From ecb78adf803de7c4a6396b2a6ecbb0f09a9f0513 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 17 Oct 2010 21:56:26 +0000 Subject: Import the binutils-2_15-branch from the sourceware CVS repository, exactly as it was on Sun, 23 May 2004 04:40:32 +0000. Corresponds to git commit 242eda977694c559d7d21626702034c13d745597. --- .cvsignore | 32 + COPYING | 340 + COPYING.LIB | 482 + COPYING.LIBGLOSS | 297 + COPYING.NEWLIB | 760 + bfd/COPYING | 340 + bfd/aix386-core.c | 272 + bfd/aix5ppc-core.c | 367 + bfd/aout-adobe.c | 571 + bfd/aout-cris.c | 307 + bfd/aout-ns32k.c | 379 + bfd/aout-tic30.c | 1102 + bfd/cf-i386lynx.c | 31 + bfd/cf-m68klynx.c | 28 + bfd/cf-sparclynx.c | 28 + bfd/cisco-core.c | 429 + bfd/coff-a29k.c | 584 + bfd/coff-apollo.c | 121 + bfd/coff-go32.c | 45 + bfd/coff-h8300.c | 1444 + bfd/coff-h8500.c | 306 + bfd/coff-i860.c | 712 + bfd/coff-i960.c | 665 + bfd/coff-m68k.c | 538 + bfd/coff-m88k.c | 291 + bfd/coff-mcore.c | 599 + bfd/coff-or32.c | 662 + bfd/coff-pmac.c | 33 + bfd/coff-sh.c | 3341 + bfd/coff-stgo32.c | 413 + bfd/coff-svm68k.c | 26 + bfd/coff-tic30.c | 210 + bfd/coff-tic4x.c | 270 + bfd/coff-tic54x.c | 668 + bfd/coff-tic80.c | 723 + bfd/coff-u68k.c | 35 + bfd/coff-w65.c | 383 + bfd/coff-we32k.c | 69 + bfd/coff-z8k.c | 343 + bfd/configure.com | 215 + bfd/cpu-a29k.c | 39 + bfd/cpu-avr.c | 93 + bfd/cpu-cris.c | 57 + bfd/cpu-d10v.c | 71 + bfd/cpu-d30v.c | 39 + bfd/cpu-dlx.c | 39 + bfd/cpu-fr30.c | 38 + bfd/cpu-frv.c | 60 + bfd/cpu-h8300.c | 251 + bfd/cpu-h8500.c | 198 + bfd/cpu-hppa.c | 89 + bfd/cpu-i370.c | 74 + bfd/cpu-i860.c | 40 + bfd/cpu-i960.c | 182 + bfd/cpu-ip2k.c | 54 + bfd/cpu-iq2000.c | 56 + bfd/cpu-m10200.c | 38 + bfd/cpu-m10300.c | 70 + bfd/cpu-m32r.c | 38 + bfd/cpu-m68hc11.c | 38 + bfd/cpu-m68hc12.c | 54 + bfd/cpu-m68k.c | 47 + bfd/cpu-m88k.c | 39 + bfd/cpu-mcore.c | 38 + bfd/cpu-mmix.c | 41 + bfd/cpu-msp430.c | 109 + bfd/cpu-ns32k.c | 836 + bfd/cpu-openrisc.c | 42 + bfd/cpu-or32.c | 40 + bfd/cpu-pdp11.c | 39 + bfd/cpu-pj.c | 39 + bfd/cpu-sh.c | 226 + bfd/cpu-tic30.c | 39 + bfd/cpu-tic4x.c | 85 + bfd/cpu-tic54x.c | 39 + bfd/cpu-tic80.c | 39 + bfd/cpu-v850.c | 42 + bfd/cpu-vax.c | 39 + bfd/cpu-w65.c | 54 + bfd/cpu-we32k.c | 39 + bfd/cpu-xstormy16.c | 38 + bfd/cpu-xtensa.c | 38 + bfd/cpu-z8k.c | 47 + bfd/doc/bfd.info | 88 + bfd/doc/bfd.info-1 | 7684 + bfd/doc/bfd.info-2 | 1396 + bfd/doc/bfd.texi | 585 - bfd/doc/makefile.vms | 5 + bfd/elf-hppa.h | 2184 + bfd/elf-m10200.c | 1414 + bfd/elf-m10300.c | 4886 + bfd/elf32-am33lin.c | 35 + bfd/elf32-avr.c | 918 + bfd/elf32-cris.c | 3121 + bfd/elf32-d10v.c | 608 + bfd/elf32-d30v.c | 562 + bfd/elf32-dlx.c | 660 + bfd/elf32-fr30.c | 757 + bfd/elf32-frv.c | 4784 + bfd/elf32-h8300.c | 1577 + bfd/elf32-hppa.c | 4194 + bfd/elf32-hppa.h | 77 + bfd/elf32-i370.c | 1562 + bfd/elf32-i386-fbsd.c | 56 - bfd/elf32-i860.c | 1253 + bfd/elf32-i960.c | 166 + bfd/elf32-ip2k.c | 1675 + bfd/elf32-iq2000.c | 953 + bfd/elf32-m32r.c | 4811 + bfd/elf32-m68hc11.c | 1309 + bfd/elf32-m68hc12.c | 577 + bfd/elf32-m68hc1x.c | 1399 + bfd/elf32-m68hc1x.h | 196 + bfd/elf32-m68k.c | 2264 + bfd/elf32-m88k.c | 36 + bfd/elf32-mcore.c | 696 + bfd/elf32-msp430.c | 707 + bfd/elf32-openrisc.c | 613 + bfd/elf32-or32.c | 552 + bfd/elf32-pj.c | 349 + bfd/elf32-sh.c | 7577 + bfd/elf32-sh64-com.c | 250 + bfd/elf32-sh64.c | 808 + bfd/elf32-sh64.h | 88 + bfd/elf32-v850.c | 3200 + bfd/elf32-vax.c | 2164 + bfd/elf32-xstormy16.c | 1086 + bfd/elf32-xtensa.c | 5864 + bfd/elf64-alpha-fbsd.c | 56 - bfd/elf64-hppa.c | 2796 + bfd/elf64-hppa.h | 50 + bfd/elf64-mmix.c | 3032 + bfd/elf64-sh64.c | 4245 + bfd/elf64-sparc.c | 6 +- bfd/elflink.h | 8532 - bfd/epoc-pe-arm.c | 37 + bfd/epoc-pei-arm.c | 30 + bfd/go32stub.h | 128 + bfd/hosts/alphavms.h | 68 + bfd/hosts/delta68.h | 18 + bfd/hosts/dpx2.h | 8 + bfd/hosts/hp300bsd.h | 13 + bfd/hosts/i386mach3.h | 25 + bfd/hosts/i860mach3.h | 27 + bfd/hosts/m68kaux.h | 16 + bfd/hosts/m68klinux.h | 6 + bfd/hosts/m88kmach3.h | 11 + bfd/hosts/news.h | 9 + bfd/hosts/pc532mach.h | 24 + bfd/hosts/riscos.h | 10 + bfd/hosts/symmetry.h | 20 + bfd/hosts/tahoe.h | 12 + bfd/hosts/vaxbsd.h | 19 + bfd/hosts/vaxult.h | 8 + bfd/hosts/vaxult2.h | 8 + bfd/hp300bsd.c | 40 + bfd/hp300hpux.c | 883 + bfd/hppabsd-core.c | 295 + bfd/hpux-core.c | 407 + bfd/i386dynix.c | 81 + bfd/i386lynx.c | 582 + bfd/i386mach3.c | 70 + bfd/i386msdos.c | 256 + bfd/i386os9k.c | 382 + bfd/irix-core.c | 360 + bfd/libhppa.h | 594 + bfd/libnlm.h | 263 + bfd/liboasys.h | 83 + bfd/lynx-core.c | 234 + bfd/m68k4knetbsd.c | 36 + bfd/m68klinux.c | 781 + bfd/m68klynx.c | 57 + bfd/m68knetbsd.c | 38 + bfd/m88kmach3.c | 42 + bfd/mach-o-target.c | 117 + bfd/mach-o.c | 2227 + bfd/mach-o.h | 511 + bfd/makefile.vms | 75 + bfd/mmo.c | 3371 + bfd/mpw-config.in | 86 + bfd/mpw-make.sed | 81 + bfd/newsos3.c | 44 + bfd/nlm-target.h | 252 + bfd/nlm.c | 55 + bfd/nlm32-alpha.c | 895 + bfd/nlm32-i386.c | 451 + bfd/nlm32-ppc.c | 1046 + bfd/nlm32-sparc.c | 436 + bfd/nlm32.c | 21 + bfd/nlm64.c | 21 + bfd/nlmcode.h | 2043 + bfd/nlmswap.h | 157 + bfd/ns32k.h | 41 + bfd/ns32knetbsd.c | 56 + bfd/oasys.c | 1570 + bfd/pc532-mach.c | 114 + bfd/pdp11.c | 5041 + bfd/pe-mcore.c | 36 + bfd/pe-sh.c | 30 + bfd/pef-traceback.h | 215 + bfd/pef.c | 1292 + bfd/pef.h | 186 + bfd/pei-arm.c | 35 + bfd/pei-i386.c | 44 + bfd/pei-mcore.c | 37 + bfd/pei-ppc.c | 45 + bfd/pei-sh.c | 33 + bfd/po/.cvsignore | 1 + bfd/po/POTFILES.in | 255 - bfd/po/da.gmo | Bin 0 -> 60556 bytes bfd/po/da.po | 2745 + bfd/po/es.gmo | Bin 0 -> 71201 bytes bfd/po/es.po | 3193 + bfd/po/fr.gmo | Bin 0 -> 71749 bytes bfd/po/fr.po | 3197 + bfd/po/ja.gmo | Bin 0 -> 38616 bytes bfd/po/ja.po | 2848 + bfd/po/ro.gmo | Bin 0 -> 69038 bytes bfd/po/ro.po | 3026 + bfd/po/sv.gmo | Bin 0 -> 67266 bytes bfd/po/sv.po | 3221 + bfd/po/tr.gmo | Bin 0 -> 69529 bytes bfd/po/tr.po | 3193 + bfd/po/zh_CN.gmo | Bin 0 -> 28132 bytes bfd/po/zh_CN.po | 2702 + bfd/riscix.c | 666 + bfd/som.c | 6413 + bfd/som.h | 243 + bfd/sparclynx.c | 269 + bfd/ticoff.h | 130 + bfd/vax1knetbsd.c | 37 + bfd/vaxbsd.c | 40 + bfd/vaxnetbsd.c | 37 + bfd/versados.c | 936 + bfd/vms-gsd.c | 930 + bfd/vms-hdr.c | 461 + bfd/vms-misc.c | 1130 + bfd/vms-tir.c | 2416 + bfd/vms.c | 1873 + bfd/vms.h | 671 + bfd/xsym.c | 2484 + bfd/xsym.h | 701 + bfd/xtensa-isa.c | 593 + bfd/xtensa-modules.c | 6088 + binutils/acconfig.h | 34 - binutils/addr2line.1 | 502 - binutils/ar.1 | 891 - binutils/arlex.c | 1857 + binutils/arparse.c | 1290 + binutils/arparse.h | 35 + binutils/binutils.texi | 3469 - binutils/config.texi | 1 - binutils/configure.com | 76 + binutils/cxxfilt.man | 114 - binutils/deflex.c | 1874 + binutils/defparse.c | 370 +- binutils/defparse.h | 17 +- binutils/defparse.y | 40 +- binutils/doc/binutils.info | 3584 + binutils/doc/nlmconv.1 | 230 + binutils/doc/windres.1 | 330 + binutils/dyn-string.c | 107 - binutils/dyn-string.h | 34 - binutils/emul_aix.c | 175 + binutils/mac-binutils.r | 42 + binutils/makefile.vms-in | 98 + binutils/mpw-config.in | 27 + binutils/mpw-make.sed | 115 + binutils/nlmconv.c | 2128 + binutils/nlmconv.h | 84 + binutils/nlmheader.c | 2171 + binutils/nlmheader.h | 52 + binutils/nlmheader.y | 960 + binutils/nm.1 | 587 - binutils/objcopy.1 | 548 - binutils/objdump.1 | 770 - binutils/po/.cvsignore | 1 + binutils/po/da.gmo | Bin 0 -> 80846 bytes binutils/po/da.po | 4800 + binutils/po/es.gmo | Bin 0 -> 120925 bytes binutils/po/es.po | 5176 + binutils/po/fr.gmo | Bin 0 -> 119583 bytes binutils/po/fr.po | 5125 + binutils/po/ja.gmo | Bin 0 -> 97376 bytes binutils/po/ja.po | 4110 + binutils/po/ru.gmo | Bin 0 -> 115866 bytes binutils/po/ru.po | 4889 + binutils/po/sv.gmo | Bin 0 -> 103077 bytes binutils/po/sv.po | 5571 + binutils/po/tr.gmo | Bin 0 -> 119049 bytes binutils/po/tr.po | 5117 + binutils/po/zh_CN.gmo | Bin 0 -> 75903 bytes binutils/po/zh_CN.po | 4742 + binutils/ranlib.1 | 441 - binutils/rclex.c | 2 +- binutils/rcparse.c | 1586 +- binutils/rcparse.y | 151 +- binutils/readelf.1 | 291 - binutils/size.1 | 518 - binutils/strings.1 | 508 - binutils/strip.1 | 542 - binutils/sysinfo.c | 1512 + binutils/sysinfo.h | 22 + binutils/sysinfo.y | 11 +- binutils/syslex.c | 1720 + binutils/syslex.l | 4 +- binutils/sysroff.info | 504 + binutils/testsuite/ChangeLog | 33 + binutils/testsuite/ChangeLog-9303 | 1044 + binutils/testsuite/binutils-all/ar.exp | 256 + binutils/testsuite/binutils-all/bintest.s | 12 + binutils/testsuite/binutils-all/dlltool.exp | 47 + binutils/testsuite/binutils-all/fastcall.def | 2 + binutils/testsuite/binutils-all/hppa/addendbug.s | 23 + binutils/testsuite/binutils-all/hppa/freg.s | 23 + binutils/testsuite/binutils-all/hppa/objdump.exp | 96 + binutils/testsuite/binutils-all/nm.exp | 123 + binutils/testsuite/binutils-all/objcopy.exp | 650 + binutils/testsuite/binutils-all/objdump.exp | 163 + binutils/testsuite/binutils-all/readelf.exp | 343 + binutils/testsuite/binutils-all/readelf.h | 20 + binutils/testsuite/binutils-all/readelf.r | 4 + binutils/testsuite/binutils-all/readelf.r-64 | 4 + binutils/testsuite/binutils-all/readelf.s | 24 + binutils/testsuite/binutils-all/readelf.s-64 | 25 + binutils/testsuite/binutils-all/readelf.ss | 18 + binutils/testsuite/binutils-all/readelf.ss-64 | 13 + binutils/testsuite/binutils-all/readelf.ss-mips | 15 + binutils/testsuite/binutils-all/readelf.ss-tmips | 15 + binutils/testsuite/binutils-all/size.exp | 78 + binutils/testsuite/binutils-all/testprog.c | 30 + binutils/testsuite/binutils-all/windres/README | 26 + binutils/testsuite/binutils-all/windres/bmp1.bmp | Bin 0 -> 122 bytes .../testsuite/binutils-all/windres/bmpalign.rc | 9 + .../testsuite/binutils-all/windres/bmpalign.rsd | 38 + .../testsuite/binutils-all/windres/capstyle.rc | 5 + .../testsuite/binutils-all/windres/capstyle.rsd | 8 + .../testsuite/binutils-all/windres/checkbox.rc | 5 + .../testsuite/binutils-all/windres/checkbox.rsd | 12 + .../testsuite/binutils-all/windres/combobox.rc | 8 + .../testsuite/binutils-all/windres/combobox.rsd | 8 + binutils/testsuite/binutils-all/windres/deflang.rc | 4 + .../testsuite/binutils-all/windres/deflang.rsd | 8 + binutils/testsuite/binutils-all/windres/dialog0.rc | 4 + .../testsuite/binutils-all/windres/dialog0.rsd | 8 + binutils/testsuite/binutils-all/windres/dialog1.rc | 5 + .../testsuite/binutils-all/windres/dialog1.rsd | 8 + .../testsuite/binutils-all/windres/dialogid.rc | 9 + .../testsuite/binutils-all/windres/dialogid.rsd | 18 + .../binutils-all/windres/dialogsignature.rc | 5 + .../binutils-all/windres/dialogsignature.rsd | 8 + binutils/testsuite/binutils-all/windres/dlgfont.rc | 29 + .../testsuite/binutils-all/windres/dlgfont.rsd | 39 + .../testsuite/binutils-all/windres/edittext.rc | 4 + .../testsuite/binutils-all/windres/edittext.rsd | 8 + binutils/testsuite/binutils-all/windres/escapea.rc | 7 + .../testsuite/binutils-all/windres/escapea.rsd | 7 + binutils/testsuite/binutils-all/windres/escapex.rc | 4 + .../testsuite/binutils-all/windres/escapex.rsd | 8 + binutils/testsuite/binutils-all/windres/lang.rc | 15 + binutils/testsuite/binutils-all/windres/lang.rsd | 10 + binutils/testsuite/binutils-all/windres/listbox.rc | 4 + .../testsuite/binutils-all/windres/listbox.rsd | 8 + binutils/testsuite/binutils-all/windres/msupdate | 40 + .../testsuite/binutils-all/windres/nocaption.rc | 4 + .../testsuite/binutils-all/windres/nocaption.rsd | 8 + .../testsuite/binutils-all/windres/printstyle.rc | 6 + .../testsuite/binutils-all/windres/printstyle.rsd | 8 + .../testsuite/binutils-all/windres/quoteclass.rc | 8 + .../testsuite/binutils-all/windres/scrollbar.rc | 4 + .../testsuite/binutils-all/windres/scrollbar.rsd | 8 + binutils/testsuite/binutils-all/windres/strtab1.rc | 8 + .../testsuite/binutils-all/windres/strtab1.rsd | 8 + binutils/testsuite/binutils-all/windres/sublang.rc | 5 + .../testsuite/binutils-all/windres/sublang.rsd | 8 + .../testsuite/binutils-all/windres/windres.exp | 149 + binutils/testsuite/config/default.exp | 103 + binutils/testsuite/config/hppa.sed | 4 + binutils/testsuite/lib/utils-lib.exp | 151 + binutils/windres.c | 1003 + binutils/windres.h | 851 + binutils/winduni.c | 140 + binutils/winduni.h | 60 + config/ChangeLog | 347 +- config/accross.m4 | 98 + config/acinclude.m4 | 82 +- config/acx.m4 | 157 + config/gettext.m4 | 66 + config/mh-cxux | 2 - config/mh-cygwin | 6 + config/mh-dgux386 | 5 + config/mh-djgpp | 14 + config/mh-i370pic | 1 + config/mh-interix | 7 + config/mh-lynxrs6k | 2 + config/mh-m68kpic | 1 + config/mh-ncr3000 | 4 + config/mh-necv4 | 2 - config/mh-openedition | 1 - config/mh-sco | 1 - config/mh-solaris | 3 - config/mh-sysv | 1 - config/mh-sysv4 | 2 - config/mh-sysv5 | 2 - config/mt-armpic | 1 - config/mt-d30v | 4 + config/mt-elfalphapic | 1 - config/mt-ia64pic | 1 - config/mt-netware | 1 + config/mt-papic | 1 - config/mt-ppcpic | 1 - config/mt-s390pic | 1 - config/mt-sparcpic | 1 - config/mt-v810 | 1 - config/mt-wince | 10 + config/mt-x86pic | 1 - config/no-executables.m4 | 61 + config/progtest.m4 | 91 + cpu/ChangeLog | 173 + cpu/frv.cpu | 8895 + cpu/frv.opc | 1544 + cpu/iq10.cpu | 1111 + cpu/iq2000.cpu | 1199 + cpu/iq2000.opc | 324 + cpu/iq2000m.cpu | 630 + cpu/simplify.inc | 215 + etc/ChangeLog | 9 + etc/Makefile.in | 8 +- etc/cfg-paper.texi | 717 - etc/configure.info | 2748 + etc/configure.man | 166 - etc/configure.texi | 4 +- etc/fdl.texi | 368 + etc/standards.info | 4893 + etc/texi2pod.pl | 427 + gas/COPYING | 340 + gas/README-vms | 248 + gas/acconfig.h | 79 - gas/as.h | 18 +- gas/conf.in | 127 - gas/config-gas.com | 186 + gas/config/atof-tahoe.c | 415 + gas/config/e-crisaout.c | 19 + gas/config/e-criself.c | 19 + gas/config/i386coff.mt | 1 - gas/config/m68k-parse.h | 334 + gas/config/m68k-parse.y | 1062 + gas/config/m88k-opcode.h | 559 + gas/config/obj-bout.c | 354 + gas/config/obj-bout.h | 319 + gas/config/obj-evax.c | 83 + gas/config/obj-evax.h | 95 + gas/config/obj-generic.c | 41 - gas/config/obj-generic.h | 79 - gas/config/obj-hp300.c | 53 + gas/config/obj-hp300.h | 72 + gas/config/obj-som.c | 347 + gas/config/obj-som.h | 73 + gas/config/obj-vms.c | 4933 + gas/config/obj-vms.h | 554 + gas/config/sco5.mt | 1 - gas/config/tc-a29k.c | 1297 + gas/config/tc-a29k.h | 55 + gas/config/tc-avr.c | 1300 + gas/config/tc-avr.h | 126 + gas/config/tc-cris.c | 3370 + gas/config/tc-cris.h | 170 + gas/config/tc-d10v.c | 1905 + gas/config/tc-d10v.h | 71 + gas/config/tc-d30v.c | 2253 + gas/config/tc-d30v.h | 68 + gas/config/tc-dlx.c | 1459 + gas/config/tc-dlx.h | 94 + gas/config/tc-fr30.c | 640 + gas/config/tc-fr30.h | 75 + gas/config/tc-frv.c | 1776 + gas/config/tc-frv.h | 129 + gas/config/tc-h8300.c | 2324 + gas/config/tc-h8300.h | 103 + gas/config/tc-h8500.c | 1617 + gas/config/tc-h8500.h | 57 + gas/config/tc-hppa.c | 8710 + gas/config/tc-hppa.h | 206 + gas/config/tc-i370.c | 2926 + gas/config/tc-i370.h | 69 + gas/config/tc-i860.c | 1546 + gas/config/tc-i860.h | 100 + gas/config/tc-i960.c | 3297 + gas/config/tc-i960.h | 205 + gas/config/tc-ip2k.c | 500 + gas/config/tc-ip2k.h | 70 + gas/config/tc-iq2000.c | 1199 + gas/config/tc-iq2000.h | 70 + gas/config/tc-m32r.c | 2346 + gas/config/tc-m32r.h | 133 + gas/config/tc-m68hc11.c | 3347 + gas/config/tc-m68hc11.h | 123 + gas/config/tc-m68k.c | 7371 + gas/config/tc-m68k.h | 237 + gas/config/tc-m88k.c | 1207 + gas/config/tc-m88k.h | 109 + gas/config/tc-mcore.c | 2393 + gas/config/tc-mcore.h | 112 + gas/config/tc-mmix.c | 4320 + gas/config/tc-mmix.h | 223 + gas/config/tc-mn10200.c | 1406 + gas/config/tc-mn10200.h | 50 + gas/config/tc-mn10300.c | 2809 + gas/config/tc-mn10300.h | 113 + gas/config/tc-msp430.c | 1561 + gas/config/tc-msp430.h | 114 + gas/config/tc-ns32k.c | 2439 + gas/config/tc-ns32k.h | 139 + gas/config/tc-openrisc.c | 483 + gas/config/tc-openrisc.h | 66 + gas/config/tc-or32.c | 1630 + gas/config/tc-or32.h | 71 + gas/config/tc-pdp11.c | 1762 + gas/config/tc-pdp11.h | 33 + gas/config/tc-pj.c | 589 + gas/config/tc-pj.h | 60 + gas/config/tc-sh.c | 871 +- gas/config/tc-sh.h | 152 +- gas/config/tc-sh64.c | 3504 + gas/config/tc-sh64.h | 223 + gas/config/tc-tahoe.c | 2013 + gas/config/tc-tahoe.h | 43 + gas/config/tc-tic30.c | 110 +- gas/config/tc-tic30.h | 2 + gas/config/tc-tic4x.c | 3175 + gas/config/tc-tic4x.h | 103 + gas/config/tc-tic54x.c | 5849 + gas/config/tc-tic54x.h | 130 + gas/config/tc-tic80.c | 1056 + gas/config/tc-tic80.h | 61 + gas/config/tc-v850.c | 428 +- gas/config/tc-v850.h | 40 +- gas/config/tc-vax.c | 3494 + gas/config/tc-vax.h | 83 + gas/config/tc-w65.c | 1137 + gas/config/tc-w65.h | 63 + gas/config/tc-xstormy16.c | 654 + gas/config/tc-xstormy16.h | 70 + gas/config/tc-xtensa.c | 8750 + gas/config/tc-xtensa.h | 194 + gas/config/tc-z8k.c | 719 +- gas/config/tc-z8k.h | 5 +- gas/config/te-aix5.h | 3 + gas/config/te-delt88.h | 13 + gas/config/te-delta.h | 14 + gas/config/te-dpx2.h | 12 + gas/config/te-dynix.h | 7 + gas/config/te-epoc-pe.h | 8 + gas/config/te-go32.h | 16 + gas/config/te-hp300.h | 27 + gas/config/te-hppa.h | 29 + gas/config/te-hppa64.h | 6 + gas/config/te-hppalinux64.h | 5 + gas/config/te-hpux.h | 4 + gas/config/te-i386aix.h | 23 + gas/config/te-ia64aix.h | 4 + gas/config/te-ic960.h | 37 + gas/config/te-interix.h | 16 + gas/config/te-irix.h | 31 + gas/config/te-lnews.h | 5 + gas/config/te-lynx.h | 7 + gas/config/te-mach.h | 2 + gas/config/te-macos.h | 11 + gas/config/te-multi.h | 22 - gas/config/te-nbsd532.h | 13 + gas/config/te-pc532mach.h | 13 + gas/config/te-psos.h | 18 + gas/config/te-riscix.h | 6 + gas/config/te-sun3.h | 48 + gas/config/te-wince-pe.h | 2 + gas/config/vax-inst.h | 79 + gas/config/vms-a-conf.h | 129 + gas/config/vms-conf.h | 179 + gas/config/xtensa-istack.h | 73 + gas/config/xtensa-relax.c | 1765 + gas/config/xtensa-relax.h | 142 + gas/doc/c-a29k.texi | 182 + gas/doc/c-cris.texi | 312 + gas/doc/c-d10v.texi | 257 + gas/doc/c-d30v.texi | 292 + gas/doc/c-h8300.texi | 356 + gas/doc/c-h8500.texi | 272 + gas/doc/c-hppa.texi | 264 + gas/doc/c-i370.texi | 200 + gas/doc/c-i860.texi | 172 + gas/doc/c-i960.texi | 299 + gas/doc/c-ip2k.texi | 46 + gas/doc/c-m32r.texi | 351 + gas/doc/c-m68hc11.texi | 442 + gas/doc/c-m68k.texi | 554 + gas/doc/c-m88k.texi | 66 + gas/doc/c-mmix.texi | 586 + gas/doc/c-msp430.texi | 164 + gas/doc/c-ns32k.texi | 30 + gas/doc/c-pdp11.texi | 354 + gas/doc/c-pj.texi | 28 + gas/doc/c-sh64.texi | 215 + gas/doc/c-tic54x.texi | 767 + gas/doc/c-v850.texi | 39 +- gas/doc/c-vax.texi | 358 + gas/doc/c-xtensa.texi | 740 + gas/doc/c-z8k.texi | 53 +- gas/doc/fdl.texi | 367 + gas/doc/gasp.texi | 1456 - gas/gasp.c | 3761 - gas/itbl-lex.c | 1712 + gas/itbl-parse.c | 1547 + gas/itbl-parse.h | 29 + gas/itbl-parse.y | 4 +- gas/m68k-parse.c | 2263 + gas/mac-as.r | 42 + gas/make-gas.com | 157 + gas/makefile.vms | 115 + gas/mpw-config.in | 115 + gas/mpw-make.sed | 96 + gas/po/.cvsignore | 1 + gas/po/es.gmo | Bin 0 -> 286958 bytes gas/po/es.po | 12265 + gas/po/fr.gmo | Bin 0 -> 288175 bytes gas/po/fr.po | 11753 + gas/po/tr.gmo | Bin 0 -> 277453 bytes gas/po/tr.po | 12174 + gas/tc.h | 19 + gas/testsuite/ChangeLog | 246 + gas/testsuite/ChangeLog-9303 | 6895 + gas/testsuite/config/default.exp | 49 + gas/testsuite/gas/all/align.d | 12 + gas/testsuite/gas/all/align.s | 61 + gas/testsuite/gas/all/align2.d | 9 + gas/testsuite/gas/all/align2.s | 2 + gas/testsuite/gas/all/cofftag.d | 25 + gas/testsuite/gas/all/cofftag.s | 57 + gas/testsuite/gas/all/comment.s | 3 + gas/testsuite/gas/all/cond.d | 30 + gas/testsuite/gas/all/cond.s | 32 + gas/testsuite/gas/all/diff1.s | 5 + gas/testsuite/gas/all/fastcall.s | 1 + gas/testsuite/gas/all/float.s | 4 + gas/testsuite/gas/all/gas.exp | 176 + gas/testsuite/gas/all/incbin.d | 13 + gas/testsuite/gas/all/incbin.dat | 1 + gas/testsuite/gas/all/incbin.s | 5 + gas/testsuite/gas/all/itbl | 20 + gas/testsuite/gas/all/itbl-test.c | 129 + gas/testsuite/gas/all/itbl.s | 13 + gas/testsuite/gas/all/p1480.s | 3 + gas/testsuite/gas/all/p2425.s | 6 + gas/testsuite/gas/all/struct.d | 8 + gas/testsuite/gas/all/struct.s | 10 + gas/testsuite/gas/all/test-example.c | 103 + gas/testsuite/gas/all/test-gen.c | 744 + gas/testsuite/gas/all/x930509.s | 3 + gas/testsuite/gas/alpha/alpha.exp | 44 + gas/testsuite/gas/alpha/elf-reloc-1.d | 21 + gas/testsuite/gas/alpha/elf-reloc-1.s | 16 + gas/testsuite/gas/alpha/elf-reloc-2.l | 4 + gas/testsuite/gas/alpha/elf-reloc-2.s | 8 + gas/testsuite/gas/alpha/elf-reloc-3.l | 3 + gas/testsuite/gas/alpha/elf-reloc-3.s | 2 + gas/testsuite/gas/alpha/elf-reloc-4.d | 25 + gas/testsuite/gas/alpha/elf-reloc-4.s | 4 + gas/testsuite/gas/alpha/elf-reloc-5.d | 28 + gas/testsuite/gas/alpha/elf-reloc-5.s | 31 + gas/testsuite/gas/alpha/elf-reloc-6.l | 3 + gas/testsuite/gas/alpha/elf-reloc-6.s | 31 + gas/testsuite/gas/alpha/elf-reloc-7.d | 22 + gas/testsuite/gas/alpha/elf-reloc-7.s | 26 + gas/testsuite/gas/alpha/elf-reloc-8.d | 330 + gas/testsuite/gas/alpha/elf-reloc-8.s | 1119 + gas/testsuite/gas/alpha/elf-tls-1.d | 29 + gas/testsuite/gas/alpha/elf-tls-1.s | 24 + gas/testsuite/gas/alpha/elf-tls-2.l | 9 + gas/testsuite/gas/alpha/elf-tls-2.s | 32 + gas/testsuite/gas/alpha/elf-tls-3.l | 7 + gas/testsuite/gas/alpha/elf-tls-3.s | 22 + gas/testsuite/gas/alpha/elf-usepv-1.d | 11 + gas/testsuite/gas/alpha/elf-usepv-1.s | 6 + gas/testsuite/gas/alpha/elf-usepv-2.l | 2 + gas/testsuite/gas/alpha/elf-usepv-2.s | 1 + gas/testsuite/gas/alpha/fp.d | 9 + gas/testsuite/gas/alpha/fp.s | 14 + gas/testsuite/gas/alpha/unop.d | 12 + gas/testsuite/gas/alpha/unop.s | 4 + gas/testsuite/gas/arc/adc.d | 85 + gas/testsuite/gas/arc/adc.s | 68 + gas/testsuite/gas/arc/add.d | 85 + gas/testsuite/gas/arc/add.s | 68 + gas/testsuite/gas/arc/alias.d | 68 + gas/testsuite/gas/arc/alias.s | 76 + gas/testsuite/gas/arc/and.d | 85 + gas/testsuite/gas/arc/and.s | 68 + gas/testsuite/gas/arc/arc.exp | 45 + gas/testsuite/gas/arc/asl.d | 68 + gas/testsuite/gas/arc/asl.s | 58 + gas/testsuite/gas/arc/asr.d | 51 + gas/testsuite/gas/arc/asr.s | 38 + gas/testsuite/gas/arc/b.d | 76 + gas/testsuite/gas/arc/b.s | 40 + gas/testsuite/gas/arc/bic.d | 85 + gas/testsuite/gas/arc/bic.s | 68 + gas/testsuite/gas/arc/bl.d | 76 + gas/testsuite/gas/arc/bl.s | 40 + gas/testsuite/gas/arc/branch.d | 45 + gas/testsuite/gas/arc/branch.s | 47 + gas/testsuite/gas/arc/brk.d | 11 + gas/testsuite/gas/arc/brk.s | 7 + gas/testsuite/gas/arc/extb.d | 51 + gas/testsuite/gas/arc/extb.s | 38 + gas/testsuite/gas/arc/extw.d | 51 + gas/testsuite/gas/arc/extw.s | 38 + gas/testsuite/gas/arc/flag.d | 38 + gas/testsuite/gas/arc/flag.s | 27 + gas/testsuite/gas/arc/insn3.d | 44 + gas/testsuite/gas/arc/insn3.s | 52 + gas/testsuite/gas/arc/j.d | 127 + gas/testsuite/gas/arc/j.s | 36 + gas/testsuite/gas/arc/jl.d | 25 + gas/testsuite/gas/arc/jl.s | 9 + gas/testsuite/gas/arc/ld.d | 13 + gas/testsuite/gas/arc/ld.s | 7 + gas/testsuite/gas/arc/ld2.d | 21 + gas/testsuite/gas/arc/ld2.s | 13 + gas/testsuite/gas/arc/lp.d | 76 + gas/testsuite/gas/arc/lp.s | 40 + gas/testsuite/gas/arc/lsr.d | 51 + gas/testsuite/gas/arc/lsr.s | 38 + gas/testsuite/gas/arc/math.d | 78 + gas/testsuite/gas/arc/math.s | 89 + gas/testsuite/gas/arc/mov.d | 68 + gas/testsuite/gas/arc/mov.s | 58 + gas/testsuite/gas/arc/nop.d | 9 + gas/testsuite/gas/arc/nop.s | 3 + gas/testsuite/gas/arc/or.d | 85 + gas/testsuite/gas/arc/or.s | 68 + gas/testsuite/gas/arc/rlc.d | 68 + gas/testsuite/gas/arc/rlc.s | 58 + gas/testsuite/gas/arc/ror.d | 51 + gas/testsuite/gas/arc/ror.s | 38 + gas/testsuite/gas/arc/rrc.d | 51 + gas/testsuite/gas/arc/rrc.s | 38 + gas/testsuite/gas/arc/sbc.d | 85 + gas/testsuite/gas/arc/sbc.s | 68 + gas/testsuite/gas/arc/sexb.d | 51 + gas/testsuite/gas/arc/sexb.s | 38 + gas/testsuite/gas/arc/sexw.d | 51 + gas/testsuite/gas/arc/sexw.s | 38 + gas/testsuite/gas/arc/sleep.d | 11 + gas/testsuite/gas/arc/sleep.s | 6 + gas/testsuite/gas/arc/sshift.d | 44 + gas/testsuite/gas/arc/sshift.s | 52 + gas/testsuite/gas/arc/st.d | 33 + gas/testsuite/gas/arc/st.s | 22 + gas/testsuite/gas/arc/sub.d | 85 + gas/testsuite/gas/arc/sub.s | 68 + gas/testsuite/gas/arc/swi.d | 11 + gas/testsuite/gas/arc/swi.s | 6 + gas/testsuite/gas/arc/warn.exp | 8 + gas/testsuite/gas/arc/warn.s | 11 + gas/testsuite/gas/arc/xor.d | 85 + gas/testsuite/gas/arc/xor.s | 68 + gas/testsuite/gas/arm/adrl.d | 27 + gas/testsuite/gas/arm/adrl.s | 24 + gas/testsuite/gas/arm/arch4t.s | 35 + gas/testsuite/gas/arm/arch5tej.d | 17 + gas/testsuite/gas/arm/arch5tej.s | 12 + gas/testsuite/gas/arm/archv6.d | 219 + gas/testsuite/gas/arm/archv6.s | 216 + gas/testsuite/gas/arm/arm.exp | 106 + gas/testsuite/gas/arm/arm3.s | 6 + gas/testsuite/gas/arm/arm6.s | 19 + gas/testsuite/gas/arm/arm7dm.s | 14 + gas/testsuite/gas/arm/arm7t.d | 70 + gas/testsuite/gas/arm/arm7t.s | 81 + gas/testsuite/gas/arm/armv1-bad.l | 12 + gas/testsuite/gas/arm/armv1-bad.s | 15 + gas/testsuite/gas/arm/armv1.d | 73 + gas/testsuite/gas/arm/armv1.s | 76 + gas/testsuite/gas/arm/copro.d | 41 + gas/testsuite/gas/arm/copro.s | 45 + gas/testsuite/gas/arm/el_segundo.d | 33 + gas/testsuite/gas/arm/el_segundo.s | 54 + gas/testsuite/gas/arm/float.s | 162 + gas/testsuite/gas/arm/fpa-dyadic.d | 166 + gas/testsuite/gas/arm/fpa-dyadic.s | 172 + gas/testsuite/gas/arm/fpa-mem.d | 34 + gas/testsuite/gas/arm/fpa-mem.s | 31 + gas/testsuite/gas/arm/fpa-monadic.d | 202 + gas/testsuite/gas/arm/fpa-monadic.s | 210 + gas/testsuite/gas/arm/immed.s | 11 + gas/testsuite/gas/arm/inst.d | 201 + gas/testsuite/gas/arm/inst.s | 223 + gas/testsuite/gas/arm/iwmmxt-bad.l | 9 + gas/testsuite/gas/arm/iwmmxt-bad.s | 8 + gas/testsuite/gas/arm/iwmmxt.d | 168 + gas/testsuite/gas/arm/iwmmxt.s | 204 + gas/testsuite/gas/arm/ldconst.d | 27 + gas/testsuite/gas/arm/ldconst.s | 28 + gas/testsuite/gas/arm/le-fpconst.d | 8 + gas/testsuite/gas/arm/le-fpconst.s | 8 + gas/testsuite/gas/arm/mapping.d | 18 + gas/testsuite/gas/arm/mapping.s | 19 + gas/testsuite/gas/arm/maverick.c | 529 + gas/testsuite/gas/arm/maverick.d | 477 + gas/testsuite/gas/arm/maverick.s | 470 + gas/testsuite/gas/arm/offset.s | 5 + gas/testsuite/gas/arm/pic.d | 17 + gas/testsuite/gas/arm/pic.s | 11 + gas/testsuite/gas/arm/r15-bad.l | 64 + gas/testsuite/gas/arm/r15-bad.s | 68 + gas/testsuite/gas/arm/req.l | 3 + gas/testsuite/gas/arm/req.s | 25 + gas/testsuite/gas/arm/thumb.s | 194 + gas/testsuite/gas/arm/thumbv6.d | 23 + gas/testsuite/gas/arm/thumbv6.s | 24 + gas/testsuite/gas/arm/undefined.l | 2 + gas/testsuite/gas/arm/undefined.s | 1 + gas/testsuite/gas/arm/vfp-bad.l | 9 + gas/testsuite/gas/arm/vfp-bad.s | 11 + gas/testsuite/gas/arm/vfp1.d | 193 + gas/testsuite/gas/arm/vfp1.s | 284 + gas/testsuite/gas/arm/vfp1xD.d | 241 + gas/testsuite/gas/arm/vfp1xD.s | 339 + gas/testsuite/gas/arm/vfp2.d | 17 + gas/testsuite/gas/arm/vfp2.s | 18 + gas/testsuite/gas/arm/wince_arm7t.d | 75 + gas/testsuite/gas/arm/wince_copro.d | 45 + gas/testsuite/gas/arm/wince_inst.d | 203 + gas/testsuite/gas/arm/wince_ldconst.d | 31 + gas/testsuite/gas/arm/xscale.d | 37 + gas/testsuite/gas/arm/xscale.s | 42 + gas/testsuite/gas/cfi/cfi-alpha-1.d | 29 + gas/testsuite/gas/cfi/cfi-alpha-1.s | 28 + gas/testsuite/gas/cfi/cfi-alpha-2.d | 9 + gas/testsuite/gas/cfi/cfi-alpha-2.s | 14 + gas/testsuite/gas/cfi/cfi-alpha-3.d | 36 + gas/testsuite/gas/cfi/cfi-alpha-3.s | 37 + gas/testsuite/gas/cfi/cfi-common-1.d | 23 + gas/testsuite/gas/cfi/cfi-common-1.s | 8 + gas/testsuite/gas/cfi/cfi-common-2.d | 24 + gas/testsuite/gas/cfi/cfi-common-2.s | 12 + gas/testsuite/gas/cfi/cfi-common-3.d | 17 + gas/testsuite/gas/cfi/cfi-common-3.s | 4 + gas/testsuite/gas/cfi/cfi-diag-1.l | 2 + gas/testsuite/gas/cfi/cfi-diag-1.s | 3 + gas/testsuite/gas/cfi/cfi-i386-2.d | 26 + gas/testsuite/gas/cfi/cfi-i386-2.s | 17 + gas/testsuite/gas/cfi/cfi-i386.d | 48 + gas/testsuite/gas/cfi/cfi-i386.s | 107 + gas/testsuite/gas/cfi/cfi-m68k.d | 38 + gas/testsuite/gas/cfi/cfi-m68k.s | 64 + gas/testsuite/gas/cfi/cfi-ppc-1.d | 30 + gas/testsuite/gas/cfi/cfi-ppc-1.s | 45 + gas/testsuite/gas/cfi/cfi-s390-1.d | 31 + gas/testsuite/gas/cfi/cfi-s390-1.s | 54 + gas/testsuite/gas/cfi/cfi-s390x-1.d | 34 + gas/testsuite/gas/cfi/cfi-s390x-1.s | 45 + gas/testsuite/gas/cfi/cfi-sh-1.d | 29 + gas/testsuite/gas/cfi/cfi-sh-1.s | 39 + gas/testsuite/gas/cfi/cfi-sparc-1.d | 22 + gas/testsuite/gas/cfi/cfi-sparc-1.s | 23 + gas/testsuite/gas/cfi/cfi-sparc64-1.d | 25 + gas/testsuite/gas/cfi/cfi-sparc64-1.s | 26 + gas/testsuite/gas/cfi/cfi-x86_64.d | 52 + gas/testsuite/gas/cfi/cfi-x86_64.s | 107 + gas/testsuite/gas/cfi/cfi.exp | 66 + gas/testsuite/gas/cris/addi.d | 19 + gas/testsuite/gas/cris/addi.s | 17 + gas/testsuite/gas/cris/binop-cmpmove.d | 405 + gas/testsuite/gas/cris/binop-cmpmovx.d | 232 + gas/testsuite/gas/cris/binop-extx.d | 327 + gas/testsuite/gas/cris/binop-segref.s | 95 + gas/testsuite/gas/cris/binop.d | 569 + gas/testsuite/gas/cris/binop.s | 914 + gas/testsuite/gas/cris/bork.d | 10 + gas/testsuite/gas/cris/bork.s | 6 + gas/testsuite/gas/cris/branch-warn-1.s | 9 + gas/testsuite/gas/cris/branch-warn-2.s | 11 + gas/testsuite/gas/cris/branch-warn-3.s | 11 + gas/testsuite/gas/cris/branch.d | 519 + gas/testsuite/gas/cris/branch.s | 270 + gas/testsuite/gas/cris/break.d | 27 + gas/testsuite/gas/cris/break.s | 22 + gas/testsuite/gas/cris/brokw-1.d | 20 + gas/testsuite/gas/cris/brokw-1.s | 19 + gas/testsuite/gas/cris/brokw-2.d | 25 + gas/testsuite/gas/cris/brokw-2.s | 22 + gas/testsuite/gas/cris/brokw-3.d | 228 + gas/testsuite/gas/cris/brokw-3.s | 112 + gas/testsuite/gas/cris/bwtest-err-1.s | 92 + gas/testsuite/gas/cris/ccr.d | 71 + gas/testsuite/gas/cris/ccr.s | 80 + gas/testsuite/gas/cris/clear.d | 323 + gas/testsuite/gas/cris/continue.d | 10 + gas/testsuite/gas/cris/continue.s | 7 + gas/testsuite/gas/cris/cris.exp | 561 + gas/testsuite/gas/cris/diffexp-ovwr.d | 26 + gas/testsuite/gas/cris/diffexp-ovwr.s | 22 + gas/testsuite/gas/cris/fragtest.d | 64 + gas/testsuite/gas/cris/fragtest.s | 66 + gas/testsuite/gas/cris/jump-type.d | 219 + gas/testsuite/gas/cris/labfloat.d | 12 + gas/testsuite/gas/cris/labfloat.s | 9 + gas/testsuite/gas/cris/macroat.d | 14 + gas/testsuite/gas/cris/macroat.s | 13 + gas/testsuite/gas/cris/movem-to-reg.d | 165 + gas/testsuite/gas/cris/mulbug-err-1.s | 55 + gas/testsuite/gas/cris/nosep.d | 10 + gas/testsuite/gas/cris/nosep.s | 8 + gas/testsuite/gas/cris/oneop-type.d | 15 + gas/testsuite/gas/cris/operand-err-1.s | 46 + gas/testsuite/gas/cris/pic-err-1.s | 20 + gas/testsuite/gas/cris/prefix.d | 94 + gas/testsuite/gas/cris/prefix.s | 247 + gas/testsuite/gas/cris/pushpop-byte-sreg.d | 39 + gas/testsuite/gas/cris/pushpop-dcr1-sreg.d | 15 + gas/testsuite/gas/cris/pushpop-dword-sreg.d | 39 + gas/testsuite/gas/cris/pushpop-word-sreg.d | 39 + gas/testsuite/gas/cris/pushpop.d | 89 + gas/testsuite/gas/cris/pushpop.s | 121 + gas/testsuite/gas/cris/quick-s6.d | 24 + gas/testsuite/gas/cris/quick-u5.d | 17 + gas/testsuite/gas/cris/quick-u6.d | 26 + gas/testsuite/gas/cris/quick.s | 51 + gas/testsuite/gas/cris/range-err-1.s | 69 + gas/testsuite/gas/cris/range-err-2.s | 10 + gas/testsuite/gas/cris/rd-bcnst.d | 22 + gas/testsuite/gas/cris/rd-bcnst.s | 3 + gas/testsuite/gas/cris/rd-dw2-1.d | 52 + gas/testsuite/gas/cris/rd-dw2-10.d | 11 + gas/testsuite/gas/cris/rd-dw2-11.d | 46 + gas/testsuite/gas/cris/rd-dw2-12.d | 93 + gas/testsuite/gas/cris/rd-dw2-13.d | 34 + gas/testsuite/gas/cris/rd-dw2-14.d | 30 + gas/testsuite/gas/cris/rd-dw2-15.d | 162 + gas/testsuite/gas/cris/rd-dw2-2.d | 35 + gas/testsuite/gas/cris/rd-dw2-3.d | 12 + gas/testsuite/gas/cris/rd-dw2-4.d | 13 + gas/testsuite/gas/cris/rd-dw2-5.d | 14 + gas/testsuite/gas/cris/rd-dw2-6.d | 230 + gas/testsuite/gas/cris/rd-dw2-7.d | 15 + gas/testsuite/gas/cris/rd-dw2-8.d | 17 + gas/testsuite/gas/cris/rd-dw2-9.d | 63 + gas/testsuite/gas/cris/rd-mulbug-1.d | 24 + gas/testsuite/gas/cris/rd-pcrel1.d | 45 + gas/testsuite/gas/cris/rd-pcrel1.s | 56 + gas/testsuite/gas/cris/rd-pcrel2.d | 52 + gas/testsuite/gas/cris/rd-pcrel2.s | 60 + gas/testsuite/gas/cris/rd-pic-1.d | 58 + gas/testsuite/gas/cris/rd-pic-1.s | 31 + gas/testsuite/gas/cris/rd-regprefix-1.d | 34 + gas/testsuite/gas/cris/rd-regprefix-1.s | 41 + gas/testsuite/gas/cris/rd-regprefix-1b.d | 43 + gas/testsuite/gas/cris/reg-to-mem.d | 165 + gas/testsuite/gas/cris/regprefix-err-1.s | 34 + gas/testsuite/gas/cris/regreg.d | 16 + gas/testsuite/gas/cris/regreg.s | 18 + gas/testsuite/gas/cris/return.d | 13 + gas/testsuite/gas/cris/return.s | 11 + gas/testsuite/gas/cris/scc.d | 28 + gas/testsuite/gas/cris/scc.s | 26 + gas/testsuite/gas/cris/sep-err-1.s | 6 + gas/testsuite/gas/cris/sep-err-2.s | 6 + gas/testsuite/gas/cris/sep-err-3.s | 6 + gas/testsuite/gas/cris/separator.d | 8 + gas/testsuite/gas/cris/separator.s | 16 + gas/testsuite/gas/cris/shexpr-1.d | 8 + gas/testsuite/gas/cris/shexpr-1.s | 6 + gas/testsuite/gas/cris/sreg-to-x.d | 215 + gas/testsuite/gas/cris/string-1.d | 12 + gas/testsuite/gas/cris/string-1.s | 8 + gas/testsuite/gas/cris/string-2.d | 12 + gas/testsuite/gas/cris/string-2.s | 7 + gas/testsuite/gas/cris/test.d | 323 + gas/testsuite/gas/cris/unimplemented.d | 31 + gas/testsuite/gas/cris/unimplemented.s | 29 + gas/testsuite/gas/cris/unop-mem.d | 218 + gas/testsuite/gas/cris/unop.s | 669 + gas/testsuite/gas/cris/us-err-1.s | 8 + gas/testsuite/gas/cris/us-err-2.s | 10 + gas/testsuite/gas/cris/us-err-3.s | 10 + gas/testsuite/gas/cris/x-to-byte-sreg.d | 93 + gas/testsuite/gas/cris/x-to-dcr1-sreg.d | 58 + gas/testsuite/gas/cris/x-to-dword-sreg.d | 181 + gas/testsuite/gas/cris/x-to-word-sreg.d | 152 + gas/testsuite/gas/d10v/address-001.d | 32 + gas/testsuite/gas/d10v/address-001.s | 78 + gas/testsuite/gas/d10v/address-002.l | 3 + gas/testsuite/gas/d10v/address-002.s | 8 + gas/testsuite/gas/d10v/address-003.l | 3 + gas/testsuite/gas/d10v/address-003.s | 8 + gas/testsuite/gas/d10v/address-004.l | 3 + gas/testsuite/gas/d10v/address-004.s | 8 + gas/testsuite/gas/d10v/address-005.l | 3 + gas/testsuite/gas/d10v/address-005.s | 8 + gas/testsuite/gas/d10v/address-006.l | 3 + gas/testsuite/gas/d10v/address-006.s | 8 + gas/testsuite/gas/d10v/address-007.l | 3 + gas/testsuite/gas/d10v/address-007.s | 8 + gas/testsuite/gas/d10v/address-008.l | 3 + gas/testsuite/gas/d10v/address-008.s | 8 + gas/testsuite/gas/d10v/address-009.l | 3 + gas/testsuite/gas/d10v/address-009.s | 8 + gas/testsuite/gas/d10v/address-010.l | 3 + gas/testsuite/gas/d10v/address-010.s | 8 + gas/testsuite/gas/d10v/address-011.l | 3 + gas/testsuite/gas/d10v/address-011.s | 8 + gas/testsuite/gas/d10v/address-012.l | 3 + gas/testsuite/gas/d10v/address-012.s | 8 + gas/testsuite/gas/d10v/address-013.l | 3 + gas/testsuite/gas/d10v/address-013.s | 8 + gas/testsuite/gas/d10v/address-014.l | 3 + gas/testsuite/gas/d10v/address-014.s | 8 + gas/testsuite/gas/d10v/address-015.l | 3 + gas/testsuite/gas/d10v/address-015.s | 8 + gas/testsuite/gas/d10v/address-016.l | 3 + gas/testsuite/gas/d10v/address-016.s | 8 + gas/testsuite/gas/d10v/address-017.l | 3 + gas/testsuite/gas/d10v/address-017.s | 8 + gas/testsuite/gas/d10v/address-018.l | 3 + gas/testsuite/gas/d10v/address-018.s | 8 + gas/testsuite/gas/d10v/address-019.l | 3 + gas/testsuite/gas/d10v/address-019.s | 8 + gas/testsuite/gas/d10v/address-020.l | 3 + gas/testsuite/gas/d10v/address-020.s | 8 + gas/testsuite/gas/d10v/address-021.l | 3 + gas/testsuite/gas/d10v/address-021.s | 8 + gas/testsuite/gas/d10v/address-022.l | 3 + gas/testsuite/gas/d10v/address-022.s | 8 + gas/testsuite/gas/d10v/address-023.l | 3 + gas/testsuite/gas/d10v/address-023.s | 8 + gas/testsuite/gas/d10v/address-024.l | 3 + gas/testsuite/gas/d10v/address-024.s | 8 + gas/testsuite/gas/d10v/address-025.l | 3 + gas/testsuite/gas/d10v/address-025.s | 8 + gas/testsuite/gas/d10v/address-026.l | 3 + gas/testsuite/gas/d10v/address-026.s | 8 + gas/testsuite/gas/d10v/address-027.l | 3 + gas/testsuite/gas/d10v/address-027.s | 8 + gas/testsuite/gas/d10v/address-028.l | 3 + gas/testsuite/gas/d10v/address-028.s | 8 + gas/testsuite/gas/d10v/address-029.l | 3 + gas/testsuite/gas/d10v/address-029.s | 8 + gas/testsuite/gas/d10v/address-030.l | 3 + gas/testsuite/gas/d10v/address-030.s | 8 + gas/testsuite/gas/d10v/address-031.l | 3 + gas/testsuite/gas/d10v/address-031.s | 8 + gas/testsuite/gas/d10v/address-032.l | 3 + gas/testsuite/gas/d10v/address-032.s | 8 + gas/testsuite/gas/d10v/address-033.l | 3 + gas/testsuite/gas/d10v/address-033.s | 8 + gas/testsuite/gas/d10v/address-034.l | 3 + gas/testsuite/gas/d10v/address-034.s | 8 + gas/testsuite/gas/d10v/address-035.l | 3 + gas/testsuite/gas/d10v/address-035.s | 8 + gas/testsuite/gas/d10v/address-036.l | 3 + gas/testsuite/gas/d10v/address-036.s | 8 + gas/testsuite/gas/d10v/address-037.l | 3 + gas/testsuite/gas/d10v/address-037.s | 8 + gas/testsuite/gas/d10v/address-038.l | 3 + gas/testsuite/gas/d10v/address-038.s | 8 + gas/testsuite/gas/d10v/address-039.l | 3 + gas/testsuite/gas/d10v/address-039.s | 8 + gas/testsuite/gas/d10v/address-040.l | 3 + gas/testsuite/gas/d10v/address-040.s | 8 + gas/testsuite/gas/d10v/address-041.l | 3 + gas/testsuite/gas/d10v/address-041.s | 8 + gas/testsuite/gas/d10v/control-001.d | 18 + gas/testsuite/gas/d10v/control-001.s | 25 + gas/testsuite/gas/d10v/d10v.exp | 102 + gas/testsuite/gas/d10v/error-001.d | 11 + gas/testsuite/gas/d10v/error-001.s | 9 + gas/testsuite/gas/d10v/error-002.d | 4 + gas/testsuite/gas/d10v/error-002.s | 9 + gas/testsuite/gas/d10v/immediate-001.d | 24 + gas/testsuite/gas/d10v/immediate-001.s | 32 + gas/testsuite/gas/d10v/immediate-002.d | 9 + gas/testsuite/gas/d10v/immediate-002.s | 9 + gas/testsuite/gas/d10v/immediate-003.d | 10 + gas/testsuite/gas/d10v/immediate-003.s | 8 + gas/testsuite/gas/d10v/immediate-004.d | 2 + gas/testsuite/gas/d10v/immediate-004.s | 8 + gas/testsuite/gas/d10v/immediate-005.d | 2 + gas/testsuite/gas/d10v/immediate-005.s | 7 + gas/testsuite/gas/d10v/immediate-006.d | 19 + gas/testsuite/gas/d10v/immediate-006.s | 14 + gas/testsuite/gas/d10v/immediate-007.d | 13 + gas/testsuite/gas/d10v/immediate-007.s | 19 + gas/testsuite/gas/d10v/inst.d | 22 + gas/testsuite/gas/d10v/inst.s | 31 + gas/testsuite/gas/d10v/instruction_packing-001.d | 24 + gas/testsuite/gas/d10v/instruction_packing-001.s | 29 + gas/testsuite/gas/d10v/instruction_packing-002.d | 16 + gas/testsuite/gas/d10v/instruction_packing-002.s | 10 + gas/testsuite/gas/d10v/instruction_packing-003.d | 15 + gas/testsuite/gas/d10v/instruction_packing-003.s | 9 + gas/testsuite/gas/d10v/instruction_packing-004.d | 13 + gas/testsuite/gas/d10v/instruction_packing-004.s | 8 + gas/testsuite/gas/d10v/instruction_packing-005.d | 29 + gas/testsuite/gas/d10v/instruction_packing-005.s | 40 + gas/testsuite/gas/d10v/instruction_packing-006.d | 50 + gas/testsuite/gas/d10v/instruction_packing-006.s | 38 + gas/testsuite/gas/d10v/instruction_packing-007.d | 13 + gas/testsuite/gas/d10v/instruction_packing-007.s | 18 + gas/testsuite/gas/d10v/instruction_packing-008.d | 14 + gas/testsuite/gas/d10v/instruction_packing-009.d | 16 + gas/testsuite/gas/d10v/instruction_packing-010.d | 14 + gas/testsuite/gas/d10v/instruction_packing.d | 85 + gas/testsuite/gas/d10v/instruction_packing.s | 83 + gas/testsuite/gas/d10v/label-001.d | 1610 + gas/testsuite/gas/d10v/label-001.s | 3132 + gas/testsuite/gas/d10v/warning-001.d | 2 + gas/testsuite/gas/d10v/warning-001.s | 4 + gas/testsuite/gas/d10v/warning-002.d | 2 + gas/testsuite/gas/d10v/warning-002.s | 4 + gas/testsuite/gas/d10v/warning-003.d | 2 + gas/testsuite/gas/d10v/warning-003.s | 4 + gas/testsuite/gas/d10v/warning-004.d | 2 + gas/testsuite/gas/d10v/warning-004.s | 4 + gas/testsuite/gas/d10v/warning-005.d | 2 + gas/testsuite/gas/d10v/warning-005.s | 4 + gas/testsuite/gas/d10v/warning-006.d | 2 + gas/testsuite/gas/d10v/warning-006.s | 4 + gas/testsuite/gas/d10v/warning-007.d | 2 + gas/testsuite/gas/d10v/warning-007.s | 4 + gas/testsuite/gas/d10v/warning-008.d | 2 + gas/testsuite/gas/d10v/warning-008.s | 5 + gas/testsuite/gas/d10v/warning-009.d | 2 + gas/testsuite/gas/d10v/warning-009.s | 5 + gas/testsuite/gas/d10v/warning-010.d | 2 + gas/testsuite/gas/d10v/warning-010.s | 6 + gas/testsuite/gas/d10v/warning-011.d | 2 + gas/testsuite/gas/d10v/warning-011.s | 7 + gas/testsuite/gas/d10v/warning-012.d | 2 + gas/testsuite/gas/d10v/warning-012.s | 6 + gas/testsuite/gas/d10v/warning-013.d | 2 + gas/testsuite/gas/d10v/warning-013.s | 6 + gas/testsuite/gas/d10v/warning-014.d | 10 + gas/testsuite/gas/d10v/warning-014.s | 8 + gas/testsuite/gas/d10v/warning-015.d | 2 + gas/testsuite/gas/d10v/warning-016.d | 2 + gas/testsuite/gas/d10v/warning-016.s | 6 + gas/testsuite/gas/d10v/warning-017.d | 2 + gas/testsuite/gas/d10v/warning-017.s | 6 + gas/testsuite/gas/d10v/warning-018.d | 2 + gas/testsuite/gas/d10v/warning-018.s | 6 + gas/testsuite/gas/d10v/warning-019.d | 2 + gas/testsuite/gas/d10v/warning-019.s | 6 + gas/testsuite/gas/d30v/align.d | 17 + gas/testsuite/gas/d30v/align.s | 28 + gas/testsuite/gas/d30v/array.d | 31 + gas/testsuite/gas/d30v/array.s | 15 + gas/testsuite/gas/d30v/bittest.d | 20 + gas/testsuite/gas/d30v/bittest.l | 52 + gas/testsuite/gas/d30v/bittest.s | 28 + gas/testsuite/gas/d30v/d30.exp | 35 + gas/testsuite/gas/d30v/guard-debug.d | 25 + gas/testsuite/gas/d30v/guard-debug.s | 17 + gas/testsuite/gas/d30v/guard.d | 17 + gas/testsuite/gas/d30v/guard.s | 24 + gas/testsuite/gas/d30v/inst.d | 265 + gas/testsuite/gas/d30v/inst.s | 504 + gas/testsuite/gas/d30v/label-debug.d | 24 + gas/testsuite/gas/d30v/label-debug.s | 11 + gas/testsuite/gas/d30v/label.d | 16 + gas/testsuite/gas/d30v/label.s | 11 + gas/testsuite/gas/d30v/mul.d | 20 + gas/testsuite/gas/d30v/mul.s | 19 + gas/testsuite/gas/d30v/opt.d | 89 + gas/testsuite/gas/d30v/opt.s | 216 + gas/testsuite/gas/d30v/reloc.d | 93 + gas/testsuite/gas/d30v/reloc.s | 68 + gas/testsuite/gas/d30v/serial.l | 46 + gas/testsuite/gas/d30v/serial.s | 14 + gas/testsuite/gas/d30v/serial2.l | 138 + gas/testsuite/gas/d30v/serial2.s | 29 + gas/testsuite/gas/d30v/serial2O.l | 99 + gas/testsuite/gas/d30v/serial2O.s | 29 + gas/testsuite/gas/d30v/warn_oddreg.l | 40 + gas/testsuite/gas/d30v/warn_oddreg.s | 12 + gas/testsuite/gas/dlx/alltests.exp | 11 + gas/testsuite/gas/dlx/branch.d | 43 + gas/testsuite/gas/dlx/branch.s | 31 + gas/testsuite/gas/dlx/itype.d | 40 + gas/testsuite/gas/dlx/itype.s | 30 + gas/testsuite/gas/dlx/lhi.d | 23 + gas/testsuite/gas/dlx/lhi.s | 10 + gas/testsuite/gas/dlx/load.d | 33 + gas/testsuite/gas/dlx/load.s | 19 + gas/testsuite/gas/dlx/lohi.d | 18 + gas/testsuite/gas/dlx/lohi.s | 9 + gas/testsuite/gas/dlx/rtype.d | 38 + gas/testsuite/gas/dlx/rtype.s | 33 + gas/testsuite/gas/dlx/store.d | 22 + gas/testsuite/gas/dlx/store.s | 9 + gas/testsuite/gas/elf/ehopt0.d | 9 + gas/testsuite/gas/elf/ehopt0.s | 32 + gas/testsuite/gas/elf/elf.exp | 57 + gas/testsuite/gas/elf/section0.d | 15 + gas/testsuite/gas/elf/section0.s | 16 + gas/testsuite/gas/elf/section1.d | 15 + gas/testsuite/gas/elf/section1.s | 32 + gas/testsuite/gas/elf/section2.e | 8 + gas/testsuite/gas/elf/section2.e-m32r | 9 + gas/testsuite/gas/elf/section2.e-mips | 10 + gas/testsuite/gas/elf/section2.e-miwmmxt | 10 + gas/testsuite/gas/elf/section2.l | 8 + gas/testsuite/gas/elf/section2.s | 3 + gas/testsuite/gas/elf/section3.d | 6 + gas/testsuite/gas/elf/section3.s | 2 + gas/testsuite/gas/elf/symver.d | 19 + gas/testsuite/gas/elf/symver.s | 6 + gas/testsuite/gas/elf/type.e | 4 + gas/testsuite/gas/elf/type.s | 18 + gas/testsuite/gas/fr30/allinsn.d | 440 + gas/testsuite/gas/fr30/allinsn.exp | 5 + gas/testsuite/gas/fr30/allinsn.s | 434 + gas/testsuite/gas/fr30/fr30.exp | 5 + gas/testsuite/gas/frv/allinsn.d | 1660 + gas/testsuite/gas/frv/allinsn.exp | 8 + gas/testsuite/gas/frv/allinsn.s | 2235 + gas/testsuite/gas/frv/fdpic.d | 51 + gas/testsuite/gas/frv/fdpic.s | 39 + gas/testsuite/gas/frv/reloc1.d | 40 + gas/testsuite/gas/frv/reloc1.s | 27 + gas/testsuite/gas/h8300/addsub.s | 16 + gas/testsuite/gas/h8300/addsubh.s | 25 + gas/testsuite/gas/h8300/addsubs.s | 25 + gas/testsuite/gas/h8300/bitops1.s | 18 + gas/testsuite/gas/h8300/bitops1h.s | 19 + gas/testsuite/gas/h8300/bitops1s.s | 29 + gas/testsuite/gas/h8300/bitops2.s | 15 + gas/testsuite/gas/h8300/bitops2h.s | 16 + gas/testsuite/gas/h8300/bitops2s.s | 23 + gas/testsuite/gas/h8300/bitops3.s | 15 + gas/testsuite/gas/h8300/bitops3h.s | 16 + gas/testsuite/gas/h8300/bitops3s.s | 24 + gas/testsuite/gas/h8300/bitops4.s | 18 + gas/testsuite/gas/h8300/bitops4h.s | 19 + gas/testsuite/gas/h8300/bitops4s.s | 29 + gas/testsuite/gas/h8300/branch-coff.s | 10 + gas/testsuite/gas/h8300/branch-elf.s | 13 + gas/testsuite/gas/h8300/branchh-coff.s | 12 + gas/testsuite/gas/h8300/branchh-elf.s | 12 + gas/testsuite/gas/h8300/branchs-coff.s | 12 + gas/testsuite/gas/h8300/branchs-elf.s | 12 + gas/testsuite/gas/h8300/cbranch.s | 23 + gas/testsuite/gas/h8300/cbranchh.s | 44 + gas/testsuite/gas/h8300/cbranchs.s | 44 + gas/testsuite/gas/h8300/cmpsi2.s | 28 + gas/testsuite/gas/h8300/compare.s | 6 + gas/testsuite/gas/h8300/compareh.s | 10 + gas/testsuite/gas/h8300/compares.s | 10 + gas/testsuite/gas/h8300/decimal.s | 5 + gas/testsuite/gas/h8300/decimalh.s | 6 + gas/testsuite/gas/h8300/decimals.s | 6 + gas/testsuite/gas/h8300/divmul.s | 5 + gas/testsuite/gas/h8300/divmulh.s | 12 + gas/testsuite/gas/h8300/divmuls.s | 12 + gas/testsuite/gas/h8300/extendh.s | 8 + gas/testsuite/gas/h8300/extends.s | 8 + gas/testsuite/gas/h8300/ffxx1-coff.d | 23 + gas/testsuite/gas/h8300/ffxx1-coff.s | 20 + gas/testsuite/gas/h8300/ffxx1-elf.d | 23 + gas/testsuite/gas/h8300/ffxx1-elf.s | 20 + gas/testsuite/gas/h8300/h8300-coff.exp | 283 + gas/testsuite/gas/h8300/h8300-elf.exp | 284 + gas/testsuite/gas/h8300/h8300.exp | 2183 + gas/testsuite/gas/h8300/h8sx_disp2.d | 46 + gas/testsuite/gas/h8300/h8sx_disp2.s | 21 + gas/testsuite/gas/h8300/h8sx_mov_imm.d | 307 + gas/testsuite/gas/h8300/h8sx_mov_imm.s | 110 + gas/testsuite/gas/h8300/h8sx_rtsl.d | 14 + gas/testsuite/gas/h8300/h8sx_rtsl.s | 8 + gas/testsuite/gas/h8300/incdec.s | 5 + gas/testsuite/gas/h8300/incdech.s | 14 + gas/testsuite/gas/h8300/incdecs.s | 14 + gas/testsuite/gas/h8300/logical.s | 14 + gas/testsuite/gas/h8300/logicalh.s | 31 + gas/testsuite/gas/h8300/logicals.s | 34 + gas/testsuite/gas/h8300/macs.s | 11 + gas/testsuite/gas/h8300/misc.s | 13 + gas/testsuite/gas/h8300/misch.s | 27 + gas/testsuite/gas/h8300/miscs.s | 41 + gas/testsuite/gas/h8300/mov32bug.s | 4 + gas/testsuite/gas/h8300/movb.s | 15 + gas/testsuite/gas/h8300/movbh.s | 20 + gas/testsuite/gas/h8300/movbs.s | 20 + gas/testsuite/gas/h8300/movlh.s | 18 + gas/testsuite/gas/h8300/movls.s | 18 + gas/testsuite/gas/h8300/movw.s | 13 + gas/testsuite/gas/h8300/movwh.s | 18 + gas/testsuite/gas/h8300/movws.s | 18 + gas/testsuite/gas/h8300/multiples.s | 17 + gas/testsuite/gas/h8300/pushpop.s | 5 + gas/testsuite/gas/h8300/pushpoph.s | 8 + gas/testsuite/gas/h8300/pushpops.s | 8 + gas/testsuite/gas/h8300/rotsh.s | 11 + gas/testsuite/gas/h8300/rotshh.s | 27 + gas/testsuite/gas/h8300/rotshs.s | 51 + gas/testsuite/gas/h8300/t01_mov.exp | 3014 + gas/testsuite/gas/h8300/t01_mov.s | 1106 + gas/testsuite/gas/h8300/t02_mova.exp | 714 + gas/testsuite/gas/h8300/t02_mova.s | 237 + gas/testsuite/gas/h8300/t03_add.exp | 3021 + gas/testsuite/gas/h8300/t03_add.s | 977 + gas/testsuite/gas/h8300/t04_sub.exp | 3020 + gas/testsuite/gas/h8300/t04_sub.s | 976 + gas/testsuite/gas/h8300/t05_cmp.exp | 2880 + gas/testsuite/gas/h8300/t05_cmp.s | 920 + gas/testsuite/gas/h8300/t06_ari2.exp | 976 + gas/testsuite/gas/h8300/t06_ari2.s | 187 + gas/testsuite/gas/h8300/t07_ari3.exp | 480 + gas/testsuite/gas/h8300/t07_ari3.s | 172 + gas/testsuite/gas/h8300/t08_or.exp | 3002 + gas/testsuite/gas/h8300/t08_or.s | 971 + gas/testsuite/gas/h8300/t09_xor.exp | 3002 + gas/testsuite/gas/h8300/t09_xor.s | 971 + gas/testsuite/gas/h8300/t10_and.exp | 3002 + gas/testsuite/gas/h8300/t10_and.s | 971 + gas/testsuite/gas/h8300/t11_logs.exp | 3173 + gas/testsuite/gas/h8300/t11_logs.s | 1176 + gas/testsuite/gas/h8300/t12_bit.exp | 582 + gas/testsuite/gas/h8300/t12_bit.s | 175 + gas/testsuite/gas/h8300/t13_otr.exp | 471 + gas/testsuite/gas/h8300/t13_otr.s | 159 + gas/testsuite/gas/hppa/README | 34 + gas/testsuite/gas/hppa/basic/add.s | 160 + gas/testsuite/gas/hppa/basic/add2.s | 92 + gas/testsuite/gas/hppa/basic/addi.s | 125 + gas/testsuite/gas/hppa/basic/basic.exp | 3864 + gas/testsuite/gas/hppa/basic/branch.s | 219 + gas/testsuite/gas/hppa/basic/branch2.s | 32 + gas/testsuite/gas/hppa/basic/comclr.s | 41 + gas/testsuite/gas/hppa/basic/copr.s | 10 + gas/testsuite/gas/hppa/basic/coprmem.s | 46 + gas/testsuite/gas/hppa/basic/dcor.s | 47 + gas/testsuite/gas/hppa/basic/dcor2.s | 34 + gas/testsuite/gas/hppa/basic/deposit.s | 79 + gas/testsuite/gas/hppa/basic/deposit2.s | 78 + gas/testsuite/gas/hppa/basic/deposit3.s | 79 + gas/testsuite/gas/hppa/basic/ds.s | 23 + gas/testsuite/gas/hppa/basic/extract.s | 42 + gas/testsuite/gas/hppa/basic/extract2.s | 42 + gas/testsuite/gas/hppa/basic/extract3.s | 43 + gas/testsuite/gas/hppa/basic/fmem.s | 43 + gas/testsuite/gas/hppa/basic/fmemLRbug.s | 76 + gas/testsuite/gas/hppa/basic/fp_comp.s | 72 + gas/testsuite/gas/hppa/basic/fp_comp2.s | 30 + gas/testsuite/gas/hppa/basic/fp_conv.s | 83 + gas/testsuite/gas/hppa/basic/fp_fcmp.s | 105 + gas/testsuite/gas/hppa/basic/fp_misc.s | 9 + gas/testsuite/gas/hppa/basic/imem.s | 84 + gas/testsuite/gas/hppa/basic/immed.s | 12 + gas/testsuite/gas/hppa/basic/logical.s | 52 + gas/testsuite/gas/hppa/basic/media.s | 38 + gas/testsuite/gas/hppa/basic/perf.s | 10 + gas/testsuite/gas/hppa/basic/purge.s | 26 + gas/testsuite/gas/hppa/basic/purge2.s | 12 + gas/testsuite/gas/hppa/basic/sh1add.s | 58 + gas/testsuite/gas/hppa/basic/sh2add.s | 58 + gas/testsuite/gas/hppa/basic/sh3add.s | 58 + gas/testsuite/gas/hppa/basic/shift.s | 25 + gas/testsuite/gas/hppa/basic/shift2.s | 24 + gas/testsuite/gas/hppa/basic/shift3.s | 26 + gas/testsuite/gas/hppa/basic/shladd.s | 161 + gas/testsuite/gas/hppa/basic/shladd2.s | 161 + gas/testsuite/gas/hppa/basic/special.s | 6 + gas/testsuite/gas/hppa/basic/spop.s | 25 + gas/testsuite/gas/hppa/basic/sub.s | 194 + gas/testsuite/gas/hppa/basic/sub2.s | 109 + gas/testsuite/gas/hppa/basic/subi.s | 57 + gas/testsuite/gas/hppa/basic/system.s | 37 + gas/testsuite/gas/hppa/basic/system2.s | 19 + gas/testsuite/gas/hppa/basic/unit.s | 60 + gas/testsuite/gas/hppa/basic/unit2.s | 47 + gas/testsuite/gas/hppa/basic/weird.s | 870 + gas/testsuite/gas/hppa/parse/align1.s | 31 + gas/testsuite/gas/hppa/parse/align2.s | 6 + gas/testsuite/gas/hppa/parse/appbug.s | 1 + gas/testsuite/gas/hppa/parse/badfmpyadd.s | 21 + gas/testsuite/gas/hppa/parse/block1.s | 11 + gas/testsuite/gas/hppa/parse/block2.s | 6 + gas/testsuite/gas/hppa/parse/calldatabug.s | 178 + gas/testsuite/gas/hppa/parse/callinfobug.s | 7 + gas/testsuite/gas/hppa/parse/defbug.s | 9 + gas/testsuite/gas/hppa/parse/entrybug.s | 12 + gas/testsuite/gas/hppa/parse/exportbug.s | 5 + gas/testsuite/gas/hppa/parse/exprbug.s | 38 + gas/testsuite/gas/hppa/parse/fixup7bug.s | 6167 + gas/testsuite/gas/hppa/parse/global.s | 7 + gas/testsuite/gas/hppa/parse/labelbug.s | 27 + gas/testsuite/gas/hppa/parse/linesepbug.s | 12 + gas/testsuite/gas/hppa/parse/lselbug.s | 10 + gas/testsuite/gas/hppa/parse/nosubspace.s | 21 + gas/testsuite/gas/hppa/parse/parse.exp | 229 + gas/testsuite/gas/hppa/parse/procbug.s | 15 + gas/testsuite/gas/hppa/parse/regpopbug.s | 9 + gas/testsuite/gas/hppa/parse/space.s | 24 + gas/testsuite/gas/hppa/parse/spacebug.s | 3 + gas/testsuite/gas/hppa/parse/ssbug.s | 10 + gas/testsuite/gas/hppa/parse/stdreg.s | 18 + gas/testsuite/gas/hppa/parse/stringer.s | 11 + gas/testsuite/gas/hppa/parse/undefbug.s | 6 + gas/testsuite/gas/hppa/parse/versionbug.s | 4 + gas/testsuite/gas/hppa/parse/xmpyubug.s | 8 + gas/testsuite/gas/hppa/reloc/applybug.s | 118 + gas/testsuite/gas/hppa/reloc/blebug.s | 7 + gas/testsuite/gas/hppa/reloc/blebug2.s | 5 + gas/testsuite/gas/hppa/reloc/blebug3.s | 5 + gas/testsuite/gas/hppa/reloc/exitbug.s | 8 + gas/testsuite/gas/hppa/reloc/fixupbug.s | 9 + gas/testsuite/gas/hppa/reloc/funcrelocbug.s | 173 + gas/testsuite/gas/hppa/reloc/labelopbug.s | 26 + gas/testsuite/gas/hppa/reloc/longcall.s | 28 + gas/testsuite/gas/hppa/reloc/picreloc.s | 9 + gas/testsuite/gas/hppa/reloc/plabelbug.s | 37 + gas/testsuite/gas/hppa/reloc/r_no_reloc.s | 34 + gas/testsuite/gas/hppa/reloc/reduce.s | 37 + gas/testsuite/gas/hppa/reloc/reduce2.s | 80 + gas/testsuite/gas/hppa/reloc/reduce3.s | 38 + gas/testsuite/gas/hppa/reloc/reloc.exp | 716 + gas/testsuite/gas/hppa/reloc/roundmode.s | 15 + gas/testsuite/gas/hppa/reloc/selectorbug.s | 18 + gas/testsuite/gas/hppa/unsorted/align3.s | 20 + gas/testsuite/gas/hppa/unsorted/align4.s | 4 + gas/testsuite/gas/hppa/unsorted/brlenbug.s | 3488 + gas/testsuite/gas/hppa/unsorted/common.s | 8 + gas/testsuite/gas/hppa/unsorted/fragbug.s | 2 + gas/testsuite/gas/hppa/unsorted/globalbug.s | 16 + gas/testsuite/gas/hppa/unsorted/importbug.s | 34 + gas/testsuite/gas/hppa/unsorted/labeldiffs.s | 39 + gas/testsuite/gas/hppa/unsorted/locallabel.s | 7 + gas/testsuite/gas/hppa/unsorted/ss_align.s | 12 + gas/testsuite/gas/hppa/unsorted/unsorted.exp | 264 + gas/testsuite/gas/i386/absrel.d | 49 + gas/testsuite/gas/i386/absrel.s | 59 + gas/testsuite/gas/i386/amd.d | 40 + gas/testsuite/gas/i386/amd.s | 33 + gas/testsuite/gas/i386/divide.d | 8 + gas/testsuite/gas/i386/divide.s | 4 + gas/testsuite/gas/i386/float.l | 85 + gas/testsuite/gas/i386/float.s | 70 + gas/testsuite/gas/i386/general.l | 290 + gas/testsuite/gas/i386/general.s | 215 + gas/testsuite/gas/i386/gotpc.d | 52 + gas/testsuite/gas/i386/gotpc.s | 40 + gas/testsuite/gas/i386/i386.exp | 105 + gas/testsuite/gas/i386/intel.d | 623 + gas/testsuite/gas/i386/intel.s | 618 + gas/testsuite/gas/i386/intel16.d | 15 + gas/testsuite/gas/i386/intel16.s | 11 + gas/testsuite/gas/i386/intelpic.d | 16 + gas/testsuite/gas/i386/intelpic.s | 11 + gas/testsuite/gas/i386/inval.l | 98 + gas/testsuite/gas/i386/inval.s | 48 + gas/testsuite/gas/i386/jump.d | 26 + gas/testsuite/gas/i386/jump.s | 24 + gas/testsuite/gas/i386/jump16.d | 40 + gas/testsuite/gas/i386/jump16.s | 43 + gas/testsuite/gas/i386/katmai.d | 172 + gas/testsuite/gas/i386/katmai.s | 167 + gas/testsuite/gas/i386/modrm.l | 1984 + gas/testsuite/gas/i386/modrm.s | 1671 + gas/testsuite/gas/i386/naked.d | 32 + gas/testsuite/gas/i386/naked.s | 25 + gas/testsuite/gas/i386/opcode.d | 574 + gas/testsuite/gas/i386/opcode.s | 567 + gas/testsuite/gas/i386/padlock.d | 21 + gas/testsuite/gas/i386/padlock.s | 18 + gas/testsuite/gas/i386/pcrel.d | 49 + gas/testsuite/gas/i386/pcrel.s | 59 + gas/testsuite/gas/i386/prefix.d | 15 + gas/testsuite/gas/i386/prefix.s | 6 + gas/testsuite/gas/i386/prescott.d | 37 + gas/testsuite/gas/i386/prescott.s | 34 + gas/testsuite/gas/i386/relax.d | 12 + gas/testsuite/gas/i386/relax.s | 18 + gas/testsuite/gas/i386/reloc.d | 20 + gas/testsuite/gas/i386/reloc.s | 11 + gas/testsuite/gas/i386/sse2.d | 156 + gas/testsuite/gas/i386/sse2.s | 149 + gas/testsuite/gas/i386/ssemmx2.d | 88 + gas/testsuite/gas/i386/ssemmx2.s | 81 + gas/testsuite/gas/i386/sub.d | 10 + gas/testsuite/gas/i386/sub.s | 11 + gas/testsuite/gas/i386/tlsd.d | 33 + gas/testsuite/gas/i386/tlsd.s | 42 + gas/testsuite/gas/i386/tlsnopic.d | 37 + gas/testsuite/gas/i386/tlsnopic.s | 54 + gas/testsuite/gas/i386/tlspic.d | 30 + gas/testsuite/gas/i386/tlspic.s | 39 + gas/testsuite/gas/i386/white.l | 24 + gas/testsuite/gas/i386/white.s | 21 + gas/testsuite/gas/i386/x86-64-inval.l | 30 + gas/testsuite/gas/i386/x86-64-inval.s | 14 + gas/testsuite/gas/i386/x86-64-opcode.d | 275 + gas/testsuite/gas/i386/x86-64-opcode.s | 396 + gas/testsuite/gas/i386/x86_64.d | 126 + gas/testsuite/gas/i386/x86_64.s | 154 + gas/testsuite/gas/i860/README.i860 | 34 + gas/testsuite/gas/i860/bitwise.d | 141 + gas/testsuite/gas/i860/bitwise.s | 150 + gas/testsuite/gas/i860/branch.d | 81 + gas/testsuite/gas/i860/branch.s | 85 + gas/testsuite/gas/i860/bte.d | 62 + gas/testsuite/gas/i860/bte.s | 55 + gas/testsuite/gas/i860/dir-align01.d | 17 + gas/testsuite/gas/i860/dir-align01.s | 11 + gas/testsuite/gas/i860/dir-intel01.d | 19 + gas/testsuite/gas/i860/dir-intel01.s | 19 + gas/testsuite/gas/i860/dir-intel02.d | 15 + gas/testsuite/gas/i860/dir-intel02.s | 13 + gas/testsuite/gas/i860/dir-intel03-err.l | 5 + gas/testsuite/gas/i860/dir-intel03-err.s | 14 + gas/testsuite/gas/i860/dual01.d | 21 + gas/testsuite/gas/i860/dual01.s | 17 + gas/testsuite/gas/i860/dual02-err.l | 2 + gas/testsuite/gas/i860/dual02-err.s | 9 + gas/testsuite/gas/i860/dual03.d | 53 + gas/testsuite/gas/i860/dual03.s | 46 + gas/testsuite/gas/i860/fldst01.d | 73 + gas/testsuite/gas/i860/fldst01.s | 75 + gas/testsuite/gas/i860/fldst02.d | 73 + gas/testsuite/gas/i860/fldst02.s | 75 + gas/testsuite/gas/i860/fldst03.d | 73 + gas/testsuite/gas/i860/fldst03.s | 75 + gas/testsuite/gas/i860/fldst04.d | 73 + gas/testsuite/gas/i860/fldst04.s | 75 + gas/testsuite/gas/i860/fldst05.d | 73 + gas/testsuite/gas/i860/fldst05.s | 75 + gas/testsuite/gas/i860/fldst06.d | 73 + gas/testsuite/gas/i860/fldst06.s | 75 + gas/testsuite/gas/i860/fldst07.d | 73 + gas/testsuite/gas/i860/fldst07.s | 75 + gas/testsuite/gas/i860/fldst08.d | 73 + gas/testsuite/gas/i860/fldst08.s | 75 + gas/testsuite/gas/i860/float01.d | 69 + gas/testsuite/gas/i860/float01.s | 84 + gas/testsuite/gas/i860/float02.d | 39 + gas/testsuite/gas/i860/float02.s | 42 + gas/testsuite/gas/i860/float03.d | 51 + gas/testsuite/gas/i860/float03.s | 64 + gas/testsuite/gas/i860/float04.d | 39 + gas/testsuite/gas/i860/float04.s | 49 + gas/testsuite/gas/i860/form.d | 63 + gas/testsuite/gas/i860/form.s | 66 + gas/testsuite/gas/i860/i860.exp | 58 + gas/testsuite/gas/i860/iarith.d | 97 + gas/testsuite/gas/i860/iarith.s | 102 + gas/testsuite/gas/i860/ldst01.d | 39 + gas/testsuite/gas/i860/ldst01.s | 35 + gas/testsuite/gas/i860/ldst02.d | 39 + gas/testsuite/gas/i860/ldst02.s | 35 + gas/testsuite/gas/i860/ldst03.d | 43 + gas/testsuite/gas/i860/ldst03.s | 39 + gas/testsuite/gas/i860/ldst04.d | 24 + gas/testsuite/gas/i860/ldst04.s | 19 + gas/testsuite/gas/i860/ldst05.d | 24 + gas/testsuite/gas/i860/ldst05.s | 19 + gas/testsuite/gas/i860/ldst06.d | 28 + gas/testsuite/gas/i860/ldst06.s | 22 + gas/testsuite/gas/i860/pfam.d | 153 + gas/testsuite/gas/i860/pfam.s | 182 + gas/testsuite/gas/i860/pfmam.d | 153 + gas/testsuite/gas/i860/pfmam.s | 182 + gas/testsuite/gas/i860/pfmsm.d | 153 + gas/testsuite/gas/i860/pfmsm.s | 182 + gas/testsuite/gas/i860/pfsm.d | 153 + gas/testsuite/gas/i860/pfsm.s | 182 + gas/testsuite/gas/i860/pseudo-ops01.d | 14 + gas/testsuite/gas/i860/pseudo-ops01.s | 10 + gas/testsuite/gas/i860/regress01.d | 21 + gas/testsuite/gas/i860/regress01.s | 19 + gas/testsuite/gas/i860/shift.d | 86 + gas/testsuite/gas/i860/shift.s | 90 + gas/testsuite/gas/i860/simd.d | 105 + gas/testsuite/gas/i860/simd.s | 119 + gas/testsuite/gas/i860/system.d | 72 + gas/testsuite/gas/i860/system.s | 76 + gas/testsuite/gas/i860/xp.d | 241 + gas/testsuite/gas/i860/xp.s | 266 + gas/testsuite/gas/ia64/alias-ilp32.d | 30 + gas/testsuite/gas/ia64/alias.d | 37 + gas/testsuite/gas/ia64/alias.s | 11 + gas/testsuite/gas/ia64/align.d | 7 + gas/testsuite/gas/ia64/align.s | 3 + gas/testsuite/gas/ia64/dependency-1.d | 17 + gas/testsuite/gas/ia64/dependency-1.s | 7 + gas/testsuite/gas/ia64/dv-branch.d | 15 + gas/testsuite/gas/ia64/dv-branch.s | 16 + gas/testsuite/gas/ia64/dv-entry-err.l | 3 + gas/testsuite/gas/ia64/dv-entry-err.s | 15 + gas/testsuite/gas/ia64/dv-imply.d | 45 + gas/testsuite/gas/ia64/dv-imply.s | 44 + gas/testsuite/gas/ia64/dv-mutex-err.l | 13 + gas/testsuite/gas/ia64/dv-mutex-err.s | 33 + gas/testsuite/gas/ia64/dv-mutex.d | 39 + gas/testsuite/gas/ia64/dv-mutex.s | 36 + gas/testsuite/gas/ia64/dv-raw-err.l | 279 + gas/testsuite/gas/ia64/dv-raw-err.s | 579 + gas/testsuite/gas/ia64/dv-safe.d | 21 + gas/testsuite/gas/ia64/dv-safe.s | 19 + gas/testsuite/gas/ia64/dv-srlz.d | 24 + gas/testsuite/gas/ia64/dv-srlz.s | 13 + gas/testsuite/gas/ia64/dv-war-err.l | 3 + gas/testsuite/gas/ia64/dv-war-err.s | 9 + gas/testsuite/gas/ia64/dv-waw-err.l | 389 + gas/testsuite/gas/ia64/dv-waw-err.s | 567 + gas/testsuite/gas/ia64/fixup-dump.pl | 12 + gas/testsuite/gas/ia64/global.d | 10 + gas/testsuite/gas/ia64/global.s | 3 + gas/testsuite/gas/ia64/ia64.exp | 58 + gas/testsuite/gas/ia64/ldxmov-1.d | 18 + gas/testsuite/gas/ia64/ldxmov-1.s | 8 + gas/testsuite/gas/ia64/ldxmov-2.l | 5 + gas/testsuite/gas/ia64/ldxmov-2.s | 8 + gas/testsuite/gas/ia64/ltoff22x-1.d | 10 + gas/testsuite/gas/ia64/ltoff22x-1.s | 4 + gas/testsuite/gas/ia64/opc-a-err.l | 18 + gas/testsuite/gas/ia64/opc-a-err.s | 24 + gas/testsuite/gas/ia64/opc-a.d | 362 + gas/testsuite/gas/ia64/opc-a.pl | 142 + gas/testsuite/gas/ia64/opc-a.s | 396 + gas/testsuite/gas/ia64/opc-b.d | 1020 + gas/testsuite/gas/ia64/opc-b.pl | 95 + gas/testsuite/gas/ia64/opc-b.s | 833 + gas/testsuite/gas/ia64/opc-f.d | 1571 + gas/testsuite/gas/ia64/opc-f.pl | 174 + gas/testsuite/gas/ia64/opc-f.s | 612 + gas/testsuite/gas/ia64/opc-i.d | 263 + gas/testsuite/gas/ia64/opc-i.pl | 189 + gas/testsuite/gas/ia64/opc-i.s | 222 + gas/testsuite/gas/ia64/opc-m.d | 1358 + gas/testsuite/gas/ia64/opc-m.pl | 218 + gas/testsuite/gas/ia64/opc-m.s | 1037 + gas/testsuite/gas/ia64/opc-x.d | 38 + gas/testsuite/gas/ia64/opc-x.s | 19 + gas/testsuite/gas/ia64/order.d | 36 + gas/testsuite/gas/ia64/order.s | 37 + gas/testsuite/gas/ia64/real.d | 10 + gas/testsuite/gas/ia64/real.s | 8 + gas/testsuite/gas/ia64/regs.d | 2333 + gas/testsuite/gas/ia64/regs.pl | 150 + gas/testsuite/gas/ia64/regs.s | 1017 + gas/testsuite/gas/ia64/secname-ilp32.d | 21 + gas/testsuite/gas/ia64/secname.d | 28 + gas/testsuite/gas/ia64/secname.s | 2 + gas/testsuite/gas/ia64/tls.d | 53 + gas/testsuite/gas/ia64/tls.s | 64 + gas/testsuite/gas/ia64/unwind-ilp32.d | 22 + gas/testsuite/gas/ia64/unwind.d | 30 + gas/testsuite/gas/ia64/unwind.s | 4 + gas/testsuite/gas/ieee-fp/x930509a.exp | 27 + gas/testsuite/gas/ieee-fp/x930509a.s | 5 + gas/testsuite/gas/iq2000/allinsn.d | 442 + gas/testsuite/gas/iq2000/allinsn.exp | 6 + gas/testsuite/gas/iq2000/allinsn.s | 582 + gas/testsuite/gas/iq2000/hazard0.s | 11 + gas/testsuite/gas/iq2000/hazard1.s | 11 + gas/testsuite/gas/iq2000/hazard2.s | 11 + gas/testsuite/gas/iq2000/hazard3.s | 14 + gas/testsuite/gas/iq2000/hazard4.s | 11 + gas/testsuite/gas/iq2000/hazard5.s | 11 + gas/testsuite/gas/iq2000/load-hazards.exp | 63 + gas/testsuite/gas/iq2000/nohazard.s | 20 + gas/testsuite/gas/iq2000/noyield.s | 13 + gas/testsuite/gas/iq2000/odd-ldw.exp | 6 + gas/testsuite/gas/iq2000/odd-sdw.exp | 6 + gas/testsuite/gas/iq2000/oddldw.s | 10 + gas/testsuite/gas/iq2000/oddsdw.s | 10 + gas/testsuite/gas/iq2000/q10allinsn.d | 492 + gas/testsuite/gas/iq2000/q10allinsn.s | 641 + gas/testsuite/gas/iq2000/q10hazard3.s | 14 + gas/testsuite/gas/iq2000/q10hazard4.s | 11 + gas/testsuite/gas/iq2000/q10hazard5.s | 11 + gas/testsuite/gas/iq2000/q10load-hazards.exp | 62 + gas/testsuite/gas/iq2000/q10nohazard.s | 20 + gas/testsuite/gas/iq2000/q10noyield.s | 14 + gas/testsuite/gas/iq2000/q10test0.d | 361 + gas/testsuite/gas/iq2000/q10test0.s | 354 + gas/testsuite/gas/iq2000/q10test1.d | 317 + gas/testsuite/gas/iq2000/q10test1.s | 310 + gas/testsuite/gas/iq2000/q10test10.d | 301 + gas/testsuite/gas/iq2000/q10test10.s | 294 + gas/testsuite/gas/iq2000/q10test11.d | 225 + gas/testsuite/gas/iq2000/q10test11.s | 218 + gas/testsuite/gas/iq2000/q10test12.d | 221 + gas/testsuite/gas/iq2000/q10test12.s | 214 + gas/testsuite/gas/iq2000/q10test2.d | 319 + gas/testsuite/gas/iq2000/q10test2.s | 312 + gas/testsuite/gas/iq2000/q10test3.d | 313 + gas/testsuite/gas/iq2000/q10test3.s | 306 + gas/testsuite/gas/iq2000/q10test4.d | 315 + gas/testsuite/gas/iq2000/q10test4.s | 308 + gas/testsuite/gas/iq2000/q10test5.d | 315 + gas/testsuite/gas/iq2000/q10test5.s | 308 + gas/testsuite/gas/iq2000/q10test6.d | 315 + gas/testsuite/gas/iq2000/q10test6.s | 308 + gas/testsuite/gas/iq2000/q10test7.d | 301 + gas/testsuite/gas/iq2000/q10test7.s | 294 + gas/testsuite/gas/iq2000/q10test8.d | 327 + gas/testsuite/gas/iq2000/q10test8.s | 286 + gas/testsuite/gas/iq2000/q10test9.d | 291 + gas/testsuite/gas/iq2000/q10test9.s | 284 + gas/testsuite/gas/iq2000/q10yield.exp | 39 + gas/testsuite/gas/iq2000/test.exp | 17 + gas/testsuite/gas/iq2000/yield.exp | 39 + gas/testsuite/gas/iq2000/yield0.s | 140 + gas/testsuite/gas/iq2000/yield1.s | 9 + gas/testsuite/gas/iq2000/yield2.s | 10 + gas/testsuite/gas/m32r/allinsn.d | 374 + gas/testsuite/gas/m32r/allinsn.exp | 5 + gas/testsuite/gas/m32r/allinsn.s | 501 + gas/testsuite/gas/m32r/error.exp | 16 + gas/testsuite/gas/m32r/fslot.d | 31 + gas/testsuite/gas/m32r/fslot.s | 27 + gas/testsuite/gas/m32r/fslotx.d | 23 + gas/testsuite/gas/m32r/fslotx.s | 19 + gas/testsuite/gas/m32r/high-1.d | 19 + gas/testsuite/gas/m32r/high-1.s | 14 + gas/testsuite/gas/m32r/interfere.s | 14 + gas/testsuite/gas/m32r/m32r.exp | 9 + gas/testsuite/gas/m32r/m32r2.d | 92 + gas/testsuite/gas/m32r/m32r2.exp | 5 + gas/testsuite/gas/m32r/m32r2.s | 126 + gas/testsuite/gas/m32r/m32rx.d | 349 + gas/testsuite/gas/m32r/m32rx.exp | 7 + gas/testsuite/gas/m32r/m32rx.s | 590 + gas/testsuite/gas/m32r/outofrange.s | 145 + gas/testsuite/gas/m32r/parallel.s | 14 + gas/testsuite/gas/m32r/pic.d | 47 + gas/testsuite/gas/m32r/pic.exp | 5 + gas/testsuite/gas/m32r/pic.s | 43 + gas/testsuite/gas/m32r/relax-1.d | 18 + gas/testsuite/gas/m32r/relax-1.s | 17 + gas/testsuite/gas/m32r/relax-2.d | 18 + gas/testsuite/gas/m32r/relax-2.s | 11 + gas/testsuite/gas/m32r/signed-relocs.d | 77 + gas/testsuite/gas/m32r/signed-relocs.s | 80 + gas/testsuite/gas/m32r/uppercase.d | 26 + gas/testsuite/gas/m32r/uppercase.s | 14 + gas/testsuite/gas/m32r/wrongsize.s | 10 + gas/testsuite/gas/m68hc11/abi-m68hc11-16-32.d | 7 + gas/testsuite/gas/m68hc11/abi-m68hc11-16-64.d | 7 + gas/testsuite/gas/m68hc11/abi-m68hc11-32-32.d | 7 + gas/testsuite/gas/m68hc11/abi-m68hc11-32-64.d | 7 + gas/testsuite/gas/m68hc11/abi.s | 4 + gas/testsuite/gas/m68hc11/all_insns.d | 500 + gas/testsuite/gas/m68hc11/all_insns.s | 335 + gas/testsuite/gas/m68hc11/branchs12.d | 225 + gas/testsuite/gas/m68hc11/branchs12.s | 111 + gas/testsuite/gas/m68hc11/bug-1825.d | 128 + gas/testsuite/gas/m68hc11/bug-1825.s | 49 + gas/testsuite/gas/m68hc11/indexed12.d | 206 + gas/testsuite/gas/m68hc11/indexed12.s | 115 + gas/testsuite/gas/m68hc11/insns-dwarf2.d | 115 + gas/testsuite/gas/m68hc11/insns.d | 69 + gas/testsuite/gas/m68hc11/insns.s | 65 + gas/testsuite/gas/m68hc11/insns12.d | 85 + gas/testsuite/gas/m68hc11/insns12.s | 71 + gas/testsuite/gas/m68hc11/lbranch-dwarf2.d | 90 + gas/testsuite/gas/m68hc11/lbranch.d | 80 + gas/testsuite/gas/m68hc11/lbranch.s | 41 + gas/testsuite/gas/m68hc11/m68hc11.exp | 186 + gas/testsuite/gas/m68hc11/malis-include.s | 19 + gas/testsuite/gas/m68hc11/malis.d | 37 + gas/testsuite/gas/m68hc11/malis.s | 240 + gas/testsuite/gas/m68hc11/movb.d | 451 + gas/testsuite/gas/m68hc11/movb.s | 333 + gas/testsuite/gas/m68hc11/opers12-dwarf2.d | 241 + gas/testsuite/gas/m68hc11/opers12.d | 113 + gas/testsuite/gas/m68hc11/opers12.s | 122 + gas/testsuite/gas/m68k-coff/gas.exp | 15 + gas/testsuite/gas/m68k-coff/p2389.s | 19 + gas/testsuite/gas/m68k-coff/p2389a.s | 3 + gas/testsuite/gas/m68k-coff/p2430.s | 6 + gas/testsuite/gas/m68k-coff/p2430a.s | 4 + gas/testsuite/gas/m68k-coff/t1.s | 36 + gas/testsuite/gas/m68k/all.exp | 55 + gas/testsuite/gas/m68k/bitfield.d | 28 + gas/testsuite/gas/m68k/bitfield.s | 24 + gas/testsuite/gas/m68k/cas.d | 20 + gas/testsuite/gas/m68k/cas.s | 16 + gas/testsuite/gas/m68k/disperr.s | 16 + gas/testsuite/gas/m68k/fmoveml.d | 60 + gas/testsuite/gas/m68k/fmoveml.s | 58 + gas/testsuite/gas/m68k/link.d | 17 + gas/testsuite/gas/m68k/link.s | 13 + gas/testsuite/gas/m68k/mcf-mov3q.d | 18 + gas/testsuite/gas/m68k/mcf-mov3q.s | 16 + gas/testsuite/gas/m68k/op68000.d | 195 + gas/testsuite/gas/m68k/operands.d | 242 + gas/testsuite/gas/m68k/operands.s | 272 + gas/testsuite/gas/m68k/p2410.s | 15 + gas/testsuite/gas/m68k/p2663.s | 16 + gas/testsuite/gas/m68k/pcrel.d | 88 + gas/testsuite/gas/m68k/pcrel.s | 59 + gas/testsuite/gas/m68k/pic1.s | 5 + gas/testsuite/gas/m68k/t2.d | 8 + gas/testsuite/gas/m68k/t2.s | 6 + gas/testsuite/gas/m88k/allinsn.d | 369 + gas/testsuite/gas/m88k/allinsn.s | 460 + gas/testsuite/gas/m88k/init.d | 10 + gas/testsuite/gas/m88k/init.s | 5 + gas/testsuite/gas/m88k/m88k.exp | 26 + gas/testsuite/gas/macros/and.s | 9 + gas/testsuite/gas/macros/app1.d | 7 + gas/testsuite/gas/macros/app1.s | 10 + gas/testsuite/gas/macros/app2.d | 7 + gas/testsuite/gas/macros/app2.s | 11 + gas/testsuite/gas/macros/app3.d | 9 + gas/testsuite/gas/macros/app3.s | 13 + gas/testsuite/gas/macros/app4.d | 10 + gas/testsuite/gas/macros/app4.s | 9 + gas/testsuite/gas/macros/app4b.s | 10 + gas/testsuite/gas/macros/err.s | 5 + gas/testsuite/gas/macros/irp.d | 13 + gas/testsuite/gas/macros/irp.s | 8 + gas/testsuite/gas/macros/macros.exp | 49 + gas/testsuite/gas/macros/rept.d | 10 + gas/testsuite/gas/macros/rept.s | 3 + gas/testsuite/gas/macros/semi.d | 8 + gas/testsuite/gas/macros/semi.s | 14 + gas/testsuite/gas/macros/strings.d | 8 + gas/testsuite/gas/macros/strings.s | 17 + gas/testsuite/gas/macros/test1.d | 5 + gas/testsuite/gas/macros/test1.s | 7 + gas/testsuite/gas/macros/test2.d | 10 + gas/testsuite/gas/macros/test2.s | 9 + gas/testsuite/gas/macros/test3.d | 8 + gas/testsuite/gas/macros/test3.s | 7 + gas/testsuite/gas/mcore/allinsn.d | 401 + gas/testsuite/gas/mcore/allinsn.exp | 5 + gas/testsuite/gas/mcore/allinsn.s | 146 + gas/testsuite/gas/mips/abs.d | 16 + gas/testsuite/gas/mips/abs.s | 5 + gas/testsuite/gas/mips/add.d | 21 + gas/testsuite/gas/mips/add.s | 16 + gas/testsuite/gas/mips/and.d | 35 + gas/testsuite/gas/mips/and.s | 28 + gas/testsuite/gas/mips/baddata1.l | 3 + gas/testsuite/gas/mips/baddata1.s | 9 + gas/testsuite/gas/mips/beq.d | 49 + gas/testsuite/gas/mips/beq.s | 30 + gas/testsuite/gas/mips/bge.d | 71 + gas/testsuite/gas/mips/bge.s | 37 + gas/testsuite/gas/mips/bgeu.d | 65 + gas/testsuite/gas/mips/bgeu.s | 33 + gas/testsuite/gas/mips/blt.d | 71 + gas/testsuite/gas/mips/blt.s | 37 + gas/testsuite/gas/mips/bltu.d | 65 + gas/testsuite/gas/mips/bltu.s | 33 + gas/testsuite/gas/mips/branch-misc-1.d | 28 + gas/testsuite/gas/mips/branch-misc-1.s | 27 + gas/testsuite/gas/mips/branch-misc-2.l | 4 + gas/testsuite/gas/mips/branch-misc-2.s | 43 + gas/testsuite/gas/mips/branch-misc-2pic.l | 10 + gas/testsuite/gas/mips/branch-misc-2pic.s | 43 + gas/testsuite/gas/mips/break20.d | 18 + gas/testsuite/gas/mips/break20.s | 17 + gas/testsuite/gas/mips/cp0-names-mips32.d | 42 + gas/testsuite/gas/mips/cp0-names-mips32r2.d | 42 + gas/testsuite/gas/mips/cp0-names-mips64.d | 42 + gas/testsuite/gas/mips/cp0-names-mips64r2.d | 42 + gas/testsuite/gas/mips/cp0-names-numeric.d | 42 + gas/testsuite/gas/mips/cp0-names-sb1.d | 42 + gas/testsuite/gas/mips/cp0-names.s | 44 + gas/testsuite/gas/mips/cp0sel-names-mips32.d | 235 + gas/testsuite/gas/mips/cp0sel-names-mips32r2.d | 235 + gas/testsuite/gas/mips/cp0sel-names-mips64.d | 235 + gas/testsuite/gas/mips/cp0sel-names-mips64r2.d | 235 + gas/testsuite/gas/mips/cp0sel-names-numeric.d | 235 + gas/testsuite/gas/mips/cp0sel-names-sb1.d | 235 + gas/testsuite/gas/mips/cp0sel-names.s | 236 + gas/testsuite/gas/mips/delay.d | 20 + gas/testsuite/gas/mips/delay.s | 8 + gas/testsuite/gas/mips/div-ilocks.d | 110 + gas/testsuite/gas/mips/div.d | 125 + gas/testsuite/gas/mips/div.s | 41 + gas/testsuite/gas/mips/dli.d | 114 + gas/testsuite/gas/mips/dli.s | 67 + gas/testsuite/gas/mips/e32-rel2.d | 30 + gas/testsuite/gas/mips/e32-rel4.d | 15 + gas/testsuite/gas/mips/e32el-rel2.d | 30 + gas/testsuite/gas/mips/elempic.d | 154 + gas/testsuite/gas/mips/elf-consthilo.d | 10 + gas/testsuite/gas/mips/elf-consthilo.s | 12 + gas/testsuite/gas/mips/elf-jal.d | 26 + gas/testsuite/gas/mips/elf-rel-got-n32.d | 388 + gas/testsuite/gas/mips/elf-rel-got-n32.s | 162 + gas/testsuite/gas/mips/elf-rel-got-n64.d | 636 + gas/testsuite/gas/mips/elf-rel-got-n64.s | 162 + gas/testsuite/gas/mips/elf-rel-xgot-n32.d | 579 + gas/testsuite/gas/mips/elf-rel-xgot-n64.d | 955 + gas/testsuite/gas/mips/elf-rel.d | 59 + gas/testsuite/gas/mips/elf-rel.s | 46 + gas/testsuite/gas/mips/elf-rel10.d | 29 + gas/testsuite/gas/mips/elf-rel10.s | 31 + gas/testsuite/gas/mips/elf-rel11.d | 43 + gas/testsuite/gas/mips/elf-rel11.s | 27 + gas/testsuite/gas/mips/elf-rel12.d | 11 + gas/testsuite/gas/mips/elf-rel12.s | 14 + gas/testsuite/gas/mips/elf-rel13.d | 17 + gas/testsuite/gas/mips/elf-rel13.s | 22 + gas/testsuite/gas/mips/elf-rel14.d | 18 + gas/testsuite/gas/mips/elf-rel14.s | 10 + gas/testsuite/gas/mips/elf-rel15.d | 14 + gas/testsuite/gas/mips/elf-rel15.s | 4 + gas/testsuite/gas/mips/elf-rel16.d | 14 + gas/testsuite/gas/mips/elf-rel16.s | 8 + gas/testsuite/gas/mips/elf-rel17.d | 13 + gas/testsuite/gas/mips/elf-rel17.s | 3 + gas/testsuite/gas/mips/elf-rel18.d | 9 + gas/testsuite/gas/mips/elf-rel18.s | 5 + gas/testsuite/gas/mips/elf-rel19.d | 34 + gas/testsuite/gas/mips/elf-rel19.s | 8 + gas/testsuite/gas/mips/elf-rel2.d | 27 + gas/testsuite/gas/mips/elf-rel2.s | 29 + gas/testsuite/gas/mips/elf-rel3.d | 14 + gas/testsuite/gas/mips/elf-rel3.s | 12 + gas/testsuite/gas/mips/elf-rel4.d | 15 + gas/testsuite/gas/mips/elf-rel4.s | 12 + gas/testsuite/gas/mips/elf-rel5.d | 152 + gas/testsuite/gas/mips/elf-rel5.s | 67 + gas/testsuite/gas/mips/elf-rel6.d | 15 + gas/testsuite/gas/mips/elf-rel6.s | 19 + gas/testsuite/gas/mips/elf-rel7.d | 32 + gas/testsuite/gas/mips/elf-rel7.s | 12 + gas/testsuite/gas/mips/elf-rel8.d | 57 + gas/testsuite/gas/mips/elf-rel8.s | 53 + gas/testsuite/gas/mips/elf-rel9.d | 68 + gas/testsuite/gas/mips/elf-rel9.s | 57 + gas/testsuite/gas/mips/elf_arch_mips1.d | 10 + gas/testsuite/gas/mips/elf_arch_mips2.d | 8 + gas/testsuite/gas/mips/elf_arch_mips3.d | 8 + gas/testsuite/gas/mips/elf_arch_mips32.d | 8 + gas/testsuite/gas/mips/elf_arch_mips32r2.d | 8 + gas/testsuite/gas/mips/elf_arch_mips4.d | 8 + gas/testsuite/gas/mips/elf_arch_mips5.d | 8 + gas/testsuite/gas/mips/elf_arch_mips64.d | 8 + gas/testsuite/gas/mips/elf_arch_mips64r2.d | 8 + gas/testsuite/gas/mips/elf_ase_mips16.d | 8 + gas/testsuite/gas/mips/elf_e_flags.c | 34 + gas/testsuite/gas/mips/elf_e_flags.s | 46 + gas/testsuite/gas/mips/elf_e_flags1.d | 29 + gas/testsuite/gas/mips/elf_e_flags2.d | 28 + gas/testsuite/gas/mips/elf_e_flags3.d | 28 + gas/testsuite/gas/mips/elf_e_flags4.d | 28 + gas/testsuite/gas/mips/elfel-rel.d | 60 + gas/testsuite/gas/mips/elfel-rel2.d | 28 + gas/testsuite/gas/mips/elfel-rel3.d | 15 + gas/testsuite/gas/mips/empic.d | 154 + gas/testsuite/gas/mips/empic.l | 3 + gas/testsuite/gas/mips/empic.s | 119 + gas/testsuite/gas/mips/empic2.d | 279 + gas/testsuite/gas/mips/empic2.s | 100 + gas/testsuite/gas/mips/empic3_e.d | 47 + gas/testsuite/gas/mips/empic3_e.s | 46 + gas/testsuite/gas/mips/empic3_g1.d | 47 + gas/testsuite/gas/mips/empic3_g1.s | 46 + gas/testsuite/gas/mips/empic3_g2.d | 47 + gas/testsuite/gas/mips/empic3_g2.s | 46 + gas/testsuite/gas/mips/empty.s | 3 + gas/testsuite/gas/mips/expr1.d | 19 + gas/testsuite/gas/mips/expr1.s | 10 + gas/testsuite/gas/mips/fpr-names-32.d | 42 + gas/testsuite/gas/mips/fpr-names-64.d | 42 + gas/testsuite/gas/mips/fpr-names-n32.d | 42 + gas/testsuite/gas/mips/fpr-names-numeric.d | 42 + gas/testsuite/gas/mips/fpr-names.s | 44 + gas/testsuite/gas/mips/gpr-names-32.d | 42 + gas/testsuite/gas/mips/gpr-names-64.d | 42 + gas/testsuite/gas/mips/gpr-names-n32.d | 42 + gas/testsuite/gas/mips/gpr-names-numeric.d | 42 + gas/testsuite/gas/mips/gpr-names.s | 44 + gas/testsuite/gas/mips/hwr-names-mips32r2.d | 43 + gas/testsuite/gas/mips/hwr-names-mips64r2.d | 43 + gas/testsuite/gas/mips/hwr-names-numeric.d | 43 + gas/testsuite/gas/mips/hwr-names.s | 44 + gas/testsuite/gas/mips/illegal.l | 3 + gas/testsuite/gas/mips/illegal.s | 5 + gas/testsuite/gas/mips/itbl | 19 + gas/testsuite/gas/mips/itbl.s | 18 + gas/testsuite/gas/mips/jal-empic-elf-2.d | 48 + gas/testsuite/gas/mips/jal-empic-elf-2.s | 28 + gas/testsuite/gas/mips/jal-empic-elf-3.d | 24 + gas/testsuite/gas/mips/jal-empic-elf-3.s | 20 + gas/testsuite/gas/mips/jal-empic-elf.d | 26 + gas/testsuite/gas/mips/jal-empic.d | 26 + gas/testsuite/gas/mips/jal-newabi.d | 17 + gas/testsuite/gas/mips/jal-newabi.s | 7 + gas/testsuite/gas/mips/jal-range.l | 4 + gas/testsuite/gas/mips/jal-range.s | 7 + gas/testsuite/gas/mips/jal-svr4pic.d | 47 + gas/testsuite/gas/mips/jal-svr4pic.s | 25 + gas/testsuite/gas/mips/jal-xgot.d | 52 + gas/testsuite/gas/mips/jal.d | 25 + gas/testsuite/gas/mips/jal.s | 11 + gas/testsuite/gas/mips/la-empic.d | 105 + gas/testsuite/gas/mips/la-empic.s | 57 + gas/testsuite/gas/mips/la-svr4pic.d | 456 + gas/testsuite/gas/mips/la-xgot.d | 600 + gas/testsuite/gas/mips/la.d | 381 + gas/testsuite/gas/mips/la.s | 111 + gas/testsuite/gas/mips/lb-empic.d | 102 + gas/testsuite/gas/mips/lb-pic.s | 55 + gas/testsuite/gas/mips/lb-svr4pic.d | 182 + gas/testsuite/gas/mips/lb-xgot-ilocks.d | 214 + gas/testsuite/gas/mips/lb-xgot.d | 242 + gas/testsuite/gas/mips/lb.d | 395 + gas/testsuite/gas/mips/lb.s | 125 + gas/testsuite/gas/mips/lca-svr4pic.d | 456 + gas/testsuite/gas/mips/lca-xgot.d | 600 + gas/testsuite/gas/mips/lca.s | 111 + gas/testsuite/gas/mips/ld-empic.d | 186 + gas/testsuite/gas/mips/ld-ilocks-addr32.d | 631 + gas/testsuite/gas/mips/ld-ilocks.d | 631 + gas/testsuite/gas/mips/ld-pic.s | 60 + gas/testsuite/gas/mips/ld-svr4pic.d | 225 + gas/testsuite/gas/mips/ld-xgot.d | 273 + gas/testsuite/gas/mips/ld.d | 639 + gas/testsuite/gas/mips/ld.s | 144 + gas/testsuite/gas/mips/ldstla-32-shared.d | 80 + gas/testsuite/gas/mips/ldstla-32.d | 80 + gas/testsuite/gas/mips/ldstla-32.s | 26 + gas/testsuite/gas/mips/ldstla-n32-shared.d | 154 + gas/testsuite/gas/mips/ldstla-n32.d | 154 + gas/testsuite/gas/mips/ldstla-n32.s | 35 + gas/testsuite/gas/mips/ldstla-n64-shared.d | 181 + gas/testsuite/gas/mips/ldstla-n64.d | 181 + gas/testsuite/gas/mips/ldstla-n64.s | 42 + gas/testsuite/gas/mips/li.d | 17 + gas/testsuite/gas/mips/li.s | 12 + gas/testsuite/gas/mips/lif-empic.d | 24 + gas/testsuite/gas/mips/lif-svr4pic.d | 30 + gas/testsuite/gas/mips/lif-xgot.d | 30 + gas/testsuite/gas/mips/lifloat.d | 23 + gas/testsuite/gas/mips/lifloat.s | 24 + gas/testsuite/gas/mips/lineno.d | 100 + gas/testsuite/gas/mips/lineno.s | 60 + gas/testsuite/gas/mips/macro-warn-1-n32.d | 5 + gas/testsuite/gas/mips/macro-warn-1-n32.l | 6 + gas/testsuite/gas/mips/macro-warn-1.d | 5 + gas/testsuite/gas/mips/macro-warn-1.l | 8 + gas/testsuite/gas/mips/macro-warn-1.s | 21 + gas/testsuite/gas/mips/macro-warn-2-n32.d | 4 + gas/testsuite/gas/mips/macro-warn-2.d | 5 + gas/testsuite/gas/mips/macro-warn-2.l | 3 + gas/testsuite/gas/mips/macro-warn-2.s | 10 + gas/testsuite/gas/mips/macro-warn-3.d | 5 + gas/testsuite/gas/mips/macro-warn-3.l | 3 + gas/testsuite/gas/mips/macro-warn-3.s | 10 + gas/testsuite/gas/mips/macro-warn-4.d | 5 + gas/testsuite/gas/mips/macro-warn-4.l | 3 + gas/testsuite/gas/mips/macro-warn-4.s | 7 + gas/testsuite/gas/mips/mips-abi32-pic.d | 117 + gas/testsuite/gas/mips/mips-abi32-pic.s | 144 + gas/testsuite/gas/mips/mips-abi32-pic2.d | 74 + gas/testsuite/gas/mips/mips-abi32-pic2.s | 107 + gas/testsuite/gas/mips/mips-abi32.d | 78 + gas/testsuite/gas/mips/mips-abi32.s | 100 + gas/testsuite/gas/mips/mips-gp32-fp32-pic.d | 117 + gas/testsuite/gas/mips/mips-gp32-fp32-pic.s | 144 + gas/testsuite/gas/mips/mips-gp32-fp32.d | 78 + gas/testsuite/gas/mips/mips-gp32-fp32.s | 100 + gas/testsuite/gas/mips/mips-gp32-fp64-pic.d | 117 + gas/testsuite/gas/mips/mips-gp32-fp64-pic.s | 142 + gas/testsuite/gas/mips/mips-gp32-fp64.d | 77 + gas/testsuite/gas/mips/mips-gp32-fp64.s | 97 + gas/testsuite/gas/mips/mips-gp64-fp32-pic.d | 152 + gas/testsuite/gas/mips/mips-gp64-fp32-pic.s | 168 + gas/testsuite/gas/mips/mips-gp64-fp32.d | 100 + gas/testsuite/gas/mips/mips-gp64-fp32.l | 4 + gas/testsuite/gas/mips/mips-gp64-fp32.s | 111 + gas/testsuite/gas/mips/mips-gp64-fp64-pic.d | 153 + gas/testsuite/gas/mips/mips-gp64-fp64-pic.s | 167 + gas/testsuite/gas/mips/mips-gp64-fp64.d | 101 + gas/testsuite/gas/mips/mips-gp64-fp64.l | 4 + gas/testsuite/gas/mips/mips-gp64-fp64.s | 109 + gas/testsuite/gas/mips/mips-jalx.d | 11 + gas/testsuite/gas/mips/mips-jalx.s | 6 + gas/testsuite/gas/mips/mips-no-jalx.l | 2 + gas/testsuite/gas/mips/mips-no-jalx.s | 3 + gas/testsuite/gas/mips/mips.exp | 747 + gas/testsuite/gas/mips/mips16-64.d | 686 + gas/testsuite/gas/mips/mips16-e.d | 38 + gas/testsuite/gas/mips/mips16-e.s | 20 + gas/testsuite/gas/mips/mips16-f.d | 30 + gas/testsuite/gas/mips/mips16-f.s | 13 + gas/testsuite/gas/mips/mips16-jalx.d | 14 + gas/testsuite/gas/mips/mips16-jalx.s | 5 + gas/testsuite/gas/mips/mips16.d | 683 + gas/testsuite/gas/mips/mips16.s | 258 + gas/testsuite/gas/mips/mips32.d | 55 + gas/testsuite/gas/mips/mips32.s | 71 + gas/testsuite/gas/mips/mips32r2-ill-fp64.l | 13 + gas/testsuite/gas/mips/mips32r2-ill-fp64.s | 60 + gas/testsuite/gas/mips/mips32r2-ill.l | 15 + gas/testsuite/gas/mips/mips32r2-ill.s | 60 + gas/testsuite/gas/mips/mips32r2.d | 47 + gas/testsuite/gas/mips/mips32r2.s | 81 + gas/testsuite/gas/mips/mips4.d | 50 + gas/testsuite/gas/mips/mips4.s | 52 + gas/testsuite/gas/mips/mips4010.d | 23 + gas/testsuite/gas/mips/mips4010.s | 21 + gas/testsuite/gas/mips/mips4100.d | 12 + gas/testsuite/gas/mips/mips4100.s | 9 + gas/testsuite/gas/mips/mips4650.d | 14 + gas/testsuite/gas/mips/mips4650.s | 9 + gas/testsuite/gas/mips/mips5.d | 68 + gas/testsuite/gas/mips/mips5.l | 3 + gas/testsuite/gas/mips/mips5.s | 65 + gas/testsuite/gas/mips/mips64-mdmx.d | 215 + gas/testsuite/gas/mips/mips64-mdmx.s | 299 + gas/testsuite/gas/mips/mips64-mips3d-incl.d | 149 + gas/testsuite/gas/mips/mips64-mips3d.d | 147 + gas/testsuite/gas/mips/mips64-mips3d.l | 5 + gas/testsuite/gas/mips/mips64-mips3d.s | 160 + gas/testsuite/gas/mips/mips64.d | 17 + gas/testsuite/gas/mips/mips64.s | 22 + gas/testsuite/gas/mips/mips64r2-ill.l | 57 + gas/testsuite/gas/mips/mips64r2-ill.s | 186 + gas/testsuite/gas/mips/mips64r2.d | 46 + gas/testsuite/gas/mips/mips64r2.s | 65 + gas/testsuite/gas/mips/mipsel16-e.d | 39 + gas/testsuite/gas/mips/mipsel16-f.d | 31 + gas/testsuite/gas/mips/mul-ilocks.d | 81 + gas/testsuite/gas/mips/mul.d | 92 + gas/testsuite/gas/mips/mul.s | 27 + gas/testsuite/gas/mips/n32-consec.d | 14 + gas/testsuite/gas/mips/n32-consec.s | 4 + gas/testsuite/gas/mips/nodelay.d | 19 + gas/testsuite/gas/mips/perfcount.d | 11 + gas/testsuite/gas/mips/perfcount.s | 7 + gas/testsuite/gas/mips/relax-swap1-mips1.d | 311 + gas/testsuite/gas/mips/relax-swap1-mips2.d | 280 + gas/testsuite/gas/mips/relax-swap1.l | 24 + gas/testsuite/gas/mips/relax-swap1.s | 151 + gas/testsuite/gas/mips/relax-swap2.d | 135 + gas/testsuite/gas/mips/relax-swap2.l | 10 + gas/testsuite/gas/mips/relax-swap2.s | 50 + gas/testsuite/gas/mips/relax.d | 395 + gas/testsuite/gas/mips/relax.l | 45 + gas/testsuite/gas/mips/relax.s | 57 + gas/testsuite/gas/mips/rm7000.d | 15 + gas/testsuite/gas/mips/rm7000.s | 7 + gas/testsuite/gas/mips/rol-hw.d | 30 + gas/testsuite/gas/mips/rol-hw.l | 2 + gas/testsuite/gas/mips/rol.d | 55 + gas/testsuite/gas/mips/rol.l | 13 + gas/testsuite/gas/mips/rol.s | 27 + gas/testsuite/gas/mips/rol64-hw.d | 43 + gas/testsuite/gas/mips/rol64-hw.l | 2 + gas/testsuite/gas/mips/rol64.d | 96 + gas/testsuite/gas/mips/rol64.l | 27 + gas/testsuite/gas/mips/rol64.s | 42 + gas/testsuite/gas/mips/sb.d | 396 + gas/testsuite/gas/mips/sb.s | 124 + gas/testsuite/gas/mips/sb1-ext-mdmx.d | 115 + gas/testsuite/gas/mips/sb1-ext-mdmx.s | 169 + gas/testsuite/gas/mips/sb1-ext-ps.d | 12 + gas/testsuite/gas/mips/sb1-ext-ps.s | 16 + gas/testsuite/gas/mips/set-arch.d | 366 + gas/testsuite/gas/mips/set-arch.l | 3 + gas/testsuite/gas/mips/set-arch.s | 487 + gas/testsuite/gas/mips/sync.d | 11 + gas/testsuite/gas/mips/sync.s | 10 + gas/testsuite/gas/mips/telempic.d | 155 + gas/testsuite/gas/mips/tempic.d | 155 + gas/testsuite/gas/mips/tmips16-e.d | 39 + gas/testsuite/gas/mips/tmips16-f.d | 31 + gas/testsuite/gas/mips/tmipsel16-e.d | 39 + gas/testsuite/gas/mips/tmipsel16-f.d | 31 + gas/testsuite/gas/mips/trap20.d | 20 + gas/testsuite/gas/mips/trap20.s | 18 + gas/testsuite/gas/mips/trunc.d | 29 + gas/testsuite/gas/mips/trunc.s | 6 + gas/testsuite/gas/mips/uld.d | 270 + gas/testsuite/gas/mips/uld.s | 66 + gas/testsuite/gas/mips/uld2-eb.d | 26 + gas/testsuite/gas/mips/uld2-el.d | 26 + gas/testsuite/gas/mips/uld2.l | 3 + gas/testsuite/gas/mips/uld2.s | 15 + gas/testsuite/gas/mips/ulh-empic.d | 91 + gas/testsuite/gas/mips/ulh-pic.s | 36 + gas/testsuite/gas/mips/ulh-svr4pic.d | 124 + gas/testsuite/gas/mips/ulh-xgot.d | 154 + gas/testsuite/gas/mips/ulh.d | 374 + gas/testsuite/gas/mips/ulh.s | 69 + gas/testsuite/gas/mips/ulh2-eb.d | 44 + gas/testsuite/gas/mips/ulh2-el.d | 44 + gas/testsuite/gas/mips/ulh2.l | 9 + gas/testsuite/gas/mips/ulh2.s | 21 + gas/testsuite/gas/mips/ulw.d | 270 + gas/testsuite/gas/mips/ulw.s | 66 + gas/testsuite/gas/mips/ulw2-eb-ilocks.d | 26 + gas/testsuite/gas/mips/ulw2-eb.d | 28 + gas/testsuite/gas/mips/ulw2-el-ilocks.d | 26 + gas/testsuite/gas/mips/ulw2-el.d | 28 + gas/testsuite/gas/mips/ulw2.l | 3 + gas/testsuite/gas/mips/ulw2.s | 15 + gas/testsuite/gas/mips/usd.d | 270 + gas/testsuite/gas/mips/usd.s | 66 + gas/testsuite/gas/mips/ush.d | 455 + gas/testsuite/gas/mips/ush.s | 65 + gas/testsuite/gas/mips/usw.d | 270 + gas/testsuite/gas/mips/usw.s | 66 + gas/testsuite/gas/mips/vr4111.d | 11 + gas/testsuite/gas/mips/vr4111.s | 2 + gas/testsuite/gas/mips/vr4120.d | 29 + gas/testsuite/gas/mips/vr4120.s | 19 + gas/testsuite/gas/mips/vr4122.d | 68 + gas/testsuite/gas/mips/vr4122.s | 65 + gas/testsuite/gas/mips/vr5400.d | 130 + gas/testsuite/gas/mips/vr5400.s | 125 + gas/testsuite/gas/mips/vr5500.d | 51 + gas/testsuite/gas/mips/vr5500.s | 80 + gas/testsuite/gas/mmix/1cjmp1b-n.d | 12 + gas/testsuite/gas/mmix/1cjmp1b-r.d | 15 + gas/testsuite/gas/mmix/1cjmp1b.d | 10 + gas/testsuite/gas/mmix/1cjmp1b.l | 14 + gas/testsuite/gas/mmix/1cjmp1b.s | 4 + gas/testsuite/gas/mmix/1cjmp1brn.d | 15 + gas/testsuite/gas/mmix/1hjmp1b.d | 10 + gas/testsuite/gas/mmix/1hjmp1b.l | 14 + gas/testsuite/gas/mmix/1hjmp1b.s | 4 + gas/testsuite/gas/mmix/align-1.d | 18 + gas/testsuite/gas/mmix/align-1.s | 11 + gas/testsuite/gas/mmix/basep-1.d | 10 + gas/testsuite/gas/mmix/basep-1.s | 4 + gas/testsuite/gas/mmix/basep-10.d | 33 + gas/testsuite/gas/mmix/basep-10.s | 16 + gas/testsuite/gas/mmix/basep-11.d | 25 + gas/testsuite/gas/mmix/basep-11.s | 13 + gas/testsuite/gas/mmix/basep-1b.d | 14 + gas/testsuite/gas/mmix/basep-2.d | 23 + gas/testsuite/gas/mmix/basep-2.s | 12 + gas/testsuite/gas/mmix/basep-2b.d | 26 + gas/testsuite/gas/mmix/basep-3.d | 13 + gas/testsuite/gas/mmix/basep-3.s | 5 + gas/testsuite/gas/mmix/basep-3b.d | 17 + gas/testsuite/gas/mmix/basep-4.d | 14 + gas/testsuite/gas/mmix/basep-5.d | 26 + gas/testsuite/gas/mmix/basep-6.d | 17 + gas/testsuite/gas/mmix/basep-7.d | 34 + gas/testsuite/gas/mmix/basep-8.d | 30 + gas/testsuite/gas/mmix/basep-8.s | 9 + gas/testsuite/gas/mmix/basep-9.d | 28 + gas/testsuite/gas/mmix/basep-9.s | 9 + gas/testsuite/gas/mmix/bspec-1.d | 26 + gas/testsuite/gas/mmix/bspec-1.s | 4 + gas/testsuite/gas/mmix/bspec-2.d | 26 + gas/testsuite/gas/mmix/bspec-2.s | 11 + gas/testsuite/gas/mmix/builtin1.d | 22 + gas/testsuite/gas/mmix/builtin1.s | 8 + gas/testsuite/gas/mmix/builtin2.d | 24 + gas/testsuite/gas/mmix/builtin3.d | 24 + gas/testsuite/gas/mmix/byte-1.d | 41 + gas/testsuite/gas/mmix/byte-1.s | 6 + gas/testsuite/gas/mmix/bz-c.d | 30 + gas/testsuite/gas/mmix/bz-c.s | 5 + gas/testsuite/gas/mmix/comment-1.d | 45 + gas/testsuite/gas/mmix/comment-1.s | 46 + gas/testsuite/gas/mmix/comment-2.d | 15 + gas/testsuite/gas/mmix/comment-2.s | 1 + gas/testsuite/gas/mmix/comment-3.d | 19 + gas/testsuite/gas/mmix/comment-3.s | 2 + gas/testsuite/gas/mmix/cons-1.d | 7 + gas/testsuite/gas/mmix/cons-1.s | 2 + gas/testsuite/gas/mmix/cons-2.d | 14 + gas/testsuite/gas/mmix/cons-2.s | 4 + gas/testsuite/gas/mmix/err-bpo1.s | 12 + gas/testsuite/gas/mmix/err-bpo2.s | 6 + gas/testsuite/gas/mmix/err-bpo3.s | 13 + gas/testsuite/gas/mmix/err-bpo4.s | 7 + gas/testsuite/gas/mmix/err-bpo5.s | 14 + gas/testsuite/gas/mmix/err-bpo6.s | 21 + gas/testsuite/gas/mmix/err-bspec-1.s | 4 + gas/testsuite/gas/mmix/err-bspec-2.s | 7 + gas/testsuite/gas/mmix/err-bspec-3.s | 4 + gas/testsuite/gas/mmix/err-bspec-4.s | 7 + gas/testsuite/gas/mmix/err-bspec-5.s | 21 + gas/testsuite/gas/mmix/err-builtin.s | 14 + gas/testsuite/gas/mmix/err-byte1.s | 11 + gas/testsuite/gas/mmix/err-byte2.s | 17 + gas/testsuite/gas/mmix/err-case.s | 8 + gas/testsuite/gas/mmix/err-fb-1.s | 7 + gas/testsuite/gas/mmix/err-greg1.s | 10 + gas/testsuite/gas/mmix/err-insn.s | 5 + gas/testsuite/gas/mmix/err-is-1.s | 4 + gas/testsuite/gas/mmix/err-loc-1.s | 5 + gas/testsuite/gas/mmix/err-loc-2.s | 5 + gas/testsuite/gas/mmix/err-loc-3.s | 4 + gas/testsuite/gas/mmix/err-loc-4.s | 4 + gas/testsuite/gas/mmix/err-loc-5.s | 4 + gas/testsuite/gas/mmix/err-loc-6.s | 4 + gas/testsuite/gas/mmix/err-loc-7.s | 4 + gas/testsuite/gas/mmix/err-loc-8.s | 4 + gas/testsuite/gas/mmix/err-local1.s | 6 + gas/testsuite/gas/mmix/err-local2.s | 3 + gas/testsuite/gas/mmix/err-ser-1.s | 10 + gas/testsuite/gas/mmix/err-set.s | 7 + gas/testsuite/gas/mmix/expr-1.d | 7 + gas/testsuite/gas/mmix/expr-1.s | 5 + gas/testsuite/gas/mmix/fb-1.d | 20 + gas/testsuite/gas/mmix/fb-1.s | 4 + gas/testsuite/gas/mmix/fb-2.d | 32 + gas/testsuite/gas/mmix/fb-2.s | 19 + gas/testsuite/gas/mmix/get-op-r.d | 11 + gas/testsuite/gas/mmix/get-op.d | 9 + gas/testsuite/gas/mmix/get-op.l | 17 + gas/testsuite/gas/mmix/get-op.s | 6 + gas/testsuite/gas/mmix/geta-c.d | 26 + gas/testsuite/gas/mmix/geta-c.s | 5 + gas/testsuite/gas/mmix/geta-op-r.d | 37 + gas/testsuite/gas/mmix/geta-op.d | 25 + gas/testsuite/gas/mmix/geta-op.l | 31 + gas/testsuite/gas/mmix/geta-op.s | 16 + gas/testsuite/gas/mmix/geta-opn.d | 27 + gas/testsuite/gas/mmix/geta-oprn.d | 37 + gas/testsuite/gas/mmix/greg1.d | 35 + gas/testsuite/gas/mmix/greg1.s | 16 + gas/testsuite/gas/mmix/greg1a.d | 39 + gas/testsuite/gas/mmix/greg2.d | 35 + gas/testsuite/gas/mmix/greg2.s | 21 + gas/testsuite/gas/mmix/greg2a.d | 39 + gas/testsuite/gas/mmix/greg3.d | 30 + gas/testsuite/gas/mmix/greg3.s | 11 + gas/testsuite/gas/mmix/greg4.d | 28 + gas/testsuite/gas/mmix/greg4.s | 4 + gas/testsuite/gas/mmix/greg5.d | 29 + gas/testsuite/gas/mmix/greg5.s | 9 + gas/testsuite/gas/mmix/greg6.d | 36 + gas/testsuite/gas/mmix/greg6.s | 9 + gas/testsuite/gas/mmix/greg7.d | 27 + gas/testsuite/gas/mmix/greg7.s | 8 + gas/testsuite/gas/mmix/greg8.d | 32 + gas/testsuite/gas/mmix/greg8.s | 8 + gas/testsuite/gas/mmix/greg9.d | 14 + gas/testsuite/gas/mmix/greg9.s | 8 + gas/testsuite/gas/mmix/hex-r.d | 11 + gas/testsuite/gas/mmix/hex.d | 9 + gas/testsuite/gas/mmix/hex.l | 13 + gas/testsuite/gas/mmix/hex.s | 3 + gas/testsuite/gas/mmix/is-1.d | 12 + gas/testsuite/gas/mmix/is-1.s | 7 + gas/testsuite/gas/mmix/jmp-op-n.d | 23 + gas/testsuite/gas/mmix/jmp-op-r.d | 29 + gas/testsuite/gas/mmix/jmp-op.d | 21 + gas/testsuite/gas/mmix/jmp-op.l | 23 + gas/testsuite/gas/mmix/jmp-op.s | 10 + gas/testsuite/gas/mmix/jmp-oprn.d | 29 + gas/testsuite/gas/mmix/jump-c.d | 28 + gas/testsuite/gas/mmix/jump-c.s | 5 + gas/testsuite/gas/mmix/list-in-n.d | 281 + gas/testsuite/gas/mmix/list-in-r.d | 315 + gas/testsuite/gas/mmix/list-in-rn.d | 315 + gas/testsuite/gas/mmix/list-insns.d | 279 + gas/testsuite/gas/mmix/list-insns.l | 301 + gas/testsuite/gas/mmix/list-insns.s | 279 + gas/testsuite/gas/mmix/list-pseudoints.l | 19 + gas/testsuite/gas/mmix/list-pseudoints.s | 6 + gas/testsuite/gas/mmix/list-textfirst | 5 + gas/testsuite/gas/mmix/list-textfirst.l | 17 + gas/testsuite/gas/mmix/list-textfirst.s | 6 + gas/testsuite/gas/mmix/loc-1.d | 45 + gas/testsuite/gas/mmix/loc-1.s | 7 + gas/testsuite/gas/mmix/loc-2.d | 39 + gas/testsuite/gas/mmix/loc-2.s | 5 + gas/testsuite/gas/mmix/loc-3.d | 43 + gas/testsuite/gas/mmix/loc-3.s | 14 + gas/testsuite/gas/mmix/loc-4.d | 44 + gas/testsuite/gas/mmix/loc-4.s | 8 + gas/testsuite/gas/mmix/loc-5.d | 45 + gas/testsuite/gas/mmix/loc-5.s | 11 + gas/testsuite/gas/mmix/local-1.d | 37 + gas/testsuite/gas/mmix/local-1.s | 12 + gas/testsuite/gas/mmix/locall1.d | 15 + gas/testsuite/gas/mmix/locall1.s | 14 + gas/testsuite/gas/mmix/mmix-err.exp | 30 + gas/testsuite/gas/mmix/mmix-list.exp | 48 + gas/testsuite/gas/mmix/mmix.exp | 38 + gas/testsuite/gas/mmix/odd-1.d | 27 + gas/testsuite/gas/mmix/odd-1.s | 9 + gas/testsuite/gas/mmix/op-0-1.d | 28 + gas/testsuite/gas/mmix/op-0-1.s | 6 + gas/testsuite/gas/mmix/op-0-1s.d | 22 + gas/testsuite/gas/mmix/op-0-2.d | 26 + gas/testsuite/gas/mmix/pop-op-r.d | 12 + gas/testsuite/gas/mmix/pop-op.d | 10 + gas/testsuite/gas/mmix/pop-op.l | 20 + gas/testsuite/gas/mmix/pop-op.s | 8 + gas/testsuite/gas/mmix/prefix1.d | 38 + gas/testsuite/gas/mmix/prefix1.s | 20 + gas/testsuite/gas/mmix/prefix2.d | 15 + gas/testsuite/gas/mmix/prefix2.s | 3 + gas/testsuite/gas/mmix/prefix3.d | 31 + gas/testsuite/gas/mmix/prefix3.s | 9 + gas/testsuite/gas/mmix/pseudo-1.d | 15 + gas/testsuite/gas/mmix/pseudo-1.s | 1 + gas/testsuite/gas/mmix/pushgo-op-r.d | 64 + gas/testsuite/gas/mmix/pushgo-op.d | 62 + gas/testsuite/gas/mmix/pushgo-op.l | 87 + gas/testsuite/gas/mmix/pushgo-op.s | 69 + gas/testsuite/gas/mmix/pushj-c.d | 28 + gas/testsuite/gas/mmix/pushj-c.s | 5 + gas/testsuite/gas/mmix/pushj-cs.d | 18 + gas/testsuite/gas/mmix/put-op-r.d | 17 + gas/testsuite/gas/mmix/put-op.d | 15 + gas/testsuite/gas/mmix/put-op.l | 27 + gas/testsuite/gas/mmix/put-op.s | 14 + gas/testsuite/gas/mmix/reg-op-r.d | 16 + gas/testsuite/gas/mmix/reg-op.d | 14 + gas/testsuite/gas/mmix/reg-op.l | 26 + gas/testsuite/gas/mmix/reg-op.s | 13 + gas/testsuite/gas/mmix/reg3-op-r.d | 32 + gas/testsuite/gas/mmix/reg3-op.d | 30 + gas/testsuite/gas/mmix/reg3-op.l | 46 + gas/testsuite/gas/mmix/reg3-op.s | 32 + gas/testsuite/gas/mmix/regt-op-r.d | 136 + gas/testsuite/gas/mmix/regt-op.d | 134 + gas/testsuite/gas/mmix/regt-op.l | 160 + gas/testsuite/gas/mmix/regt-op.s | 140 + gas/testsuite/gas/mmix/regx-op-r.d | 36 + gas/testsuite/gas/mmix/regx-op.d | 34 + gas/testsuite/gas/mmix/regx-op.l | 51 + gas/testsuite/gas/mmix/regx-op.s | 37 + gas/testsuite/gas/mmix/regy-op-r.d | 36 + gas/testsuite/gas/mmix/regy-op.d | 34 + gas/testsuite/gas/mmix/regy-op.l | 51 + gas/testsuite/gas/mmix/regy-op.s | 37 + gas/testsuite/gas/mmix/relax1-n.d | 90 + gas/testsuite/gas/mmix/relax1-r.d | 145 + gas/testsuite/gas/mmix/relax1-rn.d | 117 + gas/testsuite/gas/mmix/relax1.d | 118 + gas/testsuite/gas/mmix/relax1.l | 128 + gas/testsuite/gas/mmix/relax1.s | 43 + gas/testsuite/gas/mmix/relax2.d | 251 + gas/testsuite/gas/mmix/relax2.s | 35 + gas/testsuite/gas/mmix/reloc16-n.d | 14 + gas/testsuite/gas/mmix/reloc16-r.d | 14 + gas/testsuite/gas/mmix/reloc16.d | 12 + gas/testsuite/gas/mmix/reloc16.l | 17 + gas/testsuite/gas/mmix/reloc16.s | 4 + gas/testsuite/gas/mmix/reloc8-r.d | 20 + gas/testsuite/gas/mmix/reloc8.d | 18 + gas/testsuite/gas/mmix/reloc8.l | 25 + gas/testsuite/gas/mmix/reloc8.s | 7 + gas/testsuite/gas/mmix/relocl-n.d | 27 + gas/testsuite/gas/mmix/reloclab-r.d | 49 + gas/testsuite/gas/mmix/reloclab-rs.d | 42 + gas/testsuite/gas/mmix/reloclab-s.d | 36 + gas/testsuite/gas/mmix/reloclab.d | 43 + gas/testsuite/gas/mmix/reloclab.l | 42 + gas/testsuite/gas/mmix/reloclab.s | 14 + gas/testsuite/gas/mmix/reloclrn.d | 33 + gas/testsuite/gas/mmix/relocxrn.d | 14 + gas/testsuite/gas/mmix/resume-op-r.d | 12 + gas/testsuite/gas/mmix/resume-op.d | 10 + gas/testsuite/gas/mmix/resume-op.l | 19 + gas/testsuite/gas/mmix/resume-op.s | 7 + gas/testsuite/gas/mmix/round2-op-r.d | 19 + gas/testsuite/gas/mmix/round2-op.d | 17 + gas/testsuite/gas/mmix/round2-op.l | 28 + gas/testsuite/gas/mmix/round2-op.s | 15 + gas/testsuite/gas/mmix/roundi-op-r.d | 22 + gas/testsuite/gas/mmix/roundi-op.d | 20 + gas/testsuite/gas/mmix/roundi-op.l | 31 + gas/testsuite/gas/mmix/roundi-op.s | 18 + gas/testsuite/gas/mmix/roundr-op-r.d | 15 + gas/testsuite/gas/mmix/roundr-op.d | 13 + gas/testsuite/gas/mmix/roundr-op.l | 22 + gas/testsuite/gas/mmix/roundr-op.s | 10 + gas/testsuite/gas/mmix/save-op-r.d | 11 + gas/testsuite/gas/mmix/save-op.d | 9 + gas/testsuite/gas/mmix/save-op.l | 18 + gas/testsuite/gas/mmix/save-op.s | 6 + gas/testsuite/gas/mmix/set-r.d | 14 + gas/testsuite/gas/mmix/set.d | 12 + gas/testsuite/gas/mmix/set.l | 21 + gas/testsuite/gas/mmix/set.s | 9 + gas/testsuite/gas/mmix/swym-op-r.d | 16 + gas/testsuite/gas/mmix/swym-op.d | 14 + gas/testsuite/gas/mmix/swym-op.l | 30 + gas/testsuite/gas/mmix/swym-op.s | 15 + gas/testsuite/gas/mmix/sym-1.d | 51 + gas/testsuite/gas/mmix/sym-1.s | 19 + gas/testsuite/gas/mmix/sync-op-r.d | 14 + gas/testsuite/gas/mmix/sync-op.d | 12 + gas/testsuite/gas/mmix/sync-op.l | 23 + gas/testsuite/gas/mmix/sync-op.s | 10 + gas/testsuite/gas/mmix/two-op-r.d | 24 + gas/testsuite/gas/mmix/two-op.d | 22 + gas/testsuite/gas/mmix/two-op.l | 35 + gas/testsuite/gas/mmix/two-op.s | 23 + gas/testsuite/gas/mmix/unsave-op-r.d | 11 + gas/testsuite/gas/mmix/unsave-op.d | 9 + gas/testsuite/gas/mmix/unsave-op.l | 18 + gas/testsuite/gas/mmix/unsave-op.s | 6 + gas/testsuite/gas/mmix/weak1-s.d | 19 + gas/testsuite/gas/mmix/weak1.d | 23 + gas/testsuite/gas/mmix/weak1.s | 7 + gas/testsuite/gas/mmix/zerop-1.d | 20 + gas/testsuite/gas/mmix/zerop-1.s | 9 + gas/testsuite/gas/mn10200/add.s | 13 + gas/testsuite/gas/mn10200/basic.exp | 836 + gas/testsuite/gas/mn10200/bcc.s | 17 + gas/testsuite/gas/mn10200/bccx.s | 16 + gas/testsuite/gas/mn10200/bit.s | 5 + gas/testsuite/gas/mn10200/cmp.s | 10 + gas/testsuite/gas/mn10200/ext.s | 7 + gas/testsuite/gas/mn10200/logical.s | 12 + gas/testsuite/gas/mn10200/mov1.s | 13 + gas/testsuite/gas/mn10200/mov2.s | 10 + gas/testsuite/gas/mn10200/mov3.s | 11 + gas/testsuite/gas/mn10200/mov4.s | 9 + gas/testsuite/gas/mn10200/movb.s | 13 + gas/testsuite/gas/mn10200/movbu.s | 8 + gas/testsuite/gas/mn10200/movx.s | 7 + gas/testsuite/gas/mn10200/muldiv.s | 4 + gas/testsuite/gas/mn10200/other.s | 10 + gas/testsuite/gas/mn10200/shift.s | 5 + gas/testsuite/gas/mn10200/sub.s | 10 + gas/testsuite/gas/mn10300/add.s | 15 + gas/testsuite/gas/mn10300/am33-2.c | 745 + gas/testsuite/gas/mn10300/am33-2.d | 1324 + gas/testsuite/gas/mn10300/am33-2.s | 1306 + gas/testsuite/gas/mn10300/am33.s | 46 + gas/testsuite/gas/mn10300/am33_2.s | 64 + gas/testsuite/gas/mn10300/am33_3.s | 44 + gas/testsuite/gas/mn10300/am33_4.s | 47 + gas/testsuite/gas/mn10300/am33_5.s | 65 + gas/testsuite/gas/mn10300/am33_6.s | 70 + gas/testsuite/gas/mn10300/am33_7.s | 71 + gas/testsuite/gas/mn10300/am33_8.s | 70 + gas/testsuite/gas/mn10300/basic.exp | 1820 + gas/testsuite/gas/mn10300/bcc.s | 17 + gas/testsuite/gas/mn10300/bit.s | 12 + gas/testsuite/gas/mn10300/cmp.s | 11 + gas/testsuite/gas/mn10300/ext.s | 7 + gas/testsuite/gas/mn10300/extend.s | 15 + gas/testsuite/gas/mn10300/logical.s | 15 + gas/testsuite/gas/mn10300/loop.s | 15 + gas/testsuite/gas/mn10300/mov1.s | 17 + gas/testsuite/gas/mn10300/mov2.s | 16 + gas/testsuite/gas/mn10300/mov3.s | 16 + gas/testsuite/gas/mn10300/mov4.s | 13 + gas/testsuite/gas/mn10300/mov5.s | 7 + gas/testsuite/gas/mn10300/movbu.s | 21 + gas/testsuite/gas/mn10300/movhu.s | 21 + gas/testsuite/gas/mn10300/movm.s | 5 + gas/testsuite/gas/mn10300/movpc.l | 25 + gas/testsuite/gas/mn10300/movpc.s | 17 + gas/testsuite/gas/mn10300/muldiv.s | 5 + gas/testsuite/gas/mn10300/other.s | 20 + gas/testsuite/gas/mn10300/shift.s | 10 + gas/testsuite/gas/mn10300/sub.s | 8 + gas/testsuite/gas/mn10300/udf.s | 129 + gas/testsuite/gas/mri/char.d | 9 + gas/testsuite/gas/mri/char.s | 6 + gas/testsuite/gas/mri/comment.d | 9 + gas/testsuite/gas/mri/comment.s | 13 + gas/testsuite/gas/mri/common.d | 8 + gas/testsuite/gas/mri/common.s | 11 + gas/testsuite/gas/mri/constants.d | 20 + gas/testsuite/gas/mri/constants.s | 31 + gas/testsuite/gas/mri/empty.s | 9 + gas/testsuite/gas/mri/equ.d | 7 + gas/testsuite/gas/mri/equ.s | 3 + gas/testsuite/gas/mri/expr.d | 11 + gas/testsuite/gas/mri/expr.s | 7 + gas/testsuite/gas/mri/float.d | 10 + gas/testsuite/gas/mri/float.s | 7 + gas/testsuite/gas/mri/for.d | 30 + gas/testsuite/gas/mri/for.s | 22 + gas/testsuite/gas/mri/if.d | 25 + gas/testsuite/gas/mri/if.s | 17 + gas/testsuite/gas/mri/immconst.d | 22 + gas/testsuite/gas/mri/label.d | 8 + gas/testsuite/gas/mri/label.s | 5 + gas/testsuite/gas/mri/moveml.d | 27 + gas/testsuite/gas/mri/moveml.s | 17 + gas/testsuite/gas/mri/mri.exp | 35 + gas/testsuite/gas/mri/repeat.d | 16 + gas/testsuite/gas/mri/repeat.s | 14 + gas/testsuite/gas/mri/semi.d | 9 + gas/testsuite/gas/mri/semi.s | 14 + gas/testsuite/gas/mri/while.d | 18 + gas/testsuite/gas/mri/while.s | 14 + gas/testsuite/gas/msp430/msp430.exp | 20 + gas/testsuite/gas/msp430/opcode.d | 45 + gas/testsuite/gas/msp430/opcode.s | 57 + gas/testsuite/gas/openrisc/addi.d | 10 + gas/testsuite/gas/openrisc/addi.s | 4 + gas/testsuite/gas/openrisc/allinsn.d | 201 + gas/testsuite/gas/openrisc/allinsn.exp | 8 + gas/testsuite/gas/openrisc/allinsn.s | 260 + gas/testsuite/gas/openrisc/lohi.d | 13 + gas/testsuite/gas/openrisc/lohi.s | 7 + gas/testsuite/gas/openrisc/store.d | 13 + gas/testsuite/gas/openrisc/store.s | 7 + gas/testsuite/gas/pdp11/opcode.d | 223 + gas/testsuite/gas/pdp11/opcode.s | 229 + gas/testsuite/gas/pdp11/pdp11.exp | 22 + gas/testsuite/gas/pj/ops.d | 407 + gas/testsuite/gas/pj/ops.s | 397 + gas/testsuite/gas/pj/pj.exp | 7 + gas/testsuite/gas/ppc/aix.exp | 66 + gas/testsuite/gas/ppc/align.s | 6 + gas/testsuite/gas/ppc/altivec.d | 15 + gas/testsuite/gas/ppc/altivec.s | 10 + gas/testsuite/gas/ppc/altivec_xcoff.d | 15 + gas/testsuite/gas/ppc/altivec_xcoff.s | 16 + gas/testsuite/gas/ppc/altivec_xcoff64.d | 15 + gas/testsuite/gas/ppc/altivec_xcoff64.s | 14 + gas/testsuite/gas/ppc/astest.d | 74 + gas/testsuite/gas/ppc/astest.s | 52 + gas/testsuite/gas/ppc/astest2.d | 84 + gas/testsuite/gas/ppc/astest2.s | 66 + gas/testsuite/gas/ppc/astest2_64.d | 70 + gas/testsuite/gas/ppc/astest2_64.s | 50 + gas/testsuite/gas/ppc/astest64.d | 69 + gas/testsuite/gas/ppc/astest64.s | 50 + gas/testsuite/gas/ppc/booke.d | 144 + gas/testsuite/gas/ppc/booke.s | 136 + gas/testsuite/gas/ppc/booke_xcoff.d | 28 + gas/testsuite/gas/ppc/booke_xcoff.s | 28 + gas/testsuite/gas/ppc/booke_xcoff64.d | 125 + gas/testsuite/gas/ppc/booke_xcoff64.s | 137 + gas/testsuite/gas/ppc/e500.d | 21 + gas/testsuite/gas/ppc/e500.s | 15 + gas/testsuite/gas/ppc/generate.sh | 6 + gas/testsuite/gas/ppc/machine.d | 9 + gas/testsuite/gas/ppc/machine.s | 15 + gas/testsuite/gas/ppc/power4.d | 101 + gas/testsuite/gas/ppc/power4.s | 74 + gas/testsuite/gas/ppc/ppc.exp | 42 + gas/testsuite/gas/ppc/simpshft.d | 27 + gas/testsuite/gas/ppc/simpshft.s | 110 + gas/testsuite/gas/ppc/test1elf.asm | 95 + gas/testsuite/gas/ppc/test1elf32.d | 90 + gas/testsuite/gas/ppc/test1elf32.s | 58 + gas/testsuite/gas/ppc/test1elf64.d | 145 + gas/testsuite/gas/ppc/test1elf64.s | 95 + gas/testsuite/gas/ppc/test1xcoff.asm | 82 + gas/testsuite/gas/ppc/test1xcoff32.d | 139 + gas/testsuite/gas/ppc/test1xcoff32.s | 82 + gas/testsuite/gas/ppc/textalign-xcoff-001.d | 14 + gas/testsuite/gas/ppc/textalign-xcoff-001.s | 11 + gas/testsuite/gas/ppc/textalign-xcoff-002.d | 14 + gas/testsuite/gas/s390/opcode.d | 425 + gas/testsuite/gas/s390/opcode.s | 419 + gas/testsuite/gas/s390/opcode64.d | 211 + gas/testsuite/gas/s390/opcode64.s | 205 + gas/testsuite/gas/s390/operands.d | 23 + gas/testsuite/gas/s390/operands.s | 16 + gas/testsuite/gas/s390/operands64.d | 14 + gas/testsuite/gas/s390/operands64.s | 6 + gas/testsuite/gas/s390/reloc.d | 51 + gas/testsuite/gas/s390/reloc.s | 26 + gas/testsuite/gas/s390/reloc64.d | 32 + gas/testsuite/gas/s390/reloc64.s | 18 + gas/testsuite/gas/s390/s390.exp | 35 + gas/testsuite/gas/sh/basic.exp | 169 + gas/testsuite/gas/sh/dsp.d | 27 + gas/testsuite/gas/sh/dsp.s | 27 + gas/testsuite/gas/sh/err-1.s | 11 + gas/testsuite/gas/sh/err-at.s | 10 + gas/testsuite/gas/sh/err-be.s | 10 + gas/testsuite/gas/sh/err-le.s | 10 + gas/testsuite/gas/sh/err-sh4a-fp.s | 15 + gas/testsuite/gas/sh/err-sh4a.s | 29 + gas/testsuite/gas/sh/err-sh4al-dsp.s | 20 + gas/testsuite/gas/sh/err.exp | 28 + gas/testsuite/gas/sh/fp.s | 44 + gas/testsuite/gas/sh/pcrel-coff.d | 27 + gas/testsuite/gas/sh/pcrel-coff.s | 14 + gas/testsuite/gas/sh/pcrel.d | 24 + gas/testsuite/gas/sh/pcrel.l | 3 + gas/testsuite/gas/sh/pcrel.s | 16 + gas/testsuite/gas/sh/pcrel2.d | 23 + gas/testsuite/gas/sh/pcrel2.s | 17 + gas/testsuite/gas/sh/pic.d | 43 + gas/testsuite/gas/sh/pic.s | 43 + gas/testsuite/gas/sh/renesas-1.d | 11 + gas/testsuite/gas/sh/renesas-1.s | 3 + gas/testsuite/gas/sh/sh4a-dsp.d | 40 + gas/testsuite/gas/sh/sh4a-dsp.s | 42 + gas/testsuite/gas/sh/sh4a-fp.d | 15 + gas/testsuite/gas/sh/sh4a-fp.s | 11 + gas/testsuite/gas/sh/sh4a.d | 27 + gas/testsuite/gas/sh/sh4a.s | 28 + gas/testsuite/gas/sh/sh4al-dsp.d | 104 + gas/testsuite/gas/sh/sh4al-dsp.s | 104 + gas/testsuite/gas/sh/sh64/abi-32.d | 10 + gas/testsuite/gas/sh/sh64/abi-32.s | 7 + gas/testsuite/gas/sh/sh64/abi-64.d | 9 + gas/testsuite/gas/sh/sh64/abi-64.s | 7 + gas/testsuite/gas/sh/sh64/basic-1.d | 234 + gas/testsuite/gas/sh/sh64/basic-1.s | 233 + gas/testsuite/gas/sh/sh64/case-1.d | 23 + gas/testsuite/gas/sh/sh64/case-1.s | 12 + gas/testsuite/gas/sh/sh64/case-noexp-1.d | 18 + gas/testsuite/gas/sh/sh64/crange1-1.d | 104 + gas/testsuite/gas/sh/sh64/crange1-2.d | 108 + gas/testsuite/gas/sh/sh64/crange1.s | 210 + gas/testsuite/gas/sh/sh64/crange2-1.d | 43 + gas/testsuite/gas/sh/sh64/crange2-2.d | 22 + gas/testsuite/gas/sh/sh64/crange2-noexp-1.d | 43 + gas/testsuite/gas/sh/sh64/crange2.s | 34 + gas/testsuite/gas/sh/sh64/crange3-1.d | 24 + gas/testsuite/gas/sh/sh64/crange3.s | 34 + gas/testsuite/gas/sh/sh64/crange4-1.d | 19 + gas/testsuite/gas/sh/sh64/crange4.s | 8 + gas/testsuite/gas/sh/sh64/crange5-1.d | 12 + gas/testsuite/gas/sh/sh64/crange5.s | 26 + gas/testsuite/gas/sh/sh64/creg-1.d | 77 + gas/testsuite/gas/sh/sh64/creg-1.s | 79 + gas/testsuite/gas/sh/sh64/creg-2.d | 17 + gas/testsuite/gas/sh/sh64/creg-2.s | 14 + gas/testsuite/gas/sh/sh64/datal-1.s | 41 + gas/testsuite/gas/sh/sh64/datal-2.d | 44 + gas/testsuite/gas/sh/sh64/datal-2.s | 46 + gas/testsuite/gas/sh/sh64/datal-3.s | 48 + gas/testsuite/gas/sh/sh64/datal32-1.d | 45 + gas/testsuite/gas/sh/sh64/datal32-3.d | 94 + gas/testsuite/gas/sh/sh64/datal64-1.d | 50 + gas/testsuite/gas/sh/sh64/datal64-3.d | 123 + gas/testsuite/gas/sh/sh64/endian-1.d | 9 + gas/testsuite/gas/sh/sh64/endian-1.s | 7 + gas/testsuite/gas/sh/sh64/endian-2.d | 10 + gas/testsuite/gas/sh/sh64/endian-2.s | 7 + gas/testsuite/gas/sh/sh64/err-1.s | 47 + gas/testsuite/gas/sh/sh64/err-2.s | 16 + gas/testsuite/gas/sh/sh64/err-3.s | 36 + gas/testsuite/gas/sh/sh64/err-4.s | 27 + gas/testsuite/gas/sh/sh64/err-abi-32.s | 10 + gas/testsuite/gas/sh/sh64/err-abi-64.s | 10 + gas/testsuite/gas/sh/sh64/err-dsp.s | 15 + gas/testsuite/gas/sh/sh64/err-movi-noexp-1.s | 24 + gas/testsuite/gas/sh/sh64/err-noexp-cmd1.s | 10 + gas/testsuite/gas/sh/sh64/err-pt-1.s | 18 + gas/testsuite/gas/sh/sh64/err-pt32-cmd1.s | 10 + gas/testsuite/gas/sh/sh64/err-pt32-cmd2.s | 10 + gas/testsuite/gas/sh/sh64/err-pt32-cmd3.s | 10 + gas/testsuite/gas/sh/sh64/err-ptb-1.s | 34 + gas/testsuite/gas/sh/sh64/err-ptb-2.s | 34 + gas/testsuite/gas/sh/sh64/err.exp | 9 + gas/testsuite/gas/sh/sh64/immexpr1.s | 85 + gas/testsuite/gas/sh/sh64/immexpr2.s | 16 + gas/testsuite/gas/sh/sh64/immexpr32-1.d | 67 + gas/testsuite/gas/sh/sh64/immexpr32-2.d | 11 + gas/testsuite/gas/sh/sh64/immexpr64-1.d | 68 + gas/testsuite/gas/sh/sh64/immexpr64-2.d | 11 + gas/testsuite/gas/sh/sh64/lineno.d | 19 + gas/testsuite/gas/sh/sh64/lineno.s | 7 + gas/testsuite/gas/sh/sh64/localcom-1.d | 30 + gas/testsuite/gas/sh/sh64/localcom-1.s | 26 + gas/testsuite/gas/sh/sh64/mix-1.d | 42 + gas/testsuite/gas/sh/sh64/mix-1.s | 21 + gas/testsuite/gas/sh/sh64/mix-noexp-1.d | 33 + gas/testsuite/gas/sh/sh64/movi-1.s | 20 + gas/testsuite/gas/sh/sh64/movi-2.s | 28 + gas/testsuite/gas/sh/sh64/movi-3.d | 18 + gas/testsuite/gas/sh/sh64/movi-3.s | 10 + gas/testsuite/gas/sh/sh64/movi32-1.d | 35 + gas/testsuite/gas/sh/sh64/movi32-2.d | 36 + gas/testsuite/gas/sh/sh64/movi32-noexp-2.d | 28 + gas/testsuite/gas/sh/sh64/movi64-1.d | 44 + gas/testsuite/gas/sh/sh64/movi64-2.d | 30 + gas/testsuite/gas/sh/sh64/movi64-2.s | 10 + gas/testsuite/gas/sh/sh64/movi64-3.d | 52 + gas/testsuite/gas/sh/sh64/movi64-noexp-2.d | 28 + gas/testsuite/gas/sh/sh64/pt-1.d | 26 + gas/testsuite/gas/sh/sh64/pt-1.s | 17 + gas/testsuite/gas/sh/sh64/pt-2.s | 22 + gas/testsuite/gas/sh/sh64/pt-noexp-1.d | 27 + gas/testsuite/gas/sh/sh64/pt32-1.d | 39 + gas/testsuite/gas/sh/sh64/pt32-noexp-2.d | 34 + gas/testsuite/gas/sh/sh64/pt64-1.d | 47 + gas/testsuite/gas/sh/sh64/pt64-32-1.d | 27 + gas/testsuite/gas/sh/sh64/pt64-32-2.d | 39 + gas/testsuite/gas/sh/sh64/pt64-noexp-2.d | 34 + gas/testsuite/gas/sh/sh64/ptc-1.s | 5 + gas/testsuite/gas/sh/sh64/ptc32-1.d | 15 + gas/testsuite/gas/sh/sh64/ptc32-noexp-1.d | 12 + gas/testsuite/gas/sh/sh64/ptc64-1.d | 19 + gas/testsuite/gas/sh/sh64/ptc64-32-1.d | 15 + gas/testsuite/gas/sh/sh64/ptc64-noexp-1.d | 13 + gas/testsuite/gas/sh/sh64/ptext-1.s | 8 + gas/testsuite/gas/sh/sh64/ptext32-1.d | 40 + gas/testsuite/gas/sh/sh64/ptext32-noexp-1.d | 22 + gas/testsuite/gas/sh/sh64/ptext64-1.d | 64 + gas/testsuite/gas/sh/sh64/ptext64-32-1.d | 40 + gas/testsuite/gas/sh/sh64/ptext64-noexp-1.d | 22 + gas/testsuite/gas/sh/sh64/rel-1.s | 137 + gas/testsuite/gas/sh/sh64/rel-2.s | 138 + gas/testsuite/gas/sh/sh64/rel-3.s | 137 + gas/testsuite/gas/sh/sh64/rel-4.s | 138 + gas/testsuite/gas/sh/sh64/rel-5.s | 48 + gas/testsuite/gas/sh/sh64/rel32-1.d | 86 + gas/testsuite/gas/sh/sh64/rel32-2.d | 86 + gas/testsuite/gas/sh/sh64/rel32-3.d | 86 + gas/testsuite/gas/sh/sh64/rel32-4.d | 86 + gas/testsuite/gas/sh/sh64/rel32-5.d | 30 + gas/testsuite/gas/sh/sh64/rel64-1.d | 111 + gas/testsuite/gas/sh/sh64/rel64-2.d | 111 + gas/testsuite/gas/sh/sh64/rel64-3.d | 111 + gas/testsuite/gas/sh/sh64/rel64-4.d | 111 + gas/testsuite/gas/sh/sh64/rel64-5.d | 40 + gas/testsuite/gas/sh/sh64/relax-1.d | 30 + gas/testsuite/gas/sh/sh64/relax-1.s | 18 + gas/testsuite/gas/sh/sh64/relax-2.d | 30 + gas/testsuite/gas/sh/sh64/relax-2.s | 23 + gas/testsuite/gas/sh/sh64/relax-3.d | 43 + gas/testsuite/gas/sh/sh64/relax-3.s | 32 + gas/testsuite/gas/sh/sh64/sh64.exp | 27 + gas/testsuite/gas/sh/sh64/shift-1.s | 42 + gas/testsuite/gas/sh/sh64/shift-2.s | 34 + gas/testsuite/gas/sh/sh64/shift-3.s | 7 + gas/testsuite/gas/sh/sh64/shift32-1.d | 58 + gas/testsuite/gas/sh/sh64/shift32-3.d | 14 + gas/testsuite/gas/sh/sh64/shift32-noexp-3.d | 14 + gas/testsuite/gas/sh/sh64/shift64-1.d | 58 + gas/testsuite/gas/sh/sh64/shift64-2.d | 42 + gas/testsuite/gas/sh/sh64/shift64-3.d | 14 + gas/testsuite/gas/sh/sh64/shift64-noexp-3.d | 14 + gas/testsuite/gas/sh/sh64/syntax-1.d | 157 + gas/testsuite/gas/sh/sh64/syntax-1.s | 199 + gas/testsuite/gas/sh/sh64/syntax-2.d | 11 + gas/testsuite/gas/sh/sh64/syntax-2.s | 10 + gas/testsuite/gas/sh/sh64/ua-1.s | 16 + gas/testsuite/gas/sh/sh64/ua32-1.d | 23 + gas/testsuite/gas/sh/sh64/ua64-1.d | 23 + gas/testsuite/gas/sh/tlsd.d | 55 + gas/testsuite/gas/sh/tlsd.s | 71 + gas/testsuite/gas/sh/tlsnopic.d | 20 + gas/testsuite/gas/sh/tlsnopic.s | 23 + gas/testsuite/gas/sh/tlspic.d | 33 + gas/testsuite/gas/sh/tlspic.s | 30 + gas/testsuite/gas/sparc-solaris/addend.exp | 36 + gas/testsuite/gas/sparc-solaris/addend.s | 11 + gas/testsuite/gas/sparc-solaris/gas.exp | 10 + gas/testsuite/gas/sparc-solaris/sol-cc.s | 81 + gas/testsuite/gas/sparc-solaris/sol-gcc.s | 66 + gas/testsuite/gas/sparc/asi.d | 35 + gas/testsuite/gas/sparc/asi.s | 28 + gas/testsuite/gas/sparc/membar.d | 19 + gas/testsuite/gas/sparc/membar.s | 12 + gas/testsuite/gas/sparc/mism-1.s | 22 + gas/testsuite/gas/sparc/mismatch.exp | 20 + gas/testsuite/gas/sparc/pcrel.d | 34 + gas/testsuite/gas/sparc/pcrel.s | 26 + gas/testsuite/gas/sparc/pcrel64.d | 40 + gas/testsuite/gas/sparc/pcrel64.s | 32 + gas/testsuite/gas/sparc/plt.d | 23 + gas/testsuite/gas/sparc/plt.s | 12 + gas/testsuite/gas/sparc/plt64.d | 26 + gas/testsuite/gas/sparc/plt64.s | 13 + gas/testsuite/gas/sparc/prefetch.d | 19 + gas/testsuite/gas/sparc/prefetch.s | 11 + gas/testsuite/gas/sparc/rdpr.d | 26 + gas/testsuite/gas/sparc/rdpr.s | 19 + gas/testsuite/gas/sparc/reloc64.d | 76 + gas/testsuite/gas/sparc/reloc64.s | 48 + gas/testsuite/gas/sparc/set64.d | 109 + gas/testsuite/gas/sparc/set64.s | 56 + gas/testsuite/gas/sparc/sparc.exp | 53 + gas/testsuite/gas/sparc/splet-2.d | 23 + gas/testsuite/gas/sparc/splet-2.s | 21 + gas/testsuite/gas/sparc/splet.d | 195 + gas/testsuite/gas/sparc/splet.s | 211 + gas/testsuite/gas/sparc/synth.d | 11 + gas/testsuite/gas/sparc/synth.s | 7 + gas/testsuite/gas/sparc/synth64.d | 21 + gas/testsuite/gas/sparc/synth64.s | 19 + gas/testsuite/gas/sparc/unalign.d | 18 + gas/testsuite/gas/sparc/unalign.s | 13 + gas/testsuite/gas/sparc/wrpr.d | 24 + gas/testsuite/gas/sparc/wrpr.s | 17 + gas/testsuite/gas/sun4/addend.d | 13 + gas/testsuite/gas/sun4/addend.exp | 7 + gas/testsuite/gas/sun4/addend.s | 11 + gas/testsuite/gas/symver/symver.exp | 52 + gas/testsuite/gas/symver/symver0.d | 10 + gas/testsuite/gas/symver/symver0.s | 10 + gas/testsuite/gas/symver/symver1.d | 13 + gas/testsuite/gas/symver/symver1.s | 18 + gas/testsuite/gas/symver/symver2.l | 2 + gas/testsuite/gas/symver/symver2.s | 8 + gas/testsuite/gas/symver/symver3.l | 2 + gas/testsuite/gas/symver/symver3.s | 8 + gas/testsuite/gas/symver/symver4.l | 2 + gas/testsuite/gas/symver/symver4.s | 8 + gas/testsuite/gas/symver/symver5.l | 2 + gas/testsuite/gas/symver/symver5.s | 8 + gas/testsuite/gas/symver/symver6.l | 2 + gas/testsuite/gas/symver/symver6.s | 9 + gas/testsuite/gas/template | 96 + gas/testsuite/gas/tic4x/addressing.s | 371 + gas/testsuite/gas/tic4x/addressing_c3x.d | 243 + gas/testsuite/gas/tic4x/addressing_c4x.d | 278 + gas/testsuite/gas/tic4x/allopcodes.S | 241 + gas/testsuite/gas/tic4x/data.d | 93 + gas/testsuite/gas/tic4x/data.s | 14 + gas/testsuite/gas/tic4x/float.d | 82 + gas/testsuite/gas/tic4x/float.s | 28 + gas/testsuite/gas/tic4x/opclasses.h | 1094 + gas/testsuite/gas/tic4x/opcodes.s | 626 + gas/testsuite/gas/tic4x/opcodes_c3x.d | 1342 + gas/testsuite/gas/tic4x/opcodes_c4x.d | 2013 + gas/testsuite/gas/tic4x/opcodes_new.d | 767 + gas/testsuite/gas/tic4x/rebuild.sh | 10 + gas/testsuite/gas/tic4x/registers.s | 69 + gas/testsuite/gas/tic4x/registers_c3x.d | 46 + gas/testsuite/gas/tic4x/registers_c4x.d | 56 + gas/testsuite/gas/tic4x/tic4x.exp | 65 + gas/testsuite/gas/tic4x/zeros.d | 24 + gas/testsuite/gas/tic4x/zeros.s | 35 + gas/testsuite/gas/tic54x/address.d | 29 + gas/testsuite/gas/tic54x/address.s | 24 + gas/testsuite/gas/tic54x/addrfar.d | 31 + gas/testsuite/gas/tic54x/align.d | 55 + gas/testsuite/gas/tic54x/align.s | 31 + gas/testsuite/gas/tic54x/all-opcodes.d | 219151 ++++++++++++++++++ gas/testsuite/gas/tic54x/all-opcodes.s | 124668 ++++++++++ gas/testsuite/gas/tic54x/asg.d | 131 + gas/testsuite/gas/tic54x/asg.s | 39 + gas/testsuite/gas/tic54x/cons.d | 103 + gas/testsuite/gas/tic54x/cons.s | 38 + gas/testsuite/gas/tic54x/consfar.d | 106 + gas/testsuite/gas/tic54x/extaddr.d | 55 + gas/testsuite/gas/tic54x/extaddr.s | 45 + gas/testsuite/gas/tic54x/field.d | 30 + gas/testsuite/gas/tic54x/field.s | 14 + gas/testsuite/gas/tic54x/in_mlib.asm | 5 + gas/testsuite/gas/tic54x/labels.d | 74 + gas/testsuite/gas/tic54x/labels.inc | 3 + gas/testsuite/gas/tic54x/labels.s | 55 + gas/testsuite/gas/tic54x/loop.d | 18 + gas/testsuite/gas/tic54x/loop.s | 18 + gas/testsuite/gas/tic54x/lp.d | 10 + gas/testsuite/gas/tic54x/lp.s | 3 + gas/testsuite/gas/tic54x/macro.d | 20 + gas/testsuite/gas/tic54x/macro.s | 40 + gas/testsuite/gas/tic54x/macro1.s | 12 + gas/testsuite/gas/tic54x/macros.lib | 7 + gas/testsuite/gas/tic54x/math.d | 58 + gas/testsuite/gas/tic54x/math.s | 37 + gas/testsuite/gas/tic54x/opcodes.d | 292 + gas/testsuite/gas/tic54x/opcodes.s | 309 + gas/testsuite/gas/tic54x/sections.d | 76 + gas/testsuite/gas/tic54x/sections.s | 73 + gas/testsuite/gas/tic54x/set.d | 16 + gas/testsuite/gas/tic54x/set.s | 13 + gas/testsuite/gas/tic54x/struct.d | 15 + gas/testsuite/gas/tic54x/struct.s | 44 + gas/testsuite/gas/tic54x/subsym.d | 39 + gas/testsuite/gas/tic54x/subsym.s | 55 + gas/testsuite/gas/tic54x/subsym1.s | 10 + gas/testsuite/gas/tic54x/tic54x.exp | 30 + gas/testsuite/gas/tic80/add.d | 22 + gas/testsuite/gas/tic80/add.lst | 34 + gas/testsuite/gas/tic80/add.s | 19 + gas/testsuite/gas/tic80/align.d | 19 + gas/testsuite/gas/tic80/align.lst | 47 + gas/testsuite/gas/tic80/align.s | 37 + gas/testsuite/gas/tic80/bitnum.d | 82 + gas/testsuite/gas/tic80/bitnum.lst | 97 + gas/testsuite/gas/tic80/bitnum.s | 85 + gas/testsuite/gas/tic80/ccode.d | 32 + gas/testsuite/gas/tic80/ccode.lst | 37 + gas/testsuite/gas/tic80/ccode.s | 30 + gas/testsuite/gas/tic80/cregops.d | 68 + gas/testsuite/gas/tic80/cregops.lst | 76 + gas/testsuite/gas/tic80/cregops.s | 64 + gas/testsuite/gas/tic80/endmask.d | 41 + gas/testsuite/gas/tic80/endmask.lst | 45 + gas/testsuite/gas/tic80/endmask.s | 38 + gas/testsuite/gas/tic80/float.d | 40 + gas/testsuite/gas/tic80/float.lst | 76 + gas/testsuite/gas/tic80/float.s | 32 + gas/testsuite/gas/tic80/regops.d | 188 + gas/testsuite/gas/tic80/regops.lst | 264 + gas/testsuite/gas/tic80/regops.s | 237 + gas/testsuite/gas/tic80/regops2.d | 68 + gas/testsuite/gas/tic80/regops2.lst | 96 + gas/testsuite/gas/tic80/regops2.s | 60 + gas/testsuite/gas/tic80/regops3.d | 28 + gas/testsuite/gas/tic80/regops3.lst | 27 + gas/testsuite/gas/tic80/regops3.s | 20 + gas/testsuite/gas/tic80/regops4.d | 28 + gas/testsuite/gas/tic80/regops4.lst | 27 + gas/testsuite/gas/tic80/regops4.s | 20 + gas/testsuite/gas/tic80/relocs1.c | 28 + gas/testsuite/gas/tic80/relocs1.d | 56 + gas/testsuite/gas/tic80/relocs1.lst | 80 + gas/testsuite/gas/tic80/relocs1.s | 66 + gas/testsuite/gas/tic80/relocs1b.d | 12 + gas/testsuite/gas/tic80/relocs2.c | 41 + gas/testsuite/gas/tic80/relocs2.d | 37 + gas/testsuite/gas/tic80/relocs2.lst | 112 + gas/testsuite/gas/tic80/relocs2.s | 72 + gas/testsuite/gas/tic80/relocs2b.d | 38 + gas/testsuite/gas/tic80/tic80.exp | 21 + gas/testsuite/gas/v850/arith.s | 24 + gas/testsuite/gas/v850/basic.exp | 439 + gas/testsuite/gas/v850/bit.s | 8 + gas/testsuite/gas/v850/branch.s | 24 + gas/testsuite/gas/v850/compare.s | 28 + gas/testsuite/gas/v850/fepsw.s | 2 + gas/testsuite/gas/v850/hilo.s | 5 + gas/testsuite/gas/v850/hilo2.s | 4 + gas/testsuite/gas/v850/jumps.s | 8 + gas/testsuite/gas/v850/logical.s | 11 + gas/testsuite/gas/v850/mem.s | 16 + gas/testsuite/gas/v850/misc.s | 13 + gas/testsuite/gas/v850/move.s | 8 + gas/testsuite/gas/v850/range.s | 2 + gas/testsuite/gas/v850/reloc.s | 7 + gas/testsuite/gas/v850/v850e1.d | 44 + gas/testsuite/gas/v850/v850e1.s | 38 + gas/testsuite/gas/vax/elf-rel.d | 41 + gas/testsuite/gas/vax/elf-rel.s | 30 + gas/testsuite/gas/vax/quad.s | 3 + gas/testsuite/gas/vax/quad_elf.s | 3 + gas/testsuite/gas/vax/vax.exp | 35 + gas/testsuite/gas/vtable/entry0.d | 10 + gas/testsuite/gas/vtable/entry0.s | 2 + gas/testsuite/gas/vtable/entry1.d | 10 + gas/testsuite/gas/vtable/entry1.s | 2 + gas/testsuite/gas/vtable/inherit0.d | 10 + gas/testsuite/gas/vtable/inherit0.s | 13 + gas/testsuite/gas/vtable/inherit1.l | 6 + gas/testsuite/gas/vtable/inherit1.s | 1 + gas/testsuite/gas/vtable/vtable.exp | 59 + gas/testsuite/gas/xstormy16/allinsn.d | 1342 + gas/testsuite/gas/xstormy16/allinsn.exp | 8 + gas/testsuite/gas/xstormy16/allinsn.s | 1427 + gas/testsuite/gas/xstormy16/allinsn.sh | 1470 + gas/testsuite/gas/xstormy16/gcc.d | 15 + gas/testsuite/gas/xstormy16/gcc.s | 4 + gas/testsuite/gas/xstormy16/gcc.sh | 45 + gas/testsuite/gas/xstormy16/reloc-1.d | 26 + gas/testsuite/gas/xstormy16/reloc-1.s | 20 + gas/testsuite/gas/xstormy16/reloc-2.d | 56 + gas/testsuite/gas/xstormy16/reloc-2.s | 48 + gas/testsuite/gas/xtensa/all.exp | 98 + gas/testsuite/gas/xtensa/entry_align.s | 4 + gas/testsuite/gas/xtensa/entry_misalign.s | 4 + gas/testsuite/gas/xtensa/entry_misalign2.s | 6 + gas/testsuite/gas/xtensa/j_too_far.s | 8 + gas/testsuite/gas/xtensa/loop_align.s | 5 + gas/testsuite/gas/xtensa/loop_misalign.s | 5 + gas/testsuite/gas/z8k/calr-backf.s | 6 + gas/testsuite/gas/z8k/calr-forwf.s | 5 + gas/testsuite/gas/z8k/calr.d | 21 + gas/testsuite/gas/z8k/calr.s | 12 + gas/testsuite/gas/z8k/ctrl-names.d | 41 + gas/testsuite/gas/z8k/ctrl-names.s | 35 + gas/testsuite/gas/z8k/dec.s | 3 + gas/testsuite/gas/z8k/decbf.s | 2 + gas/testsuite/gas/z8k/decf.s | 2 + gas/testsuite/gas/z8k/djnz-backf.s | 8 + gas/testsuite/gas/z8k/djnz-backf2.s | 8 + gas/testsuite/gas/z8k/djnz.d | 21 + gas/testsuite/gas/z8k/djnz.s | 15 + gas/testsuite/gas/z8k/eidi.s | 30 + gas/testsuite/gas/z8k/eidif.s | 3 + gas/testsuite/gas/z8k/inc.s | 3 + gas/testsuite/gas/z8k/incbf.s | 2 + gas/testsuite/gas/z8k/incf.s | 2 + gas/testsuite/gas/z8k/inout.d | 593 + gas/testsuite/gas/z8k/inout.s | 630 + gas/testsuite/gas/z8k/jmp-cc.d | 44 + gas/testsuite/gas/z8k/jmp-cc.s | 38 + gas/testsuite/gas/z8k/jr-back.d | 15 + gas/testsuite/gas/z8k/jr-back.s | 9 + gas/testsuite/gas/z8k/jr-backf.s | 7 + gas/testsuite/gas/z8k/jr-forw.d | 16 + gas/testsuite/gas/z8k/jr-forw.s | 7 + gas/testsuite/gas/z8k/jr-forwf.s | 5 + gas/testsuite/gas/z8k/ldk.s | 3 + gas/testsuite/gas/z8k/ldkf.s | 2 + gas/testsuite/gas/z8k/ret-cc.d | 44 + gas/testsuite/gas/z8k/ret-cc.s | 39 + gas/testsuite/gas/z8k/z8k.exp | 48 + gas/testsuite/lib/doboth | 19 + gas/testsuite/lib/doobjcmp | 88 + gas/testsuite/lib/dostriptest | 14 + gas/testsuite/lib/dotest | 43 + gas/testsuite/lib/dounsreloc | 8 + gas/testsuite/lib/dounssym | 8 + gas/testsuite/lib/gas-defs.exp | 712 + gas/testsuite/lib/gas-dg.exp | 53 + gas/testsuite/lib/run | 2 + gas/vmsconf.sh | 128 + gettext.m4 | 344 + gprof/.gdbinit | 1 + gprof/ChangeLog | 19 + gprof/ChangeLog-9203 | 2138 + gprof/MAINTAINERS | 1 + gprof/Makefile.am | 237 + gprof/Makefile.in | 903 + gprof/README | 442 + gprof/TEST | 7 + gprof/TODO | 69 + gprof/acinclude.m4 | 14 + gprof/aclocal.m4 | 193 + gprof/alpha.c | 186 + gprof/basic_blocks.c | 595 + gprof/basic_blocks.h | 33 + gprof/bb_exit_func.c | 93 + gprof/bbconv.pl | 55 + gprof/bsd_callg_bl.c | 120 + gprof/bsd_callg_bl.m | 108 + gprof/call_graph.c | 137 + gprof/call_graph.h | 28 + gprof/cg_arcs.c | 717 + gprof/cg_arcs.h | 33 + gprof/cg_dfn.c | 308 + gprof/cg_dfn.h | 17 + gprof/cg_print.c | 1297 + gprof/cg_print.h | 31 + gprof/configure | 4794 + gprof/configure.in | 56 + gprof/corefile.c | 773 + gprof/corefile.h | 47 + gprof/dep-in.sed | 20 + gprof/flat_bl.c | 39 + gprof/flat_bl.m | 27 + gprof/fsf_callg_bl.c | 95 + gprof/fsf_callg_bl.m | 83 + gprof/gconfig.in | 132 + gprof/gen-c-prog.awk | 28 + gprof/gmon.h | 148 + gprof/gmon_io.c | 779 + gprof/gmon_io.h | 60 + gprof/gmon_out.h | 45 + gprof/gprof.1 | 712 + gprof/gprof.c | 696 + gprof/gprof.h | 139 + gprof/gprof.info | 2300 + gprof/gprof.texi | 2556 + gprof/hertz.c | 63 + gprof/hertz.h | 13 + gprof/hist.c | 562 + gprof/hist.h | 40 + gprof/i386.c | 116 + gprof/po/.cvsignore | 1 + gprof/po/Make-in | 28 +- gprof/po/da.gmo | Bin 0 -> 9586 bytes gprof/po/da.po | 552 + gprof/po/de.gmo | Bin 0 -> 9721 bytes gprof/po/de.po | 549 + gprof/po/es.gmo | Bin 0 -> 10045 bytes gprof/po/es.po | 552 + gprof/po/fr.gmo | Bin 0 -> 10044 bytes gprof/po/fr.po | 551 + gprof/po/gprof.pot | 43 +- gprof/po/id.gmo | Bin 0 -> 9735 bytes gprof/po/id.po | 547 + gprof/po/pt_BR.gmo | Bin 0 -> 9984 bytes gprof/po/pt_BR.po | 551 + gprof/po/sv.gmo | Bin 0 -> 9555 bytes gprof/po/sv.po | 554 + gprof/po/tr.gmo | Bin 0 -> 11327 bytes gprof/po/tr.po | 576 + gprof/search_list.c | 62 + gprof/search_list.h | 48 + gprof/source.c | 267 + gprof/source.h | 62 + gprof/sparc.c | 103 + gprof/stamp-h.in | 1 + gprof/sym_ids.c | 391 + gprof/sym_ids.h | 42 + gprof/symtab.c | 280 + gprof/symtab.h | 122 + gprof/tahoe.c | 354 + gprof/utils.c | 122 + gprof/utils.h | 7 + gprof/vax.c | 364 + include/COPYING | 340 + include/ChangeLog-9103 | 2737 + include/aout/adobe.h | 313 + include/aout/dynix3.h | 86 + include/aout/hp.h | 82 + include/aout/hp300hpux.h | 119 + include/aout/hppa.h | 7 + include/bout.h | 191 + include/callback.h | 270 - include/coff/ChangeLog-9103 | 1160 + include/coff/a29k.h | 148 + include/coff/apollo.h | 124 + include/coff/go32exe.h | 37 + include/coff/h8300.h | 54 + include/coff/h8500.h | 46 + include/coff/i860.h | 86 + include/coff/i960.h | 319 + include/coff/m68k.h | 81 + include/coff/m88k.h | 196 + include/coff/mcore.h | 71 + include/coff/or32.h | 287 + include/coff/tic30.h | 50 + include/coff/tic4x.h | 46 + include/coff/tic54x.h | 59 + include/coff/tic80.h | 122 + include/coff/w65.h | 46 + include/coff/we32k.h | 60 + include/coff/z8k.h | 48 + include/elf/arm-oabi.h | 88 - include/elf/po/Make-in | 251 - include/elf/po/POTFILES.in | 55 - include/elf/po/binutils.pot | 3756 - include/fopen-vms.h | 24 + include/gdb/ChangeLog | 110 + include/gdb/callback.h | 272 + include/gdb/fileio.h | 146 + include/gdb/remote-sim.h | 282 + include/gdb/signals.h | 237 + include/gdb/sim-arm.h | 114 + include/gdb/sim-d10v.h | 142 + include/gdb/sim-frv.h | 53 + include/gdb/sim-h8300.h | 78 + include/gdb/sim-sh.h | 161 + include/hp-symtab.h | 1866 + include/mpw/ChangeLog | 61 + include/mpw/README | 1 + include/mpw/dir.h | 23 + include/mpw/dirent.h | 31 + include/mpw/fcntl.h | 124 + include/mpw/grp.h | 10 + include/mpw/mpw.h | 130 + include/mpw/pwd.h | 15 + include/mpw/spin.h | 64 + include/mpw/stat.h | 75 + include/mpw/sys/file.h | 1 + include/mpw/sys/param.h | 1 + include/mpw/sys/resource.h | 9 + include/mpw/sys/stat.h | 44 + include/mpw/sys/time.h | 13 + include/mpw/sys/types.h | 15 + include/mpw/utime.h | 7 + include/mpw/varargs.h | 9 + include/nlm/ChangeLog | 93 + include/nlm/alpha-ext.h | 166 + include/nlm/common.h | 123 + include/nlm/external.h | 174 + include/nlm/i386-ext.h | 116 + include/nlm/internal.h | 309 + include/nlm/ppc-ext.h | 163 + include/nlm/sparc32-ext.h | 120 + include/oasys.h | 192 + include/opcode/a29k.h | 281 + include/opcode/avr.h | 260 + include/opcode/cris.h | 300 + include/opcode/d10v.h | 208 + include/opcode/d30v.h | 286 + include/opcode/dlx.h | 282 + include/opcode/h8300.h | 1892 + include/opcode/hppa.h | 874 + include/opcode/i370.h | 265 + include/opcode/i860.h | 507 + include/opcode/i960.h | 525 + include/opcode/m68hc11.h | 427 + include/opcode/m68k.h | 358 + include/opcode/m88k.h | 453 + include/opcode/mmix.h | 186 + include/opcode/mn10200.h | 110 + include/opcode/mn10300.h | 169 + include/opcode/msp430.h | 111 + include/opcode/ns32k.h | 487 + include/opcode/or32.h | 180 + include/opcode/pdp11.h | 85 + include/opcode/pj.h | 49 + include/opcode/pyr.h | 305 + include/opcode/tahoe.h | 213 + include/opcode/tic30.h | 691 + include/opcode/tic4x.h | 1079 + include/opcode/tic54x.h | 163 + include/opcode/tic80.h | 282 + include/opcode/v850.h | 166 + include/opcode/vax.h | 382 + include/os9k.h | 181 + include/regs/ChangeLog | 0 include/remote-sim.h | 354 - include/wait.h | 63 - include/xtensa-config.h | 139 + include/xtensa-isa-internal.h | 114 + include/xtensa-isa.h | 230 + install.sh | 247 - intl/ChangeLog | 1091 + intl/Makefile.in | 214 + intl/acconfig.h | 14 + intl/aclocal.m4 | 387 + intl/bindtextdom.c | 203 + intl/cat-compat.c | 262 + intl/config.in | 128 + intl/configure | 2950 + intl/configure.in | 10 + intl/dcgettext.c | 624 + intl/dgettext.c | 59 + intl/explodename.c | 188 + intl/finddomain.c | 216 + intl/gettext.c | 70 + intl/gettext.h | 105 + intl/gettextP.h | 89 + intl/hash-string.h | 59 + intl/intl-compat.c | 76 + intl/intlh.inst.in | 111 + intl/l10nflist.c | 411 + intl/libgettext.h | 182 + intl/libintl.glibc | 120 + intl/linux-msg.sed | 100 + intl/loadinfo.h | 76 + intl/loadmsgcat.c | 222 + intl/localealias.c | 424 + intl/po2tbl.sed.in | 102 + intl/textdomain.c | 108 + intl/xopen-msg.sed | 104 + ld/acconfig.h | 22 - ld/configdoc.texi | 14 - ld/emulparams/a29k.sh | 5 + ld/emulparams/aix5ppc.sh | 6 + ld/emulparams/aix5rs6.sh | 6 + ld/emulparams/aixppc.sh | 7 + ld/emulparams/aixrs6.sh | 7 + ld/emulparams/arm_epoc_pe.sh | 9 + ld/emulparams/armelf_linux26.sh | 20 - ld/emulparams/armelfb.sh | 2 + ld/emulparams/armelfb_linux.sh | 2 + ld/emulparams/armnto.sh | 27 + ld/emulparams/avr1.sh | 10 + ld/emulparams/avr2.sh | 10 + ld/emulparams/avr3.sh | 10 + ld/emulparams/avr4.sh | 10 + ld/emulparams/avr5.sh | 10 + ld/emulparams/coff_i860.sh | 5 + ld/emulparams/crisaout.sh | 7 + ld/emulparams/criself.sh | 104 + ld/emulparams/crislinux.sh | 39 + ld/emulparams/d10velf.sh | 9 + ld/emulparams/d30v_e.sh | 20 + ld/emulparams/d30v_o.sh | 20 + ld/emulparams/d30velf.sh | 20 + ld/emulparams/delta68.sh | 5 + ld/emulparams/ebmon29k.sh | 5 + ld/emulparams/elf32_dlx.sh | 9 + ld/emulparams/elf32_i860.sh | 9 + ld/emulparams/elf32_i960.sh | 8 + ld/emulparams/elf32am33lin.sh | 11 + ld/emulparams/elf32fr30.sh | 10 + ld/emulparams/elf32frv.sh | 19 + ld/emulparams/elf32frvfd.sh | 15 + ld/emulparams/elf32i370.sh | 8 + ld/emulparams/elf32ip2k.sh | 20 + ld/emulparams/elf32iq10.sh | 11 + ld/emulparams/elf32iq2000.sh | 14 + ld/emulparams/elf32lppcnto.sh | 5 + ld/emulparams/elf32mcore.sh | 59 + ld/emulparams/elf32openrisc.sh | 10 + ld/emulparams/elf32ppcnto.sh | 4 + ld/emulparams/elf32ppcwindiss.sh | 23 + ld/emulparams/elf32vax.sh | 11 + ld/emulparams/elf32xstormy16.sh | 13 + ld/emulparams/elf32xtensa.sh | 32 + ld/emulparams/elf64_aix.sh | 21 + ld/emulparams/elf64hppa.sh | 22 + ld/emulparams/elf64mmix.sh | 61 + ld/emulparams/elf_i386_be.sh | 12 + ld/emulparams/gld960.sh | 7 + ld/emulparams/gld960coff.sh | 19 + ld/emulparams/h8300.sh | 5 + ld/emulparams/h8300elf.sh | 12 + ld/emulparams/h8300h.sh | 5 + ld/emulparams/h8300helf.sh | 3 + ld/emulparams/h8300hn.sh | 5 + ld/emulparams/h8300hnelf.sh | 2 + ld/emulparams/h8300s.sh | 5 + ld/emulparams/h8300self.sh | 3 + ld/emulparams/h8300sn.sh | 5 + ld/emulparams/h8300snelf.sh | 2 + ld/emulparams/h8300sx.sh | 5 + ld/emulparams/h8300sxelf.sh | 3 + ld/emulparams/h8300sxn.sh | 5 + ld/emulparams/h8300sxnelf.sh | 2 + ld/emulparams/h8500.sh | 5 + ld/emulparams/h8500b.sh | 5 + ld/emulparams/h8500c.sh | 5 + ld/emulparams/h8500m.sh | 5 + ld/emulparams/h8500s.sh | 5 + ld/emulparams/hp300bsd.sh | 5 + ld/emulparams/hp3hpux.sh | 8 + ld/emulparams/hppa64linux.sh | 58 + ld/emulparams/hppaelf.sh | 9 + ld/emulparams/hppalinux.sh | 20 + ld/emulparams/hppanbsd.sh | 5 + ld/emulparams/hppaobsd.sh | 6 + ld/emulparams/i386beos.sh | 5 + ld/emulparams/i386go32.sh | 8 + ld/emulparams/i386lynx.sh | 9 + ld/emulparams/i386mach.sh | 7 + ld/emulparams/i386msdos.sh | 7 + ld/emulparams/lnk960.sh | 6 + ld/emulparams/m32relf.sh | 12 + ld/emulparams/m32relf_linux.sh | 13 + ld/emulparams/m32rlelf.sh | 2 + ld/emulparams/m32rlelf_linux.sh | 2 + ld/emulparams/m68hc11elf.sh | 18 + ld/emulparams/m68hc11elfb.sh | 12 + ld/emulparams/m68hc12elf.sh | 18 + ld/emulparams/m68hc12elfb.sh | 12 + ld/emulparams/m68k4knbsd.sh | 7 + ld/emulparams/m68kaout.sh | 7 + ld/emulparams/m68kaux.sh | 8 + ld/emulparams/m68kcoff.sh | 6 + ld/emulparams/m68kelf.sh | 12 + ld/emulparams/m68kelfnbsd.sh | 4 + ld/emulparams/m68klinux.sh | 7 + ld/emulparams/m68klynx.sh | 8 + ld/emulparams/m68knbsd.sh | 7 + ld/emulparams/m68kpsos.sh | 6 + ld/emulparams/m88kbcs.sh | 5 + ld/emulparams/mcorepe.sh | 9 + ld/emulparams/mmo.sh | 10 + ld/emulparams/mn10200.sh | 21 + ld/emulparams/mn10300.sh | 5 + ld/emulparams/msp430all.sh | 804 + ld/emulparams/news.sh | 5 + ld/emulparams/ns32knbsd.sh | 8 + ld/emulparams/or32.sh | 6 + ld/emulparams/or32elf.sh | 6 + ld/emulparams/pc532macha.sh | 6 + ld/emulparams/pdp11.sh | 5 + ld/emulparams/pjelf.sh | 5 + ld/emulparams/pjlelf.sh | 5 + ld/emulparams/riscix.sh | 5 + ld/emulparams/sa29200.sh | 5 + ld/emulparams/shelf.sh | 33 + ld/emulparams/shelf32.sh | 58 + ld/emulparams/shelf32_linux.sh | 2 + ld/emulparams/shelf32_nbsd.sh | 17 + ld/emulparams/shelf64.sh | 18 + ld/emulparams/shelf64_nbsd.sh | 8 + ld/emulparams/shelf_linux.sh | 2 + ld/emulparams/shelf_nbsd.sh | 15 + ld/emulparams/shelf_nto.sh | 10 + ld/emulparams/shlelf32.sh | 2 + ld/emulparams/shlelf32_linux.sh | 42 + ld/emulparams/shlelf32_nbsd.sh | 3 + ld/emulparams/shlelf64.sh | 2 + ld/emulparams/shlelf64_nbsd.sh | 3 + ld/emulparams/shlelf_linux.sh | 18 + ld/emulparams/shlelf_nbsd.sh | 3 + ld/emulparams/shlelf_nto.sh | 10 + ld/emulparams/shpe.sh | 9 + ld/emulparams/sparclynx.sh | 9 + ld/emulparams/st2000.sh | 5 + ld/emulparams/sun3.sh | 8 + ld/emulparams/tic30aout.sh | 7 + ld/emulparams/tic30coff.sh | 7 + ld/emulparams/tic3xcoff.sh | 6 + ld/emulparams/tic3xcoff_onchip.sh | 8 + ld/emulparams/tic4xcoff.sh | 6 + ld/emulparams/tic54xcoff.sh | 8 + ld/emulparams/tic80coff.sh | 56 + ld/emulparams/v850.sh | 15 + ld/emulparams/vax.sh | 5 + ld/emulparams/vaxnbsd.sh | 7 + ld/emulparams/w65.sh | 5 + ld/emulparams/xtensa-config.sh | 3 + ld/emulparams/z8001.sh | 7 + ld/emulparams/z8002.sh | 6 + ld/emultempl/aix.em | 1356 + ld/emultempl/beos.em | 826 + ld/emultempl/gld960.em | 189 + ld/emultempl/gld960c.em | 204 + ld/emultempl/hppaelf.em | 387 + ld/emultempl/irix.em | 41 + ld/emultempl/lnk960.em | 332 + ld/emultempl/m68hc1xelf.em | 373 + ld/emultempl/m68kcoff.em | 240 + ld/emultempl/m68kelf.em | 188 + ld/emultempl/mmix-elfnmmo.em | 121 + ld/emultempl/mmixelf.em | 44 + ld/emultempl/mmo.em | 261 + ld/emultempl/sh64elf.em | 570 + ld/emultempl/stringify.sed | 4 - ld/emultempl/xtensaelf.em | 1473 + ld/ld.info | 5838 + ld/ldgram.c | 3173 + ld/ldgram.h | 146 + ld/ldlex.c | 3711 + ld/mac-ld.r | 42 + ld/mpw-config.in | 52 + ld/mpw-make.sed | 95 + ld/po/.cvsignore | 1 + ld/po/Make-in | 24 +- ld/po/POTFILES.in | 2 +- ld/po/da.gmo | Bin 0 -> 40607 bytes ld/po/da.po | 1702 + ld/po/es.gmo | Bin 0 -> 44776 bytes ld/po/es.po | 1775 + ld/po/fr.gmo | Bin 0 -> 43539 bytes ld/po/fr.po | 1698 + ld/po/ld.pot | 860 +- ld/po/sv.gmo | Bin 0 -> 43131 bytes ld/po/sv.po | 1815 + ld/po/tr.gmo | Bin 0 -> 44359 bytes ld/po/tr.po | 1768 + ld/scripttempl/a29k.sc | 37 + ld/scripttempl/aix.sc | 62 + ld/scripttempl/avr.sc | 189 + ld/scripttempl/crisaout.sc | 131 + ld/scripttempl/delta68.sc | 49 + ld/scripttempl/dlx.sc | 30 + ld/scripttempl/ebmon29k.sc | 27 + ld/scripttempl/elf32msp430.sc | 246 + ld/scripttempl/elf32msp430_3.sc | 192 + ld/scripttempl/elf_chaos.sc | 354 + ld/scripttempl/elfd10v.sc | 196 + ld/scripttempl/elfd30v.sc | 223 + ld/scripttempl/elfi370.sc | 217 + ld/scripttempl/elfm68hc11.sc | 460 + ld/scripttempl/elfm68hc12.sc | 460 + ld/scripttempl/elfppc.sc | 288 - ld/scripttempl/elfxtensa.sc | 397 + ld/scripttempl/epocpe.sc | 151 + ld/scripttempl/h8300.sc | 94 + ld/scripttempl/h8300h.sc | 97 + ld/scripttempl/h8300hn.sc | 87 + ld/scripttempl/h8300s.sc | 97 + ld/scripttempl/h8300sn.sc | 87 + ld/scripttempl/h8300sx.sc | 97 + ld/scripttempl/h8300sxn.sc | 87 + ld/scripttempl/h8500.sc | 61 + ld/scripttempl/h8500b.sc | 61 + ld/scripttempl/h8500c.sc | 61 + ld/scripttempl/h8500m.sc | 61 + ld/scripttempl/h8500s.sc | 61 + ld/scripttempl/hppaelf.sc | 38 + ld/scripttempl/i386beos.sc | 194 + ld/scripttempl/i386go32.sc | 79 + ld/scripttempl/i386lynx.sc | 46 + ld/scripttempl/i386msdos.sc | 38 + ld/scripttempl/i860coff.sc | 42 + ld/scripttempl/i960.sc | 25 + ld/scripttempl/ip2k.sc | 150 + ld/scripttempl/iq2000.sc | 443 + ld/scripttempl/m68kaux.sc | 46 + ld/scripttempl/m68kcoff.sc | 42 + ld/scripttempl/m68klynx.sc | 46 + ld/scripttempl/m88kbcs.sc | 49 + ld/scripttempl/mcorepe.sc | 162 + ld/scripttempl/mmo.sc | 131 + ld/scripttempl/or32.sc | 37 + ld/scripttempl/pj.sc | 55 + ld/scripttempl/psos.sc | 61 + ld/scripttempl/riscix.sc | 35 + ld/scripttempl/sa29200.sc | 44 + ld/scripttempl/sparclynx.sc | 47 + ld/scripttempl/st2000.sc | 26 + ld/scripttempl/tic4xcoff.sc | 151 + ld/scripttempl/tic54xcoff.sc | 52 + ld/scripttempl/tic80coff.sc | 74 + ld/scripttempl/v850.sc | 1 + ld/scripttempl/w65.sc | 65 + ld/scripttempl/xstormy16.sc | 240 + ld/testsuite/ChangeLog | 257 + ld/testsuite/ChangeLog-9303 | 3376 + ld/testsuite/config/default.exp | 251 + ld/testsuite/ld-alpha/align.s | 9 + ld/testsuite/ld-alpha/alpha.exp | 61 + ld/testsuite/ld-alpha/tlsbin.dd | 62 + ld/testsuite/ld-alpha/tlsbin.rd | 145 + ld/testsuite/ld-alpha/tlsbin.s | 46 + ld/testsuite/ld-alpha/tlsbin.sd | 17 + ld/testsuite/ld-alpha/tlsbin.td | 17 + ld/testsuite/ld-alpha/tlsbinpic.s | 74 + ld/testsuite/ld-alpha/tlsbinr.dd | 62 + ld/testsuite/ld-alpha/tlsbinr.rd | 140 + ld/testsuite/ld-alpha/tlsbinr.sd | 12 + ld/testsuite/ld-alpha/tlsg.s | 14 + ld/testsuite/ld-alpha/tlsg.sd | 10 + ld/testsuite/ld-alpha/tlslib.s | 19 + ld/testsuite/ld-alpha/tlspic.dd | 56 + ld/testsuite/ld-alpha/tlspic.rd | 155 + ld/testsuite/ld-alpha/tlspic.sd | 17 + ld/testsuite/ld-alpha/tlspic.td | 17 + ld/testsuite/ld-alpha/tlspic1.s | 87 + ld/testsuite/ld-alpha/tlspic2.s | 11 + ld/testsuite/ld-arm/arm-app-abs32.d | 29 + ld/testsuite/ld-arm/arm-app-abs32.r | 8 + ld/testsuite/ld-arm/arm-app-abs32.s | 16 + ld/testsuite/ld-arm/arm-app.d | 35 + ld/testsuite/ld-arm/arm-app.r | 9 + ld/testsuite/ld-arm/arm-app.s | 23 + ld/testsuite/ld-arm/arm-elf.exp | 52 + ld/testsuite/ld-arm/arm-lib-plt32.d | 28 + ld/testsuite/ld-arm/arm-lib-plt32.r | 8 + ld/testsuite/ld-arm/arm-lib-plt32.s | 17 + ld/testsuite/ld-arm/arm-lib.d | 28 + ld/testsuite/ld-arm/arm-lib.r | 8 + ld/testsuite/ld-arm/arm-lib.s | 24 + ld/testsuite/ld-arm/arm-static-app.d | 24 + ld/testsuite/ld-arm/arm-static-app.r | 3 + ld/testsuite/ld-arm/arm-static-app.s | 20 + ld/testsuite/ld-auto-import/auto-import.exp | 160 + ld/testsuite/ld-auto-import/client.c | 55 + ld/testsuite/ld-auto-import/dll.c | 20 + ld/testsuite/ld-bootstrap/bootstrap.exp | 165 + ld/testsuite/ld-cdtest/cdtest-bar.cc | 17 + ld/testsuite/ld-cdtest/cdtest-foo.cc | 89 + ld/testsuite/ld-cdtest/cdtest-foo.h | 24 + ld/testsuite/ld-cdtest/cdtest-main.cc | 40 + ld/testsuite/ld-cdtest/cdtest-nrv.dat | 13 + ld/testsuite/ld-cdtest/cdtest.dat | 15 + ld/testsuite/ld-cdtest/cdtest.exp | 123 + ld/testsuite/ld-checks/asm.s | 11 + ld/testsuite/ld-checks/checks.exp | 79 + ld/testsuite/ld-checks/script | 6 + ld/testsuite/ld-cris/badgotr1.d | 11 + ld/testsuite/ld-cris/comref1.s | 8 + ld/testsuite/ld-cris/cris.exp | 55 + ld/testsuite/ld-cris/dso-1.s | 7 + ld/testsuite/ld-cris/dso-2.s | 6 + ld/testsuite/ld-cris/dso-3.s | 20 + ld/testsuite/ld-cris/dsofnf.s | 7 + ld/testsuite/ld-cris/dsofnf2.s | 8 + ld/testsuite/ld-cris/euwref1.s | 8 + ld/testsuite/ld-cris/expdref1.s | 6 + ld/testsuite/ld-cris/expdyn1.d | 14 + ld/testsuite/ld-cris/expdyn1.s | 17 + ld/testsuite/ld-cris/expdyn2.d | 16 + ld/testsuite/ld-cris/expdyn3.d | 12 + ld/testsuite/ld-cris/expdyn4.d | 12 + ld/testsuite/ld-cris/expdyn5.d | 13 + ld/testsuite/ld-cris/expdyn6.d | 13 + ld/testsuite/ld-cris/expdyn7.d | 13 + ld/testsuite/ld-cris/gotplt1.d | 48 + ld/testsuite/ld-cris/gotplt2.d | 37 + ld/testsuite/ld-cris/gotplt3.d | 35 + ld/testsuite/ld-cris/gotrel1.s | 4 + ld/testsuite/ld-cris/gotrel2.s | 5 + ld/testsuite/ld-cris/hide1 | 1 + ld/testsuite/ld-cris/ldsym1.d | 20 + ld/testsuite/ld-cris/libdso-1.d | 13 + ld/testsuite/ld-cris/libdso-2.d | 75 + ld/testsuite/ld-cris/libdso-3.d | 14 + ld/testsuite/ld-cris/libdso-4.d | 11 + ld/testsuite/ld-cris/locref1.d | 23 + ld/testsuite/ld-cris/locref1.s | 3 + ld/testsuite/ld-cris/locref2.d | 23 + ld/testsuite/ld-cris/locref2.s | 5 + ld/testsuite/ld-cris/nodyn4.d | 19 + ld/testsuite/ld-cris/nodyn5.d | 13 + ld/testsuite/ld-cris/noglob1.d | 9 + ld/testsuite/ld-cris/noglob1.s | 4 + ld/testsuite/ld-cris/undef1.d | 13 + ld/testsuite/ld-cris/weakref1.d | 17 + ld/testsuite/ld-cris/weakref2.d | 10 + ld/testsuite/ld-cygwin/exe-export.exp | 151 + ld/testsuite/ld-cygwin/testdll.c | 14 + ld/testsuite/ld-cygwin/testdll.def | 4 + ld/testsuite/ld-cygwin/testexe.c | 16 + ld/testsuite/ld-cygwin/testexe.def | 5 + ld/testsuite/ld-d10v/d10v.exp | 250 + ld/testsuite/ld-d10v/default_layout.d | 16 + ld/testsuite/ld-d10v/linktest-001.s | 4 + ld/testsuite/ld-d10v/linktest-002.lt | 2 + ld/testsuite/ld-d10v/linktest-002.s | 4 + ld/testsuite/ld-d10v/regression-001.lt | 3 + ld/testsuite/ld-d10v/regression-001.s | 14 + ld/testsuite/ld-d10v/reloc-001.d | 12 + ld/testsuite/ld-d10v/reloc-001.ld | 10 + ld/testsuite/ld-d10v/reloc-001.s | 11 + ld/testsuite/ld-d10v/reloc-002.d | 12 + ld/testsuite/ld-d10v/reloc-002.ld | 10 + ld/testsuite/ld-d10v/reloc-003.d | 5 + ld/testsuite/ld-d10v/reloc-003.ld | 10 + ld/testsuite/ld-d10v/reloc-004.d | 5 + ld/testsuite/ld-d10v/reloc-004.ld | 10 + ld/testsuite/ld-d10v/reloc-005.d | 13 + ld/testsuite/ld-d10v/reloc-005.ld | 10 + ld/testsuite/ld-d10v/reloc-005.s | 11 + ld/testsuite/ld-d10v/reloc-006.d | 13 + ld/testsuite/ld-d10v/reloc-006.ld | 8 + ld/testsuite/ld-d10v/reloc-007.d | 7 + ld/testsuite/ld-d10v/reloc-007.ld | 8 + ld/testsuite/ld-d10v/reloc-008.d | 7 + ld/testsuite/ld-d10v/reloc-008.ld | 8 + ld/testsuite/ld-d10v/reloc-009.d | 15 + ld/testsuite/ld-d10v/reloc-009.ld | 11 + ld/testsuite/ld-d10v/reloc-009.s | 12 + ld/testsuite/ld-d10v/reloc-010.d | 16 + ld/testsuite/ld-d10v/reloc-010.ld | 11 + ld/testsuite/ld-d10v/reloc-011.d | 6 + ld/testsuite/ld-d10v/reloc-011.ld | 11 + ld/testsuite/ld-d10v/reloc-012.d | 6 + ld/testsuite/ld-d10v/reloc-012.ld | 11 + ld/testsuite/ld-d10v/reloc-013.d | 16 + ld/testsuite/ld-d10v/reloc-013.ld | 12 + ld/testsuite/ld-d10v/reloc-014.d | 16 + ld/testsuite/ld-d10v/reloc-014.ld | 12 + ld/testsuite/ld-d10v/reloc-015.d | 7 + ld/testsuite/ld-d10v/reloc-015.ld | 12 + ld/testsuite/ld-d10v/reloc-016.d | 7 + ld/testsuite/ld-d10v/reloc-016.ld | 12 + ld/testsuite/ld-d10v/simple.s | 5 + ld/testsuite/ld-discard/discard.exp | 47 + ld/testsuite/ld-discard/discard.ld | 9 + ld/testsuite/ld-discard/exit.s | 6 + ld/testsuite/ld-discard/extern.d | 3 + ld/testsuite/ld-discard/extern.s | 13 + ld/testsuite/ld-discard/start.d | 4 + ld/testsuite/ld-discard/start.s | 7 + ld/testsuite/ld-discard/static.d | 3 + ld/testsuite/ld-discard/static.s | 11 + ld/testsuite/ld-elf/elf.exp | 30 + ld/testsuite/ld-elf/merge.d | 15 + ld/testsuite/ld-elf/merge.ld | 7 + ld/testsuite/ld-elf/merge.s | 14 + ld/testsuite/ld-elf/merge2.d | 15 + ld/testsuite/ld-elf/merge2.s | 58 + ld/testsuite/ld-elf/sec64k.exp | 149 + ld/testsuite/ld-elfcomm/common1a.c | 2 + ld/testsuite/ld-elfcomm/common1b.c | 3 + ld/testsuite/ld-elfcomm/elfcomm.exp | 97 + ld/testsuite/ld-elfvers/vers.exp | 946 + ld/testsuite/ld-elfvers/vers1.c | 101 + ld/testsuite/ld-elfvers/vers1.dsym | 9 + ld/testsuite/ld-elfvers/vers1.map | 13 + ld/testsuite/ld-elfvers/vers1.sym | 4 + ld/testsuite/ld-elfvers/vers1.ver | 8 + ld/testsuite/ld-elfvers/vers13.asym | 10 + ld/testsuite/ld-elfvers/vers15.c | 36 + ld/testsuite/ld-elfvers/vers15.dsym | 5 + ld/testsuite/ld-elfvers/vers15.sym | 3 + ld/testsuite/ld-elfvers/vers15.ver | 5 + ld/testsuite/ld-elfvers/vers16.c | 10 + ld/testsuite/ld-elfvers/vers16.dsym | 2 + ld/testsuite/ld-elfvers/vers16.map | 3 + ld/testsuite/ld-elfvers/vers16a.c | 8 + ld/testsuite/ld-elfvers/vers16a.dsym | 3 + ld/testsuite/ld-elfvers/vers16a.ver | 3 + ld/testsuite/ld-elfvers/vers17.c | 5 + ld/testsuite/ld-elfvers/vers17.dsym | 2 + ld/testsuite/ld-elfvers/vers17.map | 4 + ld/testsuite/ld-elfvers/vers17.ver | 3 + ld/testsuite/ld-elfvers/vers18.c | 42 + ld/testsuite/ld-elfvers/vers18.dsym | 7 + ld/testsuite/ld-elfvers/vers18.map | 12 + ld/testsuite/ld-elfvers/vers18.sym | 4 + ld/testsuite/ld-elfvers/vers18.ver | 7 + ld/testsuite/ld-elfvers/vers19.c | 10 + ld/testsuite/ld-elfvers/vers19.dsym | 1 + ld/testsuite/ld-elfvers/vers19.ver | 3 + ld/testsuite/ld-elfvers/vers2.c | 13 + ld/testsuite/ld-elfvers/vers2.dsym | 3 + ld/testsuite/ld-elfvers/vers2.map | 4 + ld/testsuite/ld-elfvers/vers2.ver | 8 + ld/testsuite/ld-elfvers/vers20.c | 1 + ld/testsuite/ld-elfvers/vers20.dsym | 2 + ld/testsuite/ld-elfvers/vers20.map | 7 + ld/testsuite/ld-elfvers/vers20.ver | 4 + ld/testsuite/ld-elfvers/vers20a.ver | 4 + ld/testsuite/ld-elfvers/vers21.c | 32 + ld/testsuite/ld-elfvers/vers21.dsym | 4 + ld/testsuite/ld-elfvers/vers21.map | 8 + ld/testsuite/ld-elfvers/vers21.sym | 3 + ld/testsuite/ld-elfvers/vers21.ver | 4 + ld/testsuite/ld-elfvers/vers22.c | 7 + ld/testsuite/ld-elfvers/vers22.dsym | 1 + ld/testsuite/ld-elfvers/vers22.map | 4 + ld/testsuite/ld-elfvers/vers22.ver | 4 + ld/testsuite/ld-elfvers/vers22a.c | 6 + ld/testsuite/ld-elfvers/vers22a.dsym | 2 + ld/testsuite/ld-elfvers/vers22a.sym | 1 + ld/testsuite/ld-elfvers/vers22a.ver | 4 + ld/testsuite/ld-elfvers/vers22b.c | 4 + ld/testsuite/ld-elfvers/vers22b.dsym | 2 + ld/testsuite/ld-elfvers/vers22b.ver | 4 + ld/testsuite/ld-elfvers/vers23.c | 10 + ld/testsuite/ld-elfvers/vers23.dsym | 1 + ld/testsuite/ld-elfvers/vers23.ver | 4 + ld/testsuite/ld-elfvers/vers23a.c | 11 + ld/testsuite/ld-elfvers/vers23a.dsym | 3 + ld/testsuite/ld-elfvers/vers23a.map | 5 + ld/testsuite/ld-elfvers/vers23a.sym | 1 + ld/testsuite/ld-elfvers/vers23a.ver | 4 + ld/testsuite/ld-elfvers/vers23b.c | 4 + ld/testsuite/ld-elfvers/vers23b.dsym | 2 + ld/testsuite/ld-elfvers/vers23b.map | 4 + ld/testsuite/ld-elfvers/vers23b.ver | 4 + ld/testsuite/ld-elfvers/vers23c.ver | 4 + ld/testsuite/ld-elfvers/vers23d.dsym | 2 + ld/testsuite/ld-elfvers/vers24.map | 4 + ld/testsuite/ld-elfvers/vers24.rd | 15 + ld/testsuite/ld-elfvers/vers24a.c | 5 + ld/testsuite/ld-elfvers/vers24b.c | 5 + ld/testsuite/ld-elfvers/vers24c.c | 9 + ld/testsuite/ld-elfvers/vers25a.c | 1 + ld/testsuite/ld-elfvers/vers25a.dsym | 2 + ld/testsuite/ld-elfvers/vers25a.map | 5 + ld/testsuite/ld-elfvers/vers25a.ver | 4 + ld/testsuite/ld-elfvers/vers25b.c | 1 + ld/testsuite/ld-elfvers/vers25b.dsym | 1 + ld/testsuite/ld-elfvers/vers25b.ver | 1 + ld/testsuite/ld-elfvers/vers26a.c | 4 + ld/testsuite/ld-elfvers/vers26a.dsym | 2 + ld/testsuite/ld-elfvers/vers26a.map | 5 + ld/testsuite/ld-elfvers/vers26a.ver | 4 + ld/testsuite/ld-elfvers/vers26b.c | 10 + ld/testsuite/ld-elfvers/vers26b.dsym | 1 + ld/testsuite/ld-elfvers/vers26b.ver | 1 + ld/testsuite/ld-elfvers/vers27a.c | 1 + ld/testsuite/ld-elfvers/vers27a.dsym | 2 + ld/testsuite/ld-elfvers/vers27a.map | 5 + ld/testsuite/ld-elfvers/vers27a.ver | 4 + ld/testsuite/ld-elfvers/vers27b.c | 2 + ld/testsuite/ld-elfvers/vers27b.dsym | 1 + ld/testsuite/ld-elfvers/vers27b.ver | 1 + ld/testsuite/ld-elfvers/vers27c.c | 1 + ld/testsuite/ld-elfvers/vers27c.dsym | 1 + ld/testsuite/ld-elfvers/vers27c.ver | 1 + ld/testsuite/ld-elfvers/vers27d.dsym | 2 + ld/testsuite/ld-elfvers/vers27d.sym | 1 + ld/testsuite/ld-elfvers/vers27d.ver | 4 + ld/testsuite/ld-elfvers/vers27d1.c | 6 + ld/testsuite/ld-elfvers/vers27d2.c | 7 + ld/testsuite/ld-elfvers/vers27d3.c | 21 + ld/testsuite/ld-elfvers/vers27d4.dsym | 1 + ld/testsuite/ld-elfvers/vers27d4.ver | 3 + ld/testsuite/ld-elfvers/vers28a.c | 1 + ld/testsuite/ld-elfvers/vers28a.dsym | 1 + ld/testsuite/ld-elfvers/vers28a.ver | 1 + ld/testsuite/ld-elfvers/vers28b.c | 3 + ld/testsuite/ld-elfvers/vers28b.dsym | 2 + ld/testsuite/ld-elfvers/vers28b.map | 5 + ld/testsuite/ld-elfvers/vers28b.ver | 4 + ld/testsuite/ld-elfvers/vers28c.c | 7 + ld/testsuite/ld-elfvers/vers28c.dsym | 1 + ld/testsuite/ld-elfvers/vers28c.ver | 4 + ld/testsuite/ld-elfvers/vers3.c | 13 + ld/testsuite/ld-elfvers/vers3.dsym | 1 + ld/testsuite/ld-elfvers/vers3.ver | 4 + ld/testsuite/ld-elfvers/vers4.c | 31 + ld/testsuite/ld-elfvers/vers4.sym | 1 + ld/testsuite/ld-elfvers/vers4a.dsym | 2 + ld/testsuite/ld-elfvers/vers4a.sym | 1 + ld/testsuite/ld-elfvers/vers4a.ver | 4 + ld/testsuite/ld-elfvers/vers5.c | 51 + ld/testsuite/ld-elfvers/vers6.c | 25 + ld/testsuite/ld-elfvers/vers6.dsym | 4 + ld/testsuite/ld-elfvers/vers6.sym | 4 + ld/testsuite/ld-elfvers/vers6.ver | 6 + ld/testsuite/ld-elfvers/vers7.c | 13 + ld/testsuite/ld-elfvers/vers7.map | 6 + ld/testsuite/ld-elfvers/vers7a.c | 18 + ld/testsuite/ld-elfvers/vers7a.dsym | 2 + ld/testsuite/ld-elfvers/vers7a.sym | 2 + ld/testsuite/ld-elfvers/vers7a.ver | 4 + ld/testsuite/ld-elfvers/vers8.c | 5 + ld/testsuite/ld-elfvers/vers8.map | 15 + ld/testsuite/ld-elfvers/vers8.ver | 8 + ld/testsuite/ld-elfvers/vers9.c | 47 + ld/testsuite/ld-elfvers/vers9.dsym | 4 + ld/testsuite/ld-elfvers/vers9.sym | 4 + ld/testsuite/ld-elfvers/vers9.ver | 5 + ld/testsuite/ld-elfvsb/common.c | 14 + ld/testsuite/ld-elfvsb/define.s | 10 + ld/testsuite/ld-elfvsb/elf-offset.ld | 173 + ld/testsuite/ld-elfvsb/elfvsb.dat | 26 + ld/testsuite/ld-elfvsb/elfvsb.exp | 462 + ld/testsuite/ld-elfvsb/hidden0.d | 10 + ld/testsuite/ld-elfvsb/hidden1.d | 9 + ld/testsuite/ld-elfvsb/internal0.d | 10 + ld/testsuite/ld-elfvsb/internal1.d | 9 + ld/testsuite/ld-elfvsb/main.c | 306 + ld/testsuite/ld-elfvsb/protected0.d | 10 + ld/testsuite/ld-elfvsb/protected1.d | 9 + ld/testsuite/ld-elfvsb/sh1.c | 407 + ld/testsuite/ld-elfvsb/sh2.c | 46 + ld/testsuite/ld-elfvsb/sh3.c | 7 + ld/testsuite/ld-elfvsb/test.c | 26 + ld/testsuite/ld-elfvsb/undef.s | 3 + ld/testsuite/ld-elfweak/bar.c | 16 + ld/testsuite/ld-elfweak/bar1a.c | 26 + ld/testsuite/ld-elfweak/bar1b.c | 7 + ld/testsuite/ld-elfweak/bar1c.c | 7 + ld/testsuite/ld-elfweak/dso.dsym | 1 + ld/testsuite/ld-elfweak/dsodata.dsym | 2 + ld/testsuite/ld-elfweak/dsow.dsym | 1 + ld/testsuite/ld-elfweak/dsowdata.dsym | 1 + ld/testsuite/ld-elfweak/elfweak.exp | 467 + ld/testsuite/ld-elfweak/foo.c | 8 + ld/testsuite/ld-elfweak/foo1a.c | 7 + ld/testsuite/ld-elfweak/foo1b.c | 7 + ld/testsuite/ld-elfweak/main.c | 19 + ld/testsuite/ld-elfweak/main1.c | 11 + ld/testsuite/ld-elfweak/strong.dat | 1 + ld/testsuite/ld-elfweak/strong.sym | 1 + ld/testsuite/ld-elfweak/strongcomm.sym | 2 + ld/testsuite/ld-elfweak/strongdata.dat | 1 + ld/testsuite/ld-elfweak/strongdata.sym | 2 + ld/testsuite/ld-elfweak/weak.dat | 1 + ld/testsuite/ld-elfweak/weak.dsym | 1 + ld/testsuite/ld-elfweak/weakdata.dat | 1 + ld/testsuite/ld-elfweak/weakdata.dsym | 1 + ld/testsuite/ld-empic/empic.exp | 263 + ld/testsuite/ld-empic/relax.t | 49 + ld/testsuite/ld-empic/relax1.c | 22 + ld/testsuite/ld-empic/relax2.c | 19 + ld/testsuite/ld-empic/relax3.c | 3 + ld/testsuite/ld-empic/relax4.c | 3 + ld/testsuite/ld-empic/run.c | 160 + ld/testsuite/ld-empic/runtest1.c | 117 + ld/testsuite/ld-empic/runtest2.c | 26 + ld/testsuite/ld-empic/runtesti.s | 94 + ld/testsuite/ld-fastcall/export.s | 3 + ld/testsuite/ld-fastcall/fastcall.exp | 48 + ld/testsuite/ld-fastcall/import.s | 4 + ld/testsuite/ld-frv/fdpic-pie-1.d | 58 + ld/testsuite/ld-frv/fdpic-pie-2.d | 72 + ld/testsuite/ld-frv/fdpic-pie-5.d | 6 + ld/testsuite/ld-frv/fdpic-pie-6-fail.d | 6 + ld/testsuite/ld-frv/fdpic-pie-6.d | 74 + ld/testsuite/ld-frv/fdpic-pie-7.d | 58 + ld/testsuite/ld-frv/fdpic-pie-8-fail.d | 0 ld/testsuite/ld-frv/fdpic-pie-8.d | 72 + ld/testsuite/ld-frv/fdpic-shared-1.d | 58 + ld/testsuite/ld-frv/fdpic-shared-2-fail.d | 5 + ld/testsuite/ld-frv/fdpic-shared-2.d | 81 + ld/testsuite/ld-frv/fdpic-shared-3.d | 84 + ld/testsuite/ld-frv/fdpic-shared-4.d | 72 + ld/testsuite/ld-frv/fdpic-shared-5.d | 83 + ld/testsuite/ld-frv/fdpic-shared-6-fail.d | 6 + ld/testsuite/ld-frv/fdpic-shared-6.d | 74 + ld/testsuite/ld-frv/fdpic-shared-7.d | 58 + ld/testsuite/ld-frv/fdpic-shared-8-fail.d | 6 + ld/testsuite/ld-frv/fdpic-shared-8.d | 84 + ld/testsuite/ld-frv/fdpic-shared-local-2.d | 84 + ld/testsuite/ld-frv/fdpic-shared-local-8.d | 84 + ld/testsuite/ld-frv/fdpic-static-1.d | 63 + ld/testsuite/ld-frv/fdpic-static-2.d | 95 + ld/testsuite/ld-frv/fdpic-static-5.d | 6 + ld/testsuite/ld-frv/fdpic-static-6.d | 74 + ld/testsuite/ld-frv/fdpic-static-7.d | 63 + ld/testsuite/ld-frv/fdpic-static-8.d | 95 + ld/testsuite/ld-frv/fdpic.exp | 61 + ld/testsuite/ld-frv/fdpic1.s | 64 + ld/testsuite/ld-frv/fdpic2.ldv | 1 + ld/testsuite/ld-frv/fdpic2.s | 81 + ld/testsuite/ld-frv/fdpic2min.ldv | 1 + ld/testsuite/ld-frv/fdpic3.s | 99 + ld/testsuite/ld-frv/fdpic4.s | 99 + ld/testsuite/ld-frv/fdpic5.s | 38 + ld/testsuite/ld-frv/fdpic6.ldv | 1 + ld/testsuite/ld-frv/fdpic6.s | 55 + ld/testsuite/ld-frv/fdpic7.s | 63 + ld/testsuite/ld-frv/fdpic8.ldv | 1 + ld/testsuite/ld-frv/fdpic8.s | 81 + ld/testsuite/ld-frv/fdpic8min.ldv | 1 + ld/testsuite/ld-h8300/h8300.exp | 38 + ld/testsuite/ld-h8300/relax-2.d | 11 + ld/testsuite/ld-h8300/relax-2.s | 8 + ld/testsuite/ld-h8300/relax-3-coff.d | 32 + ld/testsuite/ld-h8300/relax-3.d | 31 + ld/testsuite/ld-h8300/relax-3.s | 32 + ld/testsuite/ld-h8300/relax-4-coff.d | 52 + ld/testsuite/ld-h8300/relax-4.d | 51 + ld/testsuite/ld-h8300/relax-4.s | 72 + ld/testsuite/ld-h8300/relax-5-coff.d | 50 + ld/testsuite/ld-h8300/relax-5.d | 50 + ld/testsuite/ld-h8300/relax-5.s | 66 + ld/testsuite/ld-h8300/relax.d | 21 + ld/testsuite/ld-h8300/relax.s | 10 + ld/testsuite/ld-i386/combreloc.d | 18 + ld/testsuite/ld-i386/combreloc.s | 22 + ld/testsuite/ld-i386/i386.exp | 66 + ld/testsuite/ld-i386/reloc.d | 18 + ld/testsuite/ld-i386/reloc.s | 8 + ld/testsuite/ld-i386/tlsbin.dd | 456 + ld/testsuite/ld-i386/tlsbin.rd | 167 + ld/testsuite/ld-i386/tlsbin.s | 165 + ld/testsuite/ld-i386/tlsbin.sd | 14 + ld/testsuite/ld-i386/tlsbin.td | 16 + ld/testsuite/ld-i386/tlsbinpic.s | 168 + ld/testsuite/ld-i386/tlsg.s | 12 + ld/testsuite/ld-i386/tlsg.sd | 10 + ld/testsuite/ld-i386/tlsindntpoff.dd | 16 + ld/testsuite/ld-i386/tlsindntpoff.s | 19 + ld/testsuite/ld-i386/tlslib.s | 17 + ld/testsuite/ld-i386/tlsnopic.dd | 161 + ld/testsuite/ld-i386/tlsnopic.rd | 133 + ld/testsuite/ld-i386/tlsnopic.sd | 13 + ld/testsuite/ld-i386/tlsnopic1.s | 107 + ld/testsuite/ld-i386/tlsnopic2.s | 7 + ld/testsuite/ld-i386/tlspic.dd | 411 + ld/testsuite/ld-i386/tlspic.rd | 174 + ld/testsuite/ld-i386/tlspic.sd | 19 + ld/testsuite/ld-i386/tlspic.td | 16 + ld/testsuite/ld-i386/tlspic1.s | 282 + ld/testsuite/ld-i386/tlspic2.s | 11 + ld/testsuite/ld-ia64/ia64.exp | 54 + ld/testsuite/ld-ia64/tlsbin.dd | 74 + ld/testsuite/ld-ia64/tlsbin.rd | 147 + ld/testsuite/ld-ia64/tlsbin.s | 53 + ld/testsuite/ld-ia64/tlsbin.sd | 15 + ld/testsuite/ld-ia64/tlsbin.td | 16 + ld/testsuite/ld-ia64/tlsbinpic.s | 96 + ld/testsuite/ld-ia64/tlsg.s | 14 + ld/testsuite/ld-ia64/tlsg.sd | 10 + ld/testsuite/ld-ia64/tlslib.s | 18 + ld/testsuite/ld-ia64/tlspic.dd | 64 + ld/testsuite/ld-ia64/tlspic.rd | 159 + ld/testsuite/ld-ia64/tlspic.sd | 15 + ld/testsuite/ld-ia64/tlspic.td | 16 + ld/testsuite/ld-ia64/tlspic1.s | 113 + ld/testsuite/ld-ia64/tlspic2.s | 11 + ld/testsuite/ld-linkonce/linkonce.exp | 43 + ld/testsuite/ld-linkonce/x.s | 26 + ld/testsuite/ld-linkonce/y.s | 33 + ld/testsuite/ld-linkonce/zeroeh.ld | 4 + ld/testsuite/ld-linkonce/zeroehl32.d | 18 + ld/testsuite/ld-m68hc11/adj-brset.d | 32 + ld/testsuite/ld-m68hc11/adj-brset.s | 51 + ld/testsuite/ld-m68hc11/adj-jump.d | 60 + ld/testsuite/ld-m68hc11/adj-jump.s | 74 + ld/testsuite/ld-m68hc11/bug-1403.d | 12 + ld/testsuite/ld-m68hc11/bug-1403.s | 20 + ld/testsuite/ld-m68hc11/bug-1417.d | 15 + ld/testsuite/ld-m68hc11/bug-1417.s | 21 + ld/testsuite/ld-m68hc11/bug-3331.d | 14 + ld/testsuite/ld-m68hc11/bug-3331.s | 23 + ld/testsuite/ld-m68hc11/far-hc11.d | 73 + ld/testsuite/ld-m68hc11/far-hc11.s | 105 + ld/testsuite/ld-m68hc11/far-hc12.d | 55 + ld/testsuite/ld-m68hc11/far-hc12.ld | 18 + ld/testsuite/ld-m68hc11/far-hc12.s | 83 + ld/testsuite/ld-m68hc11/link-hc12.s | 6 + ld/testsuite/ld-m68hc11/link-hcs12.d | 24 + ld/testsuite/ld-m68hc11/link-hcs12.s | 7 + ld/testsuite/ld-m68hc11/m68hc11.exp | 31 + ld/testsuite/ld-m68hc11/relax-direct.d | 63 + ld/testsuite/ld-m68hc11/relax-direct.s | 84 + ld/testsuite/ld-m68hc11/relax-group.d | 63 + ld/testsuite/ld-m68hc11/relax-group.s | 161 + ld/testsuite/ld-mips-elf/branch-misc-1.d | 30 + ld/testsuite/ld-mips-elf/elf-rel-got-n32.d | 314 + ld/testsuite/ld-mips-elf/elf-rel-got-n64-linux.d | 333 + ld/testsuite/ld-mips-elf/elf-rel-got-n64.d | 331 + ld/testsuite/ld-mips-elf/elf-rel-xgot-n32.d | 428 + ld/testsuite/ld-mips-elf/elf-rel-xgot-n64-linux.d | 437 + ld/testsuite/ld-mips-elf/elf-rel-xgot-n64.d | 435 + ld/testsuite/ld-mips-elf/empic1-ln.d | 27 + ld/testsuite/ld-mips-elf/empic1-lp.d | 26 + ld/testsuite/ld-mips-elf/empic1-mn.d | 25 + ld/testsuite/ld-mips-elf/empic1-mp.d | 25 + ld/testsuite/ld-mips-elf/empic1-ref.s | 9 + ld/testsuite/ld-mips-elf/empic1-sn.d | 23 + ld/testsuite/ld-mips-elf/empic1-sp.d | 23 + ld/testsuite/ld-mips-elf/empic1-space.s | 5 + ld/testsuite/ld-mips-elf/empic1-tgt.s | 8 + ld/testsuite/ld-mips-elf/empic2-fwd-0.d | 20 + ld/testsuite/ld-mips-elf/empic2-fwd-1.d | 21 + ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s | 7 + ld/testsuite/ld-mips-elf/empic2-ref.s | 7 + ld/testsuite/ld-mips-elf/empic2-rev-0.d | 22 + ld/testsuite/ld-mips-elf/empic2-rev-1.d | 24 + ld/testsuite/ld-mips-elf/empic2-rev-tgt.s | 8 + ld/testsuite/ld-mips-elf/empic2-space.s | 5 + ld/testsuite/ld-mips-elf/emrelocs-eb.d | 25 + ld/testsuite/ld-mips-elf/emrelocs-el.d | 25 + ld/testsuite/ld-mips-elf/emrelocs.ld | 16 + ld/testsuite/ld-mips-elf/emrelocs1.s | 23 + ld/testsuite/ld-mips-elf/emrelocs2.s | 30 + ld/testsuite/ld-mips-elf/jr.s | 1 + ld/testsuite/ld-mips-elf/mips-elf-flags.exp | 160 + ld/testsuite/ld-mips-elf/mips-elf.exp | 99 + ld/testsuite/ld-mips-elf/mips16-1.d | 9 + ld/testsuite/ld-mips-elf/mips16-1a.s | 2 + ld/testsuite/ld-mips-elf/mips16-1b.s | 2 + ld/testsuite/ld-mips-elf/multi-got-1-1.s | 16384 ++ ld/testsuite/ld-mips-elf/multi-got-1-2.s | 16384 ++ ld/testsuite/ld-mips-elf/multi-got-1.d | 8233 + ld/testsuite/ld-mips-elf/region1.d | 11 + ld/testsuite/ld-mips-elf/region1.t | 12 + ld/testsuite/ld-mips-elf/region1a.s | 3 + ld/testsuite/ld-mips-elf/region1b.s | 2 + ld/testsuite/ld-mips-elf/rel32-n32.d | 15 + ld/testsuite/ld-mips-elf/rel32-o32.d | 16 + ld/testsuite/ld-mips-elf/rel32.s | 4 + ld/testsuite/ld-mips-elf/rel64.d | 19 + ld/testsuite/ld-mips-elf/rel64.s | 4 + ld/testsuite/ld-mips-elf/relax-jalr-n32-shared.d | 25 + ld/testsuite/ld-mips-elf/relax-jalr-n32.d | 23 + ld/testsuite/ld-mips-elf/relax-jalr-n64-shared.d | 25 + ld/testsuite/ld-mips-elf/relax-jalr-n64.d | 23 + ld/testsuite/ld-mips-elf/relax-jalr.s | 15 + ld/testsuite/ld-mips-elf/reloc-1-n32.d | 199 + ld/testsuite/ld-mips-elf/reloc-1-n64.d | 459 + ld/testsuite/ld-mips-elf/reloc-1-rel.d | 356 + ld/testsuite/ld-mips-elf/reloc-1a.s | 100 + ld/testsuite/ld-mips-elf/reloc-1b.s | 95 + ld/testsuite/ld-mips-elf/reloc-2.d | 169 + ld/testsuite/ld-mips-elf/reloc-2.ld | 9 + ld/testsuite/ld-mips-elf/reloc-2a.s | 78 + ld/testsuite/ld-mips-elf/reloc-2b.s | 73 + ld/testsuite/ld-mips-elf/reloc-3-r.d | 83 + ld/testsuite/ld-mips-elf/reloc-3-srec.d | 54 + ld/testsuite/ld-mips-elf/reloc-3.ld | 8 + ld/testsuite/ld-mips-elf/reloc-3a.s | 38 + ld/testsuite/ld-mips-elf/reloc-3b.s | 58 + ld/testsuite/ld-mmix/a.s | 5 + ld/testsuite/ld-mmix/areg-256.s | 2 + ld/testsuite/ld-mmix/areg-t.s | 3 + ld/testsuite/ld-mmix/aregm.s | 5 + ld/testsuite/ld-mmix/b-badfil1.d | 7 + ld/testsuite/ld-mmix/b-badfil1.s | 10 + ld/testsuite/ld-mmix/b-badfil2.d | 7 + ld/testsuite/ld-mmix/b-badfil2.s | 6 + ld/testsuite/ld-mmix/b-badfixo.d | 7 + ld/testsuite/ld-mmix/b-badfixo.s | 5 + ld/testsuite/ld-mmix/b-badloc.d | 7 + ld/testsuite/ld-mmix/b-badloc.s | 5 + ld/testsuite/ld-mmix/b-badlop.d | 7 + ld/testsuite/ld-mmix/b-badlop.s | 4 + ld/testsuite/ld-mmix/b-badm.d | 6 + ld/testsuite/ld-mmix/b-badm2.s | 6 + ld/testsuite/ld-mmix/b-badmain.s | 7 + ld/testsuite/ld-mmix/b-badquot.d | 7 + ld/testsuite/ld-mmix/b-badquot.s | 5 + ld/testsuite/ld-mmix/b-badrx1.d | 7 + ld/testsuite/ld-mmix/b-badrx1.s | 6 + ld/testsuite/ld-mmix/b-badrx2.d | 7 + ld/testsuite/ld-mmix/b-badrx2.s | 6 + ld/testsuite/ld-mmix/b-badrx3.d | 7 + ld/testsuite/ld-mmix/b-badrx3.s | 6 + ld/testsuite/ld-mmix/b-bend.s | 6 + ld/testsuite/ld-mmix/b-bend1.d | 11 + ld/testsuite/ld-mmix/b-bend2.d | 10 + ld/testsuite/ld-mmix/b-bend3.d | 6 + ld/testsuite/ld-mmix/b-bstab1.d | 7 + ld/testsuite/ld-mmix/b-bstab1.s | 5 + ld/testsuite/ld-mmix/b-fixo2.d | 27 + ld/testsuite/ld-mmix/b-fixo2.s | 6 + ld/testsuite/ld-mmix/b-goodmain.s | 5 + ld/testsuite/ld-mmix/b-loc64k.d | 24 + ld/testsuite/ld-mmix/b-loc64k.s | 8 + ld/testsuite/ld-mmix/b-nosym.d | 18 + ld/testsuite/ld-mmix/b-nosym.s | 5 + ld/testsuite/ld-mmix/b-post1.s | 5 + ld/testsuite/ld-mmix/b-twoinsn.s | 7 + ld/testsuite/ld-mmix/b-widec.s | 7 + ld/testsuite/ld-mmix/b-widec1.d | 12 + ld/testsuite/ld-mmix/b-widec2.d | 6 + ld/testsuite/ld-mmix/b-widec2.s | 7 + ld/testsuite/ld-mmix/b-widec3.d | 6 + ld/testsuite/ld-mmix/b-widec3.s | 8 + ld/testsuite/ld-mmix/bpo-1.d | 27 + ld/testsuite/ld-mmix/bpo-1.s | 2 + ld/testsuite/ld-mmix/bpo-10.d | 28 + ld/testsuite/ld-mmix/bpo-10.s | 6 + ld/testsuite/ld-mmix/bpo-11.d | 36 + ld/testsuite/ld-mmix/bpo-11.s | 5 + ld/testsuite/ld-mmix/bpo-12.d | 9 + ld/testsuite/ld-mmix/bpo-12m.d | 9 + ld/testsuite/ld-mmix/bpo-13.d | 9 + ld/testsuite/ld-mmix/bpo-13m.d | 9 + ld/testsuite/ld-mmix/bpo-14.d | 28 + ld/testsuite/ld-mmix/bpo-14m.d | 20 + ld/testsuite/ld-mmix/bpo-15.d | 7 + ld/testsuite/ld-mmix/bpo-15m.d | 7 + ld/testsuite/ld-mmix/bpo-16.d | 29 + ld/testsuite/ld-mmix/bpo-16m.d | 21 + ld/testsuite/ld-mmix/bpo-17.d | 29 + ld/testsuite/ld-mmix/bpo-17m.d | 22 + ld/testsuite/ld-mmix/bpo-18.d | 34 + ld/testsuite/ld-mmix/bpo-18m.d | 25 + ld/testsuite/ld-mmix/bpo-19.d | 39 + ld/testsuite/ld-mmix/bpo-19m.d | 30 + ld/testsuite/ld-mmix/bpo-1m.d | 18 + ld/testsuite/ld-mmix/bpo-2.d | 29 + ld/testsuite/ld-mmix/bpo-2.s | 2 + ld/testsuite/ld-mmix/bpo-20.d | 8 + ld/testsuite/ld-mmix/bpo-20m.d | 8 + ld/testsuite/ld-mmix/bpo-21.d | 10 + ld/testsuite/ld-mmix/bpo-21m.d | 9 + ld/testsuite/ld-mmix/bpo-22.d | 27 + ld/testsuite/ld-mmix/bpo-2m.d | 21 + ld/testsuite/ld-mmix/bpo-3.d | 30 + ld/testsuite/ld-mmix/bpo-3.s | 1 + ld/testsuite/ld-mmix/bpo-3m.d | 20 + ld/testsuite/ld-mmix/bpo-4.d | 31 + ld/testsuite/ld-mmix/bpo-4.s | 5 + ld/testsuite/ld-mmix/bpo-4m.d | 22 + ld/testsuite/ld-mmix/bpo-5.d | 31 + ld/testsuite/ld-mmix/bpo-5.s | 4 + ld/testsuite/ld-mmix/bpo-5m.d | 21 + ld/testsuite/ld-mmix/bpo-6.d | 36 + ld/testsuite/ld-mmix/bpo-6.s | 4 + ld/testsuite/ld-mmix/bpo-6m.d | 27 + ld/testsuite/ld-mmix/bpo-7.d | 6 + ld/testsuite/ld-mmix/bpo-7.s | 2 + ld/testsuite/ld-mmix/bpo-7m.d | 6 + ld/testsuite/ld-mmix/bpo-8.d | 7 + ld/testsuite/ld-mmix/bpo-8.s | 3 + ld/testsuite/ld-mmix/bpo-8m.d | 7 + ld/testsuite/ld-mmix/bpo-9.d | 31 + ld/testsuite/ld-mmix/bpo-9.s | 5 + ld/testsuite/ld-mmix/bpo-9m.d | 22 + ld/testsuite/ld-mmix/bpo64addr.ld | 13 + ld/testsuite/ld-mmix/bspec1.d | 55 + ld/testsuite/ld-mmix/bspec1.s | 3 + ld/testsuite/ld-mmix/bspec1m.d | 15 + ld/testsuite/ld-mmix/bspec2.d | 65 + ld/testsuite/ld-mmix/bspec2.s | 3 + ld/testsuite/ld-mmix/bspec2m.d | 21 + ld/testsuite/ld-mmix/bspec801.s | 3 + ld/testsuite/ld-mmix/bspec802.s | 7 + ld/testsuite/ld-mmix/bspec803.s | 9 + ld/testsuite/ld-mmix/bspec804.s | 9 + ld/testsuite/ld-mmix/bspec805.s | 10 + ld/testsuite/ld-mmix/bspec806.s | 10 + ld/testsuite/ld-mmix/bspec807.s | 9 + ld/testsuite/ld-mmix/bspec808.s | 9 + ld/testsuite/ld-mmix/bza-1b.d | 26 + ld/testsuite/ld-mmix/bza-1f.d | 26 + ld/testsuite/ld-mmix/bza-2b.d | 21 + ld/testsuite/ld-mmix/bza-2f.d | 21 + ld/testsuite/ld-mmix/bza-7b.d | 26 + ld/testsuite/ld-mmix/bza-7f.d | 26 + ld/testsuite/ld-mmix/bza-8b.d | 21 + ld/testsuite/ld-mmix/bza-8f.d | 21 + ld/testsuite/ld-mmix/bza.s | 7 + ld/testsuite/ld-mmix/data1.s | 2 + ld/testsuite/ld-mmix/dloc1.s | 3 + ld/testsuite/ld-mmix/dloc2.s | 3 + ld/testsuite/ld-mmix/ext1-254.s | 2 + ld/testsuite/ld-mmix/ext1.s | 2 + ld/testsuite/ld-mmix/ext1g.s | 2 + ld/testsuite/ld-mmix/ext1l.s | 2 + ld/testsuite/ld-mmix/getaa-1b.d | 24 + ld/testsuite/ld-mmix/getaa-1f.d | 24 + ld/testsuite/ld-mmix/getaa-2b.d | 21 + ld/testsuite/ld-mmix/getaa-2f.d | 21 + ld/testsuite/ld-mmix/getaa-4b.d | 26 + ld/testsuite/ld-mmix/getaa-4f.d | 25 + ld/testsuite/ld-mmix/getaa-6b.d | 11 + ld/testsuite/ld-mmix/getaa-6f.d | 10 + ld/testsuite/ld-mmix/getaa-7b.d | 24 + ld/testsuite/ld-mmix/getaa-7f.d | 24 + ld/testsuite/ld-mmix/getaa-8b.d | 21 + ld/testsuite/ld-mmix/getaa-8f.d | 21 + ld/testsuite/ld-mmix/getaa.s | 7 + ld/testsuite/ld-mmix/getaa12b.d | 26 + ld/testsuite/ld-mmix/getaa12f.d | 25 + ld/testsuite/ld-mmix/getaa14b.d | 11 + ld/testsuite/ld-mmix/getaa14f.d | 10 + ld/testsuite/ld-mmix/greg-1.d | 33 + ld/testsuite/ld-mmix/greg-1.s | 3 + ld/testsuite/ld-mmix/greg-10.d | 25 + ld/testsuite/ld-mmix/greg-11.d | 39 + ld/testsuite/ld-mmix/greg-11b.d | 32 + ld/testsuite/ld-mmix/greg-12.d | 34 + ld/testsuite/ld-mmix/greg-13.d | 33 + ld/testsuite/ld-mmix/greg-14.d | 32 + ld/testsuite/ld-mmix/greg-14s.d | 23 + ld/testsuite/ld-mmix/greg-15.d | 59 + ld/testsuite/ld-mmix/greg-16.d | 59 + ld/testsuite/ld-mmix/greg-17.d | 37 + ld/testsuite/ld-mmix/greg-18.d | 39 + ld/testsuite/ld-mmix/greg-19.d | 27 + ld/testsuite/ld-mmix/greg-2.d | 47 + ld/testsuite/ld-mmix/greg-2.s | 3 + ld/testsuite/ld-mmix/greg-20.d | 18 + ld/testsuite/ld-mmix/greg-3.d | 42 + ld/testsuite/ld-mmix/greg-3.s | 3 + ld/testsuite/ld-mmix/greg-4.d | 41 + ld/testsuite/ld-mmix/greg-4.s | 2 + ld/testsuite/ld-mmix/greg-5.d | 40 + ld/testsuite/ld-mmix/greg-5.s | 20 + ld/testsuite/ld-mmix/greg-5s.d | 31 + ld/testsuite/ld-mmix/greg-6.d | 292 + ld/testsuite/ld-mmix/greg-7.d | 292 + ld/testsuite/ld-mmix/greg-8.d | 37 + ld/testsuite/ld-mmix/greg-9.d | 39 + ld/testsuite/ld-mmix/gregbza1.s | 4 + ld/testsuite/ld-mmix/gregget1.s | 4 + ld/testsuite/ld-mmix/gregget2.s | 4 + ld/testsuite/ld-mmix/gregldo1.s | 4 + ld/testsuite/ld-mmix/gregpsj1.s | 4 + ld/testsuite/ld-mmix/hdr-1.d | 19 + ld/testsuite/ld-mmix/jumpa-1b.d | 25 + ld/testsuite/ld-mmix/jumpa-1f.d | 25 + ld/testsuite/ld-mmix/jumpa-2b.d | 21 + ld/testsuite/ld-mmix/jumpa-2f.d | 21 + ld/testsuite/ld-mmix/jumpa-3b.d | 30 + ld/testsuite/ld-mmix/jumpa-3f.d | 28 + ld/testsuite/ld-mmix/jumpa-4b.d | 26 + ld/testsuite/ld-mmix/jumpa-4f.d | 25 + ld/testsuite/ld-mmix/jumpa-5b.d | 31 + ld/testsuite/ld-mmix/jumpa-5f.d | 29 + ld/testsuite/ld-mmix/jumpa-6b.d | 11 + ld/testsuite/ld-mmix/jumpa-6f.d | 10 + ld/testsuite/ld-mmix/jumpa-7b.d | 25 + ld/testsuite/ld-mmix/jumpa-7f.d | 25 + ld/testsuite/ld-mmix/jumpa-8b.d | 21 + ld/testsuite/ld-mmix/jumpa-8f.d | 21 + ld/testsuite/ld-mmix/jumpa-9b.d | 30 + ld/testsuite/ld-mmix/jumpa-9f.d | 28 + ld/testsuite/ld-mmix/jumpa.s | 7 + ld/testsuite/ld-mmix/jumpa12b.d | 26 + ld/testsuite/ld-mmix/jumpa12f.d | 25 + ld/testsuite/ld-mmix/jumpa13b.d | 31 + ld/testsuite/ld-mmix/jumpa13f.d | 29 + ld/testsuite/ld-mmix/jumpa14b.d | 11 + ld/testsuite/ld-mmix/jumpa14f.d | 10 + ld/testsuite/ld-mmix/loc1.d | 25 + ld/testsuite/ld-mmix/loc1.s | 3 + ld/testsuite/ld-mmix/loc1m.d | 14 + ld/testsuite/ld-mmix/loc2.d | 27 + ld/testsuite/ld-mmix/loc2.s | 3 + ld/testsuite/ld-mmix/loc2m.d | 14 + ld/testsuite/ld-mmix/loc3.d | 27 + ld/testsuite/ld-mmix/loc3m.d | 14 + ld/testsuite/ld-mmix/loc4.d | 33 + ld/testsuite/ld-mmix/loc4m.d | 17 + ld/testsuite/ld-mmix/loc5.d | 6 + ld/testsuite/ld-mmix/loc5m.d | 6 + ld/testsuite/ld-mmix/loc6.d | 29 + ld/testsuite/ld-mmix/loc6m.d | 18 + ld/testsuite/ld-mmix/loc7.d | 6 + ld/testsuite/ld-mmix/loc7m.d | 6 + ld/testsuite/ld-mmix/local1.d | 62 + ld/testsuite/ld-mmix/local1.s | 2 + ld/testsuite/ld-mmix/local10.d | 5 + ld/testsuite/ld-mmix/local10m.d | 5 + ld/testsuite/ld-mmix/local11.d | 6 + ld/testsuite/ld-mmix/local11m.d | 6 + ld/testsuite/ld-mmix/local12.d | 22 + ld/testsuite/ld-mmix/local12m.d | 16 + ld/testsuite/ld-mmix/local1m.d | 19 + ld/testsuite/ld-mmix/local2.d | 8 + ld/testsuite/ld-mmix/local2.s | 2 + ld/testsuite/ld-mmix/local2m.d | 8 + ld/testsuite/ld-mmix/local3.d | 60 + ld/testsuite/ld-mmix/local3m.d | 19 + ld/testsuite/ld-mmix/local4.d | 8 + ld/testsuite/ld-mmix/local4m.d | 8 + ld/testsuite/ld-mmix/local5.d | 61 + ld/testsuite/ld-mmix/local5m.d | 21 + ld/testsuite/ld-mmix/local6.d | 9 + ld/testsuite/ld-mmix/local6m.d | 9 + ld/testsuite/ld-mmix/local7.d | 62 + ld/testsuite/ld-mmix/local7m.d | 20 + ld/testsuite/ld-mmix/local8.d | 28 + ld/testsuite/ld-mmix/local8m.d | 28 + ld/testsuite/ld-mmix/local9.d | 5 + ld/testsuite/ld-mmix/local9m.d | 5 + ld/testsuite/ld-mmix/locdo-1.d | 28 + ld/testsuite/ld-mmix/locdo.s | 2 + ld/testsuite/ld-mmix/loct-1.d | 25 + ld/testsuite/ld-mmix/loct.s | 3 + ld/testsuite/ld-mmix/locto-1.d | 25 + ld/testsuite/ld-mmix/locto.s | 2 + ld/testsuite/ld-mmix/main1.s | 5 + ld/testsuite/ld-mmix/mmix.exp | 32 + ld/testsuite/ld-mmix/mmohdr1.ld | 11 + ld/testsuite/ld-mmix/mmosec1.ld | 16 + ld/testsuite/ld-mmix/mmosec2.ld | 13 + ld/testsuite/ld-mmix/nop123.s | 3 + ld/testsuite/ld-mmix/pad16.s | 4 + ld/testsuite/ld-mmix/pad2p18m32.s | 4 + ld/testsuite/ld-mmix/pad2p26m32.s | 4 + ld/testsuite/ld-mmix/pad4.s | 4 + ld/testsuite/ld-mmix/pushja.s | 7 + ld/testsuite/ld-mmix/pushja1b-s.d | 19 + ld/testsuite/ld-mmix/pushja1b.d | 25 + ld/testsuite/ld-mmix/pushja1f-s.d | 19 + ld/testsuite/ld-mmix/pushja1f.d | 25 + ld/testsuite/ld-mmix/pushja2b.d | 21 + ld/testsuite/ld-mmix/pushja2f.d | 21 + ld/testsuite/ld-mmix/pushja7b-s.d | 19 + ld/testsuite/ld-mmix/pushja7b.d | 25 + ld/testsuite/ld-mmix/pushja7f-s.d | 19 + ld/testsuite/ld-mmix/pushja7f.d | 25 + ld/testsuite/ld-mmix/pushja8b.d | 21 + ld/testsuite/ld-mmix/pushja8f.d | 21 + ld/testsuite/ld-mmix/pushjs1.d | 27 + ld/testsuite/ld-mmix/pushjs1b.d | 31 + ld/testsuite/ld-mmix/pushjs1bm.d | 29 + ld/testsuite/ld-mmix/pushjs1m.d | 26 + ld/testsuite/ld-mmix/pushjs1r.d | 22 + ld/testsuite/ld-mmix/pushjs2.d | 29 + ld/testsuite/ld-mmix/pushjs2b.d | 33 + ld/testsuite/ld-mmix/pushjs2bm.d | 31 + ld/testsuite/ld-mmix/pushjs2m.d | 28 + ld/testsuite/ld-mmix/pushjs2r.d | 27 + ld/testsuite/ld-mmix/pushjs3.d | 29 + ld/testsuite/ld-mmix/pushjs3b.d | 30 + ld/testsuite/ld-mmix/pushjs3bm.d | 28 + ld/testsuite/ld-mmix/pushjs3m.d | 28 + ld/testsuite/ld-mmix/pushjs3r.d | 32 + ld/testsuite/ld-mmix/pushjs4.d | 34 + ld/testsuite/ld-mmix/pushjs4b.d | 35 + ld/testsuite/ld-mmix/pushjs4bm.d | 33 + ld/testsuite/ld-mmix/pushjs4m.d | 33 + ld/testsuite/ld-mmix/pushjs4r.d | 29 + ld/testsuite/ld-mmix/reg-1.d | 7 + ld/testsuite/ld-mmix/reg-1m.d | 7 + ld/testsuite/ld-mmix/reg-2.d | 7 + ld/testsuite/ld-mmix/reg-2m.d | 7 + ld/testsuite/ld-mmix/regext1.s | 2 + ld/testsuite/ld-mmix/sec-1.d | 32 + ld/testsuite/ld-mmix/sec-1.s | 14 + ld/testsuite/ld-mmix/sec-2.d | 26 + ld/testsuite/ld-mmix/sec-2.s | 2 + ld/testsuite/ld-mmix/sec-3.d | 36 + ld/testsuite/ld-mmix/sec-4.d | 22 + ld/testsuite/ld-mmix/sec-5.d | 21 + ld/testsuite/ld-mmix/sec-6.d | 37 + ld/testsuite/ld-mmix/sec-6.s | 5 + ld/testsuite/ld-mmix/sec-6m.d | 32 + ld/testsuite/ld-mmix/sec-7a.s | 6 + ld/testsuite/ld-mmix/sec-7b.s | 6 + ld/testsuite/ld-mmix/sec-7c.s | 6 + ld/testsuite/ld-mmix/sec-7d.s | 6 + ld/testsuite/ld-mmix/sec-7e.s | 6 + ld/testsuite/ld-mmix/sec-7m.d | 38 + ld/testsuite/ld-mmix/sec-8a.s | 4 + ld/testsuite/ld-mmix/sec-8b.s | 4 + ld/testsuite/ld-mmix/sec-8d.s | 4 + ld/testsuite/ld-mmix/sec-8m.d | 30 + ld/testsuite/ld-mmix/sec-8m.s | 4 + ld/testsuite/ld-mmix/spec801.d | 21 + ld/testsuite/ld-mmix/spec802.d | 24 + ld/testsuite/ld-mmix/spec803.d | 24 + ld/testsuite/ld-mmix/spec804.d | 24 + ld/testsuite/ld-mmix/spec805.d | 25 + ld/testsuite/ld-mmix/spec806.d | 25 + ld/testsuite/ld-mmix/spec807.d | 25 + ld/testsuite/ld-mmix/spec808.d | 25 + ld/testsuite/ld-mmix/start-1.d | 27 + ld/testsuite/ld-mmix/start-2.d | 4 + ld/testsuite/ld-mmix/start.s | 5 + ld/testsuite/ld-mmix/start2.s | 5 + ld/testsuite/ld-mmix/start3.s | 7 + ld/testsuite/ld-mmix/start4.s | 6 + ld/testsuite/ld-mmix/sym-1.d | 11 + ld/testsuite/ld-mmix/sym-2.d | 142 + ld/testsuite/ld-mmix/sym-2.s | 130 + ld/testsuite/ld-mmix/undef-1.d | 4 + ld/testsuite/ld-mmix/undef-1.s | 1 + ld/testsuite/ld-mmix/undef-1m.d | 4 + ld/testsuite/ld-mmix/undef-2.d | 5 + ld/testsuite/ld-mmix/undef-2.s | 1 + ld/testsuite/ld-mmix/undef-2m.d | 5 + ld/testsuite/ld-mmix/undef-3.d | 46 + ld/testsuite/ld-mmix/undef-3m.d | 18 + ld/testsuite/ld-mmix/x.s | 26 + ld/testsuite/ld-mmix/y.s | 33 + ld/testsuite/ld-mmix/zeroeh.ld | 4 + ld/testsuite/ld-mmix/zeroehelf.d | 17 + ld/testsuite/ld-mmix/zeroehmmo.d | 16 + ld/testsuite/ld-powerpc/apuinfo.rd | 10 + ld/testsuite/ld-powerpc/apuinfo1.s | 9 + ld/testsuite/ld-powerpc/apuinfo2.s | 8 + ld/testsuite/ld-powerpc/powerpc.exp | 108 + ld/testsuite/ld-powerpc/reloc.d | 16 + ld/testsuite/ld-powerpc/reloc.s | 9 + ld/testsuite/ld-powerpc/tls.d | 53 + ld/testsuite/ld-powerpc/tls.g | 12 + ld/testsuite/ld-powerpc/tls.s | 92 + ld/testsuite/ld-powerpc/tls.t | 14 + ld/testsuite/ld-powerpc/tls32.d | 50 + ld/testsuite/ld-powerpc/tls32.g | 11 + ld/testsuite/ld-powerpc/tls32.s | 80 + ld/testsuite/ld-powerpc/tls32.t | 12 + ld/testsuite/ld-powerpc/tlsexe.d | 76 + ld/testsuite/ld-powerpc/tlsexe.g | 12 + ld/testsuite/ld-powerpc/tlsexe.r | 124 + ld/testsuite/ld-powerpc/tlsexe.t | 13 + ld/testsuite/ld-powerpc/tlsexe32.d | 49 + ld/testsuite/ld-powerpc/tlsexe32.g | 11 + ld/testsuite/ld-powerpc/tlsexe32.r | 128 + ld/testsuite/ld-powerpc/tlsexe32.t | 11 + ld/testsuite/ld-powerpc/tlsexetoc.d | 60 + ld/testsuite/ld-powerpc/tlsexetoc.g | 15 + ld/testsuite/ld-powerpc/tlsexetoc.r | 123 + ld/testsuite/ld-powerpc/tlsexetoc.t | 13 + ld/testsuite/ld-powerpc/tlslib.s | 21 + ld/testsuite/ld-powerpc/tlslib32.s | 14 + ld/testsuite/ld-powerpc/tlsso.d | 76 + ld/testsuite/ld-powerpc/tlsso.g | 15 + ld/testsuite/ld-powerpc/tlsso.r | 150 + ld/testsuite/ld-powerpc/tlsso.t | 13 + ld/testsuite/ld-powerpc/tlsso32.d | 49 + ld/testsuite/ld-powerpc/tlsso32.g | 13 + ld/testsuite/ld-powerpc/tlsso32.r | 162 + ld/testsuite/ld-powerpc/tlsso32.t | 11 + ld/testsuite/ld-powerpc/tlstoc.d | 37 + ld/testsuite/ld-powerpc/tlstoc.g | 15 + ld/testsuite/ld-powerpc/tlstoc.s | 88 + ld/testsuite/ld-powerpc/tlstoc.t | 14 + ld/testsuite/ld-powerpc/tlstocso.d | 60 + ld/testsuite/ld-powerpc/tlstocso.g | 15 + ld/testsuite/ld-powerpc/tlstocso.r | 146 + ld/testsuite/ld-powerpc/tlstocso.t | 13 + ld/testsuite/ld-s390/s390.exp | 72 + ld/testsuite/ld-s390/tlsbin.dd | 185 + ld/testsuite/ld-s390/tlsbin.rd | 156 + ld/testsuite/ld-s390/tlsbin.s | 73 + ld/testsuite/ld-s390/tlsbin.sd | 13 + ld/testsuite/ld-s390/tlsbin.td | 16 + ld/testsuite/ld-s390/tlsbin_64.dd | 213 + ld/testsuite/ld-s390/tlsbin_64.rd | 156 + ld/testsuite/ld-s390/tlsbin_64.s | 75 + ld/testsuite/ld-s390/tlsbin_64.sd | 18 + ld/testsuite/ld-s390/tlsbin_64.td | 16 + ld/testsuite/ld-s390/tlsbinpic.s | 168 + ld/testsuite/ld-s390/tlsbinpic_64.s | 184 + ld/testsuite/ld-s390/tlslib.s | 17 + ld/testsuite/ld-s390/tlslib_64.s | 17 + ld/testsuite/ld-s390/tlspic.dd | 161 + ld/testsuite/ld-s390/tlspic.rd | 165 + ld/testsuite/ld-s390/tlspic.sd | 16 + ld/testsuite/ld-s390/tlspic.td | 16 + ld/testsuite/ld-s390/tlspic1.s | 206 + ld/testsuite/ld-s390/tlspic1_64.s | 222 + ld/testsuite/ld-s390/tlspic2.s | 11 + ld/testsuite/ld-s390/tlspic2_64.s | 11 + ld/testsuite/ld-s390/tlspic_64.dd | 194 + ld/testsuite/ld-s390/tlspic_64.rd | 165 + ld/testsuite/ld-s390/tlspic_64.sd | 21 + ld/testsuite/ld-s390/tlspic_64.td | 16 + ld/testsuite/ld-scripts/align.exp | 36 + ld/testsuite/ld-scripts/align.s | 2 + ld/testsuite/ld-scripts/align.t | 8 + ld/testsuite/ld-scripts/assert.exp | 31 + ld/testsuite/ld-scripts/assert.s | 0 ld/testsuite/ld-scripts/assert.t | 5 + ld/testsuite/ld-scripts/cross1.c | 6 + ld/testsuite/ld-scripts/cross1.t | 11 + ld/testsuite/ld-scripts/cross2.c | 5 + ld/testsuite/ld-scripts/cross2.t | 6 + ld/testsuite/ld-scripts/cross3.c | 7 + ld/testsuite/ld-scripts/crossref.exp | 100 + ld/testsuite/ld-scripts/data.d | 9 + ld/testsuite/ld-scripts/data.exp | 20 + ld/testsuite/ld-scripts/data.s | 0 ld/testsuite/ld-scripts/data.t | 11 + ld/testsuite/ld-scripts/defined.exp | 59 + ld/testsuite/ld-scripts/defined.s | 2 + ld/testsuite/ld-scripts/defined.t | 7 + ld/testsuite/ld-scripts/defined2.d | 21 + ld/testsuite/ld-scripts/defined2.t | 9 + ld/testsuite/ld-scripts/defined3.d | 34 + ld/testsuite/ld-scripts/defined3.t | 15 + ld/testsuite/ld-scripts/dynamic-sections-1.s | 2 + ld/testsuite/ld-scripts/dynamic-sections-2.s | 3 + ld/testsuite/ld-scripts/dynamic-sections.d | 6 + ld/testsuite/ld-scripts/dynamic-sections.exp | 8 + ld/testsuite/ld-scripts/dynamic-sections.t | 11 + ld/testsuite/ld-scripts/map-address.d | 10 + ld/testsuite/ld-scripts/map-address.exp | 37 + ld/testsuite/ld-scripts/map-address.t | 9 + ld/testsuite/ld-scripts/overlay-size-map.d | 23 + ld/testsuite/ld-scripts/overlay-size.d | 29 + ld/testsuite/ld-scripts/overlay-size.exp | 31 + ld/testsuite/ld-scripts/overlay-size.s | 25 + ld/testsuite/ld-scripts/overlay-size.t | 57 + ld/testsuite/ld-scripts/phdrs.exp | 61 + ld/testsuite/ld-scripts/phdrs.s | 8 + ld/testsuite/ld-scripts/phdrs.t | 16 + ld/testsuite/ld-scripts/phdrs2.exp | 65 + ld/testsuite/ld-scripts/phdrs2.s | 7 + ld/testsuite/ld-scripts/phdrs2.t | 23 + ld/testsuite/ld-scripts/provide-1.d | 9 + ld/testsuite/ld-scripts/provide-1.s | 4 + ld/testsuite/ld-scripts/provide-1.t | 12 + ld/testsuite/ld-scripts/provide-2.d | 7 + ld/testsuite/ld-scripts/provide-2.s | 8 + ld/testsuite/ld-scripts/provide-2.t | 10 + ld/testsuite/ld-scripts/provide-3.d | 3 + ld/testsuite/ld-scripts/provide-3.s | 4 + ld/testsuite/ld-scripts/provide-3.t | 11 + ld/testsuite/ld-scripts/provide.exp | 30 + ld/testsuite/ld-scripts/script.exp | 101 + ld/testsuite/ld-scripts/script.s | 8 + ld/testsuite/ld-scripts/script.t | 16 + ld/testsuite/ld-scripts/scriptm.t | 10 + ld/testsuite/ld-scripts/size-1.d | 14 + ld/testsuite/ld-scripts/size-1.s | 7 + ld/testsuite/ld-scripts/size-1.t | 10 + ld/testsuite/ld-scripts/size-2.d | 17 + ld/testsuite/ld-scripts/size-2.s | 8 + ld/testsuite/ld-scripts/size-2.t | 21 + ld/testsuite/ld-scripts/size.exp | 35 + ld/testsuite/ld-scripts/sizeof.exp | 71 + ld/testsuite/ld-scripts/sizeof.s | 1 + ld/testsuite/ld-scripts/sizeof.t | 17 + ld/testsuite/ld-scripts/weak.exp | 61 + ld/testsuite/ld-scripts/weak.t | 12 + ld/testsuite/ld-scripts/weak1.s | 11 + ld/testsuite/ld-scripts/weak2.s | 11 + ld/testsuite/ld-selective/1.c | 12 + ld/testsuite/ld-selective/2.c | 19 + ld/testsuite/ld-selective/3.cc | 46 + ld/testsuite/ld-selective/4.cc | 34 + ld/testsuite/ld-selective/5.cc | 38 + ld/testsuite/ld-selective/keepdot.d | 9 + ld/testsuite/ld-selective/keepdot.ld | 5 + ld/testsuite/ld-selective/keepdot.s | 17 + ld/testsuite/ld-selective/keepdot0.d | 11 + ld/testsuite/ld-selective/keepdot0.ld | 6 + ld/testsuite/ld-selective/sel-dump.exp | 31 + ld/testsuite/ld-selective/selective.exp | 204 + ld/testsuite/ld-sh/ld-r-1.d | 23 + ld/testsuite/ld-sh/ldr1.s | 5 + ld/testsuite/ld-sh/ldr2.s | 3 + ld/testsuite/ld-sh/rd-sh.exp | 64 + ld/testsuite/ld-sh/refdbg-0-dso.d | 9 + ld/testsuite/ld-sh/refdbg-1.d | 10 + ld/testsuite/ld-sh/refdbg.s | 12 + ld/testsuite/ld-sh/refdbglib.s | 8 + ld/testsuite/ld-sh/sh.exp | 162 + ld/testsuite/ld-sh/sh1.s | 13 + ld/testsuite/ld-sh/sh2.c | 120 + ld/testsuite/ld-sh/sh64/abi32.sd | 16 + ld/testsuite/ld-sh/sh64/abi32.xd | 60 + ld/testsuite/ld-sh/sh64/abi64.sd | 20 + ld/testsuite/ld-sh/sh64/abi64.xd | 59 + ld/testsuite/ld-sh/sh64/abixx-noexp.sd | 12 + ld/testsuite/ld-sh/sh64/cmpct1.sd | 9 + ld/testsuite/ld-sh/sh64/cmpct1.xd | 56 + ld/testsuite/ld-sh/sh64/crange-1.s | 8 + ld/testsuite/ld-sh/sh64/crange-2a.s | 22 + ld/testsuite/ld-sh/sh64/crange-2b.s | 39 + ld/testsuite/ld-sh/sh64/crange-2c.s | 16 + ld/testsuite/ld-sh/sh64/crange-2d.s | 9 + ld/testsuite/ld-sh/sh64/crange-2e.s | 12 + ld/testsuite/ld-sh/sh64/crange-2f.s | 21 + ld/testsuite/ld-sh/sh64/crange-2g.s | 26 + ld/testsuite/ld-sh/sh64/crange-2h.s | 17 + ld/testsuite/ld-sh/sh64/crange-2i.s | 8 + ld/testsuite/ld-sh/sh64/crange1.rd | 61 + ld/testsuite/ld-sh/sh64/crange2.rd | 69 + ld/testsuite/ld-sh/sh64/crange3-cmpct.rd | 92 + ld/testsuite/ld-sh/sh64/crange3-media.rd | 92 + ld/testsuite/ld-sh/sh64/crange3.dd | 80 + ld/testsuite/ld-sh/sh64/crange3.rd | 73 + ld/testsuite/ld-sh/sh64/crangerel1.rd | 49 + ld/testsuite/ld-sh/sh64/crangerel2.rd | 64 + ld/testsuite/ld-sh/sh64/dlsection-1.s | 17 + ld/testsuite/ld-sh/sh64/dlsection.sd | 9 + ld/testsuite/ld-sh/sh64/endian.dbd | 11 + ld/testsuite/ld-sh/sh64/endian.dld | 11 + ld/testsuite/ld-sh/sh64/endian.ld | 6 + ld/testsuite/ld-sh/sh64/endian.s | 7 + ld/testsuite/ld-sh/sh64/endian.sbd | 5 + ld/testsuite/ld-sh/sh64/endian.sld | 6 + ld/testsuite/ld-sh/sh64/gotplt.d | 12 + ld/testsuite/ld-sh/sh64/gotplt.map | 4 + ld/testsuite/ld-sh/sh64/gotplt.s | 8 + ld/testsuite/ld-sh/sh64/init-cmpct.d | 20 + ld/testsuite/ld-sh/sh64/init-media.d | 19 + ld/testsuite/ld-sh/sh64/init.s | 18 + ld/testsuite/ld-sh/sh64/init64.d | 19 + ld/testsuite/ld-sh/sh64/mix1-noexp.sd | 14 + ld/testsuite/ld-sh/sh64/mix1.sd | 16 + ld/testsuite/ld-sh/sh64/mix1.xd | 57 + ld/testsuite/ld-sh/sh64/mix2-noexp.sd | 16 + ld/testsuite/ld-sh/sh64/mix2.sd | 17 + ld/testsuite/ld-sh/sh64/mix2.xd | 67 + ld/testsuite/ld-sh/sh64/rd-sh64.exp | 41 + ld/testsuite/ld-sh/sh64/rel-1.s | 48 + ld/testsuite/ld-sh/sh64/rel-2.s | 46 + ld/testsuite/ld-sh/sh64/rel32.xd | 97 + ld/testsuite/ld-sh/sh64/rel64.xd | 97 + ld/testsuite/ld-sh/sh64/relax.exp | 152 + ld/testsuite/ld-sh/sh64/relax1.s | 12 + ld/testsuite/ld-sh/sh64/relax2.s | 3 + ld/testsuite/ld-sh/sh64/relax3.s | 8 + ld/testsuite/ld-sh/sh64/relax4.s | 2 + ld/testsuite/ld-sh/sh64/reldl-1.s | 171 + ld/testsuite/ld-sh/sh64/reldl-2.s | 156 + ld/testsuite/ld-sh/sh64/reldl32.rd | 361 + ld/testsuite/ld-sh/sh64/reldl64.rd | 363 + ld/testsuite/ld-sh/sh64/relfail.exp | 216 + ld/testsuite/ld-sh/sh64/relfail.s | 36 + ld/testsuite/ld-sh/sh64/sh64-1.s | 20 + ld/testsuite/ld-sh/sh64/sh64-2.s | 27 + ld/testsuite/ld-sh/sh64/sh64.exp | 134 + ld/testsuite/ld-sh/sh64/shcmp-1.s | 15 + ld/testsuite/ld-sh/sh64/shdl-1.s | 359 + ld/testsuite/ld-sh/sh64/shdl-2.s | 286 + ld/testsuite/ld-sh/sh64/shdl32.xd | 138 + ld/testsuite/ld-sh/sh64/shdl64.sd | 87 + ld/testsuite/ld-sh/sh64/shdl64.xd | 138 + ld/testsuite/ld-sh/sh64/shmix-1.s | 33 + ld/testsuite/ld-sh/sh64/shmix-2.s | 28 + ld/testsuite/ld-sh/sh64/shmix-3.s | 32 + ld/testsuite/ld-sh/sh64/stobin-0-dso.d | 9 + ld/testsuite/ld-sh/sh64/stobin-1.d | 15 + ld/testsuite/ld-sh/sh64/stobin.s | 5 + ld/testsuite/ld-sh/sh64/stolib.s | 7 + ld/testsuite/ld-sh/shared-1.d | 22 + ld/testsuite/ld-sh/shared-2.d | 20 + ld/testsuite/ld-sh/start.s | 27 + ld/testsuite/ld-sh/sub2l-1.d | 23 + ld/testsuite/ld-sh/sub2l.s | 26 + ld/testsuite/ld-sh/textrel1.s | 11 + ld/testsuite/ld-sh/textrel2.s | 7 + ld/testsuite/ld-sh/tlsbin-0-dso.d | 9 + ld/testsuite/ld-sh/tlsbin-1.d | 308 + ld/testsuite/ld-sh/tlsbin-2.d | 131 + ld/testsuite/ld-sh/tlsbin-3.d | 12 + ld/testsuite/ld-sh/tlsbin-4.d | 12 + ld/testsuite/ld-sh/tlsbin.s | 90 + ld/testsuite/ld-sh/tlsbinpic.s | 206 + ld/testsuite/ld-sh/tlslib.s | 20 + ld/testsuite/ld-sh/tlspic-1.d | 292 + ld/testsuite/ld-sh/tlspic-2.d | 132 + ld/testsuite/ld-sh/tlspic-3.d | 15 + ld/testsuite/ld-sh/tlspic-4.d | 12 + ld/testsuite/ld-sh/tlspic1.s | 267 + ld/testsuite/ld-sh/tlspic2.s | 5 + ld/testsuite/ld-sh/tlstpoff-1.d | 31 + ld/testsuite/ld-sh/tlstpoff-2.d | 8 + ld/testsuite/ld-sh/tlstpoff1.s | 23 + ld/testsuite/ld-sh/tlstpoff2.s | 26 + ld/testsuite/ld-sh/weak1.d | 21 + ld/testsuite/ld-sh/weak1.s | 19 + ld/testsuite/ld-shared/elf-offset.ld | 170 + ld/testsuite/ld-shared/main.c | 84 + ld/testsuite/ld-shared/sh1.c | 166 + ld/testsuite/ld-shared/sh2.c | 14 + ld/testsuite/ld-shared/shared.dat | 16 + ld/testsuite/ld-shared/shared.exp | 290 + ld/testsuite/ld-shared/sun4.dat | 16 + ld/testsuite/ld-shared/symbolic.dat | 8 + ld/testsuite/ld-shared/xcoff.dat | 10 + ld/testsuite/ld-sparc/sparc.exp | 88 + ld/testsuite/ld-sparc/tlsg32.s | 12 + ld/testsuite/ld-sparc/tlsg32.sd | 10 + ld/testsuite/ld-sparc/tlsg64.s | 12 + ld/testsuite/ld-sparc/tlsg64.sd | 11 + ld/testsuite/ld-sparc/tlslib.s | 20 + ld/testsuite/ld-sparc/tlsnopic.s | 8 + ld/testsuite/ld-sparc/tlspic.s | 12 + ld/testsuite/ld-sparc/tlssunbin32.dd | 273 + ld/testsuite/ld-sparc/tlssunbin32.rd | 137 + ld/testsuite/ld-sparc/tlssunbin32.s | 114 + ld/testsuite/ld-sparc/tlssunbin32.sd | 11 + ld/testsuite/ld-sparc/tlssunbin32.td | 19 + ld/testsuite/ld-sparc/tlssunbin64.dd | 11 + ld/testsuite/ld-sparc/tlssunbin64.rd | 8 + ld/testsuite/ld-sparc/tlssunbin64.s | 118 + ld/testsuite/ld-sparc/tlssunbin64.sd | 11 + ld/testsuite/ld-sparc/tlssunbin64.td | 11 + ld/testsuite/ld-sparc/tlssunbinpic32.s | 183 + ld/testsuite/ld-sparc/tlssunbinpic64.s | 182 + ld/testsuite/ld-sparc/tlssunnopic32.dd | 84 + ld/testsuite/ld-sparc/tlssunnopic32.rd | 112 + ld/testsuite/ld-sparc/tlssunnopic32.s | 77 + ld/testsuite/ld-sparc/tlssunnopic32.sd | 12 + ld/testsuite/ld-sparc/tlssunnopic64.dd | 12 + ld/testsuite/ld-sparc/tlssunnopic64.rd | 9 + ld/testsuite/ld-sparc/tlssunnopic64.s | 81 + ld/testsuite/ld-sparc/tlssunnopic64.sd | 12 + ld/testsuite/ld-sparc/tlssunpic32.dd | 220 + ld/testsuite/ld-sparc/tlssunpic32.rd | 155 + ld/testsuite/ld-sparc/tlssunpic32.s | 228 + ld/testsuite/ld-sparc/tlssunpic32.sd | 15 + ld/testsuite/ld-sparc/tlssunpic32.td | 16 + ld/testsuite/ld-sparc/tlssunpic64.dd | 12 + ld/testsuite/ld-sparc/tlssunpic64.rd | 9 + ld/testsuite/ld-sparc/tlssunpic64.s | 228 + ld/testsuite/ld-sparc/tlssunpic64.sd | 12 + ld/testsuite/ld-sparc/tlssunpic64.td | 12 + ld/testsuite/ld-srec/sr1.c | 25 + ld/testsuite/ld-srec/sr2.c | 18 + ld/testsuite/ld-srec/sr3.cc | 127 + ld/testsuite/ld-srec/srec.exp | 426 + ld/testsuite/ld-undefined/undefined.c | 10 + ld/testsuite/ld-undefined/undefined.exp | 147 + ld/testsuite/ld-undefined/weak-undef.exp | 71 + ld/testsuite/ld-undefined/weak-undef.s | 4 + ld/testsuite/ld-undefined/weak-undef.t | 9 + ld/testsuite/ld-versados/t1-1.ro | Bin 0 -> 3840 bytes ld/testsuite/ld-versados/t1-2.ro | Bin 0 -> 256 bytes ld/testsuite/ld-versados/t1.ld | 281 + ld/testsuite/ld-versados/t1.ook | 133 + ld/testsuite/ld-versados/t2-1.ro | Bin 0 -> 256 bytes ld/testsuite/ld-versados/t2-2.ro | Bin 0 -> 2304 bytes ld/testsuite/ld-versados/t2-3.ro | Bin 0 -> 1024 bytes ld/testsuite/ld-versados/t2.ld | 281 + ld/testsuite/ld-versados/t2.ook | 99 + ld/testsuite/ld-versados/versados.exp | 99 + ld/testsuite/ld-x86-64/tlsbin.dd | 310 + ld/testsuite/ld-x86-64/tlsbin.rd | 154 + ld/testsuite/ld-x86-64/tlsbin.s | 97 + ld/testsuite/ld-x86-64/tlsbin.sd | 14 + ld/testsuite/ld-x86-64/tlsbin.td | 16 + ld/testsuite/ld-x86-64/tlsbinpic.s | 146 + ld/testsuite/ld-x86-64/tlsg.s | 12 + ld/testsuite/ld-x86-64/tlsg.sd | 10 + ld/testsuite/ld-x86-64/tlslib.s | 18 + ld/testsuite/ld-x86-64/tlspic.dd | 234 + ld/testsuite/ld-x86-64/tlspic.rd | 162 + ld/testsuite/ld-x86-64/tlspic.sd | 21 + ld/testsuite/ld-x86-64/tlspic.td | 16 + ld/testsuite/ld-x86-64/tlspic1.s | 187 + ld/testsuite/ld-x86-64/tlspic2.s | 11 + ld/testsuite/ld-x86-64/x86-64.exp | 54 + ld/testsuite/ld-xstormy16/external.s | 5 + ld/testsuite/ld-xstormy16/pcrel.d | 33 + ld/testsuite/ld-xstormy16/pcrel.s | 31 + ld/testsuite/ld-xstormy16/xstormy16.exp | 38 + ld/testsuite/ld-xtensa/coalesce.exp | 97 + ld/testsuite/ld-xtensa/coalesce.t | 6 + ld/testsuite/ld-xtensa/coalesce1.s | 15 + ld/testsuite/ld-xtensa/coalesce2.s | 9 + ld/testsuite/ld-xtensa/lcall.exp | 111 + ld/testsuite/ld-xtensa/lcall.t | 6 + ld/testsuite/ld-xtensa/lcall1.s | 12 + ld/testsuite/ld-xtensa/lcall2.s | 5 + ld/testsuite/lib/ld-lib.exp | 1199 + libiberty/COPYING.LIB | 504 + libiberty/acconfig.h | 12 +- libiberty/alloca-botch.h | 5 - libiberty/alloca-conf.h | 24 - libiberty/alloca-norm.h | 25 - libiberty/config.h-vms | 13 + libiberty/config/mh-aix | 9 + libiberty/config/mh-sysv | 1 - libiberty/config/mh-sysv4 | 3 - libiberty/config/mh-windows | 1 + libiberty/config/mt-mingw32 | 27 - libiberty/configure.ac | 530 + libiberty/configure.in | 459 - libiberty/cp-demangle.c | 2 - libiberty/dummy.c | 49 - libiberty/functions.def | 70 - libiberty/makefile.vms | 33 + libiberty/mempcpy.c | 48 + libiberty/mpw-config.in | 7 + libiberty/mpw-make.sed | 51 + libiberty/mpw.c | 1010 + libiberty/msdos.c | 15 + libiberty/pex-common.h | 42 + libiberty/pex-djgpp.c | 103 + libiberty/pex-mpw.c | 161 + libiberty/pex-msdos.c | 147 + libiberty/pex-os2.c | 72 + libiberty/pex-unix.c | 166 + libiberty/pex-win32.c | 250 + libiberty/pexecute.c | 792 - libiberty/pexecute.txh | 63 + libiberty/snprintf.c | 65 + libiberty/stpcpy.c | 49 + libiberty/stpncpy.c | 54 + libiberty/testsuite/Makefile.in | 69 + libiberty/testsuite/demangle-expected | 3750 + libiberty/testsuite/test-demangle.c | 285 + libiberty/vmsbuild.com | 165 + libiberty/vsnprintf.c | 153 + makefile.vms | 71 + md5.sum | 3022 - mkdep | 87 + opcodes/a29k-dis.c | 367 + opcodes/acconfig.h | 6 - opcodes/avr-dis.c | 371 + opcodes/cris-dis.c | 1412 + opcodes/cris-opc.c | 885 + opcodes/d10v-dis.c | 303 + opcodes/d10v-opc.c | 349 + opcodes/d30v-dis.c | 407 + opcodes/d30v-opc.c | 513 + opcodes/dlx-dis.c | 544 + opcodes/fr30-asm.c | 746 + opcodes/fr30-desc.c | 1794 + opcodes/fr30-desc.h | 273 + opcodes/fr30-dis.c | 737 + opcodes/fr30-ibld.c | 1495 + opcodes/fr30-opc.c | 1397 + opcodes/fr30-opc.h | 151 + opcodes/frv-asm.c | 1375 + opcodes/frv-desc.c | 6436 + opcodes/frv-desc.h | 770 + opcodes/frv-dis.c | 791 + opcodes/frv-ibld.c | 2125 + opcodes/frv-opc.c | 6179 + opcodes/frv-opc.h | 379 + opcodes/h8300-dis.c | 781 + opcodes/h8500-dis.c | 352 + opcodes/h8500-opc.h | 3858 + opcodes/hppa-dis.c | 1251 + opcodes/i370-dis.c | 163 + opcodes/i370-opc.c | 946 + opcodes/i860-dis.c | 282 + opcodes/i960-dis.c | 931 + opcodes/ip2k-asm.c | 997 + opcodes/ip2k-desc.c | 1223 + opcodes/ip2k-desc.h | 251 + opcodes/ip2k-dis.c | 746 + opcodes/ip2k-ibld.c | 954 + opcodes/ip2k-opc.c | 930 + opcodes/ip2k-opc.h | 118 + opcodes/iq2000-asm.c | 883 + opcodes/iq2000-desc.c | 2228 + opcodes/iq2000-desc.h | 302 + opcodes/iq2000-dis.c | 609 + opcodes/iq2000-ibld.c | 1396 + opcodes/iq2000-opc.c | 3482 + opcodes/iq2000-opc.h | 181 + opcodes/m10200-dis.c | 341 + opcodes/m10200-opc.c | 360 + opcodes/m10300-dis.c | 768 + opcodes/m10300-opc.c | 1674 + opcodes/m32r-asm.c | 761 + opcodes/m32r-desc.c | 1574 + opcodes/m32r-desc.h | 240 + opcodes/m32r-dis.c | 680 + opcodes/m32r-ibld.c | 1236 + opcodes/m32r-opc.c | 1835 + opcodes/m32r-opc.h | 144 + opcodes/m32r-opinst.c | 766 + opcodes/m68hc11-dis.c | 738 + opcodes/m68hc11-opc.c | 1082 + opcodes/m68k-dis.c | 1345 + opcodes/m68k-opc.c | 2433 + opcodes/m88k-dis.c | 780 + opcodes/makefile.vms | 42 + opcodes/mcore-dis.c | 311 + opcodes/mcore-opc.h | 209 + opcodes/mmix-dis.c | 525 + opcodes/mmix-opc.c | 347 + opcodes/mpw-config.in | 27 + opcodes/mpw-make.sed | 25 + opcodes/msp430-dis.c | 809 + opcodes/ns32k-dis.c | 907 + opcodes/openrisc-asm.c | 684 + opcodes/openrisc-desc.c | 1064 + opcodes/openrisc-desc.h | 250 + opcodes/openrisc-dis.c | 555 + opcodes/openrisc-ibld.c | 1025 + opcodes/openrisc-opc.c | 707 + opcodes/openrisc-opc.h | 113 + opcodes/or32-dis.c | 348 + opcodes/or32-opc.c | 1052 + opcodes/pdp11-dis.c | 394 + opcodes/pdp11-opc.c | 272 + opcodes/pj-dis.c | 181 + opcodes/pj-opc.c | 536 + opcodes/po/.cvsignore | 1 + opcodes/po/da.gmo | Bin 0 -> 8332 bytes opcodes/po/da.po | 449 + opcodes/po/de.gmo | Bin 0 -> 16919 bytes opcodes/po/de.po | 813 + opcodes/po/es.gmo | Bin 0 -> 16621 bytes opcodes/po/es.po | 791 + opcodes/po/fr.gmo | Bin 0 -> 16283 bytes opcodes/po/fr.po | 793 + opcodes/po/id.gmo | Bin 0 -> 8307 bytes opcodes/po/id.po | 423 + opcodes/po/nl.gmo | Bin 0 -> 16097 bytes opcodes/po/nl.po | 809 + opcodes/po/pt_BR.gmo | Bin 0 -> 8467 bytes opcodes/po/pt_BR.po | 445 + opcodes/po/ro.gmo | Bin 0 -> 15986 bytes opcodes/po/ro.po | 788 + opcodes/po/sv.gmo | Bin 0 -> 15872 bytes opcodes/po/sv.po | 808 + opcodes/po/tr.gmo | Bin 0 -> 16094 bytes opcodes/po/tr.po | 788 + opcodes/sh64-dis.c | 639 + opcodes/sh64-opc.c | 774 + opcodes/sh64-opc.h | 139 + opcodes/sparc-opc.c | 164 +- opcodes/tic30-dis.c | 715 + opcodes/tic4x-dis.c | 827 + opcodes/tic54x-dis.c | 598 + opcodes/tic54x-opc.c | 494 + opcodes/tic80-dis.c | 387 + opcodes/tic80-opc.c | 1216 + opcodes/v850-dis.c | 385 + opcodes/v850-opc.c | 802 + opcodes/vax-dis.c | 339 + opcodes/w65-dis.c | 121 + opcodes/w65-opc.h | 569 + opcodes/xstormy16-asm.c | 707 + opcodes/xstormy16-desc.c | 1525 + opcodes/xstormy16-desc.h | 292 + opcodes/xstormy16-dis.c | 588 + opcodes/xstormy16-ibld.c | 1248 + opcodes/xstormy16-opc.c | 1201 + opcodes/xstormy16-opc.h | 138 + opcodes/xtensa-dis.c | 524 + opcodes/z8k-dis.c | 644 + opcodes/z8k-opc.h | 3796 + opcodes/z8kgen.c | 1342 + setup.com | 8 + src-release | 336 + texinfo/texinfo.tex | 6931 + 5012 files changed, 1344551 insertions(+), 37870 deletions(-) create mode 100644 .cvsignore create mode 100644 COPYING create mode 100644 COPYING.LIB create mode 100644 COPYING.LIBGLOSS create mode 100644 COPYING.NEWLIB create mode 100644 bfd/COPYING create mode 100644 bfd/aix386-core.c create mode 100644 bfd/aix5ppc-core.c create mode 100644 bfd/aout-adobe.c create mode 100644 bfd/aout-cris.c create mode 100644 bfd/aout-ns32k.c create mode 100644 bfd/aout-tic30.c create mode 100644 bfd/cf-i386lynx.c create mode 100644 bfd/cf-m68klynx.c create mode 100644 bfd/cf-sparclynx.c create mode 100644 bfd/cisco-core.c create mode 100644 bfd/coff-a29k.c create mode 100644 bfd/coff-apollo.c create mode 100644 bfd/coff-go32.c create mode 100644 bfd/coff-h8300.c create mode 100644 bfd/coff-h8500.c create mode 100644 bfd/coff-i860.c create mode 100644 bfd/coff-i960.c create mode 100644 bfd/coff-m68k.c create mode 100644 bfd/coff-m88k.c create mode 100644 bfd/coff-mcore.c create mode 100644 bfd/coff-or32.c create mode 100644 bfd/coff-pmac.c create mode 100644 bfd/coff-sh.c create mode 100644 bfd/coff-stgo32.c create mode 100644 bfd/coff-svm68k.c create mode 100644 bfd/coff-tic30.c create mode 100644 bfd/coff-tic4x.c create mode 100644 bfd/coff-tic54x.c create mode 100644 bfd/coff-tic80.c create mode 100644 bfd/coff-u68k.c create mode 100644 bfd/coff-w65.c create mode 100644 bfd/coff-we32k.c create mode 100644 bfd/coff-z8k.c create mode 100644 bfd/configure.com create mode 100644 bfd/cpu-a29k.c create mode 100644 bfd/cpu-avr.c create mode 100644 bfd/cpu-cris.c create mode 100644 bfd/cpu-d10v.c create mode 100644 bfd/cpu-d30v.c create mode 100644 bfd/cpu-dlx.c create mode 100644 bfd/cpu-fr30.c create mode 100644 bfd/cpu-frv.c create mode 100644 bfd/cpu-h8300.c create mode 100644 bfd/cpu-h8500.c create mode 100644 bfd/cpu-hppa.c create mode 100644 bfd/cpu-i370.c create mode 100644 bfd/cpu-i860.c create mode 100644 bfd/cpu-i960.c create mode 100644 bfd/cpu-ip2k.c create mode 100644 bfd/cpu-iq2000.c create mode 100644 bfd/cpu-m10200.c create mode 100644 bfd/cpu-m10300.c create mode 100644 bfd/cpu-m32r.c create mode 100644 bfd/cpu-m68hc11.c create mode 100644 bfd/cpu-m68hc12.c create mode 100644 bfd/cpu-m68k.c create mode 100644 bfd/cpu-m88k.c create mode 100644 bfd/cpu-mcore.c create mode 100644 bfd/cpu-mmix.c create mode 100644 bfd/cpu-msp430.c create mode 100644 bfd/cpu-ns32k.c create mode 100644 bfd/cpu-openrisc.c create mode 100644 bfd/cpu-or32.c create mode 100644 bfd/cpu-pdp11.c create mode 100644 bfd/cpu-pj.c create mode 100644 bfd/cpu-sh.c create mode 100644 bfd/cpu-tic30.c create mode 100644 bfd/cpu-tic4x.c create mode 100644 bfd/cpu-tic54x.c create mode 100644 bfd/cpu-tic80.c create mode 100644 bfd/cpu-v850.c create mode 100644 bfd/cpu-vax.c create mode 100644 bfd/cpu-w65.c create mode 100644 bfd/cpu-we32k.c create mode 100644 bfd/cpu-xstormy16.c create mode 100644 bfd/cpu-xtensa.c create mode 100644 bfd/cpu-z8k.c create mode 100644 bfd/doc/bfd.info create mode 100644 bfd/doc/bfd.info-1 create mode 100644 bfd/doc/bfd.info-2 delete mode 100644 bfd/doc/bfd.texi create mode 100644 bfd/doc/makefile.vms create mode 100644 bfd/elf-hppa.h create mode 100644 bfd/elf-m10200.c create mode 100644 bfd/elf-m10300.c create mode 100644 bfd/elf32-am33lin.c create mode 100644 bfd/elf32-avr.c create mode 100644 bfd/elf32-cris.c create mode 100644 bfd/elf32-d10v.c create mode 100644 bfd/elf32-d30v.c create mode 100644 bfd/elf32-dlx.c create mode 100644 bfd/elf32-fr30.c create mode 100644 bfd/elf32-frv.c create mode 100644 bfd/elf32-h8300.c create mode 100644 bfd/elf32-hppa.c create mode 100644 bfd/elf32-hppa.h create mode 100644 bfd/elf32-i370.c delete mode 100644 bfd/elf32-i386-fbsd.c create mode 100644 bfd/elf32-i860.c create mode 100644 bfd/elf32-i960.c create mode 100644 bfd/elf32-ip2k.c create mode 100644 bfd/elf32-iq2000.c create mode 100644 bfd/elf32-m32r.c create mode 100644 bfd/elf32-m68hc11.c create mode 100644 bfd/elf32-m68hc12.c create mode 100644 bfd/elf32-m68hc1x.c create mode 100644 bfd/elf32-m68hc1x.h create mode 100644 bfd/elf32-m68k.c create mode 100644 bfd/elf32-m88k.c create mode 100644 bfd/elf32-mcore.c create mode 100644 bfd/elf32-msp430.c create mode 100644 bfd/elf32-openrisc.c create mode 100644 bfd/elf32-or32.c create mode 100644 bfd/elf32-pj.c create mode 100644 bfd/elf32-sh.c create mode 100644 bfd/elf32-sh64-com.c create mode 100644 bfd/elf32-sh64.c create mode 100644 bfd/elf32-sh64.h create mode 100644 bfd/elf32-v850.c create mode 100644 bfd/elf32-vax.c create mode 100644 bfd/elf32-xstormy16.c create mode 100644 bfd/elf32-xtensa.c delete mode 100644 bfd/elf64-alpha-fbsd.c create mode 100644 bfd/elf64-hppa.c create mode 100644 bfd/elf64-hppa.h create mode 100644 bfd/elf64-mmix.c create mode 100644 bfd/elf64-sh64.c delete mode 100644 bfd/elflink.h create mode 100644 bfd/epoc-pe-arm.c create mode 100644 bfd/epoc-pei-arm.c create mode 100644 bfd/go32stub.h create mode 100644 bfd/hosts/alphavms.h create mode 100644 bfd/hosts/delta68.h create mode 100644 bfd/hosts/dpx2.h create mode 100644 bfd/hosts/hp300bsd.h create mode 100644 bfd/hosts/i386mach3.h create mode 100644 bfd/hosts/i860mach3.h create mode 100644 bfd/hosts/m68kaux.h create mode 100644 bfd/hosts/m68klinux.h create mode 100644 bfd/hosts/m88kmach3.h create mode 100644 bfd/hosts/news.h create mode 100644 bfd/hosts/pc532mach.h create mode 100644 bfd/hosts/riscos.h create mode 100644 bfd/hosts/symmetry.h create mode 100644 bfd/hosts/tahoe.h create mode 100644 bfd/hosts/vaxbsd.h create mode 100644 bfd/hosts/vaxult.h create mode 100644 bfd/hosts/vaxult2.h create mode 100644 bfd/hp300bsd.c create mode 100644 bfd/hp300hpux.c create mode 100644 bfd/hppabsd-core.c create mode 100644 bfd/hpux-core.c create mode 100644 bfd/i386dynix.c create mode 100644 bfd/i386lynx.c create mode 100644 bfd/i386mach3.c create mode 100644 bfd/i386msdos.c create mode 100644 bfd/i386os9k.c create mode 100644 bfd/irix-core.c create mode 100644 bfd/libhppa.h create mode 100644 bfd/libnlm.h create mode 100644 bfd/liboasys.h create mode 100644 bfd/lynx-core.c create mode 100644 bfd/m68k4knetbsd.c create mode 100644 bfd/m68klinux.c create mode 100644 bfd/m68klynx.c create mode 100644 bfd/m68knetbsd.c create mode 100644 bfd/m88kmach3.c create mode 100644 bfd/mach-o-target.c create mode 100644 bfd/mach-o.c create mode 100644 bfd/mach-o.h create mode 100644 bfd/makefile.vms create mode 100644 bfd/mmo.c create mode 100644 bfd/mpw-config.in create mode 100644 bfd/mpw-make.sed create mode 100644 bfd/newsos3.c create mode 100644 bfd/nlm-target.h create mode 100644 bfd/nlm.c create mode 100644 bfd/nlm32-alpha.c create mode 100644 bfd/nlm32-i386.c create mode 100644 bfd/nlm32-ppc.c create mode 100644 bfd/nlm32-sparc.c create mode 100644 bfd/nlm32.c create mode 100644 bfd/nlm64.c create mode 100644 bfd/nlmcode.h create mode 100644 bfd/nlmswap.h create mode 100644 bfd/ns32k.h create mode 100644 bfd/ns32knetbsd.c create mode 100644 bfd/oasys.c create mode 100644 bfd/pc532-mach.c create mode 100644 bfd/pdp11.c create mode 100644 bfd/pe-mcore.c create mode 100644 bfd/pe-sh.c create mode 100644 bfd/pef-traceback.h create mode 100644 bfd/pef.c create mode 100644 bfd/pef.h create mode 100644 bfd/pei-arm.c create mode 100644 bfd/pei-i386.c create mode 100644 bfd/pei-mcore.c create mode 100644 bfd/pei-ppc.c create mode 100644 bfd/pei-sh.c create mode 100644 bfd/po/.cvsignore delete mode 100644 bfd/po/POTFILES.in create mode 100644 bfd/po/da.gmo create mode 100644 bfd/po/da.po create mode 100644 bfd/po/es.gmo create mode 100644 bfd/po/es.po create mode 100644 bfd/po/fr.gmo create mode 100644 bfd/po/fr.po create mode 100644 bfd/po/ja.gmo create mode 100644 bfd/po/ja.po create mode 100644 bfd/po/ro.gmo create mode 100644 bfd/po/ro.po create mode 100644 bfd/po/sv.gmo create mode 100644 bfd/po/sv.po create mode 100644 bfd/po/tr.gmo create mode 100644 bfd/po/tr.po create mode 100644 bfd/po/zh_CN.gmo create mode 100644 bfd/po/zh_CN.po create mode 100644 bfd/riscix.c create mode 100644 bfd/som.c create mode 100644 bfd/som.h create mode 100644 bfd/sparclynx.c create mode 100644 bfd/ticoff.h create mode 100644 bfd/vax1knetbsd.c create mode 100644 bfd/vaxbsd.c create mode 100644 bfd/vaxnetbsd.c create mode 100644 bfd/versados.c create mode 100644 bfd/vms-gsd.c create mode 100644 bfd/vms-hdr.c create mode 100644 bfd/vms-misc.c create mode 100644 bfd/vms-tir.c create mode 100644 bfd/vms.c create mode 100644 bfd/vms.h create mode 100644 bfd/xsym.c create mode 100644 bfd/xsym.h create mode 100644 bfd/xtensa-isa.c create mode 100644 bfd/xtensa-modules.c delete mode 100644 binutils/acconfig.h delete mode 100644 binutils/addr2line.1 delete mode 100644 binutils/ar.1 create mode 100644 binutils/arlex.c create mode 100644 binutils/arparse.c create mode 100644 binutils/arparse.h delete mode 100644 binutils/binutils.texi delete mode 100644 binutils/config.texi create mode 100644 binutils/configure.com delete mode 100644 binutils/cxxfilt.man create mode 100644 binutils/deflex.c create mode 100644 binutils/doc/binutils.info create mode 100644 binutils/doc/nlmconv.1 create mode 100644 binutils/doc/windres.1 delete mode 100644 binutils/dyn-string.c delete mode 100644 binutils/dyn-string.h create mode 100644 binutils/emul_aix.c create mode 100644 binutils/mac-binutils.r create mode 100644 binutils/makefile.vms-in create mode 100644 binutils/mpw-config.in create mode 100644 binutils/mpw-make.sed create mode 100644 binutils/nlmconv.c create mode 100644 binutils/nlmconv.h create mode 100644 binutils/nlmheader.c create mode 100644 binutils/nlmheader.h create mode 100644 binutils/nlmheader.y delete mode 100644 binutils/nm.1 delete mode 100644 binutils/objcopy.1 delete mode 100644 binutils/objdump.1 create mode 100644 binutils/po/.cvsignore create mode 100644 binutils/po/da.gmo create mode 100644 binutils/po/da.po create mode 100644 binutils/po/es.gmo create mode 100644 binutils/po/es.po create mode 100644 binutils/po/fr.gmo create mode 100644 binutils/po/fr.po create mode 100644 binutils/po/ja.gmo create mode 100644 binutils/po/ja.po create mode 100644 binutils/po/ru.gmo create mode 100644 binutils/po/ru.po create mode 100644 binutils/po/sv.gmo create mode 100644 binutils/po/sv.po create mode 100644 binutils/po/tr.gmo create mode 100644 binutils/po/tr.po create mode 100644 binutils/po/zh_CN.gmo create mode 100644 binutils/po/zh_CN.po delete mode 100644 binutils/ranlib.1 delete mode 100644 binutils/readelf.1 delete mode 100644 binutils/size.1 delete mode 100644 binutils/strings.1 delete mode 100644 binutils/strip.1 create mode 100644 binutils/sysinfo.c create mode 100644 binutils/sysinfo.h create mode 100644 binutils/syslex.c create mode 100644 binutils/sysroff.info create mode 100644 binutils/testsuite/ChangeLog create mode 100644 binutils/testsuite/ChangeLog-9303 create mode 100644 binutils/testsuite/binutils-all/ar.exp create mode 100644 binutils/testsuite/binutils-all/bintest.s create mode 100644 binutils/testsuite/binutils-all/dlltool.exp create mode 100644 binutils/testsuite/binutils-all/fastcall.def create mode 100644 binutils/testsuite/binutils-all/hppa/addendbug.s create mode 100644 binutils/testsuite/binutils-all/hppa/freg.s create mode 100644 binutils/testsuite/binutils-all/hppa/objdump.exp create mode 100644 binutils/testsuite/binutils-all/nm.exp create mode 100644 binutils/testsuite/binutils-all/objcopy.exp create mode 100644 binutils/testsuite/binutils-all/objdump.exp create mode 100644 binutils/testsuite/binutils-all/readelf.exp create mode 100644 binutils/testsuite/binutils-all/readelf.h create mode 100644 binutils/testsuite/binutils-all/readelf.r create mode 100644 binutils/testsuite/binutils-all/readelf.r-64 create mode 100644 binutils/testsuite/binutils-all/readelf.s create mode 100644 binutils/testsuite/binutils-all/readelf.s-64 create mode 100644 binutils/testsuite/binutils-all/readelf.ss create mode 100644 binutils/testsuite/binutils-all/readelf.ss-64 create mode 100644 binutils/testsuite/binutils-all/readelf.ss-mips create mode 100644 binutils/testsuite/binutils-all/readelf.ss-tmips create mode 100644 binutils/testsuite/binutils-all/size.exp create mode 100644 binutils/testsuite/binutils-all/testprog.c create mode 100644 binutils/testsuite/binutils-all/windres/README create mode 100644 binutils/testsuite/binutils-all/windres/bmp1.bmp create mode 100644 binutils/testsuite/binutils-all/windres/bmpalign.rc create mode 100644 binutils/testsuite/binutils-all/windres/bmpalign.rsd create mode 100644 binutils/testsuite/binutils-all/windres/capstyle.rc create mode 100644 binutils/testsuite/binutils-all/windres/capstyle.rsd create mode 100644 binutils/testsuite/binutils-all/windres/checkbox.rc create mode 100644 binutils/testsuite/binutils-all/windres/checkbox.rsd create mode 100644 binutils/testsuite/binutils-all/windres/combobox.rc create mode 100644 binutils/testsuite/binutils-all/windres/combobox.rsd create mode 100644 binutils/testsuite/binutils-all/windres/deflang.rc create mode 100644 binutils/testsuite/binutils-all/windres/deflang.rsd create mode 100644 binutils/testsuite/binutils-all/windres/dialog0.rc create mode 100644 binutils/testsuite/binutils-all/windres/dialog0.rsd create mode 100644 binutils/testsuite/binutils-all/windres/dialog1.rc create mode 100644 binutils/testsuite/binutils-all/windres/dialog1.rsd create mode 100644 binutils/testsuite/binutils-all/windres/dialogid.rc create mode 100644 binutils/testsuite/binutils-all/windres/dialogid.rsd create mode 100644 binutils/testsuite/binutils-all/windres/dialogsignature.rc create mode 100644 binutils/testsuite/binutils-all/windres/dialogsignature.rsd create mode 100644 binutils/testsuite/binutils-all/windres/dlgfont.rc create mode 100644 binutils/testsuite/binutils-all/windres/dlgfont.rsd create mode 100644 binutils/testsuite/binutils-all/windres/edittext.rc create mode 100644 binutils/testsuite/binutils-all/windres/edittext.rsd create mode 100644 binutils/testsuite/binutils-all/windres/escapea.rc create mode 100644 binutils/testsuite/binutils-all/windres/escapea.rsd create mode 100644 binutils/testsuite/binutils-all/windres/escapex.rc create mode 100644 binutils/testsuite/binutils-all/windres/escapex.rsd create mode 100644 binutils/testsuite/binutils-all/windres/lang.rc create mode 100644 binutils/testsuite/binutils-all/windres/lang.rsd create mode 100644 binutils/testsuite/binutils-all/windres/listbox.rc create mode 100644 binutils/testsuite/binutils-all/windres/listbox.rsd create mode 100755 binutils/testsuite/binutils-all/windres/msupdate create mode 100644 binutils/testsuite/binutils-all/windres/nocaption.rc create mode 100644 binutils/testsuite/binutils-all/windres/nocaption.rsd create mode 100644 binutils/testsuite/binutils-all/windres/printstyle.rc create mode 100644 binutils/testsuite/binutils-all/windres/printstyle.rsd create mode 100644 binutils/testsuite/binutils-all/windres/quoteclass.rc create mode 100644 binutils/testsuite/binutils-all/windres/scrollbar.rc create mode 100644 binutils/testsuite/binutils-all/windres/scrollbar.rsd create mode 100644 binutils/testsuite/binutils-all/windres/strtab1.rc create mode 100644 binutils/testsuite/binutils-all/windres/strtab1.rsd create mode 100644 binutils/testsuite/binutils-all/windres/sublang.rc create mode 100644 binutils/testsuite/binutils-all/windres/sublang.rsd create mode 100644 binutils/testsuite/binutils-all/windres/windres.exp create mode 100644 binutils/testsuite/config/default.exp create mode 100644 binutils/testsuite/config/hppa.sed create mode 100644 binutils/testsuite/lib/utils-lib.exp create mode 100644 binutils/windres.c create mode 100644 binutils/windres.h create mode 100644 binutils/winduni.c create mode 100644 binutils/winduni.h create mode 100644 config/accross.m4 create mode 100644 config/acx.m4 create mode 100644 config/gettext.m4 create mode 100644 config/mh-cygwin create mode 100644 config/mh-dgux386 create mode 100644 config/mh-djgpp create mode 100644 config/mh-i370pic create mode 100644 config/mh-interix create mode 100644 config/mh-lynxrs6k create mode 100644 config/mh-m68kpic create mode 100644 config/mh-ncr3000 delete mode 100644 config/mh-openedition delete mode 100644 config/mh-sysv delete mode 100644 config/mt-armpic create mode 100644 config/mt-d30v delete mode 100644 config/mt-elfalphapic delete mode 100644 config/mt-ia64pic create mode 100644 config/mt-netware delete mode 100644 config/mt-papic delete mode 100644 config/mt-ppcpic delete mode 100644 config/mt-s390pic delete mode 100644 config/mt-sparcpic create mode 100644 config/mt-wince delete mode 100644 config/mt-x86pic create mode 100644 config/no-executables.m4 create mode 100644 config/progtest.m4 create mode 100644 cpu/ChangeLog create mode 100644 cpu/frv.cpu create mode 100644 cpu/frv.opc create mode 100644 cpu/iq10.cpu create mode 100644 cpu/iq2000.cpu create mode 100644 cpu/iq2000.opc create mode 100644 cpu/iq2000m.cpu create mode 100644 cpu/simplify.inc delete mode 100644 etc/cfg-paper.texi create mode 100644 etc/configure.info delete mode 100644 etc/configure.man create mode 100644 etc/fdl.texi create mode 100644 etc/standards.info create mode 100644 etc/texi2pod.pl create mode 100644 gas/COPYING create mode 100644 gas/README-vms delete mode 100644 gas/acconfig.h delete mode 100644 gas/conf.in create mode 100644 gas/config-gas.com create mode 100644 gas/config/atof-tahoe.c create mode 100644 gas/config/e-crisaout.c create mode 100644 gas/config/e-criself.c delete mode 100644 gas/config/i386coff.mt create mode 100644 gas/config/m68k-parse.h create mode 100644 gas/config/m68k-parse.y create mode 100644 gas/config/m88k-opcode.h create mode 100644 gas/config/obj-bout.c create mode 100644 gas/config/obj-bout.h create mode 100644 gas/config/obj-evax.c create mode 100644 gas/config/obj-evax.h delete mode 100644 gas/config/obj-generic.c delete mode 100644 gas/config/obj-generic.h create mode 100644 gas/config/obj-hp300.c create mode 100644 gas/config/obj-hp300.h create mode 100644 gas/config/obj-som.c create mode 100644 gas/config/obj-som.h create mode 100644 gas/config/obj-vms.c create mode 100644 gas/config/obj-vms.h delete mode 100644 gas/config/sco5.mt create mode 100644 gas/config/tc-a29k.c create mode 100644 gas/config/tc-a29k.h create mode 100644 gas/config/tc-avr.c create mode 100644 gas/config/tc-avr.h create mode 100644 gas/config/tc-cris.c create mode 100644 gas/config/tc-cris.h create mode 100644 gas/config/tc-d10v.c create mode 100644 gas/config/tc-d10v.h create mode 100644 gas/config/tc-d30v.c create mode 100644 gas/config/tc-d30v.h create mode 100644 gas/config/tc-dlx.c create mode 100644 gas/config/tc-dlx.h create mode 100644 gas/config/tc-fr30.c create mode 100644 gas/config/tc-fr30.h create mode 100644 gas/config/tc-frv.c create mode 100644 gas/config/tc-frv.h create mode 100644 gas/config/tc-h8300.c create mode 100644 gas/config/tc-h8300.h create mode 100644 gas/config/tc-h8500.c create mode 100644 gas/config/tc-h8500.h create mode 100644 gas/config/tc-hppa.c create mode 100644 gas/config/tc-hppa.h create mode 100644 gas/config/tc-i370.c create mode 100644 gas/config/tc-i370.h create mode 100644 gas/config/tc-i860.c create mode 100644 gas/config/tc-i860.h create mode 100644 gas/config/tc-i960.c create mode 100644 gas/config/tc-i960.h create mode 100644 gas/config/tc-ip2k.c create mode 100644 gas/config/tc-ip2k.h create mode 100644 gas/config/tc-iq2000.c create mode 100644 gas/config/tc-iq2000.h create mode 100644 gas/config/tc-m32r.c create mode 100644 gas/config/tc-m32r.h create mode 100644 gas/config/tc-m68hc11.c create mode 100644 gas/config/tc-m68hc11.h create mode 100644 gas/config/tc-m68k.c create mode 100644 gas/config/tc-m68k.h create mode 100644 gas/config/tc-m88k.c create mode 100644 gas/config/tc-m88k.h create mode 100644 gas/config/tc-mcore.c create mode 100644 gas/config/tc-mcore.h create mode 100644 gas/config/tc-mmix.c create mode 100644 gas/config/tc-mmix.h create mode 100644 gas/config/tc-mn10200.c create mode 100644 gas/config/tc-mn10200.h create mode 100644 gas/config/tc-mn10300.c create mode 100644 gas/config/tc-mn10300.h create mode 100644 gas/config/tc-msp430.c create mode 100644 gas/config/tc-msp430.h create mode 100644 gas/config/tc-ns32k.c create mode 100644 gas/config/tc-ns32k.h create mode 100644 gas/config/tc-openrisc.c create mode 100644 gas/config/tc-openrisc.h create mode 100644 gas/config/tc-or32.c create mode 100644 gas/config/tc-or32.h create mode 100644 gas/config/tc-pdp11.c create mode 100644 gas/config/tc-pdp11.h create mode 100644 gas/config/tc-pj.c create mode 100644 gas/config/tc-pj.h create mode 100644 gas/config/tc-sh64.c create mode 100644 gas/config/tc-sh64.h create mode 100644 gas/config/tc-tahoe.c create mode 100644 gas/config/tc-tahoe.h create mode 100644 gas/config/tc-tic4x.c create mode 100644 gas/config/tc-tic4x.h create mode 100644 gas/config/tc-tic54x.c create mode 100644 gas/config/tc-tic54x.h create mode 100644 gas/config/tc-tic80.c create mode 100644 gas/config/tc-tic80.h create mode 100644 gas/config/tc-vax.c create mode 100644 gas/config/tc-vax.h create mode 100644 gas/config/tc-w65.c create mode 100644 gas/config/tc-w65.h create mode 100644 gas/config/tc-xstormy16.c create mode 100644 gas/config/tc-xstormy16.h create mode 100644 gas/config/tc-xtensa.c create mode 100644 gas/config/tc-xtensa.h create mode 100644 gas/config/te-aix5.h create mode 100644 gas/config/te-delt88.h create mode 100644 gas/config/te-delta.h create mode 100644 gas/config/te-dpx2.h create mode 100644 gas/config/te-dynix.h create mode 100644 gas/config/te-epoc-pe.h create mode 100644 gas/config/te-go32.h create mode 100644 gas/config/te-hp300.h create mode 100644 gas/config/te-hppa.h create mode 100644 gas/config/te-hppa64.h create mode 100644 gas/config/te-hppalinux64.h create mode 100644 gas/config/te-hpux.h create mode 100644 gas/config/te-i386aix.h create mode 100644 gas/config/te-ia64aix.h create mode 100644 gas/config/te-ic960.h create mode 100644 gas/config/te-interix.h create mode 100644 gas/config/te-irix.h create mode 100644 gas/config/te-lnews.h create mode 100644 gas/config/te-lynx.h create mode 100644 gas/config/te-mach.h create mode 100644 gas/config/te-macos.h delete mode 100644 gas/config/te-multi.h create mode 100644 gas/config/te-nbsd532.h create mode 100644 gas/config/te-pc532mach.h create mode 100644 gas/config/te-psos.h create mode 100644 gas/config/te-riscix.h create mode 100644 gas/config/te-sun3.h create mode 100644 gas/config/te-wince-pe.h create mode 100644 gas/config/vax-inst.h create mode 100644 gas/config/vms-a-conf.h create mode 100644 gas/config/vms-conf.h create mode 100644 gas/config/xtensa-istack.h create mode 100644 gas/config/xtensa-relax.c create mode 100644 gas/config/xtensa-relax.h create mode 100644 gas/doc/c-a29k.texi create mode 100644 gas/doc/c-cris.texi create mode 100644 gas/doc/c-d10v.texi create mode 100644 gas/doc/c-d30v.texi create mode 100644 gas/doc/c-h8300.texi create mode 100644 gas/doc/c-h8500.texi create mode 100644 gas/doc/c-hppa.texi create mode 100644 gas/doc/c-i370.texi create mode 100644 gas/doc/c-i860.texi create mode 100644 gas/doc/c-i960.texi create mode 100644 gas/doc/c-ip2k.texi create mode 100644 gas/doc/c-m32r.texi create mode 100644 gas/doc/c-m68hc11.texi create mode 100644 gas/doc/c-m68k.texi create mode 100644 gas/doc/c-m88k.texi create mode 100644 gas/doc/c-mmix.texi create mode 100644 gas/doc/c-msp430.texi create mode 100644 gas/doc/c-ns32k.texi create mode 100644 gas/doc/c-pdp11.texi create mode 100644 gas/doc/c-pj.texi create mode 100644 gas/doc/c-sh64.texi create mode 100644 gas/doc/c-tic54x.texi create mode 100644 gas/doc/c-vax.texi create mode 100644 gas/doc/c-xtensa.texi create mode 100644 gas/doc/fdl.texi delete mode 100644 gas/doc/gasp.texi delete mode 100644 gas/gasp.c create mode 100644 gas/itbl-lex.c create mode 100644 gas/itbl-parse.c create mode 100644 gas/itbl-parse.h create mode 100644 gas/m68k-parse.c create mode 100644 gas/mac-as.r create mode 100644 gas/make-gas.com create mode 100644 gas/makefile.vms create mode 100644 gas/mpw-config.in create mode 100644 gas/mpw-make.sed create mode 100644 gas/po/.cvsignore create mode 100644 gas/po/es.gmo create mode 100644 gas/po/es.po create mode 100644 gas/po/fr.gmo create mode 100644 gas/po/fr.po create mode 100644 gas/po/tr.gmo create mode 100644 gas/po/tr.po create mode 100644 gas/testsuite/ChangeLog create mode 100644 gas/testsuite/ChangeLog-9303 create mode 100644 gas/testsuite/config/default.exp create mode 100644 gas/testsuite/gas/all/align.d create mode 100644 gas/testsuite/gas/all/align.s create mode 100644 gas/testsuite/gas/all/align2.d create mode 100644 gas/testsuite/gas/all/align2.s create mode 100644 gas/testsuite/gas/all/cofftag.d create mode 100644 gas/testsuite/gas/all/cofftag.s create mode 100644 gas/testsuite/gas/all/comment.s create mode 100644 gas/testsuite/gas/all/cond.d create mode 100644 gas/testsuite/gas/all/cond.s create mode 100644 gas/testsuite/gas/all/diff1.s create mode 100644 gas/testsuite/gas/all/fastcall.s create mode 100644 gas/testsuite/gas/all/float.s create mode 100644 gas/testsuite/gas/all/gas.exp create mode 100644 gas/testsuite/gas/all/incbin.d create mode 100644 gas/testsuite/gas/all/incbin.dat create mode 100644 gas/testsuite/gas/all/incbin.s create mode 100644 gas/testsuite/gas/all/itbl create mode 100644 gas/testsuite/gas/all/itbl-test.c create mode 100644 gas/testsuite/gas/all/itbl.s create mode 100644 gas/testsuite/gas/all/p1480.s create mode 100644 gas/testsuite/gas/all/p2425.s create mode 100644 gas/testsuite/gas/all/struct.d create mode 100644 gas/testsuite/gas/all/struct.s create mode 100644 gas/testsuite/gas/all/test-example.c create mode 100644 gas/testsuite/gas/all/test-gen.c create mode 100644 gas/testsuite/gas/all/x930509.s create mode 100644 gas/testsuite/gas/alpha/alpha.exp create mode 100644 gas/testsuite/gas/alpha/elf-reloc-1.d create mode 100644 gas/testsuite/gas/alpha/elf-reloc-1.s create mode 100644 gas/testsuite/gas/alpha/elf-reloc-2.l create mode 100644 gas/testsuite/gas/alpha/elf-reloc-2.s create mode 100644 gas/testsuite/gas/alpha/elf-reloc-3.l create mode 100644 gas/testsuite/gas/alpha/elf-reloc-3.s create mode 100644 gas/testsuite/gas/alpha/elf-reloc-4.d create mode 100644 gas/testsuite/gas/alpha/elf-reloc-4.s create mode 100644 gas/testsuite/gas/alpha/elf-reloc-5.d create mode 100644 gas/testsuite/gas/alpha/elf-reloc-5.s create mode 100644 gas/testsuite/gas/alpha/elf-reloc-6.l create mode 100644 gas/testsuite/gas/alpha/elf-reloc-6.s create mode 100644 gas/testsuite/gas/alpha/elf-reloc-7.d create mode 100644 gas/testsuite/gas/alpha/elf-reloc-7.s create mode 100644 gas/testsuite/gas/alpha/elf-reloc-8.d create mode 100644 gas/testsuite/gas/alpha/elf-reloc-8.s create mode 100644 gas/testsuite/gas/alpha/elf-tls-1.d create mode 100644 gas/testsuite/gas/alpha/elf-tls-1.s create mode 100644 gas/testsuite/gas/alpha/elf-tls-2.l create mode 100644 gas/testsuite/gas/alpha/elf-tls-2.s create mode 100644 gas/testsuite/gas/alpha/elf-tls-3.l create mode 100644 gas/testsuite/gas/alpha/elf-tls-3.s create mode 100644 gas/testsuite/gas/alpha/elf-usepv-1.d create mode 100644 gas/testsuite/gas/alpha/elf-usepv-1.s create mode 100644 gas/testsuite/gas/alpha/elf-usepv-2.l create mode 100644 gas/testsuite/gas/alpha/elf-usepv-2.s create mode 100644 gas/testsuite/gas/alpha/fp.d create mode 100644 gas/testsuite/gas/alpha/fp.s create mode 100644 gas/testsuite/gas/alpha/unop.d create mode 100644 gas/testsuite/gas/alpha/unop.s create mode 100644 gas/testsuite/gas/arc/adc.d create mode 100644 gas/testsuite/gas/arc/adc.s create mode 100644 gas/testsuite/gas/arc/add.d create mode 100644 gas/testsuite/gas/arc/add.s create mode 100644 gas/testsuite/gas/arc/alias.d create mode 100644 gas/testsuite/gas/arc/alias.s create mode 100644 gas/testsuite/gas/arc/and.d create mode 100644 gas/testsuite/gas/arc/and.s create mode 100644 gas/testsuite/gas/arc/arc.exp create mode 100644 gas/testsuite/gas/arc/asl.d create mode 100644 gas/testsuite/gas/arc/asl.s create mode 100644 gas/testsuite/gas/arc/asr.d create mode 100644 gas/testsuite/gas/arc/asr.s create mode 100644 gas/testsuite/gas/arc/b.d create mode 100644 gas/testsuite/gas/arc/b.s create mode 100644 gas/testsuite/gas/arc/bic.d create mode 100644 gas/testsuite/gas/arc/bic.s create mode 100644 gas/testsuite/gas/arc/bl.d create mode 100644 gas/testsuite/gas/arc/bl.s create mode 100644 gas/testsuite/gas/arc/branch.d create mode 100644 gas/testsuite/gas/arc/branch.s create mode 100644 gas/testsuite/gas/arc/brk.d create mode 100644 gas/testsuite/gas/arc/brk.s create mode 100644 gas/testsuite/gas/arc/extb.d create mode 100644 gas/testsuite/gas/arc/extb.s create mode 100644 gas/testsuite/gas/arc/extw.d create mode 100644 gas/testsuite/gas/arc/extw.s create mode 100644 gas/testsuite/gas/arc/flag.d create mode 100644 gas/testsuite/gas/arc/flag.s create mode 100644 gas/testsuite/gas/arc/insn3.d create mode 100644 gas/testsuite/gas/arc/insn3.s create mode 100644 gas/testsuite/gas/arc/j.d create mode 100644 gas/testsuite/gas/arc/j.s create mode 100644 gas/testsuite/gas/arc/jl.d create mode 100644 gas/testsuite/gas/arc/jl.s create mode 100644 gas/testsuite/gas/arc/ld.d create mode 100644 gas/testsuite/gas/arc/ld.s create mode 100644 gas/testsuite/gas/arc/ld2.d create mode 100644 gas/testsuite/gas/arc/ld2.s create mode 100644 gas/testsuite/gas/arc/lp.d create mode 100644 gas/testsuite/gas/arc/lp.s create mode 100644 gas/testsuite/gas/arc/lsr.d create mode 100644 gas/testsuite/gas/arc/lsr.s create mode 100644 gas/testsuite/gas/arc/math.d create mode 100644 gas/testsuite/gas/arc/math.s create mode 100644 gas/testsuite/gas/arc/mov.d create mode 100644 gas/testsuite/gas/arc/mov.s create mode 100644 gas/testsuite/gas/arc/nop.d create mode 100644 gas/testsuite/gas/arc/nop.s create mode 100644 gas/testsuite/gas/arc/or.d create mode 100644 gas/testsuite/gas/arc/or.s create mode 100644 gas/testsuite/gas/arc/rlc.d create mode 100644 gas/testsuite/gas/arc/rlc.s create mode 100644 gas/testsuite/gas/arc/ror.d create mode 100644 gas/testsuite/gas/arc/ror.s create mode 100644 gas/testsuite/gas/arc/rrc.d create mode 100644 gas/testsuite/gas/arc/rrc.s create mode 100644 gas/testsuite/gas/arc/sbc.d create mode 100644 gas/testsuite/gas/arc/sbc.s create mode 100644 gas/testsuite/gas/arc/sexb.d create mode 100644 gas/testsuite/gas/arc/sexb.s create mode 100644 gas/testsuite/gas/arc/sexw.d create mode 100644 gas/testsuite/gas/arc/sexw.s create mode 100644 gas/testsuite/gas/arc/sleep.d create mode 100644 gas/testsuite/gas/arc/sleep.s create mode 100644 gas/testsuite/gas/arc/sshift.d create mode 100644 gas/testsuite/gas/arc/sshift.s create mode 100644 gas/testsuite/gas/arc/st.d create mode 100644 gas/testsuite/gas/arc/st.s create mode 100644 gas/testsuite/gas/arc/sub.d create mode 100644 gas/testsuite/gas/arc/sub.s create mode 100644 gas/testsuite/gas/arc/swi.d create mode 100644 gas/testsuite/gas/arc/swi.s create mode 100644 gas/testsuite/gas/arc/warn.exp create mode 100644 gas/testsuite/gas/arc/warn.s create mode 100644 gas/testsuite/gas/arc/xor.d create mode 100644 gas/testsuite/gas/arc/xor.s create mode 100644 gas/testsuite/gas/arm/adrl.d create mode 100644 gas/testsuite/gas/arm/adrl.s create mode 100644 gas/testsuite/gas/arm/arch4t.s create mode 100644 gas/testsuite/gas/arm/arch5tej.d create mode 100644 gas/testsuite/gas/arm/arch5tej.s create mode 100644 gas/testsuite/gas/arm/archv6.d create mode 100644 gas/testsuite/gas/arm/archv6.s create mode 100644 gas/testsuite/gas/arm/arm.exp create mode 100644 gas/testsuite/gas/arm/arm3.s create mode 100644 gas/testsuite/gas/arm/arm6.s create mode 100644 gas/testsuite/gas/arm/arm7dm.s create mode 100644 gas/testsuite/gas/arm/arm7t.d create mode 100644 gas/testsuite/gas/arm/arm7t.s create mode 100644 gas/testsuite/gas/arm/armv1-bad.l create mode 100644 gas/testsuite/gas/arm/armv1-bad.s create mode 100644 gas/testsuite/gas/arm/armv1.d create mode 100644 gas/testsuite/gas/arm/armv1.s create mode 100644 gas/testsuite/gas/arm/copro.d create mode 100644 gas/testsuite/gas/arm/copro.s create mode 100644 gas/testsuite/gas/arm/el_segundo.d create mode 100644 gas/testsuite/gas/arm/el_segundo.s create mode 100644 gas/testsuite/gas/arm/float.s create mode 100644 gas/testsuite/gas/arm/fpa-dyadic.d create mode 100644 gas/testsuite/gas/arm/fpa-dyadic.s create mode 100644 gas/testsuite/gas/arm/fpa-mem.d create mode 100644 gas/testsuite/gas/arm/fpa-mem.s create mode 100644 gas/testsuite/gas/arm/fpa-monadic.d create mode 100644 gas/testsuite/gas/arm/fpa-monadic.s create mode 100644 gas/testsuite/gas/arm/immed.s create mode 100644 gas/testsuite/gas/arm/inst.d create mode 100644 gas/testsuite/gas/arm/inst.s create mode 100644 gas/testsuite/gas/arm/iwmmxt-bad.l create mode 100644 gas/testsuite/gas/arm/iwmmxt-bad.s create mode 100644 gas/testsuite/gas/arm/iwmmxt.d create mode 100644 gas/testsuite/gas/arm/iwmmxt.s create mode 100644 gas/testsuite/gas/arm/ldconst.d create mode 100644 gas/testsuite/gas/arm/ldconst.s create mode 100644 gas/testsuite/gas/arm/le-fpconst.d create mode 100644 gas/testsuite/gas/arm/le-fpconst.s create mode 100644 gas/testsuite/gas/arm/mapping.d create mode 100644 gas/testsuite/gas/arm/mapping.s create mode 100644 gas/testsuite/gas/arm/maverick.c create mode 100644 gas/testsuite/gas/arm/maverick.d create mode 100644 gas/testsuite/gas/arm/maverick.s create mode 100644 gas/testsuite/gas/arm/offset.s create mode 100644 gas/testsuite/gas/arm/pic.d create mode 100644 gas/testsuite/gas/arm/pic.s create mode 100644 gas/testsuite/gas/arm/r15-bad.l create mode 100644 gas/testsuite/gas/arm/r15-bad.s create mode 100644 gas/testsuite/gas/arm/req.l create mode 100644 gas/testsuite/gas/arm/req.s create mode 100644 gas/testsuite/gas/arm/thumb.s create mode 100644 gas/testsuite/gas/arm/thumbv6.d create mode 100644 gas/testsuite/gas/arm/thumbv6.s create mode 100644 gas/testsuite/gas/arm/undefined.l create mode 100644 gas/testsuite/gas/arm/undefined.s create mode 100644 gas/testsuite/gas/arm/vfp-bad.l create mode 100644 gas/testsuite/gas/arm/vfp-bad.s create mode 100644 gas/testsuite/gas/arm/vfp1.d create mode 100644 gas/testsuite/gas/arm/vfp1.s create mode 100644 gas/testsuite/gas/arm/vfp1xD.d create mode 100644 gas/testsuite/gas/arm/vfp1xD.s create mode 100644 gas/testsuite/gas/arm/vfp2.d create mode 100644 gas/testsuite/gas/arm/vfp2.s create mode 100644 gas/testsuite/gas/arm/wince_arm7t.d create mode 100644 gas/testsuite/gas/arm/wince_copro.d create mode 100644 gas/testsuite/gas/arm/wince_inst.d create mode 100644 gas/testsuite/gas/arm/wince_ldconst.d create mode 100644 gas/testsuite/gas/arm/xscale.d create mode 100644 gas/testsuite/gas/arm/xscale.s create mode 100644 gas/testsuite/gas/cfi/cfi-alpha-1.d create mode 100644 gas/testsuite/gas/cfi/cfi-alpha-1.s create mode 100644 gas/testsuite/gas/cfi/cfi-alpha-2.d create mode 100644 gas/testsuite/gas/cfi/cfi-alpha-2.s create mode 100644 gas/testsuite/gas/cfi/cfi-alpha-3.d create mode 100644 gas/testsuite/gas/cfi/cfi-alpha-3.s create mode 100644 gas/testsuite/gas/cfi/cfi-common-1.d create mode 100644 gas/testsuite/gas/cfi/cfi-common-1.s create mode 100644 gas/testsuite/gas/cfi/cfi-common-2.d create mode 100644 gas/testsuite/gas/cfi/cfi-common-2.s create mode 100644 gas/testsuite/gas/cfi/cfi-common-3.d create mode 100644 gas/testsuite/gas/cfi/cfi-common-3.s create mode 100644 gas/testsuite/gas/cfi/cfi-diag-1.l create mode 100644 gas/testsuite/gas/cfi/cfi-diag-1.s create mode 100644 gas/testsuite/gas/cfi/cfi-i386-2.d create mode 100644 gas/testsuite/gas/cfi/cfi-i386-2.s create mode 100644 gas/testsuite/gas/cfi/cfi-i386.d create mode 100644 gas/testsuite/gas/cfi/cfi-i386.s create mode 100644 gas/testsuite/gas/cfi/cfi-m68k.d create mode 100644 gas/testsuite/gas/cfi/cfi-m68k.s create mode 100644 gas/testsuite/gas/cfi/cfi-ppc-1.d create mode 100644 gas/testsuite/gas/cfi/cfi-ppc-1.s create mode 100644 gas/testsuite/gas/cfi/cfi-s390-1.d create mode 100644 gas/testsuite/gas/cfi/cfi-s390-1.s create mode 100644 gas/testsuite/gas/cfi/cfi-s390x-1.d create mode 100644 gas/testsuite/gas/cfi/cfi-s390x-1.s create mode 100644 gas/testsuite/gas/cfi/cfi-sh-1.d create mode 100644 gas/testsuite/gas/cfi/cfi-sh-1.s create mode 100644 gas/testsuite/gas/cfi/cfi-sparc-1.d create mode 100644 gas/testsuite/gas/cfi/cfi-sparc-1.s create mode 100644 gas/testsuite/gas/cfi/cfi-sparc64-1.d create mode 100644 gas/testsuite/gas/cfi/cfi-sparc64-1.s create mode 100644 gas/testsuite/gas/cfi/cfi-x86_64.d create mode 100644 gas/testsuite/gas/cfi/cfi-x86_64.s create mode 100644 gas/testsuite/gas/cfi/cfi.exp create mode 100644 gas/testsuite/gas/cris/addi.d create mode 100644 gas/testsuite/gas/cris/addi.s create mode 100644 gas/testsuite/gas/cris/binop-cmpmove.d create mode 100644 gas/testsuite/gas/cris/binop-cmpmovx.d create mode 100644 gas/testsuite/gas/cris/binop-extx.d create mode 100644 gas/testsuite/gas/cris/binop-segref.s create mode 100644 gas/testsuite/gas/cris/binop.d create mode 100644 gas/testsuite/gas/cris/binop.s create mode 100644 gas/testsuite/gas/cris/bork.d create mode 100644 gas/testsuite/gas/cris/bork.s create mode 100644 gas/testsuite/gas/cris/branch-warn-1.s create mode 100644 gas/testsuite/gas/cris/branch-warn-2.s create mode 100644 gas/testsuite/gas/cris/branch-warn-3.s create mode 100644 gas/testsuite/gas/cris/branch.d create mode 100644 gas/testsuite/gas/cris/branch.s create mode 100644 gas/testsuite/gas/cris/break.d create mode 100644 gas/testsuite/gas/cris/break.s create mode 100644 gas/testsuite/gas/cris/brokw-1.d create mode 100644 gas/testsuite/gas/cris/brokw-1.s create mode 100644 gas/testsuite/gas/cris/brokw-2.d create mode 100644 gas/testsuite/gas/cris/brokw-2.s create mode 100644 gas/testsuite/gas/cris/brokw-3.d create mode 100644 gas/testsuite/gas/cris/brokw-3.s create mode 100644 gas/testsuite/gas/cris/bwtest-err-1.s create mode 100644 gas/testsuite/gas/cris/ccr.d create mode 100644 gas/testsuite/gas/cris/ccr.s create mode 100644 gas/testsuite/gas/cris/clear.d create mode 100644 gas/testsuite/gas/cris/continue.d create mode 100644 gas/testsuite/gas/cris/continue.s create mode 100644 gas/testsuite/gas/cris/cris.exp create mode 100644 gas/testsuite/gas/cris/diffexp-ovwr.d create mode 100644 gas/testsuite/gas/cris/diffexp-ovwr.s create mode 100644 gas/testsuite/gas/cris/fragtest.d create mode 100644 gas/testsuite/gas/cris/fragtest.s create mode 100644 gas/testsuite/gas/cris/jump-type.d create mode 100644 gas/testsuite/gas/cris/labfloat.d create mode 100644 gas/testsuite/gas/cris/labfloat.s create mode 100644 gas/testsuite/gas/cris/macroat.d create mode 100644 gas/testsuite/gas/cris/macroat.s create mode 100644 gas/testsuite/gas/cris/movem-to-reg.d create mode 100644 gas/testsuite/gas/cris/mulbug-err-1.s create mode 100644 gas/testsuite/gas/cris/nosep.d create mode 100644 gas/testsuite/gas/cris/nosep.s create mode 100644 gas/testsuite/gas/cris/oneop-type.d create mode 100644 gas/testsuite/gas/cris/operand-err-1.s create mode 100644 gas/testsuite/gas/cris/pic-err-1.s create mode 100644 gas/testsuite/gas/cris/prefix.d create mode 100644 gas/testsuite/gas/cris/prefix.s create mode 100644 gas/testsuite/gas/cris/pushpop-byte-sreg.d create mode 100644 gas/testsuite/gas/cris/pushpop-dcr1-sreg.d create mode 100644 gas/testsuite/gas/cris/pushpop-dword-sreg.d create mode 100644 gas/testsuite/gas/cris/pushpop-word-sreg.d create mode 100644 gas/testsuite/gas/cris/pushpop.d create mode 100644 gas/testsuite/gas/cris/pushpop.s create mode 100644 gas/testsuite/gas/cris/quick-s6.d create mode 100644 gas/testsuite/gas/cris/quick-u5.d create mode 100644 gas/testsuite/gas/cris/quick-u6.d create mode 100644 gas/testsuite/gas/cris/quick.s create mode 100644 gas/testsuite/gas/cris/range-err-1.s create mode 100644 gas/testsuite/gas/cris/range-err-2.s create mode 100644 gas/testsuite/gas/cris/rd-bcnst.d create mode 100644 gas/testsuite/gas/cris/rd-bcnst.s create mode 100644 gas/testsuite/gas/cris/rd-dw2-1.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-10.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-11.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-12.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-13.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-14.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-15.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-2.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-3.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-4.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-5.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-6.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-7.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-8.d create mode 100644 gas/testsuite/gas/cris/rd-dw2-9.d create mode 100644 gas/testsuite/gas/cris/rd-mulbug-1.d create mode 100644 gas/testsuite/gas/cris/rd-pcrel1.d create mode 100644 gas/testsuite/gas/cris/rd-pcrel1.s create mode 100644 gas/testsuite/gas/cris/rd-pcrel2.d create mode 100644 gas/testsuite/gas/cris/rd-pcrel2.s create mode 100644 gas/testsuite/gas/cris/rd-pic-1.d create mode 100644 gas/testsuite/gas/cris/rd-pic-1.s create mode 100644 gas/testsuite/gas/cris/rd-regprefix-1.d create mode 100644 gas/testsuite/gas/cris/rd-regprefix-1.s create mode 100644 gas/testsuite/gas/cris/rd-regprefix-1b.d create mode 100644 gas/testsuite/gas/cris/reg-to-mem.d create mode 100644 gas/testsuite/gas/cris/regprefix-err-1.s create mode 100644 gas/testsuite/gas/cris/regreg.d create mode 100644 gas/testsuite/gas/cris/regreg.s create mode 100644 gas/testsuite/gas/cris/return.d create mode 100644 gas/testsuite/gas/cris/return.s create mode 100644 gas/testsuite/gas/cris/scc.d create mode 100644 gas/testsuite/gas/cris/scc.s create mode 100644 gas/testsuite/gas/cris/sep-err-1.s create mode 100644 gas/testsuite/gas/cris/sep-err-2.s create mode 100644 gas/testsuite/gas/cris/sep-err-3.s create mode 100644 gas/testsuite/gas/cris/separator.d create mode 100644 gas/testsuite/gas/cris/separator.s create mode 100644 gas/testsuite/gas/cris/shexpr-1.d create mode 100644 gas/testsuite/gas/cris/shexpr-1.s create mode 100644 gas/testsuite/gas/cris/sreg-to-x.d create mode 100644 gas/testsuite/gas/cris/string-1.d create mode 100644 gas/testsuite/gas/cris/string-1.s create mode 100644 gas/testsuite/gas/cris/string-2.d create mode 100644 gas/testsuite/gas/cris/string-2.s create mode 100644 gas/testsuite/gas/cris/test.d create mode 100644 gas/testsuite/gas/cris/unimplemented.d create mode 100644 gas/testsuite/gas/cris/unimplemented.s create mode 100644 gas/testsuite/gas/cris/unop-mem.d create mode 100644 gas/testsuite/gas/cris/unop.s create mode 100644 gas/testsuite/gas/cris/us-err-1.s create mode 100644 gas/testsuite/gas/cris/us-err-2.s create mode 100644 gas/testsuite/gas/cris/us-err-3.s create mode 100644 gas/testsuite/gas/cris/x-to-byte-sreg.d create mode 100644 gas/testsuite/gas/cris/x-to-dcr1-sreg.d create mode 100644 gas/testsuite/gas/cris/x-to-dword-sreg.d create mode 100644 gas/testsuite/gas/cris/x-to-word-sreg.d create mode 100644 gas/testsuite/gas/d10v/address-001.d create mode 100644 gas/testsuite/gas/d10v/address-001.s create mode 100644 gas/testsuite/gas/d10v/address-002.l create mode 100644 gas/testsuite/gas/d10v/address-002.s create mode 100644 gas/testsuite/gas/d10v/address-003.l create mode 100644 gas/testsuite/gas/d10v/address-003.s create mode 100644 gas/testsuite/gas/d10v/address-004.l create mode 100644 gas/testsuite/gas/d10v/address-004.s create mode 100644 gas/testsuite/gas/d10v/address-005.l create mode 100644 gas/testsuite/gas/d10v/address-005.s create mode 100644 gas/testsuite/gas/d10v/address-006.l create mode 100644 gas/testsuite/gas/d10v/address-006.s create mode 100644 gas/testsuite/gas/d10v/address-007.l create mode 100644 gas/testsuite/gas/d10v/address-007.s create mode 100644 gas/testsuite/gas/d10v/address-008.l create mode 100644 gas/testsuite/gas/d10v/address-008.s create mode 100644 gas/testsuite/gas/d10v/address-009.l create mode 100644 gas/testsuite/gas/d10v/address-009.s create mode 100644 gas/testsuite/gas/d10v/address-010.l create mode 100644 gas/testsuite/gas/d10v/address-010.s create mode 100644 gas/testsuite/gas/d10v/address-011.l create mode 100644 gas/testsuite/gas/d10v/address-011.s create mode 100644 gas/testsuite/gas/d10v/address-012.l create mode 100644 gas/testsuite/gas/d10v/address-012.s create mode 100644 gas/testsuite/gas/d10v/address-013.l create mode 100644 gas/testsuite/gas/d10v/address-013.s create mode 100644 gas/testsuite/gas/d10v/address-014.l create mode 100644 gas/testsuite/gas/d10v/address-014.s create mode 100644 gas/testsuite/gas/d10v/address-015.l create mode 100644 gas/testsuite/gas/d10v/address-015.s create mode 100644 gas/testsuite/gas/d10v/address-016.l create mode 100644 gas/testsuite/gas/d10v/address-016.s create mode 100644 gas/testsuite/gas/d10v/address-017.l create mode 100644 gas/testsuite/gas/d10v/address-017.s create mode 100644 gas/testsuite/gas/d10v/address-018.l create mode 100644 gas/testsuite/gas/d10v/address-018.s create mode 100644 gas/testsuite/gas/d10v/address-019.l create mode 100644 gas/testsuite/gas/d10v/address-019.s create mode 100644 gas/testsuite/gas/d10v/address-020.l create mode 100644 gas/testsuite/gas/d10v/address-020.s create mode 100644 gas/testsuite/gas/d10v/address-021.l create mode 100644 gas/testsuite/gas/d10v/address-021.s create mode 100644 gas/testsuite/gas/d10v/address-022.l create mode 100644 gas/testsuite/gas/d10v/address-022.s create mode 100644 gas/testsuite/gas/d10v/address-023.l create mode 100644 gas/testsuite/gas/d10v/address-023.s create mode 100644 gas/testsuite/gas/d10v/address-024.l create mode 100644 gas/testsuite/gas/d10v/address-024.s create mode 100644 gas/testsuite/gas/d10v/address-025.l create mode 100644 gas/testsuite/gas/d10v/address-025.s create mode 100644 gas/testsuite/gas/d10v/address-026.l create mode 100644 gas/testsuite/gas/d10v/address-026.s create mode 100644 gas/testsuite/gas/d10v/address-027.l create mode 100644 gas/testsuite/gas/d10v/address-027.s create mode 100644 gas/testsuite/gas/d10v/address-028.l create mode 100644 gas/testsuite/gas/d10v/address-028.s create mode 100644 gas/testsuite/gas/d10v/address-029.l create mode 100644 gas/testsuite/gas/d10v/address-029.s create mode 100644 gas/testsuite/gas/d10v/address-030.l create mode 100644 gas/testsuite/gas/d10v/address-030.s create mode 100644 gas/testsuite/gas/d10v/address-031.l create mode 100644 gas/testsuite/gas/d10v/address-031.s create mode 100644 gas/testsuite/gas/d10v/address-032.l create mode 100644 gas/testsuite/gas/d10v/address-032.s create mode 100644 gas/testsuite/gas/d10v/address-033.l create mode 100644 gas/testsuite/gas/d10v/address-033.s create mode 100644 gas/testsuite/gas/d10v/address-034.l create mode 100644 gas/testsuite/gas/d10v/address-034.s create mode 100644 gas/testsuite/gas/d10v/address-035.l create mode 100644 gas/testsuite/gas/d10v/address-035.s create mode 100644 gas/testsuite/gas/d10v/address-036.l create mode 100644 gas/testsuite/gas/d10v/address-036.s create mode 100644 gas/testsuite/gas/d10v/address-037.l create mode 100644 gas/testsuite/gas/d10v/address-037.s create mode 100644 gas/testsuite/gas/d10v/address-038.l create mode 100644 gas/testsuite/gas/d10v/address-038.s create mode 100644 gas/testsuite/gas/d10v/address-039.l create mode 100644 gas/testsuite/gas/d10v/address-039.s create mode 100644 gas/testsuite/gas/d10v/address-040.l create mode 100644 gas/testsuite/gas/d10v/address-040.s create mode 100644 gas/testsuite/gas/d10v/address-041.l create mode 100644 gas/testsuite/gas/d10v/address-041.s create mode 100644 gas/testsuite/gas/d10v/control-001.d create mode 100644 gas/testsuite/gas/d10v/control-001.s create mode 100644 gas/testsuite/gas/d10v/d10v.exp create mode 100644 gas/testsuite/gas/d10v/error-001.d create mode 100644 gas/testsuite/gas/d10v/error-001.s create mode 100644 gas/testsuite/gas/d10v/error-002.d create mode 100644 gas/testsuite/gas/d10v/error-002.s create mode 100644 gas/testsuite/gas/d10v/immediate-001.d create mode 100644 gas/testsuite/gas/d10v/immediate-001.s create mode 100644 gas/testsuite/gas/d10v/immediate-002.d create mode 100644 gas/testsuite/gas/d10v/immediate-002.s create mode 100644 gas/testsuite/gas/d10v/immediate-003.d create mode 100644 gas/testsuite/gas/d10v/immediate-003.s create mode 100644 gas/testsuite/gas/d10v/immediate-004.d create mode 100644 gas/testsuite/gas/d10v/immediate-004.s create mode 100644 gas/testsuite/gas/d10v/immediate-005.d create mode 100644 gas/testsuite/gas/d10v/immediate-005.s create mode 100644 gas/testsuite/gas/d10v/immediate-006.d create mode 100644 gas/testsuite/gas/d10v/immediate-006.s create mode 100644 gas/testsuite/gas/d10v/immediate-007.d create mode 100644 gas/testsuite/gas/d10v/immediate-007.s create mode 100644 gas/testsuite/gas/d10v/inst.d create mode 100644 gas/testsuite/gas/d10v/inst.s create mode 100644 gas/testsuite/gas/d10v/instruction_packing-001.d create mode 100644 gas/testsuite/gas/d10v/instruction_packing-001.s create mode 100644 gas/testsuite/gas/d10v/instruction_packing-002.d create mode 100644 gas/testsuite/gas/d10v/instruction_packing-002.s create mode 100644 gas/testsuite/gas/d10v/instruction_packing-003.d create mode 100644 gas/testsuite/gas/d10v/instruction_packing-003.s create mode 100644 gas/testsuite/gas/d10v/instruction_packing-004.d create mode 100644 gas/testsuite/gas/d10v/instruction_packing-004.s create mode 100644 gas/testsuite/gas/d10v/instruction_packing-005.d create mode 100644 gas/testsuite/gas/d10v/instruction_packing-005.s create mode 100644 gas/testsuite/gas/d10v/instruction_packing-006.d create mode 100644 gas/testsuite/gas/d10v/instruction_packing-006.s create mode 100644 gas/testsuite/gas/d10v/instruction_packing-007.d create mode 100644 gas/testsuite/gas/d10v/instruction_packing-007.s create mode 100644 gas/testsuite/gas/d10v/instruction_packing-008.d create mode 100644 gas/testsuite/gas/d10v/instruction_packing-009.d create mode 100644 gas/testsuite/gas/d10v/instruction_packing-010.d create mode 100644 gas/testsuite/gas/d10v/instruction_packing.d create mode 100644 gas/testsuite/gas/d10v/instruction_packing.s create mode 100644 gas/testsuite/gas/d10v/label-001.d create mode 100644 gas/testsuite/gas/d10v/label-001.s create mode 100644 gas/testsuite/gas/d10v/warning-001.d create mode 100644 gas/testsuite/gas/d10v/warning-001.s create mode 100644 gas/testsuite/gas/d10v/warning-002.d create mode 100644 gas/testsuite/gas/d10v/warning-002.s create mode 100644 gas/testsuite/gas/d10v/warning-003.d create mode 100644 gas/testsuite/gas/d10v/warning-003.s create mode 100644 gas/testsuite/gas/d10v/warning-004.d create mode 100644 gas/testsuite/gas/d10v/warning-004.s create mode 100644 gas/testsuite/gas/d10v/warning-005.d create mode 100644 gas/testsuite/gas/d10v/warning-005.s create mode 100644 gas/testsuite/gas/d10v/warning-006.d create mode 100644 gas/testsuite/gas/d10v/warning-006.s create mode 100644 gas/testsuite/gas/d10v/warning-007.d create mode 100644 gas/testsuite/gas/d10v/warning-007.s create mode 100644 gas/testsuite/gas/d10v/warning-008.d create mode 100644 gas/testsuite/gas/d10v/warning-008.s create mode 100644 gas/testsuite/gas/d10v/warning-009.d create mode 100644 gas/testsuite/gas/d10v/warning-009.s create mode 100644 gas/testsuite/gas/d10v/warning-010.d create mode 100644 gas/testsuite/gas/d10v/warning-010.s create mode 100644 gas/testsuite/gas/d10v/warning-011.d create mode 100644 gas/testsuite/gas/d10v/warning-011.s create mode 100644 gas/testsuite/gas/d10v/warning-012.d create mode 100644 gas/testsuite/gas/d10v/warning-012.s create mode 100644 gas/testsuite/gas/d10v/warning-013.d create mode 100644 gas/testsuite/gas/d10v/warning-013.s create mode 100644 gas/testsuite/gas/d10v/warning-014.d create mode 100644 gas/testsuite/gas/d10v/warning-014.s create mode 100644 gas/testsuite/gas/d10v/warning-015.d create mode 100644 gas/testsuite/gas/d10v/warning-016.d create mode 100644 gas/testsuite/gas/d10v/warning-016.s create mode 100644 gas/testsuite/gas/d10v/warning-017.d create mode 100644 gas/testsuite/gas/d10v/warning-017.s create mode 100644 gas/testsuite/gas/d10v/warning-018.d create mode 100644 gas/testsuite/gas/d10v/warning-018.s create mode 100644 gas/testsuite/gas/d10v/warning-019.d create mode 100644 gas/testsuite/gas/d10v/warning-019.s create mode 100644 gas/testsuite/gas/d30v/align.d create mode 100644 gas/testsuite/gas/d30v/align.s create mode 100644 gas/testsuite/gas/d30v/array.d create mode 100644 gas/testsuite/gas/d30v/array.s create mode 100644 gas/testsuite/gas/d30v/bittest.d create mode 100644 gas/testsuite/gas/d30v/bittest.l create mode 100644 gas/testsuite/gas/d30v/bittest.s create mode 100644 gas/testsuite/gas/d30v/d30.exp create mode 100644 gas/testsuite/gas/d30v/guard-debug.d create mode 100644 gas/testsuite/gas/d30v/guard-debug.s create mode 100644 gas/testsuite/gas/d30v/guard.d create mode 100644 gas/testsuite/gas/d30v/guard.s create mode 100644 gas/testsuite/gas/d30v/inst.d create mode 100644 gas/testsuite/gas/d30v/inst.s create mode 100644 gas/testsuite/gas/d30v/label-debug.d create mode 100644 gas/testsuite/gas/d30v/label-debug.s create mode 100644 gas/testsuite/gas/d30v/label.d create mode 100644 gas/testsuite/gas/d30v/label.s create mode 100644 gas/testsuite/gas/d30v/mul.d create mode 100644 gas/testsuite/gas/d30v/mul.s create mode 100644 gas/testsuite/gas/d30v/opt.d create mode 100644 gas/testsuite/gas/d30v/opt.s create mode 100644 gas/testsuite/gas/d30v/reloc.d create mode 100644 gas/testsuite/gas/d30v/reloc.s create mode 100644 gas/testsuite/gas/d30v/serial.l create mode 100644 gas/testsuite/gas/d30v/serial.s create mode 100644 gas/testsuite/gas/d30v/serial2.l create mode 100644 gas/testsuite/gas/d30v/serial2.s create mode 100644 gas/testsuite/gas/d30v/serial2O.l create mode 100644 gas/testsuite/gas/d30v/serial2O.s create mode 100644 gas/testsuite/gas/d30v/warn_oddreg.l create mode 100644 gas/testsuite/gas/d30v/warn_oddreg.s create mode 100644 gas/testsuite/gas/dlx/alltests.exp create mode 100644 gas/testsuite/gas/dlx/branch.d create mode 100644 gas/testsuite/gas/dlx/branch.s create mode 100644 gas/testsuite/gas/dlx/itype.d create mode 100644 gas/testsuite/gas/dlx/itype.s create mode 100644 gas/testsuite/gas/dlx/lhi.d create mode 100644 gas/testsuite/gas/dlx/lhi.s create mode 100644 gas/testsuite/gas/dlx/load.d create mode 100644 gas/testsuite/gas/dlx/load.s create mode 100644 gas/testsuite/gas/dlx/lohi.d create mode 100644 gas/testsuite/gas/dlx/lohi.s create mode 100644 gas/testsuite/gas/dlx/rtype.d create mode 100644 gas/testsuite/gas/dlx/rtype.s create mode 100644 gas/testsuite/gas/dlx/store.d create mode 100644 gas/testsuite/gas/dlx/store.s create mode 100644 gas/testsuite/gas/elf/ehopt0.d create mode 100644 gas/testsuite/gas/elf/ehopt0.s create mode 100644 gas/testsuite/gas/elf/elf.exp create mode 100644 gas/testsuite/gas/elf/section0.d create mode 100644 gas/testsuite/gas/elf/section0.s create mode 100644 gas/testsuite/gas/elf/section1.d create mode 100644 gas/testsuite/gas/elf/section1.s create mode 100644 gas/testsuite/gas/elf/section2.e create mode 100644 gas/testsuite/gas/elf/section2.e-m32r create mode 100644 gas/testsuite/gas/elf/section2.e-mips create mode 100644 gas/testsuite/gas/elf/section2.e-miwmmxt create mode 100644 gas/testsuite/gas/elf/section2.l create mode 100644 gas/testsuite/gas/elf/section2.s create mode 100644 gas/testsuite/gas/elf/section3.d create mode 100644 gas/testsuite/gas/elf/section3.s create mode 100644 gas/testsuite/gas/elf/symver.d create mode 100644 gas/testsuite/gas/elf/symver.s create mode 100644 gas/testsuite/gas/elf/type.e create mode 100644 gas/testsuite/gas/elf/type.s create mode 100644 gas/testsuite/gas/fr30/allinsn.d create mode 100644 gas/testsuite/gas/fr30/allinsn.exp create mode 100644 gas/testsuite/gas/fr30/allinsn.s create mode 100644 gas/testsuite/gas/fr30/fr30.exp create mode 100644 gas/testsuite/gas/frv/allinsn.d create mode 100644 gas/testsuite/gas/frv/allinsn.exp create mode 100644 gas/testsuite/gas/frv/allinsn.s create mode 100644 gas/testsuite/gas/frv/fdpic.d create mode 100644 gas/testsuite/gas/frv/fdpic.s create mode 100644 gas/testsuite/gas/frv/reloc1.d create mode 100644 gas/testsuite/gas/frv/reloc1.s create mode 100644 gas/testsuite/gas/h8300/addsub.s create mode 100644 gas/testsuite/gas/h8300/addsubh.s create mode 100644 gas/testsuite/gas/h8300/addsubs.s create mode 100644 gas/testsuite/gas/h8300/bitops1.s create mode 100644 gas/testsuite/gas/h8300/bitops1h.s create mode 100644 gas/testsuite/gas/h8300/bitops1s.s create mode 100644 gas/testsuite/gas/h8300/bitops2.s create mode 100644 gas/testsuite/gas/h8300/bitops2h.s create mode 100644 gas/testsuite/gas/h8300/bitops2s.s create mode 100644 gas/testsuite/gas/h8300/bitops3.s create mode 100644 gas/testsuite/gas/h8300/bitops3h.s create mode 100644 gas/testsuite/gas/h8300/bitops3s.s create mode 100644 gas/testsuite/gas/h8300/bitops4.s create mode 100644 gas/testsuite/gas/h8300/bitops4h.s create mode 100644 gas/testsuite/gas/h8300/bitops4s.s create mode 100644 gas/testsuite/gas/h8300/branch-coff.s create mode 100644 gas/testsuite/gas/h8300/branch-elf.s create mode 100644 gas/testsuite/gas/h8300/branchh-coff.s create mode 100644 gas/testsuite/gas/h8300/branchh-elf.s create mode 100644 gas/testsuite/gas/h8300/branchs-coff.s create mode 100644 gas/testsuite/gas/h8300/branchs-elf.s create mode 100644 gas/testsuite/gas/h8300/cbranch.s create mode 100644 gas/testsuite/gas/h8300/cbranchh.s create mode 100644 gas/testsuite/gas/h8300/cbranchs.s create mode 100644 gas/testsuite/gas/h8300/cmpsi2.s create mode 100644 gas/testsuite/gas/h8300/compare.s create mode 100644 gas/testsuite/gas/h8300/compareh.s create mode 100644 gas/testsuite/gas/h8300/compares.s create mode 100644 gas/testsuite/gas/h8300/decimal.s create mode 100644 gas/testsuite/gas/h8300/decimalh.s create mode 100644 gas/testsuite/gas/h8300/decimals.s create mode 100644 gas/testsuite/gas/h8300/divmul.s create mode 100644 gas/testsuite/gas/h8300/divmulh.s create mode 100644 gas/testsuite/gas/h8300/divmuls.s create mode 100644 gas/testsuite/gas/h8300/extendh.s create mode 100644 gas/testsuite/gas/h8300/extends.s create mode 100644 gas/testsuite/gas/h8300/ffxx1-coff.d create mode 100644 gas/testsuite/gas/h8300/ffxx1-coff.s create mode 100644 gas/testsuite/gas/h8300/ffxx1-elf.d create mode 100644 gas/testsuite/gas/h8300/ffxx1-elf.s create mode 100644 gas/testsuite/gas/h8300/h8300-coff.exp create mode 100644 gas/testsuite/gas/h8300/h8300-elf.exp create mode 100644 gas/testsuite/gas/h8300/h8300.exp create mode 100644 gas/testsuite/gas/h8300/h8sx_disp2.d create mode 100644 gas/testsuite/gas/h8300/h8sx_disp2.s create mode 100644 gas/testsuite/gas/h8300/h8sx_mov_imm.d create mode 100644 gas/testsuite/gas/h8300/h8sx_mov_imm.s create mode 100644 gas/testsuite/gas/h8300/h8sx_rtsl.d create mode 100644 gas/testsuite/gas/h8300/h8sx_rtsl.s create mode 100644 gas/testsuite/gas/h8300/incdec.s create mode 100644 gas/testsuite/gas/h8300/incdech.s create mode 100644 gas/testsuite/gas/h8300/incdecs.s create mode 100644 gas/testsuite/gas/h8300/logical.s create mode 100644 gas/testsuite/gas/h8300/logicalh.s create mode 100644 gas/testsuite/gas/h8300/logicals.s create mode 100644 gas/testsuite/gas/h8300/macs.s create mode 100644 gas/testsuite/gas/h8300/misc.s create mode 100644 gas/testsuite/gas/h8300/misch.s create mode 100644 gas/testsuite/gas/h8300/miscs.s create mode 100644 gas/testsuite/gas/h8300/mov32bug.s create mode 100644 gas/testsuite/gas/h8300/movb.s create mode 100644 gas/testsuite/gas/h8300/movbh.s create mode 100644 gas/testsuite/gas/h8300/movbs.s create mode 100644 gas/testsuite/gas/h8300/movlh.s create mode 100644 gas/testsuite/gas/h8300/movls.s create mode 100644 gas/testsuite/gas/h8300/movw.s create mode 100644 gas/testsuite/gas/h8300/movwh.s create mode 100644 gas/testsuite/gas/h8300/movws.s create mode 100644 gas/testsuite/gas/h8300/multiples.s create mode 100644 gas/testsuite/gas/h8300/pushpop.s create mode 100644 gas/testsuite/gas/h8300/pushpoph.s create mode 100644 gas/testsuite/gas/h8300/pushpops.s create mode 100644 gas/testsuite/gas/h8300/rotsh.s create mode 100644 gas/testsuite/gas/h8300/rotshh.s create mode 100644 gas/testsuite/gas/h8300/rotshs.s create mode 100644 gas/testsuite/gas/h8300/t01_mov.exp create mode 100644 gas/testsuite/gas/h8300/t01_mov.s create mode 100644 gas/testsuite/gas/h8300/t02_mova.exp create mode 100644 gas/testsuite/gas/h8300/t02_mova.s create mode 100644 gas/testsuite/gas/h8300/t03_add.exp create mode 100644 gas/testsuite/gas/h8300/t03_add.s create mode 100644 gas/testsuite/gas/h8300/t04_sub.exp create mode 100644 gas/testsuite/gas/h8300/t04_sub.s create mode 100644 gas/testsuite/gas/h8300/t05_cmp.exp create mode 100644 gas/testsuite/gas/h8300/t05_cmp.s create mode 100644 gas/testsuite/gas/h8300/t06_ari2.exp create mode 100644 gas/testsuite/gas/h8300/t06_ari2.s create mode 100644 gas/testsuite/gas/h8300/t07_ari3.exp create mode 100644 gas/testsuite/gas/h8300/t07_ari3.s create mode 100644 gas/testsuite/gas/h8300/t08_or.exp create mode 100644 gas/testsuite/gas/h8300/t08_or.s create mode 100644 gas/testsuite/gas/h8300/t09_xor.exp create mode 100644 gas/testsuite/gas/h8300/t09_xor.s create mode 100644 gas/testsuite/gas/h8300/t10_and.exp create mode 100644 gas/testsuite/gas/h8300/t10_and.s create mode 100644 gas/testsuite/gas/h8300/t11_logs.exp create mode 100644 gas/testsuite/gas/h8300/t11_logs.s create mode 100644 gas/testsuite/gas/h8300/t12_bit.exp create mode 100644 gas/testsuite/gas/h8300/t12_bit.s create mode 100644 gas/testsuite/gas/h8300/t13_otr.exp create mode 100644 gas/testsuite/gas/h8300/t13_otr.s create mode 100644 gas/testsuite/gas/hppa/README create mode 100644 gas/testsuite/gas/hppa/basic/add.s create mode 100644 gas/testsuite/gas/hppa/basic/add2.s create mode 100644 gas/testsuite/gas/hppa/basic/addi.s create mode 100644 gas/testsuite/gas/hppa/basic/basic.exp create mode 100644 gas/testsuite/gas/hppa/basic/branch.s create mode 100644 gas/testsuite/gas/hppa/basic/branch2.s create mode 100644 gas/testsuite/gas/hppa/basic/comclr.s create mode 100644 gas/testsuite/gas/hppa/basic/copr.s create mode 100644 gas/testsuite/gas/hppa/basic/coprmem.s create mode 100644 gas/testsuite/gas/hppa/basic/dcor.s create mode 100644 gas/testsuite/gas/hppa/basic/dcor2.s create mode 100644 gas/testsuite/gas/hppa/basic/deposit.s create mode 100644 gas/testsuite/gas/hppa/basic/deposit2.s create mode 100644 gas/testsuite/gas/hppa/basic/deposit3.s create mode 100644 gas/testsuite/gas/hppa/basic/ds.s create mode 100644 gas/testsuite/gas/hppa/basic/extract.s create mode 100644 gas/testsuite/gas/hppa/basic/extract2.s create mode 100644 gas/testsuite/gas/hppa/basic/extract3.s create mode 100644 gas/testsuite/gas/hppa/basic/fmem.s create mode 100644 gas/testsuite/gas/hppa/basic/fmemLRbug.s create mode 100644 gas/testsuite/gas/hppa/basic/fp_comp.s create mode 100644 gas/testsuite/gas/hppa/basic/fp_comp2.s create mode 100644 gas/testsuite/gas/hppa/basic/fp_conv.s create mode 100644 gas/testsuite/gas/hppa/basic/fp_fcmp.s create mode 100644 gas/testsuite/gas/hppa/basic/fp_misc.s create mode 100644 gas/testsuite/gas/hppa/basic/imem.s create mode 100644 gas/testsuite/gas/hppa/basic/immed.s create mode 100644 gas/testsuite/gas/hppa/basic/logical.s create mode 100644 gas/testsuite/gas/hppa/basic/media.s create mode 100644 gas/testsuite/gas/hppa/basic/perf.s create mode 100644 gas/testsuite/gas/hppa/basic/purge.s create mode 100644 gas/testsuite/gas/hppa/basic/purge2.s create mode 100644 gas/testsuite/gas/hppa/basic/sh1add.s create mode 100644 gas/testsuite/gas/hppa/basic/sh2add.s create mode 100644 gas/testsuite/gas/hppa/basic/sh3add.s create mode 100644 gas/testsuite/gas/hppa/basic/shift.s create mode 100644 gas/testsuite/gas/hppa/basic/shift2.s create mode 100644 gas/testsuite/gas/hppa/basic/shift3.s create mode 100644 gas/testsuite/gas/hppa/basic/shladd.s create mode 100644 gas/testsuite/gas/hppa/basic/shladd2.s create mode 100644 gas/testsuite/gas/hppa/basic/special.s create mode 100644 gas/testsuite/gas/hppa/basic/spop.s create mode 100644 gas/testsuite/gas/hppa/basic/sub.s create mode 100644 gas/testsuite/gas/hppa/basic/sub2.s create mode 100644 gas/testsuite/gas/hppa/basic/subi.s create mode 100644 gas/testsuite/gas/hppa/basic/system.s create mode 100644 gas/testsuite/gas/hppa/basic/system2.s create mode 100644 gas/testsuite/gas/hppa/basic/unit.s create mode 100644 gas/testsuite/gas/hppa/basic/unit2.s create mode 100644 gas/testsuite/gas/hppa/basic/weird.s create mode 100644 gas/testsuite/gas/hppa/parse/align1.s create mode 100644 gas/testsuite/gas/hppa/parse/align2.s create mode 100644 gas/testsuite/gas/hppa/parse/appbug.s create mode 100644 gas/testsuite/gas/hppa/parse/badfmpyadd.s create mode 100644 gas/testsuite/gas/hppa/parse/block1.s create mode 100644 gas/testsuite/gas/hppa/parse/block2.s create mode 100644 gas/testsuite/gas/hppa/parse/calldatabug.s create mode 100644 gas/testsuite/gas/hppa/parse/callinfobug.s create mode 100644 gas/testsuite/gas/hppa/parse/defbug.s create mode 100644 gas/testsuite/gas/hppa/parse/entrybug.s create mode 100644 gas/testsuite/gas/hppa/parse/exportbug.s create mode 100644 gas/testsuite/gas/hppa/parse/exprbug.s create mode 100644 gas/testsuite/gas/hppa/parse/fixup7bug.s create mode 100644 gas/testsuite/gas/hppa/parse/global.s create mode 100644 gas/testsuite/gas/hppa/parse/labelbug.s create mode 100644 gas/testsuite/gas/hppa/parse/linesepbug.s create mode 100644 gas/testsuite/gas/hppa/parse/lselbug.s create mode 100644 gas/testsuite/gas/hppa/parse/nosubspace.s create mode 100644 gas/testsuite/gas/hppa/parse/parse.exp create mode 100644 gas/testsuite/gas/hppa/parse/procbug.s create mode 100644 gas/testsuite/gas/hppa/parse/regpopbug.s create mode 100644 gas/testsuite/gas/hppa/parse/space.s create mode 100644 gas/testsuite/gas/hppa/parse/spacebug.s create mode 100644 gas/testsuite/gas/hppa/parse/ssbug.s create mode 100644 gas/testsuite/gas/hppa/parse/stdreg.s create mode 100644 gas/testsuite/gas/hppa/parse/stringer.s create mode 100644 gas/testsuite/gas/hppa/parse/undefbug.s create mode 100644 gas/testsuite/gas/hppa/parse/versionbug.s create mode 100644 gas/testsuite/gas/hppa/parse/xmpyubug.s create mode 100644 gas/testsuite/gas/hppa/reloc/applybug.s create mode 100644 gas/testsuite/gas/hppa/reloc/blebug.s create mode 100644 gas/testsuite/gas/hppa/reloc/blebug2.s create mode 100644 gas/testsuite/gas/hppa/reloc/blebug3.s create mode 100644 gas/testsuite/gas/hppa/reloc/exitbug.s create mode 100644 gas/testsuite/gas/hppa/reloc/fixupbug.s create mode 100644 gas/testsuite/gas/hppa/reloc/funcrelocbug.s create mode 100644 gas/testsuite/gas/hppa/reloc/labelopbug.s create mode 100644 gas/testsuite/gas/hppa/reloc/longcall.s create mode 100644 gas/testsuite/gas/hppa/reloc/picreloc.s create mode 100644 gas/testsuite/gas/hppa/reloc/plabelbug.s create mode 100644 gas/testsuite/gas/hppa/reloc/r_no_reloc.s create mode 100644 gas/testsuite/gas/hppa/reloc/reduce.s create mode 100644 gas/testsuite/gas/hppa/reloc/reduce2.s create mode 100644 gas/testsuite/gas/hppa/reloc/reduce3.s create mode 100644 gas/testsuite/gas/hppa/reloc/reloc.exp create mode 100644 gas/testsuite/gas/hppa/reloc/roundmode.s create mode 100644 gas/testsuite/gas/hppa/reloc/selectorbug.s create mode 100644 gas/testsuite/gas/hppa/unsorted/align3.s create mode 100644 gas/testsuite/gas/hppa/unsorted/align4.s create mode 100644 gas/testsuite/gas/hppa/unsorted/brlenbug.s create mode 100644 gas/testsuite/gas/hppa/unsorted/common.s create mode 100644 gas/testsuite/gas/hppa/unsorted/fragbug.s create mode 100644 gas/testsuite/gas/hppa/unsorted/globalbug.s create mode 100644 gas/testsuite/gas/hppa/unsorted/importbug.s create mode 100644 gas/testsuite/gas/hppa/unsorted/labeldiffs.s create mode 100644 gas/testsuite/gas/hppa/unsorted/locallabel.s create mode 100644 gas/testsuite/gas/hppa/unsorted/ss_align.s create mode 100644 gas/testsuite/gas/hppa/unsorted/unsorted.exp create mode 100644 gas/testsuite/gas/i386/absrel.d create mode 100644 gas/testsuite/gas/i386/absrel.s create mode 100644 gas/testsuite/gas/i386/amd.d create mode 100644 gas/testsuite/gas/i386/amd.s create mode 100644 gas/testsuite/gas/i386/divide.d create mode 100644 gas/testsuite/gas/i386/divide.s create mode 100644 gas/testsuite/gas/i386/float.l create mode 100644 gas/testsuite/gas/i386/float.s create mode 100644 gas/testsuite/gas/i386/general.l create mode 100644 gas/testsuite/gas/i386/general.s create mode 100644 gas/testsuite/gas/i386/gotpc.d create mode 100644 gas/testsuite/gas/i386/gotpc.s create mode 100644 gas/testsuite/gas/i386/i386.exp create mode 100644 gas/testsuite/gas/i386/intel.d create mode 100644 gas/testsuite/gas/i386/intel.s create mode 100644 gas/testsuite/gas/i386/intel16.d create mode 100644 gas/testsuite/gas/i386/intel16.s create mode 100644 gas/testsuite/gas/i386/intelpic.d create mode 100644 gas/testsuite/gas/i386/intelpic.s create mode 100644 gas/testsuite/gas/i386/inval.l create mode 100644 gas/testsuite/gas/i386/inval.s create mode 100644 gas/testsuite/gas/i386/jump.d create mode 100644 gas/testsuite/gas/i386/jump.s create mode 100644 gas/testsuite/gas/i386/jump16.d create mode 100644 gas/testsuite/gas/i386/jump16.s create mode 100644 gas/testsuite/gas/i386/katmai.d create mode 100644 gas/testsuite/gas/i386/katmai.s create mode 100644 gas/testsuite/gas/i386/modrm.l create mode 100644 gas/testsuite/gas/i386/modrm.s create mode 100644 gas/testsuite/gas/i386/naked.d create mode 100644 gas/testsuite/gas/i386/naked.s create mode 100644 gas/testsuite/gas/i386/opcode.d create mode 100644 gas/testsuite/gas/i386/opcode.s create mode 100644 gas/testsuite/gas/i386/padlock.d create mode 100644 gas/testsuite/gas/i386/padlock.s create mode 100644 gas/testsuite/gas/i386/pcrel.d create mode 100644 gas/testsuite/gas/i386/pcrel.s create mode 100644 gas/testsuite/gas/i386/prefix.d create mode 100644 gas/testsuite/gas/i386/prefix.s create mode 100644 gas/testsuite/gas/i386/prescott.d create mode 100644 gas/testsuite/gas/i386/prescott.s create mode 100644 gas/testsuite/gas/i386/relax.d create mode 100644 gas/testsuite/gas/i386/relax.s create mode 100644 gas/testsuite/gas/i386/reloc.d create mode 100644 gas/testsuite/gas/i386/reloc.s create mode 100644 gas/testsuite/gas/i386/sse2.d create mode 100644 gas/testsuite/gas/i386/sse2.s create mode 100644 gas/testsuite/gas/i386/ssemmx2.d create mode 100644 gas/testsuite/gas/i386/ssemmx2.s create mode 100644 gas/testsuite/gas/i386/sub.d create mode 100644 gas/testsuite/gas/i386/sub.s create mode 100644 gas/testsuite/gas/i386/tlsd.d create mode 100644 gas/testsuite/gas/i386/tlsd.s create mode 100644 gas/testsuite/gas/i386/tlsnopic.d create mode 100644 gas/testsuite/gas/i386/tlsnopic.s create mode 100644 gas/testsuite/gas/i386/tlspic.d create mode 100644 gas/testsuite/gas/i386/tlspic.s create mode 100644 gas/testsuite/gas/i386/white.l create mode 100644 gas/testsuite/gas/i386/white.s create mode 100644 gas/testsuite/gas/i386/x86-64-inval.l create mode 100644 gas/testsuite/gas/i386/x86-64-inval.s create mode 100644 gas/testsuite/gas/i386/x86-64-opcode.d create mode 100644 gas/testsuite/gas/i386/x86-64-opcode.s create mode 100644 gas/testsuite/gas/i386/x86_64.d create mode 100644 gas/testsuite/gas/i386/x86_64.s create mode 100644 gas/testsuite/gas/i860/README.i860 create mode 100644 gas/testsuite/gas/i860/bitwise.d create mode 100644 gas/testsuite/gas/i860/bitwise.s create mode 100644 gas/testsuite/gas/i860/branch.d create mode 100644 gas/testsuite/gas/i860/branch.s create mode 100644 gas/testsuite/gas/i860/bte.d create mode 100644 gas/testsuite/gas/i860/bte.s create mode 100644 gas/testsuite/gas/i860/dir-align01.d create mode 100644 gas/testsuite/gas/i860/dir-align01.s create mode 100644 gas/testsuite/gas/i860/dir-intel01.d create mode 100644 gas/testsuite/gas/i860/dir-intel01.s create mode 100644 gas/testsuite/gas/i860/dir-intel02.d create mode 100644 gas/testsuite/gas/i860/dir-intel02.s create mode 100644 gas/testsuite/gas/i860/dir-intel03-err.l create mode 100644 gas/testsuite/gas/i860/dir-intel03-err.s create mode 100644 gas/testsuite/gas/i860/dual01.d create mode 100644 gas/testsuite/gas/i860/dual01.s create mode 100644 gas/testsuite/gas/i860/dual02-err.l create mode 100644 gas/testsuite/gas/i860/dual02-err.s create mode 100644 gas/testsuite/gas/i860/dual03.d create mode 100644 gas/testsuite/gas/i860/dual03.s create mode 100644 gas/testsuite/gas/i860/fldst01.d create mode 100644 gas/testsuite/gas/i860/fldst01.s create mode 100644 gas/testsuite/gas/i860/fldst02.d create mode 100644 gas/testsuite/gas/i860/fldst02.s create mode 100644 gas/testsuite/gas/i860/fldst03.d create mode 100644 gas/testsuite/gas/i860/fldst03.s create mode 100644 gas/testsuite/gas/i860/fldst04.d create mode 100644 gas/testsuite/gas/i860/fldst04.s create mode 100644 gas/testsuite/gas/i860/fldst05.d create mode 100644 gas/testsuite/gas/i860/fldst05.s create mode 100644 gas/testsuite/gas/i860/fldst06.d create mode 100644 gas/testsuite/gas/i860/fldst06.s create mode 100644 gas/testsuite/gas/i860/fldst07.d create mode 100644 gas/testsuite/gas/i860/fldst07.s create mode 100644 gas/testsuite/gas/i860/fldst08.d create mode 100644 gas/testsuite/gas/i860/fldst08.s create mode 100644 gas/testsuite/gas/i860/float01.d create mode 100644 gas/testsuite/gas/i860/float01.s create mode 100644 gas/testsuite/gas/i860/float02.d create mode 100644 gas/testsuite/gas/i860/float02.s create mode 100644 gas/testsuite/gas/i860/float03.d create mode 100644 gas/testsuite/gas/i860/float03.s create mode 100644 gas/testsuite/gas/i860/float04.d create mode 100644 gas/testsuite/gas/i860/float04.s create mode 100644 gas/testsuite/gas/i860/form.d create mode 100644 gas/testsuite/gas/i860/form.s create mode 100644 gas/testsuite/gas/i860/i860.exp create mode 100644 gas/testsuite/gas/i860/iarith.d create mode 100644 gas/testsuite/gas/i860/iarith.s create mode 100644 gas/testsuite/gas/i860/ldst01.d create mode 100644 gas/testsuite/gas/i860/ldst01.s create mode 100644 gas/testsuite/gas/i860/ldst02.d create mode 100644 gas/testsuite/gas/i860/ldst02.s create mode 100644 gas/testsuite/gas/i860/ldst03.d create mode 100644 gas/testsuite/gas/i860/ldst03.s create mode 100644 gas/testsuite/gas/i860/ldst04.d create mode 100644 gas/testsuite/gas/i860/ldst04.s create mode 100644 gas/testsuite/gas/i860/ldst05.d create mode 100644 gas/testsuite/gas/i860/ldst05.s create mode 100644 gas/testsuite/gas/i860/ldst06.d create mode 100644 gas/testsuite/gas/i860/ldst06.s create mode 100644 gas/testsuite/gas/i860/pfam.d create mode 100644 gas/testsuite/gas/i860/pfam.s create mode 100644 gas/testsuite/gas/i860/pfmam.d create mode 100644 gas/testsuite/gas/i860/pfmam.s create mode 100644 gas/testsuite/gas/i860/pfmsm.d create mode 100644 gas/testsuite/gas/i860/pfmsm.s create mode 100644 gas/testsuite/gas/i860/pfsm.d create mode 100644 gas/testsuite/gas/i860/pfsm.s create mode 100644 gas/testsuite/gas/i860/pseudo-ops01.d create mode 100644 gas/testsuite/gas/i860/pseudo-ops01.s create mode 100644 gas/testsuite/gas/i860/regress01.d create mode 100644 gas/testsuite/gas/i860/regress01.s create mode 100644 gas/testsuite/gas/i860/shift.d create mode 100644 gas/testsuite/gas/i860/shift.s create mode 100644 gas/testsuite/gas/i860/simd.d create mode 100644 gas/testsuite/gas/i860/simd.s create mode 100644 gas/testsuite/gas/i860/system.d create mode 100644 gas/testsuite/gas/i860/system.s create mode 100644 gas/testsuite/gas/i860/xp.d create mode 100644 gas/testsuite/gas/i860/xp.s create mode 100644 gas/testsuite/gas/ia64/alias-ilp32.d create mode 100644 gas/testsuite/gas/ia64/alias.d create mode 100644 gas/testsuite/gas/ia64/alias.s create mode 100644 gas/testsuite/gas/ia64/align.d create mode 100644 gas/testsuite/gas/ia64/align.s create mode 100644 gas/testsuite/gas/ia64/dependency-1.d create mode 100644 gas/testsuite/gas/ia64/dependency-1.s create mode 100644 gas/testsuite/gas/ia64/dv-branch.d create mode 100644 gas/testsuite/gas/ia64/dv-branch.s create mode 100644 gas/testsuite/gas/ia64/dv-entry-err.l create mode 100644 gas/testsuite/gas/ia64/dv-entry-err.s create mode 100644 gas/testsuite/gas/ia64/dv-imply.d create mode 100644 gas/testsuite/gas/ia64/dv-imply.s create mode 100644 gas/testsuite/gas/ia64/dv-mutex-err.l create mode 100644 gas/testsuite/gas/ia64/dv-mutex-err.s create mode 100644 gas/testsuite/gas/ia64/dv-mutex.d create mode 100644 gas/testsuite/gas/ia64/dv-mutex.s create mode 100644 gas/testsuite/gas/ia64/dv-raw-err.l create mode 100644 gas/testsuite/gas/ia64/dv-raw-err.s create mode 100644 gas/testsuite/gas/ia64/dv-safe.d create mode 100644 gas/testsuite/gas/ia64/dv-safe.s create mode 100644 gas/testsuite/gas/ia64/dv-srlz.d create mode 100644 gas/testsuite/gas/ia64/dv-srlz.s create mode 100644 gas/testsuite/gas/ia64/dv-war-err.l create mode 100644 gas/testsuite/gas/ia64/dv-war-err.s create mode 100644 gas/testsuite/gas/ia64/dv-waw-err.l create mode 100644 gas/testsuite/gas/ia64/dv-waw-err.s create mode 100644 gas/testsuite/gas/ia64/fixup-dump.pl create mode 100644 gas/testsuite/gas/ia64/global.d create mode 100644 gas/testsuite/gas/ia64/global.s create mode 100644 gas/testsuite/gas/ia64/ia64.exp create mode 100644 gas/testsuite/gas/ia64/ldxmov-1.d create mode 100644 gas/testsuite/gas/ia64/ldxmov-1.s create mode 100644 gas/testsuite/gas/ia64/ldxmov-2.l create mode 100644 gas/testsuite/gas/ia64/ldxmov-2.s create mode 100644 gas/testsuite/gas/ia64/ltoff22x-1.d create mode 100644 gas/testsuite/gas/ia64/ltoff22x-1.s create mode 100644 gas/testsuite/gas/ia64/opc-a-err.l create mode 100644 gas/testsuite/gas/ia64/opc-a-err.s create mode 100644 gas/testsuite/gas/ia64/opc-a.d create mode 100644 gas/testsuite/gas/ia64/opc-a.pl create mode 100644 gas/testsuite/gas/ia64/opc-a.s create mode 100644 gas/testsuite/gas/ia64/opc-b.d create mode 100644 gas/testsuite/gas/ia64/opc-b.pl create mode 100644 gas/testsuite/gas/ia64/opc-b.s create mode 100644 gas/testsuite/gas/ia64/opc-f.d create mode 100644 gas/testsuite/gas/ia64/opc-f.pl create mode 100644 gas/testsuite/gas/ia64/opc-f.s create mode 100644 gas/testsuite/gas/ia64/opc-i.d create mode 100644 gas/testsuite/gas/ia64/opc-i.pl create mode 100644 gas/testsuite/gas/ia64/opc-i.s create mode 100644 gas/testsuite/gas/ia64/opc-m.d create mode 100644 gas/testsuite/gas/ia64/opc-m.pl create mode 100644 gas/testsuite/gas/ia64/opc-m.s create mode 100644 gas/testsuite/gas/ia64/opc-x.d create mode 100644 gas/testsuite/gas/ia64/opc-x.s create mode 100644 gas/testsuite/gas/ia64/order.d create mode 100644 gas/testsuite/gas/ia64/order.s create mode 100644 gas/testsuite/gas/ia64/real.d create mode 100644 gas/testsuite/gas/ia64/real.s create mode 100644 gas/testsuite/gas/ia64/regs.d create mode 100644 gas/testsuite/gas/ia64/regs.pl create mode 100644 gas/testsuite/gas/ia64/regs.s create mode 100644 gas/testsuite/gas/ia64/secname-ilp32.d create mode 100644 gas/testsuite/gas/ia64/secname.d create mode 100644 gas/testsuite/gas/ia64/secname.s create mode 100644 gas/testsuite/gas/ia64/tls.d create mode 100644 gas/testsuite/gas/ia64/tls.s create mode 100644 gas/testsuite/gas/ia64/unwind-ilp32.d create mode 100644 gas/testsuite/gas/ia64/unwind.d create mode 100644 gas/testsuite/gas/ia64/unwind.s create mode 100644 gas/testsuite/gas/ieee-fp/x930509a.exp create mode 100644 gas/testsuite/gas/ieee-fp/x930509a.s create mode 100644 gas/testsuite/gas/iq2000/allinsn.d create mode 100644 gas/testsuite/gas/iq2000/allinsn.exp create mode 100644 gas/testsuite/gas/iq2000/allinsn.s create mode 100644 gas/testsuite/gas/iq2000/hazard0.s create mode 100644 gas/testsuite/gas/iq2000/hazard1.s create mode 100644 gas/testsuite/gas/iq2000/hazard2.s create mode 100644 gas/testsuite/gas/iq2000/hazard3.s create mode 100644 gas/testsuite/gas/iq2000/hazard4.s create mode 100644 gas/testsuite/gas/iq2000/hazard5.s create mode 100644 gas/testsuite/gas/iq2000/load-hazards.exp create mode 100644 gas/testsuite/gas/iq2000/nohazard.s create mode 100644 gas/testsuite/gas/iq2000/noyield.s create mode 100644 gas/testsuite/gas/iq2000/odd-ldw.exp create mode 100644 gas/testsuite/gas/iq2000/odd-sdw.exp create mode 100644 gas/testsuite/gas/iq2000/oddldw.s create mode 100644 gas/testsuite/gas/iq2000/oddsdw.s create mode 100644 gas/testsuite/gas/iq2000/q10allinsn.d create mode 100644 gas/testsuite/gas/iq2000/q10allinsn.s create mode 100644 gas/testsuite/gas/iq2000/q10hazard3.s create mode 100644 gas/testsuite/gas/iq2000/q10hazard4.s create mode 100644 gas/testsuite/gas/iq2000/q10hazard5.s create mode 100644 gas/testsuite/gas/iq2000/q10load-hazards.exp create mode 100644 gas/testsuite/gas/iq2000/q10nohazard.s create mode 100644 gas/testsuite/gas/iq2000/q10noyield.s create mode 100644 gas/testsuite/gas/iq2000/q10test0.d create mode 100644 gas/testsuite/gas/iq2000/q10test0.s create mode 100644 gas/testsuite/gas/iq2000/q10test1.d create mode 100644 gas/testsuite/gas/iq2000/q10test1.s create mode 100644 gas/testsuite/gas/iq2000/q10test10.d create mode 100644 gas/testsuite/gas/iq2000/q10test10.s create mode 100644 gas/testsuite/gas/iq2000/q10test11.d create mode 100644 gas/testsuite/gas/iq2000/q10test11.s create mode 100644 gas/testsuite/gas/iq2000/q10test12.d create mode 100644 gas/testsuite/gas/iq2000/q10test12.s create mode 100644 gas/testsuite/gas/iq2000/q10test2.d create mode 100644 gas/testsuite/gas/iq2000/q10test2.s create mode 100644 gas/testsuite/gas/iq2000/q10test3.d create mode 100644 gas/testsuite/gas/iq2000/q10test3.s create mode 100644 gas/testsuite/gas/iq2000/q10test4.d create mode 100644 gas/testsuite/gas/iq2000/q10test4.s create mode 100644 gas/testsuite/gas/iq2000/q10test5.d create mode 100644 gas/testsuite/gas/iq2000/q10test5.s create mode 100644 gas/testsuite/gas/iq2000/q10test6.d create mode 100644 gas/testsuite/gas/iq2000/q10test6.s create mode 100644 gas/testsuite/gas/iq2000/q10test7.d create mode 100644 gas/testsuite/gas/iq2000/q10test7.s create mode 100644 gas/testsuite/gas/iq2000/q10test8.d create mode 100644 gas/testsuite/gas/iq2000/q10test8.s create mode 100644 gas/testsuite/gas/iq2000/q10test9.d create mode 100644 gas/testsuite/gas/iq2000/q10test9.s create mode 100644 gas/testsuite/gas/iq2000/q10yield.exp create mode 100644 gas/testsuite/gas/iq2000/test.exp create mode 100644 gas/testsuite/gas/iq2000/yield.exp create mode 100644 gas/testsuite/gas/iq2000/yield0.s create mode 100644 gas/testsuite/gas/iq2000/yield1.s create mode 100644 gas/testsuite/gas/iq2000/yield2.s create mode 100644 gas/testsuite/gas/m32r/allinsn.d create mode 100644 gas/testsuite/gas/m32r/allinsn.exp create mode 100644 gas/testsuite/gas/m32r/allinsn.s create mode 100644 gas/testsuite/gas/m32r/error.exp create mode 100644 gas/testsuite/gas/m32r/fslot.d create mode 100644 gas/testsuite/gas/m32r/fslot.s create mode 100644 gas/testsuite/gas/m32r/fslotx.d create mode 100644 gas/testsuite/gas/m32r/fslotx.s create mode 100644 gas/testsuite/gas/m32r/high-1.d create mode 100644 gas/testsuite/gas/m32r/high-1.s create mode 100644 gas/testsuite/gas/m32r/interfere.s create mode 100644 gas/testsuite/gas/m32r/m32r.exp create mode 100644 gas/testsuite/gas/m32r/m32r2.d create mode 100644 gas/testsuite/gas/m32r/m32r2.exp create mode 100644 gas/testsuite/gas/m32r/m32r2.s create mode 100644 gas/testsuite/gas/m32r/m32rx.d create mode 100644 gas/testsuite/gas/m32r/m32rx.exp create mode 100644 gas/testsuite/gas/m32r/m32rx.s create mode 100644 gas/testsuite/gas/m32r/outofrange.s create mode 100644 gas/testsuite/gas/m32r/parallel.s create mode 100644 gas/testsuite/gas/m32r/pic.d create mode 100644 gas/testsuite/gas/m32r/pic.exp create mode 100644 gas/testsuite/gas/m32r/pic.s create mode 100644 gas/testsuite/gas/m32r/relax-1.d create mode 100644 gas/testsuite/gas/m32r/relax-1.s create mode 100644 gas/testsuite/gas/m32r/relax-2.d create mode 100644 gas/testsuite/gas/m32r/relax-2.s create mode 100644 gas/testsuite/gas/m32r/signed-relocs.d create mode 100644 gas/testsuite/gas/m32r/signed-relocs.s create mode 100644 gas/testsuite/gas/m32r/uppercase.d create mode 100644 gas/testsuite/gas/m32r/uppercase.s create mode 100644 gas/testsuite/gas/m32r/wrongsize.s create mode 100644 gas/testsuite/gas/m68hc11/abi-m68hc11-16-32.d create mode 100644 gas/testsuite/gas/m68hc11/abi-m68hc11-16-64.d create mode 100644 gas/testsuite/gas/m68hc11/abi-m68hc11-32-32.d create mode 100644 gas/testsuite/gas/m68hc11/abi-m68hc11-32-64.d create mode 100644 gas/testsuite/gas/m68hc11/abi.s create mode 100644 gas/testsuite/gas/m68hc11/all_insns.d create mode 100644 gas/testsuite/gas/m68hc11/all_insns.s create mode 100644 gas/testsuite/gas/m68hc11/branchs12.d create mode 100644 gas/testsuite/gas/m68hc11/branchs12.s create mode 100644 gas/testsuite/gas/m68hc11/bug-1825.d create mode 100644 gas/testsuite/gas/m68hc11/bug-1825.s create mode 100644 gas/testsuite/gas/m68hc11/indexed12.d create mode 100644 gas/testsuite/gas/m68hc11/indexed12.s create mode 100644 gas/testsuite/gas/m68hc11/insns-dwarf2.d create mode 100644 gas/testsuite/gas/m68hc11/insns.d create mode 100644 gas/testsuite/gas/m68hc11/insns.s create mode 100644 gas/testsuite/gas/m68hc11/insns12.d create mode 100644 gas/testsuite/gas/m68hc11/insns12.s create mode 100644 gas/testsuite/gas/m68hc11/lbranch-dwarf2.d create mode 100644 gas/testsuite/gas/m68hc11/lbranch.d create mode 100644 gas/testsuite/gas/m68hc11/lbranch.s create mode 100644 gas/testsuite/gas/m68hc11/m68hc11.exp create mode 100644 gas/testsuite/gas/m68hc11/malis-include.s create mode 100644 gas/testsuite/gas/m68hc11/malis.d create mode 100644 gas/testsuite/gas/m68hc11/malis.s create mode 100644 gas/testsuite/gas/m68hc11/movb.d create mode 100644 gas/testsuite/gas/m68hc11/movb.s create mode 100644 gas/testsuite/gas/m68hc11/opers12-dwarf2.d create mode 100644 gas/testsuite/gas/m68hc11/opers12.d create mode 100644 gas/testsuite/gas/m68hc11/opers12.s create mode 100644 gas/testsuite/gas/m68k-coff/gas.exp create mode 100644 gas/testsuite/gas/m68k-coff/p2389.s create mode 100644 gas/testsuite/gas/m68k-coff/p2389a.s create mode 100644 gas/testsuite/gas/m68k-coff/p2430.s create mode 100644 gas/testsuite/gas/m68k-coff/p2430a.s create mode 100644 gas/testsuite/gas/m68k-coff/t1.s create mode 100644 gas/testsuite/gas/m68k/all.exp create mode 100644 gas/testsuite/gas/m68k/bitfield.d create mode 100644 gas/testsuite/gas/m68k/bitfield.s create mode 100644 gas/testsuite/gas/m68k/cas.d create mode 100644 gas/testsuite/gas/m68k/cas.s create mode 100644 gas/testsuite/gas/m68k/disperr.s create mode 100644 gas/testsuite/gas/m68k/fmoveml.d create mode 100644 gas/testsuite/gas/m68k/fmoveml.s create mode 100644 gas/testsuite/gas/m68k/link.d create mode 100644 gas/testsuite/gas/m68k/link.s create mode 100644 gas/testsuite/gas/m68k/mcf-mov3q.d create mode 100644 gas/testsuite/gas/m68k/mcf-mov3q.s create mode 100644 gas/testsuite/gas/m68k/op68000.d create mode 100644 gas/testsuite/gas/m68k/operands.d create mode 100644 gas/testsuite/gas/m68k/operands.s create mode 100644 gas/testsuite/gas/m68k/p2410.s create mode 100644 gas/testsuite/gas/m68k/p2663.s create mode 100644 gas/testsuite/gas/m68k/pcrel.d create mode 100644 gas/testsuite/gas/m68k/pcrel.s create mode 100644 gas/testsuite/gas/m68k/pic1.s create mode 100644 gas/testsuite/gas/m68k/t2.d create mode 100644 gas/testsuite/gas/m68k/t2.s create mode 100644 gas/testsuite/gas/m88k/allinsn.d create mode 100644 gas/testsuite/gas/m88k/allinsn.s create mode 100644 gas/testsuite/gas/m88k/init.d create mode 100644 gas/testsuite/gas/m88k/init.s create mode 100644 gas/testsuite/gas/m88k/m88k.exp create mode 100644 gas/testsuite/gas/macros/and.s create mode 100644 gas/testsuite/gas/macros/app1.d create mode 100644 gas/testsuite/gas/macros/app1.s create mode 100644 gas/testsuite/gas/macros/app2.d create mode 100644 gas/testsuite/gas/macros/app2.s create mode 100644 gas/testsuite/gas/macros/app3.d create mode 100644 gas/testsuite/gas/macros/app3.s create mode 100644 gas/testsuite/gas/macros/app4.d create mode 100644 gas/testsuite/gas/macros/app4.s create mode 100644 gas/testsuite/gas/macros/app4b.s create mode 100644 gas/testsuite/gas/macros/err.s create mode 100644 gas/testsuite/gas/macros/irp.d create mode 100644 gas/testsuite/gas/macros/irp.s create mode 100644 gas/testsuite/gas/macros/macros.exp create mode 100644 gas/testsuite/gas/macros/rept.d create mode 100644 gas/testsuite/gas/macros/rept.s create mode 100644 gas/testsuite/gas/macros/semi.d create mode 100644 gas/testsuite/gas/macros/semi.s create mode 100644 gas/testsuite/gas/macros/strings.d create mode 100644 gas/testsuite/gas/macros/strings.s create mode 100644 gas/testsuite/gas/macros/test1.d create mode 100644 gas/testsuite/gas/macros/test1.s create mode 100644 gas/testsuite/gas/macros/test2.d create mode 100644 gas/testsuite/gas/macros/test2.s create mode 100644 gas/testsuite/gas/macros/test3.d create mode 100644 gas/testsuite/gas/macros/test3.s create mode 100644 gas/testsuite/gas/mcore/allinsn.d create mode 100644 gas/testsuite/gas/mcore/allinsn.exp create mode 100644 gas/testsuite/gas/mcore/allinsn.s create mode 100644 gas/testsuite/gas/mips/abs.d create mode 100644 gas/testsuite/gas/mips/abs.s create mode 100644 gas/testsuite/gas/mips/add.d create mode 100644 gas/testsuite/gas/mips/add.s create mode 100644 gas/testsuite/gas/mips/and.d create mode 100644 gas/testsuite/gas/mips/and.s create mode 100644 gas/testsuite/gas/mips/baddata1.l create mode 100644 gas/testsuite/gas/mips/baddata1.s create mode 100644 gas/testsuite/gas/mips/beq.d create mode 100644 gas/testsuite/gas/mips/beq.s create mode 100644 gas/testsuite/gas/mips/bge.d create mode 100644 gas/testsuite/gas/mips/bge.s create mode 100644 gas/testsuite/gas/mips/bgeu.d create mode 100644 gas/testsuite/gas/mips/bgeu.s create mode 100644 gas/testsuite/gas/mips/blt.d create mode 100644 gas/testsuite/gas/mips/blt.s create mode 100644 gas/testsuite/gas/mips/bltu.d create mode 100644 gas/testsuite/gas/mips/bltu.s create mode 100644 gas/testsuite/gas/mips/branch-misc-1.d create mode 100644 gas/testsuite/gas/mips/branch-misc-1.s create mode 100644 gas/testsuite/gas/mips/branch-misc-2.l create mode 100644 gas/testsuite/gas/mips/branch-misc-2.s create mode 100644 gas/testsuite/gas/mips/branch-misc-2pic.l create mode 100644 gas/testsuite/gas/mips/branch-misc-2pic.s create mode 100644 gas/testsuite/gas/mips/break20.d create mode 100644 gas/testsuite/gas/mips/break20.s create mode 100644 gas/testsuite/gas/mips/cp0-names-mips32.d create mode 100644 gas/testsuite/gas/mips/cp0-names-mips32r2.d create mode 100644 gas/testsuite/gas/mips/cp0-names-mips64.d create mode 100644 gas/testsuite/gas/mips/cp0-names-mips64r2.d create mode 100644 gas/testsuite/gas/mips/cp0-names-numeric.d create mode 100644 gas/testsuite/gas/mips/cp0-names-sb1.d create mode 100644 gas/testsuite/gas/mips/cp0-names.s create mode 100644 gas/testsuite/gas/mips/cp0sel-names-mips32.d create mode 100644 gas/testsuite/gas/mips/cp0sel-names-mips32r2.d create mode 100644 gas/testsuite/gas/mips/cp0sel-names-mips64.d create mode 100644 gas/testsuite/gas/mips/cp0sel-names-mips64r2.d create mode 100644 gas/testsuite/gas/mips/cp0sel-names-numeric.d create mode 100644 gas/testsuite/gas/mips/cp0sel-names-sb1.d create mode 100644 gas/testsuite/gas/mips/cp0sel-names.s create mode 100644 gas/testsuite/gas/mips/delay.d create mode 100644 gas/testsuite/gas/mips/delay.s create mode 100644 gas/testsuite/gas/mips/div-ilocks.d create mode 100644 gas/testsuite/gas/mips/div.d create mode 100644 gas/testsuite/gas/mips/div.s create mode 100644 gas/testsuite/gas/mips/dli.d create mode 100644 gas/testsuite/gas/mips/dli.s create mode 100644 gas/testsuite/gas/mips/e32-rel2.d create mode 100644 gas/testsuite/gas/mips/e32-rel4.d create mode 100644 gas/testsuite/gas/mips/e32el-rel2.d create mode 100644 gas/testsuite/gas/mips/elempic.d create mode 100644 gas/testsuite/gas/mips/elf-consthilo.d create mode 100644 gas/testsuite/gas/mips/elf-consthilo.s create mode 100644 gas/testsuite/gas/mips/elf-jal.d create mode 100644 gas/testsuite/gas/mips/elf-rel-got-n32.d create mode 100644 gas/testsuite/gas/mips/elf-rel-got-n32.s create mode 100644 gas/testsuite/gas/mips/elf-rel-got-n64.d create mode 100644 gas/testsuite/gas/mips/elf-rel-got-n64.s create mode 100644 gas/testsuite/gas/mips/elf-rel-xgot-n32.d create mode 100644 gas/testsuite/gas/mips/elf-rel-xgot-n64.d create mode 100644 gas/testsuite/gas/mips/elf-rel.d create mode 100644 gas/testsuite/gas/mips/elf-rel.s create mode 100644 gas/testsuite/gas/mips/elf-rel10.d create mode 100644 gas/testsuite/gas/mips/elf-rel10.s create mode 100644 gas/testsuite/gas/mips/elf-rel11.d create mode 100644 gas/testsuite/gas/mips/elf-rel11.s create mode 100644 gas/testsuite/gas/mips/elf-rel12.d create mode 100644 gas/testsuite/gas/mips/elf-rel12.s create mode 100644 gas/testsuite/gas/mips/elf-rel13.d create mode 100644 gas/testsuite/gas/mips/elf-rel13.s create mode 100644 gas/testsuite/gas/mips/elf-rel14.d create mode 100644 gas/testsuite/gas/mips/elf-rel14.s create mode 100644 gas/testsuite/gas/mips/elf-rel15.d create mode 100644 gas/testsuite/gas/mips/elf-rel15.s create mode 100644 gas/testsuite/gas/mips/elf-rel16.d create mode 100644 gas/testsuite/gas/mips/elf-rel16.s create mode 100644 gas/testsuite/gas/mips/elf-rel17.d create mode 100644 gas/testsuite/gas/mips/elf-rel17.s create mode 100644 gas/testsuite/gas/mips/elf-rel18.d create mode 100644 gas/testsuite/gas/mips/elf-rel18.s create mode 100644 gas/testsuite/gas/mips/elf-rel19.d create mode 100644 gas/testsuite/gas/mips/elf-rel19.s create mode 100644 gas/testsuite/gas/mips/elf-rel2.d create mode 100644 gas/testsuite/gas/mips/elf-rel2.s create mode 100644 gas/testsuite/gas/mips/elf-rel3.d create mode 100644 gas/testsuite/gas/mips/elf-rel3.s create mode 100644 gas/testsuite/gas/mips/elf-rel4.d create mode 100644 gas/testsuite/gas/mips/elf-rel4.s create mode 100644 gas/testsuite/gas/mips/elf-rel5.d create mode 100644 gas/testsuite/gas/mips/elf-rel5.s create mode 100644 gas/testsuite/gas/mips/elf-rel6.d create mode 100644 gas/testsuite/gas/mips/elf-rel6.s create mode 100644 gas/testsuite/gas/mips/elf-rel7.d create mode 100644 gas/testsuite/gas/mips/elf-rel7.s create mode 100644 gas/testsuite/gas/mips/elf-rel8.d create mode 100644 gas/testsuite/gas/mips/elf-rel8.s create mode 100644 gas/testsuite/gas/mips/elf-rel9.d create mode 100644 gas/testsuite/gas/mips/elf-rel9.s create mode 100644 gas/testsuite/gas/mips/elf_arch_mips1.d create mode 100644 gas/testsuite/gas/mips/elf_arch_mips2.d create mode 100644 gas/testsuite/gas/mips/elf_arch_mips3.d create mode 100644 gas/testsuite/gas/mips/elf_arch_mips32.d create mode 100644 gas/testsuite/gas/mips/elf_arch_mips32r2.d create mode 100644 gas/testsuite/gas/mips/elf_arch_mips4.d create mode 100644 gas/testsuite/gas/mips/elf_arch_mips5.d create mode 100644 gas/testsuite/gas/mips/elf_arch_mips64.d create mode 100644 gas/testsuite/gas/mips/elf_arch_mips64r2.d create mode 100644 gas/testsuite/gas/mips/elf_ase_mips16.d create mode 100644 gas/testsuite/gas/mips/elf_e_flags.c create mode 100644 gas/testsuite/gas/mips/elf_e_flags.s create mode 100644 gas/testsuite/gas/mips/elf_e_flags1.d create mode 100644 gas/testsuite/gas/mips/elf_e_flags2.d create mode 100644 gas/testsuite/gas/mips/elf_e_flags3.d create mode 100644 gas/testsuite/gas/mips/elf_e_flags4.d create mode 100644 gas/testsuite/gas/mips/elfel-rel.d create mode 100644 gas/testsuite/gas/mips/elfel-rel2.d create mode 100644 gas/testsuite/gas/mips/elfel-rel3.d create mode 100644 gas/testsuite/gas/mips/empic.d create mode 100644 gas/testsuite/gas/mips/empic.l create mode 100644 gas/testsuite/gas/mips/empic.s create mode 100644 gas/testsuite/gas/mips/empic2.d create mode 100644 gas/testsuite/gas/mips/empic2.s create mode 100644 gas/testsuite/gas/mips/empic3_e.d create mode 100644 gas/testsuite/gas/mips/empic3_e.s create mode 100644 gas/testsuite/gas/mips/empic3_g1.d create mode 100644 gas/testsuite/gas/mips/empic3_g1.s create mode 100644 gas/testsuite/gas/mips/empic3_g2.d create mode 100644 gas/testsuite/gas/mips/empic3_g2.s create mode 100644 gas/testsuite/gas/mips/empty.s create mode 100644 gas/testsuite/gas/mips/expr1.d create mode 100644 gas/testsuite/gas/mips/expr1.s create mode 100644 gas/testsuite/gas/mips/fpr-names-32.d create mode 100644 gas/testsuite/gas/mips/fpr-names-64.d create mode 100644 gas/testsuite/gas/mips/fpr-names-n32.d create mode 100644 gas/testsuite/gas/mips/fpr-names-numeric.d create mode 100644 gas/testsuite/gas/mips/fpr-names.s create mode 100644 gas/testsuite/gas/mips/gpr-names-32.d create mode 100644 gas/testsuite/gas/mips/gpr-names-64.d create mode 100644 gas/testsuite/gas/mips/gpr-names-n32.d create mode 100644 gas/testsuite/gas/mips/gpr-names-numeric.d create mode 100644 gas/testsuite/gas/mips/gpr-names.s create mode 100644 gas/testsuite/gas/mips/hwr-names-mips32r2.d create mode 100644 gas/testsuite/gas/mips/hwr-names-mips64r2.d create mode 100644 gas/testsuite/gas/mips/hwr-names-numeric.d create mode 100644 gas/testsuite/gas/mips/hwr-names.s create mode 100644 gas/testsuite/gas/mips/illegal.l create mode 100644 gas/testsuite/gas/mips/illegal.s create mode 100644 gas/testsuite/gas/mips/itbl create mode 100644 gas/testsuite/gas/mips/itbl.s create mode 100644 gas/testsuite/gas/mips/jal-empic-elf-2.d create mode 100644 gas/testsuite/gas/mips/jal-empic-elf-2.s create mode 100644 gas/testsuite/gas/mips/jal-empic-elf-3.d create mode 100644 gas/testsuite/gas/mips/jal-empic-elf-3.s create mode 100644 gas/testsuite/gas/mips/jal-empic-elf.d create mode 100644 gas/testsuite/gas/mips/jal-empic.d create mode 100644 gas/testsuite/gas/mips/jal-newabi.d create mode 100644 gas/testsuite/gas/mips/jal-newabi.s create mode 100644 gas/testsuite/gas/mips/jal-range.l create mode 100644 gas/testsuite/gas/mips/jal-range.s create mode 100644 gas/testsuite/gas/mips/jal-svr4pic.d create mode 100644 gas/testsuite/gas/mips/jal-svr4pic.s create mode 100644 gas/testsuite/gas/mips/jal-xgot.d create mode 100644 gas/testsuite/gas/mips/jal.d create mode 100644 gas/testsuite/gas/mips/jal.s create mode 100644 gas/testsuite/gas/mips/la-empic.d create mode 100644 gas/testsuite/gas/mips/la-empic.s create mode 100644 gas/testsuite/gas/mips/la-svr4pic.d create mode 100644 gas/testsuite/gas/mips/la-xgot.d create mode 100644 gas/testsuite/gas/mips/la.d create mode 100644 gas/testsuite/gas/mips/la.s create mode 100644 gas/testsuite/gas/mips/lb-empic.d create mode 100644 gas/testsuite/gas/mips/lb-pic.s create mode 100644 gas/testsuite/gas/mips/lb-svr4pic.d create mode 100644 gas/testsuite/gas/mips/lb-xgot-ilocks.d create mode 100644 gas/testsuite/gas/mips/lb-xgot.d create mode 100644 gas/testsuite/gas/mips/lb.d create mode 100644 gas/testsuite/gas/mips/lb.s create mode 100644 gas/testsuite/gas/mips/lca-svr4pic.d create mode 100644 gas/testsuite/gas/mips/lca-xgot.d create mode 100644 gas/testsuite/gas/mips/lca.s create mode 100644 gas/testsuite/gas/mips/ld-empic.d create mode 100644 gas/testsuite/gas/mips/ld-ilocks-addr32.d create mode 100644 gas/testsuite/gas/mips/ld-ilocks.d create mode 100644 gas/testsuite/gas/mips/ld-pic.s create mode 100644 gas/testsuite/gas/mips/ld-svr4pic.d create mode 100644 gas/testsuite/gas/mips/ld-xgot.d create mode 100644 gas/testsuite/gas/mips/ld.d create mode 100644 gas/testsuite/gas/mips/ld.s create mode 100644 gas/testsuite/gas/mips/ldstla-32-shared.d create mode 100644 gas/testsuite/gas/mips/ldstla-32.d create mode 100644 gas/testsuite/gas/mips/ldstla-32.s create mode 100644 gas/testsuite/gas/mips/ldstla-n32-shared.d create mode 100644 gas/testsuite/gas/mips/ldstla-n32.d create mode 100644 gas/testsuite/gas/mips/ldstla-n32.s create mode 100644 gas/testsuite/gas/mips/ldstla-n64-shared.d create mode 100644 gas/testsuite/gas/mips/ldstla-n64.d create mode 100644 gas/testsuite/gas/mips/ldstla-n64.s create mode 100644 gas/testsuite/gas/mips/li.d create mode 100644 gas/testsuite/gas/mips/li.s create mode 100644 gas/testsuite/gas/mips/lif-empic.d create mode 100644 gas/testsuite/gas/mips/lif-svr4pic.d create mode 100644 gas/testsuite/gas/mips/lif-xgot.d create mode 100644 gas/testsuite/gas/mips/lifloat.d create mode 100644 gas/testsuite/gas/mips/lifloat.s create mode 100644 gas/testsuite/gas/mips/lineno.d create mode 100644 gas/testsuite/gas/mips/lineno.s create mode 100644 gas/testsuite/gas/mips/macro-warn-1-n32.d create mode 100644 gas/testsuite/gas/mips/macro-warn-1-n32.l create mode 100644 gas/testsuite/gas/mips/macro-warn-1.d create mode 100644 gas/testsuite/gas/mips/macro-warn-1.l create mode 100644 gas/testsuite/gas/mips/macro-warn-1.s create mode 100644 gas/testsuite/gas/mips/macro-warn-2-n32.d create mode 100644 gas/testsuite/gas/mips/macro-warn-2.d create mode 100644 gas/testsuite/gas/mips/macro-warn-2.l create mode 100644 gas/testsuite/gas/mips/macro-warn-2.s create mode 100644 gas/testsuite/gas/mips/macro-warn-3.d create mode 100644 gas/testsuite/gas/mips/macro-warn-3.l create mode 100644 gas/testsuite/gas/mips/macro-warn-3.s create mode 100644 gas/testsuite/gas/mips/macro-warn-4.d create mode 100644 gas/testsuite/gas/mips/macro-warn-4.l create mode 100644 gas/testsuite/gas/mips/macro-warn-4.s create mode 100644 gas/testsuite/gas/mips/mips-abi32-pic.d create mode 100644 gas/testsuite/gas/mips/mips-abi32-pic.s create mode 100644 gas/testsuite/gas/mips/mips-abi32-pic2.d create mode 100644 gas/testsuite/gas/mips/mips-abi32-pic2.s create mode 100644 gas/testsuite/gas/mips/mips-abi32.d create mode 100644 gas/testsuite/gas/mips/mips-abi32.s create mode 100644 gas/testsuite/gas/mips/mips-gp32-fp32-pic.d create mode 100644 gas/testsuite/gas/mips/mips-gp32-fp32-pic.s create mode 100644 gas/testsuite/gas/mips/mips-gp32-fp32.d create mode 100644 gas/testsuite/gas/mips/mips-gp32-fp32.s create mode 100644 gas/testsuite/gas/mips/mips-gp32-fp64-pic.d create mode 100644 gas/testsuite/gas/mips/mips-gp32-fp64-pic.s create mode 100644 gas/testsuite/gas/mips/mips-gp32-fp64.d create mode 100644 gas/testsuite/gas/mips/mips-gp32-fp64.s create mode 100644 gas/testsuite/gas/mips/mips-gp64-fp32-pic.d create mode 100644 gas/testsuite/gas/mips/mips-gp64-fp32-pic.s create mode 100644 gas/testsuite/gas/mips/mips-gp64-fp32.d create mode 100644 gas/testsuite/gas/mips/mips-gp64-fp32.l create mode 100644 gas/testsuite/gas/mips/mips-gp64-fp32.s create mode 100644 gas/testsuite/gas/mips/mips-gp64-fp64-pic.d create mode 100644 gas/testsuite/gas/mips/mips-gp64-fp64-pic.s create mode 100644 gas/testsuite/gas/mips/mips-gp64-fp64.d create mode 100644 gas/testsuite/gas/mips/mips-gp64-fp64.l create mode 100644 gas/testsuite/gas/mips/mips-gp64-fp64.s create mode 100644 gas/testsuite/gas/mips/mips-jalx.d create mode 100644 gas/testsuite/gas/mips/mips-jalx.s create mode 100644 gas/testsuite/gas/mips/mips-no-jalx.l create mode 100644 gas/testsuite/gas/mips/mips-no-jalx.s create mode 100644 gas/testsuite/gas/mips/mips.exp create mode 100644 gas/testsuite/gas/mips/mips16-64.d create mode 100644 gas/testsuite/gas/mips/mips16-e.d create mode 100644 gas/testsuite/gas/mips/mips16-e.s create mode 100644 gas/testsuite/gas/mips/mips16-f.d create mode 100644 gas/testsuite/gas/mips/mips16-f.s create mode 100644 gas/testsuite/gas/mips/mips16-jalx.d create mode 100644 gas/testsuite/gas/mips/mips16-jalx.s create mode 100644 gas/testsuite/gas/mips/mips16.d create mode 100644 gas/testsuite/gas/mips/mips16.s create mode 100644 gas/testsuite/gas/mips/mips32.d create mode 100644 gas/testsuite/gas/mips/mips32.s create mode 100644 gas/testsuite/gas/mips/mips32r2-ill-fp64.l create mode 100644 gas/testsuite/gas/mips/mips32r2-ill-fp64.s create mode 100644 gas/testsuite/gas/mips/mips32r2-ill.l create mode 100644 gas/testsuite/gas/mips/mips32r2-ill.s create mode 100644 gas/testsuite/gas/mips/mips32r2.d create mode 100644 gas/testsuite/gas/mips/mips32r2.s create mode 100644 gas/testsuite/gas/mips/mips4.d create mode 100644 gas/testsuite/gas/mips/mips4.s create mode 100644 gas/testsuite/gas/mips/mips4010.d create mode 100644 gas/testsuite/gas/mips/mips4010.s create mode 100644 gas/testsuite/gas/mips/mips4100.d create mode 100644 gas/testsuite/gas/mips/mips4100.s create mode 100644 gas/testsuite/gas/mips/mips4650.d create mode 100644 gas/testsuite/gas/mips/mips4650.s create mode 100644 gas/testsuite/gas/mips/mips5.d create mode 100644 gas/testsuite/gas/mips/mips5.l create mode 100644 gas/testsuite/gas/mips/mips5.s create mode 100644 gas/testsuite/gas/mips/mips64-mdmx.d create mode 100644 gas/testsuite/gas/mips/mips64-mdmx.s create mode 100644 gas/testsuite/gas/mips/mips64-mips3d-incl.d create mode 100644 gas/testsuite/gas/mips/mips64-mips3d.d create mode 100644 gas/testsuite/gas/mips/mips64-mips3d.l create mode 100644 gas/testsuite/gas/mips/mips64-mips3d.s create mode 100644 gas/testsuite/gas/mips/mips64.d create mode 100644 gas/testsuite/gas/mips/mips64.s create mode 100644 gas/testsuite/gas/mips/mips64r2-ill.l create mode 100644 gas/testsuite/gas/mips/mips64r2-ill.s create mode 100644 gas/testsuite/gas/mips/mips64r2.d create mode 100644 gas/testsuite/gas/mips/mips64r2.s create mode 100644 gas/testsuite/gas/mips/mipsel16-e.d create mode 100644 gas/testsuite/gas/mips/mipsel16-f.d create mode 100644 gas/testsuite/gas/mips/mul-ilocks.d create mode 100644 gas/testsuite/gas/mips/mul.d create mode 100644 gas/testsuite/gas/mips/mul.s create mode 100644 gas/testsuite/gas/mips/n32-consec.d create mode 100644 gas/testsuite/gas/mips/n32-consec.s create mode 100644 gas/testsuite/gas/mips/nodelay.d create mode 100644 gas/testsuite/gas/mips/perfcount.d create mode 100644 gas/testsuite/gas/mips/perfcount.s create mode 100644 gas/testsuite/gas/mips/relax-swap1-mips1.d create mode 100644 gas/testsuite/gas/mips/relax-swap1-mips2.d create mode 100644 gas/testsuite/gas/mips/relax-swap1.l create mode 100644 gas/testsuite/gas/mips/relax-swap1.s create mode 100644 gas/testsuite/gas/mips/relax-swap2.d create mode 100644 gas/testsuite/gas/mips/relax-swap2.l create mode 100644 gas/testsuite/gas/mips/relax-swap2.s create mode 100644 gas/testsuite/gas/mips/relax.d create mode 100644 gas/testsuite/gas/mips/relax.l create mode 100644 gas/testsuite/gas/mips/relax.s create mode 100644 gas/testsuite/gas/mips/rm7000.d create mode 100644 gas/testsuite/gas/mips/rm7000.s create mode 100644 gas/testsuite/gas/mips/rol-hw.d create mode 100644 gas/testsuite/gas/mips/rol-hw.l create mode 100644 gas/testsuite/gas/mips/rol.d create mode 100644 gas/testsuite/gas/mips/rol.l create mode 100644 gas/testsuite/gas/mips/rol.s create mode 100644 gas/testsuite/gas/mips/rol64-hw.d create mode 100644 gas/testsuite/gas/mips/rol64-hw.l create mode 100644 gas/testsuite/gas/mips/rol64.d create mode 100644 gas/testsuite/gas/mips/rol64.l create mode 100644 gas/testsuite/gas/mips/rol64.s create mode 100644 gas/testsuite/gas/mips/sb.d create mode 100644 gas/testsuite/gas/mips/sb.s create mode 100644 gas/testsuite/gas/mips/sb1-ext-mdmx.d create mode 100644 gas/testsuite/gas/mips/sb1-ext-mdmx.s create mode 100644 gas/testsuite/gas/mips/sb1-ext-ps.d create mode 100644 gas/testsuite/gas/mips/sb1-ext-ps.s create mode 100644 gas/testsuite/gas/mips/set-arch.d create mode 100644 gas/testsuite/gas/mips/set-arch.l create mode 100644 gas/testsuite/gas/mips/set-arch.s create mode 100644 gas/testsuite/gas/mips/sync.d create mode 100644 gas/testsuite/gas/mips/sync.s create mode 100644 gas/testsuite/gas/mips/telempic.d create mode 100644 gas/testsuite/gas/mips/tempic.d create mode 100644 gas/testsuite/gas/mips/tmips16-e.d create mode 100644 gas/testsuite/gas/mips/tmips16-f.d create mode 100644 gas/testsuite/gas/mips/tmipsel16-e.d create mode 100644 gas/testsuite/gas/mips/tmipsel16-f.d create mode 100644 gas/testsuite/gas/mips/trap20.d create mode 100644 gas/testsuite/gas/mips/trap20.s create mode 100644 gas/testsuite/gas/mips/trunc.d create mode 100644 gas/testsuite/gas/mips/trunc.s create mode 100644 gas/testsuite/gas/mips/uld.d create mode 100644 gas/testsuite/gas/mips/uld.s create mode 100644 gas/testsuite/gas/mips/uld2-eb.d create mode 100644 gas/testsuite/gas/mips/uld2-el.d create mode 100644 gas/testsuite/gas/mips/uld2.l create mode 100644 gas/testsuite/gas/mips/uld2.s create mode 100644 gas/testsuite/gas/mips/ulh-empic.d create mode 100644 gas/testsuite/gas/mips/ulh-pic.s create mode 100644 gas/testsuite/gas/mips/ulh-svr4pic.d create mode 100644 gas/testsuite/gas/mips/ulh-xgot.d create mode 100644 gas/testsuite/gas/mips/ulh.d create mode 100644 gas/testsuite/gas/mips/ulh.s create mode 100644 gas/testsuite/gas/mips/ulh2-eb.d create mode 100644 gas/testsuite/gas/mips/ulh2-el.d create mode 100644 gas/testsuite/gas/mips/ulh2.l create mode 100644 gas/testsuite/gas/mips/ulh2.s create mode 100644 gas/testsuite/gas/mips/ulw.d create mode 100644 gas/testsuite/gas/mips/ulw.s create mode 100644 gas/testsuite/gas/mips/ulw2-eb-ilocks.d create mode 100644 gas/testsuite/gas/mips/ulw2-eb.d create mode 100644 gas/testsuite/gas/mips/ulw2-el-ilocks.d create mode 100644 gas/testsuite/gas/mips/ulw2-el.d create mode 100644 gas/testsuite/gas/mips/ulw2.l create mode 100644 gas/testsuite/gas/mips/ulw2.s create mode 100644 gas/testsuite/gas/mips/usd.d create mode 100644 gas/testsuite/gas/mips/usd.s create mode 100644 gas/testsuite/gas/mips/ush.d create mode 100644 gas/testsuite/gas/mips/ush.s create mode 100644 gas/testsuite/gas/mips/usw.d create mode 100644 gas/testsuite/gas/mips/usw.s create mode 100644 gas/testsuite/gas/mips/vr4111.d create mode 100644 gas/testsuite/gas/mips/vr4111.s create mode 100644 gas/testsuite/gas/mips/vr4120.d create mode 100644 gas/testsuite/gas/mips/vr4120.s create mode 100644 gas/testsuite/gas/mips/vr4122.d create mode 100644 gas/testsuite/gas/mips/vr4122.s create mode 100644 gas/testsuite/gas/mips/vr5400.d create mode 100644 gas/testsuite/gas/mips/vr5400.s create mode 100644 gas/testsuite/gas/mips/vr5500.d create mode 100644 gas/testsuite/gas/mips/vr5500.s create mode 100644 gas/testsuite/gas/mmix/1cjmp1b-n.d create mode 100644 gas/testsuite/gas/mmix/1cjmp1b-r.d create mode 100644 gas/testsuite/gas/mmix/1cjmp1b.d create mode 100644 gas/testsuite/gas/mmix/1cjmp1b.l create mode 100644 gas/testsuite/gas/mmix/1cjmp1b.s create mode 100644 gas/testsuite/gas/mmix/1cjmp1brn.d create mode 100644 gas/testsuite/gas/mmix/1hjmp1b.d create mode 100644 gas/testsuite/gas/mmix/1hjmp1b.l create mode 100644 gas/testsuite/gas/mmix/1hjmp1b.s create mode 100644 gas/testsuite/gas/mmix/align-1.d create mode 100644 gas/testsuite/gas/mmix/align-1.s create mode 100644 gas/testsuite/gas/mmix/basep-1.d create mode 100644 gas/testsuite/gas/mmix/basep-1.s create mode 100644 gas/testsuite/gas/mmix/basep-10.d create mode 100644 gas/testsuite/gas/mmix/basep-10.s create mode 100644 gas/testsuite/gas/mmix/basep-11.d create mode 100644 gas/testsuite/gas/mmix/basep-11.s create mode 100644 gas/testsuite/gas/mmix/basep-1b.d create mode 100644 gas/testsuite/gas/mmix/basep-2.d create mode 100644 gas/testsuite/gas/mmix/basep-2.s create mode 100644 gas/testsuite/gas/mmix/basep-2b.d create mode 100644 gas/testsuite/gas/mmix/basep-3.d create mode 100644 gas/testsuite/gas/mmix/basep-3.s create mode 100644 gas/testsuite/gas/mmix/basep-3b.d create mode 100644 gas/testsuite/gas/mmix/basep-4.d create mode 100644 gas/testsuite/gas/mmix/basep-5.d create mode 100644 gas/testsuite/gas/mmix/basep-6.d create mode 100644 gas/testsuite/gas/mmix/basep-7.d create mode 100644 gas/testsuite/gas/mmix/basep-8.d create mode 100644 gas/testsuite/gas/mmix/basep-8.s create mode 100644 gas/testsuite/gas/mmix/basep-9.d create mode 100644 gas/testsuite/gas/mmix/basep-9.s create mode 100644 gas/testsuite/gas/mmix/bspec-1.d create mode 100644 gas/testsuite/gas/mmix/bspec-1.s create mode 100644 gas/testsuite/gas/mmix/bspec-2.d create mode 100644 gas/testsuite/gas/mmix/bspec-2.s create mode 100644 gas/testsuite/gas/mmix/builtin1.d create mode 100644 gas/testsuite/gas/mmix/builtin1.s create mode 100644 gas/testsuite/gas/mmix/builtin2.d create mode 100644 gas/testsuite/gas/mmix/builtin3.d create mode 100644 gas/testsuite/gas/mmix/byte-1.d create mode 100644 gas/testsuite/gas/mmix/byte-1.s create mode 100644 gas/testsuite/gas/mmix/bz-c.d create mode 100644 gas/testsuite/gas/mmix/bz-c.s create mode 100644 gas/testsuite/gas/mmix/comment-1.d create mode 100644 gas/testsuite/gas/mmix/comment-1.s create mode 100644 gas/testsuite/gas/mmix/comment-2.d create mode 100644 gas/testsuite/gas/mmix/comment-2.s create mode 100644 gas/testsuite/gas/mmix/comment-3.d create mode 100644 gas/testsuite/gas/mmix/comment-3.s create mode 100644 gas/testsuite/gas/mmix/cons-1.d create mode 100644 gas/testsuite/gas/mmix/cons-1.s create mode 100644 gas/testsuite/gas/mmix/cons-2.d create mode 100644 gas/testsuite/gas/mmix/cons-2.s create mode 100644 gas/testsuite/gas/mmix/err-bpo1.s create mode 100644 gas/testsuite/gas/mmix/err-bpo2.s create mode 100644 gas/testsuite/gas/mmix/err-bpo3.s create mode 100644 gas/testsuite/gas/mmix/err-bpo4.s create mode 100644 gas/testsuite/gas/mmix/err-bpo5.s create mode 100644 gas/testsuite/gas/mmix/err-bpo6.s create mode 100644 gas/testsuite/gas/mmix/err-bspec-1.s create mode 100644 gas/testsuite/gas/mmix/err-bspec-2.s create mode 100644 gas/testsuite/gas/mmix/err-bspec-3.s create mode 100644 gas/testsuite/gas/mmix/err-bspec-4.s create mode 100644 gas/testsuite/gas/mmix/err-bspec-5.s create mode 100644 gas/testsuite/gas/mmix/err-builtin.s create mode 100644 gas/testsuite/gas/mmix/err-byte1.s create mode 100644 gas/testsuite/gas/mmix/err-byte2.s create mode 100644 gas/testsuite/gas/mmix/err-case.s create mode 100644 gas/testsuite/gas/mmix/err-fb-1.s create mode 100644 gas/testsuite/gas/mmix/err-greg1.s create mode 100644 gas/testsuite/gas/mmix/err-insn.s create mode 100644 gas/testsuite/gas/mmix/err-is-1.s create mode 100644 gas/testsuite/gas/mmix/err-loc-1.s create mode 100644 gas/testsuite/gas/mmix/err-loc-2.s create mode 100644 gas/testsuite/gas/mmix/err-loc-3.s create mode 100644 gas/testsuite/gas/mmix/err-loc-4.s create mode 100644 gas/testsuite/gas/mmix/err-loc-5.s create mode 100644 gas/testsuite/gas/mmix/err-loc-6.s create mode 100644 gas/testsuite/gas/mmix/err-loc-7.s create mode 100644 gas/testsuite/gas/mmix/err-loc-8.s create mode 100644 gas/testsuite/gas/mmix/err-local1.s create mode 100644 gas/testsuite/gas/mmix/err-local2.s create mode 100644 gas/testsuite/gas/mmix/err-ser-1.s create mode 100644 gas/testsuite/gas/mmix/err-set.s create mode 100644 gas/testsuite/gas/mmix/expr-1.d create mode 100644 gas/testsuite/gas/mmix/expr-1.s create mode 100644 gas/testsuite/gas/mmix/fb-1.d create mode 100644 gas/testsuite/gas/mmix/fb-1.s create mode 100644 gas/testsuite/gas/mmix/fb-2.d create mode 100644 gas/testsuite/gas/mmix/fb-2.s create mode 100644 gas/testsuite/gas/mmix/get-op-r.d create mode 100644 gas/testsuite/gas/mmix/get-op.d create mode 100644 gas/testsuite/gas/mmix/get-op.l create mode 100644 gas/testsuite/gas/mmix/get-op.s create mode 100644 gas/testsuite/gas/mmix/geta-c.d create mode 100644 gas/testsuite/gas/mmix/geta-c.s create mode 100644 gas/testsuite/gas/mmix/geta-op-r.d create mode 100644 gas/testsuite/gas/mmix/geta-op.d create mode 100644 gas/testsuite/gas/mmix/geta-op.l create mode 100644 gas/testsuite/gas/mmix/geta-op.s create mode 100644 gas/testsuite/gas/mmix/geta-opn.d create mode 100644 gas/testsuite/gas/mmix/geta-oprn.d create mode 100644 gas/testsuite/gas/mmix/greg1.d create mode 100644 gas/testsuite/gas/mmix/greg1.s create mode 100644 gas/testsuite/gas/mmix/greg1a.d create mode 100644 gas/testsuite/gas/mmix/greg2.d create mode 100644 gas/testsuite/gas/mmix/greg2.s create mode 100644 gas/testsuite/gas/mmix/greg2a.d create mode 100644 gas/testsuite/gas/mmix/greg3.d create mode 100644 gas/testsuite/gas/mmix/greg3.s create mode 100644 gas/testsuite/gas/mmix/greg4.d create mode 100644 gas/testsuite/gas/mmix/greg4.s create mode 100644 gas/testsuite/gas/mmix/greg5.d create mode 100644 gas/testsuite/gas/mmix/greg5.s create mode 100644 gas/testsuite/gas/mmix/greg6.d create mode 100644 gas/testsuite/gas/mmix/greg6.s create mode 100644 gas/testsuite/gas/mmix/greg7.d create mode 100644 gas/testsuite/gas/mmix/greg7.s create mode 100644 gas/testsuite/gas/mmix/greg8.d create mode 100644 gas/testsuite/gas/mmix/greg8.s create mode 100644 gas/testsuite/gas/mmix/greg9.d create mode 100644 gas/testsuite/gas/mmix/greg9.s create mode 100644 gas/testsuite/gas/mmix/hex-r.d create mode 100644 gas/testsuite/gas/mmix/hex.d create mode 100644 gas/testsuite/gas/mmix/hex.l create mode 100644 gas/testsuite/gas/mmix/hex.s create mode 100644 gas/testsuite/gas/mmix/is-1.d create mode 100644 gas/testsuite/gas/mmix/is-1.s create mode 100644 gas/testsuite/gas/mmix/jmp-op-n.d create mode 100644 gas/testsuite/gas/mmix/jmp-op-r.d create mode 100644 gas/testsuite/gas/mmix/jmp-op.d create mode 100644 gas/testsuite/gas/mmix/jmp-op.l create mode 100644 gas/testsuite/gas/mmix/jmp-op.s create mode 100644 gas/testsuite/gas/mmix/jmp-oprn.d create mode 100644 gas/testsuite/gas/mmix/jump-c.d create mode 100644 gas/testsuite/gas/mmix/jump-c.s create mode 100644 gas/testsuite/gas/mmix/list-in-n.d create mode 100644 gas/testsuite/gas/mmix/list-in-r.d create mode 100644 gas/testsuite/gas/mmix/list-in-rn.d create mode 100644 gas/testsuite/gas/mmix/list-insns.d create mode 100644 gas/testsuite/gas/mmix/list-insns.l create mode 100644 gas/testsuite/gas/mmix/list-insns.s create mode 100644 gas/testsuite/gas/mmix/list-pseudoints.l create mode 100644 gas/testsuite/gas/mmix/list-pseudoints.s create mode 100644 gas/testsuite/gas/mmix/list-textfirst create mode 100644 gas/testsuite/gas/mmix/list-textfirst.l create mode 100644 gas/testsuite/gas/mmix/list-textfirst.s create mode 100644 gas/testsuite/gas/mmix/loc-1.d create mode 100644 gas/testsuite/gas/mmix/loc-1.s create mode 100644 gas/testsuite/gas/mmix/loc-2.d create mode 100644 gas/testsuite/gas/mmix/loc-2.s create mode 100644 gas/testsuite/gas/mmix/loc-3.d create mode 100644 gas/testsuite/gas/mmix/loc-3.s create mode 100644 gas/testsuite/gas/mmix/loc-4.d create mode 100644 gas/testsuite/gas/mmix/loc-4.s create mode 100644 gas/testsuite/gas/mmix/loc-5.d create mode 100644 gas/testsuite/gas/mmix/loc-5.s create mode 100644 gas/testsuite/gas/mmix/local-1.d create mode 100644 gas/testsuite/gas/mmix/local-1.s create mode 100644 gas/testsuite/gas/mmix/locall1.d create mode 100644 gas/testsuite/gas/mmix/locall1.s create mode 100644 gas/testsuite/gas/mmix/mmix-err.exp create mode 100644 gas/testsuite/gas/mmix/mmix-list.exp create mode 100644 gas/testsuite/gas/mmix/mmix.exp create mode 100644 gas/testsuite/gas/mmix/odd-1.d create mode 100644 gas/testsuite/gas/mmix/odd-1.s create mode 100644 gas/testsuite/gas/mmix/op-0-1.d create mode 100644 gas/testsuite/gas/mmix/op-0-1.s create mode 100644 gas/testsuite/gas/mmix/op-0-1s.d create mode 100644 gas/testsuite/gas/mmix/op-0-2.d create mode 100644 gas/testsuite/gas/mmix/pop-op-r.d create mode 100644 gas/testsuite/gas/mmix/pop-op.d create mode 100644 gas/testsuite/gas/mmix/pop-op.l create mode 100644 gas/testsuite/gas/mmix/pop-op.s create mode 100644 gas/testsuite/gas/mmix/prefix1.d create mode 100644 gas/testsuite/gas/mmix/prefix1.s create mode 100644 gas/testsuite/gas/mmix/prefix2.d create mode 100644 gas/testsuite/gas/mmix/prefix2.s create mode 100644 gas/testsuite/gas/mmix/prefix3.d create mode 100644 gas/testsuite/gas/mmix/prefix3.s create mode 100644 gas/testsuite/gas/mmix/pseudo-1.d create mode 100644 gas/testsuite/gas/mmix/pseudo-1.s create mode 100644 gas/testsuite/gas/mmix/pushgo-op-r.d create mode 100644 gas/testsuite/gas/mmix/pushgo-op.d create mode 100644 gas/testsuite/gas/mmix/pushgo-op.l create mode 100644 gas/testsuite/gas/mmix/pushgo-op.s create mode 100644 gas/testsuite/gas/mmix/pushj-c.d create mode 100644 gas/testsuite/gas/mmix/pushj-c.s create mode 100644 gas/testsuite/gas/mmix/pushj-cs.d create mode 100644 gas/testsuite/gas/mmix/put-op-r.d create mode 100644 gas/testsuite/gas/mmix/put-op.d create mode 100644 gas/testsuite/gas/mmix/put-op.l create mode 100644 gas/testsuite/gas/mmix/put-op.s create mode 100644 gas/testsuite/gas/mmix/reg-op-r.d create mode 100644 gas/testsuite/gas/mmix/reg-op.d create mode 100644 gas/testsuite/gas/mmix/reg-op.l create mode 100644 gas/testsuite/gas/mmix/reg-op.s create mode 100644 gas/testsuite/gas/mmix/reg3-op-r.d create mode 100644 gas/testsuite/gas/mmix/reg3-op.d create mode 100644 gas/testsuite/gas/mmix/reg3-op.l create mode 100644 gas/testsuite/gas/mmix/reg3-op.s create mode 100644 gas/testsuite/gas/mmix/regt-op-r.d create mode 100644 gas/testsuite/gas/mmix/regt-op.d create mode 100644 gas/testsuite/gas/mmix/regt-op.l create mode 100644 gas/testsuite/gas/mmix/regt-op.s create mode 100644 gas/testsuite/gas/mmix/regx-op-r.d create mode 100644 gas/testsuite/gas/mmix/regx-op.d create mode 100644 gas/testsuite/gas/mmix/regx-op.l create mode 100644 gas/testsuite/gas/mmix/regx-op.s create mode 100644 gas/testsuite/gas/mmix/regy-op-r.d create mode 100644 gas/testsuite/gas/mmix/regy-op.d create mode 100644 gas/testsuite/gas/mmix/regy-op.l create mode 100644 gas/testsuite/gas/mmix/regy-op.s create mode 100644 gas/testsuite/gas/mmix/relax1-n.d create mode 100644 gas/testsuite/gas/mmix/relax1-r.d create mode 100644 gas/testsuite/gas/mmix/relax1-rn.d create mode 100644 gas/testsuite/gas/mmix/relax1.d create mode 100644 gas/testsuite/gas/mmix/relax1.l create mode 100644 gas/testsuite/gas/mmix/relax1.s create mode 100644 gas/testsuite/gas/mmix/relax2.d create mode 100644 gas/testsuite/gas/mmix/relax2.s create mode 100644 gas/testsuite/gas/mmix/reloc16-n.d create mode 100644 gas/testsuite/gas/mmix/reloc16-r.d create mode 100644 gas/testsuite/gas/mmix/reloc16.d create mode 100644 gas/testsuite/gas/mmix/reloc16.l create mode 100644 gas/testsuite/gas/mmix/reloc16.s create mode 100644 gas/testsuite/gas/mmix/reloc8-r.d create mode 100644 gas/testsuite/gas/mmix/reloc8.d create mode 100644 gas/testsuite/gas/mmix/reloc8.l create mode 100644 gas/testsuite/gas/mmix/reloc8.s create mode 100644 gas/testsuite/gas/mmix/relocl-n.d create mode 100644 gas/testsuite/gas/mmix/reloclab-r.d create mode 100644 gas/testsuite/gas/mmix/reloclab-rs.d create mode 100644 gas/testsuite/gas/mmix/reloclab-s.d create mode 100644 gas/testsuite/gas/mmix/reloclab.d create mode 100644 gas/testsuite/gas/mmix/reloclab.l create mode 100644 gas/testsuite/gas/mmix/reloclab.s create mode 100644 gas/testsuite/gas/mmix/reloclrn.d create mode 100644 gas/testsuite/gas/mmix/relocxrn.d create mode 100644 gas/testsuite/gas/mmix/resume-op-r.d create mode 100644 gas/testsuite/gas/mmix/resume-op.d create mode 100644 gas/testsuite/gas/mmix/resume-op.l create mode 100644 gas/testsuite/gas/mmix/resume-op.s create mode 100644 gas/testsuite/gas/mmix/round2-op-r.d create mode 100644 gas/testsuite/gas/mmix/round2-op.d create mode 100644 gas/testsuite/gas/mmix/round2-op.l create mode 100644 gas/testsuite/gas/mmix/round2-op.s create mode 100644 gas/testsuite/gas/mmix/roundi-op-r.d create mode 100644 gas/testsuite/gas/mmix/roundi-op.d create mode 100644 gas/testsuite/gas/mmix/roundi-op.l create mode 100644 gas/testsuite/gas/mmix/roundi-op.s create mode 100644 gas/testsuite/gas/mmix/roundr-op-r.d create mode 100644 gas/testsuite/gas/mmix/roundr-op.d create mode 100644 gas/testsuite/gas/mmix/roundr-op.l create mode 100644 gas/testsuite/gas/mmix/roundr-op.s create mode 100644 gas/testsuite/gas/mmix/save-op-r.d create mode 100644 gas/testsuite/gas/mmix/save-op.d create mode 100644 gas/testsuite/gas/mmix/save-op.l create mode 100644 gas/testsuite/gas/mmix/save-op.s create mode 100644 gas/testsuite/gas/mmix/set-r.d create mode 100644 gas/testsuite/gas/mmix/set.d create mode 100644 gas/testsuite/gas/mmix/set.l create mode 100644 gas/testsuite/gas/mmix/set.s create mode 100644 gas/testsuite/gas/mmix/swym-op-r.d create mode 100644 gas/testsuite/gas/mmix/swym-op.d create mode 100644 gas/testsuite/gas/mmix/swym-op.l create mode 100644 gas/testsuite/gas/mmix/swym-op.s create mode 100644 gas/testsuite/gas/mmix/sym-1.d create mode 100644 gas/testsuite/gas/mmix/sym-1.s create mode 100644 gas/testsuite/gas/mmix/sync-op-r.d create mode 100644 gas/testsuite/gas/mmix/sync-op.d create mode 100644 gas/testsuite/gas/mmix/sync-op.l create mode 100644 gas/testsuite/gas/mmix/sync-op.s create mode 100644 gas/testsuite/gas/mmix/two-op-r.d create mode 100644 gas/testsuite/gas/mmix/two-op.d create mode 100644 gas/testsuite/gas/mmix/two-op.l create mode 100644 gas/testsuite/gas/mmix/two-op.s create mode 100644 gas/testsuite/gas/mmix/unsave-op-r.d create mode 100644 gas/testsuite/gas/mmix/unsave-op.d create mode 100644 gas/testsuite/gas/mmix/unsave-op.l create mode 100644 gas/testsuite/gas/mmix/unsave-op.s create mode 100644 gas/testsuite/gas/mmix/weak1-s.d create mode 100644 gas/testsuite/gas/mmix/weak1.d create mode 100644 gas/testsuite/gas/mmix/weak1.s create mode 100644 gas/testsuite/gas/mmix/zerop-1.d create mode 100644 gas/testsuite/gas/mmix/zerop-1.s create mode 100644 gas/testsuite/gas/mn10200/add.s create mode 100644 gas/testsuite/gas/mn10200/basic.exp create mode 100644 gas/testsuite/gas/mn10200/bcc.s create mode 100644 gas/testsuite/gas/mn10200/bccx.s create mode 100644 gas/testsuite/gas/mn10200/bit.s create mode 100644 gas/testsuite/gas/mn10200/cmp.s create mode 100644 gas/testsuite/gas/mn10200/ext.s create mode 100644 gas/testsuite/gas/mn10200/logical.s create mode 100644 gas/testsuite/gas/mn10200/mov1.s create mode 100644 gas/testsuite/gas/mn10200/mov2.s create mode 100644 gas/testsuite/gas/mn10200/mov3.s create mode 100644 gas/testsuite/gas/mn10200/mov4.s create mode 100644 gas/testsuite/gas/mn10200/movb.s create mode 100644 gas/testsuite/gas/mn10200/movbu.s create mode 100644 gas/testsuite/gas/mn10200/movx.s create mode 100644 gas/testsuite/gas/mn10200/muldiv.s create mode 100644 gas/testsuite/gas/mn10200/other.s create mode 100644 gas/testsuite/gas/mn10200/shift.s create mode 100644 gas/testsuite/gas/mn10200/sub.s create mode 100644 gas/testsuite/gas/mn10300/add.s create mode 100644 gas/testsuite/gas/mn10300/am33-2.c create mode 100644 gas/testsuite/gas/mn10300/am33-2.d create mode 100644 gas/testsuite/gas/mn10300/am33-2.s create mode 100644 gas/testsuite/gas/mn10300/am33.s create mode 100644 gas/testsuite/gas/mn10300/am33_2.s create mode 100644 gas/testsuite/gas/mn10300/am33_3.s create mode 100644 gas/testsuite/gas/mn10300/am33_4.s create mode 100644 gas/testsuite/gas/mn10300/am33_5.s create mode 100644 gas/testsuite/gas/mn10300/am33_6.s create mode 100644 gas/testsuite/gas/mn10300/am33_7.s create mode 100644 gas/testsuite/gas/mn10300/am33_8.s create mode 100644 gas/testsuite/gas/mn10300/basic.exp create mode 100644 gas/testsuite/gas/mn10300/bcc.s create mode 100644 gas/testsuite/gas/mn10300/bit.s create mode 100644 gas/testsuite/gas/mn10300/cmp.s create mode 100644 gas/testsuite/gas/mn10300/ext.s create mode 100644 gas/testsuite/gas/mn10300/extend.s create mode 100644 gas/testsuite/gas/mn10300/logical.s create mode 100644 gas/testsuite/gas/mn10300/loop.s create mode 100644 gas/testsuite/gas/mn10300/mov1.s create mode 100644 gas/testsuite/gas/mn10300/mov2.s create mode 100644 gas/testsuite/gas/mn10300/mov3.s create mode 100644 gas/testsuite/gas/mn10300/mov4.s create mode 100644 gas/testsuite/gas/mn10300/mov5.s create mode 100644 gas/testsuite/gas/mn10300/movbu.s create mode 100644 gas/testsuite/gas/mn10300/movhu.s create mode 100644 gas/testsuite/gas/mn10300/movm.s create mode 100644 gas/testsuite/gas/mn10300/movpc.l create mode 100644 gas/testsuite/gas/mn10300/movpc.s create mode 100644 gas/testsuite/gas/mn10300/muldiv.s create mode 100644 gas/testsuite/gas/mn10300/other.s create mode 100644 gas/testsuite/gas/mn10300/shift.s create mode 100644 gas/testsuite/gas/mn10300/sub.s create mode 100644 gas/testsuite/gas/mn10300/udf.s create mode 100644 gas/testsuite/gas/mri/char.d create mode 100644 gas/testsuite/gas/mri/char.s create mode 100644 gas/testsuite/gas/mri/comment.d create mode 100644 gas/testsuite/gas/mri/comment.s create mode 100644 gas/testsuite/gas/mri/common.d create mode 100644 gas/testsuite/gas/mri/common.s create mode 100644 gas/testsuite/gas/mri/constants.d create mode 100644 gas/testsuite/gas/mri/constants.s create mode 100644 gas/testsuite/gas/mri/empty.s create mode 100644 gas/testsuite/gas/mri/equ.d create mode 100644 gas/testsuite/gas/mri/equ.s create mode 100644 gas/testsuite/gas/mri/expr.d create mode 100644 gas/testsuite/gas/mri/expr.s create mode 100644 gas/testsuite/gas/mri/float.d create mode 100644 gas/testsuite/gas/mri/float.s create mode 100644 gas/testsuite/gas/mri/for.d create mode 100644 gas/testsuite/gas/mri/for.s create mode 100644 gas/testsuite/gas/mri/if.d create mode 100644 gas/testsuite/gas/mri/if.s create mode 100644 gas/testsuite/gas/mri/immconst.d create mode 100644 gas/testsuite/gas/mri/label.d create mode 100644 gas/testsuite/gas/mri/label.s create mode 100644 gas/testsuite/gas/mri/moveml.d create mode 100644 gas/testsuite/gas/mri/moveml.s create mode 100644 gas/testsuite/gas/mri/mri.exp create mode 100644 gas/testsuite/gas/mri/repeat.d create mode 100644 gas/testsuite/gas/mri/repeat.s create mode 100644 gas/testsuite/gas/mri/semi.d create mode 100644 gas/testsuite/gas/mri/semi.s create mode 100644 gas/testsuite/gas/mri/while.d create mode 100644 gas/testsuite/gas/mri/while.s create mode 100644 gas/testsuite/gas/msp430/msp430.exp create mode 100644 gas/testsuite/gas/msp430/opcode.d create mode 100644 gas/testsuite/gas/msp430/opcode.s create mode 100644 gas/testsuite/gas/openrisc/addi.d create mode 100644 gas/testsuite/gas/openrisc/addi.s create mode 100644 gas/testsuite/gas/openrisc/allinsn.d create mode 100644 gas/testsuite/gas/openrisc/allinsn.exp create mode 100644 gas/testsuite/gas/openrisc/allinsn.s create mode 100644 gas/testsuite/gas/openrisc/lohi.d create mode 100644 gas/testsuite/gas/openrisc/lohi.s create mode 100644 gas/testsuite/gas/openrisc/store.d create mode 100644 gas/testsuite/gas/openrisc/store.s create mode 100644 gas/testsuite/gas/pdp11/opcode.d create mode 100644 gas/testsuite/gas/pdp11/opcode.s create mode 100644 gas/testsuite/gas/pdp11/pdp11.exp create mode 100644 gas/testsuite/gas/pj/ops.d create mode 100644 gas/testsuite/gas/pj/ops.s create mode 100644 gas/testsuite/gas/pj/pj.exp create mode 100644 gas/testsuite/gas/ppc/aix.exp create mode 100644 gas/testsuite/gas/ppc/align.s create mode 100644 gas/testsuite/gas/ppc/altivec.d create mode 100644 gas/testsuite/gas/ppc/altivec.s create mode 100644 gas/testsuite/gas/ppc/altivec_xcoff.d create mode 100644 gas/testsuite/gas/ppc/altivec_xcoff.s create mode 100644 gas/testsuite/gas/ppc/altivec_xcoff64.d create mode 100644 gas/testsuite/gas/ppc/altivec_xcoff64.s create mode 100644 gas/testsuite/gas/ppc/astest.d create mode 100644 gas/testsuite/gas/ppc/astest.s create mode 100644 gas/testsuite/gas/ppc/astest2.d create mode 100644 gas/testsuite/gas/ppc/astest2.s create mode 100644 gas/testsuite/gas/ppc/astest2_64.d create mode 100644 gas/testsuite/gas/ppc/astest2_64.s create mode 100644 gas/testsuite/gas/ppc/astest64.d create mode 100644 gas/testsuite/gas/ppc/astest64.s create mode 100644 gas/testsuite/gas/ppc/booke.d create mode 100644 gas/testsuite/gas/ppc/booke.s create mode 100644 gas/testsuite/gas/ppc/booke_xcoff.d create mode 100644 gas/testsuite/gas/ppc/booke_xcoff.s create mode 100644 gas/testsuite/gas/ppc/booke_xcoff64.d create mode 100644 gas/testsuite/gas/ppc/booke_xcoff64.s create mode 100644 gas/testsuite/gas/ppc/e500.d create mode 100644 gas/testsuite/gas/ppc/e500.s create mode 100755 gas/testsuite/gas/ppc/generate.sh create mode 100644 gas/testsuite/gas/ppc/machine.d create mode 100644 gas/testsuite/gas/ppc/machine.s create mode 100644 gas/testsuite/gas/ppc/power4.d create mode 100644 gas/testsuite/gas/ppc/power4.s create mode 100644 gas/testsuite/gas/ppc/ppc.exp create mode 100644 gas/testsuite/gas/ppc/simpshft.d create mode 100644 gas/testsuite/gas/ppc/simpshft.s create mode 100644 gas/testsuite/gas/ppc/test1elf.asm create mode 100644 gas/testsuite/gas/ppc/test1elf32.d create mode 100644 gas/testsuite/gas/ppc/test1elf32.s create mode 100644 gas/testsuite/gas/ppc/test1elf64.d create mode 100644 gas/testsuite/gas/ppc/test1elf64.s create mode 100644 gas/testsuite/gas/ppc/test1xcoff.asm create mode 100644 gas/testsuite/gas/ppc/test1xcoff32.d create mode 100644 gas/testsuite/gas/ppc/test1xcoff32.s create mode 100644 gas/testsuite/gas/ppc/textalign-xcoff-001.d create mode 100644 gas/testsuite/gas/ppc/textalign-xcoff-001.s create mode 100644 gas/testsuite/gas/ppc/textalign-xcoff-002.d create mode 100644 gas/testsuite/gas/s390/opcode.d create mode 100644 gas/testsuite/gas/s390/opcode.s create mode 100644 gas/testsuite/gas/s390/opcode64.d create mode 100644 gas/testsuite/gas/s390/opcode64.s create mode 100644 gas/testsuite/gas/s390/operands.d create mode 100644 gas/testsuite/gas/s390/operands.s create mode 100644 gas/testsuite/gas/s390/operands64.d create mode 100644 gas/testsuite/gas/s390/operands64.s create mode 100644 gas/testsuite/gas/s390/reloc.d create mode 100644 gas/testsuite/gas/s390/reloc.s create mode 100644 gas/testsuite/gas/s390/reloc64.d create mode 100644 gas/testsuite/gas/s390/reloc64.s create mode 100644 gas/testsuite/gas/s390/s390.exp create mode 100644 gas/testsuite/gas/sh/basic.exp create mode 100644 gas/testsuite/gas/sh/dsp.d create mode 100644 gas/testsuite/gas/sh/dsp.s create mode 100644 gas/testsuite/gas/sh/err-1.s create mode 100644 gas/testsuite/gas/sh/err-at.s create mode 100644 gas/testsuite/gas/sh/err-be.s create mode 100644 gas/testsuite/gas/sh/err-le.s create mode 100644 gas/testsuite/gas/sh/err-sh4a-fp.s create mode 100644 gas/testsuite/gas/sh/err-sh4a.s create mode 100644 gas/testsuite/gas/sh/err-sh4al-dsp.s create mode 100644 gas/testsuite/gas/sh/err.exp create mode 100644 gas/testsuite/gas/sh/fp.s create mode 100644 gas/testsuite/gas/sh/pcrel-coff.d create mode 100644 gas/testsuite/gas/sh/pcrel-coff.s create mode 100644 gas/testsuite/gas/sh/pcrel.d create mode 100644 gas/testsuite/gas/sh/pcrel.l create mode 100644 gas/testsuite/gas/sh/pcrel.s create mode 100644 gas/testsuite/gas/sh/pcrel2.d create mode 100644 gas/testsuite/gas/sh/pcrel2.s create mode 100644 gas/testsuite/gas/sh/pic.d create mode 100644 gas/testsuite/gas/sh/pic.s create mode 100644 gas/testsuite/gas/sh/renesas-1.d create mode 100644 gas/testsuite/gas/sh/renesas-1.s create mode 100644 gas/testsuite/gas/sh/sh4a-dsp.d create mode 100644 gas/testsuite/gas/sh/sh4a-dsp.s create mode 100644 gas/testsuite/gas/sh/sh4a-fp.d create mode 100644 gas/testsuite/gas/sh/sh4a-fp.s create mode 100644 gas/testsuite/gas/sh/sh4a.d create mode 100644 gas/testsuite/gas/sh/sh4a.s create mode 100644 gas/testsuite/gas/sh/sh4al-dsp.d create mode 100644 gas/testsuite/gas/sh/sh4al-dsp.s create mode 100644 gas/testsuite/gas/sh/sh64/abi-32.d create mode 100644 gas/testsuite/gas/sh/sh64/abi-32.s create mode 100644 gas/testsuite/gas/sh/sh64/abi-64.d create mode 100644 gas/testsuite/gas/sh/sh64/abi-64.s create mode 100644 gas/testsuite/gas/sh/sh64/basic-1.d create mode 100644 gas/testsuite/gas/sh/sh64/basic-1.s create mode 100644 gas/testsuite/gas/sh/sh64/case-1.d create mode 100644 gas/testsuite/gas/sh/sh64/case-1.s create mode 100644 gas/testsuite/gas/sh/sh64/case-noexp-1.d create mode 100644 gas/testsuite/gas/sh/sh64/crange1-1.d create mode 100644 gas/testsuite/gas/sh/sh64/crange1-2.d create mode 100644 gas/testsuite/gas/sh/sh64/crange1.s create mode 100644 gas/testsuite/gas/sh/sh64/crange2-1.d create mode 100644 gas/testsuite/gas/sh/sh64/crange2-2.d create mode 100644 gas/testsuite/gas/sh/sh64/crange2-noexp-1.d create mode 100644 gas/testsuite/gas/sh/sh64/crange2.s create mode 100644 gas/testsuite/gas/sh/sh64/crange3-1.d create mode 100644 gas/testsuite/gas/sh/sh64/crange3.s create mode 100644 gas/testsuite/gas/sh/sh64/crange4-1.d create mode 100644 gas/testsuite/gas/sh/sh64/crange4.s create mode 100644 gas/testsuite/gas/sh/sh64/crange5-1.d create mode 100644 gas/testsuite/gas/sh/sh64/crange5.s create mode 100644 gas/testsuite/gas/sh/sh64/creg-1.d create mode 100644 gas/testsuite/gas/sh/sh64/creg-1.s create mode 100644 gas/testsuite/gas/sh/sh64/creg-2.d create mode 100644 gas/testsuite/gas/sh/sh64/creg-2.s create mode 100644 gas/testsuite/gas/sh/sh64/datal-1.s create mode 100644 gas/testsuite/gas/sh/sh64/datal-2.d create mode 100644 gas/testsuite/gas/sh/sh64/datal-2.s create mode 100644 gas/testsuite/gas/sh/sh64/datal-3.s create mode 100644 gas/testsuite/gas/sh/sh64/datal32-1.d create mode 100644 gas/testsuite/gas/sh/sh64/datal32-3.d create mode 100644 gas/testsuite/gas/sh/sh64/datal64-1.d create mode 100644 gas/testsuite/gas/sh/sh64/datal64-3.d create mode 100644 gas/testsuite/gas/sh/sh64/endian-1.d create mode 100644 gas/testsuite/gas/sh/sh64/endian-1.s create mode 100644 gas/testsuite/gas/sh/sh64/endian-2.d create mode 100644 gas/testsuite/gas/sh/sh64/endian-2.s create mode 100644 gas/testsuite/gas/sh/sh64/err-1.s create mode 100644 gas/testsuite/gas/sh/sh64/err-2.s create mode 100644 gas/testsuite/gas/sh/sh64/err-3.s create mode 100644 gas/testsuite/gas/sh/sh64/err-4.s create mode 100644 gas/testsuite/gas/sh/sh64/err-abi-32.s create mode 100644 gas/testsuite/gas/sh/sh64/err-abi-64.s create mode 100644 gas/testsuite/gas/sh/sh64/err-dsp.s create mode 100644 gas/testsuite/gas/sh/sh64/err-movi-noexp-1.s create mode 100644 gas/testsuite/gas/sh/sh64/err-noexp-cmd1.s create mode 100644 gas/testsuite/gas/sh/sh64/err-pt-1.s create mode 100644 gas/testsuite/gas/sh/sh64/err-pt32-cmd1.s create mode 100644 gas/testsuite/gas/sh/sh64/err-pt32-cmd2.s create mode 100644 gas/testsuite/gas/sh/sh64/err-pt32-cmd3.s create mode 100644 gas/testsuite/gas/sh/sh64/err-ptb-1.s create mode 100644 gas/testsuite/gas/sh/sh64/err-ptb-2.s create mode 100644 gas/testsuite/gas/sh/sh64/err.exp create mode 100644 gas/testsuite/gas/sh/sh64/immexpr1.s create mode 100644 gas/testsuite/gas/sh/sh64/immexpr2.s create mode 100644 gas/testsuite/gas/sh/sh64/immexpr32-1.d create mode 100644 gas/testsuite/gas/sh/sh64/immexpr32-2.d create mode 100644 gas/testsuite/gas/sh/sh64/immexpr64-1.d create mode 100644 gas/testsuite/gas/sh/sh64/immexpr64-2.d create mode 100644 gas/testsuite/gas/sh/sh64/lineno.d create mode 100644 gas/testsuite/gas/sh/sh64/lineno.s create mode 100644 gas/testsuite/gas/sh/sh64/localcom-1.d create mode 100644 gas/testsuite/gas/sh/sh64/localcom-1.s create mode 100644 gas/testsuite/gas/sh/sh64/mix-1.d create mode 100644 gas/testsuite/gas/sh/sh64/mix-1.s create mode 100644 gas/testsuite/gas/sh/sh64/mix-noexp-1.d create mode 100644 gas/testsuite/gas/sh/sh64/movi-1.s create mode 100644 gas/testsuite/gas/sh/sh64/movi-2.s create mode 100644 gas/testsuite/gas/sh/sh64/movi-3.d create mode 100644 gas/testsuite/gas/sh/sh64/movi-3.s create mode 100644 gas/testsuite/gas/sh/sh64/movi32-1.d create mode 100644 gas/testsuite/gas/sh/sh64/movi32-2.d create mode 100644 gas/testsuite/gas/sh/sh64/movi32-noexp-2.d create mode 100644 gas/testsuite/gas/sh/sh64/movi64-1.d create mode 100644 gas/testsuite/gas/sh/sh64/movi64-2.d create mode 100644 gas/testsuite/gas/sh/sh64/movi64-2.s create mode 100644 gas/testsuite/gas/sh/sh64/movi64-3.d create mode 100644 gas/testsuite/gas/sh/sh64/movi64-noexp-2.d create mode 100644 gas/testsuite/gas/sh/sh64/pt-1.d create mode 100644 gas/testsuite/gas/sh/sh64/pt-1.s create mode 100644 gas/testsuite/gas/sh/sh64/pt-2.s create mode 100644 gas/testsuite/gas/sh/sh64/pt-noexp-1.d create mode 100644 gas/testsuite/gas/sh/sh64/pt32-1.d create mode 100644 gas/testsuite/gas/sh/sh64/pt32-noexp-2.d create mode 100644 gas/testsuite/gas/sh/sh64/pt64-1.d create mode 100644 gas/testsuite/gas/sh/sh64/pt64-32-1.d create mode 100644 gas/testsuite/gas/sh/sh64/pt64-32-2.d create mode 100644 gas/testsuite/gas/sh/sh64/pt64-noexp-2.d create mode 100644 gas/testsuite/gas/sh/sh64/ptc-1.s create mode 100644 gas/testsuite/gas/sh/sh64/ptc32-1.d create mode 100644 gas/testsuite/gas/sh/sh64/ptc32-noexp-1.d create mode 100644 gas/testsuite/gas/sh/sh64/ptc64-1.d create mode 100644 gas/testsuite/gas/sh/sh64/ptc64-32-1.d create mode 100644 gas/testsuite/gas/sh/sh64/ptc64-noexp-1.d create mode 100644 gas/testsuite/gas/sh/sh64/ptext-1.s create mode 100644 gas/testsuite/gas/sh/sh64/ptext32-1.d create mode 100644 gas/testsuite/gas/sh/sh64/ptext32-noexp-1.d create mode 100644 gas/testsuite/gas/sh/sh64/ptext64-1.d create mode 100644 gas/testsuite/gas/sh/sh64/ptext64-32-1.d create mode 100644 gas/testsuite/gas/sh/sh64/ptext64-noexp-1.d create mode 100644 gas/testsuite/gas/sh/sh64/rel-1.s create mode 100644 gas/testsuite/gas/sh/sh64/rel-2.s create mode 100644 gas/testsuite/gas/sh/sh64/rel-3.s create mode 100644 gas/testsuite/gas/sh/sh64/rel-4.s create mode 100644 gas/testsuite/gas/sh/sh64/rel-5.s create mode 100644 gas/testsuite/gas/sh/sh64/rel32-1.d create mode 100644 gas/testsuite/gas/sh/sh64/rel32-2.d create mode 100644 gas/testsuite/gas/sh/sh64/rel32-3.d create mode 100644 gas/testsuite/gas/sh/sh64/rel32-4.d create mode 100644 gas/testsuite/gas/sh/sh64/rel32-5.d create mode 100644 gas/testsuite/gas/sh/sh64/rel64-1.d create mode 100644 gas/testsuite/gas/sh/sh64/rel64-2.d create mode 100644 gas/testsuite/gas/sh/sh64/rel64-3.d create mode 100644 gas/testsuite/gas/sh/sh64/rel64-4.d create mode 100644 gas/testsuite/gas/sh/sh64/rel64-5.d create mode 100644 gas/testsuite/gas/sh/sh64/relax-1.d create mode 100644 gas/testsuite/gas/sh/sh64/relax-1.s create mode 100644 gas/testsuite/gas/sh/sh64/relax-2.d create mode 100644 gas/testsuite/gas/sh/sh64/relax-2.s create mode 100644 gas/testsuite/gas/sh/sh64/relax-3.d create mode 100644 gas/testsuite/gas/sh/sh64/relax-3.s create mode 100644 gas/testsuite/gas/sh/sh64/sh64.exp create mode 100644 gas/testsuite/gas/sh/sh64/shift-1.s create mode 100644 gas/testsuite/gas/sh/sh64/shift-2.s create mode 100644 gas/testsuite/gas/sh/sh64/shift-3.s create mode 100644 gas/testsuite/gas/sh/sh64/shift32-1.d create mode 100644 gas/testsuite/gas/sh/sh64/shift32-3.d create mode 100644 gas/testsuite/gas/sh/sh64/shift32-noexp-3.d create mode 100644 gas/testsuite/gas/sh/sh64/shift64-1.d create mode 100644 gas/testsuite/gas/sh/sh64/shift64-2.d create mode 100644 gas/testsuite/gas/sh/sh64/shift64-3.d create mode 100644 gas/testsuite/gas/sh/sh64/shift64-noexp-3.d create mode 100644 gas/testsuite/gas/sh/sh64/syntax-1.d create mode 100644 gas/testsuite/gas/sh/sh64/syntax-1.s create mode 100644 gas/testsuite/gas/sh/sh64/syntax-2.d create mode 100644 gas/testsuite/gas/sh/sh64/syntax-2.s create mode 100644 gas/testsuite/gas/sh/sh64/ua-1.s create mode 100644 gas/testsuite/gas/sh/sh64/ua32-1.d create mode 100644 gas/testsuite/gas/sh/sh64/ua64-1.d create mode 100644 gas/testsuite/gas/sh/tlsd.d create mode 100644 gas/testsuite/gas/sh/tlsd.s create mode 100644 gas/testsuite/gas/sh/tlsnopic.d create mode 100644 gas/testsuite/gas/sh/tlsnopic.s create mode 100644 gas/testsuite/gas/sh/tlspic.d create mode 100644 gas/testsuite/gas/sh/tlspic.s create mode 100644 gas/testsuite/gas/sparc-solaris/addend.exp create mode 100644 gas/testsuite/gas/sparc-solaris/addend.s create mode 100644 gas/testsuite/gas/sparc-solaris/gas.exp create mode 100644 gas/testsuite/gas/sparc-solaris/sol-cc.s create mode 100644 gas/testsuite/gas/sparc-solaris/sol-gcc.s create mode 100644 gas/testsuite/gas/sparc/asi.d create mode 100644 gas/testsuite/gas/sparc/asi.s create mode 100644 gas/testsuite/gas/sparc/membar.d create mode 100644 gas/testsuite/gas/sparc/membar.s create mode 100644 gas/testsuite/gas/sparc/mism-1.s create mode 100644 gas/testsuite/gas/sparc/mismatch.exp create mode 100644 gas/testsuite/gas/sparc/pcrel.d create mode 100644 gas/testsuite/gas/sparc/pcrel.s create mode 100644 gas/testsuite/gas/sparc/pcrel64.d create mode 100644 gas/testsuite/gas/sparc/pcrel64.s create mode 100644 gas/testsuite/gas/sparc/plt.d create mode 100644 gas/testsuite/gas/sparc/plt.s create mode 100644 gas/testsuite/gas/sparc/plt64.d create mode 100644 gas/testsuite/gas/sparc/plt64.s create mode 100644 gas/testsuite/gas/sparc/prefetch.d create mode 100644 gas/testsuite/gas/sparc/prefetch.s create mode 100644 gas/testsuite/gas/sparc/rdpr.d create mode 100644 gas/testsuite/gas/sparc/rdpr.s create mode 100644 gas/testsuite/gas/sparc/reloc64.d create mode 100644 gas/testsuite/gas/sparc/reloc64.s create mode 100644 gas/testsuite/gas/sparc/set64.d create mode 100644 gas/testsuite/gas/sparc/set64.s create mode 100644 gas/testsuite/gas/sparc/sparc.exp create mode 100644 gas/testsuite/gas/sparc/splet-2.d create mode 100644 gas/testsuite/gas/sparc/splet-2.s create mode 100644 gas/testsuite/gas/sparc/splet.d create mode 100644 gas/testsuite/gas/sparc/splet.s create mode 100644 gas/testsuite/gas/sparc/synth.d create mode 100644 gas/testsuite/gas/sparc/synth.s create mode 100644 gas/testsuite/gas/sparc/synth64.d create mode 100644 gas/testsuite/gas/sparc/synth64.s create mode 100644 gas/testsuite/gas/sparc/unalign.d create mode 100644 gas/testsuite/gas/sparc/unalign.s create mode 100644 gas/testsuite/gas/sparc/wrpr.d create mode 100644 gas/testsuite/gas/sparc/wrpr.s create mode 100644 gas/testsuite/gas/sun4/addend.d create mode 100644 gas/testsuite/gas/sun4/addend.exp create mode 100644 gas/testsuite/gas/sun4/addend.s create mode 100644 gas/testsuite/gas/symver/symver.exp create mode 100644 gas/testsuite/gas/symver/symver0.d create mode 100644 gas/testsuite/gas/symver/symver0.s create mode 100644 gas/testsuite/gas/symver/symver1.d create mode 100644 gas/testsuite/gas/symver/symver1.s create mode 100644 gas/testsuite/gas/symver/symver2.l create mode 100644 gas/testsuite/gas/symver/symver2.s create mode 100644 gas/testsuite/gas/symver/symver3.l create mode 100644 gas/testsuite/gas/symver/symver3.s create mode 100644 gas/testsuite/gas/symver/symver4.l create mode 100644 gas/testsuite/gas/symver/symver4.s create mode 100644 gas/testsuite/gas/symver/symver5.l create mode 100644 gas/testsuite/gas/symver/symver5.s create mode 100644 gas/testsuite/gas/symver/symver6.l create mode 100644 gas/testsuite/gas/symver/symver6.s create mode 100644 gas/testsuite/gas/template create mode 100644 gas/testsuite/gas/tic4x/addressing.s create mode 100644 gas/testsuite/gas/tic4x/addressing_c3x.d create mode 100644 gas/testsuite/gas/tic4x/addressing_c4x.d create mode 100644 gas/testsuite/gas/tic4x/allopcodes.S create mode 100644 gas/testsuite/gas/tic4x/data.d create mode 100644 gas/testsuite/gas/tic4x/data.s create mode 100644 gas/testsuite/gas/tic4x/float.d create mode 100644 gas/testsuite/gas/tic4x/float.s create mode 100644 gas/testsuite/gas/tic4x/opclasses.h create mode 100644 gas/testsuite/gas/tic4x/opcodes.s create mode 100644 gas/testsuite/gas/tic4x/opcodes_c3x.d create mode 100644 gas/testsuite/gas/tic4x/opcodes_c4x.d create mode 100644 gas/testsuite/gas/tic4x/opcodes_new.d create mode 100755 gas/testsuite/gas/tic4x/rebuild.sh create mode 100644 gas/testsuite/gas/tic4x/registers.s create mode 100644 gas/testsuite/gas/tic4x/registers_c3x.d create mode 100644 gas/testsuite/gas/tic4x/registers_c4x.d create mode 100644 gas/testsuite/gas/tic4x/tic4x.exp create mode 100644 gas/testsuite/gas/tic4x/zeros.d create mode 100644 gas/testsuite/gas/tic4x/zeros.s create mode 100644 gas/testsuite/gas/tic54x/address.d create mode 100644 gas/testsuite/gas/tic54x/address.s create mode 100644 gas/testsuite/gas/tic54x/addrfar.d create mode 100644 gas/testsuite/gas/tic54x/align.d create mode 100644 gas/testsuite/gas/tic54x/align.s create mode 100644 gas/testsuite/gas/tic54x/all-opcodes.d create mode 100644 gas/testsuite/gas/tic54x/all-opcodes.s create mode 100644 gas/testsuite/gas/tic54x/asg.d create mode 100644 gas/testsuite/gas/tic54x/asg.s create mode 100644 gas/testsuite/gas/tic54x/cons.d create mode 100644 gas/testsuite/gas/tic54x/cons.s create mode 100644 gas/testsuite/gas/tic54x/consfar.d create mode 100644 gas/testsuite/gas/tic54x/extaddr.d create mode 100644 gas/testsuite/gas/tic54x/extaddr.s create mode 100644 gas/testsuite/gas/tic54x/field.d create mode 100644 gas/testsuite/gas/tic54x/field.s create mode 100644 gas/testsuite/gas/tic54x/in_mlib.asm create mode 100644 gas/testsuite/gas/tic54x/labels.d create mode 100644 gas/testsuite/gas/tic54x/labels.inc create mode 100644 gas/testsuite/gas/tic54x/labels.s create mode 100644 gas/testsuite/gas/tic54x/loop.d create mode 100644 gas/testsuite/gas/tic54x/loop.s create mode 100644 gas/testsuite/gas/tic54x/lp.d create mode 100644 gas/testsuite/gas/tic54x/lp.s create mode 100644 gas/testsuite/gas/tic54x/macro.d create mode 100644 gas/testsuite/gas/tic54x/macro.s create mode 100644 gas/testsuite/gas/tic54x/macro1.s create mode 100644 gas/testsuite/gas/tic54x/macros.lib create mode 100644 gas/testsuite/gas/tic54x/math.d create mode 100644 gas/testsuite/gas/tic54x/math.s create mode 100644 gas/testsuite/gas/tic54x/opcodes.d create mode 100644 gas/testsuite/gas/tic54x/opcodes.s create mode 100644 gas/testsuite/gas/tic54x/sections.d create mode 100644 gas/testsuite/gas/tic54x/sections.s create mode 100644 gas/testsuite/gas/tic54x/set.d create mode 100644 gas/testsuite/gas/tic54x/set.s create mode 100644 gas/testsuite/gas/tic54x/struct.d create mode 100644 gas/testsuite/gas/tic54x/struct.s create mode 100644 gas/testsuite/gas/tic54x/subsym.d create mode 100644 gas/testsuite/gas/tic54x/subsym.s create mode 100644 gas/testsuite/gas/tic54x/subsym1.s create mode 100644 gas/testsuite/gas/tic54x/tic54x.exp create mode 100644 gas/testsuite/gas/tic80/add.d create mode 100644 gas/testsuite/gas/tic80/add.lst create mode 100644 gas/testsuite/gas/tic80/add.s create mode 100644 gas/testsuite/gas/tic80/align.d create mode 100644 gas/testsuite/gas/tic80/align.lst create mode 100644 gas/testsuite/gas/tic80/align.s create mode 100644 gas/testsuite/gas/tic80/bitnum.d create mode 100644 gas/testsuite/gas/tic80/bitnum.lst create mode 100644 gas/testsuite/gas/tic80/bitnum.s create mode 100644 gas/testsuite/gas/tic80/ccode.d create mode 100644 gas/testsuite/gas/tic80/ccode.lst create mode 100644 gas/testsuite/gas/tic80/ccode.s create mode 100644 gas/testsuite/gas/tic80/cregops.d create mode 100644 gas/testsuite/gas/tic80/cregops.lst create mode 100644 gas/testsuite/gas/tic80/cregops.s create mode 100644 gas/testsuite/gas/tic80/endmask.d create mode 100644 gas/testsuite/gas/tic80/endmask.lst create mode 100644 gas/testsuite/gas/tic80/endmask.s create mode 100644 gas/testsuite/gas/tic80/float.d create mode 100644 gas/testsuite/gas/tic80/float.lst create mode 100644 gas/testsuite/gas/tic80/float.s create mode 100644 gas/testsuite/gas/tic80/regops.d create mode 100644 gas/testsuite/gas/tic80/regops.lst create mode 100644 gas/testsuite/gas/tic80/regops.s create mode 100644 gas/testsuite/gas/tic80/regops2.d create mode 100644 gas/testsuite/gas/tic80/regops2.lst create mode 100644 gas/testsuite/gas/tic80/regops2.s create mode 100644 gas/testsuite/gas/tic80/regops3.d create mode 100644 gas/testsuite/gas/tic80/regops3.lst create mode 100644 gas/testsuite/gas/tic80/regops3.s create mode 100644 gas/testsuite/gas/tic80/regops4.d create mode 100644 gas/testsuite/gas/tic80/regops4.lst create mode 100644 gas/testsuite/gas/tic80/regops4.s create mode 100644 gas/testsuite/gas/tic80/relocs1.c create mode 100644 gas/testsuite/gas/tic80/relocs1.d create mode 100644 gas/testsuite/gas/tic80/relocs1.lst create mode 100644 gas/testsuite/gas/tic80/relocs1.s create mode 100644 gas/testsuite/gas/tic80/relocs1b.d create mode 100644 gas/testsuite/gas/tic80/relocs2.c create mode 100644 gas/testsuite/gas/tic80/relocs2.d create mode 100644 gas/testsuite/gas/tic80/relocs2.lst create mode 100644 gas/testsuite/gas/tic80/relocs2.s create mode 100644 gas/testsuite/gas/tic80/relocs2b.d create mode 100644 gas/testsuite/gas/tic80/tic80.exp create mode 100644 gas/testsuite/gas/v850/arith.s create mode 100644 gas/testsuite/gas/v850/basic.exp create mode 100644 gas/testsuite/gas/v850/bit.s create mode 100644 gas/testsuite/gas/v850/branch.s create mode 100644 gas/testsuite/gas/v850/compare.s create mode 100644 gas/testsuite/gas/v850/fepsw.s create mode 100644 gas/testsuite/gas/v850/hilo.s create mode 100644 gas/testsuite/gas/v850/hilo2.s create mode 100644 gas/testsuite/gas/v850/jumps.s create mode 100644 gas/testsuite/gas/v850/logical.s create mode 100644 gas/testsuite/gas/v850/mem.s create mode 100644 gas/testsuite/gas/v850/misc.s create mode 100644 gas/testsuite/gas/v850/move.s create mode 100644 gas/testsuite/gas/v850/range.s create mode 100644 gas/testsuite/gas/v850/reloc.s create mode 100644 gas/testsuite/gas/v850/v850e1.d create mode 100644 gas/testsuite/gas/v850/v850e1.s create mode 100644 gas/testsuite/gas/vax/elf-rel.d create mode 100644 gas/testsuite/gas/vax/elf-rel.s create mode 100644 gas/testsuite/gas/vax/quad.s create mode 100644 gas/testsuite/gas/vax/quad_elf.s create mode 100644 gas/testsuite/gas/vax/vax.exp create mode 100644 gas/testsuite/gas/vtable/entry0.d create mode 100644 gas/testsuite/gas/vtable/entry0.s create mode 100644 gas/testsuite/gas/vtable/entry1.d create mode 100644 gas/testsuite/gas/vtable/entry1.s create mode 100644 gas/testsuite/gas/vtable/inherit0.d create mode 100644 gas/testsuite/gas/vtable/inherit0.s create mode 100644 gas/testsuite/gas/vtable/inherit1.l create mode 100644 gas/testsuite/gas/vtable/inherit1.s create mode 100644 gas/testsuite/gas/vtable/vtable.exp create mode 100644 gas/testsuite/gas/xstormy16/allinsn.d create mode 100644 gas/testsuite/gas/xstormy16/allinsn.exp create mode 100644 gas/testsuite/gas/xstormy16/allinsn.s create mode 100644 gas/testsuite/gas/xstormy16/allinsn.sh create mode 100644 gas/testsuite/gas/xstormy16/gcc.d create mode 100644 gas/testsuite/gas/xstormy16/gcc.s create mode 100644 gas/testsuite/gas/xstormy16/gcc.sh create mode 100644 gas/testsuite/gas/xstormy16/reloc-1.d create mode 100644 gas/testsuite/gas/xstormy16/reloc-1.s create mode 100644 gas/testsuite/gas/xstormy16/reloc-2.d create mode 100644 gas/testsuite/gas/xstormy16/reloc-2.s create mode 100644 gas/testsuite/gas/xtensa/all.exp create mode 100644 gas/testsuite/gas/xtensa/entry_align.s create mode 100644 gas/testsuite/gas/xtensa/entry_misalign.s create mode 100644 gas/testsuite/gas/xtensa/entry_misalign2.s create mode 100644 gas/testsuite/gas/xtensa/j_too_far.s create mode 100644 gas/testsuite/gas/xtensa/loop_align.s create mode 100644 gas/testsuite/gas/xtensa/loop_misalign.s create mode 100644 gas/testsuite/gas/z8k/calr-backf.s create mode 100644 gas/testsuite/gas/z8k/calr-forwf.s create mode 100644 gas/testsuite/gas/z8k/calr.d create mode 100644 gas/testsuite/gas/z8k/calr.s create mode 100644 gas/testsuite/gas/z8k/ctrl-names.d create mode 100644 gas/testsuite/gas/z8k/ctrl-names.s create mode 100644 gas/testsuite/gas/z8k/dec.s create mode 100644 gas/testsuite/gas/z8k/decbf.s create mode 100644 gas/testsuite/gas/z8k/decf.s create mode 100644 gas/testsuite/gas/z8k/djnz-backf.s create mode 100644 gas/testsuite/gas/z8k/djnz-backf2.s create mode 100644 gas/testsuite/gas/z8k/djnz.d create mode 100644 gas/testsuite/gas/z8k/djnz.s create mode 100644 gas/testsuite/gas/z8k/eidi.s create mode 100644 gas/testsuite/gas/z8k/eidif.s create mode 100644 gas/testsuite/gas/z8k/inc.s create mode 100644 gas/testsuite/gas/z8k/incbf.s create mode 100644 gas/testsuite/gas/z8k/incf.s create mode 100644 gas/testsuite/gas/z8k/inout.d create mode 100644 gas/testsuite/gas/z8k/inout.s create mode 100644 gas/testsuite/gas/z8k/jmp-cc.d create mode 100644 gas/testsuite/gas/z8k/jmp-cc.s create mode 100644 gas/testsuite/gas/z8k/jr-back.d create mode 100644 gas/testsuite/gas/z8k/jr-back.s create mode 100644 gas/testsuite/gas/z8k/jr-backf.s create mode 100644 gas/testsuite/gas/z8k/jr-forw.d create mode 100644 gas/testsuite/gas/z8k/jr-forw.s create mode 100644 gas/testsuite/gas/z8k/jr-forwf.s create mode 100644 gas/testsuite/gas/z8k/ldk.s create mode 100644 gas/testsuite/gas/z8k/ldkf.s create mode 100644 gas/testsuite/gas/z8k/ret-cc.d create mode 100644 gas/testsuite/gas/z8k/ret-cc.s create mode 100644 gas/testsuite/gas/z8k/z8k.exp create mode 100755 gas/testsuite/lib/doboth create mode 100755 gas/testsuite/lib/doobjcmp create mode 100755 gas/testsuite/lib/dostriptest create mode 100755 gas/testsuite/lib/dotest create mode 100755 gas/testsuite/lib/dounsreloc create mode 100755 gas/testsuite/lib/dounssym create mode 100644 gas/testsuite/lib/gas-defs.exp create mode 100644 gas/testsuite/lib/gas-dg.exp create mode 100755 gas/testsuite/lib/run create mode 100644 gas/vmsconf.sh create mode 100644 gettext.m4 create mode 100644 gprof/.gdbinit create mode 100644 gprof/ChangeLog create mode 100644 gprof/ChangeLog-9203 create mode 100644 gprof/MAINTAINERS create mode 100644 gprof/Makefile.am create mode 100644 gprof/Makefile.in create mode 100644 gprof/README create mode 100644 gprof/TEST create mode 100644 gprof/TODO create mode 100644 gprof/acinclude.m4 create mode 100644 gprof/aclocal.m4 create mode 100644 gprof/alpha.c create mode 100644 gprof/basic_blocks.c create mode 100644 gprof/basic_blocks.h create mode 100644 gprof/bb_exit_func.c create mode 100755 gprof/bbconv.pl create mode 100644 gprof/bsd_callg_bl.c create mode 100644 gprof/bsd_callg_bl.m create mode 100644 gprof/call_graph.c create mode 100644 gprof/call_graph.h create mode 100644 gprof/cg_arcs.c create mode 100644 gprof/cg_arcs.h create mode 100644 gprof/cg_dfn.c create mode 100644 gprof/cg_dfn.h create mode 100644 gprof/cg_print.c create mode 100644 gprof/cg_print.h create mode 100755 gprof/configure create mode 100644 gprof/configure.in create mode 100644 gprof/corefile.c create mode 100644 gprof/corefile.h create mode 100644 gprof/dep-in.sed create mode 100644 gprof/flat_bl.c create mode 100644 gprof/flat_bl.m create mode 100644 gprof/fsf_callg_bl.c create mode 100644 gprof/fsf_callg_bl.m create mode 100644 gprof/gconfig.in create mode 100644 gprof/gen-c-prog.awk create mode 100644 gprof/gmon.h create mode 100644 gprof/gmon_io.c create mode 100644 gprof/gmon_io.h create mode 100644 gprof/gmon_out.h create mode 100644 gprof/gprof.1 create mode 100644 gprof/gprof.c create mode 100644 gprof/gprof.h create mode 100644 gprof/gprof.info create mode 100644 gprof/gprof.texi create mode 100644 gprof/hertz.c create mode 100644 gprof/hertz.h create mode 100644 gprof/hist.c create mode 100644 gprof/hist.h create mode 100644 gprof/i386.c create mode 100644 gprof/po/.cvsignore create mode 100644 gprof/po/da.gmo create mode 100644 gprof/po/da.po create mode 100644 gprof/po/de.gmo create mode 100644 gprof/po/de.po create mode 100644 gprof/po/es.gmo create mode 100644 gprof/po/es.po create mode 100644 gprof/po/fr.gmo create mode 100644 gprof/po/fr.po create mode 100644 gprof/po/id.gmo create mode 100644 gprof/po/id.po create mode 100644 gprof/po/pt_BR.gmo create mode 100644 gprof/po/pt_BR.po create mode 100644 gprof/po/sv.gmo create mode 100644 gprof/po/sv.po create mode 100644 gprof/po/tr.gmo create mode 100644 gprof/po/tr.po create mode 100644 gprof/search_list.c create mode 100644 gprof/search_list.h create mode 100644 gprof/source.c create mode 100644 gprof/source.h create mode 100644 gprof/sparc.c create mode 100644 gprof/stamp-h.in create mode 100644 gprof/sym_ids.c create mode 100644 gprof/sym_ids.h create mode 100644 gprof/symtab.c create mode 100644 gprof/symtab.h create mode 100644 gprof/tahoe.c create mode 100644 gprof/utils.c create mode 100644 gprof/utils.h create mode 100644 gprof/vax.c create mode 100644 include/COPYING create mode 100644 include/ChangeLog-9103 create mode 100644 include/aout/adobe.h create mode 100644 include/aout/dynix3.h create mode 100644 include/aout/hp.h create mode 100644 include/aout/hp300hpux.h create mode 100644 include/aout/hppa.h create mode 100644 include/bout.h delete mode 100644 include/callback.h create mode 100644 include/coff/ChangeLog-9103 create mode 100644 include/coff/a29k.h create mode 100644 include/coff/apollo.h create mode 100644 include/coff/go32exe.h create mode 100644 include/coff/h8300.h create mode 100644 include/coff/h8500.h create mode 100644 include/coff/i860.h create mode 100644 include/coff/i960.h create mode 100644 include/coff/m68k.h create mode 100644 include/coff/m88k.h create mode 100644 include/coff/mcore.h create mode 100644 include/coff/or32.h create mode 100644 include/coff/tic30.h create mode 100644 include/coff/tic4x.h create mode 100644 include/coff/tic54x.h create mode 100644 include/coff/tic80.h create mode 100644 include/coff/w65.h create mode 100644 include/coff/we32k.h create mode 100644 include/coff/z8k.h delete mode 100644 include/elf/arm-oabi.h delete mode 100644 include/elf/po/Make-in delete mode 100644 include/elf/po/POTFILES.in delete mode 100644 include/elf/po/binutils.pot create mode 100644 include/fopen-vms.h create mode 100644 include/gdb/ChangeLog create mode 100644 include/gdb/callback.h create mode 100644 include/gdb/fileio.h create mode 100644 include/gdb/remote-sim.h create mode 100644 include/gdb/signals.h create mode 100644 include/gdb/sim-arm.h create mode 100644 include/gdb/sim-d10v.h create mode 100644 include/gdb/sim-frv.h create mode 100644 include/gdb/sim-h8300.h create mode 100644 include/gdb/sim-sh.h create mode 100644 include/hp-symtab.h create mode 100644 include/mpw/ChangeLog create mode 100644 include/mpw/README create mode 100644 include/mpw/dir.h create mode 100644 include/mpw/dirent.h create mode 100644 include/mpw/fcntl.h create mode 100644 include/mpw/grp.h create mode 100644 include/mpw/mpw.h create mode 100644 include/mpw/pwd.h create mode 100644 include/mpw/spin.h create mode 100644 include/mpw/stat.h create mode 100644 include/mpw/sys/file.h create mode 100644 include/mpw/sys/param.h create mode 100644 include/mpw/sys/resource.h create mode 100644 include/mpw/sys/stat.h create mode 100644 include/mpw/sys/time.h create mode 100644 include/mpw/sys/types.h create mode 100644 include/mpw/utime.h create mode 100644 include/mpw/varargs.h create mode 100644 include/nlm/ChangeLog create mode 100644 include/nlm/alpha-ext.h create mode 100644 include/nlm/common.h create mode 100644 include/nlm/external.h create mode 100644 include/nlm/i386-ext.h create mode 100644 include/nlm/internal.h create mode 100644 include/nlm/ppc-ext.h create mode 100644 include/nlm/sparc32-ext.h create mode 100644 include/oasys.h create mode 100644 include/opcode/a29k.h create mode 100644 include/opcode/avr.h create mode 100644 include/opcode/cris.h create mode 100644 include/opcode/d10v.h create mode 100644 include/opcode/d30v.h create mode 100644 include/opcode/dlx.h create mode 100644 include/opcode/h8300.h create mode 100644 include/opcode/hppa.h create mode 100644 include/opcode/i370.h create mode 100644 include/opcode/i860.h create mode 100644 include/opcode/i960.h create mode 100644 include/opcode/m68hc11.h create mode 100644 include/opcode/m68k.h create mode 100644 include/opcode/m88k.h create mode 100644 include/opcode/mmix.h create mode 100644 include/opcode/mn10200.h create mode 100644 include/opcode/mn10300.h create mode 100644 include/opcode/msp430.h create mode 100644 include/opcode/ns32k.h create mode 100644 include/opcode/or32.h create mode 100644 include/opcode/pdp11.h create mode 100644 include/opcode/pj.h create mode 100644 include/opcode/pyr.h create mode 100644 include/opcode/tahoe.h create mode 100644 include/opcode/tic30.h create mode 100644 include/opcode/tic4x.h create mode 100644 include/opcode/tic54x.h create mode 100644 include/opcode/tic80.h create mode 100644 include/opcode/v850.h create mode 100644 include/opcode/vax.h create mode 100644 include/os9k.h delete mode 100644 include/regs/ChangeLog delete mode 100644 include/remote-sim.h delete mode 100644 include/wait.h create mode 100644 include/xtensa-config.h create mode 100644 include/xtensa-isa-internal.h create mode 100644 include/xtensa-isa.h delete mode 100755 install.sh create mode 100644 intl/ChangeLog create mode 100644 intl/Makefile.in create mode 100644 intl/acconfig.h create mode 100644 intl/aclocal.m4 create mode 100644 intl/bindtextdom.c create mode 100644 intl/cat-compat.c create mode 100644 intl/config.in create mode 100755 intl/configure create mode 100644 intl/configure.in create mode 100644 intl/dcgettext.c create mode 100644 intl/dgettext.c create mode 100644 intl/explodename.c create mode 100644 intl/finddomain.c create mode 100644 intl/gettext.c create mode 100644 intl/gettext.h create mode 100644 intl/gettextP.h create mode 100644 intl/hash-string.h create mode 100644 intl/intl-compat.c create mode 100644 intl/intlh.inst.in create mode 100644 intl/l10nflist.c create mode 100644 intl/libgettext.h create mode 100644 intl/libintl.glibc create mode 100644 intl/linux-msg.sed create mode 100644 intl/loadinfo.h create mode 100644 intl/loadmsgcat.c create mode 100644 intl/localealias.c create mode 100644 intl/po2tbl.sed.in create mode 100644 intl/textdomain.c create mode 100644 intl/xopen-msg.sed delete mode 100644 ld/acconfig.h delete mode 100644 ld/configdoc.texi create mode 100644 ld/emulparams/a29k.sh create mode 100644 ld/emulparams/aix5ppc.sh create mode 100644 ld/emulparams/aix5rs6.sh create mode 100644 ld/emulparams/aixppc.sh create mode 100644 ld/emulparams/aixrs6.sh create mode 100644 ld/emulparams/arm_epoc_pe.sh delete mode 100644 ld/emulparams/armelf_linux26.sh create mode 100644 ld/emulparams/armelfb.sh create mode 100644 ld/emulparams/armelfb_linux.sh create mode 100644 ld/emulparams/armnto.sh create mode 100644 ld/emulparams/avr1.sh create mode 100644 ld/emulparams/avr2.sh create mode 100644 ld/emulparams/avr3.sh create mode 100644 ld/emulparams/avr4.sh create mode 100644 ld/emulparams/avr5.sh create mode 100644 ld/emulparams/coff_i860.sh create mode 100644 ld/emulparams/crisaout.sh create mode 100644 ld/emulparams/criself.sh create mode 100644 ld/emulparams/crislinux.sh create mode 100644 ld/emulparams/d10velf.sh create mode 100644 ld/emulparams/d30v_e.sh create mode 100644 ld/emulparams/d30v_o.sh create mode 100644 ld/emulparams/d30velf.sh create mode 100644 ld/emulparams/delta68.sh create mode 100644 ld/emulparams/ebmon29k.sh create mode 100644 ld/emulparams/elf32_dlx.sh create mode 100644 ld/emulparams/elf32_i860.sh create mode 100644 ld/emulparams/elf32_i960.sh create mode 100644 ld/emulparams/elf32am33lin.sh create mode 100755 ld/emulparams/elf32fr30.sh create mode 100755 ld/emulparams/elf32frv.sh create mode 100644 ld/emulparams/elf32frvfd.sh create mode 100644 ld/emulparams/elf32i370.sh create mode 100644 ld/emulparams/elf32ip2k.sh create mode 100755 ld/emulparams/elf32iq10.sh create mode 100755 ld/emulparams/elf32iq2000.sh create mode 100644 ld/emulparams/elf32lppcnto.sh create mode 100644 ld/emulparams/elf32mcore.sh create mode 100755 ld/emulparams/elf32openrisc.sh create mode 100644 ld/emulparams/elf32ppcnto.sh create mode 100644 ld/emulparams/elf32ppcwindiss.sh create mode 100644 ld/emulparams/elf32vax.sh create mode 100644 ld/emulparams/elf32xstormy16.sh create mode 100644 ld/emulparams/elf32xtensa.sh create mode 100644 ld/emulparams/elf64_aix.sh create mode 100755 ld/emulparams/elf64hppa.sh create mode 100644 ld/emulparams/elf64mmix.sh create mode 100644 ld/emulparams/elf_i386_be.sh create mode 100644 ld/emulparams/gld960.sh create mode 100644 ld/emulparams/gld960coff.sh create mode 100644 ld/emulparams/h8300.sh create mode 100644 ld/emulparams/h8300elf.sh create mode 100644 ld/emulparams/h8300h.sh create mode 100644 ld/emulparams/h8300helf.sh create mode 100644 ld/emulparams/h8300hn.sh create mode 100644 ld/emulparams/h8300hnelf.sh create mode 100644 ld/emulparams/h8300s.sh create mode 100644 ld/emulparams/h8300self.sh create mode 100644 ld/emulparams/h8300sn.sh create mode 100644 ld/emulparams/h8300snelf.sh create mode 100644 ld/emulparams/h8300sx.sh create mode 100644 ld/emulparams/h8300sxelf.sh create mode 100644 ld/emulparams/h8300sxn.sh create mode 100644 ld/emulparams/h8300sxnelf.sh create mode 100644 ld/emulparams/h8500.sh create mode 100644 ld/emulparams/h8500b.sh create mode 100644 ld/emulparams/h8500c.sh create mode 100644 ld/emulparams/h8500m.sh create mode 100644 ld/emulparams/h8500s.sh create mode 100644 ld/emulparams/hp300bsd.sh create mode 100644 ld/emulparams/hp3hpux.sh create mode 100644 ld/emulparams/hppa64linux.sh create mode 100644 ld/emulparams/hppaelf.sh create mode 100644 ld/emulparams/hppalinux.sh create mode 100644 ld/emulparams/hppanbsd.sh create mode 100644 ld/emulparams/hppaobsd.sh create mode 100755 ld/emulparams/i386beos.sh create mode 100644 ld/emulparams/i386go32.sh create mode 100644 ld/emulparams/i386lynx.sh create mode 100644 ld/emulparams/i386mach.sh create mode 100644 ld/emulparams/i386msdos.sh create mode 100644 ld/emulparams/lnk960.sh create mode 100644 ld/emulparams/m32relf.sh create mode 100644 ld/emulparams/m32relf_linux.sh create mode 100644 ld/emulparams/m32rlelf.sh create mode 100644 ld/emulparams/m32rlelf_linux.sh create mode 100644 ld/emulparams/m68hc11elf.sh create mode 100644 ld/emulparams/m68hc11elfb.sh create mode 100644 ld/emulparams/m68hc12elf.sh create mode 100644 ld/emulparams/m68hc12elfb.sh create mode 100644 ld/emulparams/m68k4knbsd.sh create mode 100644 ld/emulparams/m68kaout.sh create mode 100644 ld/emulparams/m68kaux.sh create mode 100644 ld/emulparams/m68kcoff.sh create mode 100644 ld/emulparams/m68kelf.sh create mode 100644 ld/emulparams/m68kelfnbsd.sh create mode 100644 ld/emulparams/m68klinux.sh create mode 100644 ld/emulparams/m68klynx.sh create mode 100644 ld/emulparams/m68knbsd.sh create mode 100644 ld/emulparams/m68kpsos.sh create mode 100644 ld/emulparams/m88kbcs.sh create mode 100644 ld/emulparams/mcorepe.sh create mode 100644 ld/emulparams/mmo.sh create mode 100644 ld/emulparams/mn10200.sh create mode 100644 ld/emulparams/mn10300.sh create mode 100644 ld/emulparams/msp430all.sh create mode 100644 ld/emulparams/news.sh create mode 100644 ld/emulparams/ns32knbsd.sh create mode 100644 ld/emulparams/or32.sh create mode 100644 ld/emulparams/or32elf.sh create mode 100644 ld/emulparams/pc532macha.sh create mode 100644 ld/emulparams/pdp11.sh create mode 100644 ld/emulparams/pjelf.sh create mode 100644 ld/emulparams/pjlelf.sh create mode 100644 ld/emulparams/riscix.sh create mode 100644 ld/emulparams/sa29200.sh create mode 100644 ld/emulparams/shelf.sh create mode 100644 ld/emulparams/shelf32.sh create mode 100644 ld/emulparams/shelf32_linux.sh create mode 100644 ld/emulparams/shelf32_nbsd.sh create mode 100644 ld/emulparams/shelf64.sh create mode 100644 ld/emulparams/shelf64_nbsd.sh create mode 100644 ld/emulparams/shelf_linux.sh create mode 100644 ld/emulparams/shelf_nbsd.sh create mode 100644 ld/emulparams/shelf_nto.sh create mode 100644 ld/emulparams/shlelf32.sh create mode 100644 ld/emulparams/shlelf32_linux.sh create mode 100644 ld/emulparams/shlelf32_nbsd.sh create mode 100644 ld/emulparams/shlelf64.sh create mode 100644 ld/emulparams/shlelf64_nbsd.sh create mode 100644 ld/emulparams/shlelf_linux.sh create mode 100644 ld/emulparams/shlelf_nbsd.sh create mode 100644 ld/emulparams/shlelf_nto.sh create mode 100644 ld/emulparams/shpe.sh create mode 100644 ld/emulparams/sparclynx.sh create mode 100644 ld/emulparams/st2000.sh create mode 100644 ld/emulparams/sun3.sh create mode 100644 ld/emulparams/tic30aout.sh create mode 100644 ld/emulparams/tic30coff.sh create mode 100644 ld/emulparams/tic3xcoff.sh create mode 100644 ld/emulparams/tic3xcoff_onchip.sh create mode 100644 ld/emulparams/tic4xcoff.sh create mode 100644 ld/emulparams/tic54xcoff.sh create mode 100644 ld/emulparams/tic80coff.sh create mode 100644 ld/emulparams/v850.sh create mode 100644 ld/emulparams/vax.sh create mode 100644 ld/emulparams/vaxnbsd.sh create mode 100644 ld/emulparams/w65.sh create mode 100644 ld/emulparams/xtensa-config.sh create mode 100644 ld/emulparams/z8001.sh create mode 100644 ld/emulparams/z8002.sh create mode 100644 ld/emultempl/aix.em create mode 100644 ld/emultempl/beos.em create mode 100644 ld/emultempl/gld960.em create mode 100644 ld/emultempl/gld960c.em create mode 100644 ld/emultempl/hppaelf.em create mode 100644 ld/emultempl/irix.em create mode 100644 ld/emultempl/lnk960.em create mode 100644 ld/emultempl/m68hc1xelf.em create mode 100644 ld/emultempl/m68kcoff.em create mode 100644 ld/emultempl/m68kelf.em create mode 100644 ld/emultempl/mmix-elfnmmo.em create mode 100644 ld/emultempl/mmixelf.em create mode 100644 ld/emultempl/mmo.em create mode 100644 ld/emultempl/sh64elf.em delete mode 100644 ld/emultempl/stringify.sed create mode 100644 ld/emultempl/xtensaelf.em create mode 100644 ld/ld.info create mode 100644 ld/ldgram.c create mode 100644 ld/ldgram.h create mode 100644 ld/ldlex.c create mode 100644 ld/mac-ld.r create mode 100644 ld/mpw-config.in create mode 100644 ld/mpw-make.sed create mode 100644 ld/po/.cvsignore create mode 100644 ld/po/da.gmo create mode 100644 ld/po/da.po create mode 100644 ld/po/es.gmo create mode 100644 ld/po/es.po create mode 100644 ld/po/fr.gmo create mode 100644 ld/po/fr.po create mode 100644 ld/po/sv.gmo create mode 100644 ld/po/sv.po create mode 100644 ld/po/tr.gmo create mode 100644 ld/po/tr.po create mode 100644 ld/scripttempl/a29k.sc create mode 100644 ld/scripttempl/aix.sc create mode 100644 ld/scripttempl/avr.sc create mode 100644 ld/scripttempl/crisaout.sc create mode 100644 ld/scripttempl/delta68.sc create mode 100644 ld/scripttempl/dlx.sc create mode 100644 ld/scripttempl/ebmon29k.sc create mode 100644 ld/scripttempl/elf32msp430.sc create mode 100644 ld/scripttempl/elf32msp430_3.sc create mode 100644 ld/scripttempl/elf_chaos.sc create mode 100644 ld/scripttempl/elfd10v.sc create mode 100644 ld/scripttempl/elfd30v.sc create mode 100644 ld/scripttempl/elfi370.sc create mode 100644 ld/scripttempl/elfm68hc11.sc create mode 100644 ld/scripttempl/elfm68hc12.sc delete mode 100644 ld/scripttempl/elfppc.sc create mode 100644 ld/scripttempl/elfxtensa.sc create mode 100644 ld/scripttempl/epocpe.sc create mode 100644 ld/scripttempl/h8300.sc create mode 100644 ld/scripttempl/h8300h.sc create mode 100644 ld/scripttempl/h8300hn.sc create mode 100644 ld/scripttempl/h8300s.sc create mode 100644 ld/scripttempl/h8300sn.sc create mode 100644 ld/scripttempl/h8300sx.sc create mode 100644 ld/scripttempl/h8300sxn.sc create mode 100644 ld/scripttempl/h8500.sc create mode 100644 ld/scripttempl/h8500b.sc create mode 100644 ld/scripttempl/h8500c.sc create mode 100644 ld/scripttempl/h8500m.sc create mode 100644 ld/scripttempl/h8500s.sc create mode 100644 ld/scripttempl/hppaelf.sc create mode 100644 ld/scripttempl/i386beos.sc create mode 100644 ld/scripttempl/i386go32.sc create mode 100644 ld/scripttempl/i386lynx.sc create mode 100644 ld/scripttempl/i386msdos.sc create mode 100644 ld/scripttempl/i860coff.sc create mode 100644 ld/scripttempl/i960.sc create mode 100644 ld/scripttempl/ip2k.sc create mode 100644 ld/scripttempl/iq2000.sc create mode 100644 ld/scripttempl/m68kaux.sc create mode 100644 ld/scripttempl/m68kcoff.sc create mode 100644 ld/scripttempl/m68klynx.sc create mode 100644 ld/scripttempl/m88kbcs.sc create mode 100644 ld/scripttempl/mcorepe.sc create mode 100644 ld/scripttempl/mmo.sc create mode 100644 ld/scripttempl/or32.sc create mode 100644 ld/scripttempl/pj.sc create mode 100644 ld/scripttempl/psos.sc create mode 100644 ld/scripttempl/riscix.sc create mode 100644 ld/scripttempl/sa29200.sc create mode 100644 ld/scripttempl/sparclynx.sc create mode 100644 ld/scripttempl/st2000.sc create mode 100644 ld/scripttempl/tic4xcoff.sc create mode 100644 ld/scripttempl/tic54xcoff.sc create mode 100644 ld/scripttempl/tic80coff.sc create mode 100644 ld/scripttempl/w65.sc create mode 100644 ld/scripttempl/xstormy16.sc create mode 100644 ld/testsuite/ChangeLog create mode 100644 ld/testsuite/ChangeLog-9303 create mode 100644 ld/testsuite/config/default.exp create mode 100644 ld/testsuite/ld-alpha/align.s create mode 100644 ld/testsuite/ld-alpha/alpha.exp create mode 100644 ld/testsuite/ld-alpha/tlsbin.dd create mode 100644 ld/testsuite/ld-alpha/tlsbin.rd create mode 100644 ld/testsuite/ld-alpha/tlsbin.s create mode 100644 ld/testsuite/ld-alpha/tlsbin.sd create mode 100644 ld/testsuite/ld-alpha/tlsbin.td create mode 100644 ld/testsuite/ld-alpha/tlsbinpic.s create mode 100644 ld/testsuite/ld-alpha/tlsbinr.dd create mode 100644 ld/testsuite/ld-alpha/tlsbinr.rd create mode 100644 ld/testsuite/ld-alpha/tlsbinr.sd create mode 100644 ld/testsuite/ld-alpha/tlsg.s create mode 100644 ld/testsuite/ld-alpha/tlsg.sd create mode 100644 ld/testsuite/ld-alpha/tlslib.s create mode 100644 ld/testsuite/ld-alpha/tlspic.dd create mode 100644 ld/testsuite/ld-alpha/tlspic.rd create mode 100644 ld/testsuite/ld-alpha/tlspic.sd create mode 100644 ld/testsuite/ld-alpha/tlspic.td create mode 100644 ld/testsuite/ld-alpha/tlspic1.s create mode 100644 ld/testsuite/ld-alpha/tlspic2.s create mode 100644 ld/testsuite/ld-arm/arm-app-abs32.d create mode 100644 ld/testsuite/ld-arm/arm-app-abs32.r create mode 100644 ld/testsuite/ld-arm/arm-app-abs32.s create mode 100644 ld/testsuite/ld-arm/arm-app.d create mode 100644 ld/testsuite/ld-arm/arm-app.r create mode 100644 ld/testsuite/ld-arm/arm-app.s create mode 100644 ld/testsuite/ld-arm/arm-elf.exp create mode 100644 ld/testsuite/ld-arm/arm-lib-plt32.d create mode 100644 ld/testsuite/ld-arm/arm-lib-plt32.r create mode 100644 ld/testsuite/ld-arm/arm-lib-plt32.s create mode 100644 ld/testsuite/ld-arm/arm-lib.d create mode 100644 ld/testsuite/ld-arm/arm-lib.r create mode 100644 ld/testsuite/ld-arm/arm-lib.s create mode 100644 ld/testsuite/ld-arm/arm-static-app.d create mode 100644 ld/testsuite/ld-arm/arm-static-app.r create mode 100644 ld/testsuite/ld-arm/arm-static-app.s create mode 100644 ld/testsuite/ld-auto-import/auto-import.exp create mode 100644 ld/testsuite/ld-auto-import/client.c create mode 100644 ld/testsuite/ld-auto-import/dll.c create mode 100644 ld/testsuite/ld-bootstrap/bootstrap.exp create mode 100644 ld/testsuite/ld-cdtest/cdtest-bar.cc create mode 100644 ld/testsuite/ld-cdtest/cdtest-foo.cc create mode 100644 ld/testsuite/ld-cdtest/cdtest-foo.h create mode 100644 ld/testsuite/ld-cdtest/cdtest-main.cc create mode 100644 ld/testsuite/ld-cdtest/cdtest-nrv.dat create mode 100644 ld/testsuite/ld-cdtest/cdtest.dat create mode 100644 ld/testsuite/ld-cdtest/cdtest.exp create mode 100644 ld/testsuite/ld-checks/asm.s create mode 100644 ld/testsuite/ld-checks/checks.exp create mode 100644 ld/testsuite/ld-checks/script create mode 100644 ld/testsuite/ld-cris/badgotr1.d create mode 100644 ld/testsuite/ld-cris/comref1.s create mode 100644 ld/testsuite/ld-cris/cris.exp create mode 100644 ld/testsuite/ld-cris/dso-1.s create mode 100644 ld/testsuite/ld-cris/dso-2.s create mode 100644 ld/testsuite/ld-cris/dso-3.s create mode 100644 ld/testsuite/ld-cris/dsofnf.s create mode 100644 ld/testsuite/ld-cris/dsofnf2.s create mode 100644 ld/testsuite/ld-cris/euwref1.s create mode 100644 ld/testsuite/ld-cris/expdref1.s create mode 100644 ld/testsuite/ld-cris/expdyn1.d create mode 100644 ld/testsuite/ld-cris/expdyn1.s create mode 100644 ld/testsuite/ld-cris/expdyn2.d create mode 100644 ld/testsuite/ld-cris/expdyn3.d create mode 100644 ld/testsuite/ld-cris/expdyn4.d create mode 100644 ld/testsuite/ld-cris/expdyn5.d create mode 100644 ld/testsuite/ld-cris/expdyn6.d create mode 100644 ld/testsuite/ld-cris/expdyn7.d create mode 100644 ld/testsuite/ld-cris/gotplt1.d create mode 100644 ld/testsuite/ld-cris/gotplt2.d create mode 100644 ld/testsuite/ld-cris/gotplt3.d create mode 100644 ld/testsuite/ld-cris/gotrel1.s create mode 100644 ld/testsuite/ld-cris/gotrel2.s create mode 100644 ld/testsuite/ld-cris/hide1 create mode 100644 ld/testsuite/ld-cris/ldsym1.d create mode 100644 ld/testsuite/ld-cris/libdso-1.d create mode 100644 ld/testsuite/ld-cris/libdso-2.d create mode 100644 ld/testsuite/ld-cris/libdso-3.d create mode 100644 ld/testsuite/ld-cris/libdso-4.d create mode 100644 ld/testsuite/ld-cris/locref1.d create mode 100644 ld/testsuite/ld-cris/locref1.s create mode 100644 ld/testsuite/ld-cris/locref2.d create mode 100644 ld/testsuite/ld-cris/locref2.s create mode 100644 ld/testsuite/ld-cris/nodyn4.d create mode 100644 ld/testsuite/ld-cris/nodyn5.d create mode 100644 ld/testsuite/ld-cris/noglob1.d create mode 100644 ld/testsuite/ld-cris/noglob1.s create mode 100644 ld/testsuite/ld-cris/undef1.d create mode 100644 ld/testsuite/ld-cris/weakref1.d create mode 100644 ld/testsuite/ld-cris/weakref2.d create mode 100644 ld/testsuite/ld-cygwin/exe-export.exp create mode 100644 ld/testsuite/ld-cygwin/testdll.c create mode 100644 ld/testsuite/ld-cygwin/testdll.def create mode 100644 ld/testsuite/ld-cygwin/testexe.c create mode 100644 ld/testsuite/ld-cygwin/testexe.def create mode 100644 ld/testsuite/ld-d10v/d10v.exp create mode 100644 ld/testsuite/ld-d10v/default_layout.d create mode 100644 ld/testsuite/ld-d10v/linktest-001.s create mode 100644 ld/testsuite/ld-d10v/linktest-002.lt create mode 100644 ld/testsuite/ld-d10v/linktest-002.s create mode 100644 ld/testsuite/ld-d10v/regression-001.lt create mode 100644 ld/testsuite/ld-d10v/regression-001.s create mode 100644 ld/testsuite/ld-d10v/reloc-001.d create mode 100644 ld/testsuite/ld-d10v/reloc-001.ld create mode 100644 ld/testsuite/ld-d10v/reloc-001.s create mode 100644 ld/testsuite/ld-d10v/reloc-002.d create mode 100644 ld/testsuite/ld-d10v/reloc-002.ld create mode 100644 ld/testsuite/ld-d10v/reloc-003.d create mode 100644 ld/testsuite/ld-d10v/reloc-003.ld create mode 100644 ld/testsuite/ld-d10v/reloc-004.d create mode 100644 ld/testsuite/ld-d10v/reloc-004.ld create mode 100644 ld/testsuite/ld-d10v/reloc-005.d create mode 100644 ld/testsuite/ld-d10v/reloc-005.ld create mode 100644 ld/testsuite/ld-d10v/reloc-005.s create mode 100644 ld/testsuite/ld-d10v/reloc-006.d create mode 100644 ld/testsuite/ld-d10v/reloc-006.ld create mode 100644 ld/testsuite/ld-d10v/reloc-007.d create mode 100644 ld/testsuite/ld-d10v/reloc-007.ld create mode 100644 ld/testsuite/ld-d10v/reloc-008.d create mode 100644 ld/testsuite/ld-d10v/reloc-008.ld create mode 100644 ld/testsuite/ld-d10v/reloc-009.d create mode 100644 ld/testsuite/ld-d10v/reloc-009.ld create mode 100644 ld/testsuite/ld-d10v/reloc-009.s create mode 100644 ld/testsuite/ld-d10v/reloc-010.d create mode 100644 ld/testsuite/ld-d10v/reloc-010.ld create mode 100644 ld/testsuite/ld-d10v/reloc-011.d create mode 100644 ld/testsuite/ld-d10v/reloc-011.ld create mode 100644 ld/testsuite/ld-d10v/reloc-012.d create mode 100644 ld/testsuite/ld-d10v/reloc-012.ld create mode 100644 ld/testsuite/ld-d10v/reloc-013.d create mode 100644 ld/testsuite/ld-d10v/reloc-013.ld create mode 100644 ld/testsuite/ld-d10v/reloc-014.d create mode 100644 ld/testsuite/ld-d10v/reloc-014.ld create mode 100644 ld/testsuite/ld-d10v/reloc-015.d create mode 100644 ld/testsuite/ld-d10v/reloc-015.ld create mode 100644 ld/testsuite/ld-d10v/reloc-016.d create mode 100644 ld/testsuite/ld-d10v/reloc-016.ld create mode 100644 ld/testsuite/ld-d10v/simple.s create mode 100644 ld/testsuite/ld-discard/discard.exp create mode 100644 ld/testsuite/ld-discard/discard.ld create mode 100644 ld/testsuite/ld-discard/exit.s create mode 100644 ld/testsuite/ld-discard/extern.d create mode 100644 ld/testsuite/ld-discard/extern.s create mode 100644 ld/testsuite/ld-discard/start.d create mode 100644 ld/testsuite/ld-discard/start.s create mode 100644 ld/testsuite/ld-discard/static.d create mode 100644 ld/testsuite/ld-discard/static.s create mode 100644 ld/testsuite/ld-elf/elf.exp create mode 100644 ld/testsuite/ld-elf/merge.d create mode 100644 ld/testsuite/ld-elf/merge.ld create mode 100644 ld/testsuite/ld-elf/merge.s create mode 100644 ld/testsuite/ld-elf/merge2.d create mode 100644 ld/testsuite/ld-elf/merge2.s create mode 100644 ld/testsuite/ld-elf/sec64k.exp create mode 100644 ld/testsuite/ld-elfcomm/common1a.c create mode 100644 ld/testsuite/ld-elfcomm/common1b.c create mode 100644 ld/testsuite/ld-elfcomm/elfcomm.exp create mode 100644 ld/testsuite/ld-elfvers/vers.exp create mode 100644 ld/testsuite/ld-elfvers/vers1.c create mode 100644 ld/testsuite/ld-elfvers/vers1.dsym create mode 100644 ld/testsuite/ld-elfvers/vers1.map create mode 100644 ld/testsuite/ld-elfvers/vers1.sym create mode 100644 ld/testsuite/ld-elfvers/vers1.ver create mode 100644 ld/testsuite/ld-elfvers/vers13.asym create mode 100644 ld/testsuite/ld-elfvers/vers15.c create mode 100644 ld/testsuite/ld-elfvers/vers15.dsym create mode 100644 ld/testsuite/ld-elfvers/vers15.sym create mode 100644 ld/testsuite/ld-elfvers/vers15.ver create mode 100644 ld/testsuite/ld-elfvers/vers16.c create mode 100644 ld/testsuite/ld-elfvers/vers16.dsym create mode 100644 ld/testsuite/ld-elfvers/vers16.map create mode 100644 ld/testsuite/ld-elfvers/vers16a.c create mode 100644 ld/testsuite/ld-elfvers/vers16a.dsym create mode 100644 ld/testsuite/ld-elfvers/vers16a.ver create mode 100644 ld/testsuite/ld-elfvers/vers17.c create mode 100644 ld/testsuite/ld-elfvers/vers17.dsym create mode 100644 ld/testsuite/ld-elfvers/vers17.map create mode 100644 ld/testsuite/ld-elfvers/vers17.ver create mode 100644 ld/testsuite/ld-elfvers/vers18.c create mode 100644 ld/testsuite/ld-elfvers/vers18.dsym create mode 100644 ld/testsuite/ld-elfvers/vers18.map create mode 100644 ld/testsuite/ld-elfvers/vers18.sym create mode 100644 ld/testsuite/ld-elfvers/vers18.ver create mode 100644 ld/testsuite/ld-elfvers/vers19.c create mode 100644 ld/testsuite/ld-elfvers/vers19.dsym create mode 100644 ld/testsuite/ld-elfvers/vers19.ver create mode 100644 ld/testsuite/ld-elfvers/vers2.c create mode 100644 ld/testsuite/ld-elfvers/vers2.dsym create mode 100644 ld/testsuite/ld-elfvers/vers2.map create mode 100644 ld/testsuite/ld-elfvers/vers2.ver create mode 100644 ld/testsuite/ld-elfvers/vers20.c create mode 100644 ld/testsuite/ld-elfvers/vers20.dsym create mode 100644 ld/testsuite/ld-elfvers/vers20.map create mode 100644 ld/testsuite/ld-elfvers/vers20.ver create mode 100644 ld/testsuite/ld-elfvers/vers20a.ver create mode 100644 ld/testsuite/ld-elfvers/vers21.c create mode 100644 ld/testsuite/ld-elfvers/vers21.dsym create mode 100644 ld/testsuite/ld-elfvers/vers21.map create mode 100644 ld/testsuite/ld-elfvers/vers21.sym create mode 100644 ld/testsuite/ld-elfvers/vers21.ver create mode 100644 ld/testsuite/ld-elfvers/vers22.c create mode 100644 ld/testsuite/ld-elfvers/vers22.dsym create mode 100644 ld/testsuite/ld-elfvers/vers22.map create mode 100644 ld/testsuite/ld-elfvers/vers22.ver create mode 100644 ld/testsuite/ld-elfvers/vers22a.c create mode 100644 ld/testsuite/ld-elfvers/vers22a.dsym create mode 100644 ld/testsuite/ld-elfvers/vers22a.sym create mode 100644 ld/testsuite/ld-elfvers/vers22a.ver create mode 100644 ld/testsuite/ld-elfvers/vers22b.c create mode 100644 ld/testsuite/ld-elfvers/vers22b.dsym create mode 100644 ld/testsuite/ld-elfvers/vers22b.ver create mode 100644 ld/testsuite/ld-elfvers/vers23.c create mode 100644 ld/testsuite/ld-elfvers/vers23.dsym create mode 100644 ld/testsuite/ld-elfvers/vers23.ver create mode 100644 ld/testsuite/ld-elfvers/vers23a.c create mode 100644 ld/testsuite/ld-elfvers/vers23a.dsym create mode 100644 ld/testsuite/ld-elfvers/vers23a.map create mode 100644 ld/testsuite/ld-elfvers/vers23a.sym create mode 100644 ld/testsuite/ld-elfvers/vers23a.ver create mode 100644 ld/testsuite/ld-elfvers/vers23b.c create mode 100644 ld/testsuite/ld-elfvers/vers23b.dsym create mode 100644 ld/testsuite/ld-elfvers/vers23b.map create mode 100644 ld/testsuite/ld-elfvers/vers23b.ver create mode 100644 ld/testsuite/ld-elfvers/vers23c.ver create mode 100644 ld/testsuite/ld-elfvers/vers23d.dsym create mode 100644 ld/testsuite/ld-elfvers/vers24.map create mode 100644 ld/testsuite/ld-elfvers/vers24.rd create mode 100644 ld/testsuite/ld-elfvers/vers24a.c create mode 100644 ld/testsuite/ld-elfvers/vers24b.c create mode 100644 ld/testsuite/ld-elfvers/vers24c.c create mode 100644 ld/testsuite/ld-elfvers/vers25a.c create mode 100644 ld/testsuite/ld-elfvers/vers25a.dsym create mode 100644 ld/testsuite/ld-elfvers/vers25a.map create mode 100644 ld/testsuite/ld-elfvers/vers25a.ver create mode 100644 ld/testsuite/ld-elfvers/vers25b.c create mode 100644 ld/testsuite/ld-elfvers/vers25b.dsym create mode 100644 ld/testsuite/ld-elfvers/vers25b.ver create mode 100644 ld/testsuite/ld-elfvers/vers26a.c create mode 100644 ld/testsuite/ld-elfvers/vers26a.dsym create mode 100644 ld/testsuite/ld-elfvers/vers26a.map create mode 100644 ld/testsuite/ld-elfvers/vers26a.ver create mode 100644 ld/testsuite/ld-elfvers/vers26b.c create mode 100644 ld/testsuite/ld-elfvers/vers26b.dsym create mode 100644 ld/testsuite/ld-elfvers/vers26b.ver create mode 100644 ld/testsuite/ld-elfvers/vers27a.c create mode 100644 ld/testsuite/ld-elfvers/vers27a.dsym create mode 100644 ld/testsuite/ld-elfvers/vers27a.map create mode 100644 ld/testsuite/ld-elfvers/vers27a.ver create mode 100644 ld/testsuite/ld-elfvers/vers27b.c create mode 100644 ld/testsuite/ld-elfvers/vers27b.dsym create mode 100644 ld/testsuite/ld-elfvers/vers27b.ver create mode 100644 ld/testsuite/ld-elfvers/vers27c.c create mode 100644 ld/testsuite/ld-elfvers/vers27c.dsym create mode 100644 ld/testsuite/ld-elfvers/vers27c.ver create mode 100644 ld/testsuite/ld-elfvers/vers27d.dsym create mode 100644 ld/testsuite/ld-elfvers/vers27d.sym create mode 100644 ld/testsuite/ld-elfvers/vers27d.ver create mode 100644 ld/testsuite/ld-elfvers/vers27d1.c create mode 100644 ld/testsuite/ld-elfvers/vers27d2.c create mode 100644 ld/testsuite/ld-elfvers/vers27d3.c create mode 100644 ld/testsuite/ld-elfvers/vers27d4.dsym create mode 100644 ld/testsuite/ld-elfvers/vers27d4.ver create mode 100644 ld/testsuite/ld-elfvers/vers28a.c create mode 100644 ld/testsuite/ld-elfvers/vers28a.dsym create mode 100644 ld/testsuite/ld-elfvers/vers28a.ver create mode 100644 ld/testsuite/ld-elfvers/vers28b.c create mode 100644 ld/testsuite/ld-elfvers/vers28b.dsym create mode 100644 ld/testsuite/ld-elfvers/vers28b.map create mode 100644 ld/testsuite/ld-elfvers/vers28b.ver create mode 100644 ld/testsuite/ld-elfvers/vers28c.c create mode 100644 ld/testsuite/ld-elfvers/vers28c.dsym create mode 100644 ld/testsuite/ld-elfvers/vers28c.ver create mode 100644 ld/testsuite/ld-elfvers/vers3.c create mode 100644 ld/testsuite/ld-elfvers/vers3.dsym create mode 100644 ld/testsuite/ld-elfvers/vers3.ver create mode 100644 ld/testsuite/ld-elfvers/vers4.c create mode 100644 ld/testsuite/ld-elfvers/vers4.sym create mode 100644 ld/testsuite/ld-elfvers/vers4a.dsym create mode 100644 ld/testsuite/ld-elfvers/vers4a.sym create mode 100644 ld/testsuite/ld-elfvers/vers4a.ver create mode 100644 ld/testsuite/ld-elfvers/vers5.c create mode 100644 ld/testsuite/ld-elfvers/vers6.c create mode 100644 ld/testsuite/ld-elfvers/vers6.dsym create mode 100644 ld/testsuite/ld-elfvers/vers6.sym create mode 100644 ld/testsuite/ld-elfvers/vers6.ver create mode 100644 ld/testsuite/ld-elfvers/vers7.c create mode 100644 ld/testsuite/ld-elfvers/vers7.map create mode 100644 ld/testsuite/ld-elfvers/vers7a.c create mode 100644 ld/testsuite/ld-elfvers/vers7a.dsym create mode 100644 ld/testsuite/ld-elfvers/vers7a.sym create mode 100644 ld/testsuite/ld-elfvers/vers7a.ver create mode 100644 ld/testsuite/ld-elfvers/vers8.c create mode 100644 ld/testsuite/ld-elfvers/vers8.map create mode 100644 ld/testsuite/ld-elfvers/vers8.ver create mode 100644 ld/testsuite/ld-elfvers/vers9.c create mode 100644 ld/testsuite/ld-elfvers/vers9.dsym create mode 100644 ld/testsuite/ld-elfvers/vers9.sym create mode 100644 ld/testsuite/ld-elfvers/vers9.ver create mode 100644 ld/testsuite/ld-elfvsb/common.c create mode 100644 ld/testsuite/ld-elfvsb/define.s create mode 100644 ld/testsuite/ld-elfvsb/elf-offset.ld create mode 100644 ld/testsuite/ld-elfvsb/elfvsb.dat create mode 100644 ld/testsuite/ld-elfvsb/elfvsb.exp create mode 100644 ld/testsuite/ld-elfvsb/hidden0.d create mode 100644 ld/testsuite/ld-elfvsb/hidden1.d create mode 100644 ld/testsuite/ld-elfvsb/internal0.d create mode 100644 ld/testsuite/ld-elfvsb/internal1.d create mode 100644 ld/testsuite/ld-elfvsb/main.c create mode 100644 ld/testsuite/ld-elfvsb/protected0.d create mode 100644 ld/testsuite/ld-elfvsb/protected1.d create mode 100644 ld/testsuite/ld-elfvsb/sh1.c create mode 100644 ld/testsuite/ld-elfvsb/sh2.c create mode 100644 ld/testsuite/ld-elfvsb/sh3.c create mode 100644 ld/testsuite/ld-elfvsb/test.c create mode 100644 ld/testsuite/ld-elfvsb/undef.s create mode 100644 ld/testsuite/ld-elfweak/bar.c create mode 100644 ld/testsuite/ld-elfweak/bar1a.c create mode 100644 ld/testsuite/ld-elfweak/bar1b.c create mode 100644 ld/testsuite/ld-elfweak/bar1c.c create mode 100644 ld/testsuite/ld-elfweak/dso.dsym create mode 100644 ld/testsuite/ld-elfweak/dsodata.dsym create mode 100644 ld/testsuite/ld-elfweak/dsow.dsym create mode 100644 ld/testsuite/ld-elfweak/dsowdata.dsym create mode 100644 ld/testsuite/ld-elfweak/elfweak.exp create mode 100644 ld/testsuite/ld-elfweak/foo.c create mode 100644 ld/testsuite/ld-elfweak/foo1a.c create mode 100644 ld/testsuite/ld-elfweak/foo1b.c create mode 100644 ld/testsuite/ld-elfweak/main.c create mode 100644 ld/testsuite/ld-elfweak/main1.c create mode 100644 ld/testsuite/ld-elfweak/strong.dat create mode 100644 ld/testsuite/ld-elfweak/strong.sym create mode 100644 ld/testsuite/ld-elfweak/strongcomm.sym create mode 100644 ld/testsuite/ld-elfweak/strongdata.dat create mode 100644 ld/testsuite/ld-elfweak/strongdata.sym create mode 100644 ld/testsuite/ld-elfweak/weak.dat create mode 100644 ld/testsuite/ld-elfweak/weak.dsym create mode 100644 ld/testsuite/ld-elfweak/weakdata.dat create mode 100644 ld/testsuite/ld-elfweak/weakdata.dsym create mode 100644 ld/testsuite/ld-empic/empic.exp create mode 100644 ld/testsuite/ld-empic/relax.t create mode 100644 ld/testsuite/ld-empic/relax1.c create mode 100644 ld/testsuite/ld-empic/relax2.c create mode 100644 ld/testsuite/ld-empic/relax3.c create mode 100644 ld/testsuite/ld-empic/relax4.c create mode 100644 ld/testsuite/ld-empic/run.c create mode 100644 ld/testsuite/ld-empic/runtest1.c create mode 100644 ld/testsuite/ld-empic/runtest2.c create mode 100644 ld/testsuite/ld-empic/runtesti.s create mode 100644 ld/testsuite/ld-fastcall/export.s create mode 100644 ld/testsuite/ld-fastcall/fastcall.exp create mode 100644 ld/testsuite/ld-fastcall/import.s create mode 100644 ld/testsuite/ld-frv/fdpic-pie-1.d create mode 100644 ld/testsuite/ld-frv/fdpic-pie-2.d create mode 100644 ld/testsuite/ld-frv/fdpic-pie-5.d create mode 100644 ld/testsuite/ld-frv/fdpic-pie-6-fail.d create mode 100644 ld/testsuite/ld-frv/fdpic-pie-6.d create mode 100644 ld/testsuite/ld-frv/fdpic-pie-7.d create mode 100644 ld/testsuite/ld-frv/fdpic-pie-8-fail.d create mode 100644 ld/testsuite/ld-frv/fdpic-pie-8.d create mode 100644 ld/testsuite/ld-frv/fdpic-shared-1.d create mode 100644 ld/testsuite/ld-frv/fdpic-shared-2-fail.d create mode 100644 ld/testsuite/ld-frv/fdpic-shared-2.d create mode 100644 ld/testsuite/ld-frv/fdpic-shared-3.d create mode 100644 ld/testsuite/ld-frv/fdpic-shared-4.d create mode 100644 ld/testsuite/ld-frv/fdpic-shared-5.d create mode 100644 ld/testsuite/ld-frv/fdpic-shared-6-fail.d create mode 100644 ld/testsuite/ld-frv/fdpic-shared-6.d create mode 100644 ld/testsuite/ld-frv/fdpic-shared-7.d create mode 100644 ld/testsuite/ld-frv/fdpic-shared-8-fail.d create mode 100644 ld/testsuite/ld-frv/fdpic-shared-8.d create mode 100644 ld/testsuite/ld-frv/fdpic-shared-local-2.d create mode 100644 ld/testsuite/ld-frv/fdpic-shared-local-8.d create mode 100644 ld/testsuite/ld-frv/fdpic-static-1.d create mode 100644 ld/testsuite/ld-frv/fdpic-static-2.d create mode 100644 ld/testsuite/ld-frv/fdpic-static-5.d create mode 100644 ld/testsuite/ld-frv/fdpic-static-6.d create mode 100644 ld/testsuite/ld-frv/fdpic-static-7.d create mode 100644 ld/testsuite/ld-frv/fdpic-static-8.d create mode 100644 ld/testsuite/ld-frv/fdpic.exp create mode 100644 ld/testsuite/ld-frv/fdpic1.s create mode 100644 ld/testsuite/ld-frv/fdpic2.ldv create mode 100644 ld/testsuite/ld-frv/fdpic2.s create mode 100644 ld/testsuite/ld-frv/fdpic2min.ldv create mode 100644 ld/testsuite/ld-frv/fdpic3.s create mode 100644 ld/testsuite/ld-frv/fdpic4.s create mode 100644 ld/testsuite/ld-frv/fdpic5.s create mode 100644 ld/testsuite/ld-frv/fdpic6.ldv create mode 100644 ld/testsuite/ld-frv/fdpic6.s create mode 100644 ld/testsuite/ld-frv/fdpic7.s create mode 100644 ld/testsuite/ld-frv/fdpic8.ldv create mode 100644 ld/testsuite/ld-frv/fdpic8.s create mode 100644 ld/testsuite/ld-frv/fdpic8min.ldv create mode 100644 ld/testsuite/ld-h8300/h8300.exp create mode 100644 ld/testsuite/ld-h8300/relax-2.d create mode 100644 ld/testsuite/ld-h8300/relax-2.s create mode 100644 ld/testsuite/ld-h8300/relax-3-coff.d create mode 100644 ld/testsuite/ld-h8300/relax-3.d create mode 100644 ld/testsuite/ld-h8300/relax-3.s create mode 100644 ld/testsuite/ld-h8300/relax-4-coff.d create mode 100644 ld/testsuite/ld-h8300/relax-4.d create mode 100644 ld/testsuite/ld-h8300/relax-4.s create mode 100644 ld/testsuite/ld-h8300/relax-5-coff.d create mode 100644 ld/testsuite/ld-h8300/relax-5.d create mode 100644 ld/testsuite/ld-h8300/relax-5.s create mode 100644 ld/testsuite/ld-h8300/relax.d create mode 100644 ld/testsuite/ld-h8300/relax.s create mode 100644 ld/testsuite/ld-i386/combreloc.d create mode 100644 ld/testsuite/ld-i386/combreloc.s create mode 100644 ld/testsuite/ld-i386/i386.exp create mode 100644 ld/testsuite/ld-i386/reloc.d create mode 100644 ld/testsuite/ld-i386/reloc.s create mode 100644 ld/testsuite/ld-i386/tlsbin.dd create mode 100644 ld/testsuite/ld-i386/tlsbin.rd create mode 100644 ld/testsuite/ld-i386/tlsbin.s create mode 100644 ld/testsuite/ld-i386/tlsbin.sd create mode 100644 ld/testsuite/ld-i386/tlsbin.td create mode 100644 ld/testsuite/ld-i386/tlsbinpic.s create mode 100644 ld/testsuite/ld-i386/tlsg.s create mode 100644 ld/testsuite/ld-i386/tlsg.sd create mode 100644 ld/testsuite/ld-i386/tlsindntpoff.dd create mode 100644 ld/testsuite/ld-i386/tlsindntpoff.s create mode 100644 ld/testsuite/ld-i386/tlslib.s create mode 100644 ld/testsuite/ld-i386/tlsnopic.dd create mode 100644 ld/testsuite/ld-i386/tlsnopic.rd create mode 100644 ld/testsuite/ld-i386/tlsnopic.sd create mode 100644 ld/testsuite/ld-i386/tlsnopic1.s create mode 100644 ld/testsuite/ld-i386/tlsnopic2.s create mode 100644 ld/testsuite/ld-i386/tlspic.dd create mode 100644 ld/testsuite/ld-i386/tlspic.rd create mode 100644 ld/testsuite/ld-i386/tlspic.sd create mode 100644 ld/testsuite/ld-i386/tlspic.td create mode 100644 ld/testsuite/ld-i386/tlspic1.s create mode 100644 ld/testsuite/ld-i386/tlspic2.s create mode 100644 ld/testsuite/ld-ia64/ia64.exp create mode 100644 ld/testsuite/ld-ia64/tlsbin.dd create mode 100644 ld/testsuite/ld-ia64/tlsbin.rd create mode 100644 ld/testsuite/ld-ia64/tlsbin.s create mode 100644 ld/testsuite/ld-ia64/tlsbin.sd create mode 100644 ld/testsuite/ld-ia64/tlsbin.td create mode 100644 ld/testsuite/ld-ia64/tlsbinpic.s create mode 100644 ld/testsuite/ld-ia64/tlsg.s create mode 100644 ld/testsuite/ld-ia64/tlsg.sd create mode 100644 ld/testsuite/ld-ia64/tlslib.s create mode 100644 ld/testsuite/ld-ia64/tlspic.dd create mode 100644 ld/testsuite/ld-ia64/tlspic.rd create mode 100644 ld/testsuite/ld-ia64/tlspic.sd create mode 100644 ld/testsuite/ld-ia64/tlspic.td create mode 100644 ld/testsuite/ld-ia64/tlspic1.s create mode 100644 ld/testsuite/ld-ia64/tlspic2.s create mode 100644 ld/testsuite/ld-linkonce/linkonce.exp create mode 100644 ld/testsuite/ld-linkonce/x.s create mode 100644 ld/testsuite/ld-linkonce/y.s create mode 100644 ld/testsuite/ld-linkonce/zeroeh.ld create mode 100644 ld/testsuite/ld-linkonce/zeroehl32.d create mode 100644 ld/testsuite/ld-m68hc11/adj-brset.d create mode 100644 ld/testsuite/ld-m68hc11/adj-brset.s create mode 100644 ld/testsuite/ld-m68hc11/adj-jump.d create mode 100644 ld/testsuite/ld-m68hc11/adj-jump.s create mode 100644 ld/testsuite/ld-m68hc11/bug-1403.d create mode 100644 ld/testsuite/ld-m68hc11/bug-1403.s create mode 100644 ld/testsuite/ld-m68hc11/bug-1417.d create mode 100644 ld/testsuite/ld-m68hc11/bug-1417.s create mode 100644 ld/testsuite/ld-m68hc11/bug-3331.d create mode 100644 ld/testsuite/ld-m68hc11/bug-3331.s create mode 100644 ld/testsuite/ld-m68hc11/far-hc11.d create mode 100644 ld/testsuite/ld-m68hc11/far-hc11.s create mode 100644 ld/testsuite/ld-m68hc11/far-hc12.d create mode 100644 ld/testsuite/ld-m68hc11/far-hc12.ld create mode 100644 ld/testsuite/ld-m68hc11/far-hc12.s create mode 100644 ld/testsuite/ld-m68hc11/link-hc12.s create mode 100644 ld/testsuite/ld-m68hc11/link-hcs12.d create mode 100644 ld/testsuite/ld-m68hc11/link-hcs12.s create mode 100644 ld/testsuite/ld-m68hc11/m68hc11.exp create mode 100644 ld/testsuite/ld-m68hc11/relax-direct.d create mode 100644 ld/testsuite/ld-m68hc11/relax-direct.s create mode 100644 ld/testsuite/ld-m68hc11/relax-group.d create mode 100644 ld/testsuite/ld-m68hc11/relax-group.s create mode 100644 ld/testsuite/ld-mips-elf/branch-misc-1.d create mode 100644 ld/testsuite/ld-mips-elf/elf-rel-got-n32.d create mode 100644 ld/testsuite/ld-mips-elf/elf-rel-got-n64-linux.d create mode 100644 ld/testsuite/ld-mips-elf/elf-rel-got-n64.d create mode 100644 ld/testsuite/ld-mips-elf/elf-rel-xgot-n32.d create mode 100644 ld/testsuite/ld-mips-elf/elf-rel-xgot-n64-linux.d create mode 100644 ld/testsuite/ld-mips-elf/elf-rel-xgot-n64.d create mode 100644 ld/testsuite/ld-mips-elf/empic1-ln.d create mode 100644 ld/testsuite/ld-mips-elf/empic1-lp.d create mode 100644 ld/testsuite/ld-mips-elf/empic1-mn.d create mode 100644 ld/testsuite/ld-mips-elf/empic1-mp.d create mode 100644 ld/testsuite/ld-mips-elf/empic1-ref.s create mode 100644 ld/testsuite/ld-mips-elf/empic1-sn.d create mode 100644 ld/testsuite/ld-mips-elf/empic1-sp.d create mode 100644 ld/testsuite/ld-mips-elf/empic1-space.s create mode 100644 ld/testsuite/ld-mips-elf/empic1-tgt.s create mode 100644 ld/testsuite/ld-mips-elf/empic2-fwd-0.d create mode 100644 ld/testsuite/ld-mips-elf/empic2-fwd-1.d create mode 100644 ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s create mode 100644 ld/testsuite/ld-mips-elf/empic2-ref.s create mode 100644 ld/testsuite/ld-mips-elf/empic2-rev-0.d create mode 100644 ld/testsuite/ld-mips-elf/empic2-rev-1.d create mode 100644 ld/testsuite/ld-mips-elf/empic2-rev-tgt.s create mode 100644 ld/testsuite/ld-mips-elf/empic2-space.s create mode 100644 ld/testsuite/ld-mips-elf/emrelocs-eb.d create mode 100644 ld/testsuite/ld-mips-elf/emrelocs-el.d create mode 100644 ld/testsuite/ld-mips-elf/emrelocs.ld create mode 100644 ld/testsuite/ld-mips-elf/emrelocs1.s create mode 100644 ld/testsuite/ld-mips-elf/emrelocs2.s create mode 100644 ld/testsuite/ld-mips-elf/jr.s create mode 100644 ld/testsuite/ld-mips-elf/mips-elf-flags.exp create mode 100644 ld/testsuite/ld-mips-elf/mips-elf.exp create mode 100644 ld/testsuite/ld-mips-elf/mips16-1.d create mode 100644 ld/testsuite/ld-mips-elf/mips16-1a.s create mode 100644 ld/testsuite/ld-mips-elf/mips16-1b.s create mode 100644 ld/testsuite/ld-mips-elf/multi-got-1-1.s create mode 100644 ld/testsuite/ld-mips-elf/multi-got-1-2.s create mode 100644 ld/testsuite/ld-mips-elf/multi-got-1.d create mode 100644 ld/testsuite/ld-mips-elf/region1.d create mode 100644 ld/testsuite/ld-mips-elf/region1.t create mode 100644 ld/testsuite/ld-mips-elf/region1a.s create mode 100644 ld/testsuite/ld-mips-elf/region1b.s create mode 100644 ld/testsuite/ld-mips-elf/rel32-n32.d create mode 100644 ld/testsuite/ld-mips-elf/rel32-o32.d create mode 100644 ld/testsuite/ld-mips-elf/rel32.s create mode 100644 ld/testsuite/ld-mips-elf/rel64.d create mode 100644 ld/testsuite/ld-mips-elf/rel64.s create mode 100644 ld/testsuite/ld-mips-elf/relax-jalr-n32-shared.d create mode 100644 ld/testsuite/ld-mips-elf/relax-jalr-n32.d create mode 100644 ld/testsuite/ld-mips-elf/relax-jalr-n64-shared.d create mode 100644 ld/testsuite/ld-mips-elf/relax-jalr-n64.d create mode 100644 ld/testsuite/ld-mips-elf/relax-jalr.s create mode 100644 ld/testsuite/ld-mips-elf/reloc-1-n32.d create mode 100644 ld/testsuite/ld-mips-elf/reloc-1-n64.d create mode 100644 ld/testsuite/ld-mips-elf/reloc-1-rel.d create mode 100644 ld/testsuite/ld-mips-elf/reloc-1a.s create mode 100644 ld/testsuite/ld-mips-elf/reloc-1b.s create mode 100644 ld/testsuite/ld-mips-elf/reloc-2.d create mode 100644 ld/testsuite/ld-mips-elf/reloc-2.ld create mode 100644 ld/testsuite/ld-mips-elf/reloc-2a.s create mode 100644 ld/testsuite/ld-mips-elf/reloc-2b.s create mode 100644 ld/testsuite/ld-mips-elf/reloc-3-r.d create mode 100644 ld/testsuite/ld-mips-elf/reloc-3-srec.d create mode 100644 ld/testsuite/ld-mips-elf/reloc-3.ld create mode 100644 ld/testsuite/ld-mips-elf/reloc-3a.s create mode 100644 ld/testsuite/ld-mips-elf/reloc-3b.s create mode 100644 ld/testsuite/ld-mmix/a.s create mode 100644 ld/testsuite/ld-mmix/areg-256.s create mode 100644 ld/testsuite/ld-mmix/areg-t.s create mode 100644 ld/testsuite/ld-mmix/aregm.s create mode 100644 ld/testsuite/ld-mmix/b-badfil1.d create mode 100644 ld/testsuite/ld-mmix/b-badfil1.s create mode 100644 ld/testsuite/ld-mmix/b-badfil2.d create mode 100644 ld/testsuite/ld-mmix/b-badfil2.s create mode 100644 ld/testsuite/ld-mmix/b-badfixo.d create mode 100644 ld/testsuite/ld-mmix/b-badfixo.s create mode 100644 ld/testsuite/ld-mmix/b-badloc.d create mode 100644 ld/testsuite/ld-mmix/b-badloc.s create mode 100644 ld/testsuite/ld-mmix/b-badlop.d create mode 100644 ld/testsuite/ld-mmix/b-badlop.s create mode 100644 ld/testsuite/ld-mmix/b-badm.d create mode 100644 ld/testsuite/ld-mmix/b-badm2.s create mode 100644 ld/testsuite/ld-mmix/b-badmain.s create mode 100644 ld/testsuite/ld-mmix/b-badquot.d create mode 100644 ld/testsuite/ld-mmix/b-badquot.s create mode 100644 ld/testsuite/ld-mmix/b-badrx1.d create mode 100644 ld/testsuite/ld-mmix/b-badrx1.s create mode 100644 ld/testsuite/ld-mmix/b-badrx2.d create mode 100644 ld/testsuite/ld-mmix/b-badrx2.s create mode 100644 ld/testsuite/ld-mmix/b-badrx3.d create mode 100644 ld/testsuite/ld-mmix/b-badrx3.s create mode 100644 ld/testsuite/ld-mmix/b-bend.s create mode 100644 ld/testsuite/ld-mmix/b-bend1.d create mode 100644 ld/testsuite/ld-mmix/b-bend2.d create mode 100644 ld/testsuite/ld-mmix/b-bend3.d create mode 100644 ld/testsuite/ld-mmix/b-bstab1.d create mode 100644 ld/testsuite/ld-mmix/b-bstab1.s create mode 100644 ld/testsuite/ld-mmix/b-fixo2.d create mode 100644 ld/testsuite/ld-mmix/b-fixo2.s create mode 100644 ld/testsuite/ld-mmix/b-goodmain.s create mode 100644 ld/testsuite/ld-mmix/b-loc64k.d create mode 100644 ld/testsuite/ld-mmix/b-loc64k.s create mode 100644 ld/testsuite/ld-mmix/b-nosym.d create mode 100644 ld/testsuite/ld-mmix/b-nosym.s create mode 100644 ld/testsuite/ld-mmix/b-post1.s create mode 100644 ld/testsuite/ld-mmix/b-twoinsn.s create mode 100644 ld/testsuite/ld-mmix/b-widec.s create mode 100644 ld/testsuite/ld-mmix/b-widec1.d create mode 100644 ld/testsuite/ld-mmix/b-widec2.d create mode 100644 ld/testsuite/ld-mmix/b-widec2.s create mode 100644 ld/testsuite/ld-mmix/b-widec3.d create mode 100644 ld/testsuite/ld-mmix/b-widec3.s create mode 100644 ld/testsuite/ld-mmix/bpo-1.d create mode 100644 ld/testsuite/ld-mmix/bpo-1.s create mode 100644 ld/testsuite/ld-mmix/bpo-10.d create mode 100644 ld/testsuite/ld-mmix/bpo-10.s create mode 100644 ld/testsuite/ld-mmix/bpo-11.d create mode 100644 ld/testsuite/ld-mmix/bpo-11.s create mode 100644 ld/testsuite/ld-mmix/bpo-12.d create mode 100644 ld/testsuite/ld-mmix/bpo-12m.d create mode 100644 ld/testsuite/ld-mmix/bpo-13.d create mode 100644 ld/testsuite/ld-mmix/bpo-13m.d create mode 100644 ld/testsuite/ld-mmix/bpo-14.d create mode 100644 ld/testsuite/ld-mmix/bpo-14m.d create mode 100644 ld/testsuite/ld-mmix/bpo-15.d create mode 100644 ld/testsuite/ld-mmix/bpo-15m.d create mode 100644 ld/testsuite/ld-mmix/bpo-16.d create mode 100644 ld/testsuite/ld-mmix/bpo-16m.d create mode 100644 ld/testsuite/ld-mmix/bpo-17.d create mode 100644 ld/testsuite/ld-mmix/bpo-17m.d create mode 100644 ld/testsuite/ld-mmix/bpo-18.d create mode 100644 ld/testsuite/ld-mmix/bpo-18m.d create mode 100644 ld/testsuite/ld-mmix/bpo-19.d create mode 100644 ld/testsuite/ld-mmix/bpo-19m.d create mode 100644 ld/testsuite/ld-mmix/bpo-1m.d create mode 100644 ld/testsuite/ld-mmix/bpo-2.d create mode 100644 ld/testsuite/ld-mmix/bpo-2.s create mode 100644 ld/testsuite/ld-mmix/bpo-20.d create mode 100644 ld/testsuite/ld-mmix/bpo-20m.d create mode 100644 ld/testsuite/ld-mmix/bpo-21.d create mode 100644 ld/testsuite/ld-mmix/bpo-21m.d create mode 100644 ld/testsuite/ld-mmix/bpo-22.d create mode 100644 ld/testsuite/ld-mmix/bpo-2m.d create mode 100644 ld/testsuite/ld-mmix/bpo-3.d create mode 100644 ld/testsuite/ld-mmix/bpo-3.s create mode 100644 ld/testsuite/ld-mmix/bpo-3m.d create mode 100644 ld/testsuite/ld-mmix/bpo-4.d create mode 100644 ld/testsuite/ld-mmix/bpo-4.s create mode 100644 ld/testsuite/ld-mmix/bpo-4m.d create mode 100644 ld/testsuite/ld-mmix/bpo-5.d create mode 100644 ld/testsuite/ld-mmix/bpo-5.s create mode 100644 ld/testsuite/ld-mmix/bpo-5m.d create mode 100644 ld/testsuite/ld-mmix/bpo-6.d create mode 100644 ld/testsuite/ld-mmix/bpo-6.s create mode 100644 ld/testsuite/ld-mmix/bpo-6m.d create mode 100644 ld/testsuite/ld-mmix/bpo-7.d create mode 100644 ld/testsuite/ld-mmix/bpo-7.s create mode 100644 ld/testsuite/ld-mmix/bpo-7m.d create mode 100644 ld/testsuite/ld-mmix/bpo-8.d create mode 100644 ld/testsuite/ld-mmix/bpo-8.s create mode 100644 ld/testsuite/ld-mmix/bpo-8m.d create mode 100644 ld/testsuite/ld-mmix/bpo-9.d create mode 100644 ld/testsuite/ld-mmix/bpo-9.s create mode 100644 ld/testsuite/ld-mmix/bpo-9m.d create mode 100644 ld/testsuite/ld-mmix/bpo64addr.ld create mode 100644 ld/testsuite/ld-mmix/bspec1.d create mode 100644 ld/testsuite/ld-mmix/bspec1.s create mode 100644 ld/testsuite/ld-mmix/bspec1m.d create mode 100644 ld/testsuite/ld-mmix/bspec2.d create mode 100644 ld/testsuite/ld-mmix/bspec2.s create mode 100644 ld/testsuite/ld-mmix/bspec2m.d create mode 100644 ld/testsuite/ld-mmix/bspec801.s create mode 100644 ld/testsuite/ld-mmix/bspec802.s create mode 100644 ld/testsuite/ld-mmix/bspec803.s create mode 100644 ld/testsuite/ld-mmix/bspec804.s create mode 100644 ld/testsuite/ld-mmix/bspec805.s create mode 100644 ld/testsuite/ld-mmix/bspec806.s create mode 100644 ld/testsuite/ld-mmix/bspec807.s create mode 100644 ld/testsuite/ld-mmix/bspec808.s create mode 100644 ld/testsuite/ld-mmix/bza-1b.d create mode 100644 ld/testsuite/ld-mmix/bza-1f.d create mode 100644 ld/testsuite/ld-mmix/bza-2b.d create mode 100644 ld/testsuite/ld-mmix/bza-2f.d create mode 100644 ld/testsuite/ld-mmix/bza-7b.d create mode 100644 ld/testsuite/ld-mmix/bza-7f.d create mode 100644 ld/testsuite/ld-mmix/bza-8b.d create mode 100644 ld/testsuite/ld-mmix/bza-8f.d create mode 100644 ld/testsuite/ld-mmix/bza.s create mode 100644 ld/testsuite/ld-mmix/data1.s create mode 100644 ld/testsuite/ld-mmix/dloc1.s create mode 100644 ld/testsuite/ld-mmix/dloc2.s create mode 100644 ld/testsuite/ld-mmix/ext1-254.s create mode 100644 ld/testsuite/ld-mmix/ext1.s create mode 100644 ld/testsuite/ld-mmix/ext1g.s create mode 100644 ld/testsuite/ld-mmix/ext1l.s create mode 100644 ld/testsuite/ld-mmix/getaa-1b.d create mode 100644 ld/testsuite/ld-mmix/getaa-1f.d create mode 100644 ld/testsuite/ld-mmix/getaa-2b.d create mode 100644 ld/testsuite/ld-mmix/getaa-2f.d create mode 100644 ld/testsuite/ld-mmix/getaa-4b.d create mode 100644 ld/testsuite/ld-mmix/getaa-4f.d create mode 100644 ld/testsuite/ld-mmix/getaa-6b.d create mode 100644 ld/testsuite/ld-mmix/getaa-6f.d create mode 100644 ld/testsuite/ld-mmix/getaa-7b.d create mode 100644 ld/testsuite/ld-mmix/getaa-7f.d create mode 100644 ld/testsuite/ld-mmix/getaa-8b.d create mode 100644 ld/testsuite/ld-mmix/getaa-8f.d create mode 100644 ld/testsuite/ld-mmix/getaa.s create mode 100644 ld/testsuite/ld-mmix/getaa12b.d create mode 100644 ld/testsuite/ld-mmix/getaa12f.d create mode 100644 ld/testsuite/ld-mmix/getaa14b.d create mode 100644 ld/testsuite/ld-mmix/getaa14f.d create mode 100644 ld/testsuite/ld-mmix/greg-1.d create mode 100644 ld/testsuite/ld-mmix/greg-1.s create mode 100644 ld/testsuite/ld-mmix/greg-10.d create mode 100644 ld/testsuite/ld-mmix/greg-11.d create mode 100644 ld/testsuite/ld-mmix/greg-11b.d create mode 100644 ld/testsuite/ld-mmix/greg-12.d create mode 100644 ld/testsuite/ld-mmix/greg-13.d create mode 100644 ld/testsuite/ld-mmix/greg-14.d create mode 100644 ld/testsuite/ld-mmix/greg-14s.d create mode 100644 ld/testsuite/ld-mmix/greg-15.d create mode 100644 ld/testsuite/ld-mmix/greg-16.d create mode 100644 ld/testsuite/ld-mmix/greg-17.d create mode 100644 ld/testsuite/ld-mmix/greg-18.d create mode 100644 ld/testsuite/ld-mmix/greg-19.d create mode 100644 ld/testsuite/ld-mmix/greg-2.d create mode 100644 ld/testsuite/ld-mmix/greg-2.s create mode 100644 ld/testsuite/ld-mmix/greg-20.d create mode 100644 ld/testsuite/ld-mmix/greg-3.d create mode 100644 ld/testsuite/ld-mmix/greg-3.s create mode 100644 ld/testsuite/ld-mmix/greg-4.d create mode 100644 ld/testsuite/ld-mmix/greg-4.s create mode 100644 ld/testsuite/ld-mmix/greg-5.d create mode 100644 ld/testsuite/ld-mmix/greg-5.s create mode 100644 ld/testsuite/ld-mmix/greg-5s.d create mode 100644 ld/testsuite/ld-mmix/greg-6.d create mode 100644 ld/testsuite/ld-mmix/greg-7.d create mode 100644 ld/testsuite/ld-mmix/greg-8.d create mode 100644 ld/testsuite/ld-mmix/greg-9.d create mode 100644 ld/testsuite/ld-mmix/gregbza1.s create mode 100644 ld/testsuite/ld-mmix/gregget1.s create mode 100644 ld/testsuite/ld-mmix/gregget2.s create mode 100644 ld/testsuite/ld-mmix/gregldo1.s create mode 100644 ld/testsuite/ld-mmix/gregpsj1.s create mode 100644 ld/testsuite/ld-mmix/hdr-1.d create mode 100644 ld/testsuite/ld-mmix/jumpa-1b.d create mode 100644 ld/testsuite/ld-mmix/jumpa-1f.d create mode 100644 ld/testsuite/ld-mmix/jumpa-2b.d create mode 100644 ld/testsuite/ld-mmix/jumpa-2f.d create mode 100644 ld/testsuite/ld-mmix/jumpa-3b.d create mode 100644 ld/testsuite/ld-mmix/jumpa-3f.d create mode 100644 ld/testsuite/ld-mmix/jumpa-4b.d create mode 100644 ld/testsuite/ld-mmix/jumpa-4f.d create mode 100644 ld/testsuite/ld-mmix/jumpa-5b.d create mode 100644 ld/testsuite/ld-mmix/jumpa-5f.d create mode 100644 ld/testsuite/ld-mmix/jumpa-6b.d create mode 100644 ld/testsuite/ld-mmix/jumpa-6f.d create mode 100644 ld/testsuite/ld-mmix/jumpa-7b.d create mode 100644 ld/testsuite/ld-mmix/jumpa-7f.d create mode 100644 ld/testsuite/ld-mmix/jumpa-8b.d create mode 100644 ld/testsuite/ld-mmix/jumpa-8f.d create mode 100644 ld/testsuite/ld-mmix/jumpa-9b.d create mode 100644 ld/testsuite/ld-mmix/jumpa-9f.d create mode 100644 ld/testsuite/ld-mmix/jumpa.s create mode 100644 ld/testsuite/ld-mmix/jumpa12b.d create mode 100644 ld/testsuite/ld-mmix/jumpa12f.d create mode 100644 ld/testsuite/ld-mmix/jumpa13b.d create mode 100644 ld/testsuite/ld-mmix/jumpa13f.d create mode 100644 ld/testsuite/ld-mmix/jumpa14b.d create mode 100644 ld/testsuite/ld-mmix/jumpa14f.d create mode 100644 ld/testsuite/ld-mmix/loc1.d create mode 100644 ld/testsuite/ld-mmix/loc1.s create mode 100644 ld/testsuite/ld-mmix/loc1m.d create mode 100644 ld/testsuite/ld-mmix/loc2.d create mode 100644 ld/testsuite/ld-mmix/loc2.s create mode 100644 ld/testsuite/ld-mmix/loc2m.d create mode 100644 ld/testsuite/ld-mmix/loc3.d create mode 100644 ld/testsuite/ld-mmix/loc3m.d create mode 100644 ld/testsuite/ld-mmix/loc4.d create mode 100644 ld/testsuite/ld-mmix/loc4m.d create mode 100644 ld/testsuite/ld-mmix/loc5.d create mode 100644 ld/testsuite/ld-mmix/loc5m.d create mode 100644 ld/testsuite/ld-mmix/loc6.d create mode 100644 ld/testsuite/ld-mmix/loc6m.d create mode 100644 ld/testsuite/ld-mmix/loc7.d create mode 100644 ld/testsuite/ld-mmix/loc7m.d create mode 100644 ld/testsuite/ld-mmix/local1.d create mode 100644 ld/testsuite/ld-mmix/local1.s create mode 100644 ld/testsuite/ld-mmix/local10.d create mode 100644 ld/testsuite/ld-mmix/local10m.d create mode 100644 ld/testsuite/ld-mmix/local11.d create mode 100644 ld/testsuite/ld-mmix/local11m.d create mode 100644 ld/testsuite/ld-mmix/local12.d create mode 100644 ld/testsuite/ld-mmix/local12m.d create mode 100644 ld/testsuite/ld-mmix/local1m.d create mode 100644 ld/testsuite/ld-mmix/local2.d create mode 100644 ld/testsuite/ld-mmix/local2.s create mode 100644 ld/testsuite/ld-mmix/local2m.d create mode 100644 ld/testsuite/ld-mmix/local3.d create mode 100644 ld/testsuite/ld-mmix/local3m.d create mode 100644 ld/testsuite/ld-mmix/local4.d create mode 100644 ld/testsuite/ld-mmix/local4m.d create mode 100644 ld/testsuite/ld-mmix/local5.d create mode 100644 ld/testsuite/ld-mmix/local5m.d create mode 100644 ld/testsuite/ld-mmix/local6.d create mode 100644 ld/testsuite/ld-mmix/local6m.d create mode 100644 ld/testsuite/ld-mmix/local7.d create mode 100644 ld/testsuite/ld-mmix/local7m.d create mode 100644 ld/testsuite/ld-mmix/local8.d create mode 100644 ld/testsuite/ld-mmix/local8m.d create mode 100644 ld/testsuite/ld-mmix/local9.d create mode 100644 ld/testsuite/ld-mmix/local9m.d create mode 100644 ld/testsuite/ld-mmix/locdo-1.d create mode 100644 ld/testsuite/ld-mmix/locdo.s create mode 100644 ld/testsuite/ld-mmix/loct-1.d create mode 100644 ld/testsuite/ld-mmix/loct.s create mode 100644 ld/testsuite/ld-mmix/locto-1.d create mode 100644 ld/testsuite/ld-mmix/locto.s create mode 100644 ld/testsuite/ld-mmix/main1.s create mode 100644 ld/testsuite/ld-mmix/mmix.exp create mode 100644 ld/testsuite/ld-mmix/mmohdr1.ld create mode 100644 ld/testsuite/ld-mmix/mmosec1.ld create mode 100644 ld/testsuite/ld-mmix/mmosec2.ld create mode 100644 ld/testsuite/ld-mmix/nop123.s create mode 100644 ld/testsuite/ld-mmix/pad16.s create mode 100644 ld/testsuite/ld-mmix/pad2p18m32.s create mode 100644 ld/testsuite/ld-mmix/pad2p26m32.s create mode 100644 ld/testsuite/ld-mmix/pad4.s create mode 100644 ld/testsuite/ld-mmix/pushja.s create mode 100644 ld/testsuite/ld-mmix/pushja1b-s.d create mode 100644 ld/testsuite/ld-mmix/pushja1b.d create mode 100644 ld/testsuite/ld-mmix/pushja1f-s.d create mode 100644 ld/testsuite/ld-mmix/pushja1f.d create mode 100644 ld/testsuite/ld-mmix/pushja2b.d create mode 100644 ld/testsuite/ld-mmix/pushja2f.d create mode 100644 ld/testsuite/ld-mmix/pushja7b-s.d create mode 100644 ld/testsuite/ld-mmix/pushja7b.d create mode 100644 ld/testsuite/ld-mmix/pushja7f-s.d create mode 100644 ld/testsuite/ld-mmix/pushja7f.d create mode 100644 ld/testsuite/ld-mmix/pushja8b.d create mode 100644 ld/testsuite/ld-mmix/pushja8f.d create mode 100644 ld/testsuite/ld-mmix/pushjs1.d create mode 100644 ld/testsuite/ld-mmix/pushjs1b.d create mode 100644 ld/testsuite/ld-mmix/pushjs1bm.d create mode 100644 ld/testsuite/ld-mmix/pushjs1m.d create mode 100644 ld/testsuite/ld-mmix/pushjs1r.d create mode 100644 ld/testsuite/ld-mmix/pushjs2.d create mode 100644 ld/testsuite/ld-mmix/pushjs2b.d create mode 100644 ld/testsuite/ld-mmix/pushjs2bm.d create mode 100644 ld/testsuite/ld-mmix/pushjs2m.d create mode 100644 ld/testsuite/ld-mmix/pushjs2r.d create mode 100644 ld/testsuite/ld-mmix/pushjs3.d create mode 100644 ld/testsuite/ld-mmix/pushjs3b.d create mode 100644 ld/testsuite/ld-mmix/pushjs3bm.d create mode 100644 ld/testsuite/ld-mmix/pushjs3m.d create mode 100644 ld/testsuite/ld-mmix/pushjs3r.d create mode 100644 ld/testsuite/ld-mmix/pushjs4.d create mode 100644 ld/testsuite/ld-mmix/pushjs4b.d create mode 100644 ld/testsuite/ld-mmix/pushjs4bm.d create mode 100644 ld/testsuite/ld-mmix/pushjs4m.d create mode 100644 ld/testsuite/ld-mmix/pushjs4r.d create mode 100644 ld/testsuite/ld-mmix/reg-1.d create mode 100644 ld/testsuite/ld-mmix/reg-1m.d create mode 100644 ld/testsuite/ld-mmix/reg-2.d create mode 100644 ld/testsuite/ld-mmix/reg-2m.d create mode 100644 ld/testsuite/ld-mmix/regext1.s create mode 100644 ld/testsuite/ld-mmix/sec-1.d create mode 100644 ld/testsuite/ld-mmix/sec-1.s create mode 100644 ld/testsuite/ld-mmix/sec-2.d create mode 100644 ld/testsuite/ld-mmix/sec-2.s create mode 100644 ld/testsuite/ld-mmix/sec-3.d create mode 100644 ld/testsuite/ld-mmix/sec-4.d create mode 100644 ld/testsuite/ld-mmix/sec-5.d create mode 100644 ld/testsuite/ld-mmix/sec-6.d create mode 100644 ld/testsuite/ld-mmix/sec-6.s create mode 100644 ld/testsuite/ld-mmix/sec-6m.d create mode 100644 ld/testsuite/ld-mmix/sec-7a.s create mode 100644 ld/testsuite/ld-mmix/sec-7b.s create mode 100644 ld/testsuite/ld-mmix/sec-7c.s create mode 100644 ld/testsuite/ld-mmix/sec-7d.s create mode 100644 ld/testsuite/ld-mmix/sec-7e.s create mode 100644 ld/testsuite/ld-mmix/sec-7m.d create mode 100644 ld/testsuite/ld-mmix/sec-8a.s create mode 100644 ld/testsuite/ld-mmix/sec-8b.s create mode 100644 ld/testsuite/ld-mmix/sec-8d.s create mode 100644 ld/testsuite/ld-mmix/sec-8m.d create mode 100644 ld/testsuite/ld-mmix/sec-8m.s create mode 100644 ld/testsuite/ld-mmix/spec801.d create mode 100644 ld/testsuite/ld-mmix/spec802.d create mode 100644 ld/testsuite/ld-mmix/spec803.d create mode 100644 ld/testsuite/ld-mmix/spec804.d create mode 100644 ld/testsuite/ld-mmix/spec805.d create mode 100644 ld/testsuite/ld-mmix/spec806.d create mode 100644 ld/testsuite/ld-mmix/spec807.d create mode 100644 ld/testsuite/ld-mmix/spec808.d create mode 100644 ld/testsuite/ld-mmix/start-1.d create mode 100644 ld/testsuite/ld-mmix/start-2.d create mode 100644 ld/testsuite/ld-mmix/start.s create mode 100644 ld/testsuite/ld-mmix/start2.s create mode 100644 ld/testsuite/ld-mmix/start3.s create mode 100644 ld/testsuite/ld-mmix/start4.s create mode 100644 ld/testsuite/ld-mmix/sym-1.d create mode 100644 ld/testsuite/ld-mmix/sym-2.d create mode 100644 ld/testsuite/ld-mmix/sym-2.s create mode 100644 ld/testsuite/ld-mmix/undef-1.d create mode 100644 ld/testsuite/ld-mmix/undef-1.s create mode 100644 ld/testsuite/ld-mmix/undef-1m.d create mode 100644 ld/testsuite/ld-mmix/undef-2.d create mode 100644 ld/testsuite/ld-mmix/undef-2.s create mode 100644 ld/testsuite/ld-mmix/undef-2m.d create mode 100644 ld/testsuite/ld-mmix/undef-3.d create mode 100644 ld/testsuite/ld-mmix/undef-3m.d create mode 100644 ld/testsuite/ld-mmix/x.s create mode 100644 ld/testsuite/ld-mmix/y.s create mode 100644 ld/testsuite/ld-mmix/zeroeh.ld create mode 100644 ld/testsuite/ld-mmix/zeroehelf.d create mode 100644 ld/testsuite/ld-mmix/zeroehmmo.d create mode 100644 ld/testsuite/ld-powerpc/apuinfo.rd create mode 100644 ld/testsuite/ld-powerpc/apuinfo1.s create mode 100644 ld/testsuite/ld-powerpc/apuinfo2.s create mode 100644 ld/testsuite/ld-powerpc/powerpc.exp create mode 100644 ld/testsuite/ld-powerpc/reloc.d create mode 100644 ld/testsuite/ld-powerpc/reloc.s create mode 100644 ld/testsuite/ld-powerpc/tls.d create mode 100644 ld/testsuite/ld-powerpc/tls.g create mode 100644 ld/testsuite/ld-powerpc/tls.s create mode 100644 ld/testsuite/ld-powerpc/tls.t create mode 100644 ld/testsuite/ld-powerpc/tls32.d create mode 100644 ld/testsuite/ld-powerpc/tls32.g create mode 100644 ld/testsuite/ld-powerpc/tls32.s create mode 100644 ld/testsuite/ld-powerpc/tls32.t create mode 100644 ld/testsuite/ld-powerpc/tlsexe.d create mode 100644 ld/testsuite/ld-powerpc/tlsexe.g create mode 100644 ld/testsuite/ld-powerpc/tlsexe.r create mode 100644 ld/testsuite/ld-powerpc/tlsexe.t create mode 100644 ld/testsuite/ld-powerpc/tlsexe32.d create mode 100644 ld/testsuite/ld-powerpc/tlsexe32.g create mode 100644 ld/testsuite/ld-powerpc/tlsexe32.r create mode 100644 ld/testsuite/ld-powerpc/tlsexe32.t create mode 100644 ld/testsuite/ld-powerpc/tlsexetoc.d create mode 100644 ld/testsuite/ld-powerpc/tlsexetoc.g create mode 100644 ld/testsuite/ld-powerpc/tlsexetoc.r create mode 100644 ld/testsuite/ld-powerpc/tlsexetoc.t create mode 100644 ld/testsuite/ld-powerpc/tlslib.s create mode 100644 ld/testsuite/ld-powerpc/tlslib32.s create mode 100644 ld/testsuite/ld-powerpc/tlsso.d create mode 100644 ld/testsuite/ld-powerpc/tlsso.g create mode 100644 ld/testsuite/ld-powerpc/tlsso.r create mode 100644 ld/testsuite/ld-powerpc/tlsso.t create mode 100644 ld/testsuite/ld-powerpc/tlsso32.d create mode 100644 ld/testsuite/ld-powerpc/tlsso32.g create mode 100644 ld/testsuite/ld-powerpc/tlsso32.r create mode 100644 ld/testsuite/ld-powerpc/tlsso32.t create mode 100644 ld/testsuite/ld-powerpc/tlstoc.d create mode 100644 ld/testsuite/ld-powerpc/tlstoc.g create mode 100644 ld/testsuite/ld-powerpc/tlstoc.s create mode 100644 ld/testsuite/ld-powerpc/tlstoc.t create mode 100644 ld/testsuite/ld-powerpc/tlstocso.d create mode 100644 ld/testsuite/ld-powerpc/tlstocso.g create mode 100644 ld/testsuite/ld-powerpc/tlstocso.r create mode 100644 ld/testsuite/ld-powerpc/tlstocso.t create mode 100644 ld/testsuite/ld-s390/s390.exp create mode 100644 ld/testsuite/ld-s390/tlsbin.dd create mode 100644 ld/testsuite/ld-s390/tlsbin.rd create mode 100644 ld/testsuite/ld-s390/tlsbin.s create mode 100644 ld/testsuite/ld-s390/tlsbin.sd create mode 100644 ld/testsuite/ld-s390/tlsbin.td create mode 100644 ld/testsuite/ld-s390/tlsbin_64.dd create mode 100644 ld/testsuite/ld-s390/tlsbin_64.rd create mode 100644 ld/testsuite/ld-s390/tlsbin_64.s create mode 100644 ld/testsuite/ld-s390/tlsbin_64.sd create mode 100644 ld/testsuite/ld-s390/tlsbin_64.td create mode 100644 ld/testsuite/ld-s390/tlsbinpic.s create mode 100644 ld/testsuite/ld-s390/tlsbinpic_64.s create mode 100644 ld/testsuite/ld-s390/tlslib.s create mode 100644 ld/testsuite/ld-s390/tlslib_64.s create mode 100644 ld/testsuite/ld-s390/tlspic.dd create mode 100644 ld/testsuite/ld-s390/tlspic.rd create mode 100644 ld/testsuite/ld-s390/tlspic.sd create mode 100644 ld/testsuite/ld-s390/tlspic.td create mode 100644 ld/testsuite/ld-s390/tlspic1.s create mode 100644 ld/testsuite/ld-s390/tlspic1_64.s create mode 100644 ld/testsuite/ld-s390/tlspic2.s create mode 100644 ld/testsuite/ld-s390/tlspic2_64.s create mode 100644 ld/testsuite/ld-s390/tlspic_64.dd create mode 100644 ld/testsuite/ld-s390/tlspic_64.rd create mode 100644 ld/testsuite/ld-s390/tlspic_64.sd create mode 100644 ld/testsuite/ld-s390/tlspic_64.td create mode 100644 ld/testsuite/ld-scripts/align.exp create mode 100644 ld/testsuite/ld-scripts/align.s create mode 100644 ld/testsuite/ld-scripts/align.t create mode 100644 ld/testsuite/ld-scripts/assert.exp create mode 100644 ld/testsuite/ld-scripts/assert.s create mode 100644 ld/testsuite/ld-scripts/assert.t create mode 100644 ld/testsuite/ld-scripts/cross1.c create mode 100644 ld/testsuite/ld-scripts/cross1.t create mode 100644 ld/testsuite/ld-scripts/cross2.c create mode 100644 ld/testsuite/ld-scripts/cross2.t create mode 100644 ld/testsuite/ld-scripts/cross3.c create mode 100644 ld/testsuite/ld-scripts/crossref.exp create mode 100644 ld/testsuite/ld-scripts/data.d create mode 100644 ld/testsuite/ld-scripts/data.exp create mode 100644 ld/testsuite/ld-scripts/data.s create mode 100644 ld/testsuite/ld-scripts/data.t create mode 100644 ld/testsuite/ld-scripts/defined.exp create mode 100644 ld/testsuite/ld-scripts/defined.s create mode 100644 ld/testsuite/ld-scripts/defined.t create mode 100644 ld/testsuite/ld-scripts/defined2.d create mode 100644 ld/testsuite/ld-scripts/defined2.t create mode 100644 ld/testsuite/ld-scripts/defined3.d create mode 100644 ld/testsuite/ld-scripts/defined3.t create mode 100644 ld/testsuite/ld-scripts/dynamic-sections-1.s create mode 100644 ld/testsuite/ld-scripts/dynamic-sections-2.s create mode 100644 ld/testsuite/ld-scripts/dynamic-sections.d create mode 100644 ld/testsuite/ld-scripts/dynamic-sections.exp create mode 100644 ld/testsuite/ld-scripts/dynamic-sections.t create mode 100644 ld/testsuite/ld-scripts/map-address.d create mode 100644 ld/testsuite/ld-scripts/map-address.exp create mode 100644 ld/testsuite/ld-scripts/map-address.t create mode 100644 ld/testsuite/ld-scripts/overlay-size-map.d create mode 100644 ld/testsuite/ld-scripts/overlay-size.d create mode 100644 ld/testsuite/ld-scripts/overlay-size.exp create mode 100644 ld/testsuite/ld-scripts/overlay-size.s create mode 100644 ld/testsuite/ld-scripts/overlay-size.t create mode 100644 ld/testsuite/ld-scripts/phdrs.exp create mode 100644 ld/testsuite/ld-scripts/phdrs.s create mode 100644 ld/testsuite/ld-scripts/phdrs.t create mode 100644 ld/testsuite/ld-scripts/phdrs2.exp create mode 100644 ld/testsuite/ld-scripts/phdrs2.s create mode 100644 ld/testsuite/ld-scripts/phdrs2.t create mode 100644 ld/testsuite/ld-scripts/provide-1.d create mode 100644 ld/testsuite/ld-scripts/provide-1.s create mode 100644 ld/testsuite/ld-scripts/provide-1.t create mode 100644 ld/testsuite/ld-scripts/provide-2.d create mode 100644 ld/testsuite/ld-scripts/provide-2.s create mode 100644 ld/testsuite/ld-scripts/provide-2.t create mode 100644 ld/testsuite/ld-scripts/provide-3.d create mode 100644 ld/testsuite/ld-scripts/provide-3.s create mode 100644 ld/testsuite/ld-scripts/provide-3.t create mode 100644 ld/testsuite/ld-scripts/provide.exp create mode 100644 ld/testsuite/ld-scripts/script.exp create mode 100644 ld/testsuite/ld-scripts/script.s create mode 100644 ld/testsuite/ld-scripts/script.t create mode 100644 ld/testsuite/ld-scripts/scriptm.t create mode 100644 ld/testsuite/ld-scripts/size-1.d create mode 100644 ld/testsuite/ld-scripts/size-1.s create mode 100644 ld/testsuite/ld-scripts/size-1.t create mode 100644 ld/testsuite/ld-scripts/size-2.d create mode 100644 ld/testsuite/ld-scripts/size-2.s create mode 100644 ld/testsuite/ld-scripts/size-2.t create mode 100644 ld/testsuite/ld-scripts/size.exp create mode 100644 ld/testsuite/ld-scripts/sizeof.exp create mode 100644 ld/testsuite/ld-scripts/sizeof.s create mode 100644 ld/testsuite/ld-scripts/sizeof.t create mode 100644 ld/testsuite/ld-scripts/weak.exp create mode 100644 ld/testsuite/ld-scripts/weak.t create mode 100644 ld/testsuite/ld-scripts/weak1.s create mode 100644 ld/testsuite/ld-scripts/weak2.s create mode 100644 ld/testsuite/ld-selective/1.c create mode 100644 ld/testsuite/ld-selective/2.c create mode 100644 ld/testsuite/ld-selective/3.cc create mode 100644 ld/testsuite/ld-selective/4.cc create mode 100644 ld/testsuite/ld-selective/5.cc create mode 100644 ld/testsuite/ld-selective/keepdot.d create mode 100644 ld/testsuite/ld-selective/keepdot.ld create mode 100644 ld/testsuite/ld-selective/keepdot.s create mode 100644 ld/testsuite/ld-selective/keepdot0.d create mode 100644 ld/testsuite/ld-selective/keepdot0.ld create mode 100644 ld/testsuite/ld-selective/sel-dump.exp create mode 100644 ld/testsuite/ld-selective/selective.exp create mode 100644 ld/testsuite/ld-sh/ld-r-1.d create mode 100644 ld/testsuite/ld-sh/ldr1.s create mode 100644 ld/testsuite/ld-sh/ldr2.s create mode 100644 ld/testsuite/ld-sh/rd-sh.exp create mode 100644 ld/testsuite/ld-sh/refdbg-0-dso.d create mode 100644 ld/testsuite/ld-sh/refdbg-1.d create mode 100644 ld/testsuite/ld-sh/refdbg.s create mode 100644 ld/testsuite/ld-sh/refdbglib.s create mode 100644 ld/testsuite/ld-sh/sh.exp create mode 100644 ld/testsuite/ld-sh/sh1.s create mode 100644 ld/testsuite/ld-sh/sh2.c create mode 100644 ld/testsuite/ld-sh/sh64/abi32.sd create mode 100644 ld/testsuite/ld-sh/sh64/abi32.xd create mode 100644 ld/testsuite/ld-sh/sh64/abi64.sd create mode 100644 ld/testsuite/ld-sh/sh64/abi64.xd create mode 100644 ld/testsuite/ld-sh/sh64/abixx-noexp.sd create mode 100644 ld/testsuite/ld-sh/sh64/cmpct1.sd create mode 100644 ld/testsuite/ld-sh/sh64/cmpct1.xd create mode 100644 ld/testsuite/ld-sh/sh64/crange-1.s create mode 100644 ld/testsuite/ld-sh/sh64/crange-2a.s create mode 100644 ld/testsuite/ld-sh/sh64/crange-2b.s create mode 100644 ld/testsuite/ld-sh/sh64/crange-2c.s create mode 100644 ld/testsuite/ld-sh/sh64/crange-2d.s create mode 100644 ld/testsuite/ld-sh/sh64/crange-2e.s create mode 100644 ld/testsuite/ld-sh/sh64/crange-2f.s create mode 100644 ld/testsuite/ld-sh/sh64/crange-2g.s create mode 100644 ld/testsuite/ld-sh/sh64/crange-2h.s create mode 100644 ld/testsuite/ld-sh/sh64/crange-2i.s create mode 100644 ld/testsuite/ld-sh/sh64/crange1.rd create mode 100644 ld/testsuite/ld-sh/sh64/crange2.rd create mode 100644 ld/testsuite/ld-sh/sh64/crange3-cmpct.rd create mode 100644 ld/testsuite/ld-sh/sh64/crange3-media.rd create mode 100644 ld/testsuite/ld-sh/sh64/crange3.dd create mode 100644 ld/testsuite/ld-sh/sh64/crange3.rd create mode 100644 ld/testsuite/ld-sh/sh64/crangerel1.rd create mode 100644 ld/testsuite/ld-sh/sh64/crangerel2.rd create mode 100644 ld/testsuite/ld-sh/sh64/dlsection-1.s create mode 100644 ld/testsuite/ld-sh/sh64/dlsection.sd create mode 100644 ld/testsuite/ld-sh/sh64/endian.dbd create mode 100644 ld/testsuite/ld-sh/sh64/endian.dld create mode 100644 ld/testsuite/ld-sh/sh64/endian.ld create mode 100644 ld/testsuite/ld-sh/sh64/endian.s create mode 100644 ld/testsuite/ld-sh/sh64/endian.sbd create mode 100644 ld/testsuite/ld-sh/sh64/endian.sld create mode 100644 ld/testsuite/ld-sh/sh64/gotplt.d create mode 100644 ld/testsuite/ld-sh/sh64/gotplt.map create mode 100644 ld/testsuite/ld-sh/sh64/gotplt.s create mode 100644 ld/testsuite/ld-sh/sh64/init-cmpct.d create mode 100644 ld/testsuite/ld-sh/sh64/init-media.d create mode 100644 ld/testsuite/ld-sh/sh64/init.s create mode 100644 ld/testsuite/ld-sh/sh64/init64.d create mode 100644 ld/testsuite/ld-sh/sh64/mix1-noexp.sd create mode 100644 ld/testsuite/ld-sh/sh64/mix1.sd create mode 100644 ld/testsuite/ld-sh/sh64/mix1.xd create mode 100644 ld/testsuite/ld-sh/sh64/mix2-noexp.sd create mode 100644 ld/testsuite/ld-sh/sh64/mix2.sd create mode 100644 ld/testsuite/ld-sh/sh64/mix2.xd create mode 100644 ld/testsuite/ld-sh/sh64/rd-sh64.exp create mode 100644 ld/testsuite/ld-sh/sh64/rel-1.s create mode 100644 ld/testsuite/ld-sh/sh64/rel-2.s create mode 100644 ld/testsuite/ld-sh/sh64/rel32.xd create mode 100644 ld/testsuite/ld-sh/sh64/rel64.xd create mode 100644 ld/testsuite/ld-sh/sh64/relax.exp create mode 100644 ld/testsuite/ld-sh/sh64/relax1.s create mode 100644 ld/testsuite/ld-sh/sh64/relax2.s create mode 100644 ld/testsuite/ld-sh/sh64/relax3.s create mode 100644 ld/testsuite/ld-sh/sh64/relax4.s create mode 100644 ld/testsuite/ld-sh/sh64/reldl-1.s create mode 100644 ld/testsuite/ld-sh/sh64/reldl-2.s create mode 100644 ld/testsuite/ld-sh/sh64/reldl32.rd create mode 100644 ld/testsuite/ld-sh/sh64/reldl64.rd create mode 100644 ld/testsuite/ld-sh/sh64/relfail.exp create mode 100644 ld/testsuite/ld-sh/sh64/relfail.s create mode 100644 ld/testsuite/ld-sh/sh64/sh64-1.s create mode 100644 ld/testsuite/ld-sh/sh64/sh64-2.s create mode 100644 ld/testsuite/ld-sh/sh64/sh64.exp create mode 100644 ld/testsuite/ld-sh/sh64/shcmp-1.s create mode 100644 ld/testsuite/ld-sh/sh64/shdl-1.s create mode 100644 ld/testsuite/ld-sh/sh64/shdl-2.s create mode 100644 ld/testsuite/ld-sh/sh64/shdl32.xd create mode 100644 ld/testsuite/ld-sh/sh64/shdl64.sd create mode 100644 ld/testsuite/ld-sh/sh64/shdl64.xd create mode 100644 ld/testsuite/ld-sh/sh64/shmix-1.s create mode 100644 ld/testsuite/ld-sh/sh64/shmix-2.s create mode 100644 ld/testsuite/ld-sh/sh64/shmix-3.s create mode 100644 ld/testsuite/ld-sh/sh64/stobin-0-dso.d create mode 100644 ld/testsuite/ld-sh/sh64/stobin-1.d create mode 100644 ld/testsuite/ld-sh/sh64/stobin.s create mode 100644 ld/testsuite/ld-sh/sh64/stolib.s create mode 100644 ld/testsuite/ld-sh/shared-1.d create mode 100644 ld/testsuite/ld-sh/shared-2.d create mode 100644 ld/testsuite/ld-sh/start.s create mode 100644 ld/testsuite/ld-sh/sub2l-1.d create mode 100644 ld/testsuite/ld-sh/sub2l.s create mode 100644 ld/testsuite/ld-sh/textrel1.s create mode 100644 ld/testsuite/ld-sh/textrel2.s create mode 100644 ld/testsuite/ld-sh/tlsbin-0-dso.d create mode 100644 ld/testsuite/ld-sh/tlsbin-1.d create mode 100644 ld/testsuite/ld-sh/tlsbin-2.d create mode 100644 ld/testsuite/ld-sh/tlsbin-3.d create mode 100644 ld/testsuite/ld-sh/tlsbin-4.d create mode 100644 ld/testsuite/ld-sh/tlsbin.s create mode 100644 ld/testsuite/ld-sh/tlsbinpic.s create mode 100644 ld/testsuite/ld-sh/tlslib.s create mode 100644 ld/testsuite/ld-sh/tlspic-1.d create mode 100644 ld/testsuite/ld-sh/tlspic-2.d create mode 100644 ld/testsuite/ld-sh/tlspic-3.d create mode 100644 ld/testsuite/ld-sh/tlspic-4.d create mode 100644 ld/testsuite/ld-sh/tlspic1.s create mode 100644 ld/testsuite/ld-sh/tlspic2.s create mode 100644 ld/testsuite/ld-sh/tlstpoff-1.d create mode 100644 ld/testsuite/ld-sh/tlstpoff-2.d create mode 100644 ld/testsuite/ld-sh/tlstpoff1.s create mode 100644 ld/testsuite/ld-sh/tlstpoff2.s create mode 100644 ld/testsuite/ld-sh/weak1.d create mode 100644 ld/testsuite/ld-sh/weak1.s create mode 100644 ld/testsuite/ld-shared/elf-offset.ld create mode 100644 ld/testsuite/ld-shared/main.c create mode 100644 ld/testsuite/ld-shared/sh1.c create mode 100644 ld/testsuite/ld-shared/sh2.c create mode 100644 ld/testsuite/ld-shared/shared.dat create mode 100644 ld/testsuite/ld-shared/shared.exp create mode 100644 ld/testsuite/ld-shared/sun4.dat create mode 100644 ld/testsuite/ld-shared/symbolic.dat create mode 100644 ld/testsuite/ld-shared/xcoff.dat create mode 100644 ld/testsuite/ld-sparc/sparc.exp create mode 100644 ld/testsuite/ld-sparc/tlsg32.s create mode 100644 ld/testsuite/ld-sparc/tlsg32.sd create mode 100644 ld/testsuite/ld-sparc/tlsg64.s create mode 100644 ld/testsuite/ld-sparc/tlsg64.sd create mode 100644 ld/testsuite/ld-sparc/tlslib.s create mode 100644 ld/testsuite/ld-sparc/tlsnopic.s create mode 100644 ld/testsuite/ld-sparc/tlspic.s create mode 100644 ld/testsuite/ld-sparc/tlssunbin32.dd create mode 100644 ld/testsuite/ld-sparc/tlssunbin32.rd create mode 100644 ld/testsuite/ld-sparc/tlssunbin32.s create mode 100644 ld/testsuite/ld-sparc/tlssunbin32.sd create mode 100644 ld/testsuite/ld-sparc/tlssunbin32.td create mode 100644 ld/testsuite/ld-sparc/tlssunbin64.dd create mode 100644 ld/testsuite/ld-sparc/tlssunbin64.rd create mode 100644 ld/testsuite/ld-sparc/tlssunbin64.s create mode 100644 ld/testsuite/ld-sparc/tlssunbin64.sd create mode 100644 ld/testsuite/ld-sparc/tlssunbin64.td create mode 100644 ld/testsuite/ld-sparc/tlssunbinpic32.s create mode 100644 ld/testsuite/ld-sparc/tlssunbinpic64.s create mode 100644 ld/testsuite/ld-sparc/tlssunnopic32.dd create mode 100644 ld/testsuite/ld-sparc/tlssunnopic32.rd create mode 100644 ld/testsuite/ld-sparc/tlssunnopic32.s create mode 100644 ld/testsuite/ld-sparc/tlssunnopic32.sd create mode 100644 ld/testsuite/ld-sparc/tlssunnopic64.dd create mode 100644 ld/testsuite/ld-sparc/tlssunnopic64.rd create mode 100644 ld/testsuite/ld-sparc/tlssunnopic64.s create mode 100644 ld/testsuite/ld-sparc/tlssunnopic64.sd create mode 100644 ld/testsuite/ld-sparc/tlssunpic32.dd create mode 100644 ld/testsuite/ld-sparc/tlssunpic32.rd create mode 100644 ld/testsuite/ld-sparc/tlssunpic32.s create mode 100644 ld/testsuite/ld-sparc/tlssunpic32.sd create mode 100644 ld/testsuite/ld-sparc/tlssunpic32.td create mode 100644 ld/testsuite/ld-sparc/tlssunpic64.dd create mode 100644 ld/testsuite/ld-sparc/tlssunpic64.rd create mode 100644 ld/testsuite/ld-sparc/tlssunpic64.s create mode 100644 ld/testsuite/ld-sparc/tlssunpic64.sd create mode 100644 ld/testsuite/ld-sparc/tlssunpic64.td create mode 100644 ld/testsuite/ld-srec/sr1.c create mode 100644 ld/testsuite/ld-srec/sr2.c create mode 100644 ld/testsuite/ld-srec/sr3.cc create mode 100644 ld/testsuite/ld-srec/srec.exp create mode 100644 ld/testsuite/ld-undefined/undefined.c create mode 100644 ld/testsuite/ld-undefined/undefined.exp create mode 100644 ld/testsuite/ld-undefined/weak-undef.exp create mode 100644 ld/testsuite/ld-undefined/weak-undef.s create mode 100644 ld/testsuite/ld-undefined/weak-undef.t create mode 100644 ld/testsuite/ld-versados/t1-1.ro create mode 100644 ld/testsuite/ld-versados/t1-2.ro create mode 100644 ld/testsuite/ld-versados/t1.ld create mode 100644 ld/testsuite/ld-versados/t1.ook create mode 100644 ld/testsuite/ld-versados/t2-1.ro create mode 100644 ld/testsuite/ld-versados/t2-2.ro create mode 100644 ld/testsuite/ld-versados/t2-3.ro create mode 100644 ld/testsuite/ld-versados/t2.ld create mode 100644 ld/testsuite/ld-versados/t2.ook create mode 100644 ld/testsuite/ld-versados/versados.exp create mode 100644 ld/testsuite/ld-x86-64/tlsbin.dd create mode 100644 ld/testsuite/ld-x86-64/tlsbin.rd create mode 100644 ld/testsuite/ld-x86-64/tlsbin.s create mode 100644 ld/testsuite/ld-x86-64/tlsbin.sd create mode 100644 ld/testsuite/ld-x86-64/tlsbin.td create mode 100644 ld/testsuite/ld-x86-64/tlsbinpic.s create mode 100644 ld/testsuite/ld-x86-64/tlsg.s create mode 100644 ld/testsuite/ld-x86-64/tlsg.sd create mode 100644 ld/testsuite/ld-x86-64/tlslib.s create mode 100644 ld/testsuite/ld-x86-64/tlspic.dd create mode 100644 ld/testsuite/ld-x86-64/tlspic.rd create mode 100644 ld/testsuite/ld-x86-64/tlspic.sd create mode 100644 ld/testsuite/ld-x86-64/tlspic.td create mode 100644 ld/testsuite/ld-x86-64/tlspic1.s create mode 100644 ld/testsuite/ld-x86-64/tlspic2.s create mode 100644 ld/testsuite/ld-x86-64/x86-64.exp create mode 100644 ld/testsuite/ld-xstormy16/external.s create mode 100644 ld/testsuite/ld-xstormy16/pcrel.d create mode 100644 ld/testsuite/ld-xstormy16/pcrel.s create mode 100644 ld/testsuite/ld-xstormy16/xstormy16.exp create mode 100644 ld/testsuite/ld-xtensa/coalesce.exp create mode 100644 ld/testsuite/ld-xtensa/coalesce.t create mode 100644 ld/testsuite/ld-xtensa/coalesce1.s create mode 100644 ld/testsuite/ld-xtensa/coalesce2.s create mode 100644 ld/testsuite/ld-xtensa/lcall.exp create mode 100644 ld/testsuite/ld-xtensa/lcall.t create mode 100644 ld/testsuite/ld-xtensa/lcall1.s create mode 100644 ld/testsuite/ld-xtensa/lcall2.s create mode 100644 ld/testsuite/lib/ld-lib.exp create mode 100644 libiberty/COPYING.LIB delete mode 100644 libiberty/alloca-botch.h delete mode 100644 libiberty/alloca-conf.h delete mode 100644 libiberty/alloca-norm.h create mode 100644 libiberty/config.h-vms create mode 100644 libiberty/config/mh-aix delete mode 100644 libiberty/config/mh-sysv delete mode 100644 libiberty/config/mh-sysv4 create mode 100644 libiberty/config/mh-windows delete mode 100644 libiberty/config/mt-mingw32 create mode 100644 libiberty/configure.ac delete mode 100644 libiberty/configure.in delete mode 100644 libiberty/dummy.c delete mode 100644 libiberty/functions.def create mode 100644 libiberty/makefile.vms create mode 100644 libiberty/mempcpy.c create mode 100644 libiberty/mpw-config.in create mode 100644 libiberty/mpw-make.sed create mode 100644 libiberty/mpw.c create mode 100644 libiberty/msdos.c create mode 100644 libiberty/pex-common.h create mode 100644 libiberty/pex-djgpp.c create mode 100644 libiberty/pex-mpw.c create mode 100644 libiberty/pex-msdos.c create mode 100644 libiberty/pex-os2.c create mode 100644 libiberty/pex-unix.c create mode 100644 libiberty/pex-win32.c delete mode 100644 libiberty/pexecute.c create mode 100644 libiberty/pexecute.txh create mode 100644 libiberty/snprintf.c create mode 100644 libiberty/stpcpy.c create mode 100644 libiberty/stpncpy.c create mode 100644 libiberty/testsuite/Makefile.in create mode 100644 libiberty/testsuite/demangle-expected create mode 100644 libiberty/testsuite/test-demangle.c create mode 100644 libiberty/vmsbuild.com create mode 100644 libiberty/vsnprintf.c create mode 100644 makefile.vms delete mode 100644 md5.sum create mode 100755 mkdep create mode 100644 opcodes/a29k-dis.c delete mode 100644 opcodes/acconfig.h create mode 100644 opcodes/avr-dis.c create mode 100644 opcodes/cris-dis.c create mode 100644 opcodes/cris-opc.c create mode 100644 opcodes/d10v-dis.c create mode 100644 opcodes/d10v-opc.c create mode 100644 opcodes/d30v-dis.c create mode 100644 opcodes/d30v-opc.c create mode 100644 opcodes/dlx-dis.c create mode 100644 opcodes/fr30-asm.c create mode 100644 opcodes/fr30-desc.c create mode 100644 opcodes/fr30-desc.h create mode 100644 opcodes/fr30-dis.c create mode 100644 opcodes/fr30-ibld.c create mode 100644 opcodes/fr30-opc.c create mode 100644 opcodes/fr30-opc.h create mode 100644 opcodes/frv-asm.c create mode 100644 opcodes/frv-desc.c create mode 100644 opcodes/frv-desc.h create mode 100644 opcodes/frv-dis.c create mode 100644 opcodes/frv-ibld.c create mode 100644 opcodes/frv-opc.c create mode 100644 opcodes/frv-opc.h create mode 100644 opcodes/h8300-dis.c create mode 100644 opcodes/h8500-dis.c create mode 100644 opcodes/h8500-opc.h create mode 100644 opcodes/hppa-dis.c create mode 100644 opcodes/i370-dis.c create mode 100644 opcodes/i370-opc.c create mode 100644 opcodes/i860-dis.c create mode 100644 opcodes/i960-dis.c create mode 100644 opcodes/ip2k-asm.c create mode 100644 opcodes/ip2k-desc.c create mode 100644 opcodes/ip2k-desc.h create mode 100644 opcodes/ip2k-dis.c create mode 100644 opcodes/ip2k-ibld.c create mode 100644 opcodes/ip2k-opc.c create mode 100644 opcodes/ip2k-opc.h create mode 100644 opcodes/iq2000-asm.c create mode 100644 opcodes/iq2000-desc.c create mode 100644 opcodes/iq2000-desc.h create mode 100644 opcodes/iq2000-dis.c create mode 100644 opcodes/iq2000-ibld.c create mode 100644 opcodes/iq2000-opc.c create mode 100644 opcodes/iq2000-opc.h create mode 100644 opcodes/m10200-dis.c create mode 100644 opcodes/m10200-opc.c create mode 100644 opcodes/m10300-dis.c create mode 100644 opcodes/m10300-opc.c create mode 100644 opcodes/m32r-asm.c create mode 100644 opcodes/m32r-desc.c create mode 100644 opcodes/m32r-desc.h create mode 100644 opcodes/m32r-dis.c create mode 100644 opcodes/m32r-ibld.c create mode 100644 opcodes/m32r-opc.c create mode 100644 opcodes/m32r-opc.h create mode 100644 opcodes/m32r-opinst.c create mode 100644 opcodes/m68hc11-dis.c create mode 100644 opcodes/m68hc11-opc.c create mode 100644 opcodes/m68k-dis.c create mode 100644 opcodes/m68k-opc.c create mode 100644 opcodes/m88k-dis.c create mode 100644 opcodes/makefile.vms create mode 100644 opcodes/mcore-dis.c create mode 100644 opcodes/mcore-opc.h create mode 100644 opcodes/mmix-dis.c create mode 100644 opcodes/mmix-opc.c create mode 100644 opcodes/mpw-config.in create mode 100644 opcodes/mpw-make.sed create mode 100644 opcodes/msp430-dis.c create mode 100644 opcodes/ns32k-dis.c create mode 100644 opcodes/openrisc-asm.c create mode 100644 opcodes/openrisc-desc.c create mode 100644 opcodes/openrisc-desc.h create mode 100644 opcodes/openrisc-dis.c create mode 100644 opcodes/openrisc-ibld.c create mode 100644 opcodes/openrisc-opc.c create mode 100644 opcodes/openrisc-opc.h create mode 100644 opcodes/or32-dis.c create mode 100644 opcodes/or32-opc.c create mode 100644 opcodes/pdp11-dis.c create mode 100644 opcodes/pdp11-opc.c create mode 100644 opcodes/pj-dis.c create mode 100644 opcodes/pj-opc.c create mode 100644 opcodes/po/.cvsignore create mode 100644 opcodes/po/da.gmo create mode 100644 opcodes/po/da.po create mode 100644 opcodes/po/de.gmo create mode 100644 opcodes/po/de.po create mode 100644 opcodes/po/es.gmo create mode 100644 opcodes/po/es.po create mode 100644 opcodes/po/fr.gmo create mode 100644 opcodes/po/fr.po create mode 100644 opcodes/po/id.gmo create mode 100644 opcodes/po/id.po create mode 100644 opcodes/po/nl.gmo create mode 100644 opcodes/po/nl.po create mode 100644 opcodes/po/pt_BR.gmo create mode 100644 opcodes/po/pt_BR.po create mode 100644 opcodes/po/ro.gmo create mode 100644 opcodes/po/ro.po create mode 100644 opcodes/po/sv.gmo create mode 100644 opcodes/po/sv.po create mode 100644 opcodes/po/tr.gmo create mode 100644 opcodes/po/tr.po create mode 100644 opcodes/sh64-dis.c create mode 100644 opcodes/sh64-opc.c create mode 100644 opcodes/sh64-opc.h create mode 100644 opcodes/tic30-dis.c create mode 100644 opcodes/tic4x-dis.c create mode 100644 opcodes/tic54x-dis.c create mode 100644 opcodes/tic54x-opc.c create mode 100644 opcodes/tic80-dis.c create mode 100644 opcodes/tic80-opc.c create mode 100644 opcodes/v850-dis.c create mode 100644 opcodes/v850-opc.c create mode 100644 opcodes/vax-dis.c create mode 100644 opcodes/w65-dis.c create mode 100644 opcodes/w65-opc.h create mode 100644 opcodes/xstormy16-asm.c create mode 100644 opcodes/xstormy16-desc.c create mode 100644 opcodes/xstormy16-desc.h create mode 100644 opcodes/xstormy16-dis.c create mode 100644 opcodes/xstormy16-ibld.c create mode 100644 opcodes/xstormy16-opc.c create mode 100644 opcodes/xstormy16-opc.h create mode 100644 opcodes/xtensa-dis.c create mode 100644 opcodes/z8k-dis.c create mode 100644 opcodes/z8k-opc.h create mode 100644 opcodes/z8kgen.c create mode 100644 setup.com create mode 100644 src-release create mode 100644 texinfo/texinfo.tex diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 0000000000000..a73a969e5ff65 --- /dev/null +++ b/.cvsignore @@ -0,0 +1,32 @@ +*-all +*-co +*-dirs +*-done +*-install-info +*-src +*-stamp-* +*-tagged +blockit +cfg-paper.info +config.status +configure.aux +configure.cp +configure.cps +configure.dvi +configure.fn +configure.fns +configure.ky +configure.kys +configure.log +configure.pg +configure.pgs +configure.toc +configure.tp +configure.tps +configure.vr +configure.vrs +dir.info +Makefile +lost+found +update.out +update.sourceware diff --git a/COPYING b/COPYING new file mode 100644 index 0000000000000..60549be514af7 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; 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. + + , 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.LIB b/COPYING.LIB new file mode 100644 index 0000000000000..161a3d1d47b94 --- /dev/null +++ b/COPYING.LIB @@ -0,0 +1,482 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 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. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, 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 library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, 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 companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library 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 Library +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; 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. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/COPYING.LIBGLOSS b/COPYING.LIBGLOSS new file mode 100644 index 0000000000000..741bc2fe0de26 --- /dev/null +++ b/COPYING.LIBGLOSS @@ -0,0 +1,297 @@ +The libgloss subdirectory is a collection of software from several sources. +Each have their own copyrights embedded in each file that they concern. + +(1) University of California, Berkeley + +[1a] + +Copyright (c) 1990 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms are permitted +provided that the above copyright notice and this paragraph are +duplicated in all such forms and that any documentation, +and other materials related to such distribution and use +acknowledge that the software was developed +by the University of California, Berkeley. The name of the +University may not be used to endorse or promote products derived +from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +[1b] + +Copyright (c) 1991, 2000 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by the University of + California, Berkeley and its contributors. +4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +[1c] + +Copyright (c) 1991, 1998, 2001 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. [rescinded 22 July 1999] +4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +------------------------------------------------------------- + Please note that in some of the above alternate licenses, there is a + statement regarding that acknowledgement must be made in any + advertising materials for products using the code. This restriction + no longer applies due to the following license change: + + ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + + In some cases the defunct clause has been removed in modified newlib code and + in some cases, the clause has been left as-is. +------------------------------------------------------------- + +(2) DJ Delorie + +Copyright (C) 1993 DJ Delorie +All rights reserved. + +Redistribution and use in source and binary forms is permitted +provided that the above copyright notice and following paragraph are +duplicated in all such forms. + +This file is distributed WITHOUT ANY WARRANTY; without even the implied +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +(3) GPL (fr30 directory only) + +Copyright (C) 1998 Free Software Foundation, Inc. +Contributed by Cygnus Solutions. + +This file is part of GNU CC. + +GNU CC is free software; 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. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. + +(4) Advanced Micro Devices + +Copyright 1989, 1990 Advanced Micro Devices, Inc. + +This software is the property of Advanced Micro Devices, Inc (AMD) which +specifically grants the user the right to modify, use and distribute this +software provided this notice is not removed or altered. All other rights +are reserved by AMD. + +AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS +SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL +DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR +USE OF THIS SOFTWARE. + +So that all may benefit from your experience, please report any problems +or suggestions about this software to the 29K Technical Support Center at +800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or +0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. + +Advanced Micro Devices, Inc. +29K Support Products +Mail Stop 573 +5900 E. Ben White Blvd. +Austin, TX 78741 +800-292-9263 + +(5) Array Technology Corporation and MIPS (mips/lsi33k-stub.h) + +COPYRIGHT (C) 1991, 1992 ARRAY TECHNOLOGY CORPORATION + All Rights Reserved + +This software is confidential information which is proprietary to and +a trade secret of ARRAY Technology Corporation. Use, duplication, or +disclosure is subject to the terms of a separate license agreement. + +Copyright 1985 by MIPS Computer Systems, Inc. + +(6) University of Utah and the Computer Systems Laboratory (CSL) + [applies only to hppa*-*-pro* targets] + +Copyright (c) 1990,1994 The University of Utah and +the Computer Systems Laboratory (CSL). All rights reserved. + +Permission to use, copy, modify and distribute this software is hereby +granted provided that (1) source code retains these copyright, permission, +and disclaimer notices, and (2) redistributions including binaries +reproduce the notices in supporting documentation, and (3) all advertising +materials mentioning features or use of this software display the following +acknowledgement: ``This product includes software developed by the +Computer Systems Laboratory at the University of Utah.'' + +THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS +IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF +ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + +CSL requests users of this software to return to csl-dist@cs.utah.edu any +improvements that they make and grant CSL redistribution rights. + +(7) Sun Microsystems + +Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + +Developed at SunPro, a Sun Microsystems, Inc. business. +Permission to use, copy, modify, and distribute this +software is freely granted, provided that this notice +is preserved. + +(8) Hewlett Packard + +(c) Copyright 1986 HEWLETT-PACKARD COMPANY + +To anyone who acknowledges that this file is provided "AS IS" +without any express or implied warranty: + permission to use, copy, modify, and distribute this file +for any purpose is hereby granted without fee, provided that +the above copyright notice and this notice appears in all +copies, and that the name of Hewlett-Packard Company not be +used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. +Hewlett-Packard Company makes no representations about the +suitability of this software for any purpose. + +(9) Hans-Peter Nilsson + +Copyright (C) 2001 Hans-Peter Nilsson + +Permission to use, copy, modify, and distribute this software is +freely granted, provided that the above copyright notice, this notice +and the following disclaimer are preserved with no changes. + +THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. + +(10) No Copyright + +THIS SOFTWARE IS NOT COPYRIGHTED + +(11) Cygnus Support / Cygnus Solutions + +Copyright (c) 1995, 1996, 1997, 1998, 1999 Cygnus Support + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +--------------------------------------------------------------- + Please note that the copyright above may be used with the name + Cygnus Solutions instead of Cygnus Support. Both names should + be considered interchangeable. These copyrights are now owned + by Red Hat Incorporated. +--------------------------------------------------------------- + +(12) Red Hat Incorporated + +Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +(13) Default copyright + +Unless otherwise stated in each remaining libgloss file, the remaining +files in the libgloss subdirectory are governed by the following copyright. + +Copyright (c) 1994, 1997, 2001, 2002 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/COPYING.NEWLIB b/COPYING.NEWLIB new file mode 100644 index 0000000000000..60b63dfac6900 --- /dev/null +++ b/COPYING.NEWLIB @@ -0,0 +1,760 @@ +The newlib subdirectory is a collection of software from several sources. +Each file may have its own copyright/license that is embedded in the source +file. + +This list documents those licenses which are more restrictive than +a BSD-like license or require the copyright notice +to be duplicated in documentation and/or other materials associated with +the distribution. Certain licenses documented here only apply to +specific targets. Certain clauses only apply if you are building the +code as part of your binary. + +Note that this list may omit certain licenses that +only pertain to the copying/modifying of the individual source code. +If you are distributing the source code, then you do not need to +worry about these omitted licenses, so long as you do not modify the +copyright information already in place. + +(1) University of California, Berkeley + +[1a] + +Copyright (c) 1990 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms are permitted +provided that the above copyright notice and this paragraph are +duplicated in all such forms and that any documentation, +and other materials related to such distribution and use +acknowledge that the software was developed +by the University of California, Berkeley. The name of the +University may not be used to endorse or promote products derived +from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +[1b] + +Copyright (c) 1990 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms are permitted +provided that the above copyright notice and this paragraph are +duplicated in all such forms and that any documentation, +advertising materials, and other materials related to such +distribution and use acknowledge that the software was developed +by the University of California, Berkeley. The name of the +University may not be used to endorse or promote products derived +from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +[1c] + +Copyright (c) 1981, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 +The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by the University of + California, Berkeley and its contributors. +4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +[1d] + +Copyright (c) 1988, 1990, 1993 Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +[1e] + +Copyright (c) 1982, 1986, 1989, 1991, 1993, 1994 +The Regents of the University of California. All rights reserved. +(c) UNIX System Laboratories, Inc. +All or some portions of this file are derived from material licensed +to the University of California by American Telephone and Telegraph +Co. or Unix System Laboratories, Inc. and are reproduced herein with +the permission of UNIX System Laboratories, Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by the University of + California, Berkeley and its contributors. +4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +[1f] + +Copyright (c) 1987, 1988, 2000 Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms are permitted +provided that: (1) source distributions retain this entire copyright +notice and comment, and (2) distributions including binaries display +the following acknowledgement: ``This product includes software +developed by the University of California, Berkeley and its contributors'' +in the documentation or other materials provided with the distribution +and in all advertising materials mentioning features or use of this +software. Neither the name of the University nor the names of its +contributors may be used to endorse or promote products derived +from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +------------------------------------------------------------- + Please note that in some of the above alternate licenses, there is a + statement regarding that acknowledgement must be made in any + advertising materials for products using the code. This restriction + no longer applies due to the following license change: + + ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change + + In some cases the defunct clause has been removed in modified newlib code and + in some cases, the clause has been left as-is. +------------------------------------------------------------- + +(2) Cygwin (cygwin targets only) + +Copyright 2001 Red Hat, Inc. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. + +(3) David M. Gay at AT&T + +The author of this software is David M. Gay. + +Copyright (c) 1991 by AT&T. + +Permission to use, copy, modify, and distribute this software for any +purpose without fee is hereby granted, provided that this entire notice +is included in all copies of any software which is or includes a copy +or modification of this software and in all copies of the supporting +documentation for such software. + +THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED +WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY +REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY +OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + +(4) Advanced Micro Devices + +Copyright 1989, 1990 Advanced Micro Devices, Inc. + +This software is the property of Advanced Micro Devices, Inc (AMD) which +specifically grants the user the right to modify, use and distribute this +software provided this notice is not removed or altered. All other rights +are reserved by AMD. + +AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS +SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL +DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR +USE OF THIS SOFTWARE. + +So that all may benefit from your experience, please report any problems +or suggestions about this software to the 29K Technical Support Center at +800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or +0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. + +Advanced Micro Devices, Inc. +29K Support Products +Mail Stop 573 +5900 E. Ben White Blvd. +Austin, TX 78741 +800-292-9263 + +(5) C.W. Sandmann + +Copyright (C) 1993 C.W. Sandmann + +This file may be freely distributed as long as the author's name remains. + +(6) Eric Backus + +(C) Copyright 1992 Eric Backus + +This software may be used freely so long as this copyright notice is +left intact. There is no warrantee on this software. + +(7) Sun Microsystems + +Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + +Developed at SunPro, a Sun Microsystems, Inc. business. +Permission to use, copy, modify, and distribute this +software is freely granted, provided that this notice +is preserved. + +(8) Hewlett Packard + +(c) Copyright 1986 HEWLETT-PACKARD COMPANY + +To anyone who acknowledges that this file is provided "AS IS" +without any express or implied warranty: + permission to use, copy, modify, and distribute this file +for any purpose is hereby granted without fee, provided that +the above copyright notice and this notice appears in all +copies, and that the name of Hewlett-Packard Company not be +used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. +Hewlett-Packard Company makes no representations about the +suitability of this software for any purpose. + +(9) Hans-Peter Nilsson + +Copyright (C) 2001 Hans-Peter Nilsson + +Permission to use, copy, modify, and distribute this software is +freely granted, provided that the above copyright notice, this notice +and the following disclaimer are preserved with no changes. + +THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. + +(10) Stephane Carrez (m68hc11-elf/m68hc12-elf targets only) + +Copyright (C) 1999, 2000, 2001, 2002 Stephane Carrez (stcarrez@nerim.fr) + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +(11) Christopher G. Demetriou + +Copyright (c) 2001 Christopher G. Demetriou +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +(12) SuperH, Inc. + +Copyright 2002 SuperH, Inc. All rights reserved + +This software is the property of SuperH, Inc (SuperH) which specifically +grants the user the right to modify, use and distribute this software +provided this notice is not removed or altered. All other rights are +reserved by SuperH. + +SUPERH MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO +THIS SOFTWARE. IN NO EVENT SHALL SUPERH BE LIABLE FOR INDIRECT, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH OR ARISING FROM +THE FURNISHING, PERFORMANCE, OR USE OF THIS SOFTWARE. + +So that all may benefit from your experience, please report any problems +or suggestions about this software to the SuperH Support Center via +e-mail at softwaresupport@superh.com . + +SuperH, Inc. +405 River Oaks Parkway +San Jose +CA 95134 +USA + +(13) Royal Institute of Technology + +Copyright (c) 1999 Kungliga Tekniska Högskolan +(Royal Institute of Technology, Stockholm, Sweden). +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of KTH nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +(14) Alexey Zelkin + +Copyright (c) 2000, 2001 Alexey Zelkin +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +(15) Andrey A. Chernov + +Copyright (C) 1997 by Andrey A. Chernov, Moscow, Russia. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +(16) FreeBSD + +Copyright (c) 1997-2002 FreeBSD Project. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +(17) S. L. Moshier + +Author: S. L. Moshier. + +Copyright (c) 1984,2000 S.L. Moshier + +Permission to use, copy, modify, and distribute this software for any +purpose without fee is hereby granted, provided that this entire notice +is included in all copies of any software which is or includes a copy +or modification of this software and in all copies of the supporting +documentation for such software. + +THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED +WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION +OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS +SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + +(18) Citrus Project + +Copyright (c)1999 Citrus Project, +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +(19) Todd C. Miller + +Copyright (c) 1998 Todd C. Miller +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +(20) DJ Delorie (i386) + +Copyright (C) 1991 DJ Delorie +All rights reserved. + +Redistribution and use in source and binary forms is permitted +provided that the above copyright notice and following paragraph are +duplicated in all such forms. + +This file is distributed WITHOUT ANY WARRANTY; without even the implied +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +(21) Free Software Foundation LGPL License (*-linux* targets only) + + Copyright (C) 1990-1999, 2000, 2001 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Mark Kettenis , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. + +(22) Xavier Leroy LGPL License (i[3456]86-*-linux* targets only) + +Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU Library 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 Library General Public License for more details. + +(23) Intel (i960) + +Copyright (c) 1993 Intel Corporation + +Intel hereby grants you permission to copy, modify, and distribute this +software and its documentation. Intel grants this permission provided +that the above copyright notice appears in all copies and that both the +copyright notice and this permission notice appear in supporting +documentation. In addition, Intel grants this permission provided that +you prominently mark as "not part of the original" any modifications +made to this software or documentation, and that the name of Intel +Corporation not be used in advertising or publicity pertaining to +distribution of the software or the documentation without specific, +written prior permission. + +Intel Corporation provides this AS IS, WITHOUT ANY WARRANTY, EXPRESS OR +IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Intel makes no guarantee or +representations regarding the use of, or the results of the use of, +the software and documentation in terms of correctness, accuracy, +reliability, currentness, or otherwise; and you rely on the software, +documentation and results solely at your own risk. + +IN NO EVENT SHALL INTEL BE LIABLE FOR ANY LOSS OF USE, LOSS OF BUSINESS, +LOSS OF PROFITS, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES +OF ANY KIND. IN NO EVENT SHALL INTEL'S TOTAL LIABILITY EXCEED THE SUM +PAID TO INTEL FOR THE PRODUCT LICENSED HEREUNDER. + +(24) Hewlett-Packard (hppa targets only) + +(c) Copyright 1986 HEWLETT-PACKARD COMPANY + +To anyone who acknowledges that this file is provided "AS IS" +without any express or implied warranty: + permission to use, copy, modify, and distribute this file +for any purpose is hereby granted without fee, provided that +the above copyright notice and this notice appears in all +copies, and that the name of Hewlett-Packard Company not be +used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. +Hewlett-Packard Company makes no representations about the +suitability of this software for any purpose. + +(25) Henry Spencer (only *-linux targets) + +Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved. +This software is not subject to any license of the American Telephone +and Telegraph Company or of the Regents of the University of California. + +Permission is granted to anyone to use this software for any purpose on +any computer system, and to alter it and redistribute it, subject +to the following restrictions: + +1. The author is not responsible for the consequences of use of this + software, no matter how awful, even if they arise from flaws in it. + +2. The origin of this software must not be misrepresented, either by + explicit claim or by omission. Since few users ever read sources, + credits must appear in the documentation. + +3. Altered versions must be plainly marked as such, and must not be + misrepresented as being the original software. Since few users + ever read sources, credits must appear in the documentation. + +4. This notice may not be removed or altered. + +(26) Mike Barcroft + +Copyright (c) 2001 Mike Barcroft +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +(27) Konstantin Chuguev (--enable-newlib-iconv) + +Copyright (c) 1999, 2000 + Konstantin Chuguev. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + + iconv (Charset Conversion Library) v2.0 + +(27) Artem Bityuckiy (--enable-newlib-iconv) + +Copyright (c) 2003, Artem B. Bityuckiy, SoftMine Corporation. +Rights transferred to Franklin Electronic Publishers. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +(28) Red Hat Incorporated + +Unless otherwise stated in each remaining newlib file, the remaining +files in the newlib subdirectory default to the following copyright. +It should be noted that Red Hat Incorporated now owns copyrights +belonging to Cygnus Solutions and Cygnus Support. + +Copyright (c) 1994, 1997, 2001, 2002, 2003, 2004 Red Hat Incorporated. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + The name of Red Hat Incorporated may not be used to endorse + or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/bfd/COPYING b/bfd/COPYING new file mode 100644 index 0000000000000..c27986e64cdef --- /dev/null +++ b/bfd/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright 1989, 1991, 1997 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. + + + Copyright (C) 19yy + + This program is free software; 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. + + , 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/bfd/aix386-core.c b/bfd/aix386-core.c new file mode 100644 index 0000000000000..22d045ae124b5 --- /dev/null +++ b/bfd/aix386-core.c @@ -0,0 +1,272 @@ +/* BFD back-end for AIX on PS/2 core files. + This was based on trad-core.c, which was written by John Gilmore of + Cygnus Support. + Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2000, + 2001, 2002, 2004 + Free Software Foundation, Inc. + Written by Minh Tran-Le . + Converted to back end form by Ian Lance Taylor . + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "coff/i386.h" +#include "coff/internal.h" +#include "libcoff.h" + +#include + +#if defined (_AIX) && defined (_I386) +#define NOCHECKS /* This is for coredump.h. */ +#define _h_USER /* Avoid including user.h from coredump.h. */ +#include +#include +#endif /* _AIX && _I386 */ + +/* Maybe this could work on some other i386 but I have not tried it + * mtranle@paris - Tue Sep 24 12:49:35 1991 + */ + +#ifndef COR_MAGIC +# define COR_MAGIC "core" +#endif + +/* Need this cast because ptr is really void *. */ +#define core_hdr(bfd) \ + (((bfd->tdata.trad_core_data))->hdr) +#define core_section(bfd,n) \ + (((bfd)->tdata.trad_core_data)->sections[n]) +#define core_regsec(bfd) \ + (((bfd)->tdata.trad_core_data)->reg_section) +#define core_reg2sec(bfd) \ + (((bfd)->tdata.trad_core_data)->reg2_section) + +/* These are stored in the bfd's tdata. */ +struct trad_core_struct { + struct corehdr *hdr; /* core file header */ + asection *reg_section; + asection *reg2_section; + asection *sections[MAX_CORE_SEGS]; +}; + +static void swap_abort PARAMS ((void)); + +static const bfd_target * +aix386_core_file_p (abfd) + bfd *abfd; +{ + int i, n; + unsigned char longbuf[4]; /* Raw bytes of various header fields */ + bfd_size_type core_size = sizeof (struct corehdr); + bfd_size_type amt; + struct corehdr *core; + struct mergem { + struct trad_core_struct coredata; + struct corehdr internal_core; + } *mergem; + + amt = sizeof (longbuf); + if (bfd_bread ((PTR) longbuf, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + if (strncmp (longbuf, COR_MAGIC, 4)) + return 0; + + if (bfd_seek (abfd, (file_ptr) 0, 0) != 0) + return 0; + + amt = sizeof (struct mergem); + mergem = (struct mergem *) bfd_zalloc (abfd, amt); + if (mergem == NULL) + return 0; + + core = &mergem->internal_core; + + if ((bfd_bread ((PTR) core, core_size, abfd)) != core_size) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + loser: + bfd_release (abfd, (char *) mergem); + abfd->tdata.any = NULL; + bfd_section_list_clear (abfd); + return 0; + } + + set_tdata (abfd, &mergem->coredata); + core_hdr (abfd) = core; + + /* Create the sections. */ + core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg"); + if (core_regsec (abfd) == NULL) + goto loser; + + core_regsec (abfd)->flags = SEC_HAS_CONTENTS; + core_regsec (abfd)->_raw_size = sizeof (core->cd_regs); + core_regsec (abfd)->vma = (bfd_vma) -1; + + /* We'll access the regs afresh in the core file, like any section. */ + core_regsec (abfd)->filepos = + (file_ptr) offsetof (struct corehdr, cd_regs[0]); + + core_reg2sec (abfd) = bfd_make_section_anyway (abfd, ".reg2"); + if (core_reg2sec (abfd) == NULL) + /* bfd_release frees everything allocated after it's arg. */ + goto loser; + + core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS; + core_reg2sec (abfd)->_raw_size = sizeof (core->cd_fpregs); + core_reg2sec (abfd)->vma = (bfd_vma) -1; + core_reg2sec (abfd)->filepos = + (file_ptr) offsetof (struct corehdr, cd_fpregs); + + for (i = 0, n = 0; (i < MAX_CORE_SEGS) && (core->cd_segs[i].cs_type); i++) + { + const char *sname; + flagword flags; + + if (core->cd_segs[i].cs_offset == 0) + continue; + + switch (core->cd_segs[i].cs_type) + { + case COR_TYPE_DATA: + sname = ".data"; + flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; + break; + case COR_TYPE_STACK: + sname = ".stack"; + flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; + break; + case COR_TYPE_LIBDATA: + sname = ".libdata"; + flags = SEC_ALLOC + SEC_HAS_CONTENTS; + break; + case COR_TYPE_WRITE: + sname = ".writeable"; + flags = SEC_ALLOC + SEC_HAS_CONTENTS; + break; + case COR_TYPE_MSC: + sname = ".misc"; + flags = SEC_ALLOC + SEC_HAS_CONTENTS; + break; + default: + sname = ".unknown"; + flags = SEC_ALLOC + SEC_HAS_CONTENTS; + break; + } + core_section (abfd, n) = bfd_make_section_anyway (abfd, sname); + if (core_section (abfd, n) == NULL) + goto loser; + + core_section (abfd, n)->flags = flags; + core_section (abfd, n)->_raw_size = core->cd_segs[i].cs_len; + core_section (abfd, n)->vma = core->cd_segs[i].cs_address; + core_section (abfd, n)->filepos = core->cd_segs[i].cs_offset; + core_section (abfd, n)->alignment_power = 2; + n++; + } + + return abfd->xvec; +} + +static char * +aix386_core_file_failing_command (abfd) + bfd *abfd; +{ + return core_hdr (abfd)->cd_comm; +} + +static int +aix386_core_file_failing_signal (abfd) + bfd *abfd; +{ + return core_hdr (abfd)->cd_cursig; +} + +static bfd_boolean +aix386_core_file_matches_executable_p (core_bfd, exec_bfd) + bfd *core_bfd; + bfd *exec_bfd; +{ + /* FIXME: We have no way of telling at this point. */ + return TRUE; +} + +/* If somebody calls any byte-swapping routines, shoot them. */ + +static void +swap_abort () +{ + /* This way doesn't require any declaration for ANSI to fuck up. */ + abort (); +} + +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) +#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort) +#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort) +#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort) + +const bfd_target aix386_core_vec = { + "aix386-core", + bfd_target_unknown_flavour, + BFD_ENDIAN_BIG, /* target byte order */ + BFD_ENDIAN_BIG, /* target headers byte order */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + 0, /* leading underscore */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + NO_GET64, NO_GETS64, NO_PUT64, + NO_GET, NO_GETS, NO_PUT, + NO_GET, NO_GETS, NO_PUT, /* data */ + NO_GET64, NO_GETS64, NO_PUT64, + NO_GET, NO_GETS, NO_PUT, + NO_GET, NO_GETS, NO_PUT, /* hdrs */ + + {_bfd_dummy_target, _bfd_dummy_target, + _bfd_dummy_target, aix386_core_file_p}, + {bfd_false, bfd_false, /* bfd_create_object */ + bfd_false, bfd_false}, + {bfd_false, bfd_false, /* bfd_write_contents */ + bfd_false, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (aix386), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), + BFD_JUMP_TABLE_WRITE (_bfd_generic), + BFD_JUMP_TABLE_LINK (_bfd_nolink), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + (PTR) 0 +}; diff --git a/bfd/aix5ppc-core.c b/bfd/aix5ppc-core.c new file mode 100644 index 0000000000000..03510765e1865 --- /dev/null +++ b/bfd/aix5ppc-core.c @@ -0,0 +1,367 @@ +/* IBM RS/6000 "XCOFF" back-end for BFD. + Copyright 2001, 2002 + Free Software Foundation, Inc. + Written by Tom Rix + Contributed by Redhat. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" + +#ifdef AIX_5_CORE + +#include "sysdep.h" +#include "libbfd.h" + +const bfd_target *xcoff64_core_p + PARAMS ((bfd *)); +bfd_boolean xcoff64_core_file_matches_executable_p + PARAMS ((bfd *, bfd *)); +char *xcoff64_core_file_failing_command + PARAMS ((bfd *)); +int xcoff64_core_file_failing_signal + PARAMS ((bfd *)); + +/* Aix 5.1 system include file. */ + +/* Need to define this macro so struct ld_info64 get included. */ +#define __LDINFO_PTRACE64__ +#include +#include + +#define core_hdr(abfd) ((struct core_dumpxx *) abfd->tdata.any) + +#define CHECK_FILE_OFFSET(s, v) \ + ((bfd_signed_vma)(v) < 0 || (bfd_signed_vma)(v) > (bfd_signed_vma)(s).st_size) + +const bfd_target * +xcoff64_core_p (abfd) + bfd *abfd; +{ + struct core_dumpxx core, *new_core_hdr; + struct stat statbuf; + asection *sec; + struct __ld_info64 ldinfo; + bfd_vma ld_offset; + bfd_size_type i; + struct vm_infox vminfo; + bfd_target *return_value = NULL; + + /* Get the header. */ + if (bfd_seek (abfd, 0, SEEK_SET) != 0) + goto xcoff64_core_p_error; + + if (sizeof (struct core_dumpxx) + != bfd_bread (&core, sizeof (struct core_dumpxx), abfd)) + goto xcoff64_core_p_error; + + if (bfd_stat (abfd, &statbuf) < 0) + goto xcoff64_core_p_error; + + /* Sanity checks + c_flag has CORE_VERSION_1, Aix 4+ + c_entries = 0 for Aix 4.3+ + IS_PROC64 is a macro defined in procinfo.h, test for 64 bit process. + + We will still be confused if a Aix 4.3 64 bit core file is + copied over to a Aix 5 machine. + + Check file header offsets + + See rs6000-core.c for comment on size of core + If there isn't enough of a real core file, bail. */ + + if ((CORE_VERSION_1 != (core.c_flag & CORE_VERSION_1)) + || (0 != core.c_entries) + || (! (IS_PROC64 (&core.c_u.U_proc))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_fdsinfox))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_loader))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_loader + core.c_lsize))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_thr))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_segregion))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_stack))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_stack + core.c_size))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_data))) + || ((CHECK_FILE_OFFSET (statbuf, core.c_data + core.c_datasize))) + || (! (core.c_flag & UBLOCK_VALID)) + || (! (core.c_flag & LE_VALID))) + goto xcoff64_core_p_error; + + /* Check for truncated stack or general truncating. */ + if ((! (core.c_flag & USTACK_VALID)) + || (core.c_flag & CORE_TRUNC)) + { + bfd_set_error (bfd_error_file_truncated); + + return return_value; + } + + new_core_hdr = (struct core_dumpxx *) + bfd_zalloc (abfd, sizeof (struct core_dumpxx)); + if (NULL == new_core_hdr) + return return_value; + + memcpy (new_core_hdr, &core, sizeof (struct core_dumpxx)); + core_hdr(abfd) = (char *)new_core_hdr; + + /* .stack section. */ + sec = bfd_make_section_anyway (abfd, ".stack"); + if (NULL == sec) + return return_value; + + sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; + sec->_raw_size = core.c_size; + sec->vma = core.c_stackorg; + sec->filepos = core.c_stack; + + /* .reg section for all registers. */ + sec = bfd_make_section_anyway (abfd, ".reg"); + if (NULL == sec) + return return_value; + + sec->flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY; + sec->_raw_size = sizeof (struct __context64); + sec->vma = 0; + sec->filepos = 0; + sec->contents = (bfd_byte *)&new_core_hdr->c_flt.r64; + + /* .ldinfo section. + To actually find out how long this section is in this particular + core dump would require going down the whole list of struct + ld_info's. See if we can just fake it. */ + sec = bfd_make_section_anyway (abfd, ".ldinfo"); + if (NULL == sec) + return return_value; + + sec->flags = SEC_HAS_CONTENTS; + sec->_raw_size = core.c_lsize; + sec->vma = 0; + sec->filepos = core.c_loader; + + /* AIX 4 adds data sections from loaded objects to the core file, + which can be found by examining ldinfo, and anonymously mmapped + regions. */ + + /* .data section from executable. */ + sec = bfd_make_section_anyway (abfd, ".data"); + if (NULL == sec) + return return_value; + + sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; + sec->_raw_size = core.c_datasize; + sec->vma = core.c_dataorg; + sec->filepos = core.c_data; + + /* .data sections from loaded objects. */ + ld_offset = core.c_loader; + + while (1) + { + if (bfd_seek (abfd, ld_offset, SEEK_SET) != 0) + return return_value; + + if (sizeof (struct __ld_info64) != + bfd_bread (&ldinfo, sizeof (struct __ld_info64), abfd)) + return return_value; + + if (ldinfo.ldinfo_core) + { + sec = bfd_make_section_anyway (abfd, ".data"); + if (NULL == sec) + return return_value; + + sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; + sec->_raw_size = ldinfo.ldinfo_datasize; + sec->vma = ldinfo.ldinfo_dataorg; + sec->filepos = ldinfo.ldinfo_core; + } + + if (0 == ldinfo.ldinfo_next) + break; + ld_offset += ldinfo.ldinfo_next; + } + + /* .vmdata sections from anonymously mmapped regions. */ + if (core.c_vmregions) + { + if (bfd_seek (abfd, core.c_vmm, SEEK_SET) != 0) + return return_value; + + for (i = 0; i < core.c_vmregions; i++) + if (sizeof (struct vm_infox) != + bfd_bread (&vminfo, sizeof (struct vm_infox), abfd)) + return return_value; + + if (vminfo.vminfo_offset) + { + sec = bfd_make_section_anyway (abfd, ".vmdata"); + if (NULL == sec) + return return_value; + + sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; + sec->_raw_size = vminfo.vminfo_size; + sec->vma = vminfo.vminfo_addr; + sec->filepos = vminfo.vminfo_offset; + } + } + + return_value = abfd->xvec; /* This is garbage for now. */ + + xcoff64_core_p_error: + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + + return return_value; +} + +/* Return `TRUE' if given core is from the given executable. */ + +bfd_boolean +xcoff64_core_file_matches_executable_p (core_bfd, exec_bfd) + bfd *core_bfd; + bfd *exec_bfd; +{ + struct core_dumpxx core; + char *path, *s; + size_t alloc; + const char *str1, *str2; + bfd_boolean return_value = FALSE; + + /* Get the header. */ + if (bfd_seek (core_bfd, 0, SEEK_SET) != 0) + return return_value; + + if (sizeof (struct core_dumpxx) != + bfd_bread (&core, sizeof (struct core_dumpxx), core_bfd)) + return return_value; + + if (bfd_seek (core_bfd, core.c_loader, SEEK_SET) != 0) + return return_value; + + alloc = 100; + path = bfd_malloc (alloc); + if (path == NULL) + return return_value; + + s = path; + + while (1) + { + if (bfd_bread (s, 1, core_bfd) != 1) + goto xcoff64_core_file_matches_executable_p_end_1; + + if (*s == '\0') + break; + ++s; + if (s == path + alloc) + { + char *n; + + alloc *= 2; + n = bfd_realloc (path, alloc); + if (n == NULL) + goto xcoff64_core_file_matches_executable_p_end_1; + + s = n + (path - s); + path = n; + } + } + + str1 = strrchr (path, '/'); + str2 = strrchr (exec_bfd->filename, '/'); + + /* Step over character '/'. */ + str1 = str1 != NULL ? str1 + 1 : path; + str2 = str2 != NULL ? str2 + 1 : exec_bfd->filename; + + if (strcmp (str1, str2) == 0) + return_value = TRUE; + + xcoff64_core_file_matches_executable_p_end_1: + free (path); + return return_value; +} + +char * +xcoff64_core_file_failing_command (abfd) + bfd *abfd; +{ + struct core_dumpxx *c = core_hdr (abfd); + char *return_value = 0; + + if (NULL != c) + return_value = c->c_u.U_proc.pi_comm; + + return return_value; +} + +int +xcoff64_core_file_failing_signal (abfd) + bfd *abfd; +{ + struct core_dumpxx *c = core_hdr (abfd); + int return_value = 0; + + if (NULL != c) + return_value = c->c_signo; + + return return_value; +} + +#else /* AIX_5_CORE */ + +const bfd_target *xcoff64_core_p + PARAMS ((bfd *)); +bfd_boolean xcoff64_core_file_matches_executable_p + PARAMS ((bfd *, bfd *)); +char *xcoff64_core_file_failing_command + PARAMS ((bfd *)); +int xcoff64_core_file_failing_signal + PARAMS ((bfd *)); + +const bfd_target * +xcoff64_core_p (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ + bfd_set_error (bfd_error_wrong_format); + return 0; +} + +bfd_boolean +xcoff64_core_file_matches_executable_p (core_bfd, exec_bfd) + bfd *core_bfd ATTRIBUTE_UNUSED; + bfd *exec_bfd ATTRIBUTE_UNUSED; +{ + return FALSE; +} + +char * +xcoff64_core_file_failing_command (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ + return 0; +} + +int +xcoff64_core_file_failing_signal (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ + return 0; +} + +#endif /* AIX_5_CORE */ diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c new file mode 100644 index 0000000000000..052e93829e021 --- /dev/null +++ b/bfd/aout-adobe.c @@ -0,0 +1,571 @@ +/* BFD back-end for a.out.adobe binaries. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, + 2002, 2003 + Free Software Foundation, Inc. + Written by Cygnus Support. Based on bout.c. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#include "aout/adobe.h" + +#include "aout/stab_gnu.h" +#include "libaout.h" /* BFD a.out internal data structures. */ + +/* Forward decl. */ +extern const bfd_target a_out_adobe_vec; + +static const bfd_target *aout_adobe_callback + PARAMS ((bfd *)); +extern bfd_boolean aout_32_slurp_symbol_table + PARAMS ((bfd *abfd)); +extern bfd_boolean aout_32_write_syms + PARAMS ((bfd *)); +static void aout_adobe_write_section + PARAMS ((bfd *abfd, sec_ptr sect)); +static const bfd_target * aout_adobe_object_p + PARAMS ((bfd *)); +static bfd_boolean aout_adobe_mkobject + PARAMS ((bfd *)); +static bfd_boolean aout_adobe_write_object_contents + PARAMS ((bfd *)); +static bfd_boolean aout_adobe_set_section_contents + PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); +static bfd_boolean aout_adobe_set_arch_mach + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +static int aout_adobe_sizeof_headers + PARAMS ((bfd *, bfd_boolean)); + +/* Swaps the information in an executable header taken from a raw byte + stream memory image, into the internal exec_header structure. */ + +void aout_adobe_swap_exec_header_in + PARAMS ((bfd *, struct external_exec *, struct internal_exec *)); + +void +aout_adobe_swap_exec_header_in (abfd, raw_bytes, execp) + bfd *abfd; + struct external_exec *raw_bytes; + struct internal_exec *execp; +{ + struct external_exec *bytes = (struct external_exec *) raw_bytes; + + /* Now fill in fields in the execp, from the bytes in the raw data. */ + execp->a_info = H_GET_32 (abfd, bytes->e_info); + execp->a_text = GET_WORD (abfd, bytes->e_text); + execp->a_data = GET_WORD (abfd, bytes->e_data); + execp->a_bss = GET_WORD (abfd, bytes->e_bss); + execp->a_syms = GET_WORD (abfd, bytes->e_syms); + execp->a_entry = GET_WORD (abfd, bytes->e_entry); + execp->a_trsize = GET_WORD (abfd, bytes->e_trsize); + execp->a_drsize = GET_WORD (abfd, bytes->e_drsize); +} + +/* Swaps the information in an internal exec header structure into the + supplied buffer ready for writing to disk. */ + +void aout_adobe_swap_exec_header_out + PARAMS ((bfd *, struct internal_exec *, struct external_exec *)); + +void +aout_adobe_swap_exec_header_out (abfd, execp, raw_bytes) + bfd *abfd; + struct internal_exec *execp; + struct external_exec *raw_bytes; +{ + struct external_exec *bytes = (struct external_exec *) raw_bytes; + + /* Now fill in fields in the raw data, from the fields in the exec + struct. */ + H_PUT_32 (abfd, execp->a_info , bytes->e_info); + PUT_WORD (abfd, execp->a_text , bytes->e_text); + PUT_WORD (abfd, execp->a_data , bytes->e_data); + PUT_WORD (abfd, execp->a_bss , bytes->e_bss); + PUT_WORD (abfd, execp->a_syms , bytes->e_syms); + PUT_WORD (abfd, execp->a_entry , bytes->e_entry); + PUT_WORD (abfd, execp->a_trsize, bytes->e_trsize); + PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize); +} + +static const bfd_target * +aout_adobe_object_p (abfd) + bfd *abfd; +{ + struct internal_exec anexec; + struct external_exec exec_bytes; + char *targ; + bfd_size_type amt = EXEC_BYTES_SIZE; + + if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + anexec.a_info = H_GET_32 (abfd, exec_bytes.e_info); + + /* Normally we just compare for the magic number. + However, a bunch of Adobe tools aren't fixed up yet; they generate + files using ZMAGIC(!). + If the environment variable GNUTARGET is set to "a.out.adobe", we will + take just about any a.out file as an Adobe a.out file. FIXME! */ + + if (N_BADMAG (anexec)) + { + targ = getenv ("GNUTARGET"); + if (targ && !strcmp (targ, a_out_adobe_vec.name)) + /* Just continue anyway, if specifically set to this format. */ + ; + else + { + bfd_set_error (bfd_error_wrong_format); + return 0; + } + } + + aout_adobe_swap_exec_header_in (abfd, &exec_bytes, &anexec); + return aout_32_some_aout_object_p (abfd, &anexec, aout_adobe_callback); +} + +/* Finish up the opening of a b.out file for reading. Fill in all the + fields that are not handled by common code. */ + +static const bfd_target * +aout_adobe_callback (abfd) + bfd *abfd; +{ + struct internal_exec *execp = exec_hdr (abfd); + asection *sect; + struct external_segdesc ext[1]; + char *section_name; + char try_again[30]; /* Name and number. */ + char *newname; + int trynum; + flagword flags; + + /* Architecture and machine type -- unknown in this format. */ + bfd_set_arch_mach (abfd, bfd_arch_unknown, 0L); + + /* The positions of the string table and symbol table. */ + obj_str_filepos (abfd) = N_STROFF (*execp); + obj_sym_filepos (abfd) = N_SYMOFF (*execp); + + /* Suck up the section information from the file, one section at a time. */ + for (;;) + { + bfd_size_type amt = sizeof (*ext); + if (bfd_bread ((PTR) ext, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + + return 0; + } + switch (ext->e_type[0]) + { + case N_TEXT: + section_name = ".text"; + flags = SEC_CODE | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS; + break; + + case N_DATA: + section_name = ".data"; + flags = SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS; + break; + + case N_BSS: + section_name = ".bss"; + flags = SEC_DATA | SEC_HAS_CONTENTS; + break; + + case 0: + goto no_more_sections; + + default: + (*_bfd_error_handler) + (_("%s: Unknown section type in a.out.adobe file: %x\n"), + bfd_archive_filename (abfd), ext->e_type[0]); + goto no_more_sections; + } + + /* First one is called ".text" or whatever; subsequent ones are + ".text1", ".text2", ... */ + bfd_set_error (bfd_error_no_error); + sect = bfd_make_section (abfd, section_name); + trynum = 0; + + while (!sect) + { + if (bfd_get_error () != bfd_error_no_error) + /* Some other error -- slide into the sunset. */ + return 0; + sprintf (try_again, "%s%d", section_name, ++trynum); + sect = bfd_make_section (abfd, try_again); + } + + /* Fix the name, if it is a sprintf'd name. */ + if (sect->name == try_again) + { + amt = strlen (sect->name); + newname = (char *) bfd_zalloc (abfd, amt); + if (newname == NULL) + return 0; + strcpy (newname, sect->name); + sect->name = newname; + } + + /* Now set the section's attributes. */ + bfd_set_section_flags (abfd, sect, flags); + /* Assumed big-endian. */ + sect->_raw_size = ((ext->e_size[0] << 8) + | ext->e_size[1] << 8 + | ext->e_size[2]); + sect->_cooked_size = sect->_raw_size; + sect->vma = H_GET_32 (abfd, ext->e_virtbase); + sect->filepos = H_GET_32 (abfd, ext->e_filebase); + /* FIXME XXX alignment? */ + + /* Set relocation information for first section of each type. */ + if (trynum == 0) + switch (ext->e_type[0]) + { + case N_TEXT: + sect->rel_filepos = N_TRELOFF (*execp); + sect->reloc_count = execp->a_trsize; + break; + + case N_DATA: + sect->rel_filepos = N_DRELOFF (*execp); + sect->reloc_count = execp->a_drsize; + break; + + default: + break; + } + } + no_more_sections: + + adata (abfd).reloc_entry_size = sizeof (struct reloc_std_external); + adata (abfd).symbol_entry_size = sizeof (struct external_nlist); + adata (abfd).page_size = 1; /* Not applicable. */ + adata (abfd).segment_size = 1; /* Not applicable. */ + adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE; + + return abfd->xvec; +} + +struct bout_data_struct + { + struct aoutdata a; + struct internal_exec e; + }; + +static bfd_boolean +aout_adobe_mkobject (abfd) + bfd *abfd; +{ + struct bout_data_struct *rawptr; + bfd_size_type amt = sizeof (struct bout_data_struct); + + rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, amt); + if (rawptr == NULL) + return FALSE; + + abfd->tdata.bout_data = rawptr; + exec_hdr (abfd) = &rawptr->e; + + adata (abfd).reloc_entry_size = sizeof (struct reloc_std_external); + adata (abfd).symbol_entry_size = sizeof (struct external_nlist); + adata (abfd).page_size = 1; /* Not applicable. */ + adata (abfd).segment_size = 1; /* Not applicable. */ + adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE; + + return TRUE; +} + +static bfd_boolean +aout_adobe_write_object_contents (abfd) + bfd *abfd; +{ + struct external_exec swapped_hdr; + static struct external_segdesc sentinel[1]; /* Initialized to zero. */ + asection *sect; + bfd_size_type amt; + + exec_hdr (abfd)->a_info = ZMAGIC; + + /* Calculate text size as total of text sections, etc. */ + + exec_hdr (abfd)->a_text = 0; + exec_hdr (abfd)->a_data = 0; + exec_hdr (abfd)->a_bss = 0; + exec_hdr (abfd)->a_trsize = 0; + exec_hdr (abfd)->a_drsize = 0; + + for (sect = abfd->sections; sect; sect = sect->next) + { + if (sect->flags & SEC_CODE) + { + exec_hdr (abfd)->a_text += sect->_raw_size; + exec_hdr (abfd)->a_trsize += sect->reloc_count * + sizeof (struct reloc_std_external); + } + else if (sect->flags & SEC_DATA) + { + exec_hdr (abfd)->a_data += sect->_raw_size; + exec_hdr (abfd)->a_drsize += sect->reloc_count * + sizeof (struct reloc_std_external); + } + else if (sect->flags & SEC_ALLOC && !(sect->flags & SEC_LOAD)) + { + exec_hdr (abfd)->a_bss += sect->_raw_size; + } + } + + exec_hdr (abfd)->a_syms = bfd_get_symcount (abfd) + * sizeof (struct external_nlist); + exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd); + + aout_adobe_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr); + + amt = EXEC_BYTES_SIZE; + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 + || bfd_bwrite ((PTR) &swapped_hdr, amt, abfd) != amt) + return FALSE; + + /* Now write out the section information. Text first, data next, rest + afterward. */ + + for (sect = abfd->sections; sect; sect = sect->next) + if (sect->flags & SEC_CODE) + aout_adobe_write_section (abfd, sect); + + for (sect = abfd->sections; sect; sect = sect->next) + if (sect->flags & SEC_DATA) + aout_adobe_write_section (abfd, sect); + + for (sect = abfd->sections; sect; sect = sect->next) + if (!(sect->flags & (SEC_CODE | SEC_DATA))) + aout_adobe_write_section (abfd, sect); + + /* Write final `sentinel` section header (with type of 0). */ + amt = sizeof (*sentinel); + if (bfd_bwrite ((PTR) sentinel, amt, abfd) != amt) + return FALSE; + + /* Now write out reloc info, followed by syms and strings. */ + if (bfd_get_symcount (abfd) != 0) + { + if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (*exec_hdr (abfd))), SEEK_SET) + != 0) + return FALSE; + + if (! aout_32_write_syms (abfd)) + return FALSE; + + if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*exec_hdr (abfd))), SEEK_SET) + != 0) + return FALSE; + + for (sect = abfd->sections; sect; sect = sect->next) + if (sect->flags & SEC_CODE) + if (!aout_32_squirt_out_relocs (abfd, sect)) + return FALSE; + + if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*exec_hdr (abfd))), SEEK_SET) + != 0) + return FALSE; + + for (sect = abfd->sections; sect; sect = sect->next) + if (sect->flags & SEC_DATA) + if (!aout_32_squirt_out_relocs (abfd, sect)) + return FALSE; + } + + return TRUE; +} + +static void +aout_adobe_write_section (abfd, sect) + bfd *abfd ATTRIBUTE_UNUSED; + sec_ptr sect ATTRIBUTE_UNUSED; +{ + /* FIXME XXX */ +} + +static bfd_boolean +aout_adobe_set_section_contents (abfd, section, location, offset, count) + bfd *abfd; + asection *section; + const PTR location; + file_ptr offset; + bfd_size_type count; +{ + file_ptr section_start; + sec_ptr sect; + + /* Set by bfd.c handler. */ + if (! abfd->output_has_begun) + { + /* Assign file offsets to sections. Text sections are first, and + are contiguous. Then data sections. Everything else at the end. */ + section_start = N_TXTOFF (ignore<-->me); + + for (sect = abfd->sections; sect; sect = sect->next) + { + if (sect->flags & SEC_CODE) + { + sect->filepos = section_start; + /* FIXME: Round to alignment. */ + section_start += sect->_raw_size; + } + } + + for (sect = abfd->sections; sect; sect = sect->next) + { + if (sect->flags & SEC_DATA) + { + sect->filepos = section_start; + /* FIXME: Round to alignment. */ + section_start += sect->_raw_size; + } + } + + for (sect = abfd->sections; sect; sect = sect->next) + { + if (sect->flags & SEC_HAS_CONTENTS && + !(sect->flags & (SEC_CODE | SEC_DATA))) + { + sect->filepos = section_start; + /* FIXME: Round to alignment. */ + section_start += sect->_raw_size; + } + } + } + + /* Regardless, once we know what we're doing, we might as well get + going. */ + if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0) + return FALSE; + + if (count == 0) + return TRUE; + + return bfd_bwrite ((PTR) location, count, abfd) == count; +} + +static bfd_boolean +aout_adobe_set_arch_mach (abfd, arch, machine) + bfd *abfd; + enum bfd_architecture arch; + unsigned long machine; +{ + if (! bfd_default_set_arch_mach (abfd, arch, machine)) + return FALSE; + + if (arch == bfd_arch_unknown + || arch == bfd_arch_m68k) + return TRUE; + + return FALSE; +} + +static int +aout_adobe_sizeof_headers (ignore_abfd, ignore) + bfd *ignore_abfd ATTRIBUTE_UNUSED; + bfd_boolean ignore ATTRIBUTE_UNUSED; +{ + return sizeof (struct internal_exec); +} + +/* Build the transfer vector for Adobe A.Out files. */ + +#define aout_32_close_and_cleanup aout_32_bfd_free_cached_info + +#define aout_32_bfd_make_debug_symbol \ + ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr) + +#define aout_32_bfd_reloc_type_lookup \ + ((reloc_howto_type *(*) \ + PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr) + +#define aout_32_set_arch_mach aout_adobe_set_arch_mach +#define aout_32_set_section_contents aout_adobe_set_section_contents + +#define aout_32_sizeof_headers aout_adobe_sizeof_headers +#define aout_32_bfd_get_relocated_section_contents \ + bfd_generic_get_relocated_section_contents +#define aout_32_get_section_contents_in_window _bfd_generic_get_section_contents_in_window +#define aout_32_bfd_relax_section bfd_generic_relax_section +#define aout_32_bfd_gc_sections bfd_generic_gc_sections +#define aout_32_bfd_merge_sections bfd_generic_merge_sections +#define aout_32_bfd_discard_group bfd_generic_discard_group +#define aout_32_bfd_link_hash_table_create \ + _bfd_generic_link_hash_table_create +#define aout_32_bfd_link_hash_table_free \ + _bfd_generic_link_hash_table_free +#define aout_32_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define aout_32_bfd_link_just_syms _bfd_generic_link_just_syms +#define aout_32_bfd_final_link _bfd_generic_final_link +#define aout_32_bfd_link_split_section _bfd_generic_link_split_section + +const bfd_target a_out_adobe_vec = + { + "a.out.adobe", /* name */ + bfd_target_aout_flavour, + BFD_ENDIAN_BIG, /* data byte order is unknown (big assumed) */ + BFD_ENDIAN_BIG, /* hdr byte order is big */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT ), + /* section flags */ + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_DATA | SEC_RELOC), + '_', /* symbol leading char */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + {_bfd_dummy_target, aout_adobe_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {bfd_false, aout_adobe_mkobject, /* bfd_set_format */ + _bfd_generic_mkarchive, bfd_false}, + {bfd_false, aout_adobe_write_object_contents,/* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (aout_32), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd), + BFD_JUMP_TABLE_SYMBOLS (aout_32), + BFD_JUMP_TABLE_RELOCS (aout_32), + BFD_JUMP_TABLE_WRITE (aout_32), + BFD_JUMP_TABLE_LINK (aout_32), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + (PTR) 0 + }; diff --git a/bfd/aout-cris.c b/bfd/aout-cris.c new file mode 100644 index 0000000000000..4d1e48d7bf42c --- /dev/null +++ b/bfd/aout-cris.c @@ -0,0 +1,307 @@ +/* BFD backend for CRIS a.out binaries. + Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Contributed by Axis Communications AB. + Written by Hans-Peter Nilsson. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* See info in the file PORTING for documentation of these macros and + functions. Beware; some of the information there is outdated. */ + +#define N_HEADER_IN_TEXT(x) 0 +#define N_TXTOFF(x) 32 +#define ENTRY_CAN_BE_ZERO +#define TEXT_START_ADDR 0 + +/* Without reading symbols to get the text start symbol, there is no way + to know where the text segment starts in an a.out file. Defaulting to + anything as constant as TEXT_START_ADDR is bad. But we can guess from + the entry point, which is usually within the first 64k of the text + segment. We also assume here that the text segment is 64k-aligned. + FIXME: It is also wrong to assume that data and bss follow immediately + after text, but with those, we don't have any choice besides reading + symbol info, and luckily there's no pressing need for correctness for + those vma:s at this time. */ +#define N_TXTADDR(x) ((x).a_entry & ~(bfd_vma) 0xffff) + +/* If you change this to 4, you can not link to an address N*4+2. */ +#define SEGMENT_SIZE 2 + +/* For some reason, if the a.out file has Z_MAGIC, then + adata(abfd).exec_bytes_size is not used, but rather + adata(abfd).zmagic_disk_block_size, even though the exec_header is + *not* included in the text segment. A simple workaround is to + #define ZMAGIC_DISK_BLOCK_SIZE, which is used if defined; otherwise + TARGET_PAGE_SIZE is used. */ +#define ZMAGIC_DISK_BLOCK_SIZE N_TXTOFF (0) + +/* It seems odd at first to set a page-size this low, but gives greater + freedom in where things can be linked. The drawback is that you have + to set alignment and padding in linker scripts. */ +#define TARGET_PAGE_SIZE SEGMENT_SIZE +#define TARGETNAME "a.out-cris" + +/* N_SHARED_LIB gets this reasonable default as of 1999-07-12, but we + have to work with 2.9.1. Note that N_SHARED_LIB is used in a + SUN-specific context, not applicable to CRIS. */ +#define N_SHARED_LIB(x) 0 + +/* The definition here seems not used; just provided as a convention. */ +#define DEFAULT_ARCH bfd_arch_cris + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (cris_aout_,OP) +#define NAME(x, y) CONCAT3 (cris_aout,_32_,y) + +#include "bfd.h" + +/* Version 1 of the header. */ +#define MY_exec_hdr_flags 1 + +#define MY_write_object_contents MY(write_object_contents) +static bfd_boolean MY(write_object_contents) PARAMS ((bfd *)); + +/* Forward this, so we can use a pointer to it in PARAMS. */ +struct reloc_ext_external; + +#define MY_swap_ext_reloc_out MY(swap_ext_reloc_out) +static void MY(swap_ext_reloc_out) PARAMS ((bfd *, arelent *, + struct reloc_ext_external *)); + +#define MY_swap_ext_reloc_in MY(swap_ext_reloc_in) +static void MY(swap_ext_reloc_in) PARAMS ((bfd *, struct + reloc_ext_external *, + arelent *, asymbol **, + bfd_size_type)); + +#define MY_set_sizes MY(set_sizes) +static bfd_boolean MY(set_sizes) PARAMS ((bfd *)); + +/* To set back reloc_size to ext, we make MY(set_sizes) be called + through this construct. Note that MY_set_arch_mach is only called + through SET_ARCH_MACH. The default bfd_default_set_arch_mach will + not call set_sizes. */ + +#define MY_set_arch_mach NAME (aout, set_arch_mach) +#define SET_ARCH_MACH(BFD, EXEC) \ + MY_set_arch_mach (BFD, DEFAULT_ARCH, N_MACHTYPE (EXEC)) + +/* These macros describe the binary layout of the reloc information we + use in a file. */ +#define RELOC_EXT_BITS_EXTERN_LITTLE 0x80 +#define RELOC_EXT_BITS_TYPE_LITTLE 3 +#define RELOC_EXT_BITS_TYPE_SH_LITTLE 0 + +#ifndef MY_get_section_contents +#define MY_get_section_contents aout_32_get_section_contents +#endif + +#define MACHTYPE_OK(mtype) ((mtype) == M_CRIS) + +/* Include generic functions (some are overridden above). */ +#include "aout32.c" +#include "aout-target.h" + +/* We need our own version to set header flags. */ + +static bfd_boolean +MY(write_object_contents) (abfd) + bfd *abfd; +{ + struct external_exec exec_bytes; + struct internal_exec *execp = exec_hdr (abfd); + + /* We set the reloc type to RELOC_EXT_SIZE, although setting it at all + seems unnecessary when inspecting as and ld behavior (not an + exhaustive inspection). The default write_object_contents + definition sets RELOC_EXT_SIZE, so we follow suite and set it too. */ + obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; + + /* Setting N_SET_MACHTYPE and using N_SET_FLAGS is not performed by + the default definition. */ + if (bfd_get_arch(abfd) == bfd_arch_cris) + N_SET_MACHTYPE(*execp, M_CRIS); + + N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags); + + WRITE_HEADERS (abfd, execp); + + return TRUE; +} + +/* We need our own for these reasons: + - Assert that a normal 8, 16 or 32 reloc is output. + - Fix what seems to be a weak-bug (perhaps there for valid reasons). */ + +static void +MY(swap_ext_reloc_out) (abfd, g, natptr) + bfd *abfd; + arelent *g; + struct reloc_ext_external *natptr; +{ + int r_index; + int r_extern; + unsigned int r_type; + bfd_vma r_addend; + asymbol *sym = *(g->sym_ptr_ptr); + asection *output_section = sym->section->output_section; + + PUT_WORD (abfd, g->address, natptr->r_address); + + r_type = (unsigned int) g->howto->type; + + r_addend = g->addend; + if ((sym->flags & BSF_SECTION_SYM) != 0) + r_addend += (*(g->sym_ptr_ptr))->section->output_section->vma; + + /* If this relocation is relative to a symbol then set the + r_index to the symbols index, and the r_extern bit. + + Absolute symbols can come in in two ways, either as an offset + from the abs section, or as a symbol which has an abs value. + check for that here. */ + + if (bfd_is_abs_section (bfd_get_section (sym))) + { + r_extern = 0; + r_index = N_ABS; + } + else if ((sym->flags & BSF_SECTION_SYM) == 0) + { + if (bfd_is_und_section (bfd_get_section (sym)) + /* Remember to check for weak symbols; they count as global. */ + || (sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0) + r_extern = 1; + else + r_extern = 0; + r_index = (*(g->sym_ptr_ptr))->KEEPIT; + } + else + { + /* Just an ordinary section. */ + r_extern = 0; + r_index = output_section->target_index; + } + + /* The relocation type is the same as the canonical ones, but only + the first 3 are used: RELOC_8, RELOC_16, RELOC_32. + We may change this later, but assert this for the moment. */ + if (r_type > 2) + { + (*_bfd_error_handler) (_("%s: Invalid relocation type exported: %d"), + bfd_get_filename (abfd), r_type); + + bfd_set_error (bfd_error_wrong_format); + } + + /* Now the fun stuff. */ + natptr->r_index[2] = r_index >> 16; + natptr->r_index[1] = r_index >> 8; + natptr->r_index[0] = r_index; + natptr->r_type[0] = + (r_extern ? RELOC_EXT_BITS_EXTERN_LITTLE : 0) + | (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE); + + PUT_WORD (abfd, r_addend, natptr->r_addend); +} + +/* We need our own to assert that a normal 8, 16 or 32 reloc is input. */ + +static void +MY(swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) + bfd *abfd; + struct reloc_ext_external *bytes; + arelent *cache_ptr; + asymbol **symbols; + bfd_size_type symcount; +{ + unsigned int r_index; + int r_extern; + unsigned int r_type; + struct aoutdata *su = &(abfd->tdata.aout_data->a); + + cache_ptr->address = (GET_SWORD (abfd, bytes->r_address)); + + /* Now the fun stuff. */ + r_index = (bytes->r_index[2] << 16) + | (bytes->r_index[1] << 8) + | bytes->r_index[0]; + r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); + r_type = ((bytes->r_type[0]) >> RELOC_EXT_BITS_TYPE_SH_LITTLE) + & RELOC_EXT_BITS_TYPE_LITTLE; + + if (r_type > 2) + { + (*_bfd_error_handler) (_("%s: Invalid relocation type imported: %d"), + bfd_archive_filename (abfd), r_type); + + bfd_set_error(bfd_error_wrong_format); + } + + cache_ptr->howto = howto_table_ext + r_type; + + if (r_extern && r_index > symcount) + { + (*_bfd_error_handler) + (_("%s: Bad relocation record imported: %d"), + bfd_archive_filename (abfd), r_index); + + bfd_set_error (bfd_error_wrong_format); + + /* We continue, so we can catch further errors. */ + r_extern = 0; + r_index = N_ABS; + } + + /* Magically uses r_extern, symbols etc. Ugly, but it's what's in the + default. */ + MOVE_ADDRESS (GET_SWORD (abfd, bytes->r_addend)); +} + +/* We use the same as the default, except that we also set + "obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;", to avoid changing + NAME (aout, set_arch_mach) in aoutx. */ + +static bfd_boolean +MY(set_sizes) (abfd) + bfd *abfd; +{ + /* Just as the default in aout-target.h (with some #ifdefs folded)... */ + + adata(abfd).page_size = TARGET_PAGE_SIZE; + adata(abfd).segment_size = SEGMENT_SIZE; + adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE; + adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; + + /* ... except for that we have the extended reloc. The alternative + would be to add a check on bfd_arch_cris in NAME (aout, + set_arch_mach) in aoutx.h, but I don't want to do that since + target-specific things should not be added there. */ + + obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; + + return TRUE; +} + +/* + * Local variables: + * eval: (c-set-style "gnu") + * indent-tabs-mode: t + * End: + */ diff --git a/bfd/aout-ns32k.c b/bfd/aout-ns32k.c new file mode 100644 index 0000000000000..1ac8d710a8ea3 --- /dev/null +++ b/bfd/aout-ns32k.c @@ -0,0 +1,379 @@ +/* BFD back-end for ns32k a.out-ish binaries. + Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Contributed by Ian Dall (idall@eleceng.adelaide.edu.au). + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "aout/aout64.h" +#include "ns32k.h" + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MYNS(OP) CONCAT2 (ns32kaout_,OP) + +reloc_howto_type * +MYNS(bfd_reloc_type_lookup) + PARAMS((bfd *abfd AND + bfd_reloc_code_real_type code)); + +bfd_boolean +MYNS(write_object_contents) + PARAMS((bfd *abfd)); + +/* Avoid multiple definitions from aoutx if supporting + standard a.out format(s) as well as this one. */ +#define NAME(x,y) CONCAT3 (ns32kaout,_32_,y) + +void bfd_ns32k_arch PARAMS ((void)); + +#include "libaout.h" + +#define MY(OP) MYNS(OP) + +#define MY_swap_std_reloc_in MY(swap_std_reloc_in) +#define MY_swap_std_reloc_out MY(swap_std_reloc_out) + +static void +MY_swap_std_reloc_in PARAMS ((bfd *, struct reloc_std_external *, + arelent *, asymbol **, + bfd_size_type)); +static void +MY_swap_std_reloc_out PARAMS ((bfd *, arelent *, + struct reloc_std_external *)); +reloc_howto_type * +MY(reloc_howto) PARAMS ((bfd *, struct reloc_std_external *, + int *, int *, int *)); +void +MY(put_reloc) PARAMS ((bfd *, int, int, bfd_vma, reloc_howto_type *, + struct reloc_std_external *)); + +/* The ns32k series is ah, unusual, when it comes to relocation. + There are three storage methods for relocatable objects. There + are displacements, immediate operands and ordinary twos complement + data. Of these, only the last fits into the standard relocation + scheme. Immediate operands are stored huffman encoded and + immediate operands are stored big endian (where as the natural byte + order is little endian for this architecture). + + Note that the ns32k displacement storage method is orthogonal to + whether the relocation is pc relative or not. The "displacement" + storage scheme is used for essentially all address constants. The + displacement can be relative to zero (absolute displacement), + relative to the pc (pc relative), the stack pointer, the frame + pointer, the static base register and general purpose register etc. + + For example: + + sym1: .long . # pc relative 2's complement + sym1: .long foo # 2's complement not pc relative + + self: movd @self, r0 # pc relative displacement + movd foo, r0 # non pc relative displacement + + self: movd self, r0 # pc relative immediate + movd foo, r0 # non pc relative immediate + + In addition, for historical reasons the encoding of the relocation types + in the a.out format relocation entries is such that even the relocation + methods which are standard are not encoded the standard way. */ + +reloc_howto_type MY(howto_table)[] = + { + /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */ + /* ns32k immediate operands. */ + HOWTO (BFD_RELOC_NS32K_IMM_8, 0, 0, 8, FALSE, 0, complain_overflow_signed, + _bfd_ns32k_reloc_imm, "NS32K_IMM_8", + TRUE, 0x000000ff,0x000000ff, FALSE), + HOWTO (BFD_RELOC_NS32K_IMM_16, 0, 1, 16, FALSE, 0, complain_overflow_signed, + _bfd_ns32k_reloc_imm, "NS32K_IMM_16", + TRUE, 0x0000ffff,0x0000ffff, FALSE), + HOWTO (BFD_RELOC_NS32K_IMM_32, 0, 2, 32, FALSE, 0, complain_overflow_signed, + _bfd_ns32k_reloc_imm, "NS32K_IMM_32", + TRUE, 0xffffffff,0xffffffff, FALSE), + HOWTO (BFD_RELOC_NS32K_IMM_8_PCREL, 0, 0, 8, TRUE, 0, complain_overflow_signed, + _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_8", + TRUE, 0x000000ff, 0x000000ff, FALSE), + HOWTO (BFD_RELOC_NS32K_IMM_16_PCREL, 0, 1, 16, TRUE, 0, complain_overflow_signed, + _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_16", + TRUE, 0x0000ffff,0x0000ffff, FALSE), + HOWTO (BFD_RELOC_NS32K_IMM_32_PCREL, 0, 2, 32, TRUE, 0, complain_overflow_signed, + _bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_32", + TRUE, 0xffffffff,0xffffffff, FALSE), + + /* ns32k displacements. */ + HOWTO (BFD_RELOC_NS32K_DISP_8, 0, 0, 7, FALSE, 0, complain_overflow_signed, + _bfd_ns32k_reloc_disp, "NS32K_DISP_8", + TRUE, 0x000000ff,0x000000ff, FALSE), + HOWTO (BFD_RELOC_NS32K_DISP_16, 0, 1, 14, FALSE, 0, complain_overflow_signed, + _bfd_ns32k_reloc_disp, "NS32K_DISP_16", + TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (BFD_RELOC_NS32K_DISP_32, 0, 2, 30, FALSE, 0, complain_overflow_signed, + _bfd_ns32k_reloc_disp, "NS32K_DISP_32", + TRUE, 0xffffffff, 0xffffffff, FALSE), + HOWTO (BFD_RELOC_NS32K_DISP_8_PCREL, 0, 0, 7, TRUE, 0, complain_overflow_signed, + _bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_8", + TRUE, 0x000000ff,0x000000ff, FALSE), + HOWTO (BFD_RELOC_NS32K_DISP_16_PCREL, 0, 1, 14, TRUE, 0, complain_overflow_signed, + _bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_16", + TRUE, 0x0000ffff,0x0000ffff, FALSE), + HOWTO (BFD_RELOC_NS32K_DISP_32_PCREL, 0, 2, 30, TRUE, 0, complain_overflow_signed, + _bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_32", + TRUE, 0xffffffff,0xffffffff, FALSE), + + /* Normal 2's complement. */ + HOWTO (BFD_RELOC_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0, + "8", TRUE, 0x000000ff,0x000000ff, FALSE), + HOWTO (BFD_RELOC_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0, + "16", TRUE, 0x0000ffff,0x0000ffff, FALSE), + HOWTO (BFD_RELOC_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0, + "32", TRUE, 0xffffffff,0xffffffff, FALSE), + HOWTO (BFD_RELOC_8_PCREL, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0, + "PCREL_8", TRUE, 0x000000ff,0x000000ff, FALSE), + HOWTO (BFD_RELOC_16_PCREL, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, + "PCREL_16", TRUE, 0x0000ffff,0x0000ffff, FALSE), + HOWTO (BFD_RELOC_32_PCREL, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, + "PCREL_32", TRUE, 0xffffffff,0xffffffff, FALSE), + }; + +#define CTOR_TABLE_RELOC_HOWTO(BFD) (MY(howto_table) + 14) + +#define RELOC_STD_BITS_NS32K_TYPE_BIG 0x06 +#define RELOC_STD_BITS_NS32K_TYPE_LITTLE 0x60 +#define RELOC_STD_BITS_NS32K_TYPE_SH_BIG 1 +#define RELOC_STD_BITS_NS32K_TYPE_SH_LITTLE 5 + +reloc_howto_type * +MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel) + bfd *abfd ATTRIBUTE_UNUSED; + struct reloc_std_external *rel; + int *r_index; + int *r_extern; + int *r_pcrel; +{ + unsigned int r_length; + int r_ns32k_type; + + /* BFD_ASSERT(bfd_header_little_endian (abfd)); */ + *r_index = ((rel->r_index[2] << 16) + | (rel->r_index[1] << 8) + | rel->r_index[0] ); + *r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); + *r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); + r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) + >> RELOC_STD_BITS_LENGTH_SH_LITTLE); + r_ns32k_type = ((rel->r_type[0] & RELOC_STD_BITS_NS32K_TYPE_LITTLE) + >> RELOC_STD_BITS_NS32K_TYPE_SH_LITTLE); + return (MY(howto_table) + r_length + 3 * (*r_pcrel) + 6 * r_ns32k_type); +} + +#define MY_reloc_howto(BFD, REL, IN, EX, PC) \ + MY(reloc_howto) (BFD, REL, &IN, &EX, &PC) + +void +MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc) + bfd *abfd; + int r_extern; + int r_index; + bfd_vma value; + reloc_howto_type *howto; + struct reloc_std_external *reloc; +{ + unsigned int r_length; + int r_pcrel; + int r_ns32k_type; + + PUT_WORD (abfd, value, reloc->r_address); + r_length = howto->size ; /* Size as a power of two. */ + r_pcrel = (int) howto->pc_relative; /* Relative to PC? */ + r_ns32k_type = (howto - MY(howto_table) )/6; + + /* BFD_ASSERT (bfd_header_little_endian (abfd)); */ + reloc->r_index[2] = r_index >> 16; + reloc->r_index[1] = r_index >> 8; + reloc->r_index[0] = r_index; + reloc->r_type[0] = + (r_extern? RELOC_STD_BITS_EXTERN_LITTLE: 0) + | (r_pcrel? RELOC_STD_BITS_PCREL_LITTLE: 0) + | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE) + | (r_ns32k_type << RELOC_STD_BITS_NS32K_TYPE_SH_LITTLE); +} + +#define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \ + MY(put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC) + +#define STAT_FOR_EXEC + +#define MY_final_link_relocate _bfd_ns32k_final_link_relocate +#define MY_relocate_contents _bfd_ns32k_relocate_contents + +#include "aoutx.h" + +reloc_howto_type * +MY(bfd_reloc_type_lookup) (abfd,code) + bfd *abfd; + bfd_reloc_code_real_type code; +{ + +#define ENTRY(i,j) case i: return &MY(howto_table)[j] + + int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE; + + BFD_ASSERT(ext == 0); + if (code == BFD_RELOC_CTOR) + switch (bfd_get_arch_info (abfd)->bits_per_address) + { + case 32: + code = BFD_RELOC_32; + break; + default: + break; + } + switch (code) + { + ENTRY(BFD_RELOC_NS32K_IMM_8, 0); + ENTRY(BFD_RELOC_NS32K_IMM_16, 1); + ENTRY(BFD_RELOC_NS32K_IMM_32, 2); + ENTRY(BFD_RELOC_NS32K_IMM_8_PCREL, 3); + ENTRY(BFD_RELOC_NS32K_IMM_16_PCREL, 4); + ENTRY(BFD_RELOC_NS32K_IMM_32_PCREL, 5); + ENTRY(BFD_RELOC_NS32K_DISP_8, 6); + ENTRY(BFD_RELOC_NS32K_DISP_16, 7); + ENTRY(BFD_RELOC_NS32K_DISP_32, 8); + ENTRY(BFD_RELOC_NS32K_DISP_8_PCREL, 9); + ENTRY(BFD_RELOC_NS32K_DISP_16_PCREL, 10); + ENTRY(BFD_RELOC_NS32K_DISP_32_PCREL, 11); + ENTRY(BFD_RELOC_8, 12); + ENTRY(BFD_RELOC_16, 13); + ENTRY(BFD_RELOC_32, 14); + ENTRY(BFD_RELOC_8_PCREL, 15); + ENTRY(BFD_RELOC_16_PCREL, 16); + ENTRY(BFD_RELOC_32_PCREL, 17); + default: + return (reloc_howto_type *) NULL; + } +#undef ENTRY +} + +static void +MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount) + bfd *abfd; + struct reloc_std_external *bytes; + arelent *cache_ptr; + asymbol **symbols; + bfd_size_type symcount ATTRIBUTE_UNUSED; +{ + int r_index; + int r_extern; + int r_pcrel; + struct aoutdata *su = &(abfd->tdata.aout_data->a); + + cache_ptr->address = H_GET_32 (abfd, bytes->r_address); + + /* Now the fun stuff. */ + cache_ptr->howto = MY_reloc_howto(abfd, bytes, r_index, r_extern, r_pcrel); + + MOVE_ADDRESS (0); +} + +static void +MY_swap_std_reloc_out (abfd, g, natptr) + bfd *abfd; + arelent *g; + struct reloc_std_external *natptr; +{ + int r_index; + asymbol *sym = *(g->sym_ptr_ptr); + int r_extern; + unsigned int r_addend; + asection *output_section = sym->section->output_section; + + r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma; + + /* Name was clobbered by aout_write_syms to be symbol index. */ + + /* If this relocation is relative to a symbol then set the + r_index to the symbols index, and the r_extern bit. + + Absolute symbols can come in in two ways, either as an offset + from the abs section, or as a symbol which has an abs value. + Check for that here. */ + if (bfd_is_com_section (output_section) + || output_section == &bfd_abs_section + || output_section == &bfd_und_section) + { + if (bfd_abs_section.symbol == sym) + { + /* Whoops, looked like an abs symbol, but is really an offset + from the abs section. */ + r_index = 0; + r_extern = 0; + } + else + { + /* Fill in symbol. */ + r_extern = 1; +#undef KEEPIT +#define KEEPIT udata.i + r_index = (*(g->sym_ptr_ptr))->KEEPIT; +#undef KEEPIT + } + } + else + { + /* Just an ordinary section. */ + r_extern = 0; + r_index = output_section->target_index; + } + + MY_put_reloc (abfd, r_extern, r_index, g->address, g->howto, natptr); +} + +bfd_reloc_status_type +_bfd_ns32k_relocate_contents (howto, input_bfd, relocation, location) + reloc_howto_type *howto; + bfd *input_bfd; + bfd_vma relocation; + bfd_byte *location; +{ + int r_ns32k_type = (howto - MY(howto_table)) / 6; + bfd_vma (*get_data) PARAMS ((bfd_byte *, int)); + void (*put_data) PARAMS ((bfd_vma, bfd_byte *, int)); + + switch (r_ns32k_type) + { + case 0: + get_data = _bfd_ns32k_get_immediate; + put_data = _bfd_ns32k_put_immediate; + break; + case 1: + get_data = _bfd_ns32k_get_displacement; + put_data = _bfd_ns32k_put_displacement; + break; + case 2: + return _bfd_relocate_contents (howto, input_bfd, relocation, + location); + /* NOT REACHED */ + break; + default: + return bfd_reloc_notsupported; + } + return _bfd_do_ns32k_reloc_contents (howto, input_bfd, relocation, + location, get_data, put_data); +} diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c new file mode 100644 index 0000000000000..1f37b995d7b3e --- /dev/null +++ b/bfd/aout-tic30.c @@ -0,0 +1,1102 @@ +/* BFD back-end for TMS320C30 a.out binaries. + Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#define TARGET_IS_BIG_ENDIAN_P +#define N_HEADER_IN_TEXT(x) 1 +#define TEXT_START_ADDR 1024 +#define TARGET_PAGE_SIZE 128 +#define SEGMENT_SIZE TARGET_PAGE_SIZE +#define DEFAULT_ARCH bfd_arch_tic30 +#define ARCH_SIZE 32 + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (tic30_aout_,OP) +#define TARGETNAME "a.out-tic30" +#define NAME(x,y) CONCAT3 (tic30_aout,_32_,y) + +#include "bfd.h" +#include "sysdep.h" +#include "libaout.h" + +#include "aout/aout64.h" +#include "aout/stab_gnu.h" +#include "aout/ar.h" + +static bfd_reloc_status_type tic30_aout_fix_16 + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type tic30_aout_fix_32 + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type tic30_aout_fix_pcrel_16 + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static reloc_howto_type *tic30_aout_reloc_howto + PARAMS ((bfd *, struct reloc_std_external *, int *, int *, int *)); +static bfd_reloc_status_type tic30_aout_relocate_contents + PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *)); +static bfd_reloc_status_type tic30_aout_final_link_relocate + PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma, + bfd_vma, bfd_vma)); +static const bfd_target *tic30_aout_object_p + PARAMS ((bfd *)); +static bfd_boolean tic30_aout_write_object_contents + PARAMS ((bfd *)); +static bfd_boolean tic30_aout_set_sizes + PARAMS ((bfd *)); +static const bfd_target * tic30_aout_callback + PARAMS ((bfd *)); +static bfd_boolean MY_bfd_copy_private_section_data + PARAMS ((bfd *, asection *, bfd *, asection *)); +static bfd_boolean MY_bfd_final_link + PARAMS ((bfd *, struct bfd_link_info *)); +reloc_howto_type * tic30_aout_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +enum machine_type tic30_aout_machine_type + PARAMS ((enum bfd_architecture, unsigned long, bfd_boolean *)); +bfd_boolean tic30_aout_set_arch_mach + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); + +#define MY_reloc_howto(BFD, REL, IN, EX, PC) \ + tic30_aout_reloc_howto(BFD, REL, &IN, &EX, &PC) +#define MY_final_link_relocate tic30_aout_final_link_relocate +#define MY_object_p tic30_aout_object_p +#define MY_mkobject NAME(aout,mkobject) +#define MY_write_object_contents tic30_aout_write_object_contents +#define MY_set_sizes tic30_aout_set_sizes + +#ifndef MY_exec_hdr_flags +#define MY_exec_hdr_flags 1 +#endif + +#ifndef MY_backend_data + +#ifndef MY_zmagic_contiguous +#define MY_zmagic_contiguous 0 +#endif +#ifndef MY_text_includes_header +#define MY_text_includes_header 0 +#endif +#ifndef MY_entry_is_text_address +#define MY_entry_is_text_address 0 +#endif +#ifndef MY_exec_header_not_counted +#define MY_exec_header_not_counted 1 +#endif +#ifndef MY_add_dynamic_symbols +#define MY_add_dynamic_symbols 0 +#endif +#ifndef MY_add_one_symbol +#define MY_add_one_symbol 0 +#endif +#ifndef MY_link_dynamic_object +#define MY_link_dynamic_object 0 +#endif +#ifndef MY_write_dynamic_symbol +#define MY_write_dynamic_symbol 0 +#endif +#ifndef MY_check_dynamic_reloc +#define MY_check_dynamic_reloc 0 +#endif +#ifndef MY_finish_dynamic_link +#define MY_finish_dynamic_link 0 +#endif + +static const struct aout_backend_data tic30_aout_backend_data = +{ + MY_zmagic_contiguous, + MY_text_includes_header, + MY_entry_is_text_address, + MY_exec_hdr_flags, + 0, /* text vma? */ + MY_set_sizes, + MY_exec_header_not_counted, + MY_add_dynamic_symbols, + MY_add_one_symbol, + MY_link_dynamic_object, + MY_write_dynamic_symbol, + MY_check_dynamic_reloc, + MY_finish_dynamic_link +}; +#define MY_backend_data &tic30_aout_backend_data +#endif + +/* FIXME: This is wrong. aoutx.h should really only be included by + aout32.c. */ + +#include "aoutx.h" + +/* This table lists the relocation types for the TMS320C30. There are + only a few relocations required, and all must be divided by 4 (>> + 2) to get the 32-bit addresses in the format the TMS320C30 likes + it. */ +reloc_howto_type tic30_aout_howto_table[] = + { + EMPTY_HOWTO (-1), + HOWTO (1, 2, 1, 16, FALSE, 0, 0, tic30_aout_fix_16, + "16", FALSE, 0x0000FFFF, 0x0000FFFF, FALSE), + HOWTO (2, 2, 2, 24, FALSE, 0, complain_overflow_bitfield, NULL, + "24", FALSE, 0x00FFFFFF, 0x00FFFFFF, FALSE), + HOWTO (3, 18, 3, 24, FALSE, 0, complain_overflow_bitfield, NULL, + "LDP", FALSE, 0x00FF0000, 0x000000FF, FALSE), + HOWTO (4, 2, 4, 32, FALSE, 0, complain_overflow_bitfield, tic30_aout_fix_32, + "32", FALSE, 0xFFFFFFFF, 0xFFFFFFFF, FALSE), + HOWTO (5, 2, 1, 16, TRUE, 0, complain_overflow_signed, + tic30_aout_fix_pcrel_16, "PCREL", TRUE, 0x0000FFFF, 0x0000FFFF, TRUE), + EMPTY_HOWTO (-1), + EMPTY_HOWTO (-1), + EMPTY_HOWTO (-1), + EMPTY_HOWTO (-1), + EMPTY_HOWTO (-1) + }; + +extern reloc_howto_type *NAME (aout, reloc_type_lookup) + PARAMS ((bfd *, bfd_reloc_code_real_type)); + +reloc_howto_type * +tic30_aout_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + switch (code) + { + case BFD_RELOC_8: + case BFD_RELOC_TIC30_LDP: + return &tic30_aout_howto_table[3]; + case BFD_RELOC_16: + return &tic30_aout_howto_table[1]; + case BFD_RELOC_24: + return &tic30_aout_howto_table[2]; + case BFD_RELOC_16_PCREL: + return &tic30_aout_howto_table[5]; + case BFD_RELOC_32: + return &tic30_aout_howto_table[4]; + default: + return (reloc_howto_type *) NULL; + } +} + +static reloc_howto_type * +tic30_aout_reloc_howto (abfd, relocs, r_index, r_extern, r_pcrel) + bfd *abfd; + struct reloc_std_external *relocs; + int *r_index; + int *r_extern; + int *r_pcrel; +{ + unsigned int r_length; + unsigned int r_pcrel_done; + int index; + + *r_pcrel = 0; + if (bfd_header_big_endian (abfd)) + { + *r_index = ((relocs->r_index[0] << 16) | (relocs->r_index[1] << 8) | relocs->r_index[2]); + *r_extern = (0 != (relocs->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); + r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); + r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) >> RELOC_STD_BITS_LENGTH_SH_BIG); + } + else + { + *r_index = ((relocs->r_index[2] << 16) | (relocs->r_index[1] << 8) | relocs->r_index[0]); + *r_extern = (0 != (relocs->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); + r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); + r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) >> RELOC_STD_BITS_LENGTH_SH_LITTLE); + } + index = r_length + 4 * r_pcrel_done; + return tic30_aout_howto_table + index; +} + +/* This function is used as a callback for 16-bit relocs. This is + required for relocations between segments. A line in aoutx.h + requires that any relocations for the data section should point to + the end of the aligned text section, plus an offset. By default, + this does not happen, therefore this function takes care of + that. */ + +static bfd_reloc_status_type +tic30_aout_fix_16 (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section ATTRIBUTE_UNUSED; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + bfd_vma relocation; + + /* Make sure that the symbol's section is defined. */ + if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0) + return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined; + /* Get the size of the input section and turn it into the TMS320C30 + 32-bit address format. */ + relocation = (symbol->section->vma >> 2); + relocation += bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); + bfd_put_16 (abfd, relocation, (bfd_byte *) data + reloc_entry->address); + return bfd_reloc_ok; +} + +/* This function does the same thing as tic30_aout_fix_16 except for 32 + bit relocations. */ + +static bfd_reloc_status_type +tic30_aout_fix_32 (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section ATTRIBUTE_UNUSED; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + bfd_vma relocation; + + /* Make sure that the symbol's section is defined. */ + if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0) + return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined; + /* Get the size of the input section and turn it into the TMS320C30 + 32-bit address format. */ + relocation = (symbol->section->vma >> 2); + relocation += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); + bfd_put_32 (abfd, relocation, (bfd_byte *) data + reloc_entry->address); + return bfd_reloc_ok; +} + +/* This function is used to work out pc-relative offsets for the + TMS320C30. The data already placed by md_pcrel_from within gas is + useless for a relocation, so we just get the offset value and place + a version of this within the object code. + tic30_aout_final_link_relocate will then calculate the required + relocation to add on to the value in the object code. */ + +static bfd_reloc_status_type +tic30_aout_fix_pcrel_16 (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol ATTRIBUTE_UNUSED; + PTR data; + asection *input_section ATTRIBUTE_UNUSED; + bfd *output_bfd ATTRIBUTE_UNUSED; + char **error_message ATTRIBUTE_UNUSED; +{ + bfd_vma relocation = 1; + bfd_byte offset_data = bfd_get_8 (abfd, (bfd_byte *) data + reloc_entry->address - 1); + + /* The byte before the location of the fix contains bits 23-16 of + the pcrel instruction. Bit 21 is set for a delayed instruction + which requires on offset of 3 instead of 1. */ + if (offset_data & 0x20) + relocation -= 3; + else + relocation -= 1; + bfd_put_16 (abfd, relocation, (bfd_byte *) data + reloc_entry->address); + return bfd_reloc_ok; +} + +/* These macros will get 24-bit values from the bfd definition. + Big-endian only. */ +#define bfd_getb_24(BFD,ADDR) \ + (bfd_get_8 (BFD, ADDR ) << 16) | \ + (bfd_get_8 (BFD, ADDR + 1) << 8) | \ + (bfd_get_8 (BFD, ADDR + 2) ) + +#define bfd_putb_24(BFD,DATA,ADDR) \ + bfd_put_8 (BFD, (bfd_byte) ((DATA >> 16) & 0xFF), ADDR ); \ + bfd_put_8 (BFD, (bfd_byte) ((DATA >> 8) & 0xFF), ADDR + 1); \ + bfd_put_8 (BFD, (bfd_byte) ( DATA & 0xFF), ADDR + 2) + +/* Set parameters about this a.out file that are machine-dependent. + This routine is called from some_aout_object_p just before it returns. */ + +static const bfd_target * +tic30_aout_callback (abfd) + bfd *abfd; +{ + struct internal_exec *execp = exec_hdr (abfd); + unsigned int arch_align_power; + unsigned long arch_align; + + /* Calculate the file positions of the parts of a newly read aout header. */ + obj_textsec (abfd)->_raw_size = N_TXTSIZE (*execp); + + /* The virtual memory addresses of the sections. */ + obj_textsec (abfd)->vma = N_TXTADDR (*execp); + obj_datasec (abfd)->vma = N_DATADDR (*execp); + obj_bsssec (abfd)->vma = N_BSSADDR (*execp); + + obj_textsec (abfd)->lma = obj_textsec (abfd)->vma; + obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; + obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; + + /* The file offsets of the sections. */ + obj_textsec (abfd)->filepos = N_TXTOFF (*execp); + obj_datasec (abfd)->filepos = N_DATOFF (*execp); + + /* The file offsets of the relocation info. */ + obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); + obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); + + /* The file offsets of the string table and symbol table. */ + obj_sym_filepos (abfd) = N_SYMOFF (*execp); + obj_str_filepos (abfd) = N_STROFF (*execp); + + /* Determine the architecture and machine type of the object file. */ +#ifdef SET_ARCH_MACH + SET_ARCH_MACH (abfd, *execp); +#else + bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0L); +#endif + + /* Now that we know the architecture, set the alignments of the + sections. This is normally done by NAME(aout,new_section_hook), + but when the initial sections were created the architecture had + not yet been set. However, for backward compatibility, we don't + set the alignment power any higher than as required by the size + of the section. */ + arch_align_power = bfd_get_arch_info (abfd)->section_align_power; + arch_align = 1 << arch_align_power; + if ((BFD_ALIGN (obj_textsec (abfd)->_raw_size, arch_align) + == obj_textsec (abfd)->_raw_size) + && (BFD_ALIGN (obj_datasec (abfd)->_raw_size, arch_align) + == obj_datasec (abfd)->_raw_size) + && (BFD_ALIGN (obj_bsssec (abfd)->_raw_size, arch_align) + == obj_bsssec (abfd)->_raw_size)) + { + obj_textsec (abfd)->alignment_power = arch_align_power; + obj_datasec (abfd)->alignment_power = arch_align_power; + obj_bsssec (abfd)->alignment_power = arch_align_power; + } + return abfd->xvec; +} + +static bfd_reloc_status_type +tic30_aout_final_link_relocate (howto, input_bfd, input_section, contents, + address, value, addend) + reloc_howto_type *howto; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + bfd_vma address; + bfd_vma value; + bfd_vma addend; +{ + bfd_vma relocation; + + if (address > input_section->_raw_size) + return bfd_reloc_outofrange; + + relocation = value + addend; + if (howto->pc_relative) + { + relocation -= (input_section->output_section->vma + input_section->output_offset); + if (howto->pcrel_offset) + relocation -= address; + } + return tic30_aout_relocate_contents (howto, input_bfd, relocation, + contents + address); +} + +bfd_reloc_status_type +tic30_aout_relocate_contents (howto, input_bfd, relocation, location) + reloc_howto_type *howto; + bfd *input_bfd; + bfd_vma relocation; + bfd_byte *location; +{ + bfd_vma x; + bfd_boolean overflow; + + if (howto->size < 0) + relocation = -relocation; + + switch (howto->size) + { + default: + case 0: + abort (); + break; + case 1: + x = bfd_get_16 (input_bfd, location); + break; + case 2: + x = bfd_getb_24 (input_bfd, location); + break; + case 3: + x = bfd_get_8 (input_bfd, location); + break; + case 4: + x = bfd_get_32 (input_bfd, location); + break; + } + + overflow = FALSE; + + if (howto->complain_on_overflow != complain_overflow_dont) + { + bfd_vma check; + bfd_signed_vma signed_check; + bfd_vma add; + bfd_signed_vma signed_add; + + if (howto->rightshift == 0) + { + check = relocation; + signed_check = (bfd_signed_vma) relocation; + } + else + { + check = relocation >> howto->rightshift; + if ((bfd_signed_vma) relocation >= 0) + signed_check = check; + else + signed_check = (check | ((bfd_vma) - 1 & ~((bfd_vma) - 1 >> howto->rightshift))); + } + add = x & howto->src_mask; + signed_add = add; + if ((add & (((~howto->src_mask) >> 1) & howto->src_mask)) != 0) + signed_add -= (((~howto->src_mask) >> 1) & howto->src_mask) << 1; + if (howto->bitpos == 0) + { + check += add; + signed_check += signed_add; + } + else + { + check += add >> howto->bitpos; + if (signed_add >= 0) + signed_check += add >> howto->bitpos; + else + signed_check += ((add >> howto->bitpos) | ((bfd_vma) - 1 & ~((bfd_vma) - 1 >> howto->bitpos))); + } + switch (howto->complain_on_overflow) + { + case complain_overflow_signed: + { + bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; + bfd_signed_vma reloc_signed_min = ~reloc_signed_max; + if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) + overflow = TRUE; + } + break; + case complain_overflow_unsigned: + { + bfd_vma reloc_unsigned_max = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; + if (check > reloc_unsigned_max) + overflow = TRUE; + } + break; + case complain_overflow_bitfield: + { + bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; + if ((check & ~reloc_bits) != 0 + && (((bfd_vma) signed_check & ~reloc_bits) + != ((bfd_vma) -1 & ~reloc_bits))) + overflow = TRUE; + } + break; + default: + abort (); + } + } + relocation >>= (bfd_vma) howto->rightshift; + relocation <<= (bfd_vma) howto->bitpos; + x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask)); + switch (howto->size) + { + default: + case 0: + abort (); + break; + case 1: + bfd_put_16 (input_bfd, x, location); + break; + case 2: + bfd_putb_24 (input_bfd, x, location); + break; + case 3: + bfd_put_8 (input_bfd, x, location); + break; + case 4: + bfd_put_32 (input_bfd, x, location); + break; + } + return overflow ? bfd_reloc_overflow : bfd_reloc_ok; +} + +/* Finish up the reading of an a.out file header. */ + +static const bfd_target * +tic30_aout_object_p (abfd) + bfd *abfd; +{ + struct external_exec exec_bytes; /* Raw exec header from file. */ + struct internal_exec exec; /* Cleaned-up exec header. */ + const bfd_target *target; + bfd_size_type amt = EXEC_BYTES_SIZE; + + if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + +#ifdef SWAP_MAGIC + exec.a_info = SWAP_MAGIC (exec_bytes.e_info); +#else + exec.a_info = H_GET_32 (abfd, exec_bytes.e_info); +#endif /* SWAP_MAGIC */ + + if (N_BADMAG (exec)) + return 0; +#ifdef MACHTYPE_OK + if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) + return 0; +#endif + + NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec); + +#ifdef SWAP_MAGIC + /* swap_exec_header_in read in a_info with the wrong byte order */ + exec.a_info = SWAP_MAGIC (exec_bytes.e_info); +#endif /* SWAP_MAGIC */ + + target = NAME (aout, some_aout_object_p) (abfd, &exec, tic30_aout_callback); + +#ifdef ENTRY_CAN_BE_ZERO + /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage) + means that it isn't obvious if EXEC_P should be set. + All of the following must be true for an executable: + There must be no relocations, the bfd can be neither an + archive nor an archive element, and the file must be executable. */ + + if (exec.a_trsize + exec.a_drsize == 0 + && bfd_get_format (abfd) == bfd_object && abfd->my_archive == NULL) + { + struct stat buf; +#ifndef S_IXUSR +#define S_IXUSR 0100 /* Execute by owner. */ +#endif + if (stat (abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR)) + abfd->flags |= EXEC_P; + } +#endif /* ENTRY_CAN_BE_ZERO */ + + return target; +} + +/* Copy private section data. This actually does nothing with the + sections. It copies the subformat field. We copy it here, because + we need to know whether this is a QMAGIC file before we set the + section contents, and copy_private_bfd_data is not called until + after the section contents have been set. */ + +static bfd_boolean +MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec) + bfd *ibfd; + asection *isec ATTRIBUTE_UNUSED; + bfd *obfd; + asection *osec ATTRIBUTE_UNUSED; +{ + if (bfd_get_flavour (obfd) == bfd_target_aout_flavour) + obj_aout_subformat (obfd) = obj_aout_subformat (ibfd); + return TRUE; +} + +/* Write an object file. + Section contents have already been written. We write the + file header, symbols, and relocation. */ + +static bfd_boolean +tic30_aout_write_object_contents (abfd) + bfd *abfd; +{ + struct external_exec exec_bytes; + struct internal_exec *execp = exec_hdr (abfd); + + obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; + + { + bfd_size_type text_size; /* Dummy vars. */ + file_ptr text_end; + + if (adata (abfd).magic == undecided_magic) + NAME (aout, adjust_sizes_and_vmas) (abfd, &text_size, &text_end); + + execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; + execp->a_entry = bfd_get_start_address (abfd); + + execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * obj_reloc_entry_size (abfd)); + execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * obj_reloc_entry_size (abfd)); + NAME (aout, swap_exec_header_out) (abfd, execp, &exec_bytes); + + if (adata (abfd).exec_bytes_size > 0) + { + bfd_size_type amt; + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + return FALSE; + amt = adata (abfd).exec_bytes_size; + if (bfd_bwrite ((PTR) &exec_bytes, amt, abfd) != amt) + return FALSE; + } + + /* Now write out reloc info, followed by syms and strings. */ + if (bfd_get_outsymbols (abfd) != (asymbol **) NULL + && bfd_get_symcount (abfd) != 0) + { + if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (*execp)), SEEK_SET) != 0) + return FALSE; + + if (!NAME (aout, write_syms) (abfd)) + return FALSE; + } + + if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*execp)), SEEK_SET) != 0) + return FALSE; + if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) + return FALSE; + + if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp)), SEEK_SET) != 0) + return FALSE; + if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) + return FALSE; + } + + return TRUE; +} + +static bfd_boolean +tic30_aout_set_sizes (abfd) + bfd *abfd; +{ + adata (abfd).page_size = TARGET_PAGE_SIZE; + +#ifdef SEGMENT_SIZE + adata (abfd).segment_size = SEGMENT_SIZE; +#else + adata (abfd).segment_size = TARGET_PAGE_SIZE; +#endif + +#ifdef ZMAGIC_DISK_BLOCK_SIZE + adata (abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE; +#else + adata (abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE; +#endif + + adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE; + + return TRUE; +} + +#ifndef MY_final_link_callback + +/* Callback for the final_link routine to set the section offsets. */ + +static void MY_final_link_callback + PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *)); + +static void +MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff) + bfd *abfd; + file_ptr *ptreloff; + file_ptr *pdreloff; + file_ptr *psymoff; +{ + struct internal_exec *execp = exec_hdr (abfd); + + *ptreloff = obj_datasec (abfd)->filepos + execp->a_data; + *pdreloff = *ptreloff + execp->a_trsize; + *psymoff = *pdreloff + execp->a_drsize;; +} + +#endif + +#ifndef MY_bfd_final_link + +/* Final link routine. We need to use a call back to get the correct + offsets in the output file. */ + +static bfd_boolean +MY_bfd_final_link (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + struct internal_exec *execp = exec_hdr (abfd); + file_ptr pos; + bfd_vma vma = 0; + int pad; + + /* Set the executable header size to 0, as we don't want one for an + output. */ + adata (abfd).exec_bytes_size = 0; + pos = adata (abfd).exec_bytes_size; + /* Text. */ + vma = info->create_object_symbols_section->vma; + pos += vma; + obj_textsec (abfd)->filepos = pos; + obj_textsec (abfd)->vma = vma; + obj_textsec (abfd)->user_set_vma = 1; + pos += obj_textsec (abfd)->_raw_size; + vma += obj_textsec (abfd)->_raw_size; + + /* Data. */ + if (abfd->flags & D_PAGED) + { + if (info->create_object_symbols_section->next->vma > 0) + obj_datasec (abfd)->vma = info->create_object_symbols_section->next->vma; + else + obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size); + } + else + { + obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4); + } + + if (obj_datasec (abfd)->vma < vma) + obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4); + + obj_datasec (abfd)->user_set_vma = 1; + vma = obj_datasec (abfd)->vma; + obj_datasec (abfd)->filepos = vma + adata (abfd).exec_bytes_size; + execp->a_text = vma - obj_textsec (abfd)->vma; + obj_textsec (abfd)->_raw_size = execp->a_text; + + /* Since BSS follows data immediately, see if it needs alignment. */ + vma += obj_datasec (abfd)->_raw_size; + pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma; + obj_datasec (abfd)->_raw_size += pad; + pos += obj_datasec (abfd)->_raw_size; + execp->a_data = obj_datasec (abfd)->_raw_size; + + /* BSS. */ + obj_bsssec (abfd)->vma = vma; + obj_bsssec (abfd)->user_set_vma = 1; + + /* We are fully resized, so don't readjust in final_link. */ + adata (abfd).magic = z_magic; + + return NAME (aout, final_link) (abfd, info, MY_final_link_callback); +} + +#endif + +enum machine_type +tic30_aout_machine_type (arch, machine, unknown) + enum bfd_architecture arch; + unsigned long machine ATTRIBUTE_UNUSED; + bfd_boolean *unknown; +{ + enum machine_type arch_flags; + + arch_flags = M_UNKNOWN; + *unknown = TRUE; + + switch (arch) + { + case bfd_arch_tic30: + *unknown = FALSE; + break; + default: + arch_flags = M_UNKNOWN; + } + if (arch_flags != M_UNKNOWN) + *unknown = FALSE; + return arch_flags; +} + +bfd_boolean +tic30_aout_set_arch_mach (abfd, arch, machine) + bfd *abfd; + enum bfd_architecture arch; + unsigned long machine; +{ + if (!bfd_default_set_arch_mach (abfd, arch, machine)) + return FALSE; + if (arch != bfd_arch_unknown) + { + bfd_boolean unknown; + tic30_aout_machine_type (arch, machine, &unknown); + if (unknown) + return FALSE; + } + obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; + return (*aout_backend_info (abfd)->set_sizes) (abfd); +} + +/* We assume BFD generic archive files. */ +#ifndef MY_openr_next_archived_file +#define MY_openr_next_archived_file bfd_generic_openr_next_archived_file +#endif +#ifndef MY_get_elt_at_index +#define MY_get_elt_at_index _bfd_generic_get_elt_at_index +#endif +#ifndef MY_generic_stat_arch_elt +#define MY_generic_stat_arch_elt bfd_generic_stat_arch_elt +#endif +#ifndef MY_slurp_armap +#define MY_slurp_armap bfd_slurp_bsd_armap +#endif +#ifndef MY_slurp_extended_name_table +#define MY_slurp_extended_name_table _bfd_slurp_extended_name_table +#endif +#ifndef MY_construct_extended_name_table +#define MY_construct_extended_name_table \ + _bfd_archive_bsd_construct_extended_name_table +#endif +#ifndef MY_write_armap +#define MY_write_armap bsd_write_armap +#endif +#ifndef MY_read_ar_hdr +#define MY_read_ar_hdr _bfd_generic_read_ar_hdr +#endif +#ifndef MY_truncate_arname +#define MY_truncate_arname bfd_bsd_truncate_arname +#endif +#ifndef MY_update_armap_timestamp +#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp +#endif + +/* No core file defined here -- configure in trad-core.c separately. */ +#ifndef MY_core_file_failing_command +#define MY_core_file_failing_command _bfd_nocore_core_file_failing_command +#endif +#ifndef MY_core_file_failing_signal +#define MY_core_file_failing_signal _bfd_nocore_core_file_failing_signal +#endif +#ifndef MY_core_file_matches_executable_p +#define MY_core_file_matches_executable_p \ + _bfd_nocore_core_file_matches_executable_p +#endif +#ifndef MY_core_file_p +#define MY_core_file_p _bfd_dummy_target +#endif + +#ifndef MY_bfd_debug_info_start +#define MY_bfd_debug_info_start bfd_void +#endif +#ifndef MY_bfd_debug_info_end +#define MY_bfd_debug_info_end bfd_void +#endif +#ifndef MY_bfd_debug_info_accumulate +#define MY_bfd_debug_info_accumulate \ + (void (*) PARAMS ((bfd*, struct bfd_section *))) bfd_void +#endif + +#ifndef MY_core_file_failing_command +#define MY_core_file_failing_command NAME(aout,core_file_failing_command) +#endif +#ifndef MY_core_file_failing_signal +#define MY_core_file_failing_signal NAME(aout,core_file_failing_signal) +#endif +#ifndef MY_core_file_matches_executable_p +#define MY_core_file_matches_executable_p NAME(aout,core_file_matches_executable_p) +#endif +#ifndef MY_set_section_contents +#define MY_set_section_contents NAME(aout,set_section_contents) +#endif +#ifndef MY_get_section_contents +#define MY_get_section_contents aout_32_get_section_contents +#endif +#ifndef MY_get_section_contents_in_window +#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window +#endif +#ifndef MY_new_section_hook +#define MY_new_section_hook NAME(aout,new_section_hook) +#endif +#ifndef MY_get_symtab_upper_bound +#define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound) +#endif +#ifndef MY_canonicalize_symtab +#define MY_canonicalize_symtab NAME(aout,canonicalize_symtab) +#endif +#ifndef MY_get_reloc_upper_bound +#define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound) +#endif +#ifndef MY_canonicalize_reloc +#define MY_canonicalize_reloc NAME(aout,canonicalize_reloc) +#endif +#ifndef MY_make_empty_symbol +#define MY_make_empty_symbol NAME(aout,make_empty_symbol) +#endif +#ifndef MY_print_symbol +#define MY_print_symbol NAME(aout,print_symbol) +#endif +#ifndef MY_get_symbol_info +#define MY_get_symbol_info NAME(aout,get_symbol_info) +#endif +#ifndef MY_get_lineno +#define MY_get_lineno NAME(aout,get_lineno) +#endif +#ifndef MY_set_arch_mach +#define MY_set_arch_mach tic30_aout_set_arch_mach +#endif +#ifndef MY_find_nearest_line +#define MY_find_nearest_line NAME(aout,find_nearest_line) +#endif +#ifndef MY_sizeof_headers +#define MY_sizeof_headers NAME(aout,sizeof_headers) +#endif +#ifndef MY_bfd_get_relocated_section_contents +#define MY_bfd_get_relocated_section_contents \ + bfd_generic_get_relocated_section_contents +#endif +#ifndef MY_bfd_relax_section +#define MY_bfd_relax_section bfd_generic_relax_section +#endif +#ifndef MY_bfd_gc_sections +#define MY_bfd_gc_sections bfd_generic_gc_sections +#endif +#ifndef MY_bfd_merge_sections +#define MY_bfd_merge_sections bfd_generic_merge_sections +#endif +#ifndef MY_bfd_discard_group +#define MY_bfd_discard_group bfd_generic_discard_group +#endif +#ifndef MY_bfd_reloc_type_lookup +#define MY_bfd_reloc_type_lookup tic30_aout_reloc_type_lookup +#endif +#ifndef MY_bfd_make_debug_symbol +#define MY_bfd_make_debug_symbol 0 +#endif +#ifndef MY_read_minisymbols +#define MY_read_minisymbols NAME(aout,read_minisymbols) +#endif +#ifndef MY_minisymbol_to_symbol +#define MY_minisymbol_to_symbol NAME(aout,minisymbol_to_symbol) +#endif +#ifndef MY_bfd_link_hash_table_create +#define MY_bfd_link_hash_table_create NAME(aout,link_hash_table_create) +#endif +#ifndef MY_bfd_link_hash_table_free +#define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#endif +#ifndef MY_bfd_link_add_symbols +#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols) +#endif +#ifndef MY_bfd_link_just_syms +#define MY_bfd_link_just_syms _bfd_generic_link_just_syms +#endif +#ifndef MY_bfd_link_split_section +#define MY_bfd_link_split_section _bfd_generic_link_split_section +#endif + +#ifndef MY_bfd_copy_private_bfd_data +#define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data +#endif + +#ifndef MY_bfd_merge_private_bfd_data +#define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data +#endif + +#ifndef MY_bfd_copy_private_symbol_data +#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data +#endif + +#ifndef MY_bfd_print_private_bfd_data +#define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data +#endif + +#ifndef MY_bfd_set_private_flags +#define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags +#endif + +#ifndef MY_bfd_is_local_label_name +#define MY_bfd_is_local_label_name bfd_generic_is_local_label_name +#endif + +#ifndef MY_bfd_free_cached_info +#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info) +#endif + +#ifndef MY_close_and_cleanup +#define MY_close_and_cleanup MY_bfd_free_cached_info +#endif + +#ifndef MY_get_dynamic_symtab_upper_bound +#define MY_get_dynamic_symtab_upper_bound \ + _bfd_nodynamic_get_dynamic_symtab_upper_bound +#endif +#ifndef MY_canonicalize_dynamic_symtab +#define MY_canonicalize_dynamic_symtab \ + _bfd_nodynamic_canonicalize_dynamic_symtab +#endif +#ifndef MY_get_dynamic_reloc_upper_bound +#define MY_get_dynamic_reloc_upper_bound \ + _bfd_nodynamic_get_dynamic_reloc_upper_bound +#endif +#ifndef MY_canonicalize_dynamic_reloc +#define MY_canonicalize_dynamic_reloc \ + _bfd_nodynamic_canonicalize_dynamic_reloc +#endif + +/* Aout symbols normally have leading underscores */ +#ifndef MY_symbol_leading_char +#define MY_symbol_leading_char '_' +#endif + +/* Aout archives normally use spaces for padding */ +#ifndef AR_PAD_CHAR +#define AR_PAD_CHAR ' ' +#endif + +#ifndef MY_BFD_TARGET +const bfd_target tic30_aout_vec = +{ + TARGETNAME, /* name */ + bfd_target_aout_flavour, + BFD_ENDIAN_BIG, /* target byte order (big) */ + BFD_ENDIAN_BIG, /* target headers byte order (big) */ + (HAS_RELOC | /* object flags */ + HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + MY_symbol_leading_char, + AR_PAD_CHAR, /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + {_bfd_dummy_target, MY_object_p, /* bfd_check_format */ + bfd_generic_archive_p, MY_core_file_p}, + {bfd_false, MY_mkobject, /* bfd_set_format */ + _bfd_generic_mkarchive, bfd_false}, + {bfd_false, MY_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (MY), + BFD_JUMP_TABLE_COPY (MY), + BFD_JUMP_TABLE_CORE (MY), + BFD_JUMP_TABLE_ARCHIVE (MY), + BFD_JUMP_TABLE_SYMBOLS (MY), + BFD_JUMP_TABLE_RELOCS (MY), + BFD_JUMP_TABLE_WRITE (MY), + BFD_JUMP_TABLE_LINK (MY), + BFD_JUMP_TABLE_DYNAMIC (MY), + + NULL, + + (PTR) MY_backend_data +}; +#endif /* MY_BFD_TARGET */ diff --git a/bfd/cf-i386lynx.c b/bfd/cf-i386lynx.c new file mode 100644 index 0000000000000..f3d9d0413047c --- /dev/null +++ b/bfd/cf-i386lynx.c @@ -0,0 +1,31 @@ +/* BFD back-end for Intel 386 COFF LynxOS files. + Copyright 1993, 1994, 1995 Free Software Foundation, Inc. + Written by Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" + +#define TARGET_SYM i386lynx_coff_vec +#define TARGET_NAME "coff-i386-lynx" + +#define LYNXOS + +#define COFF_LONG_FILENAMES + +#include "coff-i386.c" diff --git a/bfd/cf-m68klynx.c b/bfd/cf-m68klynx.c new file mode 100644 index 0000000000000..7674f1b248b1d --- /dev/null +++ b/bfd/cf-m68klynx.c @@ -0,0 +1,28 @@ +/* BFD back-end for Motorola M68K COFF LynxOS files. + Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. + Written by Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define TARGET_SYM m68klynx_coff_vec +#define TARGET_NAME "coff-m68k-lynx" +#define LYNXOS +#define COFF_LONG_FILENAMES +#define STATIC_RELOCS +#define COFF_COMMON_ADDEND + +#include "coff-m68k.c" diff --git a/bfd/cf-sparclynx.c b/bfd/cf-sparclynx.c new file mode 100644 index 0000000000000..e937498985004 --- /dev/null +++ b/bfd/cf-sparclynx.c @@ -0,0 +1,28 @@ +/* BFD back-end for Sparc COFF LynxOS files. + Copyright 1993, 1994 Free Software Foundation, Inc. + Written by Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define TARGET_SYM sparclynx_coff_vec +#define TARGET_NAME "coff-sparc-lynx" + +#define LYNXOS + +#define COFF_LONG_FILENAMES + +#include "coff-sparc.c" diff --git a/bfd/cisco-core.c b/bfd/cisco-core.c new file mode 100644 index 0000000000000..6b3a71b0ab3ee --- /dev/null +++ b/bfd/cisco-core.c @@ -0,0 +1,429 @@ +/* BFD back-end for CISCO crash dumps. + Copyright 1994, 1997, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +/* core_file_failing_signal returns a host signal (this probably should + be fixed). */ +#include + +/* for MSVC builds */ +#ifndef SIGTRAP +# define SIGTRAP 5 +#endif +#ifndef SIGEMT +# define SIGEMT 6 +#endif +#ifndef SIGBUS +# define SIGBUS 10 +#endif + +int crash_info_locs[] = { + 0x0250, /* mips, ppc, x86, i960 */ + 0x0400, /* m68k, mips, x86, i960 */ + 0x0FFC, /* m68k, mips, ppc, x86, i960 */ + 0x3000, /* ppc */ + 0x4FFC, /* m68k */ + -1 +}; + +#define CRASH_MAGIC 0xdead1234 +#define MASK_ADDR(x) ((x) & 0x0fffffff) /* Mask crash info address */ + +typedef enum { + CRASH_REASON_NOTCRASHED = 0, + CRASH_REASON_EXCEPTION = 1, + CRASH_REASON_CORRUPT = 2, +} crashreason; + +typedef struct { + char magic[4]; /* Magic number */ + char version[4]; /* Version number */ + char reason[4]; /* Crash reason */ + char cpu_vector[4]; /* CPU vector for exceptions */ + char registers[4]; /* Pointer to saved registers */ + char rambase[4]; /* Base of RAM (not in V1 crash info) */ + char textbase[4]; /* Base of .text section (not in V3 crash info) */ + char database[4]; /* Base of .data section (not in V3 crash info) */ + char bssbase[4]; /* Base of .bss section (not in V3 crash info) */ +} crashinfo_external; + +struct cisco_core_struct +{ + int sig; +}; + +static const bfd_target *cisco_core_file_validate PARAMS ((bfd *, int)); +static const bfd_target *cisco_core_file_p PARAMS ((bfd *)); +char *cisco_core_file_failing_command PARAMS ((bfd *)); +int cisco_core_file_failing_signal PARAMS ((bfd *)); +bfd_boolean cisco_core_file_matches_executable_p PARAMS ((bfd *, bfd *)); + +/* Examine the file for a crash info struct at the offset given by + CRASH_INFO_LOC. */ + +static const bfd_target * +cisco_core_file_validate (abfd, crash_info_loc) + bfd *abfd; + int crash_info_loc; +{ + char buf[4]; + unsigned int crashinfo_offset; + crashinfo_external crashinfo; + int nread; + unsigned int magic; + unsigned int version; + unsigned int rambase; + sec_ptr asect; + struct stat statbuf; + bfd_size_type amt; + + if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0) + return NULL; + + nread = bfd_bread (buf, (bfd_size_type) 4, abfd); + if (nread != 4) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + crashinfo_offset = MASK_ADDR (bfd_get_32 (abfd, buf)); + + if (bfd_seek (abfd, (file_ptr) crashinfo_offset, SEEK_SET) != 0) + { + /* Most likely we failed because of a bogus (huge) offset */ + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + nread = bfd_bread (&crashinfo, (bfd_size_type) sizeof (crashinfo), abfd); + if (nread != sizeof (crashinfo)) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + if (bfd_stat (abfd, &statbuf) < 0) + { + bfd_set_error (bfd_error_system_call); + return NULL; + } + + magic = bfd_get_32 (abfd, crashinfo.magic); + if (magic != CRASH_MAGIC) + { + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + version = bfd_get_32 (abfd, crashinfo.version); + if (version == 0) + { + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + else if (version == 1) + { + /* V1 core dumps don't specify the dump base, assume 0 */ + rambase = 0; + } + else + { + rambase = bfd_get_32 (abfd, crashinfo.rambase); + } + + /* OK, we believe you. You're a core file. */ + + amt = sizeof (struct cisco_core_struct); + abfd->tdata.cisco_core_data = (struct cisco_core_struct *) bfd_zmalloc (amt); + if (abfd->tdata.cisco_core_data == NULL) + return NULL; + + switch ((crashreason) bfd_get_32 (abfd, crashinfo.reason)) + { + case CRASH_REASON_NOTCRASHED: + /* Crash file probably came from write core. */ + abfd->tdata.cisco_core_data->sig = 0; + break; + case CRASH_REASON_CORRUPT: + /* The crash context area was corrupt -- proceed with caution. + We have no way of passing this information back to the caller. */ + abfd->tdata.cisco_core_data->sig = 0; + break; + case CRASH_REASON_EXCEPTION: + /* Crash occured due to CPU exception. */ + + /* This is 68k-specific; for MIPS we'll need to interpret + cpu_vector differently based on the target configuration + (since CISCO core files don't seem to have the processor + encoded in them). */ + + switch (bfd_get_32 (abfd, crashinfo.cpu_vector)) + { + /* bus error */ + case 2 : abfd->tdata.cisco_core_data->sig = SIGBUS; break; + /* address error */ + case 3 : abfd->tdata.cisco_core_data->sig = SIGBUS; break; + /* illegal instruction */ + case 4 : abfd->tdata.cisco_core_data->sig = SIGILL; break; + /* zero divide */ + case 5 : abfd->tdata.cisco_core_data->sig = SIGFPE; break; + /* chk instruction */ + case 6 : abfd->tdata.cisco_core_data->sig = SIGFPE; break; + /* trapv instruction */ + case 7 : abfd->tdata.cisco_core_data->sig = SIGFPE; break; + /* privilege violation */ + case 8 : abfd->tdata.cisco_core_data->sig = SIGSEGV; break; + /* trace trap */ + case 9 : abfd->tdata.cisco_core_data->sig = SIGTRAP; break; + /* line 1010 emulator */ + case 10: abfd->tdata.cisco_core_data->sig = SIGILL; break; + /* line 1111 emulator */ + case 11: abfd->tdata.cisco_core_data->sig = SIGILL; break; + + /* Coprocessor protocol violation. Using a standard MMU or FPU + this cannot be triggered by software. Call it a SIGBUS. */ + case 13: abfd->tdata.cisco_core_data->sig = SIGBUS; break; + + /* interrupt */ + case 31: abfd->tdata.cisco_core_data->sig = SIGINT; break; + /* breakpoint */ + case 33: abfd->tdata.cisco_core_data->sig = SIGTRAP; break; + + /* floating point err */ + case 48: abfd->tdata.cisco_core_data->sig = SIGFPE; break; + /* floating point err */ + case 49: abfd->tdata.cisco_core_data->sig = SIGFPE; break; + /* zero divide */ + case 50: abfd->tdata.cisco_core_data->sig = SIGFPE; break; + /* underflow */ + case 51: abfd->tdata.cisco_core_data->sig = SIGFPE; break; + /* operand error */ + case 52: abfd->tdata.cisco_core_data->sig = SIGFPE; break; + /* overflow */ + case 53: abfd->tdata.cisco_core_data->sig = SIGFPE; break; + /* NAN */ + case 54: abfd->tdata.cisco_core_data->sig = SIGFPE; break; + default: +#ifndef SIGEMT +#define SIGEMT SIGTRAP +#endif + /* "software generated"*/ + abfd->tdata.cisco_core_data->sig = SIGEMT; + } + break; + default: + /* Unknown crash reason. */ + abfd->tdata.cisco_core_data->sig = 0; + break; + } + + /* Create a ".data" section that maps the entire file, which is + essentially a dump of the target system's RAM. */ + + asect = bfd_make_section_anyway (abfd, ".data"); + if (asect == NULL) + goto error_return; + asect->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; + /* The size of memory is the size of the core file itself. */ + asect->_raw_size = statbuf.st_size; + asect->vma = rambase; + asect->filepos = 0; + + /* Create a ".crash" section to allow access to the saved + crash information. */ + + asect = bfd_make_section_anyway (abfd, ".crash"); + if (asect == NULL) + goto error_return; + asect->flags = SEC_HAS_CONTENTS; + asect->vma = 0; + asect->filepos = crashinfo_offset; + asect->_raw_size = sizeof (crashinfo); + + /* Create a ".reg" section to allow access to the saved + registers. */ + + asect = bfd_make_section_anyway (abfd, ".reg"); + if (asect == NULL) + goto error_return; + asect->flags = SEC_HAS_CONTENTS; + asect->vma = 0; + asect->filepos = bfd_get_32 (abfd, crashinfo.registers) - rambase; + /* Since we don't know the exact size of the saved register info, + choose a register section size that is either the remaining part + of the file, or 1024, whichever is smaller. */ + nread = statbuf.st_size - asect->filepos; + asect->_raw_size = (nread < 1024) ? nread : 1024; + + return abfd->xvec; + + /* Get here if we have already started filling out the BFD + and there is an error of some kind. */ + + error_return: + bfd_release (abfd, abfd->tdata.any); + abfd->tdata.any = NULL; + bfd_section_list_clear (abfd); + return NULL; +} + +static const bfd_target * +cisco_core_file_p (abfd) + bfd *abfd; +{ + int *crash_info_locp; + const bfd_target *target = NULL; + + for (crash_info_locp = crash_info_locs; + *crash_info_locp != -1 && target == NULL; + crash_info_locp++) + { + target = cisco_core_file_validate (abfd, *crash_info_locp); + } + return (target); +} + +char * +cisco_core_file_failing_command (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ + return NULL; +} + +int +cisco_core_file_failing_signal (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ + return abfd->tdata.cisco_core_data->sig; +} + +bfd_boolean +cisco_core_file_matches_executable_p (core_bfd, exec_bfd) + bfd *core_bfd ATTRIBUTE_UNUSED; + bfd *exec_bfd ATTRIBUTE_UNUSED; +{ + return TRUE; +} + +extern const bfd_target cisco_core_little_vec; + +const bfd_target cisco_core_big_vec = + { + "cisco-ios-core-big", + bfd_target_unknown_flavour, + BFD_ENDIAN_BIG, /* target byte order */ + BFD_ENDIAN_BIG, /* target headers byte order */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + 0, /* symbol prefix */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + + { /* bfd_check_format */ + _bfd_dummy_target, /* unknown format */ + _bfd_dummy_target, /* object file */ + _bfd_dummy_target, /* archive */ + cisco_core_file_p /* a core file */ + }, + { /* bfd_set_format */ + bfd_false, bfd_false, + bfd_false, bfd_false + }, + { /* bfd_write_contents */ + bfd_false, bfd_false, + bfd_false, bfd_false + }, + + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (cisco), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), + BFD_JUMP_TABLE_WRITE (_bfd_generic), + BFD_JUMP_TABLE_LINK (_bfd_nolink), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & cisco_core_little_vec, + + (PTR) 0 /* backend_data */ +}; + +const bfd_target cisco_core_little_vec = + { + "cisco-ios-core-little", + bfd_target_unknown_flavour, + BFD_ENDIAN_LITTLE, /* target byte order */ + BFD_ENDIAN_LITTLE, /* target headers byte order */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + 0, /* symbol prefix */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ + + { /* bfd_check_format */ + _bfd_dummy_target, /* unknown format */ + _bfd_dummy_target, /* object file */ + _bfd_dummy_target, /* archive */ + cisco_core_file_p /* a core file */ + }, + { /* bfd_set_format */ + bfd_false, bfd_false, + bfd_false, bfd_false + }, + { /* bfd_write_contents */ + bfd_false, bfd_false, + bfd_false, bfd_false + }, + + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (cisco), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), + BFD_JUMP_TABLE_WRITE (_bfd_generic), + BFD_JUMP_TABLE_LINK (_bfd_nolink), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + &cisco_core_big_vec, + + (PTR) 0 /* backend_data */ +}; diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c new file mode 100644 index 0000000000000..444dbc2a775d3 --- /dev/null +++ b/bfd/coff-a29k.c @@ -0,0 +1,584 @@ +/* BFD back-end for AMD 29000 COFF binaries. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, + 2002, 2003 + Free Software Foundation, Inc. + Contributed by David Wood at New York University 7/8/91. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define A29K 1 + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "coff/a29k.h" +#include "coff/internal.h" +#include "libcoff.h" + +static long get_symbol_value PARAMS ((asymbol *)); +static bfd_reloc_status_type a29k_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_boolean coff_a29k_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **)); +static bfd_boolean coff_a29k_adjust_symndx + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, + struct internal_reloc *, bfd_boolean *)); +static void reloc_processing + PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) + +#define INSERT_HWORD(WORD,HWORD) \ + (((WORD) & 0xff00ff00) | (((HWORD) & 0xff00) << 8) | ((HWORD)& 0xff)) +#define EXTRACT_HWORD(WORD) \ + ((((WORD) & 0x00ff0000) >> 8) | ((WORD) & 0xff)) +#define SIGN_EXTEND_HWORD(HWORD) \ + (((HWORD) ^ 0x8000) - 0x8000) + +/* Provided the symbol, returns the value reffed. */ + +static long +get_symbol_value (symbol) + asymbol *symbol; +{ + long relocation = 0; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value + + symbol->section->output_section->vma + + symbol->section->output_offset; + + return relocation; +} + +/* This function is in charge of performing all the 29k relocations. */ + +static bfd_reloc_status_type +a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, + error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol_in; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + /* The consth relocation comes in two parts, we have to remember + the state between calls, in these variables. */ + static bfd_boolean part1_consth_active = FALSE; + static unsigned long part1_consth_value; + unsigned long insn; + unsigned long sym_value; + unsigned long unsigned_value; + unsigned short r_type; + long signed_value; + unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/ + bfd_byte *hit_data =addr + (bfd_byte *) (data); + + r_type = reloc_entry->howto->type; + + if (output_bfd) + { + /* Partial linking - do nothing. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (symbol_in != NULL + && bfd_is_und_section (symbol_in->section)) + { + /* Keep the state machine happy in case we're called again. */ + if (r_type == R_IHIHALF) + { + part1_consth_active = TRUE; + part1_consth_value = 0; + } + return bfd_reloc_undefined; + } + + if ((part1_consth_active) && (r_type != R_IHCONST)) + { + part1_consth_active = FALSE; + *error_message = (char *) _("Missing IHCONST"); + + return bfd_reloc_dangerous; + } + + sym_value = get_symbol_value(symbol_in); + + switch (r_type) + { + case R_IREL: + insn = bfd_get_32 (abfd, hit_data); + /* Take the value in the field and sign extend it. */ + signed_value = EXTRACT_HWORD(insn); + signed_value = SIGN_EXTEND_HWORD(signed_value); + signed_value <<= 2; + + /* See the note on the R_IREL reloc in coff_a29k_relocate_section. */ + if (signed_value == - (long) reloc_entry->address) + signed_value = 0; + + signed_value += sym_value + reloc_entry->addend; + if ((signed_value & ~0x3ffff) == 0) + { /* Absolute jmp/call */ + insn |= (1 << 24); /* Make it absolute */ + /* FIXME: Should we change r_type to R_IABS. */ + } + else + { + /* Relative jmp/call, so subtract from the value the + address of the place we're coming from. */ + signed_value -= (reloc_entry->address + + input_section->output_section->vma + + input_section->output_offset); + if (signed_value > 0x1ffff || signed_value < -0x20000) + return bfd_reloc_overflow; + } + signed_value >>= 2; + insn = INSERT_HWORD (insn, signed_value); + bfd_put_32 (abfd, (bfd_vma) insn ,hit_data); + break; + case R_ILOHALF: + insn = bfd_get_32 (abfd, hit_data); + unsigned_value = EXTRACT_HWORD(insn); + unsigned_value += sym_value + reloc_entry->addend; + insn = INSERT_HWORD(insn, unsigned_value); + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); + break; + case R_IHIHALF: + insn = bfd_get_32 (abfd, hit_data); + /* consth, part 1 + Just get the symbol value that is referenced. */ + part1_consth_active = TRUE; + part1_consth_value = sym_value + reloc_entry->addend; + /* Don't modify insn until R_IHCONST. */ + break; + case R_IHCONST: + insn = bfd_get_32 (abfd, hit_data); + /* consth, part 2 + Now relocate the reference. */ + if (! part1_consth_active) + { + *error_message = (char *) _("Missing IHIHALF"); + return bfd_reloc_dangerous; + } + /* sym_ptr_ptr = r_symndx, in coff_slurp_reloc_table() */ + unsigned_value = 0; /*EXTRACT_HWORD(insn) << 16;*/ + unsigned_value += reloc_entry->addend; /* r_symndx */ + unsigned_value += part1_consth_value; + unsigned_value = unsigned_value >> 16; + insn = INSERT_HWORD(insn, unsigned_value); + part1_consth_active = FALSE; + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); + break; + case R_BYTE: + insn = bfd_get_8 (abfd, hit_data); + unsigned_value = insn + sym_value + reloc_entry->addend; + if (unsigned_value & 0xffffff00) + return bfd_reloc_overflow; + bfd_put_8 (abfd, unsigned_value, hit_data); + break; + case R_HWORD: + insn = bfd_get_16 (abfd, hit_data); + unsigned_value = insn + sym_value + reloc_entry->addend; + if (unsigned_value & 0xffff0000) + return bfd_reloc_overflow; + bfd_put_16 (abfd, (bfd_vma) insn, hit_data); + break; + case R_WORD: + insn = bfd_get_32 (abfd, hit_data); + insn += sym_value + reloc_entry->addend; + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); + break; + default: + *error_message = _("Unrecognized reloc"); + return bfd_reloc_dangerous; + } + + return(bfd_reloc_ok); +} + +/*FIXME: I'm not real sure about this table. */ +static reloc_howto_type howto_table[] = + { + {R_ABS, 0, 3, 32, FALSE, 0, complain_overflow_bitfield,a29k_reloc,"ABS", TRUE, 0xffffffff,0xffffffff, FALSE}, + EMPTY_HOWTO (1), + EMPTY_HOWTO (2), + EMPTY_HOWTO (3), + EMPTY_HOWTO (4), + EMPTY_HOWTO (5), + EMPTY_HOWTO (6), + EMPTY_HOWTO (7), + EMPTY_HOWTO (8), + EMPTY_HOWTO (9), + EMPTY_HOWTO (10), + EMPTY_HOWTO (11), + EMPTY_HOWTO (12), + EMPTY_HOWTO (13), + EMPTY_HOWTO (14), + EMPTY_HOWTO (15), + EMPTY_HOWTO (16), + EMPTY_HOWTO (17), + EMPTY_HOWTO (18), + EMPTY_HOWTO (19), + EMPTY_HOWTO (20), + EMPTY_HOWTO (21), + EMPTY_HOWTO (22), + EMPTY_HOWTO (23), + {R_IREL, 0, 3, 32, TRUE, 0, complain_overflow_signed,a29k_reloc,"IREL", TRUE, 0xffffffff,0xffffffff, FALSE}, + {R_IABS, 0, 3, 32, FALSE, 0, complain_overflow_bitfield, a29k_reloc,"IABS", TRUE, 0xffffffff,0xffffffff, FALSE}, + {R_ILOHALF, 0, 3, 16, TRUE, 0, complain_overflow_signed, a29k_reloc,"ILOHALF", TRUE, 0x0000ffff,0x0000ffff, FALSE}, + {R_IHIHALF, 0, 3, 16, TRUE, 16, complain_overflow_signed, a29k_reloc,"IHIHALF", TRUE, 0xffff0000,0xffff0000, FALSE}, + {R_IHCONST, 0, 3, 16, TRUE, 0, complain_overflow_signed, a29k_reloc,"IHCONST", TRUE, 0xffff0000,0xffff0000, FALSE}, + {R_BYTE, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, a29k_reloc,"BYTE", TRUE, 0x000000ff,0x000000ff, FALSE}, + {R_HWORD, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, a29k_reloc,"HWORD", TRUE, 0x0000ffff,0x0000ffff, FALSE}, + {R_WORD, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, a29k_reloc,"WORD", TRUE, 0xffffffff,0xffffffff, FALSE}, + }; + +#define BADMAG(x) A29KBADMAG(x) + +#define RELOC_PROCESSING(relent, reloc, symbols, abfd, section) \ + reloc_processing(relent, reloc, symbols, abfd, section) + +static void +reloc_processing (relent,reloc, symbols, abfd, section) + arelent *relent; + struct internal_reloc *reloc; + asymbol **symbols; + bfd *abfd; + asection *section; +{ + static bfd_vma ihihalf_vaddr = (bfd_vma) -1; + + relent->address = reloc->r_vaddr; + relent->howto = howto_table + reloc->r_type; + if (reloc->r_type == R_IHCONST) + { + /* The address of an R_IHCONST should always be the address of + the immediately preceding R_IHIHALF. relocs generated by gas + are correct, but relocs generated by High C are different (I + can't figure out what the address means for High C). We can + handle both gas and High C by ignoring the address here, and + simply reusing the address saved for R_IHIHALF. */ + if (ihihalf_vaddr == (bfd_vma) -1) + abort (); + relent->address = ihihalf_vaddr; + ihihalf_vaddr = (bfd_vma) -1; + relent->addend = reloc->r_symndx; + relent->sym_ptr_ptr= bfd_abs_section_ptr->symbol_ptr_ptr; + } + else + { + asymbol *ptr; + + relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; + + ptr = *(relent->sym_ptr_ptr); + + if (ptr + && bfd_asymbol_bfd(ptr) == abfd + && ((ptr->flags & BSF_OLD_COMMON) == 0)) + relent->addend = 0; + else + relent->addend = 0; + + relent->address-= section->vma; + if (reloc->r_type == R_IHIHALF) + ihihalf_vaddr = relent->address; + else if (ihihalf_vaddr != (bfd_vma) -1) + abort (); + } +} + +/* The reloc processing routine for the optimized COFF linker. */ + +static bfd_boolean +coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, syms, sections) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + struct internal_reloc *relocs; + struct internal_syment *syms; + asection **sections; +{ + struct internal_reloc *rel; + struct internal_reloc *relend; + bfd_boolean hihalf; + bfd_vma hihalf_val; + + /* If we are performing a relocatable link, we don't need to do a + thing. The caller will take care of adjusting the reloc + addresses and symbol indices. */ + if (info->relocatable) + return TRUE; + + hihalf = FALSE; + hihalf_val = 0; + + rel = relocs; + relend = rel + input_section->reloc_count; + for (; rel < relend; rel++) + { + long symndx; + bfd_byte *loc; + struct coff_link_hash_entry *h; + struct internal_syment *sym; + asection *sec; + bfd_vma val; + bfd_boolean overflow; + unsigned long insn; + long signed_value; + unsigned long unsigned_value; + bfd_reloc_status_type rstat; + + symndx = rel->r_symndx; + loc = contents + rel->r_vaddr - input_section->vma; + + if (symndx == -1 || rel->r_type == R_IHCONST) + h = NULL; + else + h = obj_coff_sym_hashes (input_bfd)[symndx]; + + sym = NULL; + sec = NULL; + val = 0; + + /* An R_IHCONST reloc does not have a symbol. Instead, the + symbol index is an addend. R_IHCONST is always used in + conjunction with R_IHHALF. */ + if (rel->r_type != R_IHCONST) + { + if (h == NULL) + { + if (symndx == -1) + sec = bfd_abs_section_ptr; + else + { + sym = syms + symndx; + sec = sections[symndx]; + val = (sec->output_section->vma + + sec->output_offset + + sym->n_value + - sec->vma); + } + } + else + { + if ( h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + val = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, input_section, + rel->r_vaddr - input_section->vma, TRUE))) + return FALSE; + } + } + + if (hihalf) + { + if (! ((*info->callbacks->reloc_dangerous) + (info, _("missing IHCONST reloc"), input_bfd, + input_section, rel->r_vaddr - input_section->vma))) + return FALSE; + hihalf = FALSE; + } + } + + overflow = FALSE; + + switch (rel->r_type) + { + default: + bfd_set_error (bfd_error_bad_value); + return FALSE; + + case R_IREL: + insn = bfd_get_32 (input_bfd, loc); + + /* Extract the addend. */ + signed_value = EXTRACT_HWORD (insn); + signed_value = SIGN_EXTEND_HWORD (signed_value); + signed_value <<= 2; + + /* Unfortunately, there are two different versions of COFF + a29k. In the original AMD version, the value stored in + the field for the R_IREL reloc is a simple addend. In + the GNU version, the value is the negative of the address + of the reloc within section. We try to cope here by + assuming the AMD version, unless the addend is exactly + the negative of the address; in the latter case we assume + the GNU version. This means that something like + .text + nop + jmp i-4 + will fail, because the addend of -4 will happen to equal + the negative of the address within the section. The + compiler will never generate code like this. + + At some point in the future we may want to take out this + check. */ + + if (signed_value == - (long) (rel->r_vaddr - input_section->vma)) + signed_value = 0; + + /* Determine the destination of the jump. */ + signed_value += val; + + if ((signed_value & ~0x3ffff) == 0) + { + /* We can use an absolute jump. */ + insn |= (1 << 24); + } + else + { + /* Make the destination PC relative. */ + signed_value -= (input_section->output_section->vma + + input_section->output_offset + + (rel->r_vaddr - input_section->vma)); + if (signed_value > 0x1ffff || signed_value < - 0x20000) + { + overflow = TRUE; + signed_value = 0; + } + } + + /* Put the adjusted value back into the instruction. */ + signed_value >>= 2; + insn = INSERT_HWORD (insn, signed_value); + + bfd_put_32 (input_bfd, (bfd_vma) insn, loc); + break; + + case R_ILOHALF: + insn = bfd_get_32 (input_bfd, loc); + unsigned_value = EXTRACT_HWORD (insn); + unsigned_value += val; + insn = INSERT_HWORD (insn, unsigned_value); + bfd_put_32 (input_bfd, (bfd_vma) insn, loc); + break; + + case R_IHIHALF: + /* Save the value for the R_IHCONST reloc. */ + hihalf = TRUE; + hihalf_val = val; + break; + + case R_IHCONST: + if (! hihalf) + { + if (! ((*info->callbacks->reloc_dangerous) + (info, _("missing IHIHALF reloc"), input_bfd, + input_section, rel->r_vaddr - input_section->vma))) + return FALSE; + hihalf_val = 0; + } + + insn = bfd_get_32 (input_bfd, loc); + unsigned_value = rel->r_symndx + hihalf_val; + unsigned_value >>= 16; + insn = INSERT_HWORD (insn, unsigned_value); + bfd_put_32 (input_bfd, (bfd_vma) insn, loc); + + hihalf = FALSE; + + break; + + case R_BYTE: + case R_HWORD: + case R_WORD: + rstat = _bfd_relocate_contents (howto_table + rel->r_type, + input_bfd, val, loc); + if (rstat == bfd_reloc_overflow) + overflow = TRUE; + else if (rstat != bfd_reloc_ok) + abort (); + break; + } + + if (overflow) + { + const char *name; + char buf[SYMNMLEN + 1]; + + if (symndx == -1) + name = "*ABS*"; + else if (h != NULL) + name = h->root.root.string; + else if (sym == NULL) + name = "*unknown*"; + else if (sym->_n._n_n._n_zeroes == 0 + && sym->_n._n_n._n_offset != 0) + name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset; + else + { + strncpy (buf, sym->_n._n_name, SYMNMLEN); + buf[SYMNMLEN] = '\0'; + name = buf; + } + + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto_table[rel->r_type].name, (bfd_vma) 0, + input_bfd, input_section, + rel->r_vaddr - input_section->vma))) + return FALSE; + } + } + + return TRUE; +} + +#define coff_relocate_section coff_a29k_relocate_section + +/* We don't want to change the symndx of a R_IHCONST reloc, since it + is actually an addend, not a symbol index at all. */ + +static bfd_boolean +coff_a29k_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) + bfd *obfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + bfd *ibfd ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + struct internal_reloc *irel; + bfd_boolean *adjustedp; +{ + if (irel->r_type == R_IHCONST) + *adjustedp = TRUE; + else + *adjustedp = FALSE; + return TRUE; +} + +#define coff_adjust_symndx coff_a29k_adjust_symndx + +#include "coffcode.h" + +CREATE_BIG_COFF_TARGET_VEC (a29kcoff_big_vec, "coff-a29k-big", 0, SEC_READONLY, '_', NULL, COFF_SWAP_TABLE) diff --git a/bfd/coff-apollo.c b/bfd/coff-apollo.c new file mode 100644 index 0000000000000..a2dd2100fa03a --- /dev/null +++ b/bfd/coff-apollo.c @@ -0,0 +1,121 @@ +/* BFD back-end for Apollo 68000 COFF binaries. + Copyright 1990, 1991, 1992, 1993, 1994, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + By Troy Rollo (troy@cbme.unsw.edu.au) + Based on m68k standard COFF version Written by Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "coff/apollo.h" +#include "coff/internal.h" +#include "libcoff.h" + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) + +#ifdef ONLY_DECLARE_RELOCS +extern reloc_howto_type apollocoff_howto_table[]; +#else +reloc_howto_type apollocoff_howto_table[] = + { + HOWTO (R_RELBYTE, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "8", TRUE, 0x000000ff,0x000000ff, FALSE), + HOWTO (R_RELWORD, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "16", TRUE, 0x0000ffff,0x0000ffff, FALSE), + HOWTO (R_RELLONG, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "32", TRUE, 0xffffffff,0xffffffff, FALSE), + HOWTO (R_PCRBYTE, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0, "DISP8", TRUE, 0x000000ff,0x000000ff, FALSE), + HOWTO (R_PCRWORD, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "DISP16", TRUE, 0x0000ffff,0x0000ffff, FALSE), + HOWTO (R_PCRLONG, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "DISP32", TRUE, 0xffffffff,0xffffffff, FALSE), + HOWTO (R_RELLONG_NEG, 0, -2, 32, FALSE, 0, complain_overflow_bitfield, 0, "-32", TRUE, 0xffffffff,0xffffffff, FALSE), + }; +#endif /* not ONLY_DECLARE_RELOCS */ + +#ifndef BADMAG +#define BADMAG(x) M68KBADMAG(x) +#endif +#define APOLLO_M68 1 /* Customize coffcode.h */ + +/* Turn a howto into a reloc number. */ + +extern void apollo_rtype2howto PARAMS ((arelent *, int)); +extern int apollo_howto2rtype PARAMS ((reloc_howto_type *)); +#ifndef ONLY_DECLARE_RELOCS + +void +apollo_rtype2howto (internal, relocentry) + arelent *internal; + int relocentry; +{ + switch (relocentry) + { + case R_RELBYTE: internal->howto = apollocoff_howto_table + 0; break; + case R_RELWORD: internal->howto = apollocoff_howto_table + 1; break; + case R_RELLONG: internal->howto = apollocoff_howto_table + 2; break; + case R_PCRBYTE: internal->howto = apollocoff_howto_table + 3; break; + case R_PCRWORD: internal->howto = apollocoff_howto_table + 4; break; + case R_PCRLONG: internal->howto = apollocoff_howto_table + 5; break; + case R_RELLONG_NEG: internal->howto = apollocoff_howto_table + 6; break; + } +} + +int +apollo_howto2rtype (internal) + reloc_howto_type *internal; +{ + if (internal->pc_relative) + { + switch (internal->bitsize) + { + case 32: return R_PCRLONG; + case 16: return R_PCRWORD; + case 8: return R_PCRBYTE; + } + } + else + { + switch (internal->bitsize) + { + case 32: return R_RELLONG; + case 16: return R_RELWORD; + case 8: return R_RELBYTE; + } + } + return R_RELLONG; +} +#endif /* not ONLY_DECLARE_RELOCS */ + +#define RTYPE2HOWTO(internal, relocentry) \ + apollo_rtype2howto (internal, (relocentry)->r_type) + +#define SELECT_RELOC(external, internal) \ + external.r_type = apollo_howto2rtype (internal); + +#include "coffcode.h" + +#ifndef TARGET_SYM +#define TARGET_SYM apollocoff_vec +#endif + +#ifndef TARGET_NAME +#define TARGET_NAME "apollo-m68k" +#endif + +#ifdef NAMES_HAVE_UNDERSCORE +CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, 0, 0, '_', NULL, COFF_SWAP_TABLE) +#else +CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, 0, 0, 0, NULL, COFF_SWAP_TABLE) +#endif diff --git a/bfd/coff-go32.c b/bfd/coff-go32.c new file mode 100644 index 0000000000000..146e3a3006046 --- /dev/null +++ b/bfd/coff-go32.c @@ -0,0 +1,45 @@ +/* BFD back-end for Intel 386 COFF files (DJGPP variant). + Copyright 1990, 1991, 1992, 1993, 1994, 1999, 2000, 2001 + Free Software Foundation, Inc. + Written by DJ Delorie. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define TARGET_SYM go32coff_vec +#define TARGET_NAME "coff-go32" +#define TARGET_UNDERSCORE '_' +#define COFF_LONG_SECTION_NAMES +#define COFF_SUPPORT_GNU_LINKONCE +#define COFF_LONG_FILENAMES + +#define COFF_SECTION_ALIGNMENT_ENTRIES \ +{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.d"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.t"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.r"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } + +#include "coff-i386.c" diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c new file mode 100644 index 0000000000000..e4d1399e31f28 --- /dev/null +++ b/bfd/coff-h8300.c @@ -0,0 +1,1444 @@ +/* BFD back-end for Renesas H8/300 COFF binaries. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + Written by Steve Chamberlain, . + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "bfdlink.h" +#include "genlink.h" +#include "coff/h8300.h" +#include "coff/internal.h" +#include "libcoff.h" +#include "libiberty.h" + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) + +/* We derive a hash table from the basic BFD hash table to + hold entries in the function vector. Aside from the + info stored by the basic hash table, we need the offset + of a particular entry within the hash table as well as + the offset where we'll add the next entry. */ + +struct funcvec_hash_entry + { + /* The basic hash table entry. */ + struct bfd_hash_entry root; + + /* The offset within the vectors section where + this entry lives. */ + bfd_vma offset; + }; + +struct funcvec_hash_table + { + /* The basic hash table. */ + struct bfd_hash_table root; + + bfd *abfd; + + /* Offset at which we'll add the next entry. */ + unsigned int offset; + }; + +static struct bfd_hash_entry * +funcvec_hash_newfunc + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); + +static bfd_boolean +funcvec_hash_table_init + (struct funcvec_hash_table *, bfd *, + struct bfd_hash_entry *(*) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *)); + +static bfd_reloc_status_type special + (bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **); +static int select_reloc + (reloc_howto_type *); +static void rtype2howto + (arelent *, struct internal_reloc *); +static void reloc_processing + (arelent *, struct internal_reloc *, asymbol **, bfd *, asection *); +static bfd_boolean h8300_symbol_address_p + (bfd *, asection *, bfd_vma); +static int h8300_reloc16_estimate + (bfd *, asection *, arelent *, unsigned int, + struct bfd_link_info *); +static void h8300_reloc16_extra_cases + (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, + bfd_byte *, unsigned int *, unsigned int *); +static bfd_boolean h8300_bfd_link_add_symbols + (bfd *, struct bfd_link_info *); + +/* To lookup a value in the function vector hash table. */ +#define funcvec_hash_lookup(table, string, create, copy) \ + ((struct funcvec_hash_entry *) \ + bfd_hash_lookup (&(table)->root, (string), (create), (copy))) + +/* The derived h8300 COFF linker table. Note it's derived from + the generic linker hash table, not the COFF backend linker hash + table! We use this to attach additional data structures we + need while linking on the h8300. */ +struct h8300_coff_link_hash_table { + /* The main hash table. */ + struct generic_link_hash_table root; + + /* Section for the vectors table. This gets attached to a + random input bfd, we keep it here for easy access. */ + asection *vectors_sec; + + /* Hash table of the functions we need to enter into the function + vector. */ + struct funcvec_hash_table *funcvec_hash_table; +}; + +static struct bfd_link_hash_table *h8300_coff_link_hash_table_create (bfd *); + +/* Get the H8/300 COFF linker hash table from a link_info structure. */ + +#define h8300_coff_hash_table(p) \ + ((struct h8300_coff_link_hash_table *) ((coff_hash_table (p)))) + +/* Initialize fields within a funcvec hash table entry. Called whenever + a new entry is added to the funcvec hash table. */ + +static struct bfd_hash_entry * +funcvec_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *gen_table, + const char *string) +{ + struct funcvec_hash_entry *ret; + struct funcvec_hash_table *table; + + ret = (struct funcvec_hash_entry *) entry; + table = (struct funcvec_hash_table *) gen_table; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == NULL) + ret = ((struct funcvec_hash_entry *) + bfd_hash_allocate (gen_table, + sizeof (struct funcvec_hash_entry))); + if (ret == NULL) + return NULL; + + /* Call the allocation method of the superclass. */ + ret = ((struct funcvec_hash_entry *) + bfd_hash_newfunc ((struct bfd_hash_entry *) ret, gen_table, string)); + + if (ret == NULL) + return NULL; + + /* Note where this entry will reside in the function vector table. */ + ret->offset = table->offset; + + /* Bump the offset at which we store entries in the function + vector. We'd like to bump up the size of the vectors section, + but it's not easily available here. */ + switch (bfd_get_mach (table->abfd)) + { + case bfd_mach_h8300: + case bfd_mach_h8300hn: + case bfd_mach_h8300sn: + table->offset += 2; + break; + case bfd_mach_h8300h: + case bfd_mach_h8300s: + table->offset += 4; + break; + default: + return NULL; + } + + /* Everything went OK. */ + return (struct bfd_hash_entry *) ret; +} + +/* Initialize the function vector hash table. */ + +static bfd_boolean +funcvec_hash_table_init (struct funcvec_hash_table *table, + bfd *abfd, + struct bfd_hash_entry *(*newfunc) + (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *)) +{ + /* Initialize our local fields, then call the generic initialization + routine. */ + table->offset = 0; + table->abfd = abfd; + return (bfd_hash_table_init (&table->root, newfunc)); +} + +/* Create the derived linker hash table. We use a derived hash table + basically to hold "static" information during an H8/300 coff link + without using static variables. */ + +static struct bfd_link_hash_table * +h8300_coff_link_hash_table_create (bfd *abfd) +{ + struct h8300_coff_link_hash_table *ret; + bfd_size_type amt = sizeof (struct h8300_coff_link_hash_table); + + ret = (struct h8300_coff_link_hash_table *) bfd_malloc (amt); + if (ret == NULL) + return NULL; + if (!_bfd_link_hash_table_init (&ret->root.root, abfd, + _bfd_generic_link_hash_newfunc)) + { + free (ret); + return NULL; + } + + /* Initialize our data. */ + ret->vectors_sec = NULL; + ret->funcvec_hash_table = NULL; + + /* OK. Everything's initialized, return the base pointer. */ + return &ret->root.root; +} + +/* Special handling for H8/300 relocs. + We only come here for pcrel stuff and return normally if not an -r link. + When doing -r, we can't do any arithmetic for the pcrel stuff, because + the code in reloc.c assumes that we can manipulate the targets of + the pcrel branches. This isn't so, since the H8/300 can do relaxing, + which means that the gap after the instruction may not be enough to + contain the offset required for the branch, so we have to use only + the addend until the final link. */ + +static bfd_reloc_status_type +special (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry ATTRIBUTE_UNUSED, + asymbol *symbol ATTRIBUTE_UNUSED, + PTR data ATTRIBUTE_UNUSED, + asection *input_section ATTRIBUTE_UNUSED, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + if (output_bfd == (bfd *) NULL) + return bfd_reloc_continue; + + /* Adjust the reloc address to that in the output section. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; +} + +static reloc_howto_type howto_table[] = { + HOWTO (R_RELBYTE, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, special, "8", FALSE, 0x000000ff, 0x000000ff, FALSE), + HOWTO (R_RELWORD, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, special, "16", FALSE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (R_RELLONG, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, special, "32", FALSE, 0xffffffff, 0xffffffff, FALSE), + HOWTO (R_PCRBYTE, 0, 0, 8, TRUE, 0, complain_overflow_signed, special, "DISP8", FALSE, 0x000000ff, 0x000000ff, TRUE), + HOWTO (R_PCRWORD, 0, 1, 16, TRUE, 0, complain_overflow_signed, special, "DISP16", FALSE, 0x0000ffff, 0x0000ffff, TRUE), + HOWTO (R_PCRLONG, 0, 2, 32, TRUE, 0, complain_overflow_signed, special, "DISP32", FALSE, 0xffffffff, 0xffffffff, TRUE), + HOWTO (R_MOV16B1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, special, "relaxable mov.b:16", FALSE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (R_MOV16B2, 0, 1, 8, FALSE, 0, complain_overflow_bitfield, special, "relaxed mov.b:16", FALSE, 0x000000ff, 0x000000ff, FALSE), + HOWTO (R_JMP1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, special, "16/pcrel", FALSE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (R_JMP2, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, special, "pcrecl/16", FALSE, 0x000000ff, 0x000000ff, FALSE), + HOWTO (R_JMPL1, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, special, "24/pcrell", FALSE, 0x00ffffff, 0x00ffffff, FALSE), + HOWTO (R_JMPL2, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, special, "pc8/24", FALSE, 0x000000ff, 0x000000ff, FALSE), + HOWTO (R_MOV24B1, 0, 1, 32, FALSE, 0, complain_overflow_bitfield, special, "relaxable mov.b:24", FALSE, 0xffffffff, 0xffffffff, FALSE), + HOWTO (R_MOV24B2, 0, 1, 8, FALSE, 0, complain_overflow_bitfield, special, "relaxed mov.b:24", FALSE, 0x0000ffff, 0x0000ffff, FALSE), + + /* An indirect reference to a function. This causes the function's address + to be added to the function vector in lo-mem and puts the address of + the function vector's entry in the jsr instruction. */ + HOWTO (R_MEM_INDIRECT, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, special, "8/indirect", FALSE, 0x000000ff, 0x000000ff, FALSE), + + /* Internal reloc for relaxing. This is created when a 16-bit pc-relative + branch is turned into an 8-bit pc-relative branch. */ + HOWTO (R_PCRWORD_B, 0, 0, 8, TRUE, 0, complain_overflow_bitfield, special, "relaxed bCC:16", FALSE, 0x000000ff, 0x000000ff, FALSE), + + HOWTO (R_MOVL1, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,special, "32/24 relaxable move", FALSE, 0xffffffff, 0xffffffff, FALSE), + + HOWTO (R_MOVL2, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, special, "32/24 relaxed move", FALSE, 0x0000ffff, 0x0000ffff, FALSE), + + HOWTO (R_BCC_INV, 0, 0, 8, TRUE, 0, complain_overflow_signed, special, "DISP8 inverted", FALSE, 0x000000ff, 0x000000ff, TRUE), + + HOWTO (R_JMP_DEL, 0, 0, 8, TRUE, 0, complain_overflow_signed, special, "Deleted jump", FALSE, 0x000000ff, 0x000000ff, TRUE), +}; + +/* Turn a howto into a reloc number. */ + +#define SELECT_RELOC(x,howto) \ + { x.r_type = select_reloc (howto); } + +#define BADMAG(x) (H8300BADMAG (x) && H8300HBADMAG (x) && H8300SBADMAG (x) \ + && H8300HNBADMAG(x) && H8300SNBADMAG(x)) +#define H8300 1 /* Customize coffcode.h */ +#define __A_MAGIC_SET__ + +/* Code to swap in the reloc. */ +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 +#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ + dst->r_stuff[0] = 'S'; \ + dst->r_stuff[1] = 'C'; + +static int +select_reloc (reloc_howto_type *howto) +{ + return howto->type; +} + +/* Code to turn a r_type into a howto ptr, uses the above howto table. */ + +static void +rtype2howto (arelent *internal, struct internal_reloc *dst) +{ + switch (dst->r_type) + { + case R_RELBYTE: + internal->howto = howto_table + 0; + break; + case R_RELWORD: + internal->howto = howto_table + 1; + break; + case R_RELLONG: + internal->howto = howto_table + 2; + break; + case R_PCRBYTE: + internal->howto = howto_table + 3; + break; + case R_PCRWORD: + internal->howto = howto_table + 4; + break; + case R_PCRLONG: + internal->howto = howto_table + 5; + break; + case R_MOV16B1: + internal->howto = howto_table + 6; + break; + case R_MOV16B2: + internal->howto = howto_table + 7; + break; + case R_JMP1: + internal->howto = howto_table + 8; + break; + case R_JMP2: + internal->howto = howto_table + 9; + break; + case R_JMPL1: + internal->howto = howto_table + 10; + break; + case R_JMPL2: + internal->howto = howto_table + 11; + break; + case R_MOV24B1: + internal->howto = howto_table + 12; + break; + case R_MOV24B2: + internal->howto = howto_table + 13; + break; + case R_MEM_INDIRECT: + internal->howto = howto_table + 14; + break; + case R_PCRWORD_B: + internal->howto = howto_table + 15; + break; + case R_MOVL1: + internal->howto = howto_table + 16; + break; + case R_MOVL2: + internal->howto = howto_table + 17; + break; + case R_BCC_INV: + internal->howto = howto_table + 18; + break; + case R_JMP_DEL: + internal->howto = howto_table + 19; + break; + default: + abort (); + break; + } +} + +#define RTYPE2HOWTO(internal, relocentry) rtype2howto (internal, relocentry) + +/* Perform any necessary magic to the addend in a reloc entry. */ + +#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ + cache_ptr->addend = ext_reloc.r_offset; + +#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ + reloc_processing (relent, reloc, symbols, abfd, section) + +static void +reloc_processing (arelent *relent, struct internal_reloc *reloc, + asymbol **symbols, bfd *abfd, asection *section) +{ + relent->address = reloc->r_vaddr; + rtype2howto (relent, reloc); + + if (((int) reloc->r_symndx) > 0) + relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; + else + relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + + relent->addend = reloc->r_offset; + + relent->address -= section->vma; +#if 0 + relent->section = 0; +#endif +} + +static bfd_boolean +h8300_symbol_address_p (bfd *abfd, asection *input_section, bfd_vma address) +{ + asymbol **s; + + s = _bfd_generic_link_get_symbols (abfd); + BFD_ASSERT (s != (asymbol **) NULL); + + /* Search all the symbols for one in INPUT_SECTION with + address ADDRESS. */ + while (*s) + { + asymbol *p = *s; + + if (p->section == input_section + && (input_section->output_section->vma + + input_section->output_offset + + p->value) == address) + return TRUE; + s++; + } + return FALSE; +} + +/* If RELOC represents a relaxable instruction/reloc, change it into + the relaxed reloc, notify the linker that symbol addresses + have changed (bfd_perform_slip) and return how much the current + section has shrunk by. + + FIXME: Much of this code has knowledge of the ordering of entries + in the howto table. This needs to be fixed. */ + +static int +h8300_reloc16_estimate (bfd *abfd, asection *input_section, arelent *reloc, + unsigned int shrink, struct bfd_link_info *link_info) +{ + bfd_vma value; + bfd_vma dot; + bfd_vma gap; + static asection *last_input_section = NULL; + static arelent *last_reloc = NULL; + + /* The address of the thing to be relocated will have moved back by + the size of the shrink - but we don't change reloc->address here, + since we need it to know where the relocation lives in the source + uncooked section. */ + bfd_vma address = reloc->address - shrink; + + if (input_section != last_input_section) + last_reloc = NULL; + + /* Only examine the relocs which might be relaxable. */ + switch (reloc->howto->type) + { + /* This is the 16-/24-bit absolute branch which could become an + 8-bit pc-relative branch. */ + case R_JMP1: + case R_JMPL1: + /* Get the address of the target of this branch. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + /* Get the address of the next instruction (not the reloc). */ + dot = (input_section->output_section->vma + + input_section->output_offset + address); + + /* Adjust for R_JMP1 vs R_JMPL1. */ + dot += (reloc->howto->type == R_JMP1 ? 1 : 2); + + /* Compute the distance from this insn to the branch target. */ + gap = value - dot; + + /* If the distance is within -128..+128 inclusive, then we can relax + this jump. +128 is valid since the target will move two bytes + closer if we do relax this branch. */ + if ((int) gap >= -128 && (int) gap <= 128) + { + bfd_byte code; + + if (!bfd_get_section_contents (abfd, input_section, & code, + reloc->address, 1)) + break; + code = bfd_get_8 (abfd, & code); + + /* It's possible we may be able to eliminate this branch entirely; + if the previous instruction is a branch around this instruction, + and there's no label at this instruction, then we can reverse + the condition on the previous branch and eliminate this jump. + + original: new: + bCC lab1 bCC' lab2 + jmp lab2 + lab1: lab1: + + This saves 4 bytes instead of two, and should be relatively + common. + + Only perform this optimisation for jumps (code 0x5a) not + subroutine calls, as otherwise it could transform: + + mov.w r0,r0 + beq .L1 + jsr @_bar + .L1: rts + _bar: rts + into: + mov.w r0,r0 + bne _bar + rts + _bar: rts + + which changes the call (jsr) into a branch (bne). */ + if (code == 0x5a + && gap <= 126 + && last_reloc + && last_reloc->howto->type == R_PCRBYTE) + { + bfd_vma last_value; + last_value = bfd_coff_reloc16_get_value (last_reloc, link_info, + input_section) + 1; + + if (last_value == dot + 2 + && last_reloc->address + 1 == reloc->address + && !h8300_symbol_address_p (abfd, input_section, dot - 2)) + { + reloc->howto = howto_table + 19; + last_reloc->howto = howto_table + 18; + last_reloc->sym_ptr_ptr = reloc->sym_ptr_ptr; + last_reloc->addend = reloc->addend; + shrink += 4; + bfd_perform_slip (abfd, 4, input_section, address); + break; + } + } + + /* Change the reloc type. */ + reloc->howto = reloc->howto + 1; + + /* This shrinks this section by two bytes. */ + shrink += 2; + bfd_perform_slip (abfd, 2, input_section, address); + } + break; + + /* This is the 16-bit pc-relative branch which could become an 8-bit + pc-relative branch. */ + case R_PCRWORD: + /* Get the address of the target of this branch, add one to the value + because the addend field in PCrel jumps is off by -1. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section) + 1; + + /* Get the address of the next instruction if we were to relax. */ + dot = input_section->output_section->vma + + input_section->output_offset + address; + + /* Compute the distance from this insn to the branch target. */ + gap = value - dot; + + /* If the distance is within -128..+128 inclusive, then we can relax + this jump. +128 is valid since the target will move two bytes + closer if we do relax this branch. */ + if ((int) gap >= -128 && (int) gap <= 128) + { + /* Change the reloc type. */ + reloc->howto = howto_table + 15; + + /* This shrinks this section by two bytes. */ + shrink += 2; + bfd_perform_slip (abfd, 2, input_section, address); + } + break; + + /* This is a 16-bit absolute address in a mov.b insn, which can + become an 8-bit absolute address if it's in the right range. */ + case R_MOV16B1: + /* Get the address of the data referenced by this mov.b insn. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + value = bfd_h8300_pad_address (abfd, value); + + /* If the address is in the top 256 bytes of the address space + then we can relax this instruction. */ + if (value >= 0xffffff00u) + { + /* Change the reloc type. */ + reloc->howto = reloc->howto + 1; + + /* This shrinks this section by two bytes. */ + shrink += 2; + bfd_perform_slip (abfd, 2, input_section, address); + } + break; + + /* Similarly for a 24-bit absolute address in a mov.b. Note that + if we can't relax this into an 8-bit absolute, we'll fall through + and try to relax it into a 16-bit absolute. */ + case R_MOV24B1: + /* Get the address of the data referenced by this mov.b insn. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + value = bfd_h8300_pad_address (abfd, value); + + if (value >= 0xffffff00u) + { + /* Change the reloc type. */ + reloc->howto = reloc->howto + 1; + + /* This shrinks this section by four bytes. */ + shrink += 4; + bfd_perform_slip (abfd, 4, input_section, address); + + /* Done with this reloc. */ + break; + } + + /* FALLTHROUGH and try to turn the 24-/32-bit reloc into a 16-bit + reloc. */ + + /* This is a 24-/32-bit absolute address in a mov insn, which can + become an 16-bit absolute address if it's in the right range. */ + case R_MOVL1: + /* Get the address of the data referenced by this mov insn. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + value = bfd_h8300_pad_address (abfd, value); + + /* If the address is a sign-extended 16-bit value then we can + relax this instruction. */ + if (value <= 0x7fff || value >= 0xffff8000u) + { + /* Change the reloc type. */ + reloc->howto = howto_table + 17; + + /* This shrinks this section by two bytes. */ + shrink += 2; + bfd_perform_slip (abfd, 2, input_section, address); + } + break; + + /* No other reloc types represent relaxing opportunities. */ + default: + break; + } + + last_reloc = reloc; + last_input_section = input_section; + return shrink; +} + +/* Handle relocations for the H8/300, including relocs for relaxed + instructions. + + FIXME: Not all relocations check for overflow! */ + +static void +h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, + struct bfd_link_order *link_order, arelent *reloc, + bfd_byte *data, unsigned int *src_ptr, + unsigned int *dst_ptr) +{ + unsigned int src_address = *src_ptr; + unsigned int dst_address = *dst_ptr; + asection *input_section = link_order->u.indirect.section; + bfd_vma value; + bfd_vma dot; + int gap, tmp; + unsigned char temp_code; + + switch (reloc->howto->type) + { + /* Generic 8-bit pc-relative relocation. */ + case R_PCRBYTE: + /* Get the address of the target of this branch. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + dot = (link_order->offset + + dst_address + + link_order->u.indirect.section->output_section->vma); + + gap = value - dot; + + /* Sanity check. */ + if (gap < -128 || gap > 126) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + + /* Everything looks OK. Apply the relocation and update the + src/dst address appropriately. */ + bfd_put_8 (abfd, gap, data + dst_address); + dst_address++; + src_address++; + + /* All done. */ + break; + + /* Generic 16-bit pc-relative relocation. */ + case R_PCRWORD: + /* Get the address of the target of this branch. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + /* Get the address of the instruction (not the reloc). */ + dot = (link_order->offset + + dst_address + + link_order->u.indirect.section->output_section->vma + 1); + + gap = value - dot; + + /* Sanity check. */ + if (gap > 32766 || gap < -32768) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + + /* Everything looks OK. Apply the relocation and update the + src/dst address appropriately. */ + bfd_put_16 (abfd, (bfd_vma) gap, data + dst_address); + dst_address += 2; + src_address += 2; + + /* All done. */ + break; + + /* Generic 8-bit absolute relocation. */ + case R_RELBYTE: + /* Get the address of the object referenced by this insn. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + bfd_put_8 (abfd, value & 0xff, data + dst_address); + dst_address += 1; + src_address += 1; + + /* All done. */ + break; + + /* Various simple 16-bit absolute relocations. */ + case R_MOV16B1: + case R_JMP1: + case R_RELWORD: + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + bfd_put_16 (abfd, value, data + dst_address); + dst_address += 2; + src_address += 2; + break; + + /* Various simple 24-/32-bit absolute relocations. */ + case R_MOV24B1: + case R_MOVL1: + case R_RELLONG: + /* Get the address of the target of this branch. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + bfd_put_32 (abfd, value, data + dst_address); + dst_address += 4; + src_address += 4; + break; + + /* Another 24-/32-bit absolute relocation. */ + case R_JMPL1: + /* Get the address of the target of this branch. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + value = ((value & 0x00ffffff) + | (bfd_get_32 (abfd, data + src_address) & 0xff000000)); + bfd_put_32 (abfd, value, data + dst_address); + dst_address += 4; + src_address += 4; + break; + + /* This is a 24-/32-bit absolute address in one of the following + instructions: + + "band", "bclr", "biand", "bild", "bior", "bist", "bixor", + "bld", "bnot", "bor", "bset", "bst", "btst", "bxor", "ldc.w", + "stc.w" and "mov.[bwl]" + + We may relax this into an 16-bit absolute address if it's in + the right range. */ + case R_MOVL2: + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + value = bfd_h8300_pad_address (abfd, value); + + /* Sanity check. */ + if (value <= 0x7fff || value >= 0xffff8000u) + { + /* Insert the 16-bit value into the proper location. */ + bfd_put_16 (abfd, value, data + dst_address); + + /* Fix the opcode. For all the instructions that belong to + this relaxation, we simply need to turn off bit 0x20 in + the previous byte. */ + data[dst_address - 1] &= ~0x20; + dst_address += 2; + src_address += 4; + } + else + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + break; + + /* A 16-bit absolute branch that is now an 8-bit pc-relative branch. */ + case R_JMP2: + /* Get the address of the target of this branch. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + /* Get the address of the next instruction. */ + dot = (link_order->offset + + dst_address + + link_order->u.indirect.section->output_section->vma + 1); + + gap = value - dot; + + /* Sanity check. */ + if (gap < -128 || gap > 126) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + + /* Now fix the instruction itself. */ + switch (data[dst_address - 1]) + { + case 0x5e: + /* jsr -> bsr */ + bfd_put_8 (abfd, 0x55, data + dst_address - 1); + break; + case 0x5a: + /* jmp -> bra */ + bfd_put_8 (abfd, 0x40, data + dst_address - 1); + break; + + default: + abort (); + } + + /* Write out the 8-bit value. */ + bfd_put_8 (abfd, gap, data + dst_address); + + dst_address += 1; + src_address += 3; + + break; + + /* A 16-bit pc-relative branch that is now an 8-bit pc-relative branch. */ + case R_PCRWORD_B: + /* Get the address of the target of this branch. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + /* Get the address of the instruction (not the reloc). */ + dot = (link_order->offset + + dst_address + + link_order->u.indirect.section->output_section->vma - 1); + + gap = value - dot; + + /* Sanity check. */ + if (gap < -128 || gap > 126) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + + /* Now fix the instruction. */ + switch (data[dst_address - 2]) + { + case 0x58: + /* bCC:16 -> bCC:8 */ + /* Get the second byte of the original insn, which contains + the condition code. */ + tmp = data[dst_address - 1]; + + /* Compute the fisrt byte of the relaxed instruction. The + original sequence 0x58 0xX0 is relaxed to 0x4X, where X + represents the condition code. */ + tmp &= 0xf0; + tmp >>= 4; + tmp |= 0x40; + + /* Write it. */ + bfd_put_8 (abfd, tmp, data + dst_address - 2); + break; + + case 0x5c: + /* bsr:16 -> bsr:8 */ + bfd_put_8 (abfd, 0x55, data + dst_address - 2); + break; + + default: + abort (); + } + + /* Output the target. */ + bfd_put_8 (abfd, gap, data + dst_address - 1); + + /* We don't advance dst_address -- the 8-bit reloc is applied at + dst_address - 1, so the next insn should begin at dst_address. */ + src_address += 2; + + break; + + /* Similarly for a 24-bit absolute that is now 8 bits. */ + case R_JMPL2: + /* Get the address of the target of this branch. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + /* Get the address of the instruction (not the reloc). */ + dot = (link_order->offset + + dst_address + + link_order->u.indirect.section->output_section->vma + 2); + + gap = value - dot; + + /* Fix the instruction. */ + switch (data[src_address]) + { + case 0x5e: + /* jsr -> bsr */ + bfd_put_8 (abfd, 0x55, data + dst_address); + break; + case 0x5a: + /* jmp ->bra */ + bfd_put_8 (abfd, 0x40, data + dst_address); + break; + default: + abort (); + } + + bfd_put_8 (abfd, gap, data + dst_address + 1); + dst_address += 2; + src_address += 4; + + break; + + /* This is a 16-bit absolute address in one of the following + instructions: + + "band", "bclr", "biand", "bild", "bior", "bist", "bixor", + "bld", "bnot", "bor", "bset", "bst", "btst", "bxor", and + "mov.b" + + We may relax this into an 8-bit absolute address if it's in + the right range. */ + case R_MOV16B2: + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + /* All instructions with R_H8_DIR16B2 start with 0x6a. */ + if (data[dst_address - 2] != 0x6a) + abort (); + + temp_code = data[src_address - 1]; + + /* If this is a mov.b instruction, clear the lower nibble, which + contains the source/destination register number. */ + if ((temp_code & 0x10) != 0x10) + temp_code &= 0xf0; + + /* Fix up the opcode. */ + switch (temp_code) + { + case 0x00: + /* This is mov.b @aa:16,Rd. */ + data[dst_address - 2] = (data[src_address - 1] & 0xf) | 0x20; + break; + case 0x80: + /* This is mov.b Rs,@aa:16. */ + data[dst_address - 2] = (data[src_address - 1] & 0xf) | 0x30; + break; + case 0x18: + /* This is a bit-maniputation instruction that stores one + bit into memory, one of "bclr", "bist", "bnot", "bset", + and "bst". */ + data[dst_address - 2] = 0x7f; + break; + case 0x10: + /* This is a bit-maniputation instruction that loads one bit + from memory, one of "band", "biand", "bild", "bior", + "bixor", "bld", "bor", "btst", and "bxor". */ + data[dst_address - 2] = 0x7e; + break; + default: + abort (); + } + + bfd_put_8 (abfd, value & 0xff, data + dst_address - 1); + src_address += 2; + break; + + /* This is a 24-bit absolute address in one of the following + instructions: + + "band", "bclr", "biand", "bild", "bior", "bist", "bixor", + "bld", "bnot", "bor", "bset", "bst", "btst", "bxor", and + "mov.b" + + We may relax this into an 8-bit absolute address if it's in + the right range. */ + case R_MOV24B2: + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + /* All instructions with R_MOV24B2 start with 0x6a. */ + if (data[dst_address - 2] != 0x6a) + abort (); + + temp_code = data[src_address - 1]; + + /* If this is a mov.b instruction, clear the lower nibble, which + contains the source/destination register number. */ + if ((temp_code & 0x30) != 0x30) + temp_code &= 0xf0; + + /* Fix up the opcode. */ + switch (temp_code) + { + case 0x20: + /* This is mov.b @aa:24/32,Rd. */ + data[dst_address - 2] = (data[src_address - 1] & 0xf) | 0x20; + break; + case 0xa0: + /* This is mov.b Rs,@aa:24/32. */ + data[dst_address - 2] = (data[src_address - 1] & 0xf) | 0x30; + break; + case 0x38: + /* This is a bit-maniputation instruction that stores one + bit into memory, one of "bclr", "bist", "bnot", "bset", + and "bst". */ + data[dst_address - 2] = 0x7f; + break; + case 0x30: + /* This is a bit-maniputation instruction that loads one bit + from memory, one of "band", "biand", "bild", "bior", + "bixor", "bld", "bor", "btst", and "bxor". */ + data[dst_address - 2] = 0x7e; + break; + default: + abort (); + } + + bfd_put_8 (abfd, value & 0xff, data + dst_address - 1); + src_address += 4; + break; + + case R_BCC_INV: + /* Get the address of the target of this branch. */ + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + dot = (link_order->offset + + dst_address + + link_order->u.indirect.section->output_section->vma) + 1; + + gap = value - dot; + + /* Sanity check. */ + if (gap < -128 || gap > 126) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + + /* Everything looks OK. Fix the condition in the instruction, apply + the relocation, and update the src/dst address appropriately. */ + + bfd_put_8 (abfd, bfd_get_8 (abfd, data + dst_address - 1) ^ 1, + data + dst_address - 1); + bfd_put_8 (abfd, gap, data + dst_address); + dst_address++; + src_address++; + + /* All done. */ + break; + + case R_JMP_DEL: + src_address += 4; + break; + + /* An 8-bit memory indirect instruction (jmp/jsr). + + There's several things that need to be done to handle + this relocation. + + If this is a reloc against the absolute symbol, then + we should handle it just R_RELBYTE. Likewise if it's + for a symbol with a value ge 0 and le 0xff. + + Otherwise it's a jump/call through the function vector, + and the linker is expected to set up the function vector + and put the right value into the jump/call instruction. */ + case R_MEM_INDIRECT: + { + /* We need to find the symbol so we can determine it's + address in the function vector table. */ + asymbol *symbol; + const char *name; + struct funcvec_hash_table *ftab; + struct funcvec_hash_entry *h; + struct h8300_coff_link_hash_table *htab; + asection *vectors_sec; + + if (link_info->hash->creator != abfd->xvec) + { + (*_bfd_error_handler) + (_("cannot handle R_MEM_INDIRECT reloc when using %s output"), + link_info->hash->creator->name); + + /* What else can we do? This function doesn't allow return + of an error, and we don't want to call abort as that + indicates an internal error. */ +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif + xexit (EXIT_FAILURE); + } + htab = h8300_coff_hash_table (link_info); + vectors_sec = htab->vectors_sec; + + /* First see if this is a reloc against the absolute symbol + or against a symbol with a nonnegative value <= 0xff. */ + symbol = *(reloc->sym_ptr_ptr); + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + if (symbol == bfd_abs_section_ptr->symbol + || value <= 0xff) + { + /* This should be handled in a manner very similar to + R_RELBYTES. If the value is in range, then just slam + the value into the right location. Else trigger a + reloc overflow callback. */ + if (value <= 0xff) + { + bfd_put_8 (abfd, value, data + dst_address); + dst_address += 1; + src_address += 1; + } + else + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + break; + } + + /* This is a jump/call through a function vector, and we're + expected to create the function vector ourselves. + + First look up this symbol in the linker hash table -- we need + the derived linker symbol which holds this symbol's index + in the function vector. */ + name = symbol->name; + if (symbol->flags & BSF_LOCAL) + { + char *new_name = bfd_malloc ((bfd_size_type) strlen (name) + 9); + + if (new_name == NULL) + abort (); + + strcpy (new_name, name); + sprintf (new_name + strlen (name), "_%08x", + (int) symbol->section); + name = new_name; + } + + ftab = htab->funcvec_hash_table; + h = funcvec_hash_lookup (ftab, name, FALSE, FALSE); + + /* This shouldn't ever happen. If it does that means we've got + data corruption of some kind. Aborting seems like a reasonable + thing to do here. */ + if (h == NULL || vectors_sec == NULL) + abort (); + + /* Place the address of the function vector entry into the + reloc's address. */ + bfd_put_8 (abfd, + vectors_sec->output_offset + h->offset, + data + dst_address); + + dst_address++; + src_address++; + + /* Now create an entry in the function vector itself. */ + switch (bfd_get_mach (input_section->owner)) + { + case bfd_mach_h8300: + case bfd_mach_h8300hn: + case bfd_mach_h8300sn: + bfd_put_16 (abfd, + bfd_coff_reloc16_get_value (reloc, + link_info, + input_section), + vectors_sec->contents + h->offset); + break; + case bfd_mach_h8300h: + case bfd_mach_h8300s: + bfd_put_32 (abfd, + bfd_coff_reloc16_get_value (reloc, + link_info, + input_section), + vectors_sec->contents + h->offset); + break; + default: + abort (); + } + + /* Gross. We've already written the contents of the vector section + before we get here... So we write it again with the new data. */ + bfd_set_section_contents (vectors_sec->output_section->owner, + vectors_sec->output_section, + vectors_sec->contents, + (file_ptr) vectors_sec->output_offset, + vectors_sec->_raw_size); + break; + } + + default: + abort (); + break; + + } + + *src_ptr = src_address; + *dst_ptr = dst_address; +} + +/* Routine for the h8300 linker. + + This routine is necessary to handle the special R_MEM_INDIRECT + relocs on the h8300. It's responsible for generating a vectors + section and attaching it to an input bfd as well as sizing + the vectors section. It also creates our vectors hash table. + + It uses the generic linker routines to actually add the symbols. + from this BFD to the bfd linker hash table. It may add a few + selected static symbols to the bfd linker hash table. */ + +static bfd_boolean +h8300_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info) +{ + asection *sec; + struct funcvec_hash_table *funcvec_hash_table; + bfd_size_type amt; + struct h8300_coff_link_hash_table *htab; + + /* Add the symbols using the generic code. */ + _bfd_generic_link_add_symbols (abfd, info); + + if (info->hash->creator != abfd->xvec) + return TRUE; + + htab = h8300_coff_hash_table (info); + + /* If we haven't created a vectors section, do so now. */ + if (!htab->vectors_sec) + { + flagword flags; + + /* Make sure the appropriate flags are set, including SEC_IN_MEMORY. */ + flags = (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_READONLY); + htab->vectors_sec = bfd_make_section (abfd, ".vectors"); + + /* If the section wasn't created, or we couldn't set the flags, + quit quickly now, rather than dying a painful death later. */ + if (!htab->vectors_sec + || !bfd_set_section_flags (abfd, htab->vectors_sec, flags)) + return FALSE; + + /* Also create the vector hash table. */ + amt = sizeof (struct funcvec_hash_table); + funcvec_hash_table = (struct funcvec_hash_table *) bfd_alloc (abfd, amt); + + if (!funcvec_hash_table) + return FALSE; + + /* And initialize the funcvec hash table. */ + if (!funcvec_hash_table_init (funcvec_hash_table, abfd, + funcvec_hash_newfunc)) + { + bfd_release (abfd, funcvec_hash_table); + return FALSE; + } + + /* Store away a pointer to the funcvec hash table. */ + htab->funcvec_hash_table = funcvec_hash_table; + } + + /* Load up the function vector hash table. */ + funcvec_hash_table = htab->funcvec_hash_table; + + /* Now scan the relocs for all the sections in this bfd; create + additional space in the .vectors section as needed. */ + for (sec = abfd->sections; sec; sec = sec->next) + { + long reloc_size, reloc_count, i; + asymbol **symbols; + arelent **relocs; + + /* Suck in the relocs, symbols & canonicalize them. */ + reloc_size = bfd_get_reloc_upper_bound (abfd, sec); + if (reloc_size <= 0) + continue; + + relocs = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); + if (!relocs) + return FALSE; + + /* The symbols should have been read in by _bfd_generic link_add_symbols + call abovec, so we can cheat and use the pointer to them that was + saved in the above call. */ + symbols = _bfd_generic_link_get_symbols(abfd); + reloc_count = bfd_canonicalize_reloc (abfd, sec, relocs, symbols); + if (reloc_count <= 0) + { + free (relocs); + continue; + } + + /* Now walk through all the relocations in this section. */ + for (i = 0; i < reloc_count; i++) + { + arelent *reloc = relocs[i]; + asymbol *symbol = *(reloc->sym_ptr_ptr); + const char *name; + + /* We've got an indirect reloc. See if we need to add it + to the function vector table. At this point, we have + to add a new entry for each unique symbol referenced + by an R_MEM_INDIRECT relocation except for a reloc + against the absolute section symbol. */ + if (reloc->howto->type == R_MEM_INDIRECT + && symbol != bfd_abs_section_ptr->symbol) + + { + struct funcvec_hash_table *ftab; + struct funcvec_hash_entry *h; + + name = symbol->name; + if (symbol->flags & BSF_LOCAL) + { + char *new_name; + + new_name = bfd_malloc ((bfd_size_type) strlen (name) + 9); + if (new_name == NULL) + abort (); + + strcpy (new_name, name); + sprintf (new_name + strlen (name), "_%08x", + (int) symbol->section); + name = new_name; + } + + /* Look this symbol up in the function vector hash table. */ + ftab = htab->funcvec_hash_table; + h = funcvec_hash_lookup (ftab, name, FALSE, FALSE); + + /* If this symbol isn't already in the hash table, add + it and bump up the size of the hash table. */ + if (h == NULL) + { + h = funcvec_hash_lookup (ftab, name, TRUE, TRUE); + if (h == NULL) + { + free (relocs); + return FALSE; + } + + /* Bump the size of the vectors section. Each vector + takes 2 bytes on the h8300 and 4 bytes on the h8300h. */ + switch (bfd_get_mach (abfd)) + { + case bfd_mach_h8300: + case bfd_mach_h8300hn: + case bfd_mach_h8300sn: + htab->vectors_sec->_raw_size += 2; + break; + case bfd_mach_h8300h: + case bfd_mach_h8300s: + htab->vectors_sec->_raw_size += 4; + break; + default: + abort (); + } + } + } + } + + /* We're done with the relocations, release them. */ + free (relocs); + } + + /* Now actually allocate some space for the function vector. It's + wasteful to do this more than once, but this is easier. */ + sec = htab->vectors_sec; + if (sec->_raw_size != 0) + { + /* Free the old contents. */ + if (sec->contents) + free (sec->contents); + + /* Allocate new contents. */ + sec->contents = bfd_malloc (sec->_raw_size); + } + + return TRUE; +} + +#define coff_reloc16_extra_cases h8300_reloc16_extra_cases +#define coff_reloc16_estimate h8300_reloc16_estimate +#define coff_bfd_link_add_symbols h8300_bfd_link_add_symbols +#define coff_bfd_link_hash_table_create h8300_coff_link_hash_table_create + +#define COFF_LONG_FILENAMES +#include "coffcode.h" + +#undef coff_bfd_get_relocated_section_contents +#undef coff_bfd_relax_section +#define coff_bfd_get_relocated_section_contents \ + bfd_coff_reloc16_get_relocated_section_contents +#define coff_bfd_relax_section bfd_coff_reloc16_relax_section + +CREATE_BIG_COFF_TARGET_VEC (h8300coff_vec, "coff-h8300", BFD_IS_RELAXABLE, 0, '_', NULL, COFF_SWAP_TABLE) diff --git a/bfd/coff-h8500.c b/bfd/coff-h8500.c new file mode 100644 index 0000000000000..a94e4a30ec634 --- /dev/null +++ b/bfd/coff-h8500.c @@ -0,0 +1,306 @@ +/* BFD back-end for Renesas H8/500 COFF binaries. + Copyright 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Contributed by Cygnus Support. + Written by Steve Chamberlain, . + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "bfdlink.h" +#include "coff/h8500.h" +#include "coff/internal.h" +#include "libcoff.h" + +static int coff_h8500_select_reloc PARAMS ((reloc_howto_type *)); +static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); +static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); +static void extra_case PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, bfd_byte *, unsigned int *, unsigned int *)); + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) + +static reloc_howto_type r_imm8 = +HOWTO (R_H8500_IMM8, 0, 1, 8, FALSE, 0, + complain_overflow_bitfield, 0, "r_imm8", TRUE, 0x000000ff, 0x000000ff, FALSE); + +static reloc_howto_type r_imm16 = +HOWTO (R_H8500_IMM16, 0, 1, 16, FALSE, 0, + complain_overflow_bitfield, 0, "r_imm16", TRUE, 0x0000ffff, 0x0000ffff, FALSE); + +static reloc_howto_type r_imm24 = +HOWTO (R_H8500_IMM24, 0, 1, 24, FALSE, 0, + complain_overflow_bitfield, 0, "r_imm24", TRUE, 0x00ffffff, 0x00ffffff, FALSE); + +static reloc_howto_type r_imm32 = +HOWTO (R_H8500_IMM32, 0, 1, 32, FALSE, 0, + complain_overflow_bitfield, 0, "r_imm32", TRUE, 0xffffffff, 0xffffffff, FALSE); + +static reloc_howto_type r_high8 = +HOWTO (R_H8500_HIGH8, 0, 1, 8, FALSE, 0, + complain_overflow_dont, 0, "r_high8", TRUE, 0x000000ff, 0x000000ff, FALSE); + +static reloc_howto_type r_low16 = +HOWTO (R_H8500_LOW16, 0, 1, 16, FALSE, 0, + complain_overflow_dont, 0, "r_low16", TRUE, 0x0000ffff, 0x0000ffff, FALSE); + +static reloc_howto_type r_pcrel8 = +HOWTO (R_H8500_PCREL8, 0, 1, 8, TRUE, 0, complain_overflow_signed, 0, "r_pcrel8", TRUE, 0, 0, TRUE); + +static reloc_howto_type r_pcrel16 = +HOWTO (R_H8500_PCREL16, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "r_pcrel16", TRUE, 0, 0, TRUE); + +static reloc_howto_type r_high16 = +HOWTO (R_H8500_HIGH16, 0, 1, 8, FALSE, 0, + complain_overflow_dont, 0, "r_high16", TRUE, 0x000ffff, 0x0000ffff, FALSE); + +/* Turn a howto into a reloc number. */ + +static int +coff_h8500_select_reloc (howto) + reloc_howto_type *howto; +{ + return howto->type; +} + +#define SELECT_RELOC(x,howto) x.r_type = coff_h8500_select_reloc(howto) + +#define BADMAG(x) H8500BADMAG(x) +#define H8500 1 /* Customize coffcode.h */ + +#define __A_MAGIC_SET__ + +/* Code to swap in the reloc. */ +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 +#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ + dst->r_stuff[0] = 'S'; \ + dst->r_stuff[1] = 'C'; + +/* Code to turn a r_type into a howto ptr, uses the above howto table. */ + +static void +rtype2howto (internal, dst) + arelent * internal; + struct internal_reloc *dst; +{ + switch (dst->r_type) + { + default: + abort (); + break; + case R_H8500_IMM8: + internal->howto = &r_imm8; + break; + case R_H8500_IMM16: + internal->howto = &r_imm16; + break; + case R_H8500_IMM24: + internal->howto = &r_imm24; + break; + case R_H8500_IMM32: + internal->howto = &r_imm32; + break; + case R_H8500_PCREL8: + internal->howto = &r_pcrel8; + break; + case R_H8500_PCREL16: + internal->howto = &r_pcrel16; + break; + case R_H8500_HIGH8: + internal->howto = &r_high8; + break; + case R_H8500_HIGH16: + internal->howto = &r_high16; + break; + case R_H8500_LOW16: + internal->howto = &r_low16; + break; + } +} + +#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) + +/* Perform any necessary magic to the addend in a reloc entry. */ + +#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ + cache_ptr->addend = ext_reloc.r_offset; + +#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ + reloc_processing(relent, reloc, symbols, abfd, section) + +static void reloc_processing (relent, reloc, symbols, abfd, section) + arelent * relent; + struct internal_reloc *reloc; + asymbol ** symbols; + bfd * abfd; + asection * section; +{ + relent->address = reloc->r_vaddr; + rtype2howto (relent, reloc); + + if (reloc->r_symndx > 0) + relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; + else + relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + + relent->addend = reloc->r_offset; + relent->address -= section->vma; +} + +static void +extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) + bfd *in_abfd; + struct bfd_link_info *link_info; + struct bfd_link_order *link_order; + arelent *reloc; + bfd_byte *data; + unsigned int *src_ptr; + unsigned int *dst_ptr; +{ + bfd_byte *d = data+*dst_ptr; + asection *input_section = link_order->u.indirect.section; + + switch (reloc->howto->type) + { + case R_H8500_IMM8: + bfd_put_8 (in_abfd, + bfd_coff_reloc16_get_value (reloc, link_info, input_section), + d); + (*dst_ptr) += 1; + (*src_ptr) += 1; + break; + + case R_H8500_HIGH8: + bfd_put_8 (in_abfd, + (bfd_coff_reloc16_get_value (reloc, link_info, input_section) + >> 16), + d); + (*dst_ptr) += 1; + (*src_ptr) += 1; + break; + + case R_H8500_IMM16: + bfd_put_16 (in_abfd, + bfd_coff_reloc16_get_value (reloc, link_info, input_section), + d); + (*dst_ptr) += 2; + (*src_ptr) += 2; + break; + + case R_H8500_LOW16: + bfd_put_16 (in_abfd, + bfd_coff_reloc16_get_value (reloc, link_info, input_section), + d); + + (*dst_ptr) += 2; + (*src_ptr) += 2; + break; + + case R_H8500_HIGH16: + bfd_put_16 (in_abfd, + (bfd_coff_reloc16_get_value (reloc, link_info, input_section) + >> 16), + d); + + (*dst_ptr) += 2; + (*src_ptr) += 2; + break; + + case R_H8500_IMM24: + { + int v = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + int o = bfd_get_32 (in_abfd, data+ *dst_ptr -1); + v = (v & 0x00ffffff) | (o & 0xff00000); + bfd_put_32 (in_abfd, (bfd_vma) v, data + *dst_ptr -1); + (*dst_ptr) += 3; + (*src_ptr) += 3;; + } + break; + case R_H8500_IMM32: + { + int v = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + bfd_put_32 (in_abfd, (bfd_vma) v, data + *dst_ptr); + (*dst_ptr) += 4; + (*src_ptr) += 4;; + } + break; + + case R_H8500_PCREL8: + { + bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + bfd_vma dot = link_order->offset + + *dst_ptr + + link_order->u.indirect.section->output_section->vma; + int gap = dst - dot - 1; /* -1 since were in the odd byte of the + word and the pc's been incremented. */ + + if (gap > 128 || gap < -128) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + bfd_put_8 (in_abfd, gap, data + *dst_ptr); + (*dst_ptr)++; + (*src_ptr)++; + break; + } + case R_H8500_PCREL16: + { + bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + bfd_vma dot = link_order->offset + + *dst_ptr + + link_order->u.indirect.section->output_section->vma; + int gap = dst - dot - 1; /* -1 since were in the odd byte of the + word and the pc's been incremented. */ + + if (gap > 32767 || gap < -32768) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + bfd_put_16 (in_abfd, (bfd_vma) gap, data + *dst_ptr); + (*dst_ptr) += 2; + (*src_ptr) += 2; + break; + } + + default: + abort (); + } +} + +#define coff_reloc16_extra_cases extra_case + +#include "coffcode.h" + +#undef coff_bfd_get_relocated_section_contents +#undef coff_bfd_relax_section +#define coff_bfd_get_relocated_section_contents \ + bfd_coff_reloc16_get_relocated_section_contents +#define coff_bfd_relax_section bfd_coff_reloc16_relax_section + +CREATE_BIG_COFF_TARGET_VEC (h8500coff_vec, "coff-h8500", 0, 0, '_', NULL, COFF_SWAP_TABLE) diff --git a/bfd/coff-i860.c b/bfd/coff-i860.c new file mode 100644 index 0000000000000..edc9f4e6a2780 --- /dev/null +++ b/bfd/coff-i860.c @@ -0,0 +1,712 @@ +/* BFD back-end for Intel i860 COFF files. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Created mostly by substituting "860" for "386" in coff-i386.c + Harry Dolan , October 1995 + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#include "coff/i860.h" + +#include "coff/internal.h" + +#include "libcoff.h" + + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) +/* The page size is a guess based on ELF. */ + +#define COFF_PAGE_SIZE 0x1000 + +/* For some reason when using i860 COFF the value stored in the .text + section for a reference to a common symbol is the value itself plus + any desired offset. Ian Taylor, Cygnus Support. */ + +/* If we are producing relocatable output, we need to do some + adjustments to the object file that are not done by the + bfd_perform_relocation function. This function is called by every + reloc type to make any required adjustments. */ + +static bfd_reloc_status_type +coff_i860_reloc (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void *data, + asection *input_section ATTRIBUTE_UNUSED, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + symvalue diff; + + if (output_bfd == (bfd *) NULL) + return bfd_reloc_continue; + + if (bfd_is_com_section (symbol->section)) + { + /* We are relocating a common symbol. The current value in the + object file is ORIG + OFFSET, where ORIG is the value of the + common symbol as seen by the object file when it was compiled + (this may be zero if the symbol was undefined) and OFFSET is + the offset into the common symbol (normally zero, but may be + non-zero when referring to a field in a common structure). + ORIG is the negative of reloc_entry->addend, which is set by + the CALC_ADDEND macro below. We want to replace the value in + the object file with NEW + OFFSET, where NEW is the value of + the common symbol which we are going to put in the final + object file. NEW is symbol->value. */ + diff = symbol->value + reloc_entry->addend; + } + else + { + /* For some reason bfd_perform_relocation always effectively + ignores the addend for a COFF target when producing + relocatable output. This seems to be always wrong for 860 + COFF, so we handle the addend here instead. */ + diff = reloc_entry->addend; + } + +#define DOIT(x) \ + x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask)) + + if (diff != 0) + { + reloc_howto_type *howto = reloc_entry->howto; + unsigned char *addr = (unsigned char *) data + reloc_entry->address; + + switch (howto->size) + { + case 0: + { + char x = bfd_get_8 (abfd, addr); + DOIT (x); + bfd_put_8 (abfd, x, addr); + } + break; + + case 1: + { + short x = bfd_get_16 (abfd, addr); + DOIT (x); + bfd_put_16 (abfd, (bfd_vma) x, addr); + } + break; + + case 2: + { + long x = bfd_get_32 (abfd, addr); + DOIT (x); + bfd_put_32 (abfd, (bfd_vma) x, addr); + } + break; + + default: + abort (); + } + } + + /* Now let bfd_perform_relocation finish everything up. */ + return bfd_reloc_continue; +} + +/* This is just a temporary measure until we teach bfd to generate + these relocations. */ + +static bfd_reloc_status_type +coff_i860_reloc_nyi (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry, + asymbol *symbol ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED, + asection *input_section ATTRIBUTE_UNUSED, + bfd *output_bfd ATTRIBUTE_UNUSED, + char **error_message ATTRIBUTE_UNUSED) +{ + reloc_howto_type *howto = reloc_entry->howto; + fprintf (stderr, _("Relocation `%s' not yet implemented\n"), howto->name); + return bfd_reloc_notsupported; +} + +#ifndef PCRELOFFSET +#define PCRELOFFSET FALSE +#endif + +static reloc_howto_type howto_table[] = +{ + EMPTY_HOWTO (0), + EMPTY_HOWTO (1), + EMPTY_HOWTO (2), + EMPTY_HOWTO (3), + EMPTY_HOWTO (4), + EMPTY_HOWTO (5), + HOWTO (R_DIR32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "dir32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + /* {7}, */ + HOWTO (R_IMAGEBASE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "rva32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + EMPTY_HOWTO (010), + EMPTY_HOWTO (011), + EMPTY_HOWTO (012), + EMPTY_HOWTO (013), + EMPTY_HOWTO (014), + EMPTY_HOWTO (015), + EMPTY_HOWTO (016), + HOWTO (R_RELBYTE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "8", /* name */ + TRUE, /* partial_inplace */ + 0x000000ff, /* src_mask */ + 0x000000ff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + HOWTO (R_RELWORD, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + HOWTO (R_RELLONG, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + HOWTO (R_PCRBYTE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "DISP8", /* name */ + TRUE, /* partial_inplace */ + 0x000000ff, /* src_mask */ + 0x000000ff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + HOWTO (R_PCRWORD, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "DISP16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + HOWTO (R_PCRLONG, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "DISP32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + PCRELOFFSET), /* pcrel_offset */ + EMPTY_HOWTO (0x15), + EMPTY_HOWTO (0x16), + EMPTY_HOWTO (0x17), + EMPTY_HOWTO (0x18), + EMPTY_HOWTO (0x19), + EMPTY_HOWTO (0x1a), + EMPTY_HOWTO (0x1b), + HOWTO (COFF860_R_PAIR, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + coff_i860_reloc_nyi, /* special_function */ + "PAIR", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + EMPTY_HOWTO (0x1d), + HOWTO (COFF860_R_HIGH, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "HIGH", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + HOWTO (COFF860_R_LOW0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "LOW0", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + HOWTO (COFF860_R_LOW1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "LOW1", /* name */ + FALSE, /* partial_inplace */ + 0xfffe, /* src_mask */ + 0xfffe, /* dst_mask */ + FALSE), /* pcrel_offset */ + HOWTO (COFF860_R_LOW2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "LOW2", /* name */ + FALSE, /* partial_inplace */ + 0xfffc, /* src_mask */ + 0xfffc, /* dst_mask */ + FALSE), /* pcrel_offset */ + HOWTO (COFF860_R_LOW3, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "LOW3", /* name */ + FALSE, /* partial_inplace */ + 0xfff8, /* src_mask */ + 0xfff8, /* dst_mask */ + FALSE), /* pcrel_offset */ + HOWTO (COFF860_R_LOW4, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + coff_i860_reloc, /* special_function */ + "LOW4", /* name */ + FALSE, /* partial_inplace */ + 0xfff0, /* src_mask */ + 0xfff0, /* dst_mask */ + FALSE), /* pcrel_offset */ + HOWTO (COFF860_R_SPLIT0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + coff_i860_reloc_nyi, /* special_function */ + "SPLIT0", /* name */ + FALSE, /* partial_inplace */ + 0x1f07ff, /* src_mask */ + 0x1f07ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + HOWTO (COFF860_R_SPLIT1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + coff_i860_reloc_nyi, /* special_function */ + "SPLIT1", /* name */ + FALSE, /* partial_inplace */ + 0x1f07fe, /* src_mask */ + 0x1f07fe, /* dst_mask */ + FALSE), /* pcrel_offset */ + HOWTO (COFF860_R_SPLIT2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + coff_i860_reloc_nyi, /* special_function */ + "SPLIT2", /* name */ + FALSE, /* partial_inplace */ + 0x1f07fc, /* src_mask */ + 0x1f07fc, /* dst_mask */ + FALSE), /* pcrel_offset */ + HOWTO (COFF860_R_HIGHADJ, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + coff_i860_reloc_nyi, /* special_function */ + "HIGHADJ", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + HOWTO (COFF860_R_BRADDR, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_i860_reloc_nyi, /* special_function */ + "BRADDR", /* name */ + FALSE, /* partial_inplace */ + 0x3ffffff, /* src_mask */ + 0x3ffffff, /* dst_mask */ + TRUE) /* pcrel_offset */ +}; + +/* Turn a howto into a reloc number. */ + +#define SELECT_RELOC(x,howto) { x.r_type = howto->type; } +#define BADMAG(x) I860BADMAG(x) +#define I860 1 /* Customize coffcode.h */ + +#define RTYPE2HOWTO(cache_ptr, dst) \ + ((cache_ptr)->howto = \ + ((dst)->r_type < sizeof (howto_table) / sizeof (howto_table[0]) \ + ? howto_table + (dst)->r_type \ + : NULL)) + +/* For 860 COFF a STYP_NOLOAD | STYP_BSS section is part of a shared + library. On some other COFF targets STYP_BSS is normally + STYP_NOLOAD. */ +#define BSS_NOLOAD_IS_SHARED_LIBRARY + +/* Compute the addend of a reloc. If the reloc is to a common symbol, + the object file contains the value of the common symbol. By the + time this is called, the linker may be using a different symbol + from a different object file with a different value. Therefore, we + hack wildly to locate the original symbol from this file so that we + can make the correct adjustment. This macro sets coffsym to the + symbol from the original file, and uses it to set the addend value + correctly. If this is not a common symbol, the usual addend + calculation is done, except that an additional tweak is needed for + PC relative relocs. + FIXME: This macro refers to symbols and asect; these are from the + calling function, not the macro arguments. */ + +/* FIXME: This was copied from the i386 version originally but + appears to be wrong for i860. For now we'll do nothing. */ +#if 0 +#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ + { \ + coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ + if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ + coffsym = (obj_symbols (abfd) \ + + (cache_ptr->sym_ptr_ptr - symbols)); \ + else if (ptr) \ + coffsym = coff_symbol_from (abfd, ptr); \ + if (coffsym != (coff_symbol_type *) NULL \ + && coffsym->native->u.syment.n_scnum == 0) \ + cache_ptr->addend = - coffsym->native->u.syment.n_value; \ + else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ + && ptr->section != (asection *) NULL) \ + cache_ptr->addend = - (ptr->section->vma + ptr->value); \ + else \ + cache_ptr->addend = 0; \ + if (ptr && howto_table[reloc.r_type].pc_relative) \ + cache_ptr->addend += asect->vma; \ + } +#else +#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) +#endif + +/* We use the special COFF backend linker. */ +#define coff_relocate_section _bfd_coff_generic_relocate_section + +static reloc_howto_type * +coff_i860_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec, + struct internal_reloc *rel, + struct coff_link_hash_entry *h, + struct internal_syment *sym, + bfd_vma *addendp) +{ + + reloc_howto_type *howto; + + if (rel->r_type > sizeof (howto_table) / sizeof (howto_table[0])) + { + bfd_set_error (bfd_error_bad_value); + return NULL; + } + + howto = howto_table + rel->r_type; + + if (howto->pc_relative) + *addendp += sec->vma; + + if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0) + { + /* This is a common symbol. The section contents include the + size (sym->n_value) as an addend. The relocate_section + function will be adding in the final value of the symbol. We + need to subtract out the current size in order to get the + correct result. */ + + BFD_ASSERT (h != NULL); + + /* I think we *do* want to bypass this. If we don't, I have seen some data + parameters get the wrong relocation address. If I link two versions + with and without this section bypassed and then do a binary comparison, + the addresses which are different can be looked up in the map. The + case in which this section has been bypassed has addresses which correspond + to values I can find in the map. */ + *addendp -= sym->n_value; + } + + /* If the output symbol is common (in which case this must be a + relocatable link), we need to add in the final size of the + common symbol. */ + if (h != NULL && h->root.type == bfd_link_hash_common) + *addendp += h->root.u.c.size; + + return howto; +} + +static reloc_howto_type * +coff_i860_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + switch (code) + { + case BFD_RELOC_32: + return howto_table + R_DIR32; + case BFD_RELOC_860_PC26: + return howto_table + COFF860_R_BRADDR; + case BFD_RELOC_860_PC16: + /* ??? How to handle PC16 for COFF? SPLIT0 is close for now. */ + return howto_table + COFF860_R_SPLIT0; + case BFD_RELOC_860_LOW0: + return howto_table + COFF860_R_LOW0; + case BFD_RELOC_860_SPLIT0: + return howto_table + COFF860_R_SPLIT0; + case BFD_RELOC_860_LOW1: + return howto_table + COFF860_R_LOW1; + case BFD_RELOC_860_SPLIT1: + return howto_table + COFF860_R_SPLIT1; + case BFD_RELOC_860_LOW2: + return howto_table + COFF860_R_LOW2; + case BFD_RELOC_860_SPLIT2: + return howto_table + COFF860_R_SPLIT2; + case BFD_RELOC_860_LOW3: + return howto_table + COFF860_R_LOW3; + case BFD_RELOC_860_HIGHADJ: + return howto_table + COFF860_R_HIGHADJ; + case BFD_RELOC_860_HIGH: + return howto_table + COFF860_R_HIGH; + default: + BFD_FAIL (); + return 0; + } +} + +/* This is called from coff_slurp_reloc_table for each relocation + entry. This special handling is due to the `PAIR' relocation + which has a different meaning for the `r_symndx' field. */ + +static void +i860_reloc_processing (arelent *cache_ptr, struct internal_reloc *dst, + asymbol **symbols, bfd *abfd, asection *asect) +{ + if (dst->r_type == COFF860_R_PAIR) + { + /* Handle the PAIR relocation specially. */ + cache_ptr->howto = howto_table + dst->r_type; + cache_ptr->address = dst->r_vaddr; + cache_ptr->addend = dst->r_symndx; + cache_ptr->sym_ptr_ptr= bfd_abs_section_ptr->symbol_ptr_ptr; + } + else + { + /* For every other relocation, do exactly what coff_slurp_reloc_table + would do (which this code is taken directly from). */ + asymbol *ptr = NULL; + cache_ptr->address = dst->r_vaddr; + + if (dst->r_symndx != -1) + { + if (dst->r_symndx < 0 || dst->r_symndx >= obj_conv_table_size (abfd)) + { + (*_bfd_error_handler) + (_("%s: warning: illegal symbol index %ld in relocs"), + bfd_archive_filename (abfd), dst->r_symndx); + cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + ptr = NULL; + } + else + { + cache_ptr->sym_ptr_ptr = (symbols + + obj_convert (abfd)[dst->r_symndx]); + ptr = *(cache_ptr->sym_ptr_ptr); + } + } + else + { + cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + ptr = NULL; + } + + /* The symbols definitions that we have read in have been + relocated as if their sections started at 0. But the offsets + refering to the symbols in the raw data have not been + modified, so we have to have a negative addend to compensate. + + Note that symbols which used to be common must be left alone. */ + + /* Calculate any reloc addend by looking at the symbol. */ + CALC_ADDEND (abfd, ptr, (*dst), cache_ptr); + + cache_ptr->address -= asect->vma; + + /* Fill in the cache_ptr->howto field from dst->r_type. */ + RTYPE2HOWTO (cache_ptr, dst); + } +} + +#define coff_rtype_to_howto coff_i860_rtype_to_howto +#define coff_bfd_reloc_type_lookup coff_i860_reloc_type_lookup + +#define RELOC_PROCESSING(relent, reloc, symbols, abfd, section) \ + i860_reloc_processing (relent, reloc, symbols, abfd, section) + +#include "coffcode.h" + +static const bfd_target * +i3coff_object_p(bfd *a) +{ + return coff_object_p (a); +} + +const bfd_target +#ifdef TARGET_SYM + TARGET_SYM = +#else + i860coff_vec = +#endif +{ +#ifdef TARGET_NAME + TARGET_NAME, +#else + "coff-i860", /* name */ +#endif + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_LITTLE, /* header byte order is little */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + '_', /* leading underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ + +/* Note that we allow an object file to be treated as a core file as well. */ + {_bfd_dummy_target, i3coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, i3coff_object_p}, + {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ + bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (coff), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + COFF_SWAP_TABLE +}; diff --git a/bfd/coff-i960.c b/bfd/coff-i960.c new file mode 100644 index 0000000000000..3a04753dcd446 --- /dev/null +++ b/bfd/coff-i960.c @@ -0,0 +1,665 @@ +/* BFD back-end for Intel 960 COFF files. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, + 2002, 2003 Free Software Foundation, Inc. + Written by Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define I960 1 +#define BADMAG(x) I960BADMAG(x) + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "coff/i960.h" +#include "coff/internal.h" +#include "libcoff.h" /* to allow easier abstraction-breaking */ + +static bfd_boolean coff_i960_is_local_label_name + PARAMS ((bfd *, const char *)); +static bfd_reloc_status_type optcall_callback + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type coff_i960_relocate + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static reloc_howto_type *coff_i960_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static bfd_boolean coff_i960_start_final_link + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean coff_i960_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **)); +static bfd_boolean coff_i960_adjust_symndx + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, + struct internal_reloc *, bfd_boolean *)); + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) +#define COFF_ALIGN_IN_SECTION_HEADER 1 + +#define GET_SCNHDR_ALIGN H_GET_32 +#define PUT_SCNHDR_ALIGN H_PUT_32 + +/* The i960 does not support an MMU, so COFF_PAGE_SIZE can be + arbitrarily small. */ +#define COFF_PAGE_SIZE 1 + +#define COFF_LONG_FILENAMES + +/* This set of local label names is taken from gas. */ + +static bfd_boolean +coff_i960_is_local_label_name (abfd, name) + bfd *abfd ATTRIBUTE_UNUSED; + const char *name; +{ + return (name[0] == 'L' + || (name[0] == '.' + && (name[1] == 'C' + || name[1] == 'I' + || name[1] == '.'))); +} + +/* This is just like the usual CALC_ADDEND, but it includes the + section VMA for PC relative relocs. */ +#ifndef CALC_ADDEND +#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ + { \ + coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ + if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ + coffsym = (obj_symbols (abfd) \ + + (cache_ptr->sym_ptr_ptr - symbols)); \ + else if (ptr) \ + coffsym = coff_symbol_from (abfd, ptr); \ + if (coffsym != (coff_symbol_type *) NULL \ + && coffsym->native->u.syment.n_scnum == 0) \ + cache_ptr->addend = 0; \ + else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ + && ptr->section != (asection *) NULL) \ + cache_ptr->addend = - (ptr->section->vma + ptr->value); \ + else \ + cache_ptr->addend = 0; \ + if (ptr && (reloc.r_type == 25 || reloc.r_type == 27)) \ + cache_ptr->addend += asect->vma; \ + } +#endif + +#define CALLS 0x66003800 /* Template for 'calls' instruction */ +#define BAL 0x0b000000 /* Template for 'bal' instruction */ +#define BAL_MASK 0x00ffffff + +static bfd_reloc_status_type +optcall_callback (abfd, reloc_entry, symbol_in, data, + input_section, ignore_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol_in; + PTR data; + asection *input_section; + bfd *ignore_bfd ATTRIBUTE_UNUSED; + char **error_message; +{ + /* This item has already been relocated correctly, but we may be + * able to patch in yet better code - done by digging out the + * correct info on this symbol */ + bfd_reloc_status_type result; + coff_symbol_type *cs = coffsymbol(symbol_in); + + /* Don't do anything with symbols which aren't tied up yet, + except move the reloc. */ + if (bfd_is_und_section (cs->symbol.section)) { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* So the target symbol has to be of coff type, and the symbol + has to have the correct native information within it */ + if ((bfd_asymbol_flavour(&cs->symbol) != bfd_target_coff_flavour) + || (cs->native == (combined_entry_type *)NULL)) + { + /* This is interesting, consider the case where we're outputting coff + from a mix n match input, linking from coff to a symbol defined in a + bout file will cause this match to be true. Should I complain? This + will only work if the bout symbol is non leaf. */ + *error_message = + (char *) _("uncertain calling convention for non-COFF symbol"); + result = bfd_reloc_dangerous; + } + else + { + switch (cs->native->u.syment.n_sclass) + { + case C_LEAFSTAT: + case C_LEAFEXT: + /* This is a call to a leaf procedure, replace instruction with a bal + to the correct location. */ + { + union internal_auxent *aux = &((cs->native+2)->u.auxent); + int word = bfd_get_32 (abfd, (bfd_byte *)data + reloc_entry->address); + int olf = (aux->x_bal.x_balntry - cs->native->u.syment.n_value); + BFD_ASSERT(cs->native->u.syment.n_numaux==2); + + /* We replace the original call instruction with a bal to + the bal entry point - the offset of which is described in + the 2nd auxent of the original symbol. We keep the native + sym and auxents untouched, so the delta between the two + is the offset of the bal entry point. */ + word = ((word + olf) & BAL_MASK) | BAL; + bfd_put_32 (abfd, (bfd_vma) word, + (bfd_byte *) data + reloc_entry->address); + } + result = bfd_reloc_ok; + break; + case C_SCALL: + /* This is a call to a system call, replace with a calls to # */ + BFD_ASSERT(0); + result = bfd_reloc_ok; + break; + default: + result = bfd_reloc_ok; + break; + } + } + return result; +} + +/* i960 COFF is used by VxWorks 5.1. However, VxWorks 5.1 does not + appear to correctly handle a reloc against a symbol defined in the + same object file. It appears to simply discard such relocs, rather + than adding their values into the object file. We handle this here + by converting all relocs against defined symbols into relocs + against the section symbol, when generating a relocatable output + file. + + Note that this function is only called if we are not using the COFF + specific backend linker. It only does something when doing a + relocatable link, which will almost certainly fail when not + generating COFF i960 output, so this function is actually no longer + useful. It was used before this target was converted to use the + COFF specific backend linker. */ + +static bfd_reloc_status_type +coff_i960_relocate (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data ATTRIBUTE_UNUSED; + asection *input_section ATTRIBUTE_UNUSED; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + asection *osec; + + if (output_bfd == NULL) + { + /* Not generating relocatable output file. */ + return bfd_reloc_continue; + } + + if (bfd_is_und_section (bfd_get_section (symbol))) + { + /* Symbol is not defined, so no need to worry about it. */ + return bfd_reloc_continue; + } + + if (bfd_is_com_section (bfd_get_section (symbol))) + { + /* I don't really know what the right action is for a common + symbol. */ + return bfd_reloc_continue; + } + + /* Convert the reloc to use the section symbol. FIXME: This method + is ridiculous. */ + osec = bfd_get_section (symbol)->output_section; + if (coff_section_data (output_bfd, osec) != NULL + && coff_section_data (output_bfd, osec)->tdata != NULL) + reloc_entry->sym_ptr_ptr = + (asymbol **) coff_section_data (output_bfd, osec)->tdata; + else + { + const char *sec_name; + asymbol **syms, **sym_end; + + sec_name = bfd_get_section_name (output_bfd, osec); + syms = bfd_get_outsymbols (output_bfd); + sym_end = syms + bfd_get_symcount (output_bfd); + for (; syms < sym_end; syms++) + { + if (bfd_asymbol_name (*syms) != NULL + && (*syms)->value == 0 + && strcmp ((*syms)->section->output_section->name, + sec_name) == 0) + break; + } + + if (syms >= sym_end) + abort (); + + reloc_entry->sym_ptr_ptr = syms; + + if (coff_section_data (output_bfd, osec) == NULL) + { + bfd_size_type amt = sizeof (struct coff_section_tdata); + osec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); + if (osec->used_by_bfd == NULL) + return bfd_reloc_overflow; + } + coff_section_data (output_bfd, osec)->tdata = (PTR) syms; + } + + /* Let bfd_perform_relocation do its thing, which will include + stuffing the symbol addend into the object file. */ + return bfd_reloc_continue; +} + +static reloc_howto_type howto_rellong = + HOWTO ((unsigned int) R_RELLONG, 0, 2, 32,FALSE, 0, + complain_overflow_bitfield, coff_i960_relocate,"rellong", TRUE, + 0xffffffff, 0xffffffff, 0); +static reloc_howto_type howto_iprmed = + HOWTO (R_IPRMED, 0, 2, 24,TRUE,0, complain_overflow_signed, + coff_i960_relocate, "iprmed ", TRUE, 0x00ffffff, 0x00ffffff, 0); +static reloc_howto_type howto_optcall = + HOWTO (R_OPTCALL, 0,2,24,TRUE,0, complain_overflow_signed, + optcall_callback, "optcall", TRUE, 0x00ffffff, 0x00ffffff, 0); + +static reloc_howto_type * +coff_i960_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + switch (code) + { + default: + return 0; + case BFD_RELOC_I960_CALLJ: + return &howto_optcall; + case BFD_RELOC_32: + case BFD_RELOC_CTOR: + return &howto_rellong; + case BFD_RELOC_24_PCREL: + return &howto_iprmed; + } +} + +/* The real code is in coffcode.h */ + +#define RTYPE2HOWTO(cache_ptr, dst) \ +{ \ + reloc_howto_type *howto_ptr; \ + switch ((dst)->r_type) { \ + case 17: howto_ptr = &howto_rellong; break; \ + case 25: howto_ptr = &howto_iprmed; break; \ + case 27: howto_ptr = &howto_optcall; break; \ + default: howto_ptr = 0; break; \ + } \ + (cache_ptr)->howto = howto_ptr; \ + } + +/* i960 COFF is used by VxWorks 5.1. However, VxWorks 5.1 does not + appear to correctly handle a reloc against a symbol defined in the + same object file. It appears to simply discard such relocs, rather + than adding their values into the object file. We handle this by + converting all relocs against global symbols into relocs against + internal symbols at the start of the section. This routine is + called at the start of the linking process, and it creates the + necessary symbols. */ + +static bfd_boolean +coff_i960_start_final_link (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + bfd_size_type symesz = bfd_coff_symesz (abfd); + asection *o; + bfd_byte *esym; + + if (! info->relocatable) + return TRUE; + + esym = (bfd_byte *) bfd_malloc (symesz); + if (esym == NULL) + return FALSE; + + if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0) + return FALSE; + + for (o = abfd->sections; o != NULL; o = o->next) + { + struct internal_syment isym; + + strncpy (isym._n._n_name, o->name, SYMNMLEN); + isym.n_value = 0; + isym.n_scnum = o->target_index; + isym.n_type = T_NULL; + isym.n_sclass = C_STAT; + isym.n_numaux = 0; + + bfd_coff_swap_sym_out (abfd, (PTR) &isym, (PTR) esym); + + if (bfd_bwrite (esym, symesz, abfd) != symesz) + { + free (esym); + return FALSE; + } + + obj_raw_syment_count (abfd) += 1; + } + + free (esym); + + return TRUE; +} + +/* The reloc processing routine for the optimized COFF linker. */ + +static bfd_boolean +coff_i960_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, syms, sections) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + struct internal_reloc *relocs; + struct internal_syment *syms; + asection **sections; +{ + struct internal_reloc *rel; + struct internal_reloc *relend; + + rel = relocs; + relend = rel + input_section->reloc_count; + for (; rel < relend; rel++) + { + long symndx; + struct coff_link_hash_entry *h; + struct internal_syment *sym; + bfd_vma addend; + bfd_vma val; + reloc_howto_type *howto; + bfd_reloc_status_type rstat = bfd_reloc_ok; + bfd_boolean done; + + symndx = rel->r_symndx; + + if (symndx == -1) + { + h = NULL; + sym = NULL; + } + else + { + h = obj_coff_sym_hashes (input_bfd)[symndx]; + sym = syms + symndx; + } + + if (sym != NULL && sym->n_scnum != 0) + addend = - sym->n_value; + else + addend = 0; + + switch (rel->r_type) + { + case 17: howto = &howto_rellong; break; + case 25: howto = &howto_iprmed; break; + case 27: howto = &howto_optcall; break; + default: + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + val = 0; + + if (h == NULL) + { + asection *sec; + + if (symndx == -1) + { + sec = bfd_abs_section_ptr; + val = 0; + } + else + { + sec = sections[symndx]; + val = (sec->output_section->vma + + sec->output_offset + + sym->n_value + - sec->vma); + } + } + else + { + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + asection *sec; + + sec = h->root.u.def.section; + val = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else if (! info->relocatable) + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, input_section, + rel->r_vaddr - input_section->vma, TRUE))) + return FALSE; + } + } + + done = FALSE; + + if (howto->type == R_OPTCALL && ! info->relocatable && symndx != -1) + { + int class; + + if (h != NULL) + class = h->class; + else + class = sym->n_sclass; + + switch (class) + { + case C_NULL: + /* This symbol is apparently not from a COFF input file. + We warn, and then assume that it is not a leaf + function. */ + if (! ((*info->callbacks->reloc_dangerous) + (info, + _("uncertain calling convention for non-COFF symbol"), + input_bfd, input_section, + rel->r_vaddr - input_section->vma))) + return FALSE; + break; + case C_LEAFSTAT: + case C_LEAFEXT: + /* This is a call to a leaf procedure; use the bal + instruction. */ + { + long olf; + unsigned long word; + + if (h != NULL) + { + BFD_ASSERT (h->numaux == 2); + olf = h->aux[1].x_bal.x_balntry; + } + else + { + bfd_byte *esyms; + union internal_auxent aux; + + BFD_ASSERT (sym->n_numaux == 2); + esyms = (bfd_byte *) obj_coff_external_syms (input_bfd); + esyms += (symndx + 2) * bfd_coff_symesz (input_bfd); + bfd_coff_swap_aux_in (input_bfd, (PTR) esyms, sym->n_type, + sym->n_sclass, 1, sym->n_numaux, + (PTR) &aux); + olf = aux.x_bal.x_balntry; + } + + word = bfd_get_32 (input_bfd, + (contents + + (rel->r_vaddr - input_section->vma))); + word = ((word + olf - val) & BAL_MASK) | BAL; + bfd_put_32 (input_bfd, + (bfd_vma) word, + contents + (rel->r_vaddr - input_section->vma)); + done = TRUE; + } + break; + case C_SCALL: + BFD_ASSERT (0); + break; + } + } + + if (! done) + { + if (howto->pc_relative) + addend += input_section->vma; + rstat = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, + rel->r_vaddr - input_section->vma, + val, addend); + } + + switch (rstat) + { + default: + abort (); + case bfd_reloc_ok: + break; + case bfd_reloc_overflow: + { + const char *name; + char buf[SYMNMLEN + 1]; + + if (symndx == -1) + name = "*ABS*"; + else if (h != NULL) + name = h->root.root.string; + else + { + name = _bfd_coff_internal_syment_name (input_bfd, sym, buf); + if (name == NULL) + return FALSE; + } + + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, input_bfd, + input_section, rel->r_vaddr - input_section->vma))) + return FALSE; + } + } + } + + return TRUE; +} + +/* Adjust the symbol index of any reloc against a global symbol to + instead be a reloc against the internal symbol we created specially + for the section. */ + +static bfd_boolean +coff_i960_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) + bfd *obfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + bfd *ibfd; + asection *sec ATTRIBUTE_UNUSED; + struct internal_reloc *irel; + bfd_boolean *adjustedp; +{ + struct coff_link_hash_entry *h; + + *adjustedp = FALSE; + + h = obj_coff_sym_hashes (ibfd)[irel->r_symndx]; + if (h == NULL + || (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak)) + return TRUE; + + irel->r_symndx = h->root.u.def.section->output_section->target_index - 1; + *adjustedp = TRUE; + + return TRUE; +} + +#define coff_bfd_is_local_label_name coff_i960_is_local_label_name + +#define coff_start_final_link coff_i960_start_final_link + +#define coff_relocate_section coff_i960_relocate_section + +#define coff_adjust_symndx coff_i960_adjust_symndx + +#define coff_bfd_reloc_type_lookup coff_i960_reloc_type_lookup + +#include "coffcode.h" + +extern const bfd_target icoff_big_vec; + +CREATE_LITTLE_COFF_TARGET_VEC (icoff_little_vec, "coff-Intel-little", 0, 0, '_', & icoff_big_vec, COFF_SWAP_TABLE) + +const bfd_target icoff_big_vec = +{ + "coff-Intel-big", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_BIG, /* header byte order is big */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + '_', /* leading underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + +bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ +bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {bfd_false, coff_mkobject, /* bfd_set_format */ + _bfd_generic_mkarchive, bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (coff), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & icoff_little_vec, + + COFF_SWAP_TABLE +}; diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c new file mode 100644 index 0000000000000..0947811687a9a --- /dev/null +++ b/bfd/coff-m68k.c @@ -0,0 +1,538 @@ +/* BFD back-end for Motorola 68000 COFF binaries. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, + 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Written by Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "coff/m68k.h" +#include "coff/internal.h" +#include "libcoff.h" + +/* This source file is compiled multiple times for various m68k COFF + variants. The following macros control its behaviour: + + TARGET_SYM + The C name of the BFD target vector. The default is m68kcoff_vec. + TARGET_NAME + The user visible target name. The default is "coff-m68k". + NAMES_HAVE_UNDERSCORE + Whether symbol names have an underscore. + ONLY_DECLARE_RELOCS + Only declare the relocation howto array. Don't actually compile + it. The actual array will be picked up in another version of the + file. + STATIC_RELOCS + Make the relocation howto array, and associated functions, static. + COFF_COMMON_ADDEND + If this is defined, then, for a relocation against a common + symbol, the object file holds the value (the size) of the common + symbol. If this is not defined, then, for a relocation against a + common symbol, the object file holds zero. */ + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) + +#ifndef COFF_PAGE_SIZE +/* The page size is a guess based on ELF. */ +#define COFF_PAGE_SIZE 0x2000 +#endif + +#ifndef COFF_COMMON_ADDEND +#define RELOC_SPECIAL_FN 0 +#else +static bfd_reloc_status_type m68kcoff_common_addend_special_fn + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static reloc_howto_type *m68kcoff_common_addend_rtype_to_howto + PARAMS ((bfd *, asection *, struct internal_reloc *, + struct coff_link_hash_entry *, struct internal_syment *, + bfd_vma *)); +#define RELOC_SPECIAL_FN m68kcoff_common_addend_special_fn +#endif + +static bfd_boolean m68k_coff_is_local_label_name + PARAMS ((bfd *, const char *)); + +/* On the delta, a symbol starting with L% is local. We won't see + such a symbol on other platforms, so it should be safe to always + consider it local here. */ + +static bfd_boolean +m68k_coff_is_local_label_name (abfd, name) + bfd *abfd; + const char *name; +{ + if (name[0] == 'L' && name[1] == '%') + return TRUE; + + return _bfd_coff_is_local_label_name (abfd, name); +} + +#ifndef STATIC_RELOCS +/* Clean up namespace. */ +#define m68kcoff_howto_table _bfd_m68kcoff_howto_table +#define m68k_rtype2howto _bfd_m68kcoff_rtype2howto +#define m68k_howto2rtype _bfd_m68kcoff_howto2rtype +#define m68k_reloc_type_lookup _bfd_m68kcoff_reloc_type_lookup +#endif + +#ifdef ONLY_DECLARE_RELOCS +extern reloc_howto_type m68kcoff_howto_table[]; +#else +#ifdef STATIC_RELOCS +static +#endif +reloc_howto_type m68kcoff_howto_table[] = + { + HOWTO (R_RELBYTE, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "8", TRUE, 0x000000ff,0x000000ff, FALSE), + HOWTO (R_RELWORD, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "16", TRUE, 0x0000ffff,0x0000ffff, FALSE), + HOWTO (R_RELLONG, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "32", TRUE, 0xffffffff,0xffffffff, FALSE), + HOWTO (R_PCRBYTE, 0, 0, 8, TRUE, 0, complain_overflow_signed, RELOC_SPECIAL_FN, "DISP8", TRUE, 0x000000ff,0x000000ff, FALSE), + HOWTO (R_PCRWORD, 0, 1, 16, TRUE, 0, complain_overflow_signed, RELOC_SPECIAL_FN, "DISP16", TRUE, 0x0000ffff,0x0000ffff, FALSE), + HOWTO (R_PCRLONG, 0, 2, 32, TRUE, 0, complain_overflow_signed, RELOC_SPECIAL_FN, "DISP32", TRUE, 0xffffffff,0xffffffff, FALSE), + HOWTO (R_RELLONG_NEG, 0, -2, 32, FALSE, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "-32", TRUE, 0xffffffff,0xffffffff, FALSE), + }; +#endif /* not ONLY_DECLARE_RELOCS */ + +#ifndef BADMAG +#define BADMAG(x) M68KBADMAG(x) +#endif +#define M68 1 /* Customize coffcode.h */ + +/* Turn a howto into a reloc number */ + +#ifdef ONLY_DECLARE_RELOCS +extern void m68k_rtype2howto PARAMS ((arelent *internal, int relocentry)); +extern int m68k_howto2rtype PARAMS ((reloc_howto_type *)); +extern reloc_howto_type *m68k_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +#else + +#ifdef STATIC_RELOCS +#define STAT_REL static +#else +#define STAT_REL +#endif + +STAT_REL reloc_howto_type * m68k_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); +STAT_REL int m68k_howto2rtype PARAMS ((reloc_howto_type *)); +STAT_REL void m68k_rtype2howto PARAMS ((arelent *, int)); + + +STAT_REL void +m68k_rtype2howto(internal, relocentry) + arelent *internal; + int relocentry; +{ + switch (relocentry) + { + case R_RELBYTE: internal->howto = m68kcoff_howto_table + 0; break; + case R_RELWORD: internal->howto = m68kcoff_howto_table + 1; break; + case R_RELLONG: internal->howto = m68kcoff_howto_table + 2; break; + case R_PCRBYTE: internal->howto = m68kcoff_howto_table + 3; break; + case R_PCRWORD: internal->howto = m68kcoff_howto_table + 4; break; + case R_PCRLONG: internal->howto = m68kcoff_howto_table + 5; break; + case R_RELLONG_NEG: internal->howto = m68kcoff_howto_table + 6; break; + } +} + +STAT_REL int +m68k_howto2rtype (internal) + reloc_howto_type *internal; +{ + if (internal->pc_relative) + { + switch (internal->bitsize) + { + case 32: return R_PCRLONG; + case 16: return R_PCRWORD; + case 8: return R_PCRBYTE; + } + } + else + { + switch (internal->bitsize) + { + case 32: return R_RELLONG; + case 16: return R_RELWORD; + case 8: return R_RELBYTE; + } + } + return R_RELLONG; +} + +STAT_REL reloc_howto_type * +m68k_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + switch (code) + { + default: return NULL; + case BFD_RELOC_8: return m68kcoff_howto_table + 0; + case BFD_RELOC_16: return m68kcoff_howto_table + 1; + case BFD_RELOC_CTOR: + case BFD_RELOC_32: return m68kcoff_howto_table + 2; + case BFD_RELOC_8_PCREL: return m68kcoff_howto_table + 3; + case BFD_RELOC_16_PCREL: return m68kcoff_howto_table + 4; + case BFD_RELOC_32_PCREL: return m68kcoff_howto_table + 5; + /* FIXME: There doesn't seem to be a code for R_RELLONG_NEG. */ + } + /*NOTREACHED*/ +} + +#endif /* not ONLY_DECLARE_RELOCS */ + +#define RTYPE2HOWTO(internal, relocentry) \ + m68k_rtype2howto(internal, (relocentry)->r_type) + +#define SELECT_RELOC(external, internal) \ + external.r_type = m68k_howto2rtype (internal) + +#define coff_bfd_reloc_type_lookup m68k_reloc_type_lookup + +#ifndef COFF_COMMON_ADDEND +#ifndef coff_rtype_to_howto + +#define coff_rtype_to_howto m68kcoff_rtype_to_howto + +static reloc_howto_type *m68kcoff_rtype_to_howto + PARAMS ((bfd *, asection *, struct internal_reloc *, + struct coff_link_hash_entry *, struct internal_syment *, + bfd_vma *)); + +static reloc_howto_type * +m68kcoff_rtype_to_howto (abfd, sec, rel, h, sym, addendp) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + struct internal_reloc *rel; + struct coff_link_hash_entry *h ATTRIBUTE_UNUSED; + struct internal_syment *sym ATTRIBUTE_UNUSED; + bfd_vma *addendp; +{ + arelent relent; + reloc_howto_type *howto; + + RTYPE2HOWTO (&relent, rel); + + howto = relent.howto; + + if (howto->pc_relative) + *addendp += sec->vma; + + return howto; +} + +#endif /* ! defined (coff_rtype_to_howto) */ +#endif /* ! defined (COFF_COMMON_ADDEND) */ + +#ifdef COFF_COMMON_ADDEND + +/* If COFF_COMMON_ADDEND is defined, then when using m68k COFF the + value stored in the .text section for a reference to a common + symbol is the value itself plus any desired offset. (taken from + work done by Ian Taylor, Cygnus Support, for I386 COFF). */ + +/* If we are producing relocatable output, we need to do some + adjustments to the object file that are not done by the + bfd_perform_relocation function. This function is called by every + reloc type to make any required adjustments. */ + +static bfd_reloc_status_type +m68kcoff_common_addend_special_fn (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section ATTRIBUTE_UNUSED; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + symvalue diff; + + if (output_bfd == (bfd *) NULL) + return bfd_reloc_continue; + + if (bfd_is_com_section (symbol->section)) + { + /* We are relocating a common symbol. The current value in the + object file is ORIG + OFFSET, where ORIG is the value of the + common symbol as seen by the object file when it was compiled + (this may be zero if the symbol was undefined) and OFFSET is + the offset into the common symbol (normally zero, but may be + non-zero when referring to a field in a common structure). + ORIG is the negative of reloc_entry->addend, which is set by + the CALC_ADDEND macro below. We want to replace the value in + the object file with NEW + OFFSET, where NEW is the value of + the common symbol which we are going to put in the final + object file. NEW is symbol->value. */ + diff = symbol->value + reloc_entry->addend; + } + else + { + /* For some reason bfd_perform_relocation always effectively + ignores the addend for a COFF target when producing + relocatable output. This seems to be always wrong for 386 + COFF, so we handle the addend here instead. */ + diff = reloc_entry->addend; + } + +#define DOIT(x) \ + x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask)) + + if (diff != 0) + { + reloc_howto_type *howto = reloc_entry->howto; + unsigned char *addr = (unsigned char *) data + reloc_entry->address; + + switch (howto->size) + { + case 0: + { + char x = bfd_get_8 (abfd, addr); + DOIT (x); + bfd_put_8 (abfd, x, addr); + } + break; + + case 1: + { + short x = bfd_get_16 (abfd, addr); + DOIT (x); + bfd_put_16 (abfd, (bfd_vma) x, addr); + } + break; + + case 2: + { + long x = bfd_get_32 (abfd, addr); + DOIT (x); + bfd_put_32 (abfd, (bfd_vma) x, addr); + } + break; + + default: + abort (); + } + } + + /* Now let bfd_perform_relocation finish everything up. */ + return bfd_reloc_continue; +} + +/* Compute the addend of a reloc. If the reloc is to a common symbol, + the object file contains the value of the common symbol. By the + time this is called, the linker may be using a different symbol + from a different object file with a different value. Therefore, we + hack wildly to locate the original symbol from this file so that we + can make the correct adjustment. This macro sets coffsym to the + symbol from the original file, and uses it to set the addend value + correctly. If this is not a common symbol, the usual addend + calculation is done, except that an additional tweak is needed for + PC relative relocs. + FIXME: This macro refers to symbols and asect; these are from the + calling function, not the macro arguments. */ + +#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ + { \ + coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ + if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ + coffsym = (obj_symbols (abfd) \ + + (cache_ptr->sym_ptr_ptr - symbols)); \ + else if (ptr) \ + coffsym = coff_symbol_from (abfd, ptr); \ + if (coffsym != (coff_symbol_type *) NULL \ + && coffsym->native->u.syment.n_scnum == 0) \ + cache_ptr->addend = - coffsym->native->u.syment.n_value; \ + else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ + && ptr->section != (asection *) NULL) \ + cache_ptr->addend = - (ptr->section->vma + ptr->value); \ + else \ + cache_ptr->addend = 0; \ + if (ptr && (reloc.r_type == R_PCRBYTE \ + || reloc.r_type == R_PCRWORD \ + || reloc.r_type == R_PCRLONG)) \ + cache_ptr->addend += asect->vma; \ + } + +#ifndef coff_rtype_to_howto + +/* coff-m68k.c uses the special COFF backend linker. We need to + adjust common symbols. */ + +static reloc_howto_type * +m68kcoff_common_addend_rtype_to_howto (abfd, sec, rel, h, sym, addendp) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + struct internal_reloc *rel; + struct coff_link_hash_entry *h; + struct internal_syment *sym; + bfd_vma *addendp; +{ + arelent relent; + reloc_howto_type *howto; + + RTYPE2HOWTO (&relent, rel); + + howto = relent.howto; + + if (howto->pc_relative) + *addendp += sec->vma; + + if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0) + { + /* This is a common symbol. The section contents include the + size (sym->n_value) as an addend. The relocate_section + function will be adding in the final value of the symbol. We + need to subtract out the current size in order to get the + correct result. */ + BFD_ASSERT (h != NULL); + *addendp -= sym->n_value; + } + + /* If the output symbol is common (in which case this must be a + relocatable link), we need to add in the final size of the + common symbol. */ + if (h != NULL && h->root.type == bfd_link_hash_common) + *addendp += h->root.u.c.size; + + return howto; +} + +#define coff_rtype_to_howto m68kcoff_common_addend_rtype_to_howto + +#endif /* ! defined (coff_rtype_to_howto) */ + +#endif /* COFF_COMMON_ADDEND */ + +#if !defined ONLY_DECLARE_RELOCS && ! defined STATIC_RELOCS +/* Given a .data section and a .emreloc in-memory section, store + relocation information into the .emreloc section which can be + used at runtime to relocate the section. This is called by the + linker when the --embedded-relocs switch is used. This is called + after the add_symbols entry point has been called for all the + objects, and before the final_link entry point is called. */ + +bfd_boolean +bfd_m68k_coff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) + bfd *abfd; + struct bfd_link_info *info; + asection *datasec; + asection *relsec; + char **errmsg; +{ + char *extsyms; + bfd_size_type symesz; + struct internal_reloc *irel, *irelend; + bfd_byte *p; + bfd_size_type amt; + + BFD_ASSERT (! info->relocatable); + + *errmsg = NULL; + + if (datasec->reloc_count == 0) + return TRUE; + + extsyms = obj_coff_external_syms (abfd); + symesz = bfd_coff_symesz (abfd); + + irel = _bfd_coff_read_internal_relocs (abfd, datasec, TRUE, NULL, FALSE, + NULL); + irelend = irel + datasec->reloc_count; + + amt = (bfd_size_type) datasec->reloc_count * 12; + relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt); + if (relsec->contents == NULL) + return FALSE; + + p = relsec->contents; + + for (; irel < irelend; irel++, p += 12) + { + asection *targetsec; + + /* We are going to write a four byte longword into the runtime + reloc section. The longword will be the address in the data + section which must be relocated. It is followed by the name + of the target section NUL-padded or truncated to 8 + characters. */ + + /* We can only relocate absolute longword relocs at run time. */ + if (irel->r_type != R_RELLONG) + { + *errmsg = _("unsupported reloc type"); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + if (irel->r_symndx == -1) + targetsec = bfd_abs_section_ptr; + else + { + struct coff_link_hash_entry *h; + + h = obj_coff_sym_hashes (abfd)[irel->r_symndx]; + if (h == NULL) + { + struct internal_syment isym; + + bfd_coff_swap_sym_in (abfd, extsyms + symesz * irel->r_symndx, + &isym); + targetsec = coff_section_from_bfd_index (abfd, isym.n_scnum); + } + else if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + targetsec = h->root.u.def.section; + else + targetsec = NULL; + } + + bfd_put_32 (abfd, + (irel->r_vaddr - datasec->vma + datasec->output_offset), p); + memset (p + 4, 0, 8); + if (targetsec != NULL) + strncpy (p + 4, targetsec->output_section->name, 8); + } + + return TRUE; +} +#endif /* neither ONLY_DECLARE_RELOCS not STATIC_RELOCS */ + +#define coff_bfd_is_local_label_name m68k_coff_is_local_label_name + +#define coff_relocate_section _bfd_coff_generic_relocate_section + +#include "coffcode.h" + +#ifndef TARGET_SYM +#define TARGET_SYM m68kcoff_vec +#endif + +#ifndef TARGET_NAME +#define TARGET_NAME "coff-m68k" +#endif + +#ifdef NAMES_HAVE_UNDERSCORE +CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, D_PAGED, 0, '_', NULL, COFF_SWAP_TABLE) +#else +CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, D_PAGED, 0, 0, NULL, COFF_SWAP_TABLE) +#endif diff --git a/bfd/coff-m88k.c b/bfd/coff-m88k.c new file mode 100644 index 0000000000000..bef0eabef33c4 --- /dev/null +++ b/bfd/coff-m88k.c @@ -0,0 +1,291 @@ +/* BFD back-end for Motorola 88000 COFF "Binary Compatibility Standard" files. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, + 2001, 2002, 2003 + Free Software Foundation, Inc. + Written by Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define M88 1 /* Customize various include files */ +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "coff/m88k.h" +#include "coff/internal.h" +#include "libcoff.h" + +static bfd_boolean m88k_is_local_label_name PARAMS ((bfd *, const char *)); +static bfd_reloc_status_type m88k_special_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); +static void reloc_processing + PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) + +#define GET_SCNHDR_NRELOC H_GET_32 +#define GET_SCNHDR_NLNNO H_GET_32 + +/* On coff-m88k, local labels start with '@'. */ + +#define coff_bfd_is_local_label_name m88k_is_local_label_name + +static bfd_boolean +m88k_is_local_label_name (abfd, name) + bfd *abfd ATTRIBUTE_UNUSED; + const char *name; +{ + return name[0] == '@'; +} + +static bfd_reloc_status_type +m88k_special_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + reloc_howto_type *howto = reloc_entry->howto; + + switch (howto->type) + { + case R_HVRT16: + case R_LVRT16: + if (output_bfd != (bfd *) NULL) + { + /* This is a partial relocation, and we want to apply the + relocation to the reloc entry rather than the raw data. + Modify the reloc inplace to reflect what we now know. */ + + reloc_entry->address += input_section->output_offset; + } + else + { + bfd_vma output_base = 0; + bfd_vma addr = reloc_entry->address; + bfd_vma x = bfd_get_16 (abfd, (bfd_byte *) data + addr); + asection *reloc_target_output_section; + long relocation = 0; + + /* Work out which section the relocation is targeted at and the + initial relocation command value. */ + + /* Get symbol value. (Common symbols are special.) */ + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + reloc_target_output_section = symbol->section->output_section; + + /* Convert input-section-relative symbol value to absolute. */ + if (output_bfd) + output_base = 0; + else + output_base = reloc_target_output_section->vma; + + relocation += output_base + symbol->section->output_offset; + + /* Add in supplied addend. */ + relocation += ((reloc_entry->addend << howto->bitsize) + x); + + reloc_entry->addend = 0; + + relocation >>= (bfd_vma) howto->rightshift; + + /* Shift everything up to where it's going to be used */ + + relocation <<= (bfd_vma) howto->bitpos; + + if (relocation) + bfd_put_16 (abfd, (bfd_vma) relocation, + (unsigned char *) data + addr); + } + + /* If we are not producing relocatable output, return an error if + the symbol is not defined. */ + if (bfd_is_und_section (symbol->section) && output_bfd == (bfd *) NULL) + return bfd_reloc_undefined; + + return bfd_reloc_ok; + + default: + if (output_bfd != (bfd *) NULL) + { + /* This is a partial relocation, and we want to apply the + relocation to the reloc entry rather than the raw data. + Modify the reloc inplace to reflect what we now know. */ + + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + break; + } + + if (output_bfd == (bfd *) NULL) + return bfd_reloc_continue; + + return bfd_reloc_ok; +} + +static reloc_howto_type howto_table[] = +{ + HOWTO (R_PCR16L, /* type */ + 02, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + m88k_special_reloc, /* special_function */ + "PCR16L", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_PCR26L, /* type */ + 02, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + m88k_special_reloc, /* special_function */ + "PCR26L", /* name */ + FALSE, /* partial_inplace */ + 0x03ffffff, /* src_mask */ + 0x03ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_VRT16, /* type */ + 00, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + m88k_special_reloc, /* special_function */ + "VRT16", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_HVRT16, /* type */ + 16, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m88k_special_reloc, /* special_function */ + "HVRT16", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_LVRT16, /* type */ + 00, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m88k_special_reloc, /* special_function */ + "LVRT16", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_VRT32, /* type */ + 00, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + m88k_special_reloc, /* special_function */ + "VRT32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ +}; + +/* Code to turn an external r_type into a pointer to an entry in the + above howto table. */ +static void +rtype2howto (cache_ptr, dst) + arelent *cache_ptr; + struct internal_reloc *dst; +{ + if (dst->r_type >= R_PCR16L && dst->r_type <= R_VRT32) + { + cache_ptr->howto = howto_table + dst->r_type - R_PCR16L; + } + else + { + BFD_ASSERT (0); + } +} + +#define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst) + +/* Code to swap in the reloc offset */ +#define SWAP_IN_RELOC_OFFSET H_GET_16 +#define SWAP_OUT_RELOC_OFFSET H_PUT_16 + +#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ + reloc_processing(relent, reloc, symbols, abfd, section) + +static void +reloc_processing (relent, reloc, symbols, abfd, section) + arelent *relent; + struct internal_reloc *reloc; + asymbol **symbols; + bfd *abfd; + asection *section; +{ + relent->address = reloc->r_vaddr; + rtype2howto (relent, reloc); + + if (((int) reloc->r_symndx) > 0) + { + relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; + } + else + { + relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + } + + relent->addend = reloc->r_offset; + relent->address -= section->vma; +} + +#define BADMAG(x) MC88BADMAG(x) +#include "coffcode.h" + +#undef coff_write_armap + +CREATE_BIG_COFF_TARGET_VEC (m88kbcs_vec, "coff-m88kbcs", 0, 0, '_', NULL, COFF_SWAP_TABLE) diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c new file mode 100644 index 0000000000000..25569e3f24902 --- /dev/null +++ b/bfd/coff-mcore.c @@ -0,0 +1,599 @@ +/* BFD back-end for Motorola MCore COFF/PE + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "coff/mcore.h" +#include "coff/internal.h" +#include "coff/pe.h" +#include "libcoff.h" + +#ifdef BADMAG +#undef BADMAG +#endif +#define BADMAG(x) MCOREBADMAG(x) + +#ifndef NUM_ELEM +#define NUM_ELEM(A) (sizeof (A) / sizeof (A)[0]) +#endif + +/* This file is compiled more than once, but we only compile the + final_link routine once. */ +extern bfd_boolean mcore_bfd_coff_final_link + PARAMS ((bfd *, struct bfd_link_info *)); +#if 0 +static struct bfd_link_hash_table *coff_mcore_link_hash_table_create + PARAMS ((bfd *)); +#endif +static bfd_reloc_status_type mcore_coff_unsupported_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_boolean coff_mcore_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **)); +static reloc_howto_type *mcore_coff_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static reloc_howto_type *coff_mcore_rtype_to_howto + PARAMS ((bfd *, asection *, struct internal_reloc *, + struct coff_link_hash_entry *, struct internal_syment *, + bfd_vma *)); +static void mcore_emit_base_file_entry + PARAMS ((struct bfd_link_info *, bfd *, asection *, bfd_vma)); +static bfd_boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *)); + +/* The NT loader points the toc register to &toc + 32768, in order to + use the complete range of a 16-bit displacement. We have to adjust + for this when we fix up loads displaced off the toc reg. */ +#define TOC_LOAD_ADJUSTMENT (-32768) +#define TOC_SECTION_NAME ".private.toc" + +/* The main body of code is in coffcode.h. */ +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2 + +/* In case we're on a 32-bit machine, construct a 64-bit "-1" value + from smaller values. Start with zero, widen, *then* decrement. */ +#define MINUS_ONE (((bfd_vma)0) - 1) + +static reloc_howto_type mcore_coff_howto_table[] = +{ + /* Unused: */ + HOWTO (IMAGE_REL_MCORE_ABSOLUTE,/* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* dont complain_on_overflow */ + NULL, /* special_function */ + "ABSOLUTE", /* name */ + FALSE, /* partial_inplace */ + 0x00, /* src_mask */ + 0x00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (IMAGE_REL_MCORE_ADDR32,/* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + NULL, /* special_function */ + "ADDR32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 8 bits + 2 zero bits; jmpi/jsri/lrw instructions. + Should not appear in object files. */ + HOWTO (IMAGE_REL_MCORE_PCREL_IMM8BY4, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + mcore_coff_unsupported_reloc, /* special_function */ + "IMM8BY4", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* bsr/bt/bf/br instructions; 11 bits + 1 zero bit + Span 2k instructions == 4k bytes. + Only useful pieces at the relocated address are the opcode (5 bits) */ + HOWTO (IMAGE_REL_MCORE_PCREL_IMM11BY2,/* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 11, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + NULL, /* special_function */ + "IMM11BY2", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 4 bits + 1 zero bit; 'loopt' instruction only; unsupported. */ + HOWTO (IMAGE_REL_MCORE_PCREL_IMM4BY2, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 4, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + mcore_coff_unsupported_reloc, /* special_function */ + "IMM4BY2", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 32-bit pc-relative. Eventually this will help support PIC code. */ + HOWTO (IMAGE_REL_MCORE_PCREL_32,/* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + NULL, /* special_function */ + "PCREL_32", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Like PCREL_IMM11BY2, this relocation indicates that there is a + 'jsri' at the specified address. There is a separate relocation + entry for the literal pool entry that it references, but we + might be able to change the jsri to a bsr if the target turns out + to be close enough [even though we won't reclaim the literal pool + entry, we'll get some runtime efficiency back]. Note that this + is a relocation that we are allowed to safely ignore. */ + HOWTO (IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2,/* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 11, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + NULL, /* special_function */ + "JSR_IMM11BY2", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (IMAGE_REL_MCORE_RVA, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + NULL, /* special_function */ + "MCORE_RVA", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE) /* pcrel_offset */ +}; + +/* Extend the coff_link_hash_table structure with a few M*Core specific fields. + This allows us to store global data here without actually creating any + global variables, which is a no-no in the BFD world. */ +typedef struct coff_mcore_link_hash_table +{ + /* The original coff_link_hash_table structure. MUST be first field. */ + struct coff_link_hash_table root; + + bfd * bfd_of_toc_owner; + long int global_toc_size; + long int import_table_size; + long int first_thunk_address; + long int thunk_size; +} +mcore_hash_table; + +/* Get the MCore coff linker hash table from a link_info structure. */ +#define coff_mcore_hash_table(info) \ + ((mcore_hash_table *) ((info)->hash)) + +#if 0 +/* Create an MCore coff linker hash table. */ + +static struct bfd_link_hash_table * +coff_mcore_link_hash_table_create (abfd) + bfd * abfd; +{ + mcore_hash_table * ret; + + ret = (mcore_hash_table *) bfd_malloc ((bfd_size_type) sizeof (* ret)); + if (ret == (mcore_hash_table *) NULL) + return NULL; + + if (! _bfd_coff_link_hash_table_init + (& ret->root, abfd, _bfd_coff_link_hash_newfunc)) + { + free (ret); + return (struct bfd_link_hash_table *) NULL; + } + + ret->bfd_of_toc_owner = NULL; + ret->global_toc_size = 0; + ret->import_table_size = 0; + ret->first_thunk_address = 0; + ret->thunk_size = 0; + + return & ret->root.root; +} +#endif + +/* Add an entry to the base file. */ + +static void +mcore_emit_base_file_entry (info, output_bfd, input_section, reloc_offset) + struct bfd_link_info * info; + bfd * output_bfd; + asection * input_section; + bfd_vma reloc_offset; +{ + bfd_vma addr = reloc_offset + - input_section->vma + + input_section->output_offset + + input_section->output_section->vma; + + if (coff_data (output_bfd)->pe) + addr -= pe_data (output_bfd)->pe_opthdr.ImageBase; + + fwrite (&addr, 1, sizeof (addr), (FILE *) info->base_file); +} + +static bfd_reloc_status_type +mcore_coff_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd * abfd; + arelent * reloc_entry; + asymbol * symbol ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection * input_section ATTRIBUTE_UNUSED; + bfd * output_bfd ATTRIBUTE_UNUSED; + char ** error_message ATTRIBUTE_UNUSED; +{ + BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0); + + _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"), + bfd_archive_filename (abfd), + reloc_entry->howto->name, + reloc_entry->howto->type); + + return bfd_reloc_notsupported; +} + +/* A cheesy little macro to make the code a little more readable. */ +#define HOW2MAP(bfd_rtype, mcore_rtype) \ + case bfd_rtype: return & mcore_coff_howto_table [mcore_rtype] + +static reloc_howto_type * +mcore_coff_reloc_type_lookup (abfd, code) + bfd * abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + switch (code) + { + HOW2MAP (BFD_RELOC_32, IMAGE_REL_MCORE_ADDR32); + HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM8BY4, IMAGE_REL_MCORE_PCREL_IMM8BY4); + HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM11BY2, IMAGE_REL_MCORE_PCREL_IMM11BY2); + HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM4BY2, IMAGE_REL_MCORE_PCREL_IMM4BY2); + HOW2MAP (BFD_RELOC_32_PCREL, IMAGE_REL_MCORE_PCREL_32); + HOW2MAP (BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2, IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2); + HOW2MAP (BFD_RELOC_RVA, IMAGE_REL_MCORE_RVA); + default: + return NULL; + } + /*NOTREACHED*/ +} + +#undef HOW2MAP + +#define RTYPE2HOWTO(cache_ptr, dst) \ + (cache_ptr)->howto = mcore_coff_howto_table + (dst)->r_type; + +static reloc_howto_type * +coff_mcore_rtype_to_howto (abfd, sec, rel, h, sym, addendp) + bfd * abfd ATTRIBUTE_UNUSED; + asection * sec; + struct internal_reloc * rel; + struct coff_link_hash_entry * h ATTRIBUTE_UNUSED; + struct internal_syment * sym; + bfd_vma * addendp; +{ + reloc_howto_type * howto; + + if (rel->r_type >= NUM_ELEM (mcore_coff_howto_table)) + return NULL; + + howto = mcore_coff_howto_table + rel->r_type; + + if (rel->r_type == IMAGE_REL_MCORE_RVA) + * addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase; + + else if (howto->pc_relative) + { + * addendp = sec->vma - 2; /* XXX guess - is this right ? */ + + /* If the symbol is defined, then the generic code is going to + add back the symbol value in order to cancel out an + adjustment it made to the addend. However, we set the addend + to 0 at the start of this function. We need to adjust here, + to avoid the adjustment the generic code will make. FIXME: + This is getting a bit hackish. */ + if (sym != NULL && sym->n_scnum != 0) + * addendp -= sym->n_value; + } + else + * addendp = 0; + + return howto; +} + +/* Return TRUE if this relocation should appear in the output .reloc section. + This function is referenced in pe_mkobject in peicode.h. */ + +static bfd_boolean +in_reloc_p (abfd, howto) + bfd * abfd ATTRIBUTE_UNUSED; + reloc_howto_type * howto; +{ + return ! howto->pc_relative && howto->type != IMAGE_REL_MCORE_RVA; +} + +/* The reloc processing routine for the optimized COFF linker. */ +static bfd_boolean +coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, syms, sections) + bfd * output_bfd; + struct bfd_link_info * info; + bfd * input_bfd; + asection * input_section; + bfd_byte * contents; + struct internal_reloc * relocs; + struct internal_syment * syms; + asection ** sections; +{ + struct internal_reloc * rel; + struct internal_reloc * relend; + bfd_boolean hihalf; + bfd_vma hihalf_val; + + /* If we are performing a relocatable link, we don't need to do a + thing. The caller will take care of adjusting the reloc + addresses and symbol indices. */ + if (info->relocatable) + return TRUE; + + /* Check if we have the same endianess */ + if ( input_bfd->xvec->byteorder != output_bfd->xvec->byteorder + && output_bfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN) + { + (*_bfd_error_handler) + (_("%s: compiled for a %s system and target is %s.\n"), + bfd_archive_filename (input_bfd), + bfd_big_endian (input_bfd) ? _("big endian") : _("little endian"), + bfd_big_endian (output_bfd) ? _("big endian") : _("little endian")); + + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } + + hihalf = FALSE; + hihalf_val = 0; + + rel = relocs; + relend = rel + input_section->reloc_count; + + for (; rel < relend; rel++) + { + long symndx; + struct internal_syment * sym; + bfd_vma val; + bfd_vma addend; + bfd_reloc_status_type rstat; + bfd_byte * loc; + unsigned short r_type = rel->r_type; + reloc_howto_type * howto = NULL; + struct coff_link_hash_entry * h; + const char * my_name; + + symndx = rel->r_symndx; + loc = contents + rel->r_vaddr - input_section->vma; + + if (symndx == -1) + { + h = NULL; + sym = NULL; + } + else + { + h = obj_coff_sym_hashes (input_bfd)[symndx]; + sym = syms + symndx; + } + + addend = 0; + + /* Get the howto and initialise the addend. */ + howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h, + sym, & addend); + if (howto == NULL) + return FALSE; + + val = 0; + + if (h == NULL) + { + if (symndx == -1) + my_name = "*ABS*"; + else + { + asection * sec = sections[symndx]; + + val = (sym->n_value + + sec->output_section->vma + + sec->output_offset); + + if (sym == NULL) + my_name = "*unknown*"; + else if ( sym->_n._n_n._n_zeroes == 0 + && sym->_n._n_n._n_offset != 0) + my_name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset; + else + { + static char buf [SYMNMLEN + 1]; + + strncpy (buf, sym->_n._n_name, SYMNMLEN); + buf[SYMNMLEN] = '\0'; + my_name = buf; + } + } + } + else + { + if ( h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + asection * sec = h->root.u.def.section; + + val = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, input_section, + rel->r_vaddr - input_section->vma, TRUE))) + return FALSE; + } + + my_name = h->root.root.string; + } + + rstat = bfd_reloc_ok; + + /* Each case must do its own relocation, setting rstat appropriately. */ + switch (r_type) + { + default: + _bfd_error_handler (_("%s: unsupported relocation type 0x%02x"), + bfd_archive_filename (input_bfd), r_type); + bfd_set_error (bfd_error_bad_value); + return FALSE; + + case IMAGE_REL_MCORE_ABSOLUTE: + fprintf (stderr, + _("Warning: unsupported reloc %s \n"), + howto->name, + bfd_archive_filename (input_bfd), + input_section->name); + + fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n", + rel->r_symndx, my_name, (long) rel->r_vaddr, + (unsigned long) rel->r_vaddr); + break; + + case IMAGE_REL_MCORE_PCREL_IMM8BY4: + case IMAGE_REL_MCORE_PCREL_IMM11BY2: + case IMAGE_REL_MCORE_PCREL_IMM4BY2: + case IMAGE_REL_MCORE_PCREL_32: + case IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2: + case IMAGE_REL_MCORE_ADDR32: + /* XXX fixme - shouldn't this be like the code for the RVA reloc ? */ + rstat = _bfd_relocate_contents (howto, input_bfd, val, loc); + break; + + case IMAGE_REL_MCORE_RVA: + rstat = _bfd_final_link_relocate + (howto, input_bfd, + input_section, contents, rel->r_vaddr - input_section->vma, + val, addend); + break; + } + + if (info->base_file) + { + /* Emit a reloc if the backend thinks it needs it. */ + if (sym && pe_data (output_bfd)->in_reloc_p (output_bfd, howto)) + mcore_emit_base_file_entry (info, output_bfd, input_section, rel->r_vaddr); + } + + switch (rstat) + { + default: + abort (); + + case bfd_reloc_ok: + break; + + case bfd_reloc_overflow: + if (! ((*info->callbacks->reloc_overflow) + (info, my_name, howto->name, + (bfd_vma) 0, input_bfd, + input_section, rel->r_vaddr - input_section->vma))) + return FALSE; + } + } + + return TRUE; +} + +/* Tailor coffcode.h -- macro heaven. */ + +/* We use the special COFF backend linker, with our own special touch. */ + +#define coff_bfd_reloc_type_lookup mcore_coff_reloc_type_lookup +#define coff_relocate_section coff_mcore_relocate_section +#define coff_rtype_to_howto coff_mcore_rtype_to_howto + +#define SELECT_RELOC(internal, howto) {internal.r_type = howto->type;} + +/* Make sure that the 'r_offset' field is copied properly + so that identical binaries will compare the same. */ +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 + +#define COFF_PAGE_SIZE 0x1000 + +#include "coffcode.h" + +/* Forward declaration to initialise alternative_target field. */ +extern const bfd_target TARGET_LITTLE_SYM; + +/* The transfer vectors that lead the outside world to all of the above. */ +CREATE_BIG_COFF_TARGET_VEC (TARGET_BIG_SYM, TARGET_BIG_NAME, D_PAGED, + (SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_READONLY | SEC_LINK_ONCE | SEC_LINK_DUPLICATES), + 0, & TARGET_LITTLE_SYM, COFF_SWAP_TABLE) +CREATE_LITTLE_COFF_TARGET_VEC (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, D_PAGED, + (SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_READONLY | SEC_LINK_ONCE | SEC_LINK_DUPLICATES), + 0, & TARGET_BIG_SYM, COFF_SWAP_TABLE) diff --git a/bfd/coff-or32.c b/bfd/coff-or32.c new file mode 100644 index 0000000000000..b21cdf3f4ade1 --- /dev/null +++ b/bfd/coff-or32.c @@ -0,0 +1,662 @@ +/* BFD back-end for OpenRISC 1000 COFF binaries. + Copyright 2002, 2003 Free Software Foundation, Inc. + Contributed by Ivan Guzvinec + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#define OR32 1 + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "coff/or32.h" +#include "coff/internal.h" +#include "libcoff.h" + +static long get_symbol_value + PARAMS ((asymbol *)); +static bfd_reloc_status_type or32_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_boolean coff_or32_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **)); +static bfd_boolean coff_or32_adjust_symndx + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, + struct internal_reloc *, bfd_boolean *)); +static void reloc_processing + PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) + +#define INSERT_HWORD(WORD,HWORD) \ + (((WORD) & 0xffff0000) | ((HWORD)& 0x0000ffff)) +#define EXTRACT_HWORD(WORD) \ + ((WORD) & 0x0000ffff) +#define SIGN_EXTEND_HWORD(HWORD) \ + ((HWORD) & 0x8000 ? (HWORD)|(~0xffffL) : (HWORD)) + +#define INSERT_JUMPTARG(WORD,JT) \ + (((WORD) & 0xfc000000) | ((JT)& 0x03ffffff)) +#define EXTRACT_JUMPTARG(WORD) \ + ((WORD) & 0x03ffffff) +#define SIGN_EXTEND_JUMPTARG(JT) \ + ((JT) & 0x04000000 ? (JT)|(~0x03ffffffL) : (JT)) + +/* Provided the symbol, returns the value reffed. */ + +static long +get_symbol_value (symbol) + asymbol *symbol; +{ + long relocation = 0; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value + + symbol->section->output_section->vma + + symbol->section->output_offset; + + return relocation; +} + +/* This function is in charge of performing all the or32 relocations. */ + +static bfd_reloc_status_type +or32_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, + error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol_in; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + /* The consth relocation comes in two parts, we have to remember + the state between calls, in these variables. */ + static bfd_boolean part1_consth_active = FALSE; + static unsigned long part1_consth_value; + + unsigned long insn; + unsigned long sym_value; + unsigned long unsigned_value; + unsigned short r_type; + long signed_value; + + unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/ + bfd_byte *hit_data =addr + (bfd_byte *)(data); + + r_type = reloc_entry->howto->type; + + if (output_bfd) + { + /* Partial linking - do nothing. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (symbol_in != NULL + && bfd_is_und_section (symbol_in->section)) + { + /* Keep the state machine happy in case we're called again. */ + if (r_type == R_IHIHALF) + { + part1_consth_active = TRUE; + part1_consth_value = 0; + } + + return bfd_reloc_undefined; + } + + if ((part1_consth_active) && (r_type != R_IHCONST)) + { + part1_consth_active = FALSE; + *error_message = (char *) "Missing IHCONST"; + + return bfd_reloc_dangerous; + } + + sym_value = get_symbol_value (symbol_in); + + switch (r_type) + { + case R_IREL: + insn = bfd_get_32(abfd, hit_data); + + /* Take the value in the field and sign extend it. */ + signed_value = EXTRACT_JUMPTARG (insn); + signed_value = SIGN_EXTEND_JUMPTARG (signed_value); + signed_value <<= 2; + + /* See the note on the R_IREL reloc in coff_or32_relocate_section. */ + if (signed_value == - (long) reloc_entry->address) + signed_value = 0; + + signed_value += sym_value + reloc_entry->addend; +#if 0 + if ((signed_value & ~0x3ffff) == 0) + { /* Absolute jmp/call. */ + insn |= (1<<24); /* Make it absolute. */ + /* FIXME: Should we change r_type to R_IABS. */ + } + else +#endif + { + /* Relative jmp/call, so subtract from the value the + address of the place we're coming from. */ + signed_value -= (reloc_entry->address + + input_section->output_section->vma + + input_section->output_offset); + if (signed_value > 0x7ffffff || signed_value < -0x8000000) + return bfd_reloc_overflow; + } + signed_value >>= 2; + insn = INSERT_JUMPTARG (insn, signed_value); + bfd_put_32 (abfd, insn, hit_data); + break; + + case R_ILOHALF: + insn = bfd_get_32 (abfd, hit_data); + unsigned_value = EXTRACT_HWORD (insn); + unsigned_value += sym_value + reloc_entry->addend; + insn = INSERT_HWORD (insn, unsigned_value); + bfd_put_32 (abfd, insn, hit_data); + break; + + case R_IHIHALF: + insn = bfd_get_32 (abfd, hit_data); + + /* consth, part 1 + Just get the symbol value that is referenced. */ + part1_consth_active = TRUE; + part1_consth_value = sym_value + reloc_entry->addend; + + /* Don't modify insn until R_IHCONST. */ + break; + + case R_IHCONST: + insn = bfd_get_32 (abfd, hit_data); + + /* consth, part 2 + Now relocate the reference. */ + if (! part1_consth_active) + { + *error_message = (char *) "Missing IHIHALF"; + return bfd_reloc_dangerous; + } + + /* sym_ptr_ptr = r_symndx, in coff_slurp_reloc_table() */ + unsigned_value = 0; /*EXTRACT_HWORD(insn) << 16;*/ + unsigned_value += reloc_entry->addend; /* r_symndx */ + unsigned_value += part1_consth_value; + unsigned_value = unsigned_value >> 16; + insn = INSERT_HWORD (insn, unsigned_value); + part1_consth_active = FALSE; + bfd_put_32 (abfd, insn, hit_data); + break; + + case R_BYTE: + insn = bfd_get_8 (abfd, hit_data); + unsigned_value = insn + sym_value + reloc_entry->addend; + if (unsigned_value & 0xffffff00) + return bfd_reloc_overflow; + bfd_put_8 (abfd, unsigned_value, hit_data); + break; + + case R_HWORD: + insn = bfd_get_16 (abfd, hit_data); + unsigned_value = insn + sym_value + reloc_entry->addend; + if (unsigned_value & 0xffff0000) + return bfd_reloc_overflow; + bfd_put_16 (abfd, insn, hit_data); + break; + + case R_WORD: + insn = bfd_get_32 (abfd, hit_data); + insn += sym_value + reloc_entry->addend; + bfd_put_32 (abfd, insn, hit_data); + break; + + default: + *error_message = _("Unrecognized reloc"); + return bfd_reloc_dangerous; + } + + return bfd_reloc_ok; +} + +/* type rightshift + size + bitsize + pc-relative + bitpos + absolute + complain_on_overflow + special_function + relocation name + partial_inplace + src_mask +*/ + +/* FIXME: I'm not real sure about this table. */ +static reloc_howto_type howto_table[] = +{ + { R_ABS, 0, 3, 32, FALSE, 0, complain_overflow_bitfield, or32_reloc, "ABS", TRUE, 0xffffffff,0xffffffff, FALSE }, + EMPTY_HOWTO (1), + EMPTY_HOWTO (2), + EMPTY_HOWTO (3), + EMPTY_HOWTO (4), + EMPTY_HOWTO (5), + EMPTY_HOWTO (6), + EMPTY_HOWTO (7), + EMPTY_HOWTO (8), + EMPTY_HOWTO (9), + EMPTY_HOWTO (10), + EMPTY_HOWTO (11), + EMPTY_HOWTO (12), + EMPTY_HOWTO (13), + EMPTY_HOWTO (14), + EMPTY_HOWTO (15), + EMPTY_HOWTO (16), + EMPTY_HOWTO (17), + EMPTY_HOWTO (18), + EMPTY_HOWTO (19), + EMPTY_HOWTO (20), + EMPTY_HOWTO (21), + EMPTY_HOWTO (22), + EMPTY_HOWTO (23), + { R_IREL, 0, 3, 32, TRUE, 0, complain_overflow_signed, or32_reloc, "IREL", TRUE, 0xffffffff,0xffffffff, FALSE }, + { R_IABS, 0, 3, 32, FALSE, 0, complain_overflow_bitfield, or32_reloc, "IABS", TRUE, 0xffffffff,0xffffffff, FALSE }, + { R_ILOHALF, 0, 3, 16, TRUE, 0, complain_overflow_signed, or32_reloc, "ILOHALF", TRUE, 0x0000ffff,0x0000ffff, FALSE }, + { R_IHIHALF, 0, 3, 16, TRUE, 16,complain_overflow_signed, or32_reloc, "IHIHALF", TRUE, 0xffff0000,0xffff0000, FALSE }, + { R_IHCONST, 0, 3, 16, TRUE, 0, complain_overflow_signed, or32_reloc, "IHCONST", TRUE, 0xffff0000,0xffff0000, FALSE }, + { R_BYTE, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, or32_reloc, "BYTE", TRUE, 0x000000ff,0x000000ff, FALSE }, + { R_HWORD, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, or32_reloc, "HWORD", TRUE, 0x0000ffff,0x0000ffff, FALSE }, + { R_WORD, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, or32_reloc, "WORD", TRUE, 0xffffffff,0xffffffff, FALSE }, +}; + +#define BADMAG(x) OR32BADMAG (x) + +#define RELOC_PROCESSING(relent, reloc, symbols, abfd, section) \ + reloc_processing (relent, reloc, symbols, abfd, section) + +static void +reloc_processing (relent,reloc, symbols, abfd, section) + arelent *relent; + struct internal_reloc *reloc; + asymbol **symbols; + bfd *abfd; + asection *section; +{ + static bfd_vma ihihalf_vaddr = (bfd_vma) -1; + + relent->address = reloc->r_vaddr; + relent->howto = howto_table + reloc->r_type; + + if (reloc->r_type == R_IHCONST) + { + /* The address of an R_IHCONST should always be the address of + the immediately preceding R_IHIHALF. relocs generated by gas + are correct, but relocs generated by High C are different (I + can't figure out what the address means for High C). We can + handle both gas and High C by ignoring the address here, and + simply reusing the address saved for R_IHIHALF. */ + if (ihihalf_vaddr == (bfd_vma) -1) + abort (); + + relent->address = ihihalf_vaddr; + ihihalf_vaddr = (bfd_vma) -1; + relent->addend = reloc->r_symndx; + relent->sym_ptr_ptr= bfd_abs_section_ptr->symbol_ptr_ptr; + } + else + { + asymbol *ptr; + relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; + + ptr = *(relent->sym_ptr_ptr); + + relent->addend = 0; + relent->address-= section->vma; + + if (reloc->r_type == R_IHIHALF) + ihihalf_vaddr = relent->address; + else if (ihihalf_vaddr != (bfd_vma) -1) + abort (); + } +} + +/* The reloc processing routine for the optimized COFF linker. */ + +static bfd_boolean +coff_or32_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, syms, sections) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + struct internal_reloc *relocs; + struct internal_syment *syms; + asection **sections; +{ + struct internal_reloc *rel; + struct internal_reloc *relend; + bfd_boolean hihalf; + bfd_vma hihalf_val; + + /* If we are performing a relocatable link, we don't need to do a + thing. The caller will take care of adjusting the reloc + addresses and symbol indices. */ + if (info->relocatable) + return TRUE; + + hihalf = FALSE; + hihalf_val = 0; + + rel = relocs; + relend = rel + input_section->reloc_count; + + for (; rel < relend; rel++) + { + long symndx; + bfd_byte *loc; + struct coff_link_hash_entry *h; + struct internal_syment *sym; + asection *sec; + bfd_vma val; + bfd_boolean overflow; + unsigned long insn; + long signed_value; + unsigned long unsigned_value; + bfd_reloc_status_type rstat; + + symndx = rel->r_symndx; + loc = contents + rel->r_vaddr - input_section->vma; + + if (symndx == -1 || rel->r_type == R_IHCONST) + h = NULL; + else + h = obj_coff_sym_hashes (input_bfd)[symndx]; + + sym = NULL; + sec = NULL; + val = 0; + + /* An R_IHCONST reloc does not have a symbol. Instead, the + symbol index is an addend. R_IHCONST is always used in + conjunction with R_IHHALF. */ + if (rel->r_type != R_IHCONST) + { + if (h == NULL) + { + if (symndx == -1) + sec = bfd_abs_section_ptr; + else + { + sym = syms + symndx; + sec = sections[symndx]; + val = (sec->output_section->vma + + sec->output_offset + + sym->n_value + - sec->vma); + } + } + else + { + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + val = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, input_section, + rel->r_vaddr - input_section->vma, TRUE))) + return FALSE; + } + } + + if (hihalf) + { + if (! ((*info->callbacks->reloc_dangerous) + (info, "missing IHCONST reloc", input_bfd, + input_section, rel->r_vaddr - input_section->vma))) + return FALSE; + hihalf = FALSE; + } + } + + overflow = FALSE; + + switch (rel->r_type) + { + default: + bfd_set_error (bfd_error_bad_value); + return FALSE; + + case R_IREL: + insn = bfd_get_32 (input_bfd, loc); + + /* Extract the addend. */ + signed_value = EXTRACT_JUMPTARG (insn); + signed_value = SIGN_EXTEND_JUMPTARG (signed_value); + signed_value <<= 2; + + /* Determine the destination of the jump. */ + signed_value += val; + +#if 0 + if ((signed_value & ~0x3ffff) == 0) + { + /* We can use an absolute jump. */ + insn |= (1 << 24); + } + else +#endif + { + /* Make the destination PC relative. */ + signed_value -= (input_section->output_section->vma + + input_section->output_offset + + (rel->r_vaddr - input_section->vma)); + if (signed_value > 0x7ffffff || signed_value < - 0x8000000) + { + overflow = TRUE; + signed_value = 0; + } + } + + /* Put the adjusted value back into the instruction. */ + signed_value >>= 2; + insn = INSERT_JUMPTARG(insn, signed_value); + + bfd_put_32 (input_bfd, (bfd_vma) insn, loc); + break; + + case R_ILOHALF: + insn = bfd_get_32 (input_bfd, loc); + unsigned_value = EXTRACT_HWORD (insn); + unsigned_value += val; + insn = INSERT_HWORD (insn, unsigned_value); + bfd_put_32 (input_bfd, insn, loc); + break; + + case R_IHIHALF: + /* Save the value for the R_IHCONST reloc. */ + hihalf = TRUE; + hihalf_val = val; + break; + + case R_IHCONST: + if (! hihalf) + { + if (! ((*info->callbacks->reloc_dangerous) + (info, "missing IHIHALF reloc", input_bfd, + input_section, rel->r_vaddr - input_section->vma))) + return FALSE; + hihalf_val = 0; + } + + insn = bfd_get_32 (input_bfd, loc); + unsigned_value = rel->r_symndx + hihalf_val; + unsigned_value >>= 16; + insn = INSERT_HWORD (insn, unsigned_value); + bfd_put_32 (input_bfd, (bfd_vma) insn, loc); + + hihalf = FALSE; + break; + + case R_BYTE: + case R_HWORD: + case R_WORD: + rstat = _bfd_relocate_contents (howto_table + rel->r_type, + input_bfd, val, loc); + if (rstat == bfd_reloc_overflow) + overflow = TRUE; + else if (rstat != bfd_reloc_ok) + abort (); + break; + } + + if (overflow) + { + const char *name; + char buf[SYMNMLEN + 1]; + + if (symndx == -1) + name = "*ABS*"; + else if (h != NULL) + name = h->root.root.string; + else if (sym == NULL) + name = "*unknown*"; + else if (sym->_n._n_n._n_zeroes == 0 + && sym->_n._n_n._n_offset != 0) + name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset; + else + { + strncpy (buf, sym->_n._n_name, SYMNMLEN); + buf[SYMNMLEN] = '\0'; + name = buf; + } + + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto_table[rel->r_type].name, (bfd_vma) 0, + input_bfd, input_section, + rel->r_vaddr - input_section->vma))) + return FALSE; + } + } + + return TRUE; +} + +#define coff_relocate_section coff_or32_relocate_section + +/* We don't want to change the symndx of a R_IHCONST reloc, since it + is actually an addend, not a symbol index at all. */ + +static bfd_boolean +coff_or32_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) + bfd *obfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + bfd *ibfd ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + struct internal_reloc *irel; + bfd_boolean *adjustedp; +{ + if (irel->r_type == R_IHCONST) + *adjustedp = TRUE; + else + *adjustedp = FALSE; + return TRUE; +} + +#define coff_adjust_symndx coff_or32_adjust_symndx + +#include "coffcode.h" + +const bfd_target or32coff_big_vec = +{ + "coff-or32-big", /* Name. */ + bfd_target_coff_flavour, + BFD_ENDIAN_BIG, /* Data byte order is big. */ + BFD_ENDIAN_BIG, /* Header byte order is big. */ + + (HAS_RELOC | EXEC_P | /* Object flags. */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT), + + (SEC_HAS_CONTENTS | SEC_ALLOC | /* Section flags. */ + SEC_LOAD | SEC_RELOC | + SEC_READONLY ), + '_', /* Leading underscore. */ + '/', /* ar_pad_char. */ + 15, /* ar_max_namelen. */ + + /* Data. */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, + + /* Headers. */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, + + { + _bfd_dummy_target, + coff_object_p, + bfd_generic_archive_p, + _bfd_dummy_target + }, + { + bfd_false, + coff_mkobject, + _bfd_generic_mkarchive, + bfd_false + }, + { + bfd_false, + coff_write_object_contents, + _bfd_write_archive_contents, + bfd_false + }, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (coff), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + /* Alternative_target. */ +#ifdef TARGET_LITTLE_SYM + & TARGET_LITTLE_SYM, +#else + NULL, +#endif + + COFF_SWAP_TABLE +}; diff --git a/bfd/coff-pmac.c b/bfd/coff-pmac.c new file mode 100644 index 0000000000000..6b44a9379ee91 --- /dev/null +++ b/bfd/coff-pmac.c @@ -0,0 +1,33 @@ +/* BFD back-end for Apple et al PowerPC Mac "XCOFF" files. + Copyright 1995, 2000, 2001 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* Tweak coffcode.h based on this being a PowerMac instead of RS/6000. */ + +#define POWERMAC + +#define TARGET_SYM pmac_xcoff_vec +#define TARGET_NAME "xcoff-powermac" + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "coff/internal.h" +#include "coff/rs6000.h" +#include "libcoff.h" +#include "xcoff-target.h" diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c new file mode 100644 index 0000000000000..d78cc16d6814a --- /dev/null +++ b/bfd/coff-sh.c @@ -0,0 +1,3341 @@ +/* BFD back-end for Renesas Super-H COFF binaries. + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Contributed by Cygnus Support. + Written by Steve Chamberlain, . + Relaxing code written by Ian Lance Taylor, . + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libiberty.h" +#include "libbfd.h" +#include "bfdlink.h" +#include "coff/sh.h" +#include "coff/internal.h" + +#ifdef COFF_WITH_PE +#include "coff/pe.h" + +#ifndef COFF_IMAGE_WITH_PE +static bfd_boolean sh_align_load_span + PARAMS ((bfd *, asection *, bfd_byte *, + bfd_boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma), + PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *)); + +#define _bfd_sh_align_load_span sh_align_load_span +#endif +#endif + +#include "libcoff.h" + +/* Internal functions. */ +static bfd_reloc_status_type sh_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static long get_symbol_value PARAMS ((asymbol *)); +static bfd_boolean sh_relax_section + PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); +static bfd_boolean sh_relax_delete_bytes + PARAMS ((bfd *, asection *, bfd_vma, int)); +#ifndef COFF_IMAGE_WITH_PE +static const struct sh_opcode *sh_insn_info PARAMS ((unsigned int)); +#endif +static bfd_boolean sh_align_loads + PARAMS ((bfd *, asection *, struct internal_reloc *, bfd_byte *, + bfd_boolean *)); +static bfd_boolean sh_swap_insns + PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); +static bfd_boolean sh_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **)); +static bfd_byte *sh_coff_get_relocated_section_contents + PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, bfd_boolean, asymbol **)); +static reloc_howto_type * sh_coff_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); + +#ifdef COFF_WITH_PE +/* Can't build import tables with 2**4 alignment. */ +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2 +#else +/* Default section alignment to 2**4. */ +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 4 +#endif + +#ifdef COFF_IMAGE_WITH_PE +/* Align PE executables. */ +#define COFF_PAGE_SIZE 0x1000 +#endif + +/* Generate long file names. */ +#define COFF_LONG_FILENAMES + +#ifdef COFF_WITH_PE +static bfd_boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *)); +/* Return TRUE if this relocation should + appear in the output .reloc section. */ +static bfd_boolean in_reloc_p (abfd, howto) + bfd * abfd ATTRIBUTE_UNUSED; + reloc_howto_type * howto; +{ + return ! howto->pc_relative && howto->type != R_SH_IMAGEBASE; +} +#endif + +/* The supported relocations. There are a lot of relocations defined + in coff/internal.h which we do not expect to ever see. */ +static reloc_howto_type sh_coff_howtos[] = +{ + EMPTY_HOWTO (0), + EMPTY_HOWTO (1), +#ifdef COFF_WITH_PE + /* Windows CE */ + HOWTO (R_SH_IMM32CE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_imm32ce", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +#else + EMPTY_HOWTO (2), +#endif + EMPTY_HOWTO (3), /* R_SH_PCREL8 */ + EMPTY_HOWTO (4), /* R_SH_PCREL16 */ + EMPTY_HOWTO (5), /* R_SH_HIGH8 */ + EMPTY_HOWTO (6), /* R_SH_IMM24 */ + EMPTY_HOWTO (7), /* R_SH_LOW16 */ + EMPTY_HOWTO (8), + EMPTY_HOWTO (9), /* R_SH_PCDISP8BY4 */ + + HOWTO (R_SH_PCDISP8BY2, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_pcdisp8by2", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + EMPTY_HOWTO (11), /* R_SH_PCDISP8 */ + + HOWTO (R_SH_PCDISP, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_pcdisp12by2", /* name */ + TRUE, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + EMPTY_HOWTO (13), + + HOWTO (R_SH_IMM32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_imm32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (15), +#ifdef COFF_WITH_PE + HOWTO (R_SH_IMAGEBASE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "rva32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +#else + EMPTY_HOWTO (16), /* R_SH_IMM8 */ +#endif + EMPTY_HOWTO (17), /* R_SH_IMM8BY2 */ + EMPTY_HOWTO (18), /* R_SH_IMM8BY4 */ + EMPTY_HOWTO (19), /* R_SH_IMM4 */ + EMPTY_HOWTO (20), /* R_SH_IMM4BY2 */ + EMPTY_HOWTO (21), /* R_SH_IMM4BY4 */ + + HOWTO (R_SH_PCRELIMM8BY2, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_pcrelimm8by2", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_SH_PCRELIMM8BY4, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_pcrelimm8by4", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_SH_IMM16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_imm16", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_SWITCH16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_switch16", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_SWITCH32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_switch32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_USES, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_uses", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_COUNT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_count", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_ALIGN, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_align", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_CODE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_code", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DATA, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_data", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_LABEL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_label", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_SWITCH8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_reloc, /* special_function */ + "r_switch8", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + FALSE) /* pcrel_offset */ +}; + +#define SH_COFF_HOWTO_COUNT (sizeof sh_coff_howtos / sizeof sh_coff_howtos[0]) + +/* Check for a bad magic number. */ +#define BADMAG(x) SHBADMAG(x) + +/* Customize coffcode.h (this is not currently used). */ +#define SH 1 + +/* FIXME: This should not be set here. */ +#define __A_MAGIC_SET__ + +#ifndef COFF_WITH_PE +/* Swap the r_offset field in and out. */ +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 + +/* Swap out extra information in the reloc structure. */ +#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ + do \ + { \ + dst->r_stuff[0] = 'S'; \ + dst->r_stuff[1] = 'C'; \ + } \ + while (0) +#endif + +/* Get the value of a symbol, when performing a relocation. */ + +static long +get_symbol_value (symbol) + asymbol *symbol; +{ + bfd_vma relocation; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = (symbol->value + + symbol->section->output_section->vma + + symbol->section->output_offset); + + return relocation; +} + +#ifdef COFF_WITH_PE +/* Convert an rtype to howto for the COFF backend linker. + Copied from coff-i386. */ +#define coff_rtype_to_howto coff_sh_rtype_to_howto +static reloc_howto_type * coff_sh_rtype_to_howto PARAMS ((bfd *, asection *, struct internal_reloc *, struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *)); + +static reloc_howto_type * +coff_sh_rtype_to_howto (abfd, sec, rel, h, sym, addendp) + bfd * abfd ATTRIBUTE_UNUSED; + asection * sec; + struct internal_reloc * rel; + struct coff_link_hash_entry * h; + struct internal_syment * sym; + bfd_vma * addendp; +{ + reloc_howto_type * howto; + + howto = sh_coff_howtos + rel->r_type; + + *addendp = 0; + + if (howto->pc_relative) + *addendp += sec->vma; + + if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0) + { + /* This is a common symbol. The section contents include the + size (sym->n_value) as an addend. The relocate_section + function will be adding in the final value of the symbol. We + need to subtract out the current size in order to get the + correct result. */ + BFD_ASSERT (h != NULL); + } + + if (howto->pc_relative) + { + *addendp -= 4; + + /* If the symbol is defined, then the generic code is going to + add back the symbol value in order to cancel out an + adjustment it made to the addend. However, we set the addend + to 0 at the start of this function. We need to adjust here, + to avoid the adjustment the generic code will make. FIXME: + This is getting a bit hackish. */ + if (sym != NULL && sym->n_scnum != 0) + *addendp -= sym->n_value; + } + + if (rel->r_type == R_SH_IMAGEBASE) + *addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase; + + return howto; +} + +#endif /* COFF_WITH_PE */ + +/* This structure is used to map BFD reloc codes to SH PE relocs. */ +struct shcoff_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char shcoff_reloc_val; +}; + +#ifdef COFF_WITH_PE +/* An array mapping BFD reloc codes to SH PE relocs. */ +static const struct shcoff_reloc_map sh_reloc_map[] = +{ + { BFD_RELOC_32, R_SH_IMM32CE }, + { BFD_RELOC_RVA, R_SH_IMAGEBASE }, + { BFD_RELOC_CTOR, R_SH_IMM32CE }, +}; +#else +/* An array mapping BFD reloc codes to SH PE relocs. */ +static const struct shcoff_reloc_map sh_reloc_map[] = +{ + { BFD_RELOC_32, R_SH_IMM32 }, + { BFD_RELOC_CTOR, R_SH_IMM32 }, +}; +#endif + +/* Given a BFD reloc code, return the howto structure for the + corresponding SH PE reloc. */ +#define coff_bfd_reloc_type_lookup sh_coff_reloc_type_lookup + +static reloc_howto_type * +sh_coff_reloc_type_lookup (abfd, code) + bfd * abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = ARRAY_SIZE (sh_reloc_map); i--;) + if (sh_reloc_map[i].bfd_reloc_val == code) + return &sh_coff_howtos[(int) sh_reloc_map[i].shcoff_reloc_val]; + + fprintf (stderr, "SH Error: unknown reloc type %d\n", code); + return NULL; +} + +/* This macro is used in coffcode.h to get the howto corresponding to + an internal reloc. */ + +#define RTYPE2HOWTO(relent, internal) \ + ((relent)->howto = \ + ((internal)->r_type < SH_COFF_HOWTO_COUNT \ + ? &sh_coff_howtos[(internal)->r_type] \ + : (reloc_howto_type *) NULL)) + +/* This is the same as the macro in coffcode.h, except that it copies + r_offset into reloc_entry->addend for some relocs. */ +#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ + { \ + coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ + if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ + coffsym = (obj_symbols (abfd) \ + + (cache_ptr->sym_ptr_ptr - symbols)); \ + else if (ptr) \ + coffsym = coff_symbol_from (abfd, ptr); \ + if (coffsym != (coff_symbol_type *) NULL \ + && coffsym->native->u.syment.n_scnum == 0) \ + cache_ptr->addend = 0; \ + else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ + && ptr->section != (asection *) NULL) \ + cache_ptr->addend = - (ptr->section->vma + ptr->value); \ + else \ + cache_ptr->addend = 0; \ + if ((reloc).r_type == R_SH_SWITCH8 \ + || (reloc).r_type == R_SH_SWITCH16 \ + || (reloc).r_type == R_SH_SWITCH32 \ + || (reloc).r_type == R_SH_USES \ + || (reloc).r_type == R_SH_COUNT \ + || (reloc).r_type == R_SH_ALIGN) \ + cache_ptr->addend = (reloc).r_offset; \ + } + +/* This is the howto function for the SH relocations. */ + +static bfd_reloc_status_type +sh_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, + error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol_in; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + unsigned long insn; + bfd_vma sym_value; + unsigned short r_type; + bfd_vma addr = reloc_entry->address; + bfd_byte *hit_data = addr + (bfd_byte *) data; + + r_type = reloc_entry->howto->type; + + if (output_bfd != NULL) + { + /* Partial linking--do nothing. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* Almost all relocs have to do with relaxing. If any work must be + done for them, it has been done in sh_relax_section. */ + if (r_type != R_SH_IMM32 +#ifdef COFF_WITH_PE + && r_type != R_SH_IMM32CE + && r_type != R_SH_IMAGEBASE +#endif + && (r_type != R_SH_PCDISP + || (symbol_in->flags & BSF_LOCAL) != 0)) + return bfd_reloc_ok; + + if (symbol_in != NULL + && bfd_is_und_section (symbol_in->section)) + return bfd_reloc_undefined; + + sym_value = get_symbol_value (symbol_in); + + switch (r_type) + { + case R_SH_IMM32: +#ifdef COFF_WITH_PE + case R_SH_IMM32CE: +#endif + insn = bfd_get_32 (abfd, hit_data); + insn += sym_value + reloc_entry->addend; + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); + break; +#ifdef COFF_WITH_PE + case R_SH_IMAGEBASE: + insn = bfd_get_32 (abfd, hit_data); + insn += sym_value + reloc_entry->addend; + insn -= pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase; + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); + break; +#endif + case R_SH_PCDISP: + insn = bfd_get_16 (abfd, hit_data); + sym_value += reloc_entry->addend; + sym_value -= (input_section->output_section->vma + + input_section->output_offset + + addr + + 4); + sym_value += (insn & 0xfff) << 1; + if (insn & 0x800) + sym_value -= 0x1000; + insn = (insn & 0xf000) | (sym_value & 0xfff); + bfd_put_16 (abfd, (bfd_vma) insn, hit_data); + if (sym_value < (bfd_vma) -0x1000 || sym_value >= 0x1000) + return bfd_reloc_overflow; + break; + default: + abort (); + break; + } + + return bfd_reloc_ok; +} + +#define coff_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match + +/* We can do relaxing. */ +#define coff_bfd_relax_section sh_relax_section + +/* We use the special COFF backend linker. */ +#define coff_relocate_section sh_relocate_section + +/* When relaxing, we need to use special code to get the relocated + section contents. */ +#define coff_bfd_get_relocated_section_contents \ + sh_coff_get_relocated_section_contents + +#include "coffcode.h" + +/* This function handles relaxing on the SH. + + Function calls on the SH look like this: + + movl L1,r0 + ... + jsr @r0 + ... + L1: + .long function + + The compiler and assembler will cooperate to create R_SH_USES + relocs on the jsr instructions. The r_offset field of the + R_SH_USES reloc is the PC relative offset to the instruction which + loads the register (the r_offset field is computed as though it + were a jump instruction, so the offset value is actually from four + bytes past the instruction). The linker can use this reloc to + determine just which function is being called, and thus decide + whether it is possible to replace the jsr with a bsr. + + If multiple function calls are all based on a single register load + (i.e., the same function is called multiple times), the compiler + guarantees that each function call will have an R_SH_USES reloc. + Therefore, if the linker is able to convert each R_SH_USES reloc + which refers to that address, it can safely eliminate the register + load. + + When the assembler creates an R_SH_USES reloc, it examines it to + determine which address is being loaded (L1 in the above example). + It then counts the number of references to that address, and + creates an R_SH_COUNT reloc at that address. The r_offset field of + the R_SH_COUNT reloc will be the number of references. If the + linker is able to eliminate a register load, it can use the + R_SH_COUNT reloc to see whether it can also eliminate the function + address. + + SH relaxing also handles another, unrelated, matter. On the SH, if + a load or store instruction is not aligned on a four byte boundary, + the memory cycle interferes with the 32 bit instruction fetch, + causing a one cycle bubble in the pipeline. Therefore, we try to + align load and store instructions on four byte boundaries if we + can, by swapping them with one of the adjacent instructions. */ + +static bfd_boolean +sh_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + bfd_boolean *again; +{ + struct internal_reloc *internal_relocs; + struct internal_reloc *free_relocs = NULL; + bfd_boolean have_code; + struct internal_reloc *irel, *irelend; + bfd_byte *contents = NULL; + bfd_byte *free_contents = NULL; + + *again = FALSE; + + if (link_info->relocatable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0) + return TRUE; + + /* If this is the first time we have been called for this section, + initialize the cooked size. */ + if (sec->_cooked_size == 0) + sec->_cooked_size = sec->_raw_size; + + internal_relocs = (_bfd_coff_read_internal_relocs + (abfd, sec, link_info->keep_memory, + (bfd_byte *) NULL, FALSE, + (struct internal_reloc *) NULL)); + if (internal_relocs == NULL) + goto error_return; + if (! link_info->keep_memory) + free_relocs = internal_relocs; + + have_code = FALSE; + + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma laddr, paddr, symval; + unsigned short insn; + struct internal_reloc *irelfn, *irelscan, *irelcount; + struct internal_syment sym; + bfd_signed_vma foff; + + if (irel->r_type == R_SH_CODE) + have_code = TRUE; + + if (irel->r_type != R_SH_USES) + continue; + + /* Get the section contents. */ + if (contents == NULL) + { + if (coff_section_data (abfd, sec) != NULL + && coff_section_data (abfd, sec)->contents != NULL) + contents = coff_section_data (abfd, sec)->contents; + else + { + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + free_contents = contents; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + /* The r_offset field of the R_SH_USES reloc will point us to + the register load. The 4 is because the r_offset field is + computed as though it were a jump offset, which are based + from 4 bytes after the jump instruction. */ + laddr = irel->r_vaddr - sec->vma + 4; + /* Careful to sign extend the 32-bit offset. */ + laddr += ((irel->r_offset & 0xffffffff) ^ 0x80000000) - 0x80000000; + if (laddr >= sec->_raw_size) + { + (*_bfd_error_handler) ("%s: 0x%lx: warning: bad R_SH_USES offset", + bfd_archive_filename (abfd), + (unsigned long) irel->r_vaddr); + continue; + } + insn = bfd_get_16 (abfd, contents + laddr); + + /* If the instruction is not mov.l NN,rN, we don't know what to do. */ + if ((insn & 0xf000) != 0xd000) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x", + bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr, insn)); + continue; + } + + /* Get the address from which the register is being loaded. The + displacement in the mov.l instruction is quadrupled. It is a + displacement from four bytes after the movl instruction, but, + before adding in the PC address, two least significant bits + of the PC are cleared. We assume that the section is aligned + on a four byte boundary. */ + paddr = insn & 0xff; + paddr *= 4; + paddr += (laddr + 4) &~ (bfd_vma) 3; + if (paddr >= sec->_raw_size) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: bad R_SH_USES load offset", + bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr)); + continue; + } + + /* Get the reloc for the address from which the register is + being loaded. This reloc will tell us which function is + actually being called. */ + paddr += sec->vma; + for (irelfn = internal_relocs; irelfn < irelend; irelfn++) + if (irelfn->r_vaddr == paddr +#ifdef COFF_WITH_PE + && (irelfn->r_type == R_SH_IMM32 + || irelfn->r_type == R_SH_IMM32CE + || irelfn->r_type == R_SH_IMAGEBASE)) + +#else + && irelfn->r_type == R_SH_IMM32) +#endif + break; + if (irelfn >= irelend) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: could not find expected reloc", + bfd_archive_filename (abfd), (unsigned long) paddr)); + continue; + } + + /* Get the value of the symbol referred to by the reloc. */ + if (! _bfd_coff_get_external_symbols (abfd)) + goto error_return; + bfd_coff_swap_sym_in (abfd, + ((bfd_byte *) obj_coff_external_syms (abfd) + + (irelfn->r_symndx + * bfd_coff_symesz (abfd))), + &sym); + if (sym.n_scnum != 0 && sym.n_scnum != sec->target_index) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: symbol in unexpected section", + bfd_archive_filename (abfd), (unsigned long) paddr)); + continue; + } + + if (sym.n_sclass != C_EXT) + { + symval = (sym.n_value + - sec->vma + + sec->output_section->vma + + sec->output_offset); + } + else + { + struct coff_link_hash_entry *h; + + h = obj_coff_sym_hashes (abfd)[irelfn->r_symndx]; + BFD_ASSERT (h != NULL); + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + { + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + continue; + } + + symval = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + + symval += bfd_get_32 (abfd, contents + paddr - sec->vma); + + /* See if this function call can be shortened. */ + foff = (symval + - (irel->r_vaddr + - sec->vma + + sec->output_section->vma + + sec->output_offset + + 4)); + if (foff < -0x1000 || foff >= 0x1000) + { + /* After all that work, we can't shorten this function call. */ + continue; + } + + /* Shorten the function call. */ + + /* For simplicity of coding, we are going to modify the section + contents, the section relocs, and the BFD symbol table. We + must tell the rest of the code not to free up this + information. It would be possible to instead create a table + of changes which have to be made, as is done in coff-mips.c; + that would be more work, but would require less memory when + the linker is run. */ + + if (coff_section_data (abfd, sec) == NULL) + { + bfd_size_type amt = sizeof (struct coff_section_tdata); + sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); + if (sec->used_by_bfd == NULL) + goto error_return; + } + + coff_section_data (abfd, sec)->relocs = internal_relocs; + coff_section_data (abfd, sec)->keep_relocs = TRUE; + free_relocs = NULL; + + coff_section_data (abfd, sec)->contents = contents; + coff_section_data (abfd, sec)->keep_contents = TRUE; + free_contents = NULL; + + obj_coff_keep_syms (abfd) = TRUE; + + /* Replace the jsr with a bsr. */ + + /* Change the R_SH_USES reloc into an R_SH_PCDISP reloc, and + replace the jsr with a bsr. */ + irel->r_type = R_SH_PCDISP; + irel->r_symndx = irelfn->r_symndx; + if (sym.n_sclass != C_EXT) + { + /* If this needs to be changed because of future relaxing, + it will be handled here like other internal PCDISP + relocs. */ + bfd_put_16 (abfd, + (bfd_vma) 0xb000 | ((foff >> 1) & 0xfff), + contents + irel->r_vaddr - sec->vma); + } + else + { + /* We can't fully resolve this yet, because the external + symbol value may be changed by future relaxing. We let + the final link phase handle it. */ + bfd_put_16 (abfd, (bfd_vma) 0xb000, + contents + irel->r_vaddr - sec->vma); + } + + /* See if there is another R_SH_USES reloc referring to the same + register load. */ + for (irelscan = internal_relocs; irelscan < irelend; irelscan++) + if (irelscan->r_type == R_SH_USES + && laddr == irelscan->r_vaddr - sec->vma + 4 + irelscan->r_offset) + break; + if (irelscan < irelend) + { + /* Some other function call depends upon this register load, + and we have not yet converted that function call. + Indeed, we may never be able to convert it. There is + nothing else we can do at this point. */ + continue; + } + + /* Look for a R_SH_COUNT reloc on the location where the + function address is stored. Do this before deleting any + bytes, to avoid confusion about the address. */ + for (irelcount = internal_relocs; irelcount < irelend; irelcount++) + if (irelcount->r_vaddr == paddr + && irelcount->r_type == R_SH_COUNT) + break; + + /* Delete the register load. */ + if (! sh_relax_delete_bytes (abfd, sec, laddr, 2)) + goto error_return; + + /* That will change things, so, just in case it permits some + other function call to come within range, we should relax + again. Note that this is not required, and it may be slow. */ + *again = TRUE; + + /* Now check whether we got a COUNT reloc. */ + if (irelcount >= irelend) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: could not find expected COUNT reloc", + bfd_archive_filename (abfd), (unsigned long) paddr)); + continue; + } + + /* The number of uses is stored in the r_offset field. We've + just deleted one. */ + if (irelcount->r_offset == 0) + { + ((*_bfd_error_handler) ("%s: 0x%lx: warning: bad count", + bfd_archive_filename (abfd), + (unsigned long) paddr)); + continue; + } + + --irelcount->r_offset; + + /* If there are no more uses, we can delete the address. Reload + the address from irelfn, in case it was changed by the + previous call to sh_relax_delete_bytes. */ + if (irelcount->r_offset == 0) + { + if (! sh_relax_delete_bytes (abfd, sec, + irelfn->r_vaddr - sec->vma, 4)) + goto error_return; + } + + /* We've done all we can with that function call. */ + } + + /* Look for load and store instructions that we can align on four + byte boundaries. */ + if (have_code) + { + bfd_boolean swapped; + + /* Get the section contents. */ + if (contents == NULL) + { + if (coff_section_data (abfd, sec) != NULL + && coff_section_data (abfd, sec)->contents != NULL) + contents = coff_section_data (abfd, sec)->contents; + else + { + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + free_contents = contents; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + if (! sh_align_loads (abfd, sec, internal_relocs, contents, &swapped)) + goto error_return; + + if (swapped) + { + if (coff_section_data (abfd, sec) == NULL) + { + bfd_size_type amt = sizeof (struct coff_section_tdata); + sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); + if (sec->used_by_bfd == NULL) + goto error_return; + } + + coff_section_data (abfd, sec)->relocs = internal_relocs; + coff_section_data (abfd, sec)->keep_relocs = TRUE; + free_relocs = NULL; + + coff_section_data (abfd, sec)->contents = contents; + coff_section_data (abfd, sec)->keep_contents = TRUE; + free_contents = NULL; + + obj_coff_keep_syms (abfd) = TRUE; + } + } + + if (free_relocs != NULL) + { + free (free_relocs); + free_relocs = NULL; + } + + if (free_contents != NULL) + { + if (! link_info->keep_memory) + free (free_contents); + else + { + /* Cache the section contents for coff_link_input_bfd. */ + if (coff_section_data (abfd, sec) == NULL) + { + bfd_size_type amt = sizeof (struct coff_section_tdata); + sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); + if (sec->used_by_bfd == NULL) + goto error_return; + coff_section_data (abfd, sec)->relocs = NULL; + } + coff_section_data (abfd, sec)->contents = contents; + } + } + + return TRUE; + + error_return: + if (free_relocs != NULL) + free (free_relocs); + if (free_contents != NULL) + free (free_contents); + return FALSE; +} + +/* Delete some bytes from a section while relaxing. */ + +static bfd_boolean +sh_relax_delete_bytes (abfd, sec, addr, count) + bfd *abfd; + asection *sec; + bfd_vma addr; + int count; +{ + bfd_byte *contents; + struct internal_reloc *irel, *irelend; + struct internal_reloc *irelalign; + bfd_vma toaddr; + bfd_byte *esym, *esymend; + bfd_size_type symesz; + struct coff_link_hash_entry **sym_hash; + asection *o; + + contents = coff_section_data (abfd, sec)->contents; + + /* The deletion must stop at the next ALIGN reloc for an aligment + power larger than the number of bytes we are deleting. */ + + irelalign = NULL; + toaddr = sec->_cooked_size; + + irel = coff_section_data (abfd, sec)->relocs; + irelend = irel + sec->reloc_count; + for (; irel < irelend; irel++) + { + if (irel->r_type == R_SH_ALIGN + && irel->r_vaddr - sec->vma > addr + && count < (1 << irel->r_offset)) + { + irelalign = irel; + toaddr = irel->r_vaddr - sec->vma; + break; + } + } + + /* Actually delete the bytes. */ + memmove (contents + addr, contents + addr + count, + (size_t) (toaddr - addr - count)); + if (irelalign == NULL) + sec->_cooked_size -= count; + else + { + int i; + +#define NOP_OPCODE (0x0009) + + BFD_ASSERT ((count & 1) == 0); + for (i = 0; i < count; i += 2) + bfd_put_16 (abfd, (bfd_vma) NOP_OPCODE, contents + toaddr - count + i); + } + + /* Adjust all the relocs. */ + for (irel = coff_section_data (abfd, sec)->relocs; irel < irelend; irel++) + { + bfd_vma nraddr, stop; + bfd_vma start = 0; + int insn = 0; + struct internal_syment sym; + int off, adjust, oinsn; + bfd_signed_vma voff = 0; + bfd_boolean overflow; + + /* Get the new reloc address. */ + nraddr = irel->r_vaddr - sec->vma; + if ((irel->r_vaddr - sec->vma > addr + && irel->r_vaddr - sec->vma < toaddr) + || (irel->r_type == R_SH_ALIGN + && irel->r_vaddr - sec->vma == toaddr)) + nraddr -= count; + + /* See if this reloc was for the bytes we have deleted, in which + case we no longer care about it. Don't delete relocs which + represent addresses, though. */ + if (irel->r_vaddr - sec->vma >= addr + && irel->r_vaddr - sec->vma < addr + count + && irel->r_type != R_SH_ALIGN + && irel->r_type != R_SH_CODE + && irel->r_type != R_SH_DATA + && irel->r_type != R_SH_LABEL) + irel->r_type = R_SH_UNUSED; + + /* If this is a PC relative reloc, see if the range it covers + includes the bytes we have deleted. */ + switch (irel->r_type) + { + default: + break; + + case R_SH_PCDISP8BY2: + case R_SH_PCDISP: + case R_SH_PCRELIMM8BY2: + case R_SH_PCRELIMM8BY4: + start = irel->r_vaddr - sec->vma; + insn = bfd_get_16 (abfd, contents + nraddr); + break; + } + + switch (irel->r_type) + { + default: + start = stop = addr; + break; + + case R_SH_IMM32: +#ifdef COFF_WITH_PE + case R_SH_IMM32CE: + case R_SH_IMAGEBASE: +#endif + /* If this reloc is against a symbol defined in this + section, and the symbol will not be adjusted below, we + must check the addend to see it will put the value in + range to be adjusted, and hence must be changed. */ + bfd_coff_swap_sym_in (abfd, + ((bfd_byte *) obj_coff_external_syms (abfd) + + (irel->r_symndx + * bfd_coff_symesz (abfd))), + &sym); + if (sym.n_sclass != C_EXT + && sym.n_scnum == sec->target_index + && ((bfd_vma) sym.n_value <= addr + || (bfd_vma) sym.n_value >= toaddr)) + { + bfd_vma val; + + val = bfd_get_32 (abfd, contents + nraddr); + val += sym.n_value; + if (val > addr && val < toaddr) + bfd_put_32 (abfd, val - count, contents + nraddr); + } + start = stop = addr; + break; + + case R_SH_PCDISP8BY2: + off = insn & 0xff; + if (off & 0x80) + off -= 0x100; + stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); + break; + + case R_SH_PCDISP: + bfd_coff_swap_sym_in (abfd, + ((bfd_byte *) obj_coff_external_syms (abfd) + + (irel->r_symndx + * bfd_coff_symesz (abfd))), + &sym); + if (sym.n_sclass == C_EXT) + start = stop = addr; + else + { + off = insn & 0xfff; + if (off & 0x800) + off -= 0x1000; + stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); + } + break; + + case R_SH_PCRELIMM8BY2: + off = insn & 0xff; + stop = start + 4 + off * 2; + break; + + case R_SH_PCRELIMM8BY4: + off = insn & 0xff; + stop = (start &~ (bfd_vma) 3) + 4 + off * 4; + break; + + case R_SH_SWITCH8: + case R_SH_SWITCH16: + case R_SH_SWITCH32: + /* These relocs types represent + .word L2-L1 + The r_offset field holds the difference between the reloc + address and L1. That is the start of the reloc, and + adding in the contents gives us the top. We must adjust + both the r_offset field and the section contents. */ + + start = irel->r_vaddr - sec->vma; + stop = (bfd_vma) ((bfd_signed_vma) start - (long) irel->r_offset); + + if (start > addr + && start < toaddr + && (stop <= addr || stop >= toaddr)) + irel->r_offset += count; + else if (stop > addr + && stop < toaddr + && (start <= addr || start >= toaddr)) + irel->r_offset -= count; + + start = stop; + + if (irel->r_type == R_SH_SWITCH16) + voff = bfd_get_signed_16 (abfd, contents + nraddr); + else if (irel->r_type == R_SH_SWITCH8) + voff = bfd_get_8 (abfd, contents + nraddr); + else + voff = bfd_get_signed_32 (abfd, contents + nraddr); + stop = (bfd_vma) ((bfd_signed_vma) start + voff); + + break; + + case R_SH_USES: + start = irel->r_vaddr - sec->vma; + stop = (bfd_vma) ((bfd_signed_vma) start + + (long) irel->r_offset + + 4); + break; + } + + if (start > addr + && start < toaddr + && (stop <= addr || stop >= toaddr)) + adjust = count; + else if (stop > addr + && stop < toaddr + && (start <= addr || start >= toaddr)) + adjust = - count; + else + adjust = 0; + + if (adjust != 0) + { + oinsn = insn; + overflow = FALSE; + switch (irel->r_type) + { + default: + abort (); + break; + + case R_SH_PCDISP8BY2: + case R_SH_PCRELIMM8BY2: + insn += adjust / 2; + if ((oinsn & 0xff00) != (insn & 0xff00)) + overflow = TRUE; + bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); + break; + + case R_SH_PCDISP: + insn += adjust / 2; + if ((oinsn & 0xf000) != (insn & 0xf000)) + overflow = TRUE; + bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); + break; + + case R_SH_PCRELIMM8BY4: + BFD_ASSERT (adjust == count || count >= 4); + if (count >= 4) + insn += adjust / 4; + else + { + if ((irel->r_vaddr & 3) == 0) + ++insn; + } + if ((oinsn & 0xff00) != (insn & 0xff00)) + overflow = TRUE; + bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); + break; + + case R_SH_SWITCH8: + voff += adjust; + if (voff < 0 || voff >= 0xff) + overflow = TRUE; + bfd_put_8 (abfd, (bfd_vma) voff, contents + nraddr); + break; + + case R_SH_SWITCH16: + voff += adjust; + if (voff < - 0x8000 || voff >= 0x8000) + overflow = TRUE; + bfd_put_signed_16 (abfd, (bfd_vma) voff, contents + nraddr); + break; + + case R_SH_SWITCH32: + voff += adjust; + bfd_put_signed_32 (abfd, (bfd_vma) voff, contents + nraddr); + break; + + case R_SH_USES: + irel->r_offset += adjust; + break; + } + + if (overflow) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: fatal: reloc overflow while relaxing", + bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + + irel->r_vaddr = nraddr + sec->vma; + } + + /* Look through all the other sections. If there contain any IMM32 + relocs against internal symbols which we are not going to adjust + below, we may need to adjust the addends. */ + for (o = abfd->sections; o != NULL; o = o->next) + { + struct internal_reloc *internal_relocs; + struct internal_reloc *irelscan, *irelscanend; + bfd_byte *ocontents; + + if (o == sec + || (o->flags & SEC_RELOC) == 0 + || o->reloc_count == 0) + continue; + + /* We always cache the relocs. Perhaps, if info->keep_memory is + FALSE, we should free them, if we are permitted to, when we + leave sh_coff_relax_section. */ + internal_relocs = (_bfd_coff_read_internal_relocs + (abfd, o, TRUE, (bfd_byte *) NULL, FALSE, + (struct internal_reloc *) NULL)); + if (internal_relocs == NULL) + return FALSE; + + ocontents = NULL; + irelscanend = internal_relocs + o->reloc_count; + for (irelscan = internal_relocs; irelscan < irelscanend; irelscan++) + { + struct internal_syment sym; + +#ifdef COFF_WITH_PE + if (irelscan->r_type != R_SH_IMM32 + && irelscan->r_type != R_SH_IMAGEBASE + && irelscan->r_type != R_SH_IMM32CE) +#else + if (irelscan->r_type != R_SH_IMM32) +#endif + continue; + + bfd_coff_swap_sym_in (abfd, + ((bfd_byte *) obj_coff_external_syms (abfd) + + (irelscan->r_symndx + * bfd_coff_symesz (abfd))), + &sym); + if (sym.n_sclass != C_EXT + && sym.n_scnum == sec->target_index + && ((bfd_vma) sym.n_value <= addr + || (bfd_vma) sym.n_value >= toaddr)) + { + bfd_vma val; + + if (ocontents == NULL) + { + if (coff_section_data (abfd, o)->contents != NULL) + ocontents = coff_section_data (abfd, o)->contents; + else + { + /* We always cache the section contents. + Perhaps, if info->keep_memory is FALSE, we + should free them, if we are permitted to, + when we leave sh_coff_relax_section. */ + ocontents = (bfd_byte *) bfd_malloc (o->_raw_size); + if (ocontents == NULL) + return FALSE; + if (! bfd_get_section_contents (abfd, o, ocontents, + (file_ptr) 0, + o->_raw_size)) + return FALSE; + coff_section_data (abfd, o)->contents = ocontents; + } + } + + val = bfd_get_32 (abfd, ocontents + irelscan->r_vaddr - o->vma); + val += sym.n_value; + if (val > addr && val < toaddr) + bfd_put_32 (abfd, val - count, + ocontents + irelscan->r_vaddr - o->vma); + + coff_section_data (abfd, o)->keep_contents = TRUE; + } + } + } + + /* Adjusting the internal symbols will not work if something has + already retrieved the generic symbols. It would be possible to + make this work by adjusting the generic symbols at the same time. + However, this case should not arise in normal usage. */ + if (obj_symbols (abfd) != NULL + || obj_raw_syments (abfd) != NULL) + { + ((*_bfd_error_handler) + ("%s: fatal: generic symbols retrieved before relaxing", + bfd_archive_filename (abfd))); + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } + + /* Adjust all the symbols. */ + sym_hash = obj_coff_sym_hashes (abfd); + symesz = bfd_coff_symesz (abfd); + esym = (bfd_byte *) obj_coff_external_syms (abfd); + esymend = esym + obj_raw_syment_count (abfd) * symesz; + while (esym < esymend) + { + struct internal_syment isym; + + bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &isym); + + if (isym.n_scnum == sec->target_index + && (bfd_vma) isym.n_value > addr + && (bfd_vma) isym.n_value < toaddr) + { + isym.n_value -= count; + + bfd_coff_swap_sym_out (abfd, (PTR) &isym, (PTR) esym); + + if (*sym_hash != NULL) + { + BFD_ASSERT ((*sym_hash)->root.type == bfd_link_hash_defined + || (*sym_hash)->root.type == bfd_link_hash_defweak); + BFD_ASSERT ((*sym_hash)->root.u.def.value >= addr + && (*sym_hash)->root.u.def.value < toaddr); + (*sym_hash)->root.u.def.value -= count; + } + } + + esym += (isym.n_numaux + 1) * symesz; + sym_hash += isym.n_numaux + 1; + } + + /* See if we can move the ALIGN reloc forward. We have adjusted + r_vaddr for it already. */ + if (irelalign != NULL) + { + bfd_vma alignto, alignaddr; + + alignto = BFD_ALIGN (toaddr, 1 << irelalign->r_offset); + alignaddr = BFD_ALIGN (irelalign->r_vaddr - sec->vma, + 1 << irelalign->r_offset); + if (alignto != alignaddr) + { + /* Tail recursion. */ + return sh_relax_delete_bytes (abfd, sec, alignaddr, + (int) (alignto - alignaddr)); + } + } + + return TRUE; +} + +/* This is yet another version of the SH opcode table, used to rapidly + get information about a particular instruction. */ + +/* The opcode map is represented by an array of these structures. The + array is indexed by the high order four bits in the instruction. */ + +struct sh_major_opcode +{ + /* A pointer to the instruction list. This is an array which + contains all the instructions with this major opcode. */ + const struct sh_minor_opcode *minor_opcodes; + /* The number of elements in minor_opcodes. */ + unsigned short count; +}; + +/* This structure holds information for a set of SH opcodes. The + instruction code is anded with the mask value, and the resulting + value is used to search the order opcode list. */ + +struct sh_minor_opcode +{ + /* The sorted opcode list. */ + const struct sh_opcode *opcodes; + /* The number of elements in opcodes. */ + unsigned short count; + /* The mask value to use when searching the opcode list. */ + unsigned short mask; +}; + +/* This structure holds information for an SH instruction. An array + of these structures is sorted in order by opcode. */ + +struct sh_opcode +{ + /* The code for this instruction, after it has been anded with the + mask value in the sh_major_opcode structure. */ + unsigned short opcode; + /* Flags for this instruction. */ + unsigned long flags; +}; + +/* Flag which appear in the sh_opcode structure. */ + +/* This instruction loads a value from memory. */ +#define LOAD (0x1) + +/* This instruction stores a value to memory. */ +#define STORE (0x2) + +/* This instruction is a branch. */ +#define BRANCH (0x4) + +/* This instruction has a delay slot. */ +#define DELAY (0x8) + +/* This instruction uses the value in the register in the field at + mask 0x0f00 of the instruction. */ +#define USES1 (0x10) +#define USES1_REG(x) ((x & 0x0f00) >> 8) + +/* This instruction uses the value in the register in the field at + mask 0x00f0 of the instruction. */ +#define USES2 (0x20) +#define USES2_REG(x) ((x & 0x00f0) >> 4) + +/* This instruction uses the value in register 0. */ +#define USESR0 (0x40) + +/* This instruction sets the value in the register in the field at + mask 0x0f00 of the instruction. */ +#define SETS1 (0x80) +#define SETS1_REG(x) ((x & 0x0f00) >> 8) + +/* This instruction sets the value in the register in the field at + mask 0x00f0 of the instruction. */ +#define SETS2 (0x100) +#define SETS2_REG(x) ((x & 0x00f0) >> 4) + +/* This instruction sets register 0. */ +#define SETSR0 (0x200) + +/* This instruction sets a special register. */ +#define SETSSP (0x400) + +/* This instruction uses a special register. */ +#define USESSP (0x800) + +/* This instruction uses the floating point register in the field at + mask 0x0f00 of the instruction. */ +#define USESF1 (0x1000) +#define USESF1_REG(x) ((x & 0x0f00) >> 8) + +/* This instruction uses the floating point register in the field at + mask 0x00f0 of the instruction. */ +#define USESF2 (0x2000) +#define USESF2_REG(x) ((x & 0x00f0) >> 4) + +/* This instruction uses floating point register 0. */ +#define USESF0 (0x4000) + +/* This instruction sets the floating point register in the field at + mask 0x0f00 of the instruction. */ +#define SETSF1 (0x8000) +#define SETSF1_REG(x) ((x & 0x0f00) >> 8) + +#define USESAS (0x10000) +#define USESAS_REG(x) (((((x) >> 8) - 2) & 3) + 2) +#define USESR8 (0x20000) +#define SETSAS (0x40000) +#define SETSAS_REG(x) USESAS_REG (x) + +#define MAP(a) a, sizeof a / sizeof a[0] + +#ifndef COFF_IMAGE_WITH_PE +static bfd_boolean sh_insn_uses_reg + PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); +static bfd_boolean sh_insn_sets_reg + PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); +static bfd_boolean sh_insn_uses_or_sets_reg + PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); +static bfd_boolean sh_insn_uses_freg + PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); +static bfd_boolean sh_insn_sets_freg + PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); +static bfd_boolean sh_insn_uses_or_sets_freg + PARAMS ((unsigned int, const struct sh_opcode *, unsigned int)); +static bfd_boolean sh_insns_conflict + PARAMS ((unsigned int, const struct sh_opcode *, unsigned int, + const struct sh_opcode *)); +static bfd_boolean sh_load_use + PARAMS ((unsigned int, const struct sh_opcode *, unsigned int, + const struct sh_opcode *)); + +/* The opcode maps. */ + +static const struct sh_opcode sh_opcode00[] = +{ + { 0x0008, SETSSP }, /* clrt */ + { 0x0009, 0 }, /* nop */ + { 0x000b, BRANCH | DELAY | USESSP }, /* rts */ + { 0x0018, SETSSP }, /* sett */ + { 0x0019, SETSSP }, /* div0u */ + { 0x001b, 0 }, /* sleep */ + { 0x0028, SETSSP }, /* clrmac */ + { 0x002b, BRANCH | DELAY | SETSSP }, /* rte */ + { 0x0038, USESSP | SETSSP }, /* ldtlb */ + { 0x0048, SETSSP }, /* clrs */ + { 0x0058, SETSSP } /* sets */ +}; + +static const struct sh_opcode sh_opcode01[] = +{ + { 0x0003, BRANCH | DELAY | USES1 | SETSSP }, /* bsrf rn */ + { 0x000a, SETS1 | USESSP }, /* sts mach,rn */ + { 0x001a, SETS1 | USESSP }, /* sts macl,rn */ + { 0x0023, BRANCH | DELAY | USES1 }, /* braf rn */ + { 0x0029, SETS1 | USESSP }, /* movt rn */ + { 0x002a, SETS1 | USESSP }, /* sts pr,rn */ + { 0x005a, SETS1 | USESSP }, /* sts fpul,rn */ + { 0x006a, SETS1 | USESSP }, /* sts fpscr,rn / sts dsr,rn */ + { 0x0083, LOAD | USES1 }, /* pref @rn */ + { 0x007a, SETS1 | USESSP }, /* sts a0,rn */ + { 0x008a, SETS1 | USESSP }, /* sts x0,rn */ + { 0x009a, SETS1 | USESSP }, /* sts x1,rn */ + { 0x00aa, SETS1 | USESSP }, /* sts y0,rn */ + { 0x00ba, SETS1 | USESSP } /* sts y1,rn */ +}; + +/* These sixteen instructions can be handled with one table entry below. */ +#if 0 + { 0x0002, SETS1 | USESSP }, /* stc sr,rn */ + { 0x0012, SETS1 | USESSP }, /* stc gbr,rn */ + { 0x0022, SETS1 | USESSP }, /* stc vbr,rn */ + { 0x0032, SETS1 | USESSP }, /* stc ssr,rn */ + { 0x0042, SETS1 | USESSP }, /* stc spc,rn */ + { 0x0052, SETS1 | USESSP }, /* stc mod,rn */ + { 0x0062, SETS1 | USESSP }, /* stc rs,rn */ + { 0x0072, SETS1 | USESSP }, /* stc re,rn */ + { 0x0082, SETS1 | USESSP }, /* stc r0_bank,rn */ + { 0x0092, SETS1 | USESSP }, /* stc r1_bank,rn */ + { 0x00a2, SETS1 | USESSP }, /* stc r2_bank,rn */ + { 0x00b2, SETS1 | USESSP }, /* stc r3_bank,rn */ + { 0x00c2, SETS1 | USESSP }, /* stc r4_bank,rn */ + { 0x00d2, SETS1 | USESSP }, /* stc r5_bank,rn */ + { 0x00e2, SETS1 | USESSP }, /* stc r6_bank,rn */ + { 0x00f2, SETS1 | USESSP } /* stc r7_bank,rn */ +#endif + +static const struct sh_opcode sh_opcode02[] = +{ + { 0x0002, SETS1 | USESSP }, /* stc ,rn */ + { 0x0004, STORE | USES1 | USES2 | USESR0 }, /* mov.b rm,@(r0,rn) */ + { 0x0005, STORE | USES1 | USES2 | USESR0 }, /* mov.w rm,@(r0,rn) */ + { 0x0006, STORE | USES1 | USES2 | USESR0 }, /* mov.l rm,@(r0,rn) */ + { 0x0007, SETSSP | USES1 | USES2 }, /* mul.l rm,rn */ + { 0x000c, LOAD | SETS1 | USES2 | USESR0 }, /* mov.b @(r0,rm),rn */ + { 0x000d, LOAD | SETS1 | USES2 | USESR0 }, /* mov.w @(r0,rm),rn */ + { 0x000e, LOAD | SETS1 | USES2 | USESR0 }, /* mov.l @(r0,rm),rn */ + { 0x000f, LOAD|SETS1|SETS2|SETSSP|USES1|USES2|USESSP }, /* mac.l @rm+,@rn+ */ +}; + +static const struct sh_minor_opcode sh_opcode0[] = +{ + { MAP (sh_opcode00), 0xffff }, + { MAP (sh_opcode01), 0xf0ff }, + { MAP (sh_opcode02), 0xf00f } +}; + +static const struct sh_opcode sh_opcode10[] = +{ + { 0x1000, STORE | USES1 | USES2 } /* mov.l rm,@(disp,rn) */ +}; + +static const struct sh_minor_opcode sh_opcode1[] = +{ + { MAP (sh_opcode10), 0xf000 } +}; + +static const struct sh_opcode sh_opcode20[] = +{ + { 0x2000, STORE | USES1 | USES2 }, /* mov.b rm,@rn */ + { 0x2001, STORE | USES1 | USES2 }, /* mov.w rm,@rn */ + { 0x2002, STORE | USES1 | USES2 }, /* mov.l rm,@rn */ + { 0x2004, STORE | SETS1 | USES1 | USES2 }, /* mov.b rm,@-rn */ + { 0x2005, STORE | SETS1 | USES1 | USES2 }, /* mov.w rm,@-rn */ + { 0x2006, STORE | SETS1 | USES1 | USES2 }, /* mov.l rm,@-rn */ + { 0x2007, SETSSP | USES1 | USES2 | USESSP }, /* div0s */ + { 0x2008, SETSSP | USES1 | USES2 }, /* tst rm,rn */ + { 0x2009, SETS1 | USES1 | USES2 }, /* and rm,rn */ + { 0x200a, SETS1 | USES1 | USES2 }, /* xor rm,rn */ + { 0x200b, SETS1 | USES1 | USES2 }, /* or rm,rn */ + { 0x200c, SETSSP | USES1 | USES2 }, /* cmp/str rm,rn */ + { 0x200d, SETS1 | USES1 | USES2 }, /* xtrct rm,rn */ + { 0x200e, SETSSP | USES1 | USES2 }, /* mulu.w rm,rn */ + { 0x200f, SETSSP | USES1 | USES2 } /* muls.w rm,rn */ +}; + +static const struct sh_minor_opcode sh_opcode2[] = +{ + { MAP (sh_opcode20), 0xf00f } +}; + +static const struct sh_opcode sh_opcode30[] = +{ + { 0x3000, SETSSP | USES1 | USES2 }, /* cmp/eq rm,rn */ + { 0x3002, SETSSP | USES1 | USES2 }, /* cmp/hs rm,rn */ + { 0x3003, SETSSP | USES1 | USES2 }, /* cmp/ge rm,rn */ + { 0x3004, SETSSP | USESSP | USES1 | USES2 }, /* div1 rm,rn */ + { 0x3005, SETSSP | USES1 | USES2 }, /* dmulu.l rm,rn */ + { 0x3006, SETSSP | USES1 | USES2 }, /* cmp/hi rm,rn */ + { 0x3007, SETSSP | USES1 | USES2 }, /* cmp/gt rm,rn */ + { 0x3008, SETS1 | USES1 | USES2 }, /* sub rm,rn */ + { 0x300a, SETS1 | SETSSP | USES1 | USES2 | USESSP }, /* subc rm,rn */ + { 0x300b, SETS1 | SETSSP | USES1 | USES2 }, /* subv rm,rn */ + { 0x300c, SETS1 | USES1 | USES2 }, /* add rm,rn */ + { 0x300d, SETSSP | USES1 | USES2 }, /* dmuls.l rm,rn */ + { 0x300e, SETS1 | SETSSP | USES1 | USES2 | USESSP }, /* addc rm,rn */ + { 0x300f, SETS1 | SETSSP | USES1 | USES2 } /* addv rm,rn */ +}; + +static const struct sh_minor_opcode sh_opcode3[] = +{ + { MAP (sh_opcode30), 0xf00f } +}; + +static const struct sh_opcode sh_opcode40[] = +{ + { 0x4000, SETS1 | SETSSP | USES1 }, /* shll rn */ + { 0x4001, SETS1 | SETSSP | USES1 }, /* shlr rn */ + { 0x4002, STORE | SETS1 | USES1 | USESSP }, /* sts.l mach,@-rn */ + { 0x4004, SETS1 | SETSSP | USES1 }, /* rotl rn */ + { 0x4005, SETS1 | SETSSP | USES1 }, /* rotr rn */ + { 0x4006, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,mach */ + { 0x4008, SETS1 | USES1 }, /* shll2 rn */ + { 0x4009, SETS1 | USES1 }, /* shlr2 rn */ + { 0x400a, SETSSP | USES1 }, /* lds rm,mach */ + { 0x400b, BRANCH | DELAY | USES1 }, /* jsr @rn */ + { 0x4010, SETS1 | SETSSP | USES1 }, /* dt rn */ + { 0x4011, SETSSP | USES1 }, /* cmp/pz rn */ + { 0x4012, STORE | SETS1 | USES1 | USESSP }, /* sts.l macl,@-rn */ + { 0x4014, SETSSP | USES1 }, /* setrc rm */ + { 0x4015, SETSSP | USES1 }, /* cmp/pl rn */ + { 0x4016, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,macl */ + { 0x4018, SETS1 | USES1 }, /* shll8 rn */ + { 0x4019, SETS1 | USES1 }, /* shlr8 rn */ + { 0x401a, SETSSP | USES1 }, /* lds rm,macl */ + { 0x401b, LOAD | SETSSP | USES1 }, /* tas.b @rn */ + { 0x4020, SETS1 | SETSSP | USES1 }, /* shal rn */ + { 0x4021, SETS1 | SETSSP | USES1 }, /* shar rn */ + { 0x4022, STORE | SETS1 | USES1 | USESSP }, /* sts.l pr,@-rn */ + { 0x4024, SETS1 | SETSSP | USES1 | USESSP }, /* rotcl rn */ + { 0x4025, SETS1 | SETSSP | USES1 | USESSP }, /* rotcr rn */ + { 0x4026, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,pr */ + { 0x4028, SETS1 | USES1 }, /* shll16 rn */ + { 0x4029, SETS1 | USES1 }, /* shlr16 rn */ + { 0x402a, SETSSP | USES1 }, /* lds rm,pr */ + { 0x402b, BRANCH | DELAY | USES1 }, /* jmp @rn */ + { 0x4052, STORE | SETS1 | USES1 | USESSP }, /* sts.l fpul,@-rn */ + { 0x4056, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,fpul */ + { 0x405a, SETSSP | USES1 }, /* lds.l rm,fpul */ + { 0x4062, STORE | SETS1 | USES1 | USESSP }, /* sts.l fpscr / dsr,@-rn */ + { 0x4066, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,fpscr / dsr */ + { 0x406a, SETSSP | USES1 }, /* lds rm,fpscr / lds rm,dsr */ + { 0x4072, STORE | SETS1 | USES1 | USESSP }, /* sts.l a0,@-rn */ + { 0x4076, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,a0 */ + { 0x407a, SETSSP | USES1 }, /* lds.l rm,a0 */ + { 0x4082, STORE | SETS1 | USES1 | USESSP }, /* sts.l x0,@-rn */ + { 0x4086, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,x0 */ + { 0x408a, SETSSP | USES1 }, /* lds.l rm,x0 */ + { 0x4092, STORE | SETS1 | USES1 | USESSP }, /* sts.l x1,@-rn */ + { 0x4096, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,x1 */ + { 0x409a, SETSSP | USES1 }, /* lds.l rm,x1 */ + { 0x40a2, STORE | SETS1 | USES1 | USESSP }, /* sts.l y0,@-rn */ + { 0x40a6, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,y0 */ + { 0x40aa, SETSSP | USES1 }, /* lds.l rm,y0 */ + { 0x40b2, STORE | SETS1 | USES1 | USESSP }, /* sts.l y1,@-rn */ + { 0x40b6, LOAD | SETS1 | SETSSP | USES1 }, /* lds.l @rm+,y1 */ + { 0x40ba, SETSSP | USES1 } /* lds.l rm,y1 */ +#if 0 /* These groups sixteen insns can be + handled with one table entry each below. */ + { 0x4003, STORE | SETS1 | USES1 | USESSP }, /* stc.l sr,@-rn */ + { 0x4013, STORE | SETS1 | USES1 | USESSP }, /* stc.l gbr,@-rn */ + { 0x4023, STORE | SETS1 | USES1 | USESSP }, /* stc.l vbr,@-rn */ + { 0x4033, STORE | SETS1 | USES1 | USESSP }, /* stc.l ssr,@-rn */ + { 0x4043, STORE | SETS1 | USES1 | USESSP }, /* stc.l spc,@-rn */ + { 0x4053, STORE | SETS1 | USES1 | USESSP }, /* stc.l mod,@-rn */ + { 0x4063, STORE | SETS1 | USES1 | USESSP }, /* stc.l rs,@-rn */ + { 0x4073, STORE | SETS1 | USES1 | USESSP }, /* stc.l re,@-rn */ + { 0x4083, STORE | SETS1 | USES1 | USESSP }, /* stc.l r0_bank,@-rn */ + .. + { 0x40f3, STORE | SETS1 | USES1 | USESSP }, /* stc.l r7_bank,@-rn */ + + { 0x4007, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,sr */ + { 0x4017, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,gbr */ + { 0x4027, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,vbr */ + { 0x4037, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,ssr */ + { 0x4047, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,spc */ + { 0x4057, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,mod */ + { 0x4067, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,rs */ + { 0x4077, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,re */ + { 0x4087, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,r0_bank */ + .. + { 0x40f7, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+,r7_bank */ + + { 0x400e, SETSSP | USES1 }, /* ldc rm,sr */ + { 0x401e, SETSSP | USES1 }, /* ldc rm,gbr */ + { 0x402e, SETSSP | USES1 }, /* ldc rm,vbr */ + { 0x403e, SETSSP | USES1 }, /* ldc rm,ssr */ + { 0x404e, SETSSP | USES1 }, /* ldc rm,spc */ + { 0x405e, SETSSP | USES1 }, /* ldc rm,mod */ + { 0x406e, SETSSP | USES1 }, /* ldc rm,rs */ + { 0x407e, SETSSP | USES1 } /* ldc rm,re */ + { 0x408e, SETSSP | USES1 } /* ldc rm,r0_bank */ + .. + { 0x40fe, SETSSP | USES1 } /* ldc rm,r7_bank */ +#endif +}; + +static const struct sh_opcode sh_opcode41[] = +{ + { 0x4003, STORE | SETS1 | USES1 | USESSP }, /* stc.l ,@-rn */ + { 0x4007, LOAD | SETS1 | SETSSP | USES1 }, /* ldc.l @rm+, */ + { 0x400c, SETS1 | USES1 | USES2 }, /* shad rm,rn */ + { 0x400d, SETS1 | USES1 | USES2 }, /* shld rm,rn */ + { 0x400e, SETSSP | USES1 }, /* ldc rm, */ + { 0x400f, LOAD|SETS1|SETS2|SETSSP|USES1|USES2|USESSP }, /* mac.w @rm+,@rn+ */ +}; + +static const struct sh_minor_opcode sh_opcode4[] = +{ + { MAP (sh_opcode40), 0xf0ff }, + { MAP (sh_opcode41), 0xf00f } +}; + +static const struct sh_opcode sh_opcode50[] = +{ + { 0x5000, LOAD | SETS1 | USES2 } /* mov.l @(disp,rm),rn */ +}; + +static const struct sh_minor_opcode sh_opcode5[] = +{ + { MAP (sh_opcode50), 0xf000 } +}; + +static const struct sh_opcode sh_opcode60[] = +{ + { 0x6000, LOAD | SETS1 | USES2 }, /* mov.b @rm,rn */ + { 0x6001, LOAD | SETS1 | USES2 }, /* mov.w @rm,rn */ + { 0x6002, LOAD | SETS1 | USES2 }, /* mov.l @rm,rn */ + { 0x6003, SETS1 | USES2 }, /* mov rm,rn */ + { 0x6004, LOAD | SETS1 | SETS2 | USES2 }, /* mov.b @rm+,rn */ + { 0x6005, LOAD | SETS1 | SETS2 | USES2 }, /* mov.w @rm+,rn */ + { 0x6006, LOAD | SETS1 | SETS2 | USES2 }, /* mov.l @rm+,rn */ + { 0x6007, SETS1 | USES2 }, /* not rm,rn */ + { 0x6008, SETS1 | USES2 }, /* swap.b rm,rn */ + { 0x6009, SETS1 | USES2 }, /* swap.w rm,rn */ + { 0x600a, SETS1 | SETSSP | USES2 | USESSP }, /* negc rm,rn */ + { 0x600b, SETS1 | USES2 }, /* neg rm,rn */ + { 0x600c, SETS1 | USES2 }, /* extu.b rm,rn */ + { 0x600d, SETS1 | USES2 }, /* extu.w rm,rn */ + { 0x600e, SETS1 | USES2 }, /* exts.b rm,rn */ + { 0x600f, SETS1 | USES2 } /* exts.w rm,rn */ +}; + +static const struct sh_minor_opcode sh_opcode6[] = +{ + { MAP (sh_opcode60), 0xf00f } +}; + +static const struct sh_opcode sh_opcode70[] = +{ + { 0x7000, SETS1 | USES1 } /* add #imm,rn */ +}; + +static const struct sh_minor_opcode sh_opcode7[] = +{ + { MAP (sh_opcode70), 0xf000 } +}; + +static const struct sh_opcode sh_opcode80[] = +{ + { 0x8000, STORE | USES2 | USESR0 }, /* mov.b r0,@(disp,rn) */ + { 0x8100, STORE | USES2 | USESR0 }, /* mov.w r0,@(disp,rn) */ + { 0x8200, SETSSP }, /* setrc #imm */ + { 0x8400, LOAD | SETSR0 | USES2 }, /* mov.b @(disp,rm),r0 */ + { 0x8500, LOAD | SETSR0 | USES2 }, /* mov.w @(disp,rn),r0 */ + { 0x8800, SETSSP | USESR0 }, /* cmp/eq #imm,r0 */ + { 0x8900, BRANCH | USESSP }, /* bt label */ + { 0x8b00, BRANCH | USESSP }, /* bf label */ + { 0x8c00, SETSSP }, /* ldrs @(disp,pc) */ + { 0x8d00, BRANCH | DELAY | USESSP }, /* bt/s label */ + { 0x8e00, SETSSP }, /* ldre @(disp,pc) */ + { 0x8f00, BRANCH | DELAY | USESSP } /* bf/s label */ +}; + +static const struct sh_minor_opcode sh_opcode8[] = +{ + { MAP (sh_opcode80), 0xff00 } +}; + +static const struct sh_opcode sh_opcode90[] = +{ + { 0x9000, LOAD | SETS1 } /* mov.w @(disp,pc),rn */ +}; + +static const struct sh_minor_opcode sh_opcode9[] = +{ + { MAP (sh_opcode90), 0xf000 } +}; + +static const struct sh_opcode sh_opcodea0[] = +{ + { 0xa000, BRANCH | DELAY } /* bra label */ +}; + +static const struct sh_minor_opcode sh_opcodea[] = +{ + { MAP (sh_opcodea0), 0xf000 } +}; + +static const struct sh_opcode sh_opcodeb0[] = +{ + { 0xb000, BRANCH | DELAY } /* bsr label */ +}; + +static const struct sh_minor_opcode sh_opcodeb[] = +{ + { MAP (sh_opcodeb0), 0xf000 } +}; + +static const struct sh_opcode sh_opcodec0[] = +{ + { 0xc000, STORE | USESR0 | USESSP }, /* mov.b r0,@(disp,gbr) */ + { 0xc100, STORE | USESR0 | USESSP }, /* mov.w r0,@(disp,gbr) */ + { 0xc200, STORE | USESR0 | USESSP }, /* mov.l r0,@(disp,gbr) */ + { 0xc300, BRANCH | USESSP }, /* trapa #imm */ + { 0xc400, LOAD | SETSR0 | USESSP }, /* mov.b @(disp,gbr),r0 */ + { 0xc500, LOAD | SETSR0 | USESSP }, /* mov.w @(disp,gbr),r0 */ + { 0xc600, LOAD | SETSR0 | USESSP }, /* mov.l @(disp,gbr),r0 */ + { 0xc700, SETSR0 }, /* mova @(disp,pc),r0 */ + { 0xc800, SETSSP | USESR0 }, /* tst #imm,r0 */ + { 0xc900, SETSR0 | USESR0 }, /* and #imm,r0 */ + { 0xca00, SETSR0 | USESR0 }, /* xor #imm,r0 */ + { 0xcb00, SETSR0 | USESR0 }, /* or #imm,r0 */ + { 0xcc00, LOAD | SETSSP | USESR0 | USESSP }, /* tst.b #imm,@(r0,gbr) */ + { 0xcd00, LOAD | STORE | USESR0 | USESSP }, /* and.b #imm,@(r0,gbr) */ + { 0xce00, LOAD | STORE | USESR0 | USESSP }, /* xor.b #imm,@(r0,gbr) */ + { 0xcf00, LOAD | STORE | USESR0 | USESSP } /* or.b #imm,@(r0,gbr) */ +}; + +static const struct sh_minor_opcode sh_opcodec[] = +{ + { MAP (sh_opcodec0), 0xff00 } +}; + +static const struct sh_opcode sh_opcoded0[] = +{ + { 0xd000, LOAD | SETS1 } /* mov.l @(disp,pc),rn */ +}; + +static const struct sh_minor_opcode sh_opcoded[] = +{ + { MAP (sh_opcoded0), 0xf000 } +}; + +static const struct sh_opcode sh_opcodee0[] = +{ + { 0xe000, SETS1 } /* mov #imm,rn */ +}; + +static const struct sh_minor_opcode sh_opcodee[] = +{ + { MAP (sh_opcodee0), 0xf000 } +}; + +static const struct sh_opcode sh_opcodef0[] = +{ + { 0xf000, SETSF1 | USESF1 | USESF2 }, /* fadd fm,fn */ + { 0xf001, SETSF1 | USESF1 | USESF2 }, /* fsub fm,fn */ + { 0xf002, SETSF1 | USESF1 | USESF2 }, /* fmul fm,fn */ + { 0xf003, SETSF1 | USESF1 | USESF2 }, /* fdiv fm,fn */ + { 0xf004, SETSSP | USESF1 | USESF2 }, /* fcmp/eq fm,fn */ + { 0xf005, SETSSP | USESF1 | USESF2 }, /* fcmp/gt fm,fn */ + { 0xf006, LOAD | SETSF1 | USES2 | USESR0 }, /* fmov.s @(r0,rm),fn */ + { 0xf007, STORE | USES1 | USESF2 | USESR0 }, /* fmov.s fm,@(r0,rn) */ + { 0xf008, LOAD | SETSF1 | USES2 }, /* fmov.s @rm,fn */ + { 0xf009, LOAD | SETS2 | SETSF1 | USES2 }, /* fmov.s @rm+,fn */ + { 0xf00a, STORE | USES1 | USESF2 }, /* fmov.s fm,@rn */ + { 0xf00b, STORE | SETS1 | USES1 | USESF2 }, /* fmov.s fm,@-rn */ + { 0xf00c, SETSF1 | USESF2 }, /* fmov fm,fn */ + { 0xf00e, SETSF1 | USESF1 | USESF2 | USESF0 } /* fmac f0,fm,fn */ +}; + +static const struct sh_opcode sh_opcodef1[] = +{ + { 0xf00d, SETSF1 | USESSP }, /* fsts fpul,fn */ + { 0xf01d, SETSSP | USESF1 }, /* flds fn,fpul */ + { 0xf02d, SETSF1 | USESSP }, /* float fpul,fn */ + { 0xf03d, SETSSP | USESF1 }, /* ftrc fn,fpul */ + { 0xf04d, SETSF1 | USESF1 }, /* fneg fn */ + { 0xf05d, SETSF1 | USESF1 }, /* fabs fn */ + { 0xf06d, SETSF1 | USESF1 }, /* fsqrt fn */ + { 0xf07d, SETSSP | USESF1 }, /* ftst/nan fn */ + { 0xf08d, SETSF1 }, /* fldi0 fn */ + { 0xf09d, SETSF1 } /* fldi1 fn */ +}; + +static const struct sh_minor_opcode sh_opcodef[] = +{ + { MAP (sh_opcodef0), 0xf00f }, + { MAP (sh_opcodef1), 0xf0ff } +}; + +static struct sh_major_opcode sh_opcodes[] = +{ + { MAP (sh_opcode0) }, + { MAP (sh_opcode1) }, + { MAP (sh_opcode2) }, + { MAP (sh_opcode3) }, + { MAP (sh_opcode4) }, + { MAP (sh_opcode5) }, + { MAP (sh_opcode6) }, + { MAP (sh_opcode7) }, + { MAP (sh_opcode8) }, + { MAP (sh_opcode9) }, + { MAP (sh_opcodea) }, + { MAP (sh_opcodeb) }, + { MAP (sh_opcodec) }, + { MAP (sh_opcoded) }, + { MAP (sh_opcodee) }, + { MAP (sh_opcodef) } +}; + +/* The double data transfer / parallel processing insns are not + described here. This will cause sh_align_load_span to leave them alone. */ + +static const struct sh_opcode sh_dsp_opcodef0[] = +{ + { 0xf400, USESAS | SETSAS | LOAD | SETSSP }, /* movs.x @-as,ds */ + { 0xf401, USESAS | SETSAS | STORE | USESSP }, /* movs.x ds,@-as */ + { 0xf404, USESAS | LOAD | SETSSP }, /* movs.x @as,ds */ + { 0xf405, USESAS | STORE | USESSP }, /* movs.x ds,@as */ + { 0xf408, USESAS | SETSAS | LOAD | SETSSP }, /* movs.x @as+,ds */ + { 0xf409, USESAS | SETSAS | STORE | USESSP }, /* movs.x ds,@as+ */ + { 0xf40c, USESAS | SETSAS | LOAD | SETSSP | USESR8 }, /* movs.x @as+r8,ds */ + { 0xf40d, USESAS | SETSAS | STORE | USESSP | USESR8 } /* movs.x ds,@as+r8 */ +}; + +static const struct sh_minor_opcode sh_dsp_opcodef[] = +{ + { MAP (sh_dsp_opcodef0), 0xfc0d } +}; + +/* Given an instruction, return a pointer to the corresponding + sh_opcode structure. Return NULL if the instruction is not + recognized. */ + +static const struct sh_opcode * +sh_insn_info (insn) + unsigned int insn; +{ + const struct sh_major_opcode *maj; + const struct sh_minor_opcode *min, *minend; + + maj = &sh_opcodes[(insn & 0xf000) >> 12]; + min = maj->minor_opcodes; + minend = min + maj->count; + for (; min < minend; min++) + { + unsigned int l; + const struct sh_opcode *op, *opend; + + l = insn & min->mask; + op = min->opcodes; + opend = op + min->count; + + /* Since the opcodes tables are sorted, we could use a binary + search here if the count were above some cutoff value. */ + for (; op < opend; op++) + if (op->opcode == l) + return op; + } + + return NULL; +} + +/* See whether an instruction uses or sets a general purpose register */ + +static bfd_boolean +sh_insn_uses_or_sets_reg (insn, op, reg) + unsigned int insn; + const struct sh_opcode *op; + unsigned int reg; +{ + if (sh_insn_uses_reg (insn, op, reg)) + return TRUE; + + return sh_insn_sets_reg (insn, op, reg); +} + +/* See whether an instruction uses a general purpose register. */ + +static bfd_boolean +sh_insn_uses_reg (insn, op, reg) + unsigned int insn; + const struct sh_opcode *op; + unsigned int reg; +{ + unsigned int f; + + f = op->flags; + + if ((f & USES1) != 0 + && USES1_REG (insn) == reg) + return TRUE; + if ((f & USES2) != 0 + && USES2_REG (insn) == reg) + return TRUE; + if ((f & USESR0) != 0 + && reg == 0) + return TRUE; + if ((f & USESAS) && reg == USESAS_REG (insn)) + return TRUE; + if ((f & USESR8) && reg == 8) + return TRUE; + + return FALSE; +} + +/* See whether an instruction sets a general purpose register. */ + +static bfd_boolean +sh_insn_sets_reg (insn, op, reg) + unsigned int insn; + const struct sh_opcode *op; + unsigned int reg; +{ + unsigned int f; + + f = op->flags; + + if ((f & SETS1) != 0 + && SETS1_REG (insn) == reg) + return TRUE; + if ((f & SETS2) != 0 + && SETS2_REG (insn) == reg) + return TRUE; + if ((f & SETSR0) != 0 + && reg == 0) + return TRUE; + if ((f & SETSAS) && reg == SETSAS_REG (insn)) + return TRUE; + + return FALSE; +} + +/* See whether an instruction uses or sets a floating point register */ + +static bfd_boolean +sh_insn_uses_or_sets_freg (insn, op, reg) + unsigned int insn; + const struct sh_opcode *op; + unsigned int reg; +{ + if (sh_insn_uses_freg (insn, op, reg)) + return TRUE; + + return sh_insn_sets_freg (insn, op, reg); +} + +/* See whether an instruction uses a floating point register. */ + +static bfd_boolean +sh_insn_uses_freg (insn, op, freg) + unsigned int insn; + const struct sh_opcode *op; + unsigned int freg; +{ + unsigned int f; + + f = op->flags; + + /* We can't tell if this is a double-precision insn, so just play safe + and assume that it might be. So not only have we test FREG against + itself, but also even FREG against FREG+1 - if the using insn uses + just the low part of a double precision value - but also an odd + FREG against FREG-1 - if the setting insn sets just the low part + of a double precision value. + So what this all boils down to is that we have to ignore the lowest + bit of the register number. */ + + if ((f & USESF1) != 0 + && (USESF1_REG (insn) & 0xe) == (freg & 0xe)) + return TRUE; + if ((f & USESF2) != 0 + && (USESF2_REG (insn) & 0xe) == (freg & 0xe)) + return TRUE; + if ((f & USESF0) != 0 + && freg == 0) + return TRUE; + + return FALSE; +} + +/* See whether an instruction sets a floating point register. */ + +static bfd_boolean +sh_insn_sets_freg (insn, op, freg) + unsigned int insn; + const struct sh_opcode *op; + unsigned int freg; +{ + unsigned int f; + + f = op->flags; + + /* We can't tell if this is a double-precision insn, so just play safe + and assume that it might be. So not only have we test FREG against + itself, but also even FREG against FREG+1 - if the using insn uses + just the low part of a double precision value - but also an odd + FREG against FREG-1 - if the setting insn sets just the low part + of a double precision value. + So what this all boils down to is that we have to ignore the lowest + bit of the register number. */ + + if ((f & SETSF1) != 0 + && (SETSF1_REG (insn) & 0xe) == (freg & 0xe)) + return TRUE; + + return FALSE; +} + +/* See whether instructions I1 and I2 conflict, assuming I1 comes + before I2. OP1 and OP2 are the corresponding sh_opcode structures. + This should return TRUE if there is a conflict, or FALSE if the + instructions can be swapped safely. */ + +static bfd_boolean +sh_insns_conflict (i1, op1, i2, op2) + unsigned int i1; + const struct sh_opcode *op1; + unsigned int i2; + const struct sh_opcode *op2; +{ + unsigned int f1, f2; + + f1 = op1->flags; + f2 = op2->flags; + + /* Load of fpscr conflicts with floating point operations. + FIXME: shouldn't test raw opcodes here. */ + if (((i1 & 0xf0ff) == 0x4066 && (i2 & 0xf000) == 0xf000) + || ((i2 & 0xf0ff) == 0x4066 && (i1 & 0xf000) == 0xf000)) + return TRUE; + + if ((f1 & (BRANCH | DELAY)) != 0 + || (f2 & (BRANCH | DELAY)) != 0) + return TRUE; + + if (((f1 | f2) & SETSSP) + && (f1 & (SETSSP | USESSP)) + && (f2 & (SETSSP | USESSP))) + return TRUE; + + if ((f1 & SETS1) != 0 + && sh_insn_uses_or_sets_reg (i2, op2, SETS1_REG (i1))) + return TRUE; + if ((f1 & SETS2) != 0 + && sh_insn_uses_or_sets_reg (i2, op2, SETS2_REG (i1))) + return TRUE; + if ((f1 & SETSR0) != 0 + && sh_insn_uses_or_sets_reg (i2, op2, 0)) + return TRUE; + if ((f1 & SETSAS) + && sh_insn_uses_or_sets_reg (i2, op2, SETSAS_REG (i1))) + return TRUE; + if ((f1 & SETSF1) != 0 + && sh_insn_uses_or_sets_freg (i2, op2, SETSF1_REG (i1))) + return TRUE; + + if ((f2 & SETS1) != 0 + && sh_insn_uses_or_sets_reg (i1, op1, SETS1_REG (i2))) + return TRUE; + if ((f2 & SETS2) != 0 + && sh_insn_uses_or_sets_reg (i1, op1, SETS2_REG (i2))) + return TRUE; + if ((f2 & SETSR0) != 0 + && sh_insn_uses_or_sets_reg (i1, op1, 0)) + return TRUE; + if ((f2 & SETSAS) + && sh_insn_uses_or_sets_reg (i1, op1, SETSAS_REG (i2))) + return TRUE; + if ((f2 & SETSF1) != 0 + && sh_insn_uses_or_sets_freg (i1, op1, SETSF1_REG (i2))) + return TRUE; + + /* The instructions do not conflict. */ + return FALSE; +} + +/* I1 is a load instruction, and I2 is some other instruction. Return + TRUE if I1 loads a register which I2 uses. */ + +static bfd_boolean +sh_load_use (i1, op1, i2, op2) + unsigned int i1; + const struct sh_opcode *op1; + unsigned int i2; + const struct sh_opcode *op2; +{ + unsigned int f1; + + f1 = op1->flags; + + if ((f1 & LOAD) == 0) + return FALSE; + + /* If both SETS1 and SETSSP are set, that means a load to a special + register using postincrement addressing mode, which we don't care + about here. */ + if ((f1 & SETS1) != 0 + && (f1 & SETSSP) == 0 + && sh_insn_uses_reg (i2, op2, (i1 & 0x0f00) >> 8)) + return TRUE; + + if ((f1 & SETSR0) != 0 + && sh_insn_uses_reg (i2, op2, 0)) + return TRUE; + + if ((f1 & SETSF1) != 0 + && sh_insn_uses_freg (i2, op2, (i1 & 0x0f00) >> 8)) + return TRUE; + + return FALSE; +} + +/* Try to align loads and stores within a span of memory. This is + called by both the ELF and the COFF sh targets. ABFD and SEC are + the BFD and section we are examining. CONTENTS is the contents of + the section. SWAP is the routine to call to swap two instructions. + RELOCS is a pointer to the internal relocation information, to be + passed to SWAP. PLABEL is a pointer to the current label in a + sorted list of labels; LABEL_END is the end of the list. START and + STOP are the range of memory to examine. If a swap is made, + *PSWAPPED is set to TRUE. */ + +#ifdef COFF_WITH_PE +static +#endif +bfd_boolean +_bfd_sh_align_load_span (abfd, sec, contents, swap, relocs, + plabel, label_end, start, stop, pswapped) + bfd *abfd; + asection *sec; + bfd_byte *contents; + bfd_boolean (*swap) PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); + PTR relocs; + bfd_vma **plabel; + bfd_vma *label_end; + bfd_vma start; + bfd_vma stop; + bfd_boolean *pswapped; +{ + int dsp = (abfd->arch_info->mach == bfd_mach_sh_dsp + || abfd->arch_info->mach == bfd_mach_sh3_dsp); + bfd_vma i; + + /* The SH4 has a Harvard architecture, hence aligning loads is not + desirable. In fact, it is counter-productive, since it interferes + with the schedules generated by the compiler. */ + if (abfd->arch_info->mach == bfd_mach_sh4) + return TRUE; + + /* If we are linking sh[3]-dsp code, swap the FPU instructions for DSP + instructions. */ + if (dsp) + { + sh_opcodes[0xf].minor_opcodes = sh_dsp_opcodef; + sh_opcodes[0xf].count = sizeof sh_dsp_opcodef / sizeof sh_dsp_opcodef; + } + + /* Instructions should be aligned on 2 byte boundaries. */ + if ((start & 1) == 1) + ++start; + + /* Now look through the unaligned addresses. */ + i = start; + if ((i & 2) == 0) + i += 2; + for (; i < stop; i += 4) + { + unsigned int insn; + const struct sh_opcode *op; + unsigned int prev_insn = 0; + const struct sh_opcode *prev_op = NULL; + + insn = bfd_get_16 (abfd, contents + i); + op = sh_insn_info (insn); + if (op == NULL + || (op->flags & (LOAD | STORE)) == 0) + continue; + + /* This is a load or store which is not on a four byte boundary. */ + + while (*plabel < label_end && **plabel < i) + ++*plabel; + + if (i > start) + { + prev_insn = bfd_get_16 (abfd, contents + i - 2); + /* If INSN is the field b of a parallel processing insn, it is not + a load / store after all. Note that the test here might mistake + the field_b of a pcopy insn for the starting code of a parallel + processing insn; this might miss a swapping opportunity, but at + least we're on the safe side. */ + if (dsp && (prev_insn & 0xfc00) == 0xf800) + continue; + + /* Check if prev_insn is actually the field b of a parallel + processing insn. Again, this can give a spurious match + after a pcopy. */ + if (dsp && i - 2 > start) + { + unsigned pprev_insn = bfd_get_16 (abfd, contents + i - 4); + + if ((pprev_insn & 0xfc00) == 0xf800) + prev_op = NULL; + else + prev_op = sh_insn_info (prev_insn); + } + else + prev_op = sh_insn_info (prev_insn); + + /* If the load/store instruction is in a delay slot, we + can't swap. */ + if (prev_op == NULL + || (prev_op->flags & DELAY) != 0) + continue; + } + if (i > start + && (*plabel >= label_end || **plabel != i) + && prev_op != NULL + && (prev_op->flags & (LOAD | STORE)) == 0 + && ! sh_insns_conflict (prev_insn, prev_op, insn, op)) + { + bfd_boolean ok; + + /* The load/store instruction does not have a label, and + there is a previous instruction; PREV_INSN is not + itself a load/store instruction, and PREV_INSN and + INSN do not conflict. */ + + ok = TRUE; + + if (i >= start + 4) + { + unsigned int prev2_insn; + const struct sh_opcode *prev2_op; + + prev2_insn = bfd_get_16 (abfd, contents + i - 4); + prev2_op = sh_insn_info (prev2_insn); + + /* If the instruction before PREV_INSN has a delay + slot--that is, PREV_INSN is in a delay slot--we + can not swap. */ + if (prev2_op == NULL + || (prev2_op->flags & DELAY) != 0) + ok = FALSE; + + /* If the instruction before PREV_INSN is a load, + and it sets a register which INSN uses, then + putting INSN immediately after PREV_INSN will + cause a pipeline bubble, so there is no point to + making the swap. */ + if (ok + && (prev2_op->flags & LOAD) != 0 + && sh_load_use (prev2_insn, prev2_op, insn, op)) + ok = FALSE; + } + + if (ok) + { + if (! (*swap) (abfd, sec, relocs, contents, i - 2)) + return FALSE; + *pswapped = TRUE; + continue; + } + } + + while (*plabel < label_end && **plabel < i + 2) + ++*plabel; + + if (i + 2 < stop + && (*plabel >= label_end || **plabel != i + 2)) + { + unsigned int next_insn; + const struct sh_opcode *next_op; + + /* There is an instruction after the load/store + instruction, and it does not have a label. */ + next_insn = bfd_get_16 (abfd, contents + i + 2); + next_op = sh_insn_info (next_insn); + if (next_op != NULL + && (next_op->flags & (LOAD | STORE)) == 0 + && ! sh_insns_conflict (insn, op, next_insn, next_op)) + { + bfd_boolean ok; + + /* NEXT_INSN is not itself a load/store instruction, + and it does not conflict with INSN. */ + + ok = TRUE; + + /* If PREV_INSN is a load, and it sets a register + which NEXT_INSN uses, then putting NEXT_INSN + immediately after PREV_INSN will cause a pipeline + bubble, so there is no reason to make this swap. */ + if (prev_op != NULL + && (prev_op->flags & LOAD) != 0 + && sh_load_use (prev_insn, prev_op, next_insn, next_op)) + ok = FALSE; + + /* If INSN is a load, and it sets a register which + the insn after NEXT_INSN uses, then doing the + swap will cause a pipeline bubble, so there is no + reason to make the swap. However, if the insn + after NEXT_INSN is itself a load or store + instruction, then it is misaligned, so + optimistically hope that it will be swapped + itself, and just live with the pipeline bubble if + it isn't. */ + if (ok + && i + 4 < stop + && (op->flags & LOAD) != 0) + { + unsigned int next2_insn; + const struct sh_opcode *next2_op; + + next2_insn = bfd_get_16 (abfd, contents + i + 4); + next2_op = sh_insn_info (next2_insn); + if ((next2_op->flags & (LOAD | STORE)) == 0 + && sh_load_use (insn, op, next2_insn, next2_op)) + ok = FALSE; + } + + if (ok) + { + if (! (*swap) (abfd, sec, relocs, contents, i)) + return FALSE; + *pswapped = TRUE; + continue; + } + } + } + } + + return TRUE; +} +#endif /* not COFF_IMAGE_WITH_PE */ + +/* Look for loads and stores which we can align to four byte + boundaries. See the longer comment above sh_relax_section for why + this is desirable. This sets *PSWAPPED if some instruction was + swapped. */ + +static bfd_boolean +sh_align_loads (abfd, sec, internal_relocs, contents, pswapped) + bfd *abfd; + asection *sec; + struct internal_reloc *internal_relocs; + bfd_byte *contents; + bfd_boolean *pswapped; +{ + struct internal_reloc *irel, *irelend; + bfd_vma *labels = NULL; + bfd_vma *label, *label_end; + bfd_size_type amt; + + *pswapped = FALSE; + + irelend = internal_relocs + sec->reloc_count; + + /* Get all the addresses with labels on them. */ + amt = (bfd_size_type) sec->reloc_count * sizeof (bfd_vma); + labels = (bfd_vma *) bfd_malloc (amt); + if (labels == NULL) + goto error_return; + label_end = labels; + for (irel = internal_relocs; irel < irelend; irel++) + { + if (irel->r_type == R_SH_LABEL) + { + *label_end = irel->r_vaddr - sec->vma; + ++label_end; + } + } + + /* Note that the assembler currently always outputs relocs in + address order. If that ever changes, this code will need to sort + the label values and the relocs. */ + + label = labels; + + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma start, stop; + + if (irel->r_type != R_SH_CODE) + continue; + + start = irel->r_vaddr - sec->vma; + + for (irel++; irel < irelend; irel++) + if (irel->r_type == R_SH_DATA) + break; + if (irel < irelend) + stop = irel->r_vaddr - sec->vma; + else + stop = sec->_cooked_size; + + if (! _bfd_sh_align_load_span (abfd, sec, contents, sh_swap_insns, + (PTR) internal_relocs, &label, + label_end, start, stop, pswapped)) + goto error_return; + } + + free (labels); + + return TRUE; + + error_return: + if (labels != NULL) + free (labels); + return FALSE; +} + +/* Swap two SH instructions. */ + +static bfd_boolean +sh_swap_insns (abfd, sec, relocs, contents, addr) + bfd *abfd; + asection *sec; + PTR relocs; + bfd_byte *contents; + bfd_vma addr; +{ + struct internal_reloc *internal_relocs = (struct internal_reloc *) relocs; + unsigned short i1, i2; + struct internal_reloc *irel, *irelend; + + /* Swap the instructions themselves. */ + i1 = bfd_get_16 (abfd, contents + addr); + i2 = bfd_get_16 (abfd, contents + addr + 2); + bfd_put_16 (abfd, (bfd_vma) i2, contents + addr); + bfd_put_16 (abfd, (bfd_vma) i1, contents + addr + 2); + + /* Adjust all reloc addresses. */ + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + int type, add; + + /* There are a few special types of relocs that we don't want to + adjust. These relocs do not apply to the instruction itself, + but are only associated with the address. */ + type = irel->r_type; + if (type == R_SH_ALIGN + || type == R_SH_CODE + || type == R_SH_DATA + || type == R_SH_LABEL) + continue; + + /* If an R_SH_USES reloc points to one of the addresses being + swapped, we must adjust it. It would be incorrect to do this + for a jump, though, since we want to execute both + instructions after the jump. (We have avoided swapping + around a label, so the jump will not wind up executing an + instruction it shouldn't). */ + if (type == R_SH_USES) + { + bfd_vma off; + + off = irel->r_vaddr - sec->vma + 4 + irel->r_offset; + if (off == addr) + irel->r_offset += 2; + else if (off == addr + 2) + irel->r_offset -= 2; + } + + if (irel->r_vaddr - sec->vma == addr) + { + irel->r_vaddr += 2; + add = -2; + } + else if (irel->r_vaddr - sec->vma == addr + 2) + { + irel->r_vaddr -= 2; + add = 2; + } + else + add = 0; + + if (add != 0) + { + bfd_byte *loc; + unsigned short insn, oinsn; + bfd_boolean overflow; + + loc = contents + irel->r_vaddr - sec->vma; + overflow = FALSE; + switch (type) + { + default: + break; + + case R_SH_PCDISP8BY2: + case R_SH_PCRELIMM8BY2: + insn = bfd_get_16 (abfd, loc); + oinsn = insn; + insn += add / 2; + if ((oinsn & 0xff00) != (insn & 0xff00)) + overflow = TRUE; + bfd_put_16 (abfd, (bfd_vma) insn, loc); + break; + + case R_SH_PCDISP: + insn = bfd_get_16 (abfd, loc); + oinsn = insn; + insn += add / 2; + if ((oinsn & 0xf000) != (insn & 0xf000)) + overflow = TRUE; + bfd_put_16 (abfd, (bfd_vma) insn, loc); + break; + + case R_SH_PCRELIMM8BY4: + /* This reloc ignores the least significant 3 bits of + the program counter before adding in the offset. + This means that if ADDR is at an even address, the + swap will not affect the offset. If ADDR is an at an + odd address, then the instruction will be crossing a + four byte boundary, and must be adjusted. */ + if ((addr & 3) != 0) + { + insn = bfd_get_16 (abfd, loc); + oinsn = insn; + insn += add / 2; + if ((oinsn & 0xff00) != (insn & 0xff00)) + overflow = TRUE; + bfd_put_16 (abfd, (bfd_vma) insn, loc); + } + + break; + } + + if (overflow) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: fatal: reloc overflow while relaxing", + bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + } + + return TRUE; +} + +/* This is a modification of _bfd_coff_generic_relocate_section, which + will handle SH relaxing. */ + +static bfd_boolean +sh_relocate_section (output_bfd, info, input_bfd, input_section, contents, + relocs, syms, sections) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + struct internal_reloc *relocs; + struct internal_syment *syms; + asection **sections; +{ + struct internal_reloc *rel; + struct internal_reloc *relend; + + rel = relocs; + relend = rel + input_section->reloc_count; + for (; rel < relend; rel++) + { + long symndx; + struct coff_link_hash_entry *h; + struct internal_syment *sym; + bfd_vma addend; + bfd_vma val; + reloc_howto_type *howto; + bfd_reloc_status_type rstat; + + /* Almost all relocs have to do with relaxing. If any work must + be done for them, it has been done in sh_relax_section. */ + if (rel->r_type != R_SH_IMM32 +#ifdef COFF_WITH_PE + && rel->r_type != R_SH_IMM32CE + && rel->r_type != R_SH_IMAGEBASE +#endif + && rel->r_type != R_SH_PCDISP) + continue; + + symndx = rel->r_symndx; + + if (symndx == -1) + { + h = NULL; + sym = NULL; + } + else + { + if (symndx < 0 + || (unsigned long) symndx >= obj_raw_syment_count (input_bfd)) + { + (*_bfd_error_handler) + ("%s: illegal symbol index %ld in relocs", + bfd_archive_filename (input_bfd), symndx); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + h = obj_coff_sym_hashes (input_bfd)[symndx]; + sym = syms + symndx; + } + + if (sym != NULL && sym->n_scnum != 0) + addend = - sym->n_value; + else + addend = 0; + + if (rel->r_type == R_SH_PCDISP) + addend -= 4; + + if (rel->r_type >= SH_COFF_HOWTO_COUNT) + howto = NULL; + else + howto = &sh_coff_howtos[rel->r_type]; + + if (howto == NULL) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + +#ifdef COFF_WITH_PE + if (rel->r_type == R_SH_IMAGEBASE) + addend -= pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase; +#endif + + val = 0; + + if (h == NULL) + { + asection *sec; + + /* There is nothing to do for an internal PCDISP reloc. */ + if (rel->r_type == R_SH_PCDISP) + continue; + + if (symndx == -1) + { + sec = bfd_abs_section_ptr; + val = 0; + } + else + { + sec = sections[symndx]; + val = (sec->output_section->vma + + sec->output_offset + + sym->n_value + - sec->vma); + } + } + else + { + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + asection *sec; + + sec = h->root.u.def.section; + val = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else if (! info->relocatable) + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, input_section, + rel->r_vaddr - input_section->vma, TRUE))) + return FALSE; + } + } + + rstat = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, + rel->r_vaddr - input_section->vma, + val, addend); + + switch (rstat) + { + default: + abort (); + case bfd_reloc_ok: + break; + case bfd_reloc_overflow: + { + const char *name; + char buf[SYMNMLEN + 1]; + + if (symndx == -1) + name = "*ABS*"; + else if (h != NULL) + name = h->root.root.string; + else if (sym->_n._n_n._n_zeroes == 0 + && sym->_n._n_n._n_offset != 0) + name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset; + else + { + strncpy (buf, sym->_n._n_name, SYMNMLEN); + buf[SYMNMLEN] = '\0'; + name = buf; + } + + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, input_bfd, + input_section, rel->r_vaddr - input_section->vma))) + return FALSE; + } + } + } + + return TRUE; +} + +/* This is a version of bfd_generic_get_relocated_section_contents + which uses sh_relocate_section. */ + +static bfd_byte * +sh_coff_get_relocated_section_contents (output_bfd, link_info, link_order, + data, relocatable, symbols) + bfd *output_bfd; + struct bfd_link_info *link_info; + struct bfd_link_order *link_order; + bfd_byte *data; + bfd_boolean relocatable; + asymbol **symbols; +{ + asection *input_section = link_order->u.indirect.section; + bfd *input_bfd = input_section->owner; + asection **sections = NULL; + struct internal_reloc *internal_relocs = NULL; + struct internal_syment *internal_syms = NULL; + + /* We only need to handle the case of relaxing, or of having a + particular set of section contents, specially. */ + if (relocatable + || coff_section_data (input_bfd, input_section) == NULL + || coff_section_data (input_bfd, input_section)->contents == NULL) + return bfd_generic_get_relocated_section_contents (output_bfd, link_info, + link_order, data, + relocatable, + symbols); + + memcpy (data, coff_section_data (input_bfd, input_section)->contents, + (size_t) input_section->_raw_size); + + if ((input_section->flags & SEC_RELOC) != 0 + && input_section->reloc_count > 0) + { + bfd_size_type symesz = bfd_coff_symesz (input_bfd); + bfd_byte *esym, *esymend; + struct internal_syment *isymp; + asection **secpp; + bfd_size_type amt; + + if (! _bfd_coff_get_external_symbols (input_bfd)) + goto error_return; + + internal_relocs = (_bfd_coff_read_internal_relocs + (input_bfd, input_section, FALSE, (bfd_byte *) NULL, + FALSE, (struct internal_reloc *) NULL)); + if (internal_relocs == NULL) + goto error_return; + + amt = obj_raw_syment_count (input_bfd); + amt *= sizeof (struct internal_syment); + internal_syms = (struct internal_syment *) bfd_malloc (amt); + if (internal_syms == NULL) + goto error_return; + + amt = obj_raw_syment_count (input_bfd); + amt *= sizeof (asection *); + sections = (asection **) bfd_malloc (amt); + if (sections == NULL) + goto error_return; + + isymp = internal_syms; + secpp = sections; + esym = (bfd_byte *) obj_coff_external_syms (input_bfd); + esymend = esym + obj_raw_syment_count (input_bfd) * symesz; + while (esym < esymend) + { + bfd_coff_swap_sym_in (input_bfd, (PTR) esym, (PTR) isymp); + + if (isymp->n_scnum != 0) + *secpp = coff_section_from_bfd_index (input_bfd, isymp->n_scnum); + else + { + if (isymp->n_value == 0) + *secpp = bfd_und_section_ptr; + else + *secpp = bfd_com_section_ptr; + } + + esym += (isymp->n_numaux + 1) * symesz; + secpp += isymp->n_numaux + 1; + isymp += isymp->n_numaux + 1; + } + + if (! sh_relocate_section (output_bfd, link_info, input_bfd, + input_section, data, internal_relocs, + internal_syms, sections)) + goto error_return; + + free (sections); + sections = NULL; + free (internal_syms); + internal_syms = NULL; + free (internal_relocs); + internal_relocs = NULL; + } + + return data; + + error_return: + if (internal_relocs != NULL) + free (internal_relocs); + if (internal_syms != NULL) + free (internal_syms); + if (sections != NULL) + free (sections); + return NULL; +} + +/* The target vectors. */ + +#ifndef TARGET_SHL_SYM +CREATE_BIG_COFF_TARGET_VEC (shcoff_vec, "coff-sh", BFD_IS_RELAXABLE, 0, '_', NULL, COFF_SWAP_TABLE) +#endif + +#ifdef TARGET_SHL_SYM +#define TARGET_SYM TARGET_SHL_SYM +#else +#define TARGET_SYM shlcoff_vec +#endif + +#ifndef TARGET_SHL_NAME +#define TARGET_SHL_NAME "coff-shl" +#endif + +#ifdef COFF_WITH_PE +CREATE_LITTLE_COFF_TARGET_VEC (TARGET_SYM, TARGET_SHL_NAME, BFD_IS_RELAXABLE, + SEC_CODE | SEC_DATA, '_', NULL, COFF_SWAP_TABLE); +#else +CREATE_LITTLE_COFF_TARGET_VEC (TARGET_SYM, TARGET_SHL_NAME, BFD_IS_RELAXABLE, + 0, '_', NULL, COFF_SWAP_TABLE) +#endif + +#ifndef TARGET_SHL_SYM +static const bfd_target * coff_small_object_p PARAMS ((bfd *)); +static bfd_boolean coff_small_new_section_hook PARAMS ((bfd *, asection *)); +/* Some people want versions of the SH COFF target which do not align + to 16 byte boundaries. We implement that by adding a couple of new + target vectors. These are just like the ones above, but they + change the default section alignment. To generate them in the + assembler, use -small. To use them in the linker, use -b + coff-sh{l}-small and -oformat coff-sh{l}-small. + + Yes, this is a horrible hack. A general solution for setting + section alignment in COFF is rather complex. ELF handles this + correctly. */ + +/* Only recognize the small versions if the target was not defaulted. + Otherwise we won't recognize the non default endianness. */ + +static const bfd_target * +coff_small_object_p (abfd) + bfd *abfd; +{ + if (abfd->target_defaulted) + { + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + return coff_object_p (abfd); +} + +/* Set the section alignment for the small versions. */ + +static bfd_boolean +coff_small_new_section_hook (abfd, section) + bfd *abfd; + asection *section; +{ + if (! coff_new_section_hook (abfd, section)) + return FALSE; + + /* We must align to at least a four byte boundary, because longword + accesses must be on a four byte boundary. */ + if (section->alignment_power == COFF_DEFAULT_SECTION_ALIGNMENT_POWER) + section->alignment_power = 2; + + return TRUE; +} + +/* This is copied from bfd_coff_std_swap_table so that we can change + the default section alignment power. */ + +static const bfd_coff_backend_data bfd_coff_small_swap_table = +{ + coff_swap_aux_in, coff_swap_sym_in, coff_swap_lineno_in, + coff_swap_aux_out, coff_swap_sym_out, + coff_swap_lineno_out, coff_swap_reloc_out, + coff_swap_filehdr_out, coff_swap_aouthdr_out, + coff_swap_scnhdr_out, + FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN, +#ifdef COFF_LONG_FILENAMES + TRUE, +#else + FALSE, +#endif +#ifdef COFF_LONG_SECTION_NAMES + TRUE, +#else + FALSE, +#endif + 2, +#ifdef COFF_FORCE_SYMBOLS_IN_STRINGS + TRUE, +#else + FALSE, +#endif +#ifdef COFF_DEBUG_STRING_WIDE_PREFIX + 4, +#else + 2, +#endif + coff_swap_filehdr_in, coff_swap_aouthdr_in, coff_swap_scnhdr_in, + coff_swap_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook, + coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, + coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, + coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, + coff_classify_symbol, coff_compute_section_file_positions, + coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, + coff_adjust_symndx, coff_link_add_one_symbol, + coff_link_output_has_begun, coff_final_link_postscript +}; + +#define coff_small_close_and_cleanup \ + coff_close_and_cleanup +#define coff_small_bfd_free_cached_info \ + coff_bfd_free_cached_info +#define coff_small_get_section_contents \ + coff_get_section_contents +#define coff_small_get_section_contents_in_window \ + coff_get_section_contents_in_window + +extern const bfd_target shlcoff_small_vec; + +const bfd_target shcoff_small_vec = +{ + "coff-sh-small", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_BIG, /* data byte order is big */ + BFD_ENDIAN_BIG, /* header byte order is big */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), + '_', /* leading symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + + {_bfd_dummy_target, coff_small_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ + bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (coff_small), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (coff), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & shlcoff_small_vec, + + (PTR) &bfd_coff_small_swap_table +}; + +const bfd_target shlcoff_small_vec = +{ + "coff-shl-small", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_LITTLE, /* header byte order is little endian too*/ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), + '_', /* leading symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ + + {_bfd_dummy_target, coff_small_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ + bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (coff_small), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (coff), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & shcoff_small_vec, + + (PTR) &bfd_coff_small_swap_table +}; +#endif diff --git a/bfd/coff-stgo32.c b/bfd/coff-stgo32.c new file mode 100644 index 0000000000000..c4264ca3811ae --- /dev/null +++ b/bfd/coff-stgo32.c @@ -0,0 +1,413 @@ +/* BFD back-end for Intel 386 COFF files (DJGPP variant with a stub). + Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Written by Robert Hoehne. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +/* This file handles now also stubbed coff images. The stub is a small + DOS executable program before the coff image to load it in memory + and execute it. This is needed, because DOS cannot run coff files. + + All the functions below are called by the corresponding functions + from coffswap.h. + The only thing what they do is to adjust the information stored in + the COFF file which are offset into the file. + This is needed, because DJGPP uses a very special way to load and run + the coff image. It loads the image in memory and assumes then, that the + image had no stub by using the filepointers as pointers in the coff + image and NOT in the file. + + To be compatible with any existing executables I have fixed this + here and NOT in the DJGPP startup code. */ + +#define TARGET_SYM go32stubbedcoff_vec +#define TARGET_NAME "coff-go32-exe" +#define TARGET_UNDERSCORE '_' +#define COFF_GO32_EXE +#define COFF_LONG_SECTION_NAMES +#define COFF_SUPPORT_GNU_LINKONCE +#define COFF_LONG_FILENAMES + +#define COFF_SECTION_ALIGNMENT_ENTRIES \ +{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } + +#include "bfd.h" + +/* At first the prototypes. */ + +static void +adjust_filehdr_in_post PARAMS ((bfd *, PTR, PTR)); +static void +adjust_filehdr_out_pre PARAMS ((bfd *, PTR, PTR)); +static void +adjust_filehdr_out_post PARAMS ((bfd *, PTR, PTR)); +static void +adjust_scnhdr_in_post PARAMS ((bfd *, PTR, PTR)); +static void +adjust_scnhdr_out_pre PARAMS ((bfd *, PTR, PTR)); +static void +adjust_scnhdr_out_post PARAMS ((bfd *, PTR, PTR)); +static void +adjust_aux_in_post PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +static void +adjust_aux_out_pre PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +static void +adjust_aux_out_post PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +static void +create_go32_stub PARAMS ((bfd *)); + +/* All that ..._PRE and ...POST functions are called from the corresponding + coff_swap... functions. The ...PRE functions are called at the beginning + of the function and the ...POST functions at the end of the swap routines. */ + +#define COFF_ADJUST_FILEHDR_IN_POST adjust_filehdr_in_post +#define COFF_ADJUST_FILEHDR_OUT_PRE adjust_filehdr_out_pre +#define COFF_ADJUST_FILEHDR_OUT_POST adjust_filehdr_out_post + +#define COFF_ADJUST_SCNHDR_IN_POST adjust_scnhdr_in_post +#define COFF_ADJUST_SCNHDR_OUT_PRE adjust_scnhdr_out_pre +#define COFF_ADJUST_SCNHDR_OUT_POST adjust_scnhdr_out_post + +#define COFF_ADJUST_AUX_IN_POST adjust_aux_in_post +#define COFF_ADJUST_AUX_OUT_PRE adjust_aux_out_pre +#define COFF_ADJUST_AUX_OUT_POST adjust_aux_out_post + +static bfd_boolean + go32_stubbed_coff_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *)); + +#define coff_bfd_copy_private_bfd_data go32_stubbed_coff_bfd_copy_private_bfd_data + +#include "coff-i386.c" + +/* I hold in the usrdata the stub. */ +#define bfd_coff_go32stub bfd_usrdata + +/* This macro is used, because I cannot assume the endianess of the + host system. */ +#define _H(index) (H_GET_16 (abfd, (header+index*2))) + +/* These bytes are a 2048-byte DOS executable, which loads the COFF + image into memory and then runs it. It is called 'stub'. */ + +static const unsigned char stub_bytes[STUBSIZE] = +{ +#include "go32stub.h" +}; + +/* + I have not commented each swap function below, because the + technique is in any function the same. For the ...in function, + all the pointers are adjusted by adding STUBSIZE and for the + ...out function, it is subtracted first and after calling the + standard swap function it is reset to the old value. */ + +/* This macro is used for adjusting the filepointers, which + is done only, if the pointer is nonzero. */ + +#define ADJUST_VAL(val,diff) \ + if (val != 0) val += diff + +static void +adjust_filehdr_in_post (abfd, src, dst) + bfd *abfd; + PTR src; + PTR dst; +{ + FILHDR *filehdr_src = (FILHDR *) src; + struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst; + + ADJUST_VAL (filehdr_dst->f_symptr, STUBSIZE); + + /* Save now the stub to be used later. */ + bfd_coff_go32stub (abfd) = (PTR) bfd_alloc (abfd, (bfd_size_type) STUBSIZE); + + /* Since this function returns no status, I do not set here + any bfd_error_... + That means, before the use of bfd_coff_go32stub (), this value + should be checked if it is != NULL. */ + if (bfd_coff_go32stub (abfd) == NULL) + return; + memcpy (bfd_coff_go32stub (abfd), filehdr_src->stub, STUBSIZE); +} + +static void +adjust_filehdr_out_pre (abfd, in, out) + bfd *abfd; + PTR in; + PTR out; +{ + struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in; + FILHDR *filehdr_out = (FILHDR *) out; + + /* Generate the stub. */ + create_go32_stub (abfd); + + /* Copy the stub to the file header. */ + if (bfd_coff_go32stub (abfd) != NULL) + memcpy (filehdr_out->stub, bfd_coff_go32stub (abfd), STUBSIZE); + else + /* Use the default. */ + memcpy (filehdr_out->stub, stub_bytes, STUBSIZE); + + ADJUST_VAL (filehdr_in->f_symptr, -STUBSIZE); +} + +static void +adjust_filehdr_out_post (abfd, in, out) + bfd *abfd ATTRIBUTE_UNUSED; + PTR in; + PTR out ATTRIBUTE_UNUSED; +{ + struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in; + /* Undo the above change. */ + ADJUST_VAL (filehdr_in->f_symptr, STUBSIZE); +} + +static void +adjust_scnhdr_in_post (abfd, ext, in) + bfd *abfd ATTRIBUTE_UNUSED; + PTR ext ATTRIBUTE_UNUSED; + PTR in; +{ + struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; + + ADJUST_VAL (scnhdr_int->s_scnptr, STUBSIZE); + ADJUST_VAL (scnhdr_int->s_relptr, STUBSIZE); + ADJUST_VAL (scnhdr_int->s_lnnoptr, STUBSIZE); +} + +static void +adjust_scnhdr_out_pre (abfd, in, out) + bfd *abfd ATTRIBUTE_UNUSED; + PTR in; + PTR out ATTRIBUTE_UNUSED; +{ + struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; + + ADJUST_VAL (scnhdr_int->s_scnptr, -STUBSIZE); + ADJUST_VAL (scnhdr_int->s_relptr, -STUBSIZE); + ADJUST_VAL (scnhdr_int->s_lnnoptr, -STUBSIZE); +} + +static void +adjust_scnhdr_out_post (abfd, in, out) + bfd *abfd ATTRIBUTE_UNUSED; + PTR in; + PTR out ATTRIBUTE_UNUSED; +{ + struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; + + ADJUST_VAL (scnhdr_int->s_scnptr, STUBSIZE); + ADJUST_VAL (scnhdr_int->s_relptr, STUBSIZE); + ADJUST_VAL (scnhdr_int->s_lnnoptr, STUBSIZE); +} + +static void +adjust_aux_in_post (abfd, ext1, type, class, indx, numaux, in1) + bfd *abfd ATTRIBUTE_UNUSED; + PTR ext1 ATTRIBUTE_UNUSED; + int type; + int class; + int indx ATTRIBUTE_UNUSED; + int numaux ATTRIBUTE_UNUSED; + PTR in1; +{ + union internal_auxent *in = (union internal_auxent *) in1; + + if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) + { + ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, STUBSIZE); + } +} + +static void +adjust_aux_out_pre (abfd, inp, type, class, indx, numaux, extp) + bfd *abfd ATTRIBUTE_UNUSED; + PTR inp; + int type; + int class; + int indx ATTRIBUTE_UNUSED; + int numaux ATTRIBUTE_UNUSED; + PTR extp ATTRIBUTE_UNUSED; +{ + union internal_auxent *in = (union internal_auxent *) inp; + + if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) + { + ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, -STUBSIZE); + } +} + +static void +adjust_aux_out_post (abfd, inp, type, class, indx, numaux, extp) + bfd *abfd ATTRIBUTE_UNUSED; + PTR inp; + int type; + int class; + int indx ATTRIBUTE_UNUSED; + int numaux ATTRIBUTE_UNUSED; + PTR extp ATTRIBUTE_UNUSED; +{ + union internal_auxent *in = (union internal_auxent *) inp; + + if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class)) + { + ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, STUBSIZE); + } +} + +/* That's the function, which creates the stub. There are + different cases from where the stub is taken. + At first the environment variable $(GO32STUB) is checked and then + $(STUB) if it was not set. + If it exists and points to a valid stub the stub is taken from + that file. This file can be also a whole executable file, because + the stub is computed from the exe information at the start of that + file. + + If there was any error, the standard stub (compiled in this file) + is taken. */ + +static void +create_go32_stub (abfd) + bfd *abfd; +{ + /* Do it only once. */ + if (bfd_coff_go32stub (abfd) == NULL) + { + char *stub; + struct stat st; + int f; + unsigned char header[10]; + char magic[8]; + unsigned long coff_start; + long exe_start; + + /* Check at first the environment variable $(GO32STUB). */ + stub = getenv ("GO32STUB"); + /* Now check the environment variable $(STUB). */ + if (stub == NULL) + stub = getenv ("STUB"); + if (stub == NULL) + goto stub_end; + if (stat (stub, &st) != 0) + goto stub_end; +#ifdef O_BINARY + f = open (stub, O_RDONLY | O_BINARY); +#else + f = open (stub, O_RDONLY); +#endif + if (f < 0) + goto stub_end; + if (read (f, &header, sizeof (header)) < 0) + { + close (f); + goto stub_end; + } + if (_H (0) != 0x5a4d) /* It is not an exe file. */ + { + close (f); + goto stub_end; + } + /* Compute the size of the stub (it is every thing up + to the beginning of the coff image). */ + coff_start = (long) _H (2) * 512L; + if (_H (1)) + coff_start += (long) _H (1) - 512L; + + /* Currently there is only a fixed stub size of 2048 bytes + supported. */ + if (coff_start != 2048) + { + close (f); + goto stub_end; + } + exe_start = _H (4) * 16; + if ((long) lseek (f, exe_start, SEEK_SET) != exe_start) + { + close (f); + goto stub_end; + } + if (read (f, &magic, 8) != 8) + { + close (f); + goto stub_end; + } + if (memcmp (magic, "go32stub", 8) != 0) + { + close (f); + goto stub_end; + } + /* Now we found a correct stub (hopefully). */ + bfd_coff_go32stub (abfd) + = (PTR) bfd_alloc (abfd, (bfd_size_type) coff_start); + if (bfd_coff_go32stub (abfd) == NULL) + { + close (f); + return; + } + lseek (f, 0L, SEEK_SET); + if ((unsigned long) read (f, bfd_coff_go32stub (abfd), coff_start) + != coff_start) + { + bfd_release (abfd, bfd_coff_go32stub (abfd)); + bfd_coff_go32stub (abfd) = NULL; + } + close (f); + } +stub_end: + /* There was something wrong above, so use now the standard builtin + stub. */ + if (bfd_coff_go32stub (abfd) == NULL) + { + bfd_coff_go32stub (abfd) + = (PTR) bfd_alloc (abfd, (bfd_size_type) STUBSIZE); + if (bfd_coff_go32stub (abfd) == NULL) + return; + memcpy (bfd_coff_go32stub (abfd), stub_bytes, STUBSIZE); + } +} + +/* If ibfd was a stubbed coff image, copy the stub from that bfd + to the new obfd. */ + +static bfd_boolean +go32_stubbed_coff_bfd_copy_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + /* Check if both are the same targets. */ + if (ibfd->xvec != obfd->xvec) + return TRUE; + + /* Check if both have a valid stub. */ + if (bfd_coff_go32stub (ibfd) == NULL + || bfd_coff_go32stub (obfd) == NULL) + return TRUE; + + /* Now copy the stub. */ + memcpy (bfd_coff_go32stub (obfd), bfd_coff_go32stub (ibfd), STUBSIZE); + + return TRUE; +} diff --git a/bfd/coff-svm68k.c b/bfd/coff-svm68k.c new file mode 100644 index 0000000000000..3d2a5a7d565d9 --- /dev/null +++ b/bfd/coff-svm68k.c @@ -0,0 +1,26 @@ +/* BFD back-end for Motorola sysv68 + Copyright 1997 Free Software Foundation, Inc. + Written by Philippe De Muyter . + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define TARGET_SYM m68ksysvcoff_vec +#define TARGET_NAME "coff-m68k-sysv" +#define STATIC_RELOCS +#define COFF_COMMON_ADDEND + +#include "coff-m68k.c" diff --git a/bfd/coff-tic30.c b/bfd/coff-tic30.c new file mode 100644 index 0000000000000..ef2f3dceed4b6 --- /dev/null +++ b/bfd/coff-tic30.c @@ -0,0 +1,210 @@ +/* BFD back-end for TMS320C30 coff binaries. + Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "bfdlink.h" +#include "coff/tic30.h" +#include "coff/internal.h" +#include "libcoff.h" + +static int coff_tic30_select_reloc PARAMS ((reloc_howto_type *)); +static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); +static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); + +reloc_howto_type * tic30_coff_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) + +reloc_howto_type tic30_coff_howto_table[] = + { + HOWTO (R_TIC30_ABS16, 2, 1, 16, FALSE, 0, 0, NULL, + "16", FALSE, 0x0000FFFF, 0x0000FFFF, FALSE), + HOWTO (R_TIC30_ABS24, 2, 2, 24, FALSE, 8, complain_overflow_bitfield, NULL, + "24", FALSE, 0xFFFFFF00, 0xFFFFFF00, FALSE), + HOWTO (R_TIC30_LDP, 18, 0, 24, FALSE, 0, complain_overflow_bitfield, NULL, + "LDP", FALSE, 0x00FF0000, 0x000000FF, FALSE), + HOWTO (R_TIC30_ABS32, 2, 2, 32, FALSE, 0, complain_overflow_bitfield, NULL, + "32", FALSE, 0xFFFFFFFF, 0xFFFFFFFF, FALSE), + HOWTO (R_TIC30_PC16, 2, 1, 16, TRUE, 0, complain_overflow_signed, NULL, + "PCREL", FALSE, 0x0000FFFF, 0x0000FFFF, FALSE), + EMPTY_HOWTO (-1) + }; + +#ifndef coff_bfd_reloc_type_lookup +#define coff_bfd_reloc_type_lookup tic30_coff_reloc_type_lookup + +/* For the case statement use the code values used in tc_gen_reloc to + map to the howto table entries that match those in both the aout + and coff implementations. */ + +reloc_howto_type * +tic30_coff_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + switch (code) + { + case BFD_RELOC_8: + case BFD_RELOC_TIC30_LDP: + return &tic30_coff_howto_table[2]; + case BFD_RELOC_16: + return &tic30_coff_howto_table[0]; + case BFD_RELOC_24: + return &tic30_coff_howto_table[1]; + case BFD_RELOC_16_PCREL: + return &tic30_coff_howto_table[4]; + case BFD_RELOC_32: + return &tic30_coff_howto_table[3]; + default: + return (reloc_howto_type *) NULL; + } +} + +#endif + +/* Turn a howto into a reloc number. */ + +static int +coff_tic30_select_reloc (howto) + reloc_howto_type *howto; +{ + return howto->type; +} + +#define SELECT_RELOC(x,howto) x.r_type = coff_tic30_select_reloc(howto) + +#define BADMAG(x) TIC30BADMAG(x) +#define TIC30 1 /* Customize coffcode.h */ +#define __A_MAGIC_SET__ + +/* Code to swap in the reloc */ +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 +#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) dst->r_stuff[0] = 'S'; \ +dst->r_stuff[1] = 'C'; + +/* Code to turn a r_type into a howto ptr, uses the above howto table. */ + +static void +rtype2howto (internal, dst) + arelent *internal; + struct internal_reloc *dst; +{ + switch (dst->r_type) + { + case R_TIC30_ABS16: + internal->howto = &tic30_coff_howto_table[0]; + break; + case R_TIC30_ABS24: + internal->howto = &tic30_coff_howto_table[1]; + break; + case R_TIC30_ABS32: + internal->howto = &tic30_coff_howto_table[3]; + break; + case R_TIC30_LDP: + internal->howto = &tic30_coff_howto_table[2]; + break; + case R_TIC30_PC16: + internal->howto = &tic30_coff_howto_table[4]; + break; + default: + abort (); + break; + } +} + +#define RTYPE2HOWTO(internal, relocentry) rtype2howto (internal, relocentry) + +/* Perform any necessary magic to the addend in a reloc entry */ + +#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ + cache_ptr->addend = ext_reloc.r_offset; + +#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ + reloc_processing(relent, reloc, symbols, abfd, section) + +static void +reloc_processing (relent, reloc, symbols, abfd, section) + arelent *relent; + struct internal_reloc *reloc; + asymbol **symbols; + bfd *abfd; + asection *section; +{ + relent->address = reloc->r_vaddr; + rtype2howto (relent, reloc); + + if (reloc->r_symndx > 0) + relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; + else + relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + + relent->addend = reloc->r_offset; + relent->address -= section->vma; +} + +#include "coffcode.h" + +const bfd_target tic30_coff_vec = +{ + "coff-tic30", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_BIG, /* data byte order is big */ + BFD_ENDIAN_LITTLE, /* header byte order is little */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + '_', /* leading symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ + bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (coff), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + COFF_SWAP_TABLE +}; diff --git a/bfd/coff-tic4x.c b/bfd/coff-tic4x.c new file mode 100644 index 0000000000000..708e6264caa31 --- /dev/null +++ b/bfd/coff-tic4x.c @@ -0,0 +1,270 @@ +/* BFD back-end for TMS320C4X coff binaries. + Copyright 1996, 1997, 1998, 1999, 2000, 2002, 2003 + Free Software Foundation, Inc. + + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz) + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "bfdlink.h" +#include "coff/tic4x.h" +#include "coff/internal.h" +#include "libcoff.h" + +#undef F_LSYMS +#define F_LSYMS F_LSYMS_TICOFF + +static bfd_boolean ticoff_bfd_is_local_label_name + PARAMS ((bfd *, const char *)); +static bfd_reloc_status_type tic4x_relocation + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char ** )); +static reloc_howto_type *tic4x_coff_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type )); +static void tic4x_lookup_howto + PARAMS ((arelent *, struct internal_reloc * )); +static reloc_howto_type *coff_tic4x_rtype_to_howto + PARAMS ((bfd *, asection *, struct internal_reloc *, struct coff_link_hash_entry *, struct internal_syment *, bfd_vma * )); +static void tic4x_reloc_processing + PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection * )); + + +/* Replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local + labels. */ +static bfd_boolean +ticoff_bfd_is_local_label_name (abfd, name) + bfd *abfd ATTRIBUTE_UNUSED; + const char *name; +{ + if (TICOFF_LOCAL_LABEL_P(name)) + return TRUE; + return FALSE; +} + +#define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name + +#define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\ + tic4x_reloc_processing (RELENT,RELOC,SYMS,ABFD,SECT) + +/* Customize coffcode.h; the default coff_ functions are set up to use + COFF2; coff_bad_format_hook uses BADMAG, so set that for COFF2. + The COFF1 and COFF0 vectors use custom _bad_format_hook procs + instead of setting BADMAG. */ +#define BADMAG(x) COFF2_BADMAG(x) +#include "coffcode.h" + +static bfd_reloc_status_type +tic4x_relocation (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry; + asymbol *symbol ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + if (output_bfd != (bfd *) NULL) + { + /* This is a partial relocation, and we want to apply the + relocation to the reloc entry rather than the raw data. + Modify the reloc inplace to reflect what we now know. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + return bfd_reloc_continue; +} + +reloc_howto_type tic4x_howto_table[] = +{ + HOWTO(R_RELWORD, 0, 2, 16, FALSE, 0, complain_overflow_signed, tic4x_relocation, "RELWORD", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO(R_REL24, 0, 2, 24, FALSE, 0, complain_overflow_bitfield, tic4x_relocation, "REL24", TRUE, 0x00ffffff, 0x00ffffff, FALSE), + HOWTO(R_RELLONG, 0, 2, 32, FALSE, 0, complain_overflow_dont, tic4x_relocation, "RELLONG", TRUE, 0xffffffff, 0xffffffff, FALSE), + HOWTO(R_PCRWORD, 0, 2, 16, TRUE, 0, complain_overflow_signed, tic4x_relocation, "PCRWORD", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO(R_PCR24, 0, 2, 24, TRUE, 0, complain_overflow_signed, tic4x_relocation, "PCR24", TRUE, 0x00ffffff, 0x00ffffff, FALSE), + HOWTO(R_PARTLS16, 0, 2, 16, FALSE, 0, complain_overflow_dont, tic4x_relocation, "PARTLS16", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO(R_PARTMS8, 16, 2, 16, FALSE, 0, complain_overflow_dont, tic4x_relocation, "PARTMS8", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO(R_RELWORD, 0, 2, 16, FALSE, 0, complain_overflow_signed, tic4x_relocation, "ARELWORD", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO(R_REL24, 0, 2, 24, FALSE, 0, complain_overflow_signed, tic4x_relocation, "AREL24", TRUE, 0x00ffffff, 0x00ffffff, FALSE), + HOWTO(R_RELLONG, 0, 2, 32, FALSE, 0, complain_overflow_signed, tic4x_relocation, "ARELLONG", TRUE, 0xffffffff, 0xffffffff, FALSE), + HOWTO(R_PCRWORD, 0, 2, 16, TRUE, 0, complain_overflow_signed, tic4x_relocation, "APCRWORD", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO(R_PCR24, 0, 2, 24, TRUE, 0, complain_overflow_signed, tic4x_relocation, "APCR24", TRUE, 0x00ffffff, 0x00ffffff, FALSE), + HOWTO(R_PARTLS16, 0, 2, 16, FALSE, 0, complain_overflow_dont, tic4x_relocation, "APARTLS16", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO(R_PARTMS8, 16, 2, 16, FALSE, 0, complain_overflow_dont, tic4x_relocation, "APARTMS8", TRUE, 0x0000ffff, 0x0000ffff, FALSE), +}; +#define HOWTO_SIZE (sizeof(tic4x_howto_table) / sizeof(tic4x_howto_table[0])) + +#undef coff_bfd_reloc_type_lookup +#define coff_bfd_reloc_type_lookup tic4x_coff_reloc_type_lookup + +/* For the case statement use the code values used tc_gen_reloc (defined in + bfd/reloc.c) to map to the howto table entries. */ + +static reloc_howto_type * +tic4x_coff_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int type; + unsigned int i; + + switch (code) + { + case BFD_RELOC_32: type = R_RELLONG; break; + case BFD_RELOC_24: type = R_REL24; break; + case BFD_RELOC_16: type = R_RELWORD; break; + case BFD_RELOC_24_PCREL: type = R_PCR24; break; + case BFD_RELOC_16_PCREL: type = R_PCRWORD; break; + case BFD_RELOC_HI16: type = R_PARTMS8; break; + case BFD_RELOC_LO16: type = R_PARTLS16; break; + default: + return NULL; + } + + for (i = 0; i < HOWTO_SIZE; i++) + { + if (tic4x_howto_table[i].type == type) + return tic4x_howto_table + i; + } + return NULL; +} + + +/* Code to turn a r_type into a howto ptr, uses the above howto table. + Called after some initial checking by the tic4x_rtype_to_howto fn + below. */ +static void +tic4x_lookup_howto (internal, dst) + arelent *internal; + struct internal_reloc *dst; +{ + unsigned int i; + int bank = (dst->r_symndx == -1) ? HOWTO_BANK : 0; + + for (i = 0; i < HOWTO_SIZE; i++) + { + if (tic4x_howto_table[i].type == dst->r_type) + { + internal->howto = tic4x_howto_table + i + bank; + return; + } + } + + (*_bfd_error_handler) (_("Unrecognized reloc type 0x%x"), + (unsigned int) dst->r_type); + abort(); +} + +#undef coff_rtype_to_howto +#define coff_rtype_to_howto coff_tic4x_rtype_to_howto + +static reloc_howto_type * +coff_tic4x_rtype_to_howto (abfd, sec, rel, h, sym, addendp) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + struct internal_reloc *rel; + struct coff_link_hash_entry *h ATTRIBUTE_UNUSED; + struct internal_syment *sym ATTRIBUTE_UNUSED; + bfd_vma *addendp; +{ + arelent genrel; + + if (rel->r_symndx == -1 && addendp != NULL) + /* This is a TI "internal relocation", which means that the relocation + amount is the amount by which the current section is being relocated + in the output section. */ + *addendp = (sec->output_section->vma + sec->output_offset) - sec->vma; + + tic4x_lookup_howto (&genrel, rel); + + return genrel.howto; +} + + +static void +tic4x_reloc_processing (relent, reloc, symbols, abfd, section) + arelent *relent; + struct internal_reloc *reloc; + asymbol **symbols; + bfd *abfd; + asection *section; +{ + asymbol *ptr; + + relent->address = reloc->r_vaddr; + + if (reloc->r_symndx != -1) + { + if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd)) + { + (*_bfd_error_handler) + (_("%s: warning: illegal symbol index %ld in relocs"), + bfd_get_filename (abfd), reloc->r_symndx); + relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + ptr = NULL; + } + else + { + relent->sym_ptr_ptr = (symbols + + obj_convert (abfd)[reloc->r_symndx]); + ptr = *(relent->sym_ptr_ptr); + } + } + else + { + relent->sym_ptr_ptr = section->symbol_ptr_ptr; + ptr = *(relent->sym_ptr_ptr); + } + + /* The symbols definitions that we have read in have been relocated + as if their sections started at 0. But the offsets refering to + the symbols in the raw data have not been modified, so we have to + have a negative addend to compensate. + + Note that symbols which used to be common must be left alone. */ + + /* Calculate any reloc addend by looking at the symbol. */ + CALC_ADDEND (abfd, ptr, *reloc, relent); + + relent->address -= section->vma; + /* !! relent->section = (asection *) NULL; */ + + /* Fill in the relent->howto field from reloc->r_type. */ + tic4x_lookup_howto (relent, reloc); +} + + +/* TI COFF v0, DOS tools (little-endian headers). */ +CREATE_LITTLE_COFF_TARGET_VEC(tic4x_coff0_vec, "coff0-tic4x", HAS_LOAD_PAGE, 0, '_', NULL, (PTR)&ticoff0_swap_table); + +/* TI COFF v0, SPARC tools (big-endian headers). */ +CREATE_BIGHDR_COFF_TARGET_VEC(tic4x_coff0_beh_vec, "coff0-beh-tic4x", HAS_LOAD_PAGE, 0, '_', &tic4x_coff0_vec, (PTR)&ticoff0_swap_table); + +/* TI COFF v1, DOS tools (little-endian headers). */ +CREATE_LITTLE_COFF_TARGET_VEC(tic4x_coff1_vec, "coff1-tic4x", HAS_LOAD_PAGE, 0, '_', &tic4x_coff0_beh_vec, (PTR)&ticoff1_swap_table); + +/* TI COFF v1, SPARC tools (big-endian headers). */ +CREATE_BIGHDR_COFF_TARGET_VEC(tic4x_coff1_beh_vec, "coff1-beh-tic4x", HAS_LOAD_PAGE, 0, '_', &tic4x_coff1_vec, (PTR)&ticoff1_swap_table); + +/* TI COFF v2, TI DOS tools output (little-endian headers). */ +CREATE_LITTLE_COFF_TARGET_VEC(tic4x_coff2_vec, "coff2-tic4x", HAS_LOAD_PAGE, 0, '_', &tic4x_coff1_beh_vec, COFF_SWAP_TABLE); + +/* TI COFF v2, TI SPARC tools output (big-endian headers). */ +CREATE_BIGHDR_COFF_TARGET_VEC(tic4x_coff2_beh_vec, "coff2-beh-tic4x", HAS_LOAD_PAGE, 0, '_', &tic4x_coff2_vec, COFF_SWAP_TABLE); diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c new file mode 100644 index 0000000000000..316768e2dc646 --- /dev/null +++ b/bfd/coff-tic54x.c @@ -0,0 +1,668 @@ +/* BFD back-end for TMS320C54X coff binaries. + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Contributed by Timothy Wall (twall@cygnus.com) + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "bfdlink.h" +#include "coff/tic54x.h" +#include "coff/internal.h" +#include "libcoff.h" + +#undef F_LSYMS +#define F_LSYMS F_LSYMS_TICOFF + +static void tic54x_reloc_processing + PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); +static bfd_reloc_status_type tic54x_relocation + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_boolean tic54x_set_section_contents + PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); +static reloc_howto_type *coff_tic54x_rtype_to_howto + PARAMS ((bfd *, asection *, struct internal_reloc *, struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *)); +static bfd_boolean tic54x_set_arch_mach + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +static reloc_howto_type * tic54x_coff_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void tic54x_lookup_howto + PARAMS ((arelent *, struct internal_reloc *)); +static bfd_boolean ticoff_bfd_is_local_label_name + PARAMS ((bfd *, const char *)); + +/* 32-bit operations + The octet order is screwy. words are LSB first (LS octet, actually), but + longwords are MSW first. For example, 0x12345678 is encoded 0x5678 in the + first word and 0x1234 in the second. When looking at the data as stored in + the COFF file, you would see the octets ordered as 0x78, 0x56, 0x34, 0x12. + Don't bother with 64-bits, as there aren't any. */ + +static bfd_vma +tic54x_getl32 (const void *p) +{ + const bfd_byte *addr = p; + unsigned long v; + + v = (unsigned long) addr[2]; + v |= (unsigned long) addr[3] << 8; + v |= (unsigned long) addr[0] << 16; + v |= (unsigned long) addr[1] << 24; + return v; +} + +static void +tic54x_putl32 (bfd_vma data, void *p) +{ + bfd_byte *addr = p; + addr[2] = data & 0xff; + addr[3] = (data >> 8) & 0xff; + addr[0] = (data >> 16) & 0xff; + addr[1] = (data >> 24) & 0xff; +} + +static bfd_signed_vma +tic54x_getl_signed_32 (const void *p) +{ + const bfd_byte *addr = p; + unsigned long v; + + v = (unsigned long) addr[2]; + v |= (unsigned long) addr[3] << 8; + v |= (unsigned long) addr[0] << 16; + v |= (unsigned long) addr[1] << 24; +#define COERCE32(x) \ + ((bfd_signed_vma) (long) (((unsigned long) (x) ^ 0x80000000) - 0x80000000)) + return COERCE32 (v); +} + +#define coff_get_section_load_page bfd_ticoff_get_section_load_page +#define coff_set_section_load_page bfd_ticoff_set_section_load_page + +void +bfd_ticoff_set_section_load_page (sect, page) + asection *sect; + int page; +{ + sect->lma = (sect->lma & ADDR_MASK) | PG_TO_FLAG(page); +} + +int +bfd_ticoff_get_section_load_page (sect) + asection *sect; +{ + int page; + + /* Provide meaningful defaults for predefined sections. */ + if (sect == &bfd_com_section) + page = PG_DATA; + + else if (sect == &bfd_und_section + || sect == &bfd_abs_section + || sect == &bfd_ind_section) + page = PG_PROG; + + else + page = FLAG_TO_PG (sect->lma); + + return page; +} + +/* Set the architecture appropriately. Allow unkown architectures + (e.g. binary). */ + +static bfd_boolean +tic54x_set_arch_mach (abfd, arch, machine) + bfd *abfd; + enum bfd_architecture arch; + unsigned long machine; +{ + if (arch == bfd_arch_unknown) + arch = bfd_arch_tic54x; + + else if (arch != bfd_arch_tic54x) + return FALSE; + + return bfd_default_set_arch_mach (abfd, arch, machine); +} + +static bfd_reloc_status_type +tic54x_relocation (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry; + asymbol *symbol ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + if (output_bfd != (bfd *) NULL) + { + /* This is a partial relocation, and we want to apply the + relocation to the reloc entry rather than the raw data. + Modify the reloc inplace to reflect what we now know. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + return bfd_reloc_continue; +} + +reloc_howto_type tic54x_howto_table[] = + { + /* type,rightshift,size (0=byte, 1=short, 2=long), + bit size, pc_relative, bitpos, dont complain_on_overflow, + special_function, name, partial_inplace, src_mask, dst_mask, pcrel_offset. */ + + /* NORMAL BANK */ + /* 16-bit direct reference to symbol's address. */ + HOWTO (R_RELWORD,0,1,16,FALSE,0,complain_overflow_dont, + tic54x_relocation,"REL16",FALSE,0xFFFF,0xFFFF,FALSE), + + /* 7 LSBs of an address */ + HOWTO (R_PARTLS7,0,1,7,FALSE,0,complain_overflow_dont, + tic54x_relocation,"LS7",FALSE,0x007F,0x007F,FALSE), + + /* 9 MSBs of an address */ + /* TI assembler doesn't shift its encoding, and is thus incompatible */ + HOWTO (R_PARTMS9,7,1,9,FALSE,0,complain_overflow_dont, + tic54x_relocation,"MS9",FALSE,0x01FF,0x01FF,FALSE), + + /* 23-bit relocation */ + HOWTO (R_EXTWORD,0,2,23,FALSE,0,complain_overflow_dont, + tic54x_relocation,"RELEXT",FALSE,0x7FFFFF,0x7FFFFF,FALSE), + + /* 16 bits of 23-bit extended address */ + HOWTO (R_EXTWORD16,0,1,16,FALSE,0,complain_overflow_dont, + tic54x_relocation,"RELEXT16",FALSE,0x7FFFFF,0x7FFFFF,FALSE), + + /* upper 7 bits of 23-bit extended address */ + HOWTO (R_EXTWORDMS7,16,1,7,FALSE,0,complain_overflow_dont, + tic54x_relocation,"RELEXTMS7",FALSE,0x7F,0x7F,FALSE), + + /* ABSOLUTE BANK */ + /* 16-bit direct reference to symbol's address, absolute */ + HOWTO (R_RELWORD,0,1,16,FALSE,0,complain_overflow_dont, + tic54x_relocation,"AREL16",FALSE,0xFFFF,0xFFFF,FALSE), + + /* 7 LSBs of an address, absolute */ + HOWTO (R_PARTLS7,0,1,7,FALSE,0,complain_overflow_dont, + tic54x_relocation,"ALS7",FALSE,0x007F,0x007F,FALSE), + + /* 9 MSBs of an address, absolute */ + /* TI assembler doesn't shift its encoding, and is thus incompatible */ + HOWTO (R_PARTMS9,7,1,9,FALSE,0,complain_overflow_dont, + tic54x_relocation,"AMS9",FALSE,0x01FF,0x01FF,FALSE), + + /* 23-bit direct reference, absolute */ + HOWTO (R_EXTWORD,0,2,23,FALSE,0,complain_overflow_dont, + tic54x_relocation,"ARELEXT",FALSE,0x7FFFFF,0x7FFFFF,FALSE), + + /* 16 bits of 23-bit extended address, absolute */ + HOWTO (R_EXTWORD16,0,1,16,FALSE,0,complain_overflow_dont, + tic54x_relocation,"ARELEXT16",FALSE,0x7FFFFF,0x7FFFFF,FALSE), + + /* upper 7 bits of 23-bit extended address, absolute */ + HOWTO (R_EXTWORDMS7,16,1,7,FALSE,0,complain_overflow_dont, + tic54x_relocation,"ARELEXTMS7",FALSE,0x7F,0x7F,FALSE), + + /* 32-bit relocation exclusively for stabs */ + HOWTO (R_RELLONG,0,2,32,FALSE,0,complain_overflow_dont, + tic54x_relocation,"STAB",FALSE,0xFFFFFFFF,0xFFFFFFFF,FALSE), + }; + +#define coff_bfd_reloc_type_lookup tic54x_coff_reloc_type_lookup + +/* For the case statement use the code values used tc_gen_reloc (defined in + bfd/reloc.c) to map to the howto table entries. */ + +reloc_howto_type * +tic54x_coff_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + switch (code) + { + case BFD_RELOC_16: + return &tic54x_howto_table[0]; + case BFD_RELOC_TIC54X_PARTLS7: + return &tic54x_howto_table[1]; + case BFD_RELOC_TIC54X_PARTMS9: + return &tic54x_howto_table[2]; + case BFD_RELOC_TIC54X_23: + return &tic54x_howto_table[3]; + case BFD_RELOC_TIC54X_16_OF_23: + return &tic54x_howto_table[4]; + case BFD_RELOC_TIC54X_MS7_OF_23: + return &tic54x_howto_table[5]; + case BFD_RELOC_32: + return &tic54x_howto_table[12]; + default: + return (reloc_howto_type *) NULL; + } +} + +/* Code to turn a r_type into a howto ptr, uses the above howto table. + Called after some initial checking by the tic54x_rtype_to_howto fn below. */ + +static void +tic54x_lookup_howto (internal, dst) + arelent *internal; + struct internal_reloc *dst; +{ + unsigned i; + int bank = (dst->r_symndx == -1) ? HOWTO_BANK : 0; + + for (i = 0; i < sizeof tic54x_howto_table/sizeof tic54x_howto_table[0]; i++) + { + if (tic54x_howto_table[i].type == dst->r_type) + { + internal->howto = tic54x_howto_table + i + bank; + return; + } + } + + (*_bfd_error_handler) (_("Unrecognized reloc type 0x%x"), + (unsigned int) dst->r_type); + abort (); +} + +#define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\ + tic54x_reloc_processing(RELENT,RELOC,SYMS,ABFD,SECT) + +#define coff_rtype_to_howto coff_tic54x_rtype_to_howto + +static reloc_howto_type * +coff_tic54x_rtype_to_howto (abfd, sec, rel, h, sym, addendp) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + struct internal_reloc *rel; + struct coff_link_hash_entry *h ATTRIBUTE_UNUSED; + struct internal_syment *sym ATTRIBUTE_UNUSED; + bfd_vma *addendp; +{ + arelent genrel; + + if (rel->r_symndx == -1 && addendp != NULL) + { + /* This is a TI "internal relocation", which means that the relocation + amount is the amount by which the current section is being relocated + in the output section. */ + *addendp = (sec->output_section->vma + sec->output_offset) - sec->vma; + } + + tic54x_lookup_howto (&genrel, rel); + + return genrel.howto; +} + +/* Replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local + labels. */ + +static bfd_boolean +ticoff_bfd_is_local_label_name (abfd, name) + bfd *abfd ATTRIBUTE_UNUSED; + const char *name; +{ + if (TICOFF_LOCAL_LABEL_P(name)) + return TRUE; + return FALSE; +} + +#define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name + +/* Customize coffcode.h; the default coff_ functions are set up to use COFF2; + coff_bad_format_hook uses BADMAG, so set that for COFF2. The COFF1 + and COFF0 vectors use custom _bad_format_hook procs instead of setting + BADMAG. */ +#define BADMAG(x) COFF2_BADMAG(x) +#include "coffcode.h" + +static bfd_boolean +tic54x_set_section_contents (abfd, section, location, offset, bytes_to_do) + bfd *abfd; + sec_ptr section; + const PTR location; + file_ptr offset; + bfd_size_type bytes_to_do; +{ + return coff_set_section_contents (abfd, section, location, + offset, bytes_to_do); +} + +static void +tic54x_reloc_processing (relent, reloc, symbols, abfd, section) + arelent *relent; + struct internal_reloc *reloc; + asymbol **symbols; + bfd *abfd; + asection *section; +{ + asymbol *ptr; + + relent->address = reloc->r_vaddr; + + if (reloc->r_symndx != -1) + { + if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd)) + { + (*_bfd_error_handler) + (_("%s: warning: illegal symbol index %ld in relocs"), + bfd_archive_filename (abfd), reloc->r_symndx); + relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + ptr = NULL; + } + else + { + relent->sym_ptr_ptr = (symbols + + obj_convert (abfd)[reloc->r_symndx]); + ptr = *(relent->sym_ptr_ptr); + } + } + else + { + relent->sym_ptr_ptr = section->symbol_ptr_ptr; + ptr = *(relent->sym_ptr_ptr); + } + + /* The symbols definitions that we have read in have been + relocated as if their sections started at 0. But the offsets + refering to the symbols in the raw data have not been + modified, so we have to have a negative addend to compensate. + + Note that symbols which used to be common must be left alone. */ + + /* Calculate any reloc addend by looking at the symbol. */ + CALC_ADDEND (abfd, ptr, *reloc, relent); + + relent->address -= section->vma; + /* !! relent->section = (asection *) NULL;*/ + + /* Fill in the relent->howto field from reloc->r_type. */ + tic54x_lookup_howto (relent, reloc); +} + +/* TI COFF v0, DOS tools (little-endian headers). */ +const bfd_target tic54x_coff0_vec = + { + "coff0-c54x", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT ), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + '_', /* leading symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ + bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (tic54x), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + NULL, + + (PTR) & ticoff0_swap_table + }; + +/* TI COFF v0, SPARC tools (big-endian headers). */ +const bfd_target tic54x_coff0_beh_vec = + { + "coff0-beh-c54x", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_BIG, /* header byte order is big */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT ), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + '_', /* leading symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ + bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (tic54x), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & tic54x_coff0_vec, + + (PTR) & ticoff0_swap_table + }; + +/* TI COFF v1, DOS tools (little-endian headers). */ +const bfd_target tic54x_coff1_vec = + { + "coff1-c54x", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT ), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + '_', /* leading symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ + bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (tic54x), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & tic54x_coff0_beh_vec, + + (PTR) & ticoff1_swap_table +}; + +/* TI COFF v1, SPARC tools (big-endian headers). */ +const bfd_target tic54x_coff1_beh_vec = + { + "coff1-beh-c54x", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_BIG, /* header byte order is big */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT ), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + '_', /* leading symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ + bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (tic54x), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & tic54x_coff1_vec, + + (PTR) & ticoff1_swap_table + }; + +/* TI COFF v2, TI DOS tools output (little-endian headers). */ +const bfd_target tic54x_coff2_vec = + { + "coff2-c54x", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_LITTLE, /* header byte order is little (DOS tools) */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT ), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + '_', /* leading symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ + bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (tic54x), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & tic54x_coff1_beh_vec, + + COFF_SWAP_TABLE + }; + +/* TI COFF v2, TI SPARC tools output (big-endian headers). */ +const bfd_target tic54x_coff2_beh_vec = + { + "coff2-beh-c54x", /* name */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_BIG, /* header byte order is big */ + + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT ), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + '_', /* leading symbol underscore */ + '/', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + + {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */ + bfd_false}, + {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (tic54x), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + & tic54x_coff2_vec, + + COFF_SWAP_TABLE + }; diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c new file mode 100644 index 0000000000000..c7ec9bd61f20e --- /dev/null +++ b/bfd/coff-tic80.c @@ -0,0 +1,723 @@ +/* BFD back-end for Texas Instruments TMS320C80 Multimedia Video Processor (MVP). + Copyright 1996, 1997, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + Written by Fred Fish (fnf@cygnus.com) + + There is nothing new under the sun. This file draws a lot on other + coff files. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "bfdlink.h" +#include "sysdep.h" +#include "libbfd.h" +#include "coff/tic80.h" +#include "coff/internal.h" +#include "libcoff.h" + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) +#define COFF_ALIGN_IN_SECTION_HEADER 1 +#define COFF_ALIGN_IN_SFLAGS 1 + +#define GET_SCNHDR_FLAGS H_GET_16 +#define PUT_SCNHDR_FLAGS H_PUT_16 + +static void rtype2howto + PARAMS ((arelent *cache_ptr, struct internal_reloc *dst)); +static bfd_reloc_status_type ppbase_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type glob15_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type glob16_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type local16_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_boolean coff_tic80_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **)); +static reloc_howto_type * coff_tic80_rtype_to_howto + PARAMS ((bfd *, asection *, struct internal_reloc *, + struct coff_link_hash_entry *, struct internal_syment *, + bfd_vma *)); + +static reloc_howto_type tic80_howto_table[] = +{ + + HOWTO (R_RELLONG, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + NULL, /* special_function */ + "RELLONG", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MPPCR, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + NULL, /* special_function */ + "MPPCR", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ABS, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + NULL, /* special_function */ + "ABS", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPBASE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + ppbase_reloc, /* special_function */ + "PPBASE", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPLBASE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + ppbase_reloc, /* special_function */ + "PPLBASE", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PP15, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 6, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + glob15_reloc, /* special_function */ + "PP15", /* name */ + TRUE, /* partial_inplace */ + 0x1ffc0, /* src_mask */ + 0x1ffc0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PP15W, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 6, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + glob15_reloc, /* special_function */ + "PP15W", /* name */ + TRUE, /* partial_inplace */ + 0x1ffc0, /* src_mask */ + 0x1ffc0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PP15H, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 6, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + glob15_reloc, /* special_function */ + "PP15H", /* name */ + TRUE, /* partial_inplace */ + 0x1ffc0, /* src_mask */ + 0x1ffc0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PP16B, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 6, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + glob16_reloc, /* special_function */ + "PP16B", /* name */ + TRUE, /* partial_inplace */ + 0x3ffc0, /* src_mask */ + 0x3ffc0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPL15, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "PPL15", /* name */ + TRUE, /* partial_inplace */ + 0x7fff, /* src_mask */ + 0x7fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPL15W, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "PPL15W", /* name */ + TRUE, /* partial_inplace */ + 0x7fff, /* src_mask */ + 0x7fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPL15H, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "PPL15H", /* name */ + TRUE, /* partial_inplace */ + 0x7fff, /* src_mask */ + 0x7fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPL16B, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + local16_reloc, /* special_function */ + "PPL16B", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPN15, /* type */ + 0, /* rightshift */ + -2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 6, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + glob15_reloc, /* special_function */ + "PPN15", /* name */ + TRUE, /* partial_inplace */ + 0x1ffc0, /* src_mask */ + 0x1ffc0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPN15W, /* type */ + 2, /* rightshift */ + -2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 6, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + glob15_reloc, /* special_function */ + "PPN15W", /* name */ + TRUE, /* partial_inplace */ + 0x1ffc0, /* src_mask */ + 0x1ffc0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPN15H, /* type */ + 1, /* rightshift */ + -2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 6, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + glob15_reloc, /* special_function */ + "PPN15H", /* name */ + TRUE, /* partial_inplace */ + 0x1ffc0, /* src_mask */ + 0x1ffc0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPN16B, /* type */ + 0, /* rightshift */ + -2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 6, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + glob16_reloc, /* special_function */ + "PPN16B", /* name */ + TRUE, /* partial_inplace */ + 0x3ffc0, /* src_mask */ + 0x3ffc0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPLN15, /* type */ + 0, /* rightshift */ + -2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "PPLN15", /* name */ + TRUE, /* partial_inplace */ + 0x7fff, /* src_mask */ + 0x7fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPLN15W, /* type */ + 2, /* rightshift */ + -2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "PPLN15W", /* name */ + TRUE, /* partial_inplace */ + 0x7fff, /* src_mask */ + 0x7fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPLN15H, /* type */ + 1, /* rightshift */ + -2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "PPLN15H", /* name */ + TRUE, /* partial_inplace */ + 0x7fff, /* src_mask */ + 0x7fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_PPLN16B, /* type */ + 0, /* rightshift */ + -2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + local16_reloc, /* special_function */ + "PPLN16B", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE) /* pcrel_offset */ +}; + +/* Special relocation functions, used when the output file is not + itself a COFF TIc80 file. */ + +/* This special function is used for the base address type + relocations. */ + +static bfd_reloc_status_type +ppbase_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, + error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry ATTRIBUTE_UNUSED; + asymbol *symbol_in ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection *input_section ATTRIBUTE_UNUSED; + bfd *output_bfd ATTRIBUTE_UNUSED; + char **error_message ATTRIBUTE_UNUSED; +{ + /* FIXME. */ + abort (); +} + +/* This special function is used for the global 15 bit relocations. */ + +static bfd_reloc_status_type +glob15_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, + error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry ATTRIBUTE_UNUSED; + asymbol *symbol_in ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection *input_section ATTRIBUTE_UNUSED; + bfd *output_bfd ATTRIBUTE_UNUSED; + char **error_message ATTRIBUTE_UNUSED; +{ + /* FIXME. */ + abort (); +} + +/* This special function is used for the global 16 bit relocations. */ + +static bfd_reloc_status_type +glob16_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, + error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry ATTRIBUTE_UNUSED; + asymbol *symbol_in ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection *input_section ATTRIBUTE_UNUSED; + bfd *output_bfd ATTRIBUTE_UNUSED; + char **error_message ATTRIBUTE_UNUSED; +{ + /* FIXME. */ + abort (); +} + +/* This special function is used for the local 16 bit relocations. */ + +static bfd_reloc_status_type +local16_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, + error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry ATTRIBUTE_UNUSED; + asymbol *symbol_in ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection *input_section ATTRIBUTE_UNUSED; + bfd *output_bfd ATTRIBUTE_UNUSED; + char **error_message ATTRIBUTE_UNUSED; +{ + /* FIXME. */ + abort (); +} + +/* Code to turn an external r_type into a pointer to an entry in the howto_table. + If passed an r_type we don't recognize the abort rather than silently failing + to generate an output file. */ + +static void +rtype2howto (cache_ptr, dst) + arelent *cache_ptr; + struct internal_reloc *dst; +{ + unsigned int i; + + for (i = 0; i < sizeof tic80_howto_table / sizeof tic80_howto_table[0]; i++) + { + if (tic80_howto_table[i].type == dst->r_type) + { + cache_ptr->howto = tic80_howto_table + i; + return; + } + } + + (*_bfd_error_handler) (_("Unrecognized reloc type 0x%x"), + (unsigned int) dst->r_type); + cache_ptr->howto = tic80_howto_table + 0; +} + +#define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst) +#define coff_rtype_to_howto coff_tic80_rtype_to_howto + +static reloc_howto_type * +coff_tic80_rtype_to_howto (abfd, sec, rel, h, sym, addendp) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + struct internal_reloc *rel; + struct coff_link_hash_entry *h ATTRIBUTE_UNUSED; + struct internal_syment *sym ATTRIBUTE_UNUSED; + bfd_vma *addendp; +{ + arelent genrel; + + if (rel -> r_symndx == -1 && addendp != NULL) + { + /* This is a TI "internal relocation", which means that the relocation + amount is the amount by which the current section is being relocated + in the output section. */ + *addendp = (sec -> output_section -> vma + sec -> output_offset) - sec -> vma; + } + RTYPE2HOWTO (&genrel, rel); + return genrel.howto; +} + +#ifndef BADMAG +#define BADMAG(x) TIC80BADMAG(x) +#endif + +#define coff_relocate_section coff_tic80_relocate_section + +/* We need a special relocation routine to handle the PP relocs. Most + of this is a copy of _bfd_coff_generic_relocate_section. */ + +static bfd_boolean +coff_tic80_relocate_section (output_bfd, info, input_bfd, + input_section, contents, relocs, syms, + sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + struct internal_reloc *relocs; + struct internal_syment *syms; + asection **sections; +{ + struct internal_reloc *rel; + struct internal_reloc *relend; + + rel = relocs; + relend = rel + input_section->reloc_count; + for (; rel < relend; rel++) + { + long symndx; + struct coff_link_hash_entry *h; + struct internal_syment *sym; + bfd_vma addend; + bfd_vma val; + reloc_howto_type *howto; + bfd_reloc_status_type rstat; + bfd_vma addr; + + symndx = rel->r_symndx; + + if (symndx == -1) + { + h = NULL; + sym = NULL; + } + else + { + h = obj_coff_sym_hashes (input_bfd)[symndx]; + sym = syms + symndx; + } + + /* COFF treats common symbols in one of two ways. Either the + size of the symbol is included in the section contents, or it + is not. We assume that the size is not included, and force + the rtype_to_howto function to adjust the addend as needed. */ + + if (sym != NULL && sym->n_scnum != 0) + addend = - sym->n_value; + else + addend = 0; + + howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h, + sym, &addend); + if (howto == NULL) + return FALSE; + + val = 0; + + if (h == NULL) + { + asection *sec; + + if (symndx == -1) + { + sec = bfd_abs_section_ptr; + val = 0; + } + else + { + sec = sections[symndx]; + val = (sec->output_section->vma + + sec->output_offset + + sym->n_value); + if (! obj_pe (output_bfd)) + val -= sec->vma; + } + } + else + { + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + asection *sec; + + sec = h->root.u.def.section; + val = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + + else if (! info->relocatable) + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, input_section, + rel->r_vaddr - input_section->vma, TRUE))) + return FALSE; + } + } + + addr = rel->r_vaddr - input_section->vma; + + /* FIXME: This code assumes little endian, but the PP can + apparently be bi-endian. I don't know if the bi-endianness + applies to the instruction set or just to the data. */ + switch (howto->type) + { + default: + case R_ABS: + case R_RELLONGX: + case R_PPL15: + case R_PPL15W: + case R_PPL15H: + case R_PPLN15: + case R_PPLN15W: + case R_PPLN15H: + rstat = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, addr, val, addend); + break; + + case R_PP15: + case R_PP15W: + case R_PP15H: + case R_PPN15: + case R_PPN15W: + case R_PPN15H: + /* Offset the address so that we can use 4 byte relocations. */ + rstat = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents + 2, addr, val, addend); + break; + + case R_PP16B: + case R_PPN16B: + { + /* The most significant bit is stored in bit 6. */ + bfd_byte hold; + + hold = contents[addr + 4]; + contents[addr + 4] &=~ 0x20; + contents[addr + 4] |= (contents[addr] >> 1) & 0x20; + rstat = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents + 2, addr, + val, addend); + contents[addr] &=~ 0x40; + contents[addr] |= (contents[addr + 4] << 1) & 0x40; + contents[addr + 4] &=~ 0x20; + contents[addr + 4] |= hold & 0x20; + break; + } + + case R_PPL16B: + case R_PPLN16B: + { + /* The most significant bit is stored in bit 28. */ + bfd_byte hold; + + hold = contents[addr + 1]; + contents[addr + 1] &=~ 0x80; + contents[addr + 1] |= (contents[addr + 3] << 3) & 0x80; + rstat = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, addr, + val, addend); + contents[addr + 3] &= ~0x10; + contents[addr + 3] |= (contents[addr + 1] >> 3) & 0x10; + contents[addr + 1] &=~ 0x80; + contents[addr + 1] |= hold & 0x80; + break; + } + + case R_PPBASE: + /* Parameter RAM is from 0x1000000 to 0x1000800. */ + contents[addr] &=~ 0x3; + if (val >= 0x1000000 && val < 0x1000800) + contents[addr] |= 0x3; + else + contents[addr] |= 0x2; + rstat = bfd_reloc_ok; + break; + + case R_PPLBASE: + /* Parameter RAM is from 0x1000000 to 0x1000800. */ + contents[addr + 2] &= ~0xc0; + if (val >= 0x1000000 && val < 0x1000800) + contents[addr + 2] |= 0xc0; + else + contents[addr + 2] |= 0x80; + rstat = bfd_reloc_ok; + break; + } + + switch (rstat) + { + default: + abort (); + case bfd_reloc_ok: + break; + case bfd_reloc_outofrange: + (*_bfd_error_handler) + (_("%s: bad reloc address 0x%lx in section `%s'"), + bfd_archive_filename (input_bfd), + (unsigned long) rel->r_vaddr, + bfd_get_section_name (input_bfd, input_section)); + return FALSE; + case bfd_reloc_overflow: + { + const char *name; + char buf[SYMNMLEN + 1]; + + if (symndx == -1) + name = "*ABS*"; + else if (h != NULL) + name = h->root.root.string; + else + { + name = _bfd_coff_internal_syment_name (input_bfd, sym, buf); + if (name == NULL) + return FALSE; + } + + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, input_bfd, + input_section, rel->r_vaddr - input_section->vma))) + return FALSE; + } + } + } + return TRUE; +} + +#define TIC80COFF 1 /* Customize coffcode.h */ +#undef C_AUTOARG /* Clashes with TIc80's C_UEXT */ +#undef C_LASTENT /* Clashes with TIc80's C_STATLAB */ +#include "coffcode.h" + +CREATE_LITTLE_COFF_TARGET_VEC (tic80coff_vec, "coff-tic80", D_PAGED, 0, '_', NULL, COFF_SWAP_TABLE) diff --git a/bfd/coff-u68k.c b/bfd/coff-u68k.c new file mode 100644 index 0000000000000..97ea73fa9c62b --- /dev/null +++ b/bfd/coff-u68k.c @@ -0,0 +1,35 @@ +/* BFD back-end for Motorola 68000 COFF binaries having underscore with name. + Copyright 1990, 1991, 1992 Free Software Foundation, Inc. + Written by Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define TARGET_SYM m68kcoffun_vec +#define TARGET_NAME "coff-m68k-un" + +#define NAMES_HAVE_UNDERSCORE + +/* define this to not have multiple copy of m68k_rtype2howto + in the executable file */ +#define ONLY_DECLARE_RELOCS + +/* This magic number indicates that the names have underscores. + Other 68k magic numbers indicate that the names do not have + underscores. */ +#define BADMAG(x) ((x).f_magic != MC68KBCSMAGIC) + +#include "coff-m68k.c" diff --git a/bfd/coff-w65.c b/bfd/coff-w65.c new file mode 100644 index 0000000000000..63634b70e93ed --- /dev/null +++ b/bfd/coff-w65.c @@ -0,0 +1,383 @@ +/* BFD back-end for WDC 65816 COFF binaries. + Copyright 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Written by Steve Chamberlain, . + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "bfdlink.h" +#include "coff/w65.h" +#include "coff/internal.h" +#include "libcoff.h" + +static int select_reloc PARAMS ((reloc_howto_type *)); +static void rtype2howto PARAMS ((arelent *, struct internal_reloc *)); +static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)); +static int w65_reloc16_estimate PARAMS ((bfd *, asection *, arelent *, unsigned int, struct bfd_link_info *)); +static void w65_reloc16_extra_cases PARAMS ((bfd *,struct bfd_link_info *, struct bfd_link_order *, arelent *, bfd_byte *, unsigned int *, unsigned int *)); + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) +static reloc_howto_type howto_table[] = + { + HOWTO (R_W65_ABS8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "abs8", TRUE, 0x000000ff, 0x000000ff, FALSE), + HOWTO (R_W65_ABS16, 1, 0, 16, FALSE, 0, complain_overflow_bitfield, 0, "abs16", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (R_W65_ABS24, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "abs24", TRUE, 0x00ffffff, 0x00ffffff, FALSE), + HOWTO (R_W65_ABS8S8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, ">abs8", TRUE, 0x000000ff, 0x000000ff, FALSE), + HOWTO (R_W65_ABS8S16, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "^abs8", TRUE, 0x000000ff, 0x000000ff, FALSE), + HOWTO (R_W65_ABS16S8, 1, 0, 16, FALSE, 0, complain_overflow_bitfield, 0, ">abs16", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (R_W65_ABS16S16,1, 0, 16, FALSE, 0, complain_overflow_bitfield, 0, "^abs16", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (R_W65_PCR8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "pcrel8", TRUE, 0x000000ff, 0x000000ff, TRUE), + HOWTO (R_W65_PCR16, 1, 0, 16, FALSE, 0, complain_overflow_bitfield, 0, "pcrel16", TRUE, 0x0000ffff, 0x0000ffff, TRUE), + HOWTO (R_W65_DP, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "dp", TRUE, 0x000000ff, 0x000000ff, FALSE), + }; + +/* Turn a howto into a reloc number. */ + +#define SELECT_RELOC(x,howto) \ + { x.r_type = select_reloc(howto); } + +#define BADMAG(x) (W65BADMAG(x)) +#define W65 1 /* Customize coffcode.h */ +#define __A_MAGIC_SET__ + +/* Code to swap in the reloc */ +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 +#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ + dst->r_stuff[0] = 'S'; \ + dst->r_stuff[1] = 'C'; + +static int +select_reloc (howto) + reloc_howto_type *howto; +{ + return howto->type ; +} + +/* Code to turn a r_type into a howto ptr, uses the above howto table. */ + +static void +rtype2howto (internal, dst) + arelent *internal; + struct internal_reloc *dst; +{ + internal->howto = howto_table + dst->r_type - 1; +} + +#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry) + +/* Perform any necessary magic to the addend in a reloc entry. */ + +#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ + cache_ptr->addend = ext_reloc.r_offset; + +#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ + reloc_processing(relent, reloc, symbols, abfd, section) + +static void +reloc_processing (relent, reloc, symbols, abfd, section) + arelent * relent; + struct internal_reloc *reloc; + asymbol ** symbols; + bfd * abfd; + asection * section; +{ + relent->address = reloc->r_vaddr; + rtype2howto (relent, reloc); + + if (((int) reloc->r_symndx) > 0) + relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; + else + relent->sym_ptr_ptr = (asymbol **)&(bfd_abs_symbol); + + relent->addend = reloc->r_offset; + + relent->address -= section->vma; + /* relent->section = 0;*/ +} + +static int +w65_reloc16_estimate (abfd, input_section, reloc, shrink, link_info) + bfd *abfd; + asection *input_section; + arelent *reloc; + unsigned int shrink; + struct bfd_link_info *link_info; +{ + bfd_vma value; + bfd_vma dot; + bfd_vma gap; + + /* The address of the thing to be relocated will have moved back by + the size of the shrink - but we don't change reloc->address here, + since we need it to know where the relocation lives in the source + uncooked section. */ + + /* reloc->address -= shrink; conceptual */ + + bfd_vma address = reloc->address - shrink; + + switch (reloc->howto->type) + { + case R_MOV16B2: + case R_JMP2: + shrink+=2; + break; + + /* Thing is a move one byte. */ + case R_MOV16B1: + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + if (value >= 0xff00) + { + /* Change the reloc type from 16bit, possible 8 to 8bit + possible 16. */ + reloc->howto = reloc->howto + 1; + /* The place to relc moves back by one. */ + /* This will be two bytes smaller in the long run. */ + shrink += 2; + bfd_perform_slip (abfd, 2, input_section, address); + } + + break; + /* This is the 24 bit branch which could become an 8 bitter, + the relocation points to the first byte of the insn, not the + actual data. */ + + case R_JMPL1: + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + dot = input_section->output_section->vma + + input_section->output_offset + address; + + /* See if the address we're looking at within 127 bytes of where + we are, if so then we can use a small branch rather than the + jump we were going to. */ + gap = value - dot; + + if (-120 < (long) gap && (long) gap < 120) + { + /* Change the reloc type from 24bit, possible 8 to 8bit + possible 32. */ + reloc->howto = reloc->howto + 1; + /* This will be two bytes smaller in the long run. */ + shrink += 2; + bfd_perform_slip (abfd, 2, input_section, address); + } + break; + + case R_JMP1: + value = bfd_coff_reloc16_get_value (reloc, link_info, input_section); + + dot = input_section->output_section->vma + + input_section->output_offset + address; + + /* See if the address we're looking at within 127 bytes of where + we are, if so then we can use a small branch rather than the + jump we were going to. */ + gap = value - (dot - shrink); + + if (-120 < (long) gap && (long) gap < 120) + { + /* Change the reloc type from 16bit, possible 8 to 8bit + possible 16. */ + reloc->howto = reloc->howto + 1; + /* The place to relc moves back by one. */ + + /* This will be two bytes smaller in the long run. */ + shrink += 2; + bfd_perform_slip (abfd, 2, input_section, address); + } + break; + } + + return shrink; +} + +/* First phase of a relaxing link. */ + +/* Reloc types + large small + R_MOV16B1 R_MOV16B2 mov.b with 16bit or 8 bit address + R_JMP1 R_JMP2 jmp or pcrel branch + R_JMPL1 R_JMPL_B8 24jmp or pcrel branch + R_MOV24B1 R_MOV24B2 24 or 8 bit reloc for mov.b */ + +static void +w65_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, + dst_ptr) + bfd *abfd; + struct bfd_link_info *link_info; + struct bfd_link_order *link_order; + arelent *reloc; + bfd_byte *data; + unsigned int *src_ptr; + unsigned int *dst_ptr; +{ + unsigned int src_address = *src_ptr; + unsigned int dst_address = *dst_ptr; + asection *input_section = link_order->u.indirect.section; + + switch (reloc->howto->type) + { + case R_W65_ABS8: + case R_W65_DP: + { + unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + bfd_put_8 (abfd, gap, data + dst_address); + dst_address += 1; + src_address += 1; + } + break; + + case R_W65_ABS8S8: + { + unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + gap >>= 8; + bfd_put_8 (abfd, gap, data + dst_address); + dst_address += 1; + src_address += 1; + } + break; + + case R_W65_ABS8S16: + { + unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + gap >>= 16; + bfd_put_8 (abfd, gap, data + dst_address); + dst_address += 1; + src_address += 1; + } + break; + + case R_W65_ABS16: + { + unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + + bfd_put_16 (abfd, (bfd_vma) gap, data + dst_address); + dst_address += 2; + src_address += 2; + } + break; + case R_W65_ABS16S8: + { + unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + gap >>= 8; + bfd_put_16 (abfd, (bfd_vma) gap, data + dst_address); + dst_address += 2; + src_address += 2; + } + break; + case R_W65_ABS16S16: + { + unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + gap >>= 16; + bfd_put_16 (abfd, (bfd_vma) gap, data + dst_address); + dst_address += 2; + src_address += 2; + } + break; + + case R_W65_ABS24: + { + unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + bfd_put_16 (abfd, (bfd_vma) gap, data + dst_address); + bfd_put_8 (abfd, gap >> 16, data+dst_address + 2); + dst_address += 3; + src_address += 3; + } + break; + + case R_W65_PCR8: + { + int gap = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + bfd_vma dot = link_order->offset + + dst_address + + link_order->u.indirect.section->output_section->vma; + + gap -= dot + 1; + if (gap < -128 || gap > 127) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + bfd_put_8 (abfd, gap, data + dst_address); + dst_address += 1; + src_address += 1; + } + break; + + case R_W65_PCR16: + { + bfd_vma gap = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + bfd_vma dot = link_order->offset + + dst_address + + link_order->u.indirect.section->output_section->vma; + + /* This wraps within the page, so ignore the relativeness, look at the + high part. */ + if ((gap & 0xf0000) != (dot & 0xf0000)) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + + gap -= dot + 2; + bfd_put_16 (abfd, gap, data + dst_address); + dst_address += 2; + src_address += 2; + } + break; + default: + printf (_("ignoring reloc %s\n"), reloc->howto->name); + break; + + } + *src_ptr = src_address; + *dst_ptr = dst_address; +} + +#define coff_reloc16_extra_cases w65_reloc16_extra_cases +#define coff_reloc16_estimate w65_reloc16_estimate + +#include "coffcode.h" + +#undef coff_bfd_get_relocated_section_contents +#undef coff_bfd_relax_section +#define coff_bfd_get_relocated_section_contents \ + bfd_coff_reloc16_get_relocated_section_contents +#define coff_bfd_relax_section bfd_coff_reloc16_relax_section + +CREATE_LITTLE_COFF_TARGET_VEC (w65_vec, "coff-w65", BFD_IS_RELAXABLE, 0, '_', NULL, COFF_SWAP_TABLE) diff --git a/bfd/coff-we32k.c b/bfd/coff-we32k.c new file mode 100644 index 0000000000000..72fa86ca12e33 --- /dev/null +++ b/bfd/coff-we32k.c @@ -0,0 +1,69 @@ +/* BFD back-end for we32k COFF files. + Copyright 1992, 1993, 1994, 1999, 2000, 2002, 2003 + Free Software Foundation, Inc. + Contributed by Brendan Kehoe (brendan@cs.widener.edu). + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "coff/we32k.h" +#include "coff/internal.h" +#include "libcoff.h" + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) + +static reloc_howto_type howto_table[] = +{ + EMPTY_HOWTO (0), + EMPTY_HOWTO (1), + EMPTY_HOWTO (2), + EMPTY_HOWTO (3), + EMPTY_HOWTO (4), + EMPTY_HOWTO (5), + HOWTO(R_DIR32, 0, 2, 32, FALSE, 0,complain_overflow_bitfield, 0, "dir32", TRUE, 0xffffffff,0xffffffff, FALSE), + EMPTY_HOWTO (7), + EMPTY_HOWTO (010), + EMPTY_HOWTO (011), + EMPTY_HOWTO (012), + EMPTY_HOWTO (013), + EMPTY_HOWTO (014), + EMPTY_HOWTO (015), + EMPTY_HOWTO (016), + HOWTO(R_RELBYTE, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "8", TRUE, 0x000000ff,0x000000ff, FALSE), + HOWTO(R_RELWORD, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "16", TRUE, 0x0000ffff,0x0000ffff, FALSE), + HOWTO(R_RELLONG, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "32", TRUE, 0xffffffff,0xffffffff, FALSE), + HOWTO(R_PCRBYTE, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0, "DISP8", TRUE, 0x000000ff,0x000000ff, FALSE), + HOWTO(R_PCRWORD, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "DISP16", TRUE, 0x0000ffff,0x0000ffff, FALSE), + HOWTO(R_PCRLONG, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "DISP32", TRUE, 0xffffffff,0xffffffff, FALSE), +}; + +/* Turn a howto into a reloc nunmber */ + +#define SELECT_RELOC(x,howto) { x.r_type = howto->type; } +#define BADMAG(x) WE32KBADMAG(x) +#define WE32K 1 + +#define RTYPE2HOWTO(cache_ptr, dst) \ + (cache_ptr)->howto = howto_table + (dst)->r_type; + +#include "coffcode.h" + +#define coff_write_armap bsd_write_armap + +CREATE_BIG_COFF_TARGET_VEC (we32kcoff_vec, "coff-we32k", 0, 0, 0, NULL, COFF_SWAP_TABLE) diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c new file mode 100644 index 0000000000000..cf4da77c299ca --- /dev/null +++ b/bfd/coff-z8k.c @@ -0,0 +1,343 @@ +/* BFD back-end for Zilog Z800n COFF binaries. + Copyright 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Contributed by Cygnus Support. + Written by Steve Chamberlain, . + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "bfdlink.h" +#include "coff/z8k.h" +#include "coff/internal.h" +#include "libcoff.h" + +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1) + +static reloc_howto_type r_imm32 = +HOWTO (R_IMM32, 0, 2, 32, FALSE, 0, + complain_overflow_bitfield, 0, "r_imm32", TRUE, 0xffffffff, + 0xffffffff, FALSE); + +static reloc_howto_type r_imm4l = +HOWTO (R_IMM4L, 0, 0, 4, FALSE, 0, + complain_overflow_bitfield, 0, "r_imm4l", TRUE, 0xf, 0xf, FALSE); + +static reloc_howto_type r_da = +HOWTO (R_IMM16, 0, 1, 16, FALSE, 0, + complain_overflow_bitfield, 0, "r_da", TRUE, 0x0000ffff, 0x0000ffff, + FALSE); + +static reloc_howto_type r_imm8 = +HOWTO (R_IMM8, 0, 0, 8, FALSE, 0, + complain_overflow_bitfield, 0, "r_imm8", TRUE, 0x000000ff, 0x000000ff, + FALSE); + +static reloc_howto_type r_rel16 = +HOWTO (R_REL16, 0, 1, 16, FALSE, 0, + complain_overflow_bitfield, 0, "r_rel16", TRUE, 0x0000ffff, 0x0000ffff, + TRUE); + +static reloc_howto_type r_jr = +HOWTO (R_JR, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0, + "r_jr", TRUE, 0, 0, TRUE); + +static reloc_howto_type r_disp7 = +HOWTO (R_DISP7, 0, 0, 7, TRUE, 0, complain_overflow_bitfield, 0, + "r_disp7", TRUE, 0, 0, TRUE); + +static reloc_howto_type r_callr = +HOWTO (R_CALLR, 0, 1, 12, TRUE, 0, complain_overflow_signed, 0, + "r_callr", TRUE, 0xfff, 0xfff, TRUE); + +/* Turn a howto into a reloc number */ + +static int +coff_z8k_select_reloc (reloc_howto_type *howto) +{ + return howto->type; +} + +#define SELECT_RELOC(x,howto) x.r_type = coff_z8k_select_reloc(howto) + +#define BADMAG(x) Z8KBADMAG(x) +#define Z8K 1 /* Customize coffcode.h */ +#define __A_MAGIC_SET__ + +/* Code to swap in the reloc. */ +#define SWAP_IN_RELOC_OFFSET H_GET_32 +#define SWAP_OUT_RELOC_OFFSET H_PUT_32 +#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \ + dst->r_stuff[0] = 'S'; \ + dst->r_stuff[1] = 'C'; + +/* Code to turn a r_type into a howto ptr, uses the above howto table. */ + +static void +rtype2howto (arelent *internal, struct internal_reloc *dst) +{ + switch (dst->r_type) + { + default: + abort (); + break; + case R_IMM8: + internal->howto = &r_imm8; + break; + case R_IMM16: + internal->howto = &r_da; + break; + case R_JR: + internal->howto = &r_jr; + break; + case R_DISP7: + internal->howto = &r_disp7; + break; + case R_CALLR: + internal->howto = &r_callr; + break; + case R_REL16: + internal->howto = &r_rel16; + break; + case R_IMM32: + internal->howto = &r_imm32; + break; + case R_IMM4L: + internal->howto = &r_imm4l; + break; + } +} + +#define RTYPE2HOWTO(internal, relocentry) rtype2howto (internal, relocentry) + +/* Perform any necessary magic to the addend in a reloc entry. */ + +#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \ + cache_ptr->addend = ext_reloc.r_offset; + +#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \ + reloc_processing(relent, reloc, symbols, abfd, section) + +static void +reloc_processing (arelent *relent, + struct internal_reloc *reloc, + asymbol **symbols, + bfd *abfd, + asection *section) +{ + relent->address = reloc->r_vaddr; + rtype2howto (relent, reloc); + + if (reloc->r_symndx > 0) + relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx]; + else + relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + + relent->addend = reloc->r_offset; + relent->address -= section->vma; +} + +static void +extra_case (bfd *in_abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + arelent *reloc, + bfd_byte *data, + unsigned int *src_ptr, + unsigned int *dst_ptr) +{ + asection * input_section = link_order->u.indirect.section; + + switch (reloc->howto->type) + { + case R_IMM8: + bfd_put_8 (in_abfd, + bfd_coff_reloc16_get_value (reloc, link_info, input_section), + data + *dst_ptr); + (*dst_ptr) += 1; + (*src_ptr) += 1; + break; + + case R_IMM32: + /* If no flags are set, assume immediate value. */ + if (! (*reloc->sym_ptr_ptr)->section->flags) + { + bfd_put_32 (in_abfd, + bfd_coff_reloc16_get_value (reloc, link_info, + input_section), + data + *dst_ptr); + } + else + { + bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + /* Addresses are 23 bit, and the layout of those in a 32-bit + value is as follows: + 1AAAAAAA xxxxxxxx AAAAAAAA AAAAAAAA + (A - address bits, x - ignore). */ + dst = (dst & 0xffff) | ((dst & 0xff0000) << 8) | 0x80000000; + bfd_put_32 (in_abfd, dst, data + *dst_ptr); + } + (*dst_ptr) += 4; + (*src_ptr) += 4; + break; + + case R_IMM4L: + bfd_put_8 (in_abfd, + ((bfd_get_8 (in_abfd, data + *dst_ptr) & 0xf0) + | (0x0f + & bfd_coff_reloc16_get_value (reloc, link_info, + input_section))), + data + *dst_ptr); + (*dst_ptr) += 1; + (*src_ptr) += 1; + break; + + case R_IMM16: + bfd_put_16 (in_abfd, + bfd_coff_reloc16_get_value (reloc, link_info, input_section), + data + *dst_ptr); + (*dst_ptr) += 2; + (*src_ptr) += 2; + break; + + case R_JR: + { + bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + bfd_vma dot = (link_order->offset + + *dst_ptr + + input_section->output_section->vma); + int gap = dst - dot - 1; /* -1, since we're in the odd byte of the + word and the pc's been incremented. */ + + if (gap & 1) + abort (); + gap /= 2; + if (gap > 128 || gap < -128) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + bfd_put_8 (in_abfd, gap, data + *dst_ptr); + (*dst_ptr)++; + (*src_ptr)++; + break; + } + + case R_DISP7: + { + bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + bfd_vma dot = (link_order->offset + + *dst_ptr + + input_section->output_section->vma); + int gap = dst - dot - 1; /* -1, since we're in the odd byte of the + word and the pc's been incremented. */ + + if (gap & 1) + abort (); + gap /= 2; + + if (gap > 0 || gap < -127) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + bfd_put_8 (in_abfd, + (bfd_get_8 ( in_abfd, data + *dst_ptr) & 0x80) + (-gap & 0x7f), + data + *dst_ptr); + (*dst_ptr)++; + (*src_ptr)++; + break; + } + + case R_CALLR: + { + bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + bfd_vma dot = (link_order->offset + + *dst_ptr + + input_section->output_section->vma); + int gap = dst - dot - 2; + + if (gap & 1) + abort (); + if (gap > 4096 || gap < -4095) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + gap /= 2; + bfd_put_16 (in_abfd, + (bfd_get_16 ( in_abfd, data + *dst_ptr) & 0xf000) | (-gap & 0x0fff), + data + *dst_ptr); + (*dst_ptr) += 2; + (*src_ptr) += 2; + break; + } + + case R_REL16: + { + bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + bfd_vma dot = (link_order->offset + + *dst_ptr + + input_section->output_section->vma); + int gap = dst - dot - 2; + + if (gap > 32767 || gap < -32768) + { + if (! ((*link_info->callbacks->reloc_overflow) + (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr), + reloc->howto->name, reloc->addend, input_section->owner, + input_section, reloc->address))) + abort (); + } + bfd_put_16 (in_abfd, (bfd_vma) gap, data + *dst_ptr); + (*dst_ptr) += 2; + (*src_ptr) += 2; + break; + } + + default: + abort (); + } +} + +#define coff_reloc16_extra_cases extra_case + +#include "coffcode.h" + +#undef coff_bfd_get_relocated_section_contents +#undef coff_bfd_relax_section +#define coff_bfd_get_relocated_section_contents \ + bfd_coff_reloc16_get_relocated_section_contents +#define coff_bfd_relax_section bfd_coff_reloc16_relax_section + +CREATE_BIG_COFF_TARGET_VEC (z8kcoff_vec, "coff-z8k", 0, 0, '_', NULL, COFF_SWAP_TABLE) diff --git a/bfd/configure.com b/bfd/configure.com new file mode 100644 index 0000000000000..929977ce8f174 --- /dev/null +++ b/bfd/configure.com @@ -0,0 +1,215 @@ +$! +$! This file configures the bfd library for use with openVMS (Alpha and Vax) +$! +$! We do not use the configure script, since we do not have /bin/sh +$! to execute it. +$! +$! Written by Klaus K"ampf (kkaempf@rmi.de) +$! +$arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2 +$arch = f$element(arch_indx,"|","|VAX|Alpha|") +$! +$if arch .eqs. "Alpha" +$then +$ write sys$output "Configuring for Alpha target" +$ target = "alpha" +$! +$! copy bfd-in2.h to bfd.h, replacing @ macros +$! +$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input - + []bfd-in2.h /output=[]bfd.h +$DECK +! +! Copy file, changing lines with macros (@@) +! +! + vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN"); + rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile)); + match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + vers := CURRENT_LINE-")"; + ELSE; + vers := "unknown"; + ENDIF; + + file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name")); + rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file)); + + match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT(vers); + ENDIF; + match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('64'); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('0'); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('__DECC'); + SPLIT_LINE; + COPY_TEXT('#include '); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('int64'); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('uint64'); + ENDIF; + WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file")); + QUIT +$ EOD +$ +$else +$ +$ write sys$output "Configuring for Vax target" +$ target = "vax" +$! +$! copy bfd-in2.h to bfd.h, replacing @ macros +$! +$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input - + []bfd-in2.h /output=[]bfd.h +$DECK +! +! Copy file, changing lines with macros (@@) +! +! + vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN"); + rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile)); + match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + vers := CURRENT_LINE-")"; + ELSE; + vers := "unknown"; + ENDIF; + + file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name")); + rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file)); + + match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT(vers); + ENDIF; + match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('32'); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('0'); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('__DECC'); + SPLIT_LINE; + COPY_TEXT('#include '); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('int64'); + ENDIF; + match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT('uint64'); + ENDIF; + WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file")); + QUIT +$ EOD +$endif +$ +$ write sys$output "Generated `bfd.h' from `bfd-in2.h'." +$! +$! +$! create targmatch.h +$! +$ open/write tfile []targmatch.h +$ write tfile "{ """ + target + "-*-*vms*""" + "," +$ write tfile "#if defined (SELECT_VECS)" +$ write tfile "SELECT_VECS" +$ write tfile "#else" +$ write tfile "UNSUPPORTED_TARGET" +$ write tfile "#endif" +$ write tfile "}," +$ close tfile +$ write sys$output "Generated `targmatch.h'" +$! +$! +$! create config.h +$! +$ create []config.h +/* config.h-vms. Generated by hand by Klaus Kämpf, kkaempf@didymus.rmi.de. */ +/* config.in. Generated automatically from configure.in by autoheader. */ +/* Whether malloc must be declared even if is included. */ +/* #undef NEED_DECLARATION_MALLOC */ +/* Whether free must be declared even if is included. */ +/* #undef NEED_DECLARATION_FREE */ +/* Define if you have a working `mmap' system call. */ +/* #define HAVE_MMAP 1 */ +/* Do we need to use the b modifier when opening binary files? */ +/* #undef USE_BINARY_FOPEN */ +/* Name of host specific header file to include in trad-core.c. */ +/* #undef TRAD_HEADER */ +/* Define only if is available *and* it defines prstatus_t. */ +/* #undef HAVE_SYS_PROCFS_H */ +/* Do we really want to use mmap if it's available? */ +/* #undef USE_MMAP */ +/* Define if you have the fcntl function. */ +#define HAVE_FCNTL 1 +/* Define if you have the getpagesize function. */ +#define HAVE_GETPAGESIZE 1 +/* Define if you have the madvise function. */ +#define HAVE_MADVISE 1 +/* Define if you have the mprotect function. */ +#define HAVE_MPROTECT 1 +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 +/* Define if you have the header file. */ +#define HAVE_STDDEF_H 1 +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 +/* Define if you have the header file. */ +#define HAVE_STRINGS_H 1 +/* Define if you have the header file. */ +#define HAVE_SYS_FILE_H 1 +/* Define if you have the header file. */ +#define HAVE_TIME_H 1 +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 +$! +$ write sys$output "Generated `config.h'" + diff --git a/bfd/cpu-a29k.c b/bfd/cpu-a29k.c new file mode 100644 index 0000000000000..d6352b199c4b3 --- /dev/null +++ b/bfd/cpu-a29k.c @@ -0,0 +1,39 @@ +/* BFD support for the AMD 29000 architecture. + Copyright 1992, 2000, 2002 Free Software Foundation, Inc. + Hacked by Steve Chamberlain of Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_a29k_arch = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_a29k, + 0, /* only 1 machine */ + "a29k", + "a29k", + 4, + TRUE, /* the one and only */ + bfd_default_compatible, + bfd_default_scan , + 0, + }; diff --git a/bfd/cpu-avr.c b/bfd/cpu-avr.c new file mode 100644 index 0000000000000..ba11c70a7a57c --- /dev/null +++ b/bfd/cpu-avr.c @@ -0,0 +1,93 @@ +/* BFD library support routines for the AVR architecture. + Copyright 1999, 2000, 2002 Free Software Foundation, Inc. + Contributed by Denis Chertykov + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +static const bfd_arch_info_type *compatible + PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); + +#define N(addr_bits, machine, print, default, next) \ +{ \ + 8, /* 8 bits in a word */ \ + addr_bits, /* bits in an address */ \ + 8, /* 8 bits in a byte */ \ + bfd_arch_avr, \ + machine, /* machine */ \ + "avr", /* arch_name */ \ + print, /* printable name */ \ + 1, /* section align power */ \ + default, /* the default machine */ \ + compatible, \ + bfd_default_scan, \ + next \ +} + +static const bfd_arch_info_type arch_info_struct[] = +{ + /* AT90S1200, ATtiny1x, ATtiny28 */ + N (16, bfd_mach_avr1, "avr:1", FALSE, & arch_info_struct[1]), + + /* AT90S2xxx, AT90S4xxx, AT90S8xxx, ATtiny22 */ + N (16, bfd_mach_avr2, "avr:2", FALSE, & arch_info_struct[2]), + + /* ATmega103, ATmega603 */ + N (22, bfd_mach_avr3, "avr:3", FALSE, & arch_info_struct[3]), + + /* ATmega83, ATmega85 */ + N (16, bfd_mach_avr4, "avr:4", FALSE, & arch_info_struct[4]), + + /* ATmega161, ATmega163, ATmega32, AT94K */ + N (22, bfd_mach_avr5, "avr:5", FALSE, NULL) +}; + +const bfd_arch_info_type bfd_avr_arch = + N (16, bfd_mach_avr2, "avr", TRUE, & arch_info_struct[0]); + +/* This routine is provided two arch_infos and works out which AVR + machine which would be compatible with both and returns a pointer + to its info structure. */ + +static const bfd_arch_info_type * +compatible (a,b) + const bfd_arch_info_type * a; + const bfd_arch_info_type * b; +{ + /* If a & b are for different architectures we can do nothing. */ + if (a->arch != b->arch) + return NULL; + + /* Special case for ATmega[16]03 (avr:3) and ATmega83 (avr:4). */ + if ((a->mach == bfd_mach_avr3 && b->mach == bfd_mach_avr4) + || (a->mach == bfd_mach_avr4 && b->mach == bfd_mach_avr3)) + return NULL; + + /* So far all newer AVR architecture cores are supersets of previous + cores. */ + if (a->mach <= b->mach) + return b; + + if (a->mach >= b->mach) + return a; + + /* Never reached! */ + return NULL; +} diff --git a/bfd/cpu-cris.c b/bfd/cpu-cris.c new file mode 100644 index 0000000000000..9e60ff062f305 --- /dev/null +++ b/bfd/cpu-cris.c @@ -0,0 +1,57 @@ +/* BFD support for the Axis CRIS architecture. + Copyright 2000, 2002 Free Software Foundation, Inc. + Contributed by Axis Communications AB. + Written by Hans-Peter Nilsson. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type +bfd_cris_arch = +{ + 32, /* There's 32 bits_per_word. */ + 32, /* There's 32 bits_per_address. */ + 8, /* There's 8 bits_per_byte. */ + bfd_arch_cris, /* One of enum bfd_architecture, defined + in archures.c and provided in + generated header files. */ + 0xff, /* Only 1 machine, but #255 for + historical reasons. */ + "cris", /* The arch_name. */ + "cris", /* The printable name is the same. */ + 1, /* Section alignment power; each section + is aligned to (only) 2^1 bytes. */ + TRUE, /* This is the default "machine", since + there's only one. */ + bfd_default_compatible, /* A default function for testing + "machine" compatibility of two + bfd_arch_info_type. */ + bfd_default_scan, /* Check if a bfd_arch_info_type is a + match. */ + NULL /* Pointer to next bfd_arch_info_type in + the same family. */ +}; + +/* + * Local variables: + * eval: (c-set-style "gnu") + * indent-tabs-mode: t + * End: + */ diff --git a/bfd/cpu-d10v.c b/bfd/cpu-d10v.c new file mode 100644 index 0000000000000..2be72d84163e8 --- /dev/null +++ b/bfd/cpu-d10v.c @@ -0,0 +1,71 @@ +/* BFD support for the D10V processor + Copyright 1996, 1999, 2000, 2002 Free Software Foundation, Inc. + Contributed by Martin Hunt (hunt@cygnus.com). + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +static const bfd_arch_info_type d10v_ts3_info = +{ + 16, /* 16 bits in a word */ + 16, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_d10v, + bfd_mach_d10v_ts3, + "d10v", + "d10v:ts3", + 4, /* section alignment power */ + FALSE, + bfd_default_compatible, + bfd_default_scan, + 0, +}; + +static const bfd_arch_info_type d10v_ts2_info = +{ + 16, /* 16 bits in a word */ + 16, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_d10v, + bfd_mach_d10v_ts2, + "d10v", + "d10v:ts2", + 4, /* section alignment power */ + FALSE, + bfd_default_compatible, + bfd_default_scan, + &d10v_ts3_info, +}; + +const bfd_arch_info_type bfd_d10v_arch = +{ + 16, /* 16 bits in a word */ + 16, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_d10v, + bfd_mach_d10v, + "d10v", + "d10v", + 4, /* section alignment power */ + TRUE, + bfd_default_compatible, + bfd_default_scan, + &d10v_ts2_info, +}; diff --git a/bfd/cpu-d30v.c b/bfd/cpu-d30v.c new file mode 100644 index 0000000000000..f884310062bed --- /dev/null +++ b/bfd/cpu-d30v.c @@ -0,0 +1,39 @@ +/* BFD support for the Mitsubishi D30V processor + Copyright 1997, 2002 Free Software Foundation, Inc. + Contributed by Martin Hunt (hunt@cygnus.com). + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_d30v_arch = +{ + 32, /* bits in a word */ + 32, /* bits in an address */ + 8, /* bits in a byte */ + bfd_arch_d30v, + 0, + "d30v", + "d30v", + 4, /* section alignment power */ + TRUE, + bfd_default_compatible, + bfd_default_scan, + 0, +}; diff --git a/bfd/cpu-dlx.c b/bfd/cpu-dlx.c new file mode 100644 index 0000000000000..358a97bfa649f --- /dev/null +++ b/bfd/cpu-dlx.c @@ -0,0 +1,39 @@ +/* BFD support for the DLX Microprocessor architecture. + Copyright 2002 Free Software Foundation, Inc. + Hacked by Kuang Hwa Lin + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_dlx_arch = + { + 32, /* 32 bits in a word. */ + 32, /* 32 bits in an address. */ + 8, /* 8 bits in a byte. */ + bfd_arch_dlx, + 0, /* Only 1 machine. */ + "dlx", + "dlx", + 4, + TRUE, /* The one and only. */ + bfd_default_compatible, + bfd_default_scan , + 0, +}; diff --git a/bfd/cpu-fr30.c b/bfd/cpu-fr30.c new file mode 100644 index 0000000000000..759f4d4b676b4 --- /dev/null +++ b/bfd/cpu-fr30.c @@ -0,0 +1,38 @@ +/* BFD support for the FR30 processor. + Copyright 1998, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_fr30_arch = +{ + 32, /* bits per word */ + 32, /* bits per address */ + 8, /* bits per byte */ + bfd_arch_fr30, /* architecture */ + bfd_mach_fr30, /* machine */ + "fr30", /* architecture name */ + "fr30", /* printable name */ + 4, /* section align power */ + TRUE, /* the default ? */ + bfd_default_compatible, /* architecture comparison fn */ + bfd_default_scan, /* string to architecture convert fn */ + NULL /* next in list */ +}; diff --git a/bfd/cpu-frv.c b/bfd/cpu-frv.c new file mode 100644 index 0000000000000..f911881a50552 --- /dev/null +++ b/bfd/cpu-frv.c @@ -0,0 +1,60 @@ +/* BFD support for the FRV processor. + Copyright 2002, 2003 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#define FRV_ARCH(MACHINE, NAME, DEFAULT, NEXT) \ +{ \ + 32, /* 32 bits in a word */ \ + 32, /* 32 bits in an address */ \ + 8, /* 8 bits in a byte */ \ + bfd_arch_frv, /* architecture */ \ + MACHINE, /* which machine */ \ + "frv", /* architecture name */ \ + NAME, /* machine name */ \ + 4, /* default alignment */ \ + DEFAULT, /* is this the default? */ \ + bfd_default_compatible, /* architecture comparison fn */ \ + bfd_default_scan, /* string to architecture convert fn */ \ + NEXT /* next in list */ \ +} + +static const bfd_arch_info_type arch_info_300 + = FRV_ARCH (bfd_mach_fr300, "fr300", FALSE, (bfd_arch_info_type *)0); + +static const bfd_arch_info_type arch_info_400 + = FRV_ARCH (bfd_mach_fr400, "fr400", FALSE, &arch_info_300); + +static const bfd_arch_info_type arch_info_500 + = FRV_ARCH (bfd_mach_fr500, "fr500", FALSE, &arch_info_400); + +static const bfd_arch_info_type arch_info_550 + = FRV_ARCH (bfd_mach_fr550, "fr550", FALSE, &arch_info_500); + +static const bfd_arch_info_type arch_info_simple + = FRV_ARCH (bfd_mach_frvsimple, "simple", FALSE, &arch_info_550); + +static const bfd_arch_info_type arch_info_tomcat + = FRV_ARCH (bfd_mach_frvtomcat, "tomcat", FALSE, &arch_info_simple); + +const bfd_arch_info_type bfd_frv_arch + = FRV_ARCH (bfd_mach_frv, "frv", TRUE, &arch_info_tomcat); + diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c new file mode 100644 index 0000000000000..5907de025376d --- /dev/null +++ b/bfd/cpu-h8300.c @@ -0,0 +1,251 @@ +/* BFD library support routines for the Renesas H8/300 architecture. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Hacked by Steve Chamberlain of Cygnus Support. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +static bfd_boolean +h8300_scan (const struct bfd_arch_info *info, const char *string) +{ + if (*string != 'h' && *string != 'H') + return FALSE; + + string++; + if (*string != '8') + return FALSE; + + string++; + if (*string == '/') + string++; + + if (*string != '3') + return FALSE; + string++; + if (*string != '0') + return FALSE; + string++; + if (*string != '0') + return FALSE; + string++; + if (*string == '-') + string++; + + /* In ELF linker scripts, we typically express the architecture/machine + as architecture:machine. + + So if we've matched so far and encounter a colon, try to match the + string following the colon. */ + if (*string == ':') + { + string++; + return h8300_scan (info, string); + } + + if (*string == 'h' || *string == 'H') + { + string++; + if (*string == 'n' || *string == 'N') + return (info->mach == bfd_mach_h8300hn); + + return (info->mach == bfd_mach_h8300h); + } + else if (*string == 's' || *string == 'S') + { + string++; + if (*string == 'n' || *string == 'N') + return (info->mach == bfd_mach_h8300sn); + + if (*string == 'x' || *string == 'X') + { + string++; + if (*string == 'n' || *string == 'N') + return (info->mach == bfd_mach_h8300sxn); + + return (info->mach == bfd_mach_h8300sx); + } + + return (info->mach == bfd_mach_h8300s); + } + else + return info->mach == bfd_mach_h8300; +} + +/* This routine is provided two arch_infos and works out the machine + which would be compatible with both and returns a pointer to its + info structure. */ + +static const bfd_arch_info_type * +compatible (const bfd_arch_info_type *in, const bfd_arch_info_type *out) +{ + /* It's really not a good idea to mix and match modes. */ + if (in->arch != out->arch || in->mach != out->mach) + return 0; + else + return in; +} + +static const bfd_arch_info_type h8300sxn_info_struct = +{ + 32, /* 32 bits in a word */ + 16, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_h8300, + bfd_mach_h8300sxn, + "h8300sxn", /* arch_name */ + "h8300sxn", /* printable name */ + 1, + FALSE, /* the default machine */ + compatible, + h8300_scan, + 0 +}; + +static const bfd_arch_info_type h8300sx_info_struct = +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_h8300, + bfd_mach_h8300sx, + "h8300sx", /* arch_name */ + "h8300sx", /* printable name */ + 1, + FALSE, /* the default machine */ + compatible, + h8300_scan, + &h8300sxn_info_struct +}; + +static const bfd_arch_info_type h8300sn_info_struct = +{ + 32, /* 32 bits in a word. */ + 16, /* 16 bits in an address. */ + 8, /* 8 bits in a byte. */ + bfd_arch_h8300, + bfd_mach_h8300sn, + "h8300sn", /* Architecture name. */ + "h8300sn", /* Printable name. */ + 1, + FALSE, /* The default machine. */ + compatible, + h8300_scan, + &h8300sx_info_struct +}; + +static const bfd_arch_info_type h8300hn_info_struct = +{ + 32, /* 32 bits in a word. */ + 16, /* 16 bits in an address. */ + 8, /* 8 bits in a byte. */ + bfd_arch_h8300, + bfd_mach_h8300hn, + "h8300hn", /* Architecture name. */ + "h8300hn", /* Printable name. */ + 1, + FALSE, /* The default machine. */ + compatible, + h8300_scan, + &h8300sn_info_struct +}; + +static const bfd_arch_info_type h8300s_info_struct = +{ + 32, /* 32 bits in a word. */ + 32, /* 32 bits in an address. */ + 8, /* 8 bits in a byte. */ + bfd_arch_h8300, + bfd_mach_h8300s, + "h8300s", /* Architecture name. */ + "h8300s", /* Printable name. */ + 1, + FALSE, /* The default machine. */ + compatible, + h8300_scan, + & h8300hn_info_struct +}; + +static const bfd_arch_info_type h8300h_info_struct = +{ + 32, /* 32 bits in a word. */ + 32, /* 32 bits in an address. */ + 8, /* 8 bits in a byte. */ + bfd_arch_h8300, + bfd_mach_h8300h, + "h8300h", /* Architecture name. */ + "h8300h", /* Printable name. */ + 1, + FALSE, /* The default machine. */ + compatible, + h8300_scan, + &h8300s_info_struct +}; + +const bfd_arch_info_type bfd_h8300_arch = +{ + 16, /* 16 bits in a word. */ + 16, /* 16 bits in an address. */ + 8, /* 8 bits in a byte. */ + bfd_arch_h8300, + bfd_mach_h8300, + "h8300", /* Architecture name. */ + "h8300", /* Printable name. */ + 1, + TRUE, /* The default machine. */ + compatible, + h8300_scan, + &h8300h_info_struct +}; + +/* Pad the given address to 32 bits, converting 16-bit and 24-bit + addresses into the values they would have had on a h8s target. */ + +bfd_vma +bfd_h8300_pad_address (bfd *abfd, bfd_vma address) +{ + /* Cope with bfd_vma's larger than 32 bits. */ + address &= 0xffffffffu; + + switch (bfd_get_mach (abfd)) + { + case bfd_mach_h8300: + case bfd_mach_h8300hn: + case bfd_mach_h8300sn: + case bfd_mach_h8300sxn: + /* Sign extend a 16-bit address. */ + if (address >= 0x8000) + return address | 0xffff0000u; + return address; + + case bfd_mach_h8300h: + /* Sign extend a 24-bit address. */ + if (address >= 0x800000) + return address | 0xff000000u; + return address; + + case bfd_mach_h8300s: + case bfd_mach_h8300sx: + return address; + + default: + abort (); + } +} diff --git a/bfd/cpu-h8500.c b/bfd/cpu-h8500.c new file mode 100644 index 0000000000000..fe05df5b020f0 --- /dev/null +++ b/bfd/cpu-h8500.c @@ -0,0 +1,198 @@ +/* BFD library support routines for the H8/500 architecture. + Copyright 1993, 1995, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Hacked by Steve Chamberlain of Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +static bfd_boolean scan_mach + PARAMS ((const struct bfd_arch_info *, const char *)); + +#if 0 +/* +Relocations for the Z8K + +*/ +static bfd_reloc_status_type +howto16_callback (abfd, reloc_entry, symbol_in, data, + ignore_input_section, ignore_bfd) + bfd *abfd; + arelent *reloc_entry; + struct bfd_symbol *symbol_in; + PTR data; + asection *ignore_input_section; + bfd *ignore_bfd; +{ + long relocation = 0; + bfd_vma addr = reloc_entry->address; + long x = bfd_get_16 (abfd, (bfd_byte *)data + addr); + + HOWTO_PREPARE(relocation, symbol_in); + + x = (x + relocation + reloc_entry->addend); + + bfd_put_16 (abfd, x, (bfd_byte *)data + addr); + return bfd_reloc_ok; +} + +static bfd_reloc_status_type +howto8_callback (abfd, reloc_entry, symbol_in, data, + ignore_input_section, ignore_bfd) + bfd *abfd; + arelent *reloc_entry; + struct bfd_symbol *symbol_in; + PTR data; + asection *ignore_input_section; + bfd *ignore_bfd; +{ + long relocation = 0; + bfd_vma addr = reloc_entry->address; + long x = bfd_get_8 (abfd, (bfd_byte *)data + addr); + + HOWTO_PREPARE(relocation, symbol_in); + + x = (x + relocation + reloc_entry->addend); + + bfd_put_8 (abfd, x, (bfd_byte *)data + addr); + return bfd_reloc_ok; +} + +static bfd_reloc_status_type +howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data, + ignore_input_section, ignore_bfd) + bfd *abfd; + arelent *reloc_entry; + struct bfd_symbol *symbol_in; + PTR data; + asection *ignore_input_section; + bfd *ignore_bfd; +{ + long relocation = 0; + bfd_vma addr = reloc_entry->address; + + long x = bfd_get_8 (abfd, (bfd_byte *)data + addr); + abort (); + HOWTO_PREPARE(relocation, symbol_in); + + x = (x + relocation + reloc_entry->addend); + + bfd_put_8 (abfd, x, (bfd_byte *)data + addr); + return bfd_reloc_ok; +} + +static bfd_reloc_status_type +howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data, + ignore_input_section, ignore_bfd) + bfd *abfd; + arelent *reloc_entry; + struct bfd_symbol *symbol_in; + PTR data; + asection *ignore_input_section; + bfd *ignore_bfd; +{ + long relocation = 0; + bfd_vma addr = reloc_entry->address; + long x = bfd_get_8 (abfd, (bfd_byte *)data + addr); + abort (); + HOWTO_PREPARE(relocation, symbol_in); + + x = (x + relocation + reloc_entry->addend); + + bfd_put_8 (abfd, x, (bfd_byte *)data + addr); + return bfd_reloc_ok; +} + +static reloc_howto_type howto_16 + = NEWHOWTO (howto16_callback, "abs16", 1, FALSE, FALSE); +static reloc_howto_type howto_8 + = NEWHOWTO (howto8_callback, "abs8", 0, FALSE, FALSE); + +static reloc_howto_type howto_8_FFnn + = NEWHOWTO (howto8_FFnn_callback, "ff00+abs8", 0, FALSE, FALSE); + +static reloc_howto_type howto_8_pcrel + = NEWHOWTO (howto8_pcrel_callback, "pcrel8", 0, FALSE, TRUE); + +static reloc_howto_type * +local_bfd_reloc_type_lookup (arch, code) + const struct bfd_arch_info *arch; + bfd_reloc_code_real_type code; +{ + switch (code) { + case BFD_RELOC_16: + return &howto_16; + case BFD_RELOC_8_FFnn: + return &howto_8_FFnn; + case BFD_RELOC_8: + return &howto_8; + case BFD_RELOC_8_PCREL: + return &howto_8_pcrel; + } + return (reloc_howto_type *)NULL; +} +#endif + +static bfd_boolean +scan_mach (info, string) + const struct bfd_arch_info *info ATTRIBUTE_UNUSED; + const char *string; +{ + if (strcmp (string,"h8/500") == 0) + return TRUE; + if (strcmp (string,"H8/500") == 0) + return TRUE; + if (strcmp (string,"h8500") == 0) + return TRUE; + if (strcmp (string,"H8500") == 0) + return TRUE; + return FALSE; +} + +#if 0 /* not used currently */ +/* This routine is provided two arch_infos and returns whether + they'd be compatible */ + +static const bfd_arch_info_type * +compatible (a,b) + const bfd_arch_info_type *a; + const bfd_arch_info_type *b; +{ + if (a->arch != b->arch || a->mach != b->mach) + return NULL; + return a; +} +#endif + +const bfd_arch_info_type bfd_h8500_arch = +{ + 16, /* 16 bits in a word */ + 24, /* 24 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_h8500, + 0, /* only 1 machine */ + "h8500", /* arch_name */ + "h8500", /* printable name */ + 1, + TRUE, /* the default machine */ + bfd_default_compatible, + scan_mach, + 0, +}; diff --git a/bfd/cpu-hppa.c b/bfd/cpu-hppa.c new file mode 100644 index 0000000000000..de5de7ef03c7f --- /dev/null +++ b/bfd/cpu-hppa.c @@ -0,0 +1,89 @@ +/* BFD support for the HP Precision Architecture architecture. + Copyright 1992, 1995, 1998, 1999, 2000, 2002, 2003 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +static const bfd_arch_info_type bfd_hppa10_arch = +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_hppa, + bfd_mach_hppa10, /* By convention PA1.0 = 10 */ + "hppa", + "hppa1.0", + 3, + TRUE, /* Unless we use 1.1 specific features */ + bfd_default_compatible, + bfd_default_scan , + 0, +}; + +/* PA2.0 in narrow mode */ +static const bfd_arch_info_type bfd_hppa20_arch = +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_hppa, + bfd_mach_hppa20, /* By convention PA2.0 = 20 */ + "hppa", + "hppa2.0", + 3, + FALSE, /* Unless we use 1.1 specific features */ + bfd_default_compatible, + bfd_default_scan , + &bfd_hppa10_arch, +}; + +/* PA2.0 in wide mode */ +static const bfd_arch_info_type bfd_hppa20w_arch = +{ + 64, /* 64 bits in a word */ + 64, /* 64 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_hppa, + bfd_mach_hppa20w, /* ??? How best to describe wide mode here? */ + "hppa", + "hppa2.0w", + 3, + FALSE, /* Unless we use 1.1 specific features */ + bfd_default_compatible, + bfd_default_scan , + &bfd_hppa20_arch, +}; + +const bfd_arch_info_type bfd_hppa_arch = +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_hppa, + bfd_mach_hppa11, /* By convention PA1.1 = 11 */ + "hppa", + "hppa1.1", + 3, + FALSE, /* 1.1 specific features used */ + bfd_default_compatible, + bfd_default_scan , + &bfd_hppa20w_arch, +}; diff --git a/bfd/cpu-i370.c b/bfd/cpu-i370.c new file mode 100644 index 0000000000000..2bb2229f93f4e --- /dev/null +++ b/bfd/cpu-i370.c @@ -0,0 +1,74 @@ +/* BFD i370 CPU definition + Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2002 + Free Software Foundation, Inc. + Contributed by Ian Lance Taylor, Cygnus Support. + Hacked by Linas Vepstas in 1998, 1999 + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +static const bfd_arch_info_type arch_info_struct[] = +{ + /* hack alert: old old machines are really 16 and 24 bit arch ... */ + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_i370, + 360, /* for the 360 */ + "i370", + "i370:360", + 3, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + &arch_info_struct[1] + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_i370, + 370, /* for the 370 */ + "i370", + "i370:370", + 3, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + 0 + }, +}; + +const bfd_arch_info_type bfd_i370_arch = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_i370, + 0, /* for the 360/370 common architecture */ + "i370", + "i370:common", + 3, + TRUE, /* the default */ + bfd_default_compatible, + bfd_default_scan, + &arch_info_struct[0] + }; diff --git a/bfd/cpu-i860.c b/bfd/cpu-i860.c new file mode 100644 index 0000000000000..0ee0c5a60bc24 --- /dev/null +++ b/bfd/cpu-i860.c @@ -0,0 +1,40 @@ +/* BFD support for the Intel 860 architecture. + Copyright 1992, 1995, 2000, 2002 Free Software Foundation, Inc. + Created mostly by substituting "860" for "386" in cpu-i386.c + Harry Dolan , October 1995 + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_i860_arch = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_i860, /* Architecture */ + 0, /* Only one machine */ + "i860", /* Architecture name */ + "i860", /* Printable name */ + 3, /* Section alignment exponent */ + TRUE, /* Is this the default architecture? */ + bfd_default_compatible, + bfd_default_scan, + 0, /* Next in list */ + }; diff --git a/bfd/cpu-i960.c b/bfd/cpu-i960.c new file mode 100644 index 0000000000000..e77a411adb902 --- /dev/null +++ b/bfd/cpu-i960.c @@ -0,0 +1,182 @@ +/* BFD library support routines for the i960 architecture. + Copyright 1990, 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. + Hacked by Steve Chamberlain of Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +static bfd_boolean scan_960_mach + PARAMS ((const bfd_arch_info_type *, const char *)); +static const bfd_arch_info_type *compatible + PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); + +/* This routine is provided a string, and tries to work out if it + could possibly refer to the i960 machine pointed at in the + info_struct pointer */ + +static bfd_boolean +scan_960_mach (ap, string) + const bfd_arch_info_type *ap; + const char *string; +{ + unsigned long machine; + int fail_because_not_80960 = FALSE; + + /* Look for the string i960 at the front of the string. */ + if (strncasecmp ("i960", string, 4) == 0) + { + string += 4; + + /* i960 on it's own means core to us. */ + if (* string == 0) + return ap->mach == bfd_mach_i960_core; + + /* "i960:*" is valid, anything else is not. */ + if (* string != ':') + return FALSE; + + string ++; + } + /* In some bfds the cpu-id is written as "80960KA", "80960KB", + "80960CA" or "80960MC". */ + else if (strncmp ("80960", string, 5) == 0) + { + string += 5; + + /* Set this to TRUE here. If a correct matching postfix + is detected below it will be reset to FALSE. */ + fail_because_not_80960 = TRUE; + } + /* No match, can't be us. */ + else + return FALSE; + + if (* string == '\0') + return FALSE; + + if (string[0] == 'c' && string[1] == 'o' && string[2] == 'r' && + string[3] == 'e' && string[4] == '\0') + machine = bfd_mach_i960_core; + else if (strcasecmp (string, "ka_sa") == 0) + machine = bfd_mach_i960_ka_sa; + else if (strcasecmp (string, "kb_sb") == 0) + machine = bfd_mach_i960_kb_sb; + else if (string[1] == '\0' || string[2] != '\0') /* rest are 2-char. */ + return FALSE; + else if (string[0] == 'k' && string[1] == 'b') + { machine = bfd_mach_i960_kb_sb; fail_because_not_80960 = FALSE; } + else if (string[0] == 's' && string[1] == 'b') + machine = bfd_mach_i960_kb_sb; + else if (string[0] == 'm' && string[1] == 'c') + { machine = bfd_mach_i960_mc; fail_because_not_80960 = FALSE; } + else if (string[0] == 'x' && string[1] == 'a') + machine = bfd_mach_i960_xa; + else if (string[0] == 'c' && string[1] == 'a') + { machine = bfd_mach_i960_ca; fail_because_not_80960 = FALSE; } + else if (string[0] == 'k' && string[1] == 'a') + { machine = bfd_mach_i960_ka_sa; fail_because_not_80960 = FALSE; } + else if (string[0] == 's' && string[1] == 'a') + machine = bfd_mach_i960_ka_sa; + else if (string[0] == 'j' && string[1] == 'x') + machine = bfd_mach_i960_jx; + else if (string[0] == 'h' && string[1] == 'x') + machine = bfd_mach_i960_hx; + else + return FALSE; + + if (fail_because_not_80960) + return FALSE; + + if (machine == ap->mach) + return TRUE; + + return FALSE; +} + +/* This routine is provided two arch_infos and works out the i960 + machine which would be compatible with both and returns a pointer + to its info structure */ + +static const bfd_arch_info_type * +compatible (a,b) + const bfd_arch_info_type *a; + const bfd_arch_info_type *b; +{ + + /* The i960 has distinct subspecies which may not interbreed: + CORE CA + CORE KA KB MC XA + CORE HX JX + Any architecture on the same line is compatible, the one on + the right is the least restrictive. + + We represent this information in an array, each machine to a side */ + +#define ERROR 0 +#define CORE bfd_mach_i960_core /*1*/ +#define KA bfd_mach_i960_ka_sa /*2*/ +#define KB bfd_mach_i960_kb_sb /*3*/ +#define MC bfd_mach_i960_mc /*4*/ +#define XA bfd_mach_i960_xa /*5*/ +#define CA bfd_mach_i960_ca /*6*/ +#define JX bfd_mach_i960_jx /*7*/ +#define HX bfd_mach_i960_hx /*8*/ +#define MAX_ARCH ((int)HX) + + static const unsigned long matrix[MAX_ARCH+1][MAX_ARCH+1] = + { + { ERROR, CORE, KA, KB, MC, XA, CA, JX, HX }, + { CORE, CORE, KA, KB, MC, XA, CA, JX, HX }, + { KA, KA, KA, KB, MC, XA, ERROR, ERROR, ERROR}, + { KB, KB, KB, KB, MC, XA, ERROR, ERROR, ERROR}, + { MC, MC, MC, MC, MC, XA, ERROR, ERROR, ERROR}, + { XA, XA, XA, XA, XA, XA, ERROR, ERROR, ERROR}, + { CA, CA, ERROR, ERROR, ERROR, ERROR, CA, ERROR, ERROR}, + { JX, JX, ERROR, ERROR, ERROR, ERROR, ERROR, JX, HX }, + { HX, HX, ERROR, ERROR, ERROR, ERROR, ERROR, HX, HX }, + }; + + if (a->arch != b->arch || matrix[a->mach][b->mach] == ERROR) + { + return NULL; + } + else + { + return (a->mach == matrix[a->mach][b->mach]) ? a : b; + } +} + +#define N(a,b,d,n) \ +{ 32, 32, 8,bfd_arch_i960,a,"i960",b,3,d,compatible,scan_960_mach,n,} + +static const bfd_arch_info_type arch_info_struct[] = +{ + N(bfd_mach_i960_ka_sa,"i960:ka_sa",FALSE, &arch_info_struct[1]), + N(bfd_mach_i960_kb_sb,"i960:kb_sb",FALSE, &arch_info_struct[2]), + N(bfd_mach_i960_mc, "i960:mc", FALSE, &arch_info_struct[3]), + N(bfd_mach_i960_xa, "i960:xa", FALSE, &arch_info_struct[4]), + N(bfd_mach_i960_ca, "i960:ca", FALSE, &arch_info_struct[5]), + N(bfd_mach_i960_jx, "i960:jx", FALSE, &arch_info_struct[6]), + N(bfd_mach_i960_hx, "i960:hx", FALSE, 0), +}; + +const bfd_arch_info_type bfd_i960_arch = + N(bfd_mach_i960_core, "i960:core", TRUE, &arch_info_struct[0]); diff --git a/bfd/cpu-ip2k.c b/bfd/cpu-ip2k.c new file mode 100644 index 0000000000000..a953149a47464 --- /dev/null +++ b/bfd/cpu-ip2k.c @@ -0,0 +1,54 @@ +/* BFD support for the Scenix IP2xxx processor. + Copyright 2000, 2002 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_ip2k_nonext_arch = +{ + 32, /* Bits per word - not really true. */ + 16, /* Bits per address. */ + 8, /* Bits per byte. */ + bfd_arch_ip2k, /* Architecture. */ + bfd_mach_ip2022, /* Machine. */ + "ip2k", /* Architecture name. */ + "ip2022", /* Machine name. */ + 1, /* Section align power. */ + FALSE, /* The default ? */ + bfd_default_compatible, /* Architecture comparison fn. */ + bfd_default_scan, /* String to architecture convert fn. */ + NULL /* Next in list. */ +}; + +const bfd_arch_info_type bfd_ip2k_arch = +{ + 32, /* Bits per word - not really true. */ + 16, /* Bits per address. */ + 8, /* Bits per byte. */ + bfd_arch_ip2k, /* Architecture. */ + bfd_mach_ip2022ext, /* Machine. */ + "ip2k", /* Architecture name. */ + "ip2022ext", /* Machine name. */ + 1, /* Section align power. */ + TRUE, /* The default ? */ + bfd_default_compatible, /* Architecture comparison fn. */ + bfd_default_scan, /* String to architecture convert fn. */ + & bfd_ip2k_nonext_arch /* Next in list. */ +}; diff --git a/bfd/cpu-iq2000.c b/bfd/cpu-iq2000.c new file mode 100644 index 0000000000000..4545f3012df60 --- /dev/null +++ b/bfd/cpu-iq2000.c @@ -0,0 +1,56 @@ +/* BFD support for the Vitesse IQ2000 processor. + Copyright (C) 2003 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +static const bfd_arch_info_type arch_info_struct[] = +{ + { + 32, /* bits per word */ + 32, /* bits per address */ + 8, /* bits per byte */ + bfd_arch_iq2000, /* architecture */ + bfd_mach_iq10, /* machine */ + "iq2000", /* architecture name */ + "iq10", /* printable name */ + 3, /* section align power */ + FALSE, /* the default ? */ + bfd_default_compatible, /* architecture comparison fn */ + bfd_default_scan, /* string to architecture convert fn */ + NULL /* next in list */ + } +}; + +const bfd_arch_info_type bfd_iq2000_arch = +{ + 32, /* bits per word */ + 32, /* bits per address */ + 8, /* bits per byte */ + bfd_arch_iq2000, /* architecture */ + bfd_mach_iq2000, /* machine */ + "iq2000", /* architecture name */ + "iq2000", /* printable name */ + 3, /* section align power */ + TRUE, /* the default ? */ + bfd_default_compatible, /* architecture comparison fn */ + bfd_default_scan, /* string to architecture convert fn */ + &arch_info_struct[0], /* next in list */ +}; diff --git a/bfd/cpu-m10200.c b/bfd/cpu-m10200.c new file mode 100644 index 0000000000000..2d0adcd6bc22b --- /dev/null +++ b/bfd/cpu-m10200.c @@ -0,0 +1,38 @@ +/* BFD support for the Matsushita 10200 processor + Copyright 1996, 1997, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_mn10200_arch = + { + 16, /* 16 bits in a word */ + 24, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_mn10200, + 200, + "mn10200", + "mn10200", + 2, + TRUE, /* the one and only */ + bfd_default_compatible, + bfd_default_scan , + 0, + }; diff --git a/bfd/cpu-m10300.c b/bfd/cpu-m10300.c new file mode 100644 index 0000000000000..76e40fd374669 --- /dev/null +++ b/bfd/cpu-m10300.c @@ -0,0 +1,70 @@ +/* BFD support for the Matsushita 10300 processor + Copyright 1996, 1997, 1999, 2002, 2003 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_am33_2_arch = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_mn10300, + 332, + "am33_2", + "am33-2", + 2, + FALSE, + bfd_default_compatible, + bfd_default_scan, + 0, + }; + +const bfd_arch_info_type bfd_am33_arch = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_mn10300, + 330, + "am33", + "am33", + 2, + FALSE, + bfd_default_compatible, + bfd_default_scan, + &bfd_am33_2_arch, + }; + +const bfd_arch_info_type bfd_mn10300_arch = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_mn10300, + 300, + "mn10300", + "mn10300", + 2, + TRUE, /* the one and only */ + bfd_default_compatible, + bfd_default_scan, + &bfd_am33_arch, + }; diff --git a/bfd/cpu-m32r.c b/bfd/cpu-m32r.c new file mode 100644 index 0000000000000..ee013ea6428fa --- /dev/null +++ b/bfd/cpu-m32r.c @@ -0,0 +1,38 @@ +/* BFD support for the M32R processor. + Copyright 1996, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#define N(number, print, default, next) \ +{ 32, 32, 8, bfd_arch_m32r, number, "m32r", print, 4, default, \ + bfd_default_compatible, bfd_default_scan, next } + +#define M32R2_NEXT & arch_info_struct [1] +#define NEXT & arch_info_struct [0] + +static const bfd_arch_info_type arch_info_struct[] = +{ + N (bfd_mach_m32rx, "m32rx", FALSE, M32R2_NEXT) , + N (bfd_mach_m32r2, "m32r2", FALSE, NULL) +}; + +const bfd_arch_info_type bfd_m32r_arch = + N (bfd_mach_m32r, "m32r", TRUE, NEXT); diff --git a/bfd/cpu-m68hc11.c b/bfd/cpu-m68hc11.c new file mode 100644 index 0000000000000..beea627c50c18 --- /dev/null +++ b/bfd/cpu-m68hc11.c @@ -0,0 +1,38 @@ +/* BFD support for the Motorola 68HC11 processor + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_m68hc11_arch = +{ + 16, /* 16 bits in a word */ + 16, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_m68hc11, + 0, + "m68hc11", + "m68hc11", + 4, /* section alignment power */ + TRUE, + bfd_default_compatible, + bfd_default_scan, + 0, +}; diff --git a/bfd/cpu-m68hc12.c b/bfd/cpu-m68hc12.c new file mode 100644 index 0000000000000..f4c8c9e758181 --- /dev/null +++ b/bfd/cpu-m68hc12.c @@ -0,0 +1,54 @@ +/* BFD support for the Motorola 68HC12 processor + Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_m68hc12s_arch = +{ + 16, /* 16 bits in a word */ + 32, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_m68hc12, + bfd_mach_m6812s, + "m68hc12:HCS12", + "m68hc12", + 4, /* section alignment power */ + TRUE, + bfd_default_compatible, + bfd_default_scan, + 0, +}; + +const bfd_arch_info_type bfd_m68hc12_arch = +{ + 16, /* 16 bits in a word */ + 32, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_m68hc12, + 0, + "m68hc12", + "m68hc12", + 4, /* section alignment power */ + TRUE, + bfd_default_compatible, + bfd_default_scan, + &bfd_m68hc12s_arch, +}; diff --git a/bfd/cpu-m68k.c b/bfd/cpu-m68k.c new file mode 100644 index 0000000000000..71c70297d1d67 --- /dev/null +++ b/bfd/cpu-m68k.c @@ -0,0 +1,47 @@ +/* BFD library support routines for architectures. + Copyright 1990, 1991, 1992, 1993, 1994, 1997, 1998, 2000, 2001, 2002, + 2003 Free Software Foundation, Inc. + Hacked by Steve Chamberlain of Cygnus Support. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#define N(name, print,d,next) \ +{ 32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_default_compatible,bfd_default_scan, next, } + +static const bfd_arch_info_type arch_info_struct[] = + { + N(bfd_mach_m68000, "m68k:68000", FALSE, &arch_info_struct[1]), + N(bfd_mach_m68008, "m68k:68008", FALSE, &arch_info_struct[2]), + N(bfd_mach_m68010, "m68k:68010", FALSE, &arch_info_struct[3]), + N(bfd_mach_m68020, "m68k:68020", FALSE, &arch_info_struct[4]), + N(bfd_mach_m68030, "m68k:68030", FALSE, &arch_info_struct[5]), + N(bfd_mach_m68040, "m68k:68040", FALSE, &arch_info_struct[6]), + N(bfd_mach_cpu32, "m68k:cpu32", FALSE, &arch_info_struct[7]), + N(bfd_mach_mcf5200, "m68k:5200", FALSE, &arch_info_struct[8]), + N(bfd_mach_mcf5206e,"m68k:5206e", FALSE, &arch_info_struct[9]), + N(bfd_mach_mcf5307, "m68k:5307", FALSE, &arch_info_struct[10]), + N(bfd_mach_mcf5407, "m68k:5407", FALSE, &arch_info_struct[11]), + N(bfd_mach_m68060, "m68k:68060", FALSE, &arch_info_struct[12]), + N(bfd_mach_mcf528x, "m68k:528x", FALSE, 0), + }; + +const bfd_arch_info_type bfd_m68k_arch = + N(0, "m68k", TRUE, &arch_info_struct[0]); diff --git a/bfd/cpu-m88k.c b/bfd/cpu-m88k.c new file mode 100644 index 0000000000000..6e0012d4fe603 --- /dev/null +++ b/bfd/cpu-m88k.c @@ -0,0 +1,39 @@ +/* bfd back-end for m88k support + Copyright 1990, 1991, 1994, 2000, 2002 Free Software Foundation, Inc. + Written by Steve Chamberlain of Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_m88k_arch = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_m88k, + 88100, /* only 1 machine */ + "m88k", + "m88k:88100", + 3, + TRUE, /* the one and only */ + bfd_default_compatible, + bfd_default_scan , + 0, + }; diff --git a/bfd/cpu-mcore.c b/bfd/cpu-mcore.c new file mode 100644 index 0000000000000..f7a2389dce736 --- /dev/null +++ b/bfd/cpu-mcore.c @@ -0,0 +1,38 @@ +/* BFD library support routines for Motorola's MCore architecture + Copyright 1993, 1999, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_mcore_arch = +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_mcore, /* Architecture */ + 0, /* Machine number - 0 for now */ + "MCore", /* Architecture name */ + "MCore", /* Printable name */ + 3, /* Section align power */ + TRUE, /* Is this the default architecture ? */ + bfd_default_compatible, /* Architecture comparison function */ + bfd_default_scan, /* String to architecture conversion */ + NULL /* Next in list */ +}; diff --git a/bfd/cpu-mmix.c b/bfd/cpu-mmix.c new file mode 100644 index 0000000000000..57b28c585bbc6 --- /dev/null +++ b/bfd/cpu-mmix.c @@ -0,0 +1,41 @@ +/* BFD library support routines for MMIX. + Copyright 2001, 2002 Free Software Foundation, Inc. + Contributed by Hans-Peter Nilsson (hp@bitrange.com) + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type +bfd_mmix_arch = + { + 64, /* 64 bits in a word. */ + 64, /* 64 bits in an address. */ + 8, /* 8 bits in a byte. */ + bfd_arch_mmix, /* Architecture. */ + 0, /* Machine number - 0 for now. */ + /* Sorry, these are by custom and creeping assumption lower-case. */ + "mmix", /* Architecture name. */ + "mmix", /* Printable name. */ + 3, /* Section align power. */ + TRUE, /* This is the default architecture. */ + bfd_default_compatible, /* Architecture comparison function. */ + bfd_default_scan, /* String to architecture conversion. */ + NULL /* Next in list. */ +}; diff --git a/bfd/cpu-msp430.c b/bfd/cpu-msp430.c new file mode 100644 index 0000000000000..519131c4b5aa6 --- /dev/null +++ b/bfd/cpu-msp430.c @@ -0,0 +1,109 @@ +/* BFD library support routines for the MSP architecture. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Contributed by Dmitry Diky + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +static const bfd_arch_info_type *compatible + PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); + +#define N(addr_bits, machine, print, default, next) \ +{ \ + 16, /* 16 bits in a word. */ \ + addr_bits, /* Bits in an address. */ \ + 8, /* 8 bits in a byte. */ \ + bfd_arch_msp430, \ + machine, /* Machine number. */ \ + "msp430", /* Architecture name. */ \ + print, /* Printable name. */ \ + 1, /* Section align power. */ \ + default, /* The default machine. */ \ + compatible, \ + bfd_default_scan, \ + next \ +} + +static const bfd_arch_info_type arch_info_struct[] = +{ + /* msp430x11x. */ + N (16, bfd_mach_msp11, "msp:11", FALSE, & arch_info_struct[1]), + + /* msp430x11x1. */ + N (16, bfd_mach_msp110, "msp:110", FALSE, & arch_info_struct[2]), + + /* msp430x12x. */ + N (16, bfd_mach_msp12, "msp:12", FALSE, & arch_info_struct[3]), + + /* msp430x13x. */ + N (16, bfd_mach_msp13, "msp:13", FALSE, & arch_info_struct[4]), + + /* msp430x14x. */ + N (16, bfd_mach_msp14, "msp:14", FALSE, & arch_info_struct[5]), + + /* msp430x15x. */ + N (16, bfd_mach_msp15, "msp:15", FALSE, & arch_info_struct[6]), + + /* msp430x16x. */ + N (16, bfd_mach_msp16, "msp:16", FALSE, & arch_info_struct[7]), + + /* msp430x31x. */ + N (16, bfd_mach_msp31, "msp:31", FALSE, & arch_info_struct[8]), + + /* msp430x32x. */ + N (16, bfd_mach_msp32, "msp:32", FALSE, & arch_info_struct[9]), + + /* msp430x33x. */ + N (16, bfd_mach_msp33, "msp:33", FALSE, & arch_info_struct[10]), + + /* msp430x41x. */ + N (16, bfd_mach_msp41, "msp:41", FALSE, & arch_info_struct[11]), + + /* msp430x42x. */ + N (16, bfd_mach_msp42, "msp:42", FALSE, & arch_info_struct[12]), + + /* msp430x43x. */ + N (16, bfd_mach_msp43, "msp:43", FALSE, & arch_info_struct[13]), + + /* msp430x44x. */ + N (16, bfd_mach_msp43, "msp:44", FALSE, NULL) +}; + +const bfd_arch_info_type bfd_msp430_arch = + N (16, bfd_mach_msp14, "msp:14", TRUE, & arch_info_struct[0]); + +/* This routine is provided two arch_infos and works out which MSP + machine which would be compatible with both and returns a pointer + to its info structure. */ + +static const bfd_arch_info_type * +compatible (a,b) + const bfd_arch_info_type * a; + const bfd_arch_info_type * b; +{ + /* If a & b are for different architectures we can do nothing. */ + if (a->arch != b->arch) + return NULL; + + if (a->mach <= b->mach) + return b; + + return a; +} diff --git a/bfd/cpu-ns32k.c b/bfd/cpu-ns32k.c new file mode 100644 index 0000000000000..39e5b23937be1 --- /dev/null +++ b/bfd/cpu-ns32k.c @@ -0,0 +1,836 @@ +/* BFD support for the ns32k architecture. + Copyright 1990, 1991, 1994, 1995, 1998, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Almost totally rewritten by Ian Dall from initial work + by Andrew Cagney. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "ns32k.h" + +#define N(machine, printable, d, next) \ +{ 32, 32, 8, bfd_arch_ns32k, machine, "ns32k",printable,3,d,bfd_default_compatible,bfd_default_scan, next, } + +static const bfd_arch_info_type arch_info_struct[] = +{ + N(32532,"ns32k:32532",TRUE, 0), /* The word ns32k will match this too. */ +}; + +const bfd_arch_info_type bfd_ns32k_arch = + N(32032,"ns32k:32032",FALSE, &arch_info_struct[0]); + +static bfd_reloc_status_type do_ns32k_reloc + PARAMS ((bfd *, arelent *, struct bfd_symbol *, PTR, asection *, + bfd *, char **, + bfd_vma (*) (bfd_byte *, int), + void (*) (bfd_vma, bfd_byte *, int))); + +bfd_vma +_bfd_ns32k_get_displacement (buffer, size) + bfd_byte *buffer; + int size; +{ + bfd_signed_vma value; + + switch (size) + { + case 1: + value = ((*buffer & 0x7f) ^ 0x40) - 0x40; + break; + + case 2: + value = ((*buffer++ & 0x3f) ^ 0x20) - 0x20; + value = (value << 8) | (0xff & *buffer); + break; + + case 4: + value = ((*buffer++ & 0x3f) ^ 0x20) - 0x20; + value = (value << 8) | (0xff & *buffer++); + value = (value << 8) | (0xff & *buffer++); + value = (value << 8) | (0xff & *buffer); + break; + + default: + abort (); + return 0; + } + + return value; +} + +void +_bfd_ns32k_put_displacement (value, buffer, size) + bfd_vma value; + bfd_byte *buffer; + int size; +{ + switch (size) + { + case 1: + value &= 0x7f; + *buffer++ = value; + break; + + case 2: + value &= 0x3fff; + value |= 0x8000; + *buffer++ = (value >> 8); + *buffer++ = value; + break; + + case 4: + value |= (bfd_vma) 0xc0000000; + *buffer++ = (value >> 24); + *buffer++ = (value >> 16); + *buffer++ = (value >> 8); + *buffer++ = value; + break; + } + return; +} + +bfd_vma +_bfd_ns32k_get_immediate (buffer, size) + bfd_byte *buffer; + int size; +{ + bfd_vma value = 0; + + switch (size) + { + case 4: + value = (value << 8) | (*buffer++ & 0xff); + value = (value << 8) | (*buffer++ & 0xff); + case 2: + value = (value << 8) | (*buffer++ & 0xff); + case 1: + value = (value << 8) | (*buffer++ & 0xff); + break; + default: + abort (); + } + return value; +} + +void +_bfd_ns32k_put_immediate (value, buffer, size) + bfd_vma value; + bfd_byte *buffer; + int size; +{ + buffer += size - 1; + switch (size) + { + case 4: + *buffer-- = (value & 0xff); value >>= 8; + *buffer-- = (value & 0xff); value >>= 8; + case 2: + *buffer-- = (value & 0xff); value >>= 8; + case 1: + *buffer-- = (value & 0xff); value >>= 8; + } +} + +/* This is just like the standard perform_relocation except we + use get_data and put_data which know about the ns32k storage + methods. This is probably a lot more complicated than it + needs to be! */ + +static bfd_reloc_status_type +do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, + error_message, get_data, put_data) + bfd *abfd; + arelent *reloc_entry; + struct bfd_symbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; + bfd_vma (*get_data) PARAMS ((bfd_byte *, int)); + void (*put_data) PARAMS ((bfd_vma, bfd_byte *, int)); +{ + int overflow = 0; + bfd_vma relocation; + bfd_reloc_status_type flag = bfd_reloc_ok; + bfd_size_type addr = reloc_entry->address; + bfd_vma output_base = 0; + reloc_howto_type *howto = reloc_entry->howto; + asection *reloc_target_output_section; + bfd_byte *location; + + if ((symbol->section == &bfd_abs_section) + && output_bfd != (bfd *) NULL) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* If we are not producing relocatable output, return an error if + the symbol is not defined. An undefined weak symbol is + considered to have a value of zero (SVR4 ABI, p. 4-27). */ + if (symbol->section == &bfd_und_section + && (symbol->flags & BSF_WEAK) == 0 + && output_bfd == (bfd *) NULL) + flag = bfd_reloc_undefined; + + /* Is the address of the relocation really within the section? */ + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + /* Work out which section the relocation is targeted at and the + initial relocation command value. */ + + /* Get symbol value. (Common symbols are special.) */ + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + reloc_target_output_section = symbol->section->output_section; + + /* Convert input-section-relative symbol value to absolute. */ + if (output_bfd != NULL && ! howto->partial_inplace) + output_base = 0; + else + output_base = reloc_target_output_section->vma; + + relocation += output_base + symbol->section->output_offset; + + /* Add in supplied addend. */ + relocation += reloc_entry->addend; + + /* Here the variable relocation holds the final address of the + symbol we are relocating against, plus any addend. */ + + if (howto->pc_relative) + { + /* This is a PC relative relocation. We want to set RELOCATION + to the distance between the address of the symbol and the + location. RELOCATION is already the address of the symbol. + + We start by subtracting the address of the section containing + the location. + + If pcrel_offset is set, we must further subtract the position + of the location within the section. Some targets arrange for + the addend to be the negative of the position of the location + within the section; for example, i386-aout does this. For + i386-aout, pcrel_offset is FALSE. Some other targets do not + include the position of the location; for example, m88kbcs, + or ELF. For those targets, pcrel_offset is TRUE. + + If we are producing relocatable output, then we must ensure + that this reloc will be correctly computed when the final + relocation is done. If pcrel_offset is FALSE we want to wind + up with the negative of the location within the section, + which means we must adjust the existing addend by the change + in the location within the section. If pcrel_offset is TRUE + we do not want to adjust the existing addend at all. + + FIXME: This seems logical to me, but for the case of + producing relocatable output it is not what the code + actually does. I don't want to change it, because it seems + far too likely that something will break. */ + relocation -= + input_section->output_section->vma + input_section->output_offset; + + if (howto->pcrel_offset) + relocation -= reloc_entry->address; + } + + if (output_bfd != (bfd *) NULL) + { + if (! howto->partial_inplace) + { + /* This is a partial relocation, and we want to apply the relocation + to the reloc entry rather than the raw data. Modify the reloc + inplace to reflect what we now know. */ + reloc_entry->addend = relocation; + reloc_entry->address += input_section->output_offset; + return flag; + } + else + { + /* This is a partial relocation, but inplace, so modify the + reloc record a bit. + + If we've relocated with a symbol with a section, change + into a ref to the section belonging to the symbol. */ + + reloc_entry->address += input_section->output_offset; + + /* WTF?? */ + if (abfd->xvec->flavour == bfd_target_coff_flavour) + { +#if 1 + /* For m68k-coff, the addend was being subtracted twice during + relocation with -r. Removing the line below this comment + fixes that problem; see PR 2953. + + However, Ian wrote the following, regarding removing the line + below, which explains why it is still enabled: --djm + + If you put a patch like that into BFD you need to check all + the COFF linkers. I am fairly certain that patch will break + coff-i386 (e.g., SCO); see coff_i386_reloc in coff-i386.c + where I worked around the problem in a different way. There + may very well be a reason that the code works as it does. + + Hmmm. The first obvious point is that bfd_perform_relocation + should not have any tests that depend upon the flavour. It's + seem like entirely the wrong place for such a thing. The + second obvious point is that the current code ignores the + reloc addend when producing relocatable output for COFF. + That's peculiar. In fact, I really have no idea what the + point of the line you want to remove is. + + A typical COFF reloc subtracts the old value of the symbol + and adds in the new value to the location in the object file + (if it's a pc relative reloc it adds the difference between + the symbol value and the location). When relocating we need + to preserve that property. + + BFD handles this by setting the addend to the negative of the + old value of the symbol. Unfortunately it handles common + symbols in a non-standard way (it doesn't subtract the old + value) but that's a different story (we can't change it + without losing backward compatibility with old object files) + (coff-i386 does subtract the old value, to be compatible with + existing coff-i386 targets, like SCO). + + So everything works fine when not producing relocatable + output. When we are producing relocatable output, logically + we should do exactly what we do when not producing + relocatable output. Therefore, your patch is correct. In + fact, it should probably always just set reloc_entry->addend + to 0 for all cases, since it is, in fact, going to add the + value into the object file. This won't hurt the COFF code, + which doesn't use the addend; I'm not sure what it will do + to other formats (the thing to check for would be whether + any formats both use the addend and set partial_inplace). + + When I wanted to make coff-i386 produce relocatable output, + I ran into the problem that you are running into: I wanted + to remove that line. Rather than risk it, I made the + coff-i386 relocs use a special function; it's coff_i386_reloc + in coff-i386.c. The function specifically adds the addend + field into the object file, knowing that bfd_perform_relocation + is not going to. If you remove that line, then coff-i386.c + will wind up adding the addend field in twice. It's trivial + to fix; it just needs to be done. + + The problem with removing the line is just that it may break + some working code. With BFD it's hard to be sure of anything. + The right way to deal with this is simply to build and test at + least all the supported COFF targets. It should be + straightforward if time and disk space consuming. For each + target: + 1) build the linker + 2) generate some executable, and link it using -r (I would + probably use paranoia.o and link against newlib/libc.a, + which for all the supported targets would be available in + /usr/cygnus/progressive/H-host/target/lib/libc.a). + 3) make the change to reloc.c + 4) rebuild the linker + 5) repeat step 2 + 6) if the resulting object files are the same, you have at + least made it no worse + 7) if they are different you have to figure out which + version is right. */ + relocation -= reloc_entry->addend; +#endif + reloc_entry->addend = 0; + } + else + { + reloc_entry->addend = relocation; + } + } + } + else + { + reloc_entry->addend = 0; + } + + /* FIXME: This overflow checking is incomplete, because the value + might have overflowed before we get here. For a correct check we + need to compute the value in a size larger than bitsize, but we + can't reasonably do that for a reloc the same size as a host + machine word. + FIXME: We should also do overflow checking on the result after + adding in the value contained in the object file. */ + if (howto->complain_on_overflow != complain_overflow_dont) + { + bfd_vma check; + + /* Get the value that will be used for the relocation, but + starting at bit position zero. */ + if (howto->rightshift > howto->bitpos) + check = relocation >> (howto->rightshift - howto->bitpos); + else + check = relocation << (howto->bitpos - howto->rightshift); + switch (howto->complain_on_overflow) + { + case complain_overflow_signed: + { + /* Assumes two's complement. */ + bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; + bfd_signed_vma reloc_signed_min = ~reloc_signed_max; + + /* The above right shift is incorrect for a signed value. + Fix it up by forcing on the upper bits. */ + if (howto->rightshift > howto->bitpos + && (bfd_signed_vma) relocation < 0) + check |= ((bfd_vma) - 1 + & ~((bfd_vma) - 1 + >> (howto->rightshift - howto->bitpos))); + if ((bfd_signed_vma) check > reloc_signed_max + || (bfd_signed_vma) check < reloc_signed_min) + flag = bfd_reloc_overflow; + } + break; + case complain_overflow_unsigned: + { + /* Assumes two's complement. This expression avoids + overflow if howto->bitsize is the number of bits in + bfd_vma. */ + bfd_vma reloc_unsigned_max = + (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; + + if ((bfd_vma) check > reloc_unsigned_max) + flag = bfd_reloc_overflow; + } + break; + case complain_overflow_bitfield: + { + /* Assumes two's complement. This expression avoids + overflow if howto->bitsize is the number of bits in + bfd_vma. */ + bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; + + if (((bfd_vma) check & ~reloc_bits) != 0 + && (((bfd_vma) check & ~reloc_bits) + != (-(bfd_vma) 1 & ~reloc_bits))) + { + /* The above right shift is incorrect for a signed + value. See if turning on the upper bits fixes the + overflow. */ + if (howto->rightshift > howto->bitpos + && (bfd_signed_vma) relocation < 0) + { + check |= ((bfd_vma) - 1 + & ~((bfd_vma) - 1 + >> (howto->rightshift - howto->bitpos))); + if (((bfd_vma) check & ~reloc_bits) + != (-(bfd_vma) 1 & ~reloc_bits)) + flag = bfd_reloc_overflow; + } + else + flag = bfd_reloc_overflow; + } + } + break; + default: + abort (); + } + } + + /* Either we are relocating all the way, or we don't want to apply + the relocation to the reloc entry (probably because there isn't + any room in the output format to describe addends to relocs). */ + + /* The cast to bfd_vma avoids a bug in the Alpha OSF/1 C compiler + (OSF version 1.3, compiler version 3.11). It miscompiles the + following program: + + struct str + { + unsigned int i0; + } s = { 0 }; + + int + main () + { + unsigned long x; + + x = 0x100000000; + x <<= (unsigned long) s.i0; + if (x == 0) + printf ("failed\n"); + else + printf ("succeeded (%lx)\n", x); + } + */ + + relocation >>= (bfd_vma) howto->rightshift; + + /* Shift everything up to where it's going to be used. */ + relocation <<= (bfd_vma) howto->bitpos; + + /* Wait for the day when all have the mask in them. */ + + /* What we do: + i instruction to be left alone + o offset within instruction + r relocation offset to apply + S src mask + D dst mask + N ~dst mask + A part 1 + B part 2 + R result + + Do this: + i i i i i o o o o o from bfd_get + and S S S S S to get the size offset we want + + r r r r r r r r r r to get the final value to place + and D D D D D to chop to right size + ----------------------- + A A A A A + And this: + ... i i i i i o o o o o from bfd_get + and N N N N N get instruction + ----------------------- + ... B B B B B + + And then: + B B B B B + or A A A A A + ----------------------- + R R R R R R R R R R put into bfd_put. */ + +#define DOIT(x) \ + x = ( (x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask)) + + location = (bfd_byte *) data + addr; + switch (howto->size) + { + case 0: + { + bfd_vma x = get_data (location, 1); + DOIT (x); + put_data ((bfd_vma) x, location, 1); + } + break; + + case 1: + if (relocation) + { + bfd_vma x = get_data (location, 2); + DOIT (x); + put_data ((bfd_vma) x, location, 2); + } + break; + case 2: + if (relocation) + { + bfd_vma x = get_data (location, 4); + DOIT (x); + put_data ((bfd_vma) x, location, 4); + } + break; + case -2: + { + bfd_vma x = get_data (location, 4); + relocation = -relocation; + DOIT(x); + put_data ((bfd_vma) x, location, 4); + } + break; + + case 3: + /* Do nothing. */ + break; + + case 4: +#ifdef BFD64 + if (relocation) + { + bfd_vma x = get_data (location, 8); + DOIT (x); + put_data (x, location, 8); + } +#else + abort (); +#endif + break; + default: + return bfd_reloc_other; + } + if ((howto->complain_on_overflow != complain_overflow_dont) && overflow) + return bfd_reloc_overflow; + + return flag; +} + +/* Relocate a given location using a given value and howto. */ + +bfd_reloc_status_type +_bfd_do_ns32k_reloc_contents (howto, input_bfd, relocation, location, + get_data, put_data) + reloc_howto_type *howto; + bfd *input_bfd ATTRIBUTE_UNUSED; + bfd_vma relocation; + bfd_byte *location; + bfd_vma (*get_data) PARAMS ((bfd_byte *, int)); + void (*put_data) PARAMS ((bfd_vma, bfd_byte *, int)); +{ + int size; + bfd_vma x; + bfd_boolean overflow; + + /* If the size is negative, negate RELOCATION. This isn't very + general. */ + if (howto->size < 0) + relocation = -relocation; + + /* Get the value we are going to relocate. */ + size = bfd_get_reloc_size (howto); + switch (size) + { + default: + case 0: + abort (); + case 1: + case 2: + case 4: +#ifdef BFD64 + case 8: +#endif + x = get_data (location, size); + break; + } + + /* Check for overflow. FIXME: We may drop bits during the addition + which we don't check for. We must either check at every single + operation, which would be tedious, or we must do the computations + in a type larger than bfd_vma, which would be inefficient. */ + overflow = FALSE; + if (howto->complain_on_overflow != complain_overflow_dont) + { + bfd_vma check; + bfd_signed_vma signed_check; + bfd_vma add; + bfd_signed_vma signed_add; + + if (howto->rightshift == 0) + { + check = relocation; + signed_check = (bfd_signed_vma) relocation; + } + else + { + /* Drop unwanted bits from the value we are relocating to. */ + check = relocation >> howto->rightshift; + + /* If this is a signed value, the rightshift just dropped + leading 1 bits (assuming twos complement). */ + if ((bfd_signed_vma) relocation >= 0) + signed_check = check; + else + signed_check = (check + | ((bfd_vma) - 1 + & ~((bfd_vma) - 1 >> howto->rightshift))); + } + + /* Get the value from the object file. */ + add = x & howto->src_mask; + + /* Get the value from the object file with an appropriate sign. + The expression involving howto->src_mask isolates the upper + bit of src_mask. If that bit is set in the value we are + adding, it is negative, and we subtract out that number times + two. If src_mask includes the highest possible bit, then we + can not get the upper bit, but that does not matter since + signed_add needs no adjustment to become negative in that + case. */ + signed_add = add; + if ((add & (((~howto->src_mask) >> 1) & howto->src_mask)) != 0) + signed_add -= (((~howto->src_mask) >> 1) & howto->src_mask) << 1; + + /* Add the value from the object file, shifted so that it is a + straight number. */ + if (howto->bitpos == 0) + { + check += add; + signed_check += signed_add; + } + else + { + check += add >> howto->bitpos; + + /* For the signed case we use ADD, rather than SIGNED_ADD, + to avoid warnings from SVR4 cc. This is OK since we + explicitly handle the sign bits. */ + if (signed_add >= 0) + signed_check += add >> howto->bitpos; + else + signed_check += ((add >> howto->bitpos) + | ((bfd_vma) - 1 + & ~((bfd_vma) - 1 >> howto->bitpos))); + } + + switch (howto->complain_on_overflow) + { + case complain_overflow_signed: + { + /* Assumes two's complement. */ + bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; + bfd_signed_vma reloc_signed_min = ~reloc_signed_max; + + if (signed_check > reloc_signed_max + || signed_check < reloc_signed_min) + overflow = TRUE; + } + break; + case complain_overflow_unsigned: + { + /* Assumes two's complement. This expression avoids + overflow if howto->bitsize is the number of bits in + bfd_vma. */ + bfd_vma reloc_unsigned_max = + (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; + + if (check > reloc_unsigned_max) + overflow = TRUE; + } + break; + case complain_overflow_bitfield: + { + /* Assumes two's complement. This expression avoids + overflow if howto->bitsize is the number of bits in + bfd_vma. */ + bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; + + if ((check & ~reloc_bits) != 0 + && (((bfd_vma) signed_check & ~reloc_bits) + != (-(bfd_vma) 1 & ~reloc_bits))) + overflow = TRUE; + } + break; + default: + abort (); + } + } + + /* Put RELOCATION in the right bits. */ + relocation >>= (bfd_vma) howto->rightshift; + relocation <<= (bfd_vma) howto->bitpos; + + /* Add RELOCATION to the right bits of X. */ + x = ((x & ~howto->dst_mask) + | (((x & howto->src_mask) + relocation) & howto->dst_mask)); + + /* Put the relocated value back in the object file. */ + switch (size) + { + default: + case 0: + abort (); + case 1: + case 2: + case 4: +#ifdef BFD64 + case 8: +#endif + put_data (x, location, size); + break; + } + + return overflow ? bfd_reloc_overflow : bfd_reloc_ok; +} + +bfd_reloc_status_type +_bfd_ns32k_reloc_disp (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + struct bfd_symbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + return do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message, + _bfd_ns32k_get_displacement, + _bfd_ns32k_put_displacement); +} + +bfd_reloc_status_type +_bfd_ns32k_reloc_imm (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + struct bfd_symbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + return do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message, _bfd_ns32k_get_immediate, + _bfd_ns32k_put_immediate); +} + +bfd_reloc_status_type +_bfd_ns32k_final_link_relocate (howto, input_bfd, input_section, contents, + address, value, addend) + reloc_howto_type *howto; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + bfd_vma address; + bfd_vma value; + bfd_vma addend; +{ + bfd_vma relocation; + + /* Sanity check the address. */ + if (address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + /* This function assumes that we are dealing with a basic relocation + against a symbol. We want to compute the value of the symbol to + relocate to. This is just VALUE, the value of the symbol, plus + ADDEND, any addend associated with the reloc. */ + relocation = value + addend; + + /* If the relocation is PC relative, we want to set RELOCATION to + the distance between the symbol (currently in RELOCATION) and the + location we are relocating. Some targets (e.g., i386-aout) + arrange for the contents of the section to be the negative of the + offset of the location within the section; for such targets + pcrel_offset is FALSE. Other targets (e.g., m88kbcs or ELF) + simply leave the contents of the section as zero; for such + targets pcrel_offset is TRUE. If pcrel_offset is FALSE we do not + need to subtract out the offset of the location within the + section (which is just ADDRESS). */ + if (howto->pc_relative) + { + relocation -= (input_section->output_section->vma + + input_section->output_offset); + if (howto->pcrel_offset) + relocation -= address; + } + + return _bfd_ns32k_relocate_contents (howto, input_bfd, relocation, + contents + address); +} diff --git a/bfd/cpu-openrisc.c b/bfd/cpu-openrisc.c new file mode 100644 index 0000000000000..0ddd68c523c8a --- /dev/null +++ b/bfd/cpu-openrisc.c @@ -0,0 +1,42 @@ +/* BFD support for the OpenRISC architecture. + Copyright 2001, 2002 Free Software Foundation, Inc. + Contributed by Johan Rydberg, jrydberg@opencores.org + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \ + { \ + BITS_WORD, /* bits in a word */ \ + BITS_ADDR, /* bits in an address */ \ + 8, /* 8 bits in a byte */ \ + bfd_arch_openrisc, \ + NUMBER, \ + "openrisc", \ + PRINT, \ + 2, \ + DEFAULT, \ + bfd_default_compatible, \ + bfd_default_scan, \ + NEXT, \ + } + +const bfd_arch_info_type bfd_openrisc_arch = + N (32, 32, 0, "openrisc", TRUE, 0); diff --git a/bfd/cpu-or32.c b/bfd/cpu-or32.c new file mode 100644 index 0000000000000..e2f1d05f288da --- /dev/null +++ b/bfd/cpu-or32.c @@ -0,0 +1,40 @@ +/* BFD support for the OpenRISC 1000 architecture. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Ivan Guzvinec + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_or32_arch = + { + 32, /* 32 bits in a word. */ + 32, /* 32 bits in an address. */ + 8, /* 8 bits in a byte. */ + bfd_arch_or32, + 0, /* Only 1 machine. */ + "or32", + "or32", + 4, + TRUE, /* The one and only. */ + bfd_default_compatible, + bfd_default_scan , + 0, + }; + diff --git a/bfd/cpu-pdp11.c b/bfd/cpu-pdp11.c new file mode 100644 index 0000000000000..1ad036ee1fcc0 --- /dev/null +++ b/bfd/cpu-pdp11.c @@ -0,0 +1,39 @@ +/* BFD back-end for PDP-11 support. + Copyright 2001, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_pdp11_arch = + { + 16, /* 16 bits in a word */ + 16, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_pdp11, + 0, /* only 1 machine */ + "pdp11", + "pdp11", + 1, /* aligment = 16 bit */ + TRUE, /* the one and only */ + bfd_default_compatible, + bfd_default_scan , + 0, + }; + diff --git a/bfd/cpu-pj.c b/bfd/cpu-pj.c new file mode 100644 index 0000000000000..a2a4cd476de1f --- /dev/null +++ b/bfd/cpu-pj.c @@ -0,0 +1,39 @@ +/* BFD library support routines for the Pico Java architecture. + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Hacked by Steve Chamberlain of Transmeta. sac@pobox.com + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_pj_arch = +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_pj, + 0, + "pj", /* arch_name */ + "pj", /* printable name */ + 1, + TRUE, /* the default machine */ + bfd_default_compatible, + bfd_default_scan, + 0 +}; diff --git a/bfd/cpu-sh.c b/bfd/cpu-sh.c new file mode 100644 index 0000000000000..2f33240bb07ba --- /dev/null +++ b/bfd/cpu-sh.c @@ -0,0 +1,226 @@ +/* BFD library support routines for the Renesas / SuperH SH architecture. + Copyright 1993, 1994, 1997, 1998, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Hacked by Steve Chamberlain of Cygnus Support. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#define SH_NEXT &arch_info_struct[0] +#define SH2_NEXT &arch_info_struct[1] +#define SH2E_NEXT &arch_info_struct[2] +#define SH_DSP_NEXT &arch_info_struct[3] +#define SH3_NEXT &arch_info_struct[4] +#define SH3_DSP_NEXT &arch_info_struct[5] +#define SH3E_NEXT &arch_info_struct[6] +#define SH4_NEXT &arch_info_struct[7] +#define SH4A_NEXT &arch_info_struct[8] +#define SH4AL_DSP_NEXT &arch_info_struct[9] +#define SH4_NOFPU_NEXT &arch_info_struct[10] +#define SH4A_NOFPU_NEXT &arch_info_struct[11] +#define SH64_NEXT NULL + +static const bfd_arch_info_type arch_info_struct[] = +{ + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh2, + "sh", /* arch_name */ + "sh2", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH2_NEXT + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh2e, + "sh", /* arch_name */ + "sh2e", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH2E_NEXT + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh_dsp, + "sh", /* arch_name */ + "sh-dsp", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH_DSP_NEXT + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh3, + "sh", /* arch_name */ + "sh3", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH3_NEXT + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh3_dsp, + "sh", /* arch_name */ + "sh3-dsp", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH3_DSP_NEXT + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh3e, + "sh", /* arch_name */ + "sh3e", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH3E_NEXT + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh4, + "sh", /* arch_name */ + "sh4", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH4_NEXT + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh4a, + "sh", /* arch_name */ + "sh4a", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH4A_NEXT + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh4al_dsp, + "sh", /* arch_name */ + "sh4al-dsp", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH4AL_DSP_NEXT + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh4_nofpu, + "sh", /* arch_name */ + "sh4-nofpu", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH4_NOFPU_NEXT + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh4a_nofpu, + "sh", /* arch_name */ + "sh4a-nofpu", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH4A_NOFPU_NEXT + }, + { + 64, /* 64 bits in a word */ + 64, /* 64 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh5, + "sh", /* arch_name */ + "sh5", /* printable name */ + 1, + FALSE, /* not the default */ + bfd_default_compatible, + bfd_default_scan, + SH64_NEXT + }, +}; + +const bfd_arch_info_type bfd_sh_arch = +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_sh, + bfd_mach_sh, + "sh", /* arch_name */ + "sh", /* printable name */ + 1, + TRUE, /* the default machine */ + bfd_default_compatible, + bfd_default_scan, + SH_NEXT +}; diff --git a/bfd/cpu-tic30.c b/bfd/cpu-tic30.c new file mode 100644 index 0000000000000..71bfc0dd2f457 --- /dev/null +++ b/bfd/cpu-tic30.c @@ -0,0 +1,39 @@ +/* BFD support for the Texas Instruments TMS320C30 architecture. + Copyright 1998, 2002 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_tic30_arch = +{ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_tic30, + 0, /* only 1 machine */ + "tic30", + "tms320c30", + 2, + TRUE, /* the one and only */ + bfd_default_compatible, + bfd_default_scan, + 0, +}; diff --git a/bfd/cpu-tic4x.c b/bfd/cpu-tic4x.c new file mode 100644 index 0000000000000..a7f40e1a4fa9a --- /dev/null +++ b/bfd/cpu-tic4x.c @@ -0,0 +1,85 @@ +/* bfd back-end for TMS320C[34]x support + Copyright 1996, 1997, 2002, 2003 Free Software Foundation, Inc. + + Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz) + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +static bfd_boolean tic4x_scan + PARAMS ((const struct bfd_arch_info *, const char * )); + + +static bfd_boolean +tic4x_scan (info, string) + const struct bfd_arch_info *info; + const char *string; +{ + /* Allow strings of form [ti][Cc][34][0-9], let's not be too picky + about strange numbered machines in C3x or C4x series. */ + if (string[0] == 't' && string[1] == 'i') + string += 2; + if (*string == 'C' || *string == 'c') + string++; + if (string[1] < '0' && string[1] > '9') + return FALSE; + + if (*string == '3') + return (info->mach == bfd_mach_tic3x); + else if (*string == '4') + return info->mach == bfd_mach_tic4x; + + return FALSE; +} + + +const bfd_arch_info_type bfd_tic3x_arch = + { + 32, /* 32 bits in a word. */ + 32, /* 32 bits in an address. */ + 32, /* 32 bits in a byte. */ + bfd_arch_tic4x, + bfd_mach_tic3x, /* Machine number. */ + "tic3x", /* Architecture name. */ + "tms320c3x", /* Printable name. */ + 0, /* Alignment power. */ + FALSE, /* Not the default architecture. */ + bfd_default_compatible, + tic4x_scan, + 0 + }; + +const bfd_arch_info_type bfd_tic4x_arch = + { + 32, /* 32 bits in a word. */ + 32, /* 32 bits in an address. */ + 32, /* 32 bits in a byte. */ + bfd_arch_tic4x, + bfd_mach_tic4x, /* Machine number. */ + "tic4x", /* Architecture name. */ + "tms320c4x", /* Printable name. */ + 0, /* Alignment power. */ + TRUE, /* The default architecture. */ + bfd_default_compatible, + tic4x_scan, + &bfd_tic3x_arch, + }; + + diff --git a/bfd/cpu-tic54x.c b/bfd/cpu-tic54x.c new file mode 100644 index 0000000000000..b6962aacc015a --- /dev/null +++ b/bfd/cpu-tic54x.c @@ -0,0 +1,39 @@ +/* BFD support for the Texas Instruments TMS320C54X architecture. + Copyright 1999, 2000, 2002 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_tic54x_arch = +{ + 16, /* 16 bits in a word */ + 16, /* 16 bits in an address (except '548) */ + 16, /* 16 bits in a byte */ + bfd_arch_tic54x, + 0, /* only 1 machine */ + "tic54x", + "tms320c54x", + 1, + TRUE, /* the one and only */ + bfd_default_compatible, + bfd_default_scan, + 0, +}; diff --git a/bfd/cpu-tic80.c b/bfd/cpu-tic80.c new file mode 100644 index 0000000000000..487bcb154f89b --- /dev/null +++ b/bfd/cpu-tic80.c @@ -0,0 +1,39 @@ +/* bfd back-end for TI TMS320C80 (MVP) support + Copyright 1996, 2002 Free Software Foundation, Inc. + Written by Fred Fish at Cygnus support (fnf@cygnus.com) + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_tic80_arch = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_tic80, /* bfd_architecture enum */ + 0, /* only 1 machine */ + "tic80", /* architecture name */ + "tic80", /* printable name */ + 2, /* section alignment power */ + TRUE, /* default machine for architecture */ + bfd_default_compatible, + bfd_default_scan , + NULL, /* Pointer to next in chain */ + }; diff --git a/bfd/cpu-v850.c b/bfd/cpu-v850.c new file mode 100644 index 0000000000000..1ff1cb3af5c1f --- /dev/null +++ b/bfd/cpu-v850.c @@ -0,0 +1,42 @@ +/* BFD support for the NEC V850 processor + Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "safe-ctype.h" + +#define N(number, print, default, next) \ +{ 32, 32, 8, bfd_arch_v850, number, "v850", print, 2, default, \ + bfd_default_compatible, bfd_default_scan, next } + +#define NEXT NULL + +static const bfd_arch_info_type arch_info_struct[] = +{ + N (bfd_mach_v850e1, "v850e1", FALSE, & arch_info_struct[1]), + N (bfd_mach_v850e, "v850e", FALSE, NULL) +}; + +#undef NEXT +#define NEXT & arch_info_struct[0] + +const bfd_arch_info_type bfd_v850_arch = + N (bfd_mach_v850, "v850", TRUE, NEXT); diff --git a/bfd/cpu-vax.c b/bfd/cpu-vax.c new file mode 100644 index 0000000000000..98f868c44f548 --- /dev/null +++ b/bfd/cpu-vax.c @@ -0,0 +1,39 @@ +/* bfd back-end for vax support + Copyright 1990, 1991, 1994, 2000, 2002 Free Software Foundation, Inc. + Written by Steve Chamberlain of Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_vax_arch = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_vax, + 0, /* only 1 machine */ + "vax", + "vax", + 3, + TRUE, /* the one and only */ + bfd_default_compatible, + bfd_default_scan , + 0, + }; diff --git a/bfd/cpu-w65.c b/bfd/cpu-w65.c new file mode 100644 index 0000000000000..ed54687d4a28c --- /dev/null +++ b/bfd/cpu-w65.c @@ -0,0 +1,54 @@ +/* BFD library support routines for the WDC 65816 architecture. + Copyright 1995, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Hacked by Steve Chamberlain of Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as publiw65ed 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 w65ould 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +static bfd_boolean scan_mach + PARAMS ((const struct bfd_arch_info *, const char *)); + +static bfd_boolean +scan_mach (info, string) + const struct bfd_arch_info *info ATTRIBUTE_UNUSED; + const char *string; +{ + if (strcmp(string,"w65") == 0) + return TRUE; + if (strcmp(string,"w65816") == 0) + return TRUE; + return FALSE; +} + +const bfd_arch_info_type bfd_w65_arch = +{ + 16, /* 16 bits in a word */ + 24, /* 24 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_w65, + 0, /* only 1 machine */ + "w65", /* arch_name */ + "w65", /* printable name */ + 1, + TRUE, /* the default machine */ + bfd_default_compatible, + scan_mach, + 0, +}; diff --git a/bfd/cpu-we32k.c b/bfd/cpu-we32k.c new file mode 100644 index 0000000000000..09bf97ae34cfb --- /dev/null +++ b/bfd/cpu-we32k.c @@ -0,0 +1,39 @@ +/* bfd back-end for we32k support + Copyright 1992, 2000, 2002 Free Software Foundation, Inc. + Contributed by Brendan Kehoe (brendan@cs.widener.edu). + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_we32k_arch = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_we32k, + 32000, /* only 1 machine */ + "we32k", + "we32k:32000", + 3, + TRUE, /* the one and only */ + bfd_default_compatible, + bfd_default_scan , + 0, + }; diff --git a/bfd/cpu-xstormy16.c b/bfd/cpu-xstormy16.c new file mode 100644 index 0000000000000..776a4831fdd12 --- /dev/null +++ b/bfd/cpu-xstormy16.c @@ -0,0 +1,38 @@ +/* BFD support for the XSTORMY16 processor. + Copyright 2001, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_xstormy16_arch = +{ + 16, /* bits per word */ + 32, /* bits per address */ + 8, /* bits per byte */ + bfd_arch_xstormy16, /* architecture */ + bfd_mach_xstormy16, /* machine */ + "xstormy16", /* architecture name */ + "xstormy16", /* printable name */ + 2, /* section align power */ + TRUE, /* the default ? */ + bfd_default_compatible, /* architecture comparison fn */ + bfd_default_scan, /* string to architecture convert fn */ + NULL /* next in list */ +}; diff --git a/bfd/cpu-xtensa.c b/bfd/cpu-xtensa.c new file mode 100644 index 0000000000000..fbfff64b61147 --- /dev/null +++ b/bfd/cpu-xtensa.c @@ -0,0 +1,38 @@ +/* BFD support for the Xtensa processor. + Copyright 2003 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_xtensa_arch = +{ + 32, /* Bits per word. */ + 32, /* Bits per address. */ + 8, /* Bits per byte. */ + bfd_arch_xtensa, /* Architecture. */ + bfd_mach_xtensa, /* Machine. */ + "xtensa", /* Architecture name. */ + "xtensa", /* Printable name. */ + 4, /* Section align power. */ + TRUE, /* The default? */ + bfd_default_compatible, /* Architecture comparison fn. */ + bfd_default_scan, /* String to architecture convert fn. */ + NULL /* Next in list. */ +}; diff --git a/bfd/cpu-z8k.c b/bfd/cpu-z8k.c new file mode 100644 index 0000000000000..d1ea14c33095d --- /dev/null +++ b/bfd/cpu-z8k.c @@ -0,0 +1,47 @@ +/* BFD library support routines for the Z800n architecture. + Copyright 1992, 1993, 1994, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Hacked by Steve Chamberlain of Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +/* This routine is provided two arch_infos and returns whether + they'd be compatible */ + +static const bfd_arch_info_type * +compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b) +{ + if (a->arch != b->arch || a->mach != b->mach) + return NULL; + return a; +} + +static const bfd_arch_info_type arch_info_struct[] = +{ + { 32, 16, 8, bfd_arch_z8k, bfd_mach_z8002, "z8k", "z8002", 1, FALSE, + compatible, bfd_default_scan, 0 } +}; + +const bfd_arch_info_type bfd_z8k_arch = +{ + 32, 32, 8, bfd_arch_z8k, bfd_mach_z8001, "z8k", "z8001", 1, TRUE, + compatible, bfd_default_scan, &arch_info_struct[0] +}; diff --git a/bfd/doc/bfd.info b/bfd/doc/bfd.info new file mode 100644 index 0000000000000..6eb95712b4da5 --- /dev/null +++ b/bfd/doc/bfd.info @@ -0,0 +1,88 @@ +This is bfd.info, produced by makeinfo version 4.6 from bfd.texinfo. + +START-INFO-DIR-ENTRY +* Bfd: (bfd). The Binary File Descriptor library. +END-INFO-DIR-ENTRY + + This file documents the BFD library. + + Copyright (C) 1991, 2000, 2001, 2003 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 + or any later version published by the Free Software Foundation; + with no Invariant Sections, with no Front-Cover Texts, and with no + Back-Cover Texts. A copy of the license is included in the +section entitled "GNU Free Documentation License". + + +Indirect: +bfd.info-1: 692 +bfd.info-2: 285251 + +Tag Table: +(Indirect) +Node: Top692 +Node: Overview1024 +Node: History2071 +Node: How It Works3009 +Node: What BFD Version 2 Can Do4546 +Node: BFD information loss5853 +Node: Canonical format8373 +Node: BFD front end12731 +Node: Memory Usage35747 +Node: Initialization36967 +Node: Sections37339 +Node: Section Input37814 +Node: Section Output39167 +Node: typedef asection41629 +Node: section prototypes60640 +Node: Symbols67775 +Node: Reading Symbols69362 +Node: Writing Symbols70487 +Node: Mini Symbols72204 +Node: typedef asymbol73166 +Node: symbol handling functions78207 +Node: Archives82832 +Node: Formats86453 +Node: Relocations89272 +Node: typedef arelent89989 +Node: howto manager105706 +Node: Core Files154473 +Node: Targets155488 +Node: bfd_target157448 +Node: Architectures175979 +Node: Opening and Closing194680 +Node: Internal202356 +Node: File Caching208588 +Node: Linker Functions211353 +Node: Creating a Linker Hash Table213016 +Node: Adding Symbols to the Hash Table214740 +Node: Differing file formats215626 +Node: Adding symbols from an object file217356 +Node: Adding symbols from an archive219489 +Node: Performing the Final Link221885 +Node: Information provided by the linker223113 +Node: Relocating the section contents224245 +Node: Writing the symbol table225978 +Node: Hash Tables228571 +Node: Creating and Freeing a Hash Table229759 +Node: Looking Up or Entering a String230913 +Node: Traversing a Hash Table232152 +Node: Deriving a New Hash Table Type232927 +Node: Define the Derived Structures233979 +Node: Write the Derived Creation Routine235042 +Node: Write Other Derived Routines237738 +Node: BFD back ends239035 +Node: What to Put Where239301 +Node: aout239439 +Node: coff245546 +Node: elf270433 +Node: mmo271264 +Node: File layout272184 +Node: Symbol-table277819 +Node: mmo section mapping281611 +Node: GNU Free Documentation License285251 +Node: Index304948 + +End Tag Table diff --git a/bfd/doc/bfd.info-1 b/bfd/doc/bfd.info-1 new file mode 100644 index 0000000000000..5d0dc61131b1c --- /dev/null +++ b/bfd/doc/bfd.info-1 @@ -0,0 +1,7684 @@ +This is bfd.info, produced by makeinfo version 4.6 from bfd.texinfo. + +START-INFO-DIR-ENTRY +* Bfd: (bfd). The Binary File Descriptor library. +END-INFO-DIR-ENTRY + + This file documents the BFD library. + + Copyright (C) 1991, 2000, 2001, 2003 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 + or any later version published by the Free Software Foundation; + with no Invariant Sections, with no Front-Cover Texts, and with no + Back-Cover Texts. A copy of the license is included in the +section entitled "GNU Free Documentation License". + + +File: bfd.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir) + + This file documents the binary file descriptor library libbfd. + +* Menu: + +* Overview:: Overview of BFD +* BFD front end:: BFD front end +* BFD back ends:: BFD back ends +* GNU Free Documentation License:: GNU Free Documentation License +* Index:: Index + + +File: bfd.info, Node: Overview, Next: BFD front end, Prev: Top, Up: Top + +Introduction +************ + +BFD is a package which allows applications to use the same routines to +operate on object files whatever the object file format. A new object +file format can be supported simply by creating a new BFD back end and +adding it to the library. + + BFD is split into two parts: the front end, and the back ends (one +for each object file format). + * The front end of BFD provides the interface to the user. It manages + memory and various canonical data structures. The front end also + decides which back end to use and when to call back end routines. + + * The back ends provide BFD its view of the real world. Each back + end provides a set of calls which the BFD front end can use to + maintain its canonical form. The back ends also may keep around + information for their own use, for greater efficiency. + +* Menu: + +* History:: History +* How It Works:: How It Works +* What BFD Version 2 Can Do:: What BFD Version 2 Can Do + + +File: bfd.info, Node: History, Next: How It Works, Prev: Overview, Up: Overview + +History +======= + +One spur behind BFD was the desire, on the part of the GNU 960 team at +Intel Oregon, for interoperability of applications on their COFF and +b.out file formats. Cygnus was providing GNU support for the team, and +was contracted to provide the required functionality. + + The name came from a conversation David Wallace was having with +Richard Stallman about the library: RMS said that it would be quite +hard--David said "BFD". Stallman was right, but the name stuck. + + At the same time, Ready Systems wanted much the same thing, but for +different object file formats: IEEE-695, Oasys, Srecords, a.out and 68k +coff. + + BFD was first implemented by members of Cygnus Support; Steve +Chamberlain (`sac@cygnus.com'), John Gilmore (`gnu@cygnus.com'), K. +Richard Pixley (`rich@cygnus.com') and David Henkel-Wallace +(`gumby@cygnus.com'). + + +File: bfd.info, Node: How It Works, Next: What BFD Version 2 Can Do, Prev: History, Up: Overview + +How To Use BFD +============== + +To use the library, include `bfd.h' and link with `libbfd.a'. + + BFD provides a common interface to the parts of an object file for a +calling application. + + When an application sucessfully opens a target file (object, +archive, or whatever), a pointer to an internal structure is returned. +This pointer points to a structure called `bfd', described in `bfd.h'. +Our convention is to call this pointer a BFD, and instances of it +within code `abfd'. All operations on the target object file are +applied as methods to the BFD. The mapping is defined within `bfd.h' +in a set of macros, all beginning with `bfd_' to reduce namespace +pollution. + + For example, this sequence does what you would probably expect: +return the number of sections in an object file attached to a BFD +`abfd'. + + #include "bfd.h" + + unsigned int number_of_sections (abfd) + bfd *abfd; + { + return bfd_count_sections (abfd); + } + + The abstraction used within BFD is that an object file has: + + * a header, + + * a number of sections containing raw data (*note Sections::), + + * a set of relocations (*note Relocations::), and + + * some symbol information (*note Symbols::). + +Also, BFDs opened for archives have the additional attribute of an index +and contain subordinate BFDs. This approach is fine for a.out and coff, +but loses efficiency when applied to formats such as S-records and +IEEE-695. + + +File: bfd.info, Node: What BFD Version 2 Can Do, Prev: How It Works, Up: Overview + +What BFD Version 2 Can Do +========================= + +When an object file is opened, BFD subroutines automatically determine +the format of the input object file. They then build a descriptor in +memory with pointers to routines that will be used to access elements of +the object file's data structures. + + As different information from the object files is required, BFD +reads from different sections of the file and processes them. For +example, a very common operation for the linker is processing symbol +tables. Each BFD back end provides a routine for converting between +the object file's representation of symbols and an internal canonical +format. When the linker asks for the symbol table of an object file, it +calls through a memory pointer to the routine from the relevant BFD +back end which reads and converts the table into a canonical form. The +linker then operates upon the canonical form. When the link is finished +and the linker writes the output file's symbol table, another BFD back +end routine is called to take the newly created symbol table and +convert it into the chosen output format. + +* Menu: + +* BFD information loss:: Information Loss +* Canonical format:: The BFD canonical object-file format + + +File: bfd.info, Node: BFD information loss, Next: Canonical format, Up: What BFD Version 2 Can Do + +Information Loss +---------------- + +_Information can be lost during output._ The output formats supported +by BFD do not provide identical facilities, and information which can +be described in one form has nowhere to go in another format. One +example of this is alignment information in `b.out'. There is nowhere +in an `a.out' format file to store alignment information on the +contained data, so when a file is linked from `b.out' and an `a.out' +image is produced, alignment information will not propagate to the +output file. (The linker will still use the alignment information +internally, so the link is performed correctly). + + Another example is COFF section names. COFF files may contain an +unlimited number of sections, each one with a textual section name. If +the target of the link is a format which does not have many sections +(e.g., `a.out') or has sections without names (e.g., the Oasys format), +the link cannot be done simply. You can circumvent this problem by +describing the desired input-to-output section mapping with the linker +command language. + + _Information can be lost during canonicalization._ The BFD internal +canonical form of the external formats is not exhaustive; there are +structures in input formats for which there is no direct representation +internally. This means that the BFD back ends cannot maintain all +possible data richness through the transformation between external to +internal and back to external formats. + + This limitation is only a problem when an application reads one +format and writes another. Each BFD back end is responsible for +maintaining as much data as possible, and the internal BFD canonical +form has structures which are opaque to the BFD core, and exported only +to the back ends. When a file is read in one format, the canonical form +is generated for BFD and the application. At the same time, the back +end saves away any information which may otherwise be lost. If the data +is then written back in the same format, the back end routine will be +able to use the canonical form provided by the BFD core as well as the +information it prepared earlier. Since there is a great deal of +commonality between back ends, there is no information lost when +linking or copying big endian COFF to little endian COFF, or `a.out' to +`b.out'. When a mixture of formats is linked, the information is only +lost from the files whose format differs from the destination. + + +File: bfd.info, Node: Canonical format, Prev: BFD information loss, Up: What BFD Version 2 Can Do + +The BFD canonical object-file format +------------------------------------ + +The greatest potential for loss of information occurs when there is the +least overlap between the information provided by the source format, +that stored by the canonical format, and that needed by the destination +format. A brief description of the canonical form may help you +understand which kinds of data you can count on preserving across +conversions. + +_files_ + Information stored on a per-file basis includes target machine + architecture, particular implementation format type, a demand + pageable bit, and a write protected bit. Information like Unix + magic numbers is not stored here--only the magic numbers' meaning, + so a `ZMAGIC' file would have both the demand pageable bit and the + write protected text bit set. The byte order of the target is + stored on a per-file basis, so that big- and little-endian object + files may be used with one another. + +_sections_ + Each section in the input file contains the name of the section, + the section's original address in the object file, size and + alignment information, various flags, and pointers into other BFD + data structures. + +_symbols_ + Each symbol contains a pointer to the information for the object + file which originally defined it, its name, its value, and various + flag bits. When a BFD back end reads in a symbol table, it + relocates all symbols to make them relative to the base of the + section where they were defined. Doing this ensures that each + symbol points to its containing section. Each symbol also has a + varying amount of hidden private data for the BFD back end. Since + the symbol points to the original file, the private data format + for that symbol is accessible. `ld' can operate on a collection + of symbols of wildly different formats without problems. + + Normal global and simple local symbols are maintained on output, + so an output file (no matter its format) will retain symbols + pointing to functions and to global, static, and common variables. + Some symbol information is not worth retaining; in `a.out', type + information is stored in the symbol table as long symbol names. + This information would be useless to most COFF debuggers; the + linker has command line switches to allow users to throw it away. + + There is one word of type information within the symbol, so if the + format supports symbol type information within symbols (for + example, COFF, IEEE, Oasys) and the type is simple enough to fit + within one word (nearly everything but aggregates), the + information will be preserved. + +_relocation level_ + Each canonical BFD relocation record contains a pointer to the + symbol to relocate to, the offset of the data to relocate, the + section the data is in, and a pointer to a relocation type + descriptor. Relocation is performed by passing messages through + the relocation type descriptor and the symbol pointer. Therefore, + relocations can be performed on output data using a relocation + method that is only available in one of the input formats. For + instance, Oasys provides a byte relocation format. A relocation + record requesting this relocation type would point indirectly to a + routine to perform this, so the relocation may be performed on a + byte being written to a 68k COFF file, even though 68k COFF has no + such relocation type. + +_line numbers_ + Object formats can contain, for debugging purposes, some form of + mapping between symbols, source line numbers, and addresses in the + output file. These addresses have to be relocated along with the + symbol information. Each symbol with an associated list of line + number records points to the first record of the list. The head + of a line number list consists of a pointer to the symbol, which + allows finding out the address of the function whose line number + is being described. The rest of the list is made up of pairs: + offsets into the section and line numbers. Any format which can + simply derive this information can pass it successfully between + formats (COFF, IEEE and Oasys). + + +File: bfd.info, Node: BFD front end, Next: BFD back ends, Prev: Overview, Up: Top + +BFD Front End +************* + +`typedef bfd' +============= + +A BFD has type `bfd'; objects of this type are the cornerstone of any +application using BFD. Using BFD consists of making references though +the BFD and to data in the BFD. + + Here is the structure that defines the type `bfd'. It contains the +major data about the file and pointers to the rest of the data. + + + struct bfd + { + /* A unique identifier of the BFD */ + unsigned int id; + + /* The filename the application opened the BFD with. */ + const char *filename; + + /* A pointer to the target jump table. */ + const struct bfd_target *xvec; + + /* To avoid dragging too many header files into every file that + includes ``bfd.h'', IOSTREAM has been declared as a "char *", + and MTIME as a "long". Their correct types, to which they + are cast when used, are "FILE *" and "time_t". The iostream + is the result of an fopen on the filename. However, if the + BFD_IN_MEMORY flag is set, then iostream is actually a pointer + to a bfd_in_memory struct. */ + void *iostream; + + /* Is the file descriptor being cached? That is, can it be closed as + needed, and re-opened when accessed later? */ + bfd_boolean cacheable; + + /* Marks whether there was a default target specified when the + BFD was opened. This is used to select which matching algorithm + to use to choose the back end. */ + bfd_boolean target_defaulted; + + /* The caching routines use these to maintain a + least-recently-used list of BFDs. */ + struct bfd *lru_prev, *lru_next; + + /* When a file is closed by the caching routines, BFD retains + state information on the file here... */ + ufile_ptr where; + + /* ... and here: (``once'' means at least once). */ + bfd_boolean opened_once; + + /* Set if we have a locally maintained mtime value, rather than + getting it from the file each time. */ + bfd_boolean mtime_set; + + /* File modified time, if mtime_set is TRUE. */ + long mtime; + + /* Reserved for an unimplemented file locking extension. */ + int ifd; + + /* The format which belongs to the BFD. (object, core, etc.) */ + bfd_format format; + + /* The direction with which the BFD was opened. */ + enum bfd_direction + { + no_direction = 0, + read_direction = 1, + write_direction = 2, + both_direction = 3 + } + direction; + + /* Format_specific flags. */ + flagword flags; + + /* Currently my_archive is tested before adding origin to + anything. I believe that this can become always an add of + origin, with origin set to 0 for non archive files. */ + ufile_ptr origin; + + /* Remember when output has begun, to stop strange things + from happening. */ + bfd_boolean output_has_begun; + + /* A hash table for section names. */ + struct bfd_hash_table section_htab; + + /* Pointer to linked list of sections. */ + struct bfd_section *sections; + + /* The place where we add to the section list. */ + struct bfd_section **section_tail; + + /* The number of sections. */ + unsigned int section_count; + + /* Stuff only useful for object files: + The start address. */ + bfd_vma start_address; + + /* Used for input and output. */ + unsigned int symcount; + + /* Symbol table for output BFD (with symcount entries). */ + struct bfd_symbol **outsymbols; + + /* Used for slurped dynamic symbol tables. */ + unsigned int dynsymcount; + + /* Pointer to structure which contains architecture information. */ + const struct bfd_arch_info *arch_info; + + /* Stuff only useful for archives. */ + void *arelt_data; + struct bfd *my_archive; /* The containing archive BFD. */ + struct bfd *next; /* The next BFD in the archive. */ + struct bfd *archive_head; /* The first BFD in the archive. */ + bfd_boolean has_armap; + + /* A chain of BFD structures involved in a link. */ + struct bfd *link_next; + + /* A field used by _bfd_generic_link_add_archive_symbols. This will + be used only for archive elements. */ + int archive_pass; + + /* Used by the back end to hold private data. */ + union + { + struct aout_data_struct *aout_data; + struct artdata *aout_ar_data; + struct _oasys_data *oasys_obj_data; + struct _oasys_ar_data *oasys_ar_data; + struct coff_tdata *coff_obj_data; + struct pe_tdata *pe_obj_data; + struct xcoff_tdata *xcoff_obj_data; + struct ecoff_tdata *ecoff_obj_data; + struct ieee_data_struct *ieee_data; + struct ieee_ar_data_struct *ieee_ar_data; + struct srec_data_struct *srec_data; + struct ihex_data_struct *ihex_data; + struct tekhex_data_struct *tekhex_data; + struct elf_obj_tdata *elf_obj_data; + struct nlm_obj_tdata *nlm_obj_data; + struct bout_data_struct *bout_data; + struct mmo_data_struct *mmo_data; + struct sun_core_struct *sun_core_data; + struct sco5_core_struct *sco5_core_data; + struct trad_core_struct *trad_core_data; + struct som_data_struct *som_data; + struct hpux_core_struct *hpux_core_data; + struct hppabsd_core_struct *hppabsd_core_data; + struct sgi_core_struct *sgi_core_data; + struct lynx_core_struct *lynx_core_data; + struct osf_core_struct *osf_core_data; + struct cisco_core_struct *cisco_core_data; + struct versados_data_struct *versados_data; + struct netbsd_core_struct *netbsd_core_data; + struct mach_o_data_struct *mach_o_data; + struct mach_o_fat_data_struct *mach_o_fat_data; + struct bfd_pef_data_struct *pef_data; + struct bfd_pef_xlib_data_struct *pef_xlib_data; + struct bfd_sym_data_struct *sym_data; + void *any; + } + tdata; + + /* Used by the application to hold private data. */ + void *usrdata; + + /* Where all the allocated stuff under this BFD goes. This is a + struct objalloc *, but we use void * to avoid requiring the inclusion + of objalloc.h. */ + void *memory; + }; + +Error reporting +=============== + +Most BFD functions return nonzero on success (check their individual +documentation for precise semantics). On an error, they call +`bfd_set_error' to set an error condition that callers can check by +calling `bfd_get_error'. If that returns `bfd_error_system_call', then +check `errno'. + + The easiest way to report a BFD error to the user is to use +`bfd_perror'. + +Type `bfd_error_type' +--------------------- + +The values returned by `bfd_get_error' are defined by the enumerated +type `bfd_error_type'. + + + typedef enum bfd_error + { + bfd_error_no_error = 0, + bfd_error_system_call, + bfd_error_invalid_target, + bfd_error_wrong_format, + bfd_error_wrong_object_format, + bfd_error_invalid_operation, + bfd_error_no_memory, + bfd_error_no_symbols, + bfd_error_no_armap, + bfd_error_no_more_archived_files, + bfd_error_malformed_archive, + bfd_error_file_not_recognized, + bfd_error_file_ambiguously_recognized, + bfd_error_no_contents, + bfd_error_nonrepresentable_section, + bfd_error_no_debug_section, + bfd_error_bad_value, + bfd_error_file_truncated, + bfd_error_file_too_big, + bfd_error_invalid_error_code + } + bfd_error_type; + +`bfd_get_error' +............... + +*Synopsis* + bfd_error_type bfd_get_error (void); + *Description* +Return the current BFD error condition. + +`bfd_set_error' +............... + +*Synopsis* + void bfd_set_error (bfd_error_type error_tag); + *Description* +Set the BFD error condition to be ERROR_TAG. + +`bfd_errmsg' +............ + +*Synopsis* + const char *bfd_errmsg (bfd_error_type error_tag); + *Description* +Return a string describing the error ERROR_TAG, or the system error if +ERROR_TAG is `bfd_error_system_call'. + +`bfd_perror' +............ + +*Synopsis* + void bfd_perror (const char *message); + *Description* +Print to the standard error stream a string describing the last BFD +error that occurred, or the last system error if the last BFD error was +a system call failure. If MESSAGE is non-NULL and non-empty, the error +string printed is preceded by MESSAGE, a colon, and a space. It is +followed by a newline. + +BFD error handler +----------------- + +Some BFD functions want to print messages describing the problem. They +call a BFD error handler function. This function may be overridden by +the program. + + The BFD error handler acts like printf. + + + typedef void (*bfd_error_handler_type) (const char *, ...); + +`bfd_set_error_handler' +....................... + +*Synopsis* + bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); + *Description* +Set the BFD error handler function. Returns the previous function. + +`bfd_set_error_program_name' +............................ + +*Synopsis* + void bfd_set_error_program_name (const char *); + *Description* +Set the program name to use when printing a BFD error. This is printed +before the error message followed by a colon and space. The string +must not be changed after it is passed to this function. + +`bfd_get_error_handler' +....................... + +*Synopsis* + bfd_error_handler_type bfd_get_error_handler (void); + *Description* +Return the BFD error handler function. + +`bfd_archive_filename' +...................... + +*Synopsis* + const char *bfd_archive_filename (bfd *); + *Description* +For a BFD that is a component of an archive, returns a string with both +the archive name and file name. For other BFDs, just returns the file +name. + +Symbols +======= + +`bfd_get_reloc_upper_bound' +........................... + +*Synopsis* + long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect); + *Description* +Return the number of bytes required to store the relocation information +associated with section SECT attached to bfd ABFD. If an error occurs, +return -1. + +`bfd_canonicalize_reloc' +........................ + +*Synopsis* + long bfd_canonicalize_reloc + (bfd *abfd, asection *sec, arelent **loc, asymbol **syms); + *Description* +Call the back end associated with the open BFD ABFD and translate the +external form of the relocation information attached to SEC into the +internal canonical form. Place the table into memory at LOC, which has +been preallocated, usually by a call to `bfd_get_reloc_upper_bound'. +Returns the number of relocs, or -1 on error. + + The SYMS table is also needed for horrible internal magic reasons. + +`bfd_set_reloc' +............... + +*Synopsis* + void bfd_set_reloc + (bfd *abfd, asection *sec, arelent **rel, unsigned int count); + *Description* +Set the relocation pointer and count within section SEC to the values +REL and COUNT. The argument ABFD is ignored. + +`bfd_set_file_flags' +.................... + +*Synopsis* + bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags); + *Description* +Set the flag word in the BFD ABFD to the value FLAGS. + + Possible errors are: + * `bfd_error_wrong_format' - The target bfd was not of object format. + + * `bfd_error_invalid_operation' - The target bfd was open for + reading. + + * `bfd_error_invalid_operation' - The flag word contained a bit + which was not applicable to the type of file. E.g., an attempt + was made to set the `D_PAGED' bit on a BFD format which does not + support demand paging. + +`bfd_get_arch_size' +................... + +*Synopsis* + int bfd_get_arch_size (bfd *abfd); + *Description* +Returns the architecture address size, in bits, as determined by the +object file's format. For ELF, this information is included in the +header. + + *Returns* +Returns the arch size in bits if known, `-1' otherwise. + +`bfd_get_sign_extend_vma' +......................... + +*Synopsis* + int bfd_get_sign_extend_vma (bfd *abfd); + *Description* +Indicates if the target architecture "naturally" sign extends an +address. Some architectures implicitly sign extend address values when +they are converted to types larger than the size of an address. For +instance, bfd_get_start_address() will return an address sign extended +to fill a bfd_vma when this is the case. + + *Returns* +Returns `1' if the target architecture is known to sign extend +addresses, `0' if the target architecture is known to not sign extend +addresses, and `-1' otherwise. + +`bfd_set_start_address' +....................... + +*Synopsis* + bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma); + *Description* +Make VMA the entry point of output BFD ABFD. + + *Returns* +Returns `TRUE' on success, `FALSE' otherwise. + +`bfd_get_gp_size' +................. + +*Synopsis* + unsigned int bfd_get_gp_size (bfd *abfd); + *Description* +Return the maximum size of objects to be optimized using the GP +register under MIPS ECOFF. This is typically set by the `-G' argument +to the compiler, assembler or linker. + +`bfd_set_gp_size' +................. + +*Synopsis* + void bfd_set_gp_size (bfd *abfd, unsigned int i); + *Description* +Set the maximum size of objects to be optimized using the GP register +under ECOFF or MIPS ELF. This is typically set by the `-G' argument to +the compiler, assembler or linker. + +`bfd_scan_vma' +.............. + +*Synopsis* + bfd_vma bfd_scan_vma (const char *string, const char **end, int base); + *Description* +Convert, like `strtoul', a numerical expression STRING into a `bfd_vma' +integer, and return that integer. (Though without as many bells and +whistles as `strtoul'.) The expression is assumed to be unsigned +(i.e., positive). If given a BASE, it is used as the base for +conversion. A base of 0 causes the function to interpret the string in +hex if a leading "0x" or "0X" is found, otherwise in octal if a leading +zero is found, otherwise in decimal. + + If the value would overflow, the maximum `bfd_vma' value is returned. + +`bfd_copy_private_bfd_data' +........................... + +*Synopsis* + bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd); + *Description* +Copy private BFD information from the BFD IBFD to the the BFD OBFD. +Return `TRUE' on success, `FALSE' on error. Possible error returns are: + + * `bfd_error_no_memory' - Not enough memory exists to create private + data for OBFD. + + #define bfd_copy_private_bfd_data(ibfd, obfd) \ + BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ + (ibfd, obfd)) + +`bfd_merge_private_bfd_data' +............................ + +*Synopsis* + bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd); + *Description* +Merge private BFD information from the BFD IBFD to the the output file +BFD OBFD when linking. Return `TRUE' on success, `FALSE' on error. +Possible error returns are: + + * `bfd_error_no_memory' - Not enough memory exists to create private + data for OBFD. + + #define bfd_merge_private_bfd_data(ibfd, obfd) \ + BFD_SEND (obfd, _bfd_merge_private_bfd_data, \ + (ibfd, obfd)) + +`bfd_set_private_flags' +....................... + +*Synopsis* + bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); + *Description* +Set private BFD flag information in the BFD ABFD. Return `TRUE' on +success, `FALSE' on error. Possible error returns are: + + * `bfd_error_no_memory' - Not enough memory exists to create private + data for OBFD. + + #define bfd_set_private_flags(abfd, flags) \ + BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags)) + +`Other functions' +................. + +*Description* +The following functions exist but have not yet been documented. + #define bfd_sizeof_headers(abfd, reloc) \ + BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc)) + + #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ + BFD_SEND (abfd, _bfd_find_nearest_line, \ + (abfd, sec, syms, off, file, func, line)) + + #define bfd_debug_info_start(abfd) \ + BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) + + #define bfd_debug_info_end(abfd) \ + BFD_SEND (abfd, _bfd_debug_info_end, (abfd)) + + #define bfd_debug_info_accumulate(abfd, section) \ + BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) + + #define bfd_stat_arch_elt(abfd, stat) \ + BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) + + #define bfd_update_armap_timestamp(abfd) \ + BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd)) + + #define bfd_set_arch_mach(abfd, arch, mach)\ + BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach)) + + #define bfd_relax_section(abfd, section, link_info, again) \ + BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again)) + + #define bfd_gc_sections(abfd, link_info) \ + BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info)) + + #define bfd_merge_sections(abfd, link_info) \ + BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info)) + + #define bfd_discard_group(abfd, sec) \ + BFD_SEND (abfd, _bfd_discard_group, (abfd, sec)) + + #define bfd_link_hash_table_create(abfd) \ + BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) + + #define bfd_link_hash_table_free(abfd, hash) \ + BFD_SEND (abfd, _bfd_link_hash_table_free, (hash)) + + #define bfd_link_add_symbols(abfd, info) \ + BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) + + #define bfd_link_just_syms(sec, info) \ + BFD_SEND (abfd, _bfd_link_just_syms, (sec, info)) + + #define bfd_final_link(abfd, info) \ + BFD_SEND (abfd, _bfd_final_link, (abfd, info)) + + #define bfd_free_cached_info(abfd) \ + BFD_SEND (abfd, _bfd_free_cached_info, (abfd)) + + #define bfd_get_dynamic_symtab_upper_bound(abfd) \ + BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd)) + + #define bfd_print_private_bfd_data(abfd, file)\ + BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file)) + + #define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ + BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) + + #define bfd_get_dynamic_reloc_upper_bound(abfd) \ + BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) + + #define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \ + BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms)) + + extern bfd_byte *bfd_get_relocated_section_contents + (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, + bfd_boolean, asymbol **); + +`bfd_alt_mach_code' +................... + +*Synopsis* + bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative); + *Description* +When more than one machine code number is available for the same +machine type, this function can be used to switch between the preferred +one (alternative == 0) and any others. Currently, only ELF supports +this feature, with up to two alternate machine codes. + + struct bfd_preserve + { + void *marker; + void *tdata; + flagword flags; + const struct bfd_arch_info *arch_info; + struct bfd_section *sections; + struct bfd_section **section_tail; + unsigned int section_count; + struct bfd_hash_table section_htab; + }; + +`bfd_preserve_save' +................... + +*Synopsis* + bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *); + *Description* +When testing an object for compatibility with a particular target +back-end, the back-end object_p function needs to set up certain fields +in the bfd on successfully recognizing the object. This typically +happens in a piecemeal fashion, with failures possible at many points. +On failure, the bfd is supposed to be restored to its initial state, +which is virtually impossible. However, restoring a subset of the bfd +state works in practice. This function stores the subset and +reinitializes the bfd. + +`bfd_preserve_restore' +...................... + +*Synopsis* + void bfd_preserve_restore (bfd *, struct bfd_preserve *); + *Description* +This function restores bfd state saved by bfd_preserve_save. If MARKER +is non-NULL in struct bfd_preserve then that block and all subsequently +bfd_alloc'd memory is freed. + +`bfd_preserve_finish' +..................... + +*Synopsis* + void bfd_preserve_finish (bfd *, struct bfd_preserve *); + *Description* +This function should be called when the bfd state saved by +bfd_preserve_save is no longer needed. ie. when the back-end object_p +function returns with success. + +`bfd_get_mtime' +............... + +*Synopsis* + long bfd_get_mtime (bfd *abfd); + *Description* +Return the file modification time (as read from the file system, or +from the archive header for archive members). + +`bfd_get_size' +.............. + +*Synopsis* + long bfd_get_size (bfd *abfd); + *Description* +Return the file size (as read from file system) for the file associated +with BFD ABFD. + + The initial motivation for, and use of, this routine is not so we +can get the exact size of the object the BFD applies to, since that +might not be generally possible (archive members for example). It +would be ideal if someone could eventually modify it so that such +results were guaranteed. + + Instead, we want to ask questions like "is this NNN byte sized +object I'm about to try read from file offset YYY reasonable?" As as +example of where we might do this, some object formats use string +tables for which the first `sizeof (long)' bytes of the table contain +the size of the table itself, including the size bytes. If an +application tries to read what it thinks is one of these string tables, +without some way to validate the size, and for some reason the size is +wrong (byte swapping error, wrong location for the string table, etc.), +the only clue is likely to be a read error when it tries to read the +table, or a "virtual memory exhausted" error when it tries to allocate +15 bazillon bytes of space for the 15 bazillon byte table it is about +to read. This function at least allows us to answer the question, "is +the size reasonable?". + +* Menu: + +* Memory Usage:: +* Initialization:: +* Sections:: +* Symbols:: +* Archives:: +* Formats:: +* Relocations:: +* Core Files:: +* Targets:: +* Architectures:: +* Opening and Closing:: +* Internal:: +* File Caching:: +* Linker Functions:: +* Hash Tables:: + + +File: bfd.info, Node: Memory Usage, Next: Initialization, Prev: BFD front end, Up: BFD front end + +Memory Usage +============ + +BFD keeps all of its internal structures in obstacks. There is one +obstack per open BFD file, into which the current state is stored. When +a BFD is closed, the obstack is deleted, and so everything which has +been allocated by BFD for the closing file is thrown away. + + BFD does not free anything created by an application, but pointers +into `bfd' structures become invalid on a `bfd_close'; for example, +after a `bfd_close' the vector passed to `bfd_canonicalize_symtab' is +still around, since it has been allocated by the application, but the +data that it pointed to are lost. + + The general rule is to not close a BFD until all operations dependent +upon data from the BFD have been completed, or all the data from within +the file has been copied. To help with the management of memory, there +is a function (`bfd_alloc_size') which returns the number of bytes in +obstacks associated with the supplied BFD. This could be used to select +the greediest open BFD, close it to reclaim the memory, perform some +operation and reopen the BFD again, to get a fresh copy of the data +structures. + + +File: bfd.info, Node: Initialization, Next: Sections, Prev: Memory Usage, Up: BFD front end + +Initialization +============== + +These are the functions that handle initializing a BFD. + +`bfd_init' +.......... + +*Synopsis* + void bfd_init (void); + *Description* +This routine must be called before any other BFD function to initialize +magical internal data structures. + + +File: bfd.info, Node: Sections, Next: Symbols, Prev: Initialization, Up: BFD front end + +Sections +======== + +The raw data contained within a BFD is maintained through the section +abstraction. A single BFD may have any number of sections. It keeps +hold of them by pointing to the first; each one points to the next in +the list. + + Sections are supported in BFD in `section.c'. + +* Menu: + +* Section Input:: +* Section Output:: +* typedef asection:: +* section prototypes:: + + +File: bfd.info, Node: Section Input, Next: Section Output, Prev: Sections, Up: Sections + +Section input +------------- + +When a BFD is opened for reading, the section structures are created +and attached to the BFD. + + Each section has a name which describes the section in the outside +world--for example, `a.out' would contain at least three sections, +called `.text', `.data' and `.bss'. + + Names need not be unique; for example a COFF file may have several +sections named `.data'. + + Sometimes a BFD will contain more than the "natural" number of +sections. A back end may attach other sections containing constructor +data, or an application may add a section (using `bfd_make_section') to +the sections attached to an already open BFD. For example, the linker +creates an extra section `COMMON' for each input file's BFD to hold +information about common storage. + + The raw data is not necessarily read in when the section descriptor +is created. Some targets may leave the data in place until a +`bfd_get_section_contents' call is made. Other back ends may read in +all the data at once. For example, an S-record file has to be read +once to determine the size of the data. An IEEE-695 file doesn't +contain raw data in sections, but data and relocation expressions +intermixed, so the data area has to be parsed to get out the data and +relocations. + + +File: bfd.info, Node: Section Output, Next: typedef asection, Prev: Section Input, Up: Sections + +Section output +-------------- + +To write a new object style BFD, the various sections to be written +have to be created. They are attached to the BFD in the same way as +input sections; data is written to the sections using +`bfd_set_section_contents'. + + Any program that creates or combines sections (e.g., the assembler +and linker) must use the `asection' fields `output_section' and +`output_offset' to indicate the file sections to which each section +must be written. (If the section is being created from scratch, +`output_section' should probably point to the section itself and +`output_offset' should probably be zero.) + + The data to be written comes from input sections attached (via +`output_section' pointers) to the output sections. The output section +structure can be considered a filter for the input section: the output +section determines the vma of the output data and the name, but the +input section determines the offset into the output section of the data +to be written. + + E.g., to create a section "O", starting at 0x100, 0x123 long, +containing two subsections, "A" at offset 0x0 (i.e., at vma 0x100) and +"B" at offset 0x20 (i.e., at vma 0x120) the `asection' structures would +look like: + + section name "A" + output_offset 0x00 + size 0x20 + output_section -----------> section name "O" + | vma 0x100 + section name "B" | size 0x123 + output_offset 0x20 | + size 0x103 | + output_section --------| + +Link orders +----------- + +The data within a section is stored in a "link_order". These are much +like the fixups in `gas'. The link_order abstraction allows a section +to grow and shrink within itself. + + A link_order knows how big it is, and which is the next link_order +and where the raw data for it is; it also points to a list of +relocations which apply to it. + + The link_order is used by the linker to perform relaxing on final +code. The compiler creates code which is as big as necessary to make +it work without relaxing, and the user can select whether to relax. +Sometimes relaxing takes a lot of time. The linker runs around the +relocations to see if any are attached to data which can be shrunk, if +so it does it on a link_order by link_order basis. + + +File: bfd.info, Node: typedef asection, Next: section prototypes, Prev: Section Output, Up: Sections + +typedef asection +---------------- + +Here is the section structure: + + + /* This structure is used for a comdat section, as in PE. A comdat + section is associated with a particular symbol. When the linker + sees a comdat section, it keeps only one of the sections with a + given name and associated with a given symbol. */ + + struct bfd_comdat_info + { + /* The name of the symbol associated with a comdat section. */ + const char *name; + + /* The local symbol table index of the symbol associated with a + comdat section. This is only meaningful to the object file format + specific code; it is not an index into the list returned by + bfd_canonicalize_symtab. */ + long symbol; + }; + + typedef struct bfd_section + { + /* The name of the section; the name isn't a copy, the pointer is + the same as that passed to bfd_make_section. */ + const char *name; + + /* A unique sequence number. */ + int id; + + /* Which section in the bfd; 0..n-1 as sections are created in a bfd. */ + int index; + + /* The next section in the list belonging to the BFD, or NULL. */ + struct bfd_section *next; + + /* The field flags contains attributes of the section. Some + flags are read in from the object file, and some are + synthesized from other information. */ + flagword flags; + + #define SEC_NO_FLAGS 0x000 + + /* Tells the OS to allocate space for this section when loading. + This is clear for a section containing debug information only. */ + #define SEC_ALLOC 0x001 + + /* Tells the OS to load the section from the file when loading. + This is clear for a .bss section. */ + #define SEC_LOAD 0x002 + + /* The section contains data still to be relocated, so there is + some relocation information too. */ + #define SEC_RELOC 0x004 + + /* ELF reserves 4 processor specific bits and 8 operating system + specific bits in sh_flags; at present we can get away with just + one in communicating between the assembler and BFD, but this + isn't a good long-term solution. */ + #define SEC_ARCH_BIT_0 0x008 + + /* A signal to the OS that the section contains read only data. */ + #define SEC_READONLY 0x010 + + /* The section contains code only. */ + #define SEC_CODE 0x020 + + /* The section contains data only. */ + #define SEC_DATA 0x040 + + /* The section will reside in ROM. */ + #define SEC_ROM 0x080 + + /* The section contains constructor information. This section + type is used by the linker to create lists of constructors and + destructors used by `g++'. When a back end sees a symbol + which should be used in a constructor list, it creates a new + section for the type of name (e.g., `__CTOR_LIST__'), attaches + the symbol to it, and builds a relocation. To build the lists + of constructors, all the linker has to do is catenate all the + sections called `__CTOR_LIST__' and relocate the data + contained within - exactly the operations it would peform on + standard data. */ + #define SEC_CONSTRUCTOR 0x100 + + /* The section has contents - a data section could be + `SEC_ALLOC' | `SEC_HAS_CONTENTS'; a debug section could be + `SEC_HAS_CONTENTS' */ + #define SEC_HAS_CONTENTS 0x200 + + /* An instruction to the linker to not output the section + even if it has information which would normally be written. */ + #define SEC_NEVER_LOAD 0x400 + + /* The section is a COFF shared library section. This flag is + only for the linker. If this type of section appears in + the input file, the linker must copy it to the output file + without changing the vma or size. FIXME: Although this + was originally intended to be general, it really is COFF + specific (and the flag was renamed to indicate this). It + might be cleaner to have some more general mechanism to + allow the back end to control what the linker does with + sections. */ + #define SEC_COFF_SHARED_LIBRARY 0x800 + + /* The section contains thread local data. */ + #define SEC_THREAD_LOCAL 0x1000 + + /* The section has GOT references. This flag is only for the + linker, and is currently only used by the elf32-hppa back end. + It will be set if global offset table references were detected + in this section, which indicate to the linker that the section + contains PIC code, and must be handled specially when doing a + static link. */ + #define SEC_HAS_GOT_REF 0x4000 + + /* The section contains common symbols (symbols may be defined + multiple times, the value of a symbol is the amount of + space it requires, and the largest symbol value is the one + used). Most targets have exactly one of these (which we + translate to bfd_com_section_ptr), but ECOFF has two. */ + #define SEC_IS_COMMON 0x8000 + + /* The section contains only debugging information. For + example, this is set for ELF .debug and .stab sections. + strip tests this flag to see if a section can be + discarded. */ + #define SEC_DEBUGGING 0x10000 + + /* The contents of this section are held in memory pointed to + by the contents field. This is checked by bfd_get_section_contents, + and the data is retrieved from memory if appropriate. */ + #define SEC_IN_MEMORY 0x20000 + + /* The contents of this section are to be excluded by the + linker for executable and shared objects unless those + objects are to be further relocated. */ + #define SEC_EXCLUDE 0x40000 + + /* The contents of this section are to be sorted based on the sum of + the symbol and addend values specified by the associated relocation + entries. Entries without associated relocation entries will be + appended to the end of the section in an unspecified order. */ + #define SEC_SORT_ENTRIES 0x80000 + + /* When linking, duplicate sections of the same name should be + discarded, rather than being combined into a single section as + is usually done. This is similar to how common symbols are + handled. See SEC_LINK_DUPLICATES below. */ + #define SEC_LINK_ONCE 0x100000 + + /* If SEC_LINK_ONCE is set, this bitfield describes how the linker + should handle duplicate sections. */ + #define SEC_LINK_DUPLICATES 0x600000 + + /* This value for SEC_LINK_DUPLICATES means that duplicate + sections with the same name should simply be discarded. */ + #define SEC_LINK_DUPLICATES_DISCARD 0x0 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if there are any duplicate sections, although + it should still only link one copy. */ + #define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections are a different size. */ + #define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections contain different + contents. */ + #define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000 + + /* This section was created by the linker as part of dynamic + relocation or other arcane processing. It is skipped when + going through the first-pass output, trusting that someone + else up the line will take care of it later. */ + #define SEC_LINKER_CREATED 0x800000 + + /* This section should not be subject to garbage collection. */ + #define SEC_KEEP 0x1000000 + + /* This section contains "short" data, and should be placed + "near" the GP. */ + #define SEC_SMALL_DATA 0x2000000 + + /* This section contains data which may be shared with other + executables or shared objects. */ + #define SEC_SHARED 0x4000000 + + /* When a section with this flag is being linked, then if the size of + the input section is less than a page, it should not cross a page + boundary. If the size of the input section is one page or more, it + should be aligned on a page boundary. */ + #define SEC_BLOCK 0x8000000 + + /* Conditionally link this section; do not link if there are no + references found to any symbol in the section. */ + #define SEC_CLINK 0x10000000 + + /* Attempt to merge identical entities in the section. + Entity size is given in the entsize field. */ + #define SEC_MERGE 0x20000000 + + /* If given with SEC_MERGE, entities to merge are zero terminated + strings where entsize specifies character size instead of fixed + size entries. */ + #define SEC_STRINGS 0x40000000 + + /* This section contains data about section groups. */ + #define SEC_GROUP 0x80000000 + + /* End of section flags. */ + + /* Some internal packed boolean fields. */ + + /* See the vma field. */ + unsigned int user_set_vma : 1; + + /* Whether relocations have been processed. */ + unsigned int reloc_done : 1; + + /* A mark flag used by some of the linker backends. */ + unsigned int linker_mark : 1; + + /* Another mark flag used by some of the linker backends. Set for + output sections that have an input section. */ + unsigned int linker_has_input : 1; + + /* A mark flag used by some linker backends for garbage collection. */ + unsigned int gc_mark : 1; + + /* The following flags are used by the ELF linker. */ + + /* Mark sections which have been allocated to segments. */ + unsigned int segment_mark : 1; + + /* Type of sec_info information. */ + unsigned int sec_info_type:3; + #define ELF_INFO_TYPE_NONE 0 + #define ELF_INFO_TYPE_STABS 1 + #define ELF_INFO_TYPE_MERGE 2 + #define ELF_INFO_TYPE_EH_FRAME 3 + #define ELF_INFO_TYPE_JUST_SYMS 4 + + /* Nonzero if this section uses RELA relocations, rather than REL. */ + unsigned int use_rela_p:1; + + /* Bits used by various backends. */ + unsigned int has_tls_reloc:1; + + /* Nonzero if this section needs the relax finalize pass. */ + unsigned int need_finalize_relax:1; + + /* Nonzero if this section has a gp reloc. */ + unsigned int has_gp_reloc:1; + + /* Unused bits. */ + unsigned int flag13:1; + unsigned int flag14:1; + unsigned int flag15:1; + unsigned int flag16:4; + unsigned int flag20:4; + unsigned int flag24:8; + + /* End of internal packed boolean fields. */ + + /* The virtual memory address of the section - where it will be + at run time. The symbols are relocated against this. The + user_set_vma flag is maintained by bfd; if it's not set, the + backend can assign addresses (for example, in `a.out', where + the default address for `.data' is dependent on the specific + target and various flags). */ + bfd_vma vma; + + /* The load address of the section - where it would be in a + rom image; really only used for writing section header + information. */ + bfd_vma lma; + + /* The size of the section in octets, as it will be output. + Contains a value even if the section has no contents (e.g., the + size of `.bss'). This will be filled in after relocation. */ + bfd_size_type _cooked_size; + + /* The original size on disk of the section, in octets. Normally this + value is the same as the size, but if some relaxing has + been done, then this value will be bigger. */ + bfd_size_type _raw_size; + + /* If this section is going to be output, then this value is the + offset in *bytes* into the output section of the first byte in the + input section (byte ==> smallest addressable unit on the + target). In most cases, if this was going to start at the + 100th octet (8-bit quantity) in the output section, this value + would be 100. However, if the target byte size is 16 bits + (bfd_octets_per_byte is "2"), this value would be 50. */ + bfd_vma output_offset; + + /* The output section through which to map on output. */ + struct bfd_section *output_section; + + /* The alignment requirement of the section, as an exponent of 2 - + e.g., 3 aligns to 2^3 (or 8). */ + unsigned int alignment_power; + + /* If an input section, a pointer to a vector of relocation + records for the data in this section. */ + struct reloc_cache_entry *relocation; + + /* If an output section, a pointer to a vector of pointers to + relocation records for the data in this section. */ + struct reloc_cache_entry **orelocation; + + /* The number of relocation records in one of the above. */ + unsigned reloc_count; + + /* Information below is back end specific - and not always used + or updated. */ + + /* File position of section data. */ + file_ptr filepos; + + /* File position of relocation info. */ + file_ptr rel_filepos; + + /* File position of line data. */ + file_ptr line_filepos; + + /* Pointer to data for applications. */ + void *userdata; + + /* If the SEC_IN_MEMORY flag is set, this points to the actual + contents. */ + unsigned char *contents; + + /* Attached line number information. */ + alent *lineno; + + /* Number of line number records. */ + unsigned int lineno_count; + + /* Entity size for merging purposes. */ + unsigned int entsize; + + /* Optional information about a COMDAT entry; NULL if not COMDAT. */ + struct bfd_comdat_info *comdat; + + /* Points to the kept section if this section is a link-once section, + and is discarded. */ + struct bfd_section *kept_section; + + /* When a section is being output, this value changes as more + linenumbers are written out. */ + file_ptr moving_line_filepos; + + /* What the section number is in the target world. */ + int target_index; + + void *used_by_bfd; + + /* If this is a constructor section then here is a list of the + relocations created to relocate items within it. */ + struct relent_chain *constructor_chain; + + /* The BFD which owns the section. */ + bfd *owner; + + /* A symbol which points at this section only. */ + struct bfd_symbol *symbol; + struct bfd_symbol **symbol_ptr_ptr; + + struct bfd_link_order *link_order_head; + struct bfd_link_order *link_order_tail; + } asection; + + /* These sections are global, and are managed by BFD. The application + and target back end are not permitted to change the values in + these sections. New code should use the section_ptr macros rather + than referring directly to the const sections. The const sections + may eventually vanish. */ + #define BFD_ABS_SECTION_NAME "*ABS*" + #define BFD_UND_SECTION_NAME "*UND*" + #define BFD_COM_SECTION_NAME "*COM*" + #define BFD_IND_SECTION_NAME "*IND*" + + /* The absolute section. */ + extern asection bfd_abs_section; + #define bfd_abs_section_ptr ((asection *) &bfd_abs_section) + #define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr) + /* Pointer to the undefined section. */ + extern asection bfd_und_section; + #define bfd_und_section_ptr ((asection *) &bfd_und_section) + #define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr) + /* Pointer to the common section. */ + extern asection bfd_com_section; + #define bfd_com_section_ptr ((asection *) &bfd_com_section) + /* Pointer to the indirect section. */ + extern asection bfd_ind_section; + #define bfd_ind_section_ptr ((asection *) &bfd_ind_section) + #define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr) + + #define bfd_is_const_section(SEC) \ + ( ((SEC) == bfd_abs_section_ptr) \ + || ((SEC) == bfd_und_section_ptr) \ + || ((SEC) == bfd_com_section_ptr) \ + || ((SEC) == bfd_ind_section_ptr)) + + extern const struct bfd_symbol * const bfd_abs_symbol; + extern const struct bfd_symbol * const bfd_com_symbol; + extern const struct bfd_symbol * const bfd_und_symbol; + extern const struct bfd_symbol * const bfd_ind_symbol; + #define bfd_get_section_size_before_reloc(section) \ + ((section)->_raw_size) + #define bfd_get_section_size_after_reloc(section) \ + ((section)->reloc_done ? (section)->_cooked_size \ + : (abort (), (bfd_size_type) 1)) + + /* Macros to handle insertion and deletion of a bfd's sections. These + only handle the list pointers, ie. do not adjust section_count, + target_index etc. */ + #define bfd_section_list_remove(ABFD, PS) \ + do \ + { \ + asection **_ps = PS; \ + asection *_s = *_ps; \ + *_ps = _s->next; \ + if (_s->next == NULL) \ + (ABFD)->section_tail = _ps; \ + } \ + while (0) + #define bfd_section_list_insert(ABFD, PS, S) \ + do \ + { \ + asection **_ps = PS; \ + asection *_s = S; \ + _s->next = *_ps; \ + *_ps = _s; \ + if (_s->next == NULL) \ + (ABFD)->section_tail = &_s->next; \ + } \ + while (0) + + +File: bfd.info, Node: section prototypes, Prev: typedef asection, Up: Sections + +Section prototypes +------------------ + +These are the functions exported by the section handling part of BFD. + +`bfd_section_list_clear' +........................ + +*Synopsis* + void bfd_section_list_clear (bfd *); + *Description* +Clears the section list, and also resets the section count and hash +table entries. + +`bfd_get_section_by_name' +......................... + +*Synopsis* + asection *bfd_get_section_by_name (bfd *abfd, const char *name); + *Description* +Run through ABFD and return the one of the `asection's whose name +matches NAME, otherwise `NULL'. *Note Sections::, for more information. + + This should only be used in special cases; the normal way to process +all sections of a given name is to use `bfd_map_over_sections' and +`strcmp' on the name (or better yet, base it on the section flags or +something else) for each section. + +`bfd_get_unique_section_name' +............................. + +*Synopsis* + char *bfd_get_unique_section_name + (bfd *abfd, const char *templat, int *count); + *Description* +Invent a section name that is unique in ABFD by tacking a dot and a +digit suffix onto the original TEMPLAT. If COUNT is non-NULL, then it +specifies the first number tried as a suffix to generate a unique name. +The value pointed to by COUNT will be incremented in this case. + +`bfd_make_section_old_way' +.......................... + +*Synopsis* + asection *bfd_make_section_old_way (bfd *abfd, const char *name); + *Description* +Create a new empty section called NAME and attach it to the end of the +chain of sections for the BFD ABFD. An attempt to create a section with +a name which is already in use returns its pointer without changing the +section chain. + + It has the funny name since this is the way it used to be before it +was rewritten.... + + Possible errors are: + * `bfd_error_invalid_operation' - If output has already started for + this BFD. + + * `bfd_error_no_memory' - If memory allocation fails. + +`bfd_make_section_anyway' +......................... + +*Synopsis* + asection *bfd_make_section_anyway (bfd *abfd, const char *name); + *Description* +Create a new empty section called NAME and attach it to the end of the +chain of sections for ABFD. Create a new section even if there is +already a section with that name. + + Return `NULL' and set `bfd_error' on error; possible errors are: + * `bfd_error_invalid_operation' - If output has already started for + ABFD. + + * `bfd_error_no_memory' - If memory allocation fails. + +`bfd_make_section' +.................. + +*Synopsis* + asection *bfd_make_section (bfd *, const char *name); + *Description* +Like `bfd_make_section_anyway', but return `NULL' (without calling +bfd_set_error ()) without changing the section chain if there is +already a section named NAME. If there is an error, return `NULL' and +set `bfd_error'. + +`bfd_set_section_flags' +....................... + +*Synopsis* + bfd_boolean bfd_set_section_flags + (bfd *abfd, asection *sec, flagword flags); + *Description* +Set the attributes of the section SEC in the BFD ABFD to the value +FLAGS. Return `TRUE' on success, `FALSE' on error. Possible error +returns are: + + * `bfd_error_invalid_operation' - The section cannot have one or + more of the attributes requested. For example, a .bss section in + `a.out' may not have the `SEC_HAS_CONTENTS' field set. + +`bfd_map_over_sections' +....................... + +*Synopsis* + void bfd_map_over_sections + (bfd *abfd, + void (*func) (bfd *abfd, asection *sect, void *obj), + void *obj); + *Description* +Call the provided function FUNC for each section attached to the BFD +ABFD, passing OBJ as an argument. The function will be called as if by + + func (abfd, the_section, obj); + + This is the preferred method for iterating over sections; an +alternative would be to use a loop: + + section *p; + for (p = abfd->sections; p != NULL; p = p->next) + func (abfd, p, ...) + +`bfd_set_section_size' +...................... + +*Synopsis* + bfd_boolean bfd_set_section_size + (bfd *abfd, asection *sec, bfd_size_type val); + *Description* +Set SEC to the size VAL. If the operation is ok, then `TRUE' is +returned, else `FALSE'. + + Possible error returns: + * `bfd_error_invalid_operation' - Writing has started to the BFD, so + setting the size is invalid. + +`bfd_set_section_contents' +.......................... + +*Synopsis* + bfd_boolean bfd_set_section_contents + (bfd *abfd, asection *section, const void *data, + file_ptr offset, bfd_size_type count); + *Description* +Sets the contents of the section SECTION in BFD ABFD to the data +starting in memory at DATA. The data is written to the output section +starting at offset OFFSET for COUNT octets. + + Normally `TRUE' is returned, else `FALSE'. Possible error returns +are: + * `bfd_error_no_contents' - The output section does not have the + `SEC_HAS_CONTENTS' attribute, so nothing can be written to it. + + * and some more too + This routine is front end to the back end function +`_bfd_set_section_contents'. + +`bfd_get_section_contents' +.......................... + +*Synopsis* + bfd_boolean bfd_get_section_contents + (bfd *abfd, asection *section, void *location, file_ptr offset, + bfd_size_type count); + *Description* +Read data from SECTION in BFD ABFD into memory starting at LOCATION. +The data is read at an offset of OFFSET from the start of the input +section, and is read for COUNT bytes. + + If the contents of a constructor with the `SEC_CONSTRUCTOR' flag set +are requested or if the section does not have the `SEC_HAS_CONTENTS' +flag set, then the LOCATION is filled with zeroes. If no errors occur, +`TRUE' is returned, else `FALSE'. + +`bfd_copy_private_section_data' +............................... + +*Synopsis* + bfd_boolean bfd_copy_private_section_data + (bfd *ibfd, asection *isec, bfd *obfd, asection *osec); + *Description* +Copy private section information from ISEC in the BFD IBFD to the +section OSEC in the BFD OBFD. Return `TRUE' on success, `FALSE' on +error. Possible error returns are: + + * `bfd_error_no_memory' - Not enough memory exists to create private + data for OSEC. + + #define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ + BFD_SEND (obfd, _bfd_copy_private_section_data, \ + (ibfd, isection, obfd, osection)) + +`_bfd_strip_section_from_output' +................................ + +*Synopsis* + void _bfd_strip_section_from_output + (struct bfd_link_info *info, asection *section); + *Description* +Remove SECTION from the output. If the output section becomes empty, +remove it from the output bfd. + + This function won't actually do anything except twiddle flags if +called too late in the linking process, when it's not safe to remove +sections. + +`bfd_generic_discard_group' +........................... + +*Synopsis* + bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group); + *Description* +Remove all members of GROUP from the output. + + +File: bfd.info, Node: Symbols, Next: Archives, Prev: Sections, Up: BFD front end + +Symbols +======= + +BFD tries to maintain as much symbol information as it can when it +moves information from file to file. BFD passes information to +applications though the `asymbol' structure. When the application +requests the symbol table, BFD reads the table in the native form and +translates parts of it into the internal format. To maintain more than +the information passed to applications, some targets keep some +information "behind the scenes" in a structure only the particular back +end knows about. For example, the coff back end keeps the original +symbol table structure as well as the canonical structure when a BFD is +read in. On output, the coff back end can reconstruct the output symbol +table so that no information is lost, even information unique to coff +which BFD doesn't know or understand. If a coff symbol table were read, +but were written through an a.out back end, all the coff specific +information would be lost. The symbol table of a BFD is not necessarily +read in until a canonicalize request is made. Then the BFD back end +fills in a table provided by the application with pointers to the +canonical information. To output symbols, the application provides BFD +with a table of pointers to pointers to `asymbol's. This allows +applications like the linker to output a symbol as it was read, since +the "behind the scenes" information will be still available. + +* Menu: + +* Reading Symbols:: +* Writing Symbols:: +* Mini Symbols:: +* typedef asymbol:: +* symbol handling functions:: + + +File: bfd.info, Node: Reading Symbols, Next: Writing Symbols, Prev: Symbols, Up: Symbols + +Reading symbols +--------------- + +There are two stages to reading a symbol table from a BFD: allocating +storage, and the actual reading process. This is an excerpt from an +application which reads the symbol table: + + long storage_needed; + asymbol **symbol_table; + long number_of_symbols; + long i; + + storage_needed = bfd_get_symtab_upper_bound (abfd); + + if (storage_needed < 0) + FAIL + + if (storage_needed == 0) + return; + + symbol_table = xmalloc (storage_needed); + ... + number_of_symbols = + bfd_canonicalize_symtab (abfd, symbol_table); + + if (number_of_symbols < 0) + FAIL + + for (i = 0; i < number_of_symbols; i++) + process_symbol (symbol_table[i]); + + All storage for the symbols themselves is in an objalloc connected +to the BFD; it is freed when the BFD is closed. + + +File: bfd.info, Node: Writing Symbols, Next: Mini Symbols, Prev: Reading Symbols, Up: Symbols + +Writing symbols +--------------- + +Writing of a symbol table is automatic when a BFD open for writing is +closed. The application attaches a vector of pointers to pointers to +symbols to the BFD being written, and fills in the symbol count. The +close and cleanup code reads through the table provided and performs +all the necessary operations. The BFD output code must always be +provided with an "owned" symbol: one which has come from another BFD, +or one which has been created using `bfd_make_empty_symbol'. Here is an +example showing the creation of a symbol table with only one element: + + #include "bfd.h" + int main (void) + { + bfd *abfd; + asymbol *ptrs[2]; + asymbol *new; + + abfd = bfd_openw ("foo","a.out-sunos-big"); + bfd_set_format (abfd, bfd_object); + new = bfd_make_empty_symbol (abfd); + new->name = "dummy_symbol"; + new->section = bfd_make_section_old_way (abfd, ".text"); + new->flags = BSF_GLOBAL; + new->value = 0x12345; + + ptrs[0] = new; + ptrs[1] = 0; + + bfd_set_symtab (abfd, ptrs, 1); + bfd_close (abfd); + return 0; + } + + ./makesym + nm foo + 00012345 A dummy_symbol + + Many formats cannot represent arbitrary symbol information; for +instance, the `a.out' object format does not allow an arbitrary number +of sections. A symbol pointing to a section which is not one of +`.text', `.data' or `.bss' cannot be described. + + +File: bfd.info, Node: Mini Symbols, Next: typedef asymbol, Prev: Writing Symbols, Up: Symbols + +Mini Symbols +------------ + +Mini symbols provide read-only access to the symbol table. They use +less memory space, but require more time to access. They can be useful +for tools like nm or objdump, which may have to handle symbol tables of +extremely large executables. + + The `bfd_read_minisymbols' function will read the symbols into +memory in an internal form. It will return a `void *' pointer to a +block of memory, a symbol count, and the size of each symbol. The +pointer is allocated using `malloc', and should be freed by the caller +when it is no longer needed. + + The function `bfd_minisymbol_to_symbol' will take a pointer to a +minisymbol, and a pointer to a structure returned by +`bfd_make_empty_symbol', and return a `asymbol' structure. The return +value may or may not be the same as the value from +`bfd_make_empty_symbol' which was passed in. + + +File: bfd.info, Node: typedef asymbol, Next: symbol handling functions, Prev: Mini Symbols, Up: Symbols + +typedef asymbol +--------------- + +An `asymbol' has the form: + + + typedef struct bfd_symbol + { + /* A pointer to the BFD which owns the symbol. This information + is necessary so that a back end can work out what additional + information (invisible to the application writer) is carried + with the symbol. + + This field is *almost* redundant, since you can use section->owner + instead, except that some symbols point to the global sections + bfd_{abs,com,und}_section. This could be fixed by making + these globals be per-bfd (or per-target-flavor). FIXME. */ + struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */ + + /* The text of the symbol. The name is left alone, and not copied; the + application may not alter it. */ + const char *name; + + /* The value of the symbol. This really should be a union of a + numeric value with a pointer, since some flags indicate that + a pointer to another symbol is stored here. */ + symvalue value; + + /* Attributes of a symbol. */ + #define BSF_NO_FLAGS 0x00 + + /* The symbol has local scope; `static' in `C'. The value + is the offset into the section of the data. */ + #define BSF_LOCAL 0x01 + + /* The symbol has global scope; initialized data in `C'. The + value is the offset into the section of the data. */ + #define BSF_GLOBAL 0x02 + + /* The symbol has global scope and is exported. The value is + the offset into the section of the data. */ + #define BSF_EXPORT BSF_GLOBAL /* No real difference. */ + + /* A normal C symbol would be one of: + `BSF_LOCAL', `BSF_FORT_COMM', `BSF_UNDEFINED' or + `BSF_GLOBAL'. */ + + /* The symbol is a debugging record. The value has an arbitrary + meaning, unless BSF_DEBUGGING_RELOC is also set. */ + #define BSF_DEBUGGING 0x08 + + /* The symbol denotes a function entry point. Used in ELF, + perhaps others someday. */ + #define BSF_FUNCTION 0x10 + + /* Used by the linker. */ + #define BSF_KEEP 0x20 + #define BSF_KEEP_G 0x40 + + /* A weak global symbol, overridable without warnings by + a regular global symbol of the same name. */ + #define BSF_WEAK 0x80 + + /* This symbol was created to point to a section, e.g. ELF's + STT_SECTION symbols. */ + #define BSF_SECTION_SYM 0x100 + + /* The symbol used to be a common symbol, but now it is + allocated. */ + #define BSF_OLD_COMMON 0x200 + + /* The default value for common data. */ + #define BFD_FORT_COMM_DEFAULT_VALUE 0 + + /* In some files the type of a symbol sometimes alters its + location in an output file - ie in coff a `ISFCN' symbol + which is also `C_EXT' symbol appears where it was + declared and not at the end of a section. This bit is set + by the target BFD part to convey this information. */ + #define BSF_NOT_AT_END 0x400 + + /* Signal that the symbol is the label of constructor section. */ + #define BSF_CONSTRUCTOR 0x800 + + /* Signal that the symbol is a warning symbol. The name is a + warning. The name of the next symbol is the one to warn about; + if a reference is made to a symbol with the same name as the next + symbol, a warning is issued by the linker. */ + #define BSF_WARNING 0x1000 + + /* Signal that the symbol is indirect. This symbol is an indirect + pointer to the symbol with the same name as the next symbol. */ + #define BSF_INDIRECT 0x2000 + + /* BSF_FILE marks symbols that contain a file name. This is used + for ELF STT_FILE symbols. */ + #define BSF_FILE 0x4000 + + /* Symbol is from dynamic linking information. */ + #define BSF_DYNAMIC 0x8000 + + /* The symbol denotes a data object. Used in ELF, and perhaps + others someday. */ + #define BSF_OBJECT 0x10000 + + /* This symbol is a debugging symbol. The value is the offset + into the section of the data. BSF_DEBUGGING should be set + as well. */ + #define BSF_DEBUGGING_RELOC 0x20000 + + /* This symbol is thread local. Used in ELF. */ + #define BSF_THREAD_LOCAL 0x40000 + + flagword flags; + + /* A pointer to the section to which this symbol is + relative. This will always be non NULL, there are special + sections for undefined and absolute symbols. */ + struct bfd_section *section; + + /* Back end special data. */ + union + { + void *p; + bfd_vma i; + } + udata; + } + asymbol; + + +File: bfd.info, Node: symbol handling functions, Prev: typedef asymbol, Up: Symbols + +Symbol handling functions +------------------------- + +`bfd_get_symtab_upper_bound' +............................ + +*Description* +Return the number of bytes required to store a vector of pointers to +`asymbols' for all the symbols in the BFD ABFD, including a terminal +NULL pointer. If there are no symbols in the BFD, then return 0. If an +error occurs, return -1. + #define bfd_get_symtab_upper_bound(abfd) \ + BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd)) + +`bfd_is_local_label' +.................... + +*Synopsis* + bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym); + *Description* +Return TRUE if the given symbol SYM in the BFD ABFD is a compiler +generated local label, else return FALSE. + +`bfd_is_local_label_name' +......................... + +*Synopsis* + bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name); + *Description* +Return TRUE if a symbol with the name NAME in the BFD ABFD is a +compiler generated local label, else return FALSE. This just checks +whether the name has the form of a local label. + #define bfd_is_local_label_name(abfd, name) \ + BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) + +`bfd_canonicalize_symtab' +......................... + +*Description* +Read the symbols from the BFD ABFD, and fills in the vector LOCATION +with pointers to the symbols and a trailing NULL. Return the actual +number of symbol pointers, not including the NULL. + #define bfd_canonicalize_symtab(abfd, location) \ + BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location)) + +`bfd_set_symtab' +................ + +*Synopsis* + bfd_boolean bfd_set_symtab + (bfd *abfd, asymbol **location, unsigned int count); + *Description* +Arrange that when the output BFD ABFD is closed, the table LOCATION of +COUNT pointers to symbols will be written. + +`bfd_print_symbol_vandf' +........................ + +*Synopsis* + void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol); + *Description* +Print the value and flags of the SYMBOL supplied to the stream FILE. + +`bfd_make_empty_symbol' +....................... + +*Description* +Create a new `asymbol' structure for the BFD ABFD and return a pointer +to it. + + This routine is necessary because each back end has private +information surrounding the `asymbol'. Building your own `asymbol' and +pointing to it will not create the private information, and will cause +problems later on. + #define bfd_make_empty_symbol(abfd) \ + BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) + +`_bfd_generic_make_empty_symbol' +................................ + +*Synopsis* + asymbol *_bfd_generic_make_empty_symbol (bfd *); + *Description* +Create a new `asymbol' structure for the BFD ABFD and return a pointer +to it. Used by core file routines, binary back-end and anywhere else +where no private info is needed. + +`bfd_make_debug_symbol' +....................... + +*Description* +Create a new `asymbol' structure for the BFD ABFD, to be used as a +debugging symbol. Further details of its use have yet to be worked out. + #define bfd_make_debug_symbol(abfd,ptr,size) \ + BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) + +`bfd_decode_symclass' +..................... + +*Description* +Return a character corresponding to the symbol class of SYMBOL, or '?' +for an unknown class. + + *Synopsis* + int bfd_decode_symclass (asymbol *symbol); + +`bfd_is_undefined_symclass' +........................... + +*Description* +Returns non-zero if the class symbol returned by bfd_decode_symclass +represents an undefined symbol. Returns zero otherwise. + + *Synopsis* + bfd_boolean bfd_is_undefined_symclass (int symclass); + +`bfd_symbol_info' +................. + +*Description* +Fill in the basic info about symbol that nm needs. Additional info may +be added by the back-ends after calling this function. + + *Synopsis* + void bfd_symbol_info (asymbol *symbol, symbol_info *ret); + +`bfd_copy_private_symbol_data' +.............................. + +*Synopsis* + bfd_boolean bfd_copy_private_symbol_data + (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym); + *Description* +Copy private symbol information from ISYM in the BFD IBFD to the symbol +OSYM in the BFD OBFD. Return `TRUE' on success, `FALSE' on error. +Possible error returns are: + + * `bfd_error_no_memory' - Not enough memory exists to create private + data for OSEC. + + #define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \ + BFD_SEND (obfd, _bfd_copy_private_symbol_data, \ + (ibfd, isymbol, obfd, osymbol)) + + +File: bfd.info, Node: Archives, Next: Formats, Prev: Symbols, Up: BFD front end + +Archives +======== + +*Description* +An archive (or library) is just another BFD. It has a symbol table, +although there's not much a user program will do with it. + + The big difference between an archive BFD and an ordinary BFD is +that the archive doesn't have sections. Instead it has a chain of BFDs +that are considered its contents. These BFDs can be manipulated like +any other. The BFDs contained in an archive opened for reading will +all be opened for reading. You may put either input or output BFDs +into an archive opened for output; they will be handled correctly when +the archive is closed. + + Use `bfd_openr_next_archived_file' to step through the contents of +an archive opened for input. You don't have to read the entire archive +if you don't want to! Read it until you find what you want. + + Archive contents of output BFDs are chained through the `next' +pointer in a BFD. The first one is findable through the `archive_head' +slot of the archive. Set it with `bfd_set_archive_head' (q.v.). A +given BFD may be in only one open output archive at a time. + + As expected, the BFD archive code is more general than the archive +code of any given environment. BFD archives may contain files of +different formats (e.g., a.out and coff) and even different +architectures. You may even place archives recursively into archives! + + This can cause unexpected confusion, since some archive formats are +more expressive than others. For instance, Intel COFF archives can +preserve long filenames; SunOS a.out archives cannot. If you move a +file from the first to the second format and back again, the filename +may be truncated. Likewise, different a.out environments have different +conventions as to how they truncate filenames, whether they preserve +directory names in filenames, etc. When interoperating with native +tools, be sure your files are homogeneous. + + Beware: most of these formats do not react well to the presence of +spaces in filenames. We do the best we can, but can't always handle +this case due to restrictions in the format of archives. Many Unix +utilities are braindead in regards to spaces and such in filenames +anyway, so this shouldn't be much of a restriction. + + Archives are supported in BFD in `archive.c'. + +`bfd_get_next_mapent' +..................... + +*Synopsis* + symindex bfd_get_next_mapent + (bfd *abfd, symindex previous, carsym **sym); + *Description* +Step through archive ABFD's symbol table (if it has one). Successively +update SYM with the next symbol's information, returning that symbol's +(internal) index into the symbol table. + + Supply `BFD_NO_MORE_SYMBOLS' as the PREVIOUS entry to get the first +one; returns `BFD_NO_MORE_SYMBOLS' when you've already got the last one. + + A `carsym' is a canonical archive symbol. The only user-visible +element is its name, a null-terminated string. + +`bfd_set_archive_head' +...................... + +*Synopsis* + bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head); + *Description* +Set the head of the chain of BFDs contained in the archive OUTPUT to +NEW_HEAD. + +`bfd_openr_next_archived_file' +.............................. + +*Synopsis* + bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous); + *Description* +Provided a BFD, ARCHIVE, containing an archive and NULL, open an input +BFD on the first contained element and returns that. Subsequent calls +should pass the archive and the previous return value to return a +created BFD to the next contained element. NULL is returned when there +are no more. + + +File: bfd.info, Node: Formats, Next: Relocations, Prev: Archives, Up: BFD front end + +File formats +============ + +A format is a BFD concept of high level file contents type. The formats +supported by BFD are: + + * `bfd_object' + The BFD may contain data, symbols, relocations and debug info. + + * `bfd_archive' + The BFD contains other BFDs and an optional index. + + * `bfd_core' + The BFD contains the result of an executable core dump. + +`bfd_check_format' +.................. + +*Synopsis* + bfd_boolean bfd_check_format (bfd *abfd, bfd_format format); + *Description* +Verify if the file attached to the BFD ABFD is compatible with the +format FORMAT (i.e., one of `bfd_object', `bfd_archive' or `bfd_core'). + + If the BFD has been set to a specific target before the call, only +the named target and format combination is checked. If the target has +not been set, or has been set to `default', then all the known target +backends is interrogated to determine a match. If the default target +matches, it is used. If not, exactly one target must recognize the +file, or an error results. + + The function returns `TRUE' on success, otherwise `FALSE' with one +of the following error codes: + + * `bfd_error_invalid_operation' - if `format' is not one of + `bfd_object', `bfd_archive' or `bfd_core'. + + * `bfd_error_system_call' - if an error occured during a read - even + some file mismatches can cause bfd_error_system_calls. + + * `file_not_recognised' - none of the backends recognised the file + format. + + * `bfd_error_file_ambiguously_recognized' - more than one backend + recognised the file format. + +`bfd_check_format_matches' +.......................... + +*Synopsis* + bfd_boolean bfd_check_format_matches + (bfd *abfd, bfd_format format, char ***matching); + *Description* +Like `bfd_check_format', except when it returns FALSE with `bfd_errno' +set to `bfd_error_file_ambiguously_recognized'. In that case, if +MATCHING is not NULL, it will be filled in with a NULL-terminated list +of the names of the formats that matched, allocated with `malloc'. +Then the user may choose a format and try again. + + When done with the list that MATCHING points to, the caller should +free it. + +`bfd_set_format' +................ + +*Synopsis* + bfd_boolean bfd_set_format (bfd *abfd, bfd_format format); + *Description* +This function sets the file format of the BFD ABFD to the format +FORMAT. If the target set in the BFD does not support the format +requested, the format is invalid, or the BFD is not open for writing, +then an error occurs. + +`bfd_format_string' +................... + +*Synopsis* + const char *bfd_format_string (bfd_format format); + *Description* +Return a pointer to a const string `invalid', `object', `archive', +`core', or `unknown', depending upon the value of FORMAT. + + +File: bfd.info, Node: Relocations, Next: Core Files, Prev: Formats, Up: BFD front end + +Relocations +=========== + +BFD maintains relocations in much the same way it maintains symbols: +they are left alone until required, then read in en-masse and +translated into an internal form. A common routine +`bfd_perform_relocation' acts upon the canonical form to do the fixup. + + Relocations are maintained on a per section basis, while symbols are +maintained on a per BFD basis. + + All that a back end has to do to fit the BFD interface is to create +a `struct reloc_cache_entry' for each relocation in a particular +section, and fill in the right bits of the structures. + +* Menu: + +* typedef arelent:: +* howto manager:: + + +File: bfd.info, Node: typedef arelent, Next: howto manager, Prev: Relocations, Up: Relocations + +typedef arelent +--------------- + +This is the structure of a relocation entry: + + + typedef enum bfd_reloc_status + { + /* No errors detected. */ + bfd_reloc_ok, + + /* The relocation was performed, but there was an overflow. */ + bfd_reloc_overflow, + + /* The address to relocate was not within the section supplied. */ + bfd_reloc_outofrange, + + /* Used by special functions. */ + bfd_reloc_continue, + + /* Unsupported relocation size requested. */ + bfd_reloc_notsupported, + + /* Unused. */ + bfd_reloc_other, + + /* The symbol to relocate against was undefined. */ + bfd_reloc_undefined, + + /* The relocation was performed, but may not be ok - presently + generated only when linking i960 coff files with i960 b.out + symbols. If this type is returned, the error_message argument + to bfd_perform_relocation will be set. */ + bfd_reloc_dangerous + } + bfd_reloc_status_type; + + + typedef struct reloc_cache_entry + { + /* A pointer into the canonical table of pointers. */ + struct bfd_symbol **sym_ptr_ptr; + + /* offset in section. */ + bfd_size_type address; + + /* addend for relocation value. */ + bfd_vma addend; + + /* Pointer to how to perform the required relocation. */ + reloc_howto_type *howto; + + } + arelent; + *Description* +Here is a description of each of the fields within an `arelent': + + * `sym_ptr_ptr' + The symbol table pointer points to a pointer to the symbol +associated with the relocation request. It is the pointer into the +table returned by the back end's `canonicalize_symtab' action. *Note +Symbols::. The symbol is referenced through a pointer to a pointer so +that tools like the linker can fix up all the symbols of the same name +by modifying only one pointer. The relocation routine looks in the +symbol and uses the base of the section the symbol is attached to and +the value of the symbol as the initial relocation offset. If the symbol +pointer is zero, then the section provided is looked up. + + * `address' + The `address' field gives the offset in bytes from the base of the +section data which owns the relocation record to the first byte of +relocatable information. The actual data relocated will be relative to +this point; for example, a relocation type which modifies the bottom +two bytes of a four byte word would not touch the first byte pointed to +in a big endian world. + + * `addend' + The `addend' is a value provided by the back end to be added (!) to +the relocation offset. Its interpretation is dependent upon the howto. +For example, on the 68k the code: + + char foo[]; + main() + { + return foo[0x12345678]; + } + + Could be compiled into: + + linkw fp,#-4 + moveb @#12345678,d0 + extbl d0 + unlk fp + rts + + This could create a reloc pointing to `foo', but leave the offset in +the data, something like: + + RELOCATION RECORDS FOR [.text]: + offset type value + 00000006 32 _foo + + 00000000 4e56 fffc ; linkw fp,#-4 + 00000004 1039 1234 5678 ; moveb @#12345678,d0 + 0000000a 49c0 ; extbl d0 + 0000000c 4e5e ; unlk fp + 0000000e 4e75 ; rts + + Using coff and an 88k, some instructions don't have enough space in +them to represent the full address range, and pointers have to be +loaded in two parts. So you'd get something like: + + or.u r13,r0,hi16(_foo+0x12345678) + ld.b r2,r13,lo16(_foo+0x12345678) + jmp r1 + + This should create two relocs, both pointing to `_foo', and with +0x12340000 in their addend field. The data would consist of: + + RELOCATION RECORDS FOR [.text]: + offset type value + 00000002 HVRT16 _foo+0x12340000 + 00000006 LVRT16 _foo+0x12340000 + + 00000000 5da05678 ; or.u r13,r0,0x5678 + 00000004 1c4d5678 ; ld.b r2,r13,0x5678 + 00000008 f400c001 ; jmp r1 + + The relocation routine digs out the value from the data, adds it to +the addend to get the original offset, and then adds the value of +`_foo'. Note that all 32 bits have to be kept around somewhere, to cope +with carry from bit 15 to bit 16. + + One further example is the sparc and the a.out format. The sparc has +a similar problem to the 88k, in that some instructions don't have room +for an entire offset, but on the sparc the parts are created in odd +sized lumps. The designers of the a.out format chose to not use the +data within the section for storing part of the offset; all the offset +is kept within the reloc. Anything in the data should be ignored. + + save %sp,-112,%sp + sethi %hi(_foo+0x12345678),%g2 + ldsb [%g2+%lo(_foo+0x12345678)],%i0 + ret + restore + + Both relocs contain a pointer to `foo', and the offsets contain junk. + + RELOCATION RECORDS FOR [.text]: + offset type value + 00000004 HI22 _foo+0x12345678 + 00000008 LO10 _foo+0x12345678 + + 00000000 9de3bf90 ; save %sp,-112,%sp + 00000004 05000000 ; sethi %hi(_foo+0),%g2 + 00000008 f048a000 ; ldsb [%g2+%lo(_foo+0)],%i0 + 0000000c 81c7e008 ; ret + 00000010 81e80000 ; restore + + * `howto' + The `howto' field can be imagined as a relocation instruction. It is +a pointer to a structure which contains information on what to do with +all of the other information in the reloc record and data section. A +back end would normally have a relocation instruction set and turn +relocations into pointers to the correct structure on input - but it +would be possible to create each howto field on demand. + +`enum complain_overflow' +........................ + +Indicates what sort of overflow checking should be done when performing +a relocation. + + + enum complain_overflow + { + /* Do not complain on overflow. */ + complain_overflow_dont, + + /* Complain if the bitfield overflows, whether it is considered + as signed or unsigned. */ + complain_overflow_bitfield, + + /* Complain if the value overflows when considered as signed + number. */ + complain_overflow_signed, + + /* Complain if the value overflows when considered as an + unsigned number. */ + complain_overflow_unsigned + }; + +`reloc_howto_type' +.................. + +The `reloc_howto_type' is a structure which contains all the +information that libbfd needs to know to tie up a back end's data. + + struct bfd_symbol; /* Forward declaration. */ + + struct reloc_howto_struct + { + /* The type field has mainly a documentary use - the back end can + do what it wants with it, though normally the back end's + external idea of what a reloc number is stored + in this field. For example, a PC relative word relocation + in a coff environment has the type 023 - because that's + what the outside world calls a R_PCRWORD reloc. */ + unsigned int type; + + /* The value the final relocation is shifted right by. This drops + unwanted data from the relocation. */ + unsigned int rightshift; + + /* The size of the item to be relocated. This is *not* a + power-of-two measure. To get the number of bytes operated + on by a type of relocation, use bfd_get_reloc_size. */ + int size; + + /* The number of bits in the item to be relocated. This is used + when doing overflow checking. */ + unsigned int bitsize; + + /* Notes that the relocation is relative to the location in the + data section of the addend. The relocation function will + subtract from the relocation value the address of the location + being relocated. */ + bfd_boolean pc_relative; + + /* The bit position of the reloc value in the destination. + The relocated value is left shifted by this amount. */ + unsigned int bitpos; + + /* What type of overflow error should be checked for when + relocating. */ + enum complain_overflow complain_on_overflow; + + /* If this field is non null, then the supplied function is + called rather than the normal function. This allows really + strange relocation methods to be accommodated (e.g., i960 callj + instructions). */ + bfd_reloc_status_type (*special_function) + (bfd *, arelent *, struct bfd_symbol *, void *, asection *, + bfd *, char **); + + /* The textual name of the relocation type. */ + char *name; + + /* Some formats record a relocation addend in the section contents + rather than with the relocation. For ELF formats this is the + distinction between USE_REL and USE_RELA (though the code checks + for USE_REL == 1/0). The value of this field is TRUE if the + addend is recorded with the section contents; when performing a + partial link (ld -r) the section contents (the data) will be + modified. The value of this field is FALSE if addends are + recorded with the relocation (in arelent.addend); when performing + a partial link the relocation will be modified. + All relocations for all ELF USE_RELA targets should set this field + to FALSE (values of TRUE should be looked on with suspicion). + However, the converse is not true: not all relocations of all ELF + USE_REL targets set this field to TRUE. Why this is so is peculiar + to each particular target. For relocs that aren't used in partial + links (e.g. GOT stuff) it doesn't matter what this is set to. */ + bfd_boolean partial_inplace; + + /* src_mask selects the part of the instruction (or data) to be used + in the relocation sum. If the target relocations don't have an + addend in the reloc, eg. ELF USE_REL, src_mask will normally equal + dst_mask to extract the addend from the section contents. If + relocations do have an addend in the reloc, eg. ELF USE_RELA, this + field should be zero. Non-zero values for ELF USE_RELA targets are + bogus as in those cases the value in the dst_mask part of the + section contents should be treated as garbage. */ + bfd_vma src_mask; + + /* dst_mask selects which parts of the instruction (or data) are + replaced with a relocated value. */ + bfd_vma dst_mask; + + /* When some formats create PC relative instructions, they leave + the value of the pc of the place being relocated in the offset + slot of the instruction, so that a PC relative relocation can + be made just by adding in an ordinary offset (e.g., sun3 a.out). + Some formats leave the displacement part of an instruction + empty (e.g., m88k bcs); this flag signals the fact. */ + bfd_boolean pcrel_offset; + }; + +`The HOWTO Macro' +................. + +*Description* +The HOWTO define is horrible and will go away. + #define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \ + { (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC } + + *Description* +And will be replaced with the totally magic way. But for the moment, we +are compatible, so do it this way. + #define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \ + HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \ + NAME, FALSE, 0, 0, IN) + + *Description* +This is used to fill in an empty howto entry in an array. + #define EMPTY_HOWTO(C) \ + HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \ + NULL, FALSE, 0, 0, FALSE) + + *Description* +Helper routine to turn a symbol into a relocation value. + #define HOWTO_PREPARE(relocation, symbol) \ + { \ + if (symbol != NULL) \ + { \ + if (bfd_is_com_section (symbol->section)) \ + { \ + relocation = 0; \ + } \ + else \ + { \ + relocation = symbol->value; \ + } \ + } \ + } + +`bfd_get_reloc_size' +.................... + +*Synopsis* + unsigned int bfd_get_reloc_size (reloc_howto_type *); + *Description* +For a reloc_howto_type that operates on a fixed number of bytes, this +returns the number of bytes operated on. + +`arelent_chain' +............... + +*Description* +How relocs are tied together in an `asection': + typedef struct relent_chain + { + arelent relent; + struct relent_chain *next; + } + arelent_chain; + +`bfd_check_overflow' +.................... + +*Synopsis* + bfd_reloc_status_type bfd_check_overflow + (enum complain_overflow how, + unsigned int bitsize, + unsigned int rightshift, + unsigned int addrsize, + bfd_vma relocation); + *Description* +Perform overflow checking on RELOCATION which has BITSIZE significant +bits and will be shifted right by RIGHTSHIFT bits, on a machine with +addresses containing ADDRSIZE significant bits. The result is either of +`bfd_reloc_ok' or `bfd_reloc_overflow'. + +`bfd_perform_relocation' +........................ + +*Synopsis* + bfd_reloc_status_type bfd_perform_relocation + (bfd *abfd, + arelent *reloc_entry, + void *data, + asection *input_section, + bfd *output_bfd, + char **error_message); + *Description* +If OUTPUT_BFD is supplied to this function, the generated image will be +relocatable; the relocations are copied to the output file after they +have been changed to reflect the new state of the world. There are two +ways of reflecting the results of partial linkage in an output file: by +modifying the output data in place, and by modifying the relocation +record. Some native formats (e.g., basic a.out and basic coff) have no +way of specifying an addend in the relocation type, so the addend has +to go in the output data. This is no big deal since in these formats +the output data slot will always be big enough for the addend. Complex +reloc types with addends were invented to solve just this problem. The +ERROR_MESSAGE argument is set to an error message if this return +`bfd_reloc_dangerous'. + +`bfd_install_relocation' +........................ + +*Synopsis* + bfd_reloc_status_type bfd_install_relocation + (bfd *abfd, + arelent *reloc_entry, + void *data, bfd_vma data_start, + asection *input_section, + char **error_message); + *Description* +This looks remarkably like `bfd_perform_relocation', except it does not +expect that the section contents have been filled in. I.e., it's +suitable for use when creating, rather than applying a relocation. + + For now, this function should be considered reserved for the +assembler. + + +File: bfd.info, Node: howto manager, Prev: typedef arelent, Up: Relocations + +The howto manager +================= + +When an application wants to create a relocation, but doesn't know what +the target machine might call it, it can find out by using this bit of +code. + +`bfd_reloc_code_type' +..................... + +*Description* +The insides of a reloc code. The idea is that, eventually, there will +be one enumerator for every type of relocation we ever do. Pass one of +these values to `bfd_reloc_type_lookup', and it'll return a howto +pointer. + + This does mean that the application must determine the correct +enumerator value; you can't get a howto pointer from a random set of +attributes. + + Here are the possible values for `enum bfd_reloc_code_real': + + - : BFD_RELOC_64 + - : BFD_RELOC_32 + - : BFD_RELOC_26 + - : BFD_RELOC_24 + - : BFD_RELOC_16 + - : BFD_RELOC_14 + - : BFD_RELOC_8 + Basic absolute relocations of N bits. + + - : BFD_RELOC_64_PCREL + - : BFD_RELOC_32_PCREL + - : BFD_RELOC_24_PCREL + - : BFD_RELOC_16_PCREL + - : BFD_RELOC_12_PCREL + - : BFD_RELOC_8_PCREL + PC-relative relocations. Sometimes these are relative to the + address of the relocation itself; sometimes they are relative to + the start of the section containing the relocation. It depends on + the specific target. + + The 24-bit relocation is used in some Intel 960 configurations. + + - : BFD_RELOC_32_GOT_PCREL + - : BFD_RELOC_16_GOT_PCREL + - : BFD_RELOC_8_GOT_PCREL + - : BFD_RELOC_32_GOTOFF + - : BFD_RELOC_16_GOTOFF + - : BFD_RELOC_LO16_GOTOFF + - : BFD_RELOC_HI16_GOTOFF + - : BFD_RELOC_HI16_S_GOTOFF + - : BFD_RELOC_8_GOTOFF + - : BFD_RELOC_64_PLT_PCREL + - : BFD_RELOC_32_PLT_PCREL + - : BFD_RELOC_24_PLT_PCREL + - : BFD_RELOC_16_PLT_PCREL + - : BFD_RELOC_8_PLT_PCREL + - : BFD_RELOC_64_PLTOFF + - : BFD_RELOC_32_PLTOFF + - : BFD_RELOC_16_PLTOFF + - : BFD_RELOC_LO16_PLTOFF + - : BFD_RELOC_HI16_PLTOFF + - : BFD_RELOC_HI16_S_PLTOFF + - : BFD_RELOC_8_PLTOFF + For ELF. + + - : BFD_RELOC_68K_GLOB_DAT + - : BFD_RELOC_68K_JMP_SLOT + - : BFD_RELOC_68K_RELATIVE + Relocations used by 68K ELF. + + - : BFD_RELOC_32_BASEREL + - : BFD_RELOC_16_BASEREL + - : BFD_RELOC_LO16_BASEREL + - : BFD_RELOC_HI16_BASEREL + - : BFD_RELOC_HI16_S_BASEREL + - : BFD_RELOC_8_BASEREL + - : BFD_RELOC_RVA + Linkage-table relative. + + - : BFD_RELOC_8_FFnn + Absolute 8-bit relocation, but used to form an address like 0xFFnn. + + - : BFD_RELOC_32_PCREL_S2 + - : BFD_RELOC_16_PCREL_S2 + - : BFD_RELOC_23_PCREL_S2 + These PC-relative relocations are stored as word displacements - + i.e., byte displacements shifted right two bits. The 30-bit word + displacement (<<32_PCREL_S2>> - 32 bits, shifted 2) is used on the + SPARC. (SPARC tools generally refer to this as <>.) The + signed 16-bit displacement is used on the MIPS, and the 23-bit + displacement is used on the Alpha. + + - : BFD_RELOC_HI22 + - : BFD_RELOC_LO10 + High 22 bits and low 10 bits of 32-bit value, placed into lower + bits of the target word. These are used on the SPARC. + + - : BFD_RELOC_GPREL16 + - : BFD_RELOC_GPREL32 + For systems that allocate a Global Pointer register, these are + displacements off that register. These relocation types are + handled specially, because the value the register will have is + decided relatively late. + + - : BFD_RELOC_I960_CALLJ + Reloc types used for i960/b.out. + + - : BFD_RELOC_NONE + - : BFD_RELOC_SPARC_WDISP22 + - : BFD_RELOC_SPARC22 + - : BFD_RELOC_SPARC13 + - : BFD_RELOC_SPARC_GOT10 + - : BFD_RELOC_SPARC_GOT13 + - : BFD_RELOC_SPARC_GOT22 + - : BFD_RELOC_SPARC_PC10 + - : BFD_RELOC_SPARC_PC22 + - : BFD_RELOC_SPARC_WPLT30 + - : BFD_RELOC_SPARC_COPY + - : BFD_RELOC_SPARC_GLOB_DAT + - : BFD_RELOC_SPARC_JMP_SLOT + - : BFD_RELOC_SPARC_RELATIVE + - : BFD_RELOC_SPARC_UA16 + - : BFD_RELOC_SPARC_UA32 + - : BFD_RELOC_SPARC_UA64 + SPARC ELF relocations. There is probably some overlap with other + relocation types already defined. + + - : BFD_RELOC_SPARC_BASE13 + - : BFD_RELOC_SPARC_BASE22 + I think these are specific to SPARC a.out (e.g., Sun 4). + + - : BFD_RELOC_SPARC_64 + - : BFD_RELOC_SPARC_10 + - : BFD_RELOC_SPARC_11 + - : BFD_RELOC_SPARC_OLO10 + - : BFD_RELOC_SPARC_HH22 + - : BFD_RELOC_SPARC_HM10 + - : BFD_RELOC_SPARC_LM22 + - : BFD_RELOC_SPARC_PC_HH22 + - : BFD_RELOC_SPARC_PC_HM10 + - : BFD_RELOC_SPARC_PC_LM22 + - : BFD_RELOC_SPARC_WDISP16 + - : BFD_RELOC_SPARC_WDISP19 + - : BFD_RELOC_SPARC_7 + - : BFD_RELOC_SPARC_6 + - : BFD_RELOC_SPARC_5 + - : BFD_RELOC_SPARC_DISP64 + - : BFD_RELOC_SPARC_PLT32 + - : BFD_RELOC_SPARC_PLT64 + - : BFD_RELOC_SPARC_HIX22 + - : BFD_RELOC_SPARC_LOX10 + - : BFD_RELOC_SPARC_H44 + - : BFD_RELOC_SPARC_M44 + - : BFD_RELOC_SPARC_L44 + - : BFD_RELOC_SPARC_REGISTER + SPARC64 relocations + + - : BFD_RELOC_SPARC_REV32 + SPARC little endian relocation + + - : BFD_RELOC_SPARC_TLS_GD_HI22 + - : BFD_RELOC_SPARC_TLS_GD_LO10 + - : BFD_RELOC_SPARC_TLS_GD_ADD + - : BFD_RELOC_SPARC_TLS_GD_CALL + - : BFD_RELOC_SPARC_TLS_LDM_HI22 + - : BFD_RELOC_SPARC_TLS_LDM_LO10 + - : BFD_RELOC_SPARC_TLS_LDM_ADD + - : BFD_RELOC_SPARC_TLS_LDM_CALL + - : BFD_RELOC_SPARC_TLS_LDO_HIX22 + - : BFD_RELOC_SPARC_TLS_LDO_LOX10 + - : BFD_RELOC_SPARC_TLS_LDO_ADD + - : BFD_RELOC_SPARC_TLS_IE_HI22 + - : BFD_RELOC_SPARC_TLS_IE_LO10 + - : BFD_RELOC_SPARC_TLS_IE_LD + - : BFD_RELOC_SPARC_TLS_IE_LDX + - : BFD_RELOC_SPARC_TLS_IE_ADD + - : BFD_RELOC_SPARC_TLS_LE_HIX22 + - : BFD_RELOC_SPARC_TLS_LE_LOX10 + - : BFD_RELOC_SPARC_TLS_DTPMOD32 + - : BFD_RELOC_SPARC_TLS_DTPMOD64 + - : BFD_RELOC_SPARC_TLS_DTPOFF32 + - : BFD_RELOC_SPARC_TLS_DTPOFF64 + - : BFD_RELOC_SPARC_TLS_TPOFF32 + - : BFD_RELOC_SPARC_TLS_TPOFF64 + SPARC TLS relocations + + - : BFD_RELOC_ALPHA_GPDISP_HI16 + Alpha ECOFF and ELF relocations. Some of these treat the symbol or + "addend" in some special way. For GPDISP_HI16 ("gpdisp") + relocations, the symbol is ignored when writing; when reading, it + will be the absolute section symbol. The addend is the + displacement in bytes of the "lda" instruction from the "ldah" + instruction (which is at the address of this reloc). + + - : BFD_RELOC_ALPHA_GPDISP_LO16 + For GPDISP_LO16 ("ignore") relocations, the symbol is handled as + with GPDISP_HI16 relocs. The addend is ignored when writing the + relocations out, and is filled in with the file's GP value on + reading, for convenience. + + - : BFD_RELOC_ALPHA_GPDISP + The ELF GPDISP relocation is exactly the same as the GPDISP_HI16 + relocation except that there is no accompanying GPDISP_LO16 + relocation. + + - : BFD_RELOC_ALPHA_LITERAL + - : BFD_RELOC_ALPHA_ELF_LITERAL + - : BFD_RELOC_ALPHA_LITUSE + The Alpha LITERAL/LITUSE relocs are produced by a symbol reference; + the assembler turns it into a LDQ instruction to load the address + of the symbol, and then fills in a register in the real + instruction. + + The LITERAL reloc, at the LDQ instruction, refers to the .lita + section symbol. The addend is ignored when writing, but is filled + in with the file's GP value on reading, for convenience, as with + the GPDISP_LO16 reloc. + + The ELF_LITERAL reloc is somewhere between 16_GOTOFF and + GPDISP_LO16. It should refer to the symbol to be referenced, as + with 16_GOTOFF, but it generates output not based on the position + within the .got section, but relative to the GP value chosen for + the file during the final link stage. + + The LITUSE reloc, on the instruction using the loaded address, + gives information to the linker that it might be able to use to + optimize away some literal section references. The symbol is + ignored (read as the absolute section symbol), and the "addend" + indicates the type of instruction using the register: 1 - "memory" + fmt insn 2 - byte-manipulation (byte offset reg) 3 - jsr (target + of branch) + + - : BFD_RELOC_ALPHA_HINT + The HINT relocation indicates a value that should be filled into + the "hint" field of a jmp/jsr/ret instruction, for possible branch- + prediction logic which may be provided on some processors. + + - : BFD_RELOC_ALPHA_LINKAGE + The LINKAGE relocation outputs a linkage pair in the object file, + which is filled by the linker. + + - : BFD_RELOC_ALPHA_CODEADDR + The CODEADDR relocation outputs a STO_CA in the object file, which + is filled by the linker. + + - : BFD_RELOC_ALPHA_GPREL_HI16 + - : BFD_RELOC_ALPHA_GPREL_LO16 + The GPREL_HI/LO relocations together form a 32-bit offset from the + GP register. + + - : BFD_RELOC_ALPHA_BRSGP + Like BFD_RELOC_23_PCREL_S2, except that the source and target must + share a common GP, and the target address is adjusted for + STO_ALPHA_STD_GPLOAD. + + - : BFD_RELOC_ALPHA_TLSGD + - : BFD_RELOC_ALPHA_TLSLDM + - : BFD_RELOC_ALPHA_DTPMOD64 + - : BFD_RELOC_ALPHA_GOTDTPREL16 + - : BFD_RELOC_ALPHA_DTPREL64 + - : BFD_RELOC_ALPHA_DTPREL_HI16 + - : BFD_RELOC_ALPHA_DTPREL_LO16 + - : BFD_RELOC_ALPHA_DTPREL16 + - : BFD_RELOC_ALPHA_GOTTPREL16 + - : BFD_RELOC_ALPHA_TPREL64 + - : BFD_RELOC_ALPHA_TPREL_HI16 + - : BFD_RELOC_ALPHA_TPREL_LO16 + - : BFD_RELOC_ALPHA_TPREL16 + Alpha thread-local storage relocations. + + - : BFD_RELOC_MIPS_JMP + Bits 27..2 of the relocation address shifted right 2 bits; simple + reloc otherwise. + + - : BFD_RELOC_MIPS16_JMP + The MIPS16 jump instruction. + + - : BFD_RELOC_MIPS16_GPREL + MIPS16 GP relative reloc. + + - : BFD_RELOC_HI16 + High 16 bits of 32-bit value; simple reloc. + + - : BFD_RELOC_HI16_S + High 16 bits of 32-bit value but the low 16 bits will be sign + extended and added to form the final result. If the low 16 bits + form a negative number, we need to add one to the high value to + compensate for the borrow when the low bits are added. + + - : BFD_RELOC_LO16 + Low 16 bits. + + - : BFD_RELOC_PCREL_HI16_S + Like BFD_RELOC_HI16_S, but PC relative. + + - : BFD_RELOC_PCREL_LO16 + Like BFD_RELOC_LO16, but PC relative. + + - : BFD_RELOC_MIPS_LITERAL + Relocation against a MIPS literal section. + + - : BFD_RELOC_MIPS_GOT16 + - : BFD_RELOC_MIPS_CALL16 + - : BFD_RELOC_MIPS_GOT_HI16 + - : BFD_RELOC_MIPS_GOT_LO16 + - : BFD_RELOC_MIPS_CALL_HI16 + - : BFD_RELOC_MIPS_CALL_LO16 + - : BFD_RELOC_MIPS_SUB + - : BFD_RELOC_MIPS_GOT_PAGE + - : BFD_RELOC_MIPS_GOT_OFST + - : BFD_RELOC_MIPS_GOT_DISP + - : BFD_RELOC_MIPS_SHIFT5 + - : BFD_RELOC_MIPS_SHIFT6 + - : BFD_RELOC_MIPS_INSERT_A + - : BFD_RELOC_MIPS_INSERT_B + - : BFD_RELOC_MIPS_DELETE + - : BFD_RELOC_MIPS_HIGHEST + - : BFD_RELOC_MIPS_HIGHER + - : BFD_RELOC_MIPS_SCN_DISP + - : BFD_RELOC_MIPS_REL16 + - : BFD_RELOC_MIPS_RELGOT + - : BFD_RELOC_MIPS_JALR + MIPS ELF relocations. + + - : BFD_RELOC_FRV_LABEL16 + - : BFD_RELOC_FRV_LABEL24 + - : BFD_RELOC_FRV_LO16 + - : BFD_RELOC_FRV_HI16 + - : BFD_RELOC_FRV_GPREL12 + - : BFD_RELOC_FRV_GPRELU12 + - : BFD_RELOC_FRV_GPREL32 + - : BFD_RELOC_FRV_GPRELHI + - : BFD_RELOC_FRV_GPRELLO + - : BFD_RELOC_FRV_GOT12 + - : BFD_RELOC_FRV_GOTHI + - : BFD_RELOC_FRV_GOTLO + - : BFD_RELOC_FRV_FUNCDESC + - : BFD_RELOC_FRV_FUNCDESC_GOT12 + - : BFD_RELOC_FRV_FUNCDESC_GOTHI + - : BFD_RELOC_FRV_FUNCDESC_GOTLO + - : BFD_RELOC_FRV_FUNCDESC_VALUE + - : BFD_RELOC_FRV_FUNCDESC_GOTOFF12 + - : BFD_RELOC_FRV_FUNCDESC_GOTOFFHI + - : BFD_RELOC_FRV_FUNCDESC_GOTOFFLO + - : BFD_RELOC_FRV_GOTOFF12 + - : BFD_RELOC_FRV_GOTOFFHI + - : BFD_RELOC_FRV_GOTOFFLO + Fujitsu Frv Relocations. + + - : BFD_RELOC_MN10300_GOTOFF24 + This is a 24bit GOT-relative reloc for the mn10300. + + - : BFD_RELOC_MN10300_GOT32 + This is a 32bit GOT-relative reloc for the mn10300, offset by two + bytes in the instruction. + + - : BFD_RELOC_MN10300_GOT24 + This is a 24bit GOT-relative reloc for the mn10300, offset by two + bytes in the instruction. + + - : BFD_RELOC_MN10300_GOT16 + This is a 16bit GOT-relative reloc for the mn10300, offset by two + bytes in the instruction. + + - : BFD_RELOC_MN10300_COPY + Copy symbol at runtime. + + - : BFD_RELOC_MN10300_GLOB_DAT + Create GOT entry. + + - : BFD_RELOC_MN10300_JMP_SLOT + Create PLT entry. + + - : BFD_RELOC_MN10300_RELATIVE + Adjust by program base. + + - : BFD_RELOC_386_GOT32 + - : BFD_RELOC_386_PLT32 + - : BFD_RELOC_386_COPY + - : BFD_RELOC_386_GLOB_DAT + - : BFD_RELOC_386_JUMP_SLOT + - : BFD_RELOC_386_RELATIVE + - : BFD_RELOC_386_GOTOFF + - : BFD_RELOC_386_GOTPC + - : BFD_RELOC_386_TLS_TPOFF + - : BFD_RELOC_386_TLS_IE + - : BFD_RELOC_386_TLS_GOTIE + - : BFD_RELOC_386_TLS_LE + - : BFD_RELOC_386_TLS_GD + - : BFD_RELOC_386_TLS_LDM + - : BFD_RELOC_386_TLS_LDO_32 + - : BFD_RELOC_386_TLS_IE_32 + - : BFD_RELOC_386_TLS_LE_32 + - : BFD_RELOC_386_TLS_DTPMOD32 + - : BFD_RELOC_386_TLS_DTPOFF32 + - : BFD_RELOC_386_TLS_TPOFF32 + i386/elf relocations + + - : BFD_RELOC_X86_64_GOT32 + - : BFD_RELOC_X86_64_PLT32 + - : BFD_RELOC_X86_64_COPY + - : BFD_RELOC_X86_64_GLOB_DAT + - : BFD_RELOC_X86_64_JUMP_SLOT + - : BFD_RELOC_X86_64_RELATIVE + - : BFD_RELOC_X86_64_GOTPCREL + - : BFD_RELOC_X86_64_32S + - : BFD_RELOC_X86_64_DTPMOD64 + - : BFD_RELOC_X86_64_DTPOFF64 + - : BFD_RELOC_X86_64_TPOFF64 + - : BFD_RELOC_X86_64_TLSGD + - : BFD_RELOC_X86_64_TLSLD + - : BFD_RELOC_X86_64_DTPOFF32 + - : BFD_RELOC_X86_64_GOTTPOFF + - : BFD_RELOC_X86_64_TPOFF32 + x86-64/elf relocations + + - : BFD_RELOC_NS32K_IMM_8 + - : BFD_RELOC_NS32K_IMM_16 + - : BFD_RELOC_NS32K_IMM_32 + - : BFD_RELOC_NS32K_IMM_8_PCREL + - : BFD_RELOC_NS32K_IMM_16_PCREL + - : BFD_RELOC_NS32K_IMM_32_PCREL + - : BFD_RELOC_NS32K_DISP_8 + - : BFD_RELOC_NS32K_DISP_16 + - : BFD_RELOC_NS32K_DISP_32 + - : BFD_RELOC_NS32K_DISP_8_PCREL + - : BFD_RELOC_NS32K_DISP_16_PCREL + - : BFD_RELOC_NS32K_DISP_32_PCREL + ns32k relocations + + - : BFD_RELOC_PDP11_DISP_8_PCREL + - : BFD_RELOC_PDP11_DISP_6_PCREL + PDP11 relocations + + - : BFD_RELOC_PJ_CODE_HI16 + - : BFD_RELOC_PJ_CODE_LO16 + - : BFD_RELOC_PJ_CODE_DIR16 + - : BFD_RELOC_PJ_CODE_DIR32 + - : BFD_RELOC_PJ_CODE_REL16 + - : BFD_RELOC_PJ_CODE_REL32 + Picojava relocs. Not all of these appear in object files. + + - : BFD_RELOC_PPC_B26 + - : BFD_RELOC_PPC_BA26 + - : BFD_RELOC_PPC_TOC16 + - : BFD_RELOC_PPC_B16 + - : BFD_RELOC_PPC_B16_BRTAKEN + - : BFD_RELOC_PPC_B16_BRNTAKEN + - : BFD_RELOC_PPC_BA16 + - : BFD_RELOC_PPC_BA16_BRTAKEN + - : BFD_RELOC_PPC_BA16_BRNTAKEN + - : BFD_RELOC_PPC_COPY + - : BFD_RELOC_PPC_GLOB_DAT + - : BFD_RELOC_PPC_JMP_SLOT + - : BFD_RELOC_PPC_RELATIVE + - : BFD_RELOC_PPC_LOCAL24PC + - : BFD_RELOC_PPC_EMB_NADDR32 + - : BFD_RELOC_PPC_EMB_NADDR16 + - : BFD_RELOC_PPC_EMB_NADDR16_LO + - : BFD_RELOC_PPC_EMB_NADDR16_HI + - : BFD_RELOC_PPC_EMB_NADDR16_HA + - : BFD_RELOC_PPC_EMB_SDAI16 + - : BFD_RELOC_PPC_EMB_SDA2I16 + - : BFD_RELOC_PPC_EMB_SDA2REL + - : BFD_RELOC_PPC_EMB_SDA21 + - : BFD_RELOC_PPC_EMB_MRKREF + - : BFD_RELOC_PPC_EMB_RELSEC16 + - : BFD_RELOC_PPC_EMB_RELST_LO + - : BFD_RELOC_PPC_EMB_RELST_HI + - : BFD_RELOC_PPC_EMB_RELST_HA + - : BFD_RELOC_PPC_EMB_BIT_FLD + - : BFD_RELOC_PPC_EMB_RELSDA + - : BFD_RELOC_PPC64_HIGHER + - : BFD_RELOC_PPC64_HIGHER_S + - : BFD_RELOC_PPC64_HIGHEST + - : BFD_RELOC_PPC64_HIGHEST_S + - : BFD_RELOC_PPC64_TOC16_LO + - : BFD_RELOC_PPC64_TOC16_HI + - : BFD_RELOC_PPC64_TOC16_HA + - : BFD_RELOC_PPC64_TOC + - : BFD_RELOC_PPC64_PLTGOT16 + - : BFD_RELOC_PPC64_PLTGOT16_LO + - : BFD_RELOC_PPC64_PLTGOT16_HI + - : BFD_RELOC_PPC64_PLTGOT16_HA + - : BFD_RELOC_PPC64_ADDR16_DS + - : BFD_RELOC_PPC64_ADDR16_LO_DS + - : BFD_RELOC_PPC64_GOT16_DS + - : BFD_RELOC_PPC64_GOT16_LO_DS + - : BFD_RELOC_PPC64_PLT16_LO_DS + - : BFD_RELOC_PPC64_SECTOFF_DS + - : BFD_RELOC_PPC64_SECTOFF_LO_DS + - : BFD_RELOC_PPC64_TOC16_DS + - : BFD_RELOC_PPC64_TOC16_LO_DS + - : BFD_RELOC_PPC64_PLTGOT16_DS + - : BFD_RELOC_PPC64_PLTGOT16_LO_DS + Power(rs6000) and PowerPC relocations. + + - : BFD_RELOC_PPC_TLS + - : BFD_RELOC_PPC_DTPMOD + - : BFD_RELOC_PPC_TPREL16 + - : BFD_RELOC_PPC_TPREL16_LO + - : BFD_RELOC_PPC_TPREL16_HI + - : BFD_RELOC_PPC_TPREL16_HA + - : BFD_RELOC_PPC_TPREL + - : BFD_RELOC_PPC_DTPREL16 + - : BFD_RELOC_PPC_DTPREL16_LO + - : BFD_RELOC_PPC_DTPREL16_HI + - : BFD_RELOC_PPC_DTPREL16_HA + - : BFD_RELOC_PPC_DTPREL + - : BFD_RELOC_PPC_GOT_TLSGD16 + - : BFD_RELOC_PPC_GOT_TLSGD16_LO + - : BFD_RELOC_PPC_GOT_TLSGD16_HI + - : BFD_RELOC_PPC_GOT_TLSGD16_HA + - : BFD_RELOC_PPC_GOT_TLSLD16 + - : BFD_RELOC_PPC_GOT_TLSLD16_LO + - : BFD_RELOC_PPC_GOT_TLSLD16_HI + - : BFD_RELOC_PPC_GOT_TLSLD16_HA + - : BFD_RELOC_PPC_GOT_TPREL16 + - : BFD_RELOC_PPC_GOT_TPREL16_LO + - : BFD_RELOC_PPC_GOT_TPREL16_HI + - : BFD_RELOC_PPC_GOT_TPREL16_HA + - : BFD_RELOC_PPC_GOT_DTPREL16 + - : BFD_RELOC_PPC_GOT_DTPREL16_LO + - : BFD_RELOC_PPC_GOT_DTPREL16_HI + - : BFD_RELOC_PPC_GOT_DTPREL16_HA + - : BFD_RELOC_PPC64_TPREL16_DS + - : BFD_RELOC_PPC64_TPREL16_LO_DS + - : BFD_RELOC_PPC64_TPREL16_HIGHER + - : BFD_RELOC_PPC64_TPREL16_HIGHERA + - : BFD_RELOC_PPC64_TPREL16_HIGHEST + - : BFD_RELOC_PPC64_TPREL16_HIGHESTA + - : BFD_RELOC_PPC64_DTPREL16_DS + - : BFD_RELOC_PPC64_DTPREL16_LO_DS + - : BFD_RELOC_PPC64_DTPREL16_HIGHER + - : BFD_RELOC_PPC64_DTPREL16_HIGHERA + - : BFD_RELOC_PPC64_DTPREL16_HIGHEST + - : BFD_RELOC_PPC64_DTPREL16_HIGHESTA + PowerPC and PowerPC64 thread-local storage relocations. + + - : BFD_RELOC_I370_D12 + IBM 370/390 relocations + + - : BFD_RELOC_CTOR + The type of reloc used to build a constructor table - at the moment + probably a 32 bit wide absolute relocation, but the target can + choose. It generally does map to one of the other relocation + types. + + - : BFD_RELOC_ARM_PCREL_BRANCH + ARM 26 bit pc-relative branch. The lowest two bits must be zero + and are not stored in the instruction. + + - : BFD_RELOC_ARM_PCREL_BLX + ARM 26 bit pc-relative branch. The lowest bit must be zero and is + not stored in the instruction. The 2nd lowest bit comes from a 1 + bit field in the instruction. + + - : BFD_RELOC_THUMB_PCREL_BLX + Thumb 22 bit pc-relative branch. The lowest bit must be zero and + is not stored in the instruction. The 2nd lowest bit comes from a + 1 bit field in the instruction. + + - : BFD_RELOC_ARM_IMMEDIATE + - : BFD_RELOC_ARM_ADRL_IMMEDIATE + - : BFD_RELOC_ARM_OFFSET_IMM + - : BFD_RELOC_ARM_SHIFT_IMM + - : BFD_RELOC_ARM_SWI + - : BFD_RELOC_ARM_MULTI + - : BFD_RELOC_ARM_CP_OFF_IMM + - : BFD_RELOC_ARM_CP_OFF_IMM_S2 + - : BFD_RELOC_ARM_ADR_IMM + - : BFD_RELOC_ARM_LDR_IMM + - : BFD_RELOC_ARM_LITERAL + - : BFD_RELOC_ARM_IN_POOL + - : BFD_RELOC_ARM_OFFSET_IMM8 + - : BFD_RELOC_ARM_HWLITERAL + - : BFD_RELOC_ARM_THUMB_ADD + - : BFD_RELOC_ARM_THUMB_IMM + - : BFD_RELOC_ARM_THUMB_SHIFT + - : BFD_RELOC_ARM_THUMB_OFFSET + - : BFD_RELOC_ARM_GOT12 + - : BFD_RELOC_ARM_GOT32 + - : BFD_RELOC_ARM_JUMP_SLOT + - : BFD_RELOC_ARM_COPY + - : BFD_RELOC_ARM_GLOB_DAT + - : BFD_RELOC_ARM_PLT32 + - : BFD_RELOC_ARM_RELATIVE + - : BFD_RELOC_ARM_GOTOFF + - : BFD_RELOC_ARM_GOTPC + These relocs are only used within the ARM assembler. They are not + (at present) written to any object files. + + - : BFD_RELOC_SH_PCDISP8BY2 + - : BFD_RELOC_SH_PCDISP12BY2 + - : BFD_RELOC_SH_IMM4 + - : BFD_RELOC_SH_IMM4BY2 + - : BFD_RELOC_SH_IMM4BY4 + - : BFD_RELOC_SH_IMM8 + - : BFD_RELOC_SH_IMM8BY2 + - : BFD_RELOC_SH_IMM8BY4 + - : BFD_RELOC_SH_PCRELIMM8BY2 + - : BFD_RELOC_SH_PCRELIMM8BY4 + - : BFD_RELOC_SH_SWITCH16 + - : BFD_RELOC_SH_SWITCH32 + - : BFD_RELOC_SH_USES + - : BFD_RELOC_SH_COUNT + - : BFD_RELOC_SH_ALIGN + - : BFD_RELOC_SH_CODE + - : BFD_RELOC_SH_DATA + - : BFD_RELOC_SH_LABEL + - : BFD_RELOC_SH_LOOP_START + - : BFD_RELOC_SH_LOOP_END + - : BFD_RELOC_SH_COPY + - : BFD_RELOC_SH_GLOB_DAT + - : BFD_RELOC_SH_JMP_SLOT + - : BFD_RELOC_SH_RELATIVE + - : BFD_RELOC_SH_GOTPC + - : BFD_RELOC_SH_GOT_LOW16 + - : BFD_RELOC_SH_GOT_MEDLOW16 + - : BFD_RELOC_SH_GOT_MEDHI16 + - : BFD_RELOC_SH_GOT_HI16 + - : BFD_RELOC_SH_GOTPLT_LOW16 + - : BFD_RELOC_SH_GOTPLT_MEDLOW16 + - : BFD_RELOC_SH_GOTPLT_MEDHI16 + - : BFD_RELOC_SH_GOTPLT_HI16 + - : BFD_RELOC_SH_PLT_LOW16 + - : BFD_RELOC_SH_PLT_MEDLOW16 + - : BFD_RELOC_SH_PLT_MEDHI16 + - : BFD_RELOC_SH_PLT_HI16 + - : BFD_RELOC_SH_GOTOFF_LOW16 + - : BFD_RELOC_SH_GOTOFF_MEDLOW16 + - : BFD_RELOC_SH_GOTOFF_MEDHI16 + - : BFD_RELOC_SH_GOTOFF_HI16 + - : BFD_RELOC_SH_GOTPC_LOW16 + - : BFD_RELOC_SH_GOTPC_MEDLOW16 + - : BFD_RELOC_SH_GOTPC_MEDHI16 + - : BFD_RELOC_SH_GOTPC_HI16 + - : BFD_RELOC_SH_COPY64 + - : BFD_RELOC_SH_GLOB_DAT64 + - : BFD_RELOC_SH_JMP_SLOT64 + - : BFD_RELOC_SH_RELATIVE64 + - : BFD_RELOC_SH_GOT10BY4 + - : BFD_RELOC_SH_GOT10BY8 + - : BFD_RELOC_SH_GOTPLT10BY4 + - : BFD_RELOC_SH_GOTPLT10BY8 + - : BFD_RELOC_SH_GOTPLT32 + - : BFD_RELOC_SH_SHMEDIA_CODE + - : BFD_RELOC_SH_IMMU5 + - : BFD_RELOC_SH_IMMS6 + - : BFD_RELOC_SH_IMMS6BY32 + - : BFD_RELOC_SH_IMMU6 + - : BFD_RELOC_SH_IMMS10 + - : BFD_RELOC_SH_IMMS10BY2 + - : BFD_RELOC_SH_IMMS10BY4 + - : BFD_RELOC_SH_IMMS10BY8 + - : BFD_RELOC_SH_IMMS16 + - : BFD_RELOC_SH_IMMU16 + - : BFD_RELOC_SH_IMM_LOW16 + - : BFD_RELOC_SH_IMM_LOW16_PCREL + - : BFD_RELOC_SH_IMM_MEDLOW16 + - : BFD_RELOC_SH_IMM_MEDLOW16_PCREL + - : BFD_RELOC_SH_IMM_MEDHI16 + - : BFD_RELOC_SH_IMM_MEDHI16_PCREL + - : BFD_RELOC_SH_IMM_HI16 + - : BFD_RELOC_SH_IMM_HI16_PCREL + - : BFD_RELOC_SH_PT_16 + - : BFD_RELOC_SH_TLS_GD_32 + - : BFD_RELOC_SH_TLS_LD_32 + - : BFD_RELOC_SH_TLS_LDO_32 + - : BFD_RELOC_SH_TLS_IE_32 + - : BFD_RELOC_SH_TLS_LE_32 + - : BFD_RELOC_SH_TLS_DTPMOD32 + - : BFD_RELOC_SH_TLS_DTPOFF32 + - : BFD_RELOC_SH_TLS_TPOFF32 + Renesas / SuperH SH relocs. Not all of these appear in object + files. + + - : BFD_RELOC_THUMB_PCREL_BRANCH9 + - : BFD_RELOC_THUMB_PCREL_BRANCH12 + - : BFD_RELOC_THUMB_PCREL_BRANCH23 + Thumb 23-, 12- and 9-bit pc-relative branches. The lowest bit must + be zero and is not stored in the instruction. + + - : BFD_RELOC_ARC_B22_PCREL + ARC Cores relocs. ARC 22 bit pc-relative branch. The lowest two + bits must be zero and are not stored in the instruction. The high + 20 bits are installed in bits 26 through 7 of the instruction. + + - : BFD_RELOC_ARC_B26 + ARC 26 bit absolute branch. The lowest two bits must be zero and + are not stored in the instruction. The high 24 bits are installed + in bits 23 through 0. + + - : BFD_RELOC_D10V_10_PCREL_R + Mitsubishi D10V relocs. This is a 10-bit reloc with the right 2 + bits assumed to be 0. + + - : BFD_RELOC_D10V_10_PCREL_L + Mitsubishi D10V relocs. This is a 10-bit reloc with the right 2 + bits assumed to be 0. This is the same as the previous reloc + except it is in the left container, i.e., shifted left 15 bits. + + - : BFD_RELOC_D10V_18 + This is an 18-bit reloc with the right 2 bits assumed to be 0. + + - : BFD_RELOC_D10V_18_PCREL + This is an 18-bit reloc with the right 2 bits assumed to be 0. + + - : BFD_RELOC_D30V_6 + Mitsubishi D30V relocs. This is a 6-bit absolute reloc. + + - : BFD_RELOC_D30V_9_PCREL + This is a 6-bit pc-relative reloc with the right 3 bits assumed to + be 0. + + - : BFD_RELOC_D30V_9_PCREL_R + This is a 6-bit pc-relative reloc with the right 3 bits assumed to + be 0. Same as the previous reloc but on the right side of the + container. + + - : BFD_RELOC_D30V_15 + This is a 12-bit absolute reloc with the right 3 bitsassumed to be + 0. + + - : BFD_RELOC_D30V_15_PCREL + This is a 12-bit pc-relative reloc with the right 3 bits assumed + to be 0. + + - : BFD_RELOC_D30V_15_PCREL_R + This is a 12-bit pc-relative reloc with the right 3 bits assumed + to be 0. Same as the previous reloc but on the right side of the + container. + + - : BFD_RELOC_D30V_21 + This is an 18-bit absolute reloc with the right 3 bits assumed to + be 0. + + - : BFD_RELOC_D30V_21_PCREL + This is an 18-bit pc-relative reloc with the right 3 bits assumed + to be 0. + + - : BFD_RELOC_D30V_21_PCREL_R + This is an 18-bit pc-relative reloc with the right 3 bits assumed + to be 0. Same as the previous reloc but on the right side of the + container. + + - : BFD_RELOC_D30V_32 + This is a 32-bit absolute reloc. + + - : BFD_RELOC_D30V_32_PCREL + This is a 32-bit pc-relative reloc. + + - : BFD_RELOC_DLX_HI16_S + DLX relocs + + - : BFD_RELOC_DLX_LO16 + DLX relocs + + - : BFD_RELOC_DLX_JMP26 + DLX relocs + + - : BFD_RELOC_M32R_24 + Renesas M32R (formerly Mitsubishi M32R) relocs. This is a 24 bit + absolute address. + + - : BFD_RELOC_M32R_10_PCREL + This is a 10-bit pc-relative reloc with the right 2 bits assumed + to be 0. + + - : BFD_RELOC_M32R_18_PCREL + This is an 18-bit reloc with the right 2 bits assumed to be 0. + + - : BFD_RELOC_M32R_26_PCREL + This is a 26-bit reloc with the right 2 bits assumed to be 0. + + - : BFD_RELOC_M32R_HI16_ULO + This is a 16-bit reloc containing the high 16 bits of an address + used when the lower 16 bits are treated as unsigned. + + - : BFD_RELOC_M32R_HI16_SLO + This is a 16-bit reloc containing the high 16 bits of an address + used when the lower 16 bits are treated as signed. + + - : BFD_RELOC_M32R_LO16 + This is a 16-bit reloc containing the lower 16 bits of an address. + + - : BFD_RELOC_M32R_SDA16 + This is a 16-bit reloc containing the small data area offset for + use in add3, load, and store instructions. + + - : BFD_RELOC_M32R_GOT24 + - : BFD_RELOC_M32R_26_PLTREL + - : BFD_RELOC_M32R_COPY + - : BFD_RELOC_M32R_GLOB_DAT + - : BFD_RELOC_M32R_JMP_SLOT + - : BFD_RELOC_M32R_RELATIVE + - : BFD_RELOC_M32R_GOTOFF + - : BFD_RELOC_M32R_GOTPC24 + - : BFD_RELOC_M32R_GOT16_HI_ULO + - : BFD_RELOC_M32R_GOT16_HI_SLO + - : BFD_RELOC_M32R_GOT16_LO + - : BFD_RELOC_M32R_GOTPC_HI_ULO + - : BFD_RELOC_M32R_GOTPC_HI_SLO + - : BFD_RELOC_M32R_GOTPC_LO + For PIC. + + - : BFD_RELOC_V850_9_PCREL + This is a 9-bit reloc + + - : BFD_RELOC_V850_22_PCREL + This is a 22-bit reloc + + - : BFD_RELOC_V850_SDA_16_16_OFFSET + This is a 16 bit offset from the short data area pointer. + + - : BFD_RELOC_V850_SDA_15_16_OFFSET + This is a 16 bit offset (of which only 15 bits are used) from the + short data area pointer. + + - : BFD_RELOC_V850_ZDA_16_16_OFFSET + This is a 16 bit offset from the zero data area pointer. + + - : BFD_RELOC_V850_ZDA_15_16_OFFSET + This is a 16 bit offset (of which only 15 bits are used) from the + zero data area pointer. + + - : BFD_RELOC_V850_TDA_6_8_OFFSET + This is an 8 bit offset (of which only 6 bits are used) from the + tiny data area pointer. + + - : BFD_RELOC_V850_TDA_7_8_OFFSET + This is an 8bit offset (of which only 7 bits are used) from the + tiny data area pointer. + + - : BFD_RELOC_V850_TDA_7_7_OFFSET + This is a 7 bit offset from the tiny data area pointer. + + - : BFD_RELOC_V850_TDA_16_16_OFFSET + This is a 16 bit offset from the tiny data area pointer. + + - : BFD_RELOC_V850_TDA_4_5_OFFSET + This is a 5 bit offset (of which only 4 bits are used) from the + tiny data area pointer. + + - : BFD_RELOC_V850_TDA_4_4_OFFSET + This is a 4 bit offset from the tiny data area pointer. + + - : BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET + This is a 16 bit offset from the short data area pointer, with the + bits placed non-contiguously in the instruction. + + - : BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET + This is a 16 bit offset from the zero data area pointer, with the + bits placed non-contiguously in the instruction. + + - : BFD_RELOC_V850_CALLT_6_7_OFFSET + This is a 6 bit offset from the call table base pointer. + + - : BFD_RELOC_V850_CALLT_16_16_OFFSET + This is a 16 bit offset from the call table base pointer. + + - : BFD_RELOC_V850_LONGCALL + Used for relaxing indirect function calls. + + - : BFD_RELOC_V850_LONGJUMP + Used for relaxing indirect jumps. + + - : BFD_RELOC_V850_ALIGN + Used to maintain alignment whilst relaxing. + + - : BFD_RELOC_MN10300_32_PCREL + This is a 32bit pcrel reloc for the mn10300, offset by two bytes + in the instruction. + + - : BFD_RELOC_MN10300_16_PCREL + This is a 16bit pcrel reloc for the mn10300, offset by two bytes + in the instruction. + + - : BFD_RELOC_TIC30_LDP + This is a 8bit DP reloc for the tms320c30, where the most + significant 8 bits of a 24 bit word are placed into the least + significant 8 bits of the opcode. + + - : BFD_RELOC_TIC54X_PARTLS7 + This is a 7bit reloc for the tms320c54x, where the least + significant 7 bits of a 16 bit word are placed into the least + significant 7 bits of the opcode. + + - : BFD_RELOC_TIC54X_PARTMS9 + This is a 9bit DP reloc for the tms320c54x, where the most + significant 9 bits of a 16 bit word are placed into the least + significant 9 bits of the opcode. + + - : BFD_RELOC_TIC54X_23 + This is an extended address 23-bit reloc for the tms320c54x. + + - : BFD_RELOC_TIC54X_16_OF_23 + This is a 16-bit reloc for the tms320c54x, where the least + significant 16 bits of a 23-bit extended address are placed into + the opcode. + + - : BFD_RELOC_TIC54X_MS7_OF_23 + This is a reloc for the tms320c54x, where the most significant 7 + bits of a 23-bit extended address are placed into the opcode. + + - : BFD_RELOC_FR30_48 + This is a 48 bit reloc for the FR30 that stores 32 bits. + + - : BFD_RELOC_FR30_20 + This is a 32 bit reloc for the FR30 that stores 20 bits split up + into two sections. + + - : BFD_RELOC_FR30_6_IN_4 + This is a 16 bit reloc for the FR30 that stores a 6 bit word + offset in 4 bits. + + - : BFD_RELOC_FR30_8_IN_8 + This is a 16 bit reloc for the FR30 that stores an 8 bit byte + offset into 8 bits. + + - : BFD_RELOC_FR30_9_IN_8 + This is a 16 bit reloc for the FR30 that stores a 9 bit short + offset into 8 bits. + + - : BFD_RELOC_FR30_10_IN_8 + This is a 16 bit reloc for the FR30 that stores a 10 bit word + offset into 8 bits. + + - : BFD_RELOC_FR30_9_PCREL + This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative + short offset into 8 bits. + + - : BFD_RELOC_FR30_12_PCREL + This is a 16 bit reloc for the FR30 that stores a 12 bit pc + relative short offset into 11 bits. + + - : BFD_RELOC_MCORE_PCREL_IMM8BY4 + - : BFD_RELOC_MCORE_PCREL_IMM11BY2 + - : BFD_RELOC_MCORE_PCREL_IMM4BY2 + - : BFD_RELOC_MCORE_PCREL_32 + - : BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2 + - : BFD_RELOC_MCORE_RVA + Motorola Mcore relocations. + + - : BFD_RELOC_MMIX_GETA + - : BFD_RELOC_MMIX_GETA_1 + - : BFD_RELOC_MMIX_GETA_2 + - : BFD_RELOC_MMIX_GETA_3 + These are relocations for the GETA instruction. + + - : BFD_RELOC_MMIX_CBRANCH + - : BFD_RELOC_MMIX_CBRANCH_J + - : BFD_RELOC_MMIX_CBRANCH_1 + - : BFD_RELOC_MMIX_CBRANCH_2 + - : BFD_RELOC_MMIX_CBRANCH_3 + These are relocations for a conditional branch instruction. + + - : BFD_RELOC_MMIX_PUSHJ + - : BFD_RELOC_MMIX_PUSHJ_1 + - : BFD_RELOC_MMIX_PUSHJ_2 + - : BFD_RELOC_MMIX_PUSHJ_3 + - : BFD_RELOC_MMIX_PUSHJ_STUBBABLE + These are relocations for the PUSHJ instruction. + + - : BFD_RELOC_MMIX_JMP + - : BFD_RELOC_MMIX_JMP_1 + - : BFD_RELOC_MMIX_JMP_2 + - : BFD_RELOC_MMIX_JMP_3 + These are relocations for the JMP instruction. + + - : BFD_RELOC_MMIX_ADDR19 + This is a relocation for a relative address as in a GETA + instruction or a branch. + + - : BFD_RELOC_MMIX_ADDR27 + This is a relocation for a relative address as in a JMP + instruction. + + - : BFD_RELOC_MMIX_REG_OR_BYTE + This is a relocation for an instruction field that may be a general + register or a value 0..255. + + - : BFD_RELOC_MMIX_REG + This is a relocation for an instruction field that may be a general + register. + + - : BFD_RELOC_MMIX_BASE_PLUS_OFFSET + This is a relocation for two instruction fields holding a register + and an offset, the equivalent of the relocation. + + - : BFD_RELOC_MMIX_LOCAL + This relocation is an assertion that the expression is not + allocated as a global register. It does not modify contents. + + - : BFD_RELOC_AVR_7_PCREL + This is a 16 bit reloc for the AVR that stores 8 bit pc relative + short offset into 7 bits. + + - : BFD_RELOC_AVR_13_PCREL + This is a 16 bit reloc for the AVR that stores 13 bit pc relative + short offset into 12 bits. + + - : BFD_RELOC_AVR_16_PM + This is a 16 bit reloc for the AVR that stores 17 bit value + (usually program memory address) into 16 bits. + + - : BFD_RELOC_AVR_LO8_LDI + This is a 16 bit reloc for the AVR that stores 8 bit value (usually + data memory address) into 8 bit immediate value of LDI insn. + + - : BFD_RELOC_AVR_HI8_LDI + This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 + bit of data memory address) into 8 bit immediate value of LDI insn. + + - : BFD_RELOC_AVR_HH8_LDI + This is a 16 bit reloc for the AVR that stores 8 bit value (most + high 8 bit of program memory address) into 8 bit immediate value + of LDI insn. + + - : BFD_RELOC_AVR_LO8_LDI_NEG + This is a 16 bit reloc for the AVR that stores negated 8 bit value + (usually data memory address) into 8 bit immediate value of SUBI + insn. + + - : BFD_RELOC_AVR_HI8_LDI_NEG + This is a 16 bit reloc for the AVR that stores negated 8 bit value + (high 8 bit of data memory address) into 8 bit immediate value of + SUBI insn. + + - : BFD_RELOC_AVR_HH8_LDI_NEG + This is a 16 bit reloc for the AVR that stores negated 8 bit value + (most high 8 bit of program memory address) into 8 bit immediate + value of LDI or SUBI insn. + + - : BFD_RELOC_AVR_LO8_LDI_PM + This is a 16 bit reloc for the AVR that stores 8 bit value (usually + command address) into 8 bit immediate value of LDI insn. + + - : BFD_RELOC_AVR_HI8_LDI_PM + This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 + bit of command address) into 8 bit immediate value of LDI insn. + + - : BFD_RELOC_AVR_HH8_LDI_PM + This is a 16 bit reloc for the AVR that stores 8 bit value (most + high 8 bit of command address) into 8 bit immediate value of LDI + insn. + + - : BFD_RELOC_AVR_LO8_LDI_PM_NEG + This is a 16 bit reloc for the AVR that stores negated 8 bit value + (usually command address) into 8 bit immediate value of SUBI insn. + + - : BFD_RELOC_AVR_HI8_LDI_PM_NEG + This is a 16 bit reloc for the AVR that stores negated 8 bit value + (high 8 bit of 16 bit command address) into 8 bit immediate value + of SUBI insn. + + - : BFD_RELOC_AVR_HH8_LDI_PM_NEG + This is a 16 bit reloc for the AVR that stores negated 8 bit value + (high 6 bit of 22 bit command address) into 8 bit immediate value + of SUBI insn. + + - : BFD_RELOC_AVR_CALL + This is a 32 bit reloc for the AVR that stores 23 bit value into + 22 bits. + + - : BFD_RELOC_390_12 + Direct 12 bit. + + - : BFD_RELOC_390_GOT12 + 12 bit GOT offset. + + - : BFD_RELOC_390_PLT32 + 32 bit PC relative PLT address. + + - : BFD_RELOC_390_COPY + Copy symbol at runtime. + + - : BFD_RELOC_390_GLOB_DAT + Create GOT entry. + + - : BFD_RELOC_390_JMP_SLOT + Create PLT entry. + + - : BFD_RELOC_390_RELATIVE + Adjust by program base. + + - : BFD_RELOC_390_GOTPC + 32 bit PC relative offset to GOT. + + - : BFD_RELOC_390_GOT16 + 16 bit GOT offset. + + - : BFD_RELOC_390_PC16DBL + PC relative 16 bit shifted by 1. + + - : BFD_RELOC_390_PLT16DBL + 16 bit PC rel. PLT shifted by 1. + + - : BFD_RELOC_390_PC32DBL + PC relative 32 bit shifted by 1. + + - : BFD_RELOC_390_PLT32DBL + 32 bit PC rel. PLT shifted by 1. + + - : BFD_RELOC_390_GOTPCDBL + 32 bit PC rel. GOT shifted by 1. + + - : BFD_RELOC_390_GOT64 + 64 bit GOT offset. + + - : BFD_RELOC_390_PLT64 + 64 bit PC relative PLT address. + + - : BFD_RELOC_390_GOTENT + 32 bit rel. offset to GOT entry. + + - : BFD_RELOC_390_GOTOFF64 + 64 bit offset to GOT. + + - : BFD_RELOC_390_GOTPLT12 + 12-bit offset to symbol-entry within GOT, with PLT handling. + + - : BFD_RELOC_390_GOTPLT16 + 16-bit offset to symbol-entry within GOT, with PLT handling. + + - : BFD_RELOC_390_GOTPLT32 + 32-bit offset to symbol-entry within GOT, with PLT handling. + + - : BFD_RELOC_390_GOTPLT64 + 64-bit offset to symbol-entry within GOT, with PLT handling. + + - : BFD_RELOC_390_GOTPLTENT + 32-bit rel. offset to symbol-entry within GOT, with PLT handling. + + - : BFD_RELOC_390_PLTOFF16 + 16-bit rel. offset from the GOT to a PLT entry. + + - : BFD_RELOC_390_PLTOFF32 + 32-bit rel. offset from the GOT to a PLT entry. + + - : BFD_RELOC_390_PLTOFF64 + 64-bit rel. offset from the GOT to a PLT entry. + + - : BFD_RELOC_390_TLS_LOAD + - : BFD_RELOC_390_TLS_GDCALL + - : BFD_RELOC_390_TLS_LDCALL + - : BFD_RELOC_390_TLS_GD32 + - : BFD_RELOC_390_TLS_GD64 + - : BFD_RELOC_390_TLS_GOTIE12 + - : BFD_RELOC_390_TLS_GOTIE32 + - : BFD_RELOC_390_TLS_GOTIE64 + - : BFD_RELOC_390_TLS_LDM32 + - : BFD_RELOC_390_TLS_LDM64 + - : BFD_RELOC_390_TLS_IE32 + - : BFD_RELOC_390_TLS_IE64 + - : BFD_RELOC_390_TLS_IEENT + - : BFD_RELOC_390_TLS_LE32 + - : BFD_RELOC_390_TLS_LE64 + - : BFD_RELOC_390_TLS_LDO32 + - : BFD_RELOC_390_TLS_LDO64 + - : BFD_RELOC_390_TLS_DTPMOD + - : BFD_RELOC_390_TLS_DTPOFF + - : BFD_RELOC_390_TLS_TPOFF + s390 tls relocations. + + - : BFD_RELOC_390_20 + - : BFD_RELOC_390_GOT20 + - : BFD_RELOC_390_GOTPLT20 + - : BFD_RELOC_390_TLS_GOTIE20 + Long displacement extension. + + - : BFD_RELOC_IP2K_FR9 + Scenix IP2K - 9-bit register number / data address + + - : BFD_RELOC_IP2K_BANK + Scenix IP2K - 4-bit register/data bank number + + - : BFD_RELOC_IP2K_ADDR16CJP + Scenix IP2K - low 13 bits of instruction word address + + - : BFD_RELOC_IP2K_PAGE3 + Scenix IP2K - high 3 bits of instruction word address + + - : BFD_RELOC_IP2K_LO8DATA + - : BFD_RELOC_IP2K_HI8DATA + - : BFD_RELOC_IP2K_EX8DATA + Scenix IP2K - ext/low/high 8 bits of data address + + - : BFD_RELOC_IP2K_LO8INSN + - : BFD_RELOC_IP2K_HI8INSN + Scenix IP2K - low/high 8 bits of instruction word address + + - : BFD_RELOC_IP2K_PC_SKIP + Scenix IP2K - even/odd PC modifier to modify snb pcl.0 + + - : BFD_RELOC_IP2K_TEXT + Scenix IP2K - 16 bit word address in text section. + + - : BFD_RELOC_IP2K_FR_OFFSET + Scenix IP2K - 7-bit sp or dp offset + + - : BFD_RELOC_VPE4KMATH_DATA + - : BFD_RELOC_VPE4KMATH_INSN + Scenix VPE4K coprocessor - data/insn-space addressing + + - : BFD_RELOC_VTABLE_INHERIT + - : BFD_RELOC_VTABLE_ENTRY + These two relocations are used by the linker to determine which of + the entries in a C++ virtual function table are actually used. + When the -gc-sections option is given, the linker will zero out + the entries that are not used, so that the code for those + functions need not be included in the output. + + VTABLE_INHERIT is a zero-space relocation used to describe to the + linker the inheritance tree of a C++ virtual function table. The + relocation's symbol should be the parent class' vtable, and the + relocation should be located at the child vtable. + + VTABLE_ENTRY is a zero-space relocation that describes the use of a + virtual function table entry. The reloc's symbol should refer to + the table of the class mentioned in the code. Off of that base, + an offset describes the entry that is being used. For Rela hosts, + this offset is stored in the reloc's addend. For Rel hosts, we + are forced to put this offset in the reloc's section offset. + + - : BFD_RELOC_IA64_IMM14 + - : BFD_RELOC_IA64_IMM22 + - : BFD_RELOC_IA64_IMM64 + - : BFD_RELOC_IA64_DIR32MSB + - : BFD_RELOC_IA64_DIR32LSB + - : BFD_RELOC_IA64_DIR64MSB + - : BFD_RELOC_IA64_DIR64LSB + - : BFD_RELOC_IA64_GPREL22 + - : BFD_RELOC_IA64_GPREL64I + - : BFD_RELOC_IA64_GPREL32MSB + - : BFD_RELOC_IA64_GPREL32LSB + - : BFD_RELOC_IA64_GPREL64MSB + - : BFD_RELOC_IA64_GPREL64LSB + - : BFD_RELOC_IA64_LTOFF22 + - : BFD_RELOC_IA64_LTOFF64I + - : BFD_RELOC_IA64_PLTOFF22 + - : BFD_RELOC_IA64_PLTOFF64I + - : BFD_RELOC_IA64_PLTOFF64MSB + - : BFD_RELOC_IA64_PLTOFF64LSB + - : BFD_RELOC_IA64_FPTR64I + - : BFD_RELOC_IA64_FPTR32MSB + - : BFD_RELOC_IA64_FPTR32LSB + - : BFD_RELOC_IA64_FPTR64MSB + - : BFD_RELOC_IA64_FPTR64LSB + - : BFD_RELOC_IA64_PCREL21B + - : BFD_RELOC_IA64_PCREL21BI + - : BFD_RELOC_IA64_PCREL21M + - : BFD_RELOC_IA64_PCREL21F + - : BFD_RELOC_IA64_PCREL22 + - : BFD_RELOC_IA64_PCREL60B + - : BFD_RELOC_IA64_PCREL64I + - : BFD_RELOC_IA64_PCREL32MSB + - : BFD_RELOC_IA64_PCREL32LSB + - : BFD_RELOC_IA64_PCREL64MSB + - : BFD_RELOC_IA64_PCREL64LSB + - : BFD_RELOC_IA64_LTOFF_FPTR22 + - : BFD_RELOC_IA64_LTOFF_FPTR64I + - : BFD_RELOC_IA64_LTOFF_FPTR32MSB + - : BFD_RELOC_IA64_LTOFF_FPTR32LSB + - : BFD_RELOC_IA64_LTOFF_FPTR64MSB + - : BFD_RELOC_IA64_LTOFF_FPTR64LSB + - : BFD_RELOC_IA64_SEGREL32MSB + - : BFD_RELOC_IA64_SEGREL32LSB + - : BFD_RELOC_IA64_SEGREL64MSB + - : BFD_RELOC_IA64_SEGREL64LSB + - : BFD_RELOC_IA64_SECREL32MSB + - : BFD_RELOC_IA64_SECREL32LSB + - : BFD_RELOC_IA64_SECREL64MSB + - : BFD_RELOC_IA64_SECREL64LSB + - : BFD_RELOC_IA64_REL32MSB + - : BFD_RELOC_IA64_REL32LSB + - : BFD_RELOC_IA64_REL64MSB + - : BFD_RELOC_IA64_REL64LSB + - : BFD_RELOC_IA64_LTV32MSB + - : BFD_RELOC_IA64_LTV32LSB + - : BFD_RELOC_IA64_LTV64MSB + - : BFD_RELOC_IA64_LTV64LSB + - : BFD_RELOC_IA64_IPLTMSB + - : BFD_RELOC_IA64_IPLTLSB + - : BFD_RELOC_IA64_COPY + - : BFD_RELOC_IA64_LTOFF22X + - : BFD_RELOC_IA64_LDXMOV + - : BFD_RELOC_IA64_TPREL14 + - : BFD_RELOC_IA64_TPREL22 + - : BFD_RELOC_IA64_TPREL64I + - : BFD_RELOC_IA64_TPREL64MSB + - : BFD_RELOC_IA64_TPREL64LSB + - : BFD_RELOC_IA64_LTOFF_TPREL22 + - : BFD_RELOC_IA64_DTPMOD64MSB + - : BFD_RELOC_IA64_DTPMOD64LSB + - : BFD_RELOC_IA64_LTOFF_DTPMOD22 + - : BFD_RELOC_IA64_DTPREL14 + - : BFD_RELOC_IA64_DTPREL22 + - : BFD_RELOC_IA64_DTPREL64I + - : BFD_RELOC_IA64_DTPREL32MSB + - : BFD_RELOC_IA64_DTPREL32LSB + - : BFD_RELOC_IA64_DTPREL64MSB + - : BFD_RELOC_IA64_DTPREL64LSB + - : BFD_RELOC_IA64_LTOFF_DTPREL22 + Intel IA64 Relocations. + + - : BFD_RELOC_M68HC11_HI8 + Motorola 68HC11 reloc. This is the 8 bit high part of an absolute + address. + + - : BFD_RELOC_M68HC11_LO8 + Motorola 68HC11 reloc. This is the 8 bit low part of an absolute + address. + + - : BFD_RELOC_M68HC11_3B + Motorola 68HC11 reloc. This is the 3 bit of a value. + + - : BFD_RELOC_M68HC11_RL_JUMP + Motorola 68HC11 reloc. This reloc marks the beginning of a + jump/call instruction. It is used for linker relaxation to + correctly identify beginning of instruction and change some + branches to use PC-relative addressing mode. + + - : BFD_RELOC_M68HC11_RL_GROUP + Motorola 68HC11 reloc. This reloc marks a group of several + instructions that gcc generates and for which the linker + relaxation pass can modify and/or remove some of them. + + - : BFD_RELOC_M68HC11_LO16 + Motorola 68HC11 reloc. This is the 16-bit lower part of an + address. It is used for 'call' instruction to specify the symbol + address without any special transformation (due to memory bank + window). + + - : BFD_RELOC_M68HC11_PAGE + Motorola 68HC11 reloc. This is a 8-bit reloc that specifies the + page number of an address. It is used by 'call' instruction to + specify the page number of the symbol. + + - : BFD_RELOC_M68HC11_24 + Motorola 68HC11 reloc. This is a 24-bit reloc that represents the + address with a 16-bit value and a 8-bit page number. The symbol + address is transformed to follow the 16K memory bank of 68HC12 + (seen as mapped in the window). + + - : BFD_RELOC_M68HC12_5B + Motorola 68HC12 reloc. This is the 5 bits of a value. + + - : BFD_RELOC_CRIS_BDISP8 + - : BFD_RELOC_CRIS_UNSIGNED_5 + - : BFD_RELOC_CRIS_SIGNED_6 + - : BFD_RELOC_CRIS_UNSIGNED_6 + - : BFD_RELOC_CRIS_UNSIGNED_4 + These relocs are only used within the CRIS assembler. They are not + (at present) written to any object files. + + - : BFD_RELOC_CRIS_COPY + - : BFD_RELOC_CRIS_GLOB_DAT + - : BFD_RELOC_CRIS_JUMP_SLOT + - : BFD_RELOC_CRIS_RELATIVE + Relocs used in ELF shared libraries for CRIS. + + - : BFD_RELOC_CRIS_32_GOT + 32-bit offset to symbol-entry within GOT. + + - : BFD_RELOC_CRIS_16_GOT + 16-bit offset to symbol-entry within GOT. + + - : BFD_RELOC_CRIS_32_GOTPLT + 32-bit offset to symbol-entry within GOT, with PLT handling. + + - : BFD_RELOC_CRIS_16_GOTPLT + 16-bit offset to symbol-entry within GOT, with PLT handling. + + - : BFD_RELOC_CRIS_32_GOTREL + 32-bit offset to symbol, relative to GOT. + + - : BFD_RELOC_CRIS_32_PLT_GOTREL + 32-bit offset to symbol with PLT entry, relative to GOT. + + - : BFD_RELOC_CRIS_32_PLT_PCREL + 32-bit offset to symbol with PLT entry, relative to this + relocation. + + - : BFD_RELOC_860_COPY + - : BFD_RELOC_860_GLOB_DAT + - : BFD_RELOC_860_JUMP_SLOT + - : BFD_RELOC_860_RELATIVE + - : BFD_RELOC_860_PC26 + - : BFD_RELOC_860_PLT26 + - : BFD_RELOC_860_PC16 + - : BFD_RELOC_860_LOW0 + - : BFD_RELOC_860_SPLIT0 + - : BFD_RELOC_860_LOW1 + - : BFD_RELOC_860_SPLIT1 + - : BFD_RELOC_860_LOW2 + - : BFD_RELOC_860_SPLIT2 + - : BFD_RELOC_860_LOW3 + - : BFD_RELOC_860_LOGOT0 + - : BFD_RELOC_860_SPGOT0 + - : BFD_RELOC_860_LOGOT1 + - : BFD_RELOC_860_SPGOT1 + - : BFD_RELOC_860_LOGOTOFF0 + - : BFD_RELOC_860_SPGOTOFF0 + - : BFD_RELOC_860_LOGOTOFF1 + - : BFD_RELOC_860_SPGOTOFF1 + - : BFD_RELOC_860_LOGOTOFF2 + - : BFD_RELOC_860_LOGOTOFF3 + - : BFD_RELOC_860_LOPC + - : BFD_RELOC_860_HIGHADJ + - : BFD_RELOC_860_HAGOT + - : BFD_RELOC_860_HAGOTOFF + - : BFD_RELOC_860_HAPC + - : BFD_RELOC_860_HIGH + - : BFD_RELOC_860_HIGOT + - : BFD_RELOC_860_HIGOTOFF + Intel i860 Relocations. + + - : BFD_RELOC_OPENRISC_ABS_26 + - : BFD_RELOC_OPENRISC_REL_26 + OpenRISC Relocations. + + - : BFD_RELOC_H8_DIR16A8 + - : BFD_RELOC_H8_DIR16R8 + - : BFD_RELOC_H8_DIR24A8 + - : BFD_RELOC_H8_DIR24R8 + - : BFD_RELOC_H8_DIR32A16 + H8 elf Relocations. + + - : BFD_RELOC_XSTORMY16_REL_12 + - : BFD_RELOC_XSTORMY16_12 + - : BFD_RELOC_XSTORMY16_24 + - : BFD_RELOC_XSTORMY16_FPTR16 + Sony Xstormy16 Relocations. + + - : BFD_RELOC_VAX_GLOB_DAT + - : BFD_RELOC_VAX_JMP_SLOT + - : BFD_RELOC_VAX_RELATIVE + Relocations used by VAX ELF. + + - : BFD_RELOC_MSP430_10_PCREL + - : BFD_RELOC_MSP430_16_PCREL + - : BFD_RELOC_MSP430_16 + - : BFD_RELOC_MSP430_16_PCREL_BYTE + - : BFD_RELOC_MSP430_16_BYTE + msp430 specific relocation codes + + - : BFD_RELOC_IQ2000_OFFSET_16 + - : BFD_RELOC_IQ2000_OFFSET_21 + - : BFD_RELOC_IQ2000_UHI16 + IQ2000 Relocations. + + - : BFD_RELOC_XTENSA_RTLD + Special Xtensa relocation used only by PLT entries in ELF shared + objects to indicate that the runtime linker should set the value + to one of its own internal functions or data structures. + + - : BFD_RELOC_XTENSA_GLOB_DAT + - : BFD_RELOC_XTENSA_JMP_SLOT + - : BFD_RELOC_XTENSA_RELATIVE + Xtensa relocations for ELF shared objects. + + - : BFD_RELOC_XTENSA_PLT + Xtensa relocation used in ELF object files for symbols that may + require PLT entries. Otherwise, this is just a generic 32-bit + relocation. + + - : BFD_RELOC_XTENSA_OP0 + - : BFD_RELOC_XTENSA_OP1 + - : BFD_RELOC_XTENSA_OP2 + Generic Xtensa relocations. Only the operand number is encoded in + the relocation. The details are determined by extracting the + instruction opcode. + + - : BFD_RELOC_XTENSA_ASM_EXPAND + Xtensa relocation to mark that the assembler expanded the + instructions from an original target. The expansion size is + encoded in the reloc size. + + - : BFD_RELOC_XTENSA_ASM_SIMPLIFY + Xtensa relocation to mark that the linker should simplify + assembler-expanded instructions. This is commonly used internally + by the linker after analysis of a BFD_RELOC_XTENSA_ASM_EXPAND. + + + typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; + +`bfd_reloc_type_lookup' +....................... + +*Synopsis* + reloc_howto_type *bfd_reloc_type_lookup + (bfd *abfd, bfd_reloc_code_real_type code); + *Description* +Return a pointer to a howto structure which, when invoked, will perform +the relocation CODE on data from the architecture noted. + +`bfd_default_reloc_type_lookup' +............................... + +*Synopsis* + reloc_howto_type *bfd_default_reloc_type_lookup + (bfd *abfd, bfd_reloc_code_real_type code); + *Description* +Provides a default relocation lookup routine for any architecture. + +`bfd_get_reloc_code_name' +......................... + +*Synopsis* + const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code); + *Description* +Provides a printable name for the supplied relocation code. Useful +mainly for printing error messages. + +`bfd_generic_relax_section' +........................... + +*Synopsis* + bfd_boolean bfd_generic_relax_section + (bfd *abfd, + asection *section, + struct bfd_link_info *, + bfd_boolean *); + *Description* +Provides default handling for relaxing for back ends which don't do +relaxing - i.e., does nothing except make sure that the final size of +the section is set. + +`bfd_generic_gc_sections' +......................... + +*Synopsis* + bfd_boolean bfd_generic_gc_sections + (bfd *, struct bfd_link_info *); + *Description* +Provides default handling for relaxing for back ends which don't do +section gc - i.e., does nothing. + +`bfd_generic_merge_sections' +............................ + +*Synopsis* + bfd_boolean bfd_generic_merge_sections + (bfd *, struct bfd_link_info *); + *Description* +Provides default handling for SEC_MERGE section merging for back ends +which don't have SEC_MERGE support - i.e., does nothing. + +`bfd_generic_get_relocated_section_contents' +............................................ + +*Synopsis* + bfd_byte *bfd_generic_get_relocated_section_contents + (bfd *abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + bfd_boolean relocatable, + asymbol **symbols); + *Description* +Provides default handling of relocation effort for back ends which +can't be bothered to do it efficiently. + + +File: bfd.info, Node: Core Files, Next: Targets, Prev: Relocations, Up: BFD front end + +Core files +========== + +*Description* +These are functions pertaining to core files. + +`bfd_core_file_failing_command' +............................... + +*Synopsis* + const char *bfd_core_file_failing_command (bfd *abfd); + *Description* +Return a read-only string explaining which program was running when it +failed and produced the core file ABFD. + +`bfd_core_file_failing_signal' +.............................. + +*Synopsis* + int bfd_core_file_failing_signal (bfd *abfd); + *Description* +Returns the signal number which caused the core dump which generated +the file the BFD ABFD is attached to. + +`core_file_matches_executable_p' +................................ + +*Synopsis* + bfd_boolean core_file_matches_executable_p + (bfd *core_bfd, bfd *exec_bfd); + *Description* +Return `TRUE' if the core file attached to CORE_BFD was generated by a +run of the executable file attached to EXEC_BFD, `FALSE' otherwise. + + +File: bfd.info, Node: Targets, Next: Architectures, Prev: Core Files, Up: BFD front end + +Targets +======= + +*Description* +Each port of BFD to a different machine requires the creation of a +target back end. All the back end provides to the root part of BFD is a +structure containing pointers to functions which perform certain low +level operations on files. BFD translates the applications's requests +through a pointer into calls to the back end routines. + + When a file is opened with `bfd_openr', its format and target are +unknown. BFD uses various mechanisms to determine how to interpret the +file. The operations performed are: + + * Create a BFD by calling the internal routine `_bfd_new_bfd', then + call `bfd_find_target' with the target string supplied to + `bfd_openr' and the new BFD pointer. + + * If a null target string was provided to `bfd_find_target', look up + the environment variable `GNUTARGET' and use that as the target + string. + + * If the target string is still `NULL', or the target string is + `default', then use the first item in the target vector as the + target type, and set `target_defaulted' in the BFD to cause + `bfd_check_format' to loop through all the targets. *Note + bfd_target::. *Note Formats::. + + * Otherwise, inspect the elements in the target vector one by one, + until a match on target name is found. When found, use it. + + * Otherwise return the error `bfd_error_invalid_target' to + `bfd_openr'. + + * `bfd_openr' attempts to open the file using `bfd_open_file', and + returns the BFD. + Once the BFD has been opened and the target selected, the file +format may be determined. This is done by calling `bfd_check_format' on +the BFD with a suggested format. If `target_defaulted' has been set, +each possible target type is tried to see if it recognizes the +specified format. `bfd_check_format' returns `TRUE' when the caller +guesses right. + +* Menu: + +* bfd_target:: + + +File: bfd.info, Node: bfd_target, Prev: Targets, Up: Targets + +bfd_target +---------- + +*Description* +This structure contains everything that BFD knows about a target. It +includes things like its byte order, name, and which routines to call +to do various operations. + + Every BFD points to a target structure with its `xvec' member. + + The macros below are used to dispatch to functions through the +`bfd_target' vector. They are used in a number of macros further down +in `bfd.h', and are also used when calling various routines by hand +inside the BFD implementation. The ARGLIST argument must be +parenthesized; it contains all the arguments to the called function. + + They make the documentation (more) unpleasant to read, so if someone +wants to fix this and not break the above, please do. + #define BFD_SEND(bfd, message, arglist) \ + ((*((bfd)->xvec->message)) arglist) + + #ifdef DEBUG_BFD_SEND + #undef BFD_SEND + #define BFD_SEND(bfd, message, arglist) \ + (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ + ((*((bfd)->xvec->message)) arglist) : \ + (bfd_assert (__FILE__,__LINE__), NULL)) + #endif + For operations which index on the BFD format: + #define BFD_SEND_FMT(bfd, message, arglist) \ + (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) + + #ifdef DEBUG_BFD_SEND + #undef BFD_SEND_FMT + #define BFD_SEND_FMT(bfd, message, arglist) \ + (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ + (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \ + (bfd_assert (__FILE__,__LINE__), NULL)) + #endif + This is the structure which defines the type of BFD this is. The +`xvec' member of the struct `bfd' itself points here. Each module that +implements access to a different target under BFD, defines one of these. + + FIXME, these names should be rationalised with the names of the +entry points which call them. Too bad we can't have one macro to define +them both! + enum bfd_flavour + { + bfd_target_unknown_flavour, + bfd_target_aout_flavour, + bfd_target_coff_flavour, + bfd_target_ecoff_flavour, + bfd_target_xcoff_flavour, + bfd_target_elf_flavour, + bfd_target_ieee_flavour, + bfd_target_nlm_flavour, + bfd_target_oasys_flavour, + bfd_target_tekhex_flavour, + bfd_target_srec_flavour, + bfd_target_ihex_flavour, + bfd_target_som_flavour, + bfd_target_os9k_flavour, + bfd_target_versados_flavour, + bfd_target_msdos_flavour, + bfd_target_ovax_flavour, + bfd_target_evax_flavour, + bfd_target_mmo_flavour, + bfd_target_mach_o_flavour, + bfd_target_pef_flavour, + bfd_target_pef_xlib_flavour, + bfd_target_sym_flavour + }; + + enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN }; + + /* Forward declaration. */ + typedef struct bfd_link_info _bfd_link_info; + + typedef struct bfd_target + { + /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */ + char *name; + + /* The "flavour" of a back end is a general indication about + the contents of a file. */ + enum bfd_flavour flavour; + + /* The order of bytes within the data area of a file. */ + enum bfd_endian byteorder; + + /* The order of bytes within the header parts of a file. */ + enum bfd_endian header_byteorder; + + /* A mask of all the flags which an executable may have set - + from the set `BFD_NO_FLAGS', `HAS_RELOC', ...`D_PAGED'. */ + flagword object_flags; + + /* A mask of all the flags which a section may have set - from + the set `SEC_NO_FLAGS', `SEC_ALLOC', ...`SET_NEVER_LOAD'. */ + flagword section_flags; + + /* The character normally found at the front of a symbol. + (if any), perhaps `_'. */ + char symbol_leading_char; + + /* The pad character for file names within an archive header. */ + char ar_pad_char; + + /* The maximum number of characters in an archive header. */ + unsigned short ar_max_namelen; + + /* Entries for byte swapping for data. These are different from the + other entry points, since they don't take a BFD asthe first argument. + Certain other handlers could do the same. */ + bfd_uint64_t (*bfd_getx64) (const void *); + bfd_int64_t (*bfd_getx_signed_64) (const void *); + void (*bfd_putx64) (bfd_uint64_t, void *); + bfd_vma (*bfd_getx32) (const void *); + bfd_signed_vma (*bfd_getx_signed_32) (const void *); + void (*bfd_putx32) (bfd_vma, void *); + bfd_vma (*bfd_getx16) (const void *); + bfd_signed_vma (*bfd_getx_signed_16) (const void *); + void (*bfd_putx16) (bfd_vma, void *); + + /* Byte swapping for the headers. */ + bfd_uint64_t (*bfd_h_getx64) (const void *); + bfd_int64_t (*bfd_h_getx_signed_64) (const void *); + void (*bfd_h_putx64) (bfd_uint64_t, void *); + bfd_vma (*bfd_h_getx32) (const void *); + bfd_signed_vma (*bfd_h_getx_signed_32) (const void *); + void (*bfd_h_putx32) (bfd_vma, void *); + bfd_vma (*bfd_h_getx16) (const void *); + bfd_signed_vma (*bfd_h_getx_signed_16) (const void *); + void (*bfd_h_putx16) (bfd_vma, void *); + + /* Format dependent routines: these are vectors of entry points + within the target vector structure, one for each format to check. */ + + /* Check the format of a file being read. Return a `bfd_target *' or zero. */ + const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *); + + /* Set the format of a file being written. */ + bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *); + + /* Write cached information into a file being written, at `bfd_close'. */ + bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *); + The general target vector. These vectors are initialized using the +BFD_JUMP_TABLE macros. + + /* Generic entry points. */ + #define BFD_JUMP_TABLE_GENERIC(NAME) \ + NAME##_close_and_cleanup, \ + NAME##_bfd_free_cached_info, \ + NAME##_new_section_hook, \ + NAME##_get_section_contents, \ + NAME##_get_section_contents_in_window + + /* Called when the BFD is being closed to do any necessary cleanup. */ + bfd_boolean (*_close_and_cleanup) (bfd *); + /* Ask the BFD to free all cached information. */ + bfd_boolean (*_bfd_free_cached_info) (bfd *); + /* Called when a new section is created. */ + bfd_boolean (*_new_section_hook) (bfd *, sec_ptr); + /* Read the contents of a section. */ + bfd_boolean (*_bfd_get_section_contents) + (bfd *, sec_ptr, void *, file_ptr, bfd_size_type); + bfd_boolean (*_bfd_get_section_contents_in_window) + (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type); + + /* Entry points to copy private data. */ + #define BFD_JUMP_TABLE_COPY(NAME) \ + NAME##_bfd_copy_private_bfd_data, \ + NAME##_bfd_merge_private_bfd_data, \ + NAME##_bfd_copy_private_section_data, \ + NAME##_bfd_copy_private_symbol_data, \ + NAME##_bfd_set_private_flags, \ + NAME##_bfd_print_private_bfd_data + + /* Called to copy BFD general private data from one object file + to another. */ + bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *); + /* Called to merge BFD general private data from one object file + to a common output file when linking. */ + bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *); + /* Called to copy BFD private section data from one object file + to another. */ + bfd_boolean (*_bfd_copy_private_section_data) + (bfd *, sec_ptr, bfd *, sec_ptr); + /* Called to copy BFD private symbol data from one symbol + to another. */ + bfd_boolean (*_bfd_copy_private_symbol_data) + (bfd *, asymbol *, bfd *, asymbol *); + /* Called to set private backend flags. */ + bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword); + + /* Called to print private BFD data. */ + bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *); + + /* Core file entry points. */ + #define BFD_JUMP_TABLE_CORE(NAME) \ + NAME##_core_file_failing_command, \ + NAME##_core_file_failing_signal, \ + NAME##_core_file_matches_executable_p + + char * (*_core_file_failing_command) (bfd *); + int (*_core_file_failing_signal) (bfd *); + bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *); + + /* Archive entry points. */ + #define BFD_JUMP_TABLE_ARCHIVE(NAME) \ + NAME##_slurp_armap, \ + NAME##_slurp_extended_name_table, \ + NAME##_construct_extended_name_table, \ + NAME##_truncate_arname, \ + NAME##_write_armap, \ + NAME##_read_ar_hdr, \ + NAME##_openr_next_archived_file, \ + NAME##_get_elt_at_index, \ + NAME##_generic_stat_arch_elt, \ + NAME##_update_armap_timestamp + + bfd_boolean (*_bfd_slurp_armap) (bfd *); + bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *); + bfd_boolean (*_bfd_construct_extended_name_table) + (bfd *, char **, bfd_size_type *, const char **); + void (*_bfd_truncate_arname) (bfd *, const char *, char *); + bfd_boolean (*write_armap) + (bfd *, unsigned int, struct orl *, unsigned int, int); + void * (*_bfd_read_ar_hdr_fn) (bfd *); + bfd * (*openr_next_archived_file) (bfd *, bfd *); + #define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i)) + bfd * (*_bfd_get_elt_at_index) (bfd *, symindex); + int (*_bfd_stat_arch_elt) (bfd *, struct stat *); + bfd_boolean (*_bfd_update_armap_timestamp) (bfd *); + + /* Entry points used for symbols. */ + #define BFD_JUMP_TABLE_SYMBOLS(NAME) \ + NAME##_get_symtab_upper_bound, \ + NAME##_canonicalize_symtab, \ + NAME##_make_empty_symbol, \ + NAME##_print_symbol, \ + NAME##_get_symbol_info, \ + NAME##_bfd_is_local_label_name, \ + NAME##_get_lineno, \ + NAME##_find_nearest_line, \ + NAME##_bfd_make_debug_symbol, \ + NAME##_read_minisymbols, \ + NAME##_minisymbol_to_symbol + + long (*_bfd_get_symtab_upper_bound) (bfd *); + long (*_bfd_canonicalize_symtab) + (bfd *, struct bfd_symbol **); + struct bfd_symbol * + (*_bfd_make_empty_symbol) (bfd *); + void (*_bfd_print_symbol) + (bfd *, void *, struct bfd_symbol *, bfd_print_symbol_type); + #define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e)) + void (*_bfd_get_symbol_info) + (bfd *, struct bfd_symbol *, symbol_info *); + #define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) + bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); + + alent * (*_get_lineno) (bfd *, struct bfd_symbol *); + bfd_boolean (*_bfd_find_nearest_line) + (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, + const char **, const char **, unsigned int *); + /* Back-door to allow format-aware applications to create debug symbols + while using BFD for everything else. Currently used by the assembler + when creating COFF files. */ + asymbol * (*_bfd_make_debug_symbol) + (bfd *, void *, unsigned long size); + #define bfd_read_minisymbols(b, d, m, s) \ + BFD_SEND (b, _read_minisymbols, (b, d, m, s)) + long (*_read_minisymbols) + (bfd *, bfd_boolean, void **, unsigned int *); + #define bfd_minisymbol_to_symbol(b, d, m, f) \ + BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f)) + asymbol * (*_minisymbol_to_symbol) + (bfd *, bfd_boolean, const void *, asymbol *); + + /* Routines for relocs. */ + #define BFD_JUMP_TABLE_RELOCS(NAME) \ + NAME##_get_reloc_upper_bound, \ + NAME##_canonicalize_reloc, \ + NAME##_bfd_reloc_type_lookup + + long (*_get_reloc_upper_bound) (bfd *, sec_ptr); + long (*_bfd_canonicalize_reloc) + (bfd *, sec_ptr, arelent **, struct bfd_symbol **); + /* See documentation on reloc types. */ + reloc_howto_type * + (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); + + /* Routines used when writing an object file. */ + #define BFD_JUMP_TABLE_WRITE(NAME) \ + NAME##_set_arch_mach, \ + NAME##_set_section_contents + + bfd_boolean (*_bfd_set_arch_mach) + (bfd *, enum bfd_architecture, unsigned long); + bfd_boolean (*_bfd_set_section_contents) + (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type); + + /* Routines used by the linker. */ + #define BFD_JUMP_TABLE_LINK(NAME) \ + NAME##_sizeof_headers, \ + NAME##_bfd_get_relocated_section_contents, \ + NAME##_bfd_relax_section, \ + NAME##_bfd_link_hash_table_create, \ + NAME##_bfd_link_hash_table_free, \ + NAME##_bfd_link_add_symbols, \ + NAME##_bfd_link_just_syms, \ + NAME##_bfd_final_link, \ + NAME##_bfd_link_split_section, \ + NAME##_bfd_gc_sections, \ + NAME##_bfd_merge_sections, \ + NAME##_bfd_discard_group + + int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); + bfd_byte * (*_bfd_get_relocated_section_contents) + (bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, bfd_boolean, struct bfd_symbol **); + + bfd_boolean (*_bfd_relax_section) + (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *); + + /* Create a hash table for the linker. Different backends store + different information in this table. */ + struct bfd_link_hash_table * + (*_bfd_link_hash_table_create) (bfd *); + + /* Release the memory associated with the linker hash table. */ + void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *); + + /* Add symbols from this object file into the hash table. */ + bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *); + + /* Indicate that we are only retrieving symbol values from this section. */ + void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *); + + /* Do a link based on the link_order structures attached to each + section of the BFD. */ + bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *); + + /* Should this section be split up into smaller pieces during linking. */ + bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *); + + /* Remove sections that are not referenced from the output. */ + bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *); + + /* Attempt to merge SEC_MERGE sections. */ + bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); + + /* Discard members of a group. */ + bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *); + + /* Routines to handle dynamic symbols and relocs. */ + #define BFD_JUMP_TABLE_DYNAMIC(NAME) \ + NAME##_get_dynamic_symtab_upper_bound, \ + NAME##_canonicalize_dynamic_symtab, \ + NAME##_get_dynamic_reloc_upper_bound, \ + NAME##_canonicalize_dynamic_reloc + + /* Get the amount of memory required to hold the dynamic symbols. */ + long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *); + /* Read in the dynamic symbols. */ + long (*_bfd_canonicalize_dynamic_symtab) + (bfd *, struct bfd_symbol **); + /* Get the amount of memory required to hold the dynamic relocs. */ + long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *); + /* Read in the dynamic relocs. */ + long (*_bfd_canonicalize_dynamic_reloc) + (bfd *, arelent **, struct bfd_symbol **); + A pointer to an alternative bfd_target in case the current one is not +satisfactory. This can happen when the target cpu supports both big +and little endian code, and target chosen by the linker has the wrong +endianness. The function open_output() in ld/ldlang.c uses this field +to find an alternative output format that is suitable. + /* Opposite endian version of this target. */ + const struct bfd_target * alternative_target; + + /* Data for use by back-end routines, which isn't + generic enough to belong in this structure. */ + const void *backend_data; + + } bfd_target; + +`bfd_set_default_target' +........................ + +*Synopsis* + bfd_boolean bfd_set_default_target (const char *name); + *Description* +Set the default target vector to use when recognizing a BFD. This +takes the name of the target, which may be a BFD target name or a +configuration triplet. + +`bfd_find_target' +................. + +*Synopsis* + const bfd_target *bfd_find_target (const char *target_name, bfd *abfd); + *Description* +Return a pointer to the transfer vector for the object target named +TARGET_NAME. If TARGET_NAME is `NULL', choose the one in the +environment variable `GNUTARGET'; if that is null or not defined, then +choose the first entry in the target list. Passing in the string +"default" or setting the environment variable to "default" will cause +the first entry in the target list to be returned, and +"target_defaulted" will be set in the BFD. This causes +`bfd_check_format' to loop over all the targets to find the one that +matches the file being read. + +`bfd_target_list' +................. + +*Synopsis* + const char ** bfd_target_list (void); + *Description* +Return a freshly malloced NULL-terminated vector of the names of all +the valid BFD targets. Do not modify the names. + +`bfd_seach_for_target' +...................... + +*Synopsis* + const bfd_target *bfd_search_for_target + (int (*search_func) (const bfd_target *, void *), + void *); + *Description* +Return a pointer to the first transfer vector in the list of transfer +vectors maintained by BFD that produces a non-zero result when passed +to the function SEARCH_FUNC. The parameter DATA is passed, unexamined, +to the search function. + + +File: bfd.info, Node: Architectures, Next: Opening and Closing, Prev: Targets, Up: BFD front end + +Architectures +============= + +BFD keeps one atom in a BFD describing the architecture of the data +attached to the BFD: a pointer to a `bfd_arch_info_type'. + + Pointers to structures can be requested independently of a BFD so +that an architecture's information can be interrogated without access +to an open BFD. + + The architecture information is provided by each architecture +package. The set of default architectures is selected by the macro +`SELECT_ARCHITECTURES'. This is normally set up in the +`config/TARGET.mt' file of your choice. If the name is not defined, +then all the architectures supported are included. + + When BFD starts up, all the architectures are called with an +initialize method. It is up to the architecture back end to insert as +many items into the list of architectures as it wants to; generally +this would be one for each machine and one for the default case (an +item with a machine field of 0). + + BFD's idea of an architecture is implemented in `archures.c'. + +bfd_architecture +---------------- + +*Description* +This enum gives the object file's CPU architecture, in a global +sense--i.e., what processor family does it belong to? Another field +indicates which processor within the family is in use. The machine +gives a number which distinguishes different versions of the +architecture, containing, for example, 2 and 3 for Intel i960 KA and +i960 KB, and 68020 and 68030 for Motorola 68020 and 68030. + enum bfd_architecture + { + bfd_arch_unknown, /* File arch not known. */ + bfd_arch_obscure, /* Arch known, not one of these. */ + bfd_arch_m68k, /* Motorola 68xxx */ + #define bfd_mach_m68000 1 + #define bfd_mach_m68008 2 + #define bfd_mach_m68010 3 + #define bfd_mach_m68020 4 + #define bfd_mach_m68030 5 + #define bfd_mach_m68040 6 + #define bfd_mach_m68060 7 + #define bfd_mach_cpu32 8 + #define bfd_mach_mcf5200 9 + #define bfd_mach_mcf5206e 10 + #define bfd_mach_mcf5307 11 + #define bfd_mach_mcf5407 12 + #define bfd_mach_mcf528x 13 + bfd_arch_vax, /* DEC Vax */ + bfd_arch_i960, /* Intel 960 */ + /* The order of the following is important. + lower number indicates a machine type that + only accepts a subset of the instructions + available to machines with higher numbers. + The exception is the "ca", which is + incompatible with all other machines except + "core". */ + + #define bfd_mach_i960_core 1 + #define bfd_mach_i960_ka_sa 2 + #define bfd_mach_i960_kb_sb 3 + #define bfd_mach_i960_mc 4 + #define bfd_mach_i960_xa 5 + #define bfd_mach_i960_ca 6 + #define bfd_mach_i960_jx 7 + #define bfd_mach_i960_hx 8 + + bfd_arch_or32, /* OpenRISC 32 */ + + bfd_arch_a29k, /* AMD 29000 */ + bfd_arch_sparc, /* SPARC */ + #define bfd_mach_sparc 1 + /* The difference between v8plus and v9 is that v9 is a true 64 bit env. */ + #define bfd_mach_sparc_sparclet 2 + #define bfd_mach_sparc_sparclite 3 + #define bfd_mach_sparc_v8plus 4 + #define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */ + #define bfd_mach_sparc_sparclite_le 6 + #define bfd_mach_sparc_v9 7 + #define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */ + #define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */ + #define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */ + /* Nonzero if MACH has the v9 instruction set. */ + #define bfd_mach_sparc_v9_p(mach) \ + ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \ + && (mach) != bfd_mach_sparc_sparclite_le) + bfd_arch_mips, /* MIPS Rxxxx */ + #define bfd_mach_mips3000 3000 + #define bfd_mach_mips3900 3900 + #define bfd_mach_mips4000 4000 + #define bfd_mach_mips4010 4010 + #define bfd_mach_mips4100 4100 + #define bfd_mach_mips4111 4111 + #define bfd_mach_mips4120 4120 + #define bfd_mach_mips4300 4300 + #define bfd_mach_mips4400 4400 + #define bfd_mach_mips4600 4600 + #define bfd_mach_mips4650 4650 + #define bfd_mach_mips5000 5000 + #define bfd_mach_mips5400 5400 + #define bfd_mach_mips5500 5500 + #define bfd_mach_mips6000 6000 + #define bfd_mach_mips7000 7000 + #define bfd_mach_mips8000 8000 + #define bfd_mach_mips10000 10000 + #define bfd_mach_mips12000 12000 + #define bfd_mach_mips16 16 + #define bfd_mach_mips5 5 + #define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */ + #define bfd_mach_mipsisa32 32 + #define bfd_mach_mipsisa32r2 33 + #define bfd_mach_mipsisa64 64 + #define bfd_mach_mipsisa64r2 65 + bfd_arch_i386, /* Intel 386 */ + #define bfd_mach_i386_i386 1 + #define bfd_mach_i386_i8086 2 + #define bfd_mach_i386_i386_intel_syntax 3 + #define bfd_mach_x86_64 64 + #define bfd_mach_x86_64_intel_syntax 65 + bfd_arch_we32k, /* AT&T WE32xxx */ + bfd_arch_tahoe, /* CCI/Harris Tahoe */ + bfd_arch_i860, /* Intel 860 */ + bfd_arch_i370, /* IBM 360/370 Mainframes */ + bfd_arch_romp, /* IBM ROMP PC/RT */ + bfd_arch_alliant, /* Alliant */ + bfd_arch_convex, /* Convex */ + bfd_arch_m88k, /* Motorola 88xxx */ + bfd_arch_m98k, /* Motorola 98xxx */ + bfd_arch_pyramid, /* Pyramid Technology */ + bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */ + #define bfd_mach_h8300 1 + #define bfd_mach_h8300h 2 + #define bfd_mach_h8300s 3 + #define bfd_mach_h8300hn 4 + #define bfd_mach_h8300sn 5 + #define bfd_mach_h8300sx 6 + #define bfd_mach_h8300sxn 7 + bfd_arch_pdp11, /* DEC PDP-11 */ + bfd_arch_powerpc, /* PowerPC */ + #define bfd_mach_ppc 32 + #define bfd_mach_ppc64 64 + #define bfd_mach_ppc_403 403 + #define bfd_mach_ppc_403gc 4030 + #define bfd_mach_ppc_505 505 + #define bfd_mach_ppc_601 601 + #define bfd_mach_ppc_602 602 + #define bfd_mach_ppc_603 603 + #define bfd_mach_ppc_ec603e 6031 + #define bfd_mach_ppc_604 604 + #define bfd_mach_ppc_620 620 + #define bfd_mach_ppc_630 630 + #define bfd_mach_ppc_750 750 + #define bfd_mach_ppc_860 860 + #define bfd_mach_ppc_a35 35 + #define bfd_mach_ppc_rs64ii 642 + #define bfd_mach_ppc_rs64iii 643 + #define bfd_mach_ppc_7400 7400 + #define bfd_mach_ppc_e500 500 + bfd_arch_rs6000, /* IBM RS/6000 */ + #define bfd_mach_rs6k 6000 + #define bfd_mach_rs6k_rs1 6001 + #define bfd_mach_rs6k_rsc 6003 + #define bfd_mach_rs6k_rs2 6002 + bfd_arch_hppa, /* HP PA RISC */ + #define bfd_mach_hppa10 10 + #define bfd_mach_hppa11 11 + #define bfd_mach_hppa20 20 + #define bfd_mach_hppa20w 25 + bfd_arch_d10v, /* Mitsubishi D10V */ + #define bfd_mach_d10v 1 + #define bfd_mach_d10v_ts2 2 + #define bfd_mach_d10v_ts3 3 + bfd_arch_d30v, /* Mitsubishi D30V */ + bfd_arch_dlx, /* DLX */ + bfd_arch_m68hc11, /* Motorola 68HC11 */ + bfd_arch_m68hc12, /* Motorola 68HC12 */ + #define bfd_mach_m6812_default 0 + #define bfd_mach_m6812 1 + #define bfd_mach_m6812s 2 + bfd_arch_z8k, /* Zilog Z8000 */ + #define bfd_mach_z8001 1 + #define bfd_mach_z8002 2 + bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */ + bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */ + #define bfd_mach_sh 1 + #define bfd_mach_sh2 0x20 + #define bfd_mach_sh_dsp 0x2d + #define bfd_mach_sh2e 0x2e + #define bfd_mach_sh3 0x30 + #define bfd_mach_sh3_dsp 0x3d + #define bfd_mach_sh3e 0x3e + #define bfd_mach_sh4 0x40 + #define bfd_mach_sh4_nofpu 0x41 + #define bfd_mach_sh4a 0x4a + #define bfd_mach_sh4a_nofpu 0x4b + #define bfd_mach_sh4al_dsp 0x4d + #define bfd_mach_sh5 0x50 + bfd_arch_alpha, /* Dec Alpha */ + #define bfd_mach_alpha_ev4 0x10 + #define bfd_mach_alpha_ev5 0x20 + #define bfd_mach_alpha_ev6 0x30 + bfd_arch_arm, /* Advanced Risc Machines ARM. */ + #define bfd_mach_arm_unknown 0 + #define bfd_mach_arm_2 1 + #define bfd_mach_arm_2a 2 + #define bfd_mach_arm_3 3 + #define bfd_mach_arm_3M 4 + #define bfd_mach_arm_4 5 + #define bfd_mach_arm_4T 6 + #define bfd_mach_arm_5 7 + #define bfd_mach_arm_5T 8 + #define bfd_mach_arm_5TE 9 + #define bfd_mach_arm_XScale 10 + #define bfd_mach_arm_ep9312 11 + #define bfd_mach_arm_iWMMXt 12 + bfd_arch_ns32k, /* National Semiconductors ns32000 */ + bfd_arch_w65, /* WDC 65816 */ + bfd_arch_tic30, /* Texas Instruments TMS320C30 */ + bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */ + #define bfd_mach_tic3x 30 + #define bfd_mach_tic4x 40 + bfd_arch_tic54x, /* Texas Instruments TMS320C54X */ + bfd_arch_tic80, /* TI TMS320c80 (MVP) */ + bfd_arch_v850, /* NEC V850 */ + #define bfd_mach_v850 1 + #define bfd_mach_v850e 'E' + #define bfd_mach_v850e1 '1' + bfd_arch_arc, /* ARC Cores */ + #define bfd_mach_arc_5 5 + #define bfd_mach_arc_6 6 + #define bfd_mach_arc_7 7 + #define bfd_mach_arc_8 8 + bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */ + #define bfd_mach_m32r 1 /* For backwards compatibility. */ + #define bfd_mach_m32rx 'x' + #define bfd_mach_m32r2 '2' + bfd_arch_mn10200, /* Matsushita MN10200 */ + bfd_arch_mn10300, /* Matsushita MN10300 */ + #define bfd_mach_mn10300 300 + #define bfd_mach_am33 330 + #define bfd_mach_am33_2 332 + bfd_arch_fr30, + #define bfd_mach_fr30 0x46523330 + bfd_arch_frv, + #define bfd_mach_frv 1 + #define bfd_mach_frvsimple 2 + #define bfd_mach_fr300 300 + #define bfd_mach_fr400 400 + #define bfd_mach_frvtomcat 499 /* fr500 prototype */ + #define bfd_mach_fr500 500 + #define bfd_mach_fr550 550 + bfd_arch_mcore, + bfd_arch_ia64, /* HP/Intel ia64 */ + #define bfd_mach_ia64_elf64 64 + #define bfd_mach_ia64_elf32 32 + bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */ + #define bfd_mach_ip2022 1 + #define bfd_mach_ip2022ext 2 + bfd_arch_iq2000, /* Vitesse IQ2000. */ + #define bfd_mach_iq2000 1 + #define bfd_mach_iq10 2 + bfd_arch_pj, + bfd_arch_avr, /* Atmel AVR microcontrollers. */ + #define bfd_mach_avr1 1 + #define bfd_mach_avr2 2 + #define bfd_mach_avr3 3 + #define bfd_mach_avr4 4 + #define bfd_mach_avr5 5 + bfd_arch_cris, /* Axis CRIS */ + bfd_arch_s390, /* IBM s390 */ + #define bfd_mach_s390_31 31 + #define bfd_mach_s390_64 64 + bfd_arch_openrisc, /* OpenRISC */ + bfd_arch_mmix, /* Donald Knuth's educational processor. */ + bfd_arch_xstormy16, + #define bfd_mach_xstormy16 1 + bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */ + #define bfd_mach_msp11 11 + #define bfd_mach_msp110 110 + #define bfd_mach_msp12 12 + #define bfd_mach_msp13 13 + #define bfd_mach_msp14 14 + #define bfd_mach_msp15 15 + #define bfd_mach_msp16 16 + #define bfd_mach_msp31 31 + #define bfd_mach_msp32 32 + #define bfd_mach_msp33 33 + #define bfd_mach_msp41 41 + #define bfd_mach_msp42 42 + #define bfd_mach_msp43 43 + #define bfd_mach_msp44 44 + bfd_arch_xtensa, /* Tensilica's Xtensa cores. */ + #define bfd_mach_xtensa 1 + bfd_arch_last + }; + +bfd_arch_info +------------- + +*Description* +This structure contains information on architectures for use within BFD. + + typedef struct bfd_arch_info + { + int bits_per_word; + int bits_per_address; + int bits_per_byte; + enum bfd_architecture arch; + unsigned long mach; + const char *arch_name; + const char *printable_name; + unsigned int section_align_power; + /* TRUE if this is the default machine for the architecture. + The default arch should be the first entry for an arch so that + all the entries for that arch can be accessed via `next'. */ + bfd_boolean the_default; + const struct bfd_arch_info * (*compatible) + (const struct bfd_arch_info *a, const struct bfd_arch_info *b); + + bfd_boolean (*scan) (const struct bfd_arch_info *, const char *); + + const struct bfd_arch_info *next; + } + bfd_arch_info_type; + +`bfd_printable_name' +.................... + +*Synopsis* + const char *bfd_printable_name (bfd *abfd); + *Description* +Return a printable string representing the architecture and machine +from the pointer to the architecture info structure. + +`bfd_scan_arch' +............... + +*Synopsis* + const bfd_arch_info_type *bfd_scan_arch (const char *string); + *Description* +Figure out if BFD supports any cpu which could be described with the +name STRING. Return a pointer to an `arch_info' structure if a machine +is found, otherwise NULL. + +`bfd_arch_list' +............... + +*Synopsis* + const char **bfd_arch_list (void); + *Description* +Return a freshly malloced NULL-terminated vector of the names of all +the valid BFD architectures. Do not modify the names. + +`bfd_arch_get_compatible' +......................... + +*Synopsis* + const bfd_arch_info_type *bfd_arch_get_compatible + (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns); + *Description* +Determine whether two BFDs' architectures and machine types are +compatible. Calculates the lowest common denominator between the two +architectures and machine types implied by the BFDs and returns a +pointer to an `arch_info' structure describing the compatible machine. + +`bfd_default_arch_struct' +......................... + +*Description* +The `bfd_default_arch_struct' is an item of `bfd_arch_info_type' which +has been initialized to a fairly generic state. A BFD starts life by +pointing to this structure, until the correct back end has determined +the real architecture of the file. + extern const bfd_arch_info_type bfd_default_arch_struct; + +`bfd_set_arch_info' +................... + +*Synopsis* + void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg); + *Description* +Set the architecture info of ABFD to ARG. + +`bfd_default_set_arch_mach' +........................... + +*Synopsis* + bfd_boolean bfd_default_set_arch_mach + (bfd *abfd, enum bfd_architecture arch, unsigned long mach); + *Description* +Set the architecture and machine type in BFD ABFD to ARCH and MACH. +Find the correct pointer to a structure and insert it into the +`arch_info' pointer. + +`bfd_get_arch' +.............. + +*Synopsis* + enum bfd_architecture bfd_get_arch (bfd *abfd); + *Description* +Return the enumerated type which describes the BFD ABFD's architecture. + +`bfd_get_mach' +.............. + +*Synopsis* + unsigned long bfd_get_mach (bfd *abfd); + *Description* +Return the long type which describes the BFD ABFD's machine. + +`bfd_arch_bits_per_byte' +........................ + +*Synopsis* + unsigned int bfd_arch_bits_per_byte (bfd *abfd); + *Description* +Return the number of bits in one of the BFD ABFD's architecture's bytes. + +`bfd_arch_bits_per_address' +........................... + +*Synopsis* + unsigned int bfd_arch_bits_per_address (bfd *abfd); + *Description* +Return the number of bits in one of the BFD ABFD's architecture's +addresses. + +`bfd_default_compatible' +........................ + +*Synopsis* + const bfd_arch_info_type *bfd_default_compatible + (const bfd_arch_info_type *a, const bfd_arch_info_type *b); + *Description* +The default function for testing for compatibility. + +`bfd_default_scan' +.................. + +*Synopsis* + bfd_boolean bfd_default_scan + (const struct bfd_arch_info *info, const char *string); + *Description* +The default function for working out whether this is an architecture +hit and a machine hit. + +`bfd_get_arch_info' +................... + +*Synopsis* + const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd); + *Description* +Return the architecture info struct in ABFD. + +`bfd_lookup_arch' +................. + +*Synopsis* + const bfd_arch_info_type *bfd_lookup_arch + (enum bfd_architecture arch, unsigned long machine); + *Description* +Look for the architecture info structure which matches the arguments +ARCH and MACHINE. A machine of 0 matches the machine/architecture +structure which marks itself as the default. + +`bfd_printable_arch_mach' +......................... + +*Synopsis* + const char *bfd_printable_arch_mach + (enum bfd_architecture arch, unsigned long machine); + *Description* +Return a printable string representing the architecture and machine +type. + + This routine is depreciated. + +`bfd_octets_per_byte' +..................... + +*Synopsis* + unsigned int bfd_octets_per_byte (bfd *abfd); + *Description* +Return the number of octets (8-bit quantities) per target byte (minimum +addressable unit). In most cases, this will be one, but some DSP +targets have 16, 32, or even 48 bits per byte. + +`bfd_arch_mach_octets_per_byte' +............................... + +*Synopsis* + unsigned int bfd_arch_mach_octets_per_byte + (enum bfd_architecture arch, unsigned long machine); + *Description* +See bfd_octets_per_byte. + + This routine is provided for those cases where a bfd * is not +available + + +File: bfd.info, Node: Opening and Closing, Next: Internal, Prev: Architectures, Up: BFD front end + +Opening and closing BFDs +======================== + +`bfd_openr' +........... + +*Synopsis* + bfd *bfd_openr (const char *filename, const char *target); + *Description* +Open the file FILENAME (using `fopen') with the target TARGET. Return +a pointer to the created BFD. + + Calls `bfd_find_target', so TARGET is interpreted as by that +function. + + If `NULL' is returned then an error has occured. Possible errors +are `bfd_error_no_memory', `bfd_error_invalid_target' or `system_call' +error. + +`bfd_fdopenr' +............. + +*Synopsis* + bfd *bfd_fdopenr (const char *filename, const char *target, int fd); + *Description* +`bfd_fdopenr' is to `bfd_fopenr' much like `fdopen' is to `fopen'. It +opens a BFD on a file already described by the FD supplied. + + When the file is later `bfd_close'd, the file descriptor will be +closed. If the caller desires that this file descriptor be cached by +BFD (opened as needed, closed as needed to free descriptors for other +opens), with the supplied FD used as an initial file descriptor (but +subject to closure at any time), call bfd_set_cacheable(bfd, 1) on the +returned BFD. The default is to assume no caching; the file descriptor +will remain open until `bfd_close', and will not be affected by BFD +operations on other files. + + Possible errors are `bfd_error_no_memory', +`bfd_error_invalid_target' and `bfd_error_system_call'. + +`bfd_openstreamr' +................. + +*Synopsis* + bfd *bfd_openstreamr (const char *, const char *, void *); + *Description* +Open a BFD for read access on an existing stdio stream. When the BFD +is passed to `bfd_close', the stream will be closed. + +`bfd_openw' +........... + +*Synopsis* + bfd *bfd_openw (const char *filename, const char *target); + *Description* +Create a BFD, associated with file FILENAME, using the file format +TARGET, and return a pointer to it. + + Possible errors are `bfd_error_system_call', `bfd_error_no_memory', +`bfd_error_invalid_target'. + +`bfd_close' +........... + +*Synopsis* + bfd_boolean bfd_close (bfd *abfd); + *Description* +Close a BFD. If the BFD was open for writing, then pending operations +are completed and the file written out and closed. If the created file +is executable, then `chmod' is called to mark it as such. + + All memory attached to the BFD is released. + + The file descriptor associated with the BFD is closed (even if it +was passed in to BFD by `bfd_fdopenr'). + + *Returns* +`TRUE' is returned if all is ok, otherwise `FALSE'. + +`bfd_close_all_done' +.................... + +*Synopsis* + bfd_boolean bfd_close_all_done (bfd *); + *Description* +Close a BFD. Differs from `bfd_close' since it does not complete any +pending operations. This routine would be used if the application had +just used BFD for swapping and didn't want to use any of the writing +code. + + If the created file is executable, then `chmod' is called to mark it +as such. + + All memory attached to the BFD is released. + + *Returns* +`TRUE' is returned if all is ok, otherwise `FALSE'. + +`bfd_create' +............ + +*Synopsis* + bfd *bfd_create (const char *filename, bfd *templ); + *Description* +Create a new BFD in the manner of `bfd_openw', but without opening a +file. The new BFD takes the target from the target used by TEMPLATE. +The format is always set to `bfd_object'. + +`bfd_make_writable' +................... + +*Synopsis* + bfd_boolean bfd_make_writable (bfd *abfd); + *Description* +Takes a BFD as created by `bfd_create' and converts it into one like as +returned by `bfd_openw'. It does this by converting the BFD to +BFD_IN_MEMORY. It's assumed that you will call `bfd_make_readable' on +this bfd later. + + *Returns* +`TRUE' is returned if all is ok, otherwise `FALSE'. + +`bfd_make_readable' +................... + +*Synopsis* + bfd_boolean bfd_make_readable (bfd *abfd); + *Description* +Takes a BFD as created by `bfd_create' and `bfd_make_writable' and +converts it into one like as returned by `bfd_openr'. It does this by +writing the contents out to the memory buffer, then reversing the +direction. + + *Returns* +`TRUE' is returned if all is ok, otherwise `FALSE'. + +`bfd_alloc' +........... + +*Synopsis* + void *bfd_alloc (bfd *abfd, size_t wanted); + *Description* +Allocate a block of WANTED bytes of memory attached to `abfd' and +return a pointer to it. + +`bfd_calc_gnu_debuglink_crc32' +.............................. + +*Synopsis* + unsigned long bfd_calc_gnu_debuglink_crc32 + (unsigned long crc, const unsigned char *buf, bfd_size_type len); + *Description* +Computes a CRC value as used in the .gnu_debuglink section. Advances +the previously computed CRC value by computing and adding in the crc32 +for LEN bytes of BUF. + + *Returns* +Return the updated CRC32 value. + +`get_debug_link_info' +..................... + +*Synopsis* + char *get_debug_link_info (bfd *abfd, unsigned long *crc32_out); + *Description* +fetch the filename and CRC32 value for any separate debuginfo +associated with ABFD. Return NULL if no such info found, otherwise +return filename and update CRC32_OUT. + +`separate_debug_file_exists' +............................ + +*Synopsis* + bfd_boolean separate_debug_file_exists + (char *name, unsigned long crc32); + *Description* +Checks to see if NAME is a file and if its contents match CRC32. + +`find_separate_debug_file' +.......................... + +*Synopsis* + char *find_separate_debug_file (bfd *abfd); + *Description* +Searches ABFD for a reference to separate debugging information, scans +various locations in the filesystem, including the file tree rooted at +DEBUG_FILE_DIRECTORY, and returns a filename of such debugging +information if the file is found and has matching CRC32. Returns NULL +if no reference to debugging file exists, or file cannot be found. + +`bfd_follow_gnu_debuglink' +.......................... + +*Synopsis* + char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir); + *Description* +Takes a BFD and searches it for a .gnu_debuglink section. If this +section is found, it examines the section for the name and checksum of +a '.debug' file containing auxiliary debugging information. It then +searches the filesystem for this .debug file in some standard +locations, including the directory tree rooted at DIR, and if found +returns the full filename. + + If DIR is NULL, it will search a default path configured into libbfd +at build time. [XXX this feature is not currently implemented]. + + *Returns* +`NULL' on any errors or failure to locate the .debug file, otherwise a +pointer to a heap-allocated string containing the filename. The caller +is responsible for freeing this string. + +`bfd_create_gnu_debuglink_section' +.................................. + +*Synopsis* + struct bfd_section *bfd_create_gnu_debuglink_section + (bfd *abfd, const char *filename); + *Description* +Takes a BFD and adds a .gnu_debuglink section to it. The section is +sized to be big enough to contain a link to the specified FILENAME. + + *Returns* +A pointer to the new section is returned if all is ok. Otherwise +`NULL' is returned and bfd_error is set. + +`bfd_fill_in_gnu_debuglink_section' +................................... + +*Synopsis* + bfd_boolean bfd_fill_in_gnu_debuglink_section + (bfd *abfd, struct bfd_section *sect, const char *filename); + *Description* +Takes a BFD and containing a .gnu_debuglink section SECT and fills in +the contents of the section to contain a link to the specified +FILENAME. The filename should be relative to the current directory. + + *Returns* +`TRUE' is returned if all is ok. Otherwise `FALSE' is returned and +bfd_error is set. + + +File: bfd.info, Node: Internal, Next: File Caching, Prev: Opening and Closing, Up: BFD front end + +Internal functions +================== + +*Description* +These routines are used within BFD. They are not intended for export, +but are documented here for completeness. + +`bfd_write_bigendian_4byte_int' +............................... + +*Synopsis* + bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int); + *Description* +Write a 4 byte integer I to the output BFD ABFD, in big endian order +regardless of what else is going on. This is useful in archives. + +`bfd_put_size' +.............. + +`bfd_get_size' +.............. + +*Description* +These macros as used for reading and writing raw data in sections; each +access (except for bytes) is vectored through the target format of the +BFD and mangled accordingly. The mangling performs any necessary endian +translations and removes alignment restrictions. Note that types +accepted and returned by these macros are identical so they can be +swapped around in macros--for example, `libaout.h' defines `GET_WORD' +to either `bfd_get_32' or `bfd_get_64'. + + In the put routines, VAL must be a `bfd_vma'. If we are on a system +without prototypes, the caller is responsible for making sure that is +true, with a cast if necessary. We don't cast them in the macro +definitions because that would prevent `lint' or `gcc -Wall' from +detecting sins such as passing a pointer. To detect calling these with +less than a `bfd_vma', use `gcc -Wconversion' on a host with 64 bit +`bfd_vma''s. + + /* Byte swapping macros for user section data. */ + + #define bfd_put_8(abfd, val, ptr) \ + ((void) (*((unsigned char *) (ptr)) = (val) & 0xff)) + #define bfd_put_signed_8 \ + bfd_put_8 + #define bfd_get_8(abfd, ptr) \ + (*(unsigned char *) (ptr) & 0xff) + #define bfd_get_signed_8(abfd, ptr) \ + (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) + + #define bfd_put_16(abfd, val, ptr) \ + BFD_SEND (abfd, bfd_putx16, ((val),(ptr))) + #define bfd_put_signed_16 \ + bfd_put_16 + #define bfd_get_16(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx16, (ptr)) + #define bfd_get_signed_16(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx_signed_16, (ptr)) + + #define bfd_put_32(abfd, val, ptr) \ + BFD_SEND (abfd, bfd_putx32, ((val),(ptr))) + #define bfd_put_signed_32 \ + bfd_put_32 + #define bfd_get_32(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx32, (ptr)) + #define bfd_get_signed_32(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx_signed_32, (ptr)) + + #define bfd_put_64(abfd, val, ptr) \ + BFD_SEND (abfd, bfd_putx64, ((val), (ptr))) + #define bfd_put_signed_64 \ + bfd_put_64 + #define bfd_get_64(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx64, (ptr)) + #define bfd_get_signed_64(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx_signed_64, (ptr)) + + #define bfd_get(bits, abfd, ptr) \ + ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \ + : (bits) == 16 ? bfd_get_16 (abfd, ptr) \ + : (bits) == 32 ? bfd_get_32 (abfd, ptr) \ + : (bits) == 64 ? bfd_get_64 (abfd, ptr) \ + : (abort (), (bfd_vma) - 1)) + + #define bfd_put(bits, abfd, val, ptr) \ + ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ + : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \ + : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \ + : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \ + : (abort (), (void) 0)) + +`bfd_h_put_size' +................ + +*Description* +These macros have the same function as their `bfd_get_x' brethren, +except that they are used for removing information for the header +records of object files. Believe it or not, some object files keep +their header records in big endian order and their data in little +endian order. + + /* Byte swapping macros for file header data. */ + + #define bfd_h_put_8(abfd, val, ptr) \ + bfd_put_8 (abfd, val, ptr) + #define bfd_h_put_signed_8(abfd, val, ptr) \ + bfd_put_8 (abfd, val, ptr) + #define bfd_h_get_8(abfd, ptr) \ + bfd_get_8 (abfd, ptr) + #define bfd_h_get_signed_8(abfd, ptr) \ + bfd_get_signed_8 (abfd, ptr) + + #define bfd_h_put_16(abfd, val, ptr) \ + BFD_SEND (abfd, bfd_h_putx16, (val, ptr)) + #define bfd_h_put_signed_16 \ + bfd_h_put_16 + #define bfd_h_get_16(abfd, ptr) \ + BFD_SEND (abfd, bfd_h_getx16, (ptr)) + #define bfd_h_get_signed_16(abfd, ptr) \ + BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr)) + + #define bfd_h_put_32(abfd, val, ptr) \ + BFD_SEND (abfd, bfd_h_putx32, (val, ptr)) + #define bfd_h_put_signed_32 \ + bfd_h_put_32 + #define bfd_h_get_32(abfd, ptr) \ + BFD_SEND (abfd, bfd_h_getx32, (ptr)) + #define bfd_h_get_signed_32(abfd, ptr) \ + BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr)) + + #define bfd_h_put_64(abfd, val, ptr) \ + BFD_SEND (abfd, bfd_h_putx64, (val, ptr)) + #define bfd_h_put_signed_64 \ + bfd_h_put_64 + #define bfd_h_get_64(abfd, ptr) \ + BFD_SEND (abfd, bfd_h_getx64, (ptr)) + #define bfd_h_get_signed_64(abfd, ptr) \ + BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr)) + + /* Aliases for the above, which should eventually go away. */ + + #define H_PUT_64 bfd_h_put_64 + #define H_PUT_32 bfd_h_put_32 + #define H_PUT_16 bfd_h_put_16 + #define H_PUT_8 bfd_h_put_8 + #define H_PUT_S64 bfd_h_put_signed_64 + #define H_PUT_S32 bfd_h_put_signed_32 + #define H_PUT_S16 bfd_h_put_signed_16 + #define H_PUT_S8 bfd_h_put_signed_8 + #define H_GET_64 bfd_h_get_64 + #define H_GET_32 bfd_h_get_32 + #define H_GET_16 bfd_h_get_16 + #define H_GET_8 bfd_h_get_8 + #define H_GET_S64 bfd_h_get_signed_64 + #define H_GET_S32 bfd_h_get_signed_32 + #define H_GET_S16 bfd_h_get_signed_16 + #define H_GET_S8 bfd_h_get_signed_8 + +`bfd_log2' +.......... + +*Synopsis* + unsigned int bfd_log2 (bfd_vma x); + *Description* +Return the log base 2 of the value supplied, rounded up. E.g., an X of +1025 returns 11. A X of 0 returns 0. + + +File: bfd.info, Node: File Caching, Next: Linker Functions, Prev: Internal, Up: BFD front end + +File caching +============ + +The file caching mechanism is embedded within BFD and allows the +application to open as many BFDs as it wants without regard to the +underlying operating system's file descriptor limit (often as low as 20 +open files). The module in `cache.c' maintains a least recently used +list of `BFD_CACHE_MAX_OPEN' files, and exports the name +`bfd_cache_lookup', which runs around and makes sure that the required +BFD is open. If not, then it chooses a file to close, closes it and +opens the one wanted, returning its file handle. + +`BFD_CACHE_MAX_OPEN macro' +.......................... + +*Description* +The maximum number of files which the cache will keep open at one time. + #define BFD_CACHE_MAX_OPEN 10 + +`bfd_last_cache' +................ + +*Synopsis* + extern bfd *bfd_last_cache; + *Description* +Zero, or a pointer to the topmost BFD on the chain. This is used by +the `bfd_cache_lookup' macro in `libbfd.h' to determine when it can +avoid a function call. + +`bfd_cache_lookup' +.................. + +*Description* +Check to see if the required BFD is the same as the last one looked up. +If so, then it can use the stream in the BFD with impunity, since it +can't have changed since the last lookup; otherwise, it has to perform +the complicated lookup function. + #define bfd_cache_lookup(x) \ + ((x)==bfd_last_cache? \ + (FILE*) (bfd_last_cache->iostream): \ + bfd_cache_lookup_worker(x)) + +`bfd_cache_init' +................ + +*Synopsis* + bfd_boolean bfd_cache_init (bfd *abfd); + *Description* +Add a newly opened BFD to the cache. + +`bfd_cache_close' +................. + +*Synopsis* + bfd_boolean bfd_cache_close (bfd *abfd); + *Description* +Remove the BFD ABFD from the cache. If the attached file is open, then +close it too. + + *Returns* +`FALSE' is returned if closing the file fails, `TRUE' is returned if +all is well. + +`bfd_open_file' +............... + +*Synopsis* + FILE* bfd_open_file (bfd *abfd); + *Description* +Call the OS to open a file for ABFD. Return the `FILE *' (possibly +`NULL') that results from this operation. Set up the BFD so that +future accesses know the file is open. If the `FILE *' returned is +`NULL', then it won't have been put in the cache, so it won't have to +be removed from it. + +`bfd_cache_lookup_worker' +......................... + +*Synopsis* + FILE *bfd_cache_lookup_worker (bfd *abfd); + *Description* +Called when the macro `bfd_cache_lookup' fails to find a quick answer. +Find a file descriptor for ABFD. If necessary, it open it. If there +are already more than `BFD_CACHE_MAX_OPEN' files open, it tries to +close one first, to avoid running out of file descriptors. + + +File: bfd.info, Node: Linker Functions, Next: Hash Tables, Prev: File Caching, Up: BFD front end + +Linker Functions +================ + +The linker uses three special entry points in the BFD target vector. +It is not necessary to write special routines for these entry points +when creating a new BFD back end, since generic versions are provided. +However, writing them can speed up linking and make it use +significantly less runtime memory. + + The first routine creates a hash table used by the other routines. +The second routine adds the symbols from an object file to the hash +table. The third routine takes all the object files and links them +together to create the output file. These routines are designed so +that the linker proper does not need to know anything about the symbols +in the object files that it is linking. The linker merely arranges the +sections as directed by the linker script and lets BFD handle the +details of symbols and relocs. + + The second routine and third routines are passed a pointer to a +`struct bfd_link_info' structure (defined in `bfdlink.h') which holds +information relevant to the link, including the linker hash table +(which was created by the first routine) and a set of callback +functions to the linker proper. + + The generic linker routines are in `linker.c', and use the header +file `genlink.h'. As of this writing, the only back ends which have +implemented versions of these routines are a.out (in `aoutx.h') and +ECOFF (in `ecoff.c'). The a.out routines are used as examples +throughout this section. + +* Menu: + +* Creating a Linker Hash Table:: +* Adding Symbols to the Hash Table:: +* Performing the Final Link:: + + +File: bfd.info, Node: Creating a Linker Hash Table, Next: Adding Symbols to the Hash Table, Prev: Linker Functions, Up: Linker Functions + +Creating a linker hash table +---------------------------- + +The linker routines must create a hash table, which must be derived +from `struct bfd_link_hash_table' described in `bfdlink.c'. *Note Hash +Tables::, for information on how to create a derived hash table. This +entry point is called using the target vector of the linker output file. + + The `_bfd_link_hash_table_create' entry point must allocate and +initialize an instance of the desired hash table. If the back end does +not require any additional information to be stored with the entries in +the hash table, the entry point may simply create a `struct +bfd_link_hash_table'. Most likely, however, some additional +information will be needed. + + For example, with each entry in the hash table the a.out linker +keeps the index the symbol has in the final output file (this index +number is used so that when doing a relocatable link the symbol index +used in the output file can be quickly filled in when copying over a +reloc). The a.out linker code defines the required structures and +functions for a hash table derived from `struct bfd_link_hash_table'. +The a.out linker hash table is created by the function +`NAME(aout,link_hash_table_create)'; it simply allocates space for the +hash table, initializes it, and returns a pointer to it. + + When writing the linker routines for a new back end, you will +generally not know exactly which fields will be required until you have +finished. You should simply create a new hash table which defines no +additional fields, and then simply add fields as they become necessary. + + +File: bfd.info, Node: Adding Symbols to the Hash Table, Next: Performing the Final Link, Prev: Creating a Linker Hash Table, Up: Linker Functions + +Adding symbols to the hash table +-------------------------------- + +The linker proper will call the `_bfd_link_add_symbols' entry point for +each object file or archive which is to be linked (typically these are +the files named on the command line, but some may also come from the +linker script). The entry point is responsible for examining the file. +For an object file, BFD must add any relevant symbol information to +the hash table. For an archive, BFD must determine which elements of +the archive should be used and adding them to the link. + + The a.out version of this entry point is +`NAME(aout,link_add_symbols)'. + +* Menu: + +* Differing file formats:: +* Adding symbols from an object file:: +* Adding symbols from an archive:: + + +File: bfd.info, Node: Differing file formats, Next: Adding symbols from an object file, Prev: Adding Symbols to the Hash Table, Up: Adding Symbols to the Hash Table + +Differing file formats +...................... + +Normally all the files involved in a link will be of the same format, +but it is also possible to link together different format object files, +and the back end must support that. The `_bfd_link_add_symbols' entry +point is called via the target vector of the file to be added. This +has an important consequence: the function may not assume that the hash +table is the type created by the corresponding +`_bfd_link_hash_table_create' vector. All the `_bfd_link_add_symbols' +function can assume about the hash table is that it is derived from +`struct bfd_link_hash_table'. + + Sometimes the `_bfd_link_add_symbols' function must store some +information in the hash table entry to be used by the `_bfd_final_link' +function. In such a case the `creator' field of the hash table must be +checked to make sure that the hash table was created by an object file +of the same format. + + The `_bfd_final_link' routine must be prepared to handle a hash +entry without any extra information added by the +`_bfd_link_add_symbols' function. A hash entry without extra +information will also occur when the linker script directs the linker +to create a symbol. Note that, regardless of how a hash table entry is +added, all the fields will be initialized to some sort of null value by +the hash table entry initialization function. + + See `ecoff_link_add_externals' for an example of how to check the +`creator' field before saving information (in this case, the ECOFF +external symbol debugging information) in a hash table entry. + + +File: bfd.info, Node: Adding symbols from an object file, Next: Adding symbols from an archive, Prev: Differing file formats, Up: Adding Symbols to the Hash Table + +Adding symbols from an object file +.................................. + +When the `_bfd_link_add_symbols' routine is passed an object file, it +must add all externally visible symbols in that object file to the hash +table. The actual work of adding the symbol to the hash table is +normally handled by the function `_bfd_generic_link_add_one_symbol'. +The `_bfd_link_add_symbols' routine is responsible for reading all the +symbols from the object file and passing the correct information to +`_bfd_generic_link_add_one_symbol'. + + The `_bfd_link_add_symbols' routine should not use +`bfd_canonicalize_symtab' to read the symbols. The point of providing +this routine is to avoid the overhead of converting the symbols into +generic `asymbol' structures. + + `_bfd_generic_link_add_one_symbol' handles the details of combining +common symbols, warning about multiple definitions, and so forth. It +takes arguments which describe the symbol to add, notably symbol flags, +a section, and an offset. The symbol flags include such things as +`BSF_WEAK' or `BSF_INDIRECT'. The section is a section in the object +file, or something like `bfd_und_section_ptr' for an undefined symbol +or `bfd_com_section_ptr' for a common symbol. + + If the `_bfd_final_link' routine is also going to need to read the +symbol information, the `_bfd_link_add_symbols' routine should save it +somewhere attached to the object file BFD. However, the information +should only be saved if the `keep_memory' field of the `info' argument +is TRUE, so that the `-no-keep-memory' linker switch is effective. + + The a.out function which adds symbols from an object file is +`aout_link_add_object_symbols', and most of the interesting work is in +`aout_link_add_symbols'. The latter saves pointers to the hash tables +entries created by `_bfd_generic_link_add_one_symbol' indexed by symbol +number, so that the `_bfd_final_link' routine does not have to call the +hash table lookup routine to locate the entry. + + +File: bfd.info, Node: Adding symbols from an archive, Prev: Adding symbols from an object file, Up: Adding Symbols to the Hash Table + +Adding symbols from an archive +.............................. + +When the `_bfd_link_add_symbols' routine is passed an archive, it must +look through the symbols defined by the archive and decide which +elements of the archive should be included in the link. For each such +element it must call the `add_archive_element' linker callback, and it +must add the symbols from the object file to the linker hash table. + + In most cases the work of looking through the symbols in the archive +should be done by the `_bfd_generic_link_add_archive_symbols' function. +This function builds a hash table from the archive symbol table and +looks through the list of undefined symbols to see which elements +should be included. `_bfd_generic_link_add_archive_symbols' is passed +a function to call to make the final decision about adding an archive +element to the link and to do the actual work of adding the symbols to +the linker hash table. + + The function passed to `_bfd_generic_link_add_archive_symbols' must +read the symbols of the archive element and decide whether the archive +element should be included in the link. If the element is to be +included, the `add_archive_element' linker callback routine must be +called with the element as an argument, and the elements symbols must +be added to the linker hash table just as though the element had itself +been passed to the `_bfd_link_add_symbols' function. + + When the a.out `_bfd_link_add_symbols' function receives an archive, +it calls `_bfd_generic_link_add_archive_symbols' passing +`aout_link_check_archive_element' as the function argument. +`aout_link_check_archive_element' calls `aout_link_check_ar_symbols'. +If the latter decides to add the element (an element is only added if +it provides a real, non-common, definition for a previously undefined +or common symbol) it calls the `add_archive_element' callback and then +`aout_link_check_archive_element' calls `aout_link_add_symbols' to +actually add the symbols to the linker hash table. + + The ECOFF back end is unusual in that it does not normally call +`_bfd_generic_link_add_archive_symbols', because ECOFF archives already +contain a hash table of symbols. The ECOFF back end searches the +archive itself to avoid the overhead of creating a new hash table. + + +File: bfd.info, Node: Performing the Final Link, Prev: Adding Symbols to the Hash Table, Up: Linker Functions + +Performing the final link +------------------------- + +When all the input files have been processed, the linker calls the +`_bfd_final_link' entry point of the output BFD. This routine is +responsible for producing the final output file, which has several +aspects. It must relocate the contents of the input sections and copy +the data into the output sections. It must build an output symbol +table including any local symbols from the input files and the global +symbols from the hash table. When producing relocatable output, it must +modify the input relocs and write them into the output file. There may +also be object format dependent work to be done. + + The linker will also call the `write_object_contents' entry point +when the BFD is closed. The two entry points must work together in +order to produce the correct output file. + + The details of how this works are inevitably dependent upon the +specific object file format. The a.out `_bfd_final_link' routine is +`NAME(aout,final_link)'. + +* Menu: + +* Information provided by the linker:: +* Relocating the section contents:: +* Writing the symbol table:: + + +File: bfd.info, Node: Information provided by the linker, Next: Relocating the section contents, Prev: Performing the Final Link, Up: Performing the Final Link + +Information provided by the linker +.................................. + +Before the linker calls the `_bfd_final_link' entry point, it sets up +some data structures for the function to use. + + The `input_bfds' field of the `bfd_link_info' structure will point +to a list of all the input files included in the link. These files are +linked through the `link_next' field of the `bfd' structure. + + Each section in the output file will have a list of `link_order' +structures attached to the `link_order_head' field (the `link_order' +structure is defined in `bfdlink.h'). These structures describe how to +create the contents of the output section in terms of the contents of +various input sections, fill constants, and, eventually, other types of +information. They also describe relocs that must be created by the BFD +backend, but do not correspond to any input file; this is used to +support -Ur, which builds constructors while generating a relocatable +object file. + + +File: bfd.info, Node: Relocating the section contents, Next: Writing the symbol table, Prev: Information provided by the linker, Up: Performing the Final Link + +Relocating the section contents +............................... + +The `_bfd_final_link' function should look through the `link_order' +structures attached to each section of the output file. Each +`link_order' structure should either be handled specially, or it should +be passed to the function `_bfd_default_link_order' which will do the +right thing (`_bfd_default_link_order' is defined in `linker.c'). + + For efficiency, a `link_order' of type `bfd_indirect_link_order' +whose associated section belongs to a BFD of the same format as the +output BFD must be handled specially. This type of `link_order' +describes part of an output section in terms of a section belonging to +one of the input files. The `_bfd_final_link' function should read the +contents of the section and any associated relocs, apply the relocs to +the section contents, and write out the modified section contents. If +performing a relocatable link, the relocs themselves must also be +modified and written out. + + The functions `_bfd_relocate_contents' and +`_bfd_final_link_relocate' provide some general support for performing +the actual relocations, notably overflow checking. Their arguments +include information about the symbol the relocation is against and a +`reloc_howto_type' argument which describes the relocation to perform. +These functions are defined in `reloc.c'. + + The a.out function which handles reading, relocating, and writing +section contents is `aout_link_input_section'. The actual relocation +is done in `aout_link_input_section_std' and +`aout_link_input_section_ext'. + + +File: bfd.info, Node: Writing the symbol table, Prev: Relocating the section contents, Up: Performing the Final Link + +Writing the symbol table +........................ + +The `_bfd_final_link' function must gather all the symbols in the input +files and write them out. It must also write out all the symbols in +the global hash table. This must be controlled by the `strip' and +`discard' fields of the `bfd_link_info' structure. + + The local symbols of the input files will not have been entered into +the linker hash table. The `_bfd_final_link' routine must consider +each input file and include the symbols in the output file. It may be +convenient to do this when looking through the `link_order' structures, +or it may be done by stepping through the `input_bfds' list. + + The `_bfd_final_link' routine must also traverse the global hash +table to gather all the externally visible symbols. It is possible +that most of the externally visible symbols may be written out when +considering the symbols of each input file, but it is still necessary +to traverse the hash table since the linker script may have defined +some symbols that are not in any of the input files. + + The `strip' field of the `bfd_link_info' structure controls which +symbols are written out. The possible values are listed in +`bfdlink.h'. If the value is `strip_some', then the `keep_hash' field +of the `bfd_link_info' structure is a hash table of symbols to keep; +each symbol should be looked up in this hash table, and only symbols +which are present should be included in the output file. + + If the `strip' field of the `bfd_link_info' structure permits local +symbols to be written out, the `discard' field is used to further +controls which local symbols are included in the output file. If the +value is `discard_l', then all local symbols which begin with a certain +prefix are discarded; this is controlled by the +`bfd_is_local_label_name' entry point. + + The a.out backend handles symbols by calling +`aout_link_write_symbols' on each input BFD and then traversing the +global hash table with the function `aout_link_write_other_symbol'. It +builds a string table while writing out the symbols, which is written +to the output file at the end of `NAME(aout,final_link)'. + +`bfd_link_split_section' +........................ + +*Synopsis* + bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec); + *Description* +Return nonzero if SEC should be split during a reloceatable or final +link. + #define bfd_link_split_section(abfd, sec) \ + BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec)) + + +File: bfd.info, Node: Hash Tables, Prev: Linker Functions, Up: BFD front end + +Hash Tables +=========== + +BFD provides a simple set of hash table functions. Routines are +provided to initialize a hash table, to free a hash table, to look up a +string in a hash table and optionally create an entry for it, and to +traverse a hash table. There is currently no routine to delete an +string from a hash table. + + The basic hash table does not permit any data to be stored with a +string. However, a hash table is designed to present a base class from +which other types of hash tables may be derived. These derived types +may store additional information with the string. Hash tables were +implemented in this way, rather than simply providing a data pointer in +a hash table entry, because they were designed for use by the linker +back ends. The linker may create thousands of hash table entries, and +the overhead of allocating private data and storing and following +pointers becomes noticeable. + + The basic hash table code is in `hash.c'. + +* Menu: + +* Creating and Freeing a Hash Table:: +* Looking Up or Entering a String:: +* Traversing a Hash Table:: +* Deriving a New Hash Table Type:: + + +File: bfd.info, Node: Creating and Freeing a Hash Table, Next: Looking Up or Entering a String, Prev: Hash Tables, Up: Hash Tables + +Creating and freeing a hash table +--------------------------------- + +To create a hash table, create an instance of a `struct bfd_hash_table' +(defined in `bfd.h') and call `bfd_hash_table_init' (if you know +approximately how many entries you will need, the function +`bfd_hash_table_init_n', which takes a SIZE argument, may be used). +`bfd_hash_table_init' returns `FALSE' if some sort of error occurs. + + The function `bfd_hash_table_init' take as an argument a function to +use to create new entries. For a basic hash table, use the function +`bfd_hash_newfunc'. *Note Deriving a New Hash Table Type::, for why +you would want to use a different value for this argument. + + `bfd_hash_table_init' will create an objalloc which will be used to +allocate new entries. You may allocate memory on this objalloc using +`bfd_hash_allocate'. + + Use `bfd_hash_table_free' to free up all the memory that has been +allocated for a hash table. This will not free up the `struct +bfd_hash_table' itself, which you must provide. + + +File: bfd.info, Node: Looking Up or Entering a String, Next: Traversing a Hash Table, Prev: Creating and Freeing a Hash Table, Up: Hash Tables + +Looking up or entering a string +------------------------------- + +The function `bfd_hash_lookup' is used both to look up a string in the +hash table and to create a new entry. + + If the CREATE argument is `FALSE', `bfd_hash_lookup' will look up a +string. If the string is found, it will returns a pointer to a `struct +bfd_hash_entry'. If the string is not found in the table +`bfd_hash_lookup' will return `NULL'. You should not modify any of the +fields in the returns `struct bfd_hash_entry'. + + If the CREATE argument is `TRUE', the string will be entered into +the hash table if it is not already there. Either way a pointer to a +`struct bfd_hash_entry' will be returned, either to the existing +structure or to a newly created one. In this case, a `NULL' return +means that an error occurred. + + If the CREATE argument is `TRUE', and a new entry is created, the +COPY argument is used to decide whether to copy the string onto the +hash table objalloc or not. If COPY is passed as `FALSE', you must be +careful not to deallocate or modify the string as long as the hash table +exists. + + +File: bfd.info, Node: Traversing a Hash Table, Next: Deriving a New Hash Table Type, Prev: Looking Up or Entering a String, Up: Hash Tables + +Traversing a hash table +----------------------- + +The function `bfd_hash_traverse' may be used to traverse a hash table, +calling a function on each element. The traversal is done in a random +order. + + `bfd_hash_traverse' takes as arguments a function and a generic +`void *' pointer. The function is called with a hash table entry (a +`struct bfd_hash_entry *') and the generic pointer passed to +`bfd_hash_traverse'. The function must return a `boolean' value, which +indicates whether to continue traversing the hash table. If the +function returns `FALSE', `bfd_hash_traverse' will stop the traversal +and return immediately. + + +File: bfd.info, Node: Deriving a New Hash Table Type, Prev: Traversing a Hash Table, Up: Hash Tables + +Deriving a new hash table type +------------------------------ + +Many uses of hash tables want to store additional information which +each entry in the hash table. Some also find it convenient to store +additional information with the hash table itself. This may be done +using a derived hash table. + + Since C is not an object oriented language, creating a derived hash +table requires sticking together some boilerplate routines with a few +differences specific to the type of hash table you want to create. + + An example of a derived hash table is the linker hash table. The +structures for this are defined in `bfdlink.h'. The functions are in +`linker.c'. + + You may also derive a hash table from an already derived hash table. +For example, the a.out linker backend code uses a hash table derived +from the linker hash table. + +* Menu: + +* Define the Derived Structures:: +* Write the Derived Creation Routine:: +* Write Other Derived Routines:: + + +File: bfd.info, Node: Define the Derived Structures, Next: Write the Derived Creation Routine, Prev: Deriving a New Hash Table Type, Up: Deriving a New Hash Table Type + +Define the derived structures +............................. + +You must define a structure for an entry in the hash table, and a +structure for the hash table itself. + + The first field in the structure for an entry in the hash table must +be of the type used for an entry in the hash table you are deriving +from. If you are deriving from a basic hash table this is `struct +bfd_hash_entry', which is defined in `bfd.h'. The first field in the +structure for the hash table itself must be of the type of the hash +table you are deriving from itself. If you are deriving from a basic +hash table, this is `struct bfd_hash_table'. + + For example, the linker hash table defines `struct +bfd_link_hash_entry' (in `bfdlink.h'). The first field, `root', is of +type `struct bfd_hash_entry'. Similarly, the first field in `struct +bfd_link_hash_table', `table', is of type `struct bfd_hash_table'. + + +File: bfd.info, Node: Write the Derived Creation Routine, Next: Write Other Derived Routines, Prev: Define the Derived Structures, Up: Deriving a New Hash Table Type + +Write the derived creation routine +.................................. + +You must write a routine which will create and initialize an entry in +the hash table. This routine is passed as the function argument to +`bfd_hash_table_init'. + + In order to permit other hash tables to be derived from the hash +table you are creating, this routine must be written in a standard way. + + The first argument to the creation routine is a pointer to a hash +table entry. This may be `NULL', in which case the routine should +allocate the right amount of space. Otherwise the space has already +been allocated by a hash table type derived from this one. + + After allocating space, the creation routine must call the creation +routine of the hash table type it is derived from, passing in a pointer +to the space it just allocated. This will initialize any fields used +by the base hash table. + + Finally the creation routine must initialize any local fields for +the new hash table type. + + Here is a boilerplate example of a creation routine. FUNCTION_NAME +is the name of the routine. ENTRY_TYPE is the type of an entry in the +hash table you are creating. BASE_NEWFUNC is the name of the creation +routine of the hash table type your hash table is derived from. + + struct bfd_hash_entry * + FUNCTION_NAME (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; + { + struct ENTRY_TYPE *ret = (ENTRY_TYPE *) entry; + + /* Allocate the structure if it has not already been allocated by a + derived class. */ + if (ret == (ENTRY_TYPE *) NULL) + { + ret = ((ENTRY_TYPE *) + bfd_hash_allocate (table, sizeof (ENTRY_TYPE))); + if (ret == (ENTRY_TYPE *) NULL) + return NULL; + } + + /* Call the allocation method of the base class. */ + ret = ((ENTRY_TYPE *) + BASE_NEWFUNC ((struct bfd_hash_entry *) ret, table, string)); + + /* Initialize the local fields here. */ + + return (struct bfd_hash_entry *) ret; + } + *Description* +The creation routine for the linker hash table, which is in `linker.c', +looks just like this example. FUNCTION_NAME is +`_bfd_link_hash_newfunc'. ENTRY_TYPE is `struct bfd_link_hash_entry'. +BASE_NEWFUNC is `bfd_hash_newfunc', the creation routine for a basic +hash table. + + `_bfd_link_hash_newfunc' also initializes the local fields in a +linker hash table entry: `type', `written' and `next'. + + +File: bfd.info, Node: Write Other Derived Routines, Prev: Write the Derived Creation Routine, Up: Deriving a New Hash Table Type + +Write other derived routines +............................ + +You will want to write other routines for your new hash table, as well. + + You will want an initialization routine which calls the +initialization routine of the hash table you are deriving from and +initializes any other local fields. For the linker hash table, this is +`_bfd_link_hash_table_init' in `linker.c'. + + You will want a lookup routine which calls the lookup routine of the +hash table you are deriving from and casts the result. The linker hash +table uses `bfd_link_hash_lookup' in `linker.c' (this actually takes an +additional argument which it uses to decide how to return the looked up +value). + + You may want a traversal routine. This should just call the +traversal routine of the hash table you are deriving from with +appropriate casts. The linker hash table uses `bfd_link_hash_traverse' +in `linker.c'. + + These routines may simply be defined as macros. For example, the +a.out backend linker hash table, which is derived from the linker hash +table, uses macros for the lookup and traversal routines. These are +`aout_link_hash_lookup' and `aout_link_hash_traverse' in aoutx.h. + + +File: bfd.info, Node: BFD back ends, Next: GNU Free Documentation License, Prev: BFD front end, Up: Top + +BFD back ends +************* + +* Menu: + +* What to Put Where:: +* aout :: a.out backends +* coff :: coff backends +* elf :: elf backends +* mmo :: mmo backend + + +File: bfd.info, Node: What to Put Where, Next: aout, Prev: BFD back ends, Up: BFD back ends + + All of BFD lives in one directory. + + +File: bfd.info, Node: aout, Next: coff, Prev: What to Put Where, Up: BFD back ends + +a.out backends +============== + +*Description* +BFD supports a number of different flavours of a.out format, though the +major differences are only the sizes of the structures on disk, and the +shape of the relocation information. + + The support is split into a basic support file `aoutx.h' and other +files which derive functions from the base. One derivation file is +`aoutf1.h' (for a.out flavour 1), and adds to the basic a.out functions +support for sun3, sun4, 386 and 29k a.out files, to create a target +jump vector for a specific target. + + This information is further split out into more specific files for +each machine, including `sunos.c' for sun3 and sun4, `newsos3.c' for +the Sony NEWS, and `demo64.c' for a demonstration of a 64 bit a.out +format. + + The base file `aoutx.h' defines general mechanisms for reading and +writing records to and from disk and various other methods which BFD +requires. It is included by `aout32.c' and `aout64.c' to form the names +`aout_32_swap_exec_header_in', `aout_64_swap_exec_header_in', etc. + + As an example, this is what goes on to make the back end for a sun4, +from `aout32.c': + + #define ARCH_SIZE 32 + #include "aoutx.h" + + Which exports names: + + ... + aout_32_canonicalize_reloc + aout_32_find_nearest_line + aout_32_get_lineno + aout_32_get_reloc_upper_bound + ... + + from `sunos.c': + + #define TARGET_NAME "a.out-sunos-big" + #define VECNAME sunos_big_vec + #include "aoutf1.h" + + requires all the names from `aout32.c', and produces the jump vector + + sunos_big_vec + + The file `host-aout.c' is a special case. It is for a large set of +hosts that use "more or less standard" a.out files, and for which +cross-debugging is not interesting. It uses the standard 32-bit a.out +support routines, but determines the file offsets and addresses of the +text, data, and BSS sections, the machine architecture and machine +type, and the entry point address, in a host-dependent manner. Once +these values have been determined, generic code is used to handle the +object file. + + When porting it to run on a new system, you must supply: + + HOST_PAGE_SIZE + HOST_SEGMENT_SIZE + HOST_MACHINE_ARCH (optional) + HOST_MACHINE_MACHINE (optional) + HOST_TEXT_START_ADDR + HOST_STACK_END_ADDR + + in the file `../include/sys/h-XXX.h' (for your host). These values, +plus the structures and macros defined in `a.out.h' on your host +system, will produce a BFD target that will access ordinary a.out files +on your host. To configure a new machine to use `host-aout.c', specify: + + TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec + TDEPFILES= host-aout.o trad-core.o + + in the `config/XXX.mt' file, and modify `configure.in' to use the +`XXX.mt' file (by setting "`bfd_target=XXX'") when your configuration +is selected. + +Relocations +----------- + +*Description* +The file `aoutx.h' provides for both the _standard_ and _extended_ +forms of a.out relocation records. + + The standard records contain only an address, a symbol index, and a +type field. The extended records (used on 29ks and sparcs) also have a +full integer for an addend. + +Internal entry points +--------------------- + +*Description* +`aoutx.h' exports several routines for accessing the contents of an +a.out file, which are gathered and exported in turn by various format +specific files (eg sunos.c). + +`aout_SIZE_swap_exec_header_in' +............................... + +*Synopsis* + void aout_SIZE_swap_exec_header_in, + (bfd *abfd, + struct external_exec *raw_bytes, + struct internal_exec *execp); + *Description* +Swap the information in an executable header RAW_BYTES taken from a raw +byte stream memory image into the internal exec header structure EXECP. + +`aout_SIZE_swap_exec_header_out' +................................ + +*Synopsis* + void aout_SIZE_swap_exec_header_out + (bfd *abfd, + struct internal_exec *execp, + struct external_exec *raw_bytes); + *Description* +Swap the information in an internal exec header structure EXECP into +the buffer RAW_BYTES ready for writing to disk. + +`aout_SIZE_some_aout_object_p' +.............................. + +*Synopsis* + const bfd_target *aout_SIZE_some_aout_object_p + (bfd *abfd, + const bfd_target *(*callback_to_real_object_p) ()); + *Description* +Some a.out variant thinks that the file open in ABFD checking is an +a.out file. Do some more checking, and set up for access if it really +is. Call back to the calling environment's "finish up" function just +before returning, to handle any last-minute setup. + +`aout_SIZE_mkobject' +.................... + +*Synopsis* + bfd_boolean aout_SIZE_mkobject, (bfd *abfd); + *Description* +Initialize BFD ABFD for use with a.out files. + +`aout_SIZE_machine_type' +........................ + +*Synopsis* + enum machine_type aout_SIZE_machine_type + (enum bfd_architecture arch, + unsigned long machine)); + *Description* +Keep track of machine architecture and machine type for a.out's. Return +the `machine_type' for a particular architecture and machine, or +`M_UNKNOWN' if that exact architecture and machine can't be represented +in a.out format. + + If the architecture is understood, machine type 0 (default) is +always understood. + +`aout_SIZE_set_arch_mach' +......................... + +*Synopsis* + bfd_boolean aout_SIZE_set_arch_mach, + (bfd *, + enum bfd_architecture arch, + unsigned long machine)); + *Description* +Set the architecture and the machine of the BFD ABFD to the values ARCH +and MACHINE. Verify that ABFD's format can support the architecture +required. + +`aout_SIZE_new_section_hook' +............................ + +*Synopsis* + bfd_boolean aout_SIZE_new_section_hook, + (bfd *abfd, + asection *newsect)); + *Description* +Called by the BFD in response to a `bfd_make_section' request. + + +File: bfd.info, Node: coff, Next: elf, Prev: aout, Up: BFD back ends + +coff backends +============= + +BFD supports a number of different flavours of coff format. The major +differences between formats are the sizes and alignments of fields in +structures on disk, and the occasional extra field. + + Coff in all its varieties is implemented with a few common files and +a number of implementation specific files. For example, The 88k bcs +coff format is implemented in the file `coff-m88k.c'. This file +`#include's `coff/m88k.h' which defines the external structure of the +coff format for the 88k, and `coff/internal.h' which defines the +internal structure. `coff-m88k.c' also defines the relocations used by +the 88k format *Note Relocations::. + + The Intel i960 processor version of coff is implemented in +`coff-i960.c'. This file has the same structure as `coff-m88k.c', +except that it includes `coff/i960.h' rather than `coff-m88k.h'. + +Porting to a new version of coff +-------------------------------- + +The recommended method is to select from the existing implementations +the version of coff which is most like the one you want to use. For +example, we'll say that i386 coff is the one you select, and that your +coff flavour is called foo. Copy `i386coff.c' to `foocoff.c', copy +`../include/coff/i386.h' to `../include/coff/foo.h', and add the lines +to `targets.c' and `Makefile.in' so that your new back end is used. +Alter the shapes of the structures in `../include/coff/foo.h' so that +they match what you need. You will probably also have to add `#ifdef's +to the code in `coff/internal.h' and `coffcode.h' if your version of +coff is too wild. + + You can verify that your new BFD backend works quite simply by +building `objdump' from the `binutils' directory, and making sure that +its version of what's going on and your host system's idea (assuming it +has the pretty standard coff dump utility, usually called `att-dump' or +just `dump') are the same. Then clean up your code, and send what +you've done to Cygnus. Then your stuff will be in the next release, and +you won't have to keep integrating it. + +How the coff backend works +-------------------------- + +File layout +........... + +The Coff backend is split into generic routines that are applicable to +any Coff target and routines that are specific to a particular target. +The target-specific routines are further split into ones which are +basically the same for all Coff targets except that they use the +external symbol format or use different values for certain constants. + + The generic routines are in `coffgen.c'. These routines work for +any Coff target. They use some hooks into the target specific code; +the hooks are in a `bfd_coff_backend_data' structure, one of which +exists for each target. + + The essentially similar target-specific routines are in +`coffcode.h'. This header file includes executable C code. The +various Coff targets first include the appropriate Coff header file, +make any special defines that are needed, and then include `coffcode.h'. + + Some of the Coff targets then also have additional routines in the +target source file itself. + + For example, `coff-i960.c' includes `coff/internal.h' and +`coff/i960.h'. It then defines a few constants, such as `I960', and +includes `coffcode.h'. Since the i960 has complex relocation types, +`coff-i960.c' also includes some code to manipulate the i960 relocs. +This code is not in `coffcode.h' because it would not be used by any +other target. + +Bit twiddling +............. + +Each flavour of coff supported in BFD has its own header file +describing the external layout of the structures. There is also an +internal description of the coff layout, in `coff/internal.h'. A major +function of the coff backend is swapping the bytes and twiddling the +bits to translate the external form of the structures into the normal +internal form. This is all performed in the `bfd_swap'_thing_direction +routines. Some elements are different sizes between different versions +of coff; it is the duty of the coff version specific include file to +override the definitions of various packing routines in `coffcode.h'. +E.g., the size of line number entry in coff is sometimes 16 bits, and +sometimes 32 bits. `#define'ing `PUT_LNSZ_LNNO' and `GET_LNSZ_LNNO' +will select the correct one. No doubt, some day someone will find a +version of coff which has a varying field size not catered to at the +moment. To port BFD, that person will have to add more `#defines'. +Three of the bit twiddling routines are exported to `gdb'; +`coff_swap_aux_in', `coff_swap_sym_in' and `coff_swap_lineno_in'. `GDB' +reads the symbol table on its own, but uses BFD to fix things up. More +of the bit twiddlers are exported for `gas'; `coff_swap_aux_out', +`coff_swap_sym_out', `coff_swap_lineno_out', `coff_swap_reloc_out', +`coff_swap_filehdr_out', `coff_swap_aouthdr_out', +`coff_swap_scnhdr_out'. `Gas' currently keeps track of all the symbol +table and reloc drudgery itself, thereby saving the internal BFD +overhead, but uses BFD to swap things on the way out, making cross +ports much safer. Doing so also allows BFD (and thus the linker) to +use the same header files as `gas', which makes one avenue to disaster +disappear. + +Symbol reading +.............. + +The simple canonical form for symbols used by BFD is not rich enough to +keep all the information available in a coff symbol table. The back end +gets around this problem by keeping the original symbol table around, +"behind the scenes". + + When a symbol table is requested (through a call to +`bfd_canonicalize_symtab'), a request gets through to +`coff_get_normalized_symtab'. This reads the symbol table from the coff +file and swaps all the structures inside into the internal form. It +also fixes up all the pointers in the table (represented in the file by +offsets from the first symbol in the table) into physical pointers to +elements in the new internal table. This involves some work since the +meanings of fields change depending upon context: a field that is a +pointer to another structure in the symbol table at one moment may be +the size in bytes of a structure at the next. Another pass is made +over the table. All symbols which mark file names (`C_FILE' symbols) +are modified so that the internal string points to the value in the +auxent (the real filename) rather than the normal text associated with +the symbol (`".file"'). + + At this time the symbol names are moved around. Coff stores all +symbols less than nine characters long physically within the symbol +table; longer strings are kept at the end of the file in the string +table. This pass moves all strings into memory and replaces them with +pointers to the strings. + + The symbol table is massaged once again, this time to create the +canonical table used by the BFD application. Each symbol is inspected +in turn, and a decision made (using the `sclass' field) about the +various flags to set in the `asymbol'. *Note Symbols::. The generated +canonical table shares strings with the hidden internal symbol table. + + Any linenumbers are read from the coff file too, and attached to the +symbols which own the functions the linenumbers belong to. + +Symbol writing +.............. + +Writing a symbol to a coff file which didn't come from a coff file will +lose any debugging information. The `asymbol' structure remembers the +BFD from which the symbol was taken, and on output the back end makes +sure that the same destination target as source target is present. + + When the symbols have come from a coff file then all the debugging +information is preserved. + + Symbol tables are provided for writing to the back end in a vector +of pointers to pointers. This allows applications like the linker to +accumulate and output large symbol tables without having to do too much +byte copying. + + This function runs through the provided symbol table and patches +each symbol marked as a file place holder (`C_FILE') to point to the +next file place holder in the list. It also marks each `offset' field +in the list with the offset from the first symbol of the current symbol. + + Another function of this procedure is to turn the canonical value +form of BFD into the form used by coff. Internally, BFD expects symbol +values to be offsets from a section base; so a symbol physically at +0x120, but in a section starting at 0x100, would have the value 0x20. +Coff expects symbols to contain their final value, so symbols have +their values changed at this point to reflect their sum with their +owning section. This transformation uses the `output_section' field of +the `asymbol''s `asection' *Note Sections::. + + * `coff_mangle_symbols' + This routine runs though the provided symbol table and uses the +offsets generated by the previous pass and the pointers generated when +the symbol table was read in to create the structured hierarchy +required by coff. It changes each pointer to a symbol into the index +into the symbol table of the asymbol. + + * `coff_write_symbols' + This routine runs through the symbol table and patches up the +symbols from their internal form into the coff way, calls the bit +twiddlers, and writes out the table to the file. + +`coff_symbol_type' +.................. + +*Description* +The hidden information for an `asymbol' is described in a +`combined_entry_type': + + + typedef struct coff_ptr_struct + { + /* Remembers the offset from the first symbol in the file for + this symbol. Generated by coff_renumber_symbols. */ + unsigned int offset; + + /* Should the value of this symbol be renumbered. Used for + XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */ + unsigned int fix_value : 1; + + /* Should the tag field of this symbol be renumbered. + Created by coff_pointerize_aux. */ + unsigned int fix_tag : 1; + + /* Should the endidx field of this symbol be renumbered. + Created by coff_pointerize_aux. */ + unsigned int fix_end : 1; + + /* Should the x_csect.x_scnlen field be renumbered. + Created by coff_pointerize_aux. */ + unsigned int fix_scnlen : 1; + + /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the + index into the line number entries. Set by coff_slurp_symbol_table. */ + unsigned int fix_line : 1; + + /* The container for the symbol structure as read and translated + from the file. */ + union + { + union internal_auxent auxent; + struct internal_syment syment; + } u; + } combined_entry_type; + + + /* Each canonical asymbol really looks like this: */ + + typedef struct coff_symbol_struct + { + /* The actual symbol which the rest of BFD works with */ + asymbol symbol; + + /* A pointer to the hidden information for this symbol */ + combined_entry_type *native; + + /* A pointer to the linenumber information for this symbol */ + struct lineno_cache_entry *lineno; + + /* Have the line numbers been relocated yet ? */ + bfd_boolean done_lineno; + } coff_symbol_type; + +`bfd_coff_backend_data' +....................... + + /* COFF symbol classifications. */ + + enum coff_symbol_classification + { + /* Global symbol. */ + COFF_SYMBOL_GLOBAL, + /* Common symbol. */ + COFF_SYMBOL_COMMON, + /* Undefined symbol. */ + COFF_SYMBOL_UNDEFINED, + /* Local symbol. */ + COFF_SYMBOL_LOCAL, + /* PE section symbol. */ + COFF_SYMBOL_PE_SECTION + }; +Special entry points for gdb to swap in coff symbol table parts: + typedef struct + { + void (*_bfd_coff_swap_aux_in) + PARAMS ((bfd *, PTR, int, int, int, int, PTR)); + + void (*_bfd_coff_swap_sym_in) + PARAMS ((bfd *, PTR, PTR)); + + void (*_bfd_coff_swap_lineno_in) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int (*_bfd_coff_swap_aux_out) + PARAMS ((bfd *, PTR, int, int, int, int, PTR)); + + unsigned int (*_bfd_coff_swap_sym_out) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int (*_bfd_coff_swap_lineno_out) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int (*_bfd_coff_swap_reloc_out) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int (*_bfd_coff_swap_filehdr_out) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int (*_bfd_coff_swap_aouthdr_out) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int (*_bfd_coff_swap_scnhdr_out) + PARAMS ((bfd *, PTR, PTR)); + + unsigned int _bfd_filhsz; + unsigned int _bfd_aoutsz; + unsigned int _bfd_scnhsz; + unsigned int _bfd_symesz; + unsigned int _bfd_auxesz; + unsigned int _bfd_relsz; + unsigned int _bfd_linesz; + unsigned int _bfd_filnmlen; + bfd_boolean _bfd_coff_long_filenames; + bfd_boolean _bfd_coff_long_section_names; + unsigned int _bfd_coff_default_section_alignment_power; + bfd_boolean _bfd_coff_force_symnames_in_strings; + unsigned int _bfd_coff_debug_string_prefix_length; + + void (*_bfd_coff_swap_filehdr_in) + PARAMS ((bfd *, PTR, PTR)); + + void (*_bfd_coff_swap_aouthdr_in) + PARAMS ((bfd *, PTR, PTR)); + + void (*_bfd_coff_swap_scnhdr_in) + PARAMS ((bfd *, PTR, PTR)); + + void (*_bfd_coff_swap_reloc_in) + PARAMS ((bfd *abfd, PTR, PTR)); + + bfd_boolean (*_bfd_coff_bad_format_hook) + PARAMS ((bfd *, PTR)); + + bfd_boolean (*_bfd_coff_set_arch_mach_hook) + PARAMS ((bfd *, PTR)); + + PTR (*_bfd_coff_mkobject_hook) + PARAMS ((bfd *, PTR, PTR)); + + bfd_boolean (*_bfd_styp_to_sec_flags_hook) + PARAMS ((bfd *, PTR, const char *, asection *, flagword *)); + + void (*_bfd_set_alignment_hook) + PARAMS ((bfd *, asection *, PTR)); + + bfd_boolean (*_bfd_coff_slurp_symbol_table) + PARAMS ((bfd *)); + + bfd_boolean (*_bfd_coff_symname_in_debug) + PARAMS ((bfd *, struct internal_syment *)); + + bfd_boolean (*_bfd_coff_pointerize_aux_hook) + PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, + unsigned int, combined_entry_type *)); + + bfd_boolean (*_bfd_coff_print_aux) + PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *, + combined_entry_type *, unsigned int)); + + void (*_bfd_coff_reloc16_extra_cases) + PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, + bfd_byte *, unsigned int *, unsigned int *)); + + int (*_bfd_coff_reloc16_estimate) + PARAMS ((bfd *, asection *, arelent *, unsigned int, + struct bfd_link_info *)); + + enum coff_symbol_classification (*_bfd_coff_classify_symbol) + PARAMS ((bfd *, struct internal_syment *)); + + bfd_boolean (*_bfd_coff_compute_section_file_positions) + PARAMS ((bfd *)); + + bfd_boolean (*_bfd_coff_start_final_link) + PARAMS ((bfd *, struct bfd_link_info *)); + + bfd_boolean (*_bfd_coff_relocate_section) + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **)); + + reloc_howto_type *(*_bfd_coff_rtype_to_howto) + PARAMS ((bfd *, asection *, struct internal_reloc *, + struct coff_link_hash_entry *, struct internal_syment *, + bfd_vma *)); + + bfd_boolean (*_bfd_coff_adjust_symndx) + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, + struct internal_reloc *, bfd_boolean *)); + + bfd_boolean (*_bfd_coff_link_add_one_symbol) + PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, + asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, + struct bfd_link_hash_entry **)); + + bfd_boolean (*_bfd_coff_link_output_has_begun) + PARAMS ((bfd *, struct coff_final_link_info *)); + + bfd_boolean (*_bfd_coff_final_link_postscript) + PARAMS ((bfd *, struct coff_final_link_info *)); + + } bfd_coff_backend_data; + + #define coff_backend_info(abfd) \ + ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) + + #define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \ + ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) + + #define bfd_coff_swap_sym_in(a,e,i) \ + ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) + + #define bfd_coff_swap_lineno_in(a,e,i) \ + ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) + + #define bfd_coff_swap_reloc_out(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) + + #define bfd_coff_swap_lineno_out(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) + + #define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \ + ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) + + #define bfd_coff_swap_sym_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) + + #define bfd_coff_swap_scnhdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) + + #define bfd_coff_swap_filehdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) + + #define bfd_coff_swap_aouthdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) + + #define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz) + #define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz) + #define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz) + #define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz) + #define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz) + #define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz) + #define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz) + #define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen) + #define bfd_coff_long_filenames(abfd) \ + (coff_backend_info (abfd)->_bfd_coff_long_filenames) + #define bfd_coff_long_section_names(abfd) \ + (coff_backend_info (abfd)->_bfd_coff_long_section_names) + #define bfd_coff_default_section_alignment_power(abfd) \ + (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) + #define bfd_coff_swap_filehdr_in(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) + + #define bfd_coff_swap_aouthdr_in(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) + + #define bfd_coff_swap_scnhdr_in(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) + + #define bfd_coff_swap_reloc_in(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) + + #define bfd_coff_bad_format_hook(abfd, filehdr) \ + ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) + + #define bfd_coff_set_arch_mach_hook(abfd, filehdr)\ + ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) + #define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\ + ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook)\ + (abfd, filehdr, aouthdr)) + + #define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\ + ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\ + (abfd, scnhdr, name, section, flags_ptr)) + + #define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\ + ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) + + #define bfd_coff_slurp_symbol_table(abfd)\ + ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) + + #define bfd_coff_symname_in_debug(abfd, sym)\ + ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) + + #define bfd_coff_force_symnames_in_strings(abfd)\ + (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings) + + #define bfd_coff_debug_string_prefix_length(abfd)\ + (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length) + + #define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\ + ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ + (abfd, file, base, symbol, aux, indaux)) + + #define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\ + reloc, data, src_ptr, dst_ptr)\ + ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ + (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) + + #define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\ + ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ + (abfd, section, reloc, shrink, link_info)) + + #define bfd_coff_classify_symbol(abfd, sym)\ + ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\ + (abfd, sym)) + + #define bfd_coff_compute_section_file_positions(abfd)\ + ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ + (abfd)) + + #define bfd_coff_start_final_link(obfd, info)\ + ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ + (obfd, info)) + #define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\ + ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ + (obfd, info, ibfd, o, con, rel, isyms, secs)) + #define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\ + ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ + (abfd, sec, rel, h, sym, addendp)) + #define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\ + ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ + (obfd, info, ibfd, sec, rel, adjustedp)) + #define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\ + value, string, cp, coll, hashp)\ + ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ + (info, abfd, name, flags, section, value, string, cp, coll, hashp)) + + #define bfd_coff_link_output_has_begun(a,p) \ + ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p)) + #define bfd_coff_final_link_postscript(a,p) \ + ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p)) + +Writing relocations +................... + +To write relocations, the back end steps though the canonical +relocation table and create an `internal_reloc'. The symbol index to +use is removed from the `offset' field in the symbol table supplied. +The address comes directly from the sum of the section base address and +the relocation offset; the type is dug directly from the howto field. +Then the `internal_reloc' is swapped into the shape of an +`external_reloc' and written out to disk. + +Reading linenumbers +................... + +Creating the linenumber table is done by reading in the entire coff +linenumber table, and creating another table for internal use. + + A coff linenumber table is structured so that each function is +marked as having a line number of 0. Each line within the function is +an offset from the first line in the function. The base of the line +number information for the table is stored in the symbol associated +with the function. + + Note: The PE format uses line number 0 for a flag indicating a new +source file. + + The information is copied from the external to the internal table, +and each symbol which marks a function is marked by pointing its... + + How does this work ? + +Reading relocations +................... + +Coff relocations are easily transformed into the internal BFD form +(`arelent'). + + Reading a coff relocation table is done in the following stages: + + * Read the entire coff relocation table into memory. + + * Process each relocation in turn; first swap it from the external + to the internal form. + + * Turn the symbol referenced in the relocation's symbol index into a + pointer into the canonical symbol table. This table is the same + as the one returned by a call to `bfd_canonicalize_symtab'. The + back end will call that routine and save the result if a + canonicalization hasn't been done. + + * The reloc index is turned into a pointer to a howto structure, in + a back end specific way. For instance, the 386 and 960 use the + `r_type' to directly produce an index into a howto table vector; + the 88k subtracts a number from the `r_type' field and creates an + addend field. + + +File: bfd.info, Node: elf, Next: mmo, Prev: coff, Up: BFD back ends + + + +ELF backends + + BFD support for ELF formats is being worked on. Currently, the best +supported back ends are for sparc and i386 (running svr4 or Solaris 2). + + Documentation of the internals of the support code still needs to be +written. The code is changing quickly enough that we haven't bothered +yet. + +`bfd_elf_find_section' +...................... + +*Synopsis* + struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name); + *Description* +Helper functions for GDB to locate the string tables. Since BFD hides +string tables from callers, GDB needs to use an internal hook to find +them. Sun's .stabstr, in particular, isn't even pointed to by the +.stab section, so ordinary mechanisms wouldn't work to find it, even if +we had some. + + +File: bfd.info, Node: mmo, Prev: elf, Up: BFD back ends + +mmo backend +=========== + +The mmo object format is used exclusively together with Professor +Donald E. Knuth's educational 64-bit processor MMIX. The simulator +`mmix' which is available at + +understands this format. That package also includes a combined +assembler and linker called `mmixal'. The mmo format has no advantages +feature-wise compared to e.g. ELF. It is a simple non-relocatable +object format with no support for archives or debugging information, +except for symbol value information and line numbers (which is not yet +implemented in BFD). See + for more +information about MMIX. The ELF format is used for intermediate object +files in the BFD implementation. + +* Menu: + +* File layout:: +* Symbol-table:: +* mmo section mapping:: + + +File: bfd.info, Node: File layout, Next: Symbol-table, Prev: mmo, Up: mmo + +File layout +----------- + +The mmo file contents is not partitioned into named sections as with +e.g. ELF. Memory areas is formed by specifying the location of the +data that follows. Only the memory area `0x0000...00' to `0x01ff...ff' +is executable, so it is used for code (and constants) and the area +`0x2000...00' to `0x20ff...ff' is used for writable data. *Note mmo +section mapping::. + + Contents is entered as 32-bit words, xor:ed over previous contents, +always zero-initialized. A word that starts with the byte `0x98' forms +a command called a `lopcode', where the next byte distinguished between +the thirteen lopcodes. The two remaining bytes, called the `Y' and `Z' +fields, or the `YZ' field (a 16-bit big-endian number), are used for +various purposes different for each lopcode. As documented in +, the +lopcodes are: + + There is provision for specifying "special data" of 65536 different +types. We use type 80 (decimal), arbitrarily chosen the same as the +ELF `e_machine' number for MMIX, filling it with section information +normally found in ELF objects. *Note mmo section mapping::. + +`lop_quote' + 0x98000001. The next word is contents, regardless of whether it + starts with 0x98 or not. + +`lop_loc' + 0x9801YYZZ, where `Z' is 1 or 2. This is a location directive, + setting the location for the next data to the next 32-bit word + (for Z = 1) or 64-bit word (for Z = 2), plus Y * 2^56. Normally + `Y' is 0 for the text segment and 2 for the data segment. + +`lop_skip' + 0x9802YYZZ. Increase the current location by `YZ' bytes. + +`lop_fixo' + 0x9803YYZZ, where `Z' is 1 or 2. Store the current location as 64 + bits into the location pointed to by the next 32-bit (Z = 1) or + 64-bit (Z = 2) word, plus Y * 2^56. + +`lop_fixr' + 0x9804YYZZ. `YZ' is stored into the current location plus 2 - 4 * + YZ. + +`lop_fixrx' + 0x980500ZZ. `Z' is 16 or 24. A value `L' derived from the + following 32-bit word are used in a manner similar to `YZ' in + lop_fixr: it is xor:ed into the current location minus 4 * L. The + first byte of the word is 0 or 1. If it is 1, then L = (LOWEST 24 + BITS OF WORD) - 2^Z, if 0, then L = (LOWEST 24 BITS OF WORD). + +`lop_file' + 0x9806YYZZ. `Y' is the file number, `Z' is count of 32-bit words. + Set the file number to `Y' and the line counter to 0. The next Z + * 4 bytes contain the file name, padded with zeros if the count is + not a multiple of four. The same `Y' may occur multiple times, + but `Z' must be 0 for all but the first occurrence. + +`lop_line' + 0x9807YYZZ. `YZ' is the line number. Together with lop_file, it + forms the source location for the next 32-bit word. Note that for + each non-lopcode 32-bit word, line numbers are assumed incremented + by one. + +`lop_spec' + 0x9808YYZZ. `YZ' is the type number. Data until the next lopcode + other than lop_quote forms special data of type `YZ'. *Note mmo + section mapping::. + + Other types than 80, (or type 80 with a content that does not + parse) is stored in sections named `.MMIX.spec_data.N' where N is + the `YZ'-type. The flags for such a sections say not to allocate + or load the data. The vma is 0. Contents of multiple occurrences + of special data N is concatenated to the data of the previous + lop_spec Ns. The location in data or code at which the lop_spec + occurred is lost. + +`lop_pre' + 0x980901ZZ. The first lopcode in a file. The `Z' field forms the + length of header information in 32-bit words, where the first word + tells the time in seconds since `00:00:00 GMT Jan 1 1970'. + +`lop_post' + 0x980a00ZZ. Z > 32. This lopcode follows after all + content-generating lopcodes in a program. The `Z' field denotes + the value of `rG' at the beginning of the program. The following + 256 - Z big-endian 64-bit words are loaded into global registers + `$G' ... `$255'. + +`lop_stab' + 0x980b0000. The next-to-last lopcode in a program. Must follow + immediately after the lop_post lopcode and its data. After this + lopcode follows all symbols in a compressed format (*note + Symbol-table::). + +`lop_end' + 0x980cYYZZ. The last lopcode in a program. It must follow the + lop_stab lopcode and its data. The `YZ' field contains the number + of 32-bit words of symbol table information after the preceding + lop_stab lopcode. + + Note that the lopcode "fixups"; `lop_fixr', `lop_fixrx' and +`lop_fixo' are not generated by BFD, but are handled. They are +generated by `mmixal'. + + This trivial one-label, one-instruction file: + + :Main TRAP 1,2,3 + + can be represented this way in mmo: + + 0x98090101 - lop_pre, one 32-bit word with timestamp. + + 0x98010002 - lop_loc, text segment, using a 64-bit address. + Note that mmixal does not emit this for the file above. + 0x00000000 - Address, high 32 bits. + 0x00000000 - Address, low 32 bits. + 0x98060002 - lop_file, 2 32-bit words for file-name. + 0x74657374 - "test" + 0x2e730000 - ".s\0\0" + 0x98070001 - lop_line, line 1. + 0x00010203 - TRAP 1,2,3 + 0x980a00ff - lop_post, setting $255 to 0. + 0x00000000 + 0x00000000 + 0x980b0000 - lop_stab for ":Main" = 0, serial 1. + 0x203a4040 *Note Symbol-table::. + 0x10404020 + 0x4d206120 + 0x69016e00 + 0x81000000 + 0x980c0005 - lop_end; symbol table contained five 32-bit words. + + +File: bfd.info, Node: Symbol-table, Next: mmo section mapping, Prev: File layout, Up: mmo + +Symbol table format +------------------- + +From mmixal.w (or really, the generated mmixal.tex) in +): +"Symbols are stored and retrieved by means of a `ternary search trie', +following ideas of Bentley and Sedgewick. (See ACM-SIAM Symp. on +Discrete Algorithms `8' (1997), 360-369; R.Sedgewick, `Algorithms in C' +(Reading, Mass. Addison-Wesley, 1998), `15.4'.) Each trie node stores +a character, and there are branches to subtries for the cases where a +given character is less than, equal to, or greater than the character +in the trie. There also is a pointer to a symbol table entry if a +symbol ends at the current node." + + So it's a tree encoded as a stream of bytes. The stream of bytes +acts on a single virtual global symbol, adding and removing characters +and signalling complete symbol points. Here, we read the stream and +create symbols at the completion points. + + First, there's a control byte `m'. If any of the listed bits in `m' +is nonzero, we execute what stands at the right, in the listed order: + + (MMO3_LEFT) + 0x40 - Traverse left trie. + (Read a new command byte and recurse.) + + (MMO3_SYMBITS) + 0x2f - Read the next byte as a character and store it in the + current character position; increment character position. + Test the bits of `m': + + (MMO3_WCHAR) + 0x80 - The character is 16-bit (so read another byte, + merge into current character. + + (MMO3_TYPEBITS) + 0xf - We have a complete symbol; parse the type, value + and serial number and do what should be done + with a symbol. The type and length information + is in j = (m & 0xf). + + (MMO3_REGQUAL_BITS) + j == 0xf: A register variable. The following + byte tells which register. + j <= 8: An absolute symbol. Read j bytes as the + big-endian number the symbol equals. + A j = 2 with two zero bytes denotes an + unknown symbol. + j > 8: As with j <= 8, but add (0x20 << 56) + to the value in the following j - 8 + bytes. + + Then comes the serial number, as a variant of + uleb128, but better named ubeb128: + Read bytes and shift the previous value left 7 + (multiply by 128). Add in the new byte, repeat + until a byte has bit 7 set. The serial number + is the computed value minus 128. + + (MMO3_MIDDLE) + 0x20 - Traverse middle trie. (Read a new command byte + and recurse.) Decrement character position. + + (MMO3_RIGHT) + 0x10 - Traverse right trie. (Read a new command byte and + recurse.) + + Let's look again at the `lop_stab' for the trivial file (*note File +layout::). + + 0x980b0000 - lop_stab for ":Main" = 0, serial 1. + 0x203a4040 + 0x10404020 + 0x4d206120 + 0x69016e00 + 0x81000000 + + This forms the trivial trie (note that the path between ":" and "M" +is redundant): + + 203a ":" + 40 / + 40 / + 10 \ + 40 / + 40 / + 204d "M" + 2061 "a" + 2069 "i" + 016e "n" is the last character in a full symbol, and + with a value represented in one byte. + 00 The value is 0. + 81 The serial number is 1. + + +File: bfd.info, Node: mmo section mapping, Prev: Symbol-table, Up: mmo + +mmo section mapping +------------------- + +The implementation in BFD uses special data type 80 (decimal) to +encapsulate and describe named sections, containing e.g. debug +information. If needed, any datum in the encapsulation will be quoted +using lop_quote. First comes a 32-bit word holding the number of +32-bit words containing the zero-terminated zero-padded segment name. +After the name there's a 32-bit word holding flags describing the +section type. Then comes a 64-bit big-endian word with the section +length (in bytes), then another with the section start address. +Depending on the type of section, the contents might follow, +zero-padded to 32-bit boundary. For a loadable section (such as data +or code), the contents might follow at some later point, not +necessarily immediately, as a lop_loc with the same start address as in +the section description, followed by the contents. This in effect +forms a descriptor that must be emitted before the actual contents. +Sections described this way must not overlap. + + For areas that don't have such descriptors, synthetic sections are +formed by BFD. Consecutive contents in the two memory areas +`0x0000...00' to `0x01ff...ff' and `0x2000...00' to `0x20ff...ff' are +entered in sections named `.text' and `.data' respectively. If an area +is not otherwise described, but would together with a neighboring lower +area be less than `0x40000000' bytes long, it is joined with the lower +area and the gap is zero-filled. For other cases, a new section is +formed, named `.MMIX.sec.N'. Here, N is a number, a running count +through the mmo file, starting at 0. + + A loadable section specified as: + + .section secname,"ax" + TETRA 1,2,3,4,-1,-2009 + BYTE 80 + + and linked to address `0x4', is represented by the sequence: + + 0x98080050 - lop_spec 80 + 0x00000002 - two 32-bit words for the section name + 0x7365636e - "secn" + 0x616d6500 - "ame\0" + 0x00000033 - flags CODE, READONLY, LOAD, ALLOC + 0x00000000 - high 32 bits of section length + 0x0000001c - section length is 28 bytes; 6 * 4 + 1 + alignment to 32 bits + 0x00000000 - high 32 bits of section address + 0x00000004 - section address is 4 + 0x98010002 - 64 bits with address of following data + 0x00000000 - high 32 bits of address + 0x00000004 - low 32 bits: data starts at address 4 + 0x00000001 - 1 + 0x00000002 - 2 + 0x00000003 - 3 + 0x00000004 - 4 + 0xffffffff - -1 + 0xfffff827 - -2009 + 0x50000000 - 80 as a byte, padded with zeros. + + Note that the lop_spec wrapping does not include the section +contents. Compare this to a non-loaded section specified as: + + .section thirdsec + TETRA 200001,100002 + BYTE 38,40 + + This, when linked to address `0x200000000000001c', is represented by: + + 0x98080050 - lop_spec 80 + 0x00000002 - two 32-bit words for the section name + 0x7365636e - "thir" + 0x616d6500 - "dsec" + 0x00000010 - flag READONLY + 0x00000000 - high 32 bits of section length + 0x0000000c - section length is 12 bytes; 2 * 4 + 2 + alignment to 32 bits + 0x20000000 - high 32 bits of address + 0x0000001c - low 32 bits of address 0x200000000000001c + 0x00030d41 - 200001 + 0x000186a2 - 100002 + 0x26280000 - 38, 40 as bytes, padded with zeros + + For the latter example, the section contents must not be loaded in +memory, and is therefore specified as part of the special data. The +address is usually unimportant but might provide information for e.g. +the DWARF 2 debugging format. + diff --git a/bfd/doc/bfd.info-2 b/bfd/doc/bfd.info-2 new file mode 100644 index 0000000000000..33c9d3f0ffdca --- /dev/null +++ b/bfd/doc/bfd.info-2 @@ -0,0 +1,1396 @@ +This is bfd.info, produced by makeinfo version 4.6 from bfd.texinfo. + +START-INFO-DIR-ENTRY +* Bfd: (bfd). The Binary File Descriptor library. +END-INFO-DIR-ENTRY + + This file documents the BFD library. + + Copyright (C) 1991, 2000, 2001, 2003 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 + or any later version published by the Free Software Foundation; + with no Invariant Sections, with no Front-Cover Texts, and with no + Back-Cover Texts. A copy of the license is included in the +section entitled "GNU Free Documentation License". + + +File: bfd.info, Node: GNU Free Documentation License, Next: Index, Prev: BFD back ends, Up: Top + +GNU Free Documentation License +****************************** + + Version 1.1, March 2000 + Copyright (C) 2000, 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. + + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or other + written document "free" in the sense of freedom: to assure everyone + the effective freedom to copy and redistribute it, with or without + modifying it, either commercially or noncommercially. Secondarily, + this License preserves for the author and publisher a way to get + credit for their work, while not being considered responsible for + modifications made by others. + + This License is a kind of "copyleft", which means that derivative + works of the document must themselves be free in the same sense. + It complements the GNU General Public License, which is a copyleft + license designed for free software. + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same freedoms + that the software does. But this License is not limited to + software manuals; it can be used for any textual work, regardless + of subject matter or whether it is published as a printed book. + We recommend this License principally for works whose purpose is + instruction or reference. + + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work that contains a + notice placed by the copyright holder saying it can be distributed + under the terms of this License. The "Document", below, refers to + any such manual or work. Any member of the public is a licensee, + and is addressed as "you." + + A "Modified Version" of the Document means any work containing the + Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. + + A "Secondary Section" is a named appendix or a front-matter + section of the Document that deals exclusively with the + relationship of the publishers or authors of the Document to the + Document's overall subject (or to related matters) and contains + nothing that could fall directly within that overall subject. + (For example, if the Document is in part a textbook of + mathematics, a Secondary Section may not explain any mathematics.) + The relationship could be a matter of historical connection with + the subject or with related matters, or of legal, commercial, + philosophical, ethical or political position regarding them. + + The "Invariant Sections" are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in + the notice that says that the Document is released under this + License. + + The "Cover Texts" are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice + that says that the Document is released under this License. + + A "Transparent" copy of the Document means a machine-readable copy, + represented in a format whose specification is available to the + general public, whose contents can be viewed and edited directly + and straightforwardly with generic text editors or (for images + composed of pixels) generic paint programs or (for drawings) some + widely available drawing editor, and that is suitable for input to + text formatters or for automatic translation to a variety of + formats suitable for input to text formatters. A copy made in an + otherwise Transparent file format whose markup has been designed + to thwart or discourage subsequent modification by readers is not + Transparent. A copy that is not "Transparent" is called "Opaque." + + Examples of suitable formats for Transparent copies include plain + ASCII without markup, Texinfo input format, LaTeX input format, + SGML or XML using a publicly available DTD, and + standard-conforming simple HTML designed for human modification. + Opaque formats include PostScript, PDF, proprietary formats that + can be read and edited only by proprietary word processors, SGML + or XML for which the DTD and/or processing tools are not generally + available, and the machine-generated HTML produced by some word + processors for output purposes only. + + The "Title Page" means, for a printed book, the title page itself, + plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For + works in formats which do not have any title page as such, "Title + Page" means the text near the most prominent appearance of the + work's title, preceding the beginning of the body of the text. + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that you + add no other conditions whatsoever to those of this License. You + may not use technical measures to obstruct or control the reading + or further copying of the copies you make or distribute. However, + you may accept compensation in exchange for copies. If you + distribute a large enough number of copies you must also follow + the conditions in section 3. + + You may also lend copies, under the same conditions stated above, + and you may publicly display copies. + + 3. COPYING IN QUANTITY + + If you publish printed copies of the Document numbering more than + 100, and the Document's license notice requires Cover Texts, you + must enclose the copies in covers that carry, clearly and legibly, + all these Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also clearly + and legibly identify you as the publisher of these copies. The + front cover must present the full title with all words of the + title equally prominent and visible. You may add other material + on the covers in addition. Copying with changes limited to the + covers, as long as they preserve the title of the Document and + satisfy these conditions, can be treated as verbatim copying in + other respects. + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + If you publish or distribute Opaque copies of the Document + numbering more than 100, you must either include a + machine-readable Transparent copy along with each Opaque copy, or + state in or with each Opaque copy a publicly-accessible + computer-network location containing a complete Transparent copy + of the Document, free of added material, which the general + network-using public has access to download anonymously at no + charge using public-standard network protocols. If you use the + latter option, you must take reasonably prudent steps, when you + begin distribution of Opaque copies in quantity, to ensure that + this Transparent copy will remain thus accessible at the stated + location until at least one year after the last time you + distribute an Opaque copy (directly or through your agents or + retailers) of that edition to the public. + + It is requested, but not required, that you contact the authors of + the Document well before redistributing any large number of + copies, to give them a chance to provide you with an updated + version of the Document. + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document + under the conditions of sections 2 and 3 above, provided that you + release the Modified Version under precisely this License, with + the Modified Version filling the role of the Document, thus + licensing distribution and modification of the Modified Version to + whoever possesses a copy of it. In addition, you must do these + things in the Modified Version: + + A. Use in the Title Page (and on the covers, if any) a title + distinct from that of the Document, and from those of previous + versions (which should, if there were any, be listed in the + History section of the Document). You may use the same title + as a previous version if the original publisher of that version + gives permission. + B. List on the Title Page, as authors, one or more persons or + entities responsible for authorship of the modifications in the + Modified Version, together with at least five of the principal + authors of the Document (all of its principal authors, if it + has less than five). + C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. + D. Preserve all the copyright notices of the Document. + E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + F. Include, immediately after the copyright notices, a license + notice giving the public permission to use the Modified Version + under the terms of this License, in the form shown in the + Addendum below. + G. Preserve in that license notice the full lists of Invariant + Sections and required Cover Texts given in the Document's + license notice. + H. Include an unaltered copy of this License. + I. Preserve the section entitled "History", and its title, and add + to it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. + If there is no section entitled "History" in the Document, + create one stating the title, year, authors, and publisher of + the Document as given on its Title Page, then add an item + describing the Modified Version as stated in the previous + sentence. + J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and + likewise the network locations given in the Document for + previous versions it was based on. These may be placed in the + "History" section. You may omit a network location for a work + that was published at least four years before the Document + itself, or if the original publisher of the version it refers + to gives permission. + K. In any section entitled "Acknowledgements" or "Dedications", + preserve the section's title, and preserve in the section all the + substance and tone of each of the contributor acknowledgements + and/or dedications given therein. + L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. + M. Delete any section entitled "Endorsements." Such a section + may not be included in the Modified Version. + N. Do not retitle any existing section as "Endorsements" or to + conflict in title with any Invariant Section. + + If the Modified Version includes new front-matter sections or + appendices that qualify as Secondary Sections and contain no + material copied from the Document, you may at your option + designate some or all of these sections as invariant. To do this, + add their titles to the list of Invariant Sections in the Modified + Version's license notice. These titles must be distinct from any + other section titles. + + You may add a section entitled "Endorsements", provided it contains + nothing but endorsements of your Modified Version by various + parties-for example, statements of peer review or that the text has + been approved by an organization as the authoritative definition + of a standard. + + You may add a passage of up to five words as a Front-Cover Text, + and a passage of up to 25 words as a Back-Cover Text, to the end + of the list of Cover Texts in the Modified Version. Only one + passage of Front-Cover Text and one of Back-Cover Text may be + added by (or through arrangements made by) any one entity. If the + Document already includes a cover text for the same cover, + previously added by you or by arrangement made by the same entity + you are acting on behalf of, you may not add another; but you may + replace the old one, on explicit permission from the previous + publisher that added the old one. + + The author(s) and publisher(s) of the Document do not by this + License give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version. + + 5. COMBINING DOCUMENTS + + You may combine the Document with other documents released under + this License, under the terms defined in section 4 above for + modified versions, provided that you include in the combination + all of the Invariant Sections of all of the original documents, + unmodified, and list them all as Invariant Sections of your + combined work in its license notice. + + The combined work need only contain one copy of this License, and + multiple identical Invariant Sections may be replaced with a single + copy. If there are multiple Invariant Sections with the same name + but different contents, make the title of each such section unique + by adding at the end of it, in parentheses, the name of the + original author or publisher of that section if known, or else a + unique number. Make the same adjustment to the section titles in + the list of Invariant Sections in the license notice of the + combined work. + + In the combination, you must combine any sections entitled + "History" in the various original documents, forming one section + entitled "History"; likewise combine any sections entitled + "Acknowledgements", and any sections entitled "Dedications." You + must delete all sections entitled "Endorsements." + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other + documents released under this License, and replace the individual + copies of this License in the various documents with a single copy + that is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the + documents in all other respects. + + You may extract a single document from such a collection, and + distribute it individually under this License, provided you insert + a copy of this License into the extracted document, and follow + this License in all other respects regarding verbatim copying of + that document. + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with other + separate and independent documents or works, in or on a volume of + a storage or distribution medium, does not as a whole count as a + Modified Version of the Document, provided no compilation + copyright is claimed for the compilation. Such a compilation is + called an "aggregate", and this License does not apply to the + other self-contained works thus compiled with the Document, on + account of their being thus compiled, if they are not themselves + derivative works of the Document. + + If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one + quarter of the entire aggregate, the Document's Cover Texts may be + placed on covers that surround only the Document within the + aggregate. Otherwise they must appear on covers around the whole + aggregate. + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section + 4. Replacing Invariant Sections with translations requires special + permission from their copyright holders, but you may include + translations of some or all Invariant Sections in addition to the + original versions of these Invariant Sections. You may include a + translation of this License provided that you also include the + original English version of this License. In case of a + disagreement between the translation and the original English + version of this License, the original English version will prevail. + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document + except as expressly provided for under this License. Any other + attempt to copy, modify, sublicense or distribute the Document 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. + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software Foundation may publish new, revised versions of + the GNU Free Documentation 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. See + http://www.gnu.org/copyleft/. + + Each version of the License is given a distinguishing version + number. If the Document specifies that a particular numbered + version of this License "or any later version" applies to it, you + have the option of following the terms and conditions either of + that specified version or of any later version that has been + published (not as a draft) by the Free Software Foundation. If + the Document does not specify a version number of this License, + you may choose any version ever published (not as a draft) by the + Free Software Foundation. + + +ADDENDUM: How to use this License for your documents +==================================================== + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and license +notices just after the title page: + + Copyright (C) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 + or any later version published by the Free Software Foundation; + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. + A copy of the license is included in the section entitled "GNU + Free Documentation License." + + If you have no Invariant Sections, write "with no Invariant Sections" +instead of saying which ones are invariant. If you have no Front-Cover +Texts, write "no Front-Cover Texts" instead of "Front-Cover Texts being +LIST"; likewise for Back-Cover Texts. + + If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, to +permit their use in free software. + + +File: bfd.info, Node: Index, Prev: GNU Free Documentation License, Up: Top + +Index +***** + +* Menu: + +* _bfd_final_link_relocate: Relocating the section contents. +* _bfd_generic_link_add_archive_symbols: Adding symbols from an archive. +* _bfd_generic_link_add_one_symbol: Adding symbols from an object file. +* _bfd_generic_make_empty_symbol: symbol handling functions. +* _bfd_link_add_symbols in target vector: Adding Symbols to the Hash Table. +* _bfd_link_final_link in target vector: Performing the Final Link. +* _bfd_link_hash_table_create in target vector: Creating a Linker Hash Table. +* _bfd_relocate_contents: Relocating the section contents. +* _bfd_strip_section_from_output: section prototypes. +* aout_SIZE_machine_type: aout. +* aout_SIZE_mkobject: aout. +* aout_SIZE_new_section_hook: aout. +* aout_SIZE_set_arch_mach: aout. +* aout_SIZE_some_aout_object_p: aout. +* aout_SIZE_swap_exec_header_in: aout. +* aout_SIZE_swap_exec_header_out: aout. +* arelent_chain: typedef arelent. +* BFD: Overview. +* BFD canonical format: Canonical format. +* bfd_alloc: Opening and Closing. +* bfd_alt_mach_code: BFD front end. +* bfd_arch_bits_per_address: Architectures. +* bfd_arch_bits_per_byte: Architectures. +* bfd_arch_get_compatible: Architectures. +* bfd_arch_list: Architectures. +* bfd_arch_mach_octets_per_byte: Architectures. +* bfd_archive_filename: BFD front end. +* bfd_cache_close: File Caching. +* bfd_cache_init: File Caching. +* bfd_cache_lookup: File Caching. +* bfd_cache_lookup_worker: File Caching. +* BFD_CACHE_MAX_OPEN macro: File Caching. +* bfd_calc_gnu_debuglink_crc32: Opening and Closing. +* bfd_canonicalize_reloc: BFD front end. +* bfd_canonicalize_symtab: symbol handling functions. +* bfd_check_format: Formats. +* bfd_check_format_matches: Formats. +* bfd_check_overflow: typedef arelent. +* bfd_close: Opening and Closing. +* bfd_close_all_done: Opening and Closing. +* bfd_coff_backend_data: coff. +* bfd_copy_private_bfd_data: BFD front end. +* bfd_copy_private_section_data: section prototypes. +* bfd_copy_private_symbol_data: symbol handling functions. +* bfd_core_file_failing_command: Core Files. +* bfd_core_file_failing_signal: Core Files. +* bfd_create: Opening and Closing. +* bfd_create_gnu_debuglink_section: Opening and Closing. +* bfd_decode_symclass: symbol handling functions. +* bfd_default_arch_struct: Architectures. +* bfd_default_compatible: Architectures. +* bfd_default_reloc_type_lookup: howto manager. +* bfd_default_scan: Architectures. +* bfd_default_set_arch_mach: Architectures. +* bfd_elf_find_section: elf. +* bfd_errmsg: BFD front end. +* bfd_fdopenr: Opening and Closing. +* bfd_fill_in_gnu_debuglink_section: Opening and Closing. +* bfd_find_target: bfd_target. +* bfd_follow_gnu_debuglink: Opening and Closing. +* bfd_format_string: Formats. +* bfd_generic_discard_group: section prototypes. +* bfd_generic_gc_sections: howto manager. +* bfd_generic_get_relocated_section_contents: howto manager. +* bfd_generic_merge_sections: howto manager. +* bfd_generic_relax_section: howto manager. +* bfd_get_arch: Architectures. +* bfd_get_arch_info: Architectures. +* bfd_get_arch_size: BFD front end. +* bfd_get_error: BFD front end. +* bfd_get_error_handler: BFD front end. +* bfd_get_gp_size: BFD front end. +* bfd_get_mach: Architectures. +* bfd_get_mtime: BFD front end. +* bfd_get_next_mapent: Archives. +* bfd_get_reloc_code_name: howto manager. +* bfd_get_reloc_size: typedef arelent. +* bfd_get_reloc_upper_bound: BFD front end. +* bfd_get_section_by_name: section prototypes. +* bfd_get_section_contents: section prototypes. +* bfd_get_sign_extend_vma: BFD front end. +* bfd_get_size <1>: Internal. +* bfd_get_size: BFD front end. +* bfd_get_symtab_upper_bound: symbol handling functions. +* bfd_get_unique_section_name: section prototypes. +* bfd_h_put_size: Internal. +* bfd_hash_allocate: Creating and Freeing a Hash Table. +* bfd_hash_lookup: Looking Up or Entering a String. +* bfd_hash_newfunc: Creating and Freeing a Hash Table. +* bfd_hash_table_free: Creating and Freeing a Hash Table. +* bfd_hash_table_init: Creating and Freeing a Hash Table. +* bfd_hash_table_init_n: Creating and Freeing a Hash Table. +* bfd_hash_traverse: Traversing a Hash Table. +* bfd_init: Initialization. +* bfd_install_relocation: typedef arelent. +* bfd_is_local_label: symbol handling functions. +* bfd_is_local_label_name: symbol handling functions. +* bfd_is_undefined_symclass: symbol handling functions. +* bfd_last_cache: File Caching. +* bfd_link_split_section: Writing the symbol table. +* bfd_log2: Internal. +* bfd_lookup_arch: Architectures. +* bfd_make_debug_symbol: symbol handling functions. +* bfd_make_empty_symbol: symbol handling functions. +* bfd_make_readable: Opening and Closing. +* bfd_make_section: section prototypes. +* bfd_make_section_anyway: section prototypes. +* bfd_make_section_old_way: section prototypes. +* bfd_make_writable: Opening and Closing. +* bfd_map_over_sections: section prototypes. +* bfd_merge_private_bfd_data: BFD front end. +* bfd_octets_per_byte: Architectures. +* bfd_open_file: File Caching. +* bfd_openr: Opening and Closing. +* bfd_openr_next_archived_file: Archives. +* bfd_openstreamr: Opening and Closing. +* bfd_openw: Opening and Closing. +* bfd_perform_relocation: typedef arelent. +* bfd_perror: BFD front end. +* bfd_preserve_finish: BFD front end. +* bfd_preserve_restore: BFD front end. +* bfd_preserve_save: BFD front end. +* bfd_print_symbol_vandf: symbol handling functions. +* bfd_printable_arch_mach: Architectures. +* bfd_printable_name: Architectures. +* bfd_put_size: Internal. +* BFD_RELOC_12_PCREL: howto manager. +* BFD_RELOC_14: howto manager. +* BFD_RELOC_16: howto manager. +* BFD_RELOC_16_BASEREL: howto manager. +* BFD_RELOC_16_GOT_PCREL: howto manager. +* BFD_RELOC_16_GOTOFF: howto manager. +* BFD_RELOC_16_PCREL: howto manager. +* BFD_RELOC_16_PCREL_S2: howto manager. +* BFD_RELOC_16_PLT_PCREL: howto manager. +* BFD_RELOC_16_PLTOFF: howto manager. +* BFD_RELOC_23_PCREL_S2: howto manager. +* BFD_RELOC_24: howto manager. +* BFD_RELOC_24_PCREL: howto manager. +* BFD_RELOC_24_PLT_PCREL: howto manager. +* BFD_RELOC_26: howto manager. +* BFD_RELOC_32: howto manager. +* BFD_RELOC_32_BASEREL: howto manager. +* BFD_RELOC_32_GOT_PCREL: howto manager. +* BFD_RELOC_32_GOTOFF: howto manager. +* BFD_RELOC_32_PCREL: howto manager. +* BFD_RELOC_32_PCREL_S2: howto manager. +* BFD_RELOC_32_PLT_PCREL: howto manager. +* BFD_RELOC_32_PLTOFF: howto manager. +* BFD_RELOC_386_COPY: howto manager. +* BFD_RELOC_386_GLOB_DAT: howto manager. +* BFD_RELOC_386_GOT32: howto manager. +* BFD_RELOC_386_GOTOFF: howto manager. +* BFD_RELOC_386_GOTPC: howto manager. +* BFD_RELOC_386_JUMP_SLOT: howto manager. +* BFD_RELOC_386_PLT32: howto manager. +* BFD_RELOC_386_RELATIVE: howto manager. +* BFD_RELOC_386_TLS_DTPMOD32: howto manager. +* BFD_RELOC_386_TLS_DTPOFF32: howto manager. +* BFD_RELOC_386_TLS_GD: howto manager. +* BFD_RELOC_386_TLS_GOTIE: howto manager. +* BFD_RELOC_386_TLS_IE: howto manager. +* BFD_RELOC_386_TLS_IE_32: howto manager. +* BFD_RELOC_386_TLS_LDM: howto manager. +* BFD_RELOC_386_TLS_LDO_32: howto manager. +* BFD_RELOC_386_TLS_LE: howto manager. +* BFD_RELOC_386_TLS_LE_32: howto manager. +* BFD_RELOC_386_TLS_TPOFF: howto manager. +* BFD_RELOC_386_TLS_TPOFF32: howto manager. +* BFD_RELOC_390_12: howto manager. +* BFD_RELOC_390_20: howto manager. +* BFD_RELOC_390_COPY: howto manager. +* BFD_RELOC_390_GLOB_DAT: howto manager. +* BFD_RELOC_390_GOT12: howto manager. +* BFD_RELOC_390_GOT16: howto manager. +* BFD_RELOC_390_GOT20: howto manager. +* BFD_RELOC_390_GOT64: howto manager. +* BFD_RELOC_390_GOTENT: howto manager. +* BFD_RELOC_390_GOTOFF64: howto manager. +* BFD_RELOC_390_GOTPC: howto manager. +* BFD_RELOC_390_GOTPCDBL: howto manager. +* BFD_RELOC_390_GOTPLT12: howto manager. +* BFD_RELOC_390_GOTPLT16: howto manager. +* BFD_RELOC_390_GOTPLT20: howto manager. +* BFD_RELOC_390_GOTPLT32: howto manager. +* BFD_RELOC_390_GOTPLT64: howto manager. +* BFD_RELOC_390_GOTPLTENT: howto manager. +* BFD_RELOC_390_JMP_SLOT: howto manager. +* BFD_RELOC_390_PC16DBL: howto manager. +* BFD_RELOC_390_PC32DBL: howto manager. +* BFD_RELOC_390_PLT16DBL: howto manager. +* BFD_RELOC_390_PLT32: howto manager. +* BFD_RELOC_390_PLT32DBL: howto manager. +* BFD_RELOC_390_PLT64: howto manager. +* BFD_RELOC_390_PLTOFF16: howto manager. +* BFD_RELOC_390_PLTOFF32: howto manager. +* BFD_RELOC_390_PLTOFF64: howto manager. +* BFD_RELOC_390_RELATIVE: howto manager. +* BFD_RELOC_390_TLS_DTPMOD: howto manager. +* BFD_RELOC_390_TLS_DTPOFF: howto manager. +* BFD_RELOC_390_TLS_GD32: howto manager. +* BFD_RELOC_390_TLS_GD64: howto manager. +* BFD_RELOC_390_TLS_GDCALL: howto manager. +* BFD_RELOC_390_TLS_GOTIE12: howto manager. +* BFD_RELOC_390_TLS_GOTIE20: howto manager. +* BFD_RELOC_390_TLS_GOTIE32: howto manager. +* BFD_RELOC_390_TLS_GOTIE64: howto manager. +* BFD_RELOC_390_TLS_IE32: howto manager. +* BFD_RELOC_390_TLS_IE64: howto manager. +* BFD_RELOC_390_TLS_IEENT: howto manager. +* BFD_RELOC_390_TLS_LDCALL: howto manager. +* BFD_RELOC_390_TLS_LDM32: howto manager. +* BFD_RELOC_390_TLS_LDM64: howto manager. +* BFD_RELOC_390_TLS_LDO32: howto manager. +* BFD_RELOC_390_TLS_LDO64: howto manager. +* BFD_RELOC_390_TLS_LE32: howto manager. +* BFD_RELOC_390_TLS_LE64: howto manager. +* BFD_RELOC_390_TLS_LOAD: howto manager. +* BFD_RELOC_390_TLS_TPOFF: howto manager. +* BFD_RELOC_64: howto manager. +* BFD_RELOC_64_PCREL: howto manager. +* BFD_RELOC_64_PLT_PCREL: howto manager. +* BFD_RELOC_64_PLTOFF: howto manager. +* BFD_RELOC_68K_GLOB_DAT: howto manager. +* BFD_RELOC_68K_JMP_SLOT: howto manager. +* BFD_RELOC_68K_RELATIVE: howto manager. +* BFD_RELOC_8: howto manager. +* BFD_RELOC_860_COPY: howto manager. +* BFD_RELOC_860_GLOB_DAT: howto manager. +* BFD_RELOC_860_HAGOT: howto manager. +* BFD_RELOC_860_HAGOTOFF: howto manager. +* BFD_RELOC_860_HAPC: howto manager. +* BFD_RELOC_860_HIGH: howto manager. +* BFD_RELOC_860_HIGHADJ: howto manager. +* BFD_RELOC_860_HIGOT: howto manager. +* BFD_RELOC_860_HIGOTOFF: howto manager. +* BFD_RELOC_860_JUMP_SLOT: howto manager. +* BFD_RELOC_860_LOGOT0: howto manager. +* BFD_RELOC_860_LOGOT1: howto manager. +* BFD_RELOC_860_LOGOTOFF0: howto manager. +* BFD_RELOC_860_LOGOTOFF1: howto manager. +* BFD_RELOC_860_LOGOTOFF2: howto manager. +* BFD_RELOC_860_LOGOTOFF3: howto manager. +* BFD_RELOC_860_LOPC: howto manager. +* BFD_RELOC_860_LOW0: howto manager. +* BFD_RELOC_860_LOW1: howto manager. +* BFD_RELOC_860_LOW2: howto manager. +* BFD_RELOC_860_LOW3: howto manager. +* BFD_RELOC_860_PC16: howto manager. +* BFD_RELOC_860_PC26: howto manager. +* BFD_RELOC_860_PLT26: howto manager. +* BFD_RELOC_860_RELATIVE: howto manager. +* BFD_RELOC_860_SPGOT0: howto manager. +* BFD_RELOC_860_SPGOT1: howto manager. +* BFD_RELOC_860_SPGOTOFF0: howto manager. +* BFD_RELOC_860_SPGOTOFF1: howto manager. +* BFD_RELOC_860_SPLIT0: howto manager. +* BFD_RELOC_860_SPLIT1: howto manager. +* BFD_RELOC_860_SPLIT2: howto manager. +* BFD_RELOC_8_BASEREL: howto manager. +* BFD_RELOC_8_FFnn: howto manager. +* BFD_RELOC_8_GOT_PCREL: howto manager. +* BFD_RELOC_8_GOTOFF: howto manager. +* BFD_RELOC_8_PCREL: howto manager. +* BFD_RELOC_8_PLT_PCREL: howto manager. +* BFD_RELOC_8_PLTOFF: howto manager. +* BFD_RELOC_ALPHA_BRSGP: howto manager. +* BFD_RELOC_ALPHA_CODEADDR: howto manager. +* BFD_RELOC_ALPHA_DTPMOD64: howto manager. +* BFD_RELOC_ALPHA_DTPREL16: howto manager. +* BFD_RELOC_ALPHA_DTPREL64: howto manager. +* BFD_RELOC_ALPHA_DTPREL_HI16: howto manager. +* BFD_RELOC_ALPHA_DTPREL_LO16: howto manager. +* BFD_RELOC_ALPHA_ELF_LITERAL: howto manager. +* BFD_RELOC_ALPHA_GOTDTPREL16: howto manager. +* BFD_RELOC_ALPHA_GOTTPREL16: howto manager. +* BFD_RELOC_ALPHA_GPDISP: howto manager. +* BFD_RELOC_ALPHA_GPDISP_HI16: howto manager. +* BFD_RELOC_ALPHA_GPDISP_LO16: howto manager. +* BFD_RELOC_ALPHA_GPREL_HI16: howto manager. +* BFD_RELOC_ALPHA_GPREL_LO16: howto manager. +* BFD_RELOC_ALPHA_HINT: howto manager. +* BFD_RELOC_ALPHA_LINKAGE: howto manager. +* BFD_RELOC_ALPHA_LITERAL: howto manager. +* BFD_RELOC_ALPHA_LITUSE: howto manager. +* BFD_RELOC_ALPHA_TLSGD: howto manager. +* BFD_RELOC_ALPHA_TLSLDM: howto manager. +* BFD_RELOC_ALPHA_TPREL16: howto manager. +* BFD_RELOC_ALPHA_TPREL64: howto manager. +* BFD_RELOC_ALPHA_TPREL_HI16: howto manager. +* BFD_RELOC_ALPHA_TPREL_LO16: howto manager. +* BFD_RELOC_ARC_B22_PCREL: howto manager. +* BFD_RELOC_ARC_B26: howto manager. +* BFD_RELOC_ARM_ADR_IMM: howto manager. +* BFD_RELOC_ARM_ADRL_IMMEDIATE: howto manager. +* BFD_RELOC_ARM_COPY: howto manager. +* BFD_RELOC_ARM_CP_OFF_IMM: howto manager. +* BFD_RELOC_ARM_CP_OFF_IMM_S2: howto manager. +* BFD_RELOC_ARM_GLOB_DAT: howto manager. +* BFD_RELOC_ARM_GOT12: howto manager. +* BFD_RELOC_ARM_GOT32: howto manager. +* BFD_RELOC_ARM_GOTOFF: howto manager. +* BFD_RELOC_ARM_GOTPC: howto manager. +* BFD_RELOC_ARM_HWLITERAL: howto manager. +* BFD_RELOC_ARM_IMMEDIATE: howto manager. +* BFD_RELOC_ARM_IN_POOL: howto manager. +* BFD_RELOC_ARM_JUMP_SLOT: howto manager. +* BFD_RELOC_ARM_LDR_IMM: howto manager. +* BFD_RELOC_ARM_LITERAL: howto manager. +* BFD_RELOC_ARM_MULTI: howto manager. +* BFD_RELOC_ARM_OFFSET_IMM: howto manager. +* BFD_RELOC_ARM_OFFSET_IMM8: howto manager. +* BFD_RELOC_ARM_PCREL_BLX: howto manager. +* BFD_RELOC_ARM_PCREL_BRANCH: howto manager. +* BFD_RELOC_ARM_PLT32: howto manager. +* BFD_RELOC_ARM_RELATIVE: howto manager. +* BFD_RELOC_ARM_SHIFT_IMM: howto manager. +* BFD_RELOC_ARM_SWI: howto manager. +* BFD_RELOC_ARM_THUMB_ADD: howto manager. +* BFD_RELOC_ARM_THUMB_IMM: howto manager. +* BFD_RELOC_ARM_THUMB_OFFSET: howto manager. +* BFD_RELOC_ARM_THUMB_SHIFT: howto manager. +* BFD_RELOC_AVR_13_PCREL: howto manager. +* BFD_RELOC_AVR_16_PM: howto manager. +* BFD_RELOC_AVR_7_PCREL: howto manager. +* BFD_RELOC_AVR_CALL: howto manager. +* BFD_RELOC_AVR_HH8_LDI: howto manager. +* BFD_RELOC_AVR_HH8_LDI_NEG: howto manager. +* BFD_RELOC_AVR_HH8_LDI_PM: howto manager. +* BFD_RELOC_AVR_HH8_LDI_PM_NEG: howto manager. +* BFD_RELOC_AVR_HI8_LDI: howto manager. +* BFD_RELOC_AVR_HI8_LDI_NEG: howto manager. +* BFD_RELOC_AVR_HI8_LDI_PM: howto manager. +* BFD_RELOC_AVR_HI8_LDI_PM_NEG: howto manager. +* BFD_RELOC_AVR_LO8_LDI: howto manager. +* BFD_RELOC_AVR_LO8_LDI_NEG: howto manager. +* BFD_RELOC_AVR_LO8_LDI_PM: howto manager. +* BFD_RELOC_AVR_LO8_LDI_PM_NEG: howto manager. +* bfd_reloc_code_type: howto manager. +* BFD_RELOC_CRIS_16_GOT: howto manager. +* BFD_RELOC_CRIS_16_GOTPLT: howto manager. +* BFD_RELOC_CRIS_32_GOT: howto manager. +* BFD_RELOC_CRIS_32_GOTPLT: howto manager. +* BFD_RELOC_CRIS_32_GOTREL: howto manager. +* BFD_RELOC_CRIS_32_PLT_GOTREL: howto manager. +* BFD_RELOC_CRIS_32_PLT_PCREL: howto manager. +* BFD_RELOC_CRIS_BDISP8: howto manager. +* BFD_RELOC_CRIS_COPY: howto manager. +* BFD_RELOC_CRIS_GLOB_DAT: howto manager. +* BFD_RELOC_CRIS_JUMP_SLOT: howto manager. +* BFD_RELOC_CRIS_RELATIVE: howto manager. +* BFD_RELOC_CRIS_SIGNED_6: howto manager. +* BFD_RELOC_CRIS_UNSIGNED_4: howto manager. +* BFD_RELOC_CRIS_UNSIGNED_5: howto manager. +* BFD_RELOC_CRIS_UNSIGNED_6: howto manager. +* BFD_RELOC_CTOR: howto manager. +* BFD_RELOC_D10V_10_PCREL_L: howto manager. +* BFD_RELOC_D10V_10_PCREL_R: howto manager. +* BFD_RELOC_D10V_18: howto manager. +* BFD_RELOC_D10V_18_PCREL: howto manager. +* BFD_RELOC_D30V_15: howto manager. +* BFD_RELOC_D30V_15_PCREL: howto manager. +* BFD_RELOC_D30V_15_PCREL_R: howto manager. +* BFD_RELOC_D30V_21: howto manager. +* BFD_RELOC_D30V_21_PCREL: howto manager. +* BFD_RELOC_D30V_21_PCREL_R: howto manager. +* BFD_RELOC_D30V_32: howto manager. +* BFD_RELOC_D30V_32_PCREL: howto manager. +* BFD_RELOC_D30V_6: howto manager. +* BFD_RELOC_D30V_9_PCREL: howto manager. +* BFD_RELOC_D30V_9_PCREL_R: howto manager. +* BFD_RELOC_DLX_HI16_S: howto manager. +* BFD_RELOC_DLX_JMP26: howto manager. +* BFD_RELOC_DLX_LO16: howto manager. +* BFD_RELOC_FR30_10_IN_8: howto manager. +* BFD_RELOC_FR30_12_PCREL: howto manager. +* BFD_RELOC_FR30_20: howto manager. +* BFD_RELOC_FR30_48: howto manager. +* BFD_RELOC_FR30_6_IN_4: howto manager. +* BFD_RELOC_FR30_8_IN_8: howto manager. +* BFD_RELOC_FR30_9_IN_8: howto manager. +* BFD_RELOC_FR30_9_PCREL: howto manager. +* BFD_RELOC_FRV_FUNCDESC: howto manager. +* BFD_RELOC_FRV_FUNCDESC_GOT12: howto manager. +* BFD_RELOC_FRV_FUNCDESC_GOTHI: howto manager. +* BFD_RELOC_FRV_FUNCDESC_GOTLO: howto manager. +* BFD_RELOC_FRV_FUNCDESC_GOTOFF12: howto manager. +* BFD_RELOC_FRV_FUNCDESC_GOTOFFHI: howto manager. +* BFD_RELOC_FRV_FUNCDESC_GOTOFFLO: howto manager. +* BFD_RELOC_FRV_FUNCDESC_VALUE: howto manager. +* BFD_RELOC_FRV_GOT12: howto manager. +* BFD_RELOC_FRV_GOTHI: howto manager. +* BFD_RELOC_FRV_GOTLO: howto manager. +* BFD_RELOC_FRV_GOTOFF12: howto manager. +* BFD_RELOC_FRV_GOTOFFHI: howto manager. +* BFD_RELOC_FRV_GOTOFFLO: howto manager. +* BFD_RELOC_FRV_GPREL12: howto manager. +* BFD_RELOC_FRV_GPREL32: howto manager. +* BFD_RELOC_FRV_GPRELHI: howto manager. +* BFD_RELOC_FRV_GPRELLO: howto manager. +* BFD_RELOC_FRV_GPRELU12: howto manager. +* BFD_RELOC_FRV_HI16: howto manager. +* BFD_RELOC_FRV_LABEL16: howto manager. +* BFD_RELOC_FRV_LABEL24: howto manager. +* BFD_RELOC_FRV_LO16: howto manager. +* BFD_RELOC_GPREL16: howto manager. +* BFD_RELOC_GPREL32: howto manager. +* BFD_RELOC_H8_DIR16A8: howto manager. +* BFD_RELOC_H8_DIR16R8: howto manager. +* BFD_RELOC_H8_DIR24A8: howto manager. +* BFD_RELOC_H8_DIR24R8: howto manager. +* BFD_RELOC_H8_DIR32A16: howto manager. +* BFD_RELOC_HI16: howto manager. +* BFD_RELOC_HI16_BASEREL: howto manager. +* BFD_RELOC_HI16_GOTOFF: howto manager. +* BFD_RELOC_HI16_PLTOFF: howto manager. +* BFD_RELOC_HI16_S: howto manager. +* BFD_RELOC_HI16_S_BASEREL: howto manager. +* BFD_RELOC_HI16_S_GOTOFF: howto manager. +* BFD_RELOC_HI16_S_PLTOFF: howto manager. +* BFD_RELOC_HI22: howto manager. +* BFD_RELOC_I370_D12: howto manager. +* BFD_RELOC_I960_CALLJ: howto manager. +* BFD_RELOC_IA64_COPY: howto manager. +* BFD_RELOC_IA64_DIR32LSB: howto manager. +* BFD_RELOC_IA64_DIR32MSB: howto manager. +* BFD_RELOC_IA64_DIR64LSB: howto manager. +* BFD_RELOC_IA64_DIR64MSB: howto manager. +* BFD_RELOC_IA64_DTPMOD64LSB: howto manager. +* BFD_RELOC_IA64_DTPMOD64MSB: howto manager. +* BFD_RELOC_IA64_DTPREL14: howto manager. +* BFD_RELOC_IA64_DTPREL22: howto manager. +* BFD_RELOC_IA64_DTPREL32LSB: howto manager. +* BFD_RELOC_IA64_DTPREL32MSB: howto manager. +* BFD_RELOC_IA64_DTPREL64I: howto manager. +* BFD_RELOC_IA64_DTPREL64LSB: howto manager. +* BFD_RELOC_IA64_DTPREL64MSB: howto manager. +* BFD_RELOC_IA64_FPTR32LSB: howto manager. +* BFD_RELOC_IA64_FPTR32MSB: howto manager. +* BFD_RELOC_IA64_FPTR64I: howto manager. +* BFD_RELOC_IA64_FPTR64LSB: howto manager. +* BFD_RELOC_IA64_FPTR64MSB: howto manager. +* BFD_RELOC_IA64_GPREL22: howto manager. +* BFD_RELOC_IA64_GPREL32LSB: howto manager. +* BFD_RELOC_IA64_GPREL32MSB: howto manager. +* BFD_RELOC_IA64_GPREL64I: howto manager. +* BFD_RELOC_IA64_GPREL64LSB: howto manager. +* BFD_RELOC_IA64_GPREL64MSB: howto manager. +* BFD_RELOC_IA64_IMM14: howto manager. +* BFD_RELOC_IA64_IMM22: howto manager. +* BFD_RELOC_IA64_IMM64: howto manager. +* BFD_RELOC_IA64_IPLTLSB: howto manager. +* BFD_RELOC_IA64_IPLTMSB: howto manager. +* BFD_RELOC_IA64_LDXMOV: howto manager. +* BFD_RELOC_IA64_LTOFF22: howto manager. +* BFD_RELOC_IA64_LTOFF22X: howto manager. +* BFD_RELOC_IA64_LTOFF64I: howto manager. +* BFD_RELOC_IA64_LTOFF_DTPMOD22: howto manager. +* BFD_RELOC_IA64_LTOFF_DTPREL22: howto manager. +* BFD_RELOC_IA64_LTOFF_FPTR22: howto manager. +* BFD_RELOC_IA64_LTOFF_FPTR32LSB: howto manager. +* BFD_RELOC_IA64_LTOFF_FPTR32MSB: howto manager. +* BFD_RELOC_IA64_LTOFF_FPTR64I: howto manager. +* BFD_RELOC_IA64_LTOFF_FPTR64LSB: howto manager. +* BFD_RELOC_IA64_LTOFF_FPTR64MSB: howto manager. +* BFD_RELOC_IA64_LTOFF_TPREL22: howto manager. +* BFD_RELOC_IA64_LTV32LSB: howto manager. +* BFD_RELOC_IA64_LTV32MSB: howto manager. +* BFD_RELOC_IA64_LTV64LSB: howto manager. +* BFD_RELOC_IA64_LTV64MSB: howto manager. +* BFD_RELOC_IA64_PCREL21B: howto manager. +* BFD_RELOC_IA64_PCREL21BI: howto manager. +* BFD_RELOC_IA64_PCREL21F: howto manager. +* BFD_RELOC_IA64_PCREL21M: howto manager. +* BFD_RELOC_IA64_PCREL22: howto manager. +* BFD_RELOC_IA64_PCREL32LSB: howto manager. +* BFD_RELOC_IA64_PCREL32MSB: howto manager. +* BFD_RELOC_IA64_PCREL60B: howto manager. +* BFD_RELOC_IA64_PCREL64I: howto manager. +* BFD_RELOC_IA64_PCREL64LSB: howto manager. +* BFD_RELOC_IA64_PCREL64MSB: howto manager. +* BFD_RELOC_IA64_PLTOFF22: howto manager. +* BFD_RELOC_IA64_PLTOFF64I: howto manager. +* BFD_RELOC_IA64_PLTOFF64LSB: howto manager. +* BFD_RELOC_IA64_PLTOFF64MSB: howto manager. +* BFD_RELOC_IA64_REL32LSB: howto manager. +* BFD_RELOC_IA64_REL32MSB: howto manager. +* BFD_RELOC_IA64_REL64LSB: howto manager. +* BFD_RELOC_IA64_REL64MSB: howto manager. +* BFD_RELOC_IA64_SECREL32LSB: howto manager. +* BFD_RELOC_IA64_SECREL32MSB: howto manager. +* BFD_RELOC_IA64_SECREL64LSB: howto manager. +* BFD_RELOC_IA64_SECREL64MSB: howto manager. +* BFD_RELOC_IA64_SEGREL32LSB: howto manager. +* BFD_RELOC_IA64_SEGREL32MSB: howto manager. +* BFD_RELOC_IA64_SEGREL64LSB: howto manager. +* BFD_RELOC_IA64_SEGREL64MSB: howto manager. +* BFD_RELOC_IA64_TPREL14: howto manager. +* BFD_RELOC_IA64_TPREL22: howto manager. +* BFD_RELOC_IA64_TPREL64I: howto manager. +* BFD_RELOC_IA64_TPREL64LSB: howto manager. +* BFD_RELOC_IA64_TPREL64MSB: howto manager. +* BFD_RELOC_IP2K_ADDR16CJP: howto manager. +* BFD_RELOC_IP2K_BANK: howto manager. +* BFD_RELOC_IP2K_EX8DATA: howto manager. +* BFD_RELOC_IP2K_FR9: howto manager. +* BFD_RELOC_IP2K_FR_OFFSET: howto manager. +* BFD_RELOC_IP2K_HI8DATA: howto manager. +* BFD_RELOC_IP2K_HI8INSN: howto manager. +* BFD_RELOC_IP2K_LO8DATA: howto manager. +* BFD_RELOC_IP2K_LO8INSN: howto manager. +* BFD_RELOC_IP2K_PAGE3: howto manager. +* BFD_RELOC_IP2K_PC_SKIP: howto manager. +* BFD_RELOC_IP2K_TEXT: howto manager. +* BFD_RELOC_IQ2000_OFFSET_16: howto manager. +* BFD_RELOC_IQ2000_OFFSET_21: howto manager. +* BFD_RELOC_IQ2000_UHI16: howto manager. +* BFD_RELOC_LO10: howto manager. +* BFD_RELOC_LO16: howto manager. +* BFD_RELOC_LO16_BASEREL: howto manager. +* BFD_RELOC_LO16_GOTOFF: howto manager. +* BFD_RELOC_LO16_PLTOFF: howto manager. +* BFD_RELOC_M32R_10_PCREL: howto manager. +* BFD_RELOC_M32R_18_PCREL: howto manager. +* BFD_RELOC_M32R_24: howto manager. +* BFD_RELOC_M32R_26_PCREL: howto manager. +* BFD_RELOC_M32R_26_PLTREL: howto manager. +* BFD_RELOC_M32R_COPY: howto manager. +* BFD_RELOC_M32R_GLOB_DAT: howto manager. +* BFD_RELOC_M32R_GOT16_HI_SLO: howto manager. +* BFD_RELOC_M32R_GOT16_HI_ULO: howto manager. +* BFD_RELOC_M32R_GOT16_LO: howto manager. +* BFD_RELOC_M32R_GOT24: howto manager. +* BFD_RELOC_M32R_GOTOFF: howto manager. +* BFD_RELOC_M32R_GOTPC24: howto manager. +* BFD_RELOC_M32R_GOTPC_HI_SLO: howto manager. +* BFD_RELOC_M32R_GOTPC_HI_ULO: howto manager. +* BFD_RELOC_M32R_GOTPC_LO: howto manager. +* BFD_RELOC_M32R_HI16_SLO: howto manager. +* BFD_RELOC_M32R_HI16_ULO: howto manager. +* BFD_RELOC_M32R_JMP_SLOT: howto manager. +* BFD_RELOC_M32R_LO16: howto manager. +* BFD_RELOC_M32R_RELATIVE: howto manager. +* BFD_RELOC_M32R_SDA16: howto manager. +* BFD_RELOC_M68HC11_24: howto manager. +* BFD_RELOC_M68HC11_3B: howto manager. +* BFD_RELOC_M68HC11_HI8: howto manager. +* BFD_RELOC_M68HC11_LO16: howto manager. +* BFD_RELOC_M68HC11_LO8: howto manager. +* BFD_RELOC_M68HC11_PAGE: howto manager. +* BFD_RELOC_M68HC11_RL_GROUP: howto manager. +* BFD_RELOC_M68HC11_RL_JUMP: howto manager. +* BFD_RELOC_M68HC12_5B: howto manager. +* BFD_RELOC_MCORE_PCREL_32: howto manager. +* BFD_RELOC_MCORE_PCREL_IMM11BY2: howto manager. +* BFD_RELOC_MCORE_PCREL_IMM4BY2: howto manager. +* BFD_RELOC_MCORE_PCREL_IMM8BY4: howto manager. +* BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2: howto manager. +* BFD_RELOC_MCORE_RVA: howto manager. +* BFD_RELOC_MIPS16_GPREL: howto manager. +* BFD_RELOC_MIPS16_JMP: howto manager. +* BFD_RELOC_MIPS_CALL16: howto manager. +* BFD_RELOC_MIPS_CALL_HI16: howto manager. +* BFD_RELOC_MIPS_CALL_LO16: howto manager. +* BFD_RELOC_MIPS_DELETE: howto manager. +* BFD_RELOC_MIPS_GOT16: howto manager. +* BFD_RELOC_MIPS_GOT_DISP: howto manager. +* BFD_RELOC_MIPS_GOT_HI16: howto manager. +* BFD_RELOC_MIPS_GOT_LO16: howto manager. +* BFD_RELOC_MIPS_GOT_OFST: howto manager. +* BFD_RELOC_MIPS_GOT_PAGE: howto manager. +* BFD_RELOC_MIPS_HIGHER: howto manager. +* BFD_RELOC_MIPS_HIGHEST: howto manager. +* BFD_RELOC_MIPS_INSERT_A: howto manager. +* BFD_RELOC_MIPS_INSERT_B: howto manager. +* BFD_RELOC_MIPS_JALR: howto manager. +* BFD_RELOC_MIPS_JMP: howto manager. +* BFD_RELOC_MIPS_LITERAL: howto manager. +* BFD_RELOC_MIPS_REL16: howto manager. +* BFD_RELOC_MIPS_RELGOT: howto manager. +* BFD_RELOC_MIPS_SCN_DISP: howto manager. +* BFD_RELOC_MIPS_SHIFT5: howto manager. +* BFD_RELOC_MIPS_SHIFT6: howto manager. +* BFD_RELOC_MIPS_SUB: howto manager. +* BFD_RELOC_MMIX_ADDR19: howto manager. +* BFD_RELOC_MMIX_ADDR27: howto manager. +* BFD_RELOC_MMIX_BASE_PLUS_OFFSET: howto manager. +* BFD_RELOC_MMIX_CBRANCH: howto manager. +* BFD_RELOC_MMIX_CBRANCH_1: howto manager. +* BFD_RELOC_MMIX_CBRANCH_2: howto manager. +* BFD_RELOC_MMIX_CBRANCH_3: howto manager. +* BFD_RELOC_MMIX_CBRANCH_J: howto manager. +* BFD_RELOC_MMIX_GETA: howto manager. +* BFD_RELOC_MMIX_GETA_1: howto manager. +* BFD_RELOC_MMIX_GETA_2: howto manager. +* BFD_RELOC_MMIX_GETA_3: howto manager. +* BFD_RELOC_MMIX_JMP: howto manager. +* BFD_RELOC_MMIX_JMP_1: howto manager. +* BFD_RELOC_MMIX_JMP_2: howto manager. +* BFD_RELOC_MMIX_JMP_3: howto manager. +* BFD_RELOC_MMIX_LOCAL: howto manager. +* BFD_RELOC_MMIX_PUSHJ: howto manager. +* BFD_RELOC_MMIX_PUSHJ_1: howto manager. +* BFD_RELOC_MMIX_PUSHJ_2: howto manager. +* BFD_RELOC_MMIX_PUSHJ_3: howto manager. +* BFD_RELOC_MMIX_PUSHJ_STUBBABLE: howto manager. +* BFD_RELOC_MMIX_REG: howto manager. +* BFD_RELOC_MMIX_REG_OR_BYTE: howto manager. +* BFD_RELOC_MN10300_16_PCREL: howto manager. +* BFD_RELOC_MN10300_32_PCREL: howto manager. +* BFD_RELOC_MN10300_COPY: howto manager. +* BFD_RELOC_MN10300_GLOB_DAT: howto manager. +* BFD_RELOC_MN10300_GOT16: howto manager. +* BFD_RELOC_MN10300_GOT24: howto manager. +* BFD_RELOC_MN10300_GOT32: howto manager. +* BFD_RELOC_MN10300_GOTOFF24: howto manager. +* BFD_RELOC_MN10300_JMP_SLOT: howto manager. +* BFD_RELOC_MN10300_RELATIVE: howto manager. +* BFD_RELOC_MSP430_10_PCREL: howto manager. +* BFD_RELOC_MSP430_16: howto manager. +* BFD_RELOC_MSP430_16_BYTE: howto manager. +* BFD_RELOC_MSP430_16_PCREL: howto manager. +* BFD_RELOC_MSP430_16_PCREL_BYTE: howto manager. +* BFD_RELOC_NONE: howto manager. +* BFD_RELOC_NS32K_DISP_16: howto manager. +* BFD_RELOC_NS32K_DISP_16_PCREL: howto manager. +* BFD_RELOC_NS32K_DISP_32: howto manager. +* BFD_RELOC_NS32K_DISP_32_PCREL: howto manager. +* BFD_RELOC_NS32K_DISP_8: howto manager. +* BFD_RELOC_NS32K_DISP_8_PCREL: howto manager. +* BFD_RELOC_NS32K_IMM_16: howto manager. +* BFD_RELOC_NS32K_IMM_16_PCREL: howto manager. +* BFD_RELOC_NS32K_IMM_32: howto manager. +* BFD_RELOC_NS32K_IMM_32_PCREL: howto manager. +* BFD_RELOC_NS32K_IMM_8: howto manager. +* BFD_RELOC_NS32K_IMM_8_PCREL: howto manager. +* BFD_RELOC_OPENRISC_ABS_26: howto manager. +* BFD_RELOC_OPENRISC_REL_26: howto manager. +* BFD_RELOC_PCREL_HI16_S: howto manager. +* BFD_RELOC_PCREL_LO16: howto manager. +* BFD_RELOC_PDP11_DISP_6_PCREL: howto manager. +* BFD_RELOC_PDP11_DISP_8_PCREL: howto manager. +* BFD_RELOC_PJ_CODE_DIR16: howto manager. +* BFD_RELOC_PJ_CODE_DIR32: howto manager. +* BFD_RELOC_PJ_CODE_HI16: howto manager. +* BFD_RELOC_PJ_CODE_LO16: howto manager. +* BFD_RELOC_PJ_CODE_REL16: howto manager. +* BFD_RELOC_PJ_CODE_REL32: howto manager. +* BFD_RELOC_PPC64_ADDR16_DS: howto manager. +* BFD_RELOC_PPC64_ADDR16_LO_DS: howto manager. +* BFD_RELOC_PPC64_DTPREL16_DS: howto manager. +* BFD_RELOC_PPC64_DTPREL16_HIGHER: howto manager. +* BFD_RELOC_PPC64_DTPREL16_HIGHERA: howto manager. +* BFD_RELOC_PPC64_DTPREL16_HIGHEST: howto manager. +* BFD_RELOC_PPC64_DTPREL16_HIGHESTA: howto manager. +* BFD_RELOC_PPC64_DTPREL16_LO_DS: howto manager. +* BFD_RELOC_PPC64_GOT16_DS: howto manager. +* BFD_RELOC_PPC64_GOT16_LO_DS: howto manager. +* BFD_RELOC_PPC64_HIGHER: howto manager. +* BFD_RELOC_PPC64_HIGHER_S: howto manager. +* BFD_RELOC_PPC64_HIGHEST: howto manager. +* BFD_RELOC_PPC64_HIGHEST_S: howto manager. +* BFD_RELOC_PPC64_PLT16_LO_DS: howto manager. +* BFD_RELOC_PPC64_PLTGOT16: howto manager. +* BFD_RELOC_PPC64_PLTGOT16_DS: howto manager. +* BFD_RELOC_PPC64_PLTGOT16_HA: howto manager. +* BFD_RELOC_PPC64_PLTGOT16_HI: howto manager. +* BFD_RELOC_PPC64_PLTGOT16_LO: howto manager. +* BFD_RELOC_PPC64_PLTGOT16_LO_DS: howto manager. +* BFD_RELOC_PPC64_SECTOFF_DS: howto manager. +* BFD_RELOC_PPC64_SECTOFF_LO_DS: howto manager. +* BFD_RELOC_PPC64_TOC: howto manager. +* BFD_RELOC_PPC64_TOC16_DS: howto manager. +* BFD_RELOC_PPC64_TOC16_HA: howto manager. +* BFD_RELOC_PPC64_TOC16_HI: howto manager. +* BFD_RELOC_PPC64_TOC16_LO: howto manager. +* BFD_RELOC_PPC64_TOC16_LO_DS: howto manager. +* BFD_RELOC_PPC64_TPREL16_DS: howto manager. +* BFD_RELOC_PPC64_TPREL16_HIGHER: howto manager. +* BFD_RELOC_PPC64_TPREL16_HIGHERA: howto manager. +* BFD_RELOC_PPC64_TPREL16_HIGHEST: howto manager. +* BFD_RELOC_PPC64_TPREL16_HIGHESTA: howto manager. +* BFD_RELOC_PPC64_TPREL16_LO_DS: howto manager. +* BFD_RELOC_PPC_B16: howto manager. +* BFD_RELOC_PPC_B16_BRNTAKEN: howto manager. +* BFD_RELOC_PPC_B16_BRTAKEN: howto manager. +* BFD_RELOC_PPC_B26: howto manager. +* BFD_RELOC_PPC_BA16: howto manager. +* BFD_RELOC_PPC_BA16_BRNTAKEN: howto manager. +* BFD_RELOC_PPC_BA16_BRTAKEN: howto manager. +* BFD_RELOC_PPC_BA26: howto manager. +* BFD_RELOC_PPC_COPY: howto manager. +* BFD_RELOC_PPC_DTPMOD: howto manager. +* BFD_RELOC_PPC_DTPREL: howto manager. +* BFD_RELOC_PPC_DTPREL16: howto manager. +* BFD_RELOC_PPC_DTPREL16_HA: howto manager. +* BFD_RELOC_PPC_DTPREL16_HI: howto manager. +* BFD_RELOC_PPC_DTPREL16_LO: howto manager. +* BFD_RELOC_PPC_EMB_BIT_FLD: howto manager. +* BFD_RELOC_PPC_EMB_MRKREF: howto manager. +* BFD_RELOC_PPC_EMB_NADDR16: howto manager. +* BFD_RELOC_PPC_EMB_NADDR16_HA: howto manager. +* BFD_RELOC_PPC_EMB_NADDR16_HI: howto manager. +* BFD_RELOC_PPC_EMB_NADDR16_LO: howto manager. +* BFD_RELOC_PPC_EMB_NADDR32: howto manager. +* BFD_RELOC_PPC_EMB_RELSDA: howto manager. +* BFD_RELOC_PPC_EMB_RELSEC16: howto manager. +* BFD_RELOC_PPC_EMB_RELST_HA: howto manager. +* BFD_RELOC_PPC_EMB_RELST_HI: howto manager. +* BFD_RELOC_PPC_EMB_RELST_LO: howto manager. +* BFD_RELOC_PPC_EMB_SDA21: howto manager. +* BFD_RELOC_PPC_EMB_SDA2I16: howto manager. +* BFD_RELOC_PPC_EMB_SDA2REL: howto manager. +* BFD_RELOC_PPC_EMB_SDAI16: howto manager. +* BFD_RELOC_PPC_GLOB_DAT: howto manager. +* BFD_RELOC_PPC_GOT_DTPREL16: howto manager. +* BFD_RELOC_PPC_GOT_DTPREL16_HA: howto manager. +* BFD_RELOC_PPC_GOT_DTPREL16_HI: howto manager. +* BFD_RELOC_PPC_GOT_DTPREL16_LO: howto manager. +* BFD_RELOC_PPC_GOT_TLSGD16: howto manager. +* BFD_RELOC_PPC_GOT_TLSGD16_HA: howto manager. +* BFD_RELOC_PPC_GOT_TLSGD16_HI: howto manager. +* BFD_RELOC_PPC_GOT_TLSGD16_LO: howto manager. +* BFD_RELOC_PPC_GOT_TLSLD16: howto manager. +* BFD_RELOC_PPC_GOT_TLSLD16_HA: howto manager. +* BFD_RELOC_PPC_GOT_TLSLD16_HI: howto manager. +* BFD_RELOC_PPC_GOT_TLSLD16_LO: howto manager. +* BFD_RELOC_PPC_GOT_TPREL16: howto manager. +* BFD_RELOC_PPC_GOT_TPREL16_HA: howto manager. +* BFD_RELOC_PPC_GOT_TPREL16_HI: howto manager. +* BFD_RELOC_PPC_GOT_TPREL16_LO: howto manager. +* BFD_RELOC_PPC_JMP_SLOT: howto manager. +* BFD_RELOC_PPC_LOCAL24PC: howto manager. +* BFD_RELOC_PPC_RELATIVE: howto manager. +* BFD_RELOC_PPC_TLS: howto manager. +* BFD_RELOC_PPC_TOC16: howto manager. +* BFD_RELOC_PPC_TPREL: howto manager. +* BFD_RELOC_PPC_TPREL16: howto manager. +* BFD_RELOC_PPC_TPREL16_HA: howto manager. +* BFD_RELOC_PPC_TPREL16_HI: howto manager. +* BFD_RELOC_PPC_TPREL16_LO: howto manager. +* BFD_RELOC_RVA: howto manager. +* BFD_RELOC_SH_ALIGN: howto manager. +* BFD_RELOC_SH_CODE: howto manager. +* BFD_RELOC_SH_COPY: howto manager. +* BFD_RELOC_SH_COPY64: howto manager. +* BFD_RELOC_SH_COUNT: howto manager. +* BFD_RELOC_SH_DATA: howto manager. +* BFD_RELOC_SH_GLOB_DAT: howto manager. +* BFD_RELOC_SH_GLOB_DAT64: howto manager. +* BFD_RELOC_SH_GOT10BY4: howto manager. +* BFD_RELOC_SH_GOT10BY8: howto manager. +* BFD_RELOC_SH_GOT_HI16: howto manager. +* BFD_RELOC_SH_GOT_LOW16: howto manager. +* BFD_RELOC_SH_GOT_MEDHI16: howto manager. +* BFD_RELOC_SH_GOT_MEDLOW16: howto manager. +* BFD_RELOC_SH_GOTOFF_HI16: howto manager. +* BFD_RELOC_SH_GOTOFF_LOW16: howto manager. +* BFD_RELOC_SH_GOTOFF_MEDHI16: howto manager. +* BFD_RELOC_SH_GOTOFF_MEDLOW16: howto manager. +* BFD_RELOC_SH_GOTPC: howto manager. +* BFD_RELOC_SH_GOTPC_HI16: howto manager. +* BFD_RELOC_SH_GOTPC_LOW16: howto manager. +* BFD_RELOC_SH_GOTPC_MEDHI16: howto manager. +* BFD_RELOC_SH_GOTPC_MEDLOW16: howto manager. +* BFD_RELOC_SH_GOTPLT10BY4: howto manager. +* BFD_RELOC_SH_GOTPLT10BY8: howto manager. +* BFD_RELOC_SH_GOTPLT32: howto manager. +* BFD_RELOC_SH_GOTPLT_HI16: howto manager. +* BFD_RELOC_SH_GOTPLT_LOW16: howto manager. +* BFD_RELOC_SH_GOTPLT_MEDHI16: howto manager. +* BFD_RELOC_SH_GOTPLT_MEDLOW16: howto manager. +* BFD_RELOC_SH_IMM4: howto manager. +* BFD_RELOC_SH_IMM4BY2: howto manager. +* BFD_RELOC_SH_IMM4BY4: howto manager. +* BFD_RELOC_SH_IMM8: howto manager. +* BFD_RELOC_SH_IMM8BY2: howto manager. +* BFD_RELOC_SH_IMM8BY4: howto manager. +* BFD_RELOC_SH_IMM_HI16: howto manager. +* BFD_RELOC_SH_IMM_HI16_PCREL: howto manager. +* BFD_RELOC_SH_IMM_LOW16: howto manager. +* BFD_RELOC_SH_IMM_LOW16_PCREL: howto manager. +* BFD_RELOC_SH_IMM_MEDHI16: howto manager. +* BFD_RELOC_SH_IMM_MEDHI16_PCREL: howto manager. +* BFD_RELOC_SH_IMM_MEDLOW16: howto manager. +* BFD_RELOC_SH_IMM_MEDLOW16_PCREL: howto manager. +* BFD_RELOC_SH_IMMS10: howto manager. +* BFD_RELOC_SH_IMMS10BY2: howto manager. +* BFD_RELOC_SH_IMMS10BY4: howto manager. +* BFD_RELOC_SH_IMMS10BY8: howto manager. +* BFD_RELOC_SH_IMMS16: howto manager. +* BFD_RELOC_SH_IMMS6: howto manager. +* BFD_RELOC_SH_IMMS6BY32: howto manager. +* BFD_RELOC_SH_IMMU16: howto manager. +* BFD_RELOC_SH_IMMU5: howto manager. +* BFD_RELOC_SH_IMMU6: howto manager. +* BFD_RELOC_SH_JMP_SLOT: howto manager. +* BFD_RELOC_SH_JMP_SLOT64: howto manager. +* BFD_RELOC_SH_LABEL: howto manager. +* BFD_RELOC_SH_LOOP_END: howto manager. +* BFD_RELOC_SH_LOOP_START: howto manager. +* BFD_RELOC_SH_PCDISP12BY2: howto manager. +* BFD_RELOC_SH_PCDISP8BY2: howto manager. +* BFD_RELOC_SH_PCRELIMM8BY2: howto manager. +* BFD_RELOC_SH_PCRELIMM8BY4: howto manager. +* BFD_RELOC_SH_PLT_HI16: howto manager. +* BFD_RELOC_SH_PLT_LOW16: howto manager. +* BFD_RELOC_SH_PLT_MEDHI16: howto manager. +* BFD_RELOC_SH_PLT_MEDLOW16: howto manager. +* BFD_RELOC_SH_PT_16: howto manager. +* BFD_RELOC_SH_RELATIVE: howto manager. +* BFD_RELOC_SH_RELATIVE64: howto manager. +* BFD_RELOC_SH_SHMEDIA_CODE: howto manager. +* BFD_RELOC_SH_SWITCH16: howto manager. +* BFD_RELOC_SH_SWITCH32: howto manager. +* BFD_RELOC_SH_TLS_DTPMOD32: howto manager. +* BFD_RELOC_SH_TLS_DTPOFF32: howto manager. +* BFD_RELOC_SH_TLS_GD_32: howto manager. +* BFD_RELOC_SH_TLS_IE_32: howto manager. +* BFD_RELOC_SH_TLS_LD_32: howto manager. +* BFD_RELOC_SH_TLS_LDO_32: howto manager. +* BFD_RELOC_SH_TLS_LE_32: howto manager. +* BFD_RELOC_SH_TLS_TPOFF32: howto manager. +* BFD_RELOC_SH_USES: howto manager. +* BFD_RELOC_SPARC13: howto manager. +* BFD_RELOC_SPARC22: howto manager. +* BFD_RELOC_SPARC_10: howto manager. +* BFD_RELOC_SPARC_11: howto manager. +* BFD_RELOC_SPARC_5: howto manager. +* BFD_RELOC_SPARC_6: howto manager. +* BFD_RELOC_SPARC_64: howto manager. +* BFD_RELOC_SPARC_7: howto manager. +* BFD_RELOC_SPARC_BASE13: howto manager. +* BFD_RELOC_SPARC_BASE22: howto manager. +* BFD_RELOC_SPARC_COPY: howto manager. +* BFD_RELOC_SPARC_DISP64: howto manager. +* BFD_RELOC_SPARC_GLOB_DAT: howto manager. +* BFD_RELOC_SPARC_GOT10: howto manager. +* BFD_RELOC_SPARC_GOT13: howto manager. +* BFD_RELOC_SPARC_GOT22: howto manager. +* BFD_RELOC_SPARC_H44: howto manager. +* BFD_RELOC_SPARC_HH22: howto manager. +* BFD_RELOC_SPARC_HIX22: howto manager. +* BFD_RELOC_SPARC_HM10: howto manager. +* BFD_RELOC_SPARC_JMP_SLOT: howto manager. +* BFD_RELOC_SPARC_L44: howto manager. +* BFD_RELOC_SPARC_LM22: howto manager. +* BFD_RELOC_SPARC_LOX10: howto manager. +* BFD_RELOC_SPARC_M44: howto manager. +* BFD_RELOC_SPARC_OLO10: howto manager. +* BFD_RELOC_SPARC_PC10: howto manager. +* BFD_RELOC_SPARC_PC22: howto manager. +* BFD_RELOC_SPARC_PC_HH22: howto manager. +* BFD_RELOC_SPARC_PC_HM10: howto manager. +* BFD_RELOC_SPARC_PC_LM22: howto manager. +* BFD_RELOC_SPARC_PLT32: howto manager. +* BFD_RELOC_SPARC_PLT64: howto manager. +* BFD_RELOC_SPARC_REGISTER: howto manager. +* BFD_RELOC_SPARC_RELATIVE: howto manager. +* BFD_RELOC_SPARC_REV32: howto manager. +* BFD_RELOC_SPARC_TLS_DTPMOD32: howto manager. +* BFD_RELOC_SPARC_TLS_DTPMOD64: howto manager. +* BFD_RELOC_SPARC_TLS_DTPOFF32: howto manager. +* BFD_RELOC_SPARC_TLS_DTPOFF64: howto manager. +* BFD_RELOC_SPARC_TLS_GD_ADD: howto manager. +* BFD_RELOC_SPARC_TLS_GD_CALL: howto manager. +* BFD_RELOC_SPARC_TLS_GD_HI22: howto manager. +* BFD_RELOC_SPARC_TLS_GD_LO10: howto manager. +* BFD_RELOC_SPARC_TLS_IE_ADD: howto manager. +* BFD_RELOC_SPARC_TLS_IE_HI22: howto manager. +* BFD_RELOC_SPARC_TLS_IE_LD: howto manager. +* BFD_RELOC_SPARC_TLS_IE_LDX: howto manager. +* BFD_RELOC_SPARC_TLS_IE_LO10: howto manager. +* BFD_RELOC_SPARC_TLS_LDM_ADD: howto manager. +* BFD_RELOC_SPARC_TLS_LDM_CALL: howto manager. +* BFD_RELOC_SPARC_TLS_LDM_HI22: howto manager. +* BFD_RELOC_SPARC_TLS_LDM_LO10: howto manager. +* BFD_RELOC_SPARC_TLS_LDO_ADD: howto manager. +* BFD_RELOC_SPARC_TLS_LDO_HIX22: howto manager. +* BFD_RELOC_SPARC_TLS_LDO_LOX10: howto manager. +* BFD_RELOC_SPARC_TLS_LE_HIX22: howto manager. +* BFD_RELOC_SPARC_TLS_LE_LOX10: howto manager. +* BFD_RELOC_SPARC_TLS_TPOFF32: howto manager. +* BFD_RELOC_SPARC_TLS_TPOFF64: howto manager. +* BFD_RELOC_SPARC_UA16: howto manager. +* BFD_RELOC_SPARC_UA32: howto manager. +* BFD_RELOC_SPARC_UA64: howto manager. +* BFD_RELOC_SPARC_WDISP16: howto manager. +* BFD_RELOC_SPARC_WDISP19: howto manager. +* BFD_RELOC_SPARC_WDISP22: howto manager. +* BFD_RELOC_SPARC_WPLT30: howto manager. +* BFD_RELOC_THUMB_PCREL_BLX: howto manager. +* BFD_RELOC_THUMB_PCREL_BRANCH12: howto manager. +* BFD_RELOC_THUMB_PCREL_BRANCH23: howto manager. +* BFD_RELOC_THUMB_PCREL_BRANCH9: howto manager. +* BFD_RELOC_TIC30_LDP: howto manager. +* BFD_RELOC_TIC54X_16_OF_23: howto manager. +* BFD_RELOC_TIC54X_23: howto manager. +* BFD_RELOC_TIC54X_MS7_OF_23: howto manager. +* BFD_RELOC_TIC54X_PARTLS7: howto manager. +* BFD_RELOC_TIC54X_PARTMS9: howto manager. +* bfd_reloc_type_lookup: howto manager. +* BFD_RELOC_V850_22_PCREL: howto manager. +* BFD_RELOC_V850_9_PCREL: howto manager. +* BFD_RELOC_V850_ALIGN: howto manager. +* BFD_RELOC_V850_CALLT_16_16_OFFSET: howto manager. +* BFD_RELOC_V850_CALLT_6_7_OFFSET: howto manager. +* BFD_RELOC_V850_LONGCALL: howto manager. +* BFD_RELOC_V850_LONGJUMP: howto manager. +* BFD_RELOC_V850_SDA_15_16_OFFSET: howto manager. +* BFD_RELOC_V850_SDA_16_16_OFFSET: howto manager. +* BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET: howto manager. +* BFD_RELOC_V850_TDA_16_16_OFFSET: howto manager. +* BFD_RELOC_V850_TDA_4_4_OFFSET: howto manager. +* BFD_RELOC_V850_TDA_4_5_OFFSET: howto manager. +* BFD_RELOC_V850_TDA_6_8_OFFSET: howto manager. +* BFD_RELOC_V850_TDA_7_7_OFFSET: howto manager. +* BFD_RELOC_V850_TDA_7_8_OFFSET: howto manager. +* BFD_RELOC_V850_ZDA_15_16_OFFSET: howto manager. +* BFD_RELOC_V850_ZDA_16_16_OFFSET: howto manager. +* BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET: howto manager. +* BFD_RELOC_VAX_GLOB_DAT: howto manager. +* BFD_RELOC_VAX_JMP_SLOT: howto manager. +* BFD_RELOC_VAX_RELATIVE: howto manager. +* BFD_RELOC_VPE4KMATH_DATA: howto manager. +* BFD_RELOC_VPE4KMATH_INSN: howto manager. +* BFD_RELOC_VTABLE_ENTRY: howto manager. +* BFD_RELOC_VTABLE_INHERIT: howto manager. +* BFD_RELOC_X86_64_32S: howto manager. +* BFD_RELOC_X86_64_COPY: howto manager. +* BFD_RELOC_X86_64_DTPMOD64: howto manager. +* BFD_RELOC_X86_64_DTPOFF32: howto manager. +* BFD_RELOC_X86_64_DTPOFF64: howto manager. +* BFD_RELOC_X86_64_GLOB_DAT: howto manager. +* BFD_RELOC_X86_64_GOT32: howto manager. +* BFD_RELOC_X86_64_GOTPCREL: howto manager. +* BFD_RELOC_X86_64_GOTTPOFF: howto manager. +* BFD_RELOC_X86_64_JUMP_SLOT: howto manager. +* BFD_RELOC_X86_64_PLT32: howto manager. +* BFD_RELOC_X86_64_RELATIVE: howto manager. +* BFD_RELOC_X86_64_TLSGD: howto manager. +* BFD_RELOC_X86_64_TLSLD: howto manager. +* BFD_RELOC_X86_64_TPOFF32: howto manager. +* BFD_RELOC_X86_64_TPOFF64: howto manager. +* BFD_RELOC_XSTORMY16_12: howto manager. +* BFD_RELOC_XSTORMY16_24: howto manager. +* BFD_RELOC_XSTORMY16_FPTR16: howto manager. +* BFD_RELOC_XSTORMY16_REL_12: howto manager. +* BFD_RELOC_XTENSA_ASM_EXPAND: howto manager. +* BFD_RELOC_XTENSA_ASM_SIMPLIFY: howto manager. +* BFD_RELOC_XTENSA_GLOB_DAT: howto manager. +* BFD_RELOC_XTENSA_JMP_SLOT: howto manager. +* BFD_RELOC_XTENSA_OP0: howto manager. +* BFD_RELOC_XTENSA_OP1: howto manager. +* BFD_RELOC_XTENSA_OP2: howto manager. +* BFD_RELOC_XTENSA_PLT: howto manager. +* BFD_RELOC_XTENSA_RELATIVE: howto manager. +* BFD_RELOC_XTENSA_RTLD: howto manager. +* bfd_scan_arch: Architectures. +* bfd_scan_vma: BFD front end. +* bfd_seach_for_target: bfd_target. +* bfd_section_list_clear: section prototypes. +* bfd_set_arch_info: Architectures. +* bfd_set_archive_head: Archives. +* bfd_set_default_target: bfd_target. +* bfd_set_error: BFD front end. +* bfd_set_error_handler: BFD front end. +* bfd_set_error_program_name: BFD front end. +* bfd_set_file_flags: BFD front end. +* bfd_set_format: Formats. +* bfd_set_gp_size: BFD front end. +* bfd_set_private_flags: BFD front end. +* bfd_set_reloc: BFD front end. +* bfd_set_section_contents: section prototypes. +* bfd_set_section_flags: section prototypes. +* bfd_set_section_size: section prototypes. +* bfd_set_start_address: BFD front end. +* bfd_set_symtab: symbol handling functions. +* bfd_symbol_info: symbol handling functions. +* bfd_target_list: bfd_target. +* bfd_write_bigendian_4byte_int: Internal. +* coff_symbol_type: coff. +* core_file_matches_executable_p: Core Files. +* find_separate_debug_file: Opening and Closing. +* get_debug_link_info: Opening and Closing. +* Hash tables: Hash Tables. +* internal object-file format: Canonical format. +* Linker: Linker Functions. +* Other functions: BFD front end. +* separate_debug_file_exists: Opening and Closing. +* target vector (_bfd_final_link): Performing the Final Link. +* target vector (_bfd_link_add_symbols): Adding Symbols to the Hash Table. +* target vector (_bfd_link_hash_table_create): Creating a Linker Hash Table. +* The HOWTO Macro: typedef arelent. +* what is it?: Overview. + + diff --git a/bfd/doc/bfd.texi b/bfd/doc/bfd.texi deleted file mode 100644 index ea0ca9e56dc96..0000000000000 --- a/bfd/doc/bfd.texi +++ /dev/null @@ -1,585 +0,0 @@ -@section @code{typedef bfd} -A BFD has type @code{bfd}; objects of this type are the -cornerstone of any application using BFD. Using BFD -consists of making references though the BFD and to data in the BFD. - -Here is the structure that defines the type @code{bfd}. It -contains the major data about the file and pointers -to the rest of the data. -@* -. -@example -struct _bfd -@{ - /* The filename the application opened the BFD with. */ - CONST char *filename; - - /* A pointer to the target jump table. */ - const struct bfd_target *xvec; - - /* To avoid dragging too many header files into every file that - includes `@code{bfd.h}', IOSTREAM has been declared as a "char - *", and MTIME as a "long". Their correct types, to which they - are cast when used, are "FILE *" and "time_t". The iostream - is the result of an fopen on the filename. However, if the - BFD_IN_MEMORY flag is set, then iostream is actually a pointer - to a bfd_in_memory struct. */ - PTR iostream; - - /* Is the file descriptor being cached? That is, can it be closed as - needed, and re-opened when accessed later? */ - - boolean cacheable; - - /* Marks whether there was a default target specified when the - BFD was opened. This is used to select which matching algorithm - to use to choose the back end. */ - - boolean target_defaulted; - - /* The caching routines use these to maintain a - least-recently-used list of BFDs */ - - struct _bfd *lru_prev, *lru_next; - - /* When a file is closed by the caching routines, BFD retains - state information on the file here: */ - - file_ptr where; - - /* and here: (``once'' means at least once) */ - - boolean opened_once; - - /* Set if we have a locally maintained mtime value, rather than - getting it from the file each time: */ - - boolean mtime_set; - - /* File modified time, if mtime_set is true: */ - - long mtime; - - /* Reserved for an unimplemented file locking extension.*/ - - int ifd; - - /* The format which belongs to the BFD. (object, core, etc.) */ - - bfd_format format; - - /* The direction the BFD was opened with*/ - - enum bfd_direction @{no_direction = 0, - read_direction = 1, - write_direction = 2, - both_direction = 3@} direction; - - /* Format_specific flags*/ - - flagword flags; - - /* Currently my_archive is tested before adding origin to - anything. I believe that this can become always an add of - origin, with origin set to 0 for non archive files. */ - - file_ptr origin; - - /* Remember when output has begun, to stop strange things - from happening. */ - boolean output_has_begun; - - /* Pointer to linked list of sections*/ - struct sec *sections; - - /* The number of sections */ - unsigned int section_count; - - /* Stuff only useful for object files: - The start address. */ - bfd_vma start_address; - - /* Used for input and output*/ - unsigned int symcount; - - /* Symbol table for output BFD (with symcount entries) */ - struct symbol_cache_entry **outsymbols; - - /* Pointer to structure which contains architecture information*/ - const struct bfd_arch_info *arch_info; - - /* Stuff only useful for archives:*/ - PTR arelt_data; - struct _bfd *my_archive; /* The containing archive BFD. */ - struct _bfd *next; /* The next BFD in the archive. */ - struct _bfd *archive_head; /* The first BFD in the archive. */ - boolean has_armap; - - /* A chain of BFD structures involved in a link. */ - struct _bfd *link_next; - - /* A field used by _bfd_generic_link_add_archive_symbols. This will - be used only for archive elements. */ - int archive_pass; - - /* Used by the back end to hold private data. */ - - union - @{ - struct aout_data_struct *aout_data; - struct artdata *aout_ar_data; - struct _oasys_data *oasys_obj_data; - struct _oasys_ar_data *oasys_ar_data; - struct coff_tdata *coff_obj_data; - struct pe_tdata *pe_obj_data; - struct xcoff_tdata *xcoff_obj_data; - struct ecoff_tdata *ecoff_obj_data; - struct ieee_data_struct *ieee_data; - struct ieee_ar_data_struct *ieee_ar_data; - struct srec_data_struct *srec_data; - struct ihex_data_struct *ihex_data; - struct tekhex_data_struct *tekhex_data; - struct elf_obj_tdata *elf_obj_data; - struct nlm_obj_tdata *nlm_obj_data; - struct bout_data_struct *bout_data; - struct sun_core_struct *sun_core_data; - struct trad_core_struct *trad_core_data; - struct som_data_struct *som_data; - struct hpux_core_struct *hpux_core_data; - struct hppabsd_core_struct *hppabsd_core_data; - struct sgi_core_struct *sgi_core_data; - struct lynx_core_struct *lynx_core_data; - struct osf_core_struct *osf_core_data; - struct cisco_core_struct *cisco_core_data; - struct versados_data_struct *versados_data; - struct netbsd_core_struct *netbsd_core_data; - PTR any; - @} tdata; - - /* Used by the application to hold private data*/ - PTR usrdata; - - /* Where all the allocated stuff under this BFD goes. This is a - struct objalloc *, but we use PTR to avoid requiring the inclusion of - objalloc.h. */ - PTR memory; -@}; - -@end example -@section Error reporting -Most BFD functions return nonzero on success (check their -individual documentation for precise semantics). On an error, -they call @code{bfd_set_error} to set an error condition that callers -can check by calling @code{bfd_get_error}. -If that returns @code{bfd_error_system_call}, then check -@code{errno}. - -The easiest way to report a BFD error to the user is to -use @code{bfd_perror}. -@* -@subsection Type @code{bfd_error_type} -The values returned by @code{bfd_get_error} are defined by the -enumerated type @code{bfd_error_type}. -@* -. -@example -typedef enum bfd_error -@{ - bfd_error_no_error = 0, - bfd_error_system_call, - bfd_error_invalid_target, - bfd_error_wrong_format, - bfd_error_invalid_operation, - bfd_error_no_memory, - bfd_error_no_symbols, - bfd_error_no_armap, - bfd_error_no_more_archived_files, - bfd_error_malformed_archive, - bfd_error_file_not_recognized, - bfd_error_file_ambiguously_recognized, - bfd_error_no_contents, - bfd_error_nonrepresentable_section, - bfd_error_no_debug_section, - bfd_error_bad_value, - bfd_error_file_truncated, - bfd_error_file_too_big, - bfd_error_invalid_error_code -@} bfd_error_type; - -@end example -@findex bfd_get_error -@subsubsection @code{bfd_get_error} -@strong{Synopsis} -@example -bfd_error_type bfd_get_error (void); -@end example -@strong{Description}@* -Return the current BFD error condition. -@* -@findex bfd_set_error -@subsubsection @code{bfd_set_error} -@strong{Synopsis} -@example -void bfd_set_error (bfd_error_type error_tag); -@end example -@strong{Description}@* -Set the BFD error condition to be @var{error_tag}. -@* -@findex bfd_errmsg -@subsubsection @code{bfd_errmsg} -@strong{Synopsis} -@example -CONST char *bfd_errmsg (bfd_error_type error_tag); -@end example -@strong{Description}@* -Return a string describing the error @var{error_tag}, or -the system error if @var{error_tag} is @code{bfd_error_system_call}. -@* -@findex bfd_perror -@subsubsection @code{bfd_perror} -@strong{Synopsis} -@example -void bfd_perror (CONST char *message); -@end example -@strong{Description}@* -Print to the standard error stream a string describing the -last BFD error that occurred, or the last system error if -the last BFD error was a system call failure. If @var{message} -is non-NULL and non-empty, the error string printed is preceded -by @var{message}, a colon, and a space. It is followed by a newline. -@* -@subsection BFD error handler -Some BFD functions want to print messages describing the -problem. They call a BFD error handler function. This -function may be overriden by the program. - -The BFD error handler acts like printf. -@* -. -@example -typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...)); - -@end example -@findex bfd_set_error_handler -@subsubsection @code{bfd_set_error_handler} -@strong{Synopsis} -@example -bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); -@end example -@strong{Description}@* -Set the BFD error handler function. Returns the previous -function. -@* -@findex bfd_set_error_program_name -@subsubsection @code{bfd_set_error_program_name} -@strong{Synopsis} -@example -void bfd_set_error_program_name (const char *); -@end example -@strong{Description}@* -Set the program name to use when printing a BFD error. This -is printed before the error message followed by a colon and -space. The string must not be changed after it is passed to -this function. -@* -@section Symbols - -@* -@findex bfd_get_reloc_upper_bound -@subsubsection @code{bfd_get_reloc_upper_bound} -@strong{Synopsis} -@example -long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect); -@end example -@strong{Description}@* -Return the number of bytes required to store the -relocation information associated with section @var{sect} -attached to bfd @var{abfd}. If an error occurs, return -1. -@* -@findex bfd_canonicalize_reloc -@subsubsection @code{bfd_canonicalize_reloc} -@strong{Synopsis} -@example -long bfd_canonicalize_reloc - (bfd *abfd, - asection *sec, - arelent **loc, - asymbol **syms); -@end example -@strong{Description}@* -Call the back end associated with the open BFD -@var{abfd} and translate the external form of the relocation -information attached to @var{sec} into the internal canonical -form. Place the table into memory at @var{loc}, which has -been preallocated, usually by a call to -@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or --1 on error. - -The @var{syms} table is also needed for horrible internal magic -reasons. -@* -@findex bfd_set_reloc -@subsubsection @code{bfd_set_reloc} -@strong{Synopsis} -@example -void bfd_set_reloc - (bfd *abfd, asection *sec, arelent **rel, unsigned int count) -@end example -@strong{Description}@* -Set the relocation pointer and count within -section @var{sec} to the values @var{rel} and @var{count}. -The argument @var{abfd} is ignored. -@* -@findex bfd_set_file_flags -@subsubsection @code{bfd_set_file_flags} -@strong{Synopsis} -@example -boolean bfd_set_file_flags(bfd *abfd, flagword flags); -@end example -@strong{Description}@* -Set the flag word in the BFD @var{abfd} to the value @var{flags}. - -Possible errors are: -@itemize @bullet - -@item -@code{bfd_error_wrong_format} - The target bfd was not of object format. -@item -@code{bfd_error_invalid_operation} - The target bfd was open for reading. -@item -@code{bfd_error_invalid_operation} - -The flag word contained a bit which was not applicable to the -type of file. E.g., an attempt was made to set the @code{D_PAGED} bit -on a BFD format which does not support demand paging. -@end itemize -@* -@findex bfd_set_start_address -@subsubsection @code{bfd_set_start_address} -@strong{Synopsis} -@example -boolean bfd_set_start_address(bfd *abfd, bfd_vma vma); -@end example -@strong{Description}@* -Make @var{vma} the entry point of output BFD @var{abfd}. -@* -@strong{Returns}@* -Returns @code{true} on success, @code{false} otherwise. -@* -@findex bfd_get_mtime -@subsubsection @code{bfd_get_mtime} -@strong{Synopsis} -@example -long bfd_get_mtime(bfd *abfd); -@end example -@strong{Description}@* -Return the file modification time (as read from the file system, or -from the archive header for archive members). -@* -@findex bfd_get_size -@subsubsection @code{bfd_get_size} -@strong{Synopsis} -@example -long bfd_get_size(bfd *abfd); -@end example -@strong{Description}@* -Return the file size (as read from file system) for the file -associated with BFD @var{abfd}. - -The initial motivation for, and use of, this routine is not -so we can get the exact size of the object the BFD applies to, since -that might not be generally possible (archive members for example). -It would be ideal if someone could eventually modify -it so that such results were guaranteed. - -Instead, we want to ask questions like "is this NNN byte sized -object I'm about to try read from file offset YYY reasonable?" -As as example of where we might do this, some object formats -use string tables for which the first @code{sizeof(long)} bytes of the -table contain the size of the table itself, including the size bytes. -If an application tries to read what it thinks is one of these -string tables, without some way to validate the size, and for -some reason the size is wrong (byte swapping error, wrong location -for the string table, etc.), the only clue is likely to be a read -error when it tries to read the table, or a "virtual memory -exhausted" error when it tries to allocate 15 bazillon bytes -of space for the 15 bazillon byte table it is about to read. -This function at least allows us to answer the quesion, "is the -size reasonable?". -@* -@findex bfd_get_gp_size -@subsubsection @code{bfd_get_gp_size} -@strong{Synopsis} -@example -int bfd_get_gp_size(bfd *abfd); -@end example -@strong{Description}@* -Return the maximum size of objects to be optimized using the GP -register under MIPS ECOFF. This is typically set by the @code{-G} -argument to the compiler, assembler or linker. -@* -@findex bfd_set_gp_size -@subsubsection @code{bfd_set_gp_size} -@strong{Synopsis} -@example -void bfd_set_gp_size(bfd *abfd, int i); -@end example -@strong{Description}@* -Set the maximum size of objects to be optimized using the GP -register under ECOFF or MIPS ELF. This is typically set by -the @code{-G} argument to the compiler, assembler or linker. -@* -@findex bfd_scan_vma -@subsubsection @code{bfd_scan_vma} -@strong{Synopsis} -@example -bfd_vma bfd_scan_vma(CONST char *string, CONST char **end, int base); -@end example -@strong{Description}@* -Convert, like @code{strtoul}, a numerical expression -@var{string} into a @code{bfd_vma} integer, and return that integer. -(Though without as many bells and whistles as @code{strtoul}.) -The expression is assumed to be unsigned (i.e., positive). -If given a @var{base}, it is used as the base for conversion. -A base of 0 causes the function to interpret the string -in hex if a leading "0x" or "0X" is found, otherwise -in octal if a leading zero is found, otherwise in decimal. - -Overflow is not detected. -@* -@findex bfd_copy_private_bfd_data -@subsubsection @code{bfd_copy_private_bfd_data} -@strong{Synopsis} -@example -boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd); -@end example -@strong{Description}@* -Copy private BFD information from the BFD @var{ibfd} to the -the BFD @var{obfd}. Return @code{true} on success, @code{false} on error. -Possible error returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{obfd}. -@end itemize -@example -#define bfd_copy_private_bfd_data(ibfd, obfd) \ - BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ - (ibfd, obfd)) -@end example -@* -@findex bfd_merge_private_bfd_data -@subsubsection @code{bfd_merge_private_bfd_data} -@strong{Synopsis} -@example -boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd); -@end example -@strong{Description}@* -Merge private BFD information from the BFD @var{ibfd} to the -the output file BFD @var{obfd} when linking. Return @code{true} -on success, @code{false} on error. Possible error returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{obfd}. -@end itemize -@example -#define bfd_merge_private_bfd_data(ibfd, obfd) \ - BFD_SEND (obfd, _bfd_merge_private_bfd_data, \ - (ibfd, obfd)) -@end example -@* -@findex bfd_set_private_flags -@subsubsection @code{bfd_set_private_flags} -@strong{Synopsis} -@example -boolean bfd_set_private_flags(bfd *abfd, flagword flags); -@end example -@strong{Description}@* -Set private BFD flag information in the BFD @var{abfd}. -Return @code{true} on success, @code{false} on error. Possible error -returns are: - -@itemize @bullet - -@item -@code{bfd_error_no_memory} - -Not enough memory exists to create private data for @var{obfd}. -@end itemize -@example -#define bfd_set_private_flags(abfd, flags) \ - BFD_SEND (abfd, _bfd_set_private_flags, \ - (abfd, flags)) -@end example -@* -@findex stuff -@subsubsection @code{stuff} -@strong{Description}@* -Stuff which should be documented: -@example -#define bfd_sizeof_headers(abfd, reloc) \ - BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc)) - -#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ - BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line)) - - /* Do these three do anything useful at all, for any back end? */ -#define bfd_debug_info_start(abfd) \ - BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) - -#define bfd_debug_info_end(abfd) \ - BFD_SEND (abfd, _bfd_debug_info_end, (abfd)) - -#define bfd_debug_info_accumulate(abfd, section) \ - BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) - - -#define bfd_stat_arch_elt(abfd, stat) \ - BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) - -#define bfd_update_armap_timestamp(abfd) \ - BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd)) - -#define bfd_set_arch_mach(abfd, arch, mach)\ - BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach)) - -#define bfd_relax_section(abfd, section, link_info, again) \ - BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again)) - -#define bfd_link_hash_table_create(abfd) \ - BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) - -#define bfd_link_add_symbols(abfd, info) \ - BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) - -#define bfd_final_link(abfd, info) \ - BFD_SEND (abfd, _bfd_final_link, (abfd, info)) - -#define bfd_free_cached_info(abfd) \ - BFD_SEND (abfd, _bfd_free_cached_info, (abfd)) - -#define bfd_get_dynamic_symtab_upper_bound(abfd) \ - BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd)) - -#define bfd_print_private_bfd_data(abfd, file)\ - BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file)) - -#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ - BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) - -#define bfd_get_dynamic_reloc_upper_bound(abfd) \ - BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) - -#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \ - BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms)) - -extern bfd_byte *bfd_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, - struct bfd_link_order *, bfd_byte *, - boolean, asymbol **)); - -@end example -@* diff --git a/bfd/doc/makefile.vms b/bfd/doc/makefile.vms new file mode 100644 index 0000000000000..a0857c0caafc5 --- /dev/null +++ b/bfd/doc/makefile.vms @@ -0,0 +1,5 @@ +CFLAGS = /noopt/include=([],[-],[-.-.include]) +LDFLAGS = /nomap +LDLIBS = ,sys$$library:vaxcrtl.olb/lib + +all: chew.exe diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h new file mode 100644 index 0000000000000..1f79147a880e4 --- /dev/null +++ b/bfd/elf-hppa.h @@ -0,0 +1,2184 @@ +/* Common code for PA ELF implementations. + Copyright 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define ELF_HOWTO_TABLE_SIZE R_PARISC_UNIMPLEMENTED + 1 + +/* This file is included by multiple PA ELF BFD backends with different + sizes. + + Most of the routines are written to be size independent, but sometimes + external constraints require 32 or 64 bit specific code. We remap + the definitions/functions as necessary here. */ +#if ARCH_SIZE == 64 +#define ELF_R_TYPE(X) ELF64_R_TYPE(X) +#define ELF_R_SYM(X) ELF64_R_SYM(X) +#define elf_hppa_reloc_final_type elf64_hppa_reloc_final_type +#define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type +#define elf_hppa_relocate_section elf64_hppa_relocate_section +#define elf_hppa_final_link elf64_hppa_final_link +#endif +#if ARCH_SIZE == 32 +#define ELF_R_TYPE(X) ELF32_R_TYPE(X) +#define ELF_R_SYM(X) ELF32_R_SYM(X) +#define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type +#define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type +#define elf_hppa_relocate_section elf32_hppa_relocate_section +#define elf_hppa_final_link elf32_hppa_final_link +#endif + +#if ARCH_SIZE == 64 +static bfd_reloc_status_type elf_hppa_final_link_relocate + (Elf_Internal_Rela *, bfd *, bfd *, asection *, bfd_byte *, bfd_vma, + struct bfd_link_info *, asection *, struct elf_link_hash_entry *, + struct elf64_hppa_dyn_hash_entry *); + +static int elf_hppa_relocate_insn + (int, int, unsigned int); +#endif + +/* ELF/PA relocation howto entries. */ + +static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] = +{ + { R_PARISC_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_NONE", FALSE, 0, 0, FALSE }, + + /* The values in DIR32 are to placate the check in + _bfd_stab_section_find_nearest_line. */ + { R_PARISC_DIR32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DIR32", FALSE, 0, 0xffffffff, FALSE }, + { R_PARISC_DIR21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DIR21L", FALSE, 0, 0, FALSE }, + { R_PARISC_DIR17R, 0, 0, 17, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DIR17R", FALSE, 0, 0, FALSE }, + { R_PARISC_DIR17F, 0, 0, 17, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DIR17F", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_DIR14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DIR14R", FALSE, 0, 0, FALSE }, + { R_PARISC_DIR14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DIR14F", FALSE, 0, 0, FALSE }, + /* 8 */ + { R_PARISC_PCREL12F, 0, 0, 12, TRUE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL12F", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL32, 0, 0, 32, TRUE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL32", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL21L, 0, 0, 21, TRUE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL21L", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL17R, 0, 0, 17, TRUE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL17R", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL17F, 0, 0, 17, TRUE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL17F", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL17C, 0, 0, 17, TRUE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL17C", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL14R, 0, 0, 14, TRUE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL14R", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL14F, 0, 0, 14, TRUE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL14F", FALSE, 0, 0, FALSE }, + /* 16 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_DPREL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DPREL21L", FALSE, 0, 0, FALSE }, + { R_PARISC_DPREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DPREL14WR", FALSE, 0, 0, FALSE }, + { R_PARISC_DPREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DPREL14DR", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_DPREL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DPREL14R", FALSE, 0, 0, FALSE }, + { R_PARISC_DPREL14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DPREL14F", FALSE, 0, 0, FALSE }, + /* 24 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_DLTREL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DLTREL21L", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_DLTREL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DLTREL14R", FALSE, 0, 0, FALSE }, + { R_PARISC_DLTREL14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DLTREL14F", FALSE, 0, 0, FALSE }, + /* 32 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_DLTIND21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DLTIND21L", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_DLTIND14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DLTIND14R", FALSE, 0, 0, FALSE }, + { R_PARISC_DLTIND14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DLTIND14F", FALSE, 0, 0, FALSE }, + /* 40 */ + { R_PARISC_SETBASE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_SETBASE", FALSE, 0, 0, FALSE }, + { R_PARISC_SECREL32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_SECREL32", FALSE, 0, 0, FALSE }, + { R_PARISC_BASEREL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_BASEREL21L", FALSE, 0, 0, FALSE }, + { R_PARISC_BASEREL17R, 0, 0, 17, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_BASEREL17R", FALSE, 0, 0, FALSE }, + { R_PARISC_BASEREL17F, 0, 0, 17, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_BASEREL17F", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_BASEREL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_BASEREL14R", FALSE, 0, 0, FALSE }, + { R_PARISC_BASEREL14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_BASEREL14F", FALSE, 0, 0, FALSE }, + /* 48 */ + { R_PARISC_SEGBASE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_SEGBASE", FALSE, 0, 0, FALSE }, + { R_PARISC_SEGREL32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_SEGREL32", FALSE, 0, 0, FALSE }, + { R_PARISC_PLTOFF21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PLTOFF21L", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_PLTOFF14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PLTOFF14R", FALSE, 0, 0, FALSE }, + { R_PARISC_PLTOFF14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PLTOFF14F", FALSE, 0, 0, FALSE }, + /* 56 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_FPTR32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR32", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_FPTR21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR21L", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_FPTR14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14R", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 64 */ + { R_PARISC_FPTR64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_FPTR64", FALSE, 0, 0, FALSE }, + { R_PARISC_PLABEL32, 0, 0, 32, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PLABEL32", FALSE, 0, 0, FALSE }, + { R_PARISC_PLABEL21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PLABEL21L", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_PLABEL14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PLABEL14R", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 72 */ + { R_PARISC_PCREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL64", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL22C, 0, 0, 22, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL22C", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL22F, 0, 0, 22, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL22F", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL14WR", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL14DR", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL16F", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL16WF", FALSE, 0, 0, FALSE }, + { R_PARISC_PCREL16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PCREL16DF", FALSE, 0, 0, FALSE }, + /* 80 */ + { R_PARISC_DIR64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DIR64", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_DIR14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DIR14WR", FALSE, 0, 0, FALSE }, + { R_PARISC_DIR14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DIR14DR", FALSE, 0, 0, FALSE }, + { R_PARISC_DIR16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DIR16F", FALSE, 0, 0, FALSE }, + { R_PARISC_DIR16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DIR16WF", FALSE, 0, 0, FALSE }, + { R_PARISC_DIR16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DIR16DF", FALSE, 0, 0, FALSE }, + /* 88 */ + { R_PARISC_GPREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_GPREL64", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_DLTREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DLTREL14WR", FALSE, 0, 0, FALSE }, + { R_PARISC_DLTREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DLTREL14DR", FALSE, 0, 0, FALSE }, + { R_PARISC_GPREL16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_GPREL16F", FALSE, 0, 0, FALSE }, + { R_PARISC_GPREL16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_GPREL16WF", FALSE, 0, 0, FALSE }, + { R_PARISC_GPREL16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_GPREL16DF", FALSE, 0, 0, FALSE }, + /* 96 */ + { R_PARISC_LTOFF64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF64", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_DLTIND14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DLTIND14WR", FALSE, 0, 0, FALSE }, + { R_PARISC_DLTIND14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_DLTIND14DR", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF16F", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", FALSE, 0, 0, FALSE }, + /* 104 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_BASEREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_BASEREL14WR", FALSE, 0, 0, FALSE }, + { R_PARISC_BASEREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_BASEREL14DR", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 112 */ + { R_PARISC_SEGREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_SEGREL64", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_PLTOFF14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PLTOFF14WR", FALSE, 0, 0, FALSE }, + { R_PARISC_PLTOFF14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PLTOFF14DR", FALSE, 0, 0, FALSE }, + { R_PARISC_PLTOFF16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PLTOFF16F", FALSE, 0, 0, FALSE }, + { R_PARISC_PLTOFF16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PLTOFF16WF", FALSE, 0, 0, FALSE }, + { R_PARISC_PLTOFF16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_PLTOFF16DF", FALSE, 0, 0, FALSE }, + /* 120 */ + { R_PARISC_LTOFF_FPTR64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_FPTR14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14WR", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_FPTR14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14DR", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_FPTR16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16F", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_FPTR16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16WF", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_FPTR16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 128 */ + { R_PARISC_COPY, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_COPY", FALSE, 0, 0, FALSE }, + { R_PARISC_IPLT, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_IPLT", FALSE, 0, 0, FALSE }, + { R_PARISC_EPLT, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_EPLT", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 136 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 144 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 152 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_TPREL32, 0, 0, 32, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_TPREL32", FALSE, 0, 0, FALSE }, + { R_PARISC_TPREL21L, 0, 0, 21, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_TPREL21L", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_TPREL14R, 0, 0, 14, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_TPREL14R", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 160 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_TP21L, 0, 0, 21, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP21L", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_TP14R, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_TP14F, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14F", FALSE, 0, 0, FALSE }, + /* 168 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 176 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 184 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 192 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 200 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 208 */ + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + /* 216 */ + { R_PARISC_TPREL64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_TPREL64", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_TPREL14WR, 0, 0, 14, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_TPREL14WR", FALSE, 0, 0, FALSE }, + { R_PARISC_TPREL14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_TPREL14DR", FALSE, 0, 0, FALSE }, + { R_PARISC_TPREL16F, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_TPREL16F", FALSE, 0, 0, FALSE }, + { R_PARISC_TPREL16WF, 0, 0, 16, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_TPREL16WF", FALSE, 0, 0, FALSE }, + { R_PARISC_TPREL16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_TPREL16DF", FALSE, 0, 0, FALSE }, + /* 224 */ + { R_PARISC_LTOFF_TP64, 0, 0, 64, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP64", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_UNIMPLEMENTED, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_TP14WR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14WR", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_TP14DR, 0, 0, 14, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14DR", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_TP16F, 0, 0, 16, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16F", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_TP16WF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16WF", FALSE, 0, 0, FALSE }, + { R_PARISC_LTOFF_TP16DF, 0, 0, 16, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16DF", FALSE, 0, 0, FALSE }, + /* 232 */ + { R_PARISC_GNU_VTENTRY, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_GNU_VTENTRY", FALSE, 0, 0, FALSE }, + { R_PARISC_GNU_VTINHERIT, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_PARISC_GNU_VTINHERIT", FALSE, 0, 0, FALSE }, +}; + +#define OFFSET_14R_FROM_21L 4 +#define OFFSET_14F_FROM_21L 5 + +/* Return the final relocation type for the given base type, instruction + format, and field selector. */ + +elf_hppa_reloc_type +elf_hppa_reloc_final_type (bfd *abfd, + elf_hppa_reloc_type base_type, + int format, + unsigned int field) +{ + elf_hppa_reloc_type final_type = base_type; + + /* Just a tangle of nested switch statements to deal with the braindamage + that a different field selector means a completely different relocation + for PA ELF. */ + switch (base_type) + { + /* We have been using generic relocation types. However, that may not + really make sense. Anyway, we need to support both R_PARISC_DIR64 + and R_PARISC_DIR32 here. */ + case R_PARISC_DIR32: + case R_PARISC_DIR64: + case R_HPPA_ABS_CALL: + switch (format) + { + case 14: + switch (field) + { + case e_fsel: + final_type = R_PARISC_DIR14F; + break; + case e_rsel: + case e_rrsel: + case e_rdsel: + final_type = R_PARISC_DIR14R; + break; + case e_rtsel: + final_type = R_PARISC_DLTIND14R; + break; + case e_rtpsel: + final_type = R_PARISC_LTOFF_FPTR14DR; + break; + case e_tsel: + final_type = R_PARISC_DLTIND14F; + break; + case e_rpsel: + final_type = R_PARISC_PLABEL14R; + break; + default: + return R_PARISC_NONE; + } + break; + + case 17: + switch (field) + { + case e_fsel: + final_type = R_PARISC_DIR17F; + break; + case e_rsel: + case e_rrsel: + case e_rdsel: + final_type = R_PARISC_DIR17R; + break; + default: + return R_PARISC_NONE; + } + break; + + case 21: + switch (field) + { + case e_lsel: + case e_lrsel: + case e_ldsel: + case e_nlsel: + case e_nlrsel: + final_type = R_PARISC_DIR21L; + break; + case e_ltsel: + final_type = R_PARISC_DLTIND21L; + break; + case e_ltpsel: + final_type = R_PARISC_LTOFF_FPTR21L; + break; + case e_lpsel: + final_type = R_PARISC_PLABEL21L; + break; + default: + return R_PARISC_NONE; + } + break; + + case 32: + switch (field) + { + case e_fsel: + final_type = R_PARISC_DIR32; + /* When in 64bit mode, a 32bit relocation is supposed to + be a section relative relocation. Dwarf2 (for example) + uses 32bit section relative relocations. */ + if (bfd_get_arch_info (abfd)->bits_per_address != 32) + final_type = R_PARISC_SECREL32; + break; + case e_psel: + final_type = R_PARISC_PLABEL32; + break; + default: + return R_PARISC_NONE; + } + break; + + case 64: + switch (field) + { + case e_fsel: + final_type = R_PARISC_DIR64; + break; + case e_psel: + final_type = R_PARISC_FPTR64; + break; + default: + return R_PARISC_NONE; + } + break; + + default: + return R_PARISC_NONE; + } + break; + + case R_HPPA_GOTOFF: + switch (format) + { + case 14: + switch (field) + { + case e_rsel: + case e_rrsel: + case e_rdsel: + /* R_PARISC_DLTREL14R for elf64, R_PARISC_DPREL14R for elf32 */ + final_type = base_type + OFFSET_14R_FROM_21L; + break; + case e_fsel: + /* R_PARISC_DLTREL14F for elf64, R_PARISC_DPREL14F for elf32 */ + final_type = base_type + OFFSET_14F_FROM_21L; + break; + default: + return R_PARISC_NONE; + } + break; + + case 21: + switch (field) + { + case e_lsel: + case e_lrsel: + case e_ldsel: + case e_nlsel: + case e_nlrsel: + /* R_PARISC_DLTREL21L for elf64, R_PARISC_DPREL21L for elf32 */ + final_type = base_type; + break; + default: + return R_PARISC_NONE; + } + break; + + default: + return R_PARISC_NONE; + } + break; + + case R_HPPA_PCREL_CALL: + switch (format) + { + case 12: + switch (field) + { + case e_fsel: + final_type = R_PARISC_PCREL12F; + break; + default: + return R_PARISC_NONE; + } + break; + + case 14: + /* Contrary to appearances, these are not calls of any sort. + Rather, they are loads/stores with a pcrel reloc. */ + switch (field) + { + case e_rsel: + case e_rrsel: + case e_rdsel: + final_type = R_PARISC_PCREL14R; + break; + case e_fsel: + if (bfd_get_mach (abfd) < 25) + final_type = R_PARISC_PCREL14F; + else + final_type = R_PARISC_PCREL16F; + break; + default: + return R_PARISC_NONE; + } + break; + + case 17: + switch (field) + { + case e_rsel: + case e_rrsel: + case e_rdsel: + final_type = R_PARISC_PCREL17R; + break; + case e_fsel: + final_type = R_PARISC_PCREL17F; + break; + default: + return R_PARISC_NONE; + } + break; + + case 21: + switch (field) + { + case e_lsel: + case e_lrsel: + case e_ldsel: + case e_nlsel: + case e_nlrsel: + final_type = R_PARISC_PCREL21L; + break; + default: + return R_PARISC_NONE; + } + break; + + case 22: + switch (field) + { + case e_fsel: + final_type = R_PARISC_PCREL22F; + break; + default: + return R_PARISC_NONE; + } + break; + + case 32: + switch (field) + { + case e_fsel: + final_type = R_PARISC_PCREL32; + break; + default: + return R_PARISC_NONE; + } + break; + + case 64: + switch (field) + { + case e_fsel: + final_type = R_PARISC_PCREL64; + break; + default: + return R_PARISC_NONE; + } + break; + + default: + return R_PARISC_NONE; + } + break; + + case R_PARISC_GNU_VTENTRY: + case R_PARISC_GNU_VTINHERIT: + case R_PARISC_SEGREL32: + case R_PARISC_SEGBASE: + /* The defaults are fine for these cases. */ + break; + + default: + return R_PARISC_NONE; + } + + return final_type; +} + +/* Return one (or more) BFD relocations which implement the base + relocation with modifications based on format and field. */ + +elf_hppa_reloc_type ** +_bfd_elf_hppa_gen_reloc_type (bfd *abfd, + elf_hppa_reloc_type base_type, + int format, + unsigned int field, + int ignore ATTRIBUTE_UNUSED, + asymbol *sym ATTRIBUTE_UNUSED) +{ + elf_hppa_reloc_type *finaltype; + elf_hppa_reloc_type **final_types; + bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2; + + /* Allocate slots for the BFD relocation. */ + final_types = bfd_alloc (abfd, amt); + if (final_types == NULL) + return NULL; + + /* Allocate space for the relocation itself. */ + amt = sizeof (elf_hppa_reloc_type); + finaltype = bfd_alloc (abfd, amt); + if (finaltype == NULL) + return NULL; + + /* Some reasonable defaults. */ + final_types[0] = finaltype; + final_types[1] = NULL; + + *finaltype = elf_hppa_reloc_final_type (abfd, base_type, format, field); + + return final_types; +} + +/* Translate from an elf into field into a howto relocation pointer. */ + +static void +elf_hppa_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + arelent *bfd_reloc, + Elf_Internal_Rela *elf_reloc) +{ + BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info) + < (unsigned int) R_PARISC_UNIMPLEMENTED); + bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)]; +} + +/* Translate from an elf into field into a howto relocation pointer. */ + +static void +elf_hppa_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + arelent *bfd_reloc, + Elf_Internal_Rela *elf_reloc) +{ + BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info) + < (unsigned int) R_PARISC_UNIMPLEMENTED); + bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)]; +} + +/* Return the address of the howto table entry to perform the CODE + relocation for an ARCH machine. */ + +static reloc_howto_type * +elf_hppa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + if ((int) code < (int) R_PARISC_UNIMPLEMENTED) + { + BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code); + return &elf_hppa_howto_table[(int) code]; + } + return NULL; +} + +/* Return TRUE if SYM represents a local label symbol. */ + +static bfd_boolean +elf_hppa_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name) +{ + if (name[0] == 'L' && name[1] == '$') + return 1; + return _bfd_elf_is_local_label_name (abfd, name); +} + +/* Set the correct type for an ELF section. We do this by the + section name, which is a hack, but ought to work. */ + +static bfd_boolean +elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) +{ + const char *name; + + name = bfd_get_section_name (abfd, sec); + + if (strcmp (name, ".PARISC.unwind") == 0) + { + int indx; + asection *asec; +#if ARCH_SIZE == 64 + hdr->sh_type = SHT_LOPROC + 1; +#else + hdr->sh_type = 1; +#endif + /* ?!? How are unwinds supposed to work for symbols in arbitrary + sections? Or what if we have multiple .text sections in a single + .o file? HP really messed up on this one. + + Ugh. We can not use elf_section_data (sec)->this_idx at this + point because it is not initialized yet. + + So we (gasp) recompute it here. Hopefully nobody ever changes the + way sections are numbered in elf.c! */ + for (asec = abfd->sections, indx = 1; asec; asec = asec->next, indx++) + { + if (asec->name && strcmp (asec->name, ".text") == 0) + { + hdr->sh_info = indx; + break; + } + } + + /* I have no idea if this is really necessary or what it means. */ + hdr->sh_entsize = 4; + } + return TRUE; +} + +static void +elf_hppa_final_write_processing (bfd *abfd, + bfd_boolean linker ATTRIBUTE_UNUSED) +{ + int mach = bfd_get_mach (abfd); + + elf_elfheader (abfd)->e_flags &= ~(EF_PARISC_ARCH | EF_PARISC_TRAPNIL + | EF_PARISC_EXT | EF_PARISC_LSB + | EF_PARISC_WIDE | EF_PARISC_NO_KABP + | EF_PARISC_LAZYSWAP); + + if (mach == 10) + elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_0; + else if (mach == 11) + elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_1; + else if (mach == 20) + elf_elfheader (abfd)->e_flags |= EFA_PARISC_2_0; + else if (mach == 25) + elf_elfheader (abfd)->e_flags |= (EF_PARISC_WIDE + | EFA_PARISC_2_0 + /* The GNU tools have trapped without + option since 1993, so need to take + a step backwards with the ELF + based toolchains. */ + | EF_PARISC_TRAPNIL); +} + +/* Comparison function for qsort to sort unwind section during a + final link. */ + +static int +hppa_unwind_entry_compare (const void *a, const void *b) +{ + const bfd_byte *ap, *bp; + unsigned long av, bv; + + ap = a; + av = (unsigned long) ap[0] << 24; + av |= (unsigned long) ap[1] << 16; + av |= (unsigned long) ap[2] << 8; + av |= (unsigned long) ap[3]; + + bp = b; + bv = (unsigned long) bp[0] << 24; + bv |= (unsigned long) bp[1] << 16; + bv |= (unsigned long) bp[2] << 8; + bv |= (unsigned long) bp[3]; + + return av < bv ? -1 : av > bv ? 1 : 0; +} + +static bfd_boolean elf_hppa_sort_unwind (bfd *abfd) +{ + asection *s; + + /* Magic section names, but this is much safer than having + relocate_section remember where SEGREL32 relocs occurred. + Consider what happens if someone inept creates a linker script + that puts unwind information in .text. */ + s = bfd_get_section_by_name (abfd, ".PARISC.unwind"); + if (s != NULL) + { + bfd_size_type size; + char *contents; + + size = s->_raw_size; + contents = bfd_malloc (size); + if (contents == NULL) + return FALSE; + + if (! bfd_get_section_contents (abfd, s, contents, (file_ptr) 0, size)) + return FALSE; + + qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare); + + if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size)) + return FALSE; + } + + return TRUE; +} + +#if ARCH_SIZE == 64 +/* Hook called by the linker routine which adds symbols from an object + file. HP's libraries define symbols with HP specific section + indices, which we have to handle. */ + +static bfd_boolean +elf_hppa_add_symbol_hook (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Sym *sym, + const char **namep ATTRIBUTE_UNUSED, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp, + bfd_vma *valp) +{ + int index = sym->st_shndx; + + switch (index) + { + case SHN_PARISC_ANSI_COMMON: + *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common"); + (*secp)->flags |= SEC_IS_COMMON; + *valp = sym->st_size; + break; + + case SHN_PARISC_HUGE_COMMON: + *secp = bfd_make_section_old_way (abfd, ".PARISC.huge.common"); + (*secp)->flags |= SEC_IS_COMMON; + *valp = sym->st_size; + break; + } + + return TRUE; +} + +static bfd_boolean +elf_hppa_unmark_useless_dynamic_symbols (struct elf_link_hash_entry *h, + void *data) +{ + struct bfd_link_info *info = data; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* If we are not creating a shared library, and this symbol is + referenced by a shared library but is not defined anywhere, then + the generic code will warn that it is undefined. + + This behavior is undesirable on HPs since the standard shared + libraries contain references to undefined symbols. + + So we twiddle the flags associated with such symbols so that they + will not trigger the warning. ?!? FIXME. This is horribly fragile. + + Ultimately we should have better controls over the generic ELF BFD + linker code. */ + if (! info->relocatable + && info->unresolved_syms_in_shared_libs != RM_IGNORE + && h->root.type == bfd_link_hash_undefined + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) + { + h->elf_link_hash_flags &= ~ELF_LINK_HASH_REF_DYNAMIC; + h->elf_link_hash_flags |= 0x8000; + } + + return TRUE; +} + +static bfd_boolean +elf_hppa_remark_useless_dynamic_symbols (struct elf_link_hash_entry *h, + void *data) +{ + struct bfd_link_info *info = data; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* If we are not creating a shared library, and this symbol is + referenced by a shared library but is not defined anywhere, then + the generic code will warn that it is undefined. + + This behavior is undesirable on HPs since the standard shared + libraries contain references to undefined symbols. + + So we twiddle the flags associated with such symbols so that they + will not trigger the warning. ?!? FIXME. This is horribly fragile. + + Ultimately we should have better controls over the generic ELF BFD + linker code. */ + if (! info->relocatable + && info->unresolved_syms_in_shared_libs != RM_IGNORE + && h->root.type == bfd_link_hash_undefined + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0 + && (h->elf_link_hash_flags & 0x8000) != 0) + { + h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC; + h->elf_link_hash_flags &= ~0x8000; + } + + return TRUE; +} + +static bfd_boolean +elf_hppa_is_dynamic_loader_symbol (const char *name) +{ + return (! strcmp (name, "__CPU_REVISION") + || ! strcmp (name, "__CPU_KEYBITS_1") + || ! strcmp (name, "__SYSTEM_ID_D") + || ! strcmp (name, "__FPU_MODEL") + || ! strcmp (name, "__FPU_REVISION") + || ! strcmp (name, "__ARGC") + || ! strcmp (name, "__ARGV") + || ! strcmp (name, "__ENVP") + || ! strcmp (name, "__TLS_SIZE_D") + || ! strcmp (name, "__LOAD_INFO") + || ! strcmp (name, "__systab")); +} + +/* Record the lowest address for the data and text segments. */ +static void +elf_hppa_record_segment_addrs (bfd *abfd ATTRIBUTE_UNUSED, + asection *section, + void *data) +{ + struct elf64_hppa_link_hash_table *hppa_info; + bfd_vma value; + + hppa_info = data; + + value = section->vma - section->filepos; + + if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) + == (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) + && value < hppa_info->text_segment_base) + hppa_info->text_segment_base = value; + else if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) + == (SEC_ALLOC | SEC_LOAD)) + && value < hppa_info->data_segment_base) + hppa_info->data_segment_base = value; +} + +/* Called after we have seen all the input files/sections, but before + final symbol resolution and section placement has been determined. + + We use this hook to (possibly) provide a value for __gp, then we + fall back to the generic ELF final link routine. */ + +static bfd_boolean +elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info) +{ + bfd_boolean retval; + struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info); + + if (! info->relocatable) + { + struct elf_link_hash_entry *gp; + bfd_vma gp_val; + + /* The linker script defines a value for __gp iff it was referenced + by one of the objects being linked. First try to find the symbol + in the hash table. If that fails, just compute the value __gp + should have had. */ + gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE, + FALSE, FALSE); + + if (gp) + { + + /* Adjust the value of __gp as we may want to slide it into the + .plt section so that the stubs can access PLT entries without + using an addil sequence. */ + gp->root.u.def.value += hppa_info->gp_offset; + + gp_val = (gp->root.u.def.section->output_section->vma + + gp->root.u.def.section->output_offset + + gp->root.u.def.value); + } + else + { + asection *sec; + + /* First look for a .plt section. If found, then __gp is the + address of the .plt + gp_offset. + + If no .plt is found, then look for .dlt, .opd and .data (in + that order) and set __gp to the base address of whichever + section is found first. */ + + sec = hppa_info->plt_sec; + if (sec && ! (sec->flags & SEC_EXCLUDE)) + gp_val = (sec->output_offset + + sec->output_section->vma + + hppa_info->gp_offset); + else + { + sec = hppa_info->dlt_sec; + if (!sec || (sec->flags & SEC_EXCLUDE)) + sec = hppa_info->opd_sec; + if (!sec || (sec->flags & SEC_EXCLUDE)) + sec = bfd_get_section_by_name (abfd, ".data"); + if (!sec || (sec->flags & SEC_EXCLUDE)) + return FALSE; + + gp_val = sec->output_offset + sec->output_section->vma; + } + } + + /* Install whatever value we found/computed for __gp. */ + _bfd_set_gp_value (abfd, gp_val); + } + + /* We need to know the base of the text and data segments so that we + can perform SEGREL relocations. We will record the base addresses + when we encounter the first SEGREL relocation. */ + hppa_info->text_segment_base = (bfd_vma)-1; + hppa_info->data_segment_base = (bfd_vma)-1; + + /* HP's shared libraries have references to symbols that are not + defined anywhere. The generic ELF BFD linker code will complain + about such symbols. + + So we detect the losing case and arrange for the flags on the symbol + to indicate that it was never referenced. This keeps the generic + ELF BFD link code happy and appears to not create any secondary + problems. Ultimately we need a way to control the behavior of the + generic ELF BFD link code better. */ + elf_link_hash_traverse (elf_hash_table (info), + elf_hppa_unmark_useless_dynamic_symbols, + info); + + /* Invoke the regular ELF backend linker to do all the work. */ + retval = bfd_elf_final_link (abfd, info); + + elf_link_hash_traverse (elf_hash_table (info), + elf_hppa_remark_useless_dynamic_symbols, + info); + + /* If we're producing a final executable, sort the contents of the + unwind section. */ + if (retval) + retval = elf_hppa_sort_unwind (abfd); + + return retval; +} + +/* Relocate an HPPA ELF section. */ + +static bfd_boolean +elf_hppa_relocate_section (bfd *output_bfd, + struct bfd_link_info *info, + bfd *input_bfd, + asection *input_section, + bfd_byte *contents, + Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + struct elf64_hppa_link_hash_table *hppa_info; + + if (info->relocatable) + return TRUE; + + hppa_info = elf64_hppa_hash_table (info); + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info); + unsigned long r_symndx; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + asection *sym_sec; + bfd_vma relocation; + bfd_reloc_status_type r; + const char *sym_name; + const char *dyn_name; + char *dynh_buf = NULL; + size_t dynh_buflen = 0; + struct elf64_hppa_dyn_hash_entry *dyn_h = NULL; + + r_type = ELF_R_TYPE (rel->r_info); + if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* This is a final link. */ + r_symndx = ELF_R_SYM (rel->r_info); + h = NULL; + sym = NULL; + sym_sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + /* This is a local symbol. */ + sym = local_syms + r_symndx; + sym_sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel); + + /* If this symbol has an entry in the PA64 dynamic hash + table, then get it. */ + dyn_name = get_dyn_name (input_bfd, h, rel, + &dynh_buf, &dynh_buflen); + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + dyn_name, FALSE, FALSE); + + } + else + { + /* This is not a local symbol. */ + long indx; + + indx = r_symndx - symtab_hdr->sh_info; + h = elf_sym_hashes (input_bfd)[indx]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sym_sec = h->root.u.def.section; + + /* If this symbol has an entry in the PA64 dynamic hash + table, then get it. */ + dyn_name = get_dyn_name (input_bfd, h, rel, + &dynh_buf, &dynh_buflen); + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + dyn_name, FALSE, FALSE); + + /* If we have a relocation against a symbol defined in a + shared library and we have not created an entry in the + PA64 dynamic symbol hash table for it, then we lose. */ + if (sym_sec->output_section == NULL && dyn_h == NULL) + { + (*_bfd_error_handler) + (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), + bfd_archive_filename (input_bfd), h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + relocation = 0; + } + else if (sym_sec->output_section) + relocation = (h->root.u.def.value + + sym_sec->output_offset + + sym_sec->output_section->vma); + /* Value will be provided via one of the offsets in the + dyn_h hash table entry. */ + else + relocation = 0; + } + else if (info->unresolved_syms_in_objects == RM_IGNORE + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + { + /* If this symbol has an entry in the PA64 dynamic hash + table, then get it. */ + dyn_name = get_dyn_name (input_bfd, h, rel, + &dynh_buf, &dynh_buflen); + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + dyn_name, FALSE, FALSE); + + if (dyn_h == NULL) + { + (*_bfd_error_handler) + (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), + bfd_archive_filename (input_bfd), h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + } + relocation = 0; + } + else if (h->root.type == bfd_link_hash_undefweak) + { + dyn_name = get_dyn_name (input_bfd, h, rel, + &dynh_buf, &dynh_buflen); + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + dyn_name, FALSE, FALSE); + + if (dyn_h == NULL) + { + (*_bfd_error_handler) + (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), + bfd_archive_filename (input_bfd), h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + } + relocation = 0; + } + else + { + /* Ignore dynamic loader defined symbols. */ + if (elf_hppa_is_dynamic_loader_symbol (h->root.root.string)) + relocation = 0; + else + { + if (!((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, + (info->unresolved_syms_in_objects == RM_GENERATE_ERROR + || ELF_ST_VISIBILITY (h->other))))) + return FALSE; + break; + } + } + } + + if (h != NULL) + sym_name = h->root.root.string; + else + { + sym_name = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name); + if (sym_name == NULL) + return FALSE; + if (*sym_name == '\0') + sym_name = bfd_section_name (input_bfd, sym_sec); + } + + r = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd, + input_section, contents, + relocation, info, sym_sec, + h, dyn_h); + + if (r != bfd_reloc_ok) + { + switch (r) + { + default: + abort (); + case bfd_reloc_overflow: + { + if (!((*info->callbacks->reloc_overflow) + (info, sym_name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return FALSE; + } + break; + } + } + } + return TRUE; +} + +/* Compute the value for a relocation (REL) during a final link stage, + then insert the value into the proper location in CONTENTS. + + VALUE is a tentative value for the relocation and may be overridden + and modified here based on the specific relocation to be performed. + + For example we do conversions for PC-relative branches in this routine + or redirection of calls to external routines to stubs. + + The work of actually applying the relocation is left to a helper + routine in an attempt to reduce the complexity and size of this + function. */ + +static bfd_reloc_status_type +elf_hppa_final_link_relocate (Elf_Internal_Rela *rel, + bfd *input_bfd, + bfd *output_bfd, + asection *input_section, + bfd_byte *contents, + bfd_vma value, + struct bfd_link_info *info, + asection *sym_sec, + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED, + struct elf64_hppa_dyn_hash_entry *dyn_h) +{ + int insn; + bfd_vma offset = rel->r_offset; + bfd_signed_vma addend = rel->r_addend; + reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info); + unsigned int r_type = howto->type; + bfd_byte *hit_data = contents + offset; + struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info); + + insn = bfd_get_32 (input_bfd, hit_data); + + switch (r_type) + { + case R_PARISC_NONE: + break; + + /* Basic function call support. + + Note for a call to a function defined in another dynamic library + we want to redirect the call to a stub. */ + + /* Random PC relative relocs. */ + case R_PARISC_PCREL21L: + case R_PARISC_PCREL14R: + case R_PARISC_PCREL14F: + case R_PARISC_PCREL14WR: + case R_PARISC_PCREL14DR: + case R_PARISC_PCREL16F: + case R_PARISC_PCREL16WF: + case R_PARISC_PCREL16DF: + { + /* If this is a call to a function defined in another dynamic + library, then redirect the call to the local stub for this + function. */ + if (sym_sec == NULL || sym_sec->output_section == NULL) + value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset + + hppa_info->stub_sec->output_section->vma); + + /* Turn VALUE into a proper PC relative address. */ + value -= (offset + input_section->output_offset + + input_section->output_section->vma); + + /* Adjust for any field selectors. */ + if (r_type == R_PARISC_PCREL21L) + value = hppa_field_adjust (value, -8 + addend, e_lsel); + else if (r_type == R_PARISC_PCREL14F + || r_type == R_PARISC_PCREL16F + || r_type == R_PARISC_PCREL16WF + || r_type == R_PARISC_PCREL16DF) + value = hppa_field_adjust (value, -8 + addend, e_fsel); + else + value = hppa_field_adjust (value, -8 + addend, e_rsel); + + /* Apply the relocation to the given instruction. */ + insn = elf_hppa_relocate_insn (insn, (int) value, r_type); + break; + } + + case R_PARISC_PCREL12F: + case R_PARISC_PCREL22F: + case R_PARISC_PCREL17F: + case R_PARISC_PCREL22C: + case R_PARISC_PCREL17C: + case R_PARISC_PCREL17R: + { + /* If this is a call to a function defined in another dynamic + library, then redirect the call to the local stub for this + function. */ + if (sym_sec == NULL || sym_sec->output_section == NULL) + value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset + + hppa_info->stub_sec->output_section->vma); + + /* Turn VALUE into a proper PC relative address. */ + value -= (offset + input_section->output_offset + + input_section->output_section->vma); + + /* Adjust for any field selectors. */ + if (r_type == R_PARISC_PCREL17R) + value = hppa_field_adjust (value, -8 + addend, e_rsel); + else + value = hppa_field_adjust (value, -8 + addend, e_fsel); + + /* All branches are implicitly shifted by 2 places. */ + value >>= 2; + + /* Apply the relocation to the given instruction. */ + insn = elf_hppa_relocate_insn (insn, (int) value, r_type); + break; + } + + /* Indirect references to data through the DLT. */ + case R_PARISC_DLTIND14R: + case R_PARISC_DLTIND14F: + case R_PARISC_DLTIND14DR: + case R_PARISC_DLTIND14WR: + case R_PARISC_DLTIND21L: + case R_PARISC_LTOFF_FPTR14R: + case R_PARISC_LTOFF_FPTR14DR: + case R_PARISC_LTOFF_FPTR14WR: + case R_PARISC_LTOFF_FPTR21L: + case R_PARISC_LTOFF_FPTR16F: + case R_PARISC_LTOFF_FPTR16WF: + case R_PARISC_LTOFF_FPTR16DF: + case R_PARISC_LTOFF_TP21L: + case R_PARISC_LTOFF_TP14R: + case R_PARISC_LTOFF_TP14F: + case R_PARISC_LTOFF_TP14WR: + case R_PARISC_LTOFF_TP14DR: + case R_PARISC_LTOFF_TP16F: + case R_PARISC_LTOFF_TP16WF: + case R_PARISC_LTOFF_TP16DF: + case R_PARISC_LTOFF16F: + case R_PARISC_LTOFF16WF: + case R_PARISC_LTOFF16DF: + { + /* If this relocation was against a local symbol, then we still + have not set up the DLT entry (it's not convenient to do so + in the "finalize_dlt" routine because it is difficult to get + to the local symbol's value). + + So, if this is a local symbol (h == NULL), then we need to + fill in its DLT entry. + + Similarly we may still need to set up an entry in .opd for + a local function which had its address taken. */ + if (dyn_h->h == NULL) + { + /* Now do .opd creation if needed. */ + if (r_type == R_PARISC_LTOFF_FPTR14R + || r_type == R_PARISC_LTOFF_FPTR14DR + || r_type == R_PARISC_LTOFF_FPTR14WR + || r_type == R_PARISC_LTOFF_FPTR21L + || r_type == R_PARISC_LTOFF_FPTR16F + || r_type == R_PARISC_LTOFF_FPTR16WF + || r_type == R_PARISC_LTOFF_FPTR16DF) + { + /* The first two words of an .opd entry are zero. */ + memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, + 0, 16); + + /* The next word is the address of the function. */ + bfd_put_64 (hppa_info->opd_sec->owner, value + addend, + (hppa_info->opd_sec->contents + + dyn_h->opd_offset + 16)); + + /* The last word is our local __gp value. */ + value = _bfd_get_gp_value + (hppa_info->opd_sec->output_section->owner); + bfd_put_64 (hppa_info->opd_sec->owner, value, + (hppa_info->opd_sec->contents + + dyn_h->opd_offset + 24)); + + /* The DLT value is the address of the .opd entry. */ + value = (dyn_h->opd_offset + + hppa_info->opd_sec->output_offset + + hppa_info->opd_sec->output_section->vma); + addend = 0; + } + + bfd_put_64 (hppa_info->dlt_sec->owner, + value + addend, + hppa_info->dlt_sec->contents + dyn_h->dlt_offset); + } + + /* We want the value of the DLT offset for this symbol, not + the symbol's actual address. Note that __gp may not point + to the start of the DLT, so we have to compute the absolute + address, then subtract out the value of __gp. */ + value = (dyn_h->dlt_offset + + hppa_info->dlt_sec->output_offset + + hppa_info->dlt_sec->output_section->vma); + value -= _bfd_get_gp_value (output_bfd); + + /* All DLTIND relocations are basically the same at this point, + except that we need different field selectors for the 21bit + version vs the 14bit versions. */ + if (r_type == R_PARISC_DLTIND21L + || r_type == R_PARISC_LTOFF_FPTR21L + || r_type == R_PARISC_LTOFF_TP21L) + value = hppa_field_adjust (value, 0, e_lsel); + else if (r_type == R_PARISC_DLTIND14F + || r_type == R_PARISC_LTOFF_FPTR16F + || r_type == R_PARISC_LTOFF_FPTR16WF + || r_type == R_PARISC_LTOFF_FPTR16DF + || r_type == R_PARISC_LTOFF16F + || r_type == R_PARISC_LTOFF16DF + || r_type == R_PARISC_LTOFF16WF + || r_type == R_PARISC_LTOFF_TP16F + || r_type == R_PARISC_LTOFF_TP16WF + || r_type == R_PARISC_LTOFF_TP16DF) + value = hppa_field_adjust (value, 0, e_fsel); + else + value = hppa_field_adjust (value, 0, e_rsel); + + insn = elf_hppa_relocate_insn (insn, (int) value, r_type); + break; + } + + case R_PARISC_DLTREL14R: + case R_PARISC_DLTREL14F: + case R_PARISC_DLTREL14DR: + case R_PARISC_DLTREL14WR: + case R_PARISC_DLTREL21L: + case R_PARISC_DPREL21L: + case R_PARISC_DPREL14WR: + case R_PARISC_DPREL14DR: + case R_PARISC_DPREL14R: + case R_PARISC_DPREL14F: + case R_PARISC_GPREL16F: + case R_PARISC_GPREL16WF: + case R_PARISC_GPREL16DF: + { + /* Subtract out the global pointer value to make value a DLT + relative address. */ + value -= _bfd_get_gp_value (output_bfd); + + /* All DLTREL relocations are basically the same at this point, + except that we need different field selectors for the 21bit + version vs the 14bit versions. */ + if (r_type == R_PARISC_DLTREL21L + || r_type == R_PARISC_DPREL21L) + value = hppa_field_adjust (value, addend, e_lrsel); + else if (r_type == R_PARISC_DLTREL14F + || r_type == R_PARISC_DPREL14F + || r_type == R_PARISC_GPREL16F + || r_type == R_PARISC_GPREL16WF + || r_type == R_PARISC_GPREL16DF) + value = hppa_field_adjust (value, addend, e_fsel); + else + value = hppa_field_adjust (value, addend, e_rrsel); + + insn = elf_hppa_relocate_insn (insn, (int) value, r_type); + break; + } + + case R_PARISC_DIR21L: + case R_PARISC_DIR17R: + case R_PARISC_DIR17F: + case R_PARISC_DIR14R: + case R_PARISC_DIR14F: + case R_PARISC_DIR14WR: + case R_PARISC_DIR14DR: + case R_PARISC_DIR16F: + case R_PARISC_DIR16WF: + case R_PARISC_DIR16DF: + { + /* All DIR relocations are basically the same at this point, + except that branch offsets need to be divided by four, and + we need different field selectors. Note that we don't + redirect absolute calls to local stubs. */ + + if (r_type == R_PARISC_DIR21L) + value = hppa_field_adjust (value, addend, e_lrsel); + else if (r_type == R_PARISC_DIR17F + || r_type == R_PARISC_DIR16F + || r_type == R_PARISC_DIR16WF + || r_type == R_PARISC_DIR16DF + || r_type == R_PARISC_DIR14F) + value = hppa_field_adjust (value, addend, e_fsel); + else + value = hppa_field_adjust (value, addend, e_rrsel); + + if (r_type == R_PARISC_DIR17R || r_type == R_PARISC_DIR17F) + { + /* All branches are implicitly shifted by 2 places. */ + value >>= 2; + } + + insn = elf_hppa_relocate_insn (insn, (int) value, r_type); + break; + } + + case R_PARISC_PLTOFF21L: + case R_PARISC_PLTOFF14R: + case R_PARISC_PLTOFF14F: + case R_PARISC_PLTOFF14WR: + case R_PARISC_PLTOFF14DR: + case R_PARISC_PLTOFF16F: + case R_PARISC_PLTOFF16WF: + case R_PARISC_PLTOFF16DF: + { + /* We want the value of the PLT offset for this symbol, not + the symbol's actual address. Note that __gp may not point + to the start of the DLT, so we have to compute the absolute + address, then subtract out the value of __gp. */ + value = (dyn_h->plt_offset + + hppa_info->plt_sec->output_offset + + hppa_info->plt_sec->output_section->vma); + value -= _bfd_get_gp_value (output_bfd); + + /* All PLTOFF relocations are basically the same at this point, + except that we need different field selectors for the 21bit + version vs the 14bit versions. */ + if (r_type == R_PARISC_PLTOFF21L) + value = hppa_field_adjust (value, addend, e_lrsel); + else if (r_type == R_PARISC_PLTOFF14F + || r_type == R_PARISC_PLTOFF16F + || r_type == R_PARISC_PLTOFF16WF + || r_type == R_PARISC_PLTOFF16DF) + value = hppa_field_adjust (value, addend, e_fsel); + else + value = hppa_field_adjust (value, addend, e_rrsel); + + insn = elf_hppa_relocate_insn (insn, (int) value, r_type); + break; + } + + case R_PARISC_LTOFF_FPTR32: + { + /* We may still need to create the FPTR itself if it was for + a local symbol. */ + if (dyn_h->h == NULL) + { + /* The first two words of an .opd entry are zero. */ + memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16); + + /* The next word is the address of the function. */ + bfd_put_64 (hppa_info->opd_sec->owner, value + addend, + (hppa_info->opd_sec->contents + + dyn_h->opd_offset + 16)); + + /* The last word is our local __gp value. */ + value = _bfd_get_gp_value + (hppa_info->opd_sec->output_section->owner); + bfd_put_64 (hppa_info->opd_sec->owner, value, + hppa_info->opd_sec->contents + dyn_h->opd_offset + 24); + + /* The DLT value is the address of the .opd entry. */ + value = (dyn_h->opd_offset + + hppa_info->opd_sec->output_offset + + hppa_info->opd_sec->output_section->vma); + + bfd_put_64 (hppa_info->dlt_sec->owner, + value, + hppa_info->dlt_sec->contents + dyn_h->dlt_offset); + } + + /* We want the value of the DLT offset for this symbol, not + the symbol's actual address. Note that __gp may not point + to the start of the DLT, so we have to compute the absolute + address, then subtract out the value of __gp. */ + value = (dyn_h->dlt_offset + + hppa_info->dlt_sec->output_offset + + hppa_info->dlt_sec->output_section->vma); + value -= _bfd_get_gp_value (output_bfd); + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + } + + case R_PARISC_LTOFF_FPTR64: + case R_PARISC_LTOFF_TP64: + { + /* We may still need to create the FPTR itself if it was for + a local symbol. */ + if (dyn_h->h == NULL && r_type == R_PARISC_LTOFF_FPTR64) + { + /* The first two words of an .opd entry are zero. */ + memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16); + + /* The next word is the address of the function. */ + bfd_put_64 (hppa_info->opd_sec->owner, value + addend, + (hppa_info->opd_sec->contents + + dyn_h->opd_offset + 16)); + + /* The last word is our local __gp value. */ + value = _bfd_get_gp_value + (hppa_info->opd_sec->output_section->owner); + bfd_put_64 (hppa_info->opd_sec->owner, value, + hppa_info->opd_sec->contents + dyn_h->opd_offset + 24); + + /* The DLT value is the address of the .opd entry. */ + value = (dyn_h->opd_offset + + hppa_info->opd_sec->output_offset + + hppa_info->opd_sec->output_section->vma); + + bfd_put_64 (hppa_info->dlt_sec->owner, + value, + hppa_info->dlt_sec->contents + dyn_h->dlt_offset); + } + + /* We want the value of the DLT offset for this symbol, not + the symbol's actual address. Note that __gp may not point + to the start of the DLT, so we have to compute the absolute + address, then subtract out the value of __gp. */ + value = (dyn_h->dlt_offset + + hppa_info->dlt_sec->output_offset + + hppa_info->dlt_sec->output_section->vma); + value -= _bfd_get_gp_value (output_bfd); + bfd_put_64 (input_bfd, value, hit_data); + return bfd_reloc_ok; + } + + case R_PARISC_DIR32: + bfd_put_32 (input_bfd, value + addend, hit_data); + return bfd_reloc_ok; + + case R_PARISC_DIR64: + bfd_put_64 (input_bfd, value + addend, hit_data); + return bfd_reloc_ok; + + case R_PARISC_GPREL64: + /* Subtract out the global pointer value to make value a DLT + relative address. */ + value -= _bfd_get_gp_value (output_bfd); + + bfd_put_64 (input_bfd, value + addend, hit_data); + return bfd_reloc_ok; + + case R_PARISC_LTOFF64: + /* We want the value of the DLT offset for this symbol, not + the symbol's actual address. Note that __gp may not point + to the start of the DLT, so we have to compute the absolute + address, then subtract out the value of __gp. */ + value = (dyn_h->dlt_offset + + hppa_info->dlt_sec->output_offset + + hppa_info->dlt_sec->output_section->vma); + value -= _bfd_get_gp_value (output_bfd); + + bfd_put_64 (input_bfd, value + addend, hit_data); + return bfd_reloc_ok; + + case R_PARISC_PCREL32: + { + /* If this is a call to a function defined in another dynamic + library, then redirect the call to the local stub for this + function. */ + if (sym_sec == NULL || sym_sec->output_section == NULL) + value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset + + hppa_info->stub_sec->output_section->vma); + + /* Turn VALUE into a proper PC relative address. */ + value -= (offset + input_section->output_offset + + input_section->output_section->vma); + + value += addend; + value -= 8; + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + } + + case R_PARISC_PCREL64: + { + /* If this is a call to a function defined in another dynamic + library, then redirect the call to the local stub for this + function. */ + if (sym_sec == NULL || sym_sec->output_section == NULL) + value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset + + hppa_info->stub_sec->output_section->vma); + + /* Turn VALUE into a proper PC relative address. */ + value -= (offset + input_section->output_offset + + input_section->output_section->vma); + + value += addend; + value -= 8; + bfd_put_64 (input_bfd, value, hit_data); + return bfd_reloc_ok; + } + + case R_PARISC_FPTR64: + { + /* We may still need to create the FPTR itself if it was for + a local symbol. */ + if (dyn_h->h == NULL) + { + /* The first two words of an .opd entry are zero. */ + memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16); + + /* The next word is the address of the function. */ + bfd_put_64 (hppa_info->opd_sec->owner, value + addend, + (hppa_info->opd_sec->contents + + dyn_h->opd_offset + 16)); + + /* The last word is our local __gp value. */ + value = _bfd_get_gp_value + (hppa_info->opd_sec->output_section->owner); + bfd_put_64 (hppa_info->opd_sec->owner, value, + hppa_info->opd_sec->contents + dyn_h->opd_offset + 24); + } + + if (dyn_h->want_opd) + /* We want the value of the OPD offset for this symbol. */ + value = (dyn_h->opd_offset + + hppa_info->opd_sec->output_offset + + hppa_info->opd_sec->output_section->vma); + else + /* We want the address of the symbol. */ + value += addend; + + bfd_put_64 (input_bfd, value, hit_data); + return bfd_reloc_ok; + } + + case R_PARISC_SECREL32: + bfd_put_32 (input_bfd, + value + addend - sym_sec->output_section->vma, + hit_data); + return bfd_reloc_ok; + + case R_PARISC_SEGREL32: + case R_PARISC_SEGREL64: + { + /* If this is the first SEGREL relocation, then initialize + the segment base values. */ + if (hppa_info->text_segment_base == (bfd_vma) -1) + bfd_map_over_sections (output_bfd, elf_hppa_record_segment_addrs, + hppa_info); + + /* VALUE holds the absolute address. We want to include the + addend, then turn it into a segment relative address. + + The segment is derived from SYM_SEC. We assume that there are + only two segments of note in the resulting executable/shlib. + A readonly segment (.text) and a readwrite segment (.data). */ + value += addend; + + if (sym_sec->flags & SEC_CODE) + value -= hppa_info->text_segment_base; + else + value -= hppa_info->data_segment_base; + + if (r_type == R_PARISC_SEGREL32) + bfd_put_32 (input_bfd, value, hit_data); + else + bfd_put_64 (input_bfd, value, hit_data); + return bfd_reloc_ok; + } + + /* Something we don't know how to handle. */ + default: + return bfd_reloc_notsupported; + } + + /* Update the instruction word. */ + bfd_put_32 (input_bfd, (bfd_vma) insn, hit_data); + return bfd_reloc_ok; +} + +/* Relocate the given INSN. VALUE should be the actual value we want + to insert into the instruction, ie by this point we should not be + concerned with computing an offset relative to the DLT, PC, etc. + Instead this routine is meant to handle the bit manipulations needed + to insert the relocation into the given instruction. */ + +static int +elf_hppa_relocate_insn (int insn, int sym_value, unsigned int r_type) +{ + switch (r_type) + { + /* This is any 22 bit branch. In PA2.0 syntax it corresponds to + the "B" instruction. */ + case R_PARISC_PCREL22F: + case R_PARISC_PCREL22C: + return (insn & ~0x3ff1ffd) | re_assemble_22 (sym_value); + + /* This is any 12 bit branch. */ + case R_PARISC_PCREL12F: + return (insn & ~0x1ffd) | re_assemble_12 (sym_value); + + /* This is any 17 bit branch. In PA2.0 syntax it also corresponds + to the "B" instruction as well as BE. */ + case R_PARISC_PCREL17F: + case R_PARISC_DIR17F: + case R_PARISC_DIR17R: + case R_PARISC_PCREL17C: + case R_PARISC_PCREL17R: + return (insn & ~0x1f1ffd) | re_assemble_17 (sym_value); + + /* ADDIL or LDIL instructions. */ + case R_PARISC_DLTREL21L: + case R_PARISC_DLTIND21L: + case R_PARISC_LTOFF_FPTR21L: + case R_PARISC_PCREL21L: + case R_PARISC_LTOFF_TP21L: + case R_PARISC_DPREL21L: + case R_PARISC_PLTOFF21L: + case R_PARISC_DIR21L: + return (insn & ~0x1fffff) | re_assemble_21 (sym_value); + + /* LDO and integer loads/stores with 14 bit displacements. */ + case R_PARISC_DLTREL14R: + case R_PARISC_DLTREL14F: + case R_PARISC_DLTIND14R: + case R_PARISC_DLTIND14F: + case R_PARISC_LTOFF_FPTR14R: + case R_PARISC_PCREL14R: + case R_PARISC_PCREL14F: + case R_PARISC_LTOFF_TP14R: + case R_PARISC_LTOFF_TP14F: + case R_PARISC_DPREL14R: + case R_PARISC_DPREL14F: + case R_PARISC_PLTOFF14R: + case R_PARISC_PLTOFF14F: + case R_PARISC_DIR14R: + case R_PARISC_DIR14F: + return (insn & ~0x3fff) | low_sign_unext (sym_value, 14); + + /* PA2.0W LDO and integer loads/stores with 16 bit displacements. */ + case R_PARISC_LTOFF_FPTR16F: + case R_PARISC_PCREL16F: + case R_PARISC_LTOFF_TP16F: + case R_PARISC_GPREL16F: + case R_PARISC_PLTOFF16F: + case R_PARISC_DIR16F: + case R_PARISC_LTOFF16F: + return (insn & ~0xffff) | re_assemble_16 (sym_value); + + /* Doubleword loads and stores with a 14 bit displacement. */ + case R_PARISC_DLTREL14DR: + case R_PARISC_DLTIND14DR: + case R_PARISC_LTOFF_FPTR14DR: + case R_PARISC_LTOFF_FPTR16DF: + case R_PARISC_PCREL14DR: + case R_PARISC_PCREL16DF: + case R_PARISC_LTOFF_TP14DR: + case R_PARISC_LTOFF_TP16DF: + case R_PARISC_DPREL14DR: + case R_PARISC_GPREL16DF: + case R_PARISC_PLTOFF14DR: + case R_PARISC_PLTOFF16DF: + case R_PARISC_DIR14DR: + case R_PARISC_DIR16DF: + case R_PARISC_LTOFF16DF: + return (insn & ~0x3ff1) | (((sym_value & 0x2000) >> 13) + | ((sym_value & 0x1ff8) << 1)); + + /* Floating point single word load/store instructions. */ + case R_PARISC_DLTREL14WR: + case R_PARISC_DLTIND14WR: + case R_PARISC_LTOFF_FPTR14WR: + case R_PARISC_LTOFF_FPTR16WF: + case R_PARISC_PCREL14WR: + case R_PARISC_PCREL16WF: + case R_PARISC_LTOFF_TP14WR: + case R_PARISC_LTOFF_TP16WF: + case R_PARISC_DPREL14WR: + case R_PARISC_GPREL16WF: + case R_PARISC_PLTOFF14WR: + case R_PARISC_PLTOFF16WF: + case R_PARISC_DIR16WF: + case R_PARISC_DIR14WR: + case R_PARISC_LTOFF16WF: + return (insn & ~0x3ff9) | (((sym_value & 0x2000) >> 13) + | ((sym_value & 0x1ffc) << 1)); + + default: + return insn; + } +} +#endif diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c new file mode 100644 index 0000000000000..52685253062e7 --- /dev/null +++ b/bfd/elf-m10200.c @@ -0,0 +1,1414 @@ +/* Matsushita 10200 specific support for 32-bit ELF + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" + +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void mn10200_info_to_howto + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static bfd_boolean mn10200_elf_relax_delete_bytes + PARAMS ((bfd *, asection *, bfd_vma, int)); +static bfd_boolean mn10200_elf_symbol_address_p + PARAMS ((bfd *, asection *, Elf_Internal_Sym *, bfd_vma)); +static bfd_reloc_status_type mn10200_elf_final_link_relocate + PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, + bfd_byte *, bfd_vma, bfd_vma, bfd_vma, + struct bfd_link_info *, asection *, int)); +static bfd_boolean mn10200_elf_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, + bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, + asection **)); +static bfd_boolean mn10200_elf_relax_section + PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); +static bfd_byte * mn10200_elf_get_relocated_section_contents + PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, bfd_boolean, asymbol **)); + +enum reloc_type { + R_MN10200_NONE = 0, + R_MN10200_32, + R_MN10200_16, + R_MN10200_8, + R_MN10200_24, + R_MN10200_PCREL8, + R_MN10200_PCREL16, + R_MN10200_PCREL24, + R_MN10200_MAX +}; + +static reloc_howto_type elf_mn10200_howto_table[] = { + /* Dummy relocation. Does nothing. */ + HOWTO (R_MN10200_NONE, + 0, + 2, + 16, + FALSE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_NONE", + FALSE, + 0, + 0, + FALSE), + /* Standard 32 bit reloc. */ + HOWTO (R_MN10200_32, + 0, + 2, + 32, + FALSE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_32", + FALSE, + 0xffffffff, + 0xffffffff, + FALSE), + /* Standard 16 bit reloc. */ + HOWTO (R_MN10200_16, + 0, + 1, + 16, + FALSE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_16", + FALSE, + 0xffff, + 0xffff, + FALSE), + /* Standard 8 bit reloc. */ + HOWTO (R_MN10200_8, + 0, + 0, + 8, + FALSE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_8", + FALSE, + 0xff, + 0xff, + FALSE), + /* Standard 24 bit reloc. */ + HOWTO (R_MN10200_24, + 0, + 2, + 24, + FALSE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_24", + FALSE, + 0xffffff, + 0xffffff, + FALSE), + /* Simple 8 pc-relative reloc. */ + HOWTO (R_MN10200_PCREL8, + 0, + 0, + 8, + TRUE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_PCREL8", + FALSE, + 0xff, + 0xff, + TRUE), + /* Simple 16 pc-relative reloc. */ + HOWTO (R_MN10200_PCREL16, + 0, + 1, + 16, + TRUE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_PCREL16", + FALSE, + 0xffff, + 0xffff, + TRUE), + /* Simple 32bit pc-relative reloc with a 1 byte adjustment + to get the pc-relative offset correct. */ + HOWTO (R_MN10200_PCREL24, + 0, + 2, + 24, + TRUE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10200_PCREL24", + FALSE, + 0xffffff, + 0xffffff, + TRUE), +}; + +struct mn10200_reloc_map { + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +static const struct mn10200_reloc_map mn10200_reloc_map[] = { + { BFD_RELOC_NONE , R_MN10200_NONE , }, + { BFD_RELOC_32 , R_MN10200_32 , }, + { BFD_RELOC_16 , R_MN10200_16 , }, + { BFD_RELOC_8 , R_MN10200_8 , }, + { BFD_RELOC_24 , R_MN10200_24 , }, + { BFD_RELOC_8_PCREL , R_MN10200_PCREL8 , }, + { BFD_RELOC_16_PCREL, R_MN10200_PCREL16, }, + { BFD_RELOC_24_PCREL, R_MN10200_PCREL24, }, +}; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; + i < sizeof (mn10200_reloc_map) / sizeof (struct mn10200_reloc_map); + i++) + { + if (mn10200_reloc_map[i].bfd_reloc_val == code) + return &elf_mn10200_howto_table[mn10200_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Set the howto pointer for an MN10200 ELF reloc. */ + +static void +mn10200_info_to_howto (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_MN10200_MAX); + cache_ptr->howto = &elf_mn10200_howto_table[r_type]; +} + +/* Perform a relocation as part of a final link. */ + +static bfd_reloc_status_type +mn10200_elf_final_link_relocate (howto, input_bfd, output_bfd, + input_section, contents, offset, value, + addend, info, sym_sec, is_local) + reloc_howto_type *howto; + bfd *input_bfd; + bfd *output_bfd ATTRIBUTE_UNUSED; + asection *input_section; + bfd_byte *contents; + bfd_vma offset; + bfd_vma value; + bfd_vma addend; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sym_sec ATTRIBUTE_UNUSED; + int is_local ATTRIBUTE_UNUSED; +{ + unsigned long r_type = howto->type; + bfd_byte *hit_data = contents + offset; + + switch (r_type) + { + + case R_MN10200_NONE: + return bfd_reloc_ok; + + case R_MN10200_32: + value += addend; + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10200_16: + value += addend; + + if ((long) value > 0x7fff || (long) value < -0x8000) + return bfd_reloc_overflow; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10200_8: + value += addend; + + if ((long) value > 0x7f || (long) value < -0x80) + return bfd_reloc_overflow; + + bfd_put_8 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10200_24: + value += addend; + + if ((long) value > 0x7fffff || (long) value < -0x800000) + return bfd_reloc_overflow; + + value &= 0xffffff; + value |= (bfd_get_32 (input_bfd, hit_data) & 0xff000000); + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10200_PCREL8: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= (offset + 1); + value += addend; + + if ((long) value > 0xff || (long) value < -0x100) + return bfd_reloc_overflow; + + bfd_put_8 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10200_PCREL16: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= (offset + 2); + value += addend; + + if ((long) value > 0xffff || (long) value < -0x10000) + return bfd_reloc_overflow; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10200_PCREL24: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= (offset + 3); + value += addend; + + if ((long) value > 0xffffff || (long) value < -0x1000000) + return bfd_reloc_overflow; + + value &= 0xffffff; + value |= (bfd_get_32 (input_bfd, hit_data) & 0xff000000); + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + default: + return bfd_reloc_notsupported; + } +} + +/* Relocate an MN10200 ELF section. */ +static bfd_boolean +mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + howto = elf_mn10200_howto_table + r_type; + + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { + bfd_boolean unresolved_reloc, warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + } + + r = mn10200_elf_final_link_relocate (howto, input_bfd, output_bfd, + input_section, + contents, rel->r_offset, + relocation, rel->r_addend, + info, sec, h == NULL); + + if (r != bfd_reloc_ok) + { + const char *name; + const char *msg = (const char *) 0; + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL || *name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + switch (r) + { + case bfd_reloc_overflow: + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return FALSE; + break; + + case bfd_reloc_undefined: + if (! ((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, + rel->r_offset, TRUE))) + return FALSE; + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + goto common_error; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + goto common_error; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous error"); + goto common_error; + + default: + msg = _("internal error: unknown error"); + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, msg, name, input_bfd, input_section, + rel->r_offset))) + return FALSE; + break; + } + } + } + + return TRUE; +} + +/* This function handles relaxing for the mn10200. + + There are quite a few relaxing opportunities available on the mn10200: + + * jsr:24 -> jsr:16 2 bytes + + * jmp:24 -> jmp:16 2 bytes + * jmp:16 -> bra:8 1 byte + + * If the previous instruction is a conditional branch + around the jump/bra, we may be able to reverse its condition + and change its target to the jump's target. The jump/bra + can then be deleted. 2 bytes + + * mov abs24 -> mov abs16 2 byte savings + + * Most instructions which accept imm24 can relax to imm16 2 bytes + - Most instructions which accept imm16 can relax to imm8 1 byte + + * Most instructions which accept d24 can relax to d16 2 bytes + - Most instructions which accept d16 can relax to d8 1 byte + + abs24, imm24, d24 all look the same at the reloc level. It + might make the code simpler if we had different relocs for + the various relaxable operand types. + + We don't handle imm16->imm8 or d16->d8 as they're very rare + and somewhat more difficult to support. */ + +static bfd_boolean +mn10200_elf_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + bfd_boolean *again; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *contents = NULL; + Elf_Internal_Sym *isymbuf = NULL; + + /* Assume nothing changes. */ + *again = FALSE; + + /* We don't have to do anything for a relocatable link, if + this section does not have relocs, or if this is not a + code section. */ + if (link_info->relocatable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0 + || (sec->flags & SEC_CODE) == 0) + return TRUE; + + /* If this is the first time we have been called for this section, + initialize the cooked size. */ + if (sec->_cooked_size == 0) + sec->_cooked_size = sec->_raw_size; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + /* Get a copy of the native relocations. */ + internal_relocs = (_bfd_elf_link_read_relocs + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + + /* Walk through them looking for relaxing opportunities. */ + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma symval; + + /* If this isn't something that can be relaxed, then ignore + this reloc. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_NONE + || ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_8 + || ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_MAX) + continue; + + /* Get the section contents if we haven't done so already. */ + if (contents == NULL) + { + /* Get cached copy if it exists. */ + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + /* Go get them off disk. */ + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + /* Read this BFD's local symbols if we haven't done so already. */ + if (isymbuf == NULL && symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + /* A local symbol. */ + Elf_Internal_Sym *isym; + asection *sym_sec; + + isym = isymbuf + ELF32_R_SYM (irel->r_info); + if (isym->st_shndx == SHN_UNDEF) + sym_sec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + sym_sec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + sym_sec = bfd_com_section_ptr; + else + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + symval = (isym->st_value + + sym_sec->output_section->vma + + sym_sec->output_offset); + } + else + { + unsigned long indx; + struct elf_link_hash_entry *h; + + /* An external symbol. */ + indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + { + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + continue; + } + + symval = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + + /* For simplicity of coding, we are going to modify the section + contents, the section relocs, and the BFD symbol table. We + must tell the rest of the code not to free up this + information. It would be possible to instead create a table + of changes which have to be made, as is done in coff-mips.c; + that would be more work, but would require less memory when + the linker is run. */ + + /* Try to turn a 24bit pc-relative branch/call into a 16bit pc-relative + branch/call. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_PCREL24) + { + bfd_vma value = symval; + + /* Deal with pc-relative gunk. */ + value -= (sec->output_section->vma + sec->output_offset); + value -= (irel->r_offset + 3); + value += irel->r_addend; + + /* See if the value will fit in 16 bits, note the high value is + 0x7fff + 2 as the target will be two bytes closer if we are + able to relax. */ + if ((long) value < 0x8001 && (long) value > -0x8000) + { + unsigned char code; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + if (code != 0xe0 && code != 0xe1) + continue; + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + if (code == 0xe0) + bfd_put_8 (abfd, 0xfc, contents + irel->r_offset - 2); + else if (code == 0xe1) + bfd_put_8 (abfd, 0xfd, contents + irel->r_offset - 2); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10200_PCREL16); + + /* The opcode got shorter too, so we have to fix the offset. */ + irel->r_offset -= 1; + + /* Delete two bytes of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + } + + /* Try to turn a 16bit pc-relative branch into a 8bit pc-relative + branch. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_PCREL16) + { + bfd_vma value = symval; + + /* Deal with pc-relative gunk. */ + value -= (sec->output_section->vma + sec->output_offset); + value -= (irel->r_offset + 2); + value += irel->r_addend; + + /* See if the value will fit in 8 bits, note the high value is + 0x7f + 1 as the target will be one bytes closer if we are + able to relax. */ + if ((long) value < 0x80 && (long) value > -0x80) + { + unsigned char code; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + if (code != 0xfc) + continue; + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xea, contents + irel->r_offset - 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10200_PCREL8); + + /* Delete one byte of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 1)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + } + + /* Try to eliminate an unconditional 8 bit pc-relative branch + which immediately follows a conditional 8 bit pc-relative + branch around the unconditional branch. + + original: new: + bCC lab1 bCC' lab2 + bra lab2 + lab1: lab1: + + This happens when the bCC can't reach lab2 at assembly time, + but due to other relaxations it can reach at link time. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_PCREL8) + { + Elf_Internal_Rela *nrel; + bfd_vma value = symval; + unsigned char code; + + /* Deal with pc-relative gunk. */ + value -= (sec->output_section->vma + sec->output_offset); + value -= (irel->r_offset + 1); + value += irel->r_addend; + + /* Do nothing if this reloc is the last byte in the section. */ + if (irel->r_offset == sec->_cooked_size) + continue; + + /* See if the next instruction is an unconditional pc-relative + branch, more often than not this test will fail, so we + test it first to speed things up. */ + code = bfd_get_8 (abfd, contents + irel->r_offset + 1); + if (code != 0xea) + continue; + + /* Also make sure the next relocation applies to the next + instruction and that it's a pc-relative 8 bit branch. */ + nrel = irel + 1; + if (nrel == irelend + || irel->r_offset + 2 != nrel->r_offset + || ELF32_R_TYPE (nrel->r_info) != (int) R_MN10200_PCREL8) + continue; + + /* Make sure our destination immediately follows the + unconditional branch. */ + if (symval != (sec->output_section->vma + sec->output_offset + + irel->r_offset + 3)) + continue; + + /* Now make sure we are a conditional branch. This may not + be necessary, but why take the chance. + + Note these checks assume that R_MN10200_PCREL8 relocs + only occur on bCC and bCCx insns. If they occured + elsewhere, we'd need to know the start of this insn + for this check to be accurate. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + if (code != 0xe0 && code != 0xe1 && code != 0xe2 + && code != 0xe3 && code != 0xe4 && code != 0xe5 + && code != 0xe6 && code != 0xe7 && code != 0xe8 + && code != 0xe9 && code != 0xec && code != 0xed + && code != 0xee && code != 0xef && code != 0xfc + && code != 0xfd && code != 0xfe && code != 0xff) + continue; + + /* We also have to be sure there is no symbol/label + at the unconditional branch. */ + if (mn10200_elf_symbol_address_p (abfd, sec, isymbuf, + irel->r_offset + 1)) + continue; + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Reverse the condition of the first branch. */ + switch (code) + { + case 0xfc: + code = 0xfd; + break; + case 0xfd: + code = 0xfc; + break; + case 0xfe: + code = 0xff; + break; + case 0xff: + code = 0xfe; + break; + case 0xe8: + code = 0xe9; + break; + case 0xe9: + code = 0xe8; + break; + case 0xe0: + code = 0xe2; + break; + case 0xe2: + code = 0xe0; + break; + case 0xe3: + code = 0xe1; + break; + case 0xe1: + code = 0xe3; + break; + case 0xe4: + code = 0xe6; + break; + case 0xe6: + code = 0xe4; + break; + case 0xe7: + code = 0xe5; + break; + case 0xe5: + code = 0xe7; + break; + case 0xec: + code = 0xed; + break; + case 0xed: + code = 0xec; + break; + case 0xee: + code = 0xef; + break; + case 0xef: + code = 0xee; + break; + } + bfd_put_8 (abfd, code, contents + irel->r_offset - 1); + + /* Set the reloc type and symbol for the first branch + from the second branch. */ + irel->r_info = nrel->r_info; + + /* Make the reloc for the second branch a null reloc. */ + nrel->r_info = ELF32_R_INFO (ELF32_R_SYM (nrel->r_info), + R_MN10200_NONE); + + /* Delete two bytes of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + + /* Try to turn a 24bit immediate, displacement or absolute address + into a 16bit immediate, displacement or absolute address. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_24) + { + bfd_vma value = symval; + + /* See if the value will fit in 16 bits. + We allow any 16bit match here. We prune those we can't + handle below. */ + if ((long) value < 0x7fff && (long) value > -0x8000) + { + unsigned char code; + + /* All insns which have 24bit operands are 5 bytes long, + the first byte will always be 0xf4, but we double check + it just in case. */ + + /* Get the first opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 2); + + if (code != 0xf4) + continue; + + /* Get the second opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + switch (code & 0xfc) + { + /* mov imm24,dn -> mov imm16,dn */ + case 0x70: + /* Not safe if the high bit is on as relaxing may + move the value out of high mem and thus not fit + in a signed 16bit value. */ + if (value & 0x8000) + continue; + + /* Note that we've changed the relocation contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xf8 + (code & 0x03), + contents + irel->r_offset - 2); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10200_16); + + /* The opcode got shorter too, so we have to fix the + offset. */ + irel->r_offset -= 1; + + /* Delete two bytes of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + break; + + /* mov imm24,an -> mov imm16,an + cmp imm24,an -> cmp imm16,an + mov (abs24),dn -> mov (abs16),dn + mov dn,(abs24) -> mov dn,(abs16) + movb dn,(abs24) -> movb dn,(abs16) + movbu (abs24),dn -> movbu (abs16),dn */ + case 0x74: + case 0x7c: + case 0xc0: + case 0x40: + case 0x44: + case 0xc8: + /* Note that we've changed the relocation contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + if ((code & 0xfc) == 0x74) + code = 0xdc + (code & 0x03); + else if ((code & 0xfc) == 0x7c) + code = 0xec + (code & 0x03); + else if ((code & 0xfc) == 0xc0) + code = 0xc8 + (code & 0x03); + else if ((code & 0xfc) == 0x40) + code = 0xc0 + (code & 0x03); + else if ((code & 0xfc) == 0x44) + code = 0xc4 + (code & 0x03); + else if ((code & 0xfc) == 0xc8) + code = 0xcc + (code & 0x03); + + /* Fix the opcode. */ + bfd_put_8 (abfd, code, contents + irel->r_offset - 2); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10200_16); + + /* The opcode got shorter too, so we have to fix the + offset. */ + irel->r_offset -= 1; + + /* Delete two bytes of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + break; + + /* cmp imm24,dn -> cmp imm16,dn + mov (abs24),an -> mov (abs16),an + mov an,(abs24) -> mov an,(abs16) + add imm24,dn -> add imm16,dn + add imm24,an -> add imm16,an + sub imm24,dn -> sub imm16,dn + sub imm24,an -> sub imm16,an + And all d24->d16 in memory ops. */ + case 0x78: + case 0xd0: + case 0x50: + case 0x60: + case 0x64: + case 0x68: + case 0x6c: + case 0x80: + case 0xf0: + case 0x00: + case 0x10: + case 0xb0: + case 0x30: + case 0xa0: + case 0x20: + case 0x90: + /* Not safe if the high bit is on as relaxing may + move the value out of high mem and thus not fit + in a signed 16bit value. */ + if (((code & 0xfc) == 0x78 + || (code & 0xfc) == 0x60 + || (code & 0xfc) == 0x64 + || (code & 0xfc) == 0x68 + || (code & 0xfc) == 0x6c + || (code & 0xfc) == 0x80 + || (code & 0xfc) == 0xf0 + || (code & 0xfc) == 0x00 + || (code & 0xfc) == 0x10 + || (code & 0xfc) == 0xb0 + || (code & 0xfc) == 0x30 + || (code & 0xfc) == 0xa0 + || (code & 0xfc) == 0x20 + || (code & 0xfc) == 0x90) + && (value & 0x8000) != 0) + continue; + + /* Note that we've changed the relocation contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xf7, contents + irel->r_offset - 2); + + if ((code & 0xfc) == 0x78) + code = 0x48 + (code & 0x03); + else if ((code & 0xfc) == 0xd0) + code = 0x30 + (code & 0x03); + else if ((code & 0xfc) == 0x50) + code = 0x20 + (code & 0x03); + else if ((code & 0xfc) == 0x60) + code = 0x18 + (code & 0x03); + else if ((code & 0xfc) == 0x64) + code = 0x08 + (code & 0x03); + else if ((code & 0xfc) == 0x68) + code = 0x1c + (code & 0x03); + else if ((code & 0xfc) == 0x6c) + code = 0x0c + (code & 0x03); + else if ((code & 0xfc) == 0x80) + code = 0xc0 + (code & 0x07); + else if ((code & 0xfc) == 0xf0) + code = 0xb0 + (code & 0x07); + else if ((code & 0xfc) == 0x00) + code = 0x80 + (code & 0x07); + else if ((code & 0xfc) == 0x10) + code = 0xa0 + (code & 0x07); + else if ((code & 0xfc) == 0xb0) + code = 0x70 + (code & 0x07); + else if ((code & 0xfc) == 0x30) + code = 0x60 + (code & 0x07); + else if ((code & 0xfc) == 0xa0) + code = 0xd0 + (code & 0x07); + else if ((code & 0xfc) == 0x20) + code = 0x90 + (code & 0x07); + else if ((code & 0xfc) == 0x90) + code = 0x50 + (code & 0x07); + + bfd_put_8 (abfd, code, contents + irel->r_offset - 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10200_16); + + /* Delete one bytes of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 2, 1)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + break; + + /* movb (abs24),dn ->movbu (abs16),dn extxb bn */ + case 0xc4: + /* Note that we've changed the reldection contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + bfd_put_8 (abfd, 0xcc + (code & 0x03), + contents + irel->r_offset - 2); + + bfd_put_8 (abfd, 0xb8 + (code & 0x03), + contents + irel->r_offset - 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10200_16); + + /* The reloc will be applied one byte in front of its + current location. */ + irel->r_offset -= 1; + + /* Delete one bytes of data. */ + if (!mn10200_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 2, 1)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + break; + } + } + } + } + + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + { + if (! link_info->keep_memory) + free (isymbuf); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) isymbuf; + } + } + + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + { + if (! link_info->keep_memory) + free (contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + } + + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + return TRUE; + + error_return: + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + free (contents); + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + return FALSE; +} + +/* Delete some bytes from a section while relaxing. */ + +static bfd_boolean +mn10200_elf_relax_delete_bytes (abfd, sec, addr, count) + bfd *abfd; + asection *sec; + bfd_vma addr; + int count; +{ + Elf_Internal_Shdr *symtab_hdr; + unsigned int sec_shndx; + bfd_byte *contents; + Elf_Internal_Rela *irel, *irelend; + Elf_Internal_Rela *irelalign; + bfd_vma toaddr; + Elf_Internal_Sym *isym; + Elf_Internal_Sym *isymend; + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry **end_hashes; + unsigned int symcount; + + sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + contents = elf_section_data (sec)->this_hdr.contents; + + /* The deletion must stop at the next ALIGN reloc for an aligment + power larger than the number of bytes we are deleting. */ + + irelalign = NULL; + toaddr = sec->_cooked_size; + + irel = elf_section_data (sec)->relocs; + irelend = irel + sec->reloc_count; + + /* Actually delete the bytes. */ + memmove (contents + addr, contents + addr + count, + (size_t) (toaddr - addr - count)); + sec->_cooked_size -= count; + + /* Adjust all the relocs. */ + for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) + { + /* Get the new reloc address. */ + if ((irel->r_offset > addr + && irel->r_offset < toaddr)) + irel->r_offset -= count; + } + + /* Adjust the local symbols defined in this section. */ + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + isym = (Elf_Internal_Sym *) symtab_hdr->contents; + for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++) + { + if (isym->st_shndx == sec_shndx + && isym->st_value > addr + && isym->st_value < toaddr) + isym->st_value -= count; + } + + /* Now adjust the global symbols defined in this section. */ + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + sym_hashes = elf_sym_hashes (abfd); + end_hashes = sym_hashes + symcount; + for (; sym_hashes < end_hashes; sym_hashes++) + { + struct elf_link_hash_entry *sym_hash = *sym_hashes; + if ((sym_hash->root.type == bfd_link_hash_defined + || sym_hash->root.type == bfd_link_hash_defweak) + && sym_hash->root.u.def.section == sec + && sym_hash->root.u.def.value > addr + && sym_hash->root.u.def.value < toaddr) + { + sym_hash->root.u.def.value -= count; + } + } + + return TRUE; +} + +/* Return TRUE if a symbol exists at the given address, else return + FALSE. */ +static bfd_boolean +mn10200_elf_symbol_address_p (abfd, sec, isym, addr) + bfd *abfd; + asection *sec; + Elf_Internal_Sym *isym; + bfd_vma addr; +{ + Elf_Internal_Shdr *symtab_hdr; + unsigned int sec_shndx; + Elf_Internal_Sym *isymend; + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry **end_hashes; + unsigned int symcount; + + sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + /* Examine all the local symbols. */ + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++) + { + if (isym->st_shndx == sec_shndx + && isym->st_value == addr) + return TRUE; + } + + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + sym_hashes = elf_sym_hashes (abfd); + end_hashes = sym_hashes + symcount; + for (; sym_hashes < end_hashes; sym_hashes++) + { + struct elf_link_hash_entry *sym_hash = *sym_hashes; + if ((sym_hash->root.type == bfd_link_hash_defined + || sym_hash->root.type == bfd_link_hash_defweak) + && sym_hash->root.u.def.section == sec + && sym_hash->root.u.def.value == addr) + return TRUE; + } + + return FALSE; +} + +/* This is a version of bfd_generic_get_relocated_section_contents + which uses mn10200_elf_relocate_section. */ + +static bfd_byte * +mn10200_elf_get_relocated_section_contents (output_bfd, link_info, link_order, + data, relocatable, symbols) + bfd *output_bfd; + struct bfd_link_info *link_info; + struct bfd_link_order *link_order; + bfd_byte *data; + bfd_boolean relocatable; + asymbol **symbols; +{ + Elf_Internal_Shdr *symtab_hdr; + asection *input_section = link_order->u.indirect.section; + bfd *input_bfd = input_section->owner; + asection **sections = NULL; + Elf_Internal_Rela *internal_relocs = NULL; + Elf_Internal_Sym *isymbuf = NULL; + + /* We only need to handle the case of relaxing, or of having a + particular set of section contents, specially. */ + if (relocatable + || elf_section_data (input_section)->this_hdr.contents == NULL) + return bfd_generic_get_relocated_section_contents (output_bfd, link_info, + link_order, data, + relocatable, + symbols); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + + memcpy (data, elf_section_data (input_section)->this_hdr.contents, + (size_t) input_section->_raw_size); + + if ((input_section->flags & SEC_RELOC) != 0 + && input_section->reloc_count > 0) + { + Elf_Internal_Sym *isym; + Elf_Internal_Sym *isymend; + asection **secpp; + bfd_size_type amt; + + internal_relocs = (_bfd_elf_link_read_relocs + (input_bfd, input_section, (PTR) NULL, + (Elf_Internal_Rela *) NULL, FALSE)); + if (internal_relocs == NULL) + goto error_return; + + if (symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + amt = symtab_hdr->sh_info; + amt *= sizeof (asection *); + sections = (asection **) bfd_malloc (amt); + if (sections == NULL && amt != 0) + goto error_return; + + isymend = isymbuf + symtab_hdr->sh_info; + for (isym = isymbuf, secpp = sections; isym < isymend; ++isym, ++secpp) + { + asection *isec; + + if (isym->st_shndx == SHN_UNDEF) + isec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + isec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + isec = bfd_com_section_ptr; + else + isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx); + + *secpp = isec; + } + + if (! mn10200_elf_relocate_section (output_bfd, link_info, input_bfd, + input_section, data, internal_relocs, + isymbuf, sections)) + goto error_return; + + if (sections != NULL) + free (sections); + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (elf_section_data (input_section)->relocs != internal_relocs) + free (internal_relocs); + } + + return data; + + error_return: + if (sections != NULL) + free (sections); + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (internal_relocs != NULL + && elf_section_data (input_section)->relocs != internal_relocs) + free (internal_relocs); + return NULL; +} + +#define TARGET_LITTLE_SYM bfd_elf32_mn10200_vec +#define TARGET_LITTLE_NAME "elf32-mn10200" +#define ELF_ARCH bfd_arch_mn10200 +#define ELF_MACHINE_CODE EM_MN10200 +#define ELF_MACHINE_ALT1 EM_CYGNUS_MN10200 +#define ELF_MAXPAGESIZE 0x1000 + +#define elf_backend_rela_normal 1 +#define elf_info_to_howto mn10200_info_to_howto +#define elf_info_to_howto_rel 0 +#define elf_backend_relocate_section mn10200_elf_relocate_section +#define bfd_elf32_bfd_relax_section mn10200_elf_relax_section +#define bfd_elf32_bfd_get_relocated_section_contents \ + mn10200_elf_get_relocated_section_contents + +#define elf_symbol_leading_char '_' + +#include "elf32-target.h" diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c new file mode 100644 index 0000000000000..c64d34f4e258f --- /dev/null +++ b/bfd/elf-m10300.c @@ -0,0 +1,4886 @@ +/* Matsushita 10300 specific support for 32-bit ELF + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/mn10300.h" + +static bfd_reloc_status_type mn10300_elf_final_link_relocate + PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *, + bfd_vma, bfd_vma, bfd_vma, + struct elf_link_hash_entry *, unsigned long, struct bfd_link_info *, + asection *, int)); +static bfd_boolean mn10300_elf_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static bfd_boolean mn10300_elf_relax_section + PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); +static bfd_byte * mn10300_elf_get_relocated_section_contents + PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, bfd_boolean, asymbol **)); +static unsigned long elf_mn10300_mach + PARAMS ((flagword)); +void _bfd_mn10300_elf_final_write_processing + PARAMS ((bfd *, bfd_boolean)); +bfd_boolean _bfd_mn10300_elf_object_p + PARAMS ((bfd *)); +bfd_boolean _bfd_mn10300_elf_merge_private_bfd_data + PARAMS ((bfd *,bfd *)); + +/* The mn10300 linker needs to keep track of the number of relocs that + it decides to copy in check_relocs for each symbol. This is so + that it can discard PC relative relocs if it doesn't need them when + linking with -Bsymbolic. We store the information in a field + extending the regular ELF linker hash table. */ + +/* This structure keeps track of the number of PC relative relocs we + have copied for a given symbol. */ + +struct elf_mn10300_pcrel_relocs_copied +{ + /* Next section. */ + struct elf_mn10300_pcrel_relocs_copied * next; + /* A section in dynobj. */ + asection * section; + /* Number of relocs copied in this section. */ + bfd_size_type count; +}; + +struct elf32_mn10300_link_hash_entry { + /* The basic elf link hash table entry. */ + struct elf_link_hash_entry root; + + /* For function symbols, the number of times this function is + called directly (ie by name). */ + unsigned int direct_calls; + + /* For function symbols, the size of this function's stack + (if <= 255 bytes). We stuff this into "call" instructions + to this target when it's valid and profitable to do so. + + This does not include stack allocated by movm! */ + unsigned char stack_size; + + /* For function symbols, arguments (if any) for movm instruction + in the prologue. We stuff this value into "call" instructions + to the target when it's valid and profitable to do so. */ + unsigned char movm_args; + + /* For function symbols, the amount of stack space that would be allocated + by the movm instruction. This is redundant with movm_args, but we + add it to the hash table to avoid computing it over and over. */ + unsigned char movm_stack_size; + + /* Number of PC relative relocs copied for this symbol. */ + struct elf_mn10300_pcrel_relocs_copied * pcrel_relocs_copied; + +/* When set, convert all "call" instructions to this target into "calls" + instructions. */ +#define MN10300_CONVERT_CALL_TO_CALLS 0x1 + +/* Used to mark functions which have had redundant parts of their + prologue deleted. */ +#define MN10300_DELETED_PROLOGUE_BYTES 0x2 + unsigned char flags; +}; + +/* We derive a hash table from the main elf linker hash table so + we can store state variables and a secondary hash table without + resorting to global variables. */ +struct elf32_mn10300_link_hash_table { + /* The main hash table. */ + struct elf_link_hash_table root; + + /* A hash table for static functions. We could derive a new hash table + instead of using the full elf32_mn10300_link_hash_table if we wanted + to save some memory. */ + struct elf32_mn10300_link_hash_table *static_hash_table; + + /* Random linker state flags. */ +#define MN10300_HASH_ENTRIES_INITIALIZED 0x1 + char flags; +}; + +/* For MN10300 linker hash table. */ + +/* Get the MN10300 ELF linker hash table from a link_info structure. */ + +#define elf32_mn10300_hash_table(p) \ + ((struct elf32_mn10300_link_hash_table *) ((p)->hash)) + +#define elf32_mn10300_link_hash_traverse(table, func, info) \ + (elf_link_hash_traverse \ + (&(table)->root, \ + (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ + (info))) + +static struct bfd_hash_entry *elf32_mn10300_link_hash_newfunc + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +static struct bfd_link_hash_table *elf32_mn10300_link_hash_table_create + PARAMS ((bfd *)); +static void elf32_mn10300_link_hash_table_free + PARAMS ((struct bfd_link_hash_table *)); + +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void mn10300_info_to_howto + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static bfd_boolean mn10300_elf_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static asection *mn10300_elf_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *info, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static bfd_boolean mn10300_elf_relax_delete_bytes + PARAMS ((bfd *, asection *, bfd_vma, int)); +static bfd_boolean mn10300_elf_symbol_address_p + PARAMS ((bfd *, asection *, Elf_Internal_Sym *, bfd_vma)); +static bfd_boolean elf32_mn10300_finish_hash_table_entry + PARAMS ((struct bfd_hash_entry *, PTR)); +static void compute_function_info + PARAMS ((bfd *, struct elf32_mn10300_link_hash_entry *, + bfd_vma, unsigned char *)); + +static bfd_boolean _bfd_mn10300_elf_create_got_section + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean _bfd_mn10300_elf_create_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean _bfd_mn10300_elf_adjust_dynamic_symbol + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); +static bfd_boolean _bfd_mn10300_elf_discard_copies + PARAMS ((struct elf32_mn10300_link_hash_entry *, + struct bfd_link_info *)); +static bfd_boolean _bfd_mn10300_elf_size_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean _bfd_mn10300_elf_finish_dynamic_symbol + PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *)); +static bfd_boolean _bfd_mn10300_elf_finish_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + +static reloc_howto_type elf_mn10300_howto_table[] = { + /* Dummy relocation. Does nothing. */ + HOWTO (R_MN10300_NONE, + 0, + 2, + 16, + FALSE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_NONE", + FALSE, + 0, + 0, + FALSE), + /* Standard 32 bit reloc. */ + HOWTO (R_MN10300_32, + 0, + 2, + 32, + FALSE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_32", + FALSE, + 0xffffffff, + 0xffffffff, + FALSE), + /* Standard 16 bit reloc. */ + HOWTO (R_MN10300_16, + 0, + 1, + 16, + FALSE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_16", + FALSE, + 0xffff, + 0xffff, + FALSE), + /* Standard 8 bit reloc. */ + HOWTO (R_MN10300_8, + 0, + 0, + 8, + FALSE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_8", + FALSE, + 0xff, + 0xff, + FALSE), + /* Standard 32bit pc-relative reloc. */ + HOWTO (R_MN10300_PCREL32, + 0, + 2, + 32, + TRUE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_PCREL32", + FALSE, + 0xffffffff, + 0xffffffff, + TRUE), + /* Standard 16bit pc-relative reloc. */ + HOWTO (R_MN10300_PCREL16, + 0, + 1, + 16, + TRUE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_PCREL16", + FALSE, + 0xffff, + 0xffff, + TRUE), + /* Standard 8 pc-relative reloc. */ + HOWTO (R_MN10300_PCREL8, + 0, + 0, + 8, + TRUE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_PCREL8", + FALSE, + 0xff, + 0xff, + TRUE), + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_MN10300_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_MN10300_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_MN10300_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_MN10300_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Standard 24 bit reloc. */ + HOWTO (R_MN10300_24, + 0, + 2, + 24, + FALSE, + 0, + complain_overflow_bitfield, + bfd_elf_generic_reloc, + "R_MN10300_24", + FALSE, + 0xffffff, + 0xffffff, + FALSE), + HOWTO (R_MN10300_GOTPC32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_GOTPC32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MN10300_GOTPC16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_GOTPC16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MN10300_GOTOFF32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_GOTOFF32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MN10300_GOTOFF24, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_GOTOFF24", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MN10300_GOTOFF16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_GOTOFF16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MN10300_PLT32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_PLT32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MN10300_PLT16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_PLT16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MN10300_GOT32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_GOT32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MN10300_GOT24, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_GOT24", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MN10300_GOT16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_GOT16", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MN10300_COPY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_COPY", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MN10300_GLOB_DAT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_GLOB_DAT", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MN10300_JMP_SLOT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_JMP_SLOT", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MN10300_RELATIVE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_MN10300_RELATIVE", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + +}; + +struct mn10300_reloc_map { + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +static const struct mn10300_reloc_map mn10300_reloc_map[] = { + { BFD_RELOC_NONE, R_MN10300_NONE, }, + { BFD_RELOC_32, R_MN10300_32, }, + { BFD_RELOC_16, R_MN10300_16, }, + { BFD_RELOC_8, R_MN10300_8, }, + { BFD_RELOC_32_PCREL, R_MN10300_PCREL32, }, + { BFD_RELOC_16_PCREL, R_MN10300_PCREL16, }, + { BFD_RELOC_8_PCREL, R_MN10300_PCREL8, }, + { BFD_RELOC_24, R_MN10300_24, }, + { BFD_RELOC_VTABLE_INHERIT, R_MN10300_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_MN10300_GNU_VTENTRY }, + { BFD_RELOC_32_GOT_PCREL, R_MN10300_GOTPC32 }, + { BFD_RELOC_16_GOT_PCREL, R_MN10300_GOTPC16 }, + { BFD_RELOC_32_GOTOFF, R_MN10300_GOTOFF32 }, + { BFD_RELOC_MN10300_GOTOFF24, R_MN10300_GOTOFF24 }, + { BFD_RELOC_16_GOTOFF, R_MN10300_GOTOFF16 }, + { BFD_RELOC_32_PLT_PCREL, R_MN10300_PLT32 }, + { BFD_RELOC_16_PLT_PCREL, R_MN10300_PLT16 }, + { BFD_RELOC_MN10300_GOT32, R_MN10300_GOT32 }, + { BFD_RELOC_MN10300_GOT24, R_MN10300_GOT24 }, + { BFD_RELOC_MN10300_GOT16, R_MN10300_GOT16 }, + { BFD_RELOC_MN10300_COPY, R_MN10300_COPY }, + { BFD_RELOC_MN10300_GLOB_DAT, R_MN10300_GLOB_DAT }, + { BFD_RELOC_MN10300_JMP_SLOT, R_MN10300_JMP_SLOT }, + { BFD_RELOC_MN10300_RELATIVE, R_MN10300_RELATIVE }, +}; + +/* Create the GOT section. */ + +static bfd_boolean +_bfd_mn10300_elf_create_got_section (abfd, info) + bfd * abfd; + struct bfd_link_info * info; +{ + flagword flags; + flagword pltflags; + asection * s; + struct bfd_link_hash_entry * bh; + struct elf_link_hash_entry * h; + const struct elf_backend_data * bed = get_elf_backend_data (abfd); + int ptralign; + + /* This function may be called more than once. */ + if (bfd_get_section_by_name (abfd, ".got") != NULL) + return TRUE; + + switch (bed->s->arch_size) + { + case 32: + ptralign = 2; + break; + + case 64: + ptralign = 3; + break; + + default: + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + + pltflags = flags; + pltflags |= SEC_CODE; + if (bed->plt_not_loaded) + pltflags &= ~ (SEC_LOAD | SEC_HAS_CONTENTS); + if (bed->plt_readonly) + pltflags |= SEC_READONLY; + + s = bfd_make_section (abfd, ".plt"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, pltflags) + || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + return FALSE; + + if (bed->want_plt_sym) + { + /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the + .plt section. */ + bh = NULL; + if (! (_bfd_generic_link_add_one_symbol + (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s, + (bfd_vma) 0, (const char *) NULL, FALSE, + get_elf_backend_data (abfd)->collect, &bh))) + return FALSE; + h = (struct elf_link_hash_entry *) bh; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; + + if (info->shared + && ! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = bfd_make_section (abfd, ".got"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + + if (bed->want_got_plt) + { + s = bfd_make_section (abfd, ".got.plt"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + } + + /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got + (or .got.plt) section. We don't do this in the linker script + because we don't want to define the symbol if we are not creating + a global offset table. */ + bh = NULL; + if (!(_bfd_generic_link_add_one_symbol + (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s, + bed->got_symbol_offset, (const char *) NULL, FALSE, + bed->collect, &bh))) + return FALSE; + h = (struct elf_link_hash_entry *) bh; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; + + if (info->shared + && ! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + + elf_hash_table (info)->hgot = h; + + /* The first bit of the global offset table is the header. */ + s->_raw_size += bed->got_header_size + bed->got_symbol_offset; + + return TRUE; +} + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; + i < sizeof (mn10300_reloc_map) / sizeof (struct mn10300_reloc_map); + i++) + { + if (mn10300_reloc_map[i].bfd_reloc_val == code) + return &elf_mn10300_howto_table[mn10300_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Set the howto pointer for an MN10300 ELF reloc. */ + +static void +mn10300_info_to_howto (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_MN10300_MAX); + cache_ptr->howto = &elf_mn10300_howto_table[r_type]; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static bfd_boolean +mn10300_elf_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + bfd * dynobj; + bfd_vma * local_got_offsets; + asection * sgot; + asection * srelgot; + asection * sreloc; + + sgot = NULL; + srelgot = NULL; + sreloc = NULL; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + dynobj = elf_hash_table (info)->dynobj; + local_got_offsets = elf_local_got_offsets (abfd); + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + /* Some relocs require a global offset table. */ + if (dynobj == NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_MN10300_GOT32: + case R_MN10300_GOT24: + case R_MN10300_GOT16: + case R_MN10300_GOTOFF32: + case R_MN10300_GOTOFF24: + case R_MN10300_GOTOFF16: + case R_MN10300_GOTPC32: + case R_MN10300_GOTPC16: + elf_hash_table (info)->dynobj = dynobj = abfd; + if (! _bfd_mn10300_elf_create_got_section (dynobj, info)) + return FALSE; + break; + + default: + break; + } + } + + switch (ELF32_R_TYPE (rel->r_info)) + { + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_MN10300_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_MN10300_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + case R_MN10300_GOT32: + case R_MN10300_GOT24: + case R_MN10300_GOT16: + /* This symbol requires a global offset table entry. */ + + if (sgot == NULL) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + } + + if (srelgot == NULL + && (h != NULL || info->shared)) + { + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + if (srelgot == NULL) + { + srelgot = bfd_make_section (dynobj, ".rela.got"); + if (srelgot == NULL + || ! bfd_set_section_flags (dynobj, srelgot, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || ! bfd_set_section_alignment (dynobj, srelgot, 2)) + return FALSE; + } + } + + if (h != NULL) + { + if (h->got.offset != (bfd_vma) -1) + /* We have already allocated space in the .got. */ + break; + + h->got.offset = sgot->_raw_size; + + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + else + { + /* This is a global offset table entry for a local + symbol. */ + if (local_got_offsets == NULL) + { + size_t size; + unsigned int i; + + size = symtab_hdr->sh_info * sizeof (bfd_vma); + local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size); + + if (local_got_offsets == NULL) + return FALSE; + elf_local_got_offsets (abfd) = local_got_offsets; + + for (i = 0; i < symtab_hdr->sh_info; i++) + local_got_offsets[i] = (bfd_vma) -1; + } + + if (local_got_offsets[r_symndx] != (bfd_vma) -1) + /* We have already allocated space in the .got. */ + break; + + local_got_offsets[r_symndx] = sgot->_raw_size; + + if (info->shared) + /* If we are generating a shared object, we need to + output a R_MN10300_RELATIVE reloc so that the dynamic + linker can adjust this GOT entry. */ + srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + + sgot->_raw_size += 4; + + break; + + case R_MN10300_PLT32: + case R_MN10300_PLT16: + /* This symbol requires a procedure linkage table entry. We + actually build the entry in adjust_dynamic_symbol, + because this might be a case of linking PIC code which is + never referenced by a dynamic object, in which case we + don't need to generate a procedure linkage table entry + after all. */ + + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + if (h == NULL) + continue; + + if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) + break; + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + + break; + + case R_MN10300_32: + case R_MN10300_24: + case R_MN10300_16: + case R_MN10300_8: + case R_MN10300_PCREL32: + case R_MN10300_PCREL16: + case R_MN10300_PCREL8: + if (h != NULL) + h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + + /* If we are creating a shared library, and this is a reloc + against a global symbol, or a non PC relative reloc + against a local symbol, then we need to copy the reloc + into the shared library. However, if we are linking with + -Bsymbolic, we do not need to copy a reloc against a + global symbol which is defined in an object we are + including in the link (i.e., DEF_REGULAR is set). At + this point we have not seen all the input files, so it is + possible that DEF_REGULAR is not set now but will be set + later (it is never cleared). We account for that + possibility below by storing information in the + pcrel_relocs_copied field of the hash table entry. */ + if (info->shared + && (sec->flags & SEC_ALLOC) != 0 + && (! (elf_mn10300_howto_table[ELF32_R_TYPE (rel->r_info)] + .pc_relative) + || (h != NULL + && (! info->symbolic + || h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + { + /* When creating a shared object, we must copy these + reloc types into the output file. We create a reloc + section in dynobj and make room for this reloc. */ + if (sreloc == NULL) + { + const char * name; + + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) + { + flagword flags; + + sreloc = bfd_make_section (dynobj, name); + flags = (SEC_HAS_CONTENTS | SEC_READONLY + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if ((sec->flags & SEC_ALLOC) != 0) + flags |= SEC_ALLOC | SEC_LOAD; + if (sreloc == NULL + || ! bfd_set_section_flags (dynobj, sreloc, flags) + || ! bfd_set_section_alignment (dynobj, sreloc, 2)) + return FALSE; + } + } + + sreloc->_raw_size += sizeof (Elf32_External_Rela); + + /* If we are linking with -Bsymbolic, and this is a + global symbol, we count the number of PC relative + relocations we have entered for this symbol, so that + we can discard them again if the symbol is later + defined by a regular object. Note that this function + is only called if we are using an elf_sh linker + hash table, which means that h is really a pointer to + an elf32_mn10300_link_hash_entry. */ + if (h != NULL + && (elf_mn10300_howto_table[ELF32_R_TYPE (rel->r_info)] + .pc_relative)) + { + struct elf32_mn10300_link_hash_entry *eh; + struct elf_mn10300_pcrel_relocs_copied *p; + + eh = (struct elf32_mn10300_link_hash_entry *) h; + + for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next) + if (p->section == sreloc) + break; + + if (p == NULL) + { + p = ((struct elf_mn10300_pcrel_relocs_copied *) + bfd_alloc (dynobj, sizeof *p)); + if (p == NULL) + return FALSE; + + p->next = eh->pcrel_relocs_copied; + eh->pcrel_relocs_copied = p; + p->section = sreloc; + p->count = 0; + } + + ++p->count; + } + } + + break; + } + } + + return TRUE; +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +mn10300_elf_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_MN10300_GNU_VTINHERIT: + case R_MN10300_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Perform a relocation as part of a final link. */ +static bfd_reloc_status_type +mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd, + input_section, contents, offset, value, + addend, h, symndx, info, sym_sec, is_local) + reloc_howto_type *howto; + bfd *input_bfd; + bfd *output_bfd ATTRIBUTE_UNUSED; + asection *input_section; + bfd_byte *contents; + bfd_vma offset; + bfd_vma value; + bfd_vma addend; + struct elf_link_hash_entry * h; + unsigned long symndx; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sym_sec ATTRIBUTE_UNUSED; + int is_local ATTRIBUTE_UNUSED; +{ + unsigned long r_type = howto->type; + bfd_byte *hit_data = contents + offset; + bfd * dynobj; + bfd_vma * local_got_offsets; + asection * sgot; + asection * splt; + asection * sreloc; + + dynobj = elf_hash_table (info)->dynobj; + local_got_offsets = elf_local_got_offsets (input_bfd); + + sgot = NULL; + splt = NULL; + sreloc = NULL; + + switch (r_type) + { + case R_MN10300_NONE: + return bfd_reloc_ok; + + case R_MN10300_32: + if (info->shared + && (input_section->flags & SEC_ALLOC) != 0) + { + Elf_Internal_Rela outrel; + bfd_boolean skip, relocate; + + /* When generating a shared object, these relocations are + copied into the output file to be resolved at run + time. */ + if (sreloc == NULL) + { + const char * name; + + name = (bfd_elf_string_from_elf_section + (input_bfd, + elf_elfheader (input_bfd)->e_shstrndx, + elf_section_data (input_section)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (input_bfd, + input_section), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + BFD_ASSERT (sreloc != NULL); + } + + skip = FALSE; + + if (elf_section_data (input_section)->sec_info == NULL + || (input_section->sec_info_type != ELF_INFO_TYPE_STABS)) + outrel.r_offset = offset; + else + { + bfd_vma off; + + off = (_bfd_stab_section_offset + (output_bfd, & elf_hash_table (info)->stab_info, + input_section, + & elf_section_data (input_section)->sec_info, + offset)); + if (off == (bfd_vma) -1) + skip = TRUE; + outrel.r_offset = off; + } + + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + { + memset (&outrel, 0, sizeof outrel); + relocate = FALSE; + } + else + { + /* h->dynindx may be -1 if this symbol was marked to + become local. */ + if (h == NULL + || ((info->symbolic || h->dynindx == -1) + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) != 0)) + { + relocate = TRUE; + outrel.r_info = ELF32_R_INFO (0, R_MN10300_RELATIVE); + outrel.r_addend = value + addend; + } + else + { + BFD_ASSERT (h->dynindx != -1); + relocate = FALSE; + outrel.r_info = ELF32_R_INFO (h->dynindx, R_MN10300_32); + outrel.r_addend = value + addend; + } + } + + bfd_elf32_swap_reloca_out (output_bfd, &outrel, + (bfd_byte *) (((Elf32_External_Rela *) sreloc->contents) + + sreloc->reloc_count)); + ++sreloc->reloc_count; + + /* If this reloc is against an external symbol, we do + not want to fiddle with the addend. Otherwise, we + need to include the symbol value so that it becomes + an addend for the dynamic reloc. */ + if (! relocate) + return bfd_reloc_ok; + } + value += addend; + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_24: + value += addend; + + if ((long) value > 0x7fffff || (long) value < -0x800000) + return bfd_reloc_overflow; + + bfd_put_8 (input_bfd, value & 0xff, hit_data); + bfd_put_8 (input_bfd, (value >> 8) & 0xff, hit_data + 1); + bfd_put_8 (input_bfd, (value >> 16) & 0xff, hit_data + 2); + return bfd_reloc_ok; + + case R_MN10300_16: + value += addend; + + if ((long) value > 0x7fff || (long) value < -0x8000) + return bfd_reloc_overflow; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_8: + value += addend; + + if ((long) value > 0x7f || (long) value < -0x80) + return bfd_reloc_overflow; + + bfd_put_8 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_PCREL8: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + if ((long) value > 0xff || (long) value < -0x100) + return bfd_reloc_overflow; + + bfd_put_8 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_PCREL16: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + if ((long) value > 0xffff || (long) value < -0x10000) + return bfd_reloc_overflow; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_PCREL32: + if (info->shared + && (input_section->flags & SEC_ALLOC) != 0 + && h != NULL + && h->dynindx != -1 + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + { + Elf_Internal_Rela outrel; + bfd_boolean skip; + + /* When generating a shared object, these relocations + are copied into the output file to be resolved at run + time. */ + + if (sreloc == NULL) + { + const char * name; + + name = (bfd_elf_string_from_elf_section + (input_bfd, + elf_elfheader (input_bfd)->e_shstrndx, + elf_section_data (input_section)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (input_bfd, + input_section), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + BFD_ASSERT (sreloc != NULL); + } + + skip = FALSE; + + if (elf_section_data (input_section)->sec_info == NULL + || (input_section->sec_info_type != ELF_INFO_TYPE_STABS)) + outrel.r_offset = offset; + else + { + bfd_vma off; + + off = (_bfd_stab_section_offset + (output_bfd, & elf_hash_table (info)->stab_info, + input_section, + & elf_section_data (input_section)->sec_info, + offset)); + if (off == (bfd_vma) -1) + skip = TRUE; + outrel.r_offset = off; + } + + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + else + { + BFD_ASSERT (h != NULL && h->dynindx != -1); + outrel.r_info = ELF32_R_INFO (h->dynindx, R_MN10300_PCREL32); + outrel.r_addend = addend; + } + + bfd_elf32_swap_reloca_out (output_bfd, &outrel, + (bfd_byte *) (((Elf32_External_Rela *) + sreloc->contents) + + sreloc->reloc_count)); + ++sreloc->reloc_count; + + return bfd_reloc_ok; + } + + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_GNU_VTINHERIT: + case R_MN10300_GNU_VTENTRY: + return bfd_reloc_ok; + + case R_MN10300_GOTPC32: + /* Use global offset table as symbol value. */ + + value = bfd_get_section_by_name (dynobj, + ".got")->output_section->vma; + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_GOTPC16: + /* Use global offset table as symbol value. */ + + value = bfd_get_section_by_name (dynobj, + ".got")->output_section->vma; + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + if ((long) value > 0xffff || (long) value < -0x10000) + return bfd_reloc_overflow; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_GOTOFF32: + value -= bfd_get_section_by_name (dynobj, + ".got")->output_section->vma; + value += addend; + + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_GOTOFF24: + value -= bfd_get_section_by_name (dynobj, + ".got")->output_section->vma; + value += addend; + + if ((long) value > 0x7fffff || (long) value < -0x800000) + return bfd_reloc_overflow; + + bfd_put_8 (input_bfd, value, hit_data); + bfd_put_8 (input_bfd, (value >> 8) & 0xff, hit_data + 1); + bfd_put_8 (input_bfd, (value >> 16) & 0xff, hit_data + 2); + return bfd_reloc_ok; + + case R_MN10300_GOTOFF16: + value -= bfd_get_section_by_name (dynobj, + ".got")->output_section->vma; + value += addend; + + if ((long) value > 0xffff || (long) value < -0x10000) + return bfd_reloc_overflow; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_PLT32: + if (h != NULL + && ELF_ST_VISIBILITY (h->other) != STV_INTERNAL + && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN + && h->plt.offset != (bfd_vma) -1) + { + asection * splt; + + splt = bfd_get_section_by_name (dynobj, ".plt"); + + value = (splt->output_section->vma + + splt->output_offset + + h->plt.offset) - value; + } + + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_PLT16: + if (h != NULL + && ELF_ST_VISIBILITY (h->other) != STV_INTERNAL + && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN + && h->plt.offset != (bfd_vma) -1) + { + asection * splt; + + splt = bfd_get_section_by_name (dynobj, ".plt"); + + value = (splt->output_section->vma + + splt->output_offset + + h->plt.offset) - value; + } + + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + if ((long) value > 0xffff || (long) value < -0x10000) + return bfd_reloc_overflow; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_MN10300_GOT32: + case R_MN10300_GOT24: + case R_MN10300_GOT16: + { + asection * sgot; + + sgot = bfd_get_section_by_name (dynobj, ".got"); + + if (h != NULL) + { + bfd_vma off; + + off = h->got.offset; + BFD_ASSERT (off != (bfd_vma) -1); + + if (! elf_hash_table (info)->dynamic_sections_created + || (info->shared + && (info->symbolic || h->dynindx == -1) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + /* This is actually a static link, or it is a + -Bsymbolic link and the symbol is defined + locally, or the symbol was forced to be local + because of a version file. We must initialize + this entry in the global offset table. + + When doing a dynamic link, we create a .rela.got + relocation entry to initialize the value. This + is done in the finish_dynamic_symbol routine. */ + bfd_put_32 (output_bfd, value, + sgot->contents + off); + + value = sgot->output_offset + off; + } + else + { + bfd_vma off; + + off = elf_local_got_offsets (input_bfd)[symndx]; + + bfd_put_32 (output_bfd, value, sgot->contents + off); + + if (info->shared) + { + asection * srelgot; + Elf_Internal_Rela outrel; + + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (srelgot != NULL); + + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + off); + outrel.r_info = ELF32_R_INFO (0, R_MN10300_RELATIVE); + outrel.r_addend = value; + bfd_elf32_swap_reloca_out (output_bfd, &outrel, + (bfd_byte *) (((Elf32_External_Rela *) + srelgot->contents) + + srelgot->reloc_count)); + ++ srelgot->reloc_count; + } + + value = sgot->output_offset + off; + } + } + + value += addend; + + if (r_type == R_MN10300_GOT32) + { + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + } + else if (r_type == R_MN10300_GOT24) + { + if ((long) value > 0x7fffff || (long) value < -0x800000) + return bfd_reloc_overflow; + + bfd_put_8 (input_bfd, value & 0xff, hit_data); + bfd_put_8 (input_bfd, (value >> 8) & 0xff, hit_data + 1); + bfd_put_8 (input_bfd, (value >> 16) & 0xff, hit_data + 2); + return bfd_reloc_ok; + } + else if (r_type == R_MN10300_GOT16) + { + if ((long) value > 0xffff || (long) value < -0x10000) + return bfd_reloc_overflow; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + } + /* Fall through. */ + + default: + return bfd_reloc_notsupported; + } +} + +/* Relocate an MN10300 ELF section. */ +static bfd_boolean +mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf32_mn10300_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + howto = elf_mn10300_howto_table + r_type; + + /* Just skip the vtable gc relocs. */ + if (r_type == R_MN10300_GNU_VTINHERIT + || r_type == R_MN10300_GNU_VTENTRY) + continue; + + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { + bfd_boolean unresolved_reloc; + bfd_boolean warned; + struct elf_link_hash_entry *hh; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + hh, sec, relocation, + unresolved_reloc, warned); + + h = (struct elf32_mn10300_link_hash_entry *) hh; + + if ((h->root.root.type == bfd_link_hash_defined + || h->root.root.type == bfd_link_hash_defweak) + && ( r_type == R_MN10300_GOTPC32 + || r_type == R_MN10300_GOTPC16 + || (( r_type == R_MN10300_PLT32 + || r_type == R_MN10300_PLT16) + && ELF_ST_VISIBILITY (h->root.other) != STV_INTERNAL + && ELF_ST_VISIBILITY (h->root.other) != STV_HIDDEN + && h->root.plt.offset != (bfd_vma) -1) + || (( r_type == R_MN10300_GOT32 + || r_type == R_MN10300_GOT24 + || r_type == R_MN10300_GOT16) + && elf_hash_table (info)->dynamic_sections_created + && (! info->shared + || (! info->symbolic && h->root.dynindx != -1) + || (h->root.elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + || (info->shared + && ((! info->symbolic && h->root.dynindx != -1) + || (h->root.elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) + && ( r_type == R_MN10300_32 + || r_type == R_MN10300_PCREL32) + && ((input_section->flags & SEC_ALLOC) != 0 + /* DWARF will emit R_MN10300_32 relocations + in its sections against symbols defined + externally in shared libraries. We can't + do anything with them here. */ + || ((input_section->flags & SEC_DEBUGGING) != 0 + && (h->root.elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0))))) + /* In these cases, we don't need the relocation + value. We check specially because in some + obscure cases sec->output_section will be NULL. */ + relocation = 0; + + else if (unresolved_reloc) + (*_bfd_error_handler) + (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), + bfd_get_filename (input_bfd), h->root.root.root.string, + bfd_get_section_name (input_bfd, input_section)); + } + + r = mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd, + input_section, + contents, rel->r_offset, + relocation, rel->r_addend, + (struct elf_link_hash_entry *)h, + r_symndx, + info, sec, h == NULL); + + if (r != bfd_reloc_ok) + { + const char *name; + const char *msg = (const char *) 0; + + if (h != NULL) + name = h->root.root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL || *name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + switch (r) + { + case bfd_reloc_overflow: + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return FALSE; + break; + + case bfd_reloc_undefined: + if (! ((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, + rel->r_offset, TRUE))) + return FALSE; + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + goto common_error; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + goto common_error; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous error"); + goto common_error; + + default: + msg = _("internal error: unknown error"); + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, msg, name, input_bfd, input_section, + rel->r_offset))) + return FALSE; + break; + } + } + } + + return TRUE; +} + +/* Finish initializing one hash table entry. */ +static bfd_boolean +elf32_mn10300_finish_hash_table_entry (gen_entry, in_args) + struct bfd_hash_entry *gen_entry; + PTR in_args ATTRIBUTE_UNUSED; +{ + struct elf32_mn10300_link_hash_entry *entry; + unsigned int byte_count = 0; + + entry = (struct elf32_mn10300_link_hash_entry *) gen_entry; + + if (entry->root.root.type == bfd_link_hash_warning) + entry = (struct elf32_mn10300_link_hash_entry *) entry->root.root.u.i.link; + + /* If we already know we want to convert "call" to "calls" for calls + to this symbol, then return now. */ + if (entry->flags == MN10300_CONVERT_CALL_TO_CALLS) + return TRUE; + + /* If there are no named calls to this symbol, or there's nothing we + can move from the function itself into the "call" instruction, then + note that all "call" instructions should be converted into "calls" + instructions and return. */ + if (entry->direct_calls == 0 + || (entry->stack_size == 0 && entry->movm_args == 0)) + { + /* Make a note that we should convert "call" instructions to "calls" + instructions for calls to this symbol. */ + entry->flags |= MN10300_CONVERT_CALL_TO_CALLS; + return TRUE; + } + + /* We may be able to move some instructions from the function itself into + the "call" instruction. Count how many bytes we might be able to + eliminate in the function itself. */ + + /* A movm instruction is two bytes. */ + if (entry->movm_args) + byte_count += 2; + + /* Count the insn to allocate stack space too. */ + if (entry->stack_size > 0) + { + if (entry->stack_size <= 128) + byte_count += 3; + else + byte_count += 4; + } + + /* If using "call" will result in larger code, then turn all + the associated "call" instructions into "calls" instructions. */ + if (byte_count < entry->direct_calls) + entry->flags |= MN10300_CONVERT_CALL_TO_CALLS; + + /* This routine never fails. */ + return TRUE; +} + +/* This function handles relaxing for the mn10300. + + There are quite a few relaxing opportunities available on the mn10300: + + * calls:32 -> calls:16 2 bytes + * call:32 -> call:16 2 bytes + + * call:32 -> calls:32 1 byte + * call:16 -> calls:16 1 byte + * These are done anytime using "calls" would result + in smaller code, or when necessary to preserve the + meaning of the program. + + * call:32 varies + * call:16 + * In some circumstances we can move instructions + from a function prologue into a "call" instruction. + This is only done if the resulting code is no larger + than the original code. + + * jmp:32 -> jmp:16 2 bytes + * jmp:16 -> bra:8 1 byte + + * If the previous instruction is a conditional branch + around the jump/bra, we may be able to reverse its condition + and change its target to the jump's target. The jump/bra + can then be deleted. 2 bytes + + * mov abs32 -> mov abs16 1 or 2 bytes + + * Most instructions which accept imm32 can relax to imm16 1 or 2 bytes + - Most instructions which accept imm16 can relax to imm8 1 or 2 bytes + + * Most instructions which accept d32 can relax to d16 1 or 2 bytes + - Most instructions which accept d16 can relax to d8 1 or 2 bytes + + We don't handle imm16->imm8 or d16->d8 as they're very rare + and somewhat more difficult to support. */ + +static bfd_boolean +mn10300_elf_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + bfd_boolean *again; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *internal_relocs = NULL; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *contents = NULL; + Elf_Internal_Sym *isymbuf = NULL; + struct elf32_mn10300_link_hash_table *hash_table; + asection *section = sec; + + /* Assume nothing changes. */ + *again = FALSE; + + /* We need a pointer to the mn10300 specific hash table. */ + hash_table = elf32_mn10300_hash_table (link_info); + + /* Initialize fields in each hash table entry the first time through. */ + if ((hash_table->flags & MN10300_HASH_ENTRIES_INITIALIZED) == 0) + { + bfd *input_bfd; + + /* Iterate over all the input bfds. */ + for (input_bfd = link_info->input_bfds; + input_bfd != NULL; + input_bfd = input_bfd->link_next) + { + /* We're going to need all the symbols for each bfd. */ + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + if (symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + /* Iterate over each section in this bfd. */ + for (section = input_bfd->sections; + section != NULL; + section = section->next) + { + struct elf32_mn10300_link_hash_entry *hash; + Elf_Internal_Sym *sym; + asection *sym_sec = NULL; + const char *sym_name; + char *new_name; + + /* If there's nothing to do in this section, skip it. */ + if (! (((section->flags & SEC_RELOC) != 0 + && section->reloc_count != 0) + || (section->flags & SEC_CODE) != 0)) + continue; + + /* Get cached copy of section contents if it exists. */ + if (elf_section_data (section)->this_hdr.contents != NULL) + contents = elf_section_data (section)->this_hdr.contents; + else if (section->_raw_size != 0) + { + /* Go get them off disk. */ + contents = (bfd_byte *) bfd_malloc (section->_raw_size); + if (contents == NULL) + goto error_return; + + if (!bfd_get_section_contents (input_bfd, section, + contents, (file_ptr) 0, + section->_raw_size)) + goto error_return; + } + else + contents = NULL; + + /* If there aren't any relocs, then there's nothing to do. */ + if ((section->flags & SEC_RELOC) != 0 + && section->reloc_count != 0) + { + + /* Get a copy of the native relocations. */ + internal_relocs = (_bfd_elf_link_read_relocs + (input_bfd, section, (PTR) NULL, + (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + + /* Now examine each relocation. */ + irel = internal_relocs; + irelend = irel + section->reloc_count; + for (; irel < irelend; irel++) + { + long r_type; + unsigned long r_index; + unsigned char code; + + r_type = ELF32_R_TYPE (irel->r_info); + r_index = ELF32_R_SYM (irel->r_info); + + if (r_type < 0 || r_type >= (int) R_MN10300_MAX) + goto error_return; + + /* We need the name and hash table entry of the target + symbol! */ + hash = NULL; + sym = NULL; + sym_sec = NULL; + + if (r_index < symtab_hdr->sh_info) + { + /* A local symbol. */ + Elf_Internal_Sym *isym; + struct elf_link_hash_table *elftab; + bfd_size_type amt; + + isym = isymbuf + r_index; + if (isym->st_shndx == SHN_UNDEF) + sym_sec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + sym_sec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + sym_sec = bfd_com_section_ptr; + else + sym_sec + = bfd_section_from_elf_index (input_bfd, + isym->st_shndx); + + sym_name + = bfd_elf_string_from_elf_section (input_bfd, + (symtab_hdr + ->sh_link), + isym->st_name); + + /* If it isn't a function, then we don't care + about it. */ + if (ELF_ST_TYPE (isym->st_info) != STT_FUNC) + continue; + + /* Tack on an ID so we can uniquely identify this + local symbol in the global hash table. */ + amt = strlen (sym_name) + 10; + new_name = bfd_malloc (amt); + if (new_name == 0) + goto error_return; + + sprintf (new_name, "%s_%08x", + sym_name, (int) sym_sec); + sym_name = new_name; + + elftab = &hash_table->static_hash_table->root; + hash = ((struct elf32_mn10300_link_hash_entry *) + elf_link_hash_lookup (elftab, sym_name, + TRUE, TRUE, FALSE)); + free (new_name); + } + else + { + r_index -= symtab_hdr->sh_info; + hash = (struct elf32_mn10300_link_hash_entry *) + elf_sym_hashes (input_bfd)[r_index]; + } + + /* If this is not a "call" instruction, then we + should convert "call" instructions to "calls" + instructions. */ + code = bfd_get_8 (input_bfd, + contents + irel->r_offset - 1); + if (code != 0xdd && code != 0xcd) + hash->flags |= MN10300_CONVERT_CALL_TO_CALLS; + + /* If this is a jump/call, then bump the + direct_calls counter. Else force "call" to + "calls" conversions. */ + if (r_type == R_MN10300_PCREL32 + || r_type == R_MN10300_PLT32 + || r_type == R_MN10300_PLT16 + || r_type == R_MN10300_PCREL16) + hash->direct_calls++; + else + hash->flags |= MN10300_CONVERT_CALL_TO_CALLS; + } + } + + /* Now look at the actual contents to get the stack size, + and a list of what registers were saved in the prologue + (ie movm_args). */ + if ((section->flags & SEC_CODE) != 0) + { + Elf_Internal_Sym *isym, *isymend; + unsigned int sec_shndx; + struct elf_link_hash_entry **hashes; + struct elf_link_hash_entry **end_hashes; + unsigned int symcount; + + sec_shndx = _bfd_elf_section_from_bfd_section (input_bfd, + section); + + /* Look at each function defined in this section and + update info for that function. */ + isymend = isymbuf + symtab_hdr->sh_info; + for (isym = isymbuf; isym < isymend; isym++) + { + if (isym->st_shndx == sec_shndx + && ELF_ST_TYPE (isym->st_info) == STT_FUNC) + { + struct elf_link_hash_table *elftab; + bfd_size_type amt; + + if (isym->st_shndx == SHN_UNDEF) + sym_sec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + sym_sec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + sym_sec = bfd_com_section_ptr; + else + sym_sec + = bfd_section_from_elf_index (input_bfd, + isym->st_shndx); + + sym_name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, + isym->st_name)); + + /* Tack on an ID so we can uniquely identify this + local symbol in the global hash table. */ + amt = strlen (sym_name) + 10; + new_name = bfd_malloc (amt); + if (new_name == 0) + goto error_return; + + sprintf (new_name, "%s_%08x", + sym_name, (int) sym_sec); + sym_name = new_name; + + elftab = &hash_table->static_hash_table->root; + hash = ((struct elf32_mn10300_link_hash_entry *) + elf_link_hash_lookup (elftab, sym_name, + TRUE, TRUE, FALSE)); + free (new_name); + compute_function_info (input_bfd, hash, + isym->st_value, contents); + } + } + + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + hashes = elf_sym_hashes (input_bfd); + end_hashes = hashes + symcount; + for (; hashes < end_hashes; hashes++) + { + hash = (struct elf32_mn10300_link_hash_entry *) *hashes; + if ((hash->root.root.type == bfd_link_hash_defined + || hash->root.root.type == bfd_link_hash_defweak) + && hash->root.root.u.def.section == section + && ELF_ST_TYPE (isym->st_info) == STT_FUNC) + compute_function_info (input_bfd, hash, + (hash)->root.root.u.def.value, + contents); + } + } + + /* Cache or free any memory we allocated for the relocs. */ + if (internal_relocs != NULL + && elf_section_data (section)->relocs != internal_relocs) + free (internal_relocs); + internal_relocs = NULL; + + /* Cache or free any memory we allocated for the contents. */ + if (contents != NULL + && elf_section_data (section)->this_hdr.contents != contents) + { + if (! link_info->keep_memory) + free (contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (section)->this_hdr.contents = contents; + } + } + contents = NULL; + } + + /* Cache or free any memory we allocated for the symbols. */ + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + { + if (! link_info->keep_memory) + free (isymbuf); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) isymbuf; + } + } + isymbuf = NULL; + } + + /* Now iterate on each symbol in the hash table and perform + the final initialization steps on each. */ + elf32_mn10300_link_hash_traverse (hash_table, + elf32_mn10300_finish_hash_table_entry, + NULL); + elf32_mn10300_link_hash_traverse (hash_table->static_hash_table, + elf32_mn10300_finish_hash_table_entry, + NULL); + + /* All entries in the hash table are fully initialized. */ + hash_table->flags |= MN10300_HASH_ENTRIES_INITIALIZED; + + /* Now that everything has been initialized, go through each + code section and delete any prologue insns which will be + redundant because their operations will be performed by + a "call" instruction. */ + for (input_bfd = link_info->input_bfds; + input_bfd != NULL; + input_bfd = input_bfd->link_next) + { + /* We're going to need all the local symbols for each bfd. */ + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + if (symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + /* Walk over each section in this bfd. */ + for (section = input_bfd->sections; + section != NULL; + section = section->next) + { + unsigned int sec_shndx; + Elf_Internal_Sym *isym, *isymend; + struct elf_link_hash_entry **hashes; + struct elf_link_hash_entry **end_hashes; + unsigned int symcount; + + /* Skip non-code sections and empty sections. */ + if ((section->flags & SEC_CODE) == 0 || section->_raw_size == 0) + continue; + + if (section->reloc_count != 0) + { + /* Get a copy of the native relocations. */ + internal_relocs = (_bfd_elf_link_read_relocs + (input_bfd, section, (PTR) NULL, + (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + } + + /* Get cached copy of section contents if it exists. */ + if (elf_section_data (section)->this_hdr.contents != NULL) + contents = elf_section_data (section)->this_hdr.contents; + else + { + /* Go get them off disk. */ + contents = (bfd_byte *) bfd_malloc (section->_raw_size); + if (contents == NULL) + goto error_return; + + if (!bfd_get_section_contents (input_bfd, section, + contents, (file_ptr) 0, + section->_raw_size)) + goto error_return; + } + + sec_shndx = _bfd_elf_section_from_bfd_section (input_bfd, + section); + + /* Now look for any function in this section which needs + insns deleted from its prologue. */ + isymend = isymbuf + symtab_hdr->sh_info; + for (isym = isymbuf; isym < isymend; isym++) + { + struct elf32_mn10300_link_hash_entry *sym_hash; + asection *sym_sec = NULL; + const char *sym_name; + char *new_name; + struct elf_link_hash_table *elftab; + bfd_size_type amt; + + if (isym->st_shndx != sec_shndx) + continue; + + if (isym->st_shndx == SHN_UNDEF) + sym_sec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + sym_sec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + sym_sec = bfd_com_section_ptr; + else + sym_sec + = bfd_section_from_elf_index (input_bfd, isym->st_shndx); + + sym_name + = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + isym->st_name); + + /* Tack on an ID so we can uniquely identify this + local symbol in the global hash table. */ + amt = strlen (sym_name) + 10; + new_name = bfd_malloc (amt); + if (new_name == 0) + goto error_return; + sprintf (new_name, "%s_%08x", sym_name, (int) sym_sec); + sym_name = new_name; + + elftab = &hash_table->static_hash_table->root; + sym_hash = ((struct elf32_mn10300_link_hash_entry *) + elf_link_hash_lookup (elftab, sym_name, + FALSE, FALSE, FALSE)); + + free (new_name); + if (sym_hash == NULL) + continue; + + if (! (sym_hash->flags & MN10300_CONVERT_CALL_TO_CALLS) + && ! (sym_hash->flags & MN10300_DELETED_PROLOGUE_BYTES)) + { + int bytes = 0; + + /* Note that we've changed things. */ + elf_section_data (section)->relocs = internal_relocs; + elf_section_data (section)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Count how many bytes we're going to delete. */ + if (sym_hash->movm_args) + bytes += 2; + + if (sym_hash->stack_size > 0) + { + if (sym_hash->stack_size <= 128) + bytes += 3; + else + bytes += 4; + } + + /* Note that we've deleted prologue bytes for this + function. */ + sym_hash->flags |= MN10300_DELETED_PROLOGUE_BYTES; + + /* Actually delete the bytes. */ + if (!mn10300_elf_relax_delete_bytes (input_bfd, + section, + isym->st_value, + bytes)) + goto error_return; + + /* Something changed. Not strictly necessary, but + may lead to more relaxing opportunities. */ + *again = TRUE; + } + } + + /* Look for any global functions in this section which + need insns deleted from their prologues. */ + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + hashes = elf_sym_hashes (input_bfd); + end_hashes = hashes + symcount; + for (; hashes < end_hashes; hashes++) + { + struct elf32_mn10300_link_hash_entry *sym_hash; + + sym_hash = (struct elf32_mn10300_link_hash_entry *) *hashes; + if ((sym_hash->root.root.type == bfd_link_hash_defined + || sym_hash->root.root.type == bfd_link_hash_defweak) + && sym_hash->root.root.u.def.section == section + && ! (sym_hash->flags & MN10300_CONVERT_CALL_TO_CALLS) + && ! (sym_hash->flags & MN10300_DELETED_PROLOGUE_BYTES)) + { + int bytes = 0; + bfd_vma symval; + + /* Note that we've changed things. */ + elf_section_data (section)->relocs = internal_relocs; + elf_section_data (section)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Count how many bytes we're going to delete. */ + if (sym_hash->movm_args) + bytes += 2; + + if (sym_hash->stack_size > 0) + { + if (sym_hash->stack_size <= 128) + bytes += 3; + else + bytes += 4; + } + + /* Note that we've deleted prologue bytes for this + function. */ + sym_hash->flags |= MN10300_DELETED_PROLOGUE_BYTES; + + /* Actually delete the bytes. */ + symval = sym_hash->root.root.u.def.value; + if (!mn10300_elf_relax_delete_bytes (input_bfd, + section, + symval, + bytes)) + goto error_return; + + /* Something changed. Not strictly necessary, but + may lead to more relaxing opportunities. */ + *again = TRUE; + } + } + + /* Cache or free any memory we allocated for the relocs. */ + if (internal_relocs != NULL + && elf_section_data (section)->relocs != internal_relocs) + free (internal_relocs); + internal_relocs = NULL; + + /* Cache or free any memory we allocated for the contents. */ + if (contents != NULL + && elf_section_data (section)->this_hdr.contents != contents) + { + if (! link_info->keep_memory) + free (contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (section)->this_hdr.contents = contents; + } + } + contents = NULL; + } + + /* Cache or free any memory we allocated for the symbols. */ + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + { + if (! link_info->keep_memory) + free (isymbuf); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) isymbuf; + } + } + isymbuf = NULL; + } + } + + /* (Re)initialize for the basic instruction shortening/relaxing pass. */ + contents = NULL; + internal_relocs = NULL; + isymbuf = NULL; + /* For error_return. */ + section = sec; + + /* We don't have to do anything for a relocatable link, if + this section does not have relocs, or if this is not a + code section. */ + if (link_info->relocatable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0 + || (sec->flags & SEC_CODE) == 0) + return TRUE; + + /* If this is the first time we have been called for this section, + initialize the cooked size. */ + if (sec->_cooked_size == 0) + sec->_cooked_size = sec->_raw_size; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + /* Get a copy of the native relocations. */ + internal_relocs = (_bfd_elf_link_read_relocs + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + + /* Walk through them looking for relaxing opportunities. */ + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma symval; + struct elf32_mn10300_link_hash_entry *h = NULL; + + /* If this isn't something that can be relaxed, then ignore + this reloc. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_NONE + || ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_8 + || ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_MAX) + continue; + + /* Get the section contents if we haven't done so already. */ + if (contents == NULL) + { + /* Get cached copy if it exists. */ + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + /* Go get them off disk. */ + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + /* Read this BFD's symbols if we haven't done so already. */ + if (isymbuf == NULL && symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + Elf_Internal_Sym *isym; + asection *sym_sec = NULL; + const char *sym_name; + char *new_name; + + /* A local symbol. */ + isym = isymbuf + ELF32_R_SYM (irel->r_info); + if (isym->st_shndx == SHN_UNDEF) + sym_sec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + sym_sec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + sym_sec = bfd_com_section_ptr; + else + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + + symval = (isym->st_value + + sym_sec->output_section->vma + + sym_sec->output_offset); + sym_name = bfd_elf_string_from_elf_section (abfd, + symtab_hdr->sh_link, + isym->st_name); + + /* Tack on an ID so we can uniquely identify this + local symbol in the global hash table. */ + new_name = bfd_malloc ((bfd_size_type) strlen (sym_name) + 10); + if (new_name == 0) + goto error_return; + sprintf (new_name, "%s_%08x", sym_name, (int) sym_sec); + sym_name = new_name; + + h = (struct elf32_mn10300_link_hash_entry *) + elf_link_hash_lookup (&hash_table->static_hash_table->root, + sym_name, FALSE, FALSE, FALSE); + free (new_name); + } + else + { + unsigned long indx; + + /* An external symbol. */ + indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = (struct elf32_mn10300_link_hash_entry *) + (elf_sym_hashes (abfd)[indx]); + BFD_ASSERT (h != NULL); + if (h->root.root.type != bfd_link_hash_defined + && h->root.root.type != bfd_link_hash_defweak) + { + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + continue; + } + + symval = (h->root.root.u.def.value + + h->root.root.u.def.section->output_section->vma + + h->root.root.u.def.section->output_offset); + } + + /* For simplicity of coding, we are going to modify the section + contents, the section relocs, and the BFD symbol table. We + must tell the rest of the code not to free up this + information. It would be possible to instead create a table + of changes which have to be made, as is done in coff-mips.c; + that would be more work, but would require less memory when + the linker is run. */ + + /* Try to turn a 32bit pc-relative branch/call into a 16bit pc-relative + branch/call, also deal with "call" -> "calls" conversions and + insertion of prologue data into "call" instructions. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_PCREL32 + || ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_PLT32) + { + bfd_vma value = symval; + + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_PLT32 + && h != NULL + && ELF_ST_VISIBILITY (h->root.other) != STV_INTERNAL + && ELF_ST_VISIBILITY (h->root.other) != STV_HIDDEN + && h->root.plt.offset != (bfd_vma) -1) + { + asection * splt; + + splt = bfd_get_section_by_name (elf_hash_table (link_info) + ->dynobj, ".plt"); + + value = ((splt->output_section->vma + + splt->output_offset + + h->root.plt.offset) + - (sec->output_section->vma + + sec->output_offset + + irel->r_offset)); + } + + /* If we've got a "call" instruction that needs to be turned + into a "calls" instruction, do so now. It saves a byte. */ + if (h && (h->flags & MN10300_CONVERT_CALL_TO_CALLS)) + { + unsigned char code; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + /* Make sure we're working with a "call" instruction! */ + if (code == 0xdd) + { + /* Note that we've changed the relocs, section contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xfc, contents + irel->r_offset - 1); + bfd_put_8 (abfd, 0xff, contents + irel->r_offset); + + /* Fix irel->r_offset and irel->r_addend. */ + irel->r_offset += 1; + irel->r_addend += 1; + + /* Delete one byte of data. */ + if (!mn10300_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 3, 1)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + } + else if (h) + { + /* We've got a "call" instruction which needs some data + from target function filled in. */ + unsigned char code; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + /* Insert data from the target function into the "call" + instruction if needed. */ + if (code == 0xdd) + { + bfd_put_8 (abfd, h->movm_args, contents + irel->r_offset + 4); + bfd_put_8 (abfd, h->stack_size + h->movm_stack_size, + contents + irel->r_offset + 5); + } + } + + /* Deal with pc-relative gunk. */ + value -= (sec->output_section->vma + sec->output_offset); + value -= irel->r_offset; + value += irel->r_addend; + + /* See if the value will fit in 16 bits, note the high value is + 0x7fff + 2 as the target will be two bytes closer if we are + able to relax. */ + if ((long) value < 0x8001 && (long) value > -0x8000) + { + unsigned char code; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + if (code != 0xdc && code != 0xdd && code != 0xff) + continue; + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + if (code == 0xdc) + bfd_put_8 (abfd, 0xcc, contents + irel->r_offset - 1); + else if (code == 0xdd) + bfd_put_8 (abfd, 0xcd, contents + irel->r_offset - 1); + else if (code == 0xff) + bfd_put_8 (abfd, 0xfa, contents + irel->r_offset - 2); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_PLT32) + ? R_MN10300_PLT16 : + R_MN10300_PCREL16); + + /* Delete two bytes of data. */ + if (!mn10300_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + } + + /* Try to turn a 16bit pc-relative branch into a 8bit pc-relative + branch. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_PCREL16) + { + bfd_vma value = symval; + + /* If we've got a "call" instruction that needs to be turned + into a "calls" instruction, do so now. It saves a byte. */ + if (h && (h->flags & MN10300_CONVERT_CALL_TO_CALLS)) + { + unsigned char code; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + /* Make sure we're working with a "call" instruction! */ + if (code == 0xcd) + { + /* Note that we've changed the relocs, section contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xfa, contents + irel->r_offset - 1); + bfd_put_8 (abfd, 0xff, contents + irel->r_offset); + + /* Fix irel->r_offset and irel->r_addend. */ + irel->r_offset += 1; + irel->r_addend += 1; + + /* Delete one byte of data. */ + if (!mn10300_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 1)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + } + else if (h) + { + unsigned char code; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + /* Insert data from the target function into the "call" + instruction if needed. */ + if (code == 0xcd) + { + bfd_put_8 (abfd, h->movm_args, contents + irel->r_offset + 2); + bfd_put_8 (abfd, h->stack_size + h->movm_stack_size, + contents + irel->r_offset + 3); + } + } + + /* Deal with pc-relative gunk. */ + value -= (sec->output_section->vma + sec->output_offset); + value -= irel->r_offset; + value += irel->r_addend; + + /* See if the value will fit in 8 bits, note the high value is + 0x7f + 1 as the target will be one bytes closer if we are + able to relax. */ + if ((long) value < 0x80 && (long) value > -0x80) + { + unsigned char code; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + if (code != 0xcc) + continue; + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xca, contents + irel->r_offset - 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10300_PCREL8); + + /* Delete one byte of data. */ + if (!mn10300_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 1)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + } + + /* Try to eliminate an unconditional 8 bit pc-relative branch + which immediately follows a conditional 8 bit pc-relative + branch around the unconditional branch. + + original: new: + bCC lab1 bCC' lab2 + bra lab2 + lab1: lab1: + + This happens when the bCC can't reach lab2 at assembly time, + but due to other relaxations it can reach at link time. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_PCREL8) + { + Elf_Internal_Rela *nrel; + bfd_vma value = symval; + unsigned char code; + + /* Deal with pc-relative gunk. */ + value -= (sec->output_section->vma + sec->output_offset); + value -= irel->r_offset; + value += irel->r_addend; + + /* Do nothing if this reloc is the last byte in the section. */ + if (irel->r_offset == sec->_cooked_size) + continue; + + /* See if the next instruction is an unconditional pc-relative + branch, more often than not this test will fail, so we + test it first to speed things up. */ + code = bfd_get_8 (abfd, contents + irel->r_offset + 1); + if (code != 0xca) + continue; + + /* Also make sure the next relocation applies to the next + instruction and that it's a pc-relative 8 bit branch. */ + nrel = irel + 1; + if (nrel == irelend + || irel->r_offset + 2 != nrel->r_offset + || ELF32_R_TYPE (nrel->r_info) != (int) R_MN10300_PCREL8) + continue; + + /* Make sure our destination immediately follows the + unconditional branch. */ + if (symval != (sec->output_section->vma + sec->output_offset + + irel->r_offset + 3)) + continue; + + /* Now make sure we are a conditional branch. This may not + be necessary, but why take the chance. + + Note these checks assume that R_MN10300_PCREL8 relocs + only occur on bCC and bCCx insns. If they occured + elsewhere, we'd need to know the start of this insn + for this check to be accurate. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + if (code != 0xc0 && code != 0xc1 && code != 0xc2 + && code != 0xc3 && code != 0xc4 && code != 0xc5 + && code != 0xc6 && code != 0xc7 && code != 0xc8 + && code != 0xc9 && code != 0xe8 && code != 0xe9 + && code != 0xea && code != 0xeb) + continue; + + /* We also have to be sure there is no symbol/label + at the unconditional branch. */ + if (mn10300_elf_symbol_address_p (abfd, sec, isymbuf, + irel->r_offset + 1)) + continue; + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Reverse the condition of the first branch. */ + switch (code) + { + case 0xc8: + code = 0xc9; + break; + case 0xc9: + code = 0xc8; + break; + case 0xc0: + code = 0xc2; + break; + case 0xc2: + code = 0xc0; + break; + case 0xc3: + code = 0xc1; + break; + case 0xc1: + code = 0xc3; + break; + case 0xc4: + code = 0xc6; + break; + case 0xc6: + code = 0xc4; + break; + case 0xc7: + code = 0xc5; + break; + case 0xc5: + code = 0xc7; + break; + case 0xe8: + code = 0xe9; + break; + case 0x9d: + code = 0xe8; + break; + case 0xea: + code = 0xeb; + break; + case 0xeb: + code = 0xea; + break; + } + bfd_put_8 (abfd, code, contents + irel->r_offset - 1); + + /* Set the reloc type and symbol for the first branch + from the second branch. */ + irel->r_info = nrel->r_info; + + /* Make the reloc for the second branch a null reloc. */ + nrel->r_info = ELF32_R_INFO (ELF32_R_SYM (nrel->r_info), + R_MN10300_NONE); + + /* Delete two bytes of data. */ + if (!mn10300_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + + /* Try to turn a 24 immediate, displacement or absolute address + into a 8 immediate, displacement or absolute address. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_24) + { + bfd_vma value = symval; + value += irel->r_addend; + + /* See if the value will fit in 8 bits. */ + if ((long) value < 0x7f && (long) value > -0x80) + { + unsigned char code; + + /* AM33 insns which have 24 operands are 6 bytes long and + will have 0xfd as the first byte. */ + + /* Get the first opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 3); + + if (code == 0xfd) + { + /* Get the second opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 2); + + /* We can not relax 0x6b, 0x7b, 0x8b, 0x9b as no 24bit + equivalent instructions exists. */ + if (code != 0x6b && code != 0x7b + && code != 0x8b && code != 0x9b + && ((code & 0x0f) == 0x09 || (code & 0x0f) == 0x08 + || (code & 0x0f) == 0x0a || (code & 0x0f) == 0x0b + || (code & 0x0f) == 0x0e)) + { + /* Not safe if the high bit is on as relaxing may + move the value out of high mem and thus not fit + in a signed 8bit value. This is currently over + conservative. */ + if ((value & 0x80) == 0) + { + /* Note that we've changed the relocation contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xfb, contents + irel->r_offset - 3); + bfd_put_8 (abfd, code, contents + irel->r_offset - 2); + + /* Fix the relocation's type. */ + irel->r_info = + ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_MN10300_8); + + /* Delete two bytes of data. */ + if (!mn10300_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax + again. Note that this is not required, and it + may be slow. */ + *again = TRUE; + break; + } + } + } + } + } + + /* Try to turn a 32bit immediate, displacement or absolute address + into a 16bit immediate, displacement or absolute address. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_32 + || ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_GOT32 + || ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_GOTOFF32 + || ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_GOTPC32) + { + bfd_vma value = symval; + + if (ELF32_R_TYPE (irel->r_info) != (int) R_MN10300_32) + { + asection * sgot; + + sgot = bfd_get_section_by_name (elf_hash_table (link_info) + ->dynobj, ".got"); + + if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_GOT32) + { + value = sgot->output_offset; + + if (h) + value += h->root.got.offset; + else + value += (elf_local_got_offsets + (abfd)[ELF32_R_SYM (irel->r_info)]); + } + else if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_GOTOFF32) + value -= sgot->output_section->vma; + else if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_GOTPC32) + value = (sgot->output_section->vma + - (sec->output_section->vma + + sec->output_offset + + irel->r_offset)); + else + abort (); + } + + value += irel->r_addend; + + /* See if the value will fit in 24 bits. + We allow any 16bit match here. We prune those we can't + handle below. */ + if ((long) value < 0x7fffff && (long) value > -0x800000) + { + unsigned char code; + + /* AM33 insns which have 32bit operands are 7 bytes long and + will have 0xfe as the first byte. */ + + /* Get the first opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 3); + + if (code == 0xfe) + { + /* Get the second opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 2); + + /* All the am33 32 -> 24 relaxing possibilities. */ + /* We can not relax 0x6b, 0x7b, 0x8b, 0x9b as no 24bit + equivalent instructions exists. */ + if (code != 0x6b && code != 0x7b + && code != 0x8b && code != 0x9b + && (ELF32_R_TYPE (irel->r_info) + != (int) R_MN10300_GOTPC32) + && ((code & 0x0f) == 0x09 || (code & 0x0f) == 0x08 + || (code & 0x0f) == 0x0a || (code & 0x0f) == 0x0b + || (code & 0x0f) == 0x0e)) + { + /* Not safe if the high bit is on as relaxing may + move the value out of high mem and thus not fit + in a signed 16bit value. This is currently over + conservative. */ + if ((value & 0x8000) == 0) + { + /* Note that we've changed the relocation contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xfd, contents + irel->r_offset - 3); + bfd_put_8 (abfd, code, contents + irel->r_offset - 2); + + /* Fix the relocation's type. */ + irel->r_info = + ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOTOFF32) + ? R_MN10300_GOTOFF24 + : (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOT32) + ? R_MN10300_GOT24 : + R_MN10300_24); + + /* Delete one byte of data. */ + if (!mn10300_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 3, 1)) + goto error_return; + + /* That will change things, so, we should relax + again. Note that this is not required, and it + may be slow. */ + *again = TRUE; + break; + } + } + } + } + + /* See if the value will fit in 16 bits. + We allow any 16bit match here. We prune those we can't + handle below. */ + if ((long) value < 0x7fff && (long) value > -0x8000) + { + unsigned char code; + + /* Most insns which have 32bit operands are 6 bytes long; + exceptions are pcrel insns and bit insns. + + We handle pcrel insns above. We don't bother trying + to handle the bit insns here. + + The first byte of the remaining insns will be 0xfc. */ + + /* Get the first opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 2); + + if (code != 0xfc) + continue; + + /* Get the second opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + if ((code & 0xf0) < 0x80) + switch (code & 0xf0) + { + /* mov (d32,am),dn -> mov (d32,am),dn + mov dm,(d32,am) -> mov dn,(d32,am) + mov (d32,am),an -> mov (d32,am),an + mov dm,(d32,am) -> mov dn,(d32,am) + movbu (d32,am),dn -> movbu (d32,am),dn + movbu dm,(d32,am) -> movbu dn,(d32,am) + movhu (d32,am),dn -> movhu (d32,am),dn + movhu dm,(d32,am) -> movhu dn,(d32,am) */ + case 0x00: + case 0x10: + case 0x20: + case 0x30: + case 0x40: + case 0x50: + case 0x60: + case 0x70: + /* Not safe if the high bit is on as relaxing may + move the value out of high mem and thus not fit + in a signed 16bit value. */ + if (code == 0xcc + && (value & 0x8000)) + continue; + + /* Note that we've changed the relocation contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xfa, contents + irel->r_offset - 2); + bfd_put_8 (abfd, code, contents + irel->r_offset - 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOTOFF32) + ? R_MN10300_GOTOFF16 + : (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOT32) + ? R_MN10300_GOT16 + : (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOTPC32) + ? R_MN10300_GOTPC16 : + R_MN10300_16); + + /* Delete two bytes of data. */ + if (!mn10300_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 2, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + break; + } + else if ((code & 0xf0) == 0x80 + || (code & 0xf0) == 0x90) + switch (code & 0xf3) + { + /* mov dn,(abs32) -> mov dn,(abs16) + movbu dn,(abs32) -> movbu dn,(abs16) + movhu dn,(abs32) -> movhu dn,(abs16) */ + case 0x81: + case 0x82: + case 0x83: + /* Note that we've changed the relocation contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + if ((code & 0xf3) == 0x81) + code = 0x01 + (code & 0x0c); + else if ((code & 0xf3) == 0x82) + code = 0x02 + (code & 0x0c); + else if ((code & 0xf3) == 0x83) + code = 0x03 + (code & 0x0c); + else + abort (); + + /* Fix the opcode. */ + bfd_put_8 (abfd, code, contents + irel->r_offset - 2); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOTOFF32) + ? R_MN10300_GOTOFF16 + : (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOT32) + ? R_MN10300_GOT16 + : (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOTPC32) + ? R_MN10300_GOTPC16 : + R_MN10300_16); + + /* The opcode got shorter too, so we have to fix the + addend and offset too! */ + irel->r_offset -= 1; + + /* Delete three bytes of data. */ + if (!mn10300_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 3)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + break; + + /* mov am,(abs32) -> mov am,(abs16) + mov am,(d32,sp) -> mov am,(d16,sp) + mov dm,(d32,sp) -> mov dm,(d32,sp) + movbu dm,(d32,sp) -> movbu dm,(d32,sp) + movhu dm,(d32,sp) -> movhu dm,(d32,sp) */ + case 0x80: + case 0x90: + case 0x91: + case 0x92: + case 0x93: + /* sp-based offsets are zero-extended. */ + if (code >= 0x90 && code <= 0x93 + && (long)value < 0) + continue; + + /* Note that we've changed the relocation contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xfa, contents + irel->r_offset - 2); + bfd_put_8 (abfd, code, contents + irel->r_offset - 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOTOFF32) + ? R_MN10300_GOTOFF16 + : (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOT32) + ? R_MN10300_GOT16 + : (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOTPC32) + ? R_MN10300_GOTPC16 : + R_MN10300_16); + + /* Delete two bytes of data. */ + if (!mn10300_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 2, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + break; + } + else if ((code & 0xf0) < 0xf0) + switch (code & 0xfc) + { + /* mov imm32,dn -> mov imm16,dn + mov imm32,an -> mov imm16,an + mov (abs32),dn -> mov (abs16),dn + movbu (abs32),dn -> movbu (abs16),dn + movhu (abs32),dn -> movhu (abs16),dn */ + case 0xcc: + case 0xdc: + case 0xa4: + case 0xa8: + case 0xac: + /* Not safe if the high bit is on as relaxing may + move the value out of high mem and thus not fit + in a signed 16bit value. */ + if (code == 0xcc + && (value & 0x8000)) + continue; + + /* mov imm16, an zero-extends the immediate. */ + if (code == 0xdc + && (long)value < 0) + continue; + + /* Note that we've changed the relocation contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + if ((code & 0xfc) == 0xcc) + code = 0x2c + (code & 0x03); + else if ((code & 0xfc) == 0xdc) + code = 0x24 + (code & 0x03); + else if ((code & 0xfc) == 0xa4) + code = 0x30 + (code & 0x03); + else if ((code & 0xfc) == 0xa8) + code = 0x34 + (code & 0x03); + else if ((code & 0xfc) == 0xac) + code = 0x38 + (code & 0x03); + else + abort (); + + /* Fix the opcode. */ + bfd_put_8 (abfd, code, contents + irel->r_offset - 2); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOTOFF32) + ? R_MN10300_GOTOFF16 + : (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOT32) + ? R_MN10300_GOT16 + : (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOTPC32) + ? R_MN10300_GOTPC16 : + R_MN10300_16); + + /* The opcode got shorter too, so we have to fix the + addend and offset too! */ + irel->r_offset -= 1; + + /* Delete three bytes of data. */ + if (!mn10300_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 3)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + break; + + /* mov (abs32),an -> mov (abs16),an + mov (d32,sp),an -> mov (d16,sp),an + mov (d32,sp),dn -> mov (d16,sp),dn + movbu (d32,sp),dn -> movbu (d16,sp),dn + movhu (d32,sp),dn -> movhu (d16,sp),dn + add imm32,dn -> add imm16,dn + cmp imm32,dn -> cmp imm16,dn + add imm32,an -> add imm16,an + cmp imm32,an -> cmp imm16,an + and imm32,dn -> and imm16,dn + or imm32,dn -> or imm16,dn + xor imm32,dn -> xor imm16,dn + btst imm32,dn -> btst imm16,dn */ + + case 0xa0: + case 0xb0: + case 0xb1: + case 0xb2: + case 0xb3: + case 0xc0: + case 0xc8: + + case 0xd0: + case 0xd8: + case 0xe0: + case 0xe1: + case 0xe2: + case 0xe3: + /* cmp imm16, an zero-extends the immediate. */ + if (code == 0xdc + && (long)value < 0) + continue; + + /* So do sp-based offsets. */ + if (code >= 0xb0 && code <= 0xb3 + && (long)value < 0) + continue; + + /* Note that we've changed the relocation contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xfa, contents + irel->r_offset - 2); + bfd_put_8 (abfd, code, contents + irel->r_offset - 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOTOFF32) + ? R_MN10300_GOTOFF16 + : (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOT32) + ? R_MN10300_GOT16 + : (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOTPC32) + ? R_MN10300_GOTPC16 : + R_MN10300_16); + + /* Delete two bytes of data. */ + if (!mn10300_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 2, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + break; + } + else if (code == 0xfe) + { + /* add imm32,sp -> add imm16,sp */ + + /* Note that we've changed the relocation contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Fix the opcode. */ + bfd_put_8 (abfd, 0xfa, contents + irel->r_offset - 2); + bfd_put_8 (abfd, 0xfe, contents + irel->r_offset - 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOT32) + ? R_MN10300_GOT16 + : (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOTOFF32) + ? R_MN10300_GOTOFF16 + : (ELF32_R_TYPE (irel->r_info) + == (int) R_MN10300_GOTPC32) + ? R_MN10300_GOTPC16 : + R_MN10300_16); + + /* Delete two bytes of data. */ + if (!mn10300_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 2, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + break; + } + } + } + } + + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + { + if (! link_info->keep_memory) + free (isymbuf); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) isymbuf; + } + } + + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + { + if (! link_info->keep_memory) + free (contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + } + + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + return TRUE; + + error_return: + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (contents != NULL + && elf_section_data (section)->this_hdr.contents != contents) + free (contents); + if (internal_relocs != NULL + && elf_section_data (section)->relocs != internal_relocs) + free (internal_relocs); + + return FALSE; +} + +/* Compute the stack size and movm arguments for the function + referred to by HASH at address ADDR in section with + contents CONTENTS, store the information in the hash table. */ +static void +compute_function_info (abfd, hash, addr, contents) + bfd *abfd; + struct elf32_mn10300_link_hash_entry *hash; + bfd_vma addr; + unsigned char *contents; +{ + unsigned char byte1, byte2; + /* We only care about a very small subset of the possible prologue + sequences here. Basically we look for: + + movm [d2,d3,a2,a3],sp (optional) + add ,sp (optional, and only for sizes which fit in an unsigned + 8 bit number) + + If we find anything else, we quit. */ + + /* Look for movm [regs],sp */ + byte1 = bfd_get_8 (abfd, contents + addr); + byte2 = bfd_get_8 (abfd, contents + addr + 1); + + if (byte1 == 0xcf) + { + hash->movm_args = byte2; + addr += 2; + byte1 = bfd_get_8 (abfd, contents + addr); + byte2 = bfd_get_8 (abfd, contents + addr + 1); + } + + /* Now figure out how much stack space will be allocated by the movm + instruction. We need this kept separate from the function's normal + stack space. */ + if (hash->movm_args) + { + /* Space for d2. */ + if (hash->movm_args & 0x80) + hash->movm_stack_size += 4; + + /* Space for d3. */ + if (hash->movm_args & 0x40) + hash->movm_stack_size += 4; + + /* Space for a2. */ + if (hash->movm_args & 0x20) + hash->movm_stack_size += 4; + + /* Space for a3. */ + if (hash->movm_args & 0x10) + hash->movm_stack_size += 4; + + /* "other" space. d0, d1, a0, a1, mdr, lir, lar, 4 byte pad. */ + if (hash->movm_args & 0x08) + hash->movm_stack_size += 8 * 4; + + if (bfd_get_mach (abfd) == bfd_mach_am33 + || bfd_get_mach (abfd) == bfd_mach_am33_2) + { + /* "exother" space. e0, e1, mdrq, mcrh, mcrl, mcvf */ + if (hash->movm_args & 0x1) + hash->movm_stack_size += 6 * 4; + + /* exreg1 space. e4, e5, e6, e7 */ + if (hash->movm_args & 0x2) + hash->movm_stack_size += 4 * 4; + + /* exreg0 space. e2, e3 */ + if (hash->movm_args & 0x4) + hash->movm_stack_size += 2 * 4; + } + } + + /* Now look for the two stack adjustment variants. */ + if (byte1 == 0xf8 && byte2 == 0xfe) + { + int temp = bfd_get_8 (abfd, contents + addr + 2); + temp = ((temp & 0xff) ^ (~0x7f)) + 0x80; + + hash->stack_size = -temp; + } + else if (byte1 == 0xfa && byte2 == 0xfe) + { + int temp = bfd_get_16 (abfd, contents + addr + 2); + temp = ((temp & 0xffff) ^ (~0x7fff)) + 0x8000; + temp = -temp; + + if (temp < 255) + hash->stack_size = temp; + } + + /* If the total stack to be allocated by the call instruction is more + than 255 bytes, then we can't remove the stack adjustment by using + "call" (we might still be able to remove the "movm" instruction. */ + if (hash->stack_size + hash->movm_stack_size > 255) + hash->stack_size = 0; + + return; +} + +/* Delete some bytes from a section while relaxing. */ + +static bfd_boolean +mn10300_elf_relax_delete_bytes (abfd, sec, addr, count) + bfd *abfd; + asection *sec; + bfd_vma addr; + int count; +{ + Elf_Internal_Shdr *symtab_hdr; + unsigned int sec_shndx; + bfd_byte *contents; + Elf_Internal_Rela *irel, *irelend; + Elf_Internal_Rela *irelalign; + bfd_vma toaddr; + Elf_Internal_Sym *isym, *isymend; + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry **end_hashes; + unsigned int symcount; + + sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + contents = elf_section_data (sec)->this_hdr.contents; + + /* The deletion must stop at the next ALIGN reloc for an aligment + power larger than the number of bytes we are deleting. */ + + irelalign = NULL; + toaddr = sec->_cooked_size; + + irel = elf_section_data (sec)->relocs; + irelend = irel + sec->reloc_count; + + /* Actually delete the bytes. */ + memmove (contents + addr, contents + addr + count, + (size_t) (toaddr - addr - count)); + sec->_cooked_size -= count; + + /* Adjust all the relocs. */ + for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) + { + /* Get the new reloc address. */ + if ((irel->r_offset > addr + && irel->r_offset < toaddr)) + irel->r_offset -= count; + } + + /* Adjust the local symbols defined in this section. */ + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + isym = (Elf_Internal_Sym *) symtab_hdr->contents; + for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++) + { + if (isym->st_shndx == sec_shndx + && isym->st_value > addr + && isym->st_value < toaddr) + isym->st_value -= count; + } + + /* Now adjust the global symbols defined in this section. */ + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + sym_hashes = elf_sym_hashes (abfd); + end_hashes = sym_hashes + symcount; + for (; sym_hashes < end_hashes; sym_hashes++) + { + struct elf_link_hash_entry *sym_hash = *sym_hashes; + if ((sym_hash->root.type == bfd_link_hash_defined + || sym_hash->root.type == bfd_link_hash_defweak) + && sym_hash->root.u.def.section == sec + && sym_hash->root.u.def.value > addr + && sym_hash->root.u.def.value < toaddr) + { + sym_hash->root.u.def.value -= count; + } + } + + return TRUE; +} + +/* Return TRUE if a symbol exists at the given address, else return + FALSE. */ +static bfd_boolean +mn10300_elf_symbol_address_p (abfd, sec, isym, addr) + bfd *abfd; + asection *sec; + Elf_Internal_Sym *isym; + bfd_vma addr; +{ + Elf_Internal_Shdr *symtab_hdr; + unsigned int sec_shndx; + Elf_Internal_Sym *isymend; + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry **end_hashes; + unsigned int symcount; + + sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + /* Examine all the symbols. */ + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++) + { + if (isym->st_shndx == sec_shndx + && isym->st_value == addr) + return TRUE; + } + + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + sym_hashes = elf_sym_hashes (abfd); + end_hashes = sym_hashes + symcount; + for (; sym_hashes < end_hashes; sym_hashes++) + { + struct elf_link_hash_entry *sym_hash = *sym_hashes; + if ((sym_hash->root.type == bfd_link_hash_defined + || sym_hash->root.type == bfd_link_hash_defweak) + && sym_hash->root.u.def.section == sec + && sym_hash->root.u.def.value == addr) + return TRUE; + } + + return FALSE; +} + +/* This is a version of bfd_generic_get_relocated_section_contents + which uses mn10300_elf_relocate_section. */ + +static bfd_byte * +mn10300_elf_get_relocated_section_contents (output_bfd, link_info, link_order, + data, relocatable, symbols) + bfd *output_bfd; + struct bfd_link_info *link_info; + struct bfd_link_order *link_order; + bfd_byte *data; + bfd_boolean relocatable; + asymbol **symbols; +{ + Elf_Internal_Shdr *symtab_hdr; + asection *input_section = link_order->u.indirect.section; + bfd *input_bfd = input_section->owner; + asection **sections = NULL; + Elf_Internal_Rela *internal_relocs = NULL; + Elf_Internal_Sym *isymbuf = NULL; + + /* We only need to handle the case of relaxing, or of having a + particular set of section contents, specially. */ + if (relocatable + || elf_section_data (input_section)->this_hdr.contents == NULL) + return bfd_generic_get_relocated_section_contents (output_bfd, link_info, + link_order, data, + relocatable, + symbols); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + + memcpy (data, elf_section_data (input_section)->this_hdr.contents, + (size_t) input_section->_raw_size); + + if ((input_section->flags & SEC_RELOC) != 0 + && input_section->reloc_count > 0) + { + asection **secpp; + Elf_Internal_Sym *isym, *isymend; + bfd_size_type amt; + + internal_relocs = (_bfd_elf_link_read_relocs + (input_bfd, input_section, (PTR) NULL, + (Elf_Internal_Rela *) NULL, FALSE)); + if (internal_relocs == NULL) + goto error_return; + + if (symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + amt = symtab_hdr->sh_info; + amt *= sizeof (asection *); + sections = (asection **) bfd_malloc (amt); + if (sections == NULL && amt != 0) + goto error_return; + + isymend = isymbuf + symtab_hdr->sh_info; + for (isym = isymbuf, secpp = sections; isym < isymend; ++isym, ++secpp) + { + asection *isec; + + if (isym->st_shndx == SHN_UNDEF) + isec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + isec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + isec = bfd_com_section_ptr; + else + isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx); + + *secpp = isec; + } + + if (! mn10300_elf_relocate_section (output_bfd, link_info, input_bfd, + input_section, data, internal_relocs, + isymbuf, sections)) + goto error_return; + + if (sections != NULL) + free (sections); + if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + } + + return data; + + error_return: + if (sections != NULL) + free (sections); + if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (internal_relocs != NULL + && internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + return NULL; +} + +/* Assorted hash table functions. */ + +/* Initialize an entry in the link hash table. */ + +/* Create an entry in an MN10300 ELF linker hash table. */ + +static struct bfd_hash_entry * +elf32_mn10300_link_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct elf32_mn10300_link_hash_entry *ret = + (struct elf32_mn10300_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct elf32_mn10300_link_hash_entry *) NULL) + ret = ((struct elf32_mn10300_link_hash_entry *) + bfd_hash_allocate (table, + sizeof (struct elf32_mn10300_link_hash_entry))); + if (ret == (struct elf32_mn10300_link_hash_entry *) NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct elf32_mn10300_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != (struct elf32_mn10300_link_hash_entry *) NULL) + { + ret->direct_calls = 0; + ret->stack_size = 0; + ret->movm_args = 0; + ret->movm_stack_size = 0; + ret->pcrel_relocs_copied = NULL; + ret->flags = 0; + } + + return (struct bfd_hash_entry *) ret; +} + +/* Create an mn10300 ELF linker hash table. */ + +static struct bfd_link_hash_table * +elf32_mn10300_link_hash_table_create (abfd) + bfd *abfd; +{ + struct elf32_mn10300_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf32_mn10300_link_hash_table); + + ret = (struct elf32_mn10300_link_hash_table *) bfd_malloc (amt); + if (ret == (struct elf32_mn10300_link_hash_table *) NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + elf32_mn10300_link_hash_newfunc)) + { + free (ret); + return NULL; + } + + ret->flags = 0; + amt = sizeof (struct elf_link_hash_table); + ret->static_hash_table + = (struct elf32_mn10300_link_hash_table *) bfd_malloc (amt); + if (ret->static_hash_table == NULL) + { + free (ret); + return NULL; + } + + if (! _bfd_elf_link_hash_table_init (&ret->static_hash_table->root, abfd, + elf32_mn10300_link_hash_newfunc)) + { + free (ret->static_hash_table); + free (ret); + return NULL; + } + return &ret->root.root; +} + +/* Free an mn10300 ELF linker hash table. */ + +static void +elf32_mn10300_link_hash_table_free (hash) + struct bfd_link_hash_table *hash; +{ + struct elf32_mn10300_link_hash_table *ret + = (struct elf32_mn10300_link_hash_table *) hash; + + _bfd_generic_link_hash_table_free + ((struct bfd_link_hash_table *) ret->static_hash_table); + _bfd_generic_link_hash_table_free + ((struct bfd_link_hash_table *) ret); +} + +static unsigned long +elf_mn10300_mach (flags) + flagword flags; +{ + switch (flags & EF_MN10300_MACH) + { + case E_MN10300_MACH_MN10300: + default: + return bfd_mach_mn10300; + + case E_MN10300_MACH_AM33: + return bfd_mach_am33; + + case E_MN10300_MACH_AM33_2: + return bfd_mach_am33_2; + } +} + +/* The final processing done just before writing out a MN10300 ELF object + file. This gets the MN10300 architecture right based on the machine + number. */ + +void +_bfd_mn10300_elf_final_write_processing (abfd, linker) + bfd *abfd; + bfd_boolean linker ATTRIBUTE_UNUSED; +{ + unsigned long val; + + switch (bfd_get_mach (abfd)) + { + default: + case bfd_mach_mn10300: + val = E_MN10300_MACH_MN10300; + break; + + case bfd_mach_am33: + val = E_MN10300_MACH_AM33; + break; + + case bfd_mach_am33_2: + val = E_MN10300_MACH_AM33_2; + break; + } + + elf_elfheader (abfd)->e_flags &= ~ (EF_MN10300_MACH); + elf_elfheader (abfd)->e_flags |= val; +} + +bfd_boolean +_bfd_mn10300_elf_object_p (abfd) + bfd *abfd; +{ + bfd_default_set_arch_mach (abfd, bfd_arch_mn10300, + elf_mn10300_mach (elf_elfheader (abfd)->e_flags)); + return TRUE; +} + +/* Merge backend specific data from an object file to the output + object file when linking. */ + +bfd_boolean +_bfd_mn10300_elf_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) + && bfd_get_mach (obfd) < bfd_get_mach (ibfd)) + { + if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), + bfd_get_mach (ibfd))) + return FALSE; + } + + return TRUE; +} + +#define PLT0_ENTRY_SIZE 15 +#define PLT_ENTRY_SIZE 20 +#define PIC_PLT_ENTRY_SIZE 24 + +static const bfd_byte elf_mn10300_plt0_entry[PLT0_ENTRY_SIZE] = +{ + 0xfc, 0xa0, 0, 0, 0, 0, /* mov (.got+8),a0 */ + 0xfe, 0xe, 0x10, 0, 0, 0, 0, /* mov (.got+4),r1 */ + 0xf0, 0xf4, /* jmp (a0) */ +}; + +static const bfd_byte elf_mn10300_plt_entry[PLT_ENTRY_SIZE] = +{ + 0xfc, 0xa0, 0, 0, 0, 0, /* mov (nameN@GOT + .got),a0 */ + 0xf0, 0xf4, /* jmp (a0) */ + 0xfe, 8, 0, 0, 0, 0, 0, /* mov reloc-table-address,r0 */ + 0xdc, 0, 0, 0, 0, /* jmp .plt0 */ +}; + +static const bfd_byte elf_mn10300_pic_plt_entry[PIC_PLT_ENTRY_SIZE] = +{ + 0xfc, 0x22, 0, 0, 0, 0, /* mov (nameN@GOT,a2),a0 */ + 0xf0, 0xf4, /* jmp (a0) */ + 0xfe, 8, 0, 0, 0, 0, 0, /* mov reloc-table-address,r0 */ + 0xf8, 0x22, 8, /* mov (8,a2),a0 */ + 0xfb, 0xa, 0x1a, 4, /* mov (4,a2),r1 */ + 0xf0, 0xf4, /* jmp (a0) */ +}; + +/* Return size of the first PLT entry. */ +#define elf_mn10300_sizeof_plt0(info) \ + (info->shared ? PIC_PLT_ENTRY_SIZE : PLT0_ENTRY_SIZE) + +/* Return size of a PLT entry. */ +#define elf_mn10300_sizeof_plt(info) \ + (info->shared ? PIC_PLT_ENTRY_SIZE : PLT_ENTRY_SIZE) + +/* Return offset of the PLT0 address in an absolute PLT entry. */ +#define elf_mn10300_plt_plt0_offset(info) 16 + +/* Return offset of the linker in PLT0 entry. */ +#define elf_mn10300_plt0_linker_offset(info) 2 + +/* Return offset of the GOT id in PLT0 entry. */ +#define elf_mn10300_plt0_gotid_offset(info) 9 + +/* Return offset of the temporary in PLT entry */ +#define elf_mn10300_plt_temp_offset(info) 8 + +/* Return offset of the symbol in PLT entry. */ +#define elf_mn10300_plt_symbol_offset(info) 2 + +/* Return offset of the relocation in PLT entry. */ +#define elf_mn10300_plt_reloc_offset(info) 11 + +/* The name of the dynamic interpreter. This is put in the .interp + section. */ + +#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1" + +/* Create dynamic sections when linking against a dynamic object. */ + +static bfd_boolean +_bfd_mn10300_elf_create_dynamic_sections (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + flagword flags; + asection * s; + const struct elf_backend_data * bed = get_elf_backend_data (abfd); + int ptralign = 0; + + switch (bed->s->arch_size) + { + case 32: + ptralign = 2; + break; + + case 64: + ptralign = 3; + break; + + default: + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and + .rel[a].bss sections. */ + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + + s = bfd_make_section (abfd, + bed->default_use_rela_p ? ".rela.plt" : ".rel.plt"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + + if (! _bfd_mn10300_elf_create_got_section (abfd, info)) + return FALSE; + + { + const char * secname; + char * relname; + flagword secflags; + asection * sec; + + for (sec = abfd->sections; sec; sec = sec->next) + { + secflags = bfd_get_section_flags (abfd, sec); + if ((secflags & (SEC_DATA | SEC_LINKER_CREATED)) + || ((secflags & SEC_HAS_CONTENTS) != SEC_HAS_CONTENTS)) + continue; + + secname = bfd_get_section_name (abfd, sec); + relname = (char *) bfd_malloc (strlen (secname) + 6); + strcpy (relname, ".rela"); + strcat (relname, secname); + + s = bfd_make_section (abfd, relname); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + } + } + + if (bed->want_dynbss) + { + /* The .dynbss section is a place to put symbols which are defined + by dynamic objects, are referenced by regular objects, and are + not functions. We must allocate space for them in the process + image and use a R_*_COPY reloc to tell the dynamic linker to + initialize them at run time. The linker script puts the .dynbss + section into the .bss section of the final image. */ + s = bfd_make_section (abfd, ".dynbss"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, SEC_ALLOC)) + return FALSE; + + /* The .rel[a].bss section holds copy relocs. This section is not + normally needed. We need to create it here, though, so that the + linker will map it to an output section. We can't just create it + only if we need it, because we will not know whether we need it + until we have seen all the input files, and the first time the + main linker code calls BFD after examining all the input files + (size_dynamic_sections) the input sections have already been + mapped to the output sections. If the section turns out not to + be needed, we can discard it later. We will never need this + section when generating a shared object, since they do not use + copy relocs. */ + if (! info->shared) + { + s = bfd_make_section (abfd, + (bed->default_use_rela_p + ? ".rela.bss" : ".rel.bss")); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + } + } + + return TRUE; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static bfd_boolean +_bfd_mn10300_elf_adjust_dynamic_symbol (info, h) + struct bfd_link_info * info; + struct elf_link_hash_entry * h; +{ + bfd * dynobj; + asection * s; + unsigned int power_of_two; + + dynobj = elf_hash_table (info)->dynobj; + + /* Make sure we know what is going on here. */ + BFD_ASSERT (dynobj != NULL + && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) + || h->weakdef != NULL + || ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_REF_REGULAR) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))); + + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later, + when we know the address of the .got section. */ + if (h->type == STT_FUNC + || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + { + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0) + { + /* This case can occur if we saw a PLT reloc in an input + file, but the symbol was never referred to by a dynamic + object. In such a case, we don't actually need to build + a procedure linkage table, and we can just do a REL32 + reloc instead. */ + BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0); + return TRUE; + } + + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (s != NULL); + + /* If this is the first .plt entry, make room for the special + first entry. */ + if (s->_raw_size == 0) + s->_raw_size += elf_mn10300_sizeof_plt0 (info); + + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + } + + h->plt.offset = s->_raw_size; + + /* Make room for this entry. */ + s->_raw_size += elf_mn10300_sizeof_plt (info); + + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + + s = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (s != NULL); + s->_raw_size += 4; + + /* We also need to make an entry in the .rela.plt section. */ + + s = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (s != NULL); + s->_raw_size += sizeof (Elf32_External_Rela); + + return TRUE; + } + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (info->shared) + return TRUE; + + /* If there are no references to this symbol that do not use the + GOT, we don't need to generate a copy reloc. */ + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + return TRUE; + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + + s = bfd_get_section_by_name (dynobj, ".dynbss"); + BFD_ASSERT (s != NULL); + + /* We must generate a R_MN10300_COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rela.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + asection * srel; + + srel = bfd_get_section_by_name (dynobj, ".rela.bss"); + BFD_ASSERT (srel != NULL); + srel->_raw_size += sizeof (Elf32_External_Rela); + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + } + + /* We need to figure out the alignment required for this symbol. I + have no idea how ELF linkers handle this. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > 3) + power_of_two = 3; + + /* Apply the required alignment. */ + s->_raw_size = BFD_ALIGN (s->_raw_size, + (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (dynobj, s)) + { + if (! bfd_set_section_alignment (dynobj, s, power_of_two)) + return FALSE; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + + /* Increment the section size to make room for the symbol. */ + s->_raw_size += h->size; + + return TRUE; +} + +/* This function is called via elf32_mn10300_link_hash_traverse if we are + creating a shared object with -Bsymbolic. It discards the space + allocated to copy PC relative relocs against symbols which are + defined in regular objects. We allocated space for them in the + check_relocs routine, but we won't fill them in in the + relocate_section routine. */ + +static bfd_boolean +_bfd_mn10300_elf_discard_copies (h, info) + struct elf32_mn10300_link_hash_entry *h; + struct bfd_link_info *info; +{ + struct elf_mn10300_pcrel_relocs_copied *s; + + /* If a symbol has been forced local or we have found a regular + definition for the symbolic link case, then we won't be needing + any relocs. */ + if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + && ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 + || info->symbolic)) + { + for (s = h->pcrel_relocs_copied; s != NULL; s = s->next) + s->section->_raw_size -= s->count * sizeof (Elf32_External_Rel); + } + + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +_bfd_mn10300_elf_size_dynamic_sections (output_bfd, info) + bfd * output_bfd; + struct bfd_link_info * info; +{ + bfd * dynobj; + asection * s; + bfd_boolean plt; + bfd_boolean relocs; + bfd_boolean reltext; + + dynobj = elf_hash_table (info)->dynobj; + BFD_ASSERT (dynobj != NULL); + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (info->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } + else + { + /* We may have created entries in the .rela.got section. + However, if we are not creating the dynamic sections, we will + not actually use these entries. Reset the size of .rela.got, + which will cause it to get stripped from the output file + below. */ + s = bfd_get_section_by_name (dynobj, ".rela.got"); + if (s != NULL) + s->_raw_size = 0; + } + + /* If this is a -Bsymbolic shared link, then we need to discard all + PC relative relocs against symbols defined in a regular object. + We allocated space for them in the check_relocs routine, but we + will not fill them in in the relocate_section routine. */ + if (info->shared && info->symbolic) + elf32_mn10300_link_hash_traverse (elf32_mn10300_hash_table (info), + _bfd_mn10300_elf_discard_copies, + info); + + /* The check_relocs and adjust_dynamic_symbol entry points have + determined the sizes of the various dynamic sections. Allocate + memory for them. */ + plt = FALSE; + relocs = FALSE; + reltext = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + const char * name; + bfd_boolean strip; + + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + /* It's OK to base decisions on the section name, because none + of the dynobj section names depend upon the input files. */ + name = bfd_get_section_name (dynobj, s); + + strip = FALSE; + + if (strcmp (name, ".plt") == 0) + { + if (s->_raw_size == 0) + /* Strip this section if we don't need it; see the + comment below. */ + strip = TRUE; + else + /* Remember whether there is a PLT. */ + plt = TRUE; + } + else if (strncmp (name, ".rela", 5) == 0) + { + if (s->_raw_size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + strip = TRUE; + } + else + { + asection * target; + + /* Remember whether there are any reloc sections other + than .rela.plt. */ + if (strcmp (name, ".rela.plt") != 0) + { + const char * outname; + + relocs = TRUE; + + /* If this relocation section applies to a read only + section, then we probably need a DT_TEXTREL + entry. The entries in the .rela.plt section + really apply to the .got section, which we + created ourselves and so know is not readonly. */ + outname = bfd_get_section_name (output_bfd, + s->output_section); + target = bfd_get_section_by_name (output_bfd, outname + 5); + if (target != NULL + && (target->flags & SEC_READONLY) != 0 + && (target->flags & SEC_ALLOC) != 0) + reltext = TRUE; + } + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + } + else if (strncmp (name, ".got", 4) != 0) + /* It's not one of our sections, so don't allocate space. */ + continue; + + if (strip) + { + _bfd_strip_section_from_output (info, s); + continue; + } + + /* Allocate memory for the section contents. We use bfd_zalloc + here in case unused entries are not reclaimed before the + section's contents are written out. This should not happen, + but this way if it does, we get a R_MN10300_NONE reloc + instead of garbage. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) + return FALSE; + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in _bfd_mn10300_elf_finish_dynamic_sections, + but we must add the entries now so that we get the correct + size for the .dynamic section. The DT_DEBUG entry is filled + in by the dynamic linker and used by the debugger. */ + if (! info->shared) + { + if (!_bfd_elf_add_dynamic_entry (info, DT_DEBUG, 0)) + return FALSE; + } + + if (plt) + { + if (!_bfd_elf_add_dynamic_entry (info, DT_PLTGOT, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_PLTRELSZ, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_PLTREL, DT_RELA) + || !_bfd_elf_add_dynamic_entry (info, DT_JMPREL, 0)) + return FALSE; + } + + if (relocs) + { + if (!_bfd_elf_add_dynamic_entry (info, DT_RELA, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_RELASZ, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_RELAENT, + sizeof (Elf32_External_Rela))) + return FALSE; + } + + if (reltext) + { + if (!_bfd_elf_add_dynamic_entry (info, DT_TEXTREL, 0)) + return FALSE; + } + } + + return TRUE; +} + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +static bfd_boolean +_bfd_mn10300_elf_finish_dynamic_symbol (output_bfd, info, h, sym) + bfd * output_bfd; + struct bfd_link_info * info; + struct elf_link_hash_entry * h; + Elf_Internal_Sym * sym; +{ + bfd * dynobj; + + dynobj = elf_hash_table (info)->dynobj; + + if (h->plt.offset != (bfd_vma) -1) + { + asection * splt; + asection * sgot; + asection * srel; + bfd_vma plt_index; + bfd_vma got_offset; + Elf_Internal_Rela rel; + + /* This symbol has an entry in the procedure linkage table. Set + it up. */ + + BFD_ASSERT (h->dynindx != -1); + + splt = bfd_get_section_by_name (dynobj, ".plt"); + sgot = bfd_get_section_by_name (dynobj, ".got.plt"); + srel = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); + + /* Get the index in the procedure linkage table which + corresponds to this symbol. This is the index of this symbol + in all the symbols for which we are making plt entries. The + first entry in the procedure linkage table is reserved. */ + plt_index = ((h->plt.offset - elf_mn10300_sizeof_plt0 (info)) + / elf_mn10300_sizeof_plt (info)); + + /* Get the offset into the .got table of the entry that + corresponds to this function. Each .got entry is 4 bytes. + The first three are reserved. */ + got_offset = (plt_index + 3) * 4; + + /* Fill in the entry in the procedure linkage table. */ + if (! info->shared) + { + memcpy (splt->contents + h->plt.offset, elf_mn10300_plt_entry, + elf_mn10300_sizeof_plt (info)); + bfd_put_32 (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + + got_offset), + (splt->contents + h->plt.offset + + elf_mn10300_plt_symbol_offset (info))); + + bfd_put_32 (output_bfd, + (1 - h->plt.offset - elf_mn10300_plt_plt0_offset (info)), + (splt->contents + h->plt.offset + + elf_mn10300_plt_plt0_offset (info))); + } + else + { + memcpy (splt->contents + h->plt.offset, elf_mn10300_pic_plt_entry, + elf_mn10300_sizeof_plt (info)); + + bfd_put_32 (output_bfd, got_offset, + (splt->contents + h->plt.offset + + elf_mn10300_plt_symbol_offset (info))); + } + + bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), + (splt->contents + h->plt.offset + + elf_mn10300_plt_reloc_offset (info))); + + /* Fill in the entry in the global offset table. */ + bfd_put_32 (output_bfd, + (splt->output_section->vma + + splt->output_offset + + h->plt.offset + + elf_mn10300_plt_temp_offset (info)), + sgot->contents + got_offset); + + /* Fill in the entry in the .rela.plt section. */ + rel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + got_offset); + rel.r_info = ELF32_R_INFO (h->dynindx, R_MN10300_JMP_SLOT); + rel.r_addend = 0; + bfd_elf32_swap_reloca_out (output_bfd, &rel, + (bfd_byte *) ((Elf32_External_Rela *) srel->contents + + plt_index)); + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + } + + if (h->got.offset != (bfd_vma) -1) + { + asection * sgot; + asection * srel; + Elf_Internal_Rela rel; + + /* This symbol has an entry in the global offset table. Set it up. */ + + sgot = bfd_get_section_by_name (dynobj, ".got"); + srel = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (sgot != NULL && srel != NULL); + + rel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + (h->got.offset &~ 1)); + + /* If this is a -Bsymbolic link, and the symbol is defined + locally, we just want to emit a RELATIVE reloc. Likewise if + the symbol was forced to be local because of a version file. + The entry in the global offset table will already have been + initialized in the relocate_section function. */ + if (info->shared + && (info->symbolic || h->dynindx == -1) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + { + rel.r_info = ELF32_R_INFO (0, R_MN10300_RELATIVE); + rel.r_addend = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + else + { + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); + rel.r_info = ELF32_R_INFO (h->dynindx, R_MN10300_GLOB_DAT); + rel.r_addend = 0; + } + + bfd_elf32_swap_reloca_out (output_bfd, &rel, + (bfd_byte *) ((Elf32_External_Rela *) srel->contents + + srel->reloc_count)); + ++ srel->reloc_count; + } + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + { + asection * s; + Elf_Internal_Rela rel; + + /* This symbol needs a copy reloc. Set it up. */ + BFD_ASSERT (h->dynindx != -1 + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)); + + s = bfd_get_section_by_name (h->root.u.def.section->owner, + ".rela.bss"); + BFD_ASSERT (s != NULL); + + rel.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + rel.r_info = ELF32_R_INFO (h->dynindx, R_MN10300_COPY); + rel.r_addend = 0; + bfd_elf32_swap_reloca_out (output_bfd, &rel, + (bfd_byte *) ((Elf32_External_Rela *) s->contents + + s->reloc_count)); + ++ s->reloc_count; + } + + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + sym->st_shndx = SHN_ABS; + + return TRUE; +} + +/* Finish up the dynamic sections. */ + +static bfd_boolean +_bfd_mn10300_elf_finish_dynamic_sections (output_bfd, info) + bfd * output_bfd; + struct bfd_link_info * info; +{ + bfd * dynobj; + asection * sgot; + asection * sdyn; + + dynobj = elf_hash_table (info)->dynobj; + + sgot = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (sgot != NULL); + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (elf_hash_table (info)->dynamic_sections_created) + { + asection * splt; + Elf32_External_Dyn * dyncon; + Elf32_External_Dyn * dynconend; + + BFD_ASSERT (sdyn != NULL); + + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + const char * name; + asection * s; + + bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + break; + + case DT_PLTGOT: + name = ".got"; + goto get_vma; + + case DT_JMPREL: + name = ".rela.plt"; + get_vma: + s = bfd_get_section_by_name (output_bfd, name); + BFD_ASSERT (s != NULL); + dyn.d_un.d_ptr = s->vma; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_PLTRELSZ: + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + BFD_ASSERT (s != NULL); + if (s->_cooked_size != 0) + dyn.d_un.d_val = s->_cooked_size; + else + dyn.d_un.d_val = s->_raw_size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_RELASZ: + /* My reading of the SVR4 ABI indicates that the + procedure linkage table relocs (DT_JMPREL) should be + included in the overall relocs (DT_RELA). This is + what Solaris does. However, UnixWare can not handle + that case. Therefore, we override the DT_RELASZ entry + here to make it not include the JMPREL relocs. Since + the linker script arranges for .rela.plt to follow all + other relocation sections, we don't have to worry + about changing the DT_RELA entry. */ + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + if (s != NULL) + { + if (s->_cooked_size != 0) + dyn.d_un.d_val -= s->_cooked_size; + else + dyn.d_un.d_val -= s->_raw_size; + } + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + } + } + + /* Fill in the first entry in the procedure linkage table. */ + splt = bfd_get_section_by_name (dynobj, ".plt"); + if (splt && splt->_raw_size > 0) + { + if (info->shared) + { + memcpy (splt->contents, elf_mn10300_pic_plt_entry, + elf_mn10300_sizeof_plt (info)); + } + else + { + memcpy (splt->contents, elf_mn10300_plt0_entry, PLT0_ENTRY_SIZE); + bfd_put_32 (output_bfd, + sgot->output_section->vma + sgot->output_offset + 4, + splt->contents + elf_mn10300_plt0_gotid_offset (info)); + bfd_put_32 (output_bfd, + sgot->output_section->vma + sgot->output_offset + 8, + splt->contents + elf_mn10300_plt0_linker_offset (info)); + } + + /* UnixWare sets the entsize of .plt to 4, although that doesn't + really seem like the right value. */ + elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4; + } + } + + /* Fill in the first three entries in the global offset table. */ + if (sgot->_raw_size > 0) + { + if (sdyn == NULL) + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + else + bfd_put_32 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + sgot->contents); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + } + + elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; + + return TRUE; +} + +#ifndef ELF_ARCH +#define TARGET_LITTLE_SYM bfd_elf32_mn10300_vec +#define TARGET_LITTLE_NAME "elf32-mn10300" +#define ELF_ARCH bfd_arch_mn10300 +#define ELF_MACHINE_CODE EM_MN10300 +#define ELF_MACHINE_ALT1 EM_CYGNUS_MN10300 +#define ELF_MAXPAGESIZE 0x1000 +#endif + +#define elf_info_to_howto mn10300_info_to_howto +#define elf_info_to_howto_rel 0 +#define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 +#define elf_backend_check_relocs mn10300_elf_check_relocs +#define elf_backend_gc_mark_hook mn10300_elf_gc_mark_hook +#define elf_backend_relocate_section mn10300_elf_relocate_section +#define bfd_elf32_bfd_relax_section mn10300_elf_relax_section +#define bfd_elf32_bfd_get_relocated_section_contents \ + mn10300_elf_get_relocated_section_contents +#define bfd_elf32_bfd_link_hash_table_create \ + elf32_mn10300_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_free \ + elf32_mn10300_link_hash_table_free + +#ifndef elf_symbol_leading_char +#define elf_symbol_leading_char '_' +#endif + +/* So we can set bits in e_flags. */ +#define elf_backend_final_write_processing \ + _bfd_mn10300_elf_final_write_processing +#define elf_backend_object_p _bfd_mn10300_elf_object_p + +#define bfd_elf32_bfd_merge_private_bfd_data \ + _bfd_mn10300_elf_merge_private_bfd_data + +#define elf_backend_can_gc_sections 1 +#define elf_backend_create_dynamic_sections \ + _bfd_mn10300_elf_create_dynamic_sections +#define elf_backend_adjust_dynamic_symbol \ + _bfd_mn10300_elf_adjust_dynamic_symbol +#define elf_backend_size_dynamic_sections \ + _bfd_mn10300_elf_size_dynamic_sections +#define elf_backend_finish_dynamic_symbol \ + _bfd_mn10300_elf_finish_dynamic_symbol +#define elf_backend_finish_dynamic_sections \ + _bfd_mn10300_elf_finish_dynamic_sections + +#define elf_backend_want_got_plt 1 +#define elf_backend_plt_readonly 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_got_header_size 12 + +#include "elf32-target.h" diff --git a/bfd/elf32-am33lin.c b/bfd/elf32-am33lin.c new file mode 100644 index 0000000000000..32e56635e38ef --- /dev/null +++ b/bfd/elf32-am33lin.c @@ -0,0 +1,35 @@ +/* Matsushita AM33/2.0 support for 32-bit GNU/Linux ELF + Copyright 2003 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#define elf_symbol_leading_char 0 + +#define TARGET_LITTLE_SYM bfd_elf32_am33lin_vec +#define TARGET_LITTLE_NAME "elf32-am33lin" +#define ELF_ARCH bfd_arch_mn10300 +#define ELF_MACHINE_CODE EM_MN10300 +#define ELF_MACHINE_ALT1 EM_CYGNUS_MN10300 +#define ELF_MAXPAGESIZE 0x1000 + +/* Rename global functions. */ +#define _bfd_mn10300_elf_merge_private_bfd_data _bfd_am33_elf_merge_private_bfd_data +#define _bfd_mn10300_elf_object_p _bfd_am33_elf_object_p +#define _bfd_mn10300_elf_final_write_processing _bfd_am33_elf_final_write_processing + +#include "elf-m10300.c" diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c new file mode 100644 index 0000000000000..06e398b542d82 --- /dev/null +++ b/bfd/elf32-avr.c @@ -0,0 +1,918 @@ +/* AVR-specific support for 32-bit ELF + Copyright 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + Contributed by Denis Chertykov + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/avr.h" + +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void avr_info_to_howto_rela + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static asection *elf32_avr_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static bfd_boolean elf32_avr_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static bfd_boolean elf32_avr_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static bfd_reloc_status_type avr_final_link_relocate + PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, bfd_vma)); +static bfd_boolean elf32_avr_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static void bfd_elf_avr_final_write_processing PARAMS ((bfd *, bfd_boolean)); +static bfd_boolean elf32_avr_object_p PARAMS ((bfd *)); + +static reloc_howto_type elf_avr_howto_table[] = +{ + HOWTO (R_AVR_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_AVR_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 7 bit PC relative relocation. */ + HOWTO (R_AVR_7_PCREL, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 7, /* bitsize */ + TRUE, /* pc_relative */ + 3, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_7_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 13 bit PC relative relocation. */ + HOWTO (R_AVR_13_PCREL, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_13_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 16 bit absolute relocation. */ + HOWTO (R_AVR_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 16 bit absolute relocation for command address. */ + HOWTO (R_AVR_16_PM, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_16_PM", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* A low 8 bit absolute relocation of 16 bit address. + For LDI command. */ + HOWTO (R_AVR_LO8_LDI, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_LO8_LDI", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* A high 8 bit absolute relocation of 16 bit address. + For LDI command. */ + HOWTO (R_AVR_HI8_LDI, /* type */ + 8, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_HI8_LDI", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* A high 6 bit absolute relocation of 22 bit address. + For LDI command. */ + HOWTO (R_AVR_HH8_LDI, /* type */ + 16, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_HH8_LDI", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* A negative low 8 bit absolute relocation of 16 bit address. + For LDI command. */ + HOWTO (R_AVR_LO8_LDI_NEG, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_LO8_LDI_NEG", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* A hegative high 8 bit absolute relocation of 16 bit address. + For LDI command. */ + HOWTO (R_AVR_HI8_LDI_NEG, /* type */ + 8, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_HI8_LDI_NEG", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* A hegative high 6 bit absolute relocation of 22 bit address. + For LDI command. */ + HOWTO (R_AVR_HH8_LDI_NEG, /* type */ + 16, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_HH8_LDI_NEG", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* A low 8 bit absolute relocation of 24 bit program memory address. + For LDI command. */ + HOWTO (R_AVR_LO8_LDI_PM, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_LO8_LDI_PM", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* A high 8 bit absolute relocation of 16 bit program memory address. + For LDI command. */ + HOWTO (R_AVR_HI8_LDI_PM, /* type */ + 9, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_HI8_LDI_PM", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* A high 8 bit absolute relocation of 24 bit program memory address. + For LDI command. */ + HOWTO (R_AVR_HH8_LDI_PM, /* type */ + 17, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_HH8_LDI_PM", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* A low 8 bit absolute relocation of a negative 24 bit + program memory address. For LDI command. */ + HOWTO (R_AVR_LO8_LDI_PM_NEG, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_LO8_LDI_PM_NEG", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* A high 8 bit absolute relocation of a negative 16 bit + program memory address. For LDI command. */ + HOWTO (R_AVR_HI8_LDI_PM_NEG, /* type */ + 9, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_HI8_LDI_PM_NEG", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* A high 8 bit absolute relocation of a negative 24 bit + program memory address. For LDI command. */ + HOWTO (R_AVR_HH8_LDI_PM_NEG, /* type */ + 17, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_HH8_LDI_PM_NEG", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* Relocation for CALL command in ATmega. */ + HOWTO (R_AVR_CALL, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 23, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_CALL", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE) /* pcrel_offset */ +}; + +/* Map BFD reloc types to AVR ELF reloc types. */ + +struct avr_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned int elf_reloc_val; +}; + + static const struct avr_reloc_map avr_reloc_map[] = +{ + { BFD_RELOC_NONE, R_AVR_NONE }, + { BFD_RELOC_32, R_AVR_32 }, + { BFD_RELOC_AVR_7_PCREL, R_AVR_7_PCREL }, + { BFD_RELOC_AVR_13_PCREL, R_AVR_13_PCREL }, + { BFD_RELOC_16, R_AVR_16 }, + { BFD_RELOC_AVR_16_PM, R_AVR_16_PM }, + { BFD_RELOC_AVR_LO8_LDI, R_AVR_LO8_LDI}, + { BFD_RELOC_AVR_HI8_LDI, R_AVR_HI8_LDI }, + { BFD_RELOC_AVR_HH8_LDI, R_AVR_HH8_LDI }, + { BFD_RELOC_AVR_LO8_LDI_NEG, R_AVR_LO8_LDI_NEG }, + { BFD_RELOC_AVR_HI8_LDI_NEG, R_AVR_HI8_LDI_NEG }, + { BFD_RELOC_AVR_HH8_LDI_NEG, R_AVR_HH8_LDI_NEG }, + { BFD_RELOC_AVR_LO8_LDI_PM, R_AVR_LO8_LDI_PM }, + { BFD_RELOC_AVR_HI8_LDI_PM, R_AVR_HI8_LDI_PM }, + { BFD_RELOC_AVR_HH8_LDI_PM, R_AVR_HH8_LDI_PM }, + { BFD_RELOC_AVR_LO8_LDI_PM_NEG, R_AVR_LO8_LDI_PM_NEG }, + { BFD_RELOC_AVR_HI8_LDI_PM_NEG, R_AVR_HI8_LDI_PM_NEG }, + { BFD_RELOC_AVR_HH8_LDI_PM_NEG, R_AVR_HH8_LDI_PM_NEG }, + { BFD_RELOC_AVR_CALL, R_AVR_CALL } +}; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; + i < sizeof (avr_reloc_map) / sizeof (struct avr_reloc_map); + i++) + { + if (avr_reloc_map[i].bfd_reloc_val == code) + return &elf_avr_howto_table[avr_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Set the howto pointer for an AVR ELF reloc. */ + +static void +avr_info_to_howto_rela (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_AVR_max); + cache_ptr->howto = &elf_avr_howto_table[r_type]; +} + +static asection * +elf32_avr_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +static bfd_boolean +elf32_avr_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +{ + /* We don't use got and plt entries for avr. */ + return TRUE; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static bfd_boolean +elf32_avr_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + } + + return TRUE; +} + +/* Perform a single relocation. By default we use the standard BFD + routines, but a few relocs, we have to do them ourselves. */ + +static bfd_reloc_status_type +avr_final_link_relocate (howto, input_bfd, input_section, + contents, rel, relocation) + reloc_howto_type * howto; + bfd * input_bfd; + asection * input_section; + bfd_byte * contents; + Elf_Internal_Rela * rel; + bfd_vma relocation; +{ + bfd_reloc_status_type r = bfd_reloc_ok; + bfd_vma x; + bfd_signed_vma srel; + + switch (howto->type) + { + case R_AVR_7_PCREL: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation; + srel += rel->r_addend; + srel -= rel->r_offset; + srel -= 2; /* Branch instructions add 2 to the PC... */ + srel -= (input_section->output_section->vma + + input_section->output_offset); + + if (srel & 1) + return bfd_reloc_outofrange; + if (srel > ((1 << 7) - 1) || (srel < - (1 << 7))) + return bfd_reloc_overflow; + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xfc07) | (((srel >> 1) << 3) & 0x3f8); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_13_PCREL: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation; + srel += rel->r_addend; + srel -= rel->r_offset; + srel -= 2; /* Branch instructions add 2 to the PC... */ + srel -= (input_section->output_section->vma + + input_section->output_offset); + + if (srel & 1) + return bfd_reloc_outofrange; + + /* AVR addresses commands as words. */ + srel >>= 1; + + /* Check for overflow. */ + if (srel < -2048 || srel > 2047) + { + /* Apply WRAPAROUND if possible. */ + switch (bfd_get_mach (input_bfd)) + { + case bfd_mach_avr2: + case bfd_mach_avr4: + break; + + default: + return bfd_reloc_overflow; + } + } + + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf000) | (srel & 0xfff); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_LO8_LDI: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation + rel->r_addend; + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_HI8_LDI: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation + rel->r_addend; + srel = (srel >> 8) & 0xff; + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_HH8_LDI: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation + rel->r_addend; + srel = (srel >> 16) & 0xff; + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_LO8_LDI_NEG: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation + rel->r_addend; + srel = -srel; + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_HI8_LDI_NEG: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation + rel->r_addend; + srel = -srel; + srel = (srel >> 8) & 0xff; + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_HH8_LDI_NEG: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation + rel->r_addend; + srel = -srel; + srel = (srel >> 16) & 0xff; + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_LO8_LDI_PM: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation + rel->r_addend; + if (srel & 1) + return bfd_reloc_outofrange; + srel = srel >> 1; + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_HI8_LDI_PM: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation + rel->r_addend; + if (srel & 1) + return bfd_reloc_outofrange; + srel = srel >> 1; + srel = (srel >> 8) & 0xff; + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_HH8_LDI_PM: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation + rel->r_addend; + if (srel & 1) + return bfd_reloc_outofrange; + srel = srel >> 1; + srel = (srel >> 16) & 0xff; + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_LO8_LDI_PM_NEG: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation + rel->r_addend; + srel = -srel; + if (srel & 1) + return bfd_reloc_outofrange; + srel = srel >> 1; + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_HI8_LDI_PM_NEG: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation + rel->r_addend; + srel = -srel; + if (srel & 1) + return bfd_reloc_outofrange; + srel = srel >> 1; + srel = (srel >> 8) & 0xff; + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_HH8_LDI_PM_NEG: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation + rel->r_addend; + srel = -srel; + if (srel & 1) + return bfd_reloc_outofrange; + srel = srel >> 1; + srel = (srel >> 16) & 0xff; + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf0f0) | (srel & 0xf) | ((srel << 4) & 0xf00); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_AVR_CALL: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation + rel->r_addend; + if (srel & 1) + return bfd_reloc_outofrange; + srel = srel >> 1; + x = bfd_get_16 (input_bfd, contents); + x |= ((srel & 0x10000) | ((srel << 3) & 0x1f00000)) >> 16; + bfd_put_16 (input_bfd, x, contents); + bfd_put_16 (input_bfd, (bfd_vma) srel & 0xffff, contents+2); + break; + + default: + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + } + + return r; +} + +/* Relocate an AVR ELF section. */ +static bfd_boolean +elf32_avr_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr * symtab_hdr; + struct elf_link_hash_entry ** sym_hashes; + Elf_Internal_Rela * rel; + Elf_Internal_Rela * relend; + + if (info->relocatable) + return TRUE; + + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + relend = relocs + input_section->reloc_count; + + for (rel = relocs; rel < relend; rel ++) + { + reloc_howto_type * howto; + unsigned long r_symndx; + Elf_Internal_Sym * sym; + asection * sec; + struct elf_link_hash_entry * h; + bfd_vma relocation; + bfd_reloc_status_type r; + const char * name = NULL; + int r_type; + + /* This is a final link. */ + r_type = ELF32_R_TYPE (rel->r_info); + r_symndx = ELF32_R_SYM (rel->r_info); + howto = elf_avr_howto_table + ELF32_R_TYPE (rel->r_info); + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); + name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + } + else + { + bfd_boolean unresolved_reloc, warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + } + + r = avr_final_link_relocate (howto, input_bfd, input_section, + contents, rel, relocation); + + if (r != bfd_reloc_ok) + { + const char * msg = (const char *) NULL; + + switch (r) + { + case bfd_reloc_overflow: + r = info->callbacks->reloc_overflow + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset); + break; + + case bfd_reloc_undefined: + r = info->callbacks->undefined_symbol + (info, name, input_bfd, input_section, rel->r_offset, TRUE); + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + break; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + break; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous relocation"); + break; + + default: + msg = _("internal error: unknown error"); + break; + } + + if (msg) + r = info->callbacks->warning + (info, msg, name, input_bfd, input_section, rel->r_offset); + + if (! r) + return FALSE; + } + } + + return TRUE; +} + +/* The final processing done just before writing out a AVR ELF object + file. This gets the AVR architecture right based on the machine + number. */ + +static void +bfd_elf_avr_final_write_processing (abfd, linker) + bfd *abfd; + bfd_boolean linker ATTRIBUTE_UNUSED; +{ + unsigned long val; + + switch (bfd_get_mach (abfd)) + { + default: + case bfd_mach_avr2: + val = E_AVR_MACH_AVR2; + break; + + case bfd_mach_avr1: + val = E_AVR_MACH_AVR1; + break; + + case bfd_mach_avr3: + val = E_AVR_MACH_AVR3; + break; + + case bfd_mach_avr4: + val = E_AVR_MACH_AVR4; + break; + + case bfd_mach_avr5: + val = E_AVR_MACH_AVR5; + break; + } + + elf_elfheader (abfd)->e_machine = EM_AVR; + elf_elfheader (abfd)->e_flags &= ~ EF_AVR_MACH; + elf_elfheader (abfd)->e_flags |= val; +} + +/* Set the right machine number. */ + +static bfd_boolean +elf32_avr_object_p (abfd) + bfd *abfd; +{ + unsigned int e_set = bfd_mach_avr2; + if (elf_elfheader (abfd)->e_machine == EM_AVR + || elf_elfheader (abfd)->e_machine == EM_AVR_OLD) + { + int e_mach = elf_elfheader (abfd)->e_flags & EF_AVR_MACH; + switch (e_mach) + { + default: + case E_AVR_MACH_AVR2: + e_set = bfd_mach_avr2; + break; + + case E_AVR_MACH_AVR1: + e_set = bfd_mach_avr1; + break; + + case E_AVR_MACH_AVR3: + e_set = bfd_mach_avr3; + break; + + case E_AVR_MACH_AVR4: + e_set = bfd_mach_avr4; + break; + + case E_AVR_MACH_AVR5: + e_set = bfd_mach_avr5; + break; + } + } + return bfd_default_set_arch_mach (abfd, bfd_arch_avr, + e_set); +} + +#define ELF_ARCH bfd_arch_avr +#define ELF_MACHINE_CODE EM_AVR +#define ELF_MACHINE_ALT1 EM_AVR_OLD +#define ELF_MAXPAGESIZE 1 + +#define TARGET_LITTLE_SYM bfd_elf32_avr_vec +#define TARGET_LITTLE_NAME "elf32-avr" + +#define elf_info_to_howto avr_info_to_howto_rela +#define elf_info_to_howto_rel NULL +#define elf_backend_relocate_section elf32_avr_relocate_section +#define elf_backend_gc_mark_hook elf32_avr_gc_mark_hook +#define elf_backend_gc_sweep_hook elf32_avr_gc_sweep_hook +#define elf_backend_check_relocs elf32_avr_check_relocs +#define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 +#define elf_backend_final_write_processing \ + bfd_elf_avr_final_write_processing +#define elf_backend_object_p elf32_avr_object_p + +#include "elf32-target.h" diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c new file mode 100644 index 0000000000000..775fd0e7c3203 --- /dev/null +++ b/bfd/elf32-cris.c @@ -0,0 +1,3121 @@ +/* CRIS-specific support for 32-bit ELF. + Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Contributed by Axis Communications AB. + Written by Hans-Peter Nilsson, based on elf32-fr30.c + PIC and shlib bits based primarily on elf32-m68k.c and elf32-i386.c. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/cris.h" + +/* Forward declarations. */ +static reloc_howto_type * cris_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); + +static void cris_info_to_howto_rela + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + +static bfd_boolean cris_elf_grok_prstatus + PARAMS ((bfd *abfd, Elf_Internal_Note *note)); + +static bfd_boolean cris_elf_grok_psinfo + PARAMS ((bfd *abfd, Elf_Internal_Note *note)); + +static bfd_boolean cris_elf_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); + +static bfd_reloc_status_type cris_final_link_relocate + PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, bfd_vma)); + +static bfd_boolean cris_elf_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); + +static asection * cris_elf_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); + +static bfd_boolean cris_elf_object_p PARAMS ((bfd *)); + +static void cris_elf_final_write_processing PARAMS ((bfd *, bfd_boolean)); + +static bfd_boolean cris_elf_print_private_bfd_data PARAMS ((bfd *, PTR)); + +static bfd_boolean cris_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *)); + +struct elf_cris_link_hash_entry; +static bfd_boolean elf_cris_discard_excess_dso_dynamics + PARAMS ((struct elf_cris_link_hash_entry *, PTR)); +static bfd_boolean elf_cris_discard_excess_program_dynamics + PARAMS ((struct elf_cris_link_hash_entry *, PTR)); +static bfd_boolean elf_cris_adjust_gotplt_to_got + PARAMS ((struct elf_cris_link_hash_entry *, PTR)); +static bfd_boolean elf_cris_try_fold_plt_to_got + PARAMS ((struct elf_cris_link_hash_entry *, PTR)); +static struct bfd_hash_entry *elf_cris_link_hash_newfunc + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +static struct bfd_link_hash_table *elf_cris_link_hash_table_create + PARAMS ((bfd *)); +static bfd_boolean elf_cris_adjust_dynamic_symbol + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); +static bfd_boolean cris_elf_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); + +static bfd_boolean elf_cris_size_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean elf_cris_finish_dynamic_symbol + PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *)); +static bfd_boolean elf_cris_finish_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static void elf_cris_hide_symbol + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean)); +static enum elf_reloc_type_class elf_cris_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); + +static reloc_howto_type cris_elf_howto_table [] = +{ + /* This reloc does nothing. */ + HOWTO (R_CRIS_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 8 bit absolute relocation. */ + HOWTO (R_CRIS_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_8", /* name */ + FALSE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0x00ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 16 bit absolute relocation. */ + HOWTO (R_CRIS_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_16", /* name */ + FALSE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit absolute relocation. */ + HOWTO (R_CRIS_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_32", /* name */ + FALSE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 8 bit PC-relative relocation. */ + HOWTO (R_CRIS_8_PCREL, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_8_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0x00ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 16 bit PC-relative relocation. */ + HOWTO (R_CRIS_16_PCREL, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 32 bit PC-relative relocation. */ + HOWTO (R_CRIS_32_PCREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_32_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy. */ + HOWTO (R_CRIS_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_CRIS_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage. */ + HOWTO (R_CRIS_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_CRIS_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* This is used only by the dynamic linker. The symbol should exist + both in the object being run and in some shared library. The + dynamic linker copies the data addressed by the symbol from the + shared library into the object, because the object being + run has to have the data at some particular address. */ + HOWTO (R_CRIS_COPY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_COPY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Like R_CRIS_32, but used when setting global offset table entries. */ + HOWTO (R_CRIS_GLOB_DAT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_GLOB_DAT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Marks a procedure linkage table entry for a symbol. */ + HOWTO (R_CRIS_JUMP_SLOT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_JUMP_SLOT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used only by the dynamic linker. When the object is run, this + longword is set to the load address of the object, plus the + addend. */ + HOWTO (R_CRIS_RELATIVE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_RELATIVE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Like R_CRIS_32, but referring to the GOT table entry for the symbol. */ + HOWTO (R_CRIS_16_GOT, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_16_GOT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CRIS_32_GOT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_32_GOT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Like R_CRIS_32_GOT, but referring to (and requesting a) PLT part of + the GOT table for the symbol. */ + HOWTO (R_CRIS_16_GOTPLT, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_16_GOTPLT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_CRIS_32_GOTPLT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_32_GOTPLT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32-bit offset from GOT to (local const) symbol: no GOT entry should + be necessary. */ + HOWTO (R_CRIS_32_GOTREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_32_GOTREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32-bit offset from GOT to entry for this symbol in PLT and request + to create PLT entry for symbol. */ + HOWTO (R_CRIS_32_PLT_GOTREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_32_PLT_GOTREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32-bit offset from PC (location after the relocation) + addend to + entry for this symbol in PLT and request to create PLT entry for + symbol. */ + HOWTO (R_CRIS_32_PLT_PCREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_CRIS_32_PLT_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE) /* pcrel_offset */ +}; + +/* Map BFD reloc types to CRIS ELF reloc types. */ + +struct cris_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned int cris_reloc_val; +}; + +static const struct cris_reloc_map cris_reloc_map [] = +{ + { BFD_RELOC_NONE, R_CRIS_NONE }, + { BFD_RELOC_8, R_CRIS_8 }, + { BFD_RELOC_16, R_CRIS_16 }, + { BFD_RELOC_32, R_CRIS_32 }, + { BFD_RELOC_8_PCREL, R_CRIS_8_PCREL }, + { BFD_RELOC_16_PCREL, R_CRIS_16_PCREL }, + { BFD_RELOC_32_PCREL, R_CRIS_32_PCREL }, + { BFD_RELOC_VTABLE_INHERIT, R_CRIS_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_CRIS_GNU_VTENTRY }, + { BFD_RELOC_CRIS_COPY, R_CRIS_COPY }, + { BFD_RELOC_CRIS_GLOB_DAT, R_CRIS_GLOB_DAT }, + { BFD_RELOC_CRIS_JUMP_SLOT, R_CRIS_JUMP_SLOT }, + { BFD_RELOC_CRIS_RELATIVE, R_CRIS_RELATIVE }, + { BFD_RELOC_CRIS_16_GOT, R_CRIS_16_GOT }, + { BFD_RELOC_CRIS_32_GOT, R_CRIS_32_GOT }, + { BFD_RELOC_CRIS_16_GOTPLT, R_CRIS_16_GOTPLT }, + { BFD_RELOC_CRIS_32_GOTPLT, R_CRIS_32_GOTPLT }, + { BFD_RELOC_CRIS_32_GOTREL, R_CRIS_32_GOTREL }, + { BFD_RELOC_CRIS_32_PLT_GOTREL, R_CRIS_32_PLT_GOTREL }, + { BFD_RELOC_CRIS_32_PLT_PCREL, R_CRIS_32_PLT_PCREL } +}; + +static reloc_howto_type * +cris_reloc_type_lookup (abfd, code) + bfd * abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; i < sizeof (cris_reloc_map) / sizeof (cris_reloc_map[0]); i++) + if (cris_reloc_map [i].bfd_reloc_val == code) + return & cris_elf_howto_table [cris_reloc_map[i].cris_reloc_val]; + + return NULL; +} + +/* Set the howto pointer for an CRIS ELF reloc. */ + +static void +cris_info_to_howto_rela (abfd, cache_ptr, dst) + bfd * abfd ATTRIBUTE_UNUSED; + arelent * cache_ptr; + Elf_Internal_Rela * dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_CRIS_max); + cache_ptr->howto = & cris_elf_howto_table [r_type]; +} + +/* Support for core dump NOTE sections. */ + +static bfd_boolean +cris_elf_grok_prstatus (abfd, note) + bfd *abfd; + Elf_Internal_Note *note; +{ + int offset; + size_t raw_size; + + switch (note->descsz) + { + default: + return FALSE; + + case 214: /* Linux/CRIS */ + /* pr_cursig */ + elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); + + /* pr_pid */ + elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 22); + + /* pr_reg */ + offset = 70; + raw_size = 140; + + break; + } + + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", + raw_size, note->descpos + offset); +} + +static bfd_boolean +cris_elf_grok_psinfo (abfd, note) + bfd *abfd; + Elf_Internal_Note *note; +{ + switch (note->descsz) + { + default: + return FALSE; + + case 124: /* Linux/CRIS elf_prpsinfo */ + elf_tdata (abfd)->core_program + = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); + elf_tdata (abfd)->core_command + = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); + } + + /* Note that for some reason, a spurious space is tacked + onto the end of the args in some (at least one anyway) + implementations, so strip it off if it exists. */ + + { + char *command = elf_tdata (abfd)->core_command; + int n = strlen (command); + + if (0 < n && command[n - 1] == ' ') + command[n - 1] = '\0'; + } + + return TRUE; +} + +/* The name of the dynamic interpreter. This is put in the .interp + section. */ + +#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1" + +/* The size in bytes of an entry in the procedure linkage table. */ + +#define PLT_ENTRY_SIZE 20 + +/* The first entry in an absolute procedure linkage table looks like this. */ + +static const bfd_byte elf_cris_plt0_entry[PLT_ENTRY_SIZE] = +{ + 0xfc, 0xe1, + 0x7e, 0x7e, /* push mof. */ + 0x7f, 0x0d, /* (dip [pc+]) */ + 0, 0, 0, 0, /* Replaced with address of .got + 4. */ + 0x30, 0x7a, /* move [...],mof */ + 0x7f, 0x0d, /* (dip [pc+]) */ + 0, 0, 0, 0, /* Replaced with address of .got + 8. */ + 0x30, 0x09, /* jump [...] */ +}; + +/* Subsequent entries in an absolute procedure linkage table look like + this. */ + +static const bfd_byte elf_cris_plt_entry[PLT_ENTRY_SIZE] = +{ + 0x7f, 0x0d, /* (dip [pc+]) */ + 0, 0, 0, 0, /* Replaced with address of this symbol in .got. */ + 0x30, 0x09, /* jump [...] */ + 0x3f, 0x7e, /* move [pc+],mof */ + 0, 0, 0, 0, /* Replaced with offset into relocation table. */ + 0x2f, 0xfe, /* add.d [pc+],pc */ + 0xec, 0xff, + 0xff, 0xff /* Replaced with offset to start of .plt. */ +}; + +/* The first entry in a PIC procedure linkage table looks like this. */ + +static const bfd_byte elf_cris_pic_plt0_entry[PLT_ENTRY_SIZE] = +{ + 0xfc, 0xe1, 0x7e, 0x7e, /* push mof */ + 0x04, 0x01, 0x30, 0x7a, /* move [r0+4],mof */ + 0x08, 0x01, 0x30, 0x09, /* jump [r0+8] */ + 0, 0, 0, 0, 0, 0, 0, 0, /* Pad out to 20 bytes. */ +}; + +/* Subsequent entries in a PIC procedure linkage table look like this. */ + +static const bfd_byte elf_cris_pic_plt_entry[PLT_ENTRY_SIZE] = +{ + 0x6f, 0x0d, /* (bdap [pc+].d,r0) */ + 0, 0, 0, 0, /* Replaced with offset of this symbol in .got. */ + 0x30, 0x09, /* jump [...] */ + 0x3f, 0x7e, /* move [pc+],mof */ + 0, 0, 0, 0, /* Replaced with offset into relocation table. */ + 0x2f, 0xfe, /* add.d [pc+],pc */ + 0xec, 0xff, /* Replaced with offset to start of .plt. */ + 0xff, 0xff +}; + +/* We copy elf32-m68k.c and elf32-i386.c for the basic linker hash bits + (and most other PIC/shlib stuff). Check that we don't drift away + without reason. + + The CRIS linker, like the m68k and i386 linkers (and probably the rest + too) needs to keep track of the number of relocs that it decides to + copy in check_relocs for each symbol. This is so that it can discard + PC relative relocs if it doesn't need them when linking with + -Bsymbolic. We store the information in a field extending the regular + ELF linker hash table. */ + +/* This structure keeps track of the number of PC relative relocs we have + copied for a given symbol. */ + +struct elf_cris_pcrel_relocs_copied +{ + /* Next section. */ + struct elf_cris_pcrel_relocs_copied *next; + /* A section in dynobj. */ + asection *section; + /* Number of relocs copied in this section. */ + bfd_size_type count; +}; + +/* CRIS ELF linker hash entry. */ + +struct elf_cris_link_hash_entry +{ + struct elf_link_hash_entry root; + + /* Number of PC relative relocs copied for this symbol. */ + struct elf_cris_pcrel_relocs_copied *pcrel_relocs_copied; + + /* The GOTPLT references are CRIS-specific; the goal is to avoid having + both a general GOT and a PLT-specific GOT entry for the same symbol, + when it is referenced both as a function and as a function pointer. + + Number of GOTPLT references for a function. */ + bfd_signed_vma gotplt_refcount; + + /* Actual GOTPLT index for this symbol, if applicable, or zero if not + (zero is never used as an index). FIXME: We should be able to fold + this with gotplt_refcount in a union, like the got and plt unions in + elf_link_hash_entry. */ + bfd_size_type gotplt_offset; +}; + +/* CRIS ELF linker hash table. */ + +struct elf_cris_link_hash_table +{ + struct elf_link_hash_table root; + + /* We can't use the PLT offset and calculate to get the GOTPLT offset, + since we try and avoid creating GOTPLT:s when there's already a GOT. + Instead, we keep and update the next available index here. */ + bfd_size_type next_gotplt_entry; +}; + +/* Traverse a CRIS ELF linker hash table. */ + +#define elf_cris_link_hash_traverse(table, func, info) \ + (elf_link_hash_traverse \ + (&(table)->root, \ + (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ + (info))) + +/* Get the CRIS ELF linker hash table from a link_info structure. */ + +#define elf_cris_hash_table(p) \ + ((struct elf_cris_link_hash_table *) (p)->hash) + +/* Create an entry in a CRIS ELF linker hash table. */ + +static struct bfd_hash_entry * +elf_cris_link_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct elf_cris_link_hash_entry *ret = + (struct elf_cris_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct elf_cris_link_hash_entry *) NULL) + ret = ((struct elf_cris_link_hash_entry *) + bfd_hash_allocate (table, + sizeof (struct elf_cris_link_hash_entry))); + if (ret == (struct elf_cris_link_hash_entry *) NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct elf_cris_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != (struct elf_cris_link_hash_entry *) NULL) + { + ret->pcrel_relocs_copied = NULL; + ret->gotplt_refcount = 0; + ret->gotplt_offset = 0; + } + + return (struct bfd_hash_entry *) ret; +} + +/* Create a CRIS ELF linker hash table. */ + +static struct bfd_link_hash_table * +elf_cris_link_hash_table_create (abfd) + bfd *abfd; +{ + struct elf_cris_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_cris_link_hash_table); + + ret = ((struct elf_cris_link_hash_table *) bfd_malloc (amt)); + if (ret == (struct elf_cris_link_hash_table *) NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + elf_cris_link_hash_newfunc)) + { + free (ret); + return NULL; + } + + /* Initialize to skip over the first three entries in the gotplt; they + are used for run-time symbol evaluation. */ + ret->next_gotplt_entry = 12; + + return &ret->root.root; +} + +/* Perform a single relocation. By default we use the standard BFD + routines, with a few tweaks. */ + +static bfd_reloc_status_type +cris_final_link_relocate (howto, input_bfd, input_section, contents, rel, + relocation) + reloc_howto_type * howto; + bfd * input_bfd; + asection * input_section; + bfd_byte * contents; + Elf_Internal_Rela * rel; + bfd_vma relocation; +{ + bfd_reloc_status_type r; + + /* PC-relative relocations are relative to the position *after* + the reloc. Note that for R_CRIS_8_PCREL the adjustment is + not a single byte, since PC must be 16-bit-aligned. */ + switch (ELF32_R_TYPE (rel->r_info)) + { + /* Check that the 16-bit GOT relocs are positive. */ + case R_CRIS_16_GOTPLT: + case R_CRIS_16_GOT: + if ((bfd_signed_vma) relocation < 0) + return bfd_reloc_overflow; + break; + + case R_CRIS_32_PLT_PCREL: + case R_CRIS_32_PCREL: + relocation -= 2; + /* Fall through. */ + case R_CRIS_8_PCREL: + case R_CRIS_16_PCREL: + relocation -= 2; + break; + + default: + break; + } + + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + return r; +} + +/* Relocate an CRIS ELF section. See elf32-fr30.c, from where this was + copied, for further comments. */ + +static bfd_boolean +cris_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + bfd *dynobj; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_vma *local_got_offsets; + asection *sgot; + asection *splt; + asection *sreloc; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + + if (info->relocatable) + return TRUE; + + dynobj = elf_hash_table (info)->dynobj; + local_got_offsets = elf_local_got_offsets (input_bfd); + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + relend = relocs + input_section->reloc_count; + + sgot = NULL; + splt = NULL; + sreloc = NULL; + + if (dynobj != NULL) + { + splt = bfd_get_section_by_name (dynobj, ".plt"); + sgot = bfd_get_section_by_name (dynobj, ".got"); + } + + for (rel = relocs; rel < relend; rel ++) + { + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + const char *symname = NULL; + int r_type; + + r_type = ELF32_R_TYPE (rel->r_info); + + if ( r_type == R_CRIS_GNU_VTINHERIT + || r_type == R_CRIS_GNU_VTENTRY) + continue; + + /* This is a final link. */ + r_symndx = ELF32_R_SYM (rel->r_info); + howto = cris_elf_howto_table + r_type; + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + symname = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (symname == NULL) + symname = bfd_section_name (input_bfd, sec); + } + else + { + bfd_boolean warned; + bfd_boolean unresolved_reloc; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + + if (unresolved_reloc + /* Perhaps we should detect the cases that + sec->output_section is expected to be NULL like i386 and + m68k, but apparently (and according to elfxx-ia64.c) all + valid cases are where the symbol is defined in a shared + object which we link dynamically against. This includes + PLT relocs for which we've created a PLT entry and other + relocs for which we're prepared to create dynamic + relocations. + + For now, new situations cause us to just err when + sec->output_offset is NULL but the object with the symbol + is *not* dynamically linked against. Thus this will + automatically remind us so we can see if there are other + valid cases we need to revisit. */ + && (sec->owner->flags & DYNAMIC) != 0) + relocation = 0; + + else if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + /* Here follow the cases where the relocation value must + be zero (or when further handling is simplified when + zero). I can't claim to understand the various + conditions and they weren't described in the files + where I copied them from (elf32-m68k.c and + elf32-i386.c), but let's mention examples of where + they happen. FIXME: Perhaps define and use a + dynamic_symbol_p function like ia64. + + - When creating a shared library, we can have an + ordinary relocation for a symbol defined in a shared + library (perhaps the one we create). We then make + the relocation value zero, as the value seen now will + be added into the relocation addend in this shared + library, but must be handled only at dynamic-link + time. FIXME: Not sure this example covers the + h->elf_link_hash_flags test, though it's there in + other targets. */ + if (info->shared + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) + && (input_section->flags & SEC_ALLOC) != 0 + && (r_type == R_CRIS_8 + || r_type == R_CRIS_16 + || r_type == R_CRIS_32 + || r_type == R_CRIS_8_PCREL + || r_type == R_CRIS_16_PCREL + || r_type == R_CRIS_32_PCREL)) + relocation = 0; + else if (unresolved_reloc) + { + _bfd_error_handler + (_("%s: unresolvable relocation %s against symbol `%s' from %s section"), + bfd_archive_filename (input_bfd), + cris_elf_howto_table[r_type].name, + symname, + bfd_get_section_name (input_bfd, input_section)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + } + + switch (r_type) + { + case R_CRIS_16_GOTPLT: + case R_CRIS_32_GOTPLT: + /* This is like the case for R_CRIS_32_GOT and R_CRIS_16_GOT, + but we require a PLT, and the PLT handling will take care of + filling in the PLT-specific GOT entry. For the GOT offset, + calculate it as we do when filling it in for the .got.plt + section. If we don't have a PLT, punt to GOT handling. */ + if (h != NULL + && ((struct elf_cris_link_hash_entry *) h)->gotplt_offset != 0) + { + asection *sgotplt + = bfd_get_section_by_name (dynobj, ".got.plt"); + bfd_vma got_offset; + + BFD_ASSERT (h->dynindx != -1); + BFD_ASSERT (sgotplt != NULL); + + got_offset + = ((struct elf_cris_link_hash_entry *) h)->gotplt_offset; + + relocation = got_offset; + break; + } + + /* We didn't make a PLT entry for this symbol. Maybe everything is + folded into the GOT. Other than folding, this happens when + statically linking PIC code, or when using -Bsymbolic. Check + that we instead have a GOT entry as done for us by + elf_cris_adjust_dynamic_symbol, and drop through into the + ordinary GOT cases. This must not happen for the + executable, because any reference it does to a function + that is satisfied by a DSO must generate a PLT. We assume + these call-specific relocs don't address non-functions. */ + if (h != NULL + && (h->got.offset == (bfd_vma) -1 + || (!info->shared + && !((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) != 0 + || ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && h->root.type == bfd_link_hash_undefweak))))) + { + (*_bfd_error_handler) + ((h->got.offset == (bfd_vma) -1) + ? _("%s: No PLT nor GOT for relocation %s against\ + symbol `%s' from %s section") + : _("%s: No PLT for relocation %s against\ + symbol `%s' from %s section"), + bfd_archive_filename (input_bfd), + cris_elf_howto_table[r_type].name, + symname[0] != '\0' ? symname : _("[whose name is lost]"), + bfd_get_section_name (input_bfd, input_section)); + + /* FIXME: Perhaps blaming input is not the right thing to + do; this is probably an internal error. But it is true + that we didn't like that particular input. */ + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + /* Fall through. */ + + /* The size of the actual relocation is not used here; we only + fill in the GOT table here. */ + case R_CRIS_16_GOT: + case R_CRIS_32_GOT: + { + bfd_vma off; + + /* Note that despite using RELA relocations, the .got contents + is always filled in with the link-relative relocation + value; the addend. */ + + if (h != NULL) + { + off = h->got.offset; + BFD_ASSERT (off != (bfd_vma) -1); + + if (!elf_hash_table (info)->dynamic_sections_created + || (! info->shared + && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) + || h->type == STT_FUNC + || (h->elf_link_hash_flags + & ELF_LINK_HASH_NEEDS_PLT))) + || (info->shared + && (info->symbolic || h->dynindx == -1) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + { + /* This wasn't checked above for ! info->shared, but + must hold there if we get here; the symbol must + be defined in the regular program or be undefweak + or be a function or otherwise need a PLT. */ + BFD_ASSERT (!elf_hash_table (info)->dynamic_sections_created + || info->shared + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) != 0 + || h->type == STT_FUNC + || (h->elf_link_hash_flags + & ELF_LINK_HASH_NEEDS_PLT) + || h->root.type == bfd_link_hash_undefweak); + + /* This is actually a static link, or it is a + -Bsymbolic link and the symbol is defined locally, + or is undefweak, or the symbol was forced to be + local because of a version file, or we're not + creating a dynamic object. We must initialize this + entry in the global offset table. Since the offset + must always be a multiple of 4, we use the least + significant bit to record whether we have + initialized it already. + + If this GOT entry should be runtime-initialized, we + will create a .rela.got relocation entry to + initialize the value. This is done in the + finish_dynamic_symbol routine. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_32 (output_bfd, relocation, + sgot->contents + off); + h->got.offset |= 1; + } + } + } + else + { + BFD_ASSERT (local_got_offsets != NULL + && local_got_offsets[r_symndx] != (bfd_vma) -1); + + off = local_got_offsets[r_symndx]; + + /* The offset must always be a multiple of 4. We use + the least significant bit to record whether we have + already generated the necessary reloc. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_32 (output_bfd, relocation, sgot->contents + off); + + if (info->shared) + { + asection *s; + Elf_Internal_Rela outrel; + bfd_byte *loc; + + s = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (s != NULL); + + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + off); + outrel.r_info = ELF32_R_INFO (0, R_CRIS_RELATIVE); + outrel.r_addend = relocation; + loc = s->contents; + loc += s->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + } + + local_got_offsets[r_symndx] |= 1; + } + } + + relocation = sgot->output_offset + off; + if (rel->r_addend != 0) + { + /* We can't do anything for a relocation which is against + a symbol *plus offset*. GOT holds relocations for + symbols. Make this an error; the compiler isn't + allowed to pass us these kinds of things. */ + if (h == NULL) + (*_bfd_error_handler) + (_("%s: relocation %s with non-zero addend %d against local symbol from %s section"), + bfd_archive_filename (input_bfd), + cris_elf_howto_table[r_type].name, + rel->r_addend, + bfd_get_section_name (input_bfd, input_section)); + else + (*_bfd_error_handler) + (_("%s: relocation %s with non-zero addend %d against symbol `%s' from %s section"), + bfd_archive_filename (input_bfd), + cris_elf_howto_table[r_type].name, + rel->r_addend, + symname[0] != '\0' ? symname : _("[whose name is lost]"), + bfd_get_section_name (input_bfd, input_section)); + + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + break; + + case R_CRIS_32_GOTREL: + /* This relocation must only be performed against local symbols. + It's also ok when we link a program and the symbol is either + defined in an ordinary (non-DSO) object or is undefined weak. */ + if (h != NULL + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + && !(!info->shared + && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + || ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && h->root.type == bfd_link_hash_undefweak)))) + { + (*_bfd_error_handler) + (_("%s: relocation %s is not allowed for global symbol: `%s' from %s section"), + bfd_archive_filename (input_bfd), + cris_elf_howto_table[r_type].name, + symname, + bfd_get_section_name (input_bfd, input_section)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* This can happen if we get a link error with the input ELF + variant mismatching the output variant. Emit an error so + it's noticed if it happens elsewhere. */ + if (sgot == NULL) + { + (*_bfd_error_handler) + (_("%s: relocation %s in section %s with no GOT created"), + bfd_archive_filename (input_bfd), + cris_elf_howto_table[r_type].name, + bfd_get_section_name (input_bfd, input_section)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* This relocation is like a PC-relative one, except the + reference point is the location of GOT. Note that + sgot->output_offset is not involved in this calculation. We + always want the start of entire .got section, not the + position after the reserved header. */ + relocation -= sgot->output_section->vma; + break; + + case R_CRIS_32_PLT_PCREL: + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + /* Resolve a PLT_PCREL reloc against a local symbol directly, + without using the procedure linkage table. */ + if (h == NULL || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + break; + + if (h->plt.offset == (bfd_vma) -1 + || splt == NULL) + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ + break; + } + + relocation = (splt->output_section->vma + + splt->output_offset + + h->plt.offset); + break; + + case R_CRIS_32_PLT_GOTREL: + /* Like R_CRIS_32_PLT_PCREL, but the reference point is the + start of the .got section. See also comment at + R_CRIS_32_GOT. */ + relocation -= sgot->output_section->vma; + + /* Resolve a PLT_GOTREL reloc against a local symbol directly, + without using the procedure linkage table. */ + if (h == NULL || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + break; + + if (h->plt.offset == (bfd_vma) -1 + || splt == NULL) + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ + break; + } + + relocation = (splt->output_section->vma + + splt->output_offset + + h->plt.offset + - sgot->output_section->vma); + break; + + case R_CRIS_8_PCREL: + case R_CRIS_16_PCREL: + case R_CRIS_32_PCREL: + /* If the symbol was local, we need no shlib-specific handling. */ + if (h == NULL || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + break; + + /* Fall through. */ + case R_CRIS_8: + case R_CRIS_16: + case R_CRIS_32: + if (info->shared + && r_symndx != 0 + && (input_section->flags & SEC_ALLOC) != 0 + && ((r_type != R_CRIS_8_PCREL + && r_type != R_CRIS_16_PCREL + && r_type != R_CRIS_32_PCREL) + || (!info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + bfd_boolean skip, relocate; + + /* When generating a shared object, these relocations + are copied into the output file to be resolved at run + time. */ + + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (input_bfd, + elf_elfheader (input_bfd)->e_shstrndx, + elf_section_data (input_section)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (input_bfd, + input_section), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + + /* That section should have been created in + cris_elf_check_relocs, but that function will not be + called for objects which fail in + cris_elf_merge_private_bfd_data. */ + if (sreloc == NULL) + { + (*_bfd_error_handler) + (_("%s: Internal inconsistency; no relocation section %s"), + bfd_archive_filename (input_bfd), + name); + + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + + skip = FALSE; + relocate = FALSE; + + outrel.r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, + rel->r_offset); + if (outrel.r_offset == (bfd_vma) -1) + skip = TRUE; + else if (outrel.r_offset == (bfd_vma) -2) + skip = TRUE, relocate = TRUE; + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + /* h->dynindx may be -1 if the symbol was marked to + become local. */ + else if (h != NULL + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + { + BFD_ASSERT (h->dynindx != -1); + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + outrel.r_addend = relocation + rel->r_addend; + } + else + { + if (r_type == R_CRIS_32) + { + relocate = TRUE; + outrel.r_info = ELF32_R_INFO (0, R_CRIS_RELATIVE); + outrel.r_addend = relocation + rel->r_addend; + } + else + { + long indx; + + if (bfd_is_abs_section (sec)) + indx = 0; + else if (sec == NULL || sec->owner == NULL) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + else + { + asection *osec; + + osec = sec->output_section; + indx = elf_section_data (osec)->dynindx; + BFD_ASSERT (indx > 0); + } + + outrel.r_info = ELF32_R_INFO (indx, r_type); + outrel.r_addend = relocation + rel->r_addend; + } + } + + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + + /* This reloc will be computed at runtime, so there's no + need to do anything now, except for R_CRIS_32 relocations + that have been turned into R_CRIS_RELATIVE. */ + if (!relocate) + continue; + } + + break; + } + + r = cris_final_link_relocate (howto, input_bfd, input_section, + contents, rel, relocation); + + if (r != bfd_reloc_ok) + { + const char * msg = (const char *) NULL; + + switch (r) + { + case bfd_reloc_overflow: + r = info->callbacks->reloc_overflow + (info, symname, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset); + break; + + case bfd_reloc_undefined: + r = info->callbacks->undefined_symbol + (info, symname, input_bfd, input_section, rel->r_offset, + TRUE); + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + break; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + break; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous relocation"); + break; + + default: + msg = _("internal error: unknown error"); + break; + } + + if (msg) + r = info->callbacks->warning + (info, msg, symname, input_bfd, input_section, rel->r_offset); + + if (! r) + return FALSE; + } + } + + return TRUE; +} + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +static bfd_boolean +elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym) + bfd *output_bfd; + struct bfd_link_info *info; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + bfd *dynobj; + int plt_off1 = 2, plt_off2 = 10, plt_off3 = 16; + + dynobj = elf_hash_table (info)->dynobj; + + if (h->plt.offset != (bfd_vma) -1) + { + asection *splt; + asection *sgotplt; + asection *sgot; + asection *srela; + bfd_vma got_base; + + bfd_vma gotplt_offset + = ((struct elf_cris_link_hash_entry *) h)->gotplt_offset; + Elf_Internal_Rela rela; + bfd_byte *loc; + bfd_boolean has_gotplt = gotplt_offset != 0; + + /* Get the index in the procedure linkage table which + corresponds to this symbol. This is the index of this symbol + in all the symbols for which we are making plt entries. The + first entry in the procedure linkage table is reserved. */ + /* We have to count backwards here, and the result is only valid as + an index into .got.plt and its relocations. FIXME: Constants... */ + bfd_vma gotplt_index = gotplt_offset/4 - 3; + + /* Get the offset into the .got table of the entry that corresponds + to this function. Note that we embed knowledge that "incoming" + .got goes after .got.plt in the output without padding (pointer + aligned). However, that knowledge is present in several other + places too. */ + bfd_vma got_offset + = (has_gotplt + ? gotplt_offset + : h->got.offset + elf_cris_hash_table(info)->next_gotplt_entry); + + /* This symbol has an entry in the procedure linkage table. Set it + up. */ + + BFD_ASSERT (h->dynindx != -1); + + splt = bfd_get_section_by_name (dynobj, ".plt"); + sgot = bfd_get_section_by_name (dynobj, ".got"); + sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + srela = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (splt != NULL && sgotplt != NULL + && (! has_gotplt || srela != NULL)); + + got_base = sgotplt->output_section->vma + sgotplt->output_offset; + + /* Fill in the entry in the procedure linkage table. */ + if (! info->shared) + { + memcpy (splt->contents + h->plt.offset, elf_cris_plt_entry, + PLT_ENTRY_SIZE); + + /* We need to enter the absolute address of the GOT entry here. */ + bfd_put_32 (output_bfd, got_base + got_offset, + splt->contents + h->plt.offset + plt_off1); + } + else + { + memcpy (splt->contents + h->plt.offset, elf_cris_pic_plt_entry, + PLT_ENTRY_SIZE); + bfd_put_32 (output_bfd, got_offset, + splt->contents + h->plt.offset + plt_off1); + } + + /* Fill in the plt entry and make a relocation, if this is a "real" + PLT entry. */ + if (has_gotplt) + { + /* Fill in the offset into the reloc table. */ + bfd_put_32 (output_bfd, + gotplt_index * sizeof (Elf32_External_Rela), + splt->contents + h->plt.offset + plt_off2); + + /* Fill in the offset to the first PLT entry, where to "jump". */ + bfd_put_32 (output_bfd, - (h->plt.offset + plt_off3 + 4), + splt->contents + h->plt.offset + plt_off3); + + /* Fill in the entry in the global offset table with the address of + the relocating stub. */ + bfd_put_32 (output_bfd, + (splt->output_section->vma + + splt->output_offset + + h->plt.offset + + 8), + sgotplt->contents + got_offset); + + /* Fill in the entry in the .rela.plt section. */ + rela.r_offset = (sgotplt->output_section->vma + + sgotplt->output_offset + + got_offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_CRIS_JUMP_SLOT); + rela.r_addend = 0; + loc = srela->contents + gotplt_index * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + } + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + + /* FIXME: From elf32-sparc.c 2001-02-19 (1.18). I still don't + know whether resetting the value is significant; if it really + is, rather than a quirk or bug in the sparc port, then I + believe we'd see this elsewhere. */ + /* If the symbol is weak, we do need to clear the value. + Otherwise, the PLT entry would provide a definition for + the symbol even if the symbol wasn't defined anywhere, + and so the symbol would never be NULL. */ + if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) + == 0) + sym->st_value = 0; + } + } + + /* For an ordinary program, we emit .got relocs only for symbols that + are in the dynamic-symbols table and are either defined by the + program or are undefined weak symbols, or are function symbols + where we do not output a PLT: the PLT reloc was output above and all + references to the function symbol are redirected to the PLT. */ + if (h->got.offset != (bfd_vma) -1 + && (info->shared + || (h->dynindx != -1 + && h->plt.offset == (bfd_vma) -1 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 + && h->root.type != bfd_link_hash_undefweak))) + { + asection *sgot; + asection *srela; + Elf_Internal_Rela rela; + bfd_byte *loc; + bfd_byte *where; + + /* This symbol has an entry in the global offset table. Set it up. */ + + sgot = bfd_get_section_by_name (dynobj, ".got"); + srela = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (sgot != NULL && srela != NULL); + + rela.r_offset = (sgot->output_section->vma + + sgot->output_offset + + (h->got.offset &~ (bfd_vma) 1)); + + /* If this is a static link, or it is a -Bsymbolic link and the + symbol is defined locally or was forced to be local because + of a version file, we just want to emit a RELATIVE reloc. + The entry in the global offset table will already have been + initialized in the relocate_section function. */ + where = sgot->contents + (h->got.offset &~ (bfd_vma) 1); + if (! elf_hash_table (info)->dynamic_sections_created + || (info->shared + && (info->symbolic || h->dynindx == -1) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + { + rela.r_info = ELF32_R_INFO (0, R_CRIS_RELATIVE); + rela.r_addend = bfd_get_signed_32 (output_bfd, where); + } + else + { + bfd_put_32 (output_bfd, (bfd_vma) 0, where); + rela.r_info = ELF32_R_INFO (h->dynindx, R_CRIS_GLOB_DAT); + rela.r_addend = 0; + } + + loc = srela->contents; + loc += srela->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + } + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + { + asection *s; + Elf_Internal_Rela rela; + bfd_byte *loc; + + /* This symbol needs a copy reloc. Set it up. */ + + BFD_ASSERT (h->dynindx != -1 + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)); + + s = bfd_get_section_by_name (h->root.u.def.section->owner, + ".rela.bss"); + BFD_ASSERT (s != NULL); + + rela.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_CRIS_COPY); + rela.r_addend = 0; + loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + } + + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + sym->st_shndx = SHN_ABS; + + return TRUE; +} + +/* Finish up the dynamic sections. */ + +static bfd_boolean +elf_cris_finish_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *sgot; + asection *sdyn; + + dynobj = elf_hash_table (info)->dynobj; + + sgot = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (sgot != NULL); + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (elf_hash_table (info)->dynamic_sections_created) + { + asection *splt; + Elf32_External_Dyn *dyncon, *dynconend; + + splt = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (splt != NULL && sdyn != NULL); + + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + asection *s; + + bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + break; + + case DT_PLTGOT: + s = bfd_get_section_by_name (output_bfd, ".got"); + BFD_ASSERT (s != NULL); + dyn.d_un.d_ptr = s->vma; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_JMPREL: + /* Yes, we *can* have a .plt and no .plt.rela, for instance + if all symbols are found in the .got (not .got.plt). */ + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + dyn.d_un.d_ptr = s != NULL ? s->vma : 0; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_PLTRELSZ: + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + if (s == NULL) + dyn.d_un.d_val = 0; + else if (s->_cooked_size != 0) + dyn.d_un.d_val = s->_cooked_size; + else + dyn.d_un.d_val = s->_raw_size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_RELASZ: + /* The procedure linkage table relocs (DT_JMPREL) should + not be included in the overall relocs (DT_RELA). + Therefore, we override the DT_RELASZ entry here to + make it not include the JMPREL relocs. Since the + linker script arranges for .rela.plt to follow all + other relocation sections, we don't have to worry + about changing the DT_RELA entry. */ + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + if (s != NULL) + { + if (s->_cooked_size != 0) + dyn.d_un.d_val -= s->_cooked_size; + else + dyn.d_un.d_val -= s->_raw_size; + } + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + } + } + + /* Fill in the first entry in the procedure linkage table. */ + if (splt->_raw_size > 0) + { + if (info->shared) + memcpy (splt->contents, elf_cris_pic_plt0_entry, PLT_ENTRY_SIZE); + else + { + memcpy (splt->contents, elf_cris_plt0_entry, PLT_ENTRY_SIZE); + bfd_put_32 (output_bfd, + sgot->output_section->vma + sgot->output_offset + 4, + splt->contents + 6); + bfd_put_32 (output_bfd, + sgot->output_section->vma + sgot->output_offset + 8, + splt->contents + 14); + + elf_section_data (splt->output_section)->this_hdr.sh_entsize + = PLT_ENTRY_SIZE; + } + } + } + + /* Fill in the first three entries in the global offset table. */ + if (sgot->_raw_size > 0) + { + if (sdyn == NULL) + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + else + bfd_put_32 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + sgot->contents); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + } + + elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; + + return TRUE; +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +cris_elf_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_CRIS_GNU_VTINHERIT: + case R_CRIS_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the got entry reference counts for the section being removed. */ + +static bfd_boolean +cris_elf_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_signed_vma *local_got_refcounts; + const Elf_Internal_Rela *rel, *relend; + bfd *dynobj; + asection *sgot; + asection *srelgot; + + dynobj = elf_hash_table (info)->dynobj; + if (dynobj == NULL) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + local_got_refcounts = elf_local_got_refcounts (abfd); + + sgot = bfd_get_section_by_name (dynobj, ".got"); + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; rel++) + { + unsigned long r_symndx; + struct elf_link_hash_entry *h; + + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_CRIS_16_GOT: + case R_CRIS_32_GOT: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->got.refcount > 0) + { + --h->got.refcount; + if (h->got.refcount == 0) + { + /* We don't need the .got entry any more. */ + sgot->_raw_size -= 4; + srelgot->_raw_size -= sizeof (Elf32_External_Rela); + } + } + break; + } + + local_got_reloc: + if (local_got_refcounts != NULL) + { + if (local_got_refcounts[r_symndx] > 0) + { + --local_got_refcounts[r_symndx]; + if (local_got_refcounts[r_symndx] == 0) + { + /* We don't need the .got entry any more. */ + sgot->_raw_size -= 4; + if (info->shared) + srelgot->_raw_size -= sizeof (Elf32_External_Rela); + } + } + } + break; + + case R_CRIS_16_GOTPLT: + case R_CRIS_32_GOTPLT: + /* For local symbols, treat these like GOT relocs. */ + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + goto local_got_reloc; + /* Fall through. */ + case R_CRIS_32_PLT_GOTREL: + /* FIXME: We don't garbage-collect away the .got section. */ + if (local_got_refcounts != NULL) + local_got_refcounts[-1]--; + /* Fall through. */ + case R_CRIS_8_PCREL: + case R_CRIS_16_PCREL: + case R_CRIS_32_PCREL: + case R_CRIS_32_PLT_PCREL: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + && h->plt.refcount > 0) + --h->plt.refcount; + } + break; + + default: + break; + } + } + + return TRUE; +} + +/* Make sure we emit a GOT entry if the symbol was supposed to have a PLT + entry but we found we will not create any. Called when we find we will + not have any PLT for this symbol, by for example + elf_cris_adjust_dynamic_symbol when we're doing a proper dynamic link, + or elf_cris_size_dynamic_sections if no dynamic sections will be + created (we're only linking static objects). */ + +static bfd_boolean +elf_cris_adjust_gotplt_to_got (h, p) + struct elf_cris_link_hash_entry *h; + PTR p; +{ + struct bfd_link_info *info = (struct bfd_link_info *) p; + bfd *dynobj = elf_hash_table (info)->dynobj; + + BFD_ASSERT (dynobj != NULL); + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link; + + /* If nobody wanted a GOTPLT with this symbol, we're done. */ + if (h->gotplt_refcount <= 0) + return TRUE; + + if (h->root.got.refcount > 0) + { + /* There's a GOT entry for this symbol. Just adjust the refcount. + Probably not necessary at this stage, but keeping it accurate + helps avoiding surprises later. */ + h->root.got.refcount += h->gotplt_refcount; + h->gotplt_refcount = -1; + } + else + { + /* No GOT entry for this symbol. We need to create one. */ + asection *sgot = bfd_get_section_by_name (dynobj, ".got"); + asection *srelgot + = bfd_get_section_by_name (dynobj, ".rela.got"); + + /* Put an accurate refcount there. */ + h->root.got.refcount = h->gotplt_refcount; + + h->gotplt_refcount = -1; + + /* We always have a .got and a .rela.got section if there were + GOTPLT relocs in input. */ + BFD_ASSERT (sgot != NULL && srelgot != NULL); + + /* Allocate space in the .got section. */ + sgot->_raw_size += 4; + + /* Allocate relocation space. */ + srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + + return TRUE; +} + +/* Try to fold PLT entries with GOT entries. There are two cases when we + want to do this: + + - When all PLT references are GOTPLT references, and there are GOT + references, and this is not the executable. We don't have to + generate a PLT at all. + + - When there are both (ordinary) PLT references and GOT references, + and this isn't the executable. + We want to make the PLT reference use the ordinary GOT entry rather + than R_CRIS_JUMP_SLOT, a run-time dynamically resolved GOTPLT entry, + since the GOT entry will have to be resolved at startup anyway. + + Though the latter case is handled when room for the PLT is allocated, + not here. + + By folding into the GOT, we may need a round-trip to a PLT in the + executable for calls, a loss in performance. Still, losing a + reloc is a win in size and at least in start-up time. + + Note that this function is called before symbols are forced local by + version scripts. The differing cases are handled by + elf_cris_hide_symbol. */ + +static bfd_boolean +elf_cris_try_fold_plt_to_got (h, p) + struct elf_cris_link_hash_entry *h; + PTR p; +{ + struct bfd_link_info *info = (struct bfd_link_info *) p; + + /* If there are no GOT references for this symbol, we can't fold any + other reference so there's nothing to do. Likewise if there are no + PLT references; GOTPLT references included. */ + if (h->root.got.refcount <= 0 || h->root.plt.refcount <= 0) + return TRUE; + + /* GOTPLT relocs are supposed to be included into the PLT refcount. */ + BFD_ASSERT (h->gotplt_refcount <= h->root.plt.refcount); + + if (h->gotplt_refcount == h->root.plt.refcount) + { + /* The only PLT references are GOTPLT references, and there are GOT + references. Convert PLT to GOT references. */ + if (! elf_cris_adjust_gotplt_to_got (h, info)) + return FALSE; + + /* Clear the PLT references, so no PLT will be created. */ + h->root.plt.offset = (bfd_vma) -1; + } + + return TRUE; +} + +/* Our own version of hide_symbol, so that we can adjust a GOTPLT reloc + to use a GOT entry (and create one) rather than requiring a GOTPLT + entry. */ + +static void +elf_cris_hide_symbol (info, h, force_local) + struct bfd_link_info *info; + struct elf_link_hash_entry *h; + bfd_boolean force_local; +{ + elf_cris_adjust_gotplt_to_got ((struct elf_cris_link_hash_entry *) h, info); + + _bfd_elf_link_hash_hide_symbol (info, h, force_local); +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static bfd_boolean +elf_cris_adjust_dynamic_symbol (info, h) + struct bfd_link_info *info; + struct elf_link_hash_entry *h; +{ + bfd *dynobj; + asection *s; + unsigned int power_of_two; + + dynobj = elf_hash_table (info)->dynobj; + + /* Make sure we know what is going on here. */ + BFD_ASSERT (dynobj != NULL + && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) + || h->weakdef != NULL + || ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_REF_REGULAR) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))); + + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later, + when we know the address of the .got section. */ + if (h->type == STT_FUNC + || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + { + /* If we link a program (not a DSO), we'll get rid of unnecessary + PLT entries; we point to the actual symbols -- even for pic + relocs, because a program built with -fpic should have the same + result as one built without -fpic, specifically considering weak + symbols. + FIXME: m68k and i386 differ here, for unclear reasons. */ + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0) + { + /* This case can occur if we saw a PLT reloc in an input file, + but the symbol was not defined by a dynamic object. In such + a case, we don't actually need to build a procedure linkage + table, and we can just do an absolute or PC reloc instead, or + change a .got.plt index to a .got index for GOTPLT relocs. */ + BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0); + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->plt.offset = (bfd_vma) -1; + return + elf_cris_adjust_gotplt_to_got ((struct + elf_cris_link_hash_entry *) h, + info); + } + + /* If we had a R_CRIS_GLOB_DAT that didn't have to point to a PLT; + where a pointer-equivalent symbol was unimportant (i.e. more + like R_CRIS_JUMP_SLOT after symbol evaluation) we could get rid + of the PLT. We can't for the executable, because the GOT + entries will point to the PLT there (and be constant). */ + if (info->shared + && !elf_cris_try_fold_plt_to_got ((struct elf_cris_link_hash_entry*) + h, info)) + return FALSE; + + /* GC or folding may have rendered this entry unused. */ + if (h->plt.refcount <= 0) + { + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->plt.offset = (bfd_vma) -1; + return TRUE; + } + + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (s != NULL); + + /* If this is the first .plt entry, make room for the special + first entry. */ + if (s->_raw_size == 0) + s->_raw_size += PLT_ENTRY_SIZE; + + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. */ + if (!info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + } + + /* If there's already a GOT entry, use that, not a .got.plt. A + GOT field still has a reference count when we get here; it's + not yet changed to an offset. We can't do this for an + executable, because then the reloc associated with the PLT + would get a non-PLT reloc pointing to the PLT. FIXME: Move + this to elf_cris_try_fold_plt_to_got. */ + if (info->shared && h->got.refcount > 0) + { + h->got.refcount += h->plt.refcount; + + /* Mark the PLT offset to use the GOT entry by setting the low + bit in the plt offset; it is always a multiple of + pointer-size. */ + BFD_ASSERT ((s->_raw_size & 3) == 0); + + /* Change the PLT refcount to an offset. */ + h->plt.offset = s->_raw_size; + + /* By not setting gotplt_offset (i.e. it remains at 0), we signal + that the got entry should be used instead. */ + BFD_ASSERT (((struct elf_cris_link_hash_entry *) + h)->gotplt_offset == 0); + + /* Make room for this entry. */ + s->_raw_size += PLT_ENTRY_SIZE; + + return TRUE; + } + + /* No GOT reference for this symbol; prepare for an ordinary PLT. */ + h->plt.offset = s->_raw_size; + + /* Make room for this entry. */ + s->_raw_size += PLT_ENTRY_SIZE; + + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + ((struct elf_cris_link_hash_entry *) h)->gotplt_offset + = elf_cris_hash_table (info)->next_gotplt_entry; + elf_cris_hash_table (info)->next_gotplt_entry += 4; + + s = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (s != NULL); + s->_raw_size += 4; + + /* We also need to make an entry in the .rela.plt section. */ + + s = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (s != NULL); + s->_raw_size += sizeof (Elf32_External_Rela); + + return TRUE; + } + + /* Reinitialize the plt offset now that it is not used as a reference + count any more. */ + h->plt.offset = (bfd_vma) -1; + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (info->shared) + return TRUE; + + /* If there are no references to this symbol that do not use the + GOT, we don't need to generate a copy reloc. */ + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + return TRUE; + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + + s = bfd_get_section_by_name (dynobj, ".dynbss"); + BFD_ASSERT (s != NULL); + + /* We must generate a R_CRIS_COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rela.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + asection *srel; + + srel = bfd_get_section_by_name (dynobj, ".rela.bss"); + BFD_ASSERT (srel != NULL); + srel->_raw_size += sizeof (Elf32_External_Rela); + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + } + + /* Historic precedent: m68k and i386 allow max 8-byte alignment for the + thing to copy; so do we. */ + + /* We need to figure out the alignment required for this symbol. I + have no idea how ELF linkers handle this. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > 3) + power_of_two = 3; + + /* Apply the required alignment. */ + s->_raw_size = BFD_ALIGN (s->_raw_size, + (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (dynobj, s)) + { + if (!bfd_set_section_alignment (dynobj, s, power_of_two)) + return FALSE; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + + /* Increment the section size to make room for the symbol. */ + s->_raw_size += h->size; + + return TRUE; +} + +/* Look through the relocs for a section during the first phase. */ + +static bfd_boolean +cris_elf_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + bfd *dynobj; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + bfd_signed_vma *local_got_refcounts; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + asection *sgot; + asection *srelgot; + asection *sreloc; + + if (info->relocatable) + return TRUE; + + dynobj = elf_hash_table (info)->dynobj; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym); + local_got_refcounts = elf_local_got_refcounts (abfd); + + sgot = NULL; + srelgot = NULL; + sreloc = NULL; + + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + enum elf_cris_reloc_type r_type; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + r_type = ELF32_R_TYPE (rel->r_info); + + /* Some relocs require linker-created sections; we need to hang them + on the first input bfd we found that contained dynamic relocs. */ + switch (r_type) + { + case R_CRIS_16_GOT: + case R_CRIS_32_GOT: + case R_CRIS_32_GOTREL: + case R_CRIS_32_PLT_GOTREL: + case R_CRIS_32_PLT_PCREL: + case R_CRIS_16_GOTPLT: + case R_CRIS_32_GOTPLT: + if (dynobj == NULL) + { + elf_hash_table (info)->dynobj = dynobj = abfd; + + /* Create the .got section, so we can assume it's always + present whenever there's a dynobj. */ + if (!_bfd_elf_create_got_section (dynobj, info)) + return FALSE; + } + break; + + default: + break; + } + + /* Some relocs require a global offset table (but perhaps not a + specific GOT entry). */ + switch (r_type) + { + /* For R_CRIS_16_GOTPLT and R_CRIS_32_GOTPLT, we need a GOT + entry only for local symbols. Unfortunately, we don't know + until later on if there's a version script that forces the + symbol local. We must have the .rela.got section in place + before we know if the symbol looks global now, so we need + to treat the reloc just like for R_CRIS_16_GOT and + R_CRIS_32_GOT. */ + case R_CRIS_16_GOTPLT: + case R_CRIS_32_GOTPLT: + case R_CRIS_16_GOT: + case R_CRIS_32_GOT: + if (srelgot == NULL + && (h != NULL || info->shared)) + { + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + if (srelgot == NULL) + { + srelgot = bfd_make_section (dynobj, ".rela.got"); + if (srelgot == NULL + || !bfd_set_section_flags (dynobj, srelgot, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || !bfd_set_section_alignment (dynobj, srelgot, 2)) + return FALSE; + } + } + /* Fall through. */ + + case R_CRIS_32_GOTREL: + case R_CRIS_32_PLT_GOTREL: + if (sgot == NULL) + sgot = bfd_get_section_by_name (dynobj, ".got"); + + if (local_got_refcounts == NULL) + { + bfd_size_type amt; + + /* We use index local_got_refcounts[-1] to count all + GOT-relative relocations that do not have explicit + GOT entries. */ + amt = symtab_hdr->sh_info + 1; + amt *= sizeof (bfd_signed_vma); + local_got_refcounts = ((bfd_signed_vma *) bfd_zalloc (abfd, amt)); + if (local_got_refcounts == NULL) + return FALSE; + + local_got_refcounts++; + elf_local_got_refcounts (abfd) = local_got_refcounts; + } + break; + + default: + break; + } + + switch (r_type) + { + case R_CRIS_16_GOTPLT: + case R_CRIS_32_GOTPLT: + /* Mark that we need a GOT entry if the PLT entry (and its GOT + entry) is eliminated. We can only do this for a non-local + symbol. */ + if (h != NULL) + { + ((struct elf_cris_link_hash_entry *) h)->gotplt_refcount++; + goto handle_gotplt_reloc; + } + /* If h is NULL then this is a local symbol, and we must make a + GOT entry for it, so handle it like a GOT reloc. */ + /* Fall through. */ + + case R_CRIS_16_GOT: + case R_CRIS_32_GOT: + /* This symbol requires a global offset table entry. */ + if (h != NULL) + { + if (h->got.refcount == 0) + { + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1) + { + if (!bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + /* Allocate space in the .got section. */ + sgot->_raw_size += 4; + /* Allocate relocation space. */ + srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + h->got.refcount++; + } + else + { + /* This is a global offset table entry for a local symbol. */ + if (local_got_refcounts[r_symndx] == 0) + { + sgot->_raw_size += 4; + if (info->shared) + { + /* If we are generating a shared object, we need to + output a R_CRIS_RELATIVE reloc so that the dynamic + linker can adjust this GOT entry. */ + srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + } + local_got_refcounts[r_symndx]++; + } + break; + + case R_CRIS_32_GOTREL: + /* This reference requires a global offset table. + FIXME: The actual refcount isn't used currently; the .got + section can't be removed if there were any references in the + input. */ + local_got_refcounts[-1]++; + break; + + handle_gotplt_reloc: + + case R_CRIS_32_PLT_GOTREL: + /* This reference requires a global offset table. */ + local_got_refcounts[-1]++; + /* Fall through. */ + + case R_CRIS_32_PLT_PCREL: + /* This symbol requires a procedure linkage table entry. We + actually build the entry in adjust_dynamic_symbol, + because this might be a case of linking PIC code which is + never referenced by a dynamic object, in which case we + don't need to generate a procedure linkage table entry + after all. */ + + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + if (h == NULL || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + continue; + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount++; + break; + + case R_CRIS_8: + case R_CRIS_16: + case R_CRIS_32: + /* Let's help debug shared library creation. Any of these + relocs can be used in shared libs, but pages containing them + cannot be shared. Don't warn for sections we don't care + about, such as debug sections or non-constant sections. We + can't help tables of (global) function pointers, for example, + though they must be emitted in a data section to avoid having + impure text sections. */ + if (info->shared + && (sec->flags & SEC_ALLOC) != 0 + && (sec->flags & SEC_READONLY) != 0) + { + /* FIXME: How do we make this optionally a warning only? */ + (*_bfd_error_handler) + (_("%s, section %s:\n relocation %s should not be used in a shared object; recompile with -fPIC"), + bfd_archive_filename (abfd), + sec->name, + cris_elf_howto_table[r_type].name); + } + /* Fall through. */ + + case R_CRIS_8_PCREL: + case R_CRIS_16_PCREL: + case R_CRIS_32_PCREL: + if (h != NULL) + { + h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + + /* Make sure a plt entry is created for this symbol if it + turns out to be a function defined by a dynamic object. */ + if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + h->plt.refcount++; + } + + /* If we are creating a shared library and this is not a local + symbol, we need to copy the reloc into the shared library. + However when linking with -Bsymbolic and this is a global + symbol which is defined in an object we are including in the + link (i.e., DEF_REGULAR is set), then we can resolve the + reloc directly. At this point we have not seen all the input + files, so it is possible that DEF_REGULAR is not set now but + will be set later (it is never cleared). In case of a weak + definition, DEF_REGULAR may be cleared later by a strong + definition in a shared library. We account for that + possibility below by storing information in the relocs_copied + field of the hash table entry. A similar situation occurs + when creating shared libraries and symbol visibility changes + render the symbol local. */ + + /* No need to do anything if we're not creating a shared object. */ + if (! info->shared) + break; + + /* We don't need to handle relocs into sections not going into + the "real" output. */ + if ((sec->flags & SEC_ALLOC) == 0) + break; + + /* We can only eliminate PC-relative relocs. */ + if (r_type == R_CRIS_8_PCREL + || r_type == R_CRIS_16_PCREL + || r_type == R_CRIS_32_PCREL) + { + /* If the symbol is local, then we can eliminate the reloc. */ + if (h == NULL || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + break; + + /* If this is with -Bsymbolic and the symbol isn't weak, and + is defined by an ordinary object (the ones we include in + this shared library) then we can also eliminate the + reloc. See comment above for more eliminable cases which + we can't identify at this time. */ + if (info->symbolic + && h->root.type != bfd_link_hash_defweak + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) + break; + } + + /* We create a reloc section in dynobj and make room for this + reloc. */ + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) + { + sreloc = bfd_make_section (dynobj, name); + if (sreloc == NULL + || !bfd_set_section_flags (dynobj, sreloc, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || !bfd_set_section_alignment (dynobj, sreloc, 2)) + return FALSE; + } + if (sec->flags & SEC_READONLY) + info->flags |= DF_TEXTREL; + } + + sreloc->_raw_size += sizeof (Elf32_External_Rela); + + /* If we are linking with -Bsymbolic, we count the number of PC + relative relocations we have entered for this symbol, so that + we can discard them again if the symbol is later defined by a + regular object. We know that h is really a pointer to an + elf_cris_link_hash_entry. */ + if ((r_type == R_CRIS_8_PCREL + || r_type == R_CRIS_16_PCREL + || r_type == R_CRIS_32_PCREL) + && info->symbolic) + { + struct elf_cris_link_hash_entry *eh; + struct elf_cris_pcrel_relocs_copied *p; + + eh = (struct elf_cris_link_hash_entry *) h; + + for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next) + if (p->section == sreloc) + break; + + if (p == NULL) + { + p = ((struct elf_cris_pcrel_relocs_copied *) + bfd_alloc (dynobj, (bfd_size_type) sizeof *p)); + if (p == NULL) + return FALSE; + p->next = eh->pcrel_relocs_copied; + eh->pcrel_relocs_copied = p; + p->section = sreloc; + p->count = 0; + } + + ++p->count; + } + break; + + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_CRIS_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_CRIS_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + + default: + /* Other relocs do not appear here. */ + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +elf_cris_size_dynamic_sections (output_bfd, info) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *s; + bfd_boolean plt; + bfd_boolean relocs; + + dynobj = elf_hash_table (info)->dynobj; + BFD_ASSERT (dynobj != NULL); + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (info->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } + else + { + /* Adjust all expected GOTPLT uses to use a GOT entry instead. */ + elf_cris_link_hash_traverse (elf_cris_hash_table (info), + elf_cris_adjust_gotplt_to_got, + (PTR) info); + + /* We may have created entries in the .rela.got section. + However, if we are not creating the dynamic sections, we will + not actually use these entries. Reset the size of .rela.got, + which will cause it to get stripped from the output file + below. */ + s = bfd_get_section_by_name (dynobj, ".rela.got"); + if (s != NULL) + s->_raw_size = 0; + } + + /* If this is a -Bsymbolic shared link, then we need to discard all PC + relative relocs against symbols defined in a regular object. We + allocated space for them in the check_relocs routine, but we will not + fill them in in the relocate_section routine. We also discard space + for relocs that have become for local symbols due to symbol + visibility changes. For programs, we discard space for relocs for + symbols not referenced by any dynamic object. */ + if (info->shared) + elf_cris_link_hash_traverse (elf_cris_hash_table (info), + elf_cris_discard_excess_dso_dynamics, + (PTR) info); + else + elf_cris_link_hash_traverse (elf_cris_hash_table (info), + elf_cris_discard_excess_program_dynamics, + (PTR) info); + + /* The check_relocs and adjust_dynamic_symbol entry points have + determined the sizes of the various dynamic sections. Allocate + memory for them. */ + plt = FALSE; + relocs = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + const char *name; + bfd_boolean strip; + + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + /* It's OK to base decisions on the section name, because none + of the dynobj section names depend upon the input files. */ + name = bfd_get_section_name (dynobj, s); + + strip = FALSE; + + if (strcmp (name, ".plt") == 0) + { + if (s->_raw_size == 0) + { + /* Strip this section if we don't need it; see the + comment below. */ + strip = TRUE; + } + else + { + /* Remember whether there is a PLT. */ + plt = TRUE; + } + } + else if (strncmp (name, ".rela", 5) == 0) + { + if (s->_raw_size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + strip = TRUE; + } + else + { + /* Remember whether there are any reloc sections other + than .rela.plt. */ + if (strcmp (name, ".rela.plt") != 0) + relocs = TRUE; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + } + else if (strncmp (name, ".got", 4) != 0) + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (strip) + { + _bfd_strip_section_from_output (info, s); + continue; + } + + /* Allocate memory for the section contents. We use bfd_zalloc here + in case unused entries are not reclaimed before the section's + contents are written out. This should not happen, but this way + if it does, we will not write out garbage. For reloc sections, + this will make entries have the type R_CRIS_NONE. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) + return FALSE; + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in elf_cris_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) + + if (!info->shared) + { + if (!add_dynamic_entry (DT_DEBUG, 0)) + return FALSE; + } + + if (plt) + { + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + } + + if (relocs) + { + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) + return FALSE; + } + + if ((info->flags & DF_TEXTREL) != 0) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return FALSE; + info->flags |= DF_TEXTREL; + } + } +#undef add_dynamic_entry + + return TRUE; +} + +/* This function is called via elf_cris_link_hash_traverse if we are + creating a shared object. In the -Bsymbolic case, it discards the + space allocated to copy PC relative relocs against symbols which + are defined in regular objects. For the normal non-symbolic case, + we also discard space for relocs that have become local due to + symbol visibility changes. We allocated space for them in the + check_relocs routine, but we won't fill them in in the + relocate_section routine. */ + +static bfd_boolean +elf_cris_discard_excess_dso_dynamics (h, inf) + struct elf_cris_link_hash_entry *h; + PTR inf; +{ + struct elf_cris_pcrel_relocs_copied *s; + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link; + + /* If a symbol has been forced local or we have found a regular + definition for the symbolic link case, then we won't be needing + any relocs. */ + if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + && ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 + || info->symbolic)) + { + for (s = h->pcrel_relocs_copied; s != NULL; s = s->next) + s->section->_raw_size -= s->count * sizeof (Elf32_External_Rela); + } + + return TRUE; +} + +/* This function is called via elf_cris_link_hash_traverse if we are *not* + creating a shared object. We discard space for relocs for symbols put + in the .got, but which we found we do not have to resolve at run-time. */ + +static bfd_boolean +elf_cris_discard_excess_program_dynamics (h, inf) + struct elf_cris_link_hash_entry *h; + PTR inf; +{ + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_cris_link_hash_entry *) h->root.root.u.i.link; + + /* If we're not creating a shared library and have a symbol which is + referred to by .got references, but the symbol is defined locally, + (or rather, not defined by a DSO) then lose the reloc for the .got + (don't allocate room for it). Likewise for relocs for something + for which we create a PLT. */ + if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + || h->root.plt.refcount > 0) + { + if (h->root.got.refcount > 0 + /* The size of this section is only valid and in sync with the + various reference counts if we do dynamic; don't decrement it + otherwise. */ + && elf_hash_table (info)->dynamic_sections_created) + { + bfd *dynobj = elf_hash_table (info)->dynobj; + asection *srelgot; + + BFD_ASSERT (dynobj != NULL); + + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + + BFD_ASSERT (srelgot != NULL); + + srelgot->_raw_size -= sizeof (Elf32_External_Rela); + } + + /* If the locally-defined symbol isn't used by a DSO, then we don't + have to export it as a dynamic symbol. This was already done for + functions; doing this for all symbols would presumably not + introduce new problems. Of course we don't do this if we're + exporting all dynamic symbols. */ + if (! info->export_dynamic + && (h->root.elf_link_hash_flags + & (ELF_LINK_HASH_DEF_DYNAMIC|ELF_LINK_HASH_REF_DYNAMIC)) == 0) + { + h->root.dynindx = -1; + _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr, + h->root.dynstr_index); + } + } + + return TRUE; +} + +/* Reject a file depending on presence and expectation of prefixed + underscores on symbols. */ + +static bfd_boolean +cris_elf_object_p (abfd) + bfd *abfd; +{ + if ((elf_elfheader (abfd)->e_flags & EF_CRIS_UNDERSCORE)) + return (bfd_get_symbol_leading_char (abfd) == '_'); + else + return (bfd_get_symbol_leading_char (abfd) == 0); +} + +/* Mark presence or absence of leading underscore. */ + +static void +cris_elf_final_write_processing (abfd, linker) + bfd *abfd; + bfd_boolean linker ATTRIBUTE_UNUSED; +{ + if (bfd_get_symbol_leading_char (abfd) == '_') + elf_elfheader (abfd)->e_flags |= EF_CRIS_UNDERSCORE; + else + elf_elfheader (abfd)->e_flags &= ~EF_CRIS_UNDERSCORE; +} + +/* Display the flags field. */ + +static bfd_boolean +cris_elf_print_private_bfd_data (abfd, ptr) + bfd *abfd; + PTR ptr; +{ + FILE *file = (FILE *) ptr; + + BFD_ASSERT (abfd != NULL && ptr != NULL) + + _bfd_elf_print_private_bfd_data (abfd, ptr); + + fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags); + + if (elf_elfheader (abfd)->e_flags & EF_CRIS_UNDERSCORE) + fprintf (file, _(" [symbols have a _ prefix]")); + + fputc ('\n', file); + return TRUE; +} + +/* Don't mix files with and without a leading underscore. */ + +static bfd_boolean +cris_elf_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + flagword old_flags, new_flags; + + if (! _bfd_generic_verify_endian_match (ibfd, obfd)) + return FALSE; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + if (! elf_flags_init (obfd)) + { + /* This happens when ld starts out with a 'blank' output file. */ + elf_flags_init (obfd) = TRUE; + + /* Set flags according to current bfd_target. */ + cris_elf_final_write_processing (obfd, FALSE); + } + + old_flags = elf_elfheader (obfd)->e_flags; + new_flags = elf_elfheader (ibfd)->e_flags; + + /* Is this good or bad? We'll follow with other excluding flags. */ + if ((old_flags & EF_CRIS_UNDERSCORE) != (new_flags & EF_CRIS_UNDERSCORE)) + { + (*_bfd_error_handler) + ((new_flags & EF_CRIS_UNDERSCORE) + ? _("%s: uses _-prefixed symbols, but writing file with non-prefixed symbols") + : _("%s: uses non-prefixed symbols, but writing file with _-prefixed symbols"), + bfd_archive_filename (ibfd)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + return TRUE; +} + + +static enum elf_reloc_type_class +elf_cris_reloc_type_class (rela) + const Elf_Internal_Rela *rela; +{ + switch ((int) ELF32_R_TYPE (rela->r_info)) + { + case R_CRIS_RELATIVE: + return reloc_class_relative; + case R_CRIS_JUMP_SLOT: + return reloc_class_plt; + case R_CRIS_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} + +#define ELF_ARCH bfd_arch_cris +#define ELF_MACHINE_CODE EM_CRIS +#define ELF_MAXPAGESIZE 0x2000 + +#define TARGET_LITTLE_SYM bfd_elf32_cris_vec +#define TARGET_LITTLE_NAME "elf32-cris" +#define elf_symbol_leading_char 0 + +#define elf_info_to_howto_rel NULL +#define elf_info_to_howto cris_info_to_howto_rela +#define elf_backend_relocate_section cris_elf_relocate_section +#define elf_backend_gc_mark_hook cris_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook cris_elf_gc_sweep_hook +#define elf_backend_check_relocs cris_elf_check_relocs +#define elf_backend_grok_prstatus cris_elf_grok_prstatus +#define elf_backend_grok_psinfo cris_elf_grok_psinfo + +#define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 + +#define elf_backend_object_p cris_elf_object_p +#define elf_backend_final_write_processing \ + cris_elf_final_write_processing +#define bfd_elf32_bfd_print_private_bfd_data \ + cris_elf_print_private_bfd_data +#define bfd_elf32_bfd_merge_private_bfd_data \ + cris_elf_merge_private_bfd_data + +#define bfd_elf32_bfd_reloc_type_lookup cris_reloc_type_lookup + +#define bfd_elf32_bfd_link_hash_table_create \ + elf_cris_link_hash_table_create +#define elf_backend_adjust_dynamic_symbol \ + elf_cris_adjust_dynamic_symbol +#define elf_backend_size_dynamic_sections \ + elf_cris_size_dynamic_sections +#define elf_backend_finish_dynamic_symbol \ + elf_cris_finish_dynamic_symbol +#define elf_backend_finish_dynamic_sections \ + elf_cris_finish_dynamic_sections +#define elf_backend_create_dynamic_sections \ + _bfd_elf_create_dynamic_sections +#define bfd_elf32_bfd_final_link \ + bfd_elf_gc_common_final_link +#define elf_backend_hide_symbol elf_cris_hide_symbol +#define elf_backend_reloc_type_class elf_cris_reloc_type_class + +#define elf_backend_want_got_plt 1 +#define elf_backend_plt_readonly 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_got_header_size 12 + +/* Later, we my want to optimize RELA entries into REL entries for dynamic + linking and libraries (if it's a win of any significance). Until then, + take the easy route. */ +#define elf_backend_may_use_rel_p 0 +#define elf_backend_may_use_rela_p 1 +#define elf_backend_rela_normal 1 + +#include "elf32-target.h" + +#define INCLUDED_TARGET_FILE + +#undef TARGET_LITTLE_SYM +#undef TARGET_LITTLE_NAME +#undef elf_symbol_leading_char + +#define TARGET_LITTLE_SYM bfd_elf32_us_cris_vec +#define TARGET_LITTLE_NAME "elf32-us-cris" +#define elf_symbol_leading_char '_' + +#include "elf32-target.h" diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c new file mode 100644 index 0000000000000..e845a254e47eb --- /dev/null +++ b/bfd/elf32-d10v.c @@ -0,0 +1,608 @@ +/* D10V-specific support for 32-bit ELF + Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + Contributed by Martin Hunt (hunt@cygnus.com). + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/d10v.h" + +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void d10v_info_to_howto_rel + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static asection * elf32_d10v_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static bfd_boolean elf32_d10v_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static bfd_boolean elf32_d10v_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static bfd_vma extract_rel_addend + PARAMS ((bfd *, bfd_byte *, reloc_howto_type *)); +static void insert_rel_addend + PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_vma)); +static bfd_boolean elf32_d10v_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, + bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, + asection **)); + +/* Use REL instead of RELA to save space. */ +#define USE_REL 1 + +static reloc_howto_type elf_d10v_howto_table[] = + { + /* This reloc does nothing. */ + HOWTO (R_D10V_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An PC Relative 10-bit relocation, shifted by 2 */ + /* right container */ + HOWTO (R_D10V_10_PCREL_R, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 7, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_10_PCREL_R", /* name */ + FALSE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* An PC Relative 10-bit relocation, shifted by 2 */ + /* left container */ + HOWTO (R_D10V_10_PCREL_L, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 7, /* bitsize */ + TRUE, /* pc_relative */ + 15, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_10_PCREL_L", /* name */ + FALSE, /* partial_inplace */ + 0x07f8000, /* src_mask */ + 0x07f8000, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 16 bit absolute relocation */ + HOWTO (R_D10V_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 18 bit absolute relocation, right shifted 2 */ + HOWTO (R_D10V_18, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_18", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A relative 18 bit relocation, right shifted by 2 */ + HOWTO (R_D10V_18_PCREL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_18_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 32 bit absolute relocation */ + HOWTO (R_D10V_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D10V_32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_D10V_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_D10V_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_D10V_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_D10V_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + }; + +/* Map BFD reloc types to D10V ELF reloc types. */ + +struct d10v_reloc_map + { + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; + }; + +static const struct d10v_reloc_map d10v_reloc_map[] = + { + { BFD_RELOC_NONE, R_D10V_NONE, }, + { BFD_RELOC_D10V_10_PCREL_R, R_D10V_10_PCREL_R }, + { BFD_RELOC_D10V_10_PCREL_L, R_D10V_10_PCREL_L }, + { BFD_RELOC_16, R_D10V_16 }, + { BFD_RELOC_D10V_18, R_D10V_18 }, + { BFD_RELOC_D10V_18_PCREL, R_D10V_18_PCREL }, + { BFD_RELOC_32, R_D10V_32 }, + { BFD_RELOC_VTABLE_INHERIT, R_D10V_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_D10V_GNU_VTENTRY }, + }; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; + i < sizeof (d10v_reloc_map) / sizeof (struct d10v_reloc_map); + i++) + { + if (d10v_reloc_map[i].bfd_reloc_val == code) + return &elf_d10v_howto_table[d10v_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Set the howto pointer for an D10V ELF reloc. */ + +static void +d10v_info_to_howto_rel (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_D10V_max); + cache_ptr->howto = &elf_d10v_howto_table[r_type]; +} + +static asection * +elf32_d10v_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_D10V_GNU_VTINHERIT: + case R_D10V_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +static bfd_boolean +elf32_d10v_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +{ + /* we don't use got and plt entries for d10v */ + return TRUE; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static bfd_boolean +elf32_d10v_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + switch (ELF32_R_TYPE (rel->r_info)) + { + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_D10V_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_D10V_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + } + } + + return TRUE; +} + +static bfd_vma +extract_rel_addend (abfd, where, howto) + bfd *abfd; + bfd_byte *where; + reloc_howto_type *howto; +{ + bfd_vma insn, val; + + switch (howto->size) + { + case 0: + insn = bfd_get_8 (abfd, where); + break; + case 1: + insn = bfd_get_16 (abfd, where); + break; + case 2: + insn = bfd_get_32 (abfd, where); + break; + default: + abort (); + } + + val = (insn & howto->dst_mask) >> howto->bitpos << howto->rightshift; + /* We should really be testing for signed addends here, but we don't + have that info directly in the howto. */ + if (howto->pc_relative) + { + bfd_vma sign; + sign = howto->dst_mask & (~howto->dst_mask >> 1 | ~(-(bfd_vma) 1 >> 1)); + sign = sign >> howto->bitpos << howto->rightshift; + val = (val ^ sign) - sign; + } + return val; +} + +static void +insert_rel_addend (abfd, where, howto, addend) + bfd *abfd; + bfd_byte *where; + reloc_howto_type *howto; + bfd_vma addend; +{ + bfd_vma insn; + + addend = (addend >> howto->rightshift << howto->bitpos) & howto->dst_mask; + insn = ~howto->dst_mask; + switch (howto->size) + { + case 0: + insn &= bfd_get_8 (abfd, where); + insn |= addend; + bfd_put_8 (abfd, insn, where); + break; + case 1: + insn &= bfd_get_16 (abfd, where); + insn |= addend; + bfd_put_16 (abfd, insn, where); + break; + case 2: + insn &= bfd_get_32 (abfd, where); + insn |= addend; + bfd_put_32 (abfd, insn, where); + break; + default: + abort (); + } +} + +/* Relocate a D10V ELF section. */ +static bfd_boolean +elf32_d10v_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + const char *name; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + + if (r_type == R_D10V_GNU_VTENTRY + || r_type == R_D10V_GNU_VTINHERIT ) + continue; + + howto = elf_d10v_howto_table + r_type; + + if (info->relocatable) + { + bfd_vma val; + bfd_byte *where; + + /* This is a relocatable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (r_symndx >= symtab_hdr->sh_info) + continue; + + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) + continue; + + sec = local_sections[r_symndx]; + val = sec->output_offset; + if (val == 0) + continue; + + where = contents + rel->r_offset; + val += extract_rel_addend (input_bfd, where, howto); + insert_rel_addend (input_bfd, where, howto, val); + continue; + } + + /* This is a final link. */ + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + if ((sec->flags & SEC_MERGE) + && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + asection *msec; + bfd_vma addend; + bfd_byte *where = contents + rel->r_offset; + + addend = extract_rel_addend (input_bfd, where, howto); + msec = sec; + addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend); + addend -= relocation; + addend += msec->output_section->vma + msec->output_offset; + insert_rel_addend (input_bfd, where, howto, addend); + } + } + else + { + bfd_boolean unresolved_reloc, warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + } + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL || *name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, (bfd_vma) 0); + + if (r != bfd_reloc_ok) + { + const char * msg = (const char *) 0; + + switch (r) + { + case bfd_reloc_overflow: + if (!((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return FALSE; + break; + + case bfd_reloc_undefined: + if (!((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, + rel->r_offset, TRUE))) + return FALSE; + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + goto common_error; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + goto common_error; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous error"); + goto common_error; + + default: + msg = _("internal error: unknown error"); + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, msg, name, input_bfd, input_section, + rel->r_offset))) + return FALSE; + break; + } + } + } + + return TRUE; +} +#define ELF_ARCH bfd_arch_d10v +#define ELF_MACHINE_CODE EM_D10V +#define ELF_MACHINE_ALT1 EM_CYGNUS_D10V +#define ELF_MAXPAGESIZE 0x1000 + +#define TARGET_BIG_SYM bfd_elf32_d10v_vec +#define TARGET_BIG_NAME "elf32-d10v" + +#define elf_info_to_howto 0 +#define elf_info_to_howto_rel d10v_info_to_howto_rel +#define elf_backend_object_p 0 +#define elf_backend_final_write_processing 0 +#define elf_backend_gc_mark_hook elf32_d10v_gc_mark_hook +#define elf_backend_gc_sweep_hook elf32_d10v_gc_sweep_hook +#define elf_backend_check_relocs elf32_d10v_check_relocs +#define elf_backend_relocate_section elf32_d10v_relocate_section +#define elf_backend_can_gc_sections 1 + +#include "elf32-target.h" diff --git a/bfd/elf32-d30v.c b/bfd/elf32-d30v.c new file mode 100644 index 0000000000000..b08977f2f9674 --- /dev/null +++ b/bfd/elf32-d30v.c @@ -0,0 +1,562 @@ +/* D30V-specific support for 32-bit ELF + Copyright 1997, 1998, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. + Contributed by Martin Hunt (hunt@cygnus.com). + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/d30v.h" + +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void d30v_info_to_howto_rel + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static void d30v_info_to_howto_rela + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static bfd_reloc_status_type bfd_elf_d30v_reloc PARAMS (( + bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + PTR data, + asection *input_section, + bfd *output_bfd, + char **error_message)); +static bfd_reloc_status_type bfd_elf_d30v_reloc_21 PARAMS (( + bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + PTR data, + asection *input_section, + bfd *output_bfd, + char **error_message)); + +static reloc_howto_type elf_d30v_howto_table[] = +{ + /* This reloc does nothing. */ + HOWTO (R_D30V_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D30V_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 6 bit absolute relocation */ + HOWTO (R_D30V_6, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D30V_6", /* name */ + FALSE, /* partial_inplace */ + 0x3f, /* src_mask */ + 0x3f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A relative 9 bit relocation, right shifted by 3 */ + HOWTO (R_D30V_9_PCREL, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_d30v_reloc_21, /* special_function */ + "R_D30V_9_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0x3f, /* src_mask */ + 0x3f, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A relative 9 bit relocation, right shifted by 3 */ + HOWTO (R_D30V_9_PCREL_R, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_d30v_reloc_21, /* special_function */ + "R_D30V_9_PCREL_R", /* name */ + FALSE, /* partial_inplace */ + 0x3f, /* src_mask */ + 0x3f, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* An absolute 15 bit relocation, right shifted by 3 */ + HOWTO (R_D30V_15, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D30V_15", /* name */ + FALSE, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A relative 15 bit relocation, right shifted by 3 */ + HOWTO (R_D30V_15_PCREL, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_d30v_reloc_21, /* special_function */ + "R_D30V_15_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A relative 15 bit relocation, right shifted by 3 */ + HOWTO (R_D30V_15_PCREL_R, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_d30v_reloc_21, /* special_function */ + "R_D30V_15_PCREL_R", /* name */ + FALSE, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* An absolute 21 bit relocation, right shifted by 3 */ + HOWTO (R_D30V_21, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 18, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D30V_21", /* name */ + FALSE, /* partial_inplace */ + 0x3ffff, /* src_mask */ + 0x3ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A relative 21 bit relocation, right shifted by 3 */ + HOWTO (R_D30V_21_PCREL, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 18, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_d30v_reloc_21, /* special_function */ + "R_D30V_21_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0x3ffff, /* src_mask */ + 0x3ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A relative 21 bit relocation, right shifted by 3, in the Right container */ + HOWTO (R_D30V_21_PCREL_R, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 18, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_d30v_reloc_21, /* special_function */ + "R_D30V_21_PCREL_R", /* name */ + FALSE, /* partial_inplace */ + 0x3ffff, /* src_mask */ + 0x3ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A D30V 32 bit absolute relocation */ + HOWTO (R_D30V_32, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_d30v_reloc, /* special_function */ + "R_D30V_32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A relative 32 bit relocation */ + HOWTO (R_D30V_32_PCREL, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_d30v_reloc, /* special_function */ + "R_D30V_32_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A regular 32 bit absolute relocation */ + HOWTO (R_D30V_32_NORMAL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D30V_32_NORMAL", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + +}; + +#define MAX32 ((bfd_signed_vma) 0x7fffffff) +#define MIN32 (- MAX32 - 1) + +static bfd_reloc_status_type +bfd_elf_d30v_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + bfd_signed_vma relocation; + bfd_vma in1, in2, num; + bfd_vma tmp_addr = 0; + bfd_reloc_status_type r; + asection *reloc_target_output_section; + bfd_size_type addr = reloc_entry->address; + bfd_reloc_status_type flag = bfd_reloc_ok; + bfd_vma output_base = 0; + reloc_howto_type *howto = reloc_entry->howto; + int make_absolute = 0; + + if (output_bfd != (bfd *) NULL) + { + /* Partial linking -- do nothing. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + if (r != bfd_reloc_continue) + return r; + + /* a hacked-up version of bfd_perform_reloc() follows */ + if (bfd_is_und_section (symbol->section) + && (symbol->flags & BSF_WEAK) == 0 + && output_bfd == (bfd *) NULL) + flag = bfd_reloc_undefined; + + /* Is the address of the relocation really within the section? */ + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + /* Work out which section the relocation is targeted at and the + initial relocation command value. */ + + /* Get symbol value. (Common symbols are special.) */ + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + reloc_target_output_section = symbol->section->output_section; + + /* Convert input-section-relative symbol value to absolute. */ + output_base = reloc_target_output_section->vma; + relocation += output_base + symbol->section->output_offset; + + /* Add in supplied addend. */ + relocation += reloc_entry->addend; + + /* Here the variable relocation holds the final address of the + symbol we are relocating against, plus any addend. */ + + if (howto->pc_relative) + { + tmp_addr = input_section->output_section->vma + input_section->output_offset + + reloc_entry->address; + relocation -= tmp_addr; + } + + in1 = bfd_get_32 (abfd, (bfd_byte *) data + addr); + in2 = bfd_get_32 (abfd, (bfd_byte *) data + addr + 4); + + /* extract the addend */ + num = ((in2 & 0x3FFFF) + | ((in2 & 0xFF00000) >> 2) + | ((in1 & 0x3F) << 26)); + in1 &= 0xFFFFFFC0; + in2 = 0x80000000; + + relocation += num; + + if (howto->pc_relative && howto->bitsize == 32) + { + /* The D30V has a PC that doesn't wrap and PC-relative jumps are + signed, so a PC-relative jump can't be more than +/- 2^31 bytes. + If one exceeds this, change it to an absolute jump. */ + if (relocation > MAX32 || relocation < MIN32) + { + relocation = (relocation + tmp_addr) & 0xffffffff; + make_absolute = 1; + } + } + + in1 |= (relocation >> 26) & 0x3F; /* top 6 bits */ + in2 |= ((relocation & 0x03FC0000) << 2); /* next 8 bits */ + in2 |= relocation & 0x0003FFFF; /* bottom 18 bits */ + + /* change a PC-relative instruction to its absolute equivalent */ + /* with this simple hack */ + if (make_absolute) + in1 |= 0x00100000; + + bfd_put_32 (abfd, in1, (bfd_byte *) data + addr); + bfd_put_32 (abfd, in2, (bfd_byte *) data + addr + 4); + + return flag; +} + +static bfd_reloc_status_type +bfd_elf_d30v_reloc_21 (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + bfd_vma relocation; + bfd_vma in1, num; + bfd_reloc_status_type r; + asection *reloc_target_output_section; + bfd_size_type addr = reloc_entry->address; + bfd_reloc_status_type flag = bfd_reloc_ok; + bfd_vma output_base = 0; + reloc_howto_type *howto = reloc_entry->howto; + int mask, max; + + if (output_bfd != (bfd *) NULL) + { + /* Partial linking -- do nothing. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + if (r != bfd_reloc_continue) + return r; + + /* a hacked-up version of bfd_perform_reloc() follows */ + if (bfd_is_und_section (symbol->section) + && (symbol->flags & BSF_WEAK) == 0 + && output_bfd == (bfd *) NULL) + flag = bfd_reloc_undefined; + + /* Is the address of the relocation really within the section? */ + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + /* Work out which section the relocation is targeted at and the + initial relocation command value. */ + + /* Get symbol value. (Common symbols are special.) */ + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + reloc_target_output_section = symbol->section->output_section; + + /* Convert input-section-relative symbol value to absolute. */ + output_base = reloc_target_output_section->vma; + relocation += output_base + symbol->section->output_offset; + + /* Add in supplied addend. */ + relocation += reloc_entry->addend; + + /* Here the variable relocation holds the final address of the + symbol we are relocating against, plus any addend. */ + + if (howto->pc_relative) + { + relocation -= (input_section->output_section->vma + + input_section->output_offset); + if (howto->pcrel_offset) + relocation -= reloc_entry->address; + } + + in1 = bfd_get_32 (abfd, (bfd_byte *) data + addr); + + mask = (1 << howto->bitsize) - 1; + if (howto->bitsize == 6) + mask <<= 12; + max = (1 << (howto->bitsize + 2)) - 1; + + /* extract the addend */ + num = in1 & mask; /* 18 bits */ + if (howto->bitsize == 6) + num >>= 12; + num <<= 3; /* shift left 3 */ + in1 &= ~mask; /* mask out addend */ + + relocation += num; + if (howto->type == R_D30V_21_PCREL_R || howto->type == R_D30V_15_PCREL_R || + howto->type == R_D30V_9_PCREL_R ) + { + relocation += 4; + } + + if ((int)relocation < 0 ) + { + if (~(int)relocation > max) + flag = bfd_reloc_overflow; + } + else + { + if ((int)relocation > max) + flag = bfd_reloc_overflow; + } + relocation >>= 3; + if (howto->bitsize == 6) + in1 |= ((relocation & (mask >> 12)) << 12); + else + in1 |= relocation & mask; + + bfd_put_32 (abfd, in1, (bfd_byte *) data + addr); + + return flag; +} + +/* Map BFD reloc types to D30V ELF reloc types. */ + +struct d30v_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +static const struct d30v_reloc_map d30v_reloc_map[] = +{ + { BFD_RELOC_NONE, R_D30V_NONE, }, + { BFD_RELOC_D30V_6, R_D30V_6 }, + { BFD_RELOC_D30V_9_PCREL, R_D30V_9_PCREL }, + { BFD_RELOC_D30V_9_PCREL_R, R_D30V_9_PCREL_R }, + { BFD_RELOC_D30V_15, R_D30V_15 }, + { BFD_RELOC_D30V_15_PCREL, R_D30V_15_PCREL }, + { BFD_RELOC_D30V_15_PCREL_R, R_D30V_15_PCREL_R }, + { BFD_RELOC_D30V_21, R_D30V_21 }, + { BFD_RELOC_D30V_21_PCREL, R_D30V_21_PCREL }, + { BFD_RELOC_D30V_21_PCREL_R, R_D30V_21_PCREL_R }, + { BFD_RELOC_D30V_32, R_D30V_32 }, + { BFD_RELOC_D30V_32_PCREL, R_D30V_32_PCREL }, + { BFD_RELOC_32, R_D30V_32_NORMAL }, +}; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; + i < sizeof (d30v_reloc_map) / sizeof (struct d30v_reloc_map); + i++) + { + if (d30v_reloc_map[i].bfd_reloc_val == code) + return &elf_d30v_howto_table[d30v_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Set the howto pointer for an D30V ELF reloc (type REL). */ + +static void +d30v_info_to_howto_rel (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_D30V_max); + cache_ptr->howto = &elf_d30v_howto_table[r_type]; +} + +/* Set the howto pointer for an D30V ELF reloc (type RELA). */ + +static void +d30v_info_to_howto_rela (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_D30V_max); + cache_ptr->howto = &elf_d30v_howto_table[r_type]; +} + +#define ELF_ARCH bfd_arch_d30v +#define ELF_MACHINE_CODE EM_D30V +#define ELF_MACHINE_ALT1 EM_CYGNUS_D30V +#define ELF_MAXPAGESIZE 0x1000 + +#define TARGET_BIG_SYM bfd_elf32_d30v_vec +#define TARGET_BIG_NAME "elf32-d30v" + +#define elf_info_to_howto d30v_info_to_howto_rela +#define elf_info_to_howto_rel d30v_info_to_howto_rel +#define elf_backend_object_p 0 +#define elf_backend_final_write_processing 0 + +#include "elf32-target.h" diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c new file mode 100644 index 0000000000000..7fb6d0c19e24a --- /dev/null +++ b/bfd/elf32-dlx.c @@ -0,0 +1,660 @@ +/* DLX specific support for 32-bit ELF + Copyright 2002, 2003 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/dlx.h" + +int set_dlx_skip_hi16_flag PARAMS ((int)); + +static bfd_boolean elf32_dlx_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static void elf32_dlx_info_to_howto + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static void elf32_dlx_info_to_howto_rel + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static bfd_reloc_status_type elf32_dlx_relocate16 + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type elf32_dlx_relocate26 + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static reloc_howto_type *elf32_dlx_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static bfd_reloc_status_type _bfd_dlx_elf_hi16_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static reloc_howto_type * dlx_rtype_to_howto + PARAMS ((unsigned int)); + + +#define USE_REL 1 + +#define bfd_elf32_bfd_reloc_type_lookup elf32_dlx_reloc_type_lookup +#define elf_info_to_howto elf32_dlx_info_to_howto +#define elf_info_to_howto_rel elf32_dlx_info_to_howto_rel +#define elf_backend_check_relocs elf32_dlx_check_relocs + +static reloc_howto_type dlx_elf_howto_table[]= + { + /* No relocation. */ + HOWTO (R_DLX_NONE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_DLX_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 8 bit relocation. */ + HOWTO (R_DLX_RELOC_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_DLX_RELOC_8", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16 bit relocation. */ + HOWTO (R_DLX_RELOC_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_DLX_RELOC_16", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + +#if 0 + /* 26 bit jump address. */ + HOWTO (R_DLX_RELOC_26, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + /* This needs complex overflow detection, because the upper four + bits must match the PC + 4. */ + bfd_elf_generic_reloc, /* special_function */ + "R_DLX_RELOC_26", /* name */ + TRUE, /* partial_inplace */ + 0x3ffffff, /* src_mask */ + 0x3ffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +#endif + + /* 32 bit relocation. */ + HOWTO (R_DLX_RELOC_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_DLX_RELOC_32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_DLX_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + NULL, /* special_function */ + "R_DLX_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_DLX_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn,/* special_function */ + "R_DLX_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE) /* pcrel_offset */ + }; + +/* 16 bit offset for pc-relative branches. */ +static reloc_howto_type elf_dlx_gnu_rel16_s2 = +HOWTO (R_DLX_RELOC_16_PCREL, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + elf32_dlx_relocate16, /* special_function */ + "R_DLX_RELOC_16_PCREL",/* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE); /* pcrel_offset */ + +/* 26 bit offset for pc-relative branches. */ +static reloc_howto_type elf_dlx_gnu_rel26_s2 = +HOWTO (R_DLX_RELOC_26_PCREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + elf32_dlx_relocate26, /* special_function */ + "R_DLX_RELOC_26_PCREL",/* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE); /* pcrel_offset */ + +/* High 16 bits of symbol value. */ +static reloc_howto_type elf_dlx_reloc_16_hi = +HOWTO (R_DLX_RELOC_16_HI, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_dlx_elf_hi16_reloc,/* special_function */ + "R_DLX_RELOC_16_HI", /* name */ + TRUE, /* partial_inplace */ + 0xFFFF, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE); /* pcrel_offset */ + + /* Low 16 bits of symbol value. */ +static reloc_howto_type elf_dlx_reloc_16_lo = +HOWTO (R_DLX_RELOC_16_LO, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_DLX_RELOC_16_LO", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE); /* pcrel_offset */ + + +/* The gas default behavior is not to preform the %hi modifier so that the + GNU assembler can have the lower 16 bits offset placed in the insn, BUT + we do like the gas to indicate it is %hi reloc type so when we in the link + loader phase we can have the corrected hi16 vale replace the buggous lo16 + value that was placed there by gas. */ + +static int skip_dlx_elf_hi16_reloc = 0; + +int +set_dlx_skip_hi16_flag (flag) + int flag; +{ + skip_dlx_elf_hi16_reloc = flag; + return flag; +} + +static bfd_reloc_status_type +_bfd_dlx_elf_hi16_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + bfd_reloc_status_type ret; + bfd_vma relocation; + + /* If the skip flag is set then we simply do the generic relocating, this + is more of a hack for dlx gas/gld, so we do not need to do the %hi/%lo + fixup like mips gld did. */ +#if 0 + printf ("DEBUG: skip_dlx_elf_hi16_reloc = 0x%08x\n", skip_dlx_elf_hi16_reloc); +#endif + if (skip_dlx_elf_hi16_reloc) + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + + /* If we're relocating, and this an external symbol, we don't want + to change anything. */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && reloc_entry->addend == 0) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + ret = bfd_reloc_ok; + + if (bfd_is_und_section (symbol->section) + && output_bfd == (bfd *) NULL) + ret = bfd_reloc_undefined; + +#if 0 + { + unsigned long vallo, val; + + vallo = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); + printf ("DEBUG: The relocation address = 0x%08x\n", reloc_entry->address); + printf ("DEBUG: The symbol = 0x%08x\n", vallo); + printf ("DEBUG: The symbol name = %s\n", bfd_asymbol_name (symbol)); + printf ("DEBUG: The symbol->value = 0x%08x\n", symbol->value); + printf ("DEBUG: The vma = 0x%08x\n", symbol->section->output_section->vma); + printf ("DEBUG: The output_offset = 0x%08x\n", symbol->section->output_offset); + printf ("DEBUG: The input_offset = 0x%08x\n", input_section->output_offset); + printf ("DEBUG: The input_vma = 0x%08x\n", input_section->vma); + printf ("DEBUG: The addend = 0x%08x\n", reloc_entry->addend); + } +#endif + + relocation = (bfd_is_com_section (symbol->section)) ? 0 : symbol->value; + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + relocation += bfd_get_16 (abfd, (bfd_byte *)data + reloc_entry->address); + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + +#if 0 + printf ("DEBUG: The finial relocation value = 0x%08x\n", relocation); +#endif + + bfd_put_16 (abfd, (short)((relocation >> 16) & 0xFFFF), + (bfd_byte *)data + reloc_entry->address); + + return ret; +} + +/* ELF relocs are against symbols. If we are producing relocatable + output, and the reloc is against an external symbol, and nothing + has given us any additional addend, the resulting reloc will also + be against the same symbol. In such a case, we don't want to + change anything about the way the reloc is handled, since it will + all be done at final link time. Rather than put special case code + into bfd_perform_relocation, all the reloc types use this howto + function. It just short circuits the reloc if producing + relocatable output against an external symbol. */ + +static bfd_reloc_status_type +elf32_dlx_relocate16 (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + unsigned long insn, vallo, allignment; + int val; + + /* HACK: I think this first condition is necessary when producing + relocatable output. After the end of HACK, the code is identical + to bfd_elf_generic_reloc(). I would _guess_ the first change + belongs there rather than here. martindo 1998-10-23. */ + + if (skip_dlx_elf_hi16_reloc) + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + + /* Check undefined section and undefined symbols */ + if (bfd_is_und_section (symbol->section) + && output_bfd == (bfd *) NULL) + return bfd_reloc_undefined; + + /* Can not support a long jump to sections other then .text */ + if (strcmp (input_section->name, symbol->section->output_section->name) != 0) + { + fprintf (stderr, + "BFD Link Error: branch (PC rel16) to section (%s) not supported\n", + symbol->section->output_section->name); + return bfd_reloc_undefined; + } + + insn = bfd_get_32 (abfd, (bfd_byte *)data + reloc_entry->address); + allignment = 1 << (input_section->output_section->alignment_power - 1); + vallo = insn & 0x0000FFFF; + + if (vallo & 0x8000) + vallo = ~(vallo | 0xFFFF0000) + 1; + + /* vallo points to the vma of next instruction. */ + vallo += (((unsigned long)(input_section->output_section->vma + + input_section->output_offset) + + allignment) & ~allignment); + + /* val is the displacement (PC relative to next instruction). */ + val = (symbol->section->output_offset + + symbol->section->output_section->vma + + symbol->value) - vallo; +#if 0 + printf ("DEBUG elf32_dlx_relocate: We are here\n"); + printf ("DEBUG: The insn = 0x%08x\n", insn); + printf ("DEBUG: The vallo = 0x%08x\n", vallo); + printf ("DEBUG: The val = 0x%08x\n", val); + printf ("DEBUG: The symbol name = %s\n", bfd_asymbol_name (symbol)); + printf ("DEBUG: The symbol->value = 0x%08x\n", symbol->value); + printf ("DEBUG: The vma = 0x%08x\n", symbol->section->output_section->vma); + printf ("DEBUG: The lma = 0x%08x\n", symbol->section->output_section->lma); + printf ("DEBUG: The alignment_power = 0x%08x\n", symbol->section->output_section->alignment_power); + printf ("DEBUG: The output_offset = 0x%08x\n", symbol->section->output_offset); + printf ("DEBUG: The addend = 0x%08x\n", reloc_entry->addend); +#endif + + if (abs ((int) val) > 0x00007FFF) + return bfd_reloc_outofrange; + + insn = (insn & 0xFFFF0000) | (val & 0x0000FFFF); + + bfd_put_32 (abfd, insn, + (bfd_byte *) data + reloc_entry->address); + + return bfd_reloc_ok; +} + +static bfd_reloc_status_type +elf32_dlx_relocate26 (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + unsigned long insn, vallo, allignment; + int val; + + /* HACK: I think this first condition is necessary when producing + relocatable output. After the end of HACK, the code is identical + to bfd_elf_generic_reloc(). I would _guess_ the first change + belongs there rather than here. martindo 1998-10-23. */ + + if (skip_dlx_elf_hi16_reloc) + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + + /* Check undefined section and undefined symbols. */ + if (bfd_is_und_section (symbol->section) + && output_bfd == (bfd *) NULL) + return bfd_reloc_undefined; + + /* Can not support a long jump to sections other then .text */ + if (strcmp (input_section->name, symbol->section->output_section->name) != 0) + { + fprintf (stderr, + "BFD Link Error: jump (PC rel26) to section (%s) not supported\n", + symbol->section->output_section->name); + return bfd_reloc_undefined; + } + + insn = bfd_get_32 (abfd, (bfd_byte *)data + reloc_entry->address); + allignment = 1 << (input_section->output_section->alignment_power - 1); + vallo = insn & 0x03FFFFFF; + + if (vallo & 0x03000000) + vallo = ~(vallo | 0xFC000000) + 1; + + /* vallo is the vma for the next instruction. */ + vallo += (((unsigned long) (input_section->output_section->vma + + input_section->output_offset) + + allignment) & ~allignment); + + /* val is the displacement (PC relative to next instruction). */ + val = (symbol->section->output_offset + + symbol->section->output_section->vma + symbol->value) + - vallo; +#if 0 + printf ("DEBUG elf32_dlx_relocate26: We are here\n"); + printf ("DEBUG: The insn = 0x%08x\n", insn); + printf ("DEBUG: The vallo = 0x%08x\n", vallo); + printf ("DEBUG: The val = 0x%08x\n", val); + printf ("DEBUG: The abs(val) = 0x%08x\n", abs (val)); + printf ("DEBUG: The symbol name = %s\n", bfd_asymbol_name (symbol)); + printf ("DEBUG: The symbol->value = 0x%08x\n", symbol->value); + printf ("DEBUG: The vma = 0x%08x\n", symbol->section->output_section->vma); + printf ("DEBUG: The output_offset = 0x%08x\n", symbol->section->output_offset); + printf ("DEBUG: The input_vma = 0x%08x\n", input_section->output_section->vma); + printf ("DEBUG: The input_offset = 0x%08x\n", input_section->output_offset); + printf ("DEBUG: The input_name = %s\n", input_section->name); + printf ("DEBUG: The addend = 0x%08x\n", reloc_entry->addend); +#endif + + if (abs ((int) val) > 0x01FFFFFF) + return bfd_reloc_outofrange; + + insn = (insn & 0xFC000000) | (val & 0x03FFFFFF); + bfd_put_32 (abfd, insn, + (bfd_byte *) data + reloc_entry->address); + + return bfd_reloc_ok; +} + +/* A mapping from BFD reloc types to DLX ELF reloc types. + Stolen from elf32-mips.c. + + More about this table - for dlx elf relocation we do not really + need this table, if we have a rtype defined in this table will + caused tc_gen_relocate confused and die on us, but if we remove + this table it will caused more problem, so for now simple solution + is to remove those entries which may cause problem. */ +struct elf_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + enum elf_dlx_reloc_type elf_reloc_val; +}; + +static const struct elf_reloc_map dlx_reloc_map[] = + { + { BFD_RELOC_NONE, R_DLX_NONE }, + { BFD_RELOC_16, R_DLX_RELOC_16 }, +#if 0 + { BFD_RELOC_DLX_JMP26, R_DLX_RELOC_26_PCREL }, +#endif + { BFD_RELOC_32, R_DLX_RELOC_32 }, + { BFD_RELOC_DLX_HI16_S, R_DLX_RELOC_16_HI }, + { BFD_RELOC_DLX_LO16, R_DLX_RELOC_16_LO }, + { BFD_RELOC_VTABLE_INHERIT, R_DLX_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_DLX_GNU_VTENTRY } + }; + + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static bfd_boolean +elf32_dlx_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + switch (ELF32_R_TYPE (rel->r_info)) + { + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_DLX_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_DLX_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + } + } + + return TRUE; +} + +/* Given a BFD reloc type, return a howto structure. */ + +static reloc_howto_type * +elf32_dlx_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; i < sizeof (dlx_reloc_map) / sizeof (struct elf_reloc_map); i++) + if (dlx_reloc_map[i].bfd_reloc_val == code) + return &dlx_elf_howto_table[(int) dlx_reloc_map[i].elf_reloc_val]; + + switch (code) + { + default: + bfd_set_error (bfd_error_bad_value); + return NULL; + case BFD_RELOC_16_PCREL_S2: + return &elf_dlx_gnu_rel16_s2; + case BFD_RELOC_DLX_JMP26: + return &elf_dlx_gnu_rel26_s2; + case BFD_RELOC_HI16_S: + return &elf_dlx_reloc_16_hi; + case BFD_RELOC_LO16: + return &elf_dlx_reloc_16_lo; + } +} + +static reloc_howto_type * +dlx_rtype_to_howto (r_type) + unsigned int r_type; +{ + switch (r_type) + { + case R_DLX_RELOC_16_PCREL: + return & elf_dlx_gnu_rel16_s2; + break; + case R_DLX_RELOC_26_PCREL: + return & elf_dlx_gnu_rel26_s2; + break; + case R_DLX_RELOC_16_HI: + return & elf_dlx_reloc_16_hi; + break; + case R_DLX_RELOC_16_LO: + return & elf_dlx_reloc_16_lo; + break; + + default: + BFD_ASSERT (r_type < (unsigned int) R_DLX_max); + return & dlx_elf_howto_table[r_type]; + break; + } +} + +static void +elf32_dlx_info_to_howto (abfd, cache_ptr, dst) + bfd * abfd ATTRIBUTE_UNUSED; + arelent * cache_ptr ATTRIBUTE_UNUSED; + Elf_Internal_Rela * dst ATTRIBUTE_UNUSED; +{ + abort (); +} + +static void +elf32_dlx_info_to_howto_rel (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + cache_ptr->howto = dlx_rtype_to_howto (r_type); + return; +} + +#define TARGET_BIG_SYM bfd_elf32_dlx_big_vec +#define TARGET_BIG_NAME "elf32-dlx" +#define ELF_ARCH bfd_arch_dlx +#define ELF_MACHINE_CODE EM_DLX +#define ELF_MAXPAGESIZE 1 /* FIXME: This number is wrong, It should be the page size in bytes. */ + +#include "elf32-target.h" diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c new file mode 100644 index 0000000000000..5f70e3f1865e3 --- /dev/null +++ b/bfd/elf32-fr30.c @@ -0,0 +1,757 @@ +/* FR30-specific support for 32-bit ELF. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/fr30.h" + +/* Forward declarations. */ +static bfd_reloc_status_type fr30_elf_i20_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type fr30_elf_i32_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static reloc_howto_type * fr30_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void fr30_info_to_howto_rela + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static bfd_boolean fr30_elf_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static bfd_reloc_status_type fr30_final_link_relocate + PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, bfd_vma)); +static bfd_boolean fr30_elf_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static asection * fr30_elf_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static bfd_boolean fr30_elf_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); + +static reloc_howto_type fr30_elf_howto_table [] = +{ + /* This reloc does nothing. */ + HOWTO (R_FR30_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FR30_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 8 bit absolute relocation. */ + HOWTO (R_FR30_8, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 4, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FR30_8", /* name */ + TRUE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0x0ff0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 20 bit absolute relocation. */ + HOWTO (R_FR30_20, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 20, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + fr30_elf_i20_reloc, /* special_function */ + "R_FR30_20", /* name */ + TRUE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0x00f0ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit absolute relocation. */ + HOWTO (R_FR30_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FR30_32", /* name */ + TRUE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit into 48 bits absolute relocation. */ + HOWTO (R_FR30_48, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + fr30_elf_i32_reloc, /* special_function */ + "R_FR30_48", /* name */ + TRUE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 6 bit absolute relocation. */ + HOWTO (R_FR30_6_IN_4, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + FALSE, /* pc_relative */ + 4, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FR30_6_IN_4", /* name */ + TRUE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0x00f0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 8 bit absolute relocation. */ + HOWTO (R_FR30_8_IN_8, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 4, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc,/* special_function */ + "R_FR30_8_IN_8", /* name */ + TRUE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0x0ff0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 9 bit absolute relocation. */ + HOWTO (R_FR30_9_IN_8, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 9, /* bitsize */ + FALSE, /* pc_relative */ + 4, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc,/* special_function */ + "R_FR30_9_IN_8", /* name */ + TRUE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0x0ff0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 10 bit absolute relocation. */ + HOWTO (R_FR30_10_IN_8, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 10, /* bitsize */ + FALSE, /* pc_relative */ + 4, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc,/* special_function */ + "R_FR30_10_IN_8", /* name */ + TRUE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0x0ff0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A PC relative 9 bit relocation, right shifted by 1. */ + HOWTO (R_FR30_9_PCREL, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 9, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FR30_9_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0x00ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A PC relative 12 bit relocation, right shifted by 1. */ + HOWTO (R_FR30_12_PCREL, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FR30_12_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0x07ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_FR30_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_FR30_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_FR30_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_FR30_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; + +/* Utility to actually perform an R_FR30_20 reloc. */ + +static bfd_reloc_status_type +fr30_elf_i20_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + bfd_vma relocation; + unsigned long x; + + /* This part is from bfd_elf_generic_reloc. */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc_entry->howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (output_bfd != NULL) + /* FIXME: See bfd_perform_relocation. Is this right? */ + return bfd_reloc_ok; + + relocation = + symbol->value + + symbol->section->output_section->vma + + symbol->section->output_offset + + reloc_entry->addend; + + if (relocation > (((bfd_vma) 1 << 20) - 1)) + return bfd_reloc_overflow; + + x = bfd_get_32 (abfd, (char *) data + reloc_entry->address); + x = (x & 0xff0f0000) | (relocation & 0x0000ffff) | ((relocation & 0x000f0000) << 4); + bfd_put_32 (abfd, (bfd_vma) x, (char *) data + reloc_entry->address); + + return bfd_reloc_ok; +} + +/* Utility to actually perform a R_FR30_48 reloc. */ + +static bfd_reloc_status_type +fr30_elf_i32_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + bfd_vma relocation; + + /* This part is from bfd_elf_generic_reloc. */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc_entry->howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (output_bfd != NULL) + /* FIXME: See bfd_perform_relocation. Is this right? */ + return bfd_reloc_ok; + + relocation = + symbol->value + + symbol->section->output_section->vma + + symbol->section->output_offset + + reloc_entry->addend; + + bfd_put_32 (abfd, relocation, (char *) data + reloc_entry->address + 2); + + return bfd_reloc_ok; +} + +/* Map BFD reloc types to FR30 ELF reloc types. */ + +struct fr30_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned int fr30_reloc_val; +}; + +static const struct fr30_reloc_map fr30_reloc_map [] = +{ + { BFD_RELOC_NONE, R_FR30_NONE }, + { BFD_RELOC_8, R_FR30_8 }, + { BFD_RELOC_FR30_20, R_FR30_20 }, + { BFD_RELOC_32, R_FR30_32 }, + { BFD_RELOC_FR30_48, R_FR30_48 }, + { BFD_RELOC_FR30_6_IN_4, R_FR30_6_IN_4 }, + { BFD_RELOC_FR30_8_IN_8, R_FR30_8_IN_8 }, + { BFD_RELOC_FR30_9_IN_8, R_FR30_9_IN_8 }, + { BFD_RELOC_FR30_10_IN_8, R_FR30_10_IN_8 }, + { BFD_RELOC_FR30_9_PCREL, R_FR30_9_PCREL }, + { BFD_RELOC_FR30_12_PCREL, R_FR30_12_PCREL }, + { BFD_RELOC_VTABLE_INHERIT, R_FR30_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_FR30_GNU_VTENTRY }, +}; + +static reloc_howto_type * +fr30_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = sizeof (fr30_reloc_map) / sizeof (fr30_reloc_map[0]); + --i;) + if (fr30_reloc_map [i].bfd_reloc_val == code) + return & fr30_elf_howto_table [fr30_reloc_map[i].fr30_reloc_val]; + + return NULL; +} + +/* Set the howto pointer for an FR30 ELF reloc. */ + +static void +fr30_info_to_howto_rela (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_FR30_max); + cache_ptr->howto = & fr30_elf_howto_table [r_type]; +} + +/* Perform a single relocation. By default we use the standard BFD + routines, but a few relocs, we have to do them ourselves. */ + +static bfd_reloc_status_type +fr30_final_link_relocate (howto, input_bfd, input_section, contents, rel, + relocation) + reloc_howto_type *howto; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *rel; + bfd_vma relocation; +{ + bfd_reloc_status_type r = bfd_reloc_ok; + bfd_vma x; + bfd_signed_vma srel; + + switch (howto->type) + { + case R_FR30_20: + contents += rel->r_offset; + relocation += rel->r_addend; + + if (relocation > ((1 << 20) - 1)) + return bfd_reloc_overflow; + + x = bfd_get_32 (input_bfd, contents); + x = (x & 0xff0f0000) | (relocation & 0x0000ffff) | ((relocation & 0x000f0000) << 4); + bfd_put_32 (input_bfd, x, contents); + break; + + case R_FR30_48: + contents += rel->r_offset + 2; + relocation += rel->r_addend; + bfd_put_32 (input_bfd, relocation, contents); + break; + + case R_FR30_9_PCREL: + contents += rel->r_offset + 1; + srel = (bfd_signed_vma) relocation; + srel += rel->r_addend; + srel -= rel->r_offset; + srel -= 2; /* Branch instructions add 2 to the PC... */ + srel -= (input_section->output_section->vma + + input_section->output_offset); + + if (srel & 1) + return bfd_reloc_outofrange; + if (srel > ((1 << 8) - 1) || (srel < - (1 << 8))) + return bfd_reloc_overflow; + + bfd_put_8 (input_bfd, srel >> 1, contents); + break; + + case R_FR30_12_PCREL: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation; + srel += rel->r_addend; + srel -= rel->r_offset; + srel -= 2; /* Branch instructions add 2 to the PC... */ + srel -= (input_section->output_section->vma + + input_section->output_offset); + + if (srel & 1) + return bfd_reloc_outofrange; + if (srel > ((1 << 11) - 1) || (srel < - (1 << 11))) + return bfd_reloc_overflow; + + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xf800) | ((srel >> 1) & 0x7ff); + bfd_put_16 (input_bfd, x, contents); + break; + + default: + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + } + + return r; +} + +/* Relocate an FR30 ELF section. + + The RELOCATE_SECTION function is called by the new ELF backend linker + to handle the relocations for a section. + + The relocs are always passed as Rela structures; if the section + actually uses Rel structures, the r_addend field will always be + zero. + + This function is responsible for adjusting the section contents as + necessary, and (if using Rela relocs and generating a relocatable + output file) adjusting the reloc addend as necessary. + + This function does not have to worry about setting the reloc + address or the reloc symbol index. + + LOCAL_SYMS is a pointer to the swapped in local symbols. + + LOCAL_SECTIONS is an array giving the section in the input file + corresponding to the st_shndx field of each local symbol. + + The global hash table entry for the global symbols can be found + via elf_sym_hashes (input_bfd). + + When generating relocatable output, this function must handle + STB_LOCAL/STT_SECTION symbols specially. The output symbol is + going to be the section symbol corresponding to the output + section, which means that the addend must be adjusted + accordingly. */ + +static bfd_boolean +fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + + if (info->relocatable) + return TRUE; + + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + relend = relocs + input_section->reloc_count; + + for (rel = relocs; rel < relend; rel ++) + { + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + const char *name = NULL; + int r_type; + + r_type = ELF32_R_TYPE (rel->r_info); + + if ( r_type == R_FR30_GNU_VTINHERIT + || r_type == R_FR30_GNU_VTENTRY) + continue; + + r_symndx = ELF32_R_SYM (rel->r_info); + + howto = fr30_elf_howto_table + ELF32_R_TYPE (rel->r_info); + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); + name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; +#if 0 + fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n", + sec->name, name, sym->st_name, + sec->output_section->vma, sec->output_offset, + sym->st_value, rel->r_addend); +#endif + } + else + { + bfd_boolean unresolved_reloc, warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + } + + r = fr30_final_link_relocate (howto, input_bfd, input_section, + contents, rel, relocation); + + if (r != bfd_reloc_ok) + { + const char * msg = (const char *) NULL; + + switch (r) + { + case bfd_reloc_overflow: + r = info->callbacks->reloc_overflow + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset); + break; + + case bfd_reloc_undefined: + r = info->callbacks->undefined_symbol + (info, name, input_bfd, input_section, rel->r_offset, + TRUE); + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + break; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + break; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous relocation"); + break; + + default: + msg = _("internal error: unknown error"); + break; + } + + if (msg) + r = info->callbacks->warning + (info, msg, name, input_bfd, input_section, rel->r_offset); + + if (! r) + return FALSE; + } + } + + return TRUE; +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +fr30_elf_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym * sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_FR30_GNU_VTINHERIT: + case R_FR30_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the got entry reference counts for the section being removed. */ + +static bfd_boolean +fr30_elf_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +{ + return TRUE; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static bfd_boolean +fr30_elf_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + switch (ELF32_R_TYPE (rel->r_info)) + { + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_FR30_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_FR30_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + } + } + + return TRUE; +} + +#define ELF_ARCH bfd_arch_fr30 +#define ELF_MACHINE_CODE EM_FR30 +#define ELF_MACHINE_ALT1 EM_CYGNUS_FR30 +#define ELF_MAXPAGESIZE 0x1000 + +#define TARGET_BIG_SYM bfd_elf32_fr30_vec +#define TARGET_BIG_NAME "elf32-fr30" + +#define elf_info_to_howto_rel NULL +#define elf_info_to_howto fr30_info_to_howto_rela +#define elf_backend_relocate_section fr30_elf_relocate_section +#define elf_backend_gc_mark_hook fr30_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook fr30_elf_gc_sweep_hook +#define elf_backend_check_relocs fr30_elf_check_relocs + +#define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 + +#define bfd_elf32_bfd_reloc_type_lookup fr30_reloc_type_lookup + +#include "elf32-target.h" diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c new file mode 100644 index 0000000000000..9a9dbd0313da3 --- /dev/null +++ b/bfd/elf32-frv.c @@ -0,0 +1,4784 @@ +/* FRV-specific support for 32-bit ELF. + Copyright 2002, 2003, 2004 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/frv.h" +#include "elf/dwarf2.h" +#include "hashtab.h" + +/* Forward declarations. */ +static bfd_reloc_status_type elf32_frv_relocate_lo16 + PARAMS ((bfd *, Elf_Internal_Rela *, bfd_byte *, bfd_vma)); +static bfd_reloc_status_type elf32_frv_relocate_hi16 + PARAMS ((bfd *, Elf_Internal_Rela *, bfd_byte *, bfd_vma)); +static bfd_reloc_status_type elf32_frv_relocate_label24 + PARAMS ((bfd *, asection *, Elf_Internal_Rela *, bfd_byte *, bfd_vma)); +static bfd_reloc_status_type elf32_frv_relocate_gprel12 + PARAMS ((struct bfd_link_info *, bfd *, asection *, Elf_Internal_Rela *, + bfd_byte *, bfd_vma)); +static bfd_reloc_status_type elf32_frv_relocate_gprelu12 + PARAMS ((struct bfd_link_info *, bfd *, asection *, Elf_Internal_Rela *, + bfd_byte *, bfd_vma)); +static bfd_reloc_status_type elf32_frv_relocate_gprello + PARAMS ((struct bfd_link_info *, bfd *, asection *, Elf_Internal_Rela *, + bfd_byte *, bfd_vma)); +static bfd_reloc_status_type elf32_frv_relocate_gprelhi + PARAMS ((struct bfd_link_info *, bfd *, asection *, Elf_Internal_Rela *, + bfd_byte *, bfd_vma)); +static reloc_howto_type *frv_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void frv_info_to_howto_rela + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static bfd_boolean elf32_frv_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static bfd_boolean elf32_frv_add_symbol_hook + PARAMS (( bfd *, struct bfd_link_info *, Elf_Internal_Sym *, + const char **, flagword *, asection **, bfd_vma *)); +static bfd_reloc_status_type frv_final_link_relocate + PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, bfd_vma)); +static bfd_boolean elf32_frv_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, const + Elf_Internal_Rela *)); +static asection * elf32_frv_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static bfd_boolean elf32_frv_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static int elf32_frv_machine + PARAMS ((bfd *)); +static bfd_boolean elf32_frv_object_p + PARAMS ((bfd *)); +static bfd_boolean frv_elf_set_private_flags + PARAMS ((bfd *, flagword)); +static bfd_boolean frv_elf_copy_private_bfd_data + PARAMS ((bfd *, bfd *)); +static bfd_boolean frv_elf_merge_private_bfd_data + PARAMS ((bfd *, bfd *)); +static bfd_boolean frv_elf_print_private_bfd_data + PARAMS ((bfd *, PTR)); + +static reloc_howto_type elf32_frv_howto_table [] = +{ + /* This reloc does nothing. */ + HOWTO (R_FRV_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit absolute relocation. */ + HOWTO (R_FRV_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 16 bit pc-relative relocation. */ + HOWTO (R_FRV_LABEL16, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_LABEL16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 24-bit pc-relative relocation. */ + HOWTO (R_FRV_LABEL24, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_LABEL24", /* name */ + FALSE, /* partial_inplace */ + 0x7e03ffff, /* src_mask */ + 0x7e03ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_FRV_LO16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_LO16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_FRV_HI16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_HI16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_FRV_GPREL12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_GPREL12", /* name */ + FALSE, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_FRV_GPRELU12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_GPRELU12", /* name */ + FALSE, /* partial_inplace */ + 0xfff, /* src_mask */ + 0x3f03f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_FRV_GPREL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_GPREL32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_FRV_GPRELHI, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_GPRELHI", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_FRV_GPRELLO, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_GPRELLO", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 12-bit signed operand with the GOT offset for the address of + the symbol. */ + HOWTO (R_FRV_GOT12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_GOT12", /* name */ + FALSE, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The upper 16 bits of the GOT offset for the address of the + symbol. */ + HOWTO (R_FRV_GOTHI, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_GOTHI", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The lower 16 bits of the GOT offset for the address of the + symbol. */ + HOWTO (R_FRV_GOTLO, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_GOTLO", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The 32-bit address of the canonical descriptor of a function. */ + HOWTO (R_FRV_FUNCDESC, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_FUNCDESC", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 12-bit signed operand with the GOT offset for the address of + canonical descriptor of a function. */ + HOWTO (R_FRV_FUNCDESC_GOT12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_FUNCDESC_GOT12", /* name */ + FALSE, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The upper 16 bits of the GOT offset for the address of the + canonical descriptor of a function. */ + HOWTO (R_FRV_FUNCDESC_GOTHI, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_FUNCDESC_GOTHI", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The lower 16 bits of the GOT offset for the address of the + canonical descriptor of a function. */ + HOWTO (R_FRV_FUNCDESC_GOTLO, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_FUNCDESC_GOTLO", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The 32-bit address of the canonical descriptor of a function. */ + HOWTO (R_FRV_FUNCDESC_VALUE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_FUNCDESC_VALUE", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 12-bit signed operand with the GOT offset for the address of + canonical descriptor of a function. */ + HOWTO (R_FRV_FUNCDESC_GOTOFF12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_FUNCDESC_GOTOFF12", /* name */ + FALSE, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The upper 16 bits of the GOT offset for the address of the + canonical descriptor of a function. */ + HOWTO (R_FRV_FUNCDESC_GOTOFFHI, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_FUNCDESC_GOTOFFHI", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The lower 16 bits of the GOT offset for the address of the + canonical descriptor of a function. */ + HOWTO (R_FRV_FUNCDESC_GOTOFFLO, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_FUNCDESC_GOTOFFLO", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 12-bit signed operand with the GOT offset for the address of + the symbol. */ + HOWTO (R_FRV_GOTOFF12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_GOTOFF12", /* name */ + FALSE, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The upper 16 bits of the GOT offset for the address of the + symbol. */ + HOWTO (R_FRV_GOTOFFHI, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_GOTOFFHI", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The lower 16 bits of the GOT offset for the address of the + symbol. */ + HOWTO (R_FRV_GOTOFFLO, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_GOTOFFLO", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + +}; + +/* GNU extension to record C++ vtable hierarchy. */ +static reloc_howto_type elf32_frv_vtinherit_howto = + HOWTO (R_FRV_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_FRV_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE); /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage. */ +static reloc_howto_type elf32_frv_vtentry_howto = + HOWTO (R_FRV_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_FRV_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE); /* pcrel_offset */ + +/* The following 3 relocations are REL. The only difference to the + entries in the table above are that partial_inplace is TRUE. */ +static reloc_howto_type elf32_frv_rel_32_howto = + HOWTO (R_FRV_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE); /* pcrel_offset */ + +static reloc_howto_type elf32_frv_rel_funcdesc_howto = + HOWTO (R_FRV_FUNCDESC, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_FUNCDESC", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE); /* pcrel_offset */ + +static reloc_howto_type elf32_frv_rel_funcdesc_value_howto = + HOWTO (R_FRV_FUNCDESC_VALUE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_FRV_FUNCDESC_VALUE", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE); /* pcrel_offset */ + + +/* Map BFD reloc types to FRV ELF reloc types. */ +#if 0 +struct frv_reloc_map +{ + unsigned int bfd_reloc_val; + unsigned int frv_reloc_val; +}; + +static const struct frv_reloc_map frv_reloc_map [] = +{ + { BFD_RELOC_NONE, R_FRV_NONE }, + { BFD_RELOC_32, R_FRV_32 }, + { BFD_RELOC_FRV_LABEL16, R_FRV_LABEL16 }, + { BFD_RELOC_FRV_LABEL24, R_FRV_LABEL24 }, + { BFD_RELOC_FRV_LO16, R_FRV_LO16 }, + { BFD_RELOC_FRV_HI16, R_FRV_HI16 }, + { BFD_RELOC_FRV_GPREL12, R_FRV_GPREL12 }, + { BFD_RELOC_FRV_GPRELU12, R_FRV_GPRELU12 }, + { BFD_RELOC_FRV_GPREL32, R_FRV_GPREL32 }, + { BFD_RELOC_FRV_GPRELHI, R_FRV_GPRELHI }, + { BFD_RELOC_FRV_GPRELLO, R_FRV_GPRELLO }, + { BFD_RELOC_FRV_GOT12, R_FRV_GOT12 }, + { BFD_RELOC_FRV_GOTHI, R_FRV_GOTHI }, + { BFD_RELOC_FRV_GOTLO, R_FRV_GOTLO }, + { BFD_RELOC_FRV_FUNCDESC, R_FRV_FUNCDESC }, + { BFD_RELOC_FRV_FUNCDESC_GOT12, R_FRV_FUNCDESC_GOT12 }, + { BFD_RELOC_FRV_FUNCDESC_GOTHI, R_FRV_FUNCDESC_GOTHI }, + { BFD_RELOC_FRV_FUNCDESC_GOTLO, R_FRV_FUNCDESC_GOTLO }, + { BFD_RELOC_FRV_FUNCDESC_VALUE, R_FRV_FUNCDESC_VALUE }, + { BFD_RELOC_FRV_FUNCDESC_GOTOFF12, R_FRV_FUNCDESC_GOTOFF12 }, + { BFD_RELOC_FRV_FUNCDESC_GOTOFFHI, R_FRV_FUNCDESC_GOTOFFHI }, + { BFD_RELOC_FRV_FUNCDESC_GOTOFFLO, R_FRV_FUNCDESC_GOTOFFLO }, + { BFD_RELOC_FRV_GOTOFF12, R_FRV_GOTOFF12 }, + { BFD_RELOC_FRV_GOTOFFHI, R_FRV_GOTOFFHI }, + { BFD_RELOC_FRV_GOTOFFLO, R_FRV_GOTOFFLO }, + { BFD_RELOC_VTABLE_INHERIT, R_FRV_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_FRV_GNU_VTENTRY }, +}; +#endif + +extern const bfd_target bfd_elf32_frvfdpic_vec; +#define IS_FDPIC(bfd) ((bfd)->xvec == &bfd_elf32_frvfdpic_vec) + +/* An extension of the elf hash table data structure, containing some + additional FRV-specific data. */ +struct frvfdpic_elf_link_hash_table +{ + struct elf_link_hash_table elf; + + /* A pointer to the .got section. */ + asection *sgot; + /* A pointer to the .rel.got section. */ + asection *sgotrel; + /* A pointer to the .rofixup section. */ + asection *sgotfixup; + /* A pointer to the .plt section. */ + asection *splt; + /* A pointer to the .rel.plt section. */ + asection *spltrel; + /* GOT base offset. */ + bfd_vma got0; + /* Location of the first non-lazy PLT entry, i.e., the number of + bytes taken by lazy PLT entries. */ + bfd_vma plt0; + /* A hash table holding information about which symbols were + referenced with which PIC-related relocations. */ + struct htab *relocs_info; +}; + +/* Get the FRV ELF linker hash table from a link_info structure. */ + +#define frvfdpic_hash_table(info) \ + ((struct frvfdpic_elf_link_hash_table *) ((info)->hash)) + +#define frvfdpic_got_section(info) \ + (frvfdpic_hash_table (info)->sgot) +#define frvfdpic_gotrel_section(info) \ + (frvfdpic_hash_table (info)->sgotrel) +#define frvfdpic_gotfixup_section(info) \ + (frvfdpic_hash_table (info)->sgotfixup) +#define frvfdpic_plt_section(info) \ + (frvfdpic_hash_table (info)->splt) +#define frvfdpic_pltrel_section(info) \ + (frvfdpic_hash_table (info)->spltrel) +#define frvfdpic_relocs_info(info) \ + (frvfdpic_hash_table (info)->relocs_info) +#define frvfdpic_got_initial_offset(info) \ + (frvfdpic_hash_table (info)->got0) +#define frvfdpic_plt_initial_offset(info) \ + (frvfdpic_hash_table (info)->plt0) + +/* Create an FRV ELF linker hash table. */ + +static struct bfd_link_hash_table * +frvfdpic_elf_link_hash_table_create (bfd *abfd) +{ + struct frvfdpic_elf_link_hash_table *ret; + bfd_size_type amt = sizeof (struct frvfdpic_elf_link_hash_table); + + ret = bfd_zalloc (abfd, amt); + if (ret == NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, + _bfd_elf_link_hash_newfunc)) + { + free (ret); + return NULL; + } + + return &ret->elf.root; +} + +/* Decide whether a reference to a symbol can be resolved locally or + not. If the symbol is protected, we want the local address, but + its function descriptor must be assigned by the dynamic linker. */ +#define FRVFDPIC_SYM_LOCAL(INFO, H) \ + (_bfd_elf_symbol_refs_local_p ((H), (INFO), 1) \ + || ! elf_hash_table (INFO)->dynamic_sections_created \ + || (/* The condition below is an ugly hack to get .scommon data to + be regarded as local. For some reason the + ELF_LINK_HASH_DEF_REGULAR bit is not set on such common + symbols, and the SEC_IS_COMMON bit is not set any longer + when we need to perform this test. Hopefully this + approximation is good enough. */ \ + ((H)->root.type == bfd_link_hash_defined \ + || (H)->root.type == bfd_link_hash_defweak) \ + && (H)->root.u.def.section->output_section \ + && ((H)->root.u.def.section->flags & SEC_LINKER_CREATED))) +#define FRVFDPIC_FUNCDESC_LOCAL(INFO, H) \ + ((H)->dynindx == -1 || ! elf_hash_table (INFO)->dynamic_sections_created) + +/* This structure collects information on what kind of GOT, PLT or + function descriptors are required by relocations that reference a + certain symbol. */ +struct frvfdpic_relocs_info +{ + /* The index of the symbol, as stored in the relocation r_info, if + we have a local symbol; -1 otherwise. */ + long symndx; + union + { + /* The input bfd in which the symbol is defined, if it's a local + symbol. */ + bfd *abfd; + /* If symndx == -1, the hash table entry corresponding to a global + symbol (even if it turns out to bind locally, in which case it + should ideally be replaced with section's symndx + addend). */ + struct elf_link_hash_entry *h; + } d; + /* The addend of the relocation that references the symbol. */ + bfd_vma addend; + + /* The fields above are used to identify an entry. The fields below + contain information on how an entry is used and, later on, which + locations it was assigned. */ + /* The following 3 fields record whether the symbol+addend above was + ever referenced with a GOT relocation. The 12 suffix indicates a + GOT12 relocation; los is used for GOTLO relocations that are not + matched by a GOTHI relocation; hilo is used for GOTLO/GOTHI + pairs. */ + unsigned got12:1; + unsigned gotlos:1; + unsigned gothilo:1; + /* Whether a FUNCDESC relocation references symbol+addend. */ + unsigned fd:1; + /* Whether a FUNCDESC_GOT relocation references symbol+addend. */ + unsigned fdgot12:1; + unsigned fdgotlos:1; + unsigned fdgothilo:1; + /* Whether a FUNCDESC_GOTOFF relocation references symbol+addend. */ + unsigned fdgoff12:1; + unsigned fdgofflos:1; + unsigned fdgoffhilo:1; + /* Whether symbol+addend is referenced with GOTOFF12, GOTOFFLO or + GOTOFFHI relocations. The addend doesn't really matter, since we + envision that this will only be used to check whether the symbol + is mapped to the same segment as the got. */ + unsigned gotoff:1; + /* Whether symbol+addend is referenced by a LABEL24 relocation. */ + unsigned call:1; + /* Whether symbol+addend is referenced by a 32 or FUNCDESC_VALUE + relocation. */ + unsigned sym:1; + /* Whether we need a PLT entry for a symbol. Should be implied by + something like: + (call && symndx == -1 && ! FRVFDPIC_SYM_LOCAL (info, d.h)) */ + unsigned plt:1; + /* Whether a function descriptor should be created in this link unit + for symbol+addend. Should be implied by something like: + (plt || fdgotoff12 || fdgotofflos || fdgotofflohi + || ((fd || fdgot12 || fdgotlos || fdgothilo) + && (symndx != -1 || FRVFDPIC_FUNCDESC_LOCAL (info, d.h)))) */ + unsigned privfd:1; + /* Whether a lazy PLT entry is needed for this symbol+addend. + Should be implied by something like: + (privfd && symndx == -1 && ! FRVFDPIC_SYM_LOCAL (info, d.h) + && ! (info->flags & DF_BIND_NOW)) */ + unsigned lazyplt:1; + /* Whether we've already emitted GOT relocations and PLT entries as + needed for this symbol. */ + unsigned done:1; + + /* The number of R_FRV_32, R_FRV_FUNCDESC and R_FRV_FUNCDESC_VALUE + relocations referencing the symbol. */ + unsigned relocs32, relocsfd, relocsfdv; + + /* The number of .rofixups entries and dynamic relocations allocated + for this symbol, minus any that might have already been used. */ + unsigned fixups, dynrelocs; + + /* The offsets of the GOT entries assigned to symbol+addend, to the + function descriptor's address, and to a function descriptor, + respectively. Should be zero if unassigned. The offsets are + counted from the value that will be assigned to the PIC register, + not from the beginning of the .got section. */ + bfd_signed_vma got_entry, fdgot_entry, fd_entry; + /* The offsets of the PLT entries assigned to symbol+addend, + non-lazy and lazy, respectively. If unassigned, should be + (bfd_vma)-1. */ + bfd_vma plt_entry, lzplt_entry; +}; + +/* Compute a hash with the key fields of an frvfdpic_relocs_info entry. */ +static hashval_t +frvfdpic_relocs_info_hash (const void *entry_) +{ + const struct frvfdpic_relocs_info *entry = entry_; + + return (entry->symndx == -1 + ? entry->d.h->root.root.hash + : entry->symndx + entry->d.abfd->id * 257) + entry->addend; +} + +/* Test whether the key fields of two frvfdpic_relocs_info entries are + identical. */ +static int +frvfdpic_relocs_info_eq (const void *entry1, const void *entry2) +{ + const struct frvfdpic_relocs_info *e1 = entry1; + const struct frvfdpic_relocs_info *e2 = entry2; + + return e1->symndx == e2->symndx && e1->addend == e2->addend + && (e1->symndx == -1 ? e1->d.h == e2->d.h : e1->d.abfd == e2->d.abfd); +} + +/* Find or create an entry in a hash table HT that matches the key + fields of the given ENTRY. If it's not found, memory for a new + entry is allocated in ABFD's obstack. */ +static struct frvfdpic_relocs_info * +frvfdpic_relocs_info_find (struct htab *ht, + bfd *abfd, + const struct frvfdpic_relocs_info *entry, + enum insert_option insert) +{ + struct frvfdpic_relocs_info **loc = + (struct frvfdpic_relocs_info **) htab_find_slot (ht, entry, insert); + + if (! loc) + return NULL; + + if (*loc) + return *loc; + + *loc = bfd_zalloc (abfd, sizeof (**loc)); + + if (! *loc) + return *loc; + + (*loc)->symndx = entry->symndx; + (*loc)->d = entry->d; + (*loc)->addend = entry->addend; + (*loc)->plt_entry = (bfd_vma)-1; + (*loc)->lzplt_entry = (bfd_vma)-1; + + return *loc; +} + +/* Obtain the address of the entry in HT associated with H's symbol + + addend, creating a new entry if none existed. ABFD is only used + for memory allocation purposes. */ +inline static struct frvfdpic_relocs_info * +frvfdpic_relocs_info_for_global (struct htab *ht, + bfd *abfd, + struct elf_link_hash_entry *h, + bfd_vma addend, + enum insert_option insert) +{ + struct frvfdpic_relocs_info entry; + + entry.symndx = -1; + entry.d.h = h; + entry.addend = addend; + + return frvfdpic_relocs_info_find (ht, abfd, &entry, insert); +} + +/* Obtain the address of the entry in HT associated with the SYMNDXth + local symbol of the input bfd ABFD, plus the addend, creating a new + entry if none existed. */ +inline static struct frvfdpic_relocs_info * +frvfdpic_relocs_info_for_local (struct htab *ht, + bfd *abfd, + long symndx, + bfd_vma addend, + enum insert_option insert) +{ + struct frvfdpic_relocs_info entry; + + entry.symndx = symndx; + entry.d.abfd = abfd; + entry.addend = addend; + + return frvfdpic_relocs_info_find (ht, abfd, &entry, insert); +} + +/* Merge fields set by check_relocs() of two entries that end up being + mapped to the same (presumably global) symbol. */ + +inline static void +frvfdpic_pic_merge_early_relocs_info (struct frvfdpic_relocs_info *e2, + struct frvfdpic_relocs_info const *e1) +{ + e2->got12 |= e1->got12; + e2->gotlos |= e1->gotlos; + e2->gothilo |= e1->gothilo; + e2->fd |= e1->fd; + e2->fdgot12 |= e1->fdgot12; + e2->fdgotlos |= e1->fdgotlos; + e2->fdgothilo |= e1->fdgothilo; + e2->fdgoff12 |= e1->fdgoff12; + e2->fdgofflos |= e1->fdgofflos; + e2->fdgoffhilo |= e1->fdgoffhilo; + e2->gotoff |= e1->gotoff; + e2->call |= e1->call; + e2->sym |= e1->sym; + +#if 0 + /* These are set in _frvfdpic_count_got_plt_entries() or later, and this + function is only called in _frvfdpic_resolve_final_relocs_info(), that + runs just before it, so we don't have to worry about the fields + below. */ + + e2->plt |= e1->plt; + e2->privfd |= e1->privfd; + e2->lazyplt |= e1->lazyplt; + e2->done |= e1->done; + + e2->relocs32 += e1->relocs32; + e2->relocsfd += e1->relocsfd; + e2->relocsfdv += e1->relocsfdv; + e2->fixups += e1->fixups; + e2->dynrelocs += e1->dynrelocs; + + if (abs (e1->got_entry) < abs (e2->got_entry)) + e2->got_entry = e1->got_entry; + if (abs (e1->fdgot_entry) < abs (e2->fdgot_entry)) + e2->fdgot_entry = e1->fdgot_entry; + if (abs (e1->fd_entry) < abs (e2->fd_entry)) + e2->fd_entry = e1->fd_entry; + + if (e1->plt_entry < e2->plt_entry) + e2->plt_entry = e1->plt_entry; + if (e1->lzplt_entry < e2->lzplt_entry) + e2->lzplt_entry = e1->lzplt_entry; +#endif +} + +/* Every block of 65535 lazy PLT entries shares a single call to the + resolver, inserted in the 32768th lazy PLT entry (i.e., entry # + 32767, counting from 0). All other lazy PLT entries branch to it + in a single instruction. */ + +#define FRVFDPIC_LZPLT_BLOCK_SIZE ((bfd_vma) 8 * 65535 + 4) +#define FRVFDPIC_LZPLT_RESOLV_LOC (8 * 32767) + +/* Add a dynamic relocation to the SRELOC section. */ + +inline static bfd_vma +_frvfdpic_add_dyn_reloc (bfd *output_bfd, asection *sreloc, bfd_vma offset, + int reloc_type, long dynindx, bfd_vma addend, + struct frvfdpic_relocs_info *entry) +{ + Elf_Internal_Rela outrel; + bfd_vma reloc_offset; + + outrel.r_offset = offset; + outrel.r_info = ELF32_R_INFO (dynindx, reloc_type); + outrel.r_addend = addend; + + reloc_offset = sreloc->reloc_count * sizeof (Elf32_External_Rel); + BFD_ASSERT (reloc_offset < sreloc->_raw_size); + bfd_elf32_swap_reloc_out (output_bfd, &outrel, + sreloc->contents + reloc_offset); + sreloc->reloc_count++; + + BFD_ASSERT (entry->dynrelocs > 0); + entry->dynrelocs--; + + return reloc_offset; +} + +/* Add a fixup to the ROFIXUP section. */ + +static bfd_vma +_frvfdpic_add_rofixup (bfd *output_bfd, asection *rofixup, bfd_vma offset, + struct frvfdpic_relocs_info *entry) +{ + bfd_vma fixup_offset; + + if (rofixup->flags & SEC_EXCLUDE) + return -1; + + fixup_offset = rofixup->reloc_count * 4; + if (rofixup->contents) + { + BFD_ASSERT (fixup_offset < rofixup->_raw_size); + bfd_put_32 (output_bfd, offset, rofixup->contents + fixup_offset); + } + rofixup->reloc_count++; + + if (entry) + { + BFD_ASSERT (entry->fixups > 0); + entry->fixups--; + } + + return fixup_offset; +} + +/* Find the segment number in which OSEC, and output section, is + located. */ + +static unsigned +_frvfdpic_osec_to_segment (bfd *output_bfd, asection *osec) +{ + struct elf_segment_map *m; + Elf_Internal_Phdr *p; + + /* Find the segment that contains the output_section. */ + for (m = elf_tdata (output_bfd)->segment_map, + p = elf_tdata (output_bfd)->phdr; + m != NULL; + m = m->next, p++) + { + int i; + + for (i = m->count - 1; i >= 0; i--) + if (m->sections[i] == osec) + break; + + if (i >= 0) + break; + } + + return p - elf_tdata (output_bfd)->phdr; +} + +inline static bfd_boolean +_frvfdpic_osec_readonly_p (bfd *output_bfd, asection *osec) +{ + unsigned seg = _frvfdpic_osec_to_segment (output_bfd, osec); + + return ! (elf_tdata (output_bfd)->phdr[seg].p_flags & PF_W); +} + +/* Generate relocations for GOT entries, function descriptors, and + code for PLT and lazy PLT entries. */ + +inline static bfd_boolean +_frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry, + bfd *output_bfd, + struct bfd_link_info *info, + asection *sec, + Elf_Internal_Sym *sym, + bfd_vma addend) + +{ + bfd_vma fd_lazy_rel_offset = (bfd_vma)-1; + int dynindx = -1; + + if (entry->done) + return TRUE; + entry->done = 1; + + if (entry->got_entry || entry->fdgot_entry || entry->fd_entry) + { + /* If the symbol is dynamic, consider it for dynamic + relocations, otherwise decay to section + offset. */ + if (entry->symndx == -1 && entry->d.h->dynindx != -1) + dynindx = entry->d.h->dynindx; + else + { + if (sec->output_section + && ! bfd_is_abs_section (sec->output_section) + && ! bfd_is_und_section (sec->output_section)) + dynindx = elf_section_data (sec->output_section)->dynindx; + else + dynindx = 0; + } + } + + /* Generate relocation for GOT entry pointing to the symbol. */ + if (entry->got_entry) + { + int idx = dynindx; + bfd_vma ad = addend; + + /* If the symbol is dynamic but binds locally, use + section+offset. */ + if (sec && (entry->symndx != -1 + || FRVFDPIC_SYM_LOCAL (info, entry->d.h))) + { + if (entry->symndx == -1) + ad += entry->d.h->root.u.def.value; + else + ad += sym->st_value; + ad += sec->output_offset; + if (sec->output_section && elf_section_data (sec->output_section)) + idx = elf_section_data (sec->output_section)->dynindx; + else + idx = 0; + } + + /* If we're linking an executable at a fixed address, we can + omit the dynamic relocation as long as the symbol is local to + this module. */ + if (info->executable && !info->pie + && (entry->symndx != -1 + || FRVFDPIC_SYM_LOCAL (info, entry->d.h))) + { + if (sec) + ad += sec->output_section->vma; + if (entry->symndx != -1 + || entry->d.h->root.type != bfd_link_hash_undefweak) + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section (info), + frvfdpic_got_section (info)->output_section + ->vma + + frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info) + + entry->got_entry, entry); + } + else + _frvfdpic_add_dyn_reloc (output_bfd, frvfdpic_gotrel_section (info), + _bfd_elf_section_offset + (output_bfd, info, + frvfdpic_got_section (info), + frvfdpic_got_initial_offset (info) + + entry->got_entry) + + frvfdpic_got_section (info) + ->output_section->vma + + frvfdpic_got_section (info)->output_offset, + R_FRV_32, idx, ad, entry); + + bfd_put_32 (output_bfd, ad, + frvfdpic_got_section (info)->contents + + frvfdpic_got_initial_offset (info) + + entry->got_entry); + } + + /* Generate relocation for GOT entry pointing to a canonical + function descriptor. */ + if (entry->fdgot_entry) + { + int reloc, idx; + bfd_vma ad = 0; + + if (! (entry->symndx == -1 + && entry->d.h->root.type == bfd_link_hash_undefweak + && FRVFDPIC_SYM_LOCAL (info, entry->d.h))) + { + /* If the symbol is dynamic and there may be dynamic symbol + resolution because we are, or are linked with, a shared + library, emit a FUNCDESC relocation such that the dynamic + linker will allocate the function descriptor. If the + symbol needs a non-local function descriptor but binds + locally (e.g., its visibility is protected, emit a + dynamic relocation decayed to section+offset. */ + if (entry->symndx == -1 + && ! FRVFDPIC_FUNCDESC_LOCAL (info, entry->d.h) + && FRVFDPIC_SYM_LOCAL (info, entry->d.h) + && !(info->executable && !info->pie)) + { + reloc = R_FRV_FUNCDESC; + idx = elf_section_data (entry->d.h->root.u.def.section + ->output_section)->dynindx; + ad = entry->d.h->root.u.def.section->output_offset + + entry->d.h->root.u.def.value; + } + else if (entry->symndx == -1 + && ! FRVFDPIC_FUNCDESC_LOCAL (info, entry->d.h)) + { + reloc = R_FRV_FUNCDESC; + idx = dynindx; + ad = addend; + if (ad) + return FALSE; + } + else + { + /* Otherwise, we know we have a private function descriptor, + so reference it directly. */ + if (elf_hash_table (info)->dynamic_sections_created) + BFD_ASSERT (entry->privfd); + reloc = R_FRV_32; + idx = elf_section_data (frvfdpic_got_section (info) + ->output_section)->dynindx; + ad = frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info) + entry->fd_entry; + } + + /* If there is room for dynamic symbol resolution, emit the + dynamic relocation. However, if we're linking an + executable at a fixed location, we won't have emitted a + dynamic symbol entry for the got section, so idx will be + zero, which means we can and should compute the address + of the private descriptor ourselves. */ + if (info->executable && !info->pie + && (entry->symndx != -1 + || FRVFDPIC_FUNCDESC_LOCAL (info, entry->d.h))) + { + ad += frvfdpic_got_section (info)->output_section->vma; + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section (info), + frvfdpic_got_section (info) + ->output_section->vma + + frvfdpic_got_section (info) + ->output_offset + + frvfdpic_got_initial_offset (info) + + entry->fdgot_entry, entry); + } + else + _frvfdpic_add_dyn_reloc (output_bfd, + frvfdpic_gotrel_section (info), + _bfd_elf_section_offset + (output_bfd, info, + frvfdpic_got_section (info), + frvfdpic_got_initial_offset (info) + + entry->fdgot_entry) + + frvfdpic_got_section (info) + ->output_section->vma + + frvfdpic_got_section (info) + ->output_offset, + reloc, idx, ad, entry); + } + + bfd_put_32 (output_bfd, ad, + frvfdpic_got_section (info)->contents + + frvfdpic_got_initial_offset (info) + + entry->fdgot_entry); + } + + /* Generate relocation to fill in a private function descriptor in + the GOT. */ + if (entry->fd_entry) + { + int idx = dynindx; + bfd_vma ad = addend; + bfd_vma ofst; + long lowword, highword; + + /* If the symbol is dynamic but binds locally, use + section+offset. */ + if (sec && (entry->symndx != -1 + || FRVFDPIC_SYM_LOCAL (info, entry->d.h))) + { + if (entry->symndx == -1) + ad += entry->d.h->root.u.def.value; + else + ad += sym->st_value; + ad += sec->output_offset; + if (sec->output_section && elf_section_data (sec->output_section)) + idx = elf_section_data (sec->output_section)->dynindx; + else + idx = 0; + } + + /* If we're linking an executable at a fixed address, we can + omit the dynamic relocation as long as the symbol is local to + this module. */ + if (info->executable && !info->pie + && (entry->symndx != -1 || FRVFDPIC_SYM_LOCAL (info, entry->d.h))) + { + if (sec) + ad += sec->output_section->vma; + ofst = 0; + if (entry->symndx != -1 + || entry->d.h->root.type != bfd_link_hash_undefweak) + { + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section (info), + frvfdpic_got_section (info) + ->output_section->vma + + frvfdpic_got_section (info) + ->output_offset + + frvfdpic_got_initial_offset (info) + + entry->fd_entry, entry); + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section (info), + frvfdpic_got_section (info) + ->output_section->vma + + frvfdpic_got_section (info) + ->output_offset + + frvfdpic_got_initial_offset (info) + + entry->fd_entry + 4, entry); + } + } + else + { + ofst = + _frvfdpic_add_dyn_reloc (output_bfd, + entry->lazyplt + ? frvfdpic_pltrel_section (info) + : frvfdpic_gotrel_section (info), + _bfd_elf_section_offset + (output_bfd, info, + frvfdpic_got_section (info), + frvfdpic_got_initial_offset (info) + + entry->fd_entry) + + frvfdpic_got_section (info) + ->output_section->vma + + frvfdpic_got_section (info) + ->output_offset, + R_FRV_FUNCDESC_VALUE, idx, ad, entry); + } + + /* If we've omitted the dynamic relocation, just emit the fixed + addresses of the symbol and of the local GOT base offset. */ + if (info->executable && !info->pie && sec && sec->output_section) + { + lowword = ad; + highword = frvfdpic_got_section (info)->output_section->vma + + frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info); + } + else if (entry->lazyplt) + { + if (ad) + return FALSE; + + fd_lazy_rel_offset = ofst; + + /* A function descriptor used for lazy or local resolving is + initialized such that its high word contains the output + section index in which the PLT entries are located, and + the low word contains the address of the lazy PLT entry + entry point, that must be within the memory region + assigned to that section. */ + lowword = entry->lzplt_entry + 4 + + frvfdpic_plt_section (info)->output_offset + + frvfdpic_plt_section (info)->output_section->vma; + highword = _frvfdpic_osec_to_segment + (output_bfd, frvfdpic_plt_section (info)->output_section); + } + else + { + /* A function descriptor for a local function gets the index + of the section. For a non-local function, it's + disregarded. */ + lowword = ad; + if (entry->symndx == -1 && entry->d.h->dynindx != -1 + && entry->d.h->dynindx == idx) + highword = 0; + else + highword = _frvfdpic_osec_to_segment + (output_bfd, sec->output_section); + } + + bfd_put_32 (output_bfd, lowword, + frvfdpic_got_section (info)->contents + + frvfdpic_got_initial_offset (info) + + entry->fd_entry); + bfd_put_32 (output_bfd, highword, + frvfdpic_got_section (info)->contents + + frvfdpic_got_initial_offset (info) + + entry->fd_entry + 4); + } + + /* Generate code for the PLT entry. */ + if (entry->plt_entry != (bfd_vma) -1) + { + bfd_byte *plt_code = frvfdpic_plt_section (info)->contents + + entry->plt_entry; + + BFD_ASSERT (entry->fd_entry); + + /* Figure out what kind of PLT entry we need, depending on the + location of the function descriptor within the GOT. */ + if (entry->fd_entry >= -(1 << (12 - 1)) + && entry->fd_entry < (1 << (12 - 1))) + { + /* lddi @(gr15, fd_entry), gr14 */ + bfd_put_32 (output_bfd, + 0x9cccf000 | (entry->fd_entry & ((1 << 12) - 1)), + plt_code); + plt_code += 4; + } + else + { + if (entry->fd_entry >= -(1 << (16 - 1)) + && entry->fd_entry < (1 << (16 - 1))) + { + /* setlos lo(fd_entry), gr14 */ + bfd_put_32 (output_bfd, + 0x9cfc0000 + | (entry->fd_entry & (((bfd_vma)1 << 16) - 1)), + plt_code); + plt_code += 4; + } + else + { + /* sethi.p hi(fd_entry), gr14 + setlo lo(fd_entry), gr14 */ + bfd_put_32 (output_bfd, + 0x1cf80000 + | ((entry->fd_entry >> 16) + & (((bfd_vma)1 << 16) - 1)), + plt_code); + bfd_put_32 (output_bfd, + 0x9cf40000 + | (entry->fd_entry & (((bfd_vma)1 << 16) - 1)), + plt_code); + plt_code += 8; + } + /* ldd @(gr14,gr15),gr14 */ + bfd_put_32 (output_bfd, 0x9c08e14f, plt_code); + plt_code += 4; + } + /* jmpl @(gr14,gr0) */ + bfd_put_32 (output_bfd, 0x8030e000, plt_code); + } + + /* Generate code for the lazy PLT entry. */ + if (entry->lzplt_entry != (bfd_vma) -1) + { + bfd_byte *lzplt_code = frvfdpic_plt_section (info)->contents + + entry->lzplt_entry; + bfd_vma resolverStub_addr; + + bfd_put_32 (output_bfd, fd_lazy_rel_offset, lzplt_code); + lzplt_code += 4; + + resolverStub_addr = entry->lzplt_entry / FRVFDPIC_LZPLT_BLOCK_SIZE + * FRVFDPIC_LZPLT_BLOCK_SIZE + FRVFDPIC_LZPLT_RESOLV_LOC; + if (resolverStub_addr >= frvfdpic_plt_initial_offset (info)) + resolverStub_addr = frvfdpic_plt_initial_offset (info) - 12; + + if (entry->lzplt_entry == resolverStub_addr) + { + /* This is a lazy PLT entry that includes a resolver call. */ + /* ldd @(gr15,gr0), gr4 + jmpl @(gr4,gr0) */ + bfd_put_32 (output_bfd, 0x8808f140, lzplt_code); + bfd_put_32 (output_bfd, 0x80304000, lzplt_code + 4); + } + else + { + /* bra resolverStub */ + bfd_put_32 (output_bfd, + 0xc01a0000 + | (((resolverStub_addr - entry->lzplt_entry) + / 4) & (((bfd_vma)1 << 16) - 1)), + lzplt_code); + } + } + + return TRUE; +} + +/* Handle an FRV small data reloc. */ + +static bfd_reloc_status_type +elf32_frv_relocate_gprel12 (info, input_bfd, input_section, relocation, + contents, value) + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + Elf_Internal_Rela *relocation; + bfd_byte *contents; + bfd_vma value; +{ + bfd_vma insn; + bfd_vma gp; + struct bfd_link_hash_entry *h; + + h = bfd_link_hash_lookup (info->hash, "_gp", FALSE, FALSE, TRUE); + + gp = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + + value -= input_section->output_section->vma; + value -= (gp - input_section->output_section->vma); + + insn = bfd_get_32 (input_bfd, contents + relocation->r_offset); + + value += relocation->r_addend; + + if ((long) value > 0x7ff || (long) value < -0x800) + return bfd_reloc_overflow; + + bfd_put_32 (input_bfd, + (insn & 0xfffff000) | (value & 0xfff), + contents + relocation->r_offset); + + return bfd_reloc_ok; +} + +/* Handle an FRV small data reloc. for the u12 field. */ + +static bfd_reloc_status_type +elf32_frv_relocate_gprelu12 (info, input_bfd, input_section, relocation, + contents, value) + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + Elf_Internal_Rela *relocation; + bfd_byte *contents; + bfd_vma value; +{ + bfd_vma insn; + bfd_vma gp; + struct bfd_link_hash_entry *h; + bfd_vma mask; + + h = bfd_link_hash_lookup (info->hash, "_gp", FALSE, FALSE, TRUE); + + gp = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + + value -= input_section->output_section->vma; + value -= (gp - input_section->output_section->vma); + + insn = bfd_get_32 (input_bfd, contents + relocation->r_offset); + + value += relocation->r_addend; + + if ((long) value > 0x7ff || (long) value < -0x800) + return bfd_reloc_overflow; + + /* The high 6 bits go into bits 17-12. The low 6 bits go into bits 5-0. */ + mask = 0x3f03f; + insn = (insn & ~mask) | ((value & 0xfc0) << 12) | (value & 0x3f); + + bfd_put_32 (input_bfd, insn, contents + relocation->r_offset); + + return bfd_reloc_ok; +} + +/* Handle an FRV ELF HI16 reloc. */ + +static bfd_reloc_status_type +elf32_frv_relocate_hi16 (input_bfd, relhi, contents, value) + bfd *input_bfd; + Elf_Internal_Rela *relhi; + bfd_byte *contents; + bfd_vma value; +{ + bfd_vma insn; + + insn = bfd_get_32 (input_bfd, contents + relhi->r_offset); + + value += relhi->r_addend; + value = ((value >> 16) & 0xffff); + + insn = (insn & 0xffff0000) | value; + + if ((long) value > 0xffff || (long) value < -0x10000) + return bfd_reloc_overflow; + + bfd_put_32 (input_bfd, insn, contents + relhi->r_offset); + return bfd_reloc_ok; + +} +static bfd_reloc_status_type +elf32_frv_relocate_lo16 (input_bfd, rello, contents, value) + bfd *input_bfd; + Elf_Internal_Rela *rello; + bfd_byte *contents; + bfd_vma value; +{ + bfd_vma insn; + + insn = bfd_get_32 (input_bfd, contents + rello->r_offset); + + value += rello->r_addend; + value = value & 0xffff; + + insn = (insn & 0xffff0000) | value; + + if ((long) value > 0xffff || (long) value < -0x10000) + return bfd_reloc_overflow; + + bfd_put_32 (input_bfd, insn, contents + rello->r_offset); + return bfd_reloc_ok; +} + +/* Perform the relocation for the CALL label24 instruction. */ + +static bfd_reloc_status_type +elf32_frv_relocate_label24 (input_bfd, input_section, rello, contents, value) + bfd *input_bfd; + asection *input_section; + Elf_Internal_Rela *rello; + bfd_byte *contents; + bfd_vma value; +{ + bfd_vma insn; + bfd_vma label6; + bfd_vma label18; + + /* The format for the call instruction is: + + 0 000000 0001111 000000000000000000 + label6 opcode label18 + + The branch calculation is: pc + (4*label24) + where label24 is the concatenation of label6 and label18. */ + + /* Grab the instruction. */ + insn = bfd_get_32 (input_bfd, contents + rello->r_offset); + + value -= input_section->output_section->vma + input_section->output_offset; + value -= rello->r_offset; + value += rello->r_addend; + + value = value >> 2; + + label6 = value & 0xfc0000; + label6 = label6 << 7; + + label18 = value & 0x3ffff; + + insn = insn & 0x803c0000; + insn = insn | label6; + insn = insn | label18; + + bfd_put_32 (input_bfd, insn, contents + rello->r_offset); + + return bfd_reloc_ok; +} + +static bfd_reloc_status_type +elf32_frv_relocate_gprelhi (info, input_bfd, input_section, relocation, + contents, value) + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + Elf_Internal_Rela *relocation; + bfd_byte *contents; + bfd_vma value; +{ + bfd_vma insn; + bfd_vma gp; + struct bfd_link_hash_entry *h; + + h = bfd_link_hash_lookup (info->hash, "_gp", FALSE, FALSE, TRUE); + + gp = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + + value -= input_section->output_section->vma; + value -= (gp - input_section->output_section->vma); + value += relocation->r_addend; + value = ((value >> 16) & 0xffff); + + if ((long) value > 0xffff || (long) value < -0x10000) + return bfd_reloc_overflow; + + insn = bfd_get_32 (input_bfd, contents + relocation->r_offset); + insn = (insn & 0xffff0000) | value; + + bfd_put_32 (input_bfd, insn, contents + relocation->r_offset); + return bfd_reloc_ok; +} + +static bfd_reloc_status_type +elf32_frv_relocate_gprello (info, input_bfd, input_section, relocation, + contents, value) + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + Elf_Internal_Rela *relocation; + bfd_byte *contents; + bfd_vma value; +{ + bfd_vma insn; + bfd_vma gp; + struct bfd_link_hash_entry *h; + + h = bfd_link_hash_lookup (info->hash, "_gp", FALSE, FALSE, TRUE); + + gp = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + + value -= input_section->output_section->vma; + value -= (gp - input_section->output_section->vma); + value += relocation->r_addend; + value = value & 0xffff; + + if ((long) value > 0xffff || (long) value < -0x10000) + return bfd_reloc_overflow; + + insn = bfd_get_32 (input_bfd, contents + relocation->r_offset); + insn = (insn & 0xffff0000) | value; + + bfd_put_32 (input_bfd, insn, contents + relocation->r_offset); + + return bfd_reloc_ok; +} + +static reloc_howto_type * +frv_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + switch (code) + { + default: + break; + + case BFD_RELOC_NONE: + return &elf32_frv_howto_table[ (int) R_FRV_NONE]; + + case BFD_RELOC_32: + if (elf_elfheader (abfd)->e_type == ET_EXEC + || elf_elfheader (abfd)->e_type == ET_DYN) + return &elf32_frv_rel_32_howto; + /* Fall through. */ + case BFD_RELOC_CTOR: + return &elf32_frv_howto_table[ (int) R_FRV_32]; + + case BFD_RELOC_FRV_LABEL16: + return &elf32_frv_howto_table[ (int) R_FRV_LABEL16]; + + case BFD_RELOC_FRV_LABEL24: + return &elf32_frv_howto_table[ (int) R_FRV_LABEL24]; + + case BFD_RELOC_FRV_LO16: + return &elf32_frv_howto_table[ (int) R_FRV_LO16]; + + case BFD_RELOC_FRV_HI16: + return &elf32_frv_howto_table[ (int) R_FRV_HI16]; + + case BFD_RELOC_FRV_GPREL12: + return &elf32_frv_howto_table[ (int) R_FRV_GPREL12]; + + case BFD_RELOC_FRV_GPRELU12: + return &elf32_frv_howto_table[ (int) R_FRV_GPRELU12]; + + case BFD_RELOC_FRV_GPREL32: + return &elf32_frv_howto_table[ (int) R_FRV_GPREL32]; + + case BFD_RELOC_FRV_GPRELHI: + return &elf32_frv_howto_table[ (int) R_FRV_GPRELHI]; + + case BFD_RELOC_FRV_GPRELLO: + return &elf32_frv_howto_table[ (int) R_FRV_GPRELLO]; + + case BFD_RELOC_FRV_GOT12: + return &elf32_frv_howto_table[ (int) R_FRV_GOT12]; + + case BFD_RELOC_FRV_GOTHI: + return &elf32_frv_howto_table[ (int) R_FRV_GOTHI]; + + case BFD_RELOC_FRV_GOTLO: + return &elf32_frv_howto_table[ (int) R_FRV_GOTLO]; + + case BFD_RELOC_FRV_FUNCDESC: + if (elf_elfheader (abfd)->e_type == ET_EXEC + || elf_elfheader (abfd)->e_type == ET_DYN) + return &elf32_frv_rel_funcdesc_howto; + return &elf32_frv_howto_table[ (int) R_FRV_FUNCDESC]; + + case BFD_RELOC_FRV_FUNCDESC_GOT12: + return &elf32_frv_howto_table[ (int) R_FRV_FUNCDESC_GOT12]; + + case BFD_RELOC_FRV_FUNCDESC_GOTHI: + return &elf32_frv_howto_table[ (int) R_FRV_FUNCDESC_GOTHI]; + + case BFD_RELOC_FRV_FUNCDESC_GOTLO: + return &elf32_frv_howto_table[ (int) R_FRV_FUNCDESC_GOTLO]; + + case BFD_RELOC_FRV_FUNCDESC_VALUE: + if (elf_elfheader (abfd)->e_type == ET_EXEC + || elf_elfheader (abfd)->e_type == ET_DYN) + return &elf32_frv_rel_funcdesc_value_howto; + return &elf32_frv_howto_table[ (int) R_FRV_FUNCDESC_VALUE]; + + case BFD_RELOC_FRV_FUNCDESC_GOTOFF12: + return &elf32_frv_howto_table[ (int) R_FRV_FUNCDESC_GOTOFF12]; + + case BFD_RELOC_FRV_FUNCDESC_GOTOFFHI: + return &elf32_frv_howto_table[ (int) R_FRV_FUNCDESC_GOTOFFHI]; + + case BFD_RELOC_FRV_FUNCDESC_GOTOFFLO: + return &elf32_frv_howto_table[ (int) R_FRV_FUNCDESC_GOTOFFLO]; + + case BFD_RELOC_FRV_GOTOFF12: + return &elf32_frv_howto_table[ (int) R_FRV_GOTOFF12]; + + case BFD_RELOC_FRV_GOTOFFHI: + return &elf32_frv_howto_table[ (int) R_FRV_GOTOFFHI]; + + case BFD_RELOC_FRV_GOTOFFLO: + return &elf32_frv_howto_table[ (int) R_FRV_GOTOFFLO]; + + case BFD_RELOC_VTABLE_INHERIT: + return &elf32_frv_vtinherit_howto; + + case BFD_RELOC_VTABLE_ENTRY: + return &elf32_frv_vtentry_howto; + } + + return NULL; +} + +/* Set the howto pointer for an FRV ELF reloc. */ + +static void +frv_info_to_howto_rela (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + switch (r_type) + { + case R_FRV_GNU_VTINHERIT: + cache_ptr->howto = &elf32_frv_vtinherit_howto; + break; + + case R_FRV_GNU_VTENTRY: + cache_ptr->howto = &elf32_frv_vtentry_howto; + break; + + default: + cache_ptr->howto = & elf32_frv_howto_table [r_type]; + break; + } +} + +/* Set the howto pointer for an FRV ELF REL reloc. */ +static void +frvfdpic_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, Elf_Internal_Rela *dst) +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + switch (r_type) + { + case R_FRV_32: + cache_ptr->howto = &elf32_frv_rel_32_howto; + break; + + case R_FRV_FUNCDESC: + cache_ptr->howto = &elf32_frv_rel_funcdesc_howto; + break; + + case R_FRV_FUNCDESC_VALUE: + cache_ptr->howto = &elf32_frv_rel_funcdesc_value_howto; + break; + + default: + cache_ptr->howto = NULL; + break; + } +} + +/* Perform a single relocation. By default we use the standard BFD + routines, but a few relocs, we have to do them ourselves. */ + +static bfd_reloc_status_type +frv_final_link_relocate (howto, input_bfd, input_section, contents, rel, + relocation) + reloc_howto_type *howto; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *rel; + bfd_vma relocation; +{ + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, relocation, + rel->r_addend); +} + + +/* Relocate an FRV ELF section. + + The RELOCATE_SECTION function is called by the new ELF backend linker + to handle the relocations for a section. + + The relocs are always passed as Rela structures; if the section + actually uses Rel structures, the r_addend field will always be + zero. + + This function is responsible for adjusting the section contents as + necessary, and (if using Rela relocs and generating a relocatable + output file) adjusting the reloc addend as necessary. + + This function does not have to worry about setting the reloc + address or the reloc symbol index. + + LOCAL_SYMS is a pointer to the swapped in local symbols. + + LOCAL_SECTIONS is an array giving the section in the input file + corresponding to the st_shndx field of each local symbol. + + The global hash table entry for the global symbols can be found + via elf_sym_hashes (input_bfd). + + When generating relocatable output, this function must handle + STB_LOCAL/STT_SECTION symbols specially. The output symbol is + going to be the section symbol corresponding to the output + section, which means that the addend must be adjusted + accordingly. */ + +static bfd_boolean +elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + unsigned isec_segment, got_segment, plt_segment, gprel_segment, + check_segment[2]; + int silence_segment_error = !(info->shared || info->pie); + + if (info->relocatable) + return TRUE; + + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + relend = relocs + input_section->reloc_count; + + isec_segment = _frvfdpic_osec_to_segment (output_bfd, + input_section->output_section); + if (IS_FDPIC (output_bfd) && frvfdpic_got_section (info)) + got_segment = _frvfdpic_osec_to_segment (output_bfd, + frvfdpic_got_section (info) + ->output_section); + else + got_segment = -1; + if (IS_FDPIC (output_bfd) && frvfdpic_gotfixup_section (info)) + gprel_segment = _frvfdpic_osec_to_segment (output_bfd, + frvfdpic_gotfixup_section (info) + ->output_section); + else + gprel_segment = -1; + if (IS_FDPIC (output_bfd) && elf_hash_table (info)->dynamic_sections_created) + plt_segment = _frvfdpic_osec_to_segment (output_bfd, + frvfdpic_plt_section (info) + ->output_section); + else + plt_segment = -1; + + for (rel = relocs; rel < relend; rel ++) + { + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + const char * name = NULL; + int r_type; + asection *osec; + struct frvfdpic_relocs_info *picrel; + bfd_vma orig_addend = rel->r_addend; + + r_type = ELF32_R_TYPE (rel->r_info); + + if ( r_type == R_FRV_GNU_VTINHERIT + || r_type == R_FRV_GNU_VTENTRY) + continue; + + /* This is a final link. */ + r_symndx = ELF32_R_SYM (rel->r_info); + howto = elf32_frv_howto_table + ELF32_R_TYPE (rel->r_info); + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + osec = sec = local_sections [r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); + name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + } + else + { + h = sym_hashes [r_symndx - symtab_hdr->sh_info]; + + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + name = h->root.root.string; + + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && ! FRVFDPIC_SYM_LOCAL (info, h)) + { + sec = NULL; + relocation = 0; + } + else + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + relocation = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else if (h->root.type == bfd_link_hash_undefweak) + { + relocation = 0; + } + else if (info->unresolved_syms_in_objects == RM_IGNORE + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + relocation = 0; + else + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, + (info->unresolved_syms_in_objects == RM_GENERATE_ERROR + || ELF_ST_VISIBILITY (h->other))))) + return FALSE; + relocation = 0; + } + osec = sec; + } + + switch (r_type) + { + case R_FRV_LABEL24: + case R_FRV_32: + if (! IS_FDPIC (output_bfd)) + goto non_fdpic; + + case R_FRV_GOT12: + case R_FRV_GOTHI: + case R_FRV_GOTLO: + case R_FRV_FUNCDESC_GOT12: + case R_FRV_FUNCDESC_GOTHI: + case R_FRV_FUNCDESC_GOTLO: + case R_FRV_GOTOFF12: + case R_FRV_GOTOFFHI: + case R_FRV_GOTOFFLO: + case R_FRV_FUNCDESC_GOTOFF12: + case R_FRV_FUNCDESC_GOTOFFHI: + case R_FRV_FUNCDESC_GOTOFFLO: + case R_FRV_FUNCDESC: + case R_FRV_FUNCDESC_VALUE: + if (h != NULL) + picrel = frvfdpic_relocs_info_for_global (frvfdpic_relocs_info + (info), input_bfd, h, + orig_addend, INSERT); + else + /* In order to find the entry we created before, we must + use the original addend, not the one that may have been + modified by _bfd_elf_rela_local_sym(). */ + picrel = frvfdpic_relocs_info_for_local (frvfdpic_relocs_info + (info), input_bfd, r_symndx, + orig_addend, INSERT); + if (! picrel) + return FALSE; + + if (!_frvfdpic_emit_got_relocs_plt_entries (picrel, output_bfd, info, + osec, sym, + rel->r_addend)) + { + (*_bfd_error_handler) + (_("%s: relocation at `%s+0x%x' references symbol `%s' with nonzero addend"), + bfd_archive_filename (input_bfd), input_section->name, + rel->r_offset, name); + return FALSE; + + } + + break; + + default: + non_fdpic: + picrel = NULL; + if (h && ! FRVFDPIC_SYM_LOCAL (info, h)) + { + info->callbacks->warning + (info, _("relocation references symbol not defined in the module"), + name, input_bfd, input_section, rel->r_offset); + return FALSE; + } + break; + } + + switch (r_type) + { + case R_FRV_LABEL24: + check_segment[0] = isec_segment; + if (! IS_FDPIC (output_bfd)) + check_segment[1] = isec_segment; + else if (picrel->plt) + { + relocation = frvfdpic_plt_section (info)->output_section->vma + + frvfdpic_plt_section (info)->output_offset + + picrel->plt_entry; + check_segment[1] = plt_segment; + } + /* We don't want to warn on calls to undefined weak symbols, + as calls to them must be protected by non-NULL tests + anyway, and unprotected calls would invoke undefined + behavior. */ + else if (picrel->symndx == -1 + && picrel->d.h->root.type == bfd_link_hash_undefweak) + check_segment[1] = check_segment[0]; + else + check_segment[1] = sec + ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) + : (unsigned)-1; + break; + + case R_FRV_GOT12: + case R_FRV_GOTHI: + case R_FRV_GOTLO: + relocation = picrel->got_entry; + check_segment[0] = check_segment[1] = got_segment; + break; + + case R_FRV_FUNCDESC_GOT12: + case R_FRV_FUNCDESC_GOTHI: + case R_FRV_FUNCDESC_GOTLO: + relocation = picrel->fdgot_entry; + check_segment[0] = check_segment[1] = got_segment; + break; + + case R_FRV_GOTOFFHI: + case R_FRV_GOTOFF12: + case R_FRV_GOTOFFLO: + relocation -= frvfdpic_got_section (info)->output_section->vma + + frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info); + check_segment[0] = got_segment; + check_segment[1] = sec + ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) + : (unsigned)-1; + break; + + case R_FRV_FUNCDESC_GOTOFF12: + case R_FRV_FUNCDESC_GOTOFFHI: + case R_FRV_FUNCDESC_GOTOFFLO: + relocation = picrel->fd_entry; + check_segment[0] = check_segment[1] = got_segment; + break; + + case R_FRV_FUNCDESC: + { + int dynindx; + bfd_vma addend = rel->r_addend; + + if (! (h && h->root.type == bfd_link_hash_undefweak + && FRVFDPIC_SYM_LOCAL (info, h))) + { + /* If the symbol is dynamic and there may be dynamic + symbol resolution because we are or are linked with a + shared library, emit a FUNCDESC relocation such that + the dynamic linker will allocate the function + descriptor. If the symbol needs a non-local function + descriptor but binds locally (e.g., its visibility is + protected, emit a dynamic relocation decayed to + section+offset. */ + if (h && ! FRVFDPIC_FUNCDESC_LOCAL (info, h) + && FRVFDPIC_SYM_LOCAL (info, h) + && !(info->executable && !info->pie)) + { + dynindx = elf_section_data (h->root.u.def.section + ->output_section)->dynindx; + addend += h->root.u.def.section->output_offset + + h->root.u.def.value; + } + else if (h && ! FRVFDPIC_FUNCDESC_LOCAL (info, h)) + { + if (addend) + { + info->callbacks->warning + (info, _("R_FRV_FUNCDESC references dynamic symbol with nonzero addend"), + name, input_bfd, input_section, rel->r_offset); + return FALSE; + } + dynindx = h->dynindx; + } + else + { + /* Otherwise, we know we have a private function + descriptor, so reference it directly. */ + BFD_ASSERT (picrel->privfd); + r_type = R_FRV_32; + dynindx = elf_section_data (frvfdpic_got_section (info) + ->output_section)->dynindx; + addend = frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info) + + picrel->fd_entry; + } + + /* If there is room for dynamic symbol resolution, emit + the dynamic relocation. However, if we're linking an + executable at a fixed location, we won't have emitted a + dynamic symbol entry for the got section, so idx will + be zero, which means we can and should compute the + address of the private descriptor ourselves. */ + if (info->executable && !info->pie + && (!h || FRVFDPIC_FUNCDESC_LOCAL (info, h))) + { + addend += frvfdpic_got_section (info)->output_section->vma; + if ((bfd_get_section_flags (output_bfd, + input_section->output_section) + & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) + { + if (_frvfdpic_osec_readonly_p (output_bfd, + input_section + ->output_section)) + { + info->callbacks->warning + (info, + _("cannot emit fixups in read-only section"), + name, input_bfd, input_section, rel->r_offset); + return FALSE; + } + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section + (info), + _bfd_elf_section_offset + (output_bfd, info, + input_section, rel->r_offset) + + input_section + ->output_section->vma + + input_section->output_offset, + picrel); + } + } + else if ((bfd_get_section_flags (output_bfd, + input_section->output_section) + & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) + { + if (_frvfdpic_osec_readonly_p (output_bfd, + input_section + ->output_section)) + { + info->callbacks->warning + (info, + _("cannot emit dynamic relocations in read-only section"), + name, input_bfd, input_section, rel->r_offset); + return FALSE; + } + _frvfdpic_add_dyn_reloc (output_bfd, + frvfdpic_gotrel_section (info), + _bfd_elf_section_offset + (output_bfd, info, + input_section, rel->r_offset) + + input_section + ->output_section->vma + + input_section->output_offset, + r_type, dynindx, addend, picrel); + } + else + addend += frvfdpic_got_section (info)->output_section->vma; + } + + /* We want the addend in-place because dynamic + relocations are REL. Setting relocation to it should + arrange for it to be installed. */ + relocation = addend - rel->r_addend; + } + check_segment[0] = check_segment[1] = got_segment; + break; + + case R_FRV_32: + if (! IS_FDPIC (output_bfd)) + { + check_segment[0] = check_segment[1] = -1; + break; + } + /* Fall through. */ + case R_FRV_FUNCDESC_VALUE: + { + int dynindx; + bfd_vma addend = rel->r_addend; + + /* If the symbol is dynamic but binds locally, use + section+offset. */ + if (h && ! FRVFDPIC_SYM_LOCAL (info, h)) + { + if (addend && r_type == R_FRV_FUNCDESC_VALUE) + { + info->callbacks->warning + (info, _("R_FRV_FUNCDESC_VALUE references dynamic symbol with nonzero addend"), + name, input_bfd, input_section, rel->r_offset); + return FALSE; + } + dynindx = h->dynindx; + } + else + { + if (h) + addend += h->root.u.def.value; + else + addend += sym->st_value; + if (osec) + addend += osec->output_offset; + if (osec && osec->output_section + && ! bfd_is_abs_section (osec->output_section) + && ! bfd_is_und_section (osec->output_section)) + dynindx = elf_section_data (osec->output_section)->dynindx; + else + dynindx = 0; + } + + /* If we're linking an executable at a fixed address, we + can omit the dynamic relocation as long as the symbol + is defined in the current link unit (which is implied + by its output section not being NULL). */ + if (info->executable && !info->pie + && (!h || FRVFDPIC_SYM_LOCAL (info, h))) + { + if (osec) + addend += osec->output_section->vma; + if (IS_FDPIC (input_bfd) + && (bfd_get_section_flags (output_bfd, + input_section->output_section) + & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) + { + if (_frvfdpic_osec_readonly_p (output_bfd, + input_section + ->output_section)) + { + info->callbacks->warning + (info, + _("cannot emit fixups in read-only section"), + name, input_bfd, input_section, rel->r_offset); + return FALSE; + } + if (!h || h->root.type != bfd_link_hash_undefweak) + { + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section + (info), + _bfd_elf_section_offset + (output_bfd, info, + input_section, rel->r_offset) + + input_section + ->output_section->vma + + input_section->output_offset, + picrel); + if (r_type == R_FRV_FUNCDESC_VALUE) + _frvfdpic_add_rofixup + (output_bfd, + frvfdpic_gotfixup_section (info), + _bfd_elf_section_offset + (output_bfd, info, + input_section, rel->r_offset) + + input_section->output_section->vma + + input_section->output_offset + 4, picrel); + } + } + } + else + { + if ((bfd_get_section_flags (output_bfd, + input_section->output_section) + & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) + { + if (_frvfdpic_osec_readonly_p (output_bfd, + input_section + ->output_section)) + { + info->callbacks->warning + (info, + _("cannot emit dynamic relocations in read-only section"), + name, input_bfd, input_section, rel->r_offset); + return FALSE; + } + _frvfdpic_add_dyn_reloc (output_bfd, + frvfdpic_gotrel_section (info), + _bfd_elf_section_offset + (output_bfd, info, + input_section, rel->r_offset) + + input_section + ->output_section->vma + + input_section->output_offset, + r_type, dynindx, addend, picrel); + } + else if (osec) + addend += osec->output_section->vma; + /* We want the addend in-place because dynamic + relocations are REL. Setting relocation to it + should arrange for it to be installed. */ + relocation = addend - rel->r_addend; + } + + if (r_type == R_FRV_FUNCDESC_VALUE) + { + /* If we've omitted the dynamic relocation, just emit + the fixed addresses of the symbol and of the local + GOT base offset. */ + if (info->executable && !info->pie + && (!h || FRVFDPIC_SYM_LOCAL (info, h))) + bfd_put_32 (output_bfd, + frvfdpic_got_section (info)->output_section->vma + + frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info), + contents + rel->r_offset + 4); + else + /* A function descriptor used for lazy or local + resolving is initialized such that its high word + contains the output section index in which the + PLT entries are located, and the low word + contains the offset of the lazy PLT entry entry + point into that section. */ + bfd_put_32 (output_bfd, + h && ! FRVFDPIC_SYM_LOCAL (info, h) + ? 0 + : _frvfdpic_osec_to_segment (output_bfd, + sec + ->output_section), + contents + rel->r_offset + 4); + } + } + check_segment[0] = check_segment[1] = got_segment; + break; + + case R_FRV_GPREL12: + case R_FRV_GPRELU12: + case R_FRV_GPREL32: + case R_FRV_GPRELHI: + case R_FRV_GPRELLO: + check_segment[0] = gprel_segment; + check_segment[1] = sec + ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) + : (unsigned)-1; + break; + + default: + check_segment[0] = isec_segment; + check_segment[1] = sec + ? _frvfdpic_osec_to_segment (output_bfd, sec->output_section) + : (unsigned)-1; + break; + } + + if (check_segment[0] != check_segment[1] && IS_FDPIC (output_bfd)) + { +#if 1 /* If you take this out, remove the #error from fdpic-static-6.d + in the ld testsuite. */ + /* This helps catch problems in GCC while we can't do more + than static linking. The idea is to test whether the + input file basename is crt0.o only once. */ + if (silence_segment_error == 1) + silence_segment_error = + (strlen (input_bfd->filename) == 6 + && strcmp (input_bfd->filename, "crt0.o") == 0) + || (strlen (input_bfd->filename) > 6 + && strcmp (input_bfd->filename + + strlen (input_bfd->filename) - 7, + "/crt0.o") == 0) + ? -1 : 0; +#endif + if (!silence_segment_error + /* We don't want duplicate errors for undefined + symbols. */ + && !(picrel && picrel->symndx == -1 + && picrel->d.h->root.type == bfd_link_hash_undefined)) + info->callbacks->warning + (info, + (info->shared || info->pie) + ? _("relocations between different segments are not supported") + : _("warning: relocation references a different segment"), + name, input_bfd, input_section, rel->r_offset); + if (!silence_segment_error && (info->shared || info->pie)) + return FALSE; + elf_elfheader (output_bfd)->e_flags |= EF_FRV_PIC; + } + + switch (r_type) + { + case R_FRV_GOTOFFHI: + /* We need the addend to be applied before we shift the + value right. */ + relocation += rel->r_addend; + /* Fall through. */ + case R_FRV_GOTHI: + case R_FRV_FUNCDESC_GOTHI: + case R_FRV_FUNCDESC_GOTOFFHI: + relocation >>= 16; + /* Fall through. */ + + case R_FRV_GOTLO: + case R_FRV_FUNCDESC_GOTLO: + case R_FRV_GOTOFFLO: + case R_FRV_FUNCDESC_GOTOFFLO: + relocation &= 0xffff; + break; + + default: + break; + } + + switch (r_type) + { + case R_FRV_LABEL24: + if (! IS_FDPIC (output_bfd) || ! picrel->plt) + break; + /* Fall through. */ + + /* When referencing a GOT entry, a function descriptor or a + PLT, we don't want the addend to apply to the reference, + but rather to the referenced symbol. The actual entry + will have already been created taking the addend into + account, so cancel it out here. */ + case R_FRV_GOT12: + case R_FRV_GOTHI: + case R_FRV_GOTLO: + case R_FRV_FUNCDESC_GOT12: + case R_FRV_FUNCDESC_GOTHI: + case R_FRV_FUNCDESC_GOTLO: + case R_FRV_FUNCDESC_GOTOFF12: + case R_FRV_FUNCDESC_GOTOFFHI: + case R_FRV_FUNCDESC_GOTOFFLO: + /* Note that we only want GOTOFFHI, not GOTOFFLO or GOTOFF12 + here, since we do want to apply the addend to the others. + Note that we've applied the addend to GOTOFFHI before we + shifted it right. */ + case R_FRV_GOTOFFHI: + relocation -= rel->r_addend; + break; + + default: + break; + } + + if (r_type == R_FRV_HI16) + r = elf32_frv_relocate_hi16 (input_bfd, rel, contents, relocation); + + else if (r_type == R_FRV_LO16) + r = elf32_frv_relocate_lo16 (input_bfd, rel, contents, relocation); + + else if (r_type == R_FRV_LABEL24) + r = elf32_frv_relocate_label24 (input_bfd, input_section, rel, + contents, relocation); + + else if (r_type == R_FRV_GPREL12) + r = elf32_frv_relocate_gprel12 (info, input_bfd, input_section, rel, + contents, relocation); + + else if (r_type == R_FRV_GPRELU12) + r = elf32_frv_relocate_gprelu12 (info, input_bfd, input_section, rel, + contents, relocation); + + else if (r_type == R_FRV_GPRELLO) + r = elf32_frv_relocate_gprello (info, input_bfd, input_section, rel, + contents, relocation); + + else if (r_type == R_FRV_GPRELHI) + r = elf32_frv_relocate_gprelhi (info, input_bfd, input_section, rel, + contents, relocation); + + else + r = frv_final_link_relocate (howto, input_bfd, input_section, contents, + rel, relocation); + + if (r != bfd_reloc_ok) + { + const char * msg = (const char *) NULL; + + switch (r) + { + case bfd_reloc_overflow: + r = info->callbacks->reloc_overflow + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset); + break; + + case bfd_reloc_undefined: + r = info->callbacks->undefined_symbol + (info, name, input_bfd, input_section, rel->r_offset, TRUE); + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + break; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + break; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous relocation"); + break; + + default: + msg = _("internal error: unknown error"); + break; + } + + if (msg) + r = info->callbacks->warning + (info, msg, name, input_bfd, input_section, rel->r_offset); + + if (! r) + return FALSE; + } + } + + return TRUE; +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +elf32_frv_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_FRV_GNU_VTINHERIT: + case R_FRV_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + default: + break; + + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the got entry reference counts for the section being removed. */ + +static bfd_boolean +elf32_frv_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +{ + return TRUE; +} + + +/* Hook called by the linker routine which adds symbols from an object + file. We use it to put .comm items in .scomm, and not .comm. */ + +static bfd_boolean +elf32_frv_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) + bfd *abfd; + struct bfd_link_info *info; + Elf_Internal_Sym *sym; + const char **namep ATTRIBUTE_UNUSED; + flagword *flagsp ATTRIBUTE_UNUSED; + asection **secp; + bfd_vma *valp; +{ + if (sym->st_shndx == SHN_COMMON + && !info->relocatable + && (int)sym->st_size <= (int)bfd_get_gp_size (abfd)) + { + /* Common symbols less than or equal to -G nn bytes are + automatically put into .sbss. */ + + asection *scomm = bfd_get_section_by_name (abfd, ".scommon"); + + if (scomm == NULL) + { + scomm = bfd_make_section (abfd, ".scommon"); + if (scomm == NULL + || !bfd_set_section_flags (abfd, scomm, (SEC_ALLOC + | SEC_IS_COMMON + | SEC_LINKER_CREATED))) + return FALSE; + } + + *secp = scomm; + *valp = sym->st_size; + } + + return TRUE; +} + +/* Create a .got section, as well as its additional info field. This + is almost entirely copied from + elflink.c:_bfd_elf_create_got_section(). */ + +static bfd_boolean +_frv_create_got_section (bfd *abfd, struct bfd_link_info *info) +{ + flagword flags; + asection *s; + struct elf_link_hash_entry *h; + struct bfd_link_hash_entry *bh; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + int ptralign; + int offset; + + /* This function may be called more than once. */ + s = bfd_get_section_by_name (abfd, ".got"); + if (s != NULL && (s->flags & SEC_LINKER_CREATED) != 0) + return TRUE; + + /* Machine specific: although pointers are 32-bits wide, we want the + GOT to be aligned to a 64-bit boundary, such that function + descriptors in it can be accessed with 64-bit loads and + stores. */ + ptralign = 3; + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + + s = bfd_make_section (abfd, ".got"); + if (s == NULL + || !bfd_set_section_flags (abfd, s, flags) + || !bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + + if (bed->want_got_plt) + { + s = bfd_make_section (abfd, ".got.plt"); + if (s == NULL + || !bfd_set_section_flags (abfd, s, flags) + || !bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + } + + if (bed->want_got_sym) + { + /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got + (or .got.plt) section. We don't do this in the linker script + because we don't want to define the symbol if we are not creating + a global offset table. */ + bh = NULL; + if (!(_bfd_generic_link_add_one_symbol + (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s, + bed->got_symbol_offset, (const char *) NULL, FALSE, + bed->collect, &bh))) + return FALSE; + h = (struct elf_link_hash_entry *) bh; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; + + /* Machine-specific: we want the symbol for executables as + well. */ + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + + elf_hash_table (info)->hgot = h; + } + + /* The first bit of the global offset table is the header. */ + s->_raw_size += bed->got_header_size + bed->got_symbol_offset; + + /* This is the machine-specific part. Create and initialize section + data for the got. */ + if (IS_FDPIC (abfd)) + { + frvfdpic_got_section (info) = s; + frvfdpic_relocs_info (info) = htab_try_create (1, frvfdpic_relocs_info_hash, + frvfdpic_relocs_info_eq, + (htab_del) NULL); + if (! frvfdpic_relocs_info (info)) + return FALSE; + + s = bfd_make_section (abfd, ".rel.got"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, (flags | SEC_READONLY)) + || ! bfd_set_section_alignment (abfd, s, 2)) + return FALSE; + + frvfdpic_gotrel_section (info) = s; + + /* Machine-specific. */ + s = bfd_make_section (abfd, ".rofixup"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, (flags | SEC_READONLY)) + || ! bfd_set_section_alignment (abfd, s, 2)) + return FALSE; + + frvfdpic_gotfixup_section (info) = s; + offset = -2048; + flags = BSF_GLOBAL; + } + else + { + offset = 2048; + flags = BSF_GLOBAL | BSF_WEAK; + } + + /* Define _gp in .rofixup, for FDPIC, or .got otherwise. If it + turns out that we're linking with a different linker script, the + linker script will override it. */ + bh = NULL; + if (!(_bfd_generic_link_add_one_symbol + (info, abfd, "_gp", flags, s, offset, (const char *) NULL, FALSE, + bed->collect, &bh))) + return FALSE; + h = (struct elf_link_hash_entry *) bh; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; + + /* Machine-specific: we want the symbol for executables as well. */ + if (IS_FDPIC (abfd) && ! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + + return TRUE; +} + +/* Make sure the got and plt sections exist, and that our pointers in + the link hash table point to them. */ + +static bfd_boolean +elf32_frvfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) +{ + /* This is mostly copied from + elflink.c:_bfd_elf_create_dynamic_sections(). */ + flagword flags, pltflags; + asection *s; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + + /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and + .rel[a].bss sections. */ + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + + pltflags = flags; + pltflags |= SEC_CODE; + if (bed->plt_not_loaded) + pltflags &= ~ (SEC_CODE | SEC_LOAD | SEC_HAS_CONTENTS); + if (bed->plt_readonly) + pltflags |= SEC_READONLY; + + s = bfd_make_section (abfd, ".plt"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, pltflags) + || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + return FALSE; + /* FRV-specific: remember it. */ + frvfdpic_plt_section (info) = s; + + if (bed->want_plt_sym) + { + /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the + .plt section. */ + struct elf_link_hash_entry *h; + struct bfd_link_hash_entry *bh = NULL; + + if (! (_bfd_generic_link_add_one_symbol + (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s, 0, NULL, + FALSE, get_elf_backend_data (abfd)->collect, &bh))) + return FALSE; + h = (struct elf_link_hash_entry *) bh; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; + + if (! info->executable + && ! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + /* FRV-specific: we want rel relocations for the plt. */ + s = bfd_make_section (abfd, ".rel.plt"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + return FALSE; + /* FRV-specific: remember it. */ + frvfdpic_pltrel_section (info) = s; + + /* FRV-specific: we want to create the GOT in the FRV way. */ + if (! _frv_create_got_section (abfd, info)) + return FALSE; + + /* FRV-specific: make sure we created everything we wanted. */ + BFD_ASSERT (frvfdpic_got_section (info) && frvfdpic_gotrel_section (info) + && frvfdpic_gotfixup_section (info) + && frvfdpic_plt_section (info) + && frvfdpic_pltrel_section (info)); + + if (bed->want_dynbss) + { + /* The .dynbss section is a place to put symbols which are defined + by dynamic objects, are referenced by regular objects, and are + not functions. We must allocate space for them in the process + image and use a R_*_COPY reloc to tell the dynamic linker to + initialize them at run time. The linker script puts the .dynbss + section into the .bss section of the final image. */ + s = bfd_make_section (abfd, ".dynbss"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, SEC_ALLOC | SEC_LINKER_CREATED)) + return FALSE; + + /* The .rel[a].bss section holds copy relocs. This section is not + normally needed. We need to create it here, though, so that the + linker will map it to an output section. We can't just create it + only if we need it, because we will not know whether we need it + until we have seen all the input files, and the first time the + main linker code calls BFD after examining all the input files + (size_dynamic_sections) the input sections have already been + mapped to the output sections. If the section turns out not to + be needed, we can discard it later. We will never need this + section when generating a shared object, since they do not use + copy relocs. */ + if (! info->shared) + { + s = bfd_make_section (abfd, + (bed->default_use_rela_p + ? ".rela.bss" : ".rel.bss")); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + return FALSE; + } + } + + return TRUE; +} + +/* The name of the dynamic interpreter. This is put in the .interp + section. */ + +#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1" + +#define DEFAULT_STACK_SIZE 0x20000 + +/* This structure is used to collect the number of entries present in + each addressable range of the got. */ +struct _frvfdpic_dynamic_got_info +{ + /* Several bits of information about the current link. */ + struct bfd_link_info *info; + /* Total size needed for GOT entries within the 12-, 16- or 32-bit + ranges. */ + bfd_vma got12, gotlos, gothilo; + /* Total size needed for function descriptor entries within the 12-, + 16- or 32-bit ranges. */ + bfd_vma fd12, fdlos, fdhilo; + /* Total size needed function descriptor entries referenced in PLT + entries, that would be profitable to place in offsets close to + the PIC register. */ + bfd_vma fdplt; + /* Total size needed by lazy PLT entries. */ + bfd_vma lzplt; + /* Number of relocations carried over from input object files. */ + unsigned long relocs; + /* Number of fixups introduced by relocations in input object files. */ + unsigned long fixups; +}; + +/* Compute the total GOT size required by each symbol in each range. + Symbols may require up to 4 words in the GOT: an entry pointing to + the symbol, an entry pointing to its function descriptor, and a + private function descriptors taking two words. */ + +static int +_frvfdpic_count_got_plt_entries (void **entryp, void *dinfo_) +{ + struct frvfdpic_relocs_info *entry = *entryp; + struct _frvfdpic_dynamic_got_info *dinfo = dinfo_; + unsigned relocs = 0, fixups = 0; + + /* Allocate space for a GOT entry pointing to the symbol. */ + if (entry->got12) + dinfo->got12 += 4; + else if (entry->gotlos) + dinfo->gotlos += 4; + else if (entry->gothilo) + dinfo->gothilo += 4; + else + entry->relocs32--; + entry->relocs32++; + + /* Allocate space for a GOT entry pointing to the function + descriptor. */ + if (entry->fdgot12) + dinfo->got12 += 4; + else if (entry->fdgotlos) + dinfo->gotlos += 4; + else if (entry->fdgothilo) + dinfo->gothilo += 4; + else + entry->relocsfd--; + entry->relocsfd++; + + /* Decide whether we need a PLT entry, a function descriptor in the + GOT, and a lazy PLT entry for this symbol. */ + entry->plt = entry->call + && entry->symndx == -1 && ! FRVFDPIC_SYM_LOCAL (dinfo->info, entry->d.h) + && elf_hash_table (dinfo->info)->dynamic_sections_created; + entry->privfd = entry->plt + || entry->fdgoff12 || entry->fdgofflos || entry->fdgoffhilo + || ((entry->fd || entry->fdgot12 || entry->fdgotlos || entry->fdgothilo) + && (entry->symndx != -1 + || FRVFDPIC_FUNCDESC_LOCAL (dinfo->info, entry->d.h))); + entry->lazyplt = entry->privfd + && entry->symndx == -1 && ! FRVFDPIC_SYM_LOCAL (dinfo->info, entry->d.h) + && ! (dinfo->info->flags & DF_BIND_NOW) + && elf_hash_table (dinfo->info)->dynamic_sections_created; + + /* Allocate space for a function descriptor. */ + if (entry->fdgoff12) + dinfo->fd12 += 8; + else if (entry->fdgofflos) + dinfo->fdlos += 8; + else if (entry->privfd && entry->plt) + dinfo->fdplt += 8; + else if (entry->privfd) + dinfo->fdhilo += 8; + else + entry->relocsfdv--; + entry->relocsfdv++; + + if (entry->lazyplt) + dinfo->lzplt += 8; + + if (!dinfo->info->executable || dinfo->info->pie) + relocs = entry->relocs32 + entry->relocsfd + entry->relocsfdv; + else + { + if (entry->symndx != -1 || FRVFDPIC_SYM_LOCAL (dinfo->info, entry->d.h)) + { + if (entry->symndx != -1 + || entry->d.h->root.type != bfd_link_hash_undefweak) + fixups += entry->relocs32 + 2 * entry->relocsfdv; + } + else + relocs += entry->relocs32 + entry->relocsfdv; + + if (entry->symndx != -1 + || FRVFDPIC_FUNCDESC_LOCAL (dinfo->info, entry->d.h)) + { + if (entry->symndx != -1 + || entry->d.h->root.type != bfd_link_hash_undefweak) + fixups += entry->relocsfd; + } + else + relocs += entry->relocsfd; + } + + entry->dynrelocs += relocs; + entry->fixups += fixups; + dinfo->relocs += relocs; + dinfo->fixups += fixups; + + return 1; +} + +/* This structure is used to assign offsets to got entries, function + descriptors, plt entries and lazy plt entries. */ + +struct _frvfdpic_dynamic_got_plt_info +{ + /* Summary information collected with _frvfdpic_count_got_plt_entries. */ + struct _frvfdpic_dynamic_got_info g; + + /* For each addressable range, we record a MAX (positive) and MIN + (negative) value. CUR is used to assign got entries, and it's + incremented from an initial positive value to MAX, then from MIN + to FDCUR (unless FDCUR wraps around first). FDCUR is used to + assign function descriptors, and it's decreased from an initial + non-positive value to MIN, then from MAX down to CUR (unless CUR + wraps around first). All of MIN, MAX, CUR and FDCUR always point + to even words. ODD, if non-zero, indicates an odd word to be + used for the next got entry, otherwise CUR is used and + incremented by a pair of words, wrapping around when it reaches + MAX. FDCUR is decremented (and wrapped) before the next function + descriptor is chosen. FDPLT indicates the number of remaining + slots that can be used for function descriptors used only by PLT + entries. */ + struct _frvfdpic_dynamic_got_alloc_data + { + bfd_signed_vma max, cur, odd, fdcur, min; + bfd_vma fdplt; + } got12, gotlos, gothilo; +}; + +/* Determine the positive and negative ranges to be used by each + offset range in the GOT. FDCUR and CUR, that must be aligned to a + double-word boundary, are the minimum (negative) and maximum + (positive) GOT offsets already used by previous ranges, except for + an ODD entry that may have been left behind. GOT and FD indicate + the size of GOT entries and function descriptors that must be + placed within the range from -WRAP to WRAP. If there's room left, + up to FDPLT bytes should be reserved for additional function + descriptors. */ + +inline static bfd_signed_vma +_frvfdpic_compute_got_alloc_data (struct _frvfdpic_dynamic_got_alloc_data *gad, + bfd_signed_vma fdcur, + bfd_signed_vma odd, + bfd_signed_vma cur, + bfd_vma got, + bfd_vma fd, + bfd_vma fdplt, + bfd_vma wrap) +{ + bfd_signed_vma wrapmin = -wrap; + + /* Start at the given initial points. */ + gad->fdcur = fdcur; + gad->cur = cur; + + /* If we had an incoming odd word and we have any got entries that + are going to use it, consume it, otherwise leave gad->odd at + zero. We might force gad->odd to zero and return the incoming + odd such that it is used by the next range, but then GOT entries + might appear to be out of order and we wouldn't be able to + shorten the GOT by one word if it turns out to end with an + unpaired GOT entry. */ + if (odd && got) + { + gad->odd = odd; + got -= 4; + odd = 0; + } + else + gad->odd = 0; + + /* If we're left with an unpaired GOT entry, compute its location + such that we can return it. Otherwise, if got doesn't require an + odd number of words here, either odd was already zero in the + block above, or it was set to zero because got was non-zero, or + got was already zero. In the latter case, we want the value of + odd to carry over to the return statement, so we don't want to + reset odd unless the condition below is true. */ + if (got & 4) + { + odd = cur + got; + got += 4; + } + + /* Compute the tentative boundaries of this range. */ + gad->max = cur + got; + gad->min = fdcur - fd; + gad->fdplt = 0; + + /* If function descriptors took too much space, wrap some of them + around. */ + if (gad->min < wrapmin) + { + gad->max += wrapmin - gad->min; + gad->min = wrapmin; + } + /* If there is space left and we have function descriptors + referenced in PLT entries that could take advantage of shorter + offsets, place them here. */ + else if (fdplt && gad->min > wrapmin) + { + bfd_vma fds; + if ((bfd_vma) (gad->min - wrapmin) < fdplt) + fds = gad->min - wrapmin; + else + fds = fdplt; + + fdplt -= fds; + gad->min -= fds; + gad->fdplt += fds; + } + + /* If GOT entries took too much space, wrap some of them around. + This may well cause gad->min to become lower than wrapmin. This + will cause a relocation overflow later on, so we don't have to + report it here . */ + if ((bfd_vma) gad->max > wrap) + { + gad->min -= gad->max - wrap; + gad->max = wrap; + } + /* If there is more space left, try to place some more function + descriptors for PLT entries. */ + else if (fdplt && (bfd_vma) gad->max < wrap) + { + bfd_vma fds; + if ((bfd_vma) (wrap - gad->max) < fdplt) + fds = wrap - gad->max; + else + fds = fdplt; + + fdplt -= fds; + gad->max += fds; + gad->fdplt += fds; + } + + /* If odd was initially computed as an offset past the wrap point, + wrap it around. */ + if (odd > gad->max) + odd = gad->min + odd - gad->max; + + /* _frvfdpic_get_got_entry() below will always wrap gad->cur if needed + before returning, so do it here too. This guarantees that, + should cur and fdcur meet at the wrap point, they'll both be + equal to min. */ + if (gad->cur == gad->max) + gad->cur = gad->min; + + return odd; +} + +/* Compute the location of the next GOT entry, given the allocation + data for a range. */ + +inline static bfd_signed_vma +_frvfdpic_get_got_entry (struct _frvfdpic_dynamic_got_alloc_data *gad) +{ + bfd_signed_vma ret; + + if (gad->odd) + { + /* If there was an odd word left behind, use it. */ + ret = gad->odd; + gad->odd = 0; + } + else + { + /* Otherwise, use the word pointed to by cur, reserve the next + as an odd word, and skip to the next pair of words, possibly + wrapping around. */ + ret = gad->cur; + gad->odd = gad->cur + 4; + gad->cur += 8; + if (gad->cur == gad->max) + gad->cur = gad->min; + } + + return ret; +} + +/* Compute the location of the next function descriptor entry in the + GOT, given the allocation data for a range. */ + +inline static bfd_signed_vma +_frvfdpic_get_fd_entry (struct _frvfdpic_dynamic_got_alloc_data *gad) +{ + /* If we're at the bottom, wrap around, and only then allocate the + next pair of words. */ + if (gad->fdcur == gad->min) + gad->fdcur = gad->max; + return gad->fdcur -= 8; +} + +/* Assign GOT offsets for every GOT entry and function descriptor. + Doing everything in a single pass is tricky. */ + +static int +_frvfdpic_assign_got_entries (void **entryp, void *info_) +{ + struct frvfdpic_relocs_info *entry = *entryp; + struct _frvfdpic_dynamic_got_plt_info *dinfo = info_; + + if (entry->got12) + entry->got_entry = _frvfdpic_get_got_entry (&dinfo->got12); + else if (entry->gotlos) + entry->got_entry = _frvfdpic_get_got_entry (&dinfo->gotlos); + else if (entry->gothilo) + entry->got_entry = _frvfdpic_get_got_entry (&dinfo->gothilo); + + if (entry->fdgot12) + entry->fdgot_entry = _frvfdpic_get_got_entry (&dinfo->got12); + else if (entry->fdgotlos) + entry->fdgot_entry = _frvfdpic_get_got_entry (&dinfo->gotlos); + else if (entry->fdgothilo) + entry->fdgot_entry = _frvfdpic_get_got_entry (&dinfo->gothilo); + + if (entry->fdgoff12) + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->got12); + else if (entry->plt && dinfo->got12.fdplt) + { + dinfo->got12.fdplt -= 8; + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->got12); + } + else if (entry->fdgofflos) + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gotlos); + else if (entry->plt && dinfo->gotlos.fdplt) + { + dinfo->gotlos.fdplt -= 8; + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gotlos); + } + else if (entry->plt) + { + dinfo->gothilo.fdplt -= 8; + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo); + } + else if (entry->privfd) + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo); + + return 1; +} + +/* Assign GOT offsets to private function descriptors used by PLT + entries (or referenced by 32-bit offsets), as well as PLT entries + and lazy PLT entries. */ + +static int +_frvfdpic_assign_plt_entries (void **entryp, void *info_) +{ + struct frvfdpic_relocs_info *entry = *entryp; + struct _frvfdpic_dynamic_got_plt_info *dinfo = info_; + + /* If this symbol requires a local function descriptor, allocate + one. */ + if (entry->privfd && entry->fd_entry == 0) + { + if (dinfo->got12.fdplt) + { + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->got12); + dinfo->got12.fdplt -= 8; + } + else if (dinfo->gotlos.fdplt) + { + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gotlos); + dinfo->gotlos.fdplt -= 8; + } + else + { + BFD_ASSERT (dinfo->gothilo.fdplt) + entry->fd_entry = _frvfdpic_get_fd_entry (&dinfo->gothilo); + dinfo->gothilo.fdplt -= 8; + } + } + + if (entry->plt) + { + int size; + + /* We use the section's raw size to mark the location of the + next PLT entry. */ + entry->plt_entry = frvfdpic_plt_section (dinfo->g.info)->_raw_size; + + /* Figure out the length of this PLT entry based on the + addressing mode we need to reach the function descriptor. */ + BFD_ASSERT (entry->fd_entry); + if (entry->fd_entry >= -(1 << (12 - 1)) + && entry->fd_entry < (1 << (12 - 1))) + size = 8; + else if (entry->fd_entry >= -(1 << (16 - 1)) + && entry->fd_entry < (1 << (16 - 1))) + size = 12; + else + size = 16; + + frvfdpic_plt_section (dinfo->g.info)->_raw_size += size; + } + + if (entry->lazyplt) + { + entry->lzplt_entry = dinfo->g.lzplt; + dinfo->g.lzplt += 8; + /* If this entry is the one that gets the resolver stub, account + for the additional instruction. */ + if (entry->lzplt_entry % FRVFDPIC_LZPLT_BLOCK_SIZE + == FRVFDPIC_LZPLT_RESOLV_LOC) + dinfo->g.lzplt += 4; + } + + return 1; +} + +/* Follow indirect and warning hash entries so that each got entry + points to the final symbol definition. P must point to a pointer + to the hash table we're traversing. Since this traversal may + modify the hash table, we set this pointer to NULL to indicate + we've made a potentially-destructive change to the hash table, so + the traversal must be restarted. */ +static int +_frvfdpic_resolve_final_relocs_info (void **entryp, void *p) +{ + struct frvfdpic_relocs_info *entry = *entryp; + htab_t *htab = p; + + if (entry->symndx == -1) + { + struct elf_link_hash_entry *h = entry->d.h; + struct frvfdpic_relocs_info *oentry; + + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *)h->root.u.i.link; + + if (entry->d.h == h) + return 1; + + oentry = frvfdpic_relocs_info_for_global (*htab, 0, h, entry->addend, + NO_INSERT); + + if (oentry) + { + /* Merge the two entries. */ + frvfdpic_pic_merge_early_relocs_info (oentry, entry); + htab_clear_slot (*htab, entryp); + return 1; + } + + entry->d.h = h; + + /* If we can't find this entry with the new bfd hash, re-insert + it, and get the traversal restarted. */ + if (! htab_find (*htab, entry)) + { + htab_clear_slot (*htab, entryp); + entryp = htab_find_slot (*htab, entry, INSERT); + if (! *entryp) + *entryp = entry; + /* Abort the traversal, since the whole table may have + moved, and leave it up to the parent to restart the + process. */ + *(htab_t *)p = NULL; + return 0; + } + } + + return 1; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +elf32_frvfdpic_size_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) +{ + bfd *dynobj; + asection *s; + struct _frvfdpic_dynamic_got_plt_info gpinfo; + bfd_signed_vma odd; + bfd_vma limit; + + dynobj = elf_hash_table (info)->dynobj; + BFD_ASSERT (dynobj != NULL); + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (info->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER; + } + } + + memset (&gpinfo, 0, sizeof (gpinfo)); + gpinfo.g.info = info; + + for (;;) + { + htab_t relocs = frvfdpic_relocs_info (info); + + htab_traverse (relocs, _frvfdpic_resolve_final_relocs_info, &relocs); + + if (relocs == frvfdpic_relocs_info (info)) + break; + } + + htab_traverse (frvfdpic_relocs_info (info), _frvfdpic_count_got_plt_entries, + &gpinfo.g); + + odd = 12; + /* Compute the total size taken by entries in the 12-bit and 16-bit + ranges, to tell how many PLT function descriptors we can bring + into the 12-bit range without causing the 16-bit range to + overflow. */ + limit = odd + gpinfo.g.got12 + gpinfo.g.gotlos + + gpinfo.g.fd12 + gpinfo.g.fdlos; + if (limit < (bfd_vma)1 << 16) + limit = ((bfd_vma)1 << 16) - limit; + else + limit = 0; + if (gpinfo.g.fdplt < limit) + limit = gpinfo.g.fdplt; + + /* Determine the ranges of GOT offsets that we can use for each + range of addressing modes. */ + odd = _frvfdpic_compute_got_alloc_data (&gpinfo.got12, + 0, + odd, + 16, + gpinfo.g.got12, + gpinfo.g.fd12, + limit, + (bfd_vma)1 << (12-1)); + odd = _frvfdpic_compute_got_alloc_data (&gpinfo.gotlos, + gpinfo.got12.min, + odd, + gpinfo.got12.max, + gpinfo.g.gotlos, + gpinfo.g.fdlos, + gpinfo.g.fdplt - gpinfo.got12.fdplt, + (bfd_vma)1 << (16-1)); + odd = _frvfdpic_compute_got_alloc_data (&gpinfo.gothilo, + gpinfo.gotlos.min, + odd, + gpinfo.gotlos.max, + gpinfo.g.gothilo, + gpinfo.g.fdhilo, + gpinfo.g.fdplt - gpinfo.got12.fdplt + - gpinfo.gotlos.fdplt, + (bfd_vma)1 << (32-1)); + + /* Now assign (most) GOT offsets. */ + htab_traverse (frvfdpic_relocs_info (info), _frvfdpic_assign_got_entries, + &gpinfo); + + frvfdpic_got_section (info)->_raw_size = gpinfo.gothilo.max + - gpinfo.gothilo.min + /* If an odd word is the last word of the GOT, we don't need this + word to be part of the GOT. */ + - (odd + 4 == gpinfo.gothilo.max ? 4 : 0); + if (frvfdpic_got_section (info)->_raw_size == 0) + frvfdpic_got_section (info)->flags |= SEC_EXCLUDE; + else if (frvfdpic_got_section (info)->_raw_size == 12 + && ! elf_hash_table (info)->dynamic_sections_created) + { + frvfdpic_got_section (info)->flags |= SEC_EXCLUDE; + frvfdpic_got_section (info)->_raw_size = 0; + } + else + { + frvfdpic_got_section (info)->contents = + (bfd_byte *) bfd_zalloc (dynobj, + frvfdpic_got_section (info)->_raw_size); + if (frvfdpic_got_section (info)->contents == NULL) + return FALSE; + } + + if (elf_hash_table (info)->dynamic_sections_created) + /* Subtract the number of lzplt entries, since those will generate + relocations in the pltrel section. */ + frvfdpic_gotrel_section (info)->_raw_size = + (gpinfo.g.relocs - gpinfo.g.lzplt / 8) + * get_elf_backend_data (output_bfd)->s->sizeof_rel; + else + BFD_ASSERT (gpinfo.g.relocs == 0); + if (frvfdpic_gotrel_section (info)->_raw_size == 0) + frvfdpic_gotrel_section (info)->flags |= SEC_EXCLUDE; + else + { + frvfdpic_gotrel_section (info)->contents = + (bfd_byte *) bfd_zalloc (dynobj, + frvfdpic_gotrel_section (info)->_raw_size); + if (frvfdpic_gotrel_section (info)->contents == NULL) + return FALSE; + } + + frvfdpic_gotfixup_section (info)->_raw_size = (gpinfo.g.fixups + 1) * 4; + if (frvfdpic_gotfixup_section (info)->_raw_size == 0) + frvfdpic_gotfixup_section (info)->flags |= SEC_EXCLUDE; + else + { + frvfdpic_gotfixup_section (info)->contents = + (bfd_byte *) bfd_zalloc (dynobj, + frvfdpic_gotfixup_section (info)->_raw_size); + if (frvfdpic_gotfixup_section (info)->contents == NULL) + return FALSE; + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + frvfdpic_pltrel_section (info)->_raw_size = + gpinfo.g.lzplt / 8 * get_elf_backend_data (output_bfd)->s->sizeof_rel; + if (frvfdpic_pltrel_section (info)->_raw_size == 0) + frvfdpic_pltrel_section (info)->flags |= SEC_EXCLUDE; + else + { + frvfdpic_pltrel_section (info)->contents = + (bfd_byte *) bfd_zalloc (dynobj, + frvfdpic_pltrel_section (info) + ->_raw_size); + if (frvfdpic_pltrel_section (info)->contents == NULL) + return FALSE; + } + } + + /* Add 4 bytes for every block of at most 65535 lazy PLT entries, + such that there's room for the additional instruction needed to + call the resolver. Since _frvfdpic_assign_got_entries didn't + account for them, our block size is 4 bytes smaller than the real + block size. */ + if (elf_hash_table (info)->dynamic_sections_created) + { + frvfdpic_plt_section (info)->_raw_size = gpinfo.g.lzplt + + ((gpinfo.g.lzplt + (FRVFDPIC_LZPLT_BLOCK_SIZE - 4) - 8) + / (FRVFDPIC_LZPLT_BLOCK_SIZE - 4) * 4); + } + + /* Reset it, such that _frvfdpic_assign_plt_entries() can use it to + actually assign lazy PLT entries addresses. */ + gpinfo.g.lzplt = 0; + + /* Save information that we're going to need to generate GOT and PLT + entries. */ + frvfdpic_got_initial_offset (info) = -gpinfo.gothilo.min; + + if (get_elf_backend_data (output_bfd)->want_got_sym) + elf_hash_table (info)->hgot->root.u.def.value + += frvfdpic_got_initial_offset (info); + + if (elf_hash_table (info)->dynamic_sections_created) + frvfdpic_plt_initial_offset (info) = + frvfdpic_plt_section (info)->_raw_size; + + htab_traverse (frvfdpic_relocs_info (info), _frvfdpic_assign_plt_entries, + &gpinfo); + + /* Allocate the PLT section contents only after + _frvfdpic_assign_plt_entries has a chance to add the size of the + non-lazy PLT entries. */ + if (elf_hash_table (info)->dynamic_sections_created) + { + if (frvfdpic_plt_section (info)->_raw_size == 0) + frvfdpic_plt_section (info)->flags |= SEC_EXCLUDE; + else + { + frvfdpic_plt_section (info)->contents = + (bfd_byte *) bfd_zalloc (dynobj, + frvfdpic_plt_section (info)->_raw_size); + if (frvfdpic_plt_section (info)->contents == NULL) + return FALSE; + } + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + if (frvfdpic_got_section (info)->_raw_size) + if (!_bfd_elf_add_dynamic_entry (info, DT_PLTGOT, 0)) + return FALSE; + + if (frvfdpic_pltrel_section (info)->_raw_size) + if (!_bfd_elf_add_dynamic_entry (info, DT_PLTRELSZ, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_PLTREL, DT_REL) + || !_bfd_elf_add_dynamic_entry (info, DT_JMPREL, 0)) + return FALSE; + + if (frvfdpic_gotrel_section (info)->_raw_size) + if (!_bfd_elf_add_dynamic_entry (info, DT_REL, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_RELSZ, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_RELENT, + sizeof (Elf32_External_Rel))) + return FALSE; + } + + return TRUE; +} + +static bfd_boolean +elf32_frvfdpic_always_size_sections (bfd *output_bfd, + struct bfd_link_info *info) +{ + if (!info->relocatable) + { + struct elf_link_hash_entry *h; + asection *sec; + + /* Force a PT_GNU_STACK segment to be created. */ + if (! elf_tdata (output_bfd)->stack_flags) + elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X; + + /* Define __stacksize if it's not defined yet. */ + h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize", + FALSE, FALSE, FALSE); + if (! h || h->root.type != bfd_link_hash_defined + || h->type != STT_OBJECT + || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + { + struct bfd_link_hash_entry *bh = NULL; + + if (!(_bfd_generic_link_add_one_symbol + (info, output_bfd, "__stacksize", + BSF_GLOBAL, bfd_abs_section_ptr, DEFAULT_STACK_SIZE, + (const char *) NULL, FALSE, + get_elf_backend_data (output_bfd)->collect, &bh))) + return FALSE; + + h = (struct elf_link_hash_entry *) bh; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; + } + + /* Create a stack section, and set its alignment. */ + sec = bfd_make_section (output_bfd, ".stack"); + + if (sec == NULL + || ! bfd_set_section_alignment (output_bfd, sec, 3)) + return FALSE; + } + + return TRUE; +} + +static bfd_boolean +elf32_frvfdpic_modify_segment_map (bfd *output_bfd, + struct bfd_link_info *info) +{ + struct elf_segment_map *m; + + /* objcopy and strip preserve what's already there using + elf32_frvfdpic_copy_private_bfd_data (). */ + if (! info) + return TRUE; + + for (m = elf_tdata (output_bfd)->segment_map; m != NULL; m = m->next) + if (m->p_type == PT_GNU_STACK) + break; + + if (m) + { + asection *sec = bfd_get_section_by_name (output_bfd, ".stack"); + struct elf_link_hash_entry *h; + + if (sec) + { + /* Obtain the pointer to the __stacksize symbol. */ + h = elf_link_hash_lookup (elf_hash_table (info), "__stacksize", + FALSE, FALSE, FALSE); + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *)h->root.u.i.link; + BFD_ASSERT (h->root.type == bfd_link_hash_defined); + + /* Set the section size from the symbol value. We + intentionally ignore the symbol section. */ + if (h->root.type == bfd_link_hash_defined) + sec->_raw_size = h->root.u.def.value; + else + sec->_raw_size = DEFAULT_STACK_SIZE; + + /* Add the stack section to the PT_GNU_STACK segment, + such that its size and alignment requirements make it + to the segment. */ + m->sections[m->count] = sec; + m->count++; + } + } + + return TRUE; +} + +/* Fill in code and data in dynamic sections. */ + +static bfd_boolean +elf32_frv_finish_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) +{ + /* Nothing to be done for non-FDPIC. */ + return TRUE; +} + +static bfd_boolean +elf32_frvfdpic_finish_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) +{ + bfd *dynobj; + asection *sdyn; + + dynobj = elf_hash_table (info)->dynobj; + + if (frvfdpic_got_section (info)) + { + BFD_ASSERT (frvfdpic_gotrel_section (info)->_raw_size + == (frvfdpic_gotrel_section (info)->reloc_count + * sizeof (Elf32_External_Rel))); + + if (frvfdpic_gotfixup_section (info)) + { + struct elf_link_hash_entry *hgot = elf_hash_table (info)->hgot; + bfd_vma got_value = hgot->root.u.def.value + + hgot->root.u.def.section->output_section->vma + + hgot->root.u.def.section->output_offset; + + _frvfdpic_add_rofixup (output_bfd, frvfdpic_gotfixup_section (info), + got_value, 0); + + if (frvfdpic_gotfixup_section (info)->_raw_size + != (frvfdpic_gotfixup_section (info)->reloc_count * 4)) + { + (*_bfd_error_handler) + ("LINKER BUG: .rofixup section size mismatch"); + return FALSE; + } + } + } + if (elf_hash_table (info)->dynamic_sections_created) + { + BFD_ASSERT (frvfdpic_pltrel_section (info)->_raw_size + == (frvfdpic_pltrel_section (info)->reloc_count + * sizeof (Elf32_External_Rel))); + } + + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (elf_hash_table (info)->dynamic_sections_created) + { + Elf32_External_Dyn * dyncon; + Elf32_External_Dyn * dynconend; + + BFD_ASSERT (sdyn != NULL); + + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + + bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + break; + + case DT_PLTGOT: + dyn.d_un.d_ptr = frvfdpic_got_section (info)->output_section->vma + + frvfdpic_got_section (info)->output_offset + + frvfdpic_got_initial_offset (info); + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_JMPREL: + dyn.d_un.d_ptr = frvfdpic_pltrel_section (info) + ->output_section->vma + + frvfdpic_pltrel_section (info)->output_offset; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_PLTRELSZ: + if (frvfdpic_pltrel_section (info)->_cooked_size != 0) + dyn.d_un.d_val = frvfdpic_pltrel_section (info)->_cooked_size; + else + dyn.d_un.d_val = frvfdpic_pltrel_section (info)->_raw_size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + } + } + } + + return TRUE; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. */ + +static bfd_boolean +elf32_frvfdpic_adjust_dynamic_symbol +(struct bfd_link_info *info ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED) +{ + bfd * dynobj; + + dynobj = elf_hash_table (info)->dynobj; + + /* Make sure we know what is going on here. */ + BFD_ASSERT (dynobj != NULL + && (h->weakdef != NULL + || ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_REF_REGULAR) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))); + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + } + + return TRUE; +} + +/* Perform any actions needed for dynamic symbols. */ + +static bfd_boolean +elf32_frvfdpic_finish_dynamic_symbol +(bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED, + Elf_Internal_Sym *sym ATTRIBUTE_UNUSED) +{ + return TRUE; +} + +/* Decide whether to attempt to turn absptr or lsda encodings in + shared libraries into pcrel within the given input section. */ + +static bfd_boolean +frvfdpic_elf_use_relative_eh_frame +(bfd *input_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *eh_frame_section ATTRIBUTE_UNUSED) +{ + /* We can't use PC-relative encodings in FDPIC binaries, in general. */ + return FALSE; +} + +/* Adjust the contents of an eh_frame_hdr section before they're output. */ + +static bfd_byte +frvfdpic_elf_encode_eh_address (bfd *abfd, + struct bfd_link_info *info, + asection *osec, bfd_vma offset, + asection *loc_sec, bfd_vma loc_offset, + bfd_vma *encoded) +{ + struct elf_link_hash_entry *h; + + h = elf_hash_table (info)->hgot; + BFD_ASSERT (h && h->root.type == bfd_link_hash_defined); + + if (! h || (_frvfdpic_osec_to_segment (abfd, osec) + == _frvfdpic_osec_to_segment (abfd, loc_sec->output_section))) + return _bfd_elf_encode_eh_address (abfd, info, osec, offset, + loc_sec, loc_offset, encoded); + + BFD_ASSERT (_frvfdpic_osec_to_segment (abfd, osec) + == (_frvfdpic_osec_to_segment + (abfd, h->root.u.def.section->output_section))); + + *encoded = osec->vma + offset + - (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + + return DW_EH_PE_datarel | DW_EH_PE_sdata4; +} + +/* Look through the relocs for a section during the first phase. + + Besides handling virtual table relocs for gc, we have to deal with + all sorts of PIC-related relocations. We describe below the + general plan on how to handle such relocations, even though we only + collect information at this point, storing them in hash tables for + perusal of later passes. + + 32 relocations are propagated to the linker output when creating + position-independent output. LO16 and HI16 relocations are not + supposed to be encountered in this case. + + LABEL16 should always be resolvable by the linker, since it's only + used by branches. + + LABEL24, on the other hand, is used by calls. If it turns out that + the target of a call is a dynamic symbol, a PLT entry must be + created for it, which triggers the creation of a private function + descriptor and, unless lazy binding is disabled, a lazy PLT entry. + + GPREL relocations require the referenced symbol to be in the same + segment as _gp, but this can only be checked later. + + All GOT, GOTOFF and FUNCDESC relocations require a .got section to + exist. LABEL24 might as well, since it may require a PLT entry, + that will require a got. + + Non-FUNCDESC GOT relocations require a GOT entry to be created + regardless of whether the symbol is dynamic. However, since a + global symbol that turns out to not be exported may have the same + address of a non-dynamic symbol, we don't assign GOT entries at + this point, such that we can share them in this case. A relocation + for the GOT entry always has to be created, be it to offset a + private symbol by the section load address, be it to get the symbol + resolved dynamically. + + FUNCDESC GOT relocations require a GOT entry to be created, and + handled as if a FUNCDESC relocation was applied to the GOT entry in + an object file. + + FUNCDESC relocations referencing a symbol that turns out to NOT be + dynamic cause a private function descriptor to be created. The + FUNCDESC relocation then decays to a 32 relocation that points at + the private descriptor. If the symbol is dynamic, the FUNCDESC + relocation is propagated to the linker output, such that the + dynamic linker creates the canonical descriptor, pointing to the + dynamically-resolved definition of the function. + + Non-FUNCDESC GOTOFF relocations must always refer to non-dynamic + symbols that are assigned to the same segment as the GOT, but we + can only check this later, after we know the complete set of + symbols defined and/or exported. + + FUNCDESC GOTOFF relocations require a function descriptor to be + created and, unless lazy binding is disabled or the symbol is not + dynamic, a lazy PLT entry. Since we can't tell at this point + whether a symbol is going to be dynamic, we have to decide later + whether to create a lazy PLT entry or bind the descriptor directly + to the private function. + + FUNCDESC_VALUE relocations are not supposed to be present in object + files, but they may very well be simply propagated to the linker + output, since they have no side effect. + + + A function descriptor always requires a FUNCDESC_VALUE relocation. + Whether it's in .plt.rel or not depends on whether lazy binding is + enabled and on whether the referenced symbol is dynamic. + + The existence of a lazy PLT requires the resolverStub lazy PLT + entry to be present. + + + As for assignment of GOT, PLT and lazy PLT entries, and private + descriptors, we might do them all sequentially, but we can do + better than that. For example, we can place GOT entries and + private function descriptors referenced using 12-bit operands + closer to the PIC register value, such that these relocations don't + overflow. Those that are only referenced with LO16 relocations + could come next, but we may as well place PLT-required function + descriptors in the 12-bit range to make them shorter. Symbols + referenced with LO16/HI16 may come next, but we may place + additional function descriptors in the 16-bit range if we can + reliably tell that we've already placed entries that are ever + referenced with only LO16. PLT entries are therefore generated as + small as possible, while not introducing relocation overflows in + GOT or FUNCDESC_GOTOFF relocations. Lazy PLT entries could be + generated before or after PLT entries, but not intermingled with + them, such that we can have more lazy PLT entries in range for a + branch to the resolverStub. The resolverStub should be emitted at + the most distant location from the first lazy PLT entry such that + it's still in range for a branch, or closer, if there isn't a need + for so many lazy PLT entries. Additional lazy PLT entries may be + emitted after the resolverStub, as long as branches are still in + range. If the branch goes out of range, longer lazy PLT entries + are emitted. + + We could further optimize PLT and lazy PLT entries by giving them + priority in assignment to closer-to-gr17 locations depending on the + number of occurrences of references to them (assuming a function + that's called more often is more important for performance, so its + PLT entry should be faster), or taking hints from the compiler. + Given infinite time and money... :-) */ + +static bfd_boolean +elf32_frv_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + bfd *dynobj; + struct frvfdpic_relocs_info *picrel; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + dynobj = elf_hash_table (info)->dynobj; + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_FRV_GOT12: + case R_FRV_GOTHI: + case R_FRV_GOTLO: + case R_FRV_FUNCDESC_GOT12: + case R_FRV_FUNCDESC_GOTHI: + case R_FRV_FUNCDESC_GOTLO: + case R_FRV_GOTOFF12: + case R_FRV_GOTOFFHI: + case R_FRV_GOTOFFLO: + case R_FRV_FUNCDESC_GOTOFF12: + case R_FRV_FUNCDESC_GOTOFFHI: + case R_FRV_FUNCDESC_GOTOFFLO: + case R_FRV_FUNCDESC: + case R_FRV_FUNCDESC_VALUE: + if (! IS_FDPIC (abfd)) + goto bad_reloc; + /* Fall through. */ + case R_FRV_GPREL12: + case R_FRV_GPRELU12: + case R_FRV_GPRELHI: + case R_FRV_GPRELLO: + case R_FRV_LABEL24: + case R_FRV_32: + if (! dynobj) + { + elf_hash_table (info)->dynobj = dynobj = abfd; + if (! _frv_create_got_section (abfd, info)) + return FALSE; + } + if (! IS_FDPIC (abfd)) + { + picrel = NULL; + break; + } + if (h != NULL) + { + if (h->dynindx == -1) + switch (ELF_ST_VISIBILITY (h->other)) + { + case STV_INTERNAL: + case STV_HIDDEN: + break; + default: + bfd_elf_link_record_dynamic_symbol (info, h); + break; + } + picrel + = frvfdpic_relocs_info_for_global (frvfdpic_relocs_info (info), + abfd, h, + rel->r_addend, INSERT); + } + else + picrel = frvfdpic_relocs_info_for_local (frvfdpic_relocs_info + (info), abfd, r_symndx, + rel->r_addend, INSERT); + if (! picrel) + return FALSE; + break; + + default: + picrel = NULL; + break; + } + + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_FRV_LABEL24: + if (IS_FDPIC (abfd)) + picrel->call = 1; + break; + + case R_FRV_FUNCDESC_VALUE: + picrel->relocsfdv++; + if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + picrel->relocs32--; + /* Fall through. */ + + case R_FRV_32: + if (! IS_FDPIC (abfd)) + break; + + picrel->sym = 1; + if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + picrel->relocs32++; + break; + + case R_FRV_GOT12: + picrel->got12 = 1; + break; + + case R_FRV_GOTHI: + case R_FRV_GOTLO: + picrel->gothilo = 1; + break; + + case R_FRV_FUNCDESC_GOT12: + picrel->fdgot12 = 1; + break; + + case R_FRV_FUNCDESC_GOTHI: + case R_FRV_FUNCDESC_GOTLO: + picrel->fdgothilo = 1; + break; + + case R_FRV_GOTOFF12: + case R_FRV_GOTOFFHI: + case R_FRV_GOTOFFLO: + picrel->gotoff = 1; + break; + + case R_FRV_FUNCDESC_GOTOFF12: + picrel->fdgoff12 = 1; + break; + + case R_FRV_FUNCDESC_GOTOFFHI: + case R_FRV_FUNCDESC_GOTOFFLO: + picrel->fdgoffhilo = 1; + break; + + case R_FRV_FUNCDESC: + picrel->fd = 1; + picrel->relocsfd++; + break; + + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_FRV_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_FRV_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + + case R_FRV_LABEL16: + case R_FRV_LO16: + case R_FRV_HI16: + case R_FRV_GPREL12: + case R_FRV_GPRELU12: + case R_FRV_GPREL32: + case R_FRV_GPRELHI: + case R_FRV_GPRELLO: + break; + + default: + bad_reloc: + (*_bfd_error_handler) + (_("%s: unsupported relocation type %i"), + bfd_archive_filename (abfd), ELF32_R_TYPE (rel->r_info)); + return FALSE; + } + } + + return TRUE; +} + + +/* Return the machine subcode from the ELF e_flags header. */ + +static int +elf32_frv_machine (abfd) + bfd *abfd; +{ + switch (elf_elfheader (abfd)->e_flags & EF_FRV_CPU_MASK) + { + default: break; + case EF_FRV_CPU_FR550: return bfd_mach_fr550; + case EF_FRV_CPU_FR500: return bfd_mach_fr500; + case EF_FRV_CPU_FR400: return bfd_mach_fr400; + case EF_FRV_CPU_FR300: return bfd_mach_fr300; + case EF_FRV_CPU_SIMPLE: return bfd_mach_frvsimple; + case EF_FRV_CPU_TOMCAT: return bfd_mach_frvtomcat; + } + + return bfd_mach_frv; +} + +/* Set the right machine number for a FRV ELF file. */ + +static bfd_boolean +elf32_frv_object_p (abfd) + bfd *abfd; +{ + bfd_default_set_arch_mach (abfd, bfd_arch_frv, elf32_frv_machine (abfd)); + return (((elf_elfheader (abfd)->e_flags & EF_FRV_FDPIC) != 0) + == (IS_FDPIC (abfd))); +} + +/* Function to set the ELF flag bits. */ + +static bfd_boolean +frv_elf_set_private_flags (abfd, flags) + bfd *abfd; + flagword flags; +{ + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + return TRUE; +} + +/* Copy backend specific data from one object module to another. */ + +static bfd_boolean +frv_elf_copy_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + BFD_ASSERT (!elf_flags_init (obfd) + || elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags); + + elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; + elf_flags_init (obfd) = TRUE; + return TRUE; +} + +static bfd_boolean +elf32_frvfdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd) +{ + unsigned i; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + if (! frv_elf_copy_private_bfd_data (ibfd, obfd)) + return FALSE; + + if (! elf_tdata (ibfd) || ! elf_tdata (ibfd)->phdr + || ! elf_tdata (obfd) || ! elf_tdata (obfd)->phdr) + return TRUE; + + /* Copy the stack size. */ + for (i = 0; i < elf_elfheader (ibfd)->e_phnum; i++) + if (elf_tdata (ibfd)->phdr[i].p_type == PT_GNU_STACK) + { + Elf_Internal_Phdr *iphdr = &elf_tdata (ibfd)->phdr[i]; + + for (i = 0; i < elf_elfheader (obfd)->e_phnum; i++) + if (elf_tdata (obfd)->phdr[i].p_type == PT_GNU_STACK) + { + memcpy (&elf_tdata (obfd)->phdr[i], iphdr, sizeof (*iphdr)); + + /* Rewrite the phdrs, since we're only called after they + were first written. */ + if (bfd_seek (obfd, (bfd_signed_vma) get_elf_backend_data (obfd) + ->s->sizeof_ehdr, SEEK_SET) != 0 + || get_elf_backend_data (obfd)->s + ->write_out_phdrs (obfd, elf_tdata (obfd)->phdr, + elf_elfheader (obfd)->e_phnum) != 0) + return FALSE; + break; + } + + break; + } + + return TRUE; +} + +/* Merge backend specific data from an object file to the output + object file when linking. */ + +static bfd_boolean +frv_elf_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + flagword old_flags, old_partial; + flagword new_flags, new_partial; + bfd_boolean error = FALSE; + char new_opt[80]; + char old_opt[80]; + + new_opt[0] = old_opt[0] = '\0'; + new_flags = elf_elfheader (ibfd)->e_flags; + old_flags = elf_elfheader (obfd)->e_flags; + + if (new_flags & EF_FRV_FDPIC) + new_flags &= ~EF_FRV_PIC; + +#ifdef DEBUG + (*_bfd_error_handler) ("old_flags = 0x%.8lx, new_flags = 0x%.8lx, init = %s, filename = %s", + old_flags, new_flags, elf_flags_init (obfd) ? "yes" : "no", + bfd_get_filename (ibfd)); +#endif + + if (!elf_flags_init (obfd)) /* First call, no flags set. */ + { + elf_flags_init (obfd) = TRUE; + old_flags = new_flags; + } + + else if (new_flags == old_flags) /* Compatible flags are ok. */ + ; + + else /* Possibly incompatible flags. */ + { + /* Warn if different # of gprs are used. Note, 0 means nothing is + said about the size of gprs. */ + new_partial = (new_flags & EF_FRV_GPR_MASK); + old_partial = (old_flags & EF_FRV_GPR_MASK); + if (new_partial == old_partial) + ; + + else if (new_partial == 0) + ; + + else if (old_partial == 0) + old_flags |= new_partial; + + else + { + switch (new_partial) + { + default: strcat (new_opt, " -mgpr-??"); break; + case EF_FRV_GPR_32: strcat (new_opt, " -mgpr-32"); break; + case EF_FRV_GPR_64: strcat (new_opt, " -mgpr-64"); break; + } + + switch (old_partial) + { + default: strcat (old_opt, " -mgpr-??"); break; + case EF_FRV_GPR_32: strcat (old_opt, " -mgpr-32"); break; + case EF_FRV_GPR_64: strcat (old_opt, " -mgpr-64"); break; + } + } + + /* Warn if different # of fprs are used. Note, 0 means nothing is + said about the size of fprs. */ + new_partial = (new_flags & EF_FRV_FPR_MASK); + old_partial = (old_flags & EF_FRV_FPR_MASK); + if (new_partial == old_partial) + ; + + else if (new_partial == 0) + ; + + else if (old_partial == 0) + old_flags |= new_partial; + + else + { + switch (new_partial) + { + default: strcat (new_opt, " -mfpr-?"); break; + case EF_FRV_FPR_32: strcat (new_opt, " -mfpr-32"); break; + case EF_FRV_FPR_64: strcat (new_opt, " -mfpr-64"); break; + case EF_FRV_FPR_NONE: strcat (new_opt, " -msoft-float"); break; + } + + switch (old_partial) + { + default: strcat (old_opt, " -mfpr-?"); break; + case EF_FRV_FPR_32: strcat (old_opt, " -mfpr-32"); break; + case EF_FRV_FPR_64: strcat (old_opt, " -mfpr-64"); break; + case EF_FRV_FPR_NONE: strcat (old_opt, " -msoft-float"); break; + } + } + + /* Warn if different dword support was used. Note, 0 means nothing is + said about the dword support. */ + new_partial = (new_flags & EF_FRV_DWORD_MASK); + old_partial = (old_flags & EF_FRV_DWORD_MASK); + if (new_partial == old_partial) + ; + + else if (new_partial == 0) + ; + + else if (old_partial == 0) + old_flags |= new_partial; + + else + { + switch (new_partial) + { + default: strcat (new_opt, " -mdword-?"); break; + case EF_FRV_DWORD_YES: strcat (new_opt, " -mdword"); break; + case EF_FRV_DWORD_NO: strcat (new_opt, " -mno-dword"); break; + } + + switch (old_partial) + { + default: strcat (old_opt, " -mdword-?"); break; + case EF_FRV_DWORD_YES: strcat (old_opt, " -mdword"); break; + case EF_FRV_DWORD_NO: strcat (old_opt, " -mno-dword"); break; + } + } + + /* Or in flags that accumulate (ie, if one module uses it, mark that the + feature is used. */ + old_flags |= new_flags & (EF_FRV_DOUBLE + | EF_FRV_MEDIA + | EF_FRV_MULADD + | EF_FRV_NON_PIC_RELOCS); + + /* If any module was compiled without -G0, clear the G0 bit. */ + old_flags = ((old_flags & ~ EF_FRV_G0) + | (old_flags & new_flags & EF_FRV_G0)); + + /* If any module was compiled without -mnopack, clear the mnopack bit. */ + old_flags = ((old_flags & ~ EF_FRV_NOPACK) + | (old_flags & new_flags & EF_FRV_NOPACK)); + + /* We don't have to do anything if the pic flags are the same, or the new + module(s) were compiled with -mlibrary-pic. */ + new_partial = (new_flags & EF_FRV_PIC_FLAGS); + old_partial = (old_flags & EF_FRV_PIC_FLAGS); + if ((new_partial == old_partial) || ((new_partial & EF_FRV_LIBPIC) != 0)) + ; + + /* If the old module(s) were compiled with -mlibrary-pic, copy in the pic + flags if any from the new module. */ + else if ((old_partial & EF_FRV_LIBPIC) != 0) + old_flags = (old_flags & ~ EF_FRV_PIC_FLAGS) | new_partial; + + /* If we have mixtures of -fpic and -fPIC, or in both bits. */ + else if (new_partial != 0 && old_partial != 0) + old_flags |= new_partial; + + /* One module was compiled for pic and the other was not, see if we have + had any relocations that are not pic-safe. */ + else + { + if ((old_flags & EF_FRV_NON_PIC_RELOCS) == 0) + old_flags |= new_partial; + else + { + old_flags &= ~ EF_FRV_PIC_FLAGS; +#ifndef FRV_NO_PIC_ERROR + error = TRUE; + (*_bfd_error_handler) + (_("%s: compiled with %s and linked with modules that use non-pic relocations"), + bfd_get_filename (ibfd), + (new_flags & EF_FRV_BIGPIC) ? "-fPIC" : "-fpic"); +#endif + } + } + + /* Warn if different cpu is used (allow a specific cpu to override + the generic cpu). */ + new_partial = (new_flags & EF_FRV_CPU_MASK); + old_partial = (old_flags & EF_FRV_CPU_MASK); + if (new_partial == old_partial) + ; + + else if (new_partial == EF_FRV_CPU_GENERIC) + ; + + else if (old_partial == EF_FRV_CPU_GENERIC) + old_flags = (old_flags & ~EF_FRV_CPU_MASK) | new_partial; + + else + { + switch (new_partial) + { + default: strcat (new_opt, " -mcpu=?"); break; + case EF_FRV_CPU_GENERIC: strcat (new_opt, " -mcpu=frv"); break; + case EF_FRV_CPU_SIMPLE: strcat (new_opt, " -mcpu=simple"); break; + case EF_FRV_CPU_FR550: strcat (new_opt, " -mcpu=fr550"); break; + case EF_FRV_CPU_FR500: strcat (new_opt, " -mcpu=fr500"); break; + case EF_FRV_CPU_FR400: strcat (new_opt, " -mcpu=fr400"); break; + case EF_FRV_CPU_FR300: strcat (new_opt, " -mcpu=fr300"); break; + case EF_FRV_CPU_TOMCAT: strcat (new_opt, " -mcpu=tomcat"); break; + } + + switch (old_partial) + { + default: strcat (old_opt, " -mcpu=?"); break; + case EF_FRV_CPU_GENERIC: strcat (old_opt, " -mcpu=frv"); break; + case EF_FRV_CPU_SIMPLE: strcat (old_opt, " -mcpu=simple"); break; + case EF_FRV_CPU_FR550: strcat (old_opt, " -mcpu=fr550"); break; + case EF_FRV_CPU_FR500: strcat (old_opt, " -mcpu=fr500"); break; + case EF_FRV_CPU_FR400: strcat (old_opt, " -mcpu=fr400"); break; + case EF_FRV_CPU_FR300: strcat (old_opt, " -mcpu=fr300"); break; + case EF_FRV_CPU_TOMCAT: strcat (old_opt, " -mcpu=tomcat"); break; + } + } + + /* Print out any mismatches from above. */ + if (new_opt[0]) + { + error = TRUE; + (*_bfd_error_handler) + (_("%s: compiled with %s and linked with modules compiled with %s"), + bfd_get_filename (ibfd), new_opt, old_opt); + } + + /* Warn about any other mismatches */ + new_partial = (new_flags & ~ EF_FRV_ALL_FLAGS); + old_partial = (old_flags & ~ EF_FRV_ALL_FLAGS); + if (new_partial != old_partial) + { + old_flags |= new_partial; + error = TRUE; + (*_bfd_error_handler) + (_("%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%lx)"), + bfd_get_filename (ibfd), (long)new_partial, (long)old_partial); + } + } + + /* If the cpu is -mcpu=simple, then set the -mnopack bit. */ + if ((old_flags & EF_FRV_CPU_MASK) == EF_FRV_CPU_SIMPLE) + old_flags |= EF_FRV_NOPACK; + + /* Update the old flags now with changes made above. */ + old_partial = elf_elfheader (obfd)->e_flags & EF_FRV_CPU_MASK; + elf_elfheader (obfd)->e_flags = old_flags; + if (old_partial != (old_flags & EF_FRV_CPU_MASK)) + bfd_default_set_arch_mach (obfd, bfd_arch_frv, elf32_frv_machine (obfd)); + + if (((new_flags & EF_FRV_FDPIC) == 0) + != (! IS_FDPIC (ibfd))) + { + error = TRUE; + if (IS_FDPIC (obfd)) + (*_bfd_error_handler) + (_("%s: cannot link non-fdpic object file into fdpic executable"), + bfd_get_filename (ibfd)); + else + (*_bfd_error_handler) + (_("%s: cannot link fdpic object file into non-fdpic executable"), + bfd_get_filename (ibfd)); + } + + if (error) + bfd_set_error (bfd_error_bad_value); + + return !error; +} + + +bfd_boolean +frv_elf_print_private_bfd_data (abfd, ptr) + bfd *abfd; + PTR ptr; +{ + FILE *file = (FILE *) ptr; + flagword flags; + + BFD_ASSERT (abfd != NULL && ptr != NULL); + + /* Print normal ELF private data. */ + _bfd_elf_print_private_bfd_data (abfd, ptr); + + flags = elf_elfheader (abfd)->e_flags; + fprintf (file, _("private flags = 0x%lx:"), (long)flags); + + switch (flags & EF_FRV_CPU_MASK) + { + default: break; + case EF_FRV_CPU_SIMPLE: fprintf (file, " -mcpu=simple"); break; + case EF_FRV_CPU_FR550: fprintf (file, " -mcpu=fr550"); break; + case EF_FRV_CPU_FR500: fprintf (file, " -mcpu=fr500"); break; + case EF_FRV_CPU_FR400: fprintf (file, " -mcpu=fr400"); break; + case EF_FRV_CPU_FR300: fprintf (file, " -mcpu=fr300"); break; + case EF_FRV_CPU_TOMCAT: fprintf (file, " -mcpu=tomcat"); break; + } + + switch (flags & EF_FRV_GPR_MASK) + { + default: break; + case EF_FRV_GPR_32: fprintf (file, " -mgpr-32"); break; + case EF_FRV_GPR_64: fprintf (file, " -mgpr-64"); break; + } + + switch (flags & EF_FRV_FPR_MASK) + { + default: break; + case EF_FRV_FPR_32: fprintf (file, " -mfpr-32"); break; + case EF_FRV_FPR_64: fprintf (file, " -mfpr-64"); break; + case EF_FRV_FPR_NONE: fprintf (file, " -msoft-float"); break; + } + + switch (flags & EF_FRV_DWORD_MASK) + { + default: break; + case EF_FRV_DWORD_YES: fprintf (file, " -mdword"); break; + case EF_FRV_DWORD_NO: fprintf (file, " -mno-dword"); break; + } + + if (flags & EF_FRV_DOUBLE) + fprintf (file, " -mdouble"); + + if (flags & EF_FRV_MEDIA) + fprintf (file, " -mmedia"); + + if (flags & EF_FRV_MULADD) + fprintf (file, " -mmuladd"); + + if (flags & EF_FRV_PIC) + fprintf (file, " -fpic"); + + if (flags & EF_FRV_BIGPIC) + fprintf (file, " -fPIC"); + + if (flags & EF_FRV_LIBPIC) + fprintf (file, " -mlibrary-pic"); + + if (flags & EF_FRV_FDPIC) + fprintf (file, " -mfdpic"); + + if (flags & EF_FRV_NON_PIC_RELOCS) + fprintf (file, " non-pic relocations"); + + if (flags & EF_FRV_G0) + fprintf (file, " -G0"); + + fputc ('\n', file); + return TRUE; +} + + +#define ELF_ARCH bfd_arch_frv +#define ELF_MACHINE_CODE EM_CYGNUS_FRV +#define ELF_MAXPAGESIZE 0x1000 + +#define TARGET_BIG_SYM bfd_elf32_frv_vec +#define TARGET_BIG_NAME "elf32-frv" + +#define elf_info_to_howto frv_info_to_howto_rela +#define elf_backend_relocate_section elf32_frv_relocate_section +#define elf_backend_gc_mark_hook elf32_frv_gc_mark_hook +#define elf_backend_gc_sweep_hook elf32_frv_gc_sweep_hook +#define elf_backend_check_relocs elf32_frv_check_relocs +#define elf_backend_object_p elf32_frv_object_p +#define elf_backend_add_symbol_hook elf32_frv_add_symbol_hook + +#define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 + +#define bfd_elf32_bfd_reloc_type_lookup frv_reloc_type_lookup +#define bfd_elf32_bfd_set_private_flags frv_elf_set_private_flags +#define bfd_elf32_bfd_copy_private_bfd_data frv_elf_copy_private_bfd_data +#define bfd_elf32_bfd_merge_private_bfd_data frv_elf_merge_private_bfd_data +#define bfd_elf32_bfd_print_private_bfd_data frv_elf_print_private_bfd_data + +#define elf_backend_want_got_sym 1 +#define elf_backend_got_header_size 0 +#define elf_backend_want_got_plt 0 +#define elf_backend_plt_readonly 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_plt_header_size 0 + +#define elf_backend_finish_dynamic_sections \ + elf32_frv_finish_dynamic_sections + +#include "elf32-target.h" + +#undef ELF_MAXPAGESIZE +#define ELF_MAXPAGESIZE 0x4000 + +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_frvfdpic_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-frvfdpic" +#undef elf32_bed +#define elf32_bed elf32_frvfdpic_bed + +#undef elf_info_to_howto_rel +#define elf_info_to_howto_rel frvfdpic_info_to_howto_rel + +#undef bfd_elf32_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_create \ + frvfdpic_elf_link_hash_table_create +#undef elf_backend_always_size_sections +#define elf_backend_always_size_sections \ + elf32_frvfdpic_always_size_sections +#undef elf_backend_modify_segment_map +#define elf_backend_modify_segment_map \ + elf32_frvfdpic_modify_segment_map +#undef bfd_elf32_bfd_copy_private_bfd_data +#define bfd_elf32_bfd_copy_private_bfd_data \ + elf32_frvfdpic_copy_private_bfd_data + +#undef elf_backend_create_dynamic_sections +#define elf_backend_create_dynamic_sections \ + elf32_frvfdpic_create_dynamic_sections +#undef elf_backend_adjust_dynamic_symbol +#define elf_backend_adjust_dynamic_symbol \ + elf32_frvfdpic_adjust_dynamic_symbol +#undef elf_backend_size_dynamic_sections +#define elf_backend_size_dynamic_sections \ + elf32_frvfdpic_size_dynamic_sections +#undef elf_backend_finish_dynamic_symbol +#define elf_backend_finish_dynamic_symbol \ + elf32_frvfdpic_finish_dynamic_symbol +#undef elf_backend_finish_dynamic_sections +#define elf_backend_finish_dynamic_sections \ + elf32_frvfdpic_finish_dynamic_sections + +#undef elf_backend_can_make_relative_eh_frame +#define elf_backend_can_make_relative_eh_frame \ + frvfdpic_elf_use_relative_eh_frame +#undef elf_backend_can_make_lsda_relative_eh_frame +#define elf_backend_can_make_lsda_relative_eh_frame \ + frvfdpic_elf_use_relative_eh_frame +#undef elf_backend_encode_eh_address +#define elf_backend_encode_eh_address \ + frvfdpic_elf_encode_eh_address + +#undef elf_backend_may_use_rel_p +#define elf_backend_may_use_rel_p 1 +#undef elf_backend_may_use_rela_p +#define elf_backend_may_use_rela_p 1 +/* We use REL for dynamic relocations only. */ +#undef elf_backend_default_use_rela_p +#define elf_backend_default_use_rela_p 1 + +#include "elf32-target.h" diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c new file mode 100644 index 0000000000000..877da8a6a3185 --- /dev/null +++ b/bfd/elf32-h8300.c @@ -0,0 +1,1577 @@ +/* BFD back-end for Renesas H8/300 ELF binaries. + Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/h8.h" + +static reloc_howto_type *elf32_h8_reloc_type_lookup + (bfd *abfd, bfd_reloc_code_real_type code); +static void elf32_h8_info_to_howto + (bfd *, arelent *, Elf_Internal_Rela *); +static void elf32_h8_info_to_howto_rel + (bfd *, arelent *, Elf_Internal_Rela *); +static unsigned long elf32_h8_mach (flagword); +static void elf32_h8_final_write_processing (bfd *, bfd_boolean); +static bfd_boolean elf32_h8_object_p (bfd *); +static bfd_boolean elf32_h8_merge_private_bfd_data (bfd *, bfd *); +static bfd_boolean elf32_h8_relax_section + (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); +static bfd_boolean elf32_h8_relax_delete_bytes + (bfd *, asection *, bfd_vma, int); +static bfd_boolean elf32_h8_symbol_address_p (bfd *, asection *, bfd_vma); +static bfd_byte *elf32_h8_get_relocated_section_contents + (bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, bfd_boolean, asymbol **); +static asection *elf32_h8_gc_mark_hook + (asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *); +static bfd_boolean elf32_h8_gc_sweep_hook + (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); +static bfd_reloc_status_type elf32_h8_final_link_relocate + (unsigned long, bfd *, bfd *, asection *, + bfd_byte *, bfd_vma, bfd_vma, bfd_vma, + struct bfd_link_info *, asection *, int); +static bfd_boolean elf32_h8_relocate_section + (bfd *, struct bfd_link_info *, bfd *, asection *, + bfd_byte *, Elf_Internal_Rela *, + Elf_Internal_Sym *, asection **); +static bfd_reloc_status_type special + (bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **); + +/* This does not include any relocation information, but should be + good enough for GDB or objdump to read the file. */ + +static reloc_howto_type h8_elf_howto_table[] = { +#define R_H8_NONE_X 0 + HOWTO (R_H8_NONE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + special, /* special_function */ + "R_H8_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ +#define R_H8_DIR32_X (R_H8_NONE_X + 1) + HOWTO (R_H8_DIR32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + special, /* special_function */ + "R_H8_DIR32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +#define R_H8_DIR16_X (R_H8_DIR32_X + 1) + HOWTO (R_H8_DIR16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + special, /* special_function */ + "R_H8_DIR16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +#define R_H8_DIR8_X (R_H8_DIR16_X + 1) + HOWTO (R_H8_DIR8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + special, /* special_function */ + "R_H8_DIR8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x000000ff, /* dst_mask */ + FALSE), /* pcrel_offset */ +#define R_H8_DIR16A8_X (R_H8_DIR8_X + 1) + HOWTO (R_H8_DIR16A8, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + special, /* special_function */ + "R_H8_DIR16A8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +#define R_H8_DIR16R8_X (R_H8_DIR16A8_X + 1) + HOWTO (R_H8_DIR16R8, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + special, /* special_function */ + "R_H8_DIR16R8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +#define R_H8_DIR24A8_X (R_H8_DIR16R8_X + 1) + HOWTO (R_H8_DIR24A8, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + special, /* special_function */ + "R_H8_DIR24A8", /* name */ + TRUE, /* partial_inplace */ + 0xff000000, /* src_mask */ + 0x00ffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +#define R_H8_DIR24R8_X (R_H8_DIR24A8_X + 1) + HOWTO (R_H8_DIR24R8, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + special, /* special_function */ + "R_H8_DIR24R8", /* name */ + TRUE, /* partial_inplace */ + 0xff000000, /* src_mask */ + 0x00ffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +#define R_H8_DIR32A16_X (R_H8_DIR24R8_X + 1) + HOWTO (R_H8_DIR32A16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + special, /* special_function */ + "R_H8_DIR32A16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +#define R_H8_PCREL16_X (R_H8_DIR32A16_X + 1) + HOWTO (R_H8_PCREL16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + special, /* special_function */ + "R_H8_PCREL16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ +#define R_H8_PCREL8_X (R_H8_PCREL16_X + 1) + HOWTO (R_H8_PCREL8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + special, /* special_function */ + "R_H8_PCREL8", /* name */ + FALSE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ +}; + +/* This structure is used to map BFD reloc codes to H8 ELF relocs. */ + +struct elf_reloc_map { + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char howto_index; +}; + +/* An array mapping BFD reloc codes to H8 ELF relocs. */ + +static const struct elf_reloc_map h8_reloc_map[] = { + { BFD_RELOC_NONE, R_H8_NONE_X }, + { BFD_RELOC_32, R_H8_DIR32_X }, + { BFD_RELOC_16, R_H8_DIR16_X }, + { BFD_RELOC_8, R_H8_DIR8_X }, + { BFD_RELOC_H8_DIR16A8, R_H8_DIR16A8_X }, + { BFD_RELOC_H8_DIR16R8, R_H8_DIR16R8_X }, + { BFD_RELOC_H8_DIR24A8, R_H8_DIR24A8_X }, + { BFD_RELOC_H8_DIR24R8, R_H8_DIR24R8_X }, + { BFD_RELOC_H8_DIR32A16, R_H8_DIR32A16_X }, + { BFD_RELOC_16_PCREL, R_H8_PCREL16_X }, + { BFD_RELOC_8_PCREL, R_H8_PCREL8_X }, +}; + + +static reloc_howto_type * +elf32_h8_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + unsigned int i; + + for (i = 0; i < sizeof (h8_reloc_map) / sizeof (struct elf_reloc_map); i++) + { + if (h8_reloc_map[i].bfd_reloc_val == code) + return &h8_elf_howto_table[(int) h8_reloc_map[i].howto_index]; + } + return NULL; +} + +static void +elf32_h8_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *bfd_reloc, + Elf_Internal_Rela *elf_reloc) +{ + unsigned int r; + unsigned int i; + + r = ELF32_R_TYPE (elf_reloc->r_info); + for (i = 0; i < sizeof (h8_elf_howto_table) / sizeof (reloc_howto_type); i++) + if (h8_elf_howto_table[i].type == r) + { + bfd_reloc->howto = &h8_elf_howto_table[i]; + return; + } + abort (); +} + +static void +elf32_h8_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, arelent *bfd_reloc, + Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED) +{ + unsigned int r; + + abort (); + r = ELF32_R_TYPE (elf_reloc->r_info); + bfd_reloc->howto = &h8_elf_howto_table[r]; +} + +/* Special handling for H8/300 relocs. + We only come here for pcrel stuff and return normally if not an -r link. + When doing -r, we can't do any arithmetic for the pcrel stuff, because + we support relaxing on the H8/300 series chips. */ +static bfd_reloc_status_type +special (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry ATTRIBUTE_UNUSED, + asymbol *symbol ATTRIBUTE_UNUSED, + PTR data ATTRIBUTE_UNUSED, + asection *input_section ATTRIBUTE_UNUSED, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + if (output_bfd == (bfd *) NULL) + return bfd_reloc_continue; + + /* Adjust the reloc address to that in the output section. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; +} + +/* Perform a relocation as part of a final link. */ +static bfd_reloc_status_type +elf32_h8_final_link_relocate (unsigned long r_type, bfd *input_bfd, + bfd *output_bfd ATTRIBUTE_UNUSED, + asection *input_section ATTRIBUTE_UNUSED, + bfd_byte *contents, bfd_vma offset, + bfd_vma value, bfd_vma addend, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *sym_sec ATTRIBUTE_UNUSED, + int is_local ATTRIBUTE_UNUSED) +{ + bfd_byte *hit_data = contents + offset; + + switch (r_type) + { + case R_H8_NONE: + return bfd_reloc_ok; + + case R_H8_DIR32: + case R_H8_DIR32A16: + case R_H8_DIR24A8: + value += addend; + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_H8_DIR16: + case R_H8_DIR16A8: + case R_H8_DIR16R8: + value += addend; + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + /* AKA R_RELBYTE */ + case R_H8_DIR8: + value += addend; + + bfd_put_8 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_H8_DIR24R8: + value += addend; + + /* HIT_DATA is the address for the first byte for the relocated + value. Subtract 1 so that we can manipulate the data in 32-bit + hunks. */ + hit_data--; + + /* Clear out the top byte in value. */ + value &= 0xffffff; + + /* Retrieve the type byte for value from the section contents. */ + value |= (bfd_get_32 (input_bfd, hit_data) & 0xff000000); + + /* Now scribble it out in one 32-bit hunk. */ + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_H8_PCREL16: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + /* The value is relative to the start of the instruction, + not the relocation offset. Subtract 2 to account for + this minor issue. */ + value -= 2; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_H8_PCREL8: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + value += addend; + + /* The value is relative to the start of the instruction, + not the relocation offset. Subtract 1 to account for + this minor issue. */ + value -= 1; + + bfd_put_8 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + default: + return bfd_reloc_notsupported; + } +} + +/* Relocate an H8 ELF section. */ +static bfd_boolean +elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + bfd *input_bfd, asection *input_section, + bfd_byte *contents, Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + unsigned int r_type; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + + /* This is a final link. */ + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { + bfd_boolean unresolved_reloc, warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + } + + r = elf32_h8_final_link_relocate (r_type, input_bfd, output_bfd, + input_section, + contents, rel->r_offset, + relocation, rel->r_addend, + info, sec, h == NULL); + + if (r != bfd_reloc_ok) + { + const char *name; + const char *msg = (const char *) 0; + arelent bfd_reloc; + reloc_howto_type *howto; + + elf32_h8_info_to_howto (input_bfd, &bfd_reloc, rel); + howto = bfd_reloc.howto; + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL || *name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + switch (r) + { + case bfd_reloc_overflow: + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return FALSE; + break; + + case bfd_reloc_undefined: + if (! ((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, + rel->r_offset, TRUE))) + return FALSE; + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + goto common_error; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + goto common_error; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous error"); + goto common_error; + + default: + msg = _("internal error: unknown error"); + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, msg, name, input_bfd, input_section, + rel->r_offset))) + return FALSE; + break; + } + } + } + + return TRUE; +} + +/* Object files encode the specific H8 model they were compiled + for in the ELF flags field. + + Examine that field and return the proper BFD machine type for + the object file. */ +static unsigned long +elf32_h8_mach (flagword flags) +{ + switch (flags & EF_H8_MACH) + { + case E_H8_MACH_H8300: + default: + return bfd_mach_h8300; + + case E_H8_MACH_H8300H: + return bfd_mach_h8300h; + + case E_H8_MACH_H8300S: + return bfd_mach_h8300s; + + case E_H8_MACH_H8300HN: + return bfd_mach_h8300hn; + + case E_H8_MACH_H8300SN: + return bfd_mach_h8300sn; + + case E_H8_MACH_H8300SX: + return bfd_mach_h8300sx; + + case E_H8_MACH_H8300SXN: + return bfd_mach_h8300sxn; + } +} + +/* The final processing done just before writing out a H8 ELF object + file. We use this opportunity to encode the BFD machine type + into the flags field in the object file. */ + +static void +elf32_h8_final_write_processing (bfd *abfd, + bfd_boolean linker ATTRIBUTE_UNUSED) +{ + unsigned long val; + + switch (bfd_get_mach (abfd)) + { + default: + case bfd_mach_h8300: + val = E_H8_MACH_H8300; + break; + + case bfd_mach_h8300h: + val = E_H8_MACH_H8300H; + break; + + case bfd_mach_h8300s: + val = E_H8_MACH_H8300S; + break; + + case bfd_mach_h8300hn: + val = E_H8_MACH_H8300HN; + break; + + case bfd_mach_h8300sn: + val = E_H8_MACH_H8300SN; + break; + + case bfd_mach_h8300sx: + val = E_H8_MACH_H8300SX; + break; + + case bfd_mach_h8300sxn: + val = E_H8_MACH_H8300SXN; + break; + } + + elf_elfheader (abfd)->e_flags &= ~ (EF_H8_MACH); + elf_elfheader (abfd)->e_flags |= val; +} + +/* Return nonzero if ABFD represents a valid H8 ELF object file; also + record the encoded machine type found in the ELF flags. */ + +static bfd_boolean +elf32_h8_object_p (bfd *abfd) +{ + bfd_default_set_arch_mach (abfd, bfd_arch_h8300, + elf32_h8_mach (elf_elfheader (abfd)->e_flags)); + return TRUE; +} + +/* Merge backend specific data from an object file to the output + object file when linking. The only data we need to copy at this + time is the architecture/machine information. */ + +static bfd_boolean +elf32_h8_merge_private_bfd_data (bfd *ibfd, bfd *obfd) +{ + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) + && bfd_get_mach (obfd) < bfd_get_mach (ibfd)) + { + if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), + bfd_get_mach (ibfd))) + return FALSE; + } + + return TRUE; +} + +/* This function handles relaxing for the H8.. + + There are a few relaxing opportunities available on the H8: + + jmp/jsr:24 -> bra/bsr:8 2 bytes + The jmp may be completely eliminated if the previous insn is a + conditional branch to the insn after the jump. In that case + we invert the branch and delete the jump and save 4 bytes. + + bCC:16 -> bCC:8 2 bytes + bsr:16 -> bsr:8 2 bytes + + bset:16 -> bset:8 2 bytes + bset:24/32 -> bset:8 4 bytes + (also applicable to other bit manipulation instructions) + + mov.b:16 -> mov.b:8 2 bytes + mov.b:24/32 -> mov.b:8 4 bytes + + bset:24/32 -> bset:16 2 bytes + (also applicable to other bit manipulation instructions) + + mov.[bwl]:24/32 -> mov.[bwl]:16 2 bytes */ + +static bfd_boolean +elf32_h8_relax_section (bfd *abfd, asection *sec, + struct bfd_link_info *link_info, bfd_boolean *again) +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *contents = NULL; + Elf_Internal_Sym *isymbuf = NULL; + static asection *last_input_section = NULL; + static Elf_Internal_Rela *last_reloc = NULL; + + /* Assume nothing changes. */ + *again = FALSE; + + /* We don't have to do anything for a relocatable link, if + this section does not have relocs, or if this is not a + code section. */ + if (link_info->relocatable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0 + || (sec->flags & SEC_CODE) == 0) + return TRUE; + + /* If this is the first time we have been called for this section, + initialize the cooked size. */ + if (sec->_cooked_size == 0) + sec->_cooked_size = sec->_raw_size; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + /* Get a copy of the native relocations. */ + internal_relocs = (_bfd_elf_link_read_relocs + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + + if (sec != last_input_section) + last_reloc = NULL; + + last_input_section = sec; + + /* Walk through the relocs looking for relaxing opportunities. */ + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma symval; + + /* Keep track of the previous reloc so that we can delete + some long jumps created by the compiler. */ + if (irel != internal_relocs) + last_reloc = irel - 1; + + if (ELF32_R_TYPE (irel->r_info) != R_H8_DIR24R8 + && ELF32_R_TYPE (irel->r_info) != R_H8_PCREL16 + && ELF32_R_TYPE (irel->r_info) != R_H8_DIR16A8 + && ELF32_R_TYPE (irel->r_info) != R_H8_DIR24A8 + && ELF32_R_TYPE (irel->r_info) != R_H8_DIR32A16) + continue; + + /* Get the section contents if we haven't done so already. */ + if (contents == NULL) + { + /* Get cached copy if it exists. */ + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + /* Go get them off disk. */ + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + /* Read this BFD's local symbols if we haven't done so already. */ + if (isymbuf == NULL && symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + /* A local symbol. */ + Elf_Internal_Sym *isym; + asection *sym_sec; + + isym = isymbuf + ELF32_R_SYM (irel->r_info); + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + symval = isym->st_value; + /* If the reloc is absolute, it will not have + a symbol or section associated with it. */ + if (sym_sec) + symval += sym_sec->output_section->vma + + sym_sec->output_offset; + } + else + { + unsigned long indx; + struct elf_link_hash_entry *h; + + /* An external symbol. */ + indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + { + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + continue; + } + + symval = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + + /* For simplicity of coding, we are going to modify the section + contents, the section relocs, and the BFD symbol table. We + must tell the rest of the code not to free up this + information. It would be possible to instead create a table + of changes which have to be made, as is done in coff-mips.c; + that would be more work, but would require less memory when + the linker is run. */ + switch (ELF32_R_TYPE (irel->r_info)) + { + /* Try to turn a 24-bit absolute branch/call into an 8-bit + pc-relative branch/call. */ + case R_H8_DIR24R8: + { + bfd_vma value = symval + irel->r_addend; + bfd_vma dot, gap; + + /* Get the address of this instruction. */ + dot = (sec->output_section->vma + + sec->output_offset + irel->r_offset - 1); + + /* Compute the distance from this insn to the branch target. */ + gap = value - dot; + + /* If the distance is within -126..+130 inclusive, then we can + relax this jump. +130 is valid since the target will move + two bytes closer if we do relax this branch. */ + if ((int) gap >= -126 && (int) gap <= 130) + { + unsigned char code; + + /* Note that we've changed the relocs, section contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Get the instruction code being relaxed. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + /* If the previous instruction conditionally jumped around + this instruction, we may be able to reverse the condition + and redirect the previous instruction to the target of + this instruction. + + Such sequences are used by the compiler to deal with + long conditional branches. + + Only perform this optimisation for jumps (code 0x5a) not + subroutine calls, as otherwise it could transform: + + mov.w r0,r0 + beq .L1 + jsr @_bar + .L1: rts + _bar: rts + into: + mov.w r0,r0 + bne _bar + rts + _bar: rts + + which changes the call (jsr) into a branch (bne). */ + if (code == 0x5a + && (int) gap <= 130 + && (int) gap >= -128 + && last_reloc + && ELF32_R_TYPE (last_reloc->r_info) == R_H8_PCREL8 + && ELF32_R_SYM (last_reloc->r_info) < symtab_hdr->sh_info) + { + bfd_vma last_value; + asection *last_sym_sec; + Elf_Internal_Sym *last_sym; + + /* We will need to examine the symbol used by the + previous relocation. */ + + last_sym = isymbuf + ELF32_R_SYM (last_reloc->r_info); + last_sym_sec + = bfd_section_from_elf_index (abfd, last_sym->st_shndx); + last_value = (last_sym->st_value + + last_sym_sec->output_section->vma + + last_sym_sec->output_offset); + + /* Verify that the previous relocation was for a + branch around this instruction and that no symbol + exists at the current location. */ + if (last_value == dot + 4 + && last_reloc->r_offset + 2 == irel->r_offset + && ! elf32_h8_symbol_address_p (abfd, sec, dot)) + { + /* We can eliminate this jump. Twiddle the + previous relocation as necessary. */ + irel->r_info + = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + ELF32_R_TYPE (R_H8_NONE)); + + last_reloc->r_info + = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + ELF32_R_TYPE (R_H8_PCREL8)); + last_reloc->r_addend = irel->r_addend; + + code = bfd_get_8 (abfd, + contents + last_reloc->r_offset - 1); + code ^= 1; + bfd_put_8 (abfd, + code, + contents + last_reloc->r_offset - 1); + + /* Delete four bytes of data. */ + if (!elf32_h8_relax_delete_bytes (abfd, sec, + irel->r_offset - 1, + 4)) + goto error_return; + + *again = TRUE; + break; + } + } + + if (code == 0x5e) + /* This is jsr. */ + bfd_put_8 (abfd, 0x55, contents + irel->r_offset - 1); + else if (code == 0x5a) + /* This is jmp. */ + bfd_put_8 (abfd, 0x40, contents + irel->r_offset - 1); + else + abort (); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_H8_PCREL8); + + /* Delete two bytes of data. */ + if (!elf32_h8_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + break; + } + + /* Try to turn a 16-bit pc-relative branch into a 8-bit pc-relative + branch. */ + case R_H8_PCREL16: + { + bfd_vma value = symval + irel->r_addend; + bfd_vma dot; + bfd_vma gap; + + /* Get the address of this instruction. */ + dot = (sec->output_section->vma + + sec->output_offset + + irel->r_offset - 2); + + gap = value - dot; + + /* If the distance is within -126..+130 inclusive, then we can + relax this jump. +130 is valid since the target will move + two bytes closer if we do relax this branch. */ + if ((int) gap >= -126 && (int) gap <= 130) + { + unsigned char code; + + /* Note that we've changed the relocs, section contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 2); + + if (code == 0x58) + { + /* bCC:16 -> bCC:8 */ + /* Get the second byte of the original insn, which + contains the condition code. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + /* Compute the fisrt byte of the relaxed + instruction. The original sequence 0x58 0xX0 + is relaxed to 0x4X, where X represents the + condition code. */ + code &= 0xf0; + code >>= 4; + code |= 0x40; + bfd_put_8 (abfd, code, contents + irel->r_offset - 2); + } + else if (code == 0x5c) + /* This is bsr. */ + bfd_put_8 (abfd, 0x55, contents + irel->r_offset - 2); + else + abort (); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_H8_PCREL8); + irel->r_offset--; + + /* Delete two bytes of data. */ + if (!elf32_h8_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + break; + } + + /* This is a 16-bit absolute address in one of the following + instructions: + + "band", "bclr", "biand", "bild", "bior", "bist", "bixor", + "bld", "bnot", "bor", "bset", "bst", "btst", "bxor", and + "mov.b" + + We may relax this into an 8-bit absolute address if it's in + the right range. */ + case R_H8_DIR16A8: + { + bfd_vma value; + + value = bfd_h8300_pad_address (abfd, symval + irel->r_addend); + if (value >= 0xffffff00u) + { + unsigned char code; + unsigned char temp_code; + + /* Note that we've changed the relocs, section contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 2); + + /* All instructions with R_H8_DIR16A8 start with + 0x6a. */ + if (code != 0x6a) + abort (); + + temp_code = code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + /* If this is a mov.b instruction, clear the lower + nibble, which contains the source/destination + register number. */ + if ((temp_code & 0x10) != 0x10) + temp_code &= 0xf0; + + switch (temp_code) + { + case 0x00: + /* This is mov.b @aa:16,Rd. */ + bfd_put_8 (abfd, (code & 0xf) | 0x20, + contents + irel->r_offset - 2); + break; + case 0x80: + /* This is mov.b Rs,@aa:16. */ + bfd_put_8 (abfd, (code & 0xf) | 0x30, + contents + irel->r_offset - 2); + break; + case 0x18: + /* This is a bit-maniputation instruction that + stores one bit into memory, one of "bclr", + "bist", "bnot", "bset", and "bst". */ + bfd_put_8 (abfd, 0x7f, contents + irel->r_offset - 2); + break; + case 0x10: + /* This is a bit-maniputation instruction that + loads one bit from memory, one of "band", + "biand", "bild", "bior", "bixor", "bld", "bor", + "btst", and "bxor". */ + bfd_put_8 (abfd, 0x7e, contents + irel->r_offset - 2); + break; + default: + abort (); + } + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_H8_DIR8); + + /* Move the relocation. */ + irel->r_offset--; + + /* Delete two bytes of data. */ + if (!elf32_h8_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + break; + } + + /* This is a 24-bit absolute address in one of the following + instructions: + + "band", "bclr", "biand", "bild", "bior", "bist", "bixor", + "bld", "bnot", "bor", "bset", "bst", "btst", "bxor", and + "mov.b" + + We may relax this into an 8-bit absolute address if it's in + the right range. */ + case R_H8_DIR24A8: + { + bfd_vma value; + + value = bfd_h8300_pad_address (abfd, symval + irel->r_addend); + if (value >= 0xffffff00u) + { + unsigned char code; + unsigned char temp_code; + + /* Note that we've changed the relocs, section contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 2); + + /* All instructions with R_H8_DIR24A8 start with + 0x6a. */ + if (code != 0x6a) + abort (); + + temp_code = code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + /* If this is a mov.b instruction, clear the lower + nibble, which contains the source/destination + register number. */ + if ((temp_code & 0x30) != 0x30) + temp_code &= 0xf0; + + switch (temp_code) + { + case 0x20: + /* This is mov.b @aa:24/32,Rd. */ + bfd_put_8 (abfd, (code & 0xf) | 0x20, + contents + irel->r_offset - 2); + break; + case 0xa0: + /* This is mov.b Rs,@aa:24/32. */ + bfd_put_8 (abfd, (code & 0xf) | 0x30, + contents + irel->r_offset - 2); + break; + case 0x38: + /* This is a bit-maniputation instruction that + stores one bit into memory, one of "bclr", + "bist", "bnot", "bset", and "bst". */ + bfd_put_8 (abfd, 0x7f, contents + irel->r_offset - 2); + break; + case 0x30: + /* This is a bit-maniputation instruction that + loads one bit from memory, one of "band", + "biand", "bild", "bior", "bixor", "bld", "bor", + "btst", and "bxor". */ + bfd_put_8 (abfd, 0x7e, contents + irel->r_offset - 2); + break; + default: + abort(); + } + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_H8_DIR8); + irel->r_offset--; + + /* Delete two bytes of data. */ + if (!elf32_h8_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 4)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + break; + } + } + + /* Fall through. */ + + /* This is a 24-/32-bit absolute address in one of the + following instructions: + + "band", "bclr", "biand", "bild", "bior", "bist", + "bixor", "bld", "bnot", "bor", "bset", "bst", "btst", + "bxor", "ldc.w", "stc.w" and "mov.[bwl]" + + We may relax this into an 16-bit absolute address if it's + in the right range. */ + case R_H8_DIR32A16: + { + bfd_vma value; + + value = bfd_h8300_pad_address (abfd, symval + irel->r_addend); + if (value <= 0x7fff || value >= 0xffff8000u) + { + unsigned char code; + + /* Note that we've changed the relocs, section contents, + etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + + /* Fix the opcode. For all the instructions that + belong to this relaxation, we simply need to turn + off bit 0x20 in the previous byte. */ + code &= ~0x20; + + bfd_put_8 (abfd, code, contents + irel->r_offset - 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_H8_DIR16); + + /* Delete two bytes of data. */ + if (!elf32_h8_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 2)) + goto error_return; + + /* That will change things, so, we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + } + break; + } + + default: + break; + } + } + + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + { + if (! link_info->keep_memory) + free (isymbuf); + else + symtab_hdr->contents = (unsigned char *) isymbuf; + } + + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + { + if (! link_info->keep_memory) + free (contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + } + + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + return TRUE; + + error_return: + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + free (contents); + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + return FALSE; +} + +/* Delete some bytes from a section while relaxing. */ + +static bfd_boolean +elf32_h8_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, int count) +{ + Elf_Internal_Shdr *symtab_hdr; + unsigned int sec_shndx; + bfd_byte *contents; + Elf_Internal_Rela *irel, *irelend; + Elf_Internal_Rela *irelalign; + Elf_Internal_Sym *isym; + Elf_Internal_Sym *isymend; + bfd_vma toaddr; + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry **end_hashes; + unsigned int symcount; + + sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + contents = elf_section_data (sec)->this_hdr.contents; + + /* The deletion must stop at the next ALIGN reloc for an aligment + power larger than the number of bytes we are deleting. */ + + irelalign = NULL; + toaddr = sec->_cooked_size; + + irel = elf_section_data (sec)->relocs; + irelend = irel + sec->reloc_count; + + /* Actually delete the bytes. */ + memmove (contents + addr, contents + addr + count, + (size_t) (toaddr - addr - count)); + sec->_cooked_size -= count; + + /* Adjust all the relocs. */ + for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) + { + /* Get the new reloc address. */ + if ((irel->r_offset > addr + && irel->r_offset < toaddr)) + irel->r_offset -= count; + } + + /* Adjust the local symbols defined in this section. */ + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + isym = (Elf_Internal_Sym *) symtab_hdr->contents; + isymend = isym + symtab_hdr->sh_info; + for (; isym < isymend; isym++) + { + if (isym->st_shndx == sec_shndx + && isym->st_value > addr + && isym->st_value < toaddr) + isym->st_value -= count; + } + + /* Now adjust the global symbols defined in this section. */ + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + sym_hashes = elf_sym_hashes (abfd); + end_hashes = sym_hashes + symcount; + for (; sym_hashes < end_hashes; sym_hashes++) + { + struct elf_link_hash_entry *sym_hash = *sym_hashes; + if ((sym_hash->root.type == bfd_link_hash_defined + || sym_hash->root.type == bfd_link_hash_defweak) + && sym_hash->root.u.def.section == sec + && sym_hash->root.u.def.value > addr + && sym_hash->root.u.def.value < toaddr) + { + sym_hash->root.u.def.value -= count; + } + } + + return TRUE; +} + +/* Return TRUE if a symbol exists at the given address, else return + FALSE. */ +static bfd_boolean +elf32_h8_symbol_address_p (bfd *abfd, asection *sec, bfd_vma addr) +{ + Elf_Internal_Shdr *symtab_hdr; + unsigned int sec_shndx; + Elf_Internal_Sym *isym; + Elf_Internal_Sym *isymend; + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry **end_hashes; + unsigned int symcount; + + sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + /* Examine all the symbols. */ + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + isym = (Elf_Internal_Sym *) symtab_hdr->contents; + isymend = isym + symtab_hdr->sh_info; + for (; isym < isymend; isym++) + { + if (isym->st_shndx == sec_shndx + && isym->st_value == addr) + return TRUE; + } + + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + sym_hashes = elf_sym_hashes (abfd); + end_hashes = sym_hashes + symcount; + for (; sym_hashes < end_hashes; sym_hashes++) + { + struct elf_link_hash_entry *sym_hash = *sym_hashes; + if ((sym_hash->root.type == bfd_link_hash_defined + || sym_hash->root.type == bfd_link_hash_defweak) + && sym_hash->root.u.def.section == sec + && sym_hash->root.u.def.value == addr) + return TRUE; + } + + return FALSE; +} + +/* This is a version of bfd_generic_get_relocated_section_contents + which uses elf32_h8_relocate_section. */ + +static bfd_byte * +elf32_h8_get_relocated_section_contents (bfd *output_bfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + bfd_boolean relocatable, + asymbol **symbols) +{ + Elf_Internal_Shdr *symtab_hdr; + asection *input_section = link_order->u.indirect.section; + bfd *input_bfd = input_section->owner; + asection **sections = NULL; + Elf_Internal_Rela *internal_relocs = NULL; + Elf_Internal_Sym *isymbuf = NULL; + + /* We only need to handle the case of relaxing, or of having a + particular set of section contents, specially. */ + if (relocatable + || elf_section_data (input_section)->this_hdr.contents == NULL) + return bfd_generic_get_relocated_section_contents (output_bfd, link_info, + link_order, data, + relocatable, + symbols); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + + memcpy (data, elf_section_data (input_section)->this_hdr.contents, + (size_t) input_section->_raw_size); + + if ((input_section->flags & SEC_RELOC) != 0 + && input_section->reloc_count > 0) + { + asection **secpp; + Elf_Internal_Sym *isym, *isymend; + bfd_size_type amt; + + internal_relocs = (_bfd_elf_link_read_relocs + (input_bfd, input_section, (PTR) NULL, + (Elf_Internal_Rela *) NULL, FALSE)); + if (internal_relocs == NULL) + goto error_return; + + if (symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + amt = symtab_hdr->sh_info; + amt *= sizeof (asection *); + sections = (asection **) bfd_malloc (amt); + if (sections == NULL && amt != 0) + goto error_return; + + isymend = isymbuf + symtab_hdr->sh_info; + for (isym = isymbuf, secpp = sections; isym < isymend; ++isym, ++secpp) + { + asection *isec; + + if (isym->st_shndx == SHN_UNDEF) + isec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + isec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + isec = bfd_com_section_ptr; + else + isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx); + + *secpp = isec; + } + + if (! elf32_h8_relocate_section (output_bfd, link_info, input_bfd, + input_section, data, internal_relocs, + isymbuf, sections)) + goto error_return; + + if (sections != NULL) + free (sections); + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (elf_section_data (input_section)->relocs != internal_relocs) + free (internal_relocs); + } + + return data; + + error_return: + if (sections != NULL) + free (sections); + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (internal_relocs != NULL + && elf_section_data (input_section)->relocs != internal_relocs) + free (internal_relocs); + return NULL; +} + +static asection * +elf32_h8_gc_mark_hook (asection *sec, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Rela *rel ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + if (h != NULL) + { + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + return NULL; +} + +static bfd_boolean +elf32_h8_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED) +{ + return TRUE; +} + + +#define TARGET_BIG_SYM bfd_elf32_h8300_vec +#define TARGET_BIG_NAME "elf32-h8300" +#define ELF_ARCH bfd_arch_h8300 +#define ELF_MACHINE_CODE EM_H8_300 +#define ELF_MAXPAGESIZE 0x1 +#define bfd_elf32_bfd_reloc_type_lookup elf32_h8_reloc_type_lookup +#define elf_info_to_howto elf32_h8_info_to_howto +#define elf_info_to_howto_rel elf32_h8_info_to_howto_rel + +/* So we can set/examine bits in e_flags to get the specific + H8 architecture in use. */ +#define elf_backend_final_write_processing \ + elf32_h8_final_write_processing +#define elf_backend_object_p \ + elf32_h8_object_p +#define bfd_elf32_bfd_merge_private_bfd_data \ + elf32_h8_merge_private_bfd_data +#define elf_backend_gc_mark_hook elf32_h8_gc_mark_hook +#define elf_backend_gc_sweep_hook elf32_h8_gc_sweep_hook + +/* ??? when elf_backend_relocate_section is not defined, elf32-target.h + defaults to using _bfd_generic_link_hash_table_create, but + bfd_elf_size_dynamic_sections uses + dynobj = elf_hash_table (info)->dynobj; + and thus requires an elf hash table. */ +#define bfd_elf32_bfd_link_hash_table_create _bfd_elf_link_hash_table_create + +/* Use an H8 specific linker, not the ELF generic linker. */ +#define elf_backend_relocate_section elf32_h8_relocate_section +#define elf_backend_rela_normal 1 +#define elf_backend_can_gc_sections 1 + +/* And relaxing stuff. */ +#define bfd_elf32_bfd_relax_section elf32_h8_relax_section +#define bfd_elf32_bfd_get_relocated_section_contents \ + elf32_h8_get_relocated_section_contents + + +#include "elf32-target.h" diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c new file mode 100644 index 0000000000000..54dbb9a62b989 --- /dev/null +++ b/bfd/elf32-hppa.c @@ -0,0 +1,4194 @@ +/* BFD back-end for HP PA-RISC ELF files. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001, + 2002, 2003, 2004 Free Software Foundation, Inc. + + Original code by + Center for Software Science + Department of Computer Science + University of Utah + Largely rewritten by Alan Modra + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/hppa.h" +#include "libhppa.h" +#include "elf32-hppa.h" +#define ARCH_SIZE 32 +#include "elf32-hppa.h" +#include "elf-hppa.h" + +/* In order to gain some understanding of code in this file without + knowing all the intricate details of the linker, note the + following: + + Functions named elf32_hppa_* are called by external routines, other + functions are only called locally. elf32_hppa_* functions appear + in this file more or less in the order in which they are called + from external routines. eg. elf32_hppa_check_relocs is called + early in the link process, elf32_hppa_finish_dynamic_sections is + one of the last functions. */ + +/* We use two hash tables to hold information for linking PA ELF objects. + + The first is the elf32_hppa_link_hash_table which is derived + from the standard ELF linker hash table. We use this as a place to + attach other hash tables and static information. + + The second is the stub hash table which is derived from the + base BFD hash table. The stub hash table holds the information + necessary to build the linker stubs during a link. + + There are a number of different stubs generated by the linker. + + Long branch stub: + : ldil LR'X,%r1 + : be,n RR'X(%sr4,%r1) + + PIC long branch stub: + : b,l .+8,%r1 + : addil LR'X - ($PIC_pcrel$0 - 4),%r1 + : be,n RR'X - ($PIC_pcrel$0 - 8)(%sr4,%r1) + + Import stub to call shared library routine from normal object file + (single sub-space version) + : addil LR'lt_ptr+ltoff,%dp ; get procedure entry point + : ldw RR'lt_ptr+ltoff(%r1),%r21 + : bv %r0(%r21) + : ldw RR'lt_ptr+ltoff+4(%r1),%r19 ; get new dlt value. + + Import stub to call shared library routine from shared library + (single sub-space version) + : addil LR'ltoff,%r19 ; get procedure entry point + : ldw RR'ltoff(%r1),%r21 + : bv %r0(%r21) + : ldw RR'ltoff+4(%r1),%r19 ; get new dlt value. + + Import stub to call shared library routine from normal object file + (multiple sub-space support) + : addil LR'lt_ptr+ltoff,%dp ; get procedure entry point + : ldw RR'lt_ptr+ltoff(%r1),%r21 + : ldw RR'lt_ptr+ltoff+4(%r1),%r19 ; get new dlt value. + : ldsid (%r21),%r1 + : mtsp %r1,%sr0 + : be 0(%sr0,%r21) ; branch to target + : stw %rp,-24(%sp) ; save rp + + Import stub to call shared library routine from shared library + (multiple sub-space support) + : addil LR'ltoff,%r19 ; get procedure entry point + : ldw RR'ltoff(%r1),%r21 + : ldw RR'ltoff+4(%r1),%r19 ; get new dlt value. + : ldsid (%r21),%r1 + : mtsp %r1,%sr0 + : be 0(%sr0,%r21) ; branch to target + : stw %rp,-24(%sp) ; save rp + + Export stub to return from shared lib routine (multiple sub-space support) + One of these is created for each exported procedure in a shared + library (and stored in the shared lib). Shared lib routines are + called via the first instruction in the export stub so that we can + do an inter-space return. Not required for single sub-space. + : bl,n X,%rp ; trap the return + : nop + : ldw -24(%sp),%rp ; restore the original rp + : ldsid (%rp),%r1 + : mtsp %r1,%sr0 + : be,n 0(%sr0,%rp) ; inter-space return. */ + +#define PLT_ENTRY_SIZE 8 +#define GOT_ENTRY_SIZE 4 +#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1" + +static const bfd_byte plt_stub[] = +{ + 0x0e, 0x80, 0x10, 0x96, /* 1: ldw 0(%r20),%r22 */ + 0xea, 0xc0, 0xc0, 0x00, /* bv %r0(%r22) */ + 0x0e, 0x88, 0x10, 0x95, /* ldw 4(%r20),%r21 */ +#define PLT_STUB_ENTRY (3*4) + 0xea, 0x9f, 0x1f, 0xdd, /* b,l 1b,%r20 */ + 0xd6, 0x80, 0x1c, 0x1e, /* depi 0,31,2,%r20 */ + 0x00, 0xc0, 0xff, 0xee, /* 9: .word fixup_func */ + 0xde, 0xad, 0xbe, 0xef /* .word fixup_ltp */ +}; + +/* Section name for stubs is the associated section name plus this + string. */ +#define STUB_SUFFIX ".stub" + +/* We don't need to copy certain PC- or GP-relative dynamic relocs + into a shared object's dynamic section. All the relocs of the + limited class we are interested in, are absolute. */ +#ifndef RELATIVE_DYNRELOCS +#define RELATIVE_DYNRELOCS 0 +#define IS_ABSOLUTE_RELOC(r_type) 1 +#endif + +/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid + copying dynamic variables from a shared lib into an app's dynbss + section, and instead use a dynamic relocation to point into the + shared lib. */ +#define ELIMINATE_COPY_RELOCS 1 + +enum elf32_hppa_stub_type { + hppa_stub_long_branch, + hppa_stub_long_branch_shared, + hppa_stub_import, + hppa_stub_import_shared, + hppa_stub_export, + hppa_stub_none +}; + +struct elf32_hppa_stub_hash_entry { + + /* Base hash table entry structure. */ + struct bfd_hash_entry root; + + /* The stub section. */ + asection *stub_sec; + + /* Offset within stub_sec of the beginning of this stub. */ + bfd_vma stub_offset; + + /* Given the symbol's value and its section we can determine its final + value when building the stubs (so the stub knows where to jump. */ + bfd_vma target_value; + asection *target_section; + + enum elf32_hppa_stub_type stub_type; + + /* The symbol table entry, if any, that this was derived from. */ + struct elf32_hppa_link_hash_entry *h; + + /* Where this stub is being called from, or, in the case of combined + stub sections, the first input section in the group. */ + asection *id_sec; +}; + +struct elf32_hppa_link_hash_entry { + + struct elf_link_hash_entry elf; + + /* A pointer to the most recently used stub hash entry against this + symbol. */ + struct elf32_hppa_stub_hash_entry *stub_cache; + + /* Used to count relocations for delayed sizing of relocation + sections. */ + struct elf32_hppa_dyn_reloc_entry { + + /* Next relocation in the chain. */ + struct elf32_hppa_dyn_reloc_entry *next; + + /* The input section of the reloc. */ + asection *sec; + + /* Number of relocs copied in this section. */ + bfd_size_type count; + +#if RELATIVE_DYNRELOCS + /* Number of relative relocs copied for the input section. */ + bfd_size_type relative_count; +#endif + } *dyn_relocs; + + /* Set if this symbol is used by a plabel reloc. */ + unsigned int plabel:1; +}; + +struct elf32_hppa_link_hash_table { + + /* The main hash table. */ + struct elf_link_hash_table elf; + + /* The stub hash table. */ + struct bfd_hash_table stub_hash_table; + + /* Linker stub bfd. */ + bfd *stub_bfd; + + /* Linker call-backs. */ + asection * (*add_stub_section) (const char *, asection *); + void (*layout_sections_again) (void); + + /* Array to keep track of which stub sections have been created, and + information on stub grouping. */ + struct map_stub { + /* This is the section to which stubs in the group will be + attached. */ + asection *link_sec; + /* The stub section. */ + asection *stub_sec; + } *stub_group; + + /* Assorted information used by elf32_hppa_size_stubs. */ + unsigned int bfd_count; + int top_index; + asection **input_list; + Elf_Internal_Sym **all_local_syms; + + /* Short-cuts to get to dynamic linker sections. */ + asection *sgot; + asection *srelgot; + asection *splt; + asection *srelplt; + asection *sdynbss; + asection *srelbss; + + /* Used during a final link to store the base of the text and data + segments so that we can perform SEGREL relocations. */ + bfd_vma text_segment_base; + bfd_vma data_segment_base; + + /* Whether we support multiple sub-spaces for shared libs. */ + unsigned int multi_subspace:1; + + /* Flags set when various size branches are detected. Used to + select suitable defaults for the stub group size. */ + unsigned int has_12bit_branch:1; + unsigned int has_17bit_branch:1; + unsigned int has_22bit_branch:1; + + /* Set if we need a .plt stub to support lazy dynamic linking. */ + unsigned int need_plt_stub:1; + + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; +}; + +/* Various hash macros and functions. */ +#define hppa_link_hash_table(p) \ + ((struct elf32_hppa_link_hash_table *) ((p)->hash)) + +#define hppa_stub_hash_lookup(table, string, create, copy) \ + ((struct elf32_hppa_stub_hash_entry *) \ + bfd_hash_lookup ((table), (string), (create), (copy))) + +/* Assorted hash table functions. */ + +/* Initialize an entry in the stub hash table. */ + +static struct bfd_hash_entry * +stub_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) +{ + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (entry == NULL) + { + entry = bfd_hash_allocate (table, + sizeof (struct elf32_hppa_stub_hash_entry)); + if (entry == NULL) + return entry; + } + + /* Call the allocation method of the superclass. */ + entry = bfd_hash_newfunc (entry, table, string); + if (entry != NULL) + { + struct elf32_hppa_stub_hash_entry *eh; + + /* Initialize the local fields. */ + eh = (struct elf32_hppa_stub_hash_entry *) entry; + eh->stub_sec = NULL; + eh->stub_offset = 0; + eh->target_value = 0; + eh->target_section = NULL; + eh->stub_type = hppa_stub_long_branch; + eh->h = NULL; + eh->id_sec = NULL; + } + + return entry; +} + +/* Initialize an entry in the link hash table. */ + +static struct bfd_hash_entry * +hppa_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) +{ + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (entry == NULL) + { + entry = bfd_hash_allocate (table, + sizeof (struct elf32_hppa_link_hash_entry)); + if (entry == NULL) + return entry; + } + + /* Call the allocation method of the superclass. */ + entry = _bfd_elf_link_hash_newfunc (entry, table, string); + if (entry != NULL) + { + struct elf32_hppa_link_hash_entry *eh; + + /* Initialize the local fields. */ + eh = (struct elf32_hppa_link_hash_entry *) entry; + eh->stub_cache = NULL; + eh->dyn_relocs = NULL; + eh->plabel = 0; + } + + return entry; +} + +/* Create the derived linker hash table. The PA ELF port uses the derived + hash table to keep information specific to the PA ELF linker (without + using static variables). */ + +static struct bfd_link_hash_table * +elf32_hppa_link_hash_table_create (bfd *abfd) +{ + struct elf32_hppa_link_hash_table *ret; + bfd_size_type amt = sizeof (*ret); + + ret = bfd_malloc (amt); + if (ret == NULL) + return NULL; + + if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, hppa_link_hash_newfunc)) + { + free (ret); + return NULL; + } + + /* Init the stub hash table too. */ + if (!bfd_hash_table_init (&ret->stub_hash_table, stub_hash_newfunc)) + return NULL; + + ret->stub_bfd = NULL; + ret->add_stub_section = NULL; + ret->layout_sections_again = NULL; + ret->stub_group = NULL; + ret->sgot = NULL; + ret->srelgot = NULL; + ret->splt = NULL; + ret->srelplt = NULL; + ret->sdynbss = NULL; + ret->srelbss = NULL; + ret->text_segment_base = (bfd_vma) -1; + ret->data_segment_base = (bfd_vma) -1; + ret->multi_subspace = 0; + ret->has_12bit_branch = 0; + ret->has_17bit_branch = 0; + ret->has_22bit_branch = 0; + ret->need_plt_stub = 0; + ret->sym_sec.abfd = NULL; + + return &ret->elf.root; +} + +/* Free the derived linker hash table. */ + +static void +elf32_hppa_link_hash_table_free (struct bfd_link_hash_table *hash) +{ + struct elf32_hppa_link_hash_table *ret + = (struct elf32_hppa_link_hash_table *) hash; + + bfd_hash_table_free (&ret->stub_hash_table); + _bfd_generic_link_hash_table_free (hash); +} + +/* Build a name for an entry in the stub hash table. */ + +static char * +hppa_stub_name (const asection *input_section, + const asection *sym_sec, + const struct elf32_hppa_link_hash_entry *hash, + const Elf_Internal_Rela *rel) +{ + char *stub_name; + bfd_size_type len; + + if (hash) + { + len = 8 + 1 + strlen (hash->elf.root.root.string) + 1 + 8 + 1; + stub_name = bfd_malloc (len); + if (stub_name != NULL) + { + sprintf (stub_name, "%08x_%s+%x", + input_section->id & 0xffffffff, + hash->elf.root.root.string, + (int) rel->r_addend & 0xffffffff); + } + } + else + { + len = 8 + 1 + 8 + 1 + 8 + 1 + 8 + 1; + stub_name = bfd_malloc (len); + if (stub_name != NULL) + { + sprintf (stub_name, "%08x_%x:%x+%x", + input_section->id & 0xffffffff, + sym_sec->id & 0xffffffff, + (int) ELF32_R_SYM (rel->r_info) & 0xffffffff, + (int) rel->r_addend & 0xffffffff); + } + } + return stub_name; +} + +/* Look up an entry in the stub hash. Stub entries are cached because + creating the stub name takes a bit of time. */ + +static struct elf32_hppa_stub_hash_entry * +hppa_get_stub_entry (const asection *input_section, + const asection *sym_sec, + struct elf32_hppa_link_hash_entry *hash, + const Elf_Internal_Rela *rel, + struct elf32_hppa_link_hash_table *htab) +{ + struct elf32_hppa_stub_hash_entry *stub_entry; + const asection *id_sec; + + /* If this input section is part of a group of sections sharing one + stub section, then use the id of the first section in the group. + Stub names need to include a section id, as there may well be + more than one stub used to reach say, printf, and we need to + distinguish between them. */ + id_sec = htab->stub_group[input_section->id].link_sec; + + if (hash != NULL && hash->stub_cache != NULL + && hash->stub_cache->h == hash + && hash->stub_cache->id_sec == id_sec) + { + stub_entry = hash->stub_cache; + } + else + { + char *stub_name; + + stub_name = hppa_stub_name (id_sec, sym_sec, hash, rel); + if (stub_name == NULL) + return NULL; + + stub_entry = hppa_stub_hash_lookup (&htab->stub_hash_table, + stub_name, FALSE, FALSE); + if (hash != NULL) + hash->stub_cache = stub_entry; + + free (stub_name); + } + + return stub_entry; +} + +/* Add a new stub entry to the stub hash. Not all fields of the new + stub entry are initialised. */ + +static struct elf32_hppa_stub_hash_entry * +hppa_add_stub (const char *stub_name, + asection *section, + struct elf32_hppa_link_hash_table *htab) +{ + asection *link_sec; + asection *stub_sec; + struct elf32_hppa_stub_hash_entry *stub_entry; + + link_sec = htab->stub_group[section->id].link_sec; + stub_sec = htab->stub_group[section->id].stub_sec; + if (stub_sec == NULL) + { + stub_sec = htab->stub_group[link_sec->id].stub_sec; + if (stub_sec == NULL) + { + size_t namelen; + bfd_size_type len; + char *s_name; + + namelen = strlen (link_sec->name); + len = namelen + sizeof (STUB_SUFFIX); + s_name = bfd_alloc (htab->stub_bfd, len); + if (s_name == NULL) + return NULL; + + memcpy (s_name, link_sec->name, namelen); + memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX)); + stub_sec = (*htab->add_stub_section) (s_name, link_sec); + if (stub_sec == NULL) + return NULL; + htab->stub_group[link_sec->id].stub_sec = stub_sec; + } + htab->stub_group[section->id].stub_sec = stub_sec; + } + + /* Enter this entry into the linker stub hash table. */ + stub_entry = hppa_stub_hash_lookup (&htab->stub_hash_table, stub_name, + TRUE, FALSE); + if (stub_entry == NULL) + { + (*_bfd_error_handler) (_("%s: cannot create stub entry %s"), + bfd_archive_filename (section->owner), + stub_name); + return NULL; + } + + stub_entry->stub_sec = stub_sec; + stub_entry->stub_offset = 0; + stub_entry->id_sec = link_sec; + return stub_entry; +} + +/* Determine the type of stub needed, if any, for a call. */ + +static enum elf32_hppa_stub_type +hppa_type_of_stub (asection *input_sec, + const Elf_Internal_Rela *rel, + struct elf32_hppa_link_hash_entry *hash, + bfd_vma destination, + struct bfd_link_info *info) +{ + bfd_vma location; + bfd_vma branch_offset; + bfd_vma max_branch_offset; + unsigned int r_type; + + if (hash != NULL + && hash->elf.plt.offset != (bfd_vma) -1 + && hash->elf.dynindx != -1 + && !hash->plabel + && (info->shared + || !(hash->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) + || hash->elf.root.type == bfd_link_hash_defweak)) + { + /* We need an import stub. Decide between hppa_stub_import + and hppa_stub_import_shared later. */ + return hppa_stub_import; + } + + /* Determine where the call point is. */ + location = (input_sec->output_offset + + input_sec->output_section->vma + + rel->r_offset); + + branch_offset = destination - location - 8; + r_type = ELF32_R_TYPE (rel->r_info); + + /* Determine if a long branch stub is needed. parisc branch offsets + are relative to the second instruction past the branch, ie. +8 + bytes on from the branch instruction location. The offset is + signed and counts in units of 4 bytes. */ + if (r_type == (unsigned int) R_PARISC_PCREL17F) + { + max_branch_offset = (1 << (17-1)) << 2; + } + else if (r_type == (unsigned int) R_PARISC_PCREL12F) + { + max_branch_offset = (1 << (12-1)) << 2; + } + else /* R_PARISC_PCREL22F. */ + { + max_branch_offset = (1 << (22-1)) << 2; + } + + if (branch_offset + max_branch_offset >= 2*max_branch_offset) + return hppa_stub_long_branch; + + return hppa_stub_none; +} + +/* Build one linker stub as defined by the stub hash table entry GEN_ENTRY. + IN_ARG contains the link info pointer. */ + +#define LDIL_R1 0x20200000 /* ldil LR'XXX,%r1 */ +#define BE_SR4_R1 0xe0202002 /* be,n RR'XXX(%sr4,%r1) */ + +#define BL_R1 0xe8200000 /* b,l .+8,%r1 */ +#define ADDIL_R1 0x28200000 /* addil LR'XXX,%r1,%r1 */ +#define DEPI_R1 0xd4201c1e /* depi 0,31,2,%r1 */ + +#define ADDIL_DP 0x2b600000 /* addil LR'XXX,%dp,%r1 */ +#define LDW_R1_R21 0x48350000 /* ldw RR'XXX(%sr0,%r1),%r21 */ +#define BV_R0_R21 0xeaa0c000 /* bv %r0(%r21) */ +#define LDW_R1_R19 0x48330000 /* ldw RR'XXX(%sr0,%r1),%r19 */ + +#define ADDIL_R19 0x2a600000 /* addil LR'XXX,%r19,%r1 */ +#define LDW_R1_DP 0x483b0000 /* ldw RR'XXX(%sr0,%r1),%dp */ + +#define LDSID_R21_R1 0x02a010a1 /* ldsid (%sr0,%r21),%r1 */ +#define MTSP_R1 0x00011820 /* mtsp %r1,%sr0 */ +#define BE_SR0_R21 0xe2a00000 /* be 0(%sr0,%r21) */ +#define STW_RP 0x6bc23fd1 /* stw %rp,-24(%sr0,%sp) */ + +#define BL22_RP 0xe800a002 /* b,l,n XXX,%rp */ +#define BL_RP 0xe8400002 /* b,l,n XXX,%rp */ +#define NOP 0x08000240 /* nop */ +#define LDW_RP 0x4bc23fd1 /* ldw -24(%sr0,%sp),%rp */ +#define LDSID_RP_R1 0x004010a1 /* ldsid (%sr0,%rp),%r1 */ +#define BE_SR0_RP 0xe0400002 /* be,n 0(%sr0,%rp) */ + +#ifndef R19_STUBS +#define R19_STUBS 1 +#endif + +#if R19_STUBS +#define LDW_R1_DLT LDW_R1_R19 +#else +#define LDW_R1_DLT LDW_R1_DP +#endif + +static bfd_boolean +hppa_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) +{ + struct elf32_hppa_stub_hash_entry *stub_entry; + struct bfd_link_info *info; + struct elf32_hppa_link_hash_table *htab; + asection *stub_sec; + bfd *stub_bfd; + bfd_byte *loc; + bfd_vma sym_value; + bfd_vma insn; + bfd_vma off; + int val; + int size; + + /* Massage our args to the form they really have. */ + stub_entry = (struct elf32_hppa_stub_hash_entry *) gen_entry; + info = in_arg; + + htab = hppa_link_hash_table (info); + stub_sec = stub_entry->stub_sec; + + /* Make a note of the offset within the stubs for this entry. */ + stub_entry->stub_offset = stub_sec->_raw_size; + loc = stub_sec->contents + stub_entry->stub_offset; + + stub_bfd = stub_sec->owner; + + switch (stub_entry->stub_type) + { + case hppa_stub_long_branch: + /* Create the long branch. A long branch is formed with "ldil" + loading the upper bits of the target address into a register, + then branching with "be" which adds in the lower bits. + The "be" has its delay slot nullified. */ + sym_value = (stub_entry->target_value + + stub_entry->target_section->output_offset + + stub_entry->target_section->output_section->vma); + + val = hppa_field_adjust (sym_value, 0, e_lrsel); + insn = hppa_rebuild_insn ((int) LDIL_R1, val, 21); + bfd_put_32 (stub_bfd, insn, loc); + + val = hppa_field_adjust (sym_value, 0, e_rrsel) >> 2; + insn = hppa_rebuild_insn ((int) BE_SR4_R1, val, 17); + bfd_put_32 (stub_bfd, insn, loc + 4); + + size = 8; + break; + + case hppa_stub_long_branch_shared: + /* Branches are relative. This is where we are going to. */ + sym_value = (stub_entry->target_value + + stub_entry->target_section->output_offset + + stub_entry->target_section->output_section->vma); + + /* And this is where we are coming from, more or less. */ + sym_value -= (stub_entry->stub_offset + + stub_sec->output_offset + + stub_sec->output_section->vma); + + bfd_put_32 (stub_bfd, (bfd_vma) BL_R1, loc); + val = hppa_field_adjust (sym_value, (bfd_signed_vma) -8, e_lrsel); + insn = hppa_rebuild_insn ((int) ADDIL_R1, val, 21); + bfd_put_32 (stub_bfd, insn, loc + 4); + + val = hppa_field_adjust (sym_value, (bfd_signed_vma) -8, e_rrsel) >> 2; + insn = hppa_rebuild_insn ((int) BE_SR4_R1, val, 17); + bfd_put_32 (stub_bfd, insn, loc + 8); + size = 12; + break; + + case hppa_stub_import: + case hppa_stub_import_shared: + off = stub_entry->h->elf.plt.offset; + if (off >= (bfd_vma) -2) + abort (); + + off &= ~ (bfd_vma) 1; + sym_value = (off + + htab->splt->output_offset + + htab->splt->output_section->vma + - elf_gp (htab->splt->output_section->owner)); + + insn = ADDIL_DP; +#if R19_STUBS + if (stub_entry->stub_type == hppa_stub_import_shared) + insn = ADDIL_R19; +#endif + val = hppa_field_adjust (sym_value, 0, e_lrsel), + insn = hppa_rebuild_insn ((int) insn, val, 21); + bfd_put_32 (stub_bfd, insn, loc); + + /* It is critical to use lrsel/rrsel here because we are using + two different offsets (+0 and +4) from sym_value. If we use + lsel/rsel then with unfortunate sym_values we will round + sym_value+4 up to the next 2k block leading to a mis-match + between the lsel and rsel value. */ + val = hppa_field_adjust (sym_value, 0, e_rrsel); + insn = hppa_rebuild_insn ((int) LDW_R1_R21, val, 14); + bfd_put_32 (stub_bfd, insn, loc + 4); + + if (htab->multi_subspace) + { + val = hppa_field_adjust (sym_value, (bfd_signed_vma) 4, e_rrsel); + insn = hppa_rebuild_insn ((int) LDW_R1_DLT, val, 14); + bfd_put_32 (stub_bfd, insn, loc + 8); + + bfd_put_32 (stub_bfd, (bfd_vma) LDSID_R21_R1, loc + 12); + bfd_put_32 (stub_bfd, (bfd_vma) MTSP_R1, loc + 16); + bfd_put_32 (stub_bfd, (bfd_vma) BE_SR0_R21, loc + 20); + bfd_put_32 (stub_bfd, (bfd_vma) STW_RP, loc + 24); + + size = 28; + } + else + { + bfd_put_32 (stub_bfd, (bfd_vma) BV_R0_R21, loc + 8); + val = hppa_field_adjust (sym_value, (bfd_signed_vma) 4, e_rrsel); + insn = hppa_rebuild_insn ((int) LDW_R1_DLT, val, 14); + bfd_put_32 (stub_bfd, insn, loc + 12); + + size = 16; + } + + break; + + case hppa_stub_export: + /* Branches are relative. This is where we are going to. */ + sym_value = (stub_entry->target_value + + stub_entry->target_section->output_offset + + stub_entry->target_section->output_section->vma); + + /* And this is where we are coming from. */ + sym_value -= (stub_entry->stub_offset + + stub_sec->output_offset + + stub_sec->output_section->vma); + + if (sym_value - 8 + (1 << (17 + 1)) >= (1 << (17 + 2)) + && (!htab->has_22bit_branch + || sym_value - 8 + (1 << (22 + 1)) >= (1 << (22 + 2)))) + { + (*_bfd_error_handler) + (_("%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"), + bfd_archive_filename (stub_entry->target_section->owner), + stub_sec->name, + (long) stub_entry->stub_offset, + stub_entry->root.string); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + val = hppa_field_adjust (sym_value, (bfd_signed_vma) -8, e_fsel) >> 2; + if (!htab->has_22bit_branch) + insn = hppa_rebuild_insn ((int) BL_RP, val, 17); + else + insn = hppa_rebuild_insn ((int) BL22_RP, val, 22); + bfd_put_32 (stub_bfd, insn, loc); + + bfd_put_32 (stub_bfd, (bfd_vma) NOP, loc + 4); + bfd_put_32 (stub_bfd, (bfd_vma) LDW_RP, loc + 8); + bfd_put_32 (stub_bfd, (bfd_vma) LDSID_RP_R1, loc + 12); + bfd_put_32 (stub_bfd, (bfd_vma) MTSP_R1, loc + 16); + bfd_put_32 (stub_bfd, (bfd_vma) BE_SR0_RP, loc + 20); + + /* Point the function symbol at the stub. */ + stub_entry->h->elf.root.u.def.section = stub_sec; + stub_entry->h->elf.root.u.def.value = stub_sec->_raw_size; + + size = 24; + break; + + default: + BFD_FAIL (); + return FALSE; + } + + stub_sec->_raw_size += size; + return TRUE; +} + +#undef LDIL_R1 +#undef BE_SR4_R1 +#undef BL_R1 +#undef ADDIL_R1 +#undef DEPI_R1 +#undef LDW_R1_R21 +#undef LDW_R1_DLT +#undef LDW_R1_R19 +#undef ADDIL_R19 +#undef LDW_R1_DP +#undef LDSID_R21_R1 +#undef MTSP_R1 +#undef BE_SR0_R21 +#undef STW_RP +#undef BV_R0_R21 +#undef BL_RP +#undef NOP +#undef LDW_RP +#undef LDSID_RP_R1 +#undef BE_SR0_RP + +/* As above, but don't actually build the stub. Just bump offset so + we know stub section sizes. */ + +static bfd_boolean +hppa_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) +{ + struct elf32_hppa_stub_hash_entry *stub_entry; + struct elf32_hppa_link_hash_table *htab; + int size; + + /* Massage our args to the form they really have. */ + stub_entry = (struct elf32_hppa_stub_hash_entry *) gen_entry; + htab = in_arg; + + if (stub_entry->stub_type == hppa_stub_long_branch) + size = 8; + else if (stub_entry->stub_type == hppa_stub_long_branch_shared) + size = 12; + else if (stub_entry->stub_type == hppa_stub_export) + size = 24; + else /* hppa_stub_import or hppa_stub_import_shared. */ + { + if (htab->multi_subspace) + size = 28; + else + size = 16; + } + + stub_entry->stub_sec->_raw_size += size; + return TRUE; +} + +/* Return nonzero if ABFD represents an HPPA ELF32 file. + Additionally we set the default architecture and machine. */ + +static bfd_boolean +elf32_hppa_object_p (bfd *abfd) +{ + Elf_Internal_Ehdr * i_ehdrp; + unsigned int flags; + + i_ehdrp = elf_elfheader (abfd); + if (strcmp (bfd_get_target (abfd), "elf32-hppa-linux") == 0) + { + /* GCC on hppa-linux produces binaries with OSABI=Linux, + but the kernel produces corefiles with OSABI=SysV. */ + if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_LINUX && + i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_NONE) /* aka SYSV */ + return FALSE; + } + else + { + if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_HPUX) + return FALSE; + } + + flags = i_ehdrp->e_flags; + switch (flags & (EF_PARISC_ARCH | EF_PARISC_WIDE)) + { + case EFA_PARISC_1_0: + return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 10); + case EFA_PARISC_1_1: + return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 11); + case EFA_PARISC_2_0: + return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 20); + case EFA_PARISC_2_0 | EF_PARISC_WIDE: + return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 25); + } + return TRUE; +} + +/* Create the .plt and .got sections, and set up our hash table + short-cuts to various dynamic sections. */ + +static bfd_boolean +elf32_hppa_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) +{ + struct elf32_hppa_link_hash_table *htab; + + /* Don't try to create the .plt and .got twice. */ + htab = hppa_link_hash_table (info); + if (htab->splt != NULL) + return TRUE; + + /* Call the generic code to do most of the work. */ + if (! _bfd_elf_create_dynamic_sections (abfd, info)) + return FALSE; + + htab->splt = bfd_get_section_by_name (abfd, ".plt"); + htab->srelplt = bfd_get_section_by_name (abfd, ".rela.plt"); + + htab->sgot = bfd_get_section_by_name (abfd, ".got"); + htab->srelgot = bfd_make_section (abfd, ".rela.got"); + if (htab->srelgot == NULL + || ! bfd_set_section_flags (abfd, htab->srelgot, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || ! bfd_set_section_alignment (abfd, htab->srelgot, 2)) + return FALSE; + + htab->sdynbss = bfd_get_section_by_name (abfd, ".dynbss"); + htab->srelbss = bfd_get_section_by_name (abfd, ".rela.bss"); + + return TRUE; +} + +/* Copy the extra info we tack onto an elf_link_hash_entry. */ + +static void +elf32_hppa_copy_indirect_symbol (const struct elf_backend_data *bed, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) +{ + struct elf32_hppa_link_hash_entry *edir, *eind; + + edir = (struct elf32_hppa_link_hash_entry *) dir; + eind = (struct elf32_hppa_link_hash_entry *) ind; + + if (eind->dyn_relocs != NULL) + { + if (edir->dyn_relocs != NULL) + { + struct elf32_hppa_dyn_reloc_entry **pp; + struct elf32_hppa_dyn_reloc_entry *p; + + if (ind->root.type == bfd_link_hash_indirect) + abort (); + + /* Add reloc counts against the weak sym to the strong sym + list. Merge any entries against the same section. */ + for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + { + struct elf32_hppa_dyn_reloc_entry *q; + + for (q = edir->dyn_relocs; q != NULL; q = q->next) + if (q->sec == p->sec) + { +#if RELATIVE_DYNRELOCS + q->relative_count += p->relative_count; +#endif + q->count += p->count; + *pp = p->next; + break; + } + if (q == NULL) + pp = &p->next; + } + *pp = edir->dyn_relocs; + } + + edir->dyn_relocs = eind->dyn_relocs; + eind->dyn_relocs = NULL; + } + + if (ELIMINATE_COPY_RELOCS + && ind->root.type != bfd_link_hash_indirect + && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) + /* If called to transfer flags for a weakdef during processing + of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. + We clear it ourselves for ELIMINATE_COPY_RELOCS. */ + dir->elf_link_hash_flags |= + (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC + | ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); + else + _bfd_elf_link_hash_copy_indirect (bed, dir, ind); +} + +/* Look through the relocs for a section during the first phase, and + calculate needed space in the global offset table, procedure linkage + table, and dynamic reloc sections. At this point we haven't + necessarily read all the input files. */ + +static bfd_boolean +elf32_hppa_check_relocs (bfd *abfd, + struct bfd_link_info *info, + asection *sec, + const Elf_Internal_Rela *relocs) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + struct elf32_hppa_link_hash_table *htab; + asection *sreloc; + asection *stubreloc; + + if (info->relocatable) + return TRUE; + + htab = hppa_link_hash_table (info); + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sreloc = NULL; + stubreloc = NULL; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + enum { + NEED_GOT = 1, + NEED_PLT = 2, + NEED_DYNREL = 4, + PLT_PLABEL = 8 + }; + + unsigned int r_symndx, r_type; + struct elf32_hppa_link_hash_entry *h; + int need_entry; + + r_symndx = ELF32_R_SYM (rel->r_info); + + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = ((struct elf32_hppa_link_hash_entry *) + sym_hashes[r_symndx - symtab_hdr->sh_info]); + + r_type = ELF32_R_TYPE (rel->r_info); + + switch (r_type) + { + case R_PARISC_DLTIND14F: + case R_PARISC_DLTIND14R: + case R_PARISC_DLTIND21L: + /* This symbol requires a global offset table entry. */ + need_entry = NEED_GOT; + break; + + case R_PARISC_PLABEL14R: /* "Official" procedure labels. */ + case R_PARISC_PLABEL21L: + case R_PARISC_PLABEL32: + /* If the addend is non-zero, we break badly. */ + if (rel->r_addend != 0) + abort (); + + /* If we are creating a shared library, then we need to + create a PLT entry for all PLABELs, because PLABELs with + local symbols may be passed via a pointer to another + object. Additionally, output a dynamic relocation + pointing to the PLT entry. + For executables, the original 32-bit ABI allowed two + different styles of PLABELs (function pointers): For + global functions, the PLABEL word points into the .plt + two bytes past a (function address, gp) pair, and for + local functions the PLABEL points directly at the + function. The magic +2 for the first type allows us to + differentiate between the two. As you can imagine, this + is a real pain when it comes to generating code to call + functions indirectly or to compare function pointers. + We avoid the mess by always pointing a PLABEL into the + .plt, even for local functions. */ + need_entry = PLT_PLABEL | NEED_PLT | NEED_DYNREL; + break; + + case R_PARISC_PCREL12F: + htab->has_12bit_branch = 1; + goto branch_common; + + case R_PARISC_PCREL17C: + case R_PARISC_PCREL17F: + htab->has_17bit_branch = 1; + goto branch_common; + + case R_PARISC_PCREL22F: + htab->has_22bit_branch = 1; + branch_common: + /* Function calls might need to go through the .plt, and + might require long branch stubs. */ + if (h == NULL) + { + /* We know local syms won't need a .plt entry, and if + they need a long branch stub we can't guarantee that + we can reach the stub. So just flag an error later + if we're doing a shared link and find we need a long + branch stub. */ + continue; + } + else + { + /* Global symbols will need a .plt entry if they remain + global, and in most cases won't need a long branch + stub. Unfortunately, we have to cater for the case + where a symbol is forced local by versioning, or due + to symbolic linking, and we lose the .plt entry. */ + need_entry = NEED_PLT; + if (h->elf.type == STT_PARISC_MILLI) + need_entry = 0; + } + break; + + case R_PARISC_SEGBASE: /* Used to set segment base. */ + case R_PARISC_SEGREL32: /* Relative reloc, used for unwind. */ + case R_PARISC_PCREL14F: /* PC relative load/store. */ + case R_PARISC_PCREL14R: + case R_PARISC_PCREL17R: /* External branches. */ + case R_PARISC_PCREL21L: /* As above, and for load/store too. */ + case R_PARISC_PCREL32: + /* We don't need to propagate the relocation if linking a + shared object since these are section relative. */ + continue; + + case R_PARISC_DPREL14F: /* Used for gp rel data load/store. */ + case R_PARISC_DPREL14R: + case R_PARISC_DPREL21L: + if (info->shared) + { + (*_bfd_error_handler) + (_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"), + bfd_archive_filename (abfd), + elf_hppa_howto_table[r_type].name); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + /* Fall through. */ + + case R_PARISC_DIR17F: /* Used for external branches. */ + case R_PARISC_DIR17R: + case R_PARISC_DIR14F: /* Used for load/store from absolute locn. */ + case R_PARISC_DIR14R: + case R_PARISC_DIR21L: /* As above, and for ext branches too. */ +#if 0 + /* Help debug shared library creation. Any of the above + relocs can be used in shared libs, but they may cause + pages to become unshared. */ + if (info->shared) + { + (*_bfd_error_handler) + (_("%s: relocation %s should not be used when making a shared object; recompile with -fPIC"), + bfd_archive_filename (abfd), + elf_hppa_howto_table[r_type].name); + } + /* Fall through. */ +#endif + + case R_PARISC_DIR32: /* .word relocs. */ + /* We may want to output a dynamic relocation later. */ + need_entry = NEED_DYNREL; + break; + + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_PARISC_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, &h->elf, rel->r_offset)) + return FALSE; + continue; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_PARISC_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, &h->elf, rel->r_addend)) + return FALSE; + continue; + + default: + continue; + } + + /* Now carry out our orders. */ + if (need_entry & NEED_GOT) + { + /* Allocate space for a GOT entry, as well as a dynamic + relocation for this entry. */ + if (htab->sgot == NULL) + { + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + if (!elf32_hppa_create_dynamic_sections (htab->elf.dynobj, info)) + return FALSE; + } + + if (h != NULL) + { + h->elf.got.refcount += 1; + } + else + { + bfd_signed_vma *local_got_refcounts; + + /* This is a global offset table entry for a local symbol. */ + local_got_refcounts = elf_local_got_refcounts (abfd); + if (local_got_refcounts == NULL) + { + bfd_size_type size; + + /* Allocate space for local got offsets and local + plt offsets. Done this way to save polluting + elf_obj_tdata with another target specific + pointer. */ + size = symtab_hdr->sh_info; + size *= 2 * sizeof (bfd_signed_vma); + local_got_refcounts = bfd_zalloc (abfd, size); + if (local_got_refcounts == NULL) + return FALSE; + elf_local_got_refcounts (abfd) = local_got_refcounts; + } + local_got_refcounts[r_symndx] += 1; + } + } + + if (need_entry & NEED_PLT) + { + /* If we are creating a shared library, and this is a reloc + against a weak symbol or a global symbol in a dynamic + object, then we will be creating an import stub and a + .plt entry for the symbol. Similarly, on a normal link + to symbols defined in a dynamic object we'll need the + import stub and a .plt entry. We don't know yet whether + the symbol is defined or not, so make an entry anyway and + clean up later in adjust_dynamic_symbol. */ + if ((sec->flags & SEC_ALLOC) != 0) + { + if (h != NULL) + { + h->elf.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->elf.plt.refcount += 1; + + /* If this .plt entry is for a plabel, mark it so + that adjust_dynamic_symbol will keep the entry + even if it appears to be local. */ + if (need_entry & PLT_PLABEL) + h->plabel = 1; + } + else if (need_entry & PLT_PLABEL) + { + bfd_signed_vma *local_got_refcounts; + bfd_signed_vma *local_plt_refcounts; + + local_got_refcounts = elf_local_got_refcounts (abfd); + if (local_got_refcounts == NULL) + { + bfd_size_type size; + + /* Allocate space for local got offsets and local + plt offsets. */ + size = symtab_hdr->sh_info; + size *= 2 * sizeof (bfd_signed_vma); + local_got_refcounts = bfd_zalloc (abfd, size); + if (local_got_refcounts == NULL) + return FALSE; + elf_local_got_refcounts (abfd) = local_got_refcounts; + } + local_plt_refcounts = (local_got_refcounts + + symtab_hdr->sh_info); + local_plt_refcounts[r_symndx] += 1; + } + } + } + + if (need_entry & NEED_DYNREL) + { + /* Flag this symbol as having a non-got, non-plt reference + so that we generate copy relocs if it turns out to be + dynamic. */ + if (h != NULL && !info->shared) + h->elf.elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + + /* If we are creating a shared library then we need to copy + the reloc into the shared library. However, if we are + linking with -Bsymbolic, we need only copy absolute + relocs or relocs against symbols that are not defined in + an object we are including in the link. PC- or DP- or + DLT-relative relocs against any local sym or global sym + with DEF_REGULAR set, can be discarded. At this point we + have not seen all the input files, so it is possible that + DEF_REGULAR is not set now but will be set later (it is + never cleared). We account for that possibility below by + storing information in the dyn_relocs field of the + hash table entry. + + A similar situation to the -Bsymbolic case occurs when + creating shared libraries and symbol visibility changes + render the symbol local. + + As it turns out, all the relocs we will be creating here + are absolute, so we cannot remove them on -Bsymbolic + links or visibility changes anyway. A STUB_REL reloc + is absolute too, as in that case it is the reloc in the + stub we will be creating, rather than copying the PCREL + reloc in the branch. + + If on the other hand, we are creating an executable, we + may need to keep relocations for symbols satisfied by a + dynamic library if we manage to avoid copy relocs for the + symbol. */ + if ((info->shared + && (sec->flags & SEC_ALLOC) != 0 + && (IS_ABSOLUTE_RELOC (r_type) + || (h != NULL + && (!info->symbolic + || h->elf.root.type == bfd_link_hash_defweak + || (h->elf.elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || (ELIMINATE_COPY_RELOCS + && !info->shared + && (sec->flags & SEC_ALLOC) != 0 + && h != NULL + && (h->elf.root.type == bfd_link_hash_defweak + || (h->elf.elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) + { + struct elf32_hppa_dyn_reloc_entry *p; + struct elf32_hppa_dyn_reloc_entry **head; + + /* Create a reloc section in dynobj and make room for + this reloc. */ + if (sreloc == NULL) + { + char *name; + bfd *dynobj; + + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); + if (name == NULL) + { + (*_bfd_error_handler) + (_("Could not find relocation section for %s"), + sec->name); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + + dynobj = htab->elf.dynobj; + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) + { + flagword flags; + + sreloc = bfd_make_section (dynobj, name); + flags = (SEC_HAS_CONTENTS | SEC_READONLY + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if ((sec->flags & SEC_ALLOC) != 0) + flags |= SEC_ALLOC | SEC_LOAD; + if (sreloc == NULL + || !bfd_set_section_flags (dynobj, sreloc, flags) + || !bfd_set_section_alignment (dynobj, sreloc, 2)) + return FALSE; + } + + elf_section_data (sec)->sreloc = sreloc; + } + + /* If this is a global symbol, we count the number of + relocations we need for this symbol. */ + if (h != NULL) + { + head = &h->dyn_relocs; + } + else + { + /* Track dynamic relocs needed for local syms too. + We really need local syms available to do this + easily. Oh well. */ + + asection *s; + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, + sec, r_symndx); + if (s == NULL) + return FALSE; + + head = ((struct elf32_hppa_dyn_reloc_entry **) + &elf_section_data (s)->local_dynrel); + } + + p = *head; + if (p == NULL || p->sec != sec) + { + p = bfd_alloc (htab->elf.dynobj, sizeof *p); + if (p == NULL) + return FALSE; + p->next = *head; + *head = p; + p->sec = sec; + p->count = 0; +#if RELATIVE_DYNRELOCS + p->relative_count = 0; +#endif + } + + p->count += 1; +#if RELATIVE_DYNRELOCS + if (!IS_ABSOLUTE_RELOC (rtype)) + p->relative_count += 1; +#endif + } + } + } + + return TRUE; +} + +/* Return the section that should be marked against garbage collection + for a given relocation. */ + +static asection * +elf32_hppa_gc_mark_hook (asection *sec, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Rela *rel, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + if (h != NULL) + { + switch ((unsigned int) ELF32_R_TYPE (rel->r_info)) + { + case R_PARISC_GNU_VTINHERIT: + case R_PARISC_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the got and plt entry reference counts for the section being + removed. */ + +static bfd_boolean +elf32_hppa_gc_sweep_hook (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *sec, + const Elf_Internal_Rela *relocs) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_signed_vma *local_got_refcounts; + bfd_signed_vma *local_plt_refcounts; + const Elf_Internal_Rela *rel, *relend; + + elf_section_data (sec)->local_dynrel = NULL; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + local_got_refcounts = elf_local_got_refcounts (abfd); + local_plt_refcounts = local_got_refcounts; + if (local_plt_refcounts != NULL) + local_plt_refcounts += symtab_hdr->sh_info; + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; rel++) + { + unsigned long r_symndx; + unsigned int r_type; + struct elf_link_hash_entry *h = NULL; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + struct elf32_hppa_link_hash_entry *eh; + struct elf32_hppa_dyn_reloc_entry **pp; + struct elf32_hppa_dyn_reloc_entry *p; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + eh = (struct elf32_hppa_link_hash_entry *) h; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { + /* Everything must go for SEC. */ + *pp = p->next; + break; + } + } + + r_type = ELF32_R_TYPE (rel->r_info); + switch (r_type) + { + case R_PARISC_DLTIND14F: + case R_PARISC_DLTIND14R: + case R_PARISC_DLTIND21L: + if (h != NULL) + { + if (h->got.refcount > 0) + h->got.refcount -= 1; + } + else if (local_got_refcounts != NULL) + { + if (local_got_refcounts[r_symndx] > 0) + local_got_refcounts[r_symndx] -= 1; + } + break; + + case R_PARISC_PCREL12F: + case R_PARISC_PCREL17C: + case R_PARISC_PCREL17F: + case R_PARISC_PCREL22F: + if (h != NULL) + { + if (h->plt.refcount > 0) + h->plt.refcount -= 1; + } + break; + + case R_PARISC_PLABEL14R: + case R_PARISC_PLABEL21L: + case R_PARISC_PLABEL32: + if (h != NULL) + { + if (h->plt.refcount > 0) + h->plt.refcount -= 1; + } + else if (local_plt_refcounts != NULL) + { + if (local_plt_refcounts[r_symndx] > 0) + local_plt_refcounts[r_symndx] -= 1; + } + break; + + default: + break; + } + } + + return TRUE; +} + +/* Our own version of hide_symbol, so that we can keep plt entries for + plabels. */ + +static void +elf32_hppa_hide_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h, + bfd_boolean force_local) +{ + if (force_local) + { + h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; + if (h->dynindx != -1) + { + h->dynindx = -1; + _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr, + h->dynstr_index); + } + } + + if (! ((struct elf32_hppa_link_hash_entry *) h)->plabel) + { + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->plt.offset = (bfd_vma) -1; + } +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static bfd_boolean +elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) +{ + struct elf32_hppa_link_hash_table *htab; + asection *s; + unsigned int power_of_two; + + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later. */ + if (h->type == STT_FUNC + || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + { + if (h->plt.refcount <= 0 + || ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + && h->root.type != bfd_link_hash_defweak + && ! ((struct elf32_hppa_link_hash_entry *) h)->plabel + && (!info->shared || info->symbolic))) + { + /* The .plt entry is not needed when: + a) Garbage collection has removed all references to the + symbol, or + b) We know for certain the symbol is defined in this + object, and it's not a weak definition, nor is the symbol + used by a plabel relocation. Either this object is the + application or we are doing a shared symbolic link. */ + + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + + return TRUE; + } + else + h->plt.offset = (bfd_vma) -1; + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + if (h->weakdef->root.type != bfd_link_hash_defined + && h->weakdef->root.type != bfd_link_hash_defweak) + abort (); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + if (ELIMINATE_COPY_RELOCS) + h->elf_link_hash_flags + = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) + | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (info->shared) + return TRUE; + + /* If there are no references to this symbol that do not use the + GOT, we don't need to generate a copy reloc. */ + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + return TRUE; + + if (ELIMINATE_COPY_RELOCS) + { + struct elf32_hppa_link_hash_entry *eh; + struct elf32_hppa_dyn_reloc_entry *p; + + eh = (struct elf32_hppa_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + s = p->sec->output_section; + if (s != NULL && (s->flags & SEC_READONLY) != 0) + break; + } + + /* If we didn't find any dynamic relocs in read-only sections, then + we'll be keeping the dynamic relocs and avoiding the copy reloc. */ + if (p == NULL) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return TRUE; + } + } + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + + htab = hppa_link_hash_table (info); + + /* We must generate a COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + htab->srelbss->_raw_size += sizeof (Elf32_External_Rela); + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + } + + /* We need to figure out the alignment required for this symbol. I + have no idea how other ELF linkers handle this. */ + + power_of_two = bfd_log2 (h->size); + if (power_of_two > 3) + power_of_two = 3; + + /* Apply the required alignment. */ + s = htab->sdynbss; + s->_raw_size = BFD_ALIGN (s->_raw_size, + (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) + { + if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) + return FALSE; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + + /* Increment the section size to make room for the symbol. */ + s->_raw_size += h->size; + + return TRUE; +} + +/* Allocate space in the .plt for entries that won't have relocations. + ie. plabel entries. */ + +static bfd_boolean +allocate_plt_static (struct elf_link_hash_entry *h, void *inf) +{ + struct bfd_link_info *info; + struct elf32_hppa_link_hash_table *htab; + asection *s; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + info = inf; + htab = hppa_link_hash_table (info); + if (htab->elf.dynamic_sections_created + && h->plt.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0 + && h->type != STT_PARISC_MILLI) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h)) + { + /* Allocate these later. From this point on, h->plabel + means that the plt entry is only used by a plabel. + We'll be using a normal plt entry for this symbol, so + clear the plabel indicator. */ + ((struct elf32_hppa_link_hash_entry *) h)->plabel = 0; + } + else if (((struct elf32_hppa_link_hash_entry *) h)->plabel) + { + /* Make an entry in the .plt section for plabel references + that won't have a .plt entry for other reasons. */ + s = htab->splt; + h->plt.offset = s->_raw_size; + s->_raw_size += PLT_ENTRY_SIZE; + } + else + { + /* No .plt entry needed. */ + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + + return TRUE; +} + +/* Allocate space in .plt, .got and associated reloc sections for + global syms. */ + +static bfd_boolean +allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) +{ + struct bfd_link_info *info; + struct elf32_hppa_link_hash_table *htab; + asection *s; + struct elf32_hppa_link_hash_entry *eh; + struct elf32_hppa_dyn_reloc_entry *p; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + info = inf; + htab = hppa_link_hash_table (info); + if (htab->elf.dynamic_sections_created + && h->plt.offset != (bfd_vma) -1 + && !((struct elf32_hppa_link_hash_entry *) h)->plabel) + { + /* Make an entry in the .plt section. */ + s = htab->splt; + h->plt.offset = s->_raw_size; + s->_raw_size += PLT_ENTRY_SIZE; + + /* We also need to make an entry in the .rela.plt section. */ + htab->srelplt->_raw_size += sizeof (Elf32_External_Rela); + htab->need_plt_stub = 1; + } + + if (h->got.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0 + && h->type != STT_PARISC_MILLI) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = htab->sgot; + h->got.offset = s->_raw_size; + s->_raw_size += GOT_ENTRY_SIZE; + if (htab->elf.dynamic_sections_created + && (info->shared + || (h->dynindx != -1 + && h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)) + { + htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + } + else + h->got.offset = (bfd_vma) -1; + + eh = (struct elf32_hppa_link_hash_entry *) h; + if (eh->dyn_relocs == NULL) + return TRUE; + + /* If this is a -Bsymbolic shared link, then we need to discard all + space allocated for dynamic pc-relative relocs against symbols + defined in a regular object. For the normal shared case, discard + space for relocs that have become local due to symbol visibility + changes. */ + if (info->shared) + { +#if RELATIVE_DYNRELOCS + if (SYMBOL_CALLS_LOCAL (info, h)) + { + struct elf32_hppa_dyn_reloc_entry **pp; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + { + p->count -= p->relative_count; + p->relative_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } +#endif + + /* Also discard relocs on undefined weak syms with non-default + visibility. */ + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + && h->root.type == bfd_link_hash_undefweak) + eh->dyn_relocs = NULL; + } + else + { + /* For the non-shared case, discard space for relocs against + symbols which turn out to need copy relocs or are not + dynamic. */ + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 + && ((ELIMINATE_COPY_RELOCS + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + || (htab->elf.dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0 + && h->type != STT_PARISC_MILLI) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + /* If that succeeded, we know we'll be keeping all the + relocs. */ + if (h->dynindx != -1) + goto keep; + } + + eh->dyn_relocs = NULL; + return TRUE; + + keep: ; + } + + /* Finally, allocate space. */ + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *sreloc = elf_section_data (p->sec)->sreloc; + sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela); + } + + return TRUE; +} + +/* This function is called via elf_link_hash_traverse to force + millicode symbols local so they do not end up as globals in the + dynamic symbol table. We ought to be able to do this in + adjust_dynamic_symbol, but our adjust_dynamic_symbol is not called + for all dynamic symbols. Arguably, this is a bug in + elf_adjust_dynamic_symbol. */ + +static bfd_boolean +clobber_millicode_symbols (struct elf_link_hash_entry *h, + struct bfd_link_info *info) +{ + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->type == STT_PARISC_MILLI + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + elf32_hppa_hide_symbol (info, h, TRUE); + } + return TRUE; +} + +/* Find any dynamic relocs that apply to read-only sections. */ + +static bfd_boolean +readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf) +{ + struct elf32_hppa_link_hash_entry *eh; + struct elf32_hppa_dyn_reloc_entry *p; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + eh = (struct elf32_hppa_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *s = p->sec->output_section; + + if (s != NULL && (s->flags & SEC_READONLY) != 0) + { + struct bfd_link_info *info = inf; + + info->flags |= DF_TEXTREL; + + /* Not an error, just cut short the traversal. */ + return FALSE; + } + } + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) +{ + struct elf32_hppa_link_hash_table *htab; + bfd *dynobj; + bfd *ibfd; + asection *s; + bfd_boolean relocs; + + htab = hppa_link_hash_table (info); + dynobj = htab->elf.dynobj; + if (dynobj == NULL) + abort (); + + if (htab->elf.dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (info->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + if (s == NULL) + abort (); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + + /* Force millicode symbols local. */ + elf_link_hash_traverse (&htab->elf, + clobber_millicode_symbols, + info); + } + + /* Set up .got and .plt offsets for local syms, and space for local + dynamic relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + bfd_signed_vma *local_got; + bfd_signed_vma *end_local_got; + bfd_signed_vma *local_plt; + bfd_signed_vma *end_local_plt; + bfd_size_type locsymcount; + Elf_Internal_Shdr *symtab_hdr; + asection *srel; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) + continue; + + for (s = ibfd->sections; s != NULL; s = s->next) + { + struct elf32_hppa_dyn_reloc_entry *p; + + for (p = ((struct elf32_hppa_dyn_reloc_entry *) + elf_section_data (s)->local_dynrel); + p != NULL; + p = p->next) + { + if (!bfd_is_abs_section (p->sec) + && bfd_is_abs_section (p->sec->output_section)) + { + /* Input section has been discarded, either because + it is a copy of a linkonce section or due to + linker script /DISCARD/, so we'll be discarding + the relocs too. */ + } + else if (p->count != 0) + { + srel = elf_section_data (p->sec)->sreloc; + srel->_raw_size += p->count * sizeof (Elf32_External_Rela); + if ((p->sec->output_section->flags & SEC_READONLY) != 0) + info->flags |= DF_TEXTREL; + } + } + } + + local_got = elf_local_got_refcounts (ibfd); + if (!local_got) + continue; + + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; + end_local_got = local_got + locsymcount; + s = htab->sgot; + srel = htab->srelgot; + for (; local_got < end_local_got; ++local_got) + { + if (*local_got > 0) + { + *local_got = s->_raw_size; + s->_raw_size += GOT_ENTRY_SIZE; + if (info->shared) + srel->_raw_size += sizeof (Elf32_External_Rela); + } + else + *local_got = (bfd_vma) -1; + } + + local_plt = end_local_got; + end_local_plt = local_plt + locsymcount; + if (! htab->elf.dynamic_sections_created) + { + /* Won't be used, but be safe. */ + for (; local_plt < end_local_plt; ++local_plt) + *local_plt = (bfd_vma) -1; + } + else + { + s = htab->splt; + srel = htab->srelplt; + for (; local_plt < end_local_plt; ++local_plt) + { + if (*local_plt > 0) + { + *local_plt = s->_raw_size; + s->_raw_size += PLT_ENTRY_SIZE; + if (info->shared) + srel->_raw_size += sizeof (Elf32_External_Rela); + } + else + *local_plt = (bfd_vma) -1; + } + } + } + + /* Do all the .plt entries without relocs first. The dynamic linker + uses the last .plt reloc to find the end of the .plt (and hence + the start of the .got) for lazy linking. */ + elf_link_hash_traverse (&htab->elf, allocate_plt_static, info); + + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ + elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, info); + + /* The check_relocs and adjust_dynamic_symbol entry points have + determined the sizes of the various dynamic sections. Allocate + memory for them. */ + relocs = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + if (s == htab->splt) + { + if (htab->need_plt_stub) + { + /* Make space for the plt stub at the end of the .plt + section. We want this stub right at the end, up + against the .got section. */ + int gotalign = bfd_section_alignment (dynobj, htab->sgot); + int pltalign = bfd_section_alignment (dynobj, s); + bfd_size_type mask; + + if (gotalign > pltalign) + bfd_set_section_alignment (dynobj, s, gotalign); + mask = ((bfd_size_type) 1 << gotalign) - 1; + s->_raw_size = (s->_raw_size + sizeof (plt_stub) + mask) & ~mask; + } + } + else if (s == htab->sgot) + ; + else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + { + if (s->_raw_size != 0) + { + /* Remember whether there are any reloc sections other + than .rela.plt. */ + if (s != htab->srelplt) + relocs = TRUE; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + } + else + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (s->_raw_size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + _bfd_strip_section_from_output (info, s); + continue; + } + + /* Allocate memory for the section contents. Zero it, because + we may not fill in all the reloc sections. */ + s->contents = bfd_zalloc (dynobj, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) + return FALSE; + } + + if (htab->elf.dynamic_sections_created) + { + /* Like IA-64 and HPPA64, always create a DT_PLTGOT. It + actually has nothing to do with the PLT, it is how we + communicate the LTP value of a load module to the dynamic + linker. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) + + if (!add_dynamic_entry (DT_PLTGOT, 0)) + return FALSE; + + /* Add some entries to the .dynamic section. We fill in the + values later, in elf32_hppa_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ + if (!info->shared) + { + if (!add_dynamic_entry (DT_DEBUG, 0)) + return FALSE; + } + + if (htab->srelplt->_raw_size != 0) + { + if (!add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + } + + if (relocs) + { + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) + return FALSE; + + /* If any dynamic relocs apply to a read-only section, + then we need a DT_TEXTREL entry. */ + if ((info->flags & DF_TEXTREL) == 0) + elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, info); + + if ((info->flags & DF_TEXTREL) != 0) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return FALSE; + } + } + } +#undef add_dynamic_entry + + return TRUE; +} + +/* External entry points for sizing and building linker stubs. */ + +/* Set up various things so that we can make a list of input sections + for each output section included in the link. Returns -1 on error, + 0 when no stubs will be needed, and 1 on success. */ + +int +elf32_hppa_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) +{ + bfd *input_bfd; + unsigned int bfd_count; + int top_id, top_index; + asection *section; + asection **input_list, **list; + bfd_size_type amt; + struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info); + + /* Count the number of input BFDs and find the top input section id. */ + for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0; + input_bfd != NULL; + input_bfd = input_bfd->link_next) + { + bfd_count += 1; + for (section = input_bfd->sections; + section != NULL; + section = section->next) + { + if (top_id < section->id) + top_id = section->id; + } + } + htab->bfd_count = bfd_count; + + amt = sizeof (struct map_stub) * (top_id + 1); + htab->stub_group = bfd_zmalloc (amt); + if (htab->stub_group == NULL) + return -1; + + /* We can't use output_bfd->section_count here to find the top output + section index as some sections may have been removed, and + _bfd_strip_section_from_output doesn't renumber the indices. */ + for (section = output_bfd->sections, top_index = 0; + section != NULL; + section = section->next) + { + if (top_index < section->index) + top_index = section->index; + } + + htab->top_index = top_index; + amt = sizeof (asection *) * (top_index + 1); + input_list = bfd_malloc (amt); + htab->input_list = input_list; + if (input_list == NULL) + return -1; + + /* For sections we aren't interested in, mark their entries with a + value we can check later. */ + list = input_list + top_index; + do + *list = bfd_abs_section_ptr; + while (list-- != input_list); + + for (section = output_bfd->sections; + section != NULL; + section = section->next) + { + if ((section->flags & SEC_CODE) != 0) + input_list[section->index] = NULL; + } + + return 1; +} + +/* The linker repeatedly calls this function for each input section, + in the order that input sections are linked into output sections. + Build lists of input sections to determine groupings between which + we may insert linker stubs. */ + +void +elf32_hppa_next_input_section (struct bfd_link_info *info, asection *isec) +{ + struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info); + + if (isec->output_section->index <= htab->top_index) + { + asection **list = htab->input_list + isec->output_section->index; + if (*list != bfd_abs_section_ptr) + { + /* Steal the link_sec pointer for our list. */ +#define PREV_SEC(sec) (htab->stub_group[(sec)->id].link_sec) + /* This happens to make the list in reverse order, + which is what we want. */ + PREV_SEC (isec) = *list; + *list = isec; + } + } +} + +/* See whether we can group stub sections together. Grouping stub + sections may result in fewer stubs. More importantly, we need to + put all .init* and .fini* stubs at the beginning of the .init or + .fini output sections respectively, because glibc splits the + _init and _fini functions into multiple parts. Putting a stub in + the middle of a function is not a good idea. */ + +static void +group_sections (struct elf32_hppa_link_hash_table *htab, + bfd_size_type stub_group_size, + bfd_boolean stubs_always_before_branch) +{ + asection **list = htab->input_list + htab->top_index; + do + { + asection *tail = *list; + if (tail == bfd_abs_section_ptr) + continue; + while (tail != NULL) + { + asection *curr; + asection *prev; + bfd_size_type total; + bfd_boolean big_sec; + + curr = tail; + if (tail->_cooked_size) + total = tail->_cooked_size; + else + total = tail->_raw_size; + big_sec = total >= stub_group_size; + + while ((prev = PREV_SEC (curr)) != NULL + && ((total += curr->output_offset - prev->output_offset) + < stub_group_size)) + curr = prev; + + /* OK, the size from the start of CURR to the end is less + than 240000 bytes and thus can be handled by one stub + section. (or the tail section is itself larger than + 240000 bytes, in which case we may be toast.) + We should really be keeping track of the total size of + stubs added here, as stubs contribute to the final output + section size. That's a little tricky, and this way will + only break if stubs added total more than 22144 bytes, or + 2768 long branch stubs. It seems unlikely for more than + 2768 different functions to be called, especially from + code only 240000 bytes long. This limit used to be + 250000, but c++ code tends to generate lots of little + functions, and sometimes violated the assumption. */ + do + { + prev = PREV_SEC (tail); + /* Set up this stub group. */ + htab->stub_group[tail->id].link_sec = curr; + } + while (tail != curr && (tail = prev) != NULL); + + /* But wait, there's more! Input sections up to 240000 + bytes before the stub section can be handled by it too. + Don't do this if we have a really large section after the + stubs, as adding more stubs increases the chance that + branches may not reach into the stub section. */ + if (!stubs_always_before_branch && !big_sec) + { + total = 0; + while (prev != NULL + && ((total += tail->output_offset - prev->output_offset) + < stub_group_size)) + { + tail = prev; + prev = PREV_SEC (tail); + htab->stub_group[tail->id].link_sec = curr; + } + } + tail = prev; + } + } + while (list-- != htab->input_list); + free (htab->input_list); +#undef PREV_SEC +} + +/* Read in all local syms for all input bfds, and create hash entries + for export stubs if we are building a multi-subspace shared lib. + Returns -1 on error, 1 if export stubs created, 0 otherwise. */ + +static int +get_local_syms (bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *info) +{ + unsigned int bfd_indx; + Elf_Internal_Sym *local_syms, **all_local_syms; + int stub_changed = 0; + struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info); + + /* We want to read in symbol extension records only once. To do this + we need to read in the local symbols in parallel and save them for + later use; so hold pointers to the local symbols in an array. */ + bfd_size_type amt = sizeof (Elf_Internal_Sym *) * htab->bfd_count; + all_local_syms = bfd_zmalloc (amt); + htab->all_local_syms = all_local_syms; + if (all_local_syms == NULL) + return -1; + + /* Walk over all the input BFDs, swapping in local symbols. + If we are creating a shared library, create hash entries for the + export stubs. */ + for (bfd_indx = 0; + input_bfd != NULL; + input_bfd = input_bfd->link_next, bfd_indx++) + { + Elf_Internal_Shdr *symtab_hdr; + + /* We'll need the symbol table in a second. */ + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + if (symtab_hdr->sh_info == 0) + continue; + + /* We need an array of the local symbols attached to the input bfd. */ + local_syms = (Elf_Internal_Sym *) symtab_hdr->contents; + if (local_syms == NULL) + { + local_syms = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + /* Cache them for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) local_syms; + } + if (local_syms == NULL) + return -1; + + all_local_syms[bfd_indx] = local_syms; + + if (info->shared && htab->multi_subspace) + { + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry **end_hashes; + unsigned int symcount; + + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + sym_hashes = elf_sym_hashes (input_bfd); + end_hashes = sym_hashes + symcount; + + /* Look through the global syms for functions; We need to + build export stubs for all globally visible functions. */ + for (; sym_hashes < end_hashes; sym_hashes++) + { + struct elf32_hppa_link_hash_entry *hash; + + hash = (struct elf32_hppa_link_hash_entry *) *sym_hashes; + + while (hash->elf.root.type == bfd_link_hash_indirect + || hash->elf.root.type == bfd_link_hash_warning) + hash = ((struct elf32_hppa_link_hash_entry *) + hash->elf.root.u.i.link); + + /* At this point in the link, undefined syms have been + resolved, so we need to check that the symbol was + defined in this BFD. */ + if ((hash->elf.root.type == bfd_link_hash_defined + || hash->elf.root.type == bfd_link_hash_defweak) + && hash->elf.type == STT_FUNC + && hash->elf.root.u.def.section->output_section != NULL + && (hash->elf.root.u.def.section->output_section->owner + == output_bfd) + && hash->elf.root.u.def.section->owner == input_bfd + && (hash->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) + && !(hash->elf.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) + && ELF_ST_VISIBILITY (hash->elf.other) == STV_DEFAULT) + { + asection *sec; + const char *stub_name; + struct elf32_hppa_stub_hash_entry *stub_entry; + + sec = hash->elf.root.u.def.section; + stub_name = hash->elf.root.root.string; + stub_entry = hppa_stub_hash_lookup (&htab->stub_hash_table, + stub_name, + FALSE, FALSE); + if (stub_entry == NULL) + { + stub_entry = hppa_add_stub (stub_name, sec, htab); + if (!stub_entry) + return -1; + + stub_entry->target_value = hash->elf.root.u.def.value; + stub_entry->target_section = hash->elf.root.u.def.section; + stub_entry->stub_type = hppa_stub_export; + stub_entry->h = hash; + stub_changed = 1; + } + else + { + (*_bfd_error_handler) (_("%s: duplicate export stub %s"), + bfd_archive_filename (input_bfd), + stub_name); + } + } + } + } + } + + return stub_changed; +} + +/* Determine and set the size of the stub section for a final link. + + The basic idea here is to examine all the relocations looking for + PC-relative calls to a target that is unreachable with a "bl" + instruction. */ + +bfd_boolean +elf32_hppa_size_stubs + (bfd *output_bfd, bfd *stub_bfd, struct bfd_link_info *info, + bfd_boolean multi_subspace, bfd_signed_vma group_size, + asection * (*add_stub_section) (const char *, asection *), + void (*layout_sections_again) (void)) +{ + bfd_size_type stub_group_size; + bfd_boolean stubs_always_before_branch; + bfd_boolean stub_changed; + struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info); + + /* Stash our params away. */ + htab->stub_bfd = stub_bfd; + htab->multi_subspace = multi_subspace; + htab->add_stub_section = add_stub_section; + htab->layout_sections_again = layout_sections_again; + stubs_always_before_branch = group_size < 0; + if (group_size < 0) + stub_group_size = -group_size; + else + stub_group_size = group_size; + if (stub_group_size == 1) + { + /* Default values. */ + if (stubs_always_before_branch) + { + stub_group_size = 7680000; + if (htab->has_17bit_branch || htab->multi_subspace) + stub_group_size = 240000; + if (htab->has_12bit_branch) + stub_group_size = 7500; + } + else + { + stub_group_size = 6971392; + if (htab->has_17bit_branch || htab->multi_subspace) + stub_group_size = 217856; + if (htab->has_12bit_branch) + stub_group_size = 6808; + } + } + + group_sections (htab, stub_group_size, stubs_always_before_branch); + + switch (get_local_syms (output_bfd, info->input_bfds, info)) + { + default: + if (htab->all_local_syms) + goto error_ret_free_local; + return FALSE; + + case 0: + stub_changed = FALSE; + break; + + case 1: + stub_changed = TRUE; + break; + } + + while (1) + { + bfd *input_bfd; + unsigned int bfd_indx; + asection *stub_sec; + + for (input_bfd = info->input_bfds, bfd_indx = 0; + input_bfd != NULL; + input_bfd = input_bfd->link_next, bfd_indx++) + { + Elf_Internal_Shdr *symtab_hdr; + asection *section; + Elf_Internal_Sym *local_syms; + + /* We'll need the symbol table in a second. */ + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + if (symtab_hdr->sh_info == 0) + continue; + + local_syms = htab->all_local_syms[bfd_indx]; + + /* Walk over each section attached to the input bfd. */ + for (section = input_bfd->sections; + section != NULL; + section = section->next) + { + Elf_Internal_Rela *internal_relocs, *irelaend, *irela; + + /* If there aren't any relocs, then there's nothing more + to do. */ + if ((section->flags & SEC_RELOC) == 0 + || section->reloc_count == 0) + continue; + + /* If this section is a link-once section that will be + discarded, then don't create any stubs. */ + if (section->output_section == NULL + || section->output_section->owner != output_bfd) + continue; + + /* Get the relocs. */ + internal_relocs + = _bfd_elf_link_read_relocs (input_bfd, section, NULL, NULL, + info->keep_memory); + if (internal_relocs == NULL) + goto error_ret_free_local; + + /* Now examine each relocation. */ + irela = internal_relocs; + irelaend = irela + section->reloc_count; + for (; irela < irelaend; irela++) + { + unsigned int r_type, r_indx; + enum elf32_hppa_stub_type stub_type; + struct elf32_hppa_stub_hash_entry *stub_entry; + asection *sym_sec; + bfd_vma sym_value; + bfd_vma destination; + struct elf32_hppa_link_hash_entry *hash; + char *stub_name; + const asection *id_sec; + + r_type = ELF32_R_TYPE (irela->r_info); + r_indx = ELF32_R_SYM (irela->r_info); + + if (r_type >= (unsigned int) R_PARISC_UNIMPLEMENTED) + { + bfd_set_error (bfd_error_bad_value); + error_ret_free_internal: + if (elf_section_data (section)->relocs == NULL) + free (internal_relocs); + goto error_ret_free_local; + } + + /* Only look for stubs on call instructions. */ + if (r_type != (unsigned int) R_PARISC_PCREL12F + && r_type != (unsigned int) R_PARISC_PCREL17F + && r_type != (unsigned int) R_PARISC_PCREL22F) + continue; + + /* Now determine the call target, its name, value, + section. */ + sym_sec = NULL; + sym_value = 0; + destination = 0; + hash = NULL; + if (r_indx < symtab_hdr->sh_info) + { + /* It's a local symbol. */ + Elf_Internal_Sym *sym; + Elf_Internal_Shdr *hdr; + + sym = local_syms + r_indx; + hdr = elf_elfsections (input_bfd)[sym->st_shndx]; + sym_sec = hdr->bfd_section; + if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) + sym_value = sym->st_value; + destination = (sym_value + irela->r_addend + + sym_sec->output_offset + + sym_sec->output_section->vma); + } + else + { + /* It's an external symbol. */ + int e_indx; + + e_indx = r_indx - symtab_hdr->sh_info; + hash = ((struct elf32_hppa_link_hash_entry *) + elf_sym_hashes (input_bfd)[e_indx]); + + while (hash->elf.root.type == bfd_link_hash_indirect + || hash->elf.root.type == bfd_link_hash_warning) + hash = ((struct elf32_hppa_link_hash_entry *) + hash->elf.root.u.i.link); + + if (hash->elf.root.type == bfd_link_hash_defined + || hash->elf.root.type == bfd_link_hash_defweak) + { + sym_sec = hash->elf.root.u.def.section; + sym_value = hash->elf.root.u.def.value; + if (sym_sec->output_section != NULL) + destination = (sym_value + irela->r_addend + + sym_sec->output_offset + + sym_sec->output_section->vma); + } + else if (hash->elf.root.type == bfd_link_hash_undefweak) + { + if (! info->shared) + continue; + } + else if (hash->elf.root.type == bfd_link_hash_undefined) + { + if (! (info->unresolved_syms_in_objects == RM_IGNORE + && (ELF_ST_VISIBILITY (hash->elf.other) + == STV_DEFAULT) + && hash->elf.type != STT_PARISC_MILLI)) + continue; + } + else + { + bfd_set_error (bfd_error_bad_value); + goto error_ret_free_internal; + } + } + + /* Determine what (if any) linker stub is needed. */ + stub_type = hppa_type_of_stub (section, irela, hash, + destination, info); + if (stub_type == hppa_stub_none) + continue; + + /* Support for grouping stub sections. */ + id_sec = htab->stub_group[section->id].link_sec; + + /* Get the name of this stub. */ + stub_name = hppa_stub_name (id_sec, sym_sec, hash, irela); + if (!stub_name) + goto error_ret_free_internal; + + stub_entry = hppa_stub_hash_lookup (&htab->stub_hash_table, + stub_name, + FALSE, FALSE); + if (stub_entry != NULL) + { + /* The proper stub has already been created. */ + free (stub_name); + continue; + } + + stub_entry = hppa_add_stub (stub_name, section, htab); + if (stub_entry == NULL) + { + free (stub_name); + goto error_ret_free_internal; + } + + stub_entry->target_value = sym_value; + stub_entry->target_section = sym_sec; + stub_entry->stub_type = stub_type; + if (info->shared) + { + if (stub_type == hppa_stub_import) + stub_entry->stub_type = hppa_stub_import_shared; + else if (stub_type == hppa_stub_long_branch) + stub_entry->stub_type = hppa_stub_long_branch_shared; + } + stub_entry->h = hash; + stub_changed = TRUE; + } + + /* We're done with the internal relocs, free them. */ + if (elf_section_data (section)->relocs == NULL) + free (internal_relocs); + } + } + + if (!stub_changed) + break; + + /* OK, we've added some stubs. Find out the new size of the + stub sections. */ + for (stub_sec = htab->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + { + stub_sec->_raw_size = 0; + stub_sec->_cooked_size = 0; + } + + bfd_hash_traverse (&htab->stub_hash_table, hppa_size_one_stub, htab); + + /* Ask the linker to do its stuff. */ + (*htab->layout_sections_again) (); + stub_changed = FALSE; + } + + free (htab->all_local_syms); + return TRUE; + + error_ret_free_local: + free (htab->all_local_syms); + return FALSE; +} + +/* For a final link, this function is called after we have sized the + stubs to provide a value for __gp. */ + +bfd_boolean +elf32_hppa_set_gp (bfd *abfd, struct bfd_link_info *info) +{ + struct bfd_link_hash_entry *h; + asection *sec = NULL; + bfd_vma gp_val = 0; + struct elf32_hppa_link_hash_table *htab; + + htab = hppa_link_hash_table (info); + h = bfd_link_hash_lookup (&htab->elf.root, "$global$", FALSE, FALSE, FALSE); + + if (h != NULL + && (h->type == bfd_link_hash_defined + || h->type == bfd_link_hash_defweak)) + { + gp_val = h->u.def.value; + sec = h->u.def.section; + } + else + { + asection *splt = bfd_get_section_by_name (abfd, ".plt"); + asection *sgot = bfd_get_section_by_name (abfd, ".got"); + + /* Choose to point our LTP at, in this order, one of .plt, .got, + or .data, if these sections exist. In the case of choosing + .plt try to make the LTP ideal for addressing anywhere in the + .plt or .got with a 14 bit signed offset. Typically, the end + of the .plt is the start of the .got, so choose .plt + 0x2000 + if either the .plt or .got is larger than 0x2000. If both + the .plt and .got are smaller than 0x2000, choose the end of + the .plt section. */ + sec = splt; + if (sec != NULL) + { + gp_val = sec->_raw_size; + if (gp_val > 0x2000 || (sgot && sgot->_raw_size > 0x2000)) + { + gp_val = 0x2000; + } + } + else + { + sec = sgot; + if (sec != NULL) + { + /* We know we don't have a .plt. If .got is large, + offset our LTP. */ + if (sec->_raw_size > 0x2000) + gp_val = 0x2000; + } + else + { + /* No .plt or .got. Who cares what the LTP is? */ + sec = bfd_get_section_by_name (abfd, ".data"); + } + } + + if (h != NULL) + { + h->type = bfd_link_hash_defined; + h->u.def.value = gp_val; + if (sec != NULL) + h->u.def.section = sec; + else + h->u.def.section = bfd_abs_section_ptr; + } + } + + if (sec != NULL && sec->output_section != NULL) + gp_val += sec->output_section->vma + sec->output_offset; + + elf_gp (abfd) = gp_val; + return TRUE; +} + +/* Build all the stubs associated with the current output file. The + stubs are kept in a hash table attached to the main linker hash + table. We also set up the .plt entries for statically linked PIC + functions here. This function is called via hppaelf_finish in the + linker. */ + +bfd_boolean +elf32_hppa_build_stubs (struct bfd_link_info *info) +{ + asection *stub_sec; + struct bfd_hash_table *table; + struct elf32_hppa_link_hash_table *htab; + + htab = hppa_link_hash_table (info); + + for (stub_sec = htab->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + { + bfd_size_type size; + + /* Allocate memory to hold the linker stubs. */ + size = stub_sec->_raw_size; + stub_sec->contents = bfd_zalloc (htab->stub_bfd, size); + if (stub_sec->contents == NULL && size != 0) + return FALSE; + stub_sec->_raw_size = 0; + } + + /* Build the stubs as directed by the stub hash table. */ + table = &htab->stub_hash_table; + bfd_hash_traverse (table, hppa_build_one_stub, info); + + return TRUE; +} + +/* Perform a final link. */ + +static bfd_boolean +elf32_hppa_final_link (bfd *abfd, struct bfd_link_info *info) +{ + /* Invoke the regular ELF linker to do all the work. */ + if (!bfd_elf_final_link (abfd, info)) + return FALSE; + + /* If we're producing a final executable, sort the contents of the + unwind section. */ + return elf_hppa_sort_unwind (abfd); +} + +/* Record the lowest address for the data and text segments. */ + +static void +hppa_record_segment_addr (bfd *abfd ATTRIBUTE_UNUSED, + asection *section, + void *data) +{ + struct elf32_hppa_link_hash_table *htab; + + htab = (struct elf32_hppa_link_hash_table *) data; + + if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) + { + bfd_vma value = section->vma - section->filepos; + + if ((section->flags & SEC_READONLY) != 0) + { + if (value < htab->text_segment_base) + htab->text_segment_base = value; + } + else + { + if (value < htab->data_segment_base) + htab->data_segment_base = value; + } + } +} + +/* Perform a relocation as part of a final link. */ + +static bfd_reloc_status_type +final_link_relocate (asection *input_section, + bfd_byte *contents, + const Elf_Internal_Rela *rel, + bfd_vma value, + struct elf32_hppa_link_hash_table *htab, + asection *sym_sec, + struct elf32_hppa_link_hash_entry *h, + struct bfd_link_info *info) +{ + int insn; + unsigned int r_type = ELF32_R_TYPE (rel->r_info); + unsigned int orig_r_type = r_type; + reloc_howto_type *howto = elf_hppa_howto_table + r_type; + int r_format = howto->bitsize; + enum hppa_reloc_field_selector_type_alt r_field; + bfd *input_bfd = input_section->owner; + bfd_vma offset = rel->r_offset; + bfd_vma max_branch_offset = 0; + bfd_byte *hit_data = contents + offset; + bfd_signed_vma addend = rel->r_addend; + bfd_vma location; + struct elf32_hppa_stub_hash_entry *stub_entry = NULL; + int val; + + if (r_type == R_PARISC_NONE) + return bfd_reloc_ok; + + insn = bfd_get_32 (input_bfd, hit_data); + + /* Find out where we are and where we're going. */ + location = (offset + + input_section->output_offset + + input_section->output_section->vma); + + /* If we are not building a shared library, convert DLTIND relocs to + DPREL relocs. */ + if (!info->shared) + { + switch (r_type) + { + case R_PARISC_DLTIND21L: + r_type = R_PARISC_DPREL21L; + break; + + case R_PARISC_DLTIND14R: + r_type = R_PARISC_DPREL14R; + break; + + case R_PARISC_DLTIND14F: + r_type = R_PARISC_DPREL14F; + break; + } + } + + switch (r_type) + { + case R_PARISC_PCREL12F: + case R_PARISC_PCREL17F: + case R_PARISC_PCREL22F: + /* If this call should go via the plt, find the import stub in + the stub hash. */ + if (sym_sec == NULL + || sym_sec->output_section == NULL + || (h != NULL + && h->elf.plt.offset != (bfd_vma) -1 + && h->elf.dynindx != -1 + && !h->plabel + && (info->shared + || !(h->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) + || h->elf.root.type == bfd_link_hash_defweak))) + { + stub_entry = hppa_get_stub_entry (input_section, sym_sec, + h, rel, htab); + if (stub_entry != NULL) + { + value = (stub_entry->stub_offset + + stub_entry->stub_sec->output_offset + + stub_entry->stub_sec->output_section->vma); + addend = 0; + } + else if (sym_sec == NULL && h != NULL + && h->elf.root.type == bfd_link_hash_undefweak) + { + /* It's OK if undefined weak. Calls to undefined weak + symbols behave as if the "called" function + immediately returns. We can thus call to a weak + function without first checking whether the function + is defined. */ + value = location; + addend = 8; + } + else + return bfd_reloc_undefined; + } + /* Fall thru. */ + + case R_PARISC_PCREL21L: + case R_PARISC_PCREL17C: + case R_PARISC_PCREL17R: + case R_PARISC_PCREL14R: + case R_PARISC_PCREL14F: + case R_PARISC_PCREL32: + /* Make it a pc relative offset. */ + value -= location; + addend -= 8; + break; + + case R_PARISC_DPREL21L: + case R_PARISC_DPREL14R: + case R_PARISC_DPREL14F: + /* Convert instructions that use the linkage table pointer (r19) to + instructions that use the global data pointer (dp). This is the + most efficient way of using PIC code in an incomplete executable, + but the user must follow the standard runtime conventions for + accessing data for this to work. */ + if (orig_r_type == R_PARISC_DLTIND21L) + { + /* Convert addil instructions if the original reloc was a + DLTIND21L. GCC sometimes uses a register other than r19 for + the operation, so we must convert any addil instruction + that uses this relocation. */ + if ((insn & 0xfc000000) == ((int) OP_ADDIL << 26)) + insn = ADDIL_DP; + else + /* We must have a ldil instruction. It's too hard to find + and convert the associated add instruction, so issue an + error. */ + (*_bfd_error_handler) + (_("%s(%s+0x%lx): %s fixup for insn 0x%x is not supported in a non-shared link"), + bfd_archive_filename (input_bfd), + input_section->name, + (long) rel->r_offset, + howto->name, + insn); + } + else if (orig_r_type == R_PARISC_DLTIND14F) + { + /* This must be a format 1 load/store. Change the base + register to dp. */ + insn = (insn & 0xfc1ffff) | (27 << 21); + } + + /* For all the DP relative relocations, we need to examine the symbol's + section. If it has no section or if it's a code section, then + "data pointer relative" makes no sense. In that case we don't + adjust the "value", and for 21 bit addil instructions, we change the + source addend register from %dp to %r0. This situation commonly + arises for undefined weak symbols and when a variable's "constness" + is declared differently from the way the variable is defined. For + instance: "extern int foo" with foo defined as "const int foo". */ + if (sym_sec == NULL || (sym_sec->flags & SEC_CODE) != 0) + { + if ((insn & ((0x3f << 26) | (0x1f << 21))) + == (((int) OP_ADDIL << 26) | (27 << 21))) + { + insn &= ~ (0x1f << 21); +#if 0 /* debug them. */ + (*_bfd_error_handler) + (_("%s(%s+0x%lx): fixing %s"), + bfd_archive_filename (input_bfd), + input_section->name, + (long) rel->r_offset, + howto->name); +#endif + } + /* Now try to make things easy for the dynamic linker. */ + + break; + } + /* Fall thru. */ + + case R_PARISC_DLTIND21L: + case R_PARISC_DLTIND14R: + case R_PARISC_DLTIND14F: + value -= elf_gp (input_section->output_section->owner); + break; + + case R_PARISC_SEGREL32: + if ((sym_sec->flags & SEC_CODE) != 0) + value -= htab->text_segment_base; + else + value -= htab->data_segment_base; + break; + + default: + break; + } + + switch (r_type) + { + case R_PARISC_DIR32: + case R_PARISC_DIR14F: + case R_PARISC_DIR17F: + case R_PARISC_PCREL17C: + case R_PARISC_PCREL14F: + case R_PARISC_PCREL32: + case R_PARISC_DPREL14F: + case R_PARISC_PLABEL32: + case R_PARISC_DLTIND14F: + case R_PARISC_SEGBASE: + case R_PARISC_SEGREL32: + r_field = e_fsel; + break; + + case R_PARISC_DLTIND21L: + case R_PARISC_PCREL21L: + case R_PARISC_PLABEL21L: + r_field = e_lsel; + break; + + case R_PARISC_DIR21L: + case R_PARISC_DPREL21L: + r_field = e_lrsel; + break; + + case R_PARISC_PCREL17R: + case R_PARISC_PCREL14R: + case R_PARISC_PLABEL14R: + case R_PARISC_DLTIND14R: + r_field = e_rsel; + break; + + case R_PARISC_DIR17R: + case R_PARISC_DIR14R: + case R_PARISC_DPREL14R: + r_field = e_rrsel; + break; + + case R_PARISC_PCREL12F: + case R_PARISC_PCREL17F: + case R_PARISC_PCREL22F: + r_field = e_fsel; + + if (r_type == (unsigned int) R_PARISC_PCREL17F) + { + max_branch_offset = (1 << (17-1)) << 2; + } + else if (r_type == (unsigned int) R_PARISC_PCREL12F) + { + max_branch_offset = (1 << (12-1)) << 2; + } + else + { + max_branch_offset = (1 << (22-1)) << 2; + } + + /* sym_sec is NULL on undefined weak syms or when shared on + undefined syms. We've already checked for a stub for the + shared undefined case. */ + if (sym_sec == NULL) + break; + + /* If the branch is out of reach, then redirect the + call to the local stub for this function. */ + if (value + addend + max_branch_offset >= 2*max_branch_offset) + { + stub_entry = hppa_get_stub_entry (input_section, sym_sec, + h, rel, htab); + if (stub_entry == NULL) + return bfd_reloc_undefined; + + /* Munge up the value and addend so that we call the stub + rather than the procedure directly. */ + value = (stub_entry->stub_offset + + stub_entry->stub_sec->output_offset + + stub_entry->stub_sec->output_section->vma + - location); + addend = -8; + } + break; + + /* Something we don't know how to handle. */ + default: + return bfd_reloc_notsupported; + } + + /* Make sure we can reach the stub. */ + if (max_branch_offset != 0 + && value + addend + max_branch_offset >= 2*max_branch_offset) + { + (*_bfd_error_handler) + (_("%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"), + bfd_archive_filename (input_bfd), + input_section->name, + (long) rel->r_offset, + stub_entry->root.string); + bfd_set_error (bfd_error_bad_value); + return bfd_reloc_notsupported; + } + + val = hppa_field_adjust (value, addend, r_field); + + switch (r_type) + { + case R_PARISC_PCREL12F: + case R_PARISC_PCREL17C: + case R_PARISC_PCREL17F: + case R_PARISC_PCREL17R: + case R_PARISC_PCREL22F: + case R_PARISC_DIR17F: + case R_PARISC_DIR17R: + /* This is a branch. Divide the offset by four. + Note that we need to decide whether it's a branch or + otherwise by inspecting the reloc. Inspecting insn won't + work as insn might be from a .word directive. */ + val >>= 2; + break; + + default: + break; + } + + insn = hppa_rebuild_insn (insn, val, r_format); + + /* Update the instruction word. */ + bfd_put_32 (input_bfd, (bfd_vma) insn, hit_data); + return bfd_reloc_ok; +} + +/* Relocate an HPPA ELF section. */ + +static bfd_boolean +elf32_hppa_relocate_section (bfd *output_bfd, + struct bfd_link_info *info, + bfd *input_bfd, + asection *input_section, + bfd_byte *contents, + Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) +{ + bfd_vma *local_got_offsets; + struct elf32_hppa_link_hash_table *htab; + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + + htab = hppa_link_hash_table (info); + local_got_offsets = elf_local_got_offsets (input_bfd); + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + unsigned int r_type; + reloc_howto_type *howto; + unsigned int r_symndx; + struct elf32_hppa_link_hash_entry *h; + Elf_Internal_Sym *sym; + asection *sym_sec; + bfd_vma relocation; + bfd_reloc_status_type r; + const char *sym_name; + bfd_boolean plabel; + bfd_boolean warned_undef; + + r_type = ELF32_R_TYPE (rel->r_info); + if (r_type >= (unsigned int) R_PARISC_UNIMPLEMENTED) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + if (r_type == (unsigned int) R_PARISC_GNU_VTENTRY + || r_type == (unsigned int) R_PARISC_GNU_VTINHERIT) + continue; + + /* This is a final link. */ + r_symndx = ELF32_R_SYM (rel->r_info); + h = NULL; + sym = NULL; + sym_sec = NULL; + warned_undef = FALSE; + if (r_symndx < symtab_hdr->sh_info) + { + /* This is a local symbol, h defaults to NULL. */ + sym = local_syms + r_symndx; + sym_sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel); + } + else + { + struct elf_link_hash_entry *hh; + bfd_boolean unresolved_reloc; + struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd); + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + hh, sym_sec, relocation, + unresolved_reloc, warned_undef); + + if (relocation == 0 + && hh->root.type != bfd_link_hash_defined + && hh->root.type != bfd_link_hash_defweak + && hh->root.type != bfd_link_hash_undefweak) + { + if (info->unresolved_syms_in_objects == RM_IGNORE + && ELF_ST_VISIBILITY (hh->other) == STV_DEFAULT + && hh->type == STT_PARISC_MILLI) + { + if (! info->callbacks->undefined_symbol + (info, hh->root.root.string, input_bfd, + input_section, rel->r_offset, FALSE)) + return FALSE; + warned_undef = TRUE; + } + } + h = (struct elf32_hppa_link_hash_entry *) hh; + } + + /* Do any required modifications to the relocation value, and + determine what types of dynamic info we need to output, if + any. */ + plabel = 0; + switch (r_type) + { + case R_PARISC_DLTIND14F: + case R_PARISC_DLTIND14R: + case R_PARISC_DLTIND21L: + { + bfd_vma off; + bfd_boolean do_got = 0; + + /* Relocation is to the entry for this symbol in the + global offset table. */ + if (h != NULL) + { + bfd_boolean dyn; + + off = h->elf.got.offset; + dyn = htab->elf.dynamic_sections_created; + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, + &h->elf)) + { + /* If we aren't going to call finish_dynamic_symbol, + then we need to handle initialisation of the .got + entry and create needed relocs here. Since the + offset must always be a multiple of 4, we use the + least significant bit to record whether we have + initialised it already. */ + if ((off & 1) != 0) + off &= ~1; + else + { + h->elf.got.offset |= 1; + do_got = 1; + } + } + } + else + { + /* Local symbol case. */ + if (local_got_offsets == NULL) + abort (); + + off = local_got_offsets[r_symndx]; + + /* The offset must always be a multiple of 4. We use + the least significant bit to record whether we have + already generated the necessary reloc. */ + if ((off & 1) != 0) + off &= ~1; + else + { + local_got_offsets[r_symndx] |= 1; + do_got = 1; + } + } + + if (do_got) + { + if (info->shared) + { + /* Output a dynamic relocation for this GOT entry. + In this case it is relative to the base of the + object because the symbol index is zero. */ + Elf_Internal_Rela outrel; + bfd_byte *loc; + asection *s = htab->srelgot; + + outrel.r_offset = (off + + htab->sgot->output_offset + + htab->sgot->output_section->vma); + outrel.r_info = ELF32_R_INFO (0, R_PARISC_DIR32); + outrel.r_addend = relocation; + loc = s->contents; + loc += s->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + } + else + bfd_put_32 (output_bfd, relocation, + htab->sgot->contents + off); + } + + if (off >= (bfd_vma) -2) + abort (); + + /* Add the base of the GOT to the relocation value. */ + relocation = (off + + htab->sgot->output_offset + + htab->sgot->output_section->vma); + } + break; + + case R_PARISC_SEGREL32: + /* If this is the first SEGREL relocation, then initialize + the segment base values. */ + if (htab->text_segment_base == (bfd_vma) -1) + bfd_map_over_sections (output_bfd, hppa_record_segment_addr, htab); + break; + + case R_PARISC_PLABEL14R: + case R_PARISC_PLABEL21L: + case R_PARISC_PLABEL32: + if (htab->elf.dynamic_sections_created) + { + bfd_vma off; + bfd_boolean do_plt = 0; + + /* If we have a global symbol with a PLT slot, then + redirect this relocation to it. */ + if (h != NULL) + { + off = h->elf.plt.offset; + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, + &h->elf)) + { + /* In a non-shared link, adjust_dynamic_symbols + isn't called for symbols forced local. We + need to write out the plt entry here. */ + if ((off & 1) != 0) + off &= ~1; + else + { + h->elf.plt.offset |= 1; + do_plt = 1; + } + } + } + else + { + bfd_vma *local_plt_offsets; + + if (local_got_offsets == NULL) + abort (); + + local_plt_offsets = local_got_offsets + symtab_hdr->sh_info; + off = local_plt_offsets[r_symndx]; + + /* As for the local .got entry case, we use the last + bit to record whether we've already initialised + this local .plt entry. */ + if ((off & 1) != 0) + off &= ~1; + else + { + local_plt_offsets[r_symndx] |= 1; + do_plt = 1; + } + } + + if (do_plt) + { + if (info->shared) + { + /* Output a dynamic IPLT relocation for this + PLT entry. */ + Elf_Internal_Rela outrel; + bfd_byte *loc; + asection *s = htab->srelplt; + + outrel.r_offset = (off + + htab->splt->output_offset + + htab->splt->output_section->vma); + outrel.r_info = ELF32_R_INFO (0, R_PARISC_IPLT); + outrel.r_addend = relocation; + loc = s->contents; + loc += s->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + } + else + { + bfd_put_32 (output_bfd, + relocation, + htab->splt->contents + off); + bfd_put_32 (output_bfd, + elf_gp (htab->splt->output_section->owner), + htab->splt->contents + off + 4); + } + } + + if (off >= (bfd_vma) -2) + abort (); + + /* PLABELs contain function pointers. Relocation is to + the entry for the function in the .plt. The magic +2 + offset signals to $$dyncall that the function pointer + is in the .plt and thus has a gp pointer too. + Exception: Undefined PLABELs should have a value of + zero. */ + if (h == NULL + || (h->elf.root.type != bfd_link_hash_undefweak + && h->elf.root.type != bfd_link_hash_undefined)) + { + relocation = (off + + htab->splt->output_offset + + htab->splt->output_section->vma + + 2); + } + plabel = 1; + } + /* Fall through and possibly emit a dynamic relocation. */ + + case R_PARISC_DIR17F: + case R_PARISC_DIR17R: + case R_PARISC_DIR14F: + case R_PARISC_DIR14R: + case R_PARISC_DIR21L: + case R_PARISC_DPREL14F: + case R_PARISC_DPREL14R: + case R_PARISC_DPREL21L: + case R_PARISC_DIR32: + /* r_symndx will be zero only for relocs against symbols + from removed linkonce sections, or sections discarded by + a linker script. */ + if (r_symndx == 0 + || (input_section->flags & SEC_ALLOC) == 0) + break; + + /* The reloc types handled here and this conditional + expression must match the code in ..check_relocs and + allocate_dynrelocs. ie. We need exactly the same condition + as in ..check_relocs, with some extra conditions (dynindx + test in this case) to cater for relocs removed by + allocate_dynrelocs. If you squint, the non-shared test + here does indeed match the one in ..check_relocs, the + difference being that here we test DEF_DYNAMIC as well as + !DEF_REGULAR. All common syms end up with !DEF_REGULAR, + which is why we can't use just that test here. + Conversely, DEF_DYNAMIC can't be used in check_relocs as + there all files have not been loaded. */ + if ((info->shared + && (h == NULL + || ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT + || h->elf.root.type != bfd_link_hash_undefweak) + && (IS_ABSOLUTE_RELOC (r_type) + || !SYMBOL_CALLS_LOCAL (info, &h->elf))) + || (!info->shared + && h != NULL + && h->elf.dynindx != -1 + && (h->elf.elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 + && ((ELIMINATE_COPY_RELOCS + && (h->elf.elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf.elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) + || h->elf.root.type == bfd_link_hash_undefweak + || h->elf.root.type == bfd_link_hash_undefined))) + { + Elf_Internal_Rela outrel; + bfd_boolean skip; + asection *sreloc; + bfd_byte *loc; + + /* When generating a shared object, these relocations + are copied into the output file to be resolved at run + time. */ + + outrel.r_addend = rel->r_addend; + outrel.r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, + rel->r_offset); + skip = (outrel.r_offset == (bfd_vma) -1 + || outrel.r_offset == (bfd_vma) -2); + outrel.r_offset += (input_section->output_offset + + input_section->output_section->vma); + + if (skip) + { + memset (&outrel, 0, sizeof (outrel)); + } + else if (h != NULL + && h->elf.dynindx != -1 + && (plabel + || !IS_ABSOLUTE_RELOC (r_type) + || !info->shared + || !info->symbolic + || (h->elf.elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + { + outrel.r_info = ELF32_R_INFO (h->elf.dynindx, r_type); + } + else /* It's a local symbol, or one marked to become local. */ + { + int indx = 0; + + /* Add the absolute offset of the symbol. */ + outrel.r_addend += relocation; + + /* Global plabels need to be processed by the + dynamic linker so that functions have at most one + fptr. For this reason, we need to differentiate + between global and local plabels, which we do by + providing the function symbol for a global plabel + reloc, and no symbol for local plabels. */ + if (! plabel + && sym_sec != NULL + && sym_sec->output_section != NULL + && ! bfd_is_abs_section (sym_sec)) + { + /* Skip this relocation if the output section has + been discarded. */ + if (bfd_is_abs_section (sym_sec->output_section)) + break; + + indx = elf_section_data (sym_sec->output_section)->dynindx; + /* We are turning this relocation into one + against a section symbol, so subtract out the + output section's address but not the offset + of the input section in the output section. */ + outrel.r_addend -= sym_sec->output_section->vma; + } + + outrel.r_info = ELF32_R_INFO (indx, r_type); + } +#if 0 + /* EH info can cause unaligned DIR32 relocs. + Tweak the reloc type for the dynamic linker. */ + if (r_type == R_PARISC_DIR32 && (outrel.r_offset & 3) != 0) + outrel.r_info = ELF32_R_INFO (ELF32_R_SYM (outrel.r_info), + R_PARISC_DIR32U); +#endif + sreloc = elf_section_data (input_section)->sreloc; + if (sreloc == NULL) + abort (); + + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + } + break; + + default: + break; + } + + r = final_link_relocate (input_section, contents, rel, relocation, + htab, sym_sec, h, info); + + if (r == bfd_reloc_ok) + continue; + + if (h != NULL) + sym_name = h->elf.root.root.string; + else + { + sym_name = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name); + if (sym_name == NULL) + return FALSE; + if (*sym_name == '\0') + sym_name = bfd_section_name (input_bfd, sym_sec); + } + + howto = elf_hppa_howto_table + r_type; + + if (r == bfd_reloc_undefined || r == bfd_reloc_notsupported) + { + if (r == bfd_reloc_notsupported || !warned_undef) + { + (*_bfd_error_handler) + (_("%s(%s+0x%lx): cannot handle %s for %s"), + bfd_archive_filename (input_bfd), + input_section->name, + (long) rel->r_offset, + howto->name, + sym_name); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + else + { + if (!((*info->callbacks->reloc_overflow) + (info, sym_name, howto->name, 0, input_bfd, input_section, + rel->r_offset))) + return FALSE; + } + } + + return TRUE; +} + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +static bfd_boolean +elf32_hppa_finish_dynamic_symbol (bfd *output_bfd, + struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + struct elf32_hppa_link_hash_table *htab; + Elf_Internal_Rela rel; + bfd_byte *loc; + + htab = hppa_link_hash_table (info); + + if (h->plt.offset != (bfd_vma) -1) + { + bfd_vma value; + + if (h->plt.offset & 1) + abort (); + + /* This symbol has an entry in the procedure linkage table. Set + it up. + + The format of a plt entry is + + <__gp> + */ + value = 0; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + value = h->root.u.def.value; + if (h->root.u.def.section->output_section != NULL) + value += (h->root.u.def.section->output_offset + + h->root.u.def.section->output_section->vma); + } + + /* Create a dynamic IPLT relocation for this entry. */ + rel.r_offset = (h->plt.offset + + htab->splt->output_offset + + htab->splt->output_section->vma); + if (h->dynindx != -1) + { + rel.r_info = ELF32_R_INFO (h->dynindx, R_PARISC_IPLT); + rel.r_addend = 0; + } + else + { + /* This symbol has been marked to become local, and is + used by a plabel so must be kept in the .plt. */ + rel.r_info = ELF32_R_INFO (0, R_PARISC_IPLT); + rel.r_addend = value; + } + + loc = htab->srelplt->contents; + loc += htab->srelplt->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (htab->splt->output_section->owner, &rel, loc); + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + } + } + + if (h->got.offset != (bfd_vma) -1) + { + /* This symbol has an entry in the global offset table. Set it + up. */ + + rel.r_offset = ((h->got.offset &~ (bfd_vma) 1) + + htab->sgot->output_offset + + htab->sgot->output_section->vma); + + /* If this is a -Bsymbolic link and the symbol is defined + locally or was forced to be local because of a version file, + we just want to emit a RELATIVE reloc. The entry in the + global offset table will already have been initialized in the + relocate_section function. */ + if (info->shared + && (info->symbolic || h->dynindx == -1) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + { + rel.r_info = ELF32_R_INFO (0, R_PARISC_DIR32); + rel.r_addend = (h->root.u.def.value + + h->root.u.def.section->output_offset + + h->root.u.def.section->output_section->vma); + } + else + { + if ((h->got.offset & 1) != 0) + abort (); + bfd_put_32 (output_bfd, 0, htab->sgot->contents + h->got.offset); + rel.r_info = ELF32_R_INFO (h->dynindx, R_PARISC_DIR32); + rel.r_addend = 0; + } + + loc = htab->srelgot->contents; + loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + } + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + { + asection *s; + + /* This symbol needs a copy reloc. Set it up. */ + + if (! (h->dynindx != -1 + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak))) + abort (); + + s = htab->srelbss; + + rel.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_offset + + h->root.u.def.section->output_section->vma); + rel.r_addend = 0; + rel.r_info = ELF32_R_INFO (h->dynindx, R_PARISC_COPY); + loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + } + + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ + if (h->root.root.string[0] == '_' + && (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)) + { + sym->st_shndx = SHN_ABS; + } + + return TRUE; +} + +/* Used to decide how to sort relocs in an optimal manner for the + dynamic linker, before writing them out. */ + +static enum elf_reloc_type_class +elf32_hppa_reloc_type_class (const Elf_Internal_Rela *rela) +{ + if (ELF32_R_SYM (rela->r_info) == 0) + return reloc_class_relative; + + switch ((int) ELF32_R_TYPE (rela->r_info)) + { + case R_PARISC_IPLT: + return reloc_class_plt; + case R_PARISC_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} + +/* Finish up the dynamic sections. */ + +static bfd_boolean +elf32_hppa_finish_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) +{ + bfd *dynobj; + struct elf32_hppa_link_hash_table *htab; + asection *sdyn; + + htab = hppa_link_hash_table (info); + dynobj = htab->elf.dynobj; + + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (htab->elf.dynamic_sections_created) + { + Elf32_External_Dyn *dyncon, *dynconend; + + if (sdyn == NULL) + abort (); + + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + asection *s; + + bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + continue; + + case DT_PLTGOT: + /* Use PLTGOT to set the GOT register. */ + dyn.d_un.d_ptr = elf_gp (output_bfd); + break; + + case DT_JMPREL: + s = htab->srelplt; + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; + break; + + case DT_PLTRELSZ: + s = htab->srelplt; + dyn.d_un.d_val = s->_raw_size; + break; + + case DT_RELASZ: + /* Don't count procedure linkage table relocs in the + overall reloc count. */ + s = htab->srelplt; + if (s == NULL) + continue; + dyn.d_un.d_val -= s->_raw_size; + break; + + case DT_RELA: + /* We may not be using the standard ELF linker script. + If .rela.plt is the first .rela section, we adjust + DT_RELA to not include it. */ + s = htab->srelplt; + if (s == NULL) + continue; + if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset) + continue; + dyn.d_un.d_ptr += s->_raw_size; + break; + } + + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + } + } + + if (htab->sgot != NULL && htab->sgot->_raw_size != 0) + { + /* Fill in the first entry in the global offset table. + We use it to point to our dynamic section, if we have one. */ + bfd_put_32 (output_bfd, + sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0, + htab->sgot->contents); + + /* The second entry is reserved for use by the dynamic linker. */ + memset (htab->sgot->contents + GOT_ENTRY_SIZE, 0, GOT_ENTRY_SIZE); + + /* Set .got entry size. */ + elf_section_data (htab->sgot->output_section) + ->this_hdr.sh_entsize = GOT_ENTRY_SIZE; + } + + if (htab->splt != NULL && htab->splt->_raw_size != 0) + { + /* Set plt entry size. */ + elf_section_data (htab->splt->output_section) + ->this_hdr.sh_entsize = PLT_ENTRY_SIZE; + + if (htab->need_plt_stub) + { + /* Set up the .plt stub. */ + memcpy (htab->splt->contents + + htab->splt->_raw_size - sizeof (plt_stub), + plt_stub, sizeof (plt_stub)); + + if ((htab->splt->output_offset + + htab->splt->output_section->vma + + htab->splt->_raw_size) + != (htab->sgot->output_offset + + htab->sgot->output_section->vma)) + { + (*_bfd_error_handler) + (_(".got section not immediately after .plt section")); + return FALSE; + } + } + } + + return TRUE; +} + +/* Tweak the OSABI field of the elf header. */ + +static void +elf32_hppa_post_process_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) +{ + Elf_Internal_Ehdr * i_ehdrp; + + i_ehdrp = elf_elfheader (abfd); + + if (strcmp (bfd_get_target (abfd), "elf32-hppa-linux") == 0) + { + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_LINUX; + } + else + { + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX; + } +} + +/* Called when writing out an object file to decide the type of a + symbol. */ +static int +elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type) +{ + if (ELF_ST_TYPE (elf_sym->st_info) == STT_PARISC_MILLI) + return STT_PARISC_MILLI; + else + return type; +} + +/* Misc BFD support code. */ +#define bfd_elf32_bfd_is_local_label_name elf_hppa_is_local_label_name +#define bfd_elf32_bfd_reloc_type_lookup elf_hppa_reloc_type_lookup +#define elf_info_to_howto elf_hppa_info_to_howto +#define elf_info_to_howto_rel elf_hppa_info_to_howto_rel + +/* Stuff for the BFD linker. */ +#define bfd_elf32_bfd_final_link elf32_hppa_final_link +#define bfd_elf32_bfd_link_hash_table_create elf32_hppa_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_free elf32_hppa_link_hash_table_free +#define elf_backend_adjust_dynamic_symbol elf32_hppa_adjust_dynamic_symbol +#define elf_backend_copy_indirect_symbol elf32_hppa_copy_indirect_symbol +#define elf_backend_check_relocs elf32_hppa_check_relocs +#define elf_backend_create_dynamic_sections elf32_hppa_create_dynamic_sections +#define elf_backend_fake_sections elf_hppa_fake_sections +#define elf_backend_relocate_section elf32_hppa_relocate_section +#define elf_backend_hide_symbol elf32_hppa_hide_symbol +#define elf_backend_finish_dynamic_symbol elf32_hppa_finish_dynamic_symbol +#define elf_backend_finish_dynamic_sections elf32_hppa_finish_dynamic_sections +#define elf_backend_size_dynamic_sections elf32_hppa_size_dynamic_sections +#define elf_backend_gc_mark_hook elf32_hppa_gc_mark_hook +#define elf_backend_gc_sweep_hook elf32_hppa_gc_sweep_hook +#define elf_backend_object_p elf32_hppa_object_p +#define elf_backend_final_write_processing elf_hppa_final_write_processing +#define elf_backend_post_process_headers elf32_hppa_post_process_headers +#define elf_backend_get_symbol_type elf32_hppa_elf_get_symbol_type +#define elf_backend_reloc_type_class elf32_hppa_reloc_type_class + +#define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 +#define elf_backend_plt_alignment 2 +#define elf_backend_want_got_plt 0 +#define elf_backend_plt_readonly 0 +#define elf_backend_want_plt_sym 0 +#define elf_backend_got_header_size 8 +#define elf_backend_rela_normal 1 + +#define TARGET_BIG_SYM bfd_elf32_hppa_vec +#define TARGET_BIG_NAME "elf32-hppa" +#define ELF_ARCH bfd_arch_hppa +#define ELF_MACHINE_CODE EM_PARISC +#define ELF_MAXPAGESIZE 0x1000 + +#include "elf32-target.h" + +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_hppa_linux_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-hppa-linux" + +#define INCLUDED_TARGET_FILE 1 +#include "elf32-target.h" diff --git a/bfd/elf32-hppa.h b/bfd/elf32-hppa.h new file mode 100644 index 0000000000000..000602eb43b67 --- /dev/null +++ b/bfd/elf32-hppa.h @@ -0,0 +1,77 @@ +/* ELF32/HPPA support + + This file contains ELF32/HPPA relocation support as specified + in the Stratus FTX/Golf Object File Format (SED-1762) dated + February 1994. + + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, + 2002, 2003 Free Software Foundation, Inc. + + Written by: + + Center for Software Science + Department of Computer Science + University of Utah + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#ifndef _ELF32_HPPA_H +#define _ELF32_HPPA_H + +#include "elf-bfd.h" +#include "libhppa.h" +#include "elf/hppa.h" + +int elf32_hppa_setup_section_lists + (bfd *, struct bfd_link_info *); + +void elf32_hppa_next_input_section + (struct bfd_link_info *, asection *); + +bfd_boolean elf32_hppa_size_stubs + (bfd *, bfd *, struct bfd_link_info *, bfd_boolean, bfd_signed_vma, + asection * (*) (const char *, asection *), void (*) (void)); + +bfd_boolean elf32_hppa_set_gp + (bfd *, struct bfd_link_info *); + +bfd_boolean elf32_hppa_build_stubs + (struct bfd_link_info *); + +elf_hppa_reloc_type elf32_hppa_reloc_final_type + (bfd *, elf_hppa_reloc_type, int, unsigned int); + +extern elf_hppa_reloc_type ** _bfd_elf32_hppa_gen_reloc_type + (bfd *, elf_hppa_reloc_type, int, unsigned int, int, asymbol *); + +/* Define groups of basic relocations. FIXME: These should + be the only basic relocations created by GAS. The rest + should be internal to the BFD backend. + + The idea is both SOM and ELF define these basic relocation + types so they map into a SOM or ELF specific relocation + as appropriate. This allows GAS to share much more code + between the two target object formats. */ + +#define R_HPPA_NONE R_PARISC_NONE +#define R_HPPA R_PARISC_DIR32 +#define R_HPPA_GOTOFF R_PARISC_DPREL21L +#define R_HPPA_PCREL_CALL R_PARISC_PCREL21L +#define R_HPPA_ABS_CALL R_PARISC_DIR17F +#define R_HPPA_COMPLEX R_PARISC_UNIMPLEMENTED + +#endif /* _ELF32_HPPA_H */ diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c new file mode 100644 index 0000000000000..f782925008139 --- /dev/null +++ b/bfd/elf32-i370.c @@ -0,0 +1,1562 @@ +/* i370-specific support for 32-bit ELF + Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + Hacked by Linas Vepstas for i370 linas@linas.org + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* This file is based on a preliminary PowerPC ELF ABI. + But its been hacked on for the IBM 360/370 architectures. + Basically, the 31bit relocation works, and just about everything + else is a wild card. In particular, don't expect shared libs or + dynamic loading to work ... its never been tested ... +*/ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/i370.h" + +static reloc_howto_type *i370_elf_howto_table[ (int)R_I370_max ]; + +static reloc_howto_type i370_elf_howto_raw[] = +{ + /* This reloc does nothing. */ + HOWTO (R_I370_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_I370_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A standard 31 bit relocation. */ + HOWTO (R_I370_ADDR31, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 31, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_I370_ADDR31", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x7fffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A standard 32 bit relocation. */ + HOWTO (R_I370_ADDR32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_I370_ADDR32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A standard 16 bit relocation. */ + HOWTO (R_I370_ADDR16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_I370_ADDR16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 31-bit PC relative */ + HOWTO (R_I370_REL31, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 31, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_I370_REL31", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x7fffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 32-bit PC relative */ + HOWTO (R_I370_REL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_I370_REL32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A standard 12 bit relocation. */ + HOWTO (R_I370_ADDR12, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_I370_ADDR12", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xfff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 12-bit PC relative */ + HOWTO (R_I370_REL12, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_I370_REL12", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xfff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A standard 8 bit relocation. */ + HOWTO (R_I370_ADDR8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_I370_ADDR8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 8-bit PC relative */ + HOWTO (R_I370_REL8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_I370_REL8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* This is used only by the dynamic linker. The symbol should exist + both in the object being run and in some shared library. The + dynamic linker copies the data addressed by the symbol from the + shared library into the object, because the object being + run has to have the data at some particular address. */ + HOWTO (R_I370_COPY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_I370_COPY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used only by the dynamic linker. When the object is run, this + longword is set to the load address of the object, plus the + addend. */ + HOWTO (R_I370_RELATIVE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_I370_RELATIVE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + +}; + +static void i370_elf_howto_init + PARAMS ((void)); +static reloc_howto_type *i370_elf_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void i370_elf_info_to_howto + PARAMS ((bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)); +static bfd_boolean i370_elf_set_private_flags + PARAMS ((bfd *, flagword)); + +/* Initialize the i370_elf_howto_table, so that linear accesses can be done. */ + +static void +i370_elf_howto_init () +{ + unsigned int i, type; + + for (i = 0; i < sizeof (i370_elf_howto_raw) / sizeof (i370_elf_howto_raw[0]); i++) + { + type = i370_elf_howto_raw[i].type; + BFD_ASSERT (type < sizeof (i370_elf_howto_table) / sizeof (i370_elf_howto_table[0])); + i370_elf_howto_table[type] = &i370_elf_howto_raw[i]; + } +} + +static reloc_howto_type * +i370_elf_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + enum i370_reloc_type i370_reloc = R_I370_NONE; + + if (!i370_elf_howto_table[ R_I370_ADDR31 ]) /* Initialize howto table if needed */ + i370_elf_howto_init (); + + switch ((int)code) + { + default: + return (reloc_howto_type *)NULL; + + case BFD_RELOC_NONE: i370_reloc = R_I370_NONE; break; + case BFD_RELOC_32: i370_reloc = R_I370_ADDR31; break; + case BFD_RELOC_16: i370_reloc = R_I370_ADDR16; break; + case BFD_RELOC_32_PCREL: i370_reloc = R_I370_REL31; break; + case BFD_RELOC_CTOR: i370_reloc = R_I370_ADDR31; break; + case BFD_RELOC_I370_D12: i370_reloc = R_I370_ADDR12; break; + } + + return i370_elf_howto_table[ (int)i370_reloc ]; +}; + +static bfd_boolean i370_elf_merge_private_bfd_data + PARAMS ((bfd *, bfd *)); +static bfd_boolean i370_elf_relocate_section + PARAMS ((bfd *, struct bfd_link_info *info, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms, + asection **)); +static void i370_elf_post_process_headers + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean i370_elf_create_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean i370_elf_section_from_shdr + PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); +static bfd_boolean i370_elf_fake_sections + PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); +static bfd_boolean i370_elf_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static bfd_boolean i370_elf_adjust_dynamic_symbol + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); +static bfd_boolean i370_elf_adjust_dynindx + PARAMS ((struct elf_link_hash_entry *, PTR)); +static bfd_boolean i370_elf_size_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean i370_elf_finish_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + +/* The name of the dynamic interpreter. This is put in the .interp + section. */ + +#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so" + +/* Set the howto pointer for an i370 ELF reloc. */ + +static void +i370_elf_info_to_howto (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + if (!i370_elf_howto_table[ R_I370_ADDR31 ]) /* Initialize howto table */ + i370_elf_howto_init (); + + BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_I370_max); + cache_ptr->howto = i370_elf_howto_table[ELF32_R_TYPE (dst->r_info)]; +} + +/* hack alert -- the following several routines look generic to me ... + * why are we bothering with them ??? + */ +/* Function to set whether a module needs the -mrelocatable bit set. */ +static bfd_boolean +i370_elf_set_private_flags (abfd, flags) + bfd *abfd; + flagword flags; +{ + BFD_ASSERT (!elf_flags_init (abfd) + || elf_elfheader (abfd)->e_flags == flags); + + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + return TRUE; +} + +/* Merge backend specific data from an object file to the output + object file when linking */ +static bfd_boolean +i370_elf_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + flagword old_flags; + flagword new_flags; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + new_flags = elf_elfheader (ibfd)->e_flags; + old_flags = elf_elfheader (obfd)->e_flags; + if (!elf_flags_init (obfd)) /* First call, no flags set */ + { + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = new_flags; + } + + else if (new_flags == old_flags) /* Compatible flags are ok */ + ; + + else /* Incompatible flags */ + { + (*_bfd_error_handler) + ("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)", + bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags); + + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + return TRUE; +} + +/* Handle an i370 specific section when reading an object file. This + is called when elfcode.h finds a section with an unknown type. */ +/* XXX hack alert bogus This routine is mostly all junk and almost + * certainly does the wrong thing. Its here simply because it does + * just enough to allow glibc-2.1 ld.so to compile & link. + */ + +static bfd_boolean +i370_elf_section_from_shdr (abfd, hdr, name) + bfd *abfd; + Elf_Internal_Shdr *hdr; + const char *name; +{ + asection *newsect; + flagword flags; + + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) + return FALSE; + + newsect = hdr->bfd_section; + flags = bfd_get_section_flags (abfd, newsect); + if (hdr->sh_flags & SHF_EXCLUDE) + flags |= SEC_EXCLUDE; + + if (hdr->sh_type == SHT_ORDERED) + flags |= SEC_SORT_ENTRIES; + + bfd_set_section_flags (abfd, newsect, flags); + return TRUE; +} + +/* Set up any other section flags and such that may be necessary. */ +/* XXX hack alert bogus This routine is mostly all junk and almost + * certainly does the wrong thing. Its here simply because it does + * just enough to allow glibc-2.1 ld.so to compile & link. + */ + +static bfd_boolean +i370_elf_fake_sections (abfd, shdr, asect) + bfd *abfd ATTRIBUTE_UNUSED; + Elf_Internal_Shdr *shdr; + asection *asect; +{ + if ((asect->flags & SEC_EXCLUDE) != 0) + shdr->sh_flags |= SHF_EXCLUDE; + + if ((asect->flags & SEC_SORT_ENTRIES) != 0) + shdr->sh_type = SHT_ORDERED; + + return TRUE; +} + +/* We have to create .dynsbss and .rela.sbss here so that they get mapped + to output sections (just like _bfd_elf_create_dynamic_sections has + to create .dynbss and .rela.bss). */ +/* XXX hack alert bogus This routine is mostly all junk and almost + * certainly does the wrong thing. Its here simply because it does + * just enough to allow glibc-2.1 ld.so to compile & link. + */ + +static bfd_boolean +i370_elf_create_dynamic_sections (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + register asection *s; + flagword flags; + + if (!_bfd_elf_create_dynamic_sections(abfd, info)) + return FALSE; + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + + s = bfd_make_section (abfd, ".dynsbss"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, SEC_ALLOC)) + return FALSE; + + if (! info->shared) + { + s = bfd_make_section (abfd, ".rela.sbss"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, 2)) + return FALSE; + } + + /* xxx beats me, seem to need a rela.text ... */ + s = bfd_make_section (abfd, ".rela.text"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, 2)) + return FALSE; + return TRUE; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ +/* XXX hack alert bogus This routine is mostly all junk and almost + * certainly does the wrong thing. Its here simply because it does + * just enough to allow glibc-2.1 ld.so to compile & link. + */ + +static bfd_boolean +i370_elf_adjust_dynamic_symbol (info, h) + struct bfd_link_info *info; + struct elf_link_hash_entry *h; +{ + bfd *dynobj = elf_hash_table (info)->dynobj; + asection *s; + unsigned int power_of_two; + +#ifdef DEBUG + fprintf (stderr, "i370_elf_adjust_dynamic_symbol called for %s\n", + h->root.root.string); +#endif + + /* Make sure we know what is going on here. */ + BFD_ASSERT (dynobj != NULL + && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) + || h->weakdef != NULL + || ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_REF_REGULAR) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))); + + s = bfd_get_section_by_name (dynobj, ".rela.text"); + BFD_ASSERT (s != NULL); + s->_raw_size += sizeof (Elf32_External_Rela); + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (info->shared) + return TRUE; + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. + + Of course, if the symbol is sufficiently small, we must instead + allocate it in .sbss. FIXME: It would be better to do this if and + only if there were actually SDAREL relocs for that symbol. */ + + if (h->size <= elf_gp_size (dynobj)) + s = bfd_get_section_by_name (dynobj, ".dynsbss"); + else + s = bfd_get_section_by_name (dynobj, ".dynbss"); + BFD_ASSERT (s != NULL); + + /* We must generate a R_I370_COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rela.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + asection *srel; + + if (h->size <= elf_gp_size (dynobj)) + srel = bfd_get_section_by_name (dynobj, ".rela.sbss"); + else + srel = bfd_get_section_by_name (dynobj, ".rela.bss"); + BFD_ASSERT (srel != NULL); + srel->_raw_size += sizeof (Elf32_External_Rela); + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + } + + /* We need to figure out the alignment required for this symbol. I + have no idea how ELF linkers handle this. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > 4) + power_of_two = 4; + + /* Apply the required alignment. */ + s->_raw_size = BFD_ALIGN (s->_raw_size, + (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (dynobj, s)) + { + if (! bfd_set_section_alignment (dynobj, s, power_of_two)) + return FALSE; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + + /* Increment the section size to make room for the symbol. */ + s->_raw_size += h->size; + + return TRUE; +} + +/* Increment the index of a dynamic symbol by a given amount. Called + via elf_link_hash_traverse. */ +/* XXX hack alert bogus This routine is mostly all junk and almost + * certainly does the wrong thing. Its here simply because it does + * just enough to allow glibc-2.1 ld.so to compile & link. + */ + +static bfd_boolean +i370_elf_adjust_dynindx (h, cparg) + struct elf_link_hash_entry *h; + PTR cparg; +{ + int *cp = (int *) cparg; + +#ifdef DEBUG + fprintf (stderr, + "i370_elf_adjust_dynindx called, h->dynindx = %d, *cp = %d\n", + h->dynindx, *cp); +#endif + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->dynindx != -1) + h->dynindx += *cp; + + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ +/* XXX hack alert bogus This routine is mostly all junk and almost + * certainly does the wrong thing. Its here simply because it does + * just enough to allow glibc-2.1 ld.so to compile & link. + */ + +static bfd_boolean +i370_elf_size_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *s; + bfd_boolean plt; + bfd_boolean relocs; + bfd_boolean reltext; + +#ifdef DEBUG + fprintf (stderr, "i370_elf_size_dynamic_sections called\n"); +#endif + + dynobj = elf_hash_table (info)->dynobj; + BFD_ASSERT (dynobj != NULL); + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (info->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } + else + { + /* We may have created entries in the .rela.got, .rela.sdata, and + .rela.sdata2 sections. However, if we are not creating the + dynamic sections, we will not actually use these entries. Reset + the size of .rela.got, et al, which will cause it to get + stripped from the output file below. */ + static char *rela_sections[] = { ".rela.got", ".rela.sdata", + ".rela.sdata2", ".rela.sbss", + (char *)0 }; + char **p; + + for (p = rela_sections; *p != (char *)0; p++) + { + s = bfd_get_section_by_name (dynobj, *p); + if (s != NULL) + s->_raw_size = 0; + } + } + + /* The check_relocs and adjust_dynamic_symbol entry points have + determined the sizes of the various dynamic sections. Allocate + memory for them. */ + plt = FALSE; + relocs = FALSE; + reltext = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + const char *name; + bfd_boolean strip; + + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + /* It's OK to base decisions on the section name, because none + of the dynobj section names depend upon the input files. */ + name = bfd_get_section_name (dynobj, s); + strip = FALSE; + + if (strcmp (name, ".plt") == 0) + { + if (s->_raw_size == 0) + { + /* Strip this section if we don't need it; see the + comment below. */ + strip = TRUE; + } + else + { + /* Remember whether there is a PLT. */ + plt = TRUE; + } + } + else if (strncmp (name, ".rela", 5) == 0) + { + if (s->_raw_size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + strip = TRUE; + } + else + { + asection *target; + const char *outname; + + /* Remember whether there are any relocation sections. */ + relocs = TRUE; + + /* If this relocation section applies to a read only + section, then we probably need a DT_TEXTREL entry. */ + outname = bfd_get_section_name (output_bfd, + s->output_section); + target = bfd_get_section_by_name (output_bfd, outname + 5); + if (target != NULL + && (target->flags & SEC_READONLY) != 0 + && (target->flags & SEC_ALLOC) != 0) + reltext = TRUE; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + } + else if (strcmp (name, ".got") != 0 + && strcmp (name, ".sdata") != 0 + && strcmp (name, ".sdata2") != 0) + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (strip) + { + asection **spp; + + for (spp = &s->output_section->owner->sections; + *spp != NULL; + spp = &(*spp)->next) + { + if (*spp == s->output_section) + { + bfd_section_list_remove (s->output_section->owner, spp); + --s->output_section->owner->section_count; + break; + } + } + continue; + } + /* Allocate memory for the section contents. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) + return FALSE; + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in i370_elf_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) + + if (!info->shared) + { + if (!add_dynamic_entry (DT_DEBUG, 0)) + return FALSE; + } + + if (plt) + { + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + } + + if (relocs) + { + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) + return FALSE; + } + + if (reltext) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return FALSE; + info->flags |= DF_TEXTREL; + } + } +#undef add_dynamic_entry + + /* If we are generating a shared library, we generate a section + symbol for each output section. These are local symbols, which + means that they must come first in the dynamic symbol table. + That means we must increment the dynamic symbol index of every + other dynamic symbol. + + FIXME: We assume that there will never be relocations to + locations in linker-created sections that do not have + externally-visible names. Instead, we should work out precisely + which sections relocations are targeted at. */ + if (info->shared) + { + int c; + + for (c = 0, s = output_bfd->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LINKER_CREATED) != 0 + || (s->flags & SEC_ALLOC) == 0) + { + elf_section_data (s)->dynindx = -1; + continue; + } + + /* These symbols will have no names, so we don't need to + fiddle with dynstr_index. */ + + elf_section_data (s)->dynindx = c + 1; + + c++; + } + + elf_link_hash_traverse (elf_hash_table (info), + i370_elf_adjust_dynindx, + (PTR) &c); + elf_hash_table (info)->dynsymcount += c; + } + + return TRUE; +} + +/* Look through the relocs for a section during the first phase, and + allocate space in the global offset table or procedure linkage + table. */ +/* XXX hack alert bogus This routine is mostly all junk and almost + * certainly does the wrong thing. Its here simply because it does + * just enough to allow glibc-2.1 ld.so to compile & link. + */ + +static bfd_boolean +i370_elf_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + bfd *dynobj; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + bfd_vma *local_got_offsets; + asection *sreloc; + + if (info->relocatable) + return TRUE; + +#ifdef DEBUG + fprintf (stderr, "i370_elf_check_relocs called for section %s in %s\n", + bfd_get_section_name (abfd, sec), + bfd_archive_filename (abfd)); +#endif + + dynobj = elf_hash_table (info)->dynobj; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + local_got_offsets = elf_local_got_offsets (abfd); + + sreloc = NULL; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + unsigned long r_symndx; + struct elf_link_hash_entry *h; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + if (info->shared) + { +#ifdef DEBUG + fprintf (stderr, + "i370_elf_check_relocs needs to create relocation for %s\n", + (h && h->root.root.string) + ? h->root.root.string : ""); +#endif + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) + { + flagword flags; + + sreloc = bfd_make_section (dynobj, name); + flags = (SEC_HAS_CONTENTS | SEC_READONLY + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if ((sec->flags & SEC_ALLOC) != 0) + flags |= SEC_ALLOC | SEC_LOAD; + if (sreloc == NULL + || ! bfd_set_section_flags (dynobj, sreloc, flags) + || ! bfd_set_section_alignment (dynobj, sreloc, 2)) + return FALSE; + } + } + + sreloc->_raw_size += sizeof (Elf32_External_Rela); + + /* FIXME: We should here do what the m68k and i386 + backends do: if the reloc is pc-relative, record it + in case it turns out that the reloc is unnecessary + because the symbol is forced local by versioning or + we are linking with -Bdynamic. Fortunately this + case is not frequent. */ + } + } + + return TRUE; +} + +/* Finish up the dynamic sections. */ +/* XXX hack alert bogus This routine is mostly all junk and almost + * certainly does the wrong thing. Its here simply because it does + * just enough to allow glibc-2.1 ld.so to compile & link. + */ + +static bfd_boolean +i370_elf_finish_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + asection *sdyn; + bfd *dynobj = elf_hash_table (info)->dynobj; + asection *sgot = bfd_get_section_by_name (dynobj, ".got"); + +#ifdef DEBUG + fprintf (stderr, "i370_elf_finish_dynamic_sections called\n"); +#endif + + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (elf_hash_table (info)->dynamic_sections_created) + { + asection *splt; + Elf32_External_Dyn *dyncon, *dynconend; + + splt = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (splt != NULL && sdyn != NULL); + + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + const char *name; + bfd_boolean size; + + bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + case DT_PLTGOT: name = ".plt"; size = FALSE; break; + case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break; + case DT_JMPREL: name = ".rela.plt"; size = FALSE; break; + default: name = NULL; size = FALSE; break; + } + + if (name != NULL) + { + asection *s; + + s = bfd_get_section_by_name (output_bfd, name); + if (s == NULL) + dyn.d_un.d_val = 0; + else + { + if (! size) + dyn.d_un.d_ptr = s->vma; + else + { + if (s->_cooked_size != 0) + dyn.d_un.d_val = s->_cooked_size; + else + dyn.d_un.d_val = s->_raw_size; + } + } + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + } + } + } + + /* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 so that a function can + easily find the address of the _GLOBAL_OFFSET_TABLE_. */ +/* XXX this is clearly very wrong for the 370 arch */ + if (sgot) + { + unsigned char *contents = sgot->contents; + bfd_put_32 (output_bfd, (bfd_vma) 0x4e800021 /* blrl */, contents); + + if (sdyn == NULL) + bfd_put_32 (output_bfd, (bfd_vma) 0, contents+4); + else + bfd_put_32 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + contents+4); + + elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; + } + + if (info->shared) + { + asection *sdynsym; + asection *s; + Elf_Internal_Sym sym; + int maxdindx = 0; + + /* Set up the section symbols for the output sections. */ + + sdynsym = bfd_get_section_by_name (dynobj, ".dynsym"); + BFD_ASSERT (sdynsym != NULL); + + sym.st_size = 0; + sym.st_name = 0; + sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); + sym.st_other = 0; + + for (s = output_bfd->sections; s != NULL; s = s->next) + { + int indx, dindx; + Elf32_External_Sym *esym; + + sym.st_value = s->vma; + + indx = elf_section_data (s)->this_idx; + dindx = elf_section_data (s)->dynindx; + if (dindx != -1) + { + BFD_ASSERT(indx > 0); + BFD_ASSERT(dindx > 0); + + if (dindx > maxdindx) + maxdindx = dindx; + + sym.st_shndx = indx; + + esym = (Elf32_External_Sym *) sdynsym->contents + dindx; + bfd_elf32_swap_symbol_out (output_bfd, &sym, (PTR) esym, (PTR) 0); + } + } + + /* Set the sh_info field of the output .dynsym section to the + index of the first global symbol. */ + elf_section_data (sdynsym->output_section)->this_hdr.sh_info = + maxdindx + 1; + } + + return TRUE; +} + +/* The RELOCATE_SECTION function is called by the ELF backend linker + to handle the relocations for a section. + + The relocs are always passed as Rela structures; if the section + actually uses Rel structures, the r_addend field will always be + zero. + + This function is responsible for adjust the section contents as + necessary, and (if using Rela relocs and generating a + relocatable output file) adjusting the reloc addend as + necessary. + + This function does not have to worry about setting the reloc + address or the reloc symbol index. + + LOCAL_SYMS is a pointer to the swapped in local symbols. + + LOCAL_SECTIONS is an array giving the section in the input file + corresponding to the st_shndx field of each local symbol. + + The global hash table entry for the global symbols can be found + via elf_sym_hashes (input_bfd). + + When generating relocatable output, this function must handle + STB_LOCAL/STT_SECTION symbols specially. The output symbol is + going to be the section symbol corresponding to the output + section, which means that the addend must be adjusted + accordingly. */ + +static bfd_boolean +i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd); + bfd *dynobj = elf_hash_table (info)->dynobj; + Elf_Internal_Rela *rel = relocs; + Elf_Internal_Rela *relend = relocs + input_section->reloc_count; + asection *sreloc = NULL; + bfd_vma *local_got_offsets; + bfd_boolean ret = TRUE; + + if (info->relocatable) + return TRUE; + +#ifdef DEBUG + fprintf (stderr, "i370_elf_relocate_section called for %s section %s, %ld relocations%s\n", + bfd_archive_filename (input_bfd), + bfd_section_name(input_bfd, input_section), + (long) input_section->reloc_count, + (info->relocatable) ? " (relocatable)" : ""); +#endif + + if (!i370_elf_howto_table[ R_I370_ADDR31 ]) /* Initialize howto table if needed */ + i370_elf_howto_init (); + + local_got_offsets = elf_local_got_offsets (input_bfd); + + for (; rel < relend; rel++) + { + enum i370_reloc_type r_type = (enum i370_reloc_type)ELF32_R_TYPE (rel->r_info); + bfd_vma offset = rel->r_offset; + bfd_vma addend = rel->r_addend; + bfd_reloc_status_type r = bfd_reloc_other; + Elf_Internal_Sym *sym = (Elf_Internal_Sym *)0; + asection *sec = (asection *)0; + struct elf_link_hash_entry *h = (struct elf_link_hash_entry *)0; + const char *sym_name = (const char *)0; + reloc_howto_type *howto; + unsigned long r_symndx; + bfd_vma relocation; + + /* Unknown relocation handling */ + if ((unsigned)r_type >= (unsigned)R_I370_max + || !i370_elf_howto_table[(int)r_type]) + { + (*_bfd_error_handler) ("%s: unknown relocation type %d", + bfd_archive_filename (input_bfd), + (int) r_type); + + bfd_set_error (bfd_error_bad_value); + ret = FALSE; + continue; + } + + howto = i370_elf_howto_table[(int)r_type]; + r_symndx = ELF32_R_SYM (rel->r_info); + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + sym_name = ""; + + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + addend = rel->r_addend; + } + else + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + sym_name = h->root.root.string; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + if (info->shared + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) + && (input_section->flags & SEC_ALLOC) != 0 + && (r_type == R_I370_ADDR31 + || r_type == R_I370_COPY + || r_type == R_I370_ADDR16 + || r_type == R_I370_RELATIVE)) + { + /* In these cases, we don't need the relocation + value. We check specially because in some + obscure cases sec->output_section will be NULL. */ + relocation = 0; + } + else + relocation = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else if (h->root.type == bfd_link_hash_undefweak) + relocation = 0; + else if (info->unresolved_syms_in_objects == RM_IGNORE + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + relocation = 0; + else + { + if ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, + (info->unresolved_syms_in_objects == RM_GENERATE_ERROR + || ELF_ST_VISIBILITY (h->other)))) + { + ret = FALSE; + continue; + } + relocation = 0; + } + } + + switch ((int) r_type) + { + default: + (*_bfd_error_handler) + ("%s: unknown relocation type %d for symbol %s", + bfd_archive_filename (input_bfd), + (int) r_type, sym_name); + + bfd_set_error (bfd_error_bad_value); + ret = FALSE; + continue; + + case (int)R_I370_NONE: + continue; + + /* Relocations that may need to be propagated if this is a shared + object. */ + case (int)R_I370_REL31: + /* If these relocations are not to a named symbol, they can be + handled right here, no need to bother the dynamic linker. */ + if (h == NULL + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + break; + /* fall through */ + + /* Relocations that always need to be propagated if this is a shared + object. */ + case (int)R_I370_ADDR31: + case (int)R_I370_ADDR16: + if (info->shared + && r_symndx != 0) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + int skip; + +#ifdef DEBUG + fprintf (stderr, + "i370_elf_relocate_section needs to create relocation for %s\n", + (h && h->root.root.string) ? h->root.root.string : ""); +#endif + + /* When generating a shared object, these relocations + are copied into the output file to be resolved at run + time. */ + + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (input_bfd, + elf_elfheader (input_bfd)->e_shstrndx, + elf_section_data (input_section)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (input_bfd, + input_section), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + BFD_ASSERT (sreloc != NULL); + } + + skip = 0; + + outrel.r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, + rel->r_offset); + if (outrel.r_offset == (bfd_vma) -1 + || outrel.r_offset == (bfd_vma) -2) + skip = (int) outrel.r_offset; + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + /* h->dynindx may be -1 if this symbol was marked to + become local. */ + else if (h != NULL + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + { + BFD_ASSERT (h->dynindx != -1); + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + outrel.r_addend = rel->r_addend; + } + else + { + if (r_type == R_I370_ADDR31) + { + outrel.r_info = ELF32_R_INFO (0, R_I370_RELATIVE); + outrel.r_addend = relocation + rel->r_addend; + } + else + { + long indx; + + if (bfd_is_abs_section (sec)) + indx = 0; + else if (sec == NULL || sec->owner == NULL) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + else + { + asection *osec; + + osec = sec->output_section; + indx = elf_section_data (osec)->dynindx; + BFD_ASSERT(indx > 0); +#ifdef DEBUG + if (indx <= 0) + { + printf ("indx=%d section=%s flags=%08x name=%s\n", + indx, osec->name, osec->flags, + h->root.root.string); + } +#endif + } + + outrel.r_info = ELF32_R_INFO (indx, r_type); + outrel.r_addend = relocation + rel->r_addend; + } + } + + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + + /* This reloc will be computed at runtime, so there's no + need to do anything now, unless this is a RELATIVE + reloc in an unallocated section. */ + if (skip == -1 + || (input_section->flags & SEC_ALLOC) != 0 + || ELF32_R_TYPE (outrel.r_info) != R_I370_RELATIVE) + continue; + } + break; + + case (int)R_I370_COPY: + case (int)R_I370_RELATIVE: + (*_bfd_error_handler) + ("%s: Relocation %s is not yet supported for symbol %s.", + bfd_archive_filename (input_bfd), + i370_elf_howto_table[(int) r_type]->name, + sym_name); + + bfd_set_error (bfd_error_invalid_operation); + ret = FALSE; + continue; + } + +#ifdef DEBUG + fprintf (stderr, "\ttype = %s (%d), name = %s, symbol index = %ld, offset = %ld, addend = %ld\n", + howto->name, + (int)r_type, + sym_name, + r_symndx, + (long)offset, + (long)addend); +#endif + + r = _bfd_final_link_relocate (howto, + input_bfd, + input_section, + contents, + offset, + relocation, + addend); + + if (r != bfd_reloc_ok) + { + ret = FALSE; + switch (r) + { + default: + break; + + case bfd_reloc_overflow: + { + const char *name; + + if (h != NULL) + name = h->root.root.string; + else + { + name = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name); + if (name == NULL) + break; + + if (*name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + (*info->callbacks->reloc_overflow) (info, + name, + howto->name, + (bfd_vma) 0, + input_bfd, + input_section, + offset); + } + break; + + } + } + } + +#ifdef DEBUG + fprintf (stderr, "\n"); +#endif + + return ret; +} + +static void +i370_elf_post_process_headers (abfd, link_info) + bfd * abfd; + struct bfd_link_info * link_info ATTRIBUTE_UNUSED; +{ + Elf_Internal_Ehdr * i_ehdrp; /* Elf file header, internal form */ + + i_ehdrp = elf_elfheader (abfd); + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_LINUX; +} + +#define TARGET_BIG_SYM bfd_elf32_i370_vec +#define TARGET_BIG_NAME "elf32-i370" +#define ELF_ARCH bfd_arch_i370 +#define ELF_MACHINE_CODE EM_S370 +#ifdef EM_I370_OLD +#define ELF_MACHINE_ALT1 EM_I370_OLD +#endif +#define ELF_MAXPAGESIZE 0x1000 +#define elf_info_to_howto i370_elf_info_to_howto + +#define elf_backend_plt_not_loaded 1 +#define elf_backend_got_symbol_offset 4 +#define elf_backend_rela_normal 1 + +#define bfd_elf32_bfd_reloc_type_lookup i370_elf_reloc_type_lookup +#define bfd_elf32_bfd_set_private_flags i370_elf_set_private_flags +#define bfd_elf32_bfd_merge_private_bfd_data i370_elf_merge_private_bfd_data +#define elf_backend_relocate_section i370_elf_relocate_section + +/* dynamic loader support is mostly broken; just enough here to be able to + * link glibc's ld.so without errors. + */ +#define elf_backend_create_dynamic_sections i370_elf_create_dynamic_sections +#define elf_backend_size_dynamic_sections i370_elf_size_dynamic_sections +#define elf_backend_finish_dynamic_sections i370_elf_finish_dynamic_sections +#define elf_backend_fake_sections i370_elf_fake_sections +#define elf_backend_section_from_shdr i370_elf_section_from_shdr +#define elf_backend_adjust_dynamic_symbol i370_elf_adjust_dynamic_symbol +#define elf_backend_check_relocs i370_elf_check_relocs + +/* +#define elf_backend_add_symbol_hook i370_elf_add_symbol_hook +#define elf_backend_finish_dynamic_symbol i370_elf_finish_dynamic_symbol +#define elf_backend_additional_program_headers i370_elf_additional_program_headers +#define elf_backend_modify_segment_map i370_elf_modify_segment_map +*/ + +#define elf_backend_post_process_headers i370_elf_post_process_headers + +static int i370_noop + PARAMS ((void)); + +static int i370_noop () +{ + return 1; +} + +/* we need to define these at least as no-ops to link glibc ld.so */ + +#define elf_backend_add_symbol_hook \ + (bfd_boolean (*) \ + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *, \ + const char **, flagword *, asection **, bfd_vma *))) i370_noop +#define elf_backend_finish_dynamic_symbol \ + (bfd_boolean (*) \ + PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, \ + Elf_Internal_Sym *))) i370_noop +#define elf_backend_additional_program_headers \ + (int (*) PARAMS ((bfd *))) i370_noop +#define elf_backend_modify_segment_map \ + (bfd_boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) i370_noop + +#include "elf32-target.h" diff --git a/bfd/elf32-i386-fbsd.c b/bfd/elf32-i386-fbsd.c deleted file mode 100644 index 500e0ebc04853..0000000000000 --- a/bfd/elf32-i386-fbsd.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Intel IA-32 specific support for 32-bit ELF on FreeBSD. - Copyright 2002 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; 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. */ - -#define TARGET_LITTLE_SYM bfd_elf32_i386_freebsd_vec -#define TARGET_LITTLE_NAME "elf32-i386-freebsd" -#define ELF_ARCH bfd_arch_i386 -#define ELF_MACHINE_CODE EM_386 -#define ELF_MAXPAGESIZE 0x1000 - -#include "bfd.h" -#include "sysdep.h" -#include "elf-bfd.h" - -/* The kernel recognizes executables as valid only if they carry a - "FreeBSD" label in the ELF header. So we put this label on all - executables and (for simplicity) also all other object files. */ - -static void elf_i386_post_process_headers - PARAMS ((bfd *, struct bfd_link_info *)); - -static void -elf_i386_post_process_headers (abfd, link_info) - bfd * abfd; - struct bfd_link_info * link_info ATTRIBUTE_UNUSED; -{ - Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */ - - i_ehdrp = elf_elfheader (abfd); - - /* Put an ABI label supported by FreeBSD >= 4.1. */ - i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; -#ifdef OLD_FREEBSD_ABI_LABEL - /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */ - memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8); -#endif -} - -#define elf_backend_post_process_headers elf_i386_post_process_headers - -#include "elf32-i386.c" diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c new file mode 100644 index 0000000000000..f156bc51e1ab8 --- /dev/null +++ b/bfd/elf32-i860.c @@ -0,0 +1,1253 @@ +/* Intel i860 specific support for 32-bit ELF. + Copyright 1993, 1995, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + + Full i860 support contributed by Jason Eckhardt . + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/i860.h" + +/* special_function for R_860_PC26 relocation. */ +static bfd_reloc_status_type +i860_howto_pc26_reloc (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry, + asymbol *symbol, + void *data ATTRIBUTE_UNUSED, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + bfd_vma insn; + bfd_vma relocation; + bfd_byte *addr; + + if (output_bfd != NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc_entry->howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* Used elf32-mips.c as an example. */ + if (bfd_is_und_section (symbol->section) + && output_bfd == (bfd *) NULL) + return bfd_reloc_undefined; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + /* Adjust for PC-relative relocation. */ + relocation -= (input_section->output_section->vma + + input_section->output_offset + + reloc_entry->address + + 4); + + /* Check for target out of range. */ + if ((bfd_signed_vma)relocation > (0x3ffffff << 2) + || (bfd_signed_vma)relocation < (-0x4000000 << 2)) + return bfd_reloc_outofrange; + + addr = (bfd_byte *) data + reloc_entry->address; + insn = bfd_get_32 (abfd, addr); + + relocation >>= reloc_entry->howto->rightshift; + insn = (insn & ~reloc_entry->howto->dst_mask) + | (relocation & reloc_entry->howto->dst_mask); + + bfd_put_32 (abfd, (bfd_vma) insn, addr); + + return bfd_reloc_ok; +} + +/* special_function for R_860_PC16 relocation. */ +static bfd_reloc_status_type +i860_howto_pc16_reloc (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void *data, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + bfd_vma insn; + bfd_vma relocation; + bfd_byte *addr; + + if (output_bfd != NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc_entry->howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* Used elf32-mips.c as an example. */ + if (bfd_is_und_section (symbol->section) + && output_bfd == (bfd *) NULL) + return bfd_reloc_undefined; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + /* Adjust for PC-relative relocation. */ + relocation -= (input_section->output_section->vma + + input_section->output_offset + + reloc_entry->address + + 4); + + /* Check for target out of range. */ + if ((bfd_signed_vma)relocation > (0x7fff << 2) + || (bfd_signed_vma)relocation < (-0x8000 << 2)) + return bfd_reloc_outofrange; + + addr = (bfd_byte *) data + reloc_entry->address; + insn = bfd_get_32 (abfd, addr); + + relocation >>= reloc_entry->howto->rightshift; + relocation = (((relocation & 0xf800) << 5) | (relocation & 0x7ff)) + & reloc_entry->howto->dst_mask; + insn = (insn & ~reloc_entry->howto->dst_mask) | relocation; + + bfd_put_32 (abfd, (bfd_vma) insn, addr); + + return bfd_reloc_ok; +} + +/* special_function for R_860_HIGHADJ relocation. */ +static bfd_reloc_status_type +i860_howto_highadj_reloc (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void *data, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + bfd_vma insn; + bfd_vma relocation; + bfd_byte *addr; + + if (output_bfd != NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc_entry->howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* Used elf32-mips.c as an example. */ + if (bfd_is_und_section (symbol->section) + && output_bfd == (bfd *) NULL) + return bfd_reloc_undefined; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + relocation += 0x8000; + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + addr = (bfd_byte *) data + reloc_entry->address; + insn = bfd_get_32 (abfd, addr); + + relocation = ((relocation >> 16) & 0xffff); + + insn = (insn & 0xffff0000) | relocation; + + bfd_put_32 (abfd, (bfd_vma) insn, addr); + + return bfd_reloc_ok; +} + +/* special_function for R_860_SPLITn relocations. */ +static bfd_reloc_status_type +i860_howto_splitn_reloc (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void *data, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + bfd_vma insn; + bfd_vma relocation; + bfd_byte *addr; + + if (output_bfd != NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc_entry->howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* Used elf32-mips.c as an example. */ + if (bfd_is_und_section (symbol->section) + && output_bfd == (bfd *) NULL) + return bfd_reloc_undefined; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + addr = (bfd_byte *) data + reloc_entry->address; + insn = bfd_get_32 (abfd, addr); + + relocation = (((relocation & 0xf800) << 5) | (relocation & 0x7ff)) + & reloc_entry->howto->dst_mask; + insn = (insn & ~reloc_entry->howto->dst_mask) | relocation; + + bfd_put_32 (abfd, (bfd_vma) insn, addr); + + return bfd_reloc_ok; +} + +/* This howto table is preliminary. */ +static reloc_howto_type elf32_i860_howto_table [] = +{ + /* This relocation does nothing. */ + HOWTO (R_860_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32-bit absolute relocation. */ + HOWTO (R_860_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_COPY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_COPY", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_GLOB_DAT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_GLOB_DAT", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_JUMP_SLOT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_JUMP_SLOT", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_RELATIVE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_RELATIVE", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 26-bit PC-relative relocation. */ + HOWTO (R_860_PC26, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + i860_howto_pc26_reloc, /* special_function */ + "R_860_PC26", /* name */ + FALSE, /* partial_inplace */ + 0x3ffffff, /* src_mask */ + 0x3ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_860_PLT26, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_PLT26", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 16-bit PC-relative relocation. */ + HOWTO (R_860_PC16, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + i860_howto_pc16_reloc, /* special_function */ + "R_860_PC16", /* name */ + FALSE, /* partial_inplace */ + 0x1f07ff, /* src_mask */ + 0x1f07ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_860_LOW0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_LOW0", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_SPLIT0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + i860_howto_splitn_reloc, /* special_function */ + "R_860_SPLIT0", /* name */ + FALSE, /* partial_inplace */ + 0x1f07ff, /* src_mask */ + 0x1f07ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_LOW1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_LOW1", /* name */ + FALSE, /* partial_inplace */ + 0xfffe, /* src_mask */ + 0xfffe, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_SPLIT1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + i860_howto_splitn_reloc, /* special_function */ + "R_860_SPLIT1", /* name */ + FALSE, /* partial_inplace */ + 0x1f07fe, /* src_mask */ + 0x1f07fe, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_LOW2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_LOW2", /* name */ + FALSE, /* partial_inplace */ + 0xfffc, /* src_mask */ + 0xfffc, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_SPLIT2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + i860_howto_splitn_reloc, /* special_function */ + "R_860_SPLIT2", /* name */ + FALSE, /* partial_inplace */ + 0x1f07fc, /* src_mask */ + 0x1f07fc, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_LOW3, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_LOW3", /* name */ + FALSE, /* partial_inplace */ + 0xfff8, /* src_mask */ + 0xfff8, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_LOGOT0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_LOGOT0", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_860_SPGOT0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_SPGOT0", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_860_LOGOT1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_LOGOT1", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_860_SPGOT1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_SPGOT1", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_860_LOGOTOFF0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_LOGOTOFF0", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_SPGOTOFF0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_SPGOTOFF0", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_LOGOTOFF1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_LOGOTOFF1", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_SPGOTOFF1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_SPGOTOFF1", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_LOGOTOFF2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_LOGOTOFF2", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_LOGOTOFF3, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_LOGOTOFF3", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_LOPC, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_LOPC", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_860_HIGHADJ, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + i860_howto_highadj_reloc, /* special_function */ + "R_860_HIGHADJ", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_HAGOT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_HAGOT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_860_HAGOTOFF, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_HAGOTOFF", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_HAPC, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_HAPC", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_860_HIGH, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_HIGH", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_860_HIGOT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_HIGOT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_860_HIGOTOFF, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_860_HIGOTOFF", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; + +static unsigned char elf_code_to_howto_index[R_860_max + 1]; + +static reloc_howto_type * +lookup_howto (unsigned int rtype) +{ + static int initialized = 0; + int i; + int howto_tbl_size = (int) (sizeof (elf32_i860_howto_table) + / sizeof (elf32_i860_howto_table[0])); + + if (! initialized) + { + initialized = 1; + memset (elf_code_to_howto_index, 0xff, + sizeof (elf_code_to_howto_index)); + for (i = 0; i < howto_tbl_size; i++) + elf_code_to_howto_index[elf32_i860_howto_table[i].type] = i; + } + + BFD_ASSERT (rtype <= R_860_max); + i = elf_code_to_howto_index[rtype]; + if (i >= howto_tbl_size) + return 0; + return elf32_i860_howto_table + i; +} + +/* Given a BFD reloc, return the matching HOWTO structure. */ +static reloc_howto_type * +elf32_i860_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + unsigned int rtype; + + switch (code) + { + case BFD_RELOC_NONE: + rtype = R_860_NONE; + break; + case BFD_RELOC_32: + rtype = R_860_32; + break; + case BFD_RELOC_860_COPY: + rtype = R_860_COPY; + break; + case BFD_RELOC_860_GLOB_DAT: + rtype = R_860_GLOB_DAT; + break; + case BFD_RELOC_860_JUMP_SLOT: + rtype = R_860_JUMP_SLOT; + break; + case BFD_RELOC_860_RELATIVE: + rtype = R_860_RELATIVE; + break; + case BFD_RELOC_860_PC26: + rtype = R_860_PC26; + break; + case BFD_RELOC_860_PLT26: + rtype = R_860_PLT26; + break; + case BFD_RELOC_860_PC16: + rtype = R_860_PC16; + break; + case BFD_RELOC_860_LOW0: + rtype = R_860_LOW0; + break; + case BFD_RELOC_860_SPLIT0: + rtype = R_860_SPLIT0; + break; + case BFD_RELOC_860_LOW1: + rtype = R_860_LOW1; + break; + case BFD_RELOC_860_SPLIT1: + rtype = R_860_SPLIT1; + break; + case BFD_RELOC_860_LOW2: + rtype = R_860_LOW2; + break; + case BFD_RELOC_860_SPLIT2: + rtype = R_860_SPLIT2; + break; + case BFD_RELOC_860_LOW3: + rtype = R_860_LOW3; + break; + case BFD_RELOC_860_LOGOT0: + rtype = R_860_LOGOT0; + break; + case BFD_RELOC_860_SPGOT0: + rtype = R_860_SPGOT0; + break; + case BFD_RELOC_860_LOGOT1: + rtype = R_860_LOGOT1; + break; + case BFD_RELOC_860_SPGOT1: + rtype = R_860_SPGOT1; + break; + case BFD_RELOC_860_LOGOTOFF0: + rtype = R_860_LOGOTOFF0; + break; + case BFD_RELOC_860_SPGOTOFF0: + rtype = R_860_SPGOTOFF0; + break; + case BFD_RELOC_860_LOGOTOFF1: + rtype = R_860_LOGOTOFF1; + break; + case BFD_RELOC_860_SPGOTOFF1: + rtype = R_860_SPGOTOFF1; + break; + case BFD_RELOC_860_LOGOTOFF2: + rtype = R_860_LOGOTOFF2; + break; + case BFD_RELOC_860_LOGOTOFF3: + rtype = R_860_LOGOTOFF3; + break; + case BFD_RELOC_860_LOPC: + rtype = R_860_LOPC; + break; + case BFD_RELOC_860_HIGHADJ: + rtype = R_860_HIGHADJ; + break; + case BFD_RELOC_860_HAGOT: + rtype = R_860_HAGOT; + break; + case BFD_RELOC_860_HAGOTOFF: + rtype = R_860_HAGOTOFF; + break; + case BFD_RELOC_860_HAPC: + rtype = R_860_HAPC; + break; + case BFD_RELOC_860_HIGH: + rtype = R_860_HIGH; + break; + case BFD_RELOC_860_HIGOT: + rtype = R_860_HIGOT; + break; + case BFD_RELOC_860_HIGOTOFF: + rtype = R_860_HIGOTOFF; + break; + default: + rtype = 0; + break; + } + return lookup_howto (rtype); +} + +/* Given a ELF reloc, return the matching HOWTO structure. */ +static void +elf32_i860_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, + arelent *bfd_reloc, + Elf_Internal_Rela *elf_reloc) +{ + bfd_reloc->howto + = lookup_howto ((unsigned) ELF32_R_TYPE (elf_reloc->r_info)); +} + +/* Specialized relocation handler for R_860_SPLITn. These relocations + involves a 16-bit field that is split into two contiguous parts. */ +static bfd_reloc_status_type +elf32_i860_relocate_splitn (bfd *input_bfd, + Elf_Internal_Rela *rello, + bfd_byte *contents, + bfd_vma value) +{ + bfd_vma insn; + reloc_howto_type *howto; + howto = lookup_howto ((unsigned) ELF32_R_TYPE (rello->r_info)); + insn = bfd_get_32 (input_bfd, contents + rello->r_offset); + + /* Relocate. */ + value += rello->r_addend; + + /* Separate the fields and insert. */ + value = (((value & 0xf800) << 5) | (value & 0x7ff)) & howto->dst_mask; + insn = (insn & ~howto->dst_mask) | value; + + bfd_put_32 (input_bfd, insn, contents + rello->r_offset); + return bfd_reloc_ok; +} + +/* Specialized relocation handler for R_860_PC16. This relocation + involves a 16-bit, PC-relative field that is split into two contiguous + parts. */ +static bfd_reloc_status_type +elf32_i860_relocate_pc16 (bfd *input_bfd, + asection *input_section, + Elf_Internal_Rela *rello, + bfd_byte *contents, + bfd_vma value) +{ + bfd_vma insn; + reloc_howto_type *howto; + howto = lookup_howto ((unsigned) ELF32_R_TYPE (rello->r_info)); + insn = bfd_get_32 (input_bfd, contents + rello->r_offset); + + /* Adjust for PC-relative relocation. */ + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= rello->r_offset; + + /* Relocate. */ + value += rello->r_addend; + + /* Adjust the value by 4, then separate the fields and insert. */ + value = (value - 4) >> howto->rightshift; + value = (((value & 0xf800) << 5) | (value & 0x7ff)) & howto->dst_mask; + insn = (insn & ~howto->dst_mask) | value; + + bfd_put_32 (input_bfd, insn, contents + rello->r_offset); + return bfd_reloc_ok; + +} + +/* Specialized relocation handler for R_860_PC26. This relocation + involves a 26-bit, PC-relative field which must be adjusted by 4. */ +static bfd_reloc_status_type +elf32_i860_relocate_pc26 (bfd *input_bfd, + asection *input_section, + Elf_Internal_Rela *rello, + bfd_byte *contents, + bfd_vma value) +{ + bfd_vma insn; + reloc_howto_type *howto; + howto = lookup_howto ((unsigned) ELF32_R_TYPE (rello->r_info)); + insn = bfd_get_32 (input_bfd, contents + rello->r_offset); + + /* Adjust for PC-relative relocation. */ + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= rello->r_offset; + + /* Relocate. */ + value += rello->r_addend; + + /* Adjust value by 4 and insert the field. */ + value = ((value - 4) >> howto->rightshift) & howto->dst_mask; + insn = (insn & ~howto->dst_mask) | value; + + bfd_put_32 (input_bfd, insn, contents + rello->r_offset); + return bfd_reloc_ok; + +} + +/* Specialized relocation handler for R_860_HIGHADJ. */ +static bfd_reloc_status_type +elf32_i860_relocate_highadj (bfd *input_bfd, + Elf_Internal_Rela *rel, + bfd_byte *contents, + bfd_vma value) +{ + bfd_vma insn; + + insn = bfd_get_32 (input_bfd, contents + rel->r_offset); + + value += rel->r_addend; + value += 0x8000; + value = ((value >> 16) & 0xffff); + + insn = (insn & 0xffff0000) | value; + + bfd_put_32 (input_bfd, insn, contents + rel->r_offset); + return bfd_reloc_ok; +} + +/* Perform a single relocation. By default we use the standard BFD + routines. However, we handle some specially. */ +static bfd_reloc_status_type +i860_final_link_relocate (reloc_howto_type *howto, + bfd *input_bfd, + asection *input_section, + bfd_byte *contents, + Elf_Internal_Rela *rel, + bfd_vma relocation) +{ + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, relocation, + rel->r_addend); +} + +/* Relocate an i860 ELF section. + + This is boiler-plate code copied from fr30. + + The RELOCATE_SECTION function is called by the new ELF backend linker + to handle the relocations for a section. + + The relocs are always passed as Rela structures; if the section + actually uses Rel structures, the r_addend field will always be + zero. + + This function is responsible for adjusting the section contents as + necessary, and (if using Rela relocs and generating a relocatable + output file) adjusting the reloc addend as necessary. + + This function does not have to worry about setting the reloc + address or the reloc symbol index. + + LOCAL_SYMS is a pointer to the swapped in local symbols. + + LOCAL_SECTIONS is an array giving the section in the input file + corresponding to the st_shndx field of each local symbol. + + The global hash table entry for the global symbols can be found + via elf_sym_hashes (input_bfd). + + When generating relocatable output, this function must handle + STB_LOCAL/STT_SECTION symbols specially. The output symbol is + going to be the section symbol corresponding to the output + section, which means that the addend must be adjusted + accordingly. */ +static bfd_boolean +elf32_i860_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info, + bfd *input_bfd, + asection *input_section, + bfd_byte *contents, + Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + + if (info->relocatable) + return TRUE; + + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + relend = relocs + input_section->reloc_count; + + for (rel = relocs; rel < relend; rel ++) + { + reloc_howto_type * howto; + unsigned long r_symndx; + Elf_Internal_Sym * sym; + asection * sec; + struct elf_link_hash_entry * h; + bfd_vma relocation; + bfd_reloc_status_type r; + const char * name = NULL; + int r_type; + + r_type = ELF32_R_TYPE (rel->r_info); + +#if 0 + if ( r_type == R_860_GNU_VTINHERIT + || r_type == R_860_GNU_VTENTRY) + continue; +#endif + + r_symndx = ELF32_R_SYM (rel->r_info); + + howto = lookup_howto ((unsigned) ELF32_R_TYPE (rel->r_info)); + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); + name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + } + else + { + bfd_boolean unresolved_reloc, warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + } + + switch (r_type) + { + default: + r = i860_final_link_relocate (howto, input_bfd, input_section, + contents, rel, relocation); + break; + + case R_860_HIGHADJ: + r = elf32_i860_relocate_highadj (input_bfd, rel, contents, + relocation); + break; + + case R_860_PC16: + r = elf32_i860_relocate_pc16 (input_bfd, input_section, rel, + contents, relocation); + break; + + case R_860_PC26: + r = elf32_i860_relocate_pc26 (input_bfd, input_section, rel, + contents, relocation); + break; + + case R_860_SPLIT0: + case R_860_SPLIT1: + case R_860_SPLIT2: + r = elf32_i860_relocate_splitn (input_bfd, rel, contents, + relocation); + break; + + /* We do not yet handle GOT/PLT/Dynamic relocations. */ + case R_860_COPY: + case R_860_GLOB_DAT: + case R_860_JUMP_SLOT: + case R_860_RELATIVE: + case R_860_PLT26: + case R_860_LOGOT0: + case R_860_SPGOT0: + case R_860_LOGOT1: + case R_860_SPGOT1: + case R_860_LOGOTOFF0: + case R_860_SPGOTOFF0: + case R_860_LOGOTOFF1: + case R_860_SPGOTOFF1: + case R_860_LOGOTOFF2: + case R_860_LOGOTOFF3: + case R_860_LOPC: + case R_860_HAGOT: + case R_860_HAGOTOFF: + case R_860_HAPC: + case R_860_HIGOT: + case R_860_HIGOTOFF: + r = bfd_reloc_notsupported; + break; + } + + if (r != bfd_reloc_ok) + { + const char * msg = (const char *) NULL; + + switch (r) + { + case bfd_reloc_overflow: + r = info->callbacks->reloc_overflow + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset); + break; + + case bfd_reloc_undefined: + r = info->callbacks->undefined_symbol + (info, name, input_bfd, input_section, rel->r_offset, TRUE); + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + break; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + break; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous relocation"); + break; + + default: + msg = _("internal error: unknown error"); + break; + } + + if (msg) + r = info->callbacks->warning + (info, msg, name, input_bfd, input_section, rel->r_offset); + + if (! r) + return FALSE; + } + } + + return TRUE; +} + +/* Return whether a symbol name implies a local label. SVR4/860 compilers + generate labels of the form ".ep.function_name" to denote the end of a + function prolog. These should be local. + ??? Do any other SVR4 compilers have this convention? If so, this should + be added to the generic routine. */ +static bfd_boolean +elf32_i860_is_local_label_name (bfd *abfd, const char *name) +{ + if (name[0] == '.' && name[1] == 'e' && name[2] == 'p' && name[3] == '.') + return TRUE; + + return _bfd_elf_is_local_label_name (abfd, name); +} + +#define TARGET_BIG_SYM bfd_elf32_i860_vec +#define TARGET_BIG_NAME "elf32-i860" +#define TARGET_LITTLE_SYM bfd_elf32_i860_little_vec +#define TARGET_LITTLE_NAME "elf32-i860-little" +#define ELF_ARCH bfd_arch_i860 +#define ELF_MACHINE_CODE EM_860 +#define ELF_MAXPAGESIZE 4096 + +#define elf_backend_rela_normal 1 +#define elf_info_to_howto_rel NULL +#define elf_info_to_howto elf32_i860_info_to_howto_rela +#define elf_backend_relocate_section elf32_i860_relocate_section +#define bfd_elf32_bfd_reloc_type_lookup elf32_i860_reloc_type_lookup +#define bfd_elf32_bfd_is_local_label_name elf32_i860_is_local_label_name + +#include "elf32-target.h" diff --git a/bfd/elf32-i960.c b/bfd/elf32-i960.c new file mode 100644 index 0000000000000..99e5585fdd9bf --- /dev/null +++ b/bfd/elf32-i960.c @@ -0,0 +1,166 @@ +/* Intel 960 specific support for 32-bit ELF + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/i960.h" + +static bfd_reloc_status_type elf32_i960_relocate + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static reloc_howto_type *elf32_i960_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void elf32_i960_info_to_howto + PARAMS ((bfd *, arelent *cache_ptr, Elf_Internal_Rela *)); +static void elf32_i960_info_to_howto_rel + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + +#define USE_REL 1 + +#define bfd_elf32_bfd_reloc_type_lookup elf32_i960_reloc_type_lookup +#define elf_info_to_howto elf32_i960_info_to_howto +#define elf_info_to_howto_rel elf32_i960_info_to_howto_rel + +static reloc_howto_type elf_howto_table[]= +{ + HOWTO(R_960_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, + elf32_i960_relocate, "R_960_NONE", TRUE, + 0x00000000, 0x00000000, FALSE), + EMPTY_HOWTO (1), + HOWTO (R_960_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, + elf32_i960_relocate, "R_960_32", TRUE, + 0xffffffff, 0xffffffff, FALSE), + HOWTO (R_960_IP24, 0, 2, 24, TRUE, 0, complain_overflow_signed, + elf32_i960_relocate, "R_960_IP24 ", TRUE, + 0x00ffffff, 0x00ffffff, FALSE), + EMPTY_HOWTO (4), + EMPTY_HOWTO (5), + EMPTY_HOWTO (6), + EMPTY_HOWTO (7) +}; + +static enum elf_i960_reloc_type +elf32_i960_bfd_to_reloc_type (bfd_reloc_code_real_type code) +{ + switch (code) + { + default: + return R_960_NONE; + case BFD_RELOC_I960_CALLJ: + return R_960_OPTCALL; + case BFD_RELOC_32: + case BFD_RELOC_CTOR: + return R_960_32; + case BFD_RELOC_24_PCREL: + return R_960_IP24; + } +} + +static void +elf32_i960_info_to_howto (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr ATTRIBUTE_UNUSED; + Elf_Internal_Rela *dst ATTRIBUTE_UNUSED; +{ + abort (); +} + +static void +elf32_i960_info_to_howto_rel (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + enum elf_i960_reloc_type type; + + type = (enum elf_i960_reloc_type) ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (type < R_960_max); + + cache_ptr->howto = &elf_howto_table[(int) type]; +} + +/* ELF relocs are against symbols. If we are producing relocatable + output, and the reloc is against an external symbol, and nothing + has given us any additional addend, the resulting reloc will also + be against the same symbol. In such a case, we don't want to + change anything about the way the reloc is handled, since it will + all be done at final link time. Rather than put special case code + into bfd_perform_relocation, all the reloc types use this howto + function. It just short circuits the reloc if producing + relocatable output against an external symbol. */ + +bfd_reloc_status_type +elf32_i960_relocate (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry; + asymbol *symbol; + PTR data ATTRIBUTE_UNUSED; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + /* HACK: I think this first condition is necessary when producing + relocatable output. After the end of HACK, the code is identical + to bfd_elf_generic_reloc(). I would _guess_ the first change + belongs there rather than here. martindo 1998-10-23. */ + if (output_bfd != (bfd *) NULL + && reloc_entry->howto->pc_relative + && !reloc_entry->howto->pcrel_offset) + { + reloc_entry->addend -= symbol->value; + } + /* This is more dubious. */ + else if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) != 0) + { + reloc_entry->addend -= symbol->section->output_section->vma; + } + else + { + /* end of HACK */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc_entry->howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + } + + return bfd_reloc_continue; +} + +static reloc_howto_type * +elf32_i960_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + return elf_howto_table + elf32_i960_bfd_to_reloc_type (code); +} + +#define TARGET_LITTLE_SYM bfd_elf32_i960_vec +#define TARGET_LITTLE_NAME "elf32-i960" +#define ELF_ARCH bfd_arch_i960 +#define ELF_MACHINE_CODE EM_960 +#define ELF_MAXPAGESIZE 1 /* FIXME: This number is wrong, It should be the page size in bytes. */ + +#include "elf32-target.h" diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c new file mode 100644 index 0000000000000..6493be6995915 --- /dev/null +++ b/bfd/elf32-ip2k.c @@ -0,0 +1,1675 @@ +/* Ubicom IP2xxx specific support for 32-bit ELF + Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/ip2k.h" + +/* Struct used to pass miscellaneous paramaters which + helps to avoid overly long parameter lists. */ +struct misc +{ + Elf_Internal_Shdr * symtab_hdr; + Elf_Internal_Rela * irelbase; + bfd_byte * contents; + Elf_Internal_Sym * isymbuf; +}; + +struct ip2k_opcode +{ + unsigned short opcode; + unsigned short mask; +}; + +/* Prototypes. */ +static reloc_howto_type *ip2k_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static int ip2k_is_opcode + PARAMS ((bfd_byte *, const struct ip2k_opcode *)); +static bfd_vma symbol_value + PARAMS ((bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *, + Elf_Internal_Rela *)); +static void ip2k_get_mem + PARAMS ((bfd *, bfd_byte *, int, bfd_byte *)); +static bfd_vma ip2k_nominal_page_bits + PARAMS ((bfd *, asection *, bfd_vma, bfd_byte *)); +static bfd_boolean ip2k_test_page_insn + PARAMS ((bfd *, asection *, Elf_Internal_Rela *, struct misc *)); +static bfd_boolean ip2k_delete_page_insn + PARAMS ((bfd *, asection *, Elf_Internal_Rela *, bfd_boolean *, struct misc *)); +static int ip2k_is_switch_table_128 + PARAMS ((bfd *, asection *, bfd_vma, bfd_byte *)); +static bfd_boolean ip2k_relax_switch_table_128 + PARAMS ((bfd *, asection *, Elf_Internal_Rela *, bfd_boolean *, struct misc *)); +static int ip2k_is_switch_table_256 + PARAMS ((bfd *, asection *, bfd_vma, bfd_byte *)); +static bfd_boolean ip2k_relax_switch_table_256 + PARAMS ((bfd *, asection *, Elf_Internal_Rela *, bfd_boolean *, struct misc *)); +static bfd_boolean ip2k_elf_relax_section + PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); +static bfd_boolean ip2k_elf_relax_section_page + PARAMS ((bfd *, asection *, bfd_boolean *, struct misc *, unsigned long, unsigned long)); +static void adjust_all_relocations + PARAMS ((bfd *, asection *, bfd_vma, bfd_vma, int, int)); +static bfd_boolean ip2k_elf_relax_delete_bytes + PARAMS ((bfd *, asection *, bfd_vma, int)); +static void ip2k_info_to_howto_rela + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static bfd_reloc_status_type ip2k_final_link_relocate + PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, bfd_vma)); +static bfd_boolean ip2k_elf_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static asection *ip2k_elf_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static bfd_boolean ip2k_elf_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); + +static bfd_boolean ip2k_relaxed = FALSE; + +static const struct ip2k_opcode ip2k_page_opcode[] = +{ + {0x0010, 0xFFF8}, /* page */ + {0x0000, 0x0000}, +}; + +#define IS_PAGE_OPCODE(code) \ + ip2k_is_opcode (code, ip2k_page_opcode) + +static const struct ip2k_opcode ip2k_jmp_opcode[] = +{ + {0xE000, 0xE000}, /* jmp */ + {0x0000, 0x0000}, +}; + +#define IS_JMP_OPCODE(code) \ + ip2k_is_opcode (code, ip2k_jmp_opcode) + +static const struct ip2k_opcode ip2k_call_opcode[] = +{ + {0xC000, 0xE000}, /* call */ + {0x0000, 0x0000}, +}; + +#define IS_CALL_OPCODE(code) \ + ip2k_is_opcode (code, ip2k_call_opcode) + +static const struct ip2k_opcode ip2k_snc_opcode[] = +{ + {0xA00B, 0xFFFF}, /* snc */ + {0x0000, 0x0000}, +}; + +#define IS_SNC_OPCODE(code) \ + ip2k_is_opcode (code, ip2k_snc_opcode) + +static const struct ip2k_opcode ip2k_inc_1sp_opcode[] = +{ + {0x2B81, 0xFFFF}, /* inc 1(SP) */ + {0x0000, 0x0000}, +}; + +#define IS_INC_1SP_OPCODE(code) \ + ip2k_is_opcode (code, ip2k_inc_1sp_opcode) + +static const struct ip2k_opcode ip2k_add_2sp_w_opcode[] = +{ + {0x1F82, 0xFFFF}, /* add 2(SP),w */ + {0x0000, 0x0000}, +}; + +#define IS_ADD_2SP_W_OPCODE(code) \ + ip2k_is_opcode (code, ip2k_add_2sp_w_opcode) + +static const struct ip2k_opcode ip2k_add_w_wreg_opcode[] = +{ + {0x1C0A, 0xFFFF}, /* add w,wreg */ + {0x1E0A, 0xFFFF}, /* add wreg,w */ + {0x0000, 0x0000}, +}; + +#define IS_ADD_W_WREG_OPCODE(code) \ + ip2k_is_opcode (code, ip2k_add_w_wreg_opcode) + +static const struct ip2k_opcode ip2k_add_pcl_w_opcode[] = +{ + {0x1E09, 0xFFFF}, /* add pcl,w */ + {0x0000, 0x0000}, +}; + +#define IS_ADD_PCL_W_OPCODE(code) \ + ip2k_is_opcode (code, ip2k_add_pcl_w_opcode) + +static const struct ip2k_opcode ip2k_skip_opcodes[] = +{ + {0xB000, 0xF000}, /* sb */ + {0xA000, 0xF000}, /* snb */ + {0x7600, 0xFE00}, /* cse/csne #lit */ + {0x5800, 0xFC00}, /* incsnz */ + {0x4C00, 0xFC00}, /* decsnz */ + {0x4000, 0xFC00}, /* cse/csne */ + {0x3C00, 0xFC00}, /* incsz */ + {0x2C00, 0xFC00}, /* decsz */ + {0x0000, 0x0000}, +}; + +#define IS_SKIP_OPCODE(code) \ + ip2k_is_opcode (code, ip2k_skip_opcodes) + +/* Relocation tables. */ +static reloc_howto_type ip2k_elf_howto_table [] = +{ +#define IP2K_HOWTO(t,rs,s,bs,pr,bp,name,sm,dm) \ + HOWTO(t, /* type */ \ + rs, /* rightshift */ \ + s, /* size (0 = byte, 1 = short, 2 = long) */ \ + bs, /* bitsize */ \ + pr, /* pc_relative */ \ + bp, /* bitpos */ \ + complain_overflow_dont,/* complain_on_overflow */ \ + bfd_elf_generic_reloc,/* special_function */ \ + name, /* name */ \ + FALSE, /* partial_inplace */ \ + sm, /* src_mask */ \ + dm, /* dst_mask */ \ + pr) /* pcrel_offset */ + + /* This reloc does nothing. */ + IP2K_HOWTO (R_IP2K_NONE, 0,2,32, FALSE, 0, "R_IP2K_NONE", 0, 0), + /* A 16 bit absolute relocation. */ + IP2K_HOWTO (R_IP2K_16, 0,1,16, FALSE, 0, "R_IP2K_16", 0, 0xffff), + /* A 32 bit absolute relocation. */ + IP2K_HOWTO (R_IP2K_32, 0,2,32, FALSE, 0, "R_IP2K_32", 0, 0xffffffff), + /* A 8-bit data relocation for the FR9 field. Ninth bit is computed specially. */ + IP2K_HOWTO (R_IP2K_FR9, 0,1,9, FALSE, 0, "R_IP2K_FR9", 0, 0x00ff), + /* A 4-bit data relocation. */ + IP2K_HOWTO (R_IP2K_BANK, 8,1,4, FALSE, 0, "R_IP2K_BANK", 0, 0x000f), + /* A 13-bit insn relocation - word address => right-shift 1 bit extra. */ + IP2K_HOWTO (R_IP2K_ADDR16CJP, 1,1,13, FALSE, 0, "R_IP2K_ADDR16CJP", 0, 0x1fff), + /* A 3-bit insn relocation - word address => right-shift 1 bit extra. */ + IP2K_HOWTO (R_IP2K_PAGE3, 14,1,3, FALSE, 0, "R_IP2K_PAGE3", 0, 0x0007), + /* Two 8-bit data relocations. */ + IP2K_HOWTO (R_IP2K_LO8DATA, 0,1,8, FALSE, 0, "R_IP2K_LO8DATA", 0, 0x00ff), + IP2K_HOWTO (R_IP2K_HI8DATA, 8,1,8, FALSE, 0, "R_IP2K_HI8DATA", 0, 0x00ff), + /* Two 8-bit insn relocations. word address => right-shift 1 bit extra. */ + IP2K_HOWTO (R_IP2K_LO8INSN, 1,1,8, FALSE, 0, "R_IP2K_LO8INSN", 0, 0x00ff), + IP2K_HOWTO (R_IP2K_HI8INSN, 9,1,8, FALSE, 0, "R_IP2K_HI8INSN", 0, 0x00ff), + + /* Special 1 bit relocation for SKIP instructions. */ + IP2K_HOWTO (R_IP2K_PC_SKIP, 1,1,1, FALSE, 12, "R_IP2K_PC_SKIP", 0xfffe, 0x1000), + /* 16 bit word address. */ + IP2K_HOWTO (R_IP2K_TEXT, 1,1,16, FALSE, 0, "R_IP2K_TEXT", 0, 0xffff), + /* A 7-bit offset relocation for the FR9 field. Eigth and ninth bit comes from insn. */ + IP2K_HOWTO (R_IP2K_FR_OFFSET, 0,1,9, FALSE, 0, "R_IP2K_FR_OFFSET", 0x180, 0x007f), + /* Bits 23:16 of an address. */ + IP2K_HOWTO (R_IP2K_EX8DATA, 16,1,8, FALSE, 0, "R_IP2K_EX8DATA", 0, 0x00ff), +}; + + +/* Map BFD reloc types to IP2K ELF reloc types. */ +static reloc_howto_type * +ip2k_reloc_type_lookup (abfd, code) + bfd * abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + /* Note that the ip2k_elf_howto_table is indxed by the R_ + constants. Thus, the order that the howto records appear in the + table *must* match the order of the relocation types defined in + include/elf/ip2k.h. */ + + switch (code) + { + case BFD_RELOC_NONE: + return &ip2k_elf_howto_table[ (int) R_IP2K_NONE]; + case BFD_RELOC_16: + return &ip2k_elf_howto_table[ (int) R_IP2K_16]; + case BFD_RELOC_32: + return &ip2k_elf_howto_table[ (int) R_IP2K_32]; + case BFD_RELOC_IP2K_FR9: + return &ip2k_elf_howto_table[ (int) R_IP2K_FR9]; + case BFD_RELOC_IP2K_BANK: + return &ip2k_elf_howto_table[ (int) R_IP2K_BANK]; + case BFD_RELOC_IP2K_ADDR16CJP: + return &ip2k_elf_howto_table[ (int) R_IP2K_ADDR16CJP]; + case BFD_RELOC_IP2K_PAGE3: + return &ip2k_elf_howto_table[ (int) R_IP2K_PAGE3]; + case BFD_RELOC_IP2K_LO8DATA: + return &ip2k_elf_howto_table[ (int) R_IP2K_LO8DATA]; + case BFD_RELOC_IP2K_HI8DATA: + return &ip2k_elf_howto_table[ (int) R_IP2K_HI8DATA]; + case BFD_RELOC_IP2K_LO8INSN: + return &ip2k_elf_howto_table[ (int) R_IP2K_LO8INSN]; + case BFD_RELOC_IP2K_HI8INSN: + return &ip2k_elf_howto_table[ (int) R_IP2K_HI8INSN]; + case BFD_RELOC_IP2K_PC_SKIP: + return &ip2k_elf_howto_table[ (int) R_IP2K_PC_SKIP]; + case BFD_RELOC_IP2K_TEXT: + return &ip2k_elf_howto_table[ (int) R_IP2K_TEXT]; + case BFD_RELOC_IP2K_FR_OFFSET: + return &ip2k_elf_howto_table[ (int) R_IP2K_FR_OFFSET]; + case BFD_RELOC_IP2K_EX8DATA: + return &ip2k_elf_howto_table[ (int) R_IP2K_EX8DATA]; + default: + /* Pacify gcc -Wall. */ + return NULL; + } + return NULL; +} + +static void +ip2k_get_mem (abfd, addr, length, ptr) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_byte *addr; + int length; + bfd_byte *ptr; +{ + while (length --) + * ptr ++ = bfd_get_8 (abfd, addr ++); +} + +static bfd_boolean +ip2k_is_opcode (code, opcodes) + bfd_byte *code; + const struct ip2k_opcode *opcodes; +{ + unsigned short insn = (code[0] << 8) | code[1]; + + while (opcodes->mask != 0) + { + if ((insn & opcodes->mask) == opcodes->opcode) + return TRUE; + + opcodes ++; + } + + return FALSE; +} + +#define PAGENO(ABSADDR) ((ABSADDR) & 0xFFFFC000) +#define BASEADDR(SEC) ((SEC)->output_section->vma + (SEC)->output_offset) + +#define UNDEFINED_SYMBOL (~(bfd_vma)0) + +/* Return the value of the symbol associated with the relocation IREL. */ + +static bfd_vma +symbol_value (abfd, symtab_hdr, isymbuf, irel) + bfd *abfd; + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Sym *isymbuf; + Elf_Internal_Rela *irel; +{ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + Elf_Internal_Sym *isym; + asection *sym_sec; + + isym = isymbuf + ELF32_R_SYM (irel->r_info); + if (isym->st_shndx == SHN_UNDEF) + sym_sec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + sym_sec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + sym_sec = bfd_com_section_ptr; + else + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + + return isym->st_value + BASEADDR (sym_sec); + } + else + { + unsigned long indx; + struct elf_link_hash_entry *h; + + indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + return UNDEFINED_SYMBOL; + + return (h->root.u.def.value + BASEADDR (h->root.u.def.section)); + } +} + +/* Returns the expected page state for the given instruction not including + the effect of page instructions. */ + +static bfd_vma +ip2k_nominal_page_bits (abfd, sec, addr, contents) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + bfd_vma addr; + bfd_byte *contents; +{ + bfd_vma page = PAGENO (BASEADDR (sec) + addr); + + /* Check if section flows into this page. If not then the page + bits are assumed to match the PC. This will be true unless + the user has a page instruction without a call/jump, in which + case they are on their own. */ + if (PAGENO (BASEADDR (sec)) == page) + return page; + + /* Section flows across page boundary. The page bits should match + the PC unless there is a possible flow from the previous page, + in which case it is not possible to determine the value of the + page bits. */ + while (PAGENO (BASEADDR (sec) + addr - 2) == page) + { + bfd_byte code[2]; + + addr -= 2; + ip2k_get_mem (abfd, contents + addr, 2, code); + if (!IS_PAGE_OPCODE (code)) + continue; + + /* Found a page instruction, check if jump table. */ + if (ip2k_is_switch_table_128 (abfd, sec, addr, contents) != -1) + /* Jump table => page is conditional. */ + continue; + + if (ip2k_is_switch_table_256 (abfd, sec, addr, contents) != -1) + /* Jump table => page is conditional. */ + continue; + + /* Found a page instruction, check if conditional. */ + if (addr >= 2) + { + ip2k_get_mem (abfd, contents + addr - 2, 2, code); + if (IS_SKIP_OPCODE (code)) + /* Page is conditional. */ + continue; + } + + /* Unconditional page instruction => page bits should be correct. */ + return page; + } + + /* Flow from previous page => page bits are impossible to determine. */ + return 0; +} + +static bfd_boolean +ip2k_test_page_insn (abfd, sec, irel, misc) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + Elf_Internal_Rela *irel; + struct misc *misc; +{ + bfd_vma symval; + + /* Get the value of the symbol referred to by the reloc. */ + symval = symbol_value (abfd, misc->symtab_hdr, misc->isymbuf, irel); + if (symval == UNDEFINED_SYMBOL) + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + return FALSE; + + /* Test if we can delete this page instruction. */ + if (PAGENO (symval + irel->r_addend) != + ip2k_nominal_page_bits (abfd, sec, irel->r_offset, misc->contents)) + return FALSE; + + return TRUE; +} + +static bfd_boolean +ip2k_delete_page_insn (abfd, sec, irel, again, misc) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + Elf_Internal_Rela *irel; + bfd_boolean *again; + struct misc *misc; +{ + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = misc->irelbase; + elf_section_data (sec)->this_hdr.contents = misc->contents; + misc->symtab_hdr->contents = (bfd_byte *) misc->isymbuf; + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_IP2K_NONE); + + /* Delete the PAGE insn. */ + if (!ip2k_elf_relax_delete_bytes (abfd, sec, irel->r_offset, 2)) + return FALSE; + + /* Modified => will need to iterate relaxation again. */ + *again = TRUE; + + return TRUE; +} + +/* Determine if the instruction sequence matches that for + the prologue of a switch dispatch table with fewer than + 128 entries. + + sc + page $nnn0 + jmp $nnn0 + add w,wreg + add pcl,w + addr=> + page $nnn1 + jmp $nnn1 + page $nnn2 + jmp $nnn2 + ... + page $nnnN + jmp $nnnN + + After relaxation. + sc + page $nnn0 + jmp $nnn0 + add pcl,w + addr=> + jmp $nnn1 + jmp $nnn2 + ... + jmp $nnnN */ + +static int +ip2k_is_switch_table_128 (abfd, sec, addr, contents) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + bfd_vma addr; + bfd_byte *contents; +{ + bfd_byte code[4]; + int index = 0; + + /* Check current page-jmp. */ + if (addr + 4 > sec->_cooked_size) + return -1; + + ip2k_get_mem (abfd, contents + addr, 4, code); + + if ((! IS_PAGE_OPCODE (code + 0)) + || (! IS_JMP_OPCODE (code + 2))) + return -1; + + /* Search back. */ + while (1) + { + if (addr < 4) + return -1; + + /* Check previous 2 instructions. */ + ip2k_get_mem (abfd, contents + addr - 4, 4, code); + if ((IS_ADD_W_WREG_OPCODE (code + 0)) + && (IS_ADD_PCL_W_OPCODE (code + 2))) + return index; + + if ((! IS_PAGE_OPCODE (code + 0)) + || (! IS_JMP_OPCODE (code + 2))) + return -1; + + index++; + addr -= 4; + } +} + +static bfd_boolean +ip2k_relax_switch_table_128 (abfd, sec, irel, again, misc) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + Elf_Internal_Rela *irel; + bfd_boolean *again; + struct misc *misc; +{ + Elf_Internal_Rela *irelend = misc->irelbase + sec->reloc_count; + Elf_Internal_Rela *ireltest = irel; + bfd_byte code[4]; + bfd_vma addr; + + /* Test all page instructions. */ + addr = irel->r_offset; + while (1) + { + if (addr + 4 > sec->_cooked_size) + break; + + ip2k_get_mem (abfd, misc->contents + addr, 4, code); + if ((! IS_PAGE_OPCODE (code + 0)) + || (! IS_JMP_OPCODE (code + 2))) + break; + + /* Validate relocation entry (every entry should have a matching + relocation entry). */ + if (ireltest >= irelend) + { + _bfd_error_handler (_("ip2k relaxer: switch table without complete matching relocation information.")); + return FALSE; + } + + if (ireltest->r_offset != addr) + { + _bfd_error_handler (_("ip2k relaxer: switch table without complete matching relocation information.")); + return FALSE; + } + + if (! ip2k_test_page_insn (abfd, sec, ireltest, misc)) + /* Un-removable page insn => nothing can be done. */ + return TRUE; + + addr += 4; + ireltest += 2; + } + + /* Relaxable. Adjust table header. */ + ip2k_get_mem (abfd, misc->contents + irel->r_offset - 4, 4, code); + if ((! IS_ADD_W_WREG_OPCODE (code + 0)) + || (! IS_ADD_PCL_W_OPCODE (code + 2))) + { + _bfd_error_handler (_("ip2k relaxer: switch table header corrupt.")); + return FALSE; + } + + if (!ip2k_elf_relax_delete_bytes (abfd, sec, irel->r_offset - 4, 2)) + return FALSE; + + *again = TRUE; + + /* Delete all page instructions in table. */ + while (irel < ireltest) + { + if (!ip2k_delete_page_insn (abfd, sec, irel, again, misc)) + return FALSE; + irel += 2; + } + + return TRUE; +} + +/* Determine if the instruction sequence matches that for + the prologue switch dispatch table with fewer than + 256 entries but more than 127. + + Before relaxation. + push %lo8insn(label) ; Push address of table + push %hi8insn(label) + add w,wreg ; index*2 => offset + snc ; CARRY SET? + inc 1(sp) ; Propagate MSB into table address + add 2(sp),w ; Add low bits of offset to table address + snc ; and handle any carry-out + inc 1(sp) + addr=> + page __indjmp ; Do an indirect jump to that location + jmp __indjmp + label: ; case dispatch table starts here + page $nnn1 + jmp $nnn1 + page $nnn2 + jmp $nnn2 + ... + page $nnnN + jmp $nnnN + + After relaxation. + push %lo8insn(label) ; Push address of table + push %hi8insn(label) + add 2(sp),w ; Add low bits of offset to table address + snc ; and handle any carry-out + inc 1(sp) + addr=> + page __indjmp ; Do an indirect jump to that location + jmp __indjmp + label: ; case dispatch table starts here + jmp $nnn1 + jmp $nnn2 + ... + jmp $nnnN */ + +static int +ip2k_is_switch_table_256 (abfd, sec, addr, contents) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + bfd_vma addr; + bfd_byte *contents; +{ + bfd_byte code[16]; + int index = 0; + + /* Check current page-jmp. */ + if (addr + 4 > sec->_cooked_size) + return -1; + + ip2k_get_mem (abfd, contents + addr, 4, code); + if ((! IS_PAGE_OPCODE (code + 0)) + || (! IS_JMP_OPCODE (code + 2))) + return -1; + + /* Search back. */ + while (1) + { + if (addr < 16) + return -1; + + /* Check previous 8 instructions. */ + ip2k_get_mem (abfd, contents + addr - 16, 16, code); + if ((IS_ADD_W_WREG_OPCODE (code + 0)) + && (IS_SNC_OPCODE (code + 2)) + && (IS_INC_1SP_OPCODE (code + 4)) + && (IS_ADD_2SP_W_OPCODE (code + 6)) + && (IS_SNC_OPCODE (code + 8)) + && (IS_INC_1SP_OPCODE (code + 10)) + && (IS_PAGE_OPCODE (code + 12)) + && (IS_JMP_OPCODE (code + 14))) + return index; + + if ((IS_ADD_W_WREG_OPCODE (code + 2)) + && (IS_SNC_OPCODE (code + 4)) + && (IS_INC_1SP_OPCODE (code + 6)) + && (IS_ADD_2SP_W_OPCODE (code + 8)) + && (IS_SNC_OPCODE (code + 10)) + && (IS_INC_1SP_OPCODE (code + 12)) + && (IS_JMP_OPCODE (code + 14))) + return index; + + if ((! IS_PAGE_OPCODE (code + 0)) + || (! IS_JMP_OPCODE (code + 2))) + return -1; + + index++; + addr -= 4; + } +} + +static bfd_boolean +ip2k_relax_switch_table_256 (abfd, sec, irel, again, misc) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + Elf_Internal_Rela *irel; + bfd_boolean *again; + struct misc *misc; +{ + Elf_Internal_Rela *irelend = misc->irelbase + sec->reloc_count; + Elf_Internal_Rela *ireltest = irel; + bfd_byte code[12]; + bfd_vma addr; + + /* Test all page instructions. */ + addr = irel->r_offset; + + while (1) + { + if (addr + 4 > sec->_cooked_size) + break; + + ip2k_get_mem (abfd, misc->contents + addr, 4, code); + + if ((! IS_PAGE_OPCODE (code + 0)) + || (! IS_JMP_OPCODE (code + 2))) + break; + + /* Validate relocation entry (every entry should have a matching + relocation entry). */ + if (ireltest >= irelend) + { + _bfd_error_handler (_("ip2k relaxer: switch table without complete matching relocation information.")); + return FALSE; + } + + if (ireltest->r_offset != addr) + { + _bfd_error_handler (_("ip2k relaxer: switch table without complete matching relocation information.")); + return FALSE; + } + + if (!ip2k_test_page_insn (abfd, sec, ireltest, misc)) + /* Un-removable page insn => nothing can be done. */ + return TRUE; + + addr += 4; + ireltest += 2; + } + + /* Relaxable. Adjust table header. */ + ip2k_get_mem (abfd, misc->contents + irel->r_offset - 4, 2, code); + if (IS_PAGE_OPCODE (code)) + addr = irel->r_offset - 16; + else + addr = irel->r_offset - 14; + + ip2k_get_mem (abfd, misc->contents + addr, 12, code); + if ((!IS_ADD_W_WREG_OPCODE (code + 0)) + || (!IS_SNC_OPCODE (code + 2)) + || (!IS_INC_1SP_OPCODE (code + 4)) + || (!IS_ADD_2SP_W_OPCODE (code + 6)) + || (!IS_SNC_OPCODE (code + 8)) + || (!IS_INC_1SP_OPCODE (code + 10))) + { + _bfd_error_handler (_("ip2k relaxer: switch table header corrupt.")); + return FALSE; + } + + /* Delete first 3 opcodes. */ + if (!ip2k_elf_relax_delete_bytes (abfd, sec, addr + 0, 6)) + return FALSE; + + *again = TRUE; + + /* Delete all page instructions in table. */ + while (irel < ireltest) + { + if (!ip2k_delete_page_insn (abfd, sec, irel, again, misc)) + return FALSE; + irel += 2; + } + + return TRUE; +} + +/* This function handles relaxing for the ip2k. + + Principle: Start with the first page and remove page instructions that + are not require on this first page. By removing page instructions more + code will fit into this page - repeat until nothing more can be achieved + for this page. Move on to the next page. + + Processing the pages one at a time from the lowest page allows a removal + only policy to be used - pages can be removed but are never reinserted. */ + +static bfd_boolean +ip2k_elf_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + bfd_boolean *again; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *internal_relocs; + bfd_byte *contents = NULL; + Elf_Internal_Sym *isymbuf = NULL; + static asection * first_section = NULL; + static unsigned long search_addr; + static unsigned long page_start = 0; + static unsigned long page_end = 0; + static unsigned int pass = 0; + static bfd_boolean new_pass = FALSE; + static bfd_boolean changed = FALSE; + struct misc misc; + asection *stab; + + /* Assume nothing changes. */ + *again = FALSE; + + if (first_section == NULL) + { + ip2k_relaxed = TRUE; + first_section = sec; + } + + if (first_section == sec) + { + pass++; + new_pass = TRUE; + } + + /* We don't have to do anything for a relocatable link, + if this section does not have relocs, or if this is + not a code section. */ + if (link_info->relocatable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0 + || (sec->flags & SEC_CODE) == 0) + return TRUE; + + /* If this is the first time we have been called + for this section, initialise the cooked size. */ + if (sec->_cooked_size == 0) + sec->_cooked_size = sec->_raw_size; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, + (Elf_Internal_Rela *)NULL, + link_info->keep_memory); + if (internal_relocs == NULL) + goto error_return; + + /* Make sure the stac.rela stuff gets read in. */ + stab = bfd_get_section_by_name (abfd, ".stab"); + + if (stab) + { + /* So stab does exits. */ + Elf_Internal_Rela * irelbase; + + irelbase = _bfd_elf_link_read_relocs (abfd, stab, NULL, + (Elf_Internal_Rela *)NULL, + link_info->keep_memory); + } + + /* Get section contents cached copy if it exists. */ + if (contents == NULL) + { + /* Get cached copy if it exists. */ + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + /* Go get them off disk. */ + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + /* Read this BFD's symbols cached copy if it exists. */ + if (isymbuf == NULL && symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + misc.symtab_hdr = symtab_hdr; + misc.isymbuf = isymbuf; + misc.irelbase = internal_relocs; + misc.contents = contents; + + /* This is where all the relaxation actually get done. */ + if ((pass == 1) || (new_pass && !changed)) + { + /* On the first pass we simply search for the lowest page that + we havn't relaxed yet. Note that the pass count is reset + each time a page is complete in order to move on to the next page. + If we can't find any more pages then we are finished. */ + if (new_pass) + { + pass = 1; + new_pass = FALSE; + changed = TRUE; /* Pre-initialize to break out of pass 1. */ + search_addr = 0xFFFFFFFF; + } + + if ((BASEADDR (sec) + sec->_cooked_size < search_addr) + && (BASEADDR (sec) + sec->_cooked_size > page_end)) + { + if (BASEADDR (sec) <= page_end) + search_addr = page_end + 1; + else + search_addr = BASEADDR (sec); + + /* Found a page => more work to do. */ + *again = TRUE; + } + } + else + { + if (new_pass) + { + new_pass = FALSE; + changed = FALSE; + page_start = PAGENO (search_addr); + page_end = page_start | 0x00003FFF; + } + + /* Only process sections in range. */ + if ((BASEADDR (sec) + sec->_cooked_size >= page_start) + && (BASEADDR (sec) <= page_end)) + { + if (!ip2k_elf_relax_section_page (abfd, sec, &changed, &misc, page_start, page_end)) + return FALSE; + } + *again = TRUE; + } + + /* Perform some house keeping after relaxing the section. */ + + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + { + if (! link_info->keep_memory) + free (isymbuf); + else + symtab_hdr->contents = (unsigned char *) isymbuf; + } + + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + { + if (! link_info->keep_memory) + free (contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + } + + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + return TRUE; + + error_return: + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + free (contents); + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + return FALSE; +} + +/* This function handles relaxation of a section in a specific page. */ + +static bfd_boolean +ip2k_elf_relax_section_page (abfd, sec, again, misc, page_start, page_end) + bfd *abfd; + asection *sec; + bfd_boolean *again; + struct misc *misc; + unsigned long page_start; + unsigned long page_end; +{ + Elf_Internal_Rela *irelend = misc->irelbase + sec->reloc_count; + Elf_Internal_Rela *irel; + int switch_table_128; + int switch_table_256; + + /* Walk thru the section looking for relaxation opportunities. */ + for (irel = misc->irelbase; irel < irelend; irel++) + { + if (ELF32_R_TYPE (irel->r_info) != (int) R_IP2K_PAGE3) + /* Ignore non page instructions. */ + continue; + + if (BASEADDR (sec) + irel->r_offset < page_start) + /* Ignore page instructions on earlier page - they have + already been processed. Remember that there is code flow + that crosses a page boundary. */ + continue; + + if (BASEADDR (sec) + irel->r_offset > page_end) + /* Flow beyond end of page => nothing more to do for this page. */ + return TRUE; + + /* Detect switch tables. */ + switch_table_128 = ip2k_is_switch_table_128 (abfd, sec, irel->r_offset, misc->contents); + switch_table_256 = ip2k_is_switch_table_256 (abfd, sec, irel->r_offset, misc->contents); + + if ((switch_table_128 > 0) || (switch_table_256 > 0)) + /* If the index is greater than 0 then it has already been processed. */ + continue; + + if (switch_table_128 == 0) + { + if (!ip2k_relax_switch_table_128 (abfd, sec, irel, again, misc)) + return FALSE; + + continue; + } + + if (switch_table_256 == 0) + { + if (!ip2k_relax_switch_table_256 (abfd, sec, irel, again, misc)) + return FALSE; + + continue; + } + + /* Simple relax. */ + if (ip2k_test_page_insn (abfd, sec, irel, misc)) + { + if (!ip2k_delete_page_insn (abfd, sec, irel, again, misc)) + return FALSE; + + continue; + } + } + + return TRUE; +} + +/* Parts of a Stabs entry. */ + +#define STRDXOFF (0) +#define TYPEOFF (4) +#define OTHEROFF (5) +#define DESCOFF (6) +#define VALOFF (8) +#define STABSIZE (12) + +/* Adjust all the relocations entries after adding or inserting instructions. */ + +static void +adjust_all_relocations (abfd, sec, addr, endaddr, count, noadj) + bfd *abfd; + asection *sec; + bfd_vma addr; + bfd_vma endaddr; + int count; + int noadj; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Sym *isymbuf, *isym, *isymend; + unsigned int shndx; + bfd_byte *contents; + Elf_Internal_Rela *irel, *irelend, *irelbase; + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry **end_hashes; + unsigned int symcount; + asection *stab; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + + shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + contents = elf_section_data (sec)->this_hdr.contents; + + irelbase = elf_section_data (sec)->relocs; + irelend = irelbase + sec->reloc_count; + + for (irel = irelbase; irel < irelend; irel++) + { + if (ELF32_R_TYPE (irel->r_info) != R_IP2K_NONE) + { + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + asection *sym_sec; + + /* A local symbol. */ + isym = isymbuf + ELF32_R_SYM (irel->r_info); + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + + if (isym->st_shndx == shndx) + { + bfd_vma baseaddr = BASEADDR (sec); + bfd_vma symval = BASEADDR (sym_sec) + isym->st_value + + irel->r_addend; + + if ((baseaddr + addr + noadj) <= symval + && symval < (baseaddr + endaddr)) + irel->r_addend += count; + } + } + } + + /* Do this only for PC space relocations. */ + if (addr <= irel->r_offset && irel->r_offset < endaddr) + irel->r_offset += count; + } + + /* Now fix the stab relocations. */ + stab = bfd_get_section_by_name (abfd, ".stab"); + if (stab) + { + bfd_byte *stabcontents, *stabend, *stabp; + + irelbase = elf_section_data (stab)->relocs; + irelend = irelbase + stab->reloc_count; + + /* Pull out the contents of the stab section. */ + if (elf_section_data (stab)->this_hdr.contents != NULL) + stabcontents = elf_section_data (stab)->this_hdr.contents; + else + { + stabcontents = (bfd_byte *) bfd_alloc (abfd, stab->_raw_size); + if (stabcontents == NULL) + return; + + if (! bfd_get_section_contents (abfd, stab, stabcontents, + (file_ptr) 0, stab->_raw_size)) + return; + + /* We need to remember this. */ + elf_section_data (stab)->this_hdr.contents = stabcontents; + } + + stabend = stabcontents + stab->_raw_size; + + for (irel = irelbase; irel < irelend; irel++) + { + if (ELF32_R_TYPE (irel->r_info) != R_IP2K_NONE) + { + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + asection *sym_sec; + + /* A local symbol. */ + isym = isymbuf + ELF32_R_SYM (irel->r_info); + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + + if (sym_sec == sec) + { + const char *name; + unsigned long strx; + unsigned char type, other; + unsigned short desc; + bfd_vma value; + bfd_vma baseaddr = BASEADDR (sec); + bfd_vma symval = BASEADDR (sym_sec) + isym->st_value + + irel->r_addend; + + if ((baseaddr + addr) <= symval + && symval <= (baseaddr + endaddr)) + irel->r_addend += count; + + /* Go hunt up a function and fix its line info if needed. */ + stabp = stabcontents + irel->r_offset - 8; + + /* Go pullout the stab entry. */ + strx = bfd_h_get_32 (abfd, stabp + STRDXOFF); + type = bfd_h_get_8 (abfd, stabp + TYPEOFF); + other = bfd_h_get_8 (abfd, stabp + OTHEROFF); + desc = bfd_h_get_16 (abfd, stabp + DESCOFF); + value = bfd_h_get_32 (abfd, stabp + VALOFF); + + name = bfd_get_stab_name (type); + + if (strcmp (name, "FUN") == 0) + { + int function_adjusted = 0; + + if (symval > (baseaddr + addr)) + /* Not in this function. */ + continue; + + /* Hey we got a function hit. */ + stabp += STABSIZE; + for (;stabp < stabend; stabp += STABSIZE) + { + /* Go pullout the stab entry. */ + strx = bfd_h_get_32 (abfd, stabp + STRDXOFF); + type = bfd_h_get_8 (abfd, stabp + TYPEOFF); + other = bfd_h_get_8 (abfd, stabp + OTHEROFF); + desc = bfd_h_get_16 (abfd, stabp + DESCOFF); + value = bfd_h_get_32 (abfd, stabp + VALOFF); + + name = bfd_get_stab_name (type); + + if (strcmp (name, "FUN") == 0) + { + /* Hit another function entry. */ + if (function_adjusted) + { + /* Adjust the value. */ + value += count; + + /* We need to put it back. */ + bfd_h_put_32 (abfd, value,stabp + VALOFF); + } + + /* And then bale out. */ + break; + } + + if (strcmp (name, "SLINE") == 0) + { + /* Got a line entry. */ + if ((baseaddr + addr) <= (symval + value)) + { + /* Adjust the line entry. */ + value += count; + + /* We need to put it back. */ + bfd_h_put_32 (abfd, value,stabp + VALOFF); + function_adjusted = 1; + } + } + } + } + } + } + } + } + } + + /* When adding an instruction back it is sometimes necessary to move any + global or local symbol that was referencing the first instruction of + the moved block to refer to the first instruction of the inserted block. + + For example adding a PAGE instruction before a CALL or JMP requires + that any label on the CALL or JMP is moved to the PAGE insn. */ + addr += noadj; + + /* Adjust the local symbols defined in this section. */ + isymend = isymbuf + symtab_hdr->sh_info; + for (isym = isymbuf; isym < isymend; isym++) + { + if (isym->st_shndx == shndx + && addr <= isym->st_value + && isym->st_value < endaddr) + isym->st_value += count; + } + + /* Now adjust the global symbols defined in this section. */ + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + sym_hashes = elf_sym_hashes (abfd); + end_hashes = sym_hashes + symcount; + for (; sym_hashes < end_hashes; sym_hashes++) + { + struct elf_link_hash_entry *sym_hash = *sym_hashes; + + if ((sym_hash->root.type == bfd_link_hash_defined + || sym_hash->root.type == bfd_link_hash_defweak) + && sym_hash->root.u.def.section == sec) + { + if (addr <= sym_hash->root.u.def.value + && sym_hash->root.u.def.value < endaddr) + sym_hash->root.u.def.value += count; + } + } + + return; +} + +/* Delete some bytes from a section while relaxing. */ + +static bfd_boolean +ip2k_elf_relax_delete_bytes (abfd, sec, addr, count) + bfd *abfd; + asection *sec; + bfd_vma addr; + int count; +{ + bfd_byte *contents = elf_section_data (sec)->this_hdr.contents; + bfd_vma endaddr = sec->_cooked_size; + + /* Actually delete the bytes. */ + memmove (contents + addr, contents + addr + count, + endaddr - addr - count); + + sec->_cooked_size -= count; + + adjust_all_relocations (abfd, sec, addr + count, endaddr, -count, 0); + return TRUE; +} + +/* -------------------------------------------------------------------- */ + +/* XXX: The following code is the result of a cut&paste. This unfortunate + practice is very widespread in the various target back-end files. */ + +/* Set the howto pointer for a IP2K ELF reloc. */ + +static void +ip2k_info_to_howto_rela (abfd, cache_ptr, dst) + bfd * abfd ATTRIBUTE_UNUSED; + arelent * cache_ptr; + Elf_Internal_Rela * dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + switch (r_type) + { + default: + cache_ptr->howto = & ip2k_elf_howto_table [r_type]; + break; + } +} + +/* Perform a single relocation. + By default we use the standard BFD routines. */ + +static bfd_reloc_status_type +ip2k_final_link_relocate (howto, input_bfd, input_section, contents, rel, + relocation) + reloc_howto_type * howto; + bfd * input_bfd; + asection * input_section; + bfd_byte * contents; + Elf_Internal_Rela * rel; + bfd_vma relocation; +{ + static bfd_vma page_addr = 0; + + bfd_reloc_status_type r = bfd_reloc_ok; + switch (howto->type) + { + /* Handle data space relocations. */ + case R_IP2K_FR9: + case R_IP2K_BANK: + if ((relocation & IP2K_DATA_MASK) == IP2K_DATA_VALUE) + relocation &= ~IP2K_DATA_MASK; + else + r = bfd_reloc_notsupported; + break; + + case R_IP2K_LO8DATA: + case R_IP2K_HI8DATA: + case R_IP2K_EX8DATA: + break; + + /* Handle insn space relocations. */ + case R_IP2K_PAGE3: + page_addr = BASEADDR (input_section) + rel->r_offset; + if ((relocation & IP2K_INSN_MASK) == IP2K_INSN_VALUE) + relocation &= ~IP2K_INSN_MASK; + else + r = bfd_reloc_notsupported; + break; + + case R_IP2K_ADDR16CJP: + if (BASEADDR (input_section) + rel->r_offset != page_addr + 2) + { + /* No preceding page instruction, verify that it isn't needed. */ + if (PAGENO (relocation + rel->r_addend) != + ip2k_nominal_page_bits (input_bfd, input_section, + rel->r_offset, contents)) + _bfd_error_handler (_("ip2k linker: missing page instruction at 0x%08lx (dest = 0x%08lx)."), + BASEADDR (input_section) + rel->r_offset, + relocation + rel->r_addend); + } + else if (ip2k_relaxed) + { + /* Preceding page instruction. Verify that the page instruction is + really needed. One reason for the relaxation to miss a page is if + the section is not marked as executable. */ + if (!ip2k_is_switch_table_128 (input_bfd, input_section, rel->r_offset - 2, contents) && + !ip2k_is_switch_table_256 (input_bfd, input_section, rel->r_offset - 2, contents) && + (PAGENO (relocation + rel->r_addend) == + ip2k_nominal_page_bits (input_bfd, input_section, + rel->r_offset - 2, contents))) + _bfd_error_handler (_("ip2k linker: redundant page instruction at 0x%08lx (dest = 0x%08lx)."), + page_addr, + relocation + rel->r_addend); + } + if ((relocation & IP2K_INSN_MASK) == IP2K_INSN_VALUE) + relocation &= ~IP2K_INSN_MASK; + else + r = bfd_reloc_notsupported; + break; + + case R_IP2K_LO8INSN: + case R_IP2K_HI8INSN: + case R_IP2K_PC_SKIP: + if ((relocation & IP2K_INSN_MASK) == IP2K_INSN_VALUE) + relocation &= ~IP2K_INSN_MASK; + else + r = bfd_reloc_notsupported; + break; + + case R_IP2K_16: + /* If this is a relocation involving a TEXT + symbol, reduce it to a word address. */ + if ((relocation & IP2K_INSN_MASK) == IP2K_INSN_VALUE) + howto = &ip2k_elf_howto_table[ (int) R_IP2K_TEXT]; + break; + + /* Pass others through. */ + default: + break; + } + + /* Only install relocation if above tests did not disqualify it. */ + if (r == bfd_reloc_ok) + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + + return r; +} + +/* Relocate a IP2K ELF section. + + The RELOCATE_SECTION function is called by the new ELF backend linker + to handle the relocations for a section. + + The relocs are always passed as Rela structures; if the section + actually uses Rel structures, the r_addend field will always be + zero. + + This function is responsible for adjusting the section contents as + necessary, and (if using Rela relocs and generating a relocatable + output file) adjusting the reloc addend as necessary. + + This function does not have to worry about setting the reloc + address or the reloc symbol index. + + LOCAL_SYMS is a pointer to the swapped in local symbols. + + LOCAL_SECTIONS is an array giving the section in the input file + corresponding to the st_shndx field of each local symbol. + + The global hash table entry for the global symbols can be found + via elf_sym_hashes (input_bfd). + + When generating relocatable output, this function must handle + STB_LOCAL/STT_SECTION symbols specially. The output symbol is + going to be the section symbol corresponding to the output + section, which means that the addend must be adjusted + accordingly. */ + +static bfd_boolean +ip2k_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + + if (info->relocatable) + return TRUE; + + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + relend = relocs + input_section->reloc_count; + + for (rel = relocs; rel < relend; rel ++) + { + reloc_howto_type * howto; + unsigned long r_symndx; + Elf_Internal_Sym * sym; + asection * sec; + struct elf_link_hash_entry * h; + bfd_vma relocation; + bfd_reloc_status_type r; + const char * name = NULL; + int r_type; + + /* This is a final link. */ + r_type = ELF32_R_TYPE (rel->r_info); + r_symndx = ELF32_R_SYM (rel->r_info); + howto = ip2k_elf_howto_table + ELF32_R_TYPE (rel->r_info); + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; + relocation = BASEADDR (sec) + sym->st_value; + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); + name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + } + else + { + bfd_boolean warned; + bfd_boolean unresolved_reloc; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + + name = h->root.root.string; + } + + /* Finally, the sole IP2K-specific part. */ + r = ip2k_final_link_relocate (howto, input_bfd, input_section, + contents, rel, relocation); + + if (r != bfd_reloc_ok) + { + const char * msg = (const char *) NULL; + + switch (r) + { + case bfd_reloc_overflow: + r = info->callbacks->reloc_overflow + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset); + break; + + case bfd_reloc_undefined: + r = info->callbacks->undefined_symbol + (info, name, input_bfd, input_section, rel->r_offset, TRUE); + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + break; + + /* This is how ip2k_final_link_relocate tells us of a non-kosher + reference between insn & data address spaces. */ + case bfd_reloc_notsupported: + if (sym != NULL) /* Only if it's not an unresolved symbol. */ + msg = _("unsupported relocation between data/insn address spaces"); + break; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous relocation"); + break; + + default: + msg = _("internal error: unknown error"); + break; + } + + if (msg) + r = info->callbacks->warning + (info, msg, name, input_bfd, input_section, rel->r_offset); + + if (! r) + return FALSE; + } + } + + return TRUE; +} + +static asection * +ip2k_elf_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { +#if 0 + case R_IP2K_GNU_VTINHERIT: + case R_IP2K_GNU_VTENTRY: + break; +#endif + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + { + if (!(elf_bad_symtab (sec->owner) + && ELF_ST_BIND (sym->st_info) != STB_LOCAL) + && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE) + && sym->st_shndx != SHN_COMMON)) + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + } + return NULL; +} + +static bfd_boolean +ip2k_elf_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +{ + /* We don't use got and plt entries for ip2k. */ + return TRUE; +} + +#define TARGET_BIG_SYM bfd_elf32_ip2k_vec +#define TARGET_BIG_NAME "elf32-ip2k" + +#define ELF_ARCH bfd_arch_ip2k +#define ELF_MACHINE_CODE EM_IP2K +#define ELF_MACHINE_ALT1 EM_IP2K_OLD +#define ELF_MAXPAGESIZE 1 /* No pages on the IP2K. */ + +#define elf_info_to_howto_rel NULL +#define elf_info_to_howto ip2k_info_to_howto_rela + +#define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 +#define elf_backend_gc_mark_hook ip2k_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook ip2k_elf_gc_sweep_hook +#define elf_backend_relocate_section ip2k_elf_relocate_section + +#define elf_symbol_leading_char '_' +#define bfd_elf32_bfd_reloc_type_lookup ip2k_reloc_type_lookup +#define bfd_elf32_bfd_relax_section ip2k_elf_relax_section + +#include "elf32-target.h" diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c new file mode 100644 index 0000000000000..60dab3483cd89 --- /dev/null +++ b/bfd/elf32-iq2000.c @@ -0,0 +1,953 @@ +/* IQ2000-specific support for 32-bit ELF. + Copyright (C) 2003, 2004 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/iq2000.h" + +/* Forward declarations. */ + +/* Private relocation functions. */ +static bfd_reloc_status_type iq2000_elf_relocate_hi16 PARAMS ((bfd *, Elf_Internal_Rela *, bfd_byte *, bfd_vma)); +static reloc_howto_type * iq2000_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void iq2000_info_to_howto_rela PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static bfd_boolean iq2000_elf_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static bfd_reloc_status_type iq2000_final_link_relocate PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, bfd_vma)); +static bfd_boolean iq2000_elf_gc_sweep_hook PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); +static asection * iq2000_elf_gc_mark_hook PARAMS ((asection *sec, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static reloc_howto_type * iq2000_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); +static int elf32_iq2000_machine PARAMS ((bfd *)); +static bfd_boolean iq2000_elf_object_p PARAMS ((bfd *)); +static bfd_boolean iq2000_elf_set_private_flags PARAMS ((bfd *, flagword)); +static bfd_boolean iq2000_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *)); +static bfd_boolean iq2000_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *)); +static bfd_boolean iq2000_elf_print_private_bfd_data PARAMS ((bfd *, PTR)); +static bfd_boolean iq2000_elf_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); +static bfd_reloc_status_type iq2000_elf_howto_hi16_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + + +static reloc_howto_type iq2000_elf_howto_table [] = +{ + /* This reloc does nothing. */ + + HOWTO (R_IQ2000_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_IQ2000_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 16 bit absolute relocation. */ + HOWTO (R_IQ2000_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_IQ2000_16", /* name */ + FALSE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit absolute relocation. */ + HOWTO (R_IQ2000_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 31, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_IQ2000_32", /* name */ + FALSE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0x7fffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 26 bit branch address. */ + HOWTO (R_IQ2000_26, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + /* This needs complex overflow + detection, because the upper four + bits must match the PC. */ + bfd_elf_generic_reloc, /* special_function */ + "R_IQ2000_26", /* name */ + FALSE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0x03ffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16 bit PC relative reference. */ + HOWTO (R_IQ2000_PC16, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_IQ2000_PC16", /* name */ + FALSE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* high 16 bits of symbol value. */ + HOWTO (R_IQ2000_HI16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + iq2000_elf_howto_hi16_reloc, /* special_function */ + "R_IQ2000_HI16", /* name */ + FALSE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0x7fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Low 16 bits of symbol value. */ + HOWTO (R_IQ2000_LO16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_IQ2000_LO16", /* name */ + FALSE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16-bit jump offset. */ + HOWTO (R_IQ2000_OFFSET_16, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_IQ2000_OFFSET_16", /* name */ + FALSE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 21-bit jump offset. */ + HOWTO (R_IQ2000_OFFSET_21, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 21, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_IQ2000_OFFSET_21", /* name */ + FALSE, /* partial_inplace */ + 0x000000, /* src_mask */ + 0x1fffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* unsigned high 16 bits of value. */ + HOWTO (R_IQ2000_OFFSET_21, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_IQ2000_UHI16", /* name */ + FALSE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0x7fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit absolute debug relocation. */ + HOWTO (R_IQ2000_32_DEBUG, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_IQ2000_32", /* name */ + FALSE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + +}; + +/* GNU extension to record C++ vtable hierarchy. */ +static reloc_howto_type iq2000_elf_vtinherit_howto = + HOWTO (R_IQ2000_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_IQ2000_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE); /* pcrel_offset */ + +/* GNU extension to record C++ vtable member usage. */ +static reloc_howto_type iq2000_elf_vtentry_howto = + HOWTO (R_IQ2000_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_IQ2000_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE); /* pcrel_offset */ + + +/* Map BFD reloc types to IQ2000 ELF reloc types. */ + +struct iq2000_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned int iq2000_reloc_val; +}; + +static const struct iq2000_reloc_map iq2000_reloc_map [] = +{ + { BFD_RELOC_NONE, R_IQ2000_NONE }, + { BFD_RELOC_16, R_IQ2000_16 }, + { BFD_RELOC_32, R_IQ2000_32 }, + { BFD_RELOC_MIPS_JMP, R_IQ2000_26 }, + { BFD_RELOC_16_PCREL_S2, R_IQ2000_PC16 }, + { BFD_RELOC_HI16, R_IQ2000_HI16 }, + { BFD_RELOC_LO16, R_IQ2000_LO16 }, + { BFD_RELOC_IQ2000_OFFSET_16,R_IQ2000_OFFSET_16 }, + { BFD_RELOC_IQ2000_OFFSET_21,R_IQ2000_OFFSET_21 }, + { BFD_RELOC_IQ2000_UHI16, R_IQ2000_UHI16 }, + { BFD_RELOC_VTABLE_INHERIT, R_IQ2000_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_IQ2000_GNU_VTENTRY }, +}; + +static bfd_reloc_status_type +iq2000_elf_howto_hi16_reloc (abfd, + reloc_entry, + symbol, + data, + input_section, + output_bfd, + error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + bfd_reloc_status_type ret; + bfd_vma relocation; + + /* If we're relocating, and this an external symbol, we don't want + to change anything. */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && reloc_entry->addend == 0) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + + /* if %lo will have sign-extension, compensate by add 0x10000 to hi portion */ + if (relocation & 0x8000) + reloc_entry->addend += 0x10000; + + /* Now do the reloc in the usual way. */ + ret = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + + /* put it back the way it was */ + if (relocation & 0x8000) + reloc_entry->addend -= 0x10000; + + return ret; +} + +static bfd_reloc_status_type +iq2000_elf_relocate_hi16 (input_bfd, relhi, contents, value) + bfd *input_bfd; + Elf_Internal_Rela *relhi; + bfd_byte *contents; + bfd_vma value; +{ + bfd_vma insn; + + insn = bfd_get_32 (input_bfd, contents + relhi->r_offset); + + value += relhi->r_addend; + value &= 0x7fffffff; /* mask off top-bit which is Harvard mask bit */ + + /* if top-bit of %lo value is on, this means that %lo will + sign-propagate and so we compensate by adding 1 to %hi value */ + if (value & 0x8000) + value += 0x10000; + + value >>= 16; + insn = ((insn & ~0xFFFF) | value); + + bfd_put_32 (input_bfd, insn, contents + relhi->r_offset); + return bfd_reloc_ok; +} + +static reloc_howto_type * +iq2000_reloc_type_lookup (abfd, code) + bfd * abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + /* Note that the iq2000_elf_howto_table is indxed by the R_ + constants. Thus, the order that the howto records appear in the + table *must* match the order of the relocation types defined in + include/elf/iq2000.h. */ + + switch (code) + { + case BFD_RELOC_NONE: + return &iq2000_elf_howto_table[ (int) R_IQ2000_NONE]; + case BFD_RELOC_16: + return &iq2000_elf_howto_table[ (int) R_IQ2000_16]; + case BFD_RELOC_32: + return &iq2000_elf_howto_table[ (int) R_IQ2000_32]; + case BFD_RELOC_MIPS_JMP: + return &iq2000_elf_howto_table[ (int) R_IQ2000_26]; + case BFD_RELOC_IQ2000_OFFSET_16: + return &iq2000_elf_howto_table[ (int) R_IQ2000_OFFSET_16]; + case BFD_RELOC_IQ2000_OFFSET_21: + return &iq2000_elf_howto_table[ (int) R_IQ2000_OFFSET_21]; + case BFD_RELOC_16_PCREL_S2: + return &iq2000_elf_howto_table[ (int) R_IQ2000_PC16]; + case BFD_RELOC_HI16: + return &iq2000_elf_howto_table[ (int) R_IQ2000_HI16]; + case BFD_RELOC_IQ2000_UHI16: + return &iq2000_elf_howto_table[ (int) R_IQ2000_UHI16]; + case BFD_RELOC_LO16: + return &iq2000_elf_howto_table[ (int) R_IQ2000_LO16]; + case BFD_RELOC_VTABLE_INHERIT: + return &iq2000_elf_vtinherit_howto; + case BFD_RELOC_VTABLE_ENTRY: + return &iq2000_elf_vtentry_howto; + default: + /* Pacify gcc -Wall. */ + return NULL; + } + return NULL; +} + + +/* Perform a single relocation. By default we use the standard BFD + routines. */ + +static bfd_reloc_status_type +iq2000_final_link_relocate (howto, input_bfd, input_section, contents, rel, relocation) + reloc_howto_type * howto; + bfd * input_bfd; + asection * input_section; + bfd_byte * contents; + Elf_Internal_Rela * rel; + bfd_vma relocation; +{ + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); +} + +/* Set the howto pointer for a IQ2000 ELF reloc. */ + +static void +iq2000_info_to_howto_rela (abfd, cache_ptr, dst) + bfd * abfd ATTRIBUTE_UNUSED; + arelent * cache_ptr; + Elf_Internal_Rela * dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + switch (r_type) + { + case R_IQ2000_GNU_VTINHERIT: + cache_ptr->howto = & iq2000_elf_vtinherit_howto; + break; + + case R_IQ2000_GNU_VTENTRY: + cache_ptr->howto = & iq2000_elf_vtentry_howto; + break; + + default: + cache_ptr->howto = & iq2000_elf_howto_table [r_type]; + break; + } +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static bfd_boolean +iq2000_elf_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + bfd_boolean changed = FALSE; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + switch (ELF32_R_TYPE (rel->r_info)) + { + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_IQ2000_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_IQ2000_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + + case R_IQ2000_32: + /* For debug section, change to special harvard-aware relocations */ + if (memcmp (sec->name, ".debug", 6) == 0 + || memcmp (sec->name, ".stab", 5) == 0 + || memcmp (sec->name, ".eh_frame", 9) == 0) + { + ((Elf_Internal_Rela *) rel)->r_info + = ELF32_R_INFO (ELF32_R_SYM (rel->r_info), R_IQ2000_32_DEBUG); + changed = TRUE; + } + break; + } + } + + if (changed) + /* Note that we've changed relocs, otherwise if !info->keep_memory + we'll free the relocs and lose our changes. */ + (const Elf_Internal_Rela *) (elf_section_data (sec)->relocs) = relocs; + + return TRUE; +} + + +/* Relocate a IQ2000 ELF section. + There is some attempt to make this function usable for many architectures, + both USE_REL and USE_RELA ['twould be nice if such a critter existed], + if only to serve as a learning tool. + + The RELOCATE_SECTION function is called by the new ELF backend linker + to handle the relocations for a section. + + The relocs are always passed as Rela structures; if the section + actually uses Rel structures, the r_addend field will always be + zero. + + This function is responsible for adjusting the section contents as + necessary, and (if using Rela relocs and generating a relocatable + output file) adjusting the reloc addend as necessary. + + This function does not have to worry about setting the reloc + address or the reloc symbol index. + + LOCAL_SYMS is a pointer to the swapped in local symbols. + + LOCAL_SECTIONS is an array giving the section in the input file + corresponding to the st_shndx field of each local symbol. + + The global hash table entry for the global symbols can be found + via elf_sym_hashes (input_bfd). + + When generating relocatable output, this function must handle + STB_LOCAL/STT_SECTION symbols specially. The output symbol is + going to be the section symbol corresponding to the output + section, which means that the addend must be adjusted + accordingly. */ + +static bfd_boolean +iq2000_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd * output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info * info; + bfd * input_bfd; + asection * input_section; + bfd_byte * contents; + Elf_Internal_Rela * relocs; + Elf_Internal_Sym * local_syms; + asection ** local_sections; +{ + Elf_Internal_Shdr * symtab_hdr; + struct elf_link_hash_entry ** sym_hashes; + Elf_Internal_Rela * rel; + Elf_Internal_Rela * relend; + + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + relend = relocs + input_section->reloc_count; + + for (rel = relocs; rel < relend; rel ++) + { + reloc_howto_type * howto; + unsigned long r_symndx; + Elf_Internal_Sym * sym; + asection * sec; + struct elf_link_hash_entry * h; + bfd_vma relocation; + bfd_reloc_status_type r; + const char * name = NULL; + int r_type; + + r_type = ELF32_R_TYPE (rel->r_info); + + if ( r_type == R_IQ2000_GNU_VTINHERIT + || r_type == R_IQ2000_GNU_VTENTRY) + continue; + + r_symndx = ELF32_R_SYM (rel->r_info); + + /* This is a final link. */ + howto = iq2000_elf_howto_table + ELF32_R_TYPE (rel->r_info); + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; + relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); + name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; +#ifdef DEBUG + fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n", + sec->name, name, sym->st_name, + sec->output_section->vma, sec->output_offset, + sym->st_value, rel->r_addend); +#endif + } + else + { + bfd_boolean unresolved_reloc; + bfd_boolean warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + + name = h->root.root.string; + } + + switch (r_type) + { + case R_IQ2000_HI16: + r = iq2000_elf_relocate_hi16 (input_bfd, rel, contents, relocation); + break; + + case R_IQ2000_PC16: + rel->r_addend -= 4; + /* Fall through. */ + + default: + r = iq2000_final_link_relocate (howto, input_bfd, input_section, + contents, rel, relocation); + break; + } + + if (r != bfd_reloc_ok) + { + const char * msg = (const char *) NULL; + + switch (r) + { + case bfd_reloc_overflow: + r = info->callbacks->reloc_overflow + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset); + break; + + case bfd_reloc_undefined: + r = info->callbacks->undefined_symbol + (info, name, input_bfd, input_section, rel->r_offset, TRUE); + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + break; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + break; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous relocation"); + break; + + default: + msg = _("internal error: unknown error"); + break; + } + + if (msg) + r = info->callbacks->warning + (info, msg, name, input_bfd, input_section, rel->r_offset); + + if (! r) + return FALSE; + } + } + + return TRUE; +} + + +/* Update the got entry reference counts for the section being + removed. */ + +static bfd_boolean +iq2000_elf_gc_sweep_hook (abfd, info, sec, relocs) + bfd * abfd ATTRIBUTE_UNUSED; + struct bfd_link_info * info ATTRIBUTE_UNUSED; + asection * sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED; +{ + return TRUE; +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +iq2000_elf_gc_mark_hook (sec, info, rel, h, sym) + asection * sec; + struct bfd_link_info * info ATTRIBUTE_UNUSED; + Elf_Internal_Rela * rel; + struct elf_link_hash_entry * h; + Elf_Internal_Sym * sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_IQ2000_GNU_VTINHERIT: + case R_IQ2000_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + + +/* Return the MACH for an e_flags value. */ + +static int +elf32_iq2000_machine (abfd) + bfd *abfd; +{ + switch (elf_elfheader (abfd)->e_flags & EF_IQ2000_CPU_MASK) + { + case EF_IQ2000_CPU_IQ2000: return bfd_mach_iq2000; + case EF_IQ2000_CPU_IQ10: return bfd_mach_iq10; + } + + return bfd_mach_iq2000; +} + + +/* Function to set the ELF flag bits. */ + +static bfd_boolean +iq2000_elf_set_private_flags (abfd, flags) + bfd *abfd; + flagword flags; +{ + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + return TRUE; +} + +/* Copy backend specific data from one object module to another. */ + +static bfd_boolean +iq2000_elf_copy_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + BFD_ASSERT (!elf_flags_init (obfd) + || elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags); + + elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; + elf_flags_init (obfd) = TRUE; + return TRUE; +} + +/* Merge backend specific data from an object file to the output + object file when linking. */ + +static bfd_boolean +iq2000_elf_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + flagword old_flags, old_partial; + flagword new_flags, new_partial; + bfd_boolean error = FALSE; + char new_opt[80]; + char old_opt[80]; + + new_opt[0] = old_opt[0] = '\0'; + new_flags = elf_elfheader (ibfd)->e_flags; + old_flags = elf_elfheader (obfd)->e_flags; + +#ifdef DEBUG + (*_bfd_error_handler) ("old_flags = 0x%.8lx, new_flags = 0x%.8lx, init = %s, filename = %s", + old_flags, new_flags, elf_flags_init (obfd) ? "yes" : "no", + bfd_get_filename (ibfd)); +#endif + + if (!elf_flags_init (obfd)) + { + /* First call, no flags set. */ + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = new_flags; + } + + else if (new_flags == old_flags) + /* Compatible flags are ok. */ + ; + + else /* Possibly incompatible flags. */ + { + /* Warn if different cpu is used (allow a specific cpu to override + the generic cpu). */ + new_partial = (new_flags & EF_IQ2000_CPU_MASK); + old_partial = (old_flags & EF_IQ2000_CPU_MASK); + if (new_partial == old_partial) + ; + + else + { + switch (new_partial) + { + default: strcat (new_opt, " -m2000"); break; + case EF_IQ2000_CPU_IQ2000: strcat (new_opt, " -m2000"); break; + case EF_IQ2000_CPU_IQ10: strcat (new_opt, " -m10"); break; + } + + switch (old_partial) + { + default: strcat (old_opt, " -m2000"); break; + case EF_IQ2000_CPU_IQ2000: strcat (old_opt, " -m2000"); break; + case EF_IQ2000_CPU_IQ10: strcat (old_opt, " -m10"); break; + } + } + + /* Print out any mismatches from above. */ + if (new_opt[0]) + { + error = TRUE; + (*_bfd_error_handler) + (_("%s: compiled with %s and linked with modules compiled with %s"), + bfd_get_filename (ibfd), new_opt, old_opt); + } + + new_flags &= ~ EF_IQ2000_ALL_FLAGS; + old_flags &= ~ EF_IQ2000_ALL_FLAGS; + + /* Warn about any other mismatches. */ + if (new_flags != old_flags) + { + error = TRUE; + (*_bfd_error_handler) + (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), + bfd_get_filename (ibfd), (long)new_flags, (long)old_flags); + } + } + + if (error) + bfd_set_error (bfd_error_bad_value); + + return !error; +} + + +static bfd_boolean +iq2000_elf_print_private_bfd_data (abfd, ptr) + bfd *abfd; + PTR ptr; +{ + FILE *file = (FILE *) ptr; + flagword flags; + + BFD_ASSERT (abfd != NULL && ptr != NULL); + + /* Print normal ELF private data. */ + _bfd_elf_print_private_bfd_data (abfd, ptr); + + flags = elf_elfheader (abfd)->e_flags; + fprintf (file, _("private flags = 0x%lx:"), (long)flags); + + switch (flags & EF_IQ2000_CPU_MASK) + { + default: break; + case EF_IQ2000_CPU_IQ2000: fprintf (file, " -m2000"); break; + case EF_IQ2000_CPU_IQ10: fprintf (file, " -m10"); break; + } + + fputc ('\n', file); + return TRUE; +} + +static +bfd_boolean +iq2000_elf_object_p (abfd) + bfd *abfd; +{ + /* Irix 5 and 6 is broken. Object file symbol tables are not always + sorted correctly such that local symbols precede global symbols, + and the sh_info field in the symbol table is not always right. */ + elf_bad_symtab (abfd) = TRUE; + + bfd_default_set_arch_mach (abfd, bfd_arch_iq2000, + elf32_iq2000_machine (abfd)); + return TRUE; +} + + +#define ELF_ARCH bfd_arch_iq2000 +#define ELF_MACHINE_CODE EM_IQ2000 +#define ELF_MAXPAGESIZE 0x1000 + +#define TARGET_BIG_SYM bfd_elf32_iq2000_vec +#define TARGET_BIG_NAME "elf32-iq2000" + +#define elf_info_to_howto_rel NULL +#define elf_info_to_howto iq2000_info_to_howto_rela +#define elf_backend_relocate_section iq2000_elf_relocate_section +#define elf_backend_gc_mark_hook iq2000_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook iq2000_elf_gc_sweep_hook +#define elf_backend_check_relocs iq2000_elf_check_relocs +#define elf_backend_object_p iq2000_elf_object_p +#define elf_backend_rela_normal 1 + +#define elf_backend_can_gc_sections 1 + +#define bfd_elf32_bfd_reloc_type_lookup iq2000_reloc_type_lookup +#define bfd_elf32_bfd_set_private_flags iq2000_elf_set_private_flags +#define bfd_elf32_bfd_copy_private_bfd_data iq2000_elf_copy_private_bfd_data +#define bfd_elf32_bfd_merge_private_bfd_data iq2000_elf_merge_private_bfd_data +#define bfd_elf32_bfd_print_private_bfd_data iq2000_elf_print_private_bfd_data + +#include "elf32-target.h" diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c new file mode 100644 index 0000000000000..21d37b176cee4 --- /dev/null +++ b/bfd/elf32-m32r.c @@ -0,0 +1,4811 @@ +/* M32R-specific support for 32-bit ELF. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/m32r.h" + +static bfd_reloc_status_type m32r_elf_10_pcrel_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type m32r_elf_do_10_pcrel_reloc + PARAMS ((bfd *, reloc_howto_type *, asection *, + bfd_byte *, bfd_vma, asection *, bfd_vma, bfd_vma)); +static bfd_reloc_status_type m32r_elf_hi16_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static void m32r_elf_relocate_hi16 + PARAMS ((bfd *, int, Elf_Internal_Rela *, Elf_Internal_Rela *, + bfd_byte *, bfd_vma)); +bfd_reloc_status_type m32r_elf_lo16_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +bfd_reloc_status_type m32r_elf_generic_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type m32r_elf_sda16_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void m32r_info_to_howto_rel + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static void m32r_info_to_howto + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +bfd_boolean _bfd_m32r_elf_section_from_bfd_section + PARAMS ((bfd *, asection *, int *)); +void _bfd_m32r_elf_symbol_processing + PARAMS ((bfd *, asymbol *)); +static bfd_boolean m32r_elf_add_symbol_hook + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *, + const char **, flagword *, asection **, bfd_vma *)); +static bfd_boolean m32r_elf_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +#if 0 /* not yet */ +static bfd_boolean m32r_elf_relax_delete_bytes + PARAMS ((bfd *, asection *, bfd_vma, int)); +#endif +static bfd_reloc_status_type m32r_elf_final_sda_base + PARAMS ((bfd *, struct bfd_link_info *, const char **, bfd_vma *)); +static bfd_boolean m32r_elf_object_p + PARAMS ((bfd *)); +static void m32r_elf_final_write_processing + PARAMS ((bfd *, bfd_boolean)); +static bfd_boolean m32r_elf_set_private_flags + PARAMS ((bfd *, flagword)); +static bfd_boolean m32r_elf_merge_private_bfd_data + PARAMS ((bfd *, bfd *)); +static bfd_boolean m32r_elf_print_private_bfd_data + PARAMS ((bfd *, PTR)); +static bfd_boolean m32r_elf_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static bfd_boolean m32r_elf_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); + +static bfd_boolean m32r_elf_adjust_dynamic_symbol + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); +static bfd_boolean m32r_elf_size_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + +asection * m32r_elf_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); + +static bfd_boolean m32r_elf_create_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + +static bfd_boolean m32r_elf_finish_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + +static bfd_boolean m32r_elf_finish_dynamic_symbol + PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *)); + +static bfd_boolean allocate_dynrelocs + PARAMS ((struct elf_link_hash_entry *, PTR)); +static bfd_boolean readonly_dynrelocs + PARAMS ((struct elf_link_hash_entry *, PTR)); +static enum elf_reloc_type_class m32r_elf_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); +static bfd_boolean m32r_elf_fake_sections + PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); + +#define NOP_INSN 0x7000 +#define MAKE_PARALLEL(insn) ((insn) | 0x8000) + +/* Use REL instead of RELA to save space. + This only saves space in libraries and object files, but perhaps + relocs will be put in ROM? All in all though, REL relocs are a pain + to work with. */ +/* #define USE_REL 1 + +#ifndef USE_REL +#define USE_REL 0 +#endif */ +/* Use RELA. But use REL to link old objects for backwords compatibility. */ + +/* Functions for the M32R ELF linker. */ + +/* The name of the dynamic interpreter. This is put in the .interp + section. */ + +#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1" + +/* The nop opcode we use. */ + +#define M32R_NOP 0x7000f000 + +#define PLT_EMPTY 0x10101010 /* RIE -> RIE */ + +/* The size in bytes of an entry in the procedure linkage table. */ + +#define PLT_ENTRY_SIZE 20 +#define PLT_HEADER_SIZE 20 + +/* The first one entries in a procedure linkage table are reserved, + and the initial contents are unimportant (we zero them out). + Subsequent entries look like this. */ + +#define PLT0_ENTRY_WORD0 0xd6c00000 /* seth r6, #high(.got+4) */ +#define PLT0_ENTRY_WORD1 0x86e60000 /* or3 r6, r6, #low(.got)+4) */ +#define PLT0_ENTRY_WORD2 0x24e626c6 /* ld r4, @r6+ -> ld r6, @r6 */ +#define PLT0_ENTRY_WORD3 0x1fc6f000 /* jmp r6 || pnop */ +#define PLT0_ENTRY_WORD4 PLT_EMPTY /* RIE -> RIE */ + +#define PLT0_PIC_ENTRY_WORD0 0xa4cc0004 /* ld r4, @(4,r12) */ +#define PLT0_PIC_ENTRY_WORD1 0xa6cc0008 /* ld r6, @(8,r12) */ +#define PLT0_PIC_ENTRY_WORD2 0x1fc6f000 /* jmp r6 || nop */ +#define PLT0_PIC_ENTRY_WORD3 PLT_EMPTY /* RIE -> RIE */ +#define PLT0_PIC_ENTRY_WORD4 PLT_EMPTY /* RIE -> RIE */ + +#define PLT_ENTRY_WORD0 0xe6000000 /* ld24 r6, .name_in_GOT */ +#define PLT_ENTRY_WORD1 0x06acf000 /* add r6, r12 || nop */ +#define PLT_ENTRY_WORD0b 0xd6c00000 /* seth r6, #high(.name_in_GOT) */ +#define PLT_ENTRY_WORD1b 0x86e60000 /* or3 r6, r6, #low(.name_in_GOT) */ +#define PLT_ENTRY_WORD2 0x26c61fc6 /* ld r6, @r6 -> jmp r6 */ +#define PLT_ENTRY_WORD3 0xe5000000 /* ld24 r5, $offset */ +#define PLT_ENTRY_WORD4 0xff000000 /* bra .plt0. */ + + +static reloc_howto_type m32r_elf_howto_table[] = +{ + /* This reloc does nothing. */ + HOWTO (R_M32R_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 16 bit absolute relocation. */ + HOWTO (R_M32R_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + m32r_elf_generic_reloc,/* special_function */ + "R_M32R_16", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit absolute relocation. */ + HOWTO (R_M32R_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + m32r_elf_generic_reloc,/* special_function */ + "R_M32R_32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 24 bit address. */ + HOWTO (R_M32R_24, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + m32r_elf_generic_reloc,/* special_function */ + "R_M32R_24", /* name */ + TRUE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An PC Relative 10-bit relocation, shifted by 2. + This reloc is complicated because relocations are relative to pc & -4. + i.e. branches in the right insn slot use the address of the left insn + slot for pc. */ + /* ??? It's not clear whether this should have partial_inplace set or not. + Branch relaxing in the assembler can store the addend in the insn, + and if bfd_install_relocation gets called the addend may get added + again. */ + HOWTO (R_M32R_10_PCREL, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 10, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + m32r_elf_10_pcrel_reloc, /* special_function */ + "R_M32R_10_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A relative 18 bit relocation, right shifted by 2. */ + HOWTO (R_M32R_18_PCREL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_18_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A relative 26 bit relocation, right shifted by 2. */ + /* ??? It's not clear whether this should have partial_inplace set or not. + Branch relaxing in the assembler can store the addend in the insn, + and if bfd_install_relocation gets called the addend may get added + again. */ + HOWTO (R_M32R_26_PCREL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_26_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* High 16 bits of address when lower 16 is or'd in. */ + HOWTO (R_M32R_HI16_ULO, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m32r_elf_hi16_reloc, /* special_function */ + "R_M32R_HI16_ULO", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* High 16 bits of address when lower 16 is added in. */ + HOWTO (R_M32R_HI16_SLO, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m32r_elf_hi16_reloc, /* special_function */ + "R_M32R_HI16_SLO", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Lower 16 bits of address. */ + HOWTO (R_M32R_LO16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m32r_elf_lo16_reloc, /* special_function */ + "R_M32R_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Small data area 16 bits offset. */ + HOWTO (R_M32R_SDA16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + m32r_elf_sda16_reloc, /* special_function */ + "R_M32R_SDA16", /* name */ + TRUE, /* partial_inplace */ /* FIXME: correct? */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_M32R_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_M32R_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_M32R_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_M32R_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (13), + EMPTY_HOWTO (14), + EMPTY_HOWTO (15), + EMPTY_HOWTO (16), + EMPTY_HOWTO (17), + EMPTY_HOWTO (18), + EMPTY_HOWTO (19), + EMPTY_HOWTO (20), + EMPTY_HOWTO (21), + EMPTY_HOWTO (22), + EMPTY_HOWTO (23), + EMPTY_HOWTO (24), + EMPTY_HOWTO (25), + EMPTY_HOWTO (26), + EMPTY_HOWTO (27), + EMPTY_HOWTO (28), + EMPTY_HOWTO (29), + EMPTY_HOWTO (30), + EMPTY_HOWTO (31), + EMPTY_HOWTO (32), + + /* A 16 bit absolute relocation. */ + HOWTO (R_M32R_16_RELA, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_16_RELA", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit absolute relocation. */ + HOWTO (R_M32R_32_RELA, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc,/* special_function */ + "R_M32R_32_RELA", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 24 bit address. */ + HOWTO (R_M32R_24_RELA, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc,/* special_function */ + "R_M32R_24_RELA", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_M32R_10_PCREL_RELA, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 10, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + m32r_elf_10_pcrel_reloc, /* special_function */ + "R_M32R_10_PCREL_RELA",/* name */ + FALSE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A relative 18 bit relocation, right shifted by 2. */ + HOWTO (R_M32R_18_PCREL_RELA, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_18_PCREL_RELA",/* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A relative 26 bit relocation, right shifted by 2. */ + HOWTO (R_M32R_26_PCREL_RELA, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_26_PCREL_RELA",/* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* High 16 bits of address when lower 16 is or'd in. */ + HOWTO (R_M32R_HI16_ULO_RELA, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_HI16_ULO_RELA",/* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* High 16 bits of address when lower 16 is added in. */ + HOWTO (R_M32R_HI16_SLO_RELA, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_HI16_SLO_RELA",/* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Lower 16 bits of address. */ + HOWTO (R_M32R_LO16_RELA, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_LO16_RELA", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Small data area 16 bits offset. */ + HOWTO (R_M32R_SDA16_RELA, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_SDA16_RELA", /* name */ + TRUE, /* partial_inplace */ /* FIXME: correct? */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_M32R_RELA_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_M32R_RELA_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_M32R_RELA_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_M32R_RELA_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (45), + EMPTY_HOWTO (46), + EMPTY_HOWTO (47), + + /* Like R_M32R_24, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOT24, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOT24", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Like R_M32R_PCREL, but referring to the procedure linkage table + entry for the symbol. */ + HOWTO (R_M32R_26_PLTREL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_26_PLTREL", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* This is used only by the dynamic linker. The symbol should exist + both in the object being run and in some shared library. The + dynamic linker copies the data addressed by the symbol from the + shared library into the object, because the object being + run has to have the data at some particular address. */ + HOWTO (R_M32R_COPY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_COPY", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Like R_M32R_24, but used when setting global offset table + entries. */ + HOWTO (R_M32R_GLOB_DAT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GLOB_DAT", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Marks a procedure linkage table entry for a symbol. */ + HOWTO (R_M32R_JMP_SLOT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_JMP_SLOT", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used only by the dynamic linker. When the object is run, this + longword is set to the load address of the object, plus the + addend. */ + HOWTO (R_M32R_RELATIVE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_RELATIVE", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_M32R_GOTOFF, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOTOFF", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An PC Relative 24-bit relocation used when setting PIC offset + table register. */ + HOWTO (R_M32R_GOTPC24, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOTPC24", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Like R_M32R_HI16_ULO, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOT16_HI_ULO, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOT16_HI_ULO", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Like R_M32R_HI16_SLO, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOT16_HI_SLO, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOT16_HI_SLO", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Like R_M32R_LO16, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOT16_LO, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOT16_LO", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An PC Relative relocation used when setting PIC offset table register. + Like R_M32R_HI16_ULO, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOTPC_HI_ULO, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOTPC_HI_ULO", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* An PC Relative relocation used when setting PIC offset table register. + Like R_M32R_HI16_SLO, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOTPC_HI_SLO, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOTPC_HI_SLO", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* An PC Relative relocation used when setting PIC offset table register. + Like R_M32R_LO16, but referring to the GOT table entry for + the symbol. */ + HOWTO (R_M32R_GOTPC_LO, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M32R_GOTPC_LO", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ +}; + +/* Handle the R_M32R_10_PCREL reloc. */ + +static bfd_reloc_status_type +m32r_elf_10_pcrel_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd * abfd; + arelent * reloc_entry; + asymbol * symbol; + PTR data; + asection * input_section; + bfd * output_bfd; + char ** error_message ATTRIBUTE_UNUSED; +{ + /* This part is from bfd_elf_generic_reloc. */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc_entry->howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (output_bfd != NULL) + { + /* FIXME: See bfd_perform_relocation. Is this right? */ + return bfd_reloc_continue; + } + + return m32r_elf_do_10_pcrel_reloc (abfd, reloc_entry->howto, + input_section, + data, reloc_entry->address, + symbol->section, + (symbol->value + + symbol->section->output_section->vma + + symbol->section->output_offset), + reloc_entry->addend); +} + +/* Utility to actually perform an R_M32R_10_PCREL reloc. */ + +static bfd_reloc_status_type +m32r_elf_do_10_pcrel_reloc (abfd, howto, input_section, data, offset, + symbol_section, symbol_value, addend) + bfd *abfd; + reloc_howto_type *howto; + asection *input_section; + bfd_byte *data; + bfd_vma offset; + asection *symbol_section ATTRIBUTE_UNUSED; + bfd_vma symbol_value; + bfd_vma addend; +{ + bfd_signed_vma relocation; + unsigned long x; + bfd_reloc_status_type status; + + /* Sanity check the address (offset in section). */ + if (offset > input_section->_cooked_size) + return bfd_reloc_outofrange; + + relocation = symbol_value + addend; + /* Make it pc relative. */ + relocation -= (input_section->output_section->vma + + input_section->output_offset); + /* These jumps mask off the lower two bits of the current address + before doing pcrel calculations. */ + relocation -= (offset & -(bfd_vma) 4); + + if (relocation < -0x200 || relocation > 0x1ff) + status = bfd_reloc_overflow; + else + status = bfd_reloc_ok; + + x = bfd_get_16 (abfd, data + offset); + relocation >>= howto->rightshift; + relocation <<= howto->bitpos; + x = (x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask); + bfd_put_16 (abfd, (bfd_vma) x, data + offset); + + return status; +} + +/* Handle the R_M32R_HI16_[SU]LO relocs. + HI16_SLO is for the add3 and load/store with displacement instructions. + HI16_ULO is for the or3 instruction. + For R_M32R_HI16_SLO, the lower 16 bits are sign extended when added to + the high 16 bytes so if the lower 16 bits are negative (bit 15 == 1) then + we must add one to the high 16 bytes (which will get subtracted off when + the low 16 bits are added). + These relocs have to be done in combination with an R_M32R_LO16 reloc + because there is a carry from the LO16 to the HI16. Here we just save + the information we need; we do the actual relocation when we see the LO16. + This code is copied from the elf32-mips.c. We also support an arbitrary + number of HI16 relocs to be associated with a single LO16 reloc. The + assembler sorts the relocs to ensure each HI16 immediately precedes its + LO16. However if there are multiple copies, the assembler may not find + the real LO16 so it picks the first one it finds. */ + +struct m32r_hi16 +{ + struct m32r_hi16 *next; + bfd_byte *addr; + bfd_vma addend; +}; + +/* FIXME: This should not be a static variable. */ + +static struct m32r_hi16 *m32r_hi16_list; + +static bfd_reloc_status_type +m32r_elf_hi16_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + bfd_reloc_status_type ret; + bfd_vma relocation; + struct m32r_hi16 *n; + + /* This part is from bfd_elf_generic_reloc. + If we're relocating, and this an external symbol, we don't want + to change anything. */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && reloc_entry->addend == 0) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* Sanity check the address (offset in section). */ + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + ret = bfd_reloc_ok; + if (bfd_is_und_section (symbol->section) + && output_bfd == (bfd *) NULL) + ret = bfd_reloc_undefined; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + + /* Save the information, and let LO16 do the actual relocation. */ + n = (struct m32r_hi16 *) bfd_malloc ((bfd_size_type) sizeof *n); + if (n == NULL) + return bfd_reloc_outofrange; + n->addr = (bfd_byte *) data + reloc_entry->address; + n->addend = relocation; + n->next = m32r_hi16_list; + m32r_hi16_list = n; + + if (output_bfd != (bfd *) NULL) + reloc_entry->address += input_section->output_offset; + + return ret; +} + +/* Handle an M32R ELF HI16 reloc. */ + +static void +m32r_elf_relocate_hi16 (input_bfd, type, relhi, rello, contents, addend) + bfd *input_bfd; + int type; + Elf_Internal_Rela *relhi; + Elf_Internal_Rela *rello; + bfd_byte *contents; + bfd_vma addend; +{ + unsigned long insn; + bfd_vma addlo; + + insn = bfd_get_32 (input_bfd, contents + relhi->r_offset); + + addlo = bfd_get_32 (input_bfd, contents + rello->r_offset); + if (type == R_M32R_HI16_SLO) + addlo = ((addlo & 0xffff) ^ 0x8000) - 0x8000; + else + addlo &= 0xffff; + + addend += ((insn & 0xffff) << 16) + addlo; + + /* Reaccount for sign extension of low part. */ + if (type == R_M32R_HI16_SLO + && (addend & 0x8000) != 0) + addend += 0x10000; + + bfd_put_32 (input_bfd, + (insn & 0xffff0000) | ((addend >> 16) & 0xffff), + contents + relhi->r_offset); +} + +/* Do an R_M32R_LO16 relocation. This is a straightforward 16 bit + inplace relocation; this function exists in order to do the + R_M32R_HI16_[SU]LO relocation described above. */ + +bfd_reloc_status_type +m32r_elf_lo16_reloc (input_bfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *input_bfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + /* This part is from bfd_elf_generic_reloc. + If we're relocating, and this an external symbol, we don't want + to change anything. */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && reloc_entry->addend == 0) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (m32r_hi16_list != NULL) + { + struct m32r_hi16 *l; + + l = m32r_hi16_list; + while (l != NULL) + { + unsigned long insn; + unsigned long val; + unsigned long vallo; + struct m32r_hi16 *next; + + /* Do the HI16 relocation. Note that we actually don't need + to know anything about the LO16 itself, except where to + find the low 16 bits of the addend needed by the LO16. */ + insn = bfd_get_32 (input_bfd, l->addr); + vallo = ((bfd_get_32 (input_bfd, (bfd_byte *) data + reloc_entry->address) + & 0xffff) ^ 0x8000) - 0x8000; + val = ((insn & 0xffff) << 16) + vallo; + val += l->addend; + + /* Reaccount for sign extension of low part. */ + if ((val & 0x8000) != 0) + val += 0x10000; + + insn = (insn &~ (bfd_vma) 0xffff) | ((val >> 16) & 0xffff); + bfd_put_32 (input_bfd, (bfd_vma) insn, l->addr); + + next = l->next; + free (l); + l = next; + } + + m32r_hi16_list = NULL; + } + + /* Now do the LO16 reloc in the usual way. + ??? It would be nice to call bfd_elf_generic_reloc here, + but we have partial_inplace set. bfd_elf_generic_reloc will + pass the handling back to bfd_install_relocation which will install + a section relative addend which is wrong. */ + return m32r_elf_generic_reloc (input_bfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); +} + +/* Do generic partial_inplace relocation. + This is a local replacement for bfd_elf_generic_reloc. */ + +bfd_reloc_status_type +m32r_elf_generic_reloc (input_bfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *input_bfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + bfd_reloc_status_type ret; + bfd_vma relocation; + bfd_byte *inplace_address; + + /* This part is from bfd_elf_generic_reloc. + If we're relocating, and this an external symbol, we don't want + to change anything. */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && reloc_entry->addend == 0) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* Now do the reloc in the usual way. + ??? It would be nice to call bfd_elf_generic_reloc here, + but we have partial_inplace set. bfd_elf_generic_reloc will + pass the handling back to bfd_install_relocation which will install + a section relative addend which is wrong. */ + + /* Sanity check the address (offset in section). */ + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + ret = bfd_reloc_ok; + if (bfd_is_und_section (symbol->section) + && output_bfd == (bfd *) NULL) + ret = bfd_reloc_undefined; + + if (bfd_is_com_section (symbol->section) + || output_bfd != (bfd *) NULL) + relocation = 0; + else + relocation = symbol->value; + + /* Only do this for a final link. */ + if (output_bfd == (bfd *) NULL) + { + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + } + + relocation += reloc_entry->addend; + inplace_address = (bfd_byte *) data + reloc_entry->address; + +#define DOIT(x) \ + x = ( (x & ~reloc_entry->howto->dst_mask) | \ + (((x & reloc_entry->howto->src_mask) + relocation) & \ + reloc_entry->howto->dst_mask)) + + switch (reloc_entry->howto->size) + { + case 1: + { + short x = bfd_get_16 (input_bfd, inplace_address); + DOIT (x); + bfd_put_16 (input_bfd, (bfd_vma) x, inplace_address); + } + break; + case 2: + { + unsigned long x = bfd_get_32 (input_bfd, inplace_address); + DOIT (x); + bfd_put_32 (input_bfd, (bfd_vma)x , inplace_address); + } + break; + default: + BFD_ASSERT (0); + } + + if (output_bfd != (bfd *) NULL) + reloc_entry->address += input_section->output_offset; + + return ret; +} + +/* Handle the R_M32R_SDA16 reloc. + This reloc is used to compute the address of objects in the small data area + and to perform loads and stores from that area. + The lower 16 bits are sign extended and added to the register specified + in the instruction, which is assumed to point to _SDA_BASE_. */ + +static bfd_reloc_status_type +m32r_elf_sda16_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry; + asymbol *symbol; + PTR data ATTRIBUTE_UNUSED; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + /* This part is from bfd_elf_generic_reloc. */ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc_entry->howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (output_bfd != NULL) + { + /* FIXME: See bfd_perform_relocation. Is this right? */ + return bfd_reloc_continue; + } + + /* FIXME: not sure what to do here yet. But then again, the linker + may never call us. */ + abort (); +} + +/* Map BFD reloc types to M32R ELF reloc types. */ + +struct m32r_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +static const struct m32r_reloc_map m32r_reloc_map_old[] = +{ + { BFD_RELOC_NONE, R_M32R_NONE }, + { BFD_RELOC_16, R_M32R_16 }, + { BFD_RELOC_32, R_M32R_32 }, + { BFD_RELOC_M32R_24, R_M32R_24 }, + { BFD_RELOC_M32R_10_PCREL, R_M32R_10_PCREL }, + { BFD_RELOC_M32R_18_PCREL, R_M32R_18_PCREL }, + { BFD_RELOC_M32R_26_PCREL, R_M32R_26_PCREL }, + { BFD_RELOC_M32R_HI16_ULO, R_M32R_HI16_ULO }, + { BFD_RELOC_M32R_HI16_SLO, R_M32R_HI16_SLO }, + { BFD_RELOC_M32R_LO16, R_M32R_LO16 }, + { BFD_RELOC_M32R_SDA16, R_M32R_SDA16 }, + { BFD_RELOC_VTABLE_INHERIT, R_M32R_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_M32R_GNU_VTENTRY }, +}; + +static const struct m32r_reloc_map m32r_reloc_map[] = +{ + { BFD_RELOC_NONE, R_M32R_NONE }, + { BFD_RELOC_16, R_M32R_16_RELA }, + { BFD_RELOC_32, R_M32R_32_RELA }, + { BFD_RELOC_M32R_24, R_M32R_24_RELA }, + { BFD_RELOC_M32R_10_PCREL, R_M32R_10_PCREL_RELA }, + { BFD_RELOC_M32R_18_PCREL, R_M32R_18_PCREL_RELA }, + { BFD_RELOC_M32R_26_PCREL, R_M32R_26_PCREL_RELA }, + { BFD_RELOC_M32R_HI16_ULO, R_M32R_HI16_ULO_RELA }, + { BFD_RELOC_M32R_HI16_SLO, R_M32R_HI16_SLO_RELA }, + { BFD_RELOC_M32R_LO16, R_M32R_LO16_RELA }, + { BFD_RELOC_M32R_SDA16, R_M32R_SDA16_RELA }, + { BFD_RELOC_VTABLE_INHERIT, R_M32R_RELA_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_M32R_RELA_GNU_VTENTRY }, + + { BFD_RELOC_M32R_GOT24, R_M32R_GOT24 }, + { BFD_RELOC_M32R_26_PLTREL, R_M32R_26_PLTREL }, + { BFD_RELOC_M32R_COPY, R_M32R_COPY }, + { BFD_RELOC_M32R_GLOB_DAT, R_M32R_GLOB_DAT }, + { BFD_RELOC_M32R_JMP_SLOT, R_M32R_JMP_SLOT }, + { BFD_RELOC_M32R_RELATIVE, R_M32R_RELATIVE }, + { BFD_RELOC_M32R_GOTOFF, R_M32R_GOTOFF }, + { BFD_RELOC_M32R_GOTPC24, R_M32R_GOTPC24 }, + { BFD_RELOC_M32R_GOT16_HI_ULO, R_M32R_GOT16_HI_ULO }, + { BFD_RELOC_M32R_GOT16_HI_SLO, R_M32R_GOT16_HI_SLO }, + { BFD_RELOC_M32R_GOT16_LO, R_M32R_GOT16_LO }, + { BFD_RELOC_M32R_GOTPC_HI_ULO, R_M32R_GOTPC_HI_ULO }, + { BFD_RELOC_M32R_GOTPC_HI_SLO, R_M32R_GOTPC_HI_SLO }, + { BFD_RELOC_M32R_GOTPC_LO, R_M32R_GOTPC_LO }, +}; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + +#ifdef USE_M32R_OLD_RELOC + for (i = 0; + i < sizeof (m32r_reloc_map_old) / sizeof (struct m32r_reloc_map); + i++) + { + if (m32r_reloc_map_old[i].bfd_reloc_val == code) + return &m32r_elf_howto_table[m32r_reloc_map_old[i].elf_reloc_val]; + } +#else /* ! USE_M32R_OLD_RELOC */ + + for (i = 0; + i < sizeof (m32r_reloc_map) / sizeof (struct m32r_reloc_map); + i++) + { + if (m32r_reloc_map[i].bfd_reloc_val == code) + return &m32r_elf_howto_table[m32r_reloc_map[i].elf_reloc_val]; + } +#endif + + return NULL; +} + +/* Set the howto pointer for an M32R ELF reloc. */ + +static void +m32r_info_to_howto_rel (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (ELF32_R_TYPE(dst->r_info) <= (unsigned int) R_M32R_GNU_VTENTRY) + cache_ptr->howto = &m32r_elf_howto_table[r_type]; +} + +static void +m32r_info_to_howto (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + BFD_ASSERT ((ELF32_R_TYPE(dst->r_info) == (unsigned int) R_M32R_NONE) + || ((ELF32_R_TYPE(dst->r_info) > (unsigned int) R_M32R_GNU_VTENTRY) + && (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_M32R_max))); + cache_ptr->howto = &m32r_elf_howto_table[ELF32_R_TYPE(dst->r_info)]; +} + + +/* Given a BFD section, try to locate the corresponding ELF section + index. */ + +bfd_boolean +_bfd_m32r_elf_section_from_bfd_section (abfd, sec, retval) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + int *retval; +{ + if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) + { + *retval = SHN_M32R_SCOMMON; + return TRUE; + } + return FALSE; +} + +/* M32R ELF uses two common sections. One is the usual one, and the other + is for small objects. All the small objects are kept together, and then + referenced via one register, which yields faster assembler code. It is + up to the compiler to emit an instruction to load the register with + _SDA_BASE. This is what we use for the small common section. This + approach is copied from elf32-mips.c. */ +static asection m32r_elf_scom_section; +static asymbol m32r_elf_scom_symbol; +static asymbol *m32r_elf_scom_symbol_ptr; + +/* Handle the special M32R section numbers that a symbol may use. */ + +void +_bfd_m32r_elf_symbol_processing (abfd, asym) + bfd *abfd ATTRIBUTE_UNUSED; + asymbol *asym; +{ + elf_symbol_type *elfsym; + + elfsym = (elf_symbol_type *) asym; + + switch (elfsym->internal_elf_sym.st_shndx) + { + case SHN_M32R_SCOMMON: + if (m32r_elf_scom_section.name == NULL) + { + /* Initialize the small common section. */ + m32r_elf_scom_section.name = ".scommon"; + m32r_elf_scom_section.flags = SEC_IS_COMMON; + m32r_elf_scom_section.output_section = &m32r_elf_scom_section; + m32r_elf_scom_section.symbol = &m32r_elf_scom_symbol; + m32r_elf_scom_section.symbol_ptr_ptr = &m32r_elf_scom_symbol_ptr; + m32r_elf_scom_symbol.name = ".scommon"; + m32r_elf_scom_symbol.flags = BSF_SECTION_SYM; + m32r_elf_scom_symbol.section = &m32r_elf_scom_section; + m32r_elf_scom_symbol_ptr = &m32r_elf_scom_symbol; + } + asym->section = &m32r_elf_scom_section; + asym->value = elfsym->internal_elf_sym.st_size; + break; + } +} + +/* Hook called by the linker routine which adds symbols from an object + file. We must handle the special M32R section numbers here. + We also keep watching for whether we need to create the sdata special + linker sections. */ + +static bfd_boolean +m32r_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) + bfd *abfd; + struct bfd_link_info *info; + Elf_Internal_Sym *sym; + const char **namep; + flagword *flagsp ATTRIBUTE_UNUSED; + asection **secp; + bfd_vma *valp; +{ + if (! info->relocatable + && (*namep)[0] == '_' && (*namep)[1] == 'S' + && strcmp (*namep, "_SDA_BASE_") == 0 + && is_elf_hash_table (info->hash)) + { + /* This is simpler than using _bfd_elf_create_linker_section + (our needs are simpler than ppc's needs). Also + _bfd_elf_create_linker_section currently has a bug where if a .sdata + section already exists a new one is created that follows it which + screws of _SDA_BASE_ address calcs because output_offset != 0. */ + struct elf_link_hash_entry *h; + struct bfd_link_hash_entry *bh; + asection *s = bfd_get_section_by_name (abfd, ".sdata"); + + /* The following code was cobbled from elf32-ppc.c and elflink.c. */ + + if (s == NULL) + { + flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + + s = bfd_make_section_anyway (abfd, ".sdata"); + if (s == NULL) + return FALSE; + bfd_set_section_flags (abfd, s, flags); + bfd_set_section_alignment (abfd, s, 2); + } + + bh = bfd_link_hash_lookup (info->hash, "_SDA_BASE_", + FALSE, FALSE, FALSE); + + if ((bh == NULL || bh->type == bfd_link_hash_undefined) + && !(_bfd_generic_link_add_one_symbol (info, + abfd, + "_SDA_BASE_", + BSF_GLOBAL, + s, + (bfd_vma) 32768, + (const char *) NULL, + FALSE, + get_elf_backend_data (abfd)->collect, + &bh))) + return FALSE; + h = (struct elf_link_hash_entry *) bh; + h->type = STT_OBJECT; + } + + switch (sym->st_shndx) + { + case SHN_M32R_SCOMMON: + *secp = bfd_make_section_old_way (abfd, ".scommon"); + (*secp)->flags |= SEC_IS_COMMON; + *valp = sym->st_size; + break; + } + + return TRUE; +} + +/* We have to figure out the SDA_BASE value, so that we can adjust the + symbol value correctly. We look up the symbol _SDA_BASE_ in the output + BFD. If we can't find it, we're stuck. We cache it in the ELF + target data. We don't need to adjust the symbol value for an + external symbol if we are producing relocatable output. */ + +static bfd_reloc_status_type +m32r_elf_final_sda_base (output_bfd, info, error_message, psb) + bfd *output_bfd; + struct bfd_link_info *info; + const char **error_message; + bfd_vma *psb; +{ + if (elf_gp (output_bfd) == 0) + { + struct bfd_link_hash_entry *h; + + h = bfd_link_hash_lookup (info->hash, "_SDA_BASE_", FALSE, FALSE, TRUE); + if (h != (struct bfd_link_hash_entry *) NULL + && h->type == bfd_link_hash_defined) + elf_gp (output_bfd) = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + else + { + /* Only get the error once. */ + *psb = elf_gp (output_bfd) = 4; + *error_message = + (const char *) _("SDA relocation when _SDA_BASE_ not defined"); + return bfd_reloc_dangerous; + } + } + *psb = elf_gp (output_bfd); + return bfd_reloc_ok; +} + +/* Return size of a PLT entry. */ +#define elf_m32r_sizeof_plt(info) PLT_ENTRY_SIZE + +/* The m32r linker needs to keep track of the number of relocs that it + decides to copy in check_relocs for each symbol. This is so that + it can discard PC relative relocs if it doesn't need them when + linking with -Bsymbolic. We store the information in a field + extending the regular ELF linker hash table. */ + +/* This structure keeps track of the number of PC relative relocs we + have copied for a given symbol. */ + +struct elf_m32r_pcrel_relocs_copied +{ + /* Next section. */ + struct elf_m32r_pcrel_relocs_copied *next; + /* A section in dynobj. */ + asection *section; + /* Number of relocs copied in this section. */ + bfd_size_type count; +}; + +/* The sh linker needs to keep track of the number of relocs that it + decides to copy as dynamic relocs in check_relocs for each symbol. + This is so that it can later discard them if they are found to be + unnecessary. We store the information in a field extending the + regular ELF linker hash table. */ + +struct elf_m32r_dyn_relocs +{ + struct elf_m32r_dyn_relocs *next; + + /* The input section of the reloc. */ + asection *sec; + + /* Total number of relocs copied for the input section. */ + bfd_size_type count; + + /* Number of pc-relative relocs copied for the input section. */ + bfd_size_type pc_count; +}; + + +/* m32r ELF linker hash entry. */ + +struct elf_m32r_link_hash_entry +{ + struct elf_link_hash_entry root; + + /* Track dynamic relocs copied for this symbol. */ + struct elf_m32r_dyn_relocs *dyn_relocs; + +// bfd_signed_vma gotplt_refcount; + + /* Number of PC relative relocs copied for this symbol. */ + /* struct elf_m32r_pcrel_relocs_copied *pcrel_relocs_copied; FIXME */ +}; + +/* m32r ELF linker hash table. */ + +struct elf_m32r_link_hash_table +{ + struct elf_link_hash_table root; + + /* Short-cuts to get to dynamic linker sections. */ + asection *sgot; + asection *sgotplt; + asection *srelgot; + asection *splt; + asection *srelplt; + asection *sdynbss; + asection *srelbss; + + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; +}; + +/* Traverse an m32r ELF linker hash table. */ + +#define m32r_elf_link_hash_traverse(table, func, info) \ + (elf_link_hash_traverse \ + (&(table)->root, \ + (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ + (info))) + +/* Get the m32r ELF linker hash table from a link_info structure. */ + + +#define m32r_elf_hash_table(p) \ + ((struct elf_m32r_link_hash_table *) ((p)->hash)) + +/* Create an entry in an m32r ELF linker hash table. */ +static struct bfd_hash_entry * +m32r_elf_link_hash_newfunc (struct bfd_hash_entry *, struct bfd_hash_table *, + const char * ); + +static struct bfd_hash_entry * +m32r_elf_link_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct elf_m32r_link_hash_entry *ret = + (struct elf_m32r_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct elf_m32r_link_hash_entry *) NULL) + ret = ((struct elf_m32r_link_hash_entry *) + bfd_hash_allocate (table, + sizeof (struct elf_m32r_link_hash_entry))); + if (ret == (struct elf_m32r_link_hash_entry *) NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct elf_m32r_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != (struct elf_m32r_link_hash_entry *) NULL) + { + struct elf_m32r_link_hash_entry *eh; + + eh = (struct elf_m32r_link_hash_entry *) ret; + eh->dyn_relocs = NULL; +// eh->gotplt_refcount = 0; + /* eh->pcrel_relocs_copied = NULL; FIXME */ + } + + return (struct bfd_hash_entry *) ret; +} + +/* Create an m32r ELF linker hash table. */ +static struct bfd_link_hash_table *m32r_elf_link_hash_table_create (bfd *); + +static struct bfd_link_hash_table * +m32r_elf_link_hash_table_create (abfd) + bfd *abfd; +{ + struct elf_m32r_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_m32r_link_hash_table); + + ret = (struct elf_m32r_link_hash_table *) bfd_malloc (amt); + if (ret == (struct elf_m32r_link_hash_table *) NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + m32r_elf_link_hash_newfunc)) + { + free (ret); + return NULL; + } + + ret->sgot = NULL; + ret->sgotplt = NULL; + ret->srelgot = NULL; + ret->splt = NULL; + ret->srelplt = NULL; + ret->sdynbss = NULL; + ret->srelbss = NULL; + ret->sym_sec.abfd = NULL; + + return &ret->root.root; +} + +/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up + shortcuts to them in our hash table. */ +static bfd_boolean create_got_section (bfd *, struct bfd_link_info *); + +static bfd_boolean +create_got_section (dynobj, info) + bfd *dynobj; + struct bfd_link_info *info; +{ + struct elf_m32r_link_hash_table *htab; + + if (! _bfd_elf_create_got_section (dynobj, info)) + return FALSE; + + htab = m32r_elf_hash_table (info); + htab->sgot = bfd_get_section_by_name (dynobj, ".got"); + htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + if (! htab->sgot || ! htab->sgotplt) + abort (); + + htab->srelgot = bfd_make_section (dynobj, ".rela.got"); + if (htab->srelgot == NULL + || ! bfd_set_section_flags (dynobj, htab->srelgot, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2)) + return FALSE; + + return TRUE; +} + +/* Create dynamic sections when linking against a dynamic object. */ + +static bfd_boolean +m32r_elf_create_dynamic_sections (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + struct elf_m32r_link_hash_table *htab; + flagword flags, pltflags; + register asection *s; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + int ptralign = 2; /* 32bit */ + + htab = m32r_elf_hash_table (info); + + /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and + .rel[a].bss sections. */ + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + + pltflags = flags; + pltflags |= SEC_CODE; + if (bed->plt_not_loaded) + pltflags &= ~ (SEC_LOAD | SEC_HAS_CONTENTS); + if (bed->plt_readonly) + pltflags |= SEC_READONLY; + + s = bfd_make_section (abfd, ".plt"); + htab->splt = s; + if (s == NULL + || ! bfd_set_section_flags (abfd, s, pltflags) + || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + return FALSE; + + if (bed->want_plt_sym) + { + /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the + .plt section. */ + struct bfd_link_hash_entry *bh = NULL; + struct elf_link_hash_entry *h; + if (! (_bfd_generic_link_add_one_symbol + (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s, + (bfd_vma) 0, (const char *) NULL, FALSE, + get_elf_backend_data (abfd)->collect, &bh))) + return FALSE; + h = (struct elf_link_hash_entry *) bh; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; + + if (info->shared + && ! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = bfd_make_section (abfd, + bed->default_use_rela_p ? ".rela.plt" : ".rel.plt"); + htab->srelplt = s; + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + + if (htab->sgot == NULL + && ! create_got_section (abfd, info)) + return FALSE; + + { + const char *secname; + char *relname; + flagword secflags; + asection *sec; + + for (sec = abfd->sections; sec; sec = sec->next) + { + secflags = bfd_get_section_flags (abfd, sec); + if ((secflags & (SEC_DATA | SEC_LINKER_CREATED)) + || ((secflags & SEC_HAS_CONTENTS) != SEC_HAS_CONTENTS)) + continue; + secname = bfd_get_section_name (abfd, sec); + relname = (char *) bfd_malloc ((bfd_size_type) strlen (secname) + 6); + strcpy (relname, ".rela"); + strcat (relname, secname); + if (bfd_get_section_by_name (abfd, secname)) + continue; + s = bfd_make_section (abfd, relname); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + } + } + + if (bed->want_dynbss) + { + /* The .dynbss section is a place to put symbols which are defined + by dynamic objects, are referenced by regular objects, and are + not functions. We must allocate space for them in the process + image and use a R_*_COPY reloc to tell the dynamic linker to + initialize them at run time. The linker script puts the .dynbss + section into the .bss section of the final image. */ + s = bfd_make_section (abfd, ".dynbss"); + htab->sdynbss = s; + if (s == NULL + || ! bfd_set_section_flags (abfd, s, SEC_ALLOC)) + return FALSE; + /* The .rel[a].bss section holds copy relocs. This section is not + normally needed. We need to create it here, though, so that the + linker will map it to an output section. We can't just create it + only if we need it, because we will not know whether we need it + until we have seen all the input files, and the first time the + main linker code calls BFD after examining all the input files + (size_dynamic_sections) the input sections have already been + mapped to the output sections. If the section turns out not to + be needed, we can discard it later. We will never need this + section when generating a shared object, since they do not use + copy relocs. */ + if (! info->shared) + { + s = bfd_make_section (abfd, + (bed->default_use_rela_p + ? ".rela.bss" : ".rel.bss")); + htab->srelbss = s; + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + } + } + + return TRUE; +} + +/* Copy the extra info we tack onto an elf_link_hash_entry. */ +static void m32r_elf_copy_indirect_symbol (const struct elf_backend_data *, + struct elf_link_hash_entry *, + struct elf_link_hash_entry *); + +static void +m32r_elf_copy_indirect_symbol (const struct elf_backend_data *bed, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) +{ + struct elf_m32r_link_hash_entry *edir, *eind; + + edir = (struct elf_m32r_link_hash_entry *) dir; + eind = (struct elf_m32r_link_hash_entry *) ind; + + if (eind->dyn_relocs != NULL) + { + if (edir->dyn_relocs != NULL) + { + struct elf_m32r_dyn_relocs **pp; + struct elf_m32r_dyn_relocs *p; + + if (ind->root.type == bfd_link_hash_indirect) + abort (); + + /* Add reloc counts against the weak sym to the strong sym + list. Merge any entries against the same section. */ + for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + { + struct elf_m32r_dyn_relocs *q; + + for (q = edir->dyn_relocs; q != NULL; q = q->next) + if (q->sec == p->sec) + { + q->pc_count += p->pc_count; + q->count += p->count; + *pp = p->next; + break; + } + if (q == NULL) + pp = &p->next; + } + *pp = edir->dyn_relocs; + } + + edir->dyn_relocs = eind->dyn_relocs; + eind->dyn_relocs = NULL; + } + +// if (ind->root.type == bfd_link_hash_indirect +// && dir->got.refcount <= 0) +// { +// edir->tls_type = eind->tls_type; +// eind->tls_type = GOT_UNKNOWN; +// } + _bfd_elf_link_hash_copy_indirect (bed, dir, ind); +} + + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static bfd_boolean +m32r_elf_adjust_dynamic_symbol (info, h) + struct bfd_link_info *info; + struct elf_link_hash_entry *h; +{ + struct elf_m32r_link_hash_table *htab; + struct elf_m32r_link_hash_entry *eh; + struct elf_m32r_dyn_relocs *p; + bfd *dynobj; + asection *s; + unsigned int power_of_two; + +#ifdef DEBUG_PIC +printf("m32r_elf_adjust_dynamic_symbol()\n"); +#endif + + dynobj = elf_hash_table (info)->dynobj; + + /* Make sure we know what is going on here. */ + BFD_ASSERT (dynobj != NULL + && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) + || h->weakdef != NULL + || ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_REF_REGULAR) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))); + + + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later, + when we know the address of the .got section. */ + if (h->type == STT_FUNC + || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + { + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 + && h->root.type != bfd_link_hash_undefweak + && h->root.type != bfd_link_hash_undefined) + { + /* This case can occur if we saw a PLT reloc in an input + file, but the symbol was never referred to by a dynamic + object. In such a case, we don't actually need to build + a procedure linkage table, and we can just do a PCREL + reloc instead. */ + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + + return TRUE; + } + else + h->plt.offset = (bfd_vma) -1; + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (info->shared) + return TRUE; + + /* If there are no references to this symbol that do not use the + GOT, we don't need to generate a copy reloc. */ + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + return TRUE; + + /* If -z nocopyreloc was given, we won't generate them either. */ + if (info->nocopyreloc) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return TRUE; + } + + eh = (struct elf_m32r_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + s = p->sec->output_section; + if (s != NULL && (s->flags & (SEC_READONLY | SEC_HAS_CONTENTS)) != 0) + break; + } + + /* If we didn't find any dynamic relocs in sections which needs the + copy reloc, then we'll be keeping the dynamic relocs and avoiding + the copy reloc. */ + if (p == NULL) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return TRUE; + } + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + + htab = m32r_elf_hash_table (info); + s = htab->sdynbss; + BFD_ASSERT (s != NULL); + + /* We must generate a R_M32R_COPY reloc to tell the dynamic linker + to copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rela.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + asection *srel; + + srel = htab->srelbss; + BFD_ASSERT (srel != NULL); + srel->_raw_size += sizeof (Elf32_External_Rela); + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + } + + /* We need to figure out the alignment required for this symbol. I + have no idea how ELF linkers handle this. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > 3) + power_of_two = 3; + + /* Apply the required alignment. */ + s->_raw_size = BFD_ALIGN (s->_raw_size, + (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (dynobj, s)) + { + if (! bfd_set_section_alignment (dynobj, s, power_of_two)) + return FALSE; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + + /* Increment the section size to make room for the symbol. */ + s->_raw_size += h->size; + + return TRUE; +} + +/* Allocate space in .plt, .got and associated reloc sections for + dynamic relocs. */ + +static bfd_boolean +allocate_dynrelocs (h, inf) + struct elf_link_hash_entry *h; + PTR inf; +{ + struct bfd_link_info *info; + struct elf_m32r_link_hash_table *htab; + struct elf_m32r_link_hash_entry *eh; + struct elf_m32r_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + /* When warning symbols are created, they **replace** the "real" + entry in the hash table, thus we never get to see the real + symbol in a hash traversal. So look at it now. */ + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + info = (struct bfd_link_info *) inf; + htab = m32r_elf_hash_table (info); + + eh = (struct elf_m32r_link_hash_entry *) h; +// if ((h->got.refcount > 0 +// || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) +// && eh->gotplt_refcount > 0) +// { +// /* The symbol has been forced local, or we have some direct got refs, +// so treat all the gotplt refs as got refs. */ +// h->got.refcount += eh->gotplt_refcount; +// if (h->plt.refcount >= eh->gotplt_refcount) +// h->plt.refcount -= eh->gotplt_refcount; +// } + + if (htab->root.dynamic_sections_created + && h->plt.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h)) + { + asection *s = htab->splt; + + /* If this is the first .plt entry, make room for the special + first entry. */ + if (s->_raw_size == 0) + s->_raw_size += PLT_ENTRY_SIZE; + + h->plt.offset = s->_raw_size; + + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + h->root.u.def.section = s; + h->root.u.def.value = h->plt.offset; + } + + /* Make room for this entry. */ + s->_raw_size += PLT_ENTRY_SIZE; + + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + htab->sgotplt->_raw_size += 4; + + /* We also need to make an entry in the .rel.plt section. */ + htab->srelplt->_raw_size += sizeof (Elf32_External_Rela); + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + + if (h->got.refcount > 0) + { + asection *s; + bfd_boolean dyn; + + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = htab->sgot; + + h->got.offset = s->_raw_size; + s->_raw_size += 4; + dyn = htab->root.dynamic_sections_created; + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)) + htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + else + h->got.offset = (bfd_vma) -1; + + if (eh->dyn_relocs == NULL) + return TRUE; + + /* In the shared -Bsymbolic case, discard space allocated for + dynamic pc-relative relocs against symbols which turn out to be + defined in regular objects. For the normal shared case, discard + space for pc-relative relocs that have become local due to symbol + visibility changes. */ + + if (info->shared) + { + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 + || info->symbolic)) + { + struct elf_m32r_dyn_relocs **pp; + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + { + p->count -= p->pc_count; + p->pc_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } + } + else + { + /* For the non-shared case, discard space for relocs against + symbols which turn out to need copy relocs or are not + dynamic. */ + + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 + && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + || (htab->root.dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + /* If that succeeded, we know we'll be keeping all the + relocs. */ + if (h->dynindx != -1) + goto keep; + } + + eh->dyn_relocs = NULL; + + keep: ; + } + + /* Finally, allocate space. */ + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *sreloc = elf_section_data (p->sec)->sreloc; + sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela); + } + + return TRUE; +} +/* Find any dynamic relocs that apply to read-only sections. */ + +static bfd_boolean +readonly_dynrelocs (h, inf) + struct elf_link_hash_entry *h; + PTR inf; +{ + struct elf_m32r_link_hash_entry *eh; + struct elf_m32r_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + eh = (struct elf_m32r_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *s = p->sec->output_section; + + if (s != NULL && (s->flags & SEC_READONLY) != 0) + { + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + info->flags |= DF_TEXTREL; + + /* Not an error, just cut short the traversal. */ + return FALSE; + } + } + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +m32r_elf_size_dynamic_sections (output_bfd, info) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; +{ + struct elf_m32r_link_hash_table *htab; + bfd *dynobj; + asection *s; + bfd_boolean relocs; + bfd *ibfd; + +#ifdef DEBUG_PIC +printf("m32r_elf_size_dynamic_sections()\n"); +#endif + + htab = m32r_elf_hash_table (info); + dynobj = htab->root.dynobj; + BFD_ASSERT (dynobj != NULL); + + if (htab->root.dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (! info->shared) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } + + /* Set up .got offsets for local syms, and space for local dynamic + relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + bfd_signed_vma *local_got; + bfd_signed_vma *end_local_got; + bfd_size_type locsymcount; + Elf_Internal_Shdr *symtab_hdr; + asection *srel; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) + continue; + + for (s = ibfd->sections; s != NULL; s = s->next) + { + struct elf_m32r_dyn_relocs *p; + + for (p = ((struct elf_m32r_dyn_relocs *) + elf_section_data (s)->local_dynrel); + p != NULL; + p = p->next) + { + if (! bfd_is_abs_section (p->sec) + && bfd_is_abs_section (p->sec->output_section)) + { + /* Input section has been discarded, either because + it is a copy of a linkonce section or due to + linker script /DISCARD/, so we'll be discarding + the relocs too. */ + } + else if (p->count != 0) + { + srel = elf_section_data (p->sec)->sreloc; + srel->_raw_size += p->count * sizeof (Elf32_External_Rela); + if ((p->sec->output_section->flags & SEC_READONLY) != 0) + info->flags |= DF_TEXTREL; + } + } + } + + local_got = elf_local_got_refcounts (ibfd); + if (!local_got) + continue; + + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; + end_local_got = local_got + locsymcount; + s = htab->sgot; + srel = htab->srelgot; + for (; local_got < end_local_got; ++local_got) + { + if (*local_got > 0) + { + *local_got = s->_raw_size; + s->_raw_size += 4; + if (info->shared) + srel->_raw_size += sizeof (Elf32_External_Rela); + } + else + *local_got = (bfd_vma) -1; + } + } + + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ + elf_link_hash_traverse (&htab->root, allocate_dynrelocs, (PTR) info); + + /* We now have determined the sizes of the various dynamic sections. + Allocate memory for them. */ + relocs = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + if (s == htab->splt + || s == htab->sgot + || s == htab->sgotplt) + { + /* Strip this section if we don't need it; see the + comment below. */ + } + else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + { + if (s->_raw_size != 0 && s != htab->srelplt) + relocs = TRUE; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + else + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (s->_raw_size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + _bfd_strip_section_from_output (info, s); + continue; + } + + /* Allocate memory for the section contents. We use bfd_zalloc + here in case unused entries are not reclaimed before the + section's contents are written out. This should not happen, + but this way if it does, we get a R_M32R_NONE reloc instead + of garbage. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + if (s->contents == NULL) + return FALSE; + } + + if (htab->root.dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in m32r_elf_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) + + if (! info->shared) + { + if (! add_dynamic_entry (DT_DEBUG, 0)) + return FALSE; + } + + if (htab->splt->_raw_size != 0) + { + if (! add_dynamic_entry (DT_PLTGOT, 0) + || ! add_dynamic_entry (DT_PLTRELSZ, 0) + || ! add_dynamic_entry (DT_PLTREL, DT_RELA) + || ! add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + } + + if (relocs) + { + if (! add_dynamic_entry (DT_RELA, 0) + || ! add_dynamic_entry (DT_RELASZ, 0) + || ! add_dynamic_entry (DT_RELAENT, + sizeof (Elf32_External_Rela))) + return FALSE; + + /* If any dynamic relocs apply to a read-only section, + then we need a DT_TEXTREL entry. */ + if ((info->flags & DF_TEXTREL) == 0) + elf_link_hash_traverse (&htab->root, readonly_dynrelocs, + (PTR) info); + + if ((info->flags & DF_TEXTREL) != 0) + { + if (! add_dynamic_entry (DT_TEXTREL, 0)) + return FALSE; + } + } + } +#undef add_dynamic_entry + + return TRUE; +} +/* Relocate an M32R/D ELF section. + There is some attempt to make this function usable for many architectures, + both for RELA and REL type relocs, if only to serve as a learning tool. + + The RELOCATE_SECTION function is called by the new ELF backend linker + to handle the relocations for a section. + + The relocs are always passed as Rela structures; if the section + actually uses Rel structures, the r_addend field will always be + zero. + + This function is responsible for adjust the section contents as + necessary, and (if using Rela relocs and generating a + relocatable output file) adjusting the reloc addend as + necessary. + + This function does not have to worry about setting the reloc + address or the reloc symbol index. + + LOCAL_SYMS is a pointer to the swapped in local symbols. + + LOCAL_SECTIONS is an array giving the section in the input file + corresponding to the st_shndx field of each local symbol. + + The global hash table entry for the global symbols can be found + via elf_sym_hashes (input_bfd). + + When generating relocatable output, this function must handle + STB_LOCAL/STT_SECTION symbols specially. The output symbol is + going to be the section symbol corresponding to the output + section, which means that the addend must be adjusted + accordingly. */ + +static bfd_boolean +m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd); + Elf_Internal_Rela *rel, *relend; + /* Assume success. */ + bfd_boolean ret = TRUE; + + struct elf_m32r_link_hash_table *htab = m32r_elf_hash_table (info); + bfd *dynobj; + bfd_vma *local_got_offsets; + asection *sgot, *splt, *sreloc; + + dynobj = htab->root.dynobj; + local_got_offsets = elf_local_got_offsets (input_bfd); + + sgot = htab->sgot; + splt = htab->splt; + sreloc = NULL; + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + struct elf_link_hash_entry *h; + /* We can't modify r_addend here as elf_link_input_bfd has an assert to + ensure it's zero (we use REL relocs, not RELA). Therefore this + should be assigning zero to `addend', but for clarity we use + `r_addend'. */ + bfd_vma addend = rel->r_addend; + bfd_vma offset = rel->r_offset; + Elf_Internal_Sym *sym; + asection *sec; + const char *sym_name; + bfd_reloc_status_type r; + const char *errmsg = NULL; + bfd_boolean use_rel = FALSE; + + h = NULL; + r_type = ELF32_R_TYPE (rel->r_info); + if (r_type < 0 || r_type >= (int) R_M32R_max) + { + (*_bfd_error_handler) (_("%s: unknown relocation type %d"), + bfd_archive_filename (input_bfd), + (int) r_type); + bfd_set_error (bfd_error_bad_value); + ret = FALSE; + continue; + } + + if (r_type == R_M32R_GNU_VTENTRY + || r_type == R_M32R_GNU_VTINHERIT + || r_type == R_M32R_NONE + || r_type == R_M32R_RELA_GNU_VTENTRY + || r_type == R_M32R_RELA_GNU_VTINHERIT) + continue; + + if (r_type <= R_M32R_GNU_VTENTRY) + use_rel = TRUE; + + howto = m32r_elf_howto_table + r_type; + r_symndx = ELF32_R_SYM (rel->r_info); + + if (info->relocatable && (use_rel == TRUE)) + { + /* This is a relocatable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + sec = NULL; + if (r_symndx >= symtab_hdr->sh_info) + { + /* External symbol. */ + continue; + } + + /* Local symbol. */ + sym = local_syms + r_symndx; + sym_name = ""; + /* STT_SECTION: symbol is associated with a section. */ + if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) + { + /* Symbol isn't associated with a section. Nothing to do. */ + continue; + } + + sec = local_sections[r_symndx]; + addend += sec->output_offset + sym->st_value; + + /* If partial_inplace, we need to store any additional addend + back in the section. */ + if (! howto->partial_inplace) + continue; + /* ??? Here is a nice place to call a special_function + like handler. */ + if (r_type != R_M32R_HI16_SLO && r_type != R_M32R_HI16_ULO) + r = _bfd_relocate_contents (howto, input_bfd, + addend, contents + offset); + else + { + Elf_Internal_Rela *lorel; + + /* We allow an arbitrary number of HI16 relocs before the + LO16 reloc. This permits gcc to emit the HI and LO relocs + itself. */ + for (lorel = rel + 1; + (lorel < relend + && (ELF32_R_TYPE (lorel->r_info) == R_M32R_HI16_SLO + || ELF32_R_TYPE (lorel->r_info) == R_M32R_HI16_ULO)); + lorel++) + continue; + if (lorel < relend + && ELF32_R_TYPE (lorel->r_info) == R_M32R_LO16) + { + m32r_elf_relocate_hi16 (input_bfd, r_type, rel, lorel, + contents, addend); + r = bfd_reloc_ok; + } + else + r = _bfd_relocate_contents (howto, input_bfd, + addend, contents + offset); + } + } + else + { + bfd_vma relocation; + + /* This is a final link. */ + sym = NULL; + sec = NULL; + h = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + /* Local symbol. */ + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + sym_name = ""; + + if (use_rel == FALSE) + { + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + addend = rel->r_addend; + + if (info->relocatable) + { + /* This is a relocatable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + rel->r_addend += sec->output_offset + sym->st_value; + + continue; + } + } + else + { + relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + } + } + else + { + /* External symbol. */ + if (info->relocatable && (use_rel == FALSE)) + continue; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + sym_name = h->root.root.string; + + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + bfd_boolean dyn; + sec = h->root.u.def.section; + + dyn = htab->root.dynamic_sections_created; + sec = h->root.u.def.section; + if (r_type == R_M32R_GOTPC24 + || (r_type == R_M32R_GOTPC_HI_ULO + || r_type == R_M32R_GOTPC_HI_SLO + || r_type == R_M32R_GOTPC_LO) + || (r_type == R_M32R_26_PLTREL + && h->plt.offset != (bfd_vma) -1) + || ((r_type == R_M32R_GOT24 + || r_type == R_M32R_GOT16_HI_ULO + || r_type == R_M32R_GOT16_HI_SLO + || r_type == R_M32R_GOT16_LO) + && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, + info->shared, h) + && (! info->shared + || (! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + || (info->shared + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) + && (((r_type == R_M32R_16_RELA + || r_type == R_M32R_32_RELA + || r_type == R_M32R_24_RELA + || r_type == R_M32R_HI16_ULO_RELA + || r_type == R_M32R_HI16_SLO_RELA + || r_type == R_M32R_LO16_RELA) + && (h->elf_link_hash_flags + & ELF_LINK_FORCED_LOCAL) == 0) + || r_type == R_M32R_10_PCREL_RELA + || r_type == R_M32R_18_PCREL_RELA + || r_type == R_M32R_26_PCREL_RELA) + && ((input_section->flags & SEC_ALLOC) != 0 + /* DWARF will emit R_M32R_16(24,32) relocations + in its sections against symbols defined + externally in shared libraries. We can't do + anything with them here. */ + || ((input_section->flags & SEC_DEBUGGING) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))) + { + /* In these cases, we don't need the relocation + value. We check specially because in some + obscure cases sec->output_section will be NULL. */ + relocation = 0; + } + else if (sec->output_section == NULL) + { + (*_bfd_error_handler) + (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), + bfd_get_filename (input_bfd), h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + + relocation = 0; + } + else + relocation = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else if (h->root.type == bfd_link_hash_undefweak) + relocation = 0; + else if (info->unresolved_syms_in_objects == RM_IGNORE + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + relocation = 0; + else + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, offset, + (info->unresolved_syms_in_objects == RM_GENERATE_ERROR + || ELF_ST_VISIBILITY (h->other))))) + return FALSE; + relocation = 0; + } + } + + /* Sanity check the address. */ + if (offset > input_section->_raw_size) + { + r = bfd_reloc_outofrange; + goto check_reloc; + } + + switch ((int) r_type) + { + case R_M32R_GOTPC24: + /* .got(_GLOBAL_OFFSET_TABLE_) - pc relocation + ld24 rx,#_GLOBAL_OFFSET_TABLE_ + */ + relocation = sgot->output_section->vma; + break; + + case R_M32R_GOTPC_HI_ULO: + case R_M32R_GOTPC_HI_SLO: + case R_M32R_GOTPC_LO: + { + /* .got(_GLOBAL_OFFSET_TABLE_) - pc relocation + bl .+4 + seth rx,#high(_GLOBAL_OFFSET_TABLE_) + or3 rx,rx,#low(_GLOBAL_OFFSET_TABLE_ +4) + or + bl .+4 + seth rx,#shigh(_GLOBAL_OFFSET_TABLE_) + add3 rx,rx,#low(_GLOBAL_OFFSET_TABLE_ +4) + */ + relocation = sgot->output_section->vma; + relocation -= (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset); + if ((r_type == R_M32R_GOTPC_HI_SLO) + && ((relocation + rel->r_addend) & 0x8000)) + rel->r_addend += 0x10000; + + break; + } + case R_M32R_GOT16_HI_ULO: + case R_M32R_GOT16_HI_SLO: + case R_M32R_GOT16_LO: + /* Fall through. */ + case R_M32R_GOT24: + /* Relocation is to the entry for this symbol in the global + offset table. */ + BFD_ASSERT (sgot != NULL); + + if (h != NULL) + { + bfd_boolean dyn; + bfd_vma off; + + off = h->got.offset; + BFD_ASSERT (off != (bfd_vma) -1); + + dyn = htab->root.dynamic_sections_created; + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) + || (info->shared + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + { + /* This is actually a static link, or it is a + -Bsymbolic link and the symbol is defined + locally, or the symbol was forced to be local + because of a version file. We must initialize + this entry in the global offset table. Since the + offset must always be a multiple of 4, we use the + least significant bit to record whether we have + initialized it already. + + When doing a dynamic link, we create a .rela.got + relocation entry to initialize the value. This + is done in the finish_dynamic_symbol routine. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_32 (output_bfd, relocation, + sgot->contents + off); + h->got.offset |= 1; + } + } + + relocation = sgot->output_offset + off; + } + else + { + bfd_vma off; + bfd_byte *loc; + + BFD_ASSERT (local_got_offsets != NULL + && local_got_offsets[r_symndx] != (bfd_vma) -1); + + off = local_got_offsets[r_symndx]; + + /* The offset must always be a multiple of 4. We use + the least significant bit to record whether we have + already processed this entry. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_32 (output_bfd, relocation, sgot->contents + off); + + if (info->shared) + { + asection *srelgot; + Elf_Internal_Rela outrel; + + /* We need to generate a R_M32R_RELATIVE reloc + for the dynamic linker. */ + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (srelgot != NULL); + + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + off); + outrel.r_info = ELF32_R_INFO (0, R_M32R_RELATIVE); + outrel.r_addend = relocation; + loc = srelgot->contents; + loc += srelgot->reloc_count * sizeof(Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel,loc); + ++srelgot->reloc_count; + } + + local_got_offsets[r_symndx] |= 1; + } + + relocation = sgot->output_offset + off; + } + if ((r_type == R_M32R_GOT16_HI_SLO) + && ((relocation + rel->r_addend) & 0x8000)) + rel->r_addend += 0x10000; + + break; + + case R_M32R_26_PLTREL: + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + /* The native assembler will generate a 26_PLTREL reloc + for a local symbol if you assemble a call from one + section to another when using -K pic. */ + if (h == NULL) + break; + + //if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + // || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) + // break; + if (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) + break; + + if (h->plt.offset == (bfd_vma) -1) + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ + break; + } + + relocation = (splt->output_section->vma + + splt->output_offset + + h->plt.offset); + break; + + case R_M32R_HI16_SLO_RELA: + { + if ((relocation + rel->r_addend) & 0x8000) + { + rel->r_addend += 0x10000; + } + } + /* Fall through. */ + case R_M32R_16_RELA: + case R_M32R_24_RELA: + case R_M32R_32_RELA: + case R_M32R_18_PCREL_RELA: + case R_M32R_26_PCREL_RELA: + case R_M32R_HI16_ULO_RELA: + case R_M32R_LO16_RELA: + case R_M32R_SDA16_RELA: + if (info->shared + && r_symndx != 0 + && (input_section->flags & SEC_ALLOC) != 0 + && ((r_type != R_M32R_18_PCREL_RELA + && r_type != R_M32R_26_PCREL_RELA) + || (h != NULL + && h->dynindx != -1 + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + { + Elf_Internal_Rela outrel; + bfd_boolean skip, relocate; + bfd_byte *loc; + + /* When generating a shared object, these relocations + are copied into the output file to be resolved at run + time. */ + + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (input_bfd, + elf_elfheader (input_bfd)->e_shstrndx, + elf_section_data (input_section)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (input_bfd, + input_section), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + BFD_ASSERT (sreloc != NULL); + } + + skip = FALSE; + relocate = FALSE; + + outrel.r_offset = _bfd_elf_section_offset (output_bfd, + info, + input_section, + rel->r_offset); + if (outrel.r_offset == (bfd_vma) -1) + skip = TRUE; + else if (outrel.r_offset == (bfd_vma) -2) + skip = TRUE, relocate = TRUE; + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + else if (r_type == R_M32R_18_PCREL_RELA + || r_type == R_M32R_26_PCREL_RELA) + { + BFD_ASSERT (h != NULL && h->dynindx != -1); + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + outrel.r_addend = rel->r_addend; + } + else + { + /* h->dynindx may be -1 if this symbol was marked to + become local. */ + if (h == NULL + || ((info->symbolic || h->dynindx == -1) + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) != 0)) + { + relocate = TRUE; + outrel.r_info = ELF32_R_INFO (0, R_M32R_RELATIVE); + outrel.r_addend = relocation + rel->r_addend; + } + else + { + BFD_ASSERT (h->dynindx != -1); + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + outrel.r_addend = relocation + rel->r_addend; + } + } + + loc = sreloc->contents; + loc += sreloc->reloc_count * sizeof(Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel,loc); + ++sreloc->reloc_count; + + /* If this reloc is against an external symbol, we do + not want to fiddle with the addend. Otherwise, we + need to include the symbol value so that it becomes + an addend for the dynamic reloc. */ + if (! relocate) + continue; + } + break; + + case (int) R_M32R_10_PCREL : + r = m32r_elf_do_10_pcrel_reloc (input_bfd, howto, input_section, + contents, offset, + sec, relocation, addend); + goto check_reloc; + + case (int) R_M32R_HI16_SLO : + case (int) R_M32R_HI16_ULO : + { + Elf_Internal_Rela *lorel; + + /* We allow an arbitrary number of HI16 relocs before the + LO16 reloc. This permits gcc to emit the HI and LO relocs + itself. */ + for (lorel = rel + 1; + (lorel < relend + && (ELF32_R_TYPE (lorel->r_info) == R_M32R_HI16_SLO + || ELF32_R_TYPE (lorel->r_info) == R_M32R_HI16_ULO)); + lorel++) + continue; + if (lorel < relend + && ELF32_R_TYPE (lorel->r_info) == R_M32R_LO16) + { + m32r_elf_relocate_hi16 (input_bfd, r_type, rel, lorel, + contents, relocation + addend); + r = bfd_reloc_ok; + } + else + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, offset, + relocation, addend); + } + + goto check_reloc; + + case (int) R_M32R_SDA16 : + { + const char *name; + + BFD_ASSERT (sec != NULL); + name = bfd_get_section_name (abfd, sec); + + if (strcmp (name, ".sdata") == 0 + || strcmp (name, ".sbss") == 0 + || strcmp (name, ".scommon") == 0) + { + bfd_vma sda_base; + bfd *out_bfd = sec->output_section->owner; + + r = m32r_elf_final_sda_base (out_bfd, info, + &errmsg, + &sda_base); + if (r != bfd_reloc_ok) + { + ret = FALSE; + goto check_reloc; + } + + /* At this point `relocation' contains the object's + address. */ + relocation -= sda_base; + /* Now it contains the offset from _SDA_BASE_. */ + } + else + { + (*_bfd_error_handler) + (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"), + bfd_archive_filename (input_bfd), + sym_name, + m32r_elf_howto_table[(int) r_type].name, + bfd_get_section_name (abfd, sec)); + /*bfd_set_error (bfd_error_bad_value); ??? why? */ + ret = FALSE; + continue; + } + } + /* fall through */ + + default : /* OLD_M32R_RELOC */ + + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, offset, + relocation, addend); + goto check_reloc; + } + + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + + } + + check_reloc: + + if (r != bfd_reloc_ok) + { + /* FIXME: This should be generic enough to go in a utility. */ + const char *name; + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL || *name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + if (errmsg != NULL) + goto common_error; + + switch (r) + { + case bfd_reloc_overflow: + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, offset))) + return FALSE; + break; + + case bfd_reloc_undefined: + if (! ((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, + offset, TRUE))) + return FALSE; + break; + + case bfd_reloc_outofrange: + errmsg = _("internal error: out of range error"); + goto common_error; + + case bfd_reloc_notsupported: + errmsg = _("internal error: unsupported relocation error"); + goto common_error; + + case bfd_reloc_dangerous: + errmsg = _("internal error: dangerous error"); + goto common_error; + + default: + errmsg = _("internal error: unknown error"); + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, errmsg, name, input_bfd, input_section, + offset))) + return FALSE; + break; + } + } + } + + return ret; +} + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ +static bfd_boolean +m32r_elf_finish_dynamic_symbol (output_bfd, info, h, sym) + bfd *output_bfd; + struct bfd_link_info *info; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + struct elf_m32r_link_hash_table *htab; + bfd *dynobj; + bfd_byte *loc; + +#ifdef DEBUG_PIC +printf("m32r_elf_finish_dynamic_symbol()\n"); +#endif + + htab = m32r_elf_hash_table (info); + dynobj = htab->root.dynobj; + + if (h->plt.offset != (bfd_vma) -1) + { + asection *splt; + asection *sgot; + asection *srela; + + bfd_vma plt_index; + bfd_vma got_offset; + Elf_Internal_Rela rela; + + /* This symbol has an entry in the procedure linkage table. Set + it up. */ + + BFD_ASSERT (h->dynindx != -1); + + splt = htab->splt; + sgot = htab->sgotplt; + srela = htab->srelplt; + BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL); + + /* Get the index in the procedure linkage table which + corresponds to this symbol. This is the index of this symbol + in all the symbols for which we are making plt entries. The + first entry in the procedure linkage table is reserved. */ + plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; + + /* Get the offset into the .got table of the entry that + corresponds to this function. Each .got entry is 4 bytes. + The first three are reserved. */ + got_offset = (plt_index + 3) * 4; + + /* Fill in the entry in the procedure linkage table. */ + if (! info->shared) + { + bfd_put_32 (output_bfd, + (PLT_ENTRY_WORD0b + + (((sgot->output_section->vma + + sgot->output_offset + + got_offset) >> 16) & 0xffff)), + splt->contents + h->plt.offset); + bfd_put_32 (output_bfd, + (PLT_ENTRY_WORD1b + + ((sgot->output_section->vma + + sgot->output_offset + + got_offset) & 0xffff)), + splt->contents + h->plt.offset + 4); + bfd_put_32 (output_bfd, PLT_ENTRY_WORD2, + splt->contents + h->plt.offset + 8); + bfd_put_32 (output_bfd, + (PLT_ENTRY_WORD3 + + plt_index * sizeof (Elf32_External_Rela)), + splt->contents + h->plt.offset + 12); + bfd_put_32 (output_bfd, + (PLT_ENTRY_WORD4 + + (((unsigned int) ((- (h->plt.offset + 16)) >> 2)) & 0xffffff)), + splt->contents + h->plt.offset + 16); + } + else + { + bfd_put_32 (output_bfd, + PLT_ENTRY_WORD0 + got_offset, + splt->contents + h->plt.offset); + bfd_put_32 (output_bfd, PLT_ENTRY_WORD1, + splt->contents + h->plt.offset + 4); + bfd_put_32 (output_bfd, PLT_ENTRY_WORD2, + splt->contents + h->plt.offset + 8); + bfd_put_32 (output_bfd, + (PLT_ENTRY_WORD3 + + plt_index * sizeof (Elf32_External_Rela)), + splt->contents + h->plt.offset + 12); + bfd_put_32 (output_bfd, + (PLT_ENTRY_WORD4 + + (((unsigned int) ((- (h->plt.offset + 16)) >> 2)) & 0xffffff)), + splt->contents + h->plt.offset + 16); + } + + /* Fill in the entry in the global offset table. */ + bfd_put_32 (output_bfd, + (splt->output_section->vma + + splt->output_offset + + h->plt.offset + + 12), /* same offset */ + sgot->contents + got_offset); + + /* Fill in the entry in the .rela.plt section. */ + rela.r_offset = (sgot->output_section->vma + + sgot->output_offset + + got_offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_M32R_JMP_SLOT); + rela.r_addend = 0; + loc = srela->contents; + loc += plt_index * sizeof(Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + } + } + + if (h->got.offset != (bfd_vma) -1) + { + asection *sgot; + asection *srela; + Elf_Internal_Rela rela; + + /* This symbol has an entry in the global offset table. Set it + up. */ + + sgot = htab->sgot; + srela = htab->srelgot; + BFD_ASSERT (sgot != NULL && srela != NULL); + + rela.r_offset = (sgot->output_section->vma + + sgot->output_offset + + (h->got.offset &~ 1)); + + /* If this is a -Bsymbolic link, and the symbol is defined + locally, we just want to emit a RELATIVE reloc. Likewise if + the symbol was forced to be local because of a version file. + The entry in the global offset table will already have been + initialized in the relocate_section function. */ + if (info->shared + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + { + rela.r_info = ELF32_R_INFO (0, R_M32R_RELATIVE); + rela.r_addend = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + else + { + BFD_ASSERT((h->got.offset & 1) == 0); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_M32R_GLOB_DAT); + rela.r_addend = 0; + } + + loc = srela->contents; + loc += srela->reloc_count * sizeof(Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + ++srela->reloc_count; + } + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + { + asection *s; + Elf_Internal_Rela rela; + + /* This symbols needs a copy reloc. Set it up. */ + + BFD_ASSERT (h->dynindx != -1 + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)); + + s = bfd_get_section_by_name (h->root.u.def.section->owner, + ".rela.bss"); + BFD_ASSERT (s != NULL); + + rela.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_M32R_COPY); + rela.r_addend = 0; + loc = s->contents; + loc += s->reloc_count * sizeof(Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + ++s->reloc_count; + } + + /* Mark some specially defined symbols as absolute. */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + sym->st_shndx = SHN_ABS; + + return TRUE; +} + + +/* Finish up the dynamic sections. */ + +static bfd_boolean +m32r_elf_finish_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + struct elf_m32r_link_hash_table *htab; + bfd *dynobj; + asection *sdyn; + asection *sgot; + +#ifdef DEBUG_PIC +printf("m32r_elf_finish_dynamic_sections()\n"); +#endif + + htab = m32r_elf_hash_table (info); + dynobj = htab->root.dynobj; + + sgot = htab->sgotplt; + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (htab->root.dynamic_sections_created) + { + asection *splt; + Elf32_External_Dyn *dyncon, *dynconend; + + BFD_ASSERT (sgot != NULL && sdyn != NULL); + + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + const char *name; + asection *s; + + bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + break; + + case DT_PLTGOT: + name = ".got"; + s = htab->sgot->output_section; + goto get_vma; + case DT_JMPREL: + name = ".rela.plt"; + s = htab->srelplt->output_section; + get_vma: + BFD_ASSERT (s != NULL); + dyn.d_un.d_ptr = s->vma; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_PLTRELSZ: + s = htab->srelplt->output_section; + BFD_ASSERT (s != NULL); + if (s->_cooked_size != 0) + dyn.d_un.d_val = s->_cooked_size; + else + dyn.d_un.d_val = s->_raw_size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_RELASZ: + /* My reading of the SVR4 ABI indicates that the + procedure linkage table relocs (DT_JMPREL) should be + included in the overall relocs (DT_RELA). This is + what Solaris does. However, UnixWare can not handle + that case. Therefore, we override the DT_RELASZ entry + here to make it not include the JMPREL relocs. Since + the linker script arranges for .rela.plt to follow all + other relocation sections, we don't have to worry + about changing the DT_RELA entry. */ + if (htab->srelplt != NULL) + { + s = htab->srelplt->output_section; + if (s->_cooked_size != 0) + dyn.d_un.d_val -= s->_cooked_size; + else + dyn.d_un.d_val -= s->_raw_size; + } + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + } + } + + /* Fill in the first entry in the procedure linkage table. */ + splt = htab->splt; + if (splt && splt->_raw_size > 0) + { + if (info->shared) + { + bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD0, splt->contents); + bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD1, splt->contents + 4); + bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD2, splt->contents + 8); + bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD3, splt->contents + 12); + bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD4, splt->contents + 16); + } + else + { + unsigned long addr; + /* addr = .got + 4 */ + addr = sgot->output_section->vma + sgot->output_offset + 4; + bfd_put_32 (output_bfd, + PLT0_ENTRY_WORD0 | ((addr >> 16) & 0xffff), + splt->contents); + bfd_put_32 (output_bfd, + PLT0_ENTRY_WORD1 | (addr & 0xffff), + splt->contents + 4); + bfd_put_32 (output_bfd, PLT0_ENTRY_WORD2, splt->contents + 8); + bfd_put_32 (output_bfd, PLT0_ENTRY_WORD3, splt->contents + 12); + bfd_put_32 (output_bfd, PLT0_ENTRY_WORD4, splt->contents + 16); + } + + elf_section_data (splt->output_section)->this_hdr.sh_entsize = + PLT_ENTRY_SIZE; + } + } + + /* Fill in the first three entries in the global offset table. */ + if (sgot && sgot->_raw_size > 0) + { + if (sdyn == NULL) + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + else + bfd_put_32 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + sgot->contents); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + + elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; + } + + return TRUE; +} + + +#if 0 /* relaxing not supported yet */ + +/* This function handles relaxing for the m32r. + Relaxing on the m32r is tricky because of instruction alignment + requirements (4 byte instructions must be aligned on 4 byte boundaries). + + The following relaxing opportunities are handled: + + seth/add3/jl -> bl24 or bl8 + seth/add3 -> ld24 + + It would be nice to handle bl24 -> bl8 but given: + + - 4 byte insns must be on 4 byte boundaries + - branch instructions only branch to insns on 4 byte boundaries + + this isn't much of a win because the insn in the 2 "deleted" bytes + must become a nop. With some complexity some real relaxation could be + done but the frequency just wouldn't make it worth it; it's better to + try to do all the code compaction one can elsewhere. + When the chip supports parallel 16 bit insns, things may change. +*/ + +static bfd_boolean +m32r_elf_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + bfd_boolean *again; +{ + Elf_Internal_Shdr *symtab_hdr; + /* The Rela structures are used here because that's what + _bfd_elf_link_read_relocs uses [for convenience - it sets the addend + field to 0]. */ + Elf_Internal_Rela *internal_relocs = NULL; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *contents = NULL; + Elf_Internal_Sym *isymbuf = NULL; + + /* Assume nothing changes. */ + *again = FALSE; + + /* We don't have to do anything for a relocatable link, if + this section does not have relocs, or if this is not a + code section. */ + if (link_info->relocatable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0 + || (sec->flags & SEC_CODE) == 0 + || 0 /* FIXME: check SHF_M32R_CAN_RELAX */) + return TRUE; + + /* If this is the first time we have been called for this section, + initialize the cooked size. */ + if (sec->_cooked_size == 0) + sec->_cooked_size = sec->_raw_size; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + /* Get a copy of the native relocations. */ + internal_relocs = (_bfd_elf_link_read_relocs + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + + /* Walk through them looking for relaxing opportunities. */ + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma symval; + + /* If this isn't something that can be relaxed, then ignore + this reloc. */ + if (ELF32_R_TYPE (irel->r_info) != (int) R_M32R_HI16_SLO) + continue; + + /* Get the section contents if we haven't done so already. */ + if (contents == NULL) + { + /* Get cached copy if it exists. */ + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + /* Go get them off disk. */ + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + /* Read this BFD's local symbols if we haven't done so already. */ + if (isymbuf == NULL && symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + /* A local symbol. */ + Elf_Internal_Sym *isym; + asection *sym_sec; + + isym = isymbuf + ELF32_R_SYM (irel->r_info), + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + symval = (isym->st_value + + sym_sec->output_section->vma + + sym_sec->output_offset); + } + else + { + unsigned long indx; + struct elf_link_hash_entry *h; + + /* An external symbol. */ + indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + { + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + continue; + } + + symval = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + + /* For simplicity of coding, we are going to modify the section + contents, the section relocs, and the BFD symbol table. We + must tell the rest of the code not to free up this + information. It would be possible to instead create a table + of changes which have to be made, as is done in coff-mips.c; + that would be more work, but would require less memory when + the linker is run. */ + + /* Try to change a seth/add3/jl subroutine call to bl24 or bl8. + This sequence is generated by the compiler when compiling in + 32 bit mode. Also look for seth/add3 -> ld24. */ + + if (ELF32_R_TYPE (irel->r_info) == (int) R_M32R_HI16_SLO) + { + Elf_Internal_Rela *nrel; + bfd_vma pc = (sec->output_section->vma + sec->output_offset + + irel->r_offset); + bfd_signed_vma pcrel_value = symval - pc; + unsigned int code,reg; + int addend,nop_p,bl8_p,to_delete; + + /* The tests are ordered so that we get out as quickly as possible + if this isn't something we can relax, taking into account that + we are looking for two separate possibilities (jl/ld24). */ + + /* Do nothing if no room in the section for this to be what we're + looking for. */ + if (irel->r_offset > sec->_cooked_size - 8) + continue; + + /* Make sure the next relocation applies to the next + instruction and that it's the add3's reloc. */ + nrel = irel + 1; + if (nrel == irelend + || irel->r_offset + 4 != nrel->r_offset + || ELF32_R_TYPE (nrel->r_info) != (int) R_M32R_LO16) + continue; + + /* See if the instructions are seth/add3. */ + /* FIXME: This is where macros from cgen can come in. */ + code = bfd_get_16 (abfd, contents + irel->r_offset + 0); + if ((code & 0xf0ff) != 0xd0c0) + continue; /* not seth rN,foo */ + reg = (code & 0x0f00) >> 8; + code = bfd_get_16 (abfd, contents + irel->r_offset + 4); + if (code != (0x80a0 | reg | (reg << 8))) + continue; /* not add3 rN,rN,foo */ + + /* At this point we've confirmed we have seth/add3. Now check + whether the next insn is a jl, in which case try to change this + to bl24 or bl8. */ + + /* Ensure the branch target is in range. + The bl24 instruction has a 24 bit operand which is the target + address right shifted by 2, giving a signed range of 26 bits. + Note that 4 bytes are added to the high value because the target + will be at least 4 bytes closer if we can relax. It'll actually + be 4 or 8 bytes closer, but we don't know which just yet and + the difference isn't significant enough to worry about. */ +#if !USE_REL /* put in for learning purposes */ + pcrel_value += irel->r_addend; +#else + addend = bfd_get_signed_16 (abfd, contents + irel->r_offset + 2); + pcrel_value += addend; +#endif + + if (pcrel_value >= -(1 << 25) && pcrel_value < (1 << 25) + 4 + /* Do nothing if no room in the section for this to be what we're + looking for. */ + && (irel->r_offset <= sec->_cooked_size - 12) + /* Ensure the next insn is "jl rN". */ + && ((code = bfd_get_16 (abfd, contents + irel->r_offset + 8)), + code != (0x1ec0 | reg))) + { + /* We can relax to bl24/bl8. */ + + /* See if there's a nop following the jl. + Also see if we can use a bl8 insn. */ + code = bfd_get_16 (abfd, contents + irel->r_offset + 10); + nop_p = (code & 0x7fff) == NOP_INSN; + bl8_p = pcrel_value >= -0x200 && pcrel_value < 0x200; + + if (bl8_p) + { + /* Change "seth rN,foo" to "bl8 foo || nop". + We OR in CODE just in case it's not a nop (technically, + CODE currently must be a nop, but for cleanness we + allow it to be anything). */ +#if !USE_REL /* put in for learning purposes */ + code = 0x7e000000 | MAKE_PARALLEL (code); +#else + code = (0x7e000000 + (((addend >> 2) & 0xff) << 16)) | MAKE_PARALLEL (code); +#endif + to_delete = 8; + } + else + { + /* Change the seth rN,foo to a bl24 foo. */ +#if !USE_REL /* put in for learning purposes */ + code = 0xfe000000; +#else + code = 0xfe000000 + ((addend >> 2) & 0xffffff); +#endif + to_delete = nop_p ? 8 : 4; + } + + bfd_put_32 (abfd, code, contents + irel->r_offset); + + /* Set the new reloc type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (nrel->r_info), + bl8_p ? R_M32R_10_PCREL : R_M32R_26_PCREL); + + /* Delete the add3 reloc by making it a null reloc. */ + nrel->r_info = ELF32_R_INFO (ELF32_R_SYM (nrel->r_info), + R_M32R_NONE); + } + else if (addend >= 0 + && symval + addend <= 0xffffff) + { + /* We can relax to ld24. */ + + code = 0xe0000000 | (reg << 24) | (addend & 0xffffff); + bfd_put_32 (abfd, code, contents + irel->r_offset); + to_delete = 4; + /* Tell the following code a nop filler isn't needed. */ + nop_p = 1; + } + else + { + /* Can't do anything here. */ + continue; + } + + /* Note that we've changed the relocs, section contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Delete TO_DELETE bytes of data. */ + if (!m32r_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 4, to_delete)) + goto error_return; + + /* Now that the following bytes have been moved into place, see if + we need to replace the jl with a nop. This happens when we had + to use a bl24 insn and the insn following the jl isn't a nop. + Technically, this situation can't happen (since the insn can + never be executed) but to be clean we do this. When the chip + supports parallel 16 bit insns things may change. + We don't need to do this in the case of relaxing to ld24, + and the above code sets nop_p so this isn't done. */ + if (! nop_p && to_delete == 4) + bfd_put_16 (abfd, NOP_INSN, contents + irel->r_offset + 4); + + /* That will change things, so we should relax again. + Note that this is not required, and it may be slow. */ + *again = TRUE; + + continue; + } + + /* loop to try the next reloc */ + } + + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + { + if (! link_info->keep_memory) + free (isymbuf); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) isymbuf; + } + } + + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + { + if (! link_info->keep_memory) + free (contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + } + + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + return TRUE; + + error_return: + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + free (contents); + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + return FALSE; +} + +/* Delete some bytes from a section while relaxing. */ + +static bfd_boolean +m32r_elf_relax_delete_bytes (abfd, sec, addr, count) + bfd *abfd; + asection *sec; + bfd_vma addr; + int count; +{ + Elf_Internal_Shdr *symtab_hdr; + int shndx; + bfd_byte *contents; + Elf_Internal_Rela *irel, *irelend; + Elf_Internal_Rela *irelalign; + bfd_vma toaddr; + Elf_Internal_Sym *isym, *isymend; + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry **end_hashes; + unsigned int symcount; + + shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + contents = elf_section_data (sec)->this_hdr.contents; + + /* The deletion must stop at the next ALIGN reloc for an aligment + power larger than the number of bytes we are deleting. */ + + irelalign = NULL; + toaddr = sec->_cooked_size; + + irel = elf_section_data (sec)->relocs; + irelend = irel + sec->reloc_count; + + /* Actually delete the bytes. */ + memmove (contents + addr, contents + addr + count, toaddr - addr - count); + sec->_cooked_size -= count; + + /* Adjust all the relocs. */ + for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) + { + /* Get the new reloc address. */ + if ((irel->r_offset > addr + && irel->r_offset < toaddr)) + irel->r_offset -= count; + } + + /* Adjust the local symbols defined in this section. */ + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + isym = (Elf_Internal_Sym *) symtab_hdr->contents; + for (isymend = isym + symtab_hdr->sh_info; isym < isymend; isym++) + { + if (isym->st_shndx == shndx + && isym->st_value > addr + && isym->st_value < toaddr) + isym->st_value -= count; + } + + /* Now adjust the global symbols defined in this section. */ + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + sym_hashes = elf_sym_hashes (abfd); + end_hashes = sym_hashes + symcount; + for (; sym_hashes < end_hashes; sym_hashes++) + { + struct elf_link_hash_entry *sym_hash = *sym_hashes; + + if ((sym_hash->root.type == bfd_link_hash_defined + || sym_hash->root.type == bfd_link_hash_defweak) + && sym_hash->root.u.def.section == sec + && sym_hash->root.u.def.value > addr + && sym_hash->root.u.def.value < toaddr) + { + sym_hash->root.u.def.value -= count; + } + } + + return TRUE; +} + +/* This is a version of bfd_generic_get_relocated_section_contents + which uses m32r_elf_relocate_section. */ + +static bfd_byte * +m32r_elf_get_relocated_section_contents (output_bfd, link_info, link_order, + data, relocatable, symbols) + bfd *output_bfd; + struct bfd_link_info *link_info; + struct bfd_link_order *link_order; + bfd_byte *data; + bfd_boolean relocatable; + asymbol **symbols; +{ + Elf_Internal_Shdr *symtab_hdr; + asection *input_section = link_order->u.indirect.section; + bfd *input_bfd = input_section->owner; + asection **sections = NULL; + Elf_Internal_Rela *internal_relocs = NULL; + Elf_Internal_Sym *isymbuf = NULL; + bfd_size_type amt; + + /* We only need to handle the case of relaxing, or of having a + particular set of section contents, specially. */ + if (relocatable + || elf_section_data (input_section)->this_hdr.contents == NULL) + return bfd_generic_get_relocated_section_contents (output_bfd, link_info, + link_order, data, + relocatable, + symbols); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + + memcpy (data, elf_section_data (input_section)->this_hdr.contents, + input_section->_raw_size); + + if ((input_section->flags & SEC_RELOC) != 0 + && input_section->reloc_count > 0) + { + Elf_Internal_Sym *isymp; + asection **secpp; + Elf32_External_Sym *esym, *esymend; + + internal_relocs = (_bfd_elf_link_read_relocs + (input_bfd, input_section, (PTR) NULL, + (Elf_Internal_Rela *) NULL, FALSE)); + if (internal_relocs == NULL) + goto error_return; + + if (symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + amt = symtab_hdr->sh_info; + amt *= sizeof (asection *); + sections = (asection **) bfd_malloc (amt); + if (sections == NULL && symtab_hdr->sh_info > 0) + goto error_return; + + isymend = isymbuf + symtab_hdr->sh_info; + for (isym = isymbuf, secpp = sections; isym < isymend; ++isym, ++secpp) + { + asection *isec; + + if (isym->st_shndx == SHN_UNDEF) + isec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + isec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + isec = bfd_com_section_ptr; + else if (isym->st_shndx == SHN_M32R_SCOMMON) + isec = &m32r_elf_scom_section; + else + isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx); + + *secpp = isec; + } + + if (! m32r_elf_relocate_section (output_bfd, link_info, input_bfd, + input_section, data, internal_relocs, + isymbuf, sections)) + goto error_return; + + if (sections != NULL) + free (sections); + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (elf_section_data (input_section)->relocs != internal_relocs) + free (internal_relocs); + } + + return data; + + error_return: + if (sections != NULL) + free (sections); + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (internal_relocs != NULL + && elf_section_data (input_section)->relocs != internal_relocs) + free (internal_relocs); + return NULL; +} + +#endif /* #if 0 */ + +/* Set the right machine number. */ +static bfd_boolean +m32r_elf_object_p (abfd) + bfd *abfd; +{ + switch (elf_elfheader (abfd)->e_flags & EF_M32R_ARCH) + { + default: + case E_M32R_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_m32r, bfd_mach_m32r); break; + case E_M32RX_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_m32r, bfd_mach_m32rx); break; + case E_M32R2_ARCH: (void) bfd_default_set_arch_mach (abfd, bfd_arch_m32r, bfd_mach_m32r2); break; + } + return TRUE; +} + +/* Store the machine number in the flags field. */ +static void +m32r_elf_final_write_processing (abfd, linker) + bfd *abfd; + bfd_boolean linker ATTRIBUTE_UNUSED; +{ + unsigned long val; + + switch (bfd_get_mach (abfd)) + { + default: + case bfd_mach_m32r: val = E_M32R_ARCH; break; + case bfd_mach_m32rx: val = E_M32RX_ARCH; break; + case bfd_mach_m32r2: val = E_M32R2_ARCH; break; + } + + elf_elfheader (abfd)->e_flags &=~ EF_M32R_ARCH; + elf_elfheader (abfd)->e_flags |= val; +} + +/* Function to keep M32R specific file flags. */ +static bfd_boolean +m32r_elf_set_private_flags (abfd, flags) + bfd *abfd; + flagword flags; +{ + BFD_ASSERT (!elf_flags_init (abfd) + || elf_elfheader (abfd)->e_flags == flags); + + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + return TRUE; +} + +/* Merge backend specific data from an object file to the output + object file when linking. */ +static bfd_boolean +m32r_elf_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + flagword out_flags; + flagword in_flags; + + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + in_flags = elf_elfheader (ibfd)->e_flags; + out_flags = elf_elfheader (obfd)->e_flags; + + if (! elf_flags_init (obfd)) + { + /* If the input is the default architecture then do not + bother setting the flags for the output architecture, + instead allow future merges to do this. If no future + merges ever set these flags then they will retain their + unitialised values, which surprise surprise, correspond + to the default values. */ + if (bfd_get_arch_info (ibfd)->the_default) + return TRUE; + + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = in_flags; + + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) + && bfd_get_arch_info (obfd)->the_default) + { + return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd)); + } + + return TRUE; + } + + /* Check flag compatibility. */ + if (in_flags == out_flags) + return TRUE; + + if ((in_flags & EF_M32R_ARCH) != (out_flags & EF_M32R_ARCH)) + { + if ( ((in_flags & EF_M32R_ARCH) != E_M32R_ARCH) + || ((out_flags & EF_M32R_ARCH) == E_M32R_ARCH) + || ((in_flags & EF_M32R_ARCH) == E_M32R2_ARCH)) + { + (*_bfd_error_handler) + (_("%s: Instruction set mismatch with previous modules"), + bfd_archive_filename (ibfd)); + + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + + return TRUE; +} + +/* Display the flags field */ +static bfd_boolean +m32r_elf_print_private_bfd_data (abfd, ptr) + bfd *abfd; + PTR ptr; +{ + FILE * file = (FILE *) ptr; + + BFD_ASSERT (abfd != NULL && ptr != NULL) + + _bfd_elf_print_private_bfd_data (abfd, ptr); + + fprintf (file, _("private flags = %lx"), elf_elfheader (abfd)->e_flags); + + switch (elf_elfheader (abfd)->e_flags & EF_M32R_ARCH) + { + default: + case E_M32R_ARCH: fprintf (file, _(": m32r instructions")); break; + case E_M32RX_ARCH: fprintf (file, _(": m32rx instructions")); break; + case E_M32R2_ARCH: fprintf (file, _(": m32r2 instructions")); break; + } + + fputc ('\n', file); + + return TRUE; +} + +asection * +m32r_elf_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_M32R_GNU_VTINHERIT: + case R_M32R_GNU_VTENTRY: + case R_M32R_RELA_GNU_VTINHERIT: + case R_M32R_RELA_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +static bfd_boolean +m32r_elf_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +{ + /* Update the got entry reference counts for the section being removed. */ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_signed_vma *local_got_refcounts; + const Elf_Internal_Rela *rel, *relend; + unsigned long r_symndx; + struct elf_link_hash_entry *h; + + elf_section_data (sec)->local_dynrel = NULL; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + local_got_refcounts = elf_local_got_refcounts (abfd); + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; rel++) + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_M32R_GOT16_HI_ULO: + case R_M32R_GOT16_HI_SLO: + case R_M32R_GOT16_LO: + case R_M32R_GOT24: + case R_M32R_GOTPC_HI_ULO: + case R_M32R_GOTPC_HI_SLO: + case R_M32R_GOTPC_LO: + case R_M32R_GOTPC24: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->got.refcount > 0) + h->got.refcount--; + } + else + { + if (local_got_refcounts && local_got_refcounts[r_symndx] > 0) + local_got_refcounts[r_symndx]--; + } + break; + + case R_M32R_16_RELA: + case R_M32R_24_RELA: + case R_M32R_32_RELA: + case R_M32R_HI16_ULO_RELA: + case R_M32R_HI16_SLO_RELA: + case R_M32R_LO16_RELA: + case R_M32R_SDA16_RELA: + case R_M32R_18_PCREL_RELA: + case R_M32R_26_PCREL_RELA: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + struct elf_m32r_link_hash_entry *eh; + struct elf_m32r_dyn_relocs **pp; + struct elf_m32r_dyn_relocs *p; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + if (!info->shared && h->plt.refcount > 0) + h->plt.refcount -= 1; + + eh = (struct elf_m32r_link_hash_entry *) h; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { + if (ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA + || ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA) + p->pc_count -= 1; + p->count -= 1; + if (p->count == 0) + *pp = p->next; + break; + } + } + break; + + case R_M32R_26_PLTREL: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->plt.refcount > 0) + h->plt.refcount--; + } + break; + + default: + break; + } + + return TRUE; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static bfd_boolean +m32r_elf_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + struct elf_m32r_link_hash_table *htab; + bfd *dynobj; + bfd_vma *local_got_offsets; + asection *sgot, *srelgot, *sreloc; + + if (info->relocatable) + return TRUE; + + sgot = srelgot = sreloc = NULL; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + htab = m32r_elf_hash_table (info); + dynobj = htab->root.dynobj; + local_got_offsets = elf_local_got_offsets (abfd); + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + int r_type; + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + /* Some relocs require a global offset table. */ + if (htab->sgot == NULL) + { + switch (r_type) + { + case R_M32R_GOT16_HI_ULO: + case R_M32R_GOT16_HI_SLO: + case R_M32R_GOT16_LO: + case R_M32R_GOTPC24: + case R_M32R_GOTPC_HI_ULO: + case R_M32R_GOTPC_HI_SLO: + case R_M32R_GOTPC_LO: + case R_M32R_GOT24: + if (dynobj == NULL) + htab->root.dynobj = dynobj = abfd; + if (! create_got_section (dynobj, info)) + return FALSE; + break; + + default: + break; + } + } + + switch (r_type) + { + case R_M32R_GOT16_HI_ULO: + case R_M32R_GOT16_HI_SLO: + case R_M32R_GOT16_LO: + case R_M32R_GOT24: + + if (h != NULL) + h->got.refcount += 1; + else + { + bfd_signed_vma *local_got_refcounts; + + /* This is a global offset table entry for a local + symbol. */ + local_got_refcounts = elf_local_got_refcounts (abfd); + if (local_got_refcounts == NULL) + { + bfd_size_type size; + + size = symtab_hdr->sh_info; + size *= sizeof (bfd_signed_vma); + local_got_refcounts = ((bfd_signed_vma *) + bfd_zalloc (abfd, size)); + if (local_got_refcounts == NULL) + return FALSE; + elf_local_got_refcounts (abfd) = local_got_refcounts; + } + local_got_refcounts[r_symndx] += 1; + } + break; + + case R_M32R_26_PLTREL: + /* This symbol requires a procedure linkage table entry. We + actually build the entry in adjust_dynamic_symbol, + because this might be a case of linking PIC code without + linking in any dynamic objects, in which case we don't + need to generate a procedure linkage table after all. */ + + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + if (h == NULL) + continue; + + if (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) + break; + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount += 1; + break; + + case R_M32R_16_RELA: + case R_M32R_24_RELA: + case R_M32R_32_RELA: + case R_M32R_HI16_ULO_RELA: + case R_M32R_HI16_SLO_RELA: + case R_M32R_LO16_RELA: + case R_M32R_SDA16_RELA: + case R_M32R_18_PCREL_RELA: + case R_M32R_26_PCREL_RELA: + + if (h != NULL && !info->shared) + { + h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + h->plt.refcount += 1; + } + + /* If we are creating a shared library, and this is a reloc + against a global symbol, or a non PC relative reloc + against a local symbol, then we need to copy the reloc + into the shared library. However, if we are linking with + -Bsymbolic, we do not need to copy a reloc against a + global symbol which is defined in an object we are + including in the link (i.e., DEF_REGULAR is set). At + this point we have not seen all the input files, so it is + possible that DEF_REGULAR is not set now but will be set + later (it is never cleared). We account for that + possibility below by storing information in the + dyn_relocs field of the hash table entry. A similar + situation occurs when creating shared libraries and symbol + visibility changes render the symbol local. + + If on the other hand, we are creating an executable, we + may need to keep relocations for symbols satisfied by a + dynamic library if we manage to avoid copy relocs for the + symbol. */ + if ((info->shared + && (sec->flags & SEC_ALLOC) != 0 + && ((r_type != R_M32R_26_PCREL_RELA + && r_type != R_M32R_18_PCREL_RELA) + || (h != NULL + && (! info->symbolic + || h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || (!info->shared + && (sec->flags & SEC_ALLOC) != 0 + && h != NULL + && (h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) + { + struct elf_m32r_dyn_relocs *p; + struct elf_m32r_dyn_relocs **head; + + if (dynobj == NULL) + htab->root.dynobj = dynobj = abfd; + + /* When creating a shared object, we must copy these + relocs into the output file. We create a reloc + section in dynobj and make room for the reloc. */ + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) + { + flagword flags; + + sreloc = bfd_make_section (dynobj, name); + flags = (SEC_HAS_CONTENTS | SEC_READONLY + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if ((sec->flags & SEC_ALLOC) != 0) + flags |= SEC_ALLOC | SEC_LOAD; + if (sreloc == NULL + || ! bfd_set_section_flags (dynobj, sreloc, flags) + || ! bfd_set_section_alignment (dynobj, sreloc, 2)) + return FALSE; + } + elf_section_data (sec)->sreloc = sreloc; + } + + /* If this is a global symbol, we count the number of + relocations we need for this symbol. */ + if (h != NULL) + head = &((struct elf_m32r_link_hash_entry *) h)->dyn_relocs; + else + { + asection *s; + + /* Track dynamic relocs needed for local syms too. */ + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, + sec, r_symndx); + if (s == NULL) + return FALSE; + + head = ((struct elf_m32r_dyn_relocs **) + &elf_section_data (s)->local_dynrel); + } + + p = *head; + if (p == NULL || p->sec != sec) + { + bfd_size_type amt = sizeof (*p); + p = ((struct elf_m32r_dyn_relocs *) bfd_alloc (dynobj, amt)); + if (p == NULL) + return FALSE; + p->next = *head; + *head = p; + p->sec = sec; + p->count = 0; + p->pc_count = 0; + } + + p->count += 1; + if (ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA + || ELF32_R_TYPE (rel->r_info) == R_M32R_18_PCREL_RELA) + p->pc_count += 1; + } + break; + + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_M32R_RELA_GNU_VTINHERIT: + case R_M32R_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_M32R_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + case R_M32R_RELA_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + } + } + + return TRUE; +} + +static struct bfd_elf_special_section const m32r_elf_special_sections[]= +{ + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } +}; + +static bfd_boolean +m32r_elf_fake_sections (abfd, hdr, sec) + bfd *abfd; + Elf_Internal_Shdr *hdr ATTRIBUTE_UNUSED; + asection *sec; +{ + register const char *name; + + name = bfd_get_section_name (abfd, sec); + + /* The generic elf_fake_sections will set up REL_HDR using the + default kind of relocations. But, we may actually need both + kinds of relocations, so we set up the second header here. + + This is not necessary for the O32 ABI since that only uses Elf32_Rel + relocations (cf. System V ABI, MIPS RISC Processor Supplement, + 3rd Edition, p. 4-17). It breaks the IRIX 5/6 32-bit ld, since one + of the resulting empty .rela.
sections starts with + sh_offset == object size, and ld doesn't allow that. While the check + is arguably bogus for empty or SHT_NOBITS sections, it can easily be + avoided by not emitting those useless sections in the first place. */ + if ((sec->flags & SEC_RELOC) != 0) + { + struct bfd_elf_section_data *esd; + bfd_size_type amt = sizeof (Elf_Internal_Shdr); + + esd = elf_section_data (sec); + BFD_ASSERT (esd->rel_hdr2 == NULL); + esd->rel_hdr2 = (Elf_Internal_Shdr *) bfd_zalloc (abfd, amt); + if (!esd->rel_hdr2) + return FALSE; + _bfd_elf_init_reloc_shdr (abfd, esd->rel_hdr2, sec, + !sec->use_rela_p); + } + + return TRUE; +} + +static enum elf_reloc_type_class +m32r_elf_reloc_type_class (rela) + const Elf_Internal_Rela *rela; +{ + switch ((int) ELF32_R_TYPE (rela->r_info)) + { + case R_M32R_RELATIVE: + return reloc_class_relative; + case R_M32R_JMP_SLOT: + return reloc_class_plt; + case R_M32R_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} + +#define ELF_ARCH bfd_arch_m32r +#define ELF_MACHINE_CODE EM_M32R +#define ELF_MACHINE_ALT1 EM_CYGNUS_M32R +#define ELF_MAXPAGESIZE 0x1 /* Explicitly requested by Mitsubishi. */ + +#define TARGET_BIG_SYM bfd_elf32_m32r_vec +#define TARGET_BIG_NAME "elf32-m32r" +#define TARGET_LITTLE_SYM bfd_elf32_m32rle_vec +#define TARGET_LITTLE_NAME "elf32-m32rle" + +#define elf_info_to_howto m32r_info_to_howto +#define elf_info_to_howto_rel m32r_info_to_howto_rel +#define elf_backend_section_from_bfd_section _bfd_m32r_elf_section_from_bfd_section +#define elf_backend_symbol_processing _bfd_m32r_elf_symbol_processing +#define elf_backend_add_symbol_hook m32r_elf_add_symbol_hook +#define elf_backend_relocate_section m32r_elf_relocate_section +#define elf_backend_gc_mark_hook m32r_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook m32r_elf_gc_sweep_hook +#define elf_backend_check_relocs m32r_elf_check_relocs + +#define elf_backend_create_dynamic_sections m32r_elf_create_dynamic_sections +#define bfd_elf32_bfd_link_hash_table_create m32r_elf_link_hash_table_create +#define elf_backend_size_dynamic_sections m32r_elf_size_dynamic_sections +#define elf_backend_finish_dynamic_sections m32r_elf_finish_dynamic_sections +#define elf_backend_adjust_dynamic_symbol m32r_elf_adjust_dynamic_symbol +#define elf_backend_finish_dynamic_symbol m32r_elf_finish_dynamic_symbol +#define elf_backend_reloc_type_class m32r_elf_reloc_type_class +#define elf_backend_copy_indirect_symbol m32r_elf_copy_indirect_symbol + +#define elf_backend_can_gc_sections 1 +/*#if !USE_REL +#define elf_backend_rela_normal 1 +#endif*/ +#define elf_backend_can_refcount 1 +#define elf_backend_want_got_plt 1 +#define elf_backend_plt_readonly 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_got_header_size 12 + +#define elf_backend_may_use_rel_p 1 +#ifdef USE_M32R_OLD_RELOC +#define elf_backend_default_use_rela_p 0 +#define elf_backend_may_use_rela_p 0 +#else +#define elf_backend_default_use_rela_p 1 +#define elf_backend_may_use_rela_p 1 +#define elf_backend_fake_sections m32r_elf_fake_sections +#endif + +#if 0 /* not yet */ +/* relax support */ +#define bfd_elf32_bfd_relax_section m32r_elf_relax_section +#define bfd_elf32_bfd_get_relocated_section_contents \ + m32r_elf_get_relocated_section_contents +#endif + +#define elf_backend_object_p m32r_elf_object_p +#define elf_backend_final_write_processing m32r_elf_final_write_processing +#define bfd_elf32_bfd_merge_private_bfd_data m32r_elf_merge_private_bfd_data +#define bfd_elf32_bfd_set_private_flags m32r_elf_set_private_flags +#define bfd_elf32_bfd_print_private_bfd_data m32r_elf_print_private_bfd_data +#define elf_backend_special_sections m32r_elf_special_sections + +#include "elf32-target.h" + +#undef ELF_MAXPAGESIZE +#define ELF_MAXPAGESIZE 0x1000 + +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_m32rlin_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-m32r-linux" +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf32_m32rlelin_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-m32rle-linux" +#undef elf32_bed +#define elf32_bed elf32_m32r_lin_bed + +#include "elf32-target.h" + diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c new file mode 100644 index 0000000000000..42010b01dd2b4 --- /dev/null +++ b/bfd/elf32-m68hc11.c @@ -0,0 +1,1309 @@ +/* Motorola 68HC11-specific support for 32-bit ELF + Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Contributed by Stephane Carrez (stcarrez@nerim.fr) + (Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com)) + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf32-m68hc1x.h" +#include "elf/m68hc11.h" +#include "opcode/m68hc11.h" + +/* Relocation functions. */ +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + (bfd *, bfd_reloc_code_real_type); +static void m68hc11_info_to_howto_rel + (bfd *, arelent *, Elf_Internal_Rela *); + +/* Trampoline generation. */ +static bfd_boolean m68hc11_elf_size_one_stub + (struct bfd_hash_entry *gen_entry, void *in_arg); +static bfd_boolean m68hc11_elf_build_one_stub + (struct bfd_hash_entry *gen_entry, void *in_arg); +static struct bfd_link_hash_table* m68hc11_elf_bfd_link_hash_table_create + (bfd* abfd); + +/* Linker relaxation. */ +static bfd_boolean m68hc11_elf_relax_section + (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); +static void m68hc11_elf_relax_delete_bytes + (bfd *, asection *, bfd_vma, int); +static void m68hc11_relax_group + (bfd *, asection *, bfd_byte *, unsigned, unsigned long, unsigned long); +static int compare_reloc (const void *, const void *); + +/* Use REL instead of RELA to save space */ +#define USE_REL 1 + +/* The Motorola 68HC11 microcontroller only addresses 64Kb but we also + support a memory bank switching mechanism similar to 68HC12. + We must handle 8 and 16-bit relocations. The 32-bit relocation + are used for debugging sections (DWARF2) to represent a virtual + address. + The 3-bit and 16-bit PC rel relocation is only used by 68HC12. */ +static reloc_howto_type elf_m68hc11_howto_table[] = { + /* This reloc does nothing. */ + HOWTO (R_M68HC11_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC11_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 8 bit absolute relocation */ + HOWTO (R_M68HC11_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC11_8", /* name */ + FALSE, /* partial_inplace */ + 0x00ff, /* src_mask */ + 0x00ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 8 bit absolute relocation (upper address) */ + HOWTO (R_M68HC11_HI8, /* type */ + 8, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC11_HI8", /* name */ + FALSE, /* partial_inplace */ + 0x00ff, /* src_mask */ + 0x00ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 8 bit absolute relocation (upper address) */ + HOWTO (R_M68HC11_LO8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC11_LO8", /* name */ + FALSE, /* partial_inplace */ + 0x00ff, /* src_mask */ + 0x00ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 8 bit PC-rel relocation */ + HOWTO (R_M68HC11_PCREL_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC11_PCREL_8", /* name */ + FALSE, /* partial_inplace */ + 0x00ff, /* src_mask */ + 0x00ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 16 bit absolute relocation */ + HOWTO (R_M68HC11_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont /*bitfield */ , /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC11_16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit absolute relocation. This one is never used for the + code relocation. It's used by gas for -gstabs generation. */ + HOWTO (R_M68HC11_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC11_32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 3 bit absolute relocation */ + HOWTO (R_M68HC11_3B, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 3, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC11_4B", /* name */ + FALSE, /* partial_inplace */ + 0x003, /* src_mask */ + 0x003, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 16 bit PC-rel relocation */ + HOWTO (R_M68HC11_PCREL_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC11_PCREL_16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_M68HC11_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_M68HC11_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_M68HC11_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_M68HC11_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 24 bit relocation */ + HOWTO (R_M68HC11_24, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC11_24", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 16-bit low relocation */ + HOWTO (R_M68HC11_LO16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC11_LO16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A page relocation */ + HOWTO (R_M68HC11_PAGE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC11_PAGE", /* name */ + FALSE, /* partial_inplace */ + 0x00ff, /* src_mask */ + 0x00ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (14), + EMPTY_HOWTO (15), + EMPTY_HOWTO (16), + EMPTY_HOWTO (17), + EMPTY_HOWTO (18), + EMPTY_HOWTO (19), + + /* Mark beginning of a jump instruction (any form). */ + HOWTO (R_M68HC11_RL_JUMP, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m68hc11_elf_ignore_reloc, /* special_function */ + "R_M68HC11_RL_JUMP", /* name */ + TRUE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Mark beginning of Gcc relaxation group instruction. */ + HOWTO (R_M68HC11_RL_GROUP, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m68hc11_elf_ignore_reloc, /* special_function */ + "R_M68HC11_RL_GROUP", /* name */ + TRUE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ +}; + +/* Map BFD reloc types to M68HC11 ELF reloc types. */ + +struct m68hc11_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +static const struct m68hc11_reloc_map m68hc11_reloc_map[] = { + {BFD_RELOC_NONE, R_M68HC11_NONE,}, + {BFD_RELOC_8, R_M68HC11_8}, + {BFD_RELOC_M68HC11_HI8, R_M68HC11_HI8}, + {BFD_RELOC_M68HC11_LO8, R_M68HC11_LO8}, + {BFD_RELOC_8_PCREL, R_M68HC11_PCREL_8}, + {BFD_RELOC_16_PCREL, R_M68HC11_PCREL_16}, + {BFD_RELOC_16, R_M68HC11_16}, + {BFD_RELOC_32, R_M68HC11_32}, + {BFD_RELOC_M68HC11_3B, R_M68HC11_3B}, + + {BFD_RELOC_VTABLE_INHERIT, R_M68HC11_GNU_VTINHERIT}, + {BFD_RELOC_VTABLE_ENTRY, R_M68HC11_GNU_VTENTRY}, + + {BFD_RELOC_M68HC11_LO16, R_M68HC11_LO16}, + {BFD_RELOC_M68HC11_PAGE, R_M68HC11_PAGE}, + {BFD_RELOC_M68HC11_24, R_M68HC11_24}, + + {BFD_RELOC_M68HC11_RL_JUMP, R_M68HC11_RL_JUMP}, + {BFD_RELOC_M68HC11_RL_GROUP, R_M68HC11_RL_GROUP}, +}; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + unsigned int i; + + for (i = 0; + i < sizeof (m68hc11_reloc_map) / sizeof (struct m68hc11_reloc_map); + i++) + { + if (m68hc11_reloc_map[i].bfd_reloc_val == code) + return &elf_m68hc11_howto_table[m68hc11_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Set the howto pointer for an M68HC11 ELF reloc. */ + +static void +m68hc11_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, Elf_Internal_Rela *dst) +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_M68HC11_max); + cache_ptr->howto = &elf_m68hc11_howto_table[r_type]; +} + + +/* Far trampoline generation. */ + +/* Build a 68HC11 trampoline stub. */ +static bfd_boolean +m68hc11_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) +{ + struct elf32_m68hc11_stub_hash_entry *stub_entry; + struct bfd_link_info *info; + struct m68hc11_elf_link_hash_table *htab; + asection *stub_sec; + bfd *stub_bfd; + bfd_byte *loc; + bfd_vma sym_value, phys_page, phys_addr; + + /* Massage our args to the form they really have. */ + stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry; + info = (struct bfd_link_info *) in_arg; + + htab = m68hc11_elf_hash_table (info); + + stub_sec = stub_entry->stub_sec; + + /* Make a note of the offset within the stubs for this entry. */ + stub_entry->stub_offset = stub_sec->_raw_size; + stub_sec->_raw_size += 10; + loc = stub_sec->contents + stub_entry->stub_offset; + + stub_bfd = stub_sec->owner; + + /* Create the trampoline call stub: + + pshb + ldab #%page(symbol) + ldy #%addr(symbol) + jmp __trampoline + + */ + sym_value = (stub_entry->target_value + + stub_entry->target_section->output_offset + + stub_entry->target_section->output_section->vma); + phys_addr = m68hc11_phys_addr (&htab->pinfo, sym_value); + phys_page = m68hc11_phys_page (&htab->pinfo, sym_value); + + /* pshb; ldab #%page(sym) */ + bfd_put_8 (stub_bfd, 0x37, loc); + bfd_put_8 (stub_bfd, 0xC6, loc + 1); + bfd_put_8 (stub_bfd, phys_page, loc + 2); + loc += 3; + + /* ldy #%addr(sym) */ + bfd_put_8 (stub_bfd, 0x18, loc); + bfd_put_8 (stub_bfd, 0xCE, loc + 1); + bfd_put_16 (stub_bfd, phys_addr, loc + 2); + loc += 4; + + /* jmp __trampoline */ + bfd_put_8 (stub_bfd, 0x7E, loc); + bfd_put_16 (stub_bfd, htab->pinfo.trampoline_addr, loc + 1); + + return TRUE; +} + +/* As above, but don't actually build the stub. Just bump offset so + we know stub section sizes. */ + +static bfd_boolean +m68hc11_elf_size_one_stub (struct bfd_hash_entry *gen_entry, + void *in_arg ATTRIBUTE_UNUSED) +{ + struct elf32_m68hc11_stub_hash_entry *stub_entry; + + /* Massage our args to the form they really have. */ + stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry; + + stub_entry->stub_sec->_raw_size += 10; + return TRUE; +} + +/* Create a 68HC11 ELF linker hash table. */ + +static struct bfd_link_hash_table * +m68hc11_elf_bfd_link_hash_table_create (bfd *abfd) +{ + struct m68hc11_elf_link_hash_table *ret; + + ret = m68hc11_elf_hash_table_create (abfd); + if (ret == (struct m68hc11_elf_link_hash_table *) NULL) + return NULL; + + ret->size_one_stub = m68hc11_elf_size_one_stub; + ret->build_one_stub = m68hc11_elf_build_one_stub; + + return &ret->root.root; +} + + +/* 68HC11 Linker Relaxation. */ + +struct m68hc11_direct_relax +{ + const char *name; + unsigned char code; + unsigned char direct_code; +} m68hc11_direct_relax_table[] = { + { "adca", 0xB9, 0x99 }, + { "adcb", 0xF9, 0xD9 }, + { "adda", 0xBB, 0x9B }, + { "addb", 0xFB, 0xDB }, + { "addd", 0xF3, 0xD3 }, + { "anda", 0xB4, 0x94 }, + { "andb", 0xF4, 0xD4 }, + { "cmpa", 0xB1, 0x91 }, + { "cmpb", 0xF1, 0xD1 }, + { "cpd", 0xB3, 0x93 }, + { "cpxy", 0xBC, 0x9C }, +/* { "cpy", 0xBC, 0x9C }, */ + { "eora", 0xB8, 0x98 }, + { "eorb", 0xF8, 0xD8 }, + { "jsr", 0xBD, 0x9D }, + { "ldaa", 0xB6, 0x96 }, + { "ldab", 0xF6, 0xD6 }, + { "ldd", 0xFC, 0xDC }, + { "lds", 0xBE, 0x9E }, + { "ldxy", 0xFE, 0xDE }, + /* { "ldy", 0xFE, 0xDE },*/ + { "oraa", 0xBA, 0x9A }, + { "orab", 0xFA, 0xDA }, + { "sbca", 0xB2, 0x92 }, + { "sbcb", 0xF2, 0xD2 }, + { "staa", 0xB7, 0x97 }, + { "stab", 0xF7, 0xD7 }, + { "std", 0xFD, 0xDD }, + { "sts", 0xBF, 0x9F }, + { "stxy", 0xFF, 0xDF }, + /* { "sty", 0xFF, 0xDF },*/ + { "suba", 0xB0, 0x90 }, + { "subb", 0xF0, 0xD0 }, + { "subd", 0xB3, 0x93 }, + { 0, 0, 0 } +}; + +static struct m68hc11_direct_relax * +find_relaxable_insn (unsigned char code) +{ + int i; + + for (i = 0; m68hc11_direct_relax_table[i].name; i++) + if (m68hc11_direct_relax_table[i].code == code) + return &m68hc11_direct_relax_table[i]; + + return 0; +} + +static int +compare_reloc (const void *e1, const void *e2) +{ + const Elf_Internal_Rela *i1 = (const Elf_Internal_Rela *) e1; + const Elf_Internal_Rela *i2 = (const Elf_Internal_Rela *) e2; + + if (i1->r_offset == i2->r_offset) + return 0; + else + return i1->r_offset < i2->r_offset ? -1 : 1; +} + +#define M6811_OP_LDX_IMMEDIATE (0xCE) + +static void +m68hc11_relax_group (bfd *abfd, asection *sec, bfd_byte *contents, + unsigned value, unsigned long offset, + unsigned long end_group) +{ + unsigned char code; + unsigned long start_offset; + unsigned long ldx_offset = offset; + unsigned long ldx_size; + int can_delete_ldx; + int relax_ldy = 0; + + /* First instruction of the relax group must be a + LDX #value or LDY #value. If this is not the case, + ignore the relax group. */ + code = bfd_get_8 (abfd, contents + offset); + if (code == 0x18) + { + relax_ldy++; + offset++; + code = bfd_get_8 (abfd, contents + offset); + } + ldx_size = offset - ldx_offset + 3; + offset += 3; + if (code != M6811_OP_LDX_IMMEDIATE || offset >= end_group) + return; + + + /* We can remove the LDX/LDY only when all bset/brclr instructions + of the relax group have been converted to use direct addressing + mode. */ + can_delete_ldx = 1; + while (offset < end_group) + { + unsigned isize; + unsigned new_value; + int bset_use_y; + + bset_use_y = 0; + start_offset = offset; + code = bfd_get_8 (abfd, contents + offset); + if (code == 0x18) + { + bset_use_y++; + offset++; + code = bfd_get_8 (abfd, contents + offset); + } + + /* Check the instruction and translate to use direct addressing mode. */ + switch (code) + { + /* bset */ + case 0x1C: + code = 0x14; + isize = 3; + break; + + /* brclr */ + case 0x1F: + code = 0x13; + isize = 4; + break; + + /* brset */ + case 0x1E: + code = 0x12; + isize = 4; + break; + + /* bclr */ + case 0x1D: + code = 0x15; + isize = 3; + break; + + /* This instruction is not recognized and we are not + at end of the relax group. Ignore and don't remove + the first LDX (we don't know what it is used for...). */ + default: + return; + } + new_value = (unsigned) bfd_get_8 (abfd, contents + offset + 1); + new_value += value; + if ((new_value & 0xff00) == 0 && bset_use_y == relax_ldy) + { + bfd_put_8 (abfd, code, contents + offset); + bfd_put_8 (abfd, new_value, contents + offset + 1); + if (start_offset != offset) + { + m68hc11_elf_relax_delete_bytes (abfd, sec, start_offset, + offset - start_offset); + end_group--; + } + } + else + { + can_delete_ldx = 0; + } + offset = start_offset + isize; + } + if (can_delete_ldx) + { + /* Remove the move instruction (3 or 4 bytes win). */ + m68hc11_elf_relax_delete_bytes (abfd, sec, ldx_offset, ldx_size); + } +} + +/* This function handles relaxing for the 68HC11. + + + and somewhat more difficult to support. */ + +static bfd_boolean +m68hc11_elf_relax_section (bfd *abfd, asection *sec, + struct bfd_link_info *link_info, bfd_boolean *again) +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Shdr *shndx_hdr; + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *free_relocs = NULL; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *contents = NULL; + bfd_byte *free_contents = NULL; + Elf32_External_Sym *free_extsyms = NULL; + Elf_Internal_Rela *prev_insn_branch = NULL; + Elf_Internal_Rela *prev_insn_group = NULL; + unsigned insn_group_value = 0; + Elf_Internal_Sym *isymbuf = NULL; + + /* Assume nothing changes. */ + *again = FALSE; + + /* We don't have to do anything for a relocatable link, if + this section does not have relocs, or if this is not a + code section. */ + if (link_info->relocatable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0 + || (sec->flags & SEC_CODE) == 0) + return TRUE; + + /* If this is the first time we have been called for this section, + initialize the cooked size. */ + if (sec->_cooked_size == 0) + sec->_cooked_size = sec->_raw_size; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; + + /* Get a copy of the native relocations. */ + internal_relocs = (_bfd_elf_link_read_relocs + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + if (! link_info->keep_memory) + free_relocs = internal_relocs; + + /* Checking for branch relaxation relies on the relocations to + be sorted on 'r_offset'. This is not guaranteed so we must sort. */ + qsort (internal_relocs, sec->reloc_count, sizeof (Elf_Internal_Rela), + compare_reloc); + + /* Walk through them looking for relaxing opportunities. */ + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma symval; + bfd_vma value; + Elf_Internal_Sym *isym; + asection *sym_sec; + int is_far = 0; + + /* If this isn't something that can be relaxed, then ignore + this reloc. */ + if (ELF32_R_TYPE (irel->r_info) != (int) R_M68HC11_16 + && ELF32_R_TYPE (irel->r_info) != (int) R_M68HC11_RL_JUMP + && ELF32_R_TYPE (irel->r_info) != (int) R_M68HC11_RL_GROUP) + { + prev_insn_branch = 0; + prev_insn_group = 0; + continue; + } + + /* Get the section contents if we haven't done so already. */ + if (contents == NULL) + { + /* Get cached copy if it exists. */ + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + /* Go get them off disk. */ + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + free_contents = contents; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + /* Try to eliminate an unconditional 8 bit pc-relative branch + which immediately follows a conditional 8 bit pc-relative + branch around the unconditional branch. + + original: new: + bCC lab1 bCC' lab2 + bra lab2 + lab1: lab1: + + This happens when the bCC can't reach lab2 at assembly time, + but due to other relaxations it can reach at link time. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_M68HC11_RL_JUMP) + { + Elf_Internal_Rela *nrel; + unsigned char code; + unsigned char roffset; + + prev_insn_branch = 0; + prev_insn_group = 0; + + /* Do nothing if this reloc is the last byte in the section. */ + if (irel->r_offset + 2 >= sec->_cooked_size) + continue; + + /* See if the next instruction is an unconditional pc-relative + branch, more often than not this test will fail, so we + test it first to speed things up. */ + code = bfd_get_8 (abfd, contents + irel->r_offset + 2); + if (code != 0x7e) + continue; + + /* Also make sure the next relocation applies to the next + instruction and that it's a pc-relative 8 bit branch. */ + nrel = irel + 1; + if (nrel == irelend + || irel->r_offset + 3 != nrel->r_offset + || ELF32_R_TYPE (nrel->r_info) != (int) R_M68HC11_16) + continue; + + /* Make sure our destination immediately follows the + unconditional branch. */ + roffset = bfd_get_8 (abfd, contents + irel->r_offset + 1); + if (roffset != 3) + continue; + + prev_insn_branch = irel; + prev_insn_group = 0; + continue; + } + + /* Read this BFD's symbols if we haven't done so already. */ + if (isymbuf == NULL && symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + /* A local symbol. */ + isym = isymbuf + ELF32_R_SYM (irel->r_info); + is_far = isym->st_other & STO_M68HC12_FAR; + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + symval = (isym->st_value + + sym_sec->output_section->vma + + sym_sec->output_offset); + } + else + { + unsigned long indx; + struct elf_link_hash_entry *h; + + /* An external symbol. */ + indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + { + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + prev_insn_branch = 0; + prev_insn_group = 0; + continue; + } + + is_far = h->other & STO_M68HC12_FAR; + isym = 0; + sym_sec = h->root.u.def.section; + symval = (h->root.u.def.value + + sym_sec->output_section->vma + + sym_sec->output_offset); + } + + if (ELF32_R_TYPE (irel->r_info) == (int) R_M68HC11_RL_GROUP) + { + prev_insn_branch = 0; + prev_insn_group = 0; + + /* Do nothing if this reloc is the last byte in the section. */ + if (irel->r_offset == sec->_cooked_size) + continue; + + prev_insn_group = irel; + insn_group_value = isym->st_value; + continue; + } + + /* When we relax some bytes, the size of our section changes. + This affects the layout of next input sections that go in our + output section. When the symbol is part of another section that + will go in the same output section as the current one, it's + final address may now be incorrect (too far). We must let the + linker re-compute all section offsets before processing this + reloc. Code example: + + Initial Final + .sect .text section size = 6 section size = 4 + jmp foo + jmp bar + .sect .text.foo_bar output_offset = 6 output_offset = 4 + foo: rts + bar: rts + + If we process the reloc now, the jmp bar is replaced by a + relative branch to the initial bar address (output_offset 6). */ + if (*again && sym_sec != sec + && sym_sec->output_section == sec->output_section) + { + prev_insn_group = 0; + prev_insn_branch = 0; + continue; + } + + value = symval; + /* Try to turn a far branch to a near branch. */ + if (ELF32_R_TYPE (irel->r_info) == (int) R_M68HC11_16 + && prev_insn_branch) + { + bfd_vma offset; + unsigned char code; + + offset = value - (prev_insn_branch->r_offset + + sec->output_section->vma + + sec->output_offset + 2); + + /* If the offset is still out of -128..+127 range, + leave that far branch unchanged. */ + if ((offset & 0xff80) != 0 && (offset & 0xff80) != 0xff80) + { + prev_insn_branch = 0; + continue; + } + + /* Shrink the branch. */ + code = bfd_get_8 (abfd, contents + prev_insn_branch->r_offset); + if (code == 0x7e) + { + code = 0x20; + bfd_put_8 (abfd, code, contents + prev_insn_branch->r_offset); + bfd_put_8 (abfd, 0xff, + contents + prev_insn_branch->r_offset + 1); + irel->r_offset = prev_insn_branch->r_offset + 1; + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_M68HC11_PCREL_8); + m68hc11_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 1); + } + else + { + code ^= 0x1; + bfd_put_8 (abfd, code, contents + prev_insn_branch->r_offset); + bfd_put_8 (abfd, 0xff, + contents + prev_insn_branch->r_offset + 1); + irel->r_offset = prev_insn_branch->r_offset + 1; + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_M68HC11_PCREL_8); + m68hc11_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 3); + } + prev_insn_branch = 0; + *again = TRUE; + } + + /* Try to turn a 16 bit address into a 8 bit page0 address. */ + else if (ELF32_R_TYPE (irel->r_info) == (int) R_M68HC11_16 + && (value & 0xff00) == 0) + { + unsigned char code; + unsigned short offset; + struct m68hc11_direct_relax *rinfo; + + prev_insn_branch = 0; + offset = bfd_get_16 (abfd, contents + irel->r_offset); + offset += value; + if ((offset & 0xff00) != 0) + { + prev_insn_group = 0; + continue; + } + + if (prev_insn_group) + { + unsigned long old_sec_size = sec->_cooked_size; + + /* Note that we've changed the relocation contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) isymbuf; + free_extsyms = NULL; + + m68hc11_relax_group (abfd, sec, contents, offset, + prev_insn_group->r_offset, + insn_group_value); + irel = prev_insn_group; + prev_insn_group = 0; + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_M68HC11_NONE); + if (sec->_cooked_size != old_sec_size) + *again = TRUE; + continue; + } + + /* Get the opcode. */ + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + rinfo = find_relaxable_insn (code); + if (rinfo == 0) + { + prev_insn_group = 0; + continue; + } + + /* Note that we've changed the relocation contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) isymbuf; + free_extsyms = NULL; + + /* Fix the opcode. */ + /* printf ("A relaxable case : 0x%02x (%s)\n", + code, rinfo->name); */ + bfd_put_8 (abfd, rinfo->direct_code, + contents + irel->r_offset - 1); + + /* Delete one byte of data (upper byte of address). */ + m68hc11_elf_relax_delete_bytes (abfd, sec, irel->r_offset, 1); + + /* Fix the relocation's type. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_M68HC11_8); + + /* That will change things, so, we should relax again. */ + *again = TRUE; + } + else if (ELF32_R_TYPE (irel->r_info) == R_M68HC11_16 && !is_far) + { + unsigned char code; + bfd_vma offset; + + prev_insn_branch = 0; + code = bfd_get_8 (abfd, contents + irel->r_offset - 1); + if (code == 0x7e || code == 0xbd) + { + offset = value - (irel->r_offset + + sec->output_section->vma + + sec->output_offset + 1); + offset += bfd_get_16 (abfd, contents + irel->r_offset); + + /* If the offset is still out of -128..+127 range, + leave that far branch unchanged. */ + if ((offset & 0xff80) == 0 || (offset & 0xff80) == 0xff80) + { + + /* Note that we've changed the relocation contents, etc. */ + elf_section_data (sec)->relocs = internal_relocs; + free_relocs = NULL; + + elf_section_data (sec)->this_hdr.contents = contents; + free_contents = NULL; + + symtab_hdr->contents = (bfd_byte *) isymbuf; + free_extsyms = NULL; + + /* Shrink the branch. */ + code = (code == 0x7e) ? 0x20 : 0x8d; + bfd_put_8 (abfd, code, + contents + irel->r_offset - 1); + bfd_put_8 (abfd, 0xff, + contents + irel->r_offset); + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_M68HC11_PCREL_8); + m68hc11_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 1, 1); + /* That will change things, so, we should relax again. */ + *again = TRUE; + } + } + } + prev_insn_branch = 0; + prev_insn_group = 0; + } + + if (free_relocs != NULL) + { + free (free_relocs); + free_relocs = NULL; + } + + if (free_contents != NULL) + { + if (! link_info->keep_memory) + free (free_contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + free_contents = NULL; + } + + if (free_extsyms != NULL) + { + if (! link_info->keep_memory) + free (free_extsyms); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) isymbuf; + } + free_extsyms = NULL; + } + + return TRUE; + + error_return: + if (free_relocs != NULL) + free (free_relocs); + if (free_contents != NULL) + free (free_contents); + if (free_extsyms != NULL) + free (free_extsyms); + return FALSE; +} + +/* Delete some bytes from a section while relaxing. */ + +static void +m68hc11_elf_relax_delete_bytes (bfd *abfd, asection *sec, + bfd_vma addr, int count) +{ + Elf_Internal_Shdr *symtab_hdr; + unsigned int sec_shndx; + bfd_byte *contents; + Elf_Internal_Rela *irel, *irelend; + bfd_vma toaddr; + Elf_Internal_Sym *isymbuf, *isym, *isymend; + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry **end_hashes; + unsigned int symcount; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + + sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + contents = elf_section_data (sec)->this_hdr.contents; + + toaddr = sec->_cooked_size; + + irel = elf_section_data (sec)->relocs; + irelend = irel + sec->reloc_count; + + /* Actually delete the bytes. */ + memmove (contents + addr, contents + addr + count, + (size_t) (toaddr - addr - count)); + + sec->_cooked_size -= count; + + /* Adjust all the relocs. */ + for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) + { + unsigned char code; + unsigned char offset; + unsigned short raddr; + unsigned long old_offset; + int branch_pos; + + old_offset = irel->r_offset; + + /* See if this reloc was for the bytes we have deleted, in which + case we no longer care about it. Don't delete relocs which + represent addresses, though. */ + if (ELF32_R_TYPE (irel->r_info) != R_M68HC11_RL_JUMP + && irel->r_offset >= addr && irel->r_offset < addr + count) + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_M68HC11_NONE); + + if (ELF32_R_TYPE (irel->r_info) == R_M68HC11_NONE) + continue; + + /* Get the new reloc address. */ + if ((irel->r_offset > addr + && irel->r_offset < toaddr)) + irel->r_offset -= count; + + /* If this is a PC relative reloc, see if the range it covers + includes the bytes we have deleted. */ + switch (ELF32_R_TYPE (irel->r_info)) + { + default: + break; + + case R_M68HC11_RL_JUMP: + code = bfd_get_8 (abfd, contents + irel->r_offset); + switch (code) + { + /* jsr and jmp instruction are also marked with RL_JUMP + relocs but no adjustment must be made. */ + case 0x7e: + case 0x9d: + case 0xbd: + continue; + + case 0x12: + case 0x13: + branch_pos = 3; + raddr = 4; + + /* Special case when we translate a brclr N,y into brclr * + In this case, the 0x18 page2 prefix is removed. + The reloc offset is not modified but the instruction + size is reduced by 1. */ + if (old_offset == addr) + raddr++; + break; + + case 0x1e: + case 0x1f: + branch_pos = 3; + raddr = 4; + break; + + case 0x18: + branch_pos = 4; + raddr = 5; + break; + + default: + branch_pos = 1; + raddr = 2; + break; + } + offset = bfd_get_8 (abfd, contents + irel->r_offset + branch_pos); + raddr += old_offset; + raddr += ((unsigned short) offset | ((offset & 0x80) ? 0xff00 : 0)); + if (irel->r_offset < addr && raddr > addr) + { + offset -= count; + bfd_put_8 (abfd, offset, contents + irel->r_offset + branch_pos); + } + else if (irel->r_offset >= addr && raddr <= addr) + { + offset += count; + bfd_put_8 (abfd, offset, contents + irel->r_offset + branch_pos); + } + else + { + /*printf ("Not adjusted 0x%04x [0x%4x 0x%4x]\n", raddr, + irel->r_offset, addr);*/ + } + + break; + } + } + + /* Adjust the local symbols defined in this section. */ + isymend = isymbuf + symtab_hdr->sh_info; + for (isym = isymbuf; isym < isymend; isym++) + { + if (isym->st_shndx == sec_shndx + && isym->st_value > addr + && isym->st_value <= toaddr) + isym->st_value -= count; + } + + /* Now adjust the global symbols defined in this section. */ + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + sym_hashes = elf_sym_hashes (abfd); + end_hashes = sym_hashes + symcount; + for (; sym_hashes < end_hashes; sym_hashes++) + { + struct elf_link_hash_entry *sym_hash = *sym_hashes; + if ((sym_hash->root.type == bfd_link_hash_defined + || sym_hash->root.type == bfd_link_hash_defweak) + && sym_hash->root.u.def.section == sec + && sym_hash->root.u.def.value > addr + && sym_hash->root.u.def.value <= toaddr) + { + sym_hash->root.u.def.value -= count; + } + } +} + +/* Specific sections: + - The .page0 is a data section that is mapped in [0x0000..0x00FF]. + Page0 accesses are faster on the M68HC11. Soft registers used by GCC-m6811 + are located in .page0. + - The .vectors is the section that represents the interrupt + vectors. */ +static struct bfd_elf_special_section const elf32_m68hc11_special_sections[]= +{ + { ".eeprom", 7, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".softregs", 9, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } +}; + +#define ELF_ARCH bfd_arch_m68hc11 +#define ELF_MACHINE_CODE EM_68HC11 +#define ELF_MAXPAGESIZE 0x1000 + +#define TARGET_BIG_SYM bfd_elf32_m68hc11_vec +#define TARGET_BIG_NAME "elf32-m68hc11" + +#define elf_info_to_howto 0 +#define elf_info_to_howto_rel m68hc11_info_to_howto_rel +#define bfd_elf32_bfd_relax_section m68hc11_elf_relax_section +#define elf_backend_gc_mark_hook elf32_m68hc11_gc_mark_hook +#define elf_backend_gc_sweep_hook elf32_m68hc11_gc_sweep_hook +#define elf_backend_check_relocs elf32_m68hc11_check_relocs +#define elf_backend_relocate_section elf32_m68hc11_relocate_section +#define elf_backend_add_symbol_hook elf32_m68hc11_add_symbol_hook +#define elf_backend_object_p 0 +#define elf_backend_final_write_processing 0 +#define elf_backend_can_gc_sections 1 +#define elf_backend_special_sections elf32_m68hc11_special_sections + +#define bfd_elf32_bfd_link_hash_table_create \ + m68hc11_elf_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_free \ + m68hc11_elf_bfd_link_hash_table_free +#define bfd_elf32_bfd_merge_private_bfd_data \ + _bfd_m68hc11_elf_merge_private_bfd_data +#define bfd_elf32_bfd_set_private_flags _bfd_m68hc11_elf_set_private_flags +#define bfd_elf32_bfd_print_private_bfd_data \ + _bfd_m68hc11_elf_print_private_bfd_data + +#include "elf32-target.h" diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c new file mode 100644 index 0000000000000..cfc265efd7332 --- /dev/null +++ b/bfd/elf32-m68hc12.c @@ -0,0 +1,577 @@ +/* Motorola 68HC12-specific support for 32-bit ELF + Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc. + Contributed by Stephane Carrez (stcarrez@nerim.fr) + (Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com)) + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf32-m68hc1x.h" +#include "elf/m68hc11.h" +#include "opcode/m68hc11.h" + +/* Relocation functions. */ +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + (bfd *, bfd_reloc_code_real_type); +static void m68hc11_info_to_howto_rel + (bfd *, arelent *, Elf_Internal_Rela *); + +/* Trampoline generation. */ +static bfd_boolean m68hc12_elf_size_one_stub + (struct bfd_hash_entry *gen_entry, void *in_arg); +static bfd_boolean m68hc12_elf_build_one_stub + (struct bfd_hash_entry *gen_entry, void *in_arg); +static struct bfd_link_hash_table* m68hc12_elf_bfd_link_hash_table_create + (bfd*); + +static bfd_boolean m68hc12_elf_set_mach_from_flags PARAMS ((bfd *)); + +/* Use REL instead of RELA to save space */ +#define USE_REL 1 + +/* The 68HC12 microcontroler has a memory bank switching system + with a 16Kb window in the 64Kb address space. The extended memory + is mapped in the 16Kb window (at 0x8000). The page register controls + which 16Kb bank is mapped. The call/rtc instructions take care of + bank switching in function calls/returns. + + For GNU Binutils to work, we consider there is a physical memory + at 0..0x0ffff and a kind of virtual memory above that. Symbols + in virtual memory have their addresses treated in a special way + when disassembling and when linking. + + For the linker to work properly, we must always relocate the virtual + memory as if it is mapped at 0x8000. When a 16-bit relocation is + made in the virtual memory, we check that it does not cross the + memory bank where it is used. This would involve a page change + which would be wrong. The 24-bit relocation is for that and it + treats the address as a physical address + page number. + + + Banked + Address Space + | | Page n + +---------------+ 0x1010000 + | | + | jsr _foo | + | .. | Page 3 + | _foo: | + +---------------+ 0x100C000 + | | + | call _bar | + | .. | Page 2 + | _bar: | + +---------------+ 0x1008000 + /------>| | + | | call _foo | Page 1 + | | | + | +---------------+ 0x1004000 + Physical | | | + Address Space | | | Page 0 + | | | + +-----------+ 0x00FFFF | +---------------+ 0x1000000 + | | | + | call _foo | | + | | | + +-----------+ 0x00BFFF -+---/ + | | | + | | | + | | 16K | + | | | + +-----------+ 0x008000 -+ + | | + | | + = = + | | + | | + +-----------+ 0000 + + + The 'call _foo' must be relocated with page 3 and 16-bit address + mapped at 0x8000. + + The 3-bit and 16-bit PC rel relocation is only used by 68HC12. */ +static reloc_howto_type elf_m68hc11_howto_table[] = { + /* This reloc does nothing. */ + HOWTO (R_M68HC11_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC12_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 8 bit absolute relocation */ + HOWTO (R_M68HC11_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC12_8", /* name */ + FALSE, /* partial_inplace */ + 0x00ff, /* src_mask */ + 0x00ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 8 bit absolute relocation (upper address) */ + HOWTO (R_M68HC11_HI8, /* type */ + 8, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC12_HI8", /* name */ + FALSE, /* partial_inplace */ + 0x00ff, /* src_mask */ + 0x00ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 8 bit absolute relocation (upper address) */ + HOWTO (R_M68HC11_LO8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC12_LO8", /* name */ + FALSE, /* partial_inplace */ + 0x00ff, /* src_mask */ + 0x00ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 8 bit PC-rel relocation */ + HOWTO (R_M68HC11_PCREL_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC12_PCREL_8", /* name */ + FALSE, /* partial_inplace */ + 0x00ff, /* src_mask */ + 0x00ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 16 bit absolute relocation */ + HOWTO (R_M68HC11_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont /*bitfield */ , /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC12_16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit absolute relocation. This one is never used for the + code relocation. It's used by gas for -gstabs generation. */ + HOWTO (R_M68HC11_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC12_32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 3 bit absolute relocation */ + HOWTO (R_M68HC11_3B, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 3, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC12_4B", /* name */ + FALSE, /* partial_inplace */ + 0x003, /* src_mask */ + 0x003, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 16 bit PC-rel relocation */ + HOWTO (R_M68HC11_PCREL_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_M68HC12_PCREL_16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_M68HC11_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_M68HC11_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_M68HC11_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_M68HC11_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 24 bit relocation */ + HOWTO (R_M68HC11_24, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m68hc11_elf_special_reloc, /* special_function */ + "R_M68HC12_24", /* name */ + FALSE, /* partial_inplace */ + 0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 16-bit low relocation */ + HOWTO (R_M68HC11_LO16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m68hc11_elf_special_reloc,/* special_function */ + "R_M68HC12_LO16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A page relocation */ + HOWTO (R_M68HC11_PAGE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m68hc11_elf_special_reloc,/* special_function */ + "R_M68HC12_PAGE", /* name */ + FALSE, /* partial_inplace */ + 0x00ff, /* src_mask */ + 0x00ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (14), + EMPTY_HOWTO (15), + EMPTY_HOWTO (16), + EMPTY_HOWTO (17), + EMPTY_HOWTO (18), + EMPTY_HOWTO (19), + + /* Mark beginning of a jump instruction (any form). */ + HOWTO (R_M68HC11_RL_JUMP, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m68hc11_elf_ignore_reloc, /* special_function */ + "R_M68HC12_RL_JUMP", /* name */ + TRUE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Mark beginning of Gcc relaxation group instruction. */ + HOWTO (R_M68HC11_RL_GROUP, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + m68hc11_elf_ignore_reloc, /* special_function */ + "R_M68HC12_RL_GROUP", /* name */ + TRUE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ +}; + +/* Map BFD reloc types to M68HC11 ELF reloc types. */ + +struct m68hc11_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +static const struct m68hc11_reloc_map m68hc11_reloc_map[] = { + {BFD_RELOC_NONE, R_M68HC11_NONE,}, + {BFD_RELOC_8, R_M68HC11_8}, + {BFD_RELOC_M68HC11_HI8, R_M68HC11_HI8}, + {BFD_RELOC_M68HC11_LO8, R_M68HC11_LO8}, + {BFD_RELOC_8_PCREL, R_M68HC11_PCREL_8}, + {BFD_RELOC_16_PCREL, R_M68HC11_PCREL_16}, + {BFD_RELOC_16, R_M68HC11_16}, + {BFD_RELOC_32, R_M68HC11_32}, + {BFD_RELOC_M68HC11_3B, R_M68HC11_3B}, + + {BFD_RELOC_VTABLE_INHERIT, R_M68HC11_GNU_VTINHERIT}, + {BFD_RELOC_VTABLE_ENTRY, R_M68HC11_GNU_VTENTRY}, + + {BFD_RELOC_M68HC11_LO16, R_M68HC11_LO16}, + {BFD_RELOC_M68HC11_PAGE, R_M68HC11_PAGE}, + {BFD_RELOC_M68HC11_24, R_M68HC11_24}, + + {BFD_RELOC_M68HC11_RL_JUMP, R_M68HC11_RL_JUMP}, + {BFD_RELOC_M68HC11_RL_GROUP, R_M68HC11_RL_GROUP}, +}; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + unsigned int i; + + for (i = 0; + i < sizeof (m68hc11_reloc_map) / sizeof (struct m68hc11_reloc_map); + i++) + { + if (m68hc11_reloc_map[i].bfd_reloc_val == code) + return &elf_m68hc11_howto_table[m68hc11_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Set the howto pointer for an M68HC11 ELF reloc. */ + +static void +m68hc11_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, Elf_Internal_Rela *dst) +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_M68HC11_max); + cache_ptr->howto = &elf_m68hc11_howto_table[r_type]; +} + + +/* Far trampoline generation. */ + +/* Build a 68HC12 trampoline stub. */ +static bfd_boolean +m68hc12_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) +{ + struct elf32_m68hc11_stub_hash_entry *stub_entry; + struct bfd_link_info *info; + struct m68hc11_elf_link_hash_table *htab; + asection *stub_sec; + bfd *stub_bfd; + bfd_byte *loc; + bfd_vma sym_value, phys_page, phys_addr; + + /* Massage our args to the form they really have. */ + stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry; + info = (struct bfd_link_info *) in_arg; + + htab = m68hc11_elf_hash_table (info); + + stub_sec = stub_entry->stub_sec; + + /* Make a note of the offset within the stubs for this entry. */ + stub_entry->stub_offset = stub_sec->_raw_size; + stub_sec->_raw_size += 7; + loc = stub_sec->contents + stub_entry->stub_offset; + + stub_bfd = stub_sec->owner; + + /* Create the trampoline call stub: + + ldy #%addr(symbol) + call %page(symbol), __trampoline + + */ + sym_value = (stub_entry->target_value + + stub_entry->target_section->output_offset + + stub_entry->target_section->output_section->vma); + phys_addr = m68hc11_phys_addr (&htab->pinfo, sym_value); + phys_page = m68hc11_phys_page (&htab->pinfo, sym_value); + + /* ldy #%page(sym) */ + bfd_put_8 (stub_bfd, 0xCD, loc); + bfd_put_16 (stub_bfd, phys_addr, loc + 1); + loc += 3; + + /* call %page(sym), __trampoline */ + bfd_put_8 (stub_bfd, 0x4a, loc); + bfd_put_16 (stub_bfd, htab->pinfo.trampoline_addr, loc + 1); + bfd_put_8 (stub_bfd, phys_page, loc + 3); + + return TRUE; +} + +/* As above, but don't actually build the stub. Just bump offset so + we know stub section sizes. */ + +static bfd_boolean +m68hc12_elf_size_one_stub (struct bfd_hash_entry *gen_entry, + void *in_arg ATTRIBUTE_UNUSED) +{ + struct elf32_m68hc11_stub_hash_entry *stub_entry; + + /* Massage our args to the form they really have. */ + stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry; + + stub_entry->stub_sec->_raw_size += 7; + return TRUE; +} + +/* Create a 68HC12 ELF linker hash table. */ + +static struct bfd_link_hash_table * +m68hc12_elf_bfd_link_hash_table_create (bfd *abfd) +{ + struct m68hc11_elf_link_hash_table *ret; + + ret = m68hc11_elf_hash_table_create (abfd); + if (ret == (struct m68hc11_elf_link_hash_table *) NULL) + return NULL; + + ret->size_one_stub = m68hc12_elf_size_one_stub; + ret->build_one_stub = m68hc12_elf_build_one_stub; + + return &ret->root.root; +} + +static bfd_boolean +m68hc12_elf_set_mach_from_flags (bfd *abfd) +{ + flagword flags = elf_elfheader (abfd)->e_flags; + + switch (flags & EF_M68HC11_MACH_MASK) + { + case EF_M68HC12_MACH: + bfd_default_set_arch_mach (abfd, bfd_arch_m68hc12, bfd_mach_m6812); + break; + case EF_M68HCS12_MACH: + bfd_default_set_arch_mach (abfd, bfd_arch_m68hc12, bfd_mach_m6812s); + break; + case EF_M68HC11_GENERIC: + bfd_default_set_arch_mach (abfd, bfd_arch_m68hc12, + bfd_mach_m6812_default); + break; + default: + return FALSE; + } + return TRUE; +} + +/* Specific sections: + - The .page0 is a data section that is mapped in [0x0000..0x00FF]. + Page0 accesses are faster on the M68HC12. + - The .vectors is the section that represents the interrupt + vectors. */ +static struct bfd_elf_special_section const elf32_m68hc12_special_sections[]= +{ + { ".eeprom", 7, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".softregs", 9, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } +}; + +#define ELF_ARCH bfd_arch_m68hc12 +#define ELF_MACHINE_CODE EM_68HC12 +#define ELF_MAXPAGESIZE 0x1000 + +#define TARGET_BIG_SYM bfd_elf32_m68hc12_vec +#define TARGET_BIG_NAME "elf32-m68hc12" + +#define elf_info_to_howto 0 +#define elf_info_to_howto_rel m68hc11_info_to_howto_rel +#define elf_backend_gc_mark_hook elf32_m68hc11_gc_mark_hook +#define elf_backend_gc_sweep_hook elf32_m68hc11_gc_sweep_hook +#define elf_backend_check_relocs elf32_m68hc11_check_relocs +#define elf_backend_relocate_section elf32_m68hc11_relocate_section +#define elf_backend_object_p m68hc12_elf_set_mach_from_flags +#define elf_backend_final_write_processing 0 +#define elf_backend_can_gc_sections 1 +#define elf_backend_special_sections elf32_m68hc12_special_sections +#define elf_backend_post_process_headers elf32_m68hc11_post_process_headers +#define elf_backend_add_symbol_hook elf32_m68hc11_add_symbol_hook + +#define bfd_elf32_bfd_link_hash_table_create \ + m68hc12_elf_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_free \ + m68hc11_elf_bfd_link_hash_table_free +#define bfd_elf32_bfd_merge_private_bfd_data \ + _bfd_m68hc11_elf_merge_private_bfd_data +#define bfd_elf32_bfd_set_private_flags _bfd_m68hc11_elf_set_private_flags +#define bfd_elf32_bfd_print_private_bfd_data \ + _bfd_m68hc11_elf_print_private_bfd_data + +#include "elf32-target.h" diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c new file mode 100644 index 0000000000000..2a139a405c264 --- /dev/null +++ b/bfd/elf32-m68hc1x.c @@ -0,0 +1,1399 @@ +/* Motorola 68HC11/HC12-specific support for 32-bit ELF + Copyright 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + Contributed by Stephane Carrez (stcarrez@nerim.fr) + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf32-m68hc1x.h" +#include "elf/m68hc11.h" +#include "opcode/m68hc11.h" + + +#define m68hc12_stub_hash_lookup(table, string, create, copy) \ + ((struct elf32_m68hc11_stub_hash_entry *) \ + bfd_hash_lookup ((table), (string), (create), (copy))) + +static struct elf32_m68hc11_stub_hash_entry* m68hc12_add_stub + (const char *stub_name, + asection *section, + struct m68hc11_elf_link_hash_table *htab); + +static struct bfd_hash_entry *stub_hash_newfunc + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); + +static void m68hc11_elf_set_symbol (bfd* abfd, struct bfd_link_info *info, + const char* name, bfd_vma value, + asection* sec); + +static bfd_boolean m68hc11_elf_export_one_stub + (struct bfd_hash_entry *gen_entry, void *in_arg); + +static void scan_sections_for_abi (bfd*, asection*, PTR); + +struct m68hc11_scan_param +{ + struct m68hc11_page_info* pinfo; + bfd_boolean use_memory_banks; +}; + + +/* Create a 68HC11/68HC12 ELF linker hash table. */ + +struct m68hc11_elf_link_hash_table* +m68hc11_elf_hash_table_create (bfd *abfd) +{ + struct m68hc11_elf_link_hash_table *ret; + bfd_size_type amt = sizeof (struct m68hc11_elf_link_hash_table); + + ret = (struct m68hc11_elf_link_hash_table *) bfd_malloc (amt); + if (ret == (struct m68hc11_elf_link_hash_table *) NULL) + return NULL; + + memset (ret, 0, amt); + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + _bfd_elf_link_hash_newfunc)) + { + free (ret); + return NULL; + } + + /* Init the stub hash table too. */ + amt = sizeof (struct bfd_hash_table); + ret->stub_hash_table = (struct bfd_hash_table*) bfd_malloc (amt); + if (ret->stub_hash_table == NULL) + { + free (ret); + return NULL; + } + if (!bfd_hash_table_init (ret->stub_hash_table, stub_hash_newfunc)) + return NULL; + + ret->stub_bfd = NULL; + ret->stub_section = 0; + ret->add_stub_section = NULL; + ret->sym_sec.abfd = NULL; + + return ret; +} + +/* Free the derived linker hash table. */ + +void +m68hc11_elf_bfd_link_hash_table_free (struct bfd_link_hash_table *hash) +{ + struct m68hc11_elf_link_hash_table *ret + = (struct m68hc11_elf_link_hash_table *) hash; + + bfd_hash_table_free (ret->stub_hash_table); + free (ret->stub_hash_table); + _bfd_generic_link_hash_table_free (hash); +} + +/* Assorted hash table functions. */ + +/* Initialize an entry in the stub hash table. */ + +static struct bfd_hash_entry * +stub_hash_newfunc (struct bfd_hash_entry *entry, struct bfd_hash_table *table, + const char *string) +{ + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (entry == NULL) + { + entry = bfd_hash_allocate (table, + sizeof (struct elf32_m68hc11_stub_hash_entry)); + if (entry == NULL) + return entry; + } + + /* Call the allocation method of the superclass. */ + entry = bfd_hash_newfunc (entry, table, string); + if (entry != NULL) + { + struct elf32_m68hc11_stub_hash_entry *eh; + + /* Initialize the local fields. */ + eh = (struct elf32_m68hc11_stub_hash_entry *) entry; + eh->stub_sec = NULL; + eh->stub_offset = 0; + eh->target_value = 0; + eh->target_section = NULL; + } + + return entry; +} + +/* Add a new stub entry to the stub hash. Not all fields of the new + stub entry are initialised. */ + +static struct elf32_m68hc11_stub_hash_entry * +m68hc12_add_stub (const char *stub_name, asection *section, + struct m68hc11_elf_link_hash_table *htab) +{ + struct elf32_m68hc11_stub_hash_entry *stub_entry; + + /* Enter this entry into the linker stub hash table. */ + stub_entry = m68hc12_stub_hash_lookup (htab->stub_hash_table, stub_name, + TRUE, FALSE); + if (stub_entry == NULL) + { + (*_bfd_error_handler) (_("%s: cannot create stub entry %s"), + bfd_archive_filename (section->owner), + stub_name); + return NULL; + } + + if (htab->stub_section == 0) + { + htab->stub_section = (*htab->add_stub_section) (".tramp", + htab->tramp_section); + } + + stub_entry->stub_sec = htab->stub_section; + stub_entry->stub_offset = 0; + return stub_entry; +} + +/* Hook called by the linker routine which adds symbols from an object + file. We use it for identify far symbols and force a loading of + the trampoline handler. */ + +bfd_boolean +elf32_m68hc11_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, + Elf_Internal_Sym *sym, + const char **namep ATTRIBUTE_UNUSED, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp ATTRIBUTE_UNUSED, + bfd_vma *valp ATTRIBUTE_UNUSED) +{ + if (sym->st_other & STO_M68HC12_FAR) + { + struct elf_link_hash_entry *h; + + h = (struct elf_link_hash_entry *) + bfd_link_hash_lookup (info->hash, "__far_trampoline", + FALSE, FALSE, FALSE); + if (h == NULL) + { + struct bfd_link_hash_entry* entry = NULL; + + _bfd_generic_link_add_one_symbol (info, abfd, + "__far_trampoline", + BSF_GLOBAL, + bfd_und_section_ptr, + (bfd_vma) 0, (const char*) NULL, + FALSE, FALSE, &entry); + } + + } + return TRUE; +} + +/* External entry points for sizing and building linker stubs. */ + +/* Set up various things so that we can make a list of input sections + for each output section included in the link. Returns -1 on error, + 0 when no stubs will be needed, and 1 on success. */ + +int +elf32_m68hc11_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) +{ + bfd *input_bfd; + unsigned int bfd_count; + int top_id, top_index; + asection *section; + asection **input_list, **list; + bfd_size_type amt; + asection *text_section; + struct m68hc11_elf_link_hash_table *htab; + + htab = m68hc11_elf_hash_table (info); + + if (htab->root.root.creator->flavour != bfd_target_elf_flavour) + return 0; + + /* Count the number of input BFDs and find the top input section id. + Also search for an existing ".tramp" section so that we know + where generated trampolines must go. Default to ".text" if we + can't find it. */ + htab->tramp_section = 0; + text_section = 0; + for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0; + input_bfd != NULL; + input_bfd = input_bfd->link_next) + { + bfd_count += 1; + for (section = input_bfd->sections; + section != NULL; + section = section->next) + { + const char* name = bfd_get_section_name (input_bfd, section); + + if (!strcmp (name, ".tramp")) + htab->tramp_section = section; + + if (!strcmp (name, ".text")) + text_section = section; + + if (top_id < section->id) + top_id = section->id; + } + } + htab->bfd_count = bfd_count; + if (htab->tramp_section == 0) + htab->tramp_section = text_section; + + /* We can't use output_bfd->section_count here to find the top output + section index as some sections may have been removed, and + _bfd_strip_section_from_output doesn't renumber the indices. */ + for (section = output_bfd->sections, top_index = 0; + section != NULL; + section = section->next) + { + if (top_index < section->index) + top_index = section->index; + } + + htab->top_index = top_index; + amt = sizeof (asection *) * (top_index + 1); + input_list = (asection **) bfd_malloc (amt); + htab->input_list = input_list; + if (input_list == NULL) + return -1; + + /* For sections we aren't interested in, mark their entries with a + value we can check later. */ + list = input_list + top_index; + do + *list = bfd_abs_section_ptr; + while (list-- != input_list); + + for (section = output_bfd->sections; + section != NULL; + section = section->next) + { + if ((section->flags & SEC_CODE) != 0) + input_list[section->index] = NULL; + } + + return 1; +} + +/* Determine and set the size of the stub section for a final link. + + The basic idea here is to examine all the relocations looking for + PC-relative calls to a target that is unreachable with a "bl" + instruction. */ + +bfd_boolean +elf32_m68hc11_size_stubs (bfd *output_bfd, bfd *stub_bfd, + struct bfd_link_info *info, + asection * (*add_stub_section) (const char*, asection*)) +{ + bfd *input_bfd; + asection *section; + Elf_Internal_Sym *local_syms, **all_local_syms; + unsigned int bfd_indx, bfd_count; + bfd_size_type amt; + asection *stub_sec; + + struct m68hc11_elf_link_hash_table *htab = m68hc11_elf_hash_table (info); + + /* Stash our params away. */ + htab->stub_bfd = stub_bfd; + htab->add_stub_section = add_stub_section; + + /* Count the number of input BFDs and find the top input section id. */ + for (input_bfd = info->input_bfds, bfd_count = 0; + input_bfd != NULL; + input_bfd = input_bfd->link_next) + { + bfd_count += 1; + } + + /* We want to read in symbol extension records only once. To do this + we need to read in the local symbols in parallel and save them for + later use; so hold pointers to the local symbols in an array. */ + amt = sizeof (Elf_Internal_Sym *) * bfd_count; + all_local_syms = (Elf_Internal_Sym **) bfd_zmalloc (amt); + if (all_local_syms == NULL) + return FALSE; + + /* Walk over all the input BFDs, swapping in local symbols. */ + for (input_bfd = info->input_bfds, bfd_indx = 0; + input_bfd != NULL; + input_bfd = input_bfd->link_next, bfd_indx++) + { + Elf_Internal_Shdr *symtab_hdr; + + /* We'll need the symbol table in a second. */ + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + if (symtab_hdr->sh_info == 0) + continue; + + /* We need an array of the local symbols attached to the input bfd. */ + local_syms = (Elf_Internal_Sym *) symtab_hdr->contents; + if (local_syms == NULL) + { + local_syms = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + /* Cache them for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) local_syms; + } + if (local_syms == NULL) + { + free (all_local_syms); + return FALSE; + } + + all_local_syms[bfd_indx] = local_syms; + } + + for (input_bfd = info->input_bfds, bfd_indx = 0; + input_bfd != NULL; + input_bfd = input_bfd->link_next, bfd_indx++) + { + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Sym *local_syms; + struct elf_link_hash_entry ** sym_hashes; + + sym_hashes = elf_sym_hashes (input_bfd); + + /* We'll need the symbol table in a second. */ + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + if (symtab_hdr->sh_info == 0) + continue; + + local_syms = all_local_syms[bfd_indx]; + + /* Walk over each section attached to the input bfd. */ + for (section = input_bfd->sections; + section != NULL; + section = section->next) + { + Elf_Internal_Rela *internal_relocs, *irelaend, *irela; + + /* If there aren't any relocs, then there's nothing more + to do. */ + if ((section->flags & SEC_RELOC) == 0 + || section->reloc_count == 0) + continue; + + /* If this section is a link-once section that will be + discarded, then don't create any stubs. */ + if (section->output_section == NULL + || section->output_section->owner != output_bfd) + continue; + + /* Get the relocs. */ + internal_relocs + = _bfd_elf_link_read_relocs (input_bfd, section, NULL, + (Elf_Internal_Rela *) NULL, + info->keep_memory); + if (internal_relocs == NULL) + goto error_ret_free_local; + + /* Now examine each relocation. */ + irela = internal_relocs; + irelaend = irela + section->reloc_count; + for (; irela < irelaend; irela++) + { + unsigned int r_type, r_indx; + struct elf32_m68hc11_stub_hash_entry *stub_entry; + asection *sym_sec; + bfd_vma sym_value; + struct elf_link_hash_entry *hash; + const char *stub_name; + Elf_Internal_Sym *sym; + + r_type = ELF32_R_TYPE (irela->r_info); + + /* Only look at 16-bit relocs. */ + if (r_type != (unsigned int) R_M68HC11_16) + continue; + + /* Now determine the call target, its name, value, + section. */ + r_indx = ELF32_R_SYM (irela->r_info); + if (r_indx < symtab_hdr->sh_info) + { + /* It's a local symbol. */ + Elf_Internal_Shdr *hdr; + bfd_boolean is_far; + + sym = local_syms + r_indx; + is_far = (sym && (sym->st_other & STO_M68HC12_FAR)); + if (!is_far) + continue; + + hdr = elf_elfsections (input_bfd)[sym->st_shndx]; + sym_sec = hdr->bfd_section; + stub_name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, + sym->st_name)); + sym_value = sym->st_value; + hash = NULL; + } + else + { + /* It's an external symbol. */ + int e_indx; + + e_indx = r_indx - symtab_hdr->sh_info; + hash = (struct elf_link_hash_entry *) + (sym_hashes[e_indx]); + + while (hash->root.type == bfd_link_hash_indirect + || hash->root.type == bfd_link_hash_warning) + hash = ((struct elf_link_hash_entry *) + hash->root.u.i.link); + + if (hash->root.type == bfd_link_hash_defined + || hash->root.type == bfd_link_hash_defweak) + { + if (!(hash->other & STO_M68HC12_FAR)) + continue; + } + else if (hash->root.type == bfd_link_hash_undefweak) + { + continue; + } + else if (hash->root.type == bfd_link_hash_undefined) + { + continue; + } + else + { + bfd_set_error (bfd_error_bad_value); + goto error_ret_free_internal; + } + sym_sec = hash->root.u.def.section; + sym_value = hash->root.u.def.value; + stub_name = hash->root.root.string; + } + + if (!stub_name) + goto error_ret_free_internal; + + stub_entry = m68hc12_stub_hash_lookup + (htab->stub_hash_table, + stub_name, + FALSE, FALSE); + if (stub_entry == NULL) + { + if (add_stub_section == 0) + continue; + + stub_entry = m68hc12_add_stub (stub_name, section, htab); + if (stub_entry == NULL) + { + error_ret_free_internal: + if (elf_section_data (section)->relocs == NULL) + free (internal_relocs); + goto error_ret_free_local; + } + } + + stub_entry->target_value = sym_value; + stub_entry->target_section = sym_sec; + } + + /* We're done with the internal relocs, free them. */ + if (elf_section_data (section)->relocs == NULL) + free (internal_relocs); + } + } + + if (add_stub_section) + { + /* OK, we've added some stubs. Find out the new size of the + stub sections. */ + for (stub_sec = htab->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + { + stub_sec->_raw_size = 0; + stub_sec->_cooked_size = 0; + } + + bfd_hash_traverse (htab->stub_hash_table, htab->size_one_stub, htab); + } + free (all_local_syms); + return TRUE; + + error_ret_free_local: + free (all_local_syms); + return FALSE; +} + +/* Export the trampoline addresses in the symbol table. */ +static bfd_boolean +m68hc11_elf_export_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) +{ + struct bfd_link_info *info; + struct m68hc11_elf_link_hash_table *htab; + struct elf32_m68hc11_stub_hash_entry *stub_entry; + char* name; + bfd_boolean result; + + info = (struct bfd_link_info *) in_arg; + htab = m68hc11_elf_hash_table (info); + + /* Massage our args to the form they really have. */ + stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry; + + /* Generate the trampoline according to HC11 or HC12. */ + result = (* htab->build_one_stub) (gen_entry, in_arg); + + /* Make a printable name that does not conflict with the real function. */ + name = alloca (strlen (stub_entry->root.string) + 16); + sprintf (name, "tramp.%s", stub_entry->root.string); + + /* Export the symbol for debugging/disassembling. */ + m68hc11_elf_set_symbol (htab->stub_bfd, info, name, + stub_entry->stub_offset, + stub_entry->stub_sec); + return result; +} + +/* Export a symbol or set its value and section. */ +static void +m68hc11_elf_set_symbol (bfd *abfd, struct bfd_link_info *info, + const char *name, bfd_vma value, asection *sec) +{ + struct elf_link_hash_entry *h; + + h = (struct elf_link_hash_entry *) + bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, FALSE); + if (h == NULL) + { + _bfd_generic_link_add_one_symbol (info, abfd, + name, + BSF_GLOBAL, + sec, + value, + (const char*) NULL, + TRUE, FALSE, NULL); + } + else + { + h->root.type = bfd_link_hash_defined; + h->root.u.def.value = value; + h->root.u.def.section = sec; + } +} + + +/* Build all the stubs associated with the current output file. The + stubs are kept in a hash table attached to the main linker hash + table. This function is called via m68hc12elf_finish in the + linker. */ + +bfd_boolean +elf32_m68hc11_build_stubs (bfd *abfd, struct bfd_link_info *info) +{ + asection *stub_sec; + struct bfd_hash_table *table; + struct m68hc11_elf_link_hash_table *htab; + struct m68hc11_scan_param param; + + m68hc11_elf_get_bank_parameters (info); + htab = m68hc11_elf_hash_table (info); + + for (stub_sec = htab->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + { + bfd_size_type size; + + /* Allocate memory to hold the linker stubs. */ + size = stub_sec->_raw_size; + stub_sec->contents = (unsigned char *) bfd_zalloc (htab->stub_bfd, size); + if (stub_sec->contents == NULL && size != 0) + return FALSE; + stub_sec->_raw_size = 0; + } + + /* Build the stubs as directed by the stub hash table. */ + table = htab->stub_hash_table; + bfd_hash_traverse (table, m68hc11_elf_export_one_stub, info); + + /* Scan the output sections to see if we use the memory banks. + If so, export the symbols that define how the memory banks + are mapped. This is used by gdb and the simulator to obtain + the information. It can be used by programs to burn the eprom + at the good addresses. */ + param.use_memory_banks = FALSE; + param.pinfo = &htab->pinfo; + bfd_map_over_sections (abfd, scan_sections_for_abi, ¶m); + if (param.use_memory_banks) + { + m68hc11_elf_set_symbol (abfd, info, BFD_M68HC11_BANK_START_NAME, + htab->pinfo.bank_physical, + bfd_abs_section_ptr); + m68hc11_elf_set_symbol (abfd, info, BFD_M68HC11_BANK_VIRTUAL_NAME, + htab->pinfo.bank_virtual, + bfd_abs_section_ptr); + m68hc11_elf_set_symbol (abfd, info, BFD_M68HC11_BANK_SIZE_NAME, + htab->pinfo.bank_size, + bfd_abs_section_ptr); + } + + return TRUE; +} + +void +m68hc11_elf_get_bank_parameters (struct bfd_link_info *info) +{ + unsigned i; + struct m68hc11_page_info *pinfo; + struct bfd_link_hash_entry *h; + + pinfo = &m68hc11_elf_hash_table (info)->pinfo; + if (pinfo->bank_param_initialized) + return; + + pinfo->bank_virtual = M68HC12_BANK_VIRT; + pinfo->bank_mask = M68HC12_BANK_MASK; + pinfo->bank_physical = M68HC12_BANK_BASE; + pinfo->bank_shift = M68HC12_BANK_SHIFT; + pinfo->bank_size = 1 << M68HC12_BANK_SHIFT; + + h = bfd_link_hash_lookup (info->hash, BFD_M68HC11_BANK_START_NAME, + FALSE, FALSE, TRUE); + if (h != (struct bfd_link_hash_entry*) NULL + && h->type == bfd_link_hash_defined) + pinfo->bank_physical = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + + h = bfd_link_hash_lookup (info->hash, BFD_M68HC11_BANK_VIRTUAL_NAME, + FALSE, FALSE, TRUE); + if (h != (struct bfd_link_hash_entry*) NULL + && h->type == bfd_link_hash_defined) + pinfo->bank_virtual = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + + h = bfd_link_hash_lookup (info->hash, BFD_M68HC11_BANK_SIZE_NAME, + FALSE, FALSE, TRUE); + if (h != (struct bfd_link_hash_entry*) NULL + && h->type == bfd_link_hash_defined) + pinfo->bank_size = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + + pinfo->bank_shift = 0; + for (i = pinfo->bank_size; i != 0; i >>= 1) + pinfo->bank_shift++; + pinfo->bank_shift--; + pinfo->bank_mask = (1 << pinfo->bank_shift) - 1; + pinfo->bank_physical_end = pinfo->bank_physical + pinfo->bank_size; + pinfo->bank_param_initialized = 1; + + h = bfd_link_hash_lookup (info->hash, "__far_trampoline", FALSE, + FALSE, TRUE); + if (h != (struct bfd_link_hash_entry*) NULL + && h->type == bfd_link_hash_defined) + pinfo->trampoline_addr = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); +} + +/* Return 1 if the address is in banked memory. + This can be applied to a virtual address and to a physical address. */ +int +m68hc11_addr_is_banked (struct m68hc11_page_info *pinfo, bfd_vma addr) +{ + if (addr >= pinfo->bank_virtual) + return 1; + + if (addr >= pinfo->bank_physical && addr <= pinfo->bank_physical_end) + return 1; + + return 0; +} + +/* Return the physical address seen by the processor, taking + into account banked memory. */ +bfd_vma +m68hc11_phys_addr (struct m68hc11_page_info *pinfo, bfd_vma addr) +{ + if (addr < pinfo->bank_virtual) + return addr; + + /* Map the address to the memory bank. */ + addr -= pinfo->bank_virtual; + addr &= pinfo->bank_mask; + addr += pinfo->bank_physical; + return addr; +} + +/* Return the page number corresponding to an address in banked memory. */ +bfd_vma +m68hc11_phys_page (struct m68hc11_page_info *pinfo, bfd_vma addr) +{ + if (addr < pinfo->bank_virtual) + return 0; + + /* Map the address to the memory bank. */ + addr -= pinfo->bank_virtual; + addr >>= pinfo->bank_shift; + addr &= 0x0ff; + return addr; +} + +/* This function is used for relocs which are only used for relaxing, + which the linker should otherwise ignore. */ + +bfd_reloc_status_type +m68hc11_elf_ignore_reloc (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry, + asymbol *symbol ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + if (output_bfd != NULL) + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; +} + +bfd_reloc_status_type +m68hc11_elf_special_reloc (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry, + asymbol *symbol, + void *data ATTRIBUTE_UNUSED, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc_entry->howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (output_bfd != NULL) + return bfd_reloc_continue; + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + abort(); +} + +asection * +elf32_m68hc11_gc_mark_hook (asection *sec, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Rela *rel, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +bfd_boolean +elf32_m68hc11_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED) +{ + /* We don't use got and plt entries for 68hc11/68hc12. */ + return TRUE; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +bfd_boolean +elf32_m68hc11_check_relocs (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs) +{ + Elf_Internal_Shdr * symtab_hdr; + struct elf_link_hash_entry ** sym_hashes; + struct elf_link_hash_entry ** sym_hashes_end; + const Elf_Internal_Rela * rel; + const Elf_Internal_Rela * rel_end; + + if (info->relocatable) + return TRUE; + + symtab_hdr = & elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + rel_end = relocs + sec->reloc_count; + + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry * h; + unsigned long r_symndx; + + r_symndx = ELF32_R_SYM (rel->r_info); + + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes [r_symndx - symtab_hdr->sh_info]; + + switch (ELF32_R_TYPE (rel->r_info)) + { + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_M68HC11_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_M68HC11_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + } + } + + return TRUE; +} + +static bfd_boolean +m68hc11_get_relocation_value (bfd *input_bfd, struct bfd_link_info *info, + asection *input_section, + asection **local_sections, + Elf_Internal_Sym *local_syms, + Elf_Internal_Rela *rel, + const char **name, + bfd_vma *relocation, bfd_boolean *is_far) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + unsigned long r_symndx; + asection *sec; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + const char* stub_name = 0; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + + r_symndx = ELF32_R_SYM (rel->r_info); + + /* This is a final link. */ + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + *relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + *is_far = (sym && (sym->st_other & STO_M68HC12_FAR)); + if (*is_far) + stub_name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, + sym->st_name)); + } + else + { + bfd_boolean unresolved_reloc, warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, *relocation, unresolved_reloc, warned); + + *is_far = (h && (h->other & STO_M68HC12_FAR)); + stub_name = h->root.root.string; + } + + if (h != NULL) + *name = h->root.root.string; + else + { + *name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (*name == NULL || **name == '\0') + *name = bfd_section_name (input_bfd, sec); + } + + if (*is_far && ELF32_R_TYPE (rel->r_info) == R_M68HC11_16) + { + struct elf32_m68hc11_stub_hash_entry* stub; + struct m68hc11_elf_link_hash_table *htab; + + htab = m68hc11_elf_hash_table (info); + stub = m68hc12_stub_hash_lookup (htab->stub_hash_table, + *name, FALSE, FALSE); + if (stub) + { + *relocation = stub->stub_offset + + stub->stub_sec->output_section->vma + + stub->stub_sec->output_offset; + *is_far = FALSE; + } + } + return TRUE; +} + +/* Relocate a 68hc11/68hc12 ELF section. */ +bfd_boolean +elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info, + bfd *input_bfd, asection *input_section, + bfd_byte *contents, Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + const char *name; + struct m68hc11_page_info *pinfo; + const struct elf_backend_data * const ebd = get_elf_backend_data (input_bfd); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + + /* Get memory bank parameters. */ + m68hc11_elf_get_bank_parameters (info); + pinfo = &m68hc11_elf_hash_table (info)->pinfo; + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + arelent arel; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + bfd_vma relocation; + bfd_reloc_status_type r = bfd_reloc_undefined; + bfd_vma phys_page; + bfd_vma phys_addr; + bfd_vma insn_addr; + bfd_vma insn_page; + bfd_boolean is_far; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + + if (r_type == R_M68HC11_GNU_VTENTRY + || r_type == R_M68HC11_GNU_VTINHERIT ) + continue; + + if (info->relocatable) + { + /* This is a relocatable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + sec = local_sections[r_symndx]; + rel->r_addend += sec->output_offset + sym->st_value; + } + } + + continue; + } + (*ebd->elf_info_to_howto_rel) (input_bfd, &arel, rel); + howto = arel.howto; + + m68hc11_get_relocation_value (input_bfd, info, input_section, + local_sections, local_syms, + rel, &name, &relocation, &is_far); + + /* Do the memory bank mapping. */ + phys_addr = m68hc11_phys_addr (pinfo, relocation + rel->r_addend); + phys_page = m68hc11_phys_page (pinfo, relocation + rel->r_addend); + switch (r_type) + { + case R_M68HC11_24: + /* Reloc used by 68HC12 call instruction. */ + bfd_put_16 (input_bfd, phys_addr, + (bfd_byte*) contents + rel->r_offset); + bfd_put_8 (input_bfd, phys_page, + (bfd_byte*) contents + rel->r_offset + 2); + r = bfd_reloc_ok; + r_type = R_M68HC11_NONE; + break; + + case R_M68HC11_NONE: + r = bfd_reloc_ok; + break; + + case R_M68HC11_LO16: + /* Reloc generated by %addr(expr) gas to obtain the + address as mapped in the memory bank window. */ + relocation = phys_addr; + break; + + case R_M68HC11_PAGE: + /* Reloc generated by %page(expr) gas to obtain the + page number associated with the address. */ + relocation = phys_page; + break; + + case R_M68HC11_16: + /* Get virtual address of instruction having the relocation. */ + if (is_far) + { + const char* msg; + char* buf; + msg = _("Reference to the far symbol `%s' using a wrong " + "relocation may result in incorrect execution"); + buf = alloca (strlen (msg) + strlen (name) + 10); + sprintf (buf, msg, name); + + (* info->callbacks->warning) + (info, buf, name, input_bfd, NULL, rel->r_offset); + } + + /* Get virtual address of instruction having the relocation. */ + insn_addr = input_section->output_section->vma + + input_section->output_offset + + rel->r_offset; + + insn_page = m68hc11_phys_page (pinfo, insn_addr); + + if (m68hc11_addr_is_banked (pinfo, relocation + rel->r_addend) + && m68hc11_addr_is_banked (pinfo, insn_addr) + && phys_page != insn_page) + { + const char* msg; + char* buf; + + msg = _("banked address [%lx:%04lx] (%lx) is not in the same bank " + "as current banked address [%lx:%04lx] (%lx)"); + + buf = alloca (strlen (msg) + 128); + sprintf (buf, msg, phys_page, phys_addr, + (long) (relocation + rel->r_addend), + insn_page, m68hc11_phys_addr (pinfo, insn_addr), + (long) (insn_addr)); + if (!((*info->callbacks->warning) + (info, buf, name, input_bfd, input_section, + rel->r_offset))) + return FALSE; + break; + } + if (phys_page != 0 && insn_page == 0) + { + const char* msg; + char* buf; + + msg = _("reference to a banked address [%lx:%04lx] in the " + "normal address space at %04lx"); + + buf = alloca (strlen (msg) + 128); + sprintf (buf, msg, phys_page, phys_addr, insn_addr); + if (!((*info->callbacks->warning) + (info, buf, name, input_bfd, input_section, + insn_addr))) + return FALSE; + + relocation = phys_addr; + break; + } + + /* If this is a banked address use the phys_addr so that + we stay in the banked window. */ + if (m68hc11_addr_is_banked (pinfo, relocation + rel->r_addend)) + relocation = phys_addr; + break; + } + if (r_type != R_M68HC11_NONE) + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + + if (r != bfd_reloc_ok) + { + const char * msg = (const char *) 0; + + switch (r) + { + case bfd_reloc_overflow: + if (!((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return FALSE; + break; + + case bfd_reloc_undefined: + if (!((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, + rel->r_offset, TRUE))) + return FALSE; + break; + + case bfd_reloc_outofrange: + msg = _ ("internal error: out of range error"); + goto common_error; + + case bfd_reloc_notsupported: + msg = _ ("internal error: unsupported relocation error"); + goto common_error; + + case bfd_reloc_dangerous: + msg = _ ("internal error: dangerous error"); + goto common_error; + + default: + msg = _ ("internal error: unknown error"); + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, msg, name, input_bfd, input_section, + rel->r_offset))) + return FALSE; + break; + } + } + } + + return TRUE; +} + + + +/* Set and control ELF flags in ELF header. */ + +bfd_boolean +_bfd_m68hc11_elf_set_private_flags (bfd *abfd, flagword flags) +{ + BFD_ASSERT (!elf_flags_init (abfd) + || elf_elfheader (abfd)->e_flags == flags); + + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + return TRUE; +} + +/* Merge backend specific data from an object file to the output + object file when linking. */ + +bfd_boolean +_bfd_m68hc11_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) +{ + flagword old_flags; + flagword new_flags; + bfd_boolean ok = TRUE; + + /* Check if we have the same endianess */ + if (!_bfd_generic_verify_endian_match (ibfd, obfd)) + return FALSE; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + new_flags = elf_elfheader (ibfd)->e_flags; + elf_elfheader (obfd)->e_flags |= new_flags & EF_M68HC11_ABI; + old_flags = elf_elfheader (obfd)->e_flags; + + if (! elf_flags_init (obfd)) + { + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = new_flags; + elf_elfheader (obfd)->e_ident[EI_CLASS] + = elf_elfheader (ibfd)->e_ident[EI_CLASS]; + + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) + && bfd_get_arch_info (obfd)->the_default) + { + if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), + bfd_get_mach (ibfd))) + return FALSE; + } + + return TRUE; + } + + /* Check ABI compatibility. */ + if ((new_flags & E_M68HC11_I32) != (old_flags & E_M68HC11_I32)) + { + (*_bfd_error_handler) + (_("%s: linking files compiled for 16-bit integers (-mshort) " + "and others for 32-bit integers"), + bfd_archive_filename (ibfd)); + ok = FALSE; + } + if ((new_flags & E_M68HC11_F64) != (old_flags & E_M68HC11_F64)) + { + (*_bfd_error_handler) + (_("%s: linking files compiled for 32-bit double (-fshort-double) " + "and others for 64-bit double"), + bfd_archive_filename (ibfd)); + ok = FALSE; + } + + /* Processor compatibility. */ + if (!EF_M68HC11_CAN_MERGE_MACH (new_flags, old_flags)) + { + (*_bfd_error_handler) + (_("%s: linking files compiled for HCS12 with " + "others compiled for HC12"), + bfd_archive_filename (ibfd)); + ok = FALSE; + } + new_flags = ((new_flags & ~EF_M68HC11_MACH_MASK) + | (EF_M68HC11_MERGE_MACH (new_flags, old_flags))); + + elf_elfheader (obfd)->e_flags = new_flags; + + new_flags &= ~(EF_M68HC11_ABI | EF_M68HC11_MACH_MASK); + old_flags &= ~(EF_M68HC11_ABI | EF_M68HC11_MACH_MASK); + + /* Warn about any other mismatches */ + if (new_flags != old_flags) + { + (*_bfd_error_handler) + (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), + bfd_archive_filename (ibfd), (unsigned long) new_flags, + (unsigned long) old_flags); + ok = FALSE; + } + + if (! ok) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + return TRUE; +} + +bfd_boolean +_bfd_m68hc11_elf_print_private_bfd_data (bfd *abfd, void *ptr) +{ + FILE *file = (FILE *) ptr; + + BFD_ASSERT (abfd != NULL && ptr != NULL); + + /* Print normal ELF private data. */ + _bfd_elf_print_private_bfd_data (abfd, ptr); + + /* xgettext:c-format */ + fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags); + + if (elf_elfheader (abfd)->e_flags & E_M68HC11_I32) + fprintf (file, _("[abi=32-bit int, ")); + else + fprintf (file, _("[abi=16-bit int, ")); + + if (elf_elfheader (abfd)->e_flags & E_M68HC11_F64) + fprintf (file, _("64-bit double, ")); + else + fprintf (file, _("32-bit double, ")); + + if (strcmp (bfd_get_target (abfd), "elf32-m68hc11") == 0) + fprintf (file, _("cpu=HC11]")); + else if (elf_elfheader (abfd)->e_flags & EF_M68HCS12_MACH) + fprintf (file, _("cpu=HCS12]")); + else + fprintf (file, _("cpu=HC12]")); + + if (elf_elfheader (abfd)->e_flags & E_M68HC12_BANKS) + fprintf (file, _(" [memory=bank-model]")); + else + fprintf (file, _(" [memory=flat]")); + + fputc ('\n', file); + + return TRUE; +} + +static void scan_sections_for_abi (bfd *abfd ATTRIBUTE_UNUSED, + asection *asect, void *arg) +{ + struct m68hc11_scan_param* p = (struct m68hc11_scan_param*) arg; + + if (asect->vma >= p->pinfo->bank_virtual) + p->use_memory_banks = TRUE; +} + +/* Tweak the OSABI field of the elf header. */ + +void +elf32_m68hc11_post_process_headers (bfd *abfd, struct bfd_link_info *link_info) +{ + struct m68hc11_scan_param param; + + if (link_info == 0) + return; + + m68hc11_elf_get_bank_parameters (link_info); + + param.use_memory_banks = FALSE; + param.pinfo = &m68hc11_elf_hash_table (link_info)->pinfo; + bfd_map_over_sections (abfd, scan_sections_for_abi, ¶m); + if (param.use_memory_banks) + { + Elf_Internal_Ehdr * i_ehdrp; + + i_ehdrp = elf_elfheader (abfd); + i_ehdrp->e_flags |= E_M68HC12_BANKS; + } +} + diff --git a/bfd/elf32-m68hc1x.h b/bfd/elf32-m68hc1x.h new file mode 100644 index 0000000000000..f6b2001a33446 --- /dev/null +++ b/bfd/elf32-m68hc1x.h @@ -0,0 +1,196 @@ +/* Motorola 68HC11/68HC12-specific support for 32-bit ELF + Copyright 2003, 2004 Free Software Foundation, Inc. + Contributed by Stephane Carrez (stcarrez@nerim.fr) + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#ifndef _ELF32_M68HC1X_H +#define _ELF32_M68HC1X_H + +#include "elf-bfd.h" +#include "bfdlink.h" +#include "elf/m68hc11.h" + +/* Name of symbols exported by HC11/HC12 linker when there is a memory + bank window. */ +#define BFD_M68HC11_BANK_START_NAME "__bank_start" +#define BFD_M68HC11_BANK_SIZE_NAME "__bank_size" +#define BFD_M68HC11_BANK_VIRTUAL_NAME "__bank_virtual" + +/* Set and control ELF flags in ELF header. */ +extern bfd_boolean _bfd_m68hc11_elf_merge_private_bfd_data (bfd*,bfd*); +extern bfd_boolean _bfd_m68hc11_elf_set_private_flags (bfd*,flagword); +extern bfd_boolean _bfd_m68hc11_elf_print_private_bfd_data (bfd*, void*); + +/* This hash entry is used to record a trampoline that must be generated + to call a far function using a normal calling convention ('jsr'). + The trampoline is used when a pointer to a far function is used. + It takes care of installing the proper memory bank as well as creating + the 'call/rtc' calling convention. */ +struct elf32_m68hc11_stub_hash_entry { + + /* Base hash table entry structure. */ + struct bfd_hash_entry root; + + /* The stub section. */ + asection *stub_sec; + + /* Offset within stub_sec of the beginning of this stub. */ + bfd_vma stub_offset; + + /* Given the symbol's value and its section we can determine its final + value when building the stubs (so the stub knows where to jump. */ + bfd_vma target_value; + asection *target_section; +}; + +/* Placeholder for the parameters to compute memory page and physical address. + The following formulas are used: + + sym > bank_virtual => + %addr(sym) = (((sym - bank_virtual) & bank_mask) + bank_physical + %page(sym) = (((sym - bank_virtual) >> bank_shift) % 256 + + sym < bank_virtual => + %addr(sym) = sym + %page(sym) = 0 + + + These parameters are obtained from the symbol table by looking + at the following: + + __bank_start Symbol marking the start of memory bank window + (bank_physical) + __bank_virtual Logical address of symbols for which the transformation + must be computed + __bank_page_size Size in bytes of page size (this is *NOT* the memory + bank window size and the window size is always + less or equal to the page size) + + For 68HC12, the window is at 0x8000 and the page size is 16K (full window). + For 68HC11 this is board specific (implemented by external hardware). + +*/ +struct m68hc11_page_info +{ + bfd_vma bank_virtual; + bfd_vma bank_physical; + bfd_vma bank_physical_end; + bfd_vma bank_mask; + bfd_vma bank_size; + int bank_shift; + int bank_param_initialized; + bfd_vma trampoline_addr; +}; + +struct m68hc11_elf_link_hash_table +{ + struct elf_link_hash_table root; + struct m68hc11_page_info pinfo; + + /* The stub hash table. */ + struct bfd_hash_table* stub_hash_table; + + /* Linker stub bfd. */ + bfd *stub_bfd; + + asection* stub_section; + asection* tramp_section; + + /* Linker call-backs. */ + asection * (*add_stub_section) PARAMS ((const char *, asection *)); + + /* Assorted information used by elf32_hppa_size_stubs. */ + unsigned int bfd_count; + int top_index; + asection **input_list; + + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; + + bfd_boolean (* size_one_stub) PARAMS((struct bfd_hash_entry*, void*)); + bfd_boolean (* build_one_stub) PARAMS((struct bfd_hash_entry*, void*)); +}; + +/* Get the Sparc64 ELF linker hash table from a link_info structure. */ + +#define m68hc11_elf_hash_table(p) \ + ((struct m68hc11_elf_link_hash_table *) ((p)->hash)) + +/* Create a 68HC11/68HC12 ELF linker hash table. */ + +extern struct m68hc11_elf_link_hash_table* m68hc11_elf_hash_table_create + (bfd*); +extern void m68hc11_elf_bfd_link_hash_table_free (struct bfd_link_hash_table*); + +extern void m68hc11_elf_get_bank_parameters (struct bfd_link_info*); + +/* Return 1 if the address is in banked memory. + This can be applied to a virtual address and to a physical address. */ +extern int m68hc11_addr_is_banked (struct m68hc11_page_info*, bfd_vma); + +/* Return the physical address seen by the processor, taking + into account banked memory. */ +extern bfd_vma m68hc11_phys_addr (struct m68hc11_page_info*, bfd_vma); + +/* Return the page number corresponding to an address in banked memory. */ +extern bfd_vma m68hc11_phys_page (struct m68hc11_page_info*, bfd_vma); + +bfd_reloc_status_type m68hc11_elf_ignore_reloc + (bfd *abfd, arelent *reloc_entry, + asymbol *symbol, void *data, asection *input_section, + bfd *output_bfd, char **error_message); +bfd_reloc_status_type m68hc11_elf_special_reloc + (bfd *abfd, arelent *reloc_entry, + asymbol *symbol, void *data, asection *input_section, + bfd *output_bfd, char **error_message); + +/* GC mark and sweep. */ +asection *elf32_m68hc11_gc_mark_hook + (asection *sec, struct bfd_link_info *info, + Elf_Internal_Rela *rel, struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym); +bfd_boolean elf32_m68hc11_gc_sweep_hook + (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs); +bfd_boolean elf32_m68hc11_check_relocs + (bfd * abfd, struct bfd_link_info * info, + asection * sec, const Elf_Internal_Rela * relocs); +bfd_boolean elf32_m68hc11_relocate_section + (bfd *output_bfd, struct bfd_link_info *info, + bfd *input_bfd, asection *input_section, + bfd_byte *contents, Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, asection **local_sections); + +bfd_boolean elf32_m68hc11_add_symbol_hook + (bfd *abfd, struct bfd_link_info *info, + Elf_Internal_Sym *sym, const char **namep, + flagword *flagsp, asection **secp, + bfd_vma *valp); + +/* Tweak the OSABI field of the elf header. */ + +extern void elf32_m68hc11_post_process_headers (bfd*, struct bfd_link_info*); + +int elf32_m68hc11_setup_section_lists (bfd *, struct bfd_link_info *); + +bfd_boolean elf32_m68hc11_size_stubs + (bfd *, bfd *, struct bfd_link_info *, + asection * (*) (const char *, asection *)); + +bfd_boolean elf32_m68hc11_build_stubs (bfd* abfd, struct bfd_link_info *); +#endif diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c new file mode 100644 index 0000000000000..39832be83cf1a --- /dev/null +++ b/bfd/elf32-m68k.c @@ -0,0 +1,2264 @@ +/* Motorola 68k series support for 32-bit ELF + Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2004 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/m68k.h" + +static reloc_howto_type *reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void rtype_to_howto + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static struct bfd_hash_entry *elf_m68k_link_hash_newfunc + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +static struct bfd_link_hash_table *elf_m68k_link_hash_table_create + PARAMS ((bfd *)); +static bfd_boolean elf_m68k_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static asection *elf_m68k_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static bfd_boolean elf_m68k_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static bfd_boolean elf_m68k_adjust_dynamic_symbol + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); +static bfd_boolean elf_m68k_size_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean elf_m68k_discard_copies + PARAMS ((struct elf_link_hash_entry *, PTR)); +static bfd_boolean elf_m68k_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static bfd_boolean elf_m68k_finish_dynamic_symbol + PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *)); +static bfd_boolean elf_m68k_finish_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + +static bfd_boolean elf32_m68k_set_private_flags + PARAMS ((bfd *, flagword)); +static bfd_boolean elf32_m68k_merge_private_bfd_data + PARAMS ((bfd *, bfd *)); +static bfd_boolean elf32_m68k_print_private_bfd_data + PARAMS ((bfd *, PTR)); +static enum elf_reloc_type_class elf32_m68k_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); + +static reloc_howto_type howto_table[] = { + HOWTO(R_68K_NONE, 0, 0, 0, FALSE,0, complain_overflow_dont, bfd_elf_generic_reloc, "R_68K_NONE", FALSE, 0, 0x00000000,FALSE), + HOWTO(R_68K_32, 0, 2,32, FALSE,0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_32", FALSE, 0, 0xffffffff,FALSE), + HOWTO(R_68K_16, 0, 1,16, FALSE,0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_16", FALSE, 0, 0x0000ffff,FALSE), + HOWTO(R_68K_8, 0, 0, 8, FALSE,0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_8", FALSE, 0, 0x000000ff,FALSE), + HOWTO(R_68K_PC32, 0, 2,32, TRUE, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_PC32", FALSE, 0, 0xffffffff,TRUE), + HOWTO(R_68K_PC16, 0, 1,16, TRUE, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_68K_PC16", FALSE, 0, 0x0000ffff,TRUE), + HOWTO(R_68K_PC8, 0, 0, 8, TRUE, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_68K_PC8", FALSE, 0, 0x000000ff,TRUE), + HOWTO(R_68K_GOT32, 0, 2,32, TRUE, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_GOT32", FALSE, 0, 0xffffffff,TRUE), + HOWTO(R_68K_GOT16, 0, 1,16, TRUE, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_68K_GOT16", FALSE, 0, 0x0000ffff,TRUE), + HOWTO(R_68K_GOT8, 0, 0, 8, TRUE, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_68K_GOT8", FALSE, 0, 0x000000ff,TRUE), + HOWTO(R_68K_GOT32O, 0, 2,32, FALSE,0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_GOT32O", FALSE, 0, 0xffffffff,FALSE), + HOWTO(R_68K_GOT16O, 0, 1,16, FALSE,0, complain_overflow_signed, bfd_elf_generic_reloc, "R_68K_GOT16O", FALSE, 0, 0x0000ffff,FALSE), + HOWTO(R_68K_GOT8O, 0, 0, 8, FALSE,0, complain_overflow_signed, bfd_elf_generic_reloc, "R_68K_GOT8O", FALSE, 0, 0x000000ff,FALSE), + HOWTO(R_68K_PLT32, 0, 2,32, TRUE, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_PLT32", FALSE, 0, 0xffffffff,TRUE), + HOWTO(R_68K_PLT16, 0, 1,16, TRUE, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_68K_PLT16", FALSE, 0, 0x0000ffff,TRUE), + HOWTO(R_68K_PLT8, 0, 0, 8, TRUE, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_68K_PLT8", FALSE, 0, 0x000000ff,TRUE), + HOWTO(R_68K_PLT32O, 0, 2,32, FALSE,0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_68K_PLT32O", FALSE, 0, 0xffffffff,FALSE), + HOWTO(R_68K_PLT16O, 0, 1,16, FALSE,0, complain_overflow_signed, bfd_elf_generic_reloc, "R_68K_PLT16O", FALSE, 0, 0x0000ffff,FALSE), + HOWTO(R_68K_PLT8O, 0, 0, 8, FALSE,0, complain_overflow_signed, bfd_elf_generic_reloc, "R_68K_PLT8O", FALSE, 0, 0x000000ff,FALSE), + HOWTO(R_68K_COPY, 0, 0, 0, FALSE,0, complain_overflow_dont, bfd_elf_generic_reloc, "R_68K_COPY", FALSE, 0, 0xffffffff,FALSE), + HOWTO(R_68K_GLOB_DAT, 0, 2,32, FALSE,0, complain_overflow_dont, bfd_elf_generic_reloc, "R_68K_GLOB_DAT", FALSE, 0, 0xffffffff,FALSE), + HOWTO(R_68K_JMP_SLOT, 0, 2,32, FALSE,0, complain_overflow_dont, bfd_elf_generic_reloc, "R_68K_JMP_SLOT", FALSE, 0, 0xffffffff,FALSE), + HOWTO(R_68K_RELATIVE, 0, 2,32, FALSE,0, complain_overflow_dont, bfd_elf_generic_reloc, "R_68K_RELATIVE", FALSE, 0, 0xffffffff,FALSE), + /* GNU extension to record C++ vtable hierarchy. */ + HOWTO (R_68K_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_68K_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), + /* GNU extension to record C++ vtable member usage. */ + HOWTO (R_68K_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_68K_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), +}; + +static void +rtype_to_howto (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_68K_max); + cache_ptr->howto = &howto_table[ELF32_R_TYPE(dst->r_info)]; +} + +#define elf_info_to_howto rtype_to_howto + +static const struct +{ + bfd_reloc_code_real_type bfd_val; + int elf_val; +} reloc_map[] = { + { BFD_RELOC_NONE, R_68K_NONE }, + { BFD_RELOC_32, R_68K_32 }, + { BFD_RELOC_16, R_68K_16 }, + { BFD_RELOC_8, R_68K_8 }, + { BFD_RELOC_32_PCREL, R_68K_PC32 }, + { BFD_RELOC_16_PCREL, R_68K_PC16 }, + { BFD_RELOC_8_PCREL, R_68K_PC8 }, + { BFD_RELOC_32_GOT_PCREL, R_68K_GOT32 }, + { BFD_RELOC_16_GOT_PCREL, R_68K_GOT16 }, + { BFD_RELOC_8_GOT_PCREL, R_68K_GOT8 }, + { BFD_RELOC_32_GOTOFF, R_68K_GOT32O }, + { BFD_RELOC_16_GOTOFF, R_68K_GOT16O }, + { BFD_RELOC_8_GOTOFF, R_68K_GOT8O }, + { BFD_RELOC_32_PLT_PCREL, R_68K_PLT32 }, + { BFD_RELOC_16_PLT_PCREL, R_68K_PLT16 }, + { BFD_RELOC_8_PLT_PCREL, R_68K_PLT8 }, + { BFD_RELOC_32_PLTOFF, R_68K_PLT32O }, + { BFD_RELOC_16_PLTOFF, R_68K_PLT16O }, + { BFD_RELOC_8_PLTOFF, R_68K_PLT8O }, + { BFD_RELOC_NONE, R_68K_COPY }, + { BFD_RELOC_68K_GLOB_DAT, R_68K_GLOB_DAT }, + { BFD_RELOC_68K_JMP_SLOT, R_68K_JMP_SLOT }, + { BFD_RELOC_68K_RELATIVE, R_68K_RELATIVE }, + { BFD_RELOC_CTOR, R_68K_32 }, + { BFD_RELOC_VTABLE_INHERIT, R_68K_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_68K_GNU_VTENTRY }, +}; + +static reloc_howto_type * +reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + for (i = 0; i < sizeof (reloc_map) / sizeof (reloc_map[0]); i++) + { + if (reloc_map[i].bfd_val == code) + return &howto_table[reloc_map[i].elf_val]; + } + return 0; +} + +#define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup +#define ELF_ARCH bfd_arch_m68k + +/* Functions for the m68k ELF linker. */ + +/* The name of the dynamic interpreter. This is put in the .interp + section. */ + +#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1" + +/* The size in bytes of an entry in the procedure linkage table. */ + +#define PLT_ENTRY_SIZE 20 + +/* The first entry in a procedure linkage table looks like this. See + the SVR4 ABI m68k supplement to see how this works. */ + +static const bfd_byte elf_m68k_plt0_entry[PLT_ENTRY_SIZE] = +{ + 0x2f, 0x3b, 0x01, 0x70, /* move.l (%pc,addr),-(%sp) */ + 0, 0, 0, 0, /* replaced with offset to .got + 4. */ + 0x4e, 0xfb, 0x01, 0x71, /* jmp ([%pc,addr]) */ + 0, 0, 0, 0, /* replaced with offset to .got + 8. */ + 0, 0, 0, 0 /* pad out to 20 bytes. */ +}; + +/* Subsequent entries in a procedure linkage table look like this. */ + +static const bfd_byte elf_m68k_plt_entry[PLT_ENTRY_SIZE] = +{ + 0x4e, 0xfb, 0x01, 0x71, /* jmp ([%pc,symbol@GOTPC]) */ + 0, 0, 0, 0, /* replaced with offset to symbol's .got entry. */ + 0x2f, 0x3c, /* move.l #offset,-(%sp) */ + 0, 0, 0, 0, /* replaced with offset into relocation table. */ + 0x60, 0xff, /* bra.l .plt */ + 0, 0, 0, 0 /* replaced with offset to start of .plt. */ +}; + +#define CPU32_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_CPU32) + +#define PLT_CPU32_ENTRY_SIZE 24 +/* Procedure linkage table entries for the cpu32 */ +static const bfd_byte elf_cpu32_plt0_entry[PLT_CPU32_ENTRY_SIZE] = +{ + 0x2f, 0x3b, 0x01, 0x70, /* move.l (%pc,addr),-(%sp) */ + 0, 0, 0, 0, /* replaced with offset to .got + 4. */ + 0x22, 0x7b, 0x01, 0x70, /* moveal %pc@(0xc), %a1 */ + 0, 0, 0, 0, /* replace with offset to .got +8. */ + 0x4e, 0xd1, /* jmp %a1@ */ + 0, 0, 0, 0, /* pad out to 24 bytes. */ + 0, 0 +}; + +static const bfd_byte elf_cpu32_plt_entry[PLT_CPU32_ENTRY_SIZE] = +{ + 0x22, 0x7b, 0x01, 0x70, /* moveal %pc@(0xc), %a1 */ + 0, 0, 0, 0, /* replaced with offset to symbol's .got entry. */ + 0x4e, 0xd1, /* jmp %a1@ */ + 0x2f, 0x3c, /* move.l #offset,-(%sp) */ + 0, 0, 0, 0, /* replaced with offset into relocation table. */ + 0x60, 0xff, /* bra.l .plt */ + 0, 0, 0, 0, /* replaced with offset to start of .plt. */ + 0, 0 +}; + +/* The m68k linker needs to keep track of the number of relocs that it + decides to copy in check_relocs for each symbol. This is so that it + can discard PC relative relocs if it doesn't need them when linking + with -Bsymbolic. We store the information in a field extending the + regular ELF linker hash table. */ + +/* This structure keeps track of the number of PC relative relocs we have + copied for a given symbol. */ + +struct elf_m68k_pcrel_relocs_copied +{ + /* Next section. */ + struct elf_m68k_pcrel_relocs_copied *next; + /* A section in dynobj. */ + asection *section; + /* Number of relocs copied in this section. */ + bfd_size_type count; +}; + +/* m68k ELF linker hash entry. */ + +struct elf_m68k_link_hash_entry +{ + struct elf_link_hash_entry root; + + /* Number of PC relative relocs copied for this symbol. */ + struct elf_m68k_pcrel_relocs_copied *pcrel_relocs_copied; +}; + +#define elf_m68k_hash_entry(ent) ((struct elf_m68k_link_hash_entry *) (ent)) + +/* m68k ELF linker hash table. */ + +struct elf_m68k_link_hash_table +{ + struct elf_link_hash_table root; + + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; +}; + +/* Get the m68k ELF linker hash table from a link_info structure. */ + +#define elf_m68k_hash_table(p) \ + ((struct elf_m68k_link_hash_table *) (p)->hash) + +/* Create an entry in an m68k ELF linker hash table. */ + +static struct bfd_hash_entry * +elf_m68k_link_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct bfd_hash_entry *ret = entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == NULL) + ret = bfd_hash_allocate (table, + sizeof (struct elf_m68k_link_hash_entry)); + if (ret == NULL) + return ret; + + /* Call the allocation method of the superclass. */ + ret = _bfd_elf_link_hash_newfunc (ret, table, string); + if (ret != NULL) + elf_m68k_hash_entry (ret)->pcrel_relocs_copied = NULL; + + return ret; +} + +/* Create an m68k ELF linker hash table. */ + +static struct bfd_link_hash_table * +elf_m68k_link_hash_table_create (abfd) + bfd *abfd; +{ + struct elf_m68k_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_m68k_link_hash_table); + + ret = (struct elf_m68k_link_hash_table *) bfd_malloc (amt); + if (ret == (struct elf_m68k_link_hash_table *) NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + elf_m68k_link_hash_newfunc)) + { + free (ret); + return NULL; + } + + ret->sym_sec.abfd = NULL; + + return &ret->root.root; +} + +/* Keep m68k-specific flags in the ELF header. */ +static bfd_boolean +elf32_m68k_set_private_flags (abfd, flags) + bfd *abfd; + flagword flags; +{ + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + return TRUE; +} + +/* Merge backend specific data from an object file to the output + object file when linking. */ +static bfd_boolean +elf32_m68k_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + flagword out_flags; + flagword in_flags; + + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + in_flags = elf_elfheader (ibfd)->e_flags; + out_flags = elf_elfheader (obfd)->e_flags; + + if (!elf_flags_init (obfd)) + { + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = in_flags; + } + + return TRUE; +} + +/* Display the flags field. */ +static bfd_boolean +elf32_m68k_print_private_bfd_data (abfd, ptr) + bfd *abfd; + PTR ptr; +{ + FILE *file = (FILE *) ptr; + + BFD_ASSERT (abfd != NULL && ptr != NULL); + + /* Print normal ELF private data. */ + _bfd_elf_print_private_bfd_data (abfd, ptr); + + /* Ignore init flag - it may not be set, despite the flags field containing valid data. */ + + /* xgettext:c-format */ + fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags); + + if (elf_elfheader (abfd)->e_flags & EF_CPU32) + fprintf (file, _(" [cpu32]")); + + if (elf_elfheader (abfd)->e_flags & EF_M68000) + fprintf (file, _(" [m68000]")); + + fputc ('\n', file); + + return TRUE; +} +/* Look through the relocs for a section during the first phase, and + allocate space in the global offset table or procedure linkage + table. */ + +static bfd_boolean +elf_m68k_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + bfd *dynobj; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_signed_vma *local_got_refcounts; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + asection *sgot; + asection *srelgot; + asection *sreloc; + + if (info->relocatable) + return TRUE; + + dynobj = elf_hash_table (info)->dynobj; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + local_got_refcounts = elf_local_got_refcounts (abfd); + + sgot = NULL; + srelgot = NULL; + sreloc = NULL; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + unsigned long r_symndx; + struct elf_link_hash_entry *h; + + r_symndx = ELF32_R_SYM (rel->r_info); + + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_68K_GOT8: + case R_68K_GOT16: + case R_68K_GOT32: + if (h != NULL + && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + break; + /* Fall through. */ + case R_68K_GOT8O: + case R_68K_GOT16O: + case R_68K_GOT32O: + /* This symbol requires a global offset table entry. */ + + if (dynobj == NULL) + { + /* Create the .got section. */ + elf_hash_table (info)->dynobj = dynobj = abfd; + if (!_bfd_elf_create_got_section (dynobj, info)) + return FALSE; + } + + if (sgot == NULL) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + } + + if (srelgot == NULL + && (h != NULL || info->shared)) + { + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + if (srelgot == NULL) + { + srelgot = bfd_make_section (dynobj, ".rela.got"); + if (srelgot == NULL + || !bfd_set_section_flags (dynobj, srelgot, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || !bfd_set_section_alignment (dynobj, srelgot, 2)) + return FALSE; + } + } + + if (h != NULL) + { + if (h->got.refcount == 0) + { + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (!bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + /* Allocate space in the .got section. */ + sgot->_raw_size += 4; + /* Allocate relocation space. */ + srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + h->got.refcount++; + } + else + { + /* This is a global offset table entry for a local symbol. */ + if (local_got_refcounts == NULL) + { + bfd_size_type size; + + size = symtab_hdr->sh_info; + size *= sizeof (bfd_signed_vma); + local_got_refcounts = ((bfd_signed_vma *) + bfd_zalloc (abfd, size)); + if (local_got_refcounts == NULL) + return FALSE; + elf_local_got_refcounts (abfd) = local_got_refcounts; + } + if (local_got_refcounts[r_symndx] == 0) + { + sgot->_raw_size += 4; + if (info->shared) + { + /* If we are generating a shared object, we need to + output a R_68K_RELATIVE reloc so that the dynamic + linker can adjust this GOT entry. */ + srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + } + local_got_refcounts[r_symndx]++; + } + break; + + case R_68K_PLT8: + case R_68K_PLT16: + case R_68K_PLT32: + /* This symbol requires a procedure linkage table entry. We + actually build the entry in adjust_dynamic_symbol, + because this might be a case of linking PIC code which is + never referenced by a dynamic object, in which case we + don't need to generate a procedure linkage table entry + after all. */ + + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + if (h == NULL) + continue; + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount++; + break; + + case R_68K_PLT8O: + case R_68K_PLT16O: + case R_68K_PLT32O: + /* This symbol requires a procedure linkage table entry. */ + + if (h == NULL) + { + /* It does not make sense to have this relocation for a + local symbol. FIXME: does it? How to handle it if + it does make sense? */ + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (!bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount++; + break; + + case R_68K_PC8: + case R_68K_PC16: + case R_68K_PC32: + /* If we are creating a shared library and this is not a local + symbol, we need to copy the reloc into the shared library. + However when linking with -Bsymbolic and this is a global + symbol which is defined in an object we are including in the + link (i.e., DEF_REGULAR is set), then we can resolve the + reloc directly. At this point we have not seen all the input + files, so it is possible that DEF_REGULAR is not set now but + will be set later (it is never cleared). We account for that + possibility below by storing information in the + pcrel_relocs_copied field of the hash table entry. */ + if (!(info->shared + && (sec->flags & SEC_ALLOC) != 0 + && h != NULL + && (!info->symbolic + || h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) + { + if (h != NULL) + { + /* Make sure a plt entry is created for this symbol if + it turns out to be a function defined by a dynamic + object. */ + h->plt.refcount++; + } + break; + } + /* Fall through. */ + case R_68K_8: + case R_68K_16: + case R_68K_32: + if (h != NULL) + { + /* Make sure a plt entry is created for this symbol if it + turns out to be a function defined by a dynamic object. */ + h->plt.refcount++; + } + + /* If we are creating a shared library, we need to copy the + reloc into the shared library. */ + if (info->shared + && (sec->flags & SEC_ALLOC) != 0) + { + /* When creating a shared object, we must copy these + reloc types into the output file. We create a reloc + section in dynobj and make room for this reloc. */ + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) + { + sreloc = bfd_make_section (dynobj, name); + if (sreloc == NULL + || !bfd_set_section_flags (dynobj, sreloc, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || !bfd_set_section_alignment (dynobj, sreloc, 2)) + return FALSE; + } + elf_section_data (sec)->sreloc = sreloc; + } + + if (sec->flags & SEC_READONLY + /* Don't set DF_TEXTREL yet for PC relative + relocations, they might be discarded later. */ + && !(ELF32_R_TYPE (rel->r_info) == R_68K_PC8 + || ELF32_R_TYPE (rel->r_info) == R_68K_PC16 + || ELF32_R_TYPE (rel->r_info) == R_68K_PC32)) + info->flags |= DF_TEXTREL; + + sreloc->_raw_size += sizeof (Elf32_External_Rela); + + /* We count the number of PC relative relocations we have + entered for this symbol, so that we can discard them + again if, in the -Bsymbolic case, the symbol is later + defined by a regular object, or, in the normal shared + case, the symbol is forced to be local. Note that this + function is only called if we are using an m68kelf linker + hash table, which means that h is really a pointer to an + elf_m68k_link_hash_entry. */ + if (ELF32_R_TYPE (rel->r_info) == R_68K_PC8 + || ELF32_R_TYPE (rel->r_info) == R_68K_PC16 + || ELF32_R_TYPE (rel->r_info) == R_68K_PC32) + { + struct elf_m68k_pcrel_relocs_copied *p; + struct elf_m68k_pcrel_relocs_copied **head; + + if (h != NULL) + { + struct elf_m68k_link_hash_entry *eh + = elf_m68k_hash_entry (h); + head = &eh->pcrel_relocs_copied; + } + else + { + asection *s; + s = (bfd_section_from_r_symndx + (abfd, &elf_m68k_hash_table (info)->sym_sec, + sec, r_symndx)); + if (s == NULL) + return FALSE; + + head = ((struct elf_m68k_pcrel_relocs_copied **) + &elf_section_data (s)->local_dynrel); + } + + for (p = *head; p != NULL; p = p->next) + if (p->section == sreloc) + break; + + if (p == NULL) + { + p = ((struct elf_m68k_pcrel_relocs_copied *) + bfd_alloc (dynobj, (bfd_size_type) sizeof *p)); + if (p == NULL) + return FALSE; + p->next = *head; + *head = p; + p->section = sreloc; + p->count = 0; + } + + ++p->count; + } + } + + break; + + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_68K_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_68K_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + + default: + break; + } + } + + return TRUE; +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +elf_m68k_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_68K_GNU_VTINHERIT: + case R_68K_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + default: + break; + + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the got entry reference counts for the section being removed. */ + +static bfd_boolean +elf_m68k_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_signed_vma *local_got_refcounts; + const Elf_Internal_Rela *rel, *relend; + bfd *dynobj; + asection *sgot; + asection *srelgot; + + dynobj = elf_hash_table (info)->dynobj; + if (dynobj == NULL) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + local_got_refcounts = elf_local_got_refcounts (abfd); + + sgot = bfd_get_section_by_name (dynobj, ".got"); + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; rel++) + { + unsigned long r_symndx; + struct elf_link_hash_entry *h; + + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_68K_GOT8: + case R_68K_GOT16: + case R_68K_GOT32: + case R_68K_GOT8O: + case R_68K_GOT16O: + case R_68K_GOT32O: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->got.refcount > 0) + { + --h->got.refcount; + if (h->got.refcount == 0) + { + /* We don't need the .got entry any more. */ + sgot->_raw_size -= 4; + srelgot->_raw_size -= sizeof (Elf32_External_Rela); + } + } + } + else if (local_got_refcounts != NULL) + { + if (local_got_refcounts[r_symndx] > 0) + { + --local_got_refcounts[r_symndx]; + if (local_got_refcounts[r_symndx] == 0) + { + /* We don't need the .got entry any more. */ + sgot->_raw_size -= 4; + if (info->shared) + srelgot->_raw_size -= sizeof (Elf32_External_Rela); + } + } + } + break; + + case R_68K_PLT8: + case R_68K_PLT16: + case R_68K_PLT32: + case R_68K_PLT8O: + case R_68K_PLT16O: + case R_68K_PLT32O: + case R_68K_PC8: + case R_68K_PC16: + case R_68K_PC32: + case R_68K_8: + case R_68K_16: + case R_68K_32: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->plt.refcount > 0) + --h->plt.refcount; + } + break; + + default: + break; + } + } + + return TRUE; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static bfd_boolean +elf_m68k_adjust_dynamic_symbol (info, h) + struct bfd_link_info *info; + struct elf_link_hash_entry *h; +{ + bfd *dynobj; + asection *s; + unsigned int power_of_two; + + dynobj = elf_hash_table (info)->dynobj; + + /* Make sure we know what is going on here. */ + BFD_ASSERT (dynobj != NULL + && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) + || h->weakdef != NULL + || ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_REF_REGULAR) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))); + + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later, + when we know the address of the .got section. */ + if (h->type == STT_FUNC + || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + { + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 + /* We must always create the plt entry if it was referenced + by a PLTxxO relocation. In this case we already recorded + it as a dynamic symbol. */ + && h->dynindx == -1) + { + /* This case can occur if we saw a PLTxx reloc in an input + file, but the symbol was never referred to by a dynamic + object. In such a case, we don't actually need to build + a procedure linkage table, and we can just do a PCxx + reloc instead. */ + BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0); + h->plt.offset = (bfd_vma) -1; + return TRUE; + } + + /* GC may have rendered this entry unused. */ + if (h->plt.refcount <= 0) + { + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->plt.offset = (bfd_vma) -1; + return TRUE; + } + + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (s != NULL); + + /* If this is the first .plt entry, make room for the special + first entry. */ + if (s->_raw_size == 0) + { + if (CPU32_FLAG (dynobj)) + s->_raw_size += PLT_CPU32_ENTRY_SIZE; + else + s->_raw_size += PLT_ENTRY_SIZE; + } + + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (!info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + } + + h->plt.offset = s->_raw_size; + + /* Make room for this entry. */ + if (CPU32_FLAG (dynobj)) + s->_raw_size += PLT_CPU32_ENTRY_SIZE; + else + s->_raw_size += PLT_ENTRY_SIZE; + + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + s = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (s != NULL); + s->_raw_size += 4; + + /* We also need to make an entry in the .rela.plt section. */ + s = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (s != NULL); + s->_raw_size += sizeof (Elf32_External_Rela); + + return TRUE; + } + + /* Reinitialize the plt offset now that it is not used as a reference + count any more. */ + h->plt.offset = (bfd_vma) -1; + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (info->shared) + return TRUE; + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + + s = bfd_get_section_by_name (dynobj, ".dynbss"); + BFD_ASSERT (s != NULL); + + /* We must generate a R_68K_COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rela.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + asection *srel; + + srel = bfd_get_section_by_name (dynobj, ".rela.bss"); + BFD_ASSERT (srel != NULL); + srel->_raw_size += sizeof (Elf32_External_Rela); + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + } + + /* We need to figure out the alignment required for this symbol. I + have no idea how ELF linkers handle this. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > 3) + power_of_two = 3; + + /* Apply the required alignment. */ + s->_raw_size = BFD_ALIGN (s->_raw_size, + (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (dynobj, s)) + { + if (!bfd_set_section_alignment (dynobj, s, power_of_two)) + return FALSE; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + + /* Increment the section size to make room for the symbol. */ + s->_raw_size += h->size; + + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +elf_m68k_size_dynamic_sections (output_bfd, info) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *s; + bfd_boolean plt; + bfd_boolean relocs; + + dynobj = elf_hash_table (info)->dynobj; + BFD_ASSERT (dynobj != NULL); + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (info->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } + else + { + /* We may have created entries in the .rela.got section. + However, if we are not creating the dynamic sections, we will + not actually use these entries. Reset the size of .rela.got, + which will cause it to get stripped from the output file + below. */ + s = bfd_get_section_by_name (dynobj, ".rela.got"); + if (s != NULL) + s->_raw_size = 0; + } + + /* If this is a -Bsymbolic shared link, then we need to discard all + PC relative relocs against symbols defined in a regular object. + For the normal shared case we discard the PC relative relocs + against symbols that have become local due to visibility changes. + We allocated space for them in the check_relocs routine, but we + will not fill them in in the relocate_section routine. */ + if (info->shared) + elf_link_hash_traverse (elf_hash_table (info), + elf_m68k_discard_copies, + (PTR) info); + + /* The check_relocs and adjust_dynamic_symbol entry points have + determined the sizes of the various dynamic sections. Allocate + memory for them. */ + plt = FALSE; + relocs = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + const char *name; + bfd_boolean strip; + + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + /* It's OK to base decisions on the section name, because none + of the dynobj section names depend upon the input files. */ + name = bfd_get_section_name (dynobj, s); + + strip = FALSE; + + if (strcmp (name, ".plt") == 0) + { + if (s->_raw_size == 0) + { + /* Strip this section if we don't need it; see the + comment below. */ + strip = TRUE; + } + else + { + /* Remember whether there is a PLT. */ + plt = TRUE; + } + } + else if (strncmp (name, ".rela", 5) == 0) + { + if (s->_raw_size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + strip = TRUE; + } + else + { + relocs = TRUE; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + } + else if (strncmp (name, ".got", 4) != 0) + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (strip) + { + _bfd_strip_section_from_output (info, s); + continue; + } + + /* Allocate memory for the section contents. */ + /* FIXME: This should be a call to bfd_alloc not bfd_zalloc. + Unused entries should be reclaimed before the section's contents + are written out, but at the moment this does not happen. Thus in + order to prevent writing out garbage, we initialise the section's + contents to zero. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) + return FALSE; + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in elf_m68k_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) + + if (!info->shared) + { + if (!add_dynamic_entry (DT_DEBUG, 0)) + return FALSE; + } + + if (plt) + { + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + } + + if (relocs) + { + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) + return FALSE; + } + + if ((info->flags & DF_TEXTREL) != 0) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return FALSE; + } + } +#undef add_dynamic_entry + + return TRUE; +} + +/* This function is called via elf_link_hash_traverse if we are + creating a shared object. In the -Bsymbolic case it discards the + space allocated to copy PC relative relocs against symbols which + are defined in regular objects. For the normal shared case, it + discards space for pc-relative relocs that have become local due to + symbol visibility changes. We allocated space for them in the + check_relocs routine, but we won't fill them in in the + relocate_section routine. + + We also check whether any of the remaining relocations apply + against a readonly section, and set the DF_TEXTREL flag in this + case. */ + +static bfd_boolean +elf_m68k_discard_copies (h, inf) + struct elf_link_hash_entry *h; + PTR inf; +{ + struct bfd_link_info *info = (struct bfd_link_info *) inf; + struct elf_m68k_pcrel_relocs_copied *s; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 + || (!info->symbolic + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)) + { + if ((info->flags & DF_TEXTREL) == 0) + { + /* Look for relocations against read-only sections. */ + for (s = elf_m68k_hash_entry (h)->pcrel_relocs_copied; + s != NULL; + s = s->next) + if ((s->section->flags & SEC_READONLY) != 0) + { + info->flags |= DF_TEXTREL; + break; + } + } + + return TRUE; + } + + for (s = elf_m68k_hash_entry (h)->pcrel_relocs_copied; + s != NULL; + s = s->next) + s->section->_raw_size -= s->count * sizeof (Elf32_External_Rela); + + return TRUE; +} + +/* Relocate an M68K ELF section. */ + +static bfd_boolean +elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + bfd *dynobj; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_vma *local_got_offsets; + asection *sgot; + asection *splt; + asection *sreloc; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + + if (info->relocatable) + return TRUE; + + dynobj = elf_hash_table (info)->dynobj; + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + local_got_offsets = elf_local_got_offsets (input_bfd); + + sgot = NULL; + splt = NULL; + sreloc = NULL; + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + asection *sec; + bfd_vma relocation; + bfd_boolean unresolved_reloc; + bfd_reloc_status_type r; + + r_type = ELF32_R_TYPE (rel->r_info); + if (r_type < 0 || r_type >= (int) R_68K_max) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + howto = howto_table + r_type; + + r_symndx = ELF32_R_SYM (rel->r_info); + + h = NULL; + sym = NULL; + sec = NULL; + unresolved_reloc = FALSE; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { + bfd_boolean warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + } + + switch (r_type) + { + case R_68K_GOT8: + case R_68K_GOT16: + case R_68K_GOT32: + /* Relocation is to the address of the entry for this symbol + in the global offset table. */ + if (h != NULL + && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + break; + /* Fall through. */ + case R_68K_GOT8O: + case R_68K_GOT16O: + case R_68K_GOT32O: + /* Relocation is the offset of the entry for this symbol in + the global offset table. */ + + { + bfd_vma off; + + if (sgot == NULL) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + } + + if (h != NULL) + { + bfd_boolean dyn; + + off = h->got.offset; + BFD_ASSERT (off != (bfd_vma) -1); + + dyn = elf_hash_table (info)->dynamic_sections_created; + if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) + || (info->shared + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) != 0) + { + /* This is actually a static link, or it is a + -Bsymbolic link and the symbol is defined + locally, or the symbol was forced to be local + because of a version file.. We must initialize + this entry in the global offset table. Since + the offset must always be a multiple of 4, we + use the least significant bit to record whether + we have initialized it already. + + When doing a dynamic link, we create a .rela.got + relocation entry to initialize the value. This + is done in the finish_dynamic_symbol routine. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_32 (output_bfd, relocation, + sgot->contents + off); + h->got.offset |= 1; + } + } + else + unresolved_reloc = FALSE; + } + else + { + BFD_ASSERT (local_got_offsets != NULL + && local_got_offsets[r_symndx] != (bfd_vma) -1); + + off = local_got_offsets[r_symndx]; + + /* The offset must always be a multiple of 4. We use + the least significant bit to record whether we have + already generated the necessary reloc. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_32 (output_bfd, relocation, sgot->contents + off); + + if (info->shared) + { + asection *s; + Elf_Internal_Rela outrel; + bfd_byte *loc; + + s = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (s != NULL); + + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + off); + outrel.r_info = ELF32_R_INFO (0, R_68K_RELATIVE); + outrel.r_addend = relocation; + loc = s->contents; + loc += s->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + } + + local_got_offsets[r_symndx] |= 1; + } + } + + relocation = sgot->output_offset + off; + if (r_type == R_68K_GOT8O + || r_type == R_68K_GOT16O + || r_type == R_68K_GOT32O) + { + /* This relocation does not use the addend. */ + rel->r_addend = 0; + } + else + relocation += sgot->output_section->vma; + } + break; + + case R_68K_PLT8: + case R_68K_PLT16: + case R_68K_PLT32: + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + /* Resolve a PLTxx reloc against a local symbol directly, + without using the procedure linkage table. */ + if (h == NULL) + break; + + if (h->plt.offset == (bfd_vma) -1 + || !elf_hash_table (info)->dynamic_sections_created) + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ + break; + } + + if (splt == NULL) + { + splt = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (splt != NULL); + } + + relocation = (splt->output_section->vma + + splt->output_offset + + h->plt.offset); + unresolved_reloc = FALSE; + break; + + case R_68K_PLT8O: + case R_68K_PLT16O: + case R_68K_PLT32O: + /* Relocation is the offset of the entry for this symbol in + the procedure linkage table. */ + BFD_ASSERT (h != NULL && h->plt.offset != (bfd_vma) -1); + + if (splt == NULL) + { + splt = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (splt != NULL); + } + + relocation = h->plt.offset; + unresolved_reloc = FALSE; + + /* This relocation does not use the addend. */ + rel->r_addend = 0; + + break; + + case R_68K_PC8: + case R_68K_PC16: + case R_68K_PC32: + if (h == NULL + || (info->shared + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) + break; + /* Fall through. */ + case R_68K_8: + case R_68K_16: + case R_68K_32: + if (info->shared + && r_symndx != 0 + && (input_section->flags & SEC_ALLOC) != 0 + && (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak) + && ((r_type != R_68K_PC8 + && r_type != R_68K_PC16 + && r_type != R_68K_PC32) + || (h != NULL + && h->dynindx != -1 + && (!info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + bfd_boolean skip, relocate; + + /* When generating a shared object, these relocations + are copied into the output file to be resolved at run + time. */ + + skip = FALSE; + relocate = FALSE; + + outrel.r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, + rel->r_offset); + if (outrel.r_offset == (bfd_vma) -1) + skip = TRUE; + else if (outrel.r_offset == (bfd_vma) -2) + skip = TRUE, relocate = TRUE; + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + else if (h != NULL + && h->dynindx != -1 + && (r_type == R_68K_PC8 + || r_type == R_68K_PC16 + || r_type == R_68K_PC32 + || !info->shared + || !info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + { + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + outrel.r_addend = rel->r_addend; + } + else + { + /* This symbol is local, or marked to become local. */ + if (r_type == R_68K_32) + { + relocate = TRUE; + outrel.r_info = ELF32_R_INFO (0, R_68K_RELATIVE); + outrel.r_addend = relocation + rel->r_addend; + } + else + { + long indx; + + if (bfd_is_abs_section (sec)) + indx = 0; + else if (sec == NULL || sec->owner == NULL) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + else + { + asection *osec; + + osec = sec->output_section; + indx = elf_section_data (osec)->dynindx; + BFD_ASSERT (indx > 0); + } + + outrel.r_info = ELF32_R_INFO (indx, r_type); + outrel.r_addend = relocation + rel->r_addend; + } + } + + sreloc = elf_section_data (input_section)->sreloc; + if (sreloc == NULL) + abort (); + + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + + /* This reloc will be computed at runtime, so there's no + need to do anything now, except for R_68K_32 + relocations that have been turned into + R_68K_RELATIVE. */ + if (!relocate) + continue; + } + + break; + + case R_68K_GNU_VTINHERIT: + case R_68K_GNU_VTENTRY: + /* These are no-ops in the end. */ + continue; + + default: + break; + } + + /* Dynamic relocs are not propagated for SEC_DEBUGGING sections + because such sections are not SEC_ALLOC and thus ld.so will + not process them. */ + if (unresolved_reloc + && !((input_section->flags & SEC_DEBUGGING) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + { + (*_bfd_error_handler) + (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, + h->root.root.string); + return FALSE; + } + + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + + if (r != bfd_reloc_ok) + { + const char *name; + + if (h != NULL) + name = h->root.root.string; + else + { + name = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name); + if (name == NULL) + return FALSE; + if (*name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + if (r == bfd_reloc_overflow) + { + if (!(info->callbacks->reloc_overflow + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return FALSE; + } + else + { + (*_bfd_error_handler) + (_("%s(%s+0x%lx): reloc against `%s': error %d"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, name, (int) r); + return FALSE; + } + } + } + + return TRUE; +} + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +static bfd_boolean +elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym) + bfd *output_bfd; + struct bfd_link_info *info; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + bfd *dynobj; + int plt_off1, plt_off2, plt_off3; + + dynobj = elf_hash_table (info)->dynobj; + + if (h->plt.offset != (bfd_vma) -1) + { + asection *splt; + asection *sgot; + asection *srela; + bfd_vma plt_index; + bfd_vma got_offset; + Elf_Internal_Rela rela; + bfd_byte *loc; + + /* This symbol has an entry in the procedure linkage table. Set + it up. */ + + BFD_ASSERT (h->dynindx != -1); + + splt = bfd_get_section_by_name (dynobj, ".plt"); + sgot = bfd_get_section_by_name (dynobj, ".got.plt"); + srela = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL); + + /* Get the index in the procedure linkage table which + corresponds to this symbol. This is the index of this symbol + in all the symbols for which we are making plt entries. The + first entry in the procedure linkage table is reserved. */ + if ( CPU32_FLAG (output_bfd)) + plt_index = h->plt.offset / PLT_CPU32_ENTRY_SIZE - 1; + else + plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; + + /* Get the offset into the .got table of the entry that + corresponds to this function. Each .got entry is 4 bytes. + The first three are reserved. */ + got_offset = (plt_index + 3) * 4; + + if ( CPU32_FLAG (output_bfd)) + { + /* Fill in the entry in the procedure linkage table. */ + memcpy (splt->contents + h->plt.offset, elf_cpu32_plt_entry, + PLT_CPU32_ENTRY_SIZE); + plt_off1 = 4; + plt_off2 = 12; + plt_off3 = 18; + } + else + { + /* Fill in the entry in the procedure linkage table. */ + memcpy (splt->contents + h->plt.offset, elf_m68k_plt_entry, + PLT_ENTRY_SIZE); + plt_off1 = 4; + plt_off2 = 10; + plt_off3 = 16; + } + + /* The offset is relative to the first extension word. */ + bfd_put_32 (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + + got_offset + - (splt->output_section->vma + + h->plt.offset + 2)), + splt->contents + h->plt.offset + plt_off1); + + bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), + splt->contents + h->plt.offset + plt_off2); + bfd_put_32 (output_bfd, - (h->plt.offset + plt_off3), + splt->contents + h->plt.offset + plt_off3); + + /* Fill in the entry in the global offset table. */ + bfd_put_32 (output_bfd, + (splt->output_section->vma + + splt->output_offset + + h->plt.offset + + 8), + sgot->contents + got_offset); + + /* Fill in the entry in the .rela.plt section. */ + rela.r_offset = (sgot->output_section->vma + + sgot->output_offset + + got_offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_68K_JMP_SLOT); + rela.r_addend = 0; + loc = srela->contents + plt_index * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + } + } + + if (h->got.offset != (bfd_vma) -1) + { + asection *sgot; + asection *srela; + Elf_Internal_Rela rela; + bfd_byte *loc; + + /* This symbol has an entry in the global offset table. Set it + up. */ + + sgot = bfd_get_section_by_name (dynobj, ".got"); + srela = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (sgot != NULL && srela != NULL); + + rela.r_offset = (sgot->output_section->vma + + sgot->output_offset + + (h->got.offset &~ (bfd_vma) 1)); + + /* If this is a -Bsymbolic link, and the symbol is defined + locally, we just want to emit a RELATIVE reloc. Likewise if + the symbol was forced to be local because of a version file. + The entry in the global offset table will already have been + initialized in the relocate_section function. */ + if (info->shared + && (info->symbolic + || h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + { + rela.r_info = ELF32_R_INFO (0, R_68K_RELATIVE); + rela.r_addend = bfd_get_signed_32 (output_bfd, + (sgot->contents + + (h->got.offset &~ (bfd_vma) 1))); + } + else + { + bfd_put_32 (output_bfd, (bfd_vma) 0, + sgot->contents + (h->got.offset &~ (bfd_vma) 1)); + rela.r_info = ELF32_R_INFO (h->dynindx, R_68K_GLOB_DAT); + rela.r_addend = 0; + } + + loc = srela->contents; + loc += srela->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + } + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + { + asection *s; + Elf_Internal_Rela rela; + bfd_byte *loc; + + /* This symbol needs a copy reloc. Set it up. */ + + BFD_ASSERT (h->dynindx != -1 + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)); + + s = bfd_get_section_by_name (h->root.u.def.section->owner, + ".rela.bss"); + BFD_ASSERT (s != NULL); + + rela.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_68K_COPY); + rela.r_addend = 0; + loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + } + + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + sym->st_shndx = SHN_ABS; + + return TRUE; +} + +/* Finish up the dynamic sections. */ + +static bfd_boolean +elf_m68k_finish_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *sgot; + asection *sdyn; + + dynobj = elf_hash_table (info)->dynobj; + + sgot = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (sgot != NULL); + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (elf_hash_table (info)->dynamic_sections_created) + { + asection *splt; + Elf32_External_Dyn *dyncon, *dynconend; + + splt = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (splt != NULL && sdyn != NULL); + + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + const char *name; + asection *s; + + bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + break; + + case DT_PLTGOT: + name = ".got"; + goto get_vma; + case DT_JMPREL: + name = ".rela.plt"; + get_vma: + s = bfd_get_section_by_name (output_bfd, name); + BFD_ASSERT (s != NULL); + dyn.d_un.d_ptr = s->vma; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_PLTRELSZ: + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + BFD_ASSERT (s != NULL); + if (s->_cooked_size != 0) + dyn.d_un.d_val = s->_cooked_size; + else + dyn.d_un.d_val = s->_raw_size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_RELASZ: + /* The procedure linkage table relocs (DT_JMPREL) should + not be included in the overall relocs (DT_RELA). + Therefore, we override the DT_RELASZ entry here to + make it not include the JMPREL relocs. Since the + linker script arranges for .rela.plt to follow all + other relocation sections, we don't have to worry + about changing the DT_RELA entry. */ + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + if (s != NULL) + { + if (s->_cooked_size != 0) + dyn.d_un.d_val -= s->_cooked_size; + else + dyn.d_un.d_val -= s->_raw_size; + } + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + } + } + + /* Fill in the first entry in the procedure linkage table. */ + if (splt->_raw_size > 0) + { + if (!CPU32_FLAG (output_bfd)) + { + memcpy (splt->contents, elf_m68k_plt0_entry, PLT_ENTRY_SIZE); + bfd_put_32 (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + 4 + - (splt->output_section->vma + 2)), + splt->contents + 4); + bfd_put_32 (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + 8 + - (splt->output_section->vma + 10)), + splt->contents + 12); + elf_section_data (splt->output_section)->this_hdr.sh_entsize + = PLT_ENTRY_SIZE; + } + else /* cpu32 */ + { + memcpy (splt->contents, elf_cpu32_plt0_entry, PLT_CPU32_ENTRY_SIZE); + bfd_put_32 (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + 4 + - (splt->output_section->vma + 2)), + splt->contents + 4); + bfd_put_32 (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + 8 + - (splt->output_section->vma + 10)), + splt->contents + 12); + elf_section_data (splt->output_section)->this_hdr.sh_entsize + = PLT_CPU32_ENTRY_SIZE; + } + } + } + + /* Fill in the first three entries in the global offset table. */ + if (sgot->_raw_size > 0) + { + if (sdyn == NULL) + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + else + bfd_put_32 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + sgot->contents); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + } + + elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; + + return TRUE; +} + +/* Given a .data section and a .emreloc in-memory section, store + relocation information into the .emreloc section which can be + used at runtime to relocate the section. This is called by the + linker when the --embedded-relocs switch is used. This is called + after the add_symbols entry point has been called for all the + objects, and before the final_link entry point is called. */ + +bfd_boolean +bfd_m68k_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) + bfd *abfd; + struct bfd_link_info *info; + asection *datasec; + asection *relsec; + char **errmsg; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Sym *isymbuf = NULL; + Elf_Internal_Rela *internal_relocs = NULL; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *p; + bfd_size_type amt; + + BFD_ASSERT (! info->relocatable); + + *errmsg = NULL; + + if (datasec->reloc_count == 0) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + /* Get a copy of the native relocations. */ + internal_relocs = (_bfd_elf_link_read_relocs + (abfd, datasec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + + amt = (bfd_size_type) datasec->reloc_count * 12; + relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt); + if (relsec->contents == NULL) + goto error_return; + + p = relsec->contents; + + irelend = internal_relocs + datasec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++, p += 12) + { + asection *targetsec; + + /* We are going to write a four byte longword into the runtime + reloc section. The longword will be the address in the data + section which must be relocated. It is followed by the name + of the target section NUL-padded or truncated to 8 + characters. */ + + /* We can only relocate absolute longword relocs at run time. */ + if (ELF32_R_TYPE (irel->r_info) != (int) R_68K_32) + { + *errmsg = _("unsupported reloc type"); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + /* Get the target section referred to by the reloc. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + /* A local symbol. */ + Elf_Internal_Sym *isym; + + /* Read this BFD's local symbols if we haven't done so already. */ + if (isymbuf == NULL) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + isym = isymbuf + ELF32_R_SYM (irel->r_info); + targetsec = bfd_section_from_elf_index (abfd, isym->st_shndx); + } + else + { + unsigned long indx; + struct elf_link_hash_entry *h; + + /* An external symbol. */ + indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + targetsec = h->root.u.def.section; + else + targetsec = NULL; + } + + bfd_put_32 (abfd, irel->r_offset + datasec->output_offset, p); + memset (p + 4, 0, 8); + if (targetsec != NULL) + strncpy (p + 4, targetsec->output_section->name, 8); + } + + if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (internal_relocs != NULL + && elf_section_data (datasec)->relocs != internal_relocs) + free (internal_relocs); + return TRUE; + +error_return: + if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (internal_relocs != NULL + && elf_section_data (datasec)->relocs != internal_relocs) + free (internal_relocs); + return FALSE; +} + +static enum elf_reloc_type_class +elf32_m68k_reloc_type_class (rela) + const Elf_Internal_Rela *rela; +{ + switch ((int) ELF32_R_TYPE (rela->r_info)) + { + case R_68K_RELATIVE: + return reloc_class_relative; + case R_68K_JMP_SLOT: + return reloc_class_plt; + case R_68K_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} + +#define TARGET_BIG_SYM bfd_elf32_m68k_vec +#define TARGET_BIG_NAME "elf32-m68k" +#define ELF_MACHINE_CODE EM_68K +#define ELF_MAXPAGESIZE 0x2000 +#define elf_backend_create_dynamic_sections \ + _bfd_elf_create_dynamic_sections +#define bfd_elf32_bfd_link_hash_table_create \ + elf_m68k_link_hash_table_create +#define bfd_elf32_bfd_final_link bfd_elf_gc_common_final_link + +#define elf_backend_check_relocs elf_m68k_check_relocs +#define elf_backend_adjust_dynamic_symbol \ + elf_m68k_adjust_dynamic_symbol +#define elf_backend_size_dynamic_sections \ + elf_m68k_size_dynamic_sections +#define elf_backend_relocate_section elf_m68k_relocate_section +#define elf_backend_finish_dynamic_symbol \ + elf_m68k_finish_dynamic_symbol +#define elf_backend_finish_dynamic_sections \ + elf_m68k_finish_dynamic_sections +#define elf_backend_gc_mark_hook elf_m68k_gc_mark_hook +#define elf_backend_gc_sweep_hook elf_m68k_gc_sweep_hook +#define bfd_elf32_bfd_merge_private_bfd_data \ + elf32_m68k_merge_private_bfd_data +#define bfd_elf32_bfd_set_private_flags \ + elf32_m68k_set_private_flags +#define bfd_elf32_bfd_print_private_bfd_data \ + elf32_m68k_print_private_bfd_data +#define elf_backend_reloc_type_class elf32_m68k_reloc_type_class + +#define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 +#define elf_backend_want_got_plt 1 +#define elf_backend_plt_readonly 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_got_header_size 12 +#define elf_backend_rela_normal 1 + +#include "elf32-target.h" diff --git a/bfd/elf32-m88k.c b/bfd/elf32-m88k.c new file mode 100644 index 0000000000000..83d7a758e6284 --- /dev/null +++ b/bfd/elf32-m88k.c @@ -0,0 +1,36 @@ +/* Motorola 88k-specific support for 32-bit ELF + Copyright 1993, 1995, 1999 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" + +/* This does not include any relocations, but should be good enough + for GDB. */ + +#define TARGET_BIG_SYM bfd_elf32_m88k_vec +#define TARGET_BIG_NAME "elf32-m88k" +#define ELF_ARCH bfd_arch_m88k +#define ELF_MACHINE_CODE EM_88K +#define ELF_MAXPAGESIZE 1 /* FIXME: This number is wrong, It should be the page size in bytes. */ +#define bfd_elf32_bfd_reloc_type_lookup bfd_default_reloc_type_lookup +#define elf_info_to_howto _bfd_elf_no_info_to_howto + +#include "elf32-target.h" diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c new file mode 100644 index 0000000000000..e6aa666c6dc1d --- /dev/null +++ b/bfd/elf32-mcore.c @@ -0,0 +1,696 @@ +/* Motorola MCore specific support for 32-bit ELF + Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* This file is based on a preliminary RCE ELF ABI. The + information may not match the final RCE ELF ABI. */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/mcore.h" +#include + +/* RELA relocs are used here... */ + +static void mcore_elf_howto_init + PARAMS ((void)); +static reloc_howto_type * mcore_elf_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void mcore_elf_info_to_howto + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static bfd_boolean mcore_elf_set_private_flags + PARAMS ((bfd *, flagword)); +static bfd_boolean mcore_elf_merge_private_bfd_data + PARAMS ((bfd *, bfd *)); +static bfd_reloc_status_type mcore_elf_unsupported_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_boolean mcore_elf_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static asection * mcore_elf_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static bfd_boolean mcore_elf_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static bfd_boolean mcore_elf_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); + +static reloc_howto_type * mcore_elf_howto_table [(int) R_MCORE_max]; + +static reloc_howto_type mcore_elf_howto_raw[] = +{ + /* This reloc does nothing. */ + HOWTO (R_MCORE_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + NULL, /* special_function */ + "R_MCORE_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A standard 32 bit relocation. */ + HOWTO (R_MCORE_ADDR32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "ADDR32", /* name *//* For compatibility with coff/pe port. */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 8 bits + 2 zero bits; jmpi/jsri/lrw instructions. + Should not appear in object files. */ + HOWTO (R_MCORE_PCRELIMM8BY4, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + mcore_elf_unsupported_reloc, /* special_function */ + "R_MCORE_PCRELIMM8BY4",/* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* bsr/bt/bf/br instructions; 11 bits + 1 zero bit + Span 2k instructions == 4k bytes. + Only useful pieces at the relocated address are the opcode (5 bits) */ + HOWTO (R_MCORE_PCRELIMM11BY2,/* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 11, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MCORE_PCRELIMM11BY2",/* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 4 bits + 1 zero bit; 'loopt' instruction only; unsupported. */ + HOWTO (R_MCORE_PCRELIMM4BY2, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 4, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + mcore_elf_unsupported_reloc,/* special_function */ + "R_MCORE_PCRELIMM4BY2",/* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 32-bit pc-relative. Eventually this will help support PIC code. */ + HOWTO (R_MCORE_PCREL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MCORE_PCREL32", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Like PCRELIMM11BY2, this relocation indicates that there is a + 'jsri' at the specified address. There is a separate relocation + entry for the literal pool entry that it references, but we + might be able to change the jsri to a bsr if the target turns out + to be close enough [even though we won't reclaim the literal pool + entry, we'll get some runtime efficiency back]. Note that this + is a relocation that we are allowed to safely ignore. */ + HOWTO (R_MCORE_PCRELJSR_IMM11BY2,/* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 11, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MCORE_PCRELJSR_IMM11BY2", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_MCORE_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_MCORE_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_MCORE_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_MCORE_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MCORE_RELATIVE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + NULL, /* special_function */ + "R_MCORE_RELATIVE", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE) /* pcrel_offset */ +}; + +#ifndef NUM_ELEM +#define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0]) +#endif + +/* Initialize the mcore_elf_howto_table, so that linear accesses can be done. */ +static void +mcore_elf_howto_init () +{ + unsigned int i; + + for (i = NUM_ELEM (mcore_elf_howto_raw); i--;) + { + unsigned int type; + + type = mcore_elf_howto_raw[i].type; + + BFD_ASSERT (type < NUM_ELEM (mcore_elf_howto_table)); + + mcore_elf_howto_table [type] = & mcore_elf_howto_raw [i]; + } +} + +static reloc_howto_type * +mcore_elf_reloc_type_lookup (abfd, code) + bfd * abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + enum elf_mcore_reloc_type mcore_reloc = R_MCORE_NONE; + + switch (code) + { + case BFD_RELOC_NONE: mcore_reloc = R_MCORE_NONE; break; + case BFD_RELOC_32: mcore_reloc = R_MCORE_ADDR32; break; + case BFD_RELOC_MCORE_PCREL_IMM8BY4: mcore_reloc = R_MCORE_PCRELIMM8BY4; break; + case BFD_RELOC_MCORE_PCREL_IMM11BY2: mcore_reloc = R_MCORE_PCRELIMM11BY2; break; + case BFD_RELOC_MCORE_PCREL_IMM4BY2: mcore_reloc = R_MCORE_PCRELIMM4BY2; break; + case BFD_RELOC_32_PCREL: mcore_reloc = R_MCORE_PCREL32; break; + case BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2: mcore_reloc = R_MCORE_PCRELJSR_IMM11BY2; break; + case BFD_RELOC_VTABLE_INHERIT: mcore_reloc = R_MCORE_GNU_VTINHERIT; break; + case BFD_RELOC_VTABLE_ENTRY: mcore_reloc = R_MCORE_GNU_VTENTRY; break; + case BFD_RELOC_RVA: mcore_reloc = R_MCORE_RELATIVE; break; + default: + return (reloc_howto_type *)NULL; + } + + if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) /* Initialize howto table if needed */ + mcore_elf_howto_init (); + + return mcore_elf_howto_table [(int) mcore_reloc]; +}; + +/* Set the howto pointer for a RCE ELF reloc. */ +static void +mcore_elf_info_to_howto (abfd, cache_ptr, dst) + bfd * abfd ATTRIBUTE_UNUSED; + arelent * cache_ptr; + Elf_Internal_Rela * dst; +{ + if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) /* Initialize howto table if needed */ + mcore_elf_howto_init (); + + BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_MCORE_max); + + cache_ptr->howto = mcore_elf_howto_table [ELF32_R_TYPE (dst->r_info)]; +} + +/* Function to set whether a module needs the -mrelocatable bit set. */ +static bfd_boolean +mcore_elf_set_private_flags (abfd, flags) + bfd * abfd; + flagword flags; +{ + BFD_ASSERT (! elf_flags_init (abfd) + || elf_elfheader (abfd)->e_flags == flags); + + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + return TRUE; +} + +/* Merge backend specific data from an object file to the output + object file when linking. */ +static bfd_boolean +mcore_elf_merge_private_bfd_data (ibfd, obfd) + bfd * ibfd; + bfd * obfd; +{ + flagword old_flags; + flagword new_flags; + + /* Check if we have the same endianess */ + if (! _bfd_generic_verify_endian_match (ibfd, obfd)) + return FALSE; + + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + new_flags = elf_elfheader (ibfd)->e_flags; + old_flags = elf_elfheader (obfd)->e_flags; + + if (! elf_flags_init (obfd)) /* First call, no flags set */ + { + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = new_flags; + } + else if (new_flags == old_flags) /* Compatible flags are ok */ + ; + else + { + /* FIXME */ + } + + return TRUE; +} + +/* Don't pretend we can deal with unsupported relocs. */ + +static bfd_reloc_status_type +mcore_elf_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd * abfd; + arelent * reloc_entry; + asymbol * symbol ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection * input_section ATTRIBUTE_UNUSED; + bfd * output_bfd ATTRIBUTE_UNUSED; + char ** error_message ATTRIBUTE_UNUSED; +{ + BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0); + + _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"), + bfd_archive_filename (abfd), + reloc_entry->howto->name, + reloc_entry->howto->type); + + return bfd_reloc_notsupported; +} + +/* The RELOCATE_SECTION function is called by the ELF backend linker + to handle the relocations for a section. + + The relocs are always passed as Rela structures; if the section + actually uses Rel structures, the r_addend field will always be + zero. + + This function is responsible for adjust the section contents as + necessary, and (if using Rela relocs and generating a + relocatable output file) adjusting the reloc addend as + necessary. + + This function does not have to worry about setting the reloc + address or the reloc symbol index. + + LOCAL_SYMS is a pointer to the swapped in local symbols. + + LOCAL_SECTIONS is an array giving the section in the input file + corresponding to the st_shndx field of each local symbol. + + The global hash table entry for the global symbols can be found + via elf_sym_hashes (input_bfd). + + When generating relocatable output, this function must handle + STB_LOCAL/STT_SECTION symbols specially. The output symbol is + going to be the section symbol corresponding to the output + section, which means that the addend must be adjusted + accordingly. */ + +static bfd_boolean +mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd * output_bfd; + struct bfd_link_info * info; + bfd * input_bfd; + asection * input_section; + bfd_byte * contents; + Elf_Internal_Rela * relocs; + Elf_Internal_Sym * local_syms; + asection ** local_sections; +{ + Elf_Internal_Shdr * symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + struct elf_link_hash_entry ** sym_hashes = elf_sym_hashes (input_bfd); + Elf_Internal_Rela * rel = relocs; + Elf_Internal_Rela * relend = relocs + input_section->reloc_count; + bfd_boolean ret = TRUE; + +#ifdef DEBUG + fprintf (stderr, + "mcore_elf_relocate_section called for %s section %s, %ld relocations%s\n", + bfd_archive_filename (input_bfd), + bfd_section_name(input_bfd, input_section), + (long) input_section->reloc_count, + (info->relocatable) ? " (relocatable)" : ""); +#endif + + if (info->relocatable) + return TRUE; + + if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) /* Initialize howto table if needed */ + mcore_elf_howto_init (); + + for (; rel < relend; rel++) + { + enum elf_mcore_reloc_type r_type = (enum elf_mcore_reloc_type) ELF32_R_TYPE (rel->r_info); + bfd_vma offset = rel->r_offset; + bfd_vma addend = rel->r_addend; + bfd_reloc_status_type r = bfd_reloc_other; + asection * sec = (asection *) 0; + reloc_howto_type * howto; + bfd_vma relocation; + Elf_Internal_Sym * sym = (Elf_Internal_Sym *) 0; + unsigned long r_symndx; + struct elf_link_hash_entry * h = (struct elf_link_hash_entry *) 0; + unsigned short oldinst = 0; + + /* Unknown relocation handling */ + if ((unsigned) r_type >= (unsigned) R_MCORE_max + || ! mcore_elf_howto_table [(int)r_type]) + { + _bfd_error_handler (_("%s: Unknown relocation type %d\n"), + bfd_archive_filename (input_bfd), + (int) r_type); + + bfd_set_error (bfd_error_bad_value); + ret = FALSE; + continue; + } + + howto = mcore_elf_howto_table [(int) r_type]; + r_symndx = ELF32_R_SYM (rel->r_info); + + /* Complain about known relocation that are not yet supported. */ + if (howto->special_function == mcore_elf_unsupported_reloc) + { + _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"), + bfd_archive_filename (input_bfd), + howto->name, + (int)r_type); + + bfd_set_error (bfd_error_bad_value); + ret = FALSE; + continue; + } + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + addend = rel->r_addend; + } + else + { + bfd_boolean unresolved_reloc, warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + } + + switch (r_type) + { + default: + break; + + case R_MCORE_PCRELJSR_IMM11BY2: + oldinst = bfd_get_16 (input_bfd, contents + offset); +#define MCORE_INST_BSR 0xF800 + bfd_put_16 (input_bfd, (bfd_vma) MCORE_INST_BSR, contents + offset); + break; + } + +#ifdef DEBUG + fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n", + howto->name, r_type, r_symndx, (long) offset, (long) addend); +#endif + + r = _bfd_final_link_relocate + (howto, input_bfd, input_section, contents, offset, relocation, addend); + + if (r != bfd_reloc_ok && r_type == R_MCORE_PCRELJSR_IMM11BY2) + { + /* Wasn't ok, back it out and give up. */ + bfd_put_16 (input_bfd, (bfd_vma) oldinst, contents + offset); + r = bfd_reloc_ok; + } + + if (r != bfd_reloc_ok) + { + ret = FALSE; + + switch (r) + { + default: + break; + + case bfd_reloc_overflow: + { + const char * name; + + if (h != NULL) + name = h->root.root.string; + else + { + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); + + if (name == NULL) + break; + + if (* name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + (*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, input_bfd, input_section, + offset); + } + break; + } + } + } + +#ifdef DEBUG + fprintf (stderr, "\n"); +#endif + + return ret; +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +mcore_elf_gc_mark_hook (sec, info, rel, h, sym) + asection * sec; + struct bfd_link_info * info ATTRIBUTE_UNUSED; + Elf_Internal_Rela * rel; + struct elf_link_hash_entry * h; + Elf_Internal_Sym * sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_MCORE_GNU_VTINHERIT: + case R_MCORE_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the got entry reference counts for the section being removed. */ + +static bfd_boolean +mcore_elf_gc_sweep_hook (abfd, info, sec, relocs) + bfd * abfd ATTRIBUTE_UNUSED; + struct bfd_link_info * info ATTRIBUTE_UNUSED; + asection * sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED; +{ + return TRUE; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static bfd_boolean +mcore_elf_check_relocs (abfd, info, sec, relocs) + bfd * abfd; + struct bfd_link_info * info; + asection * sec; + const Elf_Internal_Rela * relocs; +{ + Elf_Internal_Shdr * symtab_hdr; + struct elf_link_hash_entry ** sym_hashes; + struct elf_link_hash_entry ** sym_hashes_end; + const Elf_Internal_Rela * rel; + const Elf_Internal_Rela * rel_end; + + if (info->relocatable) + return TRUE; + + symtab_hdr = & elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + rel_end = relocs + sec->reloc_count; + + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry * h; + unsigned long r_symndx; + + r_symndx = ELF32_R_SYM (rel->r_info); + + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes [r_symndx - symtab_hdr->sh_info]; + + switch (ELF32_R_TYPE (rel->r_info)) + { + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_MCORE_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_MCORE_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + } + } + + return TRUE; +} + +static struct bfd_elf_special_section const mcore_elf_special_sections[]= +{ + { ".ctors", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".dtors", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } +}; + +#define TARGET_BIG_SYM bfd_elf32_mcore_big_vec +#define TARGET_BIG_NAME "elf32-mcore-big" +#define TARGET_LITTLE_SYM bfd_elf32_mcore_little_vec +#define TARGET_LITTLE_NAME "elf32-mcore-little" + +#define ELF_ARCH bfd_arch_mcore +#define ELF_MACHINE_CODE EM_MCORE +#define ELF_MAXPAGESIZE 0x1000 /* 4k, if we ever have 'em */ +#define elf_info_to_howto mcore_elf_info_to_howto +#define elf_info_to_howto_rel NULL + +#define bfd_elf32_bfd_merge_private_bfd_data mcore_elf_merge_private_bfd_data +#define bfd_elf32_bfd_set_private_flags mcore_elf_set_private_flags +#define bfd_elf32_bfd_reloc_type_lookup mcore_elf_reloc_type_lookup +#define elf_backend_relocate_section mcore_elf_relocate_section +#define elf_backend_gc_mark_hook mcore_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook mcore_elf_gc_sweep_hook +#define elf_backend_check_relocs mcore_elf_check_relocs +#define elf_backend_special_sections mcore_elf_special_sections + +#define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 + +#include "elf32-target.h" diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c new file mode 100644 index 0000000000000..dfe33bd246fbf --- /dev/null +++ b/bfd/elf32-msp430.c @@ -0,0 +1,707 @@ +/* MSP430-specific support for 32-bit ELF + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Contributed by Dmitry Diky + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libiberty.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/msp430.h" + +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); + +static void msp430_info_to_howto_rela + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + +static asection *elf32_msp430_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); + +static bfd_boolean elf32_msp430_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); + +static bfd_boolean elf32_msp430_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); + +static bfd_reloc_status_type msp430_final_link_relocate + PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, bfd_vma)); + +static bfd_boolean elf32_msp430_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); + +static void bfd_elf_msp430_final_write_processing + PARAMS ((bfd *, bfd_boolean)); + +static bfd_boolean elf32_msp430_object_p + PARAMS ((bfd *)); + +static void elf32_msp430_post_process_headers + PARAMS ((bfd *, struct bfd_link_info *)); + +/* Use RELA instead of REL. */ +#undef USE_REL + +static reloc_howto_type elf_msp430_howto_table[] = +{ + HOWTO (R_MSP430_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MSP430_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MSP430_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MSP430_32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 13 bit PC relative relocation. */ + HOWTO (R_MSP430_10_PCREL, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 10, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MSP430_13_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 16 bit absolute relocation. */ + HOWTO (R_MSP430_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MSP430_16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 16 bit absolute relocation for command address. */ + HOWTO (R_MSP430_16_PCREL, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MSP430_16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 16 bit absolute relocation, byte operations. */ + HOWTO (R_MSP430_16_BYTE, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MSP430_16_BYTE", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 16 bit absolute relocation for command address. */ + HOWTO (R_MSP430_16_PCREL_BYTE,/* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MSP430_16_PCREL_BYTE", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE) /* pcrel_offset */ +}; + +/* Map BFD reloc types to MSP430 ELF reloc types. */ + +struct msp430_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned int elf_reloc_val; +}; + +static const struct msp430_reloc_map msp430_reloc_map[] = + { + {BFD_RELOC_NONE, R_MSP430_NONE}, + {BFD_RELOC_32, R_MSP430_32}, + {BFD_RELOC_MSP430_10_PCREL, R_MSP430_10_PCREL}, + {BFD_RELOC_16, R_MSP430_16_BYTE}, + {BFD_RELOC_MSP430_16_PCREL, R_MSP430_16_PCREL}, + {BFD_RELOC_MSP430_16, R_MSP430_16}, + {BFD_RELOC_MSP430_16_PCREL_BYTE, R_MSP430_16_PCREL_BYTE}, + {BFD_RELOC_MSP430_16_BYTE, R_MSP430_16_BYTE} + }; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE (msp430_reloc_map); i++) + if (msp430_reloc_map[i].bfd_reloc_val == code) + return &elf_msp430_howto_table[msp430_reloc_map[i].elf_reloc_val]; + + return NULL; +} + +/* Set the howto pointer for an MSP430 ELF reloc. */ + +static void +msp430_info_to_howto_rela (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_MSP430_max); + cache_ptr->howto = &elf_msp430_howto_table[r_type]; +} + +static asection * +elf32_msp430_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +static bfd_boolean +elf32_msp430_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +{ + /* We don't use got and plt entries for msp430. */ + return TRUE; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static bfd_boolean +elf32_msp430_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = + sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + } + + return TRUE; +} + +/* Perform a single relocation. By default we use the standard BFD + routines, but a few relocs, we have to do them ourselves. */ + +static bfd_reloc_status_type +msp430_final_link_relocate (howto, input_bfd, input_section, + contents, rel, relocation) + reloc_howto_type *howto; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *rel; + bfd_vma relocation; +{ + bfd_reloc_status_type r = bfd_reloc_ok; + bfd_vma x; + bfd_signed_vma srel; + + switch (howto->type) + { + case R_MSP430_10_PCREL: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation; + srel += rel->r_addend; + srel -= rel->r_offset; + srel -= 2; /* Branch instructions add 2 to the PC... */ + srel -= (input_section->output_section->vma + + input_section->output_offset); + + if (srel & 1) + return bfd_reloc_outofrange; + + /* MSP430 addresses commands as words. */ + srel >>= 1; + + /* Check for an overflow. */ + if (srel < -512 || srel > 511) + return bfd_reloc_overflow; + + x = bfd_get_16 (input_bfd, contents); + x = (x & 0xfc00) | (srel & 0x3ff); + bfd_put_16 (input_bfd, x, contents); + break; + + case R_MSP430_16_PCREL: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation; + srel += rel->r_addend; + srel -= rel->r_offset; + /* Only branch instructions add 2 to the PC... */ + srel -= (input_section->output_section->vma + + input_section->output_offset); + + if (srel & 1) + return bfd_reloc_outofrange; + + bfd_put_16 (input_bfd, srel & 0xffff, contents); + break; + + case R_MSP430_16_PCREL_BYTE: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation; + srel += rel->r_addend; + srel -= rel->r_offset; + /* Only branch instructions add 2 to the PC... */ + srel -= (input_section->output_section->vma + + input_section->output_offset); + + bfd_put_16 (input_bfd, srel & 0xffff, contents); + break; + + case R_MSP430_16_BYTE: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation; + srel += rel->r_addend; + bfd_put_16 (input_bfd, srel & 0xffff, contents); + break; + + case R_MSP430_16: + contents += rel->r_offset; + srel = (bfd_signed_vma) relocation; + srel += rel->r_addend; + + if (srel & 1) + return bfd_reloc_notsupported; + + bfd_put_16 (input_bfd, srel & 0xffff, contents); + break; + + default: + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + } + + return r; +} + +/* Relocate an MSP430 ELF section. */ + +static bfd_boolean +elf32_msp430_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + relend = relocs + input_section->reloc_count; + + for (rel = relocs; rel < relend; rel++) + { + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + const char *name = NULL; + int r_type; + + /* This is a final link. */ + + r_type = ELF32_R_TYPE (rel->r_info); + r_symndx = ELF32_R_SYM (rel->r_info); + howto = elf_msp430_howto_table + ELF32_R_TYPE (rel->r_info); + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); + name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + } + else + { + bfd_boolean unresolved_reloc, warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + } + + r = msp430_final_link_relocate (howto, input_bfd, input_section, + contents, rel, relocation); + + if (r != bfd_reloc_ok) + { + const char *msg = (const char *) NULL; + + switch (r) + { + case bfd_reloc_overflow: + r = info->callbacks->reloc_overflow + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset); + break; + + case bfd_reloc_undefined: + r = info->callbacks->undefined_symbol + (info, name, input_bfd, input_section, rel->r_offset, TRUE); + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + break; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + break; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous relocation"); + break; + + default: + msg = _("internal error: unknown error"); + break; + } + + if (msg) + r = info->callbacks->warning + (info, msg, name, input_bfd, input_section, rel->r_offset); + + if (!r) + return FALSE; + } + + } + + return TRUE; +} + +/* The final processing done just before writing out a MSP430 ELF object + file. This gets the MSP430 architecture right based on the machine + number. */ + +static void +bfd_elf_msp430_final_write_processing (abfd, linker) + bfd *abfd; + bfd_boolean linker ATTRIBUTE_UNUSED; +{ + unsigned long val; + + switch (bfd_get_mach (abfd)) + { + default: + case bfd_mach_msp110: + val = E_MSP430_MACH_MSP430x11x1; + break; + + case bfd_mach_msp11: + val = E_MSP430_MACH_MSP430x11; + break; + + case bfd_mach_msp12: + val = E_MSP430_MACH_MSP430x12; + break; + + case bfd_mach_msp13: + val = E_MSP430_MACH_MSP430x13; + break; + + case bfd_mach_msp14: + val = E_MSP430_MACH_MSP430x14; + break; + + case bfd_mach_msp15: + val = E_MSP430_MACH_MSP430x15; + break; + + case bfd_mach_msp16: + val = E_MSP430_MACH_MSP430x16; + break; + + case bfd_mach_msp31: + val = E_MSP430_MACH_MSP430x31; + break; + + case bfd_mach_msp32: + val = E_MSP430_MACH_MSP430x32; + break; + + case bfd_mach_msp33: + val = E_MSP430_MACH_MSP430x33; + break; + + case bfd_mach_msp41: + val = E_MSP430_MACH_MSP430x41; + break; + + case bfd_mach_msp42: + val = E_MSP430_MACH_MSP430x42; + break; + + case bfd_mach_msp43: + val = E_MSP430_MACH_MSP430x43; + break; + + case bfd_mach_msp44: + val = E_MSP430_MACH_MSP430x44; + break; + } + + elf_elfheader (abfd)->e_machine = EM_MSP430; + elf_elfheader (abfd)->e_flags &= ~EF_MSP430_MACH; + elf_elfheader (abfd)->e_flags |= val; +} + +/* Set the right machine number. */ + +static bfd_boolean +elf32_msp430_object_p (abfd) + bfd *abfd; +{ + int e_set = bfd_mach_msp14; + + if (elf_elfheader (abfd)->e_machine == EM_MSP430 + || elf_elfheader (abfd)->e_machine == EM_MSP430_OLD) + { + int e_mach = elf_elfheader (abfd)->e_flags & EF_MSP430_MACH; + + switch (e_mach) + { + default: + case E_MSP430_MACH_MSP430x11: + e_set = bfd_mach_msp11; + break; + + case E_MSP430_MACH_MSP430x11x1: + e_set = bfd_mach_msp110; + break; + + case E_MSP430_MACH_MSP430x12: + e_set = bfd_mach_msp12; + break; + + case E_MSP430_MACH_MSP430x13: + e_set = bfd_mach_msp13; + break; + + case E_MSP430_MACH_MSP430x14: + e_set = bfd_mach_msp14; + break; + + case E_MSP430_MACH_MSP430x15: + e_set = bfd_mach_msp15; + break; + + case E_MSP430_MACH_MSP430x16: + e_set = bfd_mach_msp16; + break; + + case E_MSP430_MACH_MSP430x31: + e_set = bfd_mach_msp31; + break; + + case E_MSP430_MACH_MSP430x32: + e_set = bfd_mach_msp32; + break; + + case E_MSP430_MACH_MSP430x33: + e_set = bfd_mach_msp33; + break; + + case E_MSP430_MACH_MSP430x41: + e_set = bfd_mach_msp41; + break; + + case E_MSP430_MACH_MSP430x42: + e_set = bfd_mach_msp42; + break; + + case E_MSP430_MACH_MSP430x43: + e_set = bfd_mach_msp43; + break; + + case E_MSP430_MACH_MSP430x44: + e_set = bfd_mach_msp44; + break; + } + } + + return bfd_default_set_arch_mach (abfd, bfd_arch_msp430, e_set); +} + +static void +elf32_msp430_post_process_headers (abfd, link_info) + bfd *abfd; + struct bfd_link_info *link_info ATTRIBUTE_UNUSED; +{ + Elf_Internal_Ehdr *i_ehdrp; /* ELF file header, internal form. */ + + i_ehdrp = elf_elfheader (abfd); + +#ifndef ELFOSABI_STANDALONE +#define ELFOSABI_STANDALONE 255 +#endif + + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_STANDALONE; +} + + +#define ELF_ARCH bfd_arch_msp430 +#define ELF_MACHINE_CODE EM_MSP430 +#define ELF_MACHINE_ALT1 EM_MSP430_OLD +#define ELF_MAXPAGESIZE 1 + +#define TARGET_LITTLE_SYM bfd_elf32_msp430_vec +#define TARGET_LITTLE_NAME "elf32-msp430" + +#define elf_info_to_howto msp430_info_to_howto_rela +#define elf_info_to_howto_rel NULL +#define elf_backend_relocate_section elf32_msp430_relocate_section +#define elf_backend_gc_mark_hook elf32_msp430_gc_mark_hook +#define elf_backend_gc_sweep_hook elf32_msp430_gc_sweep_hook +#define elf_backend_check_relocs elf32_msp430_check_relocs +#define elf_backend_can_gc_sections 1 +#define elf_backend_final_write_processing bfd_elf_msp430_final_write_processing +#define elf_backend_object_p elf32_msp430_object_p +#define elf_backend_post_process_headers elf32_msp430_post_process_headers + +#include "elf32-target.h" diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c new file mode 100644 index 0000000000000..af1c2221f8cec --- /dev/null +++ b/bfd/elf32-openrisc.c @@ -0,0 +1,613 @@ +/* OpenRISC-specific support for 32-bit ELF. + Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Contributed by Johan Rydberg, jrydberg@opencores.org + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/openrisc.h" +#include "libiberty.h" + +/* Forward declarations. */ + +static reloc_howto_type *openrisc_reloc_type_lookup + PARAMS ((bfd * , bfd_reloc_code_real_type)); +static void openrisc_info_to_howto_rela + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static bfd_boolean openrisc_elf_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static bfd_reloc_status_type openrisc_final_link_relocate + PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, bfd_vma)); +static bfd_boolean openrisc_elf_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static asection * openrisc_elf_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static bfd_boolean openrisc_elf_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static bfd_boolean openrisc_elf_object_p + PARAMS ((bfd *)); +static void openrisc_elf_final_write_processing + PARAMS ((bfd *, bfd_boolean)); + + +static reloc_howto_type openrisc_elf_howto_table[] = + { + /* This reloc does nothing. */ + HOWTO (R_OPENRISC_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_OPENRISC_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A PC relative 26 bit relocation, right shifted by 2. */ + HOWTO (R_OPENRISC_INSN_REL_26, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_OPENRISC_INSN_REL_26", /* name */ + FALSE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0x03ffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A absolute 26 bit relocation, right shifted by 2. */ + HOWTO (R_OPENRISC_INSN_ABS_26, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_OPENRISC_INSN_ABS_26", /* name */ + FALSE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0x03ffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_OPENRISC_LO_16_IN_INSN, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_OPENRISC_LO_16_IN_INSN", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_OPENRISC_HI_16_IN_INSN, /* type */ + 16, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_OPENRISC_HI_16_IN_INSN", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 8 bit absolute relocation. */ + HOWTO (R_OPENRISC_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_OPENRISC_8", /* name */ + TRUE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0x00ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 16 bit absolute relocation. */ + HOWTO (R_OPENRISC_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_OPENRISC_16", /* name */ + TRUE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit absolute relocation. */ + HOWTO (R_OPENRISC_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_OPENRISC_32", /* name */ + TRUE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_OPENRISC_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_OPENRISC_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_OPENRISC_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_OPENRISC_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; + +/* Map BFD reloc types to OpenRISC ELF reloc types. */ + +struct openrisc_reloc_map + { + bfd_reloc_code_real_type bfd_reloc_val; + unsigned int openrisc_reloc_val; + }; + +static const struct openrisc_reloc_map openrisc_reloc_map[] = + { + { BFD_RELOC_NONE, R_OPENRISC_NONE }, + { BFD_RELOC_32, R_OPENRISC_32 }, + { BFD_RELOC_16, R_OPENRISC_16 }, + { BFD_RELOC_8, R_OPENRISC_8 }, + { BFD_RELOC_OPENRISC_REL_26,R_OPENRISC_INSN_REL_26 }, + { BFD_RELOC_OPENRISC_ABS_26,R_OPENRISC_INSN_ABS_26 }, + { BFD_RELOC_HI16, R_OPENRISC_HI_16_IN_INSN }, + { BFD_RELOC_LO16, R_OPENRISC_LO_16_IN_INSN }, + { BFD_RELOC_VTABLE_INHERIT, R_OPENRISC_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_OPENRISC_GNU_VTENTRY } + }; + +static reloc_howto_type * +openrisc_reloc_type_lookup (abfd, code) + bfd * abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = ARRAY_SIZE (openrisc_reloc_map); --i;) + if (openrisc_reloc_map[i].bfd_reloc_val == code) + return & openrisc_elf_howto_table[openrisc_reloc_map[i]. + openrisc_reloc_val]; + + return NULL; +} + +/* Set the howto pointer for an OpenRISC ELF reloc. */ + +static void +openrisc_info_to_howto_rela (abfd, cache_ptr, dst) + bfd * abfd ATTRIBUTE_UNUSED; + arelent * cache_ptr; + Elf_Internal_Rela * dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_OPENRISC_max); + cache_ptr->howto = & openrisc_elf_howto_table[r_type]; +} + +/* Perform a single relocation. By default we use the standard BFD + routines, but a few relocs, we have to do them ourselves. */ + +static bfd_reloc_status_type +openrisc_final_link_relocate (howto, input_bfd, input_section, contents, rel, + relocation) + reloc_howto_type *howto; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *rel; + bfd_vma relocation; +{ + bfd_reloc_status_type r = bfd_reloc_ok; + + switch (howto->type) + { + case R_OPENRISC_LO_16_IN_INSN: + relocation &= 0xffff; + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + break; + + default: + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + } + + return r; +} + +/* Relocate an OpenRISC ELF section. + + The RELOCATE_SECTION function is called by the new ELF backend linker + to handle the relocations for a section. + + The relocs are always passed as Rela structures; if the section + actually uses Rel structures, the r_addend field will always be + zero. + + This function is responsible for adjusting the section contents as + necessary, and (if using Rela relocs and generating a relocatable + output file) adjusting the reloc addend as necessary. + + This function does not have to worry about setting the reloc + address or the reloc symbol index. + + LOCAL_SYMS is a pointer to the swapped in local symbols. + + LOCAL_SECTIONS is an array giving the section in the input file + corresponding to the st_shndx field of each local symbol. + + The global hash table entry for the global symbols can be found + via elf_sym_hashes (input_bfd). + + When generating relocatable output, this function must handle + STB_LOCAL/STT_SECTION symbols specially. The output symbol is + going to be the section symbol corresponding to the output + section, which means that the addend must be adjusted + accordingly. */ + +static bfd_boolean +openrisc_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + relend = relocs + input_section->reloc_count; + + for (rel = relocs; rel < relend; rel++) + { + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + const char *name = NULL; + int r_type; + + r_type = ELF32_R_TYPE (rel->r_info); + r_symndx = ELF32_R_SYM (rel->r_info); + + if (r_type == R_OPENRISC_GNU_VTINHERIT + || r_type == R_OPENRISC_GNU_VTENTRY) + continue; + + if ((unsigned int) r_type > + (sizeof openrisc_elf_howto_table / sizeof (reloc_howto_type))) + abort (); + + /* This is a final link. */ + howto = openrisc_elf_howto_table + ELF32_R_TYPE (rel->r_info); + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); + name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + } + else + { + bfd_boolean unresolved_reloc, warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + } + + r = openrisc_final_link_relocate (howto, input_bfd, input_section, + contents, rel, relocation); + + if (r != bfd_reloc_ok) + { + const char *msg = (const char *) NULL; + + switch (r) + { + case bfd_reloc_overflow: + r = info->callbacks->reloc_overflow + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset); + break; + + case bfd_reloc_undefined: + r = info->callbacks->undefined_symbol + (info, name, input_bfd, input_section, rel->r_offset, TRUE); + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + break; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + break; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous relocation"); + break; + + default: + msg = _("internal error: unknown error"); + break; + } + + if (msg) + r = info->callbacks->warning + (info, msg, name, input_bfd, input_section, rel->r_offset); + + if (!r) + return FALSE; + } + } + + return TRUE; +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +openrisc_elf_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_OPENRISC_GNU_VTINHERIT: + case R_OPENRISC_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the got entry reference counts for the section being removed. */ + +static bfd_boolean +openrisc_elf_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +{ + return TRUE; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static bfd_boolean +openrisc_elf_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = + sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + switch (ELF32_R_TYPE (rel->r_info)) + { + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_OPENRISC_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_OPENRISC_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + } + } + + return TRUE; +} + +/* Set the right machine number. */ + +static bfd_boolean +openrisc_elf_object_p (abfd) + bfd *abfd; +{ + switch (elf_elfheader (abfd)->e_flags & 0xf) + { + default: + (void) bfd_default_set_arch_mach (abfd, bfd_arch_openrisc, 0); + break; + } + return TRUE; +} + +/* Store the machine number in the flags field. */ + +static void +openrisc_elf_final_write_processing (abfd, linker) + bfd *abfd; + bfd_boolean linker ATTRIBUTE_UNUSED; +{ + unsigned long val; + + switch (bfd_get_mach (abfd)) + { + default: + val = 0; + break; + } + + elf_elfheader (abfd)->e_flags &= ~0xf; + elf_elfheader (abfd)->e_flags |= val; +} + + +#define ELF_ARCH bfd_arch_openrisc +#define ELF_MACHINE_CODE EM_OPENRISC +#define ELF_MACHINE_ALT1 EM_OPENRISC_OLD +#define ELF_MAXPAGESIZE 0x1000 + +#define TARGET_BIG_SYM bfd_elf32_openrisc_vec +#define TARGET_BIG_NAME "elf32-openrisc" + +#define elf_info_to_howto_rel NULL +#define elf_info_to_howto openrisc_info_to_howto_rela +#define elf_backend_relocate_section openrisc_elf_relocate_section +#define elf_backend_gc_mark_hook openrisc_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook openrisc_elf_gc_sweep_hook +#define elf_backend_check_relocs openrisc_elf_check_relocs + +#define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 + +#define bfd_elf32_bfd_reloc_type_lookup openrisc_reloc_type_lookup + +#define elf_backend_object_p openrisc_elf_object_p +#define elf_backend_final_write_processing openrisc_elf_final_write_processing + +#include "elf32-target.h" diff --git a/bfd/elf32-or32.c b/bfd/elf32-or32.c new file mode 100644 index 0000000000000..65f8e2617d3fb --- /dev/null +++ b/bfd/elf32-or32.c @@ -0,0 +1,552 @@ +/* OR32-specific support for 32-bit ELF + Copyright 2002 Free Software Foundation, Inc. + Contributed by Ivan Guzvinec + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/or32.h" +#include "libiberty.h" + +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void or32_info_to_howto_rel + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static bfd_boolean or32_elf_object_p + PARAMS ((bfd *)); +static void or32_elf_final_write_processing + PARAMS ((bfd *, bfd_boolean)); +static bfd_reloc_status_type or32_elf_32_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type or32_elf_16_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type or32_elf_8_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type or32_elf_const_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type or32_elf_consth_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_reloc_status_type or32_elf_jumptarg_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + +/* Try to minimize the amount of space occupied by relocation tables + on the ROM (not that the ROM won't be swamped by other ELF overhead). */ +#define USE_REL 1 + +static reloc_howto_type elf_or32_howto_table[] = +{ + /* This reloc does nothing. */ + HOWTO (R_OR32_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_OR32_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A standard 32 bit relocation. */ + HOWTO (R_OR32_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + or32_elf_32_reloc, /* special_function */ + "R_OR32_32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A standard 16 bit relocation. */ + HOWTO (R_OR32_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + or32_elf_16_reloc, /* special_function */ + "R_OR32_16", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A standard 8 bit relocation. */ + HOWTO (R_OR32_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + or32_elf_8_reloc, /* special_function */ + "R_OR32_8", /* name */ + FALSE, /* partial_inplace */ + 0x000000ff, /* src_mask */ + 0x000000ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A standard low 16 bit relocation. */ + HOWTO (R_OR32_CONST, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + or32_elf_const_reloc, /* special_function */ + "R_OR32_CONST", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A standard high 16 bit relocation. */ + HOWTO (R_OR32_CONSTH, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + or32_elf_consth_reloc, /* special_function */ + "R_OR32_CONSTH", /* name */ + FALSE, /* partial_inplace */ + 0xffff0000, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A standard branch relocation. */ + HOWTO (R_OR32_JUMPTARG, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 28, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + or32_elf_jumptarg_reloc,/* special_function */ + "R_OR32_JUMPTARG", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x03ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy. */ + HOWTO (R_OR32_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_OR32_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage. */ + HOWTO (R_OR32_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_OR32_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; + +/* Map BFD reloc types to OR32 ELF reloc types. */ + +struct or32_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +static const struct or32_reloc_map or32_reloc_map[] = +{ + { BFD_RELOC_NONE, R_OR32_NONE }, + { BFD_RELOC_32, R_OR32_32 }, + { BFD_RELOC_16, R_OR32_16 }, + { BFD_RELOC_8, R_OR32_8 }, + { BFD_RELOC_LO16, R_OR32_CONST }, + { BFD_RELOC_HI16, R_OR32_CONSTH }, + { BFD_RELOC_32_GOT_PCREL, R_OR32_JUMPTARG }, + { BFD_RELOC_VTABLE_INHERIT, R_OR32_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_OR32_GNU_VTENTRY }, +}; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = ARRAY_SIZE (or32_reloc_map); i--;) + { + if (or32_reloc_map[i].bfd_reloc_val == code) + return &elf_or32_howto_table[or32_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Set the howto pointer for an OR32 ELF reloc. */ + +static void +or32_info_to_howto_rel (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_OR32_max); + cache_ptr->howto = &elf_or32_howto_table[r_type]; +} + +/* Set the right machine number for an OR32 ELF file. */ + +static bfd_boolean +or32_elf_object_p (abfd) + bfd *abfd; +{ + (void) bfd_default_set_arch_mach (abfd, bfd_arch_or32, 0); + return TRUE; +} + +/* The final processing done just before writing out an OR32 ELF object file. + This gets the OR32 architecture right based on the machine number. */ + +static void +or32_elf_final_write_processing (abfd, linker) + bfd *abfd; + bfd_boolean linker ATTRIBUTE_UNUSED; +{ + int mach; + unsigned long val; + + switch (mach = bfd_get_mach (abfd)) + { + /* + case bfd_mach_arc_base: + val = E_OR32_MACH_BASE; + break; + */ + default: + val = 0; + return; + } + + elf_elfheader (abfd)->e_flags &=~ EF_OR32_MACH; + elf_elfheader (abfd)->e_flags |= val; +} + +bfd_reloc_status_type +or32_elf_32_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + if (output_bfd != (bfd *) NULL) + { + unsigned long insn; + bfd_size_type addr = reloc_entry->address; + + reloc_entry->address += input_section->output_offset; + + insn = bfd_get_32 (abfd, (bfd_byte *) data + addr); + insn += symbol->section->output_section->vma; + insn += symbol->section->output_offset; + insn += symbol->value; + bfd_put_32 (abfd, insn, (bfd_byte *) data + addr); + + return bfd_reloc_ok; + } + + return bfd_reloc_continue; +} + +bfd_reloc_status_type +or32_elf_16_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + if (output_bfd != (bfd *) NULL) + { + unsigned short insn; + bfd_size_type addr = reloc_entry->address; + + reloc_entry->address += input_section->output_offset; + + insn = bfd_get_16 (abfd, (bfd_byte *) data + addr); + insn += symbol->section->output_section->vma; + insn += symbol->section->output_offset; + insn += symbol->value; + bfd_put_16 (abfd, insn, (bfd_byte *) data + addr); + + return bfd_reloc_ok; + } + + return bfd_reloc_continue; +} + +bfd_reloc_status_type +or32_elf_8_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + if (output_bfd != (bfd *) NULL) + { + unsigned char insn; + bfd_size_type addr = reloc_entry->address; + + reloc_entry->address += input_section->output_offset; + + insn = bfd_get_8 (abfd, (bfd_byte *) data + addr); + insn += symbol->section->output_section->vma; + insn += symbol->section->output_offset; + insn += symbol->value; + bfd_put_8 (abfd, insn, (bfd_byte *) data + addr); + + return bfd_reloc_ok; + } + + return bfd_reloc_continue; +} + +/* Do a R_OR32_CONSTH relocation. This has to be done in combination + with a R_OR32_CONST reloc, because there is a carry from the LO16 to + the HI16. Here we just save the information we need; we do the + actual relocation when we see the LO16. OR32 ELF requires that the + LO16 immediately follow the HI16. As a GNU extension, we permit an + arbitrary number of HI16 relocs to be associated with a single LO16 + reloc. This extension permits gcc to output the HI and LO relocs + itself. This code is copied from the elf32-mips.c. */ + +struct or32_consth +{ + struct or32_consth *next; + bfd_byte *addr; + bfd_vma addend; +}; + +/* FIXME: This should not be a static variable. */ + +static struct or32_consth *or32_consth_list; + +bfd_reloc_status_type +or32_elf_consth_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + bfd_reloc_status_type ret; + bfd_vma relocation; + struct or32_consth *n; + + ret = bfd_reloc_ok; + + if (bfd_is_und_section (symbol->section) + && output_bfd == (bfd *) NULL) + ret = bfd_reloc_undefined; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + /* Save the information, and let LO16 do the actual relocation. */ + n = (struct or32_consth *) bfd_malloc (sizeof *n); + if (n == NULL) + return bfd_reloc_outofrange; + n->addr = (bfd_byte *) data + reloc_entry->address; + n->addend = relocation; + n->next = or32_consth_list; + or32_consth_list = n; + + if (output_bfd != (bfd *) NULL) + reloc_entry->address += input_section->output_offset; + + return ret; +} + +/* Do a R_OR32_CONST relocation. This is a straightforward 16 bit + inplace relocation; this function exists in order to do the + R_OR32_CONSTH relocation described above. */ + +bfd_reloc_status_type +or32_elf_const_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + if (or32_consth_list != NULL) + { + struct or32_consth *l; + + l = or32_consth_list; + while (l != NULL) + { + unsigned long insn; + unsigned long val; + unsigned long vallo; + struct or32_consth *next; + + /* Do the HI16 relocation. Note that we actually don't need + to know anything about the LO16 itself, except where to + find the low 16 bits of the addend needed by the LO16. */ + insn = bfd_get_32 (abfd, l->addr); + vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) + & 0xffff); + val = ((insn & 0xffff) << 16) + vallo; + val += l->addend; + + insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff); + bfd_put_32 (abfd, insn, l->addr); + + next = l->next; + free (l); + l = next; + } + + or32_consth_list = NULL; + } + + if (output_bfd != (bfd *) NULL) + { + unsigned long insn, tmp; + bfd_size_type addr = reloc_entry->address; + + reloc_entry->address += input_section->output_offset; + + insn = bfd_get_32 (abfd, (bfd_byte *) data + addr); + tmp = insn & 0x0000ffff; + tmp += symbol->section->output_section->vma; + tmp += symbol->section->output_offset; + tmp += symbol->value; + insn = (insn & 0xffff0000) | (tmp & 0x0000ffff); + bfd_put_32 (abfd, insn, (bfd_byte *) data + addr); + + return bfd_reloc_ok; + } + + /* Now do the LO16 reloc in the usual way. */ + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); +} + +bfd_reloc_status_type +or32_elf_jumptarg_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol ATTRIBUTE_UNUSED; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + if (output_bfd != (bfd *) NULL) + { + unsigned long insn, tmp; + bfd_size_type addr = reloc_entry->address; + + reloc_entry->address += input_section->output_offset; + + insn = bfd_get_32 (abfd, (bfd_byte *) data + addr); + tmp = insn | 0xfc000000; + tmp -= (input_section->output_offset >> 2); + insn = (insn & 0xfc000000) | (tmp & 0x03ffffff); + bfd_put_32 (abfd, insn, (bfd_byte *) data + addr); + + return bfd_reloc_ok; + } + + return bfd_reloc_continue; +} + +#define TARGET_LITTLE_SYM bfd_elf32_or32_little_vec +#define TARGET_LITTLE_NAME "elf32-littleor32" +#define TARGET_BIG_SYM bfd_elf32_or32_big_vec +#define TARGET_BIG_NAME "elf32-or32" +#define ELF_ARCH bfd_arch_or32 +#define ELF_MACHINE_CODE EM_OR32 +#define ELF_MAXPAGESIZE 0x1000 + +#define elf_info_to_howto 0 +#define elf_info_to_howto_rel or32_info_to_howto_rel +#define elf_backend_object_p or32_elf_object_p +#define elf_backend_final_write_processing \ + or32_elf_final_write_processing + +#include "elf32-target.h" diff --git a/bfd/elf32-pj.c b/bfd/elf32-pj.c new file mode 100644 index 0000000000000..c8127931a2a78 --- /dev/null +++ b/bfd/elf32-pj.c @@ -0,0 +1,349 @@ +/* picoJava specific support for 32-bit ELF + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Contributed by Steve Chamberlan of Transmeta (sac@pobox.com). + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/pj.h" + +static bfd_reloc_status_type pj_elf_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static reloc_howto_type *pj_elf_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void pj_elf_info_to_howto + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static void pj_elf_final_write_processing + PARAMS ((bfd *, bfd_boolean)); + +static reloc_howto_type pj_elf_howto_table[] = +{ + /* No relocation. */ + HOWTO (R_PJ_NONE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + pj_elf_reloc, /* special_function */ + "R_PJ_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit absolute relocation. Setting partial_inplace to TRUE and + src_mask to a non-zero value is similar to the COFF toolchain. */ + HOWTO (R_PJ_DATA_DIR32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + pj_elf_reloc, /* special_function */ + "R_PJ_DIR32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit PC relative relocation. */ + HOWTO (R_PJ_CODE_REL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + pj_elf_reloc, /* special_function */ + "R_PJ_REL32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + +/* 16 bit PC relative relocation. */ + HOWTO (R_PJ_CODE_REL16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overf6w */ + pj_elf_reloc, /* special_function */ + "R_PJ_REL16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + EMPTY_HOWTO (4), + EMPTY_HOWTO (5), + HOWTO (R_PJ_CODE_DIR32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + pj_elf_reloc, /* special_function */ + "R_PJ_CODE_DIR32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (7), + EMPTY_HOWTO (8), + EMPTY_HOWTO (9), + EMPTY_HOWTO (10), + EMPTY_HOWTO (11), + EMPTY_HOWTO (12), + + HOWTO (R_PJ_CODE_LO16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + pj_elf_reloc, /* special_function */ + "R_PJ_LO16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_PJ_CODE_HI16, /* type */ + 16, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + pj_elf_reloc, /* special_function */ + "R_PJ_HI16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_PJ_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_PJ_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_PJ_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_PJ_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; + +/* This function is used for normal relocs. This is like the COFF + function, and is almost certainly incorrect for other ELF targets. */ + +static bfd_reloc_status_type +pj_elf_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, + error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol_in; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + unsigned long insn; + bfd_vma sym_value; + enum elf_pj_reloc_type r_type; + bfd_vma addr = reloc_entry->address; + bfd_byte *hit_data = addr + (bfd_byte *) data; + + r_type = (enum elf_pj_reloc_type) reloc_entry->howto->type; + + if (output_bfd != NULL) + { + /* Partial linking--do nothing. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (symbol_in != NULL + && bfd_is_und_section (symbol_in->section)) + return bfd_reloc_undefined; + + if (bfd_is_com_section (symbol_in->section)) + sym_value = 0; + else + sym_value = (symbol_in->value + + symbol_in->section->output_section->vma + + symbol_in->section->output_offset); + + switch (r_type) + { + case R_PJ_DATA_DIR32: + insn = bfd_get_32 (abfd, hit_data); + insn += sym_value + reloc_entry->addend; + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); + break; + + /* Relocations in code are always bigendian, no matter what the + data endianness is. */ + + case R_PJ_CODE_DIR32: + insn = bfd_getb32 (hit_data); + insn += sym_value + reloc_entry->addend; + bfd_putb32 ((bfd_vma) insn, hit_data); + break; + + case R_PJ_CODE_REL16: + insn = bfd_getb16 (hit_data); + insn += sym_value + reloc_entry->addend + - (input_section->output_section->vma + + input_section->output_offset); + bfd_putb16 ((bfd_vma) insn, hit_data); + break; + case R_PJ_CODE_LO16: + insn = bfd_getb16 (hit_data); + insn += sym_value + reloc_entry->addend; + bfd_putb16 ((bfd_vma) insn, hit_data); + break; + + case R_PJ_CODE_HI16: + insn = bfd_getb16 (hit_data); + insn += (sym_value + reloc_entry->addend) >> 16; + bfd_putb16 ((bfd_vma) insn, hit_data); + break; + + default: + abort (); + break; + } + + return bfd_reloc_ok; +} + +/* This structure is used to map BFD reloc codes to PJ ELF relocs. */ + +struct elf_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +/* An array mapping BFD reloc codes to PJ ELF relocs. */ + +static const struct elf_reloc_map pj_reloc_map[] = +{ + { BFD_RELOC_NONE, R_PJ_NONE }, + { BFD_RELOC_32, R_PJ_DATA_DIR32 }, + { BFD_RELOC_PJ_CODE_DIR16, R_PJ_CODE_DIR16 }, + { BFD_RELOC_PJ_CODE_DIR32, R_PJ_CODE_DIR32 }, + { BFD_RELOC_PJ_CODE_LO16, R_PJ_CODE_LO16 }, + { BFD_RELOC_PJ_CODE_HI16, R_PJ_CODE_HI16 }, + { BFD_RELOC_PJ_CODE_REL32, R_PJ_CODE_REL32 }, + { BFD_RELOC_PJ_CODE_REL16, R_PJ_CODE_REL16 }, + { BFD_RELOC_VTABLE_INHERIT, R_PJ_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_PJ_GNU_VTENTRY }, +}; + +/* Given a BFD reloc code, return the howto structure for the + corresponding PJ ELf reloc. */ + +static reloc_howto_type * +pj_elf_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; i < sizeof (pj_reloc_map) / sizeof (struct elf_reloc_map); i++) + { + if (pj_reloc_map[i].bfd_reloc_val == code) + return &pj_elf_howto_table[(int) pj_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Given an ELF reloc, fill in the howto field of a relent. */ + +static void +pj_elf_info_to_howto (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r; + + r = ELF32_R_TYPE (dst->r_info); + + BFD_ASSERT (r < (unsigned int) R_PJ_max); + + cache_ptr->howto = &pj_elf_howto_table[r]; +} + +/* Take this moment to fill in the special picoJava bits in the + e_flags field. */ + +static void +pj_elf_final_write_processing (abfd, linker) + bfd *abfd; + bfd_boolean linker ATTRIBUTE_UNUSED; +{ + elf_elfheader (abfd)->e_flags |= EF_PICOJAVA_ARCH; + elf_elfheader (abfd)->e_flags |= EF_PICOJAVA_GNUCALLS; +} + +#define TARGET_BIG_SYM bfd_elf32_pj_vec +#define TARGET_BIG_NAME "elf32-pj" +#define TARGET_LITTLE_SYM bfd_elf32_pjl_vec +#define TARGET_LITTLE_NAME "elf32-pjl" +#define ELF_ARCH bfd_arch_pj +#define ELF_MACHINE_CODE EM_PJ +#define ELF_MACHINE_ALT1 EM_PJ_OLD +#define ELF_MAXPAGESIZE 0x1000 +#define bfd_elf32_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents +#define bfd_elf32_bfd_reloc_type_lookup pj_elf_reloc_type_lookup +#define elf_backend_final_write_processing pj_elf_final_write_processing +#define elf_info_to_howto pj_elf_info_to_howto +#include "elf32-target.h" diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c new file mode 100644 index 0000000000000..a3b13145099e3 --- /dev/null +++ b/bfd/elf32-sh.c @@ -0,0 +1,7577 @@ +/* Renesas / SuperH SH specific support for 32-bit ELF + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Contributed by Ian Lance Taylor, Cygnus Support. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/sh.h" + +static bfd_reloc_status_type sh_elf_reloc + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +static bfd_reloc_status_type sh_elf_ignore_reloc + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +static reloc_howto_type *sh_elf_reloc_type_lookup + (bfd *, bfd_reloc_code_real_type); +static void sh_elf_info_to_howto + (bfd *, arelent *, Elf_Internal_Rela *); +static bfd_boolean sh_elf_set_private_flags + (bfd *, flagword); +static bfd_boolean sh_elf_copy_private_data + (bfd *, bfd *); +static bfd_boolean sh_elf_merge_private_data + (bfd *, bfd *); +static bfd_boolean sh_elf_set_mach_from_flags + (bfd *); +static bfd_boolean sh_elf_relax_section + (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); +static bfd_boolean sh_elf_relax_delete_bytes + (bfd *, asection *, bfd_vma, int); +static bfd_boolean sh_elf_align_loads + (bfd *, asection *, Elf_Internal_Rela *, bfd_byte *, bfd_boolean *); +static bfd_boolean sh_elf_swap_insns + (bfd *, asection *, void *, bfd_byte *, bfd_vma); +static bfd_boolean sh_elf_relocate_section + (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); +static bfd_byte *sh_elf_get_relocated_section_contents + (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, + bfd_boolean, asymbol **); +static void sh_elf_copy_indirect_symbol + (const struct elf_backend_data *, struct elf_link_hash_entry *, + struct elf_link_hash_entry *); +static int sh_elf_optimized_tls_reloc + (struct bfd_link_info *, int, int); +static bfd_boolean sh_elf_mkobject + (bfd *); +static bfd_boolean sh_elf_object_p + (bfd *); +static bfd_boolean sh_elf_check_relocs + (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); +static struct bfd_hash_entry *sh_elf_link_hash_newfunc + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); +static struct bfd_link_hash_table *sh_elf_link_hash_table_create + (bfd *); +static bfd_boolean sh_elf_adjust_dynamic_symbol + (struct bfd_link_info *, struct elf_link_hash_entry *); +static bfd_boolean sh_elf_size_dynamic_sections + (bfd *, struct bfd_link_info *); +static bfd_boolean sh_elf_finish_dynamic_symbol + (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *); +static bfd_boolean sh_elf_finish_dynamic_sections + (bfd *, struct bfd_link_info *); +static bfd_reloc_status_type sh_elf_reloc_loop + (int, bfd *, asection *, bfd_byte *, bfd_vma, asection *, bfd_vma, + bfd_vma); +static bfd_boolean create_got_section + (bfd *, struct bfd_link_info *); +static bfd_boolean sh_elf_create_dynamic_sections + (bfd *, struct bfd_link_info *); +static bfd_vma dtpoff_base + (struct bfd_link_info *); +static bfd_vma tpoff + (struct bfd_link_info *, bfd_vma); +static asection * sh_elf_gc_mark_hook + (asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *); +static bfd_boolean sh_elf_gc_sweep_hook + (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); +static bfd_boolean allocate_dynrelocs + (struct elf_link_hash_entry *, void *); +static bfd_boolean readonly_dynrelocs + (struct elf_link_hash_entry *, void *); +static enum elf_reloc_type_class sh_elf_reloc_type_class + (const Elf_Internal_Rela *); +#ifdef INCLUDE_SHMEDIA +inline static void movi_shori_putval (bfd *, unsigned long, char *); +#endif +static bfd_boolean elf32_shlin_grok_prstatus + (bfd *abfd, Elf_Internal_Note *note); +static bfd_boolean elf32_shlin_grok_psinfo + (bfd *abfd, Elf_Internal_Note *note); + +/* The name of the dynamic interpreter. This is put in the .interp + section. */ + +#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1" + +static reloc_howto_type sh_elf_howto_table[] = +{ + /* No relocation. */ + HOWTO (R_SH_NONE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit absolute relocation. Setting partial_inplace to TRUE and + src_mask to a non-zero value is similar to the COFF toolchain. */ + HOWTO (R_SH_DIR32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_elf_reloc, /* special_function */ + "R_SH_DIR32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit PC relative relocation. */ + HOWTO (R_SH_REL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_REL32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit PC relative branch divided by 2. */ + HOWTO (R_SH_DIR8WPN, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DIR8WPN", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 12 bit PC relative branch divided by 2. */ + /* This cannot be partial_inplace because relaxation can't know the + eventual value of a symbol. */ + HOWTO (R_SH_IND12W, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + NULL, /* special_function */ + "R_SH_IND12W", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0xfff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit unsigned PC relative divided by 4. */ + HOWTO (R_SH_DIR8WPL, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DIR8WPL", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit unsigned PC relative divided by 2. */ + HOWTO (R_SH_DIR8WPZ, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DIR8WPZ", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit GBR relative. FIXME: This only makes sense if we have some + special symbol for the GBR relative area, and that is not + implemented. */ + HOWTO (R_SH_DIR8BP, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DIR8BP", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit GBR relative divided by 2. FIXME: This only makes sense if + we have some special symbol for the GBR relative area, and that + is not implemented. */ + HOWTO (R_SH_DIR8W, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DIR8W", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit GBR relative divided by 4. FIXME: This only makes sense if + we have some special symbol for the GBR relative area, and that + is not implemented. */ + HOWTO (R_SH_DIR8L, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DIR8L", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit PC relative divided by 2 - but specified in a very odd way. */ + HOWTO (R_SH_LOOP_START, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_LOOP_START", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit PC relative divided by 2 - but specified in a very odd way. */ + HOWTO (R_SH_LOOP_END, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_LOOP_END", /* name */ + TRUE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + EMPTY_HOWTO (12), + EMPTY_HOWTO (13), + EMPTY_HOWTO (14), + EMPTY_HOWTO (15), + EMPTY_HOWTO (16), + EMPTY_HOWTO (17), + EMPTY_HOWTO (18), + EMPTY_HOWTO (19), + EMPTY_HOWTO (20), + EMPTY_HOWTO (21), + + /* The remaining relocs are a GNU extension used for relaxing. The + final pass of the linker never needs to do anything with any of + these relocs. Any required operations are handled by the + relaxation code. */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_SH_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_SH_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_SH_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_SH_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 8 bit switch table entry. This is generated for an expression + such as ``.word L1 - L2''. The offset holds the difference + between the reloc address and L2. */ + HOWTO (R_SH_SWITCH8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_SWITCH8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 16 bit switch table entry. This is generated for an expression + such as ``.word L1 - L2''. The offset holds the difference + between the reloc address and L2. */ + HOWTO (R_SH_SWITCH16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_SWITCH16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 32 bit switch table entry. This is generated for an expression + such as ``.long L1 - L2''. The offset holds the difference + between the reloc address and L2. */ + HOWTO (R_SH_SWITCH32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_SWITCH32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Indicates a .uses pseudo-op. The compiler will generate .uses + pseudo-ops when it finds a function call which can be relaxed. + The offset field holds the PC relative offset to the instruction + which loads the register used in the function call. */ + HOWTO (R_SH_USES, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_USES", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The assembler will generate this reloc for addresses referred to + by the register loads associated with USES relocs. The offset + field holds the number of times the address is referenced in the + object file. */ + HOWTO (R_SH_COUNT, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_COUNT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Indicates an alignment statement. The offset field is the power + of 2 to which subsequent portions of the object file must be + aligned. */ + HOWTO (R_SH_ALIGN, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_ALIGN", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The assembler will generate this reloc before a block of + instructions. A section should be processed as assuming it + contains data, unless this reloc is seen. */ + HOWTO (R_SH_CODE, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_CODE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The assembler will generate this reloc after a block of + instructions when it sees data that is not instructions. */ + HOWTO (R_SH_DATA, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_DATA", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The assembler generates this reloc for each label within a block + of instructions. This permits the linker to avoid swapping + instructions which are the targets of branches. */ + HOWTO (R_SH_LABEL, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_LABEL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The next 12 are only supported via linking in SHC-generated objects. */ + HOWTO (R_SH_DIR16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8UL, /* type */ + 2, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8UL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8UW, /* type */ + 1, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8UW", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8U, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8U", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8SW, /* type */ + 1, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8SW", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR8S, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR8S", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR4UL, /* type */ + 2, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 4, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR4UL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR4UW, /* type */ + 1, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 4, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR4UW", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_DIR4U, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 4, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR4U", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_PSHA, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 7, /* bitsize */ + FALSE, /* pc_relative */ + 4, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PSHA", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_PSHL, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 7, /* bitsize */ + FALSE, /* pc_relative */ + 4, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PSHL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + +#ifdef INCLUDE_SHMEDIA + /* Used in SHLLI.L and SHLRI.L. */ + HOWTO (R_SH_DIR5U, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 5, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR5U", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in SHARI, SHLLI et al. */ + HOWTO (R_SH_DIR6U, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR6U", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in BxxI, LDHI.L et al. */ + HOWTO (R_SH_DIR6S, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR6S", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in ADDI, ANDI et al. */ + HOWTO (R_SH_DIR10S, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 10, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10S", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in LD.UW, ST.W et al. */ + HOWTO (R_SH_DIR10SW, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 11, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SW", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_DIR10SL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_DIR10SQ, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SQ", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + +#else + EMPTY_HOWTO (45), + EMPTY_HOWTO (46), + EMPTY_HOWTO (47), + EMPTY_HOWTO (48), + EMPTY_HOWTO (49), + EMPTY_HOWTO (50), + EMPTY_HOWTO (51), +#endif + + EMPTY_HOWTO (52), + + HOWTO (R_SH_DIR16S, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR16S", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (54), + EMPTY_HOWTO (55), + EMPTY_HOWTO (56), + EMPTY_HOWTO (57), + EMPTY_HOWTO (58), + EMPTY_HOWTO (59), + EMPTY_HOWTO (60), + EMPTY_HOWTO (61), + EMPTY_HOWTO (62), + EMPTY_HOWTO (63), + EMPTY_HOWTO (64), + EMPTY_HOWTO (65), + EMPTY_HOWTO (66), + EMPTY_HOWTO (67), + EMPTY_HOWTO (68), + EMPTY_HOWTO (69), + EMPTY_HOWTO (70), + EMPTY_HOWTO (71), + EMPTY_HOWTO (72), + EMPTY_HOWTO (73), + EMPTY_HOWTO (74), + EMPTY_HOWTO (75), + EMPTY_HOWTO (76), + EMPTY_HOWTO (77), + EMPTY_HOWTO (78), + EMPTY_HOWTO (79), + EMPTY_HOWTO (80), + EMPTY_HOWTO (81), + EMPTY_HOWTO (82), + EMPTY_HOWTO (83), + EMPTY_HOWTO (84), + EMPTY_HOWTO (85), + EMPTY_HOWTO (86), + EMPTY_HOWTO (87), + EMPTY_HOWTO (88), + EMPTY_HOWTO (89), + EMPTY_HOWTO (90), + EMPTY_HOWTO (91), + EMPTY_HOWTO (92), + EMPTY_HOWTO (93), + EMPTY_HOWTO (94), + EMPTY_HOWTO (95), + EMPTY_HOWTO (96), + EMPTY_HOWTO (97), + EMPTY_HOWTO (98), + EMPTY_HOWTO (99), + EMPTY_HOWTO (100), + EMPTY_HOWTO (101), + EMPTY_HOWTO (102), + EMPTY_HOWTO (103), + EMPTY_HOWTO (104), + EMPTY_HOWTO (105), + EMPTY_HOWTO (106), + EMPTY_HOWTO (107), + EMPTY_HOWTO (108), + EMPTY_HOWTO (109), + EMPTY_HOWTO (110), + EMPTY_HOWTO (111), + EMPTY_HOWTO (112), + EMPTY_HOWTO (113), + EMPTY_HOWTO (114), + EMPTY_HOWTO (115), + EMPTY_HOWTO (116), + EMPTY_HOWTO (117), + EMPTY_HOWTO (118), + EMPTY_HOWTO (119), + EMPTY_HOWTO (120), + EMPTY_HOWTO (121), + EMPTY_HOWTO (122), + EMPTY_HOWTO (123), + EMPTY_HOWTO (124), + EMPTY_HOWTO (125), + EMPTY_HOWTO (126), + EMPTY_HOWTO (127), + EMPTY_HOWTO (128), + EMPTY_HOWTO (129), + EMPTY_HOWTO (130), + EMPTY_HOWTO (131), + EMPTY_HOWTO (132), + EMPTY_HOWTO (133), + EMPTY_HOWTO (134), + EMPTY_HOWTO (135), + EMPTY_HOWTO (136), + EMPTY_HOWTO (137), + EMPTY_HOWTO (138), + EMPTY_HOWTO (139), + EMPTY_HOWTO (140), + EMPTY_HOWTO (141), + EMPTY_HOWTO (142), + EMPTY_HOWTO (143), + + HOWTO (R_SH_TLS_GD_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_GD_32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_LD_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_LD_32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_LDO_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_LDO_32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_IE_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_IE_32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_LE_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_LE_32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_DTPMOD32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_DTPMOD32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_DTPOFF32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_DTPOFF32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_TLS_TPOFF32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_TLS_TPOFF32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (152), + EMPTY_HOWTO (153), + EMPTY_HOWTO (154), + EMPTY_HOWTO (155), + EMPTY_HOWTO (156), + EMPTY_HOWTO (157), + EMPTY_HOWTO (158), + EMPTY_HOWTO (159), + + HOWTO (R_SH_GOT32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_GOT32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_PLT32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_PLT32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_SH_COPY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_COPY", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_GLOB_DAT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_GLOB_DAT", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_JMP_SLOT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_JMP_SLOT", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_RELATIVE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_RELATIVE", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_GOTOFF, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_GOTOFF", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_GOTPC, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_GOTPC", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_SH_GOTPLT32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* */ + "R_SH_GOTPLT32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + +#ifdef INCLUDE_SHMEDIA + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTPLT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTPLT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTPLT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTPLT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_PLT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_PLT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_PLT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_PLT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTOFF_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTOFF_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTOFF_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTOFF_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTPC_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTPC_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTPC_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTPC_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_GOT10BY4, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT10BY4", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_GOTPLT10BY4, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT10BY4", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_GOT10BY8, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT10BY8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_GOTPLT10BY8, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT10BY8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_COPY64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_COPY64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_GLOB_DAT64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GLOB_DAT64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_JMP_SLOT64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_JMP_SLOT64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_RELATIVE64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_RELATIVE64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (197), + EMPTY_HOWTO (198), + EMPTY_HOWTO (199), + EMPTY_HOWTO (200), + EMPTY_HOWTO (201), + EMPTY_HOWTO (202), + EMPTY_HOWTO (203), + EMPTY_HOWTO (204), + EMPTY_HOWTO (205), + EMPTY_HOWTO (206), + EMPTY_HOWTO (207), + EMPTY_HOWTO (208), + EMPTY_HOWTO (209), + EMPTY_HOWTO (210), + EMPTY_HOWTO (211), + EMPTY_HOWTO (212), + EMPTY_HOWTO (213), + EMPTY_HOWTO (214), + EMPTY_HOWTO (215), + EMPTY_HOWTO (216), + EMPTY_HOWTO (217), + EMPTY_HOWTO (218), + EMPTY_HOWTO (219), + EMPTY_HOWTO (220), + EMPTY_HOWTO (221), + EMPTY_HOWTO (222), + EMPTY_HOWTO (223), + EMPTY_HOWTO (224), + EMPTY_HOWTO (225), + EMPTY_HOWTO (226), + EMPTY_HOWTO (227), + EMPTY_HOWTO (228), + EMPTY_HOWTO (229), + EMPTY_HOWTO (230), + EMPTY_HOWTO (231), + EMPTY_HOWTO (232), + EMPTY_HOWTO (233), + EMPTY_HOWTO (234), + EMPTY_HOWTO (235), + EMPTY_HOWTO (236), + EMPTY_HOWTO (237), + EMPTY_HOWTO (238), + EMPTY_HOWTO (239), + EMPTY_HOWTO (240), + EMPTY_HOWTO (241), + + /* Relocations for SHmedia code. None of these are partial_inplace or + use the field being relocated (except R_SH_PT_16). */ + + /* The assembler will generate this reloc before a block of SHmedia + instructions. A section should be processed as assuming it contains + data, unless this reloc is seen. Note that a block of SHcompact + instructions are instead preceded by R_SH_CODE. + This is currently not implemented, but should be used for SHmedia + linker relaxation. */ + HOWTO (R_SH_SHMEDIA_CODE, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf_ignore_reloc, /* special_function */ + "R_SH_SHMEDIA_CODE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The assembler will generate this reloc at a PTA or PTB instruction, + and the linker checks the right type of target, or changes a PTA to a + PTB, if the original insn was PT. */ + HOWTO (R_SH_PT_16, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 18, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PT_16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in unexpanded MOVI. */ + HOWTO (R_SH_IMMS16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMMS16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in SHORI. */ + HOWTO (R_SH_IMMU16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMMU16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_IMM_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x - $) & 65536). */ + HOWTO (R_SH_IMM_LOW16_PCREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_LOW16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_IMM_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 16) & 65536). */ + HOWTO (R_SH_IMM_MEDLOW16_PCREL, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDLOW16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_IMM_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 32) & 65536). */ + HOWTO (R_SH_IMM_MEDHI16_PCREL, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDHI16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_IMM_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 48) & 65536). */ + HOWTO (R_SH_IMM_HI16_PCREL, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_HI16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* For the .uaquad pseudo. */ + HOWTO (R_SH_64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* For the .uaquad pseudo, (x - $). */ + HOWTO (R_SH_64_PCREL, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_64_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + TRUE), /* pcrel_offset */ + +#endif +}; + +static bfd_reloc_status_type +sh_elf_reloc_loop (int r_type ATTRIBUTE_UNUSED, bfd *input_bfd, + asection *input_section, bfd_byte *contents, + bfd_vma addr, asection *symbol_section, + bfd_vma start, bfd_vma end) +{ + static bfd_vma last_addr; + static asection *last_symbol_section; + bfd_byte *start_ptr, *ptr, *last_ptr; + int diff, cum_diff; + bfd_signed_vma x; + int insn; + + /* Sanity check the address. */ + if (addr > input_section->_raw_size) + return bfd_reloc_outofrange; + + /* We require the start and end relocations to be processed consecutively - + although we allow then to be processed forwards or backwards. */ + if (! last_addr) + { + last_addr = addr; + last_symbol_section = symbol_section; + return bfd_reloc_ok; + } + if (last_addr != addr) + abort (); + last_addr = 0; + + if (! symbol_section || last_symbol_section != symbol_section || end < start) + return bfd_reloc_outofrange; + + /* Get the symbol_section contents. */ + if (symbol_section != input_section) + { + if (elf_section_data (symbol_section)->this_hdr.contents != NULL) + contents = elf_section_data (symbol_section)->this_hdr.contents; + else + { + contents = (bfd_byte *) bfd_malloc (symbol_section->_raw_size); + if (contents == NULL) + return bfd_reloc_outofrange; + if (! bfd_get_section_contents (input_bfd, symbol_section, contents, + (file_ptr) 0, + symbol_section->_raw_size)) + { + free (contents); + return bfd_reloc_outofrange; + } + } + } +#define IS_PPI(PTR) ((bfd_get_16 (input_bfd, (PTR)) & 0xfc00) == 0xf800) + start_ptr = contents + start; + for (cum_diff = -6, ptr = contents + end; cum_diff < 0 && ptr > start_ptr;) + { + for (last_ptr = ptr, ptr -= 4; ptr >= start_ptr && IS_PPI (ptr);) + ptr -= 2; + ptr += 2; + diff = (last_ptr - ptr) >> 1; + cum_diff += diff & 1; + cum_diff += diff; + } + /* Calculate the start / end values to load into rs / re minus four - + so that will cancel out the four we would otherwise have to add to + addr to get the value to subtract in order to get relative addressing. */ + if (cum_diff >= 0) + { + start -= 4; + end = (ptr + cum_diff * 2) - contents; + } + else + { + bfd_vma start0 = start - 4; + + while (start0 && IS_PPI (contents + start0)) + start0 -= 2; + start0 = start - 2 - ((start - start0) & 2); + start = start0 - cum_diff - 2; + end = start0; + } + + if (contents != NULL + && elf_section_data (symbol_section)->this_hdr.contents != contents) + free (contents); + + insn = bfd_get_16 (input_bfd, contents + addr); + + x = (insn & 0x200 ? end : start) - addr; + if (input_section != symbol_section) + x += ((symbol_section->output_section->vma + symbol_section->output_offset) + - (input_section->output_section->vma + + input_section->output_offset)); + x >>= 1; + if (x < -128 || x > 127) + return bfd_reloc_overflow; + + x = (insn & ~0xff) | (x & 0xff); + bfd_put_16 (input_bfd, (bfd_vma) x, contents + addr); + + return bfd_reloc_ok; +} + +/* This function is used for normal relocs. This used to be like the COFF + function, and is almost certainly incorrect for other ELF targets. */ + +static bfd_reloc_status_type +sh_elf_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol_in, + void *data, asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + unsigned long insn; + bfd_vma sym_value; + enum elf_sh_reloc_type r_type; + bfd_vma addr = reloc_entry->address; + bfd_byte *hit_data = addr + (bfd_byte *) data; + + r_type = (enum elf_sh_reloc_type) reloc_entry->howto->type; + + if (output_bfd != NULL) + { + /* Partial linking--do nothing. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* Almost all relocs have to do with relaxing. If any work must be + done for them, it has been done in sh_relax_section. */ + if (r_type == R_SH_IND12W && (symbol_in->flags & BSF_LOCAL) != 0) + return bfd_reloc_ok; + + if (symbol_in != NULL + && bfd_is_und_section (symbol_in->section)) + return bfd_reloc_undefined; + + if (bfd_is_com_section (symbol_in->section)) + sym_value = 0; + else + sym_value = (symbol_in->value + + symbol_in->section->output_section->vma + + symbol_in->section->output_offset); + + switch (r_type) + { + case R_SH_DIR32: + insn = bfd_get_32 (abfd, hit_data); + insn += sym_value + reloc_entry->addend; + bfd_put_32 (abfd, (bfd_vma) insn, hit_data); + break; + case R_SH_IND12W: + insn = bfd_get_16 (abfd, hit_data); + sym_value += reloc_entry->addend; + sym_value -= (input_section->output_section->vma + + input_section->output_offset + + addr + + 4); + sym_value += (insn & 0xfff) << 1; + if (insn & 0x800) + sym_value -= 0x1000; + insn = (insn & 0xf000) | (sym_value & 0xfff); + bfd_put_16 (abfd, (bfd_vma) insn, hit_data); + if (sym_value < (bfd_vma) -0x1000 || sym_value >= 0x1000) + return bfd_reloc_overflow; + break; + default: + abort (); + break; + } + + return bfd_reloc_ok; +} + +/* This function is used for relocs which are only used for relaxing, + which the linker should otherwise ignore. */ + +static bfd_reloc_status_type +sh_elf_ignore_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED, asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + if (output_bfd != NULL) + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; +} + +/* This structure is used to map BFD reloc codes to SH ELF relocs. */ + +struct elf_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +/* An array mapping BFD reloc codes to SH ELF relocs. */ + +static const struct elf_reloc_map sh_reloc_map[] = +{ + { BFD_RELOC_NONE, R_SH_NONE }, + { BFD_RELOC_32, R_SH_DIR32 }, + { BFD_RELOC_16, R_SH_DIR16 }, + { BFD_RELOC_8, R_SH_DIR8 }, + { BFD_RELOC_CTOR, R_SH_DIR32 }, + { BFD_RELOC_32_PCREL, R_SH_REL32 }, + { BFD_RELOC_SH_PCDISP8BY2, R_SH_DIR8WPN }, + { BFD_RELOC_SH_PCDISP12BY2, R_SH_IND12W }, + { BFD_RELOC_SH_PCRELIMM8BY2, R_SH_DIR8WPZ }, + { BFD_RELOC_SH_PCRELIMM8BY4, R_SH_DIR8WPL }, + { BFD_RELOC_8_PCREL, R_SH_SWITCH8 }, + { BFD_RELOC_SH_SWITCH16, R_SH_SWITCH16 }, + { BFD_RELOC_SH_SWITCH32, R_SH_SWITCH32 }, + { BFD_RELOC_SH_USES, R_SH_USES }, + { BFD_RELOC_SH_COUNT, R_SH_COUNT }, + { BFD_RELOC_SH_ALIGN, R_SH_ALIGN }, + { BFD_RELOC_SH_CODE, R_SH_CODE }, + { BFD_RELOC_SH_DATA, R_SH_DATA }, + { BFD_RELOC_SH_LABEL, R_SH_LABEL }, + { BFD_RELOC_VTABLE_INHERIT, R_SH_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_SH_GNU_VTENTRY }, + { BFD_RELOC_SH_LOOP_START, R_SH_LOOP_START }, + { BFD_RELOC_SH_LOOP_END, R_SH_LOOP_END }, + { BFD_RELOC_SH_TLS_GD_32, R_SH_TLS_GD_32 }, + { BFD_RELOC_SH_TLS_LD_32, R_SH_TLS_LD_32 }, + { BFD_RELOC_SH_TLS_LDO_32, R_SH_TLS_LDO_32 }, + { BFD_RELOC_SH_TLS_IE_32, R_SH_TLS_IE_32 }, + { BFD_RELOC_SH_TLS_LE_32, R_SH_TLS_LE_32 }, + { BFD_RELOC_SH_TLS_DTPMOD32, R_SH_TLS_DTPMOD32 }, + { BFD_RELOC_SH_TLS_DTPOFF32, R_SH_TLS_DTPOFF32 }, + { BFD_RELOC_SH_TLS_TPOFF32, R_SH_TLS_TPOFF32 }, + { BFD_RELOC_32_GOT_PCREL, R_SH_GOT32 }, + { BFD_RELOC_32_PLT_PCREL, R_SH_PLT32 }, + { BFD_RELOC_SH_COPY, R_SH_COPY }, + { BFD_RELOC_SH_GLOB_DAT, R_SH_GLOB_DAT }, + { BFD_RELOC_SH_JMP_SLOT, R_SH_JMP_SLOT }, + { BFD_RELOC_SH_RELATIVE, R_SH_RELATIVE }, + { BFD_RELOC_32_GOTOFF, R_SH_GOTOFF }, + { BFD_RELOC_SH_GOTPC, R_SH_GOTPC }, + { BFD_RELOC_SH_GOTPLT32, R_SH_GOTPLT32 }, +#ifdef INCLUDE_SHMEDIA + { BFD_RELOC_SH_GOT_LOW16, R_SH_GOT_LOW16 }, + { BFD_RELOC_SH_GOT_MEDLOW16, R_SH_GOT_MEDLOW16 }, + { BFD_RELOC_SH_GOT_MEDHI16, R_SH_GOT_MEDHI16 }, + { BFD_RELOC_SH_GOT_HI16, R_SH_GOT_HI16 }, + { BFD_RELOC_SH_GOTPLT_LOW16, R_SH_GOTPLT_LOW16 }, + { BFD_RELOC_SH_GOTPLT_MEDLOW16, R_SH_GOTPLT_MEDLOW16 }, + { BFD_RELOC_SH_GOTPLT_MEDHI16, R_SH_GOTPLT_MEDHI16 }, + { BFD_RELOC_SH_GOTPLT_HI16, R_SH_GOTPLT_HI16 }, + { BFD_RELOC_SH_PLT_LOW16, R_SH_PLT_LOW16 }, + { BFD_RELOC_SH_PLT_MEDLOW16, R_SH_PLT_MEDLOW16 }, + { BFD_RELOC_SH_PLT_MEDHI16, R_SH_PLT_MEDHI16 }, + { BFD_RELOC_SH_PLT_HI16, R_SH_PLT_HI16 }, + { BFD_RELOC_SH_GOTOFF_LOW16, R_SH_GOTOFF_LOW16 }, + { BFD_RELOC_SH_GOTOFF_MEDLOW16, R_SH_GOTOFF_MEDLOW16 }, + { BFD_RELOC_SH_GOTOFF_MEDHI16, R_SH_GOTOFF_MEDHI16 }, + { BFD_RELOC_SH_GOTOFF_HI16, R_SH_GOTOFF_HI16 }, + { BFD_RELOC_SH_GOTPC_LOW16, R_SH_GOTPC_LOW16 }, + { BFD_RELOC_SH_GOTPC_MEDLOW16, R_SH_GOTPC_MEDLOW16 }, + { BFD_RELOC_SH_GOTPC_MEDHI16, R_SH_GOTPC_MEDHI16 }, + { BFD_RELOC_SH_GOTPC_HI16, R_SH_GOTPC_HI16 }, + { BFD_RELOC_SH_COPY64, R_SH_COPY64 }, + { BFD_RELOC_SH_GLOB_DAT64, R_SH_GLOB_DAT64 }, + { BFD_RELOC_SH_JMP_SLOT64, R_SH_JMP_SLOT64 }, + { BFD_RELOC_SH_RELATIVE64, R_SH_RELATIVE64 }, + { BFD_RELOC_SH_GOT10BY4, R_SH_GOT10BY4 }, + { BFD_RELOC_SH_GOT10BY8, R_SH_GOT10BY8 }, + { BFD_RELOC_SH_GOTPLT10BY4, R_SH_GOTPLT10BY4 }, + { BFD_RELOC_SH_GOTPLT10BY8, R_SH_GOTPLT10BY8 }, + { BFD_RELOC_SH_PT_16, R_SH_PT_16 }, + { BFD_RELOC_SH_SHMEDIA_CODE, R_SH_SHMEDIA_CODE }, + { BFD_RELOC_SH_IMMU5, R_SH_DIR5U }, + { BFD_RELOC_SH_IMMS6, R_SH_DIR6S }, + { BFD_RELOC_SH_IMMU6, R_SH_DIR6U }, + { BFD_RELOC_SH_IMMS10, R_SH_DIR10S }, + { BFD_RELOC_SH_IMMS10BY2, R_SH_DIR10SW }, + { BFD_RELOC_SH_IMMS10BY4, R_SH_DIR10SL }, + { BFD_RELOC_SH_IMMS10BY8, R_SH_DIR10SQ }, + { BFD_RELOC_SH_IMMS16, R_SH_IMMS16 }, + { BFD_RELOC_SH_IMMU16, R_SH_IMMU16 }, + { BFD_RELOC_SH_IMM_LOW16, R_SH_IMM_LOW16 }, + { BFD_RELOC_SH_IMM_LOW16_PCREL, R_SH_IMM_LOW16_PCREL }, + { BFD_RELOC_SH_IMM_MEDLOW16, R_SH_IMM_MEDLOW16 }, + { BFD_RELOC_SH_IMM_MEDLOW16_PCREL, R_SH_IMM_MEDLOW16_PCREL }, + { BFD_RELOC_SH_IMM_MEDHI16, R_SH_IMM_MEDHI16 }, + { BFD_RELOC_SH_IMM_MEDHI16_PCREL, R_SH_IMM_MEDHI16_PCREL }, + { BFD_RELOC_SH_IMM_HI16, R_SH_IMM_HI16 }, + { BFD_RELOC_SH_IMM_HI16_PCREL, R_SH_IMM_HI16_PCREL }, + { BFD_RELOC_64, R_SH_64 }, + { BFD_RELOC_64_PCREL, R_SH_64_PCREL }, +#endif /* not INCLUDE_SHMEDIA */ +}; + +/* Given a BFD reloc code, return the howto structure for the + corresponding SH ELf reloc. */ + +static reloc_howto_type * +sh_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + unsigned int i; + + for (i = 0; i < sizeof (sh_reloc_map) / sizeof (struct elf_reloc_map); i++) + { + if (sh_reloc_map[i].bfd_reloc_val == code) + return &sh_elf_howto_table[(int) sh_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Given an ELF reloc, fill in the howto field of a relent. */ + +static void +sh_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, + Elf_Internal_Rela *dst) +{ + unsigned int r; + + r = ELF32_R_TYPE (dst->r_info); + + BFD_ASSERT (r < (unsigned int) R_SH_max); + BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC || r > R_SH_LAST_INVALID_RELOC); + BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_2 || r > R_SH_LAST_INVALID_RELOC_2); + BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_3 || r > R_SH_LAST_INVALID_RELOC_3); + BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_4 || r > R_SH_LAST_INVALID_RELOC_4); + BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_5 || r > R_SH_LAST_INVALID_RELOC_5); + + cache_ptr->howto = &sh_elf_howto_table[r]; +} + +/* This function handles relaxing for SH ELF. See the corresponding + function in coff-sh.c for a description of what this does. FIXME: + There is a lot of duplication here between this code and the COFF + specific code. The format of relocs and symbols is wound deeply + into this code, but it would still be better if the duplication + could be eliminated somehow. Note in particular that although both + functions use symbols like R_SH_CODE, those symbols have different + values; in coff-sh.c they come from include/coff/sh.h, whereas here + they come from enum elf_sh_reloc_type in include/elf/sh.h. */ + +static bfd_boolean +sh_elf_relax_section (bfd *abfd, asection *sec, + struct bfd_link_info *link_info, bfd_boolean *again) +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *internal_relocs; + bfd_boolean have_code; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *contents = NULL; + Elf_Internal_Sym *isymbuf = NULL; + + *again = FALSE; + + if (link_info->relocatable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0) + return TRUE; + +#ifdef INCLUDE_SHMEDIA + if (elf_section_data (sec)->this_hdr.sh_flags + & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) + { + return TRUE; + } +#endif + + /* If this is the first time we have been called for this section, + initialize the cooked size. */ + if (sec->_cooked_size == 0) + sec->_cooked_size = sec->_raw_size; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + internal_relocs = (_bfd_elf_link_read_relocs + (abfd, sec, NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + + have_code = FALSE; + + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma laddr, paddr, symval; + unsigned short insn; + Elf_Internal_Rela *irelfn, *irelscan, *irelcount; + bfd_signed_vma foff; + + if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_CODE) + have_code = TRUE; + + if (ELF32_R_TYPE (irel->r_info) != (int) R_SH_USES) + continue; + + /* Get the section contents. */ + if (contents == NULL) + { + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + /* The r_addend field of the R_SH_USES reloc will point us to + the register load. The 4 is because the r_addend field is + computed as though it were a jump offset, which are based + from 4 bytes after the jump instruction. */ + laddr = irel->r_offset + 4 + irel->r_addend; + if (laddr >= sec->_raw_size) + { + (*_bfd_error_handler) (_("%s: 0x%lx: warning: bad R_SH_USES offset"), + bfd_archive_filename (abfd), + (unsigned long) irel->r_offset); + continue; + } + insn = bfd_get_16 (abfd, contents + laddr); + + /* If the instruction is not mov.l NN,rN, we don't know what to + do. */ + if ((insn & 0xf000) != 0xd000) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x"), + bfd_archive_filename (abfd), (unsigned long) irel->r_offset, insn)); + continue; + } + + /* Get the address from which the register is being loaded. The + displacement in the mov.l instruction is quadrupled. It is a + displacement from four bytes after the movl instruction, but, + before adding in the PC address, two least significant bits + of the PC are cleared. We assume that the section is aligned + on a four byte boundary. */ + paddr = insn & 0xff; + paddr *= 4; + paddr += (laddr + 4) &~ (bfd_vma) 3; + if (paddr >= sec->_raw_size) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: warning: bad R_SH_USES load offset"), + bfd_archive_filename (abfd), (unsigned long) irel->r_offset)); + continue; + } + + /* Get the reloc for the address from which the register is + being loaded. This reloc will tell us which function is + actually being called. */ + for (irelfn = internal_relocs; irelfn < irelend; irelfn++) + if (irelfn->r_offset == paddr + && ELF32_R_TYPE (irelfn->r_info) == (int) R_SH_DIR32) + break; + if (irelfn >= irelend) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: warning: could not find expected reloc"), + bfd_archive_filename (abfd), (unsigned long) paddr)); + continue; + } + + /* Read this BFD's symbols if we haven't done so already. */ + if (isymbuf == NULL && symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irelfn->r_info) < symtab_hdr->sh_info) + { + /* A local symbol. */ + Elf_Internal_Sym *isym; + + isym = isymbuf + ELF32_R_SYM (irelfn->r_info); + if (isym->st_shndx + != (unsigned int) _bfd_elf_section_from_bfd_section (abfd, sec)) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: warning: symbol in unexpected section"), + bfd_archive_filename (abfd), (unsigned long) paddr)); + continue; + } + + symval = (isym->st_value + + sec->output_section->vma + + sec->output_offset); + } + else + { + unsigned long indx; + struct elf_link_hash_entry *h; + + indx = ELF32_R_SYM (irelfn->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + { + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + continue; + } + + symval = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + + symval += bfd_get_32 (abfd, contents + paddr); + + /* See if this function call can be shortened. */ + foff = (symval + - (irel->r_offset + + sec->output_section->vma + + sec->output_offset + + 4)); + if (foff < -0x1000 || foff >= 0x1000) + { + /* After all that work, we can't shorten this function call. */ + continue; + } + + /* Shorten the function call. */ + + /* For simplicity of coding, we are going to modify the section + contents, the section relocs, and the BFD symbol table. We + must tell the rest of the code not to free up this + information. It would be possible to instead create a table + of changes which have to be made, as is done in coff-mips.c; + that would be more work, but would require less memory when + the linker is run. */ + + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + + /* Replace the jsr with a bsr. */ + + /* Change the R_SH_USES reloc into an R_SH_IND12W reloc, and + replace the jsr with a bsr. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irelfn->r_info), R_SH_IND12W); + /* We used to test (ELF32_R_SYM (irelfn->r_info) < symtab_hdr->sh_info) + here, but that only checks if the symbol is an external symbol, + not if the symbol is in a different section. Besides, we need + a consistent meaning for the relocation, so we just assume here that + the value of the symbol is not available. */ +#if 0 + if (ELF32_R_SYM (irelfn->r_info) < symtab_hdr->sh_info) + { + /* If this needs to be changed because of future relaxing, + it will be handled here like other internal IND12W + relocs. */ + bfd_put_16 (abfd, + (bfd_vma) 0xb000 | ((foff >> 1) & 0xfff), + contents + irel->r_offset); + } + else +#endif + { + /* We can't fully resolve this yet, because the external + symbol value may be changed by future relaxing. We let + the final link phase handle it. */ + bfd_put_16 (abfd, (bfd_vma) 0xb000, contents + irel->r_offset); + } + irel->r_addend = -4; + + /* See if there is another R_SH_USES reloc referring to the same + register load. */ + for (irelscan = internal_relocs; irelscan < irelend; irelscan++) + if (ELF32_R_TYPE (irelscan->r_info) == (int) R_SH_USES + && laddr == irelscan->r_offset + 4 + irelscan->r_addend) + break; + if (irelscan < irelend) + { + /* Some other function call depends upon this register load, + and we have not yet converted that function call. + Indeed, we may never be able to convert it. There is + nothing else we can do at this point. */ + continue; + } + + /* Look for a R_SH_COUNT reloc on the location where the + function address is stored. Do this before deleting any + bytes, to avoid confusion about the address. */ + for (irelcount = internal_relocs; irelcount < irelend; irelcount++) + if (irelcount->r_offset == paddr + && ELF32_R_TYPE (irelcount->r_info) == (int) R_SH_COUNT) + break; + + /* Delete the register load. */ + if (! sh_elf_relax_delete_bytes (abfd, sec, laddr, 2)) + goto error_return; + + /* That will change things, so, just in case it permits some + other function call to come within range, we should relax + again. Note that this is not required, and it may be slow. */ + *again = TRUE; + + /* Now check whether we got a COUNT reloc. */ + if (irelcount >= irelend) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: warning: could not find expected COUNT reloc"), + bfd_archive_filename (abfd), (unsigned long) paddr)); + continue; + } + + /* The number of uses is stored in the r_addend field. We've + just deleted one. */ + if (irelcount->r_addend == 0) + { + ((*_bfd_error_handler) (_("%s: 0x%lx: warning: bad count"), + bfd_archive_filename (abfd), + (unsigned long) paddr)); + continue; + } + + --irelcount->r_addend; + + /* If there are no more uses, we can delete the address. Reload + the address from irelfn, in case it was changed by the + previous call to sh_elf_relax_delete_bytes. */ + if (irelcount->r_addend == 0) + { + if (! sh_elf_relax_delete_bytes (abfd, sec, irelfn->r_offset, 4)) + goto error_return; + } + + /* We've done all we can with that function call. */ + } + + /* Look for load and store instructions that we can align on four + byte boundaries. */ + if ((elf_elfheader (abfd)->e_flags & EF_SH_MACH_MASK) != EF_SH4 + && have_code) + { + bfd_boolean swapped; + + /* Get the section contents. */ + if (contents == NULL) + { + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + if (! sh_elf_align_loads (abfd, sec, internal_relocs, contents, + &swapped)) + goto error_return; + + if (swapped) + { + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + } + } + + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + { + if (! link_info->keep_memory) + free (isymbuf); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) isymbuf; + } + } + + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + { + if (! link_info->keep_memory) + free (contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + } + + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + return TRUE; + + error_return: + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + free (contents); + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + return FALSE; +} + +/* Delete some bytes from a section while relaxing. FIXME: There is a + lot of duplication between this function and sh_relax_delete_bytes + in coff-sh.c. */ + +static bfd_boolean +sh_elf_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, + int count) +{ + Elf_Internal_Shdr *symtab_hdr; + unsigned int sec_shndx; + bfd_byte *contents; + Elf_Internal_Rela *irel, *irelend; + Elf_Internal_Rela *irelalign; + bfd_vma toaddr; + Elf_Internal_Sym *isymbuf, *isym, *isymend; + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry **end_hashes; + unsigned int symcount; + asection *o; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + + sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + contents = elf_section_data (sec)->this_hdr.contents; + + /* The deletion must stop at the next ALIGN reloc for an aligment + power larger than the number of bytes we are deleting. */ + + irelalign = NULL; + toaddr = sec->_cooked_size; + + irel = elf_section_data (sec)->relocs; + irelend = irel + sec->reloc_count; + for (; irel < irelend; irel++) + { + if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_ALIGN + && irel->r_offset > addr + && count < (1 << irel->r_addend)) + { + irelalign = irel; + toaddr = irel->r_offset; + break; + } + } + + /* Actually delete the bytes. */ + memmove (contents + addr, contents + addr + count, + (size_t) (toaddr - addr - count)); + if (irelalign == NULL) + sec->_cooked_size -= count; + else + { + int i; + +#define NOP_OPCODE (0x0009) + + BFD_ASSERT ((count & 1) == 0); + for (i = 0; i < count; i += 2) + bfd_put_16 (abfd, (bfd_vma) NOP_OPCODE, contents + toaddr - count + i); + } + + /* Adjust all the relocs. */ + for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) + { + bfd_vma nraddr, stop; + bfd_vma start = 0; + int insn = 0; + int off, adjust, oinsn; + bfd_signed_vma voff = 0; + bfd_boolean overflow; + + /* Get the new reloc address. */ + nraddr = irel->r_offset; + if ((irel->r_offset > addr + && irel->r_offset < toaddr) + || (ELF32_R_TYPE (irel->r_info) == (int) R_SH_ALIGN + && irel->r_offset == toaddr)) + nraddr -= count; + + /* See if this reloc was for the bytes we have deleted, in which + case we no longer care about it. Don't delete relocs which + represent addresses, though. */ + if (irel->r_offset >= addr + && irel->r_offset < addr + count + && ELF32_R_TYPE (irel->r_info) != (int) R_SH_ALIGN + && ELF32_R_TYPE (irel->r_info) != (int) R_SH_CODE + && ELF32_R_TYPE (irel->r_info) != (int) R_SH_DATA + && ELF32_R_TYPE (irel->r_info) != (int) R_SH_LABEL) + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + (int) R_SH_NONE); + + /* If this is a PC relative reloc, see if the range it covers + includes the bytes we have deleted. */ + switch ((enum elf_sh_reloc_type) ELF32_R_TYPE (irel->r_info)) + { + default: + break; + + case R_SH_DIR8WPN: + case R_SH_IND12W: + case R_SH_DIR8WPZ: + case R_SH_DIR8WPL: + start = irel->r_offset; + insn = bfd_get_16 (abfd, contents + nraddr); + break; + } + + switch ((enum elf_sh_reloc_type) ELF32_R_TYPE (irel->r_info)) + { + default: + start = stop = addr; + break; + + case R_SH_DIR32: + /* If this reloc is against a symbol defined in this + section, and the symbol will not be adjusted below, we + must check the addend to see it will put the value in + range to be adjusted, and hence must be changed. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + isym = isymbuf + ELF32_R_SYM (irel->r_info); + if (isym->st_shndx == sec_shndx + && (isym->st_value <= addr + || isym->st_value >= toaddr)) + { + bfd_vma val; + + val = bfd_get_32 (abfd, contents + nraddr); + val += isym->st_value; + if (val > addr && val < toaddr) + bfd_put_32 (abfd, val - count, contents + nraddr); + } + } + start = stop = addr; + break; + + case R_SH_DIR8WPN: + off = insn & 0xff; + if (off & 0x80) + off -= 0x100; + stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); + break; + + case R_SH_IND12W: + off = insn & 0xfff; + if (! off) + { + /* This has been made by previous relaxation. Since the + relocation will be against an external symbol, the + final relocation will just do the right thing. */ + start = stop = addr; + } + else + { + if (off & 0x800) + off -= 0x1000; + stop = (bfd_vma) ((bfd_signed_vma) start + 4 + off * 2); + + /* The addend will be against the section symbol, thus + for adjusting the addend, the relevant start is the + start of the section. + N.B. If we want to abandon in-place changes here and + test directly using symbol + addend, we have to take into + account that the addend has already been adjusted by -4. */ + if (stop > addr && stop < toaddr) + irel->r_addend -= count; + } + break; + + case R_SH_DIR8WPZ: + off = insn & 0xff; + stop = start + 4 + off * 2; + break; + + case R_SH_DIR8WPL: + off = insn & 0xff; + stop = (start & ~(bfd_vma) 3) + 4 + off * 4; + break; + + case R_SH_SWITCH8: + case R_SH_SWITCH16: + case R_SH_SWITCH32: + /* These relocs types represent + .word L2-L1 + The r_addend field holds the difference between the reloc + address and L1. That is the start of the reloc, and + adding in the contents gives us the top. We must adjust + both the r_offset field and the section contents. + N.B. in gas / coff bfd, the elf bfd r_addend is called r_offset, + and the elf bfd r_offset is called r_vaddr. */ + + stop = irel->r_offset; + start = (bfd_vma) ((bfd_signed_vma) stop - (long) irel->r_addend); + + if (start > addr + && start < toaddr + && (stop <= addr || stop >= toaddr)) + irel->r_addend += count; + else if (stop > addr + && stop < toaddr + && (start <= addr || start >= toaddr)) + irel->r_addend -= count; + + if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_SWITCH16) + voff = bfd_get_signed_16 (abfd, contents + nraddr); + else if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_SWITCH8) + voff = bfd_get_8 (abfd, contents + nraddr); + else + voff = bfd_get_signed_32 (abfd, contents + nraddr); + stop = (bfd_vma) ((bfd_signed_vma) start + voff); + + break; + + case R_SH_USES: + start = irel->r_offset; + stop = (bfd_vma) ((bfd_signed_vma) start + + (long) irel->r_addend + + 4); + break; + } + + if (start > addr + && start < toaddr + && (stop <= addr || stop >= toaddr)) + adjust = count; + else if (stop > addr + && stop < toaddr + && (start <= addr || start >= toaddr)) + adjust = - count; + else + adjust = 0; + + if (adjust != 0) + { + oinsn = insn; + overflow = FALSE; + switch ((enum elf_sh_reloc_type) ELF32_R_TYPE (irel->r_info)) + { + default: + abort (); + break; + + case R_SH_DIR8WPN: + case R_SH_DIR8WPZ: + insn += adjust / 2; + if ((oinsn & 0xff00) != (insn & 0xff00)) + overflow = TRUE; + bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); + break; + + case R_SH_IND12W: + insn += adjust / 2; + if ((oinsn & 0xf000) != (insn & 0xf000)) + overflow = TRUE; + bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); + break; + + case R_SH_DIR8WPL: + BFD_ASSERT (adjust == count || count >= 4); + if (count >= 4) + insn += adjust / 4; + else + { + if ((irel->r_offset & 3) == 0) + ++insn; + } + if ((oinsn & 0xff00) != (insn & 0xff00)) + overflow = TRUE; + bfd_put_16 (abfd, (bfd_vma) insn, contents + nraddr); + break; + + case R_SH_SWITCH8: + voff += adjust; + if (voff < 0 || voff >= 0xff) + overflow = TRUE; + bfd_put_8 (abfd, voff, contents + nraddr); + break; + + case R_SH_SWITCH16: + voff += adjust; + if (voff < - 0x8000 || voff >= 0x8000) + overflow = TRUE; + bfd_put_signed_16 (abfd, (bfd_vma) voff, contents + nraddr); + break; + + case R_SH_SWITCH32: + voff += adjust; + bfd_put_signed_32 (abfd, (bfd_vma) voff, contents + nraddr); + break; + + case R_SH_USES: + irel->r_addend += adjust; + break; + } + + if (overflow) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: fatal: reloc overflow while relaxing"), + bfd_archive_filename (abfd), (unsigned long) irel->r_offset)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + + irel->r_offset = nraddr; + } + + /* Look through all the other sections. If there contain any IMM32 + relocs against internal symbols which we are not going to adjust + below, we may need to adjust the addends. */ + for (o = abfd->sections; o != NULL; o = o->next) + { + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *irelscan, *irelscanend; + bfd_byte *ocontents; + + if (o == sec + || (o->flags & SEC_RELOC) == 0 + || o->reloc_count == 0) + continue; + + /* We always cache the relocs. Perhaps, if info->keep_memory is + FALSE, we should free them, if we are permitted to, when we + leave sh_coff_relax_section. */ + internal_relocs = (_bfd_elf_link_read_relocs + (abfd, o, NULL, (Elf_Internal_Rela *) NULL, TRUE)); + if (internal_relocs == NULL) + return FALSE; + + ocontents = NULL; + irelscanend = internal_relocs + o->reloc_count; + for (irelscan = internal_relocs; irelscan < irelscanend; irelscan++) + { + /* Dwarf line numbers use R_SH_SWITCH32 relocs. */ + if (ELF32_R_TYPE (irelscan->r_info) == (int) R_SH_SWITCH32) + { + bfd_vma start, stop; + bfd_signed_vma voff; + + if (ocontents == NULL) + { + if (elf_section_data (o)->this_hdr.contents != NULL) + ocontents = elf_section_data (o)->this_hdr.contents; + else + { + /* We always cache the section contents. + Perhaps, if info->keep_memory is FALSE, we + should free them, if we are permitted to, + when we leave sh_coff_relax_section. */ + ocontents = (bfd_byte *) bfd_malloc (o->_raw_size); + if (ocontents == NULL) + return FALSE; + if (! bfd_get_section_contents (abfd, o, ocontents, + (file_ptr) 0, + o->_raw_size)) + return FALSE; + elf_section_data (o)->this_hdr.contents = ocontents; + } + } + + stop = irelscan->r_offset; + start + = (bfd_vma) ((bfd_signed_vma) stop - (long) irelscan->r_addend); + + /* STOP is in a different section, so it won't change. */ + if (start > addr && start < toaddr) + irelscan->r_addend += count; + + voff = bfd_get_signed_32 (abfd, ocontents + irelscan->r_offset); + stop = (bfd_vma) ((bfd_signed_vma) start + voff); + + if (start > addr + && start < toaddr + && (stop <= addr || stop >= toaddr)) + bfd_put_signed_32 (abfd, (bfd_vma) voff + count, + ocontents + irelscan->r_offset); + else if (stop > addr + && stop < toaddr + && (start <= addr || start >= toaddr)) + bfd_put_signed_32 (abfd, (bfd_vma) voff - count, + ocontents + irelscan->r_offset); + } + + if (ELF32_R_TYPE (irelscan->r_info) != (int) R_SH_DIR32) + continue; + + if (ELF32_R_SYM (irelscan->r_info) >= symtab_hdr->sh_info) + continue; + + + isym = isymbuf + ELF32_R_SYM (irelscan->r_info); + if (isym->st_shndx == sec_shndx + && (isym->st_value <= addr + || isym->st_value >= toaddr)) + { + bfd_vma val; + + if (ocontents == NULL) + { + if (elf_section_data (o)->this_hdr.contents != NULL) + ocontents = elf_section_data (o)->this_hdr.contents; + else + { + /* We always cache the section contents. + Perhaps, if info->keep_memory is FALSE, we + should free them, if we are permitted to, + when we leave sh_coff_relax_section. */ + ocontents = (bfd_byte *) bfd_malloc (o->_raw_size); + if (ocontents == NULL) + return FALSE; + if (! bfd_get_section_contents (abfd, o, ocontents, + (file_ptr) 0, + o->_raw_size)) + return FALSE; + elf_section_data (o)->this_hdr.contents = ocontents; + } + } + + val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); + val += isym->st_value; + if (val > addr && val < toaddr) + bfd_put_32 (abfd, val - count, + ocontents + irelscan->r_offset); + } + } + } + + /* Adjust the local symbols defined in this section. */ + isymend = isymbuf + symtab_hdr->sh_info; + for (isym = isymbuf; isym < isymend; isym++) + { + if (isym->st_shndx == sec_shndx + && isym->st_value > addr + && isym->st_value < toaddr) + isym->st_value -= count; + } + + /* Now adjust the global symbols defined in this section. */ + symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym) + - symtab_hdr->sh_info); + sym_hashes = elf_sym_hashes (abfd); + end_hashes = sym_hashes + symcount; + for (; sym_hashes < end_hashes; sym_hashes++) + { + struct elf_link_hash_entry *sym_hash = *sym_hashes; + if ((sym_hash->root.type == bfd_link_hash_defined + || sym_hash->root.type == bfd_link_hash_defweak) + && sym_hash->root.u.def.section == sec + && sym_hash->root.u.def.value > addr + && sym_hash->root.u.def.value < toaddr) + { + sym_hash->root.u.def.value -= count; + } + } + + /* See if we can move the ALIGN reloc forward. We have adjusted + r_offset for it already. */ + if (irelalign != NULL) + { + bfd_vma alignto, alignaddr; + + alignto = BFD_ALIGN (toaddr, 1 << irelalign->r_addend); + alignaddr = BFD_ALIGN (irelalign->r_offset, + 1 << irelalign->r_addend); + if (alignto != alignaddr) + { + /* Tail recursion. */ + return sh_elf_relax_delete_bytes (abfd, sec, alignaddr, + (int) (alignto - alignaddr)); + } + } + + return TRUE; +} + +/* Look for loads and stores which we can align to four byte + boundaries. This is like sh_align_loads in coff-sh.c. */ + +static bfd_boolean +sh_elf_align_loads (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, + Elf_Internal_Rela *internal_relocs, + bfd_byte *contents ATTRIBUTE_UNUSED, + bfd_boolean *pswapped) +{ + Elf_Internal_Rela *irel, *irelend; + bfd_vma *labels = NULL; + bfd_vma *label, *label_end; + bfd_size_type amt; + + *pswapped = FALSE; + + irelend = internal_relocs + sec->reloc_count; + + /* Get all the addresses with labels on them. */ + amt = sec->reloc_count; + amt *= sizeof (bfd_vma); + labels = (bfd_vma *) bfd_malloc (amt); + if (labels == NULL) + goto error_return; + label_end = labels; + for (irel = internal_relocs; irel < irelend; irel++) + { + if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_LABEL) + { + *label_end = irel->r_offset; + ++label_end; + } + } + + /* Note that the assembler currently always outputs relocs in + address order. If that ever changes, this code will need to sort + the label values and the relocs. */ + + label = labels; + + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma start, stop; + + if (ELF32_R_TYPE (irel->r_info) != (int) R_SH_CODE) + continue; + + start = irel->r_offset; + + for (irel++; irel < irelend; irel++) + if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_DATA) + break; + if (irel < irelend) + stop = irel->r_offset; + else + stop = sec->_cooked_size; + + if (! _bfd_sh_align_load_span (abfd, sec, contents, sh_elf_swap_insns, + internal_relocs, &label, + label_end, start, stop, pswapped)) + goto error_return; + } + + free (labels); + + return TRUE; + + error_return: + if (labels != NULL) + free (labels); + return FALSE; +} + +/* Swap two SH instructions. This is like sh_swap_insns in coff-sh.c. */ + +static bfd_boolean +sh_elf_swap_insns (bfd *abfd, asection *sec, void *relocs, + bfd_byte *contents, bfd_vma addr) +{ + Elf_Internal_Rela *internal_relocs = (Elf_Internal_Rela *) relocs; + unsigned short i1, i2; + Elf_Internal_Rela *irel, *irelend; + + /* Swap the instructions themselves. */ + i1 = bfd_get_16 (abfd, contents + addr); + i2 = bfd_get_16 (abfd, contents + addr + 2); + bfd_put_16 (abfd, (bfd_vma) i2, contents + addr); + bfd_put_16 (abfd, (bfd_vma) i1, contents + addr + 2); + + /* Adjust all reloc addresses. */ + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + enum elf_sh_reloc_type type; + int add; + + /* There are a few special types of relocs that we don't want to + adjust. These relocs do not apply to the instruction itself, + but are only associated with the address. */ + type = (enum elf_sh_reloc_type) ELF32_R_TYPE (irel->r_info); + if (type == R_SH_ALIGN + || type == R_SH_CODE + || type == R_SH_DATA + || type == R_SH_LABEL) + continue; + + /* If an R_SH_USES reloc points to one of the addresses being + swapped, we must adjust it. It would be incorrect to do this + for a jump, though, since we want to execute both + instructions after the jump. (We have avoided swapping + around a label, so the jump will not wind up executing an + instruction it shouldn't). */ + if (type == R_SH_USES) + { + bfd_vma off; + + off = irel->r_offset + 4 + irel->r_addend; + if (off == addr) + irel->r_offset += 2; + else if (off == addr + 2) + irel->r_offset -= 2; + } + + if (irel->r_offset == addr) + { + irel->r_offset += 2; + add = -2; + } + else if (irel->r_offset == addr + 2) + { + irel->r_offset -= 2; + add = 2; + } + else + add = 0; + + if (add != 0) + { + bfd_byte *loc; + unsigned short insn, oinsn; + bfd_boolean overflow; + + loc = contents + irel->r_offset; + overflow = FALSE; + switch (type) + { + default: + break; + + case R_SH_DIR8WPN: + case R_SH_DIR8WPZ: + insn = bfd_get_16 (abfd, loc); + oinsn = insn; + insn += add / 2; + if ((oinsn & 0xff00) != (insn & 0xff00)) + overflow = TRUE; + bfd_put_16 (abfd, (bfd_vma) insn, loc); + break; + + case R_SH_IND12W: + insn = bfd_get_16 (abfd, loc); + oinsn = insn; + insn += add / 2; + if ((oinsn & 0xf000) != (insn & 0xf000)) + overflow = TRUE; + bfd_put_16 (abfd, (bfd_vma) insn, loc); + break; + + case R_SH_DIR8WPL: + /* This reloc ignores the least significant 3 bits of + the program counter before adding in the offset. + This means that if ADDR is at an even address, the + swap will not affect the offset. If ADDR is an at an + odd address, then the instruction will be crossing a + four byte boundary, and must be adjusted. */ + if ((addr & 3) != 0) + { + insn = bfd_get_16 (abfd, loc); + oinsn = insn; + insn += add / 2; + if ((oinsn & 0xff00) != (insn & 0xff00)) + overflow = TRUE; + bfd_put_16 (abfd, (bfd_vma) insn, loc); + } + + break; + } + + if (overflow) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: fatal: reloc overflow while relaxing"), + bfd_archive_filename (abfd), (unsigned long) irel->r_offset)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + } + + return TRUE; +} + +#ifdef INCLUDE_SHMEDIA + +/* The size in bytes of an entry in the procedure linkage table. */ + +#define PLT_ENTRY_SIZE 64 + +/* First entry in an absolute procedure linkage table look like this. */ + +static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] = +{ + 0xcc, 0x00, 0x01, 0x10, /* movi .got.plt >> 16, r17 */ + 0xc8, 0x00, 0x01, 0x10, /* shori .got.plt & 65535, r17 */ + 0x89, 0x10, 0x09, 0x90, /* ld.l r17, 8, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x89, 0x10, 0x05, 0x10, /* ld.l r17, 4, r17 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ +}; + +static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] = +{ + 0x10, 0x01, 0x00, 0xcc, /* movi .got.plt >> 16, r17 */ + 0x10, 0x01, 0x00, 0xc8, /* shori .got.plt & 65535, r17 */ + 0x90, 0x09, 0x10, 0x89, /* ld.l r17, 8, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0x10, 0x05, 0x10, 0x89, /* ld.l r17, 4, r17 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ +}; + +/* Sebsequent entries in an absolute procedure linkage table look like + this. */ + +static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] = +{ + 0xcc, 0x00, 0x01, 0x90, /* movi nameN-in-GOT >> 16, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori nameN-in-GOT & 65535, r25 */ + 0x89, 0x90, 0x01, 0x90, /* ld.l r25, 0, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0xcc, 0x00, 0x01, 0x90, /* movi .PLT0 >> 16, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori .PLT0 & 65535, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0xcc, 0x00, 0x01, 0x50, /* movi reloc-offset >> 16, r21 */ + 0xc8, 0x00, 0x01, 0x50, /* shori reloc-offset & 65535, r21 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ +}; + +static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] = +{ + 0x90, 0x01, 0x00, 0xcc, /* movi nameN-in-GOT >> 16, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori nameN-in-GOT & 65535, r25 */ + 0x90, 0x01, 0x90, 0x89, /* ld.l r25, 0, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0x90, 0x01, 0x00, 0xcc, /* movi .PLT0 >> 16, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori .PLT0 & 65535, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0x50, 0x01, 0x00, 0xcc, /* movi reloc-offset >> 16, r21 */ + 0x50, 0x01, 0x00, 0xc8, /* shori reloc-offset & 65535, r21 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ +}; + +/* Entries in a PIC procedure linkage table look like this. */ + +static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] = +{ + 0xcc, 0x00, 0x01, 0x90, /* movi nameN@GOT >> 16, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori nameN@GOT & 65535, r25 */ + 0x40, 0xc2, 0x65, 0x90, /* ldx.l r12, r25, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0xce, 0x00, 0x01, 0x10, /* movi -GOT_BIAS, r17 */ + 0x00, 0xc8, 0x45, 0x10, /* add.l r12, r17, r17 */ + 0x89, 0x10, 0x09, 0x90, /* ld.l r17, 8, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x89, 0x10, 0x05, 0x10, /* ld.l r17, 4, r17 */ + 0xcc, 0x00, 0x01, 0x50, /* movi reloc-offset >> 16, r21 */ + 0xc8, 0x00, 0x01, 0x50, /* shori reloc-offset & 65535, r21 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ +}; + +static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] = +{ + 0x90, 0x01, 0x00, 0xcc, /* movi nameN@GOT >> 16, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori nameN@GOT & 65535, r25 */ + 0x90, 0x65, 0xc2, 0x40, /* ldx.l r12, r25, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0x10, 0x01, 0x00, 0xce, /* movi -GOT_BIAS, r17 */ + 0x10, 0x45, 0xc8, 0x00, /* add.l r12, r17, r17 */ + 0x90, 0x09, 0x10, 0x89, /* ld.l r17, 8, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0x10, 0x05, 0x10, 0x89, /* ld.l r17, 4, r17 */ + 0x50, 0x01, 0x00, 0xcc, /* movi reloc-offset >> 16, r21 */ + 0x50, 0x01, 0x00, 0xc8, /* shori reloc-offset & 65535, r21 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ +}; + +static const bfd_byte *elf_sh_plt0_entry; +static const bfd_byte *elf_sh_plt_entry; +static const bfd_byte *elf_sh_pic_plt_entry; + +/* Return size of a PLT entry. */ +#define elf_sh_sizeof_plt(info) PLT_ENTRY_SIZE + +/* Return offset of the PLT0 address in an absolute PLT entry. */ +#define elf_sh_plt_plt0_offset(info) 32 + +/* Return offset of the linker in PLT0 entry. */ +#define elf_sh_plt0_gotplt_offset(info) 0 + +/* Return offset of the trampoline in PLT entry */ +#define elf_sh_plt_temp_offset(info) 33 /* Add one because it's SHmedia. */ + +/* Return offset of the symbol in PLT entry. */ +#define elf_sh_plt_symbol_offset(info) 0 + +/* Return offset of the relocation in PLT entry. */ +#define elf_sh_plt_reloc_offset(info) (info->shared ? 52 : 44) + +inline static void +movi_shori_putval (bfd *output_bfd, unsigned long value, char *addr) +{ + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr) + | ((value >> 6) & 0x3fffc00), + addr); + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr + 4) + | ((value << 10) & 0x3fffc00), + addr + 4); +} + +#else +/* The size in bytes of an entry in the procedure linkage table. */ + +#define PLT_ENTRY_SIZE 28 + +/* First entry in an absolute procedure linkage table look like this. */ + +#if 1 +/* Note - this code has been "optimised" not to use r2. r2 is used by + GCC to return the address of large structures, so it should not be + corrupted here. This does mean however, that this PLT does not conform + to the SH PIC ABI. That spec says that r0 contains the type of the PLT + and r2 contains the GOT id. This version stores the GOT id in r0 and + ignores the type. Loaders can easily detect this difference however, + since the type will always be 0 or 8, and the GOT ids will always be + greater than or equal to 12. */ +static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] = +{ + 0xd0, 0x05, /* mov.l 2f,r0 */ + 0x60, 0x02, /* mov.l @r0,r0 */ + 0x2f, 0x06, /* mov.l r0,@-r15 */ + 0xd0, 0x03, /* mov.l 1f,r0 */ + 0x60, 0x02, /* mov.l @r0,r0 */ + 0x40, 0x2b, /* jmp @r0 */ + 0x60, 0xf6, /* mov.l @r15+,r0 */ + 0x00, 0x09, /* nop */ + 0x00, 0x09, /* nop */ + 0x00, 0x09, /* nop */ + 0, 0, 0, 0, /* 1: replaced with address of .got.plt + 8. */ + 0, 0, 0, 0, /* 2: replaced with address of .got.plt + 4. */ +}; + +static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] = +{ + 0x05, 0xd0, /* mov.l 2f,r0 */ + 0x02, 0x60, /* mov.l @r0,r0 */ + 0x06, 0x2f, /* mov.l r0,@-r15 */ + 0x03, 0xd0, /* mov.l 1f,r0 */ + 0x02, 0x60, /* mov.l @r0,r0 */ + 0x2b, 0x40, /* jmp @r0 */ + 0xf6, 0x60, /* mov.l @r15+,r0 */ + 0x09, 0x00, /* nop */ + 0x09, 0x00, /* nop */ + 0x09, 0x00, /* nop */ + 0, 0, 0, 0, /* 1: replaced with address of .got.plt + 8. */ + 0, 0, 0, 0, /* 2: replaced with address of .got.plt + 4. */ +}; + +/* Sebsequent entries in an absolute procedure linkage table look like + this. */ + +static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] = +{ + 0xd0, 0x04, /* mov.l 1f,r0 */ + 0x60, 0x02, /* mov.l @r0,r0 */ + 0xd1, 0x02, /* mov.l 0f,r1 */ + 0x40, 0x2b, /* jmp @r0 */ + 0x60, 0x13, /* mov r1,r0 */ + 0xd1, 0x03, /* mov.l 2f,r1 */ + 0x40, 0x2b, /* jmp @r0 */ + 0x00, 0x09, /* nop */ + 0, 0, 0, 0, /* 0: replaced with address of .PLT0. */ + 0, 0, 0, 0, /* 1: replaced with address of this symbol in .got. */ + 0, 0, 0, 0, /* 2: replaced with offset into relocation table. */ +}; + +static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] = +{ + 0x04, 0xd0, /* mov.l 1f,r0 */ + 0x02, 0x60, /* mov.l @r0,r0 */ + 0x02, 0xd1, /* mov.l 0f,r1 */ + 0x2b, 0x40, /* jmp @r0 */ + 0x13, 0x60, /* mov r1,r0 */ + 0x03, 0xd1, /* mov.l 2f,r1 */ + 0x2b, 0x40, /* jmp @r0 */ + 0x09, 0x00, /* nop */ + 0, 0, 0, 0, /* 0: replaced with address of .PLT0. */ + 0, 0, 0, 0, /* 1: replaced with address of this symbol in .got. */ + 0, 0, 0, 0, /* 2: replaced with offset into relocation table. */ +}; + +/* Entries in a PIC procedure linkage table look like this. */ + +static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] = +{ + 0xd0, 0x04, /* mov.l 1f,r0 */ + 0x00, 0xce, /* mov.l @(r0,r12),r0 */ + 0x40, 0x2b, /* jmp @r0 */ + 0x00, 0x09, /* nop */ + 0x50, 0xc2, /* mov.l @(8,r12),r0 */ + 0xd1, 0x03, /* mov.l 2f,r1 */ + 0x40, 0x2b, /* jmp @r0 */ + 0x50, 0xc1, /* mov.l @(4,r12),r0 */ + 0x00, 0x09, /* nop */ + 0x00, 0x09, /* nop */ + 0, 0, 0, 0, /* 1: replaced with address of this symbol in .got. */ + 0, 0, 0, 0 /* 2: replaced with offset into relocation table. */ +}; + +static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] = +{ + 0x04, 0xd0, /* mov.l 1f,r0 */ + 0xce, 0x00, /* mov.l @(r0,r12),r0 */ + 0x2b, 0x40, /* jmp @r0 */ + 0x09, 0x00, /* nop */ + 0xc2, 0x50, /* mov.l @(8,r12),r0 */ + 0x03, 0xd1, /* mov.l 2f,r1 */ + 0x2b, 0x40, /* jmp @r0 */ + 0xc1, 0x50, /* mov.l @(4,r12),r0 */ + 0x09, 0x00, /* nop */ + 0x09, 0x00, /* nop */ + 0, 0, 0, 0, /* 1: replaced with address of this symbol in .got. */ + 0, 0, 0, 0 /* 2: replaced with offset into relocation table. */ +}; + +#else /* These are the old style PLT entries. */ +static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] = +{ + 0xd0, 0x04, /* mov.l 1f,r0 */ + 0xd2, 0x05, /* mov.l 2f,r2 */ + 0x60, 0x02, /* mov.l @r0,r0 */ + 0x62, 0x22, /* mov.l @r2,r2 */ + 0x40, 0x2b, /* jmp @r0 */ + 0xe0, 0x00, /* mov #0,r0 */ + 0x00, 0x09, /* nop */ + 0x00, 0x09, /* nop */ + 0x00, 0x09, /* nop */ + 0x00, 0x09, /* nop */ + 0, 0, 0, 0, /* 1: replaced with address of .got.plt + 8. */ + 0, 0, 0, 0, /* 2: replaced with address of .got.plt + 4. */ +}; + +static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] = +{ + 0x04, 0xd0, /* mov.l 1f,r0 */ + 0x05, 0xd2, /* mov.l 2f,r2 */ + 0x02, 0x60, /* mov.l @r0,r0 */ + 0x22, 0x62, /* mov.l @r2,r2 */ + 0x2b, 0x40, /* jmp @r0 */ + 0x00, 0xe0, /* mov #0,r0 */ + 0x09, 0x00, /* nop */ + 0x09, 0x00, /* nop */ + 0x09, 0x00, /* nop */ + 0x09, 0x00, /* nop */ + 0, 0, 0, 0, /* 1: replaced with address of .got.plt + 8. */ + 0, 0, 0, 0, /* 2: replaced with address of .got.plt + 4. */ +}; + +/* Sebsequent entries in an absolute procedure linkage table look like + this. */ + +static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] = +{ + 0xd0, 0x04, /* mov.l 1f,r0 */ + 0x60, 0x02, /* mov.l @r0,r0 */ + 0xd2, 0x02, /* mov.l 0f,r2 */ + 0x40, 0x2b, /* jmp @r0 */ + 0x60, 0x23, /* mov r2,r0 */ + 0xd1, 0x03, /* mov.l 2f,r1 */ + 0x40, 0x2b, /* jmp @r0 */ + 0x00, 0x09, /* nop */ + 0, 0, 0, 0, /* 0: replaced with address of .PLT0. */ + 0, 0, 0, 0, /* 1: replaced with address of this symbol in .got. */ + 0, 0, 0, 0, /* 2: replaced with offset into relocation table. */ +}; + +static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] = +{ + 0x04, 0xd0, /* mov.l 1f,r0 */ + 0x02, 0x60, /* mov.l @r0,r0 */ + 0x02, 0xd2, /* mov.l 0f,r2 */ + 0x2b, 0x40, /* jmp @r0 */ + 0x23, 0x60, /* mov r2,r0 */ + 0x03, 0xd1, /* mov.l 2f,r1 */ + 0x2b, 0x40, /* jmp @r0 */ + 0x09, 0x00, /* nop */ + 0, 0, 0, 0, /* 0: replaced with address of .PLT. */ + 0, 0, 0, 0, /* 1: replaced with address of this symbol in .got. */ + 0, 0, 0, 0, /* 2: replaced with offset into relocation table. */ +}; + +/* Entries in a PIC procedure linkage table look like this. */ + +static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] = +{ + 0xd0, 0x04, /* mov.l 1f,r0 */ + 0x00, 0xce, /* mov.l @(r0,r12),r0 */ + 0x40, 0x2b, /* jmp @r0 */ + 0x00, 0x09, /* nop */ + 0x50, 0xc2, /* 0: mov.l @(8,r12),r0 */ + 0x52, 0xc1, /* 1: mov.l @(4,r12),r2 */ + 0xd1, 0x02, /* mov.l 2f,r1 */ + 0x40, 0x2b, /* jmp @r0 */ + 0xe0, 0x00, /* mov #0,r0 ! shows the type of PLT. */ + 0x00, 0x09, /* nop */ + 0, 0, 0, 0, /* 1: replaced with address of this symbol in .got. */ + 0, 0, 0, 0 /* 2: replaced with offset into relocation table. */ +}; + +static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] = +{ + 0x04, 0xd0, /* mov.l 1f,r0 */ + 0xce, 0x00, /* mov.l @(r0,r12),r0 */ + 0x2b, 0x40, /* jmp @r0 */ + 0x09, 0x00, /* nop */ + 0xc2, 0x50, /* 0: mov.l @(8,r12),r0 */ + 0xc1, 0x52, /* 1: mov.l @(4,r12),r2 */ + 0x02, 0xd1, /* mov.l 2f,r1 */ + 0x2b, 0x40, /* jmp @r0 */ + 0x00, 0xe0, /* mov #0,r0 ! shows the type of PLT. */ + 0x09, 0x00, /* nop */ + 0, 0, 0, 0, /* 1: replaced with address of this symbol in .got. */ + 0, 0, 0, 0 /* 2: replaced with offset into relocation table. */ +}; +#endif /* old style PLT entries. */ + +static const bfd_byte *elf_sh_plt0_entry; +static const bfd_byte *elf_sh_plt_entry; +static const bfd_byte *elf_sh_pic_plt_entry; + +/* Return size of a PLT entry. */ +#define elf_sh_sizeof_plt(info) PLT_ENTRY_SIZE + +/* Return offset of the PLT0 address in an absolute PLT entry. */ +#define elf_sh_plt_plt0_offset(info) 16 + +/* Return offset of the linker in PLT0 entry. */ +#define elf_sh_plt0_linker_offset(info) 20 + +/* Return offset of the GOT id in PLT0 entry. */ +#define elf_sh_plt0_gotid_offset(info) 24 + +/* Return offset of the temporary in PLT entry */ +#define elf_sh_plt_temp_offset(info) 8 + +/* Return offset of the symbol in PLT entry. */ +#define elf_sh_plt_symbol_offset(info) 20 + +/* Return offset of the relocation in PLT entry. */ +#define elf_sh_plt_reloc_offset(info) 24 +#endif + +/* The sh linker needs to keep track of the number of relocs that it + decides to copy as dynamic relocs in check_relocs for each symbol. + This is so that it can later discard them if they are found to be + unnecessary. We store the information in a field extending the + regular ELF linker hash table. */ + +struct elf_sh_dyn_relocs +{ + struct elf_sh_dyn_relocs *next; + + /* The input section of the reloc. */ + asection *sec; + + /* Total number of relocs copied for the input section. */ + bfd_size_type count; + + /* Number of pc-relative relocs copied for the input section. */ + bfd_size_type pc_count; +}; + +/* sh ELF linker hash entry. */ + +struct elf_sh_link_hash_entry +{ + struct elf_link_hash_entry root; + +#ifdef INCLUDE_SHMEDIA + union + { + bfd_signed_vma refcount; + bfd_vma offset; + } datalabel_got; +#endif + + /* Track dynamic relocs copied for this symbol. */ + struct elf_sh_dyn_relocs *dyn_relocs; + + bfd_signed_vma gotplt_refcount; + + enum { + GOT_UNKNOWN = 0, GOT_NORMAL, GOT_TLS_GD, GOT_TLS_IE + } tls_type; +}; + +#define sh_elf_hash_entry(ent) ((struct elf_sh_link_hash_entry *)(ent)) + +struct sh_elf_obj_tdata +{ + struct elf_obj_tdata root; + + /* tls_type for each local got entry. */ + char *local_got_tls_type; +}; + +#define sh_elf_tdata(abfd) \ + ((struct sh_elf_obj_tdata *) (abfd)->tdata.any) + +#define sh_elf_local_got_tls_type(abfd) \ + (sh_elf_tdata (abfd)->local_got_tls_type) + +/* Override the generic function because we need to store sh_elf_obj_tdata + as the specific tdata. */ + +static bfd_boolean +sh_elf_mkobject (bfd *abfd) +{ + bfd_size_type amt = sizeof (struct sh_elf_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + return TRUE; +} + +/* sh ELF linker hash table. */ + +struct elf_sh_link_hash_table +{ + struct elf_link_hash_table root; + + /* Short-cuts to get to dynamic linker sections. */ + asection *sgot; + asection *sgotplt; + asection *srelgot; + asection *splt; + asection *srelplt; + asection *sdynbss; + asection *srelbss; + + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; + + /* A counter or offset to track a TLS got entry. */ + union + { + bfd_signed_vma refcount; + bfd_vma offset; + } tls_ldm_got; +}; + +/* Traverse an sh ELF linker hash table. */ + +#define sh_elf_link_hash_traverse(table, func, info) \ + (elf_link_hash_traverse \ + (&(table)->root, \ + (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \ + (info))) + +/* Get the sh ELF linker hash table from a link_info structure. */ + +#define sh_elf_hash_table(p) \ + ((struct elf_sh_link_hash_table *) ((p)->hash)) + +/* Create an entry in an sh ELF linker hash table. */ + +static struct bfd_hash_entry * +sh_elf_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) +{ + struct elf_sh_link_hash_entry *ret = + (struct elf_sh_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct elf_sh_link_hash_entry *) NULL) + ret = ((struct elf_sh_link_hash_entry *) + bfd_hash_allocate (table, + sizeof (struct elf_sh_link_hash_entry))); + if (ret == (struct elf_sh_link_hash_entry *) NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct elf_sh_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != (struct elf_sh_link_hash_entry *) NULL) + { + ret->dyn_relocs = NULL; + ret->gotplt_refcount = 0; +#ifdef INCLUDE_SHMEDIA + ret->datalabel_got.refcount = ret->root.got.refcount; +#endif + ret->tls_type = GOT_UNKNOWN; + } + + return (struct bfd_hash_entry *) ret; +} + +/* Create an sh ELF linker hash table. */ + +static struct bfd_link_hash_table * +sh_elf_link_hash_table_create (bfd *abfd) +{ + struct elf_sh_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_sh_link_hash_table); + + ret = (struct elf_sh_link_hash_table *) bfd_malloc (amt); + if (ret == (struct elf_sh_link_hash_table *) NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + sh_elf_link_hash_newfunc)) + { + free (ret); + return NULL; + } + + ret->sgot = NULL; + ret->sgotplt = NULL; + ret->srelgot = NULL; + ret->splt = NULL; + ret->srelplt = NULL; + ret->sdynbss = NULL; + ret->srelbss = NULL; + ret->sym_sec.abfd = NULL; + ret->tls_ldm_got.refcount = 0; + + return &ret->root.root; +} + +/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up + shortcuts to them in our hash table. */ + +static bfd_boolean +create_got_section (bfd *dynobj, struct bfd_link_info *info) +{ + struct elf_sh_link_hash_table *htab; + + if (! _bfd_elf_create_got_section (dynobj, info)) + return FALSE; + + htab = sh_elf_hash_table (info); + htab->sgot = bfd_get_section_by_name (dynobj, ".got"); + htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + if (! htab->sgot || ! htab->sgotplt) + abort (); + + htab->srelgot = bfd_make_section (dynobj, ".rela.got"); + if (htab->srelgot == NULL + || ! bfd_set_section_flags (dynobj, htab->srelgot, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2)) + return FALSE; + return TRUE; +} + +/* Create dynamic sections when linking against a dynamic object. */ + +static bfd_boolean +sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) +{ + struct elf_sh_link_hash_table *htab; + flagword flags, pltflags; + register asection *s; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + int ptralign = 0; + + switch (bed->s->arch_size) + { + case 32: + ptralign = 2; + break; + + case 64: + ptralign = 3; + break; + + default: + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + htab = sh_elf_hash_table (info); + if (htab->root.dynamic_sections_created) + return TRUE; + + /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and + .rel[a].bss sections. */ + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + + pltflags = flags; + pltflags |= SEC_CODE; + if (bed->plt_not_loaded) + pltflags &= ~ (SEC_LOAD | SEC_HAS_CONTENTS); + if (bed->plt_readonly) + pltflags |= SEC_READONLY; + + s = bfd_make_section (abfd, ".plt"); + htab->splt = s; + if (s == NULL + || ! bfd_set_section_flags (abfd, s, pltflags) + || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + return FALSE; + + if (bed->want_plt_sym) + { + /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the + .plt section. */ + struct elf_link_hash_entry *h; + struct bfd_link_hash_entry *bh = NULL; + + if (! (_bfd_generic_link_add_one_symbol + (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s, + (bfd_vma) 0, (const char *) NULL, FALSE, + get_elf_backend_data (abfd)->collect, &bh))) + return FALSE; + + h = (struct elf_link_hash_entry *) bh; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; + + if (info->shared + && ! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = bfd_make_section (abfd, + bed->default_use_rela_p ? ".rela.plt" : ".rel.plt"); + htab->srelplt = s; + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + + if (htab->sgot == NULL + && !create_got_section (abfd, info)) + return FALSE; + + { + const char *secname; + char *relname; + flagword secflags; + asection *sec; + + for (sec = abfd->sections; sec; sec = sec->next) + { + secflags = bfd_get_section_flags (abfd, sec); + if ((secflags & (SEC_DATA | SEC_LINKER_CREATED)) + || ((secflags & SEC_HAS_CONTENTS) != SEC_HAS_CONTENTS)) + continue; + secname = bfd_get_section_name (abfd, sec); + relname = (char *) bfd_malloc ((bfd_size_type) strlen (secname) + 6); + strcpy (relname, ".rela"); + strcat (relname, secname); + if (bfd_get_section_by_name (abfd, secname)) + continue; + s = bfd_make_section (abfd, relname); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + } + } + + if (bed->want_dynbss) + { + /* The .dynbss section is a place to put symbols which are defined + by dynamic objects, are referenced by regular objects, and are + not functions. We must allocate space for them in the process + image and use a R_*_COPY reloc to tell the dynamic linker to + initialize them at run time. The linker script puts the .dynbss + section into the .bss section of the final image. */ + s = bfd_make_section (abfd, ".dynbss"); + htab->sdynbss = s; + if (s == NULL + || ! bfd_set_section_flags (abfd, s, SEC_ALLOC)) + return FALSE; + + /* The .rel[a].bss section holds copy relocs. This section is not + normally needed. We need to create it here, though, so that the + linker will map it to an output section. We can't just create it + only if we need it, because we will not know whether we need it + until we have seen all the input files, and the first time the + main linker code calls BFD after examining all the input files + (size_dynamic_sections) the input sections have already been + mapped to the output sections. If the section turns out not to + be needed, we can discard it later. We will never need this + section when generating a shared object, since they do not use + copy relocs. */ + if (! info->shared) + { + s = bfd_make_section (abfd, + (bed->default_use_rela_p + ? ".rela.bss" : ".rel.bss")); + htab->srelbss = s; + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + } + } + + return TRUE; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static bfd_boolean +sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) +{ + struct elf_sh_link_hash_table *htab; + struct elf_sh_link_hash_entry *eh; + struct elf_sh_dyn_relocs *p; + asection *s; + unsigned int power_of_two; + + htab = sh_elf_hash_table (info); + + /* Make sure we know what is going on here. */ + BFD_ASSERT (htab->root.dynobj != NULL + && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) + || h->weakdef != NULL + || ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_REF_REGULAR) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))); + + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later, + when we know the address of the .got section. */ + if (h->type == STT_FUNC + || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + { + if (h->plt.refcount <= 0 + || SYMBOL_CALLS_LOCAL (info, h) + || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + && h->root.type == bfd_link_hash_undefweak)) + { + /* This case can occur if we saw a PLT reloc in an input + file, but the symbol was never referred to by a dynamic + object. In such a case, we don't actually need to build + a procedure linkage table, and we can just do a REL32 + reloc instead. */ + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + + return TRUE; + } + else + h->plt.offset = (bfd_vma) -1; + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + if (info->nocopyreloc) + h->elf_link_hash_flags + = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) + | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (info->shared) + return TRUE; + + /* If there are no references to this symbol that do not use the + GOT, we don't need to generate a copy reloc. */ + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + return TRUE; + + /* If -z nocopyreloc was given, we won't generate them either. */ + if (info->nocopyreloc) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return TRUE; + } + + eh = (struct elf_sh_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + s = p->sec->output_section; + if (s != NULL && (s->flags & (SEC_READONLY | SEC_HAS_CONTENTS)) != 0) + break; + } + + /* If we didn't find any dynamic relocs in sections which needs the + copy reloc, then we'll be keeping the dynamic relocs and avoiding + the copy reloc. */ + if (p == NULL) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return TRUE; + } + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + + s = htab->sdynbss; + BFD_ASSERT (s != NULL); + + /* We must generate a R_SH_COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rela.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + asection *srel; + + srel = htab->srelbss; + BFD_ASSERT (srel != NULL); + srel->_raw_size += sizeof (Elf32_External_Rela); + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + } + + /* We need to figure out the alignment required for this symbol. I + have no idea how ELF linkers handle this. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > 3) + power_of_two = 3; + + /* Apply the required alignment. */ + s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (htab->root.dynobj, s)) + { + if (! bfd_set_section_alignment (htab->root.dynobj, s, power_of_two)) + return FALSE; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + + /* Increment the section size to make room for the symbol. */ + s->_raw_size += h->size; + + return TRUE; +} + +/* Allocate space in .plt, .got and associated reloc sections for + dynamic relocs. */ + +static bfd_boolean +allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) +{ + struct bfd_link_info *info; + struct elf_sh_link_hash_table *htab; + struct elf_sh_link_hash_entry *eh; + struct elf_sh_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + /* When warning symbols are created, they **replace** the "real" + entry in the hash table, thus we never get to see the real + symbol in a hash traversal. So look at it now. */ + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + info = (struct bfd_link_info *) inf; + htab = sh_elf_hash_table (info); + + eh = (struct elf_sh_link_hash_entry *) h; + if ((h->got.refcount > 0 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) + && eh->gotplt_refcount > 0) + { + /* The symbol has been forced local, or we have some direct got refs, + so treat all the gotplt refs as got refs. */ + h->got.refcount += eh->gotplt_refcount; + if (h->plt.refcount >= eh->gotplt_refcount) + h->plt.refcount -= eh->gotplt_refcount; + } + + if (htab->root.dynamic_sections_created + && h->plt.refcount > 0 + && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak)) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + if (info->shared + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h)) + { + asection *s = htab->splt; + + /* If this is the first .plt entry, make room for the special + first entry. */ + if (s->_raw_size == 0) + s->_raw_size += PLT_ENTRY_SIZE; + + h->plt.offset = s->_raw_size; + + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + h->root.u.def.section = s; + h->root.u.def.value = h->plt.offset; + } + + /* Make room for this entry. */ + s->_raw_size += PLT_ENTRY_SIZE; + + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + htab->sgotplt->_raw_size += 4; + + /* We also need to make an entry in the .rel.plt section. */ + htab->srelplt->_raw_size += sizeof (Elf32_External_Rela); + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + } + else + { + h->plt.offset = (bfd_vma) -1; + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + + if (h->got.refcount > 0) + { + asection *s; + bfd_boolean dyn; + int tls_type = sh_elf_hash_entry (h)->tls_type; + + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = htab->sgot; + h->got.offset = s->_raw_size; + s->_raw_size += 4; + /* R_SH_TLS_GD needs 2 consecutive GOT slots. */ + if (tls_type == GOT_TLS_GD) + s->_raw_size += 4; + dyn = htab->root.dynamic_sections_created; + /* R_SH_TLS_IE_32 needs one dynamic relocation if dynamic, + R_SH_TLS_GD needs one if local symbol and two if global. */ + if ((tls_type == GOT_TLS_GD && h->dynindx == -1) + || (tls_type == GOT_TLS_IE && dyn)) + htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); + else if (tls_type == GOT_TLS_GD) + htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rela); + else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak) + && (info->shared + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) + htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + else + h->got.offset = (bfd_vma) -1; + +#ifdef INCLUDE_SHMEDIA + if (eh->datalabel_got.refcount > 0) + { + asection *s; + bfd_boolean dyn; + + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = htab->sgot; + eh->datalabel_got.offset = s->_raw_size; + s->_raw_size += 4; + dyn = htab->root.dynamic_sections_created; + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)) + htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + else + eh->datalabel_got.offset = (bfd_vma) -1; +#endif + + if (eh->dyn_relocs == NULL) + return TRUE; + + /* In the shared -Bsymbolic case, discard space allocated for + dynamic pc-relative relocs against symbols which turn out to be + defined in regular objects. For the normal shared case, discard + space for pc-relative relocs that have become local due to symbol + visibility changes. */ + + if (info->shared) + { + if (SYMBOL_CALLS_LOCAL (info, h)) + { + struct elf_sh_dyn_relocs **pp; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + { + p->count -= p->pc_count; + p->pc_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } + + /* Also discard relocs on undefined weak syms with non-default + visibility. */ + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + && h->root.type == bfd_link_hash_undefweak) + eh->dyn_relocs = NULL; + } + else + { + /* For the non-shared case, discard space for relocs against + symbols which turn out to need copy relocs or are not + dynamic. */ + + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 + && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + || (htab->root.dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + /* If that succeeded, we know we'll be keeping all the + relocs. */ + if (h->dynindx != -1) + goto keep; + } + + eh->dyn_relocs = NULL; + + keep: ; + } + + /* Finally, allocate space. */ + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *sreloc = elf_section_data (p->sec)->sreloc; + sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela); + } + + return TRUE; +} + +/* Find any dynamic relocs that apply to read-only sections. */ + +static bfd_boolean +readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf) +{ + struct elf_sh_link_hash_entry *eh; + struct elf_sh_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + eh = (struct elf_sh_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *s = p->sec->output_section; + + if (s != NULL && (s->flags & SEC_READONLY) != 0) + { + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + info->flags |= DF_TEXTREL; + + /* Not an error, just cut short the traversal. */ + return FALSE; + } + } + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) +{ + struct elf_sh_link_hash_table *htab; + bfd *dynobj; + asection *s; + bfd_boolean relocs; + bfd *ibfd; + + htab = sh_elf_hash_table (info); + dynobj = htab->root.dynobj; + BFD_ASSERT (dynobj != NULL); + + if (htab->root.dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (info->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } + + /* Set up .got offsets for local syms, and space for local dynamic + relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + bfd_signed_vma *local_got; + bfd_signed_vma *end_local_got; + char *local_tls_type; + bfd_size_type locsymcount; + Elf_Internal_Shdr *symtab_hdr; + asection *srel; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) + continue; + + for (s = ibfd->sections; s != NULL; s = s->next) + { + struct elf_sh_dyn_relocs *p; + + for (p = ((struct elf_sh_dyn_relocs *) + elf_section_data (s)->local_dynrel); + p != NULL; + p = p->next) + { + if (! bfd_is_abs_section (p->sec) + && bfd_is_abs_section (p->sec->output_section)) + { + /* Input section has been discarded, either because + it is a copy of a linkonce section or due to + linker script /DISCARD/, so we'll be discarding + the relocs too. */ + } + else if (p->count != 0) + { + srel = elf_section_data (p->sec)->sreloc; + srel->_raw_size += p->count * sizeof (Elf32_External_Rela); + if ((p->sec->output_section->flags & SEC_READONLY) != 0) + info->flags |= DF_TEXTREL; + } + } + } + + local_got = elf_local_got_refcounts (ibfd); + if (!local_got) + continue; + + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; +#ifdef INCLUDE_SHMEDIA + /* Count datalabel local GOT. */ + locsymcount *= 2; +#endif + end_local_got = local_got + locsymcount; + local_tls_type = sh_elf_local_got_tls_type (ibfd); + s = htab->sgot; + srel = htab->srelgot; + for (; local_got < end_local_got; ++local_got) + { + if (*local_got > 0) + { + *local_got = s->_raw_size; + s->_raw_size += 4; + if (*local_tls_type == GOT_TLS_GD) + s->_raw_size += 4; + if (info->shared) + srel->_raw_size += sizeof (Elf32_External_Rela); + } + else + *local_got = (bfd_vma) -1; + ++local_tls_type; + } + } + + if (htab->tls_ldm_got.refcount > 0) + { + /* Allocate 2 got entries and 1 dynamic reloc for R_SH_TLS_LD_32 + relocs. */ + htab->tls_ldm_got.offset = htab->sgot->_raw_size; + htab->sgot->_raw_size += 8; + htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + else + htab->tls_ldm_got.offset = -1; + + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ + elf_link_hash_traverse (&htab->root, allocate_dynrelocs, info); + + /* We now have determined the sizes of the various dynamic sections. + Allocate memory for them. */ + relocs = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + if (s == htab->splt + || s == htab->sgot + || s == htab->sgotplt) + { + /* Strip this section if we don't need it; see the + comment below. */ + } + else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + { + if (s->_raw_size != 0 && s != htab->srelplt) + relocs = TRUE; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + else + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (s->_raw_size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + + _bfd_strip_section_from_output (info, s); + continue; + } + + /* Allocate memory for the section contents. We use bfd_zalloc + here in case unused entries are not reclaimed before the + section's contents are written out. This should not happen, + but this way if it does, we get a R_SH_NONE reloc instead + of garbage. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + if (s->contents == NULL) + return FALSE; + } + + if (htab->root.dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in sh_elf_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) + + if (info->executable) + { + if (! add_dynamic_entry (DT_DEBUG, 0)) + return FALSE; + } + + if (htab->splt->_raw_size != 0) + { + if (! add_dynamic_entry (DT_PLTGOT, 0) + || ! add_dynamic_entry (DT_PLTRELSZ, 0) + || ! add_dynamic_entry (DT_PLTREL, DT_RELA) + || ! add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + } + + if (relocs) + { + if (! add_dynamic_entry (DT_RELA, 0) + || ! add_dynamic_entry (DT_RELASZ, 0) + || ! add_dynamic_entry (DT_RELAENT, + sizeof (Elf32_External_Rela))) + return FALSE; + + /* If any dynamic relocs apply to a read-only section, + then we need a DT_TEXTREL entry. */ + if ((info->flags & DF_TEXTREL) == 0) + elf_link_hash_traverse (&htab->root, readonly_dynrelocs, info); + + if ((info->flags & DF_TEXTREL) != 0) + { + if (! add_dynamic_entry (DT_TEXTREL, 0)) + return FALSE; + } + } + } +#undef add_dynamic_entry + + return TRUE; +} + +/* Relocate an SH ELF section. */ + +static bfd_boolean +sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + bfd *input_bfd, asection *input_section, + bfd_byte *contents, Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) +{ + struct elf_sh_link_hash_table *htab; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + bfd *dynobj; + bfd_vma *local_got_offsets; + asection *sgot; + asection *sgotplt; + asection *splt; + asection *sreloc; + asection *srelgot; + + htab = sh_elf_hash_table (info); + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + dynobj = htab->root.dynobj; + local_got_offsets = elf_local_got_offsets (input_bfd); + + sgot = htab->sgot; + sgotplt = htab->sgotplt; + splt = htab->splt; + sreloc = NULL; + srelgot = NULL; + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_vma addend = (bfd_vma) 0; + bfd_reloc_status_type r; + int seen_stt_datalabel = 0; + bfd_vma off; + int tls_type; + + r_symndx = ELF32_R_SYM (rel->r_info); + + r_type = ELF32_R_TYPE (rel->r_info); + + /* Many of the relocs are only used for relaxing, and are + handled entirely by the relaxation code. */ + if (r_type >= (int) R_SH_GNU_VTINHERIT + && r_type <= (int) R_SH_LABEL) + continue; + if (r_type == (int) R_SH_NONE) + continue; + + if (r_type < 0 + || r_type >= R_SH_max + || (r_type >= (int) R_SH_FIRST_INVALID_RELOC + && r_type <= (int) R_SH_LAST_INVALID_RELOC) + || ( r_type >= (int) R_SH_FIRST_INVALID_RELOC_3 + && r_type <= (int) R_SH_LAST_INVALID_RELOC_3) + || ( r_type >= (int) R_SH_FIRST_INVALID_RELOC_4 + && r_type <= (int) R_SH_LAST_INVALID_RELOC_4) + || ( r_type >= (int) R_SH_FIRST_INVALID_RELOC_5 + && r_type <= (int) R_SH_LAST_INVALID_RELOC_5) + || (r_type >= (int) R_SH_FIRST_INVALID_RELOC_2 + && r_type <= (int) R_SH_LAST_INVALID_RELOC_2)) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + howto = sh_elf_howto_table + r_type; + + /* For relocs that aren't partial_inplace, we get the addend from + the relocation. */ + if (! howto->partial_inplace) + addend = rel->r_addend; + + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + /* A local symbol never has STO_SH5_ISA32, so we don't need + datalabel processing here. Make sure this does not change + without notice. */ + if ((sym->st_other & STO_SH5_ISA32) != 0) + ((*info->callbacks->reloc_dangerous) + (info, + _("Unexpected STO_SH5_ISA32 on local symbol is not handled"), + input_bfd, input_section, rel->r_offset)); + if (info->relocatable) + { + /* This is a relocatable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + if (! howto->partial_inplace) + { + /* For relocations with the addend in the + relocation, we need just to update the addend. + All real relocs are of type partial_inplace; this + code is mostly for completeness. */ + rel->r_addend += sec->output_offset + sym->st_value; + + continue; + } + + /* Relocs of type partial_inplace need to pick up the + contents in the contents and add the offset resulting + from the changed location of the section symbol. + Using _bfd_final_link_relocate (e.g. goto + final_link_relocate) here would be wrong, because + relocations marked pc_relative would get the current + location subtracted, and we must only do that at the + final link. */ + r = _bfd_relocate_contents (howto, input_bfd, + sec->output_offset + + sym->st_value, + contents + rel->r_offset); + goto relocation_done; + } + + continue; + } + else if (! howto->partial_inplace) + { + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + addend = rel->r_addend; + } + else if ((sec->flags & SEC_MERGE) + && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + asection *msec; + + if (howto->rightshift || howto->src_mask != 0xffffffff) + { + (*_bfd_error_handler) + (_("%s(%s+0x%lx): %s relocation against SEC_MERGE section"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, howto->name); + return FALSE; + } + + addend = bfd_get_32 (input_bfd, contents + rel->r_offset); + msec = sec; + addend = + _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend) + - relocation; + addend += msec->output_section->vma + msec->output_offset; + bfd_put_32 (input_bfd, addend, contents + rel->r_offset); + addend = 0; + } + } + else + { + /* FIXME: Ought to make use of the RELOC_FOR_GLOBAL_SYMBOL macro. */ + + /* Section symbol are never (?) placed in the hash table, so + we can just ignore hash relocations when creating a + relocatable object file. */ + if (info->relocatable) + continue; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + { +#ifdef INCLUDE_SHMEDIA + /* If the reference passes a symbol marked with + STT_DATALABEL, then any STO_SH5_ISA32 on the final value + doesn't count. */ + seen_stt_datalabel |= h->type == STT_DATALABEL; +#endif + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + bfd_boolean dyn; + + dyn = htab->root.dynamic_sections_created; + sec = h->root.u.def.section; + /* In these cases, we don't need the relocation value. + We check specially because in some obscure cases + sec->output_section will be NULL. */ + if (r_type == R_SH_GOTPC + || r_type == R_SH_GOTPC_LOW16 + || r_type == R_SH_GOTPC_MEDLOW16 + || r_type == R_SH_GOTPC_MEDHI16 + || r_type == R_SH_GOTPC_HI16 + || ((r_type == R_SH_PLT32 + || r_type == R_SH_PLT_LOW16 + || r_type == R_SH_PLT_MEDLOW16 + || r_type == R_SH_PLT_MEDHI16 + || r_type == R_SH_PLT_HI16) + && h->plt.offset != (bfd_vma) -1) + || ((r_type == R_SH_GOT32 + || r_type == R_SH_GOT_LOW16 + || r_type == R_SH_GOT_MEDLOW16 + || r_type == R_SH_GOT_MEDHI16 + || r_type == R_SH_GOT_HI16) + && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) + && (! info->shared + || (! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + /* The cases above are those in which relocation is + overwritten in the switch block below. The cases + below are those in which we must defer relocation + to run-time, because we can't resolve absolute + addresses when creating a shared library. */ + || (info->shared + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) + && ((r_type == R_SH_DIR32 + && (h->elf_link_hash_flags + & ELF_LINK_FORCED_LOCAL) == 0) + || r_type == R_SH_REL32) + && ((input_section->flags & SEC_ALLOC) != 0 + /* DWARF will emit R_SH_DIR32 relocations in its + sections against symbols defined externally + in shared libraries. We can't do anything + with them here. */ + || ((input_section->flags & SEC_DEBUGGING) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0))) + /* Dynamic relocs are not propagated for SEC_DEBUGGING + sections because such sections are not SEC_ALLOC and + thus ld.so will not process them. */ + || (sec->output_section == NULL + && ((input_section->flags & SEC_DEBUGGING) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + || (sec->output_section == NULL + && (sh_elf_hash_entry (h)->tls_type == GOT_TLS_IE + || sh_elf_hash_entry (h)->tls_type == GOT_TLS_GD))) + relocation = 0; + else if (sec->output_section == NULL) + { + (*_bfd_error_handler) + (_("%s: unresolvable relocation against symbol `%s' from %s section"), + bfd_archive_filename (input_bfd), h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + return FALSE; + } + else + relocation = ((h->root.u.def.value + + sec->output_section->vma + + sec->output_offset) + /* A STO_SH5_ISA32 causes a "bitor 1" to the + symbol value, unless we've seen + STT_DATALABEL on the way to it. */ + | ((h->other & STO_SH5_ISA32) != 0 + && ! seen_stt_datalabel)); + } + else if (h->root.type == bfd_link_hash_undefweak) + relocation = 0; + else if (info->unresolved_syms_in_objects == RM_IGNORE + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + relocation = 0; + else + { + if (! info->callbacks->undefined_symbol + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, + (info->unresolved_syms_in_objects == RM_GENERATE_ERROR + || ELF_ST_VISIBILITY (h->other)))) + return FALSE; + relocation = 0; + } + } + + switch ((int) r_type) + { + final_link_relocate: + /* COFF relocs don't use the addend. The addend is used for + R_SH_DIR32 to be compatible with other compilers. */ + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, addend); + break; + + case R_SH_IND12W: + goto final_link_relocate; + + case R_SH_DIR8WPN: + case R_SH_DIR8WPZ: + case R_SH_DIR8WPL: + /* If the reloc is against the start of this section, then + the assembler has already taken care of it and the reloc + is here only to assist in relaxing. If the reloc is not + against the start of this section, then it's against an + external symbol and we must deal with it ourselves. */ + if (input_section->output_section->vma + input_section->output_offset + != relocation) + { + int disp = (relocation + - input_section->output_section->vma + - input_section->output_offset + - rel->r_offset); + int mask = 0; + switch (r_type) + { + case R_SH_DIR8WPN: + case R_SH_DIR8WPZ: mask = 1; break; + case R_SH_DIR8WPL: mask = 3; break; + default: mask = 0; break; + } + if (disp & mask) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: fatal: unaligned branch target for relax-support relocation"), + bfd_archive_filename (input_section->owner), + (unsigned long) rel->r_offset)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + relocation -= 4; + goto final_link_relocate; + } + r = bfd_reloc_ok; + break; + + default: +#ifdef INCLUDE_SHMEDIA + if (shmedia_prepare_reloc (info, input_bfd, input_section, + contents, rel, &relocation)) + goto final_link_relocate; +#endif + bfd_set_error (bfd_error_bad_value); + return FALSE; + + case R_SH_DIR16: + case R_SH_DIR8: + case R_SH_DIR8U: + case R_SH_DIR8S: + case R_SH_DIR4U: + goto final_link_relocate; + + case R_SH_DIR8UL: + case R_SH_DIR4UL: + if (relocation & 3) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: fatal: unaligned %s relocation 0x%lx"), + bfd_archive_filename (input_section->owner), + (unsigned long) rel->r_offset, howto->name, + (unsigned long)relocation)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + goto final_link_relocate; + + case R_SH_DIR8UW: + case R_SH_DIR8SW: + case R_SH_DIR4UW: + if (relocation & 1) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: fatal: unaligned %s relocation 0x%lx"), + bfd_archive_filename (input_section->owner), + (unsigned long) rel->r_offset, howto->name, + (unsigned long)relocation)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + goto final_link_relocate; + + case R_SH_PSHA: + if ((signed int)relocation < -32 + || (signed int)relocation > 32) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: fatal: R_SH_PSHA relocation %d not in range -32..32"), + bfd_archive_filename (input_section->owner), + (unsigned long) rel->r_offset, + (unsigned long)relocation)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + goto final_link_relocate; + + case R_SH_PSHL: + if ((signed int)relocation < -16 + || (signed int)relocation > 16) + { + ((*_bfd_error_handler) + (_("%s: 0x%lx: fatal: R_SH_PSHL relocation %d not in range -32..32"), + bfd_archive_filename (input_section->owner), + (unsigned long) rel->r_offset, + (unsigned long)relocation)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + goto final_link_relocate; + + case R_SH_DIR32: + case R_SH_REL32: +#ifdef INCLUDE_SHMEDIA + case R_SH_IMM_LOW16_PCREL: + case R_SH_IMM_MEDLOW16_PCREL: + case R_SH_IMM_MEDHI16_PCREL: + case R_SH_IMM_HI16_PCREL: +#endif + if (info->shared + && (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak) + && r_symndx != 0 + && (input_section->flags & SEC_ALLOC) != 0 + && (r_type == R_SH_DIR32 + || !SYMBOL_CALLS_LOCAL (info, h))) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + bfd_boolean skip, relocate; + + /* When generating a shared object, these relocations + are copied into the output file to be resolved at run + time. */ + + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (input_bfd, + elf_elfheader (input_bfd)->e_shstrndx, + elf_section_data (input_section)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (input_bfd, + input_section), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + BFD_ASSERT (sreloc != NULL); + } + + skip = FALSE; + relocate = FALSE; + + outrel.r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, + rel->r_offset); + if (outrel.r_offset == (bfd_vma) -1) + skip = TRUE; + else if (outrel.r_offset == (bfd_vma) -2) + skip = TRUE, relocate = TRUE; + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + else if (r_type == R_SH_REL32) + { + BFD_ASSERT (h != NULL && h->dynindx != -1); + outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_REL32); + outrel.r_addend + = bfd_get_32 (input_bfd, contents + rel->r_offset); + } +#ifdef INCLUDE_SHMEDIA + else if (r_type == R_SH_IMM_LOW16_PCREL + || r_type == R_SH_IMM_MEDLOW16_PCREL + || r_type == R_SH_IMM_MEDHI16_PCREL + || r_type == R_SH_IMM_HI16_PCREL) + { + BFD_ASSERT (h != NULL && h->dynindx != -1); + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + outrel.r_addend = addend; + } +#endif + else + { + /* h->dynindx may be -1 if this symbol was marked to + become local. */ + if (h == NULL + || ((info->symbolic || h->dynindx == -1) + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) != 0)) + { + relocate = TRUE; + outrel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE); + outrel.r_addend + = relocation + bfd_get_32 (input_bfd, + contents + rel->r_offset); + } + else + { + BFD_ASSERT (h->dynindx != -1); + outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_DIR32); + outrel.r_addend + = relocation + bfd_get_32 (input_bfd, + contents + rel->r_offset); + } + } + + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + + /* If this reloc is against an external symbol, we do + not want to fiddle with the addend. Otherwise, we + need to include the symbol value so that it becomes + an addend for the dynamic reloc. */ + if (! relocate) + continue; + } + goto final_link_relocate; + + case R_SH_GOTPLT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOTPLT_LOW16: + case R_SH_GOTPLT_MEDLOW16: + case R_SH_GOTPLT_MEDHI16: + case R_SH_GOTPLT_HI16: + case R_SH_GOTPLT10BY4: + case R_SH_GOTPLT10BY8: +#endif + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + if (h == NULL + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) + || ! info->shared + || info->symbolic + || h->dynindx == -1 + || h->plt.offset == (bfd_vma) -1 + || h->got.offset != (bfd_vma) -1) + goto force_got; + + /* Relocation is to the entry for this symbol in the global + offset table extension for the procedure linkage table. */ + + BFD_ASSERT (sgotplt != NULL); + relocation = (sgotplt->output_offset + + ((h->plt.offset / elf_sh_sizeof_plt (info) + - 1 + 3) * 4)); + +#ifdef GOT_BIAS + relocation -= GOT_BIAS; +#endif + + goto final_link_relocate; + + force_got: + case R_SH_GOT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOT_LOW16: + case R_SH_GOT_MEDLOW16: + case R_SH_GOT_MEDHI16: + case R_SH_GOT_HI16: + case R_SH_GOT10BY4: + case R_SH_GOT10BY8: +#endif + /* Relocation is to the entry for this symbol in the global + offset table. */ + + BFD_ASSERT (sgot != NULL); + + if (h != NULL) + { + bfd_boolean dyn; + + off = h->got.offset; +#ifdef INCLUDE_SHMEDIA + if (seen_stt_datalabel) + { + struct elf_sh_link_hash_entry *hsh; + + hsh = (struct elf_sh_link_hash_entry *)h; + off = hsh->datalabel_got.offset; + } +#endif + BFD_ASSERT (off != (bfd_vma) -1); + + dyn = htab->root.dynamic_sections_created; + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) + || (info->shared + && SYMBOL_REFERENCES_LOCAL (info, h)) + || (ELF_ST_VISIBILITY (h->other) + && h->root.type == bfd_link_hash_undefweak)) + { + /* This is actually a static link, or it is a + -Bsymbolic link and the symbol is defined + locally, or the symbol was forced to be local + because of a version file. We must initialize + this entry in the global offset table. Since the + offset must always be a multiple of 4, we use the + least significant bit to record whether we have + initialized it already. + + When doing a dynamic link, we create a .rela.got + relocation entry to initialize the value. This + is done in the finish_dynamic_symbol routine. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_32 (output_bfd, relocation, + sgot->contents + off); +#ifdef INCLUDE_SHMEDIA + if (seen_stt_datalabel) + { + struct elf_sh_link_hash_entry *hsh; + + hsh = (struct elf_sh_link_hash_entry *)h; + hsh->datalabel_got.offset |= 1; + } + else +#endif + h->got.offset |= 1; + } + } + + relocation = sgot->output_offset + off; + } + else + { +#ifdef INCLUDE_SHMEDIA + if (rel->r_addend) + { + BFD_ASSERT (local_got_offsets != NULL + && (local_got_offsets[symtab_hdr->sh_info + + r_symndx] + != (bfd_vma) -1)); + + off = local_got_offsets[symtab_hdr->sh_info + + r_symndx]; + } + else + { +#endif + BFD_ASSERT (local_got_offsets != NULL + && local_got_offsets[r_symndx] != (bfd_vma) -1); + + off = local_got_offsets[r_symndx]; +#ifdef INCLUDE_SHMEDIA + } +#endif + + /* The offset must always be a multiple of 4. We use + the least significant bit to record whether we have + already generated the necessary reloc. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_32 (output_bfd, relocation, sgot->contents + off); + + if (info->shared) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + + if (srelgot == NULL) + { + srelgot = bfd_get_section_by_name (dynobj, + ".rela.got"); + BFD_ASSERT (srelgot != NULL); + } + + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + off); + outrel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE); + outrel.r_addend = relocation; + loc = srelgot->contents; + loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + } + +#ifdef INCLUDE_SHMEDIA + if (rel->r_addend) + local_got_offsets[symtab_hdr->sh_info + r_symndx] |= 1; + else +#endif + local_got_offsets[r_symndx] |= 1; + } + + relocation = sgot->output_offset + off; + } + +#ifdef GOT_BIAS + relocation -= GOT_BIAS; +#endif + + goto final_link_relocate; + + case R_SH_GOTOFF: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOTOFF_LOW16: + case R_SH_GOTOFF_MEDLOW16: + case R_SH_GOTOFF_MEDHI16: + case R_SH_GOTOFF_HI16: +#endif + /* Relocation is relative to the start of the global offset + table. */ + + BFD_ASSERT (sgot != NULL); + + /* Note that sgot->output_offset is not involved in this + calculation. We always want the start of .got. If we + defined _GLOBAL_OFFSET_TABLE in a different way, as is + permitted by the ABI, we might have to change this + calculation. */ + relocation -= sgot->output_section->vma; + +#ifdef GOT_BIAS + relocation -= GOT_BIAS; +#endif + + addend = rel->r_addend; + + goto final_link_relocate; + + case R_SH_GOTPC: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOTPC_LOW16: + case R_SH_GOTPC_MEDLOW16: + case R_SH_GOTPC_MEDHI16: + case R_SH_GOTPC_HI16: +#endif + /* Use global offset table as symbol value. */ + + BFD_ASSERT (sgot != NULL); + relocation = sgot->output_section->vma; + +#ifdef GOT_BIAS + relocation += GOT_BIAS; +#endif + + addend = rel->r_addend; + + goto final_link_relocate; + + case R_SH_PLT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_PLT_LOW16: + case R_SH_PLT_MEDLOW16: + case R_SH_PLT_MEDHI16: + case R_SH_PLT_HI16: +#endif + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + /* Resolve a PLT reloc against a local symbol directly, + without using the procedure linkage table. */ + if (h == NULL) + goto final_link_relocate; + + if (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) + goto final_link_relocate; + + if (h->plt.offset == (bfd_vma) -1) + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ + goto final_link_relocate; + } + + BFD_ASSERT (splt != NULL); + relocation = (splt->output_section->vma + + splt->output_offset + + h->plt.offset); + +#ifdef INCLUDE_SHMEDIA + relocation++; +#endif + + addend = rel->r_addend; + + goto final_link_relocate; + + case R_SH_LOOP_START: + { + static bfd_vma start, end; + + start = (relocation + rel->r_addend + - (sec->output_section->vma + sec->output_offset)); + r = sh_elf_reloc_loop (r_type, input_bfd, input_section, contents, + rel->r_offset, sec, start, end); + break; + + case R_SH_LOOP_END: + end = (relocation + rel->r_addend + - (sec->output_section->vma + sec->output_offset)); + r = sh_elf_reloc_loop (r_type, input_bfd, input_section, contents, + rel->r_offset, sec, start, end); + break; + } + + case R_SH_TLS_GD_32: + case R_SH_TLS_IE_32: + r_type = sh_elf_optimized_tls_reloc (info, r_type, h == NULL); + tls_type = GOT_UNKNOWN; + if (h == NULL && local_got_offsets) + tls_type = sh_elf_local_got_tls_type (input_bfd) [r_symndx]; + else if (h != NULL) + { + tls_type = sh_elf_hash_entry (h)->tls_type; + if (! info->shared + && (h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + r_type = R_SH_TLS_LE_32; + } + + if (r_type == R_SH_TLS_GD_32 && tls_type == GOT_TLS_IE) + r_type = R_SH_TLS_IE_32; + + if (r_type == R_SH_TLS_LE_32) + { + bfd_vma offset; + unsigned short insn; + + if (ELF32_R_TYPE (rel->r_info) == R_SH_TLS_GD_32) + { + /* GD->LE transition: + mov.l 1f,r4; mova 2f,r0; mov.l 2f,r1; add r0,r1; + jsr @r1; add r12,r4; bra 3f; nop; .align 2; + 1: .long x$TLSGD; 2: .long __tls_get_addr@PLT; 3: + We change it into: + mov.l 1f,r4; stc gbr,r0; add r4,r0; nop; + nop; nop; ... + 1: .long x@TPOFF; 2: .long __tls_get_addr@PLT; 3:. */ + + offset = rel->r_offset; + BFD_ASSERT (offset >= 16); + /* Size of GD instructions is 16 or 18. */ + offset -= 16; + insn = bfd_get_16 (input_bfd, contents + offset + 0); + if ((insn & 0xff00) == 0xc700) + { + BFD_ASSERT (offset >= 2); + offset -= 2; + insn = bfd_get_16 (input_bfd, contents + offset + 0); + } + + BFD_ASSERT ((insn & 0xff00) == 0xd400); + insn = bfd_get_16 (input_bfd, contents + offset + 2); + BFD_ASSERT ((insn & 0xff00) == 0xc700); + insn = bfd_get_16 (input_bfd, contents + offset + 4); + BFD_ASSERT ((insn & 0xff00) == 0xd100); + insn = bfd_get_16 (input_bfd, contents + offset + 6); + BFD_ASSERT (insn == 0x310c); + insn = bfd_get_16 (input_bfd, contents + offset + 8); + BFD_ASSERT (insn == 0x410b); + insn = bfd_get_16 (input_bfd, contents + offset + 10); + BFD_ASSERT (insn == 0x34cc); + + bfd_put_16 (output_bfd, 0x0012, contents + offset + 2); + bfd_put_16 (output_bfd, 0x304c, contents + offset + 4); + bfd_put_16 (output_bfd, 0x0009, contents + offset + 6); + bfd_put_16 (output_bfd, 0x0009, contents + offset + 8); + bfd_put_16 (output_bfd, 0x0009, contents + offset + 10); + } + else + { + int index; + + /* IE->LE transition: + mov.l 1f,r0; stc gbr,rN; mov.l @(r0,r12),rM; + bra 2f; add ...; .align 2; 1: x@GOTTPOFF; 2: + We change it into: + mov.l .Ln,rM; stc gbr,rN; nop; ...; + 1: x@TPOFF; 2:. */ + + offset = rel->r_offset; + BFD_ASSERT (offset >= 16); + /* Size of IE instructions is 10 or 12. */ + offset -= 10; + insn = bfd_get_16 (input_bfd, contents + offset + 0); + if ((insn & 0xf0ff) == 0x0012) + { + BFD_ASSERT (offset >= 2); + offset -= 2; + insn = bfd_get_16 (input_bfd, contents + offset + 0); + } + + BFD_ASSERT ((insn & 0xff00) == 0xd000); + index = insn & 0x00ff; + insn = bfd_get_16 (input_bfd, contents + offset + 2); + BFD_ASSERT ((insn & 0xf0ff) == 0x0012); + insn = bfd_get_16 (input_bfd, contents + offset + 4); + BFD_ASSERT ((insn & 0xf0ff) == 0x00ce); + insn = 0xd000 | (insn & 0x0f00) | index; + bfd_put_16 (output_bfd, insn, contents + offset + 0); + bfd_put_16 (output_bfd, 0x0009, contents + offset + 4); + } + + bfd_put_32 (output_bfd, tpoff (info, relocation), + contents + rel->r_offset); + continue; + } + + sgot = htab->sgot; + if (sgot == NULL) + abort (); + + if (h != NULL) + off = h->got.offset; + else + { + if (local_got_offsets == NULL) + abort (); + + off = local_got_offsets[r_symndx]; + } + + /* Relocate R_SH_TLS_IE_32 directly when statically linking. */ + if (r_type == R_SH_TLS_IE_32 + && ! htab->root.dynamic_sections_created) + { + off &= ~1; + bfd_put_32 (output_bfd, tpoff (info, relocation), + sgot->contents + off); + bfd_put_32 (output_bfd, sgot->output_offset + off, + contents + rel->r_offset); + continue; + } + + if ((off & 1) != 0) + off &= ~1; + else + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + int dr_type, indx; + + if (srelgot == NULL) + { + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (srelgot != NULL); + } + + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + off); + + if (h == NULL || h->dynindx == -1) + indx = 0; + else + indx = h->dynindx; + + dr_type = (r_type == R_SH_TLS_GD_32 ? R_SH_TLS_DTPMOD32 : + R_SH_TLS_TPOFF32); + if (dr_type == R_SH_TLS_TPOFF32 && indx == 0) + outrel.r_addend = relocation - dtpoff_base (info); + else + outrel.r_addend = 0; + outrel.r_info = ELF32_R_INFO (indx, dr_type); + loc = srelgot->contents; + loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + + if (r_type == R_SH_TLS_GD_32) + { + if (indx == 0) + { + bfd_put_32 (output_bfd, + relocation - dtpoff_base (info), + sgot->contents + off + 4); + } + else + { + outrel.r_info = ELF32_R_INFO (indx, + R_SH_TLS_DTPOFF32); + outrel.r_offset += 4; + outrel.r_addend = 0; + srelgot->reloc_count++; + loc += sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + } + } + + if (h != NULL) + h->got.offset |= 1; + else + local_got_offsets[r_symndx] |= 1; + } + + if (off >= (bfd_vma) -2) + abort (); + + if (r_type == (int) ELF32_R_TYPE (rel->r_info)) + relocation = sgot->output_offset + off; + else + { + bfd_vma offset; + unsigned short insn; + + /* GD->IE transition: + mov.l 1f,r4; mova 2f,r0; mov.l 2f,r1; add r0,r1; + jsr @r1; add r12,r4; bra 3f; nop; .align 2; + 1: .long x$TLSGD; 2: .long __tls_get_addr@PLT; 3: + We change it into: + mov.l 1f,r0; stc gbr,r4; mov.l @(r0,r12),r0; add r4,r0; + nop; nop; bra 3f; nop; .align 2; + 1: .long x@TPOFF; 2:...; 3:. */ + + offset = rel->r_offset; + BFD_ASSERT (offset >= 16); + /* Size of GD instructions is 16 or 18. */ + offset -= 16; + insn = bfd_get_16 (input_bfd, contents + offset + 0); + if ((insn & 0xff00) == 0xc700) + { + BFD_ASSERT (offset >= 2); + offset -= 2; + insn = bfd_get_16 (input_bfd, contents + offset + 0); + } + + BFD_ASSERT ((insn & 0xff00) == 0xd400); + + /* Replace mov.l 1f,R4 with mov.l 1f,r0. */ + bfd_put_16 (output_bfd, insn & 0xf0ff, contents + offset); + + insn = bfd_get_16 (input_bfd, contents + offset + 2); + BFD_ASSERT ((insn & 0xff00) == 0xc700); + insn = bfd_get_16 (input_bfd, contents + offset + 4); + BFD_ASSERT ((insn & 0xff00) == 0xd100); + insn = bfd_get_16 (input_bfd, contents + offset + 6); + BFD_ASSERT (insn == 0x310c); + insn = bfd_get_16 (input_bfd, contents + offset + 8); + BFD_ASSERT (insn == 0x410b); + insn = bfd_get_16 (input_bfd, contents + offset + 10); + BFD_ASSERT (insn == 0x34cc); + + bfd_put_16 (output_bfd, 0x0412, contents + offset + 2); + bfd_put_16 (output_bfd, 0x00ce, contents + offset + 4); + bfd_put_16 (output_bfd, 0x304c, contents + offset + 6); + bfd_put_16 (output_bfd, 0x0009, contents + offset + 8); + bfd_put_16 (output_bfd, 0x0009, contents + offset + 10); + + bfd_put_32 (output_bfd, sgot->output_offset + off, + contents + rel->r_offset); + + continue; + } + + addend = rel->r_addend; + + goto final_link_relocate; + + case R_SH_TLS_LD_32: + if (! info->shared) + { + bfd_vma offset; + unsigned short insn; + + /* LD->LE transition: + mov.l 1f,r4; mova 2f,r0; mov.l 2f,r1; add r0,r1; + jsr @r1; add r12,r4; bra 3f; nop; .align 2; + 1: .long x$TLSLD; 2: .long __tls_get_addr@PLT; 3: + We change it into: + stc gbr,r0; nop; nop; nop; + nop; nop; bra 3f; ...; 3:. */ + + offset = rel->r_offset; + BFD_ASSERT (offset >= 16); + /* Size of LD instructions is 16 or 18. */ + offset -= 16; + insn = bfd_get_16 (input_bfd, contents + offset + 0); + if ((insn & 0xff00) == 0xc700) + { + BFD_ASSERT (offset >= 2); + offset -= 2; + insn = bfd_get_16 (input_bfd, contents + offset + 0); + } + + BFD_ASSERT ((insn & 0xff00) == 0xd400); + insn = bfd_get_16 (input_bfd, contents + offset + 2); + BFD_ASSERT ((insn & 0xff00) == 0xc700); + insn = bfd_get_16 (input_bfd, contents + offset + 4); + BFD_ASSERT ((insn & 0xff00) == 0xd100); + insn = bfd_get_16 (input_bfd, contents + offset + 6); + BFD_ASSERT (insn == 0x310c); + insn = bfd_get_16 (input_bfd, contents + offset + 8); + BFD_ASSERT (insn == 0x410b); + insn = bfd_get_16 (input_bfd, contents + offset + 10); + BFD_ASSERT (insn == 0x34cc); + + bfd_put_16 (output_bfd, 0x0012, contents + offset + 0); + bfd_put_16 (output_bfd, 0x0009, contents + offset + 2); + bfd_put_16 (output_bfd, 0x0009, contents + offset + 4); + bfd_put_16 (output_bfd, 0x0009, contents + offset + 6); + bfd_put_16 (output_bfd, 0x0009, contents + offset + 8); + bfd_put_16 (output_bfd, 0x0009, contents + offset + 10); + + continue; + } + + sgot = htab->sgot; + if (sgot == NULL) + abort (); + + off = htab->tls_ldm_got.offset; + if (off & 1) + off &= ~1; + else + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + + srelgot = htab->srelgot; + if (srelgot == NULL) + abort (); + + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + off); + outrel.r_addend = 0; + outrel.r_info = ELF32_R_INFO (0, R_SH_TLS_DTPMOD32); + loc = srelgot->contents; + loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + htab->tls_ldm_got.offset |= 1; + } + + relocation = sgot->output_offset + off; + addend = rel->r_addend; + + goto final_link_relocate; + + case R_SH_TLS_LDO_32: + if (! info->shared) + relocation = tpoff (info, relocation); + else + relocation -= dtpoff_base (info); + + addend = rel->r_addend; + goto final_link_relocate; + + case R_SH_TLS_LE_32: + { + int indx; + Elf_Internal_Rela outrel; + bfd_byte *loc; + + if (! info->shared) + { + relocation = tpoff (info, relocation); + addend = rel->r_addend; + goto final_link_relocate; + } + + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (input_bfd, + elf_elfheader (input_bfd)->e_shstrndx, + elf_section_data (input_section)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (input_bfd, + input_section), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + BFD_ASSERT (sreloc != NULL); + } + + if (h == NULL || h->dynindx == -1) + indx = 0; + else + indx = h->dynindx; + + outrel.r_offset = (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset); + outrel.r_info = ELF32_R_INFO (indx, R_SH_TLS_TPOFF32); + if (indx == 0) + outrel.r_addend = relocation - dtpoff_base (info); + else + outrel.r_addend = 0; + + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + continue; + } + } + + relocation_done: + if (r != bfd_reloc_ok) + { + switch (r) + { + default: + case bfd_reloc_outofrange: + abort (); + case bfd_reloc_overflow: + { + const char *name; + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL) + return FALSE; + if (*name == '\0') + name = bfd_section_name (input_bfd, sec); + } + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return FALSE; + } + break; + } + } + } + + return TRUE; +} + +/* This is a version of bfd_generic_get_relocated_section_contents + which uses sh_elf_relocate_section. */ + +static bfd_byte * +sh_elf_get_relocated_section_contents (bfd *output_bfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + bfd_boolean relocatable, + asymbol **symbols) +{ + Elf_Internal_Shdr *symtab_hdr; + asection *input_section = link_order->u.indirect.section; + bfd *input_bfd = input_section->owner; + asection **sections = NULL; + Elf_Internal_Rela *internal_relocs = NULL; + Elf_Internal_Sym *isymbuf = NULL; + + /* We only need to handle the case of relaxing, or of having a + particular set of section contents, specially. */ + if (relocatable + || elf_section_data (input_section)->this_hdr.contents == NULL) + return bfd_generic_get_relocated_section_contents (output_bfd, link_info, + link_order, data, + relocatable, + symbols); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + + memcpy (data, elf_section_data (input_section)->this_hdr.contents, + (size_t) input_section->_raw_size); + + if ((input_section->flags & SEC_RELOC) != 0 + && input_section->reloc_count > 0) + { + asection **secpp; + Elf_Internal_Sym *isym, *isymend; + bfd_size_type amt; + + internal_relocs = (_bfd_elf_link_read_relocs + (input_bfd, input_section, NULL, + (Elf_Internal_Rela *) NULL, FALSE)); + if (internal_relocs == NULL) + goto error_return; + + if (symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + amt = symtab_hdr->sh_info; + amt *= sizeof (asection *); + sections = (asection **) bfd_malloc (amt); + if (sections == NULL && amt != 0) + goto error_return; + + isymend = isymbuf + symtab_hdr->sh_info; + for (isym = isymbuf, secpp = sections; isym < isymend; ++isym, ++secpp) + { + asection *isec; + + if (isym->st_shndx == SHN_UNDEF) + isec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + isec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + isec = bfd_com_section_ptr; + else + isec = bfd_section_from_elf_index (input_bfd, isym->st_shndx); + + *secpp = isec; + } + + if (! sh_elf_relocate_section (output_bfd, link_info, input_bfd, + input_section, data, internal_relocs, + isymbuf, sections)) + goto error_return; + + if (sections != NULL) + free (sections); + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (elf_section_data (input_section)->relocs != internal_relocs) + free (internal_relocs); + } + + return data; + + error_return: + if (sections != NULL) + free (sections); + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + free (isymbuf); + if (internal_relocs != NULL + && elf_section_data (input_section)->relocs != internal_relocs) + free (internal_relocs); + return NULL; +} + +/* Return the base VMA address which should be subtracted from real addresses + when resolving @dtpoff relocation. + This is PT_TLS segment p_vaddr. */ + +static bfd_vma +dtpoff_base (struct bfd_link_info *info) +{ + /* If tls_sec is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_sec == NULL) + return 0; + return elf_hash_table (info)->tls_sec->vma; +} + +/* Return the relocation value for R_SH_TLS_TPOFF32.. */ + +static bfd_vma +tpoff (struct bfd_link_info *info, bfd_vma address) +{ + /* If tls_sec is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_sec == NULL) + return 0; + /* SH TLS ABI is variant I and static TLS block start just after tcbhead + structure which has 2 pointer fields. */ + return address - elf_hash_table (info)->tls_sec->vma + 8; +} + +static asection * +sh_elf_gc_mark_hook (asection *sec, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Rela *rel, struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_SH_GNU_VTINHERIT: + case R_SH_GNU_VTENTRY: + break; + + default: +#ifdef INCLUDE_SHMEDIA + while (h->root.type == bfd_link_hash_indirect + && h->root.u.i.link) + h = (struct elf_link_hash_entry *) h->root.u.i.link; +#endif + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the got entry reference counts for the section being removed. */ + +static bfd_boolean +sh_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_signed_vma *local_got_refcounts; + const Elf_Internal_Rela *rel, *relend; + + elf_section_data (sec)->local_dynrel = NULL; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + local_got_refcounts = elf_local_got_refcounts (abfd); + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; rel++) + { + unsigned long r_symndx; + unsigned int r_type; + struct elf_link_hash_entry *h = NULL; +#ifdef INCLUDE_SHMEDIA + int seen_stt_datalabel = 0; +#endif + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + struct elf_sh_link_hash_entry *eh; + struct elf_sh_dyn_relocs **pp; + struct elf_sh_dyn_relocs *p; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; +#ifdef INCLUDE_SHMEDIA + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + { + seen_stt_datalabel |= h->type == STT_DATALABEL; + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } +#endif + eh = (struct elf_sh_link_hash_entry *) h; + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { + /* Everything must go for SEC. */ + *pp = p->next; + break; + } + } + + r_type = ELF32_R_TYPE (rel->r_info); + switch (sh_elf_optimized_tls_reloc (info, r_type, h != NULL)) + { + case R_SH_TLS_LD_32: + if (sh_elf_hash_table (info)->tls_ldm_got.refcount > 0) + sh_elf_hash_table (info)->tls_ldm_got.refcount -= 1; + break; + + case R_SH_GOT32: + case R_SH_GOTOFF: + case R_SH_GOTPC: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOT_LOW16: + case R_SH_GOT_MEDLOW16: + case R_SH_GOT_MEDHI16: + case R_SH_GOT_HI16: + case R_SH_GOT10BY4: + case R_SH_GOT10BY8: + case R_SH_GOTOFF_LOW16: + case R_SH_GOTOFF_MEDLOW16: + case R_SH_GOTOFF_MEDHI16: + case R_SH_GOTOFF_HI16: + case R_SH_GOTPC_LOW16: + case R_SH_GOTPC_MEDLOW16: + case R_SH_GOTPC_MEDHI16: + case R_SH_GOTPC_HI16: +#endif + case R_SH_TLS_GD_32: + case R_SH_TLS_IE_32: + if (h != NULL) + { +#ifdef INCLUDE_SHMEDIA + if (seen_stt_datalabel) + { + struct elf_sh_link_hash_entry *eh; + eh = (struct elf_sh_link_hash_entry *) h; + if (eh->datalabel_got.refcount > 0) + eh->datalabel_got.refcount -= 1; + } + else +#endif + if (h->got.refcount > 0) + h->got.refcount -= 1; + } + else if (local_got_refcounts != NULL) + { +#ifdef INCLUDE_SHMEDIA + if (rel->r_addend & 1) + { + if (local_got_refcounts[symtab_hdr->sh_info + r_symndx] > 0) + local_got_refcounts[symtab_hdr->sh_info + r_symndx] -= 1; + } + else +#endif + if (local_got_refcounts[r_symndx] > 0) + local_got_refcounts[r_symndx] -= 1; + } + break; + + case R_SH_DIR32: + case R_SH_REL32: + if (info->shared) + break; + /* Fall thru */ + + case R_SH_PLT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_PLT_LOW16: + case R_SH_PLT_MEDLOW16: + case R_SH_PLT_MEDHI16: + case R_SH_PLT_HI16: +#endif + if (h != NULL) + { + if (h->plt.refcount > 0) + h->plt.refcount -= 1; + } + break; + + case R_SH_GOTPLT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOTPLT_LOW16: + case R_SH_GOTPLT_MEDLOW16: + case R_SH_GOTPLT_MEDHI16: + case R_SH_GOTPLT_HI16: + case R_SH_GOTPLT10BY4: + case R_SH_GOTPLT10BY8: +#endif + if (h != NULL) + { + struct elf_sh_link_hash_entry *eh; + eh = (struct elf_sh_link_hash_entry *) h; + if (eh->gotplt_refcount > 0) + { + eh->gotplt_refcount -= 1; + if (h->plt.refcount > 0) + h->plt.refcount -= 1; + } +#ifdef INCLUDE_SHMEDIA + else if (seen_stt_datalabel) + { + if (eh->datalabel_got.refcount > 0) + eh->datalabel_got.refcount -= 1; + } +#endif + else if (h->got.refcount > 0) + h->got.refcount -= 1; + } + else if (local_got_refcounts != NULL) + { +#ifdef INCLUDE_SHMEDIA + if (rel->r_addend & 1) + { + if (local_got_refcounts[symtab_hdr->sh_info + r_symndx] > 0) + local_got_refcounts[symtab_hdr->sh_info + r_symndx] -= 1; + } + else +#endif + if (local_got_refcounts[r_symndx] > 0) + local_got_refcounts[r_symndx] -= 1; + } + break; + + default: + break; + } + } + + return TRUE; +} + +/* Copy the extra info we tack onto an elf_link_hash_entry. */ + +static void +sh_elf_copy_indirect_symbol (const struct elf_backend_data *bed, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) +{ + struct elf_sh_link_hash_entry *edir, *eind; +#ifdef INCLUDE_SHMEDIA + bfd_signed_vma tmp; +#endif + + edir = (struct elf_sh_link_hash_entry *) dir; + eind = (struct elf_sh_link_hash_entry *) ind; + + if (eind->dyn_relocs != NULL) + { + if (edir->dyn_relocs != NULL) + { + struct elf_sh_dyn_relocs **pp; + struct elf_sh_dyn_relocs *p; + + BFD_ASSERT (ind->root.type != bfd_link_hash_indirect); + + /* Add reloc counts against the weak sym to the strong sym + list. Merge any entries against the same section. */ + for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + { + struct elf_sh_dyn_relocs *q; + + for (q = edir->dyn_relocs; q != NULL; q = q->next) + if (q->sec == p->sec) + { + q->pc_count += p->pc_count; + q->count += p->count; + *pp = p->next; + break; + } + if (q == NULL) + pp = &p->next; + } + *pp = edir->dyn_relocs; + } + + edir->dyn_relocs = eind->dyn_relocs; + eind->dyn_relocs = NULL; + } + edir->gotplt_refcount = eind->gotplt_refcount; + eind->gotplt_refcount = 0; +#ifdef INCLUDE_SHMEDIA + tmp = edir->datalabel_got.refcount; + if (tmp < 1) + { + edir->datalabel_got.refcount = eind->datalabel_got.refcount; + eind->datalabel_got.refcount = tmp; + } + else + BFD_ASSERT (eind->datalabel_got.refcount < 1); +#endif + + if (ind->root.type == bfd_link_hash_indirect + && dir->got.refcount <= 0) + { + edir->tls_type = eind->tls_type; + eind->tls_type = GOT_UNKNOWN; + } + + if (ind->root.type != bfd_link_hash_indirect + && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) + /* If called to transfer flags for a weakdef during processing + of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. + We clear it ourselves for ELIMINATE_COPY_RELOCS. */ + dir->elf_link_hash_flags |= + (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC + | ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_REF_REGULAR_NONWEAK + | ELF_LINK_HASH_NEEDS_PLT)); + else + _bfd_elf_link_hash_copy_indirect (bed, dir, ind); +} + +static int +sh_elf_optimized_tls_reloc (struct bfd_link_info *info, int r_type, + int is_local) +{ + if (info->shared) + return r_type; + + switch (r_type) + { + case R_SH_TLS_GD_32: + case R_SH_TLS_IE_32: + if (is_local) + return R_SH_TLS_LE_32; + return R_SH_TLS_IE_32; + case R_SH_TLS_LD_32: + return R_SH_TLS_LE_32; + } + + return r_type; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static bfd_boolean +sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, + const Elf_Internal_Rela *relocs) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + struct elf_sh_link_hash_table *htab; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + bfd_vma *local_got_offsets; + asection *sgot; + asection *srelgot; + asection *sreloc; + unsigned int r_type; + int tls_type, old_tls_type; + + sgot = NULL; + srelgot = NULL; + sreloc = NULL; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + htab = sh_elf_hash_table (info); + local_got_offsets = elf_local_got_offsets (abfd); + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; +#ifdef INCLUDE_SHMEDIA + int seen_stt_datalabel = 0; +#endif + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; +#ifdef INCLUDE_SHMEDIA + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + { + seen_stt_datalabel |= h->type == STT_DATALABEL; + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } +#endif + } + + r_type = sh_elf_optimized_tls_reloc (info, r_type, h == NULL); + if (! info->shared + && r_type == R_SH_TLS_IE_32 + && h != NULL + && h->root.type != bfd_link_hash_undefined + && h->root.type != bfd_link_hash_undefweak + && (h->dynindx == -1 + || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + r_type = R_SH_TLS_LE_32; + + /* Some relocs require a global offset table. */ + if (htab->sgot == NULL) + { + switch (r_type) + { + case R_SH_GOTPLT32: + case R_SH_GOT32: + case R_SH_GOTOFF: + case R_SH_GOTPC: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOTPLT_LOW16: + case R_SH_GOTPLT_MEDLOW16: + case R_SH_GOTPLT_MEDHI16: + case R_SH_GOTPLT_HI16: + case R_SH_GOTPLT10BY4: + case R_SH_GOTPLT10BY8: + case R_SH_GOT_LOW16: + case R_SH_GOT_MEDLOW16: + case R_SH_GOT_MEDHI16: + case R_SH_GOT_HI16: + case R_SH_GOT10BY4: + case R_SH_GOT10BY8: + case R_SH_GOTOFF_LOW16: + case R_SH_GOTOFF_MEDLOW16: + case R_SH_GOTOFF_MEDHI16: + case R_SH_GOTOFF_HI16: + case R_SH_GOTPC_LOW16: + case R_SH_GOTPC_MEDLOW16: + case R_SH_GOTPC_MEDHI16: + case R_SH_GOTPC_HI16: +#endif + case R_SH_TLS_GD_32: + case R_SH_TLS_LD_32: + case R_SH_TLS_IE_32: + if (htab->sgot == NULL) + { + if (htab->root.dynobj == NULL) + htab->root.dynobj = abfd; + if (!create_got_section (htab->root.dynobj, info)) + return FALSE; + } + break; + + default: + break; + } + } + + switch (r_type) + { + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_SH_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_SH_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + + case R_SH_TLS_IE_32: + if (info->shared) + info->flags |= DF_STATIC_TLS; + + /* FALLTHROUGH */ + force_got: + case R_SH_TLS_GD_32: + case R_SH_GOT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOT_LOW16: + case R_SH_GOT_MEDLOW16: + case R_SH_GOT_MEDHI16: + case R_SH_GOT_HI16: + case R_SH_GOT10BY4: + case R_SH_GOT10BY8: +#endif + switch (r_type) + { + default: + tls_type = GOT_NORMAL; + break; + case R_SH_TLS_GD_32: + tls_type = GOT_TLS_GD; + break; + case R_SH_TLS_IE_32: + tls_type = GOT_TLS_IE; + break; + } + + if (h != NULL) + { +#ifdef INCLUDE_SHMEDIA + if (seen_stt_datalabel) + { + struct elf_sh_link_hash_entry *eh + = (struct elf_sh_link_hash_entry *) h; + + eh->datalabel_got.refcount += 1; + } + else +#endif + h->got.refcount += 1; + old_tls_type = sh_elf_hash_entry (h)->tls_type; + } + else + { + bfd_signed_vma *local_got_refcounts; + + /* This is a global offset table entry for a local + symbol. */ + local_got_refcounts = elf_local_got_refcounts (abfd); + if (local_got_refcounts == NULL) + { + bfd_size_type size; + + size = symtab_hdr->sh_info; + size *= sizeof (bfd_signed_vma); +#ifdef INCLUDE_SHMEDIA + /* Reserve space for both the datalabel and + codelabel local GOT offsets. */ + size *= 2; +#endif + size += symtab_hdr->sh_info; + local_got_refcounts = ((bfd_signed_vma *) + bfd_zalloc (abfd, size)); + if (local_got_refcounts == NULL) + return FALSE; + elf_local_got_refcounts (abfd) = local_got_refcounts; +#ifdef INCLUDE_SHMEDIA + /* Take care of both the datalabel and codelabel local + GOT offsets. */ + sh_elf_local_got_tls_type (abfd) + = (char *) (local_got_refcounts + 2 * symtab_hdr->sh_info); +#else + sh_elf_local_got_tls_type (abfd) + = (char *) (local_got_refcounts + symtab_hdr->sh_info); +#endif + } +#ifdef INCLUDE_SHMEDIA + if (rel->r_addend & 1) + local_got_refcounts[symtab_hdr->sh_info + r_symndx] += 1; + else +#endif + local_got_refcounts[r_symndx] += 1; + old_tls_type = sh_elf_local_got_tls_type (abfd) [r_symndx]; + } + + /* If a TLS symbol is accessed using IE at least once, + there is no point to use dynamic model for it. */ + if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN + && (old_tls_type != GOT_TLS_GD || tls_type != GOT_TLS_IE)) + { + if (old_tls_type == GOT_TLS_IE && tls_type == GOT_TLS_GD) + tls_type = GOT_TLS_IE; + else + { + (*_bfd_error_handler) + (_("%s: `%s' accessed both as normal and thread local symbol"), + bfd_archive_filename (abfd), h->root.root.string); + return FALSE; + } + } + + if (old_tls_type != tls_type) + { + if (h != NULL) + sh_elf_hash_entry (h)->tls_type = tls_type; + else + sh_elf_local_got_tls_type (abfd) [r_symndx] = tls_type; + } + + break; + + case R_SH_TLS_LD_32: + sh_elf_hash_table(info)->tls_ldm_got.refcount += 1; + break; + + case R_SH_GOTPLT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_GOTPLT_LOW16: + case R_SH_GOTPLT_MEDLOW16: + case R_SH_GOTPLT_MEDHI16: + case R_SH_GOTPLT_HI16: + case R_SH_GOTPLT10BY4: + case R_SH_GOTPLT10BY8: +#endif + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + + if (h == NULL + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) + || ! info->shared + || info->symbolic + || h->dynindx == -1) + goto force_got; + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount += 1; + ((struct elf_sh_link_hash_entry *) h)->gotplt_refcount += 1; + + break; + + case R_SH_PLT32: +#ifdef INCLUDE_SHMEDIA + case R_SH_PLT_LOW16: + case R_SH_PLT_MEDLOW16: + case R_SH_PLT_MEDHI16: + case R_SH_PLT_HI16: +#endif + /* This symbol requires a procedure linkage table entry. We + actually build the entry in adjust_dynamic_symbol, + because this might be a case of linking PIC code which is + never referenced by a dynamic object, in which case we + don't need to generate a procedure linkage table entry + after all. */ + + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + if (h == NULL) + continue; + + if (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) + break; + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount += 1; + break; + + case R_SH_DIR32: + case R_SH_REL32: +#ifdef INCLUDE_SHMEDIA + case R_SH_IMM_LOW16_PCREL: + case R_SH_IMM_MEDLOW16_PCREL: + case R_SH_IMM_MEDHI16_PCREL: + case R_SH_IMM_HI16_PCREL: +#endif + if (h != NULL && ! info->shared) + { + h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + h->plt.refcount += 1; + } + + /* If we are creating a shared library, and this is a reloc + against a global symbol, or a non PC relative reloc + against a local symbol, then we need to copy the reloc + into the shared library. However, if we are linking with + -Bsymbolic, we do not need to copy a reloc against a + global symbol which is defined in an object we are + including in the link (i.e., DEF_REGULAR is set). At + this point we have not seen all the input files, so it is + possible that DEF_REGULAR is not set now but will be set + later (it is never cleared). We account for that + possibility below by storing information in the + dyn_relocs field of the hash table entry. A similar + situation occurs when creating shared libraries and symbol + visibility changes render the symbol local. + + If on the other hand, we are creating an executable, we + may need to keep relocations for symbols satisfied by a + dynamic library if we manage to avoid copy relocs for the + symbol. */ + if ((info->shared + && (sec->flags & SEC_ALLOC) != 0 + && (r_type != R_SH_REL32 + || (h != NULL + && (! info->symbolic + || h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || (! info->shared + && (sec->flags & SEC_ALLOC) != 0 + && h != NULL + && (h->root.type == bfd_link_hash_defweak + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) + { + struct elf_sh_dyn_relocs *p; + struct elf_sh_dyn_relocs **head; + + if (htab->root.dynobj == NULL) + htab->root.dynobj = abfd; + + /* When creating a shared object, we must copy these + reloc types into the output file. We create a reloc + section in dynobj and make room for this reloc. */ + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (htab->root.dynobj, name); + if (sreloc == NULL) + { + flagword flags; + + sreloc = bfd_make_section (htab->root.dynobj, name); + flags = (SEC_HAS_CONTENTS | SEC_READONLY + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if ((sec->flags & SEC_ALLOC) != 0) + flags |= SEC_ALLOC | SEC_LOAD; + if (sreloc == NULL + || ! bfd_set_section_flags (htab->root.dynobj, + sreloc, flags) + || ! bfd_set_section_alignment (htab->root.dynobj, + sreloc, 2)) + return FALSE; + } + elf_section_data (sec)->sreloc = sreloc; + } + + /* If this is a global symbol, we count the number of + relocations we need for this symbol. */ + if (h != NULL) + head = &((struct elf_sh_link_hash_entry *) h)->dyn_relocs; + else + { + asection *s; + + /* Track dynamic relocs needed for local syms too. */ + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, + sec, r_symndx); + if (s == NULL) + return FALSE; + + head = ((struct elf_sh_dyn_relocs **) + &elf_section_data (s)->local_dynrel); + } + + p = *head; + if (p == NULL || p->sec != sec) + { + bfd_size_type amt = sizeof (*p); + p = bfd_alloc (htab->root.dynobj, amt); + if (p == NULL) + return FALSE; + p->next = *head; + *head = p; + p->sec = sec; + p->count = 0; + p->pc_count = 0; + } + + p->count += 1; + if (r_type == R_SH_REL32 +#ifdef INCLUDE_SHMEDIA + || r_type == R_SH_IMM_LOW16_PCREL + || r_type == R_SH_IMM_MEDLOW16_PCREL + || r_type == R_SH_IMM_MEDHI16_PCREL + || r_type == R_SH_IMM_HI16_PCREL +#endif + ) + p->pc_count += 1; + } + + break; + + case R_SH_TLS_LE_32: + if (info->shared) + { + (*_bfd_error_handler) (_("%s: TLS local exec code cannot be linked into shared objects"), + bfd_archive_filename (abfd)); + return FALSE; + } + + break; + + case R_SH_TLS_LDO_32: + /* Nothing to do. */ + break; + + default: + break; + } + } + + return TRUE; +} + +#ifndef sh_elf_set_mach_from_flags +static bfd_boolean +sh_elf_set_mach_from_flags (bfd *abfd) +{ + flagword flags = elf_elfheader (abfd)->e_flags; + + switch (flags & EF_SH_MACH_MASK) + { + case EF_SH1: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh); + break; + case EF_SH2: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh2); + break; + case EF_SH2E: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh2e); + break; + case EF_SH_DSP: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh_dsp); + break; + case EF_SH3: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh3); + break; + case EF_SH3_DSP: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh3_dsp); + break; + case EF_SH3E: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh3e); + break; + case EF_SH_UNKNOWN: + case EF_SH4: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4); + break; + case EF_SH4_NOFPU: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4_nofpu); + break; + case EF_SH4A: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4a); + break; + case EF_SH4A_NOFPU: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4a_nofpu); + break; + case EF_SH4AL_DSP: + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh4al_dsp); + break; + default: + return FALSE; + } + return TRUE; +} +#endif /* not sh_elf_set_mach_from_flags */ + +#ifndef sh_elf_set_private_flags +/* Function to keep SH specific file flags. */ + +static bfd_boolean +sh_elf_set_private_flags (bfd *abfd, flagword flags) +{ + BFD_ASSERT (! elf_flags_init (abfd) + || elf_elfheader (abfd)->e_flags == flags); + + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + return sh_elf_set_mach_from_flags (abfd); +} +#endif /* not sh_elf_set_private_flags */ + +#ifndef sh_elf_copy_private_data +/* Copy backend specific data from one object module to another */ + +static bfd_boolean +sh_elf_copy_private_data (bfd * ibfd, bfd * obfd) +{ + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + return sh_elf_set_private_flags (obfd, elf_elfheader (ibfd)->e_flags); +} +#endif /* not sh_elf_copy_private_data */ + +#ifndef sh_elf_merge_private_data +/* This routine checks for linking big and little endian objects + together, and for linking sh-dsp with sh3e / sh4 objects. */ + +static bfd_boolean +sh_elf_merge_private_data (bfd *ibfd, bfd *obfd) +{ + flagword old_flags, new_flags; + + if (! _bfd_generic_verify_endian_match (ibfd, obfd)) + return FALSE; + + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + if (! elf_flags_init (obfd)) + { + /* This happens when ld starts out with a 'blank' output file. */ + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = EF_SH1; + } + old_flags = elf_elfheader (obfd)->e_flags; + new_flags = elf_elfheader (ibfd)->e_flags; + if ((EF_SH_HAS_DSP (old_flags) && EF_SH_HAS_FP (new_flags)) + || (EF_SH_HAS_DSP (new_flags) && EF_SH_HAS_FP (old_flags))) + { + (*_bfd_error_handler) + ("%s: uses %s instructions while previous modules use %s instructions", + bfd_archive_filename (ibfd), + EF_SH_HAS_DSP (new_flags) ? "dsp" : "floating point", + EF_SH_HAS_DSP (new_flags) ? "floating point" : "dsp"); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + elf_elfheader (obfd)->e_flags = EF_SH_MERGE_MACH (old_flags, new_flags); + + return sh_elf_set_mach_from_flags (obfd); +} +#endif /* not sh_elf_merge_private_data */ + +/* Override the generic function because we need to store sh_elf_obj_tdata + as the specific tdata. We set also the machine architecture from flags + here. */ + +static bfd_boolean +sh_elf_object_p (bfd *abfd) +{ + return sh_elf_set_mach_from_flags (abfd); +} + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +static bfd_boolean +sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + struct elf_sh_link_hash_table *htab; + + htab = sh_elf_hash_table (info); + + if (h->plt.offset != (bfd_vma) -1) + { + asection *splt; + asection *sgot; + asection *srel; + + bfd_vma plt_index; + bfd_vma got_offset; + Elf_Internal_Rela rel; + bfd_byte *loc; + + /* This symbol has an entry in the procedure linkage table. Set + it up. */ + + BFD_ASSERT (h->dynindx != -1); + + splt = htab->splt; + sgot = htab->sgotplt; + srel = htab->srelplt; + BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); + + /* Get the index in the procedure linkage table which + corresponds to this symbol. This is the index of this symbol + in all the symbols for which we are making plt entries. The + first entry in the procedure linkage table is reserved. */ + plt_index = h->plt.offset / elf_sh_sizeof_plt (info) - 1; + + /* Get the offset into the .got table of the entry that + corresponds to this function. Each .got entry is 4 bytes. + The first three are reserved. */ + got_offset = (plt_index + 3) * 4; + +#ifdef GOT_BIAS + if (info->shared) + got_offset -= GOT_BIAS; +#endif + + /* Fill in the entry in the procedure linkage table. */ + if (! info->shared) + { + if (elf_sh_plt_entry == NULL) + { + elf_sh_plt_entry = (bfd_big_endian (output_bfd) ? + elf_sh_plt_entry_be : elf_sh_plt_entry_le); + } + memcpy (splt->contents + h->plt.offset, elf_sh_plt_entry, + elf_sh_sizeof_plt (info)); +#ifdef INCLUDE_SHMEDIA + movi_shori_putval (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + + got_offset), + (splt->contents + h->plt.offset + + elf_sh_plt_symbol_offset (info))); + + /* Set bottom bit because its for a branch to SHmedia */ + movi_shori_putval (output_bfd, + (splt->output_section->vma + splt->output_offset) + | 1, + (splt->contents + h->plt.offset + + elf_sh_plt_plt0_offset (info))); +#else + bfd_put_32 (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + + got_offset), + (splt->contents + h->plt.offset + + elf_sh_plt_symbol_offset (info))); + + bfd_put_32 (output_bfd, + (splt->output_section->vma + splt->output_offset), + (splt->contents + h->plt.offset + + elf_sh_plt_plt0_offset (info))); +#endif + } + else + { + if (elf_sh_pic_plt_entry == NULL) + { + elf_sh_pic_plt_entry = (bfd_big_endian (output_bfd) ? + elf_sh_pic_plt_entry_be : + elf_sh_pic_plt_entry_le); + } + memcpy (splt->contents + h->plt.offset, elf_sh_pic_plt_entry, + elf_sh_sizeof_plt (info)); +#ifdef INCLUDE_SHMEDIA + movi_shori_putval (output_bfd, got_offset, + (splt->contents + h->plt.offset + + elf_sh_plt_symbol_offset (info))); +#else + bfd_put_32 (output_bfd, got_offset, + (splt->contents + h->plt.offset + + elf_sh_plt_symbol_offset (info))); +#endif + } + +#ifdef GOT_BIAS + if (info->shared) + got_offset += GOT_BIAS; +#endif + +#ifdef INCLUDE_SHMEDIA + movi_shori_putval (output_bfd, + plt_index * sizeof (Elf32_External_Rela), + (splt->contents + h->plt.offset + + elf_sh_plt_reloc_offset (info))); +#else + bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), + (splt->contents + h->plt.offset + + elf_sh_plt_reloc_offset (info))); +#endif + + /* Fill in the entry in the global offset table. */ + bfd_put_32 (output_bfd, + (splt->output_section->vma + + splt->output_offset + + h->plt.offset + + elf_sh_plt_temp_offset (info)), + sgot->contents + got_offset); + + /* Fill in the entry in the .rela.plt section. */ + rel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + got_offset); + rel.r_info = ELF32_R_INFO (h->dynindx, R_SH_JMP_SLOT); + rel.r_addend = 0; +#ifdef GOT_BIAS + rel.r_addend = GOT_BIAS; +#endif + loc = srel->contents + plt_index * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + } + } + + if (h->got.offset != (bfd_vma) -1 + && sh_elf_hash_entry (h)->tls_type != GOT_TLS_GD + && sh_elf_hash_entry (h)->tls_type != GOT_TLS_IE) + { + asection *sgot; + asection *srel; + Elf_Internal_Rela rel; + bfd_byte *loc; + + /* This symbol has an entry in the global offset table. Set it + up. */ + + sgot = htab->sgot; + srel = htab->srelgot; + BFD_ASSERT (sgot != NULL && srel != NULL); + + rel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + (h->got.offset &~ (bfd_vma) 1)); + + /* If this is a static link, or it is a -Bsymbolic link and the + symbol is defined locally or was forced to be local because + of a version file, we just want to emit a RELATIVE reloc. + The entry in the global offset table will already have been + initialized in the relocate_section function. */ + if (info->shared + && SYMBOL_REFERENCES_LOCAL (info, h)) + { + rel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE); + rel.r_addend = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + else + { + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); + rel.r_info = ELF32_R_INFO (h->dynindx, R_SH_GLOB_DAT); + rel.r_addend = 0; + } + + loc = srel->contents; + loc += srel->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + } + +#ifdef INCLUDE_SHMEDIA + { + struct elf_sh_link_hash_entry *eh; + + eh = (struct elf_sh_link_hash_entry *) h; + if (eh->datalabel_got.offset != (bfd_vma) -1) + { + asection *sgot; + asection *srel; + Elf_Internal_Rela rel; + bfd_byte *loc; + + /* This symbol has a datalabel entry in the global offset table. + Set it up. */ + + sgot = htab->sgot; + srel = htab->srelgot; + BFD_ASSERT (sgot != NULL && srel != NULL); + + rel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + (eh->datalabel_got.offset &~ (bfd_vma) 1)); + + /* If this is a static link, or it is a -Bsymbolic link and the + symbol is defined locally or was forced to be local because + of a version file, we just want to emit a RELATIVE reloc. + The entry in the global offset table will already have been + initialized in the relocate_section function. */ + if (info->shared + && SYMBOL_REFERENCES_LOCAL (info, h)) + { + rel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE); + rel.r_addend = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + else + { + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + + eh->datalabel_got.offset); + rel.r_info = ELF32_R_INFO (h->dynindx, R_SH_GLOB_DAT); + rel.r_addend = 0; + } + + loc = srel->contents; + loc += srel->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + } + } +#endif + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + { + asection *s; + Elf_Internal_Rela rel; + bfd_byte *loc; + + /* This symbol needs a copy reloc. Set it up. */ + + BFD_ASSERT (h->dynindx != -1 + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)); + + s = bfd_get_section_by_name (h->root.u.def.section->owner, + ".rela.bss"); + BFD_ASSERT (s != NULL); + + rel.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + rel.r_info = ELF32_R_INFO (h->dynindx, R_SH_COPY); + rel.r_addend = 0; + loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + } + + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + sym->st_shndx = SHN_ABS; + + return TRUE; +} + +/* Finish up the dynamic sections. */ + +static bfd_boolean +sh_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) +{ + struct elf_sh_link_hash_table *htab; + asection *sgot; + asection *sdyn; + + htab = sh_elf_hash_table (info); + sgot = htab->sgotplt; + sdyn = bfd_get_section_by_name (htab->root.dynobj, ".dynamic"); + + if (htab->root.dynamic_sections_created) + { + asection *splt; + Elf32_External_Dyn *dyncon, *dynconend; + + BFD_ASSERT (sgot != NULL && sdyn != NULL); + + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + asection *s; +#ifdef INCLUDE_SHMEDIA + const char *name; +#endif + + bfd_elf32_swap_dyn_in (htab->root.dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + break; + +#ifdef INCLUDE_SHMEDIA + case DT_INIT: + name = info->init_function; + goto get_sym; + + case DT_FINI: + name = info->fini_function; + get_sym: + if (dyn.d_un.d_val != 0) + { + struct elf_link_hash_entry *h; + + h = elf_link_hash_lookup (&htab->root, name, + FALSE, FALSE, TRUE); + if (h != NULL && (h->other & STO_SH5_ISA32)) + { + dyn.d_un.d_val |= 1; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + } + } + break; +#endif + + case DT_PLTGOT: + s = htab->sgot->output_section; + goto get_vma; + + case DT_JMPREL: + s = htab->srelplt->output_section; + get_vma: + BFD_ASSERT (s != NULL); + dyn.d_un.d_ptr = s->vma; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_PLTRELSZ: + s = htab->srelplt->output_section; + BFD_ASSERT (s != NULL); + if (s->_cooked_size != 0) + dyn.d_un.d_val = s->_cooked_size; + else + dyn.d_un.d_val = s->_raw_size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_RELASZ: + /* My reading of the SVR4 ABI indicates that the + procedure linkage table relocs (DT_JMPREL) should be + included in the overall relocs (DT_RELA). This is + what Solaris does. However, UnixWare can not handle + that case. Therefore, we override the DT_RELASZ entry + here to make it not include the JMPREL relocs. Since + the linker script arranges for .rela.plt to follow all + other relocation sections, we don't have to worry + about changing the DT_RELA entry. */ + if (htab->srelplt != NULL) + { + s = htab->srelplt->output_section; + if (s->_cooked_size != 0) + dyn.d_un.d_val -= s->_cooked_size; + else + dyn.d_un.d_val -= s->_raw_size; + } + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + } + } + + /* Fill in the first entry in the procedure linkage table. */ + splt = htab->splt; + if (splt && splt->_raw_size > 0) + { + if (info->shared) + { + if (elf_sh_pic_plt_entry == NULL) + { + elf_sh_pic_plt_entry = (bfd_big_endian (output_bfd) ? + elf_sh_pic_plt_entry_be : + elf_sh_pic_plt_entry_le); + } + memcpy (splt->contents, elf_sh_pic_plt_entry, + elf_sh_sizeof_plt (info)); + } + else + { + if (elf_sh_plt0_entry == NULL) + { + elf_sh_plt0_entry = (bfd_big_endian (output_bfd) ? + elf_sh_plt0_entry_be : + elf_sh_plt0_entry_le); + } + memcpy (splt->contents, elf_sh_plt0_entry, PLT_ENTRY_SIZE); +#ifdef INCLUDE_SHMEDIA + movi_shori_putval (output_bfd, + sgot->output_section->vma + + sgot->output_offset, + splt->contents + + elf_sh_plt0_gotplt_offset (info)); +#else + bfd_put_32 (output_bfd, + sgot->output_section->vma + sgot->output_offset + 4, + splt->contents + elf_sh_plt0_gotid_offset (info)); + bfd_put_32 (output_bfd, + sgot->output_section->vma + sgot->output_offset + 8, + splt->contents + elf_sh_plt0_linker_offset (info)); +#endif + } + + /* UnixWare sets the entsize of .plt to 4, although that doesn't + really seem like the right value. */ + elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4; + } + } + + /* Fill in the first three entries in the global offset table. */ + if (sgot && sgot->_raw_size > 0) + { + if (sdyn == NULL) + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + else + bfd_put_32 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + sgot->contents); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + + elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; + } + + return TRUE; +} + +static enum elf_reloc_type_class +sh_elf_reloc_type_class (const Elf_Internal_Rela *rela) +{ + switch ((int) ELF32_R_TYPE (rela->r_info)) + { + case R_SH_RELATIVE: + return reloc_class_relative; + case R_SH_JMP_SLOT: + return reloc_class_plt; + case R_SH_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} + +/* Support for Linux core dump NOTE sections. */ +static bfd_boolean +elf32_shlin_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) +{ + int offset; + unsigned int raw_size; + + switch (note->descsz) + { + default: + return FALSE; + + case 168: /* Linux/SH */ + /* pr_cursig */ + elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); + + /* pr_pid */ + elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + + /* pr_reg */ + offset = 72; + raw_size = 92; + + break; + } + + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", + raw_size, note->descpos + offset); +} + +static bfd_boolean +elf32_shlin_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) +{ + switch (note->descsz) + { + default: + return FALSE; + + case 124: /* Linux/SH elf_prpsinfo */ + elf_tdata (abfd)->core_program + = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); + elf_tdata (abfd)->core_command + = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); + } + + /* Note that for some reason, a spurious space is tacked + onto the end of the args in some (at least one anyway) + implementations, so strip it off if it exists. */ + + { + char *command = elf_tdata (abfd)->core_command; + int n = strlen (command); + + if (0 < n && command[n - 1] == ' ') + command[n - 1] = '\0'; + } + + return TRUE; +} + +#define TARGET_BIG_SYM bfd_elf32_sh_vec +#define TARGET_BIG_NAME "elf32-sh" +#define TARGET_LITTLE_SYM bfd_elf32_shl_vec +#define TARGET_LITTLE_NAME "elf32-shl" +#define ELF_ARCH bfd_arch_sh +#define ELF_MACHINE_CODE EM_SH +#ifdef __QNXTARGET__ +#define ELF_MAXPAGESIZE 0x1000 +#else +#define ELF_MAXPAGESIZE 0x80 +#endif + +#define elf_symbol_leading_char '_' + +#define bfd_elf32_bfd_reloc_type_lookup sh_elf_reloc_type_lookup +#define elf_info_to_howto sh_elf_info_to_howto +#define bfd_elf32_bfd_relax_section sh_elf_relax_section +#define elf_backend_relocate_section sh_elf_relocate_section +#define bfd_elf32_bfd_get_relocated_section_contents \ + sh_elf_get_relocated_section_contents +#define bfd_elf32_mkobject sh_elf_mkobject +#define elf_backend_object_p sh_elf_object_p +#define bfd_elf32_bfd_set_private_bfd_flags \ + sh_elf_set_private_flags +#define bfd_elf32_bfd_copy_private_bfd_data \ + sh_elf_copy_private_data +#define bfd_elf32_bfd_merge_private_bfd_data \ + sh_elf_merge_private_data + +#define elf_backend_gc_mark_hook sh_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook sh_elf_gc_sweep_hook +#define elf_backend_check_relocs sh_elf_check_relocs +#define elf_backend_copy_indirect_symbol \ + sh_elf_copy_indirect_symbol +#define elf_backend_create_dynamic_sections \ + sh_elf_create_dynamic_sections +#define bfd_elf32_bfd_link_hash_table_create \ + sh_elf_link_hash_table_create +#define elf_backend_adjust_dynamic_symbol \ + sh_elf_adjust_dynamic_symbol +#define elf_backend_size_dynamic_sections \ + sh_elf_size_dynamic_sections +#define elf_backend_finish_dynamic_symbol \ + sh_elf_finish_dynamic_symbol +#define elf_backend_finish_dynamic_sections \ + sh_elf_finish_dynamic_sections +#define elf_backend_reloc_type_class sh_elf_reloc_type_class + +#define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 +#define elf_backend_want_got_plt 1 +#define elf_backend_plt_readonly 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_got_header_size 12 + +#ifndef INCLUDE_SHMEDIA + +#include "elf32-target.h" + +/* NetBSD support. */ +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_shnbsd_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-sh-nbsd" +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf32_shlnbsd_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-shl-nbsd" +#undef ELF_MAXPAGESIZE +#define ELF_MAXPAGESIZE 0x10000 +#undef elf_symbol_leading_char +#define elf_symbol_leading_char 0 +#undef elf32_bed +#define elf32_bed elf32_sh_nbsd_bed + +#include "elf32-target.h" + + +/* Linux support. */ +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_shblin_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-shbig-linux" +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf32_shlin_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-sh-linux" + +#undef elf_backend_grok_prstatus +#define elf_backend_grok_prstatus elf32_shlin_grok_prstatus +#undef elf_backend_grok_psinfo +#define elf_backend_grok_psinfo elf32_shlin_grok_psinfo +#undef elf32_bed +#define elf32_bed elf32_sh_lin_bed + +#include "elf32-target.h" + +#endif /* INCLUDE_SHMEDIA */ diff --git a/bfd/elf32-sh64-com.c b/bfd/elf32-sh64-com.c new file mode 100644 index 0000000000000..4c219e8a8d465 --- /dev/null +++ b/bfd/elf32-sh64-com.c @@ -0,0 +1,250 @@ +/* SuperH SH64-specific support for 32-bit ELF + Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#define SH64_ELF + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/sh.h" +#include "elf32-sh64.h" +#include "../opcodes/sh64-opc.h" + +static bfd_boolean sh64_address_in_cranges + (asection *cranges, bfd_vma, sh64_elf_crange *); + +/* Ordering functions of a crange, for the qsort and bsearch calls and for + different endianness. */ + +int +_bfd_sh64_crange_qsort_cmpb (const void *p1, const void *p2) +{ + bfd_vma a1 = bfd_getb32 (p1); + bfd_vma a2 = bfd_getb32 (p2); + + /* Preserve order if there's ambiguous contents. */ + if (a1 == a2) + return (char *) p1 - (char *) p2; + + return a1 - a2; +} + +int +_bfd_sh64_crange_qsort_cmpl (const void *p1, const void *p2) +{ + bfd_vma a1 = (bfd_vma) bfd_getl32 (p1); + bfd_vma a2 = (bfd_vma) bfd_getl32 (p2); + + /* Preserve order if there's ambiguous contents. */ + if (a1 == a2) + return (char *) p1 - (char *) p2; + + return a1 - a2; +} + +int +_bfd_sh64_crange_bsearch_cmpb (const void *p1, const void *p2) +{ + bfd_vma a1 = *(bfd_vma *) p1; + bfd_vma a2 = (bfd_vma) bfd_getb32 (p2); + bfd_size_type size + = (bfd_size_type) bfd_getb32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2); + + if (a1 >= a2 + size) + return 1; + if (a1 < a2) + return -1; + return 0; +} + +int +_bfd_sh64_crange_bsearch_cmpl (const void *p1, const void *p2) +{ + bfd_vma a1 = *(bfd_vma *) p1; + bfd_vma a2 = (bfd_vma) bfd_getl32 (p2); + bfd_size_type size + = (bfd_size_type) bfd_getl32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2); + + if (a1 >= a2 + size) + return 1; + if (a1 < a2) + return -1; + return 0; +} + +/* Check whether a specific address is specified within a .cranges + section. Return FALSE if not found, and TRUE if found, and the region + filled into RANGEP if non-NULL. */ + +static bfd_boolean +sh64_address_in_cranges (asection *cranges, bfd_vma addr, + sh64_elf_crange *rangep) +{ + bfd_byte *cranges_contents; + bfd_byte *found_rangep; + bfd_size_type cranges_size = bfd_section_size (cranges->owner, cranges); + + /* If the size is not a multiple of the cranges entry size, then + something is badly wrong. */ + if ((cranges_size % SH64_CRANGE_SIZE) != 0) + return FALSE; + + /* If this section has relocations, then we can't do anything sane. */ + if (bfd_get_section_flags (cranges->owner, cranges) & SEC_RELOC) + return FALSE; + + /* Has some kind soul (or previous call) left processed, sorted contents + for us? */ + if ((bfd_get_section_flags (cranges->owner, cranges) & SEC_IN_MEMORY) + && elf_section_data (cranges)->this_hdr.sh_type == SHT_SH5_CR_SORTED) + cranges_contents = cranges->contents; + else + { + cranges_contents + = bfd_malloc (cranges->_cooked_size != 0 + ? cranges->_cooked_size : cranges->_raw_size); + if (cranges_contents == NULL) + return FALSE; + + if (! bfd_get_section_contents (cranges->owner, cranges, + cranges_contents, (file_ptr) 0, + cranges_size)) + goto error_return; + + /* Is it sorted? */ + if (elf_section_data (cranges)->this_hdr.sh_type + != SHT_SH5_CR_SORTED) + /* Nope. Lets sort it. */ + qsort (cranges_contents, cranges_size / SH64_CRANGE_SIZE, + SH64_CRANGE_SIZE, + bfd_big_endian (cranges->owner) + ? _bfd_sh64_crange_qsort_cmpb : _bfd_sh64_crange_qsort_cmpl); + + /* Let's keep it around. */ + cranges->contents = cranges_contents; + bfd_set_section_flags (cranges->owner, cranges, + bfd_get_section_flags (cranges->owner, cranges) + | SEC_IN_MEMORY); + + /* It's sorted now. */ + elf_section_data (cranges)->this_hdr.sh_type = SHT_SH5_CR_SORTED; + } + + /* Try and find a matching range. */ + found_rangep + = bsearch (&addr, cranges_contents, cranges_size / SH64_CRANGE_SIZE, + SH64_CRANGE_SIZE, + bfd_big_endian (cranges->owner) + ? _bfd_sh64_crange_bsearch_cmpb + : _bfd_sh64_crange_bsearch_cmpl); + + /* Fill in a few return values if we found a matching range. */ + if (found_rangep) + { + enum sh64_elf_cr_type cr_type + = bfd_get_16 (cranges->owner, + SH64_CRANGE_CR_TYPE_OFFSET + found_rangep); + bfd_vma cr_addr + = bfd_get_32 (cranges->owner, + SH64_CRANGE_CR_ADDR_OFFSET + + (char *) found_rangep); + bfd_size_type cr_size + = bfd_get_32 (cranges->owner, + SH64_CRANGE_CR_SIZE_OFFSET + + (char *) found_rangep); + + rangep->cr_addr = cr_addr; + rangep->cr_size = cr_size; + rangep->cr_type = cr_type; + + return TRUE; + } + + /* There is a .cranges section, but it does not have a descriptor + matching this address. */ + return FALSE; + +error_return: + free (cranges_contents); + return FALSE; +} + +/* Determine what ADDR points to in SEC, and fill in a range descriptor in + *RANGEP if it's non-NULL. */ + +enum sh64_elf_cr_type +sh64_get_contents_type (asection *sec, bfd_vma addr, sh64_elf_crange *rangep) +{ + asection *cranges; + + /* Fill in the range with the boundaries of the section as a default. */ + if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour + && elf_elfheader (sec->owner)->e_type == ET_EXEC) + { + rangep->cr_addr = bfd_get_section_vma (sec->owner, sec); + rangep->cr_size = bfd_section_size (sec->owner, sec); + rangep->cr_type = CRT_NONE; + } + else + return FALSE; + + /* If none of the pertinent bits are set, then it's a SHcompact (or at + least not SHmedia). */ + if ((elf_section_data (sec)->this_hdr.sh_flags + & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == 0) + { + enum sh64_elf_cr_type cr_type + = ((bfd_get_section_flags (sec->owner, sec) & SEC_CODE) != 0 + ? CRT_SH5_ISA16 : CRT_DATA); + rangep->cr_type = cr_type; + return cr_type; + } + + /* If only the SHF_SH5_ISA32 bit is set, then we have SHmedia. */ + if ((elf_section_data (sec)->this_hdr.sh_flags + & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == SHF_SH5_ISA32) + { + rangep->cr_type = CRT_SH5_ISA32; + return CRT_SH5_ISA32; + } + + /* Otherwise, we have to look up the .cranges section. */ + cranges = bfd_get_section_by_name (sec->owner, SH64_CRANGES_SECTION_NAME); + + if (cranges == NULL) + /* A mixed section but there's no .cranges section. This is probably + bad input; it does not comply to specs. */ + return CRT_NONE; + + /* If this call fails, we will still have CRT_NONE in rangep->cr_type + and that will be suitable to return. */ + sh64_address_in_cranges (cranges, addr, rangep); + + return rangep->cr_type; +} + +/* This is a simpler exported interface for the benefit of gdb et al. */ + +bfd_boolean +sh64_address_is_shmedia (asection *sec, bfd_vma addr) +{ + sh64_elf_crange dummy; + return sh64_get_contents_type (sec, addr, &dummy) == CRT_SH5_ISA32; +} diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c new file mode 100644 index 0000000000000..f013e6fea8f16 --- /dev/null +++ b/bfd/elf32-sh64.c @@ -0,0 +1,808 @@ +/* SuperH SH64-specific support for 32-bit ELF + Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#define SH64_ELF + +#include "bfd.h" +#include "sysdep.h" +#include "elf-bfd.h" +#include "../opcodes/sh64-opc.h" +#include "elf32-sh64.h" + +/* Add a suffix for datalabel indirection symbols. It must not match any + other symbols; user symbols with or without version or other + decoration. It must only be used internally and not emitted by any + means. */ +#define DATALABEL_SUFFIX " DL" + +/* Used to hold data for function called through bfd_map_over_sections. */ +struct sh64_find_section_vma_data + { + asection *section; + bfd_vma addr; + }; + +static bfd_boolean sh64_elf_new_section_hook + (bfd *, asection *); +static bfd_boolean sh64_elf_copy_private_data + (bfd *, bfd *); +static bfd_boolean sh64_elf_merge_private_data + (bfd *, bfd *); +static bfd_boolean sh64_elf_fake_sections + (bfd *, Elf_Internal_Shdr *, asection *); +static bfd_boolean sh64_elf_set_private_flags + (bfd *, flagword); +static bfd_boolean sh64_elf_set_mach_from_flags + (bfd *); +static bfd_boolean shmedia_prepare_reloc + (struct bfd_link_info *, bfd *, asection *, bfd_byte *, + const Elf_Internal_Rela *, bfd_vma *); +static int sh64_elf_get_symbol_type + (Elf_Internal_Sym *, int); +static bfd_boolean sh64_elf_add_symbol_hook + (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, + flagword *, asection **, bfd_vma *); +static bfd_boolean sh64_elf_link_output_symbol_hook + (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *); +static bfd_boolean sh64_backend_section_from_shdr + (bfd *, Elf_Internal_Shdr *, const char *); +static void sh64_elf_final_write_processing + (bfd *, bfd_boolean); +static bfd_boolean sh64_bfd_elf_copy_private_section_data + (bfd *, asection *, bfd *, asection *); +static void sh64_find_section_for_address + (bfd *, asection *, void *); + +/* Let elf32-sh.c handle the "bfd_" definitions, so we only have to + intrude with an #ifndef around the function definition. */ +#define sh_elf_copy_private_data sh64_elf_copy_private_data +#define sh_elf_merge_private_data sh64_elf_merge_private_data +#define sh_elf_set_private_flags sh64_elf_set_private_flags +/* Typo in elf32-sh.c (and unlinear name). */ +#define bfd_elf32_bfd_set_private_flags sh64_elf_set_private_flags +#define sh_elf_set_mach_from_flags sh64_elf_set_mach_from_flags + +#define elf_backend_sign_extend_vma 1 +#define elf_backend_fake_sections sh64_elf_fake_sections +#define elf_backend_get_symbol_type sh64_elf_get_symbol_type +#define elf_backend_add_symbol_hook sh64_elf_add_symbol_hook +#define elf_backend_link_output_symbol_hook \ + sh64_elf_link_output_symbol_hook +#define elf_backend_merge_symbol_attribute sh64_elf_merge_symbol_attribute +#define elf_backend_final_write_processing sh64_elf_final_write_processing +#define elf_backend_section_from_shdr sh64_backend_section_from_shdr +#define elf_backend_special_sections sh64_elf_special_sections + +#define bfd_elf32_new_section_hook sh64_elf_new_section_hook + +/* For objcopy, we need to set up sh64_elf_section_data (asection *) from + incoming section flags. This is otherwise done in sh64elf.em when + linking or tc-sh64.c when assembling. */ +#define bfd_elf32_bfd_copy_private_section_data \ + sh64_bfd_elf_copy_private_section_data + +/* This COFF-only function (only compiled with COFF support, making + ELF-only chains problematic) returns TRUE early for SH4, so let's just + define it TRUE here. */ +#define _bfd_sh_align_load_span(a,b,c,d,e,f,g,h,i,j) TRUE + +#define GOT_BIAS (-((long)-32768)) +#define INCLUDE_SHMEDIA +#include "elf32-sh.c" + +/* Tack some extra info on struct bfd_elf_section_data. */ + +static bfd_boolean +sh64_elf_new_section_hook (bfd *abfd, asection *sec) +{ + struct _sh64_elf_section_data *sdata; + bfd_size_type amt = sizeof (*sdata); + + sdata = (struct _sh64_elf_section_data *) bfd_zalloc (abfd, amt); + if (sdata == NULL) + return FALSE; + sec->used_by_bfd = sdata; + + return _bfd_elf_new_section_hook (abfd, sec); +} + +/* Set the SHF_SH5_ISA32 flag for ISA SHmedia code sections, and pass + through SHT_SH5_CR_SORTED on a sorted .cranges section. */ + +bfd_boolean +sh64_elf_fake_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + Elf_Internal_Shdr *elf_section_hdr, + asection *asect) +{ + if (sh64_elf_section_data (asect)->sh64_info != NULL) + elf_section_hdr->sh_flags + |= sh64_elf_section_data (asect)->sh64_info->contents_flags; + + /* If this section has the SEC_SORT_ENTRIES flag set, it is a sorted + .cranges section passing through objcopy. */ + if ((bfd_get_section_flags (output_bfd, asect) & SEC_SORT_ENTRIES) != 0 + && strcmp (bfd_get_section_name (output_bfd, asect), + SH64_CRANGES_SECTION_NAME) == 0) + elf_section_hdr->sh_type = SHT_SH5_CR_SORTED; + + return TRUE; +} + +static bfd_boolean +sh64_elf_set_mach_from_flags (bfd *abfd) +{ + flagword flags = elf_elfheader (abfd)->e_flags; + asection *cranges; + + switch (flags & EF_SH_MACH_MASK) + { + case EF_SH5: + /* These are fit to execute on SH5. Just one but keep the switch + construct to make additions easy. */ + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh5); + break; + + default: + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } + + /* We also need to set SEC_DEBUGGING on an incoming .cranges section. + We could have used elf_backend_section_flags if it had given us the + section name; the bfd_section member in the header argument is not + set at the point of the call. FIXME: Find out whether that is by + undocumented design or a bug. */ + cranges = bfd_get_section_by_name (abfd, SH64_CRANGES_SECTION_NAME); + if (cranges != NULL + && ! bfd_set_section_flags (abfd, cranges, + bfd_get_section_flags (abfd, cranges) + | SEC_DEBUGGING)) + return FALSE; + + return TRUE; +} + +static bfd_boolean +sh64_elf_copy_private_data (bfd * ibfd, bfd * obfd) +{ + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + BFD_ASSERT (!elf_flags_init (obfd) + || (elf_elfheader (obfd)->e_flags + == elf_elfheader (ibfd)->e_flags)); + + elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; + return TRUE; +} + +static bfd_boolean +sh64_elf_merge_private_data (bfd *ibfd, bfd *obfd) +{ + flagword old_flags, new_flags; + + if (! _bfd_generic_verify_endian_match (ibfd, obfd)) + return FALSE; + + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + if (bfd_get_arch_size (ibfd) != bfd_get_arch_size (obfd)) + { + const char *msg; + + if (bfd_get_arch_size (ibfd) == 32 + && bfd_get_arch_size (obfd) == 64) + msg = _("%s: compiled as 32-bit object and %s is 64-bit"); + else if (bfd_get_arch_size (ibfd) == 64 + && bfd_get_arch_size (obfd) == 32) + msg = _("%s: compiled as 64-bit object and %s is 32-bit"); + else + msg = _("%s: object size does not match that of target %s"); + + (*_bfd_error_handler) (msg, bfd_get_filename (ibfd), + bfd_get_filename (obfd)); + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } + + old_flags = elf_elfheader (obfd)->e_flags; + new_flags = elf_elfheader (ibfd)->e_flags; + if (! elf_flags_init (obfd)) + { + /* This happens when ld starts out with a 'blank' output file. */ + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = old_flags = new_flags; + } + /* We don't allow linking in non-SH64 code. */ + else if ((new_flags & EF_SH_MACH_MASK) != EF_SH5) + { + (*_bfd_error_handler) + ("%s: uses non-SH64 instructions while previous modules use SH64 instructions", + bfd_get_filename (ibfd)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* I can't think of anything sane other than old_flags being EF_SH5 and + that we need to preserve that. */ + elf_elfheader (obfd)->e_flags = old_flags; + return sh64_elf_set_mach_from_flags (obfd); +} + +/* Handle a SH64-specific section when reading an object file. This + is called when elfcode.h finds a section with an unknown type. + + We only recognize SHT_SH5_CR_SORTED, on the .cranges section. */ + +bfd_boolean +sh64_backend_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, + const char *name) +{ + flagword flags = 0; + + /* We do like MIPS with a bit switch for recognized types, and returning + FALSE for a recognized section type with an unexpected name. Right + now we only have one recognized type, but that might change. */ + switch (hdr->sh_type) + { + case SHT_SH5_CR_SORTED: + if (strcmp (name, SH64_CRANGES_SECTION_NAME) != 0) + return FALSE; + + /* We set the SEC_SORT_ENTRIES flag so it can be passed on to + sh64_elf_fake_sections, keeping SHT_SH5_CR_SORTED if this object + passes through objcopy. Perhaps it is brittle; the flag can + suddenly be used by other BFD parts, but it seems not really used + anywhere at the moment. */ + flags = SEC_DEBUGGING | SEC_SORT_ENTRIES; + break; + + default: + return FALSE; + } + + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) + return FALSE; + + if (flags + && ! bfd_set_section_flags (abfd, hdr->bfd_section, + bfd_get_section_flags (abfd, + hdr->bfd_section) + | flags)) + return FALSE; + + return TRUE; +} + +/* In contrast to sh64_backend_section_from_shdr, this is called for all + sections, but only when copying sections, not when linking or + assembling. We need to set up the sh64_elf_section_data (asection *) + structure for the SH64 ELF section flags to be copied correctly. */ + +bfd_boolean +sh64_bfd_elf_copy_private_section_data (bfd *ibfd, asection *isec, + bfd *obfd, asection *osec) +{ + struct sh64_section_data *sh64_sec_data; + + if (ibfd->xvec->flavour != bfd_target_elf_flavour + || obfd->xvec->flavour != bfd_target_elf_flavour) + return TRUE; + + if (! _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)) + return FALSE; + + sh64_sec_data = sh64_elf_section_data (isec)->sh64_info; + if (sh64_sec_data == NULL) + { + sh64_sec_data = bfd_zmalloc (sizeof (struct sh64_section_data)); + + if (sh64_sec_data == NULL) + return FALSE; + + sh64_sec_data->contents_flags + = (elf_section_data (isec)->this_hdr.sh_flags + & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)); + + sh64_elf_section_data (osec)->sh64_info = sh64_sec_data; + } + + return TRUE; +} + +/* Function to keep SH64 specific file flags. */ + +static bfd_boolean +sh64_elf_set_private_flags (bfd *abfd, flagword flags) +{ + BFD_ASSERT (! elf_flags_init (abfd) + || elf_elfheader (abfd)->e_flags == flags); + + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + return sh64_elf_set_mach_from_flags (abfd); +} + +/* Called when writing out an object file to decide the type of a symbol. */ + +static int +sh64_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type) +{ + if (ELF_ST_TYPE (elf_sym->st_info) == STT_DATALABEL) + return STT_DATALABEL; + + return type; +} + +/* Hook called by the linker routine which adds symbols from an object + file. We must make indirect symbols for undefined symbols marked with + STT_DATALABEL, so relocations passing them will pick up that attribute + and neutralize STO_SH5_ISA32 found on the symbol definition. + + There is a problem, though: We want to fill in the hash-table entry for + this symbol and signal to the caller that no further processing is + needed. But we don't have the index for this hash-table entry. We + rely here on that the current entry is the first hash-entry with NULL, + which seems brittle. Also, iterating over the hash-table to find that + entry is a linear operation on the number of symbols in this input + file, and this function should take constant time, so that's not good + too. Only comfort is that DataLabel references should only be found in + hand-written assembly code and thus be rare. FIXME: Talk maintainers + into adding an option to elf_add_symbol_hook (preferably) for the index + or the hash entry, alternatively adding the index to Elf_Internal_Sym + (not so good). */ + +static bfd_boolean +sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, + Elf_Internal_Sym *sym, const char **namep, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp, bfd_vma *valp) +{ + /* We want to do this for relocatable as well as final linking. */ + if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL + && is_elf_hash_table (info->hash)) + { + struct elf_link_hash_entry *h; + + /* For relocatable links, we register the DataLabel sym in its own + right, and tweak the name when it's output. Otherwise, we make + an indirect symbol of it. */ + flagword flags + = info->relocatable || info->emitrelocations + ? BSF_GLOBAL : BSF_GLOBAL | BSF_INDIRECT; + + char *dl_name + = bfd_malloc (strlen (*namep) + sizeof (DATALABEL_SUFFIX)); + struct elf_link_hash_entry ** sym_hash = elf_sym_hashes (abfd); + + BFD_ASSERT (sym_hash != NULL); + + /* Allocation may fail. */ + if (dl_name == NULL) + return FALSE; + + strcpy (dl_name, *namep); + strcat (dl_name, DATALABEL_SUFFIX); + + h = (struct elf_link_hash_entry *) + bfd_link_hash_lookup (info->hash, dl_name, FALSE, FALSE, FALSE); + + if (h == NULL) + { + /* No previous datalabel symbol. Make one. */ + struct bfd_link_hash_entry *bh = NULL; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + + if (! _bfd_generic_link_add_one_symbol (info, abfd, dl_name, + flags, *secp, *valp, + *namep, FALSE, + bed->collect, &bh)) + { + free (dl_name); + return FALSE; + } + + h = (struct elf_link_hash_entry *) bh; + h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; + h->type = STT_DATALABEL; + } + else + /* If a new symbol was created, it holds the allocated name. + Otherwise, we don't need it anymore and should deallocate it. */ + free (dl_name); + + if (h->type != STT_DATALABEL + || ((info->relocatable || info->emitrelocations) + && h->root.type != bfd_link_hash_undefined) + || (! info->relocatable && !info->emitrelocations + && h->root.type != bfd_link_hash_indirect)) + { + /* Make sure we don't get confused on invalid input. */ + (*_bfd_error_handler) + (_("%s: encountered datalabel symbol in input"), + bfd_get_filename (abfd)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* Now find the hash-table slot for this entry and fill it in. */ + while (*sym_hash != NULL) + sym_hash++; + *sym_hash = h; + + /* Signal to caller to skip this symbol - we've handled it. */ + *namep = NULL; + } + + return TRUE; +} + +/* This hook function is called before the linker writes out a global + symbol. For relocatable links, DataLabel symbols will be present in + linker output. We cut off the special suffix on those symbols, so the + right name appears in the output. + + When linking and emitting relocations, there can appear global symbols + that are not referenced by relocs, but rather only implicitly through + DataLabel references, a relation that is not visible to the linker. + Since no stripping of global symbols in done when doing such linking, + we don't need to look up and make sure to emit the main symbol for each + DataLabel symbol. */ + +bfd_boolean +sh64_elf_link_output_symbol_hook (struct bfd_link_info *info, + const char *cname, + Elf_Internal_Sym *sym, + asection *input_sec ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED) +{ + char *name = (char *) cname; + + if (info->relocatable || info->emitrelocations) + { + if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL) + name[strlen (name) - strlen (DATALABEL_SUFFIX)] = 0; + } + + return TRUE; +} + +/* Check a SH64-specific reloc and put the value to relocate to into + RELOCATION, ready to pass to _bfd_final_link_relocate. Return FALSE if + bad value, TRUE if ok. */ + +static bfd_boolean +shmedia_prepare_reloc (struct bfd_link_info *info, bfd *abfd, + asection *input_section, bfd_byte *contents, + const Elf_Internal_Rela *rel, bfd_vma *relocation) +{ + bfd_vma disp, dropped; + + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_SH_PT_16: + /* Check the lowest bit of the destination field. If it is 1, we + check the ISA type of the destination (i.e. the low bit of the + "relocation" value, and emit an error if the instruction does not + match). If it is 0, we change a PTA to PTB. There should never + be a PTB that should change to a PTA; that indicates a toolchain + error; a mismatch with GAS. */ + { + char *msg = NULL; + bfd_vma insn = bfd_get_32 (abfd, contents + rel->r_offset); + + if (insn & (1 << 10)) + { + /* Check matching insn and ISA (address of target). */ + if ((insn & SHMEDIA_PTB_BIT) != 0 + && ((*relocation + rel->r_addend) & 1) != 0) + msg = _("PTB mismatch: a SHmedia address (bit 0 == 1)"); + else if ((insn & SHMEDIA_PTB_BIT) == 0 + && ((*relocation + rel->r_addend) & 1) == 0) + msg = _("PTA mismatch: a SHcompact address (bit 0 == 0)"); + + if (msg != NULL + && ! ((*info->callbacks->reloc_dangerous) + (info, msg, abfd, input_section, + rel->r_offset))) + return FALSE; + } + else + { + /* We shouldn't get here with a PTB insn and a R_SH_PT_16. It + means GAS output does not match expectations; a PTA or PTB + expressed as such (or a PT found at assembly to be PTB) + would match the test above, and PT expansion with an + unknown destination (or when relaxing) will get us here. */ + if ((insn & SHMEDIA_PTB_BIT) != 0) + { + (*_bfd_error_handler) + (_("%s: GAS error: unexpected PTB insn with R_SH_PT_16"), + bfd_get_filename (input_section->owner)); + return FALSE; + } + + /* Change the PTA to a PTB, if destination indicates so. */ + if (((*relocation + rel->r_addend) & 1) == 0) + bfd_put_32 (abfd, insn | SHMEDIA_PTB_BIT, + contents + rel->r_offset); + } + } + + case R_SH_SHMEDIA_CODE: + case R_SH_DIR5U: + case R_SH_DIR6S: + case R_SH_DIR6U: + case R_SH_DIR10S: + case R_SH_DIR10SW: + case R_SH_DIR10SL: + case R_SH_DIR10SQ: + case R_SH_IMMS16: + case R_SH_IMMU16: + case R_SH_IMM_LOW16: + case R_SH_IMM_LOW16_PCREL: + case R_SH_IMM_MEDLOW16: + case R_SH_IMM_MEDLOW16_PCREL: + case R_SH_IMM_MEDHI16: + case R_SH_IMM_MEDHI16_PCREL: + case R_SH_IMM_HI16: + case R_SH_IMM_HI16_PCREL: + case R_SH_64: + case R_SH_64_PCREL: + break; + + default: + return FALSE; + } + + disp = (*relocation & 0xf); + dropped = 0; + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_SH_DIR10SW: dropped = disp & 1; break; + case R_SH_DIR10SL: dropped = disp & 3; break; + case R_SH_DIR10SQ: dropped = disp & 7; break; + } + if (dropped != 0) + { + (*_bfd_error_handler) + (_("%s: error: unaligned relocation type %d at %08x reloc %08x\n"), + bfd_get_filename (input_section->owner), ELF32_R_TYPE (rel->r_info), + (unsigned)rel->r_offset, (unsigned)relocation); + return FALSE; + } + + return TRUE; +} + +/* Helper function to locate the section holding a certain address. This + is called via bfd_map_over_sections. */ + +static void +sh64_find_section_for_address (bfd *abfd ATTRIBUTE_UNUSED, + asection *section, void *data) +{ + bfd_vma vma; + bfd_size_type size; + struct sh64_find_section_vma_data *fsec_datap + = (struct sh64_find_section_vma_data *) data; + + /* Return if already found. */ + if (fsec_datap->section) + return; + + /* If this section isn't part of the addressable contents, skip it. */ + if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0) + return; + + vma = bfd_get_section_vma (abfd, section); + if (fsec_datap->addr < vma) + return; + + /* FIXME: section->reloc_done isn't set properly; a generic buglet + preventing us from using bfd_get_section_size_after_reloc. */ + size + = section->_cooked_size ? section->_cooked_size : section->_raw_size; + + if (fsec_datap->addr >= vma + size) + return; + + fsec_datap->section = section; +} + +/* Make sure to write out the generated entries in the .cranges section + when doing partial linking, and set bit 0 on the entry address if it + points to SHmedia code and write sorted .cranges entries when writing + executables (final linking and objcopy). */ + +static void +sh64_elf_final_write_processing (bfd *abfd, + bfd_boolean linker ATTRIBUTE_UNUSED) +{ + bfd_vma ld_generated_cranges_size; + asection *cranges + = bfd_get_section_by_name (abfd, SH64_CRANGES_SECTION_NAME); + + /* If no new .cranges were added, the generic ELF linker parts will + write it all out. If not, we need to write them out when doing + partial linking. For a final link, we will sort them and write them + all out further below. */ + if (linker + && cranges != NULL + && elf_elfheader (abfd)->e_type != ET_EXEC + && (ld_generated_cranges_size + = sh64_elf_section_data (cranges)->sh64_info->cranges_growth) != 0) + { + bfd_vma incoming_cranges_size + = ((cranges->_cooked_size != 0 + ? cranges->_cooked_size : cranges->_raw_size) + - ld_generated_cranges_size); + + if (! bfd_set_section_contents (abfd, cranges, + cranges->contents + + incoming_cranges_size, + cranges->output_offset + + incoming_cranges_size, + ld_generated_cranges_size)) + { + bfd_set_error (bfd_error_file_truncated); + (*_bfd_error_handler) + (_("%s: could not write out added .cranges entries"), + bfd_get_filename (abfd)); + } + } + + /* Only set entry address bit 0 and sort .cranges when linking to an + executable; never with objcopy or strip. */ + if (linker && elf_elfheader (abfd)->e_type == ET_EXEC) + { + struct sh64_find_section_vma_data fsec_data; + sh64_elf_crange dummy; + + /* For a final link, set the low bit of the entry address to + reflect whether or not it is a SHmedia address. + FIXME: Perhaps we shouldn't do this if the entry address was + supplied numerically, but we currently lack the infrastructure to + recognize that: The entry symbol, and info whether it is numeric + or a symbol name is kept private in the linker. */ + fsec_data.addr = elf_elfheader (abfd)->e_entry; + fsec_data.section = NULL; + + bfd_map_over_sections (abfd, sh64_find_section_for_address, + &fsec_data); + if (fsec_data.section + && (sh64_get_contents_type (fsec_data.section, + elf_elfheader (abfd)->e_entry, + &dummy) == CRT_SH5_ISA32)) + elf_elfheader (abfd)->e_entry |= 1; + + /* If we have a .cranges section, sort the entries. */ + if (cranges != NULL) + { + bfd_size_type cranges_size + = (cranges->_cooked_size != 0 + ? cranges->_cooked_size : cranges->_raw_size); + + /* We know we always have these in memory at this time. */ + BFD_ASSERT (cranges->contents != NULL); + + /* The .cranges may already have been sorted in the process of + finding out the ISA-type of the entry address. If not, we do + it here. */ + if (elf_section_data (cranges)->this_hdr.sh_type + != SHT_SH5_CR_SORTED) + { + qsort (cranges->contents, cranges_size / SH64_CRANGE_SIZE, + SH64_CRANGE_SIZE, + bfd_big_endian (cranges->owner) + ? _bfd_sh64_crange_qsort_cmpb + : _bfd_sh64_crange_qsort_cmpl); + elf_section_data (cranges)->this_hdr.sh_type + = SHT_SH5_CR_SORTED; + } + + /* We need to write it out in whole as sorted. */ + if (! bfd_set_section_contents (abfd, cranges, + cranges->contents, + cranges->output_offset, + cranges_size)) + { + bfd_set_error (bfd_error_file_truncated); + (*_bfd_error_handler) + (_("%s: could not write out sorted .cranges entries"), + bfd_get_filename (abfd)); + } + } + } +} + +/* Merge non visibility st_other attribute when the symbol comes from + a dynamic object. */ +static void +sh64_elf_merge_symbol_attribute (struct elf_link_hash_entry *h, + const Elf_Internal_Sym *isym, + bfd_boolean definition, + bfd_boolean dynamic) +{ + if (isym->st_other != 0 && dynamic) + { + unsigned char other; + + /* Take the balance of OTHER from the definition. */ + other = (definition ? isym->st_other : h->other); + other &= ~ ELF_ST_VISIBILITY (-1); + h->other = other | ELF_ST_VISIBILITY (h->other); + } + + return; +} + +static struct bfd_elf_special_section const sh64_elf_special_sections[]= +{ + { ".cranges", 8, 0, SHT_PROGBITS, 0 }, + { NULL, 0, 0, 0, 0 } +}; + +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_sh64_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-sh64" +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf32_sh64l_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-sh64l" + +#include "elf32-target.h" + +/* NetBSD support. */ +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_sh64nbsd_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-sh64-nbsd" +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf32_sh64lnbsd_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-sh64l-nbsd" +#undef ELF_MAXPAGESIZE +#define ELF_MAXPAGESIZE 0x10000 +#undef elf_symbol_leading_char +#define elf_symbol_leading_char 0 +#undef elf32_bed +#define elf32_bed elf32_sh64_nbsd_bed + +#include "elf32-target.h" + +/* Linux support. */ +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_sh64blin_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-sh64big-linux" +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf32_sh64lin_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-sh64-linux" +#undef elf32_bed +#define elf32_bed elf32_sh64_lin_bed + +#include "elf32-target.h" + diff --git a/bfd/elf32-sh64.h b/bfd/elf32-sh64.h new file mode 100644 index 0000000000000..5916aecfb7d39 --- /dev/null +++ b/bfd/elf32-sh64.h @@ -0,0 +1,88 @@ +/* SH ELF support for BFD. + Copyright 2003 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#ifndef ELF32_SH64_H +#define ELF32_SH64_H + +#define SH64_CRANGES_SECTION_NAME ".cranges" +enum sh64_elf_cr_type { + CRT_NONE = 0, + CRT_DATA = 1, + CRT_SH5_ISA16 = 2, + CRT_SH5_ISA32 = 3 +}; + +/* The official definition is this: + + typedef struct { + Elf32_Addr cr_addr; + Elf32_Word cr_size; + Elf32_Half cr_type; + } Elf32_CRange; + + but we have no use for that exact type. Instead we use this struct for + the internal representation. */ +typedef struct { + bfd_vma cr_addr; + bfd_size_type cr_size; + enum sh64_elf_cr_type cr_type; +} sh64_elf_crange; + +#define SH64_CRANGE_SIZE (4 + 4 + 2) +#define SH64_CRANGE_CR_ADDR_OFFSET 0 +#define SH64_CRANGE_CR_SIZE_OFFSET 4 +#define SH64_CRANGE_CR_TYPE_OFFSET (4 + 4) + +/* Get the contents type of an arbitrary address, or return CRT_NONE. */ +extern enum sh64_elf_cr_type sh64_get_contents_type + (asection *, bfd_vma, sh64_elf_crange *); + +/* Simpler interface. + FIXME: This seems redundant now that we export the interface above. */ +extern bfd_boolean sh64_address_is_shmedia + (asection *, bfd_vma); + +extern int _bfd_sh64_crange_qsort_cmpb + (const void *, const void *); +extern int _bfd_sh64_crange_qsort_cmpl + (const void *, const void *); +extern int _bfd_sh64_crange_bsearch_cmpb + (const void *, const void *); +extern int _bfd_sh64_crange_bsearch_cmpl + (const void *, const void *); + +struct sh64_section_data +{ + flagword contents_flags; + + /* Only used in the cranges section, but we don't have an official + backend-specific bfd field. */ + bfd_size_type cranges_growth; +}; + +struct _sh64_elf_section_data +{ + struct bfd_elf_section_data elf; + struct sh64_section_data *sh64_info; +}; + +#define sh64_elf_section_data(sec) \ + ((struct _sh64_elf_section_data *) elf_section_data (sec)) + +#endif /* ELF32_SH64_H */ diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c new file mode 100644 index 0000000000000..b9dcf3c5ae72a --- /dev/null +++ b/bfd/elf32-v850.c @@ -0,0 +1,3200 @@ +/* V850-specific support for 32-bit ELF + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +/* XXX FIXME: This code is littered with 32bit int, 16bit short, 8bit char + dependencies. As is the gas & simulator code for the v850. */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/v850.h" +#include "libiberty.h" + +/* Sign-extend a 24-bit number. */ +#define SEXT24(x) ((((x) & 0xffffff) ^ 0x800000) - 0x800000) + +static reloc_howto_type *v850_elf_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void v850_elf_info_to_howto_rel + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static void v850_elf_info_to_howto_rela + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static bfd_reloc_status_type v850_elf_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_boolean v850_elf_is_local_label_name + PARAMS ((bfd *, const char *)); +static bfd_boolean v850_elf_relocate_section + PARAMS((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static bfd_reloc_status_type v850_elf_perform_relocation + PARAMS ((bfd *, unsigned int, bfd_vma, bfd_byte *)); +static bfd_boolean v850_elf_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); +static void remember_hi16s_reloc + PARAMS ((bfd *, bfd_vma, bfd_byte *)); +static bfd_byte * find_remembered_hi16s_reloc + PARAMS ((bfd_vma, bfd_boolean *)); +static bfd_reloc_status_type v850_elf_final_link_relocate + PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *, bfd_vma, + bfd_vma, bfd_vma, struct bfd_link_info *, asection *, int)); +static bfd_boolean v850_elf_object_p + PARAMS ((bfd *)); +static bfd_boolean v850_elf_fake_sections + PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); +static void v850_elf_final_write_processing + PARAMS ((bfd *, bfd_boolean)); +static bfd_boolean v850_elf_set_private_flags + PARAMS ((bfd *, flagword)); +static bfd_boolean v850_elf_merge_private_bfd_data + PARAMS ((bfd *, bfd *)); +static bfd_boolean v850_elf_print_private_bfd_data + PARAMS ((bfd *, PTR)); +static bfd_boolean v850_elf_section_from_bfd_section + PARAMS ((bfd *, asection *, int *)); +static void v850_elf_symbol_processing + PARAMS ((bfd *, asymbol *)); +static bfd_boolean v850_elf_add_symbol_hook + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *, + const char **, flagword *, asection **, bfd_vma *)); +static bfd_boolean v850_elf_link_output_symbol_hook + PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *)); +static bfd_boolean v850_elf_section_from_shdr + PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); +static bfd_boolean v850_elf_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static asection * v850_elf_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, + Elf_Internal_Rela *, struct elf_link_hash_entry *, + Elf_Internal_Sym *)); +static bfd_reloc_status_type v850_elf_ignore_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static bfd_boolean v850_elf_relax_delete_bytes + PARAMS ((bfd *, asection *, bfd_vma, bfd_vma, int)); +static bfd_boolean v850_elf_relax_section + PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); + +/* Note: It is REQUIRED that the 'type' value of each entry + in this array match the index of the entry in the array. */ +static reloc_howto_type v850_elf_howto_table[] = +{ + /* This reloc does nothing. */ + HOWTO (R_V850_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_V850_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A PC relative 9 bit branch. */ + HOWTO (R_V850_9_PCREL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_9_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0x00ffffff, /* src_mask */ + 0x00ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A PC relative 22 bit branch. */ + HOWTO (R_V850_22_PCREL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 22, /* bitsize */ + TRUE, /* pc_relative */ + 7, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_22_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0x07ffff80, /* src_mask */ + 0x07ffff80, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* High 16 bits of symbol value. */ + HOWTO (R_V850_HI16_S, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_HI16_S", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* High 16 bits of symbol value. */ + HOWTO (R_V850_HI16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_HI16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Low 16 bits of symbol value. */ + HOWTO (R_V850_LO16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_LO16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Simple 32bit reloc. */ + HOWTO (R_V850_ABS32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_ABS32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Simple 16bit reloc. */ + HOWTO (R_V850_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_V850_16", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Simple 8bit reloc. */ + HOWTO (R_V850_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_V850_8", /* name */ + FALSE, /* partial_inplace */ + 0xff, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16 bit offset from the short data area pointer. */ + HOWTO (R_V850_SDA_16_16_OFFSET, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_SDA_16_16_OFFSET", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 15 bit offset from the short data area pointer. */ + HOWTO (R_V850_SDA_15_16_OFFSET, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 1, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_SDA_15_16_OFFSET", /* name */ + FALSE, /* partial_inplace */ + 0xfffe, /* src_mask */ + 0xfffe, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16 bit offset from the zero data area pointer. */ + HOWTO (R_V850_ZDA_16_16_OFFSET, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_ZDA_16_16_OFFSET", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 15 bit offset from the zero data area pointer. */ + HOWTO (R_V850_ZDA_15_16_OFFSET, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 1, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_ZDA_15_16_OFFSET", /* name */ + FALSE, /* partial_inplace */ + 0xfffe, /* src_mask */ + 0xfffe, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 6 bit offset from the tiny data area pointer. */ + HOWTO (R_V850_TDA_6_8_OFFSET, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 1, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_TDA_6_8_OFFSET", /* name */ + FALSE, /* partial_inplace */ + 0x7e, /* src_mask */ + 0x7e, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 8 bit offset from the tiny data area pointer. */ + HOWTO (R_V850_TDA_7_8_OFFSET, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_TDA_7_8_OFFSET", /* name */ + FALSE, /* partial_inplace */ + 0x7f, /* src_mask */ + 0x7f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 7 bit offset from the tiny data area pointer. */ + HOWTO (R_V850_TDA_7_7_OFFSET, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 7, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_TDA_7_7_OFFSET", /* name */ + FALSE, /* partial_inplace */ + 0x7f, /* src_mask */ + 0x7f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16 bit offset from the tiny data area pointer! */ + HOWTO (R_V850_TDA_16_16_OFFSET, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_TDA_16_16_OFFSET", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xfff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 5 bit offset from the tiny data area pointer. */ + HOWTO (R_V850_TDA_4_5_OFFSET, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 5, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_TDA_4_5_OFFSET", /* name */ + FALSE, /* partial_inplace */ + 0x0f, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 4 bit offset from the tiny data area pointer. */ + HOWTO (R_V850_TDA_4_4_OFFSET, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 4, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_TDA_4_4_OFFSET", /* name */ + FALSE, /* partial_inplace */ + 0x0f, /* src_mask */ + 0x0f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16 bit offset from the short data area pointer. */ + HOWTO (R_V850_SDA_16_16_SPLIT_OFFSET, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_SDA_16_16_SPLIT_OFFSET",/* name */ + FALSE, /* partial_inplace */ + 0xfffe0020, /* src_mask */ + 0xfffe0020, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16 bit offset from the zero data area pointer. */ + HOWTO (R_V850_ZDA_16_16_SPLIT_OFFSET, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_ZDA_16_16_SPLIT_OFFSET",/* name */ + FALSE, /* partial_inplace */ + 0xfffe0020, /* src_mask */ + 0xfffe0020, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 6 bit offset from the call table base pointer. */ + HOWTO (R_V850_CALLT_6_7_OFFSET, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 7, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_CALLT_6_7_OFFSET", /* name */ + FALSE, /* partial_inplace */ + 0x3f, /* src_mask */ + 0x3f, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16 bit offset from the call table base pointer. */ + HOWTO (R_V850_CALLT_16_16_OFFSET, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_CALLT_16_16_OFFSET", /* name */ + FALSE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_V850_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_V850_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_V850_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_V850_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Indicates a .longcall pseudo-op. The compiler will generate a .longcall + pseudo-op when it finds a function call which can be relaxed. */ + HOWTO (R_V850_LONGCALL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + v850_elf_ignore_reloc, /* special_function */ + "R_V850_LONGCALL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Indicates a .longjump pseudo-op. The compiler will generate a + .longjump pseudo-op when it finds a branch which can be relaxed. */ + HOWTO (R_V850_LONGJUMP, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + v850_elf_ignore_reloc, /* special_function */ + "R_V850_LONGJUMP", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_V850_ALIGN, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + v850_elf_ignore_reloc, /* special_function */ + "R_V850_ALIGN", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Simple pc-relative 32bit reloc. */ + HOWTO (R_V850_REL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + v850_elf_reloc, /* special_function */ + "R_V850_REL32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; + +/* Map BFD reloc types to V850 ELF reloc types. */ + +struct v850_elf_reloc_map +{ + /* BFD_RELOC_V850_CALLT_16_16_OFFSET is 258, which will not fix in an + unsigned char. */ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned int elf_reloc_val; +}; + +static const struct v850_elf_reloc_map v850_elf_reloc_map[] = +{ + { BFD_RELOC_NONE, R_V850_NONE }, + { BFD_RELOC_V850_9_PCREL, R_V850_9_PCREL }, + { BFD_RELOC_V850_22_PCREL, R_V850_22_PCREL }, + { BFD_RELOC_HI16_S, R_V850_HI16_S }, + { BFD_RELOC_HI16, R_V850_HI16 }, + { BFD_RELOC_LO16, R_V850_LO16 }, + { BFD_RELOC_32, R_V850_ABS32 }, + { BFD_RELOC_32_PCREL, R_V850_REL32 }, + { BFD_RELOC_16, R_V850_16 }, + { BFD_RELOC_8, R_V850_8 }, + { BFD_RELOC_V850_SDA_16_16_OFFSET, R_V850_SDA_16_16_OFFSET }, + { BFD_RELOC_V850_SDA_15_16_OFFSET, R_V850_SDA_15_16_OFFSET }, + { BFD_RELOC_V850_ZDA_16_16_OFFSET, R_V850_ZDA_16_16_OFFSET }, + { BFD_RELOC_V850_ZDA_15_16_OFFSET, R_V850_ZDA_15_16_OFFSET }, + { BFD_RELOC_V850_TDA_6_8_OFFSET, R_V850_TDA_6_8_OFFSET }, + { BFD_RELOC_V850_TDA_7_8_OFFSET, R_V850_TDA_7_8_OFFSET }, + { BFD_RELOC_V850_TDA_7_7_OFFSET, R_V850_TDA_7_7_OFFSET }, + { BFD_RELOC_V850_TDA_16_16_OFFSET, R_V850_TDA_16_16_OFFSET }, + { BFD_RELOC_V850_TDA_4_5_OFFSET, R_V850_TDA_4_5_OFFSET }, + { BFD_RELOC_V850_TDA_4_4_OFFSET, R_V850_TDA_4_4_OFFSET }, + { BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET, R_V850_SDA_16_16_SPLIT_OFFSET }, + { BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET, R_V850_ZDA_16_16_SPLIT_OFFSET }, + { BFD_RELOC_V850_CALLT_6_7_OFFSET, R_V850_CALLT_6_7_OFFSET }, + { BFD_RELOC_V850_CALLT_16_16_OFFSET, R_V850_CALLT_16_16_OFFSET }, + { BFD_RELOC_VTABLE_INHERIT, R_V850_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_V850_GNU_VTENTRY }, + { BFD_RELOC_V850_LONGCALL, R_V850_LONGCALL }, + { BFD_RELOC_V850_LONGJUMP, R_V850_LONGJUMP }, + { BFD_RELOC_V850_ALIGN, R_V850_ALIGN }, + +}; + +/* Map a bfd relocation into the appropriate howto structure. */ + +static reloc_howto_type * +v850_elf_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = ARRAY_SIZE (v850_elf_reloc_map); i --;) + if (v850_elf_reloc_map[i].bfd_reloc_val == code) + { + unsigned int elf_reloc_val = v850_elf_reloc_map[i].elf_reloc_val; + + BFD_ASSERT (v850_elf_howto_table[elf_reloc_val].type == elf_reloc_val); + + return v850_elf_howto_table + elf_reloc_val; + } + + return NULL; +} + +/* Set the howto pointer for an V850 ELF reloc. */ + +static void +v850_elf_info_to_howto_rel (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_V850_max); + cache_ptr->howto = &v850_elf_howto_table[r_type]; +} + +/* Set the howto pointer for a V850 ELF reloc (type RELA). */ +static void +v850_elf_info_to_howto_rela (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent * cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_V850_max); + cache_ptr->howto = &v850_elf_howto_table[r_type]; +} + +/* Look through the relocs for a section during the first phase, and + allocate space in the global offset table or procedure linkage + table. */ + +static bfd_boolean +v850_elf_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + bfd_boolean ret = TRUE; + bfd *dynobj; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + asection *sreloc; + enum v850_reloc_type r_type; + int other = 0; + const char *common = (const char *)0; + + if (info->relocatable) + return TRUE; + +#ifdef DEBUG + fprintf (stderr, "v850_elf_check_relocs called for section %s in %s\n", + bfd_get_section_name (abfd, sec), + bfd_archive_filename (abfd)); +#endif + + dynobj = elf_hash_table (info)->dynobj; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sreloc = NULL; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + unsigned long r_symndx; + struct elf_link_hash_entry *h; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + r_type = (enum v850_reloc_type) ELF32_R_TYPE (rel->r_info); + switch (r_type) + { + default: + case R_V850_NONE: + case R_V850_9_PCREL: + case R_V850_22_PCREL: + case R_V850_HI16_S: + case R_V850_HI16: + case R_V850_LO16: + case R_V850_ABS32: + case R_V850_REL32: + case R_V850_16: + case R_V850_8: + case R_V850_CALLT_6_7_OFFSET: + case R_V850_CALLT_16_16_OFFSET: + break; + + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_V850_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries + are actually used. Record for later use during GC. */ + case R_V850_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + + case R_V850_SDA_16_16_SPLIT_OFFSET: + case R_V850_SDA_16_16_OFFSET: + case R_V850_SDA_15_16_OFFSET: + other = V850_OTHER_SDA; + common = ".scommon"; + goto small_data_common; + + case R_V850_ZDA_16_16_SPLIT_OFFSET: + case R_V850_ZDA_16_16_OFFSET: + case R_V850_ZDA_15_16_OFFSET: + other = V850_OTHER_ZDA; + common = ".zcommon"; + goto small_data_common; + + case R_V850_TDA_4_5_OFFSET: + case R_V850_TDA_4_4_OFFSET: + case R_V850_TDA_6_8_OFFSET: + case R_V850_TDA_7_8_OFFSET: + case R_V850_TDA_7_7_OFFSET: + case R_V850_TDA_16_16_OFFSET: + other = V850_OTHER_TDA; + common = ".tcommon"; + /* fall through */ + +#define V850_OTHER_MASK (V850_OTHER_TDA | V850_OTHER_SDA | V850_OTHER_ZDA) + + small_data_common: + if (h) + { + /* Flag which type of relocation was used. */ + h->other |= other; + if ((h->other & V850_OTHER_MASK) != (other & V850_OTHER_MASK) + && (h->other & V850_OTHER_ERROR) == 0) + { + const char * msg; + static char buff[200]; /* XXX */ + + switch (h->other & V850_OTHER_MASK) + { + default: + msg = _("Variable `%s' cannot occupy in multiple small data regions"); + break; + case V850_OTHER_SDA | V850_OTHER_ZDA | V850_OTHER_TDA: + msg = _("Variable `%s' can only be in one of the small, zero, and tiny data regions"); + break; + case V850_OTHER_SDA | V850_OTHER_ZDA: + msg = _("Variable `%s' cannot be in both small and zero data regions simultaneously"); + break; + case V850_OTHER_SDA | V850_OTHER_TDA: + msg = _("Variable `%s' cannot be in both small and tiny data regions simultaneously"); + break; + case V850_OTHER_ZDA | V850_OTHER_TDA: + msg = _("Variable `%s' cannot be in both zero and tiny data regions simultaneously"); + break; + } + + sprintf (buff, msg, h->root.root.string); + info->callbacks->warning (info, buff, h->root.root.string, + abfd, h->root.u.def.section, + (bfd_vma) 0); + + bfd_set_error (bfd_error_bad_value); + h->other |= V850_OTHER_ERROR; + ret = FALSE; + } + } + + if (h && h->root.type == bfd_link_hash_common + && h->root.u.c.p + && !strcmp (bfd_get_section_name (abfd, h->root.u.c.p->section), "COMMON")) + { + asection * section; + + section = h->root.u.c.p->section = bfd_make_section_old_way (abfd, common); + section->flags |= SEC_IS_COMMON; + } + +#ifdef DEBUG + fprintf (stderr, "v850_elf_check_relocs, found %s relocation for %s%s\n", + v850_elf_howto_table[ (int)r_type ].name, + (h && h->root.root.string) ? h->root.root.string : "", + (h->root.type == bfd_link_hash_common) ? ", symbol is common" : ""); +#endif + break; + } + } + + return ret; +} + +/* In the old version, when an entry was checked out from the table, + it was deleted. This produced an error if the entry was needed + more than once, as the second attempted retry failed. + + In the current version, the entry is not deleted, instead we set + the field 'found' to TRUE. If a second lookup matches the same + entry, then we know that the hi16s reloc has already been updated + and does not need to be updated a second time. + + TODO - TOFIX: If it is possible that we need to restore 2 different + addresses from the same table entry, where the first generates an + overflow, whilst the second do not, then this code will fail. */ + +typedef struct hi16s_location +{ + bfd_vma addend; + bfd_byte *address; + unsigned long counter; + bfd_boolean found; + struct hi16s_location *next; +} +hi16s_location; + +static hi16s_location *previous_hi16s; +static hi16s_location *free_hi16s; +static unsigned long hi16s_counter; + +static void +remember_hi16s_reloc (abfd, addend, address) + bfd *abfd; + bfd_vma addend; + bfd_byte *address; +{ + hi16s_location * entry = NULL; + bfd_size_type amt = sizeof (* free_hi16s); + + /* Find a free structure. */ + if (free_hi16s == NULL) + free_hi16s = (hi16s_location *) bfd_zalloc (abfd, amt); + + entry = free_hi16s; + free_hi16s = free_hi16s->next; + + entry->addend = addend; + entry->address = address; + entry->counter = hi16s_counter ++; + entry->found = FALSE; + entry->next = previous_hi16s; + previous_hi16s = entry; + + /* Cope with wrap around of our counter. */ + if (hi16s_counter == 0) + { + /* XXX - Assume that all counter entries differ only in their low 16 bits. */ + for (entry = previous_hi16s; entry != NULL; entry = entry->next) + entry->counter &= 0xffff; + + hi16s_counter = 0x10000; + } + + return; +} + +static bfd_byte * +find_remembered_hi16s_reloc (addend, already_found) + bfd_vma addend; + bfd_boolean *already_found; +{ + hi16s_location *match = NULL; + hi16s_location *entry; + hi16s_location *previous = NULL; + hi16s_location *prev; + bfd_byte *addr; + + /* Search the table. Record the most recent entry that matches. */ + for (entry = previous_hi16s; entry; entry = entry->next) + { + if (entry->addend == addend + && (match == NULL || match->counter < entry->counter)) + { + previous = prev; + match = entry; + } + + prev = entry; + } + + if (match == NULL) + return NULL; + + /* Extract the address. */ + addr = match->address; + + /* Remember if this entry has already been used before. */ + if (already_found) + * already_found = match->found; + + /* Note that this entry has now been used. */ + match->found = TRUE; + + return addr; +} + +/* FIXME: The code here probably ought to be removed and the code in reloc.c + allowed to do its stuff instead. At least for most of the relocs, anyway. */ + +static bfd_reloc_status_type +v850_elf_perform_relocation (abfd, r_type, addend, address) + bfd *abfd; + unsigned int r_type; + bfd_vma addend; + bfd_byte *address; +{ + unsigned long insn; + bfd_signed_vma saddend = (bfd_signed_vma) addend; + + switch (r_type) + { + default: + /* fprintf (stderr, "reloc type %d not SUPPORTED\n", r_type ); */ + return bfd_reloc_notsupported; + + case R_V850_REL32: + case R_V850_ABS32: + bfd_put_32 (abfd, addend, address); + return bfd_reloc_ok; + + case R_V850_22_PCREL: + if (saddend > 0x1fffff || saddend < -0x200000) + return bfd_reloc_overflow; + + if ((addend % 2) != 0) + return bfd_reloc_dangerous; + + insn = bfd_get_32 (abfd, address); + insn &= ~0xfffe003f; + insn |= (((addend & 0xfffe) << 16) | ((addend & 0x3f0000) >> 16)); + bfd_put_32 (abfd, (bfd_vma) insn, address); + return bfd_reloc_ok; + + case R_V850_9_PCREL: + if (saddend > 0xff || saddend < -0x100) + return bfd_reloc_overflow; + + if ((addend % 2) != 0) + return bfd_reloc_dangerous; + + insn = bfd_get_16 (abfd, address); + insn &= ~ 0xf870; + insn |= ((addend & 0x1f0) << 7) | ((addend & 0x0e) << 3); + break; + + case R_V850_HI16: + addend += (bfd_get_16 (abfd, address) << 16); + addend = (addend >> 16); + insn = addend; + break; + + case R_V850_HI16_S: + /* Remember where this relocation took place. */ + remember_hi16s_reloc (abfd, addend, address); + + addend += (bfd_get_16 (abfd, address) << 16); + addend = (addend >> 16) + ((addend & 0x8000) != 0); + + /* This relocation cannot overflow. */ + if (addend > 0x7fff) + addend = 0; + + insn = addend; + break; + + case R_V850_LO16: + /* Calculate the sum of the value stored in the instruction and the + addend and check for overflow from the low 16 bits into the high + 16 bits. The assembler has already done some of this: If the + value stored in the instruction has its 15th bit set, (counting + from zero) then the assembler will have added 1 to the value + stored in the associated HI16S reloc. So for example, these + relocations: + + movhi hi( fred ), r0, r1 + movea lo( fred ), r1, r1 + + will store 0 in the value fields for the MOVHI and MOVEA instructions + and addend will be the address of fred, but for these instructions: + + movhi hi( fred + 0x123456), r0, r1 + movea lo( fred + 0x123456), r1, r1 + + the value stored in the MOVHI instruction will be 0x12 and the value + stored in the MOVEA instruction will be 0x3456. If however the + instructions were: + + movhi hi( fred + 0x10ffff), r0, r1 + movea lo( fred + 0x10ffff), r1, r1 + + then the value stored in the MOVHI instruction would be 0x11 (not + 0x10) and the value stored in the MOVEA instruction would be 0xffff. + Thus (assuming for the moment that the addend is 0), at run time the + MOVHI instruction loads 0x110000 into r1, then the MOVEA instruction + adds 0xffffffff (sign extension!) producing 0x10ffff. Similarly if + the instructions were: + + movhi hi( fred - 1), r0, r1 + movea lo( fred - 1), r1, r1 + + then 0 is stored in the MOVHI instruction and -1 is stored in the + MOVEA instruction. + + Overflow can occur if the addition of the value stored in the + instruction plus the addend sets the 15th bit when before it was clear. + This is because the 15th bit will be sign extended into the high part, + thus reducing its value by one, but since the 15th bit was originally + clear, the assembler will not have added 1 to the previous HI16S reloc + to compensate for this effect. For example: + + movhi hi( fred + 0x123456), r0, r1 + movea lo( fred + 0x123456), r1, r1 + + The value stored in HI16S reloc is 0x12, the value stored in the LO16 + reloc is 0x3456. If we assume that the address of fred is 0x00007000 + then the relocations become: + + HI16S: 0x0012 + (0x00007000 >> 16) = 0x12 + LO16: 0x3456 + (0x00007000 & 0xffff) = 0xa456 + + but when the instructions are executed, the MOVEA instruction's value + is signed extended, so the sum becomes: + + 0x00120000 + + 0xffffa456 + ------------ + 0x0011a456 but 'fred + 0x123456' = 0x0012a456 + + Note that if the 15th bit was set in the value stored in the LO16 + reloc, then we do not have to do anything: + + movhi hi( fred + 0x10ffff), r0, r1 + movea lo( fred + 0x10ffff), r1, r1 + + HI16S: 0x0011 + (0x00007000 >> 16) = 0x11 + LO16: 0xffff + (0x00007000 & 0xffff) = 0x6fff + + 0x00110000 + + 0x00006fff + ------------ + 0x00116fff = fred + 0x10ffff = 0x7000 + 0x10ffff + + Overflow can also occur if the computation carries into the 16th bit + and it also results in the 15th bit having the same value as the 15th + bit of the original value. What happens is that the HI16S reloc + will have already examined the 15th bit of the original value and + added 1 to the high part if the bit is set. This compensates for the + sign extension of 15th bit of the result of the computation. But now + there is a carry into the 16th bit, and this has not been allowed for. + + So, for example if fred is at address 0xf000: + + movhi hi( fred + 0xffff), r0, r1 [bit 15 of the offset is set] + movea lo( fred + 0xffff), r1, r1 + + HI16S: 0x0001 + (0x0000f000 >> 16) = 0x0001 + LO16: 0xffff + (0x0000f000 & 0xffff) = 0xefff (carry into bit 16 is lost) + + 0x00010000 + + 0xffffefff + ------------ + 0x0000efff but 'fred + 0xffff' = 0x0001efff + + Similarly, if the 15th bit remains clear, but overflow occurs into + the 16th bit then (assuming the address of fred is 0xf000): + + movhi hi( fred + 0x7000), r0, r1 [bit 15 of the offset is clear] + movea lo( fred + 0x7000), r1, r1 + + HI16S: 0x0000 + (0x0000f000 >> 16) = 0x0000 + LO16: 0x7000 + (0x0000f000 & 0xffff) = 0x6fff (carry into bit 16 is lost) + + 0x00000000 + + 0x00006fff + ------------ + 0x00006fff but 'fred + 0x7000' = 0x00016fff + + Note - there is no need to change anything if a carry occurs, and the + 15th bit changes its value from being set to being clear, as the HI16S + reloc will have already added in 1 to the high part for us: + + movhi hi( fred + 0xffff), r0, r1 [bit 15 of the offset is set] + movea lo( fred + 0xffff), r1, r1 + + HI16S: 0x0001 + (0x00007000 >> 16) + LO16: 0xffff + (0x00007000 & 0xffff) = 0x6fff (carry into bit 16 is lost) + + 0x00010000 + + 0x00006fff (bit 15 not set, so the top half is zero) + ------------ + 0x00016fff which is right (assuming that fred is at 0x7000) + + but if the 15th bit goes from being clear to being set, then we must + once again handle overflow: + + movhi hi( fred + 0x7000), r0, r1 [bit 15 of the offset is clear] + movea lo( fred + 0x7000), r1, r1 + + HI16S: 0x0000 + (0x0000ffff >> 16) + LO16: 0x7000 + (0x0000ffff & 0xffff) = 0x6fff (carry into bit 16) + + 0x00000000 + + 0x00006fff (bit 15 not set, so the top half is zero) + ------------ + 0x00006fff which is wrong (assuming that fred is at 0xffff). */ + { + long result; + + insn = bfd_get_16 (abfd, address); + result = insn + addend; + +#define BIT15_SET(x) ((x) & 0x8000) +#define OVERFLOWS(a,i) ((((a) & 0xffff) + (i)) > 0xffff) + + if ((BIT15_SET (result) && ! BIT15_SET (addend)) + || (OVERFLOWS (addend, insn) + && ((! BIT15_SET (insn)) || (BIT15_SET (addend))))) + { + bfd_boolean already_updated; + bfd_byte *hi16s_address = find_remembered_hi16s_reloc + (addend, & already_updated); + + /* Amend the matching HI16_S relocation. */ + if (hi16s_address != NULL) + { + if (! already_updated) + { + insn = bfd_get_16 (abfd, hi16s_address); + insn += 1; + bfd_put_16 (abfd, (bfd_vma) insn, hi16s_address); + } + } + else + { + fprintf (stderr, _("FAILED to find previous HI16 reloc\n")); + return bfd_reloc_overflow; + } + } + + /* Do not complain if value has top bit set, as this has been anticipated. */ + insn = result & 0xffff; + break; + } + + case R_V850_8: + addend += (char) bfd_get_8 (abfd, address); + + saddend = (bfd_signed_vma) addend; + + if (saddend > 0x7f || saddend < -0x80) + return bfd_reloc_overflow; + + bfd_put_8 (abfd, addend, address); + return bfd_reloc_ok; + + case R_V850_CALLT_16_16_OFFSET: + addend += bfd_get_16 (abfd, address); + + saddend = (bfd_signed_vma) addend; + + if (saddend > 0xffff || saddend < 0) + return bfd_reloc_overflow; + + insn = addend; + break; + + case R_V850_16: + + /* drop through */ + case R_V850_SDA_16_16_OFFSET: + case R_V850_ZDA_16_16_OFFSET: + case R_V850_TDA_16_16_OFFSET: + addend += bfd_get_16 (abfd, address); + + saddend = (bfd_signed_vma) addend; + + if (saddend > 0x7fff || saddend < -0x8000) + return bfd_reloc_overflow; + + insn = addend; + break; + + case R_V850_SDA_15_16_OFFSET: + case R_V850_ZDA_15_16_OFFSET: + insn = bfd_get_16 (abfd, address); + addend += (insn & 0xfffe); + + saddend = (bfd_signed_vma) addend; + + if (saddend > 0x7ffe || saddend < -0x8000) + return bfd_reloc_overflow; + + if (addend & 1) + return bfd_reloc_dangerous; + + insn = (addend &~ (bfd_vma) 1) | (insn & 1); + break; + + case R_V850_TDA_6_8_OFFSET: + insn = bfd_get_16 (abfd, address); + addend += ((insn & 0x7e) << 1); + + saddend = (bfd_signed_vma) addend; + + if (saddend > 0xfc || saddend < 0) + return bfd_reloc_overflow; + + if (addend & 3) + return bfd_reloc_dangerous; + + insn &= 0xff81; + insn |= (addend >> 1); + break; + + case R_V850_TDA_7_8_OFFSET: + insn = bfd_get_16 (abfd, address); + addend += ((insn & 0x7f) << 1); + + saddend = (bfd_signed_vma) addend; + + if (saddend > 0xfe || saddend < 0) + return bfd_reloc_overflow; + + if (addend & 1) + return bfd_reloc_dangerous; + + insn &= 0xff80; + insn |= (addend >> 1); + break; + + case R_V850_TDA_7_7_OFFSET: + insn = bfd_get_16 (abfd, address); + addend += insn & 0x7f; + + saddend = (bfd_signed_vma) addend; + + if (saddend > 0x7f || saddend < 0) + return bfd_reloc_overflow; + + insn &= 0xff80; + insn |= addend; + break; + + case R_V850_TDA_4_5_OFFSET: + insn = bfd_get_16 (abfd, address); + addend += ((insn & 0xf) << 1); + + saddend = (bfd_signed_vma) addend; + + if (saddend > 0x1e || saddend < 0) + return bfd_reloc_overflow; + + if (addend & 1) + return bfd_reloc_dangerous; + + insn &= 0xfff0; + insn |= (addend >> 1); + break; + + case R_V850_TDA_4_4_OFFSET: + insn = bfd_get_16 (abfd, address); + addend += insn & 0xf; + + saddend = (bfd_signed_vma) addend; + + if (saddend > 0xf || saddend < 0) + return bfd_reloc_overflow; + + insn &= 0xfff0; + insn |= addend; + break; + + case R_V850_ZDA_16_16_SPLIT_OFFSET: + case R_V850_SDA_16_16_SPLIT_OFFSET: + insn = bfd_get_32 (abfd, address); + addend += ((insn & 0xfffe0000) >> 16) + ((insn & 0x20) >> 5); + + saddend = (bfd_signed_vma) addend; + + if (saddend > 0x7fff || saddend < -0x8000) + return bfd_reloc_overflow; + + insn &= 0x0001ffdf; + insn |= (addend & 1) << 5; + insn |= (addend &~ (bfd_vma) 1) << 16; + + bfd_put_32 (abfd, (bfd_vma) insn, address); + return bfd_reloc_ok; + + case R_V850_CALLT_6_7_OFFSET: + insn = bfd_get_16 (abfd, address); + addend += ((insn & 0x3f) << 1); + + saddend = (bfd_signed_vma) addend; + + if (saddend > 0x7e || saddend < 0) + return bfd_reloc_overflow; + + if (addend & 1) + return bfd_reloc_dangerous; + + insn &= 0xff80; + insn |= (addend >> 1); + break; + + case R_V850_GNU_VTINHERIT: + case R_V850_GNU_VTENTRY: + return bfd_reloc_ok; + + } + + bfd_put_16 (abfd, (bfd_vma) insn, address); + return bfd_reloc_ok; +} + +/* Insert the addend into the instruction. */ + +static bfd_reloc_status_type +v850_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc; + asymbol *symbol; + PTR data ATTRIBUTE_UNUSED; + asection *isection; + bfd *obfd; + char **err ATTRIBUTE_UNUSED; +{ + long relocation; + + /* If there is an output BFD, + and the symbol is not a section name (which is only defined at final link time), + and either we are not putting the addend into the instruction + or the addend is zero, so there is nothing to add into the instruction + then just fixup the address and return. */ + if (obfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! reloc->howto->partial_inplace + || reloc->addend == 0)) + { + reloc->address += isection->output_offset; + return bfd_reloc_ok; + } + + /* Catch relocs involving undefined symbols. */ + if (bfd_is_und_section (symbol->section) + && (symbol->flags & BSF_WEAK) == 0 + && obfd == NULL) + return bfd_reloc_undefined; + + /* We handle final linking of some relocs ourselves. */ + + /* Is the address of the relocation really within the section? */ + if (reloc->address > isection->_cooked_size) + return bfd_reloc_outofrange; + + /* Work out which section the relocation is targeted at and the + initial relocation command value. */ + + if (reloc->howto->pc_relative) + return bfd_reloc_ok; + + /* Get symbol value. (Common symbols are special.) */ + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + /* Convert input-section-relative symbol value to absolute + addend. */ + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc->addend; + +#if 0 /* Since this reloc is going to be processed later on, we should + not make it pc-relative here. To test this, try assembling and + linking this program: + + .text + .globl _start + nop + _start: + jr foo + + .section ".foo","ax" + nop + foo: + nop */ + if (reloc->howto->pc_relative) + { + /* Here the variable relocation holds the final address of the + symbol we are relocating against, plus any addend. */ + relocation -= isection->output_section->vma + isection->output_offset; + + /* Deal with pcrel_offset. */ + relocation -= reloc->address; + } +#endif + reloc->addend = relocation; + return bfd_reloc_ok; +} + +/* This function is used for relocs which are only used + for relaxing, which the linker should otherwise ignore. */ + +static bfd_reloc_status_type +v850_elf_ignore_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry; + asymbol *symbol ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + if (output_bfd != NULL) + reloc_entry->address += input_section->output_offset; + + return bfd_reloc_ok; +} + +static bfd_boolean +v850_elf_is_local_label_name (abfd, name) + bfd *abfd ATTRIBUTE_UNUSED; + const char *name; +{ + return ( (name[0] == '.' && (name[1] == 'L' || name[1] == '.')) + || (name[0] == '_' && name[1] == '.' && name[2] == 'L' && name[3] == '_')); +} + +/* We overload some of the bfd_reloc error codes for own purposes. */ +#define bfd_reloc_gp_not_found bfd_reloc_other +#define bfd_reloc_ep_not_found bfd_reloc_continue +#define bfd_reloc_ctbp_not_found (bfd_reloc_dangerous + 1) + +/* Perform a relocation as part of a final link. */ + +static bfd_reloc_status_type +v850_elf_final_link_relocate (howto, input_bfd, output_bfd, + input_section, contents, offset, value, + addend, info, sym_sec, is_local) + reloc_howto_type *howto; + bfd *input_bfd; + bfd *output_bfd ATTRIBUTE_UNUSED; + asection *input_section; + bfd_byte *contents; + bfd_vma offset; + bfd_vma value; + bfd_vma addend; + struct bfd_link_info *info; + asection *sym_sec; + int is_local ATTRIBUTE_UNUSED; +{ + unsigned int r_type = howto->type; + bfd_byte *hit_data = contents + offset; + + /* Adjust the value according to the relocation. */ + switch (r_type) + { + case R_V850_9_PCREL: + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= offset; + break; + + case R_V850_22_PCREL: + value -= (input_section->output_section->vma + + input_section->output_offset + + offset); + + /* If the sign extension will corrupt the value then we have overflowed. */ + if (((value & 0xff000000) != 0x0) && ((value & 0xff000000) != 0xff000000)) + return bfd_reloc_overflow; + + /* Only the bottom 24 bits of the PC are valid */ + value = SEXT24 (value); + break; + + case R_V850_REL32: + value -= (input_section->output_section->vma + + input_section->output_offset + + offset); + break; + + case R_V850_HI16_S: + case R_V850_HI16: + case R_V850_LO16: + case R_V850_16: + case R_V850_ABS32: + case R_V850_8: + break; + + case R_V850_ZDA_15_16_OFFSET: + case R_V850_ZDA_16_16_OFFSET: + case R_V850_ZDA_16_16_SPLIT_OFFSET: + if (sym_sec == NULL) + return bfd_reloc_undefined; + + value -= sym_sec->output_section->vma; + break; + + case R_V850_SDA_15_16_OFFSET: + case R_V850_SDA_16_16_OFFSET: + case R_V850_SDA_16_16_SPLIT_OFFSET: + { + unsigned long gp; + struct bfd_link_hash_entry * h; + + if (sym_sec == NULL) + return bfd_reloc_undefined; + + /* Get the value of __gp. */ + h = bfd_link_hash_lookup (info->hash, "__gp", FALSE, FALSE, TRUE); + if (h == (struct bfd_link_hash_entry *) NULL + || h->type != bfd_link_hash_defined) + return bfd_reloc_gp_not_found; + + gp = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + + value -= sym_sec->output_section->vma; + value -= (gp - sym_sec->output_section->vma); + } + break; + + case R_V850_TDA_4_4_OFFSET: + case R_V850_TDA_4_5_OFFSET: + case R_V850_TDA_16_16_OFFSET: + case R_V850_TDA_7_7_OFFSET: + case R_V850_TDA_7_8_OFFSET: + case R_V850_TDA_6_8_OFFSET: + { + unsigned long ep; + struct bfd_link_hash_entry * h; + + /* Get the value of __ep. */ + h = bfd_link_hash_lookup (info->hash, "__ep", FALSE, FALSE, TRUE); + if (h == (struct bfd_link_hash_entry *) NULL + || h->type != bfd_link_hash_defined) + return bfd_reloc_ep_not_found; + + ep = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + + value -= ep; + } + break; + + case R_V850_CALLT_6_7_OFFSET: + { + unsigned long ctbp; + struct bfd_link_hash_entry * h; + + /* Get the value of __ctbp. */ + h = bfd_link_hash_lookup (info->hash, "__ctbp", FALSE, FALSE, TRUE); + if (h == (struct bfd_link_hash_entry *) NULL + || h->type != bfd_link_hash_defined) + return bfd_reloc_ctbp_not_found; + + ctbp = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + value -= ctbp; + } + break; + + case R_V850_CALLT_16_16_OFFSET: + { + unsigned long ctbp; + struct bfd_link_hash_entry * h; + + if (sym_sec == NULL) + return bfd_reloc_undefined; + + /* Get the value of __ctbp. */ + h = bfd_link_hash_lookup (info->hash, "__ctbp", FALSE, FALSE, TRUE); + if (h == (struct bfd_link_hash_entry *) NULL + || h->type != bfd_link_hash_defined) + return bfd_reloc_ctbp_not_found; + + ctbp = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + + value -= sym_sec->output_section->vma; + value -= (ctbp - sym_sec->output_section->vma); + } + break; + + case R_V850_NONE: + case R_V850_GNU_VTINHERIT: + case R_V850_GNU_VTENTRY: + case R_V850_LONGCALL: + case R_V850_LONGJUMP: + case R_V850_ALIGN: + return bfd_reloc_ok; + + default: + return bfd_reloc_notsupported; + } + + /* Perform the relocation. */ + return v850_elf_perform_relocation (input_bfd, r_type, value + addend, hit_data); +} + +/* Relocate an V850 ELF section. */ + +static bfd_boolean +v850_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + + if (info->relocatable) + return TRUE; + + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + + if (sym_hashes == NULL) + { + info->callbacks->warning + (info, "no hash table available", + NULL, input_bfd, input_section, (bfd_vma) 0); + + return FALSE; + } + + /* Reset the list of remembered HI16S relocs to empty. */ + free_hi16s = previous_hi16s; + previous_hi16s = NULL; + hi16s_counter = 0; + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + + if (r_type == R_V850_GNU_VTENTRY + || r_type == R_V850_GNU_VTINHERIT) + continue; + + /* This is a final link. */ + howto = v850_elf_howto_table + r_type; + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); +#if 0 + { + char * name; + + name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); + name = (name == NULL) ? "" : name; + fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n", + sec->name, name, sym->st_name, + sec->output_section->vma, sec->output_offset, sym->st_value, rel->r_addend); + } +#endif + } + else + { + bfd_boolean unresolved_reloc, warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + } + + /* FIXME: We should use the addend, but the COFF relocations don't. */ + r = v850_elf_final_link_relocate (howto, input_bfd, output_bfd, + input_section, + contents, rel->r_offset, + relocation, rel->r_addend, + info, sec, h == NULL); + + if (r != bfd_reloc_ok) + { + const char * name; + const char * msg = (const char *)0; + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL || *name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + switch (r) + { + case bfd_reloc_overflow: + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return FALSE; + break; + + case bfd_reloc_undefined: + if (! ((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, + rel->r_offset, TRUE))) + return FALSE; + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + goto common_error; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + goto common_error; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous relocation"); + goto common_error; + + case bfd_reloc_gp_not_found: + msg = _("could not locate special linker symbol __gp"); + goto common_error; + + case bfd_reloc_ep_not_found: + msg = _("could not locate special linker symbol __ep"); + goto common_error; + + case bfd_reloc_ctbp_not_found: + msg = _("could not locate special linker symbol __ctbp"); + goto common_error; + + default: + msg = _("internal error: unknown error"); + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, msg, name, input_bfd, input_section, + rel->r_offset))) + return FALSE; + break; + } + } + } + + return TRUE; +} + +static bfd_boolean +v850_elf_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +{ + /* No got and plt entries for v850-elf. */ + return TRUE; +} + +static asection * +v850_elf_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_V850_GNU_VTINHERIT: + case R_V850_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Set the right machine number. */ + +static bfd_boolean +v850_elf_object_p (abfd) + bfd *abfd; +{ + switch (elf_elfheader (abfd)->e_flags & EF_V850_ARCH) + { + default: + case E_V850_ARCH: + bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850); + break; + case E_V850E_ARCH: + bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850e); + break; + case E_V850E1_ARCH: + bfd_default_set_arch_mach (abfd, bfd_arch_v850, bfd_mach_v850e1); + break; + } + return TRUE; +} + +/* Store the machine number in the flags field. */ + +static void +v850_elf_final_write_processing (abfd, linker) + bfd *abfd; + bfd_boolean linker ATTRIBUTE_UNUSED; +{ + unsigned long val; + + switch (bfd_get_mach (abfd)) + { + default: + case bfd_mach_v850: val = E_V850_ARCH; break; + case bfd_mach_v850e: val = E_V850E_ARCH; break; + case bfd_mach_v850e1: val = E_V850E1_ARCH; break; + } + + elf_elfheader (abfd)->e_flags &=~ EF_V850_ARCH; + elf_elfheader (abfd)->e_flags |= val; +} + +/* Function to keep V850 specific file flags. */ + +static bfd_boolean +v850_elf_set_private_flags (abfd, flags) + bfd *abfd; + flagword flags; +{ + BFD_ASSERT (!elf_flags_init (abfd) + || elf_elfheader (abfd)->e_flags == flags); + + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + return TRUE; +} + +/* Merge backend specific data from an object file + to the output object file when linking. */ +static bfd_boolean +v850_elf_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + flagword out_flags; + flagword in_flags; + + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + in_flags = elf_elfheader (ibfd)->e_flags; + out_flags = elf_elfheader (obfd)->e_flags; + + if (! elf_flags_init (obfd)) + { + /* If the input is the default architecture then do not + bother setting the flags for the output architecture, + instead allow future merges to do this. If no future + merges ever set these flags then they will retain their + unitialised values, which surprise surprise, correspond + to the default values. */ + if (bfd_get_arch_info (ibfd)->the_default) + return TRUE; + + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = in_flags; + + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) + && bfd_get_arch_info (obfd)->the_default) + return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd)); + + return TRUE; + } + + /* Check flag compatibility. */ + if (in_flags == out_flags) + return TRUE; + + if ((in_flags & EF_V850_ARCH) != (out_flags & EF_V850_ARCH) + && (in_flags & EF_V850_ARCH) != E_V850_ARCH) + { + /* Allow v850e1 binaries to be linked with v850e binaries. + Set the output binary to v850e. */ + if ((in_flags & EF_V850_ARCH) == E_V850E1_ARCH + && (out_flags & EF_V850_ARCH) == E_V850E_ARCH) + return TRUE; + + if ((in_flags & EF_V850_ARCH) == E_V850E_ARCH + && (out_flags & EF_V850_ARCH) == E_V850E1_ARCH) + { + elf_elfheader (obfd)->e_flags = + ((out_flags & ~ EF_V850_ARCH) | E_V850E_ARCH); + return TRUE; + } + + _bfd_error_handler (_("%s: Architecture mismatch with previous modules"), + bfd_archive_filename (ibfd)); + } + + return TRUE; +} + +/* Display the flags field. */ + +static bfd_boolean +v850_elf_print_private_bfd_data (abfd, ptr) + bfd *abfd; + PTR ptr; +{ + FILE * file = (FILE *) ptr; + + BFD_ASSERT (abfd != NULL && ptr != NULL); + + _bfd_elf_print_private_bfd_data (abfd, ptr); + + /* xgettext:c-format */ + fprintf (file, _("private flags = %lx: "), elf_elfheader (abfd)->e_flags); + + switch (elf_elfheader (abfd)->e_flags & EF_V850_ARCH) + { + default: + case E_V850_ARCH: fprintf (file, _("v850 architecture")); break; + case E_V850E_ARCH: fprintf (file, _("v850e architecture")); break; + case E_V850E1_ARCH: fprintf (file, _("v850e1 architecture")); break; + } + + fputc ('\n', file); + + return TRUE; +} + +/* V850 ELF uses four common sections. One is the usual one, and the + others are for (small) objects in one of the special data areas: + small, tiny and zero. All the objects are kept together, and then + referenced via the gp register, the ep register or the r0 register + respectively, which yields smaller, faster assembler code. This + approach is copied from elf32-mips.c. */ + +static asection v850_elf_scom_section; +static asymbol v850_elf_scom_symbol; +static asymbol * v850_elf_scom_symbol_ptr; +static asection v850_elf_tcom_section; +static asymbol v850_elf_tcom_symbol; +static asymbol * v850_elf_tcom_symbol_ptr; +static asection v850_elf_zcom_section; +static asymbol v850_elf_zcom_symbol; +static asymbol * v850_elf_zcom_symbol_ptr; + +/* Given a BFD section, try to locate the + corresponding ELF section index. */ + +static bfd_boolean +v850_elf_section_from_bfd_section (abfd, sec, retval) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + int *retval; +{ + if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) + *retval = SHN_V850_SCOMMON; + else if (strcmp (bfd_get_section_name (abfd, sec), ".tcommon") == 0) + *retval = SHN_V850_TCOMMON; + else if (strcmp (bfd_get_section_name (abfd, sec), ".zcommon") == 0) + *retval = SHN_V850_ZCOMMON; + else + return FALSE; + + return TRUE; +} + +/* Handle the special V850 section numbers that a symbol may use. */ + +static void +v850_elf_symbol_processing (abfd, asym) + bfd *abfd; + asymbol *asym; +{ + elf_symbol_type * elfsym = (elf_symbol_type *) asym; + unsigned int indx; + + indx = elfsym->internal_elf_sym.st_shndx; + + /* If the section index is an "ordinary" index, then it may + refer to a v850 specific section created by the assembler. + Check the section's type and change the index it matches. + + FIXME: Should we alter the st_shndx field as well ? */ + + if (indx < elf_numsections (abfd)) + switch (elf_elfsections(abfd)[indx]->sh_type) + { + case SHT_V850_SCOMMON: + indx = SHN_V850_SCOMMON; + break; + + case SHT_V850_TCOMMON: + indx = SHN_V850_TCOMMON; + break; + + case SHT_V850_ZCOMMON: + indx = SHN_V850_ZCOMMON; + break; + + default: + break; + } + + switch (indx) + { + case SHN_V850_SCOMMON: + if (v850_elf_scom_section.name == NULL) + { + /* Initialize the small common section. */ + v850_elf_scom_section.name = ".scommon"; + v850_elf_scom_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA; + v850_elf_scom_section.output_section = & v850_elf_scom_section; + v850_elf_scom_section.symbol = & v850_elf_scom_symbol; + v850_elf_scom_section.symbol_ptr_ptr = & v850_elf_scom_symbol_ptr; + v850_elf_scom_symbol.name = ".scommon"; + v850_elf_scom_symbol.flags = BSF_SECTION_SYM; + v850_elf_scom_symbol.section = & v850_elf_scom_section; + v850_elf_scom_symbol_ptr = & v850_elf_scom_symbol; + } + asym->section = & v850_elf_scom_section; + asym->value = elfsym->internal_elf_sym.st_size; + break; + + case SHN_V850_TCOMMON: + if (v850_elf_tcom_section.name == NULL) + { + /* Initialize the tcommon section. */ + v850_elf_tcom_section.name = ".tcommon"; + v850_elf_tcom_section.flags = SEC_IS_COMMON; + v850_elf_tcom_section.output_section = & v850_elf_tcom_section; + v850_elf_tcom_section.symbol = & v850_elf_tcom_symbol; + v850_elf_tcom_section.symbol_ptr_ptr = & v850_elf_tcom_symbol_ptr; + v850_elf_tcom_symbol.name = ".tcommon"; + v850_elf_tcom_symbol.flags = BSF_SECTION_SYM; + v850_elf_tcom_symbol.section = & v850_elf_tcom_section; + v850_elf_tcom_symbol_ptr = & v850_elf_tcom_symbol; + } + asym->section = & v850_elf_tcom_section; + asym->value = elfsym->internal_elf_sym.st_size; + break; + + case SHN_V850_ZCOMMON: + if (v850_elf_zcom_section.name == NULL) + { + /* Initialize the zcommon section. */ + v850_elf_zcom_section.name = ".zcommon"; + v850_elf_zcom_section.flags = SEC_IS_COMMON; + v850_elf_zcom_section.output_section = & v850_elf_zcom_section; + v850_elf_zcom_section.symbol = & v850_elf_zcom_symbol; + v850_elf_zcom_section.symbol_ptr_ptr = & v850_elf_zcom_symbol_ptr; + v850_elf_zcom_symbol.name = ".zcommon"; + v850_elf_zcom_symbol.flags = BSF_SECTION_SYM; + v850_elf_zcom_symbol.section = & v850_elf_zcom_section; + v850_elf_zcom_symbol_ptr = & v850_elf_zcom_symbol; + } + asym->section = & v850_elf_zcom_section; + asym->value = elfsym->internal_elf_sym.st_size; + break; + } +} + +/* Hook called by the linker routine which adds symbols from an object + file. We must handle the special v850 section numbers here. */ + +static bfd_boolean +v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) + bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Sym *sym; + const char **namep ATTRIBUTE_UNUSED; + flagword *flagsp ATTRIBUTE_UNUSED; + asection **secp; + bfd_vma *valp; +{ + unsigned int indx = sym->st_shndx; + + /* If the section index is an "ordinary" index, then it may + refer to a v850 specific section created by the assembler. + Check the section's type and change the index it matches. + + FIXME: Should we alter the st_shndx field as well ? */ + + if (indx < elf_numsections (abfd)) + switch (elf_elfsections(abfd)[indx]->sh_type) + { + case SHT_V850_SCOMMON: + indx = SHN_V850_SCOMMON; + break; + + case SHT_V850_TCOMMON: + indx = SHN_V850_TCOMMON; + break; + + case SHT_V850_ZCOMMON: + indx = SHN_V850_ZCOMMON; + break; + + default: + break; + } + + switch (indx) + { + case SHN_V850_SCOMMON: + *secp = bfd_make_section_old_way (abfd, ".scommon"); + (*secp)->flags |= SEC_IS_COMMON; + *valp = sym->st_size; + break; + + case SHN_V850_TCOMMON: + *secp = bfd_make_section_old_way (abfd, ".tcommon"); + (*secp)->flags |= SEC_IS_COMMON; + *valp = sym->st_size; + break; + + case SHN_V850_ZCOMMON: + *secp = bfd_make_section_old_way (abfd, ".zcommon"); + (*secp)->flags |= SEC_IS_COMMON; + *valp = sym->st_size; + break; + } + + return TRUE; +} + +static bfd_boolean +v850_elf_link_output_symbol_hook (info, name, sym, input_sec, h) + struct bfd_link_info *info ATTRIBUTE_UNUSED; + const char *name ATTRIBUTE_UNUSED; + Elf_Internal_Sym *sym; + asection *input_sec; + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED; +{ + /* If we see a common symbol, which implies a relocatable link, then + if a symbol was in a special common section in an input file, mark + it as a special common in the output file. */ + + if (sym->st_shndx == SHN_COMMON) + { + if (strcmp (input_sec->name, ".scommon") == 0) + sym->st_shndx = SHN_V850_SCOMMON; + else if (strcmp (input_sec->name, ".tcommon") == 0) + sym->st_shndx = SHN_V850_TCOMMON; + else if (strcmp (input_sec->name, ".zcommon") == 0) + sym->st_shndx = SHN_V850_ZCOMMON; + } + + return TRUE; +} + +static bfd_boolean +v850_elf_section_from_shdr (abfd, hdr, name) + bfd *abfd; + Elf_Internal_Shdr *hdr; + const char *name; +{ + /* There ought to be a place to keep ELF backend specific flags, but + at the moment there isn't one. We just keep track of the + sections by their name, instead. */ + + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) + return FALSE; + + switch (hdr->sh_type) + { + case SHT_V850_SCOMMON: + case SHT_V850_TCOMMON: + case SHT_V850_ZCOMMON: + if (! bfd_set_section_flags (abfd, hdr->bfd_section, + (bfd_get_section_flags (abfd, + hdr->bfd_section) + | SEC_IS_COMMON))) + return FALSE; + } + + return TRUE; +} + +/* Set the correct type for a V850 ELF section. We do this + by the section name, which is a hack, but ought to work. */ + +static bfd_boolean +v850_elf_fake_sections (abfd, hdr, sec) + bfd *abfd ATTRIBUTE_UNUSED; + Elf_Internal_Shdr *hdr; + asection *sec; +{ + register const char * name; + + name = bfd_get_section_name (abfd, sec); + + if (strcmp (name, ".scommon") == 0) + { + hdr->sh_type = SHT_V850_SCOMMON; + } + else if (strcmp (name, ".tcommon") == 0) + { + hdr->sh_type = SHT_V850_TCOMMON; + } + else if (strcmp (name, ".zcommon") == 0) + hdr->sh_type = SHT_V850_ZCOMMON; + + return TRUE; +} + +/* Delete some bytes from a section while relaxing. */ + +static bfd_boolean +v850_elf_relax_delete_bytes (abfd, sec, addr, toaddr, count) + bfd *abfd; + asection *sec; + bfd_vma addr; + bfd_vma toaddr; + int count; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf32_External_Sym *extsyms; + Elf32_External_Sym *esym; + Elf32_External_Sym *esymend; + int index; + unsigned int sec_shndx; + bfd_byte *contents; + Elf_Internal_Rela *irel; + Elf_Internal_Rela *irelend; + struct elf_link_hash_entry *sym_hash; + Elf_Internal_Shdr *shndx_hdr; + Elf_External_Sym_Shndx *shndx; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + extsyms = (Elf32_External_Sym *) symtab_hdr->contents; + + sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + contents = elf_section_data (sec)->this_hdr.contents; + + /* The deletion must stop at the next ALIGN reloc for an alignment + power larger than the number of bytes we are deleting. */ + + /* Actually delete the bytes. */ +#if (DEBUG_RELAX & 2) + fprintf (stderr, "relax_delete: contents: sec: %s %p .. %p %x\n", + sec->name, addr, toaddr, count ); +#endif + memmove (contents + addr, contents + addr + count, + toaddr - addr - count); + memset (contents + toaddr-count, 0, count); + + /* Adjust all the relocs. */ + irel = elf_section_data (sec)->relocs; + irelend = irel + sec->reloc_count; + shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; + shndx = (Elf_External_Sym_Shndx *) shndx_hdr->contents; + + for (; irel < irelend; irel++) + { + bfd_vma raddr, paddr, symval; + Elf_Internal_Sym isym; + + /* Get the new reloc address. */ + raddr = irel->r_offset; + if ((raddr >= (addr + count) && raddr < toaddr)) + irel->r_offset -= count; + + if (raddr >= addr && raddr < addr + count) + { + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + (int) R_V850_NONE); + continue; + } + + if (ELF32_R_TYPE (irel->r_info) == (int) R_V850_ALIGN) + continue; + + bfd_elf32_swap_symbol_in (abfd, + extsyms + ELF32_R_SYM (irel->r_info), + shndx ? shndx + ELF32_R_SYM (irel->r_info) : NULL, + & isym); + + if (isym.st_shndx != sec_shndx) + continue; + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + symval = isym.st_value; +#if (DEBUG_RELAX & 2) + { + char * name = bfd_elf_string_from_elf_section + (abfd, symtab_hdr->sh_link, isym.st_name); + fprintf (stderr, + "relax_delete: local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n", + sec->name, name, isym.st_name, + sec->output_section->vma, sec->output_offset, + isym.st_value, irel->r_addend); + } +#endif + } + else + { + unsigned long indx; + struct elf_link_hash_entry * h; + + /* An external symbol. */ + indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + + h = elf_sym_hashes (abfd) [indx]; + BFD_ASSERT (h != NULL); + + symval = h->root.u.def.value; +#if (DEBUG_RELAX & 2) + fprintf (stderr, + "relax_delete: defined: sec: %s, name: %s, value: %x + %x + %x addend %x\n", + sec->name, h->root.root.string, h->root.u.def.value, + sec->output_section->vma, sec->output_offset, irel->r_addend); +#endif + } + + paddr = symval + irel->r_addend; + + if ( (symval >= addr + count && symval < toaddr) + && (paddr < addr + count || paddr >= toaddr)) + irel->r_addend += count; + else if ( (symval < addr + count || symval >= toaddr) + && (paddr >= addr + count && paddr < toaddr)) + irel->r_addend -= count; + } + + /* Adjust the local symbols defined in this section. */ + esym = extsyms; + esymend = esym + symtab_hdr->sh_info; + + for (; esym < esymend; esym++, shndx = (shndx ? shndx + 1 : NULL)) + { + Elf_Internal_Sym isym; + + bfd_elf32_swap_symbol_in (abfd, esym, shndx, & isym); + + if (isym.st_shndx == sec_shndx + && isym.st_value >= addr + count + && isym.st_value < toaddr) + { + isym.st_value -= count; + + if (isym.st_value + isym.st_size >= toaddr) + isym.st_size += count; + + bfd_elf32_swap_symbol_out (abfd, & isym, esym, shndx); + } + else if (isym.st_shndx == sec_shndx + && isym.st_value < addr + count) + { + if (isym.st_value+isym.st_size >= addr + count + && isym.st_value+isym.st_size < toaddr) + isym.st_size -= count; + + if (isym.st_value >= addr + && isym.st_value < addr + count) + isym.st_value = addr; + + bfd_elf32_swap_symbol_out (abfd, & isym, esym, shndx); + } + } + + /* Now adjust the global symbols defined in this section. */ + esym = extsyms + symtab_hdr->sh_info; + esymend = extsyms + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)); + + for (index = 0; esym < esymend; esym ++, index ++) + { + Elf_Internal_Sym isym; + + bfd_elf32_swap_symbol_in (abfd, esym, shndx, & isym); + sym_hash = elf_sym_hashes (abfd) [index]; + + if (isym.st_shndx == sec_shndx + && ((sym_hash)->root.type == bfd_link_hash_defined + || (sym_hash)->root.type == bfd_link_hash_defweak) + && (sym_hash)->root.u.def.section == sec + && (sym_hash)->root.u.def.value >= addr + count + && (sym_hash)->root.u.def.value < toaddr) + { + if ((sym_hash)->root.u.def.value + isym.st_size >= toaddr) + { + isym.st_size += count; + bfd_elf32_swap_symbol_out (abfd, & isym, esym, shndx); + } + + (sym_hash)->root.u.def.value -= count; + } + else if (isym.st_shndx == sec_shndx + && ((sym_hash)->root.type == bfd_link_hash_defined + || (sym_hash)->root.type == bfd_link_hash_defweak) + && (sym_hash)->root.u.def.section == sec + && (sym_hash)->root.u.def.value < addr + count) + { + if ((sym_hash)->root.u.def.value+isym.st_size >= addr + count + && (sym_hash)->root.u.def.value+isym.st_size < toaddr) + isym.st_size -= count; + + if ((sym_hash)->root.u.def.value >= addr + && (sym_hash)->root.u.def.value < addr + count) + (sym_hash)->root.u.def.value = addr; + + bfd_elf32_swap_symbol_out (abfd, & isym, esym, shndx); + } + + if (shndx) + ++ shndx; + } + + return TRUE; +} + +#define NOP_OPCODE (0x0000) +#define MOVHI 0x0640 /* 4byte */ +#define MOVHI_MASK 0x07e0 +#define MOVHI_R1(insn) ((insn) & 0x1f) /* 4byte */ +#define MOVHI_R2(insn) ((insn) >> 11) +#define MOVEA 0x0620 /* 2byte */ +#define MOVEA_MASK 0x07e0 +#define MOVEA_R1(insn) ((insn) & 0x1f) +#define MOVEA_R2(insn) ((insn) >> 11) +#define JARL_4 0x00040780 /* 4byte */ +#define JARL_4_MASK 0xFFFF07FF +#define JARL_R2(insn) (int)(((insn) & (~JARL_4_MASK)) >> 11) +#define ADD_I 0x0240 /* 2byte */ +#define ADD_I_MASK 0x07e0 +#define ADD_I5(insn) ((((insn) & 0x001f) << 11) >> 11) /* 2byte */ +#define ADD_R2(insn) ((insn) >> 11) +#define JMP_R 0x0060 /* 2byte */ +#define JMP_R_MASK 0xFFE0 +#define JMP_R1(insn) ((insn) & 0x1f) + +static bfd_boolean +v850_elf_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + bfd_boolean *again; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *irel; + Elf_Internal_Rela *irelend; + Elf_Internal_Rela *irelalign = NULL; + Elf_Internal_Sym *isymbuf = NULL; + bfd_byte *contents = NULL; + bfd_vma addr = 0; + bfd_vma toaddr; + int align_pad_size = 0; + bfd_boolean result = TRUE; + + *again = FALSE; + + if (link_info->relocatable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0) + return TRUE; + + /* If this is the first time we have been called + for this section, initialize the cooked size. */ + if (sec->_cooked_size == 0) + sec->_cooked_size = sec->_raw_size; + + symtab_hdr = & elf_tdata (abfd)->symtab_hdr; + + internal_relocs = (_bfd_elf_link_read_relocs + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + + irelend = internal_relocs + sec->reloc_count; + + while (addr < sec->_cooked_size) + { + toaddr = sec->_cooked_size; + + for (irel = internal_relocs; irel < irelend; irel ++) + if (ELF32_R_TYPE (irel->r_info) == (int) R_V850_ALIGN + && irel->r_offset > addr + && irel->r_offset < toaddr) + toaddr = irel->r_offset; + +#ifdef DEBUG_RELAX + fprintf (stderr, "relax region 0x%x to 0x%x align pad %d\n", + addr, toaddr, align_pad_size); +#endif + if (irelalign) + { + bfd_vma alignto; + bfd_vma alignmoveto; + + alignmoveto = BFD_ALIGN (addr - align_pad_size, 1 << irelalign->r_addend); + alignto = BFD_ALIGN (addr, 1 << irelalign->r_addend); + + if (alignmoveto < alignto) + { + unsigned int i; + + align_pad_size = alignto - alignmoveto; +#ifdef DEBUG_RELAX + fprintf (stderr, "relax move region 0x%x to 0x%x delete size 0x%x\n", + alignmoveto, toaddr, align_pad_size); +#endif + if (!v850_elf_relax_delete_bytes (abfd, sec, alignmoveto, + toaddr, align_pad_size)) + goto error_return; + + for (i = BFD_ALIGN (toaddr - align_pad_size, 1); + (i + 1) < toaddr; i += 2) + bfd_put_16 (abfd, NOP_OPCODE, contents + i); + + addr = alignmoveto; + } + else + align_pad_size = 0; + } + + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma laddr; + bfd_vma addend; + bfd_vma symval; + int insn[5]; + int no_match = -1; + Elf_Internal_Rela *hi_irelfn; + Elf_Internal_Rela *lo_irelfn; + Elf_Internal_Rela *irelcall; + bfd_signed_vma foff; + + if (! (irel->r_offset >= addr && irel->r_offset < toaddr + && (ELF32_R_TYPE (irel->r_info) == (int) R_V850_LONGCALL + || ELF32_R_TYPE (irel->r_info) == (int) R_V850_LONGJUMP))) + continue; + +#ifdef DEBUG_RELAX + fprintf (stderr, "relax check r_info 0x%x r_offset 0x%x r_addend 0x%x\n", + irel->r_info, + irel->r_offset, + irel->r_addend ); +#endif + + /* Get the section contents. */ + if (contents == NULL) + { + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + } + + /* Read this BFD's local symbols if we haven't done so already. */ + if (isymbuf == NULL && symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + laddr = irel->r_offset; + + if (ELF32_R_TYPE (irel->r_info) == (int) R_V850_LONGCALL) + { + /* Check code for -mlong-calls output. */ + if (laddr + 16 <= (bfd_vma) sec->_raw_size) + { + insn[0] = bfd_get_16 (abfd, contents + laddr); + insn[1] = bfd_get_16 (abfd, contents + laddr + 4); + insn[2] = bfd_get_32 (abfd, contents + laddr + 8); + insn[3] = bfd_get_16 (abfd, contents + laddr + 12); + insn[4] = bfd_get_16 (abfd, contents + laddr + 14); + + if ((insn[0] & MOVHI_MASK) != MOVHI + || MOVHI_R1 (insn[0]) != 0) + no_match = 0; + + if (no_match < 0 + && ((insn[1] & MOVEA_MASK) != MOVEA + || MOVHI_R2 (insn[0]) != MOVEA_R1 (insn[1]))) + no_match = 1; + + if (no_match < 0 + && (insn[2] & JARL_4_MASK) != JARL_4) + no_match = 2; + + if (no_match < 0 + && ((insn[3] & ADD_I_MASK) != ADD_I + || ADD_I5 (insn[3]) != 4 + || JARL_R2 (insn[2]) != ADD_R2 (insn[3]))) + no_match = 3; + + if (no_match < 0 + && ((insn[4] & JMP_R_MASK) != JMP_R + || MOVEA_R2 (insn[1]) != JMP_R1 (insn[4]))) + no_match = 4; + } + else + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: R_V850_LONGCALL points to unrecognized insns", + bfd_get_filename (abfd), (unsigned long) irel->r_offset)); + + continue; + } + + if (no_match >= 0) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: R_V850_LONGCALL points to unrecognized insn 0x%x", + bfd_get_filename (abfd), (unsigned long) irel->r_offset+no_match, insn[no_match])); + + continue; + } + + /* Get the reloc for the address from which the register is + being loaded. This reloc will tell us which function is + actually being called. */ + for (hi_irelfn = internal_relocs; hi_irelfn < irelend; hi_irelfn ++) + if (hi_irelfn->r_offset == laddr + 2 + && ELF32_R_TYPE (hi_irelfn->r_info) + == (int) R_V850_HI16_S) + break; + + for (lo_irelfn = internal_relocs; lo_irelfn < irelend; lo_irelfn ++) + if (lo_irelfn->r_offset == laddr + 6 + && ELF32_R_TYPE (lo_irelfn->r_info) + == (int) R_V850_LO16) + break; + + for (irelcall = internal_relocs; irelcall < irelend; irelcall ++) + if (irelcall->r_offset == laddr + 8 + && ELF32_R_TYPE (irelcall->r_info) + == (int) R_V850_22_PCREL) + break; + + if ( hi_irelfn == irelend + || lo_irelfn == irelend + || irelcall == irelend) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: R_V850_LONGCALL points to unrecognized reloc", + bfd_get_filename (abfd), (unsigned long) irel->r_offset )); + + continue; + } + + if (ELF32_R_SYM (irelcall->r_info) < symtab_hdr->sh_info) + { + Elf_Internal_Sym * isym; + + /* A local symbol. */ + isym = isymbuf + ELF32_R_SYM (irelcall->r_info); + + symval = isym->st_value; + } + else + { + unsigned long indx; + struct elf_link_hash_entry * h; + + /* An external symbol. */ + indx = ELF32_R_SYM (irelcall->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + + if ( h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + continue; + + symval = h->root.u.def.value; + } + + if (symval + irelcall->r_addend != irelcall->r_offset + 4) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: R_V850_LONGCALL points to unrecognized reloc 0x%lx", + bfd_get_filename (abfd), (unsigned long) irel->r_offset, irelcall->r_offset )); + + continue; + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (hi_irelfn->r_info) < symtab_hdr->sh_info) + { + Elf_Internal_Sym *isym; + asection *sym_sec; + + /* A local symbol. */ + isym = isymbuf + ELF32_R_SYM (hi_irelfn->r_info); + + if (isym->st_shndx == SHN_UNDEF) + sym_sec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + sym_sec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + sym_sec = bfd_com_section_ptr; + else + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + symval = (isym->st_value + + sym_sec->output_section->vma + + sym_sec->output_offset); + } + else + { + unsigned long indx; + struct elf_link_hash_entry *h; + + /* An external symbol. */ + indx = ELF32_R_SYM (hi_irelfn->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + + if ( h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + continue; + + symval = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + + addend = irel->r_addend; + + foff = (symval + addend + - (irel->r_offset + + sec->output_section->vma + + sec->output_offset + + 4)); +#ifdef DEBUG_RELAX + fprintf (stderr, "relax longcall r_offset 0x%x ptr 0x%x symbol 0x%x addend 0x%x distance 0x%x\n", + irel->r_offset, + (irel->r_offset + + sec->output_section->vma + + sec->output_offset), + symval, addend, foff); +#endif + + if (foff < -0x100000 || foff >= 0x100000) + /* After all that work, we can't shorten this function call. */ + continue; + + /* For simplicity of coding, we are going to modify the section + contents, the section relocs, and the BFD symbol table. We + must tell the rest of the code not to free up this + information. It would be possible to instead create a table + of changes which have to be made, as is done in coff-mips.c; + that would be more work, but would require less memory when + the linker is run. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (bfd_byte *) isymbuf; + + /* Replace the long call with a jarl. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (hi_irelfn->r_info), R_V850_22_PCREL); + + addend = 0; + + if (ELF32_R_SYM (hi_irelfn->r_info) < symtab_hdr->sh_info) + /* If this needs to be changed because of future relaxing, + it will be handled here like other internal IND12W + relocs. */ + bfd_put_32 (abfd, + 0x00000780 | (JARL_R2 (insn[2])<<11) | ((addend << 16) & 0xffff) | ((addend >> 16) & 0xf), + contents + irel->r_offset); + else + /* We can't fully resolve this yet, because the external + symbol value may be changed by future relaxing. + We let the final link phase handle it. */ + bfd_put_32 (abfd, 0x00000780 | (JARL_R2 (insn[2])<<11), + contents + irel->r_offset); + + hi_irelfn->r_info = + ELF32_R_INFO (ELF32_R_SYM (hi_irelfn->r_info), R_V850_NONE); + lo_irelfn->r_info = + ELF32_R_INFO (ELF32_R_SYM (lo_irelfn->r_info), R_V850_NONE); + irelcall->r_info = + ELF32_R_INFO (ELF32_R_SYM (irelcall->r_info), R_V850_NONE); + + if (! v850_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 4, toaddr, 12)) + goto error_return; + + align_pad_size += 12; + } + else if (ELF32_R_TYPE (irel->r_info) == (int) R_V850_LONGJUMP) + { + /* Check code for -mlong-jumps output. */ + if (laddr + 10 <= (bfd_vma) sec->_raw_size) + { + insn[0] = bfd_get_16 (abfd, contents + laddr); + insn[1] = bfd_get_16 (abfd, contents + laddr + 4); + insn[2] = bfd_get_16 (abfd, contents + laddr + 8); + + if ((insn[0] & MOVHI_MASK) != MOVHI + || MOVHI_R1 (insn[0]) != 0) + no_match = 0; + + if (no_match < 0 + && ((insn[1] & MOVEA_MASK) != MOVEA + || MOVHI_R2 (insn[0]) != MOVEA_R1 (insn[1]))) + no_match = 1; + + if (no_match < 0 + && ((insn[2] & JMP_R_MASK) != JMP_R + || MOVEA_R2 (insn[1]) != JMP_R1 (insn[2]))) + no_match = 4; + } + else + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: R_V850_LONGJUMP points to unrecognized insns", + bfd_get_filename (abfd), (unsigned long) irel->r_offset)); + + continue; + } + + if (no_match >= 0) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: R_V850_LONGJUMP points to unrecognized insn 0x%x", + bfd_get_filename (abfd), (unsigned long) irel->r_offset+no_match, insn[no_match])); + + continue; + } + + /* Get the reloc for the address from which the register is + being loaded. This reloc will tell us which function is + actually being called. */ + for (hi_irelfn = internal_relocs; hi_irelfn < irelend; hi_irelfn ++) + if (hi_irelfn->r_offset == laddr + 2 + && ELF32_R_TYPE (hi_irelfn->r_info) == (int) R_V850_HI16_S) + break; + + for (lo_irelfn = internal_relocs; lo_irelfn < irelend; lo_irelfn ++) + if (lo_irelfn->r_offset == laddr + 6 + && ELF32_R_TYPE (lo_irelfn->r_info) == (int) R_V850_LO16) + break; + + if ( hi_irelfn == irelend + || lo_irelfn == irelend) + { + ((*_bfd_error_handler) + ("%s: 0x%lx: warning: R_V850_LONGJUMP points to unrecognized reloc", + bfd_get_filename (abfd), (unsigned long) irel->r_offset )); + + continue; + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (hi_irelfn->r_info) < symtab_hdr->sh_info) + { + Elf_Internal_Sym * isym; + asection * sym_sec; + + /* A local symbol. */ + isym = isymbuf + ELF32_R_SYM (hi_irelfn->r_info); + + if (isym->st_shndx == SHN_UNDEF) + sym_sec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + sym_sec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + sym_sec = bfd_com_section_ptr; + else + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + symval = (isym->st_value + + sym_sec->output_section->vma + + sym_sec->output_offset); +#ifdef DEBUG_RELAX + { + char * name = bfd_elf_string_from_elf_section + (abfd, symtab_hdr->sh_link, isym->st_name); + + fprintf (stderr, "relax long jump local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n", + sym_sec->name, name, isym->st_name, + sym_sec->output_section->vma, + sym_sec->output_offset, + isym->st_value, irel->r_addend); + } +#endif + } + else + { + unsigned long indx; + struct elf_link_hash_entry * h; + + /* An external symbol. */ + indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + + if ( h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + /* This appears to be a reference to an undefined + symbol. Just ignore it--it will be caught by the + regular reloc processing. */ + continue; + + symval = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); +#ifdef DEBUG_RELAX + fprintf (stderr, + "relax longjump defined: sec: %s, name: %s, value: %x + %x + %x addend %x\n", + sec->name, h->root.root.string, h->root.u.def.value, + sec->output_section->vma, sec->output_offset, irel->r_addend); +#endif + } + + addend = irel->r_addend; + + foff = (symval + addend + - (irel->r_offset + + sec->output_section->vma + + sec->output_offset + + 4)); +#ifdef DEBUG_RELAX + fprintf (stderr, "relax longjump r_offset 0x%x ptr 0x%x symbol 0x%x addend 0x%x distance 0x%x\n", + irel->r_offset, + (irel->r_offset + + sec->output_section->vma + + sec->output_offset), + symval, addend, foff); +#endif + if (foff < -0x100000 || foff >= 0x100000) + /* After all that work, we can't shorten this function call. */ + continue; + + /* For simplicity of coding, we are going to modify the section + contents, the section relocs, and the BFD symbol table. We + must tell the rest of the code not to free up this + information. It would be possible to instead create a table + of changes which have to be made, as is done in coff-mips.c; + that would be more work, but would require less memory when + the linker is run. */ + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (bfd_byte *) isymbuf; + + if (foff < -0x100 || foff >= 0x100) + { + /* Replace the long jump with a jr. */ + + irel->r_info = + ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_V850_22_PCREL); + + irel->r_addend = addend; + addend = 0; + + if (ELF32_R_SYM (hi_irelfn->r_info) < symtab_hdr->sh_info) + /* If this needs to be changed because of future relaxing, + it will be handled here like other internal IND12W + relocs. */ + bfd_put_32 (abfd, + 0x00000780 | ((addend << 15) & 0xffff0000) | ((addend >> 17) & 0xf), + contents + irel->r_offset); + else + /* We can't fully resolve this yet, because the external + symbol value may be changed by future relaxing. + We let the final link phase handle it. */ + bfd_put_32 (abfd, 0x00000780, contents + irel->r_offset); + + hi_irelfn->r_info = + ELF32_R_INFO (ELF32_R_SYM (hi_irelfn->r_info), R_V850_NONE); + lo_irelfn->r_info = + ELF32_R_INFO (ELF32_R_SYM (lo_irelfn->r_info), R_V850_NONE); + if (!v850_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 4, toaddr, 6)) + goto error_return; + + align_pad_size += 6; + } + else + { + /* Replace the long jump with a br. */ + + irel->r_info = + ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_V850_9_PCREL); + + irel->r_addend = addend; + addend = 0; + + if (ELF32_R_SYM (hi_irelfn->r_info) < symtab_hdr->sh_info) + /* If this needs to be changed because of future relaxing, + it will be handled here like other internal IND12W + relocs. */ + bfd_put_16 (abfd, + 0x0585 | ((addend << 10) & 0xf800) | ((addend << 3) & 0x0070), + contents + irel->r_offset); + else + /* We can't fully resolve this yet, because the external + symbol value may be changed by future relaxing. + We let the final link phase handle it. */ + bfd_put_16 (abfd, 0x0585, contents + irel->r_offset); + + hi_irelfn->r_info = + ELF32_R_INFO (ELF32_R_SYM (hi_irelfn->r_info), R_V850_NONE); + lo_irelfn->r_info = + ELF32_R_INFO (ELF32_R_SYM (lo_irelfn->r_info), R_V850_NONE); + if (!v850_elf_relax_delete_bytes (abfd, sec, + irel->r_offset + 2, toaddr, 8)) + goto error_return; + + align_pad_size += 8; + } + } + } + + irelalign = NULL; + for (irel = internal_relocs; irel < irelend; irel++) + { + if (ELF32_R_TYPE (irel->r_info) == (int) R_V850_ALIGN + && irel->r_offset == toaddr) + { + irel->r_offset -= align_pad_size; + + if (irelalign == NULL || irelalign->r_addend > irel->r_addend) + irelalign = irel; + } + } + + addr = toaddr; + } + + if (!irelalign) + { +#ifdef DEBUG_RELAX + fprintf (stderr, "relax pad %d shorten %d -> %d\n", + align_pad_size, + sec->_cooked_size, + sec->_cooked_size - align_pad_size); +#endif + sec->_cooked_size -= align_pad_size; + } + + finish: + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != (unsigned char *) contents) + free (contents); + + if (isymbuf != NULL + && symtab_hdr->contents != (bfd_byte *) isymbuf) + free (isymbuf); + + return result; + + error_return: + result = FALSE; + goto finish; +} + +static struct bfd_elf_special_section const v850_elf_special_sections[]= +{ + { ".sdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_GPREL) }, + { ".rosdata", 8, -2, SHT_PROGBITS, (SHF_ALLOC + + SHF_V850_GPREL) }, + { ".sbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_GPREL) }, + { ".scommon", 8, -2, SHT_V850_SCOMMON, (SHF_ALLOC + SHF_WRITE + + SHF_V850_GPREL) }, + { ".tdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_EPREL) }, + { ".tbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_EPREL) }, + { ".tcommon", 8, -2, SHT_V850_TCOMMON, (SHF_ALLOC + SHF_WRITE + + SHF_V850_R0REL) }, + { ".zdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_R0REL) }, + { ".rozdata", 8, -2, SHT_PROGBITS, (SHF_ALLOC + + SHF_V850_R0REL) }, + { ".zbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE + + SHF_V850_R0REL) }, + { ".zcommon", 8, -2, SHT_V850_ZCOMMON, (SHF_ALLOC + SHF_WRITE + + SHF_V850_R0REL) }, + { ".call_table_data", 16, 0, SHT_PROGBITS, (SHF_ALLOC + + SHF_WRITE) }, + { ".call_table_text", 16, 0, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE + + SHF_EXECINSTR) }, + { NULL, 0, 0, 0, 0 } +}; + +#define TARGET_LITTLE_SYM bfd_elf32_v850_vec +#define TARGET_LITTLE_NAME "elf32-v850" +#define ELF_ARCH bfd_arch_v850 +#define ELF_MACHINE_CODE EM_V850 +#define ELF_MACHINE_ALT1 EM_CYGNUS_V850 +#define ELF_MAXPAGESIZE 0x1000 + +#define elf_info_to_howto v850_elf_info_to_howto_rela +#define elf_info_to_howto_rel v850_elf_info_to_howto_rel + +#define elf_backend_check_relocs v850_elf_check_relocs +#define elf_backend_relocate_section v850_elf_relocate_section +#define elf_backend_object_p v850_elf_object_p +#define elf_backend_final_write_processing v850_elf_final_write_processing +#define elf_backend_section_from_bfd_section v850_elf_section_from_bfd_section +#define elf_backend_symbol_processing v850_elf_symbol_processing +#define elf_backend_add_symbol_hook v850_elf_add_symbol_hook +#define elf_backend_link_output_symbol_hook v850_elf_link_output_symbol_hook +#define elf_backend_section_from_shdr v850_elf_section_from_shdr +#define elf_backend_fake_sections v850_elf_fake_sections +#define elf_backend_gc_mark_hook v850_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook v850_elf_gc_sweep_hook +#define elf_backend_special_sections v850_elf_special_sections + +#define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 + +#define bfd_elf32_bfd_is_local_label_name v850_elf_is_local_label_name +#define bfd_elf32_bfd_reloc_type_lookup v850_elf_reloc_type_lookup +#define bfd_elf32_bfd_merge_private_bfd_data v850_elf_merge_private_bfd_data +#define bfd_elf32_bfd_set_private_flags v850_elf_set_private_flags +#define bfd_elf32_bfd_print_private_bfd_data v850_elf_print_private_bfd_data +#define bfd_elf32_bfd_relax_section v850_elf_relax_section + +#define elf_symbol_leading_char '_' + +#include "elf32-target.h" diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c new file mode 100644 index 0000000000000..8ce4678e29157 --- /dev/null +++ b/bfd/elf32-vax.c @@ -0,0 +1,2164 @@ +/* VAX series support for 32-bit ELF + Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2004 Free Software Foundation, Inc. + Contributed by Matt Thomas . + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/vax.h" + +static reloc_howto_type *reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void rtype_to_howto + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static struct bfd_hash_entry *elf_vax_link_hash_newfunc + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +static struct bfd_link_hash_table *elf_vax_link_hash_table_create + PARAMS ((bfd *)); +static bfd_boolean elf_vax_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static asection *elf_vax_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static bfd_boolean elf_vax_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static bfd_boolean elf_vax_adjust_dynamic_symbol + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); +static bfd_boolean elf_vax_size_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean elf_vax_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static bfd_boolean elf_vax_finish_dynamic_symbol + PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *)); +static bfd_boolean elf_vax_finish_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + +static bfd_boolean elf32_vax_set_private_flags + PARAMS ((bfd *, flagword)); +static bfd_boolean elf32_vax_merge_private_bfd_data + PARAMS ((bfd *, bfd *)); +static bfd_boolean elf32_vax_print_private_bfd_data + PARAMS ((bfd *, PTR)); + +static reloc_howto_type howto_table[] = { + HOWTO (R_VAX_NONE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_VAX_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x00000000, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_VAX_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_VAX_32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_VAX_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_VAX_16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_VAX_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_VAX_8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x000000ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_VAX_PC32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_VAX_PC32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_VAX_PC16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_VAX_PC16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_VAX_PC8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_VAX_PC8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x000000ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_VAX_GOT32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_VAX_GOT32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + EMPTY_HOWTO (-1), + EMPTY_HOWTO (-1), + EMPTY_HOWTO (-1), + EMPTY_HOWTO (-1), + EMPTY_HOWTO (-1), + + HOWTO (R_VAX_PLT32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_VAX_PLT32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + EMPTY_HOWTO (-1), + EMPTY_HOWTO (-1), + EMPTY_HOWTO (-1), + EMPTY_HOWTO (-1), + EMPTY_HOWTO (-1), + + HOWTO (R_VAX_COPY, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_VAX_COPY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_VAX_GLOB_DAT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_VAX_GLOB_DAT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_VAX_JMP_SLOT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_VAX_JMP_SLOT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_VAX_RELATIVE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_VAX_RELATIVE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_VAX_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_VAX_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_VAX_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_VAX_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; + +static void +rtype_to_howto (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_VAX_max); + cache_ptr->howto = &howto_table[ELF32_R_TYPE(dst->r_info)]; +} + +#define elf_info_to_howto rtype_to_howto + +static const struct +{ + bfd_reloc_code_real_type bfd_val; + int elf_val; +} reloc_map[] = { + { BFD_RELOC_NONE, R_VAX_NONE }, + { BFD_RELOC_32, R_VAX_32 }, + { BFD_RELOC_16, R_VAX_16 }, + { BFD_RELOC_8, R_VAX_8 }, + { BFD_RELOC_32_PCREL, R_VAX_PC32 }, + { BFD_RELOC_16_PCREL, R_VAX_PC16 }, + { BFD_RELOC_8_PCREL, R_VAX_PC8 }, + { BFD_RELOC_32_GOT_PCREL, R_VAX_GOT32 }, + { BFD_RELOC_32_PLT_PCREL, R_VAX_PLT32 }, + { BFD_RELOC_NONE, R_VAX_COPY }, + { BFD_RELOC_VAX_GLOB_DAT, R_VAX_GLOB_DAT }, + { BFD_RELOC_VAX_JMP_SLOT, R_VAX_JMP_SLOT }, + { BFD_RELOC_VAX_RELATIVE, R_VAX_RELATIVE }, + { BFD_RELOC_CTOR, R_VAX_32 }, + { BFD_RELOC_VTABLE_INHERIT, R_VAX_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_VAX_GNU_VTENTRY }, +}; + +static reloc_howto_type * +reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + for (i = 0; i < sizeof (reloc_map) / sizeof (reloc_map[0]); i++) + { + if (reloc_map[i].bfd_val == code) + return &howto_table[reloc_map[i].elf_val]; + } + return 0; +} + +#define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup +#define ELF_ARCH bfd_arch_vax +/* end code generated by elf.el */ + +/* Functions for the VAX ELF linker. */ + +/* The name of the dynamic interpreter. This is put in the .interp + section. */ + +#define ELF_DYNAMIC_INTERPRETER "/usr/libexec/ld.elf_so" + +/* The size in bytes of an entry in the procedure linkage table. */ + +#define PLT_ENTRY_SIZE 12 + +/* The first entry in a procedure linkage table looks like this. See + the SVR4 ABI VAX supplement to see how this works. */ + +static const bfd_byte elf_vax_plt0_entry[PLT_ENTRY_SIZE] = +{ + 0xdd, 0xef, /* pushl l^ */ + 0, 0, 0, 0, /* offset to .plt.got + 4 */ + 0x17, 0xff, /* jmp @L^(pc) */ + 0, 0, 0, 0, /* offset to .plt.got + 8 */ +}; + +/* Subsequent entries in a procedure linkage table look like this. */ + +static const bfd_byte elf_vax_plt_entry[PLT_ENTRY_SIZE] = +{ + 0x40, 0x00, /* .word ^M */ + 0x16, 0xef, /* jsb L^(pc) */ + 0, 0, 0, 0, /* replaced with offset to start of .plt */ + 0, 0, 0, 0, /* index into .rela.plt */ +}; + +/* The VAX linker needs to keep track of the number of relocs that it + decides to copy in check_relocs for each symbol. This is so that it + can discard PC relative relocs if it doesn't need them when linking + with -Bsymbolic. We store the information in a field extending the + regular ELF linker hash table. */ + +/* This structure keeps track of the number of PC relative relocs we have + copied for a given symbol. */ + +struct elf_vax_pcrel_relocs_copied +{ + /* Next section. */ + struct elf_vax_pcrel_relocs_copied *next; + /* A section in dynobj. */ + asection *section; + /* Number of relocs copied in this section. */ + bfd_size_type count; +}; + +/* VAX ELF linker hash entry. */ + +struct elf_vax_link_hash_entry +{ + struct elf_link_hash_entry root; + + /* Number of PC relative relocs copied for this symbol. */ + struct elf_vax_pcrel_relocs_copied *pcrel_relocs_copied; + + bfd_vma got_addend; +}; + +/* VAX ELF linker hash table. */ + +struct elf_vax_link_hash_table +{ + struct elf_link_hash_table root; +}; + +/* Declare this now that the above structures are defined. */ + +static bfd_boolean elf_vax_discard_copies + PARAMS ((struct elf_vax_link_hash_entry *, PTR)); + +/* Declare this now that the above structures are defined. */ + +static bfd_boolean elf_vax_instantiate_got_entries + PARAMS ((struct elf_link_hash_entry *, PTR)); + +/* Traverse an VAX ELF linker hash table. */ + +#define elf_vax_link_hash_traverse(table, func, info) \ + (elf_link_hash_traverse \ + (&(table)->root, \ + (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ + (info))) + +/* Get the VAX ELF linker hash table from a link_info structure. */ + +#define elf_vax_hash_table(p) \ + ((struct elf_vax_link_hash_table *) (p)->hash) + +/* Create an entry in an VAX ELF linker hash table. */ + +static struct bfd_hash_entry * +elf_vax_link_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct elf_vax_link_hash_entry *ret = + (struct elf_vax_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct elf_vax_link_hash_entry *) NULL) + ret = ((struct elf_vax_link_hash_entry *) + bfd_hash_allocate (table, + sizeof (struct elf_vax_link_hash_entry))); + if (ret == (struct elf_vax_link_hash_entry *) NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct elf_vax_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != (struct elf_vax_link_hash_entry *) NULL) + { + ret->pcrel_relocs_copied = NULL; + } + + return (struct bfd_hash_entry *) ret; +} + +/* Create an VAX ELF linker hash table. */ + +static struct bfd_link_hash_table * +elf_vax_link_hash_table_create (abfd) + bfd *abfd; +{ + struct elf_vax_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_vax_link_hash_table); + + ret = (struct elf_vax_link_hash_table *) bfd_malloc (amt); + if (ret == (struct elf_vax_link_hash_table *) NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + elf_vax_link_hash_newfunc)) + { + free (ret); + return NULL; + } + + return &ret->root.root; +} + +/* Keep vax-specific flags in the ELF header */ +static bfd_boolean +elf32_vax_set_private_flags (abfd, flags) + bfd *abfd; + flagword flags; +{ + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + return TRUE; +} + +/* Merge backend specific data from an object file to the output + object file when linking. */ +static bfd_boolean +elf32_vax_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + flagword out_flags; + flagword in_flags; + + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + in_flags = elf_elfheader (ibfd)->e_flags; + out_flags = elf_elfheader (obfd)->e_flags; + + if (!elf_flags_init (obfd)) + { + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = in_flags; + } + + return TRUE; +} + +/* Display the flags field */ +static bfd_boolean +elf32_vax_print_private_bfd_data (abfd, ptr) + bfd *abfd; + PTR ptr; +{ + FILE *file = (FILE *) ptr; + + BFD_ASSERT (abfd != NULL && ptr != NULL); + + /* Print normal ELF private data. */ + _bfd_elf_print_private_bfd_data (abfd, ptr); + + /* Ignore init flag - it may not be set, despite the flags field containing valid data. */ + + /* xgettext:c-format */ + fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags); + + if (elf_elfheader (abfd)->e_flags & EF_VAX_NONPIC) + fprintf (file, _(" [nonpic]")); + + if (elf_elfheader (abfd)->e_flags & EF_VAX_DFLOAT) + fprintf (file, _(" [d-float]")); + + if (elf_elfheader (abfd)->e_flags & EF_VAX_GFLOAT) + fprintf (file, _(" [g-float]")); + + fputc ('\n', file); + + return TRUE; +} +/* Look through the relocs for a section during the first phase, and + allocate space in the global offset table or procedure linkage + table. */ + +static bfd_boolean +elf_vax_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + bfd *dynobj; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + asection *sgot; + asection *srelgot; + asection *sreloc; + + if (info->relocatable) + return TRUE; + + dynobj = elf_hash_table (info)->dynobj; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + + sgot = NULL; + srelgot = NULL; + sreloc = NULL; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + unsigned long r_symndx; + struct elf_link_hash_entry *h; + + r_symndx = ELF32_R_SYM (rel->r_info); + + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_VAX_GOT32: + if (h != NULL + && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + break; + + /* This symbol requires a global offset table entry. */ + + if (dynobj == NULL) + { + /* Create the .got section. */ + elf_hash_table (info)->dynobj = dynobj = abfd; + if (!_bfd_elf_create_got_section (dynobj, info)) + return FALSE; + } + + if (sgot == NULL) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + } + + if (srelgot == NULL + && (h != NULL || info->shared)) + { + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + if (srelgot == NULL) + { + srelgot = bfd_make_section (dynobj, ".rela.got"); + if (srelgot == NULL + || !bfd_set_section_flags (dynobj, srelgot, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || !bfd_set_section_alignment (dynobj, srelgot, 2)) + return FALSE; + } + } + + if (h != NULL) + { + struct elf_vax_link_hash_entry *eh; + + eh = (struct elf_vax_link_hash_entry *) h; + if (h->got.refcount == -1) + { + h->got.refcount = 1; + eh->got_addend = rel->r_addend; + } + else + { + h->got.refcount++; + if (eh->got_addend != (bfd_vma) rel->r_addend) + (*_bfd_error_handler) + (_("%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of %ld"), + bfd_get_filename (abfd), rel->r_addend, + h->root.root.string, + eh->got_addend); + + } + } + break; + + case R_VAX_PLT32: + /* This symbol requires a procedure linkage table entry. We + actually build the entry in adjust_dynamic_symbol, + because this might be a case of linking PIC code which is + never referenced by a dynamic object, in which case we + don't need to generate a procedure linkage table entry + after all. */ + + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + if (h == NULL) + continue; + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + if (h->plt.refcount == -1) + h->plt.refcount = 1; + else + h->plt.refcount++; + break; + + case R_VAX_PC8: + case R_VAX_PC16: + case R_VAX_PC32: + /* If we are creating a shared library and this is not a local + symbol, we need to copy the reloc into the shared library. + However when linking with -Bsymbolic and this is a global + symbol which is defined in an object we are including in the + link (i.e., DEF_REGULAR is set), then we can resolve the + reloc directly. At this point we have not seen all the input + files, so it is possible that DEF_REGULAR is not set now but + will be set later (it is never cleared). We account for that + possibility below by storing information in the + pcrel_relocs_copied field of the hash table entry. */ + if (!(info->shared + && (sec->flags & SEC_ALLOC) != 0 + && h != NULL + && (!info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) + { + if (h != NULL) + { + /* Make sure a plt entry is created for this symbol if + it turns out to be a function defined by a dynamic + object. */ + if (h->plt.refcount == -1) + h->plt.refcount = 1; + else + h->plt.refcount++; + } + break; + } + /* Fall through. */ + case R_VAX_8: + case R_VAX_16: + case R_VAX_32: + if (h != NULL) + { + /* Make sure a plt entry is created for this symbol if it + turns out to be a function defined by a dynamic object. */ + if (h->plt.refcount == -1) + h->plt.refcount = 1; + else + h->plt.refcount++; + } + + /* If we are creating a shared library, we need to copy the + reloc into the shared library. */ + if (info->shared + && (sec->flags & SEC_ALLOC) != 0) + { + /* When creating a shared object, we must copy these + reloc types into the output file. We create a reloc + section in dynobj and make room for this reloc. */ + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) + { + sreloc = bfd_make_section (dynobj, name); + if (sreloc == NULL + || !bfd_set_section_flags (dynobj, sreloc, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || !bfd_set_section_alignment (dynobj, sreloc, 2)) + return FALSE; + } + if (sec->flags & SEC_READONLY) + info->flags |= DF_TEXTREL; + } + + sreloc->_raw_size += sizeof (Elf32_External_Rela); + + /* If we are linking with -Bsymbolic, we count the number of + PC relative relocations we have entered for this symbol, + so that we can discard them again if the symbol is later + defined by a regular object. Note that this function is + only called if we are using a vaxelf linker hash table, + which means that h is really a pointer to an + elf_vax_link_hash_entry. */ + if ((ELF32_R_TYPE (rel->r_info) == R_VAX_PC8 + || ELF32_R_TYPE (rel->r_info) == R_VAX_PC16 + || ELF32_R_TYPE (rel->r_info) == R_VAX_PC32) + && info->symbolic) + { + struct elf_vax_link_hash_entry *eh; + struct elf_vax_pcrel_relocs_copied *p; + + eh = (struct elf_vax_link_hash_entry *) h; + + for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next) + if (p->section == sreloc) + break; + + if (p == NULL) + { + p = ((struct elf_vax_pcrel_relocs_copied *) + bfd_alloc (dynobj, (bfd_size_type) sizeof *p)); + if (p == NULL) + return FALSE; + p->next = eh->pcrel_relocs_copied; + eh->pcrel_relocs_copied = p; + p->section = sreloc; + p->count = 0; + } + + ++p->count; + } + } + + break; + + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_VAX_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_VAX_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + + default: + break; + } + } + + return TRUE; +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +elf_vax_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_VAX_GNU_VTINHERIT: + case R_VAX_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + default: + break; + + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the got entry reference counts for the section being removed. */ + +static bfd_boolean +elf_vax_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + const Elf_Internal_Rela *rel, *relend; + bfd *dynobj; + + dynobj = elf_hash_table (info)->dynobj; + if (dynobj == NULL) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; rel++) + { + unsigned long r_symndx; + struct elf_link_hash_entry *h; + + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_VAX_GOT32: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->got.refcount > 0) + --h->got.refcount; + } + break; + + case R_VAX_PLT32: + case R_VAX_PC8: + case R_VAX_PC16: + case R_VAX_PC32: + case R_VAX_8: + case R_VAX_16: + case R_VAX_32: + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + if (h->plt.refcount > 0) + --h->plt.refcount; + } + break; + + default: + break; + } + } + + return TRUE; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static bfd_boolean +elf_vax_adjust_dynamic_symbol (info, h) + struct bfd_link_info *info; + struct elf_link_hash_entry *h; +{ + bfd *dynobj; + asection *s; + unsigned int power_of_two; + + dynobj = elf_hash_table (info)->dynobj; + + /* Make sure we know what is going on here. */ + BFD_ASSERT (dynobj != NULL + && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) + || h->weakdef != NULL + || ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_REF_REGULAR) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))); + + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later, + when we know the address of the .got section. */ + if (h->type == STT_FUNC + || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + { + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 + /* We must always create the plt entry if it was referenced + by a PLTxxO relocation. In this case we already recorded + it as a dynamic symbol. */ + && h->dynindx == -1) + { + /* This case can occur if we saw a PLTxx reloc in an input + file, but the symbol was never referred to by a dynamic + object. In such a case, we don't actually need to build + a procedure linkage table, and we can just do a PCxx + reloc instead. */ + BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0); + h->plt.offset = (bfd_vma) -1; + return TRUE; + } + + /* GC may have rendered this entry unused. */ + if (h->plt.refcount <= 0) + { + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->plt.offset = (bfd_vma) -1; + return TRUE; + } + + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (s != NULL); + + /* If this is the first .plt entry, make room for the special + first entry. */ + if (s->_raw_size == 0) + { + s->_raw_size += PLT_ENTRY_SIZE; + } + + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (!info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + } + + h->plt.offset = s->_raw_size; + + /* Make room for this entry. */ + s->_raw_size += PLT_ENTRY_SIZE; + + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + + s = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (s != NULL); + s->_raw_size += 4; + + /* We also need to make an entry in the .rela.plt section. */ + + s = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (s != NULL); + s->_raw_size += sizeof (Elf32_External_Rela); + + return TRUE; + } + + /* Reinitialize the plt offset now that it is not used as a reference + count any more. */ + h->plt.offset = (bfd_vma) -1; + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (info->shared) + return TRUE; + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + + s = bfd_get_section_by_name (dynobj, ".dynbss"); + BFD_ASSERT (s != NULL); + + /* We must generate a R_VAX_COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rela.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + asection *srel; + + srel = bfd_get_section_by_name (dynobj, ".rela.bss"); + BFD_ASSERT (srel != NULL); + srel->_raw_size += sizeof (Elf32_External_Rela); + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + } + + /* We need to figure out the alignment required for this symbol. I + have no idea how ELF linkers handle this. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > 3) + power_of_two = 3; + + /* Apply the required alignment. */ + s->_raw_size = BFD_ALIGN (s->_raw_size, + (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (dynobj, s)) + { + if (!bfd_set_section_alignment (dynobj, s, power_of_two)) + return FALSE; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + + /* Increment the section size to make room for the symbol. */ + s->_raw_size += h->size; + + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +elf_vax_size_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *s; + bfd_boolean plt; + bfd_boolean relocs; + bfd_boolean reltext; + + dynobj = elf_hash_table (info)->dynobj; + BFD_ASSERT (dynobj != NULL); + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (info->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } + else + { + /* We may have created entries in the .rela.got and .got sections. + However, if we are not creating the dynamic sections, we will + not actually use these entries. Reset the size of .rela.got + and .got, which will cause it to get stripped from the output + file below. */ + s = bfd_get_section_by_name (dynobj, ".rela.got"); + if (s != NULL) + s->_raw_size = 0; + s = bfd_get_section_by_name (dynobj, ".got.plt"); + if (s != NULL) + s->_raw_size = 0; + s = bfd_get_section_by_name (dynobj, ".got"); + if (s != NULL) + s->_raw_size = 0; + } + + /* If this is a -Bsymbolic shared link, then we need to discard all PC + relative relocs against symbols defined in a regular object. We + allocated space for them in the check_relocs routine, but we will not + fill them in in the relocate_section routine. */ + if (info->shared && info->symbolic) + elf_vax_link_hash_traverse (elf_vax_hash_table (info), + elf_vax_discard_copies, + (PTR) NULL); + + /* If this is a -Bsymbolic shared link or a static link, we need to + discard all the got entries we've recorded. Otherwise, we need to + instantiate (allocate space for them). */ + elf_link_hash_traverse (elf_hash_table (info), + elf_vax_instantiate_got_entries, + (PTR) info); + + /* The check_relocs and adjust_dynamic_symbol entry points have + determined the sizes of the various dynamic sections. Allocate + memory for them. */ + plt = FALSE; + relocs = FALSE; + reltext = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + const char *name; + bfd_boolean strip; + + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + /* It's OK to base decisions on the section name, because none + of the dynobj section names depend upon the input files. */ + name = bfd_get_section_name (dynobj, s); + + strip = FALSE; + + if (strcmp (name, ".plt") == 0) + { + if (s->_raw_size == 0) + { + /* Strip this section if we don't need it; see the + comment below. */ + strip = TRUE; + } + else + { + /* Remember whether there is a PLT. */ + plt = TRUE; + } + } + else if (strncmp (name, ".rela", 5) == 0) + { + if (s->_raw_size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + strip = TRUE; + } + else + { + asection *target; + + /* Remember whether there are any reloc sections other + than .rela.plt. */ + if (strcmp (name, ".rela.plt") != 0) + { + const char *outname; + + relocs = TRUE; + + /* If this relocation section applies to a read only + section, then we probably need a DT_TEXTREL + entry. .rela.plt is actually associated with + .got.plt, which is never readonly. */ + outname = bfd_get_section_name (output_bfd, + s->output_section); + target = bfd_get_section_by_name (output_bfd, outname + 5); + if (target != NULL + && (target->flags & SEC_READONLY) != 0 + && (target->flags & SEC_ALLOC) != 0) + reltext = TRUE; + } + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + } + else if (strncmp (name, ".got", 4) != 0) + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (strip) + { + _bfd_strip_section_from_output (info, s); + continue; + } + + /* Allocate memory for the section contents. */ + s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) + return FALSE; + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in elf_vax_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) + + if (!info->shared) + { + if (!add_dynamic_entry (DT_DEBUG, 0)) + return FALSE; + } + + if (plt) + { + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + } + + if (relocs) + { + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) + return FALSE; + } + + if (reltext || (info->flags & DF_TEXTREL) != 0) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return FALSE; + } + } +#undef add_dynamic_entry + + return TRUE; +} + +/* This function is called via elf_vax_link_hash_traverse if we are + creating a shared object with -Bsymbolic. It discards the space + allocated to copy PC relative relocs against symbols which are defined + in regular objects. We allocated space for them in the check_relocs + routine, but we won't fill them in in the relocate_section routine. */ + +static bfd_boolean +elf_vax_discard_copies (h, ignore) + struct elf_vax_link_hash_entry *h; + PTR ignore ATTRIBUTE_UNUSED; +{ + struct elf_vax_pcrel_relocs_copied *s; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_vax_link_hash_entry *) h->root.root.u.i.link; + + /* We only discard relocs for symbols defined in a regular object. */ + if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + return TRUE; + + for (s = h->pcrel_relocs_copied; s != NULL; s = s->next) + s->section->_raw_size -= s->count * sizeof (Elf32_External_Rela); + + return TRUE; +} + +/* This function is called via elf_link_hash_traverse. It looks for entries + that have GOT or PLT (.GOT) references. If creating a static object or a + shared object with -Bsymbolic, it resets the reference count back to 0 + and sets the offset to -1 so normal PC32 relocation will be done. If + creating a shared object or executable, space in the .got and .rela.got + will be reserved for the symbol. */ + +static bfd_boolean +elf_vax_instantiate_got_entries (h, infoptr) + struct elf_link_hash_entry *h; + PTR infoptr; +{ + struct bfd_link_info *info = (struct bfd_link_info *) infoptr; + bfd *dynobj; + asection *sgot; + asection *srelgot; + + /* We don't care about non-GOT (and non-PLT) entries. */ + if (h->got.refcount <= 0 && h->plt.refcount <= 0) + return TRUE; + + dynobj = elf_hash_table (info)->dynobj; + if (dynobj == NULL) + return TRUE; + + sgot = bfd_get_section_by_name (dynobj, ".got"); + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + + if (!elf_hash_table (info)->dynamic_sections_created + || (info->shared && info->symbolic)) + { + h->got.refcount = 0; + h->got.offset = (bfd_vma) -1; + h->plt.refcount = 0; + h->plt.offset = (bfd_vma) -1; + } + else if (h->got.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1) + { + if (!bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + /* Allocate space in the .got and .rela.got sections. */ + sgot->_raw_size += 4; + srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + + return TRUE; +} + +/* Relocate an VAX ELF section. */ + +static bfd_boolean +elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + bfd *dynobj; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_vma *local_got_offsets; + bfd_vma plt_index; + bfd_vma got_offset; + asection *sgot; + asection *splt; + asection *sgotplt; + asection *sreloc; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + + if (info->relocatable) + return TRUE; + + dynobj = elf_hash_table (info)->dynobj; + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + local_got_offsets = elf_local_got_offsets (input_bfd); + + sgot = NULL; + splt = NULL; + sgotplt = NULL; + sreloc = NULL; + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + asection *sec; + bfd_vma relocation; + bfd_reloc_status_type r; + + r_type = ELF32_R_TYPE (rel->r_info); + if (r_type < 0 || r_type >= (int) R_VAX_max) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + howto = howto_table + r_type; + + /* This is a final link. */ + r_symndx = ELF32_R_SYM (rel->r_info); + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { + bfd_boolean unresolved_reloc; + bfd_boolean warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && ((r_type == R_VAX_PLT32 + && h->plt.offset != (bfd_vma) -1 + && elf_hash_table (info)->dynamic_sections_created) + || (r_type == R_VAX_GOT32 + && strcmp (h->root.root.string, + "_GLOBAL_OFFSET_TABLE_") != 0 + && elf_hash_table (info)->dynamic_sections_created + && (! info->shared + || (! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + || (info->shared + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) + && ((input_section->flags & SEC_ALLOC) != 0 + /* DWARF will emit R_VAX_32 relocations in its + sections against symbols defined externally + in shared libraries. We can't do anything + with them here. */ + + || ((input_section->flags & SEC_DEBUGGING) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + && (r_type == R_VAX_8 + || r_type == R_VAX_16 + || r_type == R_VAX_32 + || r_type == R_VAX_PC8 + || r_type == R_VAX_PC16 + || r_type == R_VAX_PC32)))) + /* In these cases, we don't need the relocation + value. We check specially because in some + obscure cases sec->output_section will be NULL. */ + relocation = 0; + } + + switch (r_type) + { + case R_VAX_GOT32: + /* Relocation is to the address of the entry for this symbol + in the global offset table. */ + if (h == NULL || h->got.offset == (bfd_vma) -1) + break; + + /* Relocation is the offset of the entry for this symbol in + the global offset table. */ + + { + bfd_vma off; + + if (sgot == NULL) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + } + + BFD_ASSERT (h != NULL); + off = h->got.offset; + BFD_ASSERT (off != (bfd_vma) -1); + BFD_ASSERT (off < sgot->_raw_size); + + if (info->shared + && h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + { + /* The symbol was forced to be local + because of a version file.. We must initialize + this entry in the global offset table. Since + the offset must always be a multiple of 4, we + use the least significant bit to record whether + we have initialized it already. + + When doing a dynamic link, we create a .rela.got + relocation entry to initialize the value. This + is done in the finish_dynamic_symbol routine. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_32 (output_bfd, relocation + rel->r_addend, + sgot->contents + off); + h->got.offset |= 1; + } + } else { + bfd_put_32 (output_bfd, rel->r_addend, sgot->contents + off); + } + + relocation = sgot->output_offset + off; + /* The GOT relocation uses the addend. */ + rel->r_addend = 0; + + /* Change the reference to be indirect. */ + contents[rel->r_offset - 1] |= 0x10; + relocation += sgot->output_section->vma; + } + break; + + case R_VAX_PLT32: + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + /* Resolve a PLTxx reloc against a local symbol directly, + without using the procedure linkage table. */ + if (h == NULL) + break; + + if (h->plt.offset == (bfd_vma) -1 + || !elf_hash_table (info)->dynamic_sections_created) + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ + break; + } + + if (splt == NULL) + { + splt = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (splt != NULL); + } + + if (sgotplt == NULL) + { + sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (splt != NULL); + } + + plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; + + /* Get the offset into the .got table of the entry that + corresponds to this function. Each .got entry is 4 bytes. + The first two are reserved. */ + got_offset = (plt_index + 3) * 4; + + /* We want the relocate to point into the .got.plt instead + of the plt itself. */ + relocation = (sgotplt->output_section->vma + + sgotplt->output_offset + + got_offset); + contents[rel->r_offset-1] |= 0x10; /* make indirect */ + if (rel->r_addend == 2) + { + h->plt.offset |= 1; + } + else if (rel->r_addend != 0) + (*_bfd_error_handler) + (_("%s: warning: PLT addend of %d to `%s' from %s section ignored"), + bfd_get_filename (input_bfd), rel->r_addend, + h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + rel->r_addend = 0; + + break; + + case R_VAX_PC8: + case R_VAX_PC16: + case R_VAX_PC32: + if (h == NULL) + break; + /* Fall through. */ + case R_VAX_8: + case R_VAX_16: + case R_VAX_32: + if (info->shared + && r_symndx != 0 + && (input_section->flags & SEC_ALLOC) != 0 + && ((r_type != R_VAX_PC8 + && r_type != R_VAX_PC16 + && r_type != R_VAX_PC32) + || (!info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + bfd_boolean skip, relocate; + + /* When generating a shared object, these relocations + are copied into the output file to be resolved at run + time. */ + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (input_bfd, + elf_elfheader (input_bfd)->e_shstrndx, + elf_section_data (input_section)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (input_bfd, + input_section), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + BFD_ASSERT (sreloc != NULL); + } + + skip = FALSE; + relocate = FALSE; + + outrel.r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, + rel->r_offset); + if (outrel.r_offset == (bfd_vma) -1) + skip = TRUE; + if (outrel.r_offset == (bfd_vma) -2) + skip = TRUE, relocate = TRUE; + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + /* h->dynindx may be -1 if the symbol was marked to + become local. */ + else if (h != NULL + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + { + BFD_ASSERT (h->dynindx != -1); + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + outrel.r_addend = relocation + rel->r_addend; + } + else + { + if (r_type == R_VAX_32) + { + relocate = TRUE; + outrel.r_info = ELF32_R_INFO (0, R_VAX_RELATIVE); + BFD_ASSERT (bfd_get_signed_32 (input_bfd, + &contents[rel->r_offset]) == 0); + outrel.r_addend = relocation + rel->r_addend; + } + else + { + long indx; + + if (bfd_is_abs_section (sec)) + indx = 0; + else if (sec == NULL || sec->owner == NULL) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + else + { + asection *osec; + + osec = sec->output_section; + indx = elf_section_data (osec)->dynindx; + BFD_ASSERT (indx > 0); + } + + outrel.r_info = ELF32_R_INFO (indx, r_type); + outrel.r_addend = relocation + rel->r_addend; + } + } + + if (!strcmp (bfd_get_section_name (input_bfd, input_section), + ".text") != 0 || + (info->shared + && ELF32_R_TYPE(outrel.r_info) != R_VAX_32 + && ELF32_R_TYPE(outrel.r_info) != R_VAX_RELATIVE + && ELF32_R_TYPE(outrel.r_info) != R_VAX_COPY + && ELF32_R_TYPE(outrel.r_info) != R_VAX_JMP_SLOT + && ELF32_R_TYPE(outrel.r_info) != R_VAX_GLOB_DAT)) + { + if (h != NULL) + (*_bfd_error_handler) + (_("%s: warning: %s relocation against symbol `%s' from %s section"), + bfd_get_filename (input_bfd), howto->name, + h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + else + (*_bfd_error_handler) + (_("%s: warning: %s relocation to 0x%x from %s section"), + bfd_get_filename (input_bfd), howto->name, + outrel.r_addend, + bfd_get_section_name (input_bfd, input_section)); + } + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + + /* This reloc will be computed at runtime, so there's no + need to do anything now, except for R_VAX_32 + relocations that have been turned into + R_VAX_RELATIVE. */ + if (!relocate) + continue; + } + + break; + + case R_VAX_GNU_VTINHERIT: + case R_VAX_GNU_VTENTRY: + /* These are no-ops in the end. */ + continue; + + default: + break; + } + + /* VAX PCREL relocations are from the end of relocation, not the start. + So subtract the difference from the relocation amount since we can't + add it to the offset. */ + if (howto->pc_relative && howto->pcrel_offset) + relocation -= bfd_get_reloc_size(howto); + + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + + if (r != bfd_reloc_ok) + { + switch (r) + { + default: + case bfd_reloc_outofrange: + abort (); + case bfd_reloc_overflow: + { + const char *name; + + if (h != NULL) + name = h->root.root.string; + else + { + name = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name); + if (name == NULL) + return FALSE; + if (*name == '\0') + name = bfd_section_name (input_bfd, sec); + } + if (!(info->callbacks->reloc_overflow + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return FALSE; + } + break; + } + } + } + + return TRUE; +} + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +static bfd_boolean +elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym) + bfd *output_bfd; + struct bfd_link_info *info; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + bfd *dynobj; + + dynobj = elf_hash_table (info)->dynobj; + + if (h->plt.offset != (bfd_vma) -1) + { + asection *splt; + asection *sgot; + asection *srela; + bfd_vma plt_index; + bfd_vma got_offset; + bfd_vma addend; + Elf_Internal_Rela rela; + bfd_byte *loc; + + /* This symbol has an entry in the procedure linkage table. Set + it up. */ + BFD_ASSERT (h->dynindx != -1); + + splt = bfd_get_section_by_name (dynobj, ".plt"); + sgot = bfd_get_section_by_name (dynobj, ".got.plt"); + srela = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL); + + addend = 2 * (h->plt.offset & 1); + h->plt.offset &= ~1; + + /* Get the index in the procedure linkage table which + corresponds to this symbol. This is the index of this symbol + in all the symbols for which we are making plt entries. The + first entry in the procedure linkage table is reserved. */ + plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; + + /* Get the offset into the .got table of the entry that + corresponds to this function. Each .got entry is 4 bytes. + The first two are reserved. */ + got_offset = (plt_index + 3) * 4; + + /* Fill in the entry in the procedure linkage table. */ + memcpy (splt->contents + h->plt.offset, elf_vax_plt_entry, + PLT_ENTRY_SIZE); + + /* The offset is relative to the first extension word. */ + bfd_put_32 (output_bfd, + -(h->plt.offset + 8), + splt->contents + h->plt.offset + 4); + + bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), + splt->contents + h->plt.offset + 8); + + /* Fill in the entry in the global offset table. */ + bfd_put_32 (output_bfd, + (splt->output_section->vma + + splt->output_offset + + h->plt.offset) + addend, + sgot->contents + got_offset); + + /* Fill in the entry in the .rela.plt section. */ + rela.r_offset = (sgot->output_section->vma + + sgot->output_offset + + got_offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_JMP_SLOT); + rela.r_addend = addend; + loc = srela->contents + plt_index * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + } + } + + if (h->got.offset != (bfd_vma) -1) + { + asection *sgot; + asection *srela; + Elf_Internal_Rela rela; + bfd_byte *loc; + + /* This symbol has an entry in the global offset table. Set it + up. */ + sgot = bfd_get_section_by_name (dynobj, ".got"); + srela = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (sgot != NULL && srela != NULL); + + rela.r_offset = (sgot->output_section->vma + + sgot->output_offset + + (h->got.offset &~ 1)); + + /* If the symbol was forced to be local because of a version file + locally we just want to emit a RELATIVE reloc. The entry in + the global offset table will already have been initialized in + the relocate_section function. */ + if (info->shared + && h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + { + rela.r_info = ELF32_R_INFO (0, R_VAX_RELATIVE); + } + else + { + rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_GLOB_DAT); + } + rela.r_addend = bfd_get_signed_32 (output_bfd, + (sgot->contents + + (h->got.offset & ~1))); + + loc = srela->contents; + loc += srela->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + } + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + { + asection *s; + Elf_Internal_Rela rela; + bfd_byte *loc; + + /* This symbol needs a copy reloc. Set it up. */ + BFD_ASSERT (h->dynindx != -1 + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)); + + s = bfd_get_section_by_name (h->root.u.def.section->owner, + ".rela.bss"); + BFD_ASSERT (s != NULL); + + rela.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_COPY); + rela.r_addend = 0; + loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + } + + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + sym->st_shndx = SHN_ABS; + + return TRUE; +} + +/* Finish up the dynamic sections. */ + +static bfd_boolean +elf_vax_finish_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *sgot; + asection *sdyn; + + dynobj = elf_hash_table (info)->dynobj; + + sgot = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (sgot != NULL); + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (elf_hash_table (info)->dynamic_sections_created) + { + asection *splt; + Elf32_External_Dyn *dyncon, *dynconend; + + splt = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (splt != NULL && sdyn != NULL); + + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + const char *name; + asection *s; + + bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + break; + + case DT_PLTGOT: + name = ".got"; + goto get_vma; + case DT_JMPREL: + name = ".rela.plt"; + get_vma: + s = bfd_get_section_by_name (output_bfd, name); + BFD_ASSERT (s != NULL); + dyn.d_un.d_ptr = s->vma; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_PLTRELSZ: + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + BFD_ASSERT (s != NULL); + if (s->_cooked_size != 0) + dyn.d_un.d_val = s->_cooked_size; + else + dyn.d_un.d_val = s->_raw_size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_RELASZ: + /* The procedure linkage table relocs (DT_JMPREL) should + not be included in the overall relocs (DT_RELA). + Therefore, we override the DT_RELASZ entry here to + make it not include the JMPREL relocs. Since the + linker script arranges for .rela.plt to follow all + other relocation sections, we don't have to worry + about changing the DT_RELA entry. */ + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + if (s != NULL) + { + if (s->_cooked_size != 0) + dyn.d_un.d_val -= s->_cooked_size; + else + dyn.d_un.d_val -= s->_raw_size; + } + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + } + } + + /* Fill in the first entry in the procedure linkage table. */ + if (splt->_raw_size > 0) + { + memcpy (splt->contents, elf_vax_plt0_entry, PLT_ENTRY_SIZE); + bfd_put_32 (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + 4 + - (splt->output_section->vma + 6)), + splt->contents + 2); + bfd_put_32 (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + 8 + - (splt->output_section->vma + 12)), + splt->contents + 8); + elf_section_data (splt->output_section)->this_hdr.sh_entsize + = PLT_ENTRY_SIZE; + } + } + + /* Fill in the first three entries in the global offset table. */ + if (sgot->_raw_size > 0) + { + if (sdyn == NULL) + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + else + bfd_put_32 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + sgot->contents); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + } + + elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; + + return TRUE; +} + +#define TARGET_LITTLE_SYM bfd_elf32_vax_vec +#define TARGET_LITTLE_NAME "elf32-vax" +#define ELF_MACHINE_CODE EM_VAX +#define ELF_MAXPAGESIZE 0x1000 + +#define elf_backend_create_dynamic_sections \ + _bfd_elf_create_dynamic_sections +#define bfd_elf32_bfd_link_hash_table_create \ + elf_vax_link_hash_table_create +#define bfd_elf32_bfd_final_link bfd_elf_gc_common_final_link + +#define elf_backend_check_relocs elf_vax_check_relocs +#define elf_backend_adjust_dynamic_symbol \ + elf_vax_adjust_dynamic_symbol +#define elf_backend_size_dynamic_sections \ + elf_vax_size_dynamic_sections +#define elf_backend_relocate_section elf_vax_relocate_section +#define elf_backend_finish_dynamic_symbol \ + elf_vax_finish_dynamic_symbol +#define elf_backend_finish_dynamic_sections \ + elf_vax_finish_dynamic_sections +#define elf_backend_gc_mark_hook elf_vax_gc_mark_hook +#define elf_backend_gc_sweep_hook elf_vax_gc_sweep_hook +#define bfd_elf32_bfd_merge_private_bfd_data \ + elf32_vax_merge_private_bfd_data +#define bfd_elf32_bfd_set_private_flags \ + elf32_vax_set_private_flags +#define bfd_elf32_bfd_print_private_bfd_data \ + elf32_vax_print_private_bfd_data + +#define elf_backend_can_gc_sections 1 +#define elf_backend_want_got_plt 1 +#define elf_backend_plt_readonly 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_got_header_size 16 +#define elf_backend_rela_normal 1 + +#include "elf32-target.h" diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c new file mode 100644 index 0000000000000..bbf6ee014873f --- /dev/null +++ b/bfd/elf32-xstormy16.c @@ -0,0 +1,1086 @@ +/* XSTORMY16-specific support for 32-bit ELF. + Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/xstormy16.h" +#include "libiberty.h" + +/* Forward declarations. */ +static reloc_howto_type * xstormy16_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void xstormy16_info_to_howto_rela + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static bfd_reloc_status_type xstormy16_elf_24_reloc + PARAMS ((bfd *abfd, arelent *reloc_entry, asymbol *symbol, + PTR data, asection *input_section, bfd *output_bfd, + char **error_message)); +static bfd_boolean xstormy16_elf_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static bfd_boolean xstormy16_relax_plt_check + PARAMS ((struct elf_link_hash_entry *, PTR)); +static bfd_boolean xstormy16_relax_plt_realloc + PARAMS ((struct elf_link_hash_entry *, PTR)); +static bfd_boolean xstormy16_elf_relax_section + PARAMS ((bfd *abfd, asection *sec, struct bfd_link_info *link_info, + bfd_boolean *again)); +static bfd_boolean xstormy16_elf_always_size_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean xstormy16_elf_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static bfd_boolean xstormy16_elf_finish_dynamic_sections + PARAMS((bfd *, struct bfd_link_info *)); +static bfd_boolean xstormy16_elf_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static asection * xstormy16_elf_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); + +static reloc_howto_type xstormy16_elf_howto_table [] = +{ + /* This reloc does nothing. */ + HOWTO (R_XSTORMY16_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XSTORMY16_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit absolute relocation. */ + HOWTO (R_XSTORMY16_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XSTORMY16_32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 16 bit absolute relocation. */ + HOWTO (R_XSTORMY16_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XSTORMY16_16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 8 bit absolute relocation. */ + HOWTO (R_XSTORMY16_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XSTORMY16_8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit pc-relative relocation. */ + HOWTO (R_XSTORMY16_PC32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XSTORMY16_PC32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 16 bit pc-relative relocation. */ + HOWTO (R_XSTORMY16_PC16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XSTORMY16_PC16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* An 8 bit pc-relative relocation. */ + HOWTO (R_XSTORMY16_PC8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XSTORMY16_PC8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 12-bit pc-relative relocation suitable for the branch instructions. */ + HOWTO (R_XSTORMY16_REL_12, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 11, /* bitsize */ + TRUE, /* pc_relative */ + 1, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XSTORMY16_REL_12", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x0ffe, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 24-bit absolute relocation suitable for the jump instructions. */ + HOWTO (R_XSTORMY16_24, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + xstormy16_elf_24_reloc, /* special_function */ + "R_XSTORMY16_24", /* name */ + TRUE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff00ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 16 bit absolute relocation to a function pointer. */ + HOWTO (R_XSTORMY16_FPTR16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XSTORMY16_FPTR16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Low order 16 bit value of a high memory address. */ + HOWTO (R_XSTORMY16_LO16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XSTORMY16_LO16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* High order 16 bit value of a high memory address. */ + HOWTO (R_XSTORMY16_HI16, /* type */ + 16, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XSTORMY16_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 12 bit absolute relocation. */ + HOWTO (R_XSTORMY16_12, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_XSTORMY16_12", /* name */ + FALSE, /* partial_inplace */ + 0x0000, /* src_mask */ + 0x0fff, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; + +static reloc_howto_type xstormy16_elf_howto_table2 [] = +{ + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_XSTORMY16_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_XSTORMY16_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_XSTORMY16_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_XSTORMY16_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + +}; + +/* Map BFD reloc types to XSTORMY16 ELF reloc types. */ + +typedef struct xstormy16_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned int xstormy16_reloc_val; + reloc_howto_type * table; +} reloc_map; + +static const reloc_map xstormy16_reloc_map [] = +{ + { BFD_RELOC_NONE, R_XSTORMY16_NONE, xstormy16_elf_howto_table }, + { BFD_RELOC_32, R_XSTORMY16_32, xstormy16_elf_howto_table }, + { BFD_RELOC_16, R_XSTORMY16_16, xstormy16_elf_howto_table }, + { BFD_RELOC_8, R_XSTORMY16_8, xstormy16_elf_howto_table }, + { BFD_RELOC_32_PCREL, R_XSTORMY16_PC32, xstormy16_elf_howto_table }, + { BFD_RELOC_16_PCREL, R_XSTORMY16_PC16, xstormy16_elf_howto_table }, + { BFD_RELOC_8_PCREL, R_XSTORMY16_PC8, xstormy16_elf_howto_table }, + { BFD_RELOC_XSTORMY16_REL_12, R_XSTORMY16_REL_12, xstormy16_elf_howto_table }, + { BFD_RELOC_XSTORMY16_24, R_XSTORMY16_24, xstormy16_elf_howto_table }, + { BFD_RELOC_XSTORMY16_FPTR16, R_XSTORMY16_FPTR16, xstormy16_elf_howto_table }, + { BFD_RELOC_LO16, R_XSTORMY16_LO16, xstormy16_elf_howto_table }, + { BFD_RELOC_HI16, R_XSTORMY16_HI16, xstormy16_elf_howto_table }, + { BFD_RELOC_XSTORMY16_12, R_XSTORMY16_12, xstormy16_elf_howto_table }, + { BFD_RELOC_VTABLE_INHERIT, R_XSTORMY16_GNU_VTINHERIT, xstormy16_elf_howto_table2 }, + { BFD_RELOC_VTABLE_ENTRY, R_XSTORMY16_GNU_VTENTRY, xstormy16_elf_howto_table2 }, +}; + +static reloc_howto_type * +xstormy16_reloc_type_lookup (abfd, code) + bfd * abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = ARRAY_SIZE (xstormy16_reloc_map); --i;) + { + const reloc_map * entry; + + entry = xstormy16_reloc_map + i; + + if (entry->bfd_reloc_val == code) + return entry->table + (entry->xstormy16_reloc_val + - entry->table[0].type); + } + + return NULL; +} + +/* Set the howto pointer for an XSTORMY16 ELF reloc. */ + +static void +xstormy16_info_to_howto_rela (abfd, cache_ptr, dst) + bfd * abfd ATTRIBUTE_UNUSED; + arelent * cache_ptr; + Elf_Internal_Rela * dst; +{ + unsigned int r_type = ELF32_R_TYPE (dst->r_info); + + if (r_type <= (unsigned int) R_XSTORMY16_12) + cache_ptr->howto = &xstormy16_elf_howto_table [r_type]; + else if (r_type - R_XSTORMY16_GNU_VTINHERIT + <= (unsigned int) R_XSTORMY16_GNU_VTENTRY) + cache_ptr->howto + = &xstormy16_elf_howto_table2 [r_type - R_XSTORMY16_GNU_VTINHERIT]; + else + abort (); +} + +/* Handle the R_XSTORMY16_24 reloc, which has an odd bit arrangement. */ + +static bfd_reloc_status_type +xstormy16_elf_24_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + bfd_vma relocation, x; + + if (output_bfd != NULL) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + + x = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); + x &= 0x0000ff00; + x |= relocation & 0xff; + x |= (relocation << 8) & 0xffff0000; + bfd_put_32 (abfd, x, (bfd_byte *) data + reloc_entry->address); + + if (relocation & ~ (bfd_vma) 0xffffff) + return bfd_reloc_overflow; + + return bfd_reloc_ok; +} + +/* We support 16-bit pointers to code above 64k by generating a thunk + below 64k containing a JMPF instruction to the final address. We + cannot, unfortunately, minimize the number of thunks unless the + -relax switch is given, as otherwise we have no idea where the + sections will fall in the address space. */ + +static bfd_boolean +xstormy16_elf_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + const Elf_Internal_Rela *rel, *relend; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Shdr *symtab_hdr; + bfd_vma *local_plt_offsets; + asection *splt; + bfd *dynobj; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata(abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + local_plt_offsets = elf_local_got_offsets (abfd); + splt = NULL; + dynobj = elf_hash_table(info)->dynobj; + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; ++rel) + { + unsigned long r_symndx; + struct elf_link_hash_entry *h; + bfd_vma *offset; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } + + switch (ELF32_R_TYPE (rel->r_info)) + { + /* This relocation describes a 16-bit pointer to a function. + We may need to allocate a thunk in low memory; reserve memory + for it now. */ + case R_XSTORMY16_FPTR16: + if (rel->r_addend != 0) + { + (*info->callbacks->warning) + (info, _("non-zero addend in @fptr reloc"), 0, + abfd, 0, 0); + } + + if (dynobj == NULL) + elf_hash_table (info)->dynobj = dynobj = abfd; + if (splt == NULL) + { + splt = bfd_get_section_by_name (dynobj, ".plt"); + if (splt == NULL) + { + splt = bfd_make_section (dynobj, ".plt"); + if (splt == NULL + || ! bfd_set_section_flags (dynobj, splt, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY + | SEC_CODE)) + || ! bfd_set_section_alignment (dynobj, splt, 1)) + return FALSE; + } + } + + if (h != NULL) + offset = &h->plt.offset; + else + { + if (local_plt_offsets == NULL) + { + size_t size; + unsigned int i; + + size = symtab_hdr->sh_info * sizeof (bfd_vma); + local_plt_offsets = (bfd_vma *) bfd_alloc (abfd, size); + if (local_plt_offsets == NULL) + return FALSE; + elf_local_got_offsets (abfd) = local_plt_offsets; + + for (i = 0; i < symtab_hdr->sh_info; i++) + local_plt_offsets[i] = (bfd_vma) -1; + } + offset = &local_plt_offsets[r_symndx]; + } + + if (*offset == (bfd_vma) -1) + { + *offset = splt->_raw_size; + splt->_raw_size += 4; + } + break; + + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_XSTORMY16_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_XSTORMY16_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + } + } + + return TRUE; +} + +/* A subroutine of xstormy16_elf_relax_section. If the global symbol H + is within the low 64k, remove any entry for it in the plt. */ + +struct relax_plt_data +{ + asection *splt; + bfd_boolean *again; +}; + +static bfd_boolean +xstormy16_relax_plt_check (h, xdata) + struct elf_link_hash_entry *h; + PTR xdata; +{ + struct relax_plt_data *data = (struct relax_plt_data *) xdata; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->plt.offset != (bfd_vma) -1) + { + bfd_vma address; + + if (h->root.type == bfd_link_hash_undefined + || h->root.type == bfd_link_hash_undefweak) + address = 0; + else + address = (h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset + + h->root.u.def.value); + + if (address <= 0xffff) + { + h->plt.offset = -1; + data->splt->_cooked_size -= 4; + *data->again = TRUE; + } + } + + return TRUE; +} + +/* A subroutine of xstormy16_elf_relax_section. If the global symbol H + previously had a plt entry, give it a new entry offset. */ + +static bfd_boolean +xstormy16_relax_plt_realloc (h, xdata) + struct elf_link_hash_entry *h; + PTR xdata; +{ + bfd_vma *entry = (bfd_vma *) xdata; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->plt.offset != (bfd_vma) -1) + { + h->plt.offset = *entry; + *entry += 4; + } + + return TRUE; +} + +static bfd_boolean +xstormy16_elf_relax_section (dynobj, splt, info, again) + bfd *dynobj; + asection *splt; + struct bfd_link_info *info; + bfd_boolean *again; +{ + struct relax_plt_data relax_plt_data; + bfd *ibfd; + + /* Assume nothing changes. */ + *again = FALSE; + + if (info->relocatable) + return TRUE; + + /* We only relax the .plt section at the moment. */ + if (dynobj != elf_hash_table (info)->dynobj + || strcmp (splt->name, ".plt") != 0) + return TRUE; + + /* Quick check for an empty plt. */ + if (splt->_raw_size == 0) + return TRUE; + + /* If this is the first time we have been called for this section, + initialize the cooked size. */ + if (splt->_cooked_size == 0) + splt->_cooked_size = splt->_raw_size; + + /* Map across all global symbols; see which ones happen to + fall in the low 64k. */ + relax_plt_data.splt = splt; + relax_plt_data.again = again; + elf_link_hash_traverse (elf_hash_table (info), xstormy16_relax_plt_check, + &relax_plt_data); + + /* Likewise for local symbols, though that's somewhat less convenient + as we have to walk the list of input bfds and swap in symbol data. */ + for (ibfd = info->input_bfds; ibfd ; ibfd = ibfd->link_next) + { + bfd_vma *local_plt_offsets = elf_local_got_offsets (ibfd); + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Sym *isymbuf = NULL; + unsigned int idx; + + if (! local_plt_offsets) + continue; + + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + if (symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (ibfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + return FALSE; + } + + for (idx = 0; idx < symtab_hdr->sh_info; ++idx) + { + Elf_Internal_Sym *isym; + asection *tsec; + bfd_vma address; + + if (local_plt_offsets[idx] == (bfd_vma) -1) + continue; + + isym = &isymbuf[idx]; + if (isym->st_shndx == SHN_UNDEF) + continue; + else if (isym->st_shndx == SHN_ABS) + tsec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + tsec = bfd_com_section_ptr; + else + tsec = bfd_section_from_elf_index (ibfd, isym->st_shndx); + + address = (tsec->output_section->vma + + tsec->output_offset + + isym->st_value); + if (address <= 0xffff) + { + local_plt_offsets[idx] = -1; + splt->_cooked_size -= 4; + *again = TRUE; + } + } + + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + { + if (! info->keep_memory) + free (isymbuf); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) isymbuf; + } + } + } + + /* If we changed anything, walk the symbols again to reallocate + .plt entry addresses. */ + if (*again && splt->_cooked_size > 0) + { + bfd_vma entry = 0; + + elf_link_hash_traverse (elf_hash_table (info), + xstormy16_relax_plt_realloc, &entry); + + for (ibfd = info->input_bfds; ibfd ; ibfd = ibfd->link_next) + { + bfd_vma *local_plt_offsets = elf_local_got_offsets (ibfd); + unsigned int nlocals = elf_tdata (ibfd)->symtab_hdr.sh_info; + unsigned int idx; + + if (! local_plt_offsets) + continue; + + for (idx = 0; idx < nlocals; ++idx) + if (local_plt_offsets[idx] != (bfd_vma) -1) + { + local_plt_offsets[idx] = entry; + entry += 4; + } + } + } + + splt->_raw_size = splt->_cooked_size; + return TRUE; +} + +static bfd_boolean +xstormy16_elf_always_size_sections (output_bfd, info) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *splt; + + if (info->relocatable) + return TRUE; + + dynobj = elf_hash_table (info)->dynobj; + if (dynobj == NULL) + return TRUE; + + splt = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (splt != NULL); + + splt->contents = (bfd_byte *) bfd_zalloc (dynobj, splt->_raw_size); + if (splt->contents == NULL) + return FALSE; + + return TRUE; +} + +/* Relocate an XSTORMY16 ELF section. + + The RELOCATE_SECTION function is called by the new ELF backend linker + to handle the relocations for a section. + + The relocs are always passed as Rela structures; if the section + actually uses Rel structures, the r_addend field will always be + zero. + + This function is responsible for adjusting the section contents as + necessary, and (if using Rela relocs and generating a relocatable + output file) adjusting the reloc addend as necessary. + + This function does not have to worry about setting the reloc + address or the reloc symbol index. + + LOCAL_SYMS is a pointer to the swapped in local symbols. + + LOCAL_SECTIONS is an array giving the section in the input file + corresponding to the st_shndx field of each local symbol. + + The global hash table entry for the global symbols can be found + via elf_sym_hashes (input_bfd). + + When generating relocatable output, this function must handle + STB_LOCAL/STT_SECTION symbols specially. The output symbol is + going to be the section symbol corresponding to the output + section, which means that the addend must be adjusted + accordingly. */ + +static bfd_boolean +xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd * output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info * info; + bfd * input_bfd; + asection * input_section; + bfd_byte * contents; + Elf_Internal_Rela * relocs; + Elf_Internal_Sym * local_syms; + asection ** local_sections; +{ + Elf_Internal_Shdr * symtab_hdr; + struct elf_link_hash_entry ** sym_hashes; + Elf_Internal_Rela * rel; + Elf_Internal_Rela * relend; + bfd *dynobj; + asection *splt; + + if (info->relocatable) + return TRUE; + + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + relend = relocs + input_section->reloc_count; + + dynobj = elf_hash_table (info)->dynobj; + splt = NULL; + if (dynobj != NULL) + splt = bfd_get_section_by_name (dynobj, ".plt"); + + for (rel = relocs; rel < relend; rel ++) + { + reloc_howto_type * howto; + unsigned long r_symndx; + Elf_Internal_Sym * sym; + asection * sec; + struct elf_link_hash_entry * h; + bfd_vma relocation; + bfd_reloc_status_type r; + const char * name = NULL; + int r_type; + + r_type = ELF32_R_TYPE (rel->r_info); + + if ( r_type == R_XSTORMY16_GNU_VTINHERIT + || r_type == R_XSTORMY16_GNU_VTENTRY) + continue; + + r_symndx = ELF32_R_SYM (rel->r_info); + howto = xstormy16_elf_howto_table + ELF32_R_TYPE (rel->r_info); + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); + name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + } + else + { + bfd_boolean unresolved_reloc, warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + } + + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_XSTORMY16_24: + { + bfd_vma reloc = relocation + rel->r_addend; + unsigned int x; + + x = bfd_get_32 (input_bfd, contents + rel->r_offset); + x &= 0x0000ff00; + x |= reloc & 0xff; + x |= (reloc << 8) & 0xffff0000; + bfd_put_32 (input_bfd, x, contents + rel->r_offset); + + if (reloc & ~0xffffff) + r = bfd_reloc_overflow; + else + r = bfd_reloc_ok; + break; + } + + case R_XSTORMY16_FPTR16: + { + bfd_vma *plt_offset; + + if (h != NULL) + plt_offset = &h->plt.offset; + else + plt_offset = elf_local_got_offsets (input_bfd) + r_symndx; + + if (relocation <= 0xffff) + { + /* If the symbol is in range for a 16-bit address, we should + have deallocated the plt entry in relax_section. */ + BFD_ASSERT (*plt_offset == (bfd_vma) -1); + } + else + { + /* If the symbol is out of range for a 16-bit address, + we must have allocated a plt entry. */ + BFD_ASSERT (*plt_offset != (bfd_vma) -1); + + /* If this is the first time we've processed this symbol, + fill in the plt entry with the correct symbol address. */ + if ((*plt_offset & 1) == 0) + { + unsigned int x; + + x = 0x00000200; /* jmpf */ + x |= relocation & 0xff; + x |= (relocation << 8) & 0xffff0000; + bfd_put_32 (input_bfd, x, splt->contents + *plt_offset); + *plt_offset |= 1; + } + + relocation = (splt->output_section->vma + + splt->output_offset + + (*plt_offset & -2)); + } + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, 0); + break; + } + + default: + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + break; + } + + if (r != bfd_reloc_ok) + { + const char * msg = (const char *) NULL; + + switch (r) + { + case bfd_reloc_overflow: + r = info->callbacks->reloc_overflow + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset); + break; + + case bfd_reloc_undefined: + r = info->callbacks->undefined_symbol + (info, name, input_bfd, input_section, rel->r_offset, + TRUE); + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + break; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + break; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous relocation"); + break; + + default: + msg = _("internal error: unknown error"); + break; + } + + if (msg) + r = info->callbacks->warning + (info, msg, name, input_bfd, input_section, rel->r_offset); + + if (! r) + return FALSE; + } + } + + return TRUE; +} + +/* This must exist if dynobj is ever set. */ + +static bfd_boolean +xstormy16_elf_finish_dynamic_sections (abfd, info) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *splt; + + /* As an extra sanity check, verify that all plt entries have + been filled in. */ + + if ((dynobj = elf_hash_table (info)->dynobj) != NULL + && (splt = bfd_get_section_by_name (dynobj, ".plt")) != NULL) + { + bfd_byte *contents = splt->contents; + unsigned int i, size = splt->_raw_size; + for (i = 0; i < size; i += 4) + { + unsigned int x = bfd_get_32 (dynobj, contents + i); + BFD_ASSERT (x != 0); + } + } + + return TRUE; +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +xstormy16_elf_gc_mark_hook (sec, info, rel, h, sym) + asection * sec; + struct bfd_link_info * info ATTRIBUTE_UNUSED; + Elf_Internal_Rela * rel; + struct elf_link_hash_entry * h; + Elf_Internal_Sym * sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_XSTORMY16_GNU_VTINHERIT: + case R_XSTORMY16_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the got entry reference counts for the section being removed. */ + +static bfd_boolean +xstormy16_elf_gc_sweep_hook (abfd, info, sec, relocs) + bfd * abfd ATTRIBUTE_UNUSED; + struct bfd_link_info * info ATTRIBUTE_UNUSED; + asection * sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED; +{ + return TRUE; +} + +#define ELF_ARCH bfd_arch_xstormy16 +#define ELF_MACHINE_CODE EM_XSTORMY16 +#define ELF_MAXPAGESIZE 0x100 + +#define TARGET_LITTLE_SYM bfd_elf32_xstormy16_vec +#define TARGET_LITTLE_NAME "elf32-xstormy16" + +#define elf_info_to_howto_rel NULL +#define elf_info_to_howto xstormy16_info_to_howto_rela +#define elf_backend_relocate_section xstormy16_elf_relocate_section +#define elf_backend_gc_mark_hook xstormy16_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook xstormy16_elf_gc_sweep_hook +#define elf_backend_check_relocs xstormy16_elf_check_relocs +#define elf_backend_always_size_sections \ + xstormy16_elf_always_size_sections +#define elf_backend_finish_dynamic_sections \ + xstormy16_elf_finish_dynamic_sections + +#define elf_backend_can_gc_sections 1 +#define elf_backend_rela_normal 1 + +#define bfd_elf32_bfd_reloc_type_lookup xstormy16_reloc_type_lookup +#define bfd_elf32_bfd_relax_section xstormy16_elf_relax_section + +#include "elf32-target.h" diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c new file mode 100644 index 0000000000000..710a1a6c2810d --- /dev/null +++ b/bfd/elf32-xtensa.c @@ -0,0 +1,5864 @@ +/* Xtensa-specific support for 32-bit ELF. + Copyright 2003, 2004 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" + +#ifdef ANSI_PROTOTYPES +#include +#else +#include +#endif +#include + +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/xtensa.h" +#include "xtensa-isa.h" +#include "xtensa-config.h" + +/* Main interface functions. */ +static void elf_xtensa_info_to_howto_rela + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +static reloc_howto_type *elf_xtensa_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +extern int xtensa_read_table_entries + PARAMS ((bfd *, asection *, property_table_entry **, const char *)); +static bfd_boolean elf_xtensa_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static void elf_xtensa_hide_symbol + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean)); +static asection *elf_xtensa_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static bfd_boolean elf_xtensa_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); +static bfd_boolean elf_xtensa_create_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean elf_xtensa_adjust_dynamic_symbol + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); +static bfd_boolean elf_xtensa_size_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean elf_xtensa_modify_segment_map + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean elf_xtensa_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); +static bfd_boolean elf_xtensa_relax_section + PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *again)); +static bfd_boolean elf_xtensa_finish_dynamic_symbol + PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *)); +static bfd_boolean elf_xtensa_finish_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean elf_xtensa_merge_private_bfd_data + PARAMS ((bfd *, bfd *)); +static bfd_boolean elf_xtensa_set_private_flags + PARAMS ((bfd *, flagword)); +extern flagword elf_xtensa_get_private_bfd_flags + PARAMS ((bfd *)); +static bfd_boolean elf_xtensa_print_private_bfd_data + PARAMS ((bfd *, PTR)); +static bfd_boolean elf_xtensa_object_p + PARAMS ((bfd *)); +static void elf_xtensa_final_write_processing + PARAMS ((bfd *, bfd_boolean)); +static enum elf_reloc_type_class elf_xtensa_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); +static bfd_boolean elf_xtensa_discard_info + PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *)); +static bfd_boolean elf_xtensa_ignore_discarded_relocs + PARAMS ((asection *)); +static bfd_boolean elf_xtensa_grok_prstatus + PARAMS ((bfd *, Elf_Internal_Note *)); +static bfd_boolean elf_xtensa_grok_psinfo + PARAMS ((bfd *, Elf_Internal_Note *)); +static bfd_boolean elf_xtensa_new_section_hook + PARAMS ((bfd *, asection *)); + + +/* Local helper functions. */ + +static bfd_boolean xtensa_elf_dynamic_symbol_p + PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *)); +static int property_table_compare + PARAMS ((const PTR, const PTR)); +static bfd_boolean elf_xtensa_in_literal_pool + PARAMS ((property_table_entry *, int, bfd_vma)); +static void elf_xtensa_make_sym_local + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); +static bfd_boolean add_extra_plt_sections + PARAMS ((bfd *, int)); +static bfd_boolean elf_xtensa_fix_refcounts + PARAMS ((struct elf_link_hash_entry *, PTR)); +static bfd_boolean elf_xtensa_allocate_plt_size + PARAMS ((struct elf_link_hash_entry *, PTR)); +static bfd_boolean elf_xtensa_allocate_got_size + PARAMS ((struct elf_link_hash_entry *, PTR)); +static void elf_xtensa_allocate_local_got_size + PARAMS ((struct bfd_link_info *, asection *)); +static bfd_reloc_status_type elf_xtensa_do_reloc + PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_vma, bfd_byte *, + bfd_vma, bfd_boolean, char **)); +static char * vsprint_msg + VPARAMS ((const char *, const char *, int, ...)); +static char *build_encoding_error_message + PARAMS ((xtensa_opcode, xtensa_encode_result)); +static bfd_reloc_status_type bfd_elf_xtensa_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static void do_fix_for_relocatable_link + PARAMS ((Elf_Internal_Rela *, bfd *, asection *)); +static void do_fix_for_final_link + PARAMS ((Elf_Internal_Rela *, asection *, bfd_vma *)); +static bfd_vma elf_xtensa_create_plt_entry + PARAMS ((bfd *, bfd *, unsigned)); +static int elf_xtensa_combine_prop_entries + PARAMS ((bfd *, asection *, asection *)); +static bfd_boolean elf_xtensa_discard_info_for_section + PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *, + asection *)); + +/* Local functions to handle Xtensa configurability. */ + +static void init_call_opcodes + PARAMS ((void)); +static bfd_boolean is_indirect_call_opcode + PARAMS ((xtensa_opcode)); +static bfd_boolean is_direct_call_opcode + PARAMS ((xtensa_opcode)); +static bfd_boolean is_windowed_call_opcode + PARAMS ((xtensa_opcode)); +static xtensa_opcode get_l32r_opcode + PARAMS ((void)); +static bfd_vma l32r_offset + PARAMS ((bfd_vma, bfd_vma)); +static int get_relocation_opnd + PARAMS ((Elf_Internal_Rela *)); +static xtensa_opcode get_relocation_opcode + PARAMS ((asection *, bfd_byte *, Elf_Internal_Rela *)); +static bfd_boolean is_l32r_relocation + PARAMS ((asection *, bfd_byte *, Elf_Internal_Rela *)); + +/* Functions for link-time code simplifications. */ + +static bfd_reloc_status_type elf_xtensa_do_asm_simplify + PARAMS ((bfd_byte *, bfd_vma, bfd_vma)); +static bfd_reloc_status_type contract_asm_expansion + PARAMS ((bfd_byte *, bfd_vma, Elf_Internal_Rela *)); +static xtensa_opcode swap_callx_for_call_opcode + PARAMS ((xtensa_opcode)); +static xtensa_opcode get_expanded_call_opcode + PARAMS ((bfd_byte *, int)); + +/* Access to internal relocations, section contents and symbols. */ + +static Elf_Internal_Rela *retrieve_internal_relocs + PARAMS ((bfd *, asection *, bfd_boolean)); +static void pin_internal_relocs + PARAMS ((asection *, Elf_Internal_Rela *)); +static void release_internal_relocs + PARAMS ((asection *, Elf_Internal_Rela *)); +static bfd_byte *retrieve_contents + PARAMS ((bfd *, asection *, bfd_boolean)); +static void pin_contents + PARAMS ((asection *, bfd_byte *)); +static void release_contents + PARAMS ((asection *, bfd_byte *)); +static Elf_Internal_Sym *retrieve_local_syms + PARAMS ((bfd *)); + +/* Miscellaneous utility functions. */ + +static asection *elf_xtensa_get_plt_section + PARAMS ((bfd *, int)); +static asection *elf_xtensa_get_gotplt_section + PARAMS ((bfd *, int)); +static asection *get_elf_r_symndx_section + PARAMS ((bfd *, unsigned long)); +static struct elf_link_hash_entry *get_elf_r_symndx_hash_entry + PARAMS ((bfd *, unsigned long)); +static bfd_vma get_elf_r_symndx_offset + PARAMS ((bfd *, unsigned long)); +static bfd_boolean pcrel_reloc_fits + PARAMS ((xtensa_operand, bfd_vma, bfd_vma)); +static bfd_boolean xtensa_is_property_section + PARAMS ((asection *)); +static bfd_boolean xtensa_is_littable_section + PARAMS ((asection *)); +static bfd_boolean is_literal_section + PARAMS ((asection *)); +static int internal_reloc_compare + PARAMS ((const PTR, const PTR)); +extern char *xtensa_get_property_section_name + PARAMS ((asection *, const char *)); + +/* Other functions called directly by the linker. */ + +typedef void (*deps_callback_t) + PARAMS ((asection *, bfd_vma, asection *, bfd_vma, PTR)); +extern bfd_boolean xtensa_callback_required_dependence + PARAMS ((bfd *, asection *, struct bfd_link_info *, + deps_callback_t, PTR)); + + +typedef struct xtensa_relax_info_struct xtensa_relax_info; + + +/* Total count of PLT relocations seen during check_relocs. + The actual PLT code must be split into multiple sections and all + the sections have to be created before size_dynamic_sections, + where we figure out the exact number of PLT entries that will be + needed. It is OK if this count is an overestimate, e.g., some + relocations may be removed by GC. */ + +static int plt_reloc_count = 0; + + +/* When this is true, relocations may have been modified to refer to + symbols from other input files. The per-section list of "fix" + records needs to be checked when resolving relocations. */ + +static bfd_boolean relaxing_section = FALSE; + + +static reloc_howto_type elf_howto_table[] = +{ + HOWTO (R_XTENSA_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_xtensa_reloc, "R_XTENSA_NONE", + FALSE, 0x00000000, 0x00000000, FALSE), + HOWTO (R_XTENSA_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, + bfd_elf_xtensa_reloc, "R_XTENSA_32", + TRUE, 0xffffffff, 0xffffffff, FALSE), + /* Replace a 32-bit value with a value from the runtime linker (only + used by linker-generated stub functions). The r_addend value is + special: 1 means to substitute a pointer to the runtime linker's + dynamic resolver function; 2 means to substitute the link map for + the shared object. */ + HOWTO (R_XTENSA_RTLD, 0, 2, 32, FALSE, 0, complain_overflow_dont, + NULL, "R_XTENSA_RTLD", + FALSE, 0x00000000, 0x00000000, FALSE), + HOWTO (R_XTENSA_GLOB_DAT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_XTENSA_GLOB_DAT", + FALSE, 0xffffffff, 0xffffffff, FALSE), + HOWTO (R_XTENSA_JMP_SLOT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_XTENSA_JMP_SLOT", + FALSE, 0xffffffff, 0xffffffff, FALSE), + HOWTO (R_XTENSA_RELATIVE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_XTENSA_RELATIVE", + FALSE, 0xffffffff, 0xffffffff, FALSE), + HOWTO (R_XTENSA_PLT, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, + bfd_elf_xtensa_reloc, "R_XTENSA_PLT", + FALSE, 0xffffffff, 0xffffffff, FALSE), + EMPTY_HOWTO (7), + HOWTO (R_XTENSA_OP0, 0, 0, 0, TRUE, 0, complain_overflow_dont, + bfd_elf_xtensa_reloc, "R_XTENSA_OP0", + FALSE, 0x00000000, 0x00000000, TRUE), + HOWTO (R_XTENSA_OP1, 0, 0, 0, TRUE, 0, complain_overflow_dont, + bfd_elf_xtensa_reloc, "R_XTENSA_OP1", + FALSE, 0x00000000, 0x00000000, TRUE), + HOWTO (R_XTENSA_OP2, 0, 0, 0, TRUE, 0, complain_overflow_dont, + bfd_elf_xtensa_reloc, "R_XTENSA_OP2", + FALSE, 0x00000000, 0x00000000, TRUE), + /* Assembly auto-expansion. */ + HOWTO (R_XTENSA_ASM_EXPAND, 0, 0, 0, TRUE, 0, complain_overflow_dont, + bfd_elf_xtensa_reloc, "R_XTENSA_ASM_EXPAND", + FALSE, 0x00000000, 0x00000000, FALSE), + /* Relax assembly auto-expansion. */ + HOWTO (R_XTENSA_ASM_SIMPLIFY, 0, 0, 0, TRUE, 0, complain_overflow_dont, + bfd_elf_xtensa_reloc, "R_XTENSA_ASM_SIMPLIFY", + FALSE, 0x00000000, 0x00000000, TRUE), + EMPTY_HOWTO (13), + EMPTY_HOWTO (14), + /* GNU extension to record C++ vtable hierarchy. */ + HOWTO (R_XTENSA_GNU_VTINHERIT, 0, 2, 0, FALSE, 0, complain_overflow_dont, + NULL, "R_XTENSA_GNU_VTINHERIT", + FALSE, 0x00000000, 0x00000000, FALSE), + /* GNU extension to record C++ vtable member usage. */ + HOWTO (R_XTENSA_GNU_VTENTRY, 0, 2, 0, FALSE, 0, complain_overflow_dont, + _bfd_elf_rel_vtable_reloc_fn, "R_XTENSA_GNU_VTENTRY", + FALSE, 0x00000000, 0x00000000, FALSE) +}; + +#ifdef DEBUG_GEN_RELOC +#define TRACE(str) \ + fprintf (stderr, "Xtensa bfd reloc lookup %d (%s)\n", code, str) +#else +#define TRACE(str) +#endif + +static reloc_howto_type * +elf_xtensa_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + switch (code) + { + case BFD_RELOC_NONE: + TRACE ("BFD_RELOC_NONE"); + return &elf_howto_table[(unsigned) R_XTENSA_NONE ]; + + case BFD_RELOC_32: + TRACE ("BFD_RELOC_32"); + return &elf_howto_table[(unsigned) R_XTENSA_32 ]; + + case BFD_RELOC_XTENSA_RTLD: + TRACE ("BFD_RELOC_XTENSA_RTLD"); + return &elf_howto_table[(unsigned) R_XTENSA_RTLD ]; + + case BFD_RELOC_XTENSA_GLOB_DAT: + TRACE ("BFD_RELOC_XTENSA_GLOB_DAT"); + return &elf_howto_table[(unsigned) R_XTENSA_GLOB_DAT ]; + + case BFD_RELOC_XTENSA_JMP_SLOT: + TRACE ("BFD_RELOC_XTENSA_JMP_SLOT"); + return &elf_howto_table[(unsigned) R_XTENSA_JMP_SLOT ]; + + case BFD_RELOC_XTENSA_RELATIVE: + TRACE ("BFD_RELOC_XTENSA_RELATIVE"); + return &elf_howto_table[(unsigned) R_XTENSA_RELATIVE ]; + + case BFD_RELOC_XTENSA_PLT: + TRACE ("BFD_RELOC_XTENSA_PLT"); + return &elf_howto_table[(unsigned) R_XTENSA_PLT ]; + + case BFD_RELOC_XTENSA_OP0: + TRACE ("BFD_RELOC_XTENSA_OP0"); + return &elf_howto_table[(unsigned) R_XTENSA_OP0 ]; + + case BFD_RELOC_XTENSA_OP1: + TRACE ("BFD_RELOC_XTENSA_OP1"); + return &elf_howto_table[(unsigned) R_XTENSA_OP1 ]; + + case BFD_RELOC_XTENSA_OP2: + TRACE ("BFD_RELOC_XTENSA_OP2"); + return &elf_howto_table[(unsigned) R_XTENSA_OP2 ]; + + case BFD_RELOC_XTENSA_ASM_EXPAND: + TRACE ("BFD_RELOC_XTENSA_ASM_EXPAND"); + return &elf_howto_table[(unsigned) R_XTENSA_ASM_EXPAND ]; + + case BFD_RELOC_XTENSA_ASM_SIMPLIFY: + TRACE ("BFD_RELOC_XTENSA_ASM_SIMPLIFY"); + return &elf_howto_table[(unsigned) R_XTENSA_ASM_SIMPLIFY ]; + + case BFD_RELOC_VTABLE_INHERIT: + TRACE ("BFD_RELOC_VTABLE_INHERIT"); + return &elf_howto_table[(unsigned) R_XTENSA_GNU_VTINHERIT ]; + + case BFD_RELOC_VTABLE_ENTRY: + TRACE ("BFD_RELOC_VTABLE_ENTRY"); + return &elf_howto_table[(unsigned) R_XTENSA_GNU_VTENTRY ]; + + default: + break; + } + + TRACE ("Unknown"); + return NULL; +} + + +/* Given an ELF "rela" relocation, find the corresponding howto and record + it in the BFD internal arelent representation of the relocation. */ + +static void +elf_xtensa_info_to_howto_rela (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type = ELF32_R_TYPE (dst->r_info); + + BFD_ASSERT (r_type < (unsigned int) R_XTENSA_max); + cache_ptr->howto = &elf_howto_table[r_type]; +} + + +/* Functions for the Xtensa ELF linker. */ + +/* The name of the dynamic interpreter. This is put in the .interp + section. */ + +#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so" + +/* The size in bytes of an entry in the procedure linkage table. + (This does _not_ include the space for the literals associated with + the PLT entry.) */ + +#define PLT_ENTRY_SIZE 16 + +/* For _really_ large PLTs, we may need to alternate between literals + and code to keep the literals within the 256K range of the L32R + instructions in the code. It's unlikely that anyone would ever need + such a big PLT, but an arbitrary limit on the PLT size would be bad. + Thus, we split the PLT into chunks. Since there's very little + overhead (2 extra literals) for each chunk, the chunk size is kept + small so that the code for handling multiple chunks get used and + tested regularly. With 254 entries, there are 1K of literals for + each chunk, and that seems like a nice round number. */ + +#define PLT_ENTRIES_PER_CHUNK 254 + +/* PLT entries are actually used as stub functions for lazy symbol + resolution. Once the symbol is resolved, the stub function is never + invoked. Note: the 32-byte frame size used here cannot be changed + without a corresponding change in the runtime linker. */ + +static const bfd_byte elf_xtensa_be_plt_entry[PLT_ENTRY_SIZE] = +{ + 0x6c, 0x10, 0x04, /* entry sp, 32 */ + 0x18, 0x00, 0x00, /* l32r a8, [got entry for rtld's resolver] */ + 0x1a, 0x00, 0x00, /* l32r a10, [got entry for rtld's link map] */ + 0x1b, 0x00, 0x00, /* l32r a11, [literal for reloc index] */ + 0x0a, 0x80, 0x00, /* jx a8 */ + 0 /* unused */ +}; + +static const bfd_byte elf_xtensa_le_plt_entry[PLT_ENTRY_SIZE] = +{ + 0x36, 0x41, 0x00, /* entry sp, 32 */ + 0x81, 0x00, 0x00, /* l32r a8, [got entry for rtld's resolver] */ + 0xa1, 0x00, 0x00, /* l32r a10, [got entry for rtld's link map] */ + 0xb1, 0x00, 0x00, /* l32r a11, [literal for reloc index] */ + 0xa0, 0x08, 0x00, /* jx a8 */ + 0 /* unused */ +}; + + +static inline bfd_boolean +xtensa_elf_dynamic_symbol_p (h, info) + struct elf_link_hash_entry *h; + struct bfd_link_info *info; +{ + /* Check if we should do dynamic things to this symbol. The + "ignore_protected" argument need not be set, because Xtensa code + does not require special handling of STV_PROTECTED to make function + pointer comparisons work properly. The PLT addresses are never + used for function pointers. */ + + return _bfd_elf_dynamic_symbol_p (h, info, 0); +} + + +static int +property_table_compare (ap, bp) + const PTR ap; + const PTR bp; +{ + const property_table_entry *a = (const property_table_entry *) ap; + const property_table_entry *b = (const property_table_entry *) bp; + + /* Check if one entry overlaps with the other; this shouldn't happen + except when searching for a match. */ + if ((b->address >= a->address && b->address < (a->address + a->size)) + || (a->address >= b->address && a->address < (b->address + b->size))) + return 0; + + return (a->address - b->address); +} + + +/* Get the literal table or instruction table entries for the given + section. Sets TABLE_P and returns the number of entries. On error, + returns a negative value. */ + +int +xtensa_read_table_entries (abfd, section, table_p, sec_name) + bfd *abfd; + asection *section; + property_table_entry **table_p; + const char *sec_name; +{ + asection *table_section; + char *table_section_name; + bfd_size_type table_size = 0; + bfd_byte *table_data; + property_table_entry *blocks; + int block_count; + bfd_size_type num_records; + Elf_Internal_Rela *internal_relocs; + bfd_vma section_addr; + + table_section_name = + xtensa_get_property_section_name (section, sec_name); + table_section = bfd_get_section_by_name (abfd, table_section_name); + free (table_section_name); + if (table_section != NULL) + table_size = (table_section->_cooked_size + ? table_section->_cooked_size : table_section->_raw_size); + + if (table_size == 0) + { + *table_p = NULL; + return 0; + } + + num_records = table_size / 8; + table_data = retrieve_contents (abfd, table_section, TRUE); + blocks = (property_table_entry *) + bfd_malloc (num_records * sizeof (property_table_entry)); + block_count = 0; + + section_addr = section->output_section->vma + section->output_offset; + + /* If the file has not yet been relocated, process the relocations + and sort out the table entries that apply to the specified section. */ + internal_relocs = retrieve_internal_relocs (abfd, table_section, TRUE); + if (internal_relocs && !table_section->reloc_done) + { + unsigned i; + + for (i = 0; i < table_section->reloc_count; i++) + { + Elf_Internal_Rela *rel = &internal_relocs[i]; + unsigned long r_symndx; + + if (ELF32_R_TYPE (rel->r_info) == R_XTENSA_NONE) + continue; + + BFD_ASSERT (ELF32_R_TYPE (rel->r_info) == R_XTENSA_32); + r_symndx = ELF32_R_SYM (rel->r_info); + + if (get_elf_r_symndx_section (abfd, r_symndx) == section) + { + bfd_vma sym_off = get_elf_r_symndx_offset (abfd, r_symndx); + blocks[block_count].address = + (section_addr + sym_off + rel->r_addend + + bfd_get_32 (abfd, table_data + rel->r_offset)); + blocks[block_count].size = + bfd_get_32 (abfd, table_data + rel->r_offset + 4); + block_count++; + } + } + } + else + { + /* The file has already been relocated and the addresses are + already in the table. */ + bfd_vma off; + + for (off = 0; off < table_size; off += 8) + { + bfd_vma address = bfd_get_32 (abfd, table_data + off); + + if (address >= section_addr + && address < ( section_addr + section->_raw_size)) + { + blocks[block_count].address = address; + blocks[block_count].size = + bfd_get_32 (abfd, table_data + off + 4); + block_count++; + } + } + } + + release_contents (table_section, table_data); + release_internal_relocs (table_section, internal_relocs); + + if (block_count > 0) + { + /* Now sort them into address order for easy reference. */ + qsort (blocks, block_count, sizeof (property_table_entry), + property_table_compare); + } + + *table_p = blocks; + return block_count; +} + + +static bfd_boolean +elf_xtensa_in_literal_pool (lit_table, lit_table_size, addr) + property_table_entry *lit_table; + int lit_table_size; + bfd_vma addr; +{ + property_table_entry entry; + + if (lit_table_size == 0) + return FALSE; + + entry.address = addr; + entry.size = 1; + + if (bsearch (&entry, lit_table, lit_table_size, + sizeof (property_table_entry), property_table_compare)) + return TRUE; + + return FALSE; +} + + +/* Look through the relocs for a section during the first phase, and + calculate needed space in the dynamic reloc sections. */ + +static bfd_boolean +elf_xtensa_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + unsigned int r_type; + unsigned long r_symndx; + struct elf_link_hash_entry *h; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + + if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) + { + (*_bfd_error_handler) (_("%s: bad symbol index: %d"), + bfd_archive_filename (abfd), + r_symndx); + return FALSE; + } + + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } + + switch (r_type) + { + case R_XTENSA_32: + if (h == NULL) + goto local_literal; + + if ((sec->flags & SEC_ALLOC) != 0) + { + if (h->got.refcount <= 0) + h->got.refcount = 1; + else + h->got.refcount += 1; + } + break; + + case R_XTENSA_PLT: + /* If this relocation is against a local symbol, then it's + exactly the same as a normal local GOT entry. */ + if (h == NULL) + goto local_literal; + + if ((sec->flags & SEC_ALLOC) != 0) + { + if (h->plt.refcount <= 0) + { + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->plt.refcount = 1; + } + else + h->plt.refcount += 1; + + /* Keep track of the total PLT relocation count even if we + don't yet know whether the dynamic sections will be + created. */ + plt_reloc_count += 1; + + if (elf_hash_table (info)->dynamic_sections_created) + { + if (!add_extra_plt_sections (elf_hash_table (info)->dynobj, + plt_reloc_count)) + return FALSE; + } + } + break; + + local_literal: + if ((sec->flags & SEC_ALLOC) != 0) + { + bfd_signed_vma *local_got_refcounts; + + /* This is a global offset table entry for a local symbol. */ + local_got_refcounts = elf_local_got_refcounts (abfd); + if (local_got_refcounts == NULL) + { + bfd_size_type size; + + size = symtab_hdr->sh_info; + size *= sizeof (bfd_signed_vma); + local_got_refcounts = ((bfd_signed_vma *) + bfd_zalloc (abfd, size)); + if (local_got_refcounts == NULL) + return FALSE; + elf_local_got_refcounts (abfd) = local_got_refcounts; + } + local_got_refcounts[r_symndx] += 1; + } + break; + + case R_XTENSA_OP0: + case R_XTENSA_OP1: + case R_XTENSA_OP2: + case R_XTENSA_ASM_EXPAND: + case R_XTENSA_ASM_SIMPLIFY: + /* Nothing to do for these. */ + break; + + case R_XTENSA_GNU_VTINHERIT: + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + case R_XTENSA_GNU_VTENTRY: + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + + default: + break; + } + } + + return TRUE; +} + + +static void +elf_xtensa_hide_symbol (info, h, force_local) + struct bfd_link_info *info; + struct elf_link_hash_entry *h; + bfd_boolean force_local; +{ + /* For a shared link, move the plt refcount to the got refcount to leave + space for RELATIVE relocs. */ + elf_xtensa_make_sym_local (info, h); + + _bfd_elf_link_hash_hide_symbol (info, h, force_local); +} + + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +elf_xtensa_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_XTENSA_GNU_VTINHERIT: + case R_XTENSA_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the GOT & PLT entry reference counts + for the section being removed. */ + +static bfd_boolean +elf_xtensa_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_signed_vma *local_got_refcounts; + const Elf_Internal_Rela *rel, *relend; + + if ((sec->flags & SEC_ALLOC) == 0) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + local_got_refcounts = elf_local_got_refcounts (abfd); + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; rel++) + { + unsigned long r_symndx; + unsigned int r_type; + struct elf_link_hash_entry *h = NULL; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + r_type = ELF32_R_TYPE (rel->r_info); + switch (r_type) + { + case R_XTENSA_32: + if (h == NULL) + goto local_literal; + if (h->got.refcount > 0) + h->got.refcount--; + break; + + case R_XTENSA_PLT: + if (h == NULL) + goto local_literal; + if (h->plt.refcount > 0) + h->plt.refcount--; + break; + + local_literal: + if (local_got_refcounts[r_symndx] > 0) + local_got_refcounts[r_symndx] -= 1; + break; + + default: + break; + } + } + + return TRUE; +} + + +/* Create all the dynamic sections. */ + +static bfd_boolean +elf_xtensa_create_dynamic_sections (dynobj, info) + bfd *dynobj; + struct bfd_link_info *info; +{ + flagword flags, noalloc_flags; + asection *s; + + /* First do all the standard stuff. */ + if (! _bfd_elf_create_dynamic_sections (dynobj, info)) + return FALSE; + + /* Create any extra PLT sections in case check_relocs has already + been called on all the non-dynamic input files. */ + if (!add_extra_plt_sections (dynobj, plt_reloc_count)) + return FALSE; + + noalloc_flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY); + flags = noalloc_flags | SEC_ALLOC | SEC_LOAD; + + /* Mark the ".got.plt" section READONLY. */ + s = bfd_get_section_by_name (dynobj, ".got.plt"); + if (s == NULL + || ! bfd_set_section_flags (dynobj, s, flags)) + return FALSE; + + /* Create ".rela.got". */ + s = bfd_make_section (dynobj, ".rela.got"); + if (s == NULL + || ! bfd_set_section_flags (dynobj, s, flags) + || ! bfd_set_section_alignment (dynobj, s, 2)) + return FALSE; + + /* Create ".got.loc" (literal tables for use by dynamic linker). */ + s = bfd_make_section (dynobj, ".got.loc"); + if (s == NULL + || ! bfd_set_section_flags (dynobj, s, flags) + || ! bfd_set_section_alignment (dynobj, s, 2)) + return FALSE; + + /* Create ".xt.lit.plt" (literal table for ".got.plt*"). */ + s = bfd_make_section (dynobj, ".xt.lit.plt"); + if (s == NULL + || ! bfd_set_section_flags (dynobj, s, noalloc_flags) + || ! bfd_set_section_alignment (dynobj, s, 2)) + return FALSE; + + return TRUE; +} + + +static bfd_boolean +add_extra_plt_sections (dynobj, count) + bfd *dynobj; + int count; +{ + int chunk; + + /* Iterate over all chunks except 0 which uses the standard ".plt" and + ".got.plt" sections. */ + for (chunk = count / PLT_ENTRIES_PER_CHUNK; chunk > 0; chunk--) + { + char *sname; + flagword flags; + asection *s; + + /* Stop when we find a section has already been created. */ + if (elf_xtensa_get_plt_section (dynobj, chunk)) + break; + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY); + + sname = (char *) bfd_malloc (10); + sprintf (sname, ".plt.%u", chunk); + s = bfd_make_section (dynobj, sname); + if (s == NULL + || ! bfd_set_section_flags (dynobj, s, flags | SEC_CODE) + || ! bfd_set_section_alignment (dynobj, s, 2)) + return FALSE; + + sname = (char *) bfd_malloc (14); + sprintf (sname, ".got.plt.%u", chunk); + s = bfd_make_section (dynobj, sname); + if (s == NULL + || ! bfd_set_section_flags (dynobj, s, flags) + || ! bfd_set_section_alignment (dynobj, s, 2)) + return FALSE; + } + + return TRUE; +} + + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static bfd_boolean +elf_xtensa_adjust_dynamic_symbol (info, h) + struct bfd_link_info *info ATTRIBUTE_UNUSED; + struct elf_link_hash_entry *h; +{ + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object. The + reference must go through the GOT, so there's no need for COPY relocs, + .dynbss, etc. */ + + return TRUE; +} + + +static void +elf_xtensa_make_sym_local (info, h) + struct bfd_link_info *info; + struct elf_link_hash_entry *h; +{ + if (info->shared) + { + if (h->plt.refcount > 0) + { + /* Will use RELATIVE relocs instead of JMP_SLOT relocs. */ + if (h->got.refcount < 0) + h->got.refcount = 0; + h->got.refcount += h->plt.refcount; + h->plt.refcount = 0; + } + } + else + { + /* Don't need any dynamic relocations at all. */ + h->plt.refcount = 0; + h->got.refcount = 0; + } +} + + +static bfd_boolean +elf_xtensa_fix_refcounts (h, arg) + struct elf_link_hash_entry *h; + PTR arg; +{ + struct bfd_link_info *info = (struct bfd_link_info *) arg; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (! xtensa_elf_dynamic_symbol_p (h, info)) + elf_xtensa_make_sym_local (info, h); + + return TRUE; +} + + +static bfd_boolean +elf_xtensa_allocate_plt_size (h, arg) + struct elf_link_hash_entry *h; + PTR arg; +{ + asection *srelplt = (asection *) arg; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->plt.refcount > 0) + srelplt->_raw_size += (h->plt.refcount * sizeof (Elf32_External_Rela)); + + return TRUE; +} + + +static bfd_boolean +elf_xtensa_allocate_got_size (h, arg) + struct elf_link_hash_entry *h; + PTR arg; +{ + asection *srelgot = (asection *) arg; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->got.refcount > 0) + srelgot->_raw_size += (h->got.refcount * sizeof (Elf32_External_Rela)); + + return TRUE; +} + + +static void +elf_xtensa_allocate_local_got_size (info, srelgot) + struct bfd_link_info *info; + asection *srelgot; +{ + bfd *i; + + for (i = info->input_bfds; i; i = i->link_next) + { + bfd_signed_vma *local_got_refcounts; + bfd_size_type j, cnt; + Elf_Internal_Shdr *symtab_hdr; + + local_got_refcounts = elf_local_got_refcounts (i); + if (!local_got_refcounts) + continue; + + symtab_hdr = &elf_tdata (i)->symtab_hdr; + cnt = symtab_hdr->sh_info; + + for (j = 0; j < cnt; ++j) + { + if (local_got_refcounts[j] > 0) + srelgot->_raw_size += (local_got_refcounts[j] + * sizeof (Elf32_External_Rela)); + } + } +} + + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +elf_xtensa_size_dynamic_sections (output_bfd, info) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; +{ + bfd *dynobj, *abfd; + asection *s, *srelplt, *splt, *sgotplt, *srelgot, *spltlittbl, *sgotloc; + bfd_boolean relplt, relgot; + int plt_entries, plt_chunks, chunk; + + plt_entries = 0; + plt_chunks = 0; + srelgot = 0; + + dynobj = elf_hash_table (info)->dynobj; + if (dynobj == NULL) + abort (); + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (info->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + if (s == NULL) + abort (); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + + /* Allocate room for one word in ".got". */ + s = bfd_get_section_by_name (dynobj, ".got"); + if (s == NULL) + abort (); + s->_raw_size = 4; + + /* Adjust refcounts for symbols that we now know are not "dynamic". */ + elf_link_hash_traverse (elf_hash_table (info), + elf_xtensa_fix_refcounts, + (PTR) info); + + /* Allocate space in ".rela.got" for literals that reference + global symbols. */ + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + if (srelgot == NULL) + abort (); + elf_link_hash_traverse (elf_hash_table (info), + elf_xtensa_allocate_got_size, + (PTR) srelgot); + + /* If we are generating a shared object, we also need space in + ".rela.got" for R_XTENSA_RELATIVE relocs for literals that + reference local symbols. */ + if (info->shared) + elf_xtensa_allocate_local_got_size (info, srelgot); + + /* Allocate space in ".rela.plt" for literals that have PLT entries. */ + srelplt = bfd_get_section_by_name (dynobj, ".rela.plt"); + if (srelplt == NULL) + abort (); + elf_link_hash_traverse (elf_hash_table (info), + elf_xtensa_allocate_plt_size, + (PTR) srelplt); + + /* Allocate space in ".plt" to match the size of ".rela.plt". For + each PLT entry, we need the PLT code plus a 4-byte literal. + For each chunk of ".plt", we also need two more 4-byte + literals, two corresponding entries in ".rela.got", and an + 8-byte entry in ".xt.lit.plt". */ + spltlittbl = bfd_get_section_by_name (dynobj, ".xt.lit.plt"); + if (spltlittbl == NULL) + abort (); + + plt_entries = srelplt->_raw_size / sizeof (Elf32_External_Rela); + plt_chunks = + (plt_entries + PLT_ENTRIES_PER_CHUNK - 1) / PLT_ENTRIES_PER_CHUNK; + + /* Iterate over all the PLT chunks, including any extra sections + created earlier because the initial count of PLT relocations + was an overestimate. */ + for (chunk = 0; + (splt = elf_xtensa_get_plt_section (dynobj, chunk)) != NULL; + chunk++) + { + int chunk_entries; + + sgotplt = elf_xtensa_get_gotplt_section (dynobj, chunk); + if (sgotplt == NULL) + abort (); + + if (chunk < plt_chunks - 1) + chunk_entries = PLT_ENTRIES_PER_CHUNK; + else if (chunk == plt_chunks - 1) + chunk_entries = plt_entries - (chunk * PLT_ENTRIES_PER_CHUNK); + else + chunk_entries = 0; + + if (chunk_entries != 0) + { + sgotplt->_raw_size = 4 * (chunk_entries + 2); + splt->_raw_size = PLT_ENTRY_SIZE * chunk_entries; + srelgot->_raw_size += 2 * sizeof (Elf32_External_Rela); + spltlittbl->_raw_size += 8; + } + else + { + sgotplt->_raw_size = 0; + splt->_raw_size = 0; + } + } + + /* Allocate space in ".got.loc" to match the total size of all the + literal tables. */ + sgotloc = bfd_get_section_by_name (dynobj, ".got.loc"); + if (sgotloc == NULL) + abort (); + sgotloc->_raw_size = spltlittbl->_raw_size; + for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next) + { + if (abfd->flags & DYNAMIC) + continue; + for (s = abfd->sections; s != NULL; s = s->next) + { + if (! elf_discarded_section (s) + && xtensa_is_littable_section (s) + && s != spltlittbl) + sgotloc->_raw_size += s->_raw_size; + } + } + } + + /* Allocate memory for dynamic sections. */ + relplt = FALSE; + relgot = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + const char *name; + bfd_boolean strip; + + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + /* It's OK to base decisions on the section name, because none + of the dynobj section names depend upon the input files. */ + name = bfd_get_section_name (dynobj, s); + + strip = FALSE; + + if (strncmp (name, ".rela", 5) == 0) + { + if (strcmp (name, ".rela.plt") == 0) + relplt = TRUE; + else if (strcmp (name, ".rela.got") == 0) + relgot = TRUE; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + else if (strncmp (name, ".plt.", 5) == 0 + || strncmp (name, ".got.plt.", 9) == 0) + { + if (s->_raw_size == 0) + { + /* If we don't need this section, strip it from the output + file. We must create the ".plt*" and ".got.plt*" + sections in create_dynamic_sections and/or check_relocs + based on a conservative estimate of the PLT relocation + count, because the sections must be created before the + linker maps input sections to output sections. The + linker does that before size_dynamic_sections, where we + compute the exact size of the PLT, so there may be more + of these sections than are actually needed. */ + strip = TRUE; + } + } + else if (strcmp (name, ".got") != 0 + && strcmp (name, ".plt") != 0 + && strcmp (name, ".got.plt") != 0 + && strcmp (name, ".xt.lit.plt") != 0 + && strcmp (name, ".got.loc") != 0) + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (strip) + _bfd_strip_section_from_output (info, s); + else + { + /* Allocate memory for the section contents. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) + return FALSE; + } + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Add the special XTENSA_RTLD relocations now. The offsets won't be + known until finish_dynamic_sections, but we need to get the relocs + in place before they are sorted. */ + if (srelgot == NULL) + abort (); + for (chunk = 0; chunk < plt_chunks; chunk++) + { + Elf_Internal_Rela irela; + bfd_byte *loc; + + irela.r_offset = 0; + irela.r_info = ELF32_R_INFO (0, R_XTENSA_RTLD); + irela.r_addend = 0; + + loc = (srelgot->contents + + srelgot->reloc_count * sizeof (Elf32_External_Rela)); + bfd_elf32_swap_reloca_out (output_bfd, &irela, loc); + bfd_elf32_swap_reloca_out (output_bfd, &irela, + loc + sizeof (Elf32_External_Rela)); + srelgot->reloc_count += 2; + } + + /* Add some entries to the .dynamic section. We fill in the + values later, in elf_xtensa_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) + + if (! info->shared) + { + if (!add_dynamic_entry (DT_DEBUG, 0)) + return FALSE; + } + + if (relplt) + { + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + } + + if (relgot) + { + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) + return FALSE; + } + + if (!add_dynamic_entry (DT_XTENSA_GOT_LOC_OFF, 0) + || !add_dynamic_entry (DT_XTENSA_GOT_LOC_SZ, 0)) + return FALSE; + } +#undef add_dynamic_entry + + return TRUE; +} + + +/* Remove any PT_LOAD segments with no allocated sections. Prior to + binutils 2.13, this function used to remove the non-SEC_ALLOC + sections from PT_LOAD segments, but that task has now been moved + into elf.c. We still need this function to remove any empty + segments that result, but there's nothing Xtensa-specific about + this and it probably ought to be moved into elf.c as well. */ + +static bfd_boolean +elf_xtensa_modify_segment_map (abfd, info) + bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; +{ + struct elf_segment_map **m_p; + + m_p = &elf_tdata (abfd)->segment_map; + while (*m_p != NULL) + { + if ((*m_p)->p_type == PT_LOAD && (*m_p)->count == 0) + *m_p = (*m_p)->next; + else + m_p = &(*m_p)->next; + } + return TRUE; +} + + +/* Perform the specified relocation. The instruction at (contents + address) + is modified to set one operand to represent the value in "relocation". The + operand position is determined by the relocation type recorded in the + howto. */ + +#define CALL_SEGMENT_BITS (30) +#define CALL_SEGMENT_SIZE (1<type) + { + case R_XTENSA_NONE: + return bfd_reloc_ok; + + case R_XTENSA_ASM_EXPAND: + if (!is_weak_undef) + { + /* Check for windowed CALL across a 1GB boundary. */ + xtensa_opcode opcode = + get_expanded_call_opcode (contents + address, + input_section->_raw_size - address); + if (is_windowed_call_opcode (opcode)) + { + self_address = (input_section->output_section->vma + + input_section->output_offset + + address); + if ((self_address >> CALL_SEGMENT_BITS) != + (relocation >> CALL_SEGMENT_BITS)) + { + *error_message = "windowed longcall crosses 1GB boundary; " + "return may fail"; + return bfd_reloc_dangerous; + } + } + } + return bfd_reloc_ok; + + case R_XTENSA_ASM_SIMPLIFY: + { + /* Convert the L32R/CALLX to CALL. */ + bfd_reloc_status_type retval = + elf_xtensa_do_asm_simplify (contents, address, + input_section->_raw_size); + if (retval != bfd_reloc_ok) + return retval; + + /* The CALL needs to be relocated. Continue below for that part. */ + address += 3; + howto = &elf_howto_table[(unsigned) R_XTENSA_OP0 ]; + } + break; + + case R_XTENSA_32: + case R_XTENSA_PLT: + { + bfd_vma x; + x = bfd_get_32 (abfd, contents + address); + x = x + relocation; + bfd_put_32 (abfd, x, contents + address); + } + return bfd_reloc_ok; + } + + /* Read the instruction into a buffer and decode the opcode. */ + ibuff = xtensa_insnbuf_alloc (isa); + xtensa_insnbuf_from_chars (isa, ibuff, contents + address); + opcode = xtensa_decode_insn (isa, ibuff); + + /* Determine which operand is being relocated. */ + if (opcode == XTENSA_UNDEFINED) + { + *error_message = "cannot decode instruction"; + return bfd_reloc_dangerous; + } + + if (howto->type < R_XTENSA_OP0 || howto->type > R_XTENSA_OP2) + { + *error_message = "unexpected relocation"; + return bfd_reloc_dangerous; + } + + opnd = howto->type - R_XTENSA_OP0; + + /* Calculate the PC address for this instruction. */ + if (!howto->pc_relative) + { + *error_message = "expected PC-relative relocation"; + return bfd_reloc_dangerous; + } + + self_address = (input_section->output_section->vma + + input_section->output_offset + + address); + + /* Apply the relocation. */ + operand = xtensa_get_operand (isa, opcode, opnd); + newval = xtensa_operand_do_reloc (operand, relocation, self_address); + encode_result = xtensa_operand_encode (operand, &newval); + xtensa_operand_set_field (operand, ibuff, newval); + + /* Write the modified instruction back out of the buffer. */ + xtensa_insnbuf_to_chars (isa, ibuff, contents + address); + free (ibuff); + + if (encode_result != xtensa_encode_result_ok) + { + char *message = build_encoding_error_message (opcode, encode_result); + *error_message = message; + return bfd_reloc_dangerous; + } + + /* Final check for call. */ + if (is_direct_call_opcode (opcode) + && is_windowed_call_opcode (opcode)) + { + if ((self_address >> CALL_SEGMENT_BITS) != + (relocation >> CALL_SEGMENT_BITS)) + { + *error_message = "windowed call crosses 1GB boundary; " + "return may fail"; + return bfd_reloc_dangerous; + } + } + + return bfd_reloc_ok; +} + + +static char * +vsprint_msg VPARAMS ((const char *origmsg, const char *fmt, int arglen, ...)) +{ + /* To reduce the size of the memory leak, + we only use a single message buffer. */ + static bfd_size_type alloc_size = 0; + static char *message = NULL; + bfd_size_type orig_len, len = 0; + bfd_boolean is_append; + + VA_OPEN (ap, arglen); + VA_FIXEDARG (ap, const char *, origmsg); + + is_append = (origmsg == message); + + orig_len = strlen (origmsg); + len = orig_len + strlen (fmt) + arglen + 20; + if (len > alloc_size) + { + message = (char *) bfd_realloc (message, len); + alloc_size = len; + } + if (!is_append) + memcpy (message, origmsg, orig_len); + vsprintf (message + orig_len, fmt, ap); + VA_CLOSE (ap); + return message; +} + + +static char * +build_encoding_error_message (opcode, encode_result) + xtensa_opcode opcode; + xtensa_encode_result encode_result; +{ + const char *opname = xtensa_opcode_name (xtensa_default_isa, opcode); + const char *msg = NULL; + + switch (encode_result) + { + case xtensa_encode_result_ok: + msg = "unexpected valid encoding"; + break; + case xtensa_encode_result_align: + msg = "misaligned encoding"; + break; + case xtensa_encode_result_not_in_table: + msg = "encoding not in lookup table"; + break; + case xtensa_encode_result_too_low: + msg = "encoding out of range: too low"; + break; + case xtensa_encode_result_too_high: + msg = "encoding out of range: too high"; + break; + case xtensa_encode_result_not_ok: + default: + msg = "could not encode"; + break; + } + + if (is_direct_call_opcode (opcode) + && (encode_result == xtensa_encode_result_too_low + || encode_result == xtensa_encode_result_too_high)) + + msg = "direct call out of range"; + + else if (opcode == get_l32r_opcode ()) + { + /* L32Rs have the strange interaction with encoding in that they + have an unsigned immediate field, so libisa returns "too high" + when the absolute value is out of range and never returns "too + low", but I leave the "too low" message in case anything + changes. */ + if (encode_result == xtensa_encode_result_too_low) + msg = "literal out of range"; + else if (encode_result == xtensa_encode_result_too_high) + msg = "literal placed after use"; + } + + return vsprint_msg (opname, ": %s", strlen (msg) + 2, msg); +} + + +/* This function is registered as the "special_function" in the + Xtensa howto for handling simplify operations. + bfd_perform_relocation / bfd_install_relocation use it to + perform (install) the specified relocation. Since this replaces the code + in bfd_perform_relocation, it is basically an Xtensa-specific, + stripped-down version of bfd_perform_relocation. */ + +static bfd_reloc_status_type +bfd_elf_xtensa_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + bfd_vma relocation; + bfd_reloc_status_type flag; + bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd); + bfd_vma output_base = 0; + reloc_howto_type *howto = reloc_entry->howto; + asection *reloc_target_output_section; + bfd_boolean is_weak_undef; + + /* ELF relocs are against symbols. If we are producing relocatable + output, and the reloc is against an external symbol, the resulting + reloc will also be against the same symbol. In such a case, we + don't want to change anything about the way the reloc is handled, + since it will all be done at final link time. This test is similar + to what bfd_elf_generic_reloc does except that it lets relocs with + howto->partial_inplace go through even if the addend is non-zero. + (The real problem is that partial_inplace is set for XTENSA_32 + relocs to begin with, but that's a long story and there's little we + can do about it now....) */ + + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* Is the address of the relocation really within the section? */ + if (reloc_entry->address > (input_section->_cooked_size + / bfd_octets_per_byte (abfd))) + return bfd_reloc_outofrange; + + /* Work out which section the relocation is targeted at and the + initial relocation command value. */ + + /* Get symbol value. (Common symbols are special.) */ + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + reloc_target_output_section = symbol->section->output_section; + + /* Convert input-section-relative symbol value to absolute. */ + if ((output_bfd && !howto->partial_inplace) + || reloc_target_output_section == NULL) + output_base = 0; + else + output_base = reloc_target_output_section->vma; + + relocation += output_base + symbol->section->output_offset; + + /* Add in supplied addend. */ + relocation += reloc_entry->addend; + + /* Here the variable relocation holds the final address of the + symbol we are relocating against, plus any addend. */ + if (output_bfd) + { + if (!howto->partial_inplace) + { + /* This is a partial relocation, and we want to apply the relocation + to the reloc entry rather than the raw data. Everything except + relocations against section symbols has already been handled + above. */ + + BFD_ASSERT (symbol->flags & BSF_SECTION_SYM); + reloc_entry->addend = relocation; + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + else + { + reloc_entry->address += input_section->output_offset; + reloc_entry->addend = 0; + } + } + + is_weak_undef = (bfd_is_und_section (symbol->section) + && (symbol->flags & BSF_WEAK) != 0); + flag = elf_xtensa_do_reloc (howto, abfd, input_section, relocation, + (bfd_byte *) data, (bfd_vma) octets, + is_weak_undef, error_message); + + if (flag == bfd_reloc_dangerous) + { + /* Add the symbol name to the error message. */ + if (! *error_message) + *error_message = ""; + *error_message = vsprint_msg (*error_message, ": (%s + 0x%lx)", + strlen (symbol->name) + 17, + symbol->name, reloc_entry->addend); + } + + return flag; +} + + +/* Set up an entry in the procedure linkage table. */ + +static bfd_vma +elf_xtensa_create_plt_entry (dynobj, output_bfd, reloc_index) + bfd *dynobj; + bfd *output_bfd; + unsigned reloc_index; +{ + asection *splt, *sgotplt; + bfd_vma plt_base, got_base; + bfd_vma code_offset, lit_offset; + int chunk; + + chunk = reloc_index / PLT_ENTRIES_PER_CHUNK; + splt = elf_xtensa_get_plt_section (dynobj, chunk); + sgotplt = elf_xtensa_get_gotplt_section (dynobj, chunk); + BFD_ASSERT (splt != NULL && sgotplt != NULL); + + plt_base = splt->output_section->vma + splt->output_offset; + got_base = sgotplt->output_section->vma + sgotplt->output_offset; + + lit_offset = 8 + (reloc_index % PLT_ENTRIES_PER_CHUNK) * 4; + code_offset = (reloc_index % PLT_ENTRIES_PER_CHUNK) * PLT_ENTRY_SIZE; + + /* Fill in the literal entry. This is the offset of the dynamic + relocation entry. */ + bfd_put_32 (output_bfd, reloc_index * sizeof (Elf32_External_Rela), + sgotplt->contents + lit_offset); + + /* Fill in the entry in the procedure linkage table. */ + memcpy (splt->contents + code_offset, + (bfd_big_endian (output_bfd) + ? elf_xtensa_be_plt_entry + : elf_xtensa_le_plt_entry), + PLT_ENTRY_SIZE); + bfd_put_16 (output_bfd, l32r_offset (got_base + 0, + plt_base + code_offset + 3), + splt->contents + code_offset + 4); + bfd_put_16 (output_bfd, l32r_offset (got_base + 4, + plt_base + code_offset + 6), + splt->contents + code_offset + 7); + bfd_put_16 (output_bfd, l32r_offset (got_base + lit_offset, + plt_base + code_offset + 9), + splt->contents + code_offset + 10); + + return plt_base + code_offset; +} + + +/* Relocate an Xtensa ELF section. This is invoked by the linker for + both relocatable and final links. */ + +static bfd_boolean +elf_xtensa_relocate_section (output_bfd, info, input_bfd, + input_section, contents, relocs, + local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + struct elf_link_hash_entry **sym_hashes; + asection *srelgot, *srelplt; + bfd *dynobj; + property_table_entry *lit_table = 0; + int ltblsize = 0; + char *error_message = NULL; + + if (xtensa_default_isa == NULL) + xtensa_isa_init (); + + dynobj = elf_hash_table (info)->dynobj; + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + + srelgot = NULL; + srelplt = NULL; + if (dynobj != NULL) + { + srelgot = bfd_get_section_by_name (dynobj, ".rela.got");; + srelplt = bfd_get_section_by_name (dynobj, ".rela.plt"); + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + ltblsize = xtensa_read_table_entries (input_bfd, input_section, + &lit_table, XTENSA_LIT_SEC_NAME); + if (ltblsize < 0) + return FALSE; + } + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + asection *sec; + bfd_vma relocation; + bfd_reloc_status_type r; + bfd_boolean is_weak_undef; + bfd_boolean unresolved_reloc; + bfd_boolean warned; + + r_type = ELF32_R_TYPE (rel->r_info); + if (r_type == (int) R_XTENSA_GNU_VTINHERIT + || r_type == (int) R_XTENSA_GNU_VTENTRY) + continue; + + if (r_type < 0 || r_type >= (int) R_XTENSA_max) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + howto = &elf_howto_table[r_type]; + + r_symndx = ELF32_R_SYM (rel->r_info); + + if (info->relocatable) + { + /* This is a relocatable link. + 1) If the reloc is against a section symbol, adjust + according to the output section. + 2) If there is a new target for this relocation, + the new target will be in the same output section. + We adjust the relocation by the output section + difference. */ + + if (relaxing_section) + { + /* Check if this references a section in another input file. */ + do_fix_for_relocatable_link (rel, input_bfd, input_section); + r_type = ELF32_R_TYPE (rel->r_info); + } + + if (r_type == R_XTENSA_ASM_SIMPLIFY) + { + /* Convert ASM_SIMPLIFY into the simpler relocation + so that they never escape a relaxing link. */ + contract_asm_expansion (contents, input_section->_raw_size, rel); + r_type = ELF32_R_TYPE (rel->r_info); + } + + /* This is a relocatable link, so we don't have to change + anything unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + sec = local_sections[r_symndx]; + rel->r_addend += sec->output_offset + sym->st_value; + } + } + + /* If there is an addend with a partial_inplace howto, + then move the addend to the contents. This is a hack + to work around problems with DWARF in relocatable links + with some previous version of BFD. Now we can't easily get + rid of the hack without breaking backward compatibility.... */ + if (rel->r_addend) + { + howto = &elf_howto_table[r_type]; + if (howto->partial_inplace) + { + r = elf_xtensa_do_reloc (howto, input_bfd, input_section, + rel->r_addend, contents, + rel->r_offset, FALSE, + &error_message); + if (r != bfd_reloc_ok) + { + if (!((*info->callbacks->reloc_dangerous) + (info, error_message, input_bfd, input_section, + rel->r_offset))) + return FALSE; + } + rel->r_addend = 0; + } + } + + /* Done with work for relocatable link; continue with next reloc. */ + continue; + } + + /* This is a final link. */ + + h = NULL; + sym = NULL; + sec = NULL; + is_weak_undef = FALSE; + unresolved_reloc = FALSE; + warned = FALSE; + + if (howto->partial_inplace) + { + /* Because R_XTENSA_32 was made partial_inplace to fix some + problems with DWARF info in partial links, there may be + an addend stored in the contents. Take it out of there + and move it back into the addend field of the reloc. */ + rel->r_addend += bfd_get_32 (input_bfd, contents + rel->r_offset); + bfd_put_32 (input_bfd, 0, contents + rel->r_offset); + } + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + + if (relocation == 0 + && !unresolved_reloc + && h->root.type == bfd_link_hash_undefweak) + is_weak_undef = TRUE; + } + + if (relaxing_section) + { + /* Check if this references a section in another input file. */ + do_fix_for_final_link (rel, input_section, &relocation); + + /* Update some already cached values. */ + r_type = ELF32_R_TYPE (rel->r_info); + howto = &elf_howto_table[r_type]; + } + + /* Sanity check the address. */ + if (rel->r_offset >= input_section->_raw_size + && ELF32_R_TYPE (rel->r_info) != R_XTENSA_NONE) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* Generate dynamic relocations. */ + if (elf_hash_table (info)->dynamic_sections_created) + { + bfd_boolean dynamic_symbol = xtensa_elf_dynamic_symbol_p (h, info); + + if (dynamic_symbol && (r_type == R_XTENSA_OP0 + || r_type == R_XTENSA_OP1 + || r_type == R_XTENSA_OP2)) + { + /* This is an error. The symbol's real value won't be known + until runtime and it's likely to be out of range anyway. */ + const char *name = h->root.root.string; + error_message = vsprint_msg ("invalid relocation for dynamic " + "symbol", ": %s", + strlen (name) + 2, name); + if (!((*info->callbacks->reloc_dangerous) + (info, error_message, input_bfd, input_section, + rel->r_offset))) + return FALSE; + } + else if ((r_type == R_XTENSA_32 || r_type == R_XTENSA_PLT) + && (input_section->flags & SEC_ALLOC) != 0 + && (dynamic_symbol || info->shared)) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + asection *srel; + + if (dynamic_symbol && r_type == R_XTENSA_PLT) + srel = srelplt; + else + srel = srelgot; + + BFD_ASSERT (srel != NULL); + + outrel.r_offset = + _bfd_elf_section_offset (output_bfd, info, + input_section, rel->r_offset); + + if ((outrel.r_offset | 1) == (bfd_vma) -1) + memset (&outrel, 0, sizeof outrel); + else + { + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + /* Complain if the relocation is in a read-only section + and not in a literal pool. */ + if ((input_section->flags & SEC_READONLY) != 0 + && !elf_xtensa_in_literal_pool (lit_table, ltblsize, + outrel.r_offset)) + { + error_message = + _("dynamic relocation in read-only section"); + if (!((*info->callbacks->reloc_dangerous) + (info, error_message, input_bfd, input_section, + rel->r_offset))) + return FALSE; + } + + if (dynamic_symbol) + { + outrel.r_addend = rel->r_addend; + rel->r_addend = 0; + + if (r_type == R_XTENSA_32) + { + outrel.r_info = + ELF32_R_INFO (h->dynindx, R_XTENSA_GLOB_DAT); + relocation = 0; + } + else /* r_type == R_XTENSA_PLT */ + { + outrel.r_info = + ELF32_R_INFO (h->dynindx, R_XTENSA_JMP_SLOT); + + /* Create the PLT entry and set the initial + contents of the literal entry to the address of + the PLT entry. */ + relocation = + elf_xtensa_create_plt_entry (dynobj, output_bfd, + srel->reloc_count); + } + unresolved_reloc = FALSE; + } + else + { + /* Generate a RELATIVE relocation. */ + outrel.r_info = ELF32_R_INFO (0, R_XTENSA_RELATIVE); + outrel.r_addend = 0; + } + } + + loc = (srel->contents + + srel->reloc_count++ * sizeof (Elf32_External_Rela)); + bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); + BFD_ASSERT (sizeof (Elf32_External_Rela) * srel->reloc_count + <= srel->_cooked_size); + } + } + + /* Dynamic relocs are not propagated for SEC_DEBUGGING sections + because such sections are not SEC_ALLOC and thus ld.so will + not process them. */ + if (unresolved_reloc + && !((input_section->flags & SEC_DEBUGGING) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + (*_bfd_error_handler) + (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, + h->root.root.string); + + /* There's no point in calling bfd_perform_relocation here. + Just go directly to our "special function". */ + r = elf_xtensa_do_reloc (howto, input_bfd, input_section, + relocation + rel->r_addend, + contents, rel->r_offset, is_weak_undef, + &error_message); + + if (r != bfd_reloc_ok && !warned) + { + const char *name; + + BFD_ASSERT (r == bfd_reloc_dangerous); + BFD_ASSERT (error_message != (char *) NULL); + + if (h != NULL) + name = h->root.root.string; + else + { + name = bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name); + if (name && *name == '\0') + name = bfd_section_name (input_bfd, sec); + } + if (name) + error_message = vsprint_msg (error_message, ": %s", + strlen (name), name); + if (!((*info->callbacks->reloc_dangerous) + (info, error_message, input_bfd, input_section, + rel->r_offset))) + return FALSE; + } + } + + if (lit_table) + free (lit_table); + + input_section->reloc_done = TRUE; + + return TRUE; +} + + +/* Finish up dynamic symbol handling. There's not much to do here since + the PLT and GOT entries are all set up by relocate_section. */ + +static bfd_boolean +elf_xtensa_finish_dynamic_symbol (output_bfd, info, h, sym) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + } + + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + sym->st_shndx = SHN_ABS; + + return TRUE; +} + + +/* Combine adjacent literal table entries in the output. Adjacent + entries within each input section may have been removed during + relaxation, but we repeat the process here, even though it's too late + to shrink the output section, because it's important to minimize the + number of literal table entries to reduce the start-up work for the + runtime linker. Returns the number of remaining table entries or -1 + on error. */ + +static int +elf_xtensa_combine_prop_entries (output_bfd, sxtlit, sgotloc) + bfd *output_bfd; + asection *sxtlit; + asection *sgotloc; +{ + bfd_byte *contents; + property_table_entry *table; + bfd_size_type section_size, sgotloc_size; + bfd_vma offset; + int n, m, num; + + section_size = (sxtlit->_cooked_size != 0 + ? sxtlit->_cooked_size : sxtlit->_raw_size); + BFD_ASSERT (section_size % 8 == 0); + num = section_size / 8; + + sgotloc_size = (sgotloc->_cooked_size != 0 + ? sgotloc->_cooked_size : sgotloc->_raw_size); + if (sgotloc_size != section_size) + { + (*_bfd_error_handler) + ("internal inconsistency in size of .got.loc section"); + return -1; + } + + contents = (bfd_byte *) bfd_malloc (section_size); + table = (property_table_entry *) + bfd_malloc (num * sizeof (property_table_entry)); + if (contents == 0 || table == 0) + return -1; + + /* The ".xt.lit.plt" section has the SEC_IN_MEMORY flag set and this + propagates to the output section, where it doesn't really apply and + where it breaks the following call to bfd_get_section_contents. */ + sxtlit->flags &= ~SEC_IN_MEMORY; + + if (! bfd_get_section_contents (output_bfd, sxtlit, contents, 0, + section_size)) + return -1; + + /* There should never be any relocations left at this point, so this + is quite a bit easier than what is done during relaxation. */ + + /* Copy the raw contents into a property table array and sort it. */ + offset = 0; + for (n = 0; n < num; n++) + { + table[n].address = bfd_get_32 (output_bfd, &contents[offset]); + table[n].size = bfd_get_32 (output_bfd, &contents[offset + 4]); + offset += 8; + } + qsort (table, num, sizeof (property_table_entry), property_table_compare); + + for (n = 0; n < num; n++) + { + bfd_boolean remove = FALSE; + + if (table[n].size == 0) + remove = TRUE; + else if (n > 0 && + (table[n-1].address + table[n-1].size == table[n].address)) + { + table[n-1].size += table[n].size; + remove = TRUE; + } + + if (remove) + { + for (m = n; m < num - 1; m++) + { + table[m].address = table[m+1].address; + table[m].size = table[m+1].size; + } + + n--; + num--; + } + } + + /* Copy the data back to the raw contents. */ + offset = 0; + for (n = 0; n < num; n++) + { + bfd_put_32 (output_bfd, table[n].address, &contents[offset]); + bfd_put_32 (output_bfd, table[n].size, &contents[offset + 4]); + offset += 8; + } + + /* Clear the removed bytes. */ + if ((bfd_size_type) (num * 8) < section_size) + { + memset (&contents[num * 8], 0, section_size - num * 8); + sxtlit->_cooked_size = num * 8; + } + + if (! bfd_set_section_contents (output_bfd, sxtlit, contents, 0, + section_size)) + return -1; + + /* Copy the contents to ".got.loc". */ + memcpy (sgotloc->contents, contents, section_size); + + free (contents); + free (table); + return num; +} + + +/* Finish up the dynamic sections. */ + +static bfd_boolean +elf_xtensa_finish_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *sdyn, *srelplt, *sgot, *sxtlit, *sgotloc; + Elf32_External_Dyn *dyncon, *dynconend; + int num_xtlit_entries; + + if (! elf_hash_table (info)->dynamic_sections_created) + return TRUE; + + dynobj = elf_hash_table (info)->dynobj; + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + BFD_ASSERT (sdyn != NULL); + + /* Set the first entry in the global offset table to the address of + the dynamic section. */ + sgot = bfd_get_section_by_name (dynobj, ".got"); + if (sgot) + { + BFD_ASSERT (sgot->_raw_size == 4); + if (sdyn == NULL) + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + else + bfd_put_32 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + sgot->contents); + } + + srelplt = bfd_get_section_by_name (dynobj, ".rela.plt"); + if (srelplt != NULL && srelplt->_raw_size != 0) + { + asection *sgotplt, *srelgot, *spltlittbl; + int chunk, plt_chunks, plt_entries; + Elf_Internal_Rela irela; + bfd_byte *loc; + unsigned rtld_reloc; + + srelgot = bfd_get_section_by_name (dynobj, ".rela.got");; + BFD_ASSERT (srelgot != NULL); + + spltlittbl = bfd_get_section_by_name (dynobj, ".xt.lit.plt"); + BFD_ASSERT (spltlittbl != NULL); + + /* Find the first XTENSA_RTLD relocation. Presumably the rest + of them follow immediately after.... */ + for (rtld_reloc = 0; rtld_reloc < srelgot->reloc_count; rtld_reloc++) + { + loc = srelgot->contents + rtld_reloc * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_in (output_bfd, loc, &irela); + if (ELF32_R_TYPE (irela.r_info) == R_XTENSA_RTLD) + break; + } + BFD_ASSERT (rtld_reloc < srelgot->reloc_count); + + plt_entries = (srelplt->_raw_size / sizeof (Elf32_External_Rela)); + plt_chunks = + (plt_entries + PLT_ENTRIES_PER_CHUNK - 1) / PLT_ENTRIES_PER_CHUNK; + + for (chunk = 0; chunk < plt_chunks; chunk++) + { + int chunk_entries = 0; + + sgotplt = elf_xtensa_get_gotplt_section (dynobj, chunk); + BFD_ASSERT (sgotplt != NULL); + + /* Emit special RTLD relocations for the first two entries in + each chunk of the .got.plt section. */ + + loc = srelgot->contents + rtld_reloc * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_in (output_bfd, loc, &irela); + BFD_ASSERT (ELF32_R_TYPE (irela.r_info) == R_XTENSA_RTLD); + irela.r_offset = (sgotplt->output_section->vma + + sgotplt->output_offset); + irela.r_addend = 1; /* tell rtld to set value to resolver function */ + bfd_elf32_swap_reloca_out (output_bfd, &irela, loc); + rtld_reloc += 1; + BFD_ASSERT (rtld_reloc <= srelgot->reloc_count); + + /* Next literal immediately follows the first. */ + loc += sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_in (output_bfd, loc, &irela); + BFD_ASSERT (ELF32_R_TYPE (irela.r_info) == R_XTENSA_RTLD); + irela.r_offset = (sgotplt->output_section->vma + + sgotplt->output_offset + 4); + /* Tell rtld to set value to object's link map. */ + irela.r_addend = 2; + bfd_elf32_swap_reloca_out (output_bfd, &irela, loc); + rtld_reloc += 1; + BFD_ASSERT (rtld_reloc <= srelgot->reloc_count); + + /* Fill in the literal table. */ + if (chunk < plt_chunks - 1) + chunk_entries = PLT_ENTRIES_PER_CHUNK; + else + chunk_entries = plt_entries - (chunk * PLT_ENTRIES_PER_CHUNK); + + BFD_ASSERT ((unsigned) (chunk + 1) * 8 <= spltlittbl->_cooked_size); + bfd_put_32 (output_bfd, + sgotplt->output_section->vma + sgotplt->output_offset, + spltlittbl->contents + (chunk * 8) + 0); + bfd_put_32 (output_bfd, + 8 + (chunk_entries * 4), + spltlittbl->contents + (chunk * 8) + 4); + } + + /* All the dynamic relocations have been emitted at this point. + Make sure the relocation sections are the correct size. */ + if (srelgot->_cooked_size != (sizeof (Elf32_External_Rela) + * srelgot->reloc_count) + || srelplt->_cooked_size != (sizeof (Elf32_External_Rela) + * srelplt->reloc_count)) + abort (); + + /* The .xt.lit.plt section has just been modified. This must + happen before the code below which combines adjacent literal + table entries, and the .xt.lit.plt contents have to be forced to + the output here. */ + if (! bfd_set_section_contents (output_bfd, + spltlittbl->output_section, + spltlittbl->contents, + spltlittbl->output_offset, + spltlittbl->_raw_size)) + return FALSE; + /* Clear SEC_HAS_CONTENTS so the contents won't be output again. */ + spltlittbl->flags &= ~SEC_HAS_CONTENTS; + } + + /* Combine adjacent literal table entries. */ + BFD_ASSERT (! info->relocatable); + sxtlit = bfd_get_section_by_name (output_bfd, ".xt.lit"); + sgotloc = bfd_get_section_by_name (dynobj, ".got.loc"); + BFD_ASSERT (sxtlit && sgotloc); + num_xtlit_entries = + elf_xtensa_combine_prop_entries (output_bfd, sxtlit, sgotloc); + if (num_xtlit_entries < 0) + return FALSE; + + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + const char *name; + asection *s; + + bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + break; + + case DT_XTENSA_GOT_LOC_SZ: + dyn.d_un.d_val = num_xtlit_entries; + break; + + case DT_XTENSA_GOT_LOC_OFF: + name = ".got.loc"; + goto get_vma; + case DT_PLTGOT: + name = ".got"; + goto get_vma; + case DT_JMPREL: + name = ".rela.plt"; + get_vma: + s = bfd_get_section_by_name (output_bfd, name); + BFD_ASSERT (s); + dyn.d_un.d_ptr = s->vma; + break; + + case DT_PLTRELSZ: + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + BFD_ASSERT (s); + dyn.d_un.d_val = (s->_cooked_size ? s->_cooked_size : s->_raw_size); + break; + + case DT_RELASZ: + /* Adjust RELASZ to not include JMPREL. This matches what + glibc expects and what is done for several other ELF + targets (e.g., i386, alpha), but the "correct" behavior + seems to be unresolved. Since the linker script arranges + for .rela.plt to follow all other relocation sections, we + don't have to worry about changing the DT_RELA entry. */ + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + if (s) + { + dyn.d_un.d_val -= + (s->_cooked_size ? s->_cooked_size : s->_raw_size); + } + break; + } + + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + } + + return TRUE; +} + + +/* Functions for dealing with the e_flags field. */ + +/* Merge backend specific data from an object file to the output + object file when linking. */ + +static bfd_boolean +elf_xtensa_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + unsigned out_mach, in_mach; + flagword out_flag, in_flag; + + /* Check if we have the same endianess. */ + if (!_bfd_generic_verify_endian_match (ibfd, obfd)) + return FALSE; + + /* Don't even pretend to support mixed-format linking. */ + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return FALSE; + + out_flag = elf_elfheader (obfd)->e_flags; + in_flag = elf_elfheader (ibfd)->e_flags; + + out_mach = out_flag & EF_XTENSA_MACH; + in_mach = in_flag & EF_XTENSA_MACH; + if (out_mach != in_mach) + { + (*_bfd_error_handler) + ("%s: incompatible machine type. Output is 0x%x. Input is 0x%x", + bfd_archive_filename (ibfd), out_mach, in_mach); + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } + + if (! elf_flags_init (obfd)) + { + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = in_flag; + + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) + && bfd_get_arch_info (obfd)->the_default) + return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), + bfd_get_mach (ibfd)); + + return TRUE; + } + + if ((out_flag & EF_XTENSA_XT_INSN) != + (in_flag & EF_XTENSA_XT_INSN)) + elf_elfheader(obfd)->e_flags &= (~ EF_XTENSA_XT_INSN); + + if ((out_flag & EF_XTENSA_XT_LIT) != + (in_flag & EF_XTENSA_XT_LIT)) + elf_elfheader(obfd)->e_flags &= (~ EF_XTENSA_XT_LIT); + + return TRUE; +} + + +static bfd_boolean +elf_xtensa_set_private_flags (abfd, flags) + bfd *abfd; + flagword flags; +{ + BFD_ASSERT (!elf_flags_init (abfd) + || elf_elfheader (abfd)->e_flags == flags); + + elf_elfheader (abfd)->e_flags |= flags; + elf_flags_init (abfd) = TRUE; + + return TRUE; +} + + +extern flagword +elf_xtensa_get_private_bfd_flags (abfd) + bfd *abfd; +{ + return elf_elfheader (abfd)->e_flags; +} + + +static bfd_boolean +elf_xtensa_print_private_bfd_data (abfd, farg) + bfd *abfd; + PTR farg; +{ + FILE *f = (FILE *) farg; + flagword e_flags = elf_elfheader (abfd)->e_flags; + + fprintf (f, "\nXtensa header:\n"); + if ((e_flags & EF_XTENSA_MACH) == E_XTENSA_MACH) + fprintf (f, "\nMachine = Base\n"); + else + fprintf (f, "\nMachine Id = 0x%x\n", e_flags & EF_XTENSA_MACH); + + fprintf (f, "Insn tables = %s\n", + (e_flags & EF_XTENSA_XT_INSN) ? "true" : "false"); + + fprintf (f, "Literal tables = %s\n", + (e_flags & EF_XTENSA_XT_LIT) ? "true" : "false"); + + return _bfd_elf_print_private_bfd_data (abfd, farg); +} + + +/* Set the right machine number for an Xtensa ELF file. */ + +static bfd_boolean +elf_xtensa_object_p (abfd) + bfd *abfd; +{ + int mach; + unsigned long arch = elf_elfheader (abfd)->e_flags & EF_XTENSA_MACH; + + switch (arch) + { + case E_XTENSA_MACH: + mach = bfd_mach_xtensa; + break; + default: + return FALSE; + } + + (void) bfd_default_set_arch_mach (abfd, bfd_arch_xtensa, mach); + return TRUE; +} + + +/* The final processing done just before writing out an Xtensa ELF object + file. This gets the Xtensa architecture right based on the machine + number. */ + +static void +elf_xtensa_final_write_processing (abfd, linker) + bfd *abfd; + bfd_boolean linker ATTRIBUTE_UNUSED; +{ + int mach; + unsigned long val; + + switch (mach = bfd_get_mach (abfd)) + { + case bfd_mach_xtensa: + val = E_XTENSA_MACH; + break; + default: + return; + } + + elf_elfheader (abfd)->e_flags &= (~ EF_XTENSA_MACH); + elf_elfheader (abfd)->e_flags |= val; +} + + +static enum elf_reloc_type_class +elf_xtensa_reloc_type_class (rela) + const Elf_Internal_Rela *rela; +{ + switch ((int) ELF32_R_TYPE (rela->r_info)) + { + case R_XTENSA_RELATIVE: + return reloc_class_relative; + case R_XTENSA_JMP_SLOT: + return reloc_class_plt; + default: + return reloc_class_normal; + } +} + + +static bfd_boolean +elf_xtensa_discard_info_for_section (abfd, cookie, info, sec) + bfd *abfd; + struct elf_reloc_cookie *cookie; + struct bfd_link_info *info; + asection *sec; +{ + bfd_byte *contents; + bfd_vma section_size; + bfd_vma offset, actual_offset; + size_t removed_bytes = 0; + + section_size = (sec->_cooked_size ? sec->_cooked_size : sec->_raw_size); + if (section_size == 0 || section_size % 8 != 0) + return FALSE; + + if (sec->output_section + && bfd_is_abs_section (sec->output_section)) + return FALSE; + + contents = retrieve_contents (abfd, sec, info->keep_memory); + if (!contents) + return FALSE; + + cookie->rels = retrieve_internal_relocs (abfd, sec, info->keep_memory); + if (!cookie->rels) + { + release_contents (sec, contents); + return FALSE; + } + + cookie->rel = cookie->rels; + cookie->relend = cookie->rels + sec->reloc_count; + + for (offset = 0; offset < section_size; offset += 8) + { + actual_offset = offset - removed_bytes; + + /* The ...symbol_deleted_p function will skip over relocs but it + won't adjust their offsets, so do that here. */ + while (cookie->rel < cookie->relend + && cookie->rel->r_offset < offset) + { + cookie->rel->r_offset -= removed_bytes; + cookie->rel++; + } + + while (cookie->rel < cookie->relend + && cookie->rel->r_offset == offset) + { + if (bfd_elf_reloc_symbol_deleted_p (offset, cookie)) + { + /* Remove the table entry. (If the reloc type is NONE, then + the entry has already been merged with another and deleted + during relaxation.) */ + if (ELF32_R_TYPE (cookie->rel->r_info) != R_XTENSA_NONE) + { + /* Shift the contents up. */ + if (offset + 8 < section_size) + memmove (&contents[actual_offset], + &contents[actual_offset+8], + section_size - offset - 8); + removed_bytes += 8; + } + + /* Remove this relocation. */ + cookie->rel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE); + } + + /* Adjust the relocation offset for previous removals. This + should not be done before calling ...symbol_deleted_p + because it might mess up the offset comparisons there. + Make sure the offset doesn't underflow in the case where + the first entry is removed. */ + if (cookie->rel->r_offset >= removed_bytes) + cookie->rel->r_offset -= removed_bytes; + else + cookie->rel->r_offset = 0; + + cookie->rel++; + } + } + + if (removed_bytes != 0) + { + /* Adjust any remaining relocs (shouldn't be any). */ + for (; cookie->rel < cookie->relend; cookie->rel++) + { + if (cookie->rel->r_offset >= removed_bytes) + cookie->rel->r_offset -= removed_bytes; + else + cookie->rel->r_offset = 0; + } + + /* Clear the removed bytes. */ + memset (&contents[section_size - removed_bytes], 0, removed_bytes); + + pin_contents (sec, contents); + pin_internal_relocs (sec, cookie->rels); + + sec->_cooked_size = section_size - removed_bytes; + /* Also shrink _raw_size. See comments in relax_property_section. */ + sec->_raw_size = sec->_cooked_size; + + if (xtensa_is_littable_section (sec)) + { + bfd *dynobj = elf_hash_table (info)->dynobj; + if (dynobj) + { + asection *sgotloc = + bfd_get_section_by_name (dynobj, ".got.loc"); + if (sgotloc) + { + bfd_size_type sgotloc_size = + (sgotloc->_cooked_size ? sgotloc->_cooked_size + : sgotloc->_raw_size); + sgotloc->_cooked_size = sgotloc_size - removed_bytes; + sgotloc->_raw_size = sgotloc_size - removed_bytes; + } + } + } + } + else + { + release_contents (sec, contents); + release_internal_relocs (sec, cookie->rels); + } + + return (removed_bytes != 0); +} + + +static bfd_boolean +elf_xtensa_discard_info (abfd, cookie, info) + bfd *abfd; + struct elf_reloc_cookie *cookie; + struct bfd_link_info *info; +{ + asection *sec; + bfd_boolean changed = FALSE; + + for (sec = abfd->sections; sec != NULL; sec = sec->next) + { + if (xtensa_is_property_section (sec)) + { + if (elf_xtensa_discard_info_for_section (abfd, cookie, info, sec)) + changed = TRUE; + } + } + + return changed; +} + + +static bfd_boolean +elf_xtensa_ignore_discarded_relocs (sec) + asection *sec; +{ + return xtensa_is_property_section (sec); +} + + +/* Support for core dump NOTE sections. */ + +static bfd_boolean +elf_xtensa_grok_prstatus (abfd, note) + bfd *abfd; + Elf_Internal_Note *note; +{ + int offset; + unsigned int raw_size; + + /* The size for Xtensa is variable, so don't try to recognize the format + based on the size. Just assume this is GNU/Linux. */ + + /* pr_cursig */ + elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); + + /* pr_pid */ + elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + + /* pr_reg */ + offset = 72; + raw_size = note->descsz - offset - 4; + + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", + raw_size, note->descpos + offset); +} + + +static bfd_boolean +elf_xtensa_grok_psinfo (abfd, note) + bfd *abfd; + Elf_Internal_Note *note; +{ + switch (note->descsz) + { + default: + return FALSE; + + case 128: /* GNU/Linux elf_prpsinfo */ + elf_tdata (abfd)->core_program + = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16); + elf_tdata (abfd)->core_command + = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80); + } + + /* Note that for some reason, a spurious space is tacked + onto the end of the args in some (at least one anyway) + implementations, so strip it off if it exists. */ + + { + char *command = elf_tdata (abfd)->core_command; + int n = strlen (command); + + if (0 < n && command[n - 1] == ' ') + command[n - 1] = '\0'; + } + + return TRUE; +} + + +/* Generic Xtensa configurability stuff. */ + +static xtensa_opcode callx0_op = XTENSA_UNDEFINED; +static xtensa_opcode callx4_op = XTENSA_UNDEFINED; +static xtensa_opcode callx8_op = XTENSA_UNDEFINED; +static xtensa_opcode callx12_op = XTENSA_UNDEFINED; +static xtensa_opcode call0_op = XTENSA_UNDEFINED; +static xtensa_opcode call4_op = XTENSA_UNDEFINED; +static xtensa_opcode call8_op = XTENSA_UNDEFINED; +static xtensa_opcode call12_op = XTENSA_UNDEFINED; + +static void +init_call_opcodes () +{ + if (callx0_op == XTENSA_UNDEFINED) + { + callx0_op = xtensa_opcode_lookup (xtensa_default_isa, "callx0"); + callx4_op = xtensa_opcode_lookup (xtensa_default_isa, "callx4"); + callx8_op = xtensa_opcode_lookup (xtensa_default_isa, "callx8"); + callx12_op = xtensa_opcode_lookup (xtensa_default_isa, "callx12"); + call0_op = xtensa_opcode_lookup (xtensa_default_isa, "call0"); + call4_op = xtensa_opcode_lookup (xtensa_default_isa, "call4"); + call8_op = xtensa_opcode_lookup (xtensa_default_isa, "call8"); + call12_op = xtensa_opcode_lookup (xtensa_default_isa, "call12"); + } +} + + +static bfd_boolean +is_indirect_call_opcode (opcode) + xtensa_opcode opcode; +{ + init_call_opcodes (); + return (opcode == callx0_op + || opcode == callx4_op + || opcode == callx8_op + || opcode == callx12_op); +} + + +static bfd_boolean +is_direct_call_opcode (opcode) + xtensa_opcode opcode; +{ + init_call_opcodes (); + return (opcode == call0_op + || opcode == call4_op + || opcode == call8_op + || opcode == call12_op); +} + + +static bfd_boolean +is_windowed_call_opcode (opcode) + xtensa_opcode opcode; +{ + init_call_opcodes (); + return (opcode == call4_op + || opcode == call8_op + || opcode == call12_op + || opcode == callx4_op + || opcode == callx8_op + || opcode == callx12_op); +} + + +static xtensa_opcode +get_l32r_opcode (void) +{ + static xtensa_opcode l32r_opcode = XTENSA_UNDEFINED; + if (l32r_opcode == XTENSA_UNDEFINED) + { + l32r_opcode = xtensa_opcode_lookup (xtensa_default_isa, "l32r"); + BFD_ASSERT (l32r_opcode != XTENSA_UNDEFINED); + } + return l32r_opcode; +} + + +static bfd_vma +l32r_offset (addr, pc) + bfd_vma addr; + bfd_vma pc; +{ + bfd_vma offset; + + offset = addr - ((pc+3) & -4); + BFD_ASSERT ((offset & ((1 << 2) - 1)) == 0); + offset = (signed int) offset >> 2; + BFD_ASSERT ((signed int) offset >> 16 == -1); + return offset; +} + + +/* Get the operand number for a PC-relative relocation. + If the relocation is not a PC-relative one, return (-1). */ + +static int +get_relocation_opnd (irel) + Elf_Internal_Rela *irel; +{ + if (ELF32_R_TYPE (irel->r_info) < R_XTENSA_OP0 + || ELF32_R_TYPE (irel->r_info) >= R_XTENSA_max) + return -1; + return ELF32_R_TYPE (irel->r_info) - R_XTENSA_OP0; +} + + +/* Get the opcode for a relocation. */ + +static xtensa_opcode +get_relocation_opcode (sec, contents, irel) + asection *sec; + bfd_byte *contents; + Elf_Internal_Rela *irel; +{ + static xtensa_insnbuf ibuff = NULL; + xtensa_isa isa = xtensa_default_isa; + + if (get_relocation_opnd (irel) == -1) + return XTENSA_UNDEFINED; + + if (contents == NULL) + return XTENSA_UNDEFINED; + + if (sec->_raw_size <= irel->r_offset) + return XTENSA_UNDEFINED; + + if (ibuff == NULL) + ibuff = xtensa_insnbuf_alloc (isa); + + /* Decode the instruction. */ + xtensa_insnbuf_from_chars (isa, ibuff, &contents[irel->r_offset]); + return xtensa_decode_insn (isa, ibuff); +} + + +bfd_boolean +is_l32r_relocation (sec, contents, irel) + asection *sec; + bfd_byte *contents; + Elf_Internal_Rela *irel; +{ + xtensa_opcode opcode; + + if (ELF32_R_TYPE (irel->r_info) != R_XTENSA_OP1) + return FALSE; + + opcode = get_relocation_opcode (sec, contents, irel); + return (opcode == get_l32r_opcode ()); +} + + +/* Code for transforming CALLs at link-time. */ + +static bfd_reloc_status_type +elf_xtensa_do_asm_simplify (contents, address, content_length) + bfd_byte *contents; + bfd_vma address; + bfd_vma content_length; +{ + static xtensa_insnbuf insnbuf = NULL; + xtensa_opcode opcode; + xtensa_operand operand; + xtensa_opcode direct_call_opcode; + xtensa_isa isa = xtensa_default_isa; + bfd_byte *chbuf = contents + address; + int opn; + + if (insnbuf == NULL) + insnbuf = xtensa_insnbuf_alloc (isa); + + if (content_length < address) + { + (*_bfd_error_handler) + ("Attempt to convert L32R/CALLX to CALL failed"); + return bfd_reloc_other; + } + + opcode = get_expanded_call_opcode (chbuf, content_length - address); + direct_call_opcode = swap_callx_for_call_opcode (opcode); + if (direct_call_opcode == XTENSA_UNDEFINED) + { + (*_bfd_error_handler) + ("Attempt to convert L32R/CALLX to CALL failed"); + return bfd_reloc_other; + } + + /* Assemble a NOP ("or a1, a1, a1") into the 0 byte offset. */ + opcode = xtensa_opcode_lookup (isa, "or"); + xtensa_encode_insn (isa, opcode, insnbuf); + for (opn = 0; opn < 3; opn++) + { + operand = xtensa_get_operand (isa, opcode, opn); + xtensa_operand_set_field (operand, insnbuf, 1); + } + xtensa_insnbuf_to_chars (isa, insnbuf, chbuf); + + /* Assemble a CALL ("callN 0") into the 3 byte offset. */ + xtensa_encode_insn (isa, direct_call_opcode, insnbuf); + operand = xtensa_get_operand (isa, opcode, 0); + xtensa_operand_set_field (operand, insnbuf, 0); + xtensa_insnbuf_to_chars (isa, insnbuf, chbuf + 3); + + return bfd_reloc_ok; +} + + +static bfd_reloc_status_type +contract_asm_expansion (contents, content_length, irel) + bfd_byte *contents; + bfd_vma content_length; + Elf_Internal_Rela *irel; +{ + bfd_reloc_status_type retval = + elf_xtensa_do_asm_simplify (contents, irel->r_offset, content_length); + + if (retval != bfd_reloc_ok) + return retval; + + /* Update the irel->r_offset field so that the right immediate and + the right instruction are modified during the relocation. */ + irel->r_offset += 3; + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), R_XTENSA_OP0); + return bfd_reloc_ok; +} + + +static xtensa_opcode +swap_callx_for_call_opcode (opcode) + xtensa_opcode opcode; +{ + init_call_opcodes (); + + if (opcode == callx0_op) return call0_op; + if (opcode == callx4_op) return call4_op; + if (opcode == callx8_op) return call8_op; + if (opcode == callx12_op) return call12_op; + + /* Return XTENSA_UNDEFINED if the opcode is not an indirect call. */ + return XTENSA_UNDEFINED; +} + + +/* Check if "buf" is pointing to a "L32R aN; CALLX aN" sequence, and + if so, return the CALLX opcode. If not, return XTENSA_UNDEFINED. */ + +#define L32R_TARGET_REG_OPERAND 0 +#define CALLN_SOURCE_OPERAND 0 + +static xtensa_opcode +get_expanded_call_opcode (buf, bufsize) + bfd_byte *buf; + int bufsize; +{ + static xtensa_insnbuf insnbuf = NULL; + xtensa_opcode opcode; + xtensa_operand operand; + xtensa_isa isa = xtensa_default_isa; + uint32 regno, call_regno; + + /* Buffer must be at least 6 bytes. */ + if (bufsize < 6) + return XTENSA_UNDEFINED; + + if (insnbuf == NULL) + insnbuf = xtensa_insnbuf_alloc (isa); + + xtensa_insnbuf_from_chars (isa, insnbuf, buf); + opcode = xtensa_decode_insn (isa, insnbuf); + + if (opcode != get_l32r_opcode ()) + return XTENSA_UNDEFINED; + + operand = xtensa_get_operand (isa, opcode, L32R_TARGET_REG_OPERAND); + regno = xtensa_operand_decode + (operand, xtensa_operand_get_field (operand, insnbuf)); + + /* Next instruction should be an CALLXn with operand 0 == regno. */ + xtensa_insnbuf_from_chars (isa, insnbuf, + buf + xtensa_insn_length (isa, opcode)); + opcode = xtensa_decode_insn (isa, insnbuf); + + if (!is_indirect_call_opcode (opcode)) + return XTENSA_UNDEFINED; + + operand = xtensa_get_operand (isa, opcode, CALLN_SOURCE_OPERAND); + call_regno = xtensa_operand_decode + (operand, xtensa_operand_get_field (operand, insnbuf)); + if (call_regno != regno) + return XTENSA_UNDEFINED; + + return opcode; +} + + +/* Data structures used during relaxation. */ + +/* r_reloc: relocation values. */ + +/* Through the relaxation process, we need to keep track of the values + that will result from evaluating relocations. The standard ELF + relocation structure is not sufficient for this purpose because we're + operating on multiple input files at once, so we need to know which + input file a relocation refers to. The r_reloc structure thus + records both the input file (bfd) and ELF relocation. + + For efficiency, an r_reloc also contains a "target_offset" field to + cache the target-section-relative offset value that is represented by + the relocation. */ + +typedef struct r_reloc_struct r_reloc; + +struct r_reloc_struct +{ + bfd *abfd; + Elf_Internal_Rela rela; + bfd_vma target_offset; +}; + +static bfd_boolean r_reloc_is_const + PARAMS ((const r_reloc *)); +static void r_reloc_init + PARAMS ((r_reloc *, bfd *, Elf_Internal_Rela *)); +static bfd_vma r_reloc_get_target_offset + PARAMS ((const r_reloc *)); +static asection *r_reloc_get_section + PARAMS ((const r_reloc *)); +static bfd_boolean r_reloc_is_defined + PARAMS ((const r_reloc *)); +static struct elf_link_hash_entry *r_reloc_get_hash_entry + PARAMS ((const r_reloc *)); + + +/* The r_reloc structure is included by value in literal_value, but not + every literal_value has an associated relocation -- some are simple + constants. In such cases, we set all the fields in the r_reloc + struct to zero. The r_reloc_is_const function should be used to + detect this case. */ + +static bfd_boolean +r_reloc_is_const (r_rel) + const r_reloc *r_rel; +{ + return (r_rel->abfd == NULL); +} + + +static void +r_reloc_init (r_rel, abfd, irel) + r_reloc *r_rel; + bfd *abfd; + Elf_Internal_Rela *irel; +{ + if (irel != NULL) + { + r_rel->rela = *irel; + r_rel->abfd = abfd; + r_rel->target_offset = r_reloc_get_target_offset (r_rel); + } + else + memset (r_rel, 0, sizeof (r_reloc)); +} + + +static bfd_vma +r_reloc_get_target_offset (r_rel) + const r_reloc *r_rel; +{ + bfd_vma target_offset; + unsigned long r_symndx; + + BFD_ASSERT (!r_reloc_is_const (r_rel)); + r_symndx = ELF32_R_SYM (r_rel->rela.r_info); + target_offset = get_elf_r_symndx_offset (r_rel->abfd, r_symndx); + return (target_offset + r_rel->rela.r_addend); +} + + +static struct elf_link_hash_entry * +r_reloc_get_hash_entry (r_rel) + const r_reloc *r_rel; +{ + unsigned long r_symndx = ELF32_R_SYM (r_rel->rela.r_info); + return get_elf_r_symndx_hash_entry (r_rel->abfd, r_symndx); +} + + +static asection * +r_reloc_get_section (r_rel) + const r_reloc *r_rel; +{ + unsigned long r_symndx = ELF32_R_SYM (r_rel->rela.r_info); + return get_elf_r_symndx_section (r_rel->abfd, r_symndx); +} + + +static bfd_boolean +r_reloc_is_defined (r_rel) + const r_reloc *r_rel; +{ + asection *sec = r_reloc_get_section (r_rel); + if (sec == bfd_abs_section_ptr + || sec == bfd_com_section_ptr + || sec == bfd_und_section_ptr) + return FALSE; + return TRUE; +} + + +/* source_reloc: relocations that reference literal sections. */ + +/* To determine whether literals can be coalesced, we need to first + record all the relocations that reference the literals. The + source_reloc structure below is used for this purpose. The + source_reloc entries are kept in a per-literal-section array, sorted + by offset within the literal section (i.e., target offset). + + The source_sec and r_rel.rela.r_offset fields identify the source of + the relocation. The r_rel field records the relocation value, i.e., + the offset of the literal being referenced. The opnd field is needed + to determine the range of the immediate field to which the relocation + applies, so we can determine whether another literal with the same + value is within range. The is_null field is true when the relocation + is being removed (e.g., when an L32R is being removed due to a CALLX + that is converted to a direct CALL). */ + +typedef struct source_reloc_struct source_reloc; + +struct source_reloc_struct +{ + asection *source_sec; + r_reloc r_rel; + xtensa_operand opnd; + bfd_boolean is_null; +}; + + +static void init_source_reloc + PARAMS ((source_reloc *, asection *, const r_reloc *, xtensa_operand)); +static source_reloc *find_source_reloc + PARAMS ((source_reloc *, int, asection *, Elf_Internal_Rela *)); +static int source_reloc_compare + PARAMS ((const PTR, const PTR)); + + +static void +init_source_reloc (reloc, source_sec, r_rel, opnd) + source_reloc *reloc; + asection *source_sec; + const r_reloc *r_rel; + xtensa_operand opnd; +{ + reloc->source_sec = source_sec; + reloc->r_rel = *r_rel; + reloc->opnd = opnd; + reloc->is_null = FALSE; +} + + +/* Find the source_reloc for a particular source offset and relocation + type. Note that the array is sorted by _target_ offset, so this is + just a linear search. */ + +static source_reloc * +find_source_reloc (src_relocs, src_count, sec, irel) + source_reloc *src_relocs; + int src_count; + asection *sec; + Elf_Internal_Rela *irel; +{ + int i; + + for (i = 0; i < src_count; i++) + { + if (src_relocs[i].source_sec == sec + && src_relocs[i].r_rel.rela.r_offset == irel->r_offset + && (ELF32_R_TYPE (src_relocs[i].r_rel.rela.r_info) + == ELF32_R_TYPE (irel->r_info))) + return &src_relocs[i]; + } + + return NULL; +} + + +static int +source_reloc_compare (ap, bp) + const PTR ap; + const PTR bp; +{ + const source_reloc *a = (const source_reloc *) ap; + const source_reloc *b = (const source_reloc *) bp; + + return (a->r_rel.target_offset - b->r_rel.target_offset); +} + + +/* Literal values and value hash tables. */ + +/* Literals with the same value can be coalesced. The literal_value + structure records the value of a literal: the "r_rel" field holds the + information from the relocation on the literal (if there is one) and + the "value" field holds the contents of the literal word itself. + + The value_map structure records a literal value along with the + location of a literal holding that value. The value_map hash table + is indexed by the literal value, so that we can quickly check if a + particular literal value has been seen before and is thus a candidate + for coalescing. */ + +typedef struct literal_value_struct literal_value; +typedef struct value_map_struct value_map; +typedef struct value_map_hash_table_struct value_map_hash_table; + +struct literal_value_struct +{ + r_reloc r_rel; + unsigned long value; +}; + +struct value_map_struct +{ + literal_value val; /* The literal value. */ + r_reloc loc; /* Location of the literal. */ + value_map *next; +}; + +struct value_map_hash_table_struct +{ + unsigned bucket_count; + value_map **buckets; + unsigned count; +}; + + +static bfd_boolean is_same_value + PARAMS ((const literal_value *, const literal_value *, bfd_boolean)); +static value_map_hash_table *value_map_hash_table_init + PARAMS ((void)); +static unsigned hash_literal_value + PARAMS ((const literal_value *)); +static unsigned hash_bfd_vma + PARAMS ((bfd_vma)); +static value_map *get_cached_value + PARAMS ((value_map_hash_table *, const literal_value *, bfd_boolean)); +static value_map *add_value_map + PARAMS ((value_map_hash_table *, const literal_value *, const r_reloc *, + bfd_boolean)); + + +static bfd_boolean +is_same_value (src1, src2, final_static_link) + const literal_value *src1; + const literal_value *src2; + bfd_boolean final_static_link; +{ + struct elf_link_hash_entry *h1, *h2; + + if (r_reloc_is_const (&src1->r_rel) != r_reloc_is_const (&src2->r_rel)) + return FALSE; + + if (r_reloc_is_const (&src1->r_rel)) + return (src1->value == src2->value); + + if (ELF32_R_TYPE (src1->r_rel.rela.r_info) + != ELF32_R_TYPE (src2->r_rel.rela.r_info)) + return FALSE; + + if (r_reloc_get_target_offset (&src1->r_rel) + != r_reloc_get_target_offset (&src2->r_rel)) + return FALSE; + + if (src1->value != src2->value) + return FALSE; + + /* Now check for the same section (if defined) or the same elf_hash + (if undefined or weak). */ + h1 = r_reloc_get_hash_entry (&src1->r_rel); + h2 = r_reloc_get_hash_entry (&src2->r_rel); + if (r_reloc_is_defined (&src1->r_rel) + && (final_static_link + || ((!h1 || h1->root.type != bfd_link_hash_defweak) + && (!h2 || h2->root.type != bfd_link_hash_defweak)))) + { + if (r_reloc_get_section (&src1->r_rel) + != r_reloc_get_section (&src2->r_rel)) + return FALSE; + } + else + { + /* Require that the hash entries (i.e., symbols) be identical. */ + if (h1 != h2 || h1 == 0) + return FALSE; + } + + return TRUE; +} + + +/* Must be power of 2. */ +#define INITIAL_HASH_RELOC_BUCKET_COUNT 1024 + +static value_map_hash_table * +value_map_hash_table_init () +{ + value_map_hash_table *values; + + values = (value_map_hash_table *) + bfd_malloc (sizeof (value_map_hash_table)); + + values->bucket_count = INITIAL_HASH_RELOC_BUCKET_COUNT; + values->count = 0; + values->buckets = (value_map **) + bfd_zmalloc (sizeof (value_map *) * values->bucket_count); + + return values; +} + + +static unsigned +hash_bfd_vma (val) + bfd_vma val; +{ + return (val >> 2) + (val >> 10); +} + + +static unsigned +hash_literal_value (src) + const literal_value *src; +{ + unsigned hash_val; + + if (r_reloc_is_const (&src->r_rel)) + return hash_bfd_vma (src->value); + + hash_val = (hash_bfd_vma (r_reloc_get_target_offset (&src->r_rel)) + + hash_bfd_vma (src->value)); + + /* Now check for the same section and the same elf_hash. */ + if (r_reloc_is_defined (&src->r_rel)) + hash_val += hash_bfd_vma ((bfd_vma) (unsigned) r_reloc_get_section (&src->r_rel)); + else + hash_val += hash_bfd_vma ((bfd_vma) (unsigned) r_reloc_get_hash_entry (&src->r_rel)); + + return hash_val; +} + + +/* Check if the specified literal_value has been seen before. */ + +static value_map * +get_cached_value (map, val, final_static_link) + value_map_hash_table *map; + const literal_value *val; + bfd_boolean final_static_link; +{ + value_map *map_e; + value_map *bucket; + unsigned idx; + + idx = hash_literal_value (val); + idx = idx & (map->bucket_count - 1); + bucket = map->buckets[idx]; + for (map_e = bucket; map_e; map_e = map_e->next) + { + if (is_same_value (&map_e->val, val, final_static_link)) + return map_e; + } + return NULL; +} + + +/* Record a new literal value. It is illegal to call this if VALUE + already has an entry here. */ + +static value_map * +add_value_map (map, val, loc, final_static_link) + value_map_hash_table *map; + const literal_value *val; + const r_reloc *loc; + bfd_boolean final_static_link; +{ + value_map **bucket_p; + unsigned idx; + + value_map *val_e = (value_map *) bfd_zmalloc (sizeof (value_map)); + + BFD_ASSERT (get_cached_value (map, val, final_static_link) == NULL); + val_e->val = *val; + val_e->loc = *loc; + + idx = hash_literal_value (val); + idx = idx & (map->bucket_count - 1); + bucket_p = &map->buckets[idx]; + + val_e->next = *bucket_p; + *bucket_p = val_e; + map->count++; + /* FIXME: consider resizing the hash table if we get too many entries */ + + return val_e; +} + + +/* Lists of literals being coalesced or removed. */ + +/* In the usual case, the literal identified by "from" is being + coalesced with another literal identified by "to". If the literal is + unused and is being removed altogether, "to.abfd" will be NULL. + The removed_literal entries are kept on a per-section list, sorted + by the "from" offset field. */ + +typedef struct removed_literal_struct removed_literal; +typedef struct removed_literal_list_struct removed_literal_list; + +struct removed_literal_struct +{ + r_reloc from; + r_reloc to; + removed_literal *next; +}; + +struct removed_literal_list_struct +{ + removed_literal *head; + removed_literal *tail; +}; + + +static void add_removed_literal + PARAMS ((removed_literal_list *, const r_reloc *, const r_reloc *)); +static removed_literal *find_removed_literal + PARAMS ((removed_literal_list *, bfd_vma)); +static bfd_vma offset_with_removed_literals + PARAMS ((removed_literal_list *, bfd_vma)); + + +/* Record that the literal at "from" is being removed. If "to" is not + NULL, the "from" literal is being coalesced with the "to" literal. */ + +static void +add_removed_literal (removed_list, from, to) + removed_literal_list *removed_list; + const r_reloc *from; + const r_reloc *to; +{ + removed_literal *r, *new_r, *next_r; + + new_r = (removed_literal *) bfd_zmalloc (sizeof (removed_literal)); + + new_r->from = *from; + if (to) + new_r->to = *to; + else + new_r->to.abfd = NULL; + new_r->next = NULL; + + r = removed_list->head; + if (r == NULL) + { + removed_list->head = new_r; + removed_list->tail = new_r; + } + /* Special check for common case of append. */ + else if (removed_list->tail->from.target_offset < from->target_offset) + { + removed_list->tail->next = new_r; + removed_list->tail = new_r; + } + else + { + while (r->from.target_offset < from->target_offset + && r->next != NULL) + { + r = r->next; + } + next_r = r->next; + r->next = new_r; + new_r->next = next_r; + if (next_r == NULL) + removed_list->tail = new_r; + } +} + + +/* Check if the list of removed literals contains an entry for the + given address. Return the entry if found. */ + +static removed_literal * +find_removed_literal (removed_list, addr) + removed_literal_list *removed_list; + bfd_vma addr; +{ + removed_literal *r = removed_list->head; + while (r && r->from.target_offset < addr) + r = r->next; + if (r && r->from.target_offset == addr) + return r; + return NULL; +} + + +/* Adjust an offset in a section to compensate for literals that are + being removed. Search the list of removed literals and subtract + 4 bytes for every removed literal prior to the given address. */ + +static bfd_vma +offset_with_removed_literals (removed_list, addr) + removed_literal_list *removed_list; + bfd_vma addr; +{ + removed_literal *r = removed_list->head; + unsigned num_bytes = 0; + + if (r == NULL) + return addr; + + while (r && r->from.target_offset <= addr) + { + num_bytes += 4; + r = r->next; + } + if (num_bytes > addr) + return 0; + return (addr - num_bytes); +} + + +/* Coalescing literals may require a relocation to refer to a section in + a different input file, but the standard relocation information + cannot express that. Instead, the reloc_bfd_fix structures are used + to "fix" the relocations that refer to sections in other input files. + These structures are kept on per-section lists. The "src_type" field + records the relocation type in case there are multiple relocations on + the same location. FIXME: This is ugly; an alternative might be to + add new symbols with the "owner" field to some other input file. */ + +typedef struct reloc_bfd_fix_struct reloc_bfd_fix; + +struct reloc_bfd_fix_struct +{ + asection *src_sec; + bfd_vma src_offset; + unsigned src_type; /* Relocation type. */ + + bfd *target_abfd; + asection *target_sec; + bfd_vma target_offset; + + reloc_bfd_fix *next; +}; + + +static reloc_bfd_fix *reloc_bfd_fix_init + PARAMS ((asection *, bfd_vma, unsigned, bfd *, asection *, bfd_vma)); +static reloc_bfd_fix *get_bfd_fix + PARAMS ((reloc_bfd_fix *, asection *, bfd_vma, unsigned)); + + +static reloc_bfd_fix * +reloc_bfd_fix_init (src_sec, src_offset, src_type, + target_abfd, target_sec, target_offset) + asection *src_sec; + bfd_vma src_offset; + unsigned src_type; + bfd *target_abfd; + asection *target_sec; + bfd_vma target_offset; +{ + reloc_bfd_fix *fix; + + fix = (reloc_bfd_fix *) bfd_malloc (sizeof (reloc_bfd_fix)); + fix->src_sec = src_sec; + fix->src_offset = src_offset; + fix->src_type = src_type; + fix->target_abfd = target_abfd; + fix->target_sec = target_sec; + fix->target_offset = target_offset; + + return fix; +} + + +static reloc_bfd_fix * +get_bfd_fix (fix_list, sec, offset, type) + reloc_bfd_fix *fix_list; + asection *sec; + bfd_vma offset; + unsigned type; +{ + reloc_bfd_fix *r; + + for (r = fix_list; r != NULL; r = r->next) + { + if (r->src_sec == sec + && r->src_offset == offset + && r->src_type == type) + return r; + } + return NULL; +} + + +/* Per-section data for relaxation. */ + +struct xtensa_relax_info_struct +{ + bfd_boolean is_relaxable_literal_section; + int visited; /* Number of times visited. */ + + source_reloc *src_relocs; /* Array[src_count]. */ + int src_count; + int src_next; /* Next src_relocs entry to assign. */ + + removed_literal_list removed_list; + + reloc_bfd_fix *fix_list; +}; + +struct elf_xtensa_section_data +{ + struct bfd_elf_section_data elf; + xtensa_relax_info relax_info; +}; + +static void init_xtensa_relax_info + PARAMS ((asection *)); +static xtensa_relax_info *get_xtensa_relax_info + PARAMS ((asection *)); +static void add_fix + PARAMS ((asection *, reloc_bfd_fix *)); + + +static bfd_boolean +elf_xtensa_new_section_hook (abfd, sec) + bfd *abfd; + asection *sec; +{ + struct elf_xtensa_section_data *sdata; + bfd_size_type amt = sizeof (*sdata); + + sdata = (struct elf_xtensa_section_data *) bfd_zalloc (abfd, amt); + if (sdata == NULL) + return FALSE; + sec->used_by_bfd = (PTR) sdata; + + return _bfd_elf_new_section_hook (abfd, sec); +} + + +static void +init_xtensa_relax_info (sec) + asection *sec; +{ + xtensa_relax_info *relax_info = get_xtensa_relax_info (sec); + + relax_info->is_relaxable_literal_section = FALSE; + relax_info->visited = 0; + + relax_info->src_relocs = NULL; + relax_info->src_count = 0; + relax_info->src_next = 0; + + relax_info->removed_list.head = NULL; + relax_info->removed_list.tail = NULL; + + relax_info->fix_list = NULL; +} + + +static xtensa_relax_info * +get_xtensa_relax_info (sec) + asection *sec; +{ + struct elf_xtensa_section_data *section_data; + + /* No info available if no section or if it is an output section. */ + if (!sec || sec == sec->output_section) + return NULL; + + section_data = (struct elf_xtensa_section_data *) elf_section_data (sec); + return §ion_data->relax_info; +} + + +static void +add_fix (src_sec, fix) + asection *src_sec; + reloc_bfd_fix *fix; +{ + xtensa_relax_info *relax_info; + + relax_info = get_xtensa_relax_info (src_sec); + fix->next = relax_info->fix_list; + relax_info->fix_list = fix; +} + + +/* Access to internal relocations, section contents and symbols. */ + +/* During relaxation, we need to modify relocations, section contents, + and symbol definitions, and we need to keep the original values from + being reloaded from the input files, i.e., we need to "pin" the + modified values in memory. We also want to continue to observe the + setting of the "keep-memory" flag. The following functions wrap the + standard BFD functions to take care of this for us. */ + +static Elf_Internal_Rela * +retrieve_internal_relocs (abfd, sec, keep_memory) + bfd *abfd; + asection *sec; + bfd_boolean keep_memory; +{ + Elf_Internal_Rela *internal_relocs; + + if ((sec->flags & SEC_LINKER_CREATED) != 0) + return NULL; + + internal_relocs = elf_section_data (sec)->relocs; + if (internal_relocs == NULL) + internal_relocs = (_bfd_elf_link_read_relocs + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + keep_memory)); + return internal_relocs; +} + + +static void +pin_internal_relocs (sec, internal_relocs) + asection *sec; + Elf_Internal_Rela *internal_relocs; +{ + elf_section_data (sec)->relocs = internal_relocs; +} + + +static void +release_internal_relocs (sec, internal_relocs) + asection *sec; + Elf_Internal_Rela *internal_relocs; +{ + if (internal_relocs + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); +} + + +static bfd_byte * +retrieve_contents (abfd, sec, keep_memory) + bfd *abfd; + asection *sec; + bfd_boolean keep_memory; +{ + bfd_byte *contents; + + contents = elf_section_data (sec)->this_hdr.contents; + + if (contents == NULL && sec->_raw_size != 0) + { + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents != NULL) + { + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + { + free (contents); + return NULL; + } + if (keep_memory) + elf_section_data (sec)->this_hdr.contents = contents; + } + } + return contents; +} + + +static void +pin_contents (sec, contents) + asection *sec; + bfd_byte *contents; +{ + elf_section_data (sec)->this_hdr.contents = contents; +} + + +static void +release_contents (sec, contents) + asection *sec; + bfd_byte *contents; +{ + if (contents && + elf_section_data (sec)->this_hdr.contents != contents) + free (contents); +} + + +static Elf_Internal_Sym * +retrieve_local_syms (input_bfd) + bfd *input_bfd; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Sym *isymbuf; + size_t locsymcount; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; + + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL && locsymcount != 0) + isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, locsymcount, 0, + NULL, NULL, NULL); + + /* Save the symbols for this input file so they won't be read again. */ + if (isymbuf && isymbuf != (Elf_Internal_Sym *) symtab_hdr->contents) + symtab_hdr->contents = (unsigned char *) isymbuf; + + return isymbuf; +} + + +/* Code for link-time relaxation. */ + +/* Local helper functions. */ +static bfd_boolean analyze_relocations + PARAMS ((struct bfd_link_info *)); +static bfd_boolean find_relaxable_sections + PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); +static bfd_boolean collect_source_relocs + PARAMS ((bfd *, asection *, struct bfd_link_info *)); +static bfd_boolean is_resolvable_asm_expansion + PARAMS ((bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, + struct bfd_link_info *, bfd_boolean *)); +static bfd_boolean remove_literals + PARAMS ((bfd *, asection *, struct bfd_link_info *, value_map_hash_table *)); +static bfd_boolean relax_section + PARAMS ((bfd *, asection *, struct bfd_link_info *)); +static bfd_boolean relax_property_section + PARAMS ((bfd *, asection *, struct bfd_link_info *)); +static bfd_boolean relax_section_symbols + PARAMS ((bfd *, asection *)); +static bfd_boolean relocations_reach + PARAMS ((source_reloc *, int, const r_reloc *)); +static void translate_reloc + PARAMS ((const r_reloc *, r_reloc *)); +static Elf_Internal_Rela *get_irel_at_offset + PARAMS ((asection *, Elf_Internal_Rela *, bfd_vma)); +static Elf_Internal_Rela *find_associated_l32r_irel + PARAMS ((asection *, bfd_byte *, Elf_Internal_Rela *, + Elf_Internal_Rela *)); +static void shrink_dynamic_reloc_sections + PARAMS ((struct bfd_link_info *, bfd *, asection *, Elf_Internal_Rela *)); + + +static bfd_boolean +elf_xtensa_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + bfd_boolean *again; +{ + static value_map_hash_table *values = NULL; + xtensa_relax_info *relax_info; + + if (!values) + { + /* Do some overall initialization for relaxation. */ + values = value_map_hash_table_init (); + relaxing_section = TRUE; + if (!analyze_relocations (link_info)) + return FALSE; + } + *again = FALSE; + + /* Don't mess with linker-created sections. */ + if ((sec->flags & SEC_LINKER_CREATED) != 0) + return TRUE; + + relax_info = get_xtensa_relax_info (sec); + BFD_ASSERT (relax_info != NULL); + + switch (relax_info->visited) + { + case 0: + /* Note: It would be nice to fold this pass into + analyze_relocations, but it is important for this step that the + sections be examined in link order. */ + if (!remove_literals (abfd, sec, link_info, values)) + return FALSE; + *again = TRUE; + break; + + case 1: + if (!relax_section (abfd, sec, link_info)) + return FALSE; + *again = TRUE; + break; + + case 2: + if (!relax_section_symbols (abfd, sec)) + return FALSE; + break; + } + + relax_info->visited++; + return TRUE; +} + +/* Initialization for relaxation. */ + +/* This function is called once at the start of relaxation. It scans + all the input sections and marks the ones that are relaxable (i.e., + literal sections with L32R relocations against them). It then + collect source_reloc information for all the relocations against + those relaxable sections. */ + +static bfd_boolean +analyze_relocations (link_info) + struct bfd_link_info *link_info; +{ + bfd *abfd; + asection *sec; + bfd_boolean is_relaxable = FALSE; + + /* Initialize the per-section relaxation info. */ + for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link_next) + for (sec = abfd->sections; sec != NULL; sec = sec->next) + { + init_xtensa_relax_info (sec); + } + + /* Mark relaxable sections (and count relocations against each one). */ + for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link_next) + for (sec = abfd->sections; sec != NULL; sec = sec->next) + { + if (!find_relaxable_sections (abfd, sec, link_info, &is_relaxable)) + return FALSE; + } + + /* Bail out if there are no relaxable sections. */ + if (!is_relaxable) + return TRUE; + + /* Allocate space for source_relocs. */ + for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link_next) + for (sec = abfd->sections; sec != NULL; sec = sec->next) + { + xtensa_relax_info *relax_info; + + relax_info = get_xtensa_relax_info (sec); + if (relax_info->is_relaxable_literal_section) + { + relax_info->src_relocs = (source_reloc *) + bfd_malloc (relax_info->src_count * sizeof (source_reloc)); + } + } + + /* Collect info on relocations against each relaxable section. */ + for (abfd = link_info->input_bfds; abfd != NULL; abfd = abfd->link_next) + for (sec = abfd->sections; sec != NULL; sec = sec->next) + { + if (!collect_source_relocs (abfd, sec, link_info)) + return FALSE; + } + + return TRUE; +} + + +/* Find all the literal sections that might be relaxed. The motivation + for this pass is that collect_source_relocs() needs to record _all_ + the relocations that target each relaxable section. That is + expensive and unnecessary unless the target section is actually going + to be relaxed. This pass identifies all such sections by checking if + they have L32Rs pointing to them. In the process, the total number + of relocations targeting each section is also counted so that we + know how much space to allocate for source_relocs against each + relaxable literal section. */ + +static bfd_boolean +find_relaxable_sections (abfd, sec, link_info, is_relaxable_p) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + bfd_boolean *is_relaxable_p; +{ + Elf_Internal_Rela *internal_relocs; + bfd_byte *contents; + bfd_boolean ok = TRUE; + unsigned i; + + internal_relocs = retrieve_internal_relocs (abfd, sec, + link_info->keep_memory); + if (internal_relocs == NULL) + return ok; + + contents = retrieve_contents (abfd, sec, link_info->keep_memory); + if (contents == NULL && sec->_raw_size != 0) + { + ok = FALSE; + goto error_return; + } + + for (i = 0; i < sec->reloc_count; i++) + { + Elf_Internal_Rela *irel = &internal_relocs[i]; + r_reloc r_rel; + asection *target_sec; + xtensa_relax_info *target_relax_info; + + r_reloc_init (&r_rel, abfd, irel); + + target_sec = r_reloc_get_section (&r_rel); + target_relax_info = get_xtensa_relax_info (target_sec); + if (!target_relax_info) + continue; + + /* Count relocations against the target section. */ + target_relax_info->src_count++; + + if (is_literal_section (target_sec) + && is_l32r_relocation (sec, contents, irel) + && r_reloc_is_defined (&r_rel)) + { + /* Mark the target section as relaxable. */ + target_relax_info->is_relaxable_literal_section = TRUE; + *is_relaxable_p = TRUE; + } + } + + error_return: + release_contents (sec, contents); + release_internal_relocs (sec, internal_relocs); + return ok; +} + + +/* Record _all_ the relocations that point to relaxable literal + sections, and get rid of ASM_EXPAND relocs by either converting them + to ASM_SIMPLIFY or by removing them. */ + +static bfd_boolean +collect_source_relocs (abfd, sec, link_info) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; +{ + Elf_Internal_Rela *internal_relocs; + bfd_byte *contents; + bfd_boolean ok = TRUE; + unsigned i; + + internal_relocs = retrieve_internal_relocs (abfd, sec, + link_info->keep_memory); + if (internal_relocs == NULL) + return ok; + + contents = retrieve_contents (abfd, sec, link_info->keep_memory); + if (contents == NULL && sec->_raw_size != 0) + { + ok = FALSE; + goto error_return; + } + + /* Record relocations against relaxable literal sections. */ + for (i = 0; i < sec->reloc_count; i++) + { + Elf_Internal_Rela *irel = &internal_relocs[i]; + r_reloc r_rel; + asection *target_sec; + xtensa_relax_info *target_relax_info; + + r_reloc_init (&r_rel, abfd, irel); + + target_sec = r_reloc_get_section (&r_rel); + target_relax_info = get_xtensa_relax_info (target_sec); + + if (target_relax_info + && target_relax_info->is_relaxable_literal_section) + { + xtensa_opcode opcode; + xtensa_operand opnd; + source_reloc *s_reloc; + int src_next; + + src_next = target_relax_info->src_next++; + s_reloc = &target_relax_info->src_relocs[src_next]; + + opcode = get_relocation_opcode (sec, contents, irel); + if (opcode == XTENSA_UNDEFINED) + opnd = NULL; + else + opnd = xtensa_get_operand (xtensa_default_isa, opcode, + get_relocation_opnd (irel)); + + init_source_reloc (s_reloc, sec, &r_rel, opnd); + } + } + + /* Now get rid of ASM_EXPAND relocations. At this point, the + src_relocs array for the target literal section may still be + incomplete, but it must at least contain the entries for the L32R + relocations associated with ASM_EXPANDs because they were just + added in the preceding loop over the relocations. */ + + for (i = 0; i < sec->reloc_count; i++) + { + Elf_Internal_Rela *irel = &internal_relocs[i]; + bfd_boolean is_reachable; + + if (!is_resolvable_asm_expansion (abfd, sec, contents, irel, link_info, + &is_reachable)) + continue; + + if (is_reachable) + { + Elf_Internal_Rela *l32r_irel; + r_reloc r_rel; + asection *target_sec; + xtensa_relax_info *target_relax_info; + + /* Mark the source_reloc for the L32R so that it will be + removed in remove_literals(), along with the associated + literal. */ + l32r_irel = find_associated_l32r_irel (sec, contents, + irel, internal_relocs); + if (l32r_irel == NULL) + continue; + + r_reloc_init (&r_rel, abfd, l32r_irel); + + target_sec = r_reloc_get_section (&r_rel); + target_relax_info = get_xtensa_relax_info (target_sec); + + if (target_relax_info + && target_relax_info->is_relaxable_literal_section) + { + source_reloc *s_reloc; + + /* Search the source_relocs for the entry corresponding to + the l32r_irel. Note: The src_relocs array is not yet + sorted, but it wouldn't matter anyway because we're + searching by source offset instead of target offset. */ + s_reloc = find_source_reloc (target_relax_info->src_relocs, + target_relax_info->src_next, + sec, l32r_irel); + BFD_ASSERT (s_reloc); + s_reloc->is_null = TRUE; + } + + /* Convert this reloc to ASM_SIMPLIFY. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + R_XTENSA_ASM_SIMPLIFY); + l32r_irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE); + + pin_internal_relocs (sec, internal_relocs); + } + else + { + /* It is resolvable but doesn't reach. We resolve now + by eliminating the relocation -- the call will remain + expanded into L32R/CALLX. */ + irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE); + pin_internal_relocs (sec, internal_relocs); + } + } + + error_return: + release_contents (sec, contents); + release_internal_relocs (sec, internal_relocs); + return ok; +} + + +/* Return TRUE if the asm expansion can be resolved. Generally it can + be resolved on a final link or when a partial link locates it in the + same section as the target. Set "is_reachable" flag if the target of + the call is within the range of a direct call, given the current VMA + for this section and the target section. */ + +bfd_boolean +is_resolvable_asm_expansion (abfd, sec, contents, irel, link_info, + is_reachable_p) + bfd *abfd; + asection *sec; + bfd_byte *contents; + Elf_Internal_Rela *irel; + struct bfd_link_info *link_info; + bfd_boolean *is_reachable_p; +{ + asection *target_sec; + bfd_vma target_offset; + r_reloc r_rel; + xtensa_opcode opcode, direct_call_opcode; + bfd_vma self_address; + bfd_vma dest_address; + + *is_reachable_p = FALSE; + + if (contents == NULL) + return FALSE; + + if (ELF32_R_TYPE (irel->r_info) != R_XTENSA_ASM_EXPAND) + return FALSE; + + opcode = get_expanded_call_opcode (contents + irel->r_offset, + sec->_raw_size - irel->r_offset); + + direct_call_opcode = swap_callx_for_call_opcode (opcode); + if (direct_call_opcode == XTENSA_UNDEFINED) + return FALSE; + + /* Check and see that the target resolves. */ + r_reloc_init (&r_rel, abfd, irel); + if (!r_reloc_is_defined (&r_rel)) + return FALSE; + + target_sec = r_reloc_get_section (&r_rel); + target_offset = r_reloc_get_target_offset (&r_rel); + + /* If the target is in a shared library, then it doesn't reach. This + isn't supposed to come up because the compiler should never generate + non-PIC calls on systems that use shared libraries, but the linker + shouldn't crash regardless. */ + if (!target_sec->output_section) + return FALSE; + + /* For relocatable sections, we can only simplify when the output + section of the target is the same as the output section of the + source. */ + if (link_info->relocatable + && (target_sec->output_section != sec->output_section)) + return FALSE; + + self_address = (sec->output_section->vma + + sec->output_offset + irel->r_offset + 3); + dest_address = (target_sec->output_section->vma + + target_sec->output_offset + target_offset); + + *is_reachable_p = pcrel_reloc_fits + (xtensa_get_operand (xtensa_default_isa, direct_call_opcode, 0), + self_address, dest_address); + + if ((self_address >> CALL_SEGMENT_BITS) != + (dest_address >> CALL_SEGMENT_BITS)) + return FALSE; + + return TRUE; +} + + +static Elf_Internal_Rela * +find_associated_l32r_irel (sec, contents, other_irel, internal_relocs) + asection *sec; + bfd_byte *contents; + Elf_Internal_Rela *other_irel; + Elf_Internal_Rela *internal_relocs; +{ + unsigned i; + + for (i = 0; i < sec->reloc_count; i++) + { + Elf_Internal_Rela *irel = &internal_relocs[i]; + + if (irel == other_irel) + continue; + if (irel->r_offset != other_irel->r_offset) + continue; + if (is_l32r_relocation (sec, contents, irel)) + return irel; + } + + return NULL; +} + +/* First relaxation pass. */ + +/* If the section is relaxable (i.e., a literal section), check each + literal to see if it has the same value as another literal that has + already been seen, either in the current section or a previous one. + If so, add an entry to the per-section list of removed literals. The + actual changes are deferred until the next pass. */ + +static bfd_boolean +remove_literals (abfd, sec, link_info, values) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + value_map_hash_table *values; +{ + xtensa_relax_info *relax_info; + bfd_byte *contents; + Elf_Internal_Rela *internal_relocs; + source_reloc *src_relocs; + bfd_boolean final_static_link; + bfd_boolean ok = TRUE; + int i; + + /* Do nothing if it is not a relaxable literal section. */ + relax_info = get_xtensa_relax_info (sec); + BFD_ASSERT (relax_info); + + if (!relax_info->is_relaxable_literal_section) + return ok; + + internal_relocs = retrieve_internal_relocs (abfd, sec, + link_info->keep_memory); + + contents = retrieve_contents (abfd, sec, link_info->keep_memory); + if (contents == NULL && sec->_raw_size != 0) + { + ok = FALSE; + goto error_return; + } + + final_static_link = + (!link_info->relocatable + && !elf_hash_table (link_info)->dynamic_sections_created); + + /* Sort the source_relocs by target offset. */ + src_relocs = relax_info->src_relocs; + qsort (src_relocs, relax_info->src_count, + sizeof (source_reloc), source_reloc_compare); + + for (i = 0; i < relax_info->src_count; i++) + { + source_reloc *rel; + Elf_Internal_Rela *irel = NULL; + literal_value val; + value_map *val_map; + + rel = &src_relocs[i]; + irel = get_irel_at_offset (sec, internal_relocs, + rel->r_rel.target_offset); + + /* If the target_offset for this relocation is the same as the + previous relocation, then we've already considered whether the + literal can be coalesced. Skip to the next one.... */ + if (i != 0 && (src_relocs[i-1].r_rel.target_offset + == rel->r_rel.target_offset)) + continue; + + /* Check if the relocation was from an L32R that is being removed + because a CALLX was converted to a direct CALL, and check if + there are no other relocations to the literal. */ + if (rel->is_null + && (i == relax_info->src_count - 1 + || (src_relocs[i+1].r_rel.target_offset + != rel->r_rel.target_offset))) + { + /* Mark the unused literal so that it will be removed. */ + add_removed_literal (&relax_info->removed_list, &rel->r_rel, NULL); + + /* Zero out the relocation on this literal location. */ + if (irel) + { + if (elf_hash_table (link_info)->dynamic_sections_created) + shrink_dynamic_reloc_sections (link_info, abfd, sec, irel); + + irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE); + } + + continue; + } + + /* Find the literal value. */ + r_reloc_init (&val.r_rel, abfd, irel); + BFD_ASSERT (rel->r_rel.target_offset < sec->_raw_size); + val.value = bfd_get_32 (abfd, contents + rel->r_rel.target_offset); + + /* Check if we've seen another literal with the same value. */ + val_map = get_cached_value (values, &val, final_static_link); + if (val_map != NULL) + { + /* First check that THIS and all the other relocs to this + literal will FIT if we move them to the new address. */ + + if (relocations_reach (rel, relax_info->src_count - i, + &val_map->loc)) + { + /* Mark that the literal will be coalesced. */ + add_removed_literal (&relax_info->removed_list, + &rel->r_rel, &val_map->loc); + } + else + { + /* Relocations do not reach -- do not remove this literal. */ + val_map->loc = rel->r_rel; + } + } + else + { + /* This is the first time we've seen this literal value. */ + BFD_ASSERT (sec == r_reloc_get_section (&rel->r_rel)); + add_value_map (values, &val, &rel->r_rel, final_static_link); + } + } + +error_return: + release_contents (sec, contents); + release_internal_relocs (sec, internal_relocs); + return ok; +} + + +/* Check if the original relocations (presumably on L32R instructions) + identified by reloc[0..N] can be changed to reference the literal + identified by r_rel. If r_rel is out of range for any of the + original relocations, then we don't want to coalesce the original + literal with the one at r_rel. We only check reloc[0..N], where the + offsets are all the same as for reloc[0] (i.e., they're all + referencing the same literal) and where N is also bounded by the + number of remaining entries in the "reloc" array. The "reloc" array + is sorted by target offset so we know all the entries for the same + literal will be contiguous. */ + +static bfd_boolean +relocations_reach (reloc, remaining_relocs, r_rel) + source_reloc *reloc; + int remaining_relocs; + const r_reloc *r_rel; +{ + bfd_vma from_offset, source_address, dest_address; + asection *sec; + int i; + + if (!r_reloc_is_defined (r_rel)) + return FALSE; + + sec = r_reloc_get_section (r_rel); + from_offset = reloc[0].r_rel.target_offset; + + for (i = 0; i < remaining_relocs; i++) + { + if (reloc[i].r_rel.target_offset != from_offset) + break; + + /* Ignore relocations that have been removed. */ + if (reloc[i].is_null) + continue; + + /* The original and new output section for these must be the same + in order to coalesce. */ + if (r_reloc_get_section (&reloc[i].r_rel)->output_section + != sec->output_section) + return FALSE; + + /* A NULL operand means it is not a PC-relative relocation, so + the literal can be moved anywhere. */ + if (reloc[i].opnd) + { + /* Otherwise, check to see that it fits. */ + source_address = (reloc[i].source_sec->output_section->vma + + reloc[i].source_sec->output_offset + + reloc[i].r_rel.rela.r_offset); + dest_address = (sec->output_section->vma + + sec->output_offset + + r_rel->target_offset); + + if (!pcrel_reloc_fits (reloc[i].opnd, source_address, dest_address)) + return FALSE; + } + } + + return TRUE; +} + + +/* WARNING: linear search here. If the relocation are in order by + address, we can use a faster binary search. ALSO, we assume that + there is only 1 non-NONE relocation per address. */ + +static Elf_Internal_Rela * +get_irel_at_offset (sec, internal_relocs, offset) + asection *sec; + Elf_Internal_Rela *internal_relocs; + bfd_vma offset; +{ + unsigned i; + if (!internal_relocs) + return NULL; + for (i = 0; i < sec->reloc_count; i++) + { + Elf_Internal_Rela *irel = &internal_relocs[i]; + if (irel->r_offset == offset + && ELF32_R_TYPE (irel->r_info) != R_XTENSA_NONE) + return irel; + } + return NULL; +} + + +/* Second relaxation pass. */ + +/* Modify all of the relocations to point to the right spot, and if this + is a relaxable section, delete the unwanted literals and fix the + cooked_size. */ + +bfd_boolean +relax_section (abfd, sec, link_info) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; +{ + Elf_Internal_Rela *internal_relocs; + xtensa_relax_info *relax_info; + bfd_byte *contents; + bfd_boolean ok = TRUE; + unsigned i; + + relax_info = get_xtensa_relax_info (sec); + BFD_ASSERT (relax_info); + + /* Handle property sections (e.g., literal tables) specially. */ + if (xtensa_is_property_section (sec)) + { + BFD_ASSERT (!relax_info->is_relaxable_literal_section); + return relax_property_section (abfd, sec, link_info); + } + + internal_relocs = retrieve_internal_relocs (abfd, sec, + link_info->keep_memory); + contents = retrieve_contents (abfd, sec, link_info->keep_memory); + if (contents == NULL && sec->_raw_size != 0) + { + ok = FALSE; + goto error_return; + } + + if (internal_relocs) + { + for (i = 0; i < sec->reloc_count; i++) + { + Elf_Internal_Rela *irel; + xtensa_relax_info *target_relax_info; + bfd_vma source_offset; + r_reloc r_rel; + unsigned r_type; + asection *target_sec; + + /* Locally change the source address. + Translate the target to the new target address. + If it points to this section and has been removed, + NULLify it. + Write it back. */ + + irel = &internal_relocs[i]; + source_offset = irel->r_offset; + + r_type = ELF32_R_TYPE (irel->r_info); + r_reloc_init (&r_rel, abfd, irel); + + if (relax_info->is_relaxable_literal_section) + { + if (r_type != R_XTENSA_NONE + && find_removed_literal (&relax_info->removed_list, + irel->r_offset)) + { + /* Remove this relocation. */ + if (elf_hash_table (link_info)->dynamic_sections_created) + shrink_dynamic_reloc_sections (link_info, abfd, sec, irel); + irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE); + irel->r_offset = offset_with_removed_literals + (&relax_info->removed_list, irel->r_offset); + continue; + } + source_offset = + offset_with_removed_literals (&relax_info->removed_list, + irel->r_offset); + irel->r_offset = source_offset; + } + + target_sec = r_reloc_get_section (&r_rel); + target_relax_info = get_xtensa_relax_info (target_sec); + + if (target_relax_info + && target_relax_info->is_relaxable_literal_section) + { + r_reloc new_rel; + reloc_bfd_fix *fix; + + translate_reloc (&r_rel, &new_rel); + + /* FIXME: If the relocation still references a section in + the same input file, the relocation should be modified + directly instead of adding a "fix" record. */ + + fix = reloc_bfd_fix_init (sec, source_offset, r_type, 0, + r_reloc_get_section (&new_rel), + new_rel.target_offset); + add_fix (sec, fix); + } + + pin_internal_relocs (sec, internal_relocs); + } + } + + if (relax_info->is_relaxable_literal_section) + { + /* Walk through the contents and delete literals that are not needed + anymore. */ + + unsigned long size = sec->_cooked_size; + unsigned long removed = 0; + + removed_literal *reloc = relax_info->removed_list.head; + for (; reloc; reloc = reloc->next) + { + unsigned long upper = sec->_raw_size; + bfd_vma start = reloc->from.target_offset + 4; + if (reloc->next) + upper = reloc->next->from.target_offset; + if (upper - start != 0) + { + BFD_ASSERT (start <= upper); + memmove (contents + start - removed - 4, + contents + start, + upper - start ); + pin_contents (sec, contents); + } + removed += 4; + size -= 4; + } + + /* Change the section size. */ + sec->_cooked_size = size; + /* Also shrink _raw_size. (The code in relocate_section that + checks that relocations are within the section must use + _raw_size because of the way the stabs sections are relaxed; + shrinking _raw_size means that these checks will not be + unnecessarily lax.) */ + sec->_raw_size = size; + } + + error_return: + release_internal_relocs (sec, internal_relocs); + release_contents (sec, contents); + return ok; +} + + +/* Fix up a relocation to take account of removed literals. */ + +static void +translate_reloc (orig_rel, new_rel) + const r_reloc *orig_rel; + r_reloc *new_rel; +{ + asection *sec; + xtensa_relax_info *relax_info; + removed_literal *removed; + unsigned long new_offset; + + *new_rel = *orig_rel; + + if (!r_reloc_is_defined (orig_rel)) + return; + sec = r_reloc_get_section (orig_rel); + + relax_info = get_xtensa_relax_info (sec); + BFD_ASSERT (relax_info); + + if (!relax_info->is_relaxable_literal_section) + return; + + /* Check if the original relocation is against a literal being removed. */ + removed = find_removed_literal (&relax_info->removed_list, + orig_rel->target_offset); + if (removed) + { + asection *new_sec; + + /* The fact that there is still a relocation to this literal indicates + that the literal is being coalesced, not simply removed. */ + BFD_ASSERT (removed->to.abfd != NULL); + + /* This was moved to some other address (possibly in another section). */ + *new_rel = removed->to; + new_sec = r_reloc_get_section (new_rel); + if (new_sec != sec) + { + sec = new_sec; + relax_info = get_xtensa_relax_info (sec); + if (!relax_info || !relax_info->is_relaxable_literal_section) + return; + } + } + + /* ...and the target address may have been moved within its section. */ + new_offset = offset_with_removed_literals (&relax_info->removed_list, + new_rel->target_offset); + + /* Modify the offset and addend. */ + new_rel->target_offset = new_offset; + new_rel->rela.r_addend += (new_offset - new_rel->target_offset); +} + + +/* For dynamic links, there may be a dynamic relocation for each + literal. The number of dynamic relocations must be computed in + size_dynamic_sections, which occurs before relaxation. When a + literal is removed, this function checks if there is a corresponding + dynamic relocation and shrinks the size of the appropriate dynamic + relocation section accordingly. At this point, the contents of the + dynamic relocation sections have not yet been filled in, so there's + nothing else that needs to be done. */ + +static void +shrink_dynamic_reloc_sections (info, abfd, input_section, rel) + struct bfd_link_info *info; + bfd *abfd; + asection *input_section; + Elf_Internal_Rela *rel; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + unsigned long r_symndx; + int r_type; + struct elf_link_hash_entry *h; + bfd_boolean dynamic_symbol; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + + r_type = ELF32_R_TYPE (rel->r_info); + r_symndx = ELF32_R_SYM (rel->r_info); + + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + dynamic_symbol = xtensa_elf_dynamic_symbol_p (h, info); + + if ((r_type == R_XTENSA_32 || r_type == R_XTENSA_PLT) + && (input_section->flags & SEC_ALLOC) != 0 + && (dynamic_symbol || info->shared)) + { + bfd *dynobj; + const char *srel_name; + asection *srel; + bfd_boolean is_plt = FALSE; + + dynobj = elf_hash_table (info)->dynobj; + BFD_ASSERT (dynobj != NULL); + + if (dynamic_symbol && r_type == R_XTENSA_PLT) + { + srel_name = ".rela.plt"; + is_plt = TRUE; + } + else + srel_name = ".rela.got"; + + /* Reduce size of the .rela.* section by one reloc. */ + srel = bfd_get_section_by_name (dynobj, srel_name); + BFD_ASSERT (srel != NULL); + BFD_ASSERT (srel->_cooked_size >= sizeof (Elf32_External_Rela)); + srel->_cooked_size -= sizeof (Elf32_External_Rela); + + /* Also shrink _raw_size. (This seems wrong but other bfd code seems + to assume that linker-created sections will never be relaxed and + hence _raw_size must always equal _cooked_size.) */ + srel->_raw_size = srel->_cooked_size; + + if (is_plt) + { + asection *splt, *sgotplt, *srelgot; + int reloc_index, chunk; + + /* Find the PLT reloc index of the entry being removed. This + is computed from the size of ".rela.plt". It is needed to + figure out which PLT chunk to resize. Usually "last index + = size - 1" since the index starts at zero, but in this + context, the size has just been decremented so there's no + need to subtract one. */ + reloc_index = srel->_cooked_size / sizeof (Elf32_External_Rela); + + chunk = reloc_index / PLT_ENTRIES_PER_CHUNK; + splt = elf_xtensa_get_plt_section (dynobj, chunk); + sgotplt = elf_xtensa_get_gotplt_section (dynobj, chunk); + BFD_ASSERT (splt != NULL && sgotplt != NULL); + + /* Check if an entire PLT chunk has just been eliminated. */ + if (reloc_index % PLT_ENTRIES_PER_CHUNK == 0) + { + /* The two magic GOT entries for that chunk can go away. */ + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (srelgot != NULL); + srelgot->reloc_count -= 2; + srelgot->_cooked_size -= 2 * sizeof (Elf32_External_Rela); + /* Shrink _raw_size (see comment above). */ + srelgot->_raw_size = srelgot->_cooked_size; + + sgotplt->_cooked_size -= 8; + + /* There should be only one entry left (and it will be + removed below). */ + BFD_ASSERT (sgotplt->_cooked_size == 4); + BFD_ASSERT (splt->_cooked_size == PLT_ENTRY_SIZE); + } + + BFD_ASSERT (sgotplt->_cooked_size >= 4); + BFD_ASSERT (splt->_cooked_size >= PLT_ENTRY_SIZE); + + sgotplt->_cooked_size -= 4; + splt->_cooked_size -= PLT_ENTRY_SIZE; + + /* Shrink _raw_sizes (see comment above). */ + sgotplt->_raw_size = sgotplt->_cooked_size; + splt->_raw_size = splt->_cooked_size; + } + } +} + + +/* This is similar to relax_section except that when a target is moved, + we shift addresses up. We also need to modify the size. This + algorithm does NOT allow for relocations into the middle of the + property sections. */ + +static bfd_boolean +relax_property_section (abfd, sec, link_info) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; +{ + Elf_Internal_Rela *internal_relocs; + bfd_byte *contents; + unsigned i, nexti; + bfd_boolean ok = TRUE; + + internal_relocs = retrieve_internal_relocs (abfd, sec, + link_info->keep_memory); + contents = retrieve_contents (abfd, sec, link_info->keep_memory); + if (contents == NULL && sec->_raw_size != 0) + { + ok = FALSE; + goto error_return; + } + + if (internal_relocs) + { + for (i = 0; i < sec->reloc_count; i++) + { + Elf_Internal_Rela *irel; + xtensa_relax_info *target_relax_info; + r_reloc r_rel; + unsigned r_type; + asection *target_sec; + + /* Locally change the source address. + Translate the target to the new target address. + If it points to this section and has been removed, MOVE IT. + Also, don't forget to modify the associated SIZE at + (offset + 4). */ + + irel = &internal_relocs[i]; + r_type = ELF32_R_TYPE (irel->r_info); + if (r_type == R_XTENSA_NONE) + continue; + + r_reloc_init (&r_rel, abfd, irel); + + target_sec = r_reloc_get_section (&r_rel); + target_relax_info = get_xtensa_relax_info (target_sec); + + if (target_relax_info + && target_relax_info->is_relaxable_literal_section) + { + /* Translate the relocation's destination. */ + bfd_vma new_offset; + bfd_vma new_end_offset; + bfd_byte *size_p; + long old_size, new_size; + + new_offset = + offset_with_removed_literals (&target_relax_info->removed_list, + r_rel.target_offset); + + /* Assert that we are not out of bounds. */ + size_p = &contents[irel->r_offset + 4]; + old_size = bfd_get_32 (abfd, &contents[irel->r_offset + 4]); + + new_end_offset = + offset_with_removed_literals (&target_relax_info->removed_list, + r_rel.target_offset + old_size); + + new_size = new_end_offset - new_offset; + if (new_size != old_size) + { + bfd_put_32 (abfd, new_size, size_p); + pin_contents (sec, contents); + } + + if (new_offset != r_rel.target_offset) + { + bfd_vma diff = new_offset - r_rel.target_offset; + irel->r_addend += diff; + pin_internal_relocs (sec, internal_relocs); + } + } + } + } + + /* Combine adjacent property table entries. This is also done in + finish_dynamic_sections() but at that point it's too late to + reclaim the space in the output section, so we do this twice. */ + + if (internal_relocs) + { + Elf_Internal_Rela *last_irel = NULL; + int removed_bytes = 0; + bfd_vma offset, last_irel_offset; + bfd_vma section_size; + + /* Walk over memory and irels at the same time. + This REQUIRES that the internal_relocs be sorted by offset. */ + qsort (internal_relocs, sec->reloc_count, sizeof (Elf_Internal_Rela), + internal_reloc_compare); + nexti = 0; /* Index into internal_relocs. */ + + pin_internal_relocs (sec, internal_relocs); + pin_contents (sec, contents); + + last_irel_offset = (bfd_vma) -1; + section_size = (sec->_cooked_size ? sec->_cooked_size : sec->_raw_size); + BFD_ASSERT (section_size % 8 == 0); + + for (offset = 0; offset < section_size; offset += 8) + { + Elf_Internal_Rela *irel, *next_irel; + bfd_vma bytes_to_remove, size, actual_offset; + bfd_boolean remove_this_irel; + + irel = NULL; + next_irel = NULL; + + /* Find the next two relocations (if there are that many left), + skipping over any R_XTENSA_NONE relocs. On entry, "nexti" is + the starting reloc index. After these two loops, "i" + is the index of the first non-NONE reloc past that starting + index, and "nexti" is the index for the next non-NONE reloc + after "i". */ + + for (i = nexti; i < sec->reloc_count; i++) + { + if (ELF32_R_TYPE (internal_relocs[i].r_info) != R_XTENSA_NONE) + { + irel = &internal_relocs[i]; + break; + } + internal_relocs[i].r_offset -= removed_bytes; + } + + for (nexti = i + 1; nexti < sec->reloc_count; nexti++) + { + if (ELF32_R_TYPE (internal_relocs[nexti].r_info) + != R_XTENSA_NONE) + { + next_irel = &internal_relocs[nexti]; + break; + } + internal_relocs[nexti].r_offset -= removed_bytes; + } + + remove_this_irel = FALSE; + bytes_to_remove = 0; + actual_offset = offset - removed_bytes; + size = bfd_get_32 (abfd, &contents[actual_offset + 4]); + + /* Check that the irels are sorted by offset, + with only one per address. */ + BFD_ASSERT (!irel || (int) irel->r_offset > (int) last_irel_offset); + BFD_ASSERT (!next_irel || next_irel->r_offset > irel->r_offset); + + /* Make sure there isn't a reloc on the size field. */ + if (irel && irel->r_offset == offset + 4) + { + irel->r_offset -= removed_bytes; + last_irel_offset = irel->r_offset; + } + else if (next_irel && next_irel->r_offset == offset + 4) + { + nexti += 1; + irel->r_offset -= removed_bytes; + next_irel->r_offset -= removed_bytes; + last_irel_offset = next_irel->r_offset; + } + else if (size == 0) + { + /* Always remove entries with zero size. */ + bytes_to_remove = 8; + if (irel && irel->r_offset == offset) + { + remove_this_irel = TRUE; + + irel->r_offset -= removed_bytes; + last_irel_offset = irel->r_offset; + } + } + else if (irel && irel->r_offset == offset) + { + if (ELF32_R_TYPE (irel->r_info) == R_XTENSA_32) + { + if (last_irel) + { + bfd_vma old_size = + bfd_get_32 (abfd, &contents[last_irel->r_offset + 4]); + bfd_vma old_address = + (last_irel->r_addend + + bfd_get_32 (abfd, &contents[last_irel->r_offset])); + bfd_vma new_address = + (irel->r_addend + + bfd_get_32 (abfd, &contents[actual_offset])); + + if ((ELF32_R_SYM (irel->r_info) == + ELF32_R_SYM (last_irel->r_info)) + && (old_address + old_size == new_address)) + { + /* fix the old size */ + bfd_put_32 (abfd, old_size + size, + &contents[last_irel->r_offset + 4]); + bytes_to_remove = 8; + remove_this_irel = TRUE; + } + else + last_irel = irel; + } + else + last_irel = irel; + } + + irel->r_offset -= removed_bytes; + last_irel_offset = irel->r_offset; + } + + if (remove_this_irel) + { + irel->r_info = ELF32_R_INFO (0, R_XTENSA_NONE); + irel->r_offset -= bytes_to_remove; + } + + if (bytes_to_remove != 0) + { + removed_bytes += bytes_to_remove; + if (offset + 8 < section_size) + memmove (&contents[actual_offset], + &contents[actual_offset+8], + section_size - offset - 8); + } + } + + if (removed_bytes) + { + /* Clear the removed bytes. */ + memset (&contents[section_size - removed_bytes], 0, removed_bytes); + + sec->_cooked_size = section_size - removed_bytes; + /* Also shrink _raw_size. (The code in relocate_section that + checks that relocations are within the section must use + _raw_size because of the way the stabs sections are + relaxed; shrinking _raw_size means that these checks will + not be unnecessarily lax.) */ + sec->_raw_size = sec->_cooked_size; + + if (xtensa_is_littable_section (sec)) + { + bfd *dynobj = elf_hash_table (link_info)->dynobj; + if (dynobj) + { + asection *sgotloc = + bfd_get_section_by_name (dynobj, ".got.loc"); + if (sgotloc) + { + bfd_size_type sgotloc_size = + (sgotloc->_cooked_size ? sgotloc->_cooked_size + : sgotloc->_raw_size); + sgotloc->_cooked_size = sgotloc_size - removed_bytes; + sgotloc->_raw_size = sgotloc_size - removed_bytes; + } + } + } + } + } + + error_return: + release_internal_relocs (sec, internal_relocs); + release_contents (sec, contents); + return ok; +} + + +/* Third relaxation pass. */ + +/* Change symbol values to account for removed literals. */ + +bfd_boolean +relax_section_symbols (abfd, sec) + bfd *abfd; + asection *sec; +{ + xtensa_relax_info *relax_info; + unsigned int sec_shndx; + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Sym *isymbuf; + unsigned i, num_syms, num_locals; + + relax_info = get_xtensa_relax_info (sec); + BFD_ASSERT (relax_info); + + if (!relax_info->is_relaxable_literal_section) + return TRUE; + + sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + isymbuf = retrieve_local_syms (abfd); + + num_syms = symtab_hdr->sh_size / sizeof (Elf32_External_Sym); + num_locals = symtab_hdr->sh_info; + + /* Adjust the local symbols defined in this section. */ + for (i = 0; i < num_locals; i++) + { + Elf_Internal_Sym *isym = &isymbuf[i]; + + if (isym->st_shndx == sec_shndx) + { + bfd_vma new_address = offset_with_removed_literals + (&relax_info->removed_list, isym->st_value); + if (new_address != isym->st_value) + isym->st_value = new_address; + } + } + + /* Now adjust the global symbols defined in this section. */ + for (i = 0; i < (num_syms - num_locals); i++) + { + struct elf_link_hash_entry *sym_hash; + + sym_hash = elf_sym_hashes (abfd)[i]; + + if (sym_hash->root.type == bfd_link_hash_warning) + sym_hash = (struct elf_link_hash_entry *) sym_hash->root.u.i.link; + + if ((sym_hash->root.type == bfd_link_hash_defined + || sym_hash->root.type == bfd_link_hash_defweak) + && sym_hash->root.u.def.section == sec) + { + bfd_vma new_address = offset_with_removed_literals + (&relax_info->removed_list, sym_hash->root.u.def.value); + if (new_address != sym_hash->root.u.def.value) + sym_hash->root.u.def.value = new_address; + } + } + + return TRUE; +} + + +/* "Fix" handling functions, called while performing relocations. */ + +static void +do_fix_for_relocatable_link (rel, input_bfd, input_section) + Elf_Internal_Rela *rel; + bfd *input_bfd; + asection *input_section; +{ + r_reloc r_rel; + asection *sec, *old_sec; + bfd_vma old_offset; + int r_type = ELF32_R_TYPE (rel->r_info); + reloc_bfd_fix *fix_list; + reloc_bfd_fix *fix; + + if (r_type == R_XTENSA_NONE) + return; + + fix_list = (get_xtensa_relax_info (input_section))->fix_list; + if (fix_list == NULL) + return; + + fix = get_bfd_fix (fix_list, input_section, rel->r_offset, r_type); + if (fix == NULL) + return; + + r_reloc_init (&r_rel, input_bfd, rel); + old_sec = r_reloc_get_section (&r_rel); + old_offset = r_reloc_get_target_offset (&r_rel); + + if (old_sec == NULL || !r_reloc_is_defined (&r_rel)) + { + BFD_ASSERT (r_type == R_XTENSA_ASM_EXPAND); + /* Leave it be. Resolution will happen in a later stage. */ + } + else + { + sec = fix->target_sec; + rel->r_addend += ((sec->output_offset + fix->target_offset) + - (old_sec->output_offset + old_offset)); + } +} + + +static void +do_fix_for_final_link (rel, input_section, relocationp) + Elf_Internal_Rela *rel; + asection *input_section; + bfd_vma *relocationp; +{ + asection *sec; + int r_type = ELF32_R_TYPE (rel->r_info); + reloc_bfd_fix *fix_list; + reloc_bfd_fix *fix; + + if (r_type == R_XTENSA_NONE) + return; + + fix_list = (get_xtensa_relax_info (input_section))->fix_list; + if (fix_list == NULL) + return; + + fix = get_bfd_fix (fix_list, input_section, rel->r_offset, r_type); + if (fix == NULL) + return; + + sec = fix->target_sec; + *relocationp = (sec->output_section->vma + + sec->output_offset + + fix->target_offset - rel->r_addend); +} + + +/* Miscellaneous utility functions.... */ + +static asection * +elf_xtensa_get_plt_section (dynobj, chunk) + bfd *dynobj; + int chunk; +{ + char plt_name[10]; + + if (chunk == 0) + return bfd_get_section_by_name (dynobj, ".plt"); + + sprintf (plt_name, ".plt.%u", chunk); + return bfd_get_section_by_name (dynobj, plt_name); +} + + +static asection * +elf_xtensa_get_gotplt_section (dynobj, chunk) + bfd *dynobj; + int chunk; +{ + char got_name[14]; + + if (chunk == 0) + return bfd_get_section_by_name (dynobj, ".got.plt"); + + sprintf (got_name, ".got.plt.%u", chunk); + return bfd_get_section_by_name (dynobj, got_name); +} + + +/* Get the input section for a given symbol index. + If the symbol is: + . a section symbol, return the section; + . a common symbol, return the common section; + . an undefined symbol, return the undefined section; + . an indirect symbol, follow the links; + . an absolute value, return the absolute section. */ + +static asection * +get_elf_r_symndx_section (abfd, r_symndx) + bfd *abfd; + unsigned long r_symndx; +{ + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + asection *target_sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + Elf_Internal_Sym *isymbuf; + unsigned int section_index; + + isymbuf = retrieve_local_syms (abfd); + section_index = isymbuf[r_symndx].st_shndx; + + if (section_index == SHN_UNDEF) + target_sec = bfd_und_section_ptr; + else if (section_index > 0 && section_index < SHN_LORESERVE) + target_sec = bfd_section_from_elf_index (abfd, section_index); + else if (section_index == SHN_ABS) + target_sec = bfd_abs_section_ptr; + else if (section_index == SHN_COMMON) + target_sec = bfd_com_section_ptr; + else + /* Who knows? */ + target_sec = NULL; + } + else + { + unsigned long indx = r_symndx - symtab_hdr->sh_info; + struct elf_link_hash_entry *h = elf_sym_hashes (abfd)[indx]; + + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + target_sec = h->root.u.def.section; + break; + case bfd_link_hash_common: + target_sec = bfd_com_section_ptr; + break; + case bfd_link_hash_undefined: + case bfd_link_hash_undefweak: + target_sec = bfd_und_section_ptr; + break; + default: /* New indirect warning. */ + target_sec = bfd_und_section_ptr; + break; + } + } + return target_sec; +} + + +static struct elf_link_hash_entry * +get_elf_r_symndx_hash_entry (abfd, r_symndx) + bfd *abfd; + unsigned long r_symndx; +{ + unsigned long indx; + struct elf_link_hash_entry *h; + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + if (r_symndx < symtab_hdr->sh_info) + return NULL; + + indx = r_symndx - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + return h; +} + + +/* Get the section-relative offset for a symbol number. */ + +static bfd_vma +get_elf_r_symndx_offset (abfd, r_symndx) + bfd *abfd; + unsigned long r_symndx; +{ + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + bfd_vma offset = 0; + + if (r_symndx < symtab_hdr->sh_info) + { + Elf_Internal_Sym *isymbuf; + isymbuf = retrieve_local_syms (abfd); + offset = isymbuf[r_symndx].st_value; + } + else + { + unsigned long indx = r_symndx - symtab_hdr->sh_info; + struct elf_link_hash_entry *h = + elf_sym_hashes (abfd)[indx]; + + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + offset = h->root.u.def.value; + } + return offset; +} + + +static bfd_boolean +pcrel_reloc_fits (opnd, self_address, dest_address) + xtensa_operand opnd; + bfd_vma self_address; + bfd_vma dest_address; +{ + uint32 new_address = + xtensa_operand_do_reloc (opnd, dest_address, self_address); + return (xtensa_operand_encode (opnd, &new_address) + == xtensa_encode_result_ok); +} + + +static int linkonce_len = sizeof (".gnu.linkonce.") - 1; +static int insn_sec_len = sizeof (XTENSA_INSN_SEC_NAME) - 1; +static int lit_sec_len = sizeof (XTENSA_LIT_SEC_NAME) - 1; + + +static bfd_boolean +xtensa_is_property_section (sec) + asection *sec; +{ + if (strncmp (XTENSA_INSN_SEC_NAME, sec->name, insn_sec_len) == 0 + || strncmp (XTENSA_LIT_SEC_NAME, sec->name, lit_sec_len) == 0) + return TRUE; + + if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0 + && (sec->name[linkonce_len] == 'x' + || sec->name[linkonce_len] == 'p') + && sec->name[linkonce_len + 1] == '.') + return TRUE; + + return FALSE; +} + + +static bfd_boolean +xtensa_is_littable_section (sec) + asection *sec; +{ + if (strncmp (XTENSA_LIT_SEC_NAME, sec->name, lit_sec_len) == 0) + return TRUE; + + if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0 + && sec->name[linkonce_len] == 'p' + && sec->name[linkonce_len + 1] == '.') + return TRUE; + + return FALSE; +} + + +static bfd_boolean +is_literal_section (sec) + asection *sec; +{ + /* FIXME: the current definition of this leaves a lot to be desired.... */ + if (sec == NULL || sec->name == NULL) + return FALSE; + return (strstr (sec->name, "literal") != NULL); +} + + +static int +internal_reloc_compare (ap, bp) + const PTR ap; + const PTR bp; +{ + const Elf_Internal_Rela *a = (const Elf_Internal_Rela *) ap; + const Elf_Internal_Rela *b = (const Elf_Internal_Rela *) bp; + + return (a->r_offset - b->r_offset); +} + + +char * +xtensa_get_property_section_name (sec, base_name) + asection *sec; + const char *base_name; +{ + if (strncmp (sec->name, ".gnu.linkonce.", linkonce_len) == 0) + { + char *prop_sec_name; + const char *suffix; + char linkonce_kind = 0; + + if (strcmp (base_name, XTENSA_INSN_SEC_NAME) == 0) + linkonce_kind = 'x'; + else if (strcmp (base_name, XTENSA_LIT_SEC_NAME) == 0) + linkonce_kind = 'p'; + else + abort (); + + prop_sec_name = (char *) bfd_malloc (strlen (sec->name) + 1); + memcpy (prop_sec_name, ".gnu.linkonce.", linkonce_len); + prop_sec_name[linkonce_len] = linkonce_kind; + prop_sec_name[linkonce_len + 1] = '.'; + + suffix = sec->name + linkonce_len; + while (*suffix) + { + suffix += 1; + if (suffix[-1] == '.') + break; + } + strcpy (prop_sec_name + linkonce_len + 2, suffix); + + return prop_sec_name; + } + + return strdup (base_name); +} + + +/* Other functions called directly by the linker. */ + +bfd_boolean +xtensa_callback_required_dependence (abfd, sec, link_info, callback, closure) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + deps_callback_t callback; + PTR closure; +{ + Elf_Internal_Rela *internal_relocs; + bfd_byte *contents; + unsigned i; + bfd_boolean ok = TRUE; + + /* ".plt*" sections have no explicit relocations but they contain L32R + instructions that reference the corresponding ".got.plt*" sections. */ + if ((sec->flags & SEC_LINKER_CREATED) != 0 + && strncmp (sec->name, ".plt", 4) == 0) + { + asection *sgotplt; + + /* Find the corresponding ".got.plt*" section. */ + if (sec->name[4] == '\0') + sgotplt = bfd_get_section_by_name (sec->owner, ".got.plt"); + else + { + char got_name[14]; + int chunk = 0; + + BFD_ASSERT (sec->name[4] == '.'); + chunk = strtol (&sec->name[5], NULL, 10); + + sprintf (got_name, ".got.plt.%u", chunk); + sgotplt = bfd_get_section_by_name (sec->owner, got_name); + } + BFD_ASSERT (sgotplt); + + /* Assume worst-case offsets: L32R at the very end of the ".plt" + section referencing a literal at the very beginning of + ".got.plt". This is very close to the real dependence, anyway. */ + (*callback) (sec, sec->_raw_size, sgotplt, 0, closure); + } + + internal_relocs = retrieve_internal_relocs (abfd, sec, + link_info->keep_memory); + if (internal_relocs == NULL + || sec->reloc_count == 0) + return ok; + + /* Cache the contents for the duration of this scan. */ + contents = retrieve_contents (abfd, sec, link_info->keep_memory); + if (contents == NULL && sec->_raw_size != 0) + { + ok = FALSE; + goto error_return; + } + + if (xtensa_default_isa == NULL) + xtensa_isa_init (); + + for (i = 0; i < sec->reloc_count; i++) + { + Elf_Internal_Rela *irel = &internal_relocs[i]; + if (is_l32r_relocation (sec, contents, irel)) + { + r_reloc l32r_rel; + asection *target_sec; + bfd_vma target_offset; + + r_reloc_init (&l32r_rel, abfd, irel); + target_sec = NULL; + target_offset = 0; + /* L32Rs must be local to the input file. */ + if (r_reloc_is_defined (&l32r_rel)) + { + target_sec = r_reloc_get_section (&l32r_rel); + target_offset = r_reloc_get_target_offset (&l32r_rel); + } + (*callback) (sec, irel->r_offset, target_sec, target_offset, + closure); + } + } + + error_return: + release_internal_relocs (sec, internal_relocs); + release_contents (sec, contents); + return ok; +} + +/* The default literal sections should always be marked as "code" (i.e., + SHF_EXECINSTR). This is particularly important for the Linux kernel + module loader so that the literals are not placed after the text. */ +static struct bfd_elf_special_section const elf_xtensa_special_sections[]= +{ + { ".literal", 8, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".init.literal", 13, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".fini.literal", 13, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { NULL, 0, 0, 0, 0 } +}; + + +#ifndef ELF_ARCH +#define TARGET_LITTLE_SYM bfd_elf32_xtensa_le_vec +#define TARGET_LITTLE_NAME "elf32-xtensa-le" +#define TARGET_BIG_SYM bfd_elf32_xtensa_be_vec +#define TARGET_BIG_NAME "elf32-xtensa-be" +#define ELF_ARCH bfd_arch_xtensa + +/* The new EM_XTENSA value will be recognized beginning in the Xtensa T1040 + release. However, we still have to generate files with the EM_XTENSA_OLD + value so that pre-T1040 tools can read the files. As soon as we stop + caring about pre-T1040 tools, the following two values should be + swapped. At the same time, any other code that uses EM_XTENSA_OLD + (e.g., prep_headers() in elf.c) should be changed to use EM_XTENSA. */ +#define ELF_MACHINE_CODE EM_XTENSA_OLD +#define ELF_MACHINE_ALT1 EM_XTENSA + +#if XCHAL_HAVE_MMU +#define ELF_MAXPAGESIZE (1 << XCHAL_MMU_MIN_PTE_PAGE_SIZE) +#else /* !XCHAL_HAVE_MMU */ +#define ELF_MAXPAGESIZE 1 +#endif /* !XCHAL_HAVE_MMU */ +#endif /* ELF_ARCH */ + +#define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 +#define elf_backend_plt_readonly 1 +#define elf_backend_got_header_size 4 +#define elf_backend_want_dynbss 0 +#define elf_backend_want_got_plt 1 + +#define elf_info_to_howto elf_xtensa_info_to_howto_rela + +#define bfd_elf32_bfd_merge_private_bfd_data elf_xtensa_merge_private_bfd_data +#define bfd_elf32_new_section_hook elf_xtensa_new_section_hook +#define bfd_elf32_bfd_print_private_bfd_data elf_xtensa_print_private_bfd_data +#define bfd_elf32_bfd_relax_section elf_xtensa_relax_section +#define bfd_elf32_bfd_reloc_type_lookup elf_xtensa_reloc_type_lookup +#define bfd_elf32_bfd_set_private_flags elf_xtensa_set_private_flags + +#define elf_backend_adjust_dynamic_symbol elf_xtensa_adjust_dynamic_symbol +#define elf_backend_check_relocs elf_xtensa_check_relocs +#define elf_backend_create_dynamic_sections elf_xtensa_create_dynamic_sections +#define elf_backend_discard_info elf_xtensa_discard_info +#define elf_backend_ignore_discarded_relocs elf_xtensa_ignore_discarded_relocs +#define elf_backend_final_write_processing elf_xtensa_final_write_processing +#define elf_backend_finish_dynamic_sections elf_xtensa_finish_dynamic_sections +#define elf_backend_finish_dynamic_symbol elf_xtensa_finish_dynamic_symbol +#define elf_backend_gc_mark_hook elf_xtensa_gc_mark_hook +#define elf_backend_gc_sweep_hook elf_xtensa_gc_sweep_hook +#define elf_backend_grok_prstatus elf_xtensa_grok_prstatus +#define elf_backend_grok_psinfo elf_xtensa_grok_psinfo +#define elf_backend_hide_symbol elf_xtensa_hide_symbol +#define elf_backend_modify_segment_map elf_xtensa_modify_segment_map +#define elf_backend_object_p elf_xtensa_object_p +#define elf_backend_reloc_type_class elf_xtensa_reloc_type_class +#define elf_backend_relocate_section elf_xtensa_relocate_section +#define elf_backend_size_dynamic_sections elf_xtensa_size_dynamic_sections +#define elf_backend_special_sections elf_xtensa_special_sections + +#include "elf32-target.h" diff --git a/bfd/elf64-alpha-fbsd.c b/bfd/elf64-alpha-fbsd.c deleted file mode 100644 index 061b0b8103020..0000000000000 --- a/bfd/elf64-alpha-fbsd.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Alpha specific support for 64-bit ELF on FreeBSD. - Copyright 2002 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; 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. */ - -#define TARGET_LITTLE_SYM bfd_elf64_alpha_freebsd_vec -#define TARGET_LITTLE_NAME "elf64-alpha-freebsd" -#define ELF_ARCH bfd_arch_alpha -#define ELF_MACHINE_CODE EM_ALPHA -#define ELF_MAXPAGESIZE 0x10000 - -#include "bfd.h" -#include "sysdep.h" -#include "elf-bfd.h" - -/* The kernel recognizes executables as valid only if they carry a - "FreeBSD" label in the ELF header. So we put this label on all - executables and (for simplicity) also all other object files. */ - -static void elf_alpha_post_process_headers - PARAMS ((bfd *, struct bfd_link_info *)); - -static void -elf_alpha_post_process_headers (abfd, link_info) - bfd * abfd; - struct bfd_link_info * link_info ATTRIBUTE_UNUSED; -{ - Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */ - - i_ehdrp = elf_elfheader (abfd); - - /* Put an ABI label supported by FreeBSD >= 4.1. */ - i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD; -#ifdef OLD_FREEBSD_ABI_LABEL - /* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */ - memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8); -#endif -} - -#define elf_backend_post_process_headers elf_alpha_post_process_headers - -#include "elf64-alpha.c" diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c new file mode 100644 index 0000000000000..76dcc18b24362 --- /dev/null +++ b/bfd/elf64-hppa.c @@ -0,0 +1,2796 @@ +/* Support for HPPA 64-bit ELF + Copyright 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "alloca-conf.h" +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/hppa.h" +#include "libhppa.h" +#include "elf64-hppa.h" +#define ARCH_SIZE 64 + +#define PLT_ENTRY_SIZE 0x10 +#define DLT_ENTRY_SIZE 0x8 +#define OPD_ENTRY_SIZE 0x20 + +#define ELF_DYNAMIC_INTERPRETER "/usr/lib/pa20_64/dld.sl" + +/* The stub is supposed to load the target address and target's DP + value out of the PLT, then do an external branch to the target + address. + + LDD PLTOFF(%r27),%r1 + BVE (%r1) + LDD PLTOFF+8(%r27),%r27 + + Note that we must use the LDD with a 14 bit displacement, not the one + with a 5 bit displacement. */ +static char plt_stub[] = {0x53, 0x61, 0x00, 0x00, 0xe8, 0x20, 0xd0, 0x00, + 0x53, 0x7b, 0x00, 0x00 }; + +struct elf64_hppa_dyn_hash_entry +{ + struct bfd_hash_entry root; + + /* Offsets for this symbol in various linker sections. */ + bfd_vma dlt_offset; + bfd_vma plt_offset; + bfd_vma opd_offset; + bfd_vma stub_offset; + + /* The symbol table entry, if any, that this was derived from. */ + struct elf_link_hash_entry *h; + + /* The index of the (possibly local) symbol in the input bfd and its + associated BFD. Needed so that we can have relocs against local + symbols in shared libraries. */ + long sym_indx; + bfd *owner; + + /* Dynamic symbols may need to have two different values. One for + the dynamic symbol table, one for the normal symbol table. + + In such cases we store the symbol's real value and section + index here so we can restore the real value before we write + the normal symbol table. */ + bfd_vma st_value; + int st_shndx; + + /* Used to count non-got, non-plt relocations for delayed sizing + of relocation sections. */ + struct elf64_hppa_dyn_reloc_entry + { + /* Next relocation in the chain. */ + struct elf64_hppa_dyn_reloc_entry *next; + + /* The type of the relocation. */ + int type; + + /* The input section of the relocation. */ + asection *sec; + + /* The index of the section symbol for the input section of + the relocation. Only needed when building shared libraries. */ + int sec_symndx; + + /* The offset within the input section of the relocation. */ + bfd_vma offset; + + /* The addend for the relocation. */ + bfd_vma addend; + + } *reloc_entries; + + /* Nonzero if this symbol needs an entry in one of the linker + sections. */ + unsigned want_dlt; + unsigned want_plt; + unsigned want_opd; + unsigned want_stub; +}; + +struct elf64_hppa_dyn_hash_table +{ + struct bfd_hash_table root; +}; + +struct elf64_hppa_link_hash_table +{ + struct elf_link_hash_table root; + + /* Shortcuts to get to the various linker defined sections. */ + asection *dlt_sec; + asection *dlt_rel_sec; + asection *plt_sec; + asection *plt_rel_sec; + asection *opd_sec; + asection *opd_rel_sec; + asection *other_rel_sec; + + /* Offset of __gp within .plt section. When the PLT gets large we want + to slide __gp into the PLT section so that we can continue to use + single DP relative instructions to load values out of the PLT. */ + bfd_vma gp_offset; + + /* Note this is not strictly correct. We should create a stub section for + each input section with calls. The stub section should be placed before + the section with the call. */ + asection *stub_sec; + + bfd_vma text_segment_base; + bfd_vma data_segment_base; + + struct elf64_hppa_dyn_hash_table dyn_hash_table; + + /* We build tables to map from an input section back to its + symbol index. This is the BFD for which we currently have + a map. */ + bfd *section_syms_bfd; + + /* Array of symbol numbers for each input section attached to the + current BFD. */ + int *section_syms; +}; + +#define elf64_hppa_hash_table(p) \ + ((struct elf64_hppa_link_hash_table *) ((p)->hash)) + +typedef struct bfd_hash_entry *(*new_hash_entry_func) + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + +static bfd_boolean elf64_hppa_dyn_hash_table_init + PARAMS ((struct elf64_hppa_dyn_hash_table *ht, bfd *abfd, + new_hash_entry_func new)); +static struct bfd_hash_entry *elf64_hppa_new_dyn_hash_entry + PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table, + const char *string)); +static struct bfd_link_hash_table *elf64_hppa_hash_table_create + PARAMS ((bfd *abfd)); +static struct elf64_hppa_dyn_hash_entry *elf64_hppa_dyn_hash_lookup + PARAMS ((struct elf64_hppa_dyn_hash_table *table, const char *string, + bfd_boolean create, bfd_boolean copy)); +static void elf64_hppa_dyn_hash_traverse + PARAMS ((struct elf64_hppa_dyn_hash_table *table, + bfd_boolean (*func) (struct elf64_hppa_dyn_hash_entry *, PTR), + PTR info)); + +static const char *get_dyn_name + PARAMS ((bfd *, struct elf_link_hash_entry *, + const Elf_Internal_Rela *, char **, size_t *)); + +/* This must follow the definitions of the various derived linker + hash tables and shared functions. */ +#include "elf-hppa.h" + +static bfd_boolean elf64_hppa_object_p + PARAMS ((bfd *)); + +static bfd_boolean elf64_hppa_section_from_shdr + PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); + +static void elf64_hppa_post_process_headers + PARAMS ((bfd *, struct bfd_link_info *)); + +static bfd_boolean elf64_hppa_create_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + +static bfd_boolean elf64_hppa_adjust_dynamic_symbol + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); + +static bfd_boolean elf64_hppa_mark_milli_and_exported_functions + PARAMS ((struct elf_link_hash_entry *, PTR)); + +static bfd_boolean elf64_hppa_size_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + +static bfd_boolean elf64_hppa_link_output_symbol_hook + PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *)); + +static bfd_boolean elf64_hppa_finish_dynamic_symbol + PARAMS ((bfd *, struct bfd_link_info *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); + +static int elf64_hppa_additional_program_headers + PARAMS ((bfd *)); + +static bfd_boolean elf64_hppa_modify_segment_map + PARAMS ((bfd *, struct bfd_link_info *)); + +static enum elf_reloc_type_class elf64_hppa_reloc_type_class + PARAMS ((const Elf_Internal_Rela *)); + +static bfd_boolean elf64_hppa_finish_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); + +static bfd_boolean elf64_hppa_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, + asection *, const Elf_Internal_Rela *)); + +static bfd_boolean elf64_hppa_dynamic_symbol_p + PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *)); + +static bfd_boolean elf64_hppa_mark_exported_functions + PARAMS ((struct elf_link_hash_entry *, PTR)); + +static bfd_boolean elf64_hppa_finalize_opd + PARAMS ((struct elf64_hppa_dyn_hash_entry *, PTR)); + +static bfd_boolean elf64_hppa_finalize_dlt + PARAMS ((struct elf64_hppa_dyn_hash_entry *, PTR)); + +static bfd_boolean allocate_global_data_dlt + PARAMS ((struct elf64_hppa_dyn_hash_entry *, PTR)); + +static bfd_boolean allocate_global_data_plt + PARAMS ((struct elf64_hppa_dyn_hash_entry *, PTR)); + +static bfd_boolean allocate_global_data_stub + PARAMS ((struct elf64_hppa_dyn_hash_entry *, PTR)); + +static bfd_boolean allocate_global_data_opd + PARAMS ((struct elf64_hppa_dyn_hash_entry *, PTR)); + +static bfd_boolean get_reloc_section + PARAMS ((bfd *, struct elf64_hppa_link_hash_table *, asection *)); + +static bfd_boolean count_dyn_reloc + PARAMS ((bfd *, struct elf64_hppa_dyn_hash_entry *, + int, asection *, int, bfd_vma, bfd_vma)); + +static bfd_boolean allocate_dynrel_entries + PARAMS ((struct elf64_hppa_dyn_hash_entry *, PTR)); + +static bfd_boolean elf64_hppa_finalize_dynreloc + PARAMS ((struct elf64_hppa_dyn_hash_entry *, PTR)); + +static bfd_boolean get_opd + PARAMS ((bfd *, struct bfd_link_info *, struct elf64_hppa_link_hash_table *)); + +static bfd_boolean get_plt + PARAMS ((bfd *, struct bfd_link_info *, struct elf64_hppa_link_hash_table *)); + +static bfd_boolean get_dlt + PARAMS ((bfd *, struct bfd_link_info *, struct elf64_hppa_link_hash_table *)); + +static bfd_boolean get_stub + PARAMS ((bfd *, struct bfd_link_info *, struct elf64_hppa_link_hash_table *)); + +static int elf64_hppa_elf_get_symbol_type + PARAMS ((Elf_Internal_Sym *, int)); + +static bfd_boolean +elf64_hppa_dyn_hash_table_init (ht, abfd, new) + struct elf64_hppa_dyn_hash_table *ht; + bfd *abfd ATTRIBUTE_UNUSED; + new_hash_entry_func new; +{ + memset (ht, 0, sizeof (*ht)); + return bfd_hash_table_init (&ht->root, new); +} + +static struct bfd_hash_entry* +elf64_hppa_new_dyn_hash_entry (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct elf64_hppa_dyn_hash_entry *ret; + ret = (struct elf64_hppa_dyn_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (!ret) + ret = bfd_hash_allocate (table, sizeof (*ret)); + + if (!ret) + return 0; + + /* Initialize our local data. All zeros, and definitely easier + than setting 8 bit fields. */ + memset (ret, 0, sizeof (*ret)); + + /* Call the allocation method of the superclass. */ + ret = ((struct elf64_hppa_dyn_hash_entry *) + bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); + + return &ret->root; +} + +/* Create the derived linker hash table. The PA64 ELF port uses this + derived hash table to keep information specific to the PA ElF + linker (without using static variables). */ + +static struct bfd_link_hash_table* +elf64_hppa_hash_table_create (abfd) + bfd *abfd; +{ + struct elf64_hppa_link_hash_table *ret; + + ret = bfd_zalloc (abfd, (bfd_size_type) sizeof (*ret)); + if (!ret) + return 0; + if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, + _bfd_elf_link_hash_newfunc)) + { + bfd_release (abfd, ret); + return 0; + } + + if (!elf64_hppa_dyn_hash_table_init (&ret->dyn_hash_table, abfd, + elf64_hppa_new_dyn_hash_entry)) + return 0; + return &ret->root.root; +} + +/* Look up an entry in a PA64 ELF linker hash table. */ + +static struct elf64_hppa_dyn_hash_entry * +elf64_hppa_dyn_hash_lookup(table, string, create, copy) + struct elf64_hppa_dyn_hash_table *table; + const char *string; + bfd_boolean create, copy; +{ + return ((struct elf64_hppa_dyn_hash_entry *) + bfd_hash_lookup (&table->root, string, create, copy)); +} + +/* Traverse a PA64 ELF linker hash table. */ + +static void +elf64_hppa_dyn_hash_traverse (table, func, info) + struct elf64_hppa_dyn_hash_table *table; + bfd_boolean (*func) PARAMS ((struct elf64_hppa_dyn_hash_entry *, PTR)); + PTR info; +{ + (bfd_hash_traverse + (&table->root, + (bfd_boolean (*) PARAMS ((struct bfd_hash_entry *, PTR))) func, + info)); +} + +/* Return nonzero if ABFD represents a PA2.0 ELF64 file. + + Additionally we set the default architecture and machine. */ +static bfd_boolean +elf64_hppa_object_p (abfd) + bfd *abfd; +{ + Elf_Internal_Ehdr * i_ehdrp; + unsigned int flags; + + i_ehdrp = elf_elfheader (abfd); + if (strcmp (bfd_get_target (abfd), "elf64-hppa-linux") == 0) + { + /* GCC on hppa-linux produces binaries with OSABI=Linux, + but the kernel produces corefiles with OSABI=SysV. */ + if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_LINUX && + i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_NONE) /* aka SYSV */ + return FALSE; + } + else + { + if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_HPUX) + return FALSE; + } + + flags = i_ehdrp->e_flags; + switch (flags & (EF_PARISC_ARCH | EF_PARISC_WIDE)) + { + case EFA_PARISC_1_0: + return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 10); + case EFA_PARISC_1_1: + return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 11); + case EFA_PARISC_2_0: + return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 20); + case EFA_PARISC_2_0 | EF_PARISC_WIDE: + return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 25); + } + /* Don't be fussy. */ + return TRUE; +} + +/* Given section type (hdr->sh_type), return a boolean indicating + whether or not the section is an elf64-hppa specific section. */ +static bfd_boolean +elf64_hppa_section_from_shdr (abfd, hdr, name) + bfd *abfd; + Elf_Internal_Shdr *hdr; + const char *name; +{ + asection *newsect; + + switch (hdr->sh_type) + { + case SHT_PARISC_EXT: + if (strcmp (name, ".PARISC.archext") != 0) + return FALSE; + break; + case SHT_PARISC_UNWIND: + if (strcmp (name, ".PARISC.unwind") != 0) + return FALSE; + break; + case SHT_PARISC_DOC: + case SHT_PARISC_ANNOT: + default: + return FALSE; + } + + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) + return FALSE; + newsect = hdr->bfd_section; + + return TRUE; +} + +/* Construct a string for use in the elf64_hppa_dyn_hash_table. The + name describes what was once potentially anonymous memory. We + allocate memory as necessary, possibly reusing PBUF/PLEN. */ + +static const char * +get_dyn_name (abfd, h, rel, pbuf, plen) + bfd *abfd; + struct elf_link_hash_entry *h; + const Elf_Internal_Rela *rel; + char **pbuf; + size_t *plen; +{ + asection *sec = abfd->sections; + size_t nlen, tlen; + char *buf; + size_t len; + + if (h && rel->r_addend == 0) + return h->root.root.string; + + if (h) + nlen = strlen (h->root.root.string); + else + nlen = 8 + 1 + sizeof (rel->r_info) * 2 - 8; + tlen = nlen + 1 + sizeof (rel->r_addend) * 2 + 1; + + len = *plen; + buf = *pbuf; + if (len < tlen) + { + if (buf) + free (buf); + *pbuf = buf = malloc (tlen); + *plen = len = tlen; + if (!buf) + return NULL; + } + + if (h) + { + memcpy (buf, h->root.root.string, nlen); + buf[nlen++] = '+'; + sprintf_vma (buf + nlen, rel->r_addend); + } + else + { + nlen = sprintf (buf, "%x:%lx", + sec->id & 0xffffffff, + (long) ELF64_R_SYM (rel->r_info)); + if (rel->r_addend) + { + buf[nlen++] = '+'; + sprintf_vma (buf + nlen, rel->r_addend); + } + } + + return buf; +} + +/* SEC is a section containing relocs for an input BFD when linking; return + a suitable section for holding relocs in the output BFD for a link. */ + +static bfd_boolean +get_reloc_section (abfd, hppa_info, sec) + bfd *abfd; + struct elf64_hppa_link_hash_table *hppa_info; + asection *sec; +{ + const char *srel_name; + asection *srel; + bfd *dynobj; + + srel_name = (bfd_elf_string_from_elf_section + (abfd, elf_elfheader(abfd)->e_shstrndx, + elf_section_data(sec)->rel_hdr.sh_name)); + if (srel_name == NULL) + return FALSE; + + BFD_ASSERT ((strncmp (srel_name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + srel_name+5) == 0) + || (strncmp (srel_name, ".rel", 4) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + srel_name+4) == 0)); + + dynobj = hppa_info->root.dynobj; + if (!dynobj) + hppa_info->root.dynobj = dynobj = abfd; + + srel = bfd_get_section_by_name (dynobj, srel_name); + if (srel == NULL) + { + srel = bfd_make_section (dynobj, srel_name); + if (srel == NULL + || !bfd_set_section_flags (dynobj, srel, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || !bfd_set_section_alignment (dynobj, srel, 3)) + return FALSE; + } + + hppa_info->other_rel_sec = srel; + return TRUE; +} + +/* Add a new entry to the list of dynamic relocations against DYN_H. + + We use this to keep a record of all the FPTR relocations against a + particular symbol so that we can create FPTR relocations in the + output file. */ + +static bfd_boolean +count_dyn_reloc (abfd, dyn_h, type, sec, sec_symndx, offset, addend) + bfd *abfd; + struct elf64_hppa_dyn_hash_entry *dyn_h; + int type; + asection *sec; + int sec_symndx; + bfd_vma offset; + bfd_vma addend; +{ + struct elf64_hppa_dyn_reloc_entry *rent; + + rent = (struct elf64_hppa_dyn_reloc_entry *) + bfd_alloc (abfd, (bfd_size_type) sizeof (*rent)); + if (!rent) + return FALSE; + + rent->next = dyn_h->reloc_entries; + rent->type = type; + rent->sec = sec; + rent->sec_symndx = sec_symndx; + rent->offset = offset; + rent->addend = addend; + dyn_h->reloc_entries = rent; + + return TRUE; +} + +/* Scan the RELOCS and record the type of dynamic entries that each + referenced symbol needs. */ + +static bfd_boolean +elf64_hppa_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + struct elf64_hppa_link_hash_table *hppa_info; + const Elf_Internal_Rela *relend; + Elf_Internal_Shdr *symtab_hdr; + const Elf_Internal_Rela *rel; + asection *dlt, *plt, *stubs; + char *buf; + size_t buf_len; + int sec_symndx; + + if (info->relocatable) + return TRUE; + + /* If this is the first dynamic object found in the link, create + the special sections required for dynamic linking. */ + if (! elf_hash_table (info)->dynamic_sections_created) + { + if (! _bfd_elf_link_create_dynamic_sections (abfd, info)) + return FALSE; + } + + hppa_info = elf64_hppa_hash_table (info); + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + /* If necessary, build a new table holding section symbols indices + for this BFD. */ + + if (info->shared && hppa_info->section_syms_bfd != abfd) + { + unsigned long i; + unsigned int highest_shndx; + Elf_Internal_Sym *local_syms = NULL; + Elf_Internal_Sym *isym, *isymend; + bfd_size_type amt; + + /* We're done with the old cache of section index to section symbol + index information. Free it. + + ?!? Note we leak the last section_syms array. Presumably we + could free it in one of the later routines in this file. */ + if (hppa_info->section_syms) + free (hppa_info->section_syms); + + /* Read this BFD's local symbols. */ + if (symtab_hdr->sh_info != 0) + { + local_syms = (Elf_Internal_Sym *) symtab_hdr->contents; + if (local_syms == NULL) + local_syms = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (local_syms == NULL) + return FALSE; + } + + /* Record the highest section index referenced by the local symbols. */ + highest_shndx = 0; + isymend = local_syms + symtab_hdr->sh_info; + for (isym = local_syms; isym < isymend; isym++) + { + if (isym->st_shndx > highest_shndx) + highest_shndx = isym->st_shndx; + } + + /* Allocate an array to hold the section index to section symbol index + mapping. Bump by one since we start counting at zero. */ + highest_shndx++; + amt = highest_shndx; + amt *= sizeof (int); + hppa_info->section_syms = (int *) bfd_malloc (amt); + + /* Now walk the local symbols again. If we find a section symbol, + record the index of the symbol into the section_syms array. */ + for (i = 0, isym = local_syms; isym < isymend; i++, isym++) + { + if (ELF_ST_TYPE (isym->st_info) == STT_SECTION) + hppa_info->section_syms[isym->st_shndx] = i; + } + + /* We are finished with the local symbols. */ + if (local_syms != NULL + && symtab_hdr->contents != (unsigned char *) local_syms) + { + if (! info->keep_memory) + free (local_syms); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) local_syms; + } + } + + /* Record which BFD we built the section_syms mapping for. */ + hppa_info->section_syms_bfd = abfd; + } + + /* Record the symbol index for this input section. We may need it for + relocations when building shared libraries. When not building shared + libraries this value is never really used, but assign it to zero to + prevent out of bounds memory accesses in other routines. */ + if (info->shared) + { + sec_symndx = _bfd_elf_section_from_bfd_section (abfd, sec); + + /* If we did not find a section symbol for this section, then + something went terribly wrong above. */ + if (sec_symndx == -1) + return FALSE; + + sec_symndx = hppa_info->section_syms[sec_symndx]; + } + else + sec_symndx = 0; + + dlt = plt = stubs = NULL; + buf = NULL; + buf_len = 0; + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; ++rel) + { + enum + { + NEED_DLT = 1, + NEED_PLT = 2, + NEED_STUB = 4, + NEED_OPD = 8, + NEED_DYNREL = 16, + }; + + struct elf_link_hash_entry *h = NULL; + unsigned long r_symndx = ELF64_R_SYM (rel->r_info); + struct elf64_hppa_dyn_hash_entry *dyn_h; + int need_entry; + const char *addr_name; + bfd_boolean maybe_dynamic; + int dynrel_type = R_PARISC_NONE; + static reloc_howto_type *howto; + + if (r_symndx >= symtab_hdr->sh_info) + { + /* We're dealing with a global symbol -- find its hash entry + and mark it as being referenced. */ + long indx = r_symndx - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + h->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR; + } + + /* We can only get preliminary data on whether a symbol is + locally or externally defined, as not all of the input files + have yet been processed. Do something with what we know, as + this may help reduce memory usage and processing time later. */ + maybe_dynamic = FALSE; + if (h && ((info->shared + && (!info->symbolic || info->unresolved_syms_in_shared_libs == RM_IGNORE)) + || ! (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) + || h->root.type == bfd_link_hash_defweak)) + maybe_dynamic = TRUE; + + howto = elf_hppa_howto_table + ELF64_R_TYPE (rel->r_info); + need_entry = 0; + switch (howto->type) + { + /* These are simple indirect references to symbols through the + DLT. We need to create a DLT entry for any symbols which + appears in a DLTIND relocation. */ + case R_PARISC_DLTIND21L: + case R_PARISC_DLTIND14R: + case R_PARISC_DLTIND14F: + case R_PARISC_DLTIND14WR: + case R_PARISC_DLTIND14DR: + need_entry = NEED_DLT; + break; + + /* ?!? These need a DLT entry. But I have no idea what to do with + the "link time TP value. */ + case R_PARISC_LTOFF_TP21L: + case R_PARISC_LTOFF_TP14R: + case R_PARISC_LTOFF_TP14F: + case R_PARISC_LTOFF_TP64: + case R_PARISC_LTOFF_TP14WR: + case R_PARISC_LTOFF_TP14DR: + case R_PARISC_LTOFF_TP16F: + case R_PARISC_LTOFF_TP16WF: + case R_PARISC_LTOFF_TP16DF: + need_entry = NEED_DLT; + break; + + /* These are function calls. Depending on their precise target we + may need to make a stub for them. The stub uses the PLT, so we + need to create PLT entries for these symbols too. */ + case R_PARISC_PCREL12F: + case R_PARISC_PCREL17F: + case R_PARISC_PCREL22F: + case R_PARISC_PCREL32: + case R_PARISC_PCREL64: + case R_PARISC_PCREL21L: + case R_PARISC_PCREL17R: + case R_PARISC_PCREL17C: + case R_PARISC_PCREL14R: + case R_PARISC_PCREL14F: + case R_PARISC_PCREL22C: + case R_PARISC_PCREL14WR: + case R_PARISC_PCREL14DR: + case R_PARISC_PCREL16F: + case R_PARISC_PCREL16WF: + case R_PARISC_PCREL16DF: + need_entry = (NEED_PLT | NEED_STUB); + break; + + case R_PARISC_PLTOFF21L: + case R_PARISC_PLTOFF14R: + case R_PARISC_PLTOFF14F: + case R_PARISC_PLTOFF14WR: + case R_PARISC_PLTOFF14DR: + case R_PARISC_PLTOFF16F: + case R_PARISC_PLTOFF16WF: + case R_PARISC_PLTOFF16DF: + need_entry = (NEED_PLT); + break; + + case R_PARISC_DIR64: + if (info->shared || maybe_dynamic) + need_entry = (NEED_DYNREL); + dynrel_type = R_PARISC_DIR64; + break; + + /* This is an indirect reference through the DLT to get the address + of a OPD descriptor. Thus we need to make a DLT entry that points + to an OPD entry. */ + case R_PARISC_LTOFF_FPTR21L: + case R_PARISC_LTOFF_FPTR14R: + case R_PARISC_LTOFF_FPTR14WR: + case R_PARISC_LTOFF_FPTR14DR: + case R_PARISC_LTOFF_FPTR32: + case R_PARISC_LTOFF_FPTR64: + case R_PARISC_LTOFF_FPTR16F: + case R_PARISC_LTOFF_FPTR16WF: + case R_PARISC_LTOFF_FPTR16DF: + if (info->shared || maybe_dynamic) + need_entry = (NEED_DLT | NEED_OPD); + else + need_entry = (NEED_DLT | NEED_OPD); + dynrel_type = R_PARISC_FPTR64; + break; + + /* This is a simple OPD entry. */ + case R_PARISC_FPTR64: + if (info->shared || maybe_dynamic) + need_entry = (NEED_OPD | NEED_DYNREL); + else + need_entry = (NEED_OPD); + dynrel_type = R_PARISC_FPTR64; + break; + + /* Add more cases as needed. */ + } + + if (!need_entry) + continue; + + /* Collect a canonical name for this address. */ + addr_name = get_dyn_name (abfd, h, rel, &buf, &buf_len); + + /* Collect the canonical entry data for this address. */ + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + addr_name, TRUE, TRUE); + BFD_ASSERT (dyn_h); + + /* Stash away enough information to be able to find this symbol + regardless of whether or not it is local or global. */ + dyn_h->h = h; + dyn_h->owner = abfd; + dyn_h->sym_indx = r_symndx; + + /* ?!? We may need to do some error checking in here. */ + /* Create what's needed. */ + if (need_entry & NEED_DLT) + { + if (! hppa_info->dlt_sec + && ! get_dlt (abfd, info, hppa_info)) + goto err_out; + dyn_h->want_dlt = 1; + } + + if (need_entry & NEED_PLT) + { + if (! hppa_info->plt_sec + && ! get_plt (abfd, info, hppa_info)) + goto err_out; + dyn_h->want_plt = 1; + } + + if (need_entry & NEED_STUB) + { + if (! hppa_info->stub_sec + && ! get_stub (abfd, info, hppa_info)) + goto err_out; + dyn_h->want_stub = 1; + } + + if (need_entry & NEED_OPD) + { + if (! hppa_info->opd_sec + && ! get_opd (abfd, info, hppa_info)) + goto err_out; + + dyn_h->want_opd = 1; + + /* FPTRs are not allocated by the dynamic linker for PA64, though + it is possible that will change in the future. */ + + /* This could be a local function that had its address taken, in + which case H will be NULL. */ + if (h) + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + } + + /* Add a new dynamic relocation to the chain of dynamic + relocations for this symbol. */ + if ((need_entry & NEED_DYNREL) && (sec->flags & SEC_ALLOC)) + { + if (! hppa_info->other_rel_sec + && ! get_reloc_section (abfd, hppa_info, sec)) + goto err_out; + + if (!count_dyn_reloc (abfd, dyn_h, dynrel_type, sec, + sec_symndx, rel->r_offset, rel->r_addend)) + goto err_out; + + /* If we are building a shared library and we just recorded + a dynamic R_PARISC_FPTR64 relocation, then make sure the + section symbol for this section ends up in the dynamic + symbol table. */ + if (info->shared && dynrel_type == R_PARISC_FPTR64 + && ! (bfd_elf_link_record_local_dynamic_symbol + (info, abfd, sec_symndx))) + return FALSE; + } + } + + if (buf) + free (buf); + return TRUE; + + err_out: + if (buf) + free (buf); + return FALSE; +} + +struct elf64_hppa_allocate_data +{ + struct bfd_link_info *info; + bfd_size_type ofs; +}; + +/* Should we do dynamic things to this symbol? */ + +static bfd_boolean +elf64_hppa_dynamic_symbol_p (h, info) + struct elf_link_hash_entry *h; + struct bfd_link_info *info; +{ + /* ??? What, if anything, needs to happen wrt STV_PROTECTED symbols + and relocations that retrieve a function descriptor? Assume the + worst for now. */ + if (_bfd_elf_dynamic_symbol_p (h, info, 1)) + { + /* ??? Why is this here and not elsewhere is_local_label_name. */ + if (h->root.root.string[0] == '$' && h->root.root.string[1] == '$') + return FALSE; + + return TRUE; + } + else + return FALSE; +} + +/* Mark all functions exported by this file so that we can later allocate + entries in .opd for them. */ + +static bfd_boolean +elf64_hppa_mark_exported_functions (h, data) + struct elf_link_hash_entry *h; + PTR data; +{ + struct bfd_link_info *info = (struct bfd_link_info *)data; + struct elf64_hppa_link_hash_table *hppa_info; + + hppa_info = elf64_hppa_hash_table (info); + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->root.u.def.section->output_section != NULL + && h->type == STT_FUNC) + { + struct elf64_hppa_dyn_hash_entry *dyn_h; + + /* Add this symbol to the PA64 linker hash table. */ + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + h->root.root.string, TRUE, TRUE); + BFD_ASSERT (dyn_h); + dyn_h->h = h; + + if (! hppa_info->opd_sec + && ! get_opd (hppa_info->root.dynobj, info, hppa_info)) + return FALSE; + + dyn_h->want_opd = 1; + /* Put a flag here for output_symbol_hook. */ + dyn_h->st_shndx = -1; + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + } + + return TRUE; +} + +/* Allocate space for a DLT entry. */ + +static bfd_boolean +allocate_global_data_dlt (dyn_h, data) + struct elf64_hppa_dyn_hash_entry *dyn_h; + PTR data; +{ + struct elf64_hppa_allocate_data *x = (struct elf64_hppa_allocate_data *)data; + + if (dyn_h->want_dlt) + { + struct elf_link_hash_entry *h = dyn_h->h; + + if (x->info->shared) + { + /* Possibly add the symbol to the local dynamic symbol + table since we might need to create a dynamic relocation + against it. */ + if (! h + || (h->dynindx == -1 && h->type != STT_PARISC_MILLI)) + { + bfd *owner; + owner = (h ? h->root.u.def.section->owner : dyn_h->owner); + + if (! (bfd_elf_link_record_local_dynamic_symbol + (x->info, owner, dyn_h->sym_indx))) + return FALSE; + } + } + + dyn_h->dlt_offset = x->ofs; + x->ofs += DLT_ENTRY_SIZE; + } + return TRUE; +} + +/* Allocate space for a DLT.PLT entry. */ + +static bfd_boolean +allocate_global_data_plt (dyn_h, data) + struct elf64_hppa_dyn_hash_entry *dyn_h; + PTR data; +{ + struct elf64_hppa_allocate_data *x = (struct elf64_hppa_allocate_data *)data; + + if (dyn_h->want_plt + && elf64_hppa_dynamic_symbol_p (dyn_h->h, x->info) + && !((dyn_h->h->root.type == bfd_link_hash_defined + || dyn_h->h->root.type == bfd_link_hash_defweak) + && dyn_h->h->root.u.def.section->output_section != NULL)) + { + dyn_h->plt_offset = x->ofs; + x->ofs += PLT_ENTRY_SIZE; + if (dyn_h->plt_offset < 0x2000) + elf64_hppa_hash_table (x->info)->gp_offset = dyn_h->plt_offset; + } + else + dyn_h->want_plt = 0; + + return TRUE; +} + +/* Allocate space for a STUB entry. */ + +static bfd_boolean +allocate_global_data_stub (dyn_h, data) + struct elf64_hppa_dyn_hash_entry *dyn_h; + PTR data; +{ + struct elf64_hppa_allocate_data *x = (struct elf64_hppa_allocate_data *)data; + + if (dyn_h->want_stub + && elf64_hppa_dynamic_symbol_p (dyn_h->h, x->info) + && !((dyn_h->h->root.type == bfd_link_hash_defined + || dyn_h->h->root.type == bfd_link_hash_defweak) + && dyn_h->h->root.u.def.section->output_section != NULL)) + { + dyn_h->stub_offset = x->ofs; + x->ofs += sizeof (plt_stub); + } + else + dyn_h->want_stub = 0; + return TRUE; +} + +/* Allocate space for a FPTR entry. */ + +static bfd_boolean +allocate_global_data_opd (dyn_h, data) + struct elf64_hppa_dyn_hash_entry *dyn_h; + PTR data; +{ + struct elf64_hppa_allocate_data *x = (struct elf64_hppa_allocate_data *)data; + + if (dyn_h->want_opd) + { + struct elf_link_hash_entry *h = dyn_h->h; + + if (h) + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* We never need an opd entry for a symbol which is not + defined by this output file. */ + if (h && (h->root.type == bfd_link_hash_undefined + || h->root.u.def.section->output_section == NULL)) + dyn_h->want_opd = 0; + + /* If we are creating a shared library, took the address of a local + function or might export this function from this object file, then + we have to create an opd descriptor. */ + else if (x->info->shared + || h == NULL + || (h->dynindx == -1 && h->type != STT_PARISC_MILLI) + || (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)) + { + /* If we are creating a shared library, then we will have to + create a runtime relocation for the symbol to properly + initialize the .opd entry. Make sure the symbol gets + added to the dynamic symbol table. */ + if (x->info->shared + && (h == NULL || (h->dynindx == -1))) + { + bfd *owner; + owner = (h ? h->root.u.def.section->owner : dyn_h->owner); + + if (!bfd_elf_link_record_local_dynamic_symbol + (x->info, owner, dyn_h->sym_indx)) + return FALSE; + } + + /* This may not be necessary or desirable anymore now that + we have some support for dealing with section symbols + in dynamic relocs. But name munging does make the result + much easier to debug. ie, the EPLT reloc will reference + a symbol like .foobar, instead of .text + offset. */ + if (x->info->shared && h) + { + char *new_name; + struct elf_link_hash_entry *nh; + + new_name = alloca (strlen (h->root.root.string) + 2); + new_name[0] = '.'; + strcpy (new_name + 1, h->root.root.string); + + nh = elf_link_hash_lookup (elf_hash_table (x->info), + new_name, TRUE, TRUE, TRUE); + + nh->root.type = h->root.type; + nh->root.u.def.value = h->root.u.def.value; + nh->root.u.def.section = h->root.u.def.section; + + if (! bfd_elf_link_record_dynamic_symbol (x->info, nh)) + return FALSE; + + } + dyn_h->opd_offset = x->ofs; + x->ofs += OPD_ENTRY_SIZE; + } + + /* Otherwise we do not need an opd entry. */ + else + dyn_h->want_opd = 0; + } + return TRUE; +} + +/* HP requires the EI_OSABI field to be filled in. The assignment to + EI_ABIVERSION may not be strictly necessary. */ + +static void +elf64_hppa_post_process_headers (abfd, link_info) + bfd * abfd; + struct bfd_link_info * link_info ATTRIBUTE_UNUSED; +{ + Elf_Internal_Ehdr * i_ehdrp; + + i_ehdrp = elf_elfheader (abfd); + + if (strcmp (bfd_get_target (abfd), "elf64-hppa-linux") == 0) + { + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_LINUX; + } + else + { + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX; + i_ehdrp->e_ident[EI_ABIVERSION] = 1; + } +} + +/* Create function descriptor section (.opd). This section is called .opd + because it contains "official procedure descriptors". The "official" + refers to the fact that these descriptors are used when taking the address + of a procedure, thus ensuring a unique address for each procedure. */ + +static bfd_boolean +get_opd (abfd, info, hppa_info) + bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + struct elf64_hppa_link_hash_table *hppa_info; +{ + asection *opd; + bfd *dynobj; + + opd = hppa_info->opd_sec; + if (!opd) + { + dynobj = hppa_info->root.dynobj; + if (!dynobj) + hppa_info->root.dynobj = dynobj = abfd; + + opd = bfd_make_section (dynobj, ".opd"); + if (!opd + || !bfd_set_section_flags (dynobj, opd, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED)) + || !bfd_set_section_alignment (abfd, opd, 3)) + { + BFD_ASSERT (0); + return FALSE; + } + + hppa_info->opd_sec = opd; + } + + return TRUE; +} + +/* Create the PLT section. */ + +static bfd_boolean +get_plt (abfd, info, hppa_info) + bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + struct elf64_hppa_link_hash_table *hppa_info; +{ + asection *plt; + bfd *dynobj; + + plt = hppa_info->plt_sec; + if (!plt) + { + dynobj = hppa_info->root.dynobj; + if (!dynobj) + hppa_info->root.dynobj = dynobj = abfd; + + plt = bfd_make_section (dynobj, ".plt"); + if (!plt + || !bfd_set_section_flags (dynobj, plt, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED)) + || !bfd_set_section_alignment (abfd, plt, 3)) + { + BFD_ASSERT (0); + return FALSE; + } + + hppa_info->plt_sec = plt; + } + + return TRUE; +} + +/* Create the DLT section. */ + +static bfd_boolean +get_dlt (abfd, info, hppa_info) + bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + struct elf64_hppa_link_hash_table *hppa_info; +{ + asection *dlt; + bfd *dynobj; + + dlt = hppa_info->dlt_sec; + if (!dlt) + { + dynobj = hppa_info->root.dynobj; + if (!dynobj) + hppa_info->root.dynobj = dynobj = abfd; + + dlt = bfd_make_section (dynobj, ".dlt"); + if (!dlt + || !bfd_set_section_flags (dynobj, dlt, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED)) + || !bfd_set_section_alignment (abfd, dlt, 3)) + { + BFD_ASSERT (0); + return FALSE; + } + + hppa_info->dlt_sec = dlt; + } + + return TRUE; +} + +/* Create the stubs section. */ + +static bfd_boolean +get_stub (abfd, info, hppa_info) + bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + struct elf64_hppa_link_hash_table *hppa_info; +{ + asection *stub; + bfd *dynobj; + + stub = hppa_info->stub_sec; + if (!stub) + { + dynobj = hppa_info->root.dynobj; + if (!dynobj) + hppa_info->root.dynobj = dynobj = abfd; + + stub = bfd_make_section (dynobj, ".stub"); + if (!stub + || !bfd_set_section_flags (dynobj, stub, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_READONLY + | SEC_LINKER_CREATED)) + || !bfd_set_section_alignment (abfd, stub, 3)) + { + BFD_ASSERT (0); + return FALSE; + } + + hppa_info->stub_sec = stub; + } + + return TRUE; +} + +/* Create sections necessary for dynamic linking. This is only a rough + cut and will likely change as we learn more about the somewhat + unusual dynamic linking scheme HP uses. + + .stub: + Contains code to implement cross-space calls. The first time one + of the stubs is used it will call into the dynamic linker, later + calls will go straight to the target. + + The only stub we support right now looks like + + ldd OFFSET(%dp),%r1 + bve %r0(%r1) + ldd OFFSET+8(%dp),%dp + + Other stubs may be needed in the future. We may want the remove + the break/nop instruction. It is only used right now to keep the + offset of a .plt entry and a .stub entry in sync. + + .dlt: + This is what most people call the .got. HP used a different name. + Losers. + + .rela.dlt: + Relocations for the DLT. + + .plt: + Function pointers as address,gp pairs. + + .rela.plt: + Should contain dynamic IPLT (and EPLT?) relocations. + + .opd: + FPTRS + + .rela.opd: + EPLT relocations for symbols exported from shared libraries. */ + +static bfd_boolean +elf64_hppa_create_dynamic_sections (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + asection *s; + + if (! get_stub (abfd, info, elf64_hppa_hash_table (info))) + return FALSE; + + if (! get_dlt (abfd, info, elf64_hppa_hash_table (info))) + return FALSE; + + if (! get_plt (abfd, info, elf64_hppa_hash_table (info))) + return FALSE; + + if (! get_opd (abfd, info, elf64_hppa_hash_table (info))) + return FALSE; + + s = bfd_make_section(abfd, ".rela.dlt"); + if (s == NULL + || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_READONLY + | SEC_LINKER_CREATED)) + || !bfd_set_section_alignment (abfd, s, 3)) + return FALSE; + elf64_hppa_hash_table (info)->dlt_rel_sec = s; + + s = bfd_make_section(abfd, ".rela.plt"); + if (s == NULL + || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_READONLY + | SEC_LINKER_CREATED)) + || !bfd_set_section_alignment (abfd, s, 3)) + return FALSE; + elf64_hppa_hash_table (info)->plt_rel_sec = s; + + s = bfd_make_section(abfd, ".rela.data"); + if (s == NULL + || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_READONLY + | SEC_LINKER_CREATED)) + || !bfd_set_section_alignment (abfd, s, 3)) + return FALSE; + elf64_hppa_hash_table (info)->other_rel_sec = s; + + s = bfd_make_section(abfd, ".rela.opd"); + if (s == NULL + || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_READONLY + | SEC_LINKER_CREATED)) + || !bfd_set_section_alignment (abfd, s, 3)) + return FALSE; + elf64_hppa_hash_table (info)->opd_rel_sec = s; + + return TRUE; +} + +/* Allocate dynamic relocations for those symbols that turned out + to be dynamic. */ + +static bfd_boolean +allocate_dynrel_entries (dyn_h, data) + struct elf64_hppa_dyn_hash_entry *dyn_h; + PTR data; +{ + struct elf64_hppa_allocate_data *x = (struct elf64_hppa_allocate_data *)data; + struct elf64_hppa_link_hash_table *hppa_info; + struct elf64_hppa_dyn_reloc_entry *rent; + bfd_boolean dynamic_symbol, shared; + + hppa_info = elf64_hppa_hash_table (x->info); + dynamic_symbol = elf64_hppa_dynamic_symbol_p (dyn_h->h, x->info); + shared = x->info->shared; + + /* We may need to allocate relocations for a non-dynamic symbol + when creating a shared library. */ + if (!dynamic_symbol && !shared) + return TRUE; + + /* Take care of the normal data relocations. */ + + for (rent = dyn_h->reloc_entries; rent; rent = rent->next) + { + /* Allocate one iff we are building a shared library, the relocation + isn't a R_PARISC_FPTR64, or we don't want an opd entry. */ + if (!shared && rent->type == R_PARISC_FPTR64 && dyn_h->want_opd) + continue; + + hppa_info->other_rel_sec->_raw_size += sizeof (Elf64_External_Rela); + + /* Make sure this symbol gets into the dynamic symbol table if it is + not already recorded. ?!? This should not be in the loop since + the symbol need only be added once. */ + if (dyn_h->h == 0 + || (dyn_h->h->dynindx == -1 && dyn_h->h->type != STT_PARISC_MILLI)) + if (!bfd_elf_link_record_local_dynamic_symbol + (x->info, rent->sec->owner, dyn_h->sym_indx)) + return FALSE; + } + + /* Take care of the GOT and PLT relocations. */ + + if ((dynamic_symbol || shared) && dyn_h->want_dlt) + hppa_info->dlt_rel_sec->_raw_size += sizeof (Elf64_External_Rela); + + /* If we are building a shared library, then every symbol that has an + opd entry will need an EPLT relocation to relocate the symbol's address + and __gp value based on the runtime load address. */ + if (shared && dyn_h->want_opd) + hppa_info->opd_rel_sec->_raw_size += sizeof (Elf64_External_Rela); + + if (dyn_h->want_plt && dynamic_symbol) + { + bfd_size_type t = 0; + + /* Dynamic symbols get one IPLT relocation. Local symbols in + shared libraries get two REL relocations. Local symbols in + main applications get nothing. */ + if (dynamic_symbol) + t = sizeof (Elf64_External_Rela); + else if (shared) + t = 2 * sizeof (Elf64_External_Rela); + + hppa_info->plt_rel_sec->_raw_size += t; + } + + return TRUE; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. */ + +static bfd_boolean +elf64_hppa_adjust_dynamic_symbol (info, h) + struct bfd_link_info *info ATTRIBUTE_UNUSED; + struct elf_link_hash_entry *h; +{ + /* ??? Undefined symbols with PLT entries should be re-defined + to be the PLT entry. */ + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + return TRUE; + } + + /* If this is a reference to a symbol defined by a dynamic object which + is not a function, we might allocate the symbol in our .dynbss section + and allocate a COPY dynamic relocation. + + But PA64 code is canonically PIC, so as a rule we can avoid this sort + of hackery. */ + + return TRUE; +} + +/* This function is called via elf_link_hash_traverse to mark millicode + symbols with a dynindx of -1 and to remove the string table reference + from the dynamic symbol table. If the symbol is not a millicode symbol, + elf64_hppa_mark_exported_functions is called. */ + +static bfd_boolean +elf64_hppa_mark_milli_and_exported_functions (h, data) + struct elf_link_hash_entry *h; + PTR data; +{ + struct bfd_link_info *info = (struct bfd_link_info *)data; + struct elf_link_hash_entry *elf = h; + + if (elf->root.type == bfd_link_hash_warning) + elf = (struct elf_link_hash_entry *) elf->root.u.i.link; + + if (elf->type == STT_PARISC_MILLI) + { + if (elf->dynindx != -1) + { + elf->dynindx = -1; + _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr, + elf->dynstr_index); + } + return TRUE; + } + + return elf64_hppa_mark_exported_functions (h, data); +} + +/* Set the final sizes of the dynamic sections and allocate memory for + the contents of our special sections. */ + +static bfd_boolean +elf64_hppa_size_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *s; + bfd_boolean plt; + bfd_boolean relocs; + bfd_boolean reltext; + struct elf64_hppa_allocate_data data; + struct elf64_hppa_link_hash_table *hppa_info; + + hppa_info = elf64_hppa_hash_table (info); + + dynobj = elf_hash_table (info)->dynobj; + BFD_ASSERT (dynobj != NULL); + + /* Mark each function this program exports so that we will allocate + space in the .opd section for each function's FPTR. If we are + creating dynamic sections, change the dynamic index of millicode + symbols to -1 and remove them from the string table for .dynstr. + + We have to traverse the main linker hash table since we have to + find functions which may not have been mentioned in any relocs. */ + elf_link_hash_traverse (elf_hash_table (info), + (elf_hash_table (info)->dynamic_sections_created + ? elf64_hppa_mark_milli_and_exported_functions + : elf64_hppa_mark_exported_functions), + info); + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (info->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } + else + { + /* We may have created entries in the .rela.got section. + However, if we are not creating the dynamic sections, we will + not actually use these entries. Reset the size of .rela.dlt, + which will cause it to get stripped from the output file + below. */ + s = bfd_get_section_by_name (dynobj, ".rela.dlt"); + if (s != NULL) + s->_raw_size = 0; + } + + /* Allocate the GOT entries. */ + + data.info = info; + if (elf64_hppa_hash_table (info)->dlt_sec) + { + data.ofs = 0x0; + elf64_hppa_dyn_hash_traverse (&hppa_info->dyn_hash_table, + allocate_global_data_dlt, &data); + hppa_info->dlt_sec->_raw_size = data.ofs; + + data.ofs = 0x0; + elf64_hppa_dyn_hash_traverse (&hppa_info->dyn_hash_table, + allocate_global_data_plt, &data); + hppa_info->plt_sec->_raw_size = data.ofs; + + data.ofs = 0x0; + elf64_hppa_dyn_hash_traverse (&hppa_info->dyn_hash_table, + allocate_global_data_stub, &data); + hppa_info->stub_sec->_raw_size = data.ofs; + } + + /* Allocate space for entries in the .opd section. */ + if (elf64_hppa_hash_table (info)->opd_sec) + { + data.ofs = 0; + elf64_hppa_dyn_hash_traverse (&hppa_info->dyn_hash_table, + allocate_global_data_opd, &data); + hppa_info->opd_sec->_raw_size = data.ofs; + } + + /* Now allocate space for dynamic relocations, if necessary. */ + if (hppa_info->root.dynamic_sections_created) + elf64_hppa_dyn_hash_traverse (&hppa_info->dyn_hash_table, + allocate_dynrel_entries, &data); + + /* The sizes of all the sections are set. Allocate memory for them. */ + plt = FALSE; + relocs = FALSE; + reltext = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + const char *name; + bfd_boolean strip; + + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + /* It's OK to base decisions on the section name, because none + of the dynobj section names depend upon the input files. */ + name = bfd_get_section_name (dynobj, s); + + strip = 0; + + if (strcmp (name, ".plt") == 0) + { + /* Strip this section if we don't need it; see the comment below. */ + if (s->_raw_size == 0) + { + strip = TRUE; + } + else + { + /* Remember whether there is a PLT. */ + plt = TRUE; + } + } + else if (strcmp (name, ".dlt") == 0) + { + /* Strip this section if we don't need it; see the comment below. */ + if (s->_raw_size == 0) + { + strip = TRUE; + } + } + else if (strcmp (name, ".opd") == 0) + { + /* Strip this section if we don't need it; see the comment below. */ + if (s->_raw_size == 0) + { + strip = TRUE; + } + } + else if (strncmp (name, ".rela", 5) == 0) + { + /* If we don't need this section, strip it from the output file. + This is mostly to handle .rela.bss and .rela.plt. We must + create both sections in create_dynamic_sections, because they + must be created before the linker maps input sections to output + sections. The linker does that before adjust_dynamic_symbol + is called, and it is that function which decides whether + anything needs to go into these sections. */ + if (s->_raw_size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + strip = TRUE; + } + else + { + asection *target; + + /* Remember whether there are any reloc sections other + than .rela.plt. */ + if (strcmp (name, ".rela.plt") != 0) + { + const char *outname; + + relocs = TRUE; + + /* If this relocation section applies to a read only + section, then we probably need a DT_TEXTREL + entry. The entries in the .rela.plt section + really apply to the .got section, which we + created ourselves and so know is not readonly. */ + outname = bfd_get_section_name (output_bfd, + s->output_section); + target = bfd_get_section_by_name (output_bfd, outname + 4); + if (target != NULL + && (target->flags & SEC_READONLY) != 0 + && (target->flags & SEC_ALLOC) != 0) + reltext = TRUE; + } + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + } + else if (strncmp (name, ".dlt", 4) != 0 + && strcmp (name, ".stub") != 0 + && strcmp (name, ".got") != 0) + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (strip) + { + _bfd_strip_section_from_output (info, s); + continue; + } + + /* Allocate memory for the section contents if it has not + been allocated already. We use bfd_zalloc here in case + unused entries are not reclaimed before the section's + contents are written out. This should not happen, but this + way if it does, we get a R_PARISC_NONE reloc instead of + garbage. */ + if (s->contents == NULL) + { + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) + return FALSE; + } + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Always create a DT_PLTGOT. It actually has nothing to do with + the PLT, it is how we communicate the __gp value of a load + module to the dynamic linker. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) + + if (!add_dynamic_entry (DT_HP_DLD_FLAGS, 0) + || !add_dynamic_entry (DT_PLTGOT, 0)) + return FALSE; + + /* Add some entries to the .dynamic section. We fill in the + values later, in elf64_hppa_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ + if (! info->shared) + { + if (!add_dynamic_entry (DT_DEBUG, 0) + || !add_dynamic_entry (DT_HP_DLD_HOOK, 0) + || !add_dynamic_entry (DT_HP_LOAD_MAP, 0)) + return FALSE; + } + + /* Force DT_FLAGS to always be set. + Required by HPUX 11.00 patch PHSS_26559. */ + if (!add_dynamic_entry (DT_FLAGS, (info)->flags)) + return FALSE; + + if (plt) + { + if (!add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + } + + if (relocs) + { + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela))) + return FALSE; + } + + if (reltext) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return FALSE; + info->flags |= DF_TEXTREL; + } + } +#undef add_dynamic_entry + + return TRUE; +} + +/* Called after we have output the symbol into the dynamic symbol + table, but before we output the symbol into the normal symbol + table. + + For some symbols we had to change their address when outputting + the dynamic symbol table. We undo that change here so that + the symbols have their expected value in the normal symbol + table. Ick. */ + +static bfd_boolean +elf64_hppa_link_output_symbol_hook (info, name, sym, input_sec, h) + struct bfd_link_info *info; + const char *name; + Elf_Internal_Sym *sym; + asection *input_sec ATTRIBUTE_UNUSED; + struct elf_link_hash_entry *h; +{ + struct elf64_hppa_link_hash_table *hppa_info; + struct elf64_hppa_dyn_hash_entry *dyn_h; + + /* We may be called with the file symbol or section symbols. + They never need munging, so it is safe to ignore them. */ + if (!name) + return TRUE; + + /* Get the PA dyn_symbol (if any) associated with NAME. */ + hppa_info = elf64_hppa_hash_table (info); + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + name, FALSE, FALSE); + if (!dyn_h || dyn_h->h != h) + return TRUE; + + /* Function symbols for which we created .opd entries *may* have been + munged by finish_dynamic_symbol and have to be un-munged here. + + Note that finish_dynamic_symbol sometimes turns dynamic symbols + into non-dynamic ones, so we initialize st_shndx to -1 in + mark_exported_functions and check to see if it was overwritten + here instead of just checking dyn_h->h->dynindx. */ + if (dyn_h->want_opd && dyn_h->st_shndx != -1) + { + /* Restore the saved value and section index. */ + sym->st_value = dyn_h->st_value; + sym->st_shndx = dyn_h->st_shndx; + } + + return TRUE; +} + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +static bfd_boolean +elf64_hppa_finish_dynamic_symbol (output_bfd, info, h, sym) + bfd *output_bfd; + struct bfd_link_info *info; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + asection *stub, *splt, *sdlt, *sopd, *spltrel, *sdltrel; + struct elf64_hppa_link_hash_table *hppa_info; + struct elf64_hppa_dyn_hash_entry *dyn_h; + + hppa_info = elf64_hppa_hash_table (info); + dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table, + h->root.root.string, FALSE, FALSE); + + stub = hppa_info->stub_sec; + splt = hppa_info->plt_sec; + sdlt = hppa_info->dlt_sec; + sopd = hppa_info->opd_sec; + spltrel = hppa_info->plt_rel_sec; + sdltrel = hppa_info->dlt_rel_sec; + + /* Incredible. It is actually necessary to NOT use the symbol's real + value when building the dynamic symbol table for a shared library. + At least for symbols that refer to functions. + + We will store a new value and section index into the symbol long + enough to output it into the dynamic symbol table, then we restore + the original values (in elf64_hppa_link_output_symbol_hook). */ + if (dyn_h && dyn_h->want_opd) + { + BFD_ASSERT (sopd != NULL) + + /* Save away the original value and section index so that we + can restore them later. */ + dyn_h->st_value = sym->st_value; + dyn_h->st_shndx = sym->st_shndx; + + /* For the dynamic symbol table entry, we want the value to be + address of this symbol's entry within the .opd section. */ + sym->st_value = (dyn_h->opd_offset + + sopd->output_offset + + sopd->output_section->vma); + sym->st_shndx = _bfd_elf_section_from_bfd_section (output_bfd, + sopd->output_section); + } + + /* Initialize a .plt entry if requested. */ + if (dyn_h && dyn_h->want_plt + && elf64_hppa_dynamic_symbol_p (dyn_h->h, info)) + { + bfd_vma value; + Elf_Internal_Rela rel; + bfd_byte *loc; + + BFD_ASSERT (splt != NULL && spltrel != NULL) + + /* We do not actually care about the value in the PLT entry + if we are creating a shared library and the symbol is + still undefined, we create a dynamic relocation to fill + in the correct value. */ + if (info->shared && h->root.type == bfd_link_hash_undefined) + value = 0; + else + value = (h->root.u.def.value + h->root.u.def.section->vma); + + /* Fill in the entry in the procedure linkage table. + + The format of a plt entry is + <__gp>. + + plt_offset is the offset within the PLT section at which to + install the PLT entry. + + We are modifying the in-memory PLT contents here, so we do not add + in the output_offset of the PLT section. */ + + bfd_put_64 (splt->owner, value, splt->contents + dyn_h->plt_offset); + value = _bfd_get_gp_value (splt->output_section->owner); + bfd_put_64 (splt->owner, value, splt->contents + dyn_h->plt_offset + 0x8); + + /* Create a dynamic IPLT relocation for this entry. + + We are creating a relocation in the output file's PLT section, + which is included within the DLT secton. So we do need to include + the PLT's output_offset in the computation of the relocation's + address. */ + rel.r_offset = (dyn_h->plt_offset + splt->output_offset + + splt->output_section->vma); + rel.r_info = ELF64_R_INFO (h->dynindx, R_PARISC_IPLT); + rel.r_addend = 0; + + loc = spltrel->contents; + loc += spltrel->reloc_count++ * sizeof (Elf64_External_Rela); + bfd_elf64_swap_reloca_out (splt->output_section->owner, &rel, loc); + } + + /* Initialize an external call stub entry if requested. */ + if (dyn_h && dyn_h->want_stub + && elf64_hppa_dynamic_symbol_p (dyn_h->h, info)) + { + bfd_vma value; + int insn; + unsigned int max_offset; + + BFD_ASSERT (stub != NULL) + + /* Install the generic stub template. + + We are modifying the contents of the stub section, so we do not + need to include the stub section's output_offset here. */ + memcpy (stub->contents + dyn_h->stub_offset, plt_stub, sizeof (plt_stub)); + + /* Fix up the first ldd instruction. + + We are modifying the contents of the STUB section in memory, + so we do not need to include its output offset in this computation. + + Note the plt_offset value is the value of the PLT entry relative to + the start of the PLT section. These instructions will reference + data relative to the value of __gp, which may not necessarily have + the same address as the start of the PLT section. + + gp_offset contains the offset of __gp within the PLT section. */ + value = dyn_h->plt_offset - hppa_info->gp_offset; + + insn = bfd_get_32 (stub->owner, stub->contents + dyn_h->stub_offset); + if (output_bfd->arch_info->mach >= 25) + { + /* Wide mode allows 16 bit offsets. */ + max_offset = 32768; + insn &= ~ 0xfff1; + insn |= re_assemble_16 ((int) value); + } + else + { + max_offset = 8192; + insn &= ~ 0x3ff1; + insn |= re_assemble_14 ((int) value); + } + + if ((value & 7) || value + max_offset >= 2*max_offset - 8) + { + (*_bfd_error_handler) (_("stub entry for %s cannot load .plt, dp offset = %ld"), + dyn_h->root.string, + (long) value); + return FALSE; + } + + bfd_put_32 (stub->owner, (bfd_vma) insn, + stub->contents + dyn_h->stub_offset); + + /* Fix up the second ldd instruction. */ + value += 8; + insn = bfd_get_32 (stub->owner, stub->contents + dyn_h->stub_offset + 8); + if (output_bfd->arch_info->mach >= 25) + { + insn &= ~ 0xfff1; + insn |= re_assemble_16 ((int) value); + } + else + { + insn &= ~ 0x3ff1; + insn |= re_assemble_14 ((int) value); + } + bfd_put_32 (stub->owner, (bfd_vma) insn, + stub->contents + dyn_h->stub_offset + 8); + } + + return TRUE; +} + +/* The .opd section contains FPTRs for each function this file + exports. Initialize the FPTR entries. */ + +static bfd_boolean +elf64_hppa_finalize_opd (dyn_h, data) + struct elf64_hppa_dyn_hash_entry *dyn_h; + PTR data; +{ + struct bfd_link_info *info = (struct bfd_link_info *)data; + struct elf64_hppa_link_hash_table *hppa_info; + struct elf_link_hash_entry *h = dyn_h ? dyn_h->h : NULL; + asection *sopd; + asection *sopdrel; + + hppa_info = elf64_hppa_hash_table (info); + sopd = hppa_info->opd_sec; + sopdrel = hppa_info->opd_rel_sec; + + if (h && dyn_h->want_opd) + { + bfd_vma value; + + /* The first two words of an .opd entry are zero. + + We are modifying the contents of the OPD section in memory, so we + do not need to include its output offset in this computation. */ + memset (sopd->contents + dyn_h->opd_offset, 0, 16); + + value = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + + /* The next word is the address of the function. */ + bfd_put_64 (sopd->owner, value, sopd->contents + dyn_h->opd_offset + 16); + + /* The last word is our local __gp value. */ + value = _bfd_get_gp_value (sopd->output_section->owner); + bfd_put_64 (sopd->owner, value, sopd->contents + dyn_h->opd_offset + 24); + } + + /* If we are generating a shared library, we must generate EPLT relocations + for each entry in the .opd, even for static functions (they may have + had their address taken). */ + if (info->shared && dyn_h && dyn_h->want_opd) + { + Elf_Internal_Rela rel; + bfd_byte *loc; + int dynindx; + + /* We may need to do a relocation against a local symbol, in + which case we have to look up it's dynamic symbol index off + the local symbol hash table. */ + if (h && h->dynindx != -1) + dynindx = h->dynindx; + else + dynindx + = _bfd_elf_link_lookup_local_dynindx (info, dyn_h->owner, + dyn_h->sym_indx); + + /* The offset of this relocation is the absolute address of the + .opd entry for this symbol. */ + rel.r_offset = (dyn_h->opd_offset + sopd->output_offset + + sopd->output_section->vma); + + /* If H is non-null, then we have an external symbol. + + It is imperative that we use a different dynamic symbol for the + EPLT relocation if the symbol has global scope. + + In the dynamic symbol table, the function symbol will have a value + which is address of the function's .opd entry. + + Thus, we can not use that dynamic symbol for the EPLT relocation + (if we did, the data in the .opd would reference itself rather + than the actual address of the function). Instead we have to use + a new dynamic symbol which has the same value as the original global + function symbol. + + We prefix the original symbol with a "." and use the new symbol in + the EPLT relocation. This new symbol has already been recorded in + the symbol table, we just have to look it up and use it. + + We do not have such problems with static functions because we do + not make their addresses in the dynamic symbol table point to + the .opd entry. Ultimately this should be safe since a static + function can not be directly referenced outside of its shared + library. + + We do have to play similar games for FPTR relocations in shared + libraries, including those for static symbols. See the FPTR + handling in elf64_hppa_finalize_dynreloc. */ + if (h) + { + char *new_name; + struct elf_link_hash_entry *nh; + + new_name = alloca (strlen (h->root.root.string) + 2); + new_name[0] = '.'; + strcpy (new_name + 1, h->root.root.string); + + nh = elf_link_hash_lookup (elf_hash_table (info), + new_name, FALSE, FALSE, FALSE); + + /* All we really want from the new symbol is its dynamic + symbol index. */ + dynindx = nh->dynindx; + } + + rel.r_addend = 0; + rel.r_info = ELF64_R_INFO (dynindx, R_PARISC_EPLT); + + loc = sopdrel->contents; + loc += sopdrel->reloc_count++ * sizeof (Elf64_External_Rela); + bfd_elf64_swap_reloca_out (sopd->output_section->owner, &rel, loc); + } + return TRUE; +} + +/* The .dlt section contains addresses for items referenced through the + dlt. Note that we can have a DLTIND relocation for a local symbol, thus + we can not depend on finish_dynamic_symbol to initialize the .dlt. */ + +static bfd_boolean +elf64_hppa_finalize_dlt (dyn_h, data) + struct elf64_hppa_dyn_hash_entry *dyn_h; + PTR data; +{ + struct bfd_link_info *info = (struct bfd_link_info *)data; + struct elf64_hppa_link_hash_table *hppa_info; + asection *sdlt, *sdltrel; + struct elf_link_hash_entry *h = dyn_h ? dyn_h->h : NULL; + + hppa_info = elf64_hppa_hash_table (info); + + sdlt = hppa_info->dlt_sec; + sdltrel = hppa_info->dlt_rel_sec; + + /* H/DYN_H may refer to a local variable and we know it's + address, so there is no need to create a relocation. Just install + the proper value into the DLT, note this shortcut can not be + skipped when building a shared library. */ + if (! info->shared && h && dyn_h->want_dlt) + { + bfd_vma value; + + /* If we had an LTOFF_FPTR style relocation we want the DLT entry + to point to the FPTR entry in the .opd section. + + We include the OPD's output offset in this computation as + we are referring to an absolute address in the resulting + object file. */ + if (dyn_h->want_opd) + { + value = (dyn_h->opd_offset + + hppa_info->opd_sec->output_offset + + hppa_info->opd_sec->output_section->vma); + } + else if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->root.u.def.section) + { + value = h->root.u.def.value + h->root.u.def.section->output_offset; + if (h->root.u.def.section->output_section) + value += h->root.u.def.section->output_section->vma; + else + value += h->root.u.def.section->vma; + } + else + /* We have an undefined function reference. */ + value = 0; + + /* We do not need to include the output offset of the DLT section + here because we are modifying the in-memory contents. */ + bfd_put_64 (sdlt->owner, value, sdlt->contents + dyn_h->dlt_offset); + } + + /* Create a relocation for the DLT entry associated with this symbol. + When building a shared library the symbol does not have to be dynamic. */ + if (dyn_h->want_dlt + && (elf64_hppa_dynamic_symbol_p (dyn_h->h, info) || info->shared)) + { + Elf_Internal_Rela rel; + bfd_byte *loc; + int dynindx; + + /* We may need to do a relocation against a local symbol, in + which case we have to look up it's dynamic symbol index off + the local symbol hash table. */ + if (h && h->dynindx != -1) + dynindx = h->dynindx; + else + dynindx + = _bfd_elf_link_lookup_local_dynindx (info, dyn_h->owner, + dyn_h->sym_indx); + + /* Create a dynamic relocation for this entry. Do include the output + offset of the DLT entry since we need an absolute address in the + resulting object file. */ + rel.r_offset = (dyn_h->dlt_offset + sdlt->output_offset + + sdlt->output_section->vma); + if (h && h->type == STT_FUNC) + rel.r_info = ELF64_R_INFO (dynindx, R_PARISC_FPTR64); + else + rel.r_info = ELF64_R_INFO (dynindx, R_PARISC_DIR64); + rel.r_addend = 0; + + loc = sdltrel->contents; + loc += sdltrel->reloc_count++ * sizeof (Elf64_External_Rela); + bfd_elf64_swap_reloca_out (sdlt->output_section->owner, &rel, loc); + } + return TRUE; +} + +/* Finalize the dynamic relocations. Specifically the FPTR relocations + for dynamic functions used to initialize static data. */ + +static bfd_boolean +elf64_hppa_finalize_dynreloc (dyn_h, data) + struct elf64_hppa_dyn_hash_entry *dyn_h; + PTR data; +{ + struct bfd_link_info *info = (struct bfd_link_info *)data; + struct elf64_hppa_link_hash_table *hppa_info; + struct elf_link_hash_entry *h; + int dynamic_symbol; + + dynamic_symbol = elf64_hppa_dynamic_symbol_p (dyn_h->h, info); + + if (!dynamic_symbol && !info->shared) + return TRUE; + + if (dyn_h->reloc_entries) + { + struct elf64_hppa_dyn_reloc_entry *rent; + int dynindx; + + hppa_info = elf64_hppa_hash_table (info); + h = dyn_h->h; + + /* We may need to do a relocation against a local symbol, in + which case we have to look up it's dynamic symbol index off + the local symbol hash table. */ + if (h && h->dynindx != -1) + dynindx = h->dynindx; + else + dynindx + = _bfd_elf_link_lookup_local_dynindx (info, dyn_h->owner, + dyn_h->sym_indx); + + for (rent = dyn_h->reloc_entries; rent; rent = rent->next) + { + Elf_Internal_Rela rel; + bfd_byte *loc; + + /* Allocate one iff we are building a shared library, the relocation + isn't a R_PARISC_FPTR64, or we don't want an opd entry. */ + if (!info->shared && rent->type == R_PARISC_FPTR64 && dyn_h->want_opd) + continue; + + /* Create a dynamic relocation for this entry. + + We need the output offset for the reloc's section because + we are creating an absolute address in the resulting object + file. */ + rel.r_offset = (rent->offset + rent->sec->output_offset + + rent->sec->output_section->vma); + + /* An FPTR64 relocation implies that we took the address of + a function and that the function has an entry in the .opd + section. We want the FPTR64 relocation to reference the + entry in .opd. + + We could munge the symbol value in the dynamic symbol table + (in fact we already do for functions with global scope) to point + to the .opd entry. Then we could use that dynamic symbol in + this relocation. + + Or we could do something sensible, not munge the symbol's + address and instead just use a different symbol to reference + the .opd entry. At least that seems sensible until you + realize there's no local dynamic symbols we can use for that + purpose. Thus the hair in the check_relocs routine. + + We use a section symbol recorded by check_relocs as the + base symbol for the relocation. The addend is the difference + between the section symbol and the address of the .opd entry. */ + if (info->shared && rent->type == R_PARISC_FPTR64 && dyn_h->want_opd) + { + bfd_vma value, value2; + + /* First compute the address of the opd entry for this symbol. */ + value = (dyn_h->opd_offset + + hppa_info->opd_sec->output_section->vma + + hppa_info->opd_sec->output_offset); + + /* Compute the value of the start of the section with + the relocation. */ + value2 = (rent->sec->output_section->vma + + rent->sec->output_offset); + + /* Compute the difference between the start of the section + with the relocation and the opd entry. */ + value -= value2; + + /* The result becomes the addend of the relocation. */ + rel.r_addend = value; + + /* The section symbol becomes the symbol for the dynamic + relocation. */ + dynindx + = _bfd_elf_link_lookup_local_dynindx (info, + rent->sec->owner, + rent->sec_symndx); + } + else + rel.r_addend = rent->addend; + + rel.r_info = ELF64_R_INFO (dynindx, rent->type); + + loc = hppa_info->other_rel_sec->contents; + loc += (hppa_info->other_rel_sec->reloc_count++ + * sizeof (Elf64_External_Rela)); + bfd_elf64_swap_reloca_out (hppa_info->other_rel_sec->output_section->owner, + &rel, loc); + } + } + + return TRUE; +} + +/* Used to decide how to sort relocs in an optimal manner for the + dynamic linker, before writing them out. */ + +static enum elf_reloc_type_class +elf64_hppa_reloc_type_class (rela) + const Elf_Internal_Rela *rela; +{ + if (ELF64_R_SYM (rela->r_info) == 0) + return reloc_class_relative; + + switch ((int) ELF64_R_TYPE (rela->r_info)) + { + case R_PARISC_IPLT: + return reloc_class_plt; + case R_PARISC_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} + +/* Finish up the dynamic sections. */ + +static bfd_boolean +elf64_hppa_finish_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + bfd *dynobj; + asection *sdyn; + struct elf64_hppa_link_hash_table *hppa_info; + + hppa_info = elf64_hppa_hash_table (info); + + /* Finalize the contents of the .opd section. */ + elf64_hppa_dyn_hash_traverse (&hppa_info->dyn_hash_table, + elf64_hppa_finalize_opd, + info); + + elf64_hppa_dyn_hash_traverse (&hppa_info->dyn_hash_table, + elf64_hppa_finalize_dynreloc, + info); + + /* Finalize the contents of the .dlt section. */ + dynobj = elf_hash_table (info)->dynobj; + /* Finalize the contents of the .dlt section. */ + elf64_hppa_dyn_hash_traverse (&hppa_info->dyn_hash_table, + elf64_hppa_finalize_dlt, + info); + + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (elf_hash_table (info)->dynamic_sections_created) + { + Elf64_External_Dyn *dyncon, *dynconend; + + BFD_ASSERT (sdyn != NULL); + + dyncon = (Elf64_External_Dyn *) sdyn->contents; + dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + asection *s; + + bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + break; + + case DT_HP_LOAD_MAP: + /* Compute the absolute address of 16byte scratchpad area + for the dynamic linker. + + By convention the linker script will allocate the scratchpad + area at the start of the .data section. So all we have to + to is find the start of the .data section. */ + s = bfd_get_section_by_name (output_bfd, ".data"); + dyn.d_un.d_ptr = s->vma; + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_PLTGOT: + /* HP's use PLTGOT to set the GOT register. */ + dyn.d_un.d_ptr = _bfd_get_gp_value (output_bfd); + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_JMPREL: + s = hppa_info->plt_rel_sec; + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_PLTRELSZ: + s = hppa_info->plt_rel_sec; + dyn.d_un.d_val = s->_raw_size; + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_RELA: + s = hppa_info->other_rel_sec; + if (! s || ! s->_raw_size) + s = hppa_info->dlt_rel_sec; + if (! s || ! s->_raw_size) + s = hppa_info->opd_rel_sec; + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_RELASZ: + s = hppa_info->other_rel_sec; + dyn.d_un.d_val = s->_raw_size; + s = hppa_info->dlt_rel_sec; + dyn.d_un.d_val += s->_raw_size; + s = hppa_info->opd_rel_sec; + dyn.d_un.d_val += s->_raw_size; + /* There is some question about whether or not the size of + the PLT relocs should be included here. HP's tools do + it, so we'll emulate them. */ + s = hppa_info->plt_rel_sec; + dyn.d_un.d_val += s->_raw_size; + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + } + } + } + + return TRUE; +} + +/* Return the number of additional phdrs we will need. + + The generic ELF code only creates PT_PHDRs for executables. The HP + dynamic linker requires PT_PHDRs for dynamic libraries too. + + This routine indicates that the backend needs one additional program + header for that case. + + Note we do not have access to the link info structure here, so we have + to guess whether or not we are building a shared library based on the + existence of a .interp section. */ + +static int +elf64_hppa_additional_program_headers (abfd) + bfd *abfd; +{ + asection *s; + + /* If we are creating a shared library, then we have to create a + PT_PHDR segment. HP's dynamic linker chokes without it. */ + s = bfd_get_section_by_name (abfd, ".interp"); + if (! s) + return 1; + return 0; +} + +/* Allocate and initialize any program headers required by this + specific backend. + + The generic ELF code only creates PT_PHDRs for executables. The HP + dynamic linker requires PT_PHDRs for dynamic libraries too. + + This allocates the PT_PHDR and initializes it in a manner suitable + for the HP linker. + + Note we do not have access to the link info structure here, so we have + to guess whether or not we are building a shared library based on the + existence of a .interp section. */ + +static bfd_boolean +elf64_hppa_modify_segment_map (abfd, info) + bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; +{ + struct elf_segment_map *m; + asection *s; + + s = bfd_get_section_by_name (abfd, ".interp"); + if (! s) + { + for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) + if (m->p_type == PT_PHDR) + break; + if (m == NULL) + { + m = ((struct elf_segment_map *) + bfd_zalloc (abfd, (bfd_size_type) sizeof *m)); + if (m == NULL) + return FALSE; + + m->p_type = PT_PHDR; + m->p_flags = PF_R | PF_X; + m->p_flags_valid = 1; + m->p_paddr_valid = 1; + m->includes_phdrs = 1; + + m->next = elf_tdata (abfd)->segment_map; + elf_tdata (abfd)->segment_map = m; + } + } + + for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) + if (m->p_type == PT_LOAD) + { + unsigned int i; + + for (i = 0; i < m->count; i++) + { + /* The code "hint" is not really a hint. It is a requirement + for certain versions of the HP dynamic linker. Worse yet, + it must be set even if the shared library does not have + any code in its "text" segment (thus the check for .hash + to catch this situation). */ + if (m->sections[i]->flags & SEC_CODE + || (strcmp (m->sections[i]->name, ".hash") == 0)) + m->p_flags |= (PF_X | PF_HP_CODE); + } + } + + return TRUE; +} + +/* Called when writing out an object file to decide the type of a + symbol. */ +static int +elf64_hppa_elf_get_symbol_type (elf_sym, type) + Elf_Internal_Sym *elf_sym; + int type; +{ + if (ELF_ST_TYPE (elf_sym->st_info) == STT_PARISC_MILLI) + return STT_PARISC_MILLI; + else + return type; +} + +static struct bfd_elf_special_section const elf64_hppa_special_sections[]= +{ + { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } +}; + +/* The hash bucket size is the standard one, namely 4. */ + +const struct elf_size_info hppa64_elf_size_info = +{ + sizeof (Elf64_External_Ehdr), + sizeof (Elf64_External_Phdr), + sizeof (Elf64_External_Shdr), + sizeof (Elf64_External_Rel), + sizeof (Elf64_External_Rela), + sizeof (Elf64_External_Sym), + sizeof (Elf64_External_Dyn), + sizeof (Elf_External_Note), + 4, + 1, + 64, 3, + ELFCLASS64, EV_CURRENT, + bfd_elf64_write_out_phdrs, + bfd_elf64_write_shdrs_and_ehdr, + bfd_elf64_write_relocs, + bfd_elf64_swap_symbol_in, + bfd_elf64_swap_symbol_out, + bfd_elf64_slurp_reloc_table, + bfd_elf64_slurp_symbol_table, + bfd_elf64_swap_dyn_in, + bfd_elf64_swap_dyn_out, + bfd_elf64_swap_reloc_in, + bfd_elf64_swap_reloc_out, + bfd_elf64_swap_reloca_in, + bfd_elf64_swap_reloca_out +}; + +#define TARGET_BIG_SYM bfd_elf64_hppa_vec +#define TARGET_BIG_NAME "elf64-hppa" +#define ELF_ARCH bfd_arch_hppa +#define ELF_MACHINE_CODE EM_PARISC +/* This is not strictly correct. The maximum page size for PA2.0 is + 64M. But everything still uses 4k. */ +#define ELF_MAXPAGESIZE 0x1000 +#define bfd_elf64_bfd_reloc_type_lookup elf_hppa_reloc_type_lookup +#define bfd_elf64_bfd_is_local_label_name elf_hppa_is_local_label_name +#define elf_info_to_howto elf_hppa_info_to_howto +#define elf_info_to_howto_rel elf_hppa_info_to_howto_rel + +#define elf_backend_section_from_shdr elf64_hppa_section_from_shdr +#define elf_backend_object_p elf64_hppa_object_p +#define elf_backend_final_write_processing \ + elf_hppa_final_write_processing +#define elf_backend_fake_sections elf_hppa_fake_sections +#define elf_backend_add_symbol_hook elf_hppa_add_symbol_hook + +#define elf_backend_relocate_section elf_hppa_relocate_section + +#define bfd_elf64_bfd_final_link elf_hppa_final_link + +#define elf_backend_create_dynamic_sections \ + elf64_hppa_create_dynamic_sections +#define elf_backend_post_process_headers elf64_hppa_post_process_headers + +#define elf_backend_adjust_dynamic_symbol \ + elf64_hppa_adjust_dynamic_symbol + +#define elf_backend_size_dynamic_sections \ + elf64_hppa_size_dynamic_sections + +#define elf_backend_finish_dynamic_symbol \ + elf64_hppa_finish_dynamic_symbol +#define elf_backend_finish_dynamic_sections \ + elf64_hppa_finish_dynamic_sections + +/* Stuff for the BFD linker: */ +#define bfd_elf64_bfd_link_hash_table_create \ + elf64_hppa_hash_table_create + +#define elf_backend_check_relocs \ + elf64_hppa_check_relocs + +#define elf_backend_size_info \ + hppa64_elf_size_info + +#define elf_backend_additional_program_headers \ + elf64_hppa_additional_program_headers + +#define elf_backend_modify_segment_map \ + elf64_hppa_modify_segment_map + +#define elf_backend_link_output_symbol_hook \ + elf64_hppa_link_output_symbol_hook + +#define elf_backend_want_got_plt 0 +#define elf_backend_plt_readonly 0 +#define elf_backend_want_plt_sym 0 +#define elf_backend_got_header_size 0 +#define elf_backend_type_change_ok TRUE +#define elf_backend_get_symbol_type elf64_hppa_elf_get_symbol_type +#define elf_backend_reloc_type_class elf64_hppa_reloc_type_class +#define elf_backend_rela_normal 1 +#define elf_backend_special_sections elf64_hppa_special_sections + +#include "elf64-target.h" + +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf64_hppa_linux_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf64-hppa-linux" + +#undef elf_backend_special_sections + +#define INCLUDED_TARGET_FILE 1 +#include "elf64-target.h" diff --git a/bfd/elf64-hppa.h b/bfd/elf64-hppa.h new file mode 100644 index 0000000000000..7bb5a26dee5ab --- /dev/null +++ b/bfd/elf64-hppa.h @@ -0,0 +1,50 @@ +/* ELF64/HPPA support + + Copyright 1999, 2000, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#ifndef _ELF64_HPPA_H +#define _ELF64_HPPA_H + +#include "elf-bfd.h" +#include "libhppa.h" +#include "elf/hppa.h" + +elf_hppa_reloc_type elf64_hppa_reloc_final_type + PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int)); + +extern elf_hppa_reloc_type ** _bfd_elf64_hppa_gen_reloc_type + PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int, int, asymbol *)); + +/* Define groups of basic relocations. FIXME: These should + be the only basic relocations created by GAS. The rest + should be internal to the BFD backend. + + The idea is both SOM and ELF define these basic relocation + types so they map into a SOM or ELF specific relocation + as appropriate. This allows GAS to share much more code + between the two target object formats. */ + +#define R_HPPA_NONE R_PARISC_NONE +#define R_HPPA R_PARISC_DIR64 +#define R_HPPA_GOTOFF R_PARISC_DLTREL21L +#define R_HPPA_PCREL_CALL R_PARISC_PCREL21L +#define R_HPPA_ABS_CALL R_PARISC_DIR17F +#define R_HPPA_COMPLEX R_PARISC_UNIMPLEMENTED + +#endif /* _ELF64_HPPA_H */ diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c new file mode 100644 index 0000000000000..4b78681faecae --- /dev/null +++ b/bfd/elf64-mmix.c @@ -0,0 +1,3032 @@ +/* MMIX-specific support for 64-bit ELF. + Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Contributed by Hans-Peter Nilsson + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* No specific ABI or "processor-specific supplement" defined. */ + +/* TODO: + - "Traditional" linker relaxation (shrinking whole sections). + - Merge reloc stubs jumping to same location. + - GETA stub relaxation (call a stub for out of range new + R_MMIX_GETA_STUBBABLE). */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/mmix.h" +#include "opcode/mmix.h" + +#define MINUS_ONE (((bfd_vma) 0) - 1) + +#define MAX_PUSHJ_STUB_SIZE (5 * 4) + +/* Put these everywhere in new code. */ +#define FATAL_DEBUG \ + _bfd_abort (__FILE__, __LINE__, \ + "Internal: Non-debugged code (test-case missing)") + +#define BAD_CASE(x) \ + _bfd_abort (__FILE__, __LINE__, \ + "bad case for " #x) + +struct _mmix_elf_section_data +{ + struct bfd_elf_section_data elf; + union + { + struct bpo_reloc_section_info *reloc; + struct bpo_greg_section_info *greg; + } bpo; + + struct pushj_stub_info + { + /* Maximum number of stubs needed for this section. */ + bfd_size_type n_pushj_relocs; + + /* Size of stubs after a mmix_elf_relax_section round. */ + bfd_size_type stubs_size_sum; + + /* Per-reloc stubs_size_sum information. The stubs_size_sum member is the sum + of these. Allocated in mmix_elf_check_common_relocs. */ + bfd_size_type *stub_size; + + /* Offset of next stub during relocation. Somewhat redundant with the + above: error coverage is easier and we don't have to reset the + stubs_size_sum for relocation. */ + bfd_size_type stub_offset; + } pjs; +}; + +#define mmix_elf_section_data(sec) \ + ((struct _mmix_elf_section_data *) elf_section_data (sec)) + +/* For each section containing a base-plus-offset (BPO) reloc, we attach + this struct as mmix_elf_section_data (section)->bpo, which is otherwise + NULL. */ +struct bpo_reloc_section_info + { + /* The base is 1; this is the first number in this section. */ + size_t first_base_plus_offset_reloc; + + /* Number of BPO-relocs in this section. */ + size_t n_bpo_relocs_this_section; + + /* Running index, used at relocation time. */ + size_t bpo_index; + + /* We don't have access to the bfd_link_info struct in + mmix_final_link_relocate. What we really want to get at is the + global single struct greg_relocation, so we stash it here. */ + asection *bpo_greg_section; + }; + +/* Helper struct (in global context) for the one below. + There's one of these created for every BPO reloc. */ +struct bpo_reloc_request + { + bfd_vma value; + + /* Valid after relaxation. The base is 0; the first register number + must be added. The offset is in range 0..255. */ + size_t regindex; + size_t offset; + + /* The order number for this BPO reloc, corresponding to the order in + which BPO relocs were found. Used to create an index after reloc + requests are sorted. */ + size_t bpo_reloc_no; + + /* Set when the value is computed. Better than coding "guard values" + into the other members. Is FALSE only for BPO relocs in a GC:ed + section. */ + bfd_boolean valid; + }; + +/* We attach this as mmix_elf_section_data (sec)->bpo in the linker-allocated + greg contents section (MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME), + which is linked into the register contents section + (MMIX_REG_CONTENTS_SECTION_NAME). This section is created by the + linker; using the same hook as for usual with BPO relocs does not + collide. */ +struct bpo_greg_section_info + { + /* After GC, this reflects the number of remaining, non-excluded + BPO-relocs. */ + size_t n_bpo_relocs; + + /* This is the number of allocated bpo_reloc_requests; the size of + sorted_indexes. Valid after the check.*relocs functions are called + for all incoming sections. It includes the number of BPO relocs in + sections that were GC:ed. */ + size_t n_max_bpo_relocs; + + /* A counter used to find out when to fold the BPO gregs, since we + don't have a single "after-relaxation" hook. */ + size_t n_remaining_bpo_relocs_this_relaxation_round; + + /* The number of linker-allocated GREGs resulting from BPO relocs. + This is an approximation after _bfd_mmix_before_linker_allocation + and supposedly accurate after mmix_elf_relax_section is called for + all incoming non-collected sections. */ + size_t n_allocated_bpo_gregs; + + /* Index into reloc_request[], sorted on increasing "value", secondary + by increasing index for strict sorting order. */ + size_t *bpo_reloc_indexes; + + /* An array of all relocations, with the "value" member filled in by + the relaxation function. */ + struct bpo_reloc_request *reloc_request; + }; + +static bfd_boolean mmix_elf_link_output_symbol_hook + PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *)); + +static bfd_reloc_status_type mmix_elf_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + +static reloc_howto_type *bfd_elf64_bfd_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); + +static void mmix_info_to_howto_rela + PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); + +static int mmix_elf_sort_relocs PARAMS ((const PTR, const PTR)); + +static bfd_boolean mmix_elf_new_section_hook + PARAMS ((bfd *, asection *)); + +static bfd_boolean mmix_elf_check_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); + +static bfd_boolean mmix_elf_check_common_relocs + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); + +static bfd_boolean mmix_elf_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); + +static asection * mmix_elf_gc_mark_hook + PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); + +static bfd_boolean mmix_elf_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); + +static bfd_reloc_status_type mmix_final_link_relocate + PARAMS ((reloc_howto_type *, asection *, bfd_byte *, + bfd_vma, bfd_signed_vma, bfd_vma, const char *, asection *)); + +static bfd_reloc_status_type mmix_elf_perform_relocation + PARAMS ((asection *, reloc_howto_type *, PTR, bfd_vma, bfd_vma)); + +static bfd_boolean mmix_elf_section_from_bfd_section + PARAMS ((bfd *, asection *, int *)); + +static bfd_boolean mmix_elf_add_symbol_hook + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *, + const char **, flagword *, asection **, bfd_vma *)); + +static bfd_boolean mmix_elf_is_local_label_name + PARAMS ((bfd *, const char *)); + +static int bpo_reloc_request_sort_fn PARAMS ((const PTR, const PTR)); + +static bfd_boolean mmix_elf_relax_section + PARAMS ((bfd *abfd, asection *sec, struct bfd_link_info *link_info, + bfd_boolean *again)); + +extern bfd_boolean mmix_elf_final_link PARAMS ((bfd *, struct bfd_link_info *)); + +extern void mmix_elf_symbol_processing PARAMS ((bfd *, asymbol *)); + +/* Only intended to be called from a debugger. */ +extern void mmix_dump_bpo_gregs + PARAMS ((struct bfd_link_info *, bfd_error_handler_type)); + +static void +mmix_set_relaxable_size + PARAMS ((bfd *, asection *, void *)); + +static bfd_boolean +mmix_elf_get_section_contents + PARAMS ((bfd *, sec_ptr, void *, file_ptr, bfd_size_type)); + + +/* Watch out: this currently needs to have elements with the same index as + their R_MMIX_ number. */ +static reloc_howto_type elf_mmix_howto_table[] = + { + /* This reloc does nothing. */ + HOWTO (R_MMIX_NONE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MMIX_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 8 bit absolute relocation. */ + HOWTO (R_MMIX_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MMIX_8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 16 bit absolute relocation. */ + HOWTO (R_MMIX_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MMIX_16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 24 bit absolute relocation. */ + HOWTO (R_MMIX_24, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MMIX_24", /* name */ + FALSE, /* partial_inplace */ + ~0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit absolute relocation. */ + HOWTO (R_MMIX_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MMIX_32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 64 bit relocation. */ + HOWTO (R_MMIX_64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MMIX_64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + MINUS_ONE, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* An 8 bit PC-relative relocation. */ + HOWTO (R_MMIX_PC_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MMIX_PC_8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* An 16 bit PC-relative relocation. */ + HOWTO (R_MMIX_PC_16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MMIX_PC_16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* An 24 bit PC-relative relocation. */ + HOWTO (R_MMIX_PC_24, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MMIX_PC_24", /* name */ + FALSE, /* partial_inplace */ + ~0xffffff, /* src_mask */ + 0xffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 32 bit absolute PC-relative relocation. */ + HOWTO (R_MMIX_PC_32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MMIX_PC_32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 64 bit PC-relative relocation. */ + HOWTO (R_MMIX_PC_64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_MMIX_PC_64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + MINUS_ONE, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy. */ + HOWTO (R_MMIX_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_MMIX_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage. */ + HOWTO (R_MMIX_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_MMIX_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The GETA relocation is supposed to get any address that could + possibly be reached by the GETA instruction. It can silently expand + to get a 64-bit operand, but will complain if any of the two least + significant bits are set. The howto members reflect a simple GETA. */ + HOWTO (R_MMIX_GETA, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_GETA", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MMIX_GETA_1, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_GETA_1", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MMIX_GETA_2, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_GETA_2", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MMIX_GETA_3, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_GETA_3", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The conditional branches are supposed to reach any (code) address. + It can silently expand to a 64-bit operand, but will emit an error if + any of the two least significant bits are set. The howto members + reflect a simple branch. */ + HOWTO (R_MMIX_CBRANCH, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_CBRANCH", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MMIX_CBRANCH_J, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_CBRANCH_J", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MMIX_CBRANCH_1, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_CBRANCH_1", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MMIX_CBRANCH_2, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_CBRANCH_2", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MMIX_CBRANCH_3, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_CBRANCH_3", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The PUSHJ instruction can reach any (code) address, as long as it's + the beginning of a function (no usable restriction). It can silently + expand to a 64-bit operand, but will emit an error if any of the two + least significant bits are set. It can also expand into a call to a + stub; see R_MMIX_PUSHJ_STUBBABLE. The howto members reflect a simple + PUSHJ. */ + HOWTO (R_MMIX_PUSHJ, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_PUSHJ", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MMIX_PUSHJ_1, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_PUSHJ_1", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MMIX_PUSHJ_2, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_PUSHJ_2", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MMIX_PUSHJ_3, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_PUSHJ_3", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A JMP is supposed to reach any (code) address. By itself, it can + reach +-64M; the expansion can reach all 64 bits. Note that the 64M + limit is soon reached if you link the program in wildly different + memory segments. The howto members reflect a trivial JMP. */ + HOWTO (R_MMIX_JMP, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 27, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_JMP", /* name */ + FALSE, /* partial_inplace */ + ~0x1ffffff, /* src_mask */ + 0x1ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MMIX_JMP_1, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 27, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_JMP_1", /* name */ + FALSE, /* partial_inplace */ + ~0x1ffffff, /* src_mask */ + 0x1ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MMIX_JMP_2, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 27, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_JMP_2", /* name */ + FALSE, /* partial_inplace */ + ~0x1ffffff, /* src_mask */ + 0x1ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_MMIX_JMP_3, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 27, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_JMP_3", /* name */ + FALSE, /* partial_inplace */ + ~0x1ffffff, /* src_mask */ + 0x1ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* When we don't emit link-time-relaxable code from the assembler, or + when relaxation has done all it can do, these relocs are used. For + GETA/PUSHJ/branches. */ + HOWTO (R_MMIX_ADDR19, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_ADDR19", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* For JMP. */ + HOWTO (R_MMIX_ADDR27, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 27, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_ADDR27", /* name */ + FALSE, /* partial_inplace */ + ~0x1ffffff, /* src_mask */ + 0x1ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A general register or the value 0..255. If a value, then the + instruction (offset -3) needs adjusting. */ + HOWTO (R_MMIX_REG_OR_BYTE, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_REG_OR_BYTE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A general register. */ + HOWTO (R_MMIX_REG, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_REG", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A register plus an index, corresponding to the relocation expression. + The sizes must correspond to the valid range of the expression, while + the bitmasks correspond to what we store in the image. */ + HOWTO (R_MMIX_BASE_PLUS_OFFSET, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_BASE_PLUS_OFFSET", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A "magic" relocation for a LOCAL expression, asserting that the + expression is less than the number of global registers. No actual + modification of the contents is done. Implementing this as a + relocation was less intrusive than e.g. putting such expressions in a + section to discard *after* relocation. */ + HOWTO (R_MMIX_LOCAL, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_LOCAL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MMIX_PUSHJ_STUBBABLE, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + mmix_elf_reloc, /* special_function */ + "R_MMIX_PUSHJ_STUBBABLE", /* name */ + FALSE, /* partial_inplace */ + ~0x0100ffff, /* src_mask */ + 0x0100ffff, /* dst_mask */ + TRUE) /* pcrel_offset */ + }; + + +/* Map BFD reloc types to MMIX ELF reloc types. */ + +struct mmix_reloc_map + { + bfd_reloc_code_real_type bfd_reloc_val; + enum elf_mmix_reloc_type elf_reloc_val; + }; + + +static const struct mmix_reloc_map mmix_reloc_map[] = + { + {BFD_RELOC_NONE, R_MMIX_NONE}, + {BFD_RELOC_8, R_MMIX_8}, + {BFD_RELOC_16, R_MMIX_16}, + {BFD_RELOC_24, R_MMIX_24}, + {BFD_RELOC_32, R_MMIX_32}, + {BFD_RELOC_64, R_MMIX_64}, + {BFD_RELOC_8_PCREL, R_MMIX_PC_8}, + {BFD_RELOC_16_PCREL, R_MMIX_PC_16}, + {BFD_RELOC_24_PCREL, R_MMIX_PC_24}, + {BFD_RELOC_32_PCREL, R_MMIX_PC_32}, + {BFD_RELOC_64_PCREL, R_MMIX_PC_64}, + {BFD_RELOC_VTABLE_INHERIT, R_MMIX_GNU_VTINHERIT}, + {BFD_RELOC_VTABLE_ENTRY, R_MMIX_GNU_VTENTRY}, + {BFD_RELOC_MMIX_GETA, R_MMIX_GETA}, + {BFD_RELOC_MMIX_CBRANCH, R_MMIX_CBRANCH}, + {BFD_RELOC_MMIX_PUSHJ, R_MMIX_PUSHJ}, + {BFD_RELOC_MMIX_JMP, R_MMIX_JMP}, + {BFD_RELOC_MMIX_ADDR19, R_MMIX_ADDR19}, + {BFD_RELOC_MMIX_ADDR27, R_MMIX_ADDR27}, + {BFD_RELOC_MMIX_REG_OR_BYTE, R_MMIX_REG_OR_BYTE}, + {BFD_RELOC_MMIX_REG, R_MMIX_REG}, + {BFD_RELOC_MMIX_BASE_PLUS_OFFSET, R_MMIX_BASE_PLUS_OFFSET}, + {BFD_RELOC_MMIX_LOCAL, R_MMIX_LOCAL}, + {BFD_RELOC_MMIX_PUSHJ_STUBBABLE, R_MMIX_PUSHJ_STUBBABLE} + }; + +static reloc_howto_type * +bfd_elf64_bfd_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; + i < sizeof (mmix_reloc_map) / sizeof (mmix_reloc_map[0]); + i++) + { + if (mmix_reloc_map[i].bfd_reloc_val == code) + return &elf_mmix_howto_table[mmix_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +static bfd_boolean +mmix_elf_new_section_hook (abfd, sec) + bfd *abfd; + asection *sec; +{ + struct _mmix_elf_section_data *sdata; + bfd_size_type amt = sizeof (*sdata); + + sdata = (struct _mmix_elf_section_data *) bfd_zalloc (abfd, amt); + if (sdata == NULL) + return FALSE; + sec->used_by_bfd = (PTR) sdata; + + return _bfd_elf_new_section_hook (abfd, sec); +} + + +/* This function performs the actual bitfiddling and sanity check for a + final relocation. Each relocation gets its *worst*-case expansion + in size when it arrives here; any reduction in size should have been + caught in linker relaxation earlier. When we get here, the relocation + looks like the smallest instruction with SWYM:s (nop:s) appended to the + max size. We fill in those nop:s. + + R_MMIX_GETA: (FIXME: Relaxation should break this up in 1, 2, 3 tetra) + GETA $N,foo + -> + SETL $N,foo & 0xffff + INCML $N,(foo >> 16) & 0xffff + INCMH $N,(foo >> 32) & 0xffff + INCH $N,(foo >> 48) & 0xffff + + R_MMIX_CBRANCH: (FIXME: Relaxation should break this up, but + condbranches needing relaxation might be rare enough to not be + worthwhile.) + [P]Bcc $N,foo + -> + [~P]B~cc $N,.+20 + SETL $255,foo & ... + INCML ... + INCMH ... + INCH ... + GO $255,$255,0 + + R_MMIX_PUSHJ: (FIXME: Relaxation...) + PUSHJ $N,foo + -> + SETL $255,foo & ... + INCML ... + INCMH ... + INCH ... + PUSHGO $N,$255,0 + + R_MMIX_JMP: (FIXME: Relaxation...) + JMP foo + -> + SETL $255,foo & ... + INCML ... + INCMH ... + INCH ... + GO $255,$255,0 + + R_MMIX_ADDR19 and R_MMIX_ADDR27 are just filled in. */ + +static bfd_reloc_status_type +mmix_elf_perform_relocation (isec, howto, datap, addr, value) + asection *isec; + reloc_howto_type *howto; + PTR datap; + bfd_vma addr; + bfd_vma value; +{ + bfd *abfd = isec->owner; + bfd_reloc_status_type flag = bfd_reloc_ok; + bfd_reloc_status_type r; + int offs = 0; + int reg = 255; + + /* The worst case bits are all similar SETL/INCML/INCMH/INCH sequences. + We handle the differences here and the common sequence later. */ + switch (howto->type) + { + case R_MMIX_GETA: + offs = 0; + reg = bfd_get_8 (abfd, (bfd_byte *) datap + 1); + + /* We change to an absolute value. */ + value += addr; + break; + + case R_MMIX_CBRANCH: + { + int in1 = bfd_get_16 (abfd, (bfd_byte *) datap) << 16; + + /* Invert the condition and prediction bit, and set the offset + to five instructions ahead. + + We *can* do better if we want to. If the branch is found to be + within limits, we could leave the branch as is; there'll just + be a bunch of NOP:s after it. But we shouldn't see this + sequence often enough that it's worth doing it. */ + + bfd_put_32 (abfd, + (((in1 ^ ((PRED_INV_BIT | COND_INV_BIT) << 24)) & ~0xffff) + | (24/4)), + (bfd_byte *) datap); + + /* Put a "GO $255,$255,0" after the common sequence. */ + bfd_put_32 (abfd, + ((GO_INSN_BYTE | IMM_OFFSET_BIT) << 24) | 0xffff00, + (bfd_byte *) datap + 20); + + /* Common sequence starts at offset 4. */ + offs = 4; + + /* We change to an absolute value. */ + value += addr; + } + break; + + case R_MMIX_PUSHJ_STUBBABLE: + /* If the address fits, we're fine. */ + if ((value & 3) == 0 + /* Note rightshift 0; see R_MMIX_JMP case below. */ + && (r = bfd_check_overflow (complain_overflow_signed, + howto->bitsize, + 0, + bfd_arch_bits_per_address (abfd), + value)) == bfd_reloc_ok) + goto pcrel_mmix_reloc_fits; + else + { + bfd_size_type raw_size + = (isec->_raw_size + - mmix_elf_section_data (isec)->pjs.n_pushj_relocs + * MAX_PUSHJ_STUB_SIZE); + + /* We have the bytes at the PUSHJ insn and need to get the + position for the stub. There's supposed to be room allocated + for the stub. */ + bfd_byte *stubcontents + = ((char *) datap + - (addr - (isec->output_section->vma + isec->output_offset)) + + raw_size + + mmix_elf_section_data (isec)->pjs.stub_offset); + bfd_vma stubaddr; + + /* The address doesn't fit, so redirect the PUSHJ to the + location of the stub. */ + r = mmix_elf_perform_relocation (isec, + &elf_mmix_howto_table + [R_MMIX_ADDR19], + datap, + addr, + isec->output_section->vma + + isec->output_offset + + raw_size + + (mmix_elf_section_data (isec) + ->pjs.stub_offset) + - addr); + if (r != bfd_reloc_ok) + return r; + + stubaddr + = (isec->output_section->vma + + isec->output_offset + + raw_size + + mmix_elf_section_data (isec)->pjs.stub_offset); + + /* We generate a simple JMP if that suffices, else the whole 5 + insn stub. */ + if (bfd_check_overflow (complain_overflow_signed, + elf_mmix_howto_table[R_MMIX_ADDR27].bitsize, + 0, + bfd_arch_bits_per_address (abfd), + addr + value - stubaddr) == bfd_reloc_ok) + { + bfd_put_32 (abfd, JMP_INSN_BYTE << 24, stubcontents); + r = mmix_elf_perform_relocation (isec, + &elf_mmix_howto_table + [R_MMIX_ADDR27], + stubcontents, + stubaddr, + value + addr - stubaddr); + mmix_elf_section_data (isec)->pjs.stub_offset += 4; + + if (raw_size + + mmix_elf_section_data (isec)->pjs.stub_offset + > isec->_cooked_size) + abort (); + + return r; + } + else + { + /* Put a "GO $255,0" after the common sequence. */ + bfd_put_32 (abfd, + ((GO_INSN_BYTE | IMM_OFFSET_BIT) << 24) + | 0xff00, (bfd_byte *) stubcontents + 16); + + /* Prepare for the general code to set the first part of the + linker stub, and */ + value += addr; + datap = stubcontents; + mmix_elf_section_data (isec)->pjs.stub_offset + += MAX_PUSHJ_STUB_SIZE; + } + } + break; + + case R_MMIX_PUSHJ: + { + int inreg = bfd_get_8 (abfd, (bfd_byte *) datap + 1); + + /* Put a "PUSHGO $N,$255,0" after the common sequence. */ + bfd_put_32 (abfd, + ((PUSHGO_INSN_BYTE | IMM_OFFSET_BIT) << 24) + | (inreg << 16) + | 0xff00, + (bfd_byte *) datap + 16); + + /* We change to an absolute value. */ + value += addr; + } + break; + + case R_MMIX_JMP: + /* This one is a little special. If we get here on a non-relaxing + link, and the destination is actually in range, we don't need to + execute the nops. + If so, we fall through to the bit-fiddling relocs. + + FIXME: bfd_check_overflow seems broken; the relocation is + rightshifted before testing, so supply a zero rightshift. */ + + if (! ((value & 3) == 0 + && (r = bfd_check_overflow (complain_overflow_signed, + howto->bitsize, + 0, + bfd_arch_bits_per_address (abfd), + value)) == bfd_reloc_ok)) + { + /* If the relocation doesn't fit in a JMP, we let the NOP:s be + modified below, and put a "GO $255,$255,0" after the + address-loading sequence. */ + bfd_put_32 (abfd, + ((GO_INSN_BYTE | IMM_OFFSET_BIT) << 24) + | 0xffff00, + (bfd_byte *) datap + 16); + + /* We change to an absolute value. */ + value += addr; + break; + } + /* FALLTHROUGH. */ + case R_MMIX_ADDR19: + case R_MMIX_ADDR27: + pcrel_mmix_reloc_fits: + /* These must be in range, or else we emit an error. */ + if ((value & 3) == 0 + /* Note rightshift 0; see above. */ + && (r = bfd_check_overflow (complain_overflow_signed, + howto->bitsize, + 0, + bfd_arch_bits_per_address (abfd), + value)) == bfd_reloc_ok) + { + bfd_vma in1 + = bfd_get_32 (abfd, (bfd_byte *) datap); + bfd_vma highbit; + + if ((bfd_signed_vma) value < 0) + { + highbit = 1 << 24; + value += (1 << (howto->bitsize - 1)); + } + else + highbit = 0; + + value >>= 2; + + bfd_put_32 (abfd, + (in1 & howto->src_mask) + | highbit + | (value & howto->dst_mask), + (bfd_byte *) datap); + + return bfd_reloc_ok; + } + else + return bfd_reloc_overflow; + + case R_MMIX_BASE_PLUS_OFFSET: + { + struct bpo_reloc_section_info *bpodata + = mmix_elf_section_data (isec)->bpo.reloc; + asection *bpo_greg_section + = bpodata->bpo_greg_section; + struct bpo_greg_section_info *gregdata + = mmix_elf_section_data (bpo_greg_section)->bpo.greg; + size_t bpo_index + = gregdata->bpo_reloc_indexes[bpodata->bpo_index++]; + + /* A consistency check: The value we now have in "relocation" must + be the same as the value we stored for that relocation. It + doesn't cost much, so can be left in at all times. */ + if (value != gregdata->reloc_request[bpo_index].value) + { + (*_bfd_error_handler) + (_("%s: Internal inconsistency error for value for\n\ + linker-allocated global register: linked: 0x%lx%08lx != relaxed: 0x%lx%08lx\n"), + bfd_get_filename (isec->owner), + (unsigned long) (value >> 32), (unsigned long) value, + (unsigned long) (gregdata->reloc_request[bpo_index].value + >> 32), + (unsigned long) gregdata->reloc_request[bpo_index].value); + bfd_set_error (bfd_error_bad_value); + return bfd_reloc_overflow; + } + + /* Then store the register number and offset for that register + into datap and datap + 1 respectively. */ + bfd_put_8 (abfd, + gregdata->reloc_request[bpo_index].regindex + + bpo_greg_section->output_section->vma / 8, + datap); + bfd_put_8 (abfd, + gregdata->reloc_request[bpo_index].offset, + ((unsigned char *) datap) + 1); + return bfd_reloc_ok; + } + + case R_MMIX_REG_OR_BYTE: + case R_MMIX_REG: + if (value > 255) + return bfd_reloc_overflow; + bfd_put_8 (abfd, value, datap); + return bfd_reloc_ok; + + default: + BAD_CASE (howto->type); + } + + /* This code adds the common SETL/INCML/INCMH/INCH worst-case + sequence. */ + + /* Lowest two bits must be 0. We return bfd_reloc_overflow for + everything that looks strange. */ + if (value & 3) + flag = bfd_reloc_overflow; + + bfd_put_32 (abfd, + (SETL_INSN_BYTE << 24) | (value & 0xffff) | (reg << 16), + (bfd_byte *) datap + offs); + bfd_put_32 (abfd, + (INCML_INSN_BYTE << 24) | ((value >> 16) & 0xffff) | (reg << 16), + (bfd_byte *) datap + offs + 4); + bfd_put_32 (abfd, + (INCMH_INSN_BYTE << 24) | ((value >> 32) & 0xffff) | (reg << 16), + (bfd_byte *) datap + offs + 8); + bfd_put_32 (abfd, + (INCH_INSN_BYTE << 24) | ((value >> 48) & 0xffff) | (reg << 16), + (bfd_byte *) datap + offs + 12); + + return flag; +} + +/* Set the howto pointer for an MMIX ELF reloc (type RELA). */ + +static void +mmix_info_to_howto_rela (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf_Internal_Rela *dst; +{ + unsigned int r_type; + + r_type = ELF64_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_MMIX_max); + cache_ptr->howto = &elf_mmix_howto_table[r_type]; +} + +/* Any MMIX-specific relocation gets here at assembly time or when linking + to other formats (such as mmo); this is the relocation function from + the reloc_table. We don't get here for final pure ELF linking. */ + +static bfd_reloc_status_type +mmix_elf_reloc (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + bfd_vma relocation; + bfd_reloc_status_type r; + asection *reloc_target_output_section; + bfd_reloc_status_type flag = bfd_reloc_ok; + bfd_vma output_base = 0; + bfd_vma addr; + + r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + + /* If that was all that was needed (i.e. this isn't a final link, only + some segment adjustments), we're done. */ + if (r != bfd_reloc_continue) + return r; + + if (bfd_is_und_section (symbol->section) + && (symbol->flags & BSF_WEAK) == 0 + && output_bfd == (bfd *) NULL) + return bfd_reloc_undefined; + + /* Is the address of the relocation really within the section? */ + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + /* Work out which section the relocation is targeted at and the + initial relocation command value. */ + + /* Get symbol value. (Common symbols are special.) */ + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + reloc_target_output_section = bfd_get_output_section (symbol); + + /* Here the variable relocation holds the final address of the symbol we + are relocating against, plus any addend. */ + if (output_bfd) + output_base = 0; + else + output_base = reloc_target_output_section->vma; + + relocation += output_base + symbol->section->output_offset; + + /* Get position of relocation. */ + addr = (reloc_entry->address + input_section->output_section->vma + + input_section->output_offset); + if (output_bfd != (bfd *) NULL) + { + /* Add in supplied addend. */ + relocation += reloc_entry->addend; + + /* This is a partial relocation, and we want to apply the + relocation to the reloc entry rather than the raw data. + Modify the reloc inplace to reflect what we now know. */ + reloc_entry->addend = relocation; + reloc_entry->address += input_section->output_offset; + return flag; + } + + return mmix_final_link_relocate (reloc_entry->howto, input_section, + data, reloc_entry->address, + reloc_entry->addend, relocation, + bfd_asymbol_name (symbol), + reloc_target_output_section); +} + +/* Relocate an MMIX ELF section. Modified from elf32-fr30.c; look to it + for guidance if you're thinking of copying this. */ + +static bfd_boolean +mmix_elf_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + bfd_size_type raw_size + = (input_section->_raw_size + - mmix_elf_section_data (input_section)->pjs.n_pushj_relocs + * MAX_PUSHJ_STUB_SIZE); + size_t pjsno = 0; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + relend = relocs + input_section->reloc_count; + + for (rel = relocs; rel < relend; rel ++) + { + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + const char *name = NULL; + int r_type; + bfd_boolean undefined_signalled = FALSE; + + r_type = ELF64_R_TYPE (rel->r_info); + + if (r_type == R_MMIX_GNU_VTINHERIT + || r_type == R_MMIX_GNU_VTENTRY) + continue; + + r_symndx = ELF64_R_SYM (rel->r_info); + + if (info->relocatable) + { + /* This is a relocatable link. For most relocs we don't have to + change anything, unless the reloc is against a section + symbol, in which case we have to adjust according to where + the section symbol winds up in the output section. */ + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + sec = local_sections [r_symndx]; + rel->r_addend += sec->output_offset + sym->st_value; + } + } + + /* For PUSHJ stub relocs however, we may need to change the + reloc and the section contents, if the reloc doesn't reach + beyond the end of the output section and previous stubs. + Then we change the section contents to be a PUSHJ to the end + of the input section plus stubs (we can do that without using + a reloc), and then we change the reloc to be a R_MMIX_PUSHJ + at the stub location. */ + if (r_type == R_MMIX_PUSHJ_STUBBABLE) + { + /* We've already checked whether we need a stub; use that + knowledge. */ + if (mmix_elf_section_data (input_section)->pjs.stub_size[pjsno] + != 0) + { + Elf_Internal_Rela relcpy; + + if (mmix_elf_section_data (input_section) + ->pjs.stub_size[pjsno] != MAX_PUSHJ_STUB_SIZE) + abort (); + + /* There's already a PUSHJ insn there, so just fill in + the offset bits to the stub. */ + if (mmix_final_link_relocate (elf_mmix_howto_table + + R_MMIX_ADDR19, + input_section, + contents, + rel->r_offset, + 0, + input_section + ->output_section->vma + + input_section->output_offset + + raw_size + + mmix_elf_section_data (input_section) + ->pjs.stub_offset, + NULL, NULL) != bfd_reloc_ok) + return FALSE; + + /* Put a JMP insn at the stub; it goes with the + R_MMIX_JMP reloc. */ + bfd_put_32 (output_bfd, JMP_INSN_BYTE << 24, + contents + + raw_size + + mmix_elf_section_data (input_section) + ->pjs.stub_offset); + + /* Change the reloc to be at the stub, and to a full + R_MMIX_JMP reloc. */ + rel->r_info = ELF64_R_INFO (r_symndx, R_MMIX_JMP); + rel->r_offset + = (raw_size + + mmix_elf_section_data (input_section) + ->pjs.stub_offset); + + mmix_elf_section_data (input_section)->pjs.stub_offset + += MAX_PUSHJ_STUB_SIZE; + + /* Shift this reloc to the end of the relocs to maintain + the r_offset sorted reloc order. */ + relcpy = *rel; + memmove (rel, rel + 1, (char *) relend - (char *) rel); + relend[-1] = relcpy; + + /* Back up one reloc, or else we'd skip the next reloc + in turn. */ + rel--; + } + + pjsno++; + } + continue; + } + + /* This is a final link. */ + howto = elf_mmix_howto_table + ELF64_R_TYPE (rel->r_info); + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections [r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + + name = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name); + if (name == NULL) + name = bfd_section_name (input_bfd, sec); + } + else + { + bfd_boolean unresolved_reloc; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, undefined_signalled); + name = h->root.root.string; + } + + r = mmix_final_link_relocate (howto, input_section, + contents, rel->r_offset, + rel->r_addend, relocation, name, sec); + + if (r != bfd_reloc_ok) + { + bfd_boolean check_ok = TRUE; + const char * msg = (const char *) NULL; + + switch (r) + { + case bfd_reloc_overflow: + check_ok = info->callbacks->reloc_overflow + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset); + break; + + case bfd_reloc_undefined: + /* We may have sent this message above. */ + if (! undefined_signalled) + check_ok = info->callbacks->undefined_symbol + (info, name, input_bfd, input_section, rel->r_offset, + TRUE); + undefined_signalled = TRUE; + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + break; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + break; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous relocation"); + break; + + default: + msg = _("internal error: unknown error"); + break; + } + + if (msg) + check_ok = info->callbacks->warning + (info, msg, name, input_bfd, input_section, rel->r_offset); + + if (! check_ok) + return FALSE; + } + } + + return TRUE; +} + +/* Perform a single relocation. By default we use the standard BFD + routines. A few relocs we have to do ourselves. */ + +static bfd_reloc_status_type +mmix_final_link_relocate (howto, input_section, contents, + r_offset, r_addend, relocation, symname, symsec) + reloc_howto_type *howto; + asection *input_section; + bfd_byte *contents; + bfd_vma r_offset; + bfd_signed_vma r_addend; + bfd_vma relocation; + const char *symname; + asection *symsec; +{ + bfd_reloc_status_type r = bfd_reloc_ok; + bfd_vma addr + = (input_section->output_section->vma + + input_section->output_offset + + r_offset); + bfd_signed_vma srel + = (bfd_signed_vma) relocation + r_addend; + + switch (howto->type) + { + /* All these are PC-relative. */ + case R_MMIX_PUSHJ_STUBBABLE: + case R_MMIX_PUSHJ: + case R_MMIX_CBRANCH: + case R_MMIX_ADDR19: + case R_MMIX_GETA: + case R_MMIX_ADDR27: + case R_MMIX_JMP: + contents += r_offset; + + srel -= (input_section->output_section->vma + + input_section->output_offset + + r_offset); + + r = mmix_elf_perform_relocation (input_section, howto, contents, + addr, srel); + break; + + case R_MMIX_BASE_PLUS_OFFSET: + if (symsec == NULL) + return bfd_reloc_undefined; + + /* Check that we're not relocating against a register symbol. */ + if (strcmp (bfd_get_section_name (symsec->owner, symsec), + MMIX_REG_CONTENTS_SECTION_NAME) == 0 + || strcmp (bfd_get_section_name (symsec->owner, symsec), + MMIX_REG_SECTION_NAME) == 0) + { + /* Note: This is separated out into two messages in order + to ease the translation into other languages. */ + if (symname == NULL || *symname == 0) + (*_bfd_error_handler) + (_("%s: base-plus-offset relocation against register symbol: (unknown) in %s"), + bfd_get_filename (input_section->owner), + bfd_get_section_name (symsec->owner, symsec)); + else + (*_bfd_error_handler) + (_("%s: base-plus-offset relocation against register symbol: %s in %s"), + bfd_get_filename (input_section->owner), symname, + bfd_get_section_name (symsec->owner, symsec)); + return bfd_reloc_overflow; + } + goto do_mmix_reloc; + + case R_MMIX_REG_OR_BYTE: + case R_MMIX_REG: + /* For now, we handle these alike. They must refer to an register + symbol, which is either relative to the register section and in + the range 0..255, or is in the register contents section with vma + regno * 8. */ + + /* FIXME: A better way to check for reg contents section? + FIXME: Postpone section->scaling to mmix_elf_perform_relocation? */ + if (symsec == NULL) + return bfd_reloc_undefined; + + if (strcmp (bfd_get_section_name (symsec->owner, symsec), + MMIX_REG_CONTENTS_SECTION_NAME) == 0) + { + if ((srel & 7) != 0 || srel < 32*8 || srel > 255*8) + { + /* The bfd_reloc_outofrange return value, though intuitively + a better value, will not get us an error. */ + return bfd_reloc_overflow; + } + srel /= 8; + } + else if (strcmp (bfd_get_section_name (symsec->owner, symsec), + MMIX_REG_SECTION_NAME) == 0) + { + if (srel < 0 || srel > 255) + /* The bfd_reloc_outofrange return value, though intuitively a + better value, will not get us an error. */ + return bfd_reloc_overflow; + } + else + { + /* Note: This is separated out into two messages in order + to ease the translation into other languages. */ + if (symname == NULL || *symname == 0) + (*_bfd_error_handler) + (_("%s: register relocation against non-register symbol: (unknown) in %s"), + bfd_get_filename (input_section->owner), + bfd_get_section_name (symsec->owner, symsec)); + else + (*_bfd_error_handler) + (_("%s: register relocation against non-register symbol: %s in %s"), + bfd_get_filename (input_section->owner), symname, + bfd_get_section_name (symsec->owner, symsec)); + + /* The bfd_reloc_outofrange return value, though intuitively a + better value, will not get us an error. */ + return bfd_reloc_overflow; + } + do_mmix_reloc: + contents += r_offset; + r = mmix_elf_perform_relocation (input_section, howto, contents, + addr, srel); + break; + + case R_MMIX_LOCAL: + /* This isn't a real relocation, it's just an assertion that the + final relocation value corresponds to a local register. We + ignore the actual relocation; nothing is changed. */ + { + asection *regsec + = bfd_get_section_by_name (input_section->output_section->owner, + MMIX_REG_CONTENTS_SECTION_NAME); + bfd_vma first_global; + + /* Check that this is an absolute value, or a reference to the + register contents section or the register (symbol) section. + Absolute numbers can get here as undefined section. Undefined + symbols are signalled elsewhere, so there's no conflict in us + accidentally handling it. */ + if (!bfd_is_abs_section (symsec) + && !bfd_is_und_section (symsec) + && strcmp (bfd_get_section_name (symsec->owner, symsec), + MMIX_REG_CONTENTS_SECTION_NAME) != 0 + && strcmp (bfd_get_section_name (symsec->owner, symsec), + MMIX_REG_SECTION_NAME) != 0) + { + (*_bfd_error_handler) + (_("%s: directive LOCAL valid only with a register or absolute value"), + bfd_get_filename (input_section->owner)); + + return bfd_reloc_overflow; + } + + /* If we don't have a register contents section, then $255 is the + first global register. */ + if (regsec == NULL) + first_global = 255; + else + { + first_global = bfd_get_section_vma (abfd, regsec) / 8; + if (strcmp (bfd_get_section_name (symsec->owner, symsec), + MMIX_REG_CONTENTS_SECTION_NAME) == 0) + { + if ((srel & 7) != 0 || srel < 32*8 || srel > 255*8) + /* The bfd_reloc_outofrange return value, though + intuitively a better value, will not get us an error. */ + return bfd_reloc_overflow; + srel /= 8; + } + } + + if ((bfd_vma) srel >= first_global) + { + /* FIXME: Better error message. */ + (*_bfd_error_handler) + (_("%s: LOCAL directive: Register $%ld is not a local register. First global register is $%ld."), + bfd_get_filename (input_section->owner), (long) srel, (long) first_global); + + return bfd_reloc_overflow; + } + } + r = bfd_reloc_ok; + break; + + default: + r = _bfd_final_link_relocate (howto, input_section->owner, input_section, + contents, r_offset, + relocation, r_addend); + } + + return r; +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +mmix_elf_gc_mark_hook (sec, info, rel, h, sym) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + if (h != NULL) + { + switch (ELF64_R_TYPE (rel->r_info)) + { + case R_MMIX_GNU_VTINHERIT: + case R_MMIX_GNU_VTENTRY: + break; + + default: + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update relocation info for a GC-excluded section. We could supposedly + perform the allocation after GC, but there's no suitable hook between + GC (or section merge) and the point when all input sections must be + present. Better to waste some memory and (perhaps) a little time. */ + +static bfd_boolean +mmix_elf_gc_sweep_hook (abfd, info, sec, relocs) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; +{ + struct bpo_reloc_section_info *bpodata + = mmix_elf_section_data (sec)->bpo.reloc; + asection *allocated_gregs_section; + + /* If no bpodata here, we have nothing to do. */ + if (bpodata == NULL) + return TRUE; + + allocated_gregs_section = bpodata->bpo_greg_section; + + mmix_elf_section_data (allocated_gregs_section)->bpo.greg->n_bpo_relocs + -= bpodata->n_bpo_relocs_this_section; + + return TRUE; +} + +/* Sort register relocs to come before expanding relocs. */ + +static int +mmix_elf_sort_relocs (p1, p2) + const PTR p1; + const PTR p2; +{ + const Elf_Internal_Rela *r1 = (const Elf_Internal_Rela *) p1; + const Elf_Internal_Rela *r2 = (const Elf_Internal_Rela *) p2; + int r1_is_reg, r2_is_reg; + + /* Sort primarily on r_offset & ~3, so relocs are done to consecutive + insns. */ + if ((r1->r_offset & ~(bfd_vma) 3) > (r2->r_offset & ~(bfd_vma) 3)) + return 1; + else if ((r1->r_offset & ~(bfd_vma) 3) < (r2->r_offset & ~(bfd_vma) 3)) + return -1; + + r1_is_reg + = (ELF64_R_TYPE (r1->r_info) == R_MMIX_REG_OR_BYTE + || ELF64_R_TYPE (r1->r_info) == R_MMIX_REG); + r2_is_reg + = (ELF64_R_TYPE (r2->r_info) == R_MMIX_REG_OR_BYTE + || ELF64_R_TYPE (r2->r_info) == R_MMIX_REG); + if (r1_is_reg != r2_is_reg) + return r2_is_reg - r1_is_reg; + + /* Neither or both are register relocs. Then sort on full offset. */ + if (r1->r_offset > r2->r_offset) + return 1; + else if (r1->r_offset < r2->r_offset) + return -1; + return 0; +} + +/* Subset of mmix_elf_check_relocs, common to ELF and mmo linking. */ + +static bfd_boolean +mmix_elf_check_common_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + bfd *bpo_greg_owner = NULL; + asection *allocated_gregs_section = NULL; + struct bpo_greg_section_info *gregdata = NULL; + struct bpo_reloc_section_info *bpodata = NULL; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + + /* We currently have to abuse this COFF-specific member, since there's + no target-machine-dedicated member. There's no alternative outside + the bfd_link_info struct; we can't specialize a hash-table since + they're different between ELF and mmo. */ + bpo_greg_owner = (bfd *) info->base_file; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + switch (ELF64_R_TYPE (rel->r_info)) + { + /* This relocation causes a GREG allocation. We need to count + them, and we need to create a section for them, so we need an + object to fake as the owner of that section. We can't use + the ELF dynobj for this, since the ELF bits assume lots of + DSO-related stuff if that member is non-NULL. */ + case R_MMIX_BASE_PLUS_OFFSET: + /* We don't do anything with this reloc for a relocatable link. */ + if (info->relocatable) + break; + + if (bpo_greg_owner == NULL) + { + bpo_greg_owner = abfd; + info->base_file = (PTR) bpo_greg_owner; + } + + if (allocated_gregs_section == NULL) + allocated_gregs_section + = bfd_get_section_by_name (bpo_greg_owner, + MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME); + + if (allocated_gregs_section == NULL) + { + allocated_gregs_section + = bfd_make_section (bpo_greg_owner, + MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME); + /* Setting both SEC_ALLOC and SEC_LOAD means the section is + treated like any other section, and we'd get errors for + address overlap with the text section. Let's set none of + those flags, as that is what currently happens for usual + GREG allocations, and that works. */ + if (allocated_gregs_section == NULL + || !bfd_set_section_flags (bpo_greg_owner, + allocated_gregs_section, + (SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED)) + || !bfd_set_section_alignment (bpo_greg_owner, + allocated_gregs_section, + 3)) + return FALSE; + + gregdata = (struct bpo_greg_section_info *) + bfd_zalloc (bpo_greg_owner, sizeof (struct bpo_greg_section_info)); + if (gregdata == NULL) + return FALSE; + mmix_elf_section_data (allocated_gregs_section)->bpo.greg + = gregdata; + } + else if (gregdata == NULL) + gregdata + = mmix_elf_section_data (allocated_gregs_section)->bpo.greg; + + /* Get ourselves some auxiliary info for the BPO-relocs. */ + if (bpodata == NULL) + { + /* No use doing a separate iteration pass to find the upper + limit - just use the number of relocs. */ + bpodata = (struct bpo_reloc_section_info *) + bfd_alloc (bpo_greg_owner, + sizeof (struct bpo_reloc_section_info) + * (sec->reloc_count + 1)); + if (bpodata == NULL) + return FALSE; + mmix_elf_section_data (sec)->bpo.reloc = bpodata; + bpodata->first_base_plus_offset_reloc + = bpodata->bpo_index + = gregdata->n_max_bpo_relocs; + bpodata->bpo_greg_section + = allocated_gregs_section; + bpodata->n_bpo_relocs_this_section = 0; + } + + bpodata->n_bpo_relocs_this_section++; + gregdata->n_max_bpo_relocs++; + + /* We don't get another chance to set this before GC; we've not + set up any hook that runs before GC. */ + gregdata->n_bpo_relocs + = gregdata->n_max_bpo_relocs; + break; + + case R_MMIX_PUSHJ_STUBBABLE: + mmix_elf_section_data (sec)->pjs.n_pushj_relocs++; + break; + } + } + + /* Allocate per-reloc stub storage and initialize it to the max stub + size. */ + if (mmix_elf_section_data (sec)->pjs.n_pushj_relocs != 0) + { + size_t i; + + mmix_elf_section_data (sec)->pjs.stub_size + = bfd_alloc (abfd, mmix_elf_section_data (sec)->pjs.n_pushj_relocs + * sizeof (mmix_elf_section_data (sec) + ->pjs.stub_size[0])); + if (mmix_elf_section_data (sec)->pjs.stub_size == NULL) + return FALSE; + + for (i = 0; i < mmix_elf_section_data (sec)->pjs.n_pushj_relocs; i++) + mmix_elf_section_data (sec)->pjs.stub_size[i] = MAX_PUSHJ_STUB_SIZE; + } + + return TRUE; +} + +/* Look through the relocs for a section during the first phase. */ + +static bfd_boolean +mmix_elf_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf64_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + /* First we sort the relocs so that any register relocs come before + expansion-relocs to the same insn. FIXME: Not done for mmo. */ + qsort ((PTR) relocs, sec->reloc_count, sizeof (Elf_Internal_Rela), + mmix_elf_sort_relocs); + + /* Do the common part. */ + if (!mmix_elf_check_common_relocs (abfd, info, sec, relocs)) + return FALSE; + + if (info->relocatable) + return TRUE; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF64_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + switch (ELF64_R_TYPE (rel->r_info)) + { + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_MMIX_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_MMIX_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + } + } + + return TRUE; +} + +/* Wrapper for mmix_elf_check_common_relocs, called when linking to mmo. + Copied from elf_link_add_object_symbols. */ + +bfd_boolean +_bfd_mmix_check_all_relocs (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + asection *o; + + for (o = abfd->sections; o != NULL; o = o->next) + { + Elf_Internal_Rela *internal_relocs; + bfd_boolean ok; + + if ((o->flags & SEC_RELOC) == 0 + || o->reloc_count == 0 + || ((info->strip == strip_all || info->strip == strip_debugger) + && (o->flags & SEC_DEBUGGING) != 0) + || bfd_is_abs_section (o->output_section)) + continue; + + internal_relocs + = _bfd_elf_link_read_relocs (abfd, o, (PTR) NULL, + (Elf_Internal_Rela *) NULL, + info->keep_memory); + if (internal_relocs == NULL) + return FALSE; + + ok = mmix_elf_check_common_relocs (abfd, info, o, internal_relocs); + + if (! info->keep_memory) + free (internal_relocs); + + if (! ok) + return FALSE; + } + + return TRUE; +} + +/* Change symbols relative to the reg contents section to instead be to + the register section, and scale them down to correspond to the register + number. */ + +static bfd_boolean +mmix_elf_link_output_symbol_hook (info, name, sym, input_sec, h) + struct bfd_link_info *info ATTRIBUTE_UNUSED; + const char *name ATTRIBUTE_UNUSED; + Elf_Internal_Sym *sym; + asection *input_sec; + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED; +{ + if (input_sec != NULL + && input_sec->name != NULL + && ELF_ST_TYPE (sym->st_info) != STT_SECTION + && strcmp (input_sec->name, MMIX_REG_CONTENTS_SECTION_NAME) == 0) + { + sym->st_value /= 8; + sym->st_shndx = SHN_REGISTER; + } + + return TRUE; +} + +/* We fake a register section that holds values that are register numbers. + Having a SHN_REGISTER and register section translates better to other + formats (e.g. mmo) than for example a STT_REGISTER attribute. + This section faking is based on a construct in elf32-mips.c. */ +static asection mmix_elf_reg_section; +static asymbol mmix_elf_reg_section_symbol; +static asymbol *mmix_elf_reg_section_symbol_ptr; + +/* Handle the special section numbers that a symbol may use. */ + +void +mmix_elf_symbol_processing (abfd, asym) + bfd *abfd ATTRIBUTE_UNUSED; + asymbol *asym; +{ + elf_symbol_type *elfsym; + + elfsym = (elf_symbol_type *) asym; + switch (elfsym->internal_elf_sym.st_shndx) + { + case SHN_REGISTER: + if (mmix_elf_reg_section.name == NULL) + { + /* Initialize the register section. */ + mmix_elf_reg_section.name = MMIX_REG_SECTION_NAME; + mmix_elf_reg_section.flags = SEC_NO_FLAGS; + mmix_elf_reg_section.output_section = &mmix_elf_reg_section; + mmix_elf_reg_section.symbol = &mmix_elf_reg_section_symbol; + mmix_elf_reg_section.symbol_ptr_ptr = &mmix_elf_reg_section_symbol_ptr; + mmix_elf_reg_section_symbol.name = MMIX_REG_SECTION_NAME; + mmix_elf_reg_section_symbol.flags = BSF_SECTION_SYM; + mmix_elf_reg_section_symbol.section = &mmix_elf_reg_section; + mmix_elf_reg_section_symbol_ptr = &mmix_elf_reg_section_symbol; + } + asym->section = &mmix_elf_reg_section; + break; + + default: + break; + } +} + +/* Given a BFD section, try to locate the corresponding ELF section + index. */ + +static bfd_boolean +mmix_elf_section_from_bfd_section (abfd, sec, retval) + bfd * abfd ATTRIBUTE_UNUSED; + asection * sec; + int * retval; +{ + if (strcmp (bfd_get_section_name (abfd, sec), MMIX_REG_SECTION_NAME) == 0) + *retval = SHN_REGISTER; + else + return FALSE; + + return TRUE; +} + +/* Hook called by the linker routine which adds symbols from an object + file. We must handle the special SHN_REGISTER section number here. + + We also check that we only have *one* each of the section-start + symbols, since otherwise having two with the same value would cause + them to be "merged", but with the contents serialized. */ + +bfd_boolean +mmix_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) + bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + Elf_Internal_Sym *sym; + const char **namep ATTRIBUTE_UNUSED; + flagword *flagsp ATTRIBUTE_UNUSED; + asection **secp; + bfd_vma *valp ATTRIBUTE_UNUSED; +{ + if (sym->st_shndx == SHN_REGISTER) + *secp = bfd_make_section_old_way (abfd, MMIX_REG_SECTION_NAME); + else if ((*namep)[0] == '_' && (*namep)[1] == '_' && (*namep)[2] == '.' + && strncmp (*namep, MMIX_LOC_SECTION_START_SYMBOL_PREFIX, + strlen (MMIX_LOC_SECTION_START_SYMBOL_PREFIX)) == 0) + { + /* See if we have another one. */ + struct bfd_link_hash_entry *h = bfd_link_hash_lookup (info->hash, + *namep, + FALSE, + FALSE, + FALSE); + + if (h != NULL && h->type != bfd_link_hash_undefined) + { + /* How do we get the asymbol (or really: the filename) from h? + h->u.def.section->owner is NULL. */ + ((*_bfd_error_handler) + (_("%s: Error: multiple definition of `%s'; start of %s is set in a earlier linked file\n"), + bfd_get_filename (abfd), *namep, + *namep + strlen (MMIX_LOC_SECTION_START_SYMBOL_PREFIX))); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + + return TRUE; +} + +/* We consider symbols matching "L.*:[0-9]+" to be local symbols. */ + +bfd_boolean +mmix_elf_is_local_label_name (abfd, name) + bfd *abfd; + const char *name; +{ + const char *colpos; + int digits; + + /* Also include the default local-label definition. */ + if (_bfd_elf_is_local_label_name (abfd, name)) + return TRUE; + + if (*name != 'L') + return FALSE; + + /* If there's no ":", or more than one, it's not a local symbol. */ + colpos = strchr (name, ':'); + if (colpos == NULL || strchr (colpos + 1, ':') != NULL) + return FALSE; + + /* Check that there are remaining characters and that they are digits. */ + if (colpos[1] == 0) + return FALSE; + + digits = strspn (colpos + 1, "0123456789"); + return digits != 0 && colpos[1 + digits] == 0; +} + +/* We get rid of the register section here. */ + +bfd_boolean +mmix_elf_final_link (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + /* We never output a register section, though we create one for + temporary measures. Check that nobody entered contents into it. */ + asection *reg_section; + asection **secpp; + + reg_section = bfd_get_section_by_name (abfd, MMIX_REG_SECTION_NAME); + + if (reg_section != NULL) + { + /* FIXME: Pass error state gracefully. */ + if (bfd_get_section_flags (abfd, reg_section) & SEC_HAS_CONTENTS) + _bfd_abort (__FILE__, __LINE__, _("Register section has contents\n")); + + /* Really remove the section. */ + for (secpp = &abfd->sections; + *secpp != reg_section; + secpp = &(*secpp)->next) + ; + bfd_section_list_remove (abfd, secpp); + --abfd->section_count; + } + + if (! bfd_elf_final_link (abfd, info)) + return FALSE; + + /* Since this section is marked SEC_LINKER_CREATED, it isn't output by + the regular linker machinery. We do it here, like other targets with + special sections. */ + if (info->base_file != NULL) + { + asection *greg_section + = bfd_get_section_by_name ((bfd *) info->base_file, + MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME); + if (!bfd_set_section_contents (abfd, + greg_section->output_section, + greg_section->contents, + (file_ptr) greg_section->output_offset, + greg_section->_cooked_size)) + return FALSE; + } + return TRUE; +} + +/* We need to include the maximum size of PUSHJ-stubs in the initial + section size. This is expected to shrink during linker relaxation. + + You might think that we should set *only* _cooked_size, but that won't + work: section contents allocation will be using _raw_size in mixed + format linking and not enough storage will be allocated. FIXME: That's + a major bug, including the name bfd_get_section_size_before_reloc; it + should be bfd_get_section_size_before_relax. The relaxation functions + set _cooked size. Relaxation happens before relocation. All functions + *after relaxation* should be using _cooked size. */ + +static void +mmix_set_relaxable_size (abfd, sec, ptr) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + void *ptr; +{ + struct bfd_link_info *info = ptr; + + /* Make sure we only do this for section where we know we want this, + otherwise we might end up resetting the size of COMMONs. */ + if (mmix_elf_section_data (sec)->pjs.n_pushj_relocs == 0) + return; + + sec->_cooked_size + = (sec->_raw_size + + mmix_elf_section_data (sec)->pjs.n_pushj_relocs + * MAX_PUSHJ_STUB_SIZE); + sec->_raw_size = sec->_cooked_size; + + /* For use in relocatable link, we start with a max stubs size. See + mmix_elf_relax_section. */ + if (info->relocatable && sec->output_section) + mmix_elf_section_data (sec->output_section)->pjs.stubs_size_sum + += (mmix_elf_section_data (sec)->pjs.n_pushj_relocs + * MAX_PUSHJ_STUB_SIZE); +} + +/* Initialize stuff for the linker-generated GREGs to match + R_MMIX_BASE_PLUS_OFFSET relocs seen by the linker. */ + +bfd_boolean +_bfd_mmix_before_linker_allocation (abfd, info) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info; +{ + asection *bpo_gregs_section; + bfd *bpo_greg_owner; + struct bpo_greg_section_info *gregdata; + size_t n_gregs; + bfd_vma gregs_size; + size_t i; + size_t *bpo_reloc_indexes; + bfd *ibfd; + + /* Set the initial size of sections. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + bfd_map_over_sections (ibfd, mmix_set_relaxable_size, info); + + /* The bpo_greg_owner bfd is supposed to have been set by + mmix_elf_check_relocs when the first R_MMIX_BASE_PLUS_OFFSET is seen. + If there is no such object, there was no R_MMIX_BASE_PLUS_OFFSET. */ + bpo_greg_owner = (bfd *) info->base_file; + if (bpo_greg_owner == NULL) + return TRUE; + + bpo_gregs_section + = bfd_get_section_by_name (bpo_greg_owner, + MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME); + + if (bpo_gregs_section == NULL) + return TRUE; + + /* We use the target-data handle in the ELF section data. */ + gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg; + if (gregdata == NULL) + return FALSE; + + n_gregs = gregdata->n_bpo_relocs; + gregdata->n_allocated_bpo_gregs = n_gregs; + + /* When this reaches zero during relaxation, all entries have been + filled in and the size of the linker gregs can be calculated. */ + gregdata->n_remaining_bpo_relocs_this_relaxation_round = n_gregs; + + /* Set the zeroth-order estimate for the GREGs size. */ + gregs_size = n_gregs * 8; + + if (!bfd_set_section_size (bpo_greg_owner, bpo_gregs_section, gregs_size)) + return FALSE; + + /* Allocate and set up the GREG arrays. They're filled in at relaxation + time. Note that we must use the max number ever noted for the array, + since the index numbers were created before GC. */ + gregdata->reloc_request + = bfd_zalloc (bpo_greg_owner, + sizeof (struct bpo_reloc_request) + * gregdata->n_max_bpo_relocs); + + gregdata->bpo_reloc_indexes + = bpo_reloc_indexes + = bfd_alloc (bpo_greg_owner, + gregdata->n_max_bpo_relocs + * sizeof (size_t)); + if (bpo_reloc_indexes == NULL) + return FALSE; + + /* The default order is an identity mapping. */ + for (i = 0; i < gregdata->n_max_bpo_relocs; i++) + { + bpo_reloc_indexes[i] = i; + gregdata->reloc_request[i].bpo_reloc_no = i; + } + + return TRUE; +} + +/* Fill in contents in the linker allocated gregs. Everything is + calculated at this point; we just move the contents into place here. */ + +bfd_boolean +_bfd_mmix_after_linker_allocation (abfd, link_info) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *link_info; +{ + asection *bpo_gregs_section; + bfd *bpo_greg_owner; + struct bpo_greg_section_info *gregdata; + size_t n_gregs; + size_t i, j; + size_t lastreg; + bfd_byte *contents; + + /* The bpo_greg_owner bfd is supposed to have been set by mmix_elf_check_relocs + when the first R_MMIX_BASE_PLUS_OFFSET is seen. If there is no such + object, there was no R_MMIX_BASE_PLUS_OFFSET. */ + bpo_greg_owner = (bfd *) link_info->base_file; + if (bpo_greg_owner == NULL) + return TRUE; + + bpo_gregs_section + = bfd_get_section_by_name (bpo_greg_owner, + MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME); + + /* This can't happen without DSO handling. When DSOs are handled + without any R_MMIX_BASE_PLUS_OFFSET seen, there will be no such + section. */ + if (bpo_gregs_section == NULL) + return TRUE; + + /* We use the target-data handle in the ELF section data. */ + + gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg; + if (gregdata == NULL) + return FALSE; + + n_gregs = gregdata->n_allocated_bpo_gregs; + + /* We need to have a _raw_size contents even though there's only + _cooked_size worth of data, since the generic relocation machinery + will allocate and copy that much temporarily. */ + bpo_gregs_section->contents + = contents = bfd_alloc (bpo_greg_owner, bpo_gregs_section->_raw_size); + if (contents == NULL) + return FALSE; + + /* Sanity check: If these numbers mismatch, some relocation has not been + accounted for and the rest of gregdata is probably inconsistent. + It's a bug, but it's more helpful to identify it than segfaulting + below. */ + if (gregdata->n_remaining_bpo_relocs_this_relaxation_round + != gregdata->n_bpo_relocs) + { + (*_bfd_error_handler) + (_("Internal inconsistency: remaining %u != max %u.\n\ + Please report this bug."), + gregdata->n_remaining_bpo_relocs_this_relaxation_round, + gregdata->n_bpo_relocs); + return FALSE; + } + + for (lastreg = 255, i = 0, j = 0; j < n_gregs; i++) + if (gregdata->reloc_request[i].regindex != lastreg) + { + bfd_put_64 (bpo_greg_owner, gregdata->reloc_request[i].value, + contents + j * 8); + lastreg = gregdata->reloc_request[i].regindex; + j++; + } + + return TRUE; +} + +/* Sort valid relocs to come before non-valid relocs, then on increasing + value. */ + +static int +bpo_reloc_request_sort_fn (p1, p2) + const PTR p1; + const PTR p2; +{ + const struct bpo_reloc_request *r1 = (const struct bpo_reloc_request *) p1; + const struct bpo_reloc_request *r2 = (const struct bpo_reloc_request *) p2; + + /* Primary function is validity; non-valid relocs sorted after valid + ones. */ + if (r1->valid != r2->valid) + return r2->valid - r1->valid; + + /* Then sort on value. Don't simplify and return just the difference of + the values: the upper bits of the 64-bit value would be truncated on + a host with 32-bit ints. */ + if (r1->value != r2->value) + return r1->value > r2->value ? 1 : -1; + + /* As a last re-sort, use the relocation number, so we get a stable + sort. The *addresses* aren't stable since items are swapped during + sorting. It depends on the qsort implementation if this actually + happens. */ + return r1->bpo_reloc_no > r2->bpo_reloc_no + ? 1 : (r1->bpo_reloc_no < r2->bpo_reloc_no ? -1 : 0); +} + +/* For debug use only. Dumps the global register allocations resulting + from base-plus-offset relocs. */ + +void +mmix_dump_bpo_gregs (link_info, pf) + struct bfd_link_info *link_info; + bfd_error_handler_type pf; +{ + bfd *bpo_greg_owner; + asection *bpo_gregs_section; + struct bpo_greg_section_info *gregdata; + unsigned int i; + + if (link_info == NULL || link_info->base_file == NULL) + return; + + bpo_greg_owner = (bfd *) link_info->base_file; + + bpo_gregs_section + = bfd_get_section_by_name (bpo_greg_owner, + MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME); + + if (bpo_gregs_section == NULL) + return; + + gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg; + if (gregdata == NULL) + return; + + if (pf == NULL) + pf = _bfd_error_handler; + + /* These format strings are not translated. They are for debug purposes + only and never displayed to an end user. Should they escape, we + surely want them in original. */ + (*pf) (" n_bpo_relocs: %u\n n_max_bpo_relocs: %u\n n_remain...round: %u\n\ + n_allocated_bpo_gregs: %u\n", gregdata->n_bpo_relocs, + gregdata->n_max_bpo_relocs, + gregdata->n_remaining_bpo_relocs_this_relaxation_round, + gregdata->n_allocated_bpo_gregs); + + if (gregdata->reloc_request) + for (i = 0; i < gregdata->n_max_bpo_relocs; i++) + (*pf) ("%4u (%4u)/%4u#%u: 0x%08lx%08lx r: %3u o: %3u\n", + i, + (gregdata->bpo_reloc_indexes != NULL + ? gregdata->bpo_reloc_indexes[i] : (size_t) -1), + gregdata->reloc_request[i].bpo_reloc_no, + gregdata->reloc_request[i].valid, + + (unsigned long) (gregdata->reloc_request[i].value >> 32), + (unsigned long) gregdata->reloc_request[i].value, + gregdata->reloc_request[i].regindex, + gregdata->reloc_request[i].offset); +} + +/* This links all R_MMIX_BASE_PLUS_OFFSET relocs into a special array, and + when the last such reloc is done, an index-array is sorted according to + the values and iterated over to produce register numbers (indexed by 0 + from the first allocated register number) and offsets for use in real + relocation. + + PUSHJ stub accounting is also done here. + + Symbol- and reloc-reading infrastructure copied from elf-m10200.c. */ + +static bfd_boolean +mmix_elf_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + bfd_boolean *again; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *irel, *irelend; + asection *bpo_gregs_section = NULL; + struct bpo_greg_section_info *gregdata; + struct bpo_reloc_section_info *bpodata + = mmix_elf_section_data (sec)->bpo.reloc; + /* The initialization is to quiet compiler warnings. The value is to + spot a missing actual initialization. */ + size_t bpono = (size_t) -1; + size_t pjsno = 0; + bfd *bpo_greg_owner; + Elf_Internal_Sym *isymbuf = NULL; + bfd_size_type raw_size + = (sec->_raw_size + - mmix_elf_section_data (sec)->pjs.n_pushj_relocs + * MAX_PUSHJ_STUB_SIZE); + + mmix_elf_section_data (sec)->pjs.stubs_size_sum = 0; + + /* Assume nothing changes. */ + *again = FALSE; + + /* If this is the first time we have been called for this section, + initialize the cooked size. */ + if (sec->_cooked_size == 0 && sec->_raw_size != 0) + abort (); + + /* We don't have to do anything if this section does not have relocs, or + if this is not a code section. */ + if ((sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0 + || (sec->flags & SEC_CODE) == 0 + || (sec->flags & SEC_LINKER_CREATED) != 0 + /* If no R_MMIX_BASE_PLUS_OFFSET relocs and no PUSHJ-stub relocs, + then nothing to do. */ + || (bpodata == NULL + && mmix_elf_section_data (sec)->pjs.n_pushj_relocs == 0)) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + bpo_greg_owner = (bfd *) link_info->base_file; + + if (bpodata != NULL) + { + bpo_gregs_section = bpodata->bpo_greg_section; + gregdata = mmix_elf_section_data (bpo_gregs_section)->bpo.greg; + bpono = bpodata->first_base_plus_offset_reloc; + } + else + gregdata = NULL; + + /* Get a copy of the native relocations. */ + internal_relocs + = _bfd_elf_link_read_relocs (abfd, sec, (PTR) NULL, + (Elf_Internal_Rela *) NULL, + link_info->keep_memory); + if (internal_relocs == NULL) + goto error_return; + + /* Walk through them looking for relaxing opportunities. */ + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma symval; + struct elf_link_hash_entry *h = NULL; + + /* We only process two relocs. */ + if (ELF64_R_TYPE (irel->r_info) != (int) R_MMIX_BASE_PLUS_OFFSET + && ELF64_R_TYPE (irel->r_info) != (int) R_MMIX_PUSHJ_STUBBABLE) + continue; + + /* We process relocs in a distinctly different way when this is a + relocatable link (for one, we don't look at symbols), so we avoid + mixing its code with that for the "normal" relaxation. */ + if (link_info->relocatable) + { + /* The only transformation in a relocatable link is to generate + a full stub at the location of the stub calculated for the + input section, if the relocated stub location, the end of the + output section plus earlier stubs, cannot be reached. Thus + relocatable linking can only lead to worse code, but it still + works. */ + if (ELF64_R_TYPE (irel->r_info) == R_MMIX_PUSHJ_STUBBABLE) + { + /* If we can reach the end of the output-section and beyond + any current stubs, then we don't need a stub for this + reloc. The relaxed order of output stub allocation may + not exactly match the straightforward order, so we always + assume presence of output stubs, which will allow + relaxation only on relocations indifferent to the + presence of output stub allocations for other relocations + and thus the order of output stub allocation. */ + if (bfd_check_overflow (complain_overflow_signed, + 19, + 0, + bfd_arch_bits_per_address (abfd), + /* Output-stub location. */ + sec->output_section->_cooked_size + + (mmix_elf_section_data (sec + ->output_section) + ->pjs.stubs_size_sum) + /* Location of this PUSHJ reloc. */ + - (sec->output_offset + irel->r_offset) + /* Don't count *this* stub twice. */ + - (mmix_elf_section_data (sec) + ->pjs.stub_size[pjsno] + + MAX_PUSHJ_STUB_SIZE)) + == bfd_reloc_ok) + mmix_elf_section_data (sec)->pjs.stub_size[pjsno] = 0; + + mmix_elf_section_data (sec)->pjs.stubs_size_sum + += mmix_elf_section_data (sec)->pjs.stub_size[pjsno]; + + pjsno++; + } + + continue; + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF64_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + /* A local symbol. */ + Elf_Internal_Sym *isym; + asection *sym_sec; + + /* Read this BFD's local symbols if we haven't already. */ + if (isymbuf == NULL) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == 0) + goto error_return; + } + + isym = isymbuf + ELF64_R_SYM (irel->r_info); + if (isym->st_shndx == SHN_UNDEF) + sym_sec = bfd_und_section_ptr; + else if (isym->st_shndx == SHN_ABS) + sym_sec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + sym_sec = bfd_com_section_ptr; + else + sym_sec = bfd_section_from_elf_index (abfd, isym->st_shndx); + symval = (isym->st_value + + sym_sec->output_section->vma + + sym_sec->output_offset); + } + else + { + unsigned long indx; + + /* An external symbol. */ + indx = ELF64_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + { + /* This appears to be a reference to an undefined symbol. Just + ignore it--it will be caught by the regular reloc processing. + We need to keep BPO reloc accounting consistent, though + else we'll abort instead of emitting an error message. */ + if (ELF64_R_TYPE (irel->r_info) == R_MMIX_BASE_PLUS_OFFSET + && gregdata != NULL) + { + gregdata->n_remaining_bpo_relocs_this_relaxation_round--; + bpono++; + } + continue; + } + + symval = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + + if (ELF64_R_TYPE (irel->r_info) == (int) R_MMIX_PUSHJ_STUBBABLE) + { + bfd_vma value = symval + irel->r_addend; + bfd_vma dot + = (sec->output_section->vma + + sec->output_offset + + irel->r_offset); + bfd_vma stubaddr + = (sec->output_section->vma + + sec->output_offset + + raw_size + + mmix_elf_section_data (sec)->pjs.stubs_size_sum); + + if ((value & 3) == 0 + && bfd_check_overflow (complain_overflow_signed, + 19, + 0, + bfd_arch_bits_per_address (abfd), + value - dot + - (value > dot + ? mmix_elf_section_data (sec) + ->pjs.stub_size[pjsno] + : 0)) + == bfd_reloc_ok) + /* If the reloc fits, no stub is needed. */ + mmix_elf_section_data (sec)->pjs.stub_size[pjsno] = 0; + else + /* Maybe we can get away with just a JMP insn? */ + if ((value & 3) == 0 + && bfd_check_overflow (complain_overflow_signed, + 27, + 0, + bfd_arch_bits_per_address (abfd), + value - stubaddr + - (value > dot + ? mmix_elf_section_data (sec) + ->pjs.stub_size[pjsno] - 4 + : 0)) + == bfd_reloc_ok) + /* Yep, account for a stub consisting of a single JMP insn. */ + mmix_elf_section_data (sec)->pjs.stub_size[pjsno] = 4; + else + /* Nope, go for the full insn stub. It doesn't seem useful to + emit the intermediate sizes; those will only be useful for + a >64M program assuming contiguous code. */ + mmix_elf_section_data (sec)->pjs.stub_size[pjsno] + = MAX_PUSHJ_STUB_SIZE; + + mmix_elf_section_data (sec)->pjs.stubs_size_sum + += mmix_elf_section_data (sec)->pjs.stub_size[pjsno]; + pjsno++; + continue; + } + + /* We're looking at a R_MMIX_BASE_PLUS_OFFSET reloc. */ + + gregdata->reloc_request[gregdata->bpo_reloc_indexes[bpono]].value + = symval + irel->r_addend; + gregdata->reloc_request[gregdata->bpo_reloc_indexes[bpono++]].valid = TRUE; + gregdata->n_remaining_bpo_relocs_this_relaxation_round--; + } + + /* Check if that was the last BPO-reloc. If so, sort the values and + calculate how many registers we need to cover them. Set the size of + the linker gregs, and if the number of registers changed, indicate + that we need to relax some more because we have more work to do. */ + if (gregdata != NULL + && gregdata->n_remaining_bpo_relocs_this_relaxation_round == 0) + { + size_t i; + bfd_vma prev_base; + size_t regindex; + + /* First, reset the remaining relocs for the next round. */ + gregdata->n_remaining_bpo_relocs_this_relaxation_round + = gregdata->n_bpo_relocs; + + qsort ((PTR) gregdata->reloc_request, + gregdata->n_max_bpo_relocs, + sizeof (struct bpo_reloc_request), + bpo_reloc_request_sort_fn); + + /* Recalculate indexes. When we find a change (however unlikely + after the initial iteration), we know we need to relax again, + since items in the GREG-array are sorted by increasing value and + stored in the relaxation phase. */ + for (i = 0; i < gregdata->n_max_bpo_relocs; i++) + if (gregdata->bpo_reloc_indexes[gregdata->reloc_request[i].bpo_reloc_no] + != i) + { + gregdata->bpo_reloc_indexes[gregdata->reloc_request[i].bpo_reloc_no] + = i; + *again = TRUE; + } + + /* Allocate register numbers (indexing from 0). Stop at the first + non-valid reloc. */ + for (i = 0, regindex = 0, prev_base = gregdata->reloc_request[0].value; + i < gregdata->n_bpo_relocs; + i++) + { + if (gregdata->reloc_request[i].value > prev_base + 255) + { + regindex++; + prev_base = gregdata->reloc_request[i].value; + } + gregdata->reloc_request[i].regindex = regindex; + gregdata->reloc_request[i].offset + = gregdata->reloc_request[i].value - prev_base; + } + + /* If it's not the same as the last time, we need to relax again, + because the size of the section has changed. I'm not sure we + actually need to do any adjustments since the shrinking happens + at the start of this section, but better safe than sorry. */ + if (gregdata->n_allocated_bpo_gregs != regindex + 1) + { + gregdata->n_allocated_bpo_gregs = regindex + 1; + *again = TRUE; + } + + bpo_gregs_section->_cooked_size = (regindex + 1) * 8; + } + + if (isymbuf != NULL && (unsigned char *) isymbuf != symtab_hdr->contents) + { + if (! link_info->keep_memory) + free (isymbuf); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) isymbuf; + } + } + + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + if (sec->_cooked_size + < raw_size + mmix_elf_section_data (sec)->pjs.stubs_size_sum) + abort (); + + if (sec->_cooked_size + > raw_size + mmix_elf_section_data (sec)->pjs.stubs_size_sum) + { + sec->_cooked_size + = raw_size + mmix_elf_section_data (sec)->pjs.stubs_size_sum; + *again = TRUE; + } + + return TRUE; + + error_return: + if (isymbuf != NULL && (unsigned char *) isymbuf != symtab_hdr->contents) + free (isymbuf); + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + return FALSE; +} + +/* Because we set _raw_size to include the max size of pushj stubs, + i.e. larger than the actual section input size (see + mmix_set_relaxable_raw_size), we have to take care of that when reading + the section. */ + +static bfd_boolean +mmix_elf_get_section_contents (abfd, section, location, offset, count) + bfd *abfd; + sec_ptr section; + void *location; + file_ptr offset; + bfd_size_type count; +{ + bfd_size_type raw_size + = (section->_raw_size + - mmix_elf_section_data (section)->pjs.n_pushj_relocs + * MAX_PUSHJ_STUB_SIZE); + + if (offset + count > section->_raw_size) + { + abort(); + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } + + /* Check bounds against the faked raw_size. */ + if (offset + count > raw_size) + { + /* Clear the part in the faked area. */ + memset (location + raw_size - offset, 0, count - (raw_size - offset)); + + /* If there's no initial part within the "real" contents, we're + done. */ + if ((bfd_size_type) offset >= raw_size) + return TRUE; + + /* Else adjust the count and fall through to call the generic + function. */ + count = raw_size - offset; + } + + return + _bfd_generic_get_section_contents (abfd, section, location, offset, + count); +} + + +#define ELF_ARCH bfd_arch_mmix +#define ELF_MACHINE_CODE EM_MMIX + +/* According to mmix-doc page 36 (paragraph 45), this should be (1LL << 48LL). + However, that's too much for something somewhere in the linker part of + BFD; perhaps the start-address has to be a non-zero multiple of this + number, or larger than this number. The symptom is that the linker + complains: "warning: allocated section `.text' not in segment". We + settle for 64k; the page-size used in examples is 8k. + #define ELF_MAXPAGESIZE 0x10000 + + Unfortunately, this causes excessive padding in the supposedly small + for-education programs that are the expected usage (where people would + inspect output). We stick to 256 bytes just to have *some* default + alignment. */ +#define ELF_MAXPAGESIZE 0x100 + +#define TARGET_BIG_SYM bfd_elf64_mmix_vec +#define TARGET_BIG_NAME "elf64-mmix" + +#define elf_info_to_howto_rel NULL +#define elf_info_to_howto mmix_info_to_howto_rela +#define elf_backend_relocate_section mmix_elf_relocate_section +#define elf_backend_gc_mark_hook mmix_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook mmix_elf_gc_sweep_hook + +#define elf_backend_link_output_symbol_hook \ + mmix_elf_link_output_symbol_hook +#define elf_backend_add_symbol_hook mmix_elf_add_symbol_hook + +#define elf_backend_check_relocs mmix_elf_check_relocs +#define elf_backend_symbol_processing mmix_elf_symbol_processing + +#define bfd_elf64_bfd_is_local_label_name \ + mmix_elf_is_local_label_name + +#define elf_backend_may_use_rel_p 0 +#define elf_backend_may_use_rela_p 1 +#define elf_backend_default_use_rela_p 1 + +#define elf_backend_can_gc_sections 1 +#define elf_backend_section_from_bfd_section \ + mmix_elf_section_from_bfd_section + +#define bfd_elf64_new_section_hook mmix_elf_new_section_hook +#define bfd_elf64_bfd_final_link mmix_elf_final_link +#define bfd_elf64_bfd_relax_section mmix_elf_relax_section +#define bfd_elf64_get_section_contents mmix_elf_get_section_contents + +#include "elf64-target.h" diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c new file mode 100644 index 0000000000000..ad6ca1c503773 --- /dev/null +++ b/bfd/elf64-sh64.c @@ -0,0 +1,4245 @@ +/* SuperH SH64-specific support for 64-bit ELF + Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#define SH64_ELF64 + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf/sh.h" + +/* Add a suffix for datalabel indirection symbols. It must not match any + other symbols; user symbols with or without version or other + decoration. It must only be used internally and not emitted by any + means. */ +#define DATALABEL_SUFFIX " DL" + +#define GOT_BIAS (-((long)-32768)) + +#define PLT_ENTRY_SIZE 64 + +/* Return size of a PLT entry. */ +#define elf_sh64_sizeof_plt(info) PLT_ENTRY_SIZE + +/* Return offset of the PLT0 address in an absolute PLT entry. */ +#define elf_sh64_plt_plt0_offset(info) 32 + +/* Return offset of the linker in PLT0 entry. */ +#define elf_sh64_plt0_gotplt_offset(info) 0 + +/* Return offset of the trampoline in PLT entry */ +#define elf_sh64_plt_temp_offset(info) 33 /* Add one because it's SHmedia. */ + +/* Return offset of the symbol in PLT entry. */ +#define elf_sh64_plt_symbol_offset(info) 0 + +/* Return offset of the relocation in PLT entry. */ +#define elf_sh64_plt_reloc_offset(info) (info->shared ? 52 : 44) + +#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1" + +/* The sh linker needs to keep track of the number of relocs that it + decides to copy in check_relocs for each symbol. This is so that + it can discard PC relative relocs if it doesn't need them when + linking with -Bsymbolic. We store the information in a field + extending the regular ELF linker hash table. */ + +/* This structure keeps track of the number of PC relative relocs we + have copied for a given symbol. */ + +struct elf_sh64_pcrel_relocs_copied +{ + /* Next section. */ + struct elf_sh64_pcrel_relocs_copied *next; + /* A section in dynobj. */ + asection *section; + /* Number of relocs copied in this section. */ + bfd_size_type count; +}; + +/* sh ELF linker hash entry. */ + +struct elf_sh64_link_hash_entry +{ + struct elf_link_hash_entry root; + + bfd_vma datalabel_got_offset; + + /* Number of PC relative relocs copied for this symbol. */ + struct elf_sh64_pcrel_relocs_copied *pcrel_relocs_copied; +}; + +/* sh ELF linker hash table. */ + +struct elf_sh64_link_hash_table +{ + struct elf_link_hash_table root; +}; + +/* Traverse an sh ELF linker hash table. */ + +#define sh64_elf64_link_hash_traverse(table, func, info) \ + (elf_link_hash_traverse \ + (&(table)->root, \ + (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \ + (info))) + +/* Get the sh ELF linker hash table from a link_info structure. */ + +#define sh64_elf64_hash_table(p) \ + ((struct elf_sh64_link_hash_table *) ((p)->hash)) + +static bfd_boolean sh_elf64_copy_private_data + (bfd *, bfd *); +static bfd_boolean sh_elf64_copy_private_data_internal + (bfd *, bfd *); +static bfd_boolean sh_elf64_merge_private_data + (bfd *, bfd *); +static bfd_reloc_status_type sh_elf64_ignore_reloc + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +static bfd_reloc_status_type sh_elf64_reloc + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +static reloc_howto_type *sh_elf64_reloc_type_lookup + (bfd *, bfd_reloc_code_real_type); +static void sh_elf64_info_to_howto + (bfd *, arelent *, Elf_Internal_Rela *); +static bfd_boolean sh_elf64_relocate_section + (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); +static bfd_byte *sh_elf64_get_relocated_section_contents + (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, + bfd_boolean, asymbol **); +static bfd_boolean sh_elf64_set_mach_from_flags + (bfd *); +static bfd_boolean sh_elf64_set_private_flags + (bfd *, flagword); +static asection *sh_elf64_gc_mark_hook + (asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *); +static bfd_boolean sh_elf64_gc_sweep_hook + (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); +static bfd_boolean sh_elf64_check_relocs + (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); +static int sh64_elf64_get_symbol_type + (Elf_Internal_Sym *, int); +static bfd_boolean sh64_elf64_add_symbol_hook + (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, + flagword *, asection **, bfd_vma *); +static bfd_boolean sh64_elf64_link_output_symbol_hook + (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *); +static bfd_boolean sh64_elf64_fake_sections + (bfd *, Elf_Internal_Shdr *, asection *); +static void sh64_elf64_final_write_processing + (bfd *, bfd_boolean); +static struct bfd_hash_entry *sh64_elf64_link_hash_newfunc + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); +static struct bfd_link_hash_table *sh64_elf64_link_hash_table_create + (bfd *); +inline static void movi_shori_putval + (bfd *, unsigned long, char *); +inline static void movi_3shori_putval + (bfd *, bfd_vma, char *); +static bfd_boolean sh64_elf64_create_dynamic_sections + (bfd *, struct bfd_link_info *); +static bfd_boolean sh64_elf64_adjust_dynamic_symbol + (struct bfd_link_info *info, struct elf_link_hash_entry *); +static bfd_boolean sh64_elf64_discard_copies + (struct elf_sh64_link_hash_entry *, void *); +static bfd_boolean sh64_elf64_size_dynamic_sections + (bfd *, struct bfd_link_info *); +static bfd_boolean sh64_elf64_finish_dynamic_symbol + (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *); +static bfd_boolean sh64_elf64_finish_dynamic_sections + (bfd *, struct bfd_link_info *); + +static reloc_howto_type sh_elf64_howto_table[] = { + /* No relocation. */ + HOWTO (R_SH_NONE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + sh_elf64_ignore_reloc, /* special_function */ + "R_SH_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit absolute relocation. Setting partial_inplace to TRUE and + src_mask to a non-zero value is similar to the COFF toolchain. */ + HOWTO (R_SH_DIR32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + sh_elf64_reloc, /* special_function */ + "R_SH_DIR32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit PC relative relocation. */ + HOWTO (R_SH_REL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + sh_elf64_ignore_reloc, /* special_function */ + "R_SH_REL32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* For 32-bit sh, this is R_SH_DIR8WPN. */ + EMPTY_HOWTO (3), + + /* For 32-bit sh, this is R_SH_IND12W. */ + EMPTY_HOWTO (4), + + /* For 32-bit sh, this is R_SH_DIR8WPL. */ + EMPTY_HOWTO (5), + + /* For 32-bit sh, this is R_SH_DIR8WPZ. */ + EMPTY_HOWTO (6), + + /* For 32-bit sh, this is R_SH_DIR8BP. */ + EMPTY_HOWTO (7), + + /* For 32-bit sh, this is R_SH_DIR8W. */ + EMPTY_HOWTO (8), + + /* For 32-bit sh, this is R_SH_DIR8L. */ + EMPTY_HOWTO (9), + + EMPTY_HOWTO (10), + EMPTY_HOWTO (11), + EMPTY_HOWTO (12), + EMPTY_HOWTO (13), + EMPTY_HOWTO (14), + EMPTY_HOWTO (15), + EMPTY_HOWTO (16), + EMPTY_HOWTO (17), + EMPTY_HOWTO (18), + EMPTY_HOWTO (19), + EMPTY_HOWTO (20), + EMPTY_HOWTO (21), + EMPTY_HOWTO (22), + EMPTY_HOWTO (23), + EMPTY_HOWTO (24), + + /* The remaining relocs are a GNU extension used for relaxing. The + final pass of the linker never needs to do anything with any of + these relocs. Any required operations are handled by the + relaxation code. */ + + /* A 16 bit switch table entry. This is generated for an expression + such as ``.word L1 - L2''. The offset holds the difference + between the reloc address and L2. */ + HOWTO (R_SH_SWITCH16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf64_ignore_reloc, /* special_function */ + "R_SH_SWITCH16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 32 bit switch table entry. This is generated for an expression + such as ``.long L1 - L2''. The offset holds the difference + between the reloc address and L2. */ + HOWTO (R_SH_SWITCH32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf64_ignore_reloc, /* special_function */ + "R_SH_SWITCH32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* For 32-bit sh, this is R_SH_USES. */ + EMPTY_HOWTO (27), + + /* For 32-bit sh, this is R_SH_COUNT. */ + EMPTY_HOWTO (28), + + /* For 32-bit sh, this is R_SH_ALIGN. FIXME: For linker relaxation, + this might be emitted. When linker relaxation is implemented, we + might want to use it. */ + EMPTY_HOWTO (29), + + /* For 32-bit sh, this is R_SH_CODE. FIXME: For linker relaxation, + this might be emitted. When linker relaxation is implemented, we + might want to use it. */ + EMPTY_HOWTO (30), + + /* For 32-bit sh, this is R_SH_DATA. FIXME: For linker relaxation, + this might be emitted. When linker relaxation is implemented, we + might want to use it. */ + EMPTY_HOWTO (31), + + /* For 32-bit sh, this is R_SH_LABEL. FIXME: For linker relaxation, + this might be emitted. When linker relaxation is implemented, we + might want to use it. */ + EMPTY_HOWTO (32), + + /* An 8 bit switch table entry. This is generated for an expression + such as ``.word L1 - L2''. The offset holds the difference + between the reloc address and L2. */ + HOWTO (R_SH_SWITCH8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf64_ignore_reloc, /* special_function */ + "R_SH_SWITCH8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_SH_GNU_VTINHERIT, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + NULL, /* special_function */ + "R_SH_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_SH_GNU_VTENTRY, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_elf_rel_vtable_reloc_fn, /* special_function */ + "R_SH_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* For 32-bit sh, this is R_SH_LOOP_START. */ + EMPTY_HOWTO (36), + + /* For 32-bit sh, this is R_SH_LOOP_END. */ + EMPTY_HOWTO (37), + + EMPTY_HOWTO (38), + EMPTY_HOWTO (39), + EMPTY_HOWTO (40), + EMPTY_HOWTO (41), + EMPTY_HOWTO (42), + EMPTY_HOWTO (43), + EMPTY_HOWTO (44), + + /* Used in SHLLI.L and SHLRI.L. */ + HOWTO (R_SH_DIR5U, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 5, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR5U", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in SHARI, SHLLI et al. */ + HOWTO (R_SH_DIR6U, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR6U", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in BxxI, LDHI.L et al. */ + HOWTO (R_SH_DIR6S, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR6S", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xfc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in ADDI, ANDI et al. */ + HOWTO (R_SH_DIR10S, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 10, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10S", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in LD.UW, ST.W et al. */ + HOWTO (R_SH_DIR10SW, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 11, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SW", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_DIR10SL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_DIR10SQ, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_DIR10SQ", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (52), + EMPTY_HOWTO (53), + EMPTY_HOWTO (54), + EMPTY_HOWTO (55), + EMPTY_HOWTO (56), + EMPTY_HOWTO (57), + EMPTY_HOWTO (58), + EMPTY_HOWTO (59), + EMPTY_HOWTO (60), + EMPTY_HOWTO (61), + EMPTY_HOWTO (62), + EMPTY_HOWTO (63), + EMPTY_HOWTO (64), + EMPTY_HOWTO (65), + EMPTY_HOWTO (66), + EMPTY_HOWTO (67), + EMPTY_HOWTO (68), + EMPTY_HOWTO (69), + EMPTY_HOWTO (70), + EMPTY_HOWTO (71), + EMPTY_HOWTO (72), + EMPTY_HOWTO (73), + EMPTY_HOWTO (74), + EMPTY_HOWTO (75), + EMPTY_HOWTO (76), + EMPTY_HOWTO (77), + EMPTY_HOWTO (78), + EMPTY_HOWTO (79), + EMPTY_HOWTO (80), + EMPTY_HOWTO (81), + EMPTY_HOWTO (82), + EMPTY_HOWTO (83), + EMPTY_HOWTO (84), + EMPTY_HOWTO (85), + EMPTY_HOWTO (86), + EMPTY_HOWTO (87), + EMPTY_HOWTO (88), + EMPTY_HOWTO (89), + EMPTY_HOWTO (90), + EMPTY_HOWTO (91), + EMPTY_HOWTO (92), + EMPTY_HOWTO (93), + EMPTY_HOWTO (94), + EMPTY_HOWTO (95), + EMPTY_HOWTO (96), + EMPTY_HOWTO (97), + EMPTY_HOWTO (98), + EMPTY_HOWTO (99), + EMPTY_HOWTO (100), + EMPTY_HOWTO (101), + EMPTY_HOWTO (102), + EMPTY_HOWTO (103), + EMPTY_HOWTO (104), + EMPTY_HOWTO (105), + EMPTY_HOWTO (106), + EMPTY_HOWTO (107), + EMPTY_HOWTO (108), + EMPTY_HOWTO (109), + EMPTY_HOWTO (110), + EMPTY_HOWTO (111), + EMPTY_HOWTO (112), + EMPTY_HOWTO (113), + EMPTY_HOWTO (114), + EMPTY_HOWTO (115), + EMPTY_HOWTO (116), + EMPTY_HOWTO (117), + EMPTY_HOWTO (118), + EMPTY_HOWTO (119), + EMPTY_HOWTO (120), + EMPTY_HOWTO (121), + EMPTY_HOWTO (122), + EMPTY_HOWTO (123), + EMPTY_HOWTO (124), + EMPTY_HOWTO (125), + EMPTY_HOWTO (126), + EMPTY_HOWTO (127), + EMPTY_HOWTO (128), + EMPTY_HOWTO (129), + EMPTY_HOWTO (130), + EMPTY_HOWTO (131), + EMPTY_HOWTO (132), + EMPTY_HOWTO (133), + EMPTY_HOWTO (134), + EMPTY_HOWTO (135), + EMPTY_HOWTO (136), + EMPTY_HOWTO (137), + EMPTY_HOWTO (138), + EMPTY_HOWTO (139), + EMPTY_HOWTO (140), + EMPTY_HOWTO (141), + EMPTY_HOWTO (142), + EMPTY_HOWTO (143), + EMPTY_HOWTO (144), + EMPTY_HOWTO (145), + EMPTY_HOWTO (146), + EMPTY_HOWTO (147), + EMPTY_HOWTO (148), + EMPTY_HOWTO (149), + EMPTY_HOWTO (150), + EMPTY_HOWTO (151), + EMPTY_HOWTO (152), + EMPTY_HOWTO (153), + EMPTY_HOWTO (154), + EMPTY_HOWTO (155), + EMPTY_HOWTO (156), + EMPTY_HOWTO (157), + EMPTY_HOWTO (158), + EMPTY_HOWTO (159), + + /* Relocs for dynamic linking for 32-bit SH would follow. We don't have + any dynamic linking support for 64-bit SH at present. */ + + EMPTY_HOWTO (160), + EMPTY_HOWTO (161), + EMPTY_HOWTO (162), + EMPTY_HOWTO (163), + EMPTY_HOWTO (164), + EMPTY_HOWTO (165), + EMPTY_HOWTO (166), + EMPTY_HOWTO (167), + EMPTY_HOWTO (168), + + /* Back to SH5 relocations. */ + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTPLT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTPLT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTPLT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTPLT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_PLT_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_PLT_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_PLT_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_PLT_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PLT_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTOFF_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTOFF_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTOFF_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTOFF_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTOFF_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_GOTPC_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_GOTPC_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_GOTPC_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_GOTPC_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPC_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_GOT10BY4, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT10BY4", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in LD.L, FLD.S et al. */ + HOWTO (R_SH_GOTPLT10BY4, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT10BY4", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_GOT10BY8, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOT10BY8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in FLD.D, FST.P et al. */ + HOWTO (R_SH_GOTPLT10BY8, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GOTPLT10BY8", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_COPY64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_COPY64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_GLOB_DAT64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_GLOB_DAT64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_JMP_SLOT64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_JMP_SLOT64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_SH_RELATIVE64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_RELATIVE64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (197), + EMPTY_HOWTO (198), + EMPTY_HOWTO (199), + EMPTY_HOWTO (200), + EMPTY_HOWTO (201), + EMPTY_HOWTO (202), + EMPTY_HOWTO (203), + EMPTY_HOWTO (204), + EMPTY_HOWTO (205), + EMPTY_HOWTO (206), + EMPTY_HOWTO (207), + EMPTY_HOWTO (208), + EMPTY_HOWTO (209), + EMPTY_HOWTO (210), + EMPTY_HOWTO (211), + EMPTY_HOWTO (212), + EMPTY_HOWTO (213), + EMPTY_HOWTO (214), + EMPTY_HOWTO (215), + EMPTY_HOWTO (216), + EMPTY_HOWTO (217), + EMPTY_HOWTO (218), + EMPTY_HOWTO (219), + EMPTY_HOWTO (220), + EMPTY_HOWTO (221), + EMPTY_HOWTO (222), + EMPTY_HOWTO (223), + EMPTY_HOWTO (224), + EMPTY_HOWTO (225), + EMPTY_HOWTO (226), + EMPTY_HOWTO (227), + EMPTY_HOWTO (228), + EMPTY_HOWTO (229), + EMPTY_HOWTO (230), + EMPTY_HOWTO (231), + EMPTY_HOWTO (232), + EMPTY_HOWTO (233), + EMPTY_HOWTO (234), + EMPTY_HOWTO (235), + EMPTY_HOWTO (236), + EMPTY_HOWTO (237), + EMPTY_HOWTO (238), + EMPTY_HOWTO (239), + EMPTY_HOWTO (240), + EMPTY_HOWTO (241), + + /* Relocations for SHmedia code. None of these are partial_inplace or + use the field being relocated. */ + + /* The assembler will generate this reloc before a block of SHmedia + instructions. A section should be processed as assuming it contains + data, unless this reloc is seen. Note that a block of SHcompact + instructions are instead preceded by R_SH_CODE. + This is currently not implemented, but should be used for SHmedia + linker relaxation. */ + HOWTO (R_SH_SHMEDIA_CODE, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + sh_elf64_ignore_reloc, /* special_function */ + "R_SH_SHMEDIA_CODE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The assembler will generate this reloc at a PTA or PTB instruction, + and the linker checks the right type of target, or changes a PTA to a + PTB, if the original insn was PT. */ + HOWTO (R_SH_PT_16, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 18, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_PT_16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in unexpanded MOVI. */ + HOWTO (R_SH_IMMS16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMMS16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in SHORI. */ + HOWTO (R_SH_IMMU16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMMU16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (x & 65536). */ + HOWTO (R_SH_IMM_LOW16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_LOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x - $) & 65536). */ + HOWTO (R_SH_IMM_LOW16_PCREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_LOW16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 16) & 65536). */ + HOWTO (R_SH_IMM_MEDLOW16, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDLOW16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 16) & 65536). */ + HOWTO (R_SH_IMM_MEDLOW16_PCREL, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDLOW16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 32) & 65536). */ + HOWTO (R_SH_IMM_MEDHI16, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDHI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 32) & 65536). */ + HOWTO (R_SH_IMM_MEDHI16_PCREL, /* type */ + 32, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_MEDHI16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Used in MOVI and SHORI ((x >> 48) & 65536). */ + HOWTO (R_SH_IMM_HI16, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_HI16", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used in MOVI and SHORI (((x - $) >> 48) & 65536). */ + HOWTO (R_SH_IMM_HI16_PCREL, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_IMM_HI16_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* For the .uaquad pseudo. */ + HOWTO (R_SH_64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_64", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* For the .uaquad pseudo, (x - $). */ + HOWTO (R_SH_64_PCREL, /* type */ + 48, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 10, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_SH_64_PCREL", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ((bfd_vma) 0) - 1, /* dst_mask */ + TRUE), /* pcrel_offset */ + +}; + +/* This function is used for relocs which are only used for relaxing, + which the linker should otherwise ignore. */ + +static bfd_reloc_status_type +sh_elf64_ignore_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, + asymbol *symbol ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED, asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + if (output_bfd != NULL) + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; +} + +/* This function is used for normal relocs. This used to be like the COFF + function, and is almost certainly incorrect for other ELF targets. + + See sh_elf_reloc in elf32-sh.c for the original. */ + +static bfd_reloc_status_type +sh_elf64_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol_in, + void *data, asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + unsigned long insn; + bfd_vma sym_value; + enum elf_sh_reloc_type r_type; + bfd_vma addr = reloc_entry->address; + bfd_byte *hit_data = addr + (bfd_byte *) data; + + r_type = (enum elf_sh_reloc_type) reloc_entry->howto->type; + + if (output_bfd != NULL) + { + /* Partial linking--do nothing. */ + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + if (symbol_in != NULL + && bfd_is_und_section (symbol_in->section)) + return bfd_reloc_undefined; + + if (bfd_is_com_section (symbol_in->section)) + sym_value = 0; + else + sym_value = (symbol_in->value + + symbol_in->section->output_section->vma + + symbol_in->section->output_offset); + + switch (r_type) + { + case R_SH_DIR32: + insn = bfd_get_32 (abfd, hit_data); + insn += sym_value + reloc_entry->addend; + bfd_put_32 (abfd, insn, hit_data); + break; + + default: + abort (); + break; + } + + return bfd_reloc_ok; +} + +/* This structure is used to map BFD reloc codes to SH ELF relocs. */ + +struct elf_reloc_map +{ + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +/* An array mapping BFD reloc codes to SH ELF relocs. */ + +static const struct elf_reloc_map sh64_reloc_map[] = +{ + { BFD_RELOC_NONE, R_SH_NONE }, + { BFD_RELOC_32, R_SH_DIR32 }, + { BFD_RELOC_CTOR, R_SH_DIR32 }, + { BFD_RELOC_32_PCREL, R_SH_REL32 }, + { BFD_RELOC_8_PCREL, R_SH_SWITCH8 }, + { BFD_RELOC_SH_SWITCH16, R_SH_SWITCH16 }, + { BFD_RELOC_SH_SWITCH32, R_SH_SWITCH32 }, + { BFD_RELOC_VTABLE_INHERIT, R_SH_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_SH_GNU_VTENTRY }, + { BFD_RELOC_SH_GOT_LOW16, R_SH_GOT_LOW16 }, + { BFD_RELOC_SH_GOT_MEDLOW16, R_SH_GOT_MEDLOW16 }, + { BFD_RELOC_SH_GOT_MEDHI16, R_SH_GOT_MEDHI16 }, + { BFD_RELOC_SH_GOT_HI16, R_SH_GOT_HI16 }, + { BFD_RELOC_SH_GOTPLT_LOW16, R_SH_GOTPLT_LOW16 }, + { BFD_RELOC_SH_GOTPLT_MEDLOW16, R_SH_GOTPLT_MEDLOW16 }, + { BFD_RELOC_SH_GOTPLT_MEDHI16, R_SH_GOTPLT_MEDHI16 }, + { BFD_RELOC_SH_GOTPLT_HI16, R_SH_GOTPLT_HI16 }, + { BFD_RELOC_SH_PLT_LOW16, R_SH_PLT_LOW16 }, + { BFD_RELOC_SH_PLT_MEDLOW16, R_SH_PLT_MEDLOW16 }, + { BFD_RELOC_SH_PLT_MEDHI16, R_SH_PLT_MEDHI16 }, + { BFD_RELOC_SH_PLT_HI16, R_SH_PLT_HI16 }, + { BFD_RELOC_SH_GOTOFF_LOW16, R_SH_GOTOFF_LOW16 }, + { BFD_RELOC_SH_GOTOFF_MEDLOW16, R_SH_GOTOFF_MEDLOW16 }, + { BFD_RELOC_SH_GOTOFF_MEDHI16, R_SH_GOTOFF_MEDHI16 }, + { BFD_RELOC_SH_GOTOFF_HI16, R_SH_GOTOFF_HI16 }, + { BFD_RELOC_SH_GOTPC_LOW16, R_SH_GOTPC_LOW16 }, + { BFD_RELOC_SH_GOTPC_MEDLOW16, R_SH_GOTPC_MEDLOW16 }, + { BFD_RELOC_SH_GOTPC_MEDHI16, R_SH_GOTPC_MEDHI16 }, + { BFD_RELOC_SH_GOTPC_HI16, R_SH_GOTPC_HI16 }, + { BFD_RELOC_SH_COPY64, R_SH_COPY64 }, + { BFD_RELOC_SH_GLOB_DAT64, R_SH_GLOB_DAT64 }, + { BFD_RELOC_SH_JMP_SLOT64, R_SH_JMP_SLOT64 }, + { BFD_RELOC_SH_RELATIVE64, R_SH_RELATIVE64 }, + { BFD_RELOC_SH_GOT10BY4, R_SH_GOT10BY4 }, + { BFD_RELOC_SH_GOT10BY8, R_SH_GOT10BY8 }, + { BFD_RELOC_SH_GOTPLT10BY4, R_SH_GOTPLT10BY4 }, + { BFD_RELOC_SH_GOTPLT10BY8, R_SH_GOTPLT10BY8 }, + { BFD_RELOC_SH_PT_16, R_SH_PT_16 }, + { BFD_RELOC_SH_SHMEDIA_CODE, R_SH_SHMEDIA_CODE }, + { BFD_RELOC_SH_IMMU5, R_SH_DIR5U }, + { BFD_RELOC_SH_IMMS6, R_SH_DIR6S }, + { BFD_RELOC_SH_IMMU6, R_SH_DIR6U }, + { BFD_RELOC_SH_IMMS10, R_SH_DIR10S }, + { BFD_RELOC_SH_IMMS10BY2, R_SH_DIR10SW }, + { BFD_RELOC_SH_IMMS10BY4, R_SH_DIR10SL }, + { BFD_RELOC_SH_IMMS10BY8, R_SH_DIR10SQ }, + { BFD_RELOC_SH_IMMS16, R_SH_IMMS16 }, + { BFD_RELOC_SH_IMMU16, R_SH_IMMU16 }, + { BFD_RELOC_SH_IMM_LOW16, R_SH_IMM_LOW16 }, + { BFD_RELOC_SH_IMM_LOW16_PCREL, R_SH_IMM_LOW16_PCREL }, + { BFD_RELOC_SH_IMM_MEDLOW16, R_SH_IMM_MEDLOW16 }, + { BFD_RELOC_SH_IMM_MEDLOW16_PCREL, R_SH_IMM_MEDLOW16_PCREL }, + { BFD_RELOC_SH_IMM_MEDHI16, R_SH_IMM_MEDHI16 }, + { BFD_RELOC_SH_IMM_MEDHI16_PCREL, R_SH_IMM_MEDHI16_PCREL }, + { BFD_RELOC_SH_IMM_HI16, R_SH_IMM_HI16 }, + { BFD_RELOC_SH_IMM_HI16_PCREL, R_SH_IMM_HI16_PCREL }, + { BFD_RELOC_64, R_SH_64 }, + { BFD_RELOC_64_PCREL, R_SH_64_PCREL }, +}; + +/* Given a BFD reloc code, return the howto structure for the + corresponding SH ELf reloc. */ + +static reloc_howto_type * +sh_elf64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + unsigned int i; + + for (i = 0; i < sizeof (sh64_reloc_map) / sizeof (struct elf_reloc_map); i++) + { + if (sh64_reloc_map[i].bfd_reloc_val == code) + return &sh_elf64_howto_table[(int) sh64_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Given an ELF reloc, fill in the howto field of a relent. + + See sh_elf_info_to_howto in elf32-sh.c for the original. */ + +static void +sh_elf64_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, + Elf_Internal_Rela *dst) +{ + unsigned int r; + + r = ELF64_R_TYPE (dst->r_info); + + BFD_ASSERT (r <= (unsigned int) R_SH_64_PCREL); + BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC || r > R_SH_LAST_INVALID_RELOC); + BFD_ASSERT (r < R_SH_DIR8WPN || r > R_SH_LAST_INVALID_RELOC_2); + BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_3 || r > R_SH_GOTPLT32); + BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_4 || r > R_SH_LAST_INVALID_RELOC_4); + + cache_ptr->howto = &sh_elf64_howto_table[r]; +} + +/* Relocate an SH ELF section. + + See sh_elf_info_to_howto in elf32-sh.c for the original. */ + +static bfd_boolean +sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info, bfd *input_bfd, + asection *input_section, bfd_byte *contents, + Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel, *relend; + bfd *dynobj; + bfd_vma *local_got_offsets; + asection *sgot; + asection *sgotplt; + asection *splt; + asection *sreloc; + bfd_vma disp, dropped; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + dynobj = elf_hash_table (info)->dynobj; + local_got_offsets = elf_local_got_offsets (input_bfd); + + sgot = NULL; + sgotplt = NULL; + splt = NULL; + sreloc = NULL; + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_vma addend = (bfd_vma)0; + bfd_reloc_status_type r; + int seen_stt_datalabel = 0; + + r_symndx = ELF64_R_SYM (rel->r_info); + + r_type = ELF64_R_TYPE (rel->r_info); + + if (r_type == (int) R_SH_NONE) + continue; + + if (r_type < 0 + || r_type > R_SH_64_PCREL + || (r_type >= (int) R_SH_FIRST_INVALID_RELOC + && r_type <= (int) R_SH_LAST_INVALID_RELOC) + || (r_type >= (int) R_SH_DIR8WPN + && r_type <= (int) R_SH_LAST_INVALID_RELOC) + || (r_type >= (int) R_SH_GNU_VTINHERIT + && r_type <= (int) R_SH_PSHL) + || (r_type >= (int) R_SH_FIRST_INVALID_RELOC_2 + && r_type <= R_SH_GOTPLT32) + || (r_type >= (int) R_SH_FIRST_INVALID_RELOC_4 + && r_type <= (int) R_SH_LAST_INVALID_RELOC_4)) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + howto = sh_elf64_howto_table + r_type; + + /* This is a final link. */ + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = ((sec->output_section->vma + + sec->output_offset + + sym->st_value) + | ((sym->st_other & STO_SH5_ISA32) != 0)); + + /* A local symbol never has STO_SH5_ISA32, so we don't need + datalabel processing here. Make sure this does not change + without notice. */ + if ((sym->st_other & STO_SH5_ISA32) != 0) + ((*info->callbacks->reloc_dangerous) + (info, + _("Unexpected STO_SH5_ISA32 on local symbol is not handled"), + input_bfd, input_section, rel->r_offset)); + + if (info->relocatable) + { + /* This is a relocatable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + goto final_link_relocate; + + continue; + } + else if (! howto->partial_inplace) + { + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + relocation |= ((sym->st_other & STO_SH5_ISA32) != 0); + } + else if ((sec->flags & SEC_MERGE) + && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + asection *msec; + + if (howto->rightshift || howto->src_mask != 0xffffffff) + { + (*_bfd_error_handler) + (_("%s(%s+0x%lx): %s relocation against SEC_MERGE section"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, howto->name); + return FALSE; + } + + addend = bfd_get_32 (input_bfd, contents + rel->r_offset); + msec = sec; + addend = + _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend) + - relocation; + addend += msec->output_section->vma + msec->output_offset; + bfd_put_32 (input_bfd, addend, contents + rel->r_offset); + addend = 0; + } + } + else + { + /* ??? Could we use the RELOC_FOR_GLOBAL_SYMBOL macro here ? */ + + /* Section symbols are never (?) placed in the hash table, so + we can just ignore hash relocations when creating a + relocatable object file. */ + if (info->relocatable) + continue; + + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + { + /* If the reference passes a symbol marked with + STT_DATALABEL, then any STO_SH5_ISA32 on the final value + doesn't count. */ + seen_stt_datalabel |= h->type == STT_DATALABEL; + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } + + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + /* In these cases, we don't need the relocation value. + We check specially because in some obscure cases + sec->output_section will be NULL. */ + if (r_type == R_SH_GOTPC_LOW16 + || r_type == R_SH_GOTPC_MEDLOW16 + || r_type == R_SH_GOTPC_MEDHI16 + || r_type == R_SH_GOTPC_HI16 + || ((r_type == R_SH_PLT_LOW16 + || r_type == R_SH_PLT_MEDLOW16 + || r_type == R_SH_PLT_MEDHI16 + || r_type == R_SH_PLT_HI16) + && h->plt.offset != (bfd_vma) -1) + || ((r_type == R_SH_GOT_LOW16 + || r_type == R_SH_GOT_MEDLOW16 + || r_type == R_SH_GOT_MEDHI16 + || r_type == R_SH_GOT_HI16) + && elf_hash_table (info)->dynamic_sections_created + && (! info->shared + || (! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)) + /* The cases above are those in which relocation is + overwritten in the switch block below. The cases + below are those in which we must defer relocation + to run-time, because we can't resolve absolute + addresses when creating a shared library. */ + || (info->shared + && ((! info->symbolic && h->dynindx != -1) + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0) + && ((r_type == R_SH_64 + && !(ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)) + || r_type == R_SH_64_PCREL) + && ((input_section->flags & SEC_ALLOC) != 0 + /* DWARF will emit R_SH_DIR32 relocations in its + sections against symbols defined externally + in shared libraries. We can't do anything + with them here. */ + || (input_section->flags & SEC_DEBUGGING) != 0)) + /* Dynamic relocs are not propagated for SEC_DEBUGGING + sections because such sections are not SEC_ALLOC and + thus ld.so will not process them. */ + || (sec->output_section == NULL + && ((input_section->flags & SEC_DEBUGGING) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0))) + relocation = 0; + else if (sec->output_section == NULL) + { + (*_bfd_error_handler) + (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), + bfd_get_filename (input_bfd), h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + relocation = 0; + } + else + relocation = ((h->root.u.def.value + + sec->output_section->vma + + sec->output_offset) + /* A STO_SH5_ISA32 causes a "bitor 1" to the + symbol value, unless we've seen + STT_DATALABEL on the way to it. */ + | ((h->other & STO_SH5_ISA32) != 0 + && ! seen_stt_datalabel)); + } + else if (h->root.type == bfd_link_hash_undefweak) + relocation = 0; + else if (info->unresolved_syms_in_objects == RM_IGNORE + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + relocation = 0; + else + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, + (info->unresolved_syms_in_objects == RM_GENERATE_ERROR + || ELF_ST_VISIBILITY (h->other))))) + return FALSE; + relocation = 0; + } + } + + disp = (relocation + - input_section->output_section->vma + - input_section->output_offset + - rel->r_offset); + dropped = 0; + switch ((int)r_type) + { + case R_SH_PT_16: dropped = disp & 2; break; + case R_SH_DIR10SW: dropped = disp & 1; break; + case R_SH_DIR10SL: dropped = disp & 3; break; + case R_SH_DIR10SQ: dropped = disp & 7; break; + } + if (dropped != 0) + { + (*_bfd_error_handler) + (_("%s: error: unaligned relocation type %d at %08x reloc %08x\n"), + bfd_get_filename (input_bfd), (int)r_type, (unsigned)rel->r_offset, (unsigned)relocation); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + switch ((int)r_type) + { + case R_SH_64: + case R_SH_64_PCREL: + if (info->shared + && (input_section->flags & SEC_ALLOC) != 0 + && (r_type != R_SH_64_PCREL + || (h != NULL + && h->dynindx != -1 + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + bfd_boolean skip, relocate; + + /* When generating a shared object, these relocations + are copied into the output file to be resolved at run + time. */ + + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (input_bfd, + elf_elfheader (input_bfd)->e_shstrndx, + elf_section_data (input_section)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (input_bfd, + input_section), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + BFD_ASSERT (sreloc != NULL); + } + + skip = FALSE; + relocate = FALSE; + + outrel.r_offset + = _bfd_elf_section_offset (output_bfd, info, + input_section, rel->r_offset); + + if (outrel.r_offset == (bfd_vma) -1) + skip = TRUE; + else if (outrel.r_offset == (bfd_vma) -2) + skip = TRUE, relocate = TRUE; + + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + else if (r_type == R_SH_64_PCREL) + { + BFD_ASSERT (h != NULL && h->dynindx != -1); + outrel.r_info = ELF64_R_INFO (h->dynindx, R_SH_64_PCREL); + outrel.r_addend = rel->r_addend; + } + else + { + /* h->dynindx may be -1 if this symbol was marked to + become local. */ + if (h == NULL + || ((info->symbolic || h->dynindx == -1) + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) != 0)) + { + relocate = TRUE; + outrel.r_info = ELF64_R_INFO (0, R_SH_RELATIVE64); + outrel.r_addend = relocation + rel->r_addend; + } + else + { + BFD_ASSERT (h->dynindx != -1); + outrel.r_info = ELF64_R_INFO (h->dynindx, R_SH_64); + outrel.r_addend = relocation + rel->r_addend; + } + } + + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela); + bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + + /* If this reloc is against an external symbol, we do + not want to fiddle with the addend. Otherwise, we + need to include the symbol value so that it becomes + an addend for the dynamic reloc. */ + if (! relocate) + continue; + } + else if (r_type == R_SH_64) + addend = rel->r_addend; + goto final_link_relocate; + + case R_SH_GOTPLT_LOW16: + case R_SH_GOTPLT_MEDLOW16: + case R_SH_GOTPLT_MEDHI16: + case R_SH_GOTPLT_HI16: + case R_SH_GOTPLT10BY4: + case R_SH_GOTPLT10BY8: + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + if (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN + || ! info->shared + || info->symbolic + || h->dynindx == -1 + || h->plt.offset == (bfd_vma) -1 + || h->got.offset != (bfd_vma) -1) + goto force_got; + + /* Relocation is to the entry for this symbol in the global + offset table extension for the procedure linkage table. */ + if (sgotplt == NULL) + { + sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (sgotplt != NULL); + } + + relocation = (sgotplt->output_offset + + ((h->plt.offset / elf_sh64_sizeof_plt (info) + - 1 + 3) * 8)); + + relocation -= GOT_BIAS; + + goto final_link_relocate; + + force_got: + case R_SH_GOT_LOW16: + case R_SH_GOT_MEDLOW16: + case R_SH_GOT_MEDHI16: + case R_SH_GOT_HI16: + case R_SH_GOT10BY4: + case R_SH_GOT10BY8: + /* Relocation is to the entry for this symbol in the global + offset table. */ + if (sgot == NULL) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + } + + if (h != NULL) + { + bfd_vma off; + + off = h->got.offset; + if (seen_stt_datalabel) + { + struct elf_sh64_link_hash_entry *hsh; + + hsh = (struct elf_sh64_link_hash_entry *)h; + off = hsh->datalabel_got_offset; + } + BFD_ASSERT (off != (bfd_vma) -1); + + if (! elf_hash_table (info)->dynamic_sections_created + || (info->shared + && (info->symbolic || h->dynindx == -1 + || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + { + /* This is actually a static link, or it is a + -Bsymbolic link and the symbol is defined + locally, or the symbol was forced to be local + because of a version file. We must initialize + this entry in the global offset table. Since the + offset must always be a multiple of 4, we use the + least significant bit to record whether we have + initialized it already. + + When doing a dynamic link, we create a .rela.got + relocation entry to initialize the value. This + is done in the finish_dynamic_symbol routine. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_64 (output_bfd, relocation, + sgot->contents + off); + if (seen_stt_datalabel) + { + struct elf_sh64_link_hash_entry *hsh; + + hsh = (struct elf_sh64_link_hash_entry *)h; + hsh->datalabel_got_offset |= 1; + } + else + h->got.offset |= 1; + } + } + + relocation = sgot->output_offset + off; + } + else + { + bfd_vma off; + + if (rel->r_addend) + { + BFD_ASSERT (local_got_offsets != NULL + && (local_got_offsets[symtab_hdr->sh_info + + r_symndx] + != (bfd_vma) -1)); + + off = local_got_offsets[symtab_hdr->sh_info + + r_symndx]; + } + else + { + BFD_ASSERT (local_got_offsets != NULL + && local_got_offsets[r_symndx] != (bfd_vma) -1); + + off = local_got_offsets[r_symndx]; + } + + /* The offset must always be a multiple of 8. We use + the least significant bit to record whether we have + already generated the necessary reloc. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_64 (output_bfd, relocation, sgot->contents + off); + + if (info->shared) + { + asection *s; + Elf_Internal_Rela outrel; + bfd_byte *loc; + + s = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (s != NULL); + + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + off); + outrel.r_info = ELF64_R_INFO (0, R_SH_RELATIVE64); + outrel.r_addend = relocation; + loc = s->contents; + loc += s->reloc_count++ * sizeof (Elf64_External_Rela); + bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + } + + if (rel->r_addend) + local_got_offsets[symtab_hdr->sh_info + r_symndx] |= 1; + else + local_got_offsets[r_symndx] |= 1; + } + + relocation = sgot->output_offset + off; + } + + relocation -= GOT_BIAS; + + goto final_link_relocate; + + case R_SH_GOTOFF_LOW16: + case R_SH_GOTOFF_MEDLOW16: + case R_SH_GOTOFF_MEDHI16: + case R_SH_GOTOFF_HI16: + /* Relocation is relative to the start of the global offset + table. */ + + if (sgot == NULL) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + } + + /* Note that sgot->output_offset is not involved in this + calculation. We always want the start of .got. If we + defined _GLOBAL_OFFSET_TABLE in a different way, as is + permitted by the ABI, we might have to change this + calculation. */ + relocation -= sgot->output_section->vma; + + relocation -= GOT_BIAS; + + addend = rel->r_addend; + + goto final_link_relocate; + + case R_SH_GOTPC_LOW16: + case R_SH_GOTPC_MEDLOW16: + case R_SH_GOTPC_MEDHI16: + case R_SH_GOTPC_HI16: + /* Use global offset table as symbol value. */ + + if (sgot == NULL) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + } + + relocation = sgot->output_section->vma; + + relocation += GOT_BIAS; + + addend = rel->r_addend; + + goto final_link_relocate; + + case R_SH_PLT_LOW16: + case R_SH_PLT_MEDLOW16: + case R_SH_PLT_MEDHI16: + case R_SH_PLT_HI16: + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + /* Resolve a PLT reloc against a local symbol directly, + without using the procedure linkage table. */ + if (h == NULL) + goto final_link_relocate; + + if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) + goto final_link_relocate; + + if (h->plt.offset == (bfd_vma) -1) + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ + goto final_link_relocate; + } + + if (splt == NULL) + { + splt = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (splt != NULL); + } + + relocation = (splt->output_section->vma + + splt->output_offset + + h->plt.offset); + relocation++; + + addend = rel->r_addend; + + goto final_link_relocate; + + case R_SH_DIR32: + case R_SH_SHMEDIA_CODE: + case R_SH_PT_16: + case R_SH_DIR5U: + case R_SH_DIR6S: + case R_SH_DIR6U: + case R_SH_DIR10S: + case R_SH_DIR10SW: + case R_SH_DIR10SL: + case R_SH_DIR10SQ: + case R_SH_IMMS16: + case R_SH_IMMU16: + case R_SH_IMM_LOW16: + case R_SH_IMM_LOW16_PCREL: + case R_SH_IMM_MEDLOW16: + case R_SH_IMM_MEDLOW16_PCREL: + case R_SH_IMM_MEDHI16: + case R_SH_IMM_MEDHI16_PCREL: + case R_SH_IMM_HI16: + case R_SH_IMM_HI16_PCREL: + addend = rel->r_addend; + /* Fall through. */ + case R_SH_REL32: + final_link_relocate: + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, addend); + break; + + default: + bfd_set_error (bfd_error_bad_value); + return FALSE; + + } + + if (r != bfd_reloc_ok) + { + switch (r) + { + default: + case bfd_reloc_outofrange: + abort (); + case bfd_reloc_overflow: + { + const char *name; + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL) + return FALSE; + if (*name == '\0') + name = bfd_section_name (input_bfd, sec); + } + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return FALSE; + } + break; + } + } + } + + return TRUE; +} + +/* This is a version of bfd_generic_get_relocated_section_contents + that uses sh_elf64_relocate_section. + + See sh_elf_relocate_section in elf32-sh.c for the original. */ + +static bfd_byte * +sh_elf64_get_relocated_section_contents (bfd *output_bfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + bfd_boolean relocatable, + asymbol **symbols) +{ + Elf_Internal_Shdr *symtab_hdr; + asection *input_section = link_order->u.indirect.section; + bfd *input_bfd = input_section->owner; + asection **sections = NULL; + Elf_Internal_Rela *internal_relocs = NULL; + Elf_Internal_Sym *isymbuf = NULL; + + /* We only need to handle the case of relaxing, or of having a + particular set of section contents, specially. */ + if (relocatable + || elf_section_data (input_section)->this_hdr.contents == NULL) + return bfd_generic_get_relocated_section_contents (output_bfd, link_info, + link_order, data, + relocatable, + symbols); + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + + memcpy (data, elf_section_data (input_section)->this_hdr.contents, + input_section->_raw_size); + + if ((input_section->flags & SEC_RELOC) != 0 + && input_section->reloc_count > 0) + { + Elf_Internal_Sym *isymp; + Elf_Internal_Sym *isymend; + asection **secpp; + + /* Read this BFD's local symbols. */ + if (symtab_hdr->sh_info != 0) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == NULL) + goto error_return; + } + + internal_relocs = (_bfd_elf_link_read_relocs + (input_bfd, input_section, NULL, + (Elf_Internal_Rela *) NULL, FALSE)); + if (internal_relocs == NULL) + goto error_return; + + sections = (asection **) bfd_malloc (symtab_hdr->sh_info + * sizeof (asection *)); + if (sections == NULL && symtab_hdr->sh_info > 0) + goto error_return; + + secpp = sections; + isymend = isymbuf + symtab_hdr->sh_info; + for (isymp = isymbuf; isymp < isymend; ++isymp, ++secpp) + { + asection *isec; + + if (isymp->st_shndx == SHN_UNDEF) + isec = bfd_und_section_ptr; + else if (isymp->st_shndx > 0 && isymp->st_shndx < SHN_LORESERVE) + isec = bfd_section_from_elf_index (input_bfd, isymp->st_shndx); + else if (isymp->st_shndx == SHN_ABS) + isec = bfd_abs_section_ptr; + else if (isymp->st_shndx == SHN_COMMON) + isec = bfd_com_section_ptr; + else + { + /* Who knows? */ + isec = NULL; + } + + *secpp = isec; + } + + if (! sh_elf64_relocate_section (output_bfd, link_info, input_bfd, + input_section, data, internal_relocs, + isymbuf, sections)) + goto error_return; + + if (sections != NULL) + free (sections); + if (internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + if (isymbuf != NULL + && (unsigned char *) isymbuf != symtab_hdr->contents) + free (isymbuf); + } + + return data; + + error_return: + if (sections != NULL) + free (sections); + if (internal_relocs != NULL + && internal_relocs != elf_section_data (input_section)->relocs) + free (internal_relocs); + if (isymbuf != NULL + && (unsigned char *) isymbuf != symtab_hdr->contents) + free (isymbuf); + return NULL; +} + +/* Set the SHF_SH5_ISA32 flag for ISA SHmedia code sections. */ + +bfd_boolean +sh64_elf64_fake_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + Elf_Internal_Shdr *elf_section_hdr, + asection *asect) +{ + /* Code sections can only contain SH64 code, so mark them as such. */ + if (bfd_get_section_flags (output_bfd, asect) & SEC_CODE) + elf_section_hdr->sh_flags |= SHF_SH5_ISA32; + + return TRUE; +} + +static bfd_boolean +sh_elf64_set_mach_from_flags (bfd *abfd) +{ + flagword flags = elf_elfheader (abfd)->e_flags; + + switch (flags & EF_SH_MACH_MASK) + { + case EF_SH5: + /* Just one, but keep the switch construct to make additions easy. */ + bfd_default_set_arch_mach (abfd, bfd_arch_sh, bfd_mach_sh5); + break; + + default: + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } + return TRUE; +} + +/* Function to keep SH64 specific file flags. + + See sh64_elf_set_private_flags in elf32-sh64.c for the original. */ + +static bfd_boolean +sh_elf64_set_private_flags (bfd *abfd, flagword flags) +{ + BFD_ASSERT (! elf_flags_init (abfd) + || elf_elfheader (abfd)->e_flags == flags); + + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + return sh_elf64_set_mach_from_flags (abfd); +} + +/* Copy the SHF_SH5_ISA32 attribute that we keep on all sections with + code, to keep attributes the same as for SHmedia in 32-bit ELF. */ + +static bfd_boolean +sh_elf64_copy_private_data_internal (bfd *ibfd, bfd *obfd) +{ + Elf_Internal_Shdr **o_shdrp; + asection *isec; + asection *osec; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + o_shdrp = elf_elfsections (obfd); + for (osec = obfd->sections; osec; osec = osec->next) + { + int oIndex = ((struct bfd_elf_section_data *) elf_section_data (osec))->this_idx; + for (isec = ibfd->sections; isec; isec = isec->next) + { + if (strcmp (osec->name, isec->name) == 0) + { + /* Note that we're not disallowing mixing data and code. */ + if ((elf_section_data (isec)->this_hdr.sh_flags + & SHF_SH5_ISA32) != 0) + o_shdrp[oIndex]->sh_flags |= SHF_SH5_ISA32; + break; + } + } + } + + return sh_elf64_set_private_flags (obfd, elf_elfheader (ibfd)->e_flags); +} + +static bfd_boolean +sh_elf64_copy_private_data (bfd *ibfd, bfd *obfd) +{ + return sh_elf64_copy_private_data_internal (ibfd, obfd); +} + +static bfd_boolean +sh_elf64_merge_private_data (bfd *ibfd, bfd *obfd) +{ + flagword old_flags, new_flags; + + if (! _bfd_generic_verify_endian_match (ibfd, obfd)) + return FALSE; + + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + if (bfd_get_arch_size (ibfd) != bfd_get_arch_size (obfd)) + { + const char *msg; + + if (bfd_get_arch_size (ibfd) == 32 + && bfd_get_arch_size (obfd) == 64) + msg = _("%s: compiled as 32-bit object and %s is 64-bit"); + else if (bfd_get_arch_size (ibfd) == 64 + && bfd_get_arch_size (obfd) == 32) + msg = _("%s: compiled as 64-bit object and %s is 32-bit"); + else + msg = _("%s: object size does not match that of target %s"); + + (*_bfd_error_handler) (msg, bfd_get_filename (ibfd), + bfd_get_filename (obfd)); + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } + + old_flags = elf_elfheader (obfd)->e_flags; + new_flags = elf_elfheader (ibfd)->e_flags; + if (! elf_flags_init (obfd)) + { + /* This happens when ld starts out with a 'blank' output file. */ + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = old_flags = new_flags; + } + /* We don't allow linking in anything else than SH64 code, and since + this is a 64-bit ELF, we assume the 64-bit ABI is used. Add code + here as things change. */ + else if ((new_flags & EF_SH_MACH_MASK) != EF_SH5) + { + (*_bfd_error_handler) + ("%s: does not use the SH64 64-bit ABI as previous modules do", + bfd_get_filename (ibfd)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + sh_elf64_copy_private_data_internal (ibfd, obfd); + + /* I can't think of anything sane other than old_flags being EF_SH5 and + that we need to preserve that. */ + elf_elfheader (obfd)->e_flags = old_flags; + + return sh_elf64_set_mach_from_flags (obfd); +} + +/* Return the section that should be marked against GC for a given + relocation. */ + +static asection * +sh_elf64_gc_mark_hook (asection *sec, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Rela *rel, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + if (h != NULL) + { + switch (ELF64_R_TYPE (rel->r_info)) + { + case R_SH_GNU_VTINHERIT: + case R_SH_GNU_VTENTRY: + break; + + default: + while (h->root.type == bfd_link_hash_indirect + && h->root.u.i.link) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + switch (h->root.type) + { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + return h->root.u.def.section; + + case bfd_link_hash_common: + return h->root.u.c.p->section; + + default: + break; + } + } + } + else + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the got entry reference counts for the section being removed. */ + +static bfd_boolean +sh_elf64_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED) +{ + /* No got and plt entries for 64-bit SH at present. */ + return TRUE; +} + +/* Look through the relocs for a section during the first phase. + Since we don't do .gots or .plts, we just need to consider the + virtual table relocs for gc. */ + +static bfd_boolean +sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + bfd *dynobj; + bfd_vma *local_got_offsets; + asection *sgot; + asection *srelgot; + asection *sreloc; + + sgot = NULL; + srelgot = NULL; + sreloc = NULL; + + if (info->relocatable) + return TRUE; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf64_External_Sym); + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + dynobj = elf_hash_table (info)->dynobj; + local_got_offsets = elf_local_got_offsets (abfd); + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned long r_symndx; + + r_symndx = ELF64_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + /* Some relocs require a global offset table. */ + if (dynobj == NULL) + { + switch (ELF64_R_TYPE (rel->r_info)) + { + case R_SH_GOTPLT_LOW16: + case R_SH_GOTPLT_MEDLOW16: + case R_SH_GOTPLT_MEDHI16: + case R_SH_GOTPLT_HI16: + case R_SH_GOTPLT10BY4: + case R_SH_GOTPLT10BY8: + case R_SH_GOT_LOW16: + case R_SH_GOT_MEDLOW16: + case R_SH_GOT_MEDHI16: + case R_SH_GOT_HI16: + case R_SH_GOT10BY4: + case R_SH_GOT10BY8: + case R_SH_GOTOFF_LOW16: + case R_SH_GOTOFF_MEDLOW16: + case R_SH_GOTOFF_MEDHI16: + case R_SH_GOTOFF_HI16: + case R_SH_GOTPC_LOW16: + case R_SH_GOTPC_MEDLOW16: + case R_SH_GOTPC_MEDHI16: + case R_SH_GOTPC_HI16: + elf_hash_table (info)->dynobj = dynobj = abfd; + if (! _bfd_elf_create_got_section (dynobj, info)) + return FALSE; + break; + + default: + break; + } + } + + switch (ELF64_R_TYPE (rel->r_info)) + { + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_SH_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + /* This relocation describes which C++ vtable entries are actually + used. Record for later use during GC. */ + case R_SH_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + + force_got: + case R_SH_GOT_LOW16: + case R_SH_GOT_MEDLOW16: + case R_SH_GOT_MEDHI16: + case R_SH_GOT_HI16: + case R_SH_GOT10BY4: + case R_SH_GOT10BY8: + /* This symbol requires a global offset table entry. */ + + if (sgot == NULL) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (sgot != NULL); + } + + if (srelgot == NULL + && (h != NULL || info->shared)) + { + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + if (srelgot == NULL) + { + srelgot = bfd_make_section (dynobj, ".rela.got"); + if (srelgot == NULL + || ! bfd_set_section_flags (dynobj, srelgot, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || ! bfd_set_section_alignment (dynobj, srelgot, 2)) + return FALSE; + } + } + + if (h != NULL) + { + if (h->type == STT_DATALABEL) + { + struct elf_sh64_link_hash_entry *hsh; + + h = (struct elf_link_hash_entry *) h->root.u.i.link; + hsh = (struct elf_sh64_link_hash_entry *)h; + if (hsh->datalabel_got_offset != (bfd_vma) -1) + break; + + hsh->datalabel_got_offset = sgot->_raw_size; + } + else + { + if (h->got.offset != (bfd_vma) -1) + { + /* We have already allocated space in the .got. */ + break; + } + h->got.offset = sgot->_raw_size; + } + + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + srelgot->_raw_size += sizeof (Elf64_External_Rela); + } + else + { + /* This is a global offset table entry for a local + symbol. */ + if (local_got_offsets == NULL) + { + size_t size; + register unsigned int i; + + size = symtab_hdr->sh_info * sizeof (bfd_vma); + /* Reserve space for both the datalabel and + codelabel local GOT offsets. */ + size *= 2; + local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size); + if (local_got_offsets == NULL) + return FALSE; + elf_local_got_offsets (abfd) = local_got_offsets; + for (i = 0; i < symtab_hdr->sh_info; i++) + local_got_offsets[i] = (bfd_vma) -1; + for (; i < 2 * symtab_hdr->sh_info; i++) + local_got_offsets[i] = (bfd_vma) -1; + } + if ((rel->r_addend & 1) != 0) + { + if (local_got_offsets[symtab_hdr->sh_info + + r_symndx] != (bfd_vma) -1) + { + /* We have already allocated space in the .got. */ + break; + } + local_got_offsets[symtab_hdr->sh_info + + r_symndx] = sgot->_raw_size; + } + else + { + if (local_got_offsets[r_symndx] != (bfd_vma) -1) + { + /* We have already allocated space in the .got. */ + break; + } + local_got_offsets[r_symndx] = sgot->_raw_size; + } + + if (info->shared) + { + /* If we are generating a shared object, we need to + output a R_SH_RELATIVE reloc so that the dynamic + linker can adjust this GOT entry. */ + srelgot->_raw_size += sizeof (Elf64_External_Rela); + } + } + + sgot->_raw_size += 8; + + break; + + case R_SH_GOTPLT_LOW16: + case R_SH_GOTPLT_MEDLOW16: + case R_SH_GOTPLT_MEDHI16: + case R_SH_GOTPLT_HI16: + case R_SH_GOTPLT10BY4: + case R_SH_GOTPLT10BY8: + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + + if (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN + || ! info->shared + || info->symbolic + || h->dynindx == -1 + || h->got.offset != (bfd_vma) -1) + goto force_got; + + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + + break; + + case R_SH_PLT_LOW16: + case R_SH_PLT_MEDLOW16: + case R_SH_PLT_MEDHI16: + case R_SH_PLT_HI16: + /* This symbol requires a procedure linkage table entry. We + actually build the entry in adjust_dynamic_symbol, + because this might be a case of linking PIC code which is + never referenced by a dynamic object, in which case we + don't need to generate a procedure linkage table entry + after all. */ + + /* If this is a local symbol, we resolve it directly without + creating a procedure linkage table entry. */ + if (h == NULL) + continue; + + if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL + || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) + break; + + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + + break; + + case R_SH_64: + case R_SH_64_PCREL: + if (h != NULL) + h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + + /* If we are creating a shared library, and this is a reloc + against a global symbol, or a non PC relative reloc + against a local symbol, then we need to copy the reloc + into the shared library. However, if we are linking with + -Bsymbolic, we do not need to copy a reloc against a + global symbol which is defined in an object we are + including in the link (i.e., DEF_REGULAR is set). At + this point we have not seen all the input files, so it is + possible that DEF_REGULAR is not set now but will be set + later (it is never cleared). We account for that + possibility below by storing information in the + pcrel_relocs_copied field of the hash table entry. */ + if (info->shared + && (sec->flags & SEC_ALLOC) != 0 + && (ELF32_R_TYPE (rel->r_info) != R_SH_64_PCREL + || (h != NULL + && (! info->symbolic + || (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + { + /* When creating a shared object, we must copy these + reloc types into the output file. We create a reloc + section in dynobj and make room for this reloc. */ + if (sreloc == NULL) + { + const char *name; + + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + name + 5) == 0); + + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) + { + flagword flags; + + sreloc = bfd_make_section (dynobj, name); + flags = (SEC_HAS_CONTENTS | SEC_READONLY + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if ((sec->flags & SEC_ALLOC) != 0) + flags |= SEC_ALLOC | SEC_LOAD; + if (sreloc == NULL + || ! bfd_set_section_flags (dynobj, sreloc, flags) + || ! bfd_set_section_alignment (dynobj, sreloc, 2)) + return FALSE; + } + } + + sreloc->_raw_size += sizeof (Elf64_External_Rela); + + /* If we are linking with -Bsymbolic, and this is a + global symbol, we count the number of PC relative + relocations we have entered for this symbol, so that + we can discard them again if the symbol is later + defined by a regular object. Note that this function + is only called if we are using an elf_sh linker + hash table, which means that h is really a pointer to + an elf_sh_link_hash_entry. */ + if (h != NULL && info->symbolic + && ELF64_R_TYPE (rel->r_info) == R_SH_64_PCREL) + { + struct elf_sh64_link_hash_entry *eh; + struct elf_sh64_pcrel_relocs_copied *p; + + eh = (struct elf_sh64_link_hash_entry *) h; + + for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next) + if (p->section == sreloc) + break; + + if (p == NULL) + { + p = ((struct elf_sh64_pcrel_relocs_copied *) + bfd_alloc (dynobj, sizeof *p)); + if (p == NULL) + return FALSE; + p->next = eh->pcrel_relocs_copied; + eh->pcrel_relocs_copied = p; + p->section = sreloc; + p->count = 0; + } + + ++p->count; + } + } + + break; + } + } + + return TRUE; +} + +static int +sh64_elf64_get_symbol_type (Elf_Internal_Sym * elf_sym, int type) +{ + if (ELF_ST_TYPE (elf_sym->st_info) == STT_DATALABEL) + return STT_DATALABEL; + + return type; +} + +/* FIXME: This is a copy of sh64_elf_add_symbol_hook in elf32-sh64.c. + Either file can presumably exist without the other, but do not differ + in elf-size-ness. How to share? + + Hook called by the linker routine which adds symbols from an object + file. We must make indirect symbols for undefined symbols marked with + STT_DATALABEL, so relocations passing them will pick up that attribute + and neutralize STO_SH5_ISA32 found on the symbol definition. + + There is a problem, though: We want to fill in the hash-table entry for + this symbol and signal to the caller that no further processing is + needed. But we don't have the index for this hash-table entry. We + rely here on that the current entry is the first hash-entry with NULL, + which seems brittle. Also, iterating over the hash-table to find that + entry is a linear operation on the number of symbols in this input + file, and this function should take constant time, so that's not good + too. Only comfort is that DataLabel references should only be found in + hand-written assembly code and thus be rare. FIXME: Talk maintainers + into adding an option to elf_add_symbol_hook (preferably) for the index + or the hash entry, alternatively adding the index to Elf_Internal_Sym + (not so good). */ + +static bfd_boolean +sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, + Elf_Internal_Sym *sym, const char **namep, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp, bfd_vma *valp) +{ + /* We want to do this for relocatable as well as final linking. */ + if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL + && is_elf_hash_table (info->hash)) + { + struct elf_link_hash_entry *h; + + /* For relocatable links, we register the DataLabel sym in its own + right, and tweak the name when it's output. Otherwise, we make + an indirect symbol of it. */ + flagword flags + = info->relocatable || info->emitrelocations + ? BSF_GLOBAL : BSF_GLOBAL | BSF_INDIRECT; + + char *dl_name + = bfd_malloc (strlen (*namep) + sizeof (DATALABEL_SUFFIX)); + struct elf_link_hash_entry ** sym_hash = elf_sym_hashes (abfd); + + BFD_ASSERT (sym_hash != NULL); + + /* Allocation may fail. */ + if (dl_name == NULL) + return FALSE; + + strcpy (dl_name, *namep); + strcat (dl_name, DATALABEL_SUFFIX); + + h = (struct elf_link_hash_entry *) + bfd_link_hash_lookup (info->hash, dl_name, FALSE, FALSE, FALSE); + + if (h == NULL) + { + /* No previous datalabel symbol. Make one. */ + struct bfd_link_hash_entry *bh = NULL; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + + if (! _bfd_generic_link_add_one_symbol (info, abfd, dl_name, + flags, *secp, *valp, + *namep, FALSE, + bed->collect, &bh)) + { + free (dl_name); + return FALSE; + } + + h = (struct elf_link_hash_entry *) bh; + h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; + h->type = STT_DATALABEL; + } + else + /* If a new symbol was created, it holds the allocated name. + Otherwise, we don't need it anymore and should deallocate it. */ + free (dl_name); + + if (h->type != STT_DATALABEL + || ((info->relocatable || info->emitrelocations) + && h->root.type != bfd_link_hash_undefined) + || (! info->relocatable && !info->emitrelocations + && h->root.type != bfd_link_hash_indirect)) + { + /* Make sure we don't get confused on invalid input. */ + (*_bfd_error_handler) + (_("%s: encountered datalabel symbol in input"), + bfd_get_filename (abfd)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* Now find the hash-table slot for this entry and fill it in. */ + while (*sym_hash != NULL) + sym_hash++; + *sym_hash = h; + + /* Signal to caller to skip this symbol - we've handled it. */ + *namep = NULL; + } + + return TRUE; +} + +/* This hook function is called before the linker writes out a global + symbol. For relocatable links, DataLabel symbols will be present in + linker output. We cut off the special suffix on those symbols, so the + right name appears in the output. + + When linking and emitting relocations, there can appear global symbols + that are not referenced by relocs, but rather only implicitly through + DataLabel references, a relation that is not visible to the linker. + Since no stripping of global symbols in done when doing such linking, + we don't need to look up and make sure to emit the main symbol for each + DataLabel symbol. */ + +static bfd_boolean +sh64_elf64_link_output_symbol_hook (struct bfd_link_info *info, + const char *cname, + Elf_Internal_Sym *sym, + asection *input_sec ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED) +{ + char *name = (char *) cname; + + if (info->relocatable || info->emitrelocations) + { + if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL) + name[strlen (name) - strlen (DATALABEL_SUFFIX)] = 0; + } + + return TRUE; +} + +/* Set bit 0 on the entry address; it always points to SHmedia code. This + is mostly for symmetry with the 32-bit format, where code can be + SHcompact and we need to make a distinction to make sure execution + starts in the right ISA mode. It is also convenient for a loader, + which would otherwise have to set this bit when loading a TR register + before jumping to the program entry. */ + +static void +sh64_elf64_final_write_processing (bfd *abfd, + bfd_boolean linker ATTRIBUTE_UNUSED) +{ + /* FIXME: Perhaps we shouldn't do this if the entry address was supplied + numerically, but we currently lack the infrastructure to recognize + that: The entry symbol, and info whether it is numeric or a symbol + name is kept private in the linker. */ + if (elf_elfheader (abfd)->e_type == ET_EXEC) + elf_elfheader (abfd)->e_entry |= 1; +} + +/* First entry in an absolute procedure linkage table look like this. */ + +static const bfd_byte elf_sh64_plt0_entry_be[PLT_ENTRY_SIZE] = +{ + 0xcc, 0x00, 0x01, 0x10, /* movi .got.plt >> 48, r17 */ + 0xc8, 0x00, 0x01, 0x10, /* shori (.got.plt >> 32) & 65535, r17 */ + 0xc8, 0x00, 0x01, 0x10, /* shori (.got.plt >> 16) & 65535, r17 */ + 0xc8, 0x00, 0x01, 0x10, /* shori .got.plt & 65535, r17 */ + 0x8d, 0x10, 0x09, 0x90, /* ld.q r17, 16, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x8d, 0x10, 0x05, 0x10, /* ld.q r17, 8, r17 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ +}; + +static const bfd_byte elf_sh64_plt0_entry_le[PLT_ENTRY_SIZE] = +{ + 0x10, 0x01, 0x00, 0xcc, /* movi .got.plt >> 16, r17 */ + 0x10, 0x01, 0x00, 0xc8, /* shori (.got.plt >> 32) & 65535, r17 */ + 0x10, 0x01, 0x00, 0xc8, /* shori (.got.plt >> 16) & 65535, r17 */ + 0x10, 0x01, 0x00, 0xc8, /* shori .got.plt & 65535, r17 */ + 0x90, 0x09, 0x10, 0x8d, /* ld.q r17, 16, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0x10, 0x05, 0x10, 0x8d, /* ld.q r17, 8, r17 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ +}; + +/* Sebsequent entries in an absolute procedure linkage table look like + this. */ + +static const bfd_byte elf_sh64_plt_entry_be[PLT_ENTRY_SIZE] = +{ + 0xcc, 0x00, 0x01, 0x90, /* movi nameN-in-GOT >> 48, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori (nameN-in-GOT >> 32) & 65535, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori (nameN-in-GOT >> 16) & 65535, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori nameN-in-GOT & 65535, r25 */ + 0x8d, 0x90, 0x01, 0x90, /* ld.q r25, 0, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0xcc, 0x00, 0x01, 0x90, /* movi (.+8-.PLT0) >> 16, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori (.+4-.PLT0) & 65535, r25 */ + 0x6b, 0xf5, 0x66, 0x00, /* ptrel r25, tr0 */ + 0xcc, 0x00, 0x01, 0x50, /* movi reloc-offset >> 16, r21 */ + 0xc8, 0x00, 0x01, 0x50, /* shori reloc-offset & 65535, r21 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ +}; + +static const bfd_byte elf_sh64_plt_entry_le[PLT_ENTRY_SIZE] = +{ + 0x90, 0x01, 0x00, 0xcc, /* movi nameN-in-GOT >> 16, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori nameN-in-GOT & 65535, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori nameN-in-GOT & 65535, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori nameN-in-GOT & 65535, r25 */ + 0x90, 0x01, 0x90, 0x8d, /* ld.q r25, 0, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0x90, 0x01, 0x00, 0xcc, /* movi (.+8-.PLT0) >> 16, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori (.+4-.PLT0) & 65535, r25 */ + 0x00, 0x66, 0xf5, 0x6b, /* ptrel r25, tr0 */ + 0x50, 0x01, 0x00, 0xcc, /* movi reloc-offset >> 16, r21 */ + 0x50, 0x01, 0x00, 0xc8, /* shori reloc-offset & 65535, r21 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ +}; + +/* Entries in a PIC procedure linkage table look like this. */ + +static const bfd_byte elf_sh64_pic_plt_entry_be[PLT_ENTRY_SIZE] = +{ + 0xcc, 0x00, 0x01, 0x90, /* movi nameN@GOT >> 16, r25 */ + 0xc8, 0x00, 0x01, 0x90, /* shori nameN@GOT & 65535, r25 */ + 0x40, 0xc3, 0x65, 0x90, /* ldx.q r12, r25, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0x6f, 0xf0, 0xff, 0xf0, /* nop */ + 0xce, 0x00, 0x01, 0x10, /* movi -GOT_BIAS, r17 */ + 0x00, 0xc9, 0x45, 0x10, /* add r12, r17, r17 */ + 0x8d, 0x10, 0x09, 0x90, /* ld.q r17, 16, r25 */ + 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ + 0x8d, 0x10, 0x05, 0x10, /* ld.q r17, 8, r17 */ + 0xcc, 0x00, 0x01, 0x50, /* movi reloc-offset >> 16, r21 */ + 0xc8, 0x00, 0x01, 0x50, /* shori reloc-offset & 65535, r21 */ + 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ +}; + +static const bfd_byte elf_sh64_pic_plt_entry_le[PLT_ENTRY_SIZE] = +{ + 0x90, 0x01, 0x00, 0xcc, /* movi nameN@GOT >> 16, r25 */ + 0x90, 0x01, 0x00, 0xc8, /* shori nameN@GOT & 65535, r25 */ + 0x90, 0x65, 0xc3, 0x40, /* ldx.q r12, r25, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0xf0, 0xff, 0xf0, 0x6f, /* nop */ + 0x10, 0x01, 0x00, 0xce, /* movi -GOT_BIAS, r17 */ + 0x10, 0x45, 0xc9, 0x00, /* add r12, r17, r17 */ + 0x90, 0x09, 0x10, 0x8d, /* ld.q r17, 16, r25 */ + 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ + 0x10, 0x05, 0x10, 0x8d, /* ld.q r17, 8, r17 */ + 0x50, 0x01, 0x00, 0xcc, /* movi reloc-offset >> 16, r21 */ + 0x50, 0x01, 0x00, 0xc8, /* shori reloc-offset & 65535, r21 */ + 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ +}; + +static const bfd_byte *elf_sh64_plt0_entry; +static const bfd_byte *elf_sh64_plt_entry; +static const bfd_byte *elf_sh64_pic_plt_entry; + +/* Create an entry in an sh ELF linker hash table. */ + +static struct bfd_hash_entry * +sh64_elf64_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) +{ + struct elf_sh64_link_hash_entry *ret = + (struct elf_sh64_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct elf_sh64_link_hash_entry *) NULL) + ret = ((struct elf_sh64_link_hash_entry *) + bfd_hash_allocate (table, + sizeof (struct elf_sh64_link_hash_entry))); + if (ret == (struct elf_sh64_link_hash_entry *) NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct elf_sh64_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != (struct elf_sh64_link_hash_entry *) NULL) + { + ret->pcrel_relocs_copied = NULL; + ret->datalabel_got_offset = (bfd_vma) -1; + } + + return (struct bfd_hash_entry *) ret; +} + +/* Create an sh64 ELF linker hash table. */ + +static struct bfd_link_hash_table * +sh64_elf64_link_hash_table_create (bfd *abfd) +{ + struct elf_sh64_link_hash_table *ret; + + ret = ((struct elf_sh64_link_hash_table *) + bfd_malloc (sizeof (struct elf_sh64_link_hash_table))); + if (ret == (struct elf_sh64_link_hash_table *) NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + sh64_elf64_link_hash_newfunc)) + { + free (ret); + return NULL; + } + + return &ret->root.root; +} + +inline static void +movi_shori_putval (bfd *output_bfd, unsigned long value, char *addr) +{ + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr) + | ((value >> 6) & 0x3fffc00), + addr); + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr + 4) + | ((value << 10) & 0x3fffc00), + addr + 4); +} + +inline static void +movi_3shori_putval (bfd *output_bfd, bfd_vma value, char *addr) +{ + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr) + | ((value >> 38) & 0x3fffc00), + addr); + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr + 4) + | ((value >> 22) & 0x3fffc00), + addr + 4); + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr + 8) + | ((value >> 6) & 0x3fffc00), + addr + 8); + bfd_put_32 (output_bfd, + bfd_get_32 (output_bfd, addr + 12) + | ((value << 10) & 0x3fffc00), + addr + 12); +} + +/* Create dynamic sections when linking against a dynamic object. */ + +static bfd_boolean +sh64_elf64_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) +{ + flagword flags, pltflags; + register asection *s; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + int ptralign = 0; + + switch (bed->s->arch_size) + { + case 32: + ptralign = 2; + break; + + case 64: + ptralign = 3; + break; + + default: + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and + .rel[a].bss sections. */ + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + + pltflags = flags; + pltflags |= SEC_CODE; + if (bed->plt_not_loaded) + pltflags &= ~ (SEC_LOAD | SEC_HAS_CONTENTS); + if (bed->plt_readonly) + pltflags |= SEC_READONLY; + + s = bfd_make_section (abfd, ".plt"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, pltflags) + || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + return FALSE; + + if (bed->want_plt_sym) + { + /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the + .plt section. */ + struct elf_link_hash_entry *h; + struct bfd_link_hash_entry *bh = NULL; + + if (! (_bfd_generic_link_add_one_symbol + (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s, + (bfd_vma) 0, (const char *) NULL, FALSE, bed->collect, &bh))) + return FALSE; + + h = (struct elf_link_hash_entry *) bh; + h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; + + if (info->shared + && ! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = bfd_make_section (abfd, + bed->default_use_rela_p ? ".rela.plt" : ".rel.plt"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + + if (! _bfd_elf_create_got_section (abfd, info)) + return FALSE; + + { + const char *secname; + char *relname; + flagword secflags; + asection *sec; + + for (sec = abfd->sections; sec; sec = sec->next) + { + secflags = bfd_get_section_flags (abfd, sec); + if ((secflags & (SEC_DATA | SEC_LINKER_CREATED)) + || ((secflags & SEC_HAS_CONTENTS) != SEC_HAS_CONTENTS)) + continue; + secname = bfd_get_section_name (abfd, sec); + relname = (char *) bfd_malloc (strlen (secname) + 6); + strcpy (relname, ".rela"); + strcat (relname, secname); + s = bfd_make_section (abfd, relname); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + } + } + + if (bed->want_dynbss) + { + /* The .dynbss section is a place to put symbols which are defined + by dynamic objects, are referenced by regular objects, and are + not functions. We must allocate space for them in the process + image and use a R_*_COPY reloc to tell the dynamic linker to + initialize them at run time. The linker script puts the .dynbss + section into the .bss section of the final image. */ + s = bfd_make_section (abfd, ".dynbss"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, SEC_ALLOC)) + return FALSE; + + /* The .rel[a].bss section holds copy relocs. This section is not + normally needed. We need to create it here, though, so that the + linker will map it to an output section. We can't just create it + only if we need it, because we will not know whether we need it + until we have seen all the input files, and the first time the + main linker code calls BFD after examining all the input files + (size_dynamic_sections) the input sections have already been + mapped to the output sections. If the section turns out not to + be needed, we can discard it later. We will never need this + section when generating a shared object, since they do not use + copy relocs. */ + if (! info->shared) + { + s = bfd_make_section (abfd, + (bed->default_use_rela_p + ? ".rela.bss" : ".rel.bss")); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) + || ! bfd_set_section_alignment (abfd, s, ptralign)) + return FALSE; + } + } + + return TRUE; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static bfd_boolean +sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) +{ + bfd *dynobj; + asection *s; + unsigned int power_of_two; + + dynobj = elf_hash_table (info)->dynobj; + + /* Make sure we know what is going on here. */ + BFD_ASSERT (dynobj != NULL + && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) + || h->weakdef != NULL + || ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_REF_REGULAR) != 0 + && (h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0))); + + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later, + when we know the address of the .got section. */ + if (h->type == STT_FUNC + || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + { + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0) + { + /* This case can occur if we saw a PLT reloc in an input + file, but the symbol was never referred to by a dynamic + object. In such a case, we don't actually need to build + a procedure linkage table, and we can just do a REL64 + reloc instead. */ + BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0); + return TRUE; + } + + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (s != NULL); + + /* If this is the first .plt entry, make room for the special + first entry. */ + if (s->_raw_size == 0) + s->_raw_size += PLT_ENTRY_SIZE; + + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (! info->shared + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + } + + h->plt.offset = s->_raw_size; + + /* Make room for this entry. */ + s->_raw_size += elf_sh64_sizeof_plt (info); + + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + + s = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (s != NULL); + s->_raw_size += 8; + + /* We also need to make an entry in the .rela.plt section. */ + + s = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (s != NULL); + s->_raw_size += sizeof (Elf64_External_Rela); + + return TRUE; + } + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (info->shared) + return TRUE; + + /* If there are no references to this symbol that do not use the + GOT, we don't need to generate a copy reloc. */ + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + return TRUE; + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + + s = bfd_get_section_by_name (dynobj, ".dynbss"); + BFD_ASSERT (s != NULL); + + /* We must generate a R_SH_COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rela.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + asection *srel; + + srel = bfd_get_section_by_name (dynobj, ".rela.bss"); + BFD_ASSERT (srel != NULL); + srel->_raw_size += sizeof (Elf64_External_Rela); + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + } + + /* We need to figure out the alignment required for this symbol. I + have no idea how ELF linkers handle this. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > 3) + power_of_two = 3; + + /* Apply the required alignment. */ + s->_raw_size = BFD_ALIGN (s->_raw_size, + (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (dynobj, s)) + { + if (! bfd_set_section_alignment (dynobj, s, power_of_two)) + return FALSE; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->_raw_size; + + /* Increment the section size to make room for the symbol. */ + s->_raw_size += h->size; + + return TRUE; +} + +/* This function is called via sh_elf_link_hash_traverse if we are + creating a shared object with -Bsymbolic. It discards the space + allocated to copy PC relative relocs against symbols which are + defined in regular objects. We allocated space for them in the + check_relocs routine, but we won't fill them in in the + relocate_section routine. */ + +static bfd_boolean +sh64_elf64_discard_copies (struct elf_sh64_link_hash_entry *h, + void *ignore ATTRIBUTE_UNUSED) +{ + struct elf_sh64_pcrel_relocs_copied *s; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct elf_sh64_link_hash_entry *) h->root.root.u.i.link; + + /* We only discard relocs for symbols defined in a regular object. */ + if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + return TRUE; + + for (s = h->pcrel_relocs_copied; s != NULL; s = s->next) + s->section->_raw_size -= s->count * sizeof (Elf64_External_Rela); + + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +sh64_elf64_size_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) +{ + bfd *dynobj; + asection *s; + bfd_boolean plt; + bfd_boolean relocs; + bfd_boolean reltext; + + dynobj = elf_hash_table (info)->dynobj; + BFD_ASSERT (dynobj != NULL); + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (info->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } + else + { + /* We may have created entries in the .rela.got section. + However, if we are not creating the dynamic sections, we will + not actually use these entries. Reset the size of .rela.got, + which will cause it to get stripped from the output file + below. */ + s = bfd_get_section_by_name (dynobj, ".rela.got"); + if (s != NULL) + s->_raw_size = 0; + } + + /* If this is a -Bsymbolic shared link, then we need to discard all + PC relative relocs against symbols defined in a regular object. + We allocated space for them in the check_relocs routine, but we + will not fill them in in the relocate_section routine. */ + if (info->shared && info->symbolic) + sh64_elf64_link_hash_traverse (sh64_elf64_hash_table (info), + sh64_elf64_discard_copies, NULL); + + /* The check_relocs and adjust_dynamic_symbol entry points have + determined the sizes of the various dynamic sections. Allocate + memory for them. */ + plt = FALSE; + relocs = FALSE; + reltext = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + const char *name; + bfd_boolean strip; + + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + /* It's OK to base decisions on the section name, because none + of the dynobj section names depend upon the input files. */ + name = bfd_get_section_name (dynobj, s); + + strip = FALSE; + + if (strcmp (name, ".plt") == 0) + { + if (s->_raw_size == 0) + { + /* Strip this section if we don't need it; see the + comment below. */ + strip = TRUE; + } + else + { + /* Remember whether there is a PLT. */ + plt = TRUE; + } + } + else if (strncmp (name, ".rela", 5) == 0) + { + if (s->_raw_size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + strip = TRUE; + } + else + { + asection *target; + + /* Remember whether there are any reloc sections other + than .rela.plt. */ + if (strcmp (name, ".rela.plt") != 0) + { + const char *outname; + + relocs = TRUE; + + /* If this relocation section applies to a read only + section, then we probably need a DT_TEXTREL + entry. The entries in the .rela.plt section + really apply to the .got section, which we + created ourselves and so know is not readonly. */ + outname = bfd_get_section_name (output_bfd, + s->output_section); + target = bfd_get_section_by_name (output_bfd, outname + 5); + if (target != NULL + && (target->flags & SEC_READONLY) != 0 + && (target->flags & SEC_ALLOC) != 0) + reltext = TRUE; + } + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + } + else if (strncmp (name, ".got", 4) != 0) + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (strip) + { + _bfd_strip_section_from_output (info, s); + continue; + } + + /* Allocate memory for the section contents. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + if (s->contents == NULL && s->_raw_size != 0) + return FALSE; + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in sh64_elf64_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ + if (info->executable) + { + if (!_bfd_elf_add_dynamic_entry (info, DT_DEBUG, 0)) + return FALSE; + } + + if (plt) + { + if (!_bfd_elf_add_dynamic_entry (info, DT_PLTGOT, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_PLTRELSZ, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_PLTREL, DT_RELA) + || !_bfd_elf_add_dynamic_entry (info, DT_JMPREL, 0)) + return FALSE; + } + + if (relocs) + { + if (!_bfd_elf_add_dynamic_entry (info, DT_RELA, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_RELASZ, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_RELAENT, + sizeof (Elf64_External_Rela))) + return FALSE; + } + + if (reltext) + { + if (!_bfd_elf_add_dynamic_entry (info, DT_TEXTREL, 0)) + return FALSE; + } + } + + return TRUE; +} + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +static bfd_boolean +sh64_elf64_finish_dynamic_symbol (bfd *output_bfd, + struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + bfd *dynobj; + + dynobj = elf_hash_table (info)->dynobj; + + if (h->plt.offset != (bfd_vma) -1) + { + asection *splt; + asection *sgot; + asection *srel; + + bfd_vma plt_index; + bfd_vma got_offset; + Elf_Internal_Rela rel; + bfd_byte *loc; + + /* This symbol has an entry in the procedure linkage table. Set + it up. */ + + BFD_ASSERT (h->dynindx != -1); + + splt = bfd_get_section_by_name (dynobj, ".plt"); + sgot = bfd_get_section_by_name (dynobj, ".got.plt"); + srel = bfd_get_section_by_name (dynobj, ".rela.plt"); + BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); + + /* Get the index in the procedure linkage table which + corresponds to this symbol. This is the index of this symbol + in all the symbols for which we are making plt entries. The + first entry in the procedure linkage table is reserved. */ + plt_index = h->plt.offset / elf_sh64_sizeof_plt (info) - 1; + + /* Get the offset into the .got table of the entry that + corresponds to this function. Each .got entry is 8 bytes. + The first three are reserved. */ + got_offset = (plt_index + 3) * 8; + + if (info->shared) + got_offset -= GOT_BIAS; + + /* Fill in the entry in the procedure linkage table. */ + if (! info->shared) + { + if (elf_sh64_plt_entry == NULL) + { + elf_sh64_plt_entry = (bfd_big_endian (output_bfd) ? + elf_sh64_plt_entry_be : elf_sh64_plt_entry_le); + } + memcpy (splt->contents + h->plt.offset, elf_sh64_plt_entry, + elf_sh64_sizeof_plt (info)); + movi_3shori_putval (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + + got_offset), + (splt->contents + h->plt.offset + + elf_sh64_plt_symbol_offset (info))); + + /* Set bottom bit because its for a branch to SHmedia */ + movi_shori_putval (output_bfd, + -(h->plt.offset + + elf_sh64_plt_plt0_offset (info) + 8) + | 1, + (splt->contents + h->plt.offset + + elf_sh64_plt_plt0_offset (info))); + } + else + { + if (elf_sh64_pic_plt_entry == NULL) + { + elf_sh64_pic_plt_entry = (bfd_big_endian (output_bfd) ? + elf_sh64_pic_plt_entry_be : + elf_sh64_pic_plt_entry_le); + } + memcpy (splt->contents + h->plt.offset, elf_sh64_pic_plt_entry, + elf_sh64_sizeof_plt (info)); + movi_shori_putval (output_bfd, got_offset, + (splt->contents + h->plt.offset + + elf_sh64_plt_symbol_offset (info))); + } + + if (info->shared) + got_offset += GOT_BIAS; + + movi_shori_putval (output_bfd, + plt_index * sizeof (Elf64_External_Rela), + (splt->contents + h->plt.offset + + elf_sh64_plt_reloc_offset (info))); + + /* Fill in the entry in the global offset table. */ + bfd_put_64 (output_bfd, + (splt->output_section->vma + + splt->output_offset + + h->plt.offset + + elf_sh64_plt_temp_offset (info)), + sgot->contents + got_offset); + + /* Fill in the entry in the .rela.plt section. */ + rel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + got_offset); + rel.r_info = ELF64_R_INFO (h->dynindx, R_SH_JMP_SLOT64); + rel.r_addend = 0; + rel.r_addend = GOT_BIAS; + loc = srel->contents + plt_index * sizeof (Elf64_External_Rela); + bfd_elf64_swap_reloca_out (output_bfd, &rel, loc); + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + } + } + + if (h->got.offset != (bfd_vma) -1) + { + asection *sgot; + asection *srel; + Elf_Internal_Rela rel; + bfd_byte *loc; + + /* This symbol has an entry in the global offset table. Set it + up. */ + + sgot = bfd_get_section_by_name (dynobj, ".got"); + srel = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (sgot != NULL && srel != NULL); + + rel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + (h->got.offset &~ 1)); + + /* If this is a -Bsymbolic link, and the symbol is defined + locally, we just want to emit a RELATIVE reloc. Likewise if + the symbol was forced to be local because of a version file. + The entry in the global offset table will already have been + initialized in the relocate_section function. */ + if (info->shared + && (info->symbolic || h->dynindx == -1) + && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + { + rel.r_info = ELF64_R_INFO (0, R_SH_RELATIVE64); + rel.r_addend = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + else + { + bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); + rel.r_info = ELF64_R_INFO (h->dynindx, R_SH_GLOB_DAT64); + rel.r_addend = 0; + } + + loc = srel->contents; + loc += srel->reloc_count++ * sizeof (Elf64_External_Rela); + bfd_elf64_swap_reloca_out (output_bfd, &rel, loc); + } + + if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + { + asection *s; + Elf_Internal_Rela rel; + bfd_byte *loc; + + /* This symbol needs a copy reloc. Set it up. */ + + BFD_ASSERT (h->dynindx != -1 + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)); + + s = bfd_get_section_by_name (h->root.u.def.section->owner, + ".rela.bss"); + BFD_ASSERT (s != NULL); + + rel.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + rel.r_info = ELF64_R_INFO (h->dynindx, R_SH_COPY64); + rel.r_addend = 0; + loc = s->contents; + loc += s->reloc_count++ * sizeof (Elf64_External_Rela); + bfd_elf64_swap_reloca_out (output_bfd, &rel, loc); + } + + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + sym->st_shndx = SHN_ABS; + + return TRUE; +} + +/* Finish up the dynamic sections. */ + +static bfd_boolean +sh64_elf64_finish_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) +{ + bfd *dynobj; + asection *sgot; + asection *sdyn; + + dynobj = elf_hash_table (info)->dynobj; + + sgot = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (sgot != NULL); + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (elf_hash_table (info)->dynamic_sections_created) + { + asection *splt; + Elf64_External_Dyn *dyncon, *dynconend; + + BFD_ASSERT (sdyn != NULL); + + dyncon = (Elf64_External_Dyn *) sdyn->contents; + dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + const char *name; + asection *s; + struct elf_link_hash_entry *h; + + bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + break; + + case DT_INIT: + name = info->init_function; + goto get_sym; + + case DT_FINI: + name = info->fini_function; + get_sym: + if (dyn.d_un.d_val != 0) + { + h = elf_link_hash_lookup (elf_hash_table (info), name, + FALSE, FALSE, TRUE); + if (h != NULL && (h->other & STO_SH5_ISA32)) + { + dyn.d_un.d_val |= 1; + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + } + } + break; + + case DT_PLTGOT: + name = ".got"; + goto get_vma; + + case DT_JMPREL: + name = ".rela.plt"; + get_vma: + s = bfd_get_section_by_name (output_bfd, name); + BFD_ASSERT (s != NULL); + dyn.d_un.d_ptr = s->vma; + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_PLTRELSZ: + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + BFD_ASSERT (s != NULL); + if (s->_cooked_size != 0) + dyn.d_un.d_val = s->_cooked_size; + else + dyn.d_un.d_val = s->_raw_size; + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_RELASZ: + /* My reading of the SVR4 ABI indicates that the + procedure linkage table relocs (DT_JMPREL) should be + included in the overall relocs (DT_RELA). This is + what Solaris does. However, UnixWare can not handle + that case. Therefore, we override the DT_RELASZ entry + here to make it not include the JMPREL relocs. Since + the linker script arranges for .rela.plt to follow all + other relocation sections, we don't have to worry + about changing the DT_RELA entry. */ + s = bfd_get_section_by_name (output_bfd, ".rela.plt"); + if (s != NULL) + { + if (s->_cooked_size != 0) + dyn.d_un.d_val -= s->_cooked_size; + else + dyn.d_un.d_val -= s->_raw_size; + } + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + } + } + + /* Fill in the first entry in the procedure linkage table. */ + splt = bfd_get_section_by_name (dynobj, ".plt"); + if (splt && splt->_raw_size > 0) + { + if (info->shared) + { + if (elf_sh64_pic_plt_entry == NULL) + { + elf_sh64_pic_plt_entry = (bfd_big_endian (output_bfd) ? + elf_sh64_pic_plt_entry_be : + elf_sh64_pic_plt_entry_le); + } + memcpy (splt->contents, elf_sh64_pic_plt_entry, + elf_sh64_sizeof_plt (info)); + } + else + { + if (elf_sh64_plt0_entry == NULL) + { + elf_sh64_plt0_entry = (bfd_big_endian (output_bfd) ? + elf_sh64_plt0_entry_be : + elf_sh64_plt0_entry_le); + } + memcpy (splt->contents, elf_sh64_plt0_entry, PLT_ENTRY_SIZE); + movi_3shori_putval (output_bfd, + sgot->output_section->vma + + sgot->output_offset, + splt->contents + + elf_sh64_plt0_gotplt_offset (info)); + } + + /* UnixWare sets the entsize of .plt to 8, although that doesn't + really seem like the right value. */ + elf_section_data (splt->output_section)->this_hdr.sh_entsize = 8; + } + } + + /* Fill in the first three entries in the global offset table. */ + if (sgot->_raw_size > 0) + { + if (sdyn == NULL) + bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents); + else + bfd_put_64 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + sgot->contents); + bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + 16); + } + + elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 8; + + return TRUE; +} + +/* Merge non visibility st_other attribute when the symbol comes from + a dynamic object. */ +static void +sh64_elf64_merge_symbol_attribute (struct elf_link_hash_entry *h, + const Elf_Internal_Sym *isym, + bfd_boolean definition, + bfd_boolean dynamic) +{ + if (isym->st_other != 0 && dynamic) + { + unsigned char other; + + /* Take the balance of OTHER from the definition. */ + other = (definition ? isym->st_other : h->other); + other &= ~ ELF_ST_VISIBILITY (-1); + h->other = other | ELF_ST_VISIBILITY (h->other); + } + + return; +} + +static struct bfd_elf_special_section const sh64_elf64_special_sections[]= +{ + { ".cranges", 8, 0, SHT_PROGBITS, 0 }, + { NULL, 0, 0, 0, 0 } +}; + +#define TARGET_BIG_SYM bfd_elf64_sh64_vec +#define TARGET_BIG_NAME "elf64-sh64" +#define TARGET_LITTLE_SYM bfd_elf64_sh64l_vec +#define TARGET_LITTLE_NAME "elf64-sh64l" +#define ELF_ARCH bfd_arch_sh +#define ELF_MACHINE_CODE EM_SH +#define ELF_MAXPAGESIZE 128 + +#define elf_symbol_leading_char '_' + +#define bfd_elf64_bfd_reloc_type_lookup sh_elf64_reloc_type_lookup +#define elf_info_to_howto sh_elf64_info_to_howto + +/* Note: there's no relaxation at present. */ + +#define elf_backend_relocate_section sh_elf64_relocate_section +#define bfd_elf64_bfd_get_relocated_section_contents \ + sh_elf64_get_relocated_section_contents +#define elf_backend_object_p sh_elf64_set_mach_from_flags +#define bfd_elf64_bfd_set_private_flags \ + sh_elf64_set_private_flags +#define bfd_elf64_bfd_copy_private_bfd_data \ + sh_elf64_copy_private_data +#define bfd_elf64_bfd_merge_private_bfd_data \ + sh_elf64_merge_private_data +#define elf_backend_fake_sections sh64_elf64_fake_sections + +#define elf_backend_gc_mark_hook sh_elf64_gc_mark_hook +#define elf_backend_gc_sweep_hook sh_elf64_gc_sweep_hook +#define elf_backend_check_relocs sh_elf64_check_relocs + +#define elf_backend_can_gc_sections 1 + +#define elf_backend_get_symbol_type sh64_elf64_get_symbol_type + +#define elf_backend_add_symbol_hook sh64_elf64_add_symbol_hook + +#define elf_backend_link_output_symbol_hook \ + sh64_elf64_link_output_symbol_hook + +#define elf_backend_merge_symbol_attribute \ + sh64_elf64_merge_symbol_attribute + +#define elf_backend_final_write_processing \ + sh64_elf64_final_write_processing + +#define elf_backend_create_dynamic_sections \ + sh64_elf64_create_dynamic_sections +#define bfd_elf64_bfd_link_hash_table_create \ + sh64_elf64_link_hash_table_create +#define elf_backend_adjust_dynamic_symbol \ + sh64_elf64_adjust_dynamic_symbol +#define elf_backend_size_dynamic_sections \ + sh64_elf64_size_dynamic_sections +#define elf_backend_finish_dynamic_symbol \ + sh64_elf64_finish_dynamic_symbol +#define elf_backend_finish_dynamic_sections \ + sh64_elf64_finish_dynamic_sections +#define elf_backend_special_sections sh64_elf64_special_sections + +#define elf_backend_want_got_plt 1 +#define elf_backend_plt_readonly 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_got_header_size 24 + +#include "elf64-target.h" + +/* NetBSD support. */ +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf64_sh64nbsd_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf64-sh64-nbsd" +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf64_sh64lnbsd_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf64-sh64l-nbsd" +#undef ELF_MAXPAGESIZE +#define ELF_MAXPAGESIZE 0x10000 +#undef elf_symbol_leading_char +#define elf_symbol_leading_char 0 + +#define elf64_bed elf64_sh64_nbsd_bed + +#include "elf64-target.h" + +/* Linux support. */ +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf64_sh64blin_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf64-sh64big-linux" +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf64_sh64lin_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf64-sh64-linux" + +#define INCLUDED_TARGET_FILE +#include "elf64-target.h" diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 90de3b974d5ef..4568a22d6430f 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -1638,11 +1638,7 @@ sparc64_elf_adjust_dynamic_symbol (info, h) || h->root.type == bfd_link_hash_defweak) && (h->root.u.def.section->flags & SEC_CODE) != 0)) { - if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 - && h->root.type != bfd_link_hash_undefweak - && h->root.type != bfd_link_hash_undefined) + if (! elf_hash_table (info)->dynamic_sections_created) { /* This case can occur if we saw a WPLT30 reloc in an input file, but none of the input files were dynamic objects. diff --git a/bfd/elflink.h b/bfd/elflink.h deleted file mode 100644 index 6887e506ab745..0000000000000 --- a/bfd/elflink.h +++ /dev/null @@ -1,8532 +0,0 @@ -/* ELF linker support. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 - Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; 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. */ - -/* ELF linker code. */ - -/* This struct is used to pass information to routines called via - elf_link_hash_traverse which must return failure. */ - -struct elf_info_failed -{ - boolean failed; - struct bfd_link_info *info; - struct bfd_elf_version_tree *verdefs; -}; - -static boolean is_global_data_symbol_definition - PARAMS ((bfd *, Elf_Internal_Sym *)); -static boolean elf_link_is_defined_archive_symbol - PARAMS ((bfd *, carsym *)); -static boolean elf_link_add_object_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean elf_link_add_archive_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean elf_merge_symbol - PARAMS ((bfd *, struct bfd_link_info *, const char *, - Elf_Internal_Sym *, asection **, bfd_vma *, - struct elf_link_hash_entry **, boolean *, boolean *, - boolean *, boolean)); -static boolean elf_add_default_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - const char *, Elf_Internal_Sym *, asection **, bfd_vma *, - boolean *, boolean, boolean)); -static boolean elf_export_symbol - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_finalize_dynstr - PARAMS ((bfd *, struct bfd_link_info *)); -static boolean elf_fix_symbol_flags - PARAMS ((struct elf_link_hash_entry *, struct elf_info_failed *)); -static boolean elf_adjust_dynamic_symbol - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_link_find_version_dependencies - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_link_assign_sym_version - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_collect_hash_codes - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_link_read_relocs_from_section - PARAMS ((bfd *, Elf_Internal_Shdr *, PTR, Elf_Internal_Rela *)); -static size_t compute_bucket_count - PARAMS ((struct bfd_link_info *)); -static boolean elf_link_output_relocs - PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *)); -static boolean elf_link_size_reloc_section - PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); -static void elf_link_adjust_relocs - PARAMS ((bfd *, Elf_Internal_Shdr *, unsigned int, - struct elf_link_hash_entry **)); -static int elf_link_sort_cmp1 - PARAMS ((const void *, const void *)); -static int elf_link_sort_cmp2 - PARAMS ((const void *, const void *)); -static size_t elf_link_sort_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection **)); -static boolean elf_section_ignore_discarded_relocs - PARAMS ((asection *)); - -/* Given an ELF BFD, add symbols to the global hash table as - appropriate. */ - -boolean -elf_bfd_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - switch (bfd_get_format (abfd)) - { - case bfd_object: - return elf_link_add_object_symbols (abfd, info); - case bfd_archive: - return elf_link_add_archive_symbols (abfd, info); - default: - bfd_set_error (bfd_error_wrong_format); - return false; - } -} - -/* Return true iff this is a non-common, definition of a non-function symbol. */ -static boolean -is_global_data_symbol_definition (abfd, sym) - bfd * abfd ATTRIBUTE_UNUSED; - Elf_Internal_Sym * sym; -{ - /* Local symbols do not count, but target specific ones might. */ - if (ELF_ST_BIND (sym->st_info) != STB_GLOBAL - && ELF_ST_BIND (sym->st_info) < STB_LOOS) - return false; - - /* Function symbols do not count. */ - if (ELF_ST_TYPE (sym->st_info) == STT_FUNC) - return false; - - /* If the section is undefined, then so is the symbol. */ - if (sym->st_shndx == SHN_UNDEF) - return false; - - /* If the symbol is defined in the common section, then - it is a common definition and so does not count. */ - if (sym->st_shndx == SHN_COMMON) - return false; - - /* If the symbol is in a target specific section then we - must rely upon the backend to tell us what it is. */ - if (sym->st_shndx >= SHN_LORESERVE && sym->st_shndx < SHN_ABS) - /* FIXME - this function is not coded yet: - - return _bfd_is_global_symbol_definition (abfd, sym); - - Instead for now assume that the definition is not global, - Even if this is wrong, at least the linker will behave - in the same way that it used to do. */ - return false; - - return true; -} - -/* Search the symbol table of the archive element of the archive ABFD - whose archive map contains a mention of SYMDEF, and determine if - the symbol is defined in this element. */ -static boolean -elf_link_is_defined_archive_symbol (abfd, symdef) - bfd * abfd; - carsym * symdef; -{ - Elf_Internal_Shdr * hdr; - bfd_size_type symcount; - bfd_size_type extsymcount; - bfd_size_type extsymoff; - Elf_Internal_Sym *isymbuf; - Elf_Internal_Sym *isym; - Elf_Internal_Sym *isymend; - boolean result; - - abfd = _bfd_get_elt_at_filepos (abfd, symdef->file_offset); - if (abfd == (bfd *) NULL) - return false; - - if (! bfd_check_format (abfd, bfd_object)) - return false; - - /* If we have already included the element containing this symbol in the - link then we do not need to include it again. Just claim that any symbol - it contains is not a definition, so that our caller will not decide to - (re)include this element. */ - if (abfd->archive_pass) - return false; - - /* Select the appropriate symbol table. */ - if ((abfd->flags & DYNAMIC) == 0 || elf_dynsymtab (abfd) == 0) - hdr = &elf_tdata (abfd)->symtab_hdr; - else - hdr = &elf_tdata (abfd)->dynsymtab_hdr; - - symcount = hdr->sh_size / sizeof (Elf_External_Sym); - - /* The sh_info field of the symtab header tells us where the - external symbols start. We don't care about the local symbols. */ - if (elf_bad_symtab (abfd)) - { - extsymcount = symcount; - extsymoff = 0; - } - else - { - extsymcount = symcount - hdr->sh_info; - extsymoff = hdr->sh_info; - } - - if (extsymcount == 0) - return false; - - /* Read in the symbol table. */ - isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff, - NULL, NULL, NULL); - if (isymbuf == NULL) - return false; - - /* Scan the symbol table looking for SYMDEF. */ - result = false; - for (isym = isymbuf, isymend = isymbuf + extsymcount; isym < isymend; isym++) - { - const char *name; - - name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link, - isym->st_name); - if (name == (const char *) NULL) - break; - - if (strcmp (name, symdef->name) == 0) - { - result = is_global_data_symbol_definition (abfd, isym); - break; - } - } - - free (isymbuf); - - return result; -} - -/* Add symbols from an ELF archive file to the linker hash table. We - don't use _bfd_generic_link_add_archive_symbols because of a - problem which arises on UnixWare. The UnixWare libc.so is an - archive which includes an entry libc.so.1 which defines a bunch of - symbols. The libc.so archive also includes a number of other - object files, which also define symbols, some of which are the same - as those defined in libc.so.1. Correct linking requires that we - consider each object file in turn, and include it if it defines any - symbols we need. _bfd_generic_link_add_archive_symbols does not do - this; it looks through the list of undefined symbols, and includes - any object file which defines them. When this algorithm is used on - UnixWare, it winds up pulling in libc.so.1 early and defining a - bunch of symbols. This means that some of the other objects in the - archive are not included in the link, which is incorrect since they - precede libc.so.1 in the archive. - - Fortunately, ELF archive handling is simpler than that done by - _bfd_generic_link_add_archive_symbols, which has to allow for a.out - oddities. In ELF, if we find a symbol in the archive map, and the - symbol is currently undefined, we know that we must pull in that - object file. - - Unfortunately, we do have to make multiple passes over the symbol - table until nothing further is resolved. */ - -static boolean -elf_link_add_archive_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - symindex c; - boolean *defined = NULL; - boolean *included = NULL; - carsym *symdefs; - boolean loop; - bfd_size_type amt; - - if (! bfd_has_map (abfd)) - { - /* An empty archive is a special case. */ - if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL) - return true; - bfd_set_error (bfd_error_no_armap); - return false; - } - - /* Keep track of all symbols we know to be already defined, and all - files we know to be already included. This is to speed up the - second and subsequent passes. */ - c = bfd_ardata (abfd)->symdef_count; - if (c == 0) - return true; - amt = c; - amt *= sizeof (boolean); - defined = (boolean *) bfd_zmalloc (amt); - included = (boolean *) bfd_zmalloc (amt); - if (defined == (boolean *) NULL || included == (boolean *) NULL) - goto error_return; - - symdefs = bfd_ardata (abfd)->symdefs; - - do - { - file_ptr last; - symindex i; - carsym *symdef; - carsym *symdefend; - - loop = false; - last = -1; - - symdef = symdefs; - symdefend = symdef + c; - for (i = 0; symdef < symdefend; symdef++, i++) - { - struct elf_link_hash_entry *h; - bfd *element; - struct bfd_link_hash_entry *undefs_tail; - symindex mark; - - if (defined[i] || included[i]) - continue; - if (symdef->file_offset == last) - { - included[i] = true; - continue; - } - - h = elf_link_hash_lookup (elf_hash_table (info), symdef->name, - false, false, false); - - if (h == NULL) - { - char *p, *copy; - size_t len, first; - - /* If this is a default version (the name contains @@), - look up the symbol again with only one `@' as well - as without the version. The effect is that references - to the symbol with and without the version will be - matched by the default symbol in the archive. */ - - p = strchr (symdef->name, ELF_VER_CHR); - if (p == NULL || p[1] != ELF_VER_CHR) - continue; - - /* First check with only one `@'. */ - len = strlen (symdef->name); - copy = bfd_alloc (abfd, (bfd_size_type) len); - if (copy == NULL) - goto error_return; - first = p - symdef->name + 1; - memcpy (copy, symdef->name, first); - memcpy (copy + first, symdef->name + first + 1, len - first); - - h = elf_link_hash_lookup (elf_hash_table (info), copy, - false, false, false); - - if (h == NULL) - { - /* We also need to check references to the symbol - without the version. */ - - copy[first - 1] = '\0'; - h = elf_link_hash_lookup (elf_hash_table (info), - copy, false, false, false); - } - - bfd_release (abfd, copy); - } - - if (h == NULL) - continue; - - if (h->root.type == bfd_link_hash_common) - { - /* We currently have a common symbol. The archive map contains - a reference to this symbol, so we may want to include it. We - only want to include it however, if this archive element - contains a definition of the symbol, not just another common - declaration of it. - - Unfortunately some archivers (including GNU ar) will put - declarations of common symbols into their archive maps, as - well as real definitions, so we cannot just go by the archive - map alone. Instead we must read in the element's symbol - table and check that to see what kind of symbol definition - this is. */ - if (! elf_link_is_defined_archive_symbol (abfd, symdef)) - continue; - } - else if (h->root.type != bfd_link_hash_undefined) - { - if (h->root.type != bfd_link_hash_undefweak) - defined[i] = true; - continue; - } - - /* We need to include this archive member. */ - element = _bfd_get_elt_at_filepos (abfd, symdef->file_offset); - if (element == (bfd *) NULL) - goto error_return; - - if (! bfd_check_format (element, bfd_object)) - goto error_return; - - /* Doublecheck that we have not included this object - already--it should be impossible, but there may be - something wrong with the archive. */ - if (element->archive_pass != 0) - { - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - element->archive_pass = 1; - - undefs_tail = info->hash->undefs_tail; - - if (! (*info->callbacks->add_archive_element) (info, element, - symdef->name)) - goto error_return; - if (! elf_link_add_object_symbols (element, info)) - goto error_return; - - /* If there are any new undefined symbols, we need to make - another pass through the archive in order to see whether - they can be defined. FIXME: This isn't perfect, because - common symbols wind up on undefs_tail and because an - undefined symbol which is defined later on in this pass - does not require another pass. This isn't a bug, but it - does make the code less efficient than it could be. */ - if (undefs_tail != info->hash->undefs_tail) - loop = true; - - /* Look backward to mark all symbols from this object file - which we have already seen in this pass. */ - mark = i; - do - { - included[mark] = true; - if (mark == 0) - break; - --mark; - } - while (symdefs[mark].file_offset == symdef->file_offset); - - /* We mark subsequent symbols from this object file as we go - on through the loop. */ - last = symdef->file_offset; - } - } - while (loop); - - free (defined); - free (included); - - return true; - - error_return: - if (defined != (boolean *) NULL) - free (defined); - if (included != (boolean *) NULL) - free (included); - return false; -} - -/* This function is called when we want to define a new symbol. It - handles the various cases which arise when we find a definition in - a dynamic object, or when there is already a definition in a - dynamic object. The new symbol is described by NAME, SYM, PSEC, - and PVALUE. We set SYM_HASH to the hash table entry. We set - OVERRIDE if the old symbol is overriding a new definition. We set - TYPE_CHANGE_OK if it is OK for the type to change. We set - SIZE_CHANGE_OK if it is OK for the size to change. By OK to - change, we mean that we shouldn't warn if the type or size does - change. DT_NEEDED indicates if it comes from a DT_NEEDED entry of - a shared object. */ - -static boolean -elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, - override, type_change_ok, size_change_ok, dt_needed) - bfd *abfd; - struct bfd_link_info *info; - const char *name; - Elf_Internal_Sym *sym; - asection **psec; - bfd_vma *pvalue; - struct elf_link_hash_entry **sym_hash; - boolean *override; - boolean *type_change_ok; - boolean *size_change_ok; - boolean dt_needed; -{ - asection *sec; - struct elf_link_hash_entry *h; - int bind; - bfd *oldbfd; - boolean newdyn, olddyn, olddef, newdef, newdyncommon, olddyncommon; - - *override = false; - - sec = *psec; - bind = ELF_ST_BIND (sym->st_info); - - if (! bfd_is_und_section (sec)) - h = elf_link_hash_lookup (elf_hash_table (info), name, true, false, false); - else - h = ((struct elf_link_hash_entry *) - bfd_wrapped_link_hash_lookup (abfd, info, name, true, false, false)); - if (h == NULL) - return false; - *sym_hash = h; - - /* This code is for coping with dynamic objects, and is only useful - if we are doing an ELF link. */ - if (info->hash->creator != abfd->xvec) - return true; - - /* For merging, we only care about real symbols. */ - - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - /* If we just created the symbol, mark it as being an ELF symbol. - Other than that, there is nothing to do--there is no merge issue - with a newly defined symbol--so we just return. */ - - if (h->root.type == bfd_link_hash_new) - { - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; - return true; - } - - /* OLDBFD is a BFD associated with the existing symbol. */ - - switch (h->root.type) - { - default: - oldbfd = NULL; - break; - - case bfd_link_hash_undefined: - case bfd_link_hash_undefweak: - oldbfd = h->root.u.undef.abfd; - break; - - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - oldbfd = h->root.u.def.section->owner; - break; - - case bfd_link_hash_common: - oldbfd = h->root.u.c.p->section->owner; - break; - } - - /* In cases involving weak versioned symbols, we may wind up trying - to merge a symbol with itself. Catch that here, to avoid the - confusion that results if we try to override a symbol with - itself. The additional tests catch cases like - _GLOBAL_OFFSET_TABLE_, which are regular symbols defined in a - dynamic object, which we do want to handle here. */ - if (abfd == oldbfd - && ((abfd->flags & DYNAMIC) == 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) - return true; - - /* NEWDYN and OLDDYN indicate whether the new or old symbol, - respectively, is from a dynamic object. */ - - if ((abfd->flags & DYNAMIC) != 0) - newdyn = true; - else - newdyn = false; - - if (oldbfd != NULL) - olddyn = (oldbfd->flags & DYNAMIC) != 0; - else - { - asection *hsec; - - /* This code handles the special SHN_MIPS_{TEXT,DATA} section - indices used by MIPS ELF. */ - switch (h->root.type) - { - default: - hsec = NULL; - break; - - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - hsec = h->root.u.def.section; - break; - - case bfd_link_hash_common: - hsec = h->root.u.c.p->section; - break; - } - - if (hsec == NULL) - olddyn = false; - else - olddyn = (hsec->symbol->flags & BSF_DYNAMIC) != 0; - } - - /* NEWDEF and OLDDEF indicate whether the new or old symbol, - respectively, appear to be a definition rather than reference. */ - - if (bfd_is_und_section (sec) || bfd_is_com_section (sec)) - newdef = false; - else - newdef = true; - - if (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_common) - olddef = false; - else - olddef = true; - - /* NEWDYNCOMMON and OLDDYNCOMMON indicate whether the new or old - symbol, respectively, appears to be a common symbol in a dynamic - object. If a symbol appears in an uninitialized section, and is - not weak, and is not a function, then it may be a common symbol - which was resolved when the dynamic object was created. We want - to treat such symbols specially, because they raise special - considerations when setting the symbol size: if the symbol - appears as a common symbol in a regular object, and the size in - the regular object is larger, we must make sure that we use the - larger size. This problematic case can always be avoided in C, - but it must be handled correctly when using Fortran shared - libraries. - - Note that if NEWDYNCOMMON is set, NEWDEF will be set, and - likewise for OLDDYNCOMMON and OLDDEF. - - Note that this test is just a heuristic, and that it is quite - possible to have an uninitialized symbol in a shared object which - is really a definition, rather than a common symbol. This could - lead to some minor confusion when the symbol really is a common - symbol in some regular object. However, I think it will be - harmless. */ - - if (newdyn - && newdef - && (sec->flags & SEC_ALLOC) != 0 - && (sec->flags & SEC_LOAD) == 0 - && sym->st_size > 0 - && bind != STB_WEAK - && ELF_ST_TYPE (sym->st_info) != STT_FUNC) - newdyncommon = true; - else - newdyncommon = false; - - if (olddyn - && olddef - && h->root.type == bfd_link_hash_defined - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->root.u.def.section->flags & SEC_ALLOC) != 0 - && (h->root.u.def.section->flags & SEC_LOAD) == 0 - && h->size > 0 - && h->type != STT_FUNC) - olddyncommon = true; - else - olddyncommon = false; - - /* It's OK to change the type if either the existing symbol or the - new symbol is weak unless it comes from a DT_NEEDED entry of - a shared object, in which case, the DT_NEEDED entry may not be - required at the run time. */ - - if ((! dt_needed && h->root.type == bfd_link_hash_defweak) - || h->root.type == bfd_link_hash_undefweak - || bind == STB_WEAK) - *type_change_ok = true; - - /* It's OK to change the size if either the existing symbol or the - new symbol is weak, or if the old symbol is undefined. */ - - if (*type_change_ok - || h->root.type == bfd_link_hash_undefined) - *size_change_ok = true; - - /* If both the old and the new symbols look like common symbols in a - dynamic object, set the size of the symbol to the larger of the - two. */ - - if (olddyncommon - && newdyncommon - && sym->st_size != h->size) - { - /* Since we think we have two common symbols, issue a multiple - common warning if desired. Note that we only warn if the - size is different. If the size is the same, we simply let - the old symbol override the new one as normally happens with - symbols defined in dynamic objects. */ - - if (! ((*info->callbacks->multiple_common) - (info, h->root.root.string, oldbfd, bfd_link_hash_common, - h->size, abfd, bfd_link_hash_common, sym->st_size))) - return false; - - if (sym->st_size > h->size) - h->size = sym->st_size; - - *size_change_ok = true; - } - - /* If we are looking at a dynamic object, and we have found a - definition, we need to see if the symbol was already defined by - some other object. If so, we want to use the existing - definition, and we do not want to report a multiple symbol - definition error; we do this by clobbering *PSEC to be - bfd_und_section_ptr. - - We treat a common symbol as a definition if the symbol in the - shared library is a function, since common symbols always - represent variables; this can cause confusion in principle, but - any such confusion would seem to indicate an erroneous program or - shared library. We also permit a common symbol in a regular - object to override a weak symbol in a shared object. - - We prefer a non-weak definition in a shared library to a weak - definition in the executable unless it comes from a DT_NEEDED - entry of a shared object, in which case, the DT_NEEDED entry - may not be required at the run time. */ - - if (newdyn - && newdef - && (olddef - || (h->root.type == bfd_link_hash_common - && (bind == STB_WEAK - || ELF_ST_TYPE (sym->st_info) == STT_FUNC))) - && (h->root.type != bfd_link_hash_defweak - || dt_needed - || bind == STB_WEAK)) - { - *override = true; - newdef = false; - newdyncommon = false; - - *psec = sec = bfd_und_section_ptr; - *size_change_ok = true; - - /* If we get here when the old symbol is a common symbol, then - we are explicitly letting it override a weak symbol or - function in a dynamic object, and we don't want to warn about - a type change. If the old symbol is a defined symbol, a type - change warning may still be appropriate. */ - - if (h->root.type == bfd_link_hash_common) - *type_change_ok = true; - } - - /* Handle the special case of an old common symbol merging with a - new symbol which looks like a common symbol in a shared object. - We change *PSEC and *PVALUE to make the new symbol look like a - common symbol, and let _bfd_generic_link_add_one_symbol will do - the right thing. */ - - if (newdyncommon - && h->root.type == bfd_link_hash_common) - { - *override = true; - newdef = false; - newdyncommon = false; - *pvalue = sym->st_size; - *psec = sec = bfd_com_section_ptr; - *size_change_ok = true; - } - - /* If the old symbol is from a dynamic object, and the new symbol is - a definition which is not from a dynamic object, then the new - symbol overrides the old symbol. Symbols from regular files - always take precedence over symbols from dynamic objects, even if - they are defined after the dynamic object in the link. - - As above, we again permit a common symbol in a regular object to - override a definition in a shared object if the shared object - symbol is a function or is weak. - - As above, we permit a non-weak definition in a shared object to - override a weak definition in a regular object. */ - - if (! newdyn - && (newdef - || (bfd_is_com_section (sec) - && (h->root.type == bfd_link_hash_defweak - || h->type == STT_FUNC))) - && olddyn - && olddef - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (bind != STB_WEAK - || h->root.type == bfd_link_hash_defweak)) - { - /* Change the hash table entry to undefined, and let - _bfd_generic_link_add_one_symbol do the right thing with the - new definition. */ - - h->root.type = bfd_link_hash_undefined; - h->root.u.undef.abfd = h->root.u.def.section->owner; - *size_change_ok = true; - - olddef = false; - olddyncommon = false; - - /* We again permit a type change when a common symbol may be - overriding a function. */ - - if (bfd_is_com_section (sec)) - *type_change_ok = true; - - /* This union may have been set to be non-NULL when this symbol - was seen in a dynamic object. We must force the union to be - NULL, so that it is correct for a regular symbol. */ - - h->verinfo.vertree = NULL; - - /* In this special case, if H is the target of an indirection, - we want the caller to frob with H rather than with the - indirect symbol. That will permit the caller to redefine the - target of the indirection, rather than the indirect symbol - itself. FIXME: This will break the -y option if we store a - symbol with a different name. */ - *sym_hash = h; - } - - /* Handle the special case of a new common symbol merging with an - old symbol that looks like it might be a common symbol defined in - a shared object. Note that we have already handled the case in - which a new common symbol should simply override the definition - in the shared library. */ - - if (! newdyn - && bfd_is_com_section (sec) - && olddyncommon) - { - /* It would be best if we could set the hash table entry to a - common symbol, but we don't know what to use for the section - or the alignment. */ - if (! ((*info->callbacks->multiple_common) - (info, h->root.root.string, oldbfd, bfd_link_hash_common, - h->size, abfd, bfd_link_hash_common, sym->st_size))) - return false; - - /* If the predumed common symbol in the dynamic object is - larger, pretend that the new symbol has its size. */ - - if (h->size > *pvalue) - *pvalue = h->size; - - /* FIXME: We no longer know the alignment required by the symbol - in the dynamic object, so we just wind up using the one from - the regular object. */ - - olddef = false; - olddyncommon = false; - - h->root.type = bfd_link_hash_undefined; - h->root.u.undef.abfd = h->root.u.def.section->owner; - - *size_change_ok = true; - *type_change_ok = true; - - h->verinfo.vertree = NULL; - } - - /* Handle the special case of a weak definition in a regular object - followed by a non-weak definition in a shared object. In this - case, we prefer the definition in the shared object unless it - comes from a DT_NEEDED entry of a shared object, in which case, - the DT_NEEDED entry may not be required at the run time. */ - if (olddef - && ! dt_needed - && h->root.type == bfd_link_hash_defweak - && newdef - && newdyn - && bind != STB_WEAK) - { - /* To make this work we have to frob the flags so that the rest - of the code does not think we are using the regular - definition. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) - h->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR; - else if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0) - h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC; - h->elf_link_hash_flags &= ~ (ELF_LINK_HASH_DEF_REGULAR - | ELF_LINK_HASH_DEF_DYNAMIC); - - /* If H is the target of an indirection, we want the caller to - use H rather than the indirect symbol. Otherwise if we are - defining a new indirect symbol we will wind up attaching it - to the entry we are overriding. */ - *sym_hash = h; - } - - /* Handle the special case of a non-weak definition in a shared - object followed by a weak definition in a regular object. In - this case we prefer to definition in the shared object. To make - this work we have to tell the caller to not treat the new symbol - as a definition. */ - if (olddef - && olddyn - && h->root.type != bfd_link_hash_defweak - && newdef - && ! newdyn - && bind == STB_WEAK) - *override = true; - - return true; -} - -/* This function is called to create an indirect symbol from the - default for the symbol with the default version if needed. The - symbol is described by H, NAME, SYM, PSEC, VALUE, and OVERRIDE. We - set DYNSYM if the new indirect symbol is dynamic. DT_NEEDED - indicates if it comes from a DT_NEEDED entry of a shared object. */ - -static boolean -elf_add_default_symbol (abfd, info, h, name, sym, psec, value, - dynsym, override, dt_needed) - bfd *abfd; - struct bfd_link_info *info; - struct elf_link_hash_entry *h; - const char *name; - Elf_Internal_Sym *sym; - asection **psec; - bfd_vma *value; - boolean *dynsym; - boolean override; - boolean dt_needed; -{ - boolean type_change_ok; - boolean size_change_ok; - char *shortname; - struct elf_link_hash_entry *hi; - struct bfd_link_hash_entry *bh; - struct elf_backend_data *bed; - boolean collect; - boolean dynamic; - char *p; - size_t len, shortlen; - asection *sec; - - /* If this symbol has a version, and it is the default version, we - create an indirect symbol from the default name to the fully - decorated name. This will cause external references which do not - specify a version to be bound to this version of the symbol. */ - p = strchr (name, ELF_VER_CHR); - if (p == NULL || p[1] != ELF_VER_CHR) - return true; - - if (override) - { - /* We are overridden by an old defition. We need to check if we - need to create the indirect symbol from the default name. */ - hi = elf_link_hash_lookup (elf_hash_table (info), name, true, - false, false); - BFD_ASSERT (hi != NULL); - if (hi == h) - return true; - while (hi->root.type == bfd_link_hash_indirect - || hi->root.type == bfd_link_hash_warning) - { - hi = (struct elf_link_hash_entry *) hi->root.u.i.link; - if (hi == h) - return true; - } - } - - bed = get_elf_backend_data (abfd); - collect = bed->collect; - dynamic = (abfd->flags & DYNAMIC) != 0; - - shortlen = p - name; - shortname = bfd_hash_allocate (&info->hash->table, shortlen + 1); - if (shortname == NULL) - return false; - memcpy (shortname, name, shortlen); - shortname[shortlen] = '\0'; - - /* We are going to create a new symbol. Merge it with any existing - symbol with this name. For the purposes of the merge, act as - though we were defining the symbol we just defined, although we - actually going to define an indirect symbol. */ - type_change_ok = false; - size_change_ok = false; - sec = *psec; - if (! elf_merge_symbol (abfd, info, shortname, sym, &sec, value, - &hi, &override, &type_change_ok, - &size_change_ok, dt_needed)) - return false; - - if (! override) - { - bh = &hi->root; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, shortname, BSF_INDIRECT, bfd_ind_section_ptr, - (bfd_vma) 0, name, false, collect, &bh))) - return false; - hi = (struct elf_link_hash_entry *) bh; - } - else - { - /* In this case the symbol named SHORTNAME is overriding the - indirect symbol we want to add. We were planning on making - SHORTNAME an indirect symbol referring to NAME. SHORTNAME - is the name without a version. NAME is the fully versioned - name, and it is the default version. - - Overriding means that we already saw a definition for the - symbol SHORTNAME in a regular object, and it is overriding - the symbol defined in the dynamic object. - - When this happens, we actually want to change NAME, the - symbol we just added, to refer to SHORTNAME. This will cause - references to NAME in the shared object to become references - to SHORTNAME in the regular object. This is what we expect - when we override a function in a shared object: that the - references in the shared object will be mapped to the - definition in the regular object. */ - - while (hi->root.type == bfd_link_hash_indirect - || hi->root.type == bfd_link_hash_warning) - hi = (struct elf_link_hash_entry *) hi->root.u.i.link; - - h->root.type = bfd_link_hash_indirect; - h->root.u.i.link = (struct bfd_link_hash_entry *) hi; - if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) - { - h->elf_link_hash_flags &=~ ELF_LINK_HASH_DEF_DYNAMIC; - hi->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC; - if (hi->elf_link_hash_flags - & (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_DEF_REGULAR)) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, hi)) - return false; - } - } - - /* Now set HI to H, so that the following code will set the - other fields correctly. */ - hi = h; - } - - /* If there is a duplicate definition somewhere, then HI may not - point to an indirect symbol. We will have reported an error to - the user in that case. */ - - if (hi->root.type == bfd_link_hash_indirect) - { - struct elf_link_hash_entry *ht; - - /* If the symbol became indirect, then we assume that we have - not seen a definition before. */ - BFD_ASSERT ((hi->elf_link_hash_flags - & (ELF_LINK_HASH_DEF_DYNAMIC - | ELF_LINK_HASH_DEF_REGULAR)) == 0); - - ht = (struct elf_link_hash_entry *) hi->root.u.i.link; - (*bed->elf_backend_copy_indirect_symbol) (bed, ht, hi); - - /* See if the new flags lead us to realize that the symbol must - be dynamic. */ - if (! *dynsym) - { - if (! dynamic) - { - if (info->shared - || ((hi->elf_link_hash_flags - & ELF_LINK_HASH_REF_DYNAMIC) != 0)) - *dynsym = true; - } - else - { - if ((hi->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0) - *dynsym = true; - } - } - } - - /* We also need to define an indirection from the nondefault version - of the symbol. */ - - len = strlen (name); - shortname = bfd_hash_allocate (&info->hash->table, len); - if (shortname == NULL) - return false; - memcpy (shortname, name, shortlen); - memcpy (shortname + shortlen, p + 1, len - shortlen); - - /* Once again, merge with any existing symbol. */ - type_change_ok = false; - size_change_ok = false; - sec = *psec; - if (! elf_merge_symbol (abfd, info, shortname, sym, &sec, value, - &hi, &override, &type_change_ok, - &size_change_ok, dt_needed)) - return false; - - if (override) - { - /* Here SHORTNAME is a versioned name, so we don't expect to see - the type of override we do in the case above unless it is - overridden by a versioned definiton. */ - if (hi->root.type != bfd_link_hash_defined - && hi->root.type != bfd_link_hash_defweak) - (*_bfd_error_handler) - (_("%s: warning: unexpected redefinition of indirect versioned symbol `%s'"), - bfd_archive_filename (abfd), shortname); - } - else - { - bh = &hi->root; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, shortname, BSF_INDIRECT, - bfd_ind_section_ptr, (bfd_vma) 0, name, false, collect, &bh))) - return false; - hi = (struct elf_link_hash_entry *) bh; - - /* If there is a duplicate definition somewhere, then HI may not - point to an indirect symbol. We will have reported an error - to the user in that case. */ - - if (hi->root.type == bfd_link_hash_indirect) - { - /* If the symbol became indirect, then we assume that we have - not seen a definition before. */ - BFD_ASSERT ((hi->elf_link_hash_flags - & (ELF_LINK_HASH_DEF_DYNAMIC - | ELF_LINK_HASH_DEF_REGULAR)) == 0); - - (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi); - - /* See if the new flags lead us to realize that the symbol - must be dynamic. */ - if (! *dynsym) - { - if (! dynamic) - { - if (info->shared - || ((hi->elf_link_hash_flags - & ELF_LINK_HASH_REF_DYNAMIC) != 0)) - *dynsym = true; - } - else - { - if ((hi->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0) - *dynsym = true; - } - } - } - } - - return true; -} - -/* Add symbols from an ELF object file to the linker hash table. */ - -static boolean -elf_link_add_object_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - boolean (*add_symbol_hook) PARAMS ((bfd *, struct bfd_link_info *, - const Elf_Internal_Sym *, - const char **, flagword *, - asection **, bfd_vma *)); - boolean (*check_relocs) PARAMS ((bfd *, struct bfd_link_info *, - asection *, const Elf_Internal_Rela *)); - boolean collect; - Elf_Internal_Shdr *hdr; - bfd_size_type symcount; - bfd_size_type extsymcount; - bfd_size_type extsymoff; - struct elf_link_hash_entry **sym_hash; - boolean dynamic; - Elf_External_Versym *extversym = NULL; - Elf_External_Versym *ever; - struct elf_link_hash_entry *weaks; - Elf_Internal_Sym *isymbuf = NULL; - Elf_Internal_Sym *isym; - Elf_Internal_Sym *isymend; - struct elf_backend_data *bed; - boolean dt_needed; - struct elf_link_hash_table * hash_table; - bfd_size_type amt; - - hash_table = elf_hash_table (info); - - bed = get_elf_backend_data (abfd); - add_symbol_hook = bed->elf_add_symbol_hook; - collect = bed->collect; - - if ((abfd->flags & DYNAMIC) == 0) - dynamic = false; - else - { - dynamic = true; - - /* You can't use -r against a dynamic object. Also, there's no - hope of using a dynamic object which does not exactly match - the format of the output file. */ - if (info->relocateable || info->hash->creator != abfd->xvec) - { - bfd_set_error (bfd_error_invalid_operation); - goto error_return; - } - } - - /* As a GNU extension, any input sections which are named - .gnu.warning.SYMBOL are treated as warning symbols for the given - symbol. This differs from .gnu.warning sections, which generate - warnings when they are included in an output file. */ - if (! info->shared) - { - asection *s; - - for (s = abfd->sections; s != NULL; s = s->next) - { - const char *name; - - name = bfd_get_section_name (abfd, s); - if (strncmp (name, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0) - { - char *msg; - bfd_size_type sz; - - name += sizeof ".gnu.warning." - 1; - - /* If this is a shared object, then look up the symbol - in the hash table. If it is there, and it is already - been defined, then we will not be using the entry - from this shared object, so we don't need to warn. - FIXME: If we see the definition in a regular object - later on, we will warn, but we shouldn't. The only - fix is to keep track of what warnings we are supposed - to emit, and then handle them all at the end of the - link. */ - if (dynamic && abfd->xvec == info->hash->creator) - { - struct elf_link_hash_entry *h; - - h = elf_link_hash_lookup (hash_table, name, - false, false, true); - - /* FIXME: What about bfd_link_hash_common? */ - if (h != NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) - { - /* We don't want to issue this warning. Clobber - the section size so that the warning does not - get copied into the output file. */ - s->_raw_size = 0; - continue; - } - } - - sz = bfd_section_size (abfd, s); - msg = (char *) bfd_alloc (abfd, sz + 1); - if (msg == NULL) - goto error_return; - - if (! bfd_get_section_contents (abfd, s, msg, (file_ptr) 0, sz)) - goto error_return; - - msg[sz] = '\0'; - - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, name, BSF_WARNING, s, (bfd_vma) 0, msg, - false, collect, (struct bfd_link_hash_entry **) NULL))) - goto error_return; - - if (! info->relocateable) - { - /* Clobber the section size so that the warning does - not get copied into the output file. */ - s->_raw_size = 0; - } - } - } - } - - dt_needed = false; - if (! dynamic) - { - /* If we are creating a shared library, create all the dynamic - sections immediately. We need to attach them to something, - so we attach them to this BFD, provided it is the right - format. FIXME: If there are no input BFD's of the same - format as the output, we can't make a shared library. */ - if (info->shared - && is_elf_hash_table (info) - && ! hash_table->dynamic_sections_created - && abfd->xvec == info->hash->creator) - { - if (! elf_link_create_dynamic_sections (abfd, info)) - goto error_return; - } - } - else if (! is_elf_hash_table (info)) - goto error_return; - else - { - asection *s; - boolean add_needed; - const char *name; - bfd_size_type oldsize; - bfd_size_type strindex; - struct bfd_link_needed_list *rpath = NULL, *runpath = NULL; - - /* ld --just-symbols and dynamic objects don't mix very well. - Test for --just-symbols by looking at info set up by - _bfd_elf_link_just_syms. */ - if ((s = abfd->sections) != NULL - && elf_section_data (s)->sec_info_type == ELF_INFO_TYPE_JUST_SYMS) - goto error_return; - - /* Find the name to use in a DT_NEEDED entry that refers to this - object. If the object has a DT_SONAME entry, we use it. - Otherwise, if the generic linker stuck something in - elf_dt_name, we use that. Otherwise, we just use the file - name. If the generic linker put a null string into - elf_dt_name, we don't make a DT_NEEDED entry at all, even if - there is a DT_SONAME entry. */ - add_needed = true; - name = bfd_get_filename (abfd); - if (elf_dt_name (abfd) != NULL) - { - name = elf_dt_name (abfd); - if (*name == '\0') - { - if (elf_dt_soname (abfd) != NULL) - dt_needed = true; - - add_needed = false; - } - } - s = bfd_get_section_by_name (abfd, ".dynamic"); - if (s != NULL) - { - Elf_External_Dyn *dynbuf = NULL; - Elf_External_Dyn *extdyn; - Elf_External_Dyn *extdynend; - int elfsec; - unsigned long shlink; - - dynbuf = (Elf_External_Dyn *) bfd_malloc (s->_raw_size); - if (dynbuf == NULL) - goto error_return; - - if (! bfd_get_section_contents (abfd, s, (PTR) dynbuf, - (file_ptr) 0, s->_raw_size)) - goto error_free_dyn; - - elfsec = _bfd_elf_section_from_bfd_section (abfd, s); - if (elfsec == -1) - goto error_free_dyn; - shlink = elf_elfsections (abfd)[elfsec]->sh_link; - - extdyn = dynbuf; - extdynend = extdyn + s->_raw_size / sizeof (Elf_External_Dyn); - for (; extdyn < extdynend; extdyn++) - { - Elf_Internal_Dyn dyn; - - elf_swap_dyn_in (abfd, extdyn, &dyn); - if (dyn.d_tag == DT_SONAME) - { - unsigned int tagv = dyn.d_un.d_val; - name = bfd_elf_string_from_elf_section (abfd, shlink, tagv); - if (name == NULL) - goto error_free_dyn; - } - if (dyn.d_tag == DT_NEEDED) - { - struct bfd_link_needed_list *n, **pn; - char *fnm, *anm; - unsigned int tagv = dyn.d_un.d_val; - - amt = sizeof (struct bfd_link_needed_list); - n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt); - fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv); - if (n == NULL || fnm == NULL) - goto error_free_dyn; - amt = strlen (fnm) + 1; - anm = bfd_alloc (abfd, amt); - if (anm == NULL) - goto error_free_dyn; - memcpy (anm, fnm, (size_t) amt); - n->name = anm; - n->by = abfd; - n->next = NULL; - for (pn = & hash_table->needed; - *pn != NULL; - pn = &(*pn)->next) - ; - *pn = n; - } - if (dyn.d_tag == DT_RUNPATH) - { - struct bfd_link_needed_list *n, **pn; - char *fnm, *anm; - unsigned int tagv = dyn.d_un.d_val; - - amt = sizeof (struct bfd_link_needed_list); - n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt); - fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv); - if (n == NULL || fnm == NULL) - goto error_free_dyn; - amt = strlen (fnm) + 1; - anm = bfd_alloc (abfd, amt); - if (anm == NULL) - goto error_free_dyn; - memcpy (anm, fnm, (size_t) amt); - n->name = anm; - n->by = abfd; - n->next = NULL; - for (pn = & runpath; - *pn != NULL; - pn = &(*pn)->next) - ; - *pn = n; - } - /* Ignore DT_RPATH if we have seen DT_RUNPATH. */ - if (!runpath && dyn.d_tag == DT_RPATH) - { - struct bfd_link_needed_list *n, **pn; - char *fnm, *anm; - unsigned int tagv = dyn.d_un.d_val; - - amt = sizeof (struct bfd_link_needed_list); - n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt); - fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv); - if (n == NULL || fnm == NULL) - goto error_free_dyn; - amt = strlen (fnm) + 1; - anm = bfd_alloc (abfd, amt); - if (anm == NULL) - { - error_free_dyn: - free (dynbuf); - goto error_return; - } - memcpy (anm, fnm, (size_t) amt); - n->name = anm; - n->by = abfd; - n->next = NULL; - for (pn = & rpath; - *pn != NULL; - pn = &(*pn)->next) - ; - *pn = n; - } - } - - free (dynbuf); - } - - /* DT_RUNPATH overrides DT_RPATH. Do _NOT_ bfd_release, as that - frees all more recently bfd_alloc'd blocks as well. */ - if (runpath) - rpath = runpath; - - if (rpath) - { - struct bfd_link_needed_list **pn; - for (pn = & hash_table->runpath; - *pn != NULL; - pn = &(*pn)->next) - ; - *pn = rpath; - } - - /* We do not want to include any of the sections in a dynamic - object in the output file. We hack by simply clobbering the - list of sections in the BFD. This could be handled more - cleanly by, say, a new section flag; the existing - SEC_NEVER_LOAD flag is not the one we want, because that one - still implies that the section takes up space in the output - file. */ - bfd_section_list_clear (abfd); - - /* If this is the first dynamic object found in the link, create - the special sections required for dynamic linking. */ - if (! hash_table->dynamic_sections_created) - if (! elf_link_create_dynamic_sections (abfd, info)) - goto error_return; - - if (add_needed) - { - /* Add a DT_NEEDED entry for this dynamic object. */ - oldsize = _bfd_elf_strtab_size (hash_table->dynstr); - strindex = _bfd_elf_strtab_add (hash_table->dynstr, name, false); - if (strindex == (bfd_size_type) -1) - goto error_return; - - if (oldsize == _bfd_elf_strtab_size (hash_table->dynstr)) - { - asection *sdyn; - Elf_External_Dyn *dyncon, *dynconend; - - /* The hash table size did not change, which means that - the dynamic object name was already entered. If we - have already included this dynamic object in the - link, just ignore it. There is no reason to include - a particular dynamic object more than once. */ - sdyn = bfd_get_section_by_name (hash_table->dynobj, ".dynamic"); - BFD_ASSERT (sdyn != NULL); - - dyncon = (Elf_External_Dyn *) sdyn->contents; - dynconend = (Elf_External_Dyn *) (sdyn->contents + - sdyn->_raw_size); - for (; dyncon < dynconend; dyncon++) - { - Elf_Internal_Dyn dyn; - - elf_swap_dyn_in (hash_table->dynobj, dyncon, & dyn); - if (dyn.d_tag == DT_NEEDED - && dyn.d_un.d_val == strindex) - { - _bfd_elf_strtab_delref (hash_table->dynstr, strindex); - return true; - } - } - } - - if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NEEDED, strindex)) - goto error_return; - } - - /* Save the SONAME, if there is one, because sometimes the - linker emulation code will need to know it. */ - if (*name == '\0') - name = basename (bfd_get_filename (abfd)); - elf_dt_name (abfd) = name; - } - - /* If this is a dynamic object, we always link against the .dynsym - symbol table, not the .symtab symbol table. The dynamic linker - will only see the .dynsym symbol table, so there is no reason to - look at .symtab for a dynamic object. */ - - if (! dynamic || elf_dynsymtab (abfd) == 0) - hdr = &elf_tdata (abfd)->symtab_hdr; - else - hdr = &elf_tdata (abfd)->dynsymtab_hdr; - - symcount = hdr->sh_size / sizeof (Elf_External_Sym); - - /* The sh_info field of the symtab header tells us where the - external symbols start. We don't care about the local symbols at - this point. */ - if (elf_bad_symtab (abfd)) - { - extsymcount = symcount; - extsymoff = 0; - } - else - { - extsymcount = symcount - hdr->sh_info; - extsymoff = hdr->sh_info; - } - - sym_hash = NULL; - if (extsymcount != 0) - { - isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff, - NULL, NULL, NULL); - if (isymbuf == NULL) - goto error_return; - - /* We store a pointer to the hash table entry for each external - symbol. */ - amt = extsymcount * sizeof (struct elf_link_hash_entry *); - sym_hash = (struct elf_link_hash_entry **) bfd_alloc (abfd, amt); - if (sym_hash == NULL) - goto error_free_sym; - elf_sym_hashes (abfd) = sym_hash; - } - - if (dynamic) - { - /* Read in any version definitions. */ - if (! _bfd_elf_slurp_version_tables (abfd)) - goto error_free_sym; - - /* Read in the symbol versions, but don't bother to convert them - to internal format. */ - if (elf_dynversym (abfd) != 0) - { - Elf_Internal_Shdr *versymhdr; - - versymhdr = &elf_tdata (abfd)->dynversym_hdr; - extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size); - if (extversym == NULL) - goto error_free_sym; - amt = versymhdr->sh_size; - if (bfd_seek (abfd, versymhdr->sh_offset, SEEK_SET) != 0 - || bfd_bread ((PTR) extversym, amt, abfd) != amt) - goto error_free_vers; - } - } - - weaks = NULL; - - ever = extversym != NULL ? extversym + extsymoff : NULL; - for (isym = isymbuf, isymend = isymbuf + extsymcount; - isym < isymend; - isym++, sym_hash++, ever = (ever != NULL ? ever + 1 : NULL)) - { - int bind; - bfd_vma value; - asection *sec; - flagword flags; - const char *name; - struct elf_link_hash_entry *h; - boolean definition; - boolean size_change_ok, type_change_ok; - boolean new_weakdef; - unsigned int old_alignment; - boolean override; - - override = false; - - flags = BSF_NO_FLAGS; - sec = NULL; - value = isym->st_value; - *sym_hash = NULL; - - bind = ELF_ST_BIND (isym->st_info); - if (bind == STB_LOCAL) - { - /* This should be impossible, since ELF requires that all - global symbols follow all local symbols, and that sh_info - point to the first global symbol. Unfortunatealy, Irix 5 - screws this up. */ - continue; - } - else if (bind == STB_GLOBAL) - { - if (isym->st_shndx != SHN_UNDEF - && isym->st_shndx != SHN_COMMON) - flags = BSF_GLOBAL; - } - else if (bind == STB_WEAK) - flags = BSF_WEAK; - else - { - /* Leave it up to the processor backend. */ - } - - if (isym->st_shndx == SHN_UNDEF) - sec = bfd_und_section_ptr; - else if (isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE) - { - sec = section_from_elf_index (abfd, isym->st_shndx); - if (sec == NULL) - sec = bfd_abs_section_ptr; - else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0) - value -= sec->vma; - } - else if (isym->st_shndx == SHN_ABS) - sec = bfd_abs_section_ptr; - else if (isym->st_shndx == SHN_COMMON) - { - sec = bfd_com_section_ptr; - /* What ELF calls the size we call the value. What ELF - calls the value we call the alignment. */ - value = isym->st_size; - } - else - { - /* Leave it up to the processor backend. */ - } - - name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link, - isym->st_name); - if (name == (const char *) NULL) - goto error_free_vers; - - if (isym->st_shndx == SHN_COMMON - && ELF_ST_TYPE (isym->st_info) == STT_TLS) - { - asection *tcomm = bfd_get_section_by_name (abfd, ".tcommon"); - - if (tcomm == NULL) - { - tcomm = bfd_make_section (abfd, ".tcommon"); - if (tcomm == NULL - || !bfd_set_section_flags (abfd, tcomm, (SEC_ALLOC - | SEC_IS_COMMON - | SEC_LINKER_CREATED - | SEC_THREAD_LOCAL))) - goto error_free_vers; - } - sec = tcomm; - } - else if (add_symbol_hook) - { - if (! (*add_symbol_hook) (abfd, info, isym, &name, &flags, &sec, - &value)) - goto error_free_vers; - - /* The hook function sets the name to NULL if this symbol - should be skipped for some reason. */ - if (name == (const char *) NULL) - continue; - } - - /* Sanity check that all possibilities were handled. */ - if (sec == (asection *) NULL) - { - bfd_set_error (bfd_error_bad_value); - goto error_free_vers; - } - - if (bfd_is_und_section (sec) - || bfd_is_com_section (sec)) - definition = false; - else - definition = true; - - size_change_ok = false; - type_change_ok = get_elf_backend_data (abfd)->type_change_ok; - old_alignment = 0; - if (info->hash->creator->flavour == bfd_target_elf_flavour) - { - Elf_Internal_Versym iver; - unsigned int vernum = 0; - - if (ever != NULL) - { - _bfd_elf_swap_versym_in (abfd, ever, &iver); - vernum = iver.vs_vers & VERSYM_VERSION; - - /* If this is a hidden symbol, or if it is not version - 1, we append the version name to the symbol name. - However, we do not modify a non-hidden absolute - symbol, because it might be the version symbol - itself. FIXME: What if it isn't? */ - if ((iver.vs_vers & VERSYM_HIDDEN) != 0 - || (vernum > 1 && ! bfd_is_abs_section (sec))) - { - const char *verstr; - size_t namelen, verlen, newlen; - char *newname, *p; - - if (isym->st_shndx != SHN_UNDEF) - { - if (vernum > elf_tdata (abfd)->dynverdef_hdr.sh_info) - { - (*_bfd_error_handler) - (_("%s: %s: invalid version %u (max %d)"), - bfd_archive_filename (abfd), name, vernum, - elf_tdata (abfd)->dynverdef_hdr.sh_info); - bfd_set_error (bfd_error_bad_value); - goto error_free_vers; - } - else if (vernum > 1) - verstr = - elf_tdata (abfd)->verdef[vernum - 1].vd_nodename; - else - verstr = ""; - } - else - { - /* We cannot simply test for the number of - entries in the VERNEED section since the - numbers for the needed versions do not start - at 0. */ - Elf_Internal_Verneed *t; - - verstr = NULL; - for (t = elf_tdata (abfd)->verref; - t != NULL; - t = t->vn_nextref) - { - Elf_Internal_Vernaux *a; - - for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) - { - if (a->vna_other == vernum) - { - verstr = a->vna_nodename; - break; - } - } - if (a != NULL) - break; - } - if (verstr == NULL) - { - (*_bfd_error_handler) - (_("%s: %s: invalid needed version %d"), - bfd_archive_filename (abfd), name, vernum); - bfd_set_error (bfd_error_bad_value); - goto error_free_vers; - } - } - - namelen = strlen (name); - verlen = strlen (verstr); - newlen = namelen + verlen + 2; - if ((iver.vs_vers & VERSYM_HIDDEN) == 0 - && isym->st_shndx != SHN_UNDEF) - ++newlen; - - newname = (char *) bfd_alloc (abfd, (bfd_size_type) newlen); - if (newname == NULL) - goto error_free_vers; - memcpy (newname, name, namelen); - p = newname + namelen; - *p++ = ELF_VER_CHR; - /* If this is a defined non-hidden version symbol, - we add another @ to the name. This indicates the - default version of the symbol. */ - if ((iver.vs_vers & VERSYM_HIDDEN) == 0 - && isym->st_shndx != SHN_UNDEF) - *p++ = ELF_VER_CHR; - memcpy (p, verstr, verlen + 1); - - name = newname; - } - } - - if (! elf_merge_symbol (abfd, info, name, isym, &sec, &value, - sym_hash, &override, &type_change_ok, - &size_change_ok, dt_needed)) - goto error_free_vers; - - if (override) - definition = false; - - h = *sym_hash; - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - /* Remember the old alignment if this is a common symbol, so - that we don't reduce the alignment later on. We can't - check later, because _bfd_generic_link_add_one_symbol - will set a default for the alignment which we want to - override. */ - if (h->root.type == bfd_link_hash_common) - old_alignment = h->root.u.c.p->alignment_power; - - if (elf_tdata (abfd)->verdef != NULL - && ! override - && vernum > 1 - && definition) - h->verinfo.verdef = &elf_tdata (abfd)->verdef[vernum - 1]; - } - - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, name, flags, sec, value, (const char *) NULL, - false, collect, (struct bfd_link_hash_entry **) sym_hash))) - goto error_free_vers; - - h = *sym_hash; - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - *sym_hash = h; - - new_weakdef = false; - if (dynamic - && definition - && (flags & BSF_WEAK) != 0 - && ELF_ST_TYPE (isym->st_info) != STT_FUNC - && info->hash->creator->flavour == bfd_target_elf_flavour - && h->weakdef == NULL) - { - /* Keep a list of all weak defined non function symbols from - a dynamic object, using the weakdef field. Later in this - function we will set the weakdef field to the correct - value. We only put non-function symbols from dynamic - objects on this list, because that happens to be the only - time we need to know the normal symbol corresponding to a - weak symbol, and the information is time consuming to - figure out. If the weakdef field is not already NULL, - then this symbol was already defined by some previous - dynamic object, and we will be using that previous - definition anyhow. */ - - h->weakdef = weaks; - weaks = h; - new_weakdef = true; - } - - /* Set the alignment of a common symbol. */ - if (isym->st_shndx == SHN_COMMON - && h->root.type == bfd_link_hash_common) - { - unsigned int align; - - align = bfd_log2 (isym->st_value); - if (align > old_alignment - /* Permit an alignment power of zero if an alignment of one - is specified and no other alignments have been specified. */ - || (isym->st_value == 1 && old_alignment == 0)) - h->root.u.c.p->alignment_power = align; - } - - if (info->hash->creator->flavour == bfd_target_elf_flavour) - { - int old_flags; - boolean dynsym; - int new_flag; - - /* Remember the symbol size and type. */ - if (isym->st_size != 0 - && (definition || h->size == 0)) - { - if (h->size != 0 && h->size != isym->st_size && ! size_change_ok) - (*_bfd_error_handler) - (_("Warning: size of symbol `%s' changed from %lu to %lu in %s"), - name, (unsigned long) h->size, - (unsigned long) isym->st_size, bfd_archive_filename (abfd)); - - h->size = isym->st_size; - } - - /* If this is a common symbol, then we always want H->SIZE - to be the size of the common symbol. The code just above - won't fix the size if a common symbol becomes larger. We - don't warn about a size change here, because that is - covered by --warn-common. */ - if (h->root.type == bfd_link_hash_common) - h->size = h->root.u.c.size; - - if (ELF_ST_TYPE (isym->st_info) != STT_NOTYPE - && (definition || h->type == STT_NOTYPE)) - { - if (h->type != STT_NOTYPE - && h->type != ELF_ST_TYPE (isym->st_info) - && ! type_change_ok) - (*_bfd_error_handler) - (_("Warning: type of symbol `%s' changed from %d to %d in %s"), - name, h->type, ELF_ST_TYPE (isym->st_info), - bfd_archive_filename (abfd)); - - h->type = ELF_ST_TYPE (isym->st_info); - } - - /* If st_other has a processor-specific meaning, specific code - might be needed here. */ - if (isym->st_other != 0) - { - unsigned char hvis, symvis, other; - - /* Take the balance of OTHER from the definition. */ - other = (definition ? isym->st_other : h->other); - other &= ~ ELF_ST_VISIBILITY (-1); - - /* Combine visibilities, using the most constraining one. */ - hvis = ELF_ST_VISIBILITY (h->other); - symvis = ELF_ST_VISIBILITY (isym->st_other); - - h->other = other | (hvis > symvis ? hvis : symvis); - } - - /* Set a flag in the hash table entry indicating the type of - reference or definition we just found. Keep a count of - the number of dynamic symbols we find. A dynamic symbol - is one which is referenced or defined by both a regular - object and a shared object. */ - old_flags = h->elf_link_hash_flags; - dynsym = false; - if (! dynamic) - { - if (! definition) - { - new_flag = ELF_LINK_HASH_REF_REGULAR; - if (bind != STB_WEAK) - new_flag |= ELF_LINK_HASH_REF_REGULAR_NONWEAK; - } - else - new_flag = ELF_LINK_HASH_DEF_REGULAR; - if (info->shared - || (old_flags & (ELF_LINK_HASH_DEF_DYNAMIC - | ELF_LINK_HASH_REF_DYNAMIC)) != 0) - dynsym = true; - } - else - { - if (! definition) - new_flag = ELF_LINK_HASH_REF_DYNAMIC; - else - new_flag = ELF_LINK_HASH_DEF_DYNAMIC; - if ((old_flags & (ELF_LINK_HASH_DEF_REGULAR - | ELF_LINK_HASH_REF_REGULAR)) != 0 - || (h->weakdef != NULL - && ! new_weakdef - && h->weakdef->dynindx != -1)) - dynsym = true; - } - - h->elf_link_hash_flags |= new_flag; - - /* Check to see if we need to add an indirect symbol for - the default name. */ - if (definition || h->root.type == bfd_link_hash_common) - if (! elf_add_default_symbol (abfd, info, h, name, isym, - &sec, &value, &dynsym, - override, dt_needed)) - goto error_free_vers; - - if (dynsym && h->dynindx == -1) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, h)) - goto error_free_vers; - if (h->weakdef != NULL - && ! new_weakdef - && h->weakdef->dynindx == -1) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, h->weakdef)) - goto error_free_vers; - } - } - else if (dynsym && h->dynindx != -1) - /* If the symbol already has a dynamic index, but - visibility says it should not be visible, turn it into - a local symbol. */ - switch (ELF_ST_VISIBILITY (h->other)) - { - case STV_INTERNAL: - case STV_HIDDEN: - (*bed->elf_backend_hide_symbol) (info, h, true); - break; - } - - if (dt_needed && definition - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0) - { - bfd_size_type oldsize; - bfd_size_type strindex; - - if (! is_elf_hash_table (info)) - goto error_free_vers; - - /* The symbol from a DT_NEEDED object is referenced from - the regular object to create a dynamic executable. We - have to make sure there is a DT_NEEDED entry for it. */ - - dt_needed = false; - oldsize = _bfd_elf_strtab_size (hash_table->dynstr); - strindex = _bfd_elf_strtab_add (hash_table->dynstr, - elf_dt_soname (abfd), false); - if (strindex == (bfd_size_type) -1) - goto error_free_vers; - - if (oldsize == _bfd_elf_strtab_size (hash_table->dynstr)) - { - asection *sdyn; - Elf_External_Dyn *dyncon, *dynconend; - - sdyn = bfd_get_section_by_name (hash_table->dynobj, - ".dynamic"); - BFD_ASSERT (sdyn != NULL); - - dyncon = (Elf_External_Dyn *) sdyn->contents; - dynconend = (Elf_External_Dyn *) (sdyn->contents + - sdyn->_raw_size); - for (; dyncon < dynconend; dyncon++) - { - Elf_Internal_Dyn dyn; - - elf_swap_dyn_in (hash_table->dynobj, - dyncon, &dyn); - BFD_ASSERT (dyn.d_tag != DT_NEEDED || - dyn.d_un.d_val != strindex); - } - } - - if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NEEDED, strindex)) - goto error_free_vers; - } - } - } - - if (extversym != NULL) - { - free (extversym); - extversym = NULL; - } - - if (isymbuf != NULL) - free (isymbuf); - isymbuf = NULL; - - /* Now set the weakdefs field correctly for all the weak defined - symbols we found. The only way to do this is to search all the - symbols. Since we only need the information for non functions in - dynamic objects, that's the only time we actually put anything on - the list WEAKS. We need this information so that if a regular - object refers to a symbol defined weakly in a dynamic object, the - real symbol in the dynamic object is also put in the dynamic - symbols; we also must arrange for both symbols to point to the - same memory location. We could handle the general case of symbol - aliasing, but a general symbol alias can only be generated in - assembler code, handling it correctly would be very time - consuming, and other ELF linkers don't handle general aliasing - either. */ - while (weaks != NULL) - { - struct elf_link_hash_entry *hlook; - asection *slook; - bfd_vma vlook; - struct elf_link_hash_entry **hpp; - struct elf_link_hash_entry **hppend; - - hlook = weaks; - weaks = hlook->weakdef; - hlook->weakdef = NULL; - - BFD_ASSERT (hlook->root.type == bfd_link_hash_defined - || hlook->root.type == bfd_link_hash_defweak - || hlook->root.type == bfd_link_hash_common - || hlook->root.type == bfd_link_hash_indirect); - slook = hlook->root.u.def.section; - vlook = hlook->root.u.def.value; - - hpp = elf_sym_hashes (abfd); - hppend = hpp + extsymcount; - for (; hpp < hppend; hpp++) - { - struct elf_link_hash_entry *h; - - h = *hpp; - if (h != NULL && h != hlook - && h->root.type == bfd_link_hash_defined - && h->root.u.def.section == slook - && h->root.u.def.value == vlook) - { - hlook->weakdef = h; - - /* If the weak definition is in the list of dynamic - symbols, make sure the real definition is put there - as well. */ - if (hlook->dynindx != -1 - && h->dynindx == -1) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, h)) - goto error_return; - } - - /* If the real definition is in the list of dynamic - symbols, make sure the weak definition is put there - as well. If we don't do this, then the dynamic - loader might not merge the entries for the real - definition and the weak definition. */ - if (h->dynindx != -1 - && hlook->dynindx == -1) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, hlook)) - goto error_return; - } - break; - } - } - } - - /* If this object is the same format as the output object, and it is - not a shared library, then let the backend look through the - relocs. - - This is required to build global offset table entries and to - arrange for dynamic relocs. It is not required for the - particular common case of linking non PIC code, even when linking - against shared libraries, but unfortunately there is no way of - knowing whether an object file has been compiled PIC or not. - Looking through the relocs is not particularly time consuming. - The problem is that we must either (1) keep the relocs in memory, - which causes the linker to require additional runtime memory or - (2) read the relocs twice from the input file, which wastes time. - This would be a good case for using mmap. - - I have no idea how to handle linking PIC code into a file of a - different format. It probably can't be done. */ - check_relocs = get_elf_backend_data (abfd)->check_relocs; - if (! dynamic - && abfd->xvec == info->hash->creator - && check_relocs != NULL) - { - asection *o; - - for (o = abfd->sections; o != NULL; o = o->next) - { - Elf_Internal_Rela *internal_relocs; - boolean ok; - - if ((o->flags & SEC_RELOC) == 0 - || o->reloc_count == 0 - || ((info->strip == strip_all || info->strip == strip_debugger) - && (o->flags & SEC_DEBUGGING) != 0) - || bfd_is_abs_section (o->output_section)) - continue; - - internal_relocs = (NAME(_bfd_elf,link_read_relocs) - (abfd, o, (PTR) NULL, - (Elf_Internal_Rela *) NULL, - info->keep_memory)); - if (internal_relocs == NULL) - goto error_return; - - ok = (*check_relocs) (abfd, info, o, internal_relocs); - - if (elf_section_data (o)->relocs != internal_relocs) - free (internal_relocs); - - if (! ok) - goto error_return; - } - } - - /* If this is a non-traditional, non-relocateable link, try to - optimize the handling of the .stab/.stabstr sections. */ - if (! dynamic - && ! info->relocateable - && ! info->traditional_format - && info->hash->creator->flavour == bfd_target_elf_flavour - && is_elf_hash_table (info) - && (info->strip != strip_all && info->strip != strip_debugger)) - { - asection *stab, *stabstr; - - stab = bfd_get_section_by_name (abfd, ".stab"); - if (stab != NULL - && (stab->flags & SEC_MERGE) == 0 - && !bfd_is_abs_section (stab->output_section)) - { - stabstr = bfd_get_section_by_name (abfd, ".stabstr"); - - if (stabstr != NULL) - { - struct bfd_elf_section_data *secdata; - - secdata = elf_section_data (stab); - if (! _bfd_link_section_stabs (abfd, - & hash_table->stab_info, - stab, stabstr, - &secdata->sec_info)) - goto error_return; - if (secdata->sec_info) - secdata->sec_info_type = ELF_INFO_TYPE_STABS; - } - } - } - - if (! info->relocateable && ! dynamic - && is_elf_hash_table (info)) - { - asection *s; - - for (s = abfd->sections; s != NULL; s = s->next) - if ((s->flags & SEC_MERGE) != 0 - && !bfd_is_abs_section (s->output_section)) - { - struct bfd_elf_section_data *secdata; - - secdata = elf_section_data (s); - if (! _bfd_merge_section (abfd, - & hash_table->merge_info, - s, &secdata->sec_info)) - goto error_return; - else if (secdata->sec_info) - secdata->sec_info_type = ELF_INFO_TYPE_MERGE; - } - } - - if (is_elf_hash_table (info)) - { - /* Add this bfd to the loaded list. */ - struct elf_link_loaded_list *n; - - n = ((struct elf_link_loaded_list *) - bfd_alloc (abfd, sizeof (struct elf_link_loaded_list))); - if (n == NULL) - goto error_return; - n->abfd = abfd; - n->next = hash_table->loaded; - hash_table->loaded = n; - } - - return true; - - error_free_vers: - if (extversym != NULL) - free (extversym); - error_free_sym: - if (isymbuf != NULL) - free (isymbuf); - error_return: - return false; -} - -/* Create some sections which will be filled in with dynamic linking - information. ABFD is an input file which requires dynamic sections - to be created. The dynamic sections take up virtual memory space - when the final executable is run, so we need to create them before - addresses are assigned to the output sections. We work out the - actual contents and size of these sections later. */ - -boolean -elf_link_create_dynamic_sections (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - flagword flags; - register asection *s; - struct elf_link_hash_entry *h; - struct bfd_link_hash_entry *bh; - struct elf_backend_data *bed; - - if (! is_elf_hash_table (info)) - return false; - - if (elf_hash_table (info)->dynamic_sections_created) - return true; - - /* Make sure that all dynamic sections use the same input BFD. */ - if (elf_hash_table (info)->dynobj == NULL) - elf_hash_table (info)->dynobj = abfd; - else - abfd = elf_hash_table (info)->dynobj; - - /* Note that we set the SEC_IN_MEMORY flag for all of these - sections. */ - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED); - - /* A dynamically linked executable has a .interp section, but a - shared library does not. */ - if (! info->shared) - { - s = bfd_make_section (abfd, ".interp"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)) - return false; - } - - if (! info->traditional_format - && info->hash->creator->flavour == bfd_target_elf_flavour) - { - s = bfd_make_section (abfd, ".eh_frame_hdr"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, 2)) - return false; - } - - /* Create sections to hold version informations. These are removed - if they are not needed. */ - s = bfd_make_section (abfd, ".gnu.version_d"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN)) - return false; - - s = bfd_make_section (abfd, ".gnu.version"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, 1)) - return false; - - s = bfd_make_section (abfd, ".gnu.version_r"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN)) - return false; - - s = bfd_make_section (abfd, ".dynsym"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN)) - return false; - - s = bfd_make_section (abfd, ".dynstr"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)) - return false; - - /* Create a strtab to hold the dynamic symbol names. */ - if (elf_hash_table (info)->dynstr == NULL) - { - elf_hash_table (info)->dynstr = _bfd_elf_strtab_init (); - if (elf_hash_table (info)->dynstr == NULL) - return false; - } - - s = bfd_make_section (abfd, ".dynamic"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN)) - return false; - - /* The special symbol _DYNAMIC is always set to the start of the - .dynamic section. This call occurs before we have processed the - symbols for any dynamic object, so we don't have to worry about - overriding a dynamic definition. We could set _DYNAMIC in a - linker script, but we only want to define it if we are, in fact, - creating a .dynamic section. We don't want to define it if there - is no .dynamic section, since on some ELF platforms the start up - code examines it to decide how to initialize the process. */ - bh = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, "_DYNAMIC", BSF_GLOBAL, s, (bfd_vma) 0, - (const char *) 0, false, get_elf_backend_data (abfd)->collect, &bh))) - return false; - h = (struct elf_link_hash_entry *) bh; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (info->shared - && ! _bfd_elf_link_record_dynamic_symbol (info, h)) - return false; - - bed = get_elf_backend_data (abfd); - - s = bfd_make_section (abfd, ".hash"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN)) - return false; - elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry; - - /* Let the backend create the rest of the sections. This lets the - backend set the right flags. The backend will normally create - the .got and .plt sections. */ - if (! (*bed->elf_backend_create_dynamic_sections) (abfd, info)) - return false; - - elf_hash_table (info)->dynamic_sections_created = true; - - return true; -} - -/* Add an entry to the .dynamic table. */ - -boolean -elf_add_dynamic_entry (info, tag, val) - struct bfd_link_info *info; - bfd_vma tag; - bfd_vma val; -{ - Elf_Internal_Dyn dyn; - bfd *dynobj; - asection *s; - bfd_size_type newsize; - bfd_byte *newcontents; - - if (! is_elf_hash_table (info)) - return false; - - dynobj = elf_hash_table (info)->dynobj; - - s = bfd_get_section_by_name (dynobj, ".dynamic"); - BFD_ASSERT (s != NULL); - - newsize = s->_raw_size + sizeof (Elf_External_Dyn); - newcontents = (bfd_byte *) bfd_realloc (s->contents, newsize); - if (newcontents == NULL) - return false; - - dyn.d_tag = tag; - dyn.d_un.d_val = val; - elf_swap_dyn_out (dynobj, &dyn, - (Elf_External_Dyn *) (newcontents + s->_raw_size)); - - s->_raw_size = newsize; - s->contents = newcontents; - - return true; -} - -/* Read and swap the relocs from the section indicated by SHDR. This - may be either a REL or a RELA section. The relocations are - translated into RELA relocations and stored in INTERNAL_RELOCS, - which should have already been allocated to contain enough space. - The EXTERNAL_RELOCS are a buffer where the external form of the - relocations should be stored. - - Returns false if something goes wrong. */ - -static boolean -elf_link_read_relocs_from_section (abfd, shdr, external_relocs, - internal_relocs) - bfd *abfd; - Elf_Internal_Shdr *shdr; - PTR external_relocs; - Elf_Internal_Rela *internal_relocs; -{ - struct elf_backend_data *bed; - bfd_size_type amt; - - /* If there aren't any relocations, that's OK. */ - if (!shdr) - return true; - - /* Position ourselves at the start of the section. */ - if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0) - return false; - - /* Read the relocations. */ - if (bfd_bread (external_relocs, shdr->sh_size, abfd) != shdr->sh_size) - return false; - - bed = get_elf_backend_data (abfd); - - /* Convert the external relocations to the internal format. */ - if (shdr->sh_entsize == sizeof (Elf_External_Rel)) - { - Elf_External_Rel *erel; - Elf_External_Rel *erelend; - Elf_Internal_Rela *irela; - Elf_Internal_Rel *irel; - - erel = (Elf_External_Rel *) external_relocs; - erelend = erel + NUM_SHDR_ENTRIES (shdr); - irela = internal_relocs; - amt = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel); - irel = bfd_alloc (abfd, amt); - for (; erel < erelend; erel++, irela += bed->s->int_rels_per_ext_rel) - { - unsigned int i; - - if (bed->s->swap_reloc_in) - (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, irel); - else - elf_swap_reloc_in (abfd, erel, irel); - - for (i = 0; i < bed->s->int_rels_per_ext_rel; ++i) - { - irela[i].r_offset = irel[i].r_offset; - irela[i].r_info = irel[i].r_info; - irela[i].r_addend = 0; - } - } - } - else - { - Elf_External_Rela *erela; - Elf_External_Rela *erelaend; - Elf_Internal_Rela *irela; - - BFD_ASSERT (shdr->sh_entsize == sizeof (Elf_External_Rela)); - - erela = (Elf_External_Rela *) external_relocs; - erelaend = erela + NUM_SHDR_ENTRIES (shdr); - irela = internal_relocs; - for (; erela < erelaend; erela++, irela += bed->s->int_rels_per_ext_rel) - { - if (bed->s->swap_reloca_in) - (*bed->s->swap_reloca_in) (abfd, (bfd_byte *) erela, irela); - else - elf_swap_reloca_in (abfd, erela, irela); - } - } - - return true; -} - -/* Read and swap the relocs for a section O. They may have been - cached. If the EXTERNAL_RELOCS and INTERNAL_RELOCS arguments are - not NULL, they are used as buffers to read into. They are known to - be large enough. If the INTERNAL_RELOCS relocs argument is NULL, - the return value is allocated using either malloc or bfd_alloc, - according to the KEEP_MEMORY argument. If O has two relocation - sections (both REL and RELA relocations), then the REL_HDR - relocations will appear first in INTERNAL_RELOCS, followed by the - REL_HDR2 relocations. */ - -Elf_Internal_Rela * -NAME(_bfd_elf,link_read_relocs) (abfd, o, external_relocs, internal_relocs, - keep_memory) - bfd *abfd; - asection *o; - PTR external_relocs; - Elf_Internal_Rela *internal_relocs; - boolean keep_memory; -{ - Elf_Internal_Shdr *rel_hdr; - PTR alloc1 = NULL; - Elf_Internal_Rela *alloc2 = NULL; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - - if (elf_section_data (o)->relocs != NULL) - return elf_section_data (o)->relocs; - - if (o->reloc_count == 0) - return NULL; - - rel_hdr = &elf_section_data (o)->rel_hdr; - - if (internal_relocs == NULL) - { - bfd_size_type size; - - size = o->reloc_count; - size *= bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela); - if (keep_memory) - internal_relocs = (Elf_Internal_Rela *) bfd_alloc (abfd, size); - else - internal_relocs = alloc2 = (Elf_Internal_Rela *) bfd_malloc (size); - if (internal_relocs == NULL) - goto error_return; - } - - if (external_relocs == NULL) - { - bfd_size_type size = rel_hdr->sh_size; - - if (elf_section_data (o)->rel_hdr2) - size += elf_section_data (o)->rel_hdr2->sh_size; - alloc1 = (PTR) bfd_malloc (size); - if (alloc1 == NULL) - goto error_return; - external_relocs = alloc1; - } - - if (!elf_link_read_relocs_from_section (abfd, rel_hdr, - external_relocs, - internal_relocs)) - goto error_return; - if (!elf_link_read_relocs_from_section - (abfd, - elf_section_data (o)->rel_hdr2, - ((bfd_byte *) external_relocs) + rel_hdr->sh_size, - internal_relocs + (NUM_SHDR_ENTRIES (rel_hdr) - * bed->s->int_rels_per_ext_rel))) - goto error_return; - - /* Cache the results for next time, if we can. */ - if (keep_memory) - elf_section_data (o)->relocs = internal_relocs; - - if (alloc1 != NULL) - free (alloc1); - - /* Don't free alloc2, since if it was allocated we are passing it - back (under the name of internal_relocs). */ - - return internal_relocs; - - error_return: - if (alloc1 != NULL) - free (alloc1); - if (alloc2 != NULL) - free (alloc2); - return NULL; -} - -/* Record an assignment to a symbol made by a linker script. We need - this in case some dynamic object refers to this symbol. */ - -boolean -NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide) - bfd *output_bfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; - const char *name; - boolean provide; -{ - struct elf_link_hash_entry *h; - - if (info->hash->creator->flavour != bfd_target_elf_flavour) - return true; - - h = elf_link_hash_lookup (elf_hash_table (info), name, true, true, false); - if (h == NULL) - return false; - - if (h->root.type == bfd_link_hash_new) - h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; - - /* If this symbol is being provided by the linker script, and it is - currently defined by a dynamic object, but not by a regular - object, then mark it as undefined so that the generic linker will - force the correct value. */ - if (provide - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - h->root.type = bfd_link_hash_undefined; - - /* If this symbol is not being provided by the linker script, and it is - currently defined by a dynamic object, but not by a regular object, - then clear out any version information because the symbol will not be - associated with the dynamic object any more. */ - if (!provide - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - h->verinfo.verdef = NULL; - - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - - if (((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC - | ELF_LINK_HASH_REF_DYNAMIC)) != 0 - || info->shared) - && h->dynindx == -1) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, h)) - return false; - - /* If this is a weak defined symbol, and we know a corresponding - real symbol from the same dynamic object, make sure the real - symbol is also made into a dynamic symbol. */ - if (h->weakdef != NULL - && h->weakdef->dynindx == -1) - { - if (! _bfd_elf_link_record_dynamic_symbol (info, h->weakdef)) - return false; - } - } - - return true; -} - -/* This structure is used to pass information to - elf_link_assign_sym_version. */ - -struct elf_assign_sym_version_info -{ - /* Output BFD. */ - bfd *output_bfd; - /* General link information. */ - struct bfd_link_info *info; - /* Version tree. */ - struct bfd_elf_version_tree *verdefs; - /* Whether we had a failure. */ - boolean failed; -}; - -/* This structure is used to pass information to - elf_link_find_version_dependencies. */ - -struct elf_find_verdep_info -{ - /* Output BFD. */ - bfd *output_bfd; - /* General link information. */ - struct bfd_link_info *info; - /* The number of dependencies. */ - unsigned int vers; - /* Whether we had a failure. */ - boolean failed; -}; - -/* Array used to determine the number of hash table buckets to use - based on the number of symbols there are. If there are fewer than - 3 symbols we use 1 bucket, fewer than 17 symbols we use 3 buckets, - fewer than 37 we use 17 buckets, and so forth. We never use more - than 32771 buckets. */ - -static const size_t elf_buckets[] = -{ - 1, 3, 17, 37, 67, 97, 131, 197, 263, 521, 1031, 2053, 4099, 8209, - 16411, 32771, 0 -}; - -/* Compute bucket count for hashing table. We do not use a static set - of possible tables sizes anymore. Instead we determine for all - possible reasonable sizes of the table the outcome (i.e., the - number of collisions etc) and choose the best solution. The - weighting functions are not too simple to allow the table to grow - without bounds. Instead one of the weighting factors is the size. - Therefore the result is always a good payoff between few collisions - (= short chain lengths) and table size. */ -static size_t -compute_bucket_count (info) - struct bfd_link_info *info; -{ - size_t dynsymcount = elf_hash_table (info)->dynsymcount; - size_t best_size = 0; - unsigned long int *hashcodes; - unsigned long int *hashcodesp; - unsigned long int i; - bfd_size_type amt; - - /* Compute the hash values for all exported symbols. At the same - time store the values in an array so that we could use them for - optimizations. */ - amt = dynsymcount; - amt *= sizeof (unsigned long int); - hashcodes = (unsigned long int *) bfd_malloc (amt); - if (hashcodes == NULL) - return 0; - hashcodesp = hashcodes; - - /* Put all hash values in HASHCODES. */ - elf_link_hash_traverse (elf_hash_table (info), - elf_collect_hash_codes, &hashcodesp); - - /* We have a problem here. The following code to optimize the table - size requires an integer type with more the 32 bits. If - BFD_HOST_U_64_BIT is set we know about such a type. */ -#ifdef BFD_HOST_U_64_BIT - if (info->optimize) - { - unsigned long int nsyms = hashcodesp - hashcodes; - size_t minsize; - size_t maxsize; - BFD_HOST_U_64_BIT best_chlen = ~((BFD_HOST_U_64_BIT) 0); - unsigned long int *counts ; - - /* Possible optimization parameters: if we have NSYMS symbols we say - that the hashing table must at least have NSYMS/4 and at most - 2*NSYMS buckets. */ - minsize = nsyms / 4; - if (minsize == 0) - minsize = 1; - best_size = maxsize = nsyms * 2; - - /* Create array where we count the collisions in. We must use bfd_malloc - since the size could be large. */ - amt = maxsize; - amt *= sizeof (unsigned long int); - counts = (unsigned long int *) bfd_malloc (amt); - if (counts == NULL) - { - free (hashcodes); - return 0; - } - - /* Compute the "optimal" size for the hash table. The criteria is a - minimal chain length. The minor criteria is (of course) the size - of the table. */ - for (i = minsize; i < maxsize; ++i) - { - /* Walk through the array of hashcodes and count the collisions. */ - BFD_HOST_U_64_BIT max; - unsigned long int j; - unsigned long int fact; - - memset (counts, '\0', i * sizeof (unsigned long int)); - - /* Determine how often each hash bucket is used. */ - for (j = 0; j < nsyms; ++j) - ++counts[hashcodes[j] % i]; - - /* For the weight function we need some information about the - pagesize on the target. This is information need not be 100% - accurate. Since this information is not available (so far) we - define it here to a reasonable default value. If it is crucial - to have a better value some day simply define this value. */ -# ifndef BFD_TARGET_PAGESIZE -# define BFD_TARGET_PAGESIZE (4096) -# endif - - /* We in any case need 2 + NSYMS entries for the size values and - the chains. */ - max = (2 + nsyms) * (ARCH_SIZE / 8); - -# if 1 - /* Variant 1: optimize for short chains. We add the squares - of all the chain lengths (which favous many small chain - over a few long chains). */ - for (j = 0; j < i; ++j) - max += counts[j] * counts[j]; - - /* This adds penalties for the overall size of the table. */ - fact = i / (BFD_TARGET_PAGESIZE / (ARCH_SIZE / 8)) + 1; - max *= fact * fact; -# else - /* Variant 2: Optimize a lot more for small table. Here we - also add squares of the size but we also add penalties for - empty slots (the +1 term). */ - for (j = 0; j < i; ++j) - max += (1 + counts[j]) * (1 + counts[j]); - - /* The overall size of the table is considered, but not as - strong as in variant 1, where it is squared. */ - fact = i / (BFD_TARGET_PAGESIZE / (ARCH_SIZE / 8)) + 1; - max *= fact; -# endif - - /* Compare with current best results. */ - if (max < best_chlen) - { - best_chlen = max; - best_size = i; - } - } - - free (counts); - } - else -#endif /* defined (BFD_HOST_U_64_BIT) */ - { - /* This is the fallback solution if no 64bit type is available or if we - are not supposed to spend much time on optimizations. We select the - bucket count using a fixed set of numbers. */ - for (i = 0; elf_buckets[i] != 0; i++) - { - best_size = elf_buckets[i]; - if (dynsymcount < elf_buckets[i + 1]) - break; - } - } - - /* Free the arrays we needed. */ - free (hashcodes); - - return best_size; -} - -/* Set up the sizes and contents of the ELF dynamic sections. This is - called by the ELF linker emulation before_allocation routine. We - must set the sizes of the sections before the linker sets the - addresses of the various sections. */ - -boolean -NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath, - filter_shlib, - auxiliary_filters, info, sinterpptr, - verdefs) - bfd *output_bfd; - const char *soname; - const char *rpath; - const char *filter_shlib; - const char * const *auxiliary_filters; - struct bfd_link_info *info; - asection **sinterpptr; - struct bfd_elf_version_tree *verdefs; -{ - bfd_size_type soname_indx; - bfd *dynobj; - struct elf_backend_data *bed; - struct elf_assign_sym_version_info asvinfo; - - *sinterpptr = NULL; - - soname_indx = (bfd_size_type) -1; - - if (info->hash->creator->flavour != bfd_target_elf_flavour) - return true; - - if (! is_elf_hash_table (info)) - return true; - - /* Any syms created from now on start with -1 in - got.refcount/offset and plt.refcount/offset. */ - elf_hash_table (info)->init_refcount = -1; - - /* The backend may have to create some sections regardless of whether - we're dynamic or not. */ - bed = get_elf_backend_data (output_bfd); - if (bed->elf_backend_always_size_sections - && ! (*bed->elf_backend_always_size_sections) (output_bfd, info)) - return false; - - dynobj = elf_hash_table (info)->dynobj; - - /* If there were no dynamic objects in the link, there is nothing to - do here. */ - if (dynobj == NULL) - return true; - - if (! _bfd_elf_maybe_strip_eh_frame_hdr (info)) - return false; - - if (elf_hash_table (info)->dynamic_sections_created) - { - struct elf_info_failed eif; - struct elf_link_hash_entry *h; - asection *dynstr; - struct bfd_elf_version_tree *t; - struct bfd_elf_version_expr *d; - boolean all_defined; - - *sinterpptr = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (*sinterpptr != NULL || info->shared); - - if (soname != NULL) - { - soname_indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, - soname, true); - if (soname_indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SONAME, - soname_indx)) - return false; - } - - if (info->symbolic) - { - if (! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMBOLIC, - (bfd_vma) 0)) - return false; - info->flags |= DF_SYMBOLIC; - } - - if (rpath != NULL) - { - bfd_size_type indx; - - indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath, - true); - if (info->new_dtags) - _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx); - if (indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, (bfd_vma) DT_RPATH, indx) - || (info->new_dtags - && ! elf_add_dynamic_entry (info, (bfd_vma) DT_RUNPATH, - indx))) - return false; - } - - if (filter_shlib != NULL) - { - bfd_size_type indx; - - indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, - filter_shlib, true); - if (indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, (bfd_vma) DT_FILTER, indx)) - return false; - } - - if (auxiliary_filters != NULL) - { - const char * const *p; - - for (p = auxiliary_filters; *p != NULL; p++) - { - bfd_size_type indx; - - indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, - *p, true); - if (indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, (bfd_vma) DT_AUXILIARY, - indx)) - return false; - } - } - - eif.info = info; - eif.verdefs = verdefs; - eif.failed = false; - - /* If we are supposed to export all symbols into the dynamic symbol - table (this is not the normal case), then do so. */ - if (info->export_dynamic) - { - elf_link_hash_traverse (elf_hash_table (info), elf_export_symbol, - (PTR) &eif); - if (eif.failed) - return false; - } - - /* Make all global versions with definiton. */ - for (t = verdefs; t != NULL; t = t->next) - for (d = t->globals; d != NULL; d = d->next) - if (!d->symver && strchr (d->pattern, '*') == NULL) - { - const char *verstr, *name; - size_t namelen, verlen, newlen; - char *newname, *p; - struct elf_link_hash_entry *newh; - - name = d->pattern; - namelen = strlen (name); - verstr = t->name; - verlen = strlen (verstr); - newlen = namelen + verlen + 3; - - newname = (char *) bfd_malloc ((bfd_size_type) newlen); - if (newname == NULL) - return false; - memcpy (newname, name, namelen); - - /* Check the hidden versioned definition. */ - p = newname + namelen; - *p++ = ELF_VER_CHR; - memcpy (p, verstr, verlen + 1); - newh = elf_link_hash_lookup (elf_hash_table (info), - newname, false, false, - false); - if (newh == NULL - || (newh->root.type != bfd_link_hash_defined - && newh->root.type != bfd_link_hash_defweak)) - { - /* Check the default versioned definition. */ - *p++ = ELF_VER_CHR; - memcpy (p, verstr, verlen + 1); - newh = elf_link_hash_lookup (elf_hash_table (info), - newname, false, false, - false); - } - free (newname); - - /* Mark this version if there is a definition and it is - not defined in a shared object. */ - if (newh != NULL - && ((newh->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) == 0) - && (newh->root.type == bfd_link_hash_defined - || newh->root.type == bfd_link_hash_defweak)) - d->symver = 1; - } - - /* Attach all the symbols to their version information. */ - asvinfo.output_bfd = output_bfd; - asvinfo.info = info; - asvinfo.verdefs = verdefs; - asvinfo.failed = false; - - elf_link_hash_traverse (elf_hash_table (info), - elf_link_assign_sym_version, - (PTR) &asvinfo); - if (asvinfo.failed) - return false; - - if (!info->allow_undefined_version) - { - /* Check if all global versions have a definiton. */ - all_defined = true; - for (t = verdefs; t != NULL; t = t->next) - for (d = t->globals; d != NULL; d = d->next) - if (!d->symver && !d->script - && strchr (d->pattern, '*') == NULL) - { - (*_bfd_error_handler) - (_("%s: undefined version: %s"), - d->pattern, t->name); - all_defined = false; - } - - if (!all_defined) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - } - - /* Find all symbols which were defined in a dynamic object and make - the backend pick a reasonable value for them. */ - elf_link_hash_traverse (elf_hash_table (info), - elf_adjust_dynamic_symbol, - (PTR) &eif); - if (eif.failed) - return false; - - /* Add some entries to the .dynamic section. We fill in some of the - values later, in elf_bfd_final_link, but we must add the entries - now so that we know the final size of the .dynamic section. */ - - /* If there are initialization and/or finalization functions to - call then add the corresponding DT_INIT/DT_FINI entries. */ - h = (info->init_function - ? elf_link_hash_lookup (elf_hash_table (info), - info->init_function, false, - false, false) - : NULL); - if (h != NULL - && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_DEF_REGULAR)) != 0) - { - if (! elf_add_dynamic_entry (info, (bfd_vma) DT_INIT, (bfd_vma) 0)) - return false; - } - h = (info->fini_function - ? elf_link_hash_lookup (elf_hash_table (info), - info->fini_function, false, - false, false) - : NULL); - if (h != NULL - && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_DEF_REGULAR)) != 0) - { - if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FINI, (bfd_vma) 0)) - return false; - } - - if (bfd_get_section_by_name (output_bfd, ".preinit_array") != NULL) - { - /* DT_PREINIT_ARRAY is not allowed in shared library. */ - if (info->shared) - { - bfd *sub; - asection *o; - - for (sub = info->input_bfds; sub != NULL; - sub = sub->link_next) - for (o = sub->sections; o != NULL; o = o->next) - if (elf_section_data (o)->this_hdr.sh_type - == SHT_PREINIT_ARRAY) - { - (*_bfd_error_handler) - (_("%s: .preinit_array section is not allowed in DSO"), - bfd_archive_filename (sub)); - break; - } - - bfd_set_error (bfd_error_nonrepresentable_section); - return false; - } - - if (!elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAY, - (bfd_vma) 0) - || !elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAYSZ, - (bfd_vma) 0)) - return false; - } - if (bfd_get_section_by_name (output_bfd, ".init_array") != NULL) - { - if (!elf_add_dynamic_entry (info, (bfd_vma) DT_INIT_ARRAY, - (bfd_vma) 0) - || !elf_add_dynamic_entry (info, (bfd_vma) DT_INIT_ARRAYSZ, - (bfd_vma) 0)) - return false; - } - if (bfd_get_section_by_name (output_bfd, ".fini_array") != NULL) - { - if (!elf_add_dynamic_entry (info, (bfd_vma) DT_FINI_ARRAY, - (bfd_vma) 0) - || !elf_add_dynamic_entry (info, (bfd_vma) DT_FINI_ARRAYSZ, - (bfd_vma) 0)) - return false; - } - - dynstr = bfd_get_section_by_name (dynobj, ".dynstr"); - /* If .dynstr is excluded from the link, we don't want any of - these tags. Strictly, we should be checking each section - individually; This quick check covers for the case where - someone does a /DISCARD/ : { *(*) }. */ - if (dynstr != NULL && dynstr->output_section != bfd_abs_section_ptr) - { - bfd_size_type strsize; - - strsize = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr); - if (! elf_add_dynamic_entry (info, (bfd_vma) DT_HASH, (bfd_vma) 0) - || ! elf_add_dynamic_entry (info, (bfd_vma) DT_STRTAB, (bfd_vma) 0) - || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMTAB, (bfd_vma) 0) - || ! elf_add_dynamic_entry (info, (bfd_vma) DT_STRSZ, strsize) - || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMENT, - (bfd_vma) sizeof (Elf_External_Sym))) - return false; - } - } - - /* The backend must work out the sizes of all the other dynamic - sections. */ - if (bed->elf_backend_size_dynamic_sections - && ! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info)) - return false; - - if (elf_hash_table (info)->dynamic_sections_created) - { - bfd_size_type dynsymcount; - asection *s; - size_t bucketcount = 0; - size_t hash_entry_size; - unsigned int dtagcount; - - /* Set up the version definition section. */ - s = bfd_get_section_by_name (dynobj, ".gnu.version_d"); - BFD_ASSERT (s != NULL); - - /* We may have created additional version definitions if we are - just linking a regular application. */ - verdefs = asvinfo.verdefs; - - /* Skip anonymous version tag. */ - if (verdefs != NULL && verdefs->vernum == 0) - verdefs = verdefs->next; - - if (verdefs == NULL) - _bfd_strip_section_from_output (info, s); - else - { - unsigned int cdefs; - bfd_size_type size; - struct bfd_elf_version_tree *t; - bfd_byte *p; - Elf_Internal_Verdef def; - Elf_Internal_Verdaux defaux; - - cdefs = 0; - size = 0; - - /* Make space for the base version. */ - size += sizeof (Elf_External_Verdef); - size += sizeof (Elf_External_Verdaux); - ++cdefs; - - for (t = verdefs; t != NULL; t = t->next) - { - struct bfd_elf_version_deps *n; - - size += sizeof (Elf_External_Verdef); - size += sizeof (Elf_External_Verdaux); - ++cdefs; - - for (n = t->deps; n != NULL; n = n->next) - size += sizeof (Elf_External_Verdaux); - } - - s->_raw_size = size; - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return false; - - /* Fill in the version definition section. */ - - p = s->contents; - - def.vd_version = VER_DEF_CURRENT; - def.vd_flags = VER_FLG_BASE; - def.vd_ndx = 1; - def.vd_cnt = 1; - def.vd_aux = sizeof (Elf_External_Verdef); - def.vd_next = (sizeof (Elf_External_Verdef) - + sizeof (Elf_External_Verdaux)); - - if (soname_indx != (bfd_size_type) -1) - { - _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, - soname_indx); - def.vd_hash = bfd_elf_hash (soname); - defaux.vda_name = soname_indx; - } - else - { - const char *name; - bfd_size_type indx; - - name = basename (output_bfd->filename); - def.vd_hash = bfd_elf_hash (name); - indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, - name, false); - if (indx == (bfd_size_type) -1) - return false; - defaux.vda_name = indx; - } - defaux.vda_next = 0; - - _bfd_elf_swap_verdef_out (output_bfd, &def, - (Elf_External_Verdef *) p); - p += sizeof (Elf_External_Verdef); - _bfd_elf_swap_verdaux_out (output_bfd, &defaux, - (Elf_External_Verdaux *) p); - p += sizeof (Elf_External_Verdaux); - - for (t = verdefs; t != NULL; t = t->next) - { - unsigned int cdeps; - struct bfd_elf_version_deps *n; - struct elf_link_hash_entry *h; - struct bfd_link_hash_entry *bh; - - cdeps = 0; - for (n = t->deps; n != NULL; n = n->next) - ++cdeps; - - /* Add a symbol representing this version. */ - bh = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, dynobj, t->name, BSF_GLOBAL, bfd_abs_section_ptr, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (dynobj)->collect, &bh))) - return false; - h = (struct elf_link_hash_entry *) bh; - h->elf_link_hash_flags &= ~ ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - h->verinfo.vertree = t; - - if (! _bfd_elf_link_record_dynamic_symbol (info, h)) - return false; - - def.vd_version = VER_DEF_CURRENT; - def.vd_flags = 0; - if (t->globals == NULL && t->locals == NULL && ! t->used) - def.vd_flags |= VER_FLG_WEAK; - def.vd_ndx = t->vernum + 1; - def.vd_cnt = cdeps + 1; - def.vd_hash = bfd_elf_hash (t->name); - def.vd_aux = sizeof (Elf_External_Verdef); - if (t->next != NULL) - def.vd_next = (sizeof (Elf_External_Verdef) - + (cdeps + 1) * sizeof (Elf_External_Verdaux)); - else - def.vd_next = 0; - - _bfd_elf_swap_verdef_out (output_bfd, &def, - (Elf_External_Verdef *) p); - p += sizeof (Elf_External_Verdef); - - defaux.vda_name = h->dynstr_index; - _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, - h->dynstr_index); - if (t->deps == NULL) - defaux.vda_next = 0; - else - defaux.vda_next = sizeof (Elf_External_Verdaux); - t->name_indx = defaux.vda_name; - - _bfd_elf_swap_verdaux_out (output_bfd, &defaux, - (Elf_External_Verdaux *) p); - p += sizeof (Elf_External_Verdaux); - - for (n = t->deps; n != NULL; n = n->next) - { - if (n->version_needed == NULL) - { - /* This can happen if there was an error in the - version script. */ - defaux.vda_name = 0; - } - else - { - defaux.vda_name = n->version_needed->name_indx; - _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, - defaux.vda_name); - } - if (n->next == NULL) - defaux.vda_next = 0; - else - defaux.vda_next = sizeof (Elf_External_Verdaux); - - _bfd_elf_swap_verdaux_out (output_bfd, &defaux, - (Elf_External_Verdaux *) p); - p += sizeof (Elf_External_Verdaux); - } - } - - if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERDEF, (bfd_vma) 0) - || ! elf_add_dynamic_entry (info, (bfd_vma) DT_VERDEFNUM, - (bfd_vma) cdefs)) - return false; - - elf_tdata (output_bfd)->cverdefs = cdefs; - } - - if ((info->new_dtags && info->flags) || (info->flags & DF_STATIC_TLS)) - { - if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS, info->flags)) - return false; - } - - if (info->flags_1) - { - if (! info->shared) - info->flags_1 &= ~ (DF_1_INITFIRST - | DF_1_NODELETE - | DF_1_NOOPEN); - if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS_1, - info->flags_1)) - return false; - } - - /* Work out the size of the version reference section. */ - - s = bfd_get_section_by_name (dynobj, ".gnu.version_r"); - BFD_ASSERT (s != NULL); - { - struct elf_find_verdep_info sinfo; - - sinfo.output_bfd = output_bfd; - sinfo.info = info; - sinfo.vers = elf_tdata (output_bfd)->cverdefs; - if (sinfo.vers == 0) - sinfo.vers = 1; - sinfo.failed = false; - - elf_link_hash_traverse (elf_hash_table (info), - elf_link_find_version_dependencies, - (PTR) &sinfo); - - if (elf_tdata (output_bfd)->verref == NULL) - _bfd_strip_section_from_output (info, s); - else - { - Elf_Internal_Verneed *t; - unsigned int size; - unsigned int crefs; - bfd_byte *p; - - /* Build the version definition section. */ - size = 0; - crefs = 0; - for (t = elf_tdata (output_bfd)->verref; - t != NULL; - t = t->vn_nextref) - { - Elf_Internal_Vernaux *a; - - size += sizeof (Elf_External_Verneed); - ++crefs; - for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) - size += sizeof (Elf_External_Vernaux); - } - - s->_raw_size = size; - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); - if (s->contents == NULL) - return false; - - p = s->contents; - for (t = elf_tdata (output_bfd)->verref; - t != NULL; - t = t->vn_nextref) - { - unsigned int caux; - Elf_Internal_Vernaux *a; - bfd_size_type indx; - - caux = 0; - for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) - ++caux; - - t->vn_version = VER_NEED_CURRENT; - t->vn_cnt = caux; - indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, - elf_dt_name (t->vn_bfd) != NULL - ? elf_dt_name (t->vn_bfd) - : basename (t->vn_bfd->filename), - false); - if (indx == (bfd_size_type) -1) - return false; - t->vn_file = indx; - t->vn_aux = sizeof (Elf_External_Verneed); - if (t->vn_nextref == NULL) - t->vn_next = 0; - else - t->vn_next = (sizeof (Elf_External_Verneed) - + caux * sizeof (Elf_External_Vernaux)); - - _bfd_elf_swap_verneed_out (output_bfd, t, - (Elf_External_Verneed *) p); - p += sizeof (Elf_External_Verneed); - - for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) - { - a->vna_hash = bfd_elf_hash (a->vna_nodename); - indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, - a->vna_nodename, false); - if (indx == (bfd_size_type) -1) - return false; - a->vna_name = indx; - if (a->vna_nextptr == NULL) - a->vna_next = 0; - else - a->vna_next = sizeof (Elf_External_Vernaux); - - _bfd_elf_swap_vernaux_out (output_bfd, a, - (Elf_External_Vernaux *) p); - p += sizeof (Elf_External_Vernaux); - } - } - - if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERNEED, - (bfd_vma) 0) - || ! elf_add_dynamic_entry (info, (bfd_vma) DT_VERNEEDNUM, - (bfd_vma) crefs)) - return false; - - elf_tdata (output_bfd)->cverrefs = crefs; - } - } - - /* Assign dynsym indicies. In a shared library we generate a - section symbol for each output section, which come first. - Next come all of the back-end allocated local dynamic syms, - followed by the rest of the global symbols. */ - - dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info); - - /* Work out the size of the symbol version section. */ - s = bfd_get_section_by_name (dynobj, ".gnu.version"); - BFD_ASSERT (s != NULL); - if (dynsymcount == 0 - || (verdefs == NULL && elf_tdata (output_bfd)->verref == NULL)) - { - _bfd_strip_section_from_output (info, s); - /* The DYNSYMCOUNT might have changed if we were going to - output a dynamic symbol table entry for S. */ - dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info); - } - else - { - s->_raw_size = dynsymcount * sizeof (Elf_External_Versym); - s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size); - if (s->contents == NULL) - return false; - - if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERSYM, (bfd_vma) 0)) - return false; - } - - /* Set the size of the .dynsym and .hash sections. We counted - the number of dynamic symbols in elf_link_add_object_symbols. - We will build the contents of .dynsym and .hash when we build - the final symbol table, because until then we do not know the - correct value to give the symbols. We built the .dynstr - section as we went along in elf_link_add_object_symbols. */ - s = bfd_get_section_by_name (dynobj, ".dynsym"); - BFD_ASSERT (s != NULL); - s->_raw_size = dynsymcount * sizeof (Elf_External_Sym); - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return false; - - if (dynsymcount != 0) - { - Elf_Internal_Sym isym; - - /* The first entry in .dynsym is a dummy symbol. */ - isym.st_value = 0; - isym.st_size = 0; - isym.st_name = 0; - isym.st_info = 0; - isym.st_other = 0; - isym.st_shndx = 0; - elf_swap_symbol_out (output_bfd, &isym, (PTR) s->contents, (PTR) 0); - } - - /* Compute the size of the hashing table. As a side effect this - computes the hash values for all the names we export. */ - bucketcount = compute_bucket_count (info); - - s = bfd_get_section_by_name (dynobj, ".hash"); - BFD_ASSERT (s != NULL); - hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize; - s->_raw_size = ((2 + bucketcount + dynsymcount) * hash_entry_size); - s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size); - if (s->contents == NULL) - return false; - - bfd_put (8 * hash_entry_size, output_bfd, (bfd_vma) bucketcount, - s->contents); - bfd_put (8 * hash_entry_size, output_bfd, (bfd_vma) dynsymcount, - s->contents + hash_entry_size); - - elf_hash_table (info)->bucketcount = bucketcount; - - s = bfd_get_section_by_name (dynobj, ".dynstr"); - BFD_ASSERT (s != NULL); - - elf_finalize_dynstr (output_bfd, info); - - s->_raw_size = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr); - - for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount) - if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NULL, (bfd_vma) 0)) - return false; - } - - return true; -} - -/* This function is used to adjust offsets into .dynstr for - dynamic symbols. This is called via elf_link_hash_traverse. */ - -static boolean elf_adjust_dynstr_offsets -PARAMS ((struct elf_link_hash_entry *, PTR)); - -static boolean -elf_adjust_dynstr_offsets (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - struct elf_strtab_hash *dynstr = (struct elf_strtab_hash *) data; - - if (h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - if (h->dynindx != -1) - h->dynstr_index = _bfd_elf_strtab_offset (dynstr, h->dynstr_index); - return true; -} - -/* Assign string offsets in .dynstr, update all structures referencing - them. */ - -static boolean -elf_finalize_dynstr (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - struct elf_link_local_dynamic_entry *entry; - struct elf_strtab_hash *dynstr = elf_hash_table (info)->dynstr; - bfd *dynobj = elf_hash_table (info)->dynobj; - asection *sdyn; - bfd_size_type size; - Elf_External_Dyn *dyncon, *dynconend; - - _bfd_elf_strtab_finalize (dynstr); - size = _bfd_elf_strtab_size (dynstr); - - /* Update all .dynamic entries referencing .dynstr strings. */ - sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - BFD_ASSERT (sdyn != NULL); - - dyncon = (Elf_External_Dyn *) sdyn->contents; - dynconend = (Elf_External_Dyn *) (sdyn->contents + - sdyn->_raw_size); - for (; dyncon < dynconend; dyncon++) - { - Elf_Internal_Dyn dyn; - - elf_swap_dyn_in (dynobj, dyncon, & dyn); - switch (dyn.d_tag) - { - case DT_STRSZ: - dyn.d_un.d_val = size; - elf_swap_dyn_out (dynobj, & dyn, dyncon); - break; - case DT_NEEDED: - case DT_SONAME: - case DT_RPATH: - case DT_RUNPATH: - case DT_FILTER: - case DT_AUXILIARY: - dyn.d_un.d_val = _bfd_elf_strtab_offset (dynstr, dyn.d_un.d_val); - elf_swap_dyn_out (dynobj, & dyn, dyncon); - break; - default: - break; - } - } - - /* Now update local dynamic symbols. */ - for (entry = elf_hash_table (info)->dynlocal; entry ; entry = entry->next) - entry->isym.st_name = _bfd_elf_strtab_offset (dynstr, - entry->isym.st_name); - - /* And the rest of dynamic symbols. */ - elf_link_hash_traverse (elf_hash_table (info), - elf_adjust_dynstr_offsets, dynstr); - - /* Adjust version definitions. */ - if (elf_tdata (output_bfd)->cverdefs) - { - asection *s; - bfd_byte *p; - bfd_size_type i; - Elf_Internal_Verdef def; - Elf_Internal_Verdaux defaux; - - s = bfd_get_section_by_name (dynobj, ".gnu.version_d"); - p = (bfd_byte *) s->contents; - do - { - _bfd_elf_swap_verdef_in (output_bfd, (Elf_External_Verdef *) p, - &def); - p += sizeof (Elf_External_Verdef); - for (i = 0; i < def.vd_cnt; ++i) - { - _bfd_elf_swap_verdaux_in (output_bfd, - (Elf_External_Verdaux *) p, &defaux); - defaux.vda_name = _bfd_elf_strtab_offset (dynstr, - defaux.vda_name); - _bfd_elf_swap_verdaux_out (output_bfd, - &defaux, (Elf_External_Verdaux *) p); - p += sizeof (Elf_External_Verdaux); - } - } - while (def.vd_next); - } - - /* Adjust version references. */ - if (elf_tdata (output_bfd)->verref) - { - asection *s; - bfd_byte *p; - bfd_size_type i; - Elf_Internal_Verneed need; - Elf_Internal_Vernaux needaux; - - s = bfd_get_section_by_name (dynobj, ".gnu.version_r"); - p = (bfd_byte *) s->contents; - do - { - _bfd_elf_swap_verneed_in (output_bfd, (Elf_External_Verneed *) p, - &need); - need.vn_file = _bfd_elf_strtab_offset (dynstr, need.vn_file); - _bfd_elf_swap_verneed_out (output_bfd, &need, - (Elf_External_Verneed *) p); - p += sizeof (Elf_External_Verneed); - for (i = 0; i < need.vn_cnt; ++i) - { - _bfd_elf_swap_vernaux_in (output_bfd, - (Elf_External_Vernaux *) p, &needaux); - needaux.vna_name = _bfd_elf_strtab_offset (dynstr, - needaux.vna_name); - _bfd_elf_swap_vernaux_out (output_bfd, - &needaux, - (Elf_External_Vernaux *) p); - p += sizeof (Elf_External_Vernaux); - } - } - while (need.vn_next); - } - - return true; -} - -/* Fix up the flags for a symbol. This handles various cases which - can only be fixed after all the input files are seen. This is - currently called by both adjust_dynamic_symbol and - assign_sym_version, which is unnecessary but perhaps more robust in - the face of future changes. */ - -static boolean -elf_fix_symbol_flags (h, eif) - struct elf_link_hash_entry *h; - struct elf_info_failed *eif; -{ - /* If this symbol was mentioned in a non-ELF file, try to set - DEF_REGULAR and REF_REGULAR correctly. This is the only way to - permit a non-ELF file to correctly refer to a symbol defined in - an ELF dynamic object. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_ELF) != 0) - { - while (h->root.type == bfd_link_hash_indirect) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - if (h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak) - h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK); - else - { - if (h->root.u.def.section->owner != NULL - && (bfd_get_flavour (h->root.u.def.section->owner) - == bfd_target_elf_flavour)) - h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK); - else - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - } - - if (h->dynindx == -1 - && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)) - { - if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h)) - { - eif->failed = true; - return false; - } - } - } - else - { - /* Unfortunately, ELF_LINK_NON_ELF is only correct if the symbol - was first seen in a non-ELF file. Fortunately, if the symbol - was first seen in an ELF file, we're probably OK unless the - symbol was defined in a non-ELF file. Catch that case here. - FIXME: We're still in trouble if the symbol was first seen in - a dynamic object, and then later in a non-ELF regular object. */ - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->root.u.def.section->owner != NULL - ? (bfd_get_flavour (h->root.u.def.section->owner) - != bfd_target_elf_flavour) - : (bfd_is_abs_section (h->root.u.def.section) - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) == 0))) - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - } - - /* If this is a final link, and the symbol was defined as a common - symbol in a regular object file, and there was no definition in - any dynamic object, then the linker will have allocated space for - the symbol in a common section but the ELF_LINK_HASH_DEF_REGULAR - flag will not have been set. */ - if (h->root.type == bfd_link_hash_defined - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - && (h->root.u.def.section->owner->flags & DYNAMIC) == 0) - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - - /* If -Bsymbolic was used (which means to bind references to global - symbols to the definition within the shared object), and this - symbol was defined in a regular object, then it actually doesn't - need a PLT entry, and we can accomplish that by forcing it local. - Likewise, if the symbol has hidden or internal visibility. - FIXME: It might be that we also do not need a PLT for other - non-hidden visibilities, but we would have to tell that to the - backend specifically; we can't just clear PLT-related data here. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0 - && eif->info->shared - && is_elf_hash_table (eif->info) - && (eif->info->symbolic - || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL - || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) - { - struct elf_backend_data *bed; - boolean force_local; - - bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj); - - force_local = (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL - || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN); - (*bed->elf_backend_hide_symbol) (eif->info, h, force_local); - } - - /* If this is a weak defined symbol in a dynamic object, and we know - the real definition in the dynamic object, copy interesting flags - over to the real definition. */ - if (h->weakdef != NULL) - { - struct elf_link_hash_entry *weakdef; - - weakdef = h->weakdef; - if (h->root.type == bfd_link_hash_indirect) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak); - BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined - || weakdef->root.type == bfd_link_hash_defweak); - BFD_ASSERT (weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC); - - /* If the real definition is defined by a regular object file, - don't do anything special. See the longer description in - elf_adjust_dynamic_symbol, below. */ - if ((weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) - h->weakdef = NULL; - else - { - struct elf_backend_data *bed; - - bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj); - (*bed->elf_backend_copy_indirect_symbol) (bed, weakdef, h); - } - } - - return true; -} - -/* Make the backend pick a good value for a dynamic symbol. This is - called via elf_link_hash_traverse, and also calls itself - recursively. */ - -static boolean -elf_adjust_dynamic_symbol (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - struct elf_info_failed *eif = (struct elf_info_failed *) data; - bfd *dynobj; - struct elf_backend_data *bed; - - if (h->root.type == bfd_link_hash_warning) - { - h->plt.offset = (bfd_vma) -1; - h->got.offset = (bfd_vma) -1; - - /* When warning symbols are created, they **replace** the "real" - entry in the hash table, thus we never get to see the real - symbol in a hash traversal. So look at it now. */ - h = (struct elf_link_hash_entry *) h->root.u.i.link; - } - - /* Ignore indirect symbols. These are added by the versioning code. */ - if (h->root.type == bfd_link_hash_indirect) - return true; - - if (! is_elf_hash_table (eif->info)) - return false; - - /* Fix the symbol flags. */ - if (! elf_fix_symbol_flags (h, eif)) - return false; - - /* If this symbol does not require a PLT entry, and it is not - defined by a dynamic object, or is not referenced by a regular - object, ignore it. We do have to handle a weak defined symbol, - even if no regular object refers to it, if we decided to add it - to the dynamic symbol table. FIXME: Do we normally need to worry - about symbols which are defined by one dynamic object and - referenced by another one? */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0 - && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - || ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0 - && (h->weakdef == NULL || h->weakdef->dynindx == -1)))) - { - h->plt.offset = (bfd_vma) -1; - return true; - } - - /* If we've already adjusted this symbol, don't do it again. This - can happen via a recursive call. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) - return true; - - /* Don't look at this symbol again. Note that we must set this - after checking the above conditions, because we may look at a - symbol once, decide not to do anything, and then get called - recursively later after REF_REGULAR is set below. */ - h->elf_link_hash_flags |= ELF_LINK_HASH_DYNAMIC_ADJUSTED; - - /* If this is a weak definition, and we know a real definition, and - the real symbol is not itself defined by a regular object file, - then get a good value for the real definition. We handle the - real symbol first, for the convenience of the backend routine. - - Note that there is a confusing case here. If the real definition - is defined by a regular object file, we don't get the real symbol - from the dynamic object, but we do get the weak symbol. If the - processor backend uses a COPY reloc, then if some routine in the - dynamic object changes the real symbol, we will not see that - change in the corresponding weak symbol. This is the way other - ELF linkers work as well, and seems to be a result of the shared - library model. - - I will clarify this issue. Most SVR4 shared libraries define the - variable _timezone and define timezone as a weak synonym. The - tzset call changes _timezone. If you write - extern int timezone; - int _timezone = 5; - int main () { tzset (); printf ("%d %d\n", timezone, _timezone); } - you might expect that, since timezone is a synonym for _timezone, - the same number will print both times. However, if the processor - backend uses a COPY reloc, then actually timezone will be copied - into your process image, and, since you define _timezone - yourself, _timezone will not. Thus timezone and _timezone will - wind up at different memory locations. The tzset call will set - _timezone, leaving timezone unchanged. */ - - if (h->weakdef != NULL) - { - /* If we get to this point, we know there is an implicit - reference by a regular object file via the weak symbol H. - FIXME: Is this really true? What if the traversal finds - H->WEAKDEF before it finds H? */ - h->weakdef->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR; - - if (! elf_adjust_dynamic_symbol (h->weakdef, (PTR) eif)) - return false; - } - - /* If a symbol has no type and no size and does not require a PLT - entry, then we are probably about to do the wrong thing here: we - are probably going to create a COPY reloc for an empty object. - This case can arise when a shared object is built with assembly - code, and the assembly code fails to set the symbol type. */ - if (h->size == 0 - && h->type == STT_NOTYPE - && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0) - (*_bfd_error_handler) - (_("warning: type and size of dynamic symbol `%s' are not defined"), - h->root.root.string); - - dynobj = elf_hash_table (eif->info)->dynobj; - bed = get_elf_backend_data (dynobj); - if (! (*bed->elf_backend_adjust_dynamic_symbol) (eif->info, h)) - { - eif->failed = true; - return false; - } - - return true; -} - -/* This routine is used to export all defined symbols into the dynamic - symbol table. It is called via elf_link_hash_traverse. */ - -static boolean -elf_export_symbol (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - struct elf_info_failed *eif = (struct elf_info_failed *) data; - - /* Ignore indirect symbols. These are added by the versioning code. */ - if (h->root.type == bfd_link_hash_indirect) - return true; - - if (h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - if (h->dynindx == -1 - && (h->elf_link_hash_flags - & (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0) - { - struct bfd_elf_version_tree *t; - struct bfd_elf_version_expr *d; - - for (t = eif->verdefs; t != NULL; t = t->next) - { - if (t->globals != NULL) - { - for (d = t->globals; d != NULL; d = d->next) - { - if ((*d->match) (d, h->root.root.string)) - goto doit; - } - } - - if (t->locals != NULL) - { - for (d = t->locals ; d != NULL; d = d->next) - { - if ((*d->match) (d, h->root.root.string)) - return true; - } - } - } - - if (!eif->verdefs) - { - doit: - if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h)) - { - eif->failed = true; - return false; - } - } - } - - return true; -} - -/* Look through the symbols which are defined in other shared - libraries and referenced here. Update the list of version - dependencies. This will be put into the .gnu.version_r section. - This function is called via elf_link_hash_traverse. */ - -static boolean -elf_link_find_version_dependencies (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - struct elf_find_verdep_info *rinfo = (struct elf_find_verdep_info *) data; - Elf_Internal_Verneed *t; - Elf_Internal_Vernaux *a; - bfd_size_type amt; - - if (h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - /* We only care about symbols defined in shared objects with version - information. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 - || h->dynindx == -1 - || h->verinfo.verdef == NULL) - return true; - - /* See if we already know about this version. */ - for (t = elf_tdata (rinfo->output_bfd)->verref; t != NULL; t = t->vn_nextref) - { - if (t->vn_bfd != h->verinfo.verdef->vd_bfd) - continue; - - for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) - if (a->vna_nodename == h->verinfo.verdef->vd_nodename) - return true; - - break; - } - - /* This is a new version. Add it to tree we are building. */ - - if (t == NULL) - { - amt = sizeof *t; - t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->output_bfd, amt); - if (t == NULL) - { - rinfo->failed = true; - return false; - } - - t->vn_bfd = h->verinfo.verdef->vd_bfd; - t->vn_nextref = elf_tdata (rinfo->output_bfd)->verref; - elf_tdata (rinfo->output_bfd)->verref = t; - } - - amt = sizeof *a; - a = (Elf_Internal_Vernaux *) bfd_zalloc (rinfo->output_bfd, amt); - - /* Note that we are copying a string pointer here, and testing it - above. If bfd_elf_string_from_elf_section is ever changed to - discard the string data when low in memory, this will have to be - fixed. */ - a->vna_nodename = h->verinfo.verdef->vd_nodename; - - a->vna_flags = h->verinfo.verdef->vd_flags; - a->vna_nextptr = t->vn_auxptr; - - h->verinfo.verdef->vd_exp_refno = rinfo->vers; - ++rinfo->vers; - - a->vna_other = h->verinfo.verdef->vd_exp_refno + 1; - - t->vn_auxptr = a; - - return true; -} - -/* Figure out appropriate versions for all the symbols. We may not - have the version number script until we have read all of the input - files, so until that point we don't know which symbols should be - local. This function is called via elf_link_hash_traverse. */ - -static boolean -elf_link_assign_sym_version (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - struct elf_assign_sym_version_info *sinfo; - struct bfd_link_info *info; - struct elf_backend_data *bed; - struct elf_info_failed eif; - char *p; - bfd_size_type amt; - - sinfo = (struct elf_assign_sym_version_info *) data; - info = sinfo->info; - - if (h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - /* Fix the symbol flags. */ - eif.failed = false; - eif.info = info; - if (! elf_fix_symbol_flags (h, &eif)) - { - if (eif.failed) - sinfo->failed = true; - return false; - } - - /* We only need version numbers for symbols defined in regular - objects. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - return true; - - bed = get_elf_backend_data (sinfo->output_bfd); - p = strchr (h->root.root.string, ELF_VER_CHR); - if (p != NULL && h->verinfo.vertree == NULL) - { - struct bfd_elf_version_tree *t; - boolean hidden; - - hidden = true; - - /* There are two consecutive ELF_VER_CHR characters if this is - not a hidden symbol. */ - ++p; - if (*p == ELF_VER_CHR) - { - hidden = false; - ++p; - } - - /* If there is no version string, we can just return out. */ - if (*p == '\0') - { - if (hidden) - h->elf_link_hash_flags |= ELF_LINK_HIDDEN; - return true; - } - - /* Look for the version. If we find it, it is no longer weak. */ - for (t = sinfo->verdefs; t != NULL; t = t->next) - { - if (strcmp (t->name, p) == 0) - { - size_t len; - char *alc; - struct bfd_elf_version_expr *d; - - len = p - h->root.root.string; - alc = bfd_malloc ((bfd_size_type) len); - if (alc == NULL) - return false; - memcpy (alc, h->root.root.string, len - 1); - alc[len - 1] = '\0'; - if (alc[len - 2] == ELF_VER_CHR) - alc[len - 2] = '\0'; - - h->verinfo.vertree = t; - t->used = true; - d = NULL; - - if (t->globals != NULL) - { - for (d = t->globals; d != NULL; d = d->next) - if ((*d->match) (d, alc)) - break; - } - - /* See if there is anything to force this symbol to - local scope. */ - if (d == NULL && t->locals != NULL) - { - for (d = t->locals; d != NULL; d = d->next) - { - if ((*d->match) (d, alc)) - { - if (h->dynindx != -1 - && info->shared - && ! info->export_dynamic) - { - (*bed->elf_backend_hide_symbol) (info, h, true); - } - - break; - } - } - } - - free (alc); - break; - } - } - - /* If we are building an application, we need to create a - version node for this version. */ - if (t == NULL && ! info->shared) - { - struct bfd_elf_version_tree **pp; - int version_index; - - /* If we aren't going to export this symbol, we don't need - to worry about it. */ - if (h->dynindx == -1) - return true; - - amt = sizeof *t; - t = ((struct bfd_elf_version_tree *) - bfd_alloc (sinfo->output_bfd, amt)); - if (t == NULL) - { - sinfo->failed = true; - return false; - } - - t->next = NULL; - t->name = p; - t->globals = NULL; - t->locals = NULL; - t->deps = NULL; - t->name_indx = (unsigned int) -1; - t->used = true; - - version_index = 1; - /* Don't count anonymous version tag. */ - if (sinfo->verdefs != NULL && sinfo->verdefs->vernum == 0) - version_index = 0; - for (pp = &sinfo->verdefs; *pp != NULL; pp = &(*pp)->next) - ++version_index; - t->vernum = version_index; - - *pp = t; - - h->verinfo.vertree = t; - } - else if (t == NULL) - { - /* We could not find the version for a symbol when - generating a shared archive. Return an error. */ - (*_bfd_error_handler) - (_("%s: undefined versioned symbol name %s"), - bfd_get_filename (sinfo->output_bfd), h->root.root.string); - bfd_set_error (bfd_error_bad_value); - sinfo->failed = true; - return false; - } - - if (hidden) - h->elf_link_hash_flags |= ELF_LINK_HIDDEN; - } - - /* If we don't have a version for this symbol, see if we can find - something. */ - if (h->verinfo.vertree == NULL && sinfo->verdefs != NULL) - { - struct bfd_elf_version_tree *t; - struct bfd_elf_version_tree *local_ver; - struct bfd_elf_version_expr *d; - - /* See if can find what version this symbol is in. If the - symbol is supposed to be local, then don't actually register - it. */ - local_ver = NULL; - for (t = sinfo->verdefs; t != NULL; t = t->next) - { - if (t->globals != NULL) - { - boolean matched; - - matched = false; - for (d = t->globals; d != NULL; d = d->next) - { - if ((*d->match) (d, h->root.root.string)) - { - if (d->symver) - matched = true; - else - { - /* There is a version without definition. Make - the symbol the default definition for this - version. */ - h->verinfo.vertree = t; - local_ver = NULL; - d->script = 1; - break; - } - } - } - - if (d != NULL) - break; - else if (matched) - /* There is no undefined version for this symbol. Hide the - default one. */ - (*bed->elf_backend_hide_symbol) (info, h, true); - } - - if (t->locals != NULL) - { - for (d = t->locals; d != NULL; d = d->next) - { - /* If the match is "*", keep looking for a more - explicit, perhaps even global, match. */ - if (d->pattern[0] == '*' && d->pattern[1] == '\0') - local_ver = t; - else if ((*d->match) (d, h->root.root.string)) - { - local_ver = t; - break; - } - } - - if (d != NULL) - break; - } - } - - if (local_ver != NULL) - { - h->verinfo.vertree = local_ver; - if (h->dynindx != -1 - && info->shared - && ! info->export_dynamic) - { - (*bed->elf_backend_hide_symbol) (info, h, true); - } - } - } - - return true; -} - -/* Final phase of ELF linker. */ - -/* A structure we use to avoid passing large numbers of arguments. */ - -struct elf_final_link_info -{ - /* General link information. */ - struct bfd_link_info *info; - /* Output BFD. */ - bfd *output_bfd; - /* Symbol string table. */ - struct bfd_strtab_hash *symstrtab; - /* .dynsym section. */ - asection *dynsym_sec; - /* .hash section. */ - asection *hash_sec; - /* symbol version section (.gnu.version). */ - asection *symver_sec; - /* first SHF_TLS section (if any). */ - asection *first_tls_sec; - /* Buffer large enough to hold contents of any section. */ - bfd_byte *contents; - /* Buffer large enough to hold external relocs of any section. */ - PTR external_relocs; - /* Buffer large enough to hold internal relocs of any section. */ - Elf_Internal_Rela *internal_relocs; - /* Buffer large enough to hold external local symbols of any input - BFD. */ - Elf_External_Sym *external_syms; - /* And a buffer for symbol section indices. */ - Elf_External_Sym_Shndx *locsym_shndx; - /* Buffer large enough to hold internal local symbols of any input - BFD. */ - Elf_Internal_Sym *internal_syms; - /* Array large enough to hold a symbol index for each local symbol - of any input BFD. */ - long *indices; - /* Array large enough to hold a section pointer for each local - symbol of any input BFD. */ - asection **sections; - /* Buffer to hold swapped out symbols. */ - Elf_External_Sym *symbuf; - /* And one for symbol section indices. */ - Elf_External_Sym_Shndx *symshndxbuf; - /* Number of swapped out symbols in buffer. */ - size_t symbuf_count; - /* Number of symbols which fit in symbuf. */ - size_t symbuf_size; -}; - -static boolean elf_link_output_sym - PARAMS ((struct elf_final_link_info *, const char *, - Elf_Internal_Sym *, asection *)); -static boolean elf_link_flush_output_syms - PARAMS ((struct elf_final_link_info *)); -static boolean elf_link_output_extsym - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_link_sec_merge_syms - PARAMS ((struct elf_link_hash_entry *, PTR)); -static boolean elf_link_check_versioned_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -static boolean elf_link_input_bfd - PARAMS ((struct elf_final_link_info *, bfd *)); -static boolean elf_reloc_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); - -/* This struct is used to pass information to elf_link_output_extsym. */ - -struct elf_outext_info -{ - boolean failed; - boolean localsyms; - struct elf_final_link_info *finfo; -}; - -/* Compute the size of, and allocate space for, REL_HDR which is the - section header for a section containing relocations for O. */ - -static boolean -elf_link_size_reloc_section (abfd, rel_hdr, o) - bfd *abfd; - Elf_Internal_Shdr *rel_hdr; - asection *o; -{ - bfd_size_type reloc_count; - bfd_size_type num_rel_hashes; - - /* Figure out how many relocations there will be. */ - if (rel_hdr == &elf_section_data (o)->rel_hdr) - reloc_count = elf_section_data (o)->rel_count; - else - reloc_count = elf_section_data (o)->rel_count2; - - num_rel_hashes = o->reloc_count; - if (num_rel_hashes < reloc_count) - num_rel_hashes = reloc_count; - - /* That allows us to calculate the size of the section. */ - rel_hdr->sh_size = rel_hdr->sh_entsize * reloc_count; - - /* The contents field must last into write_object_contents, so we - allocate it with bfd_alloc rather than malloc. Also since we - cannot be sure that the contents will actually be filled in, - we zero the allocated space. */ - rel_hdr->contents = (PTR) bfd_zalloc (abfd, rel_hdr->sh_size); - if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0) - return false; - - /* We only allocate one set of hash entries, so we only do it the - first time we are called. */ - if (elf_section_data (o)->rel_hashes == NULL - && num_rel_hashes) - { - struct elf_link_hash_entry **p; - - p = ((struct elf_link_hash_entry **) - bfd_zmalloc (num_rel_hashes - * sizeof (struct elf_link_hash_entry *))); - if (p == NULL) - return false; - - elf_section_data (o)->rel_hashes = p; - } - - return true; -} - -/* When performing a relocateable link, the input relocations are - preserved. But, if they reference global symbols, the indices - referenced must be updated. Update all the relocations in - REL_HDR (there are COUNT of them), using the data in REL_HASH. */ - -static void -elf_link_adjust_relocs (abfd, rel_hdr, count, rel_hash) - bfd *abfd; - Elf_Internal_Shdr *rel_hdr; - unsigned int count; - struct elf_link_hash_entry **rel_hash; -{ - unsigned int i; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - Elf_Internal_Rel *irel; - Elf_Internal_Rela *irela; - bfd_size_type amt = sizeof (Elf_Internal_Rel) * bed->s->int_rels_per_ext_rel; - - irel = (Elf_Internal_Rel *) bfd_zmalloc (amt); - if (irel == NULL) - { - (*_bfd_error_handler) (_("Error: out of memory")); - abort (); - } - - amt = sizeof (Elf_Internal_Rela) * bed->s->int_rels_per_ext_rel; - irela = (Elf_Internal_Rela *) bfd_zmalloc (amt); - if (irela == NULL) - { - (*_bfd_error_handler) (_("Error: out of memory")); - abort (); - } - - for (i = 0; i < count; i++, rel_hash++) - { - if (*rel_hash == NULL) - continue; - - BFD_ASSERT ((*rel_hash)->indx >= 0); - - if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel)) - { - Elf_External_Rel *erel; - unsigned int j; - - erel = (Elf_External_Rel *) rel_hdr->contents + i; - if (bed->s->swap_reloc_in) - (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, irel); - else - elf_swap_reloc_in (abfd, erel, irel); - - for (j = 0; j < bed->s->int_rels_per_ext_rel; j++) - irel[j].r_info = ELF_R_INFO ((*rel_hash)->indx, - ELF_R_TYPE (irel[j].r_info)); - - if (bed->s->swap_reloc_out) - (*bed->s->swap_reloc_out) (abfd, irel, (bfd_byte *) erel); - else - elf_swap_reloc_out (abfd, irel, erel); - } - else - { - Elf_External_Rela *erela; - unsigned int j; - - BFD_ASSERT (rel_hdr->sh_entsize - == sizeof (Elf_External_Rela)); - - erela = (Elf_External_Rela *) rel_hdr->contents + i; - if (bed->s->swap_reloca_in) - (*bed->s->swap_reloca_in) (abfd, (bfd_byte *) erela, irela); - else - elf_swap_reloca_in (abfd, erela, irela); - - for (j = 0; j < bed->s->int_rels_per_ext_rel; j++) - irela[j].r_info = ELF_R_INFO ((*rel_hash)->indx, - ELF_R_TYPE (irela[j].r_info)); - - if (bed->s->swap_reloca_out) - (*bed->s->swap_reloca_out) (abfd, irela, (bfd_byte *) erela); - else - elf_swap_reloca_out (abfd, irela, erela); - } - } - - free (irel); - free (irela); -} - -struct elf_link_sort_rela -{ - bfd_vma offset; - enum elf_reloc_type_class type; - union - { - Elf_Internal_Rel rel; - Elf_Internal_Rela rela; - } u; -}; - -static int -elf_link_sort_cmp1 (A, B) - const PTR A; - const PTR B; -{ - struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A; - struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B; - int relativea, relativeb; - - relativea = a->type == reloc_class_relative; - relativeb = b->type == reloc_class_relative; - - if (relativea < relativeb) - return 1; - if (relativea > relativeb) - return -1; - if (ELF_R_SYM (a->u.rel.r_info) < ELF_R_SYM (b->u.rel.r_info)) - return -1; - if (ELF_R_SYM (a->u.rel.r_info) > ELF_R_SYM (b->u.rel.r_info)) - return 1; - if (a->u.rel.r_offset < b->u.rel.r_offset) - return -1; - if (a->u.rel.r_offset > b->u.rel.r_offset) - return 1; - return 0; -} - -static int -elf_link_sort_cmp2 (A, B) - const PTR A; - const PTR B; -{ - struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A; - struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B; - int copya, copyb; - - if (a->offset < b->offset) - return -1; - if (a->offset > b->offset) - return 1; - copya = (a->type == reloc_class_copy) * 2 + (a->type == reloc_class_plt); - copyb = (b->type == reloc_class_copy) * 2 + (b->type == reloc_class_plt); - if (copya < copyb) - return -1; - if (copya > copyb) - return 1; - if (a->u.rel.r_offset < b->u.rel.r_offset) - return -1; - if (a->u.rel.r_offset > b->u.rel.r_offset) - return 1; - return 0; -} - -static size_t -elf_link_sort_relocs (abfd, info, psec) - bfd *abfd; - struct bfd_link_info *info; - asection **psec; -{ - bfd *dynobj = elf_hash_table (info)->dynobj; - asection *reldyn, *o; - boolean rel = false; - bfd_size_type count, size; - size_t i, j, ret; - struct elf_link_sort_rela *rela; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - - reldyn = bfd_get_section_by_name (abfd, ".rela.dyn"); - if (reldyn == NULL || reldyn->_raw_size == 0) - { - reldyn = bfd_get_section_by_name (abfd, ".rel.dyn"); - if (reldyn == NULL || reldyn->_raw_size == 0) - return 0; - rel = true; - count = reldyn->_raw_size / sizeof (Elf_External_Rel); - } - else - count = reldyn->_raw_size / sizeof (Elf_External_Rela); - - size = 0; - for (o = dynobj->sections; o != NULL; o = o->next) - if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)) - == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED) - && o->output_section == reldyn) - size += o->_raw_size; - - if (size != reldyn->_raw_size) - return 0; - - rela = (struct elf_link_sort_rela *) bfd_zmalloc (sizeof (*rela) * count); - if (rela == NULL) - { - (*info->callbacks->warning) - (info, _("Not enough memory to sort relocations"), 0, abfd, 0, - (bfd_vma) 0); - return 0; - } - - for (o = dynobj->sections; o != NULL; o = o->next) - if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)) - == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED) - && o->output_section == reldyn) - { - if (rel) - { - Elf_External_Rel *erel, *erelend; - struct elf_link_sort_rela *s; - - erel = (Elf_External_Rel *) o->contents; - erelend = (Elf_External_Rel *) (o->contents + o->_raw_size); - s = rela + o->output_offset / sizeof (Elf_External_Rel); - for (; erel < erelend; erel++, s++) - { - if (bed->s->swap_reloc_in) - (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, &s->u.rel); - else - elf_swap_reloc_in (abfd, erel, &s->u.rel); - - s->type = (*bed->elf_backend_reloc_type_class) (&s->u.rela); - } - } - else - { - Elf_External_Rela *erela, *erelaend; - struct elf_link_sort_rela *s; - - erela = (Elf_External_Rela *) o->contents; - erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size); - s = rela + o->output_offset / sizeof (Elf_External_Rela); - for (; erela < erelaend; erela++, s++) - { - if (bed->s->swap_reloca_in) - (*bed->s->swap_reloca_in) (dynobj, (bfd_byte *) erela, - &s->u.rela); - else - elf_swap_reloca_in (dynobj, erela, &s->u.rela); - - s->type = (*bed->elf_backend_reloc_type_class) (&s->u.rela); - } - } - } - - qsort (rela, (size_t) count, sizeof (*rela), elf_link_sort_cmp1); - for (ret = 0; ret < count && rela[ret].type == reloc_class_relative; ret++) - ; - for (i = ret, j = ret; i < count; i++) - { - if (ELF_R_SYM (rela[i].u.rel.r_info) != ELF_R_SYM (rela[j].u.rel.r_info)) - j = i; - rela[i].offset = rela[j].u.rel.r_offset; - } - qsort (rela + ret, (size_t) count - ret, sizeof (*rela), elf_link_sort_cmp2); - - for (o = dynobj->sections; o != NULL; o = o->next) - if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)) - == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED) - && o->output_section == reldyn) - { - if (rel) - { - Elf_External_Rel *erel, *erelend; - struct elf_link_sort_rela *s; - - erel = (Elf_External_Rel *) o->contents; - erelend = (Elf_External_Rel *) (o->contents + o->_raw_size); - s = rela + o->output_offset / sizeof (Elf_External_Rel); - for (; erel < erelend; erel++, s++) - { - if (bed->s->swap_reloc_out) - (*bed->s->swap_reloc_out) (abfd, &s->u.rel, - (bfd_byte *) erel); - else - elf_swap_reloc_out (abfd, &s->u.rel, erel); - } - } - else - { - Elf_External_Rela *erela, *erelaend; - struct elf_link_sort_rela *s; - - erela = (Elf_External_Rela *) o->contents; - erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size); - s = rela + o->output_offset / sizeof (Elf_External_Rela); - for (; erela < erelaend; erela++, s++) - { - if (bed->s->swap_reloca_out) - (*bed->s->swap_reloca_out) (dynobj, &s->u.rela, - (bfd_byte *) erela); - else - elf_swap_reloca_out (dynobj, &s->u.rela, erela); - } - } - } - - free (rela); - *psec = reldyn; - return ret; -} - -/* Do the final step of an ELF link. */ - -boolean -elf_bfd_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - boolean dynamic; - boolean emit_relocs; - bfd *dynobj; - struct elf_final_link_info finfo; - register asection *o; - register struct bfd_link_order *p; - register bfd *sub; - bfd_size_type max_contents_size; - bfd_size_type max_external_reloc_size; - bfd_size_type max_internal_reloc_count; - bfd_size_type max_sym_count; - bfd_size_type max_sym_shndx_count; - file_ptr off; - Elf_Internal_Sym elfsym; - unsigned int i; - Elf_Internal_Shdr *symtab_hdr; - Elf_Internal_Shdr *symstrtab_hdr; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - struct elf_outext_info eoinfo; - boolean merged; - size_t relativecount = 0; - asection *reldyn = 0; - bfd_size_type amt; - - if (! is_elf_hash_table (info)) - return false; - - if (info->shared) - abfd->flags |= DYNAMIC; - - dynamic = elf_hash_table (info)->dynamic_sections_created; - dynobj = elf_hash_table (info)->dynobj; - - emit_relocs = (info->relocateable - || info->emitrelocations - || bed->elf_backend_emit_relocs); - - finfo.info = info; - finfo.output_bfd = abfd; - finfo.symstrtab = elf_stringtab_init (); - if (finfo.symstrtab == NULL) - return false; - - if (! dynamic) - { - finfo.dynsym_sec = NULL; - finfo.hash_sec = NULL; - finfo.symver_sec = NULL; - } - else - { - finfo.dynsym_sec = bfd_get_section_by_name (dynobj, ".dynsym"); - finfo.hash_sec = bfd_get_section_by_name (dynobj, ".hash"); - BFD_ASSERT (finfo.dynsym_sec != NULL && finfo.hash_sec != NULL); - finfo.symver_sec = bfd_get_section_by_name (dynobj, ".gnu.version"); - /* Note that it is OK if symver_sec is NULL. */ - } - - finfo.contents = NULL; - finfo.external_relocs = NULL; - finfo.internal_relocs = NULL; - finfo.external_syms = NULL; - finfo.locsym_shndx = NULL; - finfo.internal_syms = NULL; - finfo.indices = NULL; - finfo.sections = NULL; - finfo.symbuf = NULL; - finfo.symshndxbuf = NULL; - finfo.symbuf_count = 0; - finfo.first_tls_sec = NULL; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - if ((o->flags & SEC_THREAD_LOCAL) != 0 - && (o->flags & SEC_LOAD) != 0) - { - finfo.first_tls_sec = o; - break; - } - - /* Count up the number of relocations we will output for each output - section, so that we know the sizes of the reloc sections. We - also figure out some maximum sizes. */ - max_contents_size = 0; - max_external_reloc_size = 0; - max_internal_reloc_count = 0; - max_sym_count = 0; - max_sym_shndx_count = 0; - merged = false; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - o->reloc_count = 0; - - for (p = o->link_order_head; p != NULL; p = p->next) - { - if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - ++o->reloc_count; - else if (p->type == bfd_indirect_link_order) - { - asection *sec; - - sec = p->u.indirect.section; - - /* Mark all sections which are to be included in the - link. This will normally be every section. We need - to do this so that we can identify any sections which - the linker has decided to not include. */ - sec->linker_mark = true; - - if (sec->flags & SEC_MERGE) - merged = true; - - if (info->relocateable || info->emitrelocations) - o->reloc_count += sec->reloc_count; - else if (bed->elf_backend_count_relocs) - { - Elf_Internal_Rela * relocs; - - relocs = (NAME(_bfd_elf,link_read_relocs) - (abfd, sec, (PTR) NULL, - (Elf_Internal_Rela *) NULL, info->keep_memory)); - - o->reloc_count - += (*bed->elf_backend_count_relocs) (sec, relocs); - - if (elf_section_data (o)->relocs != relocs) - free (relocs); - } - - if (sec->_raw_size > max_contents_size) - max_contents_size = sec->_raw_size; - if (sec->_cooked_size > max_contents_size) - max_contents_size = sec->_cooked_size; - - /* We are interested in just local symbols, not all - symbols. */ - if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour - && (sec->owner->flags & DYNAMIC) == 0) - { - size_t sym_count; - - if (elf_bad_symtab (sec->owner)) - sym_count = (elf_tdata (sec->owner)->symtab_hdr.sh_size - / sizeof (Elf_External_Sym)); - else - sym_count = elf_tdata (sec->owner)->symtab_hdr.sh_info; - - if (sym_count > max_sym_count) - max_sym_count = sym_count; - - if (sym_count > max_sym_shndx_count - && elf_symtab_shndx (sec->owner) != 0) - max_sym_shndx_count = sym_count; - - if ((sec->flags & SEC_RELOC) != 0) - { - size_t ext_size; - - ext_size = elf_section_data (sec)->rel_hdr.sh_size; - if (ext_size > max_external_reloc_size) - max_external_reloc_size = ext_size; - if (sec->reloc_count > max_internal_reloc_count) - max_internal_reloc_count = sec->reloc_count; - } - } - } - } - - if (o->reloc_count > 0) - o->flags |= SEC_RELOC; - else - { - /* Explicitly clear the SEC_RELOC flag. The linker tends to - set it (this is probably a bug) and if it is set - assign_section_numbers will create a reloc section. */ - o->flags &=~ SEC_RELOC; - } - - /* If the SEC_ALLOC flag is not set, force the section VMA to - zero. This is done in elf_fake_sections as well, but forcing - the VMA to 0 here will ensure that relocs against these - sections are handled correctly. */ - if ((o->flags & SEC_ALLOC) == 0 - && ! o->user_set_vma) - o->vma = 0; - } - - if (! info->relocateable && merged) - elf_link_hash_traverse (elf_hash_table (info), - elf_link_sec_merge_syms, (PTR) abfd); - - /* Figure out the file positions for everything but the symbol table - and the relocs. We set symcount to force assign_section_numbers - to create a symbol table. */ - bfd_get_symcount (abfd) = info->strip == strip_all ? 0 : 1; - BFD_ASSERT (! abfd->output_has_begun); - if (! _bfd_elf_compute_section_file_positions (abfd, info)) - goto error_return; - - /* Figure out how many relocations we will have in each section. - Just using RELOC_COUNT isn't good enough since that doesn't - maintain a separate value for REL vs. RELA relocations. */ - if (emit_relocs) - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - for (o = sub->sections; o != NULL; o = o->next) - { - asection *output_section; - - if (! o->linker_mark) - { - /* This section was omitted from the link. */ - continue; - } - - output_section = o->output_section; - - if (output_section != NULL - && (o->flags & SEC_RELOC) != 0) - { - struct bfd_elf_section_data *esdi - = elf_section_data (o); - struct bfd_elf_section_data *esdo - = elf_section_data (output_section); - unsigned int *rel_count; - unsigned int *rel_count2; - bfd_size_type entsize; - bfd_size_type entsize2; - - /* We must be careful to add the relocations from the - input section to the right output count. */ - entsize = esdi->rel_hdr.sh_entsize; - entsize2 = esdi->rel_hdr2 ? esdi->rel_hdr2->sh_entsize : 0; - BFD_ASSERT ((entsize == sizeof (Elf_External_Rel) - || entsize == sizeof (Elf_External_Rela)) - && entsize2 != entsize - && (entsize2 == 0 - || entsize2 == sizeof (Elf_External_Rel) - || entsize2 == sizeof (Elf_External_Rela))); - if (entsize == esdo->rel_hdr.sh_entsize) - { - rel_count = &esdo->rel_count; - rel_count2 = &esdo->rel_count2; - } - else - { - rel_count = &esdo->rel_count2; - rel_count2 = &esdo->rel_count; - } - - *rel_count += NUM_SHDR_ENTRIES (& esdi->rel_hdr); - if (esdi->rel_hdr2) - *rel_count2 += NUM_SHDR_ENTRIES (esdi->rel_hdr2); - output_section->flags |= SEC_RELOC; - } - } - - /* That created the reloc sections. Set their sizes, and assign - them file positions, and allocate some buffers. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_RELOC) != 0) - { - if (!elf_link_size_reloc_section (abfd, - &elf_section_data (o)->rel_hdr, - o)) - goto error_return; - - if (elf_section_data (o)->rel_hdr2 - && !elf_link_size_reloc_section (abfd, - elf_section_data (o)->rel_hdr2, - o)) - goto error_return; - } - - /* Now, reset REL_COUNT and REL_COUNT2 so that we can use them - to count upwards while actually outputting the relocations. */ - elf_section_data (o)->rel_count = 0; - elf_section_data (o)->rel_count2 = 0; - } - - _bfd_elf_assign_file_positions_for_relocs (abfd); - - /* We have now assigned file positions for all the sections except - .symtab and .strtab. We start the .symtab section at the current - file position, and write directly to it. We build the .strtab - section in memory. */ - bfd_get_symcount (abfd) = 0; - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - /* sh_name is set in prep_headers. */ - symtab_hdr->sh_type = SHT_SYMTAB; - symtab_hdr->sh_flags = 0; - symtab_hdr->sh_addr = 0; - symtab_hdr->sh_size = 0; - symtab_hdr->sh_entsize = sizeof (Elf_External_Sym); - /* sh_link is set in assign_section_numbers. */ - /* sh_info is set below. */ - /* sh_offset is set just below. */ - symtab_hdr->sh_addralign = bed->s->file_align; - - off = elf_tdata (abfd)->next_file_pos; - off = _bfd_elf_assign_file_position_for_section (symtab_hdr, off, true); - - /* Note that at this point elf_tdata (abfd)->next_file_pos is - incorrect. We do not yet know the size of the .symtab section. - We correct next_file_pos below, after we do know the size. */ - - /* Allocate a buffer to hold swapped out symbols. This is to avoid - continuously seeking to the right position in the file. */ - if (! info->keep_memory || max_sym_count < 20) - finfo.symbuf_size = 20; - else - finfo.symbuf_size = max_sym_count; - amt = finfo.symbuf_size; - amt *= sizeof (Elf_External_Sym); - finfo.symbuf = (Elf_External_Sym *) bfd_malloc (amt); - if (finfo.symbuf == NULL) - goto error_return; - if (elf_numsections (abfd) > SHN_LORESERVE) - { - amt = finfo.symbuf_size; - amt *= sizeof (Elf_External_Sym_Shndx); - finfo.symshndxbuf = (Elf_External_Sym_Shndx *) bfd_malloc (amt); - if (finfo.symshndxbuf == NULL) - goto error_return; - } - - /* Start writing out the symbol table. The first symbol is always a - dummy symbol. */ - if (info->strip != strip_all - || emit_relocs) - { - elfsym.st_value = 0; - elfsym.st_size = 0; - elfsym.st_info = 0; - elfsym.st_other = 0; - elfsym.st_shndx = SHN_UNDEF; - if (! elf_link_output_sym (&finfo, (const char *) NULL, - &elfsym, bfd_und_section_ptr)) - goto error_return; - } - -#if 0 - /* Some standard ELF linkers do this, but we don't because it causes - bootstrap comparison failures. */ - /* Output a file symbol for the output file as the second symbol. - We output this even if we are discarding local symbols, although - I'm not sure if this is correct. */ - elfsym.st_value = 0; - elfsym.st_size = 0; - elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE); - elfsym.st_other = 0; - elfsym.st_shndx = SHN_ABS; - if (! elf_link_output_sym (&finfo, bfd_get_filename (abfd), - &elfsym, bfd_abs_section_ptr)) - goto error_return; -#endif - - /* Output a symbol for each section. We output these even if we are - discarding local symbols, since they are used for relocs. These - symbols have no names. We store the index of each one in the - index field of the section, so that we can find it again when - outputting relocs. */ - if (info->strip != strip_all - || emit_relocs) - { - elfsym.st_size = 0; - elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); - elfsym.st_other = 0; - for (i = 1; i < elf_numsections (abfd); i++) - { - o = section_from_elf_index (abfd, i); - if (o != NULL) - o->target_index = bfd_get_symcount (abfd); - elfsym.st_shndx = i; - if (info->relocateable || o == NULL) - elfsym.st_value = 0; - else - elfsym.st_value = o->vma; - if (! elf_link_output_sym (&finfo, (const char *) NULL, - &elfsym, o)) - goto error_return; - if (i == SHN_LORESERVE) - i += SHN_HIRESERVE + 1 - SHN_LORESERVE; - } - } - - /* Allocate some memory to hold information read in from the input - files. */ - if (max_contents_size != 0) - { - finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size); - if (finfo.contents == NULL) - goto error_return; - } - - if (max_external_reloc_size != 0) - { - finfo.external_relocs = (PTR) bfd_malloc (max_external_reloc_size); - if (finfo.external_relocs == NULL) - goto error_return; - } - - if (max_internal_reloc_count != 0) - { - amt = max_internal_reloc_count * bed->s->int_rels_per_ext_rel; - amt *= sizeof (Elf_Internal_Rela); - finfo.internal_relocs = (Elf_Internal_Rela *) bfd_malloc (amt); - if (finfo.internal_relocs == NULL) - goto error_return; - } - - if (max_sym_count != 0) - { - amt = max_sym_count * sizeof (Elf_External_Sym); - finfo.external_syms = (Elf_External_Sym *) bfd_malloc (amt); - if (finfo.external_syms == NULL) - goto error_return; - - amt = max_sym_count * sizeof (Elf_Internal_Sym); - finfo.internal_syms = (Elf_Internal_Sym *) bfd_malloc (amt); - if (finfo.internal_syms == NULL) - goto error_return; - - amt = max_sym_count * sizeof (long); - finfo.indices = (long *) bfd_malloc (amt); - if (finfo.indices == NULL) - goto error_return; - - amt = max_sym_count * sizeof (asection *); - finfo.sections = (asection **) bfd_malloc (amt); - if (finfo.sections == NULL) - goto error_return; - } - - if (max_sym_shndx_count != 0) - { - amt = max_sym_shndx_count * sizeof (Elf_External_Sym_Shndx); - finfo.locsym_shndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt); - if (finfo.locsym_shndx == NULL) - goto error_return; - } - - if (finfo.first_tls_sec) - { - unsigned int align = 0; - bfd_vma base = finfo.first_tls_sec->vma, end = 0; - asection *sec; - - for (sec = finfo.first_tls_sec; - sec && (sec->flags & SEC_THREAD_LOCAL); - sec = sec->next) - { - bfd_vma size = sec->_raw_size; - - if (bfd_get_section_alignment (abfd, sec) > align) - align = bfd_get_section_alignment (abfd, sec); - if (sec->_raw_size == 0 && (sec->flags & SEC_HAS_CONTENTS) == 0) - { - struct bfd_link_order *o; - - size = 0; - for (o = sec->link_order_head; o != NULL; o = o->next) - if (size < o->offset + o->size) - size = o->offset + o->size; - } - end = sec->vma + size; - } - elf_hash_table (info)->tls_segment - = bfd_zalloc (abfd, sizeof (struct elf_link_tls_segment)); - if (elf_hash_table (info)->tls_segment == NULL) - goto error_return; - elf_hash_table (info)->tls_segment->start = base; - elf_hash_table (info)->tls_segment->size = end - base; - elf_hash_table (info)->tls_segment->align = align; - } - - /* Since ELF permits relocations to be against local symbols, we - must have the local symbols available when we do the relocations. - Since we would rather only read the local symbols once, and we - would rather not keep them in memory, we handle all the - relocations for a single input file at the same time. - - Unfortunately, there is no way to know the total number of local - symbols until we have seen all of them, and the local symbol - indices precede the global symbol indices. This means that when - we are generating relocateable output, and we see a reloc against - a global symbol, we can not know the symbol index until we have - finished examining all the local symbols to see which ones we are - going to output. To deal with this, we keep the relocations in - memory, and don't output them until the end of the link. This is - an unfortunate waste of memory, but I don't see a good way around - it. Fortunately, it only happens when performing a relocateable - link, which is not the common case. FIXME: If keep_memory is set - we could write the relocs out and then read them again; I don't - know how bad the memory loss will be. */ - - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - sub->output_has_begun = false; - for (o = abfd->sections; o != NULL; o = o->next) - { - for (p = o->link_order_head; p != NULL; p = p->next) - { - if (p->type == bfd_indirect_link_order - && (bfd_get_flavour ((sub = p->u.indirect.section->owner)) - == bfd_target_elf_flavour) - && elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass) - { - if (! sub->output_has_begun) - { - if (! elf_link_input_bfd (&finfo, sub)) - goto error_return; - sub->output_has_begun = true; - } - } - else if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - { - if (! elf_reloc_link_order (abfd, info, o, p)) - goto error_return; - } - else - { - if (! _bfd_default_link_order (abfd, info, o, p)) - goto error_return; - } - } - } - - /* Output any global symbols that got converted to local in a - version script or due to symbol visibility. We do this in a - separate step since ELF requires all local symbols to appear - prior to any global symbols. FIXME: We should only do this if - some global symbols were, in fact, converted to become local. - FIXME: Will this work correctly with the Irix 5 linker? */ - eoinfo.failed = false; - eoinfo.finfo = &finfo; - eoinfo.localsyms = true; - elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym, - (PTR) &eoinfo); - if (eoinfo.failed) - return false; - - /* That wrote out all the local symbols. Finish up the symbol table - with the global symbols. Even if we want to strip everything we - can, we still need to deal with those global symbols that got - converted to local in a version script. */ - - /* The sh_info field records the index of the first non local symbol. */ - symtab_hdr->sh_info = bfd_get_symcount (abfd); - - if (dynamic - && finfo.dynsym_sec->output_section != bfd_abs_section_ptr) - { - Elf_Internal_Sym sym; - Elf_External_Sym *dynsym = - (Elf_External_Sym *) finfo.dynsym_sec->contents; - long last_local = 0; - - /* Write out the section symbols for the output sections. */ - if (info->shared) - { - asection *s; - - sym.st_size = 0; - sym.st_name = 0; - sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); - sym.st_other = 0; - - for (s = abfd->sections; s != NULL; s = s->next) - { - int indx; - Elf_External_Sym *dest; - - indx = elf_section_data (s)->this_idx; - BFD_ASSERT (indx > 0); - sym.st_shndx = indx; - sym.st_value = s->vma; - dest = dynsym + elf_section_data (s)->dynindx; - elf_swap_symbol_out (abfd, &sym, (PTR) dest, (PTR) 0); - } - - last_local = bfd_count_sections (abfd); - } - - /* Write out the local dynsyms. */ - if (elf_hash_table (info)->dynlocal) - { - struct elf_link_local_dynamic_entry *e; - for (e = elf_hash_table (info)->dynlocal; e ; e = e->next) - { - asection *s; - Elf_External_Sym *dest; - - sym.st_size = e->isym.st_size; - sym.st_other = e->isym.st_other; - - /* Copy the internal symbol as is. - Note that we saved a word of storage and overwrote - the original st_name with the dynstr_index. */ - sym = e->isym; - - if (e->isym.st_shndx != SHN_UNDEF - && (e->isym.st_shndx < SHN_LORESERVE - || e->isym.st_shndx > SHN_HIRESERVE)) - { - s = bfd_section_from_elf_index (e->input_bfd, - e->isym.st_shndx); - - sym.st_shndx = - elf_section_data (s->output_section)->this_idx; - sym.st_value = (s->output_section->vma - + s->output_offset - + e->isym.st_value); - } - - if (last_local < e->dynindx) - last_local = e->dynindx; - - dest = dynsym + e->dynindx; - elf_swap_symbol_out (abfd, &sym, (PTR) dest, (PTR) 0); - } - } - - elf_section_data (finfo.dynsym_sec->output_section)->this_hdr.sh_info = - last_local + 1; - } - - /* We get the global symbols from the hash table. */ - eoinfo.failed = false; - eoinfo.localsyms = false; - eoinfo.finfo = &finfo; - elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym, - (PTR) &eoinfo); - if (eoinfo.failed) - return false; - - /* If backend needs to output some symbols not present in the hash - table, do it now. */ - if (bed->elf_backend_output_arch_syms) - { - typedef boolean (*out_sym_func) PARAMS ((PTR, const char *, - Elf_Internal_Sym *, - asection *)); - - if (! ((*bed->elf_backend_output_arch_syms) - (abfd, info, (PTR) &finfo, (out_sym_func) elf_link_output_sym))) - return false; - } - - /* Flush all symbols to the file. */ - if (! elf_link_flush_output_syms (&finfo)) - return false; - - /* Now we know the size of the symtab section. */ - off += symtab_hdr->sh_size; - - /* Finish up and write out the symbol string table (.strtab) - section. */ - symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr; - /* sh_name was set in prep_headers. */ - symstrtab_hdr->sh_type = SHT_STRTAB; - symstrtab_hdr->sh_flags = 0; - symstrtab_hdr->sh_addr = 0; - symstrtab_hdr->sh_size = _bfd_stringtab_size (finfo.symstrtab); - symstrtab_hdr->sh_entsize = 0; - symstrtab_hdr->sh_link = 0; - symstrtab_hdr->sh_info = 0; - /* sh_offset is set just below. */ - symstrtab_hdr->sh_addralign = 1; - - off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, off, true); - elf_tdata (abfd)->next_file_pos = off; - - if (bfd_get_symcount (abfd) > 0) - { - if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0 - || ! _bfd_stringtab_emit (abfd, finfo.symstrtab)) - return false; - } - - /* Adjust the relocs to have the correct symbol indices. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_RELOC) == 0) - continue; - - elf_link_adjust_relocs (abfd, &elf_section_data (o)->rel_hdr, - elf_section_data (o)->rel_count, - elf_section_data (o)->rel_hashes); - if (elf_section_data (o)->rel_hdr2 != NULL) - elf_link_adjust_relocs (abfd, elf_section_data (o)->rel_hdr2, - elf_section_data (o)->rel_count2, - (elf_section_data (o)->rel_hashes - + elf_section_data (o)->rel_count)); - - /* Set the reloc_count field to 0 to prevent write_relocs from - trying to swap the relocs out itself. */ - o->reloc_count = 0; - } - - if (dynamic && info->combreloc && dynobj != NULL) - relativecount = elf_link_sort_relocs (abfd, info, &reldyn); - - /* If we are linking against a dynamic object, or generating a - shared library, finish up the dynamic linking information. */ - if (dynamic) - { - Elf_External_Dyn *dyncon, *dynconend; - - /* Fix up .dynamic entries. */ - o = bfd_get_section_by_name (dynobj, ".dynamic"); - BFD_ASSERT (o != NULL); - - dyncon = (Elf_External_Dyn *) o->contents; - dynconend = (Elf_External_Dyn *) (o->contents + o->_raw_size); - for (; dyncon < dynconend; dyncon++) - { - Elf_Internal_Dyn dyn; - const char *name; - unsigned int type; - - elf_swap_dyn_in (dynobj, dyncon, &dyn); - - switch (dyn.d_tag) - { - default: - break; - case DT_NULL: - if (relativecount > 0 && dyncon + 1 < dynconend) - { - switch (elf_section_data (reldyn)->this_hdr.sh_type) - { - case SHT_REL: dyn.d_tag = DT_RELCOUNT; break; - case SHT_RELA: dyn.d_tag = DT_RELACOUNT; break; - default: break; - } - if (dyn.d_tag != DT_NULL) - { - dyn.d_un.d_val = relativecount; - elf_swap_dyn_out (dynobj, &dyn, dyncon); - relativecount = 0; - } - } - break; - case DT_INIT: - name = info->init_function; - goto get_sym; - case DT_FINI: - name = info->fini_function; - get_sym: - { - struct elf_link_hash_entry *h; - - h = elf_link_hash_lookup (elf_hash_table (info), name, - false, false, true); - if (h != NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) - { - dyn.d_un.d_val = h->root.u.def.value; - o = h->root.u.def.section; - if (o->output_section != NULL) - dyn.d_un.d_val += (o->output_section->vma - + o->output_offset); - else - { - /* The symbol is imported from another shared - library and does not apply to this one. */ - dyn.d_un.d_val = 0; - } - - elf_swap_dyn_out (dynobj, &dyn, dyncon); - } - } - break; - - case DT_PREINIT_ARRAYSZ: - name = ".preinit_array"; - goto get_size; - case DT_INIT_ARRAYSZ: - name = ".init_array"; - goto get_size; - case DT_FINI_ARRAYSZ: - name = ".fini_array"; - get_size: - o = bfd_get_section_by_name (abfd, name); - if (o == NULL) - { - (*_bfd_error_handler) - (_("%s: could not find output section %s"), - bfd_get_filename (abfd), name); - goto error_return; - } - if (o->_raw_size == 0) - (*_bfd_error_handler) - (_("warning: %s section has zero size"), name); - dyn.d_un.d_val = o->_raw_size; - elf_swap_dyn_out (dynobj, &dyn, dyncon); - break; - - case DT_PREINIT_ARRAY: - name = ".preinit_array"; - goto get_vma; - case DT_INIT_ARRAY: - name = ".init_array"; - goto get_vma; - case DT_FINI_ARRAY: - name = ".fini_array"; - goto get_vma; - - case DT_HASH: - name = ".hash"; - goto get_vma; - case DT_STRTAB: - name = ".dynstr"; - goto get_vma; - case DT_SYMTAB: - name = ".dynsym"; - goto get_vma; - case DT_VERDEF: - name = ".gnu.version_d"; - goto get_vma; - case DT_VERNEED: - name = ".gnu.version_r"; - goto get_vma; - case DT_VERSYM: - name = ".gnu.version"; - get_vma: - o = bfd_get_section_by_name (abfd, name); - if (o == NULL) - { - (*_bfd_error_handler) - (_("%s: could not find output section %s"), - bfd_get_filename (abfd), name); - goto error_return; - } - dyn.d_un.d_ptr = o->vma; - elf_swap_dyn_out (dynobj, &dyn, dyncon); - break; - - case DT_REL: - case DT_RELA: - case DT_RELSZ: - case DT_RELASZ: - if (dyn.d_tag == DT_REL || dyn.d_tag == DT_RELSZ) - type = SHT_REL; - else - type = SHT_RELA; - dyn.d_un.d_val = 0; - for (i = 1; i < elf_numsections (abfd); i++) - { - Elf_Internal_Shdr *hdr; - - hdr = elf_elfsections (abfd)[i]; - if (hdr->sh_type == type - && (hdr->sh_flags & SHF_ALLOC) != 0) - { - if (dyn.d_tag == DT_RELSZ || dyn.d_tag == DT_RELASZ) - dyn.d_un.d_val += hdr->sh_size; - else - { - if (dyn.d_un.d_val == 0 - || hdr->sh_addr < dyn.d_un.d_val) - dyn.d_un.d_val = hdr->sh_addr; - } - } - } - elf_swap_dyn_out (dynobj, &dyn, dyncon); - break; - } - } - } - - /* If we have created any dynamic sections, then output them. */ - if (dynobj != NULL) - { - if (! (*bed->elf_backend_finish_dynamic_sections) (abfd, info)) - goto error_return; - - for (o = dynobj->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_HAS_CONTENTS) == 0 - || o->_raw_size == 0 - || o->output_section == bfd_abs_section_ptr) - continue; - if ((o->flags & SEC_LINKER_CREATED) == 0) - { - /* At this point, we are only interested in sections - created by elf_link_create_dynamic_sections. */ - continue; - } - if ((elf_section_data (o->output_section)->this_hdr.sh_type - != SHT_STRTAB) - || strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0) - { - if (! bfd_set_section_contents (abfd, o->output_section, - o->contents, - (file_ptr) o->output_offset, - o->_raw_size)) - goto error_return; - } - else - { - /* The contents of the .dynstr section are actually in a - stringtab. */ - off = elf_section_data (o->output_section)->this_hdr.sh_offset; - if (bfd_seek (abfd, off, SEEK_SET) != 0 - || ! _bfd_elf_strtab_emit (abfd, - elf_hash_table (info)->dynstr)) - goto error_return; - } - } - } - - if (info->relocateable) - { - boolean failed = false; - - bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed); - if (failed) - goto error_return; - } - - /* If we have optimized stabs strings, output them. */ - if (elf_hash_table (info)->stab_info != NULL) - { - if (! _bfd_write_stab_strings (abfd, &elf_hash_table (info)->stab_info)) - goto error_return; - } - - if (info->eh_frame_hdr && elf_hash_table (info)->dynobj) - { - o = bfd_get_section_by_name (elf_hash_table (info)->dynobj, - ".eh_frame_hdr"); - if (o - && (elf_section_data (o)->sec_info_type - == ELF_INFO_TYPE_EH_FRAME_HDR)) - { - if (! _bfd_elf_write_section_eh_frame_hdr (abfd, o)) - goto error_return; - } - } - - if (finfo.symstrtab != NULL) - _bfd_stringtab_free (finfo.symstrtab); - if (finfo.contents != NULL) - free (finfo.contents); - if (finfo.external_relocs != NULL) - free (finfo.external_relocs); - if (finfo.internal_relocs != NULL) - free (finfo.internal_relocs); - if (finfo.external_syms != NULL) - free (finfo.external_syms); - if (finfo.locsym_shndx != NULL) - free (finfo.locsym_shndx); - if (finfo.internal_syms != NULL) - free (finfo.internal_syms); - if (finfo.indices != NULL) - free (finfo.indices); - if (finfo.sections != NULL) - free (finfo.sections); - if (finfo.symbuf != NULL) - free (finfo.symbuf); - if (finfo.symshndxbuf != NULL) - free (finfo.symbuf); - for (o = abfd->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_RELOC) != 0 - && elf_section_data (o)->rel_hashes != NULL) - free (elf_section_data (o)->rel_hashes); - } - - elf_tdata (abfd)->linker = true; - - return true; - - error_return: - if (finfo.symstrtab != NULL) - _bfd_stringtab_free (finfo.symstrtab); - if (finfo.contents != NULL) - free (finfo.contents); - if (finfo.external_relocs != NULL) - free (finfo.external_relocs); - if (finfo.internal_relocs != NULL) - free (finfo.internal_relocs); - if (finfo.external_syms != NULL) - free (finfo.external_syms); - if (finfo.locsym_shndx != NULL) - free (finfo.locsym_shndx); - if (finfo.internal_syms != NULL) - free (finfo.internal_syms); - if (finfo.indices != NULL) - free (finfo.indices); - if (finfo.sections != NULL) - free (finfo.sections); - if (finfo.symbuf != NULL) - free (finfo.symbuf); - if (finfo.symshndxbuf != NULL) - free (finfo.symbuf); - for (o = abfd->sections; o != NULL; o = o->next) - { - if ((o->flags & SEC_RELOC) != 0 - && elf_section_data (o)->rel_hashes != NULL) - free (elf_section_data (o)->rel_hashes); - } - - return false; -} - -/* Add a symbol to the output symbol table. */ - -static boolean -elf_link_output_sym (finfo, name, elfsym, input_sec) - struct elf_final_link_info *finfo; - const char *name; - Elf_Internal_Sym *elfsym; - asection *input_sec; -{ - Elf_External_Sym *dest; - Elf_External_Sym_Shndx *destshndx; - - boolean (*output_symbol_hook) PARAMS ((bfd *, - struct bfd_link_info *info, - const char *, - Elf_Internal_Sym *, - asection *)); - - output_symbol_hook = get_elf_backend_data (finfo->output_bfd)-> - elf_backend_link_output_symbol_hook; - if (output_symbol_hook != NULL) - { - if (! ((*output_symbol_hook) - (finfo->output_bfd, finfo->info, name, elfsym, input_sec))) - return false; - } - - if (name == (const char *) NULL || *name == '\0') - elfsym->st_name = 0; - else if (input_sec->flags & SEC_EXCLUDE) - elfsym->st_name = 0; - else - { - elfsym->st_name = (unsigned long) _bfd_stringtab_add (finfo->symstrtab, - name, true, false); - if (elfsym->st_name == (unsigned long) -1) - return false; - } - - if (finfo->symbuf_count >= finfo->symbuf_size) - { - if (! elf_link_flush_output_syms (finfo)) - return false; - } - - dest = finfo->symbuf + finfo->symbuf_count; - destshndx = finfo->symshndxbuf; - if (destshndx != NULL) - destshndx += finfo->symbuf_count; - elf_swap_symbol_out (finfo->output_bfd, elfsym, (PTR) dest, (PTR) destshndx); - ++finfo->symbuf_count; - - ++ bfd_get_symcount (finfo->output_bfd); - - return true; -} - -/* Flush the output symbols to the file. */ - -static boolean -elf_link_flush_output_syms (finfo) - struct elf_final_link_info *finfo; -{ - if (finfo->symbuf_count > 0) - { - Elf_Internal_Shdr *hdr; - file_ptr pos; - bfd_size_type amt; - - hdr = &elf_tdata (finfo->output_bfd)->symtab_hdr; - pos = hdr->sh_offset + hdr->sh_size; - amt = finfo->symbuf_count * sizeof (Elf_External_Sym); - if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0 - || bfd_bwrite ((PTR) finfo->symbuf, amt, finfo->output_bfd) != amt) - return false; - - hdr->sh_size += amt; - - if (finfo->symshndxbuf != NULL) - { - hdr = &elf_tdata (finfo->output_bfd)->symtab_shndx_hdr; - pos = hdr->sh_offset + hdr->sh_size; - amt = finfo->symbuf_count * sizeof (Elf_External_Sym_Shndx); - if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0 - || (bfd_bwrite ((PTR) finfo->symshndxbuf, amt, finfo->output_bfd) - != amt)) - return false; - - hdr->sh_size += amt; - } - - finfo->symbuf_count = 0; - } - - return true; -} - -/* Adjust all external symbols pointing into SEC_MERGE sections - to reflect the object merging within the sections. */ - -static boolean -elf_link_sec_merge_syms (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - asection *sec; - - if (h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && ((sec = h->root.u.def.section)->flags & SEC_MERGE) - && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE) - { - bfd *output_bfd = (bfd *) data; - - h->root.u.def.value = - _bfd_merged_section_offset (output_bfd, - &h->root.u.def.section, - elf_section_data (sec)->sec_info, - h->root.u.def.value, (bfd_vma) 0); - } - - return true; -} - -/* For DSOs loaded in via a DT_NEEDED entry, emulate ld.so in - allowing an unsatisfied unversioned symbol in the DSO to match a - versioned symbol that would normally require an explicit version. */ - -static boolean -elf_link_check_versioned_symbol (info, h) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; -{ - bfd *undef_bfd = h->root.u.undef.abfd; - struct elf_link_loaded_list *loaded; - - if ((undef_bfd->flags & DYNAMIC) == 0 - || info->hash->creator->flavour != bfd_target_elf_flavour - || elf_dt_soname (h->root.u.undef.abfd) == NULL) - return false; - - for (loaded = elf_hash_table (info)->loaded; - loaded != NULL; - loaded = loaded->next) - { - bfd *input; - Elf_Internal_Shdr *hdr; - bfd_size_type symcount; - bfd_size_type extsymcount; - bfd_size_type extsymoff; - Elf_Internal_Shdr *versymhdr; - Elf_Internal_Sym *isym; - Elf_Internal_Sym *isymend; - Elf_Internal_Sym *isymbuf; - Elf_External_Versym *ever; - Elf_External_Versym *extversym; - - input = loaded->abfd; - - /* We check each DSO for a possible hidden versioned definition. */ - if (input == undef_bfd - || (input->flags & DYNAMIC) == 0 - || elf_dynversym (input) == 0) - continue; - - hdr = &elf_tdata (input)->dynsymtab_hdr; - - symcount = hdr->sh_size / sizeof (Elf_External_Sym); - if (elf_bad_symtab (input)) - { - extsymcount = symcount; - extsymoff = 0; - } - else - { - extsymcount = symcount - hdr->sh_info; - extsymoff = hdr->sh_info; - } - - if (extsymcount == 0) - continue; - - isymbuf = bfd_elf_get_elf_syms (input, hdr, extsymcount, extsymoff, - NULL, NULL, NULL); - if (isymbuf == NULL) - return false; - - /* Read in any version definitions. */ - versymhdr = &elf_tdata (input)->dynversym_hdr; - extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size); - if (extversym == NULL) - goto error_ret; - - if (bfd_seek (input, versymhdr->sh_offset, SEEK_SET) != 0 - || (bfd_bread ((PTR) extversym, versymhdr->sh_size, input) - != versymhdr->sh_size)) - { - free (extversym); - error_ret: - free (isymbuf); - return false; - } - - ever = extversym + extsymoff; - isymend = isymbuf + extsymcount; - for (isym = isymbuf; isym < isymend; isym++, ever++) - { - const char *name; - Elf_Internal_Versym iver; - - if (ELF_ST_BIND (isym->st_info) == STB_LOCAL - || isym->st_shndx == SHN_UNDEF) - continue; - - name = bfd_elf_string_from_elf_section (input, - hdr->sh_link, - isym->st_name); - if (strcmp (name, h->root.root.string) != 0) - continue; - - _bfd_elf_swap_versym_in (input, ever, &iver); - - if ((iver.vs_vers & VERSYM_HIDDEN) == 0) - { - /* If we have a non-hidden versioned sym, then it should - have provided a definition for the undefined sym. */ - abort (); - } - - if ((iver.vs_vers & VERSYM_VERSION) == 2) - { - /* This is the oldest (default) sym. We can use it. */ - free (extversym); - free (isymbuf); - return true; - } - } - - free (extversym); - free (isymbuf); - } - - return false; -} - -/* Add an external symbol to the symbol table. This is called from - the hash table traversal routine. When generating a shared object, - we go through the symbol table twice. The first time we output - anything that might have been forced to local scope in a version - script. The second time we output the symbols that are still - global symbols. */ - -static boolean -elf_link_output_extsym (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - struct elf_outext_info *eoinfo = (struct elf_outext_info *) data; - struct elf_final_link_info *finfo = eoinfo->finfo; - boolean strip; - Elf_Internal_Sym sym; - asection *input_sec; - - if (h->root.type == bfd_link_hash_warning) - { - h = (struct elf_link_hash_entry *) h->root.u.i.link; - if (h->root.type == bfd_link_hash_new) - return true; - } - - /* Decide whether to output this symbol in this pass. */ - if (eoinfo->localsyms) - { - if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - return true; - } - else - { - if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) - return true; - } - - /* If we are not creating a shared library, and this symbol is - referenced by a shared library but is not defined anywhere, then - warn that it is undefined. If we do not do this, the runtime - linker will complain that the symbol is undefined when the - program is run. We don't have to worry about symbols that are - referenced by regular files, because we will already have issued - warnings for them. */ - if (! finfo->info->relocateable - && ! finfo->info->allow_shlib_undefined - && ! finfo->info->shared - && h->root.type == bfd_link_hash_undefined - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0 - && ! elf_link_check_versioned_symbol (finfo->info, h)) - { - if (! ((*finfo->info->callbacks->undefined_symbol) - (finfo->info, h->root.root.string, h->root.u.undef.abfd, - (asection *) NULL, (bfd_vma) 0, true))) - { - eoinfo->failed = true; - return false; - } - } - - /* We don't want to output symbols that have never been mentioned by - a regular file, or that we have been told to strip. However, if - h->indx is set to -2, the symbol is used by a reloc and we must - output it. */ - if (h->indx == -2) - strip = false; - else if (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) - strip = true; - else if (finfo->info->strip == strip_all - || (finfo->info->strip == strip_some - && bfd_hash_lookup (finfo->info->keep_hash, - h->root.root.string, - false, false) == NULL)) - strip = true; - else - strip = false; - - /* If we're stripping it, and it's not a dynamic symbol, there's - nothing else to do unless it is a forced local symbol. */ - if (strip - && h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - return true; - - sym.st_value = 0; - sym.st_size = h->size; - sym.st_other = h->other; - if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) - sym.st_info = ELF_ST_INFO (STB_LOCAL, h->type); - else if (h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_defweak) - sym.st_info = ELF_ST_INFO (STB_WEAK, h->type); - else - sym.st_info = ELF_ST_INFO (STB_GLOBAL, h->type); - - switch (h->root.type) - { - default: - case bfd_link_hash_new: - case bfd_link_hash_warning: - abort (); - return false; - - case bfd_link_hash_undefined: - case bfd_link_hash_undefweak: - input_sec = bfd_und_section_ptr; - sym.st_shndx = SHN_UNDEF; - break; - - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - { - input_sec = h->root.u.def.section; - if (input_sec->output_section != NULL) - { - sym.st_shndx = - _bfd_elf_section_from_bfd_section (finfo->output_bfd, - input_sec->output_section); - if (sym.st_shndx == SHN_BAD) - { - (*_bfd_error_handler) - (_("%s: could not find output section %s for input section %s"), - bfd_get_filename (finfo->output_bfd), - input_sec->output_section->name, - input_sec->name); - eoinfo->failed = true; - return false; - } - - /* ELF symbols in relocateable files are section relative, - but in nonrelocateable files they are virtual - addresses. */ - sym.st_value = h->root.u.def.value + input_sec->output_offset; - if (! finfo->info->relocateable) - { - sym.st_value += input_sec->output_section->vma; - if (h->type == STT_TLS) - { - /* STT_TLS symbols are relative to PT_TLS segment - base. */ - BFD_ASSERT (finfo->first_tls_sec != NULL); - sym.st_value -= finfo->first_tls_sec->vma; - } - } - } - else - { - BFD_ASSERT (input_sec->owner == NULL - || (input_sec->owner->flags & DYNAMIC) != 0); - sym.st_shndx = SHN_UNDEF; - input_sec = bfd_und_section_ptr; - } - } - break; - - case bfd_link_hash_common: - input_sec = h->root.u.c.p->section; - sym.st_shndx = SHN_COMMON; - sym.st_value = 1 << h->root.u.c.p->alignment_power; - break; - - case bfd_link_hash_indirect: - /* These symbols are created by symbol versioning. They point - to the decorated version of the name. For example, if the - symbol foo@@GNU_1.2 is the default, which should be used when - foo is used with no version, then we add an indirect symbol - foo which points to foo@@GNU_1.2. We ignore these symbols, - since the indirected symbol is already in the hash table. */ - return true; - } - - /* Give the processor backend a chance to tweak the symbol value, - and also to finish up anything that needs to be done for this - symbol. FIXME: Not calling elf_backend_finish_dynamic_symbol for - forced local syms when non-shared is due to a historical quirk. */ - if ((h->dynindx != -1 - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) - && (finfo->info->shared - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - && elf_hash_table (finfo->info)->dynamic_sections_created) - { - struct elf_backend_data *bed; - - bed = get_elf_backend_data (finfo->output_bfd); - if (! ((*bed->elf_backend_finish_dynamic_symbol) - (finfo->output_bfd, finfo->info, h, &sym))) - { - eoinfo->failed = true; - return false; - } - } - - /* If we are marking the symbol as undefined, and there are no - non-weak references to this symbol from a regular object, then - mark the symbol as weak undefined; if there are non-weak - references, mark the symbol as strong. We can't do this earlier, - because it might not be marked as undefined until the - finish_dynamic_symbol routine gets through with it. */ - if (sym.st_shndx == SHN_UNDEF - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0 - && (ELF_ST_BIND (sym.st_info) == STB_GLOBAL - || ELF_ST_BIND (sym.st_info) == STB_WEAK)) - { - int bindtype; - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) != 0) - bindtype = STB_GLOBAL; - else - bindtype = STB_WEAK; - sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info)); - } - - /* If a symbol is not defined locally, we clear the visibility field. */ - if (! finfo->info->relocateable - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - sym.st_other &= ~ ELF_ST_VISIBILITY (-1); - - /* If this symbol should be put in the .dynsym section, then put it - there now. We already know the symbol index. We also fill in - the entry in the .hash section. */ - if (h->dynindx != -1 - && elf_hash_table (finfo->info)->dynamic_sections_created) - { - size_t bucketcount; - size_t bucket; - size_t hash_entry_size; - bfd_byte *bucketpos; - bfd_vma chain; - Elf_External_Sym *esym; - - sym.st_name = h->dynstr_index; - esym = (Elf_External_Sym *) finfo->dynsym_sec->contents + h->dynindx; - elf_swap_symbol_out (finfo->output_bfd, &sym, (PTR) esym, (PTR) 0); - - bucketcount = elf_hash_table (finfo->info)->bucketcount; - bucket = h->elf_hash_value % bucketcount; - hash_entry_size - = elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize; - bucketpos = ((bfd_byte *) finfo->hash_sec->contents - + (bucket + 2) * hash_entry_size); - chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos); - bfd_put (8 * hash_entry_size, finfo->output_bfd, (bfd_vma) h->dynindx, - bucketpos); - bfd_put (8 * hash_entry_size, finfo->output_bfd, chain, - ((bfd_byte *) finfo->hash_sec->contents - + (bucketcount + 2 + h->dynindx) * hash_entry_size)); - - if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL) - { - Elf_Internal_Versym iversym; - Elf_External_Versym *eversym; - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - if (h->verinfo.verdef == NULL) - iversym.vs_vers = 0; - else - iversym.vs_vers = h->verinfo.verdef->vd_exp_refno + 1; - } - else - { - if (h->verinfo.vertree == NULL) - iversym.vs_vers = 1; - else - iversym.vs_vers = h->verinfo.vertree->vernum + 1; - } - - if ((h->elf_link_hash_flags & ELF_LINK_HIDDEN) != 0) - iversym.vs_vers |= VERSYM_HIDDEN; - - eversym = (Elf_External_Versym *) finfo->symver_sec->contents; - eversym += h->dynindx; - _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, eversym); - } - } - - /* If we're stripping it, then it was just a dynamic symbol, and - there's nothing else to do. */ - if (strip || (input_sec->flags & SEC_EXCLUDE) != 0) - return true; - - h->indx = bfd_get_symcount (finfo->output_bfd); - - if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec)) - { - eoinfo->failed = true; - return false; - } - - return true; -} - -/* Copy the relocations indicated by the INTERNAL_RELOCS (which - originated from the section given by INPUT_REL_HDR) to the - OUTPUT_BFD. */ - -static boolean -elf_link_output_relocs (output_bfd, input_section, input_rel_hdr, - internal_relocs) - bfd *output_bfd; - asection *input_section; - Elf_Internal_Shdr *input_rel_hdr; - Elf_Internal_Rela *internal_relocs; -{ - Elf_Internal_Rela *irela; - Elf_Internal_Rela *irelaend; - Elf_Internal_Shdr *output_rel_hdr; - asection *output_section; - unsigned int *rel_countp = NULL; - struct elf_backend_data *bed; - bfd_size_type amt; - - output_section = input_section->output_section; - output_rel_hdr = NULL; - - if (elf_section_data (output_section)->rel_hdr.sh_entsize - == input_rel_hdr->sh_entsize) - { - output_rel_hdr = &elf_section_data (output_section)->rel_hdr; - rel_countp = &elf_section_data (output_section)->rel_count; - } - else if (elf_section_data (output_section)->rel_hdr2 - && (elf_section_data (output_section)->rel_hdr2->sh_entsize - == input_rel_hdr->sh_entsize)) - { - output_rel_hdr = elf_section_data (output_section)->rel_hdr2; - rel_countp = &elf_section_data (output_section)->rel_count2; - } - else - { - (*_bfd_error_handler) - (_("%s: relocation size mismatch in %s section %s"), - bfd_get_filename (output_bfd), - bfd_archive_filename (input_section->owner), - input_section->name); - bfd_set_error (bfd_error_wrong_object_format); - return false; - } - - bed = get_elf_backend_data (output_bfd); - irela = internal_relocs; - irelaend = irela + (NUM_SHDR_ENTRIES (input_rel_hdr) - * bed->s->int_rels_per_ext_rel); - - if (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rel)) - { - Elf_External_Rel *erel; - Elf_Internal_Rel *irel; - - amt = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel); - irel = (Elf_Internal_Rel *) bfd_zmalloc (amt); - if (irel == NULL) - { - (*_bfd_error_handler) (_("Error: out of memory")); - abort (); - } - - erel = ((Elf_External_Rel *) output_rel_hdr->contents + *rel_countp); - for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erel++) - { - unsigned int i; - - for (i = 0; i < bed->s->int_rels_per_ext_rel; i++) - { - irel[i].r_offset = irela[i].r_offset; - irel[i].r_info = irela[i].r_info; - BFD_ASSERT (irela[i].r_addend == 0); - } - - if (bed->s->swap_reloc_out) - (*bed->s->swap_reloc_out) (output_bfd, irel, (PTR) erel); - else - elf_swap_reloc_out (output_bfd, irel, erel); - } - - free (irel); - } - else - { - Elf_External_Rela *erela; - - BFD_ASSERT (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rela)); - - erela = ((Elf_External_Rela *) output_rel_hdr->contents + *rel_countp); - for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erela++) - if (bed->s->swap_reloca_out) - (*bed->s->swap_reloca_out) (output_bfd, irela, (PTR) erela); - else - elf_swap_reloca_out (output_bfd, irela, erela); - } - - /* Bump the counter, so that we know where to add the next set of - relocations. */ - *rel_countp += NUM_SHDR_ENTRIES (input_rel_hdr); - - return true; -} - -/* Link an input file into the linker output file. This function - handles all the sections and relocations of the input file at once. - This is so that we only have to read the local symbols once, and - don't have to keep them in memory. */ - -static boolean -elf_link_input_bfd (finfo, input_bfd) - struct elf_final_link_info *finfo; - bfd *input_bfd; -{ - boolean (*relocate_section) PARAMS ((bfd *, struct bfd_link_info *, - bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, - Elf_Internal_Sym *, asection **)); - bfd *output_bfd; - Elf_Internal_Shdr *symtab_hdr; - size_t locsymcount; - size_t extsymoff; - Elf_Internal_Sym *isymbuf; - Elf_Internal_Sym *isym; - Elf_Internal_Sym *isymend; - long *pindex; - asection **ppsection; - asection *o; - struct elf_backend_data *bed; - boolean emit_relocs; - struct elf_link_hash_entry **sym_hashes; - - output_bfd = finfo->output_bfd; - bed = get_elf_backend_data (output_bfd); - relocate_section = bed->elf_backend_relocate_section; - - /* If this is a dynamic object, we don't want to do anything here: - we don't want the local symbols, and we don't want the section - contents. */ - if ((input_bfd->flags & DYNAMIC) != 0) - return true; - - emit_relocs = (finfo->info->relocateable - || finfo->info->emitrelocations - || bed->elf_backend_emit_relocs); - - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - if (elf_bad_symtab (input_bfd)) - { - locsymcount = symtab_hdr->sh_size / sizeof (Elf_External_Sym); - extsymoff = 0; - } - else - { - locsymcount = symtab_hdr->sh_info; - extsymoff = symtab_hdr->sh_info; - } - - /* Read the local symbols. */ - isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; - if (isymbuf == NULL && locsymcount != 0) - { - isymbuf = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, locsymcount, 0, - finfo->internal_syms, - finfo->external_syms, - finfo->locsym_shndx); - if (isymbuf == NULL) - return false; - } - - /* Find local symbol sections and adjust values of symbols in - SEC_MERGE sections. Write out those local symbols we know are - going into the output file. */ - isymend = isymbuf + locsymcount; - for (isym = isymbuf, pindex = finfo->indices, ppsection = finfo->sections; - isym < isymend; - isym++, pindex++, ppsection++) - { - asection *isec; - const char *name; - Elf_Internal_Sym osym; - - *pindex = -1; - - if (elf_bad_symtab (input_bfd)) - { - if (ELF_ST_BIND (isym->st_info) != STB_LOCAL) - { - *ppsection = NULL; - continue; - } - } - - if (isym->st_shndx == SHN_UNDEF) - isec = bfd_und_section_ptr; - else if (isym->st_shndx < SHN_LORESERVE - || isym->st_shndx > SHN_HIRESERVE) - { - isec = section_from_elf_index (input_bfd, isym->st_shndx); - if (isec - && elf_section_data (isec)->sec_info_type == ELF_INFO_TYPE_MERGE - && ELF_ST_TYPE (isym->st_info) != STT_SECTION) - isym->st_value = - _bfd_merged_section_offset (output_bfd, &isec, - elf_section_data (isec)->sec_info, - isym->st_value, (bfd_vma) 0); - } - else if (isym->st_shndx == SHN_ABS) - isec = bfd_abs_section_ptr; - else if (isym->st_shndx == SHN_COMMON) - isec = bfd_com_section_ptr; - else - { - /* Who knows? */ - isec = NULL; - } - - *ppsection = isec; - - /* Don't output the first, undefined, symbol. */ - if (ppsection == finfo->sections) - continue; - - if (ELF_ST_TYPE (isym->st_info) == STT_SECTION) - { - /* We never output section symbols. Instead, we use the - section symbol of the corresponding section in the output - file. */ - continue; - } - - /* If we are stripping all symbols, we don't want to output this - one. */ - if (finfo->info->strip == strip_all) - continue; - - /* If we are discarding all local symbols, we don't want to - output this one. If we are generating a relocateable output - file, then some of the local symbols may be required by - relocs; we output them below as we discover that they are - needed. */ - if (finfo->info->discard == discard_all) - continue; - - /* If this symbol is defined in a section which we are - discarding, we don't need to keep it, but note that - linker_mark is only reliable for sections that have contents. - For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE - as well as linker_mark. */ - if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE) - && isec != NULL - && ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0) - || (! finfo->info->relocateable - && (isec->flags & SEC_EXCLUDE) != 0))) - continue; - - /* Get the name of the symbol. */ - name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, - isym->st_name); - if (name == NULL) - return false; - - /* See if we are discarding symbols with this name. */ - if ((finfo->info->strip == strip_some - && (bfd_hash_lookup (finfo->info->keep_hash, name, false, false) - == NULL)) - || (((finfo->info->discard == discard_sec_merge - && (isec->flags & SEC_MERGE) && ! finfo->info->relocateable) - || finfo->info->discard == discard_l) - && bfd_is_local_label_name (input_bfd, name))) - continue; - - /* If we get here, we are going to output this symbol. */ - - osym = *isym; - - /* Adjust the section index for the output file. */ - osym.st_shndx = _bfd_elf_section_from_bfd_section (output_bfd, - isec->output_section); - if (osym.st_shndx == SHN_BAD) - return false; - - *pindex = bfd_get_symcount (output_bfd); - - /* ELF symbols in relocateable files are section relative, but - in executable files they are virtual addresses. Note that - this code assumes that all ELF sections have an associated - BFD section with a reasonable value for output_offset; below - we assume that they also have a reasonable value for - output_section. Any special sections must be set up to meet - these requirements. */ - osym.st_value += isec->output_offset; - if (! finfo->info->relocateable) - { - osym.st_value += isec->output_section->vma; - if (ELF_ST_TYPE (osym.st_info) == STT_TLS) - { - /* STT_TLS symbols are relative to PT_TLS segment base. */ - BFD_ASSERT (finfo->first_tls_sec != NULL); - osym.st_value -= finfo->first_tls_sec->vma; - } - } - - if (! elf_link_output_sym (finfo, name, &osym, isec)) - return false; - } - - /* Relocate the contents of each section. */ - sym_hashes = elf_sym_hashes (input_bfd); - for (o = input_bfd->sections; o != NULL; o = o->next) - { - bfd_byte *contents; - - if (! o->linker_mark) - { - /* This section was omitted from the link. */ - continue; - } - - if ((o->flags & SEC_HAS_CONTENTS) == 0 - || (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0)) - continue; - - if ((o->flags & SEC_LINKER_CREATED) != 0) - { - /* Section was created by elf_link_create_dynamic_sections - or somesuch. */ - continue; - } - - /* Get the contents of the section. They have been cached by a - relaxation routine. Note that o is a section in an input - file, so the contents field will not have been set by any of - the routines which work on output files. */ - if (elf_section_data (o)->this_hdr.contents != NULL) - contents = elf_section_data (o)->this_hdr.contents; - else - { - contents = finfo->contents; - if (! bfd_get_section_contents (input_bfd, o, contents, - (file_ptr) 0, o->_raw_size)) - return false; - } - - if ((o->flags & SEC_RELOC) != 0) - { - Elf_Internal_Rela *internal_relocs; - - /* Get the swapped relocs. */ - internal_relocs = (NAME(_bfd_elf,link_read_relocs) - (input_bfd, o, finfo->external_relocs, - finfo->internal_relocs, false)); - if (internal_relocs == NULL - && o->reloc_count > 0) - return false; - - /* Run through the relocs looking for any against symbols - from discarded sections and section symbols from - removed link-once sections. Complain about relocs - against discarded sections. Zero relocs against removed - link-once sections. We should really complain if - anything in the final link tries to use it, but - DWARF-based exception handling might have an entry in - .eh_frame to describe a routine in the linkonce section, - and it turns out to be hard to remove the .eh_frame - entry too. FIXME. */ - if (!finfo->info->relocateable - && !elf_section_ignore_discarded_relocs (o)) - { - Elf_Internal_Rela *rel, *relend; - - rel = internal_relocs; - relend = rel + o->reloc_count * bed->s->int_rels_per_ext_rel; - for ( ; rel < relend; rel++) - { - unsigned long r_symndx = ELF_R_SYM (rel->r_info); - - if (r_symndx >= locsymcount - || (elf_bad_symtab (input_bfd) - && finfo->sections[r_symndx] == NULL)) - { - struct elf_link_hash_entry *h; - - h = sym_hashes[r_symndx - extsymoff]; - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - /* Complain if the definition comes from a - discarded section. */ - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && elf_discarded_section (h->root.u.def.section)) - { - if ((o->flags & SEC_DEBUGGING) != 0) - { - BFD_ASSERT (r_symndx != 0); - memset (rel, 0, sizeof (*rel)); - } - else - { - if (! ((*finfo->info->callbacks->undefined_symbol) - (finfo->info, h->root.root.string, - input_bfd, o, rel->r_offset, - true))) - return false; - } - } - } - else - { - asection *sec = finfo->sections[r_symndx]; - - if (sec != NULL && elf_discarded_section (sec)) - { - if ((o->flags & SEC_DEBUGGING) != 0 - || (sec->flags & SEC_LINK_ONCE) != 0) - { - BFD_ASSERT (r_symndx != 0); - rel->r_info - = ELF_R_INFO (0, ELF_R_TYPE (rel->r_info)); - rel->r_addend = 0; - } - else - { - boolean ok; - const char *msg - = _("local symbols in discarded section %s"); - bfd_size_type amt - = strlen (sec->name) + strlen (msg) - 1; - char *buf = (char *) bfd_malloc (amt); - - if (buf != NULL) - sprintf (buf, msg, sec->name); - else - buf = (char *) sec->name; - ok = (*finfo->info->callbacks - ->undefined_symbol) (finfo->info, buf, - input_bfd, o, - rel->r_offset, - true); - if (buf != sec->name) - free (buf); - if (!ok) - return false; - } - } - } - } - } - - /* Relocate the section by invoking a back end routine. - - The back end routine is responsible for adjusting the - section contents as necessary, and (if using Rela relocs - and generating a relocateable output file) adjusting the - reloc addend as necessary. - - The back end routine does not have to worry about setting - the reloc address or the reloc symbol index. - - The back end routine is given a pointer to the swapped in - internal symbols, and can access the hash table entries - for the external symbols via elf_sym_hashes (input_bfd). - - When generating relocateable output, the back end routine - must handle STB_LOCAL/STT_SECTION symbols specially. The - output symbol is going to be a section symbol - corresponding to the output section, which will require - the addend to be adjusted. */ - - if (! (*relocate_section) (output_bfd, finfo->info, - input_bfd, o, contents, - internal_relocs, - isymbuf, - finfo->sections)) - return false; - - if (emit_relocs) - { - Elf_Internal_Rela *irela; - Elf_Internal_Rela *irelaend; - struct elf_link_hash_entry **rel_hash; - Elf_Internal_Shdr *input_rel_hdr, *input_rel_hdr2; - unsigned int next_erel; - boolean (*reloc_emitter) PARAMS ((bfd *, asection *, - Elf_Internal_Shdr *, - Elf_Internal_Rela *)); - boolean rela_normal; - - input_rel_hdr = &elf_section_data (o)->rel_hdr; - rela_normal = (bed->rela_normal - && (input_rel_hdr->sh_entsize - == sizeof (Elf_External_Rela))); - - /* Adjust the reloc addresses and symbol indices. */ - - irela = internal_relocs; - irelaend = irela + o->reloc_count * bed->s->int_rels_per_ext_rel; - rel_hash = (elf_section_data (o->output_section)->rel_hashes - + elf_section_data (o->output_section)->rel_count - + elf_section_data (o->output_section)->rel_count2); - for (next_erel = 0; irela < irelaend; irela++, next_erel++) - { - unsigned long r_symndx; - asection *sec; - Elf_Internal_Sym sym; - - if (next_erel == bed->s->int_rels_per_ext_rel) - { - rel_hash++; - next_erel = 0; - } - - irela->r_offset += o->output_offset; - - /* Relocs in an executable have to be virtual addresses. */ - if (!finfo->info->relocateable) - irela->r_offset += o->output_section->vma; - - r_symndx = ELF_R_SYM (irela->r_info); - - if (r_symndx == 0) - continue; - - if (r_symndx >= locsymcount - || (elf_bad_symtab (input_bfd) - && finfo->sections[r_symndx] == NULL)) - { - struct elf_link_hash_entry *rh; - unsigned long indx; - - /* This is a reloc against a global symbol. We - have not yet output all the local symbols, so - we do not know the symbol index of any global - symbol. We set the rel_hash entry for this - reloc to point to the global hash table entry - for this symbol. The symbol index is then - set at the end of elf_bfd_final_link. */ - indx = r_symndx - extsymoff; - rh = elf_sym_hashes (input_bfd)[indx]; - while (rh->root.type == bfd_link_hash_indirect - || rh->root.type == bfd_link_hash_warning) - rh = (struct elf_link_hash_entry *) rh->root.u.i.link; - - /* Setting the index to -2 tells - elf_link_output_extsym that this symbol is - used by a reloc. */ - BFD_ASSERT (rh->indx < 0); - rh->indx = -2; - - *rel_hash = rh; - - continue; - } - - /* This is a reloc against a local symbol. */ - - *rel_hash = NULL; - sym = isymbuf[r_symndx]; - sec = finfo->sections[r_symndx]; - if (ELF_ST_TYPE (sym.st_info) == STT_SECTION) - { - /* I suppose the backend ought to fill in the - section of any STT_SECTION symbol against a - processor specific section. If we have - discarded a section, the output_section will - be the absolute section. */ - if (bfd_is_abs_section (sec) - || (sec != NULL - && bfd_is_abs_section (sec->output_section))) - r_symndx = 0; - else if (sec == NULL || sec->owner == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - else - { - r_symndx = sec->output_section->target_index; - BFD_ASSERT (r_symndx != 0); - } - - /* Adjust the addend according to where the - section winds up in the output section. */ - if (rela_normal) - irela->r_addend += sec->output_offset; - } - else - { - if (finfo->indices[r_symndx] == -1) - { - unsigned long shlink; - const char *name; - asection *osec; - - if (finfo->info->strip == strip_all) - { - /* You can't do ld -r -s. */ - bfd_set_error (bfd_error_invalid_operation); - return false; - } - - /* This symbol was skipped earlier, but - since it is needed by a reloc, we - must output it now. */ - shlink = symtab_hdr->sh_link; - name = (bfd_elf_string_from_elf_section - (input_bfd, shlink, sym.st_name)); - if (name == NULL) - return false; - - osec = sec->output_section; - sym.st_shndx = - _bfd_elf_section_from_bfd_section (output_bfd, - osec); - if (sym.st_shndx == SHN_BAD) - return false; - - sym.st_value += sec->output_offset; - if (! finfo->info->relocateable) - { - sym.st_value += osec->vma; - if (ELF_ST_TYPE (sym.st_info) == STT_TLS) - { - /* STT_TLS symbols are relative to PT_TLS - segment base. */ - BFD_ASSERT (finfo->first_tls_sec != NULL); - sym.st_value -= finfo->first_tls_sec->vma; - } - } - - finfo->indices[r_symndx] - = bfd_get_symcount (output_bfd); - - if (! elf_link_output_sym (finfo, name, &sym, sec)) - return false; - } - - r_symndx = finfo->indices[r_symndx]; - } - - irela->r_info = ELF_R_INFO (r_symndx, - ELF_R_TYPE (irela->r_info)); - } - - /* Swap out the relocs. */ - if (bed->elf_backend_emit_relocs - && !(finfo->info->relocateable - || finfo->info->emitrelocations)) - reloc_emitter = bed->elf_backend_emit_relocs; - else - reloc_emitter = elf_link_output_relocs; - - if (input_rel_hdr->sh_size != 0 - && ! (*reloc_emitter) (output_bfd, o, input_rel_hdr, - internal_relocs)) - return false; - - input_rel_hdr2 = elf_section_data (o)->rel_hdr2; - if (input_rel_hdr2 && input_rel_hdr2->sh_size != 0) - { - internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr) - * bed->s->int_rels_per_ext_rel); - if (! (*reloc_emitter) (output_bfd, o, input_rel_hdr2, - internal_relocs)) - return false; - } - } - } - - /* Write out the modified section contents. */ - if (bed->elf_backend_write_section - && (*bed->elf_backend_write_section) (output_bfd, o, contents)) - { - /* Section written out. */ - } - else switch (elf_section_data (o)->sec_info_type) - { - case ELF_INFO_TYPE_STABS: - if (! (_bfd_write_section_stabs - (output_bfd, - &elf_hash_table (finfo->info)->stab_info, - o, &elf_section_data (o)->sec_info, contents))) - return false; - break; - case ELF_INFO_TYPE_MERGE: - if (! (_bfd_write_merged_section - (output_bfd, o, elf_section_data (o)->sec_info))) - return false; - break; - case ELF_INFO_TYPE_EH_FRAME: - { - asection *ehdrsec; - - ehdrsec - = bfd_get_section_by_name (elf_hash_table (finfo->info)->dynobj, - ".eh_frame_hdr"); - if (! (_bfd_elf_write_section_eh_frame (output_bfd, o, ehdrsec, - contents))) - return false; - } - break; - default: - { - bfd_size_type sec_size; - - sec_size = (o->_cooked_size != 0 ? o->_cooked_size : o->_raw_size); - if (! (o->flags & SEC_EXCLUDE) - && ! bfd_set_section_contents (output_bfd, o->output_section, - contents, - (file_ptr) o->output_offset, - sec_size)) - return false; - } - break; - } - } - - return true; -} - -/* Generate a reloc when linking an ELF file. This is a reloc - requested by the linker, and does come from any input file. This - is used to build constructor and destructor tables when linking - with -Ur. */ - -static boolean -elf_reloc_link_order (output_bfd, info, output_section, link_order) - bfd *output_bfd; - struct bfd_link_info *info; - asection *output_section; - struct bfd_link_order *link_order; -{ - reloc_howto_type *howto; - long indx; - bfd_vma offset; - bfd_vma addend; - struct elf_link_hash_entry **rel_hash_ptr; - Elf_Internal_Shdr *rel_hdr; - struct elf_backend_data *bed = get_elf_backend_data (output_bfd); - - howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc); - if (howto == NULL) - { - bfd_set_error (bfd_error_bad_value); - return false; - } - - addend = link_order->u.reloc.p->addend; - - /* Figure out the symbol index. */ - rel_hash_ptr = (elf_section_data (output_section)->rel_hashes - + elf_section_data (output_section)->rel_count - + elf_section_data (output_section)->rel_count2); - if (link_order->type == bfd_section_reloc_link_order) - { - indx = link_order->u.reloc.p->u.section->target_index; - BFD_ASSERT (indx != 0); - *rel_hash_ptr = NULL; - } - else - { - struct elf_link_hash_entry *h; - - /* Treat a reloc against a defined symbol as though it were - actually against the section. */ - h = ((struct elf_link_hash_entry *) - bfd_wrapped_link_hash_lookup (output_bfd, info, - link_order->u.reloc.p->u.name, - false, false, true)); - if (h != NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) - { - asection *section; - - section = h->root.u.def.section; - indx = section->output_section->target_index; - *rel_hash_ptr = NULL; - /* It seems that we ought to add the symbol value to the - addend here, but in practice it has already been added - because it was passed to constructor_callback. */ - addend += section->output_section->vma + section->output_offset; - } - else if (h != NULL) - { - /* Setting the index to -2 tells elf_link_output_extsym that - this symbol is used by a reloc. */ - h->indx = -2; - *rel_hash_ptr = h; - indx = 0; - } - else - { - if (! ((*info->callbacks->unattached_reloc) - (info, link_order->u.reloc.p->u.name, (bfd *) NULL, - (asection *) NULL, (bfd_vma) 0))) - return false; - indx = 0; - } - } - - /* If this is an inplace reloc, we must write the addend into the - object file. */ - if (howto->partial_inplace && addend != 0) - { - bfd_size_type size; - bfd_reloc_status_type rstat; - bfd_byte *buf; - boolean ok; - const char *sym_name; - - size = bfd_get_reloc_size (howto); - buf = (bfd_byte *) bfd_zmalloc (size); - if (buf == (bfd_byte *) NULL) - return false; - rstat = _bfd_relocate_contents (howto, output_bfd, (bfd_vma) addend, buf); - switch (rstat) - { - case bfd_reloc_ok: - break; - - default: - case bfd_reloc_outofrange: - abort (); - - case bfd_reloc_overflow: - if (link_order->type == bfd_section_reloc_link_order) - sym_name = bfd_section_name (output_bfd, - link_order->u.reloc.p->u.section); - else - sym_name = link_order->u.reloc.p->u.name; - if (! ((*info->callbacks->reloc_overflow) - (info, sym_name, howto->name, addend, - (bfd *) NULL, (asection *) NULL, (bfd_vma) 0))) - { - free (buf); - return false; - } - break; - } - ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf, - (file_ptr) link_order->offset, size); - free (buf); - if (! ok) - return false; - } - - /* The address of a reloc is relative to the section in a - relocateable file, and is a virtual address in an executable - file. */ - offset = link_order->offset; - if (! info->relocateable) - offset += output_section->vma; - - rel_hdr = &elf_section_data (output_section)->rel_hdr; - - if (rel_hdr->sh_type == SHT_REL) - { - bfd_size_type size; - Elf_Internal_Rel *irel; - Elf_External_Rel *erel; - unsigned int i; - - size = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel); - irel = (Elf_Internal_Rel *) bfd_zmalloc (size); - if (irel == NULL) - return false; - - for (i = 0; i < bed->s->int_rels_per_ext_rel; i++) - irel[i].r_offset = offset; - irel[0].r_info = ELF_R_INFO (indx, howto->type); - - erel = ((Elf_External_Rel *) rel_hdr->contents - + elf_section_data (output_section)->rel_count); - - if (bed->s->swap_reloc_out) - (*bed->s->swap_reloc_out) (output_bfd, irel, (bfd_byte *) erel); - else - elf_swap_reloc_out (output_bfd, irel, erel); - - free (irel); - } - else - { - bfd_size_type size; - Elf_Internal_Rela *irela; - Elf_External_Rela *erela; - unsigned int i; - - size = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela); - irela = (Elf_Internal_Rela *) bfd_zmalloc (size); - if (irela == NULL) - return false; - - for (i = 0; i < bed->s->int_rels_per_ext_rel; i++) - irela[i].r_offset = offset; - irela[0].r_info = ELF_R_INFO (indx, howto->type); - irela[0].r_addend = addend; - - erela = ((Elf_External_Rela *) rel_hdr->contents - + elf_section_data (output_section)->rel_count); - - if (bed->s->swap_reloca_out) - (*bed->s->swap_reloca_out) (output_bfd, irela, (bfd_byte *) erela); - else - elf_swap_reloca_out (output_bfd, irela, erela); - } - - ++elf_section_data (output_section)->rel_count; - - return true; -} - -/* Allocate a pointer to live in a linker created section. */ - -boolean -elf_create_pointer_linker_section (abfd, info, lsect, h, rel) - bfd *abfd; - struct bfd_link_info *info; - elf_linker_section_t *lsect; - struct elf_link_hash_entry *h; - const Elf_Internal_Rela *rel; -{ - elf_linker_section_pointers_t **ptr_linker_section_ptr = NULL; - elf_linker_section_pointers_t *linker_section_ptr; - unsigned long r_symndx = ELF_R_SYM (rel->r_info); - bfd_size_type amt; - - BFD_ASSERT (lsect != NULL); - - /* Is this a global symbol? */ - if (h != NULL) - { - /* Has this symbol already been allocated? If so, our work is done. */ - if (_bfd_elf_find_pointer_linker_section (h->linker_section_pointer, - rel->r_addend, - lsect->which)) - return true; - - ptr_linker_section_ptr = &h->linker_section_pointer; - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (! elf_link_record_dynamic_symbol (info, h)) - return false; - } - - if (lsect->rel_section) - lsect->rel_section->_raw_size += sizeof (Elf_External_Rela); - } - else - { - /* Allocation of a pointer to a local symbol. */ - elf_linker_section_pointers_t **ptr = elf_local_ptr_offsets (abfd); - - /* Allocate a table to hold the local symbols if first time. */ - if (!ptr) - { - unsigned int num_symbols = elf_tdata (abfd)->symtab_hdr.sh_info; - register unsigned int i; - - amt = num_symbols; - amt *= sizeof (elf_linker_section_pointers_t *); - ptr = (elf_linker_section_pointers_t **) bfd_alloc (abfd, amt); - - if (!ptr) - return false; - - elf_local_ptr_offsets (abfd) = ptr; - for (i = 0; i < num_symbols; i++) - ptr[i] = (elf_linker_section_pointers_t *) 0; - } - - /* Has this symbol already been allocated? If so, our work is done. */ - if (_bfd_elf_find_pointer_linker_section (ptr[r_symndx], - rel->r_addend, - lsect->which)) - return true; - - ptr_linker_section_ptr = &ptr[r_symndx]; - - if (info->shared) - { - /* If we are generating a shared object, we need to - output a R__RELATIVE reloc so that the - dynamic linker can adjust this GOT entry. */ - BFD_ASSERT (lsect->rel_section != NULL); - lsect->rel_section->_raw_size += sizeof (Elf_External_Rela); - } - } - - /* Allocate space for a pointer in the linker section, and allocate - a new pointer record from internal memory. */ - BFD_ASSERT (ptr_linker_section_ptr != NULL); - amt = sizeof (elf_linker_section_pointers_t); - linker_section_ptr = (elf_linker_section_pointers_t *) bfd_alloc (abfd, amt); - - if (!linker_section_ptr) - return false; - - linker_section_ptr->next = *ptr_linker_section_ptr; - linker_section_ptr->addend = rel->r_addend; - linker_section_ptr->which = lsect->which; - linker_section_ptr->written_address_p = false; - *ptr_linker_section_ptr = linker_section_ptr; - -#if 0 - if (lsect->hole_size && lsect->hole_offset < lsect->max_hole_offset) - { - linker_section_ptr->offset = (lsect->section->_raw_size - - lsect->hole_size + (ARCH_SIZE / 8)); - lsect->hole_offset += ARCH_SIZE / 8; - lsect->sym_offset += ARCH_SIZE / 8; - if (lsect->sym_hash) - { - /* Bump up symbol value if needed. */ - lsect->sym_hash->root.u.def.value += ARCH_SIZE / 8; -#ifdef DEBUG - fprintf (stderr, "Bump up %s by %ld, current value = %ld\n", - lsect->sym_hash->root.root.string, - (long) ARCH_SIZE / 8, - (long) lsect->sym_hash->root.u.def.value); -#endif - } - } - else -#endif - linker_section_ptr->offset = lsect->section->_raw_size; - - lsect->section->_raw_size += ARCH_SIZE / 8; - -#ifdef DEBUG - fprintf (stderr, - "Create pointer in linker section %s, offset = %ld, section size = %ld\n", - lsect->name, (long) linker_section_ptr->offset, - (long) lsect->section->_raw_size); -#endif - - return true; -} - -#if ARCH_SIZE==64 -#define bfd_put_ptr(BFD,VAL,ADDR) bfd_put_64 (BFD, VAL, ADDR) -#endif -#if ARCH_SIZE==32 -#define bfd_put_ptr(BFD,VAL,ADDR) bfd_put_32 (BFD, VAL, ADDR) -#endif - -/* Fill in the address for a pointer generated in a linker section. */ - -bfd_vma -elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, - relocation, rel, relative_reloc) - bfd *output_bfd; - bfd *input_bfd; - struct bfd_link_info *info; - elf_linker_section_t *lsect; - struct elf_link_hash_entry *h; - bfd_vma relocation; - const Elf_Internal_Rela *rel; - int relative_reloc; -{ - elf_linker_section_pointers_t *linker_section_ptr; - - BFD_ASSERT (lsect != NULL); - - if (h != NULL) - { - /* Handle global symbol. */ - linker_section_ptr = (_bfd_elf_find_pointer_linker_section - (h->linker_section_pointer, - rel->r_addend, - lsect->which)); - - BFD_ASSERT (linker_section_ptr != NULL); - - if (! elf_hash_table (info)->dynamic_sections_created - || (info->shared - && info->symbolic - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - { - /* This is actually a static link, or it is a - -Bsymbolic link and the symbol is defined - locally. We must initialize this entry in the - global section. - - When doing a dynamic link, we create a .rela. - relocation entry to initialize the value. This - is done in the finish_dynamic_symbol routine. */ - if (!linker_section_ptr->written_address_p) - { - linker_section_ptr->written_address_p = true; - bfd_put_ptr (output_bfd, - relocation + linker_section_ptr->addend, - (lsect->section->contents - + linker_section_ptr->offset)); - } - } - } - else - { - /* Handle local symbol. */ - unsigned long r_symndx = ELF_R_SYM (rel->r_info); - BFD_ASSERT (elf_local_ptr_offsets (input_bfd) != NULL); - BFD_ASSERT (elf_local_ptr_offsets (input_bfd)[r_symndx] != NULL); - linker_section_ptr = (_bfd_elf_find_pointer_linker_section - (elf_local_ptr_offsets (input_bfd)[r_symndx], - rel->r_addend, - lsect->which)); - - BFD_ASSERT (linker_section_ptr != NULL); - - /* Write out pointer if it hasn't been rewritten out before. */ - if (!linker_section_ptr->written_address_p) - { - linker_section_ptr->written_address_p = true; - bfd_put_ptr (output_bfd, relocation + linker_section_ptr->addend, - lsect->section->contents + linker_section_ptr->offset); - - if (info->shared) - { - asection *srel = lsect->rel_section; - Elf_Internal_Rela *outrel; - Elf_External_Rela *erel; - struct elf_backend_data *bed = get_elf_backend_data (output_bfd); - unsigned int i; - bfd_size_type amt; - - amt = sizeof (Elf_Internal_Rela) * bed->s->int_rels_per_ext_rel; - outrel = (Elf_Internal_Rela *) bfd_zmalloc (amt); - if (outrel == NULL) - { - (*_bfd_error_handler) (_("Error: out of memory")); - return 0; - } - - /* We need to generate a relative reloc for the dynamic - linker. */ - if (!srel) - { - srel = bfd_get_section_by_name (elf_hash_table (info)->dynobj, - lsect->rel_name); - lsect->rel_section = srel; - } - - BFD_ASSERT (srel != NULL); - - for (i = 0; i < bed->s->int_rels_per_ext_rel; i++) - outrel[i].r_offset = (lsect->section->output_section->vma - + lsect->section->output_offset - + linker_section_ptr->offset); - outrel[0].r_info = ELF_R_INFO (0, relative_reloc); - outrel[0].r_addend = 0; - erel = (Elf_External_Rela *) lsect->section->contents; - erel += elf_section_data (lsect->section)->rel_count; - elf_swap_reloca_out (output_bfd, outrel, erel); - ++elf_section_data (lsect->section)->rel_count; - - free (outrel); - } - } - } - - relocation = (lsect->section->output_offset - + linker_section_ptr->offset - - lsect->hole_offset - - lsect->sym_offset); - -#ifdef DEBUG - fprintf (stderr, - "Finish pointer in linker section %s, offset = %ld (0x%lx)\n", - lsect->name, (long) relocation, (long) relocation); -#endif - - /* Subtract out the addend, because it will get added back in by the normal - processing. */ - return relocation - linker_section_ptr->addend; -} - -/* Garbage collect unused sections. */ - -static boolean elf_gc_mark - PARAMS ((struct bfd_link_info *, asection *, - asection * (*) (asection *, struct bfd_link_info *, - Elf_Internal_Rela *, struct elf_link_hash_entry *, - Elf_Internal_Sym *))); - -static boolean elf_gc_sweep - PARAMS ((struct bfd_link_info *, - boolean (*) (bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *))); - -static boolean elf_gc_sweep_symbol - PARAMS ((struct elf_link_hash_entry *, PTR)); - -static boolean elf_gc_allocate_got_offsets - PARAMS ((struct elf_link_hash_entry *, PTR)); - -static boolean elf_gc_propagate_vtable_entries_used - PARAMS ((struct elf_link_hash_entry *, PTR)); - -static boolean elf_gc_smash_unused_vtentry_relocs - PARAMS ((struct elf_link_hash_entry *, PTR)); - -/* The mark phase of garbage collection. For a given section, mark - it and any sections in this section's group, and all the sections - which define symbols to which it refers. */ - -static boolean -elf_gc_mark (info, sec, gc_mark_hook) - struct bfd_link_info *info; - asection *sec; - asection * (*gc_mark_hook) PARAMS ((asection *, struct bfd_link_info *, - Elf_Internal_Rela *, - struct elf_link_hash_entry *, - Elf_Internal_Sym *)); -{ - boolean ret; - asection *group_sec; - - sec->gc_mark = 1; - - /* Mark all the sections in the group. */ - group_sec = elf_section_data (sec)->next_in_group; - if (group_sec && !group_sec->gc_mark) - if (!elf_gc_mark (info, group_sec, gc_mark_hook)) - return false; - - /* Look through the section relocs. */ - ret = true; - if ((sec->flags & SEC_RELOC) != 0 && sec->reloc_count > 0) - { - Elf_Internal_Rela *relstart, *rel, *relend; - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - size_t nlocsyms; - size_t extsymoff; - bfd *input_bfd = sec->owner; - struct elf_backend_data *bed = get_elf_backend_data (input_bfd); - Elf_Internal_Sym *isym = NULL; - - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (input_bfd); - - /* Read the local symbols. */ - if (elf_bad_symtab (input_bfd)) - { - nlocsyms = symtab_hdr->sh_size / sizeof (Elf_External_Sym); - extsymoff = 0; - } - else - extsymoff = nlocsyms = symtab_hdr->sh_info; - - isym = (Elf_Internal_Sym *) symtab_hdr->contents; - if (isym == NULL && nlocsyms != 0) - { - isym = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, nlocsyms, 0, - NULL, NULL, NULL); - if (isym == NULL) - return false; - } - - /* Read the relocations. */ - relstart = (NAME(_bfd_elf,link_read_relocs) - (input_bfd, sec, NULL, (Elf_Internal_Rela *) NULL, - info->keep_memory)); - if (relstart == NULL) - { - ret = false; - goto out1; - } - relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel; - - for (rel = relstart; rel < relend; rel++) - { - unsigned long r_symndx; - asection *rsec; - struct elf_link_hash_entry *h; - - r_symndx = ELF_R_SYM (rel->r_info); - if (r_symndx == 0) - continue; - - if (r_symndx >= nlocsyms - || ELF_ST_BIND (isym[r_symndx].st_info) != STB_LOCAL) - { - h = sym_hashes[r_symndx - extsymoff]; - rsec = (*gc_mark_hook) (sec, info, rel, h, NULL); - } - else - { - rsec = (*gc_mark_hook) (sec, info, rel, NULL, &isym[r_symndx]); - } - - if (rsec && !rsec->gc_mark) - { - if (bfd_get_flavour (rsec->owner) != bfd_target_elf_flavour) - rsec->gc_mark = 1; - else if (!elf_gc_mark (info, rsec, gc_mark_hook)) - { - ret = false; - goto out2; - } - } - } - - out2: - if (elf_section_data (sec)->relocs != relstart) - free (relstart); - out1: - if (isym != NULL && symtab_hdr->contents != (unsigned char *) isym) - { - if (! info->keep_memory) - free (isym); - else - symtab_hdr->contents = (unsigned char *) isym; - } - } - - return ret; -} - -/* The sweep phase of garbage collection. Remove all garbage sections. */ - -static boolean -elf_gc_sweep (info, gc_sweep_hook) - struct bfd_link_info *info; - boolean (*gc_sweep_hook) PARAMS ((bfd *, struct bfd_link_info *, - asection *, const Elf_Internal_Rela *)); -{ - bfd *sub; - - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - { - asection *o; - - if (bfd_get_flavour (sub) != bfd_target_elf_flavour) - continue; - - for (o = sub->sections; o != NULL; o = o->next) - { - /* Keep special sections. Keep .debug sections. */ - if ((o->flags & SEC_LINKER_CREATED) - || (o->flags & SEC_DEBUGGING)) - o->gc_mark = 1; - - if (o->gc_mark) - continue; - - /* Skip sweeping sections already excluded. */ - if (o->flags & SEC_EXCLUDE) - continue; - - /* Since this is early in the link process, it is simple - to remove a section from the output. */ - o->flags |= SEC_EXCLUDE; - - /* But we also have to update some of the relocation - info we collected before. */ - if (gc_sweep_hook - && (o->flags & SEC_RELOC) && o->reloc_count > 0) - { - Elf_Internal_Rela *internal_relocs; - boolean r; - - internal_relocs = (NAME(_bfd_elf,link_read_relocs) - (o->owner, o, NULL, NULL, info->keep_memory)); - if (internal_relocs == NULL) - return false; - - r = (*gc_sweep_hook) (o->owner, info, o, internal_relocs); - - if (elf_section_data (o)->relocs != internal_relocs) - free (internal_relocs); - - if (!r) - return false; - } - } - } - - /* Remove the symbols that were in the swept sections from the dynamic - symbol table. GCFIXME: Anyone know how to get them out of the - static symbol table as well? */ - { - int i = 0; - - elf_link_hash_traverse (elf_hash_table (info), - elf_gc_sweep_symbol, - (PTR) &i); - - elf_hash_table (info)->dynsymcount = i; - } - - return true; -} - -/* Sweep symbols in swept sections. Called via elf_link_hash_traverse. */ - -static boolean -elf_gc_sweep_symbol (h, idxptr) - struct elf_link_hash_entry *h; - PTR idxptr; -{ - int *idx = (int *) idxptr; - - if (h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - if (h->dynindx != -1 - && ((h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak) - || h->root.u.def.section->gc_mark)) - h->dynindx = (*idx)++; - - return true; -} - -/* Propogate collected vtable information. This is called through - elf_link_hash_traverse. */ - -static boolean -elf_gc_propagate_vtable_entries_used (h, okp) - struct elf_link_hash_entry *h; - PTR okp; -{ - if (h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - /* Those that are not vtables. */ - if (h->vtable_parent == NULL) - return true; - - /* Those vtables that do not have parents, we cannot merge. */ - if (h->vtable_parent == (struct elf_link_hash_entry *) -1) - return true; - - /* If we've already been done, exit. */ - if (h->vtable_entries_used && h->vtable_entries_used[-1]) - return true; - - /* Make sure the parent's table is up to date. */ - elf_gc_propagate_vtable_entries_used (h->vtable_parent, okp); - - if (h->vtable_entries_used == NULL) - { - /* None of this table's entries were referenced. Re-use the - parent's table. */ - h->vtable_entries_used = h->vtable_parent->vtable_entries_used; - h->vtable_entries_size = h->vtable_parent->vtable_entries_size; - } - else - { - size_t n; - boolean *cu, *pu; - - /* Or the parent's entries into ours. */ - cu = h->vtable_entries_used; - cu[-1] = true; - pu = h->vtable_parent->vtable_entries_used; - if (pu != NULL) - { - asection *sec = h->root.u.def.section; - struct elf_backend_data *bed = get_elf_backend_data (sec->owner); - int file_align = bed->s->file_align; - - n = h->vtable_parent->vtable_entries_size / file_align; - while (n--) - { - if (*pu) - *cu = true; - pu++; - cu++; - } - } - } - - return true; -} - -static boolean -elf_gc_smash_unused_vtentry_relocs (h, okp) - struct elf_link_hash_entry *h; - PTR okp; -{ - asection *sec; - bfd_vma hstart, hend; - Elf_Internal_Rela *relstart, *relend, *rel; - struct elf_backend_data *bed; - int file_align; - - if (h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - /* Take care of both those symbols that do not describe vtables as - well as those that are not loaded. */ - if (h->vtable_parent == NULL) - return true; - - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak); - - sec = h->root.u.def.section; - hstart = h->root.u.def.value; - hend = hstart + h->size; - - relstart = (NAME(_bfd_elf,link_read_relocs) - (sec->owner, sec, NULL, (Elf_Internal_Rela *) NULL, true)); - if (!relstart) - return *(boolean *) okp = false; - bed = get_elf_backend_data (sec->owner); - file_align = bed->s->file_align; - - relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel; - - for (rel = relstart; rel < relend; ++rel) - if (rel->r_offset >= hstart && rel->r_offset < hend) - { - /* If the entry is in use, do nothing. */ - if (h->vtable_entries_used - && (rel->r_offset - hstart) < h->vtable_entries_size) - { - bfd_vma entry = (rel->r_offset - hstart) / file_align; - if (h->vtable_entries_used[entry]) - continue; - } - /* Otherwise, kill it. */ - rel->r_offset = rel->r_info = rel->r_addend = 0; - } - - return true; -} - -/* Do mark and sweep of unused sections. */ - -boolean -elf_gc_sections (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - boolean ok = true; - bfd *sub; - asection * (*gc_mark_hook) - PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *h, Elf_Internal_Sym *)); - - if (!get_elf_backend_data (abfd)->can_gc_sections - || info->relocateable || info->emitrelocations - || elf_hash_table (info)->dynamic_sections_created) - return true; - - /* Apply transitive closure to the vtable entry usage info. */ - elf_link_hash_traverse (elf_hash_table (info), - elf_gc_propagate_vtable_entries_used, - (PTR) &ok); - if (!ok) - return false; - - /* Kill the vtable relocations that were not used. */ - elf_link_hash_traverse (elf_hash_table (info), - elf_gc_smash_unused_vtentry_relocs, - (PTR) &ok); - if (!ok) - return false; - - /* Grovel through relocs to find out who stays ... */ - - gc_mark_hook = get_elf_backend_data (abfd)->gc_mark_hook; - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - { - asection *o; - - if (bfd_get_flavour (sub) != bfd_target_elf_flavour) - continue; - - for (o = sub->sections; o != NULL; o = o->next) - { - if (o->flags & SEC_KEEP) - if (!elf_gc_mark (info, o, gc_mark_hook)) - return false; - } - } - - /* ... and mark SEC_EXCLUDE for those that go. */ - if (!elf_gc_sweep (info, get_elf_backend_data (abfd)->gc_sweep_hook)) - return false; - - return true; -} - -/* Called from check_relocs to record the existance of a VTINHERIT reloc. */ - -boolean -elf_gc_record_vtinherit (abfd, sec, h, offset) - bfd *abfd; - asection *sec; - struct elf_link_hash_entry *h; - bfd_vma offset; -{ - struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; - struct elf_link_hash_entry **search, *child; - bfd_size_type extsymcount; - - /* The sh_info field of the symtab header tells us where the - external symbols start. We don't care about the local symbols at - this point. */ - extsymcount = elf_tdata (abfd)->symtab_hdr.sh_size/sizeof (Elf_External_Sym); - if (!elf_bad_symtab (abfd)) - extsymcount -= elf_tdata (abfd)->symtab_hdr.sh_info; - - sym_hashes = elf_sym_hashes (abfd); - sym_hashes_end = sym_hashes + extsymcount; - - /* Hunt down the child symbol, which is in this section at the same - offset as the relocation. */ - for (search = sym_hashes; search != sym_hashes_end; ++search) - { - if ((child = *search) != NULL - && (child->root.type == bfd_link_hash_defined - || child->root.type == bfd_link_hash_defweak) - && child->root.u.def.section == sec - && child->root.u.def.value == offset) - goto win; - } - - (*_bfd_error_handler) ("%s: %s+%lu: No symbol found for INHERIT", - bfd_archive_filename (abfd), sec->name, - (unsigned long) offset); - bfd_set_error (bfd_error_invalid_operation); - return false; - - win: - if (!h) - { - /* This *should* only be the absolute section. It could potentially - be that someone has defined a non-global vtable though, which - would be bad. It isn't worth paging in the local symbols to be - sure though; that case should simply be handled by the assembler. */ - - child->vtable_parent = (struct elf_link_hash_entry *) -1; - } - else - child->vtable_parent = h; - - return true; -} - -/* Called from check_relocs to record the existance of a VTENTRY reloc. */ - -boolean -elf_gc_record_vtentry (abfd, sec, h, addend) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; - struct elf_link_hash_entry *h; - bfd_vma addend; -{ - struct elf_backend_data *bed = get_elf_backend_data (abfd); - int file_align = bed->s->file_align; - - if (addend >= h->vtable_entries_size) - { - size_t size, bytes; - boolean *ptr = h->vtable_entries_used; - - /* While the symbol is undefined, we have to be prepared to handle - a zero size. */ - if (h->root.type == bfd_link_hash_undefined) - size = addend; - else - { - size = h->size; - if (size < addend) - { - /* Oops! We've got a reference past the defined end of - the table. This is probably a bug -- shall we warn? */ - size = addend; - } - } - - /* Allocate one extra entry for use as a "done" flag for the - consolidation pass. */ - bytes = (size / file_align + 1) * sizeof (boolean); - - if (ptr) - { - ptr = bfd_realloc (ptr - 1, (bfd_size_type) bytes); - - if (ptr != NULL) - { - size_t oldbytes; - - oldbytes = ((h->vtable_entries_size / file_align + 1) - * sizeof (boolean)); - memset (((char *) ptr) + oldbytes, 0, bytes - oldbytes); - } - } - else - ptr = bfd_zmalloc ((bfd_size_type) bytes); - - if (ptr == NULL) - return false; - - /* And arrange for that done flag to be at index -1. */ - h->vtable_entries_used = ptr + 1; - h->vtable_entries_size = size; - } - - h->vtable_entries_used[addend / file_align] = true; - - return true; -} - -/* And an accompanying bit to work out final got entry offsets once - we're done. Should be called from final_link. */ - -boolean -elf_gc_common_finalize_got_offsets (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - bfd *i; - struct elf_backend_data *bed = get_elf_backend_data (abfd); - bfd_vma gotoff; - - /* The GOT offset is relative to the .got section, but the GOT header is - put into the .got.plt section, if the backend uses it. */ - if (bed->want_got_plt) - gotoff = 0; - else - gotoff = bed->got_header_size; - - /* Do the local .got entries first. */ - for (i = info->input_bfds; i; i = i->link_next) - { - bfd_signed_vma *local_got; - bfd_size_type j, locsymcount; - Elf_Internal_Shdr *symtab_hdr; - - if (bfd_get_flavour (i) != bfd_target_elf_flavour) - continue; - - local_got = elf_local_got_refcounts (i); - if (!local_got) - continue; - - symtab_hdr = &elf_tdata (i)->symtab_hdr; - if (elf_bad_symtab (i)) - locsymcount = symtab_hdr->sh_size / sizeof (Elf_External_Sym); - else - locsymcount = symtab_hdr->sh_info; - - for (j = 0; j < locsymcount; ++j) - { - if (local_got[j] > 0) - { - local_got[j] = gotoff; - gotoff += ARCH_SIZE / 8; - } - else - local_got[j] = (bfd_vma) -1; - } - } - - /* Then the global .got entries. .plt refcounts are handled by - adjust_dynamic_symbol */ - elf_link_hash_traverse (elf_hash_table (info), - elf_gc_allocate_got_offsets, - (PTR) &gotoff); - return true; -} - -/* We need a special top-level link routine to convert got reference counts - to real got offsets. */ - -static boolean -elf_gc_allocate_got_offsets (h, offarg) - struct elf_link_hash_entry *h; - PTR offarg; -{ - bfd_vma *off = (bfd_vma *) offarg; - - if (h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - if (h->got.refcount > 0) - { - h->got.offset = off[0]; - off[0] += ARCH_SIZE / 8; - } - else - h->got.offset = (bfd_vma) -1; - - return true; -} - -/* Many folk need no more in the way of final link than this, once - got entry reference counting is enabled. */ - -boolean -elf_gc_common_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - if (!elf_gc_common_finalize_got_offsets (abfd, info)) - return false; - - /* Invoke the regular ELF backend linker to do all the work. */ - return elf_bfd_final_link (abfd, info); -} - -/* This function will be called though elf_link_hash_traverse to store - all hash value of the exported symbols in an array. */ - -static boolean -elf_collect_hash_codes (h, data) - struct elf_link_hash_entry *h; - PTR data; -{ - unsigned long **valuep = (unsigned long **) data; - const char *name; - char *p; - unsigned long ha; - char *alc = NULL; - - if (h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - /* Ignore indirect symbols. These are added by the versioning code. */ - if (h->dynindx == -1) - return true; - - name = h->root.root.string; - p = strchr (name, ELF_VER_CHR); - if (p != NULL) - { - alc = bfd_malloc ((bfd_size_type) (p - name + 1)); - memcpy (alc, name, (size_t) (p - name)); - alc[p - name] = '\0'; - name = alc; - } - - /* Compute the hash value. */ - ha = bfd_elf_hash (name); - - /* Store the found hash value in the array given as the argument. */ - *(*valuep)++ = ha; - - /* And store it in the struct so that we can put it in the hash table - later. */ - h->elf_hash_value = ha; - - if (alc != NULL) - free (alc); - - return true; -} - -boolean -elf_reloc_symbol_deleted_p (offset, cookie) - bfd_vma offset; - PTR cookie; -{ - struct elf_reloc_cookie *rcookie = (struct elf_reloc_cookie *) cookie; - - if (rcookie->bad_symtab) - rcookie->rel = rcookie->rels; - - for (; rcookie->rel < rcookie->relend; rcookie->rel++) - { - unsigned long r_symndx = ELF_R_SYM (rcookie->rel->r_info); - - if (! rcookie->bad_symtab) - if (rcookie->rel->r_offset > offset) - return false; - if (rcookie->rel->r_offset != offset) - continue; - - if (r_symndx >= rcookie->locsymcount - || ELF_ST_BIND (rcookie->locsyms[r_symndx].st_info) != STB_LOCAL) - { - struct elf_link_hash_entry *h; - - h = rcookie->sym_hashes[r_symndx - rcookie->extsymoff]; - - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && elf_discarded_section (h->root.u.def.section)) - return true; - else - return false; - } - else - { - /* It's not a relocation against a global symbol, - but it could be a relocation against a local - symbol for a discarded section. */ - asection *isec; - Elf_Internal_Sym *isym; - - /* Need to: get the symbol; get the section. */ - isym = &rcookie->locsyms[r_symndx]; - if (isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE) - { - isec = section_from_elf_index (rcookie->abfd, isym->st_shndx); - if (isec != NULL && elf_discarded_section (isec)) - return true; - } - } - return false; - } - return false; -} - -/* Discard unneeded references to discarded sections. - Returns true if any section's size was changed. */ -/* This function assumes that the relocations are in sorted order, - which is true for all known assemblers. */ - -boolean -elf_bfd_discard_info (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - struct elf_reloc_cookie cookie; - asection *stab, *eh, *ehdr; - Elf_Internal_Shdr *symtab_hdr; - struct elf_backend_data *bed; - bfd *abfd; - boolean ret = false; - boolean strip = info->strip == strip_all || info->strip == strip_debugger; - - if (info->relocateable - || info->traditional_format - || info->hash->creator->flavour != bfd_target_elf_flavour - || ! is_elf_hash_table (info)) - return false; - - ehdr = NULL; - if (elf_hash_table (info)->dynobj != NULL) - ehdr = bfd_get_section_by_name (elf_hash_table (info)->dynobj, - ".eh_frame_hdr"); - - for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next) - { - if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) - continue; - - bed = get_elf_backend_data (abfd); - - if ((abfd->flags & DYNAMIC) != 0) - continue; - - eh = NULL; - if (ehdr) - { - eh = bfd_get_section_by_name (abfd, ".eh_frame"); - if (eh && (eh->_raw_size == 0 - || bfd_is_abs_section (eh->output_section))) - eh = NULL; - } - - stab = NULL; - if (!strip) - { - stab = bfd_get_section_by_name (abfd, ".stab"); - if (stab && (stab->_raw_size == 0 - || bfd_is_abs_section (stab->output_section))) - stab = NULL; - } - if ((! stab - || elf_section_data(stab)->sec_info_type != ELF_INFO_TYPE_STABS) - && ! eh - && (strip || ! bed->elf_backend_discard_info)) - continue; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - cookie.abfd = abfd; - cookie.sym_hashes = elf_sym_hashes (abfd); - cookie.bad_symtab = elf_bad_symtab (abfd); - if (cookie.bad_symtab) - { - cookie.locsymcount = - symtab_hdr->sh_size / sizeof (Elf_External_Sym); - cookie.extsymoff = 0; - } - else - { - cookie.locsymcount = symtab_hdr->sh_info; - cookie.extsymoff = symtab_hdr->sh_info; - } - - cookie.locsyms = (Elf_Internal_Sym *) symtab_hdr->contents; - if (cookie.locsyms == NULL && cookie.locsymcount != 0) - { - cookie.locsyms = bfd_elf_get_elf_syms (abfd, symtab_hdr, - cookie.locsymcount, 0, - NULL, NULL, NULL); - if (cookie.locsyms == NULL) - return false; - } - - if (stab) - { - cookie.rels = (NAME(_bfd_elf,link_read_relocs) - (abfd, stab, (PTR) NULL, (Elf_Internal_Rela *) NULL, - info->keep_memory)); - if (cookie.rels) - { - cookie.rel = cookie.rels; - cookie.relend = - cookie.rels + stab->reloc_count * bed->s->int_rels_per_ext_rel; - if (_bfd_discard_section_stabs (abfd, stab, - elf_section_data (stab)->sec_info, - elf_reloc_symbol_deleted_p, - &cookie)) - ret = true; - if (elf_section_data (stab)->relocs != cookie.rels) - free (cookie.rels); - } - } - - if (eh) - { - cookie.rels = NULL; - cookie.rel = NULL; - cookie.relend = NULL; - if (eh->reloc_count) - cookie.rels = (NAME(_bfd_elf,link_read_relocs) - (abfd, eh, (PTR) NULL, (Elf_Internal_Rela *) NULL, - info->keep_memory)); - if (cookie.rels) - { - cookie.rel = cookie.rels; - cookie.relend = - cookie.rels + eh->reloc_count * bed->s->int_rels_per_ext_rel; - } - if (_bfd_elf_discard_section_eh_frame (abfd, info, eh, ehdr, - elf_reloc_symbol_deleted_p, - &cookie)) - { - /* Relocs have been edited. Ensure edited version is - used later in relocate_section. */ - elf_section_data (eh)->relocs = cookie.rels; - ret = true; - } - if (cookie.rels && elf_section_data (eh)->relocs != cookie.rels) - free (cookie.rels); - } - - if (bed->elf_backend_discard_info) - { - if (bed->elf_backend_discard_info (abfd, &cookie, info)) - ret = true; - } - - if (cookie.locsyms != NULL - && symtab_hdr->contents != (unsigned char *) cookie.locsyms) - { - if (! info->keep_memory) - free (cookie.locsyms); - else - symtab_hdr->contents = (unsigned char *) cookie.locsyms; - } - } - - if (ehdr && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info, ehdr)) - ret = true; - return ret; -} - -static boolean -elf_section_ignore_discarded_relocs (sec) - asection *sec; -{ - struct elf_backend_data *bed; - - switch (elf_section_data (sec)->sec_info_type) - { - case ELF_INFO_TYPE_STABS: - case ELF_INFO_TYPE_EH_FRAME: - return true; - default: - break; - } - - bed = get_elf_backend_data (sec->owner); - if (bed->elf_backend_ignore_discarded_relocs != NULL - && (*bed->elf_backend_ignore_discarded_relocs) (sec)) - return true; - - return false; -} diff --git a/bfd/epoc-pe-arm.c b/bfd/epoc-pe-arm.c new file mode 100644 index 0000000000000..a6e0f8da5440a --- /dev/null +++ b/bfd/epoc-pe-arm.c @@ -0,0 +1,37 @@ +/* BFD back-end for ARM EPOC PE files. + Copyright 1999, 2000 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define TARGET_UNDERSCORE 0 +#define USER_LABEL_PREFIX "" + +#define TARGET_LITTLE_SYM arm_epoc_pe_little_vec +#define TARGET_LITTLE_NAME "epoc-pe-arm-little" +#define TARGET_BIG_SYM arm_epoc_pe_big_vec +#define TARGET_BIG_NAME "epoc-pe-arm-big" + +#define bfd_arm_allocate_interworking_sections \ + bfd_arm_epoc_pe_allocate_interworking_sections +#define bfd_arm_get_bfd_for_interworking \ + bfd_arm_epoc_pe_get_bfd_for_interworking +#define bfd_arm_process_before_allocation \ + bfd_arm_epoc_pe_process_before_allocation + +#define EXTRA_S_FLAGS (SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_CODE | SEC_READONLY | SEC_DATA) + +#include "pe-arm.c" diff --git a/bfd/epoc-pei-arm.c b/bfd/epoc-pei-arm.c new file mode 100644 index 0000000000000..fb286efd8ff3d --- /dev/null +++ b/bfd/epoc-pei-arm.c @@ -0,0 +1,30 @@ +/* BFD back-end for ARM EPOC PE IMAGE COFF files. + Copyright 1999, 2000 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define TARGET_UNDERSCORE 0 +#define USER_LABEL_PREFIX "" + +#define TARGET_LITTLE_SYM arm_epoc_pei_little_vec +#define TARGET_LITTLE_NAME "epoc-pei-arm-little" +#define TARGET_BIG_SYM arm_epoc_pei_big_vec +#define TARGET_BIG_NAME "epoc-pei-arm-big" + +#define EXTRA_S_FLAGS (SEC_CODE | SEC_READONLY | SEC_DATA) + +#include "pei-arm.c" diff --git a/bfd/go32stub.h b/bfd/go32stub.h new file mode 100644 index 0000000000000..333eec068be9c --- /dev/null +++ b/bfd/go32stub.h @@ -0,0 +1,128 @@ +0x4d,0x5a,0x00,0x00,0x04,0x00,0x00,0x00,0x20,0x00,0x27,0x00,0xff,0xff,0x00,0x00, +0x60,0x07,0x00,0x00,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x0a,0x73,0x74, +0x75,0x62,0x2e,0x68,0x20,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x20,0x66, +0x72,0x6f,0x6d,0x20,0x73,0x74,0x75,0x62,0x2e,0x61,0x73,0x6d,0x20,0x62,0x79,0x20, +0x64,0x6a,0x61,0x73,0x6d,0x2c,0x20,0x6f,0x6e,0x20,0x57,0x65,0x64,0x20,0x4a,0x75, +0x6e,0x20,0x32,0x38,0x20,0x31,0x31,0x3a,0x31,0x35,0x3a,0x30,0x34,0x20,0x32,0x30, +0x30,0x30,0x0d,0x0a,0x54,0x68,0x65,0x20,0x53,0x54,0x55,0x42,0x2e,0x45,0x58,0x45, +0x20,0x73,0x74,0x75,0x62,0x20,0x6c,0x6f,0x61,0x64,0x65,0x72,0x20,0x69,0x73,0x20, +0x43,0x6f,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x43,0x29,0x20,0x31,0x39, +0x39,0x33,0x2d,0x31,0x39,0x39,0x35,0x20,0x44,0x4a,0x20,0x44,0x65,0x6c,0x6f,0x72, +0x69,0x65,0x2e,0x20,0x0d,0x0a,0x50,0x65,0x72,0x6d,0x69,0x73,0x73,0x69,0x6f,0x6e, +0x20,0x67,0x72,0x61,0x6e,0x74,0x65,0x64,0x20,0x74,0x6f,0x20,0x75,0x73,0x65,0x20, +0x66,0x6f,0x72,0x20,0x61,0x6e,0x79,0x20,0x70,0x75,0x72,0x70,0x6f,0x73,0x65,0x20, +0x70,0x72,0x6f,0x76,0x69,0x64,0x65,0x64,0x20,0x74,0x68,0x69,0x73,0x20,0x63,0x6f, +0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x0d,0x0a,0x72,0x65,0x6d,0x61,0x69,0x6e, +0x73,0x20,0x70,0x72,0x65,0x73,0x65,0x6e,0x74,0x20,0x61,0x6e,0x64,0x20,0x75,0x6e, +0x6d,0x6f,0x64,0x69,0x66,0x69,0x65,0x64,0x2e,0x20,0x0d,0x0a,0x54,0x68,0x69,0x73, +0x20,0x6f,0x6e,0x6c,0x79,0x20,0x61,0x70,0x70,0x6c,0x69,0x65,0x73,0x20,0x74,0x6f, +0x20,0x74,0x68,0x65,0x20,0x73,0x74,0x75,0x62,0x2c,0x20,0x61,0x6e,0x64,0x20,0x6e, +0x6f,0x74,0x20,0x6e,0x65,0x63,0x65,0x73,0x73,0x61,0x72,0x69,0x6c,0x79,0x20,0x74, +0x68,0x65,0x20,0x77,0x68,0x6f,0x6c,0x65,0x20,0x70,0x72,0x6f,0x67,0x72,0x61,0x6d, +0x2e,0x0a,0x0d,0x0a,0x24,0x49,0x64,0x3a,0x20,0x73,0x74,0x75,0x62,0x2e,0x61,0x73, +0x6d,0x20,0x62,0x75,0x69,0x6c,0x74,0x20,0x30,0x36,0x2f,0x32,0x38,0x2f,0x31,0x30, +0x30,0x20,0x31,0x31,0x3a,0x31,0x35,0x3a,0x30,0x34,0x20,0x62,0x79,0x20,0x64,0x6a, +0x61,0x73,0x6d,0x20,0x24,0x0a,0x0d,0x0a,0x40,0x28,0x23,0x29,0x20,0x73,0x74,0x75, +0x62,0x2e,0x61,0x73,0x6d,0x20,0x62,0x75,0x69,0x6c,0x74,0x20,0x30,0x36,0x2f,0x32, +0x38,0x2f,0x31,0x30,0x30,0x20,0x31,0x31,0x3a,0x31,0x35,0x3a,0x30,0x34,0x20,0x62, +0x79,0x20,0x64,0x6a,0x61,0x73,0x6d,0x0a,0x0d,0x0a,0x1a,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x67,0x6f,0x33,0x32,0x73,0x74,0x75,0x62,0x2c,0x20,0x76,0x20,0x32,0x2e,0x30,0x32, +0x54,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x43,0x57,0x53,0x44,0x50,0x4d,0x49,0x2e,0x45,0x58,0x45,0x00, +0x00,0x00,0x00,0x00,0x0e,0x1f,0x8c,0x1e,0x24,0x00,0x8c,0x06,0x60,0x07,0xfc,0xb4, +0x30,0xcd,0x21,0x3c,0x03,0x73,0x08,0xb0,0x6d,0xba,0xa7,0x05,0xe9,0xd4,0x03,0xa2, +0x69,0x08,0xbe,0x20,0x00,0x8b,0x04,0x09,0xc0,0x75,0x02,0xb4,0xfe,0xbb,0x70,0x08, +0x39,0xc3,0x73,0x02,0x89,0xc3,0x89,0x1c,0xfe,0xc7,0xb9,0x04,0xff,0xd3,0xeb,0xb4, +0x4a,0xcd,0x21,0x73,0x08,0xd3,0xe3,0xfe,0xcf,0x89,0x1c,0xeb,0xd8,0x26,0x8e,0x06, +0x2c,0x00,0x31,0xff,0x30,0xc0,0xa9,0xf2,0xae,0x26,0x81,0x3d,0x50,0x41,0x75,0x15, +0xaf,0x26,0x81,0x3d,0x54,0x48,0x75,0x0d,0xaf,0x26,0x80,0x3d,0x3d,0x75,0x06,0x47, +0x89,0x3e,0x8c,0x04,0x4f,0xae,0x75,0xdf,0xaf,0xb4,0x3e,0xbb,0x13,0x00,0xcd,0x21, +0xb4,0x3e,0xbb,0x12,0x00,0xcd,0x21,0x06,0x57,0x31,0xc9,0x74,0x12,0xb0,0x6e,0xba, +0x7e,0x05,0xe9,0x5e,0x03,0x09,0xc9,0x75,0xf4,0x41,0xe8,0xa1,0x03,0x72,0xee,0xb8, +0x87,0x16,0xcd,0x2f,0x09,0xc0,0x75,0xed,0x80,0xe3,0x01,0x74,0xe8,0x89,0x3e,0x00, +0x06,0x8c,0x06,0x02,0x06,0x89,0x36,0x04,0x06,0x5f,0x07,0xe8,0xd3,0x02,0x89,0x3e, +0x2a,0x00,0x89,0x36,0x62,0x07,0x80,0x3e,0x2c,0x00,0x00,0x74,0x23,0xb9,0x08,0x00, +0xbf,0x2c,0x00,0x8a,0x05,0x47,0x08,0xc0,0x74,0x05,0x88,0x07,0x43,0xe2,0xf4,0x66, +0xc7,0x07,0x2e,0x45,0x58,0x45,0x83,0xc3,0x04,0xc6,0x07,0x00,0x89,0x1e,0x62,0x07, +0xb8,0x00,0x3d,0xba,0x64,0x07,0xcd,0x21,0x0f,0x82,0xb3,0x02,0xa3,0x06,0x06,0x89, +0xc3,0xb9,0x06,0x00,0xba,0xb5,0x07,0xb4,0x3f,0xcd,0x21,0x31,0xd2,0x31,0xc9,0xa1, +0xb5,0x07,0x3d,0x4c,0x01,0x74,0x1b,0x3d,0x4d,0x5a,0x0f,0x85,0x98,0x02,0x8b,0x16, +0xb9,0x07,0xc1,0xe2,0x09,0x8b,0x1e,0xb7,0x07,0x09,0xdb,0x74,0x05,0x80,0xee,0x02, +0x01,0xda,0x89,0x16,0xbb,0x07,0x89,0x0e,0xbd,0x07,0xb8,0x00,0x42,0x8b,0x1e,0x06, +0x06,0xcd,0x21,0xb9,0xa8,0x00,0xba,0xbf,0x07,0xb4,0x3f,0xcd,0x21,0x3d,0xa8,0x00, +0x75,0x06,0x81,0x3e,0xbf,0x07,0x4c,0x01,0x0f,0x85,0x61,0x02,0x66,0xa1,0xe3,0x07, +0x66,0xa3,0x10,0x06,0x66,0x8b,0x0e,0xbb,0x07,0x66,0xa1,0x03,0x08,0x66,0x01,0xc8, +0x66,0xa3,0x08,0x06,0x66,0xa1,0x2b,0x08,0x66,0x01,0xc8,0x66,0xa3,0x0c,0x06,0x66, +0x8b,0x1e,0x4b,0x08,0x66,0xa1,0x4f,0x08,0x66,0x01,0xc3,0x66,0xb8,0x01,0x00,0x01, +0x00,0x66,0x39,0xc3,0x73,0x03,0x66,0x89,0xc3,0x66,0x81,0xc3,0xff,0xff,0x00,0x00, +0x31,0xdb,0x66,0x89,0x1e,0x1c,0x00,0xe8,0xf5,0x02,0x8b,0x1e,0x04,0x06,0x09,0xdb, +0x74,0x0a,0xb4,0x48,0xcd,0x21,0x0f,0x82,0x15,0x02,0x8e,0xc0,0xe8,0x08,0x03,0xb8, +0x01,0x00,0xff,0x1e,0x00,0x06,0x0f,0x82,0x0f,0x02,0x8c,0x06,0x26,0x00,0x8c,0x0e, +0x28,0x00,0x8c,0xd8,0xa3,0x22,0x00,0x8e,0xc0,0x31,0xc0,0xb9,0x01,0x00,0xcd,0x31, +0x72,0x07,0xa3,0x14,0x06,0x31,0xc0,0xcd,0x31,0x0f,0x82,0xf3,0x01,0xa3,0x16,0x06, +0x66,0x8b,0x0e,0x1c,0x00,0xb8,0x01,0x05,0x8b,0x1e,0x1e,0x00,0xcd,0x31,0x0f,0x82, +0xe5,0x01,0x89,0x1e,0x1a,0x06,0x89,0x0e,0x18,0x06,0x89,0x36,0x1a,0x00,0x89,0x3e, +0x18,0x00,0xb8,0x07,0x00,0x8b,0x1e,0x14,0x06,0x8b,0x0e,0x1a,0x06,0x8b,0x16,0x18, +0x06,0xcd,0x31,0xb8,0x09,0x00,0x8c,0xc9,0x83,0xe1,0x03,0xc1,0xe1,0x05,0x51,0x81, +0xc9,0x9b,0xc0,0xcd,0x31,0xb8,0x08,0x00,0x8b,0x0e,0x1e,0x00,0x49,0xba,0xff,0xff, +0xcd,0x31,0xb8,0x07,0x00,0x8b,0x1e,0x16,0x06,0x8b,0x0e,0x1a,0x06,0x8b,0x16,0x18, +0x06,0xcd,0x31,0xb8,0x09,0x00,0x59,0x81,0xc9,0x93,0xc0,0xcd,0x31,0xb8,0x08,0x00, +0x8b,0x0e,0x1e,0x00,0x49,0xba,0xff,0xff,0xcd,0x31,0xb8,0x00,0x01,0xbb,0x00,0x0f, +0xcd,0x31,0x73,0x10,0x3d,0x08,0x00,0x0f,0x85,0x73,0x01,0xb8,0x00,0x01,0xcd,0x31, +0x0f,0x82,0x6a,0x01,0xa3,0x1c,0x06,0x89,0x16,0x1e,0x06,0xc1,0xe3,0x04,0x89,0x1e, +0x20,0x06,0x66,0x8b,0x36,0x08,0x06,0x66,0x8b,0x3e,0xfb,0x07,0x66,0x8b,0x0e,0xff, +0x07,0xe8,0x49,0x00,0x66,0x8b,0x36,0x0c,0x06,0x66,0x8b,0x3e,0x23,0x08,0x66,0x8b, +0x0e,0x27,0x08,0xe8,0x37,0x00,0x8e,0x06,0x16,0x06,0x66,0x8b,0x3e,0x4b,0x08,0x66, +0x8b,0x0e,0x4f,0x08,0x66,0x31,0xc0,0x66,0xc1,0xe9,0x02,0x67,0xf3,0x66,0xab,0xb4, +0x3e,0x8b,0x1e,0x06,0x06,0xcd,0x21,0xb8,0x01,0x01,0x8b,0x16,0x1e,0x06,0xcd,0x31, +0x1e,0x0f,0xa1,0x8e,0x1e,0x16,0x06,0x66,0x64,0xff,0x2e,0x10,0x06,0x66,0x89,0xf0, +0x66,0x25,0xff,0x01,0x00,0x00,0x66,0x01,0xc1,0x29,0xc6,0x66,0x29,0xc7,0x66,0x89, +0x0e,0x26,0x06,0x66,0x89,0x3e,0x22,0x06,0xe8,0x0f,0x01,0x89,0x36,0x3e,0x06,0x66, +0xc1,0xee,0x10,0x89,0x36,0x42,0x06,0x8b,0x1e,0x06,0x06,0x89,0x1e,0x3a,0x06,0xc7, +0x06,0x46,0x06,0x00,0x42,0xe8,0x03,0x01,0xa1,0x1c,0x06,0xa3,0x4e,0x06,0xc7,0x06, +0x3e,0x06,0x00,0x00,0xc6,0x06,0x47,0x06,0x3f,0xa1,0x28,0x06,0x09,0xc0,0x75,0x09, +0xa1,0x26,0x06,0x3b,0x06,0x20,0x06,0x76,0x03,0xa1,0x20,0x06,0xa3,0x42,0x06,0xe8, +0xd9,0x00,0x66,0x31,0xc9,0x8b,0x0e,0x46,0x06,0x66,0x8b,0x3e,0x22,0x06,0x66,0x01, +0x0e,0x22,0x06,0x66,0x29,0x0e,0x26,0x06,0x66,0x31,0xf6,0xc1,0xe9,0x02,0x1e,0x06, +0x8e,0x06,0x16,0x06,0x8e,0x1e,0x1e,0x06,0x67,0xf3,0x66,0xa5,0x07,0x1f,0x66,0x03, +0x0e,0x26,0x06,0x75,0xaf,0xc3,0x3c,0x3a,0x74,0x06,0x3c,0x2f,0x74,0x02,0x3c,0x5c, +0xc3,0xbe,0x64,0x07,0x89,0xf3,0x26,0x8a,0x05,0x47,0x88,0x04,0x38,0xe0,0x74,0x0e, +0x08,0xc0,0x74,0x0a,0x46,0xe8,0xde,0xff,0x75,0xec,0x89,0xf3,0x74,0xe8,0xc3,0xb0, +0x66,0xba,0x48,0x05,0xeb,0x0c,0xb0,0x67,0xba,0x55,0x05,0xeb,0x05,0xb0,0x68,0xba, +0x5f,0x05,0x52,0x8b,0x1e,0x62,0x07,0xc6,0x07,0x24,0xbb,0x64,0x07,0xeb,0x28,0xe8, +0xf5,0x00,0xb0,0x69,0xba,0x99,0x05,0xeb,0x1a,0xb0,0x6a,0xba,0xb2,0x05,0xeb,0x13, +0xb0,0x6b,0xba,0xc4,0x05,0xeb,0x0c,0xb0,0x6c,0xba,0xd6,0x05,0xeb,0x05,0xb0,0x69, +0xba,0x99,0x05,0x52,0xbb,0x3b,0x05,0xe8,0x15,0x00,0x5b,0xe8,0x11,0x00,0xbb,0x67, +0x04,0xe8,0x0b,0x00,0xb4,0x4c,0xcd,0x21,0x43,0x50,0xb4,0x02,0xcd,0x21,0x58,0x8a, +0x17,0x80,0xfa,0x24,0x75,0xf2,0xc3,0x0d,0x0a,0x24,0x50,0x51,0x57,0x31,0xc0,0xbf, +0x2a,0x06,0xb9,0x19,0x00,0xf3,0xab,0x5f,0x59,0x58,0xc3,0xb8,0x00,0x03,0xbb,0x21, +0x00,0x31,0xc9,0x66,0xbf,0x2a,0x06,0x00,0x00,0xcd,0x31,0xc3,0x00,0x00,0x30,0xe4, +0xe8,0x4e,0xff,0x89,0xde,0x8b,0x3e,0x8c,0x04,0xeb,0x17,0xb4,0x3b,0xe8,0x41,0xff, +0x81,0xfe,0x64,0x07,0x74,0x12,0x8a,0x44,0xff,0xe8,0x2a,0xff,0x74,0x04,0xc6,0x04, +0x5c,0x46,0xe8,0x03,0x00,0x72,0xe4,0xc3,0xe8,0x34,0x00,0xbb,0x44,0x00,0x8a,0x07, +0x88,0x04,0x43,0x46,0x08,0xc0,0x75,0xf6,0x06,0x57,0x1e,0x07,0xe8,0x9b,0xff,0xbb, +0x2a,0x06,0x8c,0x5f,0x04,0x89,0x5f,0x02,0xba,0x64,0x07,0xb8,0x00,0x4b,0xcd,0x21, +0x5f,0x07,0x72,0x09,0xb4,0x4d,0xcd,0x21,0x2d,0x00,0x03,0xf7,0xd8,0xeb,0x28,0x80, +0x3e,0x69,0x08,0x05,0x72,0x20,0xb8,0x00,0x58,0xcd,0x21,0xa2,0x67,0x08,0xb8,0x02, +0x58,0xcd,0x21,0xa2,0x68,0x08,0xb8,0x01,0x58,0xbb,0x80,0x00,0xcd,0x21,0xb8,0x03, +0x58,0xbb,0x01,0x00,0xcd,0x21,0xc3,0x9c,0x80,0x3e,0x69,0x08,0x05,0x72,0x1a,0x50, +0x53,0xb8,0x03,0x58,0x8a,0x1e,0x68,0x08,0x30,0xff,0xcd,0x21,0xb8,0x01,0x58,0x8a, +0x1e,0x67,0x08,0x30,0xff,0xcd,0x21,0x5b,0x58,0x9d,0xc3,0x4c,0x6f,0x61,0x64,0x20, +0x65,0x72,0x72,0x6f,0x72,0x3a,0x20,0x24,0x3a,0x20,0x63,0x61,0x6e,0x27,0x74,0x20, +0x6f,0x70,0x65,0x6e,0x24,0x3a,0x20,0x6e,0x6f,0x74,0x20,0x45,0x58,0x45,0x24,0x3a, +0x20,0x6e,0x6f,0x74,0x20,0x43,0x4f,0x46,0x46,0x20,0x28,0x43,0x68,0x65,0x63,0x6b, +0x20,0x66,0x6f,0x72,0x20,0x76,0x69,0x72,0x75,0x73,0x65,0x73,0x29,0x24,0x6e,0x6f, +0x20,0x44,0x50,0x4d,0x49,0x20,0x2d,0x20,0x47,0x65,0x74,0x20,0x63,0x73,0x64,0x70, +0x6d,0x69,0x2a,0x62,0x2e,0x7a,0x69,0x70,0x24,0x6e,0x6f,0x20,0x44,0x4f,0x53,0x20, +0x6d,0x65,0x6d,0x6f,0x72,0x79,0x24,0x6e,0x65,0x65,0x64,0x20,0x44,0x4f,0x53,0x20, +0x33,0x24,0x63,0x61,0x6e,0x27,0x74,0x20,0x73,0x77,0x69,0x74,0x63,0x68,0x20,0x6d, +0x6f,0x64,0x65,0x24,0x6e,0x6f,0x20,0x44,0x50,0x4d,0x49,0x20,0x73,0x65,0x6c,0x65, +0x63,0x74,0x6f,0x72,0x73,0x24,0x6e,0x6f,0x20,0x44,0x50,0x4d,0x49,0x20,0x6d,0x65, +0x6d,0x6f,0x72,0x79,0x24,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90, +0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 diff --git a/bfd/hosts/alphavms.h b/bfd/hosts/alphavms.h new file mode 100644 index 0000000000000..e77c21ff232ec --- /dev/null +++ b/bfd/hosts/alphavms.h @@ -0,0 +1,68 @@ +/* alphavms.h -- BFD definitions for an openVMS host + Copyright 1996, 2000 Free Software Foundation, Inc. + Written by Klaus Kämpf (kkaempf@progis.de) + of proGIS Softwareentwicklung, Aachen, Germany + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "bfd.h" + +#ifndef BFD_HOST_64_BIT +/* Make the basic types 64-bit quantities on the host. + Also provide the support macros BFD needs. */ +# ifdef __GNUC__ +# define BFD_HOST_64_BIT long long +# else +# define BFD_HOST_64_BIT long +# endif +typedef unsigned BFD_HOST_64_BIT uint64_type; +typedef BFD_HOST_64_BIT int64_type; + +# define sprintf_vma(s,x) sprintf (s, "%016lx", x) /* BFD_HOST_64_BIT */ +# define fprintf_vma(f,x) fprintf (f, "%016lx", x) /* BFD_HOST_64_BIT */ + +# define BYTES_IN_PRINTF_INT 4 + +/* These must have type unsigned long because they are used as + arguments in printf functions. */ +# define uint64_typeLOW(x) ((unsigned long) (((x) & 0xffffffff))) /* BFD_HOST_64_BIT */ +# define uint64_typeHIGH(x) ((unsigned long) (((x) >> 32) & 0xffffffff)) /* BFD_HOST_64_BIT */ + +#endif /* BFD_HOST_64_BIT */ + +#include "fopen-vms.h" + +#define NO_FCNTL 1 + +#ifndef O_ACCMODE +#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) +#endif + +extern int getpagesize PARAMS ((void)); diff --git a/bfd/hosts/delta68.h b/bfd/hosts/delta68.h new file mode 100644 index 0000000000000..1a6a6e6f197e1 --- /dev/null +++ b/bfd/hosts/delta68.h @@ -0,0 +1,18 @@ +/* Definitions for a Motorola Delta 3300 box running System V R3.0. + Contributed by manfred@lts.sel.alcatel.de. */ + +#include + +/* Definitions used by trad-core.c. */ +#define NBPG NBPC +#define HOST_DATA_START_ADDR u.u_exdata.ux_datorg +#define HOST_TEXT_START_ADDR u.u_exdata.ux_txtorg +#if 0 +#define HOST_STACK_END_ADDR 0x40000000 +#else +/* User's stack, copied from sys/param.h */ +#define HOST_STACK_END_ADDR USRSTACK +#endif +#define UPAGES USIZE +#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \ + abfd->tdata.trad_core_data->u.u_abort diff --git a/bfd/hosts/dpx2.h b/bfd/hosts/dpx2.h new file mode 100644 index 0000000000000..ea6395f2e5d73 --- /dev/null +++ b/bfd/hosts/dpx2.h @@ -0,0 +1,8 @@ +/* Definitions that are needed for core files. Core section sizes for + the DPX2 are in bytes. */ + +#include +#define NBPG 1 +#define UPAGES (USIZE * NBPP) +#define HOST_DATA_START_ADDR (u.u_exdata.ux_datorg) +#define HOST_STACK_END_ADDR (USERSTACK) diff --git a/bfd/hosts/hp300bsd.h b/bfd/hosts/hp300bsd.h new file mode 100644 index 0000000000000..9828717820735 --- /dev/null +++ b/bfd/hosts/hp300bsd.h @@ -0,0 +1,13 @@ +#include +#ifdef BSD4_4 +#define NO_CORE_COMMAND +#endif + +#define HOST_PAGE_SIZE NBPG +#define HOST_SEGMENT_SIZE NBPG /* Data seg start addr rounds to NBPG */ +#define HOST_MACHINE_ARCH bfd_arch_m68k +/* #define HOST_MACHINE_MACHINE */ + +#define HOST_TEXT_START_ADDR 0 +#define HOST_STACK_END_ADDR 0xfff00000 +#define HOST_BIG_ENDIAN_P diff --git a/bfd/hosts/i386mach3.h b/bfd/hosts/i386mach3.h new file mode 100644 index 0000000000000..dcc61e3c8e898 --- /dev/null +++ b/bfd/hosts/i386mach3.h @@ -0,0 +1,25 @@ +#include +#include + +/* This is an ugly way to hack around the incorrect + * definition of UPAGES in i386/machparam.h. + * + * The definition should specify the size reserved + * for "struct user" in core files in PAGES, + * but instead it gives it in 512-byte core-clicks + * for i386 and i860. UPAGES is used only in trad-core.c. + */ +#if UPAGES == 16 +#undef UPAGES +#define UPAGES 2 +#endif + +#if UPAGES != 2 +FIXME!! UPAGES is neither 2 nor 16 +#endif + +#define HOST_PAGE_SIZE 1 +#define HOST_SEGMENT_SIZE NBPG +#define HOST_MACHINE_ARCH bfd_arch_i386 +#define HOST_TEXT_START_ADDR USRTEXT +#define HOST_STACK_END_ADDR USRSTACK diff --git a/bfd/hosts/i860mach3.h b/bfd/hosts/i860mach3.h new file mode 100644 index 0000000000000..edd2aa10a7bb5 --- /dev/null +++ b/bfd/hosts/i860mach3.h @@ -0,0 +1,27 @@ +/* This file was hacked from i386mach3.h [dolan@ssd.intel.com] */ + +#include +#include + +/* This is an ugly way to hack around the incorrect + * definition of UPAGES in i386/machparam.h. + * + * The definition should specify the size reserved + * for "struct user" in core files in PAGES, + * but instead it gives it in 512-byte core-clicks + * for i386 and i860. UPAGES is used only in trad-core.c. + */ +#if UPAGES == 16 +#undef UPAGES +#define UPAGES 2 +#endif + +#if UPAGES != 2 +FIXME!! UPAGES is neither 2 nor 16 +#endif + +#define HOST_PAGE_SIZE 1 +#define HOST_SEGMENT_SIZE NBPG +#define HOST_MACHINE_ARCH bfd_arch_i860 +#define HOST_TEXT_START_ADDR USRTEXT +#define HOST_STACK_END_ADDR USRSTACK diff --git a/bfd/hosts/m68kaux.h b/bfd/hosts/m68kaux.h new file mode 100644 index 0000000000000..6237755dba553 --- /dev/null +++ b/bfd/hosts/m68kaux.h @@ -0,0 +1,16 @@ +/* Definitions for an Apple Macintosh running A/UX 3.x. */ + +#include +#include + +/* Definitions used by trad-core.c. */ +#define NBPG NBPP + +#define HOST_DATA_START_ADDR u.u_exdata.ux_datorg +#define HOST_TEXT_START_ADDR u.u_exdata.ux_txtorg +#define HOST_STACK_END_ADDR 0x100000000 + +#define UPAGES USIZE + +#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \ + (abfd->tdata.trad_core_data->u.u_arg[0]) diff --git a/bfd/hosts/m68klinux.h b/bfd/hosts/m68klinux.h new file mode 100644 index 0000000000000..0067dfa6fda31 --- /dev/null +++ b/bfd/hosts/m68klinux.h @@ -0,0 +1,6 @@ +/* Linux dumps "struct task_struct" at the end of the core-file. This + structure is currently 2512 bytes long, but we allow up to 4096 + bytes to allow for some future growth. */ +#define TRAD_CORE_EXTRA_SIZE_ALLOWED 4096 +#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \ + ((abfd)->tdata.trad_core_data->u.signal) diff --git a/bfd/hosts/m88kmach3.h b/bfd/hosts/m88kmach3.h new file mode 100644 index 0000000000000..421553893ec93 --- /dev/null +++ b/bfd/hosts/m88kmach3.h @@ -0,0 +1,11 @@ +#include +#include + +#undef UPAGES +#define UPAGES 3 + +#define HOST_PAGE_SIZE NBPG +#define HOST_SEGMENT_SIZE NBPG +#define HOST_MACHINE_ARCH bfd_arch_m88k +#define HOST_TEXT_START_ADDR USRTEXT +#define HOST_STACK_END_ADDR USRSTACK diff --git a/bfd/hosts/news.h b/bfd/hosts/news.h new file mode 100644 index 0000000000000..bf7946cdb999f --- /dev/null +++ b/bfd/hosts/news.h @@ -0,0 +1,9 @@ +/* Sony News running NewsOS 3.2. */ + +#include + +#define HOST_PAGE_SIZE NBPG +#define HOST_SEGMENT_SIZE NBPG +#define HOST_MACHINE_ARCH bfd_arch_m68k +#define HOST_TEXT_START_ADDR 0 +#define HOST_STACK_END_ADDR (KERNBASE - (UPAGES * NBPG)) diff --git a/bfd/hosts/pc532mach.h b/bfd/hosts/pc532mach.h new file mode 100644 index 0000000000000..ab96f597edd2d --- /dev/null +++ b/bfd/hosts/pc532mach.h @@ -0,0 +1,24 @@ +#include +#include + +/* This is an ugly way to hack around the incorrect + * definition of UPAGES in ns532/machparam.h. + * + * The definition should specify the size reserved + * for "struct user" in core files in PAGES, + * but instead it gives it in 512-byte core-clicks + * for ns532, i386 and i860. UPAGES is used only in trad-core.c. + */ +#if UPAGES == 16 +#undef UPAGES +#define UPAGES 2 +#endif + +#if UPAGES != 2 +#error UPAGES is neither 2 nor 16 +#endif + +#define HOST_PAGE_SIZE 1 +#define HOST_SEGMENT_SIZE NBPG +#define HOST_TEXT_START_ADDR USRTEXT +#define HOST_STACK_END_ADDR USRSTACK diff --git a/bfd/hosts/riscos.h b/bfd/hosts/riscos.h new file mode 100644 index 0000000000000..8ffa826bdcf5c --- /dev/null +++ b/bfd/hosts/riscos.h @@ -0,0 +1,10 @@ +/* RISC/os 4.52C, and presumably other versions. */ + +#include +#include + +#define NBPG BSD43_NBPG +#define UPAGES BSD43_UPAGES +#define HOST_TEXT_START_ADDR BSD43_USRTEXT +#define HOST_DATA_START_ADDR BSD43_USRDATA +#define HOST_STACK_END_ADDR BSD43_USRSTACK diff --git a/bfd/hosts/symmetry.h b/bfd/hosts/symmetry.h new file mode 100644 index 0000000000000..75717b31eb22b --- /dev/null +++ b/bfd/hosts/symmetry.h @@ -0,0 +1,20 @@ +/* Symmetry running either dynix 3.1 (bsd) or ptx (sysv). */ + +#define NBPG 4096 +#define UPAGES 1 + +#ifdef _SEQUENT_ +/* ptx */ +#define HOST_TEXT_START_ADDR 0 +#define HOST_STACK_END_ADDR 0x3fffe000 +#define TRAD_CORE_USER_OFFSET ((UPAGES * NBPG) - sizeof (struct user)) +#else +/* dynix */ +#define HOST_TEXT_START_ADDR 0x1000 +#define HOST_DATA_START_ADDR (NBPG * u.u_tsize) +#define HOST_STACK_END_ADDR 0x3ffff000 +#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \ + ((core_bfd)->tdata.trad_core_data->u.u_arg[0]) +#endif + +#define TRAD_CORE_DSIZE_INCLUDES_TSIZE diff --git a/bfd/hosts/tahoe.h b/bfd/hosts/tahoe.h new file mode 100644 index 0000000000000..716cee2a171da --- /dev/null +++ b/bfd/hosts/tahoe.h @@ -0,0 +1,12 @@ +#define NO_CORE_COMMAND + +#undef ALIGN /* They use it, we use it too */ +#include +#undef ALIGN /* They use it, we use it too */ + +#define HOST_PAGE_SIZE NBPG +#define HOST_MACHINE_ARCH bfd_arch_tahoe + +#define HOST_TEXT_START_ADDR 0 +#define HOST_STACK_END_ADDR (KERNBASE - (UPAGES * NBPG)) +#define HOST_BIG_ENDIAN_P diff --git a/bfd/hosts/vaxbsd.h b/bfd/hosts/vaxbsd.h new file mode 100644 index 0000000000000..ceb9ccedfaf13 --- /dev/null +++ b/bfd/hosts/vaxbsd.h @@ -0,0 +1,19 @@ +#define NO_CORE_COMMAND /* No command name in core file */ + +#if 0 +#undef ALIGN /* They use it, we use it too */ +/* Does not exist on BSD 4.3, it uses machine/machparam.h. + Whatever it is, it's included by , which trad-core.c, + the only place that uses this (I think), already includes. */ +#include +#endif +#undef ALIGN /* They use it, we use it too */ + +/* Note that HOST_PAGE_SIZE -- the page size as far as executable files + are concerned -- is not the same as NBPG, because of page clustering. */ +#define HOST_PAGE_SIZE 1024 +#define HOST_MACHINE_ARCH bfd_arch_vax + +#define HOST_TEXT_START_ADDR 0 +#define HOST_STACK_END_ADDR (0x80000000 - (UPAGES * NBPG)) +#undef HOST_BIG_ENDIAN_P diff --git a/bfd/hosts/vaxult.h b/bfd/hosts/vaxult.h new file mode 100644 index 0000000000000..13731b7479f6d --- /dev/null +++ b/bfd/hosts/vaxult.h @@ -0,0 +1,8 @@ +#include +#include +#define HOST_PAGE_SIZE (NBPG*CLSIZE) +#define HOST_MACHINE_ARCH bfd_arch_vax + +#define HOST_TEXT_START_ADDR USRTEXT +#define HOST_STACK_END_ADDR USRSTACK +#undef HOST_BIG_ENDIAN_P diff --git a/bfd/hosts/vaxult2.h b/bfd/hosts/vaxult2.h new file mode 100644 index 0000000000000..13731b7479f6d --- /dev/null +++ b/bfd/hosts/vaxult2.h @@ -0,0 +1,8 @@ +#include +#include +#define HOST_PAGE_SIZE (NBPG*CLSIZE) +#define HOST_MACHINE_ARCH bfd_arch_vax + +#define HOST_TEXT_START_ADDR USRTEXT +#define HOST_STACK_END_ADDR USRSTACK +#undef HOST_BIG_ENDIAN_P diff --git a/bfd/hp300bsd.c b/bfd/hp300bsd.c new file mode 100644 index 0000000000000..4d005ce9acafb --- /dev/null +++ b/bfd/hp300bsd.c @@ -0,0 +1,40 @@ +/* BFD back-end for HP 9000/300 (68000-based) machines running BSD Unix. + Copyright 1992, 1994, 1995, 2001, 2003 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define TARGET_IS_BIG_ENDIAN_P +#define N_HEADER_IN_TEXT(x) 0 +#define ENTRY_CAN_BE_ZERO +#define N_SHARED_LIB(x) 0 /* Avoids warning */ +#define TEXT_START_ADDR 0 +#define TARGET_PAGE_SIZE 4096 +#define SEGMENT_SIZE TARGET_PAGE_SIZE +#define DEFAULT_ARCH bfd_arch_m68k + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (hp300bsd_,OP) +#define TARGETNAME "a.out-hp300bsd" + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "libaout.h" + +#include "aout-target.h" diff --git a/bfd/hp300hpux.c b/bfd/hp300hpux.c new file mode 100644 index 0000000000000..f6cdd192154bf --- /dev/null +++ b/bfd/hp300hpux.c @@ -0,0 +1,883 @@ +/* BFD backend for hp-ux 9000/300 + Copyright 1990, 1991, 1993, 1994, 1995, 1997, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Written by Glenn Engel. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* + hpux native ------------> | | + | hp300hpux bfd | ----------> hpux w/gnu ext + hpux w/gnu extension ----> | | + + Support for the 9000/[34]00 has several limitations. + 1. Shared libraries are not supported. + 2. The output format from this bfd is not usable by native tools. + + The primary motivation for writing this bfd was to allow use of + gdb and gcc for host based debugging and not to mimic the hp-ux tools + in every detail. This leads to a significant simplification of the + code and a leap in performance. The decision to not output hp native + compatible objects was further strengthened by the fact that the richness + of the gcc compiled objects could not be represented without loss of + information. For example, while the hp format supports the concept of + secondary symbols, it does not support indirect symbols. Another + reason is to maintain backwards compatibility with older implementations + of gcc on hpux which used 'hpxt' to translate .a and .o files into a + format which could be readily understood by the gnu linker and gdb. + This allows reading hp secondary symbols and converting them into + indirect symbols but the reverse it not always possible. + + Another example of differences is that the hp format stores symbol offsets + in the object code while the gnu utilities use a field in the + relocation record for this. To support the hp native format, the object + code would need to be patched with the offsets when producing .o files. + + The basic technique taken in this implementation is to #include the code + from aoutx.h and aout-target.h with appropriate #defines to override + code where a unique implementation is needed: + + { + #define a bunch of stuff + #include + + implement a bunch of functions + + #include "aout-target.h" + } + + The hp symbol table is a bit different than other a.out targets. Instead + of having an array of nlist items and an array of strings, hp's format + has them mixed together in one structure. In addition, the strings are + not null terminated. It looks something like this: + + nlist element 1 + string1 + nlist element 2 + string2 + ... + + The whole symbol table is read as one chunk and then we march thru it + and convert it to canonical form. As we march thru the table, we copy + the nlist data into the internal form and we compact the strings and null + terminate them, using storage from the already allocated symbol table: + + string1 + null + string2 + null + */ + +/* @@ Is this really so different from normal a.out that it needs to include + aoutx.h? We should go through this file sometime and see what can be made + more dependent on aout32.o and what might need to be broken off and accessed + through the backend_data field. Or, maybe we really do need such a + completely separate implementation. I don't have time to investigate this + much further right now. [raeburn:19930428.2124EST] */ +/* @@ Also, note that there wind up being two versions of some routines, with + different names, only one of which actually gets used. For example: + slurp_symbol_table + swap_std_reloc_in + slurp_reloc_table + canonicalize_symtab + get_symtab_upper_bound + canonicalize_reloc + mkobject + This should also be fixed. */ + +#define TARGETNAME "a.out-hp300hpux" + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (hp300hpux_,OP) + +#define external_exec hp300hpux_exec_bytes +#define external_nlist hp300hpux_nlist_bytes + +#include "aout/hp300hpux.h" + +/* define these so we can compile unused routines in aoutx.h */ +#define e_strx e_shlib +#define e_other e_length +#define e_desc e_almod + +#define AR_PAD_CHAR '/' +#define TARGET_IS_BIG_ENDIAN_P +#define DEFAULT_ARCH bfd_arch_m68k + +#define MY_get_section_contents aout_32_get_section_contents +#define MY_slurp_armap bfd_slurp_bsd_armap_f2 + +/***********************************************/ +/* provide overrides for routines in this file */ +/***********************************************/ +/* these don't use MY because that causes problems within JUMP_TABLE + (CONCAT2 winds up being expanded recursively, which ANSI C compilers + will not do). */ +#define MY_canonicalize_symtab hp300hpux_canonicalize_symtab +#define MY_get_symtab_upper_bound hp300hpux_get_symtab_upper_bound +#define MY_canonicalize_reloc hp300hpux_canonicalize_reloc +#define MY_write_object_contents hp300hpux_write_object_contents + +#define MY_read_minisymbols _bfd_generic_read_minisymbols +#define MY_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol + +#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define MY_final_link_callback unused +#define MY_bfd_final_link _bfd_generic_final_link + +/* Until and unless we convert the slurp_reloc and slurp_symtab + routines in this file, we can not use the default aout + free_cached_info routine which assumes that the relocs and symtabs + were allocated using malloc. */ +#define MY_bfd_free_cached_info bfd_true + +#define hp300hpux_write_syms aout_32_write_syms + +#define MY_callback MY(callback) + +#define MY_exec_hdr_flags 0x2 + +#define NAME_swap_exec_header_in NAME(hp300hpux_32_,swap_exec_header_in) + +#define HP_SYMTYPE_UNDEFINED 0x00 +#define HP_SYMTYPE_ABSOLUTE 0x01 +#define HP_SYMTYPE_TEXT 0x02 +#define HP_SYMTYPE_DATA 0x03 +#define HP_SYMTYPE_BSS 0x04 +#define HP_SYMTYPE_COMMON 0x05 + +#define HP_SYMTYPE_TYPE 0x0F +#define HP_SYMTYPE_FILENAME 0x1F + +#define HP_SYMTYPE_ALIGN 0x10 +#define HP_SYMTYPE_EXTERNAL 0x20 +#define HP_SECONDARY_SYMBOL 0x40 + +/* RELOCATION DEFINITIONS */ +#define HP_RSEGMENT_TEXT 0x00 +#define HP_RSEGMENT_DATA 0x01 +#define HP_RSEGMENT_BSS 0x02 +#define HP_RSEGMENT_EXTERNAL 0x03 +#define HP_RSEGMENT_PCREL 0x04 +#define HP_RSEGMENT_RDLT 0x05 +#define HP_RSEGMENT_RPLT 0x06 +#define HP_RSEGMENT_NOOP 0x3F + +#define HP_RLENGTH_BYTE 0x00 +#define HP_RLENGTH_WORD 0x01 +#define HP_RLENGTH_LONG 0x02 +#define HP_RLENGTH_ALIGN 0x03 + +#define NAME(x,y) CONCAT3 (hp300hpux,_32_,y) +#define ARCH_SIZE 32 + +/* aoutx.h requires definitions for BMAGIC and QMAGIC. */ +#define BMAGIC HPUX_DOT_O_MAGIC +#define QMAGIC 0314 + +#include "aoutx.h" + +static const bfd_target * MY (callback) + PARAMS ((bfd *)); +static bfd_boolean MY (write_object_contents) + PARAMS ((bfd *)); +static void convert_sym_type + PARAMS ((struct external_nlist *, aout_symbol_type *, bfd *)); + +bfd_boolean MY (slurp_symbol_table) + PARAMS ((bfd *)); +void MY (swap_std_reloc_in) + PARAMS ((bfd *, struct hp300hpux_reloc *, arelent *, asymbol **, + bfd_size_type)); +bfd_boolean MY (slurp_reloc_table) + PARAMS ((bfd *, sec_ptr, asymbol **)); +long MY (canonicalize_symtab) + PARAMS ((bfd *, asymbol **)); +long MY (get_symtab_upper_bound) + PARAMS ((bfd *)); +long MY (canonicalize_reloc) + PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); + +/* Since the hpux symbol table has nlist elements interspersed with + strings and we need to insert som strings for secondary symbols, we + give ourselves a little extra padding up front to account for + this. Note that for each non-secondary symbol we process, we gain + 9 bytes of space for the discarded nlist element (one byte used for + null). SYM_EXTRA_BYTES is the extra space. */ +#define SYM_EXTRA_BYTES 1024 + +/* Set parameters about this a.out file that are machine-dependent. + This routine is called from some_aout_object_p just before it returns. */ +static const bfd_target * +MY (callback) (abfd) + bfd *abfd; +{ + struct internal_exec *execp = exec_hdr (abfd); + + /* Calculate the file positions of the parts of a newly read aout header */ + obj_textsec (abfd)->_raw_size = N_TXTSIZE (*execp); + + /* The virtual memory addresses of the sections */ + obj_textsec (abfd)->vma = N_TXTADDR (*execp); + obj_datasec (abfd)->vma = N_DATADDR (*execp); + obj_bsssec (abfd)->vma = N_BSSADDR (*execp); + + obj_textsec (abfd)->lma = obj_textsec (abfd)->vma; + obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; + obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; + + /* The file offsets of the sections */ + obj_textsec (abfd)->filepos = N_TXTOFF (*execp); + obj_datasec (abfd)->filepos = N_DATOFF (*execp); + + /* The file offsets of the relocation info */ + obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); + obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); + + /* The file offsets of the string table and symbol table. */ + obj_sym_filepos (abfd) = N_SYMOFF (*execp); + obj_str_filepos (abfd) = N_STROFF (*execp); + + /* Determine the architecture and machine type of the object file. */ +#ifdef SET_ARCH_MACH + SET_ARCH_MACH (abfd, *execp); +#else + bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0); +#endif + + if (obj_aout_subformat (abfd) == gnu_encap_format) + { + /* The file offsets of the relocation info */ + obj_textsec (abfd)->rel_filepos = N_GNU_TRELOFF (*execp); + obj_datasec (abfd)->rel_filepos = N_GNU_DRELOFF (*execp); + + /* The file offsets of the string table and symbol table. */ + obj_sym_filepos (abfd) = N_GNU_SYMOFF (*execp); + obj_str_filepos (abfd) = (obj_sym_filepos (abfd) + execp->a_syms); + + abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; + bfd_get_symcount (abfd) = execp->a_syms / 12; + obj_symbol_entry_size (abfd) = 12; + obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; + } + + return abfd->xvec; +} + +extern bfd_boolean aout_32_write_syms + PARAMS ((bfd * abfd)); + +static bfd_boolean +MY (write_object_contents) (abfd) + bfd *abfd; +{ + struct external_exec exec_bytes; + struct internal_exec *execp = exec_hdr (abfd); + bfd_size_type text_size; /* dummy vars */ + file_ptr text_end; + + memset (&exec_bytes, 0, sizeof (exec_bytes)); + + obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; + + if (adata (abfd).magic == undecided_magic) + NAME (aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); + execp->a_syms = 0; + + execp->a_entry = bfd_get_start_address (abfd); + + execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * + obj_reloc_entry_size (abfd)); + execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * + obj_reloc_entry_size (abfd)); + + N_SET_MACHTYPE (*execp, 0xc); + N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags); + + NAME (aout,swap_exec_header_out) (abfd, execp, &exec_bytes); + + /* update fields not covered by default swap_exec_header_out */ + + /* this is really the sym table size but we store it in drelocs */ + H_PUT_32 (abfd, (bfd_get_symcount (abfd) * 12), exec_bytes.e_drelocs); + + if (bfd_seek (abfd, (file_ptr) 0, FALSE) != 0 + || (bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd) + != EXEC_BYTES_SIZE)) + return FALSE; + + /* Write out the symbols, and then the relocs. We must write out + the symbols first so that we know the symbol indices. */ + + if (bfd_get_symcount (abfd) != 0) + { + /* Skip the relocs to where we want to put the symbols. */ + if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp) + execp->a_drsize), + SEEK_SET) != 0) + return FALSE; + } + + if (!MY (write_syms) (abfd)) + return FALSE; + + if (bfd_get_symcount (abfd) != 0) + { + if (bfd_seek (abfd, (file_ptr) N_TRELOFF (*execp), SEEK_CUR) != 0) + return FALSE; + if (!NAME (aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) + return FALSE; + if (bfd_seek (abfd, (file_ptr) N_DRELOFF (*execp), SEEK_CUR) != 0) + return FALSE; + if (!NAME (aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) + return FALSE; + } + + return TRUE; +} + +/* convert the hp symbol type to be the same as aout64.h usage so we */ +/* can piggyback routines in aoutx.h. */ + +static void +convert_sym_type (sym_pointer, cache_ptr, abfd) + struct external_nlist *sym_pointer ATTRIBUTE_UNUSED; + aout_symbol_type *cache_ptr; + bfd *abfd ATTRIBUTE_UNUSED; +{ + int name_type; + int new_type; + + name_type = (cache_ptr->type); + new_type = 0; + + if ((name_type & HP_SYMTYPE_ALIGN) != 0) + { + /* iou_error ("aligned symbol encountered: %s", name);*/ + name_type = 0; + } + + if (name_type == HP_SYMTYPE_FILENAME) + new_type = N_FN; + else + { + switch (name_type & HP_SYMTYPE_TYPE) + { + case HP_SYMTYPE_UNDEFINED: + new_type = N_UNDF; + break; + + case HP_SYMTYPE_ABSOLUTE: + new_type = N_ABS; + break; + + case HP_SYMTYPE_TEXT: + new_type = N_TEXT; + break; + + case HP_SYMTYPE_DATA: + new_type = N_DATA; + break; + + case HP_SYMTYPE_BSS: + new_type = N_BSS; + break; + + case HP_SYMTYPE_COMMON: + new_type = N_COMM; + break; + + default: + abort (); + break; + } + if (name_type & HP_SYMTYPE_EXTERNAL) + new_type |= N_EXT; + + if (name_type & HP_SECONDARY_SYMBOL) + { + switch (new_type) + { + default: + abort (); + case N_UNDF | N_EXT: + /* If the value is nonzero, then just treat this as a + common symbol. I don't know if this is correct in + all cases, but it is more correct than treating it as + a weak undefined symbol. */ + if (cache_ptr->symbol.value == 0) + new_type = N_WEAKU; + break; + case N_ABS | N_EXT: + new_type = N_WEAKA; + break; + case N_TEXT | N_EXT: + new_type = N_WEAKT; + break; + case N_DATA | N_EXT: + new_type = N_WEAKD; + break; + case N_BSS | N_EXT: + new_type = N_WEAKB; + break; + } + } + } + cache_ptr->type = new_type; + +} + +/* +DESCRIPTION + Swaps the information in an executable header taken from a raw + byte stream memory image, into the internal exec_header + structure. +*/ + +void +NAME (aout,swap_exec_header_in) (abfd, raw_bytes, execp) + bfd *abfd; + struct external_exec *raw_bytes; + struct internal_exec *execp; +{ + struct external_exec *bytes = (struct external_exec *) raw_bytes; + + /* The internal_exec structure has some fields that are unused in this + configuration (IE for i960), so ensure that all such uninitialized + fields are zero'd out. There are places where two of these structs + are memcmp'd, and thus the contents do matter. */ + memset (execp, 0, sizeof (struct internal_exec)); + /* Now fill in fields in the execp, from the bytes in the raw data. */ + execp->a_info = H_GET_32 (abfd, bytes->e_info); + execp->a_text = GET_WORD (abfd, bytes->e_text); + execp->a_data = GET_WORD (abfd, bytes->e_data); + execp->a_bss = GET_WORD (abfd, bytes->e_bss); + execp->a_syms = GET_WORD (abfd, bytes->e_syms); + execp->a_entry = GET_WORD (abfd, bytes->e_entry); + execp->a_trsize = GET_WORD (abfd, bytes->e_trsize); + execp->a_drsize = GET_WORD (abfd, bytes->e_drsize); + + /***************************************************************/ + /* check the header to see if it was generated by a bfd output */ + /* this is detected rather bizarrely by requiring a bunch of */ + /* header fields to be zero and an old unused field (now used) */ + /* to be set. */ + /***************************************************************/ + do + { + long syms; + struct aout_data_struct *rawptr; + bfd_size_type amt; + + if (H_GET_32 (abfd, bytes->e_passize) != 0) + break; + if (H_GET_32 (abfd, bytes->e_syms) != 0) + break; + if (H_GET_32 (abfd, bytes->e_supsize) != 0) + break; + + syms = H_GET_32 (abfd, bytes->e_drelocs); + if (syms == 0) + break; + + /* OK, we've passed the test as best as we can determine */ + execp->a_syms = syms; + + /* allocate storage for where we will store this result */ + amt = sizeof (*rawptr); + rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); + + if (rawptr == NULL) + return; + abfd->tdata.aout_data = rawptr; + obj_aout_subformat (abfd) = gnu_encap_format; + } + while (0); +} + +/* The hp symbol table is a bit different than other a.out targets. Instead + of having an array of nlist items and an array of strings, hp's format + has them mixed together in one structure. In addition, the strings are + not null terminated. It looks something like this: + + nlist element 1 + string1 + nlist element 2 + string2 + ... + + The whole symbol table is read as one chunk and then we march thru it + and convert it to canonical form. As we march thru the table, we copy + the nlist data into the internal form and we compact the strings and null + terminate them, using storage from the already allocated symbol table: + + string1 + null + string2 + null + ... +*/ + +bfd_boolean +MY (slurp_symbol_table) (abfd) + bfd *abfd; +{ + bfd_size_type symbol_bytes; + struct external_nlist *syms; + struct external_nlist *sym_pointer; + struct external_nlist *sym_end; + char *strings; + aout_symbol_type *cached; + unsigned num_syms = 0; + bfd_size_type amt; + + /* If there's no work to be done, don't do any */ + if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL) + return TRUE; + symbol_bytes = exec_hdr (abfd)->a_syms; + + amt = symbol_bytes + SYM_EXTRA_BYTES; + strings = (char *) bfd_alloc (abfd, amt); + if (!strings) + return FALSE; + syms = (struct external_nlist *) (strings + SYM_EXTRA_BYTES); + if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 + || bfd_bread ((PTR) syms, symbol_bytes, abfd) != symbol_bytes) + { + bfd_release (abfd, syms); + return FALSE; + } + + sym_end = (struct external_nlist *) (((char *) syms) + symbol_bytes); + + /* first, march thru the table and figure out how many symbols there are */ + for (sym_pointer = syms; sym_pointer < sym_end; sym_pointer++, num_syms++) + { + /* skip over the embedded symbol. */ + sym_pointer = (struct external_nlist *) (((char *) sym_pointer) + + sym_pointer->e_length[0]); + } + + /* now that we know the symbol count, update the bfd header */ + bfd_get_symcount (abfd) = num_syms; + + amt = num_syms; + amt *= sizeof (aout_symbol_type); + cached = (aout_symbol_type *) bfd_zalloc (abfd, amt); + if (cached == NULL && num_syms != 0) + return FALSE; + + /* as we march thru the hp symbol table, convert it into a list of + null terminated strings to hold the symbol names. Make sure any + assignment to the strings pointer is done after we're thru using + the nlist so we don't overwrite anything important. */ + + /* OK, now walk the new symtable, caching symbol properties */ + { + aout_symbol_type *cache_ptr = cached; + aout_symbol_type cache_save; + /* Run through table and copy values */ + for (sym_pointer = syms, cache_ptr = cached; + sym_pointer < sym_end; sym_pointer++, cache_ptr++) + { + unsigned int length; + cache_ptr->symbol.the_bfd = abfd; + cache_ptr->symbol.value = GET_SWORD (abfd, sym_pointer->e_value); + cache_ptr->desc = bfd_get_16 (abfd, sym_pointer->e_almod); + cache_ptr->type = bfd_get_8 (abfd, sym_pointer->e_type); + cache_ptr->symbol.udata.p = NULL; + length = bfd_get_8 (abfd, sym_pointer->e_length); + cache_ptr->other = length; /* other not used, save length here */ + + cache_save = *cache_ptr; + convert_sym_type (sym_pointer, cache_ptr, abfd); + if (!translate_from_native_sym_flags (abfd, cache_ptr)) + return FALSE; + + /********************************************************/ + /* for hpux, the 'length' value indicates the length of */ + /* the symbol name which follows the nlist entry. */ + /********************************************************/ + if (length) + { + /**************************************************************/ + /* the hp string is not null terminated so we create a new one*/ + /* by copying the string to overlap the just vacated nlist */ + /* structure before it in memory. */ + /**************************************************************/ + cache_ptr->symbol.name = strings; + memcpy (strings, sym_pointer + 1, length); + strings[length] = '\0'; + strings += length + 1; + } + else + cache_ptr->symbol.name = (char *) NULL; + + /* skip over the embedded symbol. */ + sym_pointer = (struct external_nlist *) (((char *) sym_pointer) + + length); + } + } + + obj_aout_symbols (abfd) = cached; + + return TRUE; +} + +void +MY (swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) + bfd *abfd; + struct hp300hpux_reloc *bytes; + arelent *cache_ptr; + asymbol **symbols; + bfd_size_type symcount ATTRIBUTE_UNUSED; +{ + int r_index; + int r_extern = 0; + unsigned int r_length; + int r_pcrel = 0; + struct aoutdata *su = &(abfd->tdata.aout_data->a); + + cache_ptr->address = H_GET_32 (abfd, bytes->r_address); + r_index = H_GET_16 (abfd, bytes->r_index); + + switch (bytes->r_type[0]) + { + case HP_RSEGMENT_TEXT: + r_index = N_TEXT; + break; + case HP_RSEGMENT_DATA: + r_index = N_DATA; + break; + case HP_RSEGMENT_BSS: + r_index = N_BSS; + break; + case HP_RSEGMENT_EXTERNAL: + r_extern = 1; + break; + case HP_RSEGMENT_PCREL: + r_extern = 1; + r_pcrel = 1; + break; + case HP_RSEGMENT_RDLT: + break; + case HP_RSEGMENT_RPLT: + break; + case HP_RSEGMENT_NOOP: + break; + default: + abort (); + break; + } + + switch (bytes->r_length[0]) + { + case HP_RLENGTH_BYTE: + r_length = 0; + break; + case HP_RLENGTH_WORD: + r_length = 1; + break; + case HP_RLENGTH_LONG: + r_length = 2; + break; + default: + abort (); + break; + } + + cache_ptr->howto = howto_table_std + r_length + 4 * r_pcrel; + /* FIXME-soon: Roll baserel, jmptable, relative bits into howto setting */ + + /* This macro uses the r_index value computed above */ + if (r_pcrel && r_extern) + { + /* The GNU linker assumes any offset from beginning of section */ + /* is already incorporated into the image while the HP linker */ + /* adds this in later. Add it in now... */ + MOVE_ADDRESS (-cache_ptr->address); + } + else + { + MOVE_ADDRESS (0); + } +} + +bfd_boolean +MY (slurp_reloc_table) (abfd, asect, symbols) + bfd *abfd; + sec_ptr asect; + asymbol **symbols; +{ + bfd_size_type count; + bfd_size_type reloc_size; + PTR relocs; + arelent *reloc_cache; + size_t each_size; + struct hp300hpux_reloc *rptr; + unsigned int counter; + arelent *cache_ptr; + + if (asect->relocation) + return TRUE; + + if (asect->flags & SEC_CONSTRUCTOR) + return TRUE; + + if (asect == obj_datasec (abfd)) + { + reloc_size = exec_hdr (abfd)->a_drsize; + goto doit; + } + + if (asect == obj_textsec (abfd)) + { + reloc_size = exec_hdr (abfd)->a_trsize; + goto doit; + } + + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + +doit: + if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0) + return FALSE; + each_size = obj_reloc_entry_size (abfd); + + count = reloc_size / each_size; + + reloc_cache = (arelent *) bfd_zalloc (abfd, count * sizeof (arelent)); + if (!reloc_cache && count != 0) + return FALSE; + + relocs = (PTR) bfd_alloc (abfd, reloc_size); + if (!relocs && reloc_size != 0) + { + bfd_release (abfd, reloc_cache); + return FALSE; + } + + if (bfd_bread (relocs, reloc_size, abfd) != reloc_size) + { + bfd_release (abfd, relocs); + bfd_release (abfd, reloc_cache); + return FALSE; + } + + rptr = (struct hp300hpux_reloc *) relocs; + counter = 0; + cache_ptr = reloc_cache; + + for (; counter < count; counter++, rptr++, cache_ptr++) + { + MY (swap_std_reloc_in) (abfd, rptr, cache_ptr, symbols, + (bfd_size_type) bfd_get_symcount (abfd)); + } + + bfd_release (abfd, relocs); + asect->relocation = reloc_cache; + asect->reloc_count = count; + return TRUE; +} + +/************************************************************************/ +/* The following functions are identical to functions in aoutx.h except */ +/* they refer to MY(func) rather than NAME(aout,func) and they also */ +/* call aout_32 versions if the input file was generated by gcc */ +/************************************************************************/ + +long aout_32_canonicalize_symtab + PARAMS ((bfd * abfd, asymbol ** location)); +long aout_32_get_symtab_upper_bound + PARAMS ((bfd * abfd)); +long aout_32_canonicalize_reloc + PARAMS ((bfd * abfd, sec_ptr section, arelent ** relptr, + asymbol ** symbols)); + +long +MY (canonicalize_symtab) (abfd, location) + bfd *abfd; + asymbol **location; +{ + unsigned int counter = 0; + aout_symbol_type *symbase; + + if (obj_aout_subformat (abfd) == gnu_encap_format) + return aout_32_canonicalize_symtab (abfd, location); + + if (!MY (slurp_symbol_table) (abfd)) + return -1; + + for (symbase = obj_aout_symbols (abfd); counter++ < bfd_get_symcount (abfd);) + *(location++) = (asymbol *) (symbase++); + *location++ = 0; + return bfd_get_symcount (abfd); +} + +long +MY (get_symtab_upper_bound) (abfd) + bfd *abfd; +{ + if (obj_aout_subformat (abfd) == gnu_encap_format) + return aout_32_get_symtab_upper_bound (abfd); + if (!MY (slurp_symbol_table) (abfd)) + return -1; + + return (bfd_get_symcount (abfd) + 1) * (sizeof (aout_symbol_type *)); +} + +long +MY (canonicalize_reloc) (abfd, section, relptr, symbols) + bfd *abfd; + sec_ptr section; + arelent **relptr; + asymbol **symbols; +{ + arelent *tblptr = section->relocation; + unsigned int count; + if (obj_aout_subformat (abfd) == gnu_encap_format) + return aout_32_canonicalize_reloc (abfd, section, relptr, symbols); + + if (!(tblptr || MY (slurp_reloc_table) (abfd, section, symbols))) + return -1; + + if (section->flags & SEC_CONSTRUCTOR) + { + arelent_chain *chain = section->constructor_chain; + for (count = 0; count < section->reloc_count; count++) + { + *relptr++ = &chain->relent; + chain = chain->next; + } + } + else + { + tblptr = section->relocation; + + for (count = 0; count++ < section->reloc_count;) + { + *relptr++ = tblptr++; + } + } + *relptr = 0; + + return section->reloc_count; +} + +#include "aout-target.h" diff --git a/bfd/hppabsd-core.c b/bfd/hppabsd-core.c new file mode 100644 index 0000000000000..ff88f9d2273bc --- /dev/null +++ b/bfd/hppabsd-core.c @@ -0,0 +1,295 @@ +/* BFD back-end for HPPA BSD core files. + Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. + + Written by the Center for Software Science at the University of Utah + and by Cygnus Support. + + The core file structure for the Utah 4.3BSD and OSF1 ports on the + PA is a mix between traditional cores and hpux cores -- just + different enough that supporting this format would tend to add + gross hacks to trad-core.c or hpux-core.c. So instead we keep any + gross hacks isolated to this file. */ + +/* This file can only be compiled on systems which use HPPA-BSD style + core files. + + I would not expect this to be of use to any other host/target, but + you never know. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#if defined (HOST_HPPABSD) + +#include "machine/vmparam.h" + +#include +#include +#include +#include +#include /* After a.out.h */ +#include + +static asection *make_bfd_asection + PARAMS ((bfd *, const char *, flagword, bfd_size_type, file_ptr, + unsigned int)); +static const bfd_target *hppabsd_core_core_file_p + PARAMS ((bfd *)); +static char *hppabsd_core_core_file_failing_command + PARAMS ((bfd *)); +static int hppabsd_core_core_file_failing_signal + PARAMS ((bfd *)); +static bfd_boolean hppabsd_core_core_file_matches_executable_p + PARAMS ((bfd *, bfd *)); +static void swap_abort + PARAMS ((void)); + +/* These are stored in the bfd's tdata. */ + +struct hppabsd_core_struct + { + int sig; + char cmd[MAXCOMLEN + 1]; + asection *data_section; + asection *stack_section; + asection *reg_section; + }; + +#define core_hdr(bfd) ((bfd)->tdata.hppabsd_core_data) +#define core_signal(bfd) (core_hdr(bfd)->sig) +#define core_command(bfd) (core_hdr(bfd)->cmd) +#define core_datasec(bfd) (core_hdr(bfd)->data_section) +#define core_stacksec(bfd) (core_hdr(bfd)->stack_section) +#define core_regsec(bfd) (core_hdr(bfd)->reg_section) + +static asection * +make_bfd_asection (abfd, name, flags, _raw_size, offset, alignment_power) + bfd *abfd; + const char *name; + flagword flags; + bfd_size_type _raw_size; + file_ptr offset; + unsigned int alignment_power; +{ + asection *asect; + + asect = bfd_make_section (abfd, name); + if (!asect) + return NULL; + + asect->flags = flags; + asect->_raw_size = _raw_size; + asect->filepos = offset; + asect->alignment_power = alignment_power; + + return asect; +} + +static const bfd_target * +hppabsd_core_core_file_p (abfd) + bfd *abfd; +{ + int val; + struct user u; + struct hppabsd_core_struct *coredata; + int clicksz; + + /* Try to read in the u-area. We will need information from this + to know how to grok the rest of the core structures. */ + val = bfd_bread ((void *) &u, (bfd_size_type) sizeof u, abfd); + if (val != sizeof u) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + /* Get the page size out of the u structure. This will be different + for PA 1.0 machines and PA 1.1 machines. Yuk! */ + clicksz = u.u_pcb.pcb_pgsz; + + /* clicksz must be a power of two >= 2k. */ + if (clicksz < 0x800 + || clicksz != (clicksz & -clicksz)) + { + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + /* Sanity checks. Make sure the size of the core file matches the + the size computed from information within the core itself. */ + { + FILE *stream = bfd_cache_lookup (abfd); + struct stat statbuf; + if (stream == NULL || fstat (fileno (stream), &statbuf) < 0) + { + bfd_set_error (bfd_error_system_call); + return NULL; + } + if (NBPG * (UPAGES + u.u_dsize + u.u_ssize) > statbuf.st_size) + { + bfd_set_error (bfd_error_file_truncated); + return NULL; + } + if (clicksz * (UPAGES + u.u_dsize + u.u_ssize) < statbuf.st_size) + { + /* The file is too big. Maybe it's not a core file + or we otherwise have bad values for u_dsize and u_ssize). */ + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + } + + /* OK, we believe you. You're a core file (sure, sure). */ + + coredata = (struct hppabsd_core_struct *) + bfd_zalloc (abfd, (bfd_size_type) sizeof (struct hppabsd_core_struct)); + if (!coredata) + return NULL; + + /* Make the core data and available via the tdata part of the BFD. */ + abfd->tdata.hppabsd_core_data = coredata; + + /* Create the sections. */ + core_stacksec (abfd) = make_bfd_asection (abfd, ".stack", + SEC_ALLOC + SEC_HAS_CONTENTS, + clicksz * u.u_ssize, + NBPG * (USIZE + KSTAKSIZE) + + clicksz * u.u_dsize, 2); + if (core_stacksec (abfd) == NULL) + goto fail; + core_stacksec (abfd)->vma = USRSTACK; + + core_datasec (abfd) = make_bfd_asection (abfd, ".data", + SEC_ALLOC + SEC_LOAD + + SEC_HAS_CONTENTS, + clicksz * u.u_dsize, + NBPG * (USIZE + KSTAKSIZE), 2); + if (core_datasec (abfd) == NULL) + goto fail; + core_datasec (abfd)->vma = UDATASEG; + + core_regsec (abfd) = make_bfd_asection (abfd, ".reg", + SEC_HAS_CONTENTS, + KSTAKSIZE * NBPG, + NBPG * USIZE, 2); + if (core_regsec (abfd) == NULL) + goto fail; + core_regsec (abfd)->vma = 0; + + strncpy (core_command (abfd), u.u_comm, MAXCOMLEN + 1); + core_signal (abfd) = u.u_code; + return abfd->xvec; + + fail: + bfd_release (abfd, abfd->tdata.any); + abfd->tdata.any = NULL; + bfd_section_list_clear (abfd); + return NULL; +} + +static char * +hppabsd_core_core_file_failing_command (abfd) + bfd *abfd; +{ + return core_command (abfd); +} + +static int +hppabsd_core_core_file_failing_signal (abfd) + bfd *abfd; +{ + return core_signal (abfd); +} + +static bfd_boolean +hppabsd_core_core_file_matches_executable_p (core_bfd, exec_bfd) + bfd *core_bfd, *exec_bfd; +{ + /* There's no way to know this... */ + return TRUE; +} + +/* If somebody calls any byte-swapping routines, shoot them. */ +static void +swap_abort () +{ + /* This way doesn't require any declaration for ANSI to fuck up. */ + abort (); +} + +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) +#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort) +#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort) +#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort) + +const bfd_target hppabsd_core_vec = + { + "hppabsd-core", + bfd_target_unknown_flavour, + BFD_ENDIAN_BIG, /* target byte order */ + BFD_ENDIAN_BIG, /* target headers byte order */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + 0, /* symbol prefix */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit data */ + NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */ + + { /* bfd_check_format */ + _bfd_dummy_target, /* unknown format */ + _bfd_dummy_target, /* object file */ + _bfd_dummy_target, /* archive */ + hppabsd_core_core_file_p /* a core file */ + }, + { /* bfd_set_format */ + bfd_false, bfd_false, + bfd_false, bfd_false + }, + { /* bfd_write_contents */ + bfd_false, bfd_false, + bfd_false, bfd_false + }, + + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (hppabsd_core), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), + BFD_JUMP_TABLE_WRITE (_bfd_generic), + BFD_JUMP_TABLE_LINK (_bfd_nolink), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + (PTR) 0 /* backend_data */ + }; +#endif diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c new file mode 100644 index 0000000000000..30967c9fc308e --- /dev/null +++ b/bfd/hpux-core.c @@ -0,0 +1,407 @@ +/* BFD back-end for HP/UX core files. + Copyright 1993, 1994, 1996, 1998, 1999, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + Written by Stu Grossman, Cygnus Support. + Converted to back-end form by Ian Lance Taylor, Cygnus SUpport + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* This file can only be compiled on systems which use HP/UX style + core files. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#if defined (HOST_HPPAHPUX) || defined (HOST_HP300HPUX) || defined (HOST_HPPAMPEIX) + +/* FIXME: sys/core.h doesn't exist for HPUX version 7. HPUX version + 5, 6, and 7 core files seem to be standard trad-core.c type core + files; can we just use trad-core.c in addition to this file? */ + +#include +#include + +#endif /* HOST_HPPAHPUX */ + +#ifdef HOST_HPPABSD + +/* Not a very swift place to put it, but that's where the BSD port + puts them. */ +#include "/hpux/usr/include/sys/core.h" + +#endif /* HOST_HPPABSD */ + +#include +#ifdef HAVE_DIRENT_H +# include +#else +# ifdef HAVE_SYS_NDIR_H +# include +# endif +# ifdef HAVE_SYS_DIR_H +# include +# endif +# ifdef HAVE_NDIR_H +# include +# endif +#endif +#include +#include +#include /* After a.out.h */ +#include + +/* Kludge: There's no explicit mechanism provided by sys/core.h to + conditionally know whether a proc_info has thread id fields. + However, CORE_ANON_SHMEM shows up first at 10.30, which is + happily also when meaningful thread id's show up in proc_info. */ +#if defined(CORE_ANON_SHMEM) +#define PROC_INFO_HAS_THREAD_ID (1) +#endif + +/* This type appears at HP-UX 10.30. Defining it if not defined + by sys/core.h allows us to build for older HP-UX's, and (since + it won't be encountered in core-dumps from older HP-UX's) is + harmless. */ +#if !defined(CORE_ANON_SHMEM) +#define CORE_ANON_SHMEM 0x00000200 /* anonymous shared memory */ +#endif + +/* These are stored in the bfd's tdata */ + +/* .lwpid and .user_tid are only valid if PROC_INFO_HAS_THREAD_ID, else they + are set to 0. Also, until HP-UX implements MxN threads, .user_tid and + .lwpid are synonymous. */ +struct hpux_core_struct +{ + int sig; + int lwpid; /* Kernel thread ID. */ + unsigned long user_tid; /* User thread ID. */ + char cmd[MAXCOMLEN + 1]; +}; + +#define core_hdr(bfd) ((bfd)->tdata.hpux_core_data) +#define core_signal(bfd) (core_hdr(bfd)->sig) +#define core_command(bfd) (core_hdr(bfd)->cmd) +#define core_kernel_thread_id(bfd) (core_hdr(bfd)->lwpid) +#define core_user_thread_id(bfd) (core_hdr(bfd)->user_tid) + +static asection *make_bfd_asection + PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, + unsigned int)); +static const bfd_target *hpux_core_core_file_p + PARAMS ((bfd *)); +static char *hpux_core_core_file_failing_command + PARAMS ((bfd *)); +static int hpux_core_core_file_failing_signal + PARAMS ((bfd *)); +static bfd_boolean hpux_core_core_file_matches_executable_p + PARAMS ((bfd *, bfd *)); +static void swap_abort + PARAMS ((void)); + +static asection * +make_bfd_asection (abfd, name, flags, _raw_size, vma, alignment_power) + bfd *abfd; + const char *name; + flagword flags; + bfd_size_type _raw_size; + bfd_vma vma; + unsigned int alignment_power; +{ + asection *asect; + char *newname; + + newname = bfd_alloc (abfd, (bfd_size_type) strlen (name) + 1); + if (!newname) + return NULL; + + strcpy (newname, name); + + asect = bfd_make_section_anyway (abfd, newname); + if (!asect) + return NULL; + + asect->flags = flags; + asect->_raw_size = _raw_size; + asect->vma = vma; + asect->filepos = bfd_tell (abfd); + asect->alignment_power = alignment_power; + + return asect; +} + +/* this function builds a bfd target if the file is a corefile. + It returns null or 0 if it finds out thaat it is not a core file. + The way it checks this is by looking for allowed 'type' field values. + These are declared in sys/core.h + There are some values which are 'reserved for future use'. In particular + CORE_NONE is actually defined as 0. This may be a catch-all for cases + in which the core file is generated by some non-hpux application. + (I am just guessing here!) +*/ +static const bfd_target * +hpux_core_core_file_p (abfd) + bfd *abfd; +{ + int good_sections = 0; + int unknown_sections = 0; + + core_hdr (abfd) = (struct hpux_core_struct *) + bfd_zalloc (abfd, (bfd_size_type) sizeof (struct hpux_core_struct)); + if (!core_hdr (abfd)) + return NULL; + + while (1) + { + int val; + struct corehead core_header; + + val = bfd_bread ((void *) &core_header, + (bfd_size_type) sizeof core_header, abfd); + if (val <= 0) + break; + switch (core_header.type) + { + case CORE_KERNEL: + case CORE_FORMAT: + /* Just skip this. */ + bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR); + good_sections++; + break; + case CORE_EXEC: + { + struct proc_exec proc_exec; + if (bfd_bread ((void *) &proc_exec, (bfd_size_type) core_header.len, + abfd) != core_header.len) + break; + strncpy (core_command (abfd), proc_exec.cmd, MAXCOMLEN + 1); + good_sections++; + } + break; + case CORE_PROC: + { + struct proc_info proc_info; + char secname[100]; /* Of arbitrary size, but plenty large. */ + + /* We need to read this section, 'cause we need to determine + whether the core-dumped app was threaded before we create + any .reg sections. */ + if (bfd_bread (&proc_info, (bfd_size_type) core_header.len, abfd) + != core_header.len) + break; + + /* However, we also want to create those sections with the + file positioned at the start of the record, it seems. */ + if (bfd_seek (abfd, (file_ptr) -core_header.len, SEEK_CUR) != 0) + break; + +#if defined(PROC_INFO_HAS_THREAD_ID) + core_kernel_thread_id (abfd) = proc_info.lwpid; + core_user_thread_id (abfd) = proc_info.user_tid; +#else + core_kernel_thread_id (abfd) = 0; + core_user_thread_id (abfd) = 0; +#endif + /* If the program was unthreaded, then we'll just create a + .reg section. + + If the program was threaded, then we'll create .reg/XXXXX + section for each thread, where XXXXX is a printable + representation of the kernel thread id. We'll also + create a .reg section for the thread that was running + and signalled at the time of the core-dump (i.e., this + is effectively an alias, needed to keep GDB happy.) + + Note that we use `.reg/XXXXX' as opposed to '.regXXXXX' + because GDB expects that .reg2 will be the floating- + point registers. */ + if (core_kernel_thread_id (abfd) == 0) + { + if (!make_bfd_asection (abfd, ".reg", + SEC_HAS_CONTENTS, + core_header.len, + (int) &proc_info - (int) & proc_info.hw_regs, + 2)) + goto fail; + } + else + { + /* There are threads. Is this the one that caused the + core-dump? We'll claim it was the running thread. */ + if (proc_info.sig != -1) + { + if (!make_bfd_asection (abfd, ".reg", + SEC_HAS_CONTENTS, + core_header.len, + (int) &proc_info - (int) & proc_info.hw_regs, + 2)) + goto fail; + } + /* We always make one of these sections, for every thread. */ + sprintf (secname, ".reg/%d", core_kernel_thread_id (abfd)); + if (!make_bfd_asection (abfd, secname, + SEC_HAS_CONTENTS, + core_header.len, + (int) &proc_info - (int) & proc_info.hw_regs, + 2)) + goto fail; + } + core_signal (abfd) = proc_info.sig; + if (bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR) != 0) + break; + good_sections++; + } + break; + + case CORE_DATA: + case CORE_STACK: + case CORE_TEXT: + case CORE_MMF: + case CORE_SHM: + case CORE_ANON_SHMEM: + if (!make_bfd_asection (abfd, ".data", + SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS, + core_header.len, core_header.addr, 2)) + goto fail; + + bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR); + good_sections++; + break; + + case CORE_NONE: + /* Let's not punt if we encounter a section of unknown + type. Rather, let's make a note of it. If we later + see that there were also "good" sections, then we'll + declare that this a core file, but we'll also warn that + it may be incompatible with this gdb. + */ + unknown_sections++; + break; + + default: + goto fail; /*unrecognized core file type */ + } + } + + /* OK, we believe you. You're a core file (sure, sure). */ + + /* Were there sections of unknown type? If so, yet there were + at least some complete sections of known type, then, issue + a warning. Possibly the core file was generated on a version + of HP-UX that is incompatible with that for which this gdb was + built. + */ + if ((unknown_sections > 0) && (good_sections > 0)) + (*_bfd_error_handler) + ("%s appears to be a core file,\nbut contains unknown sections. It may have been created on an incompatible\nversion of HP-UX. As a result, some information may be unavailable.\n", + abfd->filename); + + return abfd->xvec; + + fail: + bfd_release (abfd, core_hdr (abfd)); + core_hdr (abfd) = NULL; + bfd_section_list_clear (abfd); + return NULL; +} + +static char * +hpux_core_core_file_failing_command (abfd) + bfd *abfd; +{ + return core_command (abfd); +} + +static int +hpux_core_core_file_failing_signal (abfd) + bfd *abfd; +{ + return core_signal (abfd); +} + +static bfd_boolean +hpux_core_core_file_matches_executable_p (core_bfd, exec_bfd) + bfd *core_bfd ATTRIBUTE_UNUSED; + bfd *exec_bfd ATTRIBUTE_UNUSED; +{ + return TRUE; /* FIXME, We have no way of telling at this point */ +} + +/* If somebody calls any byte-swapping routines, shoot them. */ +static void +swap_abort () +{ + abort(); /* This way doesn't require any declaration for ANSI to fuck up */ +} + +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) +#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort) +#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort) +#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort) + +const bfd_target hpux_core_vec = + { + "hpux-core", + bfd_target_unknown_flavour, + BFD_ENDIAN_BIG, /* target byte order */ + BFD_ENDIAN_BIG, /* target headers byte order */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + 0, /* symbol prefix */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit data */ + NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */ + + { /* bfd_check_format */ + _bfd_dummy_target, /* unknown format */ + _bfd_dummy_target, /* object file */ + _bfd_dummy_target, /* archive */ + hpux_core_core_file_p /* a core file */ + }, + { /* bfd_set_format */ + bfd_false, bfd_false, + bfd_false, bfd_false + }, + { /* bfd_write_contents */ + bfd_false, bfd_false, + bfd_false, bfd_false + }, + + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (hpux_core), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), + BFD_JUMP_TABLE_WRITE (_bfd_generic), + BFD_JUMP_TABLE_LINK (_bfd_nolink), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + (PTR) 0 /* backend_data */ + }; diff --git a/bfd/i386dynix.c b/bfd/i386dynix.c new file mode 100644 index 0000000000000..17871962c1f43 --- /dev/null +++ b/bfd/i386dynix.c @@ -0,0 +1,81 @@ +/* BFD back-end for i386 a.out binaries under dynix. + Copyright 1994, 1995, 2001, 2003 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* This BFD is currently only tested with gdb, writing object files + may not work. */ + +#define TEXT_START_ADDR 4096 +#define TARGET_PAGE_SIZE 4096 +#define SEGMENT_SIZE TARGET_PAGE_SIZE + +#include "aout/dynix3.h" + +#define DEFAULT_ARCH bfd_arch_i386 +#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN) + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (i386dynix_,OP) +#define TARGETNAME "a.out-i386-dynix" +#define NAME(x,y) CONCAT3 (i386dynix,_32_,y) +#define ARCH_SIZE 32 +#define NAME_swap_exec_header_in NAME(i386dynix_32_,swap_exec_header_in) +#define MY_get_section_contents aout_32_get_section_contents + +/* aoutx.h requires definitions for NMAGIC, BMAGIC and QMAGIC. */ +#define NMAGIC 0 +#define BMAGIC OMAGIC +#define QMAGIC XMAGIC + +#include "aoutx.h" + +/* (Ab)use some fields in the internal exec header to be able to read + executables that contain shared data. */ + +#define a_shdata a_tload +#define a_shdrsize a_dload + +void +i386dynix_32_swap_exec_header_in (abfd, raw_bytes, execp) + bfd *abfd; + struct external_exec *raw_bytes; + struct internal_exec *execp; +{ + struct external_exec *bytes = (struct external_exec *)raw_bytes; + + /* The internal_exec structure has some fields that are unused in this + configuration (IE for i960), so ensure that all such uninitialized + fields are zero'd out. There are places where two of these structs + are memcmp'd, and thus the contents do matter. */ + memset ((PTR) execp, 0, sizeof (struct internal_exec)); + /* Now fill in fields in the execp, from the bytes in the raw data. */ + execp->a_info = H_GET_32 (abfd, bytes->e_info); + execp->a_text = GET_WORD (abfd, bytes->e_text); + execp->a_data = GET_WORD (abfd, bytes->e_data); + execp->a_bss = GET_WORD (abfd, bytes->e_bss); + execp->a_syms = GET_WORD (abfd, bytes->e_syms); + execp->a_entry = GET_WORD (abfd, bytes->e_entry); + execp->a_trsize = GET_WORD (abfd, bytes->e_trsize); + execp->a_drsize = GET_WORD (abfd, bytes->e_drsize); + execp->a_shdata = GET_WORD (abfd, bytes->e_shdata); + execp->a_shdrsize = GET_WORD (abfd, bytes->e_shdrsize); +} + +#include "aout-target.h" diff --git a/bfd/i386lynx.c b/bfd/i386lynx.c new file mode 100644 index 0000000000000..32274ea6c7f78 --- /dev/null +++ b/bfd/i386lynx.c @@ -0,0 +1,582 @@ +/* BFD back-end for i386 a.out binaries under LynxOS. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2001, 2002, 2003 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define N_SHARED_LIB(x) 0 + +#define TEXT_START_ADDR 0 +#define TARGET_PAGE_SIZE 4096 +#define SEGMENT_SIZE TARGET_PAGE_SIZE +#define DEFAULT_ARCH bfd_arch_i386 + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (i386lynx_aout_,OP) +#define TARGETNAME "a.out-i386-lynx" + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#ifndef WRITE_HEADERS +#define WRITE_HEADERS(abfd, execp) \ + { \ + bfd_size_type text_size; /* dummy vars */ \ + file_ptr text_end; \ + if (adata(abfd).magic == undecided_magic) \ + NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \ + \ + execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \ + execp->a_entry = bfd_get_start_address (abfd); \ + \ + execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \ + obj_reloc_entry_size (abfd)); \ + execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \ + obj_reloc_entry_size (abfd)); \ + NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \ + \ + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \ + || bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \ + abfd) != EXEC_BYTES_SIZE) \ + return FALSE; \ + /* Now write out reloc info, followed by syms and strings */ \ + \ + if (bfd_get_symcount (abfd) != 0) \ + { \ + if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) \ + != 0) \ + return FALSE; \ + \ + if (! NAME(aout,write_syms) (abfd)) return FALSE; \ + \ + if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) \ + != 0) \ + return FALSE; \ + \ + if (!NAME(lynx,squirt_out_relocs) (abfd, obj_textsec (abfd))) \ + return FALSE; \ + if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) \ + != 0) \ + return 0; \ + \ + if (!NAME(lynx,squirt_out_relocs) (abfd, obj_datasec (abfd))) \ + return FALSE; \ + } \ + } +#endif + +#include "libaout.h" +#include "aout/aout64.h" + +void NAME (lynx,swap_std_reloc_out) + PARAMS ((bfd *, arelent *, struct reloc_std_external *)); +void NAME (lynx,swap_ext_reloc_out) + PARAMS ((bfd *, arelent *, struct reloc_ext_external *)); +void NAME (lynx,swap_ext_reloc_in) + PARAMS ((bfd *, struct reloc_ext_external *, arelent *, asymbol **, + bfd_size_type)); +void NAME (lynx,swap_std_reloc_in) + PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **, + bfd_size_type)); +bfd_boolean NAME (lynx,slurp_reloc_table) + PARAMS ((bfd *, sec_ptr, asymbol **)); +bfd_boolean NAME (lynx,squirt_out_relocs) + PARAMS ((bfd *, asection *)); +long NAME (lynx,canonicalize_reloc) + PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); + +#ifdef LYNX_CORE + +char *lynx_core_file_failing_command (); +int lynx_core_file_failing_signal (); +bfd_boolean lynx_core_file_matches_executable_p (); +const bfd_target *lynx_core_file_p (); + +#define MY_core_file_failing_command lynx_core_file_failing_command +#define MY_core_file_failing_signal lynx_core_file_failing_signal +#define MY_core_file_matches_executable_p lynx_core_file_matches_executable_p +#define MY_core_file_p lynx_core_file_p + +#endif /* LYNX_CORE */ + + +#define KEEPIT udata.i + +extern reloc_howto_type aout_32_ext_howto_table[]; +extern reloc_howto_type aout_32_std_howto_table[]; + +/* Standard reloc stuff */ +/* Output standard relocation information to a file in target byte order. */ + +void +NAME(lynx,swap_std_reloc_out) (abfd, g, natptr) + bfd *abfd; + arelent *g; + struct reloc_std_external *natptr; +{ + int r_index; + asymbol *sym = *(g->sym_ptr_ptr); + int r_extern; + unsigned int r_length; + int r_pcrel; + int r_baserel, r_jmptable, r_relative; + unsigned int r_addend; + asection *output_section = sym->section->output_section; + + PUT_WORD (abfd, g->address, natptr->r_address); + + r_length = g->howto->size; /* Size as a power of two */ + r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */ + /* r_baserel, r_jmptable, r_relative??? FIXME-soon */ + r_baserel = 0; + r_jmptable = 0; + r_relative = 0; + + r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma; + + /* name was clobbered by aout_write_syms to be symbol index */ + + /* If this relocation is relative to a symbol then set the + r_index to the symbols index, and the r_extern bit. + + Absolute symbols can come in in two ways, either as an offset + from the abs section, or as a symbol which has an abs value. + check for that here + */ + + + if (bfd_is_com_section (output_section) + || bfd_is_abs_section (output_section) + || bfd_is_und_section (output_section)) + { + if (bfd_abs_section_ptr->symbol == sym) + { + /* Whoops, looked like an abs symbol, but is really an offset + from the abs section */ + r_index = 0; + r_extern = 0; + } + else + { + /* Fill in symbol */ + r_extern = 1; + r_index = (*g->sym_ptr_ptr)->KEEPIT; + } + } + else + { + /* Just an ordinary section */ + r_extern = 0; + r_index = output_section->target_index; + } + + /* now the fun stuff */ + if (bfd_header_big_endian (abfd)) + { + natptr->r_index[0] = r_index >> 16; + natptr->r_index[1] = r_index >> 8; + natptr->r_index[2] = r_index; + natptr->r_type[0] = + (r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0) + | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0) + | (r_baserel ? RELOC_STD_BITS_BASEREL_BIG : 0) + | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_BIG : 0) + | (r_relative ? RELOC_STD_BITS_RELATIVE_BIG : 0) + | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG); + } + else + { + natptr->r_index[2] = r_index >> 16; + natptr->r_index[1] = r_index >> 8; + natptr->r_index[0] = r_index; + natptr->r_type[0] = + (r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0) + | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0) + | (r_baserel ? RELOC_STD_BITS_BASEREL_LITTLE : 0) + | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_LITTLE : 0) + | (r_relative ? RELOC_STD_BITS_RELATIVE_LITTLE : 0) + | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE); + } +} + + +/* Extended stuff */ +/* Output extended relocation information to a file in target byte order. */ + +void +NAME(lynx,swap_ext_reloc_out) (abfd, g, natptr) + bfd *abfd; + arelent *g; + register struct reloc_ext_external *natptr; +{ + int r_index; + int r_extern; + unsigned int r_type; + unsigned int r_addend; + asymbol *sym = *(g->sym_ptr_ptr); + asection *output_section = sym->section->output_section; + + PUT_WORD (abfd, g->address, natptr->r_address); + + r_type = (unsigned int) g->howto->type; + + r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma; + + + /* If this relocation is relative to a symbol then set the + r_index to the symbols index, and the r_extern bit. + + Absolute symbols can come in in two ways, either as an offset + from the abs section, or as a symbol which has an abs value. + check for that here + */ + + if (bfd_is_com_section (output_section) + || bfd_is_abs_section (output_section) + || bfd_is_und_section (output_section)) + { + if (bfd_abs_section_ptr->symbol == sym) + { + /* Whoops, looked like an abs symbol, but is really an offset + from the abs section */ + r_index = 0; + r_extern = 0; + } + else + { + r_extern = 1; + r_index = (*g->sym_ptr_ptr)->KEEPIT; + } + } + else + { + /* Just an ordinary section */ + r_extern = 0; + r_index = output_section->target_index; + } + + + /* now the fun stuff */ + if (bfd_header_big_endian (abfd)) + { + natptr->r_index[0] = r_index >> 16; + natptr->r_index[1] = r_index >> 8; + natptr->r_index[2] = r_index; + natptr->r_type[0] = + (r_extern ? RELOC_EXT_BITS_EXTERN_BIG : 0) + | (r_type << RELOC_EXT_BITS_TYPE_SH_BIG); + } + else + { + natptr->r_index[2] = r_index >> 16; + natptr->r_index[1] = r_index >> 8; + natptr->r_index[0] = r_index; + natptr->r_type[0] = + (r_extern ? RELOC_EXT_BITS_EXTERN_LITTLE : 0) + | (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE); + } + + PUT_WORD (abfd, r_addend, natptr->r_addend); +} + +/* BFD deals internally with all things based from the section they're + in. so, something in 10 bytes into a text section with a base of + 50 would have a symbol (.text+10) and know .text vma was 50. + + Aout keeps all it's symbols based from zero, so the symbol would + contain 60. This macro subs the base of each section from the value + to give the true offset from the section */ + + +#define MOVE_ADDRESS(ad) \ + if (r_extern) { \ + /* undefined symbol */ \ + cache_ptr->sym_ptr_ptr = symbols + r_index; \ + cache_ptr->addend = ad; \ + } else { \ + /* defined, section relative. replace symbol with pointer to \ + symbol which points to section */ \ + switch (r_index) { \ + case N_TEXT: \ + case N_TEXT | N_EXT: \ + cache_ptr->sym_ptr_ptr = obj_textsec(abfd)->symbol_ptr_ptr; \ + cache_ptr->addend = ad - su->textsec->vma; \ + break; \ + case N_DATA: \ + case N_DATA | N_EXT: \ + cache_ptr->sym_ptr_ptr = obj_datasec(abfd)->symbol_ptr_ptr; \ + cache_ptr->addend = ad - su->datasec->vma; \ + break; \ + case N_BSS: \ + case N_BSS | N_EXT: \ + cache_ptr->sym_ptr_ptr = obj_bsssec(abfd)->symbol_ptr_ptr; \ + cache_ptr->addend = ad - su->bsssec->vma; \ + break; \ + default: \ + case N_ABS: \ + case N_ABS | N_EXT: \ + cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; \ + cache_ptr->addend = ad; \ + break; \ + } \ + } \ + +void +NAME(lynx,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) + bfd *abfd; + struct reloc_ext_external *bytes; + arelent *cache_ptr; + asymbol **symbols; + bfd_size_type symcount ATTRIBUTE_UNUSED; +{ + int r_index; + int r_extern; + unsigned int r_type; + struct aoutdata *su = &(abfd->tdata.aout_data->a); + + cache_ptr->address = (GET_SWORD (abfd, bytes->r_address)); + + r_index = bytes->r_index[1]; + r_extern = (0 != (bytes->r_index[0] & RELOC_EXT_BITS_EXTERN_BIG)); + r_type = (bytes->r_index[0] & RELOC_EXT_BITS_TYPE_BIG) + >> RELOC_EXT_BITS_TYPE_SH_BIG; + + cache_ptr->howto = aout_32_ext_howto_table + r_type; + MOVE_ADDRESS (GET_SWORD (abfd, bytes->r_addend)); +} + +void +NAME(lynx,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) + bfd *abfd; + struct reloc_std_external *bytes; + arelent *cache_ptr; + asymbol **symbols; + bfd_size_type symcount ATTRIBUTE_UNUSED; +{ + int r_index; + int r_extern; + unsigned int r_length; + int r_pcrel; + int r_baserel, r_jmptable, r_relative; + struct aoutdata *su = &(abfd->tdata.aout_data->a); + + cache_ptr->address = H_GET_32 (abfd, bytes->r_address); + + r_index = bytes->r_index[1]; + r_extern = (0 != (bytes->r_index[0] & RELOC_STD_BITS_EXTERN_BIG)); + r_pcrel = (0 != (bytes->r_index[0] & RELOC_STD_BITS_PCREL_BIG)); + r_baserel = (0 != (bytes->r_index[0] & RELOC_STD_BITS_BASEREL_BIG)); + r_jmptable = (0 != (bytes->r_index[0] & RELOC_STD_BITS_JMPTABLE_BIG)); + r_relative = (0 != (bytes->r_index[0] & RELOC_STD_BITS_RELATIVE_BIG)); + r_length = (bytes->r_index[0] & RELOC_STD_BITS_LENGTH_BIG) + >> RELOC_STD_BITS_LENGTH_SH_BIG; + + cache_ptr->howto = aout_32_std_howto_table + r_length + 4 * r_pcrel; + /* FIXME-soon: Roll baserel, jmptable, relative bits into howto setting */ + + MOVE_ADDRESS (0); +} + +/* Reloc hackery */ + +bfd_boolean +NAME(lynx,slurp_reloc_table) (abfd, asect, symbols) + bfd *abfd; + sec_ptr asect; + asymbol **symbols; +{ + bfd_size_type count; + bfd_size_type reloc_size; + PTR relocs; + arelent *reloc_cache; + size_t each_size; + + if (asect->relocation) + return TRUE; + + if (asect->flags & SEC_CONSTRUCTOR) + return TRUE; + + if (asect == obj_datasec (abfd)) + { + reloc_size = exec_hdr (abfd)->a_drsize; + goto doit; + } + + if (asect == obj_textsec (abfd)) + { + reloc_size = exec_hdr (abfd)->a_trsize; + goto doit; + } + + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + +doit: + if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0) + return FALSE; + each_size = obj_reloc_entry_size (abfd); + + count = reloc_size / each_size; + + + reloc_cache = (arelent *) bfd_zmalloc (count * sizeof (arelent)); + if (!reloc_cache && count != 0) + return FALSE; + + relocs = (PTR) bfd_alloc (abfd, reloc_size); + if (!relocs && reloc_size != 0) + { + free (reloc_cache); + return FALSE; + } + + if (bfd_bread (relocs, reloc_size, abfd) != reloc_size) + { + bfd_release (abfd, relocs); + free (reloc_cache); + return FALSE; + } + + if (each_size == RELOC_EXT_SIZE) + { + register struct reloc_ext_external *rptr = (struct reloc_ext_external *) relocs; + unsigned int counter = 0; + arelent *cache_ptr = reloc_cache; + + for (; counter < count; counter++, rptr++, cache_ptr++) + { + NAME(lynx,swap_ext_reloc_in) (abfd, rptr, cache_ptr, symbols, + (bfd_size_type) bfd_get_symcount (abfd)); + } + } + else + { + register struct reloc_std_external *rptr = (struct reloc_std_external *) relocs; + unsigned int counter = 0; + arelent *cache_ptr = reloc_cache; + + for (; counter < count; counter++, rptr++, cache_ptr++) + { + NAME(lynx,swap_std_reloc_in) (abfd, rptr, cache_ptr, symbols, + (bfd_size_type) bfd_get_symcount (abfd)); + } + + } + + bfd_release (abfd, relocs); + asect->relocation = reloc_cache; + asect->reloc_count = count; + return TRUE; +} + + + +/* Write out a relocation section into an object file. */ + +bfd_boolean +NAME(lynx,squirt_out_relocs) (abfd, section) + bfd *abfd; + asection *section; +{ + arelent **generic; + unsigned char *native, *natptr; + size_t each_size; + + unsigned int count = section->reloc_count; + bfd_size_type natsize; + + if (count == 0) + return TRUE; + + each_size = obj_reloc_entry_size (abfd); + natsize = count; + natsize *= each_size; + native = (unsigned char *) bfd_zalloc (abfd, natsize); + if (!native) + return FALSE; + + generic = section->orelocation; + + if (each_size == RELOC_EXT_SIZE) + { + for (natptr = native; + count != 0; + --count, natptr += each_size, ++generic) + NAME(lynx,swap_ext_reloc_out) (abfd, *generic, (struct reloc_ext_external *) natptr); + } + else + { + for (natptr = native; + count != 0; + --count, natptr += each_size, ++generic) + NAME(lynx,swap_std_reloc_out) (abfd, *generic, (struct reloc_std_external *) natptr); + } + + if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize) + { + bfd_release (abfd, native); + return FALSE; + } + bfd_release (abfd, native); + + return TRUE; +} + +/* This is stupid. This function should be a boolean predicate */ +long +NAME(lynx,canonicalize_reloc) (abfd, section, relptr, symbols) + bfd *abfd; + sec_ptr section; + arelent **relptr; + asymbol **symbols; +{ + arelent *tblptr = section->relocation; + unsigned int count; + + if (!(tblptr || NAME(lynx,slurp_reloc_table) (abfd, section, symbols))) + return -1; + + if (section->flags & SEC_CONSTRUCTOR) + { + arelent_chain *chain = section->constructor_chain; + for (count = 0; count < section->reloc_count; count++) + { + *relptr++ = &chain->relent; + chain = chain->next; + } + } + else + { + tblptr = section->relocation; + + for (count = 0; count++ < section->reloc_count;) + { + *relptr++ = tblptr++; + } + } + *relptr = 0; + + return section->reloc_count; +} + +#define MY_canonicalize_reloc NAME(lynx,canonicalize_reloc) + +#include "aout-target.h" diff --git a/bfd/i386mach3.c b/bfd/i386mach3.c new file mode 100644 index 0000000000000..215f814a1ca01 --- /dev/null +++ b/bfd/i386mach3.c @@ -0,0 +1,70 @@ +/* BFD back-end for i386 a.out binaries. + Copyright 1990, 1991, 1993, 1994, 1995, 1997, 2001, 2002, 2003 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* This is for Mach 3, which uses a.out, not Mach-O. */ + +/* There is no magic number or anything which lets us distinguish this target + from i386aout or i386bsd. So this target is only useful if it is the + default target. */ + +#define TARGET_PAGE_SIZE 1 +#define SEGMENT_SIZE 0x1000 +#define TEXT_START_ADDR 0x10000 +#define ARCH 32 +/* This macro is only relevant when N_MAGIC(x) == ZMAGIC. */ +#define N_HEADER_IN_TEXT(x) 1 + +#define N_TXTSIZE(x) ((x).a_text) + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "aout/aout64.h" +#include "aout/stab_gnu.h" +#include "aout/ar.h" +#include "libaout.h" /* BFD a.out internal data structures */ + +#define DEFAULT_ARCH bfd_arch_i386 + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (i386mach3_,OP) +#define TARGETNAME "a.out-mach3" + +static bfd_boolean MY (set_sizes) PARAMS ((bfd *)); +#define MY_backend_data &MY(backend_data) +static const struct aout_backend_data MY(backend_data) = { + 0, /* zmagic contiguous */ + 1, /* text incl header */ + 0, /* entry is text address */ + 0, /* exec_hdr_flags */ + 0, /* text vma? */ + MY(set_sizes), + 1, /* exec header not counted */ + 0, /* add_dynamic_symbols */ + 0, /* add_one_symbol */ + 0, /* link_dynamic_object */ + 0, /* write_dynamic_symbol */ + 0, /* check_dynamic_reloc */ + 0 /* finish_dynamic_link */ +}; + +#include "aout-target.h" diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c new file mode 100644 index 0000000000000..059466b4c9514 --- /dev/null +++ b/bfd/i386msdos.c @@ -0,0 +1,256 @@ +/* BFD back-end for MS-DOS executables. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, + 2003 Free Software Foundation, Inc. + Written by Bryan Ford of the University of Utah. + + Contributed by the Center for Software Science at the + University of Utah (pa-gdb-bugs@cs.utah.edu). + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "libaout.h" + +#if 0 +struct exe_header +{ + unsigned short magic; + unsigned short bytes_in_last_page; + unsigned short npages; /* number of 512-byte "pages" including this header */ + unsigned short nrelocs; + unsigned short header_paras; /* number of 16-byte paragraphs in header */ + unsigned short reserved; + unsigned short load_switch; + unsigned short ss_ofs; + unsigned short sp; + unsigned short checksum; + unsigned short ip; + unsigned short cs_ofs; + unsigned short reloc_ofs; + unsigned short reserved2; + unsigned short something1; + unsigned short something2; + unsigned short something3; +}; +#endif + +#define EXE_MAGIC 0x5a4d +#define EXE_LOAD_HIGH 0x0000 +#define EXE_LOAD_LOW 0xffff +#define EXE_PAGE_SIZE 512 + +static int msdos_sizeof_headers + PARAMS ((bfd *, bfd_boolean)); +static bfd_boolean msdos_write_object_contents + PARAMS ((bfd *)); +static bfd_boolean msdos_set_section_contents + PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); + +static int +msdos_sizeof_headers (abfd, exec) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_boolean exec ATTRIBUTE_UNUSED; +{ + return 0; +} + +static bfd_boolean +msdos_write_object_contents (abfd) + bfd *abfd; +{ + static char hdr[EXE_PAGE_SIZE]; + file_ptr outfile_size = sizeof(hdr); + bfd_vma high_vma = 0; + asection *sec; + + /* Find the total size of the program on disk and in memory. */ + for (sec = abfd->sections; sec != (asection *) NULL; sec = sec->next) + { + if (bfd_get_section_size_before_reloc (sec) == 0) + continue; + if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + { + bfd_vma sec_vma = bfd_get_section_vma (abfd, sec) + + bfd_get_section_size_before_reloc (sec); + if (sec_vma > high_vma) + high_vma = sec_vma; + } + if (bfd_get_section_flags (abfd, sec) & SEC_LOAD) + { + file_ptr sec_end = sizeof(hdr) + + bfd_get_section_vma (abfd, sec) + + bfd_get_section_size_before_reloc (sec); + if (sec_end > outfile_size) + outfile_size = sec_end; + } + } + + /* Make sure the program isn't too big. */ + if (high_vma > (bfd_vma)0xffff) + { + bfd_set_error(bfd_error_file_too_big); + return FALSE; + } + + /* Constants. */ + H_PUT_16 (abfd, EXE_MAGIC, &hdr[0]); + H_PUT_16 (abfd, EXE_PAGE_SIZE / 16, &hdr[8]); + H_PUT_16 (abfd, EXE_LOAD_LOW, &hdr[12]); + H_PUT_16 (abfd, 0x3e, &hdr[24]); + H_PUT_16 (abfd, 0x0001, &hdr[28]); /* XXX??? */ + H_PUT_16 (abfd, 0x30fb, &hdr[30]); /* XXX??? */ + H_PUT_16 (abfd, 0x726a, &hdr[32]); /* XXX??? */ + + /* Bytes in last page (0 = full page). */ + H_PUT_16 (abfd, outfile_size & (EXE_PAGE_SIZE - 1), &hdr[2]); + + /* Number of pages. */ + H_PUT_16 (abfd, (outfile_size + EXE_PAGE_SIZE - 1) / EXE_PAGE_SIZE, &hdr[4]); + + /* Set the initial stack pointer to the end of the bss. + The program's crt0 code must relocate it to a real stack. */ + H_PUT_16 (abfd, high_vma, &hdr[16]); + + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 + || bfd_bwrite (hdr, (bfd_size_type) sizeof(hdr), abfd) != sizeof(hdr)) + return FALSE; + + return TRUE; +} + +static bfd_boolean +msdos_set_section_contents (abfd, section, location, offset, count) + bfd *abfd; + sec_ptr section; + const PTR location; + file_ptr offset; + bfd_size_type count; +{ + + if (count == 0) + return TRUE; + + section->filepos = EXE_PAGE_SIZE + bfd_get_section_vma (abfd, section); + + if (bfd_get_section_flags (abfd, section) & SEC_LOAD) + { + if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 + || bfd_bwrite (location, count, abfd) != count) + return FALSE; + } + + return TRUE; +} + + + +#define msdos_mkobject aout_32_mkobject +#define msdos_make_empty_symbol aout_32_make_empty_symbol +#define msdos_bfd_reloc_type_lookup aout_32_reloc_type_lookup + +#define msdos_close_and_cleanup _bfd_generic_close_and_cleanup +#define msdos_bfd_free_cached_info _bfd_generic_bfd_free_cached_info +#define msdos_new_section_hook _bfd_generic_new_section_hook +#define msdos_get_section_contents _bfd_generic_get_section_contents +#define msdos_get_section_contents_in_window \ + _bfd_generic_get_section_contents_in_window +#define msdos_bfd_get_relocated_section_contents \ + bfd_generic_get_relocated_section_contents +#define msdos_bfd_relax_section bfd_generic_relax_section +#define msdos_bfd_gc_sections bfd_generic_gc_sections +#define msdos_bfd_merge_sections bfd_generic_merge_sections +#define msdos_bfd_discard_group bfd_generic_discard_group +#define msdos_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define msdos_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define msdos_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define msdos_bfd_link_just_syms _bfd_generic_link_just_syms +#define msdos_bfd_final_link _bfd_generic_final_link +#define msdos_bfd_link_split_section _bfd_generic_link_split_section +#define msdos_set_arch_mach _bfd_generic_set_arch_mach + +#define msdos_get_symtab_upper_bound _bfd_nosymbols_get_symtab_upper_bound +#define msdos_canonicalize_symtab _bfd_nosymbols_canonicalize_symtab +#define msdos_print_symbol _bfd_nosymbols_print_symbol +#define msdos_get_symbol_info _bfd_nosymbols_get_symbol_info +#define msdos_find_nearest_line _bfd_nosymbols_find_nearest_line +#define msdos_get_lineno _bfd_nosymbols_get_lineno +#define msdos_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name +#define msdos_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define msdos_read_minisymbols _bfd_nosymbols_read_minisymbols +#define msdos_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol + +#define msdos_canonicalize_reloc _bfd_norelocs_canonicalize_reloc +#define msdos_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound +#define msdos_32_bfd_link_split_section _bfd_generic_link_split_section + +const bfd_target i386msdos_vec = + { + "msdos", /* name */ + bfd_target_msdos_flavour, + BFD_ENDIAN_LITTLE, /* target byte order */ + BFD_ENDIAN_LITTLE, /* target headers byte order */ + (EXEC_P), /* object flags */ + (SEC_CODE | SEC_DATA | SEC_HAS_CONTENTS + | SEC_ALLOC | SEC_LOAD), /* section flags */ + 0, /* leading underscore */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ + + { + _bfd_dummy_target, + _bfd_dummy_target, /* bfd_check_format */ + _bfd_dummy_target, + _bfd_dummy_target, + }, + { + bfd_false, + msdos_mkobject, + _bfd_generic_mkarchive, + bfd_false, + }, + { /* bfd_write_contents */ + bfd_false, + msdos_write_object_contents, + _bfd_write_archive_contents, + bfd_false, + }, + + BFD_JUMP_TABLE_GENERIC (msdos), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (msdos), + BFD_JUMP_TABLE_RELOCS (msdos), + BFD_JUMP_TABLE_WRITE (msdos), + BFD_JUMP_TABLE_LINK (msdos), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + (PTR) 0 + }; + + diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c new file mode 100644 index 0000000000000..d9a34e34131b8 --- /dev/null +++ b/bfd/i386os9k.c @@ -0,0 +1,382 @@ +/* BFD back-end for os9000 i386 binaries. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, 2002 + Free Software Foundation, Inc. + Written by Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "bfdlink.h" +#include "libaout.h" /* BFD a.out internal data structures */ +#include "os9k.h" + +static const bfd_target * os9k_callback + PARAMS ((bfd *)); +static const bfd_target * os9k_object_p + PARAMS ((bfd *)); +static int os9k_sizeof_headers + PARAMS ((bfd *, bfd_boolean)); +bfd_boolean os9k_swap_exec_header_in + PARAMS ((bfd *, mh_com *, struct internal_exec *)); + +/* Swaps the information in an executable header taken from a raw byte + stream memory image, into the internal exec_header structure. */ +bfd_boolean +os9k_swap_exec_header_in (abfd, raw_bytes, execp) + bfd *abfd; + mh_com *raw_bytes; + struct internal_exec *execp; +{ + mh_com *bytes = (mh_com *) raw_bytes; + unsigned int dload, dmemsize, dmemstart; + + /* Now fill in fields in the execp, from the bytes in the raw data. */ + execp->a_info = H_GET_16 (abfd, bytes->m_sync); + execp->a_syms = 0; + execp->a_entry = H_GET_32 (abfd, bytes->m_exec); + execp->a_talign = 2; + execp->a_dalign = 2; + execp->a_balign = 2; + + dload = H_GET_32 (abfd, bytes->m_idata); + execp->a_data = dload + 8; + + if (bfd_seek (abfd, (file_ptr) dload, SEEK_SET) != 0 + || (bfd_bread (&dmemstart, (bfd_size_type) sizeof (dmemstart), abfd) + != sizeof (dmemstart)) + || (bfd_bread (&dmemsize, (bfd_size_type) sizeof (dmemsize), abfd) + != sizeof (dmemsize))) + return FALSE; + + execp->a_tload = 0; + execp->a_dload = H_GET_32 (abfd, (unsigned char *) &dmemstart); + execp->a_text = dload - execp->a_tload; + execp->a_data = H_GET_32 (abfd, (unsigned char *) &dmemsize); + execp->a_bss = H_GET_32 (abfd, bytes->m_data) - execp->a_data; + + execp->a_trsize = 0; + execp->a_drsize = 0; + + return TRUE; +} + +#if 0 +/* Swaps the information in an internal exec header structure into the + supplied buffer ready for writing to disk. */ + +void os9k_swap_exec_header_out + PARAMS ((bfd *, struct internal_exec *, struct mh_com *)); + +void +os9k_swap_exec_header_out (abfd, execp, raw_bytes) + bfd *abfd; + struct internal_exec *execp; + mh_com *raw_bytes; +{ + mh_com *bytes = (mh_com *) raw_bytes; + + /* Now fill in fields in the raw data, from the fields in the exec struct. */ + H_PUT_32 (abfd, execp->a_info, bytes->e_info); + H_PUT_32 (abfd, execp->a_text, bytes->e_text); + H_PUT_32 (abfd, execp->a_data, bytes->e_data); + H_PUT_32 (abfd, execp->a_bss, bytes->e_bss); + H_PUT_32 (abfd, execp->a_syms, bytes->e_syms); + H_PUT_32 (abfd, execp->a_entry, bytes->e_entry); + H_PUT_32 (abfd, execp->a_trsize, bytes->e_trsize); + H_PUT_32 (abfd, execp->a_drsize, bytes->e_drsize); + H_PUT_32 (abfd, execp->a_tload, bytes->e_tload); + H_PUT_32 (abfd, execp->a_dload, bytes->e_dload); + bytes->e_talign[0] = execp->a_talign; + bytes->e_dalign[0] = execp->a_dalign; + bytes->e_balign[0] = execp->a_balign; + bytes->e_relaxable[0] = execp->a_relaxable; +} + +#endif /* 0 */ + +static const bfd_target * +os9k_object_p (abfd) + bfd *abfd; +{ + struct internal_exec anexec; + mh_com exec_bytes; + + if (bfd_bread ((PTR) &exec_bytes, (bfd_size_type) MHCOM_BYTES_SIZE, abfd) + != MHCOM_BYTES_SIZE) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + anexec.a_info = H_GET_16 (abfd, exec_bytes.m_sync); + if (N_BADMAG (anexec)) + { + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + if (! os9k_swap_exec_header_in (abfd, &exec_bytes, &anexec)) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + return aout_32_some_aout_object_p (abfd, &anexec, os9k_callback); +} + + +/* Finish up the opening of a b.out file for reading. Fill in all the + fields that are not handled by common code. */ + +static const bfd_target * +os9k_callback (abfd) + bfd *abfd; +{ + struct internal_exec *execp = exec_hdr (abfd); + unsigned long bss_start; + + /* Architecture and machine type. */ + bfd_set_arch_mach (abfd, bfd_arch_i386, 0); + + /* The positions of the string table and symbol table. */ + obj_str_filepos (abfd) = 0; + obj_sym_filepos (abfd) = 0; + + /* The alignments of the sections. */ + obj_textsec (abfd)->alignment_power = execp->a_talign; + obj_datasec (abfd)->alignment_power = execp->a_dalign; + obj_bsssec (abfd)->alignment_power = execp->a_balign; + + /* The starting addresses of the sections. */ + obj_textsec (abfd)->vma = execp->a_tload; + obj_datasec (abfd)->vma = execp->a_dload; + + /* And reload the sizes, since the aout module zaps them. */ + obj_textsec (abfd)->_raw_size = execp->a_text; + + bss_start = execp->a_dload + execp->a_data; /* BSS = end of data section. */ + obj_bsssec (abfd)->vma = align_power (bss_start, execp->a_balign); + + /* The file positions of the sections. */ + obj_textsec (abfd)->filepos = execp->a_entry; + obj_datasec (abfd)->filepos = execp->a_dload; + + /* The file positions of the relocation info *** + obj_textsec (abfd)->rel_filepos = N_TROFF(*execp); + obj_datasec (abfd)->rel_filepos = N_DROFF(*execp); */ + + adata (abfd).page_size = 1; /* Not applicable. */ + adata (abfd).segment_size = 1;/* Not applicable. */ + adata (abfd).exec_bytes_size = MHCOM_BYTES_SIZE; + + return abfd->xvec; +} + +#if 0 +struct bout_data_struct +{ + struct aoutdata a; + struct internal_exec e; +}; + +static bfd_boolean +os9k_mkobject (abfd) + bfd *abfd; +{ + struct bout_data_struct *rawptr; + bfd_size_type amt = sizeof (struct bout_data_struct); + + rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, amt); + if (rawptr == NULL) + return FALSE; + + abfd->tdata.bout_data = rawptr; + exec_hdr (abfd) = &rawptr->e; + + obj_textsec (abfd) = (asection *) NULL; + obj_datasec (abfd) = (asection *) NULL; + obj_bsssec (abfd) = (asection *) NULL; + + return TRUE; +} + +static bfd_boolean +os9k_write_object_contents (abfd) + bfd *abfd; +{ + struct external_exec swapped_hdr; + + if (! aout_32_make_sections (abfd)) + return FALSE; + + exec_hdr (abfd)->a_info = BMAGIC; + + exec_hdr (abfd)->a_text = obj_textsec (abfd)->_raw_size; + exec_hdr (abfd)->a_data = obj_datasec (abfd)->_raw_size; + exec_hdr (abfd)->a_bss = obj_bsssec (abfd)->_raw_size; + exec_hdr (abfd)->a_syms = bfd_get_symcount (abfd) * sizeof (struct nlist); + exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd); + exec_hdr (abfd)->a_trsize = ((obj_textsec (abfd)->reloc_count) * + sizeof (struct relocation_info)); + exec_hdr (abfd)->a_drsize = ((obj_datasec (abfd)->reloc_count) * + sizeof (struct relocation_info)); + + exec_hdr (abfd)->a_talign = obj_textsec (abfd)->alignment_power; + exec_hdr (abfd)->a_dalign = obj_datasec (abfd)->alignment_power; + exec_hdr (abfd)->a_balign = obj_bsssec (abfd)->alignment_power; + + exec_hdr (abfd)->a_tload = obj_textsec (abfd)->vma; + exec_hdr (abfd)->a_dload = obj_datasec (abfd)->vma; + + bout_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr); + + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 + || bfd_bwrite ((PTR) & swapped_hdr, (bfd_size_type) EXEC_BYTES_SIZE, + abfd) != EXEC_BYTES_SIZE) + return FALSE; + + /* Now write out reloc info, followed by syms and strings. */ + if (bfd_get_symcount (abfd) != 0) + { + if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (*exec_hdr (abfd))), SEEK_SET) + != 0) + return FALSE; + + if (!aout_32_write_syms (abfd)) + return FALSE; + + if (bfd_seek (abfd, (file_ptr) (N_TROFF (*exec_hdr (abfd))), SEEK_SET) + != 0) + return FALSE; + + if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd))) + return FALSE; + if (bfd_seek (abfd, (file_ptr) (N_DROFF (*exec_hdr (abfd))), SEEK_SET) + != 0) + return FALSE; + + if (!b_out_squirt_out_relocs (abfd, obj_datasec (abfd))) + return FALSE; + } + return TRUE; +} + +static bfd_boolean +os9k_set_section_contents (abfd, section, location, offset, count) + bfd *abfd; + sec_ptr section; + unsigned char *location; + file_ptr offset; + int count; +{ + + if (! abfd->output_has_begun) + { /* set by bfd.c handler */ + if (! aout_32_make_sections (abfd)) + return FALSE; + + obj_textsec (abfd)->filepos = sizeof (struct internal_exec); + obj_datasec (abfd)->filepos = obj_textsec (abfd)->filepos + + obj_textsec (abfd)->_raw_size; + + } + /* Regardless, once we know what we're doing, we might as well get going. */ + if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0) + return FALSE; + + if (count != 0) + return bfd_bwrite ((PTR) location, (bfd_size_type) count, abfd) == count; + + return TRUE; +} +#endif /* 0 */ + +static int +os9k_sizeof_headers (ignore_abfd, ignore) + bfd *ignore_abfd ATTRIBUTE_UNUSED; + bfd_boolean ignore ATTRIBUTE_UNUSED; +{ + return sizeof (struct internal_exec); +} + + + +#define aout_32_close_and_cleanup aout_32_bfd_free_cached_info + +#define aout_32_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol + +#define aout_32_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup + +#define aout_32_get_section_contents_in_window \ + _bfd_generic_get_section_contents_in_window + +#define os9k_bfd_get_relocated_section_contents \ + bfd_generic_get_relocated_section_contents +#define os9k_bfd_relax_section bfd_generic_relax_section +#define os9k_bfd_gc_sections bfd_generic_gc_sections +#define os9k_bfd_merge_sections bfd_generic_merge_sections +#define os9k_bfd_discard_group bfd_generic_discard_group +#define os9k_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define os9k_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define os9k_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define os9k_bfd_link_just_syms _bfd_generic_link_just_syms +#define os9k_bfd_final_link _bfd_generic_final_link +#define os9k_bfd_link_split_section _bfd_generic_link_split_section + +const bfd_target i386os9k_vec = + { + "i386os9k", /* name */ + bfd_target_os9k_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_LITTLE, /* hdr byte order is little */ + (HAS_RELOC | EXEC_P | WP_TEXT), /* object flags */ + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD), /* section flags */ + 0, /* symbol leading char */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ + {_bfd_dummy_target, os9k_object_p, /* bfd_check_format */ + bfd_generic_archive_p, _bfd_dummy_target}, + {bfd_false, bfd_false, /* bfd_set_format */ + _bfd_generic_mkarchive, bfd_false}, + {bfd_false, bfd_false, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (aout_32), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd), + BFD_JUMP_TABLE_SYMBOLS (aout_32), + BFD_JUMP_TABLE_RELOCS (aout_32), + BFD_JUMP_TABLE_WRITE (aout_32), + BFD_JUMP_TABLE_LINK (os9k), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + (PTR) 0, + }; diff --git a/bfd/irix-core.c b/bfd/irix-core.c new file mode 100644 index 0000000000000..486842214f4c1 --- /dev/null +++ b/bfd/irix-core.c @@ -0,0 +1,360 @@ +/* BFD back-end for Irix core files. + Copyright 1993, 1994, 1996, 1999, 2001, 2002, 2004 + Free Software Foundation, Inc. + Written by Stu Grossman, Cygnus Support. + Converted to back-end form by Ian Lance Taylor, Cygnus Support + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +/* This file can only be compiled on systems which use Irix style core + files (namely, Irix 4 and Irix 5, so far). */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#ifdef IRIX_CORE + +#include + +struct sgi_core_struct +{ + int sig; + char cmd[CORE_NAMESIZE]; +}; + +#define core_hdr(bfd) ((bfd)->tdata.sgi_core_data) +#define core_signal(bfd) (core_hdr(bfd)->sig) +#define core_command(bfd) (core_hdr(bfd)->cmd) + +static asection *make_bfd_asection + PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr)); +static const bfd_target *irix_core_core_file_p + PARAMS ((bfd *)); +static char *irix_core_core_file_failing_command + PARAMS ((bfd *)); +static int irix_core_core_file_failing_signal + PARAMS ((bfd *)); +static bfd_boolean irix_core_core_file_matches_executable_p + PARAMS ((bfd *, bfd *)); +static void swap_abort + PARAMS ((void)); +#ifdef CORE_MAGIC64 +static int do_sections64 + PARAMS ((bfd *, struct coreout *)); +#endif +static int do_sections + PARAMS ((bfd *, struct coreout *)); + +/* Helper function for irix_core_core_file_p: + 32-bit and 64-bit versions. */ + +#ifdef CORE_MAGIC64 +static int +do_sections64 (abfd, coreout) + bfd * abfd; + struct coreout * coreout; +{ + struct vmap64 vmap; + char *secname; + int i, val; + + for (i = 0; i < coreout->c_nvmap; i++) + { + val = bfd_bread ((PTR) &vmap, (bfd_size_type) sizeof vmap, abfd); + if (val != sizeof vmap) + break; + + switch (vmap.v_type) + { + case VDATA: + secname = ".data"; + break; + case VSTACK: + secname = ".stack"; + break; +#ifdef VMAPFILE + case VMAPFILE: + secname = ".mapfile"; + break; +#endif + default: + continue; + } + + /* A file offset of zero means that the + section is not contained in the corefile. */ + if (vmap.v_offset == 0) + continue; + + if (!make_bfd_asection (abfd, secname, + SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS, + vmap.v_len, vmap.v_vaddr, vmap.v_offset)) + /* Fail. */ + return 0; + } + + return 1; +} +#endif + +/* 32-bit version. */ + +static int +do_sections (abfd, coreout) + bfd * abfd; + struct coreout *coreout; +{ + struct vmap vmap; + char *secname; + int i, val; + + for (i = 0; i < coreout->c_nvmap; i++) + { + val = bfd_bread ((PTR) &vmap, (bfd_size_type) sizeof vmap, abfd); + if (val != sizeof vmap) + break; + + switch (vmap.v_type) + { + case VDATA: + secname = ".data"; + break; + case VSTACK: + secname = ".stack"; + break; +#ifdef VMAPFILE + case VMAPFILE: + secname = ".mapfile"; + break; +#endif + default: + continue; + } + + /* A file offset of zero means that the + section is not contained in the corefile. */ + if (vmap.v_offset == 0) + continue; + + if (!make_bfd_asection (abfd, secname, + SEC_ALLOC | SEC_LOAD+SEC_HAS_CONTENTS, + vmap.v_len, vmap.v_vaddr, vmap.v_offset)) + /* Fail. */ + return 0; + } + return 1; +} + +static asection * +make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) + bfd *abfd; + const char *name; + flagword flags; + bfd_size_type _raw_size; + bfd_vma vma; + file_ptr filepos; +{ + asection *asect; + + asect = bfd_make_section_anyway (abfd, name); + if (!asect) + return NULL; + + asect->flags = flags; + asect->_raw_size = _raw_size; + asect->vma = vma; + asect->filepos = filepos; + asect->alignment_power = 4; + + return asect; +} + +static const bfd_target * +irix_core_core_file_p (abfd) + bfd *abfd; +{ + int val; + struct coreout coreout; + struct idesc *idg, *idf, *ids; + bfd_size_type amt; + + val = bfd_bread ((PTR) &coreout, (bfd_size_type) sizeof coreout, abfd); + if (val != sizeof coreout) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + if (coreout.c_version != CORE_VERSION1) + return 0; + + /* Have we got a corefile? */ + switch (coreout.c_magic) + { + case CORE_MAGIC: break; +#ifdef CORE_MAGIC64 + case CORE_MAGIC64: break; +#endif +#ifdef CORE_MAGICN32 + case CORE_MAGICN32: break; +#endif + default: return 0; /* Un-identifiable or not corefile. */ + } + + amt = sizeof (struct sgi_core_struct); + core_hdr (abfd) = (struct sgi_core_struct *) bfd_zalloc (abfd, amt); + if (!core_hdr (abfd)) + return NULL; + + strncpy (core_command (abfd), coreout.c_name, CORE_NAMESIZE); + core_signal (abfd) = coreout.c_sigcause; + + if (bfd_seek (abfd, coreout.c_vmapoffset, SEEK_SET) != 0) + goto fail; + + /* Process corefile sections. */ +#ifdef CORE_MAGIC64 + if (coreout.c_magic == (int) CORE_MAGIC64) + { + if (! do_sections64 (abfd, & coreout)) + goto fail; + } + else +#endif + if (! do_sections (abfd, & coreout)) + goto fail; + + /* Make sure that the regs are contiguous within the core file. */ + + idg = &coreout.c_idesc[I_GPREGS]; + idf = &coreout.c_idesc[I_FPREGS]; + ids = &coreout.c_idesc[I_SPECREGS]; + + if (idg->i_offset + idg->i_len != idf->i_offset + || idf->i_offset + idf->i_len != ids->i_offset) + goto fail; /* Can't deal with non-contig regs */ + + if (bfd_seek (abfd, idg->i_offset, SEEK_SET) != 0) + goto fail; + + if (!make_bfd_asection (abfd, ".reg", + SEC_HAS_CONTENTS, + idg->i_len + idf->i_len + ids->i_len, + 0, + idg->i_offset)) + goto fail; + + /* OK, we believe you. You're a core file (sure, sure). */ + bfd_default_set_arch_mach (abfd, bfd_arch_mips, 0); + + return abfd->xvec; + + fail: + bfd_release (abfd, core_hdr (abfd)); + core_hdr (abfd) = NULL; + bfd_section_list_clear (abfd); + return NULL; +} + +static char * +irix_core_core_file_failing_command (abfd) + bfd *abfd; +{ + return core_command (abfd); +} + +static int +irix_core_core_file_failing_signal (abfd) + bfd *abfd; +{ + return core_signal (abfd); +} + +static bfd_boolean +irix_core_core_file_matches_executable_p (core_bfd, exec_bfd) + bfd *core_bfd, *exec_bfd; +{ + return TRUE; /* XXX - FIXME */ +} + +/* If somebody calls any byte-swapping routines, shoot them. */ +static void +swap_abort() +{ + abort(); /* This way doesn't require any declaration for ANSI to fuck up */ +} + +#define NO_GET ((bfd_vma (*) (const void *)) swap_abort) +#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) +#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) +#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort) +#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort) +#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort) + +const bfd_target irix_core_vec = + { + "irix-core", + bfd_target_unknown_flavour, + BFD_ENDIAN_BIG, /* target byte order */ + BFD_ENDIAN_BIG, /* target headers byte order */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + 0, /* symbol prefix */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit data */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit data */ + NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs */ + NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs */ + + { /* bfd_check_format */ + _bfd_dummy_target, /* unknown format */ + _bfd_dummy_target, /* object file */ + _bfd_dummy_target, /* archive */ + irix_core_core_file_p /* a core file */ + }, + { /* bfd_set_format */ + bfd_false, bfd_false, + bfd_false, bfd_false + }, + { /* bfd_write_contents */ + bfd_false, bfd_false, + bfd_false, bfd_false + }, + + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (irix_core), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), + BFD_JUMP_TABLE_WRITE (_bfd_generic), + BFD_JUMP_TABLE_LINK (_bfd_nolink), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + (PTR) 0 /* backend_data */ + }; + +#endif /* IRIX_CORE */ diff --git a/bfd/libhppa.h b/bfd/libhppa.h new file mode 100644 index 0000000000000..f6aa23456d3b3 --- /dev/null +++ b/bfd/libhppa.h @@ -0,0 +1,594 @@ +/* HP PA-RISC SOM object file format: definitions internal to BFD. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, + 2003 Free Software Foundation, Inc. + + Contributed by the Center for Software Science at the + University of Utah (pa-gdb-bugs@cs.utah.edu). + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#ifndef _LIBHPPA_H +#define _LIBHPPA_H + +#define BYTES_IN_WORD 4 +#define PA_PAGESIZE 0x1000 + +/* The PA instruction set variants. */ +enum pa_arch {pa10 = 10, pa11 = 11, pa20 = 20, pa20w = 25}; + +/* HP PA-RISC relocation types */ + +enum hppa_reloc_field_selector_type + { + R_HPPA_FSEL = 0x0, + R_HPPA_LSSEL = 0x1, + R_HPPA_RSSEL = 0x2, + R_HPPA_LSEL = 0x3, + R_HPPA_RSEL = 0x4, + R_HPPA_LDSEL = 0x5, + R_HPPA_RDSEL = 0x6, + R_HPPA_LRSEL = 0x7, + R_HPPA_RRSEL = 0x8, + R_HPPA_NSEL = 0x9, + R_HPPA_NLSEL = 0xa, + R_HPPA_NLRSEL = 0xb, + R_HPPA_PSEL = 0xc, + R_HPPA_LPSEL = 0xd, + R_HPPA_RPSEL = 0xe, + R_HPPA_TSEL = 0xf, + R_HPPA_LTSEL = 0x10, + R_HPPA_RTSEL = 0x11, + R_HPPA_LTPSEL = 0x12, + R_HPPA_RTPSEL = 0x13 + }; + +/* /usr/include/reloc.h defines these to constants. We want to use + them in enums, so #undef them before we start using them. We might + be able to fix this another way by simply managing not to include + /usr/include/reloc.h, but currently GDB picks up these defines + somewhere. */ +#undef e_fsel +#undef e_lssel +#undef e_rssel +#undef e_lsel +#undef e_rsel +#undef e_ldsel +#undef e_rdsel +#undef e_lrsel +#undef e_rrsel +#undef e_nsel +#undef e_nlsel +#undef e_nlrsel +#undef e_psel +#undef e_lpsel +#undef e_rpsel +#undef e_tsel +#undef e_ltsel +#undef e_rtsel +#undef e_one +#undef e_two +#undef e_pcrel +#undef e_con +#undef e_plabel +#undef e_abs + +/* for compatibility */ +enum hppa_reloc_field_selector_type_alt + { + e_fsel = R_HPPA_FSEL, + e_lssel = R_HPPA_LSSEL, + e_rssel = R_HPPA_RSSEL, + e_lsel = R_HPPA_LSEL, + e_rsel = R_HPPA_RSEL, + e_ldsel = R_HPPA_LDSEL, + e_rdsel = R_HPPA_RDSEL, + e_lrsel = R_HPPA_LRSEL, + e_rrsel = R_HPPA_RRSEL, + e_nsel = R_HPPA_NSEL, + e_nlsel = R_HPPA_NLSEL, + e_nlrsel = R_HPPA_NLRSEL, + e_psel = R_HPPA_PSEL, + e_lpsel = R_HPPA_LPSEL, + e_rpsel = R_HPPA_RPSEL, + e_tsel = R_HPPA_TSEL, + e_ltsel = R_HPPA_LTSEL, + e_rtsel = R_HPPA_RTSEL, + e_ltpsel = R_HPPA_LTPSEL, + e_rtpsel = R_HPPA_RTPSEL + }; + +enum hppa_reloc_expr_type + { + R_HPPA_E_ONE = 0, + R_HPPA_E_TWO = 1, + R_HPPA_E_PCREL = 2, + R_HPPA_E_CON = 3, + R_HPPA_E_PLABEL = 7, + R_HPPA_E_ABS = 18 + }; + +/* for compatibility */ +enum hppa_reloc_expr_type_alt + { + e_one = R_HPPA_E_ONE, + e_two = R_HPPA_E_TWO, + e_pcrel = R_HPPA_E_PCREL, + e_con = R_HPPA_E_CON, + e_plabel = R_HPPA_E_PLABEL, + e_abs = R_HPPA_E_ABS + }; + + +/* Relocations for function calls must be accompanied by parameter + relocation bits. These bits describe exactly where the caller has + placed the function's arguments and where it expects to find a return + value. + + Both ELF and SOM encode this information within the addend field + of the call relocation. (Note this could break very badly if one + was to make a call like bl foo + 0x12345678). + + The high order 10 bits contain parameter relocation information, + the low order 22 bits contain the constant offset. */ + +#define HPPA_R_ARG_RELOC(a) \ + (((a) >> 22) & 0x3ff) +#define HPPA_R_CONSTANT(a) \ + ((((bfd_signed_vma)(a)) << (BFD_ARCH_SIZE-22)) >> (BFD_ARCH_SIZE-22)) +#define HPPA_R_ADDEND(r, c) \ + (((r) << 22) + ((c) & 0x3fffff)) + + +/* Some functions to manipulate PA instructions. */ + +/* Declare the functions with the unused attribute to avoid warnings. */ +static inline int sign_extend (int, int) ATTRIBUTE_UNUSED; +static inline int low_sign_extend (int, int) ATTRIBUTE_UNUSED; +static inline int sign_unext (int, int) ATTRIBUTE_UNUSED; +static inline int low_sign_unext (int, int) ATTRIBUTE_UNUSED; +static inline int re_assemble_3 (int) ATTRIBUTE_UNUSED; +static inline int re_assemble_12 (int) ATTRIBUTE_UNUSED; +static inline int re_assemble_14 (int) ATTRIBUTE_UNUSED; +static inline int re_assemble_16 (int) ATTRIBUTE_UNUSED; +static inline int re_assemble_17 (int) ATTRIBUTE_UNUSED; +static inline int re_assemble_21 (int) ATTRIBUTE_UNUSED; +static inline int re_assemble_22 (int) ATTRIBUTE_UNUSED; +static inline bfd_signed_vma hppa_field_adjust + (bfd_vma, bfd_signed_vma, enum hppa_reloc_field_selector_type_alt) + ATTRIBUTE_UNUSED; +static inline int bfd_hppa_insn2fmt (bfd *, int) ATTRIBUTE_UNUSED; +static inline int hppa_rebuild_insn (int, int, int) ATTRIBUTE_UNUSED; + + +/* The *sign_extend functions are used to assemble various bitfields + taken from an instruction and return the resulting immediate + value. */ + +static inline int +sign_extend (int x, int len) +{ + int signbit = (1 << (len - 1)); + int mask = (signbit << 1) - 1; + return ((x & mask) ^ signbit) - signbit; +} + +static inline int +low_sign_extend (int x, int len) +{ + return (x >> 1) - ((x & 1) << (len - 1)); +} + + +/* The re_assemble_* functions prepare an immediate value for + insertion into an opcode. pa-risc uses all sorts of weird bitfields + in the instruction to hold the value. */ + +static inline int +sign_unext (int x, int len) +{ + int len_ones; + + len_ones = (1 << len) - 1; + + return x & len_ones; +} + +static inline int +low_sign_unext (int x, int len) +{ + int temp; + int sign; + + sign = (x >> (len-1)) & 1; + + temp = sign_unext (x, len-1); + + return (temp << 1) | sign; +} + +static inline int +re_assemble_3 (int as3) +{ + return (( (as3 & 4) << (13-2)) + | ((as3 & 3) << (13+1))); +} + +static inline int +re_assemble_12 (int as12) +{ + return (( (as12 & 0x800) >> 11) + | ((as12 & 0x400) >> (10 - 2)) + | ((as12 & 0x3ff) << (1 + 2))); +} + +static inline int +re_assemble_14 (int as14) +{ + return (( (as14 & 0x1fff) << 1) + | ((as14 & 0x2000) >> 13)); +} + +static inline int +re_assemble_16 (int as16) +{ + int s, t; + + /* Unusual 16-bit encoding, for wide mode only. */ + t = (as16 << 1) & 0xffff; + s = (as16 & 0x8000); + return (t ^ s ^ (s >> 1)) | (s >> 15); +} + +static inline int +re_assemble_17 (int as17) +{ + return (( (as17 & 0x10000) >> 16) + | ((as17 & 0x0f800) << (16 - 11)) + | ((as17 & 0x00400) >> (10 - 2)) + | ((as17 & 0x003ff) << (1 + 2))); +} + +static inline int +re_assemble_21 (int as21) +{ + return (( (as21 & 0x100000) >> 20) + | ((as21 & 0x0ffe00) >> 8) + | ((as21 & 0x000180) << 7) + | ((as21 & 0x00007c) << 14) + | ((as21 & 0x000003) << 12)); +} + +static inline int +re_assemble_22 (int as22) +{ + return (( (as22 & 0x200000) >> 21) + | ((as22 & 0x1f0000) << (21 - 16)) + | ((as22 & 0x00f800) << (16 - 11)) + | ((as22 & 0x000400) >> (10 - 2)) + | ((as22 & 0x0003ff) << (1 + 2))); +} + + +/* Handle field selectors for PA instructions. + The L and R (and LS, RS etc.) selectors are used in pairs to form a + full 32 bit address. eg. + + LDIL L'start,%r1 ; put left part into r1 + LDW R'start(%r1),%r2 ; add r1 and right part to form address + + This function returns sign extended values in all cases. +*/ + +static inline bfd_signed_vma +hppa_field_adjust (bfd_vma sym_val, + bfd_signed_vma addend, + enum hppa_reloc_field_selector_type_alt r_field) +{ + bfd_signed_vma value; + + value = sym_val + addend; + switch (r_field) + { + case e_fsel: + /* F: No change. */ + break; + + case e_nsel: + /* N: null selector. I don't really understand what this is all + about, but HP's documentation says "this indicates that zero + bits are to be used for the displacement on the instruction. + This fixup is used to identify three-instruction sequences to + access data (for importing shared library data)." */ + value = 0; + break; + + case e_lsel: + case e_nlsel: + /* L: Select top 21 bits. */ + value = value >> 11; + break; + + case e_rsel: + /* R: Select bottom 11 bits. */ + value = value & 0x7ff; + break; + + case e_lssel: + /* LS: Round to nearest multiple of 2048 then select top 21 bits. */ + value = value + 0x400; + value = value >> 11; + break; + + case e_rssel: + /* RS: Select bottom 11 bits for LS. + We need to return a value such that 2048 * LS'x + RS'x == x. + ie. RS'x = x - ((x + 0x400) & -0x800) + this is just a sign extension from bit 21. */ + value = ((value & 0x7ff) ^ 0x400) - 0x400; + break; + + case e_ldsel: + /* LD: Round to next multiple of 2048 then select top 21 bits. + Yes, if we are already on a multiple of 2048, we go up to the + next one. RD in this case will be -2048. */ + value = value + 0x800; + value = value >> 11; + break; + + case e_rdsel: + /* RD: Set bits 0-20 to one. */ + value = value | -0x800; + break; + + case e_lrsel: + case e_nlrsel: + /* LR: L with rounding of the addend to nearest 8k. */ + value = sym_val + ((addend + 0x1000) & -0x2000); + value = value >> 11; + break; + + case e_rrsel: + /* RR: R with rounding of the addend to nearest 8k. + We need to return a value such that 2048 * LR'x + RR'x == x + ie. RR'x = s+a - (s + (((a + 0x1000) & -0x2000) & -0x800)) + . = s+a - ((s & -0x800) + ((a + 0x1000) & -0x2000)) + . = (s & 0x7ff) + a - ((a + 0x1000) & -0x2000) */ + value = (sym_val & 0x7ff) + (((addend & 0x1fff) ^ 0x1000) - 0x1000); + break; + + default: + abort (); + } + return value; +} + +/* PA-RISC OPCODES */ +#define get_opcode(insn) (((insn) >> 26) & 0x3f) + +enum hppa_opcode_type +{ + /* None of the opcodes in the first group generate relocs, so we + aren't too concerned about them. */ + OP_SYSOP = 0x00, + OP_MEMMNG = 0x01, + OP_ALU = 0x02, + OP_NDXMEM = 0x03, + OP_SPOP = 0x04, + OP_DIAG = 0x05, + OP_FMPYADD = 0x06, + OP_UNDEF07 = 0x07, + OP_COPRW = 0x09, + OP_COPRDW = 0x0b, + OP_COPR = 0x0c, + OP_FLOAT = 0x0e, + OP_PRDSPEC = 0x0f, + OP_UNDEF15 = 0x15, + OP_UNDEF1d = 0x1d, + OP_FMPYSUB = 0x26, + OP_FPFUSED = 0x2e, + OP_SHEXDP0 = 0x34, + OP_SHEXDP1 = 0x35, + OP_SHEXDP2 = 0x36, + OP_UNDEF37 = 0x37, + OP_SHEXDP3 = 0x3c, + OP_SHEXDP4 = 0x3d, + OP_MULTMED = 0x3e, + OP_UNDEF3f = 0x3f, + + OP_LDIL = 0x08, + OP_ADDIL = 0x0a, + + OP_LDO = 0x0d, + OP_LDB = 0x10, + OP_LDH = 0x11, + OP_LDW = 0x12, + OP_LDWM = 0x13, + OP_STB = 0x18, + OP_STH = 0x19, + OP_STW = 0x1a, + OP_STWM = 0x1b, + + OP_LDD = 0x14, + OP_STD = 0x1c, + + OP_FLDW = 0x16, + OP_LDWL = 0x17, + OP_FSTW = 0x1e, + OP_STWL = 0x1f, + + OP_COMBT = 0x20, + OP_COMIBT = 0x21, + OP_COMBF = 0x22, + OP_COMIBF = 0x23, + OP_CMPBDT = 0x27, + OP_ADDBT = 0x28, + OP_ADDIBT = 0x29, + OP_ADDBF = 0x2a, + OP_ADDIBF = 0x2b, + OP_CMPBDF = 0x2f, + OP_BVB = 0x30, + OP_BB = 0x31, + OP_MOVB = 0x32, + OP_MOVIB = 0x33, + OP_CMPIBD = 0x3b, + + OP_COMICLR = 0x24, + OP_SUBI = 0x25, + OP_ADDIT = 0x2c, + OP_ADDI = 0x2d, + + OP_BE = 0x38, + OP_BLE = 0x39, + OP_BL = 0x3a +}; + + +/* Given a machine instruction, return its format. */ + +static inline int +bfd_hppa_insn2fmt (bfd *abfd, int insn) +{ + enum hppa_opcode_type op = get_opcode (insn); + + switch (op) + { + case OP_COMICLR: + case OP_SUBI: + case OP_ADDIT: + case OP_ADDI: + return 11; + + case OP_COMBT: + case OP_COMIBT: + case OP_COMBF: + case OP_COMIBF: + case OP_CMPBDT: + case OP_ADDBT: + case OP_ADDIBT: + case OP_ADDBF: + case OP_ADDIBF: + case OP_CMPBDF: + case OP_BVB: + case OP_BB: + case OP_MOVB: + case OP_MOVIB: + case OP_CMPIBD: + return 12; + + case OP_LDO: + case OP_LDB: + case OP_LDH: + case OP_LDW: + case OP_LDWM: + case OP_STB: + case OP_STH: + case OP_STW: + case OP_STWM: + if (abfd->arch_info->mach >= 25) + return 16; /* Wide mode, format 16. */ + return 14; + + case OP_FLDW: + case OP_LDWL: + case OP_FSTW: + case OP_STWL: + /* This is a hack. Unfortunately, format 11 is already taken + and we're using integers rather than an enum, so it's hard + to describe the 11a format. */ + if (abfd->arch_info->mach >= 25) + return -16; /* Wide mode, format 16a. */ + return -11; + + case OP_LDD: + case OP_STD: + if (abfd->arch_info->mach >= 25) + return -10; /* Wide mode, format 10a. */ + return 10; + + case OP_BL: + if ((insn & 0x8000) != 0) + return 22; + /* fall thru */ + case OP_BE: + case OP_BLE: + return 17; + + case OP_LDIL: + case OP_ADDIL: + return 21; + + default: + break; + } + return 32; +} + + +/* Insert VALUE into INSN using R_FORMAT to determine exactly what + bits to change. */ + +static inline int +hppa_rebuild_insn (int insn, int value, int r_format) +{ + switch (r_format) + { + case 11: + return (insn & ~ 0x7ff) | low_sign_unext (value, 11); + + case 12: + return (insn & ~ 0x1ffd) | re_assemble_12 (value); + + + case 10: + return (insn & ~ 0x3ff1) | re_assemble_14 (value & -8); + + case -11: + return (insn & ~ 0x3ff9) | re_assemble_14 (value & -4); + + case 14: + return (insn & ~ 0x3fff) | re_assemble_14 (value); + + + case -10: + return (insn & ~ 0xfff1) | re_assemble_16 (value & -8); + + case -16: + return (insn & ~ 0xfff9) | re_assemble_16 (value & -4); + + case 16: + return (insn & ~ 0xffff) | re_assemble_16 (value); + + + case 17: + return (insn & ~ 0x1f1ffd) | re_assemble_17 (value); + + case 21: + return (insn & ~ 0x1fffff) | re_assemble_21 (value); + + case 22: + return (insn & ~ 0x3ff1ffd) | re_assemble_22 (value); + + case 32: + return value; + + default: + abort (); + } + return insn; +} + +#endif /* _LIBHPPA_H */ diff --git a/bfd/libnlm.h b/bfd/libnlm.h new file mode 100644 index 0000000000000..0a7b4d962c914 --- /dev/null +++ b/bfd/libnlm.h @@ -0,0 +1,263 @@ +/* BFD back-end data structures for NLM (NetWare Loadable Modules) files. + Copyright 1993, 1994, 2001, 2002, 2003 Free Software Foundation, Inc. + Written by Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#ifndef _LIBNLM_H_ +#define _LIBNLM_H_ 1 + +#ifdef ARCH_SIZE +# define NLM_ARCH_SIZE ARCH_SIZE +#endif +#include "nlm/common.h" +#include "nlm/internal.h" +#include "nlm/external.h" + +/* A reloc for an imported NLM symbol. Normal relocs are associated + with sections, and include a symbol. These relocs are associated + with (undefined) symbols, and include a section. */ + +struct nlm_relent +{ + /* Section of reloc. */ + asection *section; + /* Reloc info (sym_ptr_ptr field set only when canonicalized). */ + arelent reloc; +}; + +/* Information we keep for an NLM symbol. */ + +typedef struct +{ + /* BFD symbol. */ + asymbol symbol; + /* Number of reloc entries for imported symbol. */ + bfd_size_type rcnt; + /* Array of reloc information for imported symbol. */ + struct nlm_relent *relocs; +} nlmNAME(symbol_type); + +extern bfd_boolean nlm_mkobject + PARAMS ((bfd *)); +extern bfd_boolean nlm_set_arch_mach + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); + +extern void nlmNAME(get_symbol_info) + PARAMS ((bfd *, asymbol *, symbol_info *)); +extern long nlmNAME(get_symtab_upper_bound) + PARAMS ((bfd *)); +extern long nlmNAME(canonicalize_symtab) + PARAMS ((bfd *, asymbol **)); +extern asymbol *nlmNAME(make_empty_symbol) + PARAMS ((bfd *)); +extern void nlmNAME(print_symbol) + PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); +extern long nlmNAME(get_reloc_upper_bound) + PARAMS ((bfd *, asection *)); +extern long nlmNAME(canonicalize_reloc) + PARAMS ((bfd *, asection *, arelent **, asymbol **)); +extern const bfd_target *nlmNAME(object_p) + PARAMS ((bfd *)); +extern bfd_boolean nlmNAME(set_arch_mach) + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +extern bfd_boolean nlmNAME(set_section_contents) + PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); +extern bfd_boolean nlmNAME(write_object_contents) + PARAMS ((bfd *)); + +/* Some private data is stashed away for future use using the tdata pointer + in the bfd structure. */ + +struct nlm_obj_tdata +{ + /* Actual data, but ref like ptr */ + Nlm_Internal_Fixed_Header nlm_fixed_hdr[1]; + Nlm_Internal_Variable_Header nlm_variable_hdr[1]; + Nlm_Internal_Version_Header nlm_version_hdr[1]; + Nlm_Internal_Copyright_Header nlm_copyright_hdr[1]; + Nlm_Internal_Extended_Header nlm_extended_hdr[1]; + Nlm_Internal_Custom_Header nlm_custom_hdr[1]; + Nlm_Internal_Cygnus_Ext_Header nlm_cygnus_ext_hdr[1]; + /* BFD NLM symbols. */ + nlmNAME(symbol_type) *nlm_symbols; + /* Lowest text and data VMA values. */ + bfd_vma nlm_text_low; + bfd_vma nlm_data_low; + /* Caches for data read from object file. */ + arelent * nlm_reloc_fixups; + asection ** nlm_reloc_fixup_secs; + /* Backend specific information. This should probably be a pointer, + but that would require yet another entry point to initialize the + structure. */ + union + { + struct /* Alpha backend information. */ + { + bfd_vma gp; /* GP value. */ + bfd_vma lita_address; /* .lita section address. */ + bfd_size_type lita_size; /* .lita section size. */ + } + alpha_backend_data; + } + backend_data; +}; + +#define nlm_tdata(bfd) ((bfd) -> tdata.nlm_obj_data) +#define nlm_fixed_header(bfd) (nlm_tdata(bfd) -> nlm_fixed_hdr) +#define nlm_variable_header(bfd) (nlm_tdata(bfd) -> nlm_variable_hdr) +#define nlm_version_header(bfd) (nlm_tdata(bfd) -> nlm_version_hdr) +#define nlm_copyright_header(bfd) (nlm_tdata(bfd) -> nlm_copyright_hdr) +#define nlm_extended_header(bfd) (nlm_tdata(bfd) -> nlm_extended_hdr) +#define nlm_custom_header(bfd) (nlm_tdata(bfd) -> nlm_custom_hdr) +#define nlm_cygnus_ext_header(bfd) (nlm_tdata(bfd) -> nlm_cygnus_ext_hdr) +#define nlm_get_symbols(bfd) (nlm_tdata(bfd) -> nlm_symbols) +#define nlm_set_symbols(bfd, p) (nlm_tdata(bfd) -> nlm_symbols = (p)) +#define nlm_set_text_low(bfd, i) (nlm_tdata(bfd) -> nlm_text_low = (i)) +#define nlm_get_text_low(bfd) (nlm_tdata(bfd) -> nlm_text_low) +#define nlm_set_data_low(bfd, i) (nlm_tdata(bfd) -> nlm_data_low = (i)) +#define nlm_get_data_low(bfd) (nlm_tdata(bfd) -> nlm_data_low) +#define nlm_relocation_fixups(bfd) (nlm_tdata(bfd) -> nlm_reloc_fixups) +#define nlm_relocation_fixup_secs(bfd) (nlm_tdata(bfd)->nlm_reloc_fixup_secs) + +#define nlm_alpha_backend_data(bfd) \ + (&nlm_tdata (bfd)->backend_data.alpha_backend_data) + +/* This is used when writing out the external relocs. */ + +struct reloc_and_sec +{ + arelent *rel; + asection *sec; +}; + +/* We store some function pointer in the backend structure. This lets + different NLM targets share most of the same code, while providing + slightly different code where necessary. */ + +struct nlm_backend_data +{ + /* Signature for this backend. */ + char signature[NLM_SIGNATURE_SIZE]; + /* Size of the fixed header. */ + bfd_size_type fixed_header_size; + /* Size of optional prefix for this backend. Some backend may + require this to be a function, but so far a constant is OK. This + is for a prefix which precedes the standard NLM fixed header. */ + bfd_size_type optional_prefix_size; + /* Architecture. */ + enum bfd_architecture arch; + /* Machine. */ + unsigned int mach; + /* Some NLM formats do not use the uninitialized data section, so + all uninitialized data must be put into the regular data section + instead. */ + bfd_boolean no_uninitialized_data; + /* Some NLM formats have a prefix on the file. If this function is + not NULL, it will be called by nlm_object_p. It should return + TRUE if this file could match this format, and it should leave + the BFD such that a bfd_bread will pick up the fixed header. */ + bfd_boolean (*nlm_backend_object_p) PARAMS ((bfd *)); + /* Write out the prefix. This function may be NULL. This must + write out the same number of bytes as is in the field + optional_prefix_size. */ + bfd_boolean (*nlm_write_prefix) PARAMS ((bfd *)); + /* Read a relocation fixup from abfd. The reloc information is + machine specific. The second argument is the symbol if this is + an import, or NULL if this is a reloc fixup. This function + should set the third argument to the section which the reloc + belongs in, and the fourth argument to the reloc itself; it does + not need to fill in the sym_ptr_ptr field for a reloc against an + import symbol. */ + bfd_boolean (*nlm_read_reloc) + PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *)); + /* To make objcopy to an i386 NLM work, the i386 backend needs a + chance to work over the relocs. This is a bit icky. */ + bfd_boolean (*nlm_mangle_relocs) + PARAMS ((bfd *, asection *, const PTR data, bfd_vma offset, + bfd_size_type count)); + /* Read an import record from abfd. It would be nice if this + were in a machine-dependent format, but it doesn't seem to be. */ + bfd_boolean (*nlm_read_import) PARAMS ((bfd *, nlmNAME(symbol_type) *)); + /* Write an import record to abfd. */ + bfd_boolean (*nlm_write_import) PARAMS ((bfd *, asection *, arelent *)); + /* Set the section for a public symbol. This may be NULL, in which + case a default method will be used. */ + bfd_boolean (*nlm_set_public_section) + PARAMS ((bfd *, nlmNAME(symbol_type) *)); + /* Get the offset to write out for a public symbol. This may be + NULL, in which case a default method will be used. */ + bfd_vma (*nlm_get_public_offset) PARAMS ((bfd *, asymbol *)); + /* Swap the fixed header in and out */ + void (*nlm_swap_fhdr_in) + PARAMS ((bfd *, PTR, Nlm_Internal_Fixed_Header *)); + void (*nlm_swap_fhdr_out) + PARAMS ((bfd *, struct nlm_internal_fixed_header *, PTR)); + /* Write out an external reference. */ + bfd_boolean (*nlm_write_external) + PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *)); + bfd_boolean (*nlm_write_export) PARAMS ((bfd *, asymbol *, bfd_vma)); +}; + +#define nlm_backend(bfd) \ + ((struct nlm_backend_data *)((bfd) -> xvec -> backend_data)) +#define nlm_signature(bfd) \ + (nlm_backend(bfd) -> signature) +#define nlm_fixed_header_size(bfd) \ + (nlm_backend(bfd) -> fixed_header_size) +#define nlm_optional_prefix_size(bfd) \ + (nlm_backend(bfd) -> optional_prefix_size) +#define nlm_architecture(bfd) \ + (nlm_backend(bfd) -> arch) +#define nlm_machine(bfd) \ + (nlm_backend(bfd) -> mach) +#define nlm_no_uninitialized_data(bfd) \ + (nlm_backend(bfd) -> no_uninitialized_data) +#define nlm_backend_object_p_func(bfd) \ + (nlm_backend(bfd) -> nlm_backend_object_p) +#define nlm_write_prefix_func(bfd) \ + (nlm_backend(bfd) -> nlm_write_prefix) +#define nlm_read_reloc_func(bfd) \ + (nlm_backend(bfd) -> nlm_read_reloc) +#define nlm_mangle_relocs_func(bfd) \ + (nlm_backend(bfd) -> nlm_mangle_relocs) +#define nlm_read_import_func(bfd) \ + (nlm_backend(bfd) -> nlm_read_import) +#define nlm_write_import_func(bfd) \ + (nlm_backend(bfd) -> nlm_write_import) +#define nlm_set_public_section_func(bfd) \ + (nlm_backend(bfd) -> nlm_set_public_section) +#define nlm_get_public_offset_func(bfd) \ + (nlm_backend(bfd) -> nlm_get_public_offset) +#define nlm_swap_fixed_header_in_func(bfd) \ + (nlm_backend(bfd) -> nlm_swap_fhdr_in) +#define nlm_swap_fixed_header_out_func(bfd) \ + (nlm_backend(bfd) -> nlm_swap_fhdr_out) +#define nlm_write_external_func(bfd) \ + (nlm_backend(bfd) -> nlm_write_external) +#define nlm_write_export_func(bfd) \ + (nlm_backend(bfd) -> nlm_write_export) + +/* The NLM code, data, and uninitialized sections have no names defined + in the NLM, but bfd wants to give them names, so use the traditional + UNIX names. */ + +#define NLM_CODE_NAME ".text" +#define NLM_INITIALIZED_DATA_NAME ".data" +#define NLM_UNINITIALIZED_DATA_NAME ".bss" + +#endif /* _LIBNLM_H_ */ diff --git a/bfd/liboasys.h b/bfd/liboasys.h new file mode 100644 index 0000000000000..a91356b37781b --- /dev/null +++ b/bfd/liboasys.h @@ -0,0 +1,83 @@ +/* BFD internal declarations for Oasys file format handling. + Copyright 1990, 1991, 1992, 1993, 1994, 1997, 2002 + Free Software Foundation, Inc. + Scrawled by Steve Chamberlain of Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +typedef struct _oasys_symbol +{ + asymbol symbol; +} oasys_symbol_type; + +typedef struct _oasys_reloc { + arelent relent; + struct _oasys_reloc *next; + unsigned int symbol; +} oasys_reloc_type; + + +#define oasys_symbol(x) ((oasys_symbol_type *)(x)) +#define oasys_per_section(x) ((oasys_per_section_type *)(x->used_by_bfd)) + +typedef struct _oasys_per_section +{ + asection *section; + bfd_byte *data; + bfd_vma offset; + bfd_boolean had_vma; + oasys_reloc_type **reloc_tail_ptr; + bfd_vma pc; + + + file_ptr current_pos; + unsigned int current_byte; + bfd_boolean initialized; +} oasys_per_section_type; + +#define NSECTIONS 10 + +typedef struct _oasys_ar_obstack { + file_ptr file_offset; + bfd *abfd; +} oasys_ar_obstack_type; + + +typedef struct _oasys_module_info { + file_ptr pos; + unsigned int size; + bfd *abfd; + char *name; +} oasys_module_info_type; + +typedef struct _oasys_ar_data { + oasys_module_info_type *module; + unsigned int module_count; + unsigned int module_index; +} oasys_ar_data_type; + +typedef struct _oasys_data { + char *strings; + asymbol *symbols; + unsigned int symbol_string_length; + asection *sections[OASYS_MAX_SEC_COUNT]; + file_ptr first_data_record; +} oasys_data_type; + +#define OASYS_DATA(abfd) ((abfd)->tdata.oasys_obj_data) +#define OASYS_AR_DATA(abfd) ((abfd)->tdata.oasys_ar_data) + diff --git a/bfd/lynx-core.c b/bfd/lynx-core.c new file mode 100644 index 0000000000000..08bf2331c5364 --- /dev/null +++ b/bfd/lynx-core.c @@ -0,0 +1,234 @@ +/* BFD back end for Lynx core files + Copyright 1993, 1994, 1995, 2001, 2002 Free Software Foundation, Inc. + Written by Stu Grossman of Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#ifdef LYNX_CORE + +#include +#include +/* sys/kernel.h should define this, but doesn't always, sigh. */ +#ifndef __LYNXOS +#define __LYNXOS +#endif +#include +#include +#include +#include +#include +#include +#include + +/* These are stored in the bfd's tdata */ + +struct lynx_core_struct +{ + int sig; + char cmd[PNMLEN + 1]; +}; + +#define core_hdr(bfd) ((bfd)->tdata.lynx_core_data) +#define core_signal(bfd) (core_hdr(bfd)->sig) +#define core_command(bfd) (core_hdr(bfd)->cmd) + +/* Handle Lynx core dump file. */ + +static asection * +make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) + bfd *abfd; + const char *name; + flagword flags; + bfd_size_type _raw_size; + bfd_vma vma; + file_ptr filepos; +{ + asection *asect; + char *newname; + + newname = bfd_alloc (abfd, (bfd_size_type) strlen (name) + 1); + if (!newname) + return NULL; + + strcpy (newname, name); + + asect = bfd_make_section (abfd, newname); + if (!asect) + return NULL; + + asect->flags = flags; + asect->_raw_size = _raw_size; + asect->vma = vma; + asect->filepos = filepos; + asect->alignment_power = 2; + + return asect; +} + +const bfd_target * +lynx_core_file_p (abfd) + bfd *abfd; +{ + int secnum; + struct pssentry pss; + bfd_size_type tcontext_size; + core_st_t *threadp; + int pagesize; + asection *newsect; + bfd_size_type amt; + + pagesize = getpagesize (); /* Serious cross-target issue here... This + really needs to come from a system-specific + header file. */ + + /* Get the pss entry from the core file */ + + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + return NULL; + + amt = sizeof pss; + if (bfd_bread ((void *) &pss, amt, abfd) != amt) + { + /* Too small to be a core file */ + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + amt = sizeof (struct lynx_core_struct); + core_hdr (abfd) = (struct lynx_core_struct *) bfd_zalloc (abfd, amt); + + if (!core_hdr (abfd)) + return NULL; + + strncpy (core_command (abfd), pss.pname, PNMLEN + 1); + + /* Compute the size of the thread contexts */ + + tcontext_size = pss.threadcnt * sizeof (core_st_t); + + /* Allocate space for the thread contexts */ + + threadp = (core_st_t *) bfd_alloc (abfd, tcontext_size); + if (!threadp) + goto fail; + + /* Save thread contexts */ + + if (bfd_seek (abfd, (file_ptr) pagesize, SEEK_SET) != 0) + goto fail; + + if (bfd_bread ((void *) threadp, tcontext_size, abfd) != tcontext_size) + { + /* Probably too small to be a core file */ + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + goto fail; + } + + core_signal (abfd) = threadp->currsig; + + newsect = make_bfd_asection (abfd, ".stack", + SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS, + pss.ssize, + pss.slimit, + pagesize + tcontext_size); + if (!newsect) + goto fail; + + newsect = make_bfd_asection (abfd, ".data", + SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS, + pss.data_len + pss.bss_len, + pss.data_start, + pagesize + tcontext_size + pss.ssize +#if defined (SPARC) || defined (__SPARC__) + /* SPARC Lynx seems to start dumping + the .data section at a page + boundary. It's OK to check a + #define like SPARC here because this + file can only be compiled on a Lynx + host. */ + + pss.data_start % pagesize +#endif + ); + if (!newsect) + goto fail; + +/* And, now for the .reg/XXX pseudo sections. Each thread has it's own + .reg/XXX section, where XXX is the thread id (without leading zeros). The + currently running thread (at the time of the core dump) also has an alias + called `.reg' (just to keep GDB happy). Note that we use `.reg/XXX' as + opposed to `.regXXX' because GDB expects that .reg2 will be the floating- + point registers. */ + + newsect = make_bfd_asection (abfd, ".reg", + SEC_HAS_CONTENTS, + sizeof (core_st_t), + 0, + pagesize); + if (!newsect) + goto fail; + + for (secnum = 0; secnum < pss.threadcnt; secnum++) + { + char secname[100]; + + sprintf (secname, ".reg/%d", BUILDPID (0, threadp[secnum].tid)); + newsect = make_bfd_asection (abfd, secname, + SEC_HAS_CONTENTS, + sizeof (core_st_t), + 0, + pagesize + secnum * sizeof (core_st_t)); + if (!newsect) + goto fail; + } + + return abfd->xvec; + + fail: + bfd_release (abfd, core_hdr (abfd)); + core_hdr (abfd) = NULL; + bfd_section_list_clear (abfd); + return NULL; +} + +char * +lynx_core_file_failing_command (abfd) + bfd *abfd; +{ + return core_command (abfd); +} + +int +lynx_core_file_failing_signal (abfd) + bfd *abfd; +{ + return core_signal (abfd); +} + +bfd_boolean +lynx_core_file_matches_executable_p (core_bfd, exec_bfd) + bfd *core_bfd, *exec_bfd; +{ + return TRUE; /* FIXME, We have no way of telling at this point */ +} + +#endif /* LYNX_CORE */ diff --git a/bfd/m68k4knetbsd.c b/bfd/m68k4knetbsd.c new file mode 100644 index 0000000000000..1ca4a626999e6 --- /dev/null +++ b/bfd/m68k4knetbsd.c @@ -0,0 +1,36 @@ +/* BFD back-end for NetBSD/m68k a.out-ish binaries. + Copyright 1990, 1991, 1992, 1995, 1998, 2001, 2003 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define TARGET_IS_BIG_ENDIAN_P + +#define TARGET_PAGE_SIZE 0x1000 + +#define DEFAULT_ARCH bfd_arch_m68k +#define DEFAULT_MID M_68K4K_NETBSD + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (m68k4knetbsd_,OP) + +/* This needs to start with a.out so GDB knows it is an a.out variant. */ +#define TARGETNAME "a.out-m68k4k-netbsd" + +#include "netbsd.h" diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c new file mode 100644 index 0000000000000..996e5161424bb --- /dev/null +++ b/bfd/m68klinux.c @@ -0,0 +1,781 @@ +/* BFD back-end for linux flavored m68k a.out binaries. + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define TARGET_PAGE_SIZE 4096 +#define ZMAGIC_DISK_BLOCK_SIZE 1024 +#define SEGMENT_SIZE TARGET_PAGE_SIZE +#define TEXT_START_ADDR 0x0 +#define N_SHARED_LIB(x) 0 + +#define MACHTYPE_OK(mtype) ((mtype) == M_68020 || (mtype) == M_UNKNOWN) + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "aout/aout64.h" +#include "aout/stab_gnu.h" +#include "aout/ar.h" +#include "libaout.h" /* BFD a.out internal data structures */ + +#define TARGET_IS_BIG_ENDIAN_P +#define DEFAULT_ARCH bfd_arch_m68k + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (m68klinux_,OP) +#define TARGETNAME "a.out-m68k-linux" + +extern const bfd_target MY(vec); + +/* We always generate QMAGIC files in preference to ZMAGIC files. It + would be possible to make this a linker option, if that ever + becomes important. */ + +static void MY_final_link_callback + PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *)); +static bfd_boolean m68klinux_bfd_final_link + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean m68klinux_write_object_contents PARAMS ((bfd *)); + +static bfd_boolean +m68klinux_bfd_final_link (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + obj_aout_subformat (abfd) = q_magic_format; + return NAME(aout,final_link) (abfd, info, MY_final_link_callback); +} + +#define MY_bfd_final_link m68klinux_bfd_final_link + +/* Set the machine type correctly. */ + +static bfd_boolean +m68klinux_write_object_contents (abfd) + bfd *abfd; +{ + struct external_exec exec_bytes; + struct internal_exec *execp = exec_hdr (abfd); + + N_SET_MACHTYPE (*execp, M_68020); + + obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; + + WRITE_HEADERS(abfd, execp); + + return TRUE; +} + +#define MY_write_object_contents m68klinux_write_object_contents + +/* Code to link against Linux a.out shared libraries. */ + +/* See if a symbol name is a reference to the global offset table. */ + +#ifndef GOT_REF_PREFIX +#define GOT_REF_PREFIX "__GOT_" +#endif + +#define IS_GOT_SYM(name) \ + (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0) + +/* See if a symbol name is a reference to the procedure linkage table. */ + +#ifndef PLT_REF_PREFIX +#define PLT_REF_PREFIX "__PLT_" +#endif + +#define IS_PLT_SYM(name) \ + (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0) + +/* This string is used to generate specialized error messages. */ + +#ifndef NEEDS_SHRLIB +#define NEEDS_SHRLIB "__NEEDS_SHRLIB_" +#endif + +/* This special symbol is a set vector that contains a list of + pointers to fixup tables. It will be present in any dynamically + linked file. The linker generated fixup table should also be added + to the list, and it should always appear in the second slot (the + first one is a dummy with a magic number that is defined in + crt0.o). */ + +#ifndef SHARABLE_CONFLICTS +#define SHARABLE_CONFLICTS "__SHARABLE_CONFLICTS__" +#endif + +/* We keep a list of fixups. The terminology is a bit strange, but + each fixup contains two 32 bit numbers. A regular fixup contains + an address and a pointer, and at runtime we should store the + address at the location pointed to by the pointer. A builtin fixup + contains two pointers, and we should read the address using one + pointer and store it at the location pointed to by the other + pointer. Builtin fixups come into play when we have duplicate + __GOT__ symbols for the same variable. The builtin fixup will copy + the GOT pointer from one over into the other. */ + +struct fixup +{ + struct fixup *next; + struct linux_link_hash_entry *h; + bfd_vma value; + + /* Nonzero if this is a jump instruction that needs to be fixed, + zero if this is just a pointer */ + char jump; + + char builtin; +}; + +/* We don't need a special hash table entry structure, but we do need + to keep some information between linker passes, so we use a special + hash table. */ + +struct linux_link_hash_entry +{ + struct aout_link_hash_entry root; +}; + +struct linux_link_hash_table +{ + struct aout_link_hash_table root; + + /* First dynamic object found in link. */ + bfd *dynobj; + + /* Number of fixups. */ + size_t fixup_count; + + /* Number of builtin fixups. */ + size_t local_builtins; + + /* List of fixups. */ + struct fixup *fixup_list; +}; + +static struct bfd_hash_entry *linux_link_hash_newfunc + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +static struct bfd_link_hash_table *linux_link_hash_table_create + PARAMS ((bfd *)); +static struct fixup *new_fixup + PARAMS ((struct bfd_link_info *, struct linux_link_hash_entry *, + bfd_vma, int)); +static bfd_boolean linux_link_create_dynamic_sections + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean linux_add_one_symbol + PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *, + bfd_vma, const char *, bfd_boolean, bfd_boolean, + struct bfd_link_hash_entry **)); +static bfd_boolean linux_tally_symbols + PARAMS ((struct linux_link_hash_entry *, PTR)); +static bfd_boolean linux_finish_dynamic_link + PARAMS ((bfd *, struct bfd_link_info *)); + +/* Routine to create an entry in an Linux link hash table. */ + +static struct bfd_hash_entry * +linux_link_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct linux_link_hash_entry *ret = (struct linux_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct linux_link_hash_entry *) NULL) + ret = ((struct linux_link_hash_entry *) + bfd_hash_allocate (table, sizeof (struct linux_link_hash_entry))); + if (ret == NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct linux_link_hash_entry *) + NAME(aout,link_hash_newfunc) ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != NULL) + { + /* Set local fields; there aren't any. */ + } + + return (struct bfd_hash_entry *) ret; +} + +/* Create a Linux link hash table. */ + +static struct bfd_link_hash_table * +linux_link_hash_table_create (abfd) + bfd *abfd; +{ + struct linux_link_hash_table *ret; + bfd_size_type amt = sizeof (struct linux_link_hash_table); + + ret = (struct linux_link_hash_table *) bfd_malloc (amt); + if (ret == (struct linux_link_hash_table *) NULL) + { + bfd_set_error (bfd_error_no_memory); + return (struct bfd_link_hash_table *) NULL; + } + if (! NAME(aout,link_hash_table_init) (&ret->root, abfd, + linux_link_hash_newfunc)) + { + free (ret); + return (struct bfd_link_hash_table *) NULL; + } + + ret->dynobj = NULL; + ret->fixup_count = 0; + ret->local_builtins = 0; + ret->fixup_list = NULL; + + return &ret->root.root; +} + +/* Look up an entry in a Linux link hash table. */ + +#define linux_link_hash_lookup(table, string, create, copy, follow) \ + ((struct linux_link_hash_entry *) \ + aout_link_hash_lookup (&(table)->root, (string), (create), (copy),\ + (follow))) + +/* Traverse a Linux link hash table. */ + +#define linux_link_hash_traverse(table, func, info) \ + (aout_link_hash_traverse \ + (&(table)->root, \ + (bfd_boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \ + (info))) + +/* Get the Linux link hash table from the info structure. This is + just a cast. */ + +#define linux_hash_table(p) ((struct linux_link_hash_table *) ((p)->hash)) + +/* Store the information for a new fixup. */ + +static struct fixup * +new_fixup (info, h, value, builtin) + struct bfd_link_info *info; + struct linux_link_hash_entry *h; + bfd_vma value; + int builtin; +{ + struct fixup *f; + + f = (struct fixup *) bfd_hash_allocate (&info->hash->table, + sizeof (struct fixup)); + if (f == NULL) + return f; + f->next = linux_hash_table (info)->fixup_list; + linux_hash_table (info)->fixup_list = f; + f->h = h; + f->value = value; + f->builtin = builtin; + f->jump = 0; + ++linux_hash_table (info)->fixup_count; + return f; +} + +/* We come here once we realize that we are going to link to a shared + library. We need to create a special section that contains the + fixup table, and we ultimately need to add a pointer to this into + the set vector for SHARABLE_CONFLICTS. At this point we do not + know the size of the section, but that's OK - we just need to + create it for now. */ + +static bfd_boolean +linux_link_create_dynamic_sections (abfd, info) + bfd *abfd; + struct bfd_link_info *info ATTRIBUTE_UNUSED; +{ + flagword flags; + register asection *s; + + /* Note that we set the SEC_IN_MEMORY flag. */ + flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY; + + /* We choose to use the name ".linux-dynamic" for the fixup table. + Why not? */ + s = bfd_make_section (abfd, ".linux-dynamic"); + if (s == NULL + || ! bfd_set_section_flags (abfd, s, flags) + || ! bfd_set_section_alignment (abfd, s, 2)) + return FALSE; + s->_raw_size = 0; + s->contents = 0; + + return TRUE; +} + +/* Function to add a single symbol to the linker hash table. This is + a wrapper around _bfd_generic_link_add_one_symbol which handles the + tweaking needed for dynamic linking support. */ + +static bfd_boolean +linux_add_one_symbol (info, abfd, name, flags, section, value, string, + copy, collect, hashp) + struct bfd_link_info *info; + bfd *abfd; + const char *name; + flagword flags; + asection *section; + bfd_vma value; + const char *string; + bfd_boolean copy; + bfd_boolean collect; + struct bfd_link_hash_entry **hashp; +{ + struct linux_link_hash_entry *h; + bfd_boolean insert; + + /* Look up and see if we already have this symbol in the hash table. + If we do, and the defining entry is from a shared library, we + need to create the dynamic sections. + + FIXME: What if abfd->xvec != info->hash->creator? We may want to + be able to link Linux a.out and ELF objects together, but serious + confusion is possible. */ + + insert = FALSE; + + if (! info->relocatable + && linux_hash_table (info)->dynobj == NULL + && strcmp (name, SHARABLE_CONFLICTS) == 0 + && (flags & BSF_CONSTRUCTOR) != 0 + && abfd->xvec == info->hash->creator) + { + if (! linux_link_create_dynamic_sections (abfd, info)) + return FALSE; + linux_hash_table (info)->dynobj = abfd; + insert = TRUE; + } + + if (bfd_is_abs_section (section) + && abfd->xvec == info->hash->creator) + { + h = linux_link_hash_lookup (linux_hash_table (info), name, FALSE, + FALSE, FALSE); + if (h != NULL + && (h->root.root.type == bfd_link_hash_defined + || h->root.root.type == bfd_link_hash_defweak)) + { + struct fixup *f; + + if (hashp != NULL) + *hashp = (struct bfd_link_hash_entry *) h; + + f = new_fixup (info, h, value, ! IS_PLT_SYM (name)); + if (f == NULL) + return FALSE; + f->jump = IS_PLT_SYM (name); + + return TRUE; + } + } + + /* Do the usual procedure for adding a symbol. */ + if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, + value, string, copy, collect, + hashp)) + return FALSE; + + /* Insert a pointer to our table in the set vector. The dynamic + linker requires this information */ + if (insert) + { + asection *s; + + /* Here we do our special thing to add the pointer to the + dynamic section in the SHARABLE_CONFLICTS set vector. */ + s = bfd_get_section_by_name (linux_hash_table (info)->dynobj, + ".linux-dynamic"); + BFD_ASSERT (s != NULL); + + if (! (_bfd_generic_link_add_one_symbol + (info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS, + BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL, + FALSE, FALSE, NULL))) + return FALSE; + } + + return TRUE; +} + +/* We will crawl the hash table and come here for every global symbol. + We will examine each entry and see if there are indications that we + need to add a fixup. There are two possible cases - one is where + you have duplicate definitions of PLT or GOT symbols - these will + have already been caught and added as "builtin" fixups. If we find + that the corresponding non PLT/GOT symbol is also present, we + convert it to a regular fixup instead. + + This function is called via linux_link_hash_traverse. */ + +static bfd_boolean +linux_tally_symbols (h, data) + struct linux_link_hash_entry *h; + PTR data; +{ + struct bfd_link_info *info = (struct bfd_link_info *) data; + struct fixup *f, *f1; + int is_plt; + struct linux_link_hash_entry *h1, *h2; + bfd_boolean exists; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct linux_link_hash_entry *) h->root.root.u.i.link; + + if (h->root.root.type == bfd_link_hash_undefined + && strncmp (h->root.root.root.string, NEEDS_SHRLIB, + sizeof NEEDS_SHRLIB - 1) == 0) + { + const char *name; + char *p; + char *alloc = NULL; + + name = h->root.root.root.string + sizeof NEEDS_SHRLIB - 1; + p = strrchr (name, '_'); + if (p != NULL) + alloc = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 1); + + if (p == NULL || alloc == NULL) + (*_bfd_error_handler) (_("Output file requires shared library `%s'\n"), + name); + else + { + strcpy (alloc, name); + p = strrchr (alloc, '_'); + *p++ = '\0'; + (*_bfd_error_handler) + (_("Output file requires shared library `%s.so.%s'\n"), + alloc, p); + free (alloc); + } + + abort (); + } + + /* If this symbol is not a PLT/GOT, we do not even need to look at it */ + is_plt = IS_PLT_SYM (h->root.root.root.string); + + if (is_plt || IS_GOT_SYM (h->root.root.root.string)) + { + /* Look up this symbol twice. Once just as a regular lookup, + and then again following all of the indirect links until we + reach a real symbol. */ + h1 = linux_link_hash_lookup (linux_hash_table (info), + (h->root.root.root.string + + sizeof PLT_REF_PREFIX - 1), + FALSE, FALSE, TRUE); + /* h2 does not follow indirect symbols. */ + h2 = linux_link_hash_lookup (linux_hash_table (info), + (h->root.root.root.string + + sizeof PLT_REF_PREFIX - 1), + FALSE, FALSE, FALSE); + + /* The real symbol must exist but if it is also an ABS symbol, + there is no need to have a fixup. This is because they both + came from the same library. If on the other hand, we had to + use an indirect symbol to get to the real symbol, we add the + fixup anyway, since there are cases where these symbols come + from different shared libraries */ + if (h1 != NULL + && (((h1->root.root.type == bfd_link_hash_defined + || h1->root.root.type == bfd_link_hash_defweak) + && ! bfd_is_abs_section (h1->root.root.u.def.section)) + || h2->root.root.type == bfd_link_hash_indirect)) + { + /* See if there is a "builtin" fixup already present + involving this symbol. If so, convert it to a regular + fixup. In the end, this relaxes some of the requirements + about the order of performing fixups. */ + exists = FALSE; + for (f1 = linux_hash_table (info)->fixup_list; + f1 != NULL; + f1 = f1->next) + { + if ((f1->h != h && f1->h != h1) + || (! f1->builtin && ! f1->jump)) + continue; + if (f1->h == h1) + exists = TRUE; + if (! exists + && bfd_is_abs_section (h->root.root.u.def.section)) + { + f = new_fixup (info, h1, f1->h->root.root.u.def.value, 0); + f->jump = is_plt; + } + f1->h = h1; + f1->jump = is_plt; + f1->builtin = 0; + exists = TRUE; + } + if (! exists + && bfd_is_abs_section (h->root.root.u.def.section)) + { + f = new_fixup (info, h1, h->root.root.u.def.value, 0); + if (f == NULL) + { + /* FIXME: No way to return error. */ + abort (); + } + f->jump = is_plt; + } + } + + /* Quick and dirty way of stripping these symbols from the + symtab. */ + if (bfd_is_abs_section (h->root.root.u.def.section)) + h->root.written = TRUE; + } + + return TRUE; +} + +/* This is called to set the size of the .linux-dynamic section is. + It is called by the Linux linker emulation before_allocation + routine. We have finished reading all of the input files, and now + we just scan the hash tables to find out how many additional fixups + are required. */ + +bfd_boolean +bfd_m68klinux_size_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + struct fixup *f; + asection *s; + + if (output_bfd->xvec != &MY(vec)) + return TRUE; + + /* First find the fixups... */ + linux_link_hash_traverse (linux_hash_table (info), + linux_tally_symbols, + (PTR) info); + + /* If there are builtin fixups, leave room for a marker. This is + used by the dynamic linker so that it knows that all that follow + are builtin fixups instead of regular fixups. */ + for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next) + { + if (f->builtin) + { + ++linux_hash_table (info)->fixup_count; + ++linux_hash_table (info)->local_builtins; + break; + } + } + + if (linux_hash_table (info)->dynobj == NULL) + { + if (linux_hash_table (info)->fixup_count > 0) + abort (); + return TRUE; + } + + /* Allocate memory for our fixup table. We will fill it in later. */ + s = bfd_get_section_by_name (linux_hash_table (info)->dynobj, + ".linux-dynamic"); + if (s != NULL) + { + s->_raw_size = linux_hash_table (info)->fixup_count + 1; + s->_raw_size *= 8; + s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size); + if (s->contents == NULL) + { + bfd_set_error (bfd_error_no_memory); + return FALSE; + } + } + + return TRUE; +} + +/* We come here once we are ready to actually write the fixup table to + the output file. Scan the fixup tables and so forth and generate + the stuff we need. */ + +static bfd_boolean +linux_finish_dynamic_link (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + asection *s, *os, *is; + bfd_byte *fixup_table; + struct linux_link_hash_entry *h; + struct fixup *f; + unsigned int new_addr; + int section_offset; + unsigned int fixups_written; + + if (linux_hash_table (info)->dynobj == NULL) + return TRUE; + + s = bfd_get_section_by_name (linux_hash_table (info)->dynobj, + ".linux-dynamic"); + BFD_ASSERT (s != NULL); + os = s->output_section; + fixups_written = 0; + +#ifdef LINUX_LINK_DEBUG + printf ("Fixup table file offset: %x VMA: %x\n", + os->filepos + s->output_offset, + os->vma + s->output_offset); +#endif + + fixup_table = s->contents; + bfd_put_32 (output_bfd, (bfd_vma) linux_hash_table (info)->fixup_count, + fixup_table); + fixup_table += 4; + + /* Fill in fixup table. */ + for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next) + { + if (f->builtin) + continue; + + if (f->h->root.root.type != bfd_link_hash_defined + && f->h->root.root.type != bfd_link_hash_defweak) + { + (*_bfd_error_handler) + (_("Symbol %s not defined for fixups\n"), + f->h->root.root.root.string); + continue; + } + + is = f->h->root.root.u.def.section; + section_offset = is->output_section->vma + is->output_offset; + new_addr = f->h->root.root.u.def.value + section_offset; + +#ifdef LINUX_LINK_DEBUG + printf ("Fixup(%d) %s: %x %x\n",f->jump, f->h->root.root.string, + new_addr, f->value); +#endif + + if (f->jump) + { + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); + fixup_table += 4; + bfd_put_32 (output_bfd, f->value + 2, fixup_table); + fixup_table += 4; + } + else + { + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); + fixup_table += 4; + bfd_put_32 (output_bfd, f->value, fixup_table); + fixup_table += 4; + } + ++fixups_written; + } + + if (linux_hash_table (info)->local_builtins != 0) + { + /* Special marker so we know to switch to the other type of fixup */ + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); + fixup_table += 4; + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); + fixup_table += 4; + ++fixups_written; + for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next) + { + if (! f->builtin) + continue; + + if (f->h->root.root.type != bfd_link_hash_defined + && f->h->root.root.type != bfd_link_hash_defweak) + { + (*_bfd_error_handler) + (_("Symbol %s not defined for fixups\n"), + f->h->root.root.root.string); + continue; + } + + is = f->h->root.root.u.def.section; + section_offset = is->output_section->vma + is->output_offset; + new_addr = f->h->root.root.u.def.value + section_offset; + +#ifdef LINUX_LINK_DEBUG + printf ("Fixup(B) %s: %x %x\n", f->h->root.root.string, + new_addr, f->value); +#endif + + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); + fixup_table += 4; + bfd_put_32 (output_bfd, f->value, fixup_table); + fixup_table += 4; + ++fixups_written; + } + } + + if (linux_hash_table (info)->fixup_count != fixups_written) + { + (*_bfd_error_handler) (_("Warning: fixup count mismatch\n")); + while (linux_hash_table (info)->fixup_count > fixups_written) + { + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); + fixup_table += 4; + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); + fixup_table += 4; + ++fixups_written; + } + } + + h = linux_link_hash_lookup (linux_hash_table (info), + "__BUILTIN_FIXUPS__", + FALSE, FALSE, FALSE); + + if (h != NULL + && (h->root.root.type == bfd_link_hash_defined + || h->root.root.type == bfd_link_hash_defweak)) + { + is = h->root.root.u.def.section; + section_offset = is->output_section->vma + is->output_offset; + new_addr = h->root.root.u.def.value + section_offset; + +#ifdef LINUX_LINK_DEBUG + printf ("Builtin fixup table at %x\n", new_addr); +#endif + + bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); + } + else + bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); + + if (bfd_seek (output_bfd, (file_ptr) (os->filepos + s->output_offset), + SEEK_SET) != 0) + return FALSE; + + if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size) + return FALSE; + + return TRUE; +} + +#define MY_bfd_link_hash_table_create linux_link_hash_table_create +#define MY_add_one_symbol linux_add_one_symbol +#define MY_finish_dynamic_link linux_finish_dynamic_link + +#define MY_zmagic_contiguous 1 + +#include "aout-target.h" diff --git a/bfd/m68klynx.c b/bfd/m68klynx.c new file mode 100644 index 0000000000000..46fa0763dae92 --- /dev/null +++ b/bfd/m68klynx.c @@ -0,0 +1,57 @@ +/* BFD back-end for m68k binaries under LynxOS. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002, 2003 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define N_SHARED_LIB(x) 0 + +#define TEXT_START_ADDR 0 +#define TARGET_PAGE_SIZE 4096 +#define SEGMENT_SIZE TARGET_PAGE_SIZE +#define DEFAULT_ARCH bfd_arch_m68k + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (m68klynx_aout_,OP) +#define TARGETNAME "a.out-m68k-lynx" + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#include "libaout.h" +#include "aout/aout64.h" + +#define TARGET_IS_BIG_ENDIAN_P + +#ifdef LYNX_CORE + +char *lynx_core_file_failing_command(); +int lynx_core_file_failing_signal(); +bfd_boolean lynx_core_file_matches_executable_p(); +const bfd_target *lynx_core_file_p(); + +#define MY_core_file_failing_command lynx_core_file_failing_command +#define MY_core_file_failing_signal lynx_core_file_failing_signal +#define MY_core_file_matches_executable_p lynx_core_file_matches_executable_p +#define MY_core_file_p lynx_core_file_p + +#endif /* LYNX_CORE */ + +#include "aout-target.h" diff --git a/bfd/m68knetbsd.c b/bfd/m68knetbsd.c new file mode 100644 index 0000000000000..2a748891b99a3 --- /dev/null +++ b/bfd/m68knetbsd.c @@ -0,0 +1,38 @@ +/* BFD back-end for NetBSD/m68k a.out-ish binaries. + Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001, 2003 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define TARGET_IS_BIG_ENDIAN_P + +/* Our m68k ports use either 4K or 8K pages, but object files always + assume 8K page alignment so they will work on all m68k machines. */ +#define TARGET_PAGE_SIZE 0x2000 + +#define DEFAULT_ARCH bfd_arch_m68k +#define DEFAULT_MID M_68K_NETBSD + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (m68knetbsd_,OP) + +/* This needs to start with a.out so GDB knows it is an a.out variant. */ +#define TARGETNAME "a.out-m68k-netbsd" + +#include "netbsd.h" diff --git a/bfd/m88kmach3.c b/bfd/m88kmach3.c new file mode 100644 index 0000000000000..79e3bb8312b37 --- /dev/null +++ b/bfd/m88kmach3.c @@ -0,0 +1,42 @@ +/* BFD back-end for Motorola m88k a.out (Mach 3) binaries. + Copyright 1990, 1991, 1993, 1994, 1995, 2001, 2003 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define TARGET_PAGE_SIZE (4096*2) +#define SEGMENT_SIZE 0x20000 +#define TEXT_START_ADDR 0 +#define N_HEADER_IN_TEXT(x) 1 /* (N_MAGIG(x) == ZMAGIC) */ +#define N_SHARED_LIB(x) 0 + +#define N_TXTSIZE(x) ((x).a_text) + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "libaout.h" + +#define DEFAULT_ARCH bfd_arch_m88k + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (m88kmach3_,OP) +#define TARGETNAME "a.out-m88k-mach3" + +#include "aout-target.h" diff --git a/bfd/mach-o-target.c b/bfd/mach-o-target.c new file mode 100644 index 0000000000000..b271bfc87fe55 --- /dev/null +++ b/bfd/mach-o-target.c @@ -0,0 +1,117 @@ +/* Mach-O support for BFD. + Copyright 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#ifndef TARGET_NAME +#error TARGET_NAME must be defined +#endif /* TARGET_NAME */ + +#ifndef TARGET_STRING +#error TARGET_STRING must be defined +#endif /* TARGET_STRING */ + +#ifndef TARGET_BIG_ENDIAN +#error TARGET_BIG_ENDIAN must be defined +#endif /* TARGET_BIG_ENDIAN */ + +#ifndef TARGET_ARCHIVE +#error TARGET_ARCHIVE must be defined +#endif /* TARGET_ARCHIVE */ + +#if ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN)) +#error Mach-O fat files must always be big-endian. +#endif /* ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN)) */ + +const bfd_target TARGET_NAME = +{ + TARGET_STRING, /* Name. */ + bfd_target_mach_o_flavour, +#if TARGET_BIG_ENDIAN + BFD_ENDIAN_BIG, /* Target byte order. */ + BFD_ENDIAN_BIG, /* Target headers byte order. */ +#else + BFD_ENDIAN_LITTLE, /* Target byte order. */ + BFD_ENDIAN_LITTLE, /* Target headers byte order. */ +#endif + (HAS_RELOC | EXEC_P | /* Object flags. */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), + (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS + | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ + '_', /* symbol_leading_char. */ + ' ', /* ar_pad_char. */ + 16, /* ar_max_namelen. */ + +#if TARGET_BIG_ENDIAN + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Hdrs. */ +#else + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ +#endif /* TARGET_BIG_ENDIAN */ + + { /* bfd_check_format. */ +#if TARGET_ARCHIVE + _bfd_dummy_target, + _bfd_dummy_target, + bfd_mach_o_archive_p, + _bfd_dummy_target, +#else + _bfd_dummy_target, + bfd_mach_o_object_p, + _bfd_dummy_target, + bfd_mach_o_core_p +#endif + }, + { /* bfd_set_format. */ + bfd_false, + bfd_mach_o_mkobject, + bfd_false, + bfd_mach_o_mkobject, + }, + { /* bfd_write_contents. */ + bfd_false, + bfd_mach_o_write_contents, + bfd_false, + bfd_mach_o_write_contents, + }, + + BFD_JUMP_TABLE_GENERIC (bfd_mach_o), + BFD_JUMP_TABLE_COPY (bfd_mach_o), + BFD_JUMP_TABLE_CORE (bfd_mach_o), + BFD_JUMP_TABLE_ARCHIVE (bfd_mach_o), + BFD_JUMP_TABLE_SYMBOLS (bfd_mach_o), + BFD_JUMP_TABLE_RELOCS (bfd_mach_o), + BFD_JUMP_TABLE_WRITE (bfd_mach_o), + BFD_JUMP_TABLE_LINK (bfd_mach_o), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + NULL +}; + diff --git a/bfd/mach-o.c b/bfd/mach-o.c new file mode 100644 index 0000000000000..b5d6a728d08e2 --- /dev/null +++ b/bfd/mach-o.c @@ -0,0 +1,2227 @@ +/* Mach-O support for BFD. + Copyright 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "mach-o.h" +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "libiberty.h" +#include + +#ifndef BFD_IO_FUNCS +#define BFD_IO_FUNCS 0 +#endif + +#define bfd_mach_o_mkarchive _bfd_noarchive_mkarchive +#define bfd_mach_o_read_ar_hdr _bfd_noarchive_read_ar_hdr +#define bfd_mach_o_slurp_armap _bfd_noarchive_slurp_armap +#define bfd_mach_o_slurp_extended_name_table _bfd_noarchive_slurp_extended_name_table +#define bfd_mach_o_construct_extended_name_table _bfd_noarchive_construct_extended_name_table +#define bfd_mach_o_truncate_arname _bfd_noarchive_truncate_arname +#define bfd_mach_o_write_armap _bfd_noarchive_write_armap +#define bfd_mach_o_get_elt_at_index _bfd_noarchive_get_elt_at_index +#define bfd_mach_o_generic_stat_arch_elt _bfd_noarchive_generic_stat_arch_elt +#define bfd_mach_o_update_armap_timestamp _bfd_noarchive_update_armap_timestamp +#define bfd_mach_o_close_and_cleanup _bfd_generic_close_and_cleanup +#define bfd_mach_o_bfd_free_cached_info _bfd_generic_bfd_free_cached_info +#define bfd_mach_o_new_section_hook _bfd_generic_new_section_hook +#define bfd_mach_o_get_section_contents_in_window _bfd_generic_get_section_contents_in_window +#define bfd_mach_o_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name +#define bfd_mach_o_get_lineno _bfd_nosymbols_get_lineno +#define bfd_mach_o_find_nearest_line _bfd_nosymbols_find_nearest_line +#define bfd_mach_o_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define bfd_mach_o_read_minisymbols _bfd_generic_read_minisymbols +#define bfd_mach_o_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol +#define bfd_mach_o_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound +#define bfd_mach_o_canonicalize_reloc _bfd_norelocs_canonicalize_reloc +#define bfd_mach_o_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +#define bfd_mach_o_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents +#define bfd_mach_o_bfd_relax_section bfd_generic_relax_section +#define bfd_mach_o_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define bfd_mach_o_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define bfd_mach_o_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define bfd_mach_o_bfd_link_just_syms _bfd_generic_link_just_syms +#define bfd_mach_o_bfd_final_link _bfd_generic_final_link +#define bfd_mach_o_bfd_link_split_section _bfd_generic_link_split_section +#define bfd_mach_o_set_arch_mach bfd_default_set_arch_mach +#define bfd_mach_o_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data +#define bfd_mach_o_bfd_set_private_flags _bfd_generic_bfd_set_private_flags +#define bfd_mach_o_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data +#define bfd_mach_o_get_section_contents _bfd_generic_get_section_contents +#define bfd_mach_o_set_section_contents _bfd_generic_set_section_contents +#define bfd_mach_o_bfd_gc_sections bfd_generic_gc_sections +#define bfd_mach_o_bfd_merge_sections bfd_generic_merge_sections +#define bfd_mach_o_bfd_discard_group bfd_generic_discard_group + +static bfd_boolean bfd_mach_o_bfd_copy_private_symbol_data + PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); +static bfd_boolean bfd_mach_o_bfd_copy_private_section_data + PARAMS ((bfd *, asection *, bfd *, asection *)); +static bfd_boolean bfd_mach_o_bfd_copy_private_bfd_data + PARAMS ((bfd *, bfd *)); +static long bfd_mach_o_count_symbols + PARAMS ((bfd *)); +static long bfd_mach_o_get_symtab_upper_bound + PARAMS ((bfd *)); +static long bfd_mach_o_canonicalize_symtab + PARAMS ((bfd *, asymbol **)); +static void bfd_mach_o_get_symbol_info + PARAMS ((bfd *, asymbol *, symbol_info *)); +static void bfd_mach_o_print_symbol + PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); +static void bfd_mach_o_convert_architecture + PARAMS ((bfd_mach_o_cpu_type, bfd_mach_o_cpu_subtype, + enum bfd_architecture *, unsigned long *)); +static bfd_boolean bfd_mach_o_write_contents + PARAMS ((bfd *)); +static int bfd_mach_o_sizeof_headers + PARAMS ((bfd *, bfd_boolean)); +static asymbol * bfd_mach_o_make_empty_symbol + PARAMS ((bfd *)); +static int bfd_mach_o_write_header + PARAMS ((bfd *, bfd_mach_o_header *)); +static int bfd_mach_o_read_header + PARAMS ((bfd *, bfd_mach_o_header *)); +static asection * bfd_mach_o_make_bfd_section + PARAMS ((bfd *, bfd_mach_o_section *)); +static int bfd_mach_o_scan_read_section + PARAMS ((bfd *, bfd_mach_o_section *, bfd_vma)); +static int bfd_mach_o_scan_write_section + PARAMS ((bfd *, bfd_mach_o_section *, bfd_vma)); +static int bfd_mach_o_scan_write_symtab_symbols + PARAMS ((bfd *, bfd_mach_o_load_command *)); +static int bfd_mach_o_scan_write_thread + PARAMS ((bfd *, bfd_mach_o_load_command *)); +static int bfd_mach_o_scan_read_dylinker + PARAMS ((bfd *, bfd_mach_o_load_command *)); +static int bfd_mach_o_scan_read_dylib + PARAMS ((bfd *, bfd_mach_o_load_command *)); +static int bfd_mach_o_scan_read_prebound_dylib + PARAMS ((bfd *, bfd_mach_o_load_command *)); +static int bfd_mach_o_scan_read_thread + PARAMS ((bfd *, bfd_mach_o_load_command *)); +static int bfd_mach_o_scan_write_symtab + PARAMS ((bfd *, bfd_mach_o_load_command *)); +static int bfd_mach_o_scan_read_dysymtab + PARAMS ((bfd *, bfd_mach_o_load_command *)); +static int bfd_mach_o_scan_read_symtab + PARAMS ((bfd *, bfd_mach_o_load_command *)); +static int bfd_mach_o_scan_read_segment + PARAMS ((bfd *, bfd_mach_o_load_command *)); +static int bfd_mach_o_scan_write_segment + PARAMS ((bfd *, bfd_mach_o_load_command *)); +static int bfd_mach_o_scan_read_command + PARAMS ((bfd *, bfd_mach_o_load_command *)); +static void bfd_mach_o_flatten_sections + PARAMS ((bfd *)); +static const char * bfd_mach_o_i386_flavour_string + PARAMS ((unsigned int)); +static const char * bfd_mach_o_ppc_flavour_string + PARAMS ((unsigned int)); + +/* The flags field of a section structure is separated into two parts a section + type and section attributes. The section types are mutually exclusive (it + can only have one type) but the section attributes are not (it may have more + than one attribute). */ + +#define SECTION_TYPE 0x000000ff /* 256 section types. */ +#define SECTION_ATTRIBUTES 0xffffff00 /* 24 section attributes. */ + +/* Constants for the section attributes part of the flags field of a section + structure. */ + +#define SECTION_ATTRIBUTES_USR 0xff000000 /* User-settable attributes. */ +#define S_ATTR_PURE_INSTRUCTIONS 0x80000000 /* Section contains only true machine instructions. */ +#define SECTION_ATTRIBUTES_SYS 0x00ffff00 /* System setable attributes. */ +#define S_ATTR_SOME_INSTRUCTIONS 0x00000400 /* Section contains some machine instructions. */ +#define S_ATTR_EXT_RELOC 0x00000200 /* Section has external relocation entries. */ +#define S_ATTR_LOC_RELOC 0x00000100 /* Section has local relocation entries. */ + +#define N_STAB 0xe0 +#define N_TYPE 0x1e +#define N_EXT 0x01 +#define N_UNDF 0x0 +#define N_ABS 0x2 +#define N_SECT 0xe +#define N_INDR 0xa + +bfd_boolean +bfd_mach_o_valid (abfd) + bfd *abfd; +{ + if (abfd == NULL || abfd->xvec == NULL) + return 0; + + if (! ((abfd->xvec == &mach_o_be_vec) + || (abfd->xvec == &mach_o_le_vec) + || (abfd->xvec == &mach_o_fat_vec))) + return 0; + + if (abfd->tdata.mach_o_data == NULL) + return 0; + return 1; +} + +/* Copy any private info we understand from the input symbol + to the output symbol. */ + +static bfd_boolean +bfd_mach_o_bfd_copy_private_symbol_data (ibfd, isymbol, obfd, osymbol) + bfd *ibfd ATTRIBUTE_UNUSED; + asymbol *isymbol ATTRIBUTE_UNUSED; + bfd *obfd ATTRIBUTE_UNUSED; + asymbol *osymbol ATTRIBUTE_UNUSED; +{ + return TRUE; +} + +/* Copy any private info we understand from the input section + to the output section. */ + +static bfd_boolean +bfd_mach_o_bfd_copy_private_section_data (ibfd, isection, obfd, osection) + bfd *ibfd ATTRIBUTE_UNUSED; + asection *isection ATTRIBUTE_UNUSED; + bfd *obfd ATTRIBUTE_UNUSED; + asection *osection ATTRIBUTE_UNUSED; +{ + return TRUE; +} + +/* Copy any private info we understand from the input bfd + to the output bfd. */ + +static bfd_boolean +bfd_mach_o_bfd_copy_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + BFD_ASSERT (bfd_mach_o_valid (ibfd)); + BFD_ASSERT (bfd_mach_o_valid (obfd)); + + obfd->tdata.mach_o_data = ibfd->tdata.mach_o_data; + obfd->tdata.mach_o_data->ibfd = ibfd; + return TRUE; +} + +static long +bfd_mach_o_count_symbols (abfd) + bfd *abfd; +{ + bfd_mach_o_data_struct *mdata = NULL; + long nsyms = 0; + unsigned long i; + + BFD_ASSERT (bfd_mach_o_valid (abfd)); + mdata = abfd->tdata.mach_o_data; + + for (i = 0; i < mdata->header.ncmds; i++) + if (mdata->commands[i].type == BFD_MACH_O_LC_SYMTAB) + { + bfd_mach_o_symtab_command *sym = &mdata->commands[i].command.symtab; + nsyms += sym->nsyms; + } + + return nsyms; +} + +static long +bfd_mach_o_get_symtab_upper_bound (abfd) + bfd *abfd; +{ + long nsyms = bfd_mach_o_count_symbols (abfd); + + if (nsyms < 0) + return nsyms; + + return ((nsyms + 1) * sizeof (asymbol *)); +} + +static long +bfd_mach_o_canonicalize_symtab (abfd, alocation) + bfd *abfd; + asymbol **alocation; +{ + bfd_mach_o_data_struct *mdata = abfd->tdata.mach_o_data; + long nsyms = bfd_mach_o_count_symbols (abfd); + asymbol **csym = alocation; + unsigned long i, j; + + if (nsyms < 0) + return nsyms; + + for (i = 0; i < mdata->header.ncmds; i++) + { + if (mdata->commands[i].type == BFD_MACH_O_LC_SYMTAB) + { + bfd_mach_o_symtab_command *sym = &mdata->commands[i].command.symtab; + + if (bfd_mach_o_scan_read_symtab_symbols (abfd, &mdata->commands[i].command.symtab) != 0) + { + fprintf (stderr, "bfd_mach_o_canonicalize_symtab: unable to load symbols for section %lu\n", i); + return 0; + } + + BFD_ASSERT (sym->symbols != NULL); + + for (j = 0; j < sym->nsyms; j++) + { + BFD_ASSERT (csym < (alocation + nsyms)); + *csym++ = &sym->symbols[j]; + } + } + } + + *csym++ = NULL; + + return nsyms; +} + +static void +bfd_mach_o_get_symbol_info (abfd, symbol, ret) + bfd *abfd ATTRIBUTE_UNUSED; + asymbol *symbol; + symbol_info *ret; +{ + bfd_symbol_info (symbol, ret); +} + +static void +bfd_mach_o_print_symbol (abfd, afile, symbol, how) + bfd *abfd; + PTR afile; + asymbol *symbol; + bfd_print_symbol_type how; +{ + FILE *file = (FILE *) afile; + + switch (how) + { + case bfd_print_symbol_name: + fprintf (file, "%s", symbol->name); + break; + default: + bfd_print_symbol_vandf (abfd, (PTR) file, symbol); + fprintf (file, " %-5s %s", symbol->section->name, symbol->name); + } +} + +static void +bfd_mach_o_convert_architecture (mtype, msubtype, type, subtype) + bfd_mach_o_cpu_type mtype; + bfd_mach_o_cpu_subtype msubtype ATTRIBUTE_UNUSED; + enum bfd_architecture *type; + unsigned long *subtype; +{ + *subtype = bfd_arch_unknown; + + switch (mtype) + { + case BFD_MACH_O_CPU_TYPE_VAX: *type = bfd_arch_vax; break; + case BFD_MACH_O_CPU_TYPE_MC680x0: *type = bfd_arch_m68k; break; + case BFD_MACH_O_CPU_TYPE_I386: *type = bfd_arch_i386; break; + case BFD_MACH_O_CPU_TYPE_MIPS: *type = bfd_arch_mips; break; + case BFD_MACH_O_CPU_TYPE_MC98000: *type = bfd_arch_m98k; break; + case BFD_MACH_O_CPU_TYPE_HPPA: *type = bfd_arch_hppa; break; + case BFD_MACH_O_CPU_TYPE_ARM: *type = bfd_arch_arm; break; + case BFD_MACH_O_CPU_TYPE_MC88000: *type = bfd_arch_m88k; break; + case BFD_MACH_O_CPU_TYPE_SPARC: *type = bfd_arch_sparc; break; + case BFD_MACH_O_CPU_TYPE_I860: *type = bfd_arch_i860; break; + case BFD_MACH_O_CPU_TYPE_ALPHA: *type = bfd_arch_alpha; break; + case BFD_MACH_O_CPU_TYPE_POWERPC: *type = bfd_arch_powerpc; break; + default: *type = bfd_arch_unknown; break; + } + + switch (*type) + { + case bfd_arch_i386: *subtype = bfd_mach_i386_i386; break; + case bfd_arch_sparc: *subtype = bfd_mach_sparc; break; + default: + *subtype = bfd_arch_unknown; + } +} + +static bfd_boolean +bfd_mach_o_write_contents (abfd) + bfd *abfd; +{ + unsigned int i; + asection *s; + + bfd_mach_o_data_struct *mdata = abfd->tdata.mach_o_data; + + /* Write data sections first in case they overlap header data to be + written later. */ + + for (s = abfd->sections; s != (asection *) NULL; s = s->next) + ; + +#if 0 + for (i = 0; i < mdata->header.ncmds; i++) + { + bfd_mach_o_load_command *cur = &mdata->commands[i]; + if (cur->type != BFD_MACH_O_LC_SEGMENT) + break; + + { + bfd_mach_o_segment_command *seg = &cur->command.segment; + char buf[1024]; + bfd_vma nbytes = seg->filesize; + bfd_vma curoff = seg->fileoff; + + while (nbytes > 0) + { + bfd_vma thisread = nbytes; + + if (thisread > 1024) + thisread = 1024; + + bfd_seek (abfd, curoff, SEEK_SET); + if (bfd_bread ((PTR) buf, thisread, abfd) != thisread) + return FALSE; + + bfd_seek (abfd, curoff, SEEK_SET); + if (bfd_bwrite ((PTR) buf, thisread, abfd) != thisread) + return FALSE; + + nbytes -= thisread; + curoff += thisread; + } + } + } +#endif + + /* Now write header information. */ + if (bfd_mach_o_write_header (abfd, &mdata->header) != 0) + return FALSE; + + for (i = 0; i < mdata->header.ncmds; i++) + { + unsigned char buf[8]; + bfd_mach_o_load_command *cur = &mdata->commands[i]; + unsigned long typeflag; + + typeflag = cur->type_required ? cur->type & BFD_MACH_O_LC_REQ_DYLD : cur->type; + + bfd_h_put_32 (abfd, typeflag, buf); + bfd_h_put_32 (abfd, cur->len, buf + 4); + + bfd_seek (abfd, cur->offset, SEEK_SET); + if (bfd_bwrite ((PTR) buf, 8, abfd) != 8) + return FALSE; + + switch (cur->type) + { + case BFD_MACH_O_LC_SEGMENT: + if (bfd_mach_o_scan_write_segment (abfd, cur) != 0) + return FALSE; + break; + case BFD_MACH_O_LC_SYMTAB: + if (bfd_mach_o_scan_write_symtab (abfd, cur) != 0) + return FALSE; + break; + case BFD_MACH_O_LC_SYMSEG: + break; + case BFD_MACH_O_LC_THREAD: + case BFD_MACH_O_LC_UNIXTHREAD: + if (bfd_mach_o_scan_write_thread (abfd, cur) != 0) + return FALSE; + break; + case BFD_MACH_O_LC_LOADFVMLIB: + case BFD_MACH_O_LC_IDFVMLIB: + case BFD_MACH_O_LC_IDENT: + case BFD_MACH_O_LC_FVMFILE: + case BFD_MACH_O_LC_PREPAGE: + case BFD_MACH_O_LC_DYSYMTAB: + case BFD_MACH_O_LC_LOAD_DYLIB: + case BFD_MACH_O_LC_LOAD_WEAK_DYLIB: + case BFD_MACH_O_LC_ID_DYLIB: + case BFD_MACH_O_LC_LOAD_DYLINKER: + case BFD_MACH_O_LC_ID_DYLINKER: + case BFD_MACH_O_LC_PREBOUND_DYLIB: + case BFD_MACH_O_LC_ROUTINES: + case BFD_MACH_O_LC_SUB_FRAMEWORK: + break; + default: + fprintf (stderr, + "unable to write unknown load command 0x%lx\n", + (long) cur->type); + return FALSE; + } + } + + return TRUE; +} + +static int +bfd_mach_o_sizeof_headers (a, b) + bfd *a ATTRIBUTE_UNUSED; + bfd_boolean b ATTRIBUTE_UNUSED; +{ + return 0; +} + +/* Make an empty symbol. This is required only because + bfd_make_section_anyway wants to create a symbol for the section. */ + +static asymbol * +bfd_mach_o_make_empty_symbol (abfd) + bfd *abfd; +{ + asymbol *new; + + new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); + if (new == NULL) + return new; + new->the_bfd = abfd; + return new; +} + +static int +bfd_mach_o_write_header (abfd, header) + bfd *abfd; + bfd_mach_o_header *header; +{ + unsigned char buf[28]; + + bfd_h_put_32 (abfd, header->magic, buf + 0); + bfd_h_put_32 (abfd, header->cputype, buf + 4); + bfd_h_put_32 (abfd, header->cpusubtype, buf + 8); + bfd_h_put_32 (abfd, header->filetype, buf + 12); + bfd_h_put_32 (abfd, header->ncmds, buf + 16); + bfd_h_put_32 (abfd, header->sizeofcmds, buf + 20); + bfd_h_put_32 (abfd, header->flags, buf + 24); + + bfd_seek (abfd, 0, SEEK_SET); + if (bfd_bwrite ((PTR) buf, 28, abfd) != 28) + return -1; + + return 0; +} + +static int +bfd_mach_o_read_header (abfd, header) + bfd *abfd; + bfd_mach_o_header *header; +{ + unsigned char buf[28]; + bfd_vma (*get32) (const void *) = NULL; + + bfd_seek (abfd, 0, SEEK_SET); + + if (bfd_bread ((PTR) buf, 28, abfd) != 28) + return -1; + + if (bfd_getb32 (buf) == 0xfeedface) + { + header->byteorder = BFD_ENDIAN_BIG; + header->magic = 0xfeedface; + get32 = bfd_getb32; + } + else if (bfd_getl32 (buf) == 0xfeedface) + { + header->byteorder = BFD_ENDIAN_LITTLE; + header->magic = 0xfeedface; + get32 = bfd_getl32; + } + else + { + header->byteorder = BFD_ENDIAN_UNKNOWN; + return -1; + } + + header->cputype = (*get32) (buf + 4); + header->cpusubtype = (*get32) (buf + 8); + header->filetype = (*get32) (buf + 12); + header->ncmds = (*get32) (buf + 16); + header->sizeofcmds = (*get32) (buf + 20); + header->flags = (*get32) (buf + 24); + + return 0; +} + +static asection * +bfd_mach_o_make_bfd_section (abfd, section) + bfd *abfd; + bfd_mach_o_section *section; +{ + asection *bfdsec; + char *sname; + const char *prefix = "LC_SEGMENT"; + unsigned int snamelen; + + snamelen = strlen (prefix) + 1 + + strlen (section->segname) + 1 + + strlen (section->sectname) + 1; + + sname = (char *) bfd_alloc (abfd, snamelen); + if (sname == NULL) + return NULL; + sprintf (sname, "%s.%s.%s", prefix, section->segname, section->sectname); + + bfdsec = bfd_make_section_anyway (abfd, sname); + if (bfdsec == NULL) + return NULL; + + bfdsec->vma = section->addr; + bfdsec->lma = section->addr; + bfdsec->_raw_size = section->size; + bfdsec->filepos = section->offset; + bfdsec->alignment_power = section->align; + + if (section->flags & BFD_MACH_O_S_ZEROFILL) + bfdsec->flags = SEC_ALLOC; + else + bfdsec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE; + + return bfdsec; +} + +static int +bfd_mach_o_scan_read_section (abfd, section, offset) + bfd *abfd; + bfd_mach_o_section *section; + bfd_vma offset; +{ + unsigned char buf[68]; + + bfd_seek (abfd, offset, SEEK_SET); + if (bfd_bread ((PTR) buf, 68, abfd) != 68) + return -1; + + memcpy (section->sectname, buf, 16); + section->sectname[16] = '\0'; + memcpy (section->segname, buf + 16, 16); + section->segname[16] = '\0'; + section->addr = bfd_h_get_32 (abfd, buf + 32); + section->size = bfd_h_get_32 (abfd, buf + 36); + section->offset = bfd_h_get_32 (abfd, buf + 40); + section->align = bfd_h_get_32 (abfd, buf + 44); + section->reloff = bfd_h_get_32 (abfd, buf + 48); + section->nreloc = bfd_h_get_32 (abfd, buf + 52); + section->flags = bfd_h_get_32 (abfd, buf + 56); + section->reserved1 = bfd_h_get_32 (abfd, buf + 60); + section->reserved2 = bfd_h_get_32 (abfd, buf + 64); + section->bfdsection = bfd_mach_o_make_bfd_section (abfd, section); + + if (section->bfdsection == NULL) + return -1; + + return 0; +} + +static int +bfd_mach_o_scan_write_section (abfd, section, offset) + bfd *abfd; + bfd_mach_o_section *section; + bfd_vma offset; +{ + unsigned char buf[68]; + + memcpy (buf, section->sectname, 16); + memcpy (buf + 16, section->segname, 16); + bfd_h_put_32 (abfd, section->addr, buf + 32); + bfd_h_put_32 (abfd, section->size, buf + 36); + bfd_h_put_32 (abfd, section->offset, buf + 40); + bfd_h_put_32 (abfd, section->align, buf + 44); + bfd_h_put_32 (abfd, section->reloff, buf + 48); + bfd_h_put_32 (abfd, section->nreloc, buf + 52); + bfd_h_put_32 (abfd, section->flags, buf + 56); + /* bfd_h_put_32 (abfd, section->reserved1, buf + 60); */ + /* bfd_h_put_32 (abfd, section->reserved2, buf + 64); */ + + bfd_seek (abfd, offset, SEEK_SET); + if (bfd_bwrite ((PTR) buf, 68, abfd) != 68) + return -1; + + return 0; +} + +static int +bfd_mach_o_scan_write_symtab_symbols (abfd, command) + bfd *abfd; + bfd_mach_o_load_command *command; +{ + bfd_mach_o_symtab_command *sym = &command->command.symtab; + asymbol *s = NULL; + unsigned long i; + + for (i = 0; i < sym->nsyms; i++) + { + unsigned char buf[12]; + bfd_vma symoff = sym->symoff + (i * 12); + unsigned char ntype = 0; + unsigned char nsect = 0; + short ndesc = 0; + + s = &sym->symbols[i]; + + /* Don't set this from the symbol information; use stored values. */ +#if 0 + if (s->flags & BSF_GLOBAL) + ntype |= N_EXT; + if (s->flags & BSF_DEBUGGING) + ntype |= N_STAB; + + if (s->section == bfd_und_section_ptr) + ntype |= N_UNDF; + else if (s->section == bfd_abs_section_ptr) + ntype |= N_ABS; + else + ntype |= N_SECT; +#endif + + /* Instead just set from the stored values. */ + ntype = (s->udata.i >> 24) & 0xff; + nsect = (s->udata.i >> 16) & 0xff; + ndesc = s->udata.i & 0xffff; + + bfd_h_put_32 (abfd, s->name - sym->strtab, buf); + bfd_h_put_8 (abfd, ntype, buf + 4); + bfd_h_put_8 (abfd, nsect, buf + 5); + bfd_h_put_16 (abfd, ndesc, buf + 6); + bfd_h_put_32 (abfd, s->section->vma + s->value, buf + 8); + + bfd_seek (abfd, symoff, SEEK_SET); + if (bfd_bwrite ((PTR) buf, 12, abfd) != 12) + { + fprintf (stderr, "bfd_mach_o_scan_write_symtab_symbols: unable to write %d bytes at %lu\n", + 12, (unsigned long) symoff); + return -1; + } + } + + return 0; +} + +int +bfd_mach_o_scan_read_symtab_symbol (abfd, sym, s, i) + bfd *abfd; + bfd_mach_o_symtab_command *sym; + asymbol *s; + unsigned long i; +{ + bfd_mach_o_data_struct *mdata = abfd->tdata.mach_o_data; + bfd_vma symoff = sym->symoff + (i * 12); + unsigned char buf[12]; + unsigned char type = -1; + unsigned char section = -1; + short desc = -1; + unsigned long value = -1; + unsigned long stroff = -1; + unsigned int symtype = -1; + + BFD_ASSERT (sym->strtab != NULL); + + bfd_seek (abfd, symoff, SEEK_SET); + if (bfd_bread ((PTR) buf, 12, abfd) != 12) + { + fprintf (stderr, "bfd_mach_o_scan_read_symtab_symbol: unable to read %d bytes at %lu\n", + 12, (unsigned long) symoff); + return -1; + } + + stroff = bfd_h_get_32 (abfd, buf); + type = bfd_h_get_8 (abfd, buf + 4); + symtype = (type & 0x0e); + section = bfd_h_get_8 (abfd, buf + 5) - 1; + desc = bfd_h_get_16 (abfd, buf + 6); + value = bfd_h_get_32 (abfd, buf + 8); + + if (stroff >= sym->strsize) + { + fprintf (stderr, "bfd_mach_o_scan_read_symtab_symbol: symbol name out of range (%lu >= %lu)\n", + (unsigned long) stroff, (unsigned long) sym->strsize); + return -1; + } + + s->the_bfd = abfd; + s->name = sym->strtab + stroff; + s->value = value; + s->udata.i = (type << 24) | (section << 16) | desc; + s->flags = 0x0; + + if (type & BFD_MACH_O_N_STAB) + { + s->flags |= BSF_DEBUGGING; + s->section = bfd_und_section_ptr; + } + else + { + if (type & BFD_MACH_O_N_PEXT) + { + type &= ~BFD_MACH_O_N_PEXT; + s->flags |= BSF_GLOBAL; + } + + if (type & BFD_MACH_O_N_EXT) + { + type &= ~BFD_MACH_O_N_EXT; + s->flags |= BSF_GLOBAL; + } + + switch (symtype) + { + case BFD_MACH_O_N_UNDF: + s->section = bfd_und_section_ptr; + break; + case BFD_MACH_O_N_PBUD: + s->section = bfd_und_section_ptr; + break; + case BFD_MACH_O_N_ABS: + s->section = bfd_abs_section_ptr; + break; + case BFD_MACH_O_N_SECT: + if ((section > 0) && (section <= mdata->nsects)) + { + s->section = mdata->sections[section - 1]->bfdsection; + s->value = s->value - mdata->sections[section - 1]->addr; + } + else + { + /* Mach-O uses 0 to mean "no section"; not an error. */ + if (section != 0) + { + fprintf (stderr, "bfd_mach_o_scan_read_symtab_symbol: " + "symbol \"%s\" specified invalid section %d (max %lu): setting to undefined\n", + s->name, section, mdata->nsects); + } + s->section = bfd_und_section_ptr; + } + break; + case BFD_MACH_O_N_INDR: + fprintf (stderr, "bfd_mach_o_scan_read_symtab_symbol: " + "symbol \"%s\" is unsupported 'indirect' reference: setting to undefined\n", + s->name); + s->section = bfd_und_section_ptr; + break; + default: + fprintf (stderr, "bfd_mach_o_scan_read_symtab_symbol: " + "symbol \"%s\" specified invalid type field 0x%x: setting to undefined\n", + s->name, symtype); + s->section = bfd_und_section_ptr; + break; + } + } + + return 0; +} + +int +bfd_mach_o_scan_read_symtab_strtab (abfd, sym) + bfd *abfd; + bfd_mach_o_symtab_command *sym; +{ + BFD_ASSERT (sym->strtab == NULL); + + if (abfd->flags & BFD_IN_MEMORY) + { + struct bfd_in_memory *b; + + b = (struct bfd_in_memory *) abfd->iostream; + + if ((sym->stroff + sym->strsize) > b->size) + { + bfd_set_error (bfd_error_file_truncated); + return -1; + } + sym->strtab = b->buffer + sym->stroff; + return 0; + } + + sym->strtab = bfd_alloc (abfd, sym->strsize); + if (sym->strtab == NULL) + return -1; + + bfd_seek (abfd, sym->stroff, SEEK_SET); + if (bfd_bread ((PTR) sym->strtab, sym->strsize, abfd) != sym->strsize) + { + fprintf (stderr, "bfd_mach_o_scan_read_symtab_strtab: unable to read %lu bytes at %lu\n", + sym->strsize, sym->stroff); + return -1; + } + + return 0; +} + +int +bfd_mach_o_scan_read_symtab_symbols (abfd, sym) + bfd *abfd; + bfd_mach_o_symtab_command *sym; +{ + unsigned long i; + int ret; + + BFD_ASSERT (sym->symbols == NULL); + sym->symbols = bfd_alloc (abfd, sym->nsyms * sizeof (asymbol)); + + if (sym->symbols == NULL) + { + fprintf (stderr, "bfd_mach_o_scan_read_symtab_symbols: unable to allocate memory for symbols\n"); + return -1; + } + + ret = bfd_mach_o_scan_read_symtab_strtab (abfd, sym); + if (ret != 0) + return ret; + + for (i = 0; i < sym->nsyms; i++) + { + ret = bfd_mach_o_scan_read_symtab_symbol (abfd, sym, &sym->symbols[i], i); + if (ret != 0) + return ret; + } + + return 0; +} + +int +bfd_mach_o_scan_read_dysymtab_symbol (abfd, dysym, sym, s, i) + bfd *abfd; + bfd_mach_o_dysymtab_command *dysym; + bfd_mach_o_symtab_command *sym; + asymbol *s; + unsigned long i; +{ + unsigned long isymoff = dysym->indirectsymoff + (i * 4); + unsigned long symindex; + unsigned char buf[4]; + + BFD_ASSERT (i < dysym->nindirectsyms); + + bfd_seek (abfd, isymoff, SEEK_SET); + if (bfd_bread ((PTR) buf, 4, abfd) != 4) + { + fprintf (stderr, "bfd_mach_o_scan_read_dysymtab_symbol: unable to read %lu bytes at %lu\n", + (unsigned long) 4, isymoff); + return -1; + } + symindex = bfd_h_get_32 (abfd, buf); + + return bfd_mach_o_scan_read_symtab_symbol (abfd, sym, s, symindex); +} + +static const char * +bfd_mach_o_i386_flavour_string (flavour) + unsigned int flavour; +{ + switch ((int) flavour) + { + case BFD_MACH_O_i386_NEW_THREAD_STATE: return "i386_NEW_THREAD_STATE"; + case BFD_MACH_O_i386_FLOAT_STATE: return "i386_FLOAT_STATE"; + case BFD_MACH_O_i386_ISA_PORT_MAP_STATE: return "i386_ISA_PORT_MAP_STATE"; + case BFD_MACH_O_i386_V86_ASSIST_STATE: return "i386_V86_ASSIST_STATE"; + case BFD_MACH_O_i386_REGS_SEGS_STATE: return "i386_REGS_SEGS_STATE"; + case BFD_MACH_O_i386_THREAD_SYSCALL_STATE: return "i386_THREAD_SYSCALL_STATE"; + case BFD_MACH_O_i386_THREAD_STATE_NONE: return "i386_THREAD_STATE_NONE"; + case BFD_MACH_O_i386_SAVED_STATE: return "i386_SAVED_STATE"; + case BFD_MACH_O_i386_THREAD_STATE: return "i386_THREAD_STATE"; + case BFD_MACH_O_i386_THREAD_FPSTATE: return "i386_THREAD_FPSTATE"; + case BFD_MACH_O_i386_THREAD_EXCEPTSTATE: return "i386_THREAD_EXCEPTSTATE"; + case BFD_MACH_O_i386_THREAD_CTHREADSTATE: return "i386_THREAD_CTHREADSTATE"; + default: return "UNKNOWN"; + } +} + +static const char * +bfd_mach_o_ppc_flavour_string (flavour) + unsigned int flavour; +{ + switch ((int) flavour) + { + case BFD_MACH_O_PPC_THREAD_STATE: return "PPC_THREAD_STATE"; + case BFD_MACH_O_PPC_FLOAT_STATE: return "PPC_FLOAT_STATE"; + case BFD_MACH_O_PPC_EXCEPTION_STATE: return "PPC_EXCEPTION_STATE"; + case BFD_MACH_O_PPC_VECTOR_STATE: return "PPC_VECTOR_STATE"; + default: return "UNKNOWN"; + } +} + +static int +bfd_mach_o_scan_write_thread (abfd, command) + bfd *abfd; + bfd_mach_o_load_command *command; +{ + bfd_mach_o_thread_command *cmd = &command->command.thread; + unsigned int i; + unsigned char buf[8]; + bfd_vma offset; + unsigned int nflavours; + + BFD_ASSERT ((command->type == BFD_MACH_O_LC_THREAD) + || (command->type == BFD_MACH_O_LC_UNIXTHREAD)); + + offset = 8; + nflavours = 0; + for (i = 0; i < cmd->nflavours; i++) + { + BFD_ASSERT ((cmd->flavours[i].size % 4) == 0); + BFD_ASSERT (cmd->flavours[i].offset == (command->offset + offset + 8)); + + bfd_h_put_32 (abfd, cmd->flavours[i].flavour, buf); + bfd_h_put_32 (abfd, (cmd->flavours[i].size / 4), buf + 4); + + bfd_seek (abfd, command->offset + offset, SEEK_SET); + if (bfd_bwrite ((PTR) buf, 8, abfd) != 8) + return -1; + + offset += cmd->flavours[i].size + 8; + } + + return 0; +} + +static int +bfd_mach_o_scan_read_dylinker (abfd, command) + bfd *abfd; + bfd_mach_o_load_command *command; +{ + bfd_mach_o_dylinker_command *cmd = &command->command.dylinker; + unsigned char buf[4]; + unsigned int nameoff; + asection *bfdsec; + char *sname; + const char *prefix; + + BFD_ASSERT ((command->type == BFD_MACH_O_LC_ID_DYLINKER) + || (command->type == BFD_MACH_O_LC_LOAD_DYLINKER)); + + bfd_seek (abfd, command->offset + 8, SEEK_SET); + if (bfd_bread ((PTR) buf, 4, abfd) != 4) + return -1; + + nameoff = bfd_h_get_32 (abfd, buf + 0); + + cmd->name_offset = command->offset + nameoff; + cmd->name_len = command->len - nameoff; + + if (command->type == BFD_MACH_O_LC_LOAD_DYLINKER) + prefix = "LC_LOAD_DYLINKER"; + else if (command->type == BFD_MACH_O_LC_ID_DYLINKER) + prefix = "LC_ID_DYLINKER"; + else + abort (); + + sname = (char *) bfd_alloc (abfd, strlen (prefix) + 1); + if (sname == NULL) + return -1; + strcpy (sname, prefix); + + bfdsec = bfd_make_section_anyway (abfd, sname); + if (bfdsec == NULL) + return -1; + + bfdsec->vma = 0; + bfdsec->lma = 0; + bfdsec->_raw_size = command->len - 8; + bfdsec->filepos = command->offset + 8; + bfdsec->alignment_power = 0; + bfdsec->flags = SEC_HAS_CONTENTS; + + cmd->section = bfdsec; + + return 0; +} + +static int +bfd_mach_o_scan_read_dylib (abfd, command) + bfd *abfd; + bfd_mach_o_load_command *command; +{ + bfd_mach_o_dylib_command *cmd = &command->command.dylib; + unsigned char buf[16]; + unsigned int nameoff; + asection *bfdsec; + char *sname; + const char *prefix; + + BFD_ASSERT ((command->type == BFD_MACH_O_LC_ID_DYLIB) + || (command->type == BFD_MACH_O_LC_LOAD_DYLIB) + || (command->type == BFD_MACH_O_LC_LOAD_WEAK_DYLIB)); + + bfd_seek (abfd, command->offset + 8, SEEK_SET); + if (bfd_bread ((PTR) buf, 16, abfd) != 16) + return -1; + + nameoff = bfd_h_get_32 (abfd, buf + 0); + cmd->timestamp = bfd_h_get_32 (abfd, buf + 4); + cmd->current_version = bfd_h_get_32 (abfd, buf + 8); + cmd->compatibility_version = bfd_h_get_32 (abfd, buf + 12); + + cmd->name_offset = command->offset + nameoff; + cmd->name_len = command->len - nameoff; + + if (command->type == BFD_MACH_O_LC_LOAD_DYLIB) + prefix = "LC_LOAD_DYLIB"; + else if (command->type == BFD_MACH_O_LC_LOAD_WEAK_DYLIB) + prefix = "LC_LOAD_WEAK_DYLIB"; + else if (command->type == BFD_MACH_O_LC_ID_DYLIB) + prefix = "LC_ID_DYLIB"; + else + abort (); + + sname = (char *) bfd_alloc (abfd, strlen (prefix) + 1); + if (sname == NULL) + return -1; + strcpy (sname, prefix); + + bfdsec = bfd_make_section_anyway (abfd, sname); + if (bfdsec == NULL) + return -1; + + bfdsec->vma = 0; + bfdsec->lma = 0; + bfdsec->_raw_size = command->len - 8; + bfdsec->filepos = command->offset + 8; + bfdsec->alignment_power = 0; + bfdsec->flags = SEC_HAS_CONTENTS; + + cmd->section = bfdsec; + + return 0; +} + +static int +bfd_mach_o_scan_read_prebound_dylib (abfd, command) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_mach_o_load_command *command ATTRIBUTE_UNUSED; +{ + /* bfd_mach_o_prebound_dylib_command *cmd = &command->command.prebound_dylib; */ + + BFD_ASSERT (command->type == BFD_MACH_O_LC_PREBOUND_DYLIB); + return 0; +} + +static int +bfd_mach_o_scan_read_thread (abfd, command) + bfd *abfd; + bfd_mach_o_load_command *command; +{ + bfd_mach_o_data_struct *mdata = NULL; + bfd_mach_o_thread_command *cmd = &command->command.thread; + unsigned char buf[8]; + bfd_vma offset; + unsigned int nflavours; + unsigned int i; + + BFD_ASSERT ((command->type == BFD_MACH_O_LC_THREAD) + || (command->type == BFD_MACH_O_LC_UNIXTHREAD)); + + BFD_ASSERT (bfd_mach_o_valid (abfd)); + mdata = abfd->tdata.mach_o_data; + + offset = 8; + nflavours = 0; + while (offset != command->len) + { + if (offset >= command->len) + return -1; + + bfd_seek (abfd, command->offset + offset, SEEK_SET); + + if (bfd_bread ((PTR) buf, 8, abfd) != 8) + return -1; + + offset += 8 + bfd_h_get_32 (abfd, buf + 4) * 4; + nflavours++; + } + + cmd->flavours = + ((bfd_mach_o_thread_flavour *) + bfd_alloc (abfd, nflavours * sizeof (bfd_mach_o_thread_flavour))); + if (cmd->flavours == NULL) + return -1; + cmd->nflavours = nflavours; + + offset = 8; + nflavours = 0; + while (offset != command->len) + { + if (offset >= command->len) + return -1; + + if (nflavours >= cmd->nflavours) + return -1; + + bfd_seek (abfd, command->offset + offset, SEEK_SET); + + if (bfd_bread ((PTR) buf, 8, abfd) != 8) + return -1; + + cmd->flavours[nflavours].flavour = bfd_h_get_32 (abfd, buf); + cmd->flavours[nflavours].offset = command->offset + offset + 8; + cmd->flavours[nflavours].size = bfd_h_get_32 (abfd, buf + 4) * 4; + offset += cmd->flavours[nflavours].size + 8; + nflavours++; + } + + for (i = 0; i < nflavours; i++) + { + asection *bfdsec; + unsigned int snamelen; + char *sname; + const char *flavourstr; + const char *prefix = "LC_THREAD"; + unsigned int j = 0; + + switch (mdata->header.cputype) + { + case BFD_MACH_O_CPU_TYPE_POWERPC: + flavourstr = bfd_mach_o_ppc_flavour_string (cmd->flavours[i].flavour); + break; + case BFD_MACH_O_CPU_TYPE_I386: + flavourstr = bfd_mach_o_i386_flavour_string (cmd->flavours[i].flavour); + break; + default: + flavourstr = "UNKNOWN_ARCHITECTURE"; + break; + } + + snamelen = strlen (prefix) + 1 + 20 + 1 + strlen (flavourstr) + 1; + sname = (char *) bfd_alloc (abfd, snamelen); + if (sname == NULL) + return -1; + + for (;;) + { + sprintf (sname, "%s.%s.%u", prefix, flavourstr, j); + if (bfd_get_section_by_name (abfd, sname) == NULL) + break; + j++; + } + + bfdsec = bfd_make_section (abfd, sname); + + bfdsec->vma = 0; + bfdsec->lma = 0; + bfdsec->_raw_size = cmd->flavours[i].size; + bfdsec->filepos = cmd->flavours[i].offset; + bfdsec->alignment_power = 0x0; + bfdsec->flags = SEC_HAS_CONTENTS; + + cmd->section = bfdsec; + } + + return 0; +} + +static int +bfd_mach_o_scan_write_symtab (abfd, command) + bfd *abfd; + bfd_mach_o_load_command *command; +{ + bfd_mach_o_symtab_command *seg = &command->command.symtab; + unsigned char buf[16]; + + BFD_ASSERT (command->type == BFD_MACH_O_LC_SYMTAB); + + bfd_h_put_32 (abfd, seg->symoff, buf); + bfd_h_put_32 (abfd, seg->nsyms, buf + 4); + bfd_h_put_32 (abfd, seg->stroff, buf + 8); + bfd_h_put_32 (abfd, seg->strsize, buf + 12); + + bfd_seek (abfd, command->offset + 8, SEEK_SET); + if (bfd_bwrite ((PTR) buf, 16, abfd) != 16) + return -1; + + if (bfd_mach_o_scan_write_symtab_symbols (abfd, command) != 0) + return -1; + + return 0; +} + +static int +bfd_mach_o_scan_read_dysymtab (abfd, command) + bfd *abfd; + bfd_mach_o_load_command *command; +{ + bfd_mach_o_dysymtab_command *seg = &command->command.dysymtab; + unsigned char buf[72]; + + BFD_ASSERT (command->type == BFD_MACH_O_LC_DYSYMTAB); + + bfd_seek (abfd, command->offset + 8, SEEK_SET); + if (bfd_bread ((PTR) buf, 72, abfd) != 72) + return -1; + + seg->ilocalsym = bfd_h_get_32 (abfd, buf + 0); + seg->nlocalsym = bfd_h_get_32 (abfd, buf + 4); + seg->iextdefsym = bfd_h_get_32 (abfd, buf + 8); + seg->nextdefsym = bfd_h_get_32 (abfd, buf + 12); + seg->iundefsym = bfd_h_get_32 (abfd, buf + 16); + seg->nundefsym = bfd_h_get_32 (abfd, buf + 20); + seg->tocoff = bfd_h_get_32 (abfd, buf + 24); + seg->ntoc = bfd_h_get_32 (abfd, buf + 28); + seg->modtaboff = bfd_h_get_32 (abfd, buf + 32); + seg->nmodtab = bfd_h_get_32 (abfd, buf + 36); + seg->extrefsymoff = bfd_h_get_32 (abfd, buf + 40); + seg->nextrefsyms = bfd_h_get_32 (abfd, buf + 44); + seg->indirectsymoff = bfd_h_get_32 (abfd, buf + 48); + seg->nindirectsyms = bfd_h_get_32 (abfd, buf + 52); + seg->extreloff = bfd_h_get_32 (abfd, buf + 56); + seg->nextrel = bfd_h_get_32 (abfd, buf + 60); + seg->locreloff = bfd_h_get_32 (abfd, buf + 64); + seg->nlocrel = bfd_h_get_32 (abfd, buf + 68); + + return 0; +} + +static int +bfd_mach_o_scan_read_symtab (abfd, command) + bfd *abfd; + bfd_mach_o_load_command *command; +{ + bfd_mach_o_symtab_command *seg = &command->command.symtab; + unsigned char buf[16]; + asection *bfdsec; + char *sname; + const char *prefix = "LC_SYMTAB.stabs"; + + BFD_ASSERT (command->type == BFD_MACH_O_LC_SYMTAB); + + bfd_seek (abfd, command->offset + 8, SEEK_SET); + if (bfd_bread ((PTR) buf, 16, abfd) != 16) + return -1; + + seg->symoff = bfd_h_get_32 (abfd, buf); + seg->nsyms = bfd_h_get_32 (abfd, buf + 4); + seg->stroff = bfd_h_get_32 (abfd, buf + 8); + seg->strsize = bfd_h_get_32 (abfd, buf + 12); + seg->symbols = NULL; + seg->strtab = NULL; + + sname = (char *) bfd_alloc (abfd, strlen (prefix) + 1); + if (sname == NULL) + return -1; + strcpy (sname, prefix); + + bfdsec = bfd_make_section_anyway (abfd, sname); + if (bfdsec == NULL) + return -1; + + bfdsec->vma = 0; + bfdsec->lma = 0; + bfdsec->_raw_size = seg->nsyms * 12; + bfdsec->filepos = seg->symoff; + bfdsec->alignment_power = 0; + bfdsec->flags = SEC_HAS_CONTENTS; + + seg->stabs_segment = bfdsec; + + prefix = "LC_SYMTAB.stabstr"; + sname = (char *) bfd_alloc (abfd, strlen (prefix) + 1); + if (sname == NULL) + return -1; + strcpy (sname, prefix); + + bfdsec = bfd_make_section_anyway (abfd, sname); + if (bfdsec == NULL) + return -1; + + bfdsec->vma = 0; + bfdsec->lma = 0; + bfdsec->_raw_size = seg->strsize; + bfdsec->filepos = seg->stroff; + bfdsec->alignment_power = 0; + bfdsec->flags = SEC_HAS_CONTENTS; + + seg->stabstr_segment = bfdsec; + + return 0; +} + +static int +bfd_mach_o_scan_read_segment (abfd, command) + bfd *abfd; + bfd_mach_o_load_command *command; +{ + unsigned char buf[48]; + bfd_mach_o_segment_command *seg = &command->command.segment; + unsigned long i; + asection *bfdsec; + char *sname; + const char *prefix = "LC_SEGMENT"; + unsigned int snamelen; + + BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT); + + bfd_seek (abfd, command->offset + 8, SEEK_SET); + if (bfd_bread ((PTR) buf, 48, abfd) != 48) + return -1; + + memcpy (seg->segname, buf, 16); + seg->vmaddr = bfd_h_get_32 (abfd, buf + 16); + seg->vmsize = bfd_h_get_32 (abfd, buf + 20); + seg->fileoff = bfd_h_get_32 (abfd, buf + 24); + seg->filesize = bfd_h_get_32 (abfd, buf + 28); + /* seg->maxprot = bfd_h_get_32 (abfd, buf + 32); */ + /* seg->initprot = bfd_h_get_32 (abfd, buf + 36); */ + seg->nsects = bfd_h_get_32 (abfd, buf + 40); + seg->flags = bfd_h_get_32 (abfd, buf + 44); + + snamelen = strlen (prefix) + 1 + strlen (seg->segname) + 1; + sname = (char *) bfd_alloc (abfd, snamelen); + if (sname == NULL) + return -1; + sprintf (sname, "%s.%s", prefix, seg->segname); + + bfdsec = bfd_make_section_anyway (abfd, sname); + if (bfdsec == NULL) + return -1; + + bfdsec->vma = seg->vmaddr; + bfdsec->lma = seg->vmaddr; + bfdsec->_raw_size = seg->filesize; + bfdsec->filepos = seg->fileoff; + bfdsec->alignment_power = 0x0; + bfdsec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE; + + seg->segment = bfdsec; + + if (seg->nsects != 0) + { + seg->sections = + ((bfd_mach_o_section *) + bfd_alloc (abfd, seg->nsects * sizeof (bfd_mach_o_section))); + if (seg->sections == NULL) + return -1; + + for (i = 0; i < seg->nsects; i++) + { + bfd_vma segoff = command->offset + 48 + 8 + (i * 68); + + if (bfd_mach_o_scan_read_section (abfd, &seg->sections[i], + segoff) != 0) + return -1; + } + } + + return 0; +} + +static int +bfd_mach_o_scan_write_segment (abfd, command) + bfd *abfd; + bfd_mach_o_load_command *command; +{ + unsigned char buf[48]; + bfd_mach_o_segment_command *seg = &command->command.segment; + unsigned long i; + + BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT); + + memcpy (buf, seg->segname, 16); + bfd_h_put_32 (abfd, seg->vmaddr, buf + 16); + bfd_h_put_32 (abfd, seg->vmsize, buf + 20); + bfd_h_put_32 (abfd, seg->fileoff, buf + 24); + bfd_h_put_32 (abfd, seg->filesize, buf + 28); + bfd_h_put_32 (abfd, 0 /* seg->maxprot */, buf + 32); + bfd_h_put_32 (abfd, 0 /* seg->initprot */, buf + 36); + bfd_h_put_32 (abfd, seg->nsects, buf + 40); + bfd_h_put_32 (abfd, seg->flags, buf + 44); + + bfd_seek (abfd, command->offset + 8, SEEK_SET); + if (bfd_bwrite ((PTR) buf, 48, abfd) != 48) + return -1; + + { + char buf[1024]; + bfd_vma nbytes = seg->filesize; + bfd_vma curoff = seg->fileoff; + + while (nbytes > 0) + { + bfd_vma thisread = nbytes; + + if (thisread > 1024) + thisread = 1024; + + bfd_seek (abfd, curoff, SEEK_SET); + if (bfd_bread ((PTR) buf, thisread, abfd) != thisread) + return -1; + + bfd_seek (abfd, curoff, SEEK_SET); + if (bfd_bwrite ((PTR) buf, thisread, abfd) != thisread) + return -1; + + nbytes -= thisread; + curoff += thisread; + } + } + + for (i = 0; i < seg->nsects; i++) + { + bfd_vma segoff = command->offset + 48 + 8 + (i * 68); + + if (bfd_mach_o_scan_write_section (abfd, &seg->sections[i], segoff) != 0) + return -1; + } + + return 0; +} + +static int +bfd_mach_o_scan_read_command (abfd, command) + bfd *abfd; + bfd_mach_o_load_command *command; +{ + unsigned char buf[8]; + + bfd_seek (abfd, command->offset, SEEK_SET); + if (bfd_bread ((PTR) buf, 8, abfd) != 8) + return -1; + + command->type = (bfd_h_get_32 (abfd, buf) & ~BFD_MACH_O_LC_REQ_DYLD); + command->type_required = (bfd_h_get_32 (abfd, buf) & BFD_MACH_O_LC_REQ_DYLD + ? 1 : 0); + command->len = bfd_h_get_32 (abfd, buf + 4); + + switch (command->type) + { + case BFD_MACH_O_LC_SEGMENT: + if (bfd_mach_o_scan_read_segment (abfd, command) != 0) + return -1; + break; + case BFD_MACH_O_LC_SYMTAB: + if (bfd_mach_o_scan_read_symtab (abfd, command) != 0) + return -1; + break; + case BFD_MACH_O_LC_SYMSEG: + break; + case BFD_MACH_O_LC_THREAD: + case BFD_MACH_O_LC_UNIXTHREAD: + if (bfd_mach_o_scan_read_thread (abfd, command) != 0) + return -1; + break; + case BFD_MACH_O_LC_LOAD_DYLINKER: + case BFD_MACH_O_LC_ID_DYLINKER: + if (bfd_mach_o_scan_read_dylinker (abfd, command) != 0) + return -1; + break; + case BFD_MACH_O_LC_LOAD_DYLIB: + case BFD_MACH_O_LC_ID_DYLIB: + case BFD_MACH_O_LC_LOAD_WEAK_DYLIB: + if (bfd_mach_o_scan_read_dylib (abfd, command) != 0) + return -1; + break; + case BFD_MACH_O_LC_PREBOUND_DYLIB: + if (bfd_mach_o_scan_read_prebound_dylib (abfd, command) != 0) + return -1; + break; + case BFD_MACH_O_LC_LOADFVMLIB: + case BFD_MACH_O_LC_IDFVMLIB: + case BFD_MACH_O_LC_IDENT: + case BFD_MACH_O_LC_FVMFILE: + case BFD_MACH_O_LC_PREPAGE: + case BFD_MACH_O_LC_ROUTINES: + case BFD_MACH_O_LC_SUB_FRAMEWORK: + break; + case BFD_MACH_O_LC_DYSYMTAB: + if (bfd_mach_o_scan_read_dysymtab (abfd, command) != 0) + return -1; + break; + case BFD_MACH_O_LC_SUB_UMBRELLA: + case BFD_MACH_O_LC_SUB_CLIENT: + case BFD_MACH_O_LC_SUB_LIBRARY: + case BFD_MACH_O_LC_TWOLEVEL_HINTS: + case BFD_MACH_O_LC_PREBIND_CKSUM: + break; + default: + fprintf (stderr, "unable to read unknown load command 0x%lx\n", + (unsigned long) command->type); + break; + } + + return 0; +} + +static void +bfd_mach_o_flatten_sections (abfd) + bfd *abfd; +{ + bfd_mach_o_data_struct *mdata = abfd->tdata.mach_o_data; + long csect = 0; + unsigned long i, j; + + mdata->nsects = 0; + + for (i = 0; i < mdata->header.ncmds; i++) + { + if (mdata->commands[i].type == BFD_MACH_O_LC_SEGMENT) + { + bfd_mach_o_segment_command *seg; + + seg = &mdata->commands[i].command.segment; + mdata->nsects += seg->nsects; + } + } + + mdata->sections = bfd_alloc (abfd, + mdata->nsects * sizeof (bfd_mach_o_section *)); + csect = 0; + + for (i = 0; i < mdata->header.ncmds; i++) + { + if (mdata->commands[i].type == BFD_MACH_O_LC_SEGMENT) + { + bfd_mach_o_segment_command *seg; + + seg = &mdata->commands[i].command.segment; + BFD_ASSERT (csect + seg->nsects <= mdata->nsects); + + for (j = 0; j < seg->nsects; j++) + mdata->sections[csect++] = &seg->sections[j]; + } + } +} + +int +bfd_mach_o_scan_start_address (abfd) + bfd *abfd; +{ + bfd_mach_o_data_struct *mdata = abfd->tdata.mach_o_data; + bfd_mach_o_thread_command *cmd = NULL; + unsigned long i; + + for (i = 0; i < mdata->header.ncmds; i++) + { + if ((mdata->commands[i].type == BFD_MACH_O_LC_THREAD) || + (mdata->commands[i].type == BFD_MACH_O_LC_UNIXTHREAD)) + { + if (cmd == NULL) + cmd = &mdata->commands[i].command.thread; + else + return 0; + } + } + + if (cmd == NULL) + return 0; + + for (i = 0; i < cmd->nflavours; i++) + { + if ((mdata->header.cputype == BFD_MACH_O_CPU_TYPE_I386) + && (cmd->flavours[i].flavour + == (unsigned long) BFD_MACH_O_i386_THREAD_STATE)) + { + unsigned char buf[4]; + + bfd_seek (abfd, cmd->flavours[i].offset + 40, SEEK_SET); + + if (bfd_bread (buf, 4, abfd) != 4) + return -1; + + abfd->start_address = bfd_h_get_32 (abfd, buf); + } + else if ((mdata->header.cputype == BFD_MACH_O_CPU_TYPE_POWERPC) + && (cmd->flavours[i].flavour == BFD_MACH_O_PPC_THREAD_STATE)) + { + unsigned char buf[4]; + + bfd_seek (abfd, cmd->flavours[i].offset + 0, SEEK_SET); + + if (bfd_bread (buf, 4, abfd) != 4) + return -1; + + abfd->start_address = bfd_h_get_32 (abfd, buf); + } + } + + return 0; +} + +int +bfd_mach_o_scan (abfd, header, mdata) + bfd *abfd; + bfd_mach_o_header *header; + bfd_mach_o_data_struct *mdata; +{ + unsigned int i; + enum bfd_architecture cputype; + unsigned long cpusubtype; + + mdata->header = *header; + mdata->symbols = NULL; + + abfd->flags = (abfd->xvec->object_flags + | (abfd->flags & (BFD_IN_MEMORY | BFD_IO_FUNCS))); + abfd->tdata.mach_o_data = mdata; + + bfd_mach_o_convert_architecture (header->cputype, header->cpusubtype, + &cputype, &cpusubtype); + if (cputype == bfd_arch_unknown) + { + fprintf (stderr, "bfd_mach_o_scan: unknown architecture 0x%lx/0x%lx\n", + header->cputype, header->cpusubtype); + return -1; + } + + bfd_set_arch_mach (abfd, cputype, cpusubtype); + + if (header->ncmds != 0) + { + mdata->commands = + ((bfd_mach_o_load_command *) + bfd_alloc (abfd, header->ncmds * sizeof (bfd_mach_o_load_command))); + if (mdata->commands == NULL) + return -1; + + for (i = 0; i < header->ncmds; i++) + { + bfd_mach_o_load_command *cur = &mdata->commands[i]; + + if (i == 0) + cur->offset = 28; + else + { + bfd_mach_o_load_command *prev = &mdata->commands[i - 1]; + cur->offset = prev->offset + prev->len; + } + + if (bfd_mach_o_scan_read_command (abfd, cur) < 0) + return -1; + } + } + + if (bfd_mach_o_scan_start_address (abfd) < 0) + { +#if 0 + fprintf (stderr, "bfd_mach_o_scan: unable to scan start address: %s\n", + bfd_errmsg (bfd_get_error ())); + abfd->tdata.mach_o_data = NULL; + return -1; +#endif + } + + bfd_mach_o_flatten_sections (abfd); + + return 0; +} + +bfd_boolean +bfd_mach_o_mkobject (abfd) + bfd *abfd; +{ + bfd_mach_o_data_struct *mdata = NULL; + + mdata = ((bfd_mach_o_data_struct *) + bfd_alloc (abfd, sizeof (bfd_mach_o_data_struct))); + if (mdata == NULL) + return FALSE; + abfd->tdata.mach_o_data = mdata; + + mdata->header.magic = 0; + mdata->header.cputype = 0; + mdata->header.cpusubtype = 0; + mdata->header.filetype = 0; + mdata->header.ncmds = 0; + mdata->header.sizeofcmds = 0; + mdata->header.flags = 0; + mdata->header.byteorder = BFD_ENDIAN_UNKNOWN; + mdata->commands = NULL; + mdata->nsymbols = 0; + mdata->symbols = NULL; + mdata->nsects = 0; + mdata->sections = NULL; + mdata->ibfd = NULL; + + return TRUE; +} + +const bfd_target * +bfd_mach_o_object_p (abfd) + bfd *abfd; +{ + struct bfd_preserve preserve; + bfd_mach_o_header header; + + preserve.marker = NULL; + if (bfd_mach_o_read_header (abfd, &header) != 0) + goto wrong; + + if (! (header.byteorder == BFD_ENDIAN_BIG + || header.byteorder == BFD_ENDIAN_LITTLE)) + { + fprintf (stderr, "unknown header byte-order value 0x%lx\n", + (long) header.byteorder); + goto wrong; + } + + if (! ((header.byteorder == BFD_ENDIAN_BIG + && abfd->xvec->byteorder == BFD_ENDIAN_BIG + && abfd->xvec->header_byteorder == BFD_ENDIAN_BIG) + || (header.byteorder == BFD_ENDIAN_LITTLE + && abfd->xvec->byteorder == BFD_ENDIAN_LITTLE + && abfd->xvec->header_byteorder == BFD_ENDIAN_LITTLE))) + goto wrong; + + preserve.marker = bfd_zalloc (abfd, sizeof (bfd_mach_o_data_struct)); + if (preserve.marker == NULL + || !bfd_preserve_save (abfd, &preserve)) + goto fail; + + if (bfd_mach_o_scan (abfd, &header, + (bfd_mach_o_data_struct *) preserve.marker) != 0) + goto wrong; + + bfd_preserve_finish (abfd, &preserve); + return abfd->xvec; + + wrong: + bfd_set_error (bfd_error_wrong_format); + + fail: + if (preserve.marker != NULL) + bfd_preserve_restore (abfd, &preserve); + return NULL; +} + +const bfd_target * +bfd_mach_o_core_p (abfd) + bfd *abfd; +{ + struct bfd_preserve preserve; + bfd_mach_o_header header; + + preserve.marker = NULL; + if (bfd_mach_o_read_header (abfd, &header) != 0) + goto wrong; + + if (! (header.byteorder == BFD_ENDIAN_BIG + || header.byteorder == BFD_ENDIAN_LITTLE)) + { + fprintf (stderr, "unknown header byte-order value 0x%lx\n", + (long) header.byteorder); + abort (); + } + + if (! ((header.byteorder == BFD_ENDIAN_BIG + && abfd->xvec->byteorder == BFD_ENDIAN_BIG + && abfd->xvec->header_byteorder == BFD_ENDIAN_BIG) + || (header.byteorder == BFD_ENDIAN_LITTLE + && abfd->xvec->byteorder == BFD_ENDIAN_LITTLE + && abfd->xvec->header_byteorder == BFD_ENDIAN_LITTLE))) + goto wrong; + + if (header.filetype != BFD_MACH_O_MH_CORE) + goto wrong; + + preserve.marker = bfd_zalloc (abfd, sizeof (bfd_mach_o_data_struct)); + if (preserve.marker == NULL + || !bfd_preserve_save (abfd, &preserve)) + goto fail; + + if (bfd_mach_o_scan (abfd, &header, + (bfd_mach_o_data_struct *) preserve.marker) != 0) + goto wrong; + + bfd_preserve_finish (abfd, &preserve); + return abfd->xvec; + + wrong: + bfd_set_error (bfd_error_wrong_format); + + fail: + if (preserve.marker != NULL) + bfd_preserve_restore (abfd, &preserve); + return NULL; +} + +typedef struct mach_o_fat_archentry +{ + unsigned long cputype; + unsigned long cpusubtype; + unsigned long offset; + unsigned long size; + unsigned long align; + bfd *abfd; +} mach_o_fat_archentry; + +typedef struct mach_o_fat_data_struct +{ + unsigned long magic; + unsigned long nfat_arch; + mach_o_fat_archentry *archentries; +} mach_o_fat_data_struct; + +const bfd_target * +bfd_mach_o_archive_p (abfd) + bfd *abfd; +{ + mach_o_fat_data_struct *adata = NULL; + unsigned char buf[20]; + unsigned long i; + + bfd_seek (abfd, 0, SEEK_SET); + if (bfd_bread ((PTR) buf, 8, abfd) != 8) + goto error; + + adata = (mach_o_fat_data_struct *) + bfd_alloc (abfd, sizeof (mach_o_fat_data_struct)); + if (adata == NULL) + goto error; + + adata->magic = bfd_getb32 (buf); + adata->nfat_arch = bfd_getb32 (buf + 4); + if (adata->magic != 0xcafebabe) + goto error; + + adata->archentries = (mach_o_fat_archentry *) + bfd_alloc (abfd, adata->nfat_arch * sizeof (mach_o_fat_archentry)); + if (adata->archentries == NULL) + goto error; + + for (i = 0; i < adata->nfat_arch; i++) + { + bfd_seek (abfd, 8 + 20 * i, SEEK_SET); + + if (bfd_bread ((PTR) buf, 20, abfd) != 20) + goto error; + adata->archentries[i].cputype = bfd_getb32 (buf); + adata->archentries[i].cpusubtype = bfd_getb32 (buf + 4); + adata->archentries[i].offset = bfd_getb32 (buf + 8); + adata->archentries[i].size = bfd_getb32 (buf + 12); + adata->archentries[i].align = bfd_getb32 (buf + 16); + adata->archentries[i].abfd = NULL; + } + + abfd->tdata.mach_o_fat_data = adata; + return abfd->xvec; + + error: + if (adata != NULL) + bfd_release (abfd, adata); + bfd_set_error (bfd_error_wrong_format); + return NULL; +} + +bfd * +bfd_mach_o_openr_next_archived_file (archive, prev) + bfd *archive; + bfd *prev; +{ + mach_o_fat_data_struct *adata; + mach_o_fat_archentry *entry = NULL; + unsigned long i; + + adata = (mach_o_fat_data_struct *) archive->tdata.mach_o_fat_data; + BFD_ASSERT (adata != NULL); + + /* Find index of previous entry. */ + if (prev == NULL) + i = 0; /* Start at first one. */ + else + { + for (i = 0; i < adata->nfat_arch; i++) + { + if (adata->archentries[i].abfd == prev) + break; + } + + if (i == adata->nfat_arch) + { + /* Not found. */ + bfd_set_error (bfd_error_bad_value); + return NULL; + } + i++; /* Get next entry. */ + } + + if (i >= adata->nfat_arch) + { + bfd_set_error (bfd_error_no_more_archived_files); + return NULL; + } + + entry = &adata->archentries[i]; + if (entry->abfd == NULL) + { + bfd *nbfd = _bfd_new_bfd_contained_in (archive); + char *s = NULL; + + if (nbfd == NULL) + return NULL; + + nbfd->origin = entry->offset; + s = bfd_malloc (strlen (archive->filename) + 1); + if (s == NULL) + return NULL; + strcpy (s, archive->filename); + nbfd->filename = s; + nbfd->iostream = NULL; + entry->abfd = nbfd; + } + + return entry->abfd; +} + +int +bfd_mach_o_lookup_section (abfd, section, mcommand, msection) + bfd *abfd; + asection *section; + bfd_mach_o_load_command **mcommand; + bfd_mach_o_section **msection; +{ + struct mach_o_data_struct *md = abfd->tdata.mach_o_data; + unsigned int i, j, num; + + bfd_mach_o_load_command *ncmd = NULL; + bfd_mach_o_section *nsect = NULL; + + BFD_ASSERT (mcommand != NULL); + BFD_ASSERT (msection != NULL); + + num = 0; + for (i = 0; i < md->header.ncmds; i++) + { + struct bfd_mach_o_load_command *cmd = &md->commands[i]; + struct bfd_mach_o_segment_command *seg = NULL; + + if (cmd->type != BFD_MACH_O_LC_SEGMENT) + continue; + seg = &cmd->command.segment; + + if (seg->segment == section) + { + if (num == 0) + ncmd = cmd; + num++; + } + + for (j = 0; j < seg->nsects; j++) + { + struct bfd_mach_o_section *sect = &seg->sections[j]; + + if (sect->bfdsection == section) + { + if (num == 0) + nsect = sect; + num++; + } + } + } + + *mcommand = ncmd; + *msection = nsect; + return num; +} + +int +bfd_mach_o_lookup_command (abfd, type, mcommand) + bfd *abfd; + bfd_mach_o_load_command_type type; + bfd_mach_o_load_command **mcommand; +{ + struct mach_o_data_struct *md = NULL; + bfd_mach_o_load_command *ncmd = NULL; + unsigned int i, num; + + md = abfd->tdata.mach_o_data; + + BFD_ASSERT (md != NULL); + BFD_ASSERT (mcommand != NULL); + + num = 0; + for (i = 0; i < md->header.ncmds; i++) + { + struct bfd_mach_o_load_command *cmd = &md->commands[i]; + + if (cmd->type != type) + continue; + + if (num == 0) + ncmd = cmd; + num++; + } + + *mcommand = ncmd; + return num; +} + +unsigned long +bfd_mach_o_stack_addr (type) + enum bfd_mach_o_cpu_type type; +{ + switch (type) + { + case BFD_MACH_O_CPU_TYPE_MC680x0: + return 0x04000000; + case BFD_MACH_O_CPU_TYPE_MC88000: + return 0xffffe000; + case BFD_MACH_O_CPU_TYPE_POWERPC: + return 0xc0000000; + case BFD_MACH_O_CPU_TYPE_I386: + return 0xc0000000; + case BFD_MACH_O_CPU_TYPE_SPARC: + return 0xf0000000; + case BFD_MACH_O_CPU_TYPE_I860: + return 0; + case BFD_MACH_O_CPU_TYPE_HPPA: + return 0xc0000000 - 0x04000000; + default: + return 0; + } +} + +int +bfd_mach_o_core_fetch_environment (abfd, rbuf, rlen) + bfd *abfd; + unsigned char **rbuf; + unsigned int *rlen; +{ + bfd_mach_o_data_struct *mdata = abfd->tdata.mach_o_data; + unsigned long stackaddr = bfd_mach_o_stack_addr (mdata->header.cputype); + unsigned int i = 0; + + for (i = 0; i < mdata->header.ncmds; i++) + { + bfd_mach_o_load_command *cur = &mdata->commands[i]; + bfd_mach_o_segment_command *seg = NULL; + + if (cur->type != BFD_MACH_O_LC_SEGMENT) + continue; + + seg = &cur->command.segment; + + if ((seg->vmaddr + seg->vmsize) == stackaddr) + { + unsigned long start = seg->fileoff; + unsigned long end = seg->fileoff + seg->filesize; + unsigned char *buf = bfd_malloc (1024); + unsigned long size = 1024; + + for (;;) + { + bfd_size_type nread = 0; + unsigned long offset; + int found_nonnull = 0; + + if (size > (end - start)) + size = (end - start); + + buf = bfd_realloc (buf, size); + + bfd_seek (abfd, end - size, SEEK_SET); + nread = bfd_bread (buf, size, abfd); + + if (nread != size) + return -1; + + for (offset = 4; offset <= size; offset += 4) + { + unsigned long val; + + val = *((unsigned long *) (buf + size - offset)); + if (! found_nonnull) + { + if (val != 0) + found_nonnull = 1; + } + else if (val == 0x0) + { + unsigned long bottom; + unsigned long top; + + bottom = seg->fileoff + seg->filesize - offset; + top = seg->fileoff + seg->filesize - 4; + *rbuf = bfd_malloc (top - bottom); + *rlen = top - bottom; + + memcpy (*rbuf, buf + size - *rlen, *rlen); + return 0; + } + } + + if (size == (end - start)) + break; + + size *= 2; + } + } + } + + return -1; +} + +char * +bfd_mach_o_core_file_failing_command (abfd) + bfd *abfd; +{ + unsigned char *buf = NULL; + unsigned int len = 0; + int ret = -1; + + ret = bfd_mach_o_core_fetch_environment (abfd, &buf, &len); + if (ret < 0) + return NULL; + + return buf; +} + +int +bfd_mach_o_core_file_failing_signal (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ + return 0; +} + +bfd_boolean +bfd_mach_o_core_file_matches_executable_p (core_bfd, exec_bfd) + bfd *core_bfd ATTRIBUTE_UNUSED; + bfd *exec_bfd ATTRIBUTE_UNUSED; +{ + return TRUE; +} + +#define TARGET_NAME mach_o_be_vec +#define TARGET_STRING "mach-o-be" +#define TARGET_BIG_ENDIAN 1 +#define TARGET_ARCHIVE 0 + +#include "mach-o-target.c" + +#undef TARGET_NAME +#undef TARGET_STRING +#undef TARGET_BIG_ENDIAN +#undef TARGET_ARCHIVE + +#define TARGET_NAME mach_o_le_vec +#define TARGET_STRING "mach-o-le" +#define TARGET_BIG_ENDIAN 0 +#define TARGET_ARCHIVE 0 + +#include "mach-o-target.c" + +#undef TARGET_NAME +#undef TARGET_STRING +#undef TARGET_BIG_ENDIAN +#undef TARGET_ARCHIVE + +#define TARGET_NAME mach_o_fat_vec +#define TARGET_STRING "mach-o-fat" +#define TARGET_BIG_ENDIAN 1 +#define TARGET_ARCHIVE 1 + +#include "mach-o-target.c" + +#undef TARGET_NAME +#undef TARGET_STRING +#undef TARGET_BIG_ENDIAN +#undef TARGET_ARCHIVE diff --git a/bfd/mach-o.h b/bfd/mach-o.h new file mode 100644 index 0000000000000..1f7dd604dbf21 --- /dev/null +++ b/bfd/mach-o.h @@ -0,0 +1,511 @@ +/* Mach-O support for BFD. + Copyright 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#ifndef _BFD_MACH_O_H_ +#define _BFD_MACH_O_H_ + +#include "bfd.h" + +#define BFD_MACH_O_N_STAB 0xe0 /* If any of these bits set, a symbolic debugging entry. */ +#define BFD_MACH_O_N_PEXT 0x10 /* Private external symbol bit. */ +#define BFD_MACH_O_N_TYPE 0x0e /* Mask for the type bits. */ +#define BFD_MACH_O_N_EXT 0x01 /* External symbol bit, set for external symbols. */ +#define BFD_MACH_O_N_UNDF 0x00 /* Undefined, n_sect == NO_SECT. */ +#define BFD_MACH_O_N_ABS 0x02 /* Absolute, n_sect == NO_SECT. */ +#define BFD_MACH_O_N_SECT 0x0e /* Defined in section number n_sect. */ +#define BFD_MACH_O_N_PBUD 0x0c /* Prebound undefined (defined in a dylib). */ +#define BFD_MACH_O_N_INDR 0x0a /* Indirect. */ + +typedef enum bfd_mach_o_ppc_thread_flavour + { + BFD_MACH_O_PPC_THREAD_STATE = 1, + BFD_MACH_O_PPC_FLOAT_STATE = 2, + BFD_MACH_O_PPC_EXCEPTION_STATE = 3, + BFD_MACH_O_PPC_VECTOR_STATE = 4 + } +bfd_mach_o_ppc_thread_flavour; + +typedef enum bfd_mach_o_i386_thread_flavour + { + BFD_MACH_O_i386_NEW_THREAD_STATE = 1, + BFD_MACH_O_i386_FLOAT_STATE = 2, + BFD_MACH_O_i386_ISA_PORT_MAP_STATE = 3, + BFD_MACH_O_i386_V86_ASSIST_STATE = 4, + BFD_MACH_O_i386_REGS_SEGS_STATE = 5, + BFD_MACH_O_i386_THREAD_SYSCALL_STATE = 6, + BFD_MACH_O_i386_THREAD_STATE_NONE = 7, + BFD_MACH_O_i386_SAVED_STATE = 8, + BFD_MACH_O_i386_THREAD_STATE = -1, + BFD_MACH_O_i386_THREAD_FPSTATE = -2, + BFD_MACH_O_i386_THREAD_EXCEPTSTATE = -3, + BFD_MACH_O_i386_THREAD_CTHREADSTATE = -4, + } +bfd_mach_o_i386_thread_flavour; + +#define BFD_MACH_O_LC_REQ_DYLD 0x80000000 + +typedef enum bfd_mach_o_load_command_type + { + BFD_MACH_O_LC_SEGMENT = 0x1, /* File segment to be mapped. */ + BFD_MACH_O_LC_SYMTAB = 0x2, /* Link-edit stab symbol table info (obsolete). */ + BFD_MACH_O_LC_SYMSEG = 0x3, /* Link-edit gdb symbol table info. */ + BFD_MACH_O_LC_THREAD = 0x4, /* Thread. */ + BFD_MACH_O_LC_UNIXTHREAD = 0x5, /* UNIX thread (includes a stack). */ + BFD_MACH_O_LC_LOADFVMLIB = 0x6, /* Load a fixed VM shared library. */ + BFD_MACH_O_LC_IDFVMLIB = 0x7, /* Fixed VM shared library id. */ + BFD_MACH_O_LC_IDENT = 0x8, /* Object identification information (obsolete). */ + BFD_MACH_O_LC_FVMFILE = 0x9, /* Fixed VM file inclusion. */ + BFD_MACH_O_LC_PREPAGE = 0xa, /* Prepage command (internal use). */ + BFD_MACH_O_LC_DYSYMTAB = 0xb, /* Dynamic link-edit symbol table info. */ + BFD_MACH_O_LC_LOAD_DYLIB = 0xc, /* Load a dynamically linked shared library. */ + BFD_MACH_O_LC_ID_DYLIB = 0xd, /* Dynamically linked shared lib identification. */ + BFD_MACH_O_LC_LOAD_DYLINKER = 0xe, /* Load a dynamic linker. */ + BFD_MACH_O_LC_ID_DYLINKER = 0xf, /* Dynamic linker identification. */ + BFD_MACH_O_LC_PREBOUND_DYLIB = 0x10,/* Modules prebound for a dynamically. */ + BFD_MACH_O_LC_ROUTINES = 0x11, /* Image routines. */ + BFD_MACH_O_LC_SUB_FRAMEWORK = 0x12, /* Sub framework. */ + BFD_MACH_O_LC_SUB_UMBRELLA = 0x13, /* Sub umbrella. */ + BFD_MACH_O_LC_SUB_CLIENT = 0x14, /* Sub client. */ + BFD_MACH_O_LC_SUB_LIBRARY = 0x15, /* Sub library. */ + BFD_MACH_O_LC_TWOLEVEL_HINTS = 0x16,/* Two-level namespace lookup hints. */ + BFD_MACH_O_LC_PREBIND_CKSUM = 0x17, /* Prebind checksum. */ + /* Load a dynamically linked shared library that is allowed to be + missing (weak). */ + BFD_MACH_O_LC_LOAD_WEAK_DYLIB = 0x18 + } +bfd_mach_o_load_command_type; + +typedef enum bfd_mach_o_cpu_type + { + BFD_MACH_O_CPU_TYPE_VAX = 1, + BFD_MACH_O_CPU_TYPE_MC680x0 = 6, + BFD_MACH_O_CPU_TYPE_I386 = 7, + BFD_MACH_O_CPU_TYPE_MIPS = 8, + BFD_MACH_O_CPU_TYPE_MC98000 = 10, + BFD_MACH_O_CPU_TYPE_HPPA = 11, + BFD_MACH_O_CPU_TYPE_ARM = 12, + BFD_MACH_O_CPU_TYPE_MC88000 = 13, + BFD_MACH_O_CPU_TYPE_SPARC = 14, + BFD_MACH_O_CPU_TYPE_I860 = 15, + BFD_MACH_O_CPU_TYPE_ALPHA = 16, + BFD_MACH_O_CPU_TYPE_POWERPC = 18 + } +bfd_mach_o_cpu_type; + +typedef enum bfd_mach_o_filetype + { + BFD_MACH_O_MH_OBJECT = 1, + BFD_MACH_O_MH_EXECUTE = 2, + BFD_MACH_O_MH_FVMLIB = 3, + BFD_MACH_O_MH_CORE = 4, + BFD_MACH_O_MH_PRELOAD = 5, + BFD_MACH_O_MH_DYLIB = 6, + BFD_MACH_O_MH_DYLINKER = 7, + BFD_MACH_O_MH_BUNDLE = 8 + } +bfd_mach_o_filetype; + +/* Constants for the type of a section. */ + +typedef enum bfd_mach_o_section_type + { + /* Regular section. */ + BFD_MACH_O_S_REGULAR = 0x0, + + /* Zero fill on demand section. */ + BFD_MACH_O_S_ZEROFILL = 0x1, + + /* Section with only literal C strings. */ + BFD_MACH_O_S_CSTRING_LITERALS = 0x2, + + /* Section with only 4 byte literals. */ + BFD_MACH_O_S_4BYTE_LITERALS = 0x3, + + /* Section with only 8 byte literals. */ + BFD_MACH_O_S_8BYTE_LITERALS = 0x4, + + /* Section with only pointers to literals. */ + BFD_MACH_O_S_LITERAL_POINTERS = 0x5, + + /* For the two types of symbol pointers sections and the symbol stubs + section they have indirect symbol table entries. For each of the + entries in the section the indirect symbol table entries, in + corresponding order in the indirect symbol table, start at the index + stored in the reserved1 field of the section structure. Since the + indirect symbol table entries correspond to the entries in the + section the number of indirect symbol table entries is inferred from + the size of the section divided by the size of the entries in the + section. For symbol pointers sections the size of the entries in + the section is 4 bytes and for symbol stubs sections the byte size + of the stubs is stored in the reserved2 field of the section + structure. */ + + /* Section with only non-lazy symbol pointers. */ + BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS = 0x6, + + /* Section with only lazy symbol pointers. */ + BFD_MACH_O_S_LAZY_SYMBOL_POINTERS = 0x7, + + /* Section with only symbol stubs, byte size of stub in the reserved2 field. */ + BFD_MACH_O_S_SYMBOL_STUBS = 0x8, + + /* Section with only function pointers for initialization. */ + BFD_MACH_O_S_MOD_INIT_FUNC_POINTERS = 0x9 + } +bfd_mach_o_section_type; + +typedef unsigned long bfd_mach_o_cpu_subtype; + +typedef struct bfd_mach_o_header +{ + unsigned long magic; + unsigned long cputype; + unsigned long cpusubtype; + unsigned long filetype; + unsigned long ncmds; + unsigned long sizeofcmds; + unsigned long flags; + enum bfd_endian byteorder; +} +bfd_mach_o_header; + +typedef struct bfd_mach_o_section +{ + asection *bfdsection; + char sectname[16 + 1]; + char segname[16 + 1]; + bfd_vma addr; + bfd_vma size; + bfd_vma offset; + unsigned long align; + bfd_vma reloff; + unsigned long nreloc; + unsigned long flags; + unsigned long reserved1; + unsigned long reserved2; +} +bfd_mach_o_section; + +typedef struct bfd_mach_o_segment_command +{ + char segname[16]; + bfd_vma vmaddr; + bfd_vma vmsize; + bfd_vma fileoff; + unsigned long filesize; + unsigned long nsects; + unsigned long flags; + bfd_mach_o_section *sections; + asection *segment; +} +bfd_mach_o_segment_command; + +typedef struct bfd_mach_o_symtab_command +{ + unsigned long symoff; + unsigned long nsyms; + unsigned long stroff; + unsigned long strsize; + asymbol *symbols; + char *strtab; + asection *stabs_segment; + asection *stabstr_segment; +} +bfd_mach_o_symtab_command; + +/* This is the second set of the symbolic information which is used to support + the data structures for the dynamically link editor. + + The original set of symbolic information in the symtab_command which contains + the symbol and string tables must also be present when this load command is + present. When this load command is present the symbol table is organized + into three groups of symbols: + local symbols (static and debugging symbols) - grouped by module + defined external symbols - grouped by module (sorted by name if not lib) + undefined external symbols (sorted by name) + In this load command there are offsets and counts to each of the three groups + of symbols. + + This load command contains a the offsets and sizes of the following new + symbolic information tables: + table of contents + module table + reference symbol table + indirect symbol table + The first three tables above (the table of contents, module table and + reference symbol table) are only present if the file is a dynamically linked + shared library. For executable and object modules, which are files + containing only one module, the information that would be in these three + tables is determined as follows: + table of contents - the defined external symbols are sorted by name + module table - the file contains only one module so everything in the + file is part of the module. + reference symbol table - is the defined and undefined external symbols + + For dynamically linked shared library files this load command also contains + offsets and sizes to the pool of relocation entries for all sections + separated into two groups: + external relocation entries + local relocation entries + For executable and object modules the relocation entries continue to hang + off the section structures. */ + +typedef struct bfd_mach_o_dysymtab_command +{ + /* The symbols indicated by symoff and nsyms of the LC_SYMTAB load command + are grouped into the following three groups: + local symbols (further grouped by the module they are from) + defined external symbols (further grouped by the module they are from) + undefined symbols + + The local symbols are used only for debugging. The dynamic binding + process may have to use them to indicate to the debugger the local + symbols for a module that is being bound. + + The last two groups are used by the dynamic binding process to do the + binding (indirectly through the module table and the reference symbol + table when this is a dynamically linked shared library file). */ + + unsigned long ilocalsym; /* Index to local symbols. */ + unsigned long nlocalsym; /* Number of local symbols. */ + unsigned long iextdefsym; /* Index to externally defined symbols. */ + unsigned long nextdefsym; /* Number of externally defined symbols. */ + unsigned long iundefsym; /* Index to undefined symbols. */ + unsigned long nundefsym; /* Number of undefined symbols. */ + + /* For the for the dynamic binding process to find which module a symbol + is defined in the table of contents is used (analogous to the ranlib + structure in an archive) which maps defined external symbols to modules + they are defined in. This exists only in a dynamically linked shared + library file. For executable and object modules the defined external + symbols are sorted by name and is use as the table of contents. */ + + unsigned long tocoff; /* File offset to table of contents. */ + unsigned long ntoc; /* Number of entries in table of contents. */ + + /* To support dynamic binding of "modules" (whole object files) the symbol + table must reflect the modules that the file was created from. This is + done by having a module table that has indexes and counts into the merged + tables for each module. The module structure that these two entries + refer to is described below. This exists only in a dynamically linked + shared library file. For executable and object modules the file only + contains one module so everything in the file belongs to the module. */ + + unsigned long modtaboff; /* File offset to module table. */ + unsigned long nmodtab; /* Number of module table entries. */ + + /* To support dynamic module binding the module structure for each module + indicates the external references (defined and undefined) each module + makes. For each module there is an offset and a count into the + reference symbol table for the symbols that the module references. + This exists only in a dynamically linked shared library file. For + executable and object modules the defined external symbols and the + undefined external symbols indicates the external references. */ + + unsigned long extrefsymoff; /* Offset to referenced symbol table. */ + unsigned long nextrefsyms; /* Number of referenced symbol table entries. */ + + /* The sections that contain "symbol pointers" and "routine stubs" have + indexes and (implied counts based on the size of the section and fixed + size of the entry) into the "indirect symbol" table for each pointer + and stub. For every section of these two types the index into the + indirect symbol table is stored in the section header in the field + reserved1. An indirect symbol table entry is simply a 32bit index into + the symbol table to the symbol that the pointer or stub is referring to. + The indirect symbol table is ordered to match the entries in the section. */ + + unsigned long indirectsymoff; /* File offset to the indirect symbol table. */ + unsigned long nindirectsyms; /* Number of indirect symbol table entries. */ + + /* To support relocating an individual module in a library file quickly the + external relocation entries for each module in the library need to be + accessed efficiently. Since the relocation entries can't be accessed + through the section headers for a library file they are separated into + groups of local and external entries further grouped by module. In this + case the presents of this load command who's extreloff, nextrel, + locreloff and nlocrel fields are non-zero indicates that the relocation + entries of non-merged sections are not referenced through the section + structures (and the reloff and nreloc fields in the section headers are + set to zero). + + Since the relocation entries are not accessed through the section headers + this requires the r_address field to be something other than a section + offset to identify the item to be relocated. In this case r_address is + set to the offset from the vmaddr of the first LC_SEGMENT command. + + The relocation entries are grouped by module and the module table + entries have indexes and counts into them for the group of external + relocation entries for that the module. + + For sections that are merged across modules there must not be any + remaining external relocation entries for them (for merged sections + remaining relocation entries must be local). */ + + unsigned long extreloff; /* Offset to external relocation entries. */ + unsigned long nextrel; /* Number of external relocation entries. */ + + /* All the local relocation entries are grouped together (they are not + grouped by their module since they are only used if the object is moved + from it statically link edited address). */ + + unsigned long locreloff; /* Offset to local relocation entries. */ + unsigned long nlocrel; /* Number of local relocation entries. */ +} +bfd_mach_o_dysymtab_command; + +/* An indirect symbol table entry is simply a 32bit index into the symbol table + to the symbol that the pointer or stub is refering to. Unless it is for a + non-lazy symbol pointer section for a defined symbol which strip(1) as + removed. In which case it has the value INDIRECT_SYMBOL_LOCAL. If the + symbol was also absolute INDIRECT_SYMBOL_ABS is or'ed with that. */ + +#define INDIRECT_SYMBOL_LOCAL 0x80000000 +#define INDIRECT_SYMBOL_ABS 0x40000000 + +typedef struct bfd_mach_o_thread_flavour +{ + unsigned long flavour; + bfd_vma offset; + unsigned long size; +} +bfd_mach_o_thread_flavour; + +typedef struct bfd_mach_o_thread_command +{ + unsigned long nflavours; + bfd_mach_o_thread_flavour *flavours; + asection *section; +} +bfd_mach_o_thread_command; + +typedef struct bfd_mach_o_dylinker_command +{ + unsigned long cmd; /* LC_ID_DYLIB or LC_LOAD_DYLIB. */ + unsigned long cmdsize; /* Includes pathname string. */ + unsigned long name_offset; /* Offset to library's path name. */ + unsigned long name_len; /* Offset to library's path name. */ + asection *section; +} +bfd_mach_o_dylinker_command; + +typedef struct bfd_mach_o_dylib_command +{ + unsigned long cmd; /* LC_ID_DYLIB or LC_LOAD_DYLIB. */ + unsigned long cmdsize; /* Includes pathname string. */ + unsigned long name_offset; /* Offset to library's path name. */ + unsigned long name_len; /* Offset to library's path name. */ + unsigned long timestamp; /* Library's build time stamp. */ + unsigned long current_version; /* Library's current version number. */ + unsigned long compatibility_version; /* Library's compatibility vers number. */ + asection *section; +} +bfd_mach_o_dylib_command; + +typedef struct bfd_mach_o_prebound_dylib_command +{ + unsigned long cmd; /* LC_PREBOUND_DYLIB. */ + unsigned long cmdsize; /* Includes strings. */ + unsigned long name; /* Library's path name. */ + unsigned long nmodules; /* Number of modules in library. */ + unsigned long linked_modules; /* Bit vector of linked modules. */ + asection *section; +} +bfd_mach_o_prebound_dylib_command; + +typedef struct bfd_mach_o_load_command +{ + bfd_mach_o_load_command_type type; + unsigned int type_required; + bfd_vma offset; + bfd_vma len; + union + { + bfd_mach_o_segment_command segment; + bfd_mach_o_symtab_command symtab; + bfd_mach_o_dysymtab_command dysymtab; + bfd_mach_o_thread_command thread; + bfd_mach_o_dylib_command dylib; + bfd_mach_o_dylinker_command dylinker; + bfd_mach_o_prebound_dylib_command prebound_dylib; + } + command; +} +bfd_mach_o_load_command; + +typedef struct mach_o_data_struct +{ + bfd_mach_o_header header; + bfd_mach_o_load_command *commands; + unsigned long nsymbols; + asymbol *symbols; + unsigned long nsects; + bfd_mach_o_section **sections; + bfd *ibfd; +} +mach_o_data_struct; + +typedef struct mach_o_data_struct bfd_mach_o_data_struct; + +bfd_boolean bfd_mach_o_valid + PARAMS ((bfd *)); +int bfd_mach_o_scan_read_symtab_symbol + PARAMS ((bfd *, bfd_mach_o_symtab_command *, asymbol *, unsigned long)); +int bfd_mach_o_scan_read_symtab_strtab + PARAMS ((bfd *, bfd_mach_o_symtab_command *)); +int bfd_mach_o_scan_read_symtab_symbols + PARAMS ((bfd *, bfd_mach_o_symtab_command *)); +int bfd_mach_o_scan_read_dysymtab_symbol + PARAMS ((bfd *, bfd_mach_o_dysymtab_command *, bfd_mach_o_symtab_command *, + asymbol *, unsigned long)); +int bfd_mach_o_scan_start_address + PARAMS ((bfd *)); +int bfd_mach_o_scan + PARAMS ((bfd *, bfd_mach_o_header *, bfd_mach_o_data_struct *)); +bfd_boolean bfd_mach_o_mkobject + PARAMS ((bfd *)); +const bfd_target * bfd_mach_o_object_p + PARAMS ((bfd *)); +const bfd_target * bfd_mach_o_core_p + PARAMS ((bfd *)); +const bfd_target * bfd_mach_o_archive_p + PARAMS ((bfd *)); +bfd * bfd_mach_o_openr_next_archived_file + PARAMS ((bfd *, bfd *)); +int bfd_mach_o_lookup_section + PARAMS ((bfd *, asection *, bfd_mach_o_load_command **, + bfd_mach_o_section **)); +int bfd_mach_o_lookup_command + PARAMS ((bfd *, bfd_mach_o_load_command_type, bfd_mach_o_load_command **)); +unsigned long bfd_mach_o_stack_addr + PARAMS ((enum bfd_mach_o_cpu_type)); +int bfd_mach_o_core_fetch_environment + PARAMS ((bfd *, unsigned char **, unsigned int *)); +char * bfd_mach_o_core_file_failing_command + PARAMS ((bfd *)); +int bfd_mach_o_core_file_failing_signal + PARAMS ((bfd *)); +bfd_boolean bfd_mach_o_core_file_matches_executable_p + PARAMS ((bfd *, bfd *)); + +extern const bfd_target mach_o_be_vec; +extern const bfd_target mach_o_le_vec; +extern const bfd_target mach_o_fat_vec; + +#endif /* _BFD_MACH_O_H_ */ diff --git a/bfd/makefile.vms b/bfd/makefile.vms new file mode 100644 index 0000000000000..ad6b1fff92ace --- /dev/null +++ b/bfd/makefile.vms @@ -0,0 +1,75 @@ +# +# Makefile for bfd library under openVMS (Alpha and Vax) +# +# For use with gnu-make for vms +# +# Created by Klaus K"ampf, kkaempf@rmi.de +# +# + +CC=cc + +ifeq ($(ARCH),ALPHA) +HOSTFILE=alphavms.h +TARGETOBJS = cpu-alpha.obj +else +HOSTFILE=vaxvms.h +TARGETOBJS = cpu-vax.obj +endif + + +OBJS=archive.obj,archures.obj,bfd.obj,cache.obj,coffgen.obj,corefile.obj,\ + format.obj,init.obj,libbfd.obj,opncls.obj,reloc.obj,section.obj,syms.obj,\ + targets.obj,hash.obj,linker.obj,elf.obj,srec.obj,binary.obj,tekhex.obj,\ + ihex.obj,stab-syms.obj,vms.obj,vms-hdr.obj,vms-gsd.obj,vms-tir.obj,\ + vms-misc.obj,$(TARGETOBJS) + +ifeq ($(CC),gcc) +ifeq ($(ARCH),ALPHA) +DEFS=/define=(SELECT_VECS="&vms_alpha_vec",SELECT_ARCHITECTURES="&bfd_alpha_arch",\ +"HAVE_vms_alpha_vec=1") +else +DEFS=/define=(SELECT_VECS="&vms_vax_vec",SELECT_ARCHITECTURES="&bfd_vax_arch",\ +"HAVE_vms_vax_vec=1","VMS_DEBUG") +endif +CFLAGS=/include=([],[-.include])$(DEFS) +else +ifeq ($(ARCH),ALPHA) +DEFS=/define=(SELECT_VECS="&vms_alpha_vec",SELECT_ARCHITECTURES="&bfd_alpha_arch",\ +"HAVE_vms_alpha_vec=1","unlink=remove","const=","VMS_DEBUG",) +else +DEFS=/define=(SELECT_VECS="&vms_vax_vec",SELECT_ARCHITECTURES="&bfd_vax_arch",\ +"HAVE_vms_vax_vec=1","unlink=remove","const=","VMS_DEBUG") +endif +CFLAGS=/noopt/debug/include=([],[-.include])$(DEFS)/warnings=disable=(missingreturn,implicitfunc,longextern) +endif + + +libbfd.olb: sysdep.h bfd.h $(OBJS) + purge + lib/create libbfd $(OBJS) + +sysdep.h: [.hosts]$(HOSTFILE) config.h + $(CP) $< $@ + +bfd.h: bfd-in2.h + $$ @configure + +targmatch.h: bfd.h +config.h: bfd.h + +vms.c: vms.h +vms-mhd.c: vms.h +vms-gsd.c: vms.h +vms-tir.c: vms.h +vms-misc.c: vms.h +targets.c: targmatch.h + +clean: + $$ purge + $(RM) libbfd.olb; + $(RM) sysdep.h; + $(RM) bfd.h; + $(RM) targmatch.h; + $(RM) config.h; + $(RM) *.obj; diff --git a/bfd/mmo.c b/bfd/mmo.c new file mode 100644 index 0000000000000..74b4c9dd1d076 --- /dev/null +++ b/bfd/mmo.c @@ -0,0 +1,3371 @@ +/* BFD back-end for mmo objects (MMIX-specific object-format). + Copyright 2001, 2002, 2003 + Free Software Foundation, Inc. + Written by Hans-Peter Nilsson (hp@bitrange.com). + Infrastructure and other bits originally copied from srec.c and + binary.c. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* +SECTION + mmo backend + + The mmo object format is used exclusively together with Professor + Donald E.@: Knuth's educational 64-bit processor MMIX. The simulator + @command{mmix} which is available at + @url{http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz} + understands this format. That package also includes a combined + assembler and linker called @command{mmixal}. The mmo format has + no advantages feature-wise compared to e.g. ELF. It is a simple + non-relocatable object format with no support for archives or + debugging information, except for symbol value information and + line numbers (which is not yet implemented in BFD). See + @url{http://www-cs-faculty.stanford.edu/~knuth/mmix.html} for more + information about MMIX. The ELF format is used for intermediate + object files in the BFD implementation. + +@c We want to xref the symbol table node. A feature in "chew" +@c requires that "commands" do not contain spaces in the +@c arguments. Hence the hyphen in "Symbol-table". +@menu +@* File layout:: +@* Symbol-table:: +@* mmo section mapping:: +@end menu + +INODE +File layout, Symbol-table, mmo, mmo +SUBSECTION + File layout + + The mmo file contents is not partitioned into named sections as + with e.g.@: ELF. Memory areas is formed by specifying the + location of the data that follows. Only the memory area + @samp{0x0000@dots{}00} to @samp{0x01ff@dots{}ff} is executable, so + it is used for code (and constants) and the area + @samp{0x2000@dots{}00} to @samp{0x20ff@dots{}ff} is used for + writable data. @xref{mmo section mapping}. + + Contents is entered as 32-bit words, xor:ed over previous + contents, always zero-initialized. A word that starts with the + byte @samp{0x98} forms a command called a @samp{lopcode}, where + the next byte distinguished between the thirteen lopcodes. The + two remaining bytes, called the @samp{Y} and @samp{Z} fields, or + the @samp{YZ} field (a 16-bit big-endian number), are used for + various purposes different for each lopcode. As documented in + @url{http://www-cs-faculty.stanford.edu/~knuth/mmixal-intro.ps.gz}, + the lopcodes are: + + There is provision for specifying ``special data'' of 65536 + different types. We use type 80 (decimal), arbitrarily chosen the + same as the ELF <> number for MMIX, filling it with + section information normally found in ELF objects. @xref{mmo + section mapping}. + + @table @code + @item lop_quote + 0x98000001. The next word is contents, regardless of whether it + starts with 0x98 or not. + + @item lop_loc + 0x9801YYZZ, where @samp{Z} is 1 or 2. This is a location + directive, setting the location for the next data to the next + 32-bit word (for @math{Z = 1}) or 64-bit word (for @math{Z = 2}), + plus @math{Y * 2^56}. Normally @samp{Y} is 0 for the text segment + and 2 for the data segment. + + @item lop_skip + 0x9802YYZZ. Increase the current location by @samp{YZ} bytes. + + @item lop_fixo + 0x9803YYZZ, where @samp{Z} is 1 or 2. Store the current location + as 64 bits into the location pointed to by the next 32-bit + (@math{Z = 1}) or 64-bit (@math{Z = 2}) word, plus @math{Y * + 2^56}. + + @item lop_fixr + 0x9804YYZZ. @samp{YZ} is stored into the current location plus + @math{2 - 4 * YZ}. + + @item lop_fixrx + 0x980500ZZ. @samp{Z} is 16 or 24. A value @samp{L} derived from + the following 32-bit word are used in a manner similar to + @samp{YZ} in lop_fixr: it is xor:ed into the current location + minus @math{4 * L}. The first byte of the word is 0 or 1. If it + is 1, then @math{L = (@var{lowest 24 bits of word}) - 2^Z}, if 0, + then @math{L = (@var{lowest 24 bits of word})}. + + @item lop_file + 0x9806YYZZ. @samp{Y} is the file number, @samp{Z} is count of + 32-bit words. Set the file number to @samp{Y} and the line + counter to 0. The next @math{Z * 4} bytes contain the file name, + padded with zeros if the count is not a multiple of four. The + same @samp{Y} may occur multiple times, but @samp{Z} must be 0 for + all but the first occurrence. + + @item lop_line + 0x9807YYZZ. @samp{YZ} is the line number. Together with + lop_file, it forms the source location for the next 32-bit word. + Note that for each non-lopcode 32-bit word, line numbers are + assumed incremented by one. + + @item lop_spec + 0x9808YYZZ. @samp{YZ} is the type number. Data until the next + lopcode other than lop_quote forms special data of type @samp{YZ}. + @xref{mmo section mapping}. + + Other types than 80, (or type 80 with a content that does not + parse) is stored in sections named <<.MMIX.spec_data.@var{n}>> + where @var{n} is the @samp{YZ}-type. The flags for such a + sections say not to allocate or load the data. The vma is 0. + Contents of multiple occurrences of special data @var{n} is + concatenated to the data of the previous lop_spec @var{n}s. The + location in data or code at which the lop_spec occurred is lost. + + @item lop_pre + 0x980901ZZ. The first lopcode in a file. The @samp{Z} field forms the + length of header information in 32-bit words, where the first word + tells the time in seconds since @samp{00:00:00 GMT Jan 1 1970}. + + @item lop_post + 0x980a00ZZ. @math{Z > 32}. This lopcode follows after all + content-generating lopcodes in a program. The @samp{Z} field + denotes the value of @samp{rG} at the beginning of the program. + The following @math{256 - Z} big-endian 64-bit words are loaded + into global registers @samp{$G} @dots{} @samp{$255}. + + @item lop_stab + 0x980b0000. The next-to-last lopcode in a program. Must follow + immediately after the lop_post lopcode and its data. After this + lopcode follows all symbols in a compressed format + (@pxref{Symbol-table}). + + @item lop_end + 0x980cYYZZ. The last lopcode in a program. It must follow the + lop_stab lopcode and its data. The @samp{YZ} field contains the + number of 32-bit words of symbol table information after the + preceding lop_stab lopcode. + @end table + + Note that the lopcode "fixups"; <>, <> and + <> are not generated by BFD, but are handled. They are + generated by <>. + +EXAMPLE + This trivial one-label, one-instruction file: + +| :Main TRAP 1,2,3 + + can be represented this way in mmo: + +| 0x98090101 - lop_pre, one 32-bit word with timestamp. +| +| 0x98010002 - lop_loc, text segment, using a 64-bit address. +| Note that mmixal does not emit this for the file above. +| 0x00000000 - Address, high 32 bits. +| 0x00000000 - Address, low 32 bits. +| 0x98060002 - lop_file, 2 32-bit words for file-name. +| 0x74657374 - "test" +| 0x2e730000 - ".s\0\0" +| 0x98070001 - lop_line, line 1. +| 0x00010203 - TRAP 1,2,3 +| 0x980a00ff - lop_post, setting $255 to 0. +| 0x00000000 +| 0x00000000 +| 0x980b0000 - lop_stab for ":Main" = 0, serial 1. +| 0x203a4040 @xref{Symbol-table}. +| 0x10404020 +| 0x4d206120 +| 0x69016e00 +| 0x81000000 +| 0x980c0005 - lop_end; symbol table contained five 32-bit words. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "libiberty.h" +#include "elf/mmix.h" +#include "opcode/mmix.h" + +#define LOP 0x98 +#define LOP_QUOTE 0 +#define LOP_LOC 1 +#define LOP_SKIP 2 +#define LOP_FIXO 3 +#define LOP_FIXR 4 +#define LOP_FIXRX 5 +#define LOP_FILE 6 +#define LOP_LINE 7 +#define LOP_SPEC 8 +#define LOP_PRE 9 +#define LOP_POST 10 +#define LOP_STAB 11 +#define LOP_END 12 + +#define LOP_QUOTE_NEXT ((LOP << 24) | (LOP_QUOTE << 16) | 1) +#define SPEC_DATA_SECTION 80 +#define LOP_SPEC_SECTION \ + ((LOP << 24) | (LOP_SPEC << 16) | SPEC_DATA_SECTION) + +/* Must be a power of two. If you change this to be >= 64k, you need a + new test-case; the ld test b-loc64k.d touches chunk-size problem areas. */ +#define MMO_SEC_CONTENTS_CHUNK_SIZE (1 << 15) + +/* An arbitrary number for the maximum length section name size. */ +#define MAX_SECTION_NAME_SIZE (1024 * 1024) + +/* A quite arbitrary number for the maximum length section size. */ +#define MAX_ARTIFICIAL_SECTION_SIZE (1024 * 1024 * 1024) + +#define MMO3_WCHAR 0x80 +#define MMO3_LEFT 0x40 +#define MMO3_MIDDLE 0x20 +#define MMO3_RIGHT 0x10 +#define MMO3_TYPEBITS 0xf +#define MMO3_REGQUAL_BITS 0xf +#define MMO3_UNDEF 2 +#define MMO3_DATA 8 +#define MMO3_SYMBITS 0x2f + +/* Put these everywhere in new code. */ +#define FATAL_DEBUG \ + _bfd_abort (__FILE__, __LINE__, \ + "Internal: Non-debugged code (test-case missing)") + +#define BAD_CASE(x) \ + _bfd_abort (__FILE__, __LINE__, \ + "bad case for " #x) + +enum mmo_sym_type { mmo_reg_sym, mmo_undef_sym, mmo_data_sym, mmo_abs_sym}; + +/* When scanning the mmo file, a linked list of mmo_symbol + structures is built to represent the symbol table (if there is + one). */ + +struct mmo_symbol + { + struct mmo_symbol *next; + const char *name; + bfd_vma value; + enum mmo_sym_type sym_type; + unsigned int serno; + }; + +struct mmo_data_list_struct + { + struct mmo_data_list_struct *next; + bfd_vma where; + bfd_size_type size; + bfd_size_type allocated_size; + bfd_byte data[1]; + }; + +typedef struct mmo_data_list_struct mmo_data_list_type; + +struct mmo_symbol_trie + { + struct mmo_symbol_trie *left; + struct mmo_symbol_trie *right; + struct mmo_symbol_trie *middle; + + bfd_byte symchar; + + /* A zero name means there's nothing here. */ + struct mmo_symbol sym; + }; + +/* The mmo tdata information. */ + +struct mmo_data_struct + { + struct mmo_symbol *symbols; + struct mmo_symbol *symtail; + asymbol *csymbols; + + /* File representation of time (NULL) when this file was created. */ + bfd_byte created[4]; + + /* When we're reading bytes recursively, check this occasionally. + Also holds write errors. */ + bfd_boolean have_error; + + /* Max symbol length that may appear in the lop_stab table. Note that + this table might just hold a subset of symbols for not-really large + programs, as it can only be 65536 * 4 bytes large. */ + int max_symbol_length; + + /* Here's the symbol we build in lop_stab. */ + char *lop_stab_symbol; + + /* Index into lop_stab_symbol for the next character when parsing the + symbol information. */ + int symbol_position; + + /* When creating arbitrary sections, we need to count section numbers. */ + int sec_no; + + /* When writing or reading byte-wise, we need to count the bytes + within a 32-bit word. */ + int byte_no; + + /* We also need a buffer to hold the bytes we count reading or writing. */ + bfd_byte buf[4]; + }; + +typedef struct mmo_data_struct tdata_type; + +struct mmo_section_data_struct + { + mmo_data_list_type *head; + mmo_data_list_type *tail; + }; + +#define mmo_section_data(sec) \ + ((struct mmo_section_data_struct *) (sec)->used_by_bfd) + +/* These structures are used in bfd_map_over_sections constructs. */ + +/* Used when writing out sections; all but the register contents section + which is stored in reg_section. */ +struct mmo_write_sec_info + { + asection *reg_section; + bfd_boolean retval; + }; + +/* Used when trying to find a section corresponding to addr. */ +struct mmo_find_sec_info + { + asection *sec; + bfd_vma addr; + }; + +static bfd_boolean mmo_bfd_copy_private_bfd_data + PARAMS ((bfd *, bfd *)); +static void mmo_write_section_unless_reg_contents + PARAMS ((bfd *, asection *, PTR)); +static void mmo_find_sec_w_addr + PARAMS ((bfd *, asection *, PTR)); +static void mmo_find_sec_w_addr_grow + PARAMS ((bfd *, asection *, PTR)); +static asection *mmo_make_section + PARAMS ((bfd *, const char *)); +static void mmo_get_symbol_info + PARAMS ((bfd *, asymbol *, symbol_info *)); +static void mmo_print_symbol + PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); +static void mmo_init + PARAMS ((void)); +static bfd_boolean mmo_mkobject + PARAMS ((bfd *)); +static bfd_boolean mmo_scan + PARAMS ((bfd *)); +static asection *mmo_decide_section + PARAMS ((bfd *, bfd_vma)); +static asection *mmo_get_generic_spec_data_section + PARAMS ((bfd *, int)); +static asection *mmo_get_spec_section + PARAMS ((bfd *, int)); +static INLINE bfd_byte *mmo_get_loc + PARAMS ((asection *, bfd_vma, int)); +static void mmo_xore_64 + PARAMS ((asection *, bfd_vma vma, bfd_vma value)); +static void mmo_xore_32 + PARAMS ((asection *, bfd_vma vma, unsigned int)); +static void mmo_xore_16 + PARAMS ((asection *, bfd_vma vma, unsigned int)); +static const bfd_target *mmo_object_p + PARAMS ((bfd *)); +static void mmo_map_set_sizes + PARAMS ((bfd *, asection *, PTR)); +static bfd_boolean mmo_get_symbols + PARAMS ((bfd *)); +static bfd_boolean mmo_create_symbol + PARAMS ((bfd *, const char *, bfd_vma, enum mmo_sym_type, unsigned int)); +static bfd_boolean mmo_get_section_contents + PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); +static long mmo_get_symtab_upper_bound + PARAMS ((bfd *)); +static long mmo_canonicalize_symtab + PARAMS ((bfd *, asymbol **)); +static void mmo_get_symbol_info + PARAMS ((bfd *, asymbol *, symbol_info *)); +static void mmo_print_symbol + PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); +static bfd_boolean mmo_set_section_contents + PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); +static int mmo_sizeof_headers + PARAMS ((bfd *, bfd_boolean)); +static long mmo_get_reloc_upper_bound + PARAMS ((bfd *, asection *)); + +static bfd_boolean mmo_internal_write_header + PARAMS ((bfd *)); +static bfd_boolean mmo_internal_write_post + PARAMS ((bfd *, int, asection *)); +static bfd_boolean mmo_internal_add_3_sym + PARAMS ((bfd *, struct mmo_symbol_trie *, const struct mmo_symbol *)); +static unsigned int mmo_internal_3_length + PARAMS ((bfd *, struct mmo_symbol_trie *)); +static void mmo_internal_3_dump + PARAMS ((bfd *, struct mmo_symbol_trie *)); +static void mmo_beb128_out + PARAMS ((bfd *, int, int)); +static bfd_boolean mmo_internal_write_section + PARAMS ((bfd *, asection *)); +static void mmo_write_tetra + PARAMS ((bfd *, unsigned int)); +static void mmo_write_tetra_raw + PARAMS ((bfd *, unsigned int)); +static void mmo_write_octa + PARAMS ((bfd *, bfd_vma)); +static void mmo_write_octa_raw + PARAMS ((bfd *, bfd_vma)); +static bfd_boolean mmo_write_chunk + PARAMS ((bfd *, const bfd_byte *, unsigned int)); +static bfd_boolean mmo_flush_chunk + PARAMS ((bfd *)); +static bfd_boolean mmo_write_loc_chunk + PARAMS ((bfd *, bfd_vma, const bfd_byte *, unsigned int, bfd_vma *)); +static bfd_boolean mmo_write_chunk_list + PARAMS ((bfd *, mmo_data_list_type *)); +static bfd_boolean mmo_write_loc_chunk_list + PARAMS ((bfd *, mmo_data_list_type *)); +static bfd_boolean mmo_write_symbols_and_terminator + PARAMS ((bfd *)); +static flagword mmo_sec_flags_from_bfd_flags + PARAMS ((flagword)); +static flagword bfd_sec_flags_from_mmo_flags + PARAMS ((flagword)); +static bfd_byte mmo_get_byte + PARAMS ((bfd *)); +static void mmo_write_byte + PARAMS ((bfd *, bfd_byte)); +static bfd_boolean mmo_new_section_hook + PARAMS ((bfd *, asection *)); +static int mmo_sort_mmo_symbols + PARAMS ((const PTR, const PTR)); +static bfd_boolean mmo_write_object_contents + PARAMS ((bfd *)); +static long mmo_canonicalize_reloc + PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); + +/* Global "const" variables initialized once. Must not depend on + particular input or caller; put such things into the bfd or elsewhere. + Look ma, no static per-invocation data! */ + +static unsigned +char valid_mmo_symbol_character_set[/* A-Z a-z (we assume consecutive + codes; sorry EBCDIC:ers!). */ + + 'Z' - 'A' + 1 + 'z' - 'a' + 1 + /* Digits. */ + + 10 + /* ':' and '_'. */ + + 1 + 1 + /* Codes higher than 126. */ + + 256 - 126 + /* Ending zero. */ + + 1]; + + +/* Get section SECNAME or create one if it doesn't exist. When creating + one, new memory for the name is allocated. */ + +static asection * +mmo_make_section (abfd, secname) + bfd *abfd; + const char *secname; +{ + asection *sec = bfd_get_section_by_name (abfd, secname); + + if (sec == NULL) + { + char *newsecname = strdup (secname); + + if (newsecname == NULL) + { + (*_bfd_error_handler) + (_("%s: No core to allocate section name %s\n"), + bfd_get_filename (abfd), secname); + bfd_set_error (bfd_error_system_call); + return NULL; + } + sec = bfd_make_section (abfd, newsecname); + } + + return sec; +} + +/* Nothing to do, but keep as a placeholder if we need it. + Note that state that might differ between bfd:s must not be initialized + here, nor must it be static. Add it to tdata information instead. */ + +static void +mmo_init () +{ + static bfd_boolean inited = FALSE; + int i = 0; + int j = 0; + static const char letters[] + = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789:_"; + + if (inited) + return; + inited = TRUE; + + /* Fill in the set of valid symbol characters. */ + strcpy (valid_mmo_symbol_character_set, letters); + i = strlen (letters); + + for (j = 126; j < 256; j++) + valid_mmo_symbol_character_set[i++] = j; +} + +/* Check whether an existing file is an mmo file. */ + +static const bfd_target * +mmo_object_p (abfd) + bfd *abfd; +{ + struct stat statbuf; + bfd_byte b[4]; + + mmo_init (); + + if (bfd_stat (abfd, &statbuf) < 0 + || bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 + || bfd_bread (b, 4, abfd) != 4) + goto bad_final; + + /* All mmo files are a multiple of four bytes long. + Only recognize version one. */ + if ((statbuf.st_size % 4) != 0 + || b[0] != LOP || b[1] != LOP_PRE || b[2] != 1) + goto bad_format; + + /* Get the last 32-bit word. */ + if (bfd_seek (abfd, (file_ptr) statbuf.st_size - 4, SEEK_SET) != 0 + || bfd_bread (b, 4, abfd) != 4) + goto bad_final; + + /* Check if the file ends in a lop_end lopcode. */ + if (b[0] != LOP || b[1] != LOP_END || ! mmo_mkobject (abfd)) + goto bad_format; + + /* Compute an upper bound on the max symbol length. Not really + important as all of the symbol information can only be 256k. */ + abfd->tdata.mmo_data->max_symbol_length = (b[2] * 256 + b[3]) * 4; + abfd->tdata.mmo_data->lop_stab_symbol + = bfd_malloc (abfd->tdata.mmo_data->max_symbol_length + 1); + + if (abfd->tdata.mmo_data->lop_stab_symbol == NULL) + { + (*_bfd_error_handler) + (_("%s: No core to allocate a symbol %d bytes long\n"), + bfd_get_filename (abfd), abfd->tdata.mmo_data->max_symbol_length); + goto bad_final; + } + + /* Read in everything. */ + if (! mmo_scan (abfd)) + goto bad_format_free; + + if (abfd->symcount > 0) + abfd->flags |= HAS_SYMS; + + /* You'll have to tweak this if you want to use this format for other + arches (not recommended due to its small-size limitations). Look at + the ELF format for how to make it target-generic. */ + if (! bfd_default_set_arch_mach (abfd, bfd_arch_mmix, 0)) + goto bad_format_free; + + return abfd->xvec; + + bad_format_free: + free (abfd->tdata.mmo_data->lop_stab_symbol); + bad_format: + bfd_set_error (bfd_error_wrong_format); + bad_final: + return NULL; +} + +/* Set up the mmo tdata information. */ + +static bfd_boolean +mmo_mkobject (abfd) + bfd *abfd; +{ + mmo_init (); + + if (abfd->tdata.mmo_data == NULL) + { + time_t created; + + /* All fields are zero-initialized, so we don't have to explicitly + initialize most. */ + tdata_type *tdata = (tdata_type *) bfd_zmalloc (sizeof (tdata_type)); + if (tdata == NULL) + return FALSE; + + created = time (NULL); + bfd_put_32 (abfd, created, tdata->created); + + abfd->tdata.mmo_data = tdata; + } + + return TRUE; +} + +static bfd_boolean +mmo_bfd_copy_private_bfd_data (ibfd, obfd) + bfd *ibfd; + bfd *obfd; +{ + if (bfd_get_flavour (ibfd) != bfd_target_mmo_flavour + || bfd_get_flavour (obfd) != bfd_target_mmo_flavour) + return TRUE; + + /* Copy the time the copied-from file was created. If people want the + time the file was last *modified*, they have that in the normal file + information. */ + memcpy (obfd->tdata.mmo_data->created, ibfd->tdata.mmo_data->created, + sizeof (obfd->tdata.mmo_data->created)); + return TRUE; +} + +/* Helper functions for mmo_decide_section, used through + bfd_map_over_sections. */ + +static void +mmo_find_sec_w_addr (abfd, sec, p) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + PTR p; +{ + struct mmo_find_sec_info *infop = (struct mmo_find_sec_info *) p; + bfd_vma vma = bfd_get_section_vma (abfd, sec); + + /* Ignore sections that aren't loaded. */ + if ((bfd_get_section_flags (abfd, sec) & (SEC_LOAD | SEC_ALLOC)) + != (SEC_LOAD | SEC_ALLOC)) + return; + + if (infop->addr >= vma && infop->addr < vma + sec->_raw_size) + infop->sec = sec; +} + +static void +mmo_find_sec_w_addr_grow (abfd, sec, p) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + PTR p; +{ + struct mmo_find_sec_info *infop = (struct mmo_find_sec_info *) p; + bfd_vma vma = bfd_get_section_vma (abfd, sec); + + /* Ignore sections that aren't loaded. */ + if ((bfd_get_section_flags (abfd, sec) & (SEC_LOAD | SEC_ALLOC)) + != (SEC_LOAD | SEC_ALLOC)) + return; + + if (infop->addr >= vma && infop->addr < vma + MAX_ARTIFICIAL_SECTION_SIZE) + infop->sec = sec; +} + +/* Find a section that corresponds to a VMA. Automatically create .text + or .data and set current section to it, depending on what vma. If we + can't deduce a section, make one up as ".MMIX.sec.N", where N is an + increasing number. */ + +static asection * +mmo_decide_section (abfd, vma) + bfd *abfd; + bfd_vma vma; +{ + asection *sec = NULL; + char sec_name[sizeof (".MMIX.sec.") + 20]; + struct mmo_find_sec_info info; + + info.addr = vma; + info.sec = NULL; + + /* First see if there's a section that would match exactly. */ + bfd_map_over_sections (abfd, mmo_find_sec_w_addr, &info); + + if (info.sec != NULL) + return info.sec; + + /* If there's no such section, try and expand one of the existing ones, + up to a limit. Make sure we have .text and .data before we try that; + create them corresponding to expected addresses and set flags to make + them match the "loaded and with contents" expectation. */ + if ((vma >> 56) == 0) + { + sec = bfd_make_section_old_way (abfd, MMO_TEXT_SECTION_NAME); + + if (sec == NULL) + return NULL; + + if (! sec->user_set_vma) + bfd_set_section_vma (abfd, sec, vma); + if (! bfd_set_section_flags (abfd, sec, + bfd_get_section_flags (abfd, sec) + | SEC_CODE | SEC_LOAD | SEC_ALLOC)) + return NULL; + } + else if ((vma >> 56) == 0x20) + { + sec = bfd_make_section_old_way (abfd, MMO_DATA_SECTION_NAME); + + if (sec == NULL) + return NULL; + + if (! sec->user_set_vma) + bfd_set_section_vma (abfd, sec, vma); + if (! bfd_set_section_flags (abfd, sec, + bfd_get_section_flags (abfd, sec) + | SEC_LOAD | SEC_ALLOC)) + return NULL; + } + + bfd_map_over_sections (abfd, mmo_find_sec_w_addr_grow, &info); + + if (info.sec != NULL) + return info.sec; + + /* If there's still no suitable section, make a new one. */ + sprintf (sec_name, ".MMIX.sec.%d", abfd->tdata.mmo_data->sec_no++); + sec = mmo_make_section (abfd, sec_name); + if (! sec->user_set_vma) + bfd_set_section_vma (abfd, sec, vma); + + if (! bfd_set_section_flags (abfd, sec, + bfd_get_section_flags (abfd, sec) + | SEC_LOAD | SEC_ALLOC)) + return NULL; + return sec; +} + +/* Xor in a 64-bit value VALUE at VMA. */ + +static INLINE void +mmo_xore_64 (sec, vma, value) + asection *sec; + bfd_vma vma; + bfd_vma value; +{ + bfd_byte *loc = mmo_get_loc (sec, vma, 8); + bfd_vma prev = bfd_get_64 (sec->owner, loc); + + value ^= prev; + bfd_put_64 (sec->owner, value, loc); +} + +/* Xor in a 32-bit value VALUE at VMA. */ + +static INLINE void +mmo_xore_32 (sec, vma, value) + asection *sec; + bfd_vma vma; + unsigned int value; +{ + bfd_byte *loc = mmo_get_loc (sec, vma, 4); + unsigned int prev = bfd_get_32 (sec->owner, loc); + + value ^= prev; + bfd_put_32 (sec->owner, value, loc); +} + +/* Xor in a 16-bit value VALUE at VMA. */ + +static INLINE void +mmo_xore_16 (sec, vma, value) + asection *sec; + bfd_vma vma; + unsigned int value; +{ + bfd_byte *loc = mmo_get_loc (sec, vma, 2); + unsigned int prev = bfd_get_16 (sec->owner, loc); + + value ^= prev; + bfd_put_16 (sec->owner, value, loc); +} + +/* Write a 32-bit word to output file, no lop_quote generated. */ + +static INLINE void +mmo_write_tetra_raw (abfd, value) + bfd *abfd; + unsigned int value; +{ + bfd_byte buf[4]; + + bfd_put_32 (abfd, value, buf); + + if (bfd_bwrite ((PTR) buf, 4, abfd) != 4) + abfd->tdata.mmo_data->have_error = TRUE; +} + +/* Write a 32-bit word to output file; lop_quote if necessary. */ + +static INLINE void +mmo_write_tetra (abfd, value) + bfd *abfd; + unsigned int value; +{ + if (((value >> 24) & 0xff) == LOP) + mmo_write_tetra_raw (abfd, LOP_QUOTE_NEXT); + + mmo_write_tetra_raw (abfd, value); +} + +/* Write a 64-bit word to output file, perhaps with lop_quoting. */ + +static INLINE void +mmo_write_octa (abfd, value) + bfd *abfd; + bfd_vma value; +{ + mmo_write_tetra (abfd, (unsigned int) (value >> 32)); + mmo_write_tetra (abfd, (unsigned int) value); +} + +/* Write a 64-bit word to output file, without lop_quoting. */ + +static INLINE void +mmo_write_octa_raw (abfd, value) + bfd *abfd; + bfd_vma value; +{ + mmo_write_tetra_raw (abfd, (unsigned int) (value >> 32)); + mmo_write_tetra_raw (abfd, (unsigned int) value); +} + +/* Write quoted contents. Intended to be called multiple times in + sequence, followed by a call to mmo_flush_chunk. */ + +static INLINE bfd_boolean +mmo_write_chunk (abfd, loc, len) + bfd *abfd; + const bfd_byte *loc; + unsigned int len; +{ + bfd_boolean retval = TRUE; + + /* Fill up a tetra from bytes remaining from a previous chunk. */ + if (abfd->tdata.mmo_data->byte_no != 0) + { + while (abfd->tdata.mmo_data->byte_no < 4 && len != 0) + { + abfd->tdata.mmo_data->buf[abfd->tdata.mmo_data->byte_no++] = *loc++; + len--; + } + + if (abfd->tdata.mmo_data->byte_no == 4) + { + mmo_write_tetra (abfd, + bfd_get_32 (abfd, abfd->tdata.mmo_data->buf)); + abfd->tdata.mmo_data->byte_no = 0; + } + } + + while (len >= 4) + { + if (loc[0] == LOP) + mmo_write_tetra_raw (abfd, LOP_QUOTE_NEXT); + + retval = (retval + && ! abfd->tdata.mmo_data->have_error + && 4 == bfd_bwrite ((PTR) loc, 4, abfd)); + + loc += 4; + len -= 4; + } + + if (len) + { + memcpy (abfd->tdata.mmo_data->buf, loc, len); + abfd->tdata.mmo_data->byte_no = len; + } + + if (! retval) + abfd->tdata.mmo_data->have_error = TRUE; + return retval; +} + +/* Flush remaining bytes, from a previous mmo_write_chunk, zero-padded to + 4 bytes. */ + +static INLINE bfd_boolean +mmo_flush_chunk (abfd) + bfd *abfd; +{ + if (abfd->tdata.mmo_data->byte_no != 0) + { + memset (abfd->tdata.mmo_data->buf + abfd->tdata.mmo_data->byte_no, + 0, 4 - abfd->tdata.mmo_data->byte_no); + mmo_write_tetra (abfd, + bfd_get_32 (abfd, abfd->tdata.mmo_data->buf)); + abfd->tdata.mmo_data->byte_no = 0; + } + + return ! abfd->tdata.mmo_data->have_error; +} + +/* Same, but from a list. */ + +static INLINE bfd_boolean +mmo_write_chunk_list (abfd, datap) + bfd *abfd; + mmo_data_list_type *datap; +{ + for (; datap != NULL; datap = datap->next) + if (! mmo_write_chunk (abfd, datap->data, datap->size)) + return FALSE; + + return mmo_flush_chunk (abfd); +} + +/* Write a lop_loc and some contents. A caller needs to call + mmo_flush_chunk after calling this function. The location is only + output if different than *LAST_VMAP, which is updated after this call. */ + +static bfd_boolean +mmo_write_loc_chunk (abfd, vma, loc, len, last_vmap) + bfd *abfd; + bfd_vma vma; + const bfd_byte *loc; + unsigned int len; + bfd_vma *last_vmap; +{ + /* Find an initial and trailing section of zero tetras; we don't need to + write out zeros. FIXME: When we do this, we should emit section size + and address specifiers, else objcopy can't always perform an identity + translation. Only do this if we *don't* have left-over data from a + previous write or the vma of this chunk is *not* the next address, + because then data isn't tetrabyte-aligned and we're concatenating to + that left-over data. */ + + if (abfd->tdata.mmo_data->byte_no == 0 || vma != *last_vmap) + { + while (len >= 4 && bfd_get_32 (abfd, loc) == 0) + { + vma += 4; + len -= 4; + loc += 4; + } + + while (len >= 4 && bfd_get_32 (abfd, loc + len - 4) == 0) + len -= 4; + } + + /* Only write out the location if it's different than the one the caller + (supposedly) previously handled, accounting for omitted leading zeros. */ + if (vma != *last_vmap) + { + /* We might be in the middle of a sequence. */ + mmo_flush_chunk (abfd); + + /* We always write the location as 64 bits; no use saving bytes + here. */ + mmo_write_tetra_raw (abfd, (LOP << 24) | (LOP_LOC << 16) | 2); + mmo_write_octa_raw (abfd, vma); + } + + /* Update to reflect end of this chunk, with trailing zeros omitted. */ + *last_vmap = vma + len; + + return (! abfd->tdata.mmo_data->have_error + && mmo_write_chunk (abfd, loc, len)); +} + +/* Same, but from a list. */ + +static INLINE bfd_boolean +mmo_write_loc_chunk_list (abfd, datap) + bfd *abfd; + mmo_data_list_type *datap; +{ + /* Get an address different than the address of the first chunk. */ + bfd_vma last_vma = datap ? datap->where - 1 : 0; + + for (; datap != NULL; datap = datap->next) + if (! mmo_write_loc_chunk (abfd, datap->where, datap->data, datap->size, + &last_vma)) + return FALSE; + + return mmo_flush_chunk (abfd); +} + +/* Make a .MMIX.spec_data.N section. */ + +static asection * +mmo_get_generic_spec_data_section (abfd, spec_data_number) + bfd *abfd; + int spec_data_number; +{ + asection *sec; + char secname[sizeof (MMIX_OTHER_SPEC_SECTION_PREFIX) + 20] + = MMIX_OTHER_SPEC_SECTION_PREFIX; + + sprintf (secname + strlen (MMIX_OTHER_SPEC_SECTION_PREFIX), + "%d", spec_data_number); + + sec = mmo_make_section (abfd, secname); + + return sec; +} + +/* Make a special section for SPEC_DATA_NUMBER. If it is the one we use + ourselves, parse some of its data to get at the section name. */ + +static asection * +mmo_get_spec_section (abfd, spec_data_number) + bfd *abfd; + int spec_data_number; +{ + bfd_byte *secname; + asection *sec; + bfd_byte buf[4]; + unsigned int secname_length; + unsigned int i; + bfd_vma section_length; + bfd_vma section_vma; + mmo_data_list_type *loc; + flagword flags; + long orig_pos; + + /* If this isn't the "special" special data, then make a placeholder + section. */ + if (spec_data_number != SPEC_DATA_SECTION) + return mmo_get_generic_spec_data_section (abfd, spec_data_number); + + /* Seek back to this position if there was a format error. */ + orig_pos = bfd_tell (abfd); + + /* Read the length (in 32-bit words). */ + if (bfd_bread (buf, 4, abfd) != 4) + goto format_error; + + if (buf[0] == LOP) + { + if (buf[1] != LOP_QUOTE) + goto format_error; + + if (bfd_bread (buf, 4, abfd) != 4) + goto format_error; + } + + /* We don't care to keep the name length accurate. It's + zero-terminated. */ + secname_length = bfd_get_32 (abfd, buf) * 4; + + /* Check section name length for sanity. */ + if (secname_length > MAX_SECTION_NAME_SIZE) + goto format_error; + + /* This should be free'd regardless if a section is created. */ + secname = bfd_malloc (secname_length + 1); + secname[secname_length] = 0; + + for (i = 0; i < secname_length / 4; i++) + { + if (bfd_bread (secname + i * 4, 4, abfd) != 4) + goto format_error_free; + + if (secname[i * 4] == LOP) + { + /* A bit of overkill, but we handle char 0x98 in a section name, + and recognize misparsing. */ + if (secname[i * 4 + 1] != LOP_QUOTE + || bfd_bread (secname + i * 4, 4, abfd) != 4) + /* Whoops. We thought this was a name, and now we found a + non-lop_quote lopcode before we parsed the whole length of + the name. Signal end-of-file in the same manner. */ + goto format_error_free; + } + } + + /* Get the section flags. */ + if (bfd_bread (buf, 4, abfd) != 4 + || (buf[0] == LOP + && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4))) + goto format_error_free; + + flags = bfd_get_32 (abfd, buf); + + /* Get the section length. */ + if (bfd_bread (buf, 4, abfd) != 4 + || (buf[0] == LOP + && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4))) + goto format_error_free; + + section_length = (bfd_vma) bfd_get_32 (abfd, buf) << 32; + + /* That's the first, high-part. Now get the low part. */ + + if (bfd_bread (buf, 4, abfd) != 4 + || (buf[0] == LOP + && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4))) + goto format_error_free; + + section_length |= (bfd_vma) bfd_get_32 (abfd, buf); + + /* Check the section length for sanity. */ + if (section_length > MAX_ARTIFICIAL_SECTION_SIZE) + goto format_error_free; + + /* Get the section VMA. */ + if (bfd_bread (buf, 4, abfd) != 4 + || (buf[0] == LOP + && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4))) + goto format_error_free; + + section_vma = (bfd_vma) bfd_get_32 (abfd, buf) << 32; + + /* That's the first, high-part. Now get the low part. */ + if (bfd_bread (buf, 4, abfd) != 4 + || (buf[0] == LOP + && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4))) + goto format_error_free; + + section_vma |= (bfd_vma) bfd_get_32 (abfd, buf); + + sec = mmo_make_section (abfd, secname); + free (secname); + if (sec == NULL) + goto format_error; + + /* We allocate a buffer here for the advertised size, with head room for + tetrabyte alignment. */ + loc = bfd_zmalloc (section_length + 3 + + sizeof (struct mmo_data_list_struct)); + if (loc == NULL) + goto format_error; + + /* Use a TETRA-rounded size for the allocated buffer; we set the + "visible" section size below. */ + loc->size = (section_length + 3) & ~3; + + /* Add in the section flags we found to those bfd entered during this + process and set the contents. */ + if (! bfd_set_section_flags (abfd, sec, + bfd_sec_flags_from_mmo_flags (flags) + | bfd_get_section_flags (abfd, sec) + | (section_length != 0 ? SEC_HAS_CONTENTS : 0)) + || ! bfd_set_section_size (abfd, sec, + sec->_cooked_size + section_length) + /* Set VMA only for the first occurrence. */ + || (! sec->user_set_vma + && ! bfd_set_section_vma (abfd, sec, section_vma))) + { + /* If we get an error for any of the calls above, signal more than + just a format error for the spec section. */ + return NULL; + } + + loc->next = NULL; + if (mmo_section_data (sec)->tail != NULL) + mmo_section_data (sec)->tail->next = loc; + else + mmo_section_data (sec)->head = loc; + mmo_section_data (sec)->tail = loc; + loc->where = section_vma; + + return sec; + + format_error_free: + free (secname); + format_error: + if (bfd_seek (abfd, orig_pos, SEEK_SET) != 0) + return NULL; + + return mmo_get_generic_spec_data_section (abfd, spec_data_number); +} + +/* Read a byte, but read from file in multiples of 32-bit words. */ + +static bfd_byte +mmo_get_byte (abfd) + bfd *abfd; +{ + bfd_byte retval; + + if (abfd->tdata.mmo_data->byte_no == 0) + { + if (! abfd->tdata.mmo_data->have_error + && bfd_bread (abfd->tdata.mmo_data->buf, 4, abfd) != 4) + { + abfd->tdata.mmo_data->have_error = TRUE; + + /* A value somewhat safe against tripping on some inconsistency + when mopping up after this error. */ + return 128; + } + } + + retval = abfd->tdata.mmo_data->buf[abfd->tdata.mmo_data->byte_no]; + abfd->tdata.mmo_data->byte_no = (abfd->tdata.mmo_data->byte_no + 1) % 4; + + return retval; +} + +/* Write a byte, in multiples of 32-bit words. */ + +static void +mmo_write_byte (abfd, value) + bfd *abfd; + bfd_byte value; +{ + abfd->tdata.mmo_data->buf[(abfd->tdata.mmo_data->byte_no++ % 4)] = value; + if ((abfd->tdata.mmo_data->byte_no % 4) == 0) + { + if (! abfd->tdata.mmo_data->have_error + && bfd_bwrite (abfd->tdata.mmo_data->buf, 4, abfd) != 4) + abfd->tdata.mmo_data->have_error = TRUE; + } +} + +/* Create a symbol. */ + +static bfd_boolean +mmo_create_symbol (abfd, symname, addr, sym_type, serno) + bfd *abfd; + const char *symname; + bfd_vma addr; + enum mmo_sym_type sym_type; + unsigned int serno; +{ + struct mmo_symbol *n; + + n = (struct mmo_symbol *) bfd_alloc (abfd, sizeof (struct mmo_symbol)); + if (n == NULL) + return FALSE; + + n->name = bfd_alloc (abfd, strlen (symname) + 1); + if (n->name == NULL) + return FALSE; + + strcpy ((PTR) n->name, symname); + + n->value = addr; + n->sym_type = sym_type; + n->serno = serno; + + if (abfd->tdata.mmo_data->symbols == NULL) + abfd->tdata.mmo_data->symbols = n; + else + abfd->tdata.mmo_data->symtail->next = n; + abfd->tdata.mmo_data->symtail = n; + n->next = NULL; + + ++abfd->symcount; + + /* Check that :Main equals the last octa of the .MMIX.reg_contents + section, as it's the one place we're sure to pass when reading a mmo + object. For written objects, we do it while setting the symbol + table. */ + if (strcmp (symname, MMIX_START_SYMBOL_NAME) == 0 + && bfd_get_start_address (abfd) != addr) + { + (*_bfd_error_handler) + (_("%s: invalid mmo file: initialization value for $255 is not `Main'\n"), + bfd_get_filename (abfd)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + return TRUE; +} + +/* Read in symbols. */ + +static bfd_boolean +mmo_get_symbols (abfd) + bfd *abfd; +{ +/* +INODE +Symbol-table, mmo section mapping, File layout, mmo +SUBSECTION + Symbol table format + + From mmixal.w (or really, the generated mmixal.tex) in + @url{http://www-cs-faculty.stanford.edu/~knuth/programs/mmix.tar.gz}): + ``Symbols are stored and retrieved by means of a @samp{ternary + search trie}, following ideas of Bentley and Sedgewick. (See + ACM--SIAM Symp.@: on Discrete Algorithms @samp{8} (1997), 360--369; + R.@:Sedgewick, @samp{Algorithms in C} (Reading, Mass.@: + Addison--Wesley, 1998), @samp{15.4}.) Each trie node stores a + character, and there are branches to subtries for the cases where + a given character is less than, equal to, or greater than the + character in the trie. There also is a pointer to a symbol table + entry if a symbol ends at the current node.'' + + So it's a tree encoded as a stream of bytes. The stream of bytes + acts on a single virtual global symbol, adding and removing + characters and signalling complete symbol points. Here, we read + the stream and create symbols at the completion points. + + First, there's a control byte <>. If any of the listed bits + in <> is nonzero, we execute what stands at the right, in + the listed order: + +| (MMO3_LEFT) +| 0x40 - Traverse left trie. +| (Read a new command byte and recurse.) +| +| (MMO3_SYMBITS) +| 0x2f - Read the next byte as a character and store it in the +| current character position; increment character position. +| Test the bits of <>: +| +| (MMO3_WCHAR) +| 0x80 - The character is 16-bit (so read another byte, +| merge into current character. +| +| (MMO3_TYPEBITS) +| 0xf - We have a complete symbol; parse the type, value +| and serial number and do what should be done +| with a symbol. The type and length information +| is in j = (m & 0xf). +| +| (MMO3_REGQUAL_BITS) +| j == 0xf: A register variable. The following +| byte tells which register. +| j <= 8: An absolute symbol. Read j bytes as the +| big-endian number the symbol equals. +| A j = 2 with two zero bytes denotes an +| unknown symbol. +| j > 8: As with j <= 8, but add (0x20 << 56) +| to the value in the following j - 8 +| bytes. +| +| Then comes the serial number, as a variant of +| uleb128, but better named ubeb128: +| Read bytes and shift the previous value left 7 +| (multiply by 128). Add in the new byte, repeat +| until a byte has bit 7 set. The serial number +| is the computed value minus 128. +| +| (MMO3_MIDDLE) +| 0x20 - Traverse middle trie. (Read a new command byte +| and recurse.) Decrement character position. +| +| (MMO3_RIGHT) +| 0x10 - Traverse right trie. (Read a new command byte and +| recurse.) + + Let's look again at the <> for the trivial file + (@pxref{File layout}). + +| 0x980b0000 - lop_stab for ":Main" = 0, serial 1. +| 0x203a4040 +| 0x10404020 +| 0x4d206120 +| 0x69016e00 +| 0x81000000 + + This forms the trivial trie (note that the path between ``:'' and + ``M'' is redundant): + +| 203a ":" +| 40 / +| 40 / +| 10 \ +| 40 / +| 40 / +| 204d "M" +| 2061 "a" +| 2069 "i" +| 016e "n" is the last character in a full symbol, and +| with a value represented in one byte. +| 00 The value is 0. +| 81 The serial number is 1. */ + + bfd_byte m = mmo_get_byte (abfd); + + /* Check first if we have a bad hair day. */ + if (abfd->tdata.mmo_data->have_error) + return FALSE; + + if (m & MMO3_LEFT) + /* Traverse left trie. */ + mmo_get_symbols (abfd); + + if (m & MMO3_SYMBITS) + { + bfd_byte c = mmo_get_byte (abfd); + bfd_byte j = m & MMO3_TYPEBITS; + bfd_vma addr = 0; + enum mmo_sym_type sym_type; + unsigned int serno = 0; + bfd_byte k; + + if (m & MMO3_WCHAR) + { + bfd_byte c2 = mmo_get_byte (abfd); + + /* A two-byte character. We can't grok this, but neither can + mmotype, for other cases than the second byte being zero. */ + + if (c != 0) + { + abfd->tdata.mmo_data->lop_stab_symbol + [abfd->tdata.mmo_data->symbol_position] = 0; + + (*_bfd_error_handler) + (_("%s: unsupported wide character sequence\ + 0x%02X 0x%02X after symbol name starting with `%s'\n"), + bfd_get_filename (abfd), c, c2, + abfd->tdata.mmo_data->lop_stab_symbol); + bfd_set_error (bfd_error_bad_value); + abfd->tdata.mmo_data->have_error = TRUE; + return FALSE; + } + else + c = c2; + } + + abfd->tdata.mmo_data->lop_stab_symbol[abfd->tdata.mmo_data->symbol_position++] = c; + abfd->tdata.mmo_data->lop_stab_symbol[abfd->tdata.mmo_data->symbol_position] = 0; + + if (j & MMO3_REGQUAL_BITS) + { + if (j == MMO3_REGQUAL_BITS) + { + sym_type = mmo_reg_sym; + addr = mmo_get_byte (abfd); + } + else if (j <= 8) + { + unsigned int i; + + for (i = 0; i < j; i++) + addr = (addr << 8) + mmo_get_byte (abfd); + + if (addr == 0 && j == MMO3_UNDEF) + sym_type = mmo_undef_sym; + else + sym_type = mmo_abs_sym; + } + else + { + unsigned int i; + + for (i = MMO3_DATA; i < j; i++) + addr = (addr << 8) + mmo_get_byte (abfd); + + addr += (bfd_vma) 0x20 << 56; + sym_type = mmo_data_sym; + } + + /* Get the serial number. */ + do + { + k = mmo_get_byte (abfd); + serno = (serno << 7) + k; + } + while (k < 128); + serno -= 128; + + /* Got it. Now enter it. Skip a leading ":". */ + if (! abfd->tdata.mmo_data->have_error + && ! mmo_create_symbol (abfd, + abfd->tdata.mmo_data->lop_stab_symbol + + 1, + addr, sym_type, serno)) + abfd->tdata.mmo_data->have_error = TRUE; + } + + if (m & MMO3_MIDDLE) + /* Traverse middle trie. */ + mmo_get_symbols (abfd); + + abfd->tdata.mmo_data->symbol_position--; + } + + if (m & MMO3_RIGHT) + /* Traverse right trie. */ + mmo_get_symbols (abfd); + + return ! abfd->tdata.mmo_data->have_error; +} + +/* Get the location of memory area [VMA..VMA + SIZE - 1], which we think + is in section SEC. Adjust and reallocate zero-initialized contents. + If there's new contents, allocate to the next multiple of + MMO_SEC_CONTENTS_CHUNK_SIZE. */ + +static INLINE bfd_byte * +mmo_get_loc (sec, vma, size) + asection *sec; + bfd_vma vma; + int size; +{ + bfd_size_type allocated_size; + struct mmo_section_data_struct *sdatap = mmo_section_data (sec); + struct mmo_data_list_struct *datap = sdatap->head; + struct mmo_data_list_struct *entry; + + /* First search the list to see if we have the requested chunk in one + piece, or perhaps if we have a suitable chunk with room to fit. */ + for (; datap != NULL; datap = datap->next) + { + if (datap->where <= vma + && datap->where + datap->size >= vma + size) + return datap->data + vma - datap->where; + else if (datap->where <= vma + && datap->where + datap->allocated_size >= vma + size + /* Only munch on the "allocated size" if it does not + overlap the next chunk. */ + && (datap->next == NULL || datap->next->where >= vma + size)) + { + /* There was room allocated, but the size wasn't set to include + it. Do that now. */ + datap->size += (vma + size) - (datap->where + datap->size); + + /* Update the section size. This happens only if we update the + 32-bit-aligned chunk size. Callers that have + non-32-bit-aligned sections should do all allocation and + size-setting by themselves or at least set the section size + after the last allocating call to this function. */ + if (vma + size > sec->vma + sec->_raw_size) + sec->_raw_size += (vma + size) - (sec->vma + sec->_raw_size); + + return datap->data + vma - datap->where; + } + } + + /* Not found; allocate a new block. First check in case we get a + request for a size split up over several blocks; we'll have to return + NULL for those cases, requesting the caller to split up the request. + Requests with an address aligned on MMO_SEC_CONTENTS_CHUNK_SIZE bytes and + for no more than MMO_SEC_CONTENTS_CHUNK_SIZE will always get resolved. */ + + for (datap = sdatap->head; datap != NULL; datap = datap->next) + if ((datap->where <= vma && datap->where + datap->size > vma) + || (datap->where < vma + size + && datap->where + datap->size >= vma + size)) + return NULL; + + allocated_size + = (size + MMO_SEC_CONTENTS_CHUNK_SIZE - 1) & ~(MMO_SEC_CONTENTS_CHUNK_SIZE - 1); + entry = (mmo_data_list_type *) + bfd_zalloc (sec->owner, sizeof (mmo_data_list_type) + allocated_size); + if (entry == NULL) + return NULL; + entry->where = vma; + entry->size = size; + entry->allocated_size = allocated_size; + + datap = sdatap->head; + + /* Sort the records by address. Optimize for the common case of adding + a record to the end of the list. */ + if (sdatap->tail != NULL && entry->where >= sdatap->tail->where) + { + sdatap->tail->next = entry; + entry->next = NULL; + sdatap->tail = entry; + } + else + { + mmo_data_list_type **look; + for (look = &sdatap->head; + *look != NULL && (*look)->where < entry->where; + look = &(*look)->next) + ; + entry->next = *look; + *look = entry; + if (entry->next == NULL) + { + sdatap->tail = entry; + + /* We get here for the first time (at other times too) for this + section. Say we have contents. */ + if (! bfd_set_section_flags (sec->owner, sec, + bfd_get_section_flags (sec->owner, sec) + | SEC_HAS_CONTENTS)) + return NULL; + } + } + + /* Update the section size. This happens only when we add contents and + re-size as we go. The section size will then be aligned to 32 bits. */ + if (vma + size > sec->vma + sec->_raw_size) + sec->_raw_size += (vma + size) - (sec->vma + sec->_raw_size); + return entry->data; +} + +/* Set sizes once we've read in all sections. */ + +static void +mmo_map_set_sizes (abfd, sec, ignored) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; + PTR ignored ATTRIBUTE_UNUSED; +{ + sec->_cooked_size = sec->_raw_size; + sec->lma = sec->vma; +} + +/* Read the mmo file and turn it into sections. */ + +static bfd_boolean +mmo_scan (abfd) + bfd *abfd; +{ + unsigned int i; + unsigned int lineno = 1; + bfd_boolean error = FALSE; + bfd_vma vma = 0; + asection *sec = bfd_make_section_old_way (abfd, MMO_TEXT_SECTION_NAME); + asection *non_spec_sec = NULL; + bfd_vma non_spec_vma = 0; + char *current_filename = NULL; + bfd_size_type nbytes_read = 0; + /* Buffer with room to read a 64-bit value. */ + bfd_byte buf[8]; + long stab_loc = -1; + char *file_names[256]; + + memset (file_names, 0, sizeof (file_names)); + + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + goto error_return; + + while ((nbytes_read = bfd_bread (buf, 4, abfd)) == 4) + { + if (buf[0] == LOP) + { + unsigned int y = bfd_get_8 (abfd, buf + 2); + unsigned int z = bfd_get_8 (abfd, buf + 3); + + /* Change back to the original section for lopcodes other + than LOP_QUOTE that comes after a LOP_SPEC. */ + if ((buf[1] != LOP_QUOTE || y != 0 || z != 1) + && non_spec_sec != NULL) + { + sec = non_spec_sec; + vma = non_spec_vma; + non_spec_sec = NULL; + } + + switch (buf[1]) + { + default: + (*_bfd_error_handler) + (_("%s: invalid mmo file: unsupported lopcode `%d'\n"), + bfd_get_filename (abfd), buf[1]); + bfd_set_error (bfd_error_bad_value); + goto error_return; + + case LOP_QUOTE: + /* Quote the next 32-bit word. */ + if (y != 0 || z != 1) + { + (*_bfd_error_handler) + (_("%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n"), + bfd_get_filename (abfd), y*256+z); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + if (bfd_bread (buf, 4, abfd) != 4) + goto error_return; + + mmo_xore_32 (sec, vma, bfd_get_32 (abfd, buf)); + vma += 4; + vma &= ~3; + lineno++; + break; + + case LOP_LOC: + /* Set vma (and section). */ + vma = (bfd_vma) y << 56; + if (z == 1) + { + /* Get a 32-bit value. */ + if (bfd_bread (buf, 4, abfd) != 4) + goto error_return; + + vma += bfd_get_32 (abfd, buf); + } + else if (z == 2) + { + /* Get a 64-bit value. */ + if (bfd_bread (buf, 8, abfd) != 8) + goto error_return; + + vma += bfd_get_64 (abfd, buf); + } + else + { + (*_bfd_error_handler) + (_("%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n"), + bfd_get_filename (abfd), z); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + sec = mmo_decide_section (abfd, vma); + if (sec == NULL) + goto error_return; + break; + + case LOP_SKIP: + /* Move forward within the same section. */ + vma += y * 256 + z; + + sec = mmo_decide_section (abfd, vma); + if (sec == NULL) + goto error_return; + break; + + case LOP_FIXO: + /* A fixup: Store the current vma somewhere. Position using + same format as LOP_LOC. */ + { + bfd_vma p = (bfd_vma) y << 56; + asection *fixosec; + + if (z == 1) + { + /* Get a 32-bit value. */ + if (bfd_bread (buf, 4, abfd) != 4) + goto error_return; + + p += bfd_get_32 (abfd, buf); + } + else if (z == 2) + { + /* Get a 64-bit value. */ + if (bfd_bread (buf, 8, abfd) != 8) + goto error_return; + + p += bfd_get_64 (abfd, buf); + } + else + { + (*_bfd_error_handler) + (_("%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n"), + bfd_get_filename (abfd), z); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + /* The section where we store this address might be a + different one than the current section. */ + fixosec = mmo_decide_section (abfd, p); + if (fixosec == NULL) + goto error_return; + mmo_xore_64 (fixosec, p, vma); + } + break; + + case LOP_FIXR: + /* A fixup: Store YZ of this lopcode into YZ at vma - 4 * yz. */ + { + unsigned int yz = (y * 256 + z); + bfd_vma p = vma + 2 - 4 * yz; + asection *fixrsec = mmo_decide_section (abfd, p); + if (fixrsec == NULL) + goto error_return; + mmo_xore_16 (fixrsec, p, yz); + } + break; + + case LOP_FIXRX: + /* A fixup, similar to lop_fixr, but taking larger numbers + and can change branches into the opposite direction + (gasp!). */ + { + bfd_vma delta; + bfd_vma p; + asection *fixrsec; + + if (y != 0) + { + (*_bfd_error_handler) + (_("%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n"), + bfd_get_filename (abfd), y); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + if (z != 16 && z != 24) + { + (*_bfd_error_handler) + (_("%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n"), + bfd_get_filename (abfd), z); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + /* Get the next 32-bit value. */ + if (bfd_bread (buf, 4, abfd) != 4) + goto error_return; + + delta = bfd_get_32 (abfd, buf); + + /* Do an, ehm, involved calculation for the location of + the fixup. See mmixal documentation for a verbose + explanation. We follow it verbosely here for the + readers delight. */ + if (buf[0] == 0) + p = vma - 4 * delta; + else if (buf[0] == 1) + p = vma - 4 * ((delta & 0xffffff) - (1 << z)); + else + { + (*_bfd_error_handler) + (_("%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d for lop_fixrx\n"), + bfd_get_filename (abfd), buf[0]); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + fixrsec = mmo_decide_section (abfd, vma); + if (fixrsec == NULL) + goto error_return; + mmo_xore_32 (fixrsec, p, delta); + } + break; + + case LOP_FILE: + /* Set current file and perhaps the file name. Reset line + number. */ + if (z != 0) + { + char *fname = bfd_malloc (z * 4 + 1); + + if (fname == NULL) + { + (*_bfd_error_handler) + (_("%s: cannot allocate file name for file number %d, %d bytes\n"), + bfd_get_filename (abfd), y, z * 4 + 1); + bfd_set_error (bfd_error_system_call); + goto error_return; + } + + fname[z * 4] = 0; + + for (i = 0; i < z; i++) + { + if (bfd_bread (fname + i * 4, 4, abfd) != 4) + { + free (fname); + goto error_return; + } + } + + if (file_names[y] != NULL) + { + (*_bfd_error_handler) + (_("%s: invalid mmo file: file number %d `%s',\ + was already entered as `%s'\n"), + bfd_get_filename (abfd), y, fname, file_names[y]); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + file_names[y] = fname; + } + + if (file_names[y] == NULL) + { + (*_bfd_error_handler) + (_("%s: invalid mmo file: file name for number %d\ + was not specified before use\n"), + bfd_get_filename (abfd), y); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + current_filename = file_names[y]; + lineno = 0; + break; + + case LOP_LINE: + /* Set line number. */ + lineno = y * 256 + z; + /* FIXME: Create a sequence of mmo-specific line number + entries for each section, then translate into canonical + format. */ + break; + + case LOP_SPEC: + /* Special data follows until the next non-lop_quote + lopcode. */ + non_spec_sec = sec; + non_spec_vma = vma; + sec = mmo_get_spec_section (abfd, y * 256 + z); + if (sec == NULL) + goto error_return; + + vma = sec->vma; + break; + + case LOP_PRE: + { + /* We ignore header information, except we read in the + creation time from the first 32-bit word with the time + in seconds since era. */ + if (z >= 1 + && bfd_bread (abfd->tdata.mmo_data->created, 4, + abfd) != 4) + goto error_return; + + for (i = 1; i < z; i++) + if (bfd_bread (buf, 4, abfd) != 4) + goto error_return; + } + break; + + case LOP_POST: + /* This tells of the contents of registers $Z..$255 at + startup. We make a section out of it, with VMA = Z * 8, + but only if Z != 255 or the contents is non-zero. */ + { + asection *rsec; + bfd_byte *loc; + bfd_vma first_octa; + bfd_vma startaddr_octa; + + /* Read first octaword outside loop to simplify logic when + excluding the Z == 255, octa == 0 case. */ + if (bfd_bread (buf, 8, abfd) != 8) + goto error_return; + + first_octa = bfd_get_64 (abfd, buf); + + /* Don't emit contents for the trivial case which is + always present; $255 pointing to Main. */ + if (z != 255) + { + rsec + = bfd_make_section_old_way (abfd, + MMIX_REG_CONTENTS_SECTION_NAME); + rsec->vma = z * 8; + loc = mmo_get_loc (rsec, z * 8, (255 - z) * 8); + bfd_put_64 (abfd, first_octa, loc); + + for (i = z + 1; i < 255; i++) + { + if (bfd_bread (loc + (i - z) * 8, 8, abfd) != 8) + goto error_return; + } + + /* Read out the last octabyte, and use it to set the + start address. */ + if (bfd_bread (buf, 8, abfd) != 8) + goto error_return; + + startaddr_octa = bfd_get_64 (abfd, buf); + } + else + startaddr_octa = first_octa; + + if (! bfd_set_start_address (abfd, startaddr_octa)) + { + /* Currently this can't fail, but this should handle + future failures. */ + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + } + break; + + case LOP_STAB: + /* We read in the symbols now, not later. */ + if (y != 0 || z != 0) + { + (*_bfd_error_handler) + (_("%s: invalid mmo file: fields y and z of lop_stab\ + non-zero, y: %d, z: %d\n"), + bfd_get_filename (abfd), y, z); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + /* Save the location, so we can check that YZ in the LOP_END + is correct. */ + stab_loc = bfd_tell (abfd); + + /* It's not said that an MMO can be without symbols (though + mmixal will refuse to assemble files without Main), but + it seems it would still be a valid mmo-file, so allow it. + We detect the absence of a symbol area in that the upper + limit is computed (from the lop_end YZ field) as 0. + Don't call mmo_get_symbols; it can only detect the end of + a valid symbol trie, not the absence of one. */ + if (abfd->tdata.mmo_data->max_symbol_length != 0 + && ! mmo_get_symbols (abfd)) + goto error_return; + break; + + case LOP_END: + { + /* This must be the last 32-bit word in an mmo file. + Let's find out. */ + struct stat statbuf; + long curpos = bfd_tell (abfd); + + if (bfd_stat (abfd, &statbuf) < 0) + goto error_return; + + if (statbuf.st_size != curpos) + { + (*_bfd_error_handler) + (_("%s: invalid mmo file: lop_end not last item in\ + file\n"), + bfd_get_filename (abfd)); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + /* Check that the YZ field is right. Subtract the size of + this LOP_END in the calculation; YZ does not include + it. */ + if ((long) (y * 256 + z) * 4 != (curpos - stab_loc) - 4) + { + (*_bfd_error_handler) + (_("%s: invalid mmo file: YZ of lop_end (%ld)\ + not equal to the number of tetras to the preceding lop_stab (%ld)\n"), + bfd_get_filename (abfd), (long) (y * 256 + z), + (curpos - stab_loc - 4)/4); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + bfd_map_over_sections (abfd, mmo_map_set_sizes, NULL); + goto done; + } + } + } + else + { + /* This wasn't a lopcode, so store it in the current section. */ + mmo_xore_32 (sec, vma & ~3, bfd_get_32 (abfd, buf)); + vma += 4; + vma &= ~3; + lineno++; + } + } + + /* We know this file is a multiple of four bytes (checked in + mmo_object_p), so if we got something other than 0, this was a bad + file (although it's more likely we'll get 0 in that case too). + If we got end-of-file, then there was no lop_stab, so the file has + invalid format. */ + + if (nbytes_read != 0) + bfd_set_error (bfd_error_system_call); + else + bfd_set_error (bfd_error_bad_value); + + error_return: + error = TRUE; + done: + /* Mark the .text and .data section with their normal attribute if they + contain anything. This is not redundant wrt. mmo_decide_section, + since that code might never execute, and conversely the alloc+code + section flags must be set then. */ + sec = bfd_get_section_by_name (abfd, MMO_TEXT_SECTION_NAME); + if (sec != NULL + && (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) + && ! bfd_set_section_flags (abfd, sec, + bfd_get_section_flags (abfd, sec) + | SEC_ALLOC | SEC_LOAD | SEC_CODE)) + error = TRUE; + + sec = bfd_get_section_by_name (abfd, MMO_DATA_SECTION_NAME); + if (sec != NULL + && (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) + && ! bfd_set_section_flags (abfd, sec, + bfd_get_section_flags (abfd, sec) + | SEC_ALLOC | SEC_LOAD)) + error = TRUE; + + /* Free whatever resources we took. */ + for (i = 0; i < sizeof (file_names) / sizeof (file_names[0]); i++) + if (file_names[i]) + free (file_names[i]); + return ! error; +} + +/* A hook to set up object file dependent section information. For mmo, + we point out the shape of allocated section contents. */ + +static bfd_boolean +mmo_new_section_hook (abfd, newsect) + bfd *abfd ATTRIBUTE_UNUSED; + asection *newsect; +{ + /* We zero-fill all fields and assume NULL is represented by an all + zero-bit pattern. */ + newsect->used_by_bfd = + (PTR) bfd_zalloc (abfd, sizeof (struct mmo_section_data_struct)); + + if (!newsect->used_by_bfd) + return FALSE; + + /* Always align to at least 32-bit words. */ + newsect->alignment_power = 2; + return TRUE; +} + +/* We already have section contents loaded for sections that have + contents. */ + +static bfd_boolean +mmo_get_section_contents (abfd, sec, location, offset, bytes_to_do) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + PTR location ATTRIBUTE_UNUSED; + file_ptr offset ATTRIBUTE_UNUSED; + bfd_size_type bytes_to_do ATTRIBUTE_UNUSED; +{ + /* Iterate over diminishing chunk sizes, copying contents, like + mmo_set_section_contents. */ + while (bytes_to_do) + { + /* A minor song-and-dance to make sure we're not bitten by the + distant possibility of the cast from bfd_vma to int making the + chunk zero-sized. */ + int chunk_size + = (int) bytes_to_do != 0 ? bytes_to_do : MMO_SEC_CONTENTS_CHUNK_SIZE; + bfd_byte *loc; + + do + loc = mmo_get_loc (sec, sec->vma + offset, chunk_size); + while (loc == NULL && (chunk_size /= 2) != 0); + + if (chunk_size == 0) + return FALSE; + + memcpy (location, loc, chunk_size); + + location += chunk_size; + bytes_to_do -= chunk_size; + offset += chunk_size; + } + return TRUE; +} + +/* Return the amount of memory needed to read the symbol table. */ + +static long +mmo_get_symtab_upper_bound (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ + return (abfd->symcount + 1) * sizeof (asymbol *); +} + +/* Sort mmo symbols by serial number. */ + +static int +mmo_sort_mmo_symbols (arg1, arg2) + const PTR arg1; + const PTR arg2; +{ + const struct mmo_symbol *sym1 = *(const struct mmo_symbol **) arg1; + const struct mmo_symbol *sym2 = *(const struct mmo_symbol **) arg2; + + /* Sort by serial number first. */ + if (sym1->serno < sym2->serno) + return -1; + else if (sym1->serno > sym2->serno) + return 1; + + /* Then sort by address of the table entries. */ + return ((const char *) arg1 - (const char *) arg2); +} + +/* Translate the symbol table. */ + +static long +mmo_canonicalize_symtab (abfd, alocation) + bfd *abfd; + asymbol **alocation; +{ + unsigned int symcount = bfd_get_symcount (abfd); + asymbol *csymbols; + unsigned int i; + + csymbols = abfd->tdata.mmo_data->csymbols; + if (csymbols == NULL) + { + asymbol *c; + struct mmo_symbol *s; + struct mmo_symbol **msp; + + /* First we store the symbols into the table we'll return, then we + qsort it on the serial number, with secondary on the address of + the symbol, to preserve order if there would be non-unique serial + numbers. */ + for (s = abfd->tdata.mmo_data->symbols, + msp = (struct mmo_symbol **) alocation; + s != NULL; + s = s->next, ++msp) + *msp = s; + + *msp = NULL; + + qsort (alocation, symcount, sizeof (struct mmo_symbol *), + mmo_sort_mmo_symbols); + + csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol)); + if (csymbols == NULL && symcount != 0) + return FALSE; + abfd->tdata.mmo_data->csymbols = csymbols; + + for (msp = (struct mmo_symbol **) alocation, c = csymbols; + *msp != NULL; + msp++, ++c) + { + s = *msp; + c->the_bfd = abfd; + c->name = s->name; + c->value = s->value; + c->flags = BSF_GLOBAL; + + if (s->sym_type == mmo_data_sym) + { + c->section + = bfd_get_section_by_name (abfd, MMO_DATA_SECTION_NAME); + + if (c->section == NULL) + c->section = bfd_abs_section_ptr; + else + c->value -= c->section->vma; + } + else if (s->sym_type == mmo_undef_sym) + c->section = bfd_und_section_ptr; + else if (s->sym_type == mmo_reg_sym) + { + c->section + = bfd_make_section_old_way (abfd, MMIX_REG_SECTION_NAME); + } + else + { + asection *textsec + = bfd_get_section_by_name (abfd, MMO_TEXT_SECTION_NAME); + + if (textsec != NULL + && c->value >= textsec->vma + && c->value <= textsec->vma + textsec->_cooked_size) + { + c->section = textsec; + c->value -= c->section->vma; + } + else + c->section = bfd_abs_section_ptr; + } + + c->udata.p = NULL; + } + } + + /* Last, overwrite the incoming table with the right-type entries. */ + for (i = 0; i < symcount; i++) + *alocation++ = csymbols++; + *alocation = NULL; + + return symcount; +} + +/* Get information about a symbol. */ + +static void +mmo_get_symbol_info (ignore_abfd, symbol, ret) + bfd *ignore_abfd ATTRIBUTE_UNUSED; + asymbol *symbol; + symbol_info *ret; +{ + bfd_symbol_info (symbol, ret); +} + +static void +mmo_print_symbol (abfd, afile, symbol, how) + bfd *abfd; + PTR afile; + asymbol *symbol; + bfd_print_symbol_type how; +{ + FILE *file = (FILE *) afile; + + switch (how) + { + case bfd_print_symbol_name: + fprintf (file, "%s", symbol->name); + break; + default: + bfd_print_symbol_vandf (abfd, (PTR) file, symbol); + + fprintf (file, " %-5s %s", + symbol->section->name, + symbol->name); + } +} + +/* We can't map a file directly into executable code, so the + size of header information is irrelevant. */ + +static int +mmo_sizeof_headers (abfd, exec) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_boolean exec ATTRIBUTE_UNUSED; +{ + return 0; +} + +/* Write the (section-neutral) file preamble. */ + +static bfd_boolean +mmo_internal_write_header (abfd) + bfd *abfd; +{ + const char lop_pre_bfd[] = { LOP, LOP_PRE, 1, 1}; + + if (bfd_bwrite (lop_pre_bfd, 4, abfd) != 4) + return FALSE; + + /* Copy creation time of original file. */ + if (bfd_bwrite (abfd->tdata.mmo_data->created, 4, abfd) != 4) + return FALSE; + + return TRUE; +} + +/* Write the LOP_POST record, with global register initializations. + Z is the Z field of the LOP_POST, corresponding to 255 - number of + registers at DATA. The Z = 255 field is filled in with the + start-address. */ + +static bfd_boolean +mmo_internal_write_post (abfd, z, sec) + bfd *abfd; + int z; + asection *sec; +{ + int i; + bfd_byte buf[8]; + mmo_write_tetra_raw (abfd, (LOP << 24) | (LOP_POST << 16) | z); + + for (i = z; i < 255; i++) + { + bfd_byte *data = mmo_get_loc (sec, i * 8, 8); + + if (bfd_bwrite (data, 8, abfd) != 8) + return FALSE; + } + + /* For Z == $255, we always emit the start location; supposedly Main, + but we have it handy at bfd_get_start_address. If we're called with + Z == 255, don't assume DATA is valid. */ + bfd_put_64 (abfd, bfd_get_start_address (abfd), buf); + + return ! abfd->tdata.mmo_data->have_error && bfd_bwrite (buf, 8, abfd) == 8; +} + +/* Translate to and from BFD flags. This is to make sure that we don't + get bitten by BFD flag number changes. */ + +static flagword +mmo_sec_flags_from_bfd_flags (flags) + flagword flags; +{ + flagword oflags = 0; + + if (flags & SEC_ALLOC) + oflags |= MMO_SEC_ALLOC; + if (flags & SEC_LOAD) + oflags |= MMO_SEC_LOAD; + if (flags & SEC_RELOC) + oflags |= MMO_SEC_RELOC; + if (flags & SEC_READONLY) + oflags |= MMO_SEC_READONLY; + if (flags & SEC_CODE) + oflags |= MMO_SEC_CODE; + if (flags & SEC_DATA) + oflags |= MMO_SEC_DATA; + if (flags & SEC_NEVER_LOAD) + oflags |= MMO_SEC_NEVER_LOAD; + if (flags & SEC_IS_COMMON) + oflags |= MMO_SEC_IS_COMMON; + if (flags & SEC_DEBUGGING) + oflags |= MMO_SEC_DEBUGGING; + + return oflags; +} + +static flagword +bfd_sec_flags_from_mmo_flags (flags) + flagword flags; +{ + flagword oflags = 0; + + if (flags & MMO_SEC_ALLOC) + oflags |= SEC_ALLOC; + if (flags & MMO_SEC_LOAD) + oflags |= SEC_LOAD; + if (flags & MMO_SEC_RELOC) + oflags |= SEC_RELOC; + if (flags & MMO_SEC_READONLY) + oflags |= SEC_READONLY; + if (flags & MMO_SEC_CODE) + oflags |= SEC_CODE; + if (flags & MMO_SEC_DATA) + oflags |= SEC_DATA; + if (flags & MMO_SEC_NEVER_LOAD) + oflags |= SEC_NEVER_LOAD; + if (flags & MMO_SEC_IS_COMMON) + oflags |= SEC_IS_COMMON; + if (flags & MMO_SEC_DEBUGGING) + oflags |= SEC_DEBUGGING; + + return oflags; +} + +/* Write a section. */ + +static bfd_boolean +mmo_internal_write_section (abfd, sec) + bfd *abfd; + asection *sec; +{ + /* We do it differently depending on what section this is: + + ".text": Output, prepended by information about the first source file + (not yet implemented.) + + ".data": Output. + + (".MMIX.reg_contents": Not handled here.) + + Anything else: Output inside a lop_spec 80, in the format described + above. */ + + if (strcmp (sec->name, MMO_TEXT_SECTION_NAME) == 0) + /* FIXME: Output source file name and line number. */ + return mmo_write_loc_chunk_list (abfd, mmo_section_data (sec)->head); + else if (strcmp (sec->name, MMO_DATA_SECTION_NAME) == 0) + return mmo_write_loc_chunk_list (abfd, mmo_section_data (sec)->head); + else if (strcmp (sec->name, MMIX_REG_CONTENTS_SECTION_NAME) == 0) + /* Not handled here. */ + { + /* This would normally be an abort call since this can't happen, but + we don't do that. */ + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + else if (strncmp (sec->name, MMIX_OTHER_SPEC_SECTION_PREFIX, + strlen (MMIX_OTHER_SPEC_SECTION_PREFIX)) == 0) + { + int n = atoi (sec->name + strlen (MMIX_OTHER_SPEC_SECTION_PREFIX)); + mmo_write_tetra_raw (abfd, (LOP << 24) | (LOP_SPEC << 16) | n); + return (! abfd->tdata.mmo_data->have_error + && mmo_write_chunk_list (abfd, mmo_section_data (sec)->head)); + } + /* Ignore sections that are just allocated or empty; we write out + _contents_ here. */ + else if ((bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) != 0 + && sec->_raw_size != 0) + { + /* Keep the document-comment formatted the way it is. */ +/* +INODE +mmo section mapping, , Symbol-table, mmo +SUBSECTION + mmo section mapping + + The implementation in BFD uses special data type 80 (decimal) to + encapsulate and describe named sections, containing e.g.@: debug + information. If needed, any datum in the encapsulation will be + quoted using lop_quote. First comes a 32-bit word holding the + number of 32-bit words containing the zero-terminated zero-padded + segment name. After the name there's a 32-bit word holding flags + describing the section type. Then comes a 64-bit big-endian word + with the section length (in bytes), then another with the section + start address. Depending on the type of section, the contents + might follow, zero-padded to 32-bit boundary. For a loadable + section (such as data or code), the contents might follow at some + later point, not necessarily immediately, as a lop_loc with the + same start address as in the section description, followed by the + contents. This in effect forms a descriptor that must be emitted + before the actual contents. Sections described this way must not + overlap. + + For areas that don't have such descriptors, synthetic sections are + formed by BFD. Consecutive contents in the two memory areas + @samp{0x0000@dots{}00} to @samp{0x01ff@dots{}ff} and + @samp{0x2000@dots{}00} to @samp{0x20ff@dots{}ff} are entered in + sections named <<.text>> and <<.data>> respectively. If an area + is not otherwise described, but would together with a neighboring + lower area be less than @samp{0x40000000} bytes long, it is joined + with the lower area and the gap is zero-filled. For other cases, + a new section is formed, named <<.MMIX.sec.@var{n}>>. Here, + @var{n} is a number, a running count through the mmo file, + starting at 0. + +EXAMPLE + A loadable section specified as: + +| .section secname,"ax" +| TETRA 1,2,3,4,-1,-2009 +| BYTE 80 + + and linked to address @samp{0x4}, is represented by the sequence: + +| 0x98080050 - lop_spec 80 +| 0x00000002 - two 32-bit words for the section name +| 0x7365636e - "secn" +| 0x616d6500 - "ame\0" +| 0x00000033 - flags CODE, READONLY, LOAD, ALLOC +| 0x00000000 - high 32 bits of section length +| 0x0000001c - section length is 28 bytes; 6 * 4 + 1 + alignment to 32 bits +| 0x00000000 - high 32 bits of section address +| 0x00000004 - section address is 4 +| 0x98010002 - 64 bits with address of following data +| 0x00000000 - high 32 bits of address +| 0x00000004 - low 32 bits: data starts at address 4 +| 0x00000001 - 1 +| 0x00000002 - 2 +| 0x00000003 - 3 +| 0x00000004 - 4 +| 0xffffffff - -1 +| 0xfffff827 - -2009 +| 0x50000000 - 80 as a byte, padded with zeros. + + Note that the lop_spec wrapping does not include the section + contents. Compare this to a non-loaded section specified as: + +| .section thirdsec +| TETRA 200001,100002 +| BYTE 38,40 + + This, when linked to address @samp{0x200000000000001c}, is + represented by: + +| 0x98080050 - lop_spec 80 +| 0x00000002 - two 32-bit words for the section name +| 0x7365636e - "thir" +| 0x616d6500 - "dsec" +| 0x00000010 - flag READONLY +| 0x00000000 - high 32 bits of section length +| 0x0000000c - section length is 12 bytes; 2 * 4 + 2 + alignment to 32 bits +| 0x20000000 - high 32 bits of address +| 0x0000001c - low 32 bits of address 0x200000000000001c +| 0x00030d41 - 200001 +| 0x000186a2 - 100002 +| 0x26280000 - 38, 40 as bytes, padded with zeros + + For the latter example, the section contents must not be + loaded in memory, and is therefore specified as part of the + special data. The address is usually unimportant but might + provide information for e.g.@: the DWARF 2 debugging format. */ + + mmo_write_tetra_raw (abfd, LOP_SPEC_SECTION); + mmo_write_tetra (abfd, (strlen (sec->name) + 3) / 4); + mmo_write_chunk (abfd, sec->name, strlen (sec->name)); + mmo_flush_chunk (abfd); + /* FIXME: We can get debug sections (.debug_line & Co.) with a + section flag still having SEC_RELOC set. Investigate. This + might be true for all alien sections; perhaps mmo.em should clear + that flag. Might be related to weak references. */ + mmo_write_tetra (abfd, + mmo_sec_flags_from_bfd_flags + (bfd_get_section_flags (abfd, sec))); + mmo_write_octa (abfd, sec->_raw_size); + mmo_write_octa (abfd, bfd_get_section_vma (abfd, sec)); + + /* Writing a LOP_LOC ends the LOP_SPEC data, and makes data actually + loaded. */ + if (bfd_get_section_flags (abfd, sec) & SEC_LOAD) + return (! abfd->tdata.mmo_data->have_error + && mmo_write_loc_chunk_list (abfd, + mmo_section_data (sec)->head)); + return (! abfd->tdata.mmo_data->have_error + && mmo_write_chunk_list (abfd, mmo_section_data (sec)->head)); + } + return TRUE; +} + +/* We save up all data before output. */ + +static bfd_boolean +mmo_set_section_contents (abfd, sec, location, offset, bytes_to_do) + bfd *abfd ATTRIBUTE_UNUSED; + sec_ptr sec; + const PTR location; + file_ptr offset; + bfd_size_type bytes_to_do; +{ + /* Iterate over diminishing chunk sizes, copying contents. */ + while (bytes_to_do) + { + /* A minor song-and-dance to make sure we're not bitten by the + distant possibility of the cast from bfd_vma to int making the + chunk zero-sized. */ + int chunk_size + = (int) bytes_to_do != 0 ? bytes_to_do : MMO_SEC_CONTENTS_CHUNK_SIZE; + bfd_byte *loc; + + do + loc = mmo_get_loc (sec, sec->vma + offset, chunk_size); + while (loc == NULL && (chunk_size /= 2) != 0); + + if (chunk_size == 0) + return FALSE; + + memcpy (loc, location, chunk_size); + + location += chunk_size; + bytes_to_do -= chunk_size; + offset += chunk_size; + } + return TRUE; +} + +/* Add a symbol to a trie-tree. */ + +static bfd_boolean +mmo_internal_add_3_sym (abfd, rootp, symp) + bfd *abfd; + struct mmo_symbol_trie *rootp; + const struct mmo_symbol *symp; +{ + const char *name = symp->name; + struct mmo_symbol_trie *trie = rootp; + struct mmo_symbol_trie **triep = NULL; + + while (*name && trie != NULL) + { + if (*name < trie->symchar) + { + triep = &trie->left; + trie = trie->left; + } + else if (*name > trie->symchar) + { + triep = &trie->right; + trie = trie->right; + } + else if (*name == trie->symchar) + { + triep = &trie->middle; + name++; + + /* Make sure "trie" points to where we should fill in the + current symbol whenever we've iterated through "name". We + would lose the right position if we encounter "foobar" then + "foo". */ + if (*name) + trie = trie->middle; + } + } + + while (*name != 0) + { + /* Create middle branches for the rest of the characters. */ + trie = bfd_zalloc (abfd, sizeof (struct mmo_symbol_trie)); + *triep = trie; + trie->symchar = *name++; + triep = &trie->middle; + } + + /* We discover a duplicate symbol rather late in the process, but still; + we discover it and bail out. */ + if (trie->sym.name != NULL) + { + (*_bfd_error_handler) + (_("%s: invalid symbol table: duplicate symbol `%s'\n"), + bfd_get_filename (abfd), trie->sym.name); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + memcpy (&trie->sym, symp, sizeof *symp); + return TRUE; +} + +/* Find out the length of the serialized version of a trie in bytes. */ + +static unsigned int +mmo_internal_3_length (abfd, trie) + bfd *abfd; + struct mmo_symbol_trie *trie; +{ + /* First, one for the control byte. */ + unsigned int length = 1; + + if (trie == NULL) + return 0; + + /* Add in the recursion to the left. */ + length += mmo_internal_3_length (abfd, trie->left); + + /* Add in the middle trie and the character. */ + length += 1 + mmo_internal_3_length (abfd, trie->middle); + + /* Add in the recursion to the right. */ + length += mmo_internal_3_length (abfd, trie->right); + + /* Add in bytes for the symbol (if this is an endnode). */ + if (trie->sym.name != NULL) + { + unsigned int serno = trie->sym.serno; + + /* First what it takes to encode the value. */ + if (trie->sym.sym_type == mmo_reg_sym) + length++; + else if (trie->sym.sym_type == mmo_undef_sym) + length += 2; + else + { + bfd_vma value = trie->sym.value; + + /* Coded in one to eight following bytes. */ + if (trie->sym.sym_type == mmo_data_sym) + value -= (bfd_vma) 0x20 << 56; + + do + { + value >>= 8; + length++; + } + while (value != 0); + } + + /* Find out what it takes to encode the serial number. */ + do + { + serno >>= 7; + length++; + } + while (serno != 0); + } + + return length; +} + +/* Helper function for outputting the serial number of a symbol, output as + a variant of leb128 (see dwarf2 documentation) which could be called + beb128. Using a helper function and recursion simplifies debugging. */ + +static void +mmo_beb128_out (abfd, serno, marker) + bfd *abfd; + int serno; + int marker; +{ + if (serno & ~0x7f) + mmo_beb128_out (abfd, serno >> 7, 0); + mmo_write_byte (abfd, marker | (serno & 0x7f)); +} + +/* Serialize a trie. */ + +static void +mmo_internal_3_dump (abfd, trie) + bfd *abfd; + struct mmo_symbol_trie *trie; +{ + bfd_byte control = 0; + + if (trie == NULL) + return; + + if (trie->left) + control |= MMO3_LEFT; + + if (trie->middle) + control |= MMO3_MIDDLE; + + if (trie->right) + control |= MMO3_RIGHT; + + if (trie->sym.name != NULL) + { + /* Encode the symbol type and length of value bytes. */ + if (trie->sym.sym_type == mmo_reg_sym) + control |= MMO3_REGQUAL_BITS; + else if (trie->sym.sym_type == mmo_undef_sym) + control |= MMO3_UNDEF; + else + { + bfd_vma value = trie->sym.value; + + /* Coded in 1..8 following bytes. */ + if (trie->sym.sym_type == mmo_data_sym) + { + control |= MMO3_DATA; + value -= (bfd_vma) 0x20 << 56; + } + + do + { + value >>= 8; + control++; + } + while (value != 0); + } + } + + /* The control byte is output before recursing. */ + mmo_write_byte (abfd, control); + + mmo_internal_3_dump (abfd, trie->left); + + if (control & MMO3_SYMBITS) + { + mmo_write_byte (abfd, trie->symchar); + + if (trie->sym.name != NULL) + { + if (trie->sym.sym_type == mmo_reg_sym) + mmo_write_byte (abfd, trie->sym.value); + else if (trie->sym.sym_type == mmo_undef_sym) + { + mmo_write_byte (abfd, 0); + mmo_write_byte (abfd, 0); + } + else + { + bfd_vma value = trie->sym.value; + + bfd_byte byte_n = control & 15; + + /* Coded in 1..8 following bytes. Note that the value is + shifted out big-endian. */ + if (trie->sym.sym_type == mmo_data_sym) + { + value -= (bfd_vma) 0x20 << 56; + byte_n -= 8; + } + + do + { + mmo_write_byte (abfd, (value >> ((byte_n - 1) * 8)) & 0xff); + byte_n--; + } + while (byte_n != 0); + } + + mmo_beb128_out (abfd, trie->sym.serno, 128); + } + mmo_internal_3_dump (abfd, trie->middle); + } + mmo_internal_3_dump (abfd, trie->right); +} + +/* Write symbols in mmo format. Also write the lop_end terminator. */ + +static bfd_boolean +mmo_write_symbols_and_terminator (abfd) + bfd *abfd; +{ + int count = bfd_get_symcount (abfd); + asymbol *maintable[2]; + asymbol **table; + asymbol **orig_table = bfd_get_outsymbols (abfd); + int serno; + struct mmo_symbol_trie root; + int trie_len; + int i; + bfd_byte buf[4]; + + /* Create a symbol for "Main". */ + asymbol *fakemain = bfd_make_empty_symbol (abfd); + + fakemain->flags = BSF_GLOBAL; + fakemain->value = bfd_get_start_address (abfd); + fakemain->name = MMIX_START_SYMBOL_NAME; + fakemain->section = bfd_abs_section_ptr; + maintable[0] = fakemain; + maintable[1] = NULL; + + memset (&root, 0, sizeof (root)); + + /* Make all symbols take a left turn. */ + root.symchar = 0xff; + + /* There must always be a ":Main", so we'll add one if there are no + symbols. Make sure we have room for it. */ + table = bfd_alloc (abfd, (count + 1) * sizeof (asymbol *)); + if (table == NULL) + return FALSE; + + memcpy (table, orig_table, count * sizeof (asymbol *)); + + /* Move :Main (if there is one) to the first position. This is + necessary to get the same layout of the trie-tree when linking as + when objcopying the result as in the objcopy.exp test "simple objcopy + of executable". It also automatically takes care of assigning serial + number 1 to :Main (as is mandatory). */ + for (i = 0; i < count; i++) + if (table[i] != NULL + && strcmp (table[i]->name, MMIX_START_SYMBOL_NAME) == 0 + && (table[i]->flags & (BSF_DEBUGGING|BSF_GLOBAL)) == BSF_GLOBAL) + { + asymbol *mainsym = table[i]; + memcpy (table + 1, orig_table, i * sizeof (asymbol *)); + table[0] = mainsym; + + /* Check that the value assigned to :Main is the same as the entry + address. The default linker script asserts this. This is as + good a place as any to check this consistency. */ + if ((mainsym->value + + mainsym->section->output_section->vma + + mainsym->section->output_offset) + != bfd_get_start_address (abfd)) + { + /* Arbitrary buffer to hold the printable representation of a + vma. */ + char vmas_main[40]; + char vmas_start[40]; + bfd_vma vma_start = bfd_get_start_address (abfd); + + sprintf_vma (vmas_main, mainsym->value); + sprintf_vma (vmas_start, vma_start); + + (*_bfd_error_handler) + (_("%s: Bad symbol definition: `Main' set to %s rather\ + than the start address %s\n"), + bfd_get_filename (abfd), vmas_main, vmas_start); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + break; + } + if (i == count && count != 0) + { + /* When there are symbols, there must be a :Main. There was no + :Main, so we need to add it manually. */ + memcpy (table + 1, orig_table, count * sizeof (asymbol *)); + table[0] = fakemain; + count++; + } + + for (i = 0, serno = 1; i < count && table[i] != NULL; i++) + { + asymbol *s = table[i]; + + /* It's not enough to consult bfd_is_local_label, since it does not + mean "local" in the sense of linkable-and-observable-after-link. + Let's just check the BSF_GLOBAL flag. + + Also, don't export symbols with characters not in the allowed set. */ + if ((s->flags & (BSF_DEBUGGING|BSF_GLOBAL)) == BSF_GLOBAL + && strspn (s->name, + valid_mmo_symbol_character_set) == strlen (s->name)) + { + struct mmo_symbol sym; + memset (&sym, 0, sizeof (sym)); + + sym.name = s->name; + sym.value = + s->value + + s->section->output_section->vma + + s->section->output_offset; + + if (bfd_is_und_section (s->section)) + sym.sym_type = mmo_undef_sym; + else if (strcmp (s->section->name, MMO_DATA_SECTION_NAME) == 0 + /* The encoding of data symbols require that the "rest" + of the value fits in 6 bytes, so the upper two bytes + must be 0x2000. All other symbols get to be the + absolute type. */ + && (sym.value >> 48) == 0x2000) + sym.sym_type = mmo_data_sym; + else if (strcmp (s->section->name, MMIX_REG_SECTION_NAME) == 0) + sym.sym_type = mmo_reg_sym; + else if (strcmp (s->section->name, + MMIX_REG_CONTENTS_SECTION_NAME) == 0) + { + sym.sym_type = mmo_reg_sym; + sym.value /= 8; + } + else + sym.sym_type = mmo_abs_sym; + + /* FIXME: We assume the order of the received symbols is an + ordered mapping of the serial numbers. This is not + necessarily true if we e.g. objcopy a mmo file to another and + there are gaps in the numbering. Not sure if this can + happen. Not sure what to do. */ + sym.serno = serno++; + + if (! mmo_internal_add_3_sym (abfd, &root, &sym)) + return FALSE; + } + } + + /* Change the root node to be a ":"-prefix. */ + root.symchar = ':'; + root.middle = root.left; + root.right = NULL; + root.left = NULL; + + /* We have to find out if we can fit the whole symbol table in the mmo + symtab. It would be bad to assume we can always fit it in 262144 + bytes. If we can't, just leave the Main symbol. */ + trie_len = (mmo_internal_3_length (abfd, &root) + 3)/4; + + if (trie_len > 0xffff) + { + /* Test this code by using a lower limit in the test above and check + that the single "Main" symbol is emitted and handled properly. + There's no specific test-case. */ + struct mmo_symbol sym; + + (*_bfd_error_handler) + (_("%s: warning: symbol table too large for mmo, larger than 65535\ + 32-bit words: %d. Only `Main' will be emitted.\n"), + bfd_get_filename (abfd), trie_len); + + memset (&sym, 0, sizeof (sym)); + sym.sym_type = mmo_abs_sym; + sym.name = MMIX_START_SYMBOL_NAME; + sym.serno = 1; + sym.value = bfd_get_start_address (abfd); + + /* Then patch up a symbol table to be just the ":Main" symbol. */ + memset (&root, 0, sizeof (root)); + root.left = root.middle; + root.symchar = 0xff; + root.middle = NULL; + root.right = NULL; + + if (! mmo_internal_add_3_sym (abfd, &root, &sym)) + return FALSE; + + root.symchar = ':'; + root.middle = root.left; + root.right = NULL; + root.left = NULL; + + trie_len = (mmo_internal_3_length (abfd, &root) + 3)/4; + } + + /* Reset the written-bytes counter. */ + abfd->tdata.mmo_data->byte_no = 0; + + /* Put out the lop_stab mark. */ + bfd_put_32 (abfd, (LOP << 24) | (LOP_STAB << 16), buf); + if (bfd_bwrite (buf, 4, abfd) != 4) + return FALSE; + + /* Dump out symbols. */ + mmo_internal_3_dump (abfd, &root); + + if (trie_len != (abfd->tdata.mmo_data->byte_no + 3)/4) + { + /* I haven't seen this trig. It seems no use claiming this case + isn't debugged and abort if we get here. Instead emit a + diagnostic and fail "normally". */ + (*_bfd_error_handler) + (_("%s: internal error, symbol table changed size from %d to %d\ + words\n"), + bfd_get_filename (abfd), trie_len, + (abfd->tdata.mmo_data->byte_no + 3)/4); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* Dump out remaining bytes in the buffer and handle I/O errors by + propagating errors. */ + if ((abfd->tdata.mmo_data->byte_no % 4) != 0 + || abfd->tdata.mmo_data->have_error) + { + memset (abfd->tdata.mmo_data->buf + (abfd->tdata.mmo_data->byte_no % 4), + 0, 4 - (abfd->tdata.mmo_data->byte_no % 4)); + + if (abfd->tdata.mmo_data->have_error + || bfd_bwrite (abfd->tdata.mmo_data->buf, 4, abfd) != 4) + return FALSE; + } + + bfd_put_32 (abfd, (LOP << 24) | (LOP_END << 16) | trie_len, buf); + return bfd_bwrite (buf, 4, abfd) == 4; +} + +/* Write section unless it is the register contents section. For that, we + instead store the section in the supplied pointer. This function is + used through bfd_map_over_sections. */ + +static void +mmo_write_section_unless_reg_contents (abfd, sec, p) + bfd *abfd; + asection *sec; + PTR p; +{ + struct mmo_write_sec_info *infop = (struct mmo_write_sec_info *) p; + + if (! infop->retval) + return; + + if (strcmp (sec->name, MMIX_REG_CONTENTS_SECTION_NAME) == 0) + { + infop->reg_section = sec; + return; + } + + /* Exclude the convenience register section. */ + if (strcmp (sec->name, MMIX_REG_SECTION_NAME) == 0) + { + if (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) + { + /* Make sure it hasn't got contents. It seems impossible to + make it carry contents, so we don't have a test-case for + this. */ + (*_bfd_error_handler) + (_("%s: internal error, internal register section %s had\ + contents\n"), + bfd_get_filename (abfd), sec->name); + bfd_set_error (bfd_error_bad_value); + infop->retval = FALSE; + return; + } + + return; + } + + infop->retval = mmo_internal_write_section (abfd, sec); +} + +/* Do the actual output of a file. Assumes mmo_set_section_contents is + already called. */ + +static bfd_boolean +mmo_write_object_contents (abfd) + bfd *abfd; +{ + struct mmo_write_sec_info wsecinfo; + + /* First, there are a few words of preamble. */ + if (! mmo_internal_write_header (abfd)) + return FALSE; + + wsecinfo.reg_section = NULL; + wsecinfo.retval = TRUE; + + bfd_map_over_sections (abfd, mmo_write_section_unless_reg_contents, + (PTR) &wsecinfo); + + if (! wsecinfo.retval) + return FALSE; + + if (wsecinfo.reg_section != NULL) + { + asection *sec = wsecinfo.reg_section; + unsigned int z = (unsigned int) (sec->vma / 8); + + /* Registers 0..31 must not be global. Do sanity check on the "vma" + of the register contents section and check that it corresponds to + the length of the section. */ + if (z < 32 || z >= 255 || (sec->vma & 7) != 0 + || sec->vma != 256 * 8 - sec->_raw_size - 8) + { + bfd_set_error (bfd_error_bad_value); + + if (sec->_raw_size == 0) + /* There must always be at least one such register. */ + (*_bfd_error_handler) + (_("%s: no initialized registers; section length 0\n"), + bfd_get_filename (abfd)); + else if (sec->vma > (256 - 32) * 8) + /* Provide better error message for the case of too many + global registers. */ + (*_bfd_error_handler) + (_("%s: too many initialized registers; section length %ld\n"), + bfd_get_filename (abfd), + (long) sec->_raw_size); + else + (*_bfd_error_handler) + (_("%s: invalid start address for initialized registers of\ + length %ld: 0x%lx%08lx\n"), + bfd_get_filename (abfd), + (long) sec->_raw_size, + (unsigned long) (sec->vma >> 32), (unsigned long) (sec->vma)); + + return FALSE; + } + + if (! mmo_internal_write_post (abfd, z, sec)) + return FALSE; + } + else + if (! mmo_internal_write_post (abfd, 255, NULL)) + return FALSE; + + return mmo_write_symbols_and_terminator (abfd); +} + +/* Return the size of a NULL pointer, so we support linking in an mmo + object. */ + +static long +mmo_get_reloc_upper_bound (abfd, sec) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; +{ + return sizeof (PTR); +} + +/* Similarly canonicalize relocs to empty, filling in the terminating NULL + pointer. */ + +long +mmo_canonicalize_reloc (abfd, section, relptr, symbols) + bfd *abfd ATTRIBUTE_UNUSED; + sec_ptr section ATTRIBUTE_UNUSED; + arelent **relptr; + asymbol **symbols ATTRIBUTE_UNUSED; +{ + *relptr = NULL; + return 0; +} + +/* If there's anything in particular in a mmo bfd that we want to free, + make this a real function. Only do this if you see major memory + thrashing; zealous free:ing will cause unwanted behavior, especially if + you "free" memory allocated with "bfd_alloc", or even "bfd_release" a + block allocated with "bfd_alloc"; they're really allocated from an + obstack, and we don't know what was allocated there since this + particular allocation. */ + +#define mmo_close_and_cleanup _bfd_generic_close_and_cleanup +#define mmo_bfd_free_cached_info _bfd_generic_bfd_free_cached_info + +/* Perhaps we need to adjust this one; mmo labels (originally) without a + leading ':' might more appropriately be called local. */ +#define mmo_bfd_is_local_label_name bfd_generic_is_local_label_name + +/* Is this one really used or defined by anyone? */ +#define mmo_get_lineno _bfd_nosymbols_get_lineno + +/* FIXME: We can do better on this one, if we have a dwarf2 .debug_line + section or if MMO line numbers are implemented. */ +#define mmo_find_nearest_line _bfd_nosymbols_find_nearest_line +#define mmo_make_empty_symbol _bfd_generic_make_empty_symbol +#define mmo_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define mmo_read_minisymbols _bfd_generic_read_minisymbols +#define mmo_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol + +#define mmo_get_section_contents_in_window \ + _bfd_generic_get_section_contents_in_window +#define mmo_bfd_get_relocated_section_contents \ + bfd_generic_get_relocated_section_contents +#define mmo_bfd_gc_sections bfd_generic_gc_sections +#define mmo_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define mmo_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define mmo_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define mmo_bfd_link_just_syms _bfd_generic_link_just_syms +#define mmo_bfd_final_link _bfd_generic_final_link +#define mmo_bfd_link_split_section _bfd_generic_link_split_section + +/* Strictly speaking, only MMIX uses this restricted format, but let's not + stop anybody from shooting themselves in the foot. */ +#define mmo_set_arch_mach bfd_default_set_arch_mach +#define mmo_bfd_relax_section bfd_generic_relax_section +#define mmo_bfd_merge_sections bfd_generic_merge_sections +#define mmo_bfd_discard_group bfd_generic_discard_group + +/* objcopy will be upset if we return -1 from bfd_get_reloc_upper_bound by + using BFD_JUMP_TABLE_RELOCS (_bfd_norelocs) rather than 0. FIXME: Most + likely a bug in the _bfd_norelocs definition. + + On the other hand, we smuggle in an mmo object (because setting up ELF + is too cumbersome) when linking (from other formats, presumably ELF) to + represent the g255 entry. We need to link that object, so need to say + it has no relocs. Upper bound for the size of the relocation table is + the size of a NULL pointer, and we support "canonicalization" for that + pointer. */ +#define mmo_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup + +/* We want to copy time of creation, otherwise we'd use + BFD_JUMP_TABLE_COPY (_bfd_generic). */ +#define mmo_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data +#define mmo_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data +#define mmo_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data +#define mmo_bfd_set_private_flags _bfd_generic_bfd_set_private_flags +#define mmo_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data + +const bfd_target bfd_mmo_vec = +{ + "mmo", /* name */ + bfd_target_mmo_flavour, + BFD_ENDIAN_BIG, /* target byte order */ + BFD_ENDIAN_BIG, /* target headers byte order */ + + /* FIXME: Might need adjustments. */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT), + + /* FIXME: Might need adjustments. */ + (SEC_CODE | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD + | SEC_READONLY | SEC_EXCLUDE | SEC_DEBUGGING | SEC_IN_MEMORY), + /* section flags */ + 0, /* leading underscore */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + + { + _bfd_dummy_target, + mmo_object_p, /* bfd_check_format */ + _bfd_dummy_target, + _bfd_dummy_target, + }, + { + bfd_false, + mmo_mkobject, + bfd_false, + bfd_false, + }, + { /* bfd_write_contents */ + bfd_false, + mmo_write_object_contents, + bfd_false, + bfd_false, + }, + + BFD_JUMP_TABLE_GENERIC (mmo), + BFD_JUMP_TABLE_COPY (mmo), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (mmo), + /* We have to provide a valid method for getting relocs, returning zero, + so we can't say BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */ + BFD_JUMP_TABLE_RELOCS (mmo), + BFD_JUMP_TABLE_WRITE (mmo), + BFD_JUMP_TABLE_LINK (mmo), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + NULL +}; diff --git a/bfd/mpw-config.in b/bfd/mpw-config.in new file mode 100644 index 0000000000000..31addeebdcfbc --- /dev/null +++ b/bfd/mpw-config.in @@ -0,0 +1,86 @@ +# Configuration fragment for BFD. + +# This is almost always correct. + +Set selarchs "&bfd_{target_cpu}_arch" +Set defvec "" +Set selvecs "" +Set havevecs "" + +If "{target_canonical}" =~ /m68k-apple-macos/ + Set BFD_BACKENDS '"{o}"coff-m68k.c.o "{o}"cofflink.c.o' + Set defvec m68kcoff_vec + Set selvecs '&m68kcoff_vec' + Set havevecs '-d HAVE_m68kcoff_vec' + +Else If "{target_canonical}" =~ /powerpc-apple-macos/ + Set BFD_BACKENDS '"{o}"coff-pmac.c.o "{o}"xcofflink.c.o' + Set defvec pmac_xcoff_vec + Set selvecs '&pmac_xcoff_vec' + Set havevecs '-d HAVE_pmac_xcoff_vec' + Set selarchs "&bfd_powerpc_arch" + +Else If "{target_canonical}" =~ /i386-\Option-x-go32/ + Set BFD_BACKENDS '"{o}"coff-i386.c.o' + Set defvec i386coff_vec + Set selvecs '&i386coff_vec' + Set havevecs '-d HAVE_i386coff_vec' + +Else If "{target_canonical}" =~ /mips-\Option-x-\Option-x/ + Set BFD_BACKENDS '"{o}"coff-mips.c.o "{o}"ecoff.c.o "{o}"ecofflink.c.o "{o}"elf32.c.o "{o}"elf32-mips.c.o "{o}"elflink.c.o' + Set defvec ecoff_big_vec + Set selvecs '&ecoff_big_vec,&ecoff_little_vec,&bfd_elf32_bigmips_vec' + Set havevecs '-d HAVE_ecoff_big_vec -d HAVE_ecoff_little_vec -d HAVE_bfd_elf32_bigmips_vec' + +Else If "{target_canonical}" =~ /sh-\Option-x-hms/ + Set BFD_BACKENDS '"{o}"coff-sh.c.o "{o}"cofflink.c.o' + Set defvec shcoff_vec + Set selvecs '&shcoff_vec,&shlcoff_vec' + Set havevecs '-d HAVE_shcoff_vec -d HAVE_shlcoff_vec' +End If + +Set ta `echo {selarchs} | sed -e 's/&bfd_/{o}cpu-/g' -e 's/_arch/.c.o/g'` + +Set tdefaults "-d DEFAULT_VECTOR={defvec} -d SELECT_VECS={selvecs} -d SELECT_ARCHITECTURES={selarchs} {havevecs}" + +Echo '# From mpw-config.in' > "{o}"mk.tmp +Echo 'WORDSIZE = 32' >> "{o}"mk.tmp +Echo 'BFD_MACHINES = ' {ta} >> "{o}"mk.tmp +Echo 'BFD_BACKENDS = ' {BFD_BACKENDS} >> "{o}"mk.tmp +Echo 'TDEFAULTS = ' {tdefaults} >> "{o}"mk.tmp +Echo 'HDEPFILES = ' >> "{o}"mk.tmp +Echo 'TDEPFILES = ' >> "{o}"mk.tmp +Echo '# End from mpw-config.in' >> "{o}"mk.tmp + +Echo '/* config.h. Generated by mpw-configure. */' > "{o}"config.new +Echo '#include "mpw.h"' >> "{o}"config.new + +MoveIfChange "{o}"config.new "{o}"config.h + +# We can only handle 32-bit targets right now. + +sed -e 's/@WORDSIZE@/32/' \Option-d + -e 's/@wordsize@/32/' \Option-d + -e "s/@VERSION@/`Catenate {srcdir}VERSION`/" \Option-d + -e 's/@BFD_HOST_64_BIT_DEFINED@/0/' \Option-d + -e 's/@BFD_HOST_64_BIT@//' \Option-d + -e 's/@BFD_HOST_U_64_BIT@//' \Option-d + -e 's/@BFD_HOST_64BIT_LONG@/0/' \Option-d + "{srcdir}"bfd-in2.h >"{o}"bfd.h-new + +MoveIfChange "{o}"bfd.h-new "{o}"bfd.h + +sed -e 's/NN/32/g' "{srcdir}"elfxx-target.h >"{o}"elf32-target.h-new +MoveIfChange "{o}"elf32-target.h-new "{o}"elf32-target.h + +# Pre-expand some macros in coffswap.h, so MPW C doesn't choke. + +sed -e 's/^ PUT_AOUTHDR_TSIZE (/ bfd_h_put_32 (/' \Option-d + -e 's/^ PUT_AOUTHDR_DSIZE (/ bfd_h_put_32 (/' \Option-d + -e 's/^ PUT_AOUTHDR_BSIZE (/ bfd_h_put_32 (/' \Option-d + -e 's/^ PUT_AOUTHDR_ENTRY (/ bfd_h_put_32 (/' \Option-d + -e 's/^ PUT_AOUTHDR_TEXT_START (/ bfd_h_put_32 (/' \Option-d + -e 's/^ PUT_AOUTHDR_DATA_START (/ bfd_h_put_32 (/' \Option-d + "{srcdir}"coffswap.h >"{o}"coffswap.h-new + +MoveIfChange "{o}"coffswap.h-new "{o}"coffswap.h diff --git a/bfd/mpw-make.sed b/bfd/mpw-make.sed new file mode 100644 index 0000000000000..b2463c72b7f54 --- /dev/null +++ b/bfd/mpw-make.sed @@ -0,0 +1,81 @@ +# Sed commands to finish translating the Unix BFD Makefile into MPW syntax. + +# Whack out unused host and target define bits. +/HDEFINES/s/@HDEFINES@// +/TDEFINES/s/@TDEFINES@// + +# Fix pathnames to include directories. +/^INCDIR = /s/^INCDIR = .*$/INCDIR = "{topsrcdir}"include/ +/^CSEARCH = /s/$/ -i "{INCDIR}":mpw: -i ::extra-include:/ + +# Comment out setting of vars, configure script will add these itself. +/^WORDSIZE =/s/^/#/ +# /^ALL_BACKENDS/s/^/#/ +/^BFD_BACKENDS/s/^/#/ +/^BFD_MACHINES/s/^/#/ +/^TDEFAULTS/s/^/#/ + +# Remove extra, useless, "all". +/^all \\Option-f _oldest/,/^$/d + +# Remove the Makefile rebuild rule. +/^Makefile /,/--recheck/d + +# Don't do any recursive subdir stuff. +/ subdir_do/s/{MAKE}/null-command/ + +/BFD_H/s/^{BFD_H}/#{BFD_H}/ + +# Add explicit srcdir paths to special files. +/config.bfd/s/ config.bfd/ "{s}"config.bfd/g +/targmatch.sed/s/ targmatch.sed/ "{s}"targmatch.sed/g + +# Point at include files that are always in the objdir. +/bfd/s/"{s}"bfd\.h/"{o}"bfd.h/g +/config/s/"{s}"config\.h/"{o}"config.h/g +/targmatch/s/"{s}"targmatch\.h/"{o}"targmatch.h/g +/targmatch/s/^targmatch\.h/"{o}"targmatch.h/ +/elf32-target/s/"{s}"elf32-target\.h/"{o}"elf32-target.h/g +/elf32-target/s/^elf32-target\.h/"{o}"elf32-target.h/ +/elf64-target/s/"{s}"elf64-target\.h/"{o}"elf64-target.h/g +/elf64-target/s/^elf64-target\.h/"{o}"elf64-target.h/ + +/"{s}"{INCDIR}/s/"{s}"{INCDIR}/"{INCDIR}"/g + +/dep/s/\.dep/__dep/g + +# Removing duplicates is cool but presently unnecessary, +# so whack this out. +/^ofiles \\Option-f/,/^$/d +/ofiles/s/{OFILES} ofiles/{OFILES}/ +/echo ofiles = /d +/cat ofiles/s/`cat ofiles`/{OFILES}/ + +# No corefile support. +/COREFILE/s/@COREFILE@// +/COREFLAG/s/@COREFLAG@// + +# No PIC foolery in this environment. +/@ALLLIBS@/s/@ALLLIBS@/{TARGETLIB}/ +/@PICLIST@/s/@PICLIST@// +/@PICFLAG@/s/@PICFLAG@// +/^{OFILES} \\Option-f stamp-picdir/,/^$/d + +# Remove the pic trickery from the default build rule. +/^\.c\.o \\Option-f /,/End If/c\ +.c.o \\Option-f .c + +# MPW Make doesn't know about $<. +/"{o}"targets.c.o \\Option-f "{s}"targets.c Makefile/,/^$/c\ +"{o}"targets.c.o \\Option-f "{s}"targets.c Makefile\ + {CC} @DASH_C_FLAG@ {ALL_CFLAGS} {TDEFAULTS} "{s}"targets.c -o "{o}"targets.c.o + +/"{o}"archures.c.o \\Option-f "{s}"archures.c Makefile/,/^$/c\ +"{o}"archures.c.o \\Option-f "{s}"archures.c Makefile\ + {CC} @DASH_C_FLAG@ {ALL_CFLAGS} {TDEFAULTS} "{s}"archures.c -o "{o}"archures.c.o + +# Remove the .h rebuilding rules, we don't currently have a doc subdir, +# or a way to build the prototype-hacking tool that's in it. +/^"{srcdir}"bfd-in2.h \\Option-f /,/^$/d +/^"{srcdir}"libbfd.h \\Option-f /,/^$/d +/^"{srcdir}"libcoff.h \\Option-f /,/^$/d diff --git a/bfd/newsos3.c b/bfd/newsos3.c new file mode 100644 index 0000000000000..d0a5c54817ed2 --- /dev/null +++ b/bfd/newsos3.c @@ -0,0 +1,44 @@ +/* BFD back-end for NewsOS3 (Sony, 68k) binaries. + Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2003 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define TARGET_PAGE_SIZE 4096 +#define SEGMENT_SIZE TARGET_PAGE_SIZE +#define TEXT_START_ADDR 0 + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (newsos3_,OP) +#define TARGETNAME "a.out-newsos3" +#define ENTRY_CAN_BE_ZERO +#define N_SHARED_LIB(x) 0 /* Avoids warning when compiled with -Wall. */ +#define DEFAULT_ARCH bfd_arch_m68k +#define TARGET_IS_BIG_ENDIAN_P +#define N_HEADER_IN_TEXT(x) 0 + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "aout/aout64.h" +#include "aout/stab_gnu.h" +#include "aout/ar.h" +#include "libaout.h" /* BFD a.out internal data structures */ + +#include "aout-target.h" diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h new file mode 100644 index 0000000000000..70ae4f4d6a770 --- /dev/null +++ b/bfd/nlm-target.h @@ -0,0 +1,252 @@ +/* Target definitions for 32/64-bit NLM (NetWare Loadable Module) + Copyright 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define nlm_core_file_p _bfd_dummy_target + +#define nlm_get_symtab_upper_bound nlmNAME(get_symtab_upper_bound) +#define nlm_canonicalize_symtab nlmNAME(canonicalize_symtab) +#define nlm_make_empty_symbol nlmNAME(make_empty_symbol) +#define nlm_print_symbol nlmNAME(print_symbol) +#define nlm_get_symbol_info nlmNAME(get_symbol_info) +#define nlm_bfd_is_local_label_name bfd_generic_is_local_label_name +#define nlm_get_lineno _bfd_nosymbols_get_lineno +#define nlm_find_nearest_line _bfd_nosymbols_find_nearest_line +#define nlm_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define nlm_read_minisymbols _bfd_generic_read_minisymbols +#define nlm_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol + +#define nlm_get_reloc_upper_bound nlmNAME(get_reloc_upper_bound) +#define nlm_canonicalize_reloc nlmNAME(canonicalize_reloc) +#define nlm_bfd_reloc_type_lookup bfd_default_reloc_type_lookup + +#define nlm_set_section_contents nlmNAME(set_section_contents) + +#define nlm_sizeof_headers _bfd_nolink_sizeof_headers +#define nlm_bfd_get_relocated_section_contents \ + bfd_generic_get_relocated_section_contents +#define nlm_bfd_relax_section bfd_generic_relax_section +#define nlm_bfd_gc_sections bfd_generic_gc_sections +#define nlm_bfd_merge_sections bfd_generic_merge_sections +#define nlm_bfd_discard_group bfd_generic_discard_group +#define nlm_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define nlm_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define nlm_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define nlm_bfd_link_just_syms _bfd_generic_link_just_syms +#define nlm_bfd_final_link _bfd_generic_final_link +#define nlm_bfd_link_split_section _bfd_generic_link_split_section + +/* This structure contains everything that BFD knows about a target. + It includes things like its byte order, name, what routines to call + to do various operations, etc. Every BFD points to a target structure + with its "xvec" member. + + There are two such structures here: one for big-endian machines and + one for little-endian machines. */ + +/* Forward declaration for use when initialising alternative_target field. */ +#ifdef TARGET_LITTLE_SYM +extern const bfd_target TARGET_LITTLE_SYM; +#endif + +#ifdef TARGET_BIG_SYM +const bfd_target TARGET_BIG_SYM = +{ + /* name: identify kind of target */ + TARGET_BIG_NAME, + + /* flavour: general indication about file */ + bfd_target_nlm_flavour, + + /* byteorder: data is big endian */ + BFD_ENDIAN_BIG, + + /* header_byteorder: header is also big endian */ + BFD_ENDIAN_BIG, + + /* object_flags: mask of all file flags */ + (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS + | WP_TEXT), + + /* section_flags: mask of all section flags */ + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | + SEC_CODE | SEC_DATA), + + /* leading_symbol_char: is the first char of a user symbol + predictable, and if so what is it */ + 0, + + /* ar_pad_char: pad character for filenames within an archive header + FIXME: this really has nothing to do with NLM, this is a characteristic + of the archiver and/or os and should be independently tunable */ + '/', + + /* ar_max_namelen: maximum number of characters in an archive header + FIXME: this really has nothing to do with NLM, this is a characteristic + of the archiver and should be independently tunable. This value is + a WAG (wild a** guess) */ + 15, + + /* Routines to byte-swap various sized integers from the data sections */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, + + /* Routines to byte-swap various sized integers from the file headers */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, + + /* bfd_check_format: check the format of a file being read */ + { _bfd_dummy_target, /* unknown format */ + nlmNAME(object_p), /* assembler/linker output (object file) */ + bfd_generic_archive_p, /* an archive */ + nlm_core_file_p /* a core file */ + }, + + /* bfd_set_format: set the format of a file being written */ + { bfd_false, + nlm_mkobject, + _bfd_generic_mkarchive, + bfd_false + }, + + /* bfd_write_contents: write cached information into a file being written */ + { bfd_false, + nlmNAME(write_object_contents), + _bfd_write_archive_contents, + bfd_false + }, + + /* Initialize a jump table with the standard macro. All names start with + "nlm" */ + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (nlm), + BFD_JUMP_TABLE_RELOCS (nlm), + BFD_JUMP_TABLE_WRITE (nlm), + BFD_JUMP_TABLE_LINK (nlm), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + /* Alternative endian target. */ +#ifdef TARGET_LITTLE_SYM + & TARGET_LITTLE_SYM, +#else + NULL, +#endif + + /* backend_data: */ + (PTR) TARGET_BACKEND_DATA +}; +#endif + +#ifdef TARGET_LITTLE_SYM +const bfd_target TARGET_LITTLE_SYM = +{ + /* name: identify kind of target */ + TARGET_LITTLE_NAME, + + /* flavour: general indication about file */ + bfd_target_nlm_flavour, + + /* byteorder: data is little endian */ + BFD_ENDIAN_LITTLE, + + /* header_byteorder: header is also little endian */ + BFD_ENDIAN_LITTLE, + + /* object_flags: mask of all file flags */ + (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS + | WP_TEXT), + + /* section_flags: mask of all section flags */ + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | + SEC_DATA), + + /* leading_symbol_char: is the first char of a user symbol + predictable, and if so what is it */ + 0, + + /* ar_pad_char: pad character for filenames within an archive header + FIXME: this really has nothing to do with NLM, this is a characteristic + of the archiver and/or os and should be independently tunable */ + '/', + + /* ar_max_namelen: maximum number of characters in an archive header + FIXME: this really has nothing to do with NLM, this is a characteristic + of the archiver and should be independently tunable. This value is + a WAG (wild a** guess) */ + 15, + + /* Routines to byte-swap various sized integers from the data sections */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, + + /* Routines to byte-swap various sized integers from the file headers */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, + + /* bfd_check_format: check the format of a file being read */ + { _bfd_dummy_target, /* unknown format */ + nlmNAME(object_p), /* assembler/linker output (object file) */ + bfd_generic_archive_p, /* an archive */ + nlm_core_file_p /* a core file */ + }, + + /* bfd_set_format: set the format of a file being written */ + { bfd_false, + nlm_mkobject, + _bfd_generic_mkarchive, + bfd_false + }, + + /* bfd_write_contents: write cached information into a file being written */ + { bfd_false, + nlmNAME(write_object_contents), + _bfd_write_archive_contents, + bfd_false + }, + + /* Initialize a jump table with the standard macro. All names start with + "nlm" */ + BFD_JUMP_TABLE_GENERIC (_bfd_generic), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (nlm), + BFD_JUMP_TABLE_RELOCS (nlm), + BFD_JUMP_TABLE_WRITE (nlm), + BFD_JUMP_TABLE_LINK (nlm), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + /* Alternative endian target. */ +#ifdef TARGET_BIG_SYM + & TARGET_BIG_SYM, +#else + NULL, +#endif + + /* backend_data: */ + (PTR) TARGET_BACKEND_DATA +}; +#endif diff --git a/bfd/nlm.c b/bfd/nlm.c new file mode 100644 index 0000000000000..7a0a35ee1548b --- /dev/null +++ b/bfd/nlm.c @@ -0,0 +1,55 @@ +/* NLM (NetWare Loadable Module) executable support for BFD. + Copyright 1993, 1994, 2001, 2002, 2003 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "libnlm.h" + +/* Make an NLM object. We just need to allocate the backend + information. */ + +bfd_boolean +nlm_mkobject (abfd) + bfd * abfd; +{ + bfd_size_type amt = sizeof (struct nlm_obj_tdata); + nlm_tdata (abfd) = (struct nlm_obj_tdata *) bfd_zalloc (abfd, amt); + if (nlm_tdata (abfd) == NULL) + return FALSE; + + if (nlm_architecture (abfd) != bfd_arch_unknown) + bfd_default_set_arch_mach (abfd, nlm_architecture (abfd), + nlm_machine (abfd)); + + /* since everything is done at close time, do we need any initialization? */ + return TRUE; +} + +/* Set the architecture and machine for an NLM object. */ + +bfd_boolean +nlm_set_arch_mach (abfd, arch, machine) + bfd * abfd; + enum bfd_architecture arch; + unsigned long machine; +{ + bfd_default_set_arch_mach (abfd, arch, machine); + return arch == nlm_architecture (abfd); +} diff --git a/bfd/nlm32-alpha.c b/bfd/nlm32-alpha.c new file mode 100644 index 0000000000000..990ce8d5a7aa4 --- /dev/null +++ b/bfd/nlm32-alpha.c @@ -0,0 +1,895 @@ +/* Support for 32-bit Alpha NLM (NetWare Loadable Module) + Copyright 1993, 1994, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* This file describes the 32 bit Alpha NLM format. You might think + that an Alpha chip would use a 64 bit format, but, for some reason, + it doesn't. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#define ARCH_SIZE 32 + +#include "nlm/alpha-ext.h" +#define Nlm_External_Fixed_Header Nlm32_alpha_External_Fixed_Header + +#include "libnlm.h" + +static bfd_boolean nlm_alpha_backend_object_p + PARAMS ((bfd *)); +static bfd_boolean nlm_alpha_write_prefix + PARAMS ((bfd *)); +static bfd_boolean nlm_alpha_read_reloc + PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *)); +static bfd_boolean nlm_alpha_mangle_relocs + PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type)); +static bfd_boolean nlm_alpha_read_import + PARAMS ((bfd *, nlmNAME(symbol_type) *)); +static bfd_boolean nlm_alpha_write_import + PARAMS ((bfd *, asection *, arelent *)); +static bfd_boolean nlm_alpha_set_public_section + PARAMS ((bfd *, nlmNAME(symbol_type) *)); +static bfd_vma nlm_alpha_get_public_offset + PARAMS ((bfd *, asymbol *)); +static bfd_boolean nlm_alpha_write_external + PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *)); + +/* Alpha NLM's have a prefix header before the standard NLM. This + function reads it in, verifies the version, and seeks the bfd to + the location before the regular NLM header. */ + +static bfd_boolean +nlm_alpha_backend_object_p (abfd) + bfd *abfd; +{ + struct nlm32_alpha_external_prefix_header s; + file_ptr size; + + if (bfd_bread ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s) + return FALSE; + + if (H_GET_32 (abfd, s.magic) != NLM32_ALPHA_MAGIC) + return FALSE; + + /* FIXME: Should we check the format number? */ + + /* Skip to the end of the header. */ + size = H_GET_32 (abfd, s.size); + if (bfd_seek (abfd, size, SEEK_SET) != 0) + return FALSE; + + return TRUE; +} + +/* Write out the prefix. */ + +static bfd_boolean +nlm_alpha_write_prefix (abfd) + bfd *abfd; +{ + struct nlm32_alpha_external_prefix_header s; + + memset (&s, 0, sizeof s); + H_PUT_32 (abfd, NLM32_ALPHA_MAGIC, s.magic); + H_PUT_32 (abfd, 2, s.format); + H_PUT_32 (abfd, sizeof s, s.size); + if (bfd_bwrite ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s) + return FALSE; + return TRUE; +} + +#define ONES(n) (((bfd_vma) 1 << ((n) - 1) << 1) - 1) + +/* How to process the various reloc types. */ + +static reloc_howto_type nlm32_alpha_howto_table[] = +{ + /* Reloc type 0 is ignored by itself. However, it appears after a + GPDISP reloc to identify the location where the low order 16 bits + of the gp register are loaded. */ + HOWTO (ALPHA_R_IGNORE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + 0, /* special_function */ + "IGNORE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit reference to a symbol. */ + HOWTO (ALPHA_R_REFLONG, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "REFLONG", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 64 bit reference to a symbol. */ + HOWTO (ALPHA_R_REFQUAD, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "REFQUAD", /* name */ + TRUE, /* partial_inplace */ + ONES (64), /* src_mask */ + ONES (64), /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit GP relative offset. This is just like REFLONG except + that when the value is used the value of the gp register will be + added in. */ + HOWTO (ALPHA_R_GPREL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "GPREL32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Used for an instruction that refers to memory off the GP + register. The offset is 16 bits of the 32 bit instruction. This + reloc always seems to be against the .lita section. */ + HOWTO (ALPHA_R_LITERAL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "LITERAL", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* This reloc only appears immediately following a LITERAL reloc. + It identifies a use of the literal. It seems that the linker can + use this to eliminate a portion of the .lita section. The symbol + index is special: 1 means the literal address is in the base + register of a memory format instruction; 2 means the literal + address is in the byte offset register of a byte-manipulation + instruction; 3 means the literal address is in the target + register of a jsr instruction. This does not actually do any + relocation. */ + HOWTO (ALPHA_R_LITUSE, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + 0, /* special_function */ + "LITUSE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Load the gp register. This is always used for a ldah instruction + which loads the upper 16 bits of the gp register. The next reloc + will be an IGNORE reloc which identifies the location of the lda + instruction which loads the lower 16 bits. The symbol index of + the GPDISP instruction appears to actually be the number of bytes + between the ldah and lda instructions. This gives two different + ways to determine where the lda instruction is; I don't know why + both are used. The value to use for the relocation is the + difference between the GP value and the current location; the + load will always be done against a register holding the current + address. */ + HOWTO (ALPHA_R_GPDISP, /* type */ + 16, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + 0, /* special_function */ + "GPDISP", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 21 bit branch. The native assembler generates these for + branches within the text segment, and also fills in the PC + relative offset in the instruction. It seems to me that this + reloc, unlike the others, is not partial_inplace. */ + HOWTO (ALPHA_R_BRADDR, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 21, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "BRADDR", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0x1fffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A hint for a jump to a register. */ + HOWTO (ALPHA_R_HINT, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 14, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + 0, /* special_function */ + "HINT", /* name */ + TRUE, /* partial_inplace */ + 0x3fff, /* src_mask */ + 0x3fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16 bit PC relative offset. */ + HOWTO (ALPHA_R_SREL16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "SREL16", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit PC relative offset. */ + HOWTO (ALPHA_R_SREL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "SREL32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 64 bit PC relative offset. */ + HOWTO (ALPHA_R_SREL64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "SREL64", /* name */ + TRUE, /* partial_inplace */ + ONES (64), /* src_mask */ + ONES (64), /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Push a value on the reloc evaluation stack. */ + HOWTO (ALPHA_R_OP_PUSH, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + 0, /* special_function */ + "OP_PUSH", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Store the value from the stack at the given address. Store it in + a bitfield of size r_size starting at bit position r_offset. */ + HOWTO (ALPHA_R_OP_STORE, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + 0, /* special_function */ + "OP_STORE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + ONES (64), /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Subtract the reloc address from the value on the top of the + relocation stack. */ + HOWTO (ALPHA_R_OP_PSUB, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + 0, /* special_function */ + "OP_PSUB", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Shift the value on the top of the relocation stack right by the + given value. */ + HOWTO (ALPHA_R_OP_PRSHIFT, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + 0, /* special_function */ + "OP_PRSHIFT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Adjust the GP value for a new range in the object file. */ + HOWTO (ALPHA_R_GPVALUE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + 0, /* special_function */ + "GPVALUE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE) /* pcrel_offset */ +}; + +static reloc_howto_type nlm32_alpha_nw_howto = + HOWTO (ALPHA_R_NW_RELOC, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + 0, /* special_function */ + "NW_RELOC", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE); /* pcrel_offset */ + +/* Read an Alpha NLM reloc. This routine keeps some static data which + it uses when handling local relocs. This only works correctly + because all the local relocs are read at once. */ + +static bfd_boolean +nlm_alpha_read_reloc (abfd, sym, secp, rel) + bfd *abfd; + nlmNAME(symbol_type) *sym; + asection **secp; + arelent *rel; +{ + static bfd_vma gp_value; + static bfd_vma lita_address; + struct nlm32_alpha_external_reloc ext; + bfd_vma r_vaddr; + long r_symndx; + int r_type, r_extern, r_offset, r_size; + asection *code_sec, *data_sec; + + /* Read the reloc from the file. */ + if (bfd_bread (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext) + return FALSE; + + /* Swap in the reloc information. */ + r_vaddr = H_GET_64 (abfd, ext.r_vaddr); + r_symndx = H_GET_32 (abfd, ext.r_symndx); + + BFD_ASSERT (bfd_little_endian (abfd)); + + r_type = ((ext.r_bits[0] & RELOC_BITS0_TYPE_LITTLE) + >> RELOC_BITS0_TYPE_SH_LITTLE); + r_extern = (ext.r_bits[1] & RELOC_BITS1_EXTERN_LITTLE) != 0; + r_offset = ((ext.r_bits[1] & RELOC_BITS1_OFFSET_LITTLE) + >> RELOC_BITS1_OFFSET_SH_LITTLE); + /* Ignore the reserved bits. */ + r_size = ((ext.r_bits[3] & RELOC_BITS3_SIZE_LITTLE) + >> RELOC_BITS3_SIZE_SH_LITTLE); + + /* Fill in the BFD arelent structure. */ + code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME); + data_sec = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME); + if (r_extern) + { + /* External relocations are only used for imports. */ + BFD_ASSERT (sym != NULL); + /* We don't need to set sym_ptr_ptr for this case. It is set in + nlm_canonicalize_reloc. */ + rel->sym_ptr_ptr = NULL; + rel->addend = 0; + } + else + { + /* Internal relocations are only used for local relocation + fixups. If they are not NW_RELOC or GPDISP or IGNORE, they + must be against .text or .data. */ + BFD_ASSERT (r_type == ALPHA_R_NW_RELOC || sym == NULL); + if (r_type == ALPHA_R_NW_RELOC + || r_type == ALPHA_R_GPDISP + || r_type == ALPHA_R_IGNORE) + { + rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + rel->addend = 0; + } + else if (r_symndx == ALPHA_RELOC_SECTION_TEXT) + { + rel->sym_ptr_ptr = code_sec->symbol_ptr_ptr; + BFD_ASSERT (bfd_get_section_vma (abfd, code_sec) == 0); + rel->addend = 0; + } + else if (r_symndx == ALPHA_RELOC_SECTION_DATA) + { + rel->sym_ptr_ptr = data_sec->symbol_ptr_ptr; + rel->addend = - bfd_get_section_vma (abfd, data_sec); + } + else + { + BFD_ASSERT (0); + rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + rel->addend = 0; + } + } + + /* We use the address to determine whether the reloc is in the .text + or .data section. R_NW_RELOC relocs don't really have a section, + so we put them in .text. */ + if (r_type == ALPHA_R_NW_RELOC + || r_vaddr < bfd_section_size (abfd, code_sec)) + { + *secp = code_sec; + rel->address = r_vaddr; + } + else + { + *secp = data_sec; + rel->address = r_vaddr - bfd_section_size (abfd, code_sec); + } + + /* We must adjust the addend based on the type. */ + BFD_ASSERT ((r_type >= 0 && r_type <= ALPHA_R_GPVALUE) + || r_type == ALPHA_R_NW_RELOC); + + switch (r_type) + { + case ALPHA_R_BRADDR: + case ALPHA_R_SREL16: + case ALPHA_R_SREL32: + case ALPHA_R_SREL64: + /* The PC relative relocs do not seem to use the section VMA as + a negative addend. */ + rel->addend = 0; + break; + + case ALPHA_R_GPREL32: + /* Copy the gp value for this object file into the addend, to + ensure that we are not confused by the linker. */ + if (! r_extern) + rel->addend += gp_value; + break; + + case ALPHA_R_LITERAL: + BFD_ASSERT (! r_extern); + rel->addend += lita_address; + break; + + case ALPHA_R_LITUSE: + case ALPHA_R_GPDISP: + /* The LITUSE and GPDISP relocs do not use a symbol, or an + addend, but they do use a special code. Put this code in the + addend field. */ + rel->addend = r_symndx; + rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + break; + + case ALPHA_R_OP_STORE: + /* The STORE reloc needs the size and offset fields. We store + them in the addend. */ + BFD_ASSERT (r_offset < 256 && r_size < 256); + rel->addend = (r_offset << 8) + r_size; + break; + + case ALPHA_R_OP_PUSH: + case ALPHA_R_OP_PSUB: + case ALPHA_R_OP_PRSHIFT: + /* The PUSH, PSUB and PRSHIFT relocs do not actually use an + address. I believe that the address supplied is really an + addend. */ + rel->addend = r_vaddr; + break; + + case ALPHA_R_GPVALUE: + /* Record the new gp value. */ + gp_value += r_symndx; + rel->addend = gp_value; + break; + + case ALPHA_R_IGNORE: + /* If the type is ALPHA_R_IGNORE, make sure this is a reference + to the absolute section so that the reloc is ignored. For + some reason the address of this reloc type is not adjusted by + the section vma. We record the gp value for this object file + here, for convenience when doing the GPDISP relocation. */ + rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + rel->address = r_vaddr; + rel->addend = gp_value; + break; + + case ALPHA_R_NW_RELOC: + /* If this is SETGP, we set the addend to 0. Otherwise we set + the addend to the size of the .lita section (this is + r_symndx) plus 1. We have already set the address of the + reloc to r_vaddr. */ + if (r_size == ALPHA_R_NW_RELOC_SETGP) + { + gp_value = r_vaddr; + rel->addend = 0; + } + else if (r_size == ALPHA_R_NW_RELOC_LITA) + { + lita_address = r_vaddr; + rel->addend = r_symndx + 1; + } + else + BFD_ASSERT (0); + rel->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + break; + + default: + break; + } + + if (r_type == ALPHA_R_NW_RELOC) + rel->howto = &nlm32_alpha_nw_howto; + else + rel->howto = &nlm32_alpha_howto_table[r_type]; + + return TRUE; +} + +/* Mangle Alpha NLM relocs for output. */ + +static bfd_boolean +nlm_alpha_mangle_relocs (abfd, sec, data, offset, count) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const PTR data ATTRIBUTE_UNUSED; + bfd_vma offset ATTRIBUTE_UNUSED; + bfd_size_type count ATTRIBUTE_UNUSED; +{ + return TRUE; +} + +/* Read an ALPHA NLM import record */ + +static bfd_boolean +nlm_alpha_read_import (abfd, sym) + bfd *abfd; + nlmNAME(symbol_type) *sym; +{ + struct nlm_relent *nlm_relocs; /* relocation records for symbol */ + bfd_size_type rcount; /* number of relocs */ + bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* temporary 32-bit value */ + unsigned char symlength; /* length of symbol name */ + char *name; + bfd_size_type amt; + + if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd) + != sizeof (symlength)) + return FALSE; + sym -> symbol.the_bfd = abfd; + name = bfd_alloc (abfd, (bfd_size_type) symlength + 1); + if (name == NULL) + return FALSE; + if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength) + return FALSE; + name[symlength] = '\0'; + sym -> symbol.name = name; + sym -> symbol.flags = 0; + sym -> symbol.value = 0; + sym -> symbol.section = bfd_und_section_ptr; + if (bfd_bread ((PTR) temp, (bfd_size_type) sizeof (temp), abfd) + != sizeof (temp)) + return FALSE; + rcount = H_GET_32 (abfd, temp); + amt = rcount * sizeof (struct nlm_relent); + nlm_relocs = (struct nlm_relent *) bfd_alloc (abfd, amt); + if (!nlm_relocs) + return FALSE; + sym -> relocs = nlm_relocs; + sym -> rcnt = 0; + while (sym -> rcnt < rcount) + { + asection *section; + + if (! nlm_alpha_read_reloc (abfd, sym, §ion, &nlm_relocs -> reloc)) + return FALSE; + nlm_relocs -> section = section; + nlm_relocs++; + sym -> rcnt++; + } + + return TRUE; +} + +/* Write an Alpha NLM reloc. */ + +static bfd_boolean +nlm_alpha_write_import (abfd, sec, rel) + bfd *abfd; + asection *sec; + arelent *rel; +{ + asymbol *sym; + bfd_vma r_vaddr; + long r_symndx; + int r_type, r_extern, r_offset, r_size; + struct nlm32_alpha_external_reloc ext; + + sym = *rel->sym_ptr_ptr; + + /* Get values for the relocation fields. */ + r_type = rel->howto->type; + if (r_type != ALPHA_R_NW_RELOC) + { + r_vaddr = bfd_get_section_vma (abfd, sec) + rel->address; + if ((sec->flags & SEC_CODE) == 0) + r_vaddr += bfd_section_size (abfd, + bfd_get_section_by_name (abfd, + NLM_CODE_NAME)); + if (bfd_is_und_section (bfd_get_section (sym))) + { + r_extern = 1; + r_symndx = 0; + } + else + { + r_extern = 0; + if (bfd_get_section_flags (abfd, bfd_get_section (sym)) & SEC_CODE) + r_symndx = ALPHA_RELOC_SECTION_TEXT; + else + r_symndx = ALPHA_RELOC_SECTION_DATA; + } + r_offset = 0; + r_size = 0; + + switch (r_type) + { + case ALPHA_R_LITUSE: + case ALPHA_R_GPDISP: + r_symndx = rel->addend; + break; + + case ALPHA_R_OP_STORE: + r_size = rel->addend & 0xff; + r_offset = (rel->addend >> 8) & 0xff; + break; + + case ALPHA_R_OP_PUSH: + case ALPHA_R_OP_PSUB: + case ALPHA_R_OP_PRSHIFT: + r_vaddr = rel->addend; + break; + + case ALPHA_R_IGNORE: + r_vaddr = rel->address; + break; + + default: + break; + } + } + else + { + /* r_type == ALPHA_R_NW_RELOC */ + r_vaddr = rel->address; + if (rel->addend == 0) + { + r_symndx = 0; + r_size = ALPHA_R_NW_RELOC_SETGP; + } + else + { + r_symndx = rel->addend - 1; + r_size = ALPHA_R_NW_RELOC_LITA; + } + r_extern = 0; + r_offset = 0; + } + + /* Swap out the relocation fields. */ + H_PUT_64 (abfd, r_vaddr, ext.r_vaddr); + H_PUT_32 (abfd, r_symndx, ext.r_symndx); + + BFD_ASSERT (bfd_little_endian (abfd)); + + ext.r_bits[0] = ((r_type << RELOC_BITS0_TYPE_SH_LITTLE) + & RELOC_BITS0_TYPE_LITTLE); + ext.r_bits[1] = ((r_extern ? RELOC_BITS1_EXTERN_LITTLE : 0) + | ((r_offset << RELOC_BITS1_OFFSET_SH_LITTLE) + & RELOC_BITS1_OFFSET_LITTLE)); + ext.r_bits[2] = 0; + ext.r_bits[3] = ((r_size << RELOC_BITS3_SIZE_SH_LITTLE) + & RELOC_BITS3_SIZE_LITTLE); + + /* Write out the relocation. */ + if (bfd_bwrite (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext) + return FALSE; + + return TRUE; +} + +/* Alpha NetWare does not use the high bit to determine whether a + public symbol is in the code segment or the data segment. Instead, + it just uses the address. The set_public_section and + get_public_offset routines override the default code which uses the + high bit. */ + +/* Set the section for a public symbol. */ + +static bfd_boolean +nlm_alpha_set_public_section (abfd, sym) + bfd *abfd; + nlmNAME(symbol_type) *sym; +{ + asection *code_sec, *data_sec; + + code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME); + data_sec = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME); + if (sym->symbol.value < bfd_section_size (abfd, code_sec)) + { + sym->symbol.section = code_sec; + sym->symbol.flags |= BSF_FUNCTION; + } + else + { + sym->symbol.section = data_sec; + sym->symbol.value -= bfd_section_size (abfd, code_sec); + /* The data segment had better be aligned. */ + BFD_ASSERT ((bfd_section_size (abfd, code_sec) & 0xf) == 0); + } + return TRUE; +} + +/* Get the offset to write out for a public symbol. */ + +static bfd_vma +nlm_alpha_get_public_offset (abfd, sym) + bfd *abfd ATTRIBUTE_UNUSED; + asymbol *sym; +{ + return bfd_asymbol_value (sym); +} + +/* Write an Alpha NLM external symbol. */ + +static bfd_boolean +nlm_alpha_write_external (abfd, count, sym, relocs) + bfd *abfd; + bfd_size_type count; + asymbol *sym; + struct reloc_and_sec *relocs; +{ + bfd_size_type i; + bfd_byte len; + unsigned char temp[NLM_TARGET_LONG_SIZE]; + arelent r; + + len = strlen (sym->name); + if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) + != sizeof (bfd_byte)) + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) + return FALSE; + + bfd_put_32 (abfd, count + 2, temp); + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) + return FALSE; + + /* The first two relocs for each external symbol are the .lita + address and the GP value. */ + r.sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + r.howto = &nlm32_alpha_nw_howto; + + r.address = nlm_alpha_backend_data (abfd)->lita_address; + r.addend = nlm_alpha_backend_data (abfd)->lita_size + 1; + if (! nlm_alpha_write_import (abfd, (asection *) NULL, &r)) + return FALSE; + + r.address = nlm_alpha_backend_data (abfd)->gp; + r.addend = 0; + if (! nlm_alpha_write_import (abfd, (asection *) NULL, &r)) + return FALSE; + + for (i = 0; i < count; i++) + { + if (! nlm_alpha_write_import (abfd, relocs[i].sec, relocs[i].rel)) + return FALSE; + } + + return TRUE; +} + +#include "nlmswap.h" + +static const struct nlm_backend_data nlm32_alpha_backend = +{ + "NetWare Alpha Module \032", + sizeof (Nlm32_alpha_External_Fixed_Header), + sizeof (struct nlm32_alpha_external_prefix_header), + bfd_arch_alpha, + 0, + TRUE, /* no uninitialized data permitted by Alpha NetWare. */ + nlm_alpha_backend_object_p, + nlm_alpha_write_prefix, + nlm_alpha_read_reloc, + nlm_alpha_mangle_relocs, + nlm_alpha_read_import, + nlm_alpha_write_import, + nlm_alpha_set_public_section, + nlm_alpha_get_public_offset, + nlm_swap_fixed_header_in, + nlm_swap_fixed_header_out, + nlm_alpha_write_external, + 0, /* write_export */ +}; + +#define TARGET_LITTLE_NAME "nlm32-alpha" +#define TARGET_LITTLE_SYM nlmNAME(alpha_vec) +#define TARGET_BACKEND_DATA &nlm32_alpha_backend + +#include "nlm-target.h" diff --git a/bfd/nlm32-i386.c b/bfd/nlm32-i386.c new file mode 100644 index 0000000000000..d084d18dc7c3b --- /dev/null +++ b/bfd/nlm32-i386.c @@ -0,0 +1,451 @@ +/* Support for 32-bit i386 NLM (NetWare Loadable Module) + Copyright 1993, 1994, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#define ARCH_SIZE 32 + +#include "nlm/i386-ext.h" +#define Nlm_External_Fixed_Header Nlm32_i386_External_Fixed_Header + +#include "libnlm.h" + +static bfd_boolean nlm_i386_read_reloc + PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *)); +static bfd_boolean nlm_i386_write_import + PARAMS ((bfd *, asection *, arelent *)); +static bfd_boolean nlm_i386_mangle_relocs + PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type)); +static bfd_boolean nlm_i386_read_import + PARAMS ((bfd *, nlmNAME(symbol_type) *)); +static bfd_boolean nlm_i386_write_external + PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *)); + +/* Adjust the reloc location by an absolute value. */ + +static reloc_howto_type nlm_i386_abs_howto = + HOWTO (0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE); /* pcrel_offset */ + +/* Adjust the reloc location by a PC relative displacement. */ + +static reloc_howto_type nlm_i386_pcrel_howto = + HOWTO (1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "DISP32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE); /* pcrel_offset */ + +/* Read a NetWare i386 reloc. */ + +static bfd_boolean +nlm_i386_read_reloc (abfd, sym, secp, rel) + bfd *abfd; + nlmNAME(symbol_type) *sym; + asection **secp; + arelent *rel; +{ + bfd_byte temp[4]; + bfd_vma val; + const char *name; + + if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) + return FALSE; + + val = bfd_get_32 (abfd, temp); + + /* The value is an offset into either the code or data segment. + This is the location which needs to be adjusted. + + If this is a relocation fixup rather than an imported symbol (the + sym argument is NULL) then the high bit is 0 if the location + needs to be adjusted by the address of the data segment, or 1 if + the location needs to be adjusted by the address of the code + segment. If this is an imported symbol, then the high bit is 0 + if the location is 0 if the location should be adjusted by the + offset to the symbol, or 1 if the location should adjusted by the + absolute value of the symbol. + + The second most significant bit is 0 if the value is an offset + into the data segment, or 1 if the value is an offset into the + code segment. + + All this translates fairly easily into a BFD reloc. */ + + if (sym == NULL) + { + if ((val & NLM_HIBIT) == 0) + name = NLM_INITIALIZED_DATA_NAME; + else + { + name = NLM_CODE_NAME; + val &=~ NLM_HIBIT; + } + rel->sym_ptr_ptr = bfd_get_section_by_name (abfd, name)->symbol_ptr_ptr; + rel->howto = &nlm_i386_abs_howto; + } + else + { + /* In this case we do not need to set the sym_ptr_ptr field. */ + rel->sym_ptr_ptr = NULL; + if ((val & NLM_HIBIT) == 0) + rel->howto = &nlm_i386_pcrel_howto; + else + { + rel->howto = &nlm_i386_abs_howto; + val &=~ NLM_HIBIT; + } + } + + if ((val & (NLM_HIBIT >> 1)) == 0) + *secp = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME); + else + { + *secp = bfd_get_section_by_name (abfd, NLM_CODE_NAME); + val &=~ (NLM_HIBIT >> 1); + } + + rel->address = val; + rel->addend = 0; + + return TRUE; +} + +/* Write a NetWare i386 reloc. */ + +static bfd_boolean +nlm_i386_write_import (abfd, sec, rel) + bfd *abfd; + asection *sec; + arelent *rel; +{ + asymbol *sym; + bfd_vma val; + bfd_byte temp[4]; + + /* NetWare only supports two kinds of relocs. We should check + special_function here, as well, but at the moment coff-i386 + relocs uses a special_function which does not affect what we do + here. */ + if (rel->addend != 0 + || rel->howto == NULL + || rel->howto->rightshift != 0 + || rel->howto->size != 2 + || rel->howto->bitsize != 32 + || rel->howto->bitpos != 0 + || rel->howto->src_mask != 0xffffffff + || rel->howto->dst_mask != 0xffffffff) + { + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } + + sym = *rel->sym_ptr_ptr; + + /* The value we write out is the offset into the appropriate + segment. This offset is the section vma, adjusted by the vma of + the lowest section in that segment, plus the address of the + relocation. */ + val = bfd_get_section_vma (abfd, sec) + rel->address; + + /* The second most significant bit is 0 if the value is an offset + into the data segment, or 1 if the value is an offset into the + code segment. */ + if (bfd_get_section_flags (abfd, sec) & SEC_CODE) + { + val -= nlm_get_text_low (abfd); + val |= NLM_HIBIT >> 1; + } + else + val -= nlm_get_data_low (abfd); + + if (! bfd_is_und_section (bfd_get_section (sym))) + { + /* NetWare only supports absolute internal relocs. */ + if (rel->howto->pc_relative) + { + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } + + /* The high bit is 1 if the reloc is against the code section, 0 + if against the data section. */ + if (bfd_get_section_flags (abfd, bfd_get_section (sym)) & SEC_CODE) + val |= NLM_HIBIT; + } + else + { + /* The high bit is 1 if this is an absolute reloc, 0 if it is PC + relative. */ + if (! rel->howto->pc_relative) + val |= NLM_HIBIT; + else + { + /* PC relative relocs on NetWare must be pcrel_offset. */ + if (! rel->howto->pcrel_offset) + { + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } + } + } + + bfd_put_32 (abfd, val, temp); + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) + return FALSE; + + return TRUE; +} + +/* I want to be able to use objcopy to turn an i386 a.out or COFF file + into a NetWare i386 module. That means that the relocs from the + source file have to be mapped into relocs that apply to the target + file. This function is called by nlm_set_section_contents to give + it a chance to rework the relocs. + + This is actually a fairly general concept. However, this is not a + general implementation. */ + +static bfd_boolean +nlm_i386_mangle_relocs (abfd, sec, data, offset, count) + bfd *abfd; + asection *sec; + const PTR data; + bfd_vma offset; + bfd_size_type count; +{ + arelent **rel_ptr_ptr, **rel_end; + + rel_ptr_ptr = sec->orelocation; + rel_end = rel_ptr_ptr + sec->reloc_count; + for (; rel_ptr_ptr < rel_end; rel_ptr_ptr++) + { + arelent *rel; + asymbol *sym; + bfd_vma addend; + + rel = *rel_ptr_ptr; + sym = *rel->sym_ptr_ptr; + + /* Note that no serious harm will ensue if we fail to change a + reloc. We will wind up failing in nlm_i386_write_import. */ + + /* Make sure this reloc is within the data we have. We only 4 + byte relocs here, so we insist on having 4 bytes. */ + if (rel->address < offset + || rel->address + 4 > offset + count) + continue; + + /* NetWare doesn't support reloc addends, so we get rid of them + here by simply adding them into the object data. We handle + the symbol value, if any, the same way. */ + addend = rel->addend + sym->value; + + /* The value of a symbol is the offset into the section. If the + symbol is in the .bss segment, we need to include the size of + the data segment in the offset as well. Fortunately, we know + that at this point the size of the data section is in the NLM + header. */ + if (((bfd_get_section_flags (abfd, bfd_get_section (sym)) + & SEC_LOAD) == 0) + && ((bfd_get_section_flags (abfd, bfd_get_section (sym)) + & SEC_ALLOC) != 0)) + addend += nlm_fixed_header (abfd)->dataImageSize; + + if (addend != 0 + && rel->howto != NULL + && rel->howto->rightshift == 0 + && rel->howto->size == 2 + && rel->howto->bitsize == 32 + && rel->howto->bitpos == 0 + && rel->howto->src_mask == 0xffffffff + && rel->howto->dst_mask == 0xffffffff) + { + bfd_vma val; + + val = bfd_get_32 (abfd, (bfd_byte *) data + rel->address - offset); + val += addend; + bfd_put_32 (abfd, val, (bfd_byte *) data + rel->address - offset); + rel->addend = 0; + } + + /* NetWare uses a reloc with pcrel_offset set. We adjust + pc_relative relocs accordingly. We are going to change the + howto field, so we can only do this if the current one is + compatible. We should check special_function here, but at + the moment coff-i386 uses a special_function which does not + affect what we are doing here. */ + if (rel->howto != NULL + && rel->howto->pc_relative + && ! rel->howto->pcrel_offset + && rel->howto->rightshift == 0 + && rel->howto->size == 2 + && rel->howto->bitsize == 32 + && rel->howto->bitpos == 0 + && rel->howto->src_mask == 0xffffffff + && rel->howto->dst_mask == 0xffffffff) + { + bfd_vma val; + + /* When pcrel_offset is not set, it means that the negative + of the address of the memory location is stored in the + memory location. We must add it back in. */ + val = bfd_get_32 (abfd, (bfd_byte *) data + rel->address - offset); + val += rel->address; + bfd_put_32 (abfd, val, (bfd_byte *) data + rel->address - offset); + + rel->howto = &nlm_i386_pcrel_howto; + } + } + + return TRUE; +} + +/* Read a NetWare i386 import record */ +static bfd_boolean +nlm_i386_read_import (abfd, sym) + bfd *abfd; + nlmNAME(symbol_type) *sym; +{ + struct nlm_relent *nlm_relocs; /* relocation records for symbol */ + bfd_size_type rcount; /* number of relocs */ + bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* temporary 32-bit value */ + unsigned char symlength; /* length of symbol name */ + char *name; + + if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd) + != sizeof (symlength)) + return FALSE; + sym -> symbol.the_bfd = abfd; + name = bfd_alloc (abfd, (bfd_size_type) symlength + 1); + if (name == NULL) + return FALSE; + if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength) + return FALSE; + name[symlength] = '\0'; + sym -> symbol.name = name; + sym -> symbol.flags = 0; + sym -> symbol.value = 0; + sym -> symbol.section = bfd_und_section_ptr; + if (bfd_bread ((PTR) temp, (bfd_size_type) sizeof (temp), abfd) + != sizeof (temp)) + return FALSE; + rcount = H_GET_32 (abfd, temp); + nlm_relocs = ((struct nlm_relent *) + bfd_alloc (abfd, rcount * sizeof (struct nlm_relent))); + if (!nlm_relocs) + return FALSE; + sym -> relocs = nlm_relocs; + sym -> rcnt = 0; + while (sym -> rcnt < rcount) + { + asection *section; + + if (! nlm_i386_read_reloc (abfd, sym, §ion, &nlm_relocs -> reloc)) + return FALSE; + nlm_relocs -> section = section; + nlm_relocs++; + sym -> rcnt++; + } + return TRUE; +} + +/* Write out an external reference. */ + +static bfd_boolean +nlm_i386_write_external (abfd, count, sym, relocs) + bfd *abfd; + bfd_size_type count; + asymbol *sym; + struct reloc_and_sec *relocs; +{ + unsigned int i; + bfd_byte len; + unsigned char temp[NLM_TARGET_LONG_SIZE]; + + len = strlen (sym->name); + if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) + != sizeof (bfd_byte)) + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) + return FALSE; + + bfd_put_32 (abfd, count, temp); + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) + return FALSE; + + for (i = 0; i < count; i++) + { + if (! nlm_i386_write_import (abfd, relocs[i].sec, relocs[i].rel)) + return FALSE; + } + + return TRUE; +} + +#include "nlmswap.h" + +static const struct nlm_backend_data nlm32_i386_backend = +{ + "NetWare Loadable Module\032", + sizeof (Nlm32_i386_External_Fixed_Header), + 0, /* optional_prefix_size */ + bfd_arch_i386, + 0, + FALSE, + 0, /* backend_object_p */ + 0, /* write_prefix_func */ + nlm_i386_read_reloc, + nlm_i386_mangle_relocs, + nlm_i386_read_import, + nlm_i386_write_import, + 0, /* set_public_section */ + 0, /* get_public_offset */ + nlm_swap_fixed_header_in, + nlm_swap_fixed_header_out, + nlm_i386_write_external, + 0, /* write_export */ +}; + +#define TARGET_LITTLE_NAME "nlm32-i386" +#define TARGET_LITTLE_SYM nlmNAME(i386_vec) +#define TARGET_BACKEND_DATA &nlm32_i386_backend + +#include "nlm-target.h" diff --git a/bfd/nlm32-ppc.c b/bfd/nlm32-ppc.c new file mode 100644 index 0000000000000..aafe2cc997152 --- /dev/null +++ b/bfd/nlm32-ppc.c @@ -0,0 +1,1046 @@ +/* Support for 32-bit PowerPC NLM (NetWare Loadable Module) + Copyright 1994, 1995, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +/* The format of a PowerPC NLM changed. Define OLDFORMAT to get the + old format. */ + +#define ARCH_SIZE 32 + +#include "nlm/ppc-ext.h" +#define Nlm_External_Fixed_Header Nlm32_powerpc_External_Fixed_Header + +#include "libnlm.h" + +#ifdef OLDFORMAT +static bfd_boolean nlm_powerpc_backend_object_p + PARAMS ((bfd *)); +static bfd_boolean nlm_powerpc_write_prefix + PARAMS ((bfd *)); +#endif + +static bfd_boolean nlm_powerpc_read_reloc + PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *)); +static bfd_boolean nlm_powerpc_mangle_relocs + PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type)); +static bfd_boolean nlm_powerpc_read_import + PARAMS ((bfd *, nlmNAME(symbol_type) *)); + +#ifdef OLDFORMAT +static bfd_boolean nlm_powerpc_write_reloc + PARAMS ((bfd *, asection *, arelent *, int)); +#endif + +static bfd_boolean nlm_powerpc_write_import + PARAMS ((bfd *, asection *, arelent *)); +static bfd_boolean nlm_powerpc_write_external + PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *)); + +#ifndef OLDFORMAT +static bfd_boolean nlm_powerpc_set_public_section + PARAMS ((bfd *, nlmNAME(symbol_type) *)); +static bfd_vma nlm_powerpc_get_public_offset + PARAMS ((bfd *, asymbol *)); +#endif + +#ifdef OLDFORMAT + +/* The prefix header is only used in the old format. */ + +/* PowerPC NLM's have a prefix header before the standard NLM. This + function reads it in, verifies the version, and seeks the bfd to + the location before the regular NLM header. */ + +static bfd_boolean +nlm_powerpc_backend_object_p (abfd) + bfd *abfd; +{ + struct nlm32_powerpc_external_prefix_header s; + + if (bfd_bread ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s) + return FALSE; + + if (memcmp (s.signature, NLM32_POWERPC_SIGNATURE, sizeof s.signature) != 0 + || H_GET_32 (abfd, s.headerVersion) != NLM32_POWERPC_HEADER_VERSION) + return FALSE; + + return TRUE; +} + +/* Write out the prefix. */ + +static bfd_boolean +nlm_powerpc_write_prefix (abfd) + bfd *abfd; +{ + struct nlm32_powerpc_external_prefix_header s; + + memset (&s, 0, sizeof s); + memcpy (s.signature, NLM32_POWERPC_SIGNATURE, sizeof s.signature); + H_PUT_32 (abfd, NLM32_POWERPC_HEADER_VERSION, s.headerVersion); + H_PUT_32 (abfd, 0, s.origins); + + /* FIXME: What should we do about the date? */ + + if (bfd_bwrite ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s) + return FALSE; + + return TRUE; +} + +#endif /* OLDFORMAT */ + +#ifndef OLDFORMAT + +/* There is only one type of reloc in a PowerPC NLM. */ + +static reloc_howto_type nlm_powerpc_howto = + HOWTO (0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE); /* pcrel_offset */ + +/* Read a PowerPC NLM reloc. */ + +static bfd_boolean +nlm_powerpc_read_reloc (abfd, sym, secp, rel) + bfd *abfd; + nlmNAME(symbol_type) *sym; + asection **secp; + arelent *rel; +{ + bfd_byte temp[4]; + bfd_vma val; + const char *name; + + if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) + return FALSE; + + val = bfd_get_32 (abfd, temp); + + /* The value is a word offset into either the code or data segment. + This is the location which needs to be adjusted. + + The high bit is 0 if the value is an offset into the data + segment, or 1 if the value is an offset into the text segment. + + If this is a relocation fixup rather than an imported symbol (the + sym argument is NULL), then the second most significant bit is 0 + if the address of the data segment should be added to the + location addressed by the value, or 1 if the address of the text + segment should be added. + + If this is an imported symbol, the second most significant bit is + not used and must be 0. */ + + if ((val & NLM_HIBIT) == 0) + name = NLM_INITIALIZED_DATA_NAME; + else + { + name = NLM_CODE_NAME; + val &=~ NLM_HIBIT; + } + *secp = bfd_get_section_by_name (abfd, name); + + if (sym == NULL) + { + if ((val & (NLM_HIBIT >> 1)) == 0) + name = NLM_INITIALIZED_DATA_NAME; + else + { + name = NLM_CODE_NAME; + val &=~ (NLM_HIBIT >> 1); + } + rel->sym_ptr_ptr = bfd_get_section_by_name (abfd, name)->symbol_ptr_ptr; + } + + rel->howto = &nlm_powerpc_howto; + + rel->address = val << 2; + rel->addend = 0; + + return TRUE; +} + +#else /* OLDFORMAT */ + +/* This reloc handling is only applicable to the old format. */ + +/* How to process the various reloc types. PowerPC NLMs use XCOFF + reloc types, and I have just copied the XCOFF reloc table here. */ + +static reloc_howto_type nlm_powerpc_howto_table[] = +{ + /* Standard 32 bit relocation. */ + HOWTO (0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_POS", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit relocation, but store negative value. */ + HOWTO (1, /* type */ + 0, /* rightshift */ + -2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_NEG", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit PC relative relocation. */ + HOWTO (2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "R_REL", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16 bit TOC relative relocation. */ + HOWTO (3, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "R_TOC", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* I don't really know what this is. */ + HOWTO (4, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_RTB", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* External TOC relative symbol. */ + HOWTO (5, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_GL", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Local TOC relative symbol. */ + HOWTO (6, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_TCL", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + { 7 }, + + /* Non modifiable absolute branch. */ + HOWTO (8, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_BA", /* name */ + TRUE, /* partial_inplace */ + 0x3fffffc, /* src_mask */ + 0x3fffffc, /* dst_mask */ + FALSE), /* pcrel_offset */ + + { 9 }, + + /* Non modifiable relative branch. */ + HOWTO (0xa, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "R_BR", /* name */ + TRUE, /* partial_inplace */ + 0x3fffffc, /* src_mask */ + 0x3fffffc, /* dst_mask */ + FALSE), /* pcrel_offset */ + + { 0xb }, + + /* Indirect load. */ + HOWTO (0xc, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_RL", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Load address. */ + HOWTO (0xd, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_RLA", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + { 0xe }, + + /* Non-relocating reference. */ + HOWTO (0xf, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_REF", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + { 0x10 }, + { 0x11 }, + + /* TOC relative indirect load. */ + HOWTO (0x12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_TRL", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TOC relative load address. */ + HOWTO (0x13, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_TRLA", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Modifiable relative branch. */ + HOWTO (0x14, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_RRTBI", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Modifiable absolute branch. */ + HOWTO (0x15, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_RRTBA", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Modifiable call absolute indirect. */ + HOWTO (0x16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_CAI", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Modifiable call relative. */ + HOWTO (0x17, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_REL", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Modifiable branch absolute. */ + HOWTO (0x18, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_RBA", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Modifiable branch absolute. */ + HOWTO (0x19, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_RBAC", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Modifiable branch relative. */ + HOWTO (0x1a, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 26, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "R_REL", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Modifiable branch absolute. */ + HOWTO (0x1b, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_REL", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE) /* pcrel_offset */ +}; + +#define HOWTO_COUNT (sizeof nlm_powerpc_howto_table \ + / sizeof nlm_powerpc_howto_table[0]) + +/* Read a PowerPC NLM reloc. */ + +static bfd_boolean +nlm_powerpc_read_reloc (abfd, sym, secp, rel) + bfd *abfd; + nlmNAME(symbol_type) *sym; + asection **secp; + arelent *rel; +{ + struct nlm32_powerpc_external_reloc ext; + bfd_vma l_vaddr; + unsigned long l_symndx; + int l_rtype; + int l_rsecnm; + asection *code_sec, *data_sec, *bss_sec; + + /* Read the reloc from the file. */ + if (bfd_bread (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext) + return FALSE; + + /* Swap in the fields. */ + l_vaddr = H_GET_32 (abfd, ext.l_vaddr); + l_symndx = H_GET_32 (abfd, ext.l_symndx); + l_rtype = H_GET_16 (abfd, ext.l_rtype); + l_rsecnm = H_GET_16 (abfd, ext.l_rsecnm); + + /* Get the sections now, for convenience. */ + code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME); + data_sec = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME); + bss_sec = bfd_get_section_by_name (abfd, NLM_UNINITIALIZED_DATA_NAME); + + /* Work out the arelent fields. */ + if (sym != NULL) + { + /* This is an import. sym_ptr_ptr is filled in by + nlm_canonicalize_reloc. */ + rel->sym_ptr_ptr = NULL; + } + else + { + asection *sec; + + if (l_symndx == 0) + sec = code_sec; + else if (l_symndx == 1) + sec = data_sec; + else if (l_symndx == 2) + sec = bss_sec; + else + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + rel->sym_ptr_ptr = sec->symbol_ptr_ptr; + } + + rel->addend = 0; + + BFD_ASSERT ((l_rtype & 0xff) < HOWTO_COUNT); + + rel->howto = nlm_powerpc_howto_table + (l_rtype & 0xff); + + BFD_ASSERT (rel->howto->name != NULL + && ((l_rtype & 0x8000) != 0 + ? (rel->howto->complain_on_overflow + == complain_overflow_signed) + : (rel->howto->complain_on_overflow + == complain_overflow_bitfield)) + && ((l_rtype >> 8) & 0x1f) == rel->howto->bitsize - 1); + + if (l_rsecnm == 0) + *secp = code_sec; + else if (l_rsecnm == 1) + { + *secp = data_sec; + l_vaddr -= bfd_section_size (abfd, code_sec); + } + else + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + rel->address = l_vaddr; + + return TRUE; +} + +#endif /* OLDFORMAT */ + +/* Mangle PowerPC NLM relocs for output. */ + +static bfd_boolean +nlm_powerpc_mangle_relocs (abfd, sec, data, offset, count) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const PTR data ATTRIBUTE_UNUSED; + bfd_vma offset ATTRIBUTE_UNUSED; + bfd_size_type count ATTRIBUTE_UNUSED; +{ + return TRUE; +} + +/* Read a PowerPC NLM import record */ + +static bfd_boolean +nlm_powerpc_read_import (abfd, sym) + bfd *abfd; + nlmNAME(symbol_type) *sym; +{ + struct nlm_relent *nlm_relocs; /* relocation records for symbol */ + bfd_size_type rcount; /* number of relocs */ + bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* temporary 32-bit value */ + unsigned char symlength; /* length of symbol name */ + char *name; + + if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd) + != sizeof (symlength)) + return FALSE; + sym -> symbol.the_bfd = abfd; + name = bfd_alloc (abfd, (bfd_size_type) symlength + 1); + if (name == NULL) + return FALSE; + if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength) + return FALSE; + name[symlength] = '\0'; + sym -> symbol.name = name; + sym -> symbol.flags = 0; + sym -> symbol.value = 0; + sym -> symbol.section = bfd_und_section_ptr; + if (bfd_bread ((PTR) temp, (bfd_size_type) sizeof (temp), abfd) + != sizeof (temp)) + return FALSE; + rcount = H_GET_32 (abfd, temp); + nlm_relocs = ((struct nlm_relent *) + bfd_alloc (abfd, rcount * sizeof (struct nlm_relent))); + if (nlm_relocs == (struct nlm_relent *) NULL) + return FALSE; + sym -> relocs = nlm_relocs; + sym -> rcnt = 0; + while (sym -> rcnt < rcount) + { + asection *section; + + if (! nlm_powerpc_read_reloc (abfd, sym, §ion, &nlm_relocs -> reloc)) + return FALSE; + nlm_relocs -> section = section; + nlm_relocs++; + sym -> rcnt++; + } + return TRUE; +} + +#ifndef OLDFORMAT + +/* Write a PowerPC NLM reloc. */ + +static bfd_boolean +nlm_powerpc_write_import (abfd, sec, rel) + bfd *abfd; + asection *sec; + arelent *rel; +{ + asymbol *sym; + bfd_vma val; + bfd_byte temp[4]; + + /* PowerPC NetWare only supports one kind of reloc. */ + if (rel->addend != 0 + || rel->howto == NULL + || rel->howto->rightshift != 0 + || rel->howto->size != 2 + || rel->howto->bitsize != 32 + || rel->howto->bitpos != 0 + || rel->howto->pc_relative + || (rel->howto->src_mask != 0xffffffff && rel->addend != 0) + || rel->howto->dst_mask != 0xffffffff) + { + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } + + sym = *rel->sym_ptr_ptr; + + /* The value we write out is the offset into the appropriate + segment, rightshifted by two. This offset is the section vma, + adjusted by the vma of the lowest section in that segment, plus + the address of the relocation. */ + val = bfd_get_section_vma (abfd, sec) + rel->address; + if ((val & 3) != 0) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + val >>= 2; + + /* The high bit is 0 if the reloc is in the data section, or 1 if + the reloc is in the code section. */ + if (bfd_get_section_flags (abfd, sec) & SEC_DATA) + val -= nlm_get_data_low (abfd); + else + { + val -= nlm_get_text_low (abfd); + val |= NLM_HIBIT; + } + + if (! bfd_is_und_section (bfd_get_section (sym))) + { + /* This is an internal relocation fixup. The second most + significant bit is 0 if this is a reloc against the data + segment, or 1 if it is a reloc against the text segment. */ + if (bfd_get_section_flags (abfd, bfd_get_section (sym)) & SEC_CODE) + val |= NLM_HIBIT >> 1; + } + + bfd_put_32 (abfd, val, temp); + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) + return FALSE; + + return TRUE; +} + +#else /* OLDFORMAT */ + +/* This is used for the reloc handling in the old format. */ + +/* Write a PowerPC NLM reloc. */ + +static bfd_boolean +nlm_powerpc_write_reloc (abfd, sec, rel, indx) + bfd *abfd; + asection *sec; + arelent *rel; + int indx; +{ + struct nlm32_powerpc_external_reloc ext; + asection *code_sec, *data_sec, *bss_sec; + asymbol *sym; + asection *symsec; + unsigned long l_symndx; + int l_rtype; + int l_rsecnm; + reloc_howto_type *howto; + bfd_size_type address; + + /* Get the sections now, for convenience. */ + code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME); + data_sec = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME); + bss_sec = bfd_get_section_by_name (abfd, NLM_UNINITIALIZED_DATA_NAME); + + sym = *rel->sym_ptr_ptr; + symsec = bfd_get_section (sym); + if (indx != -1) + { + BFD_ASSERT (bfd_is_und_section (symsec)); + l_symndx = indx + 3; + } + else + { + if (symsec == code_sec) + l_symndx = 0; + else if (symsec == data_sec) + l_symndx = 1; + else if (symsec == bss_sec) + l_symndx = 2; + else + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + + H_PUT_32 (abfd, l_symndx, ext.l_symndx); + + for (howto = nlm_powerpc_howto_table; + howto < nlm_powerpc_howto_table + HOWTO_COUNT; + howto++) + { + if (howto->rightshift == rel->howto->rightshift + && howto->size == rel->howto->size + && howto->bitsize == rel->howto->bitsize + && howto->pc_relative == rel->howto->pc_relative + && howto->bitpos == rel->howto->bitpos + && (howto->partial_inplace == rel->howto->partial_inplace + || (! rel->howto->partial_inplace + && rel->addend == 0)) + && (howto->src_mask == rel->howto->src_mask + || (rel->howto->src_mask == 0 + && rel->addend == 0)) + && howto->dst_mask == rel->howto->dst_mask + && howto->pcrel_offset == rel->howto->pcrel_offset) + break; + } + if (howto >= nlm_powerpc_howto_table + HOWTO_COUNT) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + l_rtype = howto->type; + if (howto->complain_on_overflow == complain_overflow_signed) + l_rtype |= 0x8000; + l_rtype |= (howto->bitsize - 1) << 8; + H_PUT_16 (abfd, l_rtype, ext.l_rtype); + + address = rel->address; + + if (sec == code_sec) + l_rsecnm = 0; + else if (sec == data_sec) + { + l_rsecnm = 1; + address += bfd_section_size (abfd, code_sec); + } + else + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + H_PUT_16 (abfd, l_rsecnm, ext.l_rsecnm); + H_PUT_32 (abfd, address, ext.l_vaddr); + + if (bfd_bwrite (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext) + return FALSE; + + return TRUE; +} + +/* Write a PowerPC NLM import. */ + +static bfd_boolean +nlm_powerpc_write_import (abfd, sec, rel) + bfd *abfd; + asection *sec; + arelent *rel; +{ + return nlm_powerpc_write_reloc (abfd, sec, rel, -1); +} + +#endif /* OLDFORMAT */ + +/* Write a PowerPC NLM external symbol. This routine keeps a static + count of the symbol index. FIXME: I don't know if this is + necessary, and the index never gets reset. */ + +static bfd_boolean +nlm_powerpc_write_external (abfd, count, sym, relocs) + bfd *abfd; + bfd_size_type count; + asymbol *sym; + struct reloc_and_sec *relocs; +{ + unsigned int i; + bfd_byte len; + unsigned char temp[NLM_TARGET_LONG_SIZE]; +#ifdef OLDFORMAT + static int indx; +#endif + + len = strlen (sym->name); + if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) + != sizeof (bfd_byte)) + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) + return FALSE; + + bfd_put_32 (abfd, count, temp); + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) + return FALSE; + + for (i = 0; i < count; i++) + { +#ifndef OLDFORMAT + if (! nlm_powerpc_write_import (abfd, relocs[i].sec, relocs[i].rel)) + return FALSE; +#else + if (! nlm_powerpc_write_reloc (abfd, relocs[i].sec, + relocs[i].rel, indx)) + return FALSE; +#endif + } + +#ifdef OLDFORMAT + ++indx; +#endif + + return TRUE; +} + +#ifndef OLDFORMAT + +/* PowerPC Netware uses a word offset, not a byte offset, for public + symbols. */ + +/* Set the section for a public symbol. */ + +static bfd_boolean +nlm_powerpc_set_public_section (abfd, sym) + bfd *abfd; + nlmNAME(symbol_type) *sym; +{ + if (sym->symbol.value & NLM_HIBIT) + { + sym->symbol.value &= ~NLM_HIBIT; + sym->symbol.flags |= BSF_FUNCTION; + sym->symbol.section = + bfd_get_section_by_name (abfd, NLM_CODE_NAME); + } + else + { + sym->symbol.section = + bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME); + } + + sym->symbol.value <<= 2; + + return TRUE; +} + +/* Get the offset to write out for a public symbol. */ + +static bfd_vma +nlm_powerpc_get_public_offset (abfd, sym) + bfd *abfd; + asymbol *sym; +{ + bfd_vma offset; + asection *sec; + + offset = bfd_asymbol_value (sym); + sec = bfd_get_section (sym); + if (sec->flags & SEC_CODE) + { + offset -= nlm_get_text_low (abfd); + offset |= NLM_HIBIT; + } + else if (sec->flags & (SEC_DATA | SEC_ALLOC)) + { + /* SEC_ALLOC is for the .bss section. */ + offset -= nlm_get_data_low (abfd); + } + else + { + /* We can't handle an exported symbol that is not in the code or + data segment. */ + bfd_set_error (bfd_error_invalid_operation); + /* FIXME: No way to return error. */ + abort (); + } + + return offset; +} + +#endif /* ! defined (OLDFORMAT) */ + +#include "nlmswap.h" + +static const struct nlm_backend_data nlm32_powerpc_backend = +{ + "NetWare PowerPC Module \032", + sizeof (Nlm32_powerpc_External_Fixed_Header), +#ifndef OLDFORMAT + 0, /* optional_prefix_size */ +#else + sizeof (struct nlm32_powerpc_external_prefix_header), +#endif + bfd_arch_powerpc, + 0, + FALSE, +#ifndef OLDFORMAT + 0, /* backend_object_p */ + 0, /* write_prefix */ +#else + nlm_powerpc_backend_object_p, + nlm_powerpc_write_prefix, +#endif + nlm_powerpc_read_reloc, + nlm_powerpc_mangle_relocs, + nlm_powerpc_read_import, + nlm_powerpc_write_import, +#ifndef OLDFORMAT + nlm_powerpc_set_public_section, + nlm_powerpc_get_public_offset, +#else + 0, /* set_public_section */ + 0, /* get_public_offset */ +#endif + nlm_swap_fixed_header_in, + nlm_swap_fixed_header_out, + nlm_powerpc_write_external, + 0, /* write_export */ +}; + +#define TARGET_BIG_NAME "nlm32-powerpc" +#define TARGET_BIG_SYM nlmNAME(powerpc_vec) +#define TARGET_BACKEND_DATA &nlm32_powerpc_backend + +#include "nlm-target.h" diff --git a/bfd/nlm32-sparc.c b/bfd/nlm32-sparc.c new file mode 100644 index 0000000000000..e973d42a7bebd --- /dev/null +++ b/bfd/nlm32-sparc.c @@ -0,0 +1,436 @@ +/* Support for 32-bit SPARC NLM (NetWare Loadable Module) + Copyright 1993, 1994, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#define ARCH_SIZE 32 + +#include "nlm/sparc32-ext.h" +#define Nlm_External_Fixed_Header Nlm32_sparc_External_Fixed_Header + +#include "libnlm.h" + +static bfd_boolean nlm_sparc_read_reloc + PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *)); +static bfd_boolean nlm_sparc_write_reloc + PARAMS ((bfd *, asection *, arelent *)); +static bfd_boolean nlm_sparc_mangle_relocs + PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type)); +static bfd_boolean nlm_sparc_read_import + PARAMS ((bfd *, nlmNAME(symbol_type) *)); +static bfd_boolean nlm_sparc_write_import + PARAMS ((bfd *, asection *, arelent *)); +static bfd_boolean nlm_sparc_write_external + PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *)); +static bfd_boolean nlm_sparc_write_export + PARAMS ((bfd *, asymbol *, bfd_vma)); + +enum reloc_type + { + R_SPARC_NONE = 0, + R_SPARC_8, R_SPARC_16, R_SPARC_32, + R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32, + R_SPARC_WDISP30, R_SPARC_WDISP22, + R_SPARC_HI22, R_SPARC_22, + R_SPARC_13, R_SPARC_LO10, + R_SPARC_GOT10, R_SPARC_GOT13, R_SPARC_GOT22, + R_SPARC_PC10, R_SPARC_PC22, + R_SPARC_WPLT30, + R_SPARC_COPY, + R_SPARC_GLOB_DAT, R_SPARC_JMP_SLOT, + R_SPARC_RELATIVE, + R_SPARC_UA32, + R_SPARC_max + }; + +#if 0 +static const char *const reloc_type_names[] = + { + "R_SPARC_NONE", + "R_SPARC_8", "R_SPARC_16", "R_SPARC_32", + "R_SPARC_DISP8", "R_SPARC_DISP16", "R_SPARC_DISP32", + "R_SPARC_WDISP30", "R_SPARC_WDISP22", + "R_SPARC_HI22", "R_SPARC_22", + "R_SPARC_13", "R_SPARC_LO10", + "R_SPARC_GOT10", "R_SPARC_GOT13", "R_SPARC_GOT22", + "R_SPARC_PC10", "R_SPARC_PC22", + "R_SPARC_WPLT30", + "R_SPARC_COPY", + "R_SPARC_GLOB_DAT", "R_SPARC_JMP_SLOT", + "R_SPARC_RELATIVE", + "R_SPARC_UA32", + }; +#endif + +static reloc_howto_type nlm32_sparc_howto_table[] = + { + HOWTO (R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, 0,"R_SPARC_NONE", FALSE,0,0x00000000,TRUE), + HOWTO (R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_8", FALSE,0,0x000000ff,TRUE), + HOWTO (R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_16", FALSE,0,0x0000ffff,TRUE), + HOWTO (R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_32", FALSE,0,0xffffffff,TRUE), + HOWTO (R_SPARC_DISP8, 0,0, 8,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_DISP8", FALSE,0,0x000000ff,TRUE), + HOWTO (R_SPARC_DISP16, 0,1,16,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_DISP16", FALSE,0,0x0000ffff,TRUE), + HOWTO (R_SPARC_DISP32, 0,2,32,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_DISP32", FALSE,0,0x00ffffff,TRUE), + HOWTO (R_SPARC_WDISP30, 2,2,30,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_WDISP30", FALSE,0,0x3fffffff,TRUE), + HOWTO (R_SPARC_WDISP22, 2,2,22,TRUE, 0,complain_overflow_signed, 0,"R_SPARC_WDISP22", FALSE,0,0x003fffff,TRUE), + HOWTO (R_SPARC_HI22, 10,2,22,FALSE,0,complain_overflow_dont, 0,"R_SPARC_HI22", FALSE,0,0x003fffff,TRUE), + HOWTO (R_SPARC_22, 0,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_22", FALSE,0,0x003fffff,TRUE), + HOWTO (R_SPARC_13, 0,2,13,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_13", FALSE,0,0x00001fff,TRUE), + HOWTO (R_SPARC_LO10, 0,2,10,FALSE,0,complain_overflow_dont, 0,"R_SPARC_LO10", FALSE,0,0x000003ff,TRUE), + HOWTO (R_SPARC_GOT10, 0,2,10,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT10", FALSE,0,0x000003ff,TRUE), + HOWTO (R_SPARC_GOT13, 0,2,13,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT13", FALSE,0,0x00001fff,TRUE), + HOWTO (R_SPARC_GOT22, 10,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_GOT22", FALSE,0,0x003fffff,TRUE), + HOWTO (R_SPARC_PC10, 0,2,10,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_PC10", FALSE,0,0x000003ff,TRUE), + HOWTO (R_SPARC_PC22, 0,2,22,FALSE,0,complain_overflow_bitfield,0,"R_SPARC_PC22", FALSE,0,0x003fffff,TRUE), + HOWTO (R_SPARC_WPLT30, 0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_WPLT30", FALSE,0,0x00000000,TRUE), + HOWTO (R_SPARC_COPY, 0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_COPY", FALSE,0,0x00000000,TRUE), + HOWTO (R_SPARC_GLOB_DAT,0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_GLOB_DAT",FALSE,0,0x00000000,TRUE), + HOWTO (R_SPARC_JMP_SLOT,0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_JMP_SLOT",FALSE,0,0x00000000,TRUE), + HOWTO (R_SPARC_RELATIVE,0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_RELATIVE",FALSE,0,0x00000000,TRUE), + HOWTO (R_SPARC_UA32, 0,0,00,FALSE,0,complain_overflow_dont, 0,"R_SPARC_UA32", FALSE,0,0x00000000,TRUE), +}; + +/* Read a NetWare sparc reloc. */ + +struct nlm32_sparc_reloc_ext + { + unsigned char offset[4]; + unsigned char addend[4]; + unsigned char type[1]; + unsigned char pad1[3]; + }; + +static bfd_boolean +nlm_sparc_read_reloc (abfd, sym, secp, rel) + bfd *abfd; + nlmNAME(symbol_type) *sym ATTRIBUTE_UNUSED; + asection **secp; + arelent *rel; +{ + bfd_vma val, addend; + unsigned int index; + unsigned int type; + struct nlm32_sparc_reloc_ext tmp_reloc; + asection *code_sec, *data_sec; + + if (bfd_bread (&tmp_reloc, (bfd_size_type) 12, abfd) != 12) + return FALSE; + + code_sec = bfd_get_section_by_name (abfd, NLM_CODE_NAME); + data_sec = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME); + + *secp = code_sec; + + val = bfd_get_32 (abfd, tmp_reloc.offset); + addend = bfd_get_32 (abfd, tmp_reloc.addend); + type = bfd_get_8 (abfd, tmp_reloc.type); + + rel->address = val; + rel->addend = addend; + rel->howto = NULL; + + for (index = 0; + index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type); + index++) + if (nlm32_sparc_howto_table[index].type == type) + { + rel->howto = &nlm32_sparc_howto_table[index]; + break; + } + +#ifdef DEBUG + fprintf (stderr, "%s: address = %08lx, addend = %08lx, type = %d, howto = %08lx\n", + __FUNCTION__, rel->address, rel->addend, type, rel->howto); +#endif + return TRUE; + +} + +/* Write a NetWare sparc reloc. */ + +static bfd_boolean +nlm_sparc_write_reloc (abfd, sec, rel) + bfd *abfd; + asection *sec; + arelent *rel; +{ + bfd_vma val; + struct nlm32_sparc_reloc_ext tmp_reloc; + unsigned int index; + int type = -1; + reloc_howto_type *tmp; + + for (index = 0; + index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type); + index++) + { + tmp = &nlm32_sparc_howto_table[index]; + + if (tmp->rightshift == rel->howto->rightshift + && tmp->size == rel->howto->size + && tmp->bitsize == rel->howto->bitsize + && tmp->pc_relative == rel->howto->pc_relative + && tmp->bitpos == rel->howto->bitpos + && tmp->src_mask == rel->howto->src_mask + && tmp->dst_mask == rel->howto->dst_mask) + { + type = tmp->type; + break; + } + } + if (type == -1) + abort (); + + /* Netware wants a list of relocs for each address. + Format is: + long offset + long addend + char type + That should be it. */ + + /* The value we write out is the offset into the appropriate + segment. This offset is the section vma, adjusted by the vma of + the lowest section in that segment, plus the address of the + relocation. */ +#if 0 + val = bfd_get_section_vma (abfd, (*rel->sym_ptr_ptr)->section) + rel->address; +#else + val = bfd_get_section_vma (abfd, sec) + rel->address; +#endif + +#ifdef DEBUG + fprintf (stderr, "%s: val = %08lx, addend = %08lx, type = %d\n", + __FUNCTION__, val, rel->addend, rel->howto->type); +#endif + bfd_put_32 (abfd, val, tmp_reloc.offset); + bfd_put_32 (abfd, rel->addend, tmp_reloc.addend); + bfd_put_8 (abfd, (short) (rel->howto->type), tmp_reloc.type); + + if (bfd_bwrite (&tmp_reloc, (bfd_size_type) 12, abfd) != 12) + return FALSE; + + return TRUE; +} + +/* Mangle relocs for SPARC NetWare. We can just use the standard + SPARC relocs. */ + +static bfd_boolean +nlm_sparc_mangle_relocs (abfd, sec, data, offset, count) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + const PTR data ATTRIBUTE_UNUSED; + bfd_vma offset ATTRIBUTE_UNUSED; + bfd_size_type count ATTRIBUTE_UNUSED; +{ + return TRUE; +} + +/* Read a NetWare sparc import record. */ + +static bfd_boolean +nlm_sparc_read_import (abfd, sym) + bfd *abfd; + nlmNAME(symbol_type) *sym; +{ + struct nlm_relent *nlm_relocs; /* Relocation records for symbol. */ + bfd_size_type rcount; /* Number of relocs. */ + bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* Temporary 32-bit value. */ + unsigned char symlength; /* Length of symbol name. */ + char *name; + + /* First, read in the number of relocation + entries for this symbol. */ + if (bfd_bread ((PTR) temp, (bfd_size_type) 4, abfd) != 4) + return FALSE; + + rcount = bfd_get_32 (abfd, temp); + + /* Next, read in the length of the symbol. */ + + if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd) + != sizeof (symlength)) + return FALSE; + sym -> symbol.the_bfd = abfd; + name = bfd_alloc (abfd, (bfd_size_type) symlength + 1); + if (name == NULL) + return FALSE; + + /* Then read in the symbol. */ + + if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength) + return FALSE; + name[symlength] = '\0'; + sym -> symbol.name = name; + sym -> symbol.flags = 0; + sym -> symbol.value = 0; + sym -> symbol.section = bfd_und_section_ptr; + + /* Next, start reading in the relocs. */ + + nlm_relocs = ((struct nlm_relent *) + bfd_alloc (abfd, rcount * sizeof (struct nlm_relent))); + if (!nlm_relocs) + return FALSE; + sym -> relocs = nlm_relocs; + sym -> rcnt = 0; + while (sym -> rcnt < rcount) + { + asection *section; + + if (! nlm_sparc_read_reloc (abfd, sym, §ion, &nlm_relocs -> reloc)) + return FALSE; + nlm_relocs -> section = section; + nlm_relocs++; + sym -> rcnt++; + } + + return TRUE; +} + +static bfd_boolean +nlm_sparc_write_import (abfd, sec, rel) + bfd *abfd; + asection *sec; + arelent *rel; +{ + char temp[4]; + asection *code, *data, *bss, *symsec; + bfd_vma base; + + code = bfd_get_section_by_name (abfd, NLM_CODE_NAME); + data = bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME); + bss = bfd_get_section_by_name (abfd, NLM_UNINITIALIZED_DATA_NAME); + symsec = (*rel->sym_ptr_ptr)->section; + + if (symsec == code) + base = 0; + else if (symsec == data) + base = bfd_section_size (abfd, code); + else if (symsec == bss) + base = bfd_section_size (abfd, code) + bfd_section_size (abfd, data); + else + base = 0; + +#ifdef DEBUG + fprintf (stderr, "%s: <%x, 1>\n\t", + __FUNCTION__, base + (*rel->sym_ptr_ptr)->value); +#endif + bfd_put_32 (abfd, base + (*rel->sym_ptr_ptr)->value, temp); + if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4) + return FALSE; + bfd_put_32 (abfd, (bfd_vma) 1, temp); + if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4) + return FALSE; + if (! nlm_sparc_write_reloc (abfd, sec, rel)) + return FALSE; + return TRUE; +} + +/* Write out an external reference. */ + +static bfd_boolean +nlm_sparc_write_external (abfd, count, sym, relocs) + bfd *abfd; + bfd_size_type count; + asymbol *sym; + struct reloc_and_sec *relocs; +{ + unsigned int i; + bfd_byte len; + unsigned char temp[NLM_TARGET_LONG_SIZE]; + + bfd_put_32 (abfd, count, temp); + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) + return FALSE; + + len = strlen (sym->name); + if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) + != sizeof (bfd_byte)) + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) + return FALSE; + + for (i = 0; i < count; i++) + { + if (! nlm_sparc_write_reloc (abfd, relocs[i].sec, relocs[i].rel)) + return FALSE; + } + + return TRUE; +} + +static bfd_boolean +nlm_sparc_write_export (abfd, sym, value) + bfd *abfd; + asymbol *sym; + bfd_vma value; +{ + bfd_byte len; + bfd_byte temp[4]; + +#ifdef DEBUG + fprintf (stderr, "%s: <%x, %d, %s>\n", + __FUNCTION__, value, strlen (sym->name), sym->name); +#endif + bfd_put_32 (abfd, value, temp); + len = strlen (sym->name); + + if (bfd_bwrite (temp, (bfd_size_type) 4, abfd) != 4 + || bfd_bwrite (&len, (bfd_size_type) 1, abfd) != 1 + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) + return FALSE; + + return TRUE; +} + +#undef nlm_swap_fixed_header_in +#undef nlm_swap_fixed_header_out + +#include "nlmswap.h" + +static const struct nlm_backend_data nlm32_sparc_backend = + { + "NetWare SPARC Module \032", + sizeof (Nlm32_sparc_External_Fixed_Header), + 0, /* optional_prefix_size */ + bfd_arch_sparc, + 0, + FALSE, + 0, /* backend_object_p */ + 0, /* write_prefix_func */ + nlm_sparc_read_reloc, + nlm_sparc_mangle_relocs, + nlm_sparc_read_import, + nlm_sparc_write_import, + 0, /* set_public_section */ + 0, /* get_public_offset */ + nlm_swap_fixed_header_in, + nlm_swap_fixed_header_out, + nlm_sparc_write_external, + nlm_sparc_write_export + }; + +#define TARGET_BIG_NAME "nlm32-sparc" +#define TARGET_BIG_SYM nlmNAME(sparc_vec) +#define TARGET_BACKEND_DATA & nlm32_sparc_backend + +#include "nlm-target.h" diff --git a/bfd/nlm32.c b/bfd/nlm32.c new file mode 100644 index 0000000000000..bcabeef1df1d6 --- /dev/null +++ b/bfd/nlm32.c @@ -0,0 +1,21 @@ +/* NLM (NetWare Loadable Module) 32-bit executable support for BFD. + Copyright 1993 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define ARCH_SIZE 32 +#include "nlmcode.h" diff --git a/bfd/nlm64.c b/bfd/nlm64.c new file mode 100644 index 0000000000000..bedb1d7e785a5 --- /dev/null +++ b/bfd/nlm64.c @@ -0,0 +1,21 @@ +/* NLM (NetWare Loadable Module) 64-bit executable support for BFD. + Copyright 1993 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define ARCH_SIZE 64 +#include "nlmcode.h" diff --git a/bfd/nlmcode.h b/bfd/nlmcode.h new file mode 100644 index 0000000000000..68e4a2a8723ef --- /dev/null +++ b/bfd/nlmcode.h @@ -0,0 +1,2043 @@ +/* NLM (NetWare Loadable Module) executable support for BFD. + Copyright 1993, 1994, 1995, 1998, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + Written by Fred Fish @ Cygnus Support, using ELF support as the + template. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "libnlm.h" + +/* The functions in this file do not use the names they appear to use. + This file is actually compiled multiple times, once for each size + of NLM target we are using. At each size we use a different name, + constructed by the macro nlmNAME. For example, the function which + is named nlm_symbol_type below is actually named nlm32_symbol_type + in the final executable. */ + +#define Nlm_External_Fixed_Header NlmNAME(External_Fixed_Header) +#define Nlm_External_Version_Header NlmNAME(External_Version_Header) +#define Nlm_External_Copyright_Header NlmNAME(External_Copyright_Header) +#define Nlm_External_Extended_Header NlmNAME(External_Extended_Header) +#define Nlm_External_Custom_Header NlmNAME(External_Custom_Header) +#define Nlm_External_Cygnus_Ext_Header NlmNAME(External_Cygnus_Ext_Header) + +#define nlm_symbol_type nlmNAME(symbol_type) +#define nlm_get_symtab_upper_bound nlmNAME(get_symtab_upper_bound) +#define nlm_canonicalize_symtab nlmNAME(canonicalize_symtab) +#define nlm_make_empty_symbol nlmNAME(make_empty_symbol) +#define nlm_print_symbol nlmNAME(print_symbol) +#define nlm_get_symbol_info nlmNAME(get_symbol_info) +#define nlm_get_reloc_upper_bound nlmNAME(get_reloc_upper_bound) +#define nlm_canonicalize_reloc nlmNAME(canonicalize_reloc) +#define nlm_object_p nlmNAME(object_p) +#define nlm_set_section_contents nlmNAME(set_section_contents) +#define nlm_write_object_contents nlmNAME(write_object_contents) + +#define nlm_swap_fixed_header_in(abfd,src,dst) \ + (nlm_swap_fixed_header_in_func(abfd)) (abfd,src,dst) +#define nlm_swap_fixed_header_out(abfd,src,dst) \ + (nlm_swap_fixed_header_out_func(abfd)) (abfd,src,dst) + +/* Forward declarations of static functions. */ + +static bfd_boolean add_bfd_section + PARAMS ((bfd *, char *, file_ptr, bfd_size_type, flagword)); +static bfd_boolean nlm_swap_variable_header_in + PARAMS ((bfd *)); +static bfd_boolean nlm_swap_variable_header_out + PARAMS ((bfd *)); +static bfd_boolean find_nonzero + PARAMS ((PTR, size_t)); +static bfd_boolean nlm_swap_auxiliary_headers_in + PARAMS ((bfd *)); +static bfd_boolean nlm_swap_auxiliary_headers_out + PARAMS ((bfd *)); +static bfd_boolean nlm_slurp_symbol_table + PARAMS ((bfd *)); +static bfd_boolean nlm_slurp_reloc_fixups + PARAMS ((bfd *)); +static bfd_boolean nlm_compute_section_file_positions + PARAMS ((bfd *)); +static int nlm_external_reloc_compare + PARAMS ((const void *, const void *)); + +/* Should perhaps use put_offset, put_word, etc. For now, the two versions + can be handled by explicitly specifying 32 bits or "the long type". */ +#if ARCH_SIZE == 64 +#define put_word H_PUT_64 +#define get_word H_GET_64 +#endif +#if ARCH_SIZE == 32 +#define put_word H_PUT_32 +#define get_word H_GET_32 +#endif + +const bfd_target * +nlm_object_p (abfd) + bfd *abfd; +{ + struct nlm_obj_tdata *preserved_tdata = nlm_tdata (abfd); + bfd_boolean (*backend_object_p) PARAMS ((bfd *)); + PTR x_fxdhdr = NULL; + Nlm_Internal_Fixed_Header *i_fxdhdrp; + struct nlm_obj_tdata *new_tdata = NULL; + const char *signature; + enum bfd_architecture arch; + bfd_size_type amt; + + /* Some NLM formats have a prefix before the standard NLM fixed + header. */ + backend_object_p = nlm_backend_object_p_func (abfd); + if (backend_object_p) + { + if (!(*backend_object_p) (abfd)) + goto got_wrong_format_error; + } + + /* Read in the fixed length portion of the NLM header in external format. */ + amt = nlm_fixed_header_size (abfd); + x_fxdhdr = (PTR) bfd_malloc (amt); + if (x_fxdhdr == NULL) + goto got_no_match; + + if (bfd_bread ((PTR) x_fxdhdr, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + goto got_wrong_format_error; + else + goto got_no_match; + } + + /* Allocate an instance of the nlm_obj_tdata structure and hook it up to + the tdata pointer in the bfd. */ + amt = sizeof (struct nlm_obj_tdata); + new_tdata = (struct nlm_obj_tdata *) bfd_zalloc (abfd, amt); + if (new_tdata == NULL) + goto got_no_match; + + nlm_tdata (abfd) = new_tdata; + + i_fxdhdrp = nlm_fixed_header (abfd); + nlm_swap_fixed_header_in (abfd, x_fxdhdr, i_fxdhdrp); + free (x_fxdhdr); + x_fxdhdr = NULL; + + /* Check to see if we have an NLM file for this backend by matching + the NLM signature. */ + signature = nlm_signature (abfd); + if (signature != NULL + && *signature != '\0' + && strncmp ((char *) i_fxdhdrp->signature, signature, + NLM_SIGNATURE_SIZE) != 0) + goto got_wrong_format_error; + + /* There's no supported way to discover the endianess of an NLM, so test for + a sane version number after doing byte swapping appropriate for this + XVEC. (Hack alert!) */ + if (i_fxdhdrp->version > 0xFFFF) + goto got_wrong_format_error; + + /* There's no supported way to check for 32 bit versus 64 bit addresses, + so ignore this distinction for now. (FIXME) */ + /* Swap in the rest of the required header. */ + if (!nlm_swap_variable_header_in (abfd)) + { + if (bfd_get_error () != bfd_error_system_call) + goto got_wrong_format_error; + else + goto got_no_match; + } + + /* Add the sections supplied by all NLM's, and then read in the + auxiliary headers. Reading the auxiliary headers may create + additional sections described in the cygnus_ext header. + From this point on we assume that we have an NLM, and do not + treat errors as indicating the wrong format. */ + if (!add_bfd_section (abfd, NLM_CODE_NAME, + i_fxdhdrp->codeImageOffset, + i_fxdhdrp->codeImageSize, + (SEC_CODE | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_RELOC)) + || !add_bfd_section (abfd, NLM_INITIALIZED_DATA_NAME, + i_fxdhdrp->dataImageOffset, + i_fxdhdrp->dataImageSize, + (SEC_DATA | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_RELOC)) + || !add_bfd_section (abfd, NLM_UNINITIALIZED_DATA_NAME, + (file_ptr) 0, + i_fxdhdrp->uninitializedDataSize, + SEC_ALLOC)) + goto got_no_match; + + if (!nlm_swap_auxiliary_headers_in (abfd)) + goto got_no_match; + + if (nlm_fixed_header (abfd)->numberOfRelocationFixups != 0 + || nlm_fixed_header (abfd)->numberOfExternalReferences != 0) + abfd->flags |= HAS_RELOC; + if (nlm_fixed_header (abfd)->numberOfPublics != 0 + || nlm_fixed_header (abfd)->numberOfDebugRecords != 0 + || nlm_fixed_header (abfd)->numberOfExternalReferences != 0) + abfd->flags |= HAS_SYMS; + + arch = nlm_architecture (abfd); + if (arch != bfd_arch_unknown) + bfd_default_set_arch_mach (abfd, arch, (unsigned long) 0); + + abfd->flags |= EXEC_P; + bfd_get_start_address (abfd) = nlm_fixed_header (abfd)->codeStartOffset; + + return (abfd->xvec); + +got_wrong_format_error: + bfd_set_error (bfd_error_wrong_format); +got_no_match: + nlm_tdata (abfd) = preserved_tdata; + if (new_tdata != NULL) + bfd_release (abfd, new_tdata); + if (x_fxdhdr != NULL) + free (x_fxdhdr); + return (NULL); +} + +/* Add a section to the bfd. */ + +static bfd_boolean +add_bfd_section (abfd, name, offset, size, flags) + bfd *abfd; + char *name; + file_ptr offset; + bfd_size_type size; + flagword flags; +{ + asection *newsect; + + newsect = bfd_make_section (abfd, name); + if (newsect == NULL) + return FALSE; + + newsect->vma = 0; /* NLM's are relocatable. */ + newsect->_raw_size = size; + newsect->filepos = offset; + newsect->flags = flags; + newsect->alignment_power = bfd_log2 ((bfd_vma) 0); /* FIXME */ + + return TRUE; +} + +/* Read and swap in the variable length header. All the fields must + exist in the NLM, and must exist in the order they are read here. */ + +static bfd_boolean +nlm_swap_variable_header_in (abfd) + bfd *abfd; +{ + unsigned char temp[NLM_TARGET_LONG_SIZE]; + bfd_size_type amt; + + /* Read the description length and text members. */ + + amt = sizeof (nlm_variable_header (abfd)->descriptionLength); + if (bfd_bread ((PTR) &nlm_variable_header (abfd)->descriptionLength, + amt, abfd) != amt) + return FALSE; + amt = nlm_variable_header (abfd)->descriptionLength + 1; + if (bfd_bread ((PTR) nlm_variable_header (abfd)->descriptionText, + amt, abfd) != amt) + return FALSE; + + /* Read and convert the stackSize field. */ + + amt = sizeof (temp); + if (bfd_bread ((PTR) temp, amt, abfd) != amt) + return FALSE; + nlm_variable_header (abfd)->stackSize = get_word (abfd, (bfd_byte *) temp); + + /* Read and convert the reserved field. */ + + amt = sizeof (temp); + if (bfd_bread ((PTR) temp, amt, abfd) != amt) + return FALSE; + nlm_variable_header (abfd)->reserved = get_word (abfd, (bfd_byte *) temp); + + /* Read the oldThreadName field. This field is a fixed length string. */ + + amt = sizeof (nlm_variable_header (abfd)->oldThreadName); + if (bfd_bread ((PTR) nlm_variable_header (abfd)->oldThreadName, + amt, abfd) != amt) + return FALSE; + + /* Read the screen name length and text members. */ + + amt = sizeof (nlm_variable_header (abfd)->screenNameLength); + if (bfd_bread ((PTR) & nlm_variable_header (abfd)->screenNameLength, + amt, abfd) != amt) + return FALSE; + amt = nlm_variable_header (abfd)->screenNameLength + 1; + if (bfd_bread ((PTR) nlm_variable_header (abfd)->screenName, + amt, abfd) != amt) + return FALSE; + + /* Read the thread name length and text members. */ + + amt = sizeof (nlm_variable_header (abfd)->threadNameLength); + if (bfd_bread ((PTR) & nlm_variable_header (abfd)->threadNameLength, + amt, abfd) != amt) + return FALSE; + amt = nlm_variable_header (abfd)->threadNameLength + 1; + if (bfd_bread ((PTR) nlm_variable_header (abfd)->threadName, + amt, abfd) != amt) + return FALSE; + return TRUE; +} + +/* Swap and write out the variable length header. All the fields must + exist in the NLM, and must exist in this order. */ + +static bfd_boolean +nlm_swap_variable_header_out (abfd) + bfd *abfd; +{ + unsigned char temp[NLM_TARGET_LONG_SIZE]; + bfd_size_type amt; + + /* Write the description length and text members. */ + amt = sizeof (nlm_variable_header (abfd)->descriptionLength); + if (bfd_bwrite ((PTR) & nlm_variable_header (abfd)->descriptionLength, amt, + abfd) != amt) + return FALSE; + amt = nlm_variable_header (abfd)->descriptionLength + 1; + if (bfd_bwrite ((PTR) nlm_variable_header (abfd)->descriptionText, amt, + abfd) != amt) + return FALSE; + + /* Convert and write the stackSize field. */ + put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->stackSize, + (bfd_byte *) temp); + amt = sizeof (temp); + if (bfd_bwrite ((PTR) temp, amt, abfd) != amt) + return FALSE; + + /* Convert and write the reserved field. */ + put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->reserved, + (bfd_byte *) temp); + amt = sizeof (temp); + if (bfd_bwrite ((PTR) temp, amt, abfd) != amt) + return FALSE; + + /* Write the oldThreadName field. This field is a fixed length string. */ + amt = sizeof (nlm_variable_header (abfd)->oldThreadName); + if (bfd_bwrite ((PTR) nlm_variable_header (abfd)->oldThreadName, amt, + abfd) != amt) + return FALSE; + + /* Write the screen name length and text members. */ + amt = sizeof (nlm_variable_header (abfd)->screenNameLength); + if (bfd_bwrite ((PTR) & nlm_variable_header (abfd)->screenNameLength, amt, + abfd) != amt) + return FALSE; + amt = nlm_variable_header (abfd)->screenNameLength + 1; + if (bfd_bwrite ((PTR) nlm_variable_header (abfd)->screenName, amt, + abfd) != amt) + return FALSE; + + /* Write the thread name length and text members. */ + amt = sizeof (nlm_variable_header (abfd)->threadNameLength); + if (bfd_bwrite ((PTR) & nlm_variable_header (abfd)->threadNameLength, amt, + abfd) != amt) + return FALSE; + amt = nlm_variable_header (abfd)->threadNameLength + 1; + if (bfd_bwrite ((PTR) nlm_variable_header (abfd)->threadName, amt, + abfd) != amt) + return FALSE; + return TRUE; +} + +/* Read and swap in the contents of all the auxiliary headers. Because of + the braindead design, we have to do strcmps on strings of indeterminate + length to figure out what each auxiliary header is. Even worse, we have + no way of knowing how many auxiliary headers there are or where the end + of the auxiliary headers are, except by finding something that doesn't + look like a known auxiliary header. This means that the first new type + of auxiliary header added will break all existing tools that don't + recognize it. */ + +static bfd_boolean +nlm_swap_auxiliary_headers_in (abfd) + bfd *abfd; +{ + char tempstr[16]; + file_ptr position; + bfd_size_type amt; + + for (;;) + { + position = bfd_tell (abfd); + amt = sizeof (tempstr); + if (bfd_bread ((PTR) tempstr, amt, abfd) != amt) + return FALSE; + if (bfd_seek (abfd, position, SEEK_SET) != 0) + return FALSE; + if (strncmp (tempstr, "VeRsIoN#", 8) == 0) + { + Nlm_External_Version_Header thdr; + + amt = sizeof (thdr); + if (bfd_bread ((PTR) &thdr, amt, abfd) != amt) + return FALSE; + memcpy (nlm_version_header (abfd)->stamp, thdr.stamp, + sizeof (thdr.stamp)); + nlm_version_header (abfd)->majorVersion = + get_word (abfd, (bfd_byte *) thdr.majorVersion); + nlm_version_header (abfd)->minorVersion = + get_word (abfd, (bfd_byte *) thdr.minorVersion); + nlm_version_header (abfd)->revision = + get_word (abfd, (bfd_byte *) thdr.revision); + nlm_version_header (abfd)->year = + get_word (abfd, (bfd_byte *) thdr.year); + nlm_version_header (abfd)->month = + get_word (abfd, (bfd_byte *) thdr.month); + nlm_version_header (abfd)->day = + get_word (abfd, (bfd_byte *) thdr.day); + } + else if (strncmp (tempstr, "MeSsAgEs", 8) == 0) + { + Nlm_External_Extended_Header thdr; + + amt = sizeof (thdr); + if (bfd_bread ((PTR) &thdr, amt, abfd) != amt) + return FALSE; + memcpy (nlm_extended_header (abfd)->stamp, thdr.stamp, + sizeof (thdr.stamp)); + nlm_extended_header (abfd)->languageID = + get_word (abfd, (bfd_byte *) thdr.languageID); + nlm_extended_header (abfd)->messageFileOffset = + get_word (abfd, (bfd_byte *) thdr.messageFileOffset); + nlm_extended_header (abfd)->messageFileLength = + get_word (abfd, (bfd_byte *) thdr.messageFileLength); + nlm_extended_header (abfd)->messageCount = + get_word (abfd, (bfd_byte *) thdr.messageCount); + nlm_extended_header (abfd)->helpFileOffset = + get_word (abfd, (bfd_byte *) thdr.helpFileOffset); + nlm_extended_header (abfd)->helpFileLength = + get_word (abfd, (bfd_byte *) thdr.helpFileLength); + nlm_extended_header (abfd)->RPCDataOffset = + get_word (abfd, (bfd_byte *) thdr.RPCDataOffset); + nlm_extended_header (abfd)->RPCDataLength = + get_word (abfd, (bfd_byte *) thdr.RPCDataLength); + nlm_extended_header (abfd)->sharedCodeOffset = + get_word (abfd, (bfd_byte *) thdr.sharedCodeOffset); + nlm_extended_header (abfd)->sharedCodeLength = + get_word (abfd, (bfd_byte *) thdr.sharedCodeLength); + nlm_extended_header (abfd)->sharedDataOffset = + get_word (abfd, (bfd_byte *) thdr.sharedDataOffset); + nlm_extended_header (abfd)->sharedDataLength = + get_word (abfd, (bfd_byte *) thdr.sharedDataLength); + nlm_extended_header (abfd)->sharedRelocationFixupOffset = + get_word (abfd, (bfd_byte *) thdr.sharedRelocationFixupOffset); + nlm_extended_header (abfd)->sharedRelocationFixupCount = + get_word (abfd, (bfd_byte *) thdr.sharedRelocationFixupCount); + nlm_extended_header (abfd)->sharedExternalReferenceOffset = + get_word (abfd, (bfd_byte *) thdr.sharedExternalReferenceOffset); + nlm_extended_header (abfd)->sharedExternalReferenceCount = + get_word (abfd, (bfd_byte *) thdr.sharedExternalReferenceCount); + nlm_extended_header (abfd)->sharedPublicsOffset = + get_word (abfd, (bfd_byte *) thdr.sharedPublicsOffset); + nlm_extended_header (abfd)->sharedPublicsCount = + get_word (abfd, (bfd_byte *) thdr.sharedPublicsCount); + nlm_extended_header (abfd)->sharedDebugRecordOffset = + get_word (abfd, (bfd_byte *) thdr.sharedDebugRecordOffset); + nlm_extended_header (abfd)->sharedDebugRecordCount = + get_word (abfd, (bfd_byte *) thdr.sharedDebugRecordCount); + nlm_extended_header (abfd)->SharedInitializationOffset = + get_word (abfd, (bfd_byte *) thdr.sharedInitializationOffset); + nlm_extended_header (abfd)->SharedExitProcedureOffset = + get_word (abfd, (bfd_byte *) thdr.SharedExitProcedureOffset); + nlm_extended_header (abfd)->productID = + get_word (abfd, (bfd_byte *) thdr.productID); + nlm_extended_header (abfd)->reserved0 = + get_word (abfd, (bfd_byte *) thdr.reserved0); + nlm_extended_header (abfd)->reserved1 = + get_word (abfd, (bfd_byte *) thdr.reserved1); + nlm_extended_header (abfd)->reserved2 = + get_word (abfd, (bfd_byte *) thdr.reserved2); + nlm_extended_header (abfd)->reserved3 = + get_word (abfd, (bfd_byte *) thdr.reserved3); + nlm_extended_header (abfd)->reserved4 = + get_word (abfd, (bfd_byte *) thdr.reserved4); + nlm_extended_header (abfd)->reserved5 = + get_word (abfd, (bfd_byte *) thdr.reserved5); + } + else if (strncmp (tempstr, "CoPyRiGhT=", 10) == 0) + { + amt = sizeof (nlm_copyright_header (abfd)->stamp); + if (bfd_bread ((PTR) nlm_copyright_header (abfd)->stamp, + amt, abfd) != amt) + return FALSE; + if (bfd_bread ((PTR) &(nlm_copyright_header (abfd) + ->copyrightMessageLength), + (bfd_size_type) 1, abfd) != 1) + return FALSE; + /* The copyright message is a variable length string. */ + amt = nlm_copyright_header (abfd)->copyrightMessageLength + 1; + if (bfd_bread ((PTR) nlm_copyright_header (abfd)->copyrightMessage, + amt, abfd) != amt) + return FALSE; + } + else if (strncmp (tempstr, "CuStHeAd", 8) == 0) + { + Nlm_External_Custom_Header thdr; + bfd_size_type hdrLength; + file_ptr dataOffset; + bfd_size_type dataLength; + char dataStamp[8]; + PTR hdr; + + /* Read the stamp ("CuStHeAd"). */ + amt = sizeof (thdr.stamp); + if (bfd_bread ((PTR) thdr.stamp, amt, abfd) != amt) + return FALSE; + /* Read the length of this custom header. */ + amt = sizeof (thdr.length); + if (bfd_bread ((PTR) thdr.length, amt, abfd) != amt) + return FALSE; + hdrLength = get_word (abfd, (bfd_byte *) thdr.length); + /* Read further fields if we have them. */ + if (hdrLength < NLM_TARGET_LONG_SIZE) + dataOffset = 0; + else + { + amt = sizeof (thdr.dataOffset); + if (bfd_bread ((PTR) thdr.dataOffset, amt, abfd) != amt) + return FALSE; + dataOffset = get_word (abfd, (bfd_byte *) thdr.dataOffset); + } + if (hdrLength < 2 * NLM_TARGET_LONG_SIZE) + dataLength = 0; + else + { + amt = sizeof (thdr.dataLength); + if (bfd_bread ((PTR) thdr.dataLength, amt, abfd) != amt) + return FALSE; + dataLength = get_word (abfd, (bfd_byte *) thdr.dataLength); + } + if (hdrLength < 2 * NLM_TARGET_LONG_SIZE + 8) + memset (dataStamp, 0, sizeof (dataStamp)); + else + { + amt = sizeof (dataStamp); + if (bfd_bread ((PTR) dataStamp, amt, abfd) != amt) + return FALSE; + } + + /* Read the rest of the header, if any. */ + if (hdrLength <= 2 * NLM_TARGET_LONG_SIZE + 8) + { + hdr = NULL; + hdrLength = 0; + } + else + { + hdrLength -= 2 * NLM_TARGET_LONG_SIZE + 8; + hdr = bfd_alloc (abfd, hdrLength); + if (hdr == NULL) + return FALSE; + if (bfd_bread (hdr, hdrLength, abfd) != hdrLength) + return FALSE; + } + + /* If we have found a Cygnus header, process it. Otherwise, + just save the associated data without trying to interpret + it. */ + if (strncmp (dataStamp, "CyGnUsEx", 8) == 0) + { + file_ptr pos; + bfd_byte *contents; + bfd_byte *p, *pend; + + BFD_ASSERT (hdrLength == 0 && hdr == NULL); + + pos = bfd_tell (abfd); + if (bfd_seek (abfd, dataOffset, SEEK_SET) != 0) + return FALSE; + contents = (bfd_byte *) bfd_alloc (abfd, dataLength); + if (contents == NULL) + return FALSE; + if (bfd_bread (contents, dataLength, abfd) != dataLength) + return FALSE; + if (bfd_seek (abfd, pos, SEEK_SET) != 0) + return FALSE; + + memcpy (nlm_cygnus_ext_header (abfd), "CyGnUsEx", 8); + nlm_cygnus_ext_header (abfd)->offset = dataOffset; + nlm_cygnus_ext_header (abfd)->length = dataLength; + + /* This data this header points to provides a list of + the sections which were in the original object file + which was converted to become an NLM. We locate + those sections and add them to the BFD. Note that + this is likely to create a second .text, .data and + .bss section; retrieving the sections by name will + get the actual NLM sections, which is what we want to + happen. The sections from the original file, which + may be subsets of the NLM section, can only be found + using bfd_map_over_sections. */ + p = contents; + pend = p + dataLength; + while (p < pend) + { + char *name; + size_t l; + file_ptr filepos; + bfd_size_type size; + asection *newsec; + + /* The format of this information is + null terminated section name + zeroes to adjust to 4 byte boundary + 4 byte section data file pointer + 4 byte section size + */ + + name = (char *) p; + l = strlen (name) + 1; + l = (l + 3) &~ (size_t) 3; + p += l; + filepos = H_GET_32 (abfd, p); + p += 4; + size = H_GET_32 (abfd, p); + p += 4; + + newsec = bfd_make_section_anyway (abfd, name); + if (newsec == (asection *) NULL) + return FALSE; + newsec->_raw_size = size; + if (filepos != 0) + { + newsec->filepos = filepos; + newsec->flags |= SEC_HAS_CONTENTS; + } + } + } + else + { + memcpy (nlm_custom_header (abfd)->stamp, thdr.stamp, + sizeof (thdr.stamp)); + nlm_custom_header (abfd)->hdrLength = hdrLength; + nlm_custom_header (abfd)->dataOffset = dataOffset; + nlm_custom_header (abfd)->dataLength = dataLength; + memcpy (nlm_custom_header (abfd)->dataStamp, dataStamp, + sizeof (dataStamp)); + nlm_custom_header (abfd)->hdr = hdr; + } + } + else + break; + } + return TRUE; +} + +/* Return whether there is a non-zero byte in a memory block. */ + +static bfd_boolean +find_nonzero (buf, size) + PTR buf; + size_t size; +{ + char *p = (char *) buf; + + while (size-- != 0) + if (*p++ != 0) + return TRUE; + return FALSE; +} + +/* Swap out the contents of the auxiliary headers. We create those + auxiliary headers which have been set non-zero. We do not require + the caller to set up the stamp fields. */ + +static bfd_boolean +nlm_swap_auxiliary_headers_out (abfd) + bfd *abfd; +{ + bfd_size_type amt; + + /* Write out the version header if there is one. */ + if (find_nonzero ((PTR) nlm_version_header (abfd), + sizeof (Nlm_Internal_Version_Header))) + { + Nlm_External_Version_Header thdr; + + memcpy (thdr.stamp, "VeRsIoN#", 8); + put_word (abfd, (bfd_vma) nlm_version_header (abfd)->majorVersion, + (bfd_byte *) thdr.majorVersion); + put_word (abfd, (bfd_vma) nlm_version_header (abfd)->minorVersion, + (bfd_byte *) thdr.minorVersion); + put_word (abfd, (bfd_vma) nlm_version_header (abfd)->revision, + (bfd_byte *) thdr.revision); + put_word (abfd, (bfd_vma) nlm_version_header (abfd)->year, + (bfd_byte *) thdr.year); + put_word (abfd, (bfd_vma) nlm_version_header (abfd)->month, + (bfd_byte *) thdr.month); + put_word (abfd, (bfd_vma) nlm_version_header (abfd)->day, + (bfd_byte *) thdr.day); + if (bfd_bwrite ((PTR) &thdr, (bfd_size_type) sizeof (thdr), abfd) + != sizeof (thdr)) + return FALSE; + } + + /* Note - the CoPyRiGhT tag is emitted before the MeSsAgEs + tag in order to make the NW4.x and NW5.x loaders happy. */ + + /* Write out the copyright header if there is one. */ + if (find_nonzero ((PTR) nlm_copyright_header (abfd), + sizeof (Nlm_Internal_Copyright_Header))) + { + Nlm_External_Copyright_Header thdr; + + memcpy (thdr.stamp, "CoPyRiGhT=", 10); + amt = sizeof (thdr.stamp); + if (bfd_bwrite ((PTR) thdr.stamp, amt, abfd) != amt) + return FALSE; + thdr.copyrightMessageLength[0] = + nlm_copyright_header (abfd)->copyrightMessageLength; + amt = 1; + if (bfd_bwrite ((PTR) thdr.copyrightMessageLength, amt, abfd) != amt) + return FALSE; + /* The copyright message is a variable length string. */ + amt = nlm_copyright_header (abfd)->copyrightMessageLength + 1; + if (bfd_bwrite ((PTR) nlm_copyright_header (abfd)->copyrightMessage, + amt, abfd) != amt) + return FALSE; + } + + /* Write out the extended header if there is one. */ + if (find_nonzero ((PTR) nlm_extended_header (abfd), + sizeof (Nlm_Internal_Extended_Header))) + { + Nlm_External_Extended_Header thdr; + + memcpy (thdr.stamp, "MeSsAgEs", 8); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->languageID, + (bfd_byte *) thdr.languageID); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->messageFileOffset, + (bfd_byte *) thdr.messageFileOffset); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->messageFileLength, + (bfd_byte *) thdr.messageFileLength); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->messageCount, + (bfd_byte *) thdr.messageCount); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->helpFileOffset, + (bfd_byte *) thdr.helpFileOffset); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->helpFileLength, + (bfd_byte *) thdr.helpFileLength); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->RPCDataOffset, + (bfd_byte *) thdr.RPCDataOffset); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->RPCDataLength, + (bfd_byte *) thdr.RPCDataLength); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->sharedCodeOffset, + (bfd_byte *) thdr.sharedCodeOffset); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->sharedCodeLength, + (bfd_byte *) thdr.sharedCodeLength); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->sharedDataOffset, + (bfd_byte *) thdr.sharedDataOffset); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->sharedDataLength, + (bfd_byte *) thdr.sharedDataLength); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->sharedRelocationFixupOffset, + (bfd_byte *) thdr.sharedRelocationFixupOffset); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->sharedRelocationFixupCount, + (bfd_byte *) thdr.sharedRelocationFixupCount); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->sharedExternalReferenceOffset, + (bfd_byte *) thdr.sharedExternalReferenceOffset); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->sharedExternalReferenceCount, + (bfd_byte *) thdr.sharedExternalReferenceCount); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->sharedPublicsOffset, + (bfd_byte *) thdr.sharedPublicsOffset); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->sharedPublicsCount, + (bfd_byte *) thdr.sharedPublicsCount); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->sharedDebugRecordOffset, + (bfd_byte *) thdr.sharedDebugRecordOffset); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->sharedDebugRecordCount, + (bfd_byte *) thdr.sharedDebugRecordCount); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->SharedInitializationOffset, + (bfd_byte *) thdr.sharedInitializationOffset); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->SharedExitProcedureOffset, + (bfd_byte *) thdr.SharedExitProcedureOffset); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->productID, + (bfd_byte *) thdr.productID); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->reserved0, + (bfd_byte *) thdr.reserved0); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->reserved1, + (bfd_byte *) thdr.reserved1); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->reserved2, + (bfd_byte *) thdr.reserved2); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->reserved3, + (bfd_byte *) thdr.reserved3); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->reserved4, + (bfd_byte *) thdr.reserved4); + put_word (abfd, + (bfd_vma) nlm_extended_header (abfd)->reserved5, + (bfd_byte *) thdr.reserved5); + if (bfd_bwrite ((PTR) &thdr, (bfd_size_type) sizeof (thdr), abfd) + != sizeof (thdr)) + return FALSE; + } + + /* Write out the custom header if there is one. */ + if (find_nonzero ((PTR) nlm_custom_header (abfd), + sizeof (Nlm_Internal_Custom_Header))) + { + Nlm_External_Custom_Header thdr; + bfd_boolean ds; + bfd_size_type hdrLength; + + ds = find_nonzero ((PTR) nlm_custom_header (abfd)->dataStamp, + sizeof (nlm_custom_header (abfd)->dataStamp)); + memcpy (thdr.stamp, "CuStHeAd", 8); + hdrLength = (2 * NLM_TARGET_LONG_SIZE + (ds ? 8 : 0) + + nlm_custom_header (abfd)->hdrLength); + put_word (abfd, hdrLength, thdr.length); + put_word (abfd, (bfd_vma) nlm_custom_header (abfd)->dataOffset, + thdr.dataOffset); + put_word (abfd, (bfd_vma) nlm_custom_header (abfd)->dataLength, + thdr.dataLength); + if (! ds) + { + BFD_ASSERT (nlm_custom_header (abfd)->hdrLength == 0); + amt = sizeof (thdr) - sizeof (thdr.dataStamp); + if (bfd_bwrite ((PTR) &thdr, amt, abfd) != amt) + return FALSE; + } + else + { + memcpy (thdr.dataStamp, nlm_custom_header (abfd)->dataStamp, + sizeof (thdr.dataStamp)); + amt = sizeof (thdr); + if (bfd_bwrite ((PTR) &thdr, amt, abfd) != amt) + return FALSE; + amt = nlm_custom_header (abfd)->hdrLength; + if (bfd_bwrite (nlm_custom_header (abfd)->hdr, amt, abfd) != amt) + return FALSE; + } + } + + /* Write out the Cygnus debugging header if there is one. */ + if (find_nonzero ((PTR) nlm_cygnus_ext_header (abfd), + sizeof (Nlm_Internal_Cygnus_Ext_Header))) + { + Nlm_External_Custom_Header thdr; + + memcpy (thdr.stamp, "CuStHeAd", 8); + put_word (abfd, (bfd_vma) 2 * NLM_TARGET_LONG_SIZE + 8, + (bfd_byte *) thdr.length); + put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->offset, + (bfd_byte *) thdr.dataOffset); + put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->length, + (bfd_byte *) thdr.dataLength); + memcpy (thdr.dataStamp, "CyGnUsEx", 8); + amt = sizeof (thdr); + if (bfd_bwrite ((PTR) &thdr, amt, abfd) != amt) + return FALSE; + } + + return TRUE; +} + +/* We read the NLM's public symbols and use it to generate a bfd symbol + table (hey, it's better than nothing) on a one-for-one basis. Thus + use the number of public symbols as the number of bfd symbols we will + have once we actually get around to reading them in. + + Return the number of bytes required to hold the symtab vector, based on + the count plus 1, since we will NULL terminate the vector allocated based + on this size. */ + +long +nlm_get_symtab_upper_bound (abfd) + bfd *abfd; +{ + Nlm_Internal_Fixed_Header *i_fxdhdrp; /* Nlm file header, internal form. */ + long symcount; + long symtab_size = 0; + + i_fxdhdrp = nlm_fixed_header (abfd); + symcount = (i_fxdhdrp->numberOfPublics + + i_fxdhdrp->numberOfDebugRecords + + i_fxdhdrp->numberOfExternalReferences); + symtab_size = (symcount + 1) * (sizeof (asymbol)); + return (symtab_size); +} + +/* Note that bfd_get_symcount is guaranteed to be zero if slurping the + symbol table fails. */ + +long +nlm_canonicalize_symtab (abfd, alocation) + bfd *abfd; + asymbol **alocation; +{ + nlm_symbol_type *symbase; + bfd_size_type counter = 0; + + if (! nlm_slurp_symbol_table (abfd)) + return -1; + symbase = nlm_get_symbols (abfd); + while (counter < bfd_get_symcount (abfd)) + { + *alocation++ = &symbase->symbol; + symbase++; + counter++; + } + *alocation = (asymbol *) NULL; + return bfd_get_symcount (abfd); +} + +/* Make an NLM symbol. There is nothing special to do here. */ + +asymbol * +nlm_make_empty_symbol (abfd) + bfd *abfd; +{ + bfd_size_type amt = sizeof (nlm_symbol_type); + nlm_symbol_type *new = (nlm_symbol_type *) bfd_zalloc (abfd, amt); + + if (new) + new->symbol.the_bfd = abfd; + return &new->symbol; +} + +/* Get symbol information. */ + +void +nlm_get_symbol_info (ignore_abfd, symbol, ret) + bfd *ignore_abfd ATTRIBUTE_UNUSED; + asymbol *symbol; + symbol_info *ret; +{ + bfd_symbol_info (symbol, ret); +} + +/* Print symbol information. */ + +void +nlm_print_symbol (abfd, afile, symbol, how) + bfd *abfd; + PTR afile; + asymbol *symbol; + bfd_print_symbol_type how; +{ + FILE *file = (FILE *) afile; + + switch (how) + { + case bfd_print_symbol_name: + case bfd_print_symbol_more: + if (symbol->name) + fprintf (file, "%s", symbol->name); + break; + case bfd_print_symbol_all: + bfd_print_symbol_vandf (abfd, (PTR) file, symbol); + fprintf (file, " %-5s", symbol->section->name); + if (symbol->name) + fprintf (file, " %s", symbol->name); + break; + } +} + +/* Slurp in nlm symbol table. + + In the external (in-file) form, NLM export records are variable length, + with the following form: + + 1 byte length of the symbol name (N) + N bytes the symbol name + 4 bytes the symbol offset from start of it's section + + We also read in the debugging symbols and import records. Import + records are treated as undefined symbols. As we read the import + records we also read in the associated reloc information, which is + attached to the symbol. + + The bfd symbols are copied to SYMPTRS. + + When we return, the bfd symcount is either zero or contains the correct + number of symbols. */ + +static bfd_boolean +nlm_slurp_symbol_table (abfd) + bfd *abfd; +{ + Nlm_Internal_Fixed_Header *i_fxdhdrp; /* Nlm file header, internal form. */ + bfd_size_type totsymcount; /* Number of NLM symbols. */ + bfd_size_type symcount; /* Counter of NLM symbols. */ + nlm_symbol_type *sym; /* Pointer to current bfd symbol. */ + unsigned char symlength; /* Symbol length read into here. */ + unsigned char symtype; /* Type of debugging symbol. */ + bfd_byte temp[NLM_TARGET_LONG_SIZE]; /* Symbol offsets read into here. */ + bfd_boolean (*read_import_func) PARAMS ((bfd *, nlm_symbol_type *)); + bfd_boolean (*set_public_section_func) PARAMS ((bfd *, nlm_symbol_type *)); + bfd_size_type amt; + + if (nlm_get_symbols (abfd) != NULL) + return TRUE; + + /* Read each raw NLM symbol, using the information to create a canonical bfd + symbol table entry. + + Note that we allocate the initial bfd canonical symbol buffer based on a + one-to-one mapping of the NLM symbols to canonical symbols. We actually + use all the NLM symbols, so there will be no space left over at the end. + When we have all the symbols, we build the caller's pointer vector. */ + + abfd->symcount = 0; + i_fxdhdrp = nlm_fixed_header (abfd); + totsymcount = (i_fxdhdrp->numberOfPublics + + i_fxdhdrp->numberOfDebugRecords + + i_fxdhdrp->numberOfExternalReferences); + if (totsymcount == 0) + return TRUE; + + if (bfd_seek (abfd, i_fxdhdrp->publicsOffset, SEEK_SET) != 0) + return FALSE; + + amt = totsymcount * sizeof (nlm_symbol_type); + sym = ((nlm_symbol_type *) bfd_zalloc (abfd, amt)); + if (!sym) + return FALSE; + nlm_set_symbols (abfd, sym); + + /* We use the bfd's symcount directly as the control count, so that early + termination of the loop leaves the symcount correct for the symbols that + were read. */ + + set_public_section_func = nlm_set_public_section_func (abfd); + symcount = i_fxdhdrp->numberOfPublics; + while (abfd->symcount < symcount) + { + amt = sizeof (symlength); + if (bfd_bread ((PTR) &symlength, amt, abfd) != amt) + return FALSE; + amt = symlength; + sym->symbol.the_bfd = abfd; + sym->symbol.name = bfd_alloc (abfd, amt + 1); + if (!sym->symbol.name) + return FALSE; + if (bfd_bread ((PTR) sym->symbol.name, amt, abfd) != amt) + return FALSE; + /* Cast away const. */ + ((char *) (sym->symbol.name))[symlength] = '\0'; + amt = sizeof (temp); + if (bfd_bread ((PTR) temp, amt, abfd) != amt) + return FALSE; + sym->symbol.flags = BSF_GLOBAL | BSF_EXPORT; + sym->symbol.value = get_word (abfd, temp); + if (set_public_section_func) + { + /* Most backends can use the code below, but unfortunately + some use a different scheme. */ + if (! (*set_public_section_func) (abfd, sym)) + return FALSE; + } + else + { + if (sym->symbol.value & NLM_HIBIT) + { + sym->symbol.value &= ~NLM_HIBIT; + sym->symbol.flags |= BSF_FUNCTION; + sym->symbol.section = + bfd_get_section_by_name (abfd, NLM_CODE_NAME); + } + else + { + sym->symbol.section = + bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME); + } + } + sym->rcnt = 0; + abfd->symcount++; + sym++; + } + + /* Read the debugging records. */ + + if (i_fxdhdrp->numberOfDebugRecords > 0) + { + if (bfd_seek (abfd, i_fxdhdrp->debugInfoOffset, SEEK_SET) != 0) + return FALSE; + + symcount += i_fxdhdrp->numberOfDebugRecords; + while (abfd->symcount < symcount) + { + amt = sizeof (symtype); + if (bfd_bread ((PTR) &symtype, amt, abfd) != amt) + return FALSE; + amt = sizeof (temp); + if (bfd_bread ((PTR) temp, amt, abfd) != amt) + return FALSE; + amt = sizeof (symlength); + if (bfd_bread ((PTR) &symlength, amt, abfd) != amt) + return FALSE; + amt = symlength; + sym->symbol.the_bfd = abfd; + sym->symbol.name = bfd_alloc (abfd, amt + 1); + if (!sym->symbol.name) + return FALSE; + if (bfd_bread ((PTR) sym->symbol.name, amt, abfd) != amt) + return FALSE; + /* Cast away const. */ + ((char *) (sym->symbol.name))[symlength] = '\0'; + sym->symbol.flags = BSF_LOCAL; + sym->symbol.value = get_word (abfd, temp); + if (symtype == 0) + { + sym->symbol.section = + bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME); + } + else if (symtype == 1) + { + sym->symbol.flags |= BSF_FUNCTION; + sym->symbol.section = + bfd_get_section_by_name (abfd, NLM_CODE_NAME); + } + else + { + sym->symbol.section = bfd_abs_section_ptr; + } + sym->rcnt = 0; + abfd->symcount++; + sym++; + } + } + + /* Read in the import records. We can only do this if we know how + to read relocs for this target. */ + read_import_func = nlm_read_import_func (abfd); + if (read_import_func != NULL) + { + if (bfd_seek (abfd, i_fxdhdrp->externalReferencesOffset, SEEK_SET) != 0) + return FALSE; + + symcount += i_fxdhdrp->numberOfExternalReferences; + while (abfd->symcount < symcount) + { + if (! (*read_import_func) (abfd, sym)) + return FALSE; + sym++; + abfd->symcount++; + } + } + + return TRUE; +} + +/* Get the relocs for an NLM file. There are two types of relocs. + Imports are relocs against symbols defined in other NLM files. We + treat these as relocs against global symbols. Relocation fixups + are internal relocs. + + The actual format used to store the relocs is machine specific. */ + +/* Read in the relocation fixup information. This is stored in + nlm_relocation_fixups, an array of arelent structures, and + nlm_relocation_fixup_secs, an array of section pointers. The + section pointers are needed because the relocs are not sorted by + section. */ + +static bfd_boolean +nlm_slurp_reloc_fixups (abfd) + bfd *abfd; +{ + bfd_boolean (*read_func) + PARAMS ((bfd *, nlm_symbol_type *, asection **, arelent *)); + bfd_size_type count, amt; + arelent *rels; + asection **secs; + + if (nlm_relocation_fixups (abfd) != NULL) + return TRUE; + read_func = nlm_read_reloc_func (abfd); + if (read_func == NULL) + return TRUE; + + if (bfd_seek (abfd, nlm_fixed_header (abfd)->relocationFixupOffset, + SEEK_SET) != 0) + return FALSE; + + count = nlm_fixed_header (abfd)->numberOfRelocationFixups; + amt = count * sizeof (arelent); + rels = (arelent *) bfd_alloc (abfd, amt); + amt = count * sizeof (asection *); + secs = (asection **) bfd_alloc (abfd, amt); + if ((rels == NULL || secs == NULL) && count != 0) + return FALSE; + nlm_relocation_fixups (abfd) = rels; + nlm_relocation_fixup_secs (abfd) = secs; + + /* We have to read piece by piece, because we don't know how large + the machine specific reloc information is. */ + while (count-- != 0) + { + if (! (*read_func) (abfd, (nlm_symbol_type *) NULL, secs, rels)) + { + nlm_relocation_fixups (abfd) = NULL; + nlm_relocation_fixup_secs (abfd) = NULL; + return FALSE; + } + ++secs; + ++rels; + } + + return TRUE; +} + +/* Get the number of relocs. This really just returns an upper bound, + since it does not attempt to distinguish them based on the section. + That will be handled when they are actually read. */ + +long +nlm_get_reloc_upper_bound (abfd, sec) + bfd *abfd; + asection *sec; +{ + nlm_symbol_type *syms; + bfd_size_type count; + unsigned int ret; + + /* If we don't know how to read relocs, just return 0. */ + if (nlm_read_reloc_func (abfd) == NULL) + return -1; + /* Make sure we have either the code or the data section. */ + if ((bfd_get_section_flags (abfd, sec) & (SEC_CODE | SEC_DATA)) == 0) + return 0; + + syms = nlm_get_symbols (abfd); + if (syms == NULL) + { + if (! nlm_slurp_symbol_table (abfd)) + return -1; + syms = nlm_get_symbols (abfd); + } + + ret = nlm_fixed_header (abfd)->numberOfRelocationFixups; + + count = bfd_get_symcount (abfd); + while (count-- != 0) + { + ret += syms->rcnt; + ++syms; + } + + return (ret + 1) * sizeof (arelent *); +} + +/* Get the relocs themselves. */ + +long +nlm_canonicalize_reloc (abfd, sec, relptr, symbols) + bfd *abfd; + asection *sec; + arelent **relptr; + asymbol **symbols; +{ + arelent *rels; + asection **secs; + bfd_size_type count, i; + unsigned int ret; + + /* Get the relocation fixups. */ + rels = nlm_relocation_fixups (abfd); + if (rels == NULL) + { + if (! nlm_slurp_reloc_fixups (abfd)) + return -1; + rels = nlm_relocation_fixups (abfd); + } + secs = nlm_relocation_fixup_secs (abfd); + + ret = 0; + count = nlm_fixed_header (abfd)->numberOfRelocationFixups; + for (i = 0; i < count; i++, rels++, secs++) + { + if (*secs == sec) + { + *relptr++ = rels; + ++ret; + } + } + + /* Get the import symbols. */ + count = bfd_get_symcount (abfd); + for (i = 0; i < count; i++, symbols++) + { + asymbol *sym; + + sym = *symbols; + if (bfd_asymbol_flavour (sym) == bfd_target_nlm_flavour) + { + nlm_symbol_type *nlm_sym; + bfd_size_type j; + + nlm_sym = (nlm_symbol_type *) sym; + for (j = 0; j < nlm_sym->rcnt; j++) + { + if (nlm_sym->relocs[j].section == sec) + { + *relptr = &nlm_sym->relocs[j].reloc; + (*relptr)->sym_ptr_ptr = symbols; + ++relptr; + ++ret; + } + } + } + } + + *relptr = NULL; + + return ret; +} + +/* Compute the section file positions for an NLM file. All variable + length data in the file headers must be set before this function is + called. If the variable length data is changed later, the + resulting object file will be incorrect. Unfortunately, there is + no way to check this. + + This routine also sets the Size and Offset fields in the fixed + header. + + It also looks over the symbols and moves any common symbols into + the .bss section; NLM has no way to represent a common symbol. + This approach means that either the symbols must already have been + set at this point, or there must be no common symbols. We need to + move the symbols at this point so that mangle_relocs can see the + final values. */ + +static bfd_boolean +nlm_compute_section_file_positions (abfd) + bfd *abfd; +{ + file_ptr sofar; + asection *sec; + bfd_vma text, data, bss; + bfd_vma text_low, data_low; + unsigned int text_align, data_align, other_align; + file_ptr text_ptr, data_ptr, other_ptr; + asection *bss_sec; + asymbol **sym_ptr_ptr; + + if (abfd->output_has_begun) + return TRUE; + + /* Make sure we have a section to hold uninitialized data. */ + bss_sec = bfd_get_section_by_name (abfd, NLM_UNINITIALIZED_DATA_NAME); + if (bss_sec == NULL) + { + if (!add_bfd_section (abfd, NLM_UNINITIALIZED_DATA_NAME, + (file_ptr) 0, (bfd_size_type) 0, + SEC_ALLOC)) + return FALSE; + bss_sec = bfd_get_section_by_name (abfd, NLM_UNINITIALIZED_DATA_NAME); + } + + abfd->output_has_begun = TRUE; + + /* The fixed header. */ + sofar = nlm_optional_prefix_size (abfd) + nlm_fixed_header_size (abfd); + + /* The variable header. */ + sofar += (sizeof (nlm_variable_header (abfd)->descriptionLength) + + nlm_variable_header (abfd)->descriptionLength + 1 + + NLM_TARGET_LONG_SIZE /* stackSize */ + + NLM_TARGET_LONG_SIZE /* reserved */ + + sizeof (nlm_variable_header (abfd)->oldThreadName) + + sizeof (nlm_variable_header (abfd)->screenNameLength) + + nlm_variable_header (abfd)->screenNameLength + 1 + + sizeof (nlm_variable_header (abfd)->threadNameLength) + + nlm_variable_header (abfd)->threadNameLength + 1); + + /* The auxiliary headers. */ + if (find_nonzero ((PTR) nlm_version_header (abfd), + sizeof (Nlm_Internal_Version_Header))) + sofar += sizeof (Nlm_External_Version_Header); + if (find_nonzero ((PTR) nlm_extended_header (abfd), + sizeof (Nlm_Internal_Extended_Header))) + sofar += sizeof (Nlm_External_Extended_Header); + if (find_nonzero ((PTR) nlm_copyright_header (abfd), + sizeof (Nlm_Internal_Copyright_Header))) + sofar += (sizeof (Nlm_External_Copyright_Header) + + nlm_copyright_header (abfd)->copyrightMessageLength + 1); + if (find_nonzero ((PTR) nlm_custom_header (abfd), + sizeof (Nlm_Internal_Custom_Header))) + sofar += (sizeof (Nlm_External_Custom_Header) + + nlm_custom_header (abfd)->hdrLength); + if (find_nonzero ((PTR) nlm_cygnus_ext_header (abfd), + sizeof (Nlm_Internal_Cygnus_Ext_Header))) + sofar += sizeof (Nlm_External_Custom_Header); + + /* Compute the section file positions in two passes. First get the + sizes of the text and data sections, and then set the file + positions. This code aligns the sections in the file using the + same alignment restrictions that apply to the sections in memory; + this may not be necessary. */ + text = 0; + text_low = (bfd_vma) - 1; + text_align = 0; + data = 0; + data_low = (bfd_vma) - 1; + data_align = 0; + bss = 0; + other_align = 0; + for (sec = abfd->sections; sec != (asection *) NULL; sec = sec->next) + { + flagword f; + + sec->_raw_size = BFD_ALIGN (sec->_raw_size, 1 << sec->alignment_power); + + f = bfd_get_section_flags (abfd, sec); + if (f & SEC_CODE) + { + text += sec->_raw_size; + if (bfd_get_section_vma (abfd, sec) < text_low) + text_low = bfd_get_section_vma (abfd, sec); + if (sec->alignment_power > text_align) + text_align = sec->alignment_power; + } + else if (f & SEC_DATA) + { + data += sec->_raw_size; + if (bfd_get_section_vma (abfd, sec) < data_low) + data_low = bfd_get_section_vma (abfd, sec); + if (sec->alignment_power > data_align) + data_align = sec->alignment_power; + } + else if (f & SEC_HAS_CONTENTS) + { + if (sec->alignment_power > other_align) + other_align = sec->alignment_power; + } + else if (f & SEC_ALLOC) + bss += sec->_raw_size; + } + + nlm_set_text_low (abfd, text_low); + nlm_set_data_low (abfd, data_low); + + if (nlm_no_uninitialized_data (abfd)) + { + /* This NetWare format does not use uninitialized data. We must + increase the size of the data section. We will never wind up + writing those file locations, so they will remain zero. */ + data += bss; + bss = 0; + } + + text_ptr = BFD_ALIGN (sofar, 1 << text_align); + data_ptr = BFD_ALIGN (text_ptr + text, 1 << data_align); + other_ptr = BFD_ALIGN (data_ptr + data, 1 << other_align); + + /* Fill in some fields in the header for which we now have the + information. */ + nlm_fixed_header (abfd)->codeImageOffset = text_ptr; + nlm_fixed_header (abfd)->codeImageSize = text; + nlm_fixed_header (abfd)->dataImageOffset = data_ptr; + nlm_fixed_header (abfd)->dataImageSize = data; + nlm_fixed_header (abfd)->uninitializedDataSize = bss; + + for (sec = abfd->sections; sec != (asection *) NULL; sec = sec->next) + { + flagword f; + + f = bfd_get_section_flags (abfd, sec); + + if (f & SEC_CODE) + { + sec->filepos = text_ptr; + text_ptr += sec->_raw_size; + } + else if (f & SEC_DATA) + { + sec->filepos = data_ptr; + data_ptr += sec->_raw_size; + } + else if (f & SEC_HAS_CONTENTS) + { + sec->filepos = other_ptr; + other_ptr += sec->_raw_size; + } + } + + nlm_fixed_header (abfd)->relocationFixupOffset = other_ptr; + + /* Move all common symbols into the .bss section. */ + + sym_ptr_ptr = bfd_get_outsymbols (abfd); + if (sym_ptr_ptr != NULL) + { + asymbol **sym_end; + bfd_vma add; + + sym_end = sym_ptr_ptr + bfd_get_symcount (abfd); + add = 0; + for (; sym_ptr_ptr < sym_end; sym_ptr_ptr++) + { + asymbol *sym; + bfd_vma size; + + sym = *sym_ptr_ptr; + + if (!bfd_is_com_section (bfd_get_section (sym))) + continue; + + /* Put the common symbol in the .bss section, and increase + the size of the .bss section by the size of the common + symbol (which is the old value of the symbol). */ + sym->section = bss_sec; + size = sym->value; + sym->value = bss_sec->_raw_size + add; + add += size; + add = BFD_ALIGN (add, 1 << bss_sec->alignment_power); + } + if (add != 0) + { + if (nlm_no_uninitialized_data (abfd)) + { + /* We could handle this case, but so far it hasn't been + necessary. */ + abort (); + } + nlm_fixed_header (abfd)->uninitializedDataSize += add; + bss_sec->_raw_size += add; + } + } + + return TRUE; +} + +/* Set the contents of a section. To do this we need to know where + the section is going to be located in the output file. That means + that the sizes of all the sections must be set, and all the + variable size header information must be known. */ + +bfd_boolean +nlm_set_section_contents (abfd, section, location, offset, count) + bfd *abfd; + asection *section; + const PTR location; + file_ptr offset; + bfd_size_type count; +{ + if (! abfd->output_has_begun + && ! nlm_compute_section_file_positions (abfd)) + return FALSE; + + if (count == 0) + return TRUE; + + /* i386 NetWare has a very restricted set of relocs. In order for + objcopy to work, the NLM i386 backend needs a chance to rework + the section contents so that its set of relocs will work. If all + the relocs are already acceptable, this will not do anything. */ + if (section->reloc_count != 0) + { + bfd_boolean (*mangle_relocs_func) + PARAMS ((bfd *, asection *, const PTR, bfd_vma, bfd_size_type)); + + mangle_relocs_func = nlm_mangle_relocs_func (abfd); + if (mangle_relocs_func != NULL) + { + if (!(*mangle_relocs_func) (abfd, section, location, + (bfd_vma) offset, count)) + return FALSE; + } + } + + if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 + || bfd_bwrite (location, count, abfd) != count) + return FALSE; + + return TRUE; +} + +/* We need to sort a list of relocs associated with sections when we + write out the external relocs. */ + +static int +nlm_external_reloc_compare (p1, p2) + const void *p1; + const void *p2; +{ + const struct reloc_and_sec *r1 = (const struct reloc_and_sec *) p1; + const struct reloc_and_sec *r2 = (const struct reloc_and_sec *) p2; + int cmp; + + cmp = strcmp ((*r1->rel->sym_ptr_ptr)->name, + (*r2->rel->sym_ptr_ptr)->name); + if (cmp != 0) + return cmp; + + /* We sort by address within symbol to make the sort more stable and + increase the chances that different hosts will generate bit for + bit equivalent results. */ + return (int) (r1->rel->address - r2->rel->address); +} + +/* Write out an NLM file. We write out the information in this order: + fixed header + variable header + auxiliary headers + code sections + data sections + other sections (custom data, messages, help, shared NLM, RPC, + module dependencies) + relocation fixups + external references (imports) + public symbols (exports) + debugging records + This is similar to the order used by the NetWare tools; the + difference is that NetWare puts the sections other than code, data + and custom data at the end of the NLM. It is convenient for us to + know where the sections are going to be before worrying about the + size of the other information. + + By the time this function is called, all the section data should + have been output using set_section_contents. Note that custom + data, the message file, the help file, the shared NLM file, the RPC + data, and the module dependencies are all considered to be + sections; the caller is responsible for filling in the offset and + length fields in the NLM headers. The relocation fixups and + imports are both obtained from the list of relocs attached to each + section. The exports and debugging records are obtained from the + list of outsymbols. */ + +bfd_boolean +nlm_write_object_contents (abfd) + bfd *abfd; +{ + asection *sec; + bfd_boolean (*write_import_func) PARAMS ((bfd *, asection *, arelent *)); + bfd_size_type external_reloc_count, internal_reloc_count, i, c; + struct reloc_and_sec *external_relocs; + asymbol **sym_ptr_ptr; + file_ptr last; + bfd_boolean (*write_prefix_func) PARAMS ((bfd *)); + unsigned char *fixed_header = NULL; + file_ptr pos; + bfd_size_type amt; + + fixed_header = ((unsigned char *) + bfd_malloc (nlm_fixed_header_size (abfd))); + if (fixed_header == NULL) + goto error_return; + + if (! abfd->output_has_begun + && ! nlm_compute_section_file_positions (abfd)) + goto error_return; + + /* Write out the variable length headers. */ + pos = nlm_optional_prefix_size (abfd) + nlm_fixed_header_size (abfd); + if (bfd_seek (abfd, pos, SEEK_SET) != 0) + goto error_return; + if (! nlm_swap_variable_header_out (abfd) + || ! nlm_swap_auxiliary_headers_out (abfd)) + { + bfd_set_error (bfd_error_system_call); + goto error_return; + } + + /* A weak check on whether the section file positions were + reasonable. */ + if (bfd_tell (abfd) > (ufile_ptr) nlm_fixed_header (abfd)->codeImageOffset) + { + bfd_set_error (bfd_error_invalid_operation); + goto error_return; + } + + /* Advance to the relocs. */ + if (bfd_seek (abfd, nlm_fixed_header (abfd)->relocationFixupOffset, + SEEK_SET) != 0) + goto error_return; + + /* The format of the relocation entries is dependent upon the + particular target. We use an external routine to write the reloc + out. */ + write_import_func = nlm_write_import_func (abfd); + + /* Write out the internal relocation fixups. While we're looping + over the relocs, we also count the external relocs, which is + needed when they are written out below. */ + internal_reloc_count = 0; + external_reloc_count = 0; + for (sec = abfd->sections; sec != (asection *) NULL; sec = sec->next) + { + arelent **rel_ptr_ptr, **rel_end; + + if (sec->reloc_count == 0) + continue; + + /* We can only represent relocs within a code or data + section. We ignore them for a debugging section. */ + if ((bfd_get_section_flags (abfd, sec) & (SEC_CODE | SEC_DATA)) == 0) + continue; + + /* We need to know how to write out imports */ + if (write_import_func == NULL) + { + bfd_set_error (bfd_error_invalid_operation); + goto error_return; + } + + rel_ptr_ptr = sec->orelocation; + rel_end = rel_ptr_ptr + sec->reloc_count; + for (; rel_ptr_ptr < rel_end; rel_ptr_ptr++) + { + arelent *rel; + asymbol *sym; + + rel = *rel_ptr_ptr; + sym = *rel->sym_ptr_ptr; + + if (! bfd_is_und_section (bfd_get_section (sym))) + { + ++internal_reloc_count; + if (! (*write_import_func) (abfd, sec, rel)) + goto error_return; + } + else + ++external_reloc_count; + } + } + nlm_fixed_header (abfd)->numberOfRelocationFixups = internal_reloc_count; + + /* Write out the imports (relocs against external symbols). These + are output as a symbol name followed by all the relocs for that + symbol, so we must first gather together all the relocs against + external symbols and sort them. */ + amt = external_reloc_count * sizeof (struct reloc_and_sec); + external_relocs = (struct reloc_and_sec *) bfd_alloc (abfd, amt); + if (external_relocs == (struct reloc_and_sec *) NULL) + goto error_return; + i = 0; + for (sec = abfd->sections; sec != (asection *) NULL; sec = sec->next) + { + arelent **rel_ptr_ptr, **rel_end; + + if (sec->reloc_count == 0) + continue; + + rel_ptr_ptr = sec->orelocation; + rel_end = rel_ptr_ptr + sec->reloc_count; + for (; rel_ptr_ptr < rel_end; rel_ptr_ptr++) + { + arelent *rel; + asymbol *sym; + + rel = *rel_ptr_ptr; + sym = *rel->sym_ptr_ptr; + + if (! bfd_is_und_section (bfd_get_section (sym))) + continue; + + external_relocs[i].rel = rel; + external_relocs[i].sec = sec; + ++i; + } + } + + BFD_ASSERT (i == external_reloc_count); + + /* Sort the external relocs by name. */ + qsort ((PTR) external_relocs, (size_t) external_reloc_count, + sizeof (struct reloc_and_sec), nlm_external_reloc_compare); + + /* Write out the external relocs. */ + nlm_fixed_header (abfd)->externalReferencesOffset = bfd_tell (abfd); + c = 0; + i = 0; + while (i < external_reloc_count) + { + arelent *rel; + asymbol *sym; + bfd_size_type j, cnt; + + ++c; + + rel = external_relocs[i].rel; + sym = *rel->sym_ptr_ptr; + + cnt = 0; + for (j = i; + (j < external_reloc_count + && *external_relocs[j].rel->sym_ptr_ptr == sym); + j++) + ++cnt; + + if (! (*nlm_write_external_func (abfd)) (abfd, cnt, sym, + &external_relocs[i])) + goto error_return; + + i += cnt; + } + + nlm_fixed_header (abfd)->numberOfExternalReferences = c; + + /* Write out the public symbols (exports). */ + sym_ptr_ptr = bfd_get_outsymbols (abfd); + if (sym_ptr_ptr != (asymbol **) NULL) + { + bfd_vma (*get_public_offset_func) PARAMS ((bfd *, asymbol *)); + bfd_boolean (*write_export_func) PARAMS ((bfd *, asymbol *, bfd_vma)); + + asymbol **sym_end; + + nlm_fixed_header (abfd)->publicsOffset = bfd_tell (abfd); + get_public_offset_func = nlm_get_public_offset_func (abfd); + write_export_func = nlm_write_export_func (abfd); + c = 0; + sym_end = sym_ptr_ptr + bfd_get_symcount (abfd); + for (; sym_ptr_ptr < sym_end; sym_ptr_ptr++) + { + asymbol *sym; + bfd_byte len; + bfd_vma offset; + bfd_byte temp[NLM_TARGET_LONG_SIZE]; + + sym = *sym_ptr_ptr; + + if ((sym->flags & (BSF_EXPORT | BSF_GLOBAL)) == 0 + || bfd_is_und_section (bfd_get_section (sym))) + continue; + + ++c; + + if (get_public_offset_func) + { + /* Most backends can use the code below, but + unfortunately some use a different scheme. */ + offset = (*get_public_offset_func) (abfd, sym); + } + else + { + offset = bfd_asymbol_value (sym); + sec = sym->section; + if (sec->flags & SEC_CODE) + { + offset -= nlm_get_text_low (abfd); + offset |= NLM_HIBIT; + } + else if (sec->flags & (SEC_DATA | SEC_ALLOC)) + { + /* SEC_ALLOC is for the .bss section. */ + offset -= nlm_get_data_low (abfd); + } + else + { + /* We can't handle an exported symbol that is not in + the code or data segment. */ + bfd_set_error (bfd_error_invalid_operation); + goto error_return; + } + } + + if (write_export_func) + { + if (! (*write_export_func) (abfd, sym, offset)) + goto error_return; + } + else + { + len = strlen (sym->name); + if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) + != sizeof (bfd_byte)) + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) + goto error_return; + + put_word (abfd, offset, temp); + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) + != sizeof (temp)) + goto error_return; + } + } + nlm_fixed_header (abfd)->numberOfPublics = c; + + /* Write out the debugging records. The NLM conversion program + wants to be able to inhibit this, so as a special hack if + debugInfoOffset is set to -1 we don't write any debugging + information. This can not be handled by fiddling with the + symbol table, because exported symbols appear in both the + exported symbol list and the debugging information. */ + if (nlm_fixed_header (abfd)->debugInfoOffset == (file_ptr) - 1) + { + nlm_fixed_header (abfd)->debugInfoOffset = 0; + nlm_fixed_header (abfd)->numberOfDebugRecords = 0; + } + else + { + nlm_fixed_header (abfd)->debugInfoOffset = bfd_tell (abfd); + c = 0; + sym_ptr_ptr = bfd_get_outsymbols (abfd); + sym_end = sym_ptr_ptr + bfd_get_symcount (abfd); + for (; sym_ptr_ptr < sym_end; sym_ptr_ptr++) + { + asymbol *sym; + bfd_byte type, len; + bfd_vma offset; + bfd_byte temp[NLM_TARGET_LONG_SIZE]; + + sym = *sym_ptr_ptr; + + /* The NLM notion of a debugging symbol is actually what + BFD calls a local or global symbol. What BFD calls a + debugging symbol NLM does not understand at all. */ + if ((sym->flags & (BSF_LOCAL | BSF_GLOBAL | BSF_EXPORT)) == 0 + || (sym->flags & BSF_DEBUGGING) != 0 + || bfd_is_und_section (bfd_get_section (sym))) + continue; + + ++c; + + offset = bfd_asymbol_value (sym); + sec = sym->section; + if (sec->flags & SEC_CODE) + { + offset -= nlm_get_text_low (abfd); + type = 1; + } + else if (sec->flags & (SEC_DATA | SEC_ALLOC)) + { + /* SEC_ALLOC is for the .bss section. */ + offset -= nlm_get_data_low (abfd); + type = 0; + } + else + type = 2; + + /* The type is 0 for data, 1 for code, 2 for absolute. */ + if (bfd_bwrite (&type, (bfd_size_type) sizeof (bfd_byte), abfd) + != sizeof (bfd_byte)) + goto error_return; + + put_word (abfd, offset, temp); + if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) + != sizeof (temp)) + goto error_return; + + len = strlen (sym->name); + if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) + != sizeof (bfd_byte)) + || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) + goto error_return; + } + nlm_fixed_header (abfd)->numberOfDebugRecords = c; + } + } + + /* NLMLINK fills in offset values even if there is no data, so we do + the same. */ + last = bfd_tell (abfd); + if (nlm_fixed_header (abfd)->codeImageOffset == 0) + nlm_fixed_header (abfd)->codeImageOffset = last; + if (nlm_fixed_header (abfd)->dataImageOffset == 0) + nlm_fixed_header (abfd)->dataImageOffset = last; + if (nlm_fixed_header (abfd)->customDataOffset == 0) + nlm_fixed_header (abfd)->customDataOffset = last; + if (nlm_fixed_header (abfd)->moduleDependencyOffset == 0) + nlm_fixed_header (abfd)->moduleDependencyOffset = last; + if (nlm_fixed_header (abfd)->relocationFixupOffset == 0) + nlm_fixed_header (abfd)->relocationFixupOffset = last; + if (nlm_fixed_header (abfd)->externalReferencesOffset == 0) + nlm_fixed_header (abfd)->externalReferencesOffset = last; + if (nlm_fixed_header (abfd)->publicsOffset == 0) + nlm_fixed_header (abfd)->publicsOffset = last; + if (nlm_fixed_header (abfd)->debugInfoOffset == 0) + nlm_fixed_header (abfd)->debugInfoOffset = last; + + /* At this point everything has been written out except the fixed + header. */ + memcpy (nlm_fixed_header (abfd)->signature, nlm_signature (abfd), + NLM_SIGNATURE_SIZE); + nlm_fixed_header (abfd)->version = NLM_HEADER_VERSION; + nlm_fixed_header (abfd)->codeStartOffset = + (bfd_get_start_address (abfd) + - nlm_get_text_low (abfd)); + + /* We have no convenient way for the caller to pass in the exit + procedure or the check unload procedure, so the caller must set + the values in the header to the values of the symbols. */ + nlm_fixed_header (abfd)->exitProcedureOffset -= nlm_get_text_low (abfd); + if (nlm_fixed_header (abfd)->checkUnloadProcedureOffset != 0) + nlm_fixed_header (abfd)->checkUnloadProcedureOffset -= + nlm_get_text_low (abfd); + + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + goto error_return; + + write_prefix_func = nlm_write_prefix_func (abfd); + if (write_prefix_func) + { + if (! (*write_prefix_func) (abfd)) + goto error_return; + } + + BFD_ASSERT ((bfd_size_type) bfd_tell (abfd) + == nlm_optional_prefix_size (abfd)); + + nlm_swap_fixed_header_out (abfd, nlm_fixed_header (abfd), fixed_header); + if (bfd_bwrite (fixed_header, nlm_fixed_header_size (abfd), abfd) + != nlm_fixed_header_size (abfd)) + goto error_return; + + if (fixed_header != NULL) + free (fixed_header); + return TRUE; + +error_return: + if (fixed_header != NULL) + free (fixed_header); + return FALSE; +} diff --git a/bfd/nlmswap.h b/bfd/nlmswap.h new file mode 100644 index 0000000000000..2fbb102bf4f2e --- /dev/null +++ b/bfd/nlmswap.h @@ -0,0 +1,157 @@ +/* NLM (NetWare Loadable Module) swapping routines for BFD. + Copyright 1993, 2000, 2001 Free Software Foundation, Inc. + + Written by Fred Fish @ Cygnus Support, using ELF support as the + template. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* Although this is a header file, it defines functions. It is + included by NLM backends to define swapping functions that vary + from one NLM to another. The backend code must arrange for + Nlm_External_xxxx to be defined appropriately, and can then include + this file to get the swapping routines. + + At the moment this is only needed for one structure, the fixed NLM + file header. */ + +static void nlm_swap_fixed_header_in PARAMS ((bfd *, PTR, + Nlm_Internal_Fixed_Header *)); +static void nlm_swap_fixed_header_out PARAMS ((bfd *, + Nlm_Internal_Fixed_Header *, + PTR)); + +/* Translate an NLM fixed length file header in external format into an NLM + file header in internal format. */ + +static void +nlm_swap_fixed_header_in (abfd, realsrc, dst) + bfd *abfd; + PTR realsrc; + Nlm_Internal_Fixed_Header *dst; +{ + Nlm_External_Fixed_Header *src = (Nlm_External_Fixed_Header *) realsrc; + memcpy (dst->signature, src->signature, NLM_SIGNATURE_SIZE); + memcpy (dst->moduleName, src->moduleName, NLM_MODULE_NAME_SIZE); + dst->version = + H_GET_32 (abfd, src->version); + dst->codeImageOffset = + H_GET_32 (abfd, src->codeImageOffset); + dst->codeImageSize = + H_GET_32 (abfd, src->codeImageSize); + dst->dataImageOffset = + H_GET_32 (abfd, src->dataImageOffset); + dst->dataImageSize = + H_GET_32 (abfd, src->dataImageSize); + dst->uninitializedDataSize = + H_GET_32 (abfd, src->uninitializedDataSize); + dst->customDataOffset = + H_GET_32 (abfd, src->customDataOffset); + dst->customDataSize = + H_GET_32 (abfd, src->customDataSize); + dst->moduleDependencyOffset = + H_GET_32 (abfd, src->moduleDependencyOffset); + dst->numberOfModuleDependencies = + H_GET_32 (abfd, src->numberOfModuleDependencies); + dst->relocationFixupOffset = + H_GET_32 (abfd, src->relocationFixupOffset); + dst->numberOfRelocationFixups = + H_GET_32 (abfd, src->numberOfRelocationFixups); + dst->externalReferencesOffset = + H_GET_32 (abfd, src->externalReferencesOffset); + dst->numberOfExternalReferences = + H_GET_32 (abfd, src->numberOfExternalReferences); + dst->publicsOffset = + H_GET_32 (abfd, src->publicsOffset); + dst->numberOfPublics = + H_GET_32 (abfd, src->numberOfPublics); + dst->debugInfoOffset = + H_GET_32 (abfd, src->debugInfoOffset); + dst->numberOfDebugRecords = + H_GET_32 (abfd, src->numberOfDebugRecords); + dst->codeStartOffset = + H_GET_32 (abfd, src->codeStartOffset); + dst->exitProcedureOffset = + H_GET_32 (abfd, src->exitProcedureOffset); + dst->checkUnloadProcedureOffset = + H_GET_32 (abfd, src->checkUnloadProcedureOffset); + dst->moduleType = + H_GET_32 (abfd, src->moduleType); + dst->flags = + H_GET_32 (abfd, src->flags); +} + +/* Translate an NLM fixed length file header in internal format into + an NLM file header in external format. */ + +static void +nlm_swap_fixed_header_out (abfd, src, realdst) + bfd *abfd; + Nlm_Internal_Fixed_Header *src; + PTR realdst; +{ + Nlm_External_Fixed_Header *dst = (Nlm_External_Fixed_Header *) realdst; + memset (dst, 0, sizeof *dst); + memcpy (dst->signature, src->signature, NLM_SIGNATURE_SIZE); + memcpy (dst->moduleName, src->moduleName, NLM_MODULE_NAME_SIZE); + H_PUT_32 (abfd, src->version, + dst->version); + H_PUT_32 (abfd, src->codeImageOffset, + dst->codeImageOffset); + H_PUT_32 (abfd, src->codeImageSize, + dst->codeImageSize); + H_PUT_32 (abfd, src->dataImageOffset, + dst->dataImageOffset); + H_PUT_32 (abfd, src->dataImageSize, + dst->dataImageSize); + H_PUT_32 (abfd, src->uninitializedDataSize, + dst->uninitializedDataSize); + H_PUT_32 (abfd, src->customDataOffset, + dst->customDataOffset); + H_PUT_32 (abfd, src->customDataSize, + dst->customDataSize); + H_PUT_32 (abfd, src->moduleDependencyOffset, + dst->moduleDependencyOffset); + H_PUT_32 (abfd, src->numberOfModuleDependencies, + dst->numberOfModuleDependencies); + H_PUT_32 (abfd, src->relocationFixupOffset, + dst->relocationFixupOffset); + H_PUT_32 (abfd, src->numberOfRelocationFixups, + dst->numberOfRelocationFixups); + H_PUT_32 (abfd, src->externalReferencesOffset, + dst->externalReferencesOffset); + H_PUT_32 (abfd, src->numberOfExternalReferences, + dst->numberOfExternalReferences); + H_PUT_32 (abfd, src->publicsOffset, + dst->publicsOffset); + H_PUT_32 (abfd, src->numberOfPublics, + dst->numberOfPublics); + H_PUT_32 (abfd, src->debugInfoOffset, + dst->debugInfoOffset); + H_PUT_32 (abfd, src->numberOfDebugRecords, + dst->numberOfDebugRecords); + H_PUT_32 (abfd, src->codeStartOffset, + dst->codeStartOffset); + H_PUT_32 (abfd, src->exitProcedureOffset, + dst->exitProcedureOffset); + H_PUT_32 (abfd, src->checkUnloadProcedureOffset, + dst->checkUnloadProcedureOffset); + H_PUT_32 (abfd, src->moduleType, + dst->moduleType); + H_PUT_32 (abfd, src->flags, + dst->flags); +} diff --git a/bfd/ns32k.h b/bfd/ns32k.h new file mode 100644 index 0000000000000..a97a9aeec96be --- /dev/null +++ b/bfd/ns32k.h @@ -0,0 +1,41 @@ +/* Header file for ns32k routines. + Copyright 1996, 2001, 2002 Free Software Foundation, Inc. + Written by Cygnus Support. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +extern bfd_reloc_status_type _bfd_ns32k_relocate_contents + PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *)); + +extern bfd_reloc_status_type _bfd_do_ns32k_reloc_contents + PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *, + bfd_vma (*) (bfd_byte *, int), + void (*) (bfd_vma, bfd_byte *, int))); + +extern bfd_reloc_status_type _bfd_ns32k_final_link_relocate + PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma, + bfd_vma, bfd_vma)); + +extern bfd_vma _bfd_ns32k_get_displacement PARAMS ((bfd_byte *, int)); +extern bfd_vma _bfd_ns32k_get_immediate PARAMS ((bfd_byte *, int)); +extern void _bfd_ns32k_put_displacement PARAMS ((bfd_vma, bfd_byte *, int)); +extern void _bfd_ns32k_put_immediate PARAMS ((bfd_vma, bfd_byte *, int)); + +extern bfd_reloc_status_type _bfd_ns32k_reloc_disp + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +extern bfd_reloc_status_type _bfd_ns32k_reloc_imm + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); diff --git a/bfd/ns32knetbsd.c b/bfd/ns32knetbsd.c new file mode 100644 index 0000000000000..3c3b5a22d0e30 --- /dev/null +++ b/bfd/ns32knetbsd.c @@ -0,0 +1,56 @@ +/* BFD back-end for NetBSD/ns32k a.out-ish binaries. + Copyright 1990, 1991, 1992, 1994, 1995, 1998, 2000, 2001, 2002 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define BYTES_IN_WORD 4 +#undef TARGET_IS_BIG_ENDIAN_P + +#define TARGET_PAGE_SIZE 4096 +#define SEGMENT_SIZE 4096 + +#define DEFAULT_ARCH bfd_arch_ns32k +#define DEFAULT_MID M_532_NETBSD + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (pc532netbsd_,OP) + +#define NAME(x,y) CONCAT3 (ns32kaout,_32_,y) + +/* This needs to start with a.out so GDB knows it is an a.out variant. */ +#define TARGETNAME "a.out-ns32k-netbsd" + +#define ns32kaout_32_get_section_contents aout_32_get_section_contents + +#define MY_text_includes_header 1 + +/* We can`t use the MYNS macro here for cpp reasons too subtle + * for me -- IWD + */ +#define MY_bfd_reloc_type_lookup ns32kaout_bfd_reloc_type_lookup + +#include "bfd.h" /* To ensure following declaration is OK */ + +const struct reloc_howto_struct * +MY_bfd_reloc_type_lookup + PARAMS((bfd *abfd AND + bfd_reloc_code_real_type code)); + +#include "netbsd.h" diff --git a/bfd/oasys.c b/bfd/oasys.c new file mode 100644 index 0000000000000..be6a8d90d86d0 --- /dev/null +++ b/bfd/oasys.c @@ -0,0 +1,1570 @@ +/* BFD back-end for oasys objects. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, + 2002, 2003 Free Software Foundation, Inc. + Written by Steve Chamberlain of Cygnus Support, . + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#define UNDERSCORE_HACK 1 +#include "bfd.h" +#include "sysdep.h" +#include "safe-ctype.h" +#include "libbfd.h" +#include "oasys.h" +#include "liboasys.h" + +static bfd_boolean oasys_slurp_section_data + PARAMS ((bfd * const)); +static bfd_boolean oasys_read_record + PARAMS ((bfd *, oasys_record_union_type *)); +static bfd_boolean oasys_write_sections + PARAMS ((bfd *)); +static bfd_boolean oasys_write_record + PARAMS ((bfd *, oasys_record_enum_type, oasys_record_union_type *, size_t)); +static bfd_boolean oasys_write_syms + PARAMS ((bfd *)); +static bfd_boolean oasys_write_header + PARAMS ((bfd *)); +static bfd_boolean oasys_write_end + PARAMS ((bfd *)); +static bfd_boolean oasys_write_data + PARAMS ((bfd *)); +static size_t oasys_string_length + PARAMS ((oasys_record_union_type *)); +static bfd_boolean oasys_slurp_symbol_table + PARAMS ((bfd *const)); +static long int oasys_get_symtab_upper_bound + PARAMS ((bfd *const)); +static const bfd_target *oasys_archive_p + PARAMS ((bfd *)); +static bfd_boolean oasys_mkobject + PARAMS ((bfd *)); +static const bfd_target *oasys_object_p + PARAMS ((bfd *)); +static void oasys_get_symbol_info + PARAMS ((bfd *, asymbol *, symbol_info *)); +static void oasys_print_symbol + PARAMS ((bfd *, void *, asymbol *, bfd_print_symbol_type)); +static bfd_boolean oasys_new_section_hook + PARAMS ((bfd *, asection *)); +static long int oasys_get_reloc_upper_bound + PARAMS ((bfd *, sec_ptr)); +static bfd_boolean oasys_get_section_contents + PARAMS ((bfd *, sec_ptr, void *, file_ptr, bfd_size_type)); +static int comp + PARAMS ((const void *, const void *)); +static bfd_boolean oasys_write_object_contents + PARAMS ((bfd *)); +static bfd_boolean oasys_set_section_contents + PARAMS ((bfd *, sec_ptr, const void *, file_ptr, bfd_size_type)); +static asymbol *oasys_make_empty_symbol + PARAMS ((bfd *)); +static bfd *oasys_openr_next_archived_file + PARAMS ((bfd *, bfd *)); +static bfd_boolean oasys_find_nearest_line + PARAMS ((bfd *, asection *, asymbol **, bfd_vma, + const char **, const char **, unsigned int *)); +static int oasys_generic_stat_arch_elt + PARAMS ((bfd *, struct stat *)); +static int oasys_sizeof_headers + PARAMS ((bfd *, bfd_boolean)); + +long oasys_canonicalize_symtab + PARAMS ((bfd *, asymbol **)); +long oasys_canonicalize_reloc + PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); + +/* Read in all the section data and relocation stuff too. */ + +static bfd_boolean +oasys_read_record (abfd, record) + bfd *abfd; + oasys_record_union_type *record; +{ + bfd_size_type amt = sizeof (record->header); + if (bfd_bread ((PTR) record, amt, abfd) != amt) + return FALSE; + + amt = record->header.length - sizeof (record->header); + if ((long) amt <= 0) + return TRUE; + if (bfd_bread ((PTR) ((char *) record + sizeof (record->header)), amt, abfd) + != amt) + return FALSE; + return TRUE; +} + +static size_t +oasys_string_length (record) + oasys_record_union_type *record; +{ + return record->header.length + - ((char *) record->symbol.name - (char *) record); +} + +/*****************************************************************************/ + +/* + +Slurp the symbol table by reading in all the records at the start file +till we get to the first section record. + +We'll sort the symbolss into two lists, defined and undefined. The +undefined symbols will be placed into the table according to their +refno. + +We do this by placing all undefined symbols at the front of the table +moving in, and the defined symbols at the end of the table moving back. + +*/ + +static bfd_boolean +oasys_slurp_symbol_table (abfd) + bfd *const abfd; +{ + oasys_record_union_type record; + oasys_data_type *data = OASYS_DATA (abfd); + bfd_boolean loop = TRUE; + asymbol *dest_defined; + asymbol *dest; + char *string_ptr; + bfd_size_type amt; + + if (data->symbols != (asymbol *) NULL) + { + return TRUE; + } + /* Buy enough memory for all the symbols and all the names */ + amt = abfd->symcount; + amt *= sizeof (asymbol); + data->symbols = (asymbol *) bfd_alloc (abfd, amt); + + amt = data->symbol_string_length; +#ifdef UNDERSCORE_HACK + /* buy 1 more char for each symbol to keep the underscore in*/ + amt += abfd->symcount; +#endif + data->strings = bfd_alloc (abfd, amt); + + if (!data->symbols || !data->strings) + return FALSE; + + dest_defined = data->symbols + abfd->symcount - 1; + + string_ptr = data->strings; + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + return FALSE; + while (loop) + { + + if (! oasys_read_record (abfd, &record)) + return FALSE; + switch (record.header.type) + { + case oasys_record_is_header_enum: + break; + case oasys_record_is_local_enum: + case oasys_record_is_symbol_enum: + { + int flag = record.header.type == (int) oasys_record_is_local_enum ? + (BSF_LOCAL) : (BSF_GLOBAL | BSF_EXPORT); + + + size_t length = oasys_string_length (&record); + switch (record.symbol.relb & RELOCATION_TYPE_BITS) + { + case RELOCATION_TYPE_ABS: + dest = dest_defined--; + dest->section = bfd_abs_section_ptr; + dest->flags = 0; + + break; + case RELOCATION_TYPE_REL: + dest = dest_defined--; + dest->section = + OASYS_DATA (abfd)->sections[record.symbol.relb & + RELOCATION_SECT_BITS]; + if (record.header.type == (int) oasys_record_is_local_enum) + { + dest->flags = BSF_LOCAL; + if (dest->section == (asection *) (~0)) + { + /* It seems that sometimes internal symbols are tied up, but + still get output, even though there is no + section */ + dest->section = 0; + } + } + else + { + + dest->flags = flag; + } + break; + case RELOCATION_TYPE_UND: + dest = data->symbols + H_GET_16 (abfd, record.symbol.refno); + dest->section = bfd_und_section_ptr; + break; + case RELOCATION_TYPE_COM: + dest = dest_defined--; + dest->name = string_ptr; + dest->the_bfd = abfd; + + dest->section = bfd_com_section_ptr; + + break; + default: + dest = dest_defined--; + BFD_ASSERT (0); + break; + } + dest->name = string_ptr; + dest->the_bfd = abfd; + dest->udata.p = (PTR) NULL; + dest->value = H_GET_32 (abfd, record.symbol.value); + +#ifdef UNDERSCORE_HACK + if (record.symbol.name[0] != '_') + { + string_ptr[0] = '_'; + string_ptr++; + } +#endif + memcpy (string_ptr, record.symbol.name, length); + + + string_ptr[length] = 0; + string_ptr += length + 1; + } + break; + default: + loop = FALSE; + } + } + return TRUE; +} + +static long +oasys_get_symtab_upper_bound (abfd) + bfd *const abfd; +{ + if (! oasys_slurp_symbol_table (abfd)) + return -1; + + return (abfd->symcount + 1) * (sizeof (oasys_symbol_type *)); +} + +extern const bfd_target oasys_vec; + +long +oasys_canonicalize_symtab (abfd, location) + bfd *abfd; + asymbol **location; +{ + asymbol *symbase; + unsigned int counter; + if (! oasys_slurp_symbol_table (abfd)) + { + return -1; + } + symbase = OASYS_DATA (abfd)->symbols; + for (counter = 0; counter < abfd->symcount; counter++) + { + *(location++) = symbase++; + } + *location = 0; + return abfd->symcount; +} + +/*********************************************************************** +* archive stuff +*/ + +static const bfd_target * +oasys_archive_p (abfd) + bfd *abfd; +{ + oasys_archive_header_type header; + oasys_extarchive_header_type header_ext; + unsigned int i; + file_ptr filepos; + bfd_size_type amt; + + amt = sizeof (header_ext); + if (bfd_seek (abfd, (file_ptr) 0, 0) != 0 + || bfd_bread ((PTR) &header_ext, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + header.version = H_GET_32 (abfd, header_ext.version); + header.mod_count = H_GET_32 (abfd, header_ext.mod_count); + header.mod_tbl_offset = H_GET_32 (abfd, header_ext.mod_tbl_offset); + header.sym_tbl_size = H_GET_32 (abfd, header_ext.sym_tbl_size); + header.sym_count = H_GET_32 (abfd, header_ext.sym_count); + header.sym_tbl_offset = H_GET_32 (abfd, header_ext.sym_tbl_offset); + header.xref_count = H_GET_32 (abfd, header_ext.xref_count); + header.xref_lst_offset = H_GET_32 (abfd, header_ext.xref_lst_offset); + + /* + There isn't a magic number in an Oasys archive, so the best we + can do to verify reasonableness is to make sure that the values in + the header are too weird + */ + + if (header.version > 10000 || + header.mod_count > 10000 || + header.sym_count > 100000 || + header.xref_count > 100000) + return (const bfd_target *) NULL; + + /* + That all worked, let's buy the space for the header and read in + the headers. + */ + { + oasys_ar_data_type *ar; + oasys_module_info_type *module; + oasys_module_table_type record; + + amt = sizeof (oasys_ar_data_type); + ar = (oasys_ar_data_type *) bfd_alloc (abfd, amt); + + amt = header.mod_count; + amt *= sizeof (oasys_module_info_type); + module = (oasys_module_info_type *) bfd_alloc (abfd, amt); + + if (!ar || !module) + return NULL; + + abfd->tdata.oasys_ar_data = ar; + ar->module = module; + ar->module_count = header.mod_count; + + filepos = header.mod_tbl_offset; + for (i = 0; i < header.mod_count; i++) + { + if (bfd_seek (abfd, filepos, SEEK_SET) != 0) + return NULL; + + /* There are two ways of specifying the archive header */ + + if (0) + { + oasys_extmodule_table_type_a_type record_ext; + + amt = sizeof (record_ext); + if (bfd_bread ((PTR) &record_ext, amt, abfd) != amt) + return NULL; + + record.mod_size = H_GET_32 (abfd, record_ext.mod_size); + record.file_offset = H_GET_32 (abfd, record_ext.file_offset); + + record.dep_count = H_GET_32 (abfd, record_ext.dep_count); + record.depee_count = H_GET_32 (abfd, record_ext.depee_count); + record.sect_count = H_GET_32 (abfd, record_ext.sect_count); + + module[i].name = bfd_alloc (abfd, (bfd_size_type) 33); + if (!module[i].name) + return NULL; + + memcpy (module[i].name, record_ext.mod_name, 33); + filepos += + sizeof (record_ext) + + record.dep_count * 4 + + record.depee_count * 4 + + record.sect_count * 8 + 187; + } + else + { + oasys_extmodule_table_type_b_type record_ext; + + amt = sizeof (record_ext); + if (bfd_bread ((PTR) &record_ext, amt, abfd) != amt) + return NULL; + + record.mod_size = H_GET_32 (abfd, record_ext.mod_size); + record.file_offset = H_GET_32 (abfd, record_ext.file_offset); + + record.dep_count = H_GET_32 (abfd, record_ext.dep_count); + record.depee_count = H_GET_32 (abfd, record_ext.depee_count); + record.sect_count = H_GET_32 (abfd, record_ext.sect_count); + record.module_name_size = H_GET_32 (abfd, + record_ext.mod_name_length); + + amt = record.module_name_size; + module[i].name = bfd_alloc (abfd, amt + 1); + if (!module[i].name) + return NULL; + if (bfd_bread ((PTR) module[i].name, amt, abfd) != amt) + return NULL; + module[i].name[record.module_name_size] = 0; + filepos += (sizeof (record_ext) + + record.dep_count * 4 + + record.module_name_size + 1); + } + + module[i].size = record.mod_size; + module[i].pos = record.file_offset; + module[i].abfd = 0; + } + } + return abfd->xvec; +} + +static bfd_boolean +oasys_mkobject (abfd) + bfd *abfd; +{ + bfd_size_type amt = sizeof (oasys_data_type); + abfd->tdata.oasys_obj_data = (oasys_data_type *) bfd_alloc (abfd, amt); + return abfd->tdata.oasys_obj_data != NULL; +} + +#define MAX_SECS 16 +static const bfd_target * +oasys_object_p (abfd) + bfd *abfd; +{ + oasys_data_type *oasys; + oasys_data_type *save = OASYS_DATA (abfd); + bfd_boolean loop = TRUE; + bfd_boolean had_usefull = FALSE; + + abfd->tdata.oasys_obj_data = 0; + oasys_mkobject (abfd); + oasys = OASYS_DATA (abfd); + memset ((PTR) oasys->sections, 0xff, sizeof (oasys->sections)); + + /* Point to the start of the file */ + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + goto fail; + oasys->symbol_string_length = 0; + /* Inspect the records, but only keep the section info - + remember the size of the symbols + */ + oasys->first_data_record = 0; + while (loop) + { + oasys_record_union_type record; + if (! oasys_read_record (abfd, &record)) + goto fail; + if ((size_t) record.header.length < (size_t) sizeof (record.header)) + goto fail; + + + switch ((oasys_record_enum_type) (record.header.type)) + { + case oasys_record_is_header_enum: + had_usefull = TRUE; + break; + case oasys_record_is_symbol_enum: + case oasys_record_is_local_enum: + /* Count symbols and remember their size for a future malloc */ + abfd->symcount++; + oasys->symbol_string_length += 1 + oasys_string_length (&record); + had_usefull = TRUE; + break; + case oasys_record_is_section_enum: + { + asection *s; + char *buffer; + unsigned int section_number; + if (record.section.header.length != sizeof (record.section)) + { + goto fail; + } + buffer = bfd_alloc (abfd, (bfd_size_type) 3); + if (!buffer) + goto fail; + section_number = record.section.relb & RELOCATION_SECT_BITS; + sprintf (buffer, "%u", section_number); + s = bfd_make_section (abfd, buffer); + oasys->sections[section_number] = s; + switch (record.section.relb & RELOCATION_TYPE_BITS) + { + case RELOCATION_TYPE_ABS: + case RELOCATION_TYPE_REL: + break; + case RELOCATION_TYPE_UND: + case RELOCATION_TYPE_COM: + BFD_FAIL (); + } + + s->_raw_size = H_GET_32 (abfd, record.section.value); + s->vma = H_GET_32 (abfd, record.section.vma); + s->flags = 0; + had_usefull = TRUE; + } + break; + case oasys_record_is_data_enum: + oasys->first_data_record = bfd_tell (abfd) - record.header.length; + case oasys_record_is_debug_enum: + case oasys_record_is_module_enum: + case oasys_record_is_named_section_enum: + case oasys_record_is_end_enum: + if (! had_usefull) + goto fail; + loop = FALSE; + break; + default: + goto fail; + } + } + oasys->symbols = (asymbol *) NULL; + /* + Oasys support several architectures, but I can't see a simple way + to discover which one is in a particular file - we'll guess + */ + bfd_default_set_arch_mach (abfd, bfd_arch_m68k, 0); + if (abfd->symcount != 0) + { + abfd->flags |= HAS_SYMS; + } + + /* + We don't know if a section has data until we've read it.. + */ + + oasys_slurp_section_data (abfd); + + + return abfd->xvec; + +fail: + (void) bfd_release (abfd, oasys); + abfd->tdata.oasys_obj_data = save; + return (const bfd_target *) NULL; +} + + +static void +oasys_get_symbol_info (ignore_abfd, symbol, ret) + bfd *ignore_abfd ATTRIBUTE_UNUSED; + asymbol *symbol; + symbol_info *ret; +{ + bfd_symbol_info (symbol, ret); + if (!symbol->section) + ret->type = (symbol->flags & BSF_LOCAL) ? 'a' : 'A'; +} + +static void +oasys_print_symbol (abfd, afile, symbol, how) + bfd *abfd; + PTR afile; + asymbol *symbol; + bfd_print_symbol_type how; +{ + FILE *file = (FILE *) afile; + + switch (how) + { + case bfd_print_symbol_name: + case bfd_print_symbol_more: + fprintf (file, "%s", symbol->name); + break; + case bfd_print_symbol_all: + { + const char *section_name = symbol->section == (asection *) NULL ? + (const char *) "*abs" : symbol->section->name; + + bfd_print_symbol_vandf (abfd, (PTR) file, symbol); + + fprintf (file, " %-5s %s", + section_name, + symbol->name); + } + break; + } +} +/* + The howto table is build using the top two bits of a reloc byte to + index into it. The bits are PCREL,WORD/LONG +*/ +static reloc_howto_type howto_table[] = +{ + + HOWTO (0, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "abs16", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (0, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "abs32", TRUE, 0xffffffff, 0xffffffff, FALSE), + HOWTO (0, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "pcrel16", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (0, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "pcrel32", TRUE, 0xffffffff, 0xffffffff, FALSE) +}; + +/* Read in all the section data and relocation stuff too */ +static bfd_boolean +oasys_slurp_section_data (abfd) + bfd *const abfd; +{ + oasys_record_union_type record; + oasys_data_type *data = OASYS_DATA (abfd); + bfd_boolean loop = TRUE; + oasys_per_section_type *per; + asection *s; + bfd_size_type amt; + + /* See if the data has been slurped already .. */ + for (s = abfd->sections; s != (asection *) NULL; s = s->next) + { + per = oasys_per_section (s); + if (per->initialized) + return TRUE; + } + + if (data->first_data_record == 0) + return TRUE; + + if (bfd_seek (abfd, data->first_data_record, SEEK_SET) != 0) + return FALSE; + while (loop) + { + if (! oasys_read_record (abfd, &record)) + return FALSE; + switch (record.header.type) + { + case oasys_record_is_header_enum: + break; + case oasys_record_is_data_enum: + { + + bfd_byte *src = record.data.data; + bfd_byte *end_src = ((bfd_byte *) & record) + record.header.length; + bfd_byte *dst_ptr; + bfd_byte *dst_base_ptr; + unsigned int relbit; + unsigned int count; + asection *section = + data->sections[record.data.relb & RELOCATION_SECT_BITS]; + bfd_vma dst_offset; + + per = oasys_per_section (section); + + if (! per->initialized) + { + per->data = (bfd_byte *) bfd_zalloc (abfd, section->_raw_size); + if (!per->data) + return FALSE; + per->reloc_tail_ptr + = (oasys_reloc_type **) §ion->relocation; + per->had_vma = FALSE; + per->initialized = TRUE; + section->reloc_count = 0; + section->flags = SEC_ALLOC; + } + + dst_offset = H_GET_32 (abfd, record.data.addr); + if (! per->had_vma) + { + /* Take the first vma we see as the base */ + section->vma = dst_offset; + per->had_vma = TRUE; + } + + dst_offset -= section->vma; + + dst_base_ptr = oasys_per_section (section)->data; + dst_ptr = oasys_per_section (section)->data + + dst_offset; + + if (src < end_src) + { + section->flags |= SEC_LOAD | SEC_HAS_CONTENTS; + } + while (src < end_src) + { + unsigned char mod_byte = *src++; + size_t gap = end_src - src; + + count = 8; + if (mod_byte == 0 && gap >= 8) + { + dst_ptr[0] = src[0]; + dst_ptr[1] = src[1]; + dst_ptr[2] = src[2]; + dst_ptr[3] = src[3]; + dst_ptr[4] = src[4]; + dst_ptr[5] = src[5]; + dst_ptr[6] = src[6]; + dst_ptr[7] = src[7]; + dst_ptr += 8; + src += 8; + } + else + { + for (relbit = 1; count-- != 0 && src < end_src; relbit <<= 1) + { + if (relbit & mod_byte) + { + unsigned char reloc = *src; + /* This item needs to be relocated */ + switch (reloc & RELOCATION_TYPE_BITS) + { + case RELOCATION_TYPE_ABS: + + break; + + case RELOCATION_TYPE_REL: + { + /* Relocate the item relative to the section */ + oasys_reloc_type *r; + + amt = sizeof (oasys_reloc_type); + r = (oasys_reloc_type *) bfd_alloc (abfd, + amt); + if (!r) + return FALSE; + *(per->reloc_tail_ptr) = r; + per->reloc_tail_ptr = &r->next; + r->next = (oasys_reloc_type *) NULL; + /* Reference to undefined symbol */ + src++; + /* There is no symbol */ + r->symbol = 0; + /* Work out the howto */ + abort (); +#if 0 + r->relent.section = + data->sections[reloc & + RELOCATION_SECT_BITS]; + + r->relent.addend = - + r->relent.section->vma; +#endif + r->relent.address = dst_ptr - dst_base_ptr; + r->relent.howto = &howto_table[reloc >> 6]; + r->relent.sym_ptr_ptr = (asymbol **) NULL; + section->reloc_count++; + + /* Fake up the data to look like + it's got the -ve pc in it, this + makes it much easier to convert + into other formats. This is done + by hitting the addend. */ + if (r->relent.howto->pc_relative) + r->relent.addend -= dst_ptr - dst_base_ptr; + } + break; + + + case RELOCATION_TYPE_UND: + { + oasys_reloc_type *r; + + amt = sizeof (oasys_reloc_type); + r = (oasys_reloc_type *) bfd_alloc (abfd, + amt); + if (!r) + return FALSE; + *(per->reloc_tail_ptr) = r; + per->reloc_tail_ptr = &r->next; + r->next = (oasys_reloc_type *) NULL; + /* Reference to undefined symbol */ + src++; + /* Get symbol number */ + r->symbol = (src[0] << 8) | src[1]; + /* Work out the howto */ + abort (); + +#if 0 + r->relent.section = (asection + *) NULL; +#endif + r->relent.addend = 0; + r->relent.address = dst_ptr - dst_base_ptr; + r->relent.howto = &howto_table[reloc >> 6]; + r->relent.sym_ptr_ptr = (asymbol **) NULL; + section->reloc_count++; + + src += 2; + /* Fake up the data to look like + it's got the -ve pc in it, this + makes it much easier to convert + into other formats. This is done + by hitting the addend. */ + if (r->relent.howto->pc_relative) + r->relent.addend -= dst_ptr - dst_base_ptr; + } + break; + case RELOCATION_TYPE_COM: + BFD_FAIL (); + } + } + *dst_ptr++ = *src++; + } + } + } + } + break; + case oasys_record_is_local_enum: + case oasys_record_is_symbol_enum: + case oasys_record_is_section_enum: + break; + default: + loop = FALSE; + } + } + + return TRUE; + +} + +static bfd_boolean +oasys_new_section_hook (abfd, newsect) + bfd *abfd; + asection *newsect; +{ + newsect->used_by_bfd = (PTR) + bfd_alloc (abfd, (bfd_size_type) sizeof (oasys_per_section_type)); + if (!newsect->used_by_bfd) + return FALSE; + oasys_per_section (newsect)->data = (bfd_byte *) NULL; + oasys_per_section (newsect)->section = newsect; + oasys_per_section (newsect)->offset = 0; + oasys_per_section (newsect)->initialized = FALSE; + newsect->alignment_power = 1; + /* Turn the section string into an index */ + + sscanf (newsect->name, "%u", &newsect->target_index); + + return TRUE; +} + + +static long +oasys_get_reloc_upper_bound (abfd, asect) + bfd *abfd; + sec_ptr asect; +{ + if (! oasys_slurp_section_data (abfd)) + return -1; + return (asect->reloc_count + 1) * sizeof (arelent *); +} + +static bfd_boolean +oasys_get_section_contents (abfd, section, location, offset, count) + bfd *abfd; + sec_ptr section; + PTR location; + file_ptr offset; + bfd_size_type count; +{ + oasys_per_section_type *p = oasys_per_section (section); + oasys_slurp_section_data (abfd); + if (! p->initialized) + { + (void) memset (location, 0, (size_t) count); + } + else + { + (void) memcpy (location, (PTR) (p->data + offset), (size_t) count); + } + return TRUE; +} + + +long +oasys_canonicalize_reloc (ignore_abfd, section, relptr, symbols) + bfd *ignore_abfd ATTRIBUTE_UNUSED; + sec_ptr section; + arelent **relptr; + asymbol **symbols ATTRIBUTE_UNUSED; +{ + unsigned int reloc_count = 0; + oasys_reloc_type *src = (oasys_reloc_type *) (section->relocation); + while (src != (oasys_reloc_type *) NULL) + { + abort (); + +#if 0 + if (src->relent.section == (asection *) NULL) + { + src->relent.sym_ptr_ptr = symbols + src->symbol; + } +#endif + + *relptr++ = &src->relent; + src = src->next; + reloc_count++; + } + *relptr = (arelent *) NULL; + return section->reloc_count = reloc_count; +} + + + + +/* Writing */ + + +/* Calculate the checksum and write one record */ +static bfd_boolean +oasys_write_record (abfd, type, record, size) + bfd *abfd; + oasys_record_enum_type type; + oasys_record_union_type *record; + size_t size; +{ + int checksum; + size_t i; + unsigned char *ptr; + + record->header.length = size; + record->header.type = (int) type; + record->header.check_sum = 0; + record->header.fill = 0; + ptr = (unsigned char *) &record->pad[0]; + checksum = 0; + for (i = 0; i < size; i++) + { + checksum += *ptr++; + } + record->header.check_sum = 0xff & (-checksum); + if (bfd_bwrite ((PTR) record, (bfd_size_type) size, abfd) != size) + return FALSE; + return TRUE; +} + + +/* Write out all the symbols */ +static bfd_boolean +oasys_write_syms (abfd) + bfd *abfd; +{ + unsigned int count; + asymbol **generic = bfd_get_outsymbols (abfd); + unsigned int index = 0; + for (count = 0; count < bfd_get_symcount (abfd); count++) + { + + oasys_symbol_record_type symbol; + asymbol *const g = generic[count]; + + const char *src = g->name; + char *dst = symbol.name; + unsigned int l = 0; + + if (bfd_is_com_section (g->section)) + { + symbol.relb = RELOCATION_TYPE_COM; + H_PUT_16 (abfd, index, symbol.refno); + index++; + } + else if (bfd_is_abs_section (g->section)) + { + symbol.relb = RELOCATION_TYPE_ABS; + H_PUT_16 (abfd, 0, symbol.refno); + + } + else if (bfd_is_und_section (g->section)) + { + symbol.relb = RELOCATION_TYPE_UND; + H_PUT_16 (abfd, index, symbol.refno); + /* Overload the value field with the output index number */ + index++; + } + else if (g->flags & BSF_DEBUGGING) + { + /* throw it away */ + continue; + } + else + { + if (g->section == (asection *) NULL) + { + /* Sometime, the oasys tools give out a symbol with illegal + bits in it, we'll output it in the same broken way */ + + symbol.relb = RELOCATION_TYPE_REL | 0; + } + else + { + symbol.relb = RELOCATION_TYPE_REL | g->section->output_section->target_index; + } + H_PUT_16 (abfd, 0, symbol.refno); + } +#ifdef UNDERSCORE_HACK + if (src[l] == '_') + dst[l++] = '.'; +#endif + while (src[l]) + { + dst[l] = src[l]; + l++; + } + + H_PUT_32 (abfd, g->value, symbol.value); + + + if (g->flags & BSF_LOCAL) + { + if (! oasys_write_record (abfd, + oasys_record_is_local_enum, + (oasys_record_union_type *) & symbol, + offsetof (oasys_symbol_record_type, + name[0]) + l)) + return FALSE; + } + else + { + if (! oasys_write_record (abfd, + oasys_record_is_symbol_enum, + (oasys_record_union_type *) & symbol, + offsetof (oasys_symbol_record_type, + name[0]) + l)) + return FALSE; + } + g->value = index - 1; + } + + return TRUE; +} + + + /* Write a section header for each section */ +static bfd_boolean +oasys_write_sections (abfd) + bfd *abfd; +{ + asection *s; + static oasys_section_record_type out; + + for (s = abfd->sections; s != (asection *) NULL; s = s->next) + { + if (!ISDIGIT (s->name[0])) + { + (*_bfd_error_handler) + (_("%s: can not represent section `%s' in oasys"), + bfd_get_filename (abfd), s->name); + bfd_set_error (bfd_error_nonrepresentable_section); + return FALSE; + } + out.relb = RELOCATION_TYPE_REL | s->target_index; + H_PUT_32 (abfd, s->_cooked_size, out.value); + H_PUT_32 (abfd, s->vma, out.vma); + + if (! oasys_write_record (abfd, + oasys_record_is_section_enum, + (oasys_record_union_type *) & out, + sizeof (out))) + return FALSE; + } + return TRUE; +} + +static bfd_boolean +oasys_write_header (abfd) + bfd *abfd; +{ + /* Create and write the header */ + oasys_header_record_type r; + size_t length = strlen (abfd->filename); + if (length > (size_t) sizeof (r.module_name)) + { + length = sizeof (r.module_name); + } + + (void) memcpy (r.module_name, + abfd->filename, + length); + (void) memset (r.module_name + length, + ' ', + sizeof (r.module_name) - length); + + r.version_number = OASYS_VERSION_NUMBER; + r.rev_number = OASYS_REV_NUMBER; + if (! oasys_write_record (abfd, + oasys_record_is_header_enum, + (oasys_record_union_type *) & r, + offsetof (oasys_header_record_type, + description[0]))) + return FALSE; + + return TRUE; +} + +static bfd_boolean +oasys_write_end (abfd) + bfd *abfd; +{ + oasys_end_record_type end; + unsigned char null = 0; + end.relb = RELOCATION_TYPE_ABS; + H_PUT_32 (abfd, abfd->start_address, end.entry); + H_PUT_16 (abfd, 0, end.fill); + end.zero = 0; + if (! oasys_write_record (abfd, + oasys_record_is_end_enum, + (oasys_record_union_type *) & end, + sizeof (end))) + return FALSE; + if (bfd_bwrite ((PTR) &null, (bfd_size_type) 1, abfd) != 1) + return FALSE; + return TRUE; +} + +static int +comp (ap, bp) + const PTR ap; + const PTR bp; +{ + arelent *a = *((arelent **) ap); + arelent *b = *((arelent **) bp); + return a->address - b->address; +} + +/* + Writing data.. + +*/ +static bfd_boolean +oasys_write_data (abfd) + bfd *abfd; +{ + asection *s; + for (s = abfd->sections; s != (asection *) NULL; s = s->next) + { + if (s->flags & SEC_LOAD) + { + bfd_byte *raw_data = oasys_per_section (s)->data; + oasys_data_record_type processed_data; + bfd_size_type current_byte_index = 0; + unsigned int relocs_to_go = s->reloc_count; + arelent **p = s->orelocation; + if (s->reloc_count != 0) + { +/* Sort the reloc records so it's easy to insert the relocs into the + data */ + + qsort (s->orelocation, + s->reloc_count, + sizeof (arelent **), + comp); + } + current_byte_index = 0; + processed_data.relb = s->target_index | RELOCATION_TYPE_REL; + + while (current_byte_index < s->_cooked_size) + { + /* Scan forwards by eight bytes or however much is left and see if + there are any relocations going on */ + bfd_byte *mod = &processed_data.data[0]; + bfd_byte *dst = &processed_data.data[1]; + + unsigned int i = 0; + *mod = 0; + + + H_PUT_32 (abfd, s->vma + current_byte_index, + processed_data.addr); + + /* Don't start a relocation unless you're sure you can finish it + within the same data record. The worst case relocation is a + 4-byte relocatable value which is split across two modification + bytes (1 relocation byte + 2 symbol reference bytes + 2 data + + 1 modification byte + 2 data = 8 bytes total). That's where + the magic number 8 comes from. + */ + while (current_byte_index < s->_raw_size && dst <= + &processed_data.data[sizeof (processed_data.data) - 8]) + { + + + if (relocs_to_go != 0) + { + arelent *r = *p; + reloc_howto_type *const how = r->howto; + /* There is a relocation, is it for this byte ? */ + if (r->address == current_byte_index) + { + unsigned char rel_byte; + + p++; + relocs_to_go--; + + *mod |= (1 << i); + if (how->pc_relative) + { + rel_byte = RELOCATION_PCREL_BIT; + + /* Also patch the raw data so that it doesn't have + the -ve stuff any more */ + if (how->size != 2) + { + bfd_put_16 (abfd, + bfd_get_16 (abfd, raw_data) + + current_byte_index, raw_data); + } + + else + { + bfd_put_32 (abfd, + bfd_get_32 (abfd, raw_data) + + current_byte_index, raw_data); + } + } + else + { + rel_byte = 0; + } + if (how->size == 2) + { + rel_byte |= RELOCATION_32BIT_BIT; + } + + /* Is this a section relative relocation, or a symbol + relative relocation ? */ + abort (); + +#if 0 + if (r->section != (asection *) NULL) + { + /* The relent has a section attached, so it must be section + relative */ + rel_byte |= RELOCATION_TYPE_REL; + rel_byte |= r->section->output_section->target_index; + *dst++ = rel_byte; + } + else +#endif + { + asymbol *sym = *(r->sym_ptr_ptr); + + /* If this symbol has a section attached, then it + has already been resolved. Change from a symbol + ref to a section ref */ + if (sym->section != (asection *) NULL) + { + rel_byte |= RELOCATION_TYPE_REL; + rel_byte |= + sym->section->output_section->target_index; + *dst++ = rel_byte; + } + else + { + rel_byte |= RELOCATION_TYPE_UND; + *dst++ = rel_byte; + /* Next two bytes are a symbol index - we can get + this from the symbol value which has been zapped + into the symbol index in the table when the + symbol table was written + */ + *dst++ = sym->value >> 8; + *dst++ = sym->value; + } + } +#define ADVANCE { if (++i >= 8) { i = 0; mod = dst++; *mod = 0; } current_byte_index++; } + /* relocations never occur from an unloadable section, + so we can assume that raw_data is not NULL + */ + *dst++ = *raw_data++; + ADVANCE + * dst++ = *raw_data++; + ADVANCE + if (how->size == 2) + { + *dst++ = *raw_data++; + ADVANCE + * dst++ = *raw_data++; + ADVANCE + } + continue; + } + } + /* If this is coming from an unloadable section then copy + zeros */ + if (raw_data == NULL) + { + *dst++ = 0; + } + else + { + *dst++ = *raw_data++; + } + ADVANCE + } + + /* Don't write a useless null modification byte */ + if (dst == mod + 1) + { + --dst; + } + + if (! (oasys_write_record + (abfd, oasys_record_is_data_enum, + ((oasys_record_union_type *) &processed_data), + (size_t) (dst - (bfd_byte *) &processed_data)))) + return FALSE; + } + } + } + + return TRUE; +} + +static bfd_boolean +oasys_write_object_contents (abfd) + bfd *abfd; +{ + if (! oasys_write_header (abfd)) + return FALSE; + if (! oasys_write_syms (abfd)) + return FALSE; + if (! oasys_write_sections (abfd)) + return FALSE; + if (! oasys_write_data (abfd)) + return FALSE; + if (! oasys_write_end (abfd)) + return FALSE; + return TRUE; +} + + + + +/** exec and core file sections */ + +/* set section contents is complicated with OASYS since the format is +* not a byte image, but a record stream. +*/ +static bfd_boolean +oasys_set_section_contents (abfd, section, location, offset, count) + bfd *abfd; + sec_ptr section; + const PTR location; + file_ptr offset; + bfd_size_type count; +{ + if (count != 0) + { + if (oasys_per_section (section)->data == (bfd_byte *) NULL) + { + oasys_per_section (section)->data = + (bfd_byte *) (bfd_alloc (abfd, section->_cooked_size)); + if (!oasys_per_section (section)->data) + return FALSE; + } + (void) memcpy ((PTR) (oasys_per_section (section)->data + offset), + location, + (size_t) count); + } + return TRUE; +} + + + +/* Native-level interface to symbols. */ + +/* We read the symbols into a buffer, which is discarded when this +function exits. We read the strings into a buffer large enough to +hold them all plus all the cached symbol entries. */ + +static asymbol * +oasys_make_empty_symbol (abfd) + bfd *abfd; +{ + bfd_size_type amt = sizeof (oasys_symbol_type); + oasys_symbol_type *new = (oasys_symbol_type *) bfd_zalloc (abfd, amt); + if (!new) + return NULL; + new->symbol.the_bfd = abfd; + return &new->symbol; +} + + + + +/* User should have checked the file flags; perhaps we should return +BFD_NO_MORE_SYMBOLS if there are none? */ + +static bfd * +oasys_openr_next_archived_file (arch, prev) + bfd *arch; + bfd *prev; +{ + oasys_ar_data_type *ar = OASYS_AR_DATA (arch); + oasys_module_info_type *p; + /* take the next one from the arch state, or reset */ + if (prev == (bfd *) NULL) + { + /* Reset the index - the first two entries are bogus*/ + ar->module_index = 0; + } + + p = ar->module + ar->module_index; + ar->module_index++; + + if (ar->module_index <= ar->module_count) + { + if (p->abfd == (bfd *) NULL) + { + p->abfd = _bfd_create_empty_archive_element_shell (arch); + p->abfd->origin = p->pos; + p->abfd->filename = p->name; + + /* Fixup a pointer to this element for the member */ + p->abfd->arelt_data = (PTR) p; + } + return p->abfd; + } + else + { + bfd_set_error (bfd_error_no_more_archived_files); + return (bfd *) NULL; + } +} + +static bfd_boolean +oasys_find_nearest_line (abfd, section, symbols, offset, + filename_ptr, functionname_ptr, line_ptr) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section ATTRIBUTE_UNUSED; + asymbol **symbols ATTRIBUTE_UNUSED; + bfd_vma offset ATTRIBUTE_UNUSED; + const char **filename_ptr ATTRIBUTE_UNUSED; + const char **functionname_ptr ATTRIBUTE_UNUSED; + unsigned int *line_ptr ATTRIBUTE_UNUSED; +{ + return FALSE; + +} + +static int +oasys_generic_stat_arch_elt (abfd, buf) + bfd *abfd; + struct stat *buf; +{ + oasys_module_info_type *mod = (oasys_module_info_type *) abfd->arelt_data; + if (mod == (oasys_module_info_type *) NULL) + { + bfd_set_error (bfd_error_invalid_operation); + return -1; + } + else + { + buf->st_size = mod->size; + buf->st_mode = 0666; + return 0; + } +} + +static int +oasys_sizeof_headers (abfd, exec) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_boolean exec ATTRIBUTE_UNUSED; +{ + return 0; +} + +#define oasys_close_and_cleanup _bfd_generic_close_and_cleanup +#define oasys_bfd_free_cached_info _bfd_generic_bfd_free_cached_info + +#define oasys_slurp_armap bfd_true +#define oasys_slurp_extended_name_table bfd_true +#define oasys_construct_extended_name_table \ + ((bfd_boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \ + bfd_true) +#define oasys_truncate_arname bfd_dont_truncate_arname +#define oasys_write_armap \ + ((bfd_boolean (*) \ + PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \ + bfd_true) +#define oasys_read_ar_hdr bfd_nullvoidptr +#define oasys_get_elt_at_index _bfd_generic_get_elt_at_index +#define oasys_update_armap_timestamp bfd_true + +#define oasys_bfd_is_local_label_name bfd_generic_is_local_label_name +#define oasys_get_lineno _bfd_nosymbols_get_lineno +#define oasys_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define oasys_read_minisymbols _bfd_generic_read_minisymbols +#define oasys_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol + +#define oasys_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup + +#define oasys_set_arch_mach bfd_default_set_arch_mach + +#define oasys_get_section_contents_in_window \ + _bfd_generic_get_section_contents_in_window + +#define oasys_bfd_get_relocated_section_contents \ + bfd_generic_get_relocated_section_contents +#define oasys_bfd_relax_section bfd_generic_relax_section +#define oasys_bfd_gc_sections bfd_generic_gc_sections +#define oasys_bfd_merge_sections bfd_generic_merge_sections +#define oasys_bfd_discard_group bfd_generic_discard_group +#define oasys_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define oasys_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define oasys_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define oasys_bfd_link_just_syms _bfd_generic_link_just_syms +#define oasys_bfd_final_link _bfd_generic_final_link +#define oasys_bfd_link_split_section _bfd_generic_link_split_section + +/*SUPPRESS 460 */ +const bfd_target oasys_vec = +{ + "oasys", /* name */ + bfd_target_oasys_flavour, + BFD_ENDIAN_BIG, /* target byte order */ + BFD_ENDIAN_BIG, /* target headers byte order */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), + (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS + | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + 0, /* leading underscore */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + + {_bfd_dummy_target, + oasys_object_p, /* bfd_check_format */ + oasys_archive_p, + _bfd_dummy_target, + }, + { /* bfd_set_format */ + bfd_false, + oasys_mkobject, + _bfd_generic_mkarchive, + bfd_false + }, + { /* bfd_write_contents */ + bfd_false, + oasys_write_object_contents, + _bfd_write_archive_contents, + bfd_false, + }, + + BFD_JUMP_TABLE_GENERIC (oasys), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (oasys), + BFD_JUMP_TABLE_SYMBOLS (oasys), + BFD_JUMP_TABLE_RELOCS (oasys), + BFD_JUMP_TABLE_WRITE (oasys), + BFD_JUMP_TABLE_LINK (oasys), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + (PTR) 0 +}; diff --git a/bfd/pc532-mach.c b/bfd/pc532-mach.c new file mode 100644 index 0000000000000..f96956a608feb --- /dev/null +++ b/bfd/pc532-mach.c @@ -0,0 +1,114 @@ +/* BFD back-end for Mach3/532 a.out-ish binaries. + Copyright 1990, 1991, 1992, 1994, 1995, 2000, 2001, 2002 + Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* Written by Ian Dall + * 19-Apr-94 + * + * Formerly part of aout-pc532-mach.c. Split out to allow more + * flexibility with multiple formats. + * + */ +/* This architecture has N_TXTOFF and N_TXTADDR defined as if + * N_HEADER_IN_TEXT, but the a_text entry (text size) does not include the + * space for the header. So we have N_HEADER_IN_TEXT defined to + * 1 and specially define our own N_TXTSIZE + */ + +#define N_HEADER_IN_TEXT(x) 1 +#define N_TXTSIZE(x) ((x).a_text) + +#define TEXT_START_ADDR 0x10000 /* from old ld */ +#define TARGET_PAGE_SIZE 0x1000 /* from old ld, 032 & 532 are really 512/4k */ + +/* Use a_entry of 0 to distinguish object files from OMAGIC executables */ +#define N_TXTADDR(x) \ + (N_MAGIC(x) == OMAGIC ? \ + ((x).a_entry < TEXT_START_ADDR? 0: TEXT_START_ADDR): \ + (N_MAGIC(x) == NMAGIC? TEXT_START_ADDR: \ + TEXT_START_ADDR + EXEC_BYTES_SIZE)) + +#define SEGMENT_SIZE TARGET_PAGE_SIZE + +#define N_SHARED_LIB(x) 0 +#define SEGMENT_SIZE TARGET_PAGE_SIZE +#define DEFAULT_ARCH bfd_arch_ns32k + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (pc532machaout_,OP) + +/* Must be the same as aout-ns32k.c */ +#define NAME(x,y) CONCAT3 (ns32kaout,_32_,y) + +#define TARGETNAME "a.out-pc532-mach" + +#include "bfd.h" +#include "sysdep.h" +#include "libaout.h" +#include "libbfd.h" +#include "aout/aout64.h" + +#define MY_bfd_reloc_type_lookup ns32kaout_bfd_reloc_type_lookup + +/* libaout doesn't use NAME for these ... */ + +#define MY_get_section_contents aout_32_get_section_contents + +#define MY_text_includes_header 1 + +#define MY_exec_header_not_counted 1 + +reloc_howto_type *ns32kaout_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); + +static bfd_boolean MY(write_object_contents) + PARAMS ((bfd *abfd)); + +static bfd_boolean +MY(write_object_contents) (abfd) + bfd *abfd; +{ + struct external_exec exec_bytes; + struct internal_exec *execp = exec_hdr (abfd); + + obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; + + BFD_ASSERT (bfd_get_arch (abfd) == bfd_arch_ns32k); + switch (bfd_get_mach (abfd)) + { + case 32032: + N_SET_MACHTYPE (*execp, M_NS32032); + break; + case 32532: + default: + N_SET_MACHTYPE (*execp, M_NS32532); + break; + } + N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags); + + WRITE_HEADERS(abfd, execp); + + return TRUE; +} + +#define MY_write_object_contents MY(write_object_contents) + +#include "aout-target.h" diff --git a/bfd/pdp11.c b/bfd/pdp11.c new file mode 100644 index 0000000000000..95d2ccd30bedc --- /dev/null +++ b/bfd/pdp11.c @@ -0,0 +1,5041 @@ +/* BFD back-end for PDP-11 a.out binaries. + Copyright 2001, 2002, 2003 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +/* BFD backend for PDP-11, running 2.11BSD in particular. + + This file was hacked up by looking hard at the existing vaxnetbsd + back end and the header files in 2.11BSD. + + TODO + * support for V7 file formats + * support for overlay object files (see 2.11 a.out(5)) + * support for old and very old archives + (see 2.11 ar(5), historical section) + + Search for TODO to find other areas needing more work. */ + +#define BYTES_IN_WORD 2 +#define BYTES_IN_LONG 4 +#define ARCH_SIZE 16 +#undef TARGET_IS_BIG_ENDIAN_P + +#define TARGET_PAGE_SIZE 1024 +#define SEGMENT__SIZE TARGET_PAGE_SIZE + +#define DEFAULT_ARCH bfd_arch_pdp11 +#define DEFAULT_MID M_PDP11 + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (pdp11_aout_,OP) + +/* This needs to start with a.out so GDB knows it is an a.out variant. */ +#define TARGETNAME "a.out-pdp11" + +/* This is the normal load address for executables. */ +#define TEXT_START_ADDR 0 + +/* The header is not included in the text segment. */ +#define N_HEADER_IN_TEXT(x) 0 + +/* There are no shared libraries. */ +#define N_SHARED_LIB(x) 0 + +/* There is no flags field. */ +#define N_FLAGS(exec) 0 + +#define N_SET_FLAGS(exec, flags) do { } while (0) +#define N_BADMAG(x) (((x).a_info != OMAGIC) && \ + ((x).a_info != NMAGIC) && \ + ((x).a_info != A_MAGIC3) && \ + ((x).a_info != A_MAGIC4) && \ + ((x).a_info != A_MAGIC5) && \ + ((x).a_info != A_MAGIC6)) + +#include "bfd.h" + +#define external_exec pdp11_external_exec +struct pdp11_external_exec + { + bfd_byte e_info[2]; /* magic number */ + bfd_byte e_text[2]; /* length of text section in bytes */ + bfd_byte e_data[2]; /* length of data section in bytes */ + bfd_byte e_bss[2]; /* length of bss area in bytes */ + bfd_byte e_syms[2]; /* length of symbol table in bytes */ + bfd_byte e_entry[2]; /* start address */ + bfd_byte e_unused[2]; /* not used */ + bfd_byte e_flag[2]; /* relocation info stripped */ + bfd_byte e_relocatable; /* ugly hack */ + }; + +#define EXEC_BYTES_SIZE (8 * 2) + +#define A_MAGIC1 OMAGIC +#define OMAGIC 0407 /* ...object file or impure executable. */ +#define A_MAGIC2 NMAGIC +#define NMAGIC 0410 /* pure executable. */ +#define ZMAGIC 0413 /* demand-paged executable. */ +#define A_MAGIC3 0411 /* separated I&D */ +#define A_MAGIC4 0405 /* overlay */ +#define A_MAGIC5 0430 /* auto-overlay (nonseparate) */ +#define A_MAGIC6 0431 /* auto-overlay (separate) */ +#define QMAGIC 0 +#define BMAGIC 0 + +#define A_FLAG_RELOC_STRIPPED 0x0001 + +#define external_nlist pdp11_external_nlist +struct pdp11_external_nlist + { + bfd_byte e_unused[2]; /* unused */ + bfd_byte e_strx[2]; /* index into string table of name */ + bfd_byte e_type[1]; /* type of symbol */ + bfd_byte e_ovly[1]; /* overlay number */ + bfd_byte e_value[2]; /* value of symbol */ + }; + +#define EXTERNAL_NLIST_SIZE 8 + +#define N_TXTOFF(x) (EXEC_BYTES_SIZE) +#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text) +#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data) +#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize) +#define N_SYMOFF(x) (N_DRELOFF(x) + (x).a_drsize) +#define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms) + +#define WRITE_HEADERS(abfd, execp) pdp11_aout_write_headers (abfd, execp) + +#include "sysdep.h" +#include "libbfd.h" +#include "libaout.h" + +#define SWAP_MAGIC(ext) bfd_getl16 (ext) + +#define MY_entry_is_text_address 1 + +#define MY_write_object_contents MY(write_object_contents) +static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd)); +#define MY_text_includes_header 1 + +static bfd_vma bfd_getp32 (const void *); +static bfd_signed_vma bfd_getp_signed_32 (const void *); +static void bfd_putp32 (bfd_vma, void *); + +#define MY_BFD_TARGET + +#include "aout-target.h" + +const bfd_target MY(vec) = +{ + TARGETNAME, /* name */ + bfd_target_aout_flavour, + BFD_ENDIAN_LITTLE, /* target byte order (little) */ + BFD_ENDIAN_LITTLE, /* target headers byte order (little) */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT), + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), + MY_symbol_leading_char, + AR_PAD_CHAR, /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getp32, bfd_getp_signed_32, bfd_putp32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getp32, bfd_getp_signed_32, bfd_putp32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ + {_bfd_dummy_target, MY_object_p, /* bfd_check_format */ + bfd_generic_archive_p, MY_core_file_p}, + {bfd_false, MY_mkobject, /* bfd_set_format */ + _bfd_generic_mkarchive, bfd_false}, + {bfd_false, MY_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (MY), + BFD_JUMP_TABLE_COPY (MY), + BFD_JUMP_TABLE_CORE (MY), + BFD_JUMP_TABLE_ARCHIVE (MY), + BFD_JUMP_TABLE_SYMBOLS (MY), + BFD_JUMP_TABLE_RELOCS (MY), + BFD_JUMP_TABLE_WRITE (MY), + BFD_JUMP_TABLE_LINK (MY), + BFD_JUMP_TABLE_DYNAMIC (MY), + + /* Alternative_target */ + NULL, + + (PTR) MY_backend_data, +}; + +/* start of modified aoutx.h */ +/* BFD semi-generic back-end for a.out binaries. + Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998 + Free Software Foundation, Inc. + Written by Cygnus Support. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* +SECTION + a.out backends + + +DESCRIPTION + + BFD supports a number of different flavours of a.out format, + though the major differences are only the sizes of the + structures on disk, and the shape of the relocation + information. + + The support is split into a basic support file @file{aoutx.h} + and other files which derive functions from the base. One + derivation file is @file{aoutf1.h} (for a.out flavour 1), and + adds to the basic a.out functions support for sun3, sun4, 386 + and 29k a.out files, to create a target jump vector for a + specific target. + + This information is further split out into more specific files + for each machine, including @file{sunos.c} for sun3 and sun4, + @file{newsos3.c} for the Sony NEWS, and @file{demo64.c} for a + demonstration of a 64 bit a.out format. + + The base file @file{aoutx.h} defines general mechanisms for + reading and writing records to and from disk and various + other methods which BFD requires. It is included by + @file{aout32.c} and @file{aout64.c} to form the names + <>, <>, etc. + + As an example, this is what goes on to make the back end for a + sun4, from @file{aout32.c}: + +| #define ARCH_SIZE 32 +| #include "aoutx.h" + + Which exports names: + +| ... +| aout_32_canonicalize_reloc +| aout_32_find_nearest_line +| aout_32_get_lineno +| aout_32_get_reloc_upper_bound +| ... + + from @file{sunos.c}: + +| #define TARGET_NAME "a.out-sunos-big" +| #define VECNAME sunos_big_vec +| #include "aoutf1.h" + + requires all the names from @file{aout32.c}, and produces the jump vector + +| sunos_big_vec + + The file @file{host-aout.c} is a special case. It is for a large set + of hosts that use ``more or less standard'' a.out files, and + for which cross-debugging is not interesting. It uses the + standard 32-bit a.out support routines, but determines the + file offsets and addresses of the text, data, and BSS + sections, the machine architecture and machine type, and the + entry point address, in a host-dependent manner. Once these + values have been determined, generic code is used to handle + the object file. + + When porting it to run on a new system, you must supply: + +| HOST_PAGE_SIZE +| HOST_SEGMENT_SIZE +| HOST_MACHINE_ARCH (optional) +| HOST_MACHINE_MACHINE (optional) +| HOST_TEXT_START_ADDR +| HOST_STACK_END_ADDR + + in the file @file{../include/sys/h-@var{XXX}.h} (for your host). These + values, plus the structures and macros defined in @file{a.out.h} on + your host system, will produce a BFD target that will access + ordinary a.out files on your host. To configure a new machine + to use @file{host-aout.c}, specify: + +| TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec +| TDEPFILES= host-aout.o trad-core.o + + in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in} + to use the + @file{@var{XXX}.mt} file (by setting "<>") when your + configuration is selected. + +*/ + +/* Some assumptions: + * Any BFD with D_PAGED set is ZMAGIC, and vice versa. + Doesn't matter what the setting of WP_TEXT is on output, but it'll + get set on input. + * Any BFD with D_PAGED clear and WP_TEXT set is NMAGIC. + * Any BFD with both flags clear is OMAGIC. + (Just want to make these explicit, so the conditions tested in this + file make sense if you're more familiar with a.out than with BFD.) */ + +#define KEEPIT udata.i + +#include /* For strchr and friends */ +#include "bfd.h" +#include "sysdep.h" +#include "safe-ctype.h" +#include "bfdlink.h" + +#include "libaout.h" +/*#include "libbfd.h"*/ +#include "aout/aout64.h" +#include "aout/stab_gnu.h" +#include "aout/ar.h" + +#undef N_TYPE +#undef N_UNDF +#undef N_ABS +#undef N_TEXT +#undef N_DATA +#undef N_BSS +#undef N_REG +#undef N_FN +#undef N_EXT +#define N_TYPE 0x1f /* type mask */ +#define N_UNDF 0x00 /* undefined */ +#define N_ABS 0x01 /* absolute */ +#define N_TEXT 0x02 /* text segment */ +#define N_DATA 0x03 /* data segment */ +#define N_BSS 0x04 /* bss segment */ +#define N_REG 0x14 /* register symbol */ +#define N_FN 0x1f /* file name */ + +#define N_EXT 0x20 /* external flag */ + +#define RELOC_SIZE 2 + +struct pdp11_aout_reloc_external +{ + bfd_byte e_reloc_entry[2]; +}; + +#define RELFLG 0x0001 /* pc-relative flag */ +#define RTYPE 0x000e /* type mask */ +#define RIDXMASK 0xfff0 /* index mask */ + +#define RABS 0x00 /* absolute */ +#define RTEXT 0x02 /* text */ +#define RDATA 0x04 /* data */ +#define RBSS 0x06 /* bss */ +#define REXT 0x08 /* external */ + +#define RINDEX(x) (((x) & 0xfff0) >> 4) + +static bfd_boolean aout_get_external_symbols PARAMS ((bfd *)); +static bfd_boolean translate_from_native_sym_flags + PARAMS ((bfd *, aout_symbol_type *)); +static bfd_boolean translate_to_native_sym_flags + PARAMS ((bfd *, asymbol *, struct external_nlist *)); +static void adjust_o_magic PARAMS ((bfd *, struct internal_exec *)); +static void adjust_z_magic PARAMS ((bfd *, struct internal_exec *)); +static void adjust_n_magic PARAMS ((bfd *, struct internal_exec *)); + +static int pdp11_aout_write_headers PARAMS ((bfd *, struct internal_exec *)); +void pdp11_aout_swap_reloc_out PARAMS ((bfd *, arelent *, struct pdp11_aout_reloc_external *)); +void pdp11_aout_swap_reloc_in +PARAMS ((bfd *, struct pdp11_aout_reloc_external *, arelent *, + bfd_size_type, asymbol **, bfd_size_type)); + +/* +SUBSECTION + Relocations + +DESCRIPTION + The file @file{aoutx.h} provides for both the @emph{standard} + and @emph{extended} forms of a.out relocation records. + + The standard records contain only an + address, a symbol index, and a type field. The extended records + (used on 29ks and sparcs) also have a full integer for an + addend. + +*/ + +#ifndef MY_final_link_relocate +#define MY_final_link_relocate _bfd_final_link_relocate +#endif + +#ifndef MY_relocate_contents +#define MY_relocate_contents _bfd_relocate_contents +#endif + +reloc_howto_type howto_table_pdp11[] = +{ + /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */ +HOWTO( 0, 0, 1, 16, FALSE, 0, complain_overflow_signed,0,"16", TRUE, 0x0000ffff,0x0000ffff, FALSE), +HOWTO( 1, 0, 1, 16, TRUE, 0, complain_overflow_signed,0,"DISP16", TRUE, 0x0000ffff,0x0000ffff, FALSE), +}; + +#define TABLE_SIZE(TABLE) (sizeof(TABLE)/sizeof(TABLE[0])) + +reloc_howto_type * +NAME(aout,reloc_type_lookup) (abfd,code) + bfd * abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + switch (code) + { + case BFD_RELOC_16: + return &howto_table_pdp11[0]; + case BFD_RELOC_16_PCREL: + return &howto_table_pdp11[1]; + default: + return (reloc_howto_type *)NULL; + } +} + +static int +pdp11_aout_write_headers (abfd, execp) + bfd *abfd; + struct internal_exec *execp; +{ + struct external_exec exec_bytes; + bfd_size_type text_size; + file_ptr text_end; + + if (adata(abfd).magic == undecided_magic) + NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); + + execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; + execp->a_entry = bfd_get_start_address (abfd); + + if (obj_textsec (abfd)->reloc_count > 0 || + obj_datasec (abfd)->reloc_count > 0) + { + execp->a_trsize = execp->a_text; + execp->a_drsize = execp->a_data; + } + else + { + execp->a_trsize = 0; + execp->a_drsize = 0; + } + + NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); + + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + return FALSE; + + if (bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd) + != EXEC_BYTES_SIZE) + return FALSE; + + /* Now write out reloc info, followed by syms and strings */ + + if (bfd_get_outsymbols (abfd) != (asymbol **) NULL + && bfd_get_symcount (abfd) != 0) + { + if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0) + return FALSE; + + if (! NAME(aout,write_syms) (abfd)) + return FALSE; + } + + if (obj_textsec (abfd)->reloc_count > 0 || + obj_datasec (abfd)->reloc_count > 0) + { + if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) + return FALSE; + if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) + return FALSE; + + if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) + return FALSE; + if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) + return FALSE; + } + + return TRUE; +} + +/* Write an object file. + Section contents have already been written. We write the + file header, symbols, and relocation. */ + +static bfd_boolean +MY(write_object_contents) (abfd) + bfd *abfd; +{ + struct internal_exec *execp = exec_hdr (abfd); + + /* We must make certain that the magic number has been set. This + will normally have been done by set_section_contents, but only if + there actually are some section contents. */ + if (! abfd->output_has_begun) + { + bfd_size_type text_size; + file_ptr text_end; + + NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); + } + + obj_reloc_entry_size (abfd) = RELOC_SIZE; + + return WRITE_HEADERS(abfd, execp); +} + +/* +SUBSECTION + Internal entry points + +DESCRIPTION + @file{aoutx.h} exports several routines for accessing the + contents of an a.out file, which are gathered and exported in + turn by various format specific files (eg sunos.c). + +*/ + +/* +FUNCTION + aout_@var{size}_swap_exec_header_in + +SYNOPSIS + void aout_@var{size}_swap_exec_header_in, + (bfd *abfd, + struct external_exec *raw_bytes, + struct internal_exec *execp); + +DESCRIPTION + Swap the information in an executable header @var{raw_bytes} taken + from a raw byte stream memory image into the internal exec header + structure @var{execp}. +*/ + +#ifndef NAME_swap_exec_header_in +void +NAME(aout,swap_exec_header_in) (abfd, raw_bytes, execp) + bfd *abfd; + struct external_exec *raw_bytes; + struct internal_exec *execp; +{ + struct external_exec *bytes = (struct external_exec *)raw_bytes; + + /* The internal_exec structure has some fields that are unused in this + configuration (IE for i960), so ensure that all such uninitialized + fields are zero'd out. There are places where two of these structs + are memcmp'd, and thus the contents do matter. */ + memset ((PTR) execp, 0, sizeof (struct internal_exec)); + /* Now fill in fields in the execp, from the bytes in the raw data. */ + execp->a_info = GET_MAGIC (abfd, bytes->e_info); + execp->a_text = GET_WORD (abfd, bytes->e_text); + execp->a_data = GET_WORD (abfd, bytes->e_data); + execp->a_bss = GET_WORD (abfd, bytes->e_bss); + execp->a_syms = GET_WORD (abfd, bytes->e_syms); + execp->a_entry = GET_WORD (abfd, bytes->e_entry); + + if (GET_WORD (abfd, bytes->e_flag) & A_FLAG_RELOC_STRIPPED) + { + execp->a_trsize = 0; + execp->a_drsize = 0; + } + else + { + execp->a_trsize = execp->a_text; + execp->a_drsize = execp->a_data; + } +} +#define NAME_swap_exec_header_in NAME(aout,swap_exec_header_in) +#endif + +/* +FUNCTION + aout_@var{size}_swap_exec_header_out + +SYNOPSIS + void aout_@var{size}_swap_exec_header_out + (bfd *abfd, + struct internal_exec *execp, + struct external_exec *raw_bytes); + +DESCRIPTION + Swap the information in an internal exec header structure + @var{execp} into the buffer @var{raw_bytes} ready for writing to disk. +*/ +void +NAME(aout,swap_exec_header_out) (abfd, execp, raw_bytes) + bfd *abfd; + struct internal_exec *execp; + struct external_exec *raw_bytes; +{ + struct external_exec *bytes = (struct external_exec *)raw_bytes; + + /* Now fill in fields in the raw data, from the fields in the exec struct. */ + PUT_MAGIC (abfd, execp->a_info, bytes->e_info); + PUT_WORD (abfd, execp->a_text, bytes->e_text); + PUT_WORD (abfd, execp->a_data, bytes->e_data); + PUT_WORD (abfd, execp->a_bss, bytes->e_bss); + PUT_WORD (abfd, execp->a_syms, bytes->e_syms); + PUT_WORD (abfd, execp->a_entry, bytes->e_entry); + PUT_WORD (abfd, 0, bytes->e_unused); + + if ((execp->a_trsize == 0 || execp->a_text == 0) && + (execp->a_drsize == 0 || execp->a_data == 0)) + PUT_WORD (abfd, A_FLAG_RELOC_STRIPPED, bytes->e_flag); + else if (execp->a_trsize == execp->a_text && + execp->a_drsize == execp->a_data) + PUT_WORD (abfd, 0, bytes->e_flag); + else + { + /* TODO: print a proper warning message */ + fprintf (stderr, "BFD:%s:%d: internal error\n", __FILE__, __LINE__); + PUT_WORD (abfd, 0, bytes->e_flag); + } +} + +/* Make all the section for an a.out file. */ + +bfd_boolean +NAME(aout,make_sections) (abfd) + bfd *abfd; +{ + if (obj_textsec (abfd) == (asection *) NULL + && bfd_make_section (abfd, ".text") == (asection *) NULL) + return FALSE; + if (obj_datasec (abfd) == (asection *) NULL + && bfd_make_section (abfd, ".data") == (asection *) NULL) + return FALSE; + if (obj_bsssec (abfd) == (asection *) NULL + && bfd_make_section (abfd, ".bss") == (asection *) NULL) + return FALSE; + return TRUE; +} + +/* +FUNCTION + aout_@var{size}_some_aout_object_p + +SYNOPSIS + const bfd_target *aout_@var{size}_some_aout_object_p + (bfd *abfd, + const bfd_target *(*callback_to_real_object_p)()); + +DESCRIPTION + Some a.out variant thinks that the file open in @var{abfd} + checking is an a.out file. Do some more checking, and set up + for access if it really is. Call back to the calling + environment's "finish up" function just before returning, to + handle any last-minute setup. +*/ + +const bfd_target * +NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p) + bfd *abfd; + struct internal_exec *execp; + const bfd_target *(*callback_to_real_object_p) PARAMS ((bfd *)); +{ + struct aout_data_struct *rawptr, *oldrawptr; + const bfd_target *result; + bfd_size_type amt = sizeof (struct aout_data_struct); + + rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); + if (rawptr == NULL) + return 0; + + oldrawptr = abfd->tdata.aout_data; + abfd->tdata.aout_data = rawptr; + + /* Copy the contents of the old tdata struct. + In particular, we want the subformat, since for hpux it was set in + hp300hpux.c:swap_exec_header_in and will be used in + hp300hpux.c:callback. */ + if (oldrawptr != NULL) + *abfd->tdata.aout_data = *oldrawptr; + + abfd->tdata.aout_data->a.hdr = &rawptr->e; + *(abfd->tdata.aout_data->a.hdr) = *execp; /* Copy in the internal_exec struct */ + execp = abfd->tdata.aout_data->a.hdr; + + /* Set the file flags */ + abfd->flags = BFD_NO_FLAGS; + if (execp->a_drsize || execp->a_trsize) + abfd->flags |= HAS_RELOC; + /* Setting of EXEC_P has been deferred to the bottom of this function */ + if (execp->a_syms) + abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; + if (N_DYNAMIC(*execp)) + abfd->flags |= DYNAMIC; + + if (N_MAGIC (*execp) == ZMAGIC) + { + abfd->flags |= D_PAGED | WP_TEXT; + adata (abfd).magic = z_magic; + } + else if (N_MAGIC (*execp) == QMAGIC) + { + abfd->flags |= D_PAGED | WP_TEXT; + adata (abfd).magic = z_magic; + adata (abfd).subformat = q_magic_format; + } + else if (N_MAGIC (*execp) == NMAGIC) + { + abfd->flags |= WP_TEXT; + adata (abfd).magic = n_magic; + } + else if (N_MAGIC (*execp) == OMAGIC + || N_MAGIC (*execp) == BMAGIC) + adata (abfd).magic = o_magic; + else + { + /* Should have been checked with N_BADMAG before this routine + was called. */ + abort (); + } + + bfd_get_start_address (abfd) = execp->a_entry; + + obj_aout_symbols (abfd) = (aout_symbol_type *)NULL; + bfd_get_symcount (abfd) = execp->a_syms / sizeof (struct external_nlist); + + /* The default relocation entry size is that of traditional V7 Unix. */ + obj_reloc_entry_size (abfd) = RELOC_SIZE; + + /* The default symbol entry size is that of traditional Unix. */ + obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE; + +#ifdef USE_MMAP + bfd_init_window (&obj_aout_sym_window (abfd)); + bfd_init_window (&obj_aout_string_window (abfd)); +#endif + obj_aout_external_syms (abfd) = NULL; + obj_aout_external_strings (abfd) = NULL; + obj_aout_sym_hashes (abfd) = NULL; + + if (! NAME(aout,make_sections) (abfd)) + return NULL; + + obj_datasec (abfd)->_raw_size = execp->a_data; + obj_bsssec (abfd)->_raw_size = execp->a_bss; + + obj_textsec (abfd)->flags = + (execp->a_trsize != 0 + ? (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_RELOC) + : (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)); + obj_datasec (abfd)->flags = + (execp->a_drsize != 0 + ? (SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS | SEC_RELOC) + : (SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS)); + obj_bsssec (abfd)->flags = SEC_ALLOC; + +#ifdef THIS_IS_ONLY_DOCUMENTATION + /* The common code can't fill in these things because they depend + on either the start address of the text segment, the rounding + up of virtual addresses between segments, or the starting file + position of the text segment -- all of which varies among different + versions of a.out. */ + + /* Call back to the format-dependent code to fill in the rest of the + fields and do any further cleanup. Things that should be filled + in by the callback: */ + + struct exec *execp = exec_hdr (abfd); + + obj_textsec (abfd)->size = N_TXTSIZE(*execp); + obj_textsec (abfd)->raw_size = N_TXTSIZE(*execp); + /* data and bss are already filled in since they're so standard */ + + /* The virtual memory addresses of the sections */ + obj_textsec (abfd)->vma = N_TXTADDR(*execp); + obj_datasec (abfd)->vma = N_DATADDR(*execp); + obj_bsssec (abfd)->vma = N_BSSADDR(*execp); + + /* The file offsets of the sections */ + obj_textsec (abfd)->filepos = N_TXTOFF(*execp); + obj_datasec (abfd)->filepos = N_DATOFF(*execp); + + /* The file offsets of the relocation info */ + obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp); + obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp); + + /* The file offsets of the string table and symbol table. */ + obj_str_filepos (abfd) = N_STROFF (*execp); + obj_sym_filepos (abfd) = N_SYMOFF (*execp); + + /* Determine the architecture and machine type of the object file. */ + abfd->obj_arch = bfd_arch_obscure; + + adata(abfd)->page_size = TARGET_PAGE_SIZE; + adata(abfd)->segment_size = SEGMENT_SIZE; + adata(abfd)->exec_bytes_size = EXEC_BYTES_SIZE; + + return abfd->xvec; + + /* The architecture is encoded in various ways in various a.out variants, + or is not encoded at all in some of them. The relocation size depends + on the architecture and the a.out variant. Finally, the return value + is the bfd_target vector in use. If an error occurs, return zero and + set bfd_error to the appropriate error code. + + Formats such as b.out, which have additional fields in the a.out + header, should cope with them in this callback as well. */ +#endif /* DOCUMENTATION */ + + result = (*callback_to_real_object_p)(abfd); + + /* Now that the segment addresses have been worked out, take a better + guess at whether the file is executable. If the entry point + is within the text segment, assume it is. (This makes files + executable even if their entry point address is 0, as long as + their text starts at zero.). + + This test had to be changed to deal with systems where the text segment + runs at a different location than the default. The problem is that the + entry address can appear to be outside the text segment, thus causing an + erroneous conclusion that the file isn't executable. + + To fix this, we now accept any non-zero entry point as an indication of + executability. This will work most of the time, since only the linker + sets the entry point, and that is likely to be non-zero for most systems. */ + + if (execp->a_entry != 0 + || (execp->a_entry >= obj_textsec(abfd)->vma + && execp->a_entry < obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size)) + abfd->flags |= EXEC_P; +#ifdef STAT_FOR_EXEC + else + { + struct stat stat_buf; + + /* The original heuristic doesn't work in some important cases. + The a.out file has no information about the text start + address. For files (like kernels) linked to non-standard + addresses (ld -Ttext nnn) the entry point may not be between + the default text start (obj_textsec(abfd)->vma) and + (obj_textsec(abfd)->vma) + text size. This is not just a mach + issue. Many kernels are loaded at non standard addresses. */ + if (abfd->iostream != NULL + && (abfd->flags & BFD_IN_MEMORY) == 0 + && (fstat(fileno((FILE *) (abfd->iostream)), &stat_buf) == 0) + && ((stat_buf.st_mode & 0111) != 0)) + abfd->flags |= EXEC_P; + } +#endif /* STAT_FOR_EXEC */ + + if (result) + { +#if 0 /* These should be set correctly anyways. */ + abfd->sections = obj_textsec (abfd); + obj_textsec (abfd)->next = obj_datasec (abfd); + obj_datasec (abfd)->next = obj_bsssec (abfd); +#endif + } + else + { + free (rawptr); + abfd->tdata.aout_data = oldrawptr; + } + return result; +} + +/* +FUNCTION + aout_@var{size}_mkobject + +SYNOPSIS + bfd_boolean aout_@var{size}_mkobject, (bfd *abfd); + +DESCRIPTION + Initialize BFD @var{abfd} for use with a.out files. +*/ + +bfd_boolean +NAME(aout,mkobject) (abfd) + bfd *abfd; +{ + struct aout_data_struct *rawptr; + bfd_size_type amt = sizeof (struct aout_data_struct); + + bfd_set_error (bfd_error_system_call); + + /* Use an intermediate variable for clarity */ + rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); + + if (rawptr == NULL) + return FALSE; + + abfd->tdata.aout_data = rawptr; + exec_hdr (abfd) = &(rawptr->e); + + obj_textsec (abfd) = (asection *)NULL; + obj_datasec (abfd) = (asection *)NULL; + obj_bsssec (abfd) = (asection *)NULL; + + return TRUE; +} + + +/* +FUNCTION + aout_@var{size}_machine_type + +SYNOPSIS + enum machine_type aout_@var{size}_machine_type + (enum bfd_architecture arch, + unsigned long machine)); + +DESCRIPTION + Keep track of machine architecture and machine type for + a.out's. Return the <> for a particular + architecture and machine, or <> if that exact architecture + and machine can't be represented in a.out format. + + If the architecture is understood, machine type 0 (default) + is always understood. +*/ + +enum machine_type +NAME(aout,machine_type) (arch, machine, unknown) + enum bfd_architecture arch; + unsigned long machine; + bfd_boolean *unknown; +{ + enum machine_type arch_flags; + + arch_flags = M_UNKNOWN; + *unknown = TRUE; + + switch (arch) + { + case bfd_arch_sparc: + if (machine == 0 + || machine == bfd_mach_sparc + || machine == bfd_mach_sparc_sparclite + || machine == bfd_mach_sparc_v9) + arch_flags = M_SPARC; + else if (machine == bfd_mach_sparc_sparclet) + arch_flags = M_SPARCLET; + break; + + case bfd_arch_m68k: + switch (machine) + { + case 0: arch_flags = M_68010; break; + case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = FALSE; break; + case bfd_mach_m68010: arch_flags = M_68010; break; + case bfd_mach_m68020: arch_flags = M_68020; break; + default: arch_flags = M_UNKNOWN; break; + } + break; + + case bfd_arch_i386: + if (machine == 0 + || machine == bfd_mach_i386_i386 + || machine == bfd_mach_i386_i386_intel_syntax) + arch_flags = M_386; + break; + + case bfd_arch_a29k: + if (machine == 0) arch_flags = M_29K; + break; + + case bfd_arch_arm: + if (machine == 0) arch_flags = M_ARM; + break; + + case bfd_arch_mips: + switch (machine) + { + case 0: + case 2000: + case bfd_mach_mips3000: + arch_flags = M_MIPS1; + break; + case bfd_mach_mips4000: /* mips3 */ + case bfd_mach_mips4400: + case bfd_mach_mips8000: /* mips4 */ + case bfd_mach_mips6000: /* real mips2: */ + arch_flags = M_MIPS2; + break; + default: + arch_flags = M_UNKNOWN; + break; + } + break; + + case bfd_arch_ns32k: + switch (machine) + { + case 0: arch_flags = M_NS32532; break; + case 32032: arch_flags = M_NS32032; break; + case 32532: arch_flags = M_NS32532; break; + default: arch_flags = M_UNKNOWN; break; + } + break; + + case bfd_arch_pdp11: + /* TODO: arch_flags = M_PDP11; */ + *unknown = FALSE; + break; + + case bfd_arch_vax: + *unknown = FALSE; + break; + + default: + arch_flags = M_UNKNOWN; + } + + if (arch_flags != M_UNKNOWN) + *unknown = FALSE; + + return arch_flags; +} + + +/* +FUNCTION + aout_@var{size}_set_arch_mach + +SYNOPSIS + bfd_boolean aout_@var{size}_set_arch_mach, + (bfd *, + enum bfd_architecture arch, + unsigned long machine)); + +DESCRIPTION + Set the architecture and the machine of the BFD @var{abfd} to the + values @var{arch} and @var{machine}. Verify that @var{abfd}'s format + can support the architecture required. +*/ + +bfd_boolean +NAME(aout,set_arch_mach) (abfd, arch, machine) + bfd *abfd; + enum bfd_architecture arch; + unsigned long machine; +{ + if (! bfd_default_set_arch_mach (abfd, arch, machine)) + return FALSE; + + if (arch != bfd_arch_unknown) + { + bfd_boolean unknown; + + NAME(aout,machine_type) (arch, machine, &unknown); + if (unknown) + return FALSE; + } + + obj_reloc_entry_size (abfd) = RELOC_SIZE; + + return (*aout_backend_info(abfd)->set_sizes) (abfd); +} + +static void +adjust_o_magic (abfd, execp) + bfd *abfd; + struct internal_exec *execp; +{ + file_ptr pos = adata (abfd).exec_bytes_size; + bfd_vma vma = 0; + int pad = 0; + + /* Text. */ + obj_textsec (abfd)->filepos = pos; + if (! obj_textsec (abfd)->user_set_vma) + obj_textsec (abfd)->vma = vma; + else + vma = obj_textsec (abfd)->vma; + + pos += obj_textsec (abfd)->_raw_size; + vma += obj_textsec (abfd)->_raw_size; + + /* Data. */ + if (!obj_datasec (abfd)->user_set_vma) + { +#if 0 /* ?? Does alignment in the file image really matter? */ + pad = align_power (vma, obj_datasec (abfd)->alignment_power) - vma; +#endif + obj_textsec (abfd)->_raw_size += pad; + pos += pad; + vma += pad; + obj_datasec (abfd)->vma = vma; + } + else + vma = obj_datasec (abfd)->vma; + obj_datasec (abfd)->filepos = pos; + pos += obj_datasec (abfd)->_raw_size; + vma += obj_datasec (abfd)->_raw_size; + + /* BSS. */ + if (! obj_bsssec (abfd)->user_set_vma) + { +#if 0 + pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma; +#endif + obj_datasec (abfd)->_raw_size += pad; + pos += pad; + vma += pad; + obj_bsssec (abfd)->vma = vma; + } + else + { + /* The VMA of the .bss section is set by the VMA of the + .data section plus the size of the .data section. We may + need to add padding bytes to make this true. */ + pad = obj_bsssec (abfd)->vma - vma; + if (pad > 0) + { + obj_datasec (abfd)->_raw_size += pad; + pos += pad; + } + } + obj_bsssec (abfd)->filepos = pos; + + /* Fix up the exec header. */ + execp->a_text = obj_textsec (abfd)->_raw_size; + execp->a_data = obj_datasec (abfd)->_raw_size; + execp->a_bss = obj_bsssec (abfd)->_raw_size; + N_SET_MAGIC (*execp, OMAGIC); +} + +static void +adjust_z_magic (abfd, execp) + bfd *abfd; + struct internal_exec *execp; +{ + bfd_size_type data_pad, text_pad; + file_ptr text_end; + const struct aout_backend_data *abdp; + int ztih; /* Nonzero if text includes exec header. */ + + abdp = aout_backend_info (abfd); + + /* Text. */ + ztih = (abdp != NULL + && (abdp->text_includes_header + || obj_aout_subformat (abfd) == q_magic_format)); + obj_textsec(abfd)->filepos = (ztih + ? adata(abfd).exec_bytes_size + : adata(abfd).zmagic_disk_block_size); + if (! obj_textsec(abfd)->user_set_vma) + { + /* ?? Do we really need to check for relocs here? */ + obj_textsec(abfd)->vma = ((abfd->flags & HAS_RELOC) + ? 0 + : (ztih + ? (abdp->default_text_vma + + adata (abfd).exec_bytes_size) + : abdp->default_text_vma)); + text_pad = 0; + } + else + { + /* The .text section is being loaded at an unusual address. We + may need to pad it such that the .data section starts at a page + boundary. */ + if (ztih) + text_pad = ((obj_textsec (abfd)->filepos - obj_textsec (abfd)->vma) + & (adata (abfd).page_size - 1)); + else + text_pad = ((- obj_textsec (abfd)->vma) + & (adata (abfd).page_size - 1)); + } + + /* Find start of data. */ + if (ztih) + { + text_end = obj_textsec (abfd)->filepos + obj_textsec (abfd)->_raw_size; + text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end; + } + else + { + /* Note that if page_size == zmagic_disk_block_size, then + filepos == page_size, and this case is the same as the ztih + case. */ + text_end = obj_textsec (abfd)->_raw_size; + text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end; + text_end += obj_textsec (abfd)->filepos; + } + + obj_textsec (abfd)->_raw_size += text_pad; + text_end += text_pad; + + /* Data. */ + if (!obj_datasec(abfd)->user_set_vma) + { + bfd_vma vma; + vma = obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size; + obj_datasec(abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size); + } + if (abdp && abdp->zmagic_mapped_contiguous) + { + text_pad = (obj_datasec(abfd)->vma + - obj_textsec(abfd)->vma + - obj_textsec(abfd)->_raw_size); + obj_textsec(abfd)->_raw_size += text_pad; + } + obj_datasec (abfd)->filepos = (obj_textsec (abfd)->filepos + + obj_textsec (abfd)->_raw_size); + + /* Fix up exec header while we're at it. */ + execp->a_text = obj_textsec(abfd)->_raw_size; + if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted))) + execp->a_text += adata(abfd).exec_bytes_size; + if (obj_aout_subformat (abfd) == q_magic_format) + N_SET_MAGIC (*execp, QMAGIC); + else + N_SET_MAGIC (*execp, ZMAGIC); + + /* Spec says data section should be rounded up to page boundary. */ + obj_datasec(abfd)->_raw_size + = align_power (obj_datasec(abfd)->_raw_size, + obj_bsssec(abfd)->alignment_power); + execp->a_data = BFD_ALIGN (obj_datasec(abfd)->_raw_size, + adata(abfd).page_size); + data_pad = execp->a_data - obj_datasec(abfd)->_raw_size; + + /* BSS. */ + if (!obj_bsssec(abfd)->user_set_vma) + obj_bsssec(abfd)->vma = (obj_datasec(abfd)->vma + + obj_datasec(abfd)->_raw_size); + /* If the BSS immediately follows the data section and extra space + in the page is left after the data section, fudge data + in the header so that the bss section looks smaller by that + amount. We'll start the bss section there, and lie to the OS. + (Note that a linker script, as well as the above assignment, + could have explicitly set the BSS vma to immediately follow + the data section.) */ + if (align_power (obj_bsssec(abfd)->vma, obj_bsssec(abfd)->alignment_power) + == obj_datasec(abfd)->vma + obj_datasec(abfd)->_raw_size) + execp->a_bss = (data_pad > obj_bsssec(abfd)->_raw_size) ? 0 : + obj_bsssec(abfd)->_raw_size - data_pad; + else + execp->a_bss = obj_bsssec(abfd)->_raw_size; +} + +static void +adjust_n_magic (abfd, execp) + bfd *abfd; + struct internal_exec *execp; +{ + file_ptr pos = adata(abfd).exec_bytes_size; + bfd_vma vma = 0; + int pad; + + /* Text. */ + obj_textsec(abfd)->filepos = pos; + if (!obj_textsec(abfd)->user_set_vma) + obj_textsec(abfd)->vma = vma; + else + vma = obj_textsec(abfd)->vma; + pos += obj_textsec(abfd)->_raw_size; + vma += obj_textsec(abfd)->_raw_size; + + /* Data. */ + obj_datasec(abfd)->filepos = pos; + if (!obj_datasec(abfd)->user_set_vma) + obj_datasec(abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size); + vma = obj_datasec(abfd)->vma; + + /* Since BSS follows data immediately, see if it needs alignment. */ + vma += obj_datasec(abfd)->_raw_size; + pad = align_power (vma, obj_bsssec(abfd)->alignment_power) - vma; + obj_datasec(abfd)->_raw_size += pad; + pos += obj_datasec(abfd)->_raw_size; + + /* BSS. */ + if (!obj_bsssec(abfd)->user_set_vma) + obj_bsssec(abfd)->vma = vma; + else + vma = obj_bsssec(abfd)->vma; + + /* Fix up exec header. */ + execp->a_text = obj_textsec(abfd)->_raw_size; + execp->a_data = obj_datasec(abfd)->_raw_size; + execp->a_bss = obj_bsssec(abfd)->_raw_size; + N_SET_MAGIC (*execp, NMAGIC); +} + +bfd_boolean +NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end) + bfd *abfd; + bfd_size_type *text_size; + file_ptr * text_end ATTRIBUTE_UNUSED; +{ + struct internal_exec *execp = exec_hdr (abfd); + + if (! NAME(aout,make_sections) (abfd)) + return FALSE; + + if (adata(abfd).magic != undecided_magic) + return TRUE; + + obj_textsec(abfd)->_raw_size = + align_power(obj_textsec(abfd)->_raw_size, + obj_textsec(abfd)->alignment_power); + + *text_size = obj_textsec (abfd)->_raw_size; + /* Rule (heuristic) for when to pad to a new page. Note that there + are (at least) two ways demand-paged (ZMAGIC) files have been + handled. Most Berkeley-based systems start the text segment at + (TARGET_PAGE_SIZE). However, newer versions of SUNOS start the text + segment right after the exec header; the latter is counted in the + text segment size, and is paged in by the kernel with the rest of + the text. */ + + /* This perhaps isn't the right way to do this, but made it simpler for me + to understand enough to implement it. Better would probably be to go + right from BFD flags to alignment/positioning characteristics. But the + old code was sloppy enough about handling the flags, and had enough + other magic, that it was a little hard for me to understand. I think + I understand it better now, but I haven't time to do the cleanup this + minute. */ + + if (abfd->flags & WP_TEXT) + adata(abfd).magic = n_magic; + else + adata(abfd).magic = o_magic; + +#ifdef BFD_AOUT_DEBUG /* requires gcc2 */ +#if __GNUC__ >= 2 + fprintf (stderr, "%s text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x,%x>\n", + ({ char *str; + switch (adata(abfd).magic) { + case n_magic: str = "NMAGIC"; break; + case o_magic: str = "OMAGIC"; break; + case z_magic: str = "ZMAGIC"; break; + default: abort (); + } + str; + }), + obj_textsec(abfd)->vma, obj_textsec(abfd)->_raw_size, + obj_textsec(abfd)->alignment_power, + obj_datasec(abfd)->vma, obj_datasec(abfd)->_raw_size, + obj_datasec(abfd)->alignment_power, + obj_bsssec(abfd)->vma, obj_bsssec(abfd)->_raw_size, + obj_bsssec(abfd)->alignment_power); +#endif +#endif + + switch (adata(abfd).magic) + { + case o_magic: + adjust_o_magic (abfd, execp); + break; + case z_magic: + adjust_z_magic (abfd, execp); + break; + case n_magic: + adjust_n_magic (abfd, execp); + break; + default: + abort (); + } + +#ifdef BFD_AOUT_DEBUG + fprintf (stderr, " text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x>\n", + obj_textsec(abfd)->vma, obj_textsec(abfd)->_raw_size, + obj_textsec(abfd)->filepos, + obj_datasec(abfd)->vma, obj_datasec(abfd)->_raw_size, + obj_datasec(abfd)->filepos, + obj_bsssec(abfd)->vma, obj_bsssec(abfd)->_raw_size); +#endif + + return TRUE; +} + +/* +FUNCTION + aout_@var{size}_new_section_hook + +SYNOPSIS + bfd_boolean aout_@var{size}_new_section_hook, + (bfd *abfd, + asection *newsect)); + +DESCRIPTION + Called by the BFD in response to a @code{bfd_make_section} + request. +*/ +bfd_boolean +NAME(aout,new_section_hook) (abfd, newsect) + bfd *abfd; + asection *newsect; +{ + /* align to double at least */ + newsect->alignment_power = bfd_get_arch_info(abfd)->section_align_power; + + + if (bfd_get_format (abfd) == bfd_object) + { + if (obj_textsec (abfd) == NULL + && ! strcmp (newsect->name, ".text")) + { + obj_textsec(abfd)= newsect; + newsect->target_index = N_TEXT; + return TRUE; + } + + if (obj_datasec (abfd) == NULL + && ! strcmp (newsect->name, ".data")) + { + obj_datasec (abfd) = newsect; + newsect->target_index = N_DATA; + return TRUE; + } + + if (obj_bsssec (abfd) == NULL + && !strcmp (newsect->name, ".bss")) + { + obj_bsssec (abfd) = newsect; + newsect->target_index = N_BSS; + return TRUE; + } + } + + /* We allow more than three sections internally */ + return TRUE; +} + +bfd_boolean +NAME(aout,set_section_contents) (abfd, section, location, offset, count) + bfd *abfd; + sec_ptr section; + const PTR location; + file_ptr offset; + bfd_size_type count; +{ + file_ptr text_end; + bfd_size_type text_size; + + if (! abfd->output_has_begun) + { + if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end)) + return FALSE; + } + + if (section == obj_bsssec (abfd)) + { + bfd_set_error (bfd_error_no_contents); + return FALSE; + } + + if (section != obj_textsec (abfd) + && section != obj_datasec (abfd)) + { + (*_bfd_error_handler) + ("%s: can not represent section `%s' in a.out object file format", + bfd_get_filename (abfd), bfd_get_section_name (abfd, section)); + bfd_set_error (bfd_error_nonrepresentable_section); + return FALSE; + } + + if (count != 0) + { + if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 + || bfd_bwrite (location, count, abfd) != count) + return FALSE; + } + + return TRUE; +} + +/* Read the external symbols from an a.out file. */ + +static bfd_boolean +aout_get_external_symbols (abfd) + bfd *abfd; +{ + if (obj_aout_external_syms (abfd) == (struct external_nlist *) NULL) + { + bfd_size_type count; + struct external_nlist *syms; + + count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE; + +#ifdef USE_MMAP + if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), + exec_hdr (abfd)->a_syms, + &obj_aout_sym_window (abfd), TRUE)) + return FALSE; + syms = (struct external_nlist *) obj_aout_sym_window (abfd).data; +#else + /* We allocate using malloc to make the values easy to free + later on. If we put them on the objalloc it might not be + possible to free them. */ + syms = (struct external_nlist *) bfd_malloc (count * EXTERNAL_NLIST_SIZE); + if (syms == (struct external_nlist *) NULL && count != 0) + return FALSE; + + if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 + || (bfd_bread (syms, exec_hdr (abfd)->a_syms, abfd) + != exec_hdr (abfd)->a_syms)) + { + free (syms); + return FALSE; + } +#endif + + obj_aout_external_syms (abfd) = syms; + obj_aout_external_sym_count (abfd) = count; + } + + if (obj_aout_external_strings (abfd) == NULL + && exec_hdr (abfd)->a_syms != 0) + { + unsigned char string_chars[BYTES_IN_LONG]; + bfd_size_type stringsize; + char *strings; + + /* Get the size of the strings. */ + if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0 + || (bfd_bread ((PTR) string_chars, (bfd_size_type) BYTES_IN_LONG, + abfd) != BYTES_IN_LONG)) + return FALSE; + stringsize = H_GET_32 (abfd, string_chars); + +#ifdef USE_MMAP + if (! bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize, + &obj_aout_string_window (abfd), TRUE)) + return FALSE; + strings = (char *) obj_aout_string_window (abfd).data; +#else + strings = (char *) bfd_malloc (stringsize + 1); + if (strings == NULL) + return FALSE; + + /* Skip space for the string count in the buffer for convenience + when using indexes. */ + if (bfd_bread (strings + 4, stringsize - 4, abfd) != stringsize - 4) + { + free (strings); + return FALSE; + } +#endif + + /* Ensure that a zero index yields an empty string. */ + strings[0] = '\0'; + + strings[stringsize - 1] = 0; + + obj_aout_external_strings (abfd) = strings; + obj_aout_external_string_size (abfd) = stringsize; + } + + return TRUE; +} + +/* Translate an a.out symbol into a BFD symbol. The desc, other, type + and symbol->value fields of CACHE_PTR will be set from the a.out + nlist structure. This function is responsible for setting + symbol->flags and symbol->section, and adjusting symbol->value. */ + +static bfd_boolean +translate_from_native_sym_flags (abfd, cache_ptr) + bfd *abfd; + aout_symbol_type *cache_ptr; +{ + flagword visible; + + if (cache_ptr->type == N_FN) + { + asection *sec; + + /* This is a debugging symbol. */ + + cache_ptr->symbol.flags = BSF_DEBUGGING; + + /* Work out the symbol section. */ + switch (cache_ptr->type & N_TYPE) + { + case N_TEXT: + case N_FN: + sec = obj_textsec (abfd); + break; + case N_DATA: + sec = obj_datasec (abfd); + break; + case N_BSS: + sec = obj_bsssec (abfd); + break; + default: + case N_ABS: + sec = bfd_abs_section_ptr; + break; + } + + cache_ptr->symbol.section = sec; + cache_ptr->symbol.value -= sec->vma; + + return TRUE; + } + + /* Get the default visibility. This does not apply to all types, so + we just hold it in a local variable to use if wanted. */ + if ((cache_ptr->type & N_EXT) == 0) + visible = BSF_LOCAL; + else + visible = BSF_GLOBAL; + + switch (cache_ptr->type) + { + default: + case N_ABS: case N_ABS | N_EXT: + cache_ptr->symbol.section = bfd_abs_section_ptr; + cache_ptr->symbol.flags = visible; + break; + + case N_UNDF | N_EXT: + if (cache_ptr->symbol.value != 0) + { + /* This is a common symbol. */ + cache_ptr->symbol.flags = BSF_GLOBAL; + cache_ptr->symbol.section = bfd_com_section_ptr; + } + else + { + cache_ptr->symbol.flags = 0; + cache_ptr->symbol.section = bfd_und_section_ptr; + } + break; + + case N_TEXT: case N_TEXT | N_EXT: + cache_ptr->symbol.section = obj_textsec (abfd); + cache_ptr->symbol.value -= cache_ptr->symbol.section->vma; + cache_ptr->symbol.flags = visible; + break; + + case N_DATA: case N_DATA | N_EXT: + cache_ptr->symbol.section = obj_datasec (abfd); + cache_ptr->symbol.value -= cache_ptr->symbol.section->vma; + cache_ptr->symbol.flags = visible; + break; + + case N_BSS: case N_BSS | N_EXT: + cache_ptr->symbol.section = obj_bsssec (abfd); + cache_ptr->symbol.value -= cache_ptr->symbol.section->vma; + cache_ptr->symbol.flags = visible; + break; + } + + return TRUE; +} + +/* Set the fields of SYM_POINTER according to CACHE_PTR. */ + +static bfd_boolean +translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) + bfd *abfd; + asymbol *cache_ptr; + struct external_nlist *sym_pointer; +{ + bfd_vma value = cache_ptr->value; + asection *sec; + bfd_vma off; + + /* Mask out any existing type bits in case copying from one section + to another. */ + sym_pointer->e_type[0] &= ~N_TYPE; + + sec = bfd_get_section (cache_ptr); + off = 0; + + if (sec == NULL) + { + /* This case occurs, e.g., for the *DEBUG* section of a COFF + file. */ + (*_bfd_error_handler) + ("%s: can not represent section for symbol `%s' in a.out object file format", + bfd_archive_filename (abfd), + cache_ptr->name != NULL ? cache_ptr->name : "*unknown*"); + bfd_set_error (bfd_error_nonrepresentable_section); + return FALSE; + } + + if (sec->output_section != NULL) + { + off = sec->output_offset; + sec = sec->output_section; + } + + if (bfd_is_abs_section (sec)) + sym_pointer->e_type[0] |= N_ABS; + else if (sec == obj_textsec (abfd)) + sym_pointer->e_type[0] |= N_TEXT; + else if (sec == obj_datasec (abfd)) + sym_pointer->e_type[0] |= N_DATA; + else if (sec == obj_bsssec (abfd)) + sym_pointer->e_type[0] |= N_BSS; + else if (bfd_is_und_section (sec)) + sym_pointer->e_type[0] = N_UNDF | N_EXT; + else if (bfd_is_com_section (sec)) + sym_pointer->e_type[0] = N_UNDF | N_EXT; + else + { + (*_bfd_error_handler) + ("%s: can not represent section `%s' in a.out object file format", + bfd_archive_filename (abfd), bfd_get_section_name (abfd, sec)); + bfd_set_error (bfd_error_nonrepresentable_section); + return FALSE; + } + + /* Turn the symbol from section relative to absolute again */ + value += sec->vma + off; + + if ((cache_ptr->flags & BSF_DEBUGGING) != 0) + sym_pointer->e_type[0] = ((aout_symbol_type *) cache_ptr)->type; + else if ((cache_ptr->flags & BSF_GLOBAL) != 0) + sym_pointer->e_type[0] |= N_EXT; + +#if 0 + if ((cache_ptr->flags & BSF_CONSTRUCTOR) != 0) + { + int type = ((aout_symbol_type *) cache_ptr)->type; + + + switch (type) + { + case N_ABS: type = N_SETA; break; + case N_TEXT: type = N_SETT; break; + case N_DATA: type = N_SETD; break; + case N_BSS: type = N_SETB; break; + } + sym_pointer->e_type[0] = type; + } +#endif + +#if 0 + if ((cache_ptr->flags & BSF_WEAK) != 0) + { + int type; + + switch (sym_pointer->e_type[0] & N_TYPE) + { + default: + case N_ABS: type = N_WEAKA; break; + case N_TEXT: type = N_WEAKT; break; + case N_DATA: type = N_WEAKD; break; + case N_BSS: type = N_WEAKB; break; + case N_UNDF: type = N_WEAKU; break; + } + sym_pointer->e_type[0] = type; + } +#endif + + PUT_WORD(abfd, value, sym_pointer->e_value); + + return TRUE; +} + +/* Native-level interface to symbols. */ + +asymbol * +NAME(aout,make_empty_symbol) (abfd) + bfd *abfd; +{ + bfd_size_type amt = sizeof (aout_symbol_type); + aout_symbol_type *new = (aout_symbol_type *) bfd_zalloc (abfd, amt); + if (!new) + return NULL; + new->symbol.the_bfd = abfd; + + return &new->symbol; +} + +/* Translate a set of internal symbols into external symbols. */ + +bfd_boolean +NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic) + bfd *abfd; + aout_symbol_type *in; + struct external_nlist *ext; + bfd_size_type count; + char *str; + bfd_size_type strsize; + bfd_boolean dynamic; +{ + struct external_nlist *ext_end; + + ext_end = ext + count; + for (; ext < ext_end; ext++, in++) + { + bfd_vma x; + + x = GET_WORD (abfd, ext->e_strx); + in->symbol.the_bfd = abfd; + + /* For the normal symbols, the zero index points at the number + of bytes in the string table but is to be interpreted as the + null string. For the dynamic symbols, the number of bytes in + the string table is stored in the __DYNAMIC structure and the + zero index points at an actual string. */ + if (x == 0 && ! dynamic) + in->symbol.name = ""; + else if (x < strsize) + in->symbol.name = str + x; + else + return FALSE; + + in->symbol.value = GET_SWORD (abfd, ext->e_value); + /* TODO: is 0 a safe value here? */ + in->desc = 0; + in->other = 0; + in->type = H_GET_8 (abfd, ext->e_type); + in->symbol.udata.p = NULL; + + if (! translate_from_native_sym_flags (abfd, in)) + return FALSE; + + if (dynamic) + in->symbol.flags |= BSF_DYNAMIC; + } + + return TRUE; +} + +/* We read the symbols into a buffer, which is discarded when this + function exits. We read the strings into a buffer large enough to + hold them all plus all the cached symbol entries. */ + +bfd_boolean +NAME(aout,slurp_symbol_table) (abfd) + bfd *abfd; +{ + struct external_nlist *old_external_syms; + aout_symbol_type *cached; + bfd_size_type cached_size; + + /* If there's no work to be done, don't do any */ + if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL) + return TRUE; + + old_external_syms = obj_aout_external_syms (abfd); + + if (! aout_get_external_symbols (abfd)) + return FALSE; + + cached_size = obj_aout_external_sym_count (abfd); + cached_size *= sizeof (aout_symbol_type); + cached = (aout_symbol_type *) bfd_zmalloc (cached_size); + if (cached == NULL && cached_size != 0) + return FALSE; + + /* Convert from external symbol information to internal. */ + if (! (NAME(aout,translate_symbol_table) + (abfd, cached, + obj_aout_external_syms (abfd), + obj_aout_external_sym_count (abfd), + obj_aout_external_strings (abfd), + obj_aout_external_string_size (abfd), + FALSE))) + { + free (cached); + return FALSE; + } + + bfd_get_symcount (abfd) = obj_aout_external_sym_count (abfd); + + obj_aout_symbols (abfd) = cached; + + /* It is very likely that anybody who calls this function will not + want the external symbol information, so if it was allocated + because of our call to aout_get_external_symbols, we free it up + right away to save space. */ + if (old_external_syms == (struct external_nlist *) NULL + && obj_aout_external_syms (abfd) != (struct external_nlist *) NULL) + { +#ifdef USE_MMAP + bfd_free_window (&obj_aout_sym_window (abfd)); +#else + free (obj_aout_external_syms (abfd)); +#endif + obj_aout_external_syms (abfd) = NULL; + } + + return TRUE; +} + +/* We use a hash table when writing out symbols so that we only write + out a particular string once. This helps particularly when the + linker writes out stabs debugging entries, because each different + contributing object file tends to have many duplicate stabs + strings. + + This hash table code breaks dbx on SunOS 4.1.3, so we don't do it + if BFD_TRADITIONAL_FORMAT is set. */ + +static bfd_size_type add_to_stringtab + PARAMS ((bfd *, struct bfd_strtab_hash *, const char *, bfd_boolean)); +static bfd_boolean emit_stringtab PARAMS ((bfd *, struct bfd_strtab_hash *)); + +/* Get the index of a string in a strtab, adding it if it is not + already present. */ + +static INLINE bfd_size_type +add_to_stringtab (abfd, tab, str, copy) + bfd *abfd; + struct bfd_strtab_hash *tab; + const char *str; + bfd_boolean copy; +{ + bfd_boolean hash; + bfd_size_type index; + + /* An index of 0 always means the empty string. */ + if (str == 0 || *str == '\0') + return 0; + + /* Don't hash if BFD_TRADITIONAL_FORMAT is set, because SunOS dbx + doesn't understand a hashed string table. */ + hash = TRUE; + if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0) + hash = FALSE; + + index = _bfd_stringtab_add (tab, str, hash, copy); + + if (index != (bfd_size_type) -1) + { + /* Add BYTES_IN_LONG to the return value to account for the + space taken up by the string table size. */ + index += BYTES_IN_LONG; + } + + return index; +} + +/* Write out a strtab. ABFD is already at the right location in the + file. */ + +static bfd_boolean +emit_stringtab (abfd, tab) + register bfd *abfd; + struct bfd_strtab_hash *tab; +{ + bfd_byte buffer[BYTES_IN_LONG]; + + /* The string table starts with the size. */ + H_PUT_32 (abfd, _bfd_stringtab_size (tab) + BYTES_IN_LONG, buffer); + if (bfd_bwrite ((PTR) buffer, (bfd_size_type) BYTES_IN_LONG, abfd) + != BYTES_IN_LONG) + return FALSE; + + return _bfd_stringtab_emit (abfd, tab); +} + +bfd_boolean +NAME(aout,write_syms) (abfd) + bfd *abfd; +{ + unsigned int count ; + asymbol **generic = bfd_get_outsymbols (abfd); + struct bfd_strtab_hash *strtab; + + strtab = _bfd_stringtab_init (); + if (strtab == NULL) + return FALSE; + + for (count = 0; count < bfd_get_symcount (abfd); count++) + { + asymbol *g = generic[count]; + bfd_size_type indx; + struct external_nlist nsp; + + PUT_WORD (abfd, 0, nsp.e_unused); + + indx = add_to_stringtab (abfd, strtab, g->name, FALSE); + if (indx == (bfd_size_type) -1) + goto error_return; + PUT_WORD (abfd, indx, nsp.e_strx); + + if (bfd_asymbol_flavour(g) == abfd->xvec->flavour) + H_PUT_8 (abfd, aout_symbol(g)->type, nsp.e_type); + else + H_PUT_8 (abfd, 0, nsp.e_type); + + if (! translate_to_native_sym_flags (abfd, g, &nsp)) + goto error_return; + + H_PUT_8 (abfd, 0, nsp.e_ovly); + + if (bfd_bwrite ((PTR)&nsp, (bfd_size_type) EXTERNAL_NLIST_SIZE, abfd) + != EXTERNAL_NLIST_SIZE) + goto error_return; + + /* NB: `KEEPIT' currently overlays `udata.p', so set this only + here, at the end. */ + g->KEEPIT = count; + } + + if (! emit_stringtab (abfd, strtab)) + goto error_return; + + _bfd_stringtab_free (strtab); + + return TRUE; + +error_return: + _bfd_stringtab_free (strtab); + return FALSE; +} + + +long +NAME(aout,canonicalize_symtab) (abfd, location) + bfd *abfd; + asymbol **location; +{ + unsigned int counter = 0; + aout_symbol_type *symbase; + + if (!NAME(aout,slurp_symbol_table)(abfd)) + return -1; + + for (symbase = obj_aout_symbols(abfd); counter++ < bfd_get_symcount (abfd);) + *(location++) = (asymbol *)( symbase++); + *location++ =0; + return bfd_get_symcount (abfd); +} + + +/* Standard reloc stuff */ + +/* Extended stuff */ +/* Output extended relocation information to a file in target byte order. */ + +void +pdp11_aout_swap_reloc_out (abfd, g, natptr) + bfd *abfd; + arelent *g; + register struct pdp11_aout_reloc_external *natptr; +{ + int r_index; + int r_pcrel; + int reloc_entry; + int r_type; + asymbol *sym = *(g->sym_ptr_ptr); + asection *output_section = sym->section->output_section; + + if (g->addend != 0) + fprintf (stderr, "BFD: can't do this reloc addend stuff\n"); + + r_pcrel = g->howto->pc_relative; + + if (bfd_is_abs_section (output_section)) + r_type = RABS; + else if (output_section == obj_textsec (abfd)) + r_type = RTEXT; + else if (output_section == obj_datasec (abfd)) + r_type = RDATA; + else if (output_section == obj_bsssec (abfd)) + r_type = RBSS; + else if (bfd_is_und_section (output_section)) + r_type = REXT; + else if (bfd_is_com_section (output_section)) + r_type = REXT; + else + r_type = -1; + + BFD_ASSERT (r_type != -1); + + if (r_type == RABS) + r_index = 0; + else + r_index = (*(g->sym_ptr_ptr))->KEEPIT; + +#if 0 + if (bfd_is_abs_section (bfd_get_section (sym))) + { + r_extern = 0; + r_index = N_ABS; + r_type = RABS; + } + else if ((sym->flags & BSF_SECTION_SYM) == 0) + { + if (bfd_is_und_section (bfd_get_section (sym)) + || (sym->flags & BSF_GLOBAL) != 0) + r_extern = 1; + else + r_extern = 0; + r_index = (*(g->sym_ptr_ptr))->KEEPIT; + } + else + { + /* Just an ordinary section */ + r_extern = 0; + r_index = output_section->target_index; + } +#endif + + reloc_entry = r_index << 4 | r_type | r_pcrel; + + PUT_WORD (abfd, reloc_entry, natptr->e_reloc_entry); +} + +/* BFD deals internally with all things based from the section they're + in. so, something in 10 bytes into a text section with a base of + 50 would have a symbol (.text+10) and know .text vma was 50. + + Aout keeps all it's symbols based from zero, so the symbol would + contain 60. This macro subs the base of each section from the value + to give the true offset from the section */ + + +#define MOVE_ADDRESS(ad) \ + if (r_extern) \ + { \ + /* Undefined symbol. */ \ + cache_ptr->sym_ptr_ptr = symbols + r_index; \ + cache_ptr->addend = ad; \ + } \ + else \ + { \ + /* Defined, section relative. replace symbol with pointer to \ + symbol which points to section. */ \ + switch (r_index) \ + { \ + case N_TEXT: \ + case N_TEXT | N_EXT: \ + cache_ptr->sym_ptr_ptr = obj_textsec (abfd)->symbol_ptr_ptr; \ + cache_ptr->addend = ad - su->textsec->vma; \ + break; \ + case N_DATA: \ + case N_DATA | N_EXT: \ + cache_ptr->sym_ptr_ptr = obj_datasec (abfd)->symbol_ptr_ptr; \ + cache_ptr->addend = ad - su->datasec->vma; \ + break; \ + case N_BSS: \ + case N_BSS | N_EXT: \ + cache_ptr->sym_ptr_ptr = obj_bsssec (abfd)->symbol_ptr_ptr; \ + cache_ptr->addend = ad - su->bsssec->vma; \ + break; \ + default: \ + case N_ABS: \ + case N_ABS | N_EXT: \ + cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; \ + cache_ptr->addend = ad; \ + break; \ + } \ + } + +void +pdp11_aout_swap_reloc_in (abfd, bytes, cache_ptr, offset, + symbols, symcount) + bfd *abfd; + struct pdp11_aout_reloc_external *bytes; + arelent *cache_ptr; + bfd_size_type offset; + asymbol **symbols; + bfd_size_type symcount; +{ + struct aoutdata *su = &(abfd->tdata.aout_data->a); + unsigned int r_index; + int reloc_entry; + int r_extern; + int r_pcrel; + + reloc_entry = GET_WORD (abfd, (PTR)bytes); + + r_pcrel = reloc_entry & RELFLG; + + cache_ptr->address = offset; + cache_ptr->howto = howto_table_pdp11 + (r_pcrel ? 1 : 0); + + if ((reloc_entry & RTYPE) == RABS) + r_index = N_ABS; + else + r_index = RINDEX (reloc_entry); + + /* r_extern reflects whether the symbol the reloc is against is + local or global. */ + r_extern = (reloc_entry & RTYPE) == REXT; + + if (r_extern && r_index > symcount) + { + /* We could arrange to return an error, but it might be useful + to see the file even if it is bad. */ + r_extern = 0; + r_index = N_ABS; + } + + MOVE_ADDRESS(0); +} + +/* Read and swap the relocs for a section. */ + +bfd_boolean +NAME(aout,slurp_reloc_table) (abfd, asect, symbols) + bfd *abfd; + sec_ptr asect; + asymbol **symbols; +{ + struct pdp11_aout_reloc_external *rptr; + bfd_size_type count; + bfd_size_type reloc_size; + PTR relocs; + arelent *reloc_cache; + size_t each_size; + unsigned int counter = 0; + arelent *cache_ptr; + + if (asect->relocation) + return TRUE; + + if (asect->flags & SEC_CONSTRUCTOR) + return TRUE; + + if (asect == obj_datasec (abfd)) + reloc_size = exec_hdr(abfd)->a_drsize; + else if (asect == obj_textsec (abfd)) + reloc_size = exec_hdr(abfd)->a_trsize; + else if (asect == obj_bsssec (abfd)) + reloc_size = 0; + else + { + bfd_set_error (bfd_error_invalid_operation); + return FALSE; + } + + if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0) + return FALSE; + + each_size = obj_reloc_entry_size (abfd); + + relocs = bfd_malloc (reloc_size); + if (relocs == NULL && reloc_size != 0) + return FALSE; + + if (bfd_bread (relocs, reloc_size, abfd) != reloc_size) + { + free (relocs); + return FALSE; + } + + count = reloc_size / each_size; + + /* Count the number of NON-ZERO relocs, this is the count we want. */ + { + unsigned int real_count = 0; + + for (counter = 0; counter < count; counter++) + { + int x; + + x = GET_WORD (abfd, (char *) relocs + each_size * counter); + if (x != 0) + real_count++; + } + + count = real_count; + } + + reloc_cache = (arelent *) bfd_zmalloc (count * sizeof (arelent)); + if (reloc_cache == NULL && count != 0) + return FALSE; + + cache_ptr = reloc_cache; + + rptr = (struct pdp11_aout_reloc_external *) relocs; + for (counter = 0; + counter < count; + counter++, ((char *)rptr) += RELOC_SIZE, cache_ptr++) + { + while (GET_WORD (abfd, (PTR)rptr) == 0) + { + rptr = + (struct pdp11_aout_reloc_external *) + ((char *) rptr + RELOC_SIZE); + if ((char *) rptr >= (char *) relocs + reloc_size) + goto done; + } + + pdp11_aout_swap_reloc_in (abfd, rptr, cache_ptr, + (bfd_size_type) ((char *) rptr - (char *) relocs), + symbols, + (bfd_size_type) bfd_get_symcount (abfd)); + } + done: + /* Just in case, if rptr >= relocs + reloc_size should happen + too early. */ + BFD_ASSERT (counter == count); + + free (relocs); + + asect->relocation = reloc_cache; + asect->reloc_count = cache_ptr - reloc_cache; + + return TRUE; +} + +/* Write out a relocation section into an object file. */ + +bfd_boolean +NAME(aout,squirt_out_relocs) (abfd, section) + bfd *abfd; + asection *section; +{ + arelent **generic; + unsigned char *native; + unsigned int count = section->reloc_count; + bfd_size_type natsize; + +#if 0 + /* If we're writing an .o file, we must write + relocation information, even if there is none. */ + if ((count == 0 || section->orelocation == NULL) && + ) + return TRUE; +#endif + + natsize = bfd_get_section_size_before_reloc (section); + native = (unsigned char *) bfd_zalloc (abfd, natsize); + if (!native) + return FALSE; + + generic = section->orelocation; + if (generic != NULL) + { + while (count > 0) + { + struct pdp11_aout_reloc_external *r; + + r = (struct pdp11_aout_reloc_external *) + (native + (*generic)->address); + pdp11_aout_swap_reloc_out (abfd, *generic, r); + count--; + generic++; + } + } + + if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize) + { + bfd_release (abfd, native); + return FALSE; + } + + bfd_release (abfd, native); + return TRUE; +} + +/* This is stupid. This function should be a boolean predicate */ +long +NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols) + bfd *abfd; + sec_ptr section; + arelent **relptr; + asymbol **symbols; +{ + arelent *tblptr = section->relocation; + unsigned int count; + + if (section == obj_bsssec (abfd)) + { + *relptr = NULL; + return 0; + } + + if (!(tblptr || NAME(aout,slurp_reloc_table)(abfd, section, symbols))) + return -1; + + if (section->flags & SEC_CONSTRUCTOR) + { + arelent_chain *chain = section->constructor_chain; + + for (count = 0; count < section->reloc_count; count ++) + { + *relptr ++ = &chain->relent; + chain = chain->next; + } + } + else + { + tblptr = section->relocation; + + for (count = 0; count++ < section->reloc_count;) + *relptr++ = tblptr++; + } + + *relptr = 0; + + return section->reloc_count; +} + +long +NAME(aout,get_reloc_upper_bound) (abfd, asect) + bfd *abfd; + sec_ptr asect; +{ + if (bfd_get_format (abfd) != bfd_object) + { + bfd_set_error (bfd_error_invalid_operation); + return -1; + } + + if (asect->flags & SEC_CONSTRUCTOR) + return (sizeof (arelent *) * (asect->reloc_count+1)); + + if (asect == obj_datasec (abfd)) + return (sizeof (arelent *) + * ((exec_hdr(abfd)->a_drsize / obj_reloc_entry_size (abfd)) + + 1)); + + if (asect == obj_textsec (abfd)) + return (sizeof (arelent *) + * ((exec_hdr(abfd)->a_trsize / obj_reloc_entry_size (abfd)) + + 1)); + + /* TODO: why are there two if statements for obj_bsssec()? */ + + if (asect == obj_bsssec (abfd)) + return sizeof (arelent *); + + if (asect == obj_bsssec (abfd)) + return 0; + + bfd_set_error (bfd_error_invalid_operation); + return -1; +} + + +long +NAME(aout,get_symtab_upper_bound) (abfd) + bfd *abfd; +{ + if (!NAME(aout,slurp_symbol_table)(abfd)) + return -1; + + return (bfd_get_symcount (abfd) + 1) * (sizeof (aout_symbol_type *)); +} + +alent * +NAME(aout,get_lineno) (abfd, symbol) + bfd * abfd ATTRIBUTE_UNUSED; + asymbol * symbol ATTRIBUTE_UNUSED; +{ + return (alent *)NULL; +} + +void +NAME(aout,get_symbol_info) (abfd, symbol, ret) + bfd * abfd ATTRIBUTE_UNUSED; + asymbol *symbol; + symbol_info *ret; +{ + bfd_symbol_info (symbol, ret); + + if (ret->type == '?') + { + int type_code = aout_symbol(symbol)->type & 0xff; + const char *stab_name = bfd_get_stab_name (type_code); + static char buf[10]; + + if (stab_name == NULL) + { + sprintf(buf, "(%d)", type_code); + stab_name = buf; + } + ret->type = '-'; + ret->stab_type = type_code; + ret->stab_other = (unsigned)(aout_symbol(symbol)->other & 0xff); + ret->stab_desc = (unsigned)(aout_symbol(symbol)->desc & 0xffff); + ret->stab_name = stab_name; + } +} + +void +NAME(aout,print_symbol) (abfd, afile, symbol, how) + bfd * abfd; + PTR afile; + asymbol *symbol; + bfd_print_symbol_type how; +{ + FILE *file = (FILE *)afile; + + switch (how) + { + case bfd_print_symbol_name: + if (symbol->name) + fprintf(file,"%s", symbol->name); + break; + case bfd_print_symbol_more: + fprintf(file,"%4x %2x %2x",(unsigned)(aout_symbol(symbol)->desc & 0xffff), + (unsigned)(aout_symbol(symbol)->other & 0xff), + (unsigned)(aout_symbol(symbol)->type)); + break; + case bfd_print_symbol_all: + { + const char *section_name = symbol->section->name; + + bfd_print_symbol_vandf (abfd, (PTR)file, symbol); + + fprintf (file," %-5s %04x %02x %02x", + section_name, + (unsigned)(aout_symbol(symbol)->desc & 0xffff), + (unsigned)(aout_symbol(symbol)->other & 0xff), + (unsigned)(aout_symbol(symbol)->type & 0xff)); + if (symbol->name) + fprintf(file," %s", symbol->name); + } + break; + } +} + +/* If we don't have to allocate more than 1MB to hold the generic + symbols, we use the generic minisymbol method: it's faster, since + it only translates the symbols once, not multiple times. */ +#define MINISYM_THRESHOLD (1000000 / sizeof (asymbol)) + +/* Read minisymbols. For minisymbols, we use the unmodified a.out + symbols. The minisymbol_to_symbol function translates these into + BFD asymbol structures. */ + +long +NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep) + bfd *abfd; + bfd_boolean dynamic; + PTR *minisymsp; + unsigned int *sizep; +{ + if (dynamic) + { + /* We could handle the dynamic symbols here as well, but it's + easier to hand them off. */ + return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep); + } + + if (! aout_get_external_symbols (abfd)) + return -1; + + if (obj_aout_external_sym_count (abfd) < MINISYM_THRESHOLD) + return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep); + + *minisymsp = (PTR) obj_aout_external_syms (abfd); + + /* By passing the external symbols back from this routine, we are + giving up control over the memory block. Clear + obj_aout_external_syms, so that we do not try to free it + ourselves. */ + obj_aout_external_syms (abfd) = NULL; + + *sizep = EXTERNAL_NLIST_SIZE; + return obj_aout_external_sym_count (abfd); +} + +/* Convert a minisymbol to a BFD asymbol. A minisymbol is just an + unmodified a.out symbol. The SYM argument is a structure returned + by bfd_make_empty_symbol, which we fill in here. */ + +asymbol * +NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym) + bfd *abfd; + bfd_boolean dynamic; + const PTR minisym; + asymbol *sym; +{ + if (dynamic + || obj_aout_external_sym_count (abfd) < MINISYM_THRESHOLD) + return _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym); + + memset (sym, 0, sizeof (aout_symbol_type)); + + /* We call translate_symbol_table to translate a single symbol. */ + if (! (NAME(aout,translate_symbol_table) + (abfd, + (aout_symbol_type *) sym, + (struct external_nlist *) minisym, + (bfd_size_type) 1, + obj_aout_external_strings (abfd), + obj_aout_external_string_size (abfd), + FALSE))) + return NULL; + + return sym; +} + +/* + provided a BFD, a section and an offset into the section, calculate + and return the name of the source file and the line nearest to the + wanted location. +*/ + +bfd_boolean +NAME(aout,find_nearest_line) + (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr) + bfd *abfd; + asection *section; + asymbol **symbols; + bfd_vma offset; + const char **filename_ptr; + const char **functionname_ptr; + unsigned int *line_ptr; +{ + /* Run down the file looking for the filename, function and linenumber */ + asymbol **p; + const char *directory_name = NULL; + const char *main_file_name = NULL; + const char *current_file_name = NULL; + const char *line_file_name = NULL; /* Value of current_file_name at line number. */ + bfd_vma low_line_vma = 0; + bfd_vma low_func_vma = 0; + asymbol *func = 0; + size_t filelen, funclen; + char *buf; + + *filename_ptr = abfd->filename; + *functionname_ptr = 0; + *line_ptr = 0; + + if (symbols != (asymbol **)NULL) + { + for (p = symbols; *p; p++) + { + aout_symbol_type *q = (aout_symbol_type *)(*p); + next: + switch (q->type) + { + case N_TEXT: + /* If this looks like a file name symbol, and it comes after + the line number we have found so far, but before the + offset, then we have probably not found the right line + number. */ + if (q->symbol.value <= offset + && ((q->symbol.value > low_line_vma + && (line_file_name != NULL + || *line_ptr != 0)) + || (q->symbol.value > low_func_vma + && func != NULL))) + { + const char * symname; + + symname = q->symbol.name; + if (strcmp (symname + strlen (symname) - 2, ".o") == 0) + { + if (q->symbol.value > low_line_vma) + { + *line_ptr = 0; + line_file_name = NULL; + } + if (q->symbol.value > low_func_vma) + func = NULL; + } + } + break; + + case N_SO: + /* If this symbol is less than the offset, but greater than + the line number we have found so far, then we have not + found the right line number. */ + if (q->symbol.value <= offset) + { + if (q->symbol.value > low_line_vma) + { + *line_ptr = 0; + line_file_name = NULL; + } + if (q->symbol.value > low_func_vma) + func = NULL; + } + + main_file_name = current_file_name = q->symbol.name; + /* Look ahead to next symbol to check if that too is an N_SO. */ + p++; + if (*p == NULL) + break; + q = (aout_symbol_type *)(*p); + if (q->type != (int)N_SO) + goto next; + + /* Found a second N_SO First is directory; second is filename. */ + directory_name = current_file_name; + main_file_name = current_file_name = q->symbol.name; + if (obj_textsec(abfd) != section) + goto done; + break; + case N_SOL: + current_file_name = q->symbol.name; + break; + + case N_SLINE: + case N_DSLINE: + case N_BSLINE: + /* We'll keep this if it resolves nearer than the one we have + already. */ + if (q->symbol.value >= low_line_vma + && q->symbol.value <= offset) + { + *line_ptr = q->desc; + low_line_vma = q->symbol.value; + line_file_name = current_file_name; + } + break; + + case N_FUN: + { + /* We'll keep this if it is nearer than the one we have already */ + if (q->symbol.value >= low_func_vma && + q->symbol.value <= offset) + { + low_func_vma = q->symbol.value; + func = (asymbol *)q; + } + else if (q->symbol.value > offset) + goto done; + } + break; + } + } + } + + done: + if (*line_ptr != 0) + main_file_name = line_file_name; + + if (main_file_name == NULL + || main_file_name[0] == '/' + || directory_name == NULL) + filelen = 0; + else + filelen = strlen (directory_name) + strlen (main_file_name); + if (func == NULL) + funclen = 0; + else + funclen = strlen (bfd_asymbol_name (func)); + + if (adata (abfd).line_buf != NULL) + free (adata (abfd).line_buf); + if (filelen + funclen == 0) + adata (abfd).line_buf = buf = NULL; + else + { + buf = (char *) bfd_malloc ((bfd_size_type) filelen + funclen + 3); + adata (abfd).line_buf = buf; + if (buf == NULL) + return FALSE; + } + + if (main_file_name != NULL) + { + if (main_file_name[0] == '/' || directory_name == NULL) + *filename_ptr = main_file_name; + else + { + sprintf (buf, "%s%s", directory_name, main_file_name); + *filename_ptr = buf; + buf += filelen + 1; + } + } + + if (func) + { + const char *function = func->name; + char *colon; + + /* The caller expects a symbol name. We actually have a + function name, without the leading underscore. Put the + underscore back in, so that the caller gets a symbol name. */ + if (bfd_get_symbol_leading_char (abfd) == '\0') + strcpy (buf, function); + else + { + buf[0] = bfd_get_symbol_leading_char (abfd); + strcpy (buf + 1, function); + } + + /* Have to remove : stuff. */ + colon = strchr (buf, ':'); + if (colon != NULL) + *colon = '\0'; + *functionname_ptr = buf; + } + + return TRUE; +} + +int +NAME(aout,sizeof_headers) (abfd, execable) + bfd *abfd; + bfd_boolean execable ATTRIBUTE_UNUSED; +{ + return adata(abfd).exec_bytes_size; +} + +/* Free all information we have cached for this BFD. We can always + read it again later if we need it. */ + +bfd_boolean +NAME(aout,bfd_free_cached_info) (abfd) + bfd *abfd; +{ + asection *o; + + if (bfd_get_format (abfd) != bfd_object) + return TRUE; + +#define BFCI_FREE(x) if (x != NULL) { free (x); x = NULL; } + BFCI_FREE (obj_aout_symbols (abfd)); +#ifdef USE_MMAP + obj_aout_external_syms (abfd) = 0; + bfd_free_window (&obj_aout_sym_window (abfd)); + bfd_free_window (&obj_aout_string_window (abfd)); + obj_aout_external_strings (abfd) = 0; +#else + BFCI_FREE (obj_aout_external_syms (abfd)); + BFCI_FREE (obj_aout_external_strings (abfd)); +#endif + for (o = abfd->sections; o != (asection *) NULL; o = o->next) + BFCI_FREE (o->relocation); +#undef BFCI_FREE + + return TRUE; +} + +/* a.out link code. */ + +static bfd_boolean aout_link_add_object_symbols + PARAMS ((bfd *, struct bfd_link_info *)); +static bfd_boolean aout_link_check_archive_element + PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *)); +static bfd_boolean aout_link_free_symbols PARAMS ((bfd *)); +static bfd_boolean aout_link_check_ar_symbols + PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded)); +static bfd_boolean aout_link_add_symbols + PARAMS ((bfd *, struct bfd_link_info *)); + +/* Routine to create an entry in an a.out link hash table. */ + +struct bfd_hash_entry * +NAME(aout,link_hash_newfunc) (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct aout_link_hash_entry *ret = (struct aout_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct aout_link_hash_entry *) NULL) + ret = ((struct aout_link_hash_entry *) + bfd_hash_allocate (table, sizeof (struct aout_link_hash_entry))); + if (ret == (struct aout_link_hash_entry *) NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct aout_link_hash_entry *) + _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret) + { + /* Set local fields. */ + ret->written = FALSE; + ret->indx = -1; + } + + return (struct bfd_hash_entry *) ret; +} + +/* Initialize an a.out link hash table. */ + +bfd_boolean +NAME(aout,link_hash_table_init) (table, abfd, newfunc) + struct aout_link_hash_table *table; + bfd *abfd; + struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *)); +{ + return _bfd_link_hash_table_init (&table->root, abfd, newfunc); +} + +/* Create an a.out link hash table. */ + +struct bfd_link_hash_table * +NAME(aout,link_hash_table_create) (abfd) + bfd *abfd; +{ + struct aout_link_hash_table *ret; + bfd_size_type amt = sizeof (struct aout_link_hash_table); + + ret = ((struct aout_link_hash_table *) bfd_alloc (abfd, amt)); + if (ret == NULL) + return (struct bfd_link_hash_table *) NULL; + if (! NAME(aout,link_hash_table_init) (ret, abfd, + NAME(aout,link_hash_newfunc))) + { + free (ret); + return (struct bfd_link_hash_table *) NULL; + } + return &ret->root; +} + +/* Given an a.out BFD, add symbols to the global hash table as + appropriate. */ + +bfd_boolean +NAME(aout,link_add_symbols) (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + switch (bfd_get_format (abfd)) + { + case bfd_object: + return aout_link_add_object_symbols (abfd, info); + case bfd_archive: + return _bfd_generic_link_add_archive_symbols + (abfd, info, aout_link_check_archive_element); + default: + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } +} + +/* Add symbols from an a.out object file. */ + +static bfd_boolean +aout_link_add_object_symbols (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + if (! aout_get_external_symbols (abfd)) + return FALSE; + if (! aout_link_add_symbols (abfd, info)) + return FALSE; + if (! info->keep_memory) + { + if (! aout_link_free_symbols (abfd)) + return FALSE; + } + return TRUE; +} + +/* Check a single archive element to see if we need to include it in + the link. *PNEEDED is set according to whether this element is + needed in the link or not. This is called from + _bfd_generic_link_add_archive_symbols. */ + +static bfd_boolean +aout_link_check_archive_element (abfd, info, pneeded) + bfd *abfd; + struct bfd_link_info *info; + bfd_boolean *pneeded; +{ + if (! aout_get_external_symbols (abfd)) + return FALSE; + + if (! aout_link_check_ar_symbols (abfd, info, pneeded)) + return FALSE; + + if (*pneeded) + { + if (! aout_link_add_symbols (abfd, info)) + return FALSE; + } + + if (! info->keep_memory || ! *pneeded) + { + if (! aout_link_free_symbols (abfd)) + return FALSE; + } + + return TRUE; +} + +/* Free up the internal symbols read from an a.out file. */ + +static bfd_boolean +aout_link_free_symbols (abfd) + bfd *abfd; +{ + if (obj_aout_external_syms (abfd) != (struct external_nlist *) NULL) + { +#ifdef USE_MMAP + bfd_free_window (&obj_aout_sym_window (abfd)); +#else + free ((PTR) obj_aout_external_syms (abfd)); +#endif + obj_aout_external_syms (abfd) = (struct external_nlist *) NULL; + } + if (obj_aout_external_strings (abfd) != (char *) NULL) + { +#ifdef USE_MMAP + bfd_free_window (&obj_aout_string_window (abfd)); +#else + free ((PTR) obj_aout_external_strings (abfd)); +#endif + obj_aout_external_strings (abfd) = (char *) NULL; + } + return TRUE; +} + +/* Look through the internal symbols to see if this object file should + be included in the link. We should include this object file if it + defines any symbols which are currently undefined. If this object + file defines a common symbol, then we may adjust the size of the + known symbol but we do not include the object file in the link + (unless there is some other reason to include it). */ + +static bfd_boolean +aout_link_check_ar_symbols (abfd, info, pneeded) + bfd *abfd; + struct bfd_link_info *info; + bfd_boolean *pneeded; +{ + register struct external_nlist *p; + struct external_nlist *pend; + char *strings; + + *pneeded = FALSE; + + /* Look through all the symbols. */ + p = obj_aout_external_syms (abfd); + pend = p + obj_aout_external_sym_count (abfd); + strings = obj_aout_external_strings (abfd); + for (; p < pend; p++) + { + int type = H_GET_8 (abfd, p->e_type); + const char *name; + struct bfd_link_hash_entry *h; + + /* Ignore symbols that are not externally visible. This is an + optimization only, as we check the type more thoroughly + below. */ + if ((type & N_EXT) == 0 + || type == N_FN) + continue; + + name = strings + GET_WORD (abfd, p->e_strx); + h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); + + /* We are only interested in symbols that are currently + undefined or common. */ + if (h == (struct bfd_link_hash_entry *) NULL + || (h->type != bfd_link_hash_undefined + && h->type != bfd_link_hash_common)) + continue; + + if (type == (N_TEXT | N_EXT) + || type == (N_DATA | N_EXT) + || type == (N_BSS | N_EXT) + || type == (N_ABS | N_EXT)) + { + /* This object file defines this symbol. We must link it + in. This is true regardless of whether the current + definition of the symbol is undefined or common. If the + current definition is common, we have a case in which we + have already seen an object file including + int a; + and this object file from the archive includes + int a = 5; + In such a case we must include this object file. + + FIXME: The SunOS 4.1.3 linker will pull in the archive + element if the symbol is defined in the .data section, + but not if it is defined in the .text section. That + seems a bit crazy to me, and I haven't implemented it. + However, it might be correct. */ + if (! (*info->callbacks->add_archive_element) (info, abfd, name)) + return FALSE; + *pneeded = TRUE; + return TRUE; + } + + if (type == (N_UNDF | N_EXT)) + { + bfd_vma value; + + value = GET_WORD (abfd, p->e_value); + if (value != 0) + { + /* This symbol is common in the object from the archive + file. */ + if (h->type == bfd_link_hash_undefined) + { + bfd *symbfd; + unsigned int power; + + symbfd = h->u.undef.abfd; + if (symbfd == (bfd *) NULL) + { + /* This symbol was created as undefined from + outside BFD. We assume that we should link + in the object file. This is done for the -u + option in the linker. */ + if (! (*info->callbacks->add_archive_element) (info, + abfd, + name)) + return FALSE; + *pneeded = TRUE; + return TRUE; + } + /* Turn the current link symbol into a common + symbol. It is already on the undefs list. */ + h->type = bfd_link_hash_common; + h->u.c.p = ((struct bfd_link_hash_common_entry *) + bfd_hash_allocate (&info->hash->table, + sizeof (struct bfd_link_hash_common_entry))); + if (h->u.c.p == NULL) + return FALSE; + + h->u.c.size = value; + + /* FIXME: This isn't quite right. The maximum + alignment of a common symbol should be set by the + architecture of the output file, not of the input + file. */ + power = bfd_log2 (value); + if (power > bfd_get_arch_info (abfd)->section_align_power) + power = bfd_get_arch_info (abfd)->section_align_power; + h->u.c.p->alignment_power = power; + + h->u.c.p->section = bfd_make_section_old_way (symbfd, + "COMMON"); + } + else + { + /* Adjust the size of the common symbol if + necessary. */ + if (value > h->u.c.size) + h->u.c.size = value; + } + } + } + } + + /* We do not need this object file. */ + return TRUE; +} + +/* Add all symbols from an object file to the hash table. */ + +static bfd_boolean +aout_link_add_symbols (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + bfd_boolean (*add_one_symbol) + PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *, + bfd_vma, const char *, bfd_boolean, bfd_boolean, + struct bfd_link_hash_entry **)); + struct external_nlist *syms; + bfd_size_type sym_count; + char *strings; + bfd_boolean copy; + struct aout_link_hash_entry **sym_hash; + register struct external_nlist *p; + struct external_nlist *pend; + + syms = obj_aout_external_syms (abfd); + sym_count = obj_aout_external_sym_count (abfd); + strings = obj_aout_external_strings (abfd); + if (info->keep_memory) + copy = FALSE; + else + copy = TRUE; + + if (aout_backend_info (abfd)->add_dynamic_symbols != NULL) + { + if (! ((*aout_backend_info (abfd)->add_dynamic_symbols) + (abfd, info, &syms, &sym_count, &strings))) + return FALSE; + } + + /* We keep a list of the linker hash table entries that correspond + to particular symbols. We could just look them up in the hash + table, but keeping the list is more efficient. Perhaps this + should be conditional on info->keep_memory. */ + sym_hash = ((struct aout_link_hash_entry **) + bfd_alloc (abfd, + sym_count * sizeof (struct aout_link_hash_entry *))); + if (sym_hash == NULL && sym_count != 0) + return FALSE; + obj_aout_sym_hashes (abfd) = sym_hash; + + add_one_symbol = aout_backend_info (abfd)->add_one_symbol; + if (add_one_symbol == NULL) + add_one_symbol = _bfd_generic_link_add_one_symbol; + + p = syms; + pend = p + sym_count; + for (; p < pend; p++, sym_hash++) + { + int type; + const char *name; + bfd_vma value; + asection *section; + flagword flags; + const char *string; + + *sym_hash = NULL; + + type = H_GET_8 (abfd, p->e_type); + +#if 0 /* not supported in PDP-11 a.out */ + /* Ignore debugging symbols. */ + if ((type & N_STAB) != 0) + continue; +#endif + + name = strings + GET_WORD (abfd, p->e_strx); + value = GET_WORD (abfd, p->e_value); + flags = BSF_GLOBAL; + string = NULL; + switch (type) + { + default: + abort (); + + case N_UNDF: + case N_ABS: + case N_TEXT: + case N_DATA: + case N_BSS: + case N_REG: + case N_FN: + /* Ignore symbols that are not externally visible. */ + continue; + + case N_UNDF | N_EXT: + if (value == 0) + { + section = bfd_und_section_ptr; + flags = 0; + } + else + section = bfd_com_section_ptr; + break; + case N_ABS | N_EXT: + section = bfd_abs_section_ptr; + break; + case N_TEXT | N_EXT: + section = obj_textsec (abfd); + value -= bfd_get_section_vma (abfd, section); + break; + case N_DATA | N_EXT: + /* Treat N_SETV symbols as N_DATA symbol; see comment in + translate_from_native_sym_flags. */ + section = obj_datasec (abfd); + value -= bfd_get_section_vma (abfd, section); + break; + case N_BSS | N_EXT: + section = obj_bsssec (abfd); + value -= bfd_get_section_vma (abfd, section); + break; + } + + if (! ((*add_one_symbol) + (info, abfd, name, flags, section, value, string, copy, FALSE, + (struct bfd_link_hash_entry **) sym_hash))) + return FALSE; + + /* Restrict the maximum alignment of a common symbol based on + the architecture, since a.out has no way to represent + alignment requirements of a section in a .o file. FIXME: + This isn't quite right: it should use the architecture of the + output file, not the input files. */ + if ((*sym_hash)->root.type == bfd_link_hash_common + && ((*sym_hash)->root.u.c.p->alignment_power > + bfd_get_arch_info (abfd)->section_align_power)) + (*sym_hash)->root.u.c.p->alignment_power = + bfd_get_arch_info (abfd)->section_align_power; + + /* If this is a set symbol, and we are not building sets, then + it is possible for the hash entry to not have been set. In + such a case, treat the symbol as not globally defined. */ + if ((*sym_hash)->root.type == bfd_link_hash_new) + { + BFD_ASSERT ((flags & BSF_CONSTRUCTOR) != 0); + *sym_hash = NULL; + } + } + + return TRUE; +} + +/* A hash table used for header files with N_BINCL entries. */ + +struct aout_link_includes_table +{ + struct bfd_hash_table root; +}; + +/* A linked list of totals that we have found for a particular header + file. */ + +struct aout_link_includes_totals +{ + struct aout_link_includes_totals *next; + bfd_vma total; +}; + +/* An entry in the header file hash table. */ + +struct aout_link_includes_entry +{ + struct bfd_hash_entry root; + /* List of totals we have found for this file. */ + struct aout_link_includes_totals *totals; +}; + +/* Look up an entry in an the header file hash table. */ + +#define aout_link_includes_lookup(table, string, create, copy) \ + ((struct aout_link_includes_entry *) \ + bfd_hash_lookup (&(table)->root, (string), (create), (copy))) + +/* During the final link step we need to pass around a bunch of + information, so we do it in an instance of this structure. */ + +struct aout_final_link_info +{ + /* General link information. */ + struct bfd_link_info *info; + /* Output bfd. */ + bfd *output_bfd; + /* Reloc file positions. */ + file_ptr treloff, dreloff; + /* File position of symbols. */ + file_ptr symoff; + /* String table. */ + struct bfd_strtab_hash *strtab; + /* Header file hash table. */ + struct aout_link_includes_table includes; + /* A buffer large enough to hold the contents of any section. */ + bfd_byte *contents; + /* A buffer large enough to hold the relocs of any section. */ + PTR relocs; + /* A buffer large enough to hold the symbol map of any input BFD. */ + int *symbol_map; + /* A buffer large enough to hold output symbols of any input BFD. */ + struct external_nlist *output_syms; +}; + +static struct bfd_hash_entry *aout_link_includes_newfunc + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +static bfd_boolean aout_link_input_bfd + PARAMS ((struct aout_final_link_info *, bfd *input_bfd)); +static bfd_boolean aout_link_write_symbols + PARAMS ((struct aout_final_link_info *, bfd *input_bfd)); +static bfd_boolean aout_link_write_other_symbol + PARAMS ((struct aout_link_hash_entry *, PTR)); +static bfd_boolean aout_link_input_section + PARAMS ((struct aout_final_link_info *, bfd *input_bfd, + asection *input_section, file_ptr *reloff_ptr, + bfd_size_type rel_size)); +static INLINE asection *aout_reloc_type_to_section + PARAMS ((bfd *, int)); +static bfd_boolean aout_link_reloc_link_order + PARAMS ((struct aout_final_link_info *, asection *, + struct bfd_link_order *)); +static bfd_boolean pdp11_aout_link_input_section + PARAMS ((struct aout_final_link_info *finfo, + bfd *input_bfd, + asection *input_section, + struct pdp11_aout_reloc_external *relocs, + bfd_size_type rel_size, + bfd_byte *contents)); + +/* The function to create a new entry in the header file hash table. */ + +static struct bfd_hash_entry * +aout_link_includes_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct aout_link_includes_entry *ret = + (struct aout_link_includes_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct aout_link_includes_entry *) NULL) + ret = ((struct aout_link_includes_entry *) + bfd_hash_allocate (table, + sizeof (struct aout_link_includes_entry))); + if (ret == (struct aout_link_includes_entry *) NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct aout_link_includes_entry *) + bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); + if (ret) + { + /* Set local fields. */ + ret->totals = NULL; + } + + return (struct bfd_hash_entry *) ret; +} + +/* Do the final link step. This is called on the output BFD. The + INFO structure should point to a list of BFDs linked through the + link_next field which can be used to find each BFD which takes part + in the output. Also, each section in ABFD should point to a list + of bfd_link_order structures which list all the input sections for + the output section. */ + +bfd_boolean +NAME(aout,final_link) (abfd, info, callback) + bfd *abfd; + struct bfd_link_info *info; + void (*callback) PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *)); +{ + struct aout_final_link_info aout_info; + bfd_boolean includes_hash_initialized = FALSE; + register bfd *sub; + bfd_size_type trsize, drsize; + bfd_size_type max_contents_size; + bfd_size_type max_relocs_size; + bfd_size_type max_sym_count; + bfd_size_type text_size; + file_ptr text_end; + register struct bfd_link_order *p; + asection *o; + bfd_boolean have_link_order_relocs; + + if (info->shared) + abfd->flags |= DYNAMIC; + + aout_info.info = info; + aout_info.output_bfd = abfd; + aout_info.contents = NULL; + aout_info.relocs = NULL; + aout_info.symbol_map = NULL; + aout_info.output_syms = NULL; + + if (! bfd_hash_table_init_n (&aout_info.includes.root, + aout_link_includes_newfunc, + 251)) + goto error_return; + includes_hash_initialized = TRUE; + + /* Figure out the largest section size. Also, if generating + relocatable output, count the relocs. */ + trsize = 0; + drsize = 0; + max_contents_size = 0; + max_relocs_size = 0; + max_sym_count = 0; + for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) + { + size_t sz; + + if (info->relocatable) + { + if (bfd_get_flavour (sub) == bfd_target_aout_flavour) + { + trsize += exec_hdr (sub)->a_trsize; + drsize += exec_hdr (sub)->a_drsize; + } + else + { + /* FIXME: We need to identify the .text and .data sections + and call get_reloc_upper_bound and canonicalize_reloc to + work out the number of relocs needed, and then multiply + by the reloc size. */ + (*_bfd_error_handler) + ("%s: relocatable link from %s to %s not supported", + bfd_get_filename (abfd), + sub->xvec->name, abfd->xvec->name); + bfd_set_error (bfd_error_invalid_operation); + goto error_return; + } + } + + if (bfd_get_flavour (sub) == bfd_target_aout_flavour) + { + sz = bfd_section_size (sub, obj_textsec (sub)); + if (sz > max_contents_size) + max_contents_size = sz; + sz = bfd_section_size (sub, obj_datasec (sub)); + if (sz > max_contents_size) + max_contents_size = sz; + + sz = exec_hdr (sub)->a_trsize; + if (sz > max_relocs_size) + max_relocs_size = sz; + sz = exec_hdr (sub)->a_drsize; + if (sz > max_relocs_size) + max_relocs_size = sz; + + sz = obj_aout_external_sym_count (sub); + if (sz > max_sym_count) + max_sym_count = sz; + } + } + + if (info->relocatable) + { + if (obj_textsec (abfd) != (asection *) NULL) + trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd) + ->link_order_head) + * obj_reloc_entry_size (abfd)); + if (obj_datasec (abfd) != (asection *) NULL) + drsize += (_bfd_count_link_order_relocs (obj_datasec (abfd) + ->link_order_head) + * obj_reloc_entry_size (abfd)); + } + + exec_hdr (abfd)->a_trsize = trsize; + exec_hdr (abfd)->a_drsize = drsize; + + exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd); + + /* Adjust the section sizes and vmas according to the magic number. + This sets a_text, a_data and a_bss in the exec_hdr and sets the + filepos for each section. */ + if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end)) + goto error_return; + + /* The relocation and symbol file positions differ among a.out + targets. We are passed a callback routine from the backend + specific code to handle this. + FIXME: At this point we do not know how much space the symbol + table will require. This will not work for any (nonstandard) + a.out target that needs to know the symbol table size before it + can compute the relocation file positions. This may or may not + be the case for the hp300hpux target, for example. */ + (*callback) (abfd, &aout_info.treloff, &aout_info.dreloff, + &aout_info.symoff); + obj_textsec (abfd)->rel_filepos = aout_info.treloff; + obj_datasec (abfd)->rel_filepos = aout_info.dreloff; + obj_sym_filepos (abfd) = aout_info.symoff; + + /* We keep a count of the symbols as we output them. */ + obj_aout_external_sym_count (abfd) = 0; + + /* We accumulate the string table as we write out the symbols. */ + aout_info.strtab = _bfd_stringtab_init (); + if (aout_info.strtab == NULL) + goto error_return; + + /* Allocate buffers to hold section contents and relocs. */ + aout_info.contents = (bfd_byte *) bfd_malloc (max_contents_size); + aout_info.relocs = (PTR) bfd_malloc (max_relocs_size); + aout_info.symbol_map = (int *) bfd_malloc (max_sym_count * sizeof (int *)); + aout_info.output_syms = ((struct external_nlist *) + bfd_malloc ((max_sym_count + 1) + * sizeof (struct external_nlist))); + if ((aout_info.contents == NULL && max_contents_size != 0) + || (aout_info.relocs == NULL && max_relocs_size != 0) + || (aout_info.symbol_map == NULL && max_sym_count != 0) + || aout_info.output_syms == NULL) + goto error_return; + + /* If we have a symbol named __DYNAMIC, force it out now. This is + required by SunOS. Doing this here rather than in sunos.c is a + hack, but it's easier than exporting everything which would be + needed. */ + { + struct aout_link_hash_entry *h; + + h = aout_link_hash_lookup (aout_hash_table (info), "__DYNAMIC", + FALSE, FALSE, FALSE); + if (h != NULL) + aout_link_write_other_symbol (h, &aout_info); + } + + /* The most time efficient way to do the link would be to read all + the input object files into memory and then sort out the + information into the output file. Unfortunately, that will + probably use too much memory. Another method would be to step + through everything that composes the text section and write it + out, and then everything that composes the data section and write + it out, and then write out the relocs, and then write out the + symbols. Unfortunately, that requires reading stuff from each + input file several times, and we will not be able to keep all the + input files open simultaneously, and reopening them will be slow. + + What we do is basically process one input file at a time. We do + everything we need to do with an input file once--copy over the + section contents, handle the relocation information, and write + out the symbols--and then we throw away the information we read + from it. This approach requires a lot of lseeks of the output + file, which is unfortunate but still faster than reopening a lot + of files. + + We use the output_has_begun field of the input BFDs to see + whether we have already handled it. */ + for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next) + sub->output_has_begun = FALSE; + + /* Mark all sections which are to be included in the link. This + will normally be every section. We need to do this so that we + can identify any sections which the linker has decided to not + include. */ + for (o = abfd->sections; o != NULL; o = o->next) + { + for (p = o->link_order_head; p != NULL; p = p->next) + { + if (p->type == bfd_indirect_link_order) + p->u.indirect.section->linker_mark = TRUE; + } + } + + have_link_order_relocs = FALSE; + for (o = abfd->sections; o != (asection *) NULL; o = o->next) + { + for (p = o->link_order_head; + p != (struct bfd_link_order *) NULL; + p = p->next) + { + if (p->type == bfd_indirect_link_order + && (bfd_get_flavour (p->u.indirect.section->owner) + == bfd_target_aout_flavour)) + { + bfd *input_bfd; + + input_bfd = p->u.indirect.section->owner; + if (! input_bfd->output_has_begun) + { + if (! aout_link_input_bfd (&aout_info, input_bfd)) + goto error_return; + input_bfd->output_has_begun = TRUE; + } + } + else if (p->type == bfd_section_reloc_link_order + || p->type == bfd_symbol_reloc_link_order) + { + /* These are handled below. */ + have_link_order_relocs = TRUE; + } + else + { + if (! _bfd_default_link_order (abfd, info, o, p)) + goto error_return; + } + } + } + + /* Write out any symbols that we have not already written out. */ + aout_link_hash_traverse (aout_hash_table (info), + aout_link_write_other_symbol, + (PTR) &aout_info); + + /* Now handle any relocs we were asked to create by the linker. + These did not come from any input file. We must do these after + we have written out all the symbols, so that we know the symbol + indices to use. */ + if (have_link_order_relocs) + { + for (o = abfd->sections; o != (asection *) NULL; o = o->next) + { + for (p = o->link_order_head; + p != (struct bfd_link_order *) NULL; + p = p->next) + { + if (p->type == bfd_section_reloc_link_order + || p->type == bfd_symbol_reloc_link_order) + { + if (! aout_link_reloc_link_order (&aout_info, o, p)) + goto error_return; + } + } + } + } + + if (aout_info.contents != NULL) + { + free (aout_info.contents); + aout_info.contents = NULL; + } + if (aout_info.relocs != NULL) + { + free (aout_info.relocs); + aout_info.relocs = NULL; + } + if (aout_info.symbol_map != NULL) + { + free (aout_info.symbol_map); + aout_info.symbol_map = NULL; + } + if (aout_info.output_syms != NULL) + { + free (aout_info.output_syms); + aout_info.output_syms = NULL; + } + if (includes_hash_initialized) + { + bfd_hash_table_free (&aout_info.includes.root); + includes_hash_initialized = FALSE; + } + + /* Finish up any dynamic linking we may be doing. */ + if (aout_backend_info (abfd)->finish_dynamic_link != NULL) + { + if (! (*aout_backend_info (abfd)->finish_dynamic_link) (abfd, info)) + goto error_return; + } + + /* Update the header information. */ + abfd->symcount = obj_aout_external_sym_count (abfd); + exec_hdr (abfd)->a_syms = abfd->symcount * EXTERNAL_NLIST_SIZE; + obj_str_filepos (abfd) = obj_sym_filepos (abfd) + exec_hdr (abfd)->a_syms; + obj_textsec (abfd)->reloc_count = + exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd); + obj_datasec (abfd)->reloc_count = + exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd); + + /* Write out the string table, unless there are no symbols. */ + if (abfd->symcount > 0) + { + if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0 + || ! emit_stringtab (abfd, aout_info.strtab)) + goto error_return; + } + else if (obj_textsec (abfd)->reloc_count == 0 + && obj_datasec (abfd)->reloc_count == 0) + { + bfd_byte b; + + b = 0; + if (bfd_seek (abfd, + (file_ptr) (obj_datasec (abfd)->filepos + + exec_hdr (abfd)->a_data + - 1), + SEEK_SET) != 0 + || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) + goto error_return; + } + + return TRUE; + + error_return: + if (aout_info.contents != NULL) + free (aout_info.contents); + if (aout_info.relocs != NULL) + free (aout_info.relocs); + if (aout_info.symbol_map != NULL) + free (aout_info.symbol_map); + if (aout_info.output_syms != NULL) + free (aout_info.output_syms); + if (includes_hash_initialized) + bfd_hash_table_free (&aout_info.includes.root); + return FALSE; +} + +/* Link an a.out input BFD into the output file. */ + +static bfd_boolean +aout_link_input_bfd (finfo, input_bfd) + struct aout_final_link_info *finfo; + bfd *input_bfd; +{ + bfd_size_type sym_count; + + BFD_ASSERT (bfd_get_format (input_bfd) == bfd_object); + + /* If this is a dynamic object, it may need special handling. */ + if ((input_bfd->flags & DYNAMIC) != 0 + && aout_backend_info (input_bfd)->link_dynamic_object != NULL) + { + return ((*aout_backend_info (input_bfd)->link_dynamic_object) + (finfo->info, input_bfd)); + } + + /* Get the symbols. We probably have them already, unless + finfo->info->keep_memory is FALSE. */ + if (! aout_get_external_symbols (input_bfd)) + return FALSE; + + sym_count = obj_aout_external_sym_count (input_bfd); + + /* Write out the symbols and get a map of the new indices. The map + is placed into finfo->symbol_map. */ + if (! aout_link_write_symbols (finfo, input_bfd)) + return FALSE; + + /* Relocate and write out the sections. These functions use the + symbol map created by aout_link_write_symbols. The linker_mark + field will be set if these sections are to be included in the + link, which will normally be the case. */ + if (obj_textsec (input_bfd)->linker_mark) + { + if (! aout_link_input_section (finfo, input_bfd, + obj_textsec (input_bfd), + &finfo->treloff, + exec_hdr (input_bfd)->a_trsize)) + return FALSE; + } + if (obj_datasec (input_bfd)->linker_mark) + { + if (! aout_link_input_section (finfo, input_bfd, + obj_datasec (input_bfd), + &finfo->dreloff, + exec_hdr (input_bfd)->a_drsize)) + return FALSE; + } + + /* If we are not keeping memory, we don't need the symbols any + longer. We still need them if we are keeping memory, because the + strings in the hash table point into them. */ + if (! finfo->info->keep_memory) + { + if (! aout_link_free_symbols (input_bfd)) + return FALSE; + } + + return TRUE; +} + +/* Adjust and write out the symbols for an a.out file. Set the new + symbol indices into a symbol_map. */ + +static bfd_boolean +aout_link_write_symbols (finfo, input_bfd) + struct aout_final_link_info *finfo; + bfd *input_bfd; +{ + bfd *output_bfd; + bfd_size_type sym_count; + char *strings; + enum bfd_link_strip strip; + enum bfd_link_discard discard; + struct external_nlist *outsym; + bfd_size_type strtab_index; + register struct external_nlist *sym; + struct external_nlist *sym_end; + struct aout_link_hash_entry **sym_hash; + int *symbol_map; + bfd_boolean pass; + bfd_boolean skip_next; + + output_bfd = finfo->output_bfd; + sym_count = obj_aout_external_sym_count (input_bfd); + strings = obj_aout_external_strings (input_bfd); + strip = finfo->info->strip; + discard = finfo->info->discard; + outsym = finfo->output_syms; + + /* First write out a symbol for this object file, unless we are + discarding such symbols. */ + if (strip != strip_all + && (strip != strip_some + || bfd_hash_lookup (finfo->info->keep_hash, input_bfd->filename, + FALSE, FALSE) != NULL) + && discard != discard_all) + { + H_PUT_8 (output_bfd, N_TEXT, outsym->e_type); + strtab_index = add_to_stringtab (output_bfd, finfo->strtab, + input_bfd->filename, FALSE); + if (strtab_index == (bfd_size_type) -1) + return FALSE; + PUT_WORD (output_bfd, strtab_index, outsym->e_strx); + PUT_WORD (output_bfd, + (bfd_get_section_vma (output_bfd, + obj_textsec (input_bfd)->output_section) + + obj_textsec (input_bfd)->output_offset), + outsym->e_value); + ++obj_aout_external_sym_count (output_bfd); + ++outsym; + } + + pass = FALSE; + skip_next = FALSE; + sym = obj_aout_external_syms (input_bfd); + sym_end = sym + sym_count; + sym_hash = obj_aout_sym_hashes (input_bfd); + symbol_map = finfo->symbol_map; + memset (symbol_map, 0, (size_t) sym_count * sizeof *symbol_map); + for (; sym < sym_end; sym++, sym_hash++, symbol_map++) + { + const char *name; + int type; + struct aout_link_hash_entry *h; + bfd_boolean skip; + asection *symsec; + bfd_vma val = 0; + bfd_boolean copy; + + /* We set *symbol_map to 0 above for all symbols. If it has + already been set to -1 for this symbol, it means that we are + discarding it because it appears in a duplicate header file. + See the N_BINCL code below. */ + if (*symbol_map == -1) + continue; + + /* Initialize *symbol_map to -1, which means that the symbol was + not copied into the output file. We will change it later if + we do copy the symbol over. */ + *symbol_map = -1; + + type = H_GET_8 (input_bfd, sym->e_type); + name = strings + GET_WORD (input_bfd, sym->e_strx); + + h = NULL; + + if (pass) + { + /* Pass this symbol through. It is the target of an + indirect or warning symbol. */ + val = GET_WORD (input_bfd, sym->e_value); + pass = FALSE; + } + else if (skip_next) + { + /* Skip this symbol, which is the target of an indirect + symbol that we have changed to no longer be an indirect + symbol. */ + skip_next = FALSE; + continue; + } + else + { + struct aout_link_hash_entry *hresolve; + + /* We have saved the hash table entry for this symbol, if + there is one. Note that we could just look it up again + in the hash table, provided we first check that it is an + external symbol. */ + h = *sym_hash; + + /* Use the name from the hash table, in case the symbol was + wrapped. */ + if (h != NULL) + name = h->root.root.string; + + /* If this is an indirect or warning symbol, then change + hresolve to the base symbol. We also change *sym_hash so + that the relocation routines relocate against the real + symbol. */ + hresolve = h; + if (h != (struct aout_link_hash_entry *) NULL + && (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning)) + { + hresolve = (struct aout_link_hash_entry *) h->root.u.i.link; + while (hresolve->root.type == bfd_link_hash_indirect + || hresolve->root.type == bfd_link_hash_warning) + hresolve = ((struct aout_link_hash_entry *) + hresolve->root.u.i.link); + *sym_hash = hresolve; + } + + /* If the symbol has already been written out, skip it. */ + if (h != (struct aout_link_hash_entry *) NULL + && h->root.type != bfd_link_hash_warning + && h->written) + { + if ((type & N_TYPE) == N_INDR + || type == N_WARNING) + skip_next = TRUE; + *symbol_map = h->indx; + continue; + } + + /* See if we are stripping this symbol. */ + skip = FALSE; + switch (strip) + { + case strip_none: + break; + case strip_debugger: + if ((type & N_STAB) != 0) + skip = TRUE; + break; + case strip_some: + if (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, FALSE) + == NULL) + skip = TRUE; + break; + case strip_all: + skip = TRUE; + break; + } + if (skip) + { + if (h != (struct aout_link_hash_entry *) NULL) + h->written = TRUE; + continue; + } + + /* Get the value of the symbol. */ + if ((type & N_TYPE) == N_TEXT + || type == N_WEAKT) + symsec = obj_textsec (input_bfd); + else if ((type & N_TYPE) == N_DATA + || type == N_WEAKD) + symsec = obj_datasec (input_bfd); + else if ((type & N_TYPE) == N_BSS + || type == N_WEAKB) + symsec = obj_bsssec (input_bfd); + else if ((type & N_TYPE) == N_ABS + || type == N_WEAKA) + symsec = bfd_abs_section_ptr; + else if (((type & N_TYPE) == N_INDR + && (hresolve == (struct aout_link_hash_entry *) NULL + || (hresolve->root.type != bfd_link_hash_defined + && hresolve->root.type != bfd_link_hash_defweak + && hresolve->root.type != bfd_link_hash_common))) + || type == N_WARNING) + { + /* Pass the next symbol through unchanged. The + condition above for indirect symbols is so that if + the indirect symbol was defined, we output it with + the correct definition so the debugger will + understand it. */ + pass = TRUE; + val = GET_WORD (input_bfd, sym->e_value); + symsec = NULL; + } + else if ((type & N_STAB) != 0) + { + val = GET_WORD (input_bfd, sym->e_value); + symsec = NULL; + } + else + { + /* If we get here with an indirect symbol, it means that + we are outputting it with a real definition. In such + a case we do not want to output the next symbol, + which is the target of the indirection. */ + if ((type & N_TYPE) == N_INDR) + skip_next = TRUE; + + symsec = NULL; + + /* We need to get the value from the hash table. We use + hresolve so that if we have defined an indirect + symbol we output the final definition. */ + if (h == (struct aout_link_hash_entry *) NULL) + { + switch (type & N_TYPE) + { + case N_SETT: + symsec = obj_textsec (input_bfd); + break; + case N_SETD: + symsec = obj_datasec (input_bfd); + break; + case N_SETB: + symsec = obj_bsssec (input_bfd); + break; + case N_SETA: + symsec = bfd_abs_section_ptr; + break; + default: + val = 0; + break; + } + } + else if (hresolve->root.type == bfd_link_hash_defined + || hresolve->root.type == bfd_link_hash_defweak) + { + asection *input_section; + asection *output_section; + + /* This case usually means a common symbol which was + turned into a defined symbol. */ + input_section = hresolve->root.u.def.section; + output_section = input_section->output_section; + BFD_ASSERT (bfd_is_abs_section (output_section) + || output_section->owner == output_bfd); + val = (hresolve->root.u.def.value + + bfd_get_section_vma (output_bfd, output_section) + + input_section->output_offset); + + /* Get the correct type based on the section. If + this is a constructed set, force it to be + globally visible. */ + if (type == N_SETT + || type == N_SETD + || type == N_SETB + || type == N_SETA) + type |= N_EXT; + + type &=~ N_TYPE; + + if (output_section == obj_textsec (output_bfd)) + type |= (hresolve->root.type == bfd_link_hash_defined + ? N_TEXT + : N_WEAKT); + else if (output_section == obj_datasec (output_bfd)) + type |= (hresolve->root.type == bfd_link_hash_defined + ? N_DATA + : N_WEAKD); + else if (output_section == obj_bsssec (output_bfd)) + type |= (hresolve->root.type == bfd_link_hash_defined + ? N_BSS + : N_WEAKB); + else + type |= (hresolve->root.type == bfd_link_hash_defined + ? N_ABS + : N_WEAKA); + } + else if (hresolve->root.type == bfd_link_hash_common) + val = hresolve->root.u.c.size; + else if (hresolve->root.type == bfd_link_hash_undefweak) + { + val = 0; + type = N_WEAKU; + } + else + val = 0; + } + if (symsec != (asection *) NULL) + val = (symsec->output_section->vma + + symsec->output_offset + + (GET_WORD (input_bfd, sym->e_value) + - symsec->vma)); + + /* If this is a global symbol set the written flag, and if + it is a local symbol see if we should discard it. */ + if (h != (struct aout_link_hash_entry *) NULL) + { + h->written = TRUE; + h->indx = obj_aout_external_sym_count (output_bfd); + } + else if ((type & N_TYPE) != N_SETT + && (type & N_TYPE) != N_SETD + && (type & N_TYPE) != N_SETB + && (type & N_TYPE) != N_SETA) + { + switch (discard) + { + case discard_none: + case discard_sec_merge: + break; + case discard_l: + if ((type & N_STAB) == 0 + && bfd_is_local_label_name (input_bfd, name)) + skip = TRUE; + break; + case discard_all: + skip = TRUE; + break; + } + if (skip) + { + pass = FALSE; + continue; + } + } + + /* An N_BINCL symbol indicates the start of the stabs + entries for a header file. We need to scan ahead to the + next N_EINCL symbol, ignoring nesting, adding up all the + characters in the symbol names, not including the file + numbers in types (the first number after an open + parenthesis). */ + if (type == N_BINCL) + { + struct external_nlist *incl_sym; + int nest; + struct aout_link_includes_entry *incl_entry; + struct aout_link_includes_totals *t; + + val = 0; + nest = 0; + for (incl_sym = sym + 1; incl_sym < sym_end; incl_sym++) + { + int incl_type; + + incl_type = H_GET_8 (input_bfd, incl_sym->e_type); + if (incl_type == N_EINCL) + { + if (nest == 0) + break; + --nest; + } + else if (incl_type == N_BINCL) + ++nest; + else if (nest == 0) + { + const char *s; + + s = strings + GET_WORD (input_bfd, incl_sym->e_strx); + for (; *s != '\0'; s++) + { + val += *s; + if (*s == '(') + { + /* Skip the file number. */ + ++s; + while (ISDIGIT (*s)) + ++s; + --s; + } + } + } + } + + /* If we have already included a header file with the + same value, then replace this one with an N_EXCL + symbol. */ + copy = ! finfo->info->keep_memory; + incl_entry = aout_link_includes_lookup (&finfo->includes, + name, TRUE, copy); + if (incl_entry == NULL) + return FALSE; + for (t = incl_entry->totals; t != NULL; t = t->next) + if (t->total == val) + break; + if (t == NULL) + { + /* This is the first time we have seen this header + file with this set of stabs strings. */ + t = ((struct aout_link_includes_totals *) + bfd_hash_allocate (&finfo->includes.root, + sizeof *t)); + if (t == NULL) + return FALSE; + t->total = val; + t->next = incl_entry->totals; + incl_entry->totals = t; + } + else + { + int *incl_map; + + /* This is a duplicate header file. We must change + it to be an N_EXCL entry, and mark all the + included symbols to prevent outputting them. */ + type = N_EXCL; + + nest = 0; + for (incl_sym = sym + 1, incl_map = symbol_map + 1; + incl_sym < sym_end; + incl_sym++, incl_map++) + { + int incl_type; + + incl_type = H_GET_8 (input_bfd, incl_sym->e_type); + if (incl_type == N_EINCL) + { + if (nest == 0) + { + *incl_map = -1; + break; + } + --nest; + } + else if (incl_type == N_BINCL) + ++nest; + else if (nest == 0) + *incl_map = -1; + } + } + } + } + + /* Copy this symbol into the list of symbols we are going to + write out. */ + H_PUT_8 (output_bfd, type, outsym->e_type); + copy = FALSE; + if (! finfo->info->keep_memory) + { + /* name points into a string table which we are going to + free. If there is a hash table entry, use that string. + Otherwise, copy name into memory. */ + if (h != (struct aout_link_hash_entry *) NULL) + name = h->root.root.string; + else + copy = TRUE; + } + strtab_index = add_to_stringtab (output_bfd, finfo->strtab, + name, copy); + if (strtab_index == (bfd_size_type) -1) + return FALSE; + PUT_WORD (output_bfd, strtab_index, outsym->e_strx); + PUT_WORD (output_bfd, val, outsym->e_value); + *symbol_map = obj_aout_external_sym_count (output_bfd); + ++obj_aout_external_sym_count (output_bfd); + ++outsym; + } + + /* Write out the output symbols we have just constructed. */ + if (outsym > finfo->output_syms) + { + bfd_size_type size; + + if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0) + return FALSE; + size = outsym - finfo->output_syms; + size *= EXTERNAL_NLIST_SIZE; + if (bfd_bwrite ((PTR) finfo->output_syms, size, output_bfd) != size) + return FALSE; + finfo->symoff += size; + } + + return TRUE; +} + +/* Write out a symbol that was not associated with an a.out input + object. */ + +static bfd_boolean +aout_link_write_other_symbol (h, data) + struct aout_link_hash_entry *h; + PTR data; +{ + struct aout_final_link_info *finfo = (struct aout_final_link_info *) data; + bfd *output_bfd; + int type; + bfd_vma val; + struct external_nlist outsym; + bfd_size_type indx; + bfd_size_type amt; + + if (h->root.type == bfd_link_hash_warning) + { + h = (struct aout_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return TRUE; + } + + output_bfd = finfo->output_bfd; + + if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL) + { + if (! ((*aout_backend_info (output_bfd)->write_dynamic_symbol) + (output_bfd, finfo->info, h))) + { + /* FIXME: No way to handle errors. */ + abort (); + } + } + + if (h->written) + return TRUE; + + h->written = TRUE; + + /* An indx of -2 means the symbol must be written. */ + if (h->indx != -2 + && (finfo->info->strip == strip_all + || (finfo->info->strip == strip_some + && bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string, + FALSE, FALSE) == NULL))) + return TRUE; + + switch (h->root.type) + { + default: + abort (); + /* Avoid variable not initialized warnings. */ + return TRUE; + case bfd_link_hash_new: + /* This can happen for set symbols when sets are not being + built. */ + return TRUE; + case bfd_link_hash_undefined: + type = N_UNDF | N_EXT; + val = 0; + break; + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + { + asection *sec; + + sec = h->root.u.def.section->output_section; + BFD_ASSERT (bfd_is_abs_section (sec) + || sec->owner == output_bfd); + if (sec == obj_textsec (output_bfd)) + type = h->root.type == bfd_link_hash_defined ? N_TEXT : N_WEAKT; + else if (sec == obj_datasec (output_bfd)) + type = h->root.type == bfd_link_hash_defined ? N_DATA : N_WEAKD; + else if (sec == obj_bsssec (output_bfd)) + type = h->root.type == bfd_link_hash_defined ? N_BSS : N_WEAKB; + else + type = h->root.type == bfd_link_hash_defined ? N_ABS : N_WEAKA; + type |= N_EXT; + val = (h->root.u.def.value + + sec->vma + + h->root.u.def.section->output_offset); + } + break; + case bfd_link_hash_common: + type = N_UNDF | N_EXT; + val = h->root.u.c.size; + break; + case bfd_link_hash_undefweak: + type = N_WEAKU; + val = 0; + case bfd_link_hash_indirect: + case bfd_link_hash_warning: + /* FIXME: Ignore these for now. The circumstances under which + they should be written out are not clear to me. */ + return TRUE; + } + + H_PUT_8 (output_bfd, type, outsym.e_type); + indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string, + FALSE); + if (indx == (bfd_size_type) -1) + { + /* FIXME: No way to handle errors. */ + abort (); + } + PUT_WORD (output_bfd, indx, outsym.e_strx); + PUT_WORD (output_bfd, val, outsym.e_value); + + amt = EXTERNAL_NLIST_SIZE; + if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0 + || bfd_bwrite ((PTR) &outsym, amt, output_bfd) != amt) + { + /* FIXME: No way to handle errors. */ + abort (); + } + + finfo->symoff += amt; + h->indx = obj_aout_external_sym_count (output_bfd); + ++obj_aout_external_sym_count (output_bfd); + + return TRUE; +} + +/* Link an a.out section into the output file. */ + +static bfd_boolean +aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr, + rel_size) + struct aout_final_link_info *finfo; + bfd *input_bfd; + asection *input_section; + file_ptr *reloff_ptr; + bfd_size_type rel_size; +{ + bfd_size_type input_size; + PTR relocs; + + /* Get the section contents. */ + input_size = bfd_section_size (input_bfd, input_section); + if (! bfd_get_section_contents (input_bfd, input_section, + (PTR) finfo->contents, + (file_ptr) 0, input_size)) + return FALSE; + + /* Read in the relocs if we haven't already done it. */ + if (aout_section_data (input_section) != NULL + && aout_section_data (input_section)->relocs != NULL) + relocs = aout_section_data (input_section)->relocs; + else + { + relocs = finfo->relocs; + if (rel_size > 0) + { + if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 + || bfd_bread (relocs, rel_size, input_bfd) != rel_size) + return FALSE; + } + } + + /* Relocate the section contents. */ + if (! pdp11_aout_link_input_section (finfo, input_bfd, input_section, + (struct pdp11_aout_reloc_external *) relocs, + rel_size, finfo->contents)) + return FALSE; + + /* Write out the section contents. */ + if (! bfd_set_section_contents (finfo->output_bfd, + input_section->output_section, + (PTR) finfo->contents, + (file_ptr) input_section->output_offset, + input_size)) + return FALSE; + + /* If we are producing relocatable output, the relocs were + modified, and we now write them out. */ + if (finfo->info->relocatable && rel_size > 0) + { + if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0) + return FALSE; + if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size) + return FALSE; + *reloff_ptr += rel_size; + + /* Assert that the relocs have not run into the symbols, and + that if these are the text relocs they have not run into the + data relocs. */ + BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd) + && (reloff_ptr != &finfo->treloff + || (*reloff_ptr + <= obj_datasec (finfo->output_bfd)->rel_filepos))); + } + + return TRUE; +} + +/* Get the section corresponding to a reloc index. */ + +static INLINE asection * +aout_reloc_type_to_section (abfd, type) + bfd *abfd; + int type; +{ + switch (type) + { + case RTEXT: + return obj_textsec (abfd); + case RDATA: + return obj_datasec (abfd); + case RBSS: + return obj_bsssec (abfd); + case RABS: + return bfd_abs_section_ptr; + case REXT: + return bfd_und_section_ptr; + default: + abort (); + } +} + +static bfd_boolean +pdp11_aout_link_input_section (finfo, input_bfd, input_section, relocs, + rel_size, contents) + struct aout_final_link_info *finfo; + bfd *input_bfd; + asection *input_section; + struct pdp11_aout_reloc_external *relocs; + bfd_size_type rel_size; + bfd_byte *contents; +{ + bfd_boolean (*check_dynamic_reloc) + PARAMS ((struct bfd_link_info *, bfd *, asection *, + struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *, + bfd_vma *)); + bfd *output_bfd; + bfd_boolean relocatable; + struct external_nlist *syms; + char *strings; + struct aout_link_hash_entry **sym_hashes; + int *symbol_map; + bfd_size_type reloc_count; + register struct pdp11_aout_reloc_external *rel; + struct pdp11_aout_reloc_external *rel_end; + + output_bfd = finfo->output_bfd; + check_dynamic_reloc = aout_backend_info (output_bfd)->check_dynamic_reloc; + + BFD_ASSERT (obj_reloc_entry_size (input_bfd) == RELOC_SIZE); + BFD_ASSERT (input_bfd->xvec->header_byteorder + == output_bfd->xvec->header_byteorder); + + relocatable = finfo->info->relocatable; + syms = obj_aout_external_syms (input_bfd); + strings = obj_aout_external_strings (input_bfd); + sym_hashes = obj_aout_sym_hashes (input_bfd); + symbol_map = finfo->symbol_map; + + reloc_count = rel_size / RELOC_SIZE; + rel = relocs; + rel_end = (struct pdp11_aout_reloc_external *)(((char *)rel) + rel_size); + for (; rel < rel_end; ((char *)rel) += RELOC_SIZE) + { + bfd_vma r_addr; + int r_index; + int r_type; + int r_pcrel; + int r_extern; + reloc_howto_type *howto; + struct aout_link_hash_entry *h = NULL; + bfd_vma relocation; + bfd_reloc_status_type r; + int reloc_entry; + + reloc_entry = GET_WORD (input_bfd, (PTR)rel); + if (reloc_entry == 0) + continue; + + { + unsigned int howto_idx; + + r_index = (reloc_entry & RIDXMASK) >> 4; + r_type = reloc_entry & RTYPE; + r_pcrel = reloc_entry & RELFLG; + r_addr = (char *)rel - (char *)relocs; + + r_extern = (r_type == REXT); + + howto_idx = r_pcrel; + BFD_ASSERT (howto_idx < TABLE_SIZE (howto_table_pdp11)); + howto = howto_table_pdp11 + howto_idx; + } + + if (relocatable) + { + /* We are generating a relocatable output file, and must + modify the reloc accordingly. */ + if (r_extern) + { + /* If we know the symbol this relocation is against, + convert it into a relocation against a section. This + is what the native linker does. */ + h = sym_hashes[r_index]; + if (h != (struct aout_link_hash_entry *) NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)) + { + asection *output_section; + + /* Compute a new r_index. */ + output_section = h->root.u.def.section->output_section; + if (output_section == obj_textsec (output_bfd)) + r_type = N_TEXT; + else if (output_section == obj_datasec (output_bfd)) + r_type = N_DATA; + else if (output_section == obj_bsssec (output_bfd)) + r_type = N_BSS; + else + r_type = N_ABS; + + /* Add the symbol value and the section VMA to the + addend stored in the contents. */ + relocation = (h->root.u.def.value + + output_section->vma + + h->root.u.def.section->output_offset); + } + else + { + /* We must change r_index according to the symbol + map. */ + r_index = symbol_map[r_index]; + + if (r_index == -1) + { + if (h != NULL) + { + /* We decided to strip this symbol, but it + turns out that we can't. Note that we + lose the other and desc information here. + I don't think that will ever matter for a + global symbol. */ + if (h->indx < 0) + { + h->indx = -2; + h->written = FALSE; + if (! aout_link_write_other_symbol (h, + (PTR) finfo)) + return FALSE; + } + r_index = h->indx; + } + else + { + const char *name; + + name = strings + GET_WORD (input_bfd, + syms[r_index].e_strx); + if (! ((*finfo->info->callbacks->unattached_reloc) + (finfo->info, name, input_bfd, input_section, + r_addr))) + return FALSE; + r_index = 0; + } + } + + relocation = 0; + } + + /* Write out the new r_index value. */ + reloc_entry = GET_WORD (input_bfd, rel->e_reloc_entry); + reloc_entry &= RIDXMASK; + reloc_entry |= r_index << 4; + PUT_WORD (input_bfd, reloc_entry, rel->e_reloc_entry); + } + else + { + asection *section; + + /* This is a relocation against a section. We must + adjust by the amount that the section moved. */ + section = aout_reloc_type_to_section (input_bfd, r_type); + relocation = (section->output_section->vma + + section->output_offset + - section->vma); + } + + /* Change the address of the relocation. */ +#if 0 + PUT_WORD (output_bfd, + r_addr + input_section->output_offset, + rel->r_address); +#else +fprintf (stderr, "TODO: change the address of the relocation\n"); +#endif + + /* Adjust a PC relative relocation by removing the reference + to the original address in the section and including the + reference to the new address. */ + if (r_pcrel) + relocation -= (input_section->output_section->vma + + input_section->output_offset + - input_section->vma); + +#ifdef MY_relocatable_reloc + MY_relocatable_reloc (howto, output_bfd, rel, relocation, r_addr); +#endif + + if (relocation == 0) + r = bfd_reloc_ok; + else + r = MY_relocate_contents (howto, + input_bfd, relocation, + contents + r_addr); + } + else + { + bfd_boolean hundef; + + /* We are generating an executable, and must do a full + relocation. */ + hundef = FALSE; + if (r_extern) + { + h = sym_hashes[r_index]; + + if (h != (struct aout_link_hash_entry *) NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)) + { + relocation = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + else if (h != (struct aout_link_hash_entry *) NULL + && h->root.type == bfd_link_hash_undefweak) + relocation = 0; + else + { + hundef = TRUE; + relocation = 0; + } + } + else + { + asection *section; + + section = aout_reloc_type_to_section (input_bfd, r_type); + relocation = (section->output_section->vma + + section->output_offset + - section->vma); + if (r_pcrel) + relocation += input_section->vma; + } + + if (check_dynamic_reloc != NULL) + { + bfd_boolean skip; + + if (! ((*check_dynamic_reloc) + (finfo->info, input_bfd, input_section, h, + (PTR) rel, contents, &skip, &relocation))) + return FALSE; + if (skip) + continue; + } + + /* Now warn if a global symbol is undefined. We could not + do this earlier, because check_dynamic_reloc might want + to skip this reloc. */ + if (hundef && ! finfo->info->shared) + { + const char *name; + + if (h != NULL) + name = h->root.root.string; + else + name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); + if (! ((*finfo->info->callbacks->undefined_symbol) + (finfo->info, name, input_bfd, input_section, + r_addr, TRUE))) + return FALSE; + } + + r = MY_final_link_relocate (howto, + input_bfd, input_section, + contents, r_addr, relocation, + (bfd_vma) 0); + } + + if (r != bfd_reloc_ok) + { + switch (r) + { + default: + case bfd_reloc_outofrange: + abort (); + case bfd_reloc_overflow: + { + const char *name; + + if (h != NULL) + name = h->root.root.string; + else if (r_extern) + name = strings + GET_WORD (input_bfd, + syms[r_index].e_strx); + else + { + asection *s; + + s = aout_reloc_type_to_section (input_bfd, r_type); + name = bfd_section_name (input_bfd, s); + } + if (! ((*finfo->info->callbacks->reloc_overflow) + (finfo->info, name, howto->name, + (bfd_vma) 0, input_bfd, input_section, r_addr))) + return FALSE; + } + break; + } + } + } + + return TRUE; +} + +/* Handle a link order which is supposed to generate a reloc. */ + +static bfd_boolean +aout_link_reloc_link_order (finfo, o, p) + struct aout_final_link_info *finfo; + asection *o; + struct bfd_link_order *p; +{ + struct bfd_link_order_reloc *pr; + int r_index; + int r_extern; + reloc_howto_type *howto; + file_ptr *reloff_ptr; + struct reloc_std_external srel; + PTR rel_ptr; + bfd_size_type rel_size; + + pr = p->u.reloc.p; + + if (p->type == bfd_section_reloc_link_order) + { + r_extern = 0; + if (bfd_is_abs_section (pr->u.section)) + r_index = N_ABS | N_EXT; + else + { + BFD_ASSERT (pr->u.section->owner == finfo->output_bfd); + r_index = pr->u.section->target_index; + } + } + else + { + struct aout_link_hash_entry *h; + + BFD_ASSERT (p->type == bfd_symbol_reloc_link_order); + r_extern = 1; + h = ((struct aout_link_hash_entry *) + bfd_wrapped_link_hash_lookup (finfo->output_bfd, finfo->info, + pr->u.name, FALSE, FALSE, TRUE)); + if (h != (struct aout_link_hash_entry *) NULL + && h->indx >= 0) + r_index = h->indx; + else if (h != NULL) + { + /* We decided to strip this symbol, but it turns out that we + can't. Note that we lose the other and desc information + here. I don't think that will ever matter for a global + symbol. */ + h->indx = -2; + h->written = FALSE; + if (! aout_link_write_other_symbol (h, (PTR) finfo)) + return FALSE; + r_index = h->indx; + } + else + { + if (! ((*finfo->info->callbacks->unattached_reloc) + (finfo->info, pr->u.name, (bfd *) NULL, + (asection *) NULL, (bfd_vma) 0))) + return FALSE; + r_index = 0; + } + } + + howto = bfd_reloc_type_lookup (finfo->output_bfd, pr->reloc); + if (howto == 0) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + if (o == obj_textsec (finfo->output_bfd)) + reloff_ptr = &finfo->treloff; + else if (o == obj_datasec (finfo->output_bfd)) + reloff_ptr = &finfo->dreloff; + else + abort (); + +#ifdef MY_put_reloc + MY_put_reloc(finfo->output_bfd, r_extern, r_index, p->offset, howto, + &srel); +#else + { + int r_pcrel; + int r_baserel; + int r_jmptable; + int r_relative; + int r_length; + + fprintf (stderr, "TODO: line %d in bfd/pdp11.c\n", __LINE__); + + r_pcrel = howto->pc_relative; + r_baserel = (howto->type & 8) != 0; + r_jmptable = (howto->type & 16) != 0; + r_relative = (howto->type & 32) != 0; + r_length = howto->size; + + PUT_WORD (finfo->output_bfd, p->offset, srel.r_address); + if (bfd_header_big_endian (finfo->output_bfd)) + { + srel.r_index[0] = r_index >> 16; + srel.r_index[1] = r_index >> 8; + srel.r_index[2] = r_index; + srel.r_type[0] = + ((r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0) + | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0) + | (r_baserel ? RELOC_STD_BITS_BASEREL_BIG : 0) + | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_BIG : 0) + | (r_relative ? RELOC_STD_BITS_RELATIVE_BIG : 0) + | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG)); + } + else + { + srel.r_index[2] = r_index >> 16; + srel.r_index[1] = r_index >> 8; + srel.r_index[0] = r_index; + srel.r_type[0] = + ((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0) + | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0) + | (r_baserel ? RELOC_STD_BITS_BASEREL_LITTLE : 0) + | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_LITTLE : 0) + | (r_relative ? RELOC_STD_BITS_RELATIVE_LITTLE : 0) + | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE)); + } + } +#endif + rel_ptr = (PTR) &srel; + + /* We have to write the addend into the object file, since + standard a.out relocs are in place. It would be more + reliable if we had the current contents of the file here, + rather than assuming zeroes, but we can't read the file since + it was opened using bfd_openw. */ + if (pr->addend != 0) + { + bfd_size_type size; + bfd_reloc_status_type r; + bfd_byte *buf; + bfd_boolean ok; + + size = bfd_get_reloc_size (howto); + buf = (bfd_byte *) bfd_zmalloc (size); + if (buf == (bfd_byte *) NULL) + return FALSE; + r = MY_relocate_contents (howto, finfo->output_bfd, + pr->addend, buf); + switch (r) + { + case bfd_reloc_ok: + break; + default: + case bfd_reloc_outofrange: + abort (); + case bfd_reloc_overflow: + if (! ((*finfo->info->callbacks->reloc_overflow) + (finfo->info, + (p->type == bfd_section_reloc_link_order + ? bfd_section_name (finfo->output_bfd, + pr->u.section) + : pr->u.name), + howto->name, pr->addend, (bfd *) NULL, + (asection *) NULL, (bfd_vma) 0))) + { + free (buf); + return FALSE; + } + break; + } + ok = bfd_set_section_contents (finfo->output_bfd, o, + (PTR) buf, + (file_ptr) p->offset, + size); + free (buf); + if (! ok) + return FALSE; + } + + rel_size = obj_reloc_entry_size (finfo->output_bfd); + if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0 + || bfd_bwrite (rel_ptr, rel_size, finfo->output_bfd) != rel_size) + return FALSE; + + *reloff_ptr += rel_size; + + /* Assert that the relocs have not run into the symbols, and that n + the text relocs have not run into the data relocs. */ + BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd) + && (reloff_ptr != &finfo->treloff + || (*reloff_ptr + <= obj_datasec (finfo->output_bfd)->rel_filepos))); + + return TRUE; +} +/* end of modified aoutx.h */ + +static bfd_vma +bfd_getp32 (const void *p) +{ + const bfd_byte *addr = p; + unsigned long v; + v = (unsigned long) addr[1] << 24; + v |= (unsigned long) addr[0] << 16; + v |= (unsigned long) addr[3] << 8; + v |= (unsigned long) addr[2]; + return v; +} + +#define COERCE32(x) (((bfd_signed_vma) (x) ^ 0x80000000) - 0x80000000) + +static bfd_signed_vma +bfd_getp_signed_32 (const void *p) +{ + const bfd_byte *addr = p; + unsigned long v; + v = (unsigned long) addr[1] << 24; + v |= (unsigned long) addr[0] << 16; + v |= (unsigned long) addr[3] << 8; + v |= (unsigned long) addr[2]; + return COERCE32 (v); +} + +static void +bfd_putp32 (bfd_vma data, void *p) +{ + bfd_byte *addr = p; + addr[0] = (data >> 16) & 0xff; + addr[1] = (data >> 24) & 0xff; + addr[2] = (data >> 0) & 0xff; + addr[3] = (data >> 8) & 0xff; +} diff --git a/bfd/pe-mcore.c b/bfd/pe-mcore.c new file mode 100644 index 0000000000000..1fcb0dd42cd9e --- /dev/null +++ b/bfd/pe-mcore.c @@ -0,0 +1,36 @@ +/* BFD back-end for MCore PECOFF files. + Copyright 1999, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" + +#ifndef TARGET_BIG_SYM +#define TARGET_BIG_SYM mcore_pe_big_vec +#define TARGET_BIG_NAME "pe-mcore-big" +#define TARGET_LITTLE_SYM mcore_pe_little_vec +#define TARGET_LITTLE_NAME "pe-mcore-little" +#endif + +#define COFF_WITH_PE +#define PCRELOFFSET TRUE +#define COFF_LONG_SECTION_NAMES + +#define MCORE_PE + +#include "coff-mcore.c" diff --git a/bfd/pe-sh.c b/bfd/pe-sh.c new file mode 100644 index 0000000000000..684d9a7611f9a --- /dev/null +++ b/bfd/pe-sh.c @@ -0,0 +1,30 @@ +/* BFD back-end for SH PECOFF files. + Copyright 1995, 2000, 2001, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" + +#define TARGET_SHL_SYM shlpe_vec +#define TARGET_SHL_NAME "pe-shl" +#define COFF_WITH_PE +#define PCRELOFFSET TRUE +#define TARGET_UNDERSCORE '_' +#define COFF_LONG_SECTION_NAMES + +#include "coff-sh.c" diff --git a/bfd/pef-traceback.h b/bfd/pef-traceback.h new file mode 100644 index 0000000000000..15f43b6e594ce --- /dev/null +++ b/bfd/pef-traceback.h @@ -0,0 +1,215 @@ +/* PowerPC traceback table support for BFD. + Copyright 1993, 1998, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +/* Originally written by Ira Ruben, 06/28/93 */ + +/* This is a compiler independent representation of the AIX Version 3 traceback table (in + sys/debug.h), which occurs, usually, one per procedure (routine). The table is marked by + a multiple of 4 32-bit word of zeroes in the instruction space. The traceback table is + also referred to as "procedure-end table". + + The AIX traceback table representation on which this header is based is defined as a + series of bit field struct specifications. Bit fields are compiler dependent! Thus, + the definitions presented here follow the original header and the existing documentation + (such as it is), but define the fields as BIT MASKS and other macros. The mask names, + however, where chosen as the original field names to give some compatibility with the + original header and to agree with the documentation. */ + +#ifndef __TRACEBACK__ +#define __TRACEBACK__ + +#define TB_C 0U /* C */ +#define TB_FORTRAN 1U /* FORTRAN */ +#define TB_PASCAL 2U /* Pascal */ +#define TB_ADA 3U /* ADA */ +#define TB_PL1 4U /* PL1 */ +#define TB_BASIC 5U /* Basic */ +#define TB_LISP 6U /* Lisp */ +#define TB_COBOL 7U /* eCobol */ +#define TB_MODULA2 8U /* Modula2 */ +#define TB_CPLUSPLUS 9U /* C++ */ +#define TB_RPG 10U /* RPG */ +#define TB_PL8 11U /* PL8 */ +#define TB_ASM 12U /* Asm */ + +/* flags 1 */ + +#define TB_GLOBALLINK 0x80U /* Routine is Global Linkage. */ +#define TB_is_eprol 0x40U /* Out-of-line prolog or epilog routine. */ +#define TB_HAS_TBOFF 0x20U /* tb_offset set (extension field). */ +#define TB_INT_PROC 0x10U /* Internal leaf routine. */ +#define TB_HAS_CTL 0x08U /* Has controlled automatic storage. */ +#define TB_TOCLESS 0X04U /* Routine has no TOC. */ +#define TB_FP_PRESENT 0x02U /* Routine has floating point ops. */ +#define TB_LOG_ABORT 0x01U /* fp_present && log/abort compiler opt. */ + +/* flags 2 */ + +#define TB_INT_HNDL 0x80U /* Routine is an interrupt handler. */ +#define TB_NAME_PRESENT 0x40U /* Name_len/name set (extension field). */ +#define TB_USES_ALLOCA 0x20U /* Uses alloca() to allocate storage. */ +#define TB_CL_DIS_inv 0x1CU /* On-condition directives (see below). */ +#define TB_SAVES_CR 0x02U /* Routine saves the CR. */ +#define TB_SAVES_LR 0x01U /* Routine saves the LR. */ + +/* cl_dis_inv "on condition" settings: */ + +#define TB_CL_DIS_INV(x) (((x) & cl_dis_inv) >> 2U) + +#define TB_WALK_ONCOND 0U /* Walk stack without restoring state. */ +#define TB_DISCARD_ONCOND 1U /* Walk stack and discard. */ +#define TB_INVOKE_ONCOND 2U /* Invoke a specific system routine. */ + +/* flags 3 */ + +#define TB_STORES_BC 0x80U /* Routine saves frame ptr of caller. */ +#define TB_SPARE2 0X40U /* Spare bit. */ +#define TB_FPR_SAVED 0x3fU /* Number of FPRs saved (max of 32). */ + /* (Last reg saved is ALWAYS fpr31). */ + +#define TB_NUM_FPR_SAVED(x) ((x) & fpr_saved) + +/* flags 4 */ + +#define TB_HAS_VEC_INFO 0x80U /* Routine uses vectors. */ +#define TB_SPARE3 0X40U /* Spare bit. */ +#define TB_GPR_SAVED 0x3fU /* Number of GPRs saved (max of 32). */ + /* (Last reg saved is ALWAYS gpr31). */ + +#define TB_NUM_GPR_SAVED(x) ((x) & gpr_saved) + +/* flags 5 */ + +#define TB_FLOATPARAMS 0xfeU /* Number of floating point parameters. */ +#define TB_PARAMSONSTK 0X01U /* All parameters are on the stack. */ + +#define TB_NUM_FLOATPARAMS(X) (((x) & floatparams) >> 1U) + +/* traceback_table (fixed portion). */ + +struct traceback_table +{ + /* Traceback table layout (fixed portion): */ + + unsigned char version; /* Traceback format version. */ + unsigned char lang; /* Language indicators: */ + unsigned char flags1; /* Flag bits #1: */ + unsigned char flags2; /* Flag bits #2: */ + unsigned char flags3; /* Flag bits #3: */ + unsigned char flags4; /* Flag bits #4: */ + unsigned char fixedparams; /* Number of fixed point parameters. */ + unsigned char flags5; /* Flag bits #5: */ +}; + +/* traceback_table (optional) extensions. */ + +/* Optional portions exist independently in the order presented below, + not as a structure or a union. Whether or not portions exist is + determinable from bit-fields within the fixed portion above. */ + +/* The following is present only if fixedparams or floatparams are non + zero and it immediately follows the fixed portion of the traceback + table... */ + +/* Order and type encoding of parameters: */ +struct traceback_table_fixedparams +{ + unsigned long paraminfo; +}; + +/* Left-justified bit-encoding as follows: */ +#define FIXED_PARAM 0 /* '0' ==> fixed param (1 gpr or word). */ +#define SPFP_PARAM 2 /* '10' ==> single-precision float param. */ +#define DPFP_PARAM 3 /* '11' ==> double-precision float param. */ + +#define PARAM_ENCODING(x, bit) /* Yields xxx_PARAM as a function of "bit". */ \ + ((((x)&(1UL<<(31UL-(bit++))))==0UL) /* Values 0:31 (left-to-right). "bit" is */ \ + ? FIXED_PARAM /* an L-value that's left incremented to */ \ + : ((((x)&(1UL<<(31UL-(bit++))))==0)/* the next bit position for the next */ \ + ? SPFP_PARAM /* parameter. This will be 1 or 2 bit */ \ + : DPFP_PARAM)) /* positions later. */ + +/* The following is present only if has_tboff (in flags1) in fixed part is present... */ + +/* Offset from start of code to TracebackTbl. */ +struct traceback_table_tboff +{ + unsigned long tb_offset; +}; + +/* The following is present only if int_hndl (in flags2) in fixed part is present ... */ + +/* What interrupts are handled by the routine. */ +struct traceback_table_interrupts +{ + long hand_mask; +}; + +/* The following are present only if has_ctl (in flags1) in fixed part is present... */ + +/* Controlled automatic storage info: */ +struct traceback_table_anchors +{ + unsigned long ctl_info; /* Number of controlled automatic anchors. */ + long ctl_info_disp[1]; /* Array of stack displacements where each. */ +}; /* Anchor is located (array STARTS here). */ + +/* The following are present only if name_present (in flags2) in fixed + part is present... */ + +/* Routine name: */ +struct traceback_table_routine +{ + unsigned short name_len; /* Length of name that follows. */ + char name[1]; /* Name starts here (NOT null terminated). */ +}; + +/* The following are present only if uses_alloca (in flags2) in fixed + part is present... */ + +/* Register auto storage when alloca() is used. */ +struct traceback_table_alloca +{ + char alloca_reg; +}; + +/* The following are present only if has_vec_info (in flags4) in fixed + part is present... */ + +/* Vector info: */ +struct traceback_table_vector +{ + unsigned char vec_flags1; /* Vec info bits #1: */ + +#define TB_VR_SAVED 0xFCU /* Number of saved vector registers. */ +#define TB_SAVES_VRSAVE 0x02U /* Saves VRsave. */ +#define TB_HAS_VARARGS 0x01U /* Routine has a variable argument list. */ + +#define TB_NUM_VR_SAVED(x) (((x) & TB_VR_SAVED) >> 2U) + + unsigned char vec_flags2; /* Vec info bits #2: */ + +#define TB_VECTORPARAMS 0xfeU /* Number of vector parameters. */ +#define TB_VEC_PRESENT 0x01U /* Routine uses at least one vec instr. */ + +#define VECPARAMS(x) (((x) & TB_VECTORPARAMS) >> 1U) +}; + +#endif diff --git a/bfd/pef.c b/bfd/pef.c new file mode 100644 index 0000000000000..7d758cf57d219 --- /dev/null +++ b/bfd/pef.c @@ -0,0 +1,1292 @@ +/* PEF support for BFD. + Copyright 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "safe-ctype.h" + +#include "pef.h" +#include "pef-traceback.h" + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#include "libiberty.h" + +#ifndef BFD_IO_FUNCS +#define BFD_IO_FUNCS 0 +#endif + +#define bfd_pef_close_and_cleanup _bfd_generic_close_and_cleanup +#define bfd_pef_bfd_free_cached_info _bfd_generic_bfd_free_cached_info +#define bfd_pef_new_section_hook _bfd_generic_new_section_hook +#define bfd_pef_bfd_is_local_label_name bfd_generic_is_local_label_name +#define bfd_pef_get_lineno _bfd_nosymbols_get_lineno +#define bfd_pef_find_nearest_line _bfd_nosymbols_find_nearest_line +#define bfd_pef_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define bfd_pef_read_minisymbols _bfd_generic_read_minisymbols +#define bfd_pef_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol +#define bfd_pef_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound +#define bfd_pef_canonicalize_reloc _bfd_norelocs_canonicalize_reloc +#define bfd_pef_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +#define bfd_pef_set_arch_mach _bfd_generic_set_arch_mach +#define bfd_pef_get_section_contents _bfd_generic_get_section_contents +#define bfd_pef_set_section_contents _bfd_generic_set_section_contents +#define bfd_pef_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents +#define bfd_pef_bfd_relax_section bfd_generic_relax_section +#define bfd_pef_bfd_gc_sections bfd_generic_gc_sections +#define bfd_pef_bfd_merge_sections bfd_generic_merge_sections +#define bfd_pef_bfd_discard_group bfd_generic_discard_group +#define bfd_pef_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define bfd_pef_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define bfd_pef_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define bfd_pef_bfd_link_just_syms _bfd_generic_link_just_syms +#define bfd_pef_bfd_final_link _bfd_generic_final_link +#define bfd_pef_bfd_link_split_section _bfd_generic_link_split_section +#define bfd_pef_get_section_contents_in_window _bfd_generic_get_section_contents_in_window + +static void bfd_pef_print_symbol PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); +static void bfd_pef_convert_architecture PARAMS ((unsigned long, enum bfd_architecture *, unsigned long *)); +static bfd_boolean bfd_pef_mkobject PARAMS ((bfd *)); +static int bfd_pef_parse_traceback_table PARAMS ((bfd *, asection *, unsigned char *, size_t, size_t, asymbol *, FILE *)); +static const char *bfd_pef_section_name PARAMS ((bfd_pef_section *)); +static unsigned long bfd_pef_section_flags PARAMS ((bfd_pef_section *)); +static asection *bfd_pef_make_bfd_section PARAMS ((bfd *, bfd_pef_section *)); +static int bfd_pef_read_header PARAMS ((bfd *, bfd_pef_header *)); +static const bfd_target *bfd_pef_object_p PARAMS ((bfd *)); +static int bfd_pef_parse_traceback_tables PARAMS ((bfd *, asection *, unsigned char *, size_t, long *, asymbol **)); +static int bfd_pef_parse_function_stub PARAMS ((bfd *, unsigned char *, size_t, unsigned long *)); +static int bfd_pef_parse_function_stubs PARAMS ((bfd *, asection *, unsigned char *, size_t, unsigned char *, size_t, unsigned long *, asymbol **)); +static long bfd_pef_parse_symbols PARAMS ((bfd *, asymbol **)); +static long bfd_pef_count_symbols PARAMS ((bfd *)); +static long bfd_pef_get_symtab_upper_bound PARAMS ((bfd *)); +static long bfd_pef_canonicalize_symtab PARAMS ((bfd *, asymbol **)); +static asymbol *bfd_pef_make_empty_symbol PARAMS ((bfd *)); +static void bfd_pef_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); +static int bfd_pef_sizeof_headers PARAMS ((bfd *, bfd_boolean)); +static int bfd_pef_xlib_read_header PARAMS ((bfd *, bfd_pef_xlib_header *)); +static int bfd_pef_xlib_scan PARAMS ((bfd *, bfd_pef_xlib_header *)); +static const bfd_target *bfd_pef_xlib_object_p PARAMS ((bfd *)); + +static void +bfd_pef_print_symbol (abfd, afile, symbol, how) + bfd *abfd; + PTR afile; + asymbol *symbol; + bfd_print_symbol_type how; +{ + FILE *file = (FILE *) afile; + + switch (how) + { + case bfd_print_symbol_name: + fprintf (file, "%s", symbol->name); + break; + default: + bfd_print_symbol_vandf (abfd, (PTR) file, symbol); + fprintf (file, " %-5s %s", symbol->section->name, symbol->name); + if (strncmp (symbol->name, "__traceback_", strlen ("__traceback_")) == 0) + { + char *buf = alloca (symbol->udata.i); + size_t offset = symbol->value + 4; + size_t len = symbol->udata.i; + int ret; + + bfd_get_section_contents (abfd, symbol->section, buf, offset, len); + ret = bfd_pef_parse_traceback_table (abfd, symbol->section, buf, + len, 0, NULL, file); + if (ret < 0) + fprintf (file, " [ERROR]"); + } + } +} + +static void +bfd_pef_convert_architecture (architecture, type, subtype) + unsigned long architecture; + enum bfd_architecture *type; + unsigned long *subtype; +{ + const unsigned long ARCH_POWERPC = 0x70777063; /* 'pwpc' */ + const unsigned long ARCH_M68K = 0x6d36386b; /* 'm68k' */ + + *subtype = bfd_arch_unknown; + *type = bfd_arch_unknown; + + if (architecture == ARCH_POWERPC) + *type = bfd_arch_powerpc; + else if (architecture == ARCH_M68K) + *type = bfd_arch_m68k; +} + +static bfd_boolean +bfd_pef_mkobject (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ + return TRUE; +} + +static int +bfd_pef_parse_traceback_table (abfd, section, buf, len, pos, sym, file) + bfd *abfd; + asection *section; + unsigned char *buf; + size_t len; + size_t pos; + asymbol *sym; + FILE *file; +{ + struct traceback_table table; + size_t offset; + const char *s; + asymbol tmpsymbol; + + if (sym == NULL) + sym = &tmpsymbol; + + sym->name = NULL; + sym->value = 0; + sym->the_bfd = abfd; + sym->section = section; + sym->flags = 0; + sym->udata.i = 0; + + /* memcpy is fine since all fields are unsigned char. */ + + if ((pos + 8) > len) + return -1; + memcpy (&table, buf + pos, 8); + + /* Calling code relies on returned symbols having a name and + correct offset. */ + + if ((table.lang != TB_C) && (table.lang != TB_CPLUSPLUS)) + return -1; + + if (! (table.flags2 & TB_NAME_PRESENT)) + return -1; + + if (! table.flags1 & TB_HAS_TBOFF) + return -1; + + offset = 8; + + if ((table.flags5 & TB_FLOATPARAMS) || (table.fixedparams)) + offset += 4; + + if (table.flags1 & TB_HAS_TBOFF) + { + struct traceback_table_tboff off; + + if ((pos + offset + 4) > len) + return -1; + off.tb_offset = bfd_getb32 (buf + pos + offset); + offset += 4; + + /* Need to subtract 4 because the offset includes the 0x0L + preceding the table. */ + + if (file != NULL) + fprintf (file, " [offset = 0x%lx]", off.tb_offset); + + if ((file == NULL) && ((off.tb_offset + 4) > (pos + offset))) + return -1; + + sym->value = pos - off.tb_offset - 4; + } + + if (table.flags2 & TB_INT_HNDL) + offset += 4; + + if (table.flags1 & TB_HAS_CTL) + { + struct traceback_table_anchors anchors; + + if ((pos + offset + 4) > len) + return -1; + anchors.ctl_info = bfd_getb32 (buf + pos + offset); + offset += 4; + + if (anchors.ctl_info > 1024) + return -1; + + offset += anchors.ctl_info * 4; + } + + if (table.flags2 & TB_NAME_PRESENT) + { + struct traceback_table_routine name; + char *namebuf; + + if ((pos + offset + 2) > len) + return -1; + name.name_len = bfd_getb16 (buf + pos + offset); + offset += 2; + + if (name.name_len > 4096) + return -1; + + if ((pos + offset + name.name_len) > len) + return -1; + + namebuf = (char *) bfd_alloc (abfd, name.name_len + 1); + if (namebuf == NULL) + return -1; + + memcpy (namebuf, buf + pos + offset, name.name_len); + namebuf[name.name_len] = '\0'; + + /* Strip leading period inserted by compiler. */ + if (namebuf[0] == '.') + memmove (namebuf, namebuf + 1, name.name_len + 1); + + sym->name = namebuf; + + for (s = sym->name; (*s != '\0'); s++) + if (! ISPRINT (*s)) + return -1; + + offset += name.name_len; + } + + if (table.flags2 & TB_USES_ALLOCA) + offset += 4; + + if (table.flags4 & TB_HAS_VEC_INFO) + offset += 4; + + if (file != NULL) + fprintf (file, " [length = 0x%lx]", (long) offset); + + return offset; +} + +static const char *bfd_pef_section_name (section) + bfd_pef_section *section; +{ + switch (section->section_kind) + { + case BFD_PEF_SECTION_CODE: return "code"; + case BFD_PEF_SECTION_UNPACKED_DATA: return "unpacked-data"; + case BFD_PEF_SECTION_PACKED_DATA: return "packed-data"; + case BFD_PEF_SECTION_CONSTANT: return "constant"; + case BFD_PEF_SECTION_LOADER: return "loader"; + case BFD_PEF_SECTION_DEBUG: return "debug"; + case BFD_PEF_SECTION_EXEC_DATA: return "exec-data"; + case BFD_PEF_SECTION_EXCEPTION: return "exception"; + case BFD_PEF_SECTION_TRACEBACK: return "traceback"; + default: return "unknown"; + } +} + +static unsigned long bfd_pef_section_flags (section) + bfd_pef_section *section; +{ + switch (section->section_kind) + { + case BFD_PEF_SECTION_CODE: + return SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE; + case BFD_PEF_SECTION_UNPACKED_DATA: + case BFD_PEF_SECTION_PACKED_DATA: + case BFD_PEF_SECTION_CONSTANT: + case BFD_PEF_SECTION_LOADER: + case BFD_PEF_SECTION_DEBUG: + case BFD_PEF_SECTION_EXEC_DATA: + case BFD_PEF_SECTION_EXCEPTION: + case BFD_PEF_SECTION_TRACEBACK: + default: + return SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; + } +} + +static asection * +bfd_pef_make_bfd_section (abfd, section) + bfd *abfd; + bfd_pef_section *section; +{ + asection *bfdsec; + const char *name = bfd_pef_section_name (section); + + bfdsec = bfd_make_section_anyway (abfd, name); + if (bfdsec == NULL) + return NULL; + + bfdsec->vma = section->default_address + section->container_offset; + bfdsec->lma = section->default_address + section->container_offset; + bfdsec->_raw_size = section->container_length; + bfdsec->filepos = section->container_offset; + bfdsec->alignment_power = section->alignment; + + bfdsec->flags = bfd_pef_section_flags (section); + + return bfdsec; +} + +int bfd_pef_parse_loader_header (abfd, buf, len, header) + bfd *abfd ATTRIBUTE_UNUSED; + unsigned char *buf; + size_t len; + bfd_pef_loader_header *header; +{ + BFD_ASSERT (len == 56); + + header->main_section = bfd_getb32 (buf); + header->main_offset = bfd_getb32 (buf + 4); + header->init_section = bfd_getb32 (buf + 8); + header->init_offset = bfd_getb32 (buf + 12); + header->term_section = bfd_getb32 (buf + 16); + header->term_offset = bfd_getb32 (buf + 20); + header->imported_library_count = bfd_getb32 (buf + 24); + header->total_imported_symbol_count = bfd_getb32 (buf + 28); + header->reloc_section_count = bfd_getb32 (buf + 32); + header->reloc_instr_offset = bfd_getb32 (buf + 36); + header->loader_strings_offset = bfd_getb32 (buf + 40); + header->export_hash_offset = bfd_getb32 (buf + 44); + header->export_hash_table_power = bfd_getb32 (buf + 48); + header->exported_symbol_count = bfd_getb32 (buf + 52); + + return 0; +} + +int bfd_pef_parse_imported_library (abfd, buf, len, header) + bfd *abfd ATTRIBUTE_UNUSED; + unsigned char *buf; + size_t len; + bfd_pef_imported_library *header; +{ + BFD_ASSERT (len == 24); + + header->name_offset = bfd_getb32 (buf); + header->old_implementation_version = bfd_getb32 (buf + 4); + header->current_version = bfd_getb32 (buf + 8); + header->imported_symbol_count = bfd_getb32 (buf + 12); + header->first_imported_symbol = bfd_getb32 (buf + 16); + header->options = buf[20]; + header->reserved_a = buf[21]; + header->reserved_b = bfd_getb16 (buf + 22); + + return 0; +} + +int bfd_pef_parse_imported_symbol (abfd, buf, len, symbol) + bfd *abfd ATTRIBUTE_UNUSED; + unsigned char *buf; + size_t len; + bfd_pef_imported_symbol *symbol; +{ + unsigned long value; + + BFD_ASSERT (len == 4); + + value = bfd_getb32 (buf); + symbol->class = value >> 24; + symbol->name = value & 0x00ffffff; + + return 0; +} + +int bfd_pef_scan_section (abfd, section) + bfd *abfd; + bfd_pef_section *section; +{ + unsigned char buf[28]; + + bfd_seek (abfd, section->header_offset, SEEK_SET); + if (bfd_bread ((PTR) buf, 28, abfd) != 28) + return -1; + + section->name_offset = bfd_h_get_32 (abfd, buf); + section->default_address = bfd_h_get_32 (abfd, buf + 4); + section->total_length = bfd_h_get_32 (abfd, buf + 8); + section->unpacked_length = bfd_h_get_32 (abfd, buf + 12); + section->container_length = bfd_h_get_32 (abfd, buf + 16); + section->container_offset = bfd_h_get_32 (abfd, buf + 20); + section->section_kind = buf[24]; + section->share_kind = buf[25]; + section->alignment = buf[26]; + section->reserved = buf[27]; + + section->bfd_section = bfd_pef_make_bfd_section (abfd, section); + if (section->bfd_section == NULL) + return -1; + + return 0; +} + +void +bfd_pef_print_loader_header (abfd, header, file) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_pef_loader_header *header; + FILE *file; +{ + fprintf (file, "main_section: %ld\n", header->main_section); + fprintf (file, "main_offset: %lu\n", header->main_offset); + fprintf (file, "init_section: %ld\n", header->init_section); + fprintf (file, "init_offset: %lu\n", header->init_offset); + fprintf (file, "term_section: %ld\n", header->term_section); + fprintf (file, "term_offset: %lu\n", header->term_offset); + fprintf (file, "imported_library_count: %lu\n", + header->imported_library_count); + fprintf (file, "total_imported_symbol_count: %lu\n", + header->total_imported_symbol_count); + fprintf (file, "reloc_section_count: %lu\n", header->reloc_section_count); + fprintf (file, "reloc_instr_offset: %lu\n", header->reloc_instr_offset); + fprintf (file, "loader_strings_offset: %lu\n", + header->loader_strings_offset); + fprintf (file, "export_hash_offset: %lu\n", header->export_hash_offset); + fprintf (file, "export_hash_table_power: %lu\n", + header->export_hash_table_power); + fprintf (file, "exported_symbol_count: %lu\n", + header->exported_symbol_count); +} + +int +bfd_pef_print_loader_section (abfd, file) + bfd *abfd; + FILE *file; +{ + bfd_pef_loader_header header; + asection *loadersec = NULL; + unsigned char *loaderbuf = NULL; + size_t loaderlen = 0; + int ret; + + loadersec = bfd_get_section_by_name (abfd, "loader"); + if (loadersec == NULL) + return -1; + + loaderlen = bfd_section_size (abfd, loadersec); + loaderbuf = (unsigned char *) bfd_malloc (loaderlen); + if (bfd_seek (abfd, loadersec->filepos, SEEK_SET) < 0) + { + free (loaderbuf); + return -1; + } + if (bfd_bread ((PTR) loaderbuf, loaderlen, abfd) != loaderlen) + { + free (loaderbuf); + return -1; + } + + if (loaderlen < 56) + { + free (loaderbuf); + return -1; + } + ret = bfd_pef_parse_loader_header (abfd, loaderbuf, 56, &header); + if (ret < 0) + { + free (loaderbuf); + return -1; + } + + bfd_pef_print_loader_header (abfd, &header, file); + return 0; +} + +int +bfd_pef_scan_start_address (abfd) + bfd *abfd; +{ + bfd_pef_loader_header header; + asection *section; + + asection *loadersec = NULL; + unsigned char *loaderbuf = NULL; + size_t loaderlen = 0; + int ret; + + loadersec = bfd_get_section_by_name (abfd, "loader"); + if (loadersec == NULL) + goto end; + + loaderlen = bfd_section_size (abfd, loadersec); + loaderbuf = (unsigned char *) bfd_malloc (loaderlen); + if (bfd_seek (abfd, loadersec->filepos, SEEK_SET) < 0) + goto error; + if (bfd_bread ((PTR) loaderbuf, loaderlen, abfd) != loaderlen) + goto error; + + if (loaderlen < 56) + goto error; + ret = bfd_pef_parse_loader_header (abfd, loaderbuf, 56, &header); + if (ret < 0) + goto error; + + if (header.main_section < 0) + goto end; + + for (section = abfd->sections; section != NULL; section = section->next) + if ((section->index + 1) == header.main_section) + break; + + if (section == NULL) + goto error; + + abfd->start_address = section->vma + header.main_offset; + + end: + if (loaderbuf != NULL) + free (loaderbuf); + return 0; + + error: + if (loaderbuf != NULL) + free (loaderbuf); + return -1; +} + +int +bfd_pef_scan (abfd, header, mdata) + bfd *abfd; + bfd_pef_header *header; + bfd_pef_data_struct *mdata; +{ + unsigned int i; + enum bfd_architecture cputype; + unsigned long cpusubtype; + + mdata->header = *header; + + bfd_pef_convert_architecture (header->architecture, &cputype, &cpusubtype); + if (cputype == bfd_arch_unknown) + { + fprintf (stderr, "bfd_pef_scan: unknown architecture 0x%lx\n", + header->architecture); + return -1; + } + bfd_set_arch_mach (abfd, cputype, cpusubtype); + + mdata->header = *header; + + abfd->flags = (abfd->xvec->object_flags + | (abfd->flags & (BFD_IN_MEMORY | BFD_IO_FUNCS))); + + if (header->section_count != 0) + { + mdata->sections = + ((bfd_pef_section *) + bfd_alloc (abfd, header->section_count * sizeof (bfd_pef_section))); + + if (mdata->sections == NULL) + return -1; + + for (i = 0; i < header->section_count; i++) + { + bfd_pef_section *cur = &mdata->sections[i]; + cur->header_offset = 40 + (i * 28); + if (bfd_pef_scan_section (abfd, cur) < 0) + return -1; + } + } + + if (bfd_pef_scan_start_address (abfd) < 0) + { +#if 0 + fprintf (stderr, "bfd_pef_scan: unable to scan start address: %s\n", + bfd_errmsg (bfd_get_error ())); + return -1; +#endif + } + + abfd->tdata.pef_data = mdata; + + return 0; +} + +static int +bfd_pef_read_header (abfd, header) + bfd *abfd; + bfd_pef_header *header; +{ + unsigned char buf[40]; + + bfd_seek (abfd, 0, SEEK_SET); + + if (bfd_bread ((PTR) buf, 40, abfd) != 40) + return -1; + + header->tag1 = bfd_getb32 (buf); + header->tag2 = bfd_getb32 (buf + 4); + header->architecture = bfd_getb32 (buf + 8); + header->format_version = bfd_getb32 (buf + 12); + header->timestamp = bfd_getb32 (buf + 16); + header->old_definition_version = bfd_getb32 (buf + 20); + header->old_implementation_version = bfd_getb32 (buf + 24); + header->current_version = bfd_getb32 (buf + 28); + header->section_count = bfd_getb32 (buf + 32) + 1; + header->instantiated_section_count = bfd_getb32 (buf + 34); + header->reserved = bfd_getb32 (buf + 36); + + return 0; +} + +static const bfd_target * +bfd_pef_object_p (abfd) + bfd *abfd; +{ + struct bfd_preserve preserve; + bfd_pef_header header; + + preserve.marker = NULL; + if (bfd_pef_read_header (abfd, &header) != 0) + goto wrong; + + if (header.tag1 != BFD_PEF_TAG1 || header.tag2 != BFD_PEF_TAG2) + goto wrong; + + preserve.marker = bfd_zalloc (abfd, sizeof (bfd_pef_data_struct)); + if (preserve.marker == NULL + || !bfd_preserve_save (abfd, &preserve)) + goto fail; + + if (bfd_pef_scan (abfd, &header, + (bfd_pef_data_struct *) preserve.marker) != 0) + goto wrong; + + bfd_preserve_finish (abfd, &preserve); + return abfd->xvec; + + wrong: + bfd_set_error (bfd_error_wrong_format); + + fail: + if (preserve.marker != NULL) + bfd_preserve_restore (abfd, &preserve); + return NULL; +} + +static int bfd_pef_parse_traceback_tables (abfd, sec, buf, len, nsym, csym) + bfd *abfd; + asection *sec; + unsigned char *buf; + size_t len; + long *nsym; + asymbol **csym; +{ + char *name; + + asymbol function; + asymbol traceback; + + const char *const tbprefix = "__traceback_"; + size_t tbnamelen; + + size_t pos = 0; + unsigned long count = 0; + int ret; + + for (;;) + { + /* We're reading symbols two at a time. */ + if (csym && ((csym[count] == NULL) || (csym[count + 1] == NULL))) + break; + + pos += 3; + pos -= (pos % 4); + + while ((pos + 4) <= len) + { + if (bfd_getb32 (buf + pos) == 0) + break; + pos += 4; + } + + if ((pos + 4) > len) + break; + + ret = bfd_pef_parse_traceback_table (abfd, sec, buf, len, pos + 4, + &function, 0); + if (ret < 0) + { + /* Skip over 0x0L to advance to next possible traceback table. */ + pos += 4; + continue; + } + + BFD_ASSERT (function.name != NULL); + + /* Don't bother to compute the name if we are just + counting symbols. */ + + if (csym) + { + tbnamelen = strlen (tbprefix) + strlen (function.name); + name = bfd_alloc (abfd, tbnamelen + 1); + if (name == NULL) + { + bfd_release (abfd, (PTR) function.name); + function.name = NULL; + break; + } + snprintf (name, tbnamelen + 1, "%s%s", tbprefix, function.name); + traceback.name = name; + traceback.value = pos; + traceback.the_bfd = abfd; + traceback.section = sec; + traceback.flags = 0; + traceback.udata.i = ret; + + *(csym[count]) = function; + *(csym[count + 1]) = traceback; + } + + pos += ret; + count += 2; + } + + *nsym = count; + return 0; +} + +static int bfd_pef_parse_function_stub (abfd, buf, len, offset) + bfd *abfd ATTRIBUTE_UNUSED; + unsigned char *buf; + size_t len; + unsigned long *offset; +{ + BFD_ASSERT (len == 24); + + if ((bfd_getb32 (buf) & 0xffff0000) != 0x81820000) + return -1; + if (bfd_getb32 (buf + 4) != 0x90410014) + return -1; + if (bfd_getb32 (buf + 8) != 0x800c0000) + return -1; + if (bfd_getb32 (buf + 12) != 0x804c0004) + return -1; + if (bfd_getb32 (buf + 16) != 0x7c0903a6) + return -1; + if (bfd_getb32 (buf + 20) != 0x4e800420) + return -1; + + if (offset != NULL) + *offset = (bfd_getb32 (buf) & 0x0000ffff) / 4; + + return 0; +} + +static int bfd_pef_parse_function_stubs (abfd, codesec, codebuf, codelen, + loaderbuf, loaderlen, nsym, csym) + bfd *abfd; + asection *codesec; + unsigned char *codebuf; + size_t codelen; + unsigned char *loaderbuf; + size_t loaderlen; + unsigned long *nsym; + asymbol **csym; +{ + const char *const sprefix = "__stub_"; + + size_t codepos = 0; + unsigned long count = 0; + + bfd_pef_loader_header header; + bfd_pef_imported_library *libraries = NULL; + bfd_pef_imported_symbol *imports = NULL; + + unsigned long i; + int ret; + + if (loaderlen < 56) + goto error; + + ret = bfd_pef_parse_loader_header (abfd, loaderbuf, 56, &header); + if (ret < 0) + goto error; + + libraries = (bfd_pef_imported_library *) bfd_malloc + (header.imported_library_count * sizeof (bfd_pef_imported_library)); + imports = (bfd_pef_imported_symbol *) bfd_malloc + (header.total_imported_symbol_count * sizeof (bfd_pef_imported_symbol)); + + if (loaderlen < (56 + (header.imported_library_count * 24))) + goto error; + for (i = 0; i < header.imported_library_count; i++) + { + ret = bfd_pef_parse_imported_library + (abfd, loaderbuf + 56 + (i * 24), 24, &libraries[i]); + if (ret < 0) + goto error; + } + + if (loaderlen < (56 + (header.imported_library_count * 24) + + (header.total_imported_symbol_count * 4))) + goto error; + for (i = 0; i < header.total_imported_symbol_count; i++) + { + ret = (bfd_pef_parse_imported_symbol + (abfd, + loaderbuf + 56 + (header.imported_library_count * 24) + (i * 4), + 4, &imports[i])); + if (ret < 0) + goto error; + } + + codepos = 0; + + for (;;) + { + asymbol sym; + const char *symname; + char *name; + unsigned long index; + int ret; + + if (csym && (csym[count] == NULL)) + break; + + codepos += 3; + codepos -= (codepos % 4); + + while ((codepos + 4) <= codelen) + { + if ((bfd_getb32 (codebuf + codepos) & 0xffff0000) == 0x81820000) + break; + codepos += 4; + } + + if ((codepos + 4) > codelen) + break; + + ret = bfd_pef_parse_function_stub (abfd, codebuf + codepos, 24, &index); + if (ret < 0) + { + codepos += 24; + continue; + } + + if (index >= header.total_imported_symbol_count) + { + codepos += 24; + continue; + } + + { + size_t max, namelen; + const char *s; + + if (loaderlen < (header.loader_strings_offset + imports[index].name)) + goto error; + + max = loaderlen - (header.loader_strings_offset + imports[index].name); + symname = loaderbuf + header.loader_strings_offset + imports[index].name; + namelen = 0; + for (s = symname; s < (symname + max); s++) + { + if (*s == '\0') + break; + if (! ISPRINT (*s)) + goto error; + namelen++; + } + if (*s != '\0') + goto error; + + name = bfd_alloc (abfd, strlen (sprefix) + namelen + 1); + if (name == NULL) + break; + + snprintf (name, strlen (sprefix) + namelen + 1, "%s%s", + sprefix, symname); + sym.name = name; + } + + sym.value = codepos; + sym.the_bfd = abfd; + sym.section = codesec; + sym.flags = 0; + sym.udata.i = 0; + + codepos += 24; + + if (csym != NULL) + *(csym[count]) = sym; + + count++; + } + + goto end; + + end: + if (libraries != NULL) + free (libraries); + if (imports != NULL) + free (imports); + *nsym = count; + return 0; + + error: + if (libraries != NULL) + free (libraries); + if (imports != NULL) + free (imports); + *nsym = count; + return -1; +} + +static long bfd_pef_parse_symbols (abfd, csym) + bfd *abfd; + asymbol **csym; +{ + unsigned long count = 0; + + asection *codesec = NULL; + unsigned char *codebuf = NULL; + size_t codelen = 0; + + asection *loadersec = NULL; + unsigned char *loaderbuf = NULL; + size_t loaderlen = 0; + + codesec = bfd_get_section_by_name (abfd, "code"); + if (codesec != NULL) + { + codelen = bfd_section_size (abfd, codesec); + codebuf = (unsigned char *) bfd_malloc (codelen); + if (bfd_seek (abfd, codesec->filepos, SEEK_SET) < 0) + goto end; + if (bfd_bread ((PTR) codebuf, codelen, abfd) != codelen) + goto end; + } + + loadersec = bfd_get_section_by_name (abfd, "loader"); + if (loadersec != NULL) + { + loaderlen = bfd_section_size (abfd, loadersec); + loaderbuf = (unsigned char *) bfd_malloc (loaderlen); + if (bfd_seek (abfd, loadersec->filepos, SEEK_SET) < 0) + goto end; + if (bfd_bread ((PTR) loaderbuf, loaderlen, abfd) != loaderlen) + goto end; + } + + count = 0; + if (codesec != NULL) + { + unsigned long ncount = 0; + bfd_pef_parse_traceback_tables (abfd, codesec, codebuf, codelen, + &ncount, csym); + count += ncount; + } + + if ((codesec != NULL) && (loadersec != NULL)) + { + unsigned long ncount = 0; + bfd_pef_parse_function_stubs + (abfd, codesec, codebuf, codelen, loaderbuf, loaderlen, &ncount, + (csym != NULL) ? (csym + count) : NULL); + count += ncount; + } + + if (csym != NULL) + csym[count] = NULL; + + end: + if (codebuf != NULL) + free (codebuf); + + if (loaderbuf != NULL) + free (loaderbuf); + + return count; +} + +static long +bfd_pef_count_symbols (abfd) + bfd *abfd; +{ + return bfd_pef_parse_symbols (abfd, NULL); +} + +static long +bfd_pef_get_symtab_upper_bound (abfd) + bfd *abfd; +{ + long nsyms = bfd_pef_count_symbols (abfd); + if (nsyms < 0) + return nsyms; + return ((nsyms + 1) * sizeof (asymbol *)); +} + +static long +bfd_pef_canonicalize_symtab (abfd, alocation) + bfd *abfd; + asymbol **alocation; +{ + long i; + asymbol *syms; + long ret; + + long nsyms = bfd_pef_count_symbols (abfd); + if (nsyms < 0) + return nsyms; + + syms = bfd_alloc (abfd, nsyms * sizeof (asymbol)); + if (syms == NULL) + return -1; + + for (i = 0; i < nsyms; i++) + alocation[i] = &syms[i]; + + alocation[nsyms] = NULL; + + ret = bfd_pef_parse_symbols (abfd, alocation); + if (ret != nsyms) + return 0; + + return ret; +} + +static asymbol * +bfd_pef_make_empty_symbol (abfd) + bfd *abfd; +{ + return (asymbol *) bfd_alloc (abfd, sizeof (asymbol)); +} + +static void +bfd_pef_get_symbol_info (abfd, symbol, ret) + bfd *abfd ATTRIBUTE_UNUSED; + asymbol *symbol; + symbol_info *ret; +{ + bfd_symbol_info (symbol, ret); +} + +static int +bfd_pef_sizeof_headers (abfd, exec) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_boolean exec ATTRIBUTE_UNUSED; +{ + return 0; +} + +const bfd_target pef_vec = +{ + "pef", /* name */ + bfd_target_pef_flavour, /* flavour */ + BFD_ENDIAN_BIG, /* byteorder */ + BFD_ENDIAN_BIG, /* header_byteorder */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), + (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA + | SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */ + 0, /* symbol_leading_char */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + { /* bfd_check_format */ + _bfd_dummy_target, + bfd_pef_object_p, /* bfd_check_format */ + _bfd_dummy_target, + _bfd_dummy_target, + }, + { /* bfd_set_format */ + bfd_false, + bfd_pef_mkobject, + bfd_false, + bfd_false, + }, + { /* bfd_write_contents */ + bfd_false, + bfd_true, + bfd_false, + bfd_false, + }, + + BFD_JUMP_TABLE_GENERIC (bfd_pef), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (bfd_pef), + BFD_JUMP_TABLE_RELOCS (bfd_pef), + BFD_JUMP_TABLE_WRITE (bfd_pef), + BFD_JUMP_TABLE_LINK (bfd_pef), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + NULL +}; + +#define bfd_pef_xlib_close_and_cleanup _bfd_generic_close_and_cleanup +#define bfd_pef_xlib_bfd_free_cached_info _bfd_generic_bfd_free_cached_info +#define bfd_pef_xlib_new_section_hook _bfd_generic_new_section_hook +#define bfd_pef_xlib_get_section_contents _bfd_generic_get_section_contents +#define bfd_pef_xlib_set_section_contents _bfd_generic_set_section_contents +#define bfd_pef_xlib_get_section_contents_in_window _bfd_generic_get_section_contents_in_window +#define bfd_pef_xlib_set_section_contents_in_window _bfd_generic_set_section_contents_in_window + +static int +bfd_pef_xlib_read_header (abfd, header) + bfd *abfd; + bfd_pef_xlib_header *header; +{ + unsigned char buf[76]; + + bfd_seek (abfd, 0, SEEK_SET); + + if (bfd_bread ((PTR) buf, 76, abfd) != 76) + return -1; + + header->tag1 = bfd_getb32 (buf); + header->tag2 = bfd_getb32 (buf + 4); + header->current_format = bfd_getb32 (buf + 8); + header->container_strings_offset = bfd_getb32 (buf + 12); + header->export_hash_offset = bfd_getb32 (buf + 16); + header->export_key_offset = bfd_getb32 (buf + 20); + header->export_symbol_offset = bfd_getb32 (buf + 24); + header->export_names_offset = bfd_getb32 (buf + 28); + header->export_hash_table_power = bfd_getb32 (buf + 32); + header->exported_symbol_count = bfd_getb32 (buf + 36); + header->frag_name_offset = bfd_getb32 (buf + 40); + header->frag_name_length = bfd_getb32 (buf + 44); + header->dylib_path_offset = bfd_getb32 (buf + 48); + header->dylib_path_length = bfd_getb32 (buf + 52); + header->cpu_family = bfd_getb32 (buf + 56); + header->cpu_model = bfd_getb32 (buf + 60); + header->date_time_stamp = bfd_getb32 (buf + 64); + header->current_version = bfd_getb32 (buf + 68); + header->old_definition_version = bfd_getb32 (buf + 72); + header->old_implementation_version = bfd_getb32 (buf + 76); + + return 0; +} + +int +bfd_pef_xlib_scan (abfd, header) + bfd *abfd; + bfd_pef_xlib_header *header; +{ + bfd_pef_xlib_data_struct *mdata = NULL; + + mdata = ((bfd_pef_xlib_data_struct *) + bfd_alloc (abfd, sizeof (bfd_pef_xlib_data_struct))); + if (mdata == NULL) + return -1; + + mdata->header = *header; + + abfd->flags = (abfd->xvec->object_flags + | (abfd->flags & (BFD_IN_MEMORY | BFD_IO_FUNCS))); + + abfd->tdata.pef_xlib_data = mdata; + + return 0; +} + +static const bfd_target * +bfd_pef_xlib_object_p (abfd) + bfd *abfd; +{ + struct bfd_preserve preserve; + bfd_pef_xlib_header header; + + if (bfd_pef_xlib_read_header (abfd, &header) != 0) + { + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + if ((header.tag1 != BFD_PEF_XLIB_TAG1) + || ((header.tag2 != BFD_PEF_VLIB_TAG2) + && (header.tag2 != BFD_PEF_BLIB_TAG2))) + { + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + if (! bfd_preserve_save (abfd, &preserve)) + { + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + if (bfd_pef_xlib_scan (abfd, &header) != 0) + { + bfd_preserve_restore (abfd, &preserve); + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + bfd_preserve_finish (abfd, &preserve); + return abfd->xvec; +} + +const bfd_target pef_xlib_vec = +{ + "pef-xlib", /* name */ + bfd_target_pef_xlib_flavour, /* flavour */ + BFD_ENDIAN_BIG, /* byteorder */ + BFD_ENDIAN_BIG, /* header_byteorder */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), + (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA + | SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */ + 0, /* symbol_leading_char */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + { /* bfd_check_format */ + _bfd_dummy_target, + bfd_pef_xlib_object_p, /* bfd_check_format */ + _bfd_dummy_target, + _bfd_dummy_target, + }, + { /* bfd_set_format */ + bfd_false, + bfd_pef_mkobject, + bfd_false, + bfd_false, + }, + { /* bfd_write_contents */ + bfd_false, + bfd_true, + bfd_false, + bfd_false, + }, + + BFD_JUMP_TABLE_GENERIC (bfd_pef_xlib), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), + BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), + BFD_JUMP_TABLE_WRITE (_bfd_nowrite), + BFD_JUMP_TABLE_LINK (_bfd_nolink), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + NULL +}; diff --git a/bfd/pef.h b/bfd/pef.h new file mode 100644 index 0000000000000..caeb710e16e65 --- /dev/null +++ b/bfd/pef.h @@ -0,0 +1,186 @@ +/* PEF support for BFD. + Copyright 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" + +#include + +struct bfd_pef_header +{ + unsigned long tag1; + unsigned long tag2; + unsigned long architecture; + unsigned long format_version; + unsigned long timestamp; + unsigned long old_definition_version; + unsigned long old_implementation_version; + unsigned long current_version; + unsigned short section_count; + unsigned short instantiated_section_count; + unsigned long reserved; +}; +typedef struct bfd_pef_header bfd_pef_header; + +struct bfd_pef_loader_header +{ + long main_section; + unsigned long main_offset; + long init_section; + unsigned long init_offset; + long term_section; + unsigned long term_offset; + unsigned long imported_library_count; + unsigned long total_imported_symbol_count; + unsigned long reloc_section_count; + unsigned long reloc_instr_offset; + unsigned long loader_strings_offset; + unsigned long export_hash_offset; + unsigned long export_hash_table_power; + unsigned long exported_symbol_count; +}; +typedef struct bfd_pef_loader_header bfd_pef_loader_header; + +struct bfd_pef_imported_library +{ + unsigned long name_offset; + unsigned long old_implementation_version; + unsigned long current_version; + unsigned long imported_symbol_count; + unsigned long first_imported_symbol; + unsigned char options; + unsigned char reserved_a; + unsigned short reserved_b; +}; +typedef struct bfd_pef_imported_library bfd_pef_imported_library; + +enum bfd_pef_imported_library_options + { + BFD_PEF_WEAK_IMPORT_LIB = 0x40, + BFD_PEF_INIT_LIB_BEFORE = 0x80 + }; + +struct bfd_pef_imported_symbol +{ + unsigned char class; + unsigned long name; +}; +typedef struct bfd_pef_imported_symbol bfd_pef_imported_symbol; + +enum bfd_pef_imported_symbol_class + { + BFD_PEF_CODE_SYMBOL = 0x00, + BFD_PEF_DATA_SYMBOL = 0x01, + BFD_PEF_TVECTOR_SYMBOL = 0x02, + BFD_PEF_TOC_SYMBOL = 0x03, + BFD_PEF_GLUE_SYMBOL = 0x04, + BFD_PEF_UNDEFINED_SYMBOL = 0x0F, + BFD_PEF_WEAK_IMPORT_SYMBOL_MASK = 0x80 + }; + +#define BFD_PEF_TAG1 0x4A6F7921 /* 'Joy!' */ +#define BFD_PEF_TAG2 0x70656666 /* 'peff' */ + +#define BFD_PEF_VERSION 0x00000001 + +struct bfd_pef_section +{ + long name_offset; + unsigned long header_offset; + unsigned long default_address; + unsigned long total_length; + unsigned long unpacked_length; + unsigned long container_length; + unsigned long container_offset; + unsigned char section_kind; + unsigned char share_kind; + unsigned char alignment; + unsigned char reserved; + asection *bfd_section; +}; +typedef struct bfd_pef_section bfd_pef_section; + +#define BFD_PEF_SECTION_CODE 0 +#define BFD_PEF_SECTION_UNPACKED_DATA 1 +#define BFD_PEF_SECTION_PACKED_DATA 2 +#define BFD_PEF_SECTION_CONSTANT 3 +#define BFD_PEF_SECTION_LOADER 4 +#define BFD_PEF_SECTION_DEBUG 5 +#define BFD_PEF_SECTION_EXEC_DATA 6 +#define BFD_PEF_SECTION_EXCEPTION 7 +#define BFD_PEF_SECTION_TRACEBACK 8 + +#define BFD_PEF_SHARE_PROCESS 1 +#define BFD_PEF_SHARE_GLOBAL 4 +#define BFD_PEF_SHARE_PROTECTED 5 + +struct bfd_pef_data_struct +{ + bfd_pef_header header; + bfd_pef_section *sections; + bfd *ibfd; +}; +typedef struct bfd_pef_data_struct bfd_pef_data_struct; + +#define BFD_PEF_XLIB_TAG1 0xF04D6163 /* '?Mac' */ +#define BFD_PEF_VLIB_TAG2 0x564C6962 /* 'VLib' */ +#define BFD_PEF_BLIB_TAG2 0x424C6962 /* 'BLib' */ + +#define BFD_PEF_XLIB_VERSION 0x00000001 + +struct bfd_pef_xlib_header +{ + unsigned long tag1; + unsigned long tag2; + unsigned long current_format; + unsigned long container_strings_offset; + unsigned long export_hash_offset; + unsigned long export_key_offset; + unsigned long export_symbol_offset; + unsigned long export_names_offset; + unsigned long export_hash_table_power; + unsigned long exported_symbol_count; + + unsigned long frag_name_offset; + unsigned long frag_name_length; + unsigned long dylib_path_offset; + unsigned long dylib_path_length; + unsigned long cpu_family; + unsigned long cpu_model; + unsigned long date_time_stamp; + unsigned long current_version; + unsigned long old_definition_version; + unsigned long old_implementation_version; +}; +typedef struct bfd_pef_xlib_header bfd_pef_xlib_header; + +struct bfd_pef_xlib_data_struct +{ + bfd_pef_xlib_header header; +}; +typedef struct bfd_pef_xlib_data_struct bfd_pef_xlib_data_struct; + +int bfd_pef_parse_loader_header PARAMS ((bfd *, unsigned char *, size_t, bfd_pef_loader_header *)); +int bfd_pef_print_loader_section PARAMS ((bfd *, FILE *)); +void bfd_pef_print_loader_header PARAMS ((bfd *, bfd_pef_loader_header *, FILE *)); +int bfd_pef_parse_imported_library PARAMS ((bfd *, unsigned char *, size_t, bfd_pef_imported_library *)); +int bfd_pef_parse_imported_symbol PARAMS ((bfd *, unsigned char *, size_t, bfd_pef_imported_symbol *)); +int bfd_pef_scan_section PARAMS ((bfd *, bfd_pef_section *)); +int bfd_pef_scan_start_address PARAMS ((bfd *)); +int bfd_pef_scan PARAMS ((bfd *, bfd_pef_header *, bfd_pef_data_struct *)); diff --git a/bfd/pei-arm.c b/bfd/pei-arm.c new file mode 100644 index 0000000000000..8eb23eb6faac9 --- /dev/null +++ b/bfd/pei-arm.c @@ -0,0 +1,35 @@ +/* BFD back-end for arm PE IMAGE COFF files. + Copyright 1995, 1996, 1999, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" + +#ifndef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM armpei_little_vec +#define TARGET_LITTLE_NAME "pei-arm-little" +#define TARGET_BIG_SYM armpei_big_vec +#define TARGET_BIG_NAME "pei-arm-big" +#endif + +#define COFF_IMAGE_WITH_PE +#define COFF_WITH_PE +#define PCRELOFFSET TRUE +#define COFF_LONG_SECTION_NAMES + +#include "coff-arm.c" diff --git a/bfd/pei-i386.c b/bfd/pei-i386.c new file mode 100644 index 0000000000000..63a63a84839ce --- /dev/null +++ b/bfd/pei-i386.c @@ -0,0 +1,44 @@ +/* BFD back-end for Intel 386 PE IMAGE COFF files. + Copyright 1995, 1996, 1999, 2002 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" + +#define TARGET_SYM i386pei_vec +#define TARGET_NAME "pei-i386" +#define COFF_IMAGE_WITH_PE +#define COFF_WITH_PE +#define PCRELOFFSET TRUE +#define TARGET_UNDERSCORE '_' +#define COFF_LONG_SECTION_NAMES +#define COFF_LONG_FILENAMES + +#define COFF_SECTION_ALIGNMENT_ENTRIES \ +{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 } + +#include "coff-i386.c" diff --git a/bfd/pei-mcore.c b/bfd/pei-mcore.c new file mode 100644 index 0000000000000..416cb81b8bb58 --- /dev/null +++ b/bfd/pei-mcore.c @@ -0,0 +1,37 @@ +/* BFD back-end for MCore PECOFF files. + Copyright 1999, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" + +#ifndef TARGET_BIG_SYM +#define TARGET_BIG_SYM mcore_pei_big_vec +#define TARGET_BIG_NAME "pei-mcore-big" +#define TARGET_LITTLE_SYM mcore_pei_little_vec +#define TARGET_LITTLE_NAME "pei-mcore-little" +#endif + +#define COFF_IMAGE_WITH_PE +#define COFF_WITH_PE +#define PCRELOFFSET TRUE +#define COFF_LONG_SECTION_NAMES + +#define MCORE_PE + +#include "coff-mcore.c" diff --git a/bfd/pei-ppc.c b/bfd/pei-ppc.c new file mode 100644 index 0000000000000..66216a865897a --- /dev/null +++ b/bfd/pei-ppc.c @@ -0,0 +1,45 @@ +/* BFD back-end for PowerPC PE IMAGE COFF files. + Copyright 1995, 1996, 1999 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" + +/* setting up for a PE environment stolen directly from the i386 structure */ +#define E_FILNMLEN 18 /* # characters in a file name */ + +#define PPC_PE + +#define TARGET_LITTLE_SYM bfd_powerpcle_pei_vec +#define TARGET_LITTLE_NAME "pei-powerpcle" + +#define TARGET_BIG_SYM bfd_powerpc_pei_vec +#define TARGET_BIG_NAME "pei-powerpc" + +#define COFF_IMAGE_WITH_PE +#define COFF_WITH_PE + +#define COFF_LONG_SECTION_NAMES + +/* FIXME: Verify PCRELOFFSET is always false */ + +/* FIXME: This target no longer works. Search for POWERPC_LE_PE in + coff-ppc.c and peigen.c. */ + +#include "coff-ppc.c" diff --git a/bfd/pei-sh.c b/bfd/pei-sh.c new file mode 100644 index 0000000000000..b4cc579fa490e --- /dev/null +++ b/bfd/pei-sh.c @@ -0,0 +1,33 @@ +/* BFD back-end for SH PE IMAGE COFF files. + Copyright 1995, 2000, 2001, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" + +#define TARGET_SHL_SYM shlpei_vec +#define TARGET_SHL_NAME "pei-shl" +#define IMAGE_BASE NT_IMAGE_BASE +#define COFF_IMAGE_WITH_PE +#define COFF_WITH_PE +#define PCRELOFFSET TRUE +#define TARGET_UNDERSCORE '_' +#define COFF_LONG_SECTION_NAMES + +#include "coff-sh.c" + diff --git a/bfd/po/.cvsignore b/bfd/po/.cvsignore new file mode 100644 index 0000000000000..becd1537dbec1 --- /dev/null +++ b/bfd/po/.cvsignore @@ -0,0 +1 @@ +*.gmo diff --git a/bfd/po/POTFILES.in b/bfd/po/POTFILES.in deleted file mode 100644 index f75b4caec8982..0000000000000 --- a/bfd/po/POTFILES.in +++ /dev/null @@ -1,255 +0,0 @@ -aix386-core.c -aout0.c -aout32.c -aout64.c -aout-adobe.c -aout-arm.c -aout-cris.c -aoutf1.h -aout-ns32k.c -aout-sparcle.c -aout-target.h -aout-tic30.c -aoutx.h -archive.c -archures.c -armnetbsd.c -bfd.c -binary.c -bout.c -cache.c -cf-i386lynx.c -cf-m68klynx.c -cf-sparclynx.c -cisco-core.c -coff64-rs6000.c -coff-a29k.c -coff-alpha.c -coff-apollo.c -coff-arm.c -coff-aux.c -coffcode.h -coffgen.c -coff-go32.c -coff-h8300.c -coff-h8500.c -coff-i386.c -coff-i860.c -coff-i960.c -cofflink.c -coff-m68k.c -coff-m88k.c -coff-mips.c -coff-pmac.c -coff-rs6000.c -coff-sh.c -coff-sparc.c -coff-stgo32.c -coff-svm68k.c -coffswap.h -coff-tic30.c -coff-tic54x.c -coff-tic80.c -coff-u68k.c -coff-w65.c -coff-we32k.c -coff-z8k.c -corefile.c -cpu-a29k.c -cpu-alpha.c -cpu-arc.c -cpu-arm.c -cpu-avr.c -cpu-cris.c -cpu-d10v.c -cpu-d30v.c -cpu-fr30.c -cpu-h8300.c -cpu-h8500.c -cpu-hppa.c -cpu-i370.c -cpu-i386.c -cpu-i860.c -cpu-i960.c -cpu-ia64.c -cpu-m10200.c -cpu-m10300.c -cpu-m32r.c -cpu-m68hc11.c -cpu-m68hc12.c -cpu-m68k.c -cpu-m88k.c -cpu-mcore.c -cpu-mips.c -cpu-ns32k.c -cpu-pj.c -cpu-powerpc.c -cpu-rs6000.c -cpu-sh.c -cpu-sparc.c -cpu-tic30.c -cpu-tic54x.c -cpu-tic80.c -cpu-v850.c -cpu-vax.c -cpu-w65.c -cpu-we32k.c -cpu-z8k.c -demo64.c -dwarf1.c -dwarf2.c -ecoff.c -ecofflink.c -ecoffswap.h -efi-app-ia32.c -efi-app-ia64.c -elf32-arc.c -elf32-arm.h -elf32-avr.c -elf32.c -elf32-cris.c -elf32-d10v.c -elf32-d30v.c -elf32-fr30.c -elf32-gen.c -elf32-hppa.c -elf32-hppa.h -elf32-i370.c -elf32-i386.c -elf32-i860.c -elf32-i960.c -elf32-m32r.c -elf32-m68hc11.c -elf32-m68hc12.c -elf32-m68k.c -elf32-m88k.c -elf32-mcore.c -elf32-mips.c -elf32-pj.c -elf32-ppc.c -elf32-sh.c -elf32-sh-lin.c -elf32-sparc.c -elf32-v850.c -elf64-alpha.c -elf64.c -elf64-gen.c -elf64-hppa.c -elf64-hppa.h -elf64-mips.c -elf64-sparc.c -elf64-x86-64.c -elfarm-nabi.c -elfarm-oabi.c -elf-bfd.h -elf.c -elfcode.h -elfcore.h -elf-hppa.h -elflink.c -elflink.h -elf-m10200.c -elf-m10300.c -epoc-pe-arm.c -epoc-pei-arm.c -format.c -freebsd.h -genlink.h -go32stub.h -hash.c -hp300bsd.c -hp300hpux.c -hpux-core.c -i386aout.c -i386bsd.c -i386dynix.c -i386freebsd.c -i386linux.c -i386lynx.c -i386mach3.c -i386msdos.c -i386netbsd.c -i386os9k.c -ieee.c -ihex.c -init.c -irix-core.c -libaout.h -libbfd.c -libbfd.h -libcoff.h -libecoff.h -libhppa.h -libieee.h -libnlm.h -liboasys.h -libpei.h -linker.c -lynx-core.c -m68k4knetbsd.c -m68klinux.c -m68klynx.c -m68knetbsd.c -m88kmach3.c -mipsbsd.c -netbsd.h -newsos3.c -nlm32-alpha.c -nlm32.c -nlm32-i386.c -nlm32-ppc.c -nlm32-sparc.c -nlm64.c -nlm.c -nlmcode.h -nlmswap.h -nlm-target.h -ns32k.h -ns32knetbsd.c -oasys.c -opncls.c -osf-core.c -pc532-mach.c -pe-arm.c -pe-i386.c -pei-arm.c -peicode.h -peigen.c -pei-i386.c -pei-mcore.c -pei-mips.c -pei-ppc.c -pei-sh.c -pe-mcore.c -pe-mips.c -pe-ppc.c -pe-sh.c -ppcboot.c -reloc16.c -reloc.c -riscix.c -sco5-core.c -section.c -som.c -som.h -sparclinux.c -sparclynx.c -sparcnetbsd.c -srec.c -stabs.c -stab-syms.c -sunos.c -syms.c -targets.c -tekhex.c -trad-core.c -vaxnetbsd.c -versados.c -vms.c -vms-gsd.c -vms.h -vms-hdr.c -vms-misc.c -vms-tir.c -xcofflink.c -xcoff-target.h diff --git a/bfd/po/da.gmo b/bfd/po/da.gmo new file mode 100644 index 0000000000000..944a11c1610b7 Binary files /dev/null and b/bfd/po/da.gmo differ diff --git a/bfd/po/da.po b/bfd/po/da.po new file mode 100644 index 0000000000000..cf0121a3076a6 --- /dev/null +++ b/bfd/po/da.po @@ -0,0 +1,2745 @@ +# Danish messages for bfd. +# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Keld Simonsen , 2002-2003 +# +msgid "" +msgstr "" +"Project-Id-Version: bfd 2.12.91\n" +"POT-Creation-Date: 2002-07-23 15:55-0400\n" +"PO-Revision-Date: 2003-03-01 23:25+0100\n" +"Last-Translator: Keld Simonsen \n" +"Language-Team: Danish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: aout-adobe.c:197 +#, c-format +msgid "%s: Unknown section type in a.out.adobe file: %x\n" +msgstr "%s: Ukendt sektionstype i a.out.adobe-fil: %x\n" + +#: aout-cris.c:208 +#, c-format +msgid "%s: Invalid relocation type exported: %d" +msgstr "%s: Ugyldig relokeringstype eksporteret: %d" + +#: aout-cris.c:252 +#, c-format +msgid "%s: Invalid relocation type imported: %d" +msgstr "%s: Ugyldig relokeringstype importeret: %d" + +#: aout-cris.c:263 +#, c-format +msgid "%s: Bad relocation record imported: %d" +msgstr "%s: Fejlagtig relokeringstype importeret: %d" + +#: aoutx.h:1282 aoutx.h:1699 +#, c-format +msgid "%s: can not represent section `%s' in a.out object file format" +msgstr "%s: kan ikke repræsentere sektionen \"%s\" i a.out-objektfilformat" + +#: aoutx.h:1669 +#, c-format +msgid "%s: can not represent section for symbol `%s' in a.out object file format" +msgstr "%s: kan ikke repræsentere sektion for symbolet \"%s\" i a.out-objektfilformat" + +#: aoutx.h:1671 +msgid "*unknown*" +msgstr "*ukendt*" + +#: aoutx.h:3732 +#, c-format +msgid "%s: relocateable link from %s to %s not supported" +msgstr "%s: relokérbar lænke fra %s til %s understøttes ikke" + +#: archive.c:1826 +msgid "Warning: writing archive was slow: rewriting timestamp\n" +msgstr "Advarsel: arkivskrivning var langsom: genskriver tidsstempel\n" + +#: archive.c:2093 +msgid "Reading archive file mod timestamp" +msgstr "Læser arkivfilens ændringstidsstempel" + +#. FIXME: bfd can't call perror. +#: archive.c:2120 +msgid "Writing updated armap timestamp" +msgstr "Skriver opdateret armap-tidsstempel" + +#: bfd.c:274 +msgid "No error" +msgstr "Ingen fejl" + +#: bfd.c:275 +msgid "System call error" +msgstr "Systemkaldsfejl" + +#: bfd.c:276 +msgid "Invalid bfd target" +msgstr "Ugyldigt bfd-mål" + +#: bfd.c:277 +msgid "File in wrong format" +msgstr "Filen er i forkert format" + +#: bfd.c:278 +msgid "Archive object file in wrong format" +msgstr "Arkivobjektfil er i forkert format" + +#: bfd.c:279 +msgid "Invalid operation" +msgstr "Ugyldig handling" + +#: bfd.c:280 +msgid "Memory exhausted" +msgstr "Hukommelsen er opbrugt" + +#: bfd.c:281 +msgid "No symbols" +msgstr "Ingen symboler" + +#: bfd.c:282 +msgid "Archive has no index; run ranlib to add one" +msgstr "Arkivet har intet indeks; kør ranlib til at tilføje ét" + +#: bfd.c:283 +msgid "No more archived files" +msgstr "Ikke flere arkiverede filer" + +#: bfd.c:284 +msgid "Malformed archive" +msgstr "Forvansket arkiv" + +#: bfd.c:285 +msgid "File format not recognized" +msgstr "Filformatet ikke genkendt" + +#: bfd.c:286 +msgid "File format is ambiguous" +msgstr "Filformatet er flertydigt" + +#: bfd.c:287 +msgid "Section has no contents" +msgstr "Sektionen har intet indhold" + +#: bfd.c:288 +msgid "Nonrepresentable section on output" +msgstr "Ikkerepræsenterbar sektion i uddata" + +#: bfd.c:289 +msgid "Symbol needs debug section which does not exist" +msgstr "Symbolet kræver fejlsøgningssektion som ikke eksisterer" + +#: bfd.c:290 +msgid "Bad value" +msgstr "Fejlagtigt værdi" + +#: bfd.c:291 +msgid "File truncated" +msgstr "Filen trunkeret" + +#: bfd.c:292 +msgid "File too big" +msgstr "Filen er for stor" + +#: bfd.c:293 +msgid "#" +msgstr "#" + +#: bfd.c:700 +#, c-format +msgid "BFD %s assertion fail %s:%d" +msgstr "BFD %s-forsikring mislykkedes %s:%d" + +#: bfd.c:719 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d in %s\n" +msgstr "Intern BFD %s-fejl, afbryder ved %s linje %d i %s\n" + +#: bfd.c:723 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d\n" +msgstr "Internt BFD %s-fejl, afbryder ved %s linje %d\n" + +#: bfd.c:725 +msgid "Please report this bug.\n" +msgstr "Rapportér gerne denne fejl.\n" + +#: binary.c:306 +#, c-format +msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx." +msgstr "Advarsel: Skrivning af sektionen \"%s\" til enorm (dvs negativ) afsætsbyte 0x%lx." + +# src/menus.c:341 +#: coff-a29k.c:119 +msgid "Missing IHCONST" +msgstr "IHCONST mangler" + +# src/menus.c:341 +#: coff-a29k.c:180 +msgid "Missing IHIHALF" +msgstr "IHIHALF mangler" + +#: coff-a29k.c:212 coff-or32.c:229 +msgid "Unrecognized reloc" +msgstr "Ukendt relokering" + +#: coff-a29k.c:408 +msgid "missing IHCONST reloc" +msgstr "IHCONST-relokering mangler" + +#: coff-a29k.c:498 +msgid "missing IHIHALF reloc" +msgstr "IHIHALF-relokering mangler" + +#: coff-alpha.c:881 coff-alpha.c:918 coff-alpha.c:1989 coff-mips.c:1432 +msgid "GP relative relocation used when GP not defined" +msgstr "GP-relativ relokering bruges når GP ikke er defineret" + +#: coff-alpha.c:1485 +msgid "using multiple gp values" +msgstr "bruger flere gp-værdier" + +#: coff-arm.c:1066 elf32-arm.h:285 +#, c-format +msgid "%s: unable to find THUMB glue '%s' for `%s'" +msgstr "%s: kunne ikke finde THUMB-klistret \"%s\" til \"%s\"" + +#: coff-arm.c:1096 elf32-arm.h:320 +#, c-format +msgid "%s: unable to find ARM glue '%s' for `%s'" +msgstr "%s: kunne ikke finde ARM-klistret \"%s\" til \"%s\"" + +#: coff-arm.c:1391 coff-arm.c:1486 elf32-arm.h:887 elf32-arm.h:991 +#, c-format +msgid "%s(%s): warning: interworking not enabled." +msgstr "%s(%s): advarsel: samvirken er ikke aktiveret." + +#: coff-arm.c:1395 elf32-arm.h:994 +#, c-format +msgid " first occurrence: %s: arm call to thumb" +msgstr " første forekomst: %s: arm-kald til thumb" + +#: coff-arm.c:1490 elf32-arm.h:890 +#, c-format +msgid " first occurrence: %s: thumb call to arm" +msgstr " første forekomst: %s: thumb-kald til arm" + +#: coff-arm.c:1493 +msgid " consider relinking with --support-old-code enabled" +msgstr " overvej omlænkning med --support-old-code aktiveret" + +#: coff-arm.c:1785 coff-tic80.c:686 cofflink.c:3031 +#, c-format +msgid "%s: bad reloc address 0x%lx in section `%s'" +msgstr "%s: fejlagtig relokeringsadresse 0x%lx i sektionen \"%s\"" + +#: coff-arm.c:2127 +#, c-format +msgid "%s: illegal symbol index in reloc: %d" +msgstr "%s: ikke tilladt symbolindeks i relokering: %d" + +#: coff-arm.c:2255 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d" +msgstr "FEJL: %s oversat for APCS-%d, mens %s er oversat for APCS-%d" + +#: coff-arm.c:2270 elf32-arm.h:2297 +#, c-format +msgid "ERROR: %s passes floats in float registers, whereas %s passes them in integer registers" +msgstr "FEJL: %s overfører flydende tal i flydendetalsregister, mens %s overfører dem i heltalsregister" + +#: coff-arm.c:2273 elf32-arm.h:2302 +#, c-format +msgid "ERROR: %s passes floats in integer registers, whereas %s passes them in float registers" +msgstr "FEJL: %s overfører flydende tal i heltalsregister, mens %s overfører dem i flydendetalsregister" + +#: coff-arm.c:2288 +#, c-format +msgid "ERROR: %s is compiled as position independent code, whereas target %s is absolute position" +msgstr "FEJL: %s er oversat som positionsuafhængig kode, mens målet %s har absolut position" + +#: coff-arm.c:2291 +#, c-format +msgid "ERROR: %s is compiled as absolute position code, whereas target %s is position independent" +msgstr "FEJL: %s er oversat som kode med absolut position, mens målet %s er positionsuafhængigt" + +#: coff-arm.c:2320 elf32-arm.h:2358 +#, c-format +msgid "Warning: %s supports interworking, whereas %s does not" +msgstr "Advarsel: %s understøtter samvirken, mens %s derimod ikke gør det" + +#: coff-arm.c:2323 elf32-arm.h:2365 +#, c-format +msgid "Warning: %s does not support interworking, whereas %s does" +msgstr "Advarsel: %s understøtter ikke samvirken, mens %s derimod gør det" + +#: coff-arm.c:2350 +#, c-format +msgid "private flags = %x:" +msgstr "private flag = %x:" + +#: coff-arm.c:2358 elf32-arm.h:2418 +msgid " [floats passed in float registers]" +msgstr " [flydende tal overført i flydendetalsregistre]" + +#: coff-arm.c:2360 +msgid " [floats passed in integer registers]" +msgstr " [flydende tal overført i heltalsregistre]" + +#: coff-arm.c:2363 elf32-arm.h:2421 +msgid " [position independent]" +msgstr " [positionsuafhængigt]" + +#: coff-arm.c:2365 +msgid " [absolute position]" +msgstr " [absolut position]" + +#: coff-arm.c:2369 +msgid " [interworking flag not initialised]" +msgstr " [samvirkendeflag er ikke initieret]" + +#: coff-arm.c:2371 +msgid " [interworking supported]" +msgstr " [samvirken understøttes]" + +#: coff-arm.c:2373 +msgid " [interworking not supported]" +msgstr " [samvirken understøttes ikke]" + +#: coff-arm.c:2421 elf32-arm.h:2124 +#, c-format +msgid "Warning: Not setting interworking flag of %s since it has already been specified as non-interworking" +msgstr "Advarsel: Sætter ikke samvirkeflaget for %s da den allerede er angivet som ikke-samvirkende" + +#: coff-arm.c:2425 elf32-arm.h:2128 +#, c-format +msgid "Warning: Clearing the interworking flag of %s due to outside request" +msgstr "Advarsel: Fjerner samvirkeflaget for %s på grund af anmodning udefra" + +#: coff-i960.c:136 coff-i960.c:485 +msgid "uncertain calling convention for non-COFF symbol" +msgstr "usikker kaldskonvention for ikke-COFF-symbol" + +#: coff-m68k.c:481 coff-mips.c:2429 elf32-m68k.c:2157 elf32-mips.c:1844 +msgid "unsupported reloc type" +msgstr "relokeringstypen understøttes ikke" + +#: coff-mips.c:874 elf32-mips.c:1062 elf64-mips.c:1609 +msgid "GP relative relocation when _gp not defined" +msgstr "GP-relativ relokering når _gp ikke var defineret" + +#. No other sections should appear in -membedded-pic +#. code. +#: coff-mips.c:2466 +msgid "reloc against unsupported section" +msgstr "relokering mod sektion som ikke understøttes" + +#: coff-mips.c:2474 +msgid "reloc not properly aligned" +msgstr "relokering ikke på passende afrundet adresse" + +#: coff-rs6000.c:2766 +#, c-format +msgid "%s: unsupported relocation type 0x%02x" +msgstr "%s: relokeringstypen 0x%02x understøttes ikke" + +#: coff-rs6000.c:2859 +#, c-format +msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry" +msgstr "%s: TOC-relokering ved 0x%x til symbolet \"%s\" uden nogen TOC-post" + +#: coff-rs6000.c:3590 coff64-rs6000.c:2091 +#, c-format +msgid "%s: symbol `%s' has unrecognized smclas %d" +msgstr "%s: symbolet \"%s\" har ukendt smclas %d" + +#: coff-tic54x.c:279 coff-tic80.c:449 +#, c-format +msgid "Unrecognized reloc type 0x%x" +msgstr "Ukendt relokeringstype 0x%x" + +#: coff-tic54x.c:390 coffcode.h:4974 +#, c-format +msgid "%s: warning: illegal symbol index %ld in relocs" +msgstr "%s: advarsel: ikke tilladt symbolindeks %ld i relokeringerne" + +#: coff-w65.c:363 +#, c-format +msgid "ignoring reloc %s\n" +msgstr "ignorerer relokering %s\n" + +#: coffcode.h:1086 +#, c-format +msgid "%s (%s): Section flag %s (0x%x) ignored" +msgstr "%s (%s): Sektionsflaget %s (0x%x) ignoreredes" + +#: coffcode.h:2143 +#, c-format +msgid "Unrecognized TI COFF target id '0x%x'" +msgstr "Ukendt TI COFF-mål-id \"0x%x\"" + +#: coffcode.h:4365 +#, c-format +msgid "%s: warning: illegal symbol index %ld in line numbers" +msgstr "%s: advarsel: ikke tilladt symbolindeks %ld i linjenumre" + +#: coffcode.h:4379 +#, c-format +msgid "%s: warning: duplicate line number information for `%s'" +msgstr "%s: advarsel: dobbelt linjenummersinformation for \"%s\"" + +#: coffcode.h:4736 +#, c-format +msgid "%s: Unrecognized storage class %d for %s symbol `%s'" +msgstr "%s: Ukendt lagringsklasse %d for %s-symbolet \"%s\"" + +#: coffcode.h:4867 +#, c-format +msgid "warning: %s: local symbol `%s' has no section" +msgstr "advarsel: %s: lokalt symbol \"%s\" har ingen sektion" + +#: coffcode.h:5012 +#, c-format +msgid "%s: illegal relocation type %d at address 0x%lx" +msgstr "%s: ikke tilladt relokeringstype %d på adresse 0x%lx" + +#: coffgen.c:1661 +#, c-format +msgid "%s: bad string table size %lu" +msgstr "%s: fejlagtig strengtabelstørrelse %lu" + +#: cofflink.c:534 elflink.h:1912 +#, c-format +msgid "Warning: type of symbol `%s' changed from %d to %d in %s" +msgstr "Advarsel: typen på symbol \"%s\" ændredes fra %d til %d i %s" + +#: cofflink.c:2321 +#, c-format +msgid "%s: relocs in section `%s', but it has no contents" +msgstr "%s: relokeringer i sektionen \"%s\", men den har intet indhold" + +#: cofflink.c:2664 coffswap.h:877 +#, c-format +msgid "%s: %s: reloc overflow: 0x%lx > 0xffff" +msgstr "%s: %s: relokering giver overløb: 0x%lx > 0xffff" + +#: cofflink.c:2673 coffswap.h:864 +#, c-format +msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: advarsel: %s: linjenummer giver overløb: 0x%lx > 0xffff" + +#: dwarf2.c:382 +msgid "Dwarf Error: Can't find .debug_str section." +msgstr "Dwarf-fejl: Kan ikke finde sektionen .debug_str." + +#: dwarf2.c:399 +#, c-format +msgid "Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str size (%lu)." +msgstr "Dwarf-fejl: DW_FORM_strp-afstanden (%lu) større end eller lig med størrelsen på .debug_str (%lu)." + +#: dwarf2.c:543 +msgid "Dwarf Error: Can't find .debug_abbrev section." +msgstr "Dwarf-fejl: Kan ikke finde sektionen .debug_abbrev." + +#: dwarf2.c:560 +#, c-format +msgid "Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size (%lu)." +msgstr "Dwarf-fejl: Forkortelsesafstanden (%lu) større end eller lig med størrelsen .debug_abbrev (%lu)." + +#: dwarf2.c:757 +#, c-format +msgid "Dwarf Error: Invalid or unhandled FORM value: %u." +msgstr "Dwarf-fejl: Ugyldig eller ubehandlet FORM-værdi: %u." + +#: dwarf2.c:852 +msgid "Dwarf Error: mangled line number section (bad file number)." +msgstr "Dwarf-fejl: vanskabt linjenummerssektion (fejlagtigt filnummer)." + +#: dwarf2.c:938 +msgid "Dwarf Error: Can't find .debug_line section." +msgstr "Dwarf-fejl: Kan ikke finde sektionen .debug_line." + +#: dwarf2.c:961 +#, c-format +msgid "Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)." +msgstr "Dwarf-fejl: Linjeafstanden (%lu) større end eller lig med størrelsen .debug_line (%lu)." + +#: dwarf2.c:1159 +msgid "Dwarf Error: mangled line number section." +msgstr "Dwarf-fejl: vanskabt linjenummerssektion." + +#: dwarf2.c:1355 dwarf2.c:1566 +#, c-format +msgid "Dwarf Error: Could not find abbrev number %u." +msgstr "Dwarf-fejl: Kunne ikke finde forkortelsesnumret %u." + +#: dwarf2.c:1527 +#, c-format +msgid "Dwarf Error: found dwarf version '%u', this reader only handles version 2 information." +msgstr "Dwarf-fejl: fandt dwarf version \"%u\", denne læser håndterer kun information fra version 2." + +#: dwarf2.c:1534 +#, c-format +msgid "Dwarf Error: found address size '%u', this reader can not handle sizes greater than '%u'." +msgstr "Dwarf-fejl: fandt adressestørrelsen \"%u\", denne læser kan ikke håndtere størrelser større end \"%u\"." + +#: dwarf2.c:1557 +#, c-format +msgid "Dwarf Error: Bad abbrev number: %u." +msgstr "Dwarf-fejl: Fejlagtigt forkortelsesnummer: %u." + +#: ecoff.c:1318 +#, c-format +msgid "Unknown basic type %d" +msgstr "Ukendt grundtype %d" + +#: ecoff.c:1578 +#, c-format +msgid "" +"\n" +" End+1 symbol: %ld" +msgstr "" +"\n" +" Symbol slut+1: %ld" + +#: ecoff.c:1585 ecoff.c:1588 +#, c-format +msgid "" +"\n" +" First symbol: %ld" +msgstr "" +"\n" +" Første symbol: %ld" + +#: ecoff.c:1600 +#, c-format +msgid "" +"\n" +" End+1 symbol: %-7ld Type: %s" +msgstr "" +"\n" +" Symbol slut+1: %-7ld Type: %s" + +#: ecoff.c:1607 +#, c-format +msgid "" +"\n" +" Local symbol: %ld" +msgstr "" +"\n" +" Lokalt symbol: %ld" + +#: ecoff.c:1615 +#, c-format +msgid "" +"\n" +" struct; End+1 symbol: %ld" +msgstr "" +"\n" +" struct; symbol slut+1: %ld" + +#: ecoff.c:1620 +#, c-format +msgid "" +"\n" +" union; End+1 symbol: %ld" +msgstr "" +"\n" +" union; symbol slut+1: %ld" + +#: ecoff.c:1625 +#, c-format +msgid "" +"\n" +" enum; End+1 symbol: %ld" +msgstr "" +"\n" +" enum; symbol slut+1: %ld" + +#: ecoff.c:1631 +#, c-format +msgid "" +"\n" +" Type: %s" +msgstr "" +"\n" +" Type: %s" + +#: elf-hppa.h:1476 elf-hppa.h:1509 elf32-ppc.c:3091 elf32-sh.c:4213 +#: elf64-sh64.c:1659 +#, c-format +msgid "%s: warning: unresolvable relocation against symbol `%s' from %s section" +msgstr "%s: advarsel: uløselig relokering mod symbol \"%s\" fra sektionen %s" + +#: elf-m10200.c:446 elf-m10300.c:656 elf32-arm.h:2084 elf32-avr.c:833 +#: elf32-cris.c:1403 elf32-d10v.c:481 elf32-fr30.c:635 elf32-frv.c:809 +#: elf32-h8300.c:548 elf32-i860.c:1031 elf32-m32r.c:1278 elf32-openrisc.c:439 +#: elf32-v850.c:1691 elf32-xstormy16.c:933 elf64-mmix.c:1302 +msgid "internal error: out of range error" +msgstr "intern fejl: uden for intervallet" + +#: elf-m10200.c:450 elf-m10300.c:660 elf32-arm.h:2088 elf32-avr.c:837 +#: elf32-cris.c:1407 elf32-d10v.c:485 elf32-fr30.c:639 elf32-frv.c:813 +#: elf32-h8300.c:552 elf32-i860.c:1035 elf32-m32r.c:1282 elf32-openrisc.c:443 +#: elf32-v850.c:1695 elf32-xstormy16.c:937 elf64-mmix.c:1306 elfxx-mips.c:5264 +msgid "internal error: unsupported relocation error" +msgstr "intern fejl: relokeringen understøttes ikke" + +#: elf-m10200.c:454 elf-m10300.c:664 elf32-arm.h:2092 elf32-d10v.c:489 +#: elf32-h8300.c:556 elf32-m32r.c:1286 +msgid "internal error: dangerous error" +msgstr "intern fejl: farlig fejl" + +#: elf-m10200.c:458 elf-m10300.c:668 elf32-arm.h:2096 elf32-avr.c:845 +#: elf32-cris.c:1415 elf32-d10v.c:493 elf32-fr30.c:647 elf32-frv.c:821 +#: elf32-h8300.c:560 elf32-i860.c:1043 elf32-m32r.c:1290 elf32-openrisc.c:451 +#: elf32-v850.c:1715 elf32-xstormy16.c:945 elf64-mmix.c:1314 +msgid "internal error: unknown error" +msgstr "intern fejl: ukendt fejl" + +#: elf.c:343 +#, c-format +msgid "%s: invalid string offset %u >= %lu for section `%s'" +msgstr "%s: ugyldig strengafstand %u >= %lu for sektionen \"%s\"" + +#: elf.c:589 +#, c-format +msgid "%s: invalid SHT_GROUP entry" +msgstr "%s: ugyldig SHT_GROUP-post" + +#: elf.c:660 +#, c-format +msgid "%s: no group info for section %s" +msgstr "%s: ingen gruppeinformation for sektionen %s" + +#: elf.c:1023 +msgid "" +"\n" +"Program Header:\n" +msgstr "" +"\n" +"Programhoved:\n" + +#: elf.c:1073 +msgid "" +"\n" +"Dynamic Section:\n" +msgstr "" +"\n" +"Dynamisk sektion:\n" + +#: elf.c:1202 +msgid "" +"\n" +"Version definitions:\n" +msgstr "" +"\n" +"Versionsdefinitioner:\n" + +#: elf.c:1225 +msgid "" +"\n" +"Version References:\n" +msgstr "" +"\n" +"Versionsreferencer:\n" + +#: elf.c:1230 +#, c-format +msgid " required from %s:\n" +msgstr " kræves fra %s:\n" + +#: elf.c:1902 +#, c-format +msgid "%s: invalid link %lu for reloc section %s (index %u)" +msgstr "%s: ugyldig lænke %lu for relokeringssektion %s (indeks %u)" + +#: elf.c:3603 +#, c-format +msgid "%s: Not enough room for program headers (allocated %u, need %u)" +msgstr "%s: Ikke tilstrækkeligt med plads for programhoveder (allokerede %u, behøver %u)" + +#: elf.c:3708 +#, c-format +msgid "%s: Not enough room for program headers, try linking with -N" +msgstr "%s: Ikke tilstrækkeligt med plads for programhoveder, forsøg at lænke med -N" + +#: elf.c:3833 +#, c-format +msgid "Error: First section in segment (%s) starts at 0x%x whereas the segment starts at 0x%x" +msgstr "Fejl: Første sektion i segmentet (%s) begynder ved 0x%x mens segmentet begynder ved 0x%x" + +#: elf.c:4148 +#, c-format +msgid "%s: warning: allocated section `%s' not in segment" +msgstr "%s: advarsel: allokeret sektion \"%s\" ikke i segment" + +#: elf.c:4472 +#, c-format +msgid "%s: symbol `%s' required but not present" +msgstr "%s: symbol \"%s\" kræves, men er ikke tilstede" + +#: elf.c:4749 +#, c-format +msgid "%s: warning: Empty loadable segment detected, is this intentional ?\n" +msgstr "%s: advarsel: Tomt indlæsningsbart segment opdaget, er dette meningen?\n" + +#: elf.c:6193 +#, c-format +msgid "%s: unsupported relocation type %s" +msgstr "%s: relokeringstypen %s understøttes ikke" + +#: elf32-arm.h:1221 +#, c-format +msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'." +msgstr "%s: Advarsel: Arm BLX-instruktion bruger Arm-funktionen \"%s\" som mål." + +#: elf32-arm.h:1417 +#, c-format +msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'." +msgstr "%s: Advarsel: Thumb BLX-instruktionen bruger thumb-funktionen \"%s\" som mål." + +#: elf32-arm.h:1914 elf32-sh.c:4125 +#, c-format +msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section" +msgstr "%s(%s+0x%lx): %s relokering mod SEC_MERGE-sektion" + +#: elf32-arm.h:2008 +#, c-format +msgid "%s: warning: unresolvable relocation %d against symbol `%s' from %s section" +msgstr "%s: advarsel: uløselig relokering %d mod symbol \"%s\" fra sektionen %s" + +#: elf32-arm.h:2176 +#, c-format +msgid "Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it" +msgstr "Advarsel: Fjerner samvirkendeflaget i %s eftersom ikke-samvirkende kode i %s er lænket med det" + +#: elf32-arm.h:2271 +#, c-format +msgid "ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d" +msgstr "FEJL: %s er oversat for EABI version %d, mens %s er oversat for version %d" + +#: elf32-arm.h:2285 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d" +msgstr "FEJL: %s er oversat for APCS-%d, mens målet %s bruger APCS-%d" + +#: elf32-arm.h:2313 +#, c-format +msgid "ERROR: %s uses VFP instructions, whereas %s uses FPA instructions" +msgstr "FEJL: %s bruger VFP-instruktioner, mens %s bruger FPA-instruktioner" + +#: elf32-arm.h:2318 +#, c-format +msgid "ERROR: %s uses FPA instructions, whereas %s uses VFP instructions" +msgstr "FEJL: %s bruger FPA-instruktioner, mens %s bruger VFP-instruktioner" + +#: elf32-arm.h:2338 +#, c-format +msgid "ERROR: %s uses software FP, whereas %s uses hardware FP" +msgstr "FEJL: %s bruger programmeret flydende tal, mens %s bruger maskinens flydende tal" + +#: elf32-arm.h:2343 +#, c-format +msgid "ERROR: %s uses hardware FP, whereas %s uses software FP" +msgstr "FEJL: %s bruger maskinens flydende tal, mens %s bruger programmeret flydende tal" + +#. Ignore init flag - it may not be set, despite the flags field +#. containing valid data. +#: elf32-arm.h:2396 elf32-cris.c:2988 elf32-m68k.c:410 elf32-vax.c:543 +#: elfxx-mips.c:7756 +#, c-format +msgid "private flags = %lx:" +msgstr "private flag = %lx:" + +#: elf32-arm.h:2405 +msgid " [interworking enabled]" +msgstr " [samvirkende er aktiveret]" + +#: elf32-arm.h:2413 +msgid " [VFP float format]" +msgstr " [VFP-flydende talsformat]" + +#: elf32-arm.h:2415 +msgid " [FPA float format]" +msgstr " [FPA-flydende talsformat]" + +#: elf32-arm.h:2424 +msgid " [new ABI]" +msgstr " [nyt ABI]" + +#: elf32-arm.h:2427 +msgid " [old ABI]" +msgstr " [gammelt ABI]" + +#: elf32-arm.h:2430 +msgid " [software FP]" +msgstr " [programmeret FP]" + +#: elf32-arm.h:2438 +msgid " [Version1 EABI]" +msgstr " [Version1 EABI]" + +#: elf32-arm.h:2441 elf32-arm.h:2452 +msgid " [sorted symbol table]" +msgstr " [sorteret symboltabel]" + +#: elf32-arm.h:2443 elf32-arm.h:2454 +msgid " [unsorted symbol table]" +msgstr " [usorteret symboltabel]" + +#: elf32-arm.h:2449 +msgid " [Version2 EABI]" +msgstr " [Version2 EABI]" + +#: elf32-arm.h:2457 +msgid " [dynamic symbols use segment index]" +msgstr " [dynamiske symboler bruger segmentindeks]" + +#: elf32-arm.h:2460 +msgid " [mapping symbols precede others]" +msgstr " [mapningssymboler foretrækkes frem for andre]" + +#: elf32-arm.h:2467 +msgid " " +msgstr " " + +#: elf32-arm.h:2474 +msgid " [relocatable executable]" +msgstr " [relokérbar kørbar fil]" + +#: elf32-arm.h:2477 +msgid " [has entry point]" +msgstr " [har startpunkt]" + +#: elf32-arm.h:2482 +msgid "" +msgstr "" + +#: elf32-avr.c:841 elf32-cris.c:1411 elf32-fr30.c:643 elf32-frv.c:817 +#: elf32-i860.c:1039 elf32-openrisc.c:447 elf32-v850.c:1699 +#: elf32-xstormy16.c:941 elf64-mmix.c:1310 +msgid "internal error: dangerous relocation" +msgstr "intern fejl: farlig relokering" + +#: elf32-cris.c:949 +#, c-format +msgid "%s: unresolvable relocation %s against symbol `%s' from %s section" +msgstr "%s: uløselig relokering %s mod symbol \"%s\" fra sektionen %s" + +#: elf32-cris.c:1012 +#, c-format +msgid "%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section" +msgstr "%s: Hverken nogen PLT eller GOT for relokering %s mod symbol \"%s\" fra sektionen %s" + +#: elf32-cris.c:1015 elf32-cris.c:1141 +msgid "[whose name is lost]" +msgstr "[hvis navn er tabt]" + +#: elf32-cris.c:1130 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against local symbol from %s section" +msgstr "%s: relokering %s med ikke-tomt addendum %d mod lokalt symbol fra sektionen %s" + +#: elf32-cris.c:1137 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against symbol `%s' from %s section" +msgstr "%s: relokering %s med ikke-tomt addendum %d mod symbol \"%s\" fra sektionen %s" + +#: elf32-cris.c:1155 +#, c-format +msgid "%s: relocation %s is not allowed for global symbol: `%s' from %s section" +msgstr "%s: relokeringen %s er ikke tilladt for globalt symbol: \"%s\" fra sektionen %s" + +#: elf32-cris.c:1170 +#, c-format +msgid "%s: relocation %s in section %s with no GOT created" +msgstr "%s: relokering %s i sektionen %s uden GOT oprettet" + +#: elf32-cris.c:1288 +#, c-format +msgid "%s: Internal inconsistency; no relocation section %s" +msgstr "%s: Intern inkonsistens; ingen relokeringssektion %s" + +#: elf32-cris.c:2514 +#, c-format +msgid "" +"%s, section %s:\n" +" relocation %s should not be used in a shared object; recompile with -fPIC" +msgstr "" +"%s, sektion %s:\n" +" relokeringen %s bør ikke bruges i et delt objekt; genoversæt med -fPIC" + +#: elf32-cris.c:2991 +msgid " [symbols have a _ prefix]" +msgstr " [symboler har et _-præfiks]" + +#: elf32-cris.c:3030 +#, c-format +msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols" +msgstr "%s: bruger symboler med _-præfiks, men skriver fil med symboler uden præfiks" + +#: elf32-cris.c:3031 +#, c-format +msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols" +msgstr "%s: bruger symboler uden præfiks, men skriver fil med symboler med _-præfiks" + +#: elf32-frv.c:1217 +#, c-format +msgid "%s: compiled with %s and linked with modules that use non-pic relocations" +msgstr "%s: oversat med %s og lænket med moduler som bruger ikke-pic-relokering" + +#: elf32-frv.c:1267 +#, c-format +msgid "%s: compiled with %s and linked with modules compiled with %s" +msgstr "%s: oversat med %s og lænket med moduler som oversattes med %s" + +#: elf32-frv.c:1279 +#, c-format +msgid "%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%s: bruger andre ukendte e_flags-felter (0x%lx) end tidligere moduler (0x%lx)" + +#: elf32-frv.c:1315 +#, c-format +msgid "private flags = 0x%lx:" +msgstr "private flag = 0x%lx:" + +#: elf32-gen.c:82 elf64-gen.c:82 +#, c-format +msgid "%s: Relocations in generic ELF (EM: %d)" +msgstr "%s: Relokering i generisk ELF (EM: %d)" + +#: elf32-hppa.c:671 elf64-ppc.c:2323 +#, c-format +msgid "%s: cannot create stub entry %s" +msgstr "%s: kan ikke oprette stubstarten %s" + +#: elf32-hppa.c:956 elf32-hppa.c:3555 +#, c-format +msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections" +msgstr "%s(%s+0x%lx): kan ikke nå %s, genoversæt med -ffunction-sections" + +#: elf32-hppa.c:1338 elf64-x86-64.c:673 +#, c-format +msgid "%s: relocation %s can not be used when making a shared object; recompile with -fPIC" +msgstr "%s: relokeringen %s kan ikke bruges når et delt objekt oprettes; genoversæt med -fPIC" + +#: elf32-hppa.c:1358 +#, c-format +msgid "%s: relocation %s should not be used when making a shared object; recompile with -fPIC" +msgstr "%s: relokeringen %s bør ikke bruges når et delt objekt oprettes; genoversæt med -fPIC" + +#: elf32-hppa.c:1551 +#, c-format +msgid "Could not find relocation section for %s" +msgstr "Kunne ikke finde relokeringssektion for %s" + +#: elf32-hppa.c:2855 +#, c-format +msgid "%s: duplicate export stub %s" +msgstr "%s: dobbelt eksportstub %s" + +#: elf32-hppa.c:3433 +#, c-format +msgid "%s(%s+0x%lx): fixing %s" +msgstr "%s(%s+0x%lx): retter %s" + +#: elf32-hppa.c:4080 +#, c-format +msgid "%s(%s+0x%lx): cannot handle %s for %s" +msgstr "%s(%s+0x%lx): kan ikke håndtere %s for %s" + +#: elf32-hppa.c:4393 +msgid ".got section not immediately after .plt section" +msgstr ".got-sektionen følger ikke umiddelbart efter .plt-sektion" + +#: elf32-i386.c:379 +#, c-format +msgid "%s: invalid relocation type %d" +msgstr "%s: ugyldig relokeringstype %d" + +#: elf32-i386.c:876 elf32-s390.c:649 elf64-s390.c:595 elf64-x86-64.c:591 +#, c-format +msgid "%s: bad symbol index: %d" +msgstr "%s: fejlagtigt symbolindeks: %d" + +#: elf32-i386.c:948 +#, c-format +msgid "%s: `%s' accessed both as normal and thread local symbol" +msgstr "%s: \"%s\" kaldt både som lokalt normalt symbol og lokalt trådsymbol" + +#: elf32-i386.c:1072 elf32-s390.c:808 elf64-ppc.c:2827 elf64-s390.c:759 +#: elf64-x86-64.c:761 +#, c-format +msgid "%s: bad relocation section name `%s'" +msgstr "%s: fejlagtig relokeringssektionsnavn \"%s\"" + +#: elf32-i386.c:1159 elf64-alpha.c:4768 +#, c-format +msgid "%s: TLS local exec code cannot be linked into shared objects" +msgstr "%s: lokal TLS-eksekveringskode kan ikke lænkes ind i delte objekter" + +#: elf32-i386.c:2747 elf32-s390.c:1981 elf32-sparc.c:1571 elf64-ppc.c:5918 +#: elf64-s390.c:1945 elf64-sparc.c:2578 elf64-x86-64.c:1948 +#, c-format +msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'" +msgstr "%s(%s+0x%lx): uløselig relokering mod symbol \"%s\"" + +#: elf32-i386.c:2784 elf32-s390.c:2019 elf64-ppc.c:5977 elf64-s390.c:1983 +#: elf64-x86-64.c:1986 +#, c-format +msgid "%s(%s+0x%lx): reloc against `%s': error %d" +msgstr "%s(%s+0x%lx): relokering mod \"%s\": fejl %d" + +#: elf32-m32r.c:924 +msgid "SDA relocation when _SDA_BASE_ not defined" +msgstr "SDA-relokering når _SDA_BASE_ ikke er defineret" + +#: elf32-ia64.c:3687 elf32-m32r.c:1013 elf32-ppc.c:2987 elf64-alpha.c:4185 +#: elf64-alpha.c:4313 elf64-ia64.c:3687 +#, c-format +msgid "%s: unknown relocation type %d" +msgstr "%s: ukendt relokeringstype %d" + +#: elf32-m32r.c:1221 +#, c-format +msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)" +msgstr "%s: Målet (%s) for en %s-relokering er i forkert sektion (%s)" + +#: elf32-m32r.c:1947 +#, c-format +msgid "%s: Instruction set mismatch with previous modules" +msgstr "%s: Instruktionsopsætning passer ikke med tidligere moduler" + +#: elf32-m32r.c:1970 +#, c-format +msgid "private flags = %lx" +msgstr "private flag = %lx" + +#: elf32-m32r.c:1975 +msgid ": m32r instructions" +msgstr ": m32r-instruktioner" + +#: elf32-m32r.c:1976 +msgid ": m32rx instructions" +msgstr ": m32rx-instruktioner" + +#: elf32-m68k.c:413 +msgid " [cpu32]" +msgstr " [cpu32]" + +#: elf32-m68k.c:416 +msgid " [m68000]" +msgstr " [m68000]" + +#: elf32-mcore.c:354 elf32-mcore.c:457 +#, c-format +msgid "%s: Relocation %s (%d) is not currently supported.\n" +msgstr "%s: Relokering %s (%d) understøttes ikke i øjeblikket.\n" + +#: elf32-mcore.c:442 +#, c-format +msgid "%s: Unknown relocation type %d\n" +msgstr "%s: Ukendt relokeringstype %d\n" + +#: elf32-mips.c:1152 elf64-mips.c:1783 +msgid "32bits gp relative relocation occurs for an external symbol" +msgstr "32-bit gp-relativ relokering forekom for et eksternt symbol" + +#: elf32-mips.c:1301 +#, c-format +msgid "Linking mips16 objects into %s format is not supported" +msgstr "Lænkning af mips16-objekter til %s-format understøttes ikke" + +#: elf32-ppc.c:1460 +#, c-format +msgid "%s: compiled with -mrelocatable and linked with modules compiled normally" +msgstr "%s: oversat med -mrelocatable og lænket med moduler som oversattes normalt" + +#: elf32-ppc.c:1468 +#, c-format +msgid "%s: compiled normally and linked with modules compiled with -mrelocatable" +msgstr "%s: oversat normalt og lænket med moduler som oversattes med -mrelocatable" + +#: elf32-ppc.c:1494 elf64-sparc.c:2989 elfxx-mips.c:7713 +#, c-format +msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%s: bruger andre e_flags-felter (0x%lx) end tidligere moduler (0x%lx)" + +#: elf32-ppc.c:1592 +#, c-format +msgid "%s: Unknown special linker type %d" +msgstr "%s: Ukendt speciallænkertype %d" + +#: elf32-ppc.c:2273 elf32-ppc.c:2307 elf32-ppc.c:2342 +#, c-format +msgid "%s: relocation %s cannot be used when making a shared object" +msgstr "%s: relokeringen %s kan ikke bruges når et delt objekt oprettes" + +#: elf32-ppc.c:3126 elf64-ppc.c:5473 +#, c-format +msgid "%s: unknown relocation type %d for symbol %s" +msgstr "%s: ukendt relokeringstype %d for symbol %s" + +#: elf32-ppc.c:3482 elf32-ppc.c:3503 elf32-ppc.c:3553 +#, c-format +msgid "%s: The target (%s) of a %s relocation is in the wrong output section (%s)" +msgstr "%s: Målet (%s) for en %s-relokering er i forkert uddatasektion (%s)" + +#: elf32-ppc.c:3619 +#, c-format +msgid "%s: Relocation %s is not yet supported for symbol %s." +msgstr "%s: Relokeringen %s understøttes ikke endnu for symbol %s." + +#: elf32-sh.c:1964 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES offset" +msgstr "%s: 0x%lx: advarsel: fejlagtig R_SH_USES-afstand" + +#: elf32-sh.c:1976 +#, c-format +msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x" +msgstr "%s: 0x%lx: advarsel: R_SH_USES peger til ukendt instruktion 0x%x" + +#: elf32-sh.c:1993 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES load offset" +msgstr "%s: 0x%lx: advarsel: fejlagtig R_SH_USES-indlæsningsafstand" + +#: elf32-sh.c:2008 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected reloc" +msgstr "%s: 0x%lx: advarsel: kunne ikke finde forventet relokering" + +#: elf32-sh.c:2036 +#, c-format +msgid "%s: 0x%lx: warning: symbol in unexpected section" +msgstr "%s: 0x%lx: advarsel: symbol i uventet sektion" + +#: elf32-sh.c:2153 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected COUNT reloc" +msgstr "%s: 0x%lx: advarsel: kunne ikke finde forventet COUNT-relokering" + +#: elf32-sh.c:2162 +#, c-format +msgid "%s: 0x%lx: warning: bad count" +msgstr "%s: 0x%lx: advarsel: fejlagtigt antal" + +#: elf32-sh.c:2550 elf32-sh.c:2926 +#, c-format +msgid "%s: 0x%lx: fatal: reloc overflow while relaxing" +msgstr "%s: 0x%lx: fatalt: relokering giver overløb ved forenklingen" + +#: elf32-sh.c:4073 elf64-sh64.c:1576 +msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled" +msgstr "Uventet STO_SH5_ISA32 på lokalt symbol håndteres ikke" + +#: elf32-sh.c:4284 +#, c-format +msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation" +msgstr "%s: 0x%lx: fatalt: ujusteret grenmål for relokering for forenklingsunderstøttelse" + +#: elf32-sh64.c:203 elf64-sh64.c:2364 +#, c-format +msgid "%s: compiled as 32-bit object and %s is 64-bit" +msgstr "%s: oversat som 32-bitsobjekt og %s er 64-bit" + +#: elf32-sh64.c:206 elf64-sh64.c:2367 +#, c-format +msgid "%s: compiled as 64-bit object and %s is 32-bit" +msgstr "%s: oversat som 64-bitsobjekt og %s er 32-bit" + +#: elf32-sh64.c:208 elf64-sh64.c:2369 +#, c-format +msgid "%s: object size does not match that of target %s" +msgstr "%s: objektstørrelsen stemmer ikke overens med den hos målet %s" + +#: elf32-sh64.c:440 elf64-sh64.c:2941 +#, c-format +msgid "%s: encountered datalabel symbol in input" +msgstr "%s: mødte dataetikettesymbol i inddata" + +#: elf32-sh64.c:523 +msgid "PTB mismatch: a SHmedia address (bit 0 == 1)" +msgstr "PTB passer ikke: en SHmedia-adresse (bit 0 == 1)" + +#: elf32-sh64.c:526 +msgid "PTA mismatch: a SHcompact address (bit 0 == 0)" +msgstr "PTA passer ikke: en SHcompact-adresse (bit 0 == 0)" + +#: elf32-sh64.c:544 +#, c-format +msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16" +msgstr "%s: GAS-fejl: uventet PTB-instruktion med R_SH_PT_16" + +#: elf32-sh64.c:593 elf64-sh64.c:1703 +#, c-format +msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n" +msgstr "%s: fejl: ujusteret relokeringstype %d på %08x relokering %08x\n" + +#: elf32-sh64.c:677 +#, c-format +msgid "%s: could not write out added .cranges entries" +msgstr "%s: kunne ikke udskrive tilføjede .cranges-poster" + +#: elf32-sh64.c:739 +#, c-format +msgid "%s: could not write out sorted .cranges entries" +msgstr "%s: kunne ikke udskrive sorterede cranges-poster" + +#: elf32-sparc.c:1535 elf64-sparc.c:2224 +#, c-format +msgid "%s: probably compiled without -fPIC?" +msgstr "%s: nok oversat uden -fPIC?" + +#: elf32-sparc.c:2002 +#, c-format +msgid "%s: compiled for a 64 bit system and target is 32 bit" +msgstr "%s: oversat for et 64-bitssystem og målet er 32-bit" + +#: elf32-sparc.c:2016 +#, c-format +msgid "%s: linking little endian files with big endian files" +msgstr "%s: lænker little endian-filer med big endian-filer" + +#: elf32-v850.c:682 +#, c-format +msgid "Variable `%s' cannot occupy in multiple small data regions" +msgstr "Variabel \"%s\" kan ikke befinde sig i flere små dataområder" + +#: elf32-v850.c:685 +#, c-format +msgid "Variable `%s' can only be in one of the small, zero, and tiny data regions" +msgstr "Variabel \"%s\" kan kun være i ét af de små, tomme og bittesmå dataområder" + +#: elf32-v850.c:688 +#, c-format +msgid "Variable `%s' cannot be in both small and zero data regions simultaneously" +msgstr "Variabel \"%s\" kan ikke være i både små og tomme dataområder samtidigt" + +#: elf32-v850.c:691 +#, c-format +msgid "Variable `%s' cannot be in both small and tiny data regions simultaneously" +msgstr "Variabel \"%s\" kan ikke være i både små og bittesmå dataområder samtidigt" + +#: elf32-v850.c:694 +#, c-format +msgid "Variable `%s' cannot be in both zero and tiny data regions simultaneously" +msgstr "Variabel \"%s\" kan ikke være i både tomme og bittesmå dataområder samtidigt" + +#: elf32-v850.c:1072 +msgid "FAILED to find previous HI16 reloc\n" +msgstr "MISLYKKEDES med at finde tidligere HI16-relokering\n" + +#: elf32-v850.c:1703 +msgid "could not locate special linker symbol __gp" +msgstr "kunne ikke lokalisere specielt lænkersymbol __gp" + +#: elf32-v850.c:1707 +msgid "could not locate special linker symbol __ep" +msgstr "kunne ikke lokalisere specielt lænkersymbol __ep" + +#: elf32-v850.c:1711 +msgid "could not locate special linker symbol __ctbp" +msgstr "kunne ikke lokalisere specielt lænkersymbol __ctbp" + +#: elf32-v850.c:1875 +#, c-format +msgid "%s: Architecture mismatch with previous modules" +msgstr "%s: Arkitekturen passer ikke sammen med tidligere moduler" + +#: elf32-v850.c:1895 +#, c-format +msgid "private flags = %lx: " +msgstr "private flag = %lx: " + +#: elf32-v850.c:1900 +msgid "v850 architecture" +msgstr "v850-arkitektur" + +#: elf32-v850.c:1901 +msgid "v850e architecture" +msgstr "v850e-arkitektur" + +#: elf32-v850.c:1902 +msgid "v850ea architecture" +msgstr "v850ea-arkitektur" + +#: elf32-vax.c:546 +msgid " [nonpic]" +msgstr " [ikke-pic]" + +#: elf32-vax.c:549 +msgid " [d-float]" +msgstr " [d-flydende tal]" + +#: elf32-vax.c:552 +msgid " [g-float]" +msgstr " [g-flydende tal]" + +#: elf32-vax.c:674 +#, c-format +msgid "%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of %ld" +msgstr "%s: advarsel: GOT-addendum %ld til \"%s\" stemmer ikke overens med tidligere GOT-addendum %ld" + +#: elf32-vax.c:1679 +#, c-format +msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored" +msgstr "%s: advarsel: PLT-addendum %d til \"%s\" fra sektionen %s ignoreredes" + +#: elf32-vax.c:1814 +#, c-format +msgid "%s: warning: %s relocation against symbol `%s' from %s section" +msgstr "%s: advarsel: %s-relokering mod symbol \"%s\" fra sektionen %s" + +#: elf32-vax.c:1820 +#, c-format +msgid "%s: warning: %s relocation to 0x%x from %s section" +msgstr "%s: advarsel: %s-relokering til 0x%x fra sektionen %s" + +#: elf32-ia64.c:2280 elf32-xstormy16.c:414 elf64-ia64.c:2280 +msgid "non-zero addend in @fptr reloc" +msgstr "ikke-tomt addendum i @fptr-relokering" + +#: elf64-alpha.c:1097 +msgid "GPDISP relocation did not find ldah and lda instructions" +msgstr "GPDISP-relokering fandt ingen ldah- og lda-instruktioner" + +#: elf64-alpha.c:3675 +#, c-format +msgid "%s: .got subsegment exceeds 64K (size %d)" +msgstr "%s: .got-subsegment overskrider 64 kB (størrelse %d)" + +#: elf64-alpha.c:4498 elf64-alpha.c:4510 +#, c-format +msgid "%s: gp-relative relocation against dynamic symbol %s" +msgstr "%s: gp-relativ relokering mod dynamisk symbol %s" + +#: elf64-alpha.c:4536 elf64-alpha.c:4676 +#, c-format +msgid "%s: pc-relative relocation against dynamic symbol %s" +msgstr "%s: pc-relativ relokering mod dynamisk symbol %s" + +#: elf64-alpha.c:4564 +#, c-format +msgid "%s: change in gp: BRSGP %s" +msgstr "%s: ændring i gp: BRSGP %s" + +#: elf64-alpha.c:4589 +msgid "" +msgstr "" + +#: elf64-alpha.c:4594 +#, c-format +msgid "%s: !samegp reloc against symbol without .prologue: %s" +msgstr "%s: !samegp-relokering mod symbol uden .prologue: %s" + +#: elf64-alpha.c:4639 +#, c-format +msgid "%s: unhandled dynamic relocation against %s" +msgstr "%s: uhåndteret dynamisk relokering mod %s" + +#: elf64-alpha.c:4752 +#, c-format +msgid "%s: dtp-relative relocation against dynamic symbol %s" +msgstr "%s: dtp-relativ relokering mod dynamisk symbol %s" + +#: elf64-alpha.c:4775 +#, c-format +msgid "%s: tp-relative relocation against dynamic symbol %s" +msgstr "%s: tp-relativ relokering mod dynamisk symbol %s" + +#: elf64-hppa.c:2080 +#, c-format +msgid "stub entry for %s cannot load .plt, dp offset = %ld" +msgstr "stubpost for %s kan ikke indlæse .plt, dp-afstand = %ld" + +#: elf64-mmix.c:1002 +#, c-format +msgid "" +"%s: Internal inconsistency error for value for\n" +" linker-allocated global register: linked: 0x%lx%08lx != relaxed: 0x%lx%08lx\n" +msgstr "" +"%s: Intern inkonsistensfejl for værdien for\n" +" lænkerallokeret globalt register: lænket: 0x%lx%08lx != forenklet: 0x%lx%08lx\n" + +#: elf64-mmix.c:1386 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: (unknown) in %s" +msgstr "%s: base-plus-afstandsrelokering mod registersymbol: (ukendt) i %s" + +#: elf64-mmix.c:1391 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: %s in %s" +msgstr "%s: base-plus-afstandsrelokering mod registersymbol: %s i %s" + +#: elf64-mmix.c:1435 +#, c-format +msgid "%s: register relocation against non-register symbol: (unknown) in %s" +msgstr "%s: registerrelokering mod ikke-registersymbol: (ukendt) i %s" + +#: elf64-mmix.c:1440 +#, c-format +msgid "%s: register relocation against non-register symbol: %s in %s" +msgstr "%s: registerrelokering mod ikke-registersymbol: %s i %s" + +#: elf64-mmix.c:1477 +#, c-format +msgid "%s: directive LOCAL valid only with a register or absolute value" +msgstr "%s: LOCAL-direktivet er kun gyldigt med et register eller en absolutværdi" + +#: elf64-mmix.c:1505 +#, c-format +msgid "%s: LOCAL directive: Register $%ld is not a local register. First global register is $%ld." +msgstr "%s: LOCAL-direktiv: Register $%ld er ikke et lokalt register. Første globale register er $%ld." + +#: elf64-mmix.c:1965 +#, c-format +msgid "%s: Error: multiple definition of `%s'; start of %s is set in a earlier linked file\n" +msgstr "%s: Fejl: flere definitioner af \"%s\"; begyndelsen på %s er sat i en tidligere lænket fil\n" + +#: elf64-mmix.c:2024 +msgid "Register section has contents\n" +msgstr "Registersektion har indhold\n" + +#: elf64-mmix.c:2186 +#, c-format +msgid "" +"Internal inconsistency: remaining %u != max %u.\n" +" Please report this bug." +msgstr "" +"Intern inkonsekvens: genstående %u != max %u.\n" +" Rapportér gerne denne fejl." + +#: elf64-ppc.c:1669 libbfd.c:1435 +#, c-format +msgid "%s: compiled for a big endian system and target is little endian" +msgstr "%s: oversat for et big endian-system og målet er little endian" + +#: elf64-ppc.c:1671 libbfd.c:1437 +#, c-format +msgid "%s: compiled for a little endian system and target is big endian" +msgstr "%s: oversat for et little endian-system og målet er big endian" + +#: elf64-ppc.c:3610 +#, c-format +msgid "%s: unexpected reloc type %u in .opd section" +msgstr "%s: uventet relokeringstype %u i .opd-sektion" + +#: elf64-ppc.c:3630 +#, c-format +msgid "%s: .opd is not a regular array of opd entries" +msgstr "%s: .opd er ikke en almindelig vektor med opd-poster" + +#: elf64-ppc.c:3672 +#, c-format +msgid "%s: undefined sym `%s' in .opd section" +msgstr "%s: udefineret symbol \"%s\" i .opd-sektion" + +#: elf64-ppc.c:4397 +#, c-format +msgid "can't find branch stub `%s'" +msgstr "kan ikke finde grenstub \"%s\"" + +#: elf64-ppc.c:4436 elf64-ppc.c:4501 +#, c-format +msgid "linkage table error against `%s'" +msgstr "lænketabelsfejl mod \"%s\"" + +#: elf64-ppc.c:4573 +#, c-format +msgid "can't build branch stub `%s'" +msgstr "kan ikke bygge grenstub \"%s\"" + +#: elf64-ppc.c:5179 +msgid "stubs don't match calculated size" +msgstr "stubbe stemmer ikke overens med beregnet størrelse" + +#: elf64-ppc.c:5828 +#, c-format +msgid "%s: Relocation %s is not supported for symbol %s." +msgstr "%s: Relokeringen %s understøttes ikke for symbol %s." + +#: elf64-ppc.c:5872 +#, c-format +msgid "%s: error: relocation %s not a multiple of 4" +msgstr "%s: fejl: relokeringen %s er ikke en multipel af 4" + +#: elf64-sparc.c:1280 +#, c-format +msgid "%s: check_relocs: unhandled reloc type %d" +msgstr "%s: check_relocs: uhåndteret relokeringstype %d" + +#: elf64-sparc.c:1317 +#, c-format +msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER" +msgstr "%s: Kun register %%g[2367] kan deklareres med STT_REGISTER" + +#: elf64-sparc.c:1337 +#, c-format +msgid "Register %%g%d used incompatibly: %s in %s, previously %s in %s" +msgstr "Register %%g%d brugt inkompatibelt: %s i %s, tidligere %s i %s" + +#: elf64-sparc.c:1360 +#, c-format +msgid "Symbol `%s' has differing types: REGISTER in %s, previously %s in %s" +msgstr "Symbol \"%s\" har forskellige typer: REGISTER i %s, tidligere %s i %s" + +#: elf64-sparc.c:1406 +#, c-format +msgid "Symbol `%s' has differing types: %s in %s, previously REGISTER in %s" +msgstr "Symbol \"%s\" har forskellige typer: %s i %s, tidligere REGISTER i %s" + +#: elf64-sparc.c:2970 +#, c-format +msgid "%s: linking UltraSPARC specific with HAL specific code" +msgstr "%s: lænker UltraSPARC-specifik med HAL-specifik kode" + +#: elfcode.h:1198 +#, c-format +msgid "%s: version count (%ld) does not match symbol count (%ld)" +msgstr "%s: versionsantal (%ld) stemmer ikke med symbolantal (%ld)" + +#: elflink.c:440 +#, c-format +msgid "%s: Section %s is too large to add hole of %ld bytes" +msgstr "%s: Sektionen %s er for stor til at stoppe hul med %ld byte i" + +#: elflink.h:1090 +#, c-format +msgid "%s: warning: unexpected redefinition of `%s'" +msgstr "%s: advarsel: uventet omdefinition af \"%s\"" + +#: elflink.h:1727 +#, c-format +msgid "%s: %s: invalid version %u (max %d)" +msgstr "%s: %s: ugyldig version %u (max %d)" + +#: elflink.h:1768 +#, c-format +msgid "%s: %s: invalid needed version %d" +msgstr "%s: %s: ugyldig krævet version %d" + +#: elflink.h:1890 +#, c-format +msgid "Warning: size of symbol `%s' changed from %lu to %lu in %s" +msgstr "Advarsel: størrelsen på symbol \"%s\" ændredes fra %lu til %lu i %s" + +#: elflink.h:3174 +#, c-format +msgid "%s: .preinit_array section is not allowed in DSO" +msgstr "%s: .preinit_array-sektionen er ikke tilladt i DSO" + +#: elflink.h:4030 +#, c-format +msgid "warning: type and size of dynamic symbol `%s' are not defined" +msgstr "advarsel: typen og størrelsen på dynamisk symbol \"%s\" er ikke defineret" + +#: elflink.h:4345 +#, c-format +msgid "%s: undefined versioned symbol name %s" +msgstr "%s: udefineret symbolnavn med version %s" + +#: elflink.h:4611 elflink.h:4619 elflink.h:6508 elflink.h:7600 +msgid "Error: out of memory" +msgstr "Fejl: ikke mere hukommelse" + +#: elflink.h:4781 +msgid "Not enough memory to sort relocations" +msgstr "Ikke nok hukommelse til at sortere relokeringer" + +#: elflink.h:5682 elflink.h:5725 +#, c-format +msgid "%s: could not find output section %s" +msgstr "%s: kunne ikke finde uddatasektionen %s" + +#: elflink.h:5688 +#, c-format +msgid "warning: %s section has zero size" +msgstr "advarsel: %s-sektionen har nulstørrelse" + +#: elflink.h:6275 +#, c-format +msgid "%s: could not find output section %s for input section %s" +msgstr "%s: kunne ikke finde uddatasektionen %s for inddatasektionen %s" + +#: elflink.h:6486 +#, c-format +msgid "%s: relocation size mismatch in %s section %s" +msgstr "%s: relokeringsstørrelsen stemmer ikke overens i %s-sektionen %s" + +#: elflink.h:6849 +msgid "warning: relocation against removed section; zeroing" +msgstr "advarsel: relokering mod fjernet sektion; nulstiller" + +#: elflink.h:6879 +msgid "warning: relocation against removed section" +msgstr "advarsel: relokering mod fjernet sektion" + +#: elflink.h:6892 +#, c-format +msgid "local symbols in discarded section %s" +msgstr "lokale symboler i bortkastet sektion %s" + +#: elfxx-mips.c:734 +msgid "static procedure (no name)" +msgstr "statisk procedure (intet navn)" + +#: elfxx-mips.c:1601 +msgid "not enough GOT space for local GOT entries" +msgstr "ikke nok med GOT-plads for lokale GOT-poster" + +#: elfxx-mips.c:2750 +#, c-format +msgid "%s: %s+0x%lx: jump to stub routine which is not jal" +msgstr "%s: %s+0x%lx: hop til stubrutine som ikke er jal" + +#: elfxx-mips.c:4270 +#, c-format +msgid "%s: Malformed reloc detected for section %s" +msgstr "%s: Fejlagtig relokering for sektion %s opdaget" + +#: elfxx-mips.c:4348 +#, c-format +msgid "%s: CALL16 reloc at 0x%lx not against global symbol" +msgstr "%s: CALL16-relokering ved 0x%lx er ikke mod globalt symbol" + +#: elfxx-mips.c:7301 +#, c-format +msgid "%s: illegal section name `%s'" +msgstr "%s: ugyldigt sektionsnavn \"%s\"" + +#: elfxx-mips.c:7615 +#, c-format +msgid "%s: linking PIC files with non-PIC files" +msgstr "%s: lænker PIC-filer med ikke-PIC-filer" + +#: elfxx-mips.c:7625 +#, c-format +msgid "%s: linking abicalls files with non-abicalls files" +msgstr "%s: lænker abicalls-filer med ikke-abicalls-filer" + +#: elfxx-mips.c:7654 +#, c-format +msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)" +msgstr "%s: ISA (-mips%d) passer ikke med tidligere moduler (-mips%d)" + +#: elfxx-mips.c:7676 +#, c-format +msgid "%s: ISA mismatch (%d) with previous modules (%d)" +msgstr "%s: ISA (%d) passer ikke med tidligere moduler (%d)" + +#: elfxx-mips.c:7699 +#, c-format +msgid "%s: ABI mismatch: linking %s module with previous %s modules" +msgstr "%s: ABI passer ikke: lænker %s-modul med tidligere %s-moduler" + +#: elfxx-mips.c:7759 +msgid " [abi=O32]" +msgstr " [abi=O32]" + +#: elfxx-mips.c:7761 +msgid " [abi=O64]" +msgstr " [abi=O64]" + +#: elfxx-mips.c:7763 +msgid " [abi=EABI32]" +msgstr " [abi=EABI32]" + +#: elfxx-mips.c:7765 +msgid " [abi=EABI64]" +msgstr " [abi=EABI64]" + +#: elfxx-mips.c:7767 +msgid " [abi unknown]" +msgstr " [ukendt abi]" + +#: elfxx-mips.c:7769 +msgid " [abi=N32]" +msgstr " [abi=N32]" + +#: elfxx-mips.c:7771 +msgid " [abi=64]" +msgstr " [abi=64]" + +#: elfxx-mips.c:7773 +msgid " [no abi set]" +msgstr " [intet abi sat]" + +#: elfxx-mips.c:7776 +msgid " [mips1]" +msgstr " [mips1]" + +#: elfxx-mips.c:7778 +msgid " [mips2]" +msgstr " [mips2]" + +#: elfxx-mips.c:7780 +msgid " [mips3]" +msgstr " [mips3]" + +#: elfxx-mips.c:7782 +msgid " [mips4]" +msgstr " [mips4]" + +#: elfxx-mips.c:7784 +msgid " [mips5]" +msgstr " [mips5]" + +#: elfxx-mips.c:7786 +msgid " [mips32]" +msgstr " [mips32]" + +#: elfxx-mips.c:7788 +msgid " [mips64]" +msgstr " [mips64]" + +#: elfxx-mips.c:7790 +msgid " [unknown ISA]" +msgstr " [ukendt ISA]" + +#: elfxx-mips.c:7793 +msgid " [mdmx]" +msgstr " [mdmx]" + +#: elfxx-mips.c:7796 +msgid " [mips16]" +msgstr " [mips16]" + +#: elfxx-mips.c:7799 +msgid " [32bitmode]" +msgstr " [32-bittilstand]" + +#: elfxx-mips.c:7801 +msgid " [not 32bitmode]" +msgstr " [ikke 32-bittilstand]" + +#: i386linux.c:458 m68klinux.c:462 sparclinux.c:459 +#, c-format +msgid "Output file requires shared library `%s'\n" +msgstr "Uddatafilen kræver delt bibliotek \"%s\"\n" + +#: i386linux.c:466 m68klinux.c:470 sparclinux.c:467 +#, c-format +msgid "Output file requires shared library `%s.so.%s'\n" +msgstr "Uddatafilen kræver delt bibliotek \"%s.so.%s\"\n" + +#: i386linux.c:655 i386linux.c:705 m68klinux.c:662 m68klinux.c:710 +#: sparclinux.c:657 sparclinux.c:707 +#, c-format +msgid "Symbol %s not defined for fixups\n" +msgstr "Symbol %s er ikke defineret for rettelser\n" + +#: i386linux.c:729 m68klinux.c:734 sparclinux.c:731 +msgid "Warning: fixup count mismatch\n" +msgstr "Advarsel: antal rettelser stemmer ikke\n" + +#: ieee.c:235 +#, c-format +msgid "%s: string too long (%d chars, max 65535)" +msgstr "%s: strengen er for lang (%d tegn, max 65535)" + +#: ieee.c:365 +#, c-format +msgid "%s: unrecognized symbol `%s' flags 0x%x" +msgstr "%s: ukendt symbol \"%s\" flag 0x%x" + +#: ieee.c:877 +#, c-format +msgid "%s: unimplemented ATI record %u for symbol %u" +msgstr "%s: ikke implementeret ATI-post %u for symbol %u" + +#: ieee.c:902 +#, c-format +msgid "%s: unexpected ATN type %d in external part" +msgstr "%s: uventet ATN-type %d i ekstern del" + +#: ieee.c:924 +#, c-format +msgid "%s: unexpected type after ATN" +msgstr "%s: uventet type efter ATN" + +#: ihex.c:258 +#, c-format +msgid "%s:%d: unexpected character `%s' in Intel Hex file\n" +msgstr "%s:%d: uventet tegn \"%s\" i heksadecimal Intel-fil\n" + +#: ihex.c:366 +#, c-format +msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)" +msgstr "%s:%u: fejlagtig kontrolsum i heksadecimal Intel-fil (forventede %u, fandt %u)" + +#: ihex.c:420 +#, c-format +msgid "%s:%u: bad extended address record length in Intel Hex file" +msgstr "%s:%u: fejlagtig længde på post for udvidet adresse i heksadecimal Intel-fil" + +#: ihex.c:437 +#, c-format +msgid "%s:%u: bad extended start address length in Intel Hex file" +msgstr "%s:%u: fejlagtig længde på udvidet startadresse i heksadecimal Intel-fil" + +#: ihex.c:454 +#, c-format +msgid "%s:%u: bad extended linear address record length in Intel Hex file" +msgstr "%s:%u: fejlagtig længde på post for udvidet lineær adresse i heksadecimal Intel-fil" + +#: ihex.c:471 +#, c-format +msgid "%s:%u: bad extended linear start address length in Intel Hex file" +msgstr "%s:%u: fejlagtig længde på post for udvidet lineær startadresse i heksadecimal Intel-fil" + +#: ihex.c:488 +#, c-format +msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n" +msgstr "%s:%u: ukendt ihex-type %u i heksadecimal Intel-fil\n" + +#: ihex.c:607 +#, c-format +msgid "%s: internal error in ihex_read_section" +msgstr "%s: intern fejl i ihex_read_section" + +#: ihex.c:642 +#, c-format +msgid "%s: bad section length in ihex_read_section" +msgstr "%s: fejlagtig sektionslængde i ihex_read_sektion" + +#: ihex.c:860 +#, c-format +msgid "%s: address 0x%s out of range for Intel Hex file" +msgstr "%s: adressen 0x%s er uden for intervallet for heksadecimal Intel-fil" + +#: libbfd.c:492 +#, c-format +msgid "not mapping: data=%lx mapped=%d\n" +msgstr "mapper ikke: data=%lx mappet=%d\n" + +#: libbfd.c:495 +msgid "not mapping: env var not set\n" +msgstr "mapper ikke: miljøvariabel er ikke sat\n" + +#: libbfd.c:1466 +#, c-format +msgid "Deprecated %s called at %s line %d in %s\n" +msgstr "Forældet %s kaldt ved %s linje %d i %s\n" + +#: libbfd.c:1469 +#, c-format +msgid "Deprecated %s called\n" +msgstr "Forældet %s kaldt\n" + +#: linker.c:1873 +#, c-format +msgid "%s: indirect symbol `%s' to `%s' is a loop" +msgstr "%s: indirekte symbol \"%s\" til \"%s\" er en løkke" + +#: linker.c:2776 +#, c-format +msgid "Attempt to do relocateable link with %s input and %s output" +msgstr "Forsøg at lave en relokérbar lænke med %s-inddata og %s-uddata" + +#: merge.c:892 +#, c-format +msgid "%s: access beyond end of merged section (%ld + %ld)" +msgstr "%s: adgang udover slutningen på sammenslagt sektion (%ld + %ld)" + +#: mmo.c:460 +#, c-format +msgid "%s: No core to allocate section name %s\n" +msgstr "%s: Ingen kerne til at allokere sektionsnavn %s\n" + +#: mmo.c:536 +#, c-format +msgid "%s: No core to allocate a symbol %d bytes long\n" +msgstr "%s: Ingen kerne til at allokere et %d byte langt symbol\n" + +#: mmo.c:1245 +#, c-format +msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n" +msgstr "%s: ugyldig mmo-fil: initieringsværdi for $255 er ikke \"Main\"\n" + +#: mmo.c:1391 +#, c-format +msgid "%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name starting with `%s'\n" +msgstr "%s: bred tegn-sekvens som ikke understøttes 0x%02X 0x%02X efter symbolnavnet som begynder med \"%s\"\n" + +#: mmo.c:1633 +#, c-format +msgid "%s: invalid mmo file: unsupported lopcode `%d'\n" +msgstr "%s: ugyldig mmo-fil: lopkode \"%d\" understøttes ikke\n" + +#: mmo.c:1643 +#, c-format +msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n" +msgstr "%s: ugyldig mmo-fil: forventede YZ = 1 fik YZ = %d for lop_quote\n" + +#: mmo.c:1679 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n" +msgstr "%s: ugyldig mmo-fil: forventede z = 1 eller z = 2, fik z = %d for lop_loc\n" + +#: mmo.c:1725 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n" +msgstr "%s: ugyldig mmo-fil: forventede z = 1 eller z = 2, fik z = %d for lop_fixo\n" + +#: mmo.c:1764 +#, c-format +msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n" +msgstr "%s: ugyldig mmo-fil: forventede y = 0, fik y = %d for lop_fixrx\n" + +#: mmo.c:1773 +#, c-format +msgid "%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n" +msgstr "%s: ugyldig mmo-fil: forventede z = 16 eller z = 24, fik z = %d for lop_fixr\n" + +#: mmo.c:1796 +#, c-format +msgid "%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d for lop_fixrx\n" +msgstr "%s: ugyldig mmo-fil: indledende byte i operandord skal være 0 eller 1, fik %d for lop_fixrx\n" + +#: mmo.c:1819 +#, c-format +msgid "%s: cannot allocate file name for file number %d, %d bytes\n" +msgstr "%s: kan ikke allokere filnavn for fil nummer %d, %d byte\n" + +#: mmo.c:1839 +#, c-format +msgid "%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n" +msgstr "%s: ugyldig mmo-fil: fil nummer %d \"%s\", var allerede angivet som \"%s\"\n" + +#: mmo.c:1852 +#, c-format +msgid "%s: invalid mmo file: file name for number %d was not specified before use\n" +msgstr "%s: ugyldig mmo-fil: filnavnet for nummer %d blev ikke angivet inden brug\n" + +#: mmo.c:1958 +#, c-format +msgid "%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n" +msgstr "%s: ugyldig mmo-fil: felter y og z i lop_stab er ikke-tomme, y: %d, z: %d\n" + +#: mmo.c:1994 +#, c-format +msgid "%s: invalid mmo file: lop_end not last item in file\n" +msgstr "%s: ugyldig mmo-fil: lop_end er ikke sidste objekt i fil\n" + +#: mmo.c:2007 +#, c-format +msgid "%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras to the preceding lop_stab (%ld)\n" +msgstr "%s: ugyldig mmo-fil: YZ i lop_end (%ld) er ikke lig med antal af tetraer til den foregående lop_stab (%ld)\n" + +#: mmo.c:2670 +#, c-format +msgid "%s: invalid symbol table: duplicate symbol `%s'\n" +msgstr "%s: ugyldig symboltabel: dubletsymbol \"%s\"\n" + +#: mmo.c:2921 +#, c-format +msgid "%s: Bad symbol definition: `Main' set to %s rather than the start address %s\n" +msgstr "%s: Fejlagtig symboldefinition: \"Main\" er sat til %s i stedet for startadressen %s\n" + +#: mmo.c:3011 +#, c-format +msgid "%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: %d. Only `Main' will be emitted.\n" +msgstr "%s: advarsel: symboltabellen er for stor for mmo, større end 65535 32-bit ord: %d. Kun \"Main\" vil blive sendt.\n" + +#: mmo.c:3056 +#, c-format +msgid "%s: internal error, symbol table changed size from %d to %d words\n" +msgstr "%s: intern fejl, symboltabellen ændrede størrelse fra %d til %d ord\n" + +#: mmo.c:3111 +#, c-format +msgid "%s: internal error, internal register section %s had contents\n" +msgstr "%s: intern fejl, den interne registersektion %s havde indhold\n" + +#: mmo.c:3163 +#, c-format +msgid "%s: no initialized registers; section length 0\n" +msgstr "%s: ingen initierede registre; sektionslængde 0\n" + +#: mmo.c:3169 +#, c-format +msgid "%s: too many initialized registers; section length %ld\n" +msgstr "%s: for mange initierede registre; sektionslængde %ld\n" + +#: mmo.c:3174 +#, c-format +msgid "%s: invalid start address for initialized registers of length %ld: 0x%lx%08lx\n" +msgstr "%s: ugyldig startadresse for initierede registre med længden %ld: 0x%lx%08lx\n" + +#: oasys.c:1029 +#, c-format +msgid "%s: can not represent section `%s' in oasys" +msgstr "%s: kan ikke repræsentere sektionen \"%s\" i oasys" + +#: osf-core.c:132 +#, c-format +msgid "Unhandled OSF/1 core file section type %d\n" +msgstr "Uhåndteret sektionstype %d for OSF/1-hukommelsesfil\n" + +#: pe-mips.c:658 +#, c-format +msgid "%s: `ld -r' not supported with PE MIPS objects\n" +msgstr "%s: \"ld -r\" understøttes ikke med PE MIPS-objekt\n" + +#. OK, at this point the following variables are set up: +#. src = VMA of the memory we're fixing up +#. mem = pointer to memory we're fixing up +#. val = VMA of what we need to refer to +#. +#: pe-mips.c:794 +#, c-format +msgid "%s: unimplemented %s\n" +msgstr "%s: uimplementeret %s\n" + +#: pe-mips.c:820 +#, c-format +msgid "%s: jump too far away\n" +msgstr "%s: hop for langt bort\n" + +#: pe-mips.c:847 +#, c-format +msgid "%s: bad pair/reflo after refhi\n" +msgstr "%s: fejlagtigt par/reflo efter refhi\n" + +#. XXX code yet to be written. +#: peicode.h:785 +#, c-format +msgid "%s: Unhandled import type; %x" +msgstr "%s: Uhåndteret importtype; %x" + +#: peicode.h:790 +#, c-format +msgid "%s: Unrecognised import type; %x" +msgstr "%s: Ukendt importtype; %x" + +#: peicode.h:804 +#, c-format +msgid "%s: Unrecognised import name type; %x" +msgstr "%s: Ukendt importnavnstype; %x" + +#: peicode.h:1162 +#, c-format +msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive" +msgstr "%s: Ukendt maskintype (0x%x) i Import Library Format-arkiv" + +#: peicode.h:1174 +#, c-format +msgid "%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive" +msgstr "%s: Kendt, men uhåndteret maskintype (0x%x) i Import Library Format-arkiv" + +#: peicode.h:1191 +#, c-format +msgid "%s: size field is zero in Import Library Format header" +msgstr "%s: størrelsesfeltet er nul i Import Library Format-hoved" + +#: peicode.h:1219 +#, c-format +msgid "%s: string not null terminated in ILF object file." +msgstr "%s: streng ikke nultermineret i ILF-objektfil." + +#: ppcboot.c:416 +msgid "" +"\n" +"ppcboot header:\n" +msgstr "" +"\n" +"ppcboot-hoved:\n" + +#: ppcboot.c:417 +#, c-format +msgid "Entry offset = 0x%.8lx (%ld)\n" +msgstr "Startafstand = 0x%.8lx (%ld)\n" + +#: ppcboot.c:418 +#, c-format +msgid "Length = 0x%.8lx (%ld)\n" +msgstr "Længde = 0x%.8lx (%ld)\n" + +#: ppcboot.c:421 +#, c-format +msgid "Flag field = 0x%.2x\n" +msgstr "Flagfelt = 0x%.2x\n" + +#: ppcboot.c:427 +#, c-format +msgid "Partition name = \"%s\"\n" +msgstr "Partitionsnavn = \"%s\"\n" + +#: ppcboot.c:446 +#, c-format +msgid "" +"\n" +"Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "" +"\n" +"Start på partition[%d] = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:452 +#, c-format +msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "Slut på partition[%d] = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:458 +#, c-format +msgid "Partition[%d] sector = 0x%.8lx (%ld)\n" +msgstr "Sektor for partition[%d] = 0x%.8lx (%ld)\n" + +#: ppcboot.c:459 +#, c-format +msgid "Partition[%d] length = 0x%.8lx (%ld)\n" +msgstr "Længde på partition[%d] = 0x%.8lx (%ld)\n" + +#: som.c:5398 +msgid "som_sizeof_headers unimplemented" +msgstr "som_sizeof_headers er ikke implementeret" + +#: srec.c:301 +#, c-format +msgid "%s:%d: Unexpected character `%s' in S-record file\n" +msgstr "%s:%d: Uventet tegn \"%s\" i S-postfil\n" + +# Hvad er stabs? +#: stabs.c:319 +#, c-format +msgid "%s(%s+0x%lx): Stabs entry has invalid string index." +msgstr "%s(%s+0x%lx): Stabpost har ugyldigt strengindeks." + +#: syms.c:1044 +msgid "Unsupported .stab relocation" +msgstr ".stab-relokering som ikke understøttes" + +#: vms-gsd.c:356 +#, c-format +msgid "bfd_make_section (%s) failed" +msgstr "bfd_make_section (%s) mislykkedes" + +#: vms-gsd.c:371 +#, c-format +msgid "bfd_set_section_flags (%s, %x) failed" +msgstr "bfd_set_section_flags (%s, %x) mislykkedes" + +#: vms-gsd.c:407 +#, c-format +msgid "Size mismatch section %s=%lx, %s=%lx" +msgstr "Størrelsen passer ikke på sektion %s=%lx, %s=%lx" + +#: vms-gsd.c:702 +#, c-format +msgid "unknown gsd/egsd subtype %d" +msgstr "ukendt gsd/egsd-undertype %d" + +#: vms-hdr.c:406 +msgid "Object module NOT error-free !\n" +msgstr "Objektmodulet IKKE fejlfri!\n" + +#: vms-misc.c:543 +#, c-format +msgid "Stack overflow (%d) in _bfd_vms_push" +msgstr "Stakken giver overløb (%d) i _bfd_vms_push" + +#: vms-misc.c:561 +msgid "Stack underflow in _bfd_vms_pop" +msgstr "Stakken giver underløb i _bfd_vms_pop" + +#: vms-misc.c:919 +msgid "_bfd_vms_output_counted called with zero bytes" +msgstr "_bfd_vms_output_counted kaldt med nul byte" + +#: vms-misc.c:924 +msgid "_bfd_vms_output_counted called with too many bytes" +msgstr "_bfd_vms_output_counted kaldt med for mange byte" + +#: vms-misc.c:1055 +#, c-format +msgid "Symbol %s replaced by %s\n" +msgstr "Symbol %s erstattet med %s\n" + +#: vms-misc.c:1117 +#, c-format +msgid "failed to enter %s" +msgstr "mislykkedes med at gå ind i %s" + +#: vms-tir.c:81 +msgid "No Mem !" +msgstr "Ingen hukommelse!" + +#: vms-tir.c:362 +#, c-format +msgid "bad section index in %s" +msgstr "fejlagtigt sektionsindeks i %s" + +#: vms-tir.c:375 +#, c-format +msgid "unsupported STA cmd %s" +msgstr "STA-kommando %s understøttes ikke" + +#: vms-tir.c:380 vms-tir.c:1240 +#, c-format +msgid "reserved STA cmd %d" +msgstr "reserveret STA-kommando %d" + +#: vms-tir.c:491 vms-tir.c:514 +#, c-format +msgid "%s: no symbol \"%s\"" +msgstr "%s: intet symbol \"%s\"" + +#. unsigned shift +#. rotate +#. Redefine symbol to current location. +#. Define a literal. +#: vms-tir.c:581 vms-tir.c:693 vms-tir.c:803 vms-tir.c:821 vms-tir.c:829 +#: vms-tir.c:838 vms-tir.c:1563 +#, c-format +msgid "%s: not supported" +msgstr "%s: understøttes ikke" + +#: vms-tir.c:586 vms-tir.c:1418 +#, c-format +msgid "%s: not implemented" +msgstr "%s: ikke implementeret" + +#: vms-tir.c:590 vms-tir.c:1422 +#, c-format +msgid "reserved STO cmd %d" +msgstr "reserveret STO-kommando %d" + +#: vms-tir.c:708 vms-tir.c:1568 +#, c-format +msgid "reserved OPR cmd %d" +msgstr "reserveret OPR-kommando %d" + +#: vms-tir.c:776 vms-tir.c:1632 +#, c-format +msgid "reserved CTL cmd %d" +msgstr "reserveret CTL-kommando %d" + +#. stack byte from image +#. arg: none. +#: vms-tir.c:1148 +msgid "stack-from-image not implemented" +msgstr "stack-from-image er ikke implementeret" + +#: vms-tir.c:1166 +msgid "stack-entry-mask not fully implemented" +msgstr "stack-entry-mask er ikke helt implementeret" + +#. compare procedure argument +#. arg: cs symbol name +#. by argument index +#. da argument descriptor +#. +#. compare argument descriptor with symbol argument (ARG$V_PASSMECH) +#. and stack TRUE (args match) or FALSE (args dont match) value. +#: vms-tir.c:1180 +msgid "PASSMECH not fully implemented" +msgstr "PASSMECH er ikke helt implementeret" + +#: vms-tir.c:1199 +msgid "stack-local-symbol not fully implemented" +msgstr "stack-local-symbol er ikke helt implementeret" + +#: vms-tir.c:1212 +msgid "stack-literal not fully implemented" +msgstr "stack-literal er ikke helt implementeret" + +#: vms-tir.c:1233 +msgid "stack-local-symbol-entry-point-mask not fully implemented" +msgstr "stack-local-symbol-entry-point-mask er ikke helt implementeret" + +#: vms-tir.c:1510 vms-tir.c:1522 vms-tir.c:1534 vms-tir.c:1546 vms-tir.c:1611 +#: vms-tir.c:1619 vms-tir.c:1627 +#, c-format +msgid "%s: not fully implemented" +msgstr "%s: ikke helt implementeret" + +#: vms-tir.c:1684 +#, c-format +msgid "obj code %d not found" +msgstr "objektkode %d kunne ikke findes" + +#: vms-tir.c:2019 +#, c-format +msgid "SEC_RELOC with no relocs in section %s" +msgstr "SEC_RELOC uden relokeringer i sektion %s" + +#: vms-tir.c:2307 +#, c-format +msgid "Unhandled relocation %s" +msgstr "Uhåndteret relokering %s" + +#: xcofflink.c:1243 +#, c-format +msgid "%s: `%s' has line numbers but no enclosing section" +msgstr "%s: \"%s\" har linjenumre, men ingen omsluttende sektion" + +#: xcofflink.c:1296 +#, c-format +msgid "%s: class %d symbol `%s' has no aux entries" +msgstr "%s: klasse %d-symbol \"%s\" har ingen ydre poster" + +#: xcofflink.c:1319 +#, c-format +msgid "%s: symbol `%s' has unrecognized csect type %d" +msgstr "%s: symbol \"%s\" har ukendt csect-type %d" + +#: xcofflink.c:1331 +#, c-format +msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d" +msgstr "%s: fejlagtig XTY_ER-symbol \"%s\": klasse %d scnum %d scnlen %d" + +#: xcofflink.c:1367 +#, c-format +msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d" +msgstr "%s: XMC_TC0-symbol \"%s\" er klasse %d scnlen %d" + +#: xcofflink.c:1519 +#, c-format +msgid "%s: csect `%s' not in enclosing section" +msgstr "%s: csect \"%s\" er ikke i omsluttende sektion" + +#: xcofflink.c:1626 +#, c-format +msgid "%s: misplaced XTY_LD `%s'" +msgstr "%s: fejlagtigt placeret XTY_LD \"%s\"" + +#: xcofflink.c:1957 +#, c-format +msgid "%s: reloc %s:%d not in csect" +msgstr "%s: relokeringen %s:%d er ikke i csect" + +#: xcofflink.c:2092 +#, c-format +msgid "%s: XCOFF shared object when not producing XCOFF output" +msgstr "%s: XCOFF delt objekt når ikke XCOFF-uddata produceres" + +#: xcofflink.c:2113 +#, c-format +msgid "%s: dynamic object with no .loader section" +msgstr "%s: dynamisk objekt uden nogen .loader-sektion" + +#: xcofflink.c:2758 +#, c-format +msgid "%s: no such symbol" +msgstr "%s: intet sådant symbol" + +#: xcofflink.c:2891 +msgid "error: undefined symbol __rtinit" +msgstr "fejl: udefineret symbol __rtinit" + +#: xcofflink.c:3453 +#, c-format +msgid "warning: attempt to export undefined symbol `%s'" +msgstr "advarsel: forsøg på at eksportere udefineret symbol \"%s\"" + +#: xcofflink.c:4447 +#, c-format +msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling" +msgstr "TOC giver overløb: 0x%lx > 0x10000; prøv -mminimal-toc ved oversættelse" + +#: xcofflink.c:5287 xcofflink.c:5756 xcofflink.c:5818 xcofflink.c:6119 +#, c-format +msgid "%s: loader reloc in unrecognized section `%s'" +msgstr "%s: indlæserrelokering i ukendt sektion \"%s\"" + +#: xcofflink.c:5309 xcofflink.c:6130 +#, c-format +msgid "%s: `%s' in loader reloc but not loader sym" +msgstr "%s: \"%s\" i indlæserrelokering, men ikke indlæsersym" + +#: xcofflink.c:5324 +#, c-format +msgid "%s: loader reloc in read-only section %s" +msgstr "%s: indlæserrelokering i skrivebeskyttet sektion %s" + +#: elf32-ia64.c:2222 elf64-ia64.c:2222 +msgid "@pltoff reloc against local symbol" +msgstr "@pltoff-relokering mod lokalt symbol" + +#: elf32-ia64.c:3562 elf64-ia64.c:3562 +#, c-format +msgid "%s: short data segment overflowed (0x%lx >= 0x400000)" +msgstr "%s: kort datasegment løb over (0x%lx >= 0x400000)" + +#: elf32-ia64.c:3573 elf64-ia64.c:3573 +#, c-format +msgid "%s: __gp does not cover short data segment" +msgstr "%s: __gp dækker ikke kort datasegment" + +#: elf32-ia64.c:3858 elf64-ia64.c:3858 +#, c-format +msgid "%s: linking non-pic code in a shared library" +msgstr "%s: lænker ikke-pic-kode i delt bibliotek" + +#: elf32-ia64.c:3891 elf64-ia64.c:3891 +#, c-format +msgid "%s: @gprel relocation against dynamic symbol %s" +msgstr "%s: @gprel-relokering mod dynamisk symbol %s" + +#: elf32-ia64.c:4030 elf64-ia64.c:4030 +#, c-format +msgid "%s: dynamic relocation against speculation fixup" +msgstr "%s: dynamisk relokering uden spekulationsrettelser" + +#: elf32-ia64.c:4038 elf64-ia64.c:4038 +#, c-format +msgid "%s: speculation fixup against undefined weak symbol" +msgstr "%s: spekulationsfix mod udefineret svagt symbol" + +#: elf32-ia64.c:4271 elf64-ia64.c:4271 +msgid "unsupported reloc" +msgstr "relokeringen understøttes ikke" + +#: elf32-ia64.c:4551 elf64-ia64.c:4551 +#, c-format +msgid "%s: linking trap-on-NULL-dereference with non-trapping files" +msgstr "%s: lænker fang-ved-NULL-dereference med ikkefangende filer" + +#: elf32-ia64.c:4560 elf64-ia64.c:4560 +#, c-format +msgid "%s: linking big-endian files with little-endian files" +msgstr "%s: lænker big endian-filer med little endian-filer" + +#: elf32-ia64.c:4569 elf64-ia64.c:4569 +#, c-format +msgid "%s: linking 64-bit files with 32-bit files" +msgstr "%s: lænker 64-bitfiler med 32-bitfiler" + +#: elf32-ia64.c:4578 elf64-ia64.c:4578 +#, c-format +msgid "%s: linking constant-gp files with non-constant-gp files" +msgstr "%s: lænker konstant-gp-filer med ikke-konstant-gp-filer" + +#: elf32-ia64.c:4588 elf64-ia64.c:4588 +#, c-format +msgid "%s: linking auto-pic files with non-auto-pic files" +msgstr "%s: lænker auto-pic-filer med ikke-auto-pic-filer" + +#: peigen.c:962 pepigen.c:962 +#, c-format +msgid "%s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: linjenummer giver overløb: 0x%lx > 0xffff" + +#: peigen.c:979 pepigen.c:979 +#, c-format +msgid "%s: reloc overflow 1: 0x%lx > 0xffff" +msgstr "%s: relokering giver overløb 1: 0x%lx > 0xffff" + +#: peigen.c:993 pepigen.c:993 +msgid "Export Directory [.edata (or where ever we found it)]" +msgstr "Eksportkatalog [.edata (eller hvor vi fandt det)]" + +#: peigen.c:994 pepigen.c:994 +msgid "Import Directory [parts of .idata]" +msgstr "Importkatalog [dele af .idata]" + +#: peigen.c:995 pepigen.c:995 +msgid "Resource Directory [.rsrc]" +msgstr "Resursekatalog [.rsrc]" + +#: peigen.c:996 pepigen.c:996 +msgid "Exception Directory [.pdata]" +msgstr "Undtagelseskatalog [.pdata]" + +#: peigen.c:997 pepigen.c:997 +msgid "Security Directory" +msgstr "Sikkerhedskatalog" + +#: peigen.c:998 pepigen.c:998 +msgid "Base Relocation Directory [.reloc]" +msgstr "Baserelokeringskatalog [.reloc]" + +#: peigen.c:999 pepigen.c:999 +msgid "Debug Directory" +msgstr "Fejlsøgningskatalog" + +#: peigen.c:1000 pepigen.c:1000 +msgid "Description Directory" +msgstr "Beskrivelseskatalog" + +#: peigen.c:1001 pepigen.c:1001 +msgid "Special Directory" +msgstr "Specialkatalog" + +#: peigen.c:1002 pepigen.c:1002 +msgid "Thread Storage Directory [.tls]" +msgstr "Trådlagringskatalog [.tls]" + +#: peigen.c:1003 pepigen.c:1003 +msgid "Load Configuration Directory" +msgstr "Indlæsningskonfigurationskatalog" + +#: peigen.c:1004 pepigen.c:1004 +msgid "Bound Import Directory" +msgstr "Katalog over bundne importer" + +#: peigen.c:1005 pepigen.c:1005 +msgid "Import Address Table Directory" +msgstr "Importadressetabelkatalog" + +#: peigen.c:1006 pepigen.c:1006 +msgid "Delay Import Directory" +msgstr "Katalog over forskinkede importer" + +#: peigen.c:1007 peigen.c:1008 pepigen.c:1007 pepigen.c:1008 +msgid "Reserved" +msgstr "Reserveret" + +#: peigen.c:1071 pepigen.c:1071 +msgid "" +"\n" +"There is an import table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Der findes en importtabel, men sektionen som indeholder den kunne ikke findes\n" + +#: peigen.c:1076 pepigen.c:1076 +#, c-format +msgid "" +"\n" +"There is an import table in %s at 0x%lx\n" +msgstr "" +"\n" +"Der findes en importtabel i %s på 0x%lx\n" + +#: peigen.c:1113 pepigen.c:1113 +#, c-format +msgid "" +"\n" +"Function descriptor located at the start address: %04lx\n" +msgstr "" +"\n" +"Funktionsidentifikatorer fundet på startadressen: %04lx\n" + +#: peigen.c:1116 pepigen.c:1116 +#, c-format +msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n" +msgstr "\tkodebase %08lx toc (indlæsningsbar/reelt) %08lx/%08lx\n" + +#: peigen.c:1122 pepigen.c:1122 +msgid "" +"\n" +"No reldata section! Function descriptor not decoded.\n" +msgstr "" +"\n" +"Ingen reldata-sektion! Funktionsidentifikatorer afkodedes ikke.\n" + +#: peigen.c:1127 pepigen.c:1127 +#, c-format +msgid "" +"\n" +"The Import Tables (interpreted %s section contents)\n" +msgstr "" +"\n" +"Importtabellerne (tolket indhold i %s-sektion)\n" + +# Hvad er thunk? +#: peigen.c:1130 pepigen.c:1130 +msgid "" +" vma: Hint Time Forward DLL First\n" +" Table Stamp Chain Name Thunk\n" +msgstr "" +" vma: Tips- Tids- Fremad- DLL- Første\n" +" tabel stempel kæde navn thunk\n" + +#: peigen.c:1181 pepigen.c:1181 +#, c-format +msgid "" +"\n" +"\tDLL Name: %s\n" +msgstr "" +"\n" +"\tDLL-navn: %s\n" + +#: peigen.c:1192 pepigen.c:1192 +msgid "\tvma: Hint/Ord Member-Name Bound-To\n" +msgstr "\tvma: Tips/Ordn Medlemsnavn Bundet til\n" + +#: peigen.c:1217 pepigen.c:1217 +msgid "" +"\n" +"There is a first thunk, but the section containing it could not be found\n" +msgstr "" +"\n" +"Der findes en første thunk, men sektionen som indeholder den kunne ikke findes\n" + +#: peigen.c:1357 pepigen.c:1357 +msgid "" +"\n" +"There is an export table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Der findes en eksporttabel, men sektionen som indeholder den kunne ikke findes\n" + +#: peigen.c:1362 pepigen.c:1362 +#, c-format +msgid "" +"\n" +"There is an export table in %s at 0x%lx\n" +msgstr "" +"\n" +"Der findes en eksporttabel i %s ved 0x%lx\n" + +#: peigen.c:1393 pepigen.c:1393 +#, c-format +msgid "" +"\n" +"The Export Tables (interpreted %s section contents)\n" +"\n" +msgstr "" +"\n" +"Eksporttabellerne (tolket indhold i %s-sektion)\n" + +#: peigen.c:1397 pepigen.c:1397 +#, c-format +msgid "Export Flags \t\t\t%lx\n" +msgstr "Eksportflag \t\t\t%lx\n" + +#: peigen.c:1400 pepigen.c:1400 +#, c-format +msgid "Time/Date stamp \t\t%lx\n" +msgstr "Tids-/datostempel \t\t%lx\n" + +#: peigen.c:1403 pepigen.c:1403 +#, c-format +msgid "Major/Minor \t\t\t%d/%d\n" +msgstr "Større/mindre \t\t\t%d/%d\n" + +#: peigen.c:1406 pepigen.c:1406 +msgid "Name \t\t\t\t" +msgstr "Navn \t\t\t\t" + +#: peigen.c:1412 pepigen.c:1412 +#, c-format +msgid "Ordinal Base \t\t\t%ld\n" +msgstr "Ordningsbase \t\t\t%ld\n" + +#: peigen.c:1415 pepigen.c:1415 +msgid "Number in:\n" +msgstr "Tal i:\n" + +#: peigen.c:1418 pepigen.c:1418 +#, c-format +msgid "\tExport Address Table \t\t%08lx\n" +msgstr "\tEksportadressetabel \t\t%08lx\n" + +#: peigen.c:1422 pepigen.c:1422 +#, c-format +msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n" +msgstr "\t[Navnepeger/Ordningstal]-tabel\t%08lx\n" + +#: peigen.c:1425 pepigen.c:1425 +msgid "Table Addresses\n" +msgstr "Tabeladresser\n" + +#: peigen.c:1428 pepigen.c:1428 +msgid "\tExport Address Table \t\t" +msgstr "\tEksportadressetabel \t\t" + +#: peigen.c:1433 pepigen.c:1433 +msgid "\tName Pointer Table \t\t" +msgstr "\tNavnepegertabel \t\t" + +#: peigen.c:1438 pepigen.c:1438 +msgid "\tOrdinal Table \t\t\t" +msgstr "\tOrdningstalstabel \t\t\t" + +#: peigen.c:1453 pepigen.c:1453 +#, c-format +msgid "" +"\n" +"Export Address Table -- Ordinal Base %ld\n" +msgstr "" +"\n" +"Eksportadressetabel -- Ordningsbase %ld\n" + +#: peigen.c:1472 pepigen.c:1472 +msgid "Forwarder RVA" +msgstr "Videresender-RVA" + +#: peigen.c:1483 pepigen.c:1483 +msgid "Export RVA" +msgstr "Eksport-RVA" + +#: peigen.c:1490 pepigen.c:1490 +msgid "" +"\n" +"[Ordinal/Name Pointer] Table\n" +msgstr "" +"\n" +"[Ordningstals-/Navnepeger-]tabel\n" + +#: peigen.c:1545 pepigen.c:1545 +#, c-format +msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n" +msgstr "Advarsel, størrelsen på .pdata-sektionen (%ld) er ikke en multipel af %d\n" + +#: peigen.c:1549 pepigen.c:1549 +msgid "" +"\n" +"The Function Table (interpreted .pdata section contents)\n" +msgstr "" +"\n" +"Funktionstabellen (tolket indhold fra .pdata-sektionen)\n" + +#: peigen.c:1552 pepigen.c:1552 +msgid " vma:\t\t\tBegin Address End Address Unwind Info\n" +msgstr " vma:\t\t\tStartadresse Slutadresse Tilbagespolings-information\n" + +#: peigen.c:1554 pepigen.c:1554 +msgid "" +" vma:\t\tBegin End EH EH PrologEnd Exception\n" +" \t\tAddress Address Handler Data Address Mask\n" +msgstr "" +" vma:\t\tStart- Slut- EH- EH- Prologsluts- Undtagelses-\n" +" \t\tadresse adresse håndterer data adresse maske\n" + +#: peigen.c:1624 pepigen.c:1624 +msgid " Register save millicode" +msgstr " Registergemnings millikode" + +#: peigen.c:1627 pepigen.c:1627 +msgid " Register restore millicode" +msgstr " Registergenskabnings millikode" + +#: peigen.c:1630 pepigen.c:1630 +msgid " Glue code sequence" +msgstr " Klisterkodesekvens" + +#: peigen.c:1682 pepigen.c:1682 +msgid "" +"\n" +"\n" +"PE File Base Relocations (interpreted .reloc section contents)\n" +msgstr "" +"\n" +"\n" +"PE-filbaserelokeringer (tolket indhold i .reloc-sektionen)\n" + +#: peigen.c:1712 pepigen.c:1712 +#, c-format +msgid "" +"\n" +"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n" +msgstr "" +"\n" +"Virtuel adresse: %08lx Områdesstørrelse %ld (0x%lx) Antal rettelser %ld\n" + +#: peigen.c:1725 pepigen.c:1725 +#, c-format +msgid "\treloc %4d offset %4x [%4lx] %s" +msgstr "\trelokering %4d afstand %4x [%4lx] %s" + +#. The MS dumpbin program reportedly ands with 0xff0f before +#. printing the characteristics field. Not sure why. No reason to +#. emulate it here. +#: peigen.c:1765 pepigen.c:1765 +#, c-format +msgid "" +"\n" +"Characteristics 0x%x\n" +msgstr "" +"\n" +"Karakteristik 0x%x\n" diff --git a/bfd/po/es.gmo b/bfd/po/es.gmo new file mode 100644 index 0000000000000..3b3adfc6aab2a Binary files /dev/null and b/bfd/po/es.gmo differ diff --git a/bfd/po/es.po b/bfd/po/es.po new file mode 100644 index 0000000000000..3aa3336bf5b12 --- /dev/null +++ b/bfd/po/es.po @@ -0,0 +1,3193 @@ +# Mensajes en español para bfd 2.14rel030712. +# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Cristian Othón Martínez Vera , 2002, 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: bfd 2.14rel030712\n" +"POT-Creation-Date: 2003-07-11 13:53+0930\n" +"PO-Revision-Date: 2003-07-13 21:49-0500\n" +"Last-Translator: Cristian Othón Martínez Vera \n" +"Language-Team: Spanish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: aout-adobe.c:204 +#, c-format +msgid "%s: Unknown section type in a.out.adobe file: %x\n" +msgstr "%s: Tipo de sección desconocido en el fichero a.out.adobe: %x\n" + +#: aout-cris.c:207 +#, c-format +msgid "%s: Invalid relocation type exported: %d" +msgstr "%s: Tipo de reubicación exportado inválido: %d" + +#: aout-cris.c:251 +#, c-format +msgid "%s: Invalid relocation type imported: %d" +msgstr "%s: Tipo de reubicación importado inválido: %d" + +#: aout-cris.c:262 +#, c-format +msgid "%s: Bad relocation record imported: %d" +msgstr "%s: Registro de reubicación importado erróneo: %d" + +#: aoutx.h:1295 aoutx.h:1716 +#, c-format +msgid "%s: can not represent section `%s' in a.out object file format" +msgstr "%s: no se puede representar la sección `%s' en el fichero objeto de formato a.out" + +#: aoutx.h:1682 +#, c-format +msgid "%s: can not represent section for symbol `%s' in a.out object file format" +msgstr "%s: no se puede representar la sección para el símbolo `%s' en el fichero objeto de formato a.out" + +#: aoutx.h:1684 +msgid "*unknown*" +msgstr "*desconocido*" + +#: aoutx.h:3776 +#, c-format +msgid "%s: relocatable link from %s to %s not supported" +msgstr "%s: el enlace reubicable de %s a %s no está soportado" + +#: archive.c:1751 +msgid "Warning: writing archive was slow: rewriting timestamp\n" +msgstr "Aviso: la escritura del fichero fue lenta: reescribiendo la marca de tiempo\n" + +# ¡Uff! Si utilizáramos file=archivo, esta traducción sería imposible. cfuga +#: archive.c:2014 +msgid "Reading archive file mod timestamp" +msgstr "Leyendo el archivo de la modificación de marca de tiempo del fichero" + +#: archive.c:2040 +msgid "Writing updated armap timestamp" +msgstr "Escribiendo la marca de tiempo actualizada de armap" + +#: bfd.c:280 +msgid "No error" +msgstr "No hay error" + +#: bfd.c:281 +msgid "System call error" +msgstr "Error en la llamada al sistema" + +#: bfd.c:282 +msgid "Invalid bfd target" +msgstr "Objetivo bfd inválido" + +#: bfd.c:283 +msgid "File in wrong format" +msgstr "Fichero en formato erróneo" + +#: bfd.c:284 +msgid "Archive object file in wrong format" +msgstr "Archivo de ficheros objeto en formato erróneo" + +#: bfd.c:285 +msgid "Invalid operation" +msgstr "Operación inválida" + +#: bfd.c:286 +msgid "Memory exhausted" +msgstr "Memoria agotada" + +#: bfd.c:287 +msgid "No symbols" +msgstr "No hay símbolos" + +#: bfd.c:288 +msgid "Archive has no index; run ranlib to add one" +msgstr "El archivo no tiene índice; ejecute ranlib para agregar uno" + +#: bfd.c:289 +msgid "No more archived files" +msgstr "No hay más ficheros archivados" + +#: bfd.c:290 +msgid "Malformed archive" +msgstr "Archivo malformado" + +#: bfd.c:291 +msgid "File format not recognized" +msgstr "No se reconoce el formato del fichero" + +#: bfd.c:292 +msgid "File format is ambiguous" +msgstr "El formato del fichero es ambiguo" + +#: bfd.c:293 +msgid "Section has no contents" +msgstr "La sección no tiene contenidos" + +#: bfd.c:294 +msgid "Nonrepresentable section on output" +msgstr "Sección no representable en la salida" + +#: bfd.c:295 +msgid "Symbol needs debug section which does not exist" +msgstr "Un símbolo requiere de una sección de depuración, la cual no existe" + +#: bfd.c:296 +msgid "Bad value" +msgstr "Valor erróneo" + +#: bfd.c:297 +msgid "File truncated" +msgstr "Fichero truncado" + +#: bfd.c:298 +msgid "File too big" +msgstr "Fichero demasiado grande" + +#: bfd.c:299 +msgid "#" +msgstr "#" + +#: bfd.c:687 +#, c-format +msgid "BFD %s assertion fail %s:%d" +msgstr "falló la aseveración BFD %s %s:%d" + +#: bfd.c:703 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d in %s\n" +msgstr "error interno de BFD %s, abortando en %s línea %d en %s\n" + +#: bfd.c:707 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d\n" +msgstr "error interno de BFD %s, abortando en %s línea %d\n" + +#: bfd.c:709 +msgid "Please report this bug.\n" +msgstr "Por favor reporte este bicho.\n" + +#: bfdwin.c:202 +#, c-format +msgid "not mapping: data=%lx mapped=%d\n" +msgstr "no se mapea: datos=%lx mapeados%d\n" + +#: bfdwin.c:205 +msgid "not mapping: env var not set\n" +msgstr "no se mapea: no se estableció la variable de ambiente\n" + +#: binary.c:306 +#, c-format +msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx." +msgstr "Aviso: Escribiendo la sección `%s' a un desplazamiento de fichero grande (pe negativo) 0x%lx." + +#: coff-a29k.c:120 +msgid "Missing IHCONST" +msgstr "IHCONST faltante" + +#: coff-a29k.c:181 +msgid "Missing IHIHALF" +msgstr "IHIHALF faltante" + +#: coff-a29k.c:213 coff-or32.c:236 +msgid "Unrecognized reloc" +msgstr "Reubicación no reconocida" + +#: coff-a29k.c:409 +msgid "missing IHCONST reloc" +msgstr "reubicación IHCONST faltante" + +#: coff-a29k.c:499 +msgid "missing IHIHALF reloc" +msgstr "reubicación IHIHALF faltante" + +#: coff-alpha.c:884 coff-alpha.c:921 coff-alpha.c:1992 coff-mips.c:1397 +msgid "GP relative relocation used when GP not defined" +msgstr "se usó una reubicación GP relativa cuando GP no estaba definido" + +#: coff-alpha.c:1488 +msgid "using multiple gp values" +msgstr "usando valores múltiples de gp" + +#: coff-arm.c:1066 elf32-arm.h:294 +#, c-format +msgid "%s: unable to find THUMB glue '%s' for `%s'" +msgstr "%s: no se puede encontrar el pegamento THUMB '%s' para `%s'" + +#: coff-arm.c:1096 elf32-arm.h:329 +#, c-format +msgid "%s: unable to find ARM glue '%s' for `%s'" +msgstr "%s: no se puede encontrar el pegamento ARM '%s' para `%s'" + +#: coff-arm.c:1394 coff-arm.c:1489 elf32-arm.h:892 elf32-arm.h:999 +#, c-format +msgid "%s(%s): warning: interworking not enabled." +msgstr "%s(%s): aviso: interoperabilidad no activada." + +#: coff-arm.c:1398 elf32-arm.h:1002 +#, c-format +msgid " first occurrence: %s: arm call to thumb" +msgstr " primera ocurrencia: %s: llamada arm a thumb" + +#: coff-arm.c:1493 elf32-arm.h:895 +#, c-format +msgid " first occurrence: %s: thumb call to arm" +msgstr " primera ocurrencia: %s: llamada thumb a arm" + +#: coff-arm.c:1496 +msgid " consider relinking with --support-old-code enabled" +msgstr " considere el reenlace con --support-old-code activado" + +#: coff-arm.c:1788 coff-tic80.c:687 cofflink.c:3038 +#, c-format +msgid "%s: bad reloc address 0x%lx in section `%s'" +msgstr "%s: dirección de reubicación 0x%lx errónea en la sección `%s'" + +#: coff-arm.c:2132 +#, c-format +msgid "%s: illegal symbol index in reloc: %d" +msgstr "%s: índice de símbolos ilegal en la reubicación: %d" + +#: coff-arm.c:2265 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d" +msgstr "ERROR: %s está compilado para APCS-%d, mientras que %s está compilado para APCS-%d" + +#: coff-arm.c:2280 elf32-arm.h:2328 +#, c-format +msgid "ERROR: %s passes floats in float registers, whereas %s passes them in integer registers" +msgstr "ERROR: %s pasa números de coma flotante en registros de coma flotante, mientras que %s los pasa en registros enteros" + +#: coff-arm.c:2283 elf32-arm.h:2333 +#, c-format +msgid "ERROR: %s passes floats in integer registers, whereas %s passes them in float registers" +msgstr "ERROR: %s pasa números de coma flotante en registros enteros, mientras que %s los pasa en registros de coma flotante" + +#: coff-arm.c:2298 +#, c-format +msgid "ERROR: %s is compiled as position independent code, whereas target %s is absolute position" +msgstr "ERROR: %s está compilado como código independiente de posición, mientras que el objetivo %s es de posición absoluta" + +#: coff-arm.c:2301 +#, c-format +msgid "ERROR: %s is compiled as absolute position code, whereas target %s is position independent" +msgstr "ERROR: %s está compilado como código de posición absoluta, mientras que el objetivo %s es independiente de posición" + +#: coff-arm.c:2330 elf32-arm.h:2405 +#, c-format +msgid "Warning: %s supports interworking, whereas %s does not" +msgstr "Aviso: el fichero de entrada %s soporta interoperabilidad, mientras que %s no" + +#: coff-arm.c:2333 elf32-arm.h:2412 +#, c-format +msgid "Warning: %s does not support interworking, whereas %s does" +msgstr "Aviso: el fichero de entrada %s no soporta interoperabilidad, mientras que %s sí" + +#: coff-arm.c:2360 +#, c-format +msgid "private flags = %x:" +msgstr "opciones privadas = %x:" + +#: coff-arm.c:2368 elf32-arm.h:2467 +msgid " [floats passed in float registers]" +msgstr "[números de coma flotante pasados en registros de coma flotante]" + +#: coff-arm.c:2370 +msgid " [floats passed in integer registers]" +msgstr "[números de coma flotante pasados en registros enteros]" + +#: coff-arm.c:2373 elf32-arm.h:2470 +msgid " [position independent]" +msgstr "[independiente de posición]" + +#: coff-arm.c:2375 +msgid " [absolute position]" +msgstr "[posición absoluta]" + +#: coff-arm.c:2379 +msgid " [interworking flag not initialised]" +msgstr "[opción de interoperabilidad no iniciada]" + +#: coff-arm.c:2381 +msgid " [interworking supported]" +msgstr "[soporte para interoperabilidad]" + +#: coff-arm.c:2383 +msgid " [interworking not supported]" +msgstr "[sin soporte para interoperabilidad]" + +#: coff-arm.c:2431 elf32-arm.h:2150 +#, c-format +msgid "Warning: Not setting interworking flag of %s since it has already been specified as non-interworking" +msgstr "Aviso: No se establece la opción de interoperabilidad de %s ya que se había especificado con anterioridad como no interoperable" + +#: coff-arm.c:2435 elf32-arm.h:2154 +#, c-format +msgid "Warning: Clearing the interworking flag of %s due to outside request" +msgstr "Aviso: Limpiando la opción de interoperabilidad de %s debido a una petición externa" + +#: coff-h8300.c:1096 +#, c-format +msgid "cannot handle R_MEM_INDIRECT reloc when using %s output" +msgstr "no se puede manejar la reubicación R_MEM_INDIRECT cuando se utiliza la salida %s" + +#: coff-i960.c:137 coff-i960.c:486 +msgid "uncertain calling convention for non-COFF symbol" +msgstr "convención de llamada incierta para un símbolo que no es COFF" + +#: coff-m68k.c:482 coff-mips.c:2394 elf32-m68k.c:2193 elf32-mips.c:1783 +msgid "unsupported reloc type" +msgstr "tipo de reubicación sin soporte" + +#: coff-mips.c:839 elf32-mips.c:1088 elf64-mips.c:1590 elfn32-mips.c:1554 +msgid "GP relative relocation when _gp not defined" +msgstr "reubicación GP relativa cuando _gp no está definido" + +#. No other sections should appear in -membedded-pic +#. code. +#: coff-mips.c:2431 +msgid "reloc against unsupported section" +msgstr "reubicación contra una sección sin soporte" + +#: coff-mips.c:2439 +msgid "reloc not properly aligned" +msgstr "reubicación no alineada adecuadamente" + +#: coff-rs6000.c:2790 +#, c-format +msgid "%s: unsupported relocation type 0x%02x" +msgstr "%s: tipo de reubicación 0x%02x sin soporte" + +#: coff-rs6000.c:2883 +#, c-format +msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry" +msgstr "%s: reubicación de TOC en 0x%x al símbolo `%s' sin entrada TOC" + +#: coff-rs6000.c:3616 coff64-rs6000.c:2109 +#, c-format +msgid "%s: symbol `%s' has unrecognized smclas %d" +msgstr "%s: el símbolo `%s' tiene smclas %d no reconocido" + +#: coff-tic4x.c:170 coff-tic54x.c:288 coff-tic80.c:450 +#, c-format +msgid "Unrecognized reloc type 0x%x" +msgstr "Tipo de reubicación 0x%x no reconocida" + +#: coff-tic4x.c:218 coff-tic54x.c:373 coffcode.h:5045 +#, c-format +msgid "%s: warning: illegal symbol index %ld in relocs" +msgstr "%s: aviso: íncide de símbolos %ld ilegal en reubicaciones" + +#: coff-w65.c:364 +#, c-format +msgid "ignoring reloc %s\n" +msgstr "ignorando la reubicación %s\n" + +#: coffcode.h:1108 +#, c-format +msgid "%s (%s): Section flag %s (0x%x) ignored" +msgstr "%s (%s): Se ignora la opción de sección %s (0x%x)" + +#: coffcode.h:2214 +#, c-format +msgid "Unrecognized TI COFF target id '0x%x'" +msgstr "Id de objetivo TI COFF '0x%x' no reconocido" + +#: coffcode.h:4437 +#, c-format +msgid "%s: warning: illegal symbol index %ld in line numbers" +msgstr "%s: aviso: índice de símbolos %ld ilegal en los números de línea" + +#: coffcode.h:4451 +#, c-format +msgid "%s: warning: duplicate line number information for `%s'" +msgstr "%s: aviso: información duplicada de números de línea para `%s'" + +#: coffcode.h:4805 +#, c-format +msgid "%s: Unrecognized storage class %d for %s symbol `%s'" +msgstr "%s: Clase de almacenamiento %d no reconocida para %s símbolo `%s'" + +#: coffcode.h:4938 +#, c-format +msgid "warning: %s: local symbol `%s' has no section" +msgstr "aviso: %s: el símbolo local `%s' no tiene sección" + +#: coffcode.h:5083 +#, c-format +msgid "%s: illegal relocation type %d at address 0x%lx" +msgstr "%s: tipo de reubicación %d ilegal en la dirección 0x%lx" + +#: coffgen.c:1666 +#, c-format +msgid "%s: bad string table size %lu" +msgstr "%s: tamaño de tabla de cadenas %lu erróneo" + +#: cofflink.c:538 elflink.h:1276 +#, c-format +msgid "Warning: type of symbol `%s' changed from %d to %d in %s" +msgstr "Aviso: el tipo del símbolo `%s' cambió de %d a %d en %s" + +#: cofflink.c:2328 +#, c-format +msgid "%s: relocs in section `%s', but it has no contents" +msgstr "%s: reubicaciones en la sección `%s', pero no tiene contenidos" + +#: cofflink.c:2671 coffswap.h:890 +#, c-format +msgid "%s: %s: reloc overflow: 0x%lx > 0xffff" +msgstr "%s: %s: desbordamiento de reubicación: 0x%lx > 0xffff" + +#: cofflink.c:2680 coffswap.h:876 +#, c-format +msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: aviso: %s: desbordamiento de número de línea: 0x%lx > 0xffff" + +#: cpu-arm.c:196 cpu-arm.c:206 +#, c-format +msgid "ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale" +msgstr "ERROR: %s está compilado para el EP9312, mientras que %s está compilado para Xscale" + +#: cpu-arm.c:344 +#, c-format +msgid "warning: unable to update contents of %s section in %s" +msgstr "aviso: no se puede actualizar el contenido de la sección %s en %s" + +#: dwarf2.c:380 +msgid "Dwarf Error: Can't find .debug_str section." +msgstr "Error de Dwarf: No se puede encontrar la sección .debug_str." + +#: dwarf2.c:397 +#, c-format +msgid "Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str size (%lu)." +msgstr "Error de Dwarf: El desplazamiento DW_FROM_strp (%lu) es más grande o igual que el tamaño de .debug_str (%lu)." + +#: dwarf2.c:541 +msgid "Dwarf Error: Can't find .debug_abbrev section." +msgstr "Error de Dwarf: No se puede encontrar la sección .debug_abbrev." + +#: dwarf2.c:556 +#, c-format +msgid "Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size (%lu)." +msgstr "Error de Dwarf: El desplazamiento de abreviatura (%lu) es más grande o igual que el tamaño de .debug_abbrev (%lu)." + +#: dwarf2.c:756 +#, c-format +msgid "Dwarf Error: Invalid or unhandled FORM value: %u." +msgstr "Error de Dwarf: Valor de FORM inválido o no manejado: %u." + +#: dwarf2.c:933 +msgid "Dwarf Error: mangled line number section (bad file number)." +msgstr "Error de Dwarf: sección de números de línea revuelta (número erróneo de fichero)." + +#: dwarf2.c:1032 +msgid "Dwarf Error: Can't find .debug_line section." +msgstr "Error de Dwarf: No se puede encontrar lan sección .debug_line." + +#: dwarf2.c:1049 +#, c-format +msgid "Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)." +msgstr "Error de Dwarf: El desplazamiento de línea (%lu) es más grande o igual que el tamaño de .debug_line (%lu)." + +#: dwarf2.c:1255 +msgid "Dwarf Error: mangled line number section." +msgstr "Error de Dwarf: sección de números de línea revuelta." + +#: dwarf2.c:1470 dwarf2.c:1620 +#, c-format +msgid "Dwarf Error: Could not find abbrev number %u." +msgstr "Error de Dwarf: No se puede encontrar el número de abreviatura %u." + +#: dwarf2.c:1581 +#, c-format +msgid "Dwarf Error: found dwarf version '%u', this reader only handles version 2 information." +msgstr "Error de Dwarf: se encontró la versión de dwarf '%u', este lector solamente maneja información de la versión 2." + +#: dwarf2.c:1588 +#, c-format +msgid "Dwarf Error: found address size '%u', this reader can not handle sizes greater than '%u'." +msgstr "Error de Dwarf: se encontró el tamaño de dirección '%u', este lector no puede manejar tamaños más grandes que '%u'." + +#: dwarf2.c:1611 +#, c-format +msgid "Dwarf Error: Bad abbrev number: %u." +msgstr "Error de Dwarf: Número de abreviación erróneo: %u." + +#: ecoff.c:1339 +#, c-format +msgid "Unknown basic type %d" +msgstr "Tipo básico %d desconocido" + +#: ecoff.c:1599 +#, c-format +msgid "" +"\n" +" End+1 symbol: %ld" +msgstr "" +"\n" +" Símbolo final+1: %ld" + +#: ecoff.c:1606 ecoff.c:1609 +#, c-format +msgid "" +"\n" +" First symbol: %ld" +msgstr "" +"\n" +" Primer símbolo: %ld" + +#: ecoff.c:1621 +#, c-format +msgid "" +"\n" +" End+1 symbol: %-7ld Type: %s" +msgstr "" +"\n" +" Símbolo final+1: %-7ld Tipo: %s" + +#: ecoff.c:1628 +#, c-format +msgid "" +"\n" +" Local symbol: %ld" +msgstr "" +"\n" +" Símbolo local: %ld" + +#: ecoff.c:1636 +#, c-format +msgid "" +"\n" +" struct; End+1 symbol: %ld" +msgstr "" +"\n" +" struct; símbolo final+1: %ld" + +#: ecoff.c:1641 +#, c-format +msgid "" +"\n" +" union; End+1 symbol: %ld" +msgstr "" +"\n" +" union; símbolo final+1: %ld" + +#: ecoff.c:1646 +#, c-format +msgid "" +"\n" +" enum; End+1 symbol: %ld" +msgstr "" +"\n" +" enum; símbolo final+1: %ld" + +#: ecoff.c:1652 +#, c-format +msgid "" +"\n" +" Type: %s" +msgstr "" +"\n" +" Tipo: %s" + +#: elf-hppa.h:1458 elf-hppa.h:1491 elf-m10300.c:1628 elf64-sh64.c:1704 +#, c-format +msgid "%s: warning: unresolvable relocation against symbol `%s' from %s section" +msgstr "%s: aviso: reubicación sin resolución contra el símbolo `%s' de la sección %s" + +#: elf-m10200.c:442 elf-m10300.c:1695 elf32-arm.h:2088 elf32-avr.c:812 +#: elf32-cris.c:1390 elf32-d10v.c:570 elf32-fr30.c:634 elf32-frv.c:815 +#: elf32-h8300.c:528 elf32-i860.c:1028 elf32-ip2k.c:1586 elf32-iq2000.c:699 +#: elf32-m32r.c:1283 elf32-m68hc1x.c:1305 elf32-msp430.c:510 +#: elf32-openrisc.c:436 elf32-v850.c:1777 elf32-xstormy16.c:976 +#: elf64-mmix.c:1332 +msgid "internal error: out of range error" +msgstr "error interno: error fuera de rango" + +#: elf-m10200.c:446 elf-m10300.c:1699 elf32-arm.h:2092 elf32-avr.c:816 +#: elf32-cris.c:1394 elf32-d10v.c:574 elf32-fr30.c:638 elf32-frv.c:819 +#: elf32-h8300.c:532 elf32-i860.c:1032 elf32-iq2000.c:703 elf32-m32r.c:1287 +#: elf32-m68hc1x.c:1309 elf32-msp430.c:514 elf32-openrisc.c:440 +#: elf32-v850.c:1781 elf32-xstormy16.c:980 elf64-mmix.c:1336 elfxx-mips.c:6452 +msgid "internal error: unsupported relocation error" +msgstr "error interno: error de reubicación sin soporte" + +#: elf-m10200.c:450 elf-m10300.c:1703 elf32-arm.h:2096 elf32-d10v.c:578 +#: elf32-h8300.c:536 elf32-m32r.c:1291 elf32-m68hc1x.c:1313 +msgid "internal error: dangerous error" +msgstr "error interno: error peligroso" + +#: elf-m10200.c:454 elf-m10300.c:1707 elf32-arm.h:2100 elf32-avr.c:824 +#: elf32-cris.c:1402 elf32-d10v.c:582 elf32-fr30.c:646 elf32-frv.c:827 +#: elf32-h8300.c:540 elf32-i860.c:1040 elf32-ip2k.c:1601 elf32-iq2000.c:711 +#: elf32-m32r.c:1295 elf32-m68hc1x.c:1317 elf32-msp430.c:522 +#: elf32-openrisc.c:448 elf32-v850.c:1801 elf32-xstormy16.c:988 +#: elf64-mmix.c:1344 +msgid "internal error: unknown error" +msgstr "error interno: error desconocido" + +#: elf.c:372 +#, c-format +msgid "%s: invalid string offset %u >= %lu for section `%s'" +msgstr "%s: desplazamiento de cadena inválido %u >= %lu para la sección `%s'" + +#: elf.c:624 +#, c-format +msgid "%s: invalid SHT_GROUP entry" +msgstr "%s: entrada SHT_GROUP inválida" + +#: elf.c:695 +#, c-format +msgid "%s: no group info for section %s" +msgstr "%s: no hay información de grupo para la sección %s" + +#: elf.c:1055 +msgid "" +"\n" +"Program Header:\n" +msgstr "" +"\n" +"Encabezado del Programa:\n" + +#: elf.c:1106 +msgid "" +"\n" +"Dynamic Section:\n" +msgstr "" +"\n" +"Sección Dinámica:\n" + +#: elf.c:1235 +msgid "" +"\n" +"Version definitions:\n" +msgstr "" +"\n" +"Definiciones de versión:\n" + +#: elf.c:1258 +msgid "" +"\n" +"Version References:\n" +msgstr "" +"\n" +"Referencias de Versión:\n" + +#: elf.c:1263 +#, c-format +msgid " required from %s:\n" +msgstr " requerido desde %s:\n" + +#: elf.c:1944 +#, c-format +msgid "%s: invalid link %lu for reloc section %s (index %u)" +msgstr "%s: enlace %lu inválido para la sección de reubicación %s (índice %u)" + +#: elf.c:3686 +#, c-format +msgid "%s: Not enough room for program headers (allocated %u, need %u)" +msgstr "%s: No hay suficiente espacio para los encabezados del programa (%u asignados, %u necesarios)" + +#: elf.c:3791 +#, c-format +msgid "%s: Not enough room for program headers, try linking with -N" +msgstr "%s: No hay suficiente espacio para los encabezados del programa, pruebe enlazar con -N" + +#: elf.c:3922 +#, c-format +msgid "Error: First section in segment (%s) starts at 0x%x whereas the segment starts at 0x%x" +msgstr "Error: La primera sección en el segmento (%s) inicia en 0x%x mientras que el segmento inicia en 0x%x" + +#: elf.c:4242 +#, c-format +msgid "%s: warning: allocated section `%s' not in segment" +msgstr "%s: aviso: la sección asignada `%s' no está en el segmento" + +#: elf.c:4566 +#, c-format +msgid "%s: symbol `%s' required but not present" +msgstr "%s: se requiere el símbolo `%s' pero no está presente" + +#: elf.c:4854 +#, c-format +msgid "%s: warning: Empty loadable segment detected, is this intentional ?\n" +msgstr "%s: aviso: Se detectó un segmento cargable vacío, ¿ es intencional ?\n" + +#: elf.c:5485 +#, c-format +msgid "Unable to find equivalent output section for symbol '%s' from section '%s'" +msgstr "No se puede encontrar la sección de salida equivalente para el símbolo '%s' de la sección '%s'" + +#: elf.c:6298 +#, c-format +msgid "%s: unsupported relocation type %s" +msgstr "%s: tipo de reubicación %s sin soporte" + +#: elf32-arm.h:1228 +#, c-format +msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'." +msgstr "%s: Aviso: La instrucción Arm BLX apunta a la función Arm '%s'." + +#: elf32-arm.h:1424 +#, c-format +msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'." +msgstr "%s: Aviso: La instrucción Thumb BLX apunta a la función thumb '%s'." + +#: elf32-arm.h:1918 elf32-sh.c:4706 elf64-sh64.c:1613 +#, c-format +msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section" +msgstr "%s(%s+0x%lx): reubicación %s contra la sección SEC_MERGE" + +#: elf32-arm.h:2012 +#, c-format +msgid "%s: warning: unresolvable relocation %d against symbol `%s' from %s section" +msgstr "%s: aviso: reubicación %d sin resolución contra el símbolo `%s' de la sección %s" + +#: elf32-arm.h:2202 +#, c-format +msgid "Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it" +msgstr "Aviso: Limpiando la opción de interoperación en %s porque se ha enlazado con él código no interoperable en %s" + +#: elf32-arm.h:2302 +#, c-format +msgid "ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d" +msgstr "ERROR: %s está compilado para EABI versión %d, mientras que %s está compilado para la versión %d" + +#: elf32-arm.h:2316 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d" +msgstr "ERROR: %s está compilado para APCS-%d mientras que el objetivo %s usa APCS-%d" + +#: elf32-arm.h:2344 +#, c-format +msgid "ERROR: %s uses VFP instructions, whereas %s does not" +msgstr "ERROR: %s utiliza instrucciones VFP, mientras que %s no" + +#: elf32-arm.h:2349 +#, c-format +msgid "ERROR: %s uses FPA instructions, whereas %s does not" +msgstr "ERROR: %s utiliza instrucciones FPA, mientras que %s no" + +#: elf32-arm.h:2360 elf32-arm.h:2365 +#, c-format +msgid "ERROR: %s uses Maverick instructions, whereas %s does not" +msgstr "ERROR: %s utiliza instrucciones Maverick, mientras que %s no" + +#: elf32-arm.h:2385 +#, c-format +msgid "ERROR: %s uses software FP, whereas %s uses hardware FP" +msgstr "ERROR: %s utiliza FP de software, mientras que %s utiliza FP de hardware" + +#: elf32-arm.h:2390 +#, c-format +msgid "ERROR: %s uses hardware FP, whereas %s uses software FP" +msgstr "ERROR: %s utiliza FP de hardware, mientras que %s utiliza FP de software" + +#. Ignore init flag - it may not be set, despite the flags field +#. containing valid data. +#: elf32-arm.h:2443 elf32-cris.c:2975 elf32-m68hc1x.c:1459 elf32-m68k.c:397 +#: elf32-vax.c:546 elfxx-mips.c:9238 +#, c-format +msgid "private flags = %lx:" +msgstr "opciones privadas = %lx:" + +#: elf32-arm.h:2452 +msgid " [interworking enabled]" +msgstr " [interoperabilidad activada]" + +#: elf32-arm.h:2460 +msgid " [VFP float format]" +msgstr " [formato de coma flotante VFP]" + +#: elf32-arm.h:2462 +msgid " [Maverick float format]" +msgstr " [formato de coma flotante Maverick]" + +#: elf32-arm.h:2464 +msgid " [FPA float format]" +msgstr " [formato de coma flotante FPA]" + +#: elf32-arm.h:2473 +msgid " [new ABI]" +msgstr " [ABI nuevo]" + +#: elf32-arm.h:2476 +msgid " [old ABI]" +msgstr " [ABI antiguo]" + +#: elf32-arm.h:2479 +msgid " [software FP]" +msgstr " [FP por software]" + +#: elf32-arm.h:2488 +msgid " [Version1 EABI]" +msgstr " [EABI Version1]" + +#: elf32-arm.h:2491 elf32-arm.h:2502 +msgid " [sorted symbol table]" +msgstr " [tabla de símbolos ordenados]" + +#: elf32-arm.h:2493 elf32-arm.h:2504 +msgid " [unsorted symbol table]" +msgstr " [tabla de símbolos sin ordenar]" + +#: elf32-arm.h:2499 +msgid " [Version2 EABI]" +msgstr " [EABI Version2]" + +#: elf32-arm.h:2507 +msgid " [dynamic symbols use segment index]" +msgstr " [los símbolos dinámicos utilizan índices de segmento]" + +#: elf32-arm.h:2510 +msgid " [mapping symbols precede others]" +msgstr " [el mapeo de símbolos precede a otros]" + +#: elf32-arm.h:2517 +msgid " " +msgstr " " + +#: elf32-arm.h:2524 +msgid " [relocatable executable]" +msgstr " [ejecutable reubicable]" + +#: elf32-arm.h:2527 +msgid " [has entry point]" +msgstr " [tiene punto de entrada]" + +#: elf32-arm.h:2532 +msgid "" +msgstr "" + +#: elf32-avr.c:820 elf32-cris.c:1398 elf32-fr30.c:642 elf32-frv.c:823 +#: elf32-i860.c:1036 elf32-ip2k.c:1597 elf32-iq2000.c:707 elf32-msp430.c:518 +#: elf32-openrisc.c:444 elf32-v850.c:1785 elf32-xstormy16.c:984 +#: elf64-mmix.c:1340 +msgid "internal error: dangerous relocation" +msgstr "error interno: reubicación peligrosa" + +#: elf32-cris.c:931 +#, c-format +msgid "%s: unresolvable relocation %s against symbol `%s' from %s section" +msgstr "%s: reubicación %s sin resolución contra el símbolo `%s' de la sección %s" + +#: elf32-cris.c:993 +#, c-format +msgid "%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section" +msgstr "%s: No hay PLT ni GOT para la reubicación %s contra el símbolo `%s' de la sección %s" + +#: elf32-cris.c:996 elf32-cris.c:1122 +msgid "[whose name is lost]" +msgstr "[cuyo nombre se pierde]" + +#: elf32-cris.c:1111 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against local symbol from %s section" +msgstr "%s: reubicación %s con adición %d que no es cero contra un símbolo local de la sección %s" + +#: elf32-cris.c:1118 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against symbol `%s' from %s section" +msgstr "%s: reubicación %s con adición %d que no es cero contra el símbolo `%s' de la sección %s" + +#: elf32-cris.c:1143 +#, c-format +msgid "%s: relocation %s is not allowed for global symbol: `%s' from %s section" +msgstr "%s: no se permite la reubicación %s para el símbolo global: `%s' de la sección %s" + +#: elf32-cris.c:1158 +#, c-format +msgid "%s: relocation %s in section %s with no GOT created" +msgstr "%s: la reubicación %s en la sección %s sin GOT creado" + +#: elf32-cris.c:1277 +#, c-format +msgid "%s: Internal inconsistency; no relocation section %s" +msgstr "%s: Inconsistencia interna; no se encuentra la sección de reubicación %s" + +#: elf32-cris.c:2500 +#, c-format +msgid "" +"%s, section %s:\n" +" relocation %s should not be used in a shared object; recompile with -fPIC" +msgstr "" +"%s, sección %s:\n" +" no se debe usar la reubicación %s en un objeto compartido; recompile con -fPIC" + +#: elf32-cris.c:2978 +msgid " [symbols have a _ prefix]" +msgstr " [los símbolos tiene un prefijo _]" + +#: elf32-cris.c:3017 +#, c-format +msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols" +msgstr "%s: utiliza símbolos con prefijo _, pero escribe el fichero con símbolos sin prefijo" + +#: elf32-cris.c:3018 +#, c-format +msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols" +msgstr "%s: utiliza símbolos sin prefijo, pero escribe el fichero con símbolos con prefijo _" + +#: elf32-frv.c:1223 +#, c-format +msgid "%s: compiled with %s and linked with modules that use non-pic relocations" +msgstr "%s: compilado con %s y enlazado con módulos que usan reubicaciones que no son pic" + +#: elf32-frv.c:1273 elf32-iq2000.c:895 +#, c-format +msgid "%s: compiled with %s and linked with modules compiled with %s" +msgstr "%s: compilado con %s y enlazado con módulos compilados con %s" + +#: elf32-frv.c:1285 +#, c-format +msgid "%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%s: usa campos e_flags desconocidos (0x%lx) diferentes a aquéllos de los módulos previos (0x%lx)" + +#: elf32-frv.c:1321 elf32-iq2000.c:933 +#, c-format +msgid "private flags = 0x%lx:" +msgstr "opciones privadas = 0x%lx:" + +#: elf32-gen.c:83 elf64-gen.c:82 +#, c-format +msgid "%s: Relocations in generic ELF (EM: %d)" +msgstr "%s: Reubicaciones en ELF genérico (EM: %d)" + +#: elf32-hppa.c:672 elf32-m68hc1x.c:176 elf64-ppc.c:3118 +#, c-format +msgid "%s: cannot create stub entry %s" +msgstr "%s: no se puede crear la entrada de cabo %s" + +#: elf32-hppa.c:957 elf32-hppa.c:3538 +#, c-format +msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections" +msgstr "%s(%s+0x%lx): no se puede alcanzar %s, recompile con -ffuntion-sections" + +#: elf32-hppa.c:1340 elf64-x86-64.c:672 elf64-x86-64.c:797 +#, c-format +msgid "%s: relocation %s can not be used when making a shared object; recompile with -fPIC" +msgstr "%s: no se puede usar la reubicación %s cuando se hace un objeto compartido; recompile con -fPIC" + +#: elf32-hppa.c:1360 +#, c-format +msgid "%s: relocation %s should not be used when making a shared object; recompile with -fPIC" +msgstr "%s: no se debe usar la reubicación %s cuando se hace un objeto compartido; recompile con -fPIC" + +#: elf32-hppa.c:1553 +#, c-format +msgid "Could not find relocation section for %s" +msgstr "No se puede encontrar la sección de reubicación para %s" + +#: elf32-hppa.c:2828 +#, c-format +msgid "%s: duplicate export stub %s" +msgstr "%s: cabo de exportación %s duplicado" + +#: elf32-hppa.c:3416 +#, c-format +msgid "%s(%s+0x%lx): fixing %s" +msgstr "%s(%s+0x%lx): componiendo %s" + +#: elf32-hppa.c:4039 +#, c-format +msgid "%s(%s+0x%lx): cannot handle %s for %s" +msgstr "%s(%s+0x%lx): no se puede manejar %s para %s" + +#: elf32-hppa.c:4357 +msgid ".got section not immediately after .plt section" +msgstr "la sección .got no está inmediatamente después de la sección .plt" + +#: elf32-i386.c:326 +#, c-format +msgid "%s: invalid relocation type %d" +msgstr "%s: tipo de reubicación %d inválido" + +#: elf32-i386.c:841 elf32-s390.c:990 elf32-sparc.c:887 elf32-xtensa.c:637 +#: elf64-s390.c:943 elf64-x86-64.c:650 +#, c-format +msgid "%s: bad symbol index: %d" +msgstr "%s: índice de símbolos erróneo: %d" + +#: elf32-i386.c:949 elf32-s390.c:1168 elf32-sh.c:6426 elf32-sparc.c:1011 +#: elf64-s390.c:1129 +#, c-format +msgid "%s: `%s' accessed both as normal and thread local symbol" +msgstr "%s: se accesó `%s' como un símbolo normal y un símbolo local de hilo" + +#: elf32-i386.c:1064 elf32-s390.c:1279 elf64-ppc.c:3929 elf64-s390.c:1243 +#: elf64-x86-64.c:886 +#, c-format +msgid "%s: bad relocation section name `%s'" +msgstr "%s: nombre de sección de reubicación `%s' erróneo" + +#: elf32-i386.c:2908 elf32-m68k.c:1757 elf32-s390.c:3022 elf32-sparc.c:2879 +#: elf32-xtensa.c:2193 elf64-s390.c:3018 elf64-sparc.c:2664 +#: elf64-x86-64.c:2452 +#, c-format +msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'" +msgstr "%s(%s+0x%lx): reubicación sin resolución contra el símbolo `%s'" + +#: elf32-i386.c:2947 elf32-m68k.c:1796 elf32-s390.c:3072 elf64-s390.c:3068 +#: elf64-x86-64.c:2490 +#, c-format +msgid "%s(%s+0x%lx): reloc against `%s': error %d" +msgstr "%s(%s+0x%lx): reubicación contra `%s': error %d" + +#: elf32-ip2k.c:565 elf32-ip2k.c:571 elf32-ip2k.c:734 elf32-ip2k.c:740 +msgid "ip2k relaxer: switch table without complete matching relocation information." +msgstr "relajador ip2k: tabla switch sin información completa de reubicación de coincidencias." + +#: elf32-ip2k.c:588 elf32-ip2k.c:767 +msgid "ip2k relaxer: switch table header corrupt." +msgstr "relajador ip2k: encabezado de tabla switch corrupto." + +#: elf32-ip2k.c:1395 +#, c-format +msgid "ip2k linker: missing page instruction at 0x%08lx (dest = 0x%08lx)." +msgstr "enlazador ip2k: instrucción de página faltante en 0x%08lx (dest = 0x%08lx)." + +#: elf32-ip2k.c:1409 +#, c-format +msgid "ip2k linker: redundant page instruction at 0x%08lx (dest = 0x%08lx)." +msgstr "enlazador ip2k: instrucción de página redundante en 0x%08lx (dest = 0x%08lx)." + +#. Only if it's not an unresolved symbol. +#: elf32-ip2k.c:1593 +msgid "unsupported relocation between data/insn address spaces" +msgstr "reubicación sin soporte entre espacios de direcciones datos/insn" + +#: elf32-iq2000.c:907 elf32-m68hc1x.c:1431 elf32-ppc.c:2175 elf64-sparc.c:3072 +#: elfxx-mips.c:9195 +#, c-format +msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%s: usa campos de e_flags diferentes (0x%lx) que los módulos previos (0x%lx)" + +#: elf32-m32r.c:930 +msgid "SDA relocation when _SDA_BASE_ not defined" +msgstr "reubicación SDA cuando _SDA_BASE_ no está definido" + +#: elf32-m32r.c:1018 elf64-alpha.c:4279 elf64-alpha.c:4407 elf32-ia64.c:3958 +#: elf64-ia64.c:3958 +#, c-format +msgid "%s: unknown relocation type %d" +msgstr "%s: tipo de reubicación %d desconocido" + +#: elf32-m32r.c:1226 +#, c-format +msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)" +msgstr "%s: El objetivo (%s) de una reubicación %s está en la sección errónea (%s)" + +#: elf32-m32r.c:1952 +#, c-format +msgid "%s: Instruction set mismatch with previous modules" +msgstr "%s: Conjunto de instrucciones no coincidente con módulos previos" + +#: elf32-m32r.c:1975 +#, c-format +msgid "private flags = %lx" +msgstr "opciones privadas = %lx" + +#: elf32-m32r.c:1980 +msgid ": m32r instructions" +msgstr ": instrucciones m32r" + +#: elf32-m32r.c:1981 +msgid ": m32rx instructions" +msgstr ": instrucciones m32rx" + +#: elf32-m68hc1x.c:1217 +#, c-format +msgid "Reference to the far symbol `%s' using a wrong relocation may result in incorrect execution" +msgstr "Una referencia al símbolo far `%s' usando una reubicación incorrecta puede resultar en una ejecución incorrecta" + +#: elf32-m68hc1x.c:1240 +#, c-format +msgid "banked address [%lx:%04lx] (%lx) is not in the same bank as current banked address [%lx:%04lx] (%lx)" +msgstr "la dirección almacenada [%lx:%04lx] (%lx) no está en el mismo banco que la dirección almacenada actual [%lx:%04lx] (%lx)" + +#: elf32-m68hc1x.c:1259 +#, c-format +msgid "reference to a banked address [%lx:%04lx] in the normal address space at %04lx" +msgstr "referencia a una dirección almacenada [%lx:%04lx] en el espacio normal de direcciones en %04lx" + +#: elf32-m68hc1x.c:1396 +#, c-format +msgid "%s: linking files compiled for 16-bit integers (-mshort) and others for 32-bit integers" +msgstr "%s: enlazando ficheros compilados con enteros de 16-bit (-mshort) y otros con enteros de 32-bit" + +#: elf32-m68hc1x.c:1404 +#, c-format +msgid "%s: linking files compiled for 32-bit double (-fshort-double) and others for 64-bit double" +msgstr "%s: enlazando ficheros compilados con dobles de 32-bit (-fshort-double) y otros con dobles de 64-bit" + +#: elf32-m68hc1x.c:1414 +#, c-format +msgid "%s: linking files compiled for HCS12 with others compiled for HC12" +msgstr "%s: enlazando ficheros compilados para HCS12, con otros compilados para HC12" + +#: elf32-m68hc1x.c:1462 +msgid "[abi=32-bit int, " +msgstr "[abi=int de 32-bit, " + +#: elf32-m68hc1x.c:1464 +msgid "[abi=16-bit int, " +msgstr "[abi=int de 16-bit, " + +#: elf32-m68hc1x.c:1467 +msgid "64-bit double, " +msgstr "doble de 64-bit, " + +#: elf32-m68hc1x.c:1469 +msgid "32-bit double, " +msgstr "doble de 32-bit, " + +#: elf32-m68hc1x.c:1472 +msgid "cpu=HC11]" +msgstr "cpu=HC11]" + +#: elf32-m68hc1x.c:1474 +msgid "cpu=HCS12]" +msgstr "cpu=HCS12]" + +#: elf32-m68hc1x.c:1476 +msgid "cpu=HC12]" +msgstr "cpu=HC12]" + +#: elf32-m68hc1x.c:1479 +msgid " [memory=bank-model]" +msgstr " [memoria=modelo de bancos]" + +#: elf32-m68hc1x.c:1481 +msgid " [memory=flat]" +msgstr " [memoria=plana]" + +#: elf32-m68k.c:400 +msgid " [cpu32]" +msgstr " [cpu32]" + +#: elf32-m68k.c:403 +msgid " [m68000]" +msgstr " [m68000]" + +#: elf32-mcore.c:353 elf32-mcore.c:456 +#, c-format +msgid "%s: Relocation %s (%d) is not currently supported.\n" +msgstr "%s: La reubicación %s (%d) actualmente no tiene soporte.\n" + +#: elf32-mcore.c:441 +#, c-format +msgid "%s: Unknown relocation type %d\n" +msgstr "%s: Tipo de reubicación %d desconocido\n" + +#: elf32-mips.c:1170 elf64-mips.c:1717 elfn32-mips.c:1664 +msgid "32bits gp relative relocation occurs for an external symbol" +msgstr "la reubicación gp relativa de 32bits sucede para un símbolo externo" + +#: elf32-mips.c:1314 elf64-mips.c:1830 elfn32-mips.c:1783 +#, c-format +msgid "Linking mips16 objects into %s format is not supported" +msgstr "Enlazar objetos mips16 en el formato %s no tiene soporte" + +#: elf32-ppc.c:2056 +#, c-format +msgid "generic linker can't handle %s" +msgstr "el enlazador genérico no puede manejar %s" + +#: elf32-ppc.c:2138 +#, c-format +msgid "%s: compiled with -mrelocatable and linked with modules compiled normally" +msgstr "%s: compilado con -mrelocatable y enlazado con módulos compilados de forma normal" + +#: elf32-ppc.c:2147 +#, c-format +msgid "%s: compiled normally and linked with modules compiled with -mrelocatable" +msgstr "%s: compilado de forma normal y enlazado con módulos compilados con -mrelocatable" + +#: elf32-ppc.c:3413 +#, c-format +msgid "%s: relocation %s cannot be used when making a shared object" +msgstr "%s: no se puede usar la reubicación %s cuando se hace un objeto compartido" + +#. It does not make sense to have a procedure linkage +#. table entry for a local symbol. +#: elf32-ppc.c:3619 +#, c-format +msgid "%s(%s+0x%lx): %s reloc against local symbol" +msgstr "%s(%s+0x%lx): reubicación %s contra un símbolo local" + +#: elf32-ppc.c:4862 elf64-ppc.c:7789 +#, c-format +msgid "%s: unknown relocation type %d for symbol %s" +msgstr "%s: tipo de reubicación %d desconocido para el símbolo %s" + +#: elf32-ppc.c:5113 +#, c-format +msgid "%s(%s+0x%lx): non-zero addend on %s reloc against `%s'" +msgstr "%s(%s+0x%lx): adición que no es cero en la reubicación %s contra `%s'" + +#: elf32-ppc.c:5399 elf32-ppc.c:5425 elf32-ppc.c:5484 +#, c-format +msgid "%s: the target (%s) of a %s relocation is in the wrong output section (%s)" +msgstr "%s: el objetivo (%s) de una reubicación %s está en la sección de salida errónea (%s)" + +#: elf32-ppc.c:5539 +#, c-format +msgid "%s: relocation %s is not yet supported for symbol %s." +msgstr "%s: la reubicación %s aún no tiene soporte para el símbolo %s." + +#: elf32-ppc.c:5594 elf64-ppc.c:8461 +#, c-format +msgid "%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'" +msgstr "%s(%s+0x%lx): reubicación %s sin resolución contra el símbolo `%s'" + +#: elf32-ppc.c:5644 elf64-ppc.c:8507 +#, c-format +msgid "%s(%s+0x%lx): %s reloc against `%s': error %d" +msgstr "%s(%s+0x%lx): reubicación %s contra `%s': error %d" + +#: elf32-ppc.c:5888 +#, c-format +msgid "corrupt or empty %s section in %s" +msgstr "sección %s corrupta o vacía en %s" + +#: elf32-ppc.c:5895 +#, c-format +msgid "unable to read in %s section from %s" +msgstr "no se puede leer en la sección %s desde %s" + +#: elf32-ppc.c:5901 +#, c-format +msgid "corrupt %s section in %s" +msgstr "sección %s corrupta en %s" + +#: elf32-ppc.c:5944 +#, c-format +msgid "warning: unable to set size of %s section in %s" +msgstr "aviso: no se puede establecer el tamaño de la sección %s en %s" + +#: elf32-ppc.c:5994 +msgid "failed to allocate space for new APUinfo section." +msgstr "no se puede reservar espacio para la nueva sección APUinfo." + +#: elf32-ppc.c:6013 +msgid "failed to compute new APUinfo section." +msgstr "no se puede calcular la nueva sección APUinfo." + +#: elf32-ppc.c:6016 +msgid "failed to install new APUinfo section." +msgstr "no se puede instalar la nueva sección APUinfo." + +#: elf32-s390.c:2256 elf64-s390.c:2226 +#, c-format +msgid "%s(%s+0x%lx): invalid instruction for TLS relocation %s" +msgstr "%s(%s+0x%lx): instrucción inválida para la reubicación TLS %s" + +#: elf32-sh.c:2103 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES offset" +msgstr "%s: 0x%lx: aviso: desplazamiento R_SH_USES erróneo" + +#: elf32-sh.c:2115 +#, c-format +msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x" +msgstr "%s: 0x%lx: aviso: R_SH_USES señala al insn 0x%x no reconocido" + +#: elf32-sh.c:2132 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES load offset" +msgstr "%s: 0x%lx: aviso: desplazamiento de carga R_SH_USES erróneo" + +#: elf32-sh.c:2147 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected reloc" +msgstr "%s: 0x%lx: aviso: no se puede encontrar la reubicación esperada" + +#: elf32-sh.c:2175 +#, c-format +msgid "%s: 0x%lx: warning: symbol in unexpected section" +msgstr "%s: 0x%lx: aviso: símbolo en una sección inesperada" + +#: elf32-sh.c:2300 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected COUNT reloc" +msgstr "%s: 0x%lx: aviso: no se puede encontrar la reubicación COUNT esperada" + +#: elf32-sh.c:2309 +#, c-format +msgid "%s: 0x%lx: warning: bad count" +msgstr "%s: 0x%lx: aviso: cuenta errónea" + +#: elf32-sh.c:2712 elf32-sh.c:3088 +#, c-format +msgid "%s: 0x%lx: fatal: reloc overflow while relaxing" +msgstr "%s: 0x%lx: fatal: desbordamiento de reubicación durante la relajación" + +#: elf32-sh.c:4654 elf64-sh64.c:1585 +msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled" +msgstr "No se maneja un STO_SH5_ISA32 inesperado en un símbolo local" + +#: elf32-sh.c:4809 +#, c-format +msgid "%s: unresolvable relocation against symbol `%s' from %s section" +msgstr "%s: reubicación sin resolución contra el símbolo `%s' de la sección %s" + +#: elf32-sh.c:4881 +#, c-format +msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation" +msgstr "%s: 0x%lx: fatal: objetivo de ramificación sin alineación para la reubicación de soporte de relajamiento" + +#: elf32-sh.c:6627 elf64-alpha.c:4848 +#, c-format +msgid "%s: TLS local exec code cannot be linked into shared objects" +msgstr "%s: el código de ejecución local TLS no se puede enlazar en objetos compartidos" + +#: elf32-sh64.c:221 elf64-sh64.c:2407 +#, c-format +msgid "%s: compiled as 32-bit object and %s is 64-bit" +msgstr "%s: compilado como un objeto de 32-bit y %s es de 64-bit" + +#: elf32-sh64.c:224 elf64-sh64.c:2410 +#, c-format +msgid "%s: compiled as 64-bit object and %s is 32-bit" +msgstr "%s: compilado como un objeto de 64-bit y %s es de 32-bit" + +#: elf32-sh64.c:226 elf64-sh64.c:2412 +#, c-format +msgid "%s: object size does not match that of target %s" +msgstr "%s: el tamaño del objeto no coincide con el tamaño del objetivo %s" + +#: elf32-sh64.c:461 elf64-sh64.c:2990 +#, c-format +msgid "%s: encountered datalabel symbol in input" +msgstr "%s: se encontró un símbolo datalabel en la entrada" + +#: elf32-sh64.c:544 +msgid "PTB mismatch: a SHmedia address (bit 0 == 1)" +msgstr "No coincide PTB: una dirección SHmedia (bit 0 == 1)" + +#: elf32-sh64.c:547 +msgid "PTA mismatch: a SHcompact address (bit 0 == 0)" +msgstr "No coincide PTA: una dirección SHcompact (bit 0 == 0)" + +#: elf32-sh64.c:565 +#, c-format +msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16" +msgstr "%s: error de GAS: instrucción PTB inesperada con R_SH_PT_16" + +#: elf32-sh64.c:614 elf64-sh64.c:1748 +#, c-format +msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n" +msgstr "%s: error: tipo de reubicación %d sin alinear en %08x reubicación %08x\n" + +#: elf32-sh64.c:698 +#, c-format +msgid "%s: could not write out added .cranges entries" +msgstr "%s: no se pueden escribir las entradas .cranges agregadas" + +#: elf32-sh64.c:760 +#, c-format +msgid "%s: could not write out sorted .cranges entries" +msgstr "%s: no se pueden escribir las entradas .cranges ordenadas" + +#: elf32-sparc.c:2521 elf64-sparc.c:2314 +#, c-format +msgid "%s: probably compiled without -fPIC?" +msgstr "%s: ¿Compilado probablemente sin -fPIC?" + +#: elf32-sparc.c:3348 +#, c-format +msgid "%s: compiled for a 64 bit system and target is 32 bit" +msgstr "%s: compilado para un sistema de 64 bit y el objetivo es de 32 bit" + +#: elf32-sparc.c:3362 +#, c-format +msgid "%s: linking little endian files with big endian files" +msgstr "%s: enlazando ficheros little endian con ficheros big endian" + +#: elf32-v850.c:753 +#, c-format +msgid "Variable `%s' cannot occupy in multiple small data regions" +msgstr "La variable `%s' no puede ocupar múltiples regiones de datos small" + +#: elf32-v850.c:756 +#, c-format +msgid "Variable `%s' can only be in one of the small, zero, and tiny data regions" +msgstr "La variable `%s' solamente puede estar en una de las regiones de datos small, cero, y tiny" + +#: elf32-v850.c:759 +#, c-format +msgid "Variable `%s' cannot be in both small and zero data regions simultaneously" +msgstr "La variable `%s' no puede estar simultáneamente en las regiones de datos small y cero" + +#: elf32-v850.c:762 +#, c-format +msgid "Variable `%s' cannot be in both small and tiny data regions simultaneously" +msgstr "La variable `%s' no puede estar simultáneamente en las regiones de datos small y tiny" + +#: elf32-v850.c:765 +#, c-format +msgid "Variable `%s' cannot be in both zero and tiny data regions simultaneously" +msgstr "La variable `%s' no puede estar simultáneamente en las regiones de datos cero y tiny" + +#: elf32-v850.c:1144 +msgid "FAILED to find previous HI16 reloc\n" +msgstr "FALLO para encontrar la reubicación HI16 previa\n" + +#: elf32-v850.c:1789 +msgid "could not locate special linker symbol __gp" +msgstr "no se puede localizar el símbolo especial del enlazador __gp" + +#: elf32-v850.c:1793 +msgid "could not locate special linker symbol __ep" +msgstr "no se puede localizar el símbolo especial del enlazador __ep" + +#: elf32-v850.c:1797 +msgid "could not locate special linker symbol __ctbp" +msgstr "no se puede localizar el símbolo especial del enlazador __ctbp" + +#: elf32-v850.c:1963 +#, c-format +msgid "%s: Architecture mismatch with previous modules" +msgstr "%s: No coincide la arquitectura con los módulos previos" + +#: elf32-v850.c:1983 +#, c-format +msgid "private flags = %lx: " +msgstr "opciones privadas = %lx: " + +#: elf32-v850.c:1988 +msgid "v850 architecture" +msgstr "arquitectura v850" + +#: elf32-v850.c:1989 +msgid "v850e architecture" +msgstr "arquitectura v850e" + +#: elf32-vax.c:549 +msgid " [nonpic]" +msgstr " [no pic]" + +#: elf32-vax.c:552 +msgid " [d-float]" +msgstr " [flotante-d]" + +#: elf32-vax.c:555 +msgid " [g-float]" +msgstr " [flotante-g]" + +#: elf32-vax.c:663 +#, c-format +msgid "%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of %ld" +msgstr "%s: aviso: la adición GOT de %ld a `%s' no coincide con la adición previa GOT de %ld" + +#: elf32-vax.c:1667 +#, c-format +msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored" +msgstr "%s: aviso: se ignora la adición PLT de %d a `%s' de la sección %s" + +#: elf32-vax.c:1802 +#, c-format +msgid "%s: warning: %s relocation against symbol `%s' from %s section" +msgstr "%s: aviso: reubicación %s contra el símbolo `%s' de la sección %s" + +#: elf32-vax.c:1808 +#, c-format +msgid "%s: warning: %s relocation to 0x%x from %s section" +msgstr "%s: aviso: reubicación %s a 0x%x de la sección %s" + +#: elf32-xstormy16.c:462 elf32-ia64.c:2450 elf64-ia64.c:2450 +msgid "non-zero addend in @fptr reloc" +msgstr "adición que no es cero en la reubicación @fptr" + +#: elf64-alpha.c:1108 +msgid "GPDISP relocation did not find ldah and lda instructions" +msgstr "la reubicación GPDISP no encontró las instrucciones ldah y lda" + +#: elf64-alpha.c:3731 +#, c-format +msgid "%s: .got subsegment exceeds 64K (size %d)" +msgstr "%s: el subsegmento .got excede los 64K (tamaño %d)" + +#: elf64-alpha.c:4602 elf64-alpha.c:4614 +#, c-format +msgid "%s: gp-relative relocation against dynamic symbol %s" +msgstr "%s: reubicación gp relativa contra el símbolo dinámico %s" + +#: elf64-alpha.c:4640 elf64-alpha.c:4773 +#, c-format +msgid "%s: pc-relative relocation against dynamic symbol %s" +msgstr "%s: reubicación relativa al pc contra el símbolo dinámico %s" + +#: elf64-alpha.c:4668 +#, c-format +msgid "%s: change in gp: BRSGP %s" +msgstr "%s: cambio en gp: BRSGP %s" + +#: elf64-alpha.c:4693 +msgid "" +msgstr "" + +#: elf64-alpha.c:4698 +#, c-format +msgid "%s: !samegp reloc against symbol without .prologue: %s" +msgstr "%s: reubicación !samegp contra un símbolo sin .prologue: %s" + +#: elf64-alpha.c:4749 +#, c-format +msgid "%s: unhandled dynamic relocation against %s" +msgstr "%s: reubicación dinámica sin manejar contra %s" + +#: elf64-alpha.c:4832 +#, c-format +msgid "%s: dtp-relative relocation against dynamic symbol %s" +msgstr "%s: reubicación relativa a dtp contra el símbolo dinámico %s" + +#: elf64-alpha.c:4855 +#, c-format +msgid "%s: tp-relative relocation against dynamic symbol %s" +msgstr "%s: reubicación relativa a tp contra el símbolo dinámico %s" + +#: elf64-hppa.c:2086 +#, c-format +msgid "stub entry for %s cannot load .plt, dp offset = %ld" +msgstr "la entrada de cabo para %s no puede cargar .plt, desplazamiento dp = %ld" + +#: elf64-mmix.c:1032 +#, c-format +msgid "" +"%s: Internal inconsistency error for value for\n" +" linker-allocated global register: linked: 0x%lx%08lx != relaxed: 0x%lx%08lx\n" +msgstr "" +"%s: Error de inconsistencia interna para el valor para\n" +" un registro global colocado por el enlazador: enlazado: 0x%lx%08lx != relajado: 0x%lx%08lx\n" + +#: elf64-mmix.c:1416 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: (unknown) in %s" +msgstr "%s: reubicación base-más-desplazamiento contra un símbolo de registro: (desconocido) en %s" + +#: elf64-mmix.c:1421 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: %s in %s" +msgstr "%s: reubicación base-más-desplazamiento contra un símbolo de registro: %s en %s" + +#: elf64-mmix.c:1465 +#, c-format +msgid "%s: register relocation against non-register symbol: (unknown) in %s" +msgstr "%s: reubicación de registro contra un símbolo que no es registro: (desconocido) en %s" + +#: elf64-mmix.c:1470 +#, c-format +msgid "%s: register relocation against non-register symbol: %s in %s" +msgstr "%s: reubicación de registro contra un símbolo que no es registro: %s en %s" + +#: elf64-mmix.c:1507 +#, c-format +msgid "%s: directive LOCAL valid only with a register or absolute value" +msgstr "%s: la directiva LOCAL sólo es válida con un registro o un valor absoluto" + +#: elf64-mmix.c:1535 +#, c-format +msgid "%s: LOCAL directive: Register $%ld is not a local register. First global register is $%ld." +msgstr "%s: directiva LOCAL: El registro $%ld no es un registro local. El primer registro global es $%ld." + +#: elf64-mmix.c:1994 +#, c-format +msgid "%s: Error: multiple definition of `%s'; start of %s is set in a earlier linked file\n" +msgstr "%s: Error: definición múltiple de `%s'; el inicio de %s está definido en un fichero enlazado con anterioridad\n" + +#: elf64-mmix.c:2053 +msgid "Register section has contents\n" +msgstr "La sección de registros no tiene contenido\n" + +#: elf64-mmix.c:2216 +#, c-format +msgid "" +"Internal inconsistency: remaining %u != max %u.\n" +" Please report this bug." +msgstr "" +"Inconsistencia interna: %u restante != %u máximo.\n" +" Por favor reporte este bicho." + +#: elf64-ppc.c:2388 libbfd.c:831 +#, c-format +msgid "%s: compiled for a big endian system and target is little endian" +msgstr "%s: compilado para un sistema big endian y el objetivo es little endian" + +#: elf64-ppc.c:2391 libbfd.c:833 +#, c-format +msgid "%s: compiled for a little endian system and target is big endian" +msgstr "%s: compilado para un sistema little endian y el objetivo es big endian" + +#: elf64-ppc.c:4857 +#, c-format +msgid "%s: unexpected reloc type %u in .opd section" +msgstr "%s: tipo de reubicación %u inesperado en la sección .opd" + +#: elf64-ppc.c:4877 +#, c-format +msgid "%s: .opd is not a regular array of opd entries" +msgstr "%s: .opd no es una matriz regular de entradas opd" + +#: elf64-ppc.c:4897 +#, c-format +msgid "%s: undefined sym `%s' in .opd section" +msgstr "%s: símbolo `%s' indefinido en la sección .opd" + +#: elf64-ppc.c:6136 +#, c-format +msgid "can't find branch stub `%s'" +msgstr "no se puede encontrar la ramificación de cabo `%s'" + +#: elf64-ppc.c:6175 elf64-ppc.c:6250 +#, c-format +msgid "linkage table error against `%s'" +msgstr "error de la tabla de enlazado contra `%s'" + +#: elf64-ppc.c:6340 +#, c-format +msgid "can't build branch stub `%s'" +msgstr "no se puede construir la ramificación de cabos `%s'" + +#: elf64-ppc.c:7047 +msgid ".glink and .plt too far apart" +msgstr ".glink y .plt están demasiado alejados" + +#: elf64-ppc.c:7135 +msgid "stubs don't match calculated size" +msgstr "los cabos no coinciden con el tamaño calculado" + +#: elf64-ppc.c:7147 +#, c-format +msgid "" +"linker stubs in %u groups\n" +" branch %lu\n" +" toc adjust %lu\n" +" long branch %lu\n" +" long toc adj %lu\n" +" plt call %lu" +msgstr "" +"cabos de enlazador en %u grupos\n" +" rama %lu\n" +" ajuste toc %lu\n" +" rama long %lu\n" +" ajuste toc long %lu\n" +" llamada plt %lu" + +#: elf64-ppc.c:7723 +#, c-format +msgid "%s(%s+0x%lx): automatic multiple TOCs not supported using your crt files; recompile with -mminimal-toc or upgrade gcc" +msgstr "%s(%s+0x%lx): los TOCs múltiples automáticos no tienes soporte utilizando sus ficheros crt; recompile con -mminimal-toc o actualice gcc" + +#: elf64-ppc.c:7731 +#, c-format +msgid "%s(%s+0x%lx): sibling call optimization to `%s' does not allow automatic multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, or make `%s' extern" +msgstr "%s(%s+0x%lx): la optimización de llamada hermana a `%s' no permite TOCs múltiples automáticos; recompile con -mminimal-toc ó -fno-optimize-sibling-calls, o vuelva `%s' externa" + +#: elf64-ppc.c:8329 +#, c-format +msgid "%s: relocation %s is not supported for symbol %s." +msgstr "%s: la reubicación %s no tiene soporte para el símbolo %s." + +#: elf64-ppc.c:8408 +#, c-format +msgid "%s: error: relocation %s not a multiple of %d" +msgstr "%s: error: la reubicación %s no es un múltiplo de %d" + +#: elf64-sparc.c:1370 +#, c-format +msgid "%s: check_relocs: unhandled reloc type %d" +msgstr "%s: check_relocs: tipo de reubicación %d sin manejar" + +#: elf64-sparc.c:1407 +#, c-format +msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER" +msgstr "%s: Solamente los registros %%g[2367] pueden ser declarados utilizando STT_REGISTER" + +#: elf64-sparc.c:1427 +#, c-format +msgid "Register %%g%d used incompatibly: %s in %s, previously %s in %s" +msgstr "El registro %%g%d se usó de forma incompatible: %s en %s, previamente %s en %s" + +#: elf64-sparc.c:1450 +#, c-format +msgid "Symbol `%s' has differing types: REGISTER in %s, previously %s in %s" +msgstr "El símbolo `%s' tiene tipos divergentes: REGISTER en %s, previamente %s en %s" + +#: elf64-sparc.c:1496 +#, c-format +msgid "Symbol `%s' has differing types: %s in %s, previously REGISTER in %s" +msgstr "El símbolo `%s' tiene tipos divergentes: %s en %s, previamente REGISTER en %s" + +#: elf64-sparc.c:3053 +#, c-format +msgid "%s: linking UltraSPARC specific with HAL specific code" +msgstr "%s: enlazando código específico de UltraSPARC con código específico de HAL" + +#: elf64-x86-64.c:739 +#, c-format +msgid "%s: %s' accessed both as normal and thread local symbol" +msgstr "%s: se accesó `%s' como un símbolo normal y como un símbolo local de hilo" + +#: elfcode.h:1113 +#, c-format +msgid "%s: version count (%ld) does not match symbol count (%ld)" +msgstr "%s: la cuenta de versión (%ld) no coincide con la cuenta de símbolos (%ld)" + +#: elfcode.h:1342 +#, c-format +msgid "%s(%s): relocation %d has invalid symbol index %ld" +msgstr "%s(%s): la reubicación %d tiene un índice de símbolo %ld inválido" + +#: elflink.c:1456 +#, c-format +msgid "%s: warning: unexpected redefinition of indirect versioned symbol `%s'" +msgstr "%s: aviso: redefinición inesperada del símbolo con versión indirecta `%s'" + +#: elflink.c:1807 +#, c-format +msgid "%s: undefined versioned symbol name %s" +msgstr "%s: nombre de símbolo con versión %s sin definir" + +#: elflink.c:2142 +#, c-format +msgid "%s: relocation size mismatch in %s section %s" +msgstr "%s: tamaño de reubicación no coincidente en %s sección %s" + +#: elflink.c:2434 +#, c-format +msgid "warning: type and size of dynamic symbol `%s' are not defined" +msgstr "aviso: el tipo y tamaño del símbolo dinámico `%s' no están definidos" + +#: elflink.h:1022 +#, c-format +msgid "%s: %s: invalid version %u (max %d)" +msgstr "%s: %s: versión %u inválida (máximo %d)" + +#: elflink.h:1063 +#, c-format +msgid "%s: %s: invalid needed version %d" +msgstr "%s: %s: versión requerida %d inválida" + +#: elflink.h:1238 +#, c-format +msgid "Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s" +msgstr "Aviso: la alineación %u del símbolo `%s' en %s es más pequeña que %u en %s" + +#: elflink.h:1252 +#, c-format +msgid "Warning: size of symbol `%s' changed from %lu in %s to %lu in %s" +msgstr "Aviso: el tamaño del símbolo `%s' cambió de %lu en %s a %lu en %s" + +#: elflink.h:2160 +#, c-format +msgid "%s: undefined version: %s" +msgstr "%s: versión sin definir: %s" + +#: elflink.h:2226 +#, c-format +msgid "%s: .preinit_array section is not allowed in DSO" +msgstr "%s: no se permite la sección .preinit_array en DSO" + +#: elflink.h:3078 +msgid "Not enough memory to sort relocations" +msgstr "No hay suficiente memoria para ordenar las reubicaciones" + +#: elflink.h:3958 elflink.h:4001 +#, c-format +msgid "%s: could not find output section %s" +msgstr "%s: no se puede encontrar la sección de salida %s" + +#: elflink.h:3964 +#, c-format +msgid "warning: %s section has zero size" +msgstr "aviso: la sección %s es de tamaño cero" + +#: elflink.h:4483 +#, c-format +msgid "%s: %s symbol `%s' in %s is referenced by DSO" +msgstr "%s: el símbolo %s `%s' en %s está referenciado por DSO" + +#: elflink.h:4564 +#, c-format +msgid "%s: could not find output section %s for input section %s" +msgstr "%s: no se puede encontrar la sección de salida %s para la sección de entrada %s" + +#: elflink.h:4666 +#, c-format +msgid "%s: %s symbol `%s' isn't defined" +msgstr "%s: el símbolo %s `%s' no está definido" + +#: elflink.h:5053 elflink.h:5095 +msgid "%T: discarded in section `%s' from %s\n" +msgstr "%T: descartado en la sección `%s' desde %s\n" + +#: elfxx-mips.c:887 +msgid "static procedure (no name)" +msgstr "procedimiento estático (sin nombre)" + +#: elfxx-mips.c:1897 +msgid "not enough GOT space for local GOT entries" +msgstr "no hay suficiente espacio GOT para entradas GOT locales" + +#: elfxx-mips.c:3691 +#, c-format +msgid "%s: %s+0x%lx: jump to stub routine which is not jal" +msgstr "%s: %s+0x%lx: salto a una rutina cabo la cual no es jal" + +#: elfxx-mips.c:5192 +#, c-format +msgid "%s: Malformed reloc detected for section %s" +msgstr "%s: Se detectó una reubicación malformada para la sección %s" + +#: elfxx-mips.c:5266 +#, c-format +msgid "%s: CALL16 reloc at 0x%lx not against global symbol" +msgstr "%s: la reubicación CALL16 en 0x%lx no es contra un símbolo global" + +#: elfxx-mips.c:8692 +#, c-format +msgid "%s: illegal section name `%s'" +msgstr "%s: nombre de sección `%s' ilegal" + +#: elfxx-mips.c:9025 +#, c-format +msgid "%s: endianness incompatible with that of the selected emulation" +msgstr "%s: la endianez es incompatible con aquella de la emulación seleccionada" + +#: elfxx-mips.c:9037 +#, c-format +msgid "%s: ABI is incompatible with that of the selected emulation" +msgstr "%s: la ABI es incompatible con aquella de la emulación seleccionada" + +#: elfxx-mips.c:9104 +#, c-format +msgid "%s: warning: linking PIC files with non-PIC files" +msgstr "%s: aviso: enlazando ficheros PIC con ficheros que no son PIC" + +#: elfxx-mips.c:9121 +#, c-format +msgid "%s: linking 32-bit code with 64-bit code" +msgstr "%s: enlazando código de 32-bit con código de 64-bit" + +#: elfxx-mips.c:9149 +#, c-format +msgid "%s: linking %s module with previous %s modules" +msgstr "%s: enlazando el módulo %s con módulos %s previos" + +#: elfxx-mips.c:9172 +#, c-format +msgid "%s: ABI mismatch: linking %s module with previous %s modules" +msgstr "%s: no coincide el ABI: enlazando el módulo %s con módulos %s previos" + +#: elfxx-mips.c:9241 +msgid " [abi=O32]" +msgstr " [abi=O32]" + +#: elfxx-mips.c:9243 +msgid " [abi=O64]" +msgstr " [abi=O64]" + +#: elfxx-mips.c:9245 +msgid " [abi=EABI32]" +msgstr " [abi=EABI32]" + +#: elfxx-mips.c:9247 +msgid " [abi=EABI64]" +msgstr " [abi=EABI64]" + +#: elfxx-mips.c:9249 +msgid " [abi unknown]" +msgstr " [abi desconocido]" + +#: elfxx-mips.c:9251 +msgid " [abi=N32]" +msgstr " [abi=N32]" + +#: elfxx-mips.c:9253 +msgid " [abi=64]" +msgstr " [abi=64]" + +#: elfxx-mips.c:9255 +msgid " [no abi set]" +msgstr " [no hay conjunto abi]" + +#: elfxx-mips.c:9258 +msgid " [mips1]" +msgstr " [mips1]" + +#: elfxx-mips.c:9260 +msgid " [mips2]" +msgstr " [mips2]" + +#: elfxx-mips.c:9262 +msgid " [mips3]" +msgstr " [mips3]" + +#: elfxx-mips.c:9264 +msgid " [mips4]" +msgstr " [mips4]" + +#: elfxx-mips.c:9266 +msgid " [mips5]" +msgstr " [mips5]" + +#: elfxx-mips.c:9268 +msgid " [mips32]" +msgstr " [mips32]" + +#: elfxx-mips.c:9270 +msgid " [mips64]" +msgstr " [mips64]" + +#: elfxx-mips.c:9272 +msgid " [mips32r2]" +msgstr " [mips32r2]" + +#: elfxx-mips.c:9274 +msgid " [unknown ISA]" +msgstr " [ISA desconocido]" + +#: elfxx-mips.c:9277 +msgid " [mdmx]" +msgstr " [mdmx]" + +#: elfxx-mips.c:9280 +msgid " [mips16]" +msgstr " [mips16]" + +#: elfxx-mips.c:9283 +msgid " [32bitmode]" +msgstr " [modo 32bit]" + +#: elfxx-mips.c:9285 +msgid " [not 32bitmode]" +msgstr " [no es modo 32bit]" + +#: i386linux.c:457 m68klinux.c:461 sparclinux.c:458 +#, c-format +msgid "Output file requires shared library `%s'\n" +msgstr "El fichero de salida requiere la biblioteca compartida `%s'\n" + +#: i386linux.c:465 m68klinux.c:469 sparclinux.c:466 +#, c-format +msgid "Output file requires shared library `%s.so.%s'\n" +msgstr "El fichero de salida requiere la biblioteca compartida `%s.so.%s'\n" + +#: i386linux.c:654 i386linux.c:704 m68klinux.c:661 m68klinux.c:709 +#: sparclinux.c:656 sparclinux.c:706 +#, c-format +msgid "Symbol %s not defined for fixups\n" +msgstr "El símbolo %s no está definido para composturas\n" + +#: i386linux.c:728 m68klinux.c:733 sparclinux.c:730 +msgid "Warning: fixup count mismatch\n" +msgstr "Aviso: no coincide la cuenta de composturas\n" + +#: ieee.c:293 +#, c-format +msgid "%s: string too long (%d chars, max 65535)" +msgstr "%s: la cadena es demasiado larga (%d caracteres, máximo 65535)" + +#: ieee.c:428 +#, c-format +msgid "%s: unrecognized symbol `%s' flags 0x%x" +msgstr "%s: símbolo `%s' no reconocido opciones 0x%x" + +#: ieee.c:938 +#, c-format +msgid "%s: unimplemented ATI record %u for symbol %u" +msgstr "%s: grabación ATI %u sin implementar para el símbolo %u" + +#: ieee.c:963 +#, c-format +msgid "%s: unexpected ATN type %d in external part" +msgstr "%s: tipo ATN %d inesperado en la parte externa" + +#: ieee.c:985 +#, c-format +msgid "%s: unexpected type after ATN" +msgstr "%s: tipo inesperado después de ATN" + +#: ihex.c:264 +#, c-format +msgid "%s:%d: unexpected character `%s' in Intel Hex file\n" +msgstr "%s:%d: carácter `%s' inesperado en el fichero Hexadecimal de Intel\n" + +#: ihex.c:372 +#, c-format +msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)" +msgstr "%s:%u: suma de comprobación errónea en el fichero Hexadecimal de Intel (se esperaba %u, se obtuvo %u)" + +#: ihex.c:426 +#, c-format +msgid "%s:%u: bad extended address record length in Intel Hex file" +msgstr "%s:%u: longitud de registro de dirección extendida errónea en el fichero Hexadecimal de Intel" + +#: ihex.c:443 +#, c-format +msgid "%s:%u: bad extended start address length in Intel Hex file" +msgstr "%s:%u: longitud de dirección de inicio extendida errónea en el fichero Hexadecimal de Intel" + +#: ihex.c:460 +#, c-format +msgid "%s:%u: bad extended linear address record length in Intel Hex file" +msgstr "%s:%u: longitud de registro de dirección lineal extendida errónea en el fichero Hexadecimal de Intel" + +#: ihex.c:477 +#, c-format +msgid "%s:%u: bad extended linear start address length in Intel Hex file" +msgstr "%s:%u: longitud de dirección de inicio lineal extendida errónea en el fichero Hexadecimal de Intel" + +#: ihex.c:494 +#, c-format +msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n" +msgstr "%s:%u: tipo ihex %u no reconocido en el fichero Hexadecimal de Intel\n" + +#: ihex.c:619 +#, c-format +msgid "%s: internal error in ihex_read_section" +msgstr "%s: error interno en ihex_read_section" + +#: ihex.c:654 +#, c-format +msgid "%s: bad section length in ihex_read_section" +msgstr "%s: longitud de sección errónea en ihex_read_section" + +#: ihex.c:872 +#, c-format +msgid "%s: address 0x%s out of range for Intel Hex file" +msgstr "%s: la dirección 0x%s está fuera de rango en el fichero Hexadecimal de Intel" + +#: libbfd.c:861 +#, c-format +msgid "Deprecated %s called at %s line %d in %s\n" +msgstr "Se llamó a %s que está deprecado en %s línea %d en %s\n" + +#: libbfd.c:864 +#, c-format +msgid "Deprecated %s called\n" +msgstr "Se llamó a %s que está deprecado\n" + +#: linker.c:1829 +#, c-format +msgid "%s: indirect symbol `%s' to `%s' is a loop" +msgstr "%s: el símbolo indirecto `%s' para `%s' es un ciclo" + +#: linker.c:2697 +#, c-format +msgid "Attempt to do relocatable link with %s input and %s output" +msgstr "Se intentó hacer un enlace reubicable con entrada %s y salida %s" + +#: merge.c:896 +#, c-format +msgid "%s: access beyond end of merged section (%ld + %ld)" +msgstr "%s: acceso más allá del final de la sección mezclada (%ld + %ld)" + +#: mmo.c:503 +#, c-format +msgid "%s: No core to allocate section name %s\n" +msgstr "%s: No hay core para asignar el nombre de sección %s\n" + +#: mmo.c:579 +#, c-format +msgid "%s: No core to allocate a symbol %d bytes long\n" +msgstr "%s: No hay core para asignar un símbolo de %d bytes de longitud\n" + +#: mmo.c:1287 +#, c-format +msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n" +msgstr "%s: fichero mmo inválido: el valor de iniciación para $255 no es `Main'\n" + +#: mmo.c:1433 +#, c-format +msgid "%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name starting with `%s'\n" +msgstr "%s: secuencia de caracteres anchos 0x%02X 0x%02X sin soporte después del nombre de símbolo que inicia con `%s'\n" + +#: mmo.c:1674 +#, c-format +msgid "%s: invalid mmo file: unsupported lopcode `%d'\n" +msgstr "%s: fichero mmo inválido: código de operación-l `%d' sin soporte\n" + +#: mmo.c:1684 +#, c-format +msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n" +msgstr "%s: fichero mmo inválido: se esperaba YZ = 1 se obtuvo YZ = %d para lop_quote\n" + +#: mmo.c:1720 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n" +msgstr "%s: fichero mmo inválido: se esperaba z = 1 ó z = 2, se obtuvo z = %d para lop_loc\n" + +#: mmo.c:1766 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n" +msgstr "%s: fichero mmo inválido: se esperaba z = 1 ó z = 2, se obtuvo z = %d para lop_fixo\n" + +#: mmo.c:1805 +#, c-format +msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n" +msgstr "%s: fichero mmo inválido: se esperaba y = 0, se obtuvo y = %d para lop_fixrx\n" + +#: mmo.c:1814 +#, c-format +msgid "%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n" +msgstr "%s: fichero mmo inválido: se esperaba z = 16 ó z = 24, se obtuvo z = %d para lop_fixrx\n" + +#: mmo.c:1837 +#, c-format +msgid "%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d for lop_fixrx\n" +msgstr "%s: fichero mmo inválido: el byte inicial de la palabra operando debe ser 0 ó 1, se obtuvo %d para lop_fixrx\n" + +#: mmo.c:1860 +#, c-format +msgid "%s: cannot allocate file name for file number %d, %d bytes\n" +msgstr "%s: no se puede asignar el nombre de fichero para el número de fichero %d, %d bytes\n" + +#: mmo.c:1880 +#, c-format +msgid "%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n" +msgstr "%s: fichero mmo inválido: el número de fichero %d `%s' ya se había introducido como `%s'\n" + +#: mmo.c:1893 +#, c-format +msgid "%s: invalid mmo file: file name for number %d was not specified before use\n" +msgstr "%s: fichero mmo inválido: no se especificó un nombre de fichero para el número %d antes de utilizarse\n" + +#: mmo.c:1999 +#, c-format +msgid "%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n" +msgstr "%s: fichero mmo inválido: los campos y y z de lop_stab no son cero, y: %d, z: %d\n" + +#: mmo.c:2035 +#, c-format +msgid "%s: invalid mmo file: lop_end not last item in file\n" +msgstr "%s: fichero mmo inválido: lop_end no es el último elemento en el fichero\n" + +#: mmo.c:2048 +#, c-format +msgid "%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras to the preceding lop_stab (%ld)\n" +msgstr "%s: fichero mmo inválido: YZ de lop_end (%ld) no es igual al número de tetras del lop_stab precedente (%ld)\n" + +#: mmo.c:2698 +#, c-format +msgid "%s: invalid symbol table: duplicate symbol `%s'\n" +msgstr "%s: tabla de símbolos inválida: símbolo `%s' duplicado\n" + +#: mmo.c:2949 +#, c-format +msgid "%s: Bad symbol definition: `Main' set to %s rather than the start address %s\n" +msgstr "%s: Definición de símbolo errónea: `Main' se estableción como %s en lugar de la dirección de inicio %s\n" + +#: mmo.c:3039 +#, c-format +msgid "%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: %d. Only `Main' will be emitted.\n" +msgstr "%s: aviso: la tabla de símbolos es demasiado grande para mmo, es más grande que 65535 words de 32-bit: %d. Sólo se emitirá `Main'.\n" + +#: mmo.c:3084 +#, c-format +msgid "%s: internal error, symbol table changed size from %d to %d words\n" +msgstr "%s: error interno, la tabla de símbolos cambió de tamaño de %d a %d words\n" + +#: mmo.c:3139 +#, c-format +msgid "%s: internal error, internal register section %s had contents\n" +msgstr "%s: error interno, la sección interna de registros %s tiene contenido\n" + +#: mmo.c:3191 +#, c-format +msgid "%s: no initialized registers; section length 0\n" +msgstr "%s: no hay registros iniciados; longitud de sección 0\n" + +#: mmo.c:3197 +#, c-format +msgid "%s: too many initialized registers; section length %ld\n" +msgstr "%s: demasiados registros iniciados: longitud de sección %ld\n" + +#: mmo.c:3202 +#, c-format +msgid "%s: invalid start address for initialized registers of length %ld: 0x%lx%08lx\n" +msgstr "%s: dirección de inicio inválida para los registros iniciados de longitud %ld: 0x%lx%08lx\n" + +#: oasys.c:1052 +#, c-format +msgid "%s: can not represent section `%s' in oasys" +msgstr "%s: no se puede representar la sección `%s' en oasys" + +#: osf-core.c:137 +#, c-format +msgid "Unhandled OSF/1 core file section type %d\n" +msgstr "Tipo de sección de fichero núcleo OSF/1 %d sin manejar\n" + +#: pe-mips.c:659 +#, c-format +msgid "%s: `ld -r' not supported with PE MIPS objects\n" +msgstr "%s: `ld -r' no tiene soporte con objetos PE MIPS\n" + +#. OK, at this point the following variables are set up: +#. src = VMA of the memory we're fixing up +#. mem = pointer to memory we're fixing up +#. val = VMA of what we need to refer to +#. +#: pe-mips.c:795 +#, c-format +msgid "%s: unimplemented %s\n" +msgstr "%s: %s sin implementar\n" + +#: pe-mips.c:821 +#, c-format +msgid "%s: jump too far away\n" +msgstr "%s: salto demasiado lejos\n" + +#: pe-mips.c:848 +#, c-format +msgid "%s: bad pair/reflo after refhi\n" +msgstr "%s: pair/reflo erróneo después de refhi\n" + +#. XXX code yet to be written. +#: peicode.h:787 +#, c-format +msgid "%s: Unhandled import type; %x" +msgstr "%s: Tipo de importación sin manejar; %x" + +#: peicode.h:792 +#, c-format +msgid "%s: Unrecognised import type; %x" +msgstr "%s: Tipo de importación no reconocida; %x" + +#: peicode.h:806 +#, c-format +msgid "%s: Unrecognised import name type; %x" +msgstr "%s: Tipo de nombre de importación no reconocida; %x" + +#: peicode.h:1164 +#, c-format +msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive" +msgstr "%s: Tipo de máquina (0x%x) no reconocida en el archivo de Formato de Importación de Bibliotecas" + +#: peicode.h:1176 +#, c-format +msgid "%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive" +msgstr "%s: Tipo de máquina (0x%x) reconocida pero sin manejar en el archivo de Formato de Importación de Bibliotecas" + +#: peicode.h:1193 +#, c-format +msgid "%s: size field is zero in Import Library Format header" +msgstr "%s: el tamaño del campo es cero en el encabezado del Formato de Importación de Bibliotecas" + +#: peicode.h:1224 +#, c-format +msgid "%s: string not null terminated in ILF object file." +msgstr "%s: la cadena no termina en null en el fichero objeto ILF." + +#: ppcboot.c:416 +msgid "" +"\n" +"ppcboot header:\n" +msgstr "" +"\n" +"encabezado de ppcboot:\n" + +#: ppcboot.c:417 +#, c-format +msgid "Entry offset = 0x%.8lx (%ld)\n" +msgstr "Desplazamiento de entrada = 0x%.8lx (%ld)\n" + +#: ppcboot.c:418 +#, c-format +msgid "Length = 0x%.8lx (%ld)\n" +msgstr "Longitud = 0x%.8lx (%ld)\n" + +#: ppcboot.c:421 +#, c-format +msgid "Flag field = 0x%.2x\n" +msgstr "Campo de opciones = 0x%.2x\n" + +#: ppcboot.c:427 +#, c-format +msgid "Partition name = \"%s\"\n" +msgstr "Nombre de la partición = \"%s\"\n" + +#: ppcboot.c:446 +#, c-format +msgid "" +"\n" +"Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "" +"\n" +"Partición[%d] inicio = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:452 +#, c-format +msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "Partición[%d] fin = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:458 +#, c-format +msgid "Partition[%d] sector = 0x%.8lx (%ld)\n" +msgstr "Partición[%d] sector = 0x%.8lx (%ld)\n" + +#: ppcboot.c:459 +#, c-format +msgid "Partition[%d] length = 0x%.8lx (%ld)\n" +msgstr "Partición[%d] longitud = 0x%.8lx (%ld)\n" + +#: som.c:5422 +msgid "som_sizeof_headers unimplemented" +msgstr "som_sizeof_headers sin implementar" + +#: srec.c:302 +#, c-format +msgid "%s:%d: Unexpected character `%s' in S-record file\n" +msgstr "%s:%d: Caractér `%s' inesperado en el fichero S-record\n" + +#: stabs.c:319 +#, c-format +msgid "%s(%s+0x%lx): Stabs entry has invalid string index." +msgstr "%s(%s+0x%lx): La entrada de cabos tiene una cadena índice inválida." + +#: syms.c:1019 +msgid "Unsupported .stab relocation" +msgstr "Reubicación .stab sin soporte" + +#: vms-gsd.c:356 +#, c-format +msgid "bfd_make_section (%s) failed" +msgstr "bfd_make_section (%s) falló" + +#: vms-gsd.c:371 +#, c-format +msgid "bfd_set_section_flags (%s, %x) failed" +msgstr "bfd_set_section_flags (%s, %x) falló" + +#: vms-gsd.c:407 +#, c-format +msgid "Size mismatch section %s=%lx, %s=%lx" +msgstr "No coincide el tamaño de la sección %s=%lx, %s=%lx" + +#: vms-gsd.c:704 +#, c-format +msgid "unknown gsd/egsd subtype %d" +msgstr "subtipo de gsd/egsd %d desconocido" + +#: vms-hdr.c:408 +msgid "Object module NOT error-free !\n" +msgstr "¡ El módulo objeto NO está libre de errores !\n" + +#: vms-misc.c:541 +#, c-format +msgid "Stack overflow (%d) in _bfd_vms_push" +msgstr "Desbordamiento de la pila (%d) en _bfd_vms_push" + +#: vms-misc.c:559 +msgid "Stack underflow in _bfd_vms_pop" +msgstr "Desbordamiento por debajo de la pila en _bfd_vms_pop" + +#: vms-misc.c:918 +msgid "_bfd_vms_output_counted called with zero bytes" +msgstr "se llamó _bfd_vms_output_counted con cero bytes" + +#: vms-misc.c:923 +msgid "_bfd_vms_output_counted called with too many bytes" +msgstr "se llamó _bfd_vms_output_counted con demasiados bytes" + +#: vms-misc.c:1054 +#, c-format +msgid "Symbol %s replaced by %s\n" +msgstr "El símbolo %s fue reemplazado por %s\n" + +#: vms-misc.c:1117 +#, c-format +msgid "failed to enter %s" +msgstr "falló la introducción de %s" + +#: vms-tir.c:102 +msgid "No Mem !" +msgstr "¡ No hay Memoria !" + +#: vms-tir.c:383 +#, c-format +msgid "bad section index in %s" +msgstr "Índice de sección erróneo en %s" + +#: vms-tir.c:396 +#, c-format +msgid "unsupported STA cmd %s" +msgstr "orden STA %s sin soporte" + +#: vms-tir.c:401 vms-tir.c:1261 +#, c-format +msgid "reserved STA cmd %d" +msgstr "orden STA %d reservada" + +#: vms-tir.c:512 vms-tir.c:535 +#, c-format +msgid "%s: no symbol \"%s\"" +msgstr "%s: no existe el símbolo \"%s\"" + +#. unsigned shift +#. rotate +#. Redefine symbol to current location. +#. Define a literal. +#: vms-tir.c:602 vms-tir.c:714 vms-tir.c:824 vms-tir.c:842 vms-tir.c:850 +#: vms-tir.c:859 vms-tir.c:1584 +#, c-format +msgid "%s: not supported" +msgstr "%s: no tiene soporte" + +#: vms-tir.c:607 vms-tir.c:1439 +#, c-format +msgid "%s: not implemented" +msgstr "%s: sin implementar" + +#: vms-tir.c:611 vms-tir.c:1443 +#, c-format +msgid "reserved STO cmd %d" +msgstr "orden STO %d reservada" + +#: vms-tir.c:729 vms-tir.c:1589 +#, c-format +msgid "reserved OPR cmd %d" +msgstr "orden OPR %d reservada" + +#: vms-tir.c:797 vms-tir.c:1653 +#, c-format +msgid "reserved CTL cmd %d" +msgstr "orden CTL %d reservada" + +#. stack byte from image +#. arg: none. +#: vms-tir.c:1169 +msgid "stack-from-image not implemented" +msgstr "pila-desde-imagen sin implementar" + +#: vms-tir.c:1187 +msgid "stack-entry-mask not fully implemented" +msgstr "pila-máscara-entrada no está completamente implementado" + +#. compare procedure argument +#. arg: cs symbol name +#. by argument index +#. da argument descriptor +#. +#. compare argument descriptor with symbol argument (ARG$V_PASSMECH) +#. and stack TRUE (args match) or FALSE (args dont match) value. +#: vms-tir.c:1201 +msgid "PASSMECH not fully implemented" +msgstr "PASSMECH no está completamente implementado" + +#: vms-tir.c:1220 +msgid "stack-local-symbol not fully implemented" +msgstr "pila-símbolo-local no está completamente implementado" + +#: vms-tir.c:1233 +msgid "stack-literal not fully implemented" +msgstr "pila-literal no está completamente implementado" + +#: vms-tir.c:1254 +msgid "stack-local-symbol-entry-point-mask not fully implemented" +msgstr "pila-símbolo-local-máscara-punto-entrada no está completamente implementado" + +#: vms-tir.c:1531 vms-tir.c:1543 vms-tir.c:1555 vms-tir.c:1567 vms-tir.c:1632 +#: vms-tir.c:1640 vms-tir.c:1648 +#, c-format +msgid "%s: not fully implemented" +msgstr "%s: no está completamente implementado" + +#: vms-tir.c:1705 +#, c-format +msgid "obj code %d not found" +msgstr "no se encontró el código objeto %d" + +#: vms-tir.c:2043 +#, c-format +msgid "SEC_RELOC with no relocs in section %s" +msgstr "SEC_RELOC sin reubicaciones en la sección %s" + +#: vms-tir.c:2331 +#, c-format +msgid "Unhandled relocation %s" +msgstr "Reubicación %s sin manejar" + +#: xcofflink.c:1244 +#, c-format +msgid "%s: `%s' has line numbers but no enclosing section" +msgstr "%s: `%s' tiene números de línea pero no una sección contenedora" + +#: xcofflink.c:1297 +#, c-format +msgid "%s: class %d symbol `%s' has no aux entries" +msgstr "%s: clase %d símbolo `%s' no tiene entradas auxiliares" + +#: xcofflink.c:1320 +#, c-format +msgid "%s: symbol `%s' has unrecognized csect type %d" +msgstr "%s: el símbolo `%s' tiene un tipo csect %d no reconocido" + +#: xcofflink.c:1332 +#, c-format +msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d" +msgstr "%s: símbolo XTY_ER `%s' erróneo: clase %d scnum %d scnlen %d" + +#: xcofflink.c:1368 +#, c-format +msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d" +msgstr "%s: símbolo XMC_TCO `%s' es clase %d scnlen %d" + +#: xcofflink.c:1520 +#, c-format +msgid "%s: csect `%s' not in enclosing section" +msgstr "%s: csect `%s' no está contenido en una sección" + +#: xcofflink.c:1627 +#, c-format +msgid "%s: misplaced XTY_LD `%s'" +msgstr "%s: XTY_LD `%s' mal ubicado" + +#: xcofflink.c:1958 +#, c-format +msgid "%s: reloc %s:%d not in csect" +msgstr "%s: la reubicación %s:%d no está en csect" + +#: xcofflink.c:2095 +#, c-format +msgid "%s: XCOFF shared object when not producing XCOFF output" +msgstr "%s: objeto compartido XCOFF cuando no se produce salida XCOFF" + +#: xcofflink.c:2116 +#, c-format +msgid "%s: dynamic object with no .loader section" +msgstr "%s: objeto dinámico sin sección .loader" + +#: xcofflink.c:2761 +#, c-format +msgid "%s: no such symbol" +msgstr "%s: no hay tal símbolo" + +#: xcofflink.c:2894 +msgid "error: undefined symbol __rtinit" +msgstr "error: símbolo __rtinit indefinido" + +#: xcofflink.c:3455 +#, c-format +msgid "warning: attempt to export undefined symbol `%s'" +msgstr "aviso: intento de exportar el símbolo sin definir `%s'" + +#: xcofflink.c:4448 +#, c-format +msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling" +msgstr "Desbordamiento de TOC: 0x%lx > 0x10000; pruebe -mminimal-toc al compilar" + +#: xcofflink.c:5288 xcofflink.c:5755 xcofflink.c:5817 xcofflink.c:6119 +#, c-format +msgid "%s: loader reloc in unrecognized section `%s'" +msgstr "%s: reubicación del cargador en la sección `%s' no reconocida" + +#: xcofflink.c:5310 xcofflink.c:6130 +#, c-format +msgid "%s: `%s' in loader reloc but not loader sym" +msgstr "%s: `%s' en la reubicación del cargador pero no es un símbolo del cargador" + +#: xcofflink.c:5325 +#, c-format +msgid "%s: loader reloc in read-only section %s" +msgstr "%s: reubicación del cargador en la sección de sólo lectura %s" + +#: elf32-ia64.c:2392 elf64-ia64.c:2392 +msgid "@pltoff reloc against local symbol" +msgstr "reubicación @pltoff contra un símbolo local" + +#: elf32-ia64.c:3804 elf64-ia64.c:3804 +#, c-format +msgid "%s: short data segment overflowed (0x%lx >= 0x400000)" +msgstr "%s: segmento de datos short desbordado (0x%lx >= 0x400000)" + +#: elf32-ia64.c:3815 elf64-ia64.c:3815 +#, c-format +msgid "%s: __gp does not cover short data segment" +msgstr "%s: __gp no cubre el segmento de datos short" + +#: elf32-ia64.c:4131 elf64-ia64.c:4131 +#, c-format +msgid "%s: linking non-pic code in a shared library" +msgstr "%s: enlazando código que no es pic en una biblioteca compartida" + +#: elf32-ia64.c:4164 elf64-ia64.c:4164 +#, c-format +msgid "%s: @gprel relocation against dynamic symbol %s" +msgstr "%s: reubicación @gprel contra el símbolo dinámico %s" + +#: elf32-ia64.c:4224 elf64-ia64.c:4224 +#, c-format +msgid "%s: linking non-pic code in a position independent executable" +msgstr "%s: enlazando código que no es pic en un ejecutable independiente de posición" + +#: elf32-ia64.c:4363 elf64-ia64.c:4363 +#, c-format +msgid "%s: @internal branch to dynamic symbol %s" +msgstr "%s: ramificación @internal al símbolo dinámico %s" + +#: elf32-ia64.c:4365 elf64-ia64.c:4365 +#, c-format +msgid "%s: speculation fixup to dynamic symbol %s" +msgstr "%s: compostura de especulación al símbolo dinámico %s" + +#: elf32-ia64.c:4367 elf64-ia64.c:4367 +#, c-format +msgid "%s: @pcrel relocation against dynamic symbol %s" +msgstr "%s: reubicación @pcrel contra el símbolo dinámico %s" + +#: elf32-ia64.c:4579 elf64-ia64.c:4579 +msgid "unsupported reloc" +msgstr "reubicación sin soporte" + +#: elf32-ia64.c:4858 elf64-ia64.c:4858 +#, c-format +msgid "%s: linking trap-on-NULL-dereference with non-trapping files" +msgstr "%s: enlazando deferencias-captura-en-NULL con ficheros que no son de captura" + +#: elf32-ia64.c:4867 elf64-ia64.c:4867 +#, c-format +msgid "%s: linking big-endian files with little-endian files" +msgstr "%s: enlazando ficheros big endian con ficheros little endian" + +#: elf32-ia64.c:4876 elf64-ia64.c:4876 +#, c-format +msgid "%s: linking 64-bit files with 32-bit files" +msgstr "%s: enlazando ficheros de 64-bit con ficheros de 32-bit" + +#: elf32-ia64.c:4885 elf64-ia64.c:4885 +#, c-format +msgid "%s: linking constant-gp files with non-constant-gp files" +msgstr "%s: enlazando ficheros de gp constante con ficheros con gp no constante" + +#: elf32-ia64.c:4895 elf64-ia64.c:4895 +#, c-format +msgid "%s: linking auto-pic files with non-auto-pic files" +msgstr "%s: enlazando ficheros de pic automático con ficheros sin pic automático" + +#: peigen.c:985 pepigen.c:985 +#, c-format +msgid "%s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: desbordamiento de número de línea: 0x%lx > 0xffff" + +#: peigen.c:1002 pepigen.c:1002 +#, c-format +msgid "%s: reloc overflow 1: 0x%lx > 0xffff" +msgstr "%s: desbordamiento de reubicación 1: 0x%lx > 0xffff" + +#: peigen.c:1016 pepigen.c:1016 +msgid "Export Directory [.edata (or where ever we found it)]" +msgstr "Directorio de Exportación [.edata (o donde quiera que se encuentre)]" + +#: peigen.c:1017 pepigen.c:1017 +msgid "Import Directory [parts of .idata]" +msgstr "Directorio de Importación [partes de .idata]" + +#: peigen.c:1018 pepigen.c:1018 +msgid "Resource Directory [.rsrc]" +msgstr "Directorio de Recursos [.rsrc]" + +#: peigen.c:1019 pepigen.c:1019 +msgid "Exception Directory [.pdata]" +msgstr "Directorio de Excepciones [.pdata]" + +#: peigen.c:1020 pepigen.c:1020 +msgid "Security Directory" +msgstr "Directorio de Seguridad" + +#: peigen.c:1021 pepigen.c:1021 +msgid "Base Relocation Directory [.reloc]" +msgstr "Directorio de Reubicación Base [.reloc]" + +#: peigen.c:1022 pepigen.c:1022 +msgid "Debug Directory" +msgstr "Directorio de Depuración" + +#: peigen.c:1023 pepigen.c:1023 +msgid "Description Directory" +msgstr "Directorio de Descripciones" + +#: peigen.c:1024 pepigen.c:1024 +msgid "Special Directory" +msgstr "Directorio Especial" + +#: peigen.c:1025 pepigen.c:1025 +msgid "Thread Storage Directory [.tls]" +msgstr "Directorio de Almacenamiento de Hilos [.tls]" + +#: peigen.c:1026 pepigen.c:1026 +msgid "Load Configuration Directory" +msgstr "Directorio de Carga de Configuraciones" + +#: peigen.c:1027 pepigen.c:1027 +msgid "Bound Import Directory" +msgstr "Directorio de Importación de Relaciones" + +#: peigen.c:1028 pepigen.c:1028 +msgid "Import Address Table Directory" +msgstr "Directorio de Importación de Tablas de Direcciones" + +#: peigen.c:1029 pepigen.c:1029 +msgid "Delay Import Directory" +msgstr "Directorio de Retardo de Importación" + +#: peigen.c:1030 peigen.c:1031 pepigen.c:1030 pepigen.c:1031 +msgid "Reserved" +msgstr "Reservado" + +#: peigen.c:1094 pepigen.c:1094 +msgid "" +"\n" +"There is an import table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Hay una tabla de importación, pero la sección que la contiene no se puede encontrar\n" + +#: peigen.c:1099 pepigen.c:1099 +#, c-format +msgid "" +"\n" +"There is an import table in %s at 0x%lx\n" +msgstr "" +"\n" +"Hay una tabla de importación en %s en 0x%lx\n" + +#: peigen.c:1136 pepigen.c:1136 +#, c-format +msgid "" +"\n" +"Function descriptor located at the start address: %04lx\n" +msgstr "" +"\n" +"Se localizó el descriptor de función en la dirección de inicio: %04lx\n" + +#: peigen.c:1139 pepigen.c:1139 +#, c-format +msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n" +msgstr "\tcódigo-base %08lx tabla-de-contenidos (cargable/actual) %08lx/%08lx\n" + +#: peigen.c:1145 pepigen.c:1145 +msgid "" +"\n" +"No reldata section! Function descriptor not decoded.\n" +msgstr "" +"\n" +"¡No está la sección reldata! No se decodificó el descriptor de función.\n" + +#: peigen.c:1150 pepigen.c:1150 +#, c-format +msgid "" +"\n" +"The Import Tables (interpreted %s section contents)\n" +msgstr "" +"\n" +"Las Tablas de Importación (se interpretaron los contenidos de la sección %s)\n" + +#: peigen.c:1153 pepigen.c:1153 +msgid "" +" vma: Hint Time Forward DLL First\n" +" Table Stamp Chain Name Thunk\n" +msgstr "" +" vma: Pista Fecha Adelante DLL Primero\n" +" Tabla Estampa Cadena Nombre Thunk\n" + +#: peigen.c:1204 pepigen.c:1204 +#, c-format +msgid "" +"\n" +"\tDLL Name: %s\n" +msgstr "" +"\n" +"\tNombre de la DLL: %s\n" + +#: peigen.c:1215 pepigen.c:1215 +msgid "\tvma: Hint/Ord Member-Name Bound-To\n" +msgstr "\tvma: Pista/Ord Nombre-Miembro Unido-A\n" + +#: peigen.c:1240 pepigen.c:1240 +msgid "" +"\n" +"There is a first thunk, but the section containing it could not be found\n" +msgstr "" +"\n" +"Hay un thunk inicial, pero la sección que lo contiene no se puede encontrar\n" + +#: peigen.c:1380 pepigen.c:1380 +msgid "" +"\n" +"There is an export table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Hay una tabla de exportación, pero la sección que la contiene no se puede encontrar\n" + +#: peigen.c:1385 pepigen.c:1385 +#, c-format +msgid "" +"\n" +"There is an export table in %s at 0x%lx\n" +msgstr "" +"\n" +"Hay una tabla de exportación en %s en 0x%lx\n" + +#: peigen.c:1416 pepigen.c:1416 +#, c-format +msgid "" +"\n" +"The Export Tables (interpreted %s section contents)\n" +"\n" +msgstr "" +"\n" +"Las Tablas de Exportación (se interpretaron los contenidos de la sección %s)\n" +"\n" + +#: peigen.c:1420 pepigen.c:1420 +#, c-format +msgid "Export Flags \t\t\t%lx\n" +msgstr "Opciones de Exportación \t\t\t%lx\n" + +#: peigen.c:1423 pepigen.c:1423 +#, c-format +msgid "Time/Date stamp \t\t%lx\n" +msgstr "marca de Hora/Fecha \t\t%lx\n" + +#: peigen.c:1426 pepigen.c:1426 +#, c-format +msgid "Major/Minor \t\t\t%d/%d\n" +msgstr "Mayor/Menor \t\t\t%d/%d\n" + +#: peigen.c:1429 pepigen.c:1429 +msgid "Name \t\t\t\t" +msgstr "Nombre \t\t\t\t" + +#: peigen.c:1435 pepigen.c:1435 +#, c-format +msgid "Ordinal Base \t\t\t%ld\n" +msgstr "Base Ordinal \t\t\t%ld\n" + +#: peigen.c:1438 pepigen.c:1438 +msgid "Number in:\n" +msgstr "Número en:\n" + +#: peigen.c:1441 pepigen.c:1441 +#, c-format +msgid "\tExport Address Table \t\t%08lx\n" +msgstr "\tTabla de Exportación de Direcciones \t\t%08lx\n" + +#: peigen.c:1445 pepigen.c:1445 +#, c-format +msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n" +msgstr "\tTabla [Nombre Apuntador/Ordinal]\t%08lx\n" + +#: peigen.c:1448 pepigen.c:1448 +msgid "Table Addresses\n" +msgstr "Direcciones de la Tabla\n" + +#: peigen.c:1451 pepigen.c:1451 +msgid "\tExport Address Table \t\t" +msgstr "\tTabla de Exportación de Direcciones \t\t" + +#: peigen.c:1456 pepigen.c:1456 +msgid "\tName Pointer Table \t\t" +msgstr "\tNombre de la Tabla de Apuntadores \t\t" + +# continuar aqui +#: peigen.c:1461 pepigen.c:1461 +msgid "\tOrdinal Table \t\t\t" +msgstr "\tTabla Ordinal \t\t\t" + +#: peigen.c:1476 pepigen.c:1476 +#, c-format +msgid "" +"\n" +"Export Address Table -- Ordinal Base %ld\n" +msgstr "" +"\n" +"Tabla de Exportación de Direcciones -- Base Ordinal %ld\n" + +#: peigen.c:1495 pepigen.c:1495 +msgid "Forwarder RVA" +msgstr "RVA Adelantador" + +#: peigen.c:1506 pepigen.c:1506 +msgid "Export RVA" +msgstr "RVA Exportador" + +#: peigen.c:1513 pepigen.c:1513 +msgid "" +"\n" +"[Ordinal/Name Pointer] Table\n" +msgstr "" +"\n" +"Tabla [Apuntador a Ordinal/Nombre]\n" + +#: peigen.c:1568 pepigen.c:1568 +#, c-format +msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n" +msgstr "Aviso, el tamaño de la sección .pdata (%ld) no es un múltiplo de %d\n" + +#: peigen.c:1572 pepigen.c:1572 +msgid "" +"\n" +"The Function Table (interpreted .pdata section contents)\n" +msgstr "" +"\n" +"La Tabla de Funciones (se interpretaron los contenidos de la sección .pdata)\n" + +#: peigen.c:1575 pepigen.c:1575 +msgid " vma:\t\t\tBegin Address End Address Unwind Info\n" +msgstr " vma:\t\t\tDirección Inicio Dirección Fin Información Desenvuelta\n" + +#: peigen.c:1577 pepigen.c:1577 +msgid "" +" vma:\t\tBegin End EH EH PrologEnd Exception\n" +" \t\tAddress Address Handler Data Address Mask\n" +msgstr "" +" vma:\t\tInicio Fin EH EH FinPrólogo Excepción\n" +" \t\tDirecc Direcc Asa Datos Dirección Máscara\n" + +#: peigen.c:1647 pepigen.c:1647 +msgid " Register save millicode" +msgstr " Registro para guardar milicódigo" + +#: peigen.c:1650 pepigen.c:1650 +msgid " Register restore millicode" +msgstr " Registro para restaurar milicódigo" + +#: peigen.c:1653 pepigen.c:1653 +msgid " Glue code sequence" +msgstr " Secuencia de código pegamento" + +#: peigen.c:1705 pepigen.c:1705 +msgid "" +"\n" +"\n" +"PE File Base Relocations (interpreted .reloc section contents)\n" +msgstr "" +"\n" +"\n" +"Reubicaciones de Fichero Base PE (se interpretaron los contenidos de la sección .reloc)\n" + +#: peigen.c:1735 pepigen.c:1735 +#, c-format +msgid "" +"\n" +"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n" +msgstr "" +"\n" +"Dirección Virtual: %08lx Tamaño del trozo %ld (0x%lx) Número de composturas %ld\n" + +#: peigen.c:1748 pepigen.c:1748 +#, c-format +msgid "\treloc %4d offset %4x [%4lx] %s" +msgstr "\treubicación %4d desplazamiento %4x [%4lx] %s" + +#. The MS dumpbin program reportedly ands with 0xff0f before +#. printing the characteristics field. Not sure why. No reason to +#. emulate it here. +#: peigen.c:1788 pepigen.c:1788 +#, c-format +msgid "" +"\n" +"Characteristics 0x%x\n" +msgstr "" +"\n" +"Características 0x%x\n" + +#~ msgid "%s: Unknown special linker type %d" +#~ msgstr "%s: Tipo de enlazador especial %d desconocido" + +#~ msgid "v850ea architecture" +#~ msgstr "arquitectura v850ea" + +#~ msgid "%s: Section %s is too large to add hole of %ld bytes" +#~ msgstr "%s: La sección %s es muy grande para agregar un agujero de %ld bytes" + +#~ msgid "Error: out of memory" +#~ msgstr "Error: memoria agotada" + +#~ msgid "warning: relocation against removed section; zeroing" +#~ msgstr "aviso: reubicación contra una sección eliminada; cambiando a ceros" + +#~ msgid "warning: relocation against removed section" +#~ msgstr "aviso: reubicación contra una sección eliminada" + +#~ msgid "local symbols in discarded section %s" +#~ msgstr "símbolos locales en la sección descartada %s" + +#~ msgid "%s: linking abicalls files with non-abicalls files" +#~ msgstr "%s: enlazando ficheros de llamadas abi con ficheros que no son de llamadas abi" + +#~ msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)" +#~ msgstr "%s: no coincide el ISA (-mips%d) con módulos previos (-mips%d)" + +#~ msgid "%s: ISA mismatch (%d) with previous modules (%d)" +#~ msgstr "%s: no coincide el ISA (%d) con módulos previos (%d)" + +#~ msgid "%s: dynamic relocation against speculation fixup" +#~ msgstr "%s: reubicación dinámica contra una compostura de especulación" + +#~ msgid "%s: speculation fixup against undefined weak symbol" +#~ msgstr "%s: compostura de especulación contra un símbolo débil indefinido" + +#~ msgid "\tThe Import Address Table (difference found)\n" +#~ msgstr "\tLa Tabla de Importación de Direcciones (se encontró una diferencia)\n" + +#~ msgid "\t>>> Ran out of IAT members!\n" +#~ msgstr "\t>>> ¡Se terminaron los miembros IAT!\n" + +#~ msgid "\tThe Import Address Table is identical\n" +#~ msgstr "\tLa Tabla de Importación de Direcciones es idéntica\n" + +#~ msgid "GP relative relocation when GP not defined" +#~ msgstr "reubicación GP relativa cuando GP no estaba definido" + +#~ msgid "%s: ERROR: passes floats in float registers whereas target %s uses integer registers" +#~ msgstr "%s: ERROR: pasan números de coma flotante en registros de coma flotante mientras que el objetivo %s usa registros enteros" + +#~ msgid "%s: ERROR: passes floats in integer registers whereas target %s uses float registers" +#~ msgstr "%s: ERROR: pasan números de coma flotante en registros enteros mientras que el objetivo %s usa registros de coma flotante" + +#~ msgid "Warning: input file %s supports interworking, whereas %s does not." +#~ msgstr "Aviso: el fichero de entrada %s soporta interoperabilidad, mientras que %s no." + +#~ msgid "Warning: input file %s does not support interworking, whereas %s does." +#~ msgstr "Aviso: el fichero de entrada %s no soporta interoperabilidad, mientras que %s sí." + +# FIXME: Revisar en el código si son abreviaturas comunes, o corresponden a +# partes fijas dentro del programa. cfuga +#~ msgid "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld" +#~ msgstr "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld" + +#~ msgid "elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = 0x%.8lx%s\n" +#~ msgstr "elf_symbol_from_bfd_symbol 0x%.8lx, nombre = %s, núm sim = %d, opciones = 0x%.8lx%s\n" + +#~ msgid "Warning: Not setting interwork flag of %s since it has already been specified as non-interworking" +#~ msgstr "Aviso: No se activa la opción de interoperación de %s ya que ya había sido especificada como no interoperable" + +#~ msgid "Warning: Clearing the interwork flag of %s due to outside request" +#~ msgstr "Aviso: Limpiando la opción de interoperación de %s debido a una petición externa" + +#~ msgid " [APCS-26]" +#~ msgstr " [APCS-26]" + +#~ msgid " [APCS-32]" +#~ msgstr " [APCS-32]" + +#~ msgid "(unknown)" +#~ msgstr "(desconocido)" + +#~ msgid " previously %s in %s" +#~ msgstr " previamente %s en %s" + +#~ msgid "Symbol `%s' has differing types: %s in %s" +#~ msgstr "El símbolo `%s' tiene tipos diferentes: %s en %s" + +#~ msgid "ETIR_S_C_STO_GBL: no symbol \"%s\"" +#~ msgstr "ETIR_S_C_STO_GBL: no está el símbolo \"%s\"" + +#~ msgid "ETIR_S_C_STO_CA: no symbol \"%s\"" +#~ msgstr "ETIR_S_C_STO_CA: no está el símbolo \"%s\"" + +#~ msgid "ETIR_S_C_STO_RB/AB: Not supported" +#~ msgstr "ETIR_S_C_STO_RB/AB: Sin soporte" + +#~ msgid "ETIR_S_C_STO_LP_PSB: Not supported" +#~ msgstr "ETIR_S_C_STO_LP_PSB: Sin soporte" + +#~ msgid "ETIR_S_C_STO_HINT_GBL: not implemented" +#~ msgstr "ETIR_S_C_STO_HINT_GBL: sin implementar" + +#~ msgid "ETIR_S_C_STO_HINT_PS: not implemented" +#~ msgstr "ETIR_S_C_STO_HINT_PS: sin implementar" + +#~ msgid "ETIR_S_C_OPR_INSV: Not supported" +#~ msgstr "ETIR_S_C_OPR_INSV: Sin soporte" + +#~ msgid "ETIR_S_C_OPR_USH: Not supported" +#~ msgstr "ETIR_S_C_OPR_USH: Sin soporte" + +#~ msgid "ETIR_S_C_OPR_ROT: Not supported" +#~ msgstr "ETIR_S_C_OPR_ROT: Sin soporte" + +#~ msgid "ETIR_S_C_OPR_REDEF: Not supported" +#~ msgstr "ETIR_S_C_OPR_REDEF: Sin soporte" + +#~ msgid "ETIR_S_C_OPR_DFLIT: Not supported" +#~ msgstr "ETIR_S_C_OPR_DFLIT: Sin soporte" + +#~ msgid "ETIR_S_C_STC_LP: not supported" +#~ msgstr "ETIR_S_C_STC_LP: sin soporte" + +#~ msgid "ETIR_S_C_STC_GBL: not supported" +#~ msgstr "ETIR_S_C_STC_GBL: sin soporte" + +#~ msgid "ETIR_S_C_STC_GCA: not supported" +#~ msgstr "ETIR_S_C_STC_GCA: sin soporte" + +#~ msgid "ETIR_S_C_STC_PS: not supported" +#~ msgstr "ETIR_S_C_STC_PS: sin soporte" + +#~ msgid "Unimplemented STO cmd %d" +#~ msgstr "Orden STO %d sin implementar" + +#~ msgid "TIR_S_C_OPR_ASH incomplete" +#~ msgstr "TIR_S_C_OPR_ASH incompleto" + +#~ msgid "TIR_S_C_OPR_USH incomplete" +#~ msgstr "TIR_S_C_OPR_USH incompleto" + +#~ msgid "TIR_S_C_OPR_ROT incomplete" +#~ msgstr "TIR_S_C_OPR_ROT incompleto" + +#~ msgid "TIR_S_C_OPR_REDEF not supported" +#~ msgstr "TIR_S_C_OPR_REDEF sin soporte" + +#~ msgid "TIR_S_C_OPR_DFLIT not supported" +#~ msgstr "TIR_S_C_OPR_DFLIT sin soporte" + +#~ msgid "TIR_S_C_CTL_DFLOC not fully implemented" +#~ msgstr "TIR_S_C_CTL_DFLOC no está completamente implementado" + +#~ msgid "TIR_S_C_CTL_STLOC not fully implemented" +#~ msgstr "TIR_S_C_CTL_STLOC no está completamente implementado" + +#~ msgid "TIR_S_C_CTL_STKDL not fully implemented" +#~ msgstr "TIR_S_C_CTL_STKDL no está completamente implementado" + +#~ msgid " vma: Hint Time Forward DLL First\n" +#~ msgstr " vma: Pista Tiempo Adelante DLL Primero\n" + +#~ msgid " \t\tAddress Address Handler Data Address Mask\n" +#~ msgstr " \t\tDirección Dirección Manejador Datos Dirección Máscara\n" + +#~ msgid "integer" +#~ msgstr "entero" + +# FIXME: Revisar el contexto en el código para confirmar esta traducción. cfuga +#~ msgid "soft" +#~ msgstr "suave" + +#~ msgid "hard" +#~ msgstr "duro" + +#~ msgid "Warning: %s %s interworking, whereas %s %s" +#~ msgstr "Aviso: %s %s interoperatibilidad, mientras que %s %s" + +#~ msgid "supports" +#~ msgstr "tiene soporte para" + +#~ msgid "does not" +#~ msgstr "no" + +#~ msgid "does" +#~ msgstr " " + +#~ msgid "%s(%s+0x%lx): cannot find stub entry %s" +#~ msgstr "%s(%s+0x%lx): no se puede encontrar la entrada de cabo %s" + +#~ msgid "%s(%s+0x%lx): cannot relocate %s, recompile with -ffunction-sections" +#~ msgstr "%s(%s+0x%lx): no se puede reubicar %s, recompile con -ffuncion-sections" + +#~ msgid "creating section symbol, name = %s, value = 0x%.8lx, index = %d, section = 0x%.8lx\n" +#~ msgstr "creando el símbolo de sección, nombre = %s, valor = 0x%.8lx, índice = %d, sección 0x%.8lx\n" + +#~ msgid " whereas segment starts at 0x%x" +#~ msgstr " mientras que el segmento inicia en 0x%x" diff --git a/bfd/po/fr.gmo b/bfd/po/fr.gmo new file mode 100644 index 0000000000000..1a6948d5b93c8 Binary files /dev/null and b/bfd/po/fr.gmo differ diff --git a/bfd/po/fr.po b/bfd/po/fr.po new file mode 100644 index 0000000000000..c5d65f62c595a --- /dev/null +++ b/bfd/po/fr.po @@ -0,0 +1,3197 @@ +# Messages français pour GNU concernant bfd. +# Copyright © 2004 Free Software Foundation, Inc. +# Michel Robitaille , traducteur depuis/since 1996. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU bfd 2.14rel030712\n" +"POT-Creation-Date: 2003-07-11 13:53+0930\n" +"PO-Revision-Date: 2004-05-10 08:00-0500\n" +"Last-Translator: Michel Robitaille \n" +"Language-Team: French \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: aout-adobe.c:204 +#, c-format +msgid "%s: Unknown section type in a.out.adobe file: %x\n" +msgstr "%s: type de section inconnu dans le fichier a.out.adobe: %x\n" + +#: aout-cris.c:207 +#, c-format +msgid "%s: Invalid relocation type exported: %d" +msgstr "%s: relocalisation invalide du type exporté: %d" + +#: aout-cris.c:251 +#, c-format +msgid "%s: Invalid relocation type imported: %d" +msgstr "%s: relocalisation invalide du type importé: %d" + +#: aout-cris.c:262 +#, c-format +msgid "%s: Bad relocation record imported: %d" +msgstr "%s: mauvais enregistrement de relocalisation importé: %d" + +#: aoutx.h:1295 aoutx.h:1716 +#, c-format +msgid "%s: can not represent section `%s' in a.out object file format" +msgstr "%s: ne peut représenter la section « %s » dans le fichier format objet a.out" + +#: aoutx.h:1682 +#, c-format +msgid "%s: can not represent section for symbol `%s' in a.out object file format" +msgstr "%s: ne peut représenter la section pour le symbole « %s » dans le fichier format objet a.out" + +#: aoutx.h:1684 +msgid "*unknown*" +msgstr "*inconnu*" + +#: aoutx.h:3776 +#, c-format +msgid "%s: relocatable link from %s to %s not supported" +msgstr "%s: lien relocalisable de %s vers %s n'est pas supporté" + +#: archive.c:1751 +msgid "Warning: writing archive was slow: rewriting timestamp\n" +msgstr "AVERTISSEMENT: l'écriture de l'archive était lente: réécriture du cachet de date-heure\n" + +#: archive.c:2014 +msgid "Reading archive file mod timestamp" +msgstr "Lecture du cachet date-heure modifé du fichier d'archive" + +#: archive.c:2040 +msgid "Writing updated armap timestamp" +msgstr "Écriture du cachet date-heure armap mise à jour" + +#: bfd.c:280 +msgid "No error" +msgstr "Pas d'erreur" + +#: bfd.c:281 +msgid "System call error" +msgstr "Erreur d'appel système" + +#: bfd.c:282 +msgid "Invalid bfd target" +msgstr "cible bfd invalide" + +#: bfd.c:283 +msgid "File in wrong format" +msgstr "Fichier dans un mauvais format" + +#: bfd.c:284 +msgid "Archive object file in wrong format" +msgstr "Fichier objet d'archive dans un mauvais format" + +#: bfd.c:285 +msgid "Invalid operation" +msgstr "Opération invalide" + +#: bfd.c:286 +msgid "Memory exhausted" +msgstr "Mémoire épuisée" + +#: bfd.c:287 +msgid "No symbols" +msgstr "Aucun symbole" + +#: bfd.c:288 +msgid "Archive has no index; run ranlib to add one" +msgstr "L'archive n'a pas d'index; exécuter ranlib pour en ajouter un" + +#: bfd.c:289 +msgid "No more archived files" +msgstr "Aucun autre fichier d'archive" + +#: bfd.c:290 +msgid "Malformed archive" +msgstr "Archive mal formé" + +#: bfd.c:291 +msgid "File format not recognized" +msgstr "Format de fichier non reconnu" + +#: bfd.c:292 +msgid "File format is ambiguous" +msgstr "Format de fichier ambiguë" + +#: bfd.c:293 +msgid "Section has no contents" +msgstr "Section sans contenu" + +#: bfd.c:294 +msgid "Nonrepresentable section on output" +msgstr "Section non-représentable pour la sortie" + +#: bfd.c:295 +msgid "Symbol needs debug section which does not exist" +msgstr "Symboles ont besoin de la section de débug qui est inexistente" + +#: bfd.c:296 +msgid "Bad value" +msgstr "Mauvaise valeur" + +#: bfd.c:297 +msgid "File truncated" +msgstr "Fichier tronqué" + +#: bfd.c:298 +msgid "File too big" +msgstr "Fichier trop gros" + +#: bfd.c:299 +msgid "#" +msgstr "#" + +#: bfd.c:687 +#, c-format +msgid "BFD %s assertion fail %s:%d" +msgstr "BFD assertion %s a échoué %s:%d" + +#: bfd.c:703 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d in %s\n" +msgstr "BFD erreur interne %s, abandon à %s, ligne %d dans %s\n" + +#: bfd.c:707 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d\n" +msgstr "BFD erreur interne %s, abandon à %s, ligne %d\n" + +#: bfd.c:709 +msgid "Please report this bug.\n" +msgstr "SVP rapporter cette anomalie.\n" + +#: bfdwin.c:202 +#, c-format +msgid "not mapping: data=%lx mapped=%d\n" +msgstr "pas de table de projection: données=%lx adresse de la table=%d\n" + +#: bfdwin.c:205 +msgid "not mapping: env var not set\n" +msgstr "pas de table de projection: variable d'environnement pas initialisée\n" + +#: binary.c:306 +#, c-format +msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx." +msgstr "AVERTISSEMENT: écriture de la section « %s » vers un énorme décalage (ie négatif) dans le fichier 0x%lx." + +#: coff-a29k.c:120 +msgid "Missing IHCONST" +msgstr "IHCONST manquant" + +#: coff-a29k.c:181 +msgid "Missing IHIHALF" +msgstr "IHIHALF manquant" + +#: coff-a29k.c:213 coff-or32.c:236 +msgid "Unrecognized reloc" +msgstr "Relocalisation non reconnue" + +#: coff-a29k.c:409 +msgid "missing IHCONST reloc" +msgstr "IHCONST de relocalisation manquant" + +#: coff-a29k.c:499 +msgid "missing IHIHALF reloc" +msgstr "IHIHALF de relocalisation manquant" + +#: coff-alpha.c:884 coff-alpha.c:921 coff-alpha.c:1992 coff-mips.c:1397 +msgid "GP relative relocation used when GP not defined" +msgstr "Relocalisation relative GP utilisé alors que GP n'est pas défini" + +#: coff-alpha.c:1488 +msgid "using multiple gp values" +msgstr "utilisation de valeurs multiples gp" + +#: coff-arm.c:1066 elf32-arm.h:294 +#, c-format +msgid "%s: unable to find THUMB glue '%s' for `%s'" +msgstr "%s: incapable de repérer le REPÈRE de liant « %s » pour « %s »" + +#: coff-arm.c:1096 elf32-arm.h:329 +#, c-format +msgid "%s: unable to find ARM glue '%s' for `%s'" +msgstr "%s: incapable de repérer le liant ARM « %s » pour « %s »" + +#: coff-arm.c:1394 coff-arm.c:1489 elf32-arm.h:892 elf32-arm.h:999 +#, c-format +msgid "%s(%s): warning: interworking not enabled." +msgstr "%s(%s): AVERTISSEMENT: l'inter-réseautage n'est pas permis." + +#: coff-arm.c:1398 elf32-arm.h:1002 +#, c-format +msgid " first occurrence: %s: arm call to thumb" +msgstr " première occurrence: %s: appel arm de repérage" + +#: coff-arm.c:1493 elf32-arm.h:895 +#, c-format +msgid " first occurrence: %s: thumb call to arm" +msgstr " première occurrence: %s: appel de repérage à ARM" + +#: coff-arm.c:1496 +msgid " consider relinking with --support-old-code enabled" +msgstr " considérer de rafaire les liens avec --support-old-code enabled" + +#: coff-arm.c:1788 coff-tic80.c:687 cofflink.c:3038 +#, c-format +msgid "%s: bad reloc address 0x%lx in section `%s'" +msgstr "%s: mauvaise adresse de relocalisation 0x%lx dans la section « %s »" + +#: coff-arm.c:2132 +#, c-format +msgid "%s: illegal symbol index in reloc: %d" +msgstr "%s: symbole index illégal dans la relocalisation: %d" + +#: coff-arm.c:2265 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d" +msgstr "Erreur: %s compilé pour APCS-%d alors que %s a été compilé pour APCS-%d" + +#: coff-arm.c:2280 elf32-arm.h:2328 +#, c-format +msgid "ERROR: %s passes floats in float registers, whereas %s passes them in integer registers" +msgstr "Erreur: %s passage de valeurs en virgule flottante dans les registres FP alors que %s les passe dans les registres entiers" + +#: coff-arm.c:2283 elf32-arm.h:2333 +#, c-format +msgid "ERROR: %s passes floats in integer registers, whereas %s passes them in float registers" +msgstr "Erreur: %s passage de valeurs en virgule flottante dans les registres entiers alors que %s les passe dans les registres FP" + +#: coff-arm.c:2298 +#, c-format +msgid "ERROR: %s is compiled as position independent code, whereas target %s is absolute position" +msgstr "ERREUR: %s compilé avec du code à position indépendante alors que la cible %s est à position absolue" + +#: coff-arm.c:2301 +#, c-format +msgid "ERROR: %s is compiled as absolute position code, whereas target %s is position independent" +msgstr "ERREUR: %s compilé avec du code à position absolu alors que la cible %s est à position indépendante" + +#: coff-arm.c:2330 elf32-arm.h:2405 +#, c-format +msgid "Warning: %s supports interworking, whereas %s does not" +msgstr "AVERTISSEMENT: %s supporte l'inter-réseautage, contrairement à %s." + +#: coff-arm.c:2333 elf32-arm.h:2412 +#, c-format +msgid "Warning: %s does not support interworking, whereas %s does" +msgstr "AVERTISSEMENT: %s ne supporte pas l'inter-réseautage, contrairement à %s." + +#: coff-arm.c:2360 +#, c-format +msgid "private flags = %x:" +msgstr "fanions privés = %x" + +#: coff-arm.c:2368 elf32-arm.h:2467 +msgid " [floats passed in float registers]" +msgstr " [valeurs en virgule flottante passées dans des registres de valeurs en virgule flottante]" + +#: coff-arm.c:2370 +msgid " [floats passed in integer registers]" +msgstr " [valeurs en virgule flottante passées dans des registres de valeurs entières]" + +#: coff-arm.c:2373 elf32-arm.h:2470 +msgid " [position independent]" +msgstr " [position indépendante]" + +#: coff-arm.c:2375 +msgid " [absolute position]" +msgstr " [position absolue]" + +#: coff-arm.c:2379 +msgid " [interworking flag not initialised]" +msgstr " [fanion d'inter-réseautage n'a pas été initialisé]" + +#: coff-arm.c:2381 +msgid " [interworking supported]" +msgstr " [inter-réseautage supporté]" + +#: coff-arm.c:2383 +msgid " [interworking not supported]" +msgstr " [inter-réseautage non supporté]" + +#: coff-arm.c:2431 elf32-arm.h:2150 +#, c-format +msgid "Warning: Not setting interworking flag of %s since it has already been specified as non-interworking" +msgstr "AVERTISSEMENT: pas d'initialisation du fanion d'inter-réseautage %s puisqu'il a déjà été spécifié sans inter-réseautage" + +#: coff-arm.c:2435 elf32-arm.h:2154 +#, c-format +msgid "Warning: Clearing the interworking flag of %s due to outside request" +msgstr "AVERTISSEMENT: mise à zéro du fanion d'inter-réseautage %s en raison d'une requête externe" + +#: coff-h8300.c:1096 +#, c-format +msgid "cannot handle R_MEM_INDIRECT reloc when using %s output" +msgstr "ne peut traiter la relocalisation R_MEM_INDIRECT lorsque %s est utilisé en sortie" + +#: coff-i960.c:137 coff-i960.c:486 +msgid "uncertain calling convention for non-COFF symbol" +msgstr "convention d'appel incertaine pour un symbole non COFF" + +#: coff-m68k.c:482 coff-mips.c:2394 elf32-m68k.c:2193 elf32-mips.c:1783 +msgid "unsupported reloc type" +msgstr "type de relocalisation non supporté" + +#: coff-mips.c:839 elf32-mips.c:1088 elf64-mips.c:1590 elfn32-mips.c:1554 +msgid "GP relative relocation when _gp not defined" +msgstr "relocalisation relative GP sans que _gp ne soit défini" + +#. No other sections should appear in -membedded-pic +#. code. +#: coff-mips.c:2431 +msgid "reloc against unsupported section" +msgstr "relocalisation vers une section non supportée" + +#: coff-mips.c:2439 +msgid "reloc not properly aligned" +msgstr "relocalisation n'est pas alignée correctement" + +#: coff-rs6000.c:2790 +#, c-format +msgid "%s: unsupported relocation type 0x%02x" +msgstr "%s: type de relocalisation non supporté 0x%02x" + +#: coff-rs6000.c:2883 +#, c-format +msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry" +msgstr "%s: table des matières des relocalisation à 0x%x pour les symboles « %s » sans aucune entrée" + +#: coff-rs6000.c:3616 coff64-rs6000.c:2109 +#, c-format +msgid "%s: symbol `%s' has unrecognized smclas %d" +msgstr "%s: symbole « %s » a une classe smclas non reconnue %d" + +#: coff-tic4x.c:170 coff-tic54x.c:288 coff-tic80.c:450 +#, c-format +msgid "Unrecognized reloc type 0x%x" +msgstr "Type de relocalisation non reconnu 0x%x" + +#: coff-tic4x.c:218 coff-tic54x.c:373 coffcode.h:5045 +#, c-format +msgid "%s: warning: illegal symbol index %ld in relocs" +msgstr "%s: AVERTISSEMENT: symbole index illégal %ld dans les relocalisations" + +#: coff-w65.c:364 +#, c-format +msgid "ignoring reloc %s\n" +msgstr "relocalisation de %s ignorée\n" + +#: coffcode.h:1108 +#, c-format +msgid "%s (%s): Section flag %s (0x%x) ignored" +msgstr "%s (%s): fanion de section %s (0x%x) ignoré" + +#: coffcode.h:2214 +#, c-format +msgid "Unrecognized TI COFF target id '0x%x'" +msgstr "cible TI COFF non reconnue identificateur '0x%x'" + +#: coffcode.h:4437 +#, c-format +msgid "%s: warning: illegal symbol index %ld in line numbers" +msgstr "%s: AVERTISSEMENT: symbole d'index illégal %ld dans le numéro de ligne" + +#: coffcode.h:4451 +#, c-format +msgid "%s: warning: duplicate line number information for `%s'" +msgstr "%s: AVERTISSEMENT: information de numéro de ligne dédoublée pour « %s »" + +#: coffcode.h:4805 +#, c-format +msgid "%s: Unrecognized storage class %d for %s symbol `%s'" +msgstr "%s: classe de stockage non reconnue %d pour %s symbole « %s »" + +#: coffcode.h:4938 +#, c-format +msgid "warning: %s: local symbol `%s' has no section" +msgstr "AVERTISSEMENT: %s: symbole local « %s » n'a pas de section" + +#: coffcode.h:5083 +#, c-format +msgid "%s: illegal relocation type %d at address 0x%lx" +msgstr "%s: type de relocalisation illégal %d à l'adresse 0x%lx" + +#: coffgen.c:1666 +#, c-format +msgid "%s: bad string table size %lu" +msgstr "%s: chaîne erronée de la taille de table %lu" + +#: cofflink.c:538 elflink.h:1276 +#, c-format +msgid "Warning: type of symbol `%s' changed from %d to %d in %s" +msgstr "AVERTISSEMENT: type de symbole « %s » a changé de %d à %d dans %s" + +#: cofflink.c:2328 +#, c-format +msgid "%s: relocs in section `%s', but it has no contents" +msgstr "%s: relocalisations dans la section « %s », mais n'a aucun contenu" + +#: cofflink.c:2671 coffswap.h:890 +#, c-format +msgid "%s: %s: reloc overflow: 0x%lx > 0xffff" +msgstr "%s: %s: débordement de relocalisation: 0x%lx > 0xffff" + +#: cofflink.c:2680 coffswap.h:876 +#, c-format +msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: AVERTISSEMENT: %s: débordement du compteur de numéro de ligne: 0x%lx > 0xffff" + +#: cpu-arm.c:196 cpu-arm.c:206 +#, c-format +msgid "ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale" +msgstr "ERREUR: %s compilé pour EP9312 alors que %s a été compilé pour XScale" + +#: cpu-arm.c:344 +#, c-format +msgid "warning: unable to update contents of %s section in %s" +msgstr "AVERTISSEMENT: incapable de mettre à jour le contenu de la section %s dans %s" + +#: dwarf2.c:380 +msgid "Dwarf Error: Can't find .debug_str section." +msgstr "Erreur DWARF: ne peut repérer la section .debug_str" + +#: dwarf2.c:397 +#, c-format +msgid "Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str size (%lu)." +msgstr "Erreur DWARF: décalage DW_FORM_strp (%lu) est >= à la taille de .debug_str (%lu)." + +#: dwarf2.c:541 +msgid "Dwarf Error: Can't find .debug_abbrev section." +msgstr "Erreur DWARF: ne peut repérer la section .debug_abbrev" + +#: dwarf2.c:556 +#, c-format +msgid "Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size (%lu)." +msgstr "Erreur DWARF: décalage Abbrev (%lu) est >= à la taille .debug_abbrev (%lu)." + +#: dwarf2.c:756 +#, c-format +msgid "Dwarf Error: Invalid or unhandled FORM value: %u." +msgstr "Erreur DWARF: valeur de FORME invalide ou mal traitée: %u" + +#: dwarf2.c:933 +msgid "Dwarf Error: mangled line number section (bad file number)." +msgstr "Erreur DWARF: numéro mutilé de ligne de section (mauvais no. de fichier)" + +#: dwarf2.c:1032 +msgid "Dwarf Error: Can't find .debug_line section." +msgstr "Erreur DWARF: ne peut repérer la section .debug_line" + +#: dwarf2.c:1049 +#, c-format +msgid "Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)." +msgstr "Erreur DWARF: décalage de ligne (%lu) est >= à la taille de .debug_line (%lu)" + +#: dwarf2.c:1255 +msgid "Dwarf Error: mangled line number section." +msgstr "Erreur DWARF: numéro mutilé de ligne de section" + +#: dwarf2.c:1470 dwarf2.c:1620 +#, c-format +msgid "Dwarf Error: Could not find abbrev number %u." +msgstr "Erreur DWARF: ne peut repérer le numéro abrégé %u" + +#: dwarf2.c:1581 +#, c-format +msgid "Dwarf Error: found dwarf version '%u', this reader only handles version 2 information." +msgstr "Erreur DWARF: version DWARF retrouvée « %u », ce lecteur ne supporte que les informations de la version 2." + +#: dwarf2.c:1588 +#, c-format +msgid "Dwarf Error: found address size '%u', this reader can not handle sizes greater than '%u'." +msgstr "Erreur DWARF: taille d'adresse obtenue « %u », ce lecteur ne peut traiter des tailles plus grandes que « %u »." + +#: dwarf2.c:1611 +#, c-format +msgid "Dwarf Error: Bad abbrev number: %u." +msgstr "Erreur DWARF: mauvais numéro abrégé: %u" + +#: ecoff.c:1339 +#, c-format +msgid "Unknown basic type %d" +msgstr "type de base inconnu %d" + +#: ecoff.c:1599 +#, c-format +msgid "" +"\n" +" End+1 symbol: %ld" +msgstr "" +"\n" +" Dernier+1 symbole: %ld" + +#: ecoff.c:1606 ecoff.c:1609 +#, c-format +msgid "" +"\n" +" First symbol: %ld" +msgstr "" +"\n" +" Premier symbole: %ld" + +#: ecoff.c:1621 +#, c-format +msgid "" +"\n" +" End+1 symbol: %-7ld Type: %s" +msgstr "" +"\n" +" Dernier+1 symbole: %-7ld Type: %s" + +#: ecoff.c:1628 +#, c-format +msgid "" +"\n" +" Local symbol: %ld" +msgstr "" +"\n" +" Symbole local: %ld" + +#: ecoff.c:1636 +#, c-format +msgid "" +"\n" +" struct; End+1 symbol: %ld" +msgstr "" +"\n" +" struct; Symbole Fin+1: %ld" + +#: ecoff.c:1641 +#, c-format +msgid "" +"\n" +" union; End+1 symbol: %ld" +msgstr "" +"\n" +" union; Dernier+1 symbole: %ld" + +#: ecoff.c:1646 +#, c-format +msgid "" +"\n" +" enum; End+1 symbol: %ld" +msgstr "" +"\n" +" enum; Dernier+1 symbol: %ld" + +#: ecoff.c:1652 +#, c-format +msgid "" +"\n" +" Type: %s" +msgstr "" +"\n" +" Type: %s" + +#: elf-hppa.h:1458 elf-hppa.h:1491 elf-m10300.c:1628 elf64-sh64.c:1704 +#, c-format +msgid "%s: warning: unresolvable relocation against symbol `%s' from %s section" +msgstr "%s: AVERTISSEMENT: relocalisation sans solution vers le symbole « %s » de la section %s" + +#: elf-m10200.c:442 elf-m10300.c:1695 elf32-arm.h:2088 elf32-avr.c:812 +#: elf32-cris.c:1390 elf32-d10v.c:570 elf32-fr30.c:634 elf32-frv.c:815 +#: elf32-h8300.c:528 elf32-i860.c:1028 elf32-ip2k.c:1586 elf32-iq2000.c:699 +#: elf32-m32r.c:1283 elf32-m68hc1x.c:1305 elf32-msp430.c:510 +#: elf32-openrisc.c:436 elf32-v850.c:1777 elf32-xstormy16.c:976 +#: elf64-mmix.c:1332 +msgid "internal error: out of range error" +msgstr "erreur interne: hors limite" + +#: elf-m10200.c:446 elf-m10300.c:1699 elf32-arm.h:2092 elf32-avr.c:816 +#: elf32-cris.c:1394 elf32-d10v.c:574 elf32-fr30.c:638 elf32-frv.c:819 +#: elf32-h8300.c:532 elf32-i860.c:1032 elf32-iq2000.c:703 elf32-m32r.c:1287 +#: elf32-m68hc1x.c:1309 elf32-msp430.c:514 elf32-openrisc.c:440 +#: elf32-v850.c:1781 elf32-xstormy16.c:980 elf64-mmix.c:1336 elfxx-mips.c:6452 +msgid "internal error: unsupported relocation error" +msgstr "erreur interne: erreur de relocalisation non supportée" + +#: elf-m10200.c:450 elf-m10300.c:1703 elf32-arm.h:2096 elf32-d10v.c:578 +#: elf32-h8300.c:536 elf32-m32r.c:1291 elf32-m68hc1x.c:1313 +msgid "internal error: dangerous error" +msgstr "erreur interne: erreur dangereuse" + +#: elf-m10200.c:454 elf-m10300.c:1707 elf32-arm.h:2100 elf32-avr.c:824 +#: elf32-cris.c:1402 elf32-d10v.c:582 elf32-fr30.c:646 elf32-frv.c:827 +#: elf32-h8300.c:540 elf32-i860.c:1040 elf32-ip2k.c:1601 elf32-iq2000.c:711 +#: elf32-m32r.c:1295 elf32-m68hc1x.c:1317 elf32-msp430.c:522 +#: elf32-openrisc.c:448 elf32-v850.c:1801 elf32-xstormy16.c:988 +#: elf64-mmix.c:1344 +msgid "internal error: unknown error" +msgstr "erreur interne: erreur inconnue" + +#: elf.c:372 +#, c-format +msgid "%s: invalid string offset %u >= %lu for section `%s'" +msgstr "%s: chaîne de décalage invalide %u >= %lu pour la section « %s »" + +#: elf.c:624 +#, c-format +msgid "%s: invalid SHT_GROUP entry" +msgstr "%s: entrée SHT_GROUP invalide" + +#: elf.c:695 +#, c-format +msgid "%s: no group info for section %s" +msgstr "%s: aucune info de groupe pour la section %s" + +#: elf.c:1055 +msgid "" +"\n" +"Program Header:\n" +msgstr "" +"\n" +"En-tête de programme:\n" + +#: elf.c:1106 +msgid "" +"\n" +"Dynamic Section:\n" +msgstr "" +"\n" +"Section dynamique:\n" + +#: elf.c:1235 +msgid "" +"\n" +"Version definitions:\n" +msgstr "" +"\n" +"Définitions des versions:\n" + +#: elf.c:1258 +msgid "" +"\n" +"Version References:\n" +msgstr "" +"\n" +"Références de version:\n" + +#: elf.c:1263 +#, c-format +msgid " required from %s:\n" +msgstr " requis par %s:\n" + +#: elf.c:1944 +#, c-format +msgid "%s: invalid link %lu for reloc section %s (index %u)" +msgstr "%s: lien invalide %lu pour la section de relocalisation %s (index %u)" + +#: elf.c:3686 +#, c-format +msgid "%s: Not enough room for program headers (allocated %u, need %u)" +msgstr "%s: pas suffisamment d'espace pour les en-têtes du programme (alloué %u, besoin de %u)" + +#: elf.c:3791 +#, c-format +msgid "%s: Not enough room for program headers, try linking with -N" +msgstr "%s: pas suffisamment d'espace pour les en-têtes du programme, essayer l'option -N" + +#: elf.c:3922 +#, c-format +msgid "Error: First section in segment (%s) starts at 0x%x whereas the segment starts at 0x%x" +msgstr "Erreur: première section dans le segment (%s) débute à 0x%x alors que le segment débute à 0x%x" + +#: elf.c:4242 +#, c-format +msgid "%s: warning: allocated section `%s' not in segment" +msgstr "%s: AVERTISSEMENT: section allouée « %s » n'est pas dans le segment" + +#: elf.c:4566 +#, c-format +msgid "%s: symbol `%s' required but not present" +msgstr "%s: symbole « %s » requis mais absent" + +#: elf.c:4854 +#, c-format +msgid "%s: warning: Empty loadable segment detected, is this intentional ?\n" +msgstr "%s: AVERTISSEMENT: segment chargeable vide détecté, est-ce intentionnel ?\n" + +#: elf.c:5485 +#, c-format +msgid "Unable to find equivalent output section for symbol '%s' from section '%s'" +msgstr "Incapable de trouver un équivalent pour le symbole « %s » de la section « %s »" + +#: elf.c:6298 +#, c-format +msgid "%s: unsupported relocation type %s" +msgstr "%s: type de relocalisation non supporté %s" + +#: elf32-arm.h:1228 +#, c-format +msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'." +msgstr "%s: AVERTISSEMENT: instruction Arm BLX vise la fonction Arm « %s »." + +#: elf32-arm.h:1424 +#, c-format +msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'." +msgstr "%s: AVERTISSEMENT: instruction de repérage BLX vise la function de repérage « %s »." + +#: elf32-arm.h:1918 elf32-sh.c:4706 elf64-sh64.c:1613 +#, c-format +msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section" +msgstr "%s(%s+0x%lx): %s relocation vers une section SEC_MERGE" + +#: elf32-arm.h:2012 +#, c-format +msgid "%s: warning: unresolvable relocation %d against symbol `%s' from %s section" +msgstr "%s: AVERTISSEMENT: relocalisation sans solution %d vers le symbole « %s » de la section %s" + +#: elf32-arm.h:2202 +#, c-format +msgid "Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it" +msgstr "AVERTISSEMENT: mise à zéro du fanion d'inter-réseautage %s en raison du code sans inter-réseautage dans %s lié avec lui" + +#: elf32-arm.h:2302 +#, c-format +msgid "ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d" +msgstr "ERREUR: %s compilé pour une version EABI %d alors que %s a été compilé pour la version %d" + +#: elf32-arm.h:2316 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d" +msgstr "ERREUR: %s compilé pour APCS-%d alors que la cible %s utilise APCS-%d" + +#: elf32-arm.h:2344 +#, c-format +msgid "ERROR: %s uses VFP instructions, whereas %s does not" +msgstr "ERREUR: %s utilise les instructions VFP alors que %s ne les utilise pas" + +#: elf32-arm.h:2349 +#, c-format +msgid "ERROR: %s uses FPA instructions, whereas %s does not" +msgstr "ERREUR: %s utilise les instructions FPA alors que %s ne les utilise pas" + +#: elf32-arm.h:2360 elf32-arm.h:2365 +#, c-format +msgid "ERROR: %s uses Maverick instructions, whereas %s does not" +msgstr "ERREUR: %s utilise les instructions Maverick alors que %s ne les utilise pas" + +#: elf32-arm.h:2385 +#, c-format +msgid "ERROR: %s uses software FP, whereas %s uses hardware FP" +msgstr "ERREUR: %s utilise le logiciel pour virgule flottante alors que %s utilise le matériel pour virgule flottante" + +#: elf32-arm.h:2390 +#, c-format +msgid "ERROR: %s uses hardware FP, whereas %s uses software FP" +msgstr "ERREUR: %s utilise le matériel pour virgule flottante alors que %s utilise le logiciel pour virgule flottante" + +#. Ignore init flag - it may not be set, despite the flags field +#. containing valid data. +#: elf32-arm.h:2443 elf32-cris.c:2975 elf32-m68hc1x.c:1459 elf32-m68k.c:397 +#: elf32-vax.c:546 elfxx-mips.c:9238 +#, c-format +msgid "private flags = %lx:" +msgstr "fanions privés = %lx" + +#: elf32-arm.h:2452 +msgid " [interworking enabled]" +msgstr " [inter-réseautage autorisé]" + +#: elf32-arm.h:2460 +msgid " [VFP float format]" +msgstr " [format flottant VFP]" + +#: elf32-arm.h:2462 +msgid " [Maverick float format]" +msgstr " [format flottant Maverick]" + +#: elf32-arm.h:2464 +msgid " [FPA float format]" +msgstr " [format flottant FPA]" + +#: elf32-arm.h:2473 +msgid " [new ABI]" +msgstr " [nouvel ABI]" + +#: elf32-arm.h:2476 +msgid " [old ABI]" +msgstr " [ancien ABI]" + +#: elf32-arm.h:2479 +msgid " [software FP]" +msgstr " [virgule flottante logiciel]" + +#: elf32-arm.h:2488 +msgid " [Version1 EABI]" +msgstr " [Version 1 EABI]" + +#: elf32-arm.h:2491 elf32-arm.h:2502 +msgid " [sorted symbol table]" +msgstr " [table des symboles triés]" + +#: elf32-arm.h:2493 elf32-arm.h:2504 +msgid " [unsorted symbol table]" +msgstr " [table des symboles non triés]" + +#: elf32-arm.h:2499 +msgid " [Version2 EABI]" +msgstr " [Version2 EABI]" + +#: elf32-arm.h:2507 +msgid " [dynamic symbols use segment index]" +msgstr " [symboles dynamiques utilisent un index de segment]" + +#: elf32-arm.h:2510 +msgid " [mapping symbols precede others]" +msgstr " [mapping de symboles précèdes les autres]" + +#: elf32-arm.h:2517 +msgid " " +msgstr " " + +#: elf32-arm.h:2524 +msgid " [relocatable executable]" +msgstr " [exécutables relocalisés]" + +#: elf32-arm.h:2527 +msgid " [has entry point]" +msgstr " [a des points d'entrées]" + +#: elf32-arm.h:2532 +msgid "" +msgstr "" + +#: elf32-avr.c:820 elf32-cris.c:1398 elf32-fr30.c:642 elf32-frv.c:823 +#: elf32-i860.c:1036 elf32-ip2k.c:1597 elf32-iq2000.c:707 elf32-msp430.c:518 +#: elf32-openrisc.c:444 elf32-v850.c:1785 elf32-xstormy16.c:984 +#: elf64-mmix.c:1340 +msgid "internal error: dangerous relocation" +msgstr "erreur interne: relocalisation dangereuse" + +#: elf32-cris.c:931 +#, c-format +msgid "%s: unresolvable relocation %s against symbol `%s' from %s section" +msgstr "%s: relocalisation %s sans solution vers le symbole « %s » à partir de la section %s" + +#: elf32-cris.c:993 +#, c-format +msgid "%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section" +msgstr "%s: pas de relocalisation %s PLT ni GOT vers le symbole « %s » à partir de la section %s" + +#: elf32-cris.c:996 elf32-cris.c:1122 +msgid "[whose name is lost]" +msgstr "[où le nom est perdu]" + +#: elf32-cris.c:1111 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against local symbol from %s section" +msgstr "%s: relocalisation %s sans zéro ajoute %d vers le symbole local à partir de la section %s" + +#: elf32-cris.c:1118 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against symbol `%s' from %s section" +msgstr "%s: relocalisation %s sans zéro ajoute %d vers le symbole « %s » à partir de la section %s" + +#: elf32-cris.c:1143 +#, c-format +msgid "%s: relocation %s is not allowed for global symbol: `%s' from %s section" +msgstr "%s: relocalisation %s n'est pas permise pour le symbole global: « %s » de la section %s." + +#: elf32-cris.c:1158 +#, c-format +msgid "%s: relocation %s in section %s with no GOT created" +msgstr "%s: relocalisation %s dans la section %s mais aucun GOT créé" + +#: elf32-cris.c:1277 +#, c-format +msgid "%s: Internal inconsistency; no relocation section %s" +msgstr "%s: inconsistence interne; pas de section de relocalisation %s" + +#: elf32-cris.c:2500 +#, c-format +msgid "" +"%s, section %s:\n" +" relocation %s should not be used in a shared object; recompile with -fPIC" +msgstr "" +"%s, section %s:\n" +" relocalisation %s devrait être utilisée dans un objet partagé; recompiler avec -fPIC" + +#: elf32-cris.c:2978 +msgid " [symbols have a _ prefix]" +msgstr " [symboles sont préfixés par « _ »]" + +#: elf32-cris.c:3017 +#, c-format +msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols" +msgstr "%s: utilise _-prefixed symbols, mais avec écriture au fichier avec des symboles sans préfixes" + +#: elf32-cris.c:3018 +#, c-format +msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols" +msgstr "%s: utilise des symboles sans préfixes, mais avec écriture au fichier avec des symboles ayant des préfixes_-prefixed" + +#: elf32-frv.c:1223 +#, c-format +msgid "%s: compiled with %s and linked with modules that use non-pic relocations" +msgstr "%s: compilé avec %s et lié avec les modules qui utilisent de la relocalisation non PIC" + +#: elf32-frv.c:1273 elf32-iq2000.c:895 +#, c-format +msgid "%s: compiled with %s and linked with modules compiled with %s" +msgstr "%s: compilé avec %s et lié avec les modules compilés avec %s" + +#: elf32-frv.c:1285 +#, c-format +msgid "%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%s: utilise différents champs e_flags (0x%lx) que les modules précédents (0x%lx)" + +#: elf32-frv.c:1321 elf32-iq2000.c:933 +#, c-format +msgid "private flags = 0x%lx:" +msgstr "fanions privés = 0x%lx:" + +#: elf32-gen.c:83 elf64-gen.c:82 +#, c-format +msgid "%s: Relocations in generic ELF (EM: %d)" +msgstr "%s: relocalisation en format ELF générique (EM: %d)" + +#: elf32-hppa.c:672 elf32-m68hc1x.c:176 elf64-ppc.c:3118 +#, c-format +msgid "%s: cannot create stub entry %s" +msgstr "%s: ne peut créer l'entrée du talon %s" + +#: elf32-hppa.c:957 elf32-hppa.c:3538 +#, c-format +msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections" +msgstr "%s(%s+0x%lx): ne peut atteindre %s, recompiler avec -ffunction-sections" + +#: elf32-hppa.c:1340 elf64-x86-64.c:672 elf64-x86-64.c:797 +#, c-format +msgid "%s: relocation %s can not be used when making a shared object; recompile with -fPIC" +msgstr "%s: relocalisation de %s ne peut être utilisée lors de la création d'un objet partagé; recompiler avec -fPIC" + +#: elf32-hppa.c:1360 +#, c-format +msgid "%s: relocation %s should not be used when making a shared object; recompile with -fPIC" +msgstr "%s: relocalisation %s ne doit pas être utilisée lors de la création d'un objet partagé; recompiler avec -fPIC" + +#: elf32-hppa.c:1553 +#, c-format +msgid "Could not find relocation section for %s" +msgstr "Ne peut repérer la section de relocalisation pour %s" + +#: elf32-hppa.c:2828 +#, c-format +msgid "%s: duplicate export stub %s" +msgstr "%s: talon d'exportation en double %s" + +#: elf32-hppa.c:3416 +#, c-format +msgid "%s(%s+0x%lx): fixing %s" +msgstr "%s(%s+0x%lx): corrigeant %s" + +#: elf32-hppa.c:4039 +#, c-format +msgid "%s(%s+0x%lx): cannot handle %s for %s" +msgstr "%s(%s+0x%lx): ne traiter %s pour %s" + +#: elf32-hppa.c:4357 +msgid ".got section not immediately after .plt section" +msgstr "section .got pas immédiatement après la section .plt" + +#: elf32-i386.c:326 +#, c-format +msgid "%s: invalid relocation type %d" +msgstr "%s: type de relocalisation invalide %d" + +#: elf32-i386.c:841 elf32-s390.c:990 elf32-sparc.c:887 elf32-xtensa.c:637 +#: elf64-s390.c:943 elf64-x86-64.c:650 +#, c-format +msgid "%s: bad symbol index: %d" +msgstr "%s: symbole index erroné: %d" + +#: elf32-i386.c:949 elf32-s390.c:1168 elf32-sh.c:6426 elf32-sparc.c:1011 +#: elf64-s390.c:1129 +#, c-format +msgid "%s: `%s' accessed both as normal and thread local symbol" +msgstr "%s: « %s » symbole local accéder à la fois comme normal et avec thread" + +#: elf32-i386.c:1064 elf32-s390.c:1279 elf64-ppc.c:3929 elf64-s390.c:1243 +#: elf64-x86-64.c:886 +#, c-format +msgid "%s: bad relocation section name `%s'" +msgstr "%s: nom de section de relocalisation erroné « %s »" + +#: elf32-i386.c:2908 elf32-m68k.c:1757 elf32-s390.c:3022 elf32-sparc.c:2879 +#: elf32-xtensa.c:2193 elf64-s390.c:3018 elf64-sparc.c:2664 +#: elf64-x86-64.c:2452 +#, c-format +msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'" +msgstr "%s(%s+0x%lx): relocalisation sans solution vers le symbole « %s »" + +#: elf32-i386.c:2947 elf32-m68k.c:1796 elf32-s390.c:3072 elf64-s390.c:3068 +#: elf64-x86-64.c:2490 +#, c-format +msgid "%s(%s+0x%lx): reloc against `%s': error %d" +msgstr "%s(%s+0x%lx): relocalisation vers « %s »: erreur %d" + +#: elf32-ip2k.c:565 elf32-ip2k.c:571 elf32-ip2k.c:734 elf32-ip2k.c:740 +msgid "ip2k relaxer: switch table without complete matching relocation information." +msgstr "relâche ip2k: table de commutation sans concordance complète des informations de relocalisation" + +#: elf32-ip2k.c:588 elf32-ip2k.c:767 +msgid "ip2k relaxer: switch table header corrupt." +msgstr "relâche ip2k: en-tête de table de commutation corrompue" + +#: elf32-ip2k.c:1395 +#, c-format +msgid "ip2k linker: missing page instruction at 0x%08lx (dest = 0x%08lx)." +msgstr "liaison ip2k: instruction de page manquante à 0x%08lx (cible = 0x%08lx)." + +#: elf32-ip2k.c:1409 +#, c-format +msgid "ip2k linker: redundant page instruction at 0x%08lx (dest = 0x%08lx)." +msgstr "liaison ip2k: instruction de page redondante à 0x%08lx (cible = 0x%08lx)." + +#. Only if it's not an unresolved symbol. +#: elf32-ip2k.c:1593 +msgid "unsupported relocation between data/insn address spaces" +msgstr "relocalisation non supporté entre les espaces d'adresses data/insn" + +#: elf32-iq2000.c:907 elf32-m68hc1x.c:1431 elf32-ppc.c:2175 elf64-sparc.c:3072 +#: elfxx-mips.c:9195 +#, c-format +msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%s: utilise differents champs e_flags (0x%lx) que les modules précédents (0x%lx)" + +#: elf32-m32r.c:930 +msgid "SDA relocation when _SDA_BASE_ not defined" +msgstr "relocalisation SDA alors que _SDA_BASE_ n'est pas définie" + +#: elf32-m32r.c:1018 elf64-alpha.c:4279 elf64-alpha.c:4407 elf32-ia64.c:3958 +#: elf64-ia64.c:3958 +#, c-format +msgid "%s: unknown relocation type %d" +msgstr "%s: type de relocalisation inconnu %d" + +#: elf32-m32r.c:1226 +#, c-format +msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)" +msgstr "%s: la cible (%s) de la relocalisation %s est dans la mauvaise section (%s)" + +#: elf32-m32r.c:1952 +#, c-format +msgid "%s: Instruction set mismatch with previous modules" +msgstr "%s: jeu d'instructions ne concorde par avec les modules précédents" + +#: elf32-m32r.c:1975 +#, c-format +msgid "private flags = %lx" +msgstr "fanions privés = %lx" + +#: elf32-m32r.c:1980 +msgid ": m32r instructions" +msgstr ": instructions m32r" + +#: elf32-m32r.c:1981 +msgid ": m32rx instructions" +msgstr ": instruction m32rx" + +#: elf32-m68hc1x.c:1217 +#, c-format +msgid "Reference to the far symbol `%s' using a wrong relocation may result in incorrect execution" +msgstr "Référence à un symbole far « %s » utilisant la mauvaise relocalisation peut provoquer une exécution incorrecte" + +#: elf32-m68hc1x.c:1240 +#, c-format +msgid "banked address [%lx:%04lx] (%lx) is not in the same bank as current banked address [%lx:%04lx] (%lx)" +msgstr "banque d'adresses [%lx:%04lx] (%lx) n'es pas dans la même banque que la banque courante d'adresses [%lx:%04lx] (%lx)" + +#: elf32-m68hc1x.c:1259 +#, c-format +msgid "reference to a banked address [%lx:%04lx] in the normal address space at %04lx" +msgstr "référence à une banque d'adresses [%lx:%04lx] dans l'espace normal d'adresses à %04lx" + +#: elf32-m68hc1x.c:1396 +#, c-format +msgid "%s: linking files compiled for 16-bit integers (-mshort) and others for 32-bit integers" +msgstr "%s: fichiers liés compilés pour des entiers de 16 bits (-mshort) et d'autres pour des entiers de 32 bits" + +#: elf32-m68hc1x.c:1404 +#, c-format +msgid "%s: linking files compiled for 32-bit double (-fshort-double) and others for 64-bit double" +msgstr "%s: fichiers liés compilés pour des doubles de 32 bits (-fshort-double) et d'autres pour des doubles de 64 bits" + +#: elf32-m68hc1x.c:1414 +#, c-format +msgid "%s: linking files compiled for HCS12 with others compiled for HC12" +msgstr "%s: certains fichiers liés compilés pour HCS12 avec d'autres compilés pour HC12" + +#: elf32-m68hc1x.c:1462 +msgid "[abi=32-bit int, " +msgstr "[abi=32-bit int, " + +#: elf32-m68hc1x.c:1464 +msgid "[abi=16-bit int, " +msgstr "[abi=16-bit int, " + +#: elf32-m68hc1x.c:1467 +msgid "64-bit double, " +msgstr "double de 64 bits, " + +#: elf32-m68hc1x.c:1469 +msgid "32-bit double, " +msgstr "double de 32 bits, " + +#: elf32-m68hc1x.c:1472 +msgid "cpu=HC11]" +msgstr "cpu=HC11]" + +#: elf32-m68hc1x.c:1474 +msgid "cpu=HCS12]" +msgstr "cpu=HCS12]" + +#: elf32-m68hc1x.c:1476 +msgid "cpu=HC12]" +msgstr "cpu=HC12]" + +#: elf32-m68hc1x.c:1479 +msgid " [memory=bank-model]" +msgstr " [memory=bank-model]" + +#: elf32-m68hc1x.c:1481 +msgid " [memory=flat]" +msgstr " [memory=flat]" + +#: elf32-m68k.c:400 +msgid " [cpu32]" +msgstr " [cpu32]" + +#: elf32-m68k.c:403 +msgid " [m68000]" +msgstr " [m68000]" + +#: elf32-mcore.c:353 elf32-mcore.c:456 +#, c-format +msgid "%s: Relocation %s (%d) is not currently supported.\n" +msgstr "%s: relocalisation %s (%d) n'est pas couramment supportée.\n" + +#: elf32-mcore.c:441 +#, c-format +msgid "%s: Unknown relocation type %d\n" +msgstr "%s: type de relocalisation inconnue %d\n" + +#: elf32-mips.c:1170 elf64-mips.c:1717 elfn32-mips.c:1664 +msgid "32bits gp relative relocation occurs for an external symbol" +msgstr "relocalisation relative gp 32bits est survenue pour un symbole externe" + +#: elf32-mips.c:1314 elf64-mips.c:1830 elfn32-mips.c:1783 +#, c-format +msgid "Linking mips16 objects into %s format is not supported" +msgstr "Édition de liens d'objets mips16 dans le format %s n'est pas supporté" + +#: elf32-ppc.c:2056 +#, c-format +msgid "generic linker can't handle %s" +msgstr "liaison générique ne peut traiter %s" + +#: elf32-ppc.c:2138 +#, c-format +msgid "%s: compiled with -mrelocatable and linked with modules compiled normally" +msgstr "%s: compilé avec -mrelocatable et fait l'édition de lien avec les modules compilés normalement" + +#: elf32-ppc.c:2147 +#, c-format +msgid "%s: compiled normally and linked with modules compiled with -mrelocatable" +msgstr "%s: compilé normalement et fait l'édition de lien avec les modules compilés avec -mrelocatable" + +#: elf32-ppc.c:3413 +#, c-format +msgid "%s: relocation %s cannot be used when making a shared object" +msgstr "%s: relocalisation %s ne peut être utilisée lors de la création d'un objet partagé" + +#. It does not make sense to have a procedure linkage +#. table entry for a local symbol. +#: elf32-ppc.c:3619 +#, c-format +msgid "%s(%s+0x%lx): %s reloc against local symbol" +msgstr "%s(%s+0x%lx): %s relocalisation vers un symbole local" + +#: elf32-ppc.c:4862 elf64-ppc.c:7789 +#, c-format +msgid "%s: unknown relocation type %d for symbol %s" +msgstr "%s: type de relocalisation inconnue %d pour le symbole %s" + +#: elf32-ppc.c:5113 +#, c-format +msgid "%s(%s+0x%lx): non-zero addend on %s reloc against `%s'" +msgstr "%s(%s+0x%lx): ajot non nulle sur la relocalisation %s vers « %s »" + +#: elf32-ppc.c:5399 elf32-ppc.c:5425 elf32-ppc.c:5484 +#, c-format +msgid "%s: the target (%s) of a %s relocation is in the wrong output section (%s)" +msgstr "%s: la cible (%s) d'une relocalisation %s est dans la mauvaise section de sortie (%s)" + +#: elf32-ppc.c:5539 +#, c-format +msgid "%s: relocation %s is not yet supported for symbol %s." +msgstr "%s: relocalisation %s n'est pas encore supporté pour le symbole %s." + +#: elf32-ppc.c:5594 elf64-ppc.c:8461 +#, c-format +msgid "%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'" +msgstr "%s(%s+0x%lx): relocalisation %s sans solution vers le symbole « %s »" + +#: elf32-ppc.c:5644 elf64-ppc.c:8507 +#, c-format +msgid "%s(%s+0x%lx): %s reloc against `%s': error %d" +msgstr "%s(%s+0x%lx): %s relocalisation vers « %s »: erreur %d" + +#: elf32-ppc.c:5888 +#, c-format +msgid "corrupt or empty %s section in %s" +msgstr "section %s vide ou corrompue dans %s" + +#: elf32-ppc.c:5895 +#, c-format +msgid "unable to read in %s section from %s" +msgstr "incapable de lire dans la section %s à partir de %s" + +#: elf32-ppc.c:5901 +#, c-format +msgid "corrupt %s section in %s" +msgstr "section %s corrompue dans %s" + +#: elf32-ppc.c:5944 +#, c-format +msgid "warning: unable to set size of %s section in %s" +msgstr "AVERTISSEMENT: incapable d'initialiser la taille de la section %s dans %s" + +#: elf32-ppc.c:5994 +msgid "failed to allocate space for new APUinfo section." +msgstr "échec d'allocation d'espace pour une nouvelle section APUinfo" + +#: elf32-ppc.c:6013 +msgid "failed to compute new APUinfo section." +msgstr "échec d'évaluation de la nouvelle section APUinfo" + +#: elf32-ppc.c:6016 +msgid "failed to install new APUinfo section." +msgstr "échec d'installation de la nouvelle section APUinfo" + +#: elf32-s390.c:2256 elf64-s390.c:2226 +#, c-format +msgid "%s(%s+0x%lx): invalid instruction for TLS relocation %s" +msgstr "%s(%s+0x%lx): instruction invalide pour la relocalisation TLS %s" + +#: elf32-sh.c:2103 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES offset" +msgstr "%s: 0x%lx: AVERTISSEMENT: mauvais décalage pour R_SH_USES" + +#: elf32-sh.c:2115 +#, c-format +msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x" +msgstr "%s: 0x%lx: AVERTISSEMENT: R_SH_USES pointe vers un insn inconnu 0x%x " + +#: elf32-sh.c:2132 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES load offset" +msgstr "%s: 0x%lx: AVERTISSEMENT: mauvais décalage de chargement R_SH_USES" + +#: elf32-sh.c:2147 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected reloc" +msgstr "%s: 0x%lx: AVERTISSEMENT: ne peut repérer la relocalisation attendue" + +#: elf32-sh.c:2175 +#, c-format +msgid "%s: 0x%lx: warning: symbol in unexpected section" +msgstr "%s: 0x%lx: AVERTISSEMENT: symbole dans une section inattendue" + +#: elf32-sh.c:2300 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected COUNT reloc" +msgstr "%s: 0x%lx: AVERTISSEMENT: ne peut repérer le compteur de relocalisation attendu" + +#: elf32-sh.c:2309 +#, c-format +msgid "%s: 0x%lx: warning: bad count" +msgstr "%s: 0x%lx: AVERTISSEMENT: mauvais décompte" + +#: elf32-sh.c:2712 elf32-sh.c:3088 +#, c-format +msgid "%s: 0x%lx: fatal: reloc overflow while relaxing" +msgstr "%s: 0x%lx: erreur fatale: débordement de relocalisation lors de relâches" + +#: elf32-sh.c:4654 elf64-sh64.c:1585 +msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled" +msgstr "STO_SH5_ISA32 inattendu sur le symbole local n'est pas traité" + +#: elf32-sh.c:4809 +#, c-format +msgid "%s: unresolvable relocation against symbol `%s' from %s section" +msgstr "%s: relocalisation sans solution vers le symbole « %s » à partir de la section %s" + +#: elf32-sh.c:4881 +#, c-format +msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation" +msgstr "%s: 0x%lx: fatal: cible de branchement non aligné pour une relocalisatin de type relax-support" + +#: elf32-sh.c:6627 elf64-alpha.c:4848 +#, c-format +msgid "%s: TLS local exec code cannot be linked into shared objects" +msgstr "%s: code exécutable local TLS ne peut être lié en objets partagés" + +#: elf32-sh64.c:221 elf64-sh64.c:2407 +#, c-format +msgid "%s: compiled as 32-bit object and %s is 64-bit" +msgstr "%s: compilé comme un objet de 32 bits et %s est de 64 bits" + +#: elf32-sh64.c:224 elf64-sh64.c:2410 +#, c-format +msgid "%s: compiled as 64-bit object and %s is 32-bit" +msgstr "%s: compilé comme un objet de 64 bits et %s est de 32 bits" + +#: elf32-sh64.c:226 elf64-sh64.c:2412 +#, c-format +msgid "%s: object size does not match that of target %s" +msgstr "%s: taille de l'objet ne concorde pas avec la taille de la cible %s" + +#: elf32-sh64.c:461 elf64-sh64.c:2990 +#, c-format +msgid "%s: encountered datalabel symbol in input" +msgstr "%s: rencontre du symbole d'une étiquette de donnée dans l'entrée" + +#: elf32-sh64.c:544 +msgid "PTB mismatch: a SHmedia address (bit 0 == 1)" +msgstr "Non concordance PTB: adresse SHmedia (bit 0 == 1)" + +#: elf32-sh64.c:547 +msgid "PTA mismatch: a SHcompact address (bit 0 == 0)" +msgstr "Non concordance PTA: adresse SHcompact (bit 0 == 0)" + +#: elf32-sh64.c:565 +#, c-format +msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16" +msgstr "%s: ERREUR GAS: insn PTB inattendue avec R_SH_PT_16" + +#: elf32-sh64.c:614 elf64-sh64.c:1748 +#, c-format +msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n" +msgstr "%s: ERREUR: relocalisation non alignée type %d à %08x relocalisé`%08x\n" + +#: elf32-sh64.c:698 +#, c-format +msgid "%s: could not write out added .cranges entries" +msgstr "%s: ne peut écrire en sortie des entrées .cranges" + +#: elf32-sh64.c:760 +#, c-format +msgid "%s: could not write out sorted .cranges entries" +msgstr "%s: ne peut écrire en sortie des entrées .cranges" + +#: elf32-sparc.c:2521 elf64-sparc.c:2314 +#, c-format +msgid "%s: probably compiled without -fPIC?" +msgstr "%s: probablement compilé sans -fPIC?" + +#: elf32-sparc.c:3348 +#, c-format +msgid "%s: compiled for a 64 bit system and target is 32 bit" +msgstr "%s: compilé pour un système à 64 bits et la cible est de 32 bits" + +#: elf32-sparc.c:3362 +#, c-format +msgid "%s: linking little endian files with big endian files" +msgstr "" +"%s: édition de liens pour des fichiers en système à octets de poids faibles\n" +"avec des fichiers pour des systèmes à octets de poids fort" + +#: elf32-v850.c:753 +#, c-format +msgid "Variable `%s' cannot occupy in multiple small data regions" +msgstr "Variable « %s » ne peut occuper de multiples petites régions de données" + +#: elf32-v850.c:756 +#, c-format +msgid "Variable `%s' can only be in one of the small, zero, and tiny data regions" +msgstr "Variable « %s » peut seulement être dans une région de données petite, zéro ou minuscule" + +#: elf32-v850.c:759 +#, c-format +msgid "Variable `%s' cannot be in both small and zero data regions simultaneously" +msgstr "Variable « %s » ne peut être dans une région de données petite et zéro à la fois" + +#: elf32-v850.c:762 +#, c-format +msgid "Variable `%s' cannot be in both small and tiny data regions simultaneously" +msgstr "Variable « %s » ne peut être dans une région de données petite et minuscule zéro à la fois" + +#: elf32-v850.c:765 +#, c-format +msgid "Variable `%s' cannot be in both zero and tiny data regions simultaneously" +msgstr "Variable « %s » ne peut être dans une région de données zéro et minuscule zéro à la fois" + +#: elf32-v850.c:1144 +msgid "FAILED to find previous HI16 reloc\n" +msgstr "ÉCHEC de repérage de la relocalisation précédente HI16\n" + +#: elf32-v850.c:1789 +msgid "could not locate special linker symbol __gp" +msgstr "ne peut repérer le symbole spécial d'édition de lien __gp" + +#: elf32-v850.c:1793 +msgid "could not locate special linker symbol __ep" +msgstr "ne peut repérer le symbole spécial d'édition de lien __ep" + +#: elf32-v850.c:1797 +msgid "could not locate special linker symbol __ctbp" +msgstr "ne peut repérer le symbole spécial d'édition de lien __ctbp" + +#: elf32-v850.c:1963 +#, c-format +msgid "%s: Architecture mismatch with previous modules" +msgstr "%s: l'architecture ne concorde pas avec les modules précédents" + +#: elf32-v850.c:1983 +#, c-format +msgid "private flags = %lx: " +msgstr "fanions privés = %lx" + +#: elf32-v850.c:1988 +msgid "v850 architecture" +msgstr "architecture v850" + +#: elf32-v850.c:1989 +msgid "v850e architecture" +msgstr "architecture v850e" + +#: elf32-vax.c:549 +msgid " [nonpic]" +msgstr " [nonpic]" + +#: elf32-vax.c:552 +msgid " [d-float]" +msgstr " [d-float]" + +#: elf32-vax.c:555 +msgid " [g-float]" +msgstr " [g-float]" + +#: elf32-vax.c:663 +#, c-format +msgid "%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of %ld" +msgstr "%s: AVERTISSEMENT: GOT ajouté de %ld vers « %s » ne concorde par avec le GOT ajouté de %ld" + +#: elf32-vax.c:1667 +#, c-format +msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored" +msgstr "%s: AVERTISSEMENT: PLT ajouté de %d vers « %s » de la section %s ignoré" + +#: elf32-vax.c:1802 +#, c-format +msgid "%s: warning: %s relocation against symbol `%s' from %s section" +msgstr "%s: AVERTISSEMENT: relocalisation %s vers le symbole « %s » de la section %s" + +#: elf32-vax.c:1808 +#, c-format +msgid "%s: warning: %s relocation to 0x%x from %s section" +msgstr "%s: AVERTISSEMENT: relocalisation %s vers 0x%x de la section %s" + +#: elf32-xstormy16.c:462 elf32-ia64.c:2450 elf64-ia64.c:2450 +msgid "non-zero addend in @fptr reloc" +msgstr "ajout non null dans la relocalisation @fptr" + +#: elf64-alpha.c:1108 +msgid "GPDISP relocation did not find ldah and lda instructions" +msgstr "la relocalisation GPDISP n'a pas repéré les instructions ldah et lda" + +#: elf64-alpha.c:3731 +#, c-format +msgid "%s: .got subsegment exceeds 64K (size %d)" +msgstr "%s: le sous-segment .got excède 64K (taille %d)" + +#: elf64-alpha.c:4602 elf64-alpha.c:4614 +#, c-format +msgid "%s: gp-relative relocation against dynamic symbol %s" +msgstr "%s: relocalisation relative gp vers le symbole dynamique %s" + +#: elf64-alpha.c:4640 elf64-alpha.c:4773 +#, c-format +msgid "%s: pc-relative relocation against dynamic symbol %s" +msgstr "%s: relocalisation relative au PC vers le symbole dynamique %s" + +#: elf64-alpha.c:4668 +#, c-format +msgid "%s: change in gp: BRSGP %s" +msgstr "%s: changé dans le GP: BRSGP %s" + +#: elf64-alpha.c:4693 +msgid "" +msgstr "" + +#: elf64-alpha.c:4698 +#, c-format +msgid "%s: !samegp reloc against symbol without .prologue: %s" +msgstr "%s: relocalisation !samegp vers le symbole sans .prologue: %s" + +#: elf64-alpha.c:4749 +#, c-format +msgid "%s: unhandled dynamic relocation against %s" +msgstr "%s: relocalisation dynamique non traitée vers %s" + +#: elf64-alpha.c:4832 +#, c-format +msgid "%s: dtp-relative relocation against dynamic symbol %s" +msgstr "%s: relocalisation relative dtp vers le symbole dynamique %s" + +#: elf64-alpha.c:4855 +#, c-format +msgid "%s: tp-relative relocation against dynamic symbol %s" +msgstr "%s: relocalisation relative tp vers le symbole dynamique %s" + +#: elf64-hppa.c:2086 +#, c-format +msgid "stub entry for %s cannot load .plt, dp offset = %ld" +msgstr "entrée du talon pour %s ne peut charger .plt, décalage dp = %ld" + +#: elf64-mmix.c:1032 +#, c-format +msgid "" +"%s: Internal inconsistency error for value for\n" +" linker-allocated global register: linked: 0x%lx%08lx != relaxed: 0x%lx%08lx\n" +msgstr "" +"%s: erreur d'inconsistence interne pour la valeur du registre global\n" +" alloué à l'édition de lien: lié: 0x%lx%08lx != relâché: 0x%lx%08lx\n" + +#: elf64-mmix.c:1416 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: (unknown) in %s" +msgstr "%s: relocalisation base plus décalage vers le symbole registre: (inconnu) dans %s" + +#: elf64-mmix.c:1421 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: %s in %s" +msgstr "%s: relocalisation base plus décalage vers le symbole registre: %s dans %s" + +#: elf64-mmix.c:1465 +#, c-format +msgid "%s: register relocation against non-register symbol: (unknown) in %s" +msgstr "%s: relocalisation de registre vers le symbole non-registre: (inconnu) dans %s" + +#: elf64-mmix.c:1470 +#, c-format +msgid "%s: register relocation against non-register symbol: %s in %s" +msgstr "%s: relocalisation de registre vers le symbole non-registre: %s dans %s" + +#: elf64-mmix.c:1507 +#, c-format +msgid "%s: directive LOCAL valid only with a register or absolute value" +msgstr "%s: directive LOCAL valide seulement avec un registre ou une valeur absolue" + +#: elf64-mmix.c:1535 +#, c-format +msgid "%s: LOCAL directive: Register $%ld is not a local register. First global register is $%ld." +msgstr "%s: directive LOCAL: registre $%ld n'est pas un registre local. Premier registre global est $%ld." + +#: elf64-mmix.c:1994 +#, c-format +msgid "%s: Error: multiple definition of `%s'; start of %s is set in a earlier linked file\n" +msgstr "%s: erreur: multiple définitions de « %s »; début de %s est initialisé dans un précédent fichier lié\n" + +#: elf64-mmix.c:2053 +msgid "Register section has contents\n" +msgstr "Registre de section contient\n" + +#: elf64-mmix.c:2216 +#, c-format +msgid "" +"Internal inconsistency: remaining %u != max %u.\n" +" Please report this bug." +msgstr "" +"Inconsistence interne: reste %u != max %u.\n" +" SVP rapporter cette anomalie." + +#: elf64-ppc.c:2388 libbfd.c:831 +#, c-format +msgid "%s: compiled for a big endian system and target is little endian" +msgstr "" +"%s: compilé pour un système à octets de poids fort alors que la cible\n" +"est un système à octets de poids faible" + +#: elf64-ppc.c:2391 libbfd.c:833 +#, c-format +msgid "%s: compiled for a little endian system and target is big endian" +msgstr "" +"%s: compilé pour un système à octets de poids faible alors que la cible\n" +"est un système à octets de poids fort" + +#: elf64-ppc.c:4857 +#, c-format +msgid "%s: unexpected reloc type %u in .opd section" +msgstr "%s: type inattendu de relocalisation %u dans la section .opd" + +#: elf64-ppc.c:4877 +#, c-format +msgid "%s: .opd is not a regular array of opd entries" +msgstr "%s: .opd n'est pas un tableau régulier d'entrées opd" + +#: elf64-ppc.c:4897 +#, c-format +msgid "%s: undefined sym `%s' in .opd section" +msgstr "%s: symbole « %s » indéfini dans la section .opd" + +#: elf64-ppc.c:6136 +#, c-format +msgid "can't find branch stub `%s'" +msgstr "ne peut repérer le talon de branchement « %s »" + +#: elf64-ppc.c:6175 elf64-ppc.c:6250 +#, c-format +msgid "linkage table error against `%s'" +msgstr "erreur de liaison de la table de liaison vers « %s »" + +#: elf64-ppc.c:6340 +#, c-format +msgid "can't build branch stub `%s'" +msgstr "ne peut construire un talon de branchement « %s »" + +#: elf64-ppc.c:7047 +msgid ".glink and .plt too far apart" +msgstr ".glink et .plt trop éloignée" + +#: elf64-ppc.c:7135 +msgid "stubs don't match calculated size" +msgstr "taille des talons ne concorde pas avec la taille calculée" + +#: elf64-ppc.c:7147 +#, c-format +msgid "" +"linker stubs in %u groups\n" +" branch %lu\n" +" toc adjust %lu\n" +" long branch %lu\n" +" long toc adj %lu\n" +" plt call %lu" +msgstr "" +"talons d'édition de liens dans les groupes %u\n" +" branchements %lu\n" +" ajustements toc %lu\n" +" long branchements %lu\n" +" long ajustements toc %lu\n" +" appels plt %lu" + +#: elf64-ppc.c:7723 +#, c-format +msgid "%s(%s+0x%lx): automatic multiple TOCs not supported using your crt files; recompile with -mminimal-toc or upgrade gcc" +msgstr "%s(%s+0x%lx): TOC multiples et automatiques non supportés utilisant votre fichier crt; recompiler avec -mminimal-toc ou mettre à jour gcc" + +#: elf64-ppc.c:7731 +#, c-format +msgid "%s(%s+0x%lx): sibling call optimization to `%s' does not allow automatic multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, or make `%s' extern" +msgstr "%s(%s+0x%lx): optimisation soeurs des appels vers `%s' ne permet par de TOC multiples et automatiques; recompiler avec -mminimal-toc ou -fno-optimize-sibling-calls, ou rendre externe `%s'" + +#: elf64-ppc.c:8329 +#, c-format +msgid "%s: relocation %s is not supported for symbol %s." +msgstr "%s: relocalisation %s n'est pas supportée pour le symbole %s." + +#: elf64-ppc.c:8408 +#, c-format +msgid "%s: error: relocation %s not a multiple of %d" +msgstr "%s: erreur: relocalisation %s n'est pas un multiple de %d" + +#: elf64-sparc.c:1370 +#, c-format +msgid "%s: check_relocs: unhandled reloc type %d" +msgstr "%s: check_relocs: type de relocalisation non traitée %d" + +#: elf64-sparc.c:1407 +#, c-format +msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER" +msgstr "%s: seuls les registres %%g[2367] peuvent être déclarés en utilisant les registres STT_REGISTER" + +#: elf64-sparc.c:1427 +#, c-format +msgid "Register %%g%d used incompatibly: %s in %s, previously %s in %s" +msgstr "Registre %%g%d utilisé de manière incompatible: %s dans %s précédemment %s dans %s" + +#: elf64-sparc.c:1450 +#, c-format +msgid "Symbol `%s' has differing types: REGISTER in %s, previously %s in %s" +msgstr "Symbole « %s » a des types qui diffèrent: REGISTRE dans %s, précédemment %s dans %s" + +#: elf64-sparc.c:1496 +#, c-format +msgid "Symbol `%s' has differing types: %s in %s, previously REGISTER in %s" +msgstr "Symbole « %s » a des types qui diffèrent: %s dans %s, précédemment REGISTRE dans %s" + +#: elf64-sparc.c:3053 +#, c-format +msgid "%s: linking UltraSPARC specific with HAL specific code" +msgstr "%s: édition de liens spécifiques pour UltraSPARC avec du code spécifique HAL" + +#: elf64-x86-64.c:739 +#, c-format +msgid "%s: %s' accessed both as normal and thread local symbol" +msgstr "%s: %s symbole accédé à la fois comme normal et comme thread" + +#: elfcode.h:1113 +#, c-format +msgid "%s: version count (%ld) does not match symbol count (%ld)" +msgstr "%s: compteur de version (%ld) ne concorde pas avec le symbole du compteur (%ld)" + +#: elfcode.h:1342 +#, c-format +msgid "%s(%s): relocation %d has invalid symbol index %ld" +msgstr "%s(%s): relocalisation %d a un index de symbole invalide %ld" + +#: elflink.c:1456 +#, c-format +msgid "%s: warning: unexpected redefinition of indirect versioned symbol `%s'" +msgstr "%s: AVERTISSEMENT: redéfinition inattendue du symbole indirect avec version « %s »" + +#: elflink.c:1807 +#, c-format +msgid "%s: undefined versioned symbol name %s" +msgstr "%s: nom symbole avec version indéfinie %s" + +#: elflink.c:2142 +#, c-format +msgid "%s: relocation size mismatch in %s section %s" +msgstr "%s: taille de la relocalisation ne concorde pas dans %s section %s" + +#: elflink.c:2434 +#, c-format +msgid "warning: type and size of dynamic symbol `%s' are not defined" +msgstr "AVERTISSEMENT: type et taille du symbole dynamique « %s » ne sont pas définis" + +#: elflink.h:1022 +#, c-format +msgid "%s: %s: invalid version %u (max %d)" +msgstr "%s: %s: version invalide %u (max %d)" + +#: elflink.h:1063 +#, c-format +msgid "%s: %s: invalid needed version %d" +msgstr "%s: %s: version requise invalide %d" + +#: elflink.h:1238 +#, c-format +msgid "Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s" +msgstr "AVERTISSEMENT: alignement %u du symbole « %s » ans %s est plus petit que %u dans %s" + +#: elflink.h:1252 +#, c-format +msgid "Warning: size of symbol `%s' changed from %lu in %s to %lu in %s" +msgstr "AVERTISSEMENT: taille du symbole « %s » a changé de %lu dans %s à %lu dans %s" + +#: elflink.h:2160 +#, c-format +msgid "%s: undefined version: %s" +msgstr "%s: version non définie: %s" + +#: elflink.h:2226 +#, c-format +msgid "%s: .preinit_array section is not allowed in DSO" +msgstr "%s: section .preinit_array n'est pas permise dans DSO" + +#: elflink.h:3078 +msgid "Not enough memory to sort relocations" +msgstr "Pas assez de mémoire pour effectuer le trie des relocalisations" + +#: elflink.h:3958 elflink.h:4001 +#, c-format +msgid "%s: could not find output section %s" +msgstr "%s: ne peut repérer la section de sortie %s" + +#: elflink.h:3964 +#, c-format +msgid "warning: %s section has zero size" +msgstr "AVERTISSEMENT: section %s a une taille nulle" + +#: elflink.h:4483 +#, c-format +msgid "%s: %s symbol `%s' in %s is referenced by DSO" +msgstr "%s: %s symbole « %s » in %s est référencé par DSO" + +#: elflink.h:4564 +#, c-format +msgid "%s: could not find output section %s for input section %s" +msgstr "%s: ne peut repérer la section de sortie %s pour la section d'entrée %s" + +#: elflink.h:4666 +#, c-format +msgid "%s: %s symbol `%s' isn't defined" +msgstr "%s: %s symbole « %s » n'est pas défini" + +#: elflink.h:5053 elflink.h:5095 +msgid "%T: discarded in section `%s' from %s\n" +msgstr "%T: mis de côté dans la section « %s » à partir de %s\n" + +#: elfxx-mips.c:887 +msgid "static procedure (no name)" +msgstr "procédure statique (sans name)" + +#: elfxx-mips.c:1897 +msgid "not enough GOT space for local GOT entries" +msgstr "pas suffisamment d'espace GOT pour les entrées locales GOT" + +#: elfxx-mips.c:3691 +#, c-format +msgid "%s: %s+0x%lx: jump to stub routine which is not jal" +msgstr "%s: %s+0x%lx: saut vers la routine dans la partie du talon (stub) qui n'est pas jal" + +#: elfxx-mips.c:5192 +#, c-format +msgid "%s: Malformed reloc detected for section %s" +msgstr "%s: relocalisation mal composée détectée dans la section %s" + +#: elfxx-mips.c:5266 +#, c-format +msgid "%s: CALL16 reloc at 0x%lx not against global symbol" +msgstr "%s: appel CALL16 de relocalisation à 0x%lx qui n'est pas pourun symbole global" + +#: elfxx-mips.c:8692 +#, c-format +msgid "%s: illegal section name `%s'" +msgstr "%s: nom illégal de section « %s »" + +#: elfxx-mips.c:9025 +#, c-format +msgid "%s: endianness incompatible with that of the selected emulation" +msgstr "%s: système de poids fort ou faible incompatible avec celui sélectionné pour l'émulation" + +#: elfxx-mips.c:9037 +#, c-format +msgid "%s: ABI is incompatible with that of the selected emulation" +msgstr "%s: ABI est incompatible avec celui sélectionné pour l'émulation" + +#: elfxx-mips.c:9104 +#, c-format +msgid "%s: warning: linking PIC files with non-PIC files" +msgstr "%s: AVERTISSEMENT: édition de liens des fichiers PIC avec des fichiers non PIC" + +#: elfxx-mips.c:9121 +#, c-format +msgid "%s: linking 32-bit code with 64-bit code" +msgstr "%s: édition de liens de code de 32 bits avec du code de 64 bits" + +#: elfxx-mips.c:9149 +#, c-format +msgid "%s: linking %s module with previous %s modules" +msgstr "%s: édition de liens du module %s avec les modules précédents %s" + +#: elfxx-mips.c:9172 +#, c-format +msgid "%s: ABI mismatch: linking %s module with previous %s modules" +msgstr "%s: ABI ne concorde pas: édition de lien du module %s avec les modules précédents %s" + +#: elfxx-mips.c:9241 +msgid " [abi=O32]" +msgstr " [abi=O32]" + +#: elfxx-mips.c:9243 +msgid " [abi=O64]" +msgstr " [abi=O64]" + +#: elfxx-mips.c:9245 +msgid " [abi=EABI32]" +msgstr " [abi=EABI32]" + +#: elfxx-mips.c:9247 +msgid " [abi=EABI64]" +msgstr " [abi=EABI64]" + +#: elfxx-mips.c:9249 +msgid " [abi unknown]" +msgstr " [abi inconnu]" + +#: elfxx-mips.c:9251 +msgid " [abi=N32]" +msgstr " [abi=N32]" + +#: elfxx-mips.c:9253 +msgid " [abi=64]" +msgstr " [abi=64]" + +#: elfxx-mips.c:9255 +msgid " [no abi set]" +msgstr " [aucun jeu abi]" + +#: elfxx-mips.c:9258 +msgid " [mips1]" +msgstr " [mips1]" + +#: elfxx-mips.c:9260 +msgid " [mips2]" +msgstr " [mips2]" + +#: elfxx-mips.c:9262 +msgid " [mips3]" +msgstr " [mips3]" + +#: elfxx-mips.c:9264 +msgid " [mips4]" +msgstr " [mips4]" + +#: elfxx-mips.c:9266 +msgid " [mips5]" +msgstr " [mips5]" + +#: elfxx-mips.c:9268 +msgid " [mips32]" +msgstr " [mips32]" + +#: elfxx-mips.c:9270 +msgid " [mips64]" +msgstr " [mips64]" + +#: elfxx-mips.c:9272 +msgid " [mips32r2]" +msgstr " [mips32r2]" + +#: elfxx-mips.c:9274 +msgid " [unknown ISA]" +msgstr " [ISA inconnu]" + +#: elfxx-mips.c:9277 +msgid " [mdmx]" +msgstr " [mdmx]" + +#: elfxx-mips.c:9280 +msgid " [mips16]" +msgstr " [mips16]" + +#: elfxx-mips.c:9283 +msgid " [32bitmode]" +msgstr " [mode 32 bits]" + +#: elfxx-mips.c:9285 +msgid " [not 32bitmode]" +msgstr " [aucun mode 32 bits]" + +#: i386linux.c:457 m68klinux.c:461 sparclinux.c:458 +#, c-format +msgid "Output file requires shared library `%s'\n" +msgstr "La sortie requiert une ilbrairie partagée « %s »\n" + +#: i386linux.c:465 m68klinux.c:469 sparclinux.c:466 +#, c-format +msgid "Output file requires shared library `%s.so.%s'\n" +msgstr "Le fichier de sortie requiert une librairie partagée « %s.so.%s »\n" + +#: i386linux.c:654 i386linux.c:704 m68klinux.c:661 m68klinux.c:709 +#: sparclinux.c:656 sparclinux.c:706 +#, c-format +msgid "Symbol %s not defined for fixups\n" +msgstr "Symbole %s n'est pas défini pour les corrections\n" + +#: i386linux.c:728 m68klinux.c:733 sparclinux.c:730 +msgid "Warning: fixup count mismatch\n" +msgstr "AVERTISSEMENT: correction du compteur qui ne concordait pas\n" + +#: ieee.c:293 +#, c-format +msgid "%s: string too long (%d chars, max 65535)" +msgstr "%s: chaîne trop longue (%d caractères, max 65535)" + +#: ieee.c:428 +#, c-format +msgid "%s: unrecognized symbol `%s' flags 0x%x" +msgstr "%s: symbole non reconnue « %s » fanions 0x%x" + +#: ieee.c:938 +#, c-format +msgid "%s: unimplemented ATI record %u for symbol %u" +msgstr "%s: enregistrement ATI non implanté %u pour le symbole %u" + +#: ieee.c:963 +#, c-format +msgid "%s: unexpected ATN type %d in external part" +msgstr "%s: type ATN inattendu %d dans la partie externe" + +#: ieee.c:985 +#, c-format +msgid "%s: unexpected type after ATN" +msgstr "%s: type inattendu après ATN" + +#: ihex.c:264 +#, c-format +msgid "%s:%d: unexpected character `%s' in Intel Hex file\n" +msgstr "%s:%d: caractères inattendue « %s » dans le fichier Intel hexadécimal\n" + +#: ihex.c:372 +#, c-format +msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)" +msgstr "%s:%u: somme de contrôle erronée dans le fichier Intel hexadécimal (attendu %u, obtenu %u)" + +#: ihex.c:426 +#, c-format +msgid "%s:%u: bad extended address record length in Intel Hex file" +msgstr "%s:%u: longueur erronée de l'enregistrement d'adresse étendue dans le fichier Intel hexadécimal" + +#: ihex.c:443 +#, c-format +msgid "%s:%u: bad extended start address length in Intel Hex file" +msgstr "%s:%u: longueur erronée d'adresse étendue de début dans le fichier Intel hexadécimal" + +#: ihex.c:460 +#, c-format +msgid "%s:%u: bad extended linear address record length in Intel Hex file" +msgstr "%s:%u: longueur erronée de l'enregistrement d'adresse étendue linéaire dans le fichier Intel hexadécimal" + +#: ihex.c:477 +#, c-format +msgid "%s:%u: bad extended linear start address length in Intel Hex file" +msgstr "%s:%u: longueur erronée d'adresse étendue linéraire de début dans le fichier Intel hexadécimal" + +#: ihex.c:494 +#, c-format +msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n" +msgstr "%s:%u: type ihex non reconnu %u dans le fichier Intel hexadécimal\n" + +#: ihex.c:619 +#, c-format +msgid "%s: internal error in ihex_read_section" +msgstr "%s: erreur interne dans ihex_read_section" + +#: ihex.c:654 +#, c-format +msgid "%s: bad section length in ihex_read_section" +msgstr "%s: longuer erronée de section dans ihex_read_section" + +#: ihex.c:872 +#, c-format +msgid "%s: address 0x%s out of range for Intel Hex file" +msgstr "%s: adresse 0x%s hors limite pour le fichier Intel hexadécimal" + +#: libbfd.c:861 +#, c-format +msgid "Deprecated %s called at %s line %d in %s\n" +msgstr "%s déprécié appelé à %s dans la ligne %d dans %s\n" + +#: libbfd.c:864 +#, c-format +msgid "Deprecated %s called\n" +msgstr "%s appel déprécié\n" + +#: linker.c:1829 +#, c-format +msgid "%s: indirect symbol `%s' to `%s' is a loop" +msgstr "%s: symbole indirect « %s » vers « %s » est une boucle" + +#: linker.c:2697 +#, c-format +msgid "Attempt to do relocatable link with %s input and %s output" +msgstr "Tentative de relocalisation d'un lien avec %s à l'entrée et %s à la sortie" + +#: merge.c:896 +#, c-format +msgid "%s: access beyond end of merged section (%ld + %ld)" +msgstr "%s: accès au-delà de la fin de la section fusionnée (%ld + %ld)" + +#: mmo.c:503 +#, c-format +msgid "%s: No core to allocate section name %s\n" +msgstr "%s: pas de corps pour allouer un nom de section %s\n" + +#: mmo.c:579 +#, c-format +msgid "%s: No core to allocate a symbol %d bytes long\n" +msgstr "%s: pas de corps pour allouer un symbole %d octets de longueur\n" + +#: mmo.c:1287 +#, c-format +msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n" +msgstr "%s: fichier mmo invalide: valeur d'initialisation pour $255 n'est pas « Main »\n" + +#: mmo.c:1433 +#, c-format +msgid "%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name starting with `%s'\n" +msgstr "%s: séquence de caractères large 0x%02X 0x%02X non supportée après le nom de symbole débutant avec « %s »\n" + +#: mmo.c:1674 +#, c-format +msgid "%s: invalid mmo file: unsupported lopcode `%d'\n" +msgstr "%s: fichier mmo invalide: lopcode non supporté « %d »\n" + +#: mmo.c:1684 +#, c-format +msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n" +msgstr "%s: fichier mmo invalide: attendu YZ = 1 obtenu YZ = %d pour lop_quote\n" + +#: mmo.c:1720 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n" +msgstr "%s: fichier mmo invalide: attendu z = 1 ou z = 2, obtenu z = %d pour lop_loc\n" + +#: mmo.c:1766 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n" +msgstr "%s: fichier mmo invalide: attendu z = 1 ou z = 2, obtenu z = %d pour lop_fixo\n" + +#: mmo.c:1805 +#, c-format +msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n" +msgstr "%s: fichier mmo invalide: attendu y = 0, obtenu y = %d pour lop_fixrx\n" + +#: mmo.c:1814 +#, c-format +msgid "%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n" +msgstr "%s: fichier mmo invalide: attendu z = 16 ou z = 24, obtenu z = %d pour lop_fixrx\n" + +#: mmo.c:1837 +#, c-format +msgid "%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d for lop_fixrx\n" +msgstr "%s: fichier mmo invalide: octet de tête du mot de l'opérande doit être 0 ou 1, obtenu %d pour lop_fixrx\n" + +#: mmo.c:1860 +#, c-format +msgid "%s: cannot allocate file name for file number %d, %d bytes\n" +msgstr "%s: ne allouer un nom de ficheir pour le no. de fichier %d, %d octets\n" + +#: mmo.c:1880 +#, c-format +msgid "%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n" +msgstr "%s: fichier mmo invalide: no. de fichier %d « %s », a déjà été entré comme « %s »\n" + +#: mmo.c:1893 +#, c-format +msgid "%s: invalid mmo file: file name for number %d was not specified before use\n" +msgstr "%s: fichier mmo invalide: nom de fichier %d n'a pas été spécifié avant son utilisation\n" + +#: mmo.c:1999 +#, c-format +msgid "%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n" +msgstr "%s: fichier mmo invalide: champs y et z de lop_stab non null, y: %d, z: %d\n" + +#: mmo.c:2035 +#, c-format +msgid "%s: invalid mmo file: lop_end not last item in file\n" +msgstr "%s: fichier mmo invalide: lop_end N,est pas le dernier item dans le fichier\n" + +#: mmo.c:2048 +#, c-format +msgid "%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras to the preceding lop_stab (%ld)\n" +msgstr "%s: fichier mmo invalide: YZ de lop_end (%ld) n'est pas égal au nombre de teras du lop_stab précédent (%ld)\n" + +#: mmo.c:2698 +#, c-format +msgid "%s: invalid symbol table: duplicate symbol `%s'\n" +msgstr "%s: table de symboles invalides: duplication du symbole « %s »\n" + +#: mmo.c:2949 +#, c-format +msgid "%s: Bad symbol definition: `Main' set to %s rather than the start address %s\n" +msgstr "%s: définition de symbole erronée: « Main » initialisé à %s au lieu de l'adresse de départ %s\n" + +#: mmo.c:3039 +#, c-format +msgid "%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: %d. Only `Main' will be emitted.\n" +msgstr "%s: avertissement: table de symboles trop grande pour mmo, plus grande que 65535 mots de 32 bits: %d. Seul « Main » sera produit.\n" + +#: mmo.c:3084 +#, c-format +msgid "%s: internal error, symbol table changed size from %d to %d words\n" +msgstr "%s: erreur interne, table de symbole a changé de taille de %d à %d mots\n" + +#: mmo.c:3139 +#, c-format +msgid "%s: internal error, internal register section %s had contents\n" +msgstr "%s: erreur interne, registre interne de section %s a du contenu\n" + +#: mmo.c:3191 +#, c-format +msgid "%s: no initialized registers; section length 0\n" +msgstr "%s: pas de registres initialisés; section de longeur 0\n" + +#: mmo.c:3197 +#, c-format +msgid "%s: too many initialized registers; section length %ld\n" +msgstr "%s: trop de resigstres initialisés; longueur de section %ld\n" + +#: mmo.c:3202 +#, c-format +msgid "%s: invalid start address for initialized registers of length %ld: 0x%lx%08lx\n" +msgstr "%s: adresse de départ invalide pour des registres initialisés de longueur %ld: 0x%lx%08lx\n" + +#: oasys.c:1052 +#, c-format +msgid "%s: can not represent section `%s' in oasys" +msgstr "%s: ne peut représenter la section « %s » dans oasis" + +#: osf-core.c:137 +#, c-format +msgid "Unhandled OSF/1 core file section type %d\n" +msgstr "Type de section de fichier core OSF/1 non traité %d\n" + +#: pe-mips.c:659 +#, c-format +msgid "%s: `ld -r' not supported with PE MIPS objects\n" +msgstr "%s: « ld -r » non supporté avec les objets PE MIPS\n" + +#. OK, at this point the following variables are set up: +#. src = VMA of the memory we're fixing up +#. mem = pointer to memory we're fixing up +#. val = VMA of what we need to refer to +#. +#: pe-mips.c:795 +#, c-format +msgid "%s: unimplemented %s\n" +msgstr "%s: non implanté %s\n" + +#: pe-mips.c:821 +#, c-format +msgid "%s: jump too far away\n" +msgstr "%s: le saut va trop loin\n" + +#: pe-mips.c:848 +#, c-format +msgid "%s: bad pair/reflo after refhi\n" +msgstr "%s: pairage erronée pair/reflo après refhi\n" + +#. XXX code yet to be written. +#: peicode.h:787 +#, c-format +msgid "%s: Unhandled import type; %x" +msgstr "%s: type d'importation non traitée; %x" + +#: peicode.h:792 +#, c-format +msgid "%s: Unrecognised import type; %x" +msgstr "%s: type d'importation non reconnu; %x" + +#: peicode.h:806 +#, c-format +msgid "%s: Unrecognised import name type; %x" +msgstr "%s: type de nom d'importation non reconnu: %x" + +#: peicode.h:1164 +#, c-format +msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive" +msgstr "%s: type de machine non reconnue (0x%x) dans l'archive de librairie d'importation" + +#: peicode.h:1176 +#, c-format +msgid "%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive" +msgstr "%s: type de machine reconnue mais non traitée (0x%x) dans l'archive da la librairie de formats d'importation" + +#: peicode.h:1193 +#, c-format +msgid "%s: size field is zero in Import Library Format header" +msgstr "%s: taille du champ est zéro dans l'en-tête de la librairie de formats d'importation" + +#: peicode.h:1224 +#, c-format +msgid "%s: string not null terminated in ILF object file." +msgstr "%s: chaîne n'est pas terminée par un nulle dans le fichier objet ILF." + +#: ppcboot.c:416 +msgid "" +"\n" +"ppcboot header:\n" +msgstr "" +"\n" +"En-têtes ppcboot:\n" + +#: ppcboot.c:417 +#, c-format +msgid "Entry offset = 0x%.8lx (%ld)\n" +msgstr "Décalage de l'entrée= 0x%.8lx (%ld)\n" + +#: ppcboot.c:418 +#, c-format +msgid "Length = 0x%.8lx (%ld)\n" +msgstr "Longueur = 0x%.8lx (%ld)\n" + +#: ppcboot.c:421 +#, c-format +msgid "Flag field = 0x%.2x\n" +msgstr "Champ de fanion = 0x%.2x\n" + +#: ppcboot.c:427 +#, c-format +msgid "Partition name = \"%s\"\n" +msgstr "Nom de partition = « %s »\n" + +#: ppcboot.c:446 +#, c-format +msgid "" +"\n" +"Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "" +"\n" +"Début de partition[%d] = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:452 +#, c-format +msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "Fin de la partition[%d] = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:458 +#, c-format +msgid "Partition[%d] sector = 0x%.8lx (%ld)\n" +msgstr "Secteur de la partition[%d] = 0x%.8lx (%ld)\n" + +#: ppcboot.c:459 +#, c-format +msgid "Partition[%d] length = 0x%.8lx (%ld)\n" +msgstr "Longueur de la partition[%d] = 0x%.8lx (%ld)\n" + +#: som.c:5422 +msgid "som_sizeof_headers unimplemented" +msgstr "som_sizeof_headers non implanté" + +#: srec.c:302 +#, c-format +msgid "%s:%d: Unexpected character `%s' in S-record file\n" +msgstr "%s:%d: caractère inattendue « %s » dans le fichier S-record\n" + +#: stabs.c:319 +#, c-format +msgid "%s(%s+0x%lx): Stabs entry has invalid string index." +msgstr "%s(%s+0x%lx): entrée des talons a une chaîne index invalide" + +#: syms.c:1019 +msgid "Unsupported .stab relocation" +msgstr "Relocalisation du .stab non supporté" + +#: vms-gsd.c:356 +#, c-format +msgid "bfd_make_section (%s) failed" +msgstr "Échec de bfd_make_section (%s)" + +#: vms-gsd.c:371 +#, c-format +msgid "bfd_set_section_flags (%s, %x) failed" +msgstr "bfd_set_section_flags (%s, %x) a échoué" + +#: vms-gsd.c:407 +#, c-format +msgid "Size mismatch section %s=%lx, %s=%lx" +msgstr "Taille de section ne concorde pas %s=%lx, %s=%lx" + +#: vms-gsd.c:704 +#, c-format +msgid "unknown gsd/egsd subtype %d" +msgstr "sous type gsd/egsd inconnu %d" + +#: vms-hdr.c:408 +msgid "Object module NOT error-free !\n" +msgstr "Module objet N'EST PAS sans erreur !\n" + +#: vms-misc.c:541 +#, c-format +msgid "Stack overflow (%d) in _bfd_vms_push" +msgstr "Débordement de la pile (%d) dans _bfd_vms_push" + +#: vms-misc.c:559 +msgid "Stack underflow in _bfd_vms_pop" +msgstr "Sous dépilage de la pile dans _bfd_vms_pop" + +#: vms-misc.c:918 +msgid "_bfd_vms_output_counted called with zero bytes" +msgstr "_bfd_vms_output_counted appelé avec un compte de zéro octet" + +#: vms-misc.c:923 +msgid "_bfd_vms_output_counted called with too many bytes" +msgstr "_bfd_vms_output_counted appelé avec trop d'octets" + +#: vms-misc.c:1054 +#, c-format +msgid "Symbol %s replaced by %s\n" +msgstr "Symbole %s remplacé par %s\n" + +#: vms-misc.c:1117 +#, c-format +msgid "failed to enter %s" +msgstr "échec d'insertion de %s" + +#: vms-tir.c:102 +msgid "No Mem !" +msgstr "Mémoire épuisée!" + +#: vms-tir.c:383 +#, c-format +msgid "bad section index in %s" +msgstr "index de section erronée dans %s" + +#: vms-tir.c:396 +#, c-format +msgid "unsupported STA cmd %s" +msgstr "commande STA non supportée %s" + +#: vms-tir.c:401 vms-tir.c:1261 +#, c-format +msgid "reserved STA cmd %d" +msgstr "commande STA réservée %d" + +#: vms-tir.c:512 vms-tir.c:535 +#, c-format +msgid "%s: no symbol \"%s\"" +msgstr "%s: pas de symbole \"%s\"" + +#. unsigned shift +#. rotate +#. Redefine symbol to current location. +#. Define a literal. +#: vms-tir.c:602 vms-tir.c:714 vms-tir.c:824 vms-tir.c:842 vms-tir.c:850 +#: vms-tir.c:859 vms-tir.c:1584 +#, c-format +msgid "%s: not supported" +msgstr "%s: pas supporté" + +#: vms-tir.c:607 vms-tir.c:1439 +#, c-format +msgid "%s: not implemented" +msgstr "%s: non implanté" + +#: vms-tir.c:611 vms-tir.c:1443 +#, c-format +msgid "reserved STO cmd %d" +msgstr "commande STO réservée %d" + +#: vms-tir.c:729 vms-tir.c:1589 +#, c-format +msgid "reserved OPR cmd %d" +msgstr "commande OPR réservée %d" + +#: vms-tir.c:797 vms-tir.c:1653 +#, c-format +msgid "reserved CTL cmd %d" +msgstr "commande CTL réservée %d" + +#. stack byte from image +#. arg: none. +#: vms-tir.c:1169 +msgid "stack-from-image not implemented" +msgstr "pile depuis l'image non implanté" + +#: vms-tir.c:1187 +msgid "stack-entry-mask not fully implemented" +msgstr "masque de pile d'entrée pas complètement implanté" + +#. compare procedure argument +#. arg: cs symbol name +#. by argument index +#. da argument descriptor +#. +#. compare argument descriptor with symbol argument (ARG$V_PASSMECH) +#. and stack TRUE (args match) or FALSE (args dont match) value. +#: vms-tir.c:1201 +msgid "PASSMECH not fully implemented" +msgstr "PASSMECH pas complètement implanté" + +#: vms-tir.c:1220 +msgid "stack-local-symbol not fully implemented" +msgstr "symbole local de pile pas complètement implanté" + +#: vms-tir.c:1233 +msgid "stack-literal not fully implemented" +msgstr "litéral de pile pas complètement implanté" + +#: vms-tir.c:1254 +msgid "stack-local-symbol-entry-point-mask not fully implemented" +msgstr "masque du symbole local de point d'entrée de pile pas complètement implanté" + +#: vms-tir.c:1531 vms-tir.c:1543 vms-tir.c:1555 vms-tir.c:1567 vms-tir.c:1632 +#: vms-tir.c:1640 vms-tir.c:1648 +#, c-format +msgid "%s: not fully implemented" +msgstr "%s: pas complètement implanté" + +#: vms-tir.c:1705 +#, c-format +msgid "obj code %d not found" +msgstr "code objet %d non repéré" + +#: vms-tir.c:2043 +#, c-format +msgid "SEC_RELOC with no relocs in section %s" +msgstr "SEC_RELOC sans relocalisation dans la section %s" + +#: vms-tir.c:2331 +#, c-format +msgid "Unhandled relocation %s" +msgstr "Relocalisation non traitée: %s" + +#: xcofflink.c:1244 +#, c-format +msgid "%s: `%s' has line numbers but no enclosing section" +msgstr "%s: « %s » contient des numéros de lignes mais de section de fermeture" + +#: xcofflink.c:1297 +#, c-format +msgid "%s: class %d symbol `%s' has no aux entries" +msgstr "%s: classe %d symbole « %s » n'a pas d'entrée auxiliaire" + +#: xcofflink.c:1320 +#, c-format +msgid "%s: symbol `%s' has unrecognized csect type %d" +msgstr "%s: symbole « %s » a un type csect non reconnu %d" + +#: xcofflink.c:1332 +#, c-format +msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d" +msgstr "%s: symbole XTY_ER erroné « %s »: classe %d scnum %d scnlen %d" + +#: xcofflink.c:1368 +#, c-format +msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d" +msgstr "%s: XMC_TC0 symbol « %s » est la classe %d scnlen %d" + +#: xcofflink.c:1520 +#, c-format +msgid "%s: csect `%s' not in enclosing section" +msgstr "%s: csect « %s » n'est pas dans un section fermée" + +#: xcofflink.c:1627 +#, c-format +msgid "%s: misplaced XTY_LD `%s'" +msgstr "%s: XTY_LD mal placé « %s »" + +#: xcofflink.c:1958 +#, c-format +msgid "%s: reloc %s:%d not in csect" +msgstr "%s: relocalisation %s:%d n'est pas dans csect" + +#: xcofflink.c:2095 +#, c-format +msgid "%s: XCOFF shared object when not producing XCOFF output" +msgstr "%s: objet XCOFF partagé sans être en production de sortie XCOFF" + +#: xcofflink.c:2116 +#, c-format +msgid "%s: dynamic object with no .loader section" +msgstr "%s: objet dynamique sans section .loader" + +#: xcofflink.c:2761 +#, c-format +msgid "%s: no such symbol" +msgstr "%s: pas de tel symbole" + +#: xcofflink.c:2894 +msgid "error: undefined symbol __rtinit" +msgstr "erreur: symbole __rtinit indéfini" + +#: xcofflink.c:3455 +#, c-format +msgid "warning: attempt to export undefined symbol `%s'" +msgstr "AVERTISSEMENT: tentative d'exportation d'un symbole indéfini « %s »" + +#: xcofflink.c:4448 +#, c-format +msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling" +msgstr "Débordement de la table des entrées: 0x%lx > 0x10000; essayer l'option -mminimal-toc" + +#: xcofflink.c:5288 xcofflink.c:5755 xcofflink.c:5817 xcofflink.c:6119 +#, c-format +msgid "%s: loader reloc in unrecognized section `%s'" +msgstr "%s: chargeur de relocalisation dans une section non reconnnue « %s »" + +#: xcofflink.c:5310 xcofflink.c:6130 +#, c-format +msgid "%s: `%s' in loader reloc but not loader sym" +msgstr "%s: « %s » est dans le chargeur de relocalisation mais pas dans celui des symboles" + +#: xcofflink.c:5325 +#, c-format +msgid "%s: loader reloc in read-only section %s" +msgstr "%s: chargeur de relocalisation dans un section en lecture seulement %s" + +#: elf32-ia64.c:2392 elf64-ia64.c:2392 +msgid "@pltoff reloc against local symbol" +msgstr "relocalisation @pltoff vers un symbole local" + +#: elf32-ia64.c:3804 elf64-ia64.c:3804 +#, c-format +msgid "%s: short data segment overflowed (0x%lx >= 0x400000)" +msgstr "%s: débordement du segment de données court (0x%lx >= 0x400000)" + +#: elf32-ia64.c:3815 elf64-ia64.c:3815 +#, c-format +msgid "%s: __gp does not cover short data segment" +msgstr "%s: __gp ne couvre pas ce segment de données court" + +#: elf32-ia64.c:4131 elf64-ia64.c:4131 +#, c-format +msgid "%s: linking non-pic code in a shared library" +msgstr "%s: liaison de code non-pic dans une librairie partagée" + +#: elf32-ia64.c:4164 elf64-ia64.c:4164 +#, c-format +msgid "%s: @gprel relocation against dynamic symbol %s" +msgstr "%s: relocalisation @gprel vers le symbole dynamique %s" + +#: elf32-ia64.c:4224 elf64-ia64.c:4224 +#, c-format +msgid "%s: linking non-pic code in a position independent executable" +msgstr "%s: liaison de code non-pic dans un exécutable à position indépendante" + +#: elf32-ia64.c:4363 elf64-ia64.c:4363 +#, c-format +msgid "%s: @internal branch to dynamic symbol %s" +msgstr "%s: relocalisation @internal vers le symbole dynamique %s" + +#: elf32-ia64.c:4365 elf64-ia64.c:4365 +#, c-format +msgid "%s: speculation fixup to dynamic symbol %s" +msgstr "%s: spéculation d'ajustements vers un symbole dynamique %s" + +#: elf32-ia64.c:4367 elf64-ia64.c:4367 +#, c-format +msgid "%s: @pcrel relocation against dynamic symbol %s" +msgstr "%s: relocalisation @pcrel vers le symbole dynamique %s" + +#: elf32-ia64.c:4579 elf64-ia64.c:4579 +msgid "unsupported reloc" +msgstr "relocalisation non supportée" + +#: elf32-ia64.c:4858 elf64-ia64.c:4858 +#, c-format +msgid "%s: linking trap-on-NULL-dereference with non-trapping files" +msgstr "%s: édition de liens trap-on-NULL-dereference avec des fichiers non-trapping" + +#: elf32-ia64.c:4867 elf64-ia64.c:4867 +#, c-format +msgid "%s: linking big-endian files with little-endian files" +msgstr "" +"%s: édition de liens pour des fichiers en système à octets de poids fort\n" +"avec des fichiers pour des systèmes à octets de poids faible" + +#: elf32-ia64.c:4876 elf64-ia64.c:4876 +#, c-format +msgid "%s: linking 64-bit files with 32-bit files" +msgstr "%s: édition de liens de fichiers de 64 bits avec des fichiers de 32 bits" + +#: elf32-ia64.c:4885 elf64-ia64.c:4885 +#, c-format +msgid "%s: linking constant-gp files with non-constant-gp files" +msgstr "%s: édition de liens de fichiers constant-gp avec des fichier non-constant-gp" + +#: elf32-ia64.c:4895 elf64-ia64.c:4895 +#, c-format +msgid "%s: linking auto-pic files with non-auto-pic files" +msgstr "%s: édition de liens de fichiers auto-pic avec des fichiers non-auto-pic" + +#: peigen.c:985 pepigen.c:985 +#, c-format +msgid "%s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: débordement du nombre de lignes: 0x%lx > 0xffff" + +#: peigen.c:1002 pepigen.c:1002 +#, c-format +msgid "%s: reloc overflow 1: 0x%lx > 0xffff" +msgstr "%s: débordement de la relocalisation 1: 0x%lx > 0xffff" + +#: peigen.c:1016 pepigen.c:1016 +msgid "Export Directory [.edata (or where ever we found it)]" +msgstr "Répertoire d'exportation [.edata (ou là où il a été repéré)]" + +#: peigen.c:1017 pepigen.c:1017 +msgid "Import Directory [parts of .idata]" +msgstr "Répertoire d'importation [faisant partie de .idata]" + +#: peigen.c:1018 pepigen.c:1018 +msgid "Resource Directory [.rsrc]" +msgstr "Répertoire des resources [.rsrc]" + +#: peigen.c:1019 pepigen.c:1019 +msgid "Exception Directory [.pdata]" +msgstr "Répertoire des exceptions [.pdata]" + +#: peigen.c:1020 pepigen.c:1020 +msgid "Security Directory" +msgstr "Répertoire de la sécurité" + +#: peigen.c:1021 pepigen.c:1021 +msgid "Base Relocation Directory [.reloc]" +msgstr "Répertoire de base de relocalisation [.reloc]" + +#: peigen.c:1022 pepigen.c:1022 +msgid "Debug Directory" +msgstr "Répertoire de débug" + +#: peigen.c:1023 pepigen.c:1023 +msgid "Description Directory" +msgstr "Répertoire de description" + +#: peigen.c:1024 pepigen.c:1024 +msgid "Special Directory" +msgstr "Répertoire spécial" + +#: peigen.c:1025 pepigen.c:1025 +msgid "Thread Storage Directory [.tls]" +msgstr "Répertoire des files de stockage [.tls]" + +#: peigen.c:1026 pepigen.c:1026 +msgid "Load Configuration Directory" +msgstr "Répertoire de chargement de configuration" + +#: peigen.c:1027 pepigen.c:1027 +msgid "Bound Import Directory" +msgstr "Répertoire des importations limitées" + +#: peigen.c:1028 pepigen.c:1028 +msgid "Import Address Table Directory" +msgstr "Répertoire de la table d'adresse d'importation" + +#: peigen.c:1029 pepigen.c:1029 +msgid "Delay Import Directory" +msgstr "Répertoire des délais d'importation" + +#: peigen.c:1030 peigen.c:1031 pepigen.c:1030 pepigen.c:1031 +msgid "Reserved" +msgstr "Réservé" + +#: peigen.c:1094 pepigen.c:1094 +msgid "" +"\n" +"There is an import table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Il y a une table d'importation, mais la section la contenant ne peut être repérée\n" + +#: peigen.c:1099 pepigen.c:1099 +#, c-format +msgid "" +"\n" +"There is an import table in %s at 0x%lx\n" +msgstr "" +"\n" +"Il y a une table d'importation dans %s à 0x%lx\n" + +#: peigen.c:1136 pepigen.c:1136 +#, c-format +msgid "" +"\n" +"Function descriptor located at the start address: %04lx\n" +msgstr "" +"\n" +"Descripteur de fonction localisé à l'adresse de départ: %04lx\n" + +#: peigen.c:1139 pepigen.c:1139 +#, c-format +msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n" +msgstr "\tcode-base %08lx tab. des entrées (chargeable/actuel) %08lx/%08lx\n" + +#: peigen.c:1145 pepigen.c:1145 +msgid "" +"\n" +"No reldata section! Function descriptor not decoded.\n" +msgstr "" +"\n" +"Pas de section reldata! Descripteur de fonction n'a pas été décodé.\n" + +#: peigen.c:1150 pepigen.c:1150 +#, c-format +msgid "" +"\n" +"The Import Tables (interpreted %s section contents)\n" +msgstr "" +"\n" +"Les tables d'importation (contenus interprétés de la section %s)\n" + +#: peigen.c:1153 pepigen.c:1153 +msgid "" +" vma: Hint Time Forward DLL First\n" +" Table Stamp Chain Name Thunk\n" +msgstr "" +" vma: Hint Temps Avant DLL Premier\n" +" Table Estampil. Chaîne Nom Thunk\n" + +#: peigen.c:1204 pepigen.c:1204 +#, c-format +msgid "" +"\n" +"\tDLL Name: %s\n" +msgstr "" +"\n" +"\tNom DLL: %s\n" + +#: peigen.c:1215 pepigen.c:1215 +msgid "\tvma: Hint/Ord Member-Name Bound-To\n" +msgstr "\tvma: Hint/Ord Membre Lien\n" + +#: peigen.c:1240 pepigen.c:1240 +msgid "" +"\n" +"There is a first thunk, but the section containing it could not be found\n" +msgstr "" +"\n" +"Il y a un premier « thunk », mais la section le contenant ne peut être repérée\n" + +#: peigen.c:1380 pepigen.c:1380 +msgid "" +"\n" +"There is an export table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Il y a une table d'exportation, mais la section la contenant n'a pu être repérée\n" + +#: peigen.c:1385 pepigen.c:1385 +#, c-format +msgid "" +"\n" +"There is an export table in %s at 0x%lx\n" +msgstr "" +"\n" +"Il y a une table d'exportation dans %s à 0x%lx\n" + +#: peigen.c:1416 pepigen.c:1416 +#, c-format +msgid "" +"\n" +"The Export Tables (interpreted %s section contents)\n" +"\n" +msgstr "" +"\n" +"Les tables d'exportation (contenus interprétés de la section %s)\n" +"\n" + +#: peigen.c:1420 pepigen.c:1420 +#, c-format +msgid "Export Flags \t\t\t%lx\n" +msgstr "Fanion d'exportation \t\t\t%lx\n" + +#: peigen.c:1423 pepigen.c:1423 +#, c-format +msgid "Time/Date stamp \t\t%lx\n" +msgstr "Tampon Heure/Date \t\t%lx\n" + +#: peigen.c:1426 pepigen.c:1426 +#, c-format +msgid "Major/Minor \t\t\t%d/%d\n" +msgstr "Majeur/Mineur \t\t\t%d/%d\n" + +#: peigen.c:1429 pepigen.c:1429 +msgid "Name \t\t\t\t" +msgstr "Nom \t\t\t\t" + +#: peigen.c:1435 pepigen.c:1435 +#, c-format +msgid "Ordinal Base \t\t\t%ld\n" +msgstr "base de nombre ordinal \t\t\t%ld\n" + +#: peigen.c:1438 pepigen.c:1438 +msgid "Number in:\n" +msgstr "Numéro dans:\n" + +#: peigen.c:1441 pepigen.c:1441 +#, c-format +msgid "\tExport Address Table \t\t%08lx\n" +msgstr "\tTable d'adresses d'exportation \t\t%08lx\n" + +#: peigen.c:1445 pepigen.c:1445 +#, c-format +msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n" +msgstr "\tTable de noms [Pointeur/Nombre ordinal]\t%08lx\n" + +#: peigen.c:1448 pepigen.c:1448 +msgid "Table Addresses\n" +msgstr "Table d'adresses\n" + +#: peigen.c:1451 pepigen.c:1451 +msgid "\tExport Address Table \t\t" +msgstr "\tTable d'adresse d'exportation \t\t" + +#: peigen.c:1456 pepigen.c:1456 +msgid "\tName Pointer Table \t\t" +msgstr "\tTable des noms de pointeurs \t\t" + +#: peigen.c:1461 pepigen.c:1461 +msgid "\tOrdinal Table \t\t\t" +msgstr "\tTable des ordinals \t\t\t" + +#: peigen.c:1476 pepigen.c:1476 +#, c-format +msgid "" +"\n" +"Export Address Table -- Ordinal Base %ld\n" +msgstr "" +"\n" +"Table d'adresses d'exportation -- base de nombre ordinal %ld\n" + +#: peigen.c:1495 pepigen.c:1495 +msgid "Forwarder RVA" +msgstr "Adresseur RVA" + +#: peigen.c:1506 pepigen.c:1506 +msgid "Export RVA" +msgstr "Exportation RVA" + +#: peigen.c:1513 pepigen.c:1513 +msgid "" +"\n" +"[Ordinal/Name Pointer] Table\n" +msgstr "" +"\n" +"Table [Ordinal/Nom de pointeurs]\n" + +#: peigen.c:1568 pepigen.c:1568 +#, c-format +msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n" +msgstr "AVERTISSEMENT, taille de la section .pdata (%ld) n'est pas un multiple de %d\n" + +#: peigen.c:1572 pepigen.c:1572 +msgid "" +"\n" +"The Function Table (interpreted .pdata section contents)\n" +msgstr "" +"\n" +"La table de fonctions (interprétation du contenu de la section .pdata)\n" + +#: peigen.c:1575 pepigen.c:1575 +msgid " vma:\t\t\tBegin Address End Address Unwind Info\n" +msgstr " vma:\t\t\tDébut Adresse Fin Adresse Unwind Info\n" + +#: peigen.c:1577 pepigen.c:1577 +msgid "" +" vma:\t\tBegin End EH EH PrologEnd Exception\n" +" \t\tAddress Address Handler Data Address Mask\n" +msgstr "" +" vma:\t\tDébut Fin EH EH FinProlog Exception\n" +" \t\tAdresse Adresse Handler Données Adresse Masque\n" + +#: peigen.c:1647 pepigen.c:1647 +msgid " Register save millicode" +msgstr " Registre a préservé le millicode" + +#: peigen.c:1650 pepigen.c:1650 +msgid " Register restore millicode" +msgstr " Registre a restauré le millicode" + +#: peigen.c:1653 pepigen.c:1653 +msgid " Glue code sequence" +msgstr " Séquence du code de liants" + +#: peigen.c:1705 pepigen.c:1705 +msgid "" +"\n" +"\n" +"PE File Base Relocations (interpreted .reloc section contents)\n" +msgstr "" +"\n" +"\n" +"Fichier de base des relocalisation PE (contenus interprétés de la section .reloc)\n" + +#: peigen.c:1735 pepigen.c:1735 +#, c-format +msgid "" +"\n" +"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n" +msgstr "" +"\n" +"Adresse virtuelle: %08lx taille des morceaux %ld (0x%lx) nombre de correctifs %ld\n" + +#: peigen.c:1748 pepigen.c:1748 +#, c-format +msgid "\treloc %4d offset %4x [%4lx] %s" +msgstr "\trelocalisation %4d décalage %4x [%4lx] %s" + +#. The MS dumpbin program reportedly ands with 0xff0f before +#. printing the characteristics field. Not sure why. No reason to +#. emulate it here. +#: peigen.c:1788 pepigen.c:1788 +#, c-format +msgid "" +"\n" +"Characteristics 0x%x\n" +msgstr "" +"\n" +"Caractéristiques 0x%x\n" + +#~ msgid "%s: Unknown special linker type %d" +#~ msgstr "%s: type d'édition spécial de lien inconnu %d" + +#~ msgid "v850ea architecture" +#~ msgstr "architecture v850ea" + +#~ msgid "%s: Section %s is too large to add hole of %ld bytes" +#~ msgstr "%s: section %s est trop grande pour ajouter un trou de %ld octets" + +#~ msgid "Error: out of memory" +#~ msgstr "Erreur: mémoire épuisée" + +#~ msgid "warning: relocation against removed section; zeroing" +#~ msgstr "AVERTISSEMENT: relocalisation vers une section qui a été enlevée; mise à zéro" + +#~ msgid "warning: relocation against removed section" +#~ msgstr "AVERTISSEMENT: relocalisation vers une section enlevée" + +#~ msgid "local symbols in discarded section %s" +#~ msgstr "symboles locaux de la section mise à l'écart %s" + +#~ msgid "%s: linking abicalls files with non-abicalls files" +#~ msgstr "%s: édition de liens des fichier abicalls avec des fichiers non abicalls" + +#~ msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)" +#~ msgstr "%s: ISA ne concorde pas (-mips%d) avec les modules précédents (-mips%d)" + +#~ msgid "%s: ISA mismatch (%d) with previous modules (%d)" +#~ msgstr "%s: ISA ne concorde pas (%d) avec les modules précédents (%d)" + +#~ msgid "%s: dynamic relocation against speculation fixup" +#~ msgstr "%s: relocalisation dynamique vers un correctif spéculé" + +#~ msgid "%s: speculation fixup against undefined weak symbol" +#~ msgstr "%s: correctif spéculé vers un symbole faible indéfini" + +#~ msgid "\tThe Import Address Table (difference found)\n" +#~ msgstr "\tL'adresse de la table d'importation (différence détectée)\n" + +#~ msgid "\t>>> Ran out of IAT members!\n" +#~ msgstr "\t>>> membres IAT tous utilisés!\n" + +#~ msgid "\tThe Import Address Table is identical\n" +#~ msgstr "\tL'adresse de la table d'importation est identique\n" + +#~ msgid "GP relative relocation when GP not defined" +#~ msgstr "GP relocalisation relative alors que GP n'est pas défini" + +#~ msgid "%s: ERROR: passes floats in float registers whereas target %s uses integer registers" +#~ msgstr "%s: ERREUR: passage de valeurs en virgule flottante dans des registreen virgule flottance alors que la cible %s utilise des registres de valeursentières" + +#~ msgid "%s: ERROR: passes floats in integer registers whereas target %s uses float registers" +#~ msgstr "%s: ERREUR: passage de valeurs en virgule flottante dans des registreen valeur entière alors que la cible %s utilise des registres de valeursen virgule flottante" + +#~ msgid "Warning: input file %s supports interworking, whereas %s does not." +#~ msgstr "AVERTISSEMENT: file d'entrée %s supporte l'inter-réseautage, contrairement à %s." + +#~ msgid "Warning: input file %s does not support interworking, whereas %s does." +#~ msgstr "AVERTISSEMENT: fichier d'entrée %s ne supporte pas l'inter-réseautage, contrairement à %s." + +#~ msgid "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld" +#~ msgstr "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld prochain %ld" + +#~ msgid "elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = 0x%.8lx%s\n" +#~ msgstr "elf_symbol_from_bfd_symbol 0x%.8lx, nom = %s, no. de symbole = %d, fanions = 0x%.8lx%s\n" + +#~ msgid "Warning: Not setting interwork flag of %s since it has already been specified as non-interworking" +#~ msgstr "AVERTISSEMENT: pas d'initialisation du fanion d'inter-réseautage %s alors qu'il a déjè été spécifié sans inter-réseautage" + +#~ msgid "Warning: Clearing the interwork flag of %s due to outside request" +#~ msgstr "AVERTISSEMENT: mise à zéro du fanion d'inter-réseautage %s en raison d'une requête externe" + +#~ msgid " [APCS-26]" +#~ msgstr " [APCS-26]" + +#~ msgid " [APCS-32]" +#~ msgstr " [APCS-32]" + +#~ msgid "(unknown)" +#~ msgstr "(inconnu)" + +#~ msgid " previously %s in %s" +#~ msgstr " précédemment %s dans %s" + +#~ msgid "Symbol `%s' has differing types: %s in %s" +#~ msgstr "Symbole « %s » a des types qui diffèrent: %s dans %s" + +#~ msgid "ETIR_S_C_STO_GBL: no symbol \"%s\"" +#~ msgstr "ETIR_S_C_STO_GBL: pas de symbole « %s »" + +#~ msgid "ETIR_S_C_STO_CA: no symbol \"%s\"" +#~ msgstr "ETIR_S_C_STO_CA: pas de symbole « %s »" + +#~ msgid "ETIR_S_C_STO_RB/AB: Not supported" +#~ msgstr "ETIR_S_C_STO_RB/AB: non supporté" + +#~ msgid "ETIR_S_C_STO_LP_PSB: Not supported" +#~ msgstr "ETIR_S_C_STO_LP_PSB: non supporté" + +#~ msgid "ETIR_S_C_STO_HINT_GBL: not implemented" +#~ msgstr "ETIR_S_C_STO_HINT_GBL: pas implanté" + +#~ msgid "ETIR_S_C_STO_HINT_PS: not implemented" +#~ msgstr "ETIR_S_C_STO_HINT_PS: pas implanté" + +#~ msgid "ETIR_S_C_OPR_INSV: Not supported" +#~ msgstr "ETIR_S_C_OPR_INSV: non supporté" + +#~ msgid "ETIR_S_C_OPR_USH: Not supported" +#~ msgstr "ETIR_S_C_OPR_USH: non supporté" + +#~ msgid "ETIR_S_C_OPR_ROT: Not supported" +#~ msgstr "ETIR_S_C_OPR_ROT: non supporté" + +#~ msgid "ETIR_S_C_OPR_REDEF: Not supported" +#~ msgstr "ETIR_S_C_OPR_REDEF: non supporté" + +#~ msgid "ETIR_S_C_OPR_DFLIT: Not supported" +#~ msgstr "ETIR_S_C_OPR_DFLIT: non supporté" + +#~ msgid "ETIR_S_C_STC_LP: not supported" +#~ msgstr "ETIR_S_C_STC_LP: non supporté" + +#~ msgid "ETIR_S_C_STC_GBL: not supported" +#~ msgstr "ETIR_S_C_STC_GBL: non supporté" + +#~ msgid "ETIR_S_C_STC_GCA: not supported" +#~ msgstr "ETIR_S_C_STC_GCA: non supporté" + +#~ msgid "ETIR_S_C_STC_PS: not supported" +#~ msgstr "ETIR_S_C_STC_PS: non supporté" + +#~ msgid "Unimplemented STO cmd %d" +#~ msgstr "Commande STO non implantée %d" + +#~ msgid "TIR_S_C_OPR_ASH incomplete" +#~ msgstr "TIR_S_C_OPR_ASH incomplète" + +#~ msgid "TIR_S_C_OPR_USH incomplete" +#~ msgstr "TIR_S_C_OPR_USH incomplète" + +#~ msgid "TIR_S_C_OPR_ROT incomplete" +#~ msgstr "TIR_S_C_OPR_ROT incomplète" + +#~ msgid "TIR_S_C_OPR_REDEF not supported" +#~ msgstr "TIR_S_C_OPR_REDEF non supporté" + +#~ msgid "TIR_S_C_OPR_DFLIT not supported" +#~ msgstr "TIR_S_C_OPR_DFLIT non supporté" + +#~ msgid "TIR_S_C_CTL_DFLOC not fully implemented" +#~ msgstr "TIR_S_C_CTL_DFLOC pas complètement implanté" + +#~ msgid "TIR_S_C_CTL_STLOC not fully implemented" +#~ msgstr "TIR_S_C_CTL_STLOC pas complètement implanté" + +#~ msgid "TIR_S_C_CTL_STKDL not fully implemented" +#~ msgstr "TIR_S_C_CTL_STKDL n'est pas complètement implanté" + +#~ msgid " vma: Hint Time Forward DLL First\n" +#~ msgstr " vma: Hint Heure Forward DLL Premier\n" + +#~ msgid " \t\tAddress Address Handler Data Address Mask\n" +#~ msgstr " \t\tAdresse Adresse Routine Données Adresse Masque\n" + +#~ msgid "integer" +#~ msgstr "entier" + +#~ msgid "soft" +#~ msgstr "logiciel" + +#~ msgid "hard" +#~ msgstr "matériel" + +#~ msgid "Warning: %s %s interworking, whereas %s %s" +#~ msgstr "Warning: %s %s inter-réseautage, alors que %s %s" + +#~ msgid "supports" +#~ msgstr "supporte" + +#~ msgid "does not" +#~ msgstr "n'est pas" + +#~ msgid "does" +#~ msgstr "est" + +#~ msgid "%s(%s+0x%lx): cannot find stub entry %s" +#~ msgstr "%s(%s+0x%lx): ne peut repérer l'entrée du talon %s" + +#~ msgid "%s(%s+0x%lx): cannot relocate %s, recompile with -ffunction-sections" +#~ msgstr "%s(%s+0x%lx): ne peut relocaliser %s, recompiler avec -ffunction-sections" + +#~ msgid "creating section symbol, name = %s, value = 0x%.8lx, index = %d, section = 0x%.8lx\n" +#~ msgstr "création de la section des symboles, nom = %s, valeur = 0x%.8lx, index = %d, section = 0x%.8lx\n" + +#~ msgid " whereas segment starts at 0x%x" +#~ msgstr " alors que le segment débute à 0x%x" diff --git a/bfd/po/ja.gmo b/bfd/po/ja.gmo new file mode 100644 index 0000000000000..f8142480577e2 Binary files /dev/null and b/bfd/po/ja.gmo differ diff --git a/bfd/po/ja.po b/bfd/po/ja.po new file mode 100644 index 0000000000000..9373b275a0856 --- /dev/null +++ b/bfd/po/ja.po @@ -0,0 +1,2848 @@ +# Japanese message for bfd 2.11 +# Copyright (C) 2001 Free Software Foundation, Inc. +# Daisuke Yamashita , 2001 +# +msgid "" +msgstr "" +"Project-Id-Version: bfd 2.11\n" +"POT-Creation-Date: 2002-01-31 17:07+0000\n" +"PO-Revision-Date: 2001-12-22 13:37+0900\n" +"Last-Translator: Daisuke Yamashita \n" +"Language-Team: Japanese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=EUC-JP\n" +"Content-Transfer-Encoding: 8bit\n" + +#: aout-adobe.c:196 +#, c-format +msgid "%s: Unknown section type in a.out.adobe file: %x\n" +msgstr "%s: a.out.adobe ¥Õ¥¡¥¤¥ë¤ËÉÔÌÀ¤Ê¥»¥¯¥·¥ç¥ó·¿¤¬¤¢¤ê¤Þ¤¹: %x\n" + +#: aout-cris.c:208 +#, c-format +msgid "%s: Invalid relocation type exported: %d" +msgstr "%s: export ¤µ¤ì¤¿ºÆÇÛÃÖ¥¿¥¤¥×¤¬ÉÔŬÀڤǤ¹: %d" + +#: aout-cris.c:252 +#, c-format +msgid "%s: Invalid relocation type imported: %d" +msgstr "%s: import ¤µ¤ì¤¿ºÆÇÛÃÖ¥¿¥¤¥×¤¬ÉÔŬÀڤǤ¹: %d" + +#: aout-cris.c:263 +#, c-format +msgid "%s: Bad relocation record imported: %d" +msgstr "%s: import ¤µ¤ì¤¿ºÆÇÛÃ֥쥳¡¼¥É¤¬ÉÔÀµ¤Ç¤¹: %d" + +#: aoutx.h:1282 aoutx.h:1699 +#, c-format +msgid "%s: can not represent section `%s' in a.out object file format" +msgstr "%s: a.out ¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë·Á¼°¤Ç¤Ï¥»¥¯¥·¥ç¥ó `%s' ¤òɽ¸½¤Ç¤­¤Þ¤»¤ó" + +#: aoutx.h:1669 +#, c-format +msgid "" +"%s: can not represent section for symbol `%s' in a.out object file format" +msgstr "" +"%s: a.out ¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë·Á¼°¤Ç¤Ï¥·¥ó¥Ü¥ë `%s' ÍѤΥ»¥¯¥·¥ç¥ó¤òɽ¸½¤Ç¤­" +"¤Þ¤»¤ó" + +#: aoutx.h:1671 +msgid "*unknown*" +msgstr "*ÉÔ ÌÀ*" + +#: aoutx.h:3735 +#, c-format +msgid "%s: relocateable link from %s to %s not supported" +msgstr "%s: %s ¤«¤é %s ¤Ø¤ÎºÆÇÛÃÖ²Äǽ¥ê¥ó¥¯¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: archive.c:1826 +msgid "Warning: writing archive was slow: rewriting timestamp\n" +msgstr "·Ù¹ð: ½ñ¸Ë¤Ø¤Î½ñ¤­¹þ¤ß¤¬ÃÙ¤ì¤Þ¤·¤¿: ¥¿¥¤¥à¥¹¥¿¥ó¥×¤ò½ñ¤­´¹¤¨¤Þ¤¹\n" + +#: archive.c:2093 +msgid "Reading archive file mod timestamp" +msgstr "½ñ¸Ë¥Õ¥¡¥¤¥ë¤Î½¤Àµ»þ¹ïÆÉ¹þ¤ßÃæ" + +#. FIXME: bfd can't call perror. +#: archive.c:2120 +msgid "Writing updated armap timestamp" +msgstr "¹¹¿·¤µ¤ì¤¿ armap ¥¿¥¤¥à¥¹¥¿¥ó¥×½ñ¹þ¤ßÃæ" + +#: bfd.c:274 +msgid "No error" +msgstr "¥¨¥é¡¼¤Ï¤¢¤ê¤Þ¤»¤ó" + +#: bfd.c:275 +msgid "System call error" +msgstr "¥·¥¹¥Æ¥à¥³¡¼¥ë¥¨¥é¡¼" + +#: bfd.c:276 +msgid "Invalid bfd target" +msgstr "ÉÔŬÀÚ¤Ê bfd ¥¿¡¼¥²¥Ã¥È¤Ç¤¹" + +#: bfd.c:277 +msgid "File in wrong format" +msgstr "´Ö°ã¤Ã¤¿·Á¼°¤Î¥Õ¥¡¥¤¥ë" + +#: bfd.c:278 +#, fuzzy +msgid "Archive object file in wrong format" +msgstr "´Ö°ã¤Ã¤¿·Á¼°¤Î¥Õ¥¡¥¤¥ë" + +#: bfd.c:279 +msgid "Invalid operation" +msgstr "ÉÔŬÀÚ¤ÊÁàºî" + +#: bfd.c:280 +msgid "Memory exhausted" +msgstr "¥á¥â¥ê¤ò»È¤¤²Ì¤¿¤·¤Þ¤·¤¿" + +#: bfd.c:281 +msgid "No symbols" +msgstr "¥·¥ó¥Ü¥ë¤¬¤¢¤ê¤Þ¤»¤ó" + +#: bfd.c:282 +msgid "Archive has no index; run ranlib to add one" +msgstr "" +"½ñ¸Ë¤Ë¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬¤¢¤ê¤Þ¤»¤ó -- Äɲ乤뤿¤á¤Ë ranlib ¤ò¼Â¹Ô¤·¤Þ¤·¤ç¤¦" + +#: bfd.c:283 +msgid "No more archived files" +msgstr "¤³¤ì°Ê¾å½ñ¸Ë¥Õ¥¡¥¤¥ë¤Ï¤¢¤ê¤Þ¤»¤ó" + +#: bfd.c:284 +msgid "Malformed archive" +msgstr "¤ª¤«¤·¤Ê½ñ¸Ë¤Ç¤¹" + +#: bfd.c:285 +msgid "File format not recognized" +msgstr "¥Õ¥¡¥¤¥ë·Á¼°¤¬Ç§¼±¤Ç¤­¤Þ¤»¤ó" + +#: bfd.c:286 +msgid "File format is ambiguous" +msgstr "¥Õ¥¡¥¤¥ë·Á¼°¤¬Û£Ëæ¤Ç¤¹" + +#: bfd.c:287 +msgid "Section has no contents" +msgstr "¥»¥¯¥·¥ç¥ó¤ËÆâÍÆ¤¬¤¢¤ê¤Þ¤»¤ó" + +#: bfd.c:288 +msgid "Nonrepresentable section on output" +msgstr "½ÐÎϤËÂбþ¤¹¤ë¥»¥¯¥·¥ç¥ó¤¬¤¢¤ê¤Þ¤»¤ó" + +#: bfd.c:289 +msgid "Symbol needs debug section which does not exist" +msgstr "¸ºß¤·¤Æ¤¤¤Ê¤¤¥Ç¥Ð¥Ã¥°¥»¥¯¥·¥ç¥ó¤ò¥·¥ó¥Ü¥ë¤¬É¬ÍפȤ·¤Æ¤¤¤Þ¤¹" + +#: bfd.c:290 +msgid "Bad value" +msgstr "ÉÔÀµ¤ÊÃͤǤ¹" + +#: bfd.c:291 +msgid "File truncated" +msgstr "¥Õ¥¡¥¤¥ë¤¬ÅÓÀÚ¤ì¤Æ¤¤¤Þ¤¹" + +#: bfd.c:292 +msgid "File too big" +msgstr "¥Õ¥¡¥¤¥ë¤¬Â礭¤¹¤®¤Þ¤¹" + +#: bfd.c:293 +msgid "#" +msgstr "#<ÉÔŬÀڤʥ¨¥é¡¼¥³¡¼¥É>" + +#: bfd.c:700 +#, fuzzy, c-format +msgid "BFD %s assertion fail %s:%d" +msgstr "bfd ¥¢¥µ¡¼¥·¥ç¥ó¤¬¼ºÇÔ %s:%d" + +#: bfd.c:719 +#, fuzzy, c-format +msgid "BFD %s internal error, aborting at %s line %d in %s\n" +msgstr "BFD ÆâÉô¥¨¥é¡¼¡£%s ¤Î %d ¹ÔÌÜ %s ¤ÇÃæÃǤ·¤Þ¤·¤¿\n" + +#: bfd.c:723 +#, fuzzy, c-format +msgid "BFD %s internal error, aborting at %s line %d\n" +msgstr "BFD ÆâÉô¥¨¥é¡¼¡£%s ¤Î %d ¹ÔÌܤÇÃæÃǤ·¤Þ¤·¤¿\n" + +#: bfd.c:725 +msgid "Please report this bug.\n" +msgstr "¤³¤Î¥Ð¥°¤òÊó¹ð¤·¤Æ¤¯¤À¤µ¤¤¡£\n" + +#: binary.c:306 +#, c-format +msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx." +msgstr "" +"·Ù¹ð: ¥»¥¯¥·¥ç¥ó `%s' µðÂç(Îã Éé¿ô)¤Ê¥Õ¥¡¥¤¥ë¥ª¥Õ¥»¥Ã¥È 0x%lx ¤Ø¤Î½ñ¹þ¤ß¤Ç" +"¤¹¡£" + +#: coff-a29k.c:119 +msgid "Missing IHCONST" +msgstr "IHCONST ¤ò·ç¤¤¤Æ¤¤¤Þ¤¹" + +#: coff-a29k.c:180 +msgid "Missing IHIHALF" +msgstr "IHIHALF ¤ò·ç¤¤¤Æ¤¤¤Þ¤¹" + +#: coff-a29k.c:212 coff-or32.c:228 +msgid "Unrecognized reloc" +msgstr "ǧ¼±¤Ç¤­¤Ê¤¤ºÆÇÛÃ֤Ǥ¹" + +#: coff-a29k.c:408 +msgid "missing IHCONST reloc" +msgstr "IHCONST ºÆÇÛÃÖ¤ò·ç¤¤¤Æ¤¤¤Þ¤¹" + +#: coff-a29k.c:498 +msgid "missing IHIHALF reloc" +msgstr "IHIHALF ºÆÇÛÃÖ¤ò·ç¤¤¤Æ¤¤¤Þ¤¹" + +#: coff-alpha.c:881 coff-alpha.c:918 coff-alpha.c:1989 coff-mips.c:1433 +msgid "GP relative relocation used when GP not defined" +msgstr "GP ¤¬Ì¤ÄêµÁ¤Î»þ¤Ë GP ´ØÏ¢ºÆÇÛÃÖ¤¬»È¤ï¤ì¤Þ¤·¤¿" + +#: coff-alpha.c:1485 +msgid "using multiple gp values" +msgstr "Ê£¿ô¤Î gp Ãͤò»ÈÍѤ¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹" + +#: coff-arm.c:1051 elf32-arm.h:285 +#, c-format +msgid "%s: unable to find THUMB glue '%s' for `%s'" +msgstr "%s: THUMB ¥°¥ë¡¼ '%s' (`%s' ÍÑ) ¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó" + +#: coff-arm.c:1080 elf32-arm.h:320 +#, c-format +msgid "%s: unable to find ARM glue '%s' for `%s'" +msgstr "%s: ARM ¥°¥ë¡¼ '%s' (`%s' ÍÑ) ¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó" + +#: coff-arm.c:1375 coff-arm.c:1470 elf32-arm.h:886 elf32-arm.h:990 +#, c-format +msgid "%s(%s): warning: interworking not enabled." +msgstr "%s(%s): ·Ù¹ð: interworking ¤¬Í­¸ú¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: coff-arm.c:1379 elf32-arm.h:993 +#, c-format +msgid " first occurrence: %s: arm call to thumb" +msgstr " ½é²óȯÀ¸: %s: arm ¤Î thumb ¸Æ¤Ó½Ð¤·" + +#: coff-arm.c:1474 elf32-arm.h:889 +#, c-format +msgid " first occurrence: %s: thumb call to arm" +msgstr " ½é²óȯÀ¸: %s: thumb ¤Î arm ¸Æ¤Ó½Ð¤·" + +#: coff-arm.c:1477 +msgid " consider relinking with --support-old-code enabled" +msgstr "" +" --support-old-code ¤òÍ­¸ú¤Ë¤·¤ÆºÆ¥ê¥ó¥¯¤¹¤ë¤³¤È¤ò¹Íθ¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤" + +#: coff-arm.c:1767 coff-tic80.c:686 cofflink.c:3017 +#, c-format +msgid "%s: bad reloc address 0x%lx in section `%s'" +msgstr "%s: ÉÔÀµ¤ÊºÆÇÛÃÖ¥¢¥É¥ì¥¹ 0x%lx ¤¬¥»¥¯¥·¥ç¥ó `%s' Æâ¤Ë¤¢¤ê¤Þ¤¹" + +#: coff-arm.c:2107 +#, c-format +msgid "%s: illegal symbol index in reloc: %d" +msgstr "%s: ºÆÇÛÃÖÆâ¤Î¥·¥ó¥Ü¥ë¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬ÉÔÀµ¤Ç¤¹: %d" + +#: coff-arm.c:2235 +#, c-format +msgid "%s: ERROR: compiled for APCS-%d whereas target %s uses APCS-%d" +msgstr "" +"%s: ¥¨¥é¡¼: APCS-%d ÍѤ˥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿¥¿¡¼¥²¥Ã¥È %s ¤Ë¤â¤«¤«¤ï¤é¤º APCS-%d " +"¤ò»È¤Ã¤Æ¤¤¤Þ¤¹" + +#: coff-arm.c:2250 +#, c-format +msgid "" +"%s: ERROR: passes floats in float registers whereas target %s uses integer " +"registers" +msgstr "" +"%s: ¥¨¥é¡¼: ÉâÆ°¾®¿ô¥ì¥¸¥¹¥¿¤ËÉâÆ°¾®¿ô¤òÅϤ·¤Æ¤¤¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢¥¿¡¼¥²¥Ã¥È " +"%s ¤¬À°¿ô¥ì¥¸¥¹¥¿¤ò»È¤Ã¤Æ¤¤¤Þ¤¹" + +#: coff-arm.c:2253 +#, c-format +msgid "" +"%s: ERROR: passes floats in integer registers whereas target %s uses float " +"registers" +msgstr "" +"%s: ¥¨¥é¡¼: À°¿ô¥ì¥¸¥¹¥¿¤ËÉâÆ°¾®¿ô¤òÅϤ·¤Æ¤¤¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢¥¿¡¼¥²¥Ã¥È %s " +"¤ÏÉâÆ°¾®¿ô¥ì¥¸¥¹¥¿¤ò»È¤Ã¤Æ¤¤¤Þ¤¹" + +#: coff-arm.c:2268 +#, c-format +msgid "" +"%s: ERROR: compiled as position independent code, whereas target %s is " +"absolute position" +msgstr "" +"%s: ¥¨¥é¡¼: °ÌÃÖÈó°Í¸¥³¡¼¥É¤È¤·¤Æ¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿¤Ë¤â¤«¤«¤ï¤é¤º¡¢¥¿¡¼¥²¥Ã¥È " +"%s ¤ÏÀäÂаÌÃ֤ˤʤäƤ¤¤Þ¤¹" + +#: coff-arm.c:2271 +#, c-format +msgid "" +"%s: ERROR: compiled as absolute position code, whereas target %s is position " +"independent" +msgstr "" +"%s: ¥¨¥é¡¼: ÀäÂаÌÃÖ¥³¡¼¥É¤È¤·¤Æ¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿¤Ë¤â¤«¤«¤ï¤é¤º¡¢¥¿¡¼¥²¥Ã¥È %" +"s ¤Ï°ÌÃÖÈó°Í¸¥³¡¼¥É¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹" + +#: coff-arm.c:2300 +#, fuzzy, c-format +msgid "Warning: %s supports interworking, whereas %s does not." +msgstr "" +"·Ù¹ð: ÆþÎÏ¥Õ¥¡¥¤¥ë %s ¤¬ interworking ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢%s ¤Ï" +"¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó¡£" + +#: coff-arm.c:2303 +#, fuzzy, c-format +msgid "Warning: %s does not support interworking, whereas %s does." +msgstr "" +"·Ù¹ð: ÆþÎÏ¥Õ¥¡¥¤¥ë %s ¤¬ interworking ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢%s ¤Ï" +"¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£" + +#: coff-arm.c:2330 +#, c-format +msgid "private flags = %x:" +msgstr "private ¥Õ¥é¥° = %x:" + +#: coff-arm.c:2338 elf32-arm.h:2408 +msgid " [floats passed in float registers]" +msgstr " [ÉâÆ°¾®¿ô¤¬ÉâÆ°¾®¿ô¥ì¥¸¥¹¥¿¤ËÅϤµ¤ì¤Þ¤·¤¿]" + +#: coff-arm.c:2340 +msgid " [floats passed in integer registers]" +msgstr " [ÉâÆ°¾®¿ô¤¬À°¿ô¥ì¥¸¥¹¥¿¤ËÅϤµ¤ì¤Þ¤·¤¿]" + +#: coff-arm.c:2343 elf32-arm.h:2411 +msgid " [position independent]" +msgstr " [°ÌÃÖÈó°Í¸]" + +#: coff-arm.c:2345 +msgid " [absolute position]" +msgstr " [ÀäÂаÌÃÖ]" + +#: coff-arm.c:2349 +msgid " [interworking flag not initialised]" +msgstr " [interworking ¥Õ¥é¥°¤Ï½é´ü²½¤µ¤ì¤Æ¤¤¤Þ¤»¤ó]" + +#: coff-arm.c:2351 +msgid " [interworking supported]" +msgstr " [interworking ¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤¹]" + +#: coff-arm.c:2353 +msgid " [interworking not supported]" +msgstr " [interworking ¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó]" + +#: coff-arm.c:2401 elf32-arm.h:2114 +#, fuzzy, c-format +msgid "" +"Warning: Not setting interworking flag of %s since it has already been " +"specified as non-interworking" +msgstr "" +"·Ù¹ð: ´û¤ËÈó interworking ¤È»ØÄꤵ¤ì¤Æ¤¤¤ë¤¿¤á¡¢%s ¤Î interworking ¥Õ¥é¥°¤òÀß" +"Äꤷ¤Þ¤»¤ó" + +#: coff-arm.c:2405 elf32-arm.h:2118 +#, c-format +msgid "Warning: Clearing the interworking flag of %s due to outside request" +msgstr "·Ù¹ð: Í׵ᳰ¤Î¤¿¤á %s ¤Î interworking ¥Õ¥é¥°¤ò¥¯¥ê¥¢¤·¤Þ¤¹" + +#: coff-i960.c:136 coff-i960.c:485 +msgid "uncertain calling convention for non-COFF symbol" +msgstr "Èó COFF ¥·¥ó¥Ü¥ëÍѤθƤӽФ·µ¬Ìó¤¬ÉÔ³ÎÄê¤Ç¤¹" + +#: coff-m68k.c:481 coff-mips.c:2431 elf32-m68k.c:2212 elf32-mips.c:9954 +msgid "unsupported reloc type" +msgstr "¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ºÆÇÛÃÖ¥¿¥¤¥×¤Ç¤¹" + +#: coff-mips.c:875 elf32-mips.c:1997 elf64-mips.c:1739 +msgid "GP relative relocation when _gp not defined" +msgstr "GP ´ØÏ¢¤ÎºÆÇÛÃÖ¤¬ _gp ¤¬Ì¤ÄêµÁ¤Î»þÅÀ¤Ç¸½¤ì¤Þ¤·¤¿" + +#. No other sections should appear in -membedded-pic +#. code. +#: coff-mips.c:2468 +msgid "reloc against unsupported section" +msgstr "¥µ¥Ý¡¼¥È³°¤Î¥»¥¯¥·¥ç¥ó¤ËÂФ¹¤ëºÆÇÛÃ֤Ǥ¹" + +#: coff-mips.c:2476 +msgid "reloc not properly aligned" +msgstr "ºÆÇÛÃÖÎΰ褬ŬÀڤ˥¢¥é¥¤¥ó¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: coff-rs6000.c:2710 coff64-rs6000.c:1164 +#, c-format +msgid "%s: unsupported relocation type 0x%02x" +msgstr "%s: ºÆÇÛÃÖ¥¿¥¤¥× 0x%02x ¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#: coff-rs6000.c:2756 coff64-rs6000.c:1210 +#, c-format +msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry" +msgstr "%s: TOC ºÆÇÛÃÖ(0x%x, ¥·¥ó¥Ü¥ë `%s') ¤Ë TOC ¥¨¥ó¥È¥ê¤¬¤¢¤ê¤Þ¤»¤ó" + +#: coff-rs6000.c:3006 coff64-rs6000.c:2060 +#, c-format +msgid "%s: symbol `%s' has unrecognized smclas %d" +msgstr "%s: ¥·¥ó¥Ü¥ë `%s' ¤Ïǧ¼±¤Ç¤­¤Ê¤¤ smclas %d ¤ò»ý¤Ã¤Æ¤¤¤Þ¤¹" + +#: coff-tic54x.c:279 coff-tic80.c:449 +#, c-format +msgid "Unrecognized reloc type 0x%x" +msgstr "ºÆÇÛÃÖ¥¿¥¤¥× 0x%x ¤òǧ¼±¤Ç¤­¤Þ¤»¤ó" + +#: coff-tic54x.c:390 coffcode.h:4868 +#, c-format +msgid "%s: warning: illegal symbol index %ld in relocs" +msgstr "%s: ·Ù¹ð: ÉÔÀµ¤Ê¥·¥ó¥Ü¥ë¥¤¥ó¥Ç¥Ã¥¯¥¹ %ld ¤¬ºÆÇÛÃÖÆâ¥¨¥ó¥È¥ê¤Ë¤¢¤ê¤Þ¤¹" + +#: coff-w65.c:363 +#, c-format +msgid "ignoring reloc %s\n" +msgstr "ºÆÇÛÃÖ %s ¤ò̵»ë¤·¤Þ¤¹\n" + +#: coffcode.h:1081 +#, fuzzy, c-format +msgid "%s (%s): Section flag %s (0x%x) ignored" +msgstr "bfd_set_section_flags (%s, %x) ¤¬¼ºÇÔ¤·¤Þ¤·¤¿" + +#: coffcode.h:2132 +#, c-format +msgid "Unrecognized TI COFF target id '0x%x'" +msgstr "TI COFF ¥¿¡¼¥²¥Ã¥È id '0x%x' ¤òǧ¼±¤Ç¤­¤Þ¤»¤ó" + +#: coffcode.h:4257 +#, c-format +msgid "%s: warning: illegal symbol index %ld in line numbers" +msgstr "%s: ·Ù¹ð: ÉÔÀµ¤Ê¥·¥ó¥Ü¥ë¥¤¥ó¥Ç¥Ã¥¯¥¹ %ld ¤¬¹ÔÈÖ¹æÃæ¤Ë¤¢¤ê¤Þ¤¹" + +#: coffcode.h:4271 +#, c-format +msgid "%s: warning: duplicate line number information for `%s'" +msgstr "%s: ·Ù¹ð: `%s' ÍѤιÔÈÖ¹æ¾ðÊ󤬽ÅÊ£¤·¤Æ¤¤¤Þ¤¹" + +#: coffcode.h:4630 +#, c-format +msgid "%s: Unrecognized storage class %d for %s symbol `%s'" +msgstr "%s: µ­²±¥¯¥é¥¹ %d (section %s, symbol `%s') ¤òǧ¼±¤Ç¤­¤Þ¤»¤ó" + +#: coffcode.h:4761 +#, c-format +msgid "warning: %s: local symbol `%s' has no section" +msgstr "·Ù¹ð: %s: ¶É½ê¥·¥ó¥Ü¥ë `%s' ¤¬¥»¥¯¥·¥ç¥ó¤ò»ý¤Ã¤Æ¤¤¤Þ¤»¤ó" + +#: coffcode.h:4906 +#, c-format +msgid "%s: illegal relocation type %d at address 0x%lx" +msgstr "%s: ÉÔÀµ¤ÊºÆÇÛÃÖ¥¿¥¤¥× %d ¤¬¥¢¥É¥ì¥¹ 0x%lx ¤Ç¸«¤Ä¤«¤ê¤Þ¤·¤¿" + +#: coffgen.c:1661 +#, c-format +msgid "%s: bad string table size %lu" +msgstr "%s: ʸ»úÎ󥯡¼¥Ö¥ë¥µ¥¤¥º %lu ¤ÏÉÔÀµ¤Ç¤¹" + +#: cofflink.c:536 elflink.h:1967 +#, c-format +msgid "Warning: type of symbol `%s' changed from %d to %d in %s" +msgstr "·Ù¹ð: ¥·¥ó¥Ü¥ë `%s' ¤Î·¿¤Ï %d ¤«¤é %d ¤ËÊѹ¹¤µ¤ì¤Þ¤·¤¿ (%s Æâ)" + +#: cofflink.c:2317 +#, c-format +msgid "%s: relocs in section `%s', but it has no contents" +msgstr "%s: ¥»¥¯¥·¥ç¥ó `%s' Æâ¤ÎºÆÇÛÃÖÎΰè¤ËÆâÍÆ¤¬¤¢¤ê¤Þ¤»¤ó" + +#: cofflink.c:2653 coffswap.h:889 +#, c-format +msgid "%s: %s: reloc overflow: 0x%lx > 0xffff" +msgstr "%s: %s: ºÆÇÛÃÖÎΰ褬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿: 0x%lx > 0xffff" + +#: cofflink.c:2662 coffswap.h:876 +#, c-format +msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: ·Ù¹ð: %s: ¹ÔÈֹ椬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿: 0x%lx > 0xffff" + +#: dwarf2.c:381 +#, fuzzy +msgid "Dwarf Error: Can't find .debug_str section." +msgstr "Dwarf ¥¨¥é¡¼: .debug_abbrev ¥»¥¯¥·¥ç¥ó¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó¡£" + +#: dwarf2.c:398 +#, fuzzy, c-format +msgid "" +"Dwarf Error: DW_FORM_strp offset (%u) greater than or equal to .debug_str " +"size (%u)." +msgstr "" +"Dwarf ¥¨¥é¡¼: abbrev ¥ª¥Õ¥»¥Ã¥È (%u) ¤¬ abbrev ¥µ¥¤¥º (%u) ¤è¤êÂ礭¤¤¤Ç¤¹¡£" + +#: dwarf2.c:542 +msgid "Dwarf Error: Can't find .debug_abbrev section." +msgstr "Dwarf ¥¨¥é¡¼: .debug_abbrev ¥»¥¯¥·¥ç¥ó¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó¡£" + +#: dwarf2.c:559 +#, fuzzy, c-format +msgid "" +"Dwarf Error: Abbrev offset (%u) greater than or equal to .debug_abbrev size " +"(%u)." +msgstr "" +"Dwarf ¥¨¥é¡¼: abbrev ¥ª¥Õ¥»¥Ã¥È (%u) ¤¬ abbrev ¥µ¥¤¥º (%u) ¤è¤êÂ礭¤¤¤Ç¤¹¡£" + +#: dwarf2.c:756 +#, c-format +msgid "Dwarf Error: Invalid or unhandled FORM value: %d." +msgstr "Dwarf ¥¨¥é¡¼: FORM Ãͤ¬ÉÔŬÀڤǤ¢¤ë¤«¡¢¼è¤ê°·¤¨¤Þ¤»¤ó: %d¡£" + +#: dwarf2.c:843 +msgid "Dwarf Error: mangled line number section (bad file number)." +msgstr "Dwarf ¥¨¥é¡¼: ¹ÔÈֹ楻¥¯¥·¥ç¥ó¤¬ÊÑ·Á¤µ¤ì¤Þ¤·¤¿¡ÊÉÔÀµ¤Ê¥Õ¥¡¥¤¥ëÈÖ¹æ¡Ë¡£" + +#: dwarf2.c:929 +msgid "Dwarf Error: Can't find .debug_line section." +msgstr "Dwarf ¥¨¥é¡¼: .debug_line ¥»¥¯¥·¥ç¥ó¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó¡£" + +#: dwarf2.c:952 +#, fuzzy, c-format +msgid "" +"Dwarf Error: Line offset (%u) greater than or equal to .debug_line size (%u)." +msgstr "" +"Dwarf ¥¨¥é¡¼: line ¥ª¥Õ¥»¥Ã¥È (%u) ¤¬ line ¥µ¥¤¥º (%u) ¤è¤êÂ礭¤¤¤Ç¤¹¡£" + +#: dwarf2.c:1143 +msgid "Dwarf Error: mangled line number section." +msgstr "Dwarf ¥¨¥é¡¼: ¹ÔÈֹ楻¥¯¥·¥ç¥ó¤¬ÊÑ·Á¤µ¤ì¤Þ¤·¤¿¡£" + +#: dwarf2.c:1318 dwarf2.c:1529 +#, c-format +msgid "Dwarf Error: Could not find abbrev number %d." +msgstr "Dwarf ¥¨¥é¡¼: abbrev ÈÖ¹æ %d ¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó¤Ç¤·¤¿¡£" + +#: dwarf2.c:1490 +#, c-format +msgid "" +"Dwarf Error: found dwarf version '%hu', this reader only handles version 2 " +"information." +msgstr "" +"Dwarf ¥¨¥é¡¼: dwarf ¥Ð¡¼¥¸¥ç¥ó '%hu' ¤¬¸«¤Ä¤«¤ê¤Þ¤·¤¿¤¬¡¢¥Ð¡¼¥¸¥ç¥ó 2 ¤Î¾ðÊó" +"¤·¤«ÆÉ¤ß¼è¤ì¤Þ¤»¤ó¡£" + +#: dwarf2.c:1497 +#, c-format +msgid "" +"Dwarf Error: found address size '%u', this reader can not handle sizes " +"greater than '%u'." +msgstr "" +"Dwarf ¥¨¥é¡¼: ¥¢¥É¥ì¥¹¥µ¥¤¥º '%u' ¤¬¸«¤Ä¤«¤ê¤Þ¤·¤¿¤¬¡¢'%u' ¤è¤êÂ礭¤Ê¥µ¥¤¥º¤Ï" +"°·¤¨¤Þ¤»¤ó¡£" + +#: dwarf2.c:1520 +#, c-format +msgid "Dwarf Error: Bad abbrev number: %d." +msgstr "Dwarf ¥¨¥é¡¼: ÉÔÀµ¤Ê abbrev ÈÖ¹æ¤Ç¤¹: %d¡£" + +#: ecoff.c:1328 +#, c-format +msgid "Unknown basic type %d" +msgstr "´ðËÜ·¿ %d ¤¬ÉÔÌÀ¤Ç¤¹" + +#: ecoff.c:1597 +#, c-format +msgid "" +"\n" +" End+1 symbol: %ld" +msgstr "" +"\n" +" End+1 ¥·¥ó¥Ü¥ë: %ld" + +#: ecoff.c:1604 ecoff.c:1607 +#, c-format +msgid "" +"\n" +" First symbol: %ld" +msgstr "" +"\n" +" ºÇ½é¤Î¥·¥ó¥Ü¥ë: %ld" + +#: ecoff.c:1619 +#, c-format +msgid "" +"\n" +" End+1 symbol: %-7ld Type: %s" +msgstr "" +"\n" +" End+1 ¥·¥ó¥Ü¥ë: %-7ld ¥¿¥¤¥×: %s" + +#: ecoff.c:1626 +#, c-format +msgid "" +"\n" +" Local symbol: %ld" +msgstr "" +"\n" +" ¶É½ê¥·¥ó¥Ü¥ë: %ld" + +#: ecoff.c:1634 +#, c-format +msgid "" +"\n" +" struct; End+1 symbol: %ld" +msgstr "" +"\n" +" struct; End+1 ¥·¥ó¥Ü¥ë: %ld" + +#: ecoff.c:1639 +#, c-format +msgid "" +"\n" +" union; End+1 symbol: %ld" +msgstr "" +"\n" +" union; End+1 ¥·¥ó¥Ü¥ë: %ld" + +#: ecoff.c:1644 +#, c-format +msgid "" +"\n" +" enum; End+1 symbol: %ld" +msgstr "" +"\n" +" enum; End+1 ¥·¥ó¥Ü¥ë: %ld" + +#: ecoff.c:1650 +#, c-format +msgid "" +"\n" +" Type: %s" +msgstr "" +"\n" +" ·¿: %s" + +#: elf-hppa.h:1366 elf-hppa.h:1399 elf32-ppc.c:3062 elf32-sh.c:3201 +#: elf64-x86-64.c:1275 +#, c-format +msgid "" +"%s: warning: unresolvable relocation against symbol `%s' from %s section" +msgstr "%s: ·Ù¹ð: ¥·¥ó¥Ü¥ë `%s' (%s ¥»¥¯¥·¥ç¥ó)¤ËÂФ¹¤ëºÆÇÛÃÖ¤ò²ò·è¤Ç¤­¤Þ¤»¤ó" + +#: elf-m10200.c:463 elf-m10300.c:673 elf32-arm.h:2074 elf32-avr.c:835 +#: elf32-cris.c:1406 elf32-d10v.c:482 elf32-fr30.c:653 elf32-h8300.c:547 +#: elf32-i860.c:1048 elf32-m32r.c:1280 elf32-openrisc.c:455 elf32-v850.c:1691 +#: elf32-xstormy16.c:976 elf64-mmix.c:1164 +msgid "internal error: out of range error" +msgstr "ÆâÉô¥¨¥é¡¼: Èϰϳ°¥¨¥é¡¼¤Ç¤¹" + +#: elf-m10200.c:467 elf-m10300.c:677 elf32-arm.h:2078 elf32-avr.c:839 +#: elf32-cris.c:1410 elf32-d10v.c:486 elf32-fr30.c:657 elf32-h8300.c:551 +#: elf32-i860.c:1052 elf32-m32r.c:1284 elf32-mips.c:7587 elf32-openrisc.c:459 +#: elf32-v850.c:1695 elf32-xstormy16.c:980 elf64-mips.c:4464 elf64-mmix.c:1168 +msgid "internal error: unsupported relocation error" +msgstr "ÆâÉô¥¨¥é¡¼: ̤¥µ¥Ý¡¼¥È¤ÎºÆÇÛÃÖ¥¨¥é¡¼" + +#: elf-m10200.c:471 elf-m10300.c:681 elf32-arm.h:2082 elf32-d10v.c:490 +#: elf32-h8300.c:555 elf32-m32r.c:1288 +msgid "internal error: dangerous error" +msgstr "ÆâÉô¥¨¥é¡¼: ´í¸±¤Ê¥¨¥é¡¼" + +#: elf-m10200.c:475 elf-m10300.c:685 elf32-arm.h:2086 elf32-avr.c:847 +#: elf32-cris.c:1418 elf32-d10v.c:494 elf32-fr30.c:665 elf32-h8300.c:559 +#: elf32-i860.c:1060 elf32-m32r.c:1292 elf32-openrisc.c:467 elf32-v850.c:1715 +#: elf32-xstormy16.c:988 elf64-mmix.c:1176 +msgid "internal error: unknown error" +msgstr "ÆâÉô¥¨¥é¡¼: ÉÔÌÀ¤Ê¥¨¥é¡¼" + +#: elf.c:343 +#, c-format +msgid "%s: invalid string offset %u >= %lu for section `%s'" +msgstr "%s: ÉÔŬÀÚ¤Êʸ»úÎ󥪥ե»¥Ã¥È %u >= %lu (¥»¥¯¥·¥ç¥ó `%s' ÍÑ)" + +#: elf.c:448 +#, c-format +msgid "%s: invalid SHT_GROUP entry" +msgstr "" + +#: elf.c:529 +#, fuzzy, c-format +msgid "%s: no group info for section %s" +msgstr "%s: ¥í¡¼¥ÀºÆÇÛÃÖ¤¬ÆÉ¹þ¤ßÀìÍÑ¥»¥¯¥·¥ç¥ó %s ¤Ë¤¢¤ê¤Þ¤¹" + +#: elf.c:840 +msgid "" +"\n" +"Program Header:\n" +msgstr "" +"\n" +"¥×¥í¥°¥é¥à¥Ø¥Ã¥À:\n" + +#: elf.c:889 +msgid "" +"\n" +"Dynamic Section:\n" +msgstr "" +"\n" +"ưŪ¥»¥¯¥·¥ç¥ó:\n" + +#: elf.c:1018 +msgid "" +"\n" +"Version definitions:\n" +msgstr "" +"\n" +"¥Ð¡¼¥¸¥ç¥óÄêµÁ:\n" + +#: elf.c:1041 +msgid "" +"\n" +"Version References:\n" +msgstr "" +"\n" +"¥Ð¡¼¥¸¥ç¥ó»²¾È:\n" + +#: elf.c:1046 +#, c-format +msgid " required from %s:\n" +msgstr " %s ¤«¤é¤ÎÍ×µá:\n" + +#: elf.c:1682 +#, c-format +msgid "%s: invalid link %lu for reloc section %s (index %u)" +msgstr "" +"%s: ÉÔŬÀڤʥê¥ó¥¯ %lu ¤òºÆÇÛÃÖ¥»¥¯¥·¥ç¥ó %s (index %u) ¤Ë¹Ô¤Ê¤Ã¤Æ¤¤¤Þ¤¹" + +#: elf.c:3296 +#, c-format +msgid "%s: Not enough room for program headers (allocated %u, need %u)" +msgstr "%s: ¥×¥í¥°¥é¥à¥Ø¥Ã¥ÀÍѤζõ´Ö¤¬ÉÔ½½Ê¬¤Ç¤¹ (³ÎÊÝºÑ %u, Í× %u)" + +#: elf.c:3400 +#, c-format +msgid "%s: Not enough room for program headers, try linking with -N" +msgstr "" +"%s: ¥×¥í¥°¥é¥à¥Ø¥Ã¥ÀÍѤζõ´Ö¤¬ÉÔ½½Ê¬¤Ç¤¹¡£-N ¤òÉÕ¤±¤Æ¥ê¥ó¥¯¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤" + +#: elf.c:3525 +#, fuzzy, c-format +msgid "" +"Error: First section in segment (%s) starts at 0x%x whereas the segment " +"starts at 0x%x" +msgstr "¥¨¥é¡¼: ¥»¥°¥á¥ó¥È (%s) ¤ÎºÇ½é¤Î¥»¥¯¥·¥ç¥ó¤¬ 0x%x ¤Ç»Ï¤Þ¤Ã¤Æ¤¤¤ë" + +#: elf.c:3811 +#, c-format +msgid "%s: warning: allocated section `%s' not in segment" +msgstr "%s: ·Ù¹ð: ³ÎÊݤµ¤ì¤¿¥»¥¯¥·¥ç¥ó `%s' ¤¬¥»¥°¥á¥ó¥ÈÆâ¤Ë¤¢¤ê¤Þ¤»¤ó" + +#: elf.c:4142 +#, c-format +msgid "%s: symbol `%s' required but not present" +msgstr "%s: ¥·¥ó¥Ü¥ë `%s' ¤¬Í׵ᤵ¤ì¤Þ¤·¤¿¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó" + +#: elf.c:4395 +#, c-format +msgid "%s: warning: Empty loadable segment detected\n" +msgstr "%s: ·Ù¹ð: ¶õ¤Î¥í¡¼¥À¥Ö¥ë¥»¥°¥á¥ó¥È¤¬¸¡½Ð¤µ¤ì¤Þ¤·¤¿\n" + +#: elf.c:5808 +#, c-format +msgid "%s: unsupported relocation type %s" +msgstr "%s: ¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ºÆÇÛÃÖ¥¿¥¤¥× %s ¤Ç¤¹" + +#: elf32-arm.h:1224 +#, c-format +msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'." +msgstr "" +"%s: ·Ù¹ð: Arm BLX Ì¿Î᤬ Arm ¥Õ¥¡¥ó¥¯¥·¥ç¥ó '%s' ¤ò¥¿¡¼¥²¥Ã¥È¤Ë¤·¤Æ¤¤¤Þ¤¹¡£" + +#: elf32-arm.h:1420 +#, c-format +msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'." +msgstr "" +"%s: ·Ù¹ð: Thumb BLX Ì¿Î᤬ thumb ¥Õ¥¡¥ó¥¯¥·¥ç¥ó '%s' ¤ò¥¿¡¼¥²¥Ã¥È¤Ë¤·¤Æ¤Þ¤¹¡£" + +#: elf32-arm.h:1904 elf32-i386.c:1778 elf32-sh.c:3133 +#, c-format +msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section" +msgstr "" + +#: elf32-arm.h:1998 +#, fuzzy, c-format +msgid "" +"%s: warning: unresolvable relocation %d against symbol `%s' from %s section" +msgstr "%s: ·Ù¹ð: ¥·¥ó¥Ü¥ë `%s' (%s ¥»¥¯¥·¥ç¥ó)¤ËÂФ¹¤ëºÆÇÛÃÖ¤ò²ò·è¤Ç¤­¤Þ¤»¤ó" + +#: elf32-arm.h:2166 +#, fuzzy, c-format +msgid "" +"Warning: Clearing the interworking flag of %s because non-interworking code " +"in %s has been linked with it" +msgstr "" +"·Ù¹ð: %s ¤Î interwork ¥Õ¥é¥°¤ò¥¯¥ê¥¢¤·¤Þ¤¹¡£%s ¤ÎÈó interworking ¥³¡¼¥É¤È°ì½ï" +"¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë¤«¤é¤Ç¤¹¡£" + +#: elf32-arm.h:2261 +#, c-format +msgid "" +"Error: %s compiled for EABI version %d, whereas %s is compiled for version %d" +msgstr "" +"¥¨¥é¡¼: %s ¤Ï EABI ¥Ð¡¼¥¸¥ç¥ó %d ÍѤ˥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿¤Ë¤â¤«¤«¤ï¤é¤º¡¢%s ¤¬" +"¥Ð¡¼¥¸¥ç¥ó %d ÍѤ˥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤Þ¤·¤¿" + +#: elf32-arm.h:2275 +#, c-format +msgid "Error: %s compiled for APCS-%d, whereas %s is compiled for APCS-%d" +msgstr "" +"¥¨¥é¡¼: %s ¤Ï APCS-%d ÍѤ˥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿¤Ë¤â¤«¤«¤ï¤é¤º¡¢%s ¤¬ APCS-%d ÍѤË" +"¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤Þ¤·¤¿" + +#: elf32-arm.h:2287 +#, fuzzy, c-format +msgid "" +"Error: %s passes floats in FP registers, whereas %s passes them in integer " +"registers" +msgstr "" +"¥¨¥é¡¼: %s ¤ÏÉâÆ°¾®¿ô¤ò%s¥ì¥¸¥¹¥¿¤ËÅϤ·¤Æ¤¤¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢%s ¤¬¤½¤ì¤é¤ò%s" +"¥ì¥¸¥¹¥¿¤ËÅϤ·¤Æ¤¤¤Þ¤¹" + +#: elf32-arm.h:2292 +#, fuzzy, c-format +msgid "" +"Error: %s passes floats in integer registers, whereas %s passes them in FP " +"registers" +msgstr "" +"¥¨¥é¡¼: %s ¤ÏÉâÆ°¾®¿ô¤ò%s¥ì¥¸¥¹¥¿¤ËÅϤ·¤Æ¤¤¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢%s ¤¬¤½¤ì¤é¤ò%s" +"¥ì¥¸¥¹¥¿¤ËÅϤ·¤Æ¤¤¤Þ¤¹" + +#: elf32-arm.h:2303 +#, fuzzy, c-format +msgid "Error: %s uses VFP instructions, whereas %s uses FPA instructions" +msgstr "" +"¥¨¥é¡¼: %s ¤Ï%sÉâÆ°¾®¿ôÅÀ¤ò»È¤Ã¤Æ¤¤¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢%s ¤¬%sÉâÆ°¾®¿ôÅÀ¤ò»È¤Ã" +"¤Æ¤¤¤Þ¤¹" + +#: elf32-arm.h:2308 +#, fuzzy, c-format +msgid "Error: %s uses FPA instructions, whereas %s uses VFP instructions" +msgstr "" +"¥¨¥é¡¼: %s ¤Ï%sÉâÆ°¾®¿ôÅÀ¤ò»È¤Ã¤Æ¤¤¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢%s ¤¬%sÉâÆ°¾®¿ôÅÀ¤ò»È¤Ã" +"¤Æ¤¤¤Þ¤¹" + +#: elf32-arm.h:2328 +#, fuzzy, c-format +msgid "Error: %s uses software FP, whereas %s uses hardware FP" +msgstr "" +"¥¨¥é¡¼: %s ¤Ï%sÉâÆ°¾®¿ôÅÀ¤ò»È¤Ã¤Æ¤¤¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢%s ¤¬%sÉâÆ°¾®¿ôÅÀ¤ò»È¤Ã" +"¤Æ¤¤¤Þ¤¹" + +#: elf32-arm.h:2333 +#, fuzzy, c-format +msgid "Error: %s uses hardware FP, whereas %s uses software FP" +msgstr "" +"¥¨¥é¡¼: %s ¤Ï%sÉâÆ°¾®¿ôÅÀ¤ò»È¤Ã¤Æ¤¤¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢%s ¤¬%sÉâÆ°¾®¿ôÅÀ¤ò»È¤Ã" +"¤Æ¤¤¤Þ¤¹" + +#: elf32-arm.h:2348 +#, fuzzy, c-format +msgid "Warning: %s supports interworking, whereas %s does not" +msgstr "" +"·Ù¹ð: ÆþÎÏ¥Õ¥¡¥¤¥ë %s ¤¬ interworking ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢%s ¤Ï" +"¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó¡£" + +#: elf32-arm.h:2355 +#, fuzzy, c-format +msgid "Warning: %s does not support interworking, whereas %s does" +msgstr "" +"·Ù¹ð: ÆþÎÏ¥Õ¥¡¥¤¥ë %s ¤¬ interworking ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢%s ¤Ï" +"¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£" + +#. Ignore init flag - it may not be set, despite the flags field +#. containing valid data. +#: elf32-arm.h:2386 elf32-cris.c:2991 elf32-m68k.c:410 elf32-mips.c:3242 +#, c-format +msgid "private flags = %lx:" +msgstr "private ¥Õ¥é¥° = %lx:" + +#: elf32-arm.h:2395 +msgid " [interworking enabled]" +msgstr " [interworking ¤ÏÍ­¸ú]" + +#: elf32-arm.h:2398 +msgid " [APCS-26]" +msgstr " [APCS-26]" + +#: elf32-arm.h:2400 +msgid " [APCS-32]" +msgstr " [APCS-32]" + +#: elf32-arm.h:2403 +msgid " [VFP float format]" +msgstr "" + +#: elf32-arm.h:2405 +msgid " [FPA float format]" +msgstr "" + +#: elf32-arm.h:2414 +msgid " [new ABI]" +msgstr " [¿· ABI]" + +#: elf32-arm.h:2417 +msgid " [old ABI]" +msgstr " [µì ABI]" + +#: elf32-arm.h:2420 +msgid " [software FP]" +msgstr " [¥½¥Õ¥È¥¦¥§¥¢ÉâÆ°¾®¿ôÅÀ]" + +#: elf32-arm.h:2428 +msgid " [Version1 EABI]" +msgstr " [¥Ð¡¼¥¸¥ç¥ó1 EABI]" + +#: elf32-arm.h:2431 elf32-arm.h:2442 +msgid " [sorted symbol table]" +msgstr " [¥½¡¼¥ÈºÑ¥·¥ó¥Ü¥ë¥Æ¡¼¥Ö¥ë]" + +#: elf32-arm.h:2433 elf32-arm.h:2444 +msgid " [unsorted symbol table]" +msgstr " [̤¥½¡¼¥È¥·¥ó¥Ü¥ë¥Æ¡¼¥Ö¥ë]" + +#: elf32-arm.h:2439 +#, fuzzy +msgid " [Version2 EABI]" +msgstr " [¥Ð¡¼¥¸¥ç¥ó1 EABI]" + +#: elf32-arm.h:2447 +msgid " [dynamic symbols use segment index]" +msgstr "" + +#: elf32-arm.h:2450 +msgid " [mapping symbols precede others]" +msgstr "" + +#: elf32-arm.h:2457 +msgid " " +msgstr " " + +#: elf32-arm.h:2464 +msgid " [relocatable executable]" +msgstr " [ºÆÇÛÃÖ²Äǽ¼Â¹Ô¥Õ¥¡¥¤¥ë]" + +#: elf32-arm.h:2467 +msgid " [has entry point]" +msgstr " [¥¨¥ó¥È¥ê¥Ý¥¤¥ó¥È¤ò»ý¤Ã¤Æ¤¤¤Þ¤¹]" + +#: elf32-arm.h:2472 +msgid "" +msgstr "<¥Õ¥é¥°¥Ó¥Ã¥È¥»¥Ã¥È¤òǧ¼±¤Ç¤­¤Þ¤»¤ó>" + +#: elf32-avr.c:843 elf32-cris.c:1414 elf32-fr30.c:661 elf32-i860.c:1056 +#: elf32-openrisc.c:463 elf32-v850.c:1699 elf32-xstormy16.c:984 +#: elf64-mmix.c:1172 +msgid "internal error: dangerous relocation" +msgstr "ÆâÉô¥¨¥é¡¼: ´í¸±¤ÊºÆÇÛÃ֤Ǥ¹" + +#: elf32-cris.c:949 +#, fuzzy, c-format +msgid "%s: unresolvable relocation %s against symbol `%s' from %s section" +msgstr "%s: ·Ù¹ð: ¥·¥ó¥Ü¥ë `%s' (%s ¥»¥¯¥·¥ç¥ó)¤ËÂФ¹¤ëºÆÇÛÃÖ¤ò²ò·è¤Ç¤­¤Þ¤»¤ó" + +#: elf32-cris.c:1012 +#, fuzzy, c-format +msgid "" +"%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section" +msgstr "%s: ·Ù¹ð: ¥·¥ó¥Ü¥ë `%s' (%s ¥»¥¯¥·¥ç¥ó)¤ËÂФ¹¤ëºÆÇÛÃÖ¤ò²ò·è¤Ç¤­¤Þ¤»¤ó" + +#: elf32-cris.c:1015 elf32-cris.c:1142 +msgid "[whose name is lost]" +msgstr "" + +#: elf32-cris.c:1131 +#, fuzzy, c-format +msgid "" +"%s: relocation %s with non-zero addend %d against local symbol from %s " +"section" +msgstr "%s: ·Ù¹ð: ¥·¥ó¥Ü¥ë `%s' (%s ¥»¥¯¥·¥ç¥ó)¤ËÂФ¹¤ëºÆÇÛÃÖ¤ò²ò·è¤Ç¤­¤Þ¤»¤ó" + +#: elf32-cris.c:1138 +#, fuzzy, c-format +msgid "" +"%s: relocation %s with non-zero addend %d against symbol `%s' from %s section" +msgstr "%s: ·Ù¹ð: ¥·¥ó¥Ü¥ë `%s' (%s ¥»¥¯¥·¥ç¥ó)¤ËÂФ¹¤ëºÆÇÛÃÖ¤ò²ò·è¤Ç¤­¤Þ¤»¤ó" + +#: elf32-cris.c:1156 +#, fuzzy, c-format +msgid "" +"%s: relocation %s is not allowed for global symbol: `%s' from %s section" +msgstr "%s: ºÆÇÛÃÖ %s ¤Ï¥·¥ó¥Ü¥ë %s ÍѤΤâ¤Î¤È¤·¤Æ¤Ï¤Þ¤À¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: elf32-cris.c:1171 +#, fuzzy, c-format +msgid "%s: relocation %s in section %s with no GOT created" +msgstr "%s: ¥»¥¯¥·¥ç¥ó `%s' Æâ¤ÎºÆÇÛÃÖÎΰè¤ËÆâÍÆ¤¬¤¢¤ê¤Þ¤»¤ó" + +#: elf32-cris.c:1289 +#, fuzzy, c-format +msgid "%s: Internal inconsistency; no relocation section %s" +msgstr "%s ÍѤκÆÇÛÃÖ¥»¥¯¥·¥ç¥ó¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó" + +#: elf32-cris.c:2523 +#, fuzzy, c-format +msgid "" +"%s, section %s:\n" +" relocation %s should not be used in a shared object; recompile with -fPIC" +msgstr "" +"%s: ºÆÇÛÃÖ %s ¤Ï¶¦Í­¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¤¿¤È¤­¤Ë¤Ï»È¤¦¤Ù¤­¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó -- -" +"fPIC ¤ò¤Ä¤±¤ÆºÆ¥³¥ó¥Ñ¥¤¥ë¤·¤Æ¤¯¤À¤µ¤¤" + +#: elf32-cris.c:2994 +msgid " [symbols have a _ prefix]" +msgstr " [ _ ÀÜÆ¬¼­¤Ä¤­¥·¥ó¥Ü¥ë]" + +#: elf32-cris.c:3033 +#, c-format +msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols" +msgstr "" +"%s: _ ÀÜÆ¬¼­¥·¥ó¥Ü¥ë¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¢¥Õ¥¡¥¤¥ë¤ËÀÜÆ¬¼­Ìµ¤·¤Ç½ñ¤­¹þ¤ß¤Þ¤¹" + +#: elf32-cris.c:3034 +#, c-format +msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols" +msgstr "" +"%s: ÀÜÆ¬¼­Ìµ¤·¤Î¥·¥ó¥Ü¥ë¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¢¥Õ¥¡¥¤¥ë¤Ë¤Ï _ ÀÜÆ¬¼­ÉÕ¤­¤Ç½ñ¤­¹þ¤ß" +"¤Þ¤¹" + +#: elf32-gen.c:82 elf64-gen.c:82 +#, c-format +msgid "%s: Relocations in generic ELF (EM: %d)" +msgstr "" + +#: elf32-hppa.c:646 +#, c-format +msgid "%s: cannot create stub entry %s" +msgstr "%s: ¥¹¥¿¥Ö¥¨¥ó¥È¥ê %s ¤òºîÀ®¤Ç¤­¤Þ¤»¤ó" + +#: elf32-hppa.c:937 elf32-hppa.c:3545 +#, c-format +msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections" +msgstr "" +"%s(%s+0x%lx): %s ¤ËÆÏ¤­¤Þ¤»¤ó¡£-ffunction-sections ¤òÉÕ¤±¤ÆºÆ¥³¥ó¥Ñ¥¤¥ë¤·¤Æ¤¯" +"¤À¤µ¤¤" + +#: elf32-hppa.c:1312 +#, c-format +msgid "" +"%s: relocation %s can not be used when making a shared object; recompile " +"with -fPIC" +msgstr "" +"%s: ºÆÇÛÃÖ %s ¤Ï¶¦Í­¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¤¿¤È¤­¤Ë¤Ï»È¤¨¤Þ¤»¤ó -- -fPIC ¤òÉÕ¤±" +"¤ÆºÆ¥³¥ó¥Ñ¥¤¥ë¤·¤Æ¤¯¤À¤µ¤¤" + +#: elf32-hppa.c:1332 +#, c-format +msgid "" +"%s: relocation %s should not be used when making a shared object; recompile " +"with -fPIC" +msgstr "" +"%s: ºÆÇÛÃÖ %s ¤Ï¶¦Í­¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¤¿¤È¤­¤Ë¤Ï»È¤¦¤Ù¤­¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó -- -" +"fPIC ¤ò¤Ä¤±¤ÆºÆ¥³¥ó¥Ñ¥¤¥ë¤·¤Æ¤¯¤À¤µ¤¤" + +#: elf32-hppa.c:1525 +#, c-format +msgid "Could not find relocation section for %s" +msgstr "%s ÍѤκÆÇÛÃÖ¥»¥¯¥·¥ç¥ó¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó" + +#: elf32-hppa.c:2867 +#, c-format +msgid "%s: duplicate export stub %s" +msgstr "%s: export ¥¹¥¿¥Ö %s ¤¬½ÅÊ£¤·¤Æ¤¤¤Þ¤¹" + +#: elf32-hppa.c:3429 +#, c-format +msgid "%s(%s+0x%lx): fixing %s" +msgstr "%s(%s+0x%lx): %s ¤ò½¤Éü¤·¤Þ¤¹" + +#: elf32-hppa.c:4069 +#, c-format +msgid "%s(%s+0x%lx): cannot handle %s for %s" +msgstr "%s(%s+0x%lx): %s (%s) ¤ò¼è¤ê°·¤¨¤Þ¤»¤ó" + +#: elf32-hppa.c:4408 +msgid ".got section not immediately after .plt section" +msgstr ".got ¥»¥¯¥·¥ç¥ó¤¬ .plt ¥»¥¯¥·¥ç¥ó¤Îľ¸å¤Ë¤¢¤ê¤Þ¤»¤ó" + +#: elf32-i386.c:298 +#, c-format +msgid "%s: invalid relocation type %d" +msgstr "%s: ºÆÇÛÃÖ¥¿¥¤¥× %d ¤ÏÉÔŬÀڤǤ¹" + +#: elf32-i386.c:718 elf32-s390.c:636 elf64-s390.c:595 +#, fuzzy, c-format +msgid "%s: bad symbol index: %d" +msgstr "%s: ºÆÇÛÃÖÆâ¤Î¥·¥ó¥Ü¥ë¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬ÉÔÀµ¤Ç¤¹: %d" + +#: elf32-i386.c:863 elf32-s390.c:790 elf64-ppc.c:2198 elf64-s390.c:759 +#, fuzzy, c-format +msgid "%s: bad relocation section name `%s'" +msgstr "%s: ÉÔÀµ¤Ê¥»¥¯¥·¥ç¥ó̾ `%s' ¤Ç¤¹" + +#: elf32-i386.c:2069 elf32-s390.c:1951 elf64-ppc.c:4124 elf64-s390.c:1955 +#, fuzzy, c-format +msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'" +msgstr "%s: ·Ù¹ð: ¥·¥ó¥Ü¥ë `%s' (%s ¥»¥¯¥·¥ç¥ó)¤ËÂФ¹¤ëºÆÇÛÃÖ¤ò²ò·è¤Ç¤­¤Þ¤»¤ó" + +#: elf32-i386.c:2107 elf32-s390.c:1989 elf64-s390.c:1993 +#, fuzzy, c-format +msgid "%s(%s+0x%lx): reloc against `%s': error %d" +msgstr "%s(%s+0x%lx): %s (%s) ¤ò¼è¤ê°·¤¨¤Þ¤»¤ó" + +#: elf32-m32r.c:923 +msgid "SDA relocation when _SDA_BASE_ not defined" +msgstr "_SDA_BASE_ ¤¬Ì¤ÄêµÁ¤Î»þÅÀ¤Ç¤Î SDA ºÆÇÛÃ֤Ǥ¹" + +#: elf32-ia64.c:3537 elf32-m32r.c:1007 elf32-ppc.c:2930 elf64-ia64.c:3537 +#, c-format +msgid "%s: unknown relocation type %d" +msgstr "%s: ºÆÇÛÃÖ¥¿¥¤¥× %d ¤¬ÉÔÌÀ¤Ç¤¹" + +#: elf32-m32r.c:1223 +#, c-format +msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)" +msgstr "%s: ¥¿¡¼¥²¥Ã¥È (%s, %s ºÆÇÛÃÖ) ¤¬´Ö°ã¤Ã¤¿¥»¥¯¥·¥ç¥ó (%s) Æâ¤Ë¤¢¤ê¤Þ¤¹" + +#: elf32-m32r.c:2000 +#, c-format +msgid "%s: Instruction set mismatch with previous modules" +msgstr "%s: Ì¿Î᥻¥Ã¥È¤¬°ÊÁ°¤Î¥â¥¸¥å¡¼¥ë¤ÈŬ¹ç¤·¤Þ¤»¤ó" + +#: elf32-m32r.c:2023 +#, c-format +msgid "private flags = %lx" +msgstr "private ¥Õ¥é¥° = %lx" + +#: elf32-m32r.c:2028 +msgid ": m32r instructions" +msgstr ": m32r Ì¿Îá" + +#: elf32-m32r.c:2029 +msgid ": m32rx instructions" +msgstr ": m32rx Ì¿Îá" + +#: elf32-m68k.c:413 +msgid " [cpu32]" +msgstr " [cpu32]" + +#: elf32-mcore.c:353 elf32-mcore.c:479 +#, c-format +msgid "%s: Relocation %s (%d) is not currently supported.\n" +msgstr "%s: ºÆÇÛÃÖ %s (%d) ¤Ï¸½ºß¤Î¤È¤³¤í¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó\n" + +#: elf32-mcore.c:438 +#, c-format +msgid "%s: Unknown relocation type %d\n" +msgstr "%s: ºÆÇÛÃÖ¥¿¥¤¥× %d ¤ÏÉÔÌÀ¤Ç¤¹\n" + +#: elf32-mips.c:2156 elf64-mips.c:1972 +msgid "32bits gp relative relocation occurs for an external symbol" +msgstr "32¥Ó¥Ã¥È gp ´ØÏ¢ºÆÇÛÃÖ¤¬³°Éô¥·¥ó¥Ü¥ë¤ÎÍѤËȯÀ¸¤·¤Þ¤·¤¿" + +#: elf32-mips.c:2305 +#, c-format +msgid "Linking mips16 objects into %s format is not supported" +msgstr "" +"%s ·Á¼°¤Ø¤Î mips16 ¥ª¥Ö¥¸¥§¥¯¥È¤ò¥ê¥ó¥¯¤¹¤ë¤³¤È¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: elf32-mips.c:3129 +#, c-format +msgid "%s: linking PIC files with non-PIC files" +msgstr "%s: PIC ¥Õ¥¡¥¤¥ë¤ËÈó PIC ¥Õ¥¡¥¤¥ë¤ò¥ê¥ó¥¯¤·¤è¤¦¤È¤·¤Þ¤·¤¿" + +#: elf32-mips.c:3139 +#, c-format +msgid "%s: linking abicalls files with non-abicalls files" +msgstr "%s: abicall ¥Õ¥¡¥¤¥ë¤ËÈó abicall ¥Õ¥¡¥¤¥ë¤ò¥ê¥ó¥¯¤·¤è¤¦¤È¤·¤Þ¤·¤¿" + +#: elf32-mips.c:3168 +#, c-format +msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)" +msgstr "%s: ISA (-mips%d) ¤¬°ÊÁ°¤Î¥â¥¸¥å¡¼¥ë (-mips%d) ¤È°ìÃפ·¤Þ¤»¤ó" + +#: elf32-mips.c:3177 +#, c-format +msgid "%s: ISA mismatch (%d) with previous modules (%d)" +msgstr "%s: ISA (%d) ¤¬°ÊÁ°¤Î¥â¥¸¥å¡¼¥ë (%d) ¤È°ìÃפ·¤Þ¤»¤ó" + +#: elf32-mips.c:3200 +#, c-format +msgid "%s: ABI mismatch: linking %s module with previous %s modules" +msgstr "" +"%s: ABI ¤¬°ìÃפ·¤Þ¤»¤ó -- %s ¥â¥¸¥å¡¼¥ë¤ò°ÊÁ°¤Î %s ¥â¥¸¥å¡¼¥ë¤È¥ê¥ó¥¯¤·¤è¤¦¤È" +"¤·¤Þ¤·¤¿" + +#: elf32-mips.c:3214 elf32-ppc.c:1470 elf64-ppc.c:1556 elf64-sparc.c:3027 +#, c-format +msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "" +"%s: »ÈÍѤ·¤Æ¤¤¤ë e_flags(0x%lx) ¤¬°ÊÁ°¤Î¥â¥¸¥å¡¼¥ë (0x%lx) ¤È°Û¤Ê¤Ã¤Æ¤¤¤Þ¤¹" + +#: elf32-mips.c:3245 +msgid " [abi=O32]" +msgstr " [abi=O32]" + +#: elf32-mips.c:3247 +msgid " [abi=O64]" +msgstr " [abi=O64]" + +#: elf32-mips.c:3249 +msgid " [abi=EABI32]" +msgstr " [abi=EABI32]" + +#: elf32-mips.c:3251 +msgid " [abi=EABI64]" +msgstr " [abi=EABI64]" + +#: elf32-mips.c:3253 +msgid " [abi unknown]" +msgstr " [abi unknown]" + +#: elf32-mips.c:3255 +msgid " [abi=N32]" +msgstr " [abi=N32]" + +#: elf32-mips.c:3257 +msgid " [abi=64]" +msgstr " [abi=64]" + +#: elf32-mips.c:3259 +msgid " [no abi set]" +msgstr " [abi ¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó]" + +#: elf32-mips.c:3262 +msgid " [mips1]" +msgstr " [mips1]" + +#: elf32-mips.c:3264 +msgid " [mips2]" +msgstr " [mips2]" + +#: elf32-mips.c:3266 +msgid " [mips3]" +msgstr " [mips3]" + +#: elf32-mips.c:3268 +msgid " [mips4]" +msgstr " [mips4]" + +#: elf32-mips.c:3270 +msgid " [mips5]" +msgstr " [mips5]" + +#: elf32-mips.c:3272 +msgid " [mips32]" +msgstr " [mips32]" + +#: elf32-mips.c:3274 +msgid " [mips64]" +msgstr " [mips64]" + +#: elf32-mips.c:3276 +msgid " [unknown ISA]" +msgstr " [ÉÔÌÀ¤Ê ISA]" + +#: elf32-mips.c:3279 +msgid " [32bitmode]" +msgstr " [32¥Ó¥Ã¥È¥â¡¼¥É]" + +#: elf32-mips.c:3281 +msgid " [not 32bitmode]" +msgstr " [Èó 32 ¥Ó¥Ã¥È¥â¡¼¥É]" + +#: elf32-mips.c:4954 +msgid "static procedure (no name)" +msgstr "ÀÅŪ¥×¥í¥·¡¼¥¸¥ã(̾Á°Ìµ¤·)" + +#: elf32-mips.c:5572 elf64-mips.c:6694 +#, c-format +msgid "%s: illegal section name `%s'" +msgstr "%s: ÉÔÀµ¤Ê¥»¥¯¥·¥ç¥ó̾ `%s' ¤Ç¤¹" + +#: elf32-mips.c:6139 elf64-mips.c:3150 +msgid "not enough GOT space for local GOT entries" +msgstr "¶É½ê GOT ¥¨¥ó¥È¥êÍѤΠGOT ¶õ´Ö¤¬ÉÔ½½Ê¬¤Ç¤¹" + +#: elf32-mips.c:7250 elf64-mips.c:4203 +#, c-format +msgid "%s: %s+0x%lx: jump to stub routine which is not jal" +msgstr "%s: %s+0x%lx: jal ¤Ç¤Ï¤Ê¤¤¥¹¥¿¥Ö¥ë¡¼¥Á¥ó¤Ø¤Î¥¸¥ã¥ó¥×¤Ç¤¹" + +#: elf32-mips.c:8259 elf64-mips.c:5891 +#, fuzzy, c-format +msgid "%s: Malformed reloc detected for section %s" +msgstr "¥»¥¯¥·¥ç¥ó %s ÍѤȤ·¤Æ¤Ï¤ª¤«¤·¤ÊºÆÇÛÃÖ¤ò¸¡½Ð¤·¤Þ¤·¤¿" + +#: elf32-mips.c:8337 elf64-mips.c:5969 +#, c-format +msgid "%s: CALL16 reloc at 0x%lx not against global symbol" +msgstr "%s: 0x%lx ¤Ç¤Î CALL16 ºÆÇÛÃÖ¤¬Âç°è¥·¥ó¥Ü¥ë¤òÂоݤȤ·¤Æ¤¤¤Þ¤»¤ó" + +#: elf32-ppc.c:1436 elf64-ppc.c:1521 +#, c-format +msgid "" +"%s: compiled with -mrelocatable and linked with modules compiled normally" +msgstr "" +"%s: -mrelocatable ¤òÉÕ¤±¤Æ¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿¤â¤Î¤ÈÉáÄ̤˥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿¥â" +"¥¸¥å¡¼¥ë¤È¤ò¥ê¥ó¥¯¤·¤Þ¤·¤¿" + +#: elf32-ppc.c:1444 elf64-ppc.c:1529 +#, c-format +msgid "" +"%s: compiled normally and linked with modules compiled with -mrelocatable" +msgstr "" +"%s: ÉáÄ̤˥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿¤â¤Î¤È -mrelocatable ¤òÉÕ¤±¤Æ¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿¥â" +"¥¸¥å¡¼¥ë¤È¤ò¥ê¥ó¥¯¤·¤Þ¤·¤¿" + +#: elf32-ppc.c:1568 +#, c-format +msgid "%s: Unknown special linker type %d" +msgstr "%s: ¥¹¥Ú¥·¥ã¥ë¥ê¥ó¥«¥¿¥¤¥× %d ¤¬ÉÔÌÀ¤Ç¤¹" + +#: elf32-ppc.c:2218 elf32-ppc.c:2252 elf32-ppc.c:2287 +#, c-format +msgid "%s: relocation %s cannot be used when making a shared object" +msgstr "%s: ºÆÇÛÃÖ %s ¤Ï¶¦Í­¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¤Æ¤¤¤ë»þÅÀ¤Ç¤ÏÍøÍѤǤ­¤Þ¤»¤ó" + +#: elf32-ppc.c:3097 elf64-ppc.c:3716 +#, c-format +msgid "%s: unknown relocation type %d for symbol %s" +msgstr "%s: ºÆÇÛÃÖ¥¿¥¤¥× %d (¥·¥ó¥Ü¥ë %s) ¤¬ÉÔÌÀ¤Ç¤¹" + +#: elf32-ppc.c:3452 elf32-ppc.c:3473 elf32-ppc.c:3523 +#, c-format +msgid "" +"%s: The target (%s) of a %s relocation is in the wrong output section (%s)" +msgstr "%s: ¥¿¡¼¥²¥Ã¥È %s (%sºÆÇÛÃÖ) ¤¬´Ö°ã¤Ã¤¿½ÐÎÏ¥»¥¯¥·¥ç¥ó (%s) ¤Ë¤¢¤ê¤Þ¤¹" + +#: elf32-ppc.c:3589 +#, c-format +msgid "%s: Relocation %s is not yet supported for symbol %s." +msgstr "%s: ºÆÇÛÃÖ %s ¤Ï¥·¥ó¥Ü¥ë %s ÍѤΤâ¤Î¤È¤·¤Æ¤Ï¤Þ¤À¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: elf32-sh.c:1101 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES offset" +msgstr "%s: 0x%lx: ·Ù¹ð: R_SH_USES ¥ª¥Õ¥»¥Ã¥È¤¬ÉÔÀµ¤Ç¤¹" + +#: elf32-sh.c:1113 +#, c-format +msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x" +msgstr "%s: 0x%lx: ·Ù¹ð: R_SH_USES ¤¬Ç§¼±¤Ç¤­¤Ê¤¤Ì¿Îá 0x%x ¤ò»Ø¤·¤Æ¤¤¤Þ¤¹" + +#: elf32-sh.c:1130 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES load offset" +msgstr "%s: 0x%lx: ·Ù¹ð: R_SH_USES load ¥ª¥Õ¥»¥Ã¥È¤¬ÉÔÀµ¤Ç¤¹" + +#: elf32-sh.c:1145 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected reloc" +msgstr "%s: 0x%lx: ·Ù¹ð: ¸ºß¤¹¤ë¤Ï¤º¤ÎºÆÇÛÃÖÎΰè¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó" + +#: elf32-sh.c:1202 +#, c-format +msgid "%s: 0x%lx: warning: symbol in unexpected section" +msgstr "%s: 0x%lx: ·Ù¹ð: ¥·¥ó¥Ü¥ë¤¬Í½´ü¤»¤Ì¥»¥¯¥·¥ç¥ó¤Ë¤¢¤ê¤Þ¤¹" + +#: elf32-sh.c:1323 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected COUNT reloc" +msgstr "%s: 0x%lx: ·Ù¹ð: ¸ºß¤¹¤ë¤Ï¤º¤Î COUNT ºÆÇÛÃÖÎΰè¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó" + +#: elf32-sh.c:1332 +#, c-format +msgid "%s: 0x%lx: warning: bad count" +msgstr "%s: 0x%lx: ·Ù¹ð: count ¤¬ÉÔÀµ¤Ç¤¹" + +#: elf32-sh.c:1741 elf32-sh.c:2132 +#, c-format +msgid "%s: 0x%lx: fatal: reloc overflow while relaxing" +msgstr "%s: 0x%lx: Ã×̿Ū: relax Ãæ¤ËºÆÇÛÃÖÎΰ褬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿" + +#: elf32-sh.c:3267 +#, c-format +msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation" +msgstr "" + +#: elf32-sparc.c:1554 elf64-sparc.c:2280 +#, c-format +msgid "%s: probably compiled without -fPIC?" +msgstr "%s: ¶²¤é¤¯ -fPIC ¤òÉÕ¤±¤º¤Ë¥³¥ó¥Ñ¥¤¥ë¤·¤¿¤Î¤Ç¤Ï¡©" + +#: elf32-sparc.c:2007 +#, c-format +msgid "%s: compiled for a 64 bit system and target is 32 bit" +msgstr "" +"%s: 64 ¥Ó¥Ã¥È¥·¥¹¥Æ¥àÍѤ˥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤Þ¤·¤¿¤¬¥¿¡¼¥²¥Ã¥È¤¬ 32 ¥Ó¥Ã¥È¤Ç¤¹" + +#: elf32-sparc.c:2021 +#, c-format +msgid "%s: linking little endian files with big endian files" +msgstr "" +"%s: ¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤Î¥Õ¥¡¥¤¥ë¤È¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Î¥Õ¥¡¥¤¥ë¤È¤ò¥ê¥ó¥¯¤·¤è" +"¤¦¤È¤·¤Æ¤¤¤Þ¤¹" + +#: elf32-v850.c:682 +#, c-format +msgid "Variable `%s' cannot occupy in multiple small data regions" +msgstr "ÊÑ¿ô `%s' ¤ÏÊ£¿ô¤Î small ¥Ç¡¼¥¿Îΰè¤òÀêÍ­¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó" + +#: elf32-v850.c:685 +#, c-format +msgid "" +"Variable `%s' can only be in one of the small, zero, and tiny data regions" +msgstr "" +"ÊÑ¿ô `%s' ¤Ï small, zero µÚ¤Ó tiny ¥Ç¡¼¥¿Îΰè¤ÎÆâ°ì¤Ä¤Ë¤Î¤ßÃÖ¤¯¤³¤È¤¬¤Ç¤­¤Þ¤¹" + +#: elf32-v850.c:688 +#, c-format +msgid "" +"Variable `%s' cannot be in both small and zero data regions simultaneously" +msgstr "ÊÑ¿ô `%s' ¤ò small ¤È zero ¥Ç¡¼¥¿ÎÎ°è¤ØÆ±»þ¤ËÃÖ¤¯¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó" + +#: elf32-v850.c:691 +#, c-format +msgid "" +"Variable `%s' cannot be in both small and tiny data regions simultaneously" +msgstr "ÊÑ¿ô `%s' ¤ò small ¤È tiny ¥Ç¡¼¥¿ÎÎ°è¤ØÆ±»þ¤ËÃÖ¤¯¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó" + +#: elf32-v850.c:694 +#, c-format +msgid "" +"Variable `%s' cannot be in both zero and tiny data regions simultaneously" +msgstr "ÊÑ¿ô `%s' ¤Ï zero ¤È tiny ¥Ç¡¼¥¿ÎÎ°è¤ØÆ±»þ¤ËÃÖ¤¯¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó" + +#: elf32-v850.c:1072 +msgid "FAILED to find previous HI16 reloc\n" +msgstr "°ÊÁ°¤Î HI16 ºÆÇÛÃÖ¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó¤Ç¤·¤¿\n" + +#: elf32-v850.c:1703 +msgid "could not locate special linker symbol __gp" +msgstr "ÆÃ¼ì¥ê¥ó¥«¥·¥ó¥Ü¥ë __gp ¤Î°ÌÃÖ¤òÆÃÄê¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿" + +#: elf32-v850.c:1707 +msgid "could not locate special linker symbol __ep" +msgstr "ÆÃ¼ì¥ê¥ó¥«¥·¥ó¥Ü¥ë __ep ¤Î°ÌÃÖ¤òÆÃÄê¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿" + +#: elf32-v850.c:1711 +msgid "could not locate special linker symbol __ctbp" +msgstr "ÆÃ¼ì¥ê¥ó¥«¥·¥ó¥Ü¥ë __ctbp ¤Î°ÌÃÖ¤òÆÃÄê¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿" + +#: elf32-v850.c:1877 +#, c-format +msgid "%s: Architecture mismatch with previous modules" +msgstr "%s: °ÊÁ°¤Î¥â¥¸¥å¡¼¥ë¤È¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤¬°ìÃפ·¤Þ¤»¤ó" + +#: elf32-v850.c:1897 +#, c-format +msgid "private flags = %lx: " +msgstr "private ¥Õ¥é¥° = %lx: " + +#: elf32-v850.c:1902 +msgid "v850 architecture" +msgstr "v850 ¥¢¡¼¥­¥Æ¥¯¥Á¥ã" + +#: elf32-v850.c:1903 +msgid "v850e architecture" +msgstr "v850e ¥¢¡¼¥­¥Æ¥¯¥Á¥ã" + +#: elf32-v850.c:1904 +msgid "v850ea architecture" +msgstr "v850ea ¥¢¡¼¥­¥Æ¥¯¥Á¥ã" + +#: elf32-ia64.c:2247 elf32-xstormy16.c:414 elf64-ia64.c:2247 +msgid "non-zero addend in @fptr reloc" +msgstr "" + +#: elf64-alpha.c:858 +msgid "GPDISP relocation did not find ldah and lda instructions" +msgstr "GPDISP ºÆÇÛÃÖ¤¬ ldah ¤È lda Ì¿Îá¤ò¸«¤Ä¤±¤Þ¤»¤ó¤Ç¤·¤¿" + +#: elf64-alpha.c:2934 +#, c-format +msgid "%s: .got subsegment exceeds 64K (size %d)" +msgstr "%s: .got ¥µ¥Ö¥»¥°¥á¥ó¥È¤¬ 64K ¤òͤ¨¤Æ¤¤¤Þ¤¹ (¥µ¥¤¥º %d)" + +#: elf64-alpha.c:3518 elf64-alpha.c:3530 +#, fuzzy, c-format +msgid "%s: gp-relative relocation against dynamic symbol %s" +msgstr "32¥Ó¥Ã¥È gp ´ØÏ¢ºÆÇÛÃÖ¤¬³°Éô¥·¥ó¥Ü¥ë¤ÎÍѤËȯÀ¸¤·¤Þ¤·¤¿" + +#: elf64-hppa.c:2070 +#, c-format +msgid "stub entry for %s cannot load .plt, dp offset = %ld" +msgstr "" + +#: elf64-mmix.c:1271 +#, c-format +msgid "%s: register relocation against non-register symbol: (unknown) in %s" +msgstr "" + +#: elf64-mmix.c:1276 +#, fuzzy, c-format +msgid "%s: register relocation against non-register symbol: %s in %s" +msgstr "%s: ·Ù¹ð: ¥·¥ó¥Ü¥ë `%s' (%s ¥»¥¯¥·¥ç¥ó)¤ËÂФ¹¤ëºÆÇÛÃÖ¤ò²ò·è¤Ç¤­¤Þ¤»¤ó" + +#: elf64-mmix.c:1312 +#, c-format +msgid "%s: directive LOCAL valid only with a register or absolute value" +msgstr "" + +#: elf64-mmix.c:1340 +#, c-format +msgid "" +"%s: LOCAL directive: Register $%ld is not a local register. First global " +"register is $%ld." +msgstr "" + +#: elf64-mmix.c:1615 +#, c-format +msgid "" +"%s: Error: multiple definition of `%s'; start of %s is set in a earlier " +"linked file\n" +msgstr "" + +#: elf64-mmix.c:1674 +#, fuzzy +msgid "Register section has contents\n" +msgstr "¥»¥¯¥·¥ç¥ó¤ËÆâÍÆ¤¬¤¢¤ê¤Þ¤»¤ó" + +#: elf64-ppc.c:1484 libbfd.c:1436 +#, c-format +msgid "%s: compiled for a big endian system and target is little endian" +msgstr "" +"%s: ¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¥·¥¹¥Æ¥àÍѤ˥³¥ó¥Ñ¥¤¥ë¤µ¤ì¡¢¥¿¡¼¥²¥Ã¥È¤¬¥ê¥È¥ë¥¨¥ó¥Ç¥£" +"¥¢¥ó¤Ç¤¹" + +#: elf64-ppc.c:1486 libbfd.c:1438 +#, c-format +msgid "%s: compiled for a little endian system and target is big endian" +msgstr "" +"%s: ¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¥·¥¹¥Æ¥àÍѤ˥³¥ó¥Ñ¥¤¥ë¤µ¤ì¡¢¥¿¡¼¥²¥Ã¥È¤¬¥Ó¥Ã¥°¥¨¥ó¥Ç¥£" +"¥¢¥ó¤Ç¤¹¡£" + +#: elf64-ppc.c:3350 +#, c-format +msgid "linkage table error against `%s'" +msgstr "" + +#: elf64-ppc.c:3432 +msgid "stub section size doesn't match calculated size" +msgstr "" + +#: elf64-ppc.c:4061 +#, fuzzy, c-format +msgid "%s: Relocation %s is not supported for symbol %s." +msgstr "%s: ºÆÇÛÃÖ %s ¤Ï¥·¥ó¥Ü¥ë %s ÍѤΤâ¤Î¤È¤·¤Æ¤Ï¤Þ¤À¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: elf64-ppc.c:4105 +#, c-format +msgid "%s: error: relocation %s not a multiple of 4" +msgstr "" + +#: elf64-sparc.c:1277 +#, c-format +msgid "%s: check_relocs: unhandled reloc type %d" +msgstr "%s: check_relocs: ºÆÇÛÃÖ¥¿¥¤¥× %d ¤Ï¼è¤ê°·¤ï¤ì¤Þ¤»¤ó" + +#: elf64-sparc.c:1314 +#, c-format +msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER" +msgstr "%s: STT_REGISTER ¤ò»È¤¦¤ÈÀë¸À¤Ç¤­¤ë¤Î¤Ï¥ì¥¸¥¹¥¿ %%g[2367] ¤À¤±¤Ç¤¹" + +#: elf64-sparc.c:1334 +#, fuzzy, c-format +msgid "Register %%g%d used incompatibly: %s in %s, previously %s in %s" +msgstr "" +"¥ì¥¸¥¹¥¿ %%g%d ¤ÏÌ·½â¤·¤Æ»È¤ï¤ì¤Þ¤·¤¿: °ÊÁ°¤ÎÀë¸À¤Ï %s ¤Ç %s¡¢%s ¤Ç %s ¤ÈºÆÄê" +"µÁ¤µ¤ì¤Þ¤·¤¿" + +#: elf64-sparc.c:1357 +#, fuzzy, c-format +msgid "Symbol `%s' has differing types: REGISTER in %s, previously %s in %s" +msgstr "" +"¥·¥ó¥Ü¥ë `%s' ¤Ï°Û¤Ê¤ë·¿¤ò»ý¤Ã¤Æ¤¤¤Þ¤¹: %s ¤Ç REGISTER, ¤Ç¤¹¤¬ %s ¤È %s ¤ÇÄê" +"µÁ¤µ¤ì¤Æ¤¤¤Þ¤¹" + +#: elf64-sparc.c:1404 +#, fuzzy, c-format +msgid "Symbol `%s' has differing types: %s in %s, previously REGISTER in %s" +msgstr "¥·¥ó¥Ü¥ë `%s' ¤Ï°Û¤Ê¤ë·¿¤ò¤â¤Ã¤Æ¤¤¤Þ¤¹: °ÊÁ°¤Ï %s, %s ¤Ç¤Ï REGISTER" + +#: elf64-sparc.c:3008 +#, c-format +msgid "%s: linking UltraSPARC specific with HAL specific code" +msgstr "" +"%s: UltraSPARC ÆÃÍ­¤Î¥³¡¼¥É¤È HAL ÆÃÍ­¤Î¥³¡¼¥É¤È¤ò¥ê¥ó¥¯¤·¤è¤¦¤È¤·¤Æ¤¤¤Þ¤¹" + +#: elfcode.h:1218 +#, c-format +msgid "%s: version count (%ld) does not match symbol count (%ld)" +msgstr "%s: ¥Ð¡¼¥¸¥ç¥ó¥«¥¦¥ó¥È (%ld) ¤¬¥·¥ó¥Ü¥ë¥«¥¦¥ó¥È (%ld) ¤È°ìÃפ·¤Þ¤»¤ó" + +#: elflink.c:434 +#, fuzzy, c-format +msgid "%s: Section %s is too large to add hole of %ld bytes" +msgstr "%s: ´û¤Ë¥»¥¯¥·¥ç¥ó %s ¤ÏÂ礭¤¹¤®¤Æ %ld ¥Ð¥¤¥È¤Î hole ¤òÃÖ¤±¤Þ¤»¤ó" + +#: elflink.h:1113 +#, c-format +msgid "%s: warning: unexpected redefinition of `%s'" +msgstr "%s: ·Ù¹ð: `%s' ¤ÎºÆÄêµÁ¤Ï¤¢¤êÆÀ¤Ê¤¤¤³¤È¤Ç¤¹" + +#: elflink.h:1784 +#, c-format +msgid "%s: %s: invalid version %u (max %d)" +msgstr "%s: %s: ÉÔŬÀڤʥС¼¥¸¥ç¥ó %u (ºÇÂç %d)" + +#: elflink.h:1825 +#, c-format +msgid "%s: %s: invalid needed version %d" +msgstr "%s: %s: ɬÍפȤµ¤ì¤ë¥Ð¡¼¥¸¥ç¥ó %d ¤¬ÉÔŬÀڤǤ¹" + +#: elflink.h:1945 +#, c-format +msgid "Warning: size of symbol `%s' changed from %lu to %lu in %s" +msgstr "·Ù¹ð: ¥·¥ó¥Ü¥ë `%s' ¤Î¥µ¥¤¥º¤¬ %lu ¤«¤é %lu ¤ËÊѹ¹¤µ¤ì¤Þ¤·¤¿ (%s Æâ)" + +#: elflink.h:4014 +#, c-format +msgid "warning: type and size of dynamic symbol `%s' are not defined" +msgstr "·Ù¹ð: ưŪ¥·¥ó¥Ü¥ë `%s' ¤Î·¿¤È¥µ¥¤¥º¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: elflink.h:4320 +#, c-format +msgid "%s: undefined versioned symbol name %s" +msgstr "%s: ¥·¥ó¥Ü¥ë̾ %s ¤Î¥Ð¡¼¥¸¥ç¥ó¤¬Ì¤ÄêµÁ¤Ç¤¹" + +#: elflink.h:4544 elflink.h:4552 elflink.h:6203 elflink.h:7280 +msgid "Error: out of memory" +msgstr "" + +#: elflink.h:4714 +msgid "Not enough memory to sort relocations" +msgstr "" + +#: elflink.h:5980 +#, c-format +msgid "%s: could not find output section %s for input section %s" +msgstr "%s: ½ÐÎÏ¥»¥¯¥·¥ç¥ó %s (ÆþÎÏ¥»¥¯¥·¥ç¥ó %s ÍÑ) ¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó" + +#: elflink.h:6553 +#, fuzzy +msgid "warning: relocation against removed section; zeroing" +msgstr "%s: ·Ù¹ð: ¥·¥ó¥Ü¥ë `%s' (%s ¥»¥¯¥·¥ç¥ó)¤ËÂФ¹¤ëºÆÇÛÃÖ¤ò²ò·è¤Ç¤­¤Þ¤»¤ó" + +#: elflink.h:6583 +#, fuzzy +msgid "warning: relocation against removed section" +msgstr "%s: ·Ù¹ð: ¥·¥ó¥Ü¥ë `%s' (%s ¥»¥¯¥·¥ç¥ó)¤ËÂФ¹¤ëºÆÇÛÃÖ¤ò²ò·è¤Ç¤­¤Þ¤»¤ó" + +#: elflink.h:6596 +#, c-format +msgid "local symbols in discarded section %s" +msgstr "" + +#: i386linux.c:455 m68klinux.c:459 sparclinux.c:456 +#, c-format +msgid "Output file requires shared library `%s'\n" +msgstr "½ÐÎÏ¥Õ¥¡¥¤¥ë¤Ï¶¦Í­¥é¥¤¥Ö¥é¥ê `%s' ¤òɬÍפȤ·¤Æ¤¤¤Þ¤¹\n" + +#: i386linux.c:463 m68klinux.c:467 sparclinux.c:464 +#, c-format +msgid "Output file requires shared library `%s.so.%s'\n" +msgstr "½ÐÎÏ¥Õ¥¡¥¤¥ë¤Ï¶¦Í­¥é¥¤¥Ö¥é¥ê `%s.so.%s' ¤òɬÍפȤ·¤Æ¤¤¤Þ¤¹\n" + +#: i386linux.c:653 i386linux.c:703 m68klinux.c:660 m68klinux.c:708 +#: sparclinux.c:655 sparclinux.c:705 +#, c-format +msgid "Symbol %s not defined for fixups\n" +msgstr "¥·¥ó¥Ü¥ë %s ¤Ï fixup ÍѤËÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó\n" + +#: i386linux.c:727 m68klinux.c:732 sparclinux.c:729 +msgid "Warning: fixup count mismatch\n" +msgstr "·Ù¹ð: fixup ¥«¥¦¥ó¥È¤¬°ìÃפ·¤Þ¤»¤ó\n" + +#: ieee.c:235 +#, c-format +msgid "%s: string too long (%d chars, max 65535)" +msgstr "%s: ʸ»úÎó¤¬Ä¹¤¹¤®¤Þ¤¹ (%d ʸ»ú, ºÇÂç 65535)" + +#: ieee.c:365 +#, c-format +msgid "%s: unrecognized symbol `%s' flags 0x%x" +msgstr "%s: ¥·¥ó¥Ü¥ë `%s' ¥Õ¥é¥° 0x%x ¤òǧ¼±¤Ç¤­¤Þ¤»¤ó" + +#: ieee.c:877 +#, fuzzy, c-format +msgid "%s: unimplemented ATI record %u for symbol %u" +msgstr "%s: ATI ¥ì¥³¡¼¥É %u (¥·¥ó¥Ü¥ë %u ÍÑ) ¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: ieee.c:902 +#, c-format +msgid "%s: unexpected ATN type %d in external part" +msgstr "%s: external Éôʬ¤Ë¤¢¤ë ATN ¥¿¥¤¥× %d ¤È¤¤¤¦¤Î¤Ï¤¢¤êÆÀ¤Þ¤»¤ó" + +#: ieee.c:924 +#, c-format +msgid "%s: unexpected type after ATN" +msgstr "%s: ATN ¤Î¸å¤í¤Ë¤¢¤êÆÀ¤Ê¤¤¥¿¥¤¥×¤¬¤¢¤ê¤Þ¤¹" + +#: ihex.c:258 +#, c-format +msgid "%s:%d: unexpected character `%s' in Intel Hex file\n" +msgstr "%s:%d: Intel Hex ¥Õ¥¡¥¤¥ë¤È¤·¤Æ¤¢¤êÆÀ¤Ê¤¤Ê¸»ú `%s' ¤¬¤¢¤ê¤Þ¤¹\n" + +#: ihex.c:368 +#, fuzzy, c-format +msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)" +msgstr "%s:%d: Intel Hex ¥Õ¥¡¥¤¥ë¤Î¥Á¥§¥Ã¥¯¥µ¥à¤¬ÉÔÀµ¤Ç¤¹ (%u ¤ÎȦ¤¬ %u ¤Ç¤¹)" + +#: ihex.c:422 +#, fuzzy, c-format +msgid "%s:%u: bad extended address record length in Intel Hex file" +msgstr "%s:%d: ³ÈÄ¥¥¢¥É¥ì¥¹¥ì¥³¡¼¥ÉŤ¬ Intel Hex ¥Õ¥¡¥¤¥ë¤È¤·¤Æ¤ÏÉÔÀµ¤Ç¤¹" + +#: ihex.c:439 +#, fuzzy, c-format +msgid "%s:%u: bad extended start address length in Intel Hex file" +msgstr "%s:%d: ³ÈÄ¥³«»Ï¥¢¥É¥ì¥¹Ä¹¤¬ Intel Hex ¥Õ¥¡¥¤¥ë¤È¤·¤Æ¤ÏÉÔÀµ¤Ç¤¹" + +#: ihex.c:456 +#, fuzzy, c-format +msgid "%s:%u: bad extended linear address record length in Intel Hex file" +msgstr "%s:%d: ³ÈÄ¥¥ê¥Ë¥¢¥¢¥É¥ì¥¹¥ì¥³¡¼¥ÉŤ¬ Intel Hex ¥Õ¥¡¥¤¥ë¤È¤·¤ÆÉÔÀµ¤Ç¤¹" + +#: ihex.c:473 +#, fuzzy, c-format +msgid "%s:%u: bad extended linear start address length in Intel Hex file" +msgstr "%s:%d: ³ÈÄ¥¥ê¥Ë¥¢³«»Ï¥¢¥É¥ì¥¹Ä¢¤¬ Intel Hex ¥Õ¥¡¥¤¥ë¤È¤·¤Æ¤ÏÉÔÀµ¤Ç¤¹" + +#: ihex.c:490 +#, fuzzy, c-format +msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n" +msgstr "%s:%d: Intel Hex ¥Õ¥¡¥¤¥ë¤Î ihex ¥¿¥¤¥× %u ¤òǧ¼±¤Ç¤­¤Þ¤»¤ó\n" + +#: ihex.c:610 +#, c-format +msgid "%s: internal error in ihex_read_section" +msgstr "%s: ihex_read_section Æâ¤ÇÆâÉô¥¨¥é¡¼" + +#: ihex.c:645 +#, c-format +msgid "%s: bad section length in ihex_read_section" +msgstr "%s: ihex_read_section Æâ¤ÇÉÔÀµ¤Ê¥»¥¯¥·¥ç¥óŤ¬¤¢¤ê¤Þ¤¹" + +#: ihex.c:863 +#, fuzzy, c-format +msgid "%s: address 0x%s out of range for Intel Hex file" +msgstr "%s: ¥¢¥É¥ì¥¹ 0x%s ¤Ï Intel Hex ¥Õ¥¡¥¤¥ë¤ÎÈϰϤòͤ¨¤Æ¤¤¤Þ¤¹" + +#: libbfd.c:492 +#, c-format +msgid "not mapping: data=%lx mapped=%d\n" +msgstr "¥Þ¥Ã¥×¤·¤Þ¤»¤ó: ¥Ç¡¼¥¿=%lx ¥Þ¥Ã¥×ºÑ=%d\n" + +#: libbfd.c:495 +msgid "not mapping: env var not set\n" +msgstr "¥Þ¥Ã¥×¤·¤Þ¤»¤ó: ´Ä¶­ÊÑ¿ô¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó\n" + +#: libbfd.c:1467 +#, fuzzy, c-format +msgid "Deprecated %s called at %s line %d in %s\n" +msgstr "BFD ÆâÉô¥¨¥é¡¼¡£%s ¤Î %d ¹ÔÌÜ %s ¤ÇÃæÃǤ·¤Þ¤·¤¿\n" + +#: libbfd.c:1470 +#, c-format +msgid "Deprecated %s called\n" +msgstr "" + +#: linker.c:1849 +#, c-format +msgid "%s: indirect symbol `%s' to `%s' is a loop" +msgstr "" + +#: linker.c:2745 +#, c-format +msgid "Attempt to do relocateable link with %s input and %s output" +msgstr "ÆþÎÏ %s ¤È½ÐÎÏ %s ¤È¤òºÆÇÛÃÖ²Äǽ¥ê¥ó¥¯¤·¤è¤¦¤È¤·¤Þ¤·¤¿" + +#: merge.c:897 +#, c-format +msgid "%s: access beyond end of merged section (%ld + %ld)" +msgstr "" + +#: mmo.c:460 +#, fuzzy, c-format +msgid "%s: No core to allocate section name %s\n" +msgstr "%s: ÉÔÀµ¤Ê¥»¥¯¥·¥ç¥ó̾ `%s' ¤Ç¤¹" + +#: mmo.c:537 +#, c-format +msgid "%s: No core to allocate a symbol %d bytes long\n" +msgstr "" + +#: mmo.c:1190 +#, c-format +msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n" +msgstr "" + +#: mmo.c:1336 +#, c-format +msgid "" +"%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name " +"starting with `%s'\n" +msgstr "" + +#: mmo.c:1571 +#, c-format +msgid "%s: invalid mmo file: unsupported lopcode `%d'\n" +msgstr "" + +#: mmo.c:1581 +#, c-format +msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n" +msgstr "" + +#: mmo.c:1617 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n" +msgstr "" + +#: mmo.c:1663 +#, c-format +msgid "" +"%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n" +msgstr "" + +#: mmo.c:1702 +#, c-format +msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n" +msgstr "" + +#: mmo.c:1711 +#, c-format +msgid "" +"%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n" +msgstr "" + +#: mmo.c:1734 +#, c-format +msgid "" +"%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d " +"for lop_fixrx\n" +msgstr "" + +#: mmo.c:1757 +#, c-format +msgid "%s: cannot allocate file name for file number %d, %d bytes\n" +msgstr "" + +#: mmo.c:1777 +#, c-format +msgid "" +"%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n" +msgstr "" + +#: mmo.c:1790 +#, c-format +msgid "" +"%s: invalid mmo file: file name for number %d was not specified before use\n" +msgstr "" + +#: mmo.c:1896 +#, c-format +msgid "" +"%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n" +msgstr "" + +#: mmo.c:1932 +#, c-format +msgid "%s: invalid mmo file: lop_end not last item in file\n" +msgstr "" + +#: mmo.c:1945 +#, c-format +msgid "" +"%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras " +"to the preceding lop_stab (%ld)\n" +msgstr "" + +#: mmo.c:2610 +#, c-format +msgid "%s: invalid symbol table: duplicate symbol `%s'\n" +msgstr "" + +#: mmo.c:2898 +#, c-format +msgid "" +"%s: Bad symbol definition: `Main' set to %s rather than the start address %" +"s\n" +msgstr "" + +#: mmo.c:2932 +#, c-format +msgid "" +"%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: " +"%d. Only `Main' will be emitted.\n" +msgstr "" + +#: mmo.c:2977 +#, fuzzy, c-format +msgid "%s: internal error, symbol table changed size from %d to %d words\n" +msgstr "·Ù¹ð: ¥·¥ó¥Ü¥ë `%s' ¤Î·¿¤Ï %d ¤«¤é %d ¤ËÊѹ¹¤µ¤ì¤Þ¤·¤¿ (%s Æâ)" + +#: mmo.c:3032 +#, fuzzy, c-format +msgid "%s: internal error, internal register section %s had contents\n" +msgstr "%s: ihex_read_section Æâ¤ÇÆâÉô¥¨¥é¡¼" + +#: mmo.c:3084 +#, c-format +msgid "%s: no initialized registers; section length 0\n" +msgstr "" + +#: mmo.c:3090 +#, c-format +msgid "%s: too many initialized registers; section length %ld\n" +msgstr "" + +#: mmo.c:3095 +#, c-format +msgid "" +"%s: invalid start address for initialized registers of length %ld: 0x%lx%" +"08lx\n" +msgstr "" + +#: oasys.c:1036 +#, c-format +msgid "%s: can not represent section `%s' in oasys" +msgstr "%s: oasys ¤Ç¤Ï¥»¥¯¥·¥ç¥ó `%s' ¤òɽ¸½¤Ç¤­¤Þ¤»¤ó" + +#: osf-core.c:132 +#, c-format +msgid "Unhandled OSF/1 core file section type %d\n" +msgstr "OSF/1 ¥³¥¢¥Õ¥¡¥¤¥ë¥»¥¯¥·¥ç¥ó¥¿¥¤¥× %d ¤Ï¼è¤ê°·¤ï¤ì¤Þ¤»¤ó¤Ç¤·¤¿\n" + +#: pe-mips.c:658 +#, c-format +msgid "%s: `ld -r' not supported with PE MIPS objects\n" +msgstr "%s: `ld -r' ¤ò PE MIPS objects ¤È¶¦¤Ë»È¤¦»ö¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó\n" + +#. OK, at this point the following variables are set up: +#. src = VMA of the memory we're fixing up +#. mem = pointer to memory we're fixing up +#. val = VMA of what we need to refer to +#. +#: pe-mips.c:794 +#, c-format +msgid "%s: unimplemented %s\n" +msgstr "%s: ̤¼ÂÁõ¤Î %s ¤Ç¤¹\n" + +#: pe-mips.c:820 +#, c-format +msgid "%s: jump too far away\n" +msgstr "%s: ¥¸¥ã¥ó¥×À褬±ó¤¹¤®¤Þ¤¹\n" + +#: pe-mips.c:847 +#, c-format +msgid "%s: bad pair/reflo after refhi\n" +msgstr "%s: ÉÔÀµ¤Ê pair/reflo ¤¬ refhi ¤Î¸å¤í¤Ë¤¢¤ê¤Þ¤¹\n" + +#. XXX code yet to be written. +#: peicode.h:785 +#, c-format +msgid "%s: Unhandled import type; %x" +msgstr "%s: import ¥¿¥¤¥× %x ¤Ï¼è¤ê°·¤ï¤ì¤Þ¤»¤ó¤Ç¤·¤¿" + +#: peicode.h:790 +#, c-format +msgid "%s: Unrecognised import type; %x" +msgstr "%s: import ¥¿¥¤¥×¤òǧ¼±¤Ç¤­¤Þ¤»¤ó -- %x" + +#: peicode.h:804 +#, c-format +msgid "%s: Unrecognised import name type; %x" +msgstr "%s: import ̾Á°¥¿¥¤¥×¤òǧ¼±¤Ç¤­¤Þ¤»¤ó -- %x" + +#: peicode.h:1162 +#, c-format +msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive" +msgstr "%s: Import Library Format ½ñ¸ËÆâ¤Î¥Þ¥·¥ó¥¿¥¤¥× (0x%x) ¤òǧ¼±¤Ç¤­¤Þ¤»¤ó" + +#: peicode.h:1174 +#, c-format +msgid "" +"%s: Recognised but unhandled machine type (0x%x) in Import Library Format " +"archive" +msgstr "" +"%s: Import Library Format ½ñ¸ËÆâ¤Î¥Þ¥·¥ó¥¿¥¤¥× (0x%x) ¤Ïǧ¼±¤Ç¤­¤Þ¤·¤¿¤¬¼è¤ê" +"°·¤ï¤ì¤Þ¤»¤ó¤Ç¤·¤¿" + +#: peicode.h:1191 +#, c-format +msgid "%s: size field is zero in Import Library Format header" +msgstr "%s: Import Library Format ¥Ø¥Ã¥ÀÆâ¤Î¥µ¥¤¥º¥Õ¥£¡¼¥ë¥É¤¬¥¼¥í¤Ç¤¹" + +#: peicode.h:1219 +#, c-format +msgid "%s: string not null terminated in ILF object file." +msgstr "%s: ILF ¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ëÆâ¤Îʸ»úÎó¤¬ null ½ªÃ¼¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£" + +#: ppcboot.c:416 +msgid "" +"\n" +"ppcboot header:\n" +msgstr "" +"\n" +"ppcboot ¥Ø¥Ã¥À:\n" + +#: ppcboot.c:417 +#, c-format +msgid "Entry offset = 0x%.8lx (%ld)\n" +msgstr "¥¨¥ó¥È¥ê¥ª¥Õ¥»¥Ã¥È = 0x%.8lx (%ld)\n" + +#: ppcboot.c:418 +#, c-format +msgid "Length = 0x%.8lx (%ld)\n" +msgstr "Ťµ = 0x%.8lx (%ld)\n" + +#: ppcboot.c:421 +#, c-format +msgid "Flag field = 0x%.2x\n" +msgstr "¥Õ¥é¥°¥Õ¥£¡¼¥ë¥É = 0x%.2x\n" + +#: ppcboot.c:427 +#, c-format +msgid "Partition name = \"%s\"\n" +msgstr "Îΰè̾ = \"%s\"\n" + +#: ppcboot.c:446 +#, c-format +msgid "" +"\n" +"Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "" +"\n" +"Îΰè[%d] ¤Î³«»Ï = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:452 +#, c-format +msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "Îΰè[%d] ¤ÎËöÈø = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:458 +#, c-format +msgid "Partition[%d] sector = 0x%.8lx (%ld)\n" +msgstr "Îΰè[%d] ¥»¥¯¥¿ = 0x%.8lx (%ld)\n" + +#: ppcboot.c:459 +#, c-format +msgid "Partition[%d] length = 0x%.8lx (%ld)\n" +msgstr "Îΰè[%d] Ťµ = 0x%.8lx (%ld)\n" + +#: som.c:5402 +msgid "som_sizeof_headers unimplemented" +msgstr "som_sizeof_headers ¤Ï̤¼ÂÁõ¤Ç¤¹" + +#: srec.c:301 +#, c-format +msgid "%s:%d: Unexpected character `%s' in S-record file\n" +msgstr "%s:%d: `%s' ¤Ï S-record ¥Õ¥¡¥¤¥ëÆâ¤Ë¤Ï¤¢¤êÆÀ¤Ê¤¤Ê¸»ú¤Ç¤¹\n" + +#: syms.c:998 +msgid "Unsupported .stab relocation" +msgstr ".stab ºÆÇÛÃ֤ϥµ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: vms-gsd.c:356 +#, c-format +msgid "bfd_make_section (%s) failed" +msgstr "bfd_make_section (%s) ¤¬¼ºÇÔ¤·¤Þ¤·¤¿" + +#: vms-gsd.c:371 +#, c-format +msgid "bfd_set_section_flags (%s, %x) failed" +msgstr "bfd_set_section_flags (%s, %x) ¤¬¼ºÇÔ¤·¤Þ¤·¤¿" + +#: vms-gsd.c:407 +#, c-format +msgid "Size mismatch section %s=%lx, %s=%lx" +msgstr "¥»¥¯¥·¥ç¥ó %s=%lx, %s=%lx ¤Ç¥µ¥¤¥º¤¬°ìÃפ·¤Þ¤»¤ó" + +#: vms-gsd.c:704 +#, c-format +msgid "unknown gsd/egsd subtype %d" +msgstr "ÉÔÌÀ¤Ê gsd/egsd ¥µ¥Ö¥¿¥¤¥× %d ¤Ç¤¹" + +#: vms-hdr.c:406 +msgid "Object module NOT error-free !\n" +msgstr "¥ª¥Ö¥¸¥§¥¯¥È¥â¥¸¥å¡¼¥ë¤¬¥¨¥é¡¼¥Õ¥ê¡¼¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó!\n" + +#: vms-misc.c:543 +#, c-format +msgid "Stack overflow (%d) in _bfd_vms_push" +msgstr "_bfd_vms_push ¤Ç¥¹¥¿¥Ã¥¯¥ª¡¼¥Ð¡¼¥Õ¥í¡¼(%d)¤·¤Þ¤·¤¿" + +#: vms-misc.c:561 +msgid "Stack underflow in _bfd_vms_pop" +msgstr "_bfd_vms_pop ¤Ç¥¹¥¿¥Ã¥¯¥¢¥ó¥À¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿" + +#: vms-misc.c:919 +msgid "_bfd_vms_output_counted called with zero bytes" +msgstr "_bfd_vms_output_counted ¤¬¥¼¥í¥Ð¥¤¥È¤Ç¸Æ¤Ó½Ð¤µ¤ì¤Þ¤·¤¿" + +#: vms-misc.c:924 +msgid "_bfd_vms_output_counted called with too many bytes" +msgstr "_bfd_vms_output_counted ¸Æ¤Ó½Ð¤·»þ¤Î¥Ð¥¤¥È¿ô¤¬Â礭¤¹¤®¤Þ¤¹" + +#: vms-misc.c:1055 +#, c-format +msgid "Symbol %s replaced by %s\n" +msgstr "¥·¥ó¥Ü¥ë %s ¤Ï %s ¤ÇÃÖ¤­´¹¤¨¤é¤ì¤Þ¤·¤¿\n" + +#: vms-misc.c:1117 +#, c-format +msgid "failed to enter %s" +msgstr "%s ¤ØÆþ¤ì¤Þ¤»¤ó¤Ç¤·¤¿" + +#: vms-tir.c:81 +msgid "No Mem !" +msgstr "¥á¥â¥ê¤¬¤¢¤ê¤Þ¤»¤ó!" + +#: vms-tir.c:362 +#, fuzzy, c-format +msgid "bad section index in %s" +msgstr "ETIR_S_C_STA_PQ ¤Ë¤¢¤ë¥»¥¯¥·¥ç¥ó¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬ÉÔÀµ¤Ç¤¹" + +#: vms-tir.c:375 +#, fuzzy, c-format +msgid "unsupported STA cmd %s" +msgstr "STA cmd %d ¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#: vms-tir.c:380 vms-tir.c:1240 +#, fuzzy, c-format +msgid "reserved STA cmd %d" +msgstr "STA cmd %d ¤ÏͽÌóºÑ¤Ç¤¹" + +#: vms-tir.c:491 vms-tir.c:514 +#, fuzzy, c-format +msgid "%s: no symbol \"%s\"" +msgstr "%s: ¤½¤Î¤è¤¦¤Ê¥·¥ó¥Ü¥ë¤Ï¤¢¤ê¤Þ¤»¤ó" + +#. unsigned shift +#. rotate +#. Redefine symbol to current location. +#. Define a literal. +#: vms-tir.c:581 vms-tir.c:693 vms-tir.c:803 vms-tir.c:821 vms-tir.c:829 +#: vms-tir.c:838 vms-tir.c:1563 +#, fuzzy, c-format +msgid "%s: not supported" +msgstr "¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó" + +#: vms-tir.c:586 vms-tir.c:1418 +#, fuzzy, c-format +msgid "%s: not implemented" +msgstr "%s: ̤¼ÂÁõ¤Î %s ¤Ç¤¹\n" + +#: vms-tir.c:590 vms-tir.c:1422 +#, fuzzy, c-format +msgid "reserved STO cmd %d" +msgstr "STO cmd %d ¤ÏͽÌóºÑ¤Ç¤¹" + +#: vms-tir.c:708 vms-tir.c:1568 +#, fuzzy, c-format +msgid "reserved OPR cmd %d" +msgstr "OPR cmd %d ¤ÏͽÌóºÑ¤Ç¤¹" + +#: vms-tir.c:776 vms-tir.c:1632 +#, fuzzy, c-format +msgid "reserved CTL cmd %d" +msgstr "CTL cmd %d ¤ÏͽÌóºÑ¤Ç¤¹" + +#. stack byte from image +#. arg: none. +#: vms-tir.c:1148 +#, fuzzy +msgid "stack-from-image not implemented" +msgstr "Stack-from-image ¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: vms-tir.c:1166 +#, fuzzy +msgid "stack-entry-mask not fully implemented" +msgstr "Stack-entry-mask ¤Ï´°Á´¤Ë¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#. compare procedure argument +#. arg: cs symbol name +#. by argument index +#. da argument descriptor +#. +#. compare argument descriptor with symbol argument (ARG$V_PASSMECH) +#. and stack TRUE (args match) or FALSE (args dont match) value. +#: vms-tir.c:1180 +msgid "PASSMECH not fully implemented" +msgstr "PASSMECH ¤Ï´°Á´¤Ë¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: vms-tir.c:1199 +#, fuzzy +msgid "stack-local-symbol not fully implemented" +msgstr "Stack-local-symbol ¤Ï´°Á´¤Ë¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: vms-tir.c:1212 +#, fuzzy +msgid "stack-literal not fully implemented" +msgstr "Stack-literal ¤Ï´°Á´¤Ë¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: vms-tir.c:1233 +#, fuzzy +msgid "stack-local-symbol-entry-point-mask not fully implemented" +msgstr "Stack-local-symbol-entry-point-mask ¤Ï´°Á´¤Ë¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: vms-tir.c:1510 vms-tir.c:1522 vms-tir.c:1534 vms-tir.c:1546 vms-tir.c:1611 +#: vms-tir.c:1619 vms-tir.c:1627 +#, fuzzy, c-format +msgid "%s: not fully implemented" +msgstr "PASSMECH ¤Ï´°Á´¤Ë¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: vms-tir.c:1684 +#, fuzzy, c-format +msgid "obj code %d not found" +msgstr "¥ª¥Ö¥¸¥§¥¯¥È¥³¡¼¥É %d ¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó" + +#: vms-tir.c:2019 +#, c-format +msgid "SEC_RELOC with no relocs in section %s" +msgstr "SEC_RELOC ¤¬¥»¥¯¥·¥ç¥ó %s ¤Ë¤¢¤ê¤Þ¤¹¤¬ºÆÇÛÃÖ¤¬¤¢¤ê¤Þ¤»¤ó" + +#: vms-tir.c:2307 +#, c-format +msgid "Unhandled relocation %s" +msgstr "ºÆÇÛÃÖ %s ¤¬¼è¤ê°·¤ï¤ì¤Þ¤»¤ó¤Ç¤·¤¿" + +#: xcofflink.c:1241 +#, c-format +msgid "%s: `%s' has line numbers but no enclosing section" +msgstr "%s: `%s' ¤Ï¹ÔÈÖ¹æ¤ò»ý¤Á¤Þ¤¹¤¬¡¢¥»¥¯¥·¥ç¥ó¤ò°Ï¤¤¹þ¤ó¤Ç¤¤¤Þ¤»¤ó" + +#: xcofflink.c:1294 +#, c-format +msgid "%s: class %d symbol `%s' has no aux entries" +msgstr "%s: ¥¯¥é¥¹ %d ¥·¥ó¥Ü¥ë `%s' ¤ËÊä½õ¥¨¥ó¥È¥ê¤¬¤¢¤ê¤Þ¤»¤ó" + +#: xcofflink.c:1317 +#, c-format +msgid "%s: symbol `%s' has unrecognized csect type %d" +msgstr "%s: ¥·¥ó¥Ü¥ë `%s' ¤¬Ç§¼±¤Ç¤­¤Ê¤¤ csect ¥¿¥¤¥× %d ¤ò»ý¤Ã¤Æ¤¤¤Þ¤¹" + +#: xcofflink.c:1329 +#, c-format +msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d" +msgstr "%s: ÉÔÀµ XTY_ER ¥·¥ó¥Ü¥ë `%s': ¥¯¥é¥¹ %d scnum %d scnlen %d" + +#: xcofflink.c:1365 +#, c-format +msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d" +msgstr "%s: XMC_TC0 ¥·¥ó¥Ü¥ë `%s' ¤Ï class %d scnlen %d ¤Ç¤¹" + +#: xcofflink.c:1517 +#, c-format +msgid "%s: csect `%s' not in enclosing section" +msgstr "%s: csect `%s' ¤¬¥»¥¯¥·¥ç¥ó¤Î°Ï¤ß¤ÎÃæ¤Ë¤¢¤ê¤Þ¤»¤ó" + +#: xcofflink.c:1624 +#, c-format +msgid "%s: misplaced XTY_LD `%s'" +msgstr "%s: XTY_LD `%s' ¤òÃÖ¤­°ã¤¨¤Æ¤¤¤Þ¤¹" + +#: xcofflink.c:1948 +#, c-format +msgid "%s: reloc %s:%d not in csect" +msgstr "%s: ºÆÇÛÃÖ %s:%d ¤¬ csect Æâ¤Ë¤¢¤ê¤Þ¤»¤ó" + +#: xcofflink.c:2083 +#, c-format +msgid "%s: XCOFF shared object when not producing XCOFF output" +msgstr "%s: XCOFF ¤¬ XCOFF ½ÐÎÏÀ¸À®»þ°Ê³°¤Ë¥ª¥Ö¥¸¥§¥¯¥È¤ò¶¦Í­¤·¤Þ¤·¤¿" + +#: xcofflink.c:2104 +#, c-format +msgid "%s: dynamic object with no .loader section" +msgstr "%s: ưŪ¥ª¥Ö¥¸¥§¥¯¥È¤Ë .loader ¥»¥¯¥·¥ç¥ó¤¬¤¢¤ê¤Þ¤»¤ó" + +#: xcofflink.c:2749 +#, c-format +msgid "%s: no such symbol" +msgstr "%s: ¤½¤Î¤è¤¦¤Ê¥·¥ó¥Ü¥ë¤Ï¤¢¤ê¤Þ¤»¤ó" + +#: xcofflink.c:2890 +msgid "error: undefined symbol __rtinit" +msgstr "" + +#: xcofflink.c:3458 +#, c-format +msgid "warning: attempt to export undefined symbol `%s'" +msgstr "·Ù¹ð: ̤ÄêµÁ¥·¥ó¥Ü¥ë `%s' ¤ò export ¤·¤è¤¦¤È¤·¤Æ¤¤¤Þ¤¹" + +#: xcofflink.c:4452 +#, c-format +msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling" +msgstr "" +"TOC ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼: 0x%lx > 0x10000 -- ¥³¥ó¥Ñ¥¤¥ë»þ¤Ë -mminimal-toc ¤ò»î¤·¤Þ" +"¤·¤ç¤¦" + +#: xcofflink.c:5292 xcofflink.c:5754 xcofflink.c:5816 xcofflink.c:6117 +#, c-format +msgid "%s: loader reloc in unrecognized section `%s'" +msgstr "%s: ¥í¡¼¥ÀºÆÇÛÃÖ¤¬Ç§¼±¤Ç¤­¤Ê¤¤¥»¥¯¥·¥ç¥ó `%s' ¤Ë¤¢¤ê¤Þ¤¹" + +#: xcofflink.c:5314 xcofflink.c:6128 +#, c-format +msgid "%s: `%s' in loader reloc but not loader sym" +msgstr "%s: `%s' ¤¬¥í¡¼¥ÀºÆÇÛÃ֤ˤ¢¤ê¤Þ¤¹¤¬¥í¡¼¥À¥·¥ó¥Ü¥ë¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó" + +#: xcofflink.c:5329 +#, c-format +msgid "%s: loader reloc in read-only section %s" +msgstr "%s: ¥í¡¼¥ÀºÆÇÛÃÖ¤¬ÆÉ¹þ¤ßÀìÍÑ¥»¥¯¥·¥ç¥ó %s ¤Ë¤¢¤ê¤Þ¤¹" + +#: elf32-ia64.c:2189 elf64-ia64.c:2189 +#, fuzzy +msgid "@pltoff reloc against local symbol" +msgstr "%s: 0x%lx ¤Ç¤Î CALL16 ºÆÇÛÃÖ¤¬Âç°è¥·¥ó¥Ü¥ë¤òÂоݤȤ·¤Æ¤¤¤Þ¤»¤ó" + +#: elf32-ia64.c:3413 elf64-ia64.c:3413 +#, c-format +msgid "%s: short data segment overflowed (0x%lx >= 0x400000)" +msgstr "" + +#: elf32-ia64.c:3424 elf64-ia64.c:3424 +#, c-format +msgid "%s: __gp does not cover short data segment" +msgstr "" + +#: elf32-ia64.c:3728 elf64-ia64.c:3728 +#, c-format +msgid "%s: linking non-pic code in a shared library" +msgstr "" + +#: elf32-ia64.c:3761 elf64-ia64.c:3761 +#, fuzzy, c-format +msgid "%s: @gprel relocation against dynamic symbol %s" +msgstr "%s: ºÆÇÛÃÖ¥¿¥¤¥× %d (¥·¥ó¥Ü¥ë %s) ¤¬ÉÔÌÀ¤Ç¤¹" + +#: elf32-ia64.c:3900 elf64-ia64.c:3900 +#, fuzzy, c-format +msgid "%s: dynamic relocation against speculation fixup" +msgstr "%s: ưŪ¥ª¥Ö¥¸¥§¥¯¥È¤Ë .loader ¥»¥¯¥·¥ç¥ó¤¬¤¢¤ê¤Þ¤»¤ó" + +#: elf32-ia64.c:3908 elf64-ia64.c:3908 +#, c-format +msgid "%s: speculation fixup against undefined weak symbol" +msgstr "" + +#: elf32-ia64.c:4092 elf64-ia64.c:4092 +#, fuzzy +msgid "unsupported reloc" +msgstr "¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ºÆÇÛÃÖ¥¿¥¤¥×¤Ç¤¹" + +#: elf32-ia64.c:4372 elf64-ia64.c:4372 +#, fuzzy, c-format +msgid "%s: linking trap-on-NULL-dereference with non-trapping files" +msgstr "%s: abicall ¥Õ¥¡¥¤¥ë¤ËÈó abicall ¥Õ¥¡¥¤¥ë¤ò¥ê¥ó¥¯¤·¤è¤¦¤È¤·¤Þ¤·¤¿" + +#: elf32-ia64.c:4381 elf64-ia64.c:4381 +#, fuzzy, c-format +msgid "%s: linking big-endian files with little-endian files" +msgstr "" +"%s: ¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤Î¥Õ¥¡¥¤¥ë¤È¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Î¥Õ¥¡¥¤¥ë¤È¤ò¥ê¥ó¥¯¤·¤è" +"¤¦¤È¤·¤Æ¤¤¤Þ¤¹" + +#: elf32-ia64.c:4390 elf64-ia64.c:4390 +#, fuzzy, c-format +msgid "%s: linking 64-bit files with 32-bit files" +msgstr "%s: abicall ¥Õ¥¡¥¤¥ë¤ËÈó abicall ¥Õ¥¡¥¤¥ë¤ò¥ê¥ó¥¯¤·¤è¤¦¤È¤·¤Þ¤·¤¿" + +#: elf32-ia64.c:4399 elf64-ia64.c:4399 +#, fuzzy, c-format +msgid "%s: linking constant-gp files with non-constant-gp files" +msgstr "%s: abicall ¥Õ¥¡¥¤¥ë¤ËÈó abicall ¥Õ¥¡¥¤¥ë¤ò¥ê¥ó¥¯¤·¤è¤¦¤È¤·¤Þ¤·¤¿" + +#: elf32-ia64.c:4409 elf64-ia64.c:4409 +#, fuzzy, c-format +msgid "%s: linking auto-pic files with non-auto-pic files" +msgstr "%s: abicall ¥Õ¥¡¥¤¥ë¤ËÈó abicall ¥Õ¥¡¥¤¥ë¤ò¥ê¥ó¥¯¤·¤è¤¦¤È¤·¤Þ¤·¤¿" + +#: peigen.c:962 pepigen.c:962 +#, c-format +msgid "%s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: ¹ÔÈֹ椬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿: 0x%lx > 0xffff" + +#: peigen.c:979 pepigen.c:979 +#, c-format +msgid "%s: reloc overflow 1: 0x%lx > 0xffff" +msgstr "%s: ºÆÇÛÃÖÎΰ褬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿ 1: 0x%lx > 0xffff" + +#: peigen.c:993 pepigen.c:993 +msgid "Export Directory [.edata (or where ever we found it)]" +msgstr "Export ¥Ç¥£¥ì¥¯¥È¥ê [.edata (°¿¤¤¤Ï¤³¤³¤Þ¤Ç¤Ë¸«¤Ä¤±¤¿¾ì½ê)]" + +#: peigen.c:994 pepigen.c:994 +msgid "Import Directory [parts of .idata]" +msgstr "Import ¥Ç¥£¥ì¥¯¥È¥ê [.idata ¤ÎÉôʬ]" + +#: peigen.c:995 pepigen.c:995 +msgid "Resource Directory [.rsrc]" +msgstr "¥ê¥½¡¼¥¹¥Ç¥£¥ì¥¯¥È¥ê [.rsrc]" + +#: peigen.c:996 pepigen.c:996 +msgid "Exception Directory [.pdata]" +msgstr "Îã³°¥Ç¥£¥ì¥¯¥È¥ê [.pdata]" + +#: peigen.c:997 pepigen.c:997 +msgid "Security Directory" +msgstr "¥»¥­¥å¥ê¥Æ¥£¥Ç¥£¥ì¥¯¥È¥ê" + +#: peigen.c:998 pepigen.c:998 +msgid "Base Relocation Directory [.reloc]" +msgstr "´ðËܺÆÇÛÃ֥ǥ£¥ì¥¯¥È¥ê [.reloc]" + +#: peigen.c:999 pepigen.c:999 +msgid "Debug Directory" +msgstr "¥Ç¥Ð¥Ã¥°¥Ç¥£¥ì¥¯¥È¥ê" + +#: peigen.c:1000 pepigen.c:1000 +msgid "Description Directory" +msgstr "µ­½Ò»Ò¥Ç¥£¥ì¥¯¥È¥ê" + +#: peigen.c:1001 pepigen.c:1001 +msgid "Special Directory" +msgstr "¥¹¥Ú¥·¥ã¥ë¥Ç¥£¥ì¥¯¥È¥ê" + +#: peigen.c:1002 pepigen.c:1002 +msgid "Thread Storage Directory [.tls]" +msgstr "¥¹¥ì¥Ã¥Éµ­²±¥Ç¥£¥ì¥¯¥È¥ê [.tls]" + +#: peigen.c:1003 pepigen.c:1003 +msgid "Load Configuration Directory" +msgstr "¥í¡¼¥ÉÀßÄê¥Ç¥£¥ì¥¯¥È¥ê" + +#: peigen.c:1004 pepigen.c:1004 +msgid "Bound Import Directory" +msgstr "¶­³¦ Import ¥Ç¥£¥ì¥¯¥È¥ê" + +#: peigen.c:1005 pepigen.c:1005 +msgid "Import Address Table Directory" +msgstr "Import ¥¢¥É¥ì¥¹¥Æ¡¼¥Ö¥ë¥Ç¥£¥ì¥¯¥È¥ê" + +#: peigen.c:1006 pepigen.c:1006 +msgid "Delay Import Directory" +msgstr "ÃÙ±ä Import ¥Ç¥£¥ì¥¯¥È¥ê" + +#: peigen.c:1007 peigen.c:1008 pepigen.c:1007 pepigen.c:1008 +msgid "Reserved" +msgstr "ͽÌóºÑ" + +#: peigen.c:1071 pepigen.c:1071 +msgid "" +"\n" +"There is an import table, but the section containing it could not be found\n" +msgstr "" +"\n" +"import ¥Æ¡¼¥Ö¥ë¤¬¤¢¤ê¤Þ¤¹¤¬¡¢¤³¤³¤ò´Þ¤ó¤Ç¤¤¤ë¥»¥¯¥·¥ç¥ó¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó¤Ç¤·" +"¤¿\n" + +#: peigen.c:1076 pepigen.c:1076 +#, c-format +msgid "" +"\n" +"There is an import table in %s at 0x%lx\n" +msgstr "" +"\n" +"%s Æâ¤Î 0x%lx ¤Ë¤¢¤ë import ¥Æ¡¼¥Ö¥ë¤Ç¤¹\n" + +#: peigen.c:1113 pepigen.c:1113 +#, c-format +msgid "" +"\n" +"Function descriptor located at the start address: %04lx\n" +msgstr "" +"\n" +"´Ø¿ôµ­½Ò»Ò¤Ï³«»Ï¥¢¥É¥ì¥¹¤Ë°ÌÃÖ¤·¤Æ¤¤¤Þ¤¹: %04lx\n" + +#: peigen.c:1116 pepigen.c:1116 +#, c-format +msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n" +msgstr "\t¥³¡¼¥É¥Ù¡¼¥¹ %08lx toc (loadable/actual) %08lx/%08lx\n" + +#: peigen.c:1122 pepigen.c:1122 +msgid "" +"\n" +"No reldata section! Function descriptor not decoded.\n" +msgstr "" +"\n" +"reldata ¥»¥¯¥·¥ç¥ó¤¬¤¢¤ê¤Þ¤»¤ó! ´Ø¿ôµ­½Ò»Ò¤¬¥Ç¥³¡¼¥É¤µ¤ì¤Þ¤»¤ó¤Ç¤·¤¿¡£\n" + +#: peigen.c:1127 pepigen.c:1127 +#, c-format +msgid "" +"\n" +"The Import Tables (interpreted %s section contents)\n" +msgstr "" +"\n" +"Import ¥Æ¡¼¥Ö¥ë (%s ¥»¥¯¥·¥ç¥ó¤ÎÆâÍÆ¤ò²ò¼á)\n" + +#: peigen.c:1130 pepigen.c:1130 +#, fuzzy +msgid "" +" vma: Hint Time Forward DLL First\n" +" Table Stamp Chain Name Thunk\n" +msgstr " Table Stamp Chain Name Thunk\n" + +#: peigen.c:1180 pepigen.c:1180 +#, c-format +msgid "" +"\n" +"\tDLL Name: %s\n" +msgstr "" +"\n" +"\tDLL ̾: %s\n" + +#: peigen.c:1184 peigen.c:1247 pepigen.c:1184 pepigen.c:1247 +msgid "\tvma: Hint/Ord Member-Name\n" +msgstr "\tvma: Hint/Ord ¥á¥ó¥Ð̾\n" + +#: peigen.c:1246 pepigen.c:1246 +msgid "\tThe Import Address Table (difference found)\n" +msgstr "\tImport ¥¢¥É¥ì¥¹¥Æ¡¼¥Ö¥ë (º¹°Û¤òȯ¸«)\n" + +#: peigen.c:1253 pepigen.c:1253 +msgid "\t>>> Ran out of IAT members!\n" +msgstr "\t>>> IAT ¥á¥ó¥Ð¤òÄɤ¤½Ð¤·¤Þ¤·¤¿!\n" + +#: peigen.c:1271 pepigen.c:1271 +msgid "\tThe Import Address Table is identical\n" +msgstr "\tImport Address Table ¤¬Á´¤¯Æ±¤¸¤Ç¤¹\n" + +#: peigen.c:1343 pepigen.c:1343 +msgid "" +"\n" +"There is an export table, but the section containing it could not be found\n" +msgstr "" +"\n" +"export ¥Æ¡¼¥Ö¥ë¤¬¤¢¤ê¤Þ¤¹¤¬¡¢¤³¤ì¤ò´Þ¤ó¤Ç¤¤¤ë¥»¥¯¥·¥ç¥ó¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó¤Ç¤·" +"¤¿\n" + +#: peigen.c:1348 pepigen.c:1348 +#, c-format +msgid "" +"\n" +"There is an export table in %s at 0x%lx\n" +msgstr "" +"\n" +"%s ¤Î 0x%lx ¤Ë export ¥Æ¡¼¥Ö¥ë¤¬¤¢¤ê¤Þ¤¹\n" + +#: peigen.c:1379 pepigen.c:1379 +#, c-format +msgid "" +"\n" +"The Export Tables (interpreted %s section contents)\n" +"\n" +msgstr "" +"\n" +"Export ¥Æ¡¼¥Ö¥ë (%s ¥»¥¯¥·¥ç¥ó¤ÎÆâÍÆ¤ò²ò¼á)\n" +"\n" + +#: peigen.c:1383 pepigen.c:1383 +#, c-format +msgid "Export Flags \t\t\t%lx\n" +msgstr "Export ¥Õ¥é¥° \t\t\t%lx\n" + +#: peigen.c:1386 pepigen.c:1386 +#, c-format +msgid "Time/Date stamp \t\t%lx\n" +msgstr "»þ¹ï/ÆüÉÕ¥¹¥¿¥ó¥× \t\t%lx\n" + +#: peigen.c:1389 pepigen.c:1389 +#, c-format +msgid "Major/Minor \t\t\t%d/%d\n" +msgstr "Major/Minor \t\t\t%d/%d\n" + +#: peigen.c:1392 pepigen.c:1392 +msgid "Name \t\t\t\t" +msgstr "̾Á° \t\t\t\t" + +#: peigen.c:1398 pepigen.c:1398 +#, c-format +msgid "Ordinal Base \t\t\t%ld\n" +msgstr "½ø¿ô¥Ù¡¼¥¹ \t\t\t%ld\n" + +#: peigen.c:1401 pepigen.c:1401 +msgid "Number in:\n" +msgstr "³Æ¼ï¤Î¿ôÃÍ:\n" + +#: peigen.c:1404 pepigen.c:1404 +#, c-format +msgid "\tExport Address Table \t\t%08lx\n" +msgstr "\tExport ¥¢¥É¥ì¥¹¥Æ¡¼¥Ö¥ë\t\t%08lx\n" + +#: peigen.c:1408 pepigen.c:1408 +#, c-format +msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n" +msgstr "\t[̾Á°¥Ý¥¤¥ó¥¿/½ø¿ô] ¥Æ¡¼¥Ö¥ë\t%08lx\n" + +#: peigen.c:1411 pepigen.c:1411 +msgid "Table Addresses\n" +msgstr "¥Æ¡¼¥Ö¥ë¥¢¥É¥ì¥¹\n" + +#: peigen.c:1414 pepigen.c:1414 +msgid "\tExport Address Table \t\t" +msgstr "\tExport ¥¢¥É¥ì¥¹¥Æ¡¼¥Ö¥ë\t\t" + +#: peigen.c:1419 pepigen.c:1419 +msgid "\tName Pointer Table \t\t" +msgstr "\t̾Á°¥Ý¥¤¥ó¥¿¥Æ¡¼¥Ö¥ë \t\t" + +#: peigen.c:1424 pepigen.c:1424 +msgid "\tOrdinal Table \t\t\t" +msgstr "\t½ø¿ô¥Æ¡¼¥Ö¥ë \t\t\t" + +#: peigen.c:1439 pepigen.c:1439 +#, c-format +msgid "" +"\n" +"Export Address Table -- Ordinal Base %ld\n" +msgstr "" +"\n" +"Export ¥¢¥É¥ì¥¹¥Æ¡¼¥Ö¥ë -- ½ø¿ô¥Ù¡¼¥¹ %ld\n" + +#: peigen.c:1458 pepigen.c:1458 +msgid "Forwarder RVA" +msgstr "Forwarder RVA" + +#: peigen.c:1469 pepigen.c:1469 +msgid "Export RVA" +msgstr "Export RVA" + +#: peigen.c:1476 pepigen.c:1476 +msgid "" +"\n" +"[Ordinal/Name Pointer] Table\n" +msgstr "" +"\n" +"[½ø¿ô/̾Á°¥Ý¥¤¥ó¥¿] ¥Æ¡¼¥Ö¥ë\n" + +#: peigen.c:1531 pepigen.c:1531 +#, c-format +msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n" +msgstr "·Ù¹ð¡¢.pdata ¥»¥¯¥·¥ç¥ó¥µ¥¤¥º (%ld) ¤¬ %d ¤ÎÇÜ¿ô¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó\n" + +#: peigen.c:1535 pepigen.c:1535 +msgid "" +"\n" +"The Function Table (interpreted .pdata section contents)\n" +msgstr "" +"\n" +"´Ø¿ô¥Æ¡¼¥Ö¥ë (.pdata ¥»¥¯¥·¥ç¥ó¤ÎÆâÍÆ¤ò²ò¼á)\n" + +#: peigen.c:1538 pepigen.c:1538 +msgid " vma:\t\t\tBegin Address End Address Unwind Info\n" +msgstr " vma:\t\t\t³«»Ï¥¢¥É¥ì¥¹ ½ªÎ»¥¢¥É¥ì¥¹ Unwind ¾ðÊó\n" + +#: peigen.c:1540 pepigen.c:1540 +#, fuzzy +msgid "" +" vma:\t\tBegin End EH EH PrologEnd Exception\n" +" \t\tAddress Address Handler Data Address Mask\n" +msgstr " vma:\t\t³«»Ï ½ªÎ» EH EH PrologEnd Îã³°\n" + +#: peigen.c:1610 pepigen.c:1610 +msgid " Register save millicode" +msgstr " ¥ì¥¸¥¹¥¿Êݸ¥ß¥ê¥³¡¼¥É" + +#: peigen.c:1613 pepigen.c:1613 +msgid " Register restore millicode" +msgstr " ¥ì¥¸¥¹¥¿Éü¸µ¥ß¥ê¥³¡¼¥É" + +#: peigen.c:1616 pepigen.c:1616 +msgid " Glue code sequence" +msgstr " ¥°¥ë¡¼¥³¡¼¥ÉÎó" + +#: peigen.c:1668 pepigen.c:1668 +msgid "" +"\n" +"\n" +"PE File Base Relocations (interpreted .reloc section contents)\n" +msgstr "" +"\n" +"\n" +"PE ¥Õ¥¡¥¤¥ë¥Ù¡¼¥¹ºÆÇÛÃÖ (.reloc ¥»¥¯¥·¥ç¥ó¤ÎÆâÍÆ¤ò²ò¼á)\n" + +#: peigen.c:1698 pepigen.c:1698 +#, c-format +msgid "" +"\n" +"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n" +msgstr "" +"\n" +"²¾ÁÛ¥¢¥É¥ì¥¹: %08lx ¥Á¥ã¥ó¥¯¥µ¥¤¥º %ld (0x%lx) fixups ¤Î¸Ä¿ô %ld\n" + +#: peigen.c:1711 pepigen.c:1711 +#, c-format +msgid "\treloc %4d offset %4x [%4lx] %s" +msgstr "\treloc %4d ¥ª¥Õ¥»¥Ã¥È %4x [%4lx] %s" + +#. The MS dumpbin program reportedly ands with 0xff0f before +#. printing the characteristics field. Not sure why. No reason to +#. emulate it here. +#: peigen.c:1751 pepigen.c:1751 +#, c-format +msgid "" +"\n" +"Characteristics 0x%x\n" +msgstr "" +"\n" +"¸ÇÍ­ 0x%x\n" + +#~ msgid "GP relative relocation when GP not defined" +#~ msgstr "GP ¤¬Ì¤ÄêµÁ¤Î»þ¤Î GP ´ØÏ¢ºÆÇÛÃ֤Ǥ¹" + +#~ msgid "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld" +#~ msgstr "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld" + +#~ msgid "" +#~ "Warning: Not setting interwork flag of %s since it has already been " +#~ "specified as non-interworking" +#~ msgstr "" +#~ "·Ù¹ð: Èó interworking ¤È´û¤Ë»ØÄꤵ¤ì¤Æ¤¤¤ë¤¿¤á¡¢%s ¤Î interwork ¥Õ¥é¥°¤ò" +#~ "¥»¥Ã¥È¤·¤Þ¤»¤ó" + +#~ msgid "Warning: Clearing the interwork flag of %s due to outside request" +#~ msgstr "·Ù¹ð: Í׵ᳰ¤Î¤¿¤á %s ¤Î interwork ¥Õ¥é¥°¤ò¥¯¥ê¥¢¤·¤Þ¤¹" + +#~ msgid "float" +#~ msgstr "ÉâÆ°¾®¿ô" + +#~ msgid "integer" +#~ msgstr "À°¿ô" + +#~ msgid "soft" +#~ msgstr "¥½¥Õ¥È" + +#~ msgid "hard" +#~ msgstr "¥Ï¡¼¥É" + +#~ msgid "Warning: %s %s interworking, whereas %s %s" +#~ msgstr "·Ù¹ð: %s ¤Ï interworking ¤ò%s¤Ë¤â¤«¤«¤ï¤é¤º¡¢%s ¤¬%s" + +#~ msgid "supports" +#~ msgstr "¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë" + +#~ msgid "does not" +#~ msgstr "¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó" + +#~ msgid "does" +#~ msgstr "¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹" + +#~ msgid "%s(%s+0x%lx): cannot find stub entry %s" +#~ msgstr "%s(%s+0x%lx): ¥¹¥¿¥Ö¥¨¥ó¥È¥ê %s ¤ò¸«¤Ä¤±¤é¤ì¤Þ¤»¤ó" + +#~ msgid "%s(%s+0x%lx): cannot relocate %s, recompile with -ffunction-sections" +#~ msgstr "" +#~ "%s(%s+0x%lx): %s ¤òºÆÇÛÃ֤Ǥ­¤Þ¤»¤ó¡£-ffunction-sections ¤òÉÕ¤±¤ÆºÆ¥³¥ó¥Ñ" +#~ "¥¤¥ë¤·¤Þ¤·¤ç¤¦" + +#~ msgid "" +#~ "creating section symbol, name = %s, value = 0x%.8lx, index = %d, section " +#~ "= 0x%.8lx\n" +#~ msgstr "" +#~ "¥»¥¯¥·¥ç¥ó¥·¥ó¥Ü¥ë¤òºîÀ®¤·¤Þ¤¹, ̾Á° = %s, ÃÍ = 0x%.8lx, º÷°ú = %d, ¥»¥¯" +#~ "¥·¥ç¥ó = 0x%.8lx\n" + +#~ msgid " whereas segment starts at 0x%x" +#~ msgstr " ¤Ë¤â¤«¤«¤ï¤é¤º¡¢¥»¥°¥á¥ó¥È¤¬ 0x%x ¤Ç»Ï¤Þ¤Ã¤Æ¤¤¤Þ¤¹" + +#~ msgid "" +#~ "elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = 0x" +#~ "%.8lx%s\n" +#~ msgstr "" +#~ "elf_symbol_from_bfd_symbol 0x%.8lx, ̾Á° = %s, ¥·¥ó¥Ü¥ëÈÖ¹æ = %d, ¥Õ¥é¥° " +#~ "= 0x%.8lx%s\n" + +#~ msgid " vma: Hint Time Forward DLL First\n" +#~ msgstr " vma: Hint Time Forward DLL First\n" + +#~ msgid " \t\tAddress Address Handler Data Address Mask\n" +#~ msgstr " \t\t¥¢¥É¥ì¥¹ ¥¢¥É¥ì¥¹ ¥Ï¥ó¥É¥é ¥Ç¡¼¥¿ ¥¢¥É¥ì¥¹ ¥Þ¥¹¥¯\n" + +#~ msgid "ETIR_S_C_STO_GBL: no symbol \"%s\"" +#~ msgstr "ETIR_S_C_STO_GBL: ¥·¥ó¥Ü¥ë \"%s\" ¤¬¤¢¤ê¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_STO_CA: no symbol \"%s\"" +#~ msgstr "ETIR_S_C_STO_CA: ¥·¥ó¥Ü¥ë \"%s\" ¤¬¤¢¤ê¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_STO_RB/AB: Not supported" +#~ msgstr "ETIR_S_C_STO_RB/AB: ¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_STO_LP_PSB: Not supported" +#~ msgstr "ETIR_S_C_STO_LP_PSB: ¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_STO_HINT_GBL: not implemented" +#~ msgstr "ETIR_S_C_STO_HINT_GBL: ¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_STO_HINT_PS: not implemented" +#~ msgstr "ETIR_S_C_STO_HINT_PS: ¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_OPR_INSV: Not supported" +#~ msgstr "ETIR_S_C_OPR_INSV: ¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_OPR_USH: Not supported" +#~ msgstr "ETIR_S_C_OPR_USH: ¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_OPR_ROT: Not supported" +#~ msgstr "ETIR_S_C_OPR_ROT: ¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_OPR_REDEF: Not supported" +#~ msgstr "ETIR_S_C_OPR_REDEF: ¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_OPR_DFLIT: Not supported" +#~ msgstr "ETIR_S_C_OPR_DFLIT: ¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_STC_LP: not supported" +#~ msgstr "ETIR_S_C_STC_LP: ¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_STC_GBL: not supported" +#~ msgstr "ETIR_S_C_STC_GBL: ¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_STC_GCA: not supported" +#~ msgstr "ETIR_S_C_STC_GCA: ¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "ETIR_S_C_STC_PS: not supported" +#~ msgstr "ETIR_S_C_STC_PS: ¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "Unimplemented STO cmd %d" +#~ msgstr "STO cmd %d ¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#~ msgid "TIR_S_C_OPR_ASH incomplete" +#~ msgstr "TIR_S_C_OPR_ASH ¤ÏÉÔ´°Á´¤Ç¤¹" + +#~ msgid "TIR_S_C_OPR_USH incomplete" +#~ msgstr "TIR_S_C_OPR_USH ¤ÏÉÔ´°Á´¤Ç¤¹" + +#~ msgid "TIR_S_C_OPR_ROT incomplete" +#~ msgstr "TIR_S_C_OPR_ROT ¤ÏÉÔ´°Á´¤Ç¤¹" + +#~ msgid "TIR_S_C_OPR_REDEF not supported" +#~ msgstr "TIR_S_C_OPR_REDEF ¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "TIR_S_C_OPR_DFLIT not supported" +#~ msgstr "TIR_S_C_OPR_DFLIT ¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#~ msgid "TIR_S_C_CTL_DFLOC not fully implemented" +#~ msgstr "TIR_S_C_CTL_DFLOC ¤Ï´°Á´¤Ë¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#~ msgid "TIR_S_C_CTL_STLOC not fully implemented" +#~ msgstr "TIR_S_C_CTL_STLOC ¤Ï´°Á´¤Ë¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#~ msgid "TIR_S_C_CTL_STKDL not fully implemented" +#~ msgstr "TIR_S_C_CTL_STKDL ¤Ï´°Á´¤Ë¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" diff --git a/bfd/po/ro.gmo b/bfd/po/ro.gmo new file mode 100644 index 0000000000000..8621928313f63 Binary files /dev/null and b/bfd/po/ro.gmo differ diff --git a/bfd/po/ro.po b/bfd/po/ro.po new file mode 100644 index 0000000000000..5706e4fd96371 --- /dev/null +++ b/bfd/po/ro.po @@ -0,0 +1,3026 @@ +# Mesajele în limba românã pentru pachetul bfd. +# Copyright (C) 2003 Free Software Foundation, Inc. +# Eugen Hoanca , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: bfd 2.14rel030712\n" +"POT-Creation-Date: 2003-07-11 13:53+0930\n" +"PO-Revision-Date: 2003-11-25 08:39+0200\n" +"Last-Translator: Eugen Hoanca \n" +"Language-Team: Romanian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" + +#: aout-adobe.c:204 +#, c-format +msgid "%s: Unknown section type in a.out.adobe file: %x\n" +msgstr "%s: Tip secþiune necunoscut în fiºier adobe a.out: %x\n" + +#: aout-cris.c:207 +#, c-format +msgid "%s: Invalid relocation type exported: %d" +msgstr "%s: Tip de relocare exportat invalid: %d" + +#: aout-cris.c:251 +#, c-format +msgid "%s: Invalid relocation type imported: %d" +msgstr "%s: Tip de relocare importat invalid: %d" + +#: aout-cris.c:262 +#, c-format +msgid "%s: Bad relocation record imported: %d" +msgstr "%s: Înregistrare de relocare greºitã importatã: %d" + +#: aoutx.h:1295 aoutx.h:1716 +#, c-format +msgid "%s: can not represent section `%s' in a.out object file format" +msgstr "%s: nu se poate reprezenta secþiunea `%s' în format de fiºier obiect a.out" + +#: aoutx.h:1682 +#, c-format +msgid "%s: can not represent section for symbol `%s' in a.out object file format" +msgstr "%s: nu se poate reprezenta secþiunea pentru simbolul `%s' în formatul de fiºier obiect a.out" + +#: aoutx.h:1684 +msgid "*unknown*" +msgstr "*necunoscut*" + +#: aoutx.h:3776 +#, c-format +msgid "%s: relocatable link from %s to %s not supported" +msgstr "%s: legãtura relocalizabilã din %s cãtre %s nesuportatã" + +#: archive.c:1751 +msgid "Warning: writing archive was slow: rewriting timestamp\n" +msgstr "Avertisment: scrierea arhivei a fost lentã: se rescrie marcajul de timp(timestamp)\n" + +#: archive.c:2014 +msgid "Reading archive file mod timestamp" +msgstr "Citirea fiºierului arhivã mod marcaj de timp" + +#: archive.c:2040 +msgid "Writing updated armap timestamp" +msgstr "Scriere marcaj de timp armap înnoit" + +#: bfd.c:280 +msgid "No error" +msgstr "Nici o eroare" + +#: bfd.c:281 +msgid "System call error" +msgstr "Eroare apel sistem" + +#: bfd.c:282 +msgid "Invalid bfd target" +msgstr "Þintã bfd invalidã" + +#: bfd.c:283 +msgid "File in wrong format" +msgstr "Fiºier în format eronat" + +#: bfd.c:284 +msgid "Archive object file in wrong format" +msgstr "Fiºier obiect arhivã în format eronat" + +#: bfd.c:285 +msgid "Invalid operation" +msgstr "Operaþie invalidã" + +#: bfd.c:286 +msgid "Memory exhausted" +msgstr "Memorie plinã" + +#: bfd.c:287 +msgid "No symbols" +msgstr "Nici un simbol" + +#: bfd.c:288 +msgid "Archive has no index; run ranlib to add one" +msgstr "Arhiva nu are nici un index.; rulaþi ranlib pentru a adãuga unul" + +#: bfd.c:289 +msgid "No more archived files" +msgstr "Nu mai existã fiºiere arhivate" + +#: bfd.c:290 +msgid "Malformed archive" +msgstr "Arhivã malformatã" + +#: bfd.c:291 +msgid "File format not recognized" +msgstr "Formatul de fiºier nu a fost recunoscut" + +#: bfd.c:292 +msgid "File format is ambiguous" +msgstr "Formatul de fiºier este ambiguu" + +#: bfd.c:293 +msgid "Section has no contents" +msgstr "Secþiunea nu are conþinut" + +#: bfd.c:294 +msgid "Nonrepresentable section on output" +msgstr "Secþiune de output nereprezentabilã" + +#: bfd.c:295 +msgid "Symbol needs debug section which does not exist" +msgstr "Simbolul necesitã secþiune de debug care nu existã" + +#: bfd.c:296 +msgid "Bad value" +msgstr "Valoare eronatã" + +#: bfd.c:297 +msgid "File truncated" +msgstr "Fiºier trunchiat" + +#: bfd.c:298 +msgid "File too big" +msgstr "Fiºier prea mare" + +#: bfd.c:299 +msgid "#" +msgstr "#" + +#: bfd.c:687 +#, c-format +msgid "BFD %s assertion fail %s:%d" +msgstr "Aserþiunea BFD %s a eºuat %s:%d" + +#: bfd.c:703 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d in %s\n" +msgstr "Eroare interna BFD %s, se renunþã la %s linia %d în %s\n" + +#: bfd.c:707 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d\n" +msgstr "Eroare internã BFD %s, se renunþã la %s linia %d\n" + +#: bfd.c:709 +msgid "Please report this bug.\n" +msgstr "Vã rugãm raportaþi acest bug.\n" + +#: bfdwin.c:202 +#, c-format +msgid "not mapping: data=%lx mapped=%d\n" +msgstr "nu se mapeazã: data=%lx mapat =%d\n" + +#: bfdwin.c:205 +msgid "not mapping: env var not set\n" +msgstr "nu se mapeazã: variabila env nu este setatã\n" + +#: binary.c:306 +#, c-format +msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx." +msgstr "Avertisment: Scrierea secþiunii `%s' spre offset de fiºier imens (sau negativ) 0x%lx" + +#: coff-a29k.c:120 +msgid "Missing IHCONST" +msgstr "IHCONST lipsã" + +#: coff-a29k.c:181 +msgid "Missing IHIHALF" +msgstr "IHHALF lipsã" + +#: coff-a29k.c:213 coff-or32.c:236 +msgid "Unrecognized reloc" +msgstr "Reloc necunoscut" + +#: coff-a29k.c:409 +msgid "missing IHCONST reloc" +msgstr "IHCONST reloc lipsã" + +#: coff-a29k.c:499 +msgid "missing IHIHALF reloc" +msgstr "IHIHALF reloc lipsã" + +#: coff-alpha.c:884 coff-alpha.c:921 coff-alpha.c:1992 coff-mips.c:1397 +msgid "GP relative relocation used when GP not defined" +msgstr "Relocare relativã GP folositã când GP nu este definit" + +#: coff-alpha.c:1488 +msgid "using multiple gp values" +msgstr "folosire de valori multiple gp" + +#: coff-arm.c:1066 elf32-arm.h:294 +#, c-format +msgid "%s: unable to find THUMB glue '%s' for `%s'" +msgstr "%s: nu s-a putut gãsi legãtura(glue) THUMB `%s' pentru `%s'" + +#: coff-arm.c:1096 elf32-arm.h:329 +#, c-format +msgid "%s: unable to find ARM glue '%s' for `%s'" +msgstr "%s: nu s-a putut gãsi legãtura(glue) ARM `%s' pentru `%s'" + +#: coff-arm.c:1394 coff-arm.c:1489 elf32-arm.h:892 elf32-arm.h:999 +#, c-format +msgid "%s(%s): warning: interworking not enabled." +msgstr "%s(%s): avertisment: interlucrul(interworking) nu este activat" + +#: coff-arm.c:1398 elf32-arm.h:1002 +#, c-format +msgid " first occurrence: %s: arm call to thumb" +msgstr " prima gãsire: %s: apelare braþ(arm) cãtre deget(thumb)" + +#: coff-arm.c:1493 elf32-arm.h:895 +#, c-format +msgid " first occurrence: %s: thumb call to arm" +msgstr " prima gãsire: %s: apelare deget(thumb) cãtre braþ(arm)" + +#: coff-arm.c:1496 +msgid " consider relinking with --support-old-code enabled" +msgstr " luaþi în considerare relinkuirea cu --support-old-code activat" + +#: coff-arm.c:1788 coff-tic80.c:687 cofflink.c:3038 +#, c-format +msgid "%s: bad reloc address 0x%lx in section `%s'" +msgstr "%s: adresã eronatã de relocare 0x%lx în secþiunea `%s'" + +#: coff-arm.c:2132 +#, c-format +msgid "%s: illegal symbol index in reloc: %d" +msgstr "%s: index ilegal de simbol în reloc: %d" + +#: coff-arm.c:2265 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d" +msgstr "EROARE: %s este compilat pentru APCS-%d, pe când %s e compilat pentru APCS-%d" + +#: coff-arm.c:2280 elf32-arm.h:2328 +#, c-format +msgid "ERROR: %s passes floats in float registers, whereas %s passes them in integer registers" +msgstr "EROARE: %s trimite float în regiºtrii de float, pe când %s îi trimite în regiºtrii de integer" + +#: coff-arm.c:2283 elf32-arm.h:2333 +#, c-format +msgid "ERROR: %s passes floats in integer registers, whereas %s passes them in float registers" +msgstr "EROARE: %s trimite integer în regiºtrii de integer, pe când %s îi trimite în regiºtrii de float" + +#: coff-arm.c:2298 +#, c-format +msgid "ERROR: %s is compiled as position independent code, whereas target %s is absolute position" +msgstr "EROARE: %s este compilat ca ºi cod independent de poziþie,pe când þinta %seste poziþie absolutã" + +#: coff-arm.c:2301 +#, c-format +msgid "ERROR: %s is compiled as absolute position code, whereas target %s is position independent" +msgstr "EROARE: %s este compilat ca ºi cod poziþie absolutã,pe când þinta %seste independentã de poziþie" + +#: coff-arm.c:2330 elf32-arm.h:2405 +#, c-format +msgid "Warning: %s supports interworking, whereas %s does not" +msgstr "Avertisment: %s suportã interlucru(interworking), pe când %s nu suportã" + +#: coff-arm.c:2333 elf32-arm.h:2412 +#, c-format +msgid "Warning: %s does not support interworking, whereas %s does" +msgstr "Avertisment: %s nu suportã interlucru(interworking), pe când %s suportã" + +#: coff-arm.c:2360 +#, c-format +msgid "private flags = %x:" +msgstr "marcaje(flags) private = %x:" + +#: coff-arm.c:2368 elf32-arm.h:2467 +msgid " [floats passed in float registers]" +msgstr " [floats trecuþi în regiºtri de float]" + +#: coff-arm.c:2370 +msgid " [floats passed in integer registers]" +msgstr " [floats trecuþi în regiºtrii de integer]" + +#: coff-arm.c:2373 elf32-arm.h:2470 +msgid " [position independent]" +msgstr "[ independent de poziþie]" + +#: coff-arm.c:2375 +msgid " [absolute position]" +msgstr " [poziþie absolutã]" + +#: coff-arm.c:2379 +msgid " [interworking flag not initialised]" +msgstr " [marcajul(flag) de interlucru(interworking) nu este iniþializat]" + +#: coff-arm.c:2381 +msgid " [interworking supported]" +msgstr " [interlucru(interworking) suportat]" + +#: coff-arm.c:2383 +msgid " [interworking not supported]" +msgstr " [interlucru(interworking) nesuportat]" + +#: coff-arm.c:2431 elf32-arm.h:2150 +#, c-format +msgid "Warning: Not setting interworking flag of %s since it has already been specified as non-interworking" +msgstr "Avertisment: Nu se seteazã marcajul(flagu) de interlucru(interworking) al %s atâta timp cât a fost specificat ca non-interlucru(interworking)" + +#: coff-arm.c:2435 elf32-arm.h:2154 +#, c-format +msgid "Warning: Clearing the interworking flag of %s due to outside request" +msgstr "Avertisment: Se ºterge marcajul(flag) de interlucru(interworking) al %s datoritã unei cereri din afarã" + +#: coff-h8300.c:1096 +#, c-format +msgid "cannot handle R_MEM_INDIRECT reloc when using %s output" +msgstr "nu am putut mainpula(handle) relocarea R_MEM_INDIRECT în folosirea ieºirii(output) %s" + +#: coff-i960.c:137 coff-i960.c:486 +msgid "uncertain calling convention for non-COFF symbol" +msgstr "convenþie de apelare nesigurã pentru simbol non-COFF" + +#: coff-m68k.c:482 coff-mips.c:2394 elf32-m68k.c:2193 elf32-mips.c:1783 +msgid "unsupported reloc type" +msgstr "tip de relocare nesuportat" + +#: coff-mips.c:839 elf32-mips.c:1088 elf64-mips.c:1590 elfn32-mips.c:1554 +msgid "GP relative relocation when _gp not defined" +msgstr "Relocare relativã GP atâta timp cât _gp nu este definit" + +#. No other sections should appear in -membedded-pic +#. code. +#: coff-mips.c:2431 +msgid "reloc against unsupported section" +msgstr "relocare pe o secþiune nesuportatã" + +#: coff-mips.c:2439 +msgid "reloc not properly aligned" +msgstr "relocare incorect aliniatã" + +#: coff-rs6000.c:2790 +#, c-format +msgid "%s: unsupported relocation type 0x%02x" +msgstr "%s: tip de relocare nesuportat 0x%02x" + +#: coff-rs6000.c:2883 +#, c-format +msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry" +msgstr "%s: relocare TOC la 0x%x cãtre simbolul `%s' fãrã nici o intrare TOC" + +#: coff-rs6000.c:3616 coff64-rs6000.c:2109 +#, c-format +msgid "%s: symbol `%s' has unrecognized smclas %d" +msgstr "%s: simbolul `%s' are un smclas necunoscut %d" + +#: coff-tic4x.c:170 coff-tic54x.c:288 coff-tic80.c:450 +#, c-format +msgid "Unrecognized reloc type 0x%x" +msgstr "Tip de relocare necunoscut 0x%x" + +#: coff-tic4x.c:218 coff-tic54x.c:373 coffcode.h:5045 +#, c-format +msgid "%s: warning: illegal symbol index %ld in relocs" +msgstr "%s: avertisment: index ilegal de simbol %ld în relocãri" + +#: coff-w65.c:364 +#, c-format +msgid "ignoring reloc %s\n" +msgstr "se ignorã reloc %s\n" + +#: coffcode.h:1108 +#, c-format +msgid "%s (%s): Section flag %s (0x%x) ignored" +msgstr "%s (%s): Marcajul(flag) de secþiune %s (0x%x) ignorat" + +#: coffcode.h:2214 +#, c-format +msgid "Unrecognized TI COFF target id '0x%x'" +msgstr "Id þintã TI COFF necunoscut `0x%x'" + +#: coffcode.h:4437 +#, c-format +msgid "%s: warning: illegal symbol index %ld in line numbers" +msgstr "%s: avertisment: index ilegal de simbol %ld în numãrul de linii" + +#: coffcode.h:4451 +#, c-format +msgid "%s: warning: duplicate line number information for `%s'" +msgstr "%s: avertisment: informaþie duplicat a numãrului de linii pentru `%s'" + +#: coffcode.h:4805 +#, c-format +msgid "%s: Unrecognized storage class %d for %s symbol `%s'" +msgstr "%s: Clasã de depozitare(storage) %d necunoscutã pentru %s simbolul `%s'" + +#: coffcode.h:4938 +#, c-format +msgid "warning: %s: local symbol `%s' has no section" +msgstr "avertisment: %s: simbolul local `%s' nu are secþiune" + +#: coffcode.h:5083 +#, c-format +msgid "%s: illegal relocation type %d at address 0x%lx" +msgstr "%s: tip ilegal de relocare %d la adresa 0x%lx" + +#: coffgen.c:1666 +#, c-format +msgid "%s: bad string table size %lu" +msgstr "%s: mãrime tabel ºiruri invalidã %lu" + +#: cofflink.c:538 elflink.h:1276 +#, c-format +msgid "Warning: type of symbol `%s' changed from %d to %d in %s" +msgstr "Avertisment: tipul de simbol `%s' schimbat de la %d la %d în %s" + +#: cofflink.c:2328 +#, c-format +msgid "%s: relocs in section `%s', but it has no contents" +msgstr "%s: relocãri în secþiunea `%s', dar fãrã conþinut" + +#: cofflink.c:2671 coffswap.h:890 +#, c-format +msgid "%s: %s: reloc overflow: 0x%lx > 0xffff" +msgstr "%s: %s: depãºire(overflow) de relocãri: 0x%lx > 0xffff" + +#: cofflink.c:2680 coffswap.h:876 +#, c-format +msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: avertisment: %s: depãºire(overflow) numãr de linii: 0x%lx > 0xffff" + +#: cpu-arm.c:196 cpu-arm.c:206 +#, c-format +msgid "ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale" +msgstr "EROARE: %s este compilat pentru EP9312, pe când %s e compilat pentru XScale" + +#: cpu-arm.c:344 +#, c-format +msgid "warning: unable to update contents of %s section in %s" +msgstr "avertisment: imposibil de adus la zi(update) conþinutul secþiunii %s în %s" + +#: dwarf2.c:380 +msgid "Dwarf Error: Can't find .debug_str section." +msgstr "Eroare Pitic(Dwarf): Nu pot gãsi secþiunea debug_str" + +#: dwarf2.c:397 +#, c-format +msgid "Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str size (%lu)." +msgstr "Eroare Pitic(Dwarf): DW_FORM_strp offset (%lu) mai mare sau egalã cu mãrimea .debug_str (%lu)." + +#: dwarf2.c:541 +msgid "Dwarf Error: Can't find .debug_abbrev section." +msgstr "Eroare Pitic(Dwarf): Nu pot gãsi secþiunea debug_abbrev." + +#: dwarf2.c:556 +#, c-format +msgid "Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size (%lu)." +msgstr "Eroare Pitic(Dwarf): Offset abbrev(%lu) mai mare sau egal cu mãrimea .debug_abbrev (%lu)." + +#: dwarf2.c:756 +#, c-format +msgid "Dwarf Error: Invalid or unhandled FORM value: %u." +msgstr "Eroare Pitic(Dwarf): Valoare FORM invalidã sau nemanipulabilã: %u." + +#: dwarf2.c:933 +msgid "Dwarf Error: mangled line number section (bad file number)." +msgstr "Eroare Pitic(Dwarf): secþiune numãr de linii trunchiatã (numãr fiºier eronat)" + +#: dwarf2.c:1032 +msgid "Dwarf Error: Can't find .debug_line section." +msgstr "Eroare Pitic(Dwarf): Nu pot gãsi secþiunea debug_line." + +#: dwarf2.c:1049 +#, c-format +msgid "Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)." +msgstr "Eroare Pitic(Dwarf): Offsetul de linie (%lu) mai mare sau egal cu mãrimea .debug_line (%lu)" + +#: dwarf2.c:1255 +msgid "Dwarf Error: mangled line number section." +msgstr "Eroare Pitic(Dwarf): secþiune trunchiatã numãr de linii" + +#: dwarf2.c:1470 dwarf2.c:1620 +#, c-format +msgid "Dwarf Error: Could not find abbrev number %u." +msgstr "Eroare Pitic(Dwarf): Nu am putut gãsi numãrul abbrev: %u." + +#: dwarf2.c:1581 +#, c-format +msgid "Dwarf Error: found dwarf version '%u', this reader only handles version 2 information." +msgstr "Eroare Pitic(Dwarf): S-a gãsit dwarf versiunea `%u', acest cititor manipuleazã doar informaþii ale versiunii 2." + +#: dwarf2.c:1588 +#, c-format +msgid "Dwarf Error: found address size '%u', this reader can not handle sizes greater than '%u'." +msgstr "Eroare Pitic(Dwarf): s-a gãsit adresa mãrimea `%u', acest cititor nu poate manipula mãrimi mai mari decât `%u'" + +#: dwarf2.c:1611 +#, c-format +msgid "Dwarf Error: Bad abbrev number: %u." +msgstr "Eroare Pitic(Dwarf): Numãr invalid de abbrev: %u" + +#: ecoff.c:1339 +#, c-format +msgid "Unknown basic type %d" +msgstr "Tip de bazã necunoscut %d" + +#: ecoff.c:1599 +#, c-format +msgid "" +"\n" +" End+1 symbol: %ld" +msgstr "" +"\n" +" Simbol Sfârºit+1: %ld" + +#: ecoff.c:1606 ecoff.c:1609 +#, c-format +msgid "" +"\n" +" First symbol: %ld" +msgstr "" +"\n" +" Primul simbol: %ld" + +#: ecoff.c:1621 +#, c-format +msgid "" +"\n" +" End+1 symbol: %-7ld Type: %s" +msgstr "" +"\n" +" Simbol Sfârºit+1: %-7ld Tip: %s" + +#: ecoff.c:1628 +#, c-format +msgid "" +"\n" +" Local symbol: %ld" +msgstr "" +"\n" +" Simbol local: %ld" + +#: ecoff.c:1636 +#, c-format +msgid "" +"\n" +" struct; End+1 symbol: %ld" +msgstr "" +"\n" +" struct; Simbol Sfârºit+1: %ld" + +#: ecoff.c:1641 +#, c-format +msgid "" +"\n" +" union; End+1 symbol: %ld" +msgstr "" +"\n" +" uniune; Simbol Sfârºit+1: %ld" + +#: ecoff.c:1646 +#, c-format +msgid "" +"\n" +" enum; End+1 symbol: %ld" +msgstr "" +"\n" +" enum; Simbol Sfârºit+1: %ld" + +#: ecoff.c:1652 +#, c-format +msgid "" +"\n" +" Type: %s" +msgstr "" +"\n" +" Tip: %s" + +#: elf-hppa.h:1458 elf-hppa.h:1491 elf-m10300.c:1628 elf64-sh64.c:1704 +#, c-format +msgid "%s: warning: unresolvable relocation against symbol `%s' from %s section" +msgstr "%s: avertisment: relocare nerezolvabilã pe simbolul `%s; din secþiunea `%s'" + +#: elf-m10200.c:442 elf-m10300.c:1695 elf32-arm.h:2088 elf32-avr.c:812 +#: elf32-cris.c:1390 elf32-d10v.c:570 elf32-fr30.c:634 elf32-frv.c:815 +#: elf32-h8300.c:528 elf32-i860.c:1028 elf32-ip2k.c:1586 elf32-iq2000.c:699 +#: elf32-m32r.c:1283 elf32-m68hc1x.c:1305 elf32-msp430.c:510 +#: elf32-openrisc.c:436 elf32-v850.c:1777 elf32-xstormy16.c:976 +#: elf64-mmix.c:1332 +msgid "internal error: out of range error" +msgstr "eroare internã: eroare depãºire de domeniu(out of range)" + +#: elf-m10200.c:446 elf-m10300.c:1699 elf32-arm.h:2092 elf32-avr.c:816 +#: elf32-cris.c:1394 elf32-d10v.c:574 elf32-fr30.c:638 elf32-frv.c:819 +#: elf32-h8300.c:532 elf32-i860.c:1032 elf32-iq2000.c:703 elf32-m32r.c:1287 +#: elf32-m68hc1x.c:1309 elf32-msp430.c:514 elf32-openrisc.c:440 +#: elf32-v850.c:1781 elf32-xstormy16.c:980 elf64-mmix.c:1336 elfxx-mips.c:6452 +msgid "internal error: unsupported relocation error" +msgstr "eroare internã: eroare de relocare nesuportatã" + +#: elf-m10200.c:450 elf-m10300.c:1703 elf32-arm.h:2096 elf32-d10v.c:578 +#: elf32-h8300.c:536 elf32-m32r.c:1291 elf32-m68hc1x.c:1313 +msgid "internal error: dangerous error" +msgstr "eroare internã: eroare periculoasã" + +#: elf-m10200.c:454 elf-m10300.c:1707 elf32-arm.h:2100 elf32-avr.c:824 +#: elf32-cris.c:1402 elf32-d10v.c:582 elf32-fr30.c:646 elf32-frv.c:827 +#: elf32-h8300.c:540 elf32-i860.c:1040 elf32-ip2k.c:1601 elf32-iq2000.c:711 +#: elf32-m32r.c:1295 elf32-m68hc1x.c:1317 elf32-msp430.c:522 +#: elf32-openrisc.c:448 elf32-v850.c:1801 elf32-xstormy16.c:988 +#: elf64-mmix.c:1344 +msgid "internal error: unknown error" +msgstr "eroare internã: eroare necunoscutã" + +#: elf.c:372 +#, c-format +msgid "%s: invalid string offset %u >= %lu for section `%s'" +msgstr "%s: offset de ºir invalid %u >= %lu pentru secþiunea `%s'" + +#: elf.c:624 +#, c-format +msgid "%s: invalid SHT_GROUP entry" +msgstr "%s: intrare SHT_GROUP invalidã" + +#: elf.c:695 +#, c-format +msgid "%s: no group info for section %s" +msgstr "%s nu existã informaþii de grup pentru secþiunea %s" + +#: elf.c:1055 +msgid "" +"\n" +"Program Header:\n" +msgstr "" +"\n" +"Header Program:\n" + +#: elf.c:1106 +msgid "" +"\n" +"Dynamic Section:\n" +msgstr "" +"\n" +"Secþiune Dinamicã:\n" + +#: elf.c:1235 +msgid "" +"\n" +"Version definitions:\n" +msgstr "" +"\n" +"Definiþii de versiune:\n" + +#: elf.c:1258 +msgid "" +"\n" +"Version References:\n" +msgstr "" +"\n" +"Referinþe Versiune:\n" + +#: elf.c:1263 +#, c-format +msgid " required from %s:\n" +msgstr " cerute de %s:\n" + +#: elf.c:1944 +#, c-format +msgid "%s: invalid link %lu for reloc section %s (index %u)" +msgstr "%s: link invalid %lu pentru secþiunea de relocare %s (index %u)" + +#: elf.c:3686 +#, c-format +msgid "%s: Not enough room for program headers (allocated %u, need %u)" +msgstr "%s: Memorie insuficientã pentru headerele programului (alocatã %u, necesarã %u)" + +#: elf.c:3791 +#, c-format +msgid "%s: Not enough room for program headers, try linking with -N" +msgstr "%s: Memorie insuficientã pentru headerele programului, încercaþi linkuirea cu -N" + +#: elf.c:3922 +#, c-format +msgid "Error: First section in segment (%s) starts at 0x%x whereas the segment starts at 0x%x" +msgstr "Eroare: prima secþiune în segment (%s) începe la 0x%x pe când segmentul începe la 0x%x" + +#: elf.c:4242 +#, c-format +msgid "%s: warning: allocated section `%s' not in segment" +msgstr "%s: avertisment: secþiunea alocatã `%s' nu este în segment" + +#: elf.c:4566 +#, c-format +msgid "%s: symbol `%s' required but not present" +msgstr "%s: simbolul `%s' necesar, dar nu este prezent" + +#: elf.c:4854 +#, c-format +msgid "%s: warning: Empty loadable segment detected, is this intentional ?\n" +msgstr "%s: avertisment: S-a detectat segment încãrcabil vid, este intenþionat ?\n" + +#: elf.c:5485 +#, c-format +msgid "Unable to find equivalent output section for symbol '%s' from section '%s'" +msgstr "Nnu am putut gãsi secþiunea de output echivalentã pentru simbolul '%s' din secþiunea '%s'" + +#: elf.c:6298 +#, c-format +msgid "%s: unsupported relocation type %s" +msgstr "%s: tip de relocare nesuportat: %s" + +#: elf32-arm.h:1228 +#, c-format +msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'." +msgstr "%s: Avertisment: BLX Arm are ca þintã funcþia Arm `%s'." + +#: elf32-arm.h:1424 +#, c-format +msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'." +msgstr "%s: Avertisment: BLX Thumb are ca þintã funcþia thumb `%s'." + +#: elf32-arm.h:1918 elf32-sh.c:4706 elf64-sh64.c:1613 +#, c-format +msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section" +msgstr "%s(%s+0x%lx): %s relocare pe secþiunea SEC_MERGE" + +#: elf32-arm.h:2012 +#, c-format +msgid "%s: warning: unresolvable relocation %d against symbol `%s' from %s section" +msgstr "%s: avertisment: relocare nerezolvabilã %d pe simbolul `%s' din secþiunea %s" + +#: elf32-arm.h:2202 +#, c-format +msgid "Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it" +msgstr "Avertisment: Se ºterge marcajul(flag) de interlucru(interworking) al %s deoarece împreunã cu el a fost linkuit cod non-interlucru în %s" + +#: elf32-arm.h:2302 +#, c-format +msgid "ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d" +msgstr "EROARE: %s este compilat pentru EABI versiunea %d, pe când %s este compilat pentru versiunea %d" + +#: elf32-arm.h:2316 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d" +msgstr "EROARE: %s este compilat pentru APCS-%d, pe când þinta %s foloseºte APCS-%d" + +#: elf32-arm.h:2344 +#, c-format +msgid "ERROR: %s uses VFP instructions, whereas %s does not" +msgstr "EROARE: %s foloseºte instrucþiuni VFP, pe când %s nu le foloseºte" + +#: elf32-arm.h:2349 +#, c-format +msgid "ERROR: %s uses FPA instructions, whereas %s does not" +msgstr "EROARE: %s foloseºte instrucþiuni FPA, pe când %s nu le foloseºte" + +#: elf32-arm.h:2360 elf32-arm.h:2365 +#, c-format +msgid "ERROR: %s uses Maverick instructions, whereas %s does not" +msgstr "EROARE: %s foloseºte instrucþiuni Maverick, pe când %s nu le foloseºte" + +#: elf32-arm.h:2385 +#, c-format +msgid "ERROR: %s uses software FP, whereas %s uses hardware FP" +msgstr "EROARE: %s foloseºte FP software, pe când %s foloseºte FP hardware" + +#: elf32-arm.h:2390 +#, c-format +msgid "ERROR: %s uses hardware FP, whereas %s uses software FP" +msgstr "EROARE: %s foloseºte FP hardware, pe când %s foloseºte FP software" + +#. Ignore init flag - it may not be set, despite the flags field +#. containing valid data. +#: elf32-arm.h:2443 elf32-cris.c:2975 elf32-m68hc1x.c:1459 elf32-m68k.c:397 +#: elf32-vax.c:546 elfxx-mips.c:9238 +#, c-format +msgid "private flags = %lx:" +msgstr "marcaje(flags) private = %lx:" + +#: elf32-arm.h:2452 +msgid " [interworking enabled]" +msgstr " [interlucru(interworking) activat]" + +#: elf32-arm.h:2460 +msgid " [VFP float format]" +msgstr " [format float VFP]" + +#: elf32-arm.h:2462 +msgid " [Maverick float format]" +msgstr " [format float Maverick]" + +#: elf32-arm.h:2464 +msgid " [FPA float format]" +msgstr " [format float FPA]" + +#: elf32-arm.h:2473 +msgid " [new ABI]" +msgstr " [ABI nou]" + +#: elf32-arm.h:2476 +msgid " [old ABI]" +msgstr " [ABI vechi]" + +#: elf32-arm.h:2479 +msgid " [software FP]" +msgstr " [FP software]" + +#: elf32-arm.h:2488 +msgid " [Version1 EABI]" +msgstr " [EABI Versiunea1]" + +#: elf32-arm.h:2491 elf32-arm.h:2502 +msgid " [sorted symbol table]" +msgstr " [tabelã sortatã de simboluri]" + +#: elf32-arm.h:2493 elf32-arm.h:2504 +msgid " [unsorted symbol table]" +msgstr " [tabelã de simboluri nesortatã]" + +#: elf32-arm.h:2499 +msgid " [Version2 EABI]" +msgstr " [EABI Versiunea2]" + +#: elf32-arm.h:2507 +msgid " [dynamic symbols use segment index]" +msgstr " [simbolurile dinamice folosesc index de segment]" + +#: elf32-arm.h:2510 +msgid " [mapping symbols precede others]" +msgstr " [simbolurile de mapare le precedeazã pe celelalte]" + +#: elf32-arm.h:2517 +msgid " " +msgstr " " + +#: elf32-arm.h:2524 +msgid " [relocatable executable]" +msgstr " [executabil relocabil]" + +#: elf32-arm.h:2527 +msgid " [has entry point]" +msgstr " [are punct de intrare]" + +#: elf32-arm.h:2532 +msgid "" +msgstr "" + +#: elf32-avr.c:820 elf32-cris.c:1398 elf32-fr30.c:642 elf32-frv.c:823 +#: elf32-i860.c:1036 elf32-ip2k.c:1597 elf32-iq2000.c:707 elf32-msp430.c:518 +#: elf32-openrisc.c:444 elf32-v850.c:1785 elf32-xstormy16.c:984 +#: elf64-mmix.c:1340 +msgid "internal error: dangerous relocation" +msgstr "eroare internã: relocare periculoasã" + +#: elf32-cris.c:931 +#, c-format +msgid "%s: unresolvable relocation %s against symbol `%s' from %s section" +msgstr "%s: relocare nerezolvabilã %s pe simbolul `%s' din secþiunea `%s'" + +#: elf32-cris.c:993 +#, c-format +msgid "%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section" +msgstr "%s:Nu existã nici PLT nici GOR pentru relocarea %s pe simbolul `%s' din secþiunea %s" + +#: elf32-cris.c:996 elf32-cris.c:1122 +msgid "[whose name is lost]" +msgstr "[al cãrui nume s-a pierdut]" + +#: elf32-cris.c:1111 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against local symbol from %s section" +msgstr "%s: relocarea %s cu adãugarea diferitã de zero %d pe simbolul local din secþiunea %s" + +#: elf32-cris.c:1118 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against symbol `%s' from %s section" +msgstr "%s: relocarea %s cu adãugare non-zero %d pe simbolul `%s' din secþiunea %s" + +#: elf32-cris.c:1143 +#, c-format +msgid "%s: relocation %s is not allowed for global symbol: `%s' from %s section" +msgstr "%s: relocarea %s nu este permisã pentru simbolul global `%s' din secþiunea %s" + +#: elf32-cris.c:1158 +#, c-format +msgid "%s: relocation %s in section %s with no GOT created" +msgstr "%s: relocarea %s din secþiunea %s fãrã GOT creat" + +#: elf32-cris.c:1277 +#, c-format +msgid "%s: Internal inconsistency; no relocation section %s" +msgstr "%s: Inconsistenþã internã, nu existã secþiunea de relocare %s" + +#: elf32-cris.c:2500 +#, c-format +msgid "" +"%s, section %s:\n" +" relocation %s should not be used in a shared object; recompile with -fPIC" +msgstr "" +"%s, secþiunea %s:\n" +" relocarea %s n-ar trebui folositã într-un shared object; recompilaþi cu -fPIC" + +#: elf32-cris.c:2978 +msgid " [symbols have a _ prefix]" +msgstr " [simbolurile au un _prefix]" + +#: elf32-cris.c:3017 +#, c-format +msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols" +msgstr "%s: se folosesc simbolurile _-prefixate, dar se scrie fiºierul cu simboluri neprefixate" + +#: elf32-cris.c:3018 +#, c-format +msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols" +msgstr "%s: se folosesc simboluri neprefixate, dar se scrie fiºierul cu simboluri _-prefixate" + +#: elf32-frv.c:1223 +#, c-format +msgid "%s: compiled with %s and linked with modules that use non-pic relocations" +msgstr "%s: compilat cu %s ºi linkuit cu module care folosesc relocaþii non-pic" + +#: elf32-frv.c:1273 elf32-iq2000.c:895 +#, c-format +msgid "%s: compiled with %s and linked with modules compiled with %s" +msgstr "%s: compilat cu %s ºi linkuit cu module compilate cu %s" + +#: elf32-frv.c:1285 +#, c-format +msgid "%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%s: foloseºte câmpuri marcaje e_flags (0x%lx) diferite de modulele anterioare (0x%lx)" + +#: elf32-frv.c:1321 elf32-iq2000.c:933 +#, c-format +msgid "private flags = 0x%lx:" +msgstr "marcaje(flags) private = 0x%lx" + +#: elf32-gen.c:83 elf64-gen.c:82 +#, c-format +msgid "%s: Relocations in generic ELF (EM: %d)" +msgstr "%s: Relocãri în ELF generic (EM: %d)" + +#: elf32-hppa.c:672 elf32-m68hc1x.c:176 elf64-ppc.c:3118 +#, c-format +msgid "%s: cannot create stub entry %s" +msgstr "%s: nu se poate crea intrarea trunchiatã %s" + +#: elf32-hppa.c:957 elf32-hppa.c:3538 +#, c-format +msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections" +msgstr "%s(%s+0x%lx): nu se poate gãsi %s, recompilaþi cu -ffunction-sections" + +#: elf32-hppa.c:1340 elf64-x86-64.c:672 elf64-x86-64.c:797 +#, c-format +msgid "%s: relocation %s can not be used when making a shared object; recompile with -fPIC" +msgstr "%s: relocarea %s nu poate fi utilizatã când se face un shared object, recompilaþicu -fPIC" + +#: elf32-hppa.c:1360 +#, c-format +msgid "%s: relocation %s should not be used when making a shared object; recompile with -fPIC" +msgstr "%s: relocarea %s nu ar trebui utilizatã când se face un shared object, recompilaþicu -fPIC" + +#: elf32-hppa.c:1553 +#, c-format +msgid "Could not find relocation section for %s" +msgstr "Nu se poate gãsi secþiunea de relocare pentru %s" + +#: elf32-hppa.c:2828 +#, c-format +msgid "%s: duplicate export stub %s" +msgstr "%s: exportare de ciot(stub) duplicatã %s" + +#: elf32-hppa.c:3416 +#, c-format +msgid "%s(%s+0x%lx): fixing %s" +msgstr "%s(%s+0x%lx): se fixeazã %s" + +#: elf32-hppa.c:4039 +#, c-format +msgid "%s(%s+0x%lx): cannot handle %s for %s" +msgstr "%s(%s+0x%lx): nu pot manipula %s pentru %s" + +#: elf32-hppa.c:4357 +msgid ".got section not immediately after .plt section" +msgstr "secþiunea .got nu urmeazã imediat dupã secþiunea .plt" + +#: elf32-i386.c:326 +#, c-format +msgid "%s: invalid relocation type %d" +msgstr "%s: tip de relocare invalid %d" + +#: elf32-i386.c:841 elf32-s390.c:990 elf32-sparc.c:887 elf32-xtensa.c:637 +#: elf64-s390.c:943 elf64-x86-64.c:650 +#, c-format +msgid "%s: bad symbol index: %d" +msgstr "%s:index de simboluri invalid: %d" + +#: elf32-i386.c:949 elf32-s390.c:1168 elf32-sh.c:6426 elf32-sparc.c:1011 +#: elf64-s390.c:1129 +#, c-format +msgid "%s: `%s' accessed both as normal and thread local symbol" +msgstr "%s: `%s' accesate ºi ca simboluri locale normale ºi ca simboluri locale pe fire (thread)" + +#: elf32-i386.c:1064 elf32-s390.c:1279 elf64-ppc.c:3929 elf64-s390.c:1243 +#: elf64-x86-64.c:886 +#, c-format +msgid "%s: bad relocation section name `%s'" +msgstr "%s: nume secþiune relocare invalid `%s'" + +#: elf32-i386.c:2908 elf32-m68k.c:1757 elf32-s390.c:3022 elf32-sparc.c:2879 +#: elf32-xtensa.c:2193 elf64-s390.c:3018 elf64-sparc.c:2664 +#: elf64-x86-64.c:2452 +#, c-format +msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'" +msgstr "%s(%s+0x%lx): relocare nerezolvabilã pe simbolul `%s'" + +#: elf32-i386.c:2947 elf32-m68k.c:1796 elf32-s390.c:3072 elf64-s390.c:3068 +#: elf64-x86-64.c:2490 +#, c-format +msgid "%s(%s+0x%lx): reloc against `%s': error %d" +msgstr "%s(%s+0x%lx): relocare pe `%s': eroare %d" + +#: elf32-ip2k.c:565 elf32-ip2k.c:571 elf32-ip2k.c:734 elf32-ip2k.c:740 +msgid "ip2k relaxer: switch table without complete matching relocation information." +msgstr "ip2k relaxer: schimbare de tabel fãrã potrivirea completã a informaþiei de relocare." + +#: elf32-ip2k.c:588 elf32-ip2k.c:767 +msgid "ip2k relaxer: switch table header corrupt." +msgstr "ip2k relaxer: headerul tablelului de schimbare este corupt." + +#: elf32-ip2k.c:1395 +#, c-format +msgid "ip2k linker: missing page instruction at 0x%08lx (dest = 0x%08lx)." +msgstr "ip2k linker: lipseºte instrucþiunea de paginã la 0x%08lx (dest = 0x%08lx)." + +#: elf32-ip2k.c:1409 +#, c-format +msgid "ip2k linker: redundant page instruction at 0x%08lx (dest = 0x%08lx)." +msgstr "ip2k linker: instrucþiune redundantã de paginã la 0x%08lx (dest = 0x%08lx)." + +#. Only if it's not an unresolved symbol. +#: elf32-ip2k.c:1593 +msgid "unsupported relocation between data/insn address spaces" +msgstr "relocare nesuportatã între datã/spaþiu adresã insn" + +#: elf32-iq2000.c:907 elf32-m68hc1x.c:1431 elf32-ppc.c:2175 elf64-sparc.c:3072 +#: elfxx-mips.c:9195 +#, c-format +msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%s: foloseºte câmpuri de marcaje e_flags (0x%lx) diferite de modulele anterioare (0x%lx)" + +#: elf32-m32r.c:930 +msgid "SDA relocation when _SDA_BASE_ not defined" +msgstr "Relocare SDA când _SDA_BASE_ nu este definit" + +#: elf32-m32r.c:1018 elf64-alpha.c:4279 elf64-alpha.c:4407 elf32-ia64.c:3958 +#: elf64-ia64.c:3958 +#, c-format +msgid "%s: unknown relocation type %d" +msgstr "%s: tip necunoscut de relocare %d" + +#: elf32-m32r.c:1226 +#, c-format +msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)" +msgstr "%s: Þinta (%s) unei relocãri %s este în secþiunea nepotrivitã (%s)" + +#: elf32-m32r.c:1952 +#, c-format +msgid "%s: Instruction set mismatch with previous modules" +msgstr "%s: Setul de instrucþiuni nu se potriveºte cu modulele anterioare" + +#: elf32-m32r.c:1975 +#, c-format +msgid "private flags = %lx" +msgstr "marcaje (flags) private = %lx" + +#: elf32-m32r.c:1980 +msgid ": m32r instructions" +msgstr ": instrucþiuni m32r" + +#: elf32-m32r.c:1981 +msgid ": m32rx instructions" +msgstr ": instrucþiuni m32rx" + +#: elf32-m68hc1x.c:1217 +#, c-format +msgid "Reference to the far symbol `%s' using a wrong relocation may result in incorrect execution" +msgstr "Referinþa la simbolul depãrtat `%s' folosind o relocare invalidã poate duce la execuþie incorectã" + +#: elf32-m68hc1x.c:1240 +#, c-format +msgid "banked address [%lx:%04lx] (%lx) is not in the same bank as current banked address [%lx:%04lx] (%lx)" +msgstr "adresa banked [%lx:%04lx] (%lx) nu este în acelaºi bank precum adresa banked curentã [%lx:%04lx] (%lx)" + +#: elf32-m68hc1x.c:1259 +#, c-format +msgid "reference to a banked address [%lx:%04lx] in the normal address space at %04lx" +msgstr "referinþã la adresa banked [%lx:%04lx] în spaþiul normal de adresã la %04lx" + +#: elf32-m68hc1x.c:1396 +#, c-format +msgid "%s: linking files compiled for 16-bit integers (-mshort) and others for 32-bit integers" +msgstr "%s: linkuire a fiºierelor compilate pentru întregi(integers) pe 16-biþi (-mshort) ºi a celorlalte pentru întregi(integers) pe 32-biþi" + +#: elf32-m68hc1x.c:1404 +#, c-format +msgid "%s: linking files compiled for 32-bit double (-fshort-double) and others for 64-bit double" +msgstr "%s: linkuire a fiºierelor compilate pentru double pe 32-biþi (-fshort-double) ºi a celorlalte pentru double pe 64-biþi" + +#: elf32-m68hc1x.c:1414 +#, c-format +msgid "%s: linking files compiled for HCS12 with others compiled for HC12" +msgstr "%s:linkuire a fiºierelor compilate pentru HCS12 cu celelalte compilate pentru HC12" + +#: elf32-m68hc1x.c:1462 +msgid "[abi=32-bit int, " +msgstr "[abi=32-bit int, " + +#: elf32-m68hc1x.c:1464 +msgid "[abi=16-bit int, " +msgstr "[abi=16-bit int, " + +#: elf32-m68hc1x.c:1467 +msgid "64-bit double, " +msgstr "double pe 64-biþi, " + +#: elf32-m68hc1x.c:1469 +msgid "32-bit double, " +msgstr "double pe 32-biþi, " + +#: elf32-m68hc1x.c:1472 +msgid "cpu=HC11]" +msgstr "cpu=HC11]" + +#: elf32-m68hc1x.c:1474 +msgid "cpu=HCS12]" +msgstr "cpu=HCS12]" + +#: elf32-m68hc1x.c:1476 +msgid "cpu=HC12]" +msgstr "cpu=HC12]" + +#: elf32-m68hc1x.c:1479 +msgid " [memory=bank-model]" +msgstr " [memorie=mod-bank]" + +#: elf32-m68hc1x.c:1481 +msgid " [memory=flat]" +msgstr " [memorie=întinsã(flat)]" + +#: elf32-m68k.c:400 +msgid " [cpu32]" +msgstr " [cpu32]" + +#: elf32-m68k.c:403 +msgid " [m68000]" +msgstr " [m68000]" + +#: elf32-mcore.c:353 elf32-mcore.c:456 +#, c-format +msgid "%s: Relocation %s (%d) is not currently supported.\n" +msgstr "%s: Relocarea %s (%d) nu este încã suportatã.\n" + +#: elf32-mcore.c:441 +#, c-format +msgid "%s: Unknown relocation type %d\n" +msgstr "%s: Tip necunoscut de relocare %d\n" + +#: elf32-mips.c:1170 elf64-mips.c:1717 elfn32-mips.c:1664 +msgid "32bits gp relative relocation occurs for an external symbol" +msgstr "relocarea relativã gp 32bits are loc pe un simbol extern" + +#: elf32-mips.c:1314 elf64-mips.c:1830 elfn32-mips.c:1783 +#, c-format +msgid "Linking mips16 objects into %s format is not supported" +msgstr "Linkuirea obiectelor mips16 în formatul %s nu este suportatã" + +#: elf32-ppc.c:2056 +#, c-format +msgid "generic linker can't handle %s" +msgstr "linkerul generic nu poate manipula(handle) %s" + +#: elf32-ppc.c:2138 +#, c-format +msgid "%s: compiled with -mrelocatable and linked with modules compiled normally" +msgstr "%s: compilat cu -mrelocatable ºi linkuit cu module compilate normal" + +#: elf32-ppc.c:2147 +#, c-format +msgid "%s: compiled normally and linked with modules compiled with -mrelocatable" +msgstr "%s: compilat normal ºi linkuite cu module compilate cu -mrelocatable" + +#: elf32-ppc.c:3413 +#, c-format +msgid "%s: relocation %s cannot be used when making a shared object" +msgstr "%s: relocarea %s nu poate fi folositã când se creazã un shared object" + +#. It does not make sense to have a procedure linkage +#. table entry for a local symbol. +#: elf32-ppc.c:3619 +#, c-format +msgid "%s(%s+0x%lx): %s reloc against local symbol" +msgstr "relocare %s(%s+0x%lx): %s pe simbol local" + +#: elf32-ppc.c:4862 elf64-ppc.c:7789 +#, c-format +msgid "%s: unknown relocation type %d for symbol %s" +msgstr "%s: tip de relocare %d necunoscut pentru simbolul %s" + +#: elf32-ppc.c:5113 +#, c-format +msgid "%s(%s+0x%lx): non-zero addend on %s reloc against `%s'" +msgstr "%s(%s+0x%lx): adãugare non-zero în relocarea %s pentru `%s'" + +#: elf32-ppc.c:5399 elf32-ppc.c:5425 elf32-ppc.c:5484 +#, c-format +msgid "%s: the target (%s) of a %s relocation is in the wrong output section (%s)" +msgstr "%s: þinta (%s) unei relocãri %s este într-o secþiune invalidã de output (%s)" + +#: elf32-ppc.c:5539 +#, c-format +msgid "%s: relocation %s is not yet supported for symbol %s." +msgstr "%s: relocarea %s nu este încã suportatã pentru simbolul %s." + +#: elf32-ppc.c:5594 elf64-ppc.c:8461 +#, c-format +msgid "%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'" +msgstr "%s(%s+0x%lx): relocare nerezolvabilã %s pe simbolul `%s'" + +#: elf32-ppc.c:5644 elf64-ppc.c:8507 +#, c-format +msgid "%s(%s+0x%lx): %s reloc against `%s': error %d" +msgstr "%s(%s+0x%lx):relocarea %s pe `%s': eroare %d" + +#: elf32-ppc.c:5888 +#, c-format +msgid "corrupt or empty %s section in %s" +msgstr "secþiune %s coruptã sau vidã în %s" + +#: elf32-ppc.c:5895 +#, c-format +msgid "unable to read in %s section from %s" +msgstr "nu se poate citi în secþiunea %s din %s" + +#: elf32-ppc.c:5901 +#, c-format +msgid "corrupt %s section in %s" +msgstr "secþiune coruptã %s în %s" + +#: elf32-ppc.c:5944 +#, c-format +msgid "warning: unable to set size of %s section in %s" +msgstr "avertisment: nu se poate seta mãrimea secþiunii %s în %s" + +#: elf32-ppc.c:5994 +msgid "failed to allocate space for new APUinfo section." +msgstr "nu s-a putut aloca spaþiu pentru secþiunea nouã APUinfo." + +#: elf32-ppc.c:6013 +msgid "failed to compute new APUinfo section." +msgstr "nu s-a putut calcula(compute) secþiunea nouã APUinfo." + +#: elf32-ppc.c:6016 +msgid "failed to install new APUinfo section." +msgstr "nu s-a putut instala secþiunea APUinfo nouã." + +#: elf32-s390.c:2256 elf64-s390.c:2226 +#, c-format +msgid "%s(%s+0x%lx): invalid instruction for TLS relocation %s" +msgstr "%s(%s+0x%lx): instrucþiune invalidã pentur relocarea TLS %s" + +#: elf32-sh.c:2103 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES offset" +msgstr "%s: 0x%lx: avertisment: offset R_SH_USES invalid" + +#: elf32-sh.c:2115 +#, c-format +msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x" +msgstr "%s: 0x%lx: avertisment: R_SH_USES trimite cãtre insn necunoscut 0x%x" + +#: elf32-sh.c:2132 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES load offset" +msgstr "%s: 0x%lx: avertisment:offset de încãrcare R_SH_USES invalid" + +#: elf32-sh.c:2147 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected reloc" +msgstr "%s: 0x%lx: avertismetn: nu s-a putut gãsi relocarea aºteptatã" + +#: elf32-sh.c:2175 +#, c-format +msgid "%s: 0x%lx: warning: symbol in unexpected section" +msgstr "%s: 0x%lx: avertisment: simbol în secþiune neaºteptatã" + +#: elf32-sh.c:2300 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected COUNT reloc" +msgstr "%s: 0x%lx: avertisment: nu s-a putut gãsi relocarea COUNT aºteptatã" + +#: elf32-sh.c:2309 +#, c-format +msgid "%s: 0x%lx: warning: bad count" +msgstr "%s: 0x%lx: avertisment: numãrãtoare(count) invalidã" + +#: elf32-sh.c:2712 elf32-sh.c:3088 +#, c-format +msgid "%s: 0x%lx: fatal: reloc overflow while relaxing" +msgstr "%s: 0x%lx: fatal: relocare depãºitã(overflow) în timpul relaxãrii" + +#: elf32-sh.c:4654 elf64-sh64.c:1585 +msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled" +msgstr "STO_SH5_ISA32 neaºteptat pe simbol local ce nu poate fi manipulat" + +#: elf32-sh.c:4809 +#, c-format +msgid "%s: unresolvable relocation against symbol `%s' from %s section" +msgstr "%s: relocare nerezolvabilã pe simbolul '%s' din secþiunea `%s'" + +#: elf32-sh.c:4881 +#, c-format +msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation" +msgstr "%s: 0x%lx: fatal: ramurã þintã nealiniatã pentru relocare cu suport de relaxare" + +#: elf32-sh.c:6627 elf64-alpha.c:4848 +#, c-format +msgid "%s: TLS local exec code cannot be linked into shared objects" +msgstr "%s: codul local executabil TLS nu poate fi linkuit în shared objects" + +#: elf32-sh64.c:221 elf64-sh64.c:2407 +#, c-format +msgid "%s: compiled as 32-bit object and %s is 64-bit" +msgstr "%s: compilat ca obiect pe 32-biþi ºi %s este pe 64-biþi" + +#: elf32-sh64.c:224 elf64-sh64.c:2410 +#, c-format +msgid "%s: compiled as 64-bit object and %s is 32-bit" +msgstr "%s: compilat ca obiect pe 64-biþi ºi %s este pe 32-biþi" + +#: elf32-sh64.c:226 elf64-sh64.c:2412 +#, c-format +msgid "%s: object size does not match that of target %s" +msgstr "%s: mãrimea obiectului nu se potriveºte cu cea a þintei %s" + +#: elf32-sh64.c:461 elf64-sh64.c:2990 +#, c-format +msgid "%s: encountered datalabel symbol in input" +msgstr "%s: s-a întâlnit un simbol etichetãdate(datalabel) în intrare(input)" + +#: elf32-sh64.c:544 +msgid "PTB mismatch: a SHmedia address (bit 0 == 1)" +msgstr "nepotrivire PTB: o adresã SHmedia (bit 0 == 1)" + +#: elf32-sh64.c:547 +msgid "PTA mismatch: a SHcompact address (bit 0 == 0)" +msgstr "nepotrivire PTA: o adresã SHcompact (bit 0 == 0)" + +#: elf32-sh64.c:565 +#, c-format +msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16" +msgstr "%s: eroare GASr: PTB insn neaºteptat cu R_SH_PT_16" + +#: elf32-sh64.c:614 elf64-sh64.c:1748 +#, c-format +msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n" +msgstr "%s: eroare: tip de reloare nealiniat %d la %08x relocarea %08x\n" + +#: elf32-sh64.c:698 +#, c-format +msgid "%s: could not write out added .cranges entries" +msgstr "%s: nu am putut scrie intrãrile .cranges adãugate" + +#: elf32-sh64.c:760 +#, c-format +msgid "%s: could not write out sorted .cranges entries" +msgstr "%s: nu am putut scrie intrãrile .cranges sortate" + +#: elf32-sparc.c:2521 elf64-sparc.c:2314 +#, c-format +msgid "%s: probably compiled without -fPIC?" +msgstr "%s: probabil compilat fãrã -fPIC?" + +#: elf32-sparc.c:3348 +#, c-format +msgid "%s: compiled for a 64 bit system and target is 32 bit" +msgstr "%s: compilat pentru un sistem 64 biþi ºi þinta fiind pe 32 biþi" + +#: elf32-sparc.c:3362 +#, c-format +msgid "%s: linking little endian files with big endian files" +msgstr "%s: linkuire fiºiere little endian files cu fiºiere big endian" + +#: elf32-v850.c:753 +#, c-format +msgid "Variable `%s' cannot occupy in multiple small data regions" +msgstr "Variabila `%s' nu poate ocupa regiuni multiple de date mici" + +#: elf32-v850.c:756 +#, c-format +msgid "Variable `%s' can only be in one of the small, zero, and tiny data regions" +msgstr "Variabila `%s' nu poate sã fie în una din regiunile mici, zero sau micuþe" + +#: elf32-v850.c:759 +#, c-format +msgid "Variable `%s' cannot be in both small and zero data regions simultaneously" +msgstr "Variabila `%s' nu poate fi simultan ºi în regiuni de date mici ºi de date zero" + +#: elf32-v850.c:762 +#, c-format +msgid "Variable `%s' cannot be in both small and tiny data regions simultaneously" +msgstr "Variabila `%s' nu poate fi simultan ºi în regiuni de date mici ºi de date micuþe" + +#: elf32-v850.c:765 +#, c-format +msgid "Variable `%s' cannot be in both zero and tiny data regions simultaneously" +msgstr "Variabila `%s' nu poate fi simultan ºi în regiuni de date zero ºi de date micuþe" + +#: elf32-v850.c:1144 +msgid "FAILED to find previous HI16 reloc\n" +msgstr "EªUARE în gãsirea relocãrii anterioare HI16\n" + +#: elf32-v850.c:1789 +msgid "could not locate special linker symbol __gp" +msgstr "nu am putut localiza simbolul special de linker __gp" + +#: elf32-v850.c:1793 +msgid "could not locate special linker symbol __ep" +msgstr "nu am putut localiza simbolul special de linker __ep" + +#: elf32-v850.c:1797 +msgid "could not locate special linker symbol __ctbp" +msgstr "nu am putut localiza simbolul special de linker __ctbp" + +#: elf32-v850.c:1963 +#, c-format +msgid "%s: Architecture mismatch with previous modules" +msgstr "%s: Arhitectura nu se potriveºte cu modulele anterioare" + +#: elf32-v850.c:1983 +#, c-format +msgid "private flags = %lx: " +msgstr "marcaje(flags) private=- %lx: " + +#: elf32-v850.c:1988 +msgid "v850 architecture" +msgstr "arhitecturã v850" + +#: elf32-v850.c:1989 +msgid "v850e architecture" +msgstr "arhitecturã v850e" + +#: elf32-vax.c:549 +msgid " [nonpic]" +msgstr " [nonpic]" + +#: elf32-vax.c:552 +msgid " [d-float]" +msgstr " [d-float]" + +#: elf32-vax.c:555 +msgid " [g-float]" +msgstr " [g-float]" + +#: elf32-vax.c:663 +#, c-format +msgid "%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of %ld" +msgstr "%s: avertisment: adãugarea GOT a %ld în `%s' nu se potriveºte adãugãrii GOT anterioare a %ld" + +#: elf32-vax.c:1667 +#, c-format +msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored" +msgstr "%s: avertisment: adãugarea PLT a %d în `%s' din secþiunea %s ignoratã" + +#: elf32-vax.c:1802 +#, c-format +msgid "%s: warning: %s relocation against symbol `%s' from %s section" +msgstr "%s: avertisment: relocare %s pentru simbolul `%s' din secþiunea %s" + +#: elf32-vax.c:1808 +#, c-format +msgid "%s: warning: %s relocation to 0x%x from %s section" +msgstr "%s: avertisment: relocare %s spre 0x%x din secþiunea %s" + +#: elf32-xstormy16.c:462 elf32-ia64.c:2450 elf64-ia64.c:2450 +msgid "non-zero addend in @fptr reloc" +msgstr "adãugare non-zero în relocare @fptr" + +#: elf64-alpha.c:1108 +msgid "GPDISP relocation did not find ldah and lda instructions" +msgstr "relocarea GPDISP nu a gãsit instrucþiuni ldah ºi lda" + +#: elf64-alpha.c:3731 +#, c-format +msgid "%s: .got subsegment exceeds 64K (size %d)" +msgstr "%s: .subsegmentul got depãseºte 64K (size %d)" + +#: elf64-alpha.c:4602 elf64-alpha.c:4614 +#, c-format +msgid "%s: gp-relative relocation against dynamic symbol %s" +msgstr "%s: relocare relativã-gp pentru simbolul %s" + +#: elf64-alpha.c:4640 elf64-alpha.c:4773 +#, c-format +msgid "%s: pc-relative relocation against dynamic symbol %s" +msgstr "%s: relocare relativã pc pentru simbolul dinamic %s" + +#: elf64-alpha.c:4668 +#, c-format +msgid "%s: change in gp: BRSGP %s" +msgstr "%s: schimbare în gp: BRSGP %s" + +#: elf64-alpha.c:4693 +msgid "" +msgstr "" + +#: elf64-alpha.c:4698 +#, c-format +msgid "%s: !samegp reloc against symbol without .prologue: %s" +msgstr "%s: !samegp reloc apentru simbol fãrã .prologue: %s" + +#: elf64-alpha.c:4749 +#, c-format +msgid "%s: unhandled dynamic relocation against %s" +msgstr "%s: relocare dinamicã nemanipulabilã pentru %s" + +#: elf64-alpha.c:4832 +#, c-format +msgid "%s: dtp-relative relocation against dynamic symbol %s" +msgstr "%s: relocare relativã-dtp pentru simbolul dinamic %s" + +#: elf64-alpha.c:4855 +#, c-format +msgid "%s: tp-relative relocation against dynamic symbol %s" +msgstr "%s: relocare relativã-tp pentru simbolul dinamic %s" + +#: elf64-hppa.c:2086 +#, c-format +msgid "stub entry for %s cannot load .plt, dp offset = %ld" +msgstr "intrarea trunchiatã pentru %s nu poate încãrca .plt, offset dp = %ld" + +#: elf64-mmix.c:1032 +#, c-format +msgid "" +"%s: Internal inconsistency error for value for\n" +" linker-allocated global register: linked: 0x%lx%08lx != relaxed: 0x%lx%08lx\n" +msgstr "" +"%s: eroare internã de inconsistenþã pentru valoarea\n" +"registrului global alocat de linker: linkuit: 0x%lx%08lx != relaxat: 0x%lx%08lx\n" + +#: elf64-mmix.c:1416 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: (unknown) in %s" +msgstr "%s:relocare-offset-bazã-plus pentru simbolul registru: (necunoscut) în %s" + +#: elf64-mmix.c:1421 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: %s in %s" +msgstr "%s:relocare-offset-bazã-plus pentru simbolul registru: %s în %s" + +#: elf64-mmix.c:1465 +#, c-format +msgid "%s: register relocation against non-register symbol: (unknown) in %s" +msgstr "%s:relocare registru pentru simbolul non-registru: (necunoscut) în %s" + +#: elf64-mmix.c:1470 +#, c-format +msgid "%s: register relocation against non-register symbol: %s in %s" +msgstr "%s:relocare registru pentru simbolul non-registru: %s în %s" + +#: elf64-mmix.c:1507 +#, c-format +msgid "%s: directive LOCAL valid only with a register or absolute value" +msgstr "%s: directiva LOCAL este validã doar cu un registru sau o valoare absolutã" + +#: elf64-mmix.c:1535 +#, c-format +msgid "%s: LOCAL directive: Register $%ld is not a local register. First global register is $%ld." +msgstr "%s: directivã LOCAL: Registrulr $%ld nu este un registru local. Primul registru global $%ld." + +#: elf64-mmix.c:1994 +#, c-format +msgid "%s: Error: multiple definition of `%s'; start of %s is set in a earlier linked file\n" +msgstr "%s: Eroare: definiþii multiple ale `%s'; începutul lui %s este setat într-un fiºierlinkuit anterior\n" + +#: elf64-mmix.c:2053 +msgid "Register section has contents\n" +msgstr "Secþiunea registru nu are conþinut\n" + +#: elf64-mmix.c:2216 +#, c-format +msgid "" +"Internal inconsistency: remaining %u != max %u.\n" +" Please report this bug." +msgstr "" +"Inconsistenþã internã: rãmâne %u ! = max %u\n" +" Vã rugãm raportaþi acest bug." + +#: elf64-ppc.c:2388 libbfd.c:831 +#, c-format +msgid "%s: compiled for a big endian system and target is little endian" +msgstr "%s: compilat pentru un sistem big endiat iar þinta este little endian" + +#: elf64-ppc.c:2391 libbfd.c:833 +#, c-format +msgid "%s: compiled for a little endian system and target is big endian" +msgstr "%s: compilat pentru un sistem little endiat iar þinta este big endian" + +#: elf64-ppc.c:4857 +#, c-format +msgid "%s: unexpected reloc type %u in .opd section" +msgstr "%s: tip de relocare neaºteptat %u în secþiune .opd" + +#: elf64-ppc.c:4877 +#, c-format +msgid "%s: .opd is not a regular array of opd entries" +msgstr "%s: .opd nu este un domeniu(array) de intrãri opd" + +#: elf64-ppc.c:4897 +#, c-format +msgid "%s: undefined sym `%s' in .opd section" +msgstr "%s: sym nedefinit `%s' în secþiune .opd" + +#: elf64-ppc.c:6136 +#, c-format +msgid "can't find branch stub `%s'" +msgstr "nu pot gãsi ramura trunchiatã `%s'" + +#: elf64-ppc.c:6175 elf64-ppc.c:6250 +#, c-format +msgid "linkage table error against `%s'" +msgstr "eroare tabel de linkuire pentru `%s'" + +#: elf64-ppc.c:6340 +#, c-format +msgid "can't build branch stub `%s'" +msgstr "nu se poate construi ramura trunchiatã `%s'" + +#: elf64-ppc.c:7047 +msgid ".glink and .plt too far apart" +msgstr ".glink ºi .plt prea departe unul de altul" + +#: elf64-ppc.c:7135 +msgid "stubs don't match calculated size" +msgstr "trunchierile(stubs) sunt în neconcordanþã cu mãrimea calculatã" + +#: elf64-ppc.c:7147 +#, c-format +msgid "" +"linker stubs in %u groups\n" +" branch %lu\n" +" toc adjust %lu\n" +" long branch %lu\n" +" long toc adj %lu\n" +" plt call %lu" +msgstr "" +"trunchieri(stubs) de linker în grupurile %u\n" +" ramurã %lu\n" +" ajustare toc %lu\n" +" ramurã lungã %lu\n" +" ajust. lungã toc %lu\n" +" apelare plt %lu" + +#: elf64-ppc.c:7723 +#, c-format +msgid "%s(%s+0x%lx): automatic multiple TOCs not supported using your crt files; recompile with -mminimal-toc or upgrade gcc" +msgstr "%s(%s+0x%lx): TOCuri multiple nu sunt suportateîn folosirea fiºierelor voastre crt; recompilaþi cu -mminimal-toc sau upgradaþi gcc" + +#: elf64-ppc.c:7731 +#, c-format +msgid "%s(%s+0x%lx): sibling call optimization to `%s' does not allow automatic multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, or make `%s' extern" +msgstr "%s(%s+0 x%lx): optimizare apelare sibling pentru `%s' nu permite automatTOCuri multiple; recompilaþi cu -mminimal-toc sau -fno-optimize-sibling-calls, sau faceþi(make) `%s' extern" + +#: elf64-ppc.c:8329 +#, c-format +msgid "%s: relocation %s is not supported for symbol %s." +msgstr "%s: relocarea %s nu este suportatã pentru simbolul %s." + +#: elf64-ppc.c:8408 +#, c-format +msgid "%s: error: relocation %s not a multiple of %d" +msgstr "%s: eroare: relocarea %s nu este multiplu de %d" + +#: elf64-sparc.c:1370 +#, c-format +msgid "%s: check_relocs: unhandled reloc type %d" +msgstr "%s: check_relocs: tip de relocare nemanipulabil %d" + +#: elf64-sparc.c:1407 +#, c-format +msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER" +msgstr "%s: Doar regiºtrii %%g[2367] pot fi declaraþi folosind STT_REGISTER" + +#: elf64-sparc.c:1427 +#, c-format +msgid "Register %%g%d used incompatibly: %s in %s, previously %s in %s" +msgstr "Registrul %%g%d a folosit incompatibilitãþi: %s în %s, anterior %s în %s" + +#: elf64-sparc.c:1450 +#, c-format +msgid "Symbol `%s' has differing types: REGISTER in %s, previously %s in %s" +msgstr "Simbolul `%s' are tipuri diferenþiate: REGISTER în %s, anterior %s în %s" + +#: elf64-sparc.c:1496 +#, c-format +msgid "Symbol `%s' has differing types: %s in %s, previously REGISTER in %s" +msgstr "Simbolul `%s' are tipuri diferenþiate: %s în %s, anterior REGISTER în %s" + +#: elf64-sparc.c:3053 +#, c-format +msgid "%s: linking UltraSPARC specific with HAL specific code" +msgstr "%s: linkuire cod specific UltraSPARC cu cod specific HAL" + +#: elf64-x86-64.c:739 +#, c-format +msgid "%s: %s' accessed both as normal and thread local symbol" +msgstr "%s: `%s' accesate ºi ca simboluri locale normale ºi ca simboluri locale pe fire (thread)" + +#: elfcode.h:1113 +#, c-format +msgid "%s: version count (%ld) does not match symbol count (%ld)" +msgstr "%s: numãrul versiunii(%ld) nu se potriveºte cu numãrul simbolului (%ld)" + +#: elfcode.h:1342 +#, c-format +msgid "%s(%s): relocation %d has invalid symbol index %ld" +msgstr "%s(%s): relocarea %d are indexul de simbol invalid %ld" + +#: elflink.c:1456 +#, c-format +msgid "%s: warning: unexpected redefinition of indirect versioned symbol `%s'" +msgstr "%s: avertisment: redefinire neaºteptatã a simbolului indirect cu versiune(versioned) `%s'" + +#: elflink.c:1807 +#, c-format +msgid "%s: undefined versioned symbol name %s" +msgstr "%s: nume de simbol versiune %s nedefinit" + +#: elflink.c:2142 +#, c-format +msgid "%s: relocation size mismatch in %s section %s" +msgstr "%s: nepotrivire a mãrimii de relocare în %s secþiunea %s" + +#: elflink.c:2434 +#, c-format +msgid "warning: type and size of dynamic symbol `%s' are not defined" +msgstr "avertisment: tipul ºi mãrimea simbolului dinamic `%s' nu sunt definite" + +#: elflink.h:1022 +#, c-format +msgid "%s: %s: invalid version %u (max %d)" +msgstr "%s: %s: versiune invalidã %u (max %d)" + +#: elflink.h:1063 +#, c-format +msgid "%s: %s: invalid needed version %d" +msgstr "%s: %s: versiune necesarã %d invalidã" + +#: elflink.h:1238 +#, c-format +msgid "Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s" +msgstr "Avertisment: alinierea %u al simbolului `%s' din %s este mai micã decât %u în %s" + +#: elflink.h:1252 +#, c-format +msgid "Warning: size of symbol `%s' changed from %lu in %s to %lu in %s" +msgstr "Avertisment: mãrimea simbolului `%s' a fost schimbatã din %lu din %s în %lu din %s" + +#: elflink.h:2160 +#, c-format +msgid "%s: undefined version: %s" +msgstr "%s:versiune %s nedefinitã" + +#: elflink.h:2226 +#, c-format +msgid "%s: .preinit_array section is not allowed in DSO" +msgstr "%s: secþiunea .preinit_array section nu este permisã în DSO" + +#: elflink.h:3078 +msgid "Not enough memory to sort relocations" +msgstr "Nu existã memorie suficientã pentru a sorta relocãrile" + +#: elflink.h:3958 elflink.h:4001 +#, c-format +msgid "%s: could not find output section %s" +msgstr "%s: nu s-a putut gãsi secþiunea de output %s" + +#: elflink.h:3964 +#, c-format +msgid "warning: %s section has zero size" +msgstr "avertisment: secþiunea %s are mãrime zero" + +#: elflink.h:4483 +#, c-format +msgid "%s: %s symbol `%s' in %s is referenced by DSO" +msgstr "%s: %s simbolul `%s' în %s este referit de DSO" + +#: elflink.h:4564 +#, c-format +msgid "%s: could not find output section %s for input section %s" +msgstr "%s: nu am putut gãsi secþiunea de output %s pentru secþiunea de input %s" + +#: elflink.h:4666 +#, c-format +msgid "%s: %s symbol `%s' isn't defined" +msgstr "%s: %s simbolul `%s' nu este definit" + +#: elflink.h:5053 elflink.h:5095 +msgid "%T: discarded in section `%s' from %s\n" +msgstr "%T: abandonat(discarded) în secþiunea `%s' din %s\n" + +#: elfxx-mips.c:887 +msgid "static procedure (no name)" +msgstr "procedurã staticã (fãrã nume)" + +#: elfxx-mips.c:1897 +msgid "not enough GOT space for local GOT entries" +msgstr "nu existã destul spaþiu GOT pentru intrãrile GOT locale" + +#: elfxx-mips.c:3691 +#, c-format +msgid "%s: %s+0x%lx: jump to stub routine which is not jal" +msgstr "%s: %s+0x%lx: salt la rutinã ciot(stub) ce nu este jal" + +#: elfxx-mips.c:5192 +#, c-format +msgid "%s: Malformed reloc detected for section %s" +msgstr "%s: Relocare malformatã detectatã pentru secþiunea %s" + +#: elfxx-mips.c:5266 +#, c-format +msgid "%s: CALL16 reloc at 0x%lx not against global symbol" +msgstr "%s: relocarea CALL16 la 0x%lx nu este pe simbolul global" + +#: elfxx-mips.c:8692 +#, c-format +msgid "%s: illegal section name `%s'" +msgstr "%s: nume ilegal de secþiune `%s'" + +#: elfxx-mips.c:9025 +#, c-format +msgid "%s: endianness incompatible with that of the selected emulation" +msgstr "%s: endianness incompatibilã cu aceea a emulaþiei selectate" + +#: elfxx-mips.c:9037 +#, c-format +msgid "%s: ABI is incompatible with that of the selected emulation" +msgstr "%s: ABI este incompatibil cu cel al emulaþiei selectate" + +#: elfxx-mips.c:9104 +#, c-format +msgid "%s: warning: linking PIC files with non-PIC files" +msgstr "%s: avertisment: linkuire de fiºiere PIC cu fiºiere non-PIC" + +#: elfxx-mips.c:9121 +#, c-format +msgid "%s: linking 32-bit code with 64-bit code" +msgstr "%s: linkuire cod 32-biþi cu cod 64-biþi" + +#: elfxx-mips.c:9149 +#, c-format +msgid "%s: linking %s module with previous %s modules" +msgstr "%s: linkuire a modulului %s cu modulele%s anterioare" + +#: elfxx-mips.c:9172 +#, c-format +msgid "%s: ABI mismatch: linking %s module with previous %s modules" +msgstr "%s: nepotrivire ABI: linkuire modul %s cu module %s anterioare" + +#: elfxx-mips.c:9241 +msgid " [abi=O32]" +msgstr " [abi=O32]" + +#: elfxx-mips.c:9243 +msgid " [abi=O64]" +msgstr " [abi=O64]" + +#: elfxx-mips.c:9245 +msgid " [abi=EABI32]" +msgstr " [abi=EABI32]" + +#: elfxx-mips.c:9247 +msgid " [abi=EABI64]" +msgstr " [abi=EABI64]" + +#: elfxx-mips.c:9249 +msgid " [abi unknown]" +msgstr " [abi necunoscut]" + +#: elfxx-mips.c:9251 +msgid " [abi=N32]" +msgstr " [abi=N32]" + +#: elfxx-mips.c:9253 +msgid " [abi=64]" +msgstr " [abi=64]" + +#: elfxx-mips.c:9255 +msgid " [no abi set]" +msgstr " [abi nesetat]" + +#: elfxx-mips.c:9258 +msgid " [mips1]" +msgstr " [mips1]" + +#: elfxx-mips.c:9260 +msgid " [mips2]" +msgstr " [mips2]" + +#: elfxx-mips.c:9262 +msgid " [mips3]" +msgstr " [mips3]" + +#: elfxx-mips.c:9264 +msgid " [mips4]" +msgstr " [mips4]" + +#: elfxx-mips.c:9266 +msgid " [mips5]" +msgstr " [mips5]" + +#: elfxx-mips.c:9268 +msgid " [mips32]" +msgstr " [mips32]" + +#: elfxx-mips.c:9270 +msgid " [mips64]" +msgstr " [mips64]" + +#: elfxx-mips.c:9272 +msgid " [mips32r2]" +msgstr " [mips32r2]" + +#: elfxx-mips.c:9274 +msgid " [unknown ISA]" +msgstr " [ISA necunoscut]" + +#: elfxx-mips.c:9277 +msgid " [mdmx]" +msgstr " [mdmx]" + +#: elfxx-mips.c:9280 +msgid " [mips16]" +msgstr " [mips16]" + +#: elfxx-mips.c:9283 +msgid " [32bitmode]" +msgstr " [mod32biþi]" + +#: elfxx-mips.c:9285 +msgid " [not 32bitmode]" +msgstr " [non-mod32biþi]" + +#: i386linux.c:457 m68klinux.c:461 sparclinux.c:458 +#, c-format +msgid "Output file requires shared library `%s'\n" +msgstr "Fiºierul de output necesitã biblioteca globalã(shared) `%s'\n" + +#: i386linux.c:465 m68klinux.c:469 sparclinux.c:466 +#, c-format +msgid "Output file requires shared library `%s.so.%s'\n" +msgstr "Fiºierul de output necesitã biblioteca globalã(shared) `%s'.so.`%s'\n" + +#: i386linux.c:654 i386linux.c:704 m68klinux.c:661 m68klinux.c:709 +#: sparclinux.c:656 sparclinux.c:706 +#, c-format +msgid "Symbol %s not defined for fixups\n" +msgstr "Simbolul %s nu este definit pentru acceptare(fixups)\n" + +#: i386linux.c:728 m68klinux.c:733 sparclinux.c:730 +msgid "Warning: fixup count mismatch\n" +msgstr "Avertisment: nepotrivire numãrãtori acceptare(fixup)\n" + +#: ieee.c:293 +#, c-format +msgid "%s: string too long (%d chars, max 65535)" +msgstr "%s: ºir prea lung (%d caractere, max 65535)" + +#: ieee.c:428 +#, c-format +msgid "%s: unrecognized symbol `%s' flags 0x%x" +msgstr "%s: simbol necunoscut `%s' marcaje(flags) 0x%x" + +#: ieee.c:938 +#, c-format +msgid "%s: unimplemented ATI record %u for symbol %u" +msgstr "%s: înregistrare ATI neimplementatã %u pe simbolul %u" + +#: ieee.c:963 +#, c-format +msgid "%s: unexpected ATN type %d in external part" +msgstr "%s: tip ATN neaºteptat %d în parte externã" + +#: ieee.c:985 +#, c-format +msgid "%s: unexpected type after ATN" +msgstr "%s: tip neaºteptat dupã ATN" + +#: ihex.c:264 +#, c-format +msgid "%s:%d: unexpected character `%s' in Intel Hex file\n" +msgstr "%s:%d: caracter neaºteptat `%s' în fiºier Intel Hex\n" + +#: ihex.c:372 +#, c-format +msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)" +msgstr "%s:%u: checksum invalid în fiºier Intel Hex (se aºtepta %u, s-a gãsit %u)" + +#: ihex.c:426 +#, c-format +msgid "%s:%u: bad extended address record length in Intel Hex file" +msgstr "%s: %u: mãrime înregistrare a adresei extinse invalidã în fiºier Intel Hex" + +#: ihex.c:443 +#, c-format +msgid "%s:%u: bad extended start address length in Intel Hex file" +msgstr "%s: %u: mãrime adresã de start extinsã invalidã în fiºier Intel Hex" + +#: ihex.c:460 +#, c-format +msgid "%s:%u: bad extended linear address record length in Intel Hex file" +msgstr "%s: %u: mãrime înregistrare a adresei lineare extinse invalidã în fiºier Intel Hex" + +#: ihex.c:477 +#, c-format +msgid "%s:%u: bad extended linear start address length in Intel Hex file" +msgstr "%s: %u: mãrime adresã linearã de start extinsã invalidã în fiºier Intel Hex" + +#: ihex.c:494 +#, c-format +msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n" +msgstr "%s: %u: tip ihex necunoscut %u în fiºier Intel Hex\n" + +#: ihex.c:619 +#, c-format +msgid "%s: internal error in ihex_read_section" +msgstr "%s: eroare internã în ihex_read_section" + +#: ihex.c:654 +#, c-format +msgid "%s: bad section length in ihex_read_section" +msgstr "%s: mãrime secþiune invalidã în ihex_read_section" + +#: ihex.c:872 +#, c-format +msgid "%s: address 0x%s out of range for Intel Hex file" +msgstr "%s: adresa 0x%s este în afara domeniului(range) pentru fiºierul Intel Hex" + +#: libbfd.c:861 +#, c-format +msgid "Deprecated %s called at %s line %d in %s\n" +msgstr "%s învechitã apelatã la %s linia %d în %s\n" + +#: libbfd.c:864 +#, c-format +msgid "Deprecated %s called\n" +msgstr "%s învechitã apelatã\n" + +#: linker.c:1829 +#, c-format +msgid "%s: indirect symbol `%s' to `%s' is a loop" +msgstr "%s: simbolul indirect `%s' pentru `%s' este o buclã" + +#: linker.c:2697 +#, c-format +msgid "Attempt to do relocatable link with %s input and %s output" +msgstr "Încercare de a crea un link relocabil cu input %s ºi output %s" + +#: merge.c:896 +#, c-format +msgid "%s: access beyond end of merged section (%ld + %ld)" +msgstr "%s: acces dincolo de sfârºitul secþiunii concatenate(merged) (%ld + %ld)" + +#: mmo.c:503 +#, c-format +msgid "%s: No core to allocate section name %s\n" +msgstr "%s:Nu existã nucleu(core) pentru a aloca numele de secþiune %s\n" + +#: mmo.c:579 +#, c-format +msgid "%s: No core to allocate a symbol %d bytes long\n" +msgstr "%s: Nu existã nucleu(core) pentru a aloca un simbol lung de %d octeþi\n" + +#: mmo.c:1287 +#, c-format +msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n" +msgstr "%s: fiºier mmo invalid: valoare de iniþializare pentru $255 nu este 'Main'\n" + +#: mmo.c:1433 +#, c-format +msgid "%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name starting with `%s'\n" +msgstr "%s: secvenþã mare(wide) de caractere 0x%02X 0x%02X nesuportatã dupã numele de simbol care începe cu `%s'\n" + +#: mmo.c:1674 +#, c-format +msgid "%s: invalid mmo file: unsupported lopcode `%d'\n" +msgstr "%s: fiºier mmo invalid: lopcode `%d' nesuportat\n" + +#: mmo.c:1684 +#, c-format +msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n" +msgstr "%s: fiºier mmo invalid: pentru lop_quote se aºtepta YZ = 1 s-a primit YZ= %d\n" + +#: mmo.c:1720 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n" +msgstr "%s: fiºier mmo invalid: pentru lop_loc se aºtepta z =1 sau z = 2 s-a primit z = %d\n" + +#: mmo.c:1766 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n" +msgstr "%s: fiºier mmo invalid: pentru lop_fixo se aºtepta z =1 sau z = 2 s-a primit z = %d\n" + +#: mmo.c:1805 +#, c-format +msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n" +msgstr "%s: fiºier mmo invalid: pentru lop_fixrx se aºtepta y =0 s-a primit y = %d\n" + +#: mmo.c:1814 +#, c-format +msgid "%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n" +msgstr "%s: fiºier mmo invalid: pentru lop_fixrx se aºtepta z =16 sau z = 24 s-a primit z = %d\n" + +#: mmo.c:1837 +#, c-format +msgid "%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d for lop_fixrx\n" +msgstr "%s: fiºier mmo invalid: pentru lop_fixrx octetul de înceout al operandului word trebuie sã fie 0 sau 1, s-a primit %d\n" + +#: mmo.c:1860 +#, c-format +msgid "%s: cannot allocate file name for file number %d, %d bytes\n" +msgstr "%s: nu se poate aloca nume fiºier pentru fiºierul numãrul %d, %d octeþi\n" + +#: mmo.c:1880 +#, c-format +msgid "%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n" +msgstr "%s: fiºier mmo invalid: fiºierul numãrul %d `%s' a fost deja introdus ca `%s'\n" + +#: mmo.c:1893 +#, c-format +msgid "%s: invalid mmo file: file name for number %d was not specified before use\n" +msgstr "%s: fiºier mmo invalid: numele de fiºier pentru numãrul %d nu a fost specificat înainte de folosire\n" + +#: mmo.c:1999 +#, c-format +msgid "%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n" +msgstr "%s: fiºier mmo invalid: câmpurile y ºi z ale lop_stab sunt non-zero: y: %d, z: %d\n" + +#: mmo.c:2035 +#, c-format +msgid "%s: invalid mmo file: lop_end not last item in file\n" +msgstr "%s: fiºier mmo invalid: lop_end nu este ultimul element în fiºier\n" + +#: mmo.c:2048 +#, c-format +msgid "%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras to the preceding lop_stab (%ld)\n" +msgstr "%s: fiºier mmo invalid: YZ al lop_end (%ld) nu este egal cu numerele tetras ale lop_stab precedent (%ld)\n" + +#: mmo.c:2698 +#, c-format +msgid "%s: invalid symbol table: duplicate symbol `%s'\n" +msgstr "%s: tabelã de simboluri invalidã: simbol `%s' duplicat\n" + +#: mmo.c:2949 +#, c-format +msgid "%s: Bad symbol definition: `Main' set to %s rather than the start address %s\n" +msgstr "%s: Definire invalidã de simbol: `Main' setat la %s în loc de adresa de start %s\n" + +#: mmo.c:3039 +#, c-format +msgid "%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: %d. Only `Main' will be emitted.\n" +msgstr "%s: avertisment: tabela de simboluri prea mare pentru mmo, mai mare decâd 65535 cuvinte pe 32 de biþi: %d. Doar 'Main' va fi emis.\n" + +#: mmo.c:3084 +#, c-format +msgid "%s: internal error, symbol table changed size from %d to %d words\n" +msgstr "%s: eroare internã, tabela de simboluri ºi-a schimbat mãrimea din %d în %d cuvinte\n" + +#: mmo.c:3139 +#, c-format +msgid "%s: internal error, internal register section %s had contents\n" +msgstr "%s: eroare internã, secþiunea de regiºtri internã %s nu are conþinut\n" + +#: mmo.c:3191 +#, c-format +msgid "%s: no initialized registers; section length 0\n" +msgstr "%s: nu existã regiºtri iniþializaþi; lungime secþiune 0\n" + +#: mmo.c:3197 +#, c-format +msgid "%s: too many initialized registers; section length %ld\n" +msgstr "%s: prea mulþi regiºtri iniþializaþi; lungime secþiune %ld\n" + +#: mmo.c:3202 +#, c-format +msgid "%s: invalid start address for initialized registers of length %ld: 0x%lx%08lx\n" +msgstr "%s: adresã de start invalidã pentru regiºtrii iniþializaþi de lungime %ld: 0x%lx%08lx\n" + +#: oasys.c:1052 +#, c-format +msgid "%s: can not represent section `%s' in oasys" +msgstr "%s: nu se poate reprezenta secþiune `%s' în oasys" + +#: osf-core.c:137 +#, c-format +msgid "Unhandled OSF/1 core file section type %d\n" +msgstr "Tip nemanipulabil %d de fiºier nucleu(core) OSF/1\n" + +#: pe-mips.c:659 +#, c-format +msgid "%s: `ld -r' not supported with PE MIPS objects\n" +msgstr "%s: `ld -r' nu este suportat cu obiecte PE MIPS\n" + +#. OK, at this point the following variables are set up: +#. src = VMA of the memory we're fixing up +#. mem = pointer to memory we're fixing up +#. val = VMA of what we need to refer to +#. +#: pe-mips.c:795 +#, c-format +msgid "%s: unimplemented %s\n" +msgstr "%s: %s neimplementat\n" + +#: pe-mips.c:821 +#, c-format +msgid "%s: jump too far away\n" +msgstr "%s: salt prea departe(far away)\n" + +#: pe-mips.c:848 +#, c-format +msgid "%s: bad pair/reflo after refhi\n" +msgstr "%s: pair/reflo invalid dupã refhi\n" + +#. XXX code yet to be written. +#: peicode.h:787 +#, c-format +msgid "%s: Unhandled import type; %x" +msgstr "%s: Tip import nemanipulabil; %x" + +#: peicode.h:792 +#, c-format +msgid "%s: Unrecognised import type; %x" +msgstr "%s: Tip import necunoscut; %x" + +#: peicode.h:806 +#, c-format +msgid "%s: Unrecognised import name type; %x" +msgstr "%s: Tip nume import necunoscut; %x" + +#: peicode.h:1164 +#, c-format +msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive" +msgstr "%s: Tip maºinã necunoscut (0x%x) în arhiva Import Library Format" + +#: peicode.h:1176 +#, c-format +msgid "%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive" +msgstr "%s: Tip de maºinã recunoscut dar nemanipulabil (0x%x) în arhiva Import Library Format" + +#: peicode.h:1193 +#, c-format +msgid "%s: size field is zero in Import Library Format header" +msgstr "%s: mãrimea câmpului din headerul Import Library Format este zero" + +#: peicode.h:1224 +#, c-format +msgid "%s: string not null terminated in ILF object file." +msgstr "%s: ºirul nenul terminat în fiºier obiect ILF." + +#: ppcboot.c:416 +msgid "" +"\n" +"ppcboot header:\n" +msgstr "" +"\n" +"header ppcboot:\n" + +#: ppcboot.c:417 +#, c-format +msgid "Entry offset = 0x%.8lx (%ld)\n" +msgstr "Offset intrare = 0x%.8lx (%ld)\n" + +#: ppcboot.c:418 +#, c-format +msgid "Length = 0x%.8lx (%ld)\n" +msgstr "Lungime = 0x%.8lx (%ld)\n" + +#: ppcboot.c:421 +#, c-format +msgid "Flag field = 0x%.2x\n" +msgstr "Câmp Marcaj(Flag) = 0x%.2x\n" + +#: ppcboot.c:427 +#, c-format +msgid "Partition name = \"%s\"\n" +msgstr "Nume Partiþie = \"%s\"\n" + +#: ppcboot.c:446 +#, c-format +msgid "" +"\n" +"Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "" +"\n" +"Start Partiþie[%d] = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:452 +#, c-format +msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "Sfârºit Partiþie[%d] = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:458 +#, c-format +msgid "Partition[%d] sector = 0x%.8lx (%ld)\n" +msgstr "Sector Partiþie[%d] sector = 0x%.8lx (%ld)\n" + +#: ppcboot.c:459 +#, c-format +msgid "Partition[%d] length = 0x%.8lx (%ld)\n" +msgstr "Mãrime Partiþie[%d] = 0x%.8lx (%ld)\n" + +#: som.c:5422 +msgid "som_sizeof_headers unimplemented" +msgstr "som_sizeof_headers neimplementatã" + +#: srec.c:302 +#, c-format +msgid "%s:%d: Unexpected character `%s' in S-record file\n" +msgstr "%s:%d: Caracter neaºteptat `%s'în fiºier S-record\n" + +#: stabs.c:319 +#, c-format +msgid "%s(%s+0x%lx): Stabs entry has invalid string index." +msgstr "%s(%s+0x%lx): Intrarea bruscã(stab) are index ºir invalid." + +#: syms.c:1019 +msgid "Unsupported .stab relocation" +msgstr "Relocare .stab nesuportatã" + +#: vms-gsd.c:356 +#, c-format +msgid "bfd_make_section (%s) failed" +msgstr "bfd_make_section (%s) eºuatã" + +#: vms-gsd.c:371 +#, c-format +msgid "bfd_set_section_flags (%s, %x) failed" +msgstr "bfd_set_section_flags (%s, %x) eºuatã" + +#: vms-gsd.c:407 +#, c-format +msgid "Size mismatch section %s=%lx, %s=%lx" +msgstr "Mãrime nepotrivitã secþiune %s=%lx, %s=%lx" + +#: vms-gsd.c:704 +#, c-format +msgid "unknown gsd/egsd subtype %d" +msgstr "subtip %d gsd/egsd necunoscut" + +#: vms-hdr.c:408 +msgid "Object module NOT error-free !\n" +msgstr "Modul obiect CU erori !\n" + +#: vms-misc.c:541 +#, c-format +msgid "Stack overflow (%d) in _bfd_vms_push" +msgstr "Depãºire(overflow) de stivã(%d) în bfd_vms_push" + +#: vms-misc.c:559 +msgid "Stack underflow in _bfd_vms_pop" +msgstr "Subfolosire(underflow) a stivei _bfd_vms_pop" + +#: vms-misc.c:918 +msgid "_bfd_vms_output_counted called with zero bytes" +msgstr "_bfd_vms_output_counted apelat cu zero octeþi" + +#: vms-misc.c:923 +msgid "_bfd_vms_output_counted called with too many bytes" +msgstr "_bfd_vms_output_counted apelat cu prea mulþi octeþi" + +#: vms-misc.c:1054 +#, c-format +msgid "Symbol %s replaced by %s\n" +msgstr "Simbolul %s înlocuit de %s\n" + +#: vms-misc.c:1117 +#, c-format +msgid "failed to enter %s" +msgstr "Eºec în introducerea %s" + +#: vms-tir.c:102 +msgid "No Mem !" +msgstr "Nu mai existã Mem !" + +#: vms-tir.c:383 +#, c-format +msgid "bad section index in %s" +msgstr "index de secþiune invalid în %s" + +#: vms-tir.c:396 +#, c-format +msgid "unsupported STA cmd %s" +msgstr "cmd STA %s nesuportatã" + +#: vms-tir.c:401 vms-tir.c:1261 +#, c-format +msgid "reserved STA cmd %d" +msgstr "cmd STA %d rezervatã" + +#: vms-tir.c:512 vms-tir.c:535 +#, c-format +msgid "%s: no symbol \"%s\"" +msgstr "%s: nu existã simbolul \"%s\"" + +#. unsigned shift +#. rotate +#. Redefine symbol to current location. +#. Define a literal. +#: vms-tir.c:602 vms-tir.c:714 vms-tir.c:824 vms-tir.c:842 vms-tir.c:850 +#: vms-tir.c:859 vms-tir.c:1584 +#, c-format +msgid "%s: not supported" +msgstr "%s: nesuportat" + +#: vms-tir.c:607 vms-tir.c:1439 +#, c-format +msgid "%s: not implemented" +msgstr "%s: neimplementat" + +#: vms-tir.c:611 vms-tir.c:1443 +#, c-format +msgid "reserved STO cmd %d" +msgstr "cmd STO %d rezervatã" + +#: vms-tir.c:729 vms-tir.c:1589 +#, c-format +msgid "reserved OPR cmd %d" +msgstr "cmd OPR %d rezervatã" + +#: vms-tir.c:797 vms-tir.c:1653 +#, c-format +msgid "reserved CTL cmd %d" +msgstr "cmd CTL %d rezervatã" + +#. stack byte from image +#. arg: none. +#: vms-tir.c:1169 +msgid "stack-from-image not implemented" +msgstr "stack-from-image neimplementatã" + +#: vms-tir.c:1187 +msgid "stack-entry-mask not fully implemented" +msgstr "stack-entry-mask neimplementatã complet" + +#. compare procedure argument +#. arg: cs symbol name +#. by argument index +#. da argument descriptor +#. +#. compare argument descriptor with symbol argument (ARG$V_PASSMECH) +#. and stack TRUE (args match) or FALSE (args dont match) value. +#: vms-tir.c:1201 +msgid "PASSMECH not fully implemented" +msgstr "PASSMECH neimplementatã complet" + +#: vms-tir.c:1220 +msgid "stack-local-symbol not fully implemented" +msgstr "stack-local-symbol neimplementatã complet" + +#: vms-tir.c:1233 +msgid "stack-literal not fully implemented" +msgstr "stack-literal neimplementatã complet" + +#: vms-tir.c:1254 +msgid "stack-local-symbol-entry-point-mask not fully implemented" +msgstr "stack-local-symbol-entry-point-mask neimplementatã complet" + +#: vms-tir.c:1531 vms-tir.c:1543 vms-tir.c:1555 vms-tir.c:1567 vms-tir.c:1632 +#: vms-tir.c:1640 vms-tir.c:1648 +#, c-format +msgid "%s: not fully implemented" +msgstr "%s: neimplementatã complet" + +#: vms-tir.c:1705 +#, c-format +msgid "obj code %d not found" +msgstr "codul abj %d nu a fost gãsit" + +#: vms-tir.c:2043 +#, c-format +msgid "SEC_RELOC with no relocs in section %s" +msgstr "SEC_RELOC fãrã relocãri în secþiunea %s" + +#: vms-tir.c:2331 +#, c-format +msgid "Unhandled relocation %s" +msgstr "Relocare nemanipulabilã %s" + +#: xcofflink.c:1244 +#, c-format +msgid "%s: `%s' has line numbers but no enclosing section" +msgstr "%s: `%s' are numere de linii dar nici o secþiune de închidere" + +#: xcofflink.c:1297 +#, c-format +msgid "%s: class %d symbol `%s' has no aux entries" +msgstr "%s: clasa %d simbolul `%s' nu are intrãri aux" + +#: xcofflink.c:1320 +#, c-format +msgid "%s: symbol `%s' has unrecognized csect type %d" +msgstr "%s: simbolul `%s' are tip necunoscut csect %d" + +#: xcofflink.c:1332 +#, c-format +msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d" +msgstr "%s: simbol XTY_ER invalid `%s': clasa %d scnum %d scnlen %d" + +#: xcofflink.c:1368 +#, c-format +msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d" +msgstr "%s: simblul XMC_TC0 `%s' este clasa %d scnlen %d" + +#: xcofflink.c:1520 +#, c-format +msgid "%s: csect `%s' not in enclosing section" +msgstr "%s: csect `%s' nu este în secþiunea de închidere" + +#: xcofflink.c:1627 +#, c-format +msgid "%s: misplaced XTY_LD `%s'" +msgstr "%s:XTY_LD `%s' rãtãcit" + +#: xcofflink.c:1958 +#, c-format +msgid "%s: reloc %s:%d not in csect" +msgstr "%s: relocarea %s:%d nu este în csect" + +#: xcofflink.c:2095 +#, c-format +msgid "%s: XCOFF shared object when not producing XCOFF output" +msgstr "%s: XCOFF shared object neproducând output XCOFF" + +#: xcofflink.c:2116 +#, c-format +msgid "%s: dynamic object with no .loader section" +msgstr "%s: obiect dinamic fãrã secþiune .loader" + +#: xcofflink.c:2761 +#, c-format +msgid "%s: no such symbol" +msgstr "%s: nu existã acest simbol" + +#: xcofflink.c:2894 +msgid "error: undefined symbol __rtinit" +msgstr "eroare: simbol __rtinit nedefinit" + +#: xcofflink.c:3455 +#, c-format +msgid "warning: attempt to export undefined symbol `%s'" +msgstr "avertisment: încercare de exportare a simbolului nedefinit `%s'" + +#: xcofflink.c:4448 +#, c-format +msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling" +msgstr "suprasolicitare(overflow) TOC: 0x%lx > 0x10000; încercaþi -mminimal-toc la compilare" + +#: xcofflink.c:5288 xcofflink.c:5755 xcofflink.c:5817 xcofflink.c:6119 +#, c-format +msgid "%s: loader reloc in unrecognized section `%s'" +msgstr "%s: relocare loader în secþiune necunoscutã `%s'" + +#: xcofflink.c:5310 xcofflink.c:6130 +#, c-format +msgid "%s: `%s' in loader reloc but not loader sym" +msgstr "%s: `%s' în relocare loader dar nu în loader sym" + +#: xcofflink.c:5325 +#, c-format +msgid "%s: loader reloc in read-only section %s" +msgstr "%s: relocare loader în secþiunea doar-în-citire %s" + +#: elf32-ia64.c:2392 elf64-ia64.c:2392 +msgid "@pltoff reloc against local symbol" +msgstr "relocare @pltoff pe simbol local" + +#: elf32-ia64.c:3804 elf64-ia64.c:3804 +#, c-format +msgid "%s: short data segment overflowed (0x%lx >= 0x400000)" +msgstr "%s: segment de date scurt depãºit(overflowed) (0x%lx >= 0x400000)" + +#: elf32-ia64.c:3815 elf64-ia64.c:3815 +#, c-format +msgid "%s: __gp does not cover short data segment" +msgstr "%s: __gp nu acoperã segmentul de date scurte" + +#: elf32-ia64.c:4131 elf64-ia64.c:4131 +#, c-format +msgid "%s: linking non-pic code in a shared library" +msgstr "%s: linkuire cod non-pic într-o bibliotecã globalã(shared)" + +#: elf32-ia64.c:4164 elf64-ia64.c:4164 +#, c-format +msgid "%s: @gprel relocation against dynamic symbol %s" +msgstr "%s: relocare @gprel pe simbolul dinamic %s" + +#: elf32-ia64.c:4224 elf64-ia64.c:4224 +#, c-format +msgid "%s: linking non-pic code in a position independent executable" +msgstr "%s: linkuire cod non-pic într-un executabil independent de poziþie" + +#: elf32-ia64.c:4363 elf64-ia64.c:4363 +#, c-format +msgid "%s: @internal branch to dynamic symbol %s" +msgstr "%s: ramurã @internal cãtre simbolul dinamic %s" + +#: elf32-ia64.c:4365 elf64-ia64.c:4365 +#, c-format +msgid "%s: speculation fixup to dynamic symbol %s" +msgstr "%s: rezolvare de speculaþie cãtre simbolul dinamic %s" + +#: elf32-ia64.c:4367 elf64-ia64.c:4367 +#, c-format +msgid "%s: @pcrel relocation against dynamic symbol %s" +msgstr "%s: relocare @pcrell pe simbolul dinamic %s" + +#: elf32-ia64.c:4579 elf64-ia64.c:4579 +msgid "unsupported reloc" +msgstr "relocare nesuportatã" + +#: elf32-ia64.c:4858 elf64-ia64.c:4858 +#, c-format +msgid "%s: linking trap-on-NULL-dereference with non-trapping files" +msgstr "%s: linkuire trap-on-NULL-dereference cu fiºiere non-trapping" + +#: elf32-ia64.c:4867 elf64-ia64.c:4867 +#, c-format +msgid "%s: linking big-endian files with little-endian files" +msgstr "%s: linkuire fiºiere big-endiancu fiºiere little-endian" + +#: elf32-ia64.c:4876 elf64-ia64.c:4876 +#, c-format +msgid "%s: linking 64-bit files with 32-bit files" +msgstr "%s: linkuire fiºiere pe 64-biþi cu fiºiere pe 32-biþi" + +#: elf32-ia64.c:4885 elf64-ia64.c:4885 +#, c-format +msgid "%s: linking constant-gp files with non-constant-gp files" +msgstr "%s: linkuire fiºiere constant-gp cu fiºiere non-constant-gp" + +#: elf32-ia64.c:4895 elf64-ia64.c:4895 +#, c-format +msgid "%s: linking auto-pic files with non-auto-pic files" +msgstr "%s: linkuire fiºiere auto-pic cu fiºiere non-auto-pic" + +#: peigen.c:985 pepigen.c:985 +#, c-format +msgid "%s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: depãºire(overflow) numãr linii: 0x%lx > 0xffff" + +#: peigen.c:1002 pepigen.c:1002 +#, c-format +msgid "%s: reloc overflow 1: 0x%lx > 0xffff" +msgstr "%s: depãºire(overflow) relocare 1: 0x%lx > 0xffff" + +#: peigen.c:1016 pepigen.c:1016 +msgid "Export Directory [.edata (or where ever we found it)]" +msgstr "Director Exportare [.edata (sau oriunde se gãseºte)]" + +#: peigen.c:1017 pepigen.c:1017 +msgid "Import Directory [parts of .idata]" +msgstr "Director Importare [ pãrþi ale .idata]" + +#: peigen.c:1018 pepigen.c:1018 +msgid "Resource Directory [.rsrc]" +msgstr "Director Resursã [.rsrc]" + +#: peigen.c:1019 pepigen.c:1019 +msgid "Exception Directory [.pdata]" +msgstr "Director Excepþie [.pdata]" + +#: peigen.c:1020 pepigen.c:1020 +msgid "Security Directory" +msgstr "Director Securitate" + +#: peigen.c:1021 pepigen.c:1021 +msgid "Base Relocation Directory [.reloc]" +msgstr "Director Relocare de Bazã [.reloc]" + +#: peigen.c:1022 pepigen.c:1022 +msgid "Debug Directory" +msgstr "Director Debug" + +#: peigen.c:1023 pepigen.c:1023 +msgid "Description Directory" +msgstr "Director Descriere" + +#: peigen.c:1024 pepigen.c:1024 +msgid "Special Directory" +msgstr "Director Special" + +#: peigen.c:1025 pepigen.c:1025 +msgid "Thread Storage Directory [.tls]" +msgstr "Director Depozitare Fire(Thread) [.tls]" + +#: peigen.c:1026 pepigen.c:1026 +msgid "Load Configuration Directory" +msgstr "Director Încãrcare Configuraþie" + +#: peigen.c:1027 pepigen.c:1027 +msgid "Bound Import Directory" +msgstr "Director Importare de Graniþã(Bound)" + +#: peigen.c:1028 pepigen.c:1028 +msgid "Import Address Table Directory" +msgstr "Director Importare Tabelã de Adrese" + +#: peigen.c:1029 pepigen.c:1029 +msgid "Delay Import Directory" +msgstr "Director Importare Întârziere" + +#: peigen.c:1030 peigen.c:1031 pepigen.c:1030 pepigen.c:1031 +msgid "Reserved" +msgstr "Rezervat" + +#: peigen.c:1094 pepigen.c:1094 +msgid "" +"\n" +"There is an import table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Existã o tabelã de importare, dar secþiunea care o conþine n-a putut fi gãsitã\n" + +#: peigen.c:1099 pepigen.c:1099 +#, c-format +msgid "" +"\n" +"There is an import table in %s at 0x%lx\n" +msgstr "" +"\n" +"Existã o tabelã de importare în %s la 0x%lx\n" + +#: peigen.c:1136 pepigen.c:1136 +#, c-format +msgid "" +"\n" +"Function descriptor located at the start address: %04lx\n" +msgstr "" +"\n" +"Descriptorul de funcþie localizat la adresa de start: %04lx\n" + +#: peigen.c:1139 pepigen.c:1139 +#, c-format +msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n" +msgstr "\tcode-base %08lx toc (încãrcabil/actual) %08lx/%08lx\n" + +#: peigen.c:1145 pepigen.c:1145 +msgid "" +"\n" +"No reldata section! Function descriptor not decoded.\n" +msgstr "" +"\n" +"Nu existã secþiune reldata! Descriptorul de funcþie nu este decodat.\n" + +#: peigen.c:1150 pepigen.c:1150 +#, c-format +msgid "" +"\n" +"The Import Tables (interpreted %s section contents)\n" +msgstr "" +"\n" +"Tabelele de Importare (interpretat conþinutul secþiunii %s)\n" + +#: peigen.c:1153 pepigen.c:1153 +msgid "" +" vma: Hint Time Forward DLL First\n" +" Table Stamp Chain Name Thunk\n" +msgstr "" +" vma: Sugestie Timp Înaintare DLL Primul\n" +" Tabel Marcaj Lanþ Nume Thunk\n" + +#: peigen.c:1204 pepigen.c:1204 +#, c-format +msgid "" +"\n" +"\tDLL Name: %s\n" +msgstr "" +"\n" +"\tNume DLL: %s\n" + +#: peigen.c:1215 pepigen.c:1215 +msgid "\tvma: Hint/Ord Member-Name Bound-To\n" +msgstr "\tvma: Sugestie/Ord Membru-Nume Salt-La\n" + +#: peigen.c:1240 pepigen.c:1240 +msgid "" +"\n" +"There is a first thunk, but the section containing it could not be found\n" +msgstr "" +"\n" +"Existã un prim thunk, dar secþiunea care îl conþine nu poate fi gãsitã\n" + +#: peigen.c:1380 pepigen.c:1380 +msgid "" +"\n" +"There is an export table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Existã o tabelã de export, dar secþiunea ce o conþine nu poate fi gãsitã\n" + +#: peigen.c:1385 pepigen.c:1385 +#, c-format +msgid "" +"\n" +"There is an export table in %s at 0x%lx\n" +msgstr "" +"\n" +"Existã o tabelã de exportare în %s la 0x%lx\n" + +#: peigen.c:1416 pepigen.c:1416 +#, c-format +msgid "" +"\n" +"The Export Tables (interpreted %s section contents)\n" +"\n" +msgstr "" +"\n" +"Tabelele de Exportare (interpretare conþinut secþiune %s)\n" +"\n" + +#: peigen.c:1420 pepigen.c:1420 +#, c-format +msgid "Export Flags \t\t\t%lx\n" +msgstr "Marcaje(Flags) Exportare \t\t\t%lx\n" + +#: peigen.c:1423 pepigen.c:1423 +#, c-format +msgid "Time/Date stamp \t\t%lx\n" +msgstr "Marcaj(stamp) Orã/Datã \t\t%lx\n" + +#: peigen.c:1426 pepigen.c:1426 +#, c-format +msgid "Major/Minor \t\t\t%d/%d\n" +msgstr "Major/Minor \t\t\t%d/%d\n" + +#: peigen.c:1429 pepigen.c:1429 +msgid "Name \t\t\t\t" +msgstr "Nume \t\t\t\t" + +#: peigen.c:1435 pepigen.c:1435 +#, c-format +msgid "Ordinal Base \t\t\t%ld\n" +msgstr "Bazã Ordinalã \t\t\t%ld\n" + +#: peigen.c:1438 pepigen.c:1438 +msgid "Number in:\n" +msgstr "Numãr în:\n" + +#: peigen.c:1441 pepigen.c:1441 +#, c-format +msgid "\tExport Address Table \t\t%08lx\n" +msgstr "\t Tabelã Exportare Adrese \t\t%08lx\n" + +#: peigen.c:1445 pepigen.c:1445 +#, c-format +msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n" +msgstr "\tTabelã [Nume Pointer/Ordinal]\t%08lx\n" + +#: peigen.c:1448 pepigen.c:1448 +msgid "Table Addresses\n" +msgstr "Adrese Tabelã\n" + +#: peigen.c:1451 pepigen.c:1451 +msgid "\tExport Address Table \t\t" +msgstr "\tTabelã Exportare de Adrese \t\t" + +#: peigen.c:1456 pepigen.c:1456 +msgid "\tName Pointer Table \t\t" +msgstr "\tNume Pointer Tabelã \t\t" + +#: peigen.c:1461 pepigen.c:1461 +msgid "\tOrdinal Table \t\t\t" +msgstr "\tOrdinal Tabelã \t\t\t" + +#: peigen.c:1476 pepigen.c:1476 +#, c-format +msgid "" +"\n" +"Export Address Table -- Ordinal Base %ld\n" +msgstr "" +"\n" +"Tabelã Exportare de Adrese -- Bazã Ordinalã %ld\n" + +#: peigen.c:1495 pepigen.c:1495 +msgid "Forwarder RVA" +msgstr "Trimiþãtor(Forwarder) RVA" + +#: peigen.c:1506 pepigen.c:1506 +msgid "Export RVA" +msgstr "Exportare RVA" + +#: peigen.c:1513 pepigen.c:1513 +msgid "" +"\n" +"[Ordinal/Name Pointer] Table\n" +msgstr "" +"\n" +"[Ordinal/Nume Pointer] Tabelã\n" + +#: peigen.c:1568 pepigen.c:1568 +#, c-format +msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n" +msgstr "Avertisment, mãrimea secþiunii .pdata (%ld) nu este multiplu de %d\n" + +#: peigen.c:1572 pepigen.c:1572 +msgid "" +"\n" +"The Function Table (interpreted .pdata section contents)\n" +msgstr "" +"\n" +"Tabela de Funcþii (interpretare conþinut secþiune .pdata)\n" + +#: peigen.c:1575 pepigen.c:1575 +msgid " vma:\t\t\tBegin Address End Address Unwind Info\n" +msgstr " vma:\t\t\tAdresã Început Adresã Sfârºit Info Unwind\n" + +#: peigen.c:1577 pepigen.c:1577 +msgid "" +" vma:\t\tBegin End EH EH PrologEnd Exception\n" +" \t\tAddress Address Handler Data Address Mask\n" +msgstr "" +" vma:\t\tÎnceput Sfârºit EH EH PrologSfârºit Excepþii\n" +" \t\tAdresã Adresã Manipulant Date Adresã Mascã\n" + +#: peigen.c:1647 pepigen.c:1647 +msgid " Register save millicode" +msgstr " Registrul salveazã millicode " + +#: peigen.c:1650 pepigen.c:1650 +msgid " Register restore millicode" +msgstr "Registrul reface millicode" + +#: peigen.c:1653 pepigen.c:1653 +msgid " Glue code sequence" +msgstr "Secvenþã de cod lipitã(glue)" + +#: peigen.c:1705 pepigen.c:1705 +msgid "" +"\n" +"\n" +"PE File Base Relocations (interpreted .reloc section contents)\n" +msgstr "" +"\n" +"\n" +"Relocãri Bazã Fiºier PE (interpretare conþinut secþiune .reloc)\n" + +#: peigen.c:1735 pepigen.c:1735 +#, c-format +msgid "" +"\n" +"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n" +msgstr "" +"\n" +"Adresã Virtualã: %08lx Mãrime Trunchiere %ld (0x%lx) Numãr acceptãri %ld\n" + +#: peigen.c:1748 pepigen.c:1748 +#, c-format +msgid "\treloc %4d offset %4x [%4lx] %s" +msgstr "\trelocarea %4d offset %4x [%4lx] %s" + +#. The MS dumpbin program reportedly ands with 0xff0f before +#. printing the characteristics field. Not sure why. No reason to +#. emulate it here. +#: peigen.c:1788 pepigen.c:1788 +#, c-format +msgid "" +"\n" +"Characteristics 0x%x\n" +msgstr "" +"\n" +"Caracteristici 0x%x\n" + +#~ msgid "%s: Unknown special linker type %d" +#~ msgstr "%s: Tip special necunoscut de linker %d" + +#~ msgid "v850ea architecture" +#~ msgstr "arhitecturã v850ea" + +#~ msgid "%s: Section %s is too large to add hole of %ld bytes" +#~ msgstr "%s: Secþiunea %s este prea mare pentru a adãuga o gaurã de %ld octeþi" + +#~ msgid "Error: out of memory" +#~ msgstr "Eroare: memorie plinã" + +#~ msgid "warning: relocation against removed section; zeroing" +#~ msgstr "avertisment: relocare pe secþiune eliminatã; se umple cu zero(zeroing)" + +#~ msgid "warning: relocation against removed section" +#~ msgstr "avertisment: relocare pe secþiune eliminatã" + +#~ msgid "local symbols in discarded section %s" +#~ msgstr "simboluri locale în secþiunea îndepãrtatã(discarded) %s" + +#~ msgid "%s: linking abicalls files with non-abicalls files" +#~ msgstr "%s: linkuire fiºiere abicalls cu fiºiere non-abicalls" + +#~ msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)" +#~ msgstr "%s: nepotrivire ISA (-mips%d) cu modulele anterioare (-mips%d)" + +#~ msgid "%s: ISA mismatch (%d) with previous modules (%d)" +#~ msgstr "%s: nepotrivire ISA (%d) cu modulele anterioare (%d)" + +#~ msgid "%s: dynamic relocation against speculation fixup" +#~ msgstr "%s: relocare dinamicã pe acceptare(fixup) speculativã" + +#~ msgid "%s: speculation fixup against undefined weak symbol" +#~ msgstr "%s: speculaþie acceptare(fixup) pe simbol ambiguu(weak) nedefinit" diff --git a/bfd/po/sv.gmo b/bfd/po/sv.gmo new file mode 100644 index 0000000000000..e746ec02e7563 Binary files /dev/null and b/bfd/po/sv.gmo differ diff --git a/bfd/po/sv.po b/bfd/po/sv.po new file mode 100644 index 0000000000000..e0b667cb4b4ea --- /dev/null +++ b/bfd/po/sv.po @@ -0,0 +1,3221 @@ +# Swedish messages for bfd. +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Christian Rose , 2001, 2002, 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: bfd 2.14rel030712\n" +"POT-Creation-Date: 2003-07-11 13:53+0930\n" +"PO-Revision-Date: 2003-08-14 22:40+0200\n" +"Last-Translator: Christian Rose \n" +"Language-Team: Swedish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: aout-adobe.c:204 +#, c-format +msgid "%s: Unknown section type in a.out.adobe file: %x\n" +msgstr "%s: Okänd sektionstyp i a.out.adobe-fil: %x\n" + +#: aout-cris.c:207 +#, c-format +msgid "%s: Invalid relocation type exported: %d" +msgstr "%s: Ogiltig omlokaliseringstyp exporterad: %d" + +#: aout-cris.c:251 +#, c-format +msgid "%s: Invalid relocation type imported: %d" +msgstr "%s: Ogiltig omlokaliseringstyp importerad: %d" + +#: aout-cris.c:262 +#, c-format +msgid "%s: Bad relocation record imported: %d" +msgstr "%s: Felaktig omlokaliseringstyp importerad: %d" + +#: aoutx.h:1295 aoutx.h:1716 +#, c-format +msgid "%s: can not represent section `%s' in a.out object file format" +msgstr "%s: kan inte representera sektionen \"%s\" i a.out-objektfilformat" + +#: aoutx.h:1682 +#, c-format +msgid "%s: can not represent section for symbol `%s' in a.out object file format" +msgstr "%s: kan inte representera sektion för symbolen \"%s\" i a.out-objektfilformat" + +#: aoutx.h:1684 +msgid "*unknown*" +msgstr "*okänd*" + +#: aoutx.h:3776 +#, c-format +msgid "%s: relocatable link from %s to %s not supported" +msgstr "%s: omlokaliseringsbar länk från %s till %s stöds inte" + +#: archive.c:1751 +msgid "Warning: writing archive was slow: rewriting timestamp\n" +msgstr "Varning: arkivskrivning var långsam: skriver om tidsstämpel\n" + +#: archive.c:2014 +msgid "Reading archive file mod timestamp" +msgstr "Läser arkivfilens modifieringstidsstämpel" + +#: archive.c:2040 +msgid "Writing updated armap timestamp" +msgstr "Skriver uppdaterad armap-tidsstämpel" + +#: bfd.c:280 +msgid "No error" +msgstr "Inget fel" + +#: bfd.c:281 +msgid "System call error" +msgstr "Systemanropsfel" + +#: bfd.c:282 +msgid "Invalid bfd target" +msgstr "Ogiltigt bfd-mål" + +#: bfd.c:283 +msgid "File in wrong format" +msgstr "Filen är i fel format" + +#: bfd.c:284 +msgid "Archive object file in wrong format" +msgstr "Arkivobjektfil är i fel format" + +#: bfd.c:285 +msgid "Invalid operation" +msgstr "Ogiltig åtgärd" + +#: bfd.c:286 +msgid "Memory exhausted" +msgstr "Minnet är slut" + +#: bfd.c:287 +msgid "No symbols" +msgstr "Inga symboler" + +#: bfd.c:288 +msgid "Archive has no index; run ranlib to add one" +msgstr "Arkivet har inget index; kör ranlib för att lägga till ett" + +#: bfd.c:289 +msgid "No more archived files" +msgstr "Inga fler arkiverade filer" + +#: bfd.c:290 +msgid "Malformed archive" +msgstr "Trasigt arkiv" + +#: bfd.c:291 +msgid "File format not recognized" +msgstr "Filformatet känns inte igen" + +#: bfd.c:292 +msgid "File format is ambiguous" +msgstr "Filformatet är tvetydigt" + +#: bfd.c:293 +msgid "Section has no contents" +msgstr "Sektionen har inget innehåll" + +#: bfd.c:294 +msgid "Nonrepresentable section on output" +msgstr "Ickerepresenterbar sektion i utdata" + +#: bfd.c:295 +msgid "Symbol needs debug section which does not exist" +msgstr "Symbolen kräver felsökningssektion som inte finns" + +#: bfd.c:296 +msgid "Bad value" +msgstr "Felaktigt värde" + +#: bfd.c:297 +msgid "File truncated" +msgstr "Filen trunkerad" + +#: bfd.c:298 +msgid "File too big" +msgstr "Filen är för stor" + +#: bfd.c:299 +msgid "#" +msgstr "#" + +#: bfd.c:687 +#, c-format +msgid "BFD %s assertion fail %s:%d" +msgstr "BFD %s-försäkran misslyckades %s:%d" + +#: bfd.c:703 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d in %s\n" +msgstr "Internt BFD %s-fel, avbryter vid %s rad %d i %s\n" + +#: bfd.c:707 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d\n" +msgstr "Internt BFD %s-fel, avbryter vid %s rad %d\n" + +#: bfd.c:709 +msgid "Please report this bug.\n" +msgstr "Rapportera gärna detta fel.\n" + +#: bfdwin.c:202 +#, c-format +msgid "not mapping: data=%lx mapped=%d\n" +msgstr "mappar inte: data=%lx mappat=%d\n" + +#: bfdwin.c:205 +msgid "not mapping: env var not set\n" +msgstr "mappar inte: miljövariabel är inte satt\n" + +#: binary.c:306 +#, c-format +msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx." +msgstr "Varning: Skrivning av sektionen \"%s\" till enormt (dvs negativt) avlägsen byte 0x%lx." + +# src/menus.c:341 +#: coff-a29k.c:120 +msgid "Missing IHCONST" +msgstr "IHCONST saknas" + +# src/menus.c:341 +#: coff-a29k.c:181 +msgid "Missing IHIHALF" +msgstr "IHIHALF saknas" + +#: coff-a29k.c:213 coff-or32.c:236 +msgid "Unrecognized reloc" +msgstr "Okänd omlokalisering" + +#: coff-a29k.c:409 +msgid "missing IHCONST reloc" +msgstr "IHCONST-omlokalisering saknas" + +#: coff-a29k.c:499 +msgid "missing IHIHALF reloc" +msgstr "IHIHALF-omlokalisering saknas" + +#: coff-alpha.c:884 coff-alpha.c:921 coff-alpha.c:1992 coff-mips.c:1397 +msgid "GP relative relocation used when GP not defined" +msgstr "GP-relativ omlokalisering användes då GP inte är definierad" + +#: coff-alpha.c:1488 +msgid "using multiple gp values" +msgstr "använder flera gp-värden" + +#: coff-arm.c:1066 elf32-arm.h:294 +#, c-format +msgid "%s: unable to find THUMB glue '%s' for `%s'" +msgstr "%s: kunde inte hitta THUMB-klistret \"%s\" till \"%s\"" + +#: coff-arm.c:1096 elf32-arm.h:329 +#, c-format +msgid "%s: unable to find ARM glue '%s' for `%s'" +msgstr "%s: kunde inte hitta ARM-klistret \"%s\" till \"%s\"" + +#: coff-arm.c:1394 coff-arm.c:1489 elf32-arm.h:892 elf32-arm.h:999 +#, c-format +msgid "%s(%s): warning: interworking not enabled." +msgstr "%s(%s): varning: samverkande är inte aktiverat." + +#: coff-arm.c:1398 elf32-arm.h:1002 +#, c-format +msgid " first occurrence: %s: arm call to thumb" +msgstr " första förekomst: %s: arm-anrop till thumb" + +#: coff-arm.c:1493 elf32-arm.h:895 +#, c-format +msgid " first occurrence: %s: thumb call to arm" +msgstr " första förekomst: %s: thumb-anrop till arm" + +#: coff-arm.c:1496 +msgid " consider relinking with --support-old-code enabled" +msgstr " överväg omlänkning med --support-old-code aktiverat" + +#: coff-arm.c:1788 coff-tic80.c:687 cofflink.c:3038 +#, c-format +msgid "%s: bad reloc address 0x%lx in section `%s'" +msgstr "%s: felaktig omlokaliseringsadress 0x%lx i sektionen \"%s\"" + +#: coff-arm.c:2132 +#, c-format +msgid "%s: illegal symbol index in reloc: %d" +msgstr "%s: otillåtet symbolindex i omlokalisering: %d" + +#: coff-arm.c:2265 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d" +msgstr "FEL: %s kompilerad för APCS-%d, medan %s är kompilerad för APCS-%d" + +#: coff-arm.c:2280 elf32-arm.h:2328 +#, c-format +msgid "ERROR: %s passes floats in float registers, whereas %s passes them in integer registers" +msgstr "FEL: %s skickar flyttal i flyttalsregister, medan %s skickar dem i heltalsregister" + +#: coff-arm.c:2283 elf32-arm.h:2333 +#, c-format +msgid "ERROR: %s passes floats in integer registers, whereas %s passes them in float registers" +msgstr "FEL: %s skickar flyttal i heltalsregister, medan %s skickar dem i flyttalsregister" + +#: coff-arm.c:2298 +#, c-format +msgid "ERROR: %s is compiled as position independent code, whereas target %s is absolute position" +msgstr "FEL: %s är kompilerad som positionsoberoende kod, medan målet %s har absolut position" + +#: coff-arm.c:2301 +#, c-format +msgid "ERROR: %s is compiled as absolute position code, whereas target %s is position independent" +msgstr "FEL: %s är kompilerad som kod med absolut position, medan målet %s är positionsoberoende" + +#: coff-arm.c:2330 elf32-arm.h:2405 +#, c-format +msgid "Warning: %s supports interworking, whereas %s does not" +msgstr "Varning: %s stöder samverkande, medan %s däremot inte gör det" + +#: coff-arm.c:2333 elf32-arm.h:2412 +#, c-format +msgid "Warning: %s does not support interworking, whereas %s does" +msgstr "Varning: %s stöder inte samverkande, medan %s däremot gör det" + +#: coff-arm.c:2360 +#, c-format +msgid "private flags = %x:" +msgstr "privata flaggor = %x:" + +#: coff-arm.c:2368 elf32-arm.h:2467 +msgid " [floats passed in float registers]" +msgstr " [flyttal skickade i flyttalsregister]" + +#: coff-arm.c:2370 +msgid " [floats passed in integer registers]" +msgstr " [flyttal skickade i heltalsregister]" + +#: coff-arm.c:2373 elf32-arm.h:2470 +msgid " [position independent]" +msgstr " [positionsoberoende]" + +#: coff-arm.c:2375 +msgid " [absolute position]" +msgstr " [absolut position]" + +#: coff-arm.c:2379 +msgid " [interworking flag not initialised]" +msgstr " [samverkandeflagga är inte initierad]" + +#: coff-arm.c:2381 +msgid " [interworking supported]" +msgstr " [samverkan stöds]" + +#: coff-arm.c:2383 +msgid " [interworking not supported]" +msgstr " [samverkan stöds inte]" + +#: coff-arm.c:2431 elf32-arm.h:2150 +#, c-format +msgid "Warning: Not setting interworking flag of %s since it has already been specified as non-interworking" +msgstr "Varning: Ställer inte in samverkansflaggan för %s eftersom den redan har angivits som inte samverkande" + +#: coff-arm.c:2435 elf32-arm.h:2154 +#, c-format +msgid "Warning: Clearing the interworking flag of %s due to outside request" +msgstr "Varning: Stänger av samverkansflaggan för %s på grund av begäran utifrån" + +#: coff-h8300.c:1096 +#, c-format +msgid "cannot handle R_MEM_INDIRECT reloc when using %s output" +msgstr "kan inte hantera R_MEM_INDIRECT-omlokalisering vid användning av %s-utdata" + +#: coff-i960.c:137 coff-i960.c:486 +msgid "uncertain calling convention for non-COFF symbol" +msgstr "osäker anropskonvention för icke-COFF-symbol" + +#: coff-m68k.c:482 coff-mips.c:2394 elf32-m68k.c:2193 elf32-mips.c:1783 +msgid "unsupported reloc type" +msgstr "omlokaliseringstypen stöds inte" + +#: coff-mips.c:839 elf32-mips.c:1088 elf64-mips.c:1590 elfn32-mips.c:1554 +msgid "GP relative relocation when _gp not defined" +msgstr "GP-relativ omlokalisering då _gp inte var definierat" + +#. No other sections should appear in -membedded-pic +#. code. +#: coff-mips.c:2431 +msgid "reloc against unsupported section" +msgstr "omlokalisering mot sektion som inte stöds" + +#: coff-mips.c:2439 +msgid "reloc not properly aligned" +msgstr "omlokalisering inte på jämn gräns" + +#: coff-rs6000.c:2790 +#, c-format +msgid "%s: unsupported relocation type 0x%02x" +msgstr "%s: omlokaliseringstypen 0x%02x stöds inte" + +#: coff-rs6000.c:2883 +#, c-format +msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry" +msgstr "%s: TOC-omlokalisering vid 0x%x till symbolen \"%s\" utan någon TOC-post" + +#: coff-rs6000.c:3616 coff64-rs6000.c:2109 +#, c-format +msgid "%s: symbol `%s' has unrecognized smclas %d" +msgstr "%s: symbolen \"%s\" har okänd smclas %d" + +#: coff-tic4x.c:170 coff-tic54x.c:288 coff-tic80.c:450 +#, c-format +msgid "Unrecognized reloc type 0x%x" +msgstr "Okänd omlokaliseringstyp 0x%x" + +#: coff-tic4x.c:218 coff-tic54x.c:373 coffcode.h:5045 +#, c-format +msgid "%s: warning: illegal symbol index %ld in relocs" +msgstr "%s: varning: otillåtet symbolindex %ld i omlokaliseringarna" + +#: coff-w65.c:364 +#, c-format +msgid "ignoring reloc %s\n" +msgstr "ignorerar omlokalisering %s\n" + +#: coffcode.h:1108 +#, c-format +msgid "%s (%s): Section flag %s (0x%x) ignored" +msgstr "%s (%s): Sektionsflaggan %s (0x%x) ignorerades" + +#: coffcode.h:2214 +#, c-format +msgid "Unrecognized TI COFF target id '0x%x'" +msgstr "Okänt TI COFF-målid \"0x%x\"" + +#: coffcode.h:4437 +#, c-format +msgid "%s: warning: illegal symbol index %ld in line numbers" +msgstr "%s: varning: otillåtet symbolindex %ld i radnummer" + +#: coffcode.h:4451 +#, c-format +msgid "%s: warning: duplicate line number information for `%s'" +msgstr "%s: varning: dubbel radnummersinformation för \"%s\"" + +#: coffcode.h:4805 +#, c-format +msgid "%s: Unrecognized storage class %d for %s symbol `%s'" +msgstr "%s: Okänd lagringsklass %d för %s-symbolen \"%s\"" + +#: coffcode.h:4938 +#, c-format +msgid "warning: %s: local symbol `%s' has no section" +msgstr "varning: %s: lokala symbolen \"%s\" har ingen sektion" + +#: coffcode.h:5083 +#, c-format +msgid "%s: illegal relocation type %d at address 0x%lx" +msgstr "%s: otillåten omlokaliseringstyp %d på adress 0x%lx" + +#: coffgen.c:1666 +#, c-format +msgid "%s: bad string table size %lu" +msgstr "%s: felaktig strängtabellstorlek %lu" + +#: cofflink.c:538 elflink.h:1276 +#, c-format +msgid "Warning: type of symbol `%s' changed from %d to %d in %s" +msgstr "Varning: typen på symbolen \"%s\" ändrades från %d till %d i %s" + +#: cofflink.c:2328 +#, c-format +msgid "%s: relocs in section `%s', but it has no contents" +msgstr "%s: omlokaliseringar i sektionen \"%s\", men den har inget innehåll" + +#: cofflink.c:2671 coffswap.h:890 +#, c-format +msgid "%s: %s: reloc overflow: 0x%lx > 0xffff" +msgstr "%s: %s: omlokalisering ger överspill: 0x%lx > 0xffff" + +#: cofflink.c:2680 coffswap.h:876 +#, c-format +msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: varning: %s: radnummer ger överspill: 0x%lx > 0xffff" + +#: cpu-arm.c:196 cpu-arm.c:206 +#, c-format +msgid "ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale" +msgstr "FEL: %s kompilerad för EP9312, medan %s är kompilerad för XScale" + +#: cpu-arm.c:344 +#, c-format +msgid "warning: unable to update contents of %s section in %s" +msgstr "varning: kan inte uppdatera innehållet i %s-sektion i %s" + +#: dwarf2.c:380 +msgid "Dwarf Error: Can't find .debug_str section." +msgstr "Dwarf-fel: Kan inte hitta sektionen .debug_str." + +#: dwarf2.c:397 +#, c-format +msgid "Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str size (%lu)." +msgstr "Dwarf-fel: DW_FORM_strp-avståndet (%lu) större än eller lika med storleken på .debug_str (%lu)." + +#: dwarf2.c:541 +msgid "Dwarf Error: Can't find .debug_abbrev section." +msgstr "Dwarf-fel: Kan inte hitta sektionen .debug_abbrev." + +#: dwarf2.c:556 +#, c-format +msgid "Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size (%lu)." +msgstr "Dwarf-fel: Förkortningsavståndet (%lu) större än eller lika med storleken .debug_abbrev (%lu)." + +#: dwarf2.c:756 +#, c-format +msgid "Dwarf Error: Invalid or unhandled FORM value: %u." +msgstr "Dwarf-fel: Ogiltig eller ohanterat FORM-värde: %u." + +#: dwarf2.c:933 +msgid "Dwarf Error: mangled line number section (bad file number)." +msgstr "Dwarf-fel: trasig radnummerssektion (felaktigt filnummer)." + +#: dwarf2.c:1032 +msgid "Dwarf Error: Can't find .debug_line section." +msgstr "Dwarf-fel: Kan inte hitta sektionen .debug_line." + +#: dwarf2.c:1049 +#, c-format +msgid "Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)." +msgstr "Dwarf-fel: Radavståndet (%lu) större än eller lika med storleken .debug_line (%lu)." + +#: dwarf2.c:1255 +msgid "Dwarf Error: mangled line number section." +msgstr "Dwarf-fel: trasig radnummerssektion." + +#: dwarf2.c:1470 dwarf2.c:1620 +#, c-format +msgid "Dwarf Error: Could not find abbrev number %u." +msgstr "Dwarf-fel: Kunde inte hitta förkortningsnumret %u." + +#: dwarf2.c:1581 +#, c-format +msgid "Dwarf Error: found dwarf version '%u', this reader only handles version 2 information." +msgstr "Dwarf-fel: hittade dwarf version \"%u\", denna läsare hanterar endast information från version 2." + +#: dwarf2.c:1588 +#, c-format +msgid "Dwarf Error: found address size '%u', this reader can not handle sizes greater than '%u'." +msgstr "Dwarf-fel: hittade adresstorleken \"%u\", denna läsare kan inte hantera storlekar större än \"%u\"." + +#: dwarf2.c:1611 +#, c-format +msgid "Dwarf Error: Bad abbrev number: %u." +msgstr "Dwarf-fel: Felaktigt förkortningsnummer: %u." + +#: ecoff.c:1339 +#, c-format +msgid "Unknown basic type %d" +msgstr "Okänd grundtyp %d" + +#: ecoff.c:1599 +#, c-format +msgid "" +"\n" +" End+1 symbol: %ld" +msgstr "" +"\n" +" Symbol slut+1: %ld" + +#: ecoff.c:1606 ecoff.c:1609 +#, c-format +msgid "" +"\n" +" First symbol: %ld" +msgstr "" +"\n" +" Första symbolen: %ld" + +#: ecoff.c:1621 +#, c-format +msgid "" +"\n" +" End+1 symbol: %-7ld Type: %s" +msgstr "" +"\n" +" Symbol slut+1: %-7ld Typ: %s" + +#: ecoff.c:1628 +#, c-format +msgid "" +"\n" +" Local symbol: %ld" +msgstr "" +"\n" +" Lokal symbol: %ld" + +#: ecoff.c:1636 +#, c-format +msgid "" +"\n" +" struct; End+1 symbol: %ld" +msgstr "" +"\n" +" struct; symbol slut+1: %ld" + +#: ecoff.c:1641 +#, c-format +msgid "" +"\n" +" union; End+1 symbol: %ld" +msgstr "" +"\n" +" union; symbol slut+1: %ld" + +#: ecoff.c:1646 +#, c-format +msgid "" +"\n" +" enum; End+1 symbol: %ld" +msgstr "" +"\n" +" enum; symbol slut+1: %ld" + +#: ecoff.c:1652 +#, c-format +msgid "" +"\n" +" Type: %s" +msgstr "" +"\n" +" Typ: %s" + +#: elf-hppa.h:1458 elf-hppa.h:1491 elf-m10300.c:1628 elf64-sh64.c:1704 +#, c-format +msgid "%s: warning: unresolvable relocation against symbol `%s' from %s section" +msgstr "%s: varning: olöslig omlokalisering mot symbolen \"%s\" från sektionen %s" + +#: elf-m10200.c:442 elf-m10300.c:1695 elf32-arm.h:2088 elf32-avr.c:812 +#: elf32-cris.c:1390 elf32-d10v.c:570 elf32-fr30.c:634 elf32-frv.c:815 +#: elf32-h8300.c:528 elf32-i860.c:1028 elf32-ip2k.c:1586 elf32-iq2000.c:699 +#: elf32-m32r.c:1283 elf32-m68hc1x.c:1305 elf32-msp430.c:510 +#: elf32-openrisc.c:436 elf32-v850.c:1777 elf32-xstormy16.c:976 +#: elf64-mmix.c:1332 +msgid "internal error: out of range error" +msgstr "internt fel: utanför intervallet" + +#: elf-m10200.c:446 elf-m10300.c:1699 elf32-arm.h:2092 elf32-avr.c:816 +#: elf32-cris.c:1394 elf32-d10v.c:574 elf32-fr30.c:638 elf32-frv.c:819 +#: elf32-h8300.c:532 elf32-i860.c:1032 elf32-iq2000.c:703 elf32-m32r.c:1287 +#: elf32-m68hc1x.c:1309 elf32-msp430.c:514 elf32-openrisc.c:440 +#: elf32-v850.c:1781 elf32-xstormy16.c:980 elf64-mmix.c:1336 elfxx-mips.c:6452 +msgid "internal error: unsupported relocation error" +msgstr "internt fel: omlokaliseringen stöds inte" + +#: elf-m10200.c:450 elf-m10300.c:1703 elf32-arm.h:2096 elf32-d10v.c:578 +#: elf32-h8300.c:536 elf32-m32r.c:1291 elf32-m68hc1x.c:1313 +msgid "internal error: dangerous error" +msgstr "internt fel: farligt fel" + +#: elf-m10200.c:454 elf-m10300.c:1707 elf32-arm.h:2100 elf32-avr.c:824 +#: elf32-cris.c:1402 elf32-d10v.c:582 elf32-fr30.c:646 elf32-frv.c:827 +#: elf32-h8300.c:540 elf32-i860.c:1040 elf32-ip2k.c:1601 elf32-iq2000.c:711 +#: elf32-m32r.c:1295 elf32-m68hc1x.c:1317 elf32-msp430.c:522 +#: elf32-openrisc.c:448 elf32-v850.c:1801 elf32-xstormy16.c:988 +#: elf64-mmix.c:1344 +msgid "internal error: unknown error" +msgstr "internt fel: okänt fel" + +#: elf.c:372 +#, c-format +msgid "%s: invalid string offset %u >= %lu for section `%s'" +msgstr "%s: ogiltigt strängavstånd %u >= %lu för sektionen \"%s\"" + +#: elf.c:624 +#, c-format +msgid "%s: invalid SHT_GROUP entry" +msgstr "%s: ogiltig SHT_GROUP-post" + +#: elf.c:695 +#, c-format +msgid "%s: no group info for section %s" +msgstr "%s: ingen gruppinformation för sektionen %s" + +#: elf.c:1055 +msgid "" +"\n" +"Program Header:\n" +msgstr "" +"\n" +"Programhuvud:\n" + +#: elf.c:1106 +msgid "" +"\n" +"Dynamic Section:\n" +msgstr "" +"\n" +"Dynamisk sektion:\n" + +#: elf.c:1235 +msgid "" +"\n" +"Version definitions:\n" +msgstr "" +"\n" +"Versionsdefinitioner:\n" + +#: elf.c:1258 +msgid "" +"\n" +"Version References:\n" +msgstr "" +"\n" +"Versionsreferenser:\n" + +#: elf.c:1263 +#, c-format +msgid " required from %s:\n" +msgstr " krävs från %s:\n" + +#: elf.c:1944 +#, c-format +msgid "%s: invalid link %lu for reloc section %s (index %u)" +msgstr "%s: ogiltig länk %lu för omlokaliseringssektion %s (index %u)" + +#: elf.c:3686 +#, c-format +msgid "%s: Not enough room for program headers (allocated %u, need %u)" +msgstr "%s: Inte tillräckligt med utrymme för programhuvuden (allokerade %u, behöver %u)" + +#: elf.c:3791 +#, c-format +msgid "%s: Not enough room for program headers, try linking with -N" +msgstr "%s: Inte tillräckligt med utrymme för programhuvuden, försök att länka med -N" + +#: elf.c:3922 +#, c-format +msgid "Error: First section in segment (%s) starts at 0x%x whereas the segment starts at 0x%x" +msgstr "Fel: Första sektionen i segmentet (%s) börjar vid 0x%x medan segmentet börjar med 0x%x" + +#: elf.c:4242 +#, c-format +msgid "%s: warning: allocated section `%s' not in segment" +msgstr "%s: varning: allokerad sektion \"%s\" inte i segment" + +#: elf.c:4566 +#, c-format +msgid "%s: symbol `%s' required but not present" +msgstr "%s: symbolen \"%s\" krävs men finns inte med" + +#: elf.c:4854 +#, c-format +msgid "%s: warning: Empty loadable segment detected, is this intentional ?\n" +msgstr "%s: varning: Tomt inläsningsbart segment upptäckt, är detta meningen?\n" + +#: elf.c:5485 +#, c-format +msgid "Unable to find equivalent output section for symbol '%s' from section '%s'" +msgstr "Kan inte hitta ekvivalent utdatasektion för symbolen \"%s\" från sektionen \"%s\"" + +#: elf.c:6298 +#, c-format +msgid "%s: unsupported relocation type %s" +msgstr "%s: omlokaliseringstypen %s stöds inte" + +#: elf32-arm.h:1228 +#, c-format +msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'." +msgstr "%s: Varning: Arm BLX-instruktion använder Arm-funktionen \"%s\" som mål." + +#: elf32-arm.h:1424 +#, c-format +msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'." +msgstr "%s: Varning: Thumb BLX-instruktionen använder thumb-funktionen \"%s\" som mål." + +#: elf32-arm.h:1918 elf32-sh.c:4706 elf64-sh64.c:1613 +#, c-format +msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section" +msgstr "%s(%s+0x%lx): %s omlokalisering mot SEC_MERGE-sektion" + +#: elf32-arm.h:2012 +#, c-format +msgid "%s: warning: unresolvable relocation %d against symbol `%s' from %s section" +msgstr "%s: varning: olöslig omlokalisering %d mot symbolen \"%s\" från sektionen %s" + +#: elf32-arm.h:2202 +#, c-format +msgid "Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it" +msgstr "Varning: Stänger av samverkandeflaggan i %s eftersom icke-samverkande kod i %s har länkats med det" + +#: elf32-arm.h:2302 +#, c-format +msgid "ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d" +msgstr "FEL: %s är kompilerad för EABI version %d, medan %s är kompilerad för version %d" + +#: elf32-arm.h:2316 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d" +msgstr "FEL: %s är kompilerad för APCS-%d, medan målet %s använder APCS-%d" + +#: elf32-arm.h:2344 +#, c-format +msgid "ERROR: %s uses VFP instructions, whereas %s does not" +msgstr "FEL: %s använder VFP-instruktioner, men det gör inte %s" + +#: elf32-arm.h:2349 +#, c-format +msgid "ERROR: %s uses FPA instructions, whereas %s does not" +msgstr "FEL: %s använder FPA-instruktioner, men det gör inte %s" + +#: elf32-arm.h:2360 elf32-arm.h:2365 +#, c-format +msgid "ERROR: %s uses Maverick instructions, whereas %s does not" +msgstr "FEL: %s använder Maverick-instruktioner, men det gör inte %s" + +#: elf32-arm.h:2385 +#, c-format +msgid "ERROR: %s uses software FP, whereas %s uses hardware FP" +msgstr "FEL: %s använder programvaruflyttal, medan %s använder hårdvaruflyttal" + +#: elf32-arm.h:2390 +#, c-format +msgid "ERROR: %s uses hardware FP, whereas %s uses software FP" +msgstr "FEL: %s använder hårdvaruflyttal, medan %s använder programvaruflyttal" + +#. Ignore init flag - it may not be set, despite the flags field +#. containing valid data. +#: elf32-arm.h:2443 elf32-cris.c:2975 elf32-m68hc1x.c:1459 elf32-m68k.c:397 +#: elf32-vax.c:546 elfxx-mips.c:9238 +#, c-format +msgid "private flags = %lx:" +msgstr "privata flaggor = %lx:" + +#: elf32-arm.h:2452 +msgid " [interworking enabled]" +msgstr " [samverkande är aktiverat]" + +#: elf32-arm.h:2460 +msgid " [VFP float format]" +msgstr " [VFP-flyttalsformat]" + +#: elf32-arm.h:2462 +msgid " [Maverick float format]" +msgstr " [Maverick-flyttalsformat]" + +#: elf32-arm.h:2464 +msgid " [FPA float format]" +msgstr " [FPA-flyttalsformat]" + +#: elf32-arm.h:2473 +msgid " [new ABI]" +msgstr " [nytt ABI]" + +#: elf32-arm.h:2476 +msgid " [old ABI]" +msgstr " [gammalt ABI]" + +#: elf32-arm.h:2479 +msgid " [software FP]" +msgstr " [programvaru-FP]" + +#: elf32-arm.h:2488 +msgid " [Version1 EABI]" +msgstr " [Version1 EABI]" + +#: elf32-arm.h:2491 elf32-arm.h:2502 +msgid " [sorted symbol table]" +msgstr " [sorterad symboltabell]" + +#: elf32-arm.h:2493 elf32-arm.h:2504 +msgid " [unsorted symbol table]" +msgstr " [osorterad symboltabell]" + +#: elf32-arm.h:2499 +msgid " [Version2 EABI]" +msgstr " [Version2 EABI]" + +#: elf32-arm.h:2507 +msgid " [dynamic symbols use segment index]" +msgstr " [dynamiska symboler använder segmentindex]" + +#: elf32-arm.h:2510 +msgid " [mapping symbols precede others]" +msgstr " [mappsymboler har företräde före andra]" + +#: elf32-arm.h:2517 +msgid " " +msgstr " " + +#: elf32-arm.h:2524 +msgid " [relocatable executable]" +msgstr " [omlokaliseringsbar körbar fil]" + +#: elf32-arm.h:2527 +msgid " [has entry point]" +msgstr " [har startpunkt]" + +#: elf32-arm.h:2532 +msgid "" +msgstr "" + +#: elf32-avr.c:820 elf32-cris.c:1398 elf32-fr30.c:642 elf32-frv.c:823 +#: elf32-i860.c:1036 elf32-ip2k.c:1597 elf32-iq2000.c:707 elf32-msp430.c:518 +#: elf32-openrisc.c:444 elf32-v850.c:1785 elf32-xstormy16.c:984 +#: elf64-mmix.c:1340 +msgid "internal error: dangerous relocation" +msgstr "internt fel: farlig omlokalisering" + +#: elf32-cris.c:931 +#, c-format +msgid "%s: unresolvable relocation %s against symbol `%s' from %s section" +msgstr "%s: olöslig omlokalisering %s mot symbolen \"%s\" från sektionen %s" + +#: elf32-cris.c:993 +#, c-format +msgid "%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section" +msgstr "%s: Varken någon PLT eller GOT för omlokalisering %s mot symbolen \"%s\" från sektionen %s" + +#: elf32-cris.c:996 elf32-cris.c:1122 +msgid "[whose name is lost]" +msgstr "[vars namn tappats bort]" + +#: elf32-cris.c:1111 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against local symbol from %s section" +msgstr "%s: omlokalisering %s med icke-tomt addendum %d mot lokal symbol från sektionen %s" + +#: elf32-cris.c:1118 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against symbol `%s' from %s section" +msgstr "%s: omlokalisering %s med icke-tomt addendum %d mot symbolen \"%s\" från sektionen %s" + +#: elf32-cris.c:1143 +#, c-format +msgid "%s: relocation %s is not allowed for global symbol: `%s' from %s section" +msgstr "%s: omlokaliseringen %s är inte tillåten för global symbol: \"%s\" från sektionen %s" + +#: elf32-cris.c:1158 +#, c-format +msgid "%s: relocation %s in section %s with no GOT created" +msgstr "%s: omlokalisering %s i sektionen %s utan GOT skapad" + +#: elf32-cris.c:1277 +#, c-format +msgid "%s: Internal inconsistency; no relocation section %s" +msgstr "%s: Intern inkonsistens; ingen omlokaliseringssektion %s" + +#: elf32-cris.c:2500 +#, c-format +msgid "" +"%s, section %s:\n" +" relocation %s should not be used in a shared object; recompile with -fPIC" +msgstr "" +"%s, sektion %s:\n" +" omlokaliseringen %s bör inte användas i ett delat objekt; kompilera om med -fPIC" + +#: elf32-cris.c:2978 +msgid " [symbols have a _ prefix]" +msgstr " [symboler har ett _-prefix]" + +#: elf32-cris.c:3017 +#, c-format +msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols" +msgstr "%s: använder symboler med _-prefix, men skriver fil med symboler utan prefix" + +#: elf32-cris.c:3018 +#, c-format +msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols" +msgstr "%s: använder symboler utan prefix, men skriver fil med symboler med _-prefix" + +#: elf32-frv.c:1223 +#, c-format +msgid "%s: compiled with %s and linked with modules that use non-pic relocations" +msgstr "%s: kompilerad med %s och länkad med moduler som använder icke-pic-omlokalisering" + +#: elf32-frv.c:1273 elf32-iq2000.c:895 +#, c-format +msgid "%s: compiled with %s and linked with modules compiled with %s" +msgstr "%s: kompilerad med %s och länkad med moduler som kompilerats med %s" + +#: elf32-frv.c:1285 +#, c-format +msgid "%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%s: använder andra okända e_flags-fält (0x%lx) än tidigare moduler (0x%lx)" + +#: elf32-frv.c:1321 elf32-iq2000.c:933 +#, c-format +msgid "private flags = 0x%lx:" +msgstr "privata flaggor = 0x%lx:" + +#: elf32-gen.c:83 elf64-gen.c:82 +#, c-format +msgid "%s: Relocations in generic ELF (EM: %d)" +msgstr "%s: Omlokalisering i allmän ELF (EM: %d)" + +#: elf32-hppa.c:672 elf32-m68hc1x.c:176 elf64-ppc.c:3118 +#, c-format +msgid "%s: cannot create stub entry %s" +msgstr "%s: kan inte skapa stubbstarten %s" + +#: elf32-hppa.c:957 elf32-hppa.c:3538 +#, c-format +msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections" +msgstr "%s(%s+0x%lx): kan inte nå %s, kompilera om med -ffunction-sections" + +#: elf32-hppa.c:1340 elf64-x86-64.c:672 elf64-x86-64.c:797 +#, c-format +msgid "%s: relocation %s can not be used when making a shared object; recompile with -fPIC" +msgstr "%s: omlokaliseringen %s kan inte användas då ett delat objekt skapas; kompilera om med -fPIC" + +#: elf32-hppa.c:1360 +#, c-format +msgid "%s: relocation %s should not be used when making a shared object; recompile with -fPIC" +msgstr "%s: omlokaliseringen %s bör inte användas då ett delat objekt skapas; kompilera om med -fPIC" + +#: elf32-hppa.c:1553 +#, c-format +msgid "Could not find relocation section for %s" +msgstr "Kunde inte hitta omlokaliseringssektion för %s" + +#: elf32-hppa.c:2828 +#, c-format +msgid "%s: duplicate export stub %s" +msgstr "%s: dubbel exportstubb %s" + +#: elf32-hppa.c:3416 +#, c-format +msgid "%s(%s+0x%lx): fixing %s" +msgstr "%s(%s+0x%lx): fixar %s" + +#: elf32-hppa.c:4039 +#, c-format +msgid "%s(%s+0x%lx): cannot handle %s for %s" +msgstr "%s(%s+0x%lx): kan inte hantera %s för %s" + +#: elf32-hppa.c:4357 +msgid ".got section not immediately after .plt section" +msgstr ".got-sektionen följer inte omedelbart efter .plt-sektion" + +#: elf32-i386.c:326 +#, c-format +msgid "%s: invalid relocation type %d" +msgstr "%s: ogiltig omlokaliseringstyp %d" + +#: elf32-i386.c:841 elf32-s390.c:990 elf32-sparc.c:887 elf32-xtensa.c:637 +#: elf64-s390.c:943 elf64-x86-64.c:650 +#, c-format +msgid "%s: bad symbol index: %d" +msgstr "%s: felaktigt symbolindex: %d" + +#: elf32-i386.c:949 elf32-s390.c:1168 elf32-sh.c:6426 elf32-sparc.c:1011 +#: elf64-s390.c:1129 +#, c-format +msgid "%s: `%s' accessed both as normal and thread local symbol" +msgstr "%s: \"%s\" anropad både som lokal normal symbol och lokal trådsymbol" + +#: elf32-i386.c:1064 elf32-s390.c:1279 elf64-ppc.c:3929 elf64-s390.c:1243 +#: elf64-x86-64.c:886 +#, c-format +msgid "%s: bad relocation section name `%s'" +msgstr "%s: felaktig omlokaliseringssektionsnamn \"%s\"" + +#: elf32-i386.c:2908 elf32-m68k.c:1757 elf32-s390.c:3022 elf32-sparc.c:2879 +#: elf32-xtensa.c:2193 elf64-s390.c:3018 elf64-sparc.c:2664 +#: elf64-x86-64.c:2452 +#, c-format +msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'" +msgstr "%s(%s+0x%lx): olöslig omlokalisering mot symbolen \"%s\"" + +#: elf32-i386.c:2947 elf32-m68k.c:1796 elf32-s390.c:3072 elf64-s390.c:3068 +#: elf64-x86-64.c:2490 +#, c-format +msgid "%s(%s+0x%lx): reloc against `%s': error %d" +msgstr "%s(%s+0x%lx): omlokalisering mot \"%s\": fel %d" + +#: elf32-ip2k.c:565 elf32-ip2k.c:571 elf32-ip2k.c:734 elf32-ip2k.c:740 +msgid "ip2k relaxer: switch table without complete matching relocation information." +msgstr "ip2k-relaxerare: switchtabell utan helt matchande omlokaliseringsinformation." + +#: elf32-ip2k.c:588 elf32-ip2k.c:767 +msgid "ip2k relaxer: switch table header corrupt." +msgstr "ip2k-relaxerare: switchtabellshuvud trasigt." + +#: elf32-ip2k.c:1395 +#, c-format +msgid "ip2k linker: missing page instruction at 0x%08lx (dest = 0x%08lx)." +msgstr "ip2k-länkare: sidinstruktion saknas vid 0x%08lx (dest = 0x%08lx)." + +#: elf32-ip2k.c:1409 +#, c-format +msgid "ip2k linker: redundant page instruction at 0x%08lx (dest = 0x%08lx)." +msgstr "ip2k-länkare: redundant sidinstruktion vid 0x%08lx (dest = 0x%08lx)." + +#. Only if it's not an unresolved symbol. +#: elf32-ip2k.c:1593 +msgid "unsupported relocation between data/insn address spaces" +msgstr "omlokalisering mellan data/-instruktionsadressutrymmen stöds inte" + +#: elf32-iq2000.c:907 elf32-m68hc1x.c:1431 elf32-ppc.c:2175 elf64-sparc.c:3072 +#: elfxx-mips.c:9195 +#, c-format +msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%s: använder andra e_flags-fält (0x%lx) än tidigare moduler (0x%lx)" + +#: elf32-m32r.c:930 +msgid "SDA relocation when _SDA_BASE_ not defined" +msgstr "SDA-omlokalisering då _SDA_BASE_ inte är definierat" + +#: elf32-m32r.c:1018 elf64-alpha.c:4279 elf64-alpha.c:4407 elf32-ia64.c:3958 +#: elf64-ia64.c:3958 +#, c-format +msgid "%s: unknown relocation type %d" +msgstr "%s: okänd omlokaliseringstyp %d" + +#: elf32-m32r.c:1226 +#, c-format +msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)" +msgstr "%s: Målet (%s) för en %s-omlokalisering är i fel sektion (%s)" + +#: elf32-m32r.c:1952 +#, c-format +msgid "%s: Instruction set mismatch with previous modules" +msgstr "%s: Instruktionsuppsättning passar inte med tidigare moduler" + +#: elf32-m32r.c:1975 +#, c-format +msgid "private flags = %lx" +msgstr "privata flaggor = %lx" + +#: elf32-m32r.c:1980 +msgid ": m32r instructions" +msgstr ": m32r-instruktioner" + +#: elf32-m32r.c:1981 +msgid ": m32rx instructions" +msgstr ": m32rx-instruktioner" + +#: elf32-m68hc1x.c:1217 +#, c-format +msgid "Reference to the far symbol `%s' using a wrong relocation may result in incorrect execution" +msgstr "Referens till den avlägsna symbolen \"%s\" med hjälp av en felaktig omlokalisering kan resultera i felaktig exekvering" + +#: elf32-m68hc1x.c:1240 +#, c-format +msgid "banked address [%lx:%04lx] (%lx) is not in the same bank as current banked address [%lx:%04lx] (%lx)" +msgstr "bankad adress [%lx:%04lx] (%lx) är inte i samma bank som den aktuella bankade adressen [%lx:%04lx] (%lx)" + +#: elf32-m68hc1x.c:1259 +#, c-format +msgid "reference to a banked address [%lx:%04lx] in the normal address space at %04lx" +msgstr "referens till en bankad adress [%lx:%04lx] i det normala adressutrymmet vid %04lx" + +#: elf32-m68hc1x.c:1396 +#, c-format +msgid "%s: linking files compiled for 16-bit integers (-mshort) and others for 32-bit integers" +msgstr "%s: länkar filer kompilerade för 16-bitars heltal (-mshort) och andra för 32-bitars heltal" + +#: elf32-m68hc1x.c:1404 +#, c-format +msgid "%s: linking files compiled for 32-bit double (-fshort-double) and others for 64-bit double" +msgstr "%s: länkar filer kompilerade för 32-bitars dubbelprecisionsflyttal (-fshort-double) och andra för 64-bitars dubbelprecisionsflyttal" + +#: elf32-m68hc1x.c:1414 +#, c-format +msgid "%s: linking files compiled for HCS12 with others compiled for HC12" +msgstr "%s: länkar filer kompilerade för HCS12 med andra kompilerade för HC12" + +#: elf32-m68hc1x.c:1462 +msgid "[abi=32-bit int, " +msgstr "[abi=32-bitars heltal, " + +#: elf32-m68hc1x.c:1464 +msgid "[abi=16-bit int, " +msgstr "[abi=16-bitars heltal, " + +#: elf32-m68hc1x.c:1467 +msgid "64-bit double, " +msgstr "64-bitars dubbelprecisionsflyttal, " + +#: elf32-m68hc1x.c:1469 +msgid "32-bit double, " +msgstr "32-bitars dubbelprecisionsflyttal, " + +#: elf32-m68hc1x.c:1472 +msgid "cpu=HC11]" +msgstr "cpu=HC11]" + +#: elf32-m68hc1x.c:1474 +msgid "cpu=HCS12]" +msgstr "cpu=HCS12]" + +#: elf32-m68hc1x.c:1476 +msgid "cpu=HC12]" +msgstr "cpu=HC12]" + +#: elf32-m68hc1x.c:1479 +msgid " [memory=bank-model]" +msgstr " [memory=bank-modell]" + +#: elf32-m68hc1x.c:1481 +msgid " [memory=flat]" +msgstr " [memory=platt]" + +#: elf32-m68k.c:400 +msgid " [cpu32]" +msgstr " [cpu32]" + +#: elf32-m68k.c:403 +msgid " [m68000]" +msgstr " [m68000]" + +#: elf32-mcore.c:353 elf32-mcore.c:456 +#, c-format +msgid "%s: Relocation %s (%d) is not currently supported.\n" +msgstr "%s: Omlokalisering %s (%d) stöds för närvarande inte.\n" + +#: elf32-mcore.c:441 +#, c-format +msgid "%s: Unknown relocation type %d\n" +msgstr "%s: Okänd omlokaliseringstyp %d\n" + +#: elf32-mips.c:1170 elf64-mips.c:1717 elfn32-mips.c:1664 +msgid "32bits gp relative relocation occurs for an external symbol" +msgstr "32-bitars gp-relativ omlokalisering förekom för en extern symbol" + +#: elf32-mips.c:1314 elf64-mips.c:1830 elfn32-mips.c:1783 +#, c-format +msgid "Linking mips16 objects into %s format is not supported" +msgstr "Länkning av mips16-objekt till %s-format stöds inte" + +#: elf32-ppc.c:2056 +#, c-format +msgid "generic linker can't handle %s" +msgstr "allmän länkare kan inte hantera %s" + +#: elf32-ppc.c:2138 +#, c-format +msgid "%s: compiled with -mrelocatable and linked with modules compiled normally" +msgstr "%s: kompilerad med -mrelocatable och länkad med moduler som kompilerats normalt" + +#: elf32-ppc.c:2147 +#, c-format +msgid "%s: compiled normally and linked with modules compiled with -mrelocatable" +msgstr "%s: kompilerad normalt och länkad med moduler som kompilerats med -mrelocatable" + +#: elf32-ppc.c:3413 +#, c-format +msgid "%s: relocation %s cannot be used when making a shared object" +msgstr "%s: omlokaliseringen %s kan inte användas då ett delat objekt skapas" + +#. It does not make sense to have a procedure linkage +#. table entry for a local symbol. +#: elf32-ppc.c:3619 +#, c-format +msgid "%s(%s+0x%lx): %s reloc against local symbol" +msgstr "%s(%s+0x%lx): %s-omlokalisering mot lokal symbol" + +#: elf32-ppc.c:4862 elf64-ppc.c:7789 +#, c-format +msgid "%s: unknown relocation type %d for symbol %s" +msgstr "%s: okänd omlokaliseringstyp %d för symbolen %s" + +#: elf32-ppc.c:5113 +#, c-format +msgid "%s(%s+0x%lx): non-zero addend on %s reloc against `%s'" +msgstr "%s(%s+0x%lx): icke-tomt addendum på %s-omlokalisering mot \"%s\"" + +#: elf32-ppc.c:5399 elf32-ppc.c:5425 elf32-ppc.c:5484 +#, c-format +msgid "%s: the target (%s) of a %s relocation is in the wrong output section (%s)" +msgstr "%s: målet (%s) för en %s-omlokalisering är i fel utdatasektion (%s)" + +#: elf32-ppc.c:5539 +#, c-format +msgid "%s: relocation %s is not yet supported for symbol %s." +msgstr "%s: omlokaliseringen %s stöds inte än för symbolen %s." + +#: elf32-ppc.c:5594 elf64-ppc.c:8461 +#, c-format +msgid "%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'" +msgstr "%s(%s+0x%lx): olöslig %s-omlokalisering mot symbolen \"%s\"" + +#: elf32-ppc.c:5644 elf64-ppc.c:8507 +#, c-format +msgid "%s(%s+0x%lx): %s reloc against `%s': error %d" +msgstr "%s(%s+0x%lx): %s-omlokalisering mot \"%s\": fel %d" + +#: elf32-ppc.c:5888 +#, c-format +msgid "corrupt or empty %s section in %s" +msgstr "trasig eller tom %s-sektion i %s" + +#: elf32-ppc.c:5895 +#, c-format +msgid "unable to read in %s section from %s" +msgstr "kan inte läsa in %s-sektion från %s" + +#: elf32-ppc.c:5901 +#, c-format +msgid "corrupt %s section in %s" +msgstr "trasig %s-sektion i %s" + +#: elf32-ppc.c:5944 +#, c-format +msgid "warning: unable to set size of %s section in %s" +msgstr "varning: kan inte ställa in storleken för sektionen %s i %s" + +#: elf32-ppc.c:5994 +msgid "failed to allocate space for new APUinfo section." +msgstr "misslyckades med att allokera utrymme för ny APUinfo-sektion." + +#: elf32-ppc.c:6013 +msgid "failed to compute new APUinfo section." +msgstr "misslyckades med att beräkna ny APUinfo-sektion." + +#: elf32-ppc.c:6016 +msgid "failed to install new APUinfo section." +msgstr "misslyckades med att installera ny APUinfo-sektion." + +#: elf32-s390.c:2256 elf64-s390.c:2226 +#, c-format +msgid "%s(%s+0x%lx): invalid instruction for TLS relocation %s" +msgstr "%s(%s+0x%lx): ogiltig instruktion för TLS-omlokalisering %s" + +#: elf32-sh.c:2103 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES offset" +msgstr "%s: 0x%lx: varning: felaktigt R_SH_USES-avstånd" + +#: elf32-sh.c:2115 +#, c-format +msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x" +msgstr "%s: 0x%lx: varning: R_SH_USES pekar till okänd instruktion 0x%x" + +#: elf32-sh.c:2132 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES load offset" +msgstr "%s: 0x%lx: varning: felaktigt R_SH_USES-inläsningsavstånd" + +#: elf32-sh.c:2147 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected reloc" +msgstr "%s: 0x%lx: varning: kunde inte hitta förväntad omlokalisering" + +#: elf32-sh.c:2175 +#, c-format +msgid "%s: 0x%lx: warning: symbol in unexpected section" +msgstr "%s: 0x%lx: varning: symbol i oväntad sektion" + +#: elf32-sh.c:2300 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected COUNT reloc" +msgstr "%s: 0x%lx: varning: kunde inte hitta förväntad COUNT-omlokalisering" + +#: elf32-sh.c:2309 +#, c-format +msgid "%s: 0x%lx: warning: bad count" +msgstr "%s: 0x%lx: varning: felaktigt antal" + +#: elf32-sh.c:2712 elf32-sh.c:3088 +#, c-format +msgid "%s: 0x%lx: fatal: reloc overflow while relaxing" +msgstr "%s: 0x%lx: ödesdigert: omlokalisering ger överspill vid förenklingen" + +#: elf32-sh.c:4654 elf64-sh64.c:1585 +msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled" +msgstr "Oväntat STO_SH5_ISA32 på lokal symbol hanteras inte" + +#: elf32-sh.c:4809 +#, c-format +msgid "%s: unresolvable relocation against symbol `%s' from %s section" +msgstr "%s: olöslig omlokalisering mot symbolen \"%s\" från sektionen %s" + +#: elf32-sh.c:4881 +#, c-format +msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation" +msgstr "%s: 0x%lx: ödesdigert: ojusterat grenmål för omlokalisering för förenklingsstöd" + +#: elf32-sh.c:6627 elf64-alpha.c:4848 +#, c-format +msgid "%s: TLS local exec code cannot be linked into shared objects" +msgstr "%s: lokal TLS-exekveringskod kan inte länkas in i delade objekt" + +#: elf32-sh64.c:221 elf64-sh64.c:2407 +#, c-format +msgid "%s: compiled as 32-bit object and %s is 64-bit" +msgstr "%s: kompilerat som 32-bitarsobjekt och %s är 64-bitars" + +#: elf32-sh64.c:224 elf64-sh64.c:2410 +#, c-format +msgid "%s: compiled as 64-bit object and %s is 32-bit" +msgstr "%s: kompilerat som 64-bitarsobjekt och %s är 32-bitars" + +#: elf32-sh64.c:226 elf64-sh64.c:2412 +#, c-format +msgid "%s: object size does not match that of target %s" +msgstr "%s: objektstorleken stämmer inte överens med den hos målet %s" + +#: elf32-sh64.c:461 elf64-sh64.c:2990 +#, c-format +msgid "%s: encountered datalabel symbol in input" +msgstr "%s: påträffade dataetikettssymbol i indata" + +#: elf32-sh64.c:544 +msgid "PTB mismatch: a SHmedia address (bit 0 == 1)" +msgstr "PTB passar inte: en SHmedia-adress (bit 0 == 1)" + +#: elf32-sh64.c:547 +msgid "PTA mismatch: a SHcompact address (bit 0 == 0)" +msgstr "PTA passar inte: en SHcompact-adress (bit 0 == 0)" + +#: elf32-sh64.c:565 +#, c-format +msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16" +msgstr "%s: GAS-fel: oväntad PTB-instruktion med R_SH_PT_16" + +#: elf32-sh64.c:614 elf64-sh64.c:1748 +#, c-format +msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n" +msgstr "%s: fel: ojusterad omlokaliseringstyp %d på %08x omlokalisering %08x\n" + +#: elf32-sh64.c:698 +#, c-format +msgid "%s: could not write out added .cranges entries" +msgstr "%s: kunde inte skriva ut tillagda .cranges-poster" + +#: elf32-sh64.c:760 +#, c-format +msgid "%s: could not write out sorted .cranges entries" +msgstr "%s: kunde inte skriva ut sorterade cranges-poster" + +#: elf32-sparc.c:2521 elf64-sparc.c:2314 +#, c-format +msgid "%s: probably compiled without -fPIC?" +msgstr "%s: troligen kompilerad utan -fPIC?" + +#: elf32-sparc.c:3348 +#, c-format +msgid "%s: compiled for a 64 bit system and target is 32 bit" +msgstr "%s: kompilerat för ett 64-bitarssystem och målet är 32-bitars" + +#: elf32-sparc.c:3362 +#, c-format +msgid "%s: linking little endian files with big endian files" +msgstr "%s: länkar little endian-filer med big endian-filer" + +#: elf32-v850.c:753 +#, c-format +msgid "Variable `%s' cannot occupy in multiple small data regions" +msgstr "Variabel \"%s\" kan inte befinna sig i flera små dataområden" + +#: elf32-v850.c:756 +#, c-format +msgid "Variable `%s' can only be in one of the small, zero, and tiny data regions" +msgstr "Variabel \"%s\" kan bara vara i ett av de små, tomma och pyttesmå dataområdena" + +#: elf32-v850.c:759 +#, c-format +msgid "Variable `%s' cannot be in both small and zero data regions simultaneously" +msgstr "Variabel \"%s\" kan inte vara i både små och tomma dataområden samtidigt" + +#: elf32-v850.c:762 +#, c-format +msgid "Variable `%s' cannot be in both small and tiny data regions simultaneously" +msgstr "Variabel \"%s\" kan inte vara i både små och pyttesmå dataområden samtidigt" + +#: elf32-v850.c:765 +#, c-format +msgid "Variable `%s' cannot be in both zero and tiny data regions simultaneously" +msgstr "Variabel \"%s\" kan inte vara i både tomma och pyttesmå dataområden samtidigt" + +#: elf32-v850.c:1144 +msgid "FAILED to find previous HI16 reloc\n" +msgstr "MISSLYCKADES med att hitta tidigare HI16-omlokalisering\n" + +#: elf32-v850.c:1789 +msgid "could not locate special linker symbol __gp" +msgstr "kunde inte lokalisera speciell länkarsymbol __gp" + +#: elf32-v850.c:1793 +msgid "could not locate special linker symbol __ep" +msgstr "kunde inte lokalisera speciell länkarsymbol __ep" + +#: elf32-v850.c:1797 +msgid "could not locate special linker symbol __ctbp" +msgstr "kunde inte lokalisera speciell länkarsymbol __ctbp" + +#: elf32-v850.c:1963 +#, c-format +msgid "%s: Architecture mismatch with previous modules" +msgstr "%s: Arkitekturen passar inte ihop med tidigare moduler" + +#: elf32-v850.c:1983 +#, c-format +msgid "private flags = %lx: " +msgstr "privata flaggor = %lx: " + +#: elf32-v850.c:1988 +msgid "v850 architecture" +msgstr "v850-arkitektur" + +#: elf32-v850.c:1989 +msgid "v850e architecture" +msgstr "v850e-arkitektur" + +#: elf32-vax.c:549 +msgid " [nonpic]" +msgstr " [icke-pic]" + +#: elf32-vax.c:552 +msgid " [d-float]" +msgstr " [d-flyttal]" + +#: elf32-vax.c:555 +msgid " [g-float]" +msgstr " [g-flyttal]" + +#: elf32-vax.c:663 +#, c-format +msgid "%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of %ld" +msgstr "%s: varning: GOT-addendum %ld till \"%s\" stämmer inte överens med tidigare GOT-addendum %ld" + +#: elf32-vax.c:1667 +#, c-format +msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored" +msgstr "%s: varning: PLT-addendum %d till \"%s\" från sektionen %s ignorerades" + +#: elf32-vax.c:1802 +#, c-format +msgid "%s: warning: %s relocation against symbol `%s' from %s section" +msgstr "%s: varning: %s-omlokalisering mot symbolen \"%s\" från sektionen %s" + +#: elf32-vax.c:1808 +#, c-format +msgid "%s: warning: %s relocation to 0x%x from %s section" +msgstr "%s: varning: %s-omlokalisering till 0x%x från sektionen %s" + +#: elf32-xstormy16.c:462 elf32-ia64.c:2450 elf64-ia64.c:2450 +msgid "non-zero addend in @fptr reloc" +msgstr "icke-tomt addendum i @fptr-omlokalisering" + +#: elf64-alpha.c:1108 +msgid "GPDISP relocation did not find ldah and lda instructions" +msgstr "GPDISP-omlokalisering hittade inga ldah- och lda-instruktioner" + +#: elf64-alpha.c:3731 +#, c-format +msgid "%s: .got subsegment exceeds 64K (size %d)" +msgstr "%s: .got-subsegment överskrider 64 kB (storlek %d)" + +#: elf64-alpha.c:4602 elf64-alpha.c:4614 +#, c-format +msgid "%s: gp-relative relocation against dynamic symbol %s" +msgstr "%s: gp-relativ omlokalisering mot dynamiska symbolen %s" + +#: elf64-alpha.c:4640 elf64-alpha.c:4773 +#, c-format +msgid "%s: pc-relative relocation against dynamic symbol %s" +msgstr "%s: pc-relativ omlokalisering mot dynamiska symbolen %s" + +#: elf64-alpha.c:4668 +#, c-format +msgid "%s: change in gp: BRSGP %s" +msgstr "%s: ändring i gp: BRSGP %s" + +#: elf64-alpha.c:4693 +msgid "" +msgstr "" + +#: elf64-alpha.c:4698 +#, c-format +msgid "%s: !samegp reloc against symbol without .prologue: %s" +msgstr "%s: !samegp-omlokalisering mot symbol utan .prologue: %s" + +#: elf64-alpha.c:4749 +#, c-format +msgid "%s: unhandled dynamic relocation against %s" +msgstr "%s: ohanterad dynamisk omlokalisering mot %s" + +#: elf64-alpha.c:4832 +#, c-format +msgid "%s: dtp-relative relocation against dynamic symbol %s" +msgstr "%s: dtp-relativ omlokalisering mot dynamiska symbolen %s" + +#: elf64-alpha.c:4855 +#, c-format +msgid "%s: tp-relative relocation against dynamic symbol %s" +msgstr "%s: tp-relativ omlokalisering mot dynamiska symbolen %s" + +#: elf64-hppa.c:2086 +#, c-format +msgid "stub entry for %s cannot load .plt, dp offset = %ld" +msgstr "stubbpost för %s kan inte läsa in .plt, dp-avstånd = %ld" + +#: elf64-mmix.c:1032 +#, c-format +msgid "" +"%s: Internal inconsistency error for value for\n" +" linker-allocated global register: linked: 0x%lx%08lx != relaxed: 0x%lx%08lx\n" +msgstr "" +"%s: Intern inkkonsistensfel för värdet för\n" +" länkarallokerat globalt register: länkat: 0x%lx%08lx != avslappnat: 0x%lx%08lx\n" + +#: elf64-mmix.c:1416 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: (unknown) in %s" +msgstr "%s: bas-plus-avståndsomlokalisering mot registersymbol: (okänd) i %s" + +#: elf64-mmix.c:1421 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: %s in %s" +msgstr "%s: bas-plus-avståndsomlokalisering mot registersymbol: %s i %s" + +#: elf64-mmix.c:1465 +#, c-format +msgid "%s: register relocation against non-register symbol: (unknown) in %s" +msgstr "%s: registeromlokalisering mot icke-registersymbol: (okänd) i %s" + +#: elf64-mmix.c:1470 +#, c-format +msgid "%s: register relocation against non-register symbol: %s in %s" +msgstr "%s: registeromlokalisering mot icke-registersymbol: %s i %s" + +#: elf64-mmix.c:1507 +#, c-format +msgid "%s: directive LOCAL valid only with a register or absolute value" +msgstr "%s: LOCAL-direktivet är endast giltigt med ett register eller absolutvärde" + +#: elf64-mmix.c:1535 +#, c-format +msgid "%s: LOCAL directive: Register $%ld is not a local register. First global register is $%ld." +msgstr "%s: LOCAL-direktiv: Register $%ld är inte ett lokalt register. Första globala registret är $%ld." + +#: elf64-mmix.c:1994 +#, c-format +msgid "%s: Error: multiple definition of `%s'; start of %s is set in a earlier linked file\n" +msgstr "%s: Fel: flera definitioner av \"%s\"; början på %s är inställd i en tidigare länkad fil\n" + +#: elf64-mmix.c:2053 +msgid "Register section has contents\n" +msgstr "Registersektion har innehåll\n" + +#: elf64-mmix.c:2216 +#, c-format +msgid "" +"Internal inconsistency: remaining %u != max %u.\n" +" Please report this bug." +msgstr "" +"Intern inkonsekvens: återstående %u != max %u.\n" +" Rapportera gärna detta fel." + +#: elf64-ppc.c:2388 libbfd.c:831 +#, c-format +msgid "%s: compiled for a big endian system and target is little endian" +msgstr "%s: kompilerad för big endian-system och målet är little endian" + +#: elf64-ppc.c:2391 libbfd.c:833 +#, c-format +msgid "%s: compiled for a little endian system and target is big endian" +msgstr "%s: kompilerad för ett little endian-system och målet är big endian" + +#: elf64-ppc.c:4857 +#, c-format +msgid "%s: unexpected reloc type %u in .opd section" +msgstr "%s: oväntad omlokaliseringstyp %u i .opd-sektion" + +#: elf64-ppc.c:4877 +#, c-format +msgid "%s: .opd is not a regular array of opd entries" +msgstr "%s: .opd är inte en vanlig vektor med opd-poster" + +#: elf64-ppc.c:4897 +#, c-format +msgid "%s: undefined sym `%s' in .opd section" +msgstr "%s: odefinierad symbol \"%s\" i .opd-sektion" + +#: elf64-ppc.c:6136 +#, c-format +msgid "can't find branch stub `%s'" +msgstr "kan inte hitta grenstubb \"%s\"" + +#: elf64-ppc.c:6175 elf64-ppc.c:6250 +#, c-format +msgid "linkage table error against `%s'" +msgstr "länktabellsfel mot \"%s\"" + +#: elf64-ppc.c:6340 +#, c-format +msgid "can't build branch stub `%s'" +msgstr "kan inte bygga grenstubb \"%s\"" + +#: elf64-ppc.c:7047 +msgid ".glink and .plt too far apart" +msgstr ".glink och .plt för långt ifrån varandra" + +#: elf64-ppc.c:7135 +msgid "stubs don't match calculated size" +msgstr "stubbar stämmer inte överens med beräknad storlek" + +#: elf64-ppc.c:7147 +#, c-format +msgid "" +"linker stubs in %u groups\n" +" branch %lu\n" +" toc adjust %lu\n" +" long branch %lu\n" +" long toc adj %lu\n" +" plt call %lu" +msgstr "" +"länkarstubbar i %u grupper\n" +" gren %lu\n" +" toc-justering %lu\n" +" lång gren %lu\n" +" lång toc-just. %lu\n" +" plt-anrop %lu" + +#: elf64-ppc.c:7723 +#, c-format +msgid "%s(%s+0x%lx): automatic multiple TOCs not supported using your crt files; recompile with -mminimal-toc or upgrade gcc" +msgstr "%s(%s+0x%lx): flera automatiska TOC stöds inte vid användning av dina crt-filer; kompilera om med -mminimal-toc eller uppgradera gcc" + +#: elf64-ppc.c:7731 +#, c-format +msgid "%s(%s+0x%lx): sibling call optimization to `%s' does not allow automatic multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, or make `%s' extern" +msgstr "%s(%s+0x%lx): syskonanropsoptimering till \"%s\" stöder inte flera automatiska TOC; kompilera om med -mminimal-toc eller -fno-optimize-sibling-calls, eller gör \"%s\" extern" + +#: elf64-ppc.c:8329 +#, c-format +msgid "%s: relocation %s is not supported for symbol %s." +msgstr "%s: omlokaliseringen %s stöds inte för symbolen %s." + +#: elf64-ppc.c:8408 +#, c-format +msgid "%s: error: relocation %s not a multiple of %d" +msgstr "%s: fel: omlokaliseringen %s är inte en multipel av %d" + +#: elf64-sparc.c:1370 +#, c-format +msgid "%s: check_relocs: unhandled reloc type %d" +msgstr "%s: check_relocs: ohanterad omlokaliseringstyp %d" + +#: elf64-sparc.c:1407 +#, c-format +msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER" +msgstr "%s: Endast register %%g[2367] kan deklareras med STT_REGISTER" + +#: elf64-sparc.c:1427 +#, c-format +msgid "Register %%g%d used incompatibly: %s in %s, previously %s in %s" +msgstr "Register %%g%d används inkompatibelt: %s i %s, tidigare %s i %s" + +#: elf64-sparc.c:1450 +#, c-format +msgid "Symbol `%s' has differing types: REGISTER in %s, previously %s in %s" +msgstr "Symbolen \"%s\" har olika typer: REGISTER i %s, tidigare %s i %s" + +#: elf64-sparc.c:1496 +#, c-format +msgid "Symbol `%s' has differing types: %s in %s, previously REGISTER in %s" +msgstr "Symbolen \"%s\" har olika typer: %s i %s, tidigare REGISTER i %s" + +#: elf64-sparc.c:3053 +#, c-format +msgid "%s: linking UltraSPARC specific with HAL specific code" +msgstr "%s: länkar UltraSPARC-specifik med HAL-specifik kod" + +#: elf64-x86-64.c:739 +#, c-format +msgid "%s: %s' accessed both as normal and thread local symbol" +msgstr "%s: \"%s\" anropad både som lokal normal symbol och lokal trådsymbol" + +#: elfcode.h:1113 +#, c-format +msgid "%s: version count (%ld) does not match symbol count (%ld)" +msgstr "%s: versionsantal (%ld) stämmer inte med symbolantal (%ld)" + +#: elfcode.h:1342 +#, c-format +msgid "%s(%s): relocation %d has invalid symbol index %ld" +msgstr "%s(%s): omlokalisering %d har ogiltigt symbolindex %ld" + +#: elflink.c:1456 +#, c-format +msgid "%s: warning: unexpected redefinition of indirect versioned symbol `%s'" +msgstr "%s: varning: oväntad omdefinition av indirekt versionsangiven symbol \"%s\"" + +#: elflink.c:1807 +#, c-format +msgid "%s: undefined versioned symbol name %s" +msgstr "%s: odefinierat symbolnamn med version %s" + +#: elflink.c:2142 +#, c-format +msgid "%s: relocation size mismatch in %s section %s" +msgstr "%s: omlokaliseringsstorleken stämmer inte överens i %s, sektion %s" + +#: elflink.c:2434 +#, c-format +msgid "warning: type and size of dynamic symbol `%s' are not defined" +msgstr "varning: typen och storleken på dynamiska symbolen \"%s\" är inte definierade" + +#: elflink.h:1022 +#, c-format +msgid "%s: %s: invalid version %u (max %d)" +msgstr "%s: %s: ogiltig version %u (max %d)" + +#: elflink.h:1063 +#, c-format +msgid "%s: %s: invalid needed version %d" +msgstr "%s: %s: ogiltig krävd version %d" + +#: elflink.h:1238 +#, c-format +msgid "Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s" +msgstr "Varning: justeringen %u på symbolen \"%s\" i %s är mindre än %u i %s" + +#: elflink.h:1252 +#, c-format +msgid "Warning: size of symbol `%s' changed from %lu in %s to %lu in %s" +msgstr "Varning: storleken på symbolen \"%s\" ändrades från %lu i %s till %lu i %s" + +#: elflink.h:2160 +#, c-format +msgid "%s: undefined version: %s" +msgstr "%s: odefinierad version: %s" + +#: elflink.h:2226 +#, c-format +msgid "%s: .preinit_array section is not allowed in DSO" +msgstr "%s: .preinit_array-sektionen är inte tillåten i DSO" + +#: elflink.h:3078 +msgid "Not enough memory to sort relocations" +msgstr "Inte tillräckligt med minne för att sortera omlokaliseringar" + +#: elflink.h:3958 elflink.h:4001 +#, c-format +msgid "%s: could not find output section %s" +msgstr "%s: kunde inte hitta utdatasektionen %s" + +#: elflink.h:3964 +#, c-format +msgid "warning: %s section has zero size" +msgstr "varning: sektionen %s har nollstorlek" + +#: elflink.h:4483 +#, c-format +msgid "%s: %s symbol `%s' in %s is referenced by DSO" +msgstr "%s: %s-symbolen \"%s\" i %s refereras till av DSO" + +#: elflink.h:4564 +#, c-format +msgid "%s: could not find output section %s for input section %s" +msgstr "%s: kunde inte hitta utdatasektionen %s för indatasektionen %s" + +#: elflink.h:4666 +#, c-format +msgid "%s: %s symbol `%s' isn't defined" +msgstr "%s: %s-symbolen \"%s\" är inte definierad" + +#: elflink.h:5053 elflink.h:5095 +msgid "%T: discarded in section `%s' from %s\n" +msgstr "%T: bortkastade i sektionen \"%s\" från %s\n" + +#: elfxx-mips.c:887 +msgid "static procedure (no name)" +msgstr "statisk procedur (inget namn)" + +#: elfxx-mips.c:1897 +msgid "not enough GOT space for local GOT entries" +msgstr "inte tillräckligt med GOT-utrymme för lokala GOT-poster" + +#: elfxx-mips.c:3691 +#, c-format +msgid "%s: %s+0x%lx: jump to stub routine which is not jal" +msgstr "%s: %s+0x%lx: hoppa till stubbrutin som inte är jal" + +#: elfxx-mips.c:5192 +#, c-format +msgid "%s: Malformed reloc detected for section %s" +msgstr "%s: Felaktig omlokalisering för sektion %s upptäckt" + +#: elfxx-mips.c:5266 +#, c-format +msgid "%s: CALL16 reloc at 0x%lx not against global symbol" +msgstr "%s: CALL16-omlokalisering vid 0x%lx är inte mot global symbol" + +#: elfxx-mips.c:8692 +#, c-format +msgid "%s: illegal section name `%s'" +msgstr "%s: ogiltigt sektionsnamn \"%s\"" + +#: elfxx-mips.c:9025 +#, c-format +msgid "%s: endianness incompatible with that of the selected emulation" +msgstr "%s: endianness inkompatibel med den för den valda emuleringen" + +#: elfxx-mips.c:9037 +#, c-format +msgid "%s: ABI is incompatible with that of the selected emulation" +msgstr "%s: ABI är inkompatibelt med den för den valda emuleringen" + +#: elfxx-mips.c:9104 +#, c-format +msgid "%s: warning: linking PIC files with non-PIC files" +msgstr "%s: varning: länkar PIC-filer med icke-PIC-filer" + +#: elfxx-mips.c:9121 +#, c-format +msgid "%s: linking 32-bit code with 64-bit code" +msgstr "%s: länkar 32-bitarskod med 64-bitarskod" + +#: elfxx-mips.c:9149 +#, c-format +msgid "%s: linking %s module with previous %s modules" +msgstr "%s: länkar %s-modul med tidigare %s-moduler" + +#: elfxx-mips.c:9172 +#, c-format +msgid "%s: ABI mismatch: linking %s module with previous %s modules" +msgstr "%s: ABI passar inte: länkar %s-modul med tidigare %s-moduler" + +#: elfxx-mips.c:9241 +msgid " [abi=O32]" +msgstr " [abi=O32]" + +#: elfxx-mips.c:9243 +msgid " [abi=O64]" +msgstr " [abi=O64]" + +#: elfxx-mips.c:9245 +msgid " [abi=EABI32]" +msgstr " [abi=EABI32]" + +#: elfxx-mips.c:9247 +msgid " [abi=EABI64]" +msgstr " [abi=EABI64]" + +#: elfxx-mips.c:9249 +msgid " [abi unknown]" +msgstr " [okänt abi]" + +#: elfxx-mips.c:9251 +msgid " [abi=N32]" +msgstr " [abi=N32]" + +#: elfxx-mips.c:9253 +msgid " [abi=64]" +msgstr " [abi=64]" + +#: elfxx-mips.c:9255 +msgid " [no abi set]" +msgstr " [inget abi inställt]" + +#: elfxx-mips.c:9258 +msgid " [mips1]" +msgstr " [mips1]" + +#: elfxx-mips.c:9260 +msgid " [mips2]" +msgstr " [mips2]" + +#: elfxx-mips.c:9262 +msgid " [mips3]" +msgstr " [mips3]" + +#: elfxx-mips.c:9264 +msgid " [mips4]" +msgstr " [mips4]" + +#: elfxx-mips.c:9266 +msgid " [mips5]" +msgstr " [mips5]" + +#: elfxx-mips.c:9268 +msgid " [mips32]" +msgstr " [mips32]" + +#: elfxx-mips.c:9270 +msgid " [mips64]" +msgstr " [mips64]" + +#: elfxx-mips.c:9272 +msgid " [mips32r2]" +msgstr " [mips32r2]" + +#: elfxx-mips.c:9274 +msgid " [unknown ISA]" +msgstr " [okänd ISA]" + +#: elfxx-mips.c:9277 +msgid " [mdmx]" +msgstr " [mdmx]" + +#: elfxx-mips.c:9280 +msgid " [mips16]" +msgstr " [mips16]" + +#: elfxx-mips.c:9283 +msgid " [32bitmode]" +msgstr " [32-bitarsläge]" + +#: elfxx-mips.c:9285 +msgid " [not 32bitmode]" +msgstr " [inte 32-bitarsläge]" + +#: i386linux.c:457 m68klinux.c:461 sparclinux.c:458 +#, c-format +msgid "Output file requires shared library `%s'\n" +msgstr "Utdatafilen kräver delade biblioteket \"%s\"\n" + +#: i386linux.c:465 m68klinux.c:469 sparclinux.c:466 +#, c-format +msgid "Output file requires shared library `%s.so.%s'\n" +msgstr "Utdatafilen kräver delade biblioteket \"%s.so.%s\"\n" + +#: i386linux.c:654 i386linux.c:704 m68klinux.c:661 m68klinux.c:709 +#: sparclinux.c:656 sparclinux.c:706 +#, c-format +msgid "Symbol %s not defined for fixups\n" +msgstr "Symbolen %s är inte definierad för fixar\n" + +#: i386linux.c:728 m68klinux.c:733 sparclinux.c:730 +msgid "Warning: fixup count mismatch\n" +msgstr "Varning: antalet fixar stämmer inte\n" + +#: ieee.c:293 +#, c-format +msgid "%s: string too long (%d chars, max 65535)" +msgstr "%s: strängen är för lång (%d tecken, max 65535)" + +#: ieee.c:428 +#, c-format +msgid "%s: unrecognized symbol `%s' flags 0x%x" +msgstr "%s: okänd symbol \"%s\" flaggor 0x%x" + +#: ieee.c:938 +#, c-format +msgid "%s: unimplemented ATI record %u for symbol %u" +msgstr "%s: inte implementerad ATI-post %u för symbolen %u" + +#: ieee.c:963 +#, c-format +msgid "%s: unexpected ATN type %d in external part" +msgstr "%s: oväntad ATN-typ %d i extern del" + +#: ieee.c:985 +#, c-format +msgid "%s: unexpected type after ATN" +msgstr "%s: oväntad typ efter ATN" + +#: ihex.c:264 +#, c-format +msgid "%s:%d: unexpected character `%s' in Intel Hex file\n" +msgstr "%s:%d: oväntat tecken \"%s\" i hexadecimal Intel-fil\n" + +#: ihex.c:372 +#, c-format +msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)" +msgstr "%s:%u: felaktig kontrollsumma i hexadecimal Intel-fil (förväntade %u, hittade %u)" + +#: ihex.c:426 +#, c-format +msgid "%s:%u: bad extended address record length in Intel Hex file" +msgstr "%s:%u: felaktig längd på post för utökad adress i hexadecimal Intel-fil" + +#: ihex.c:443 +#, c-format +msgid "%s:%u: bad extended start address length in Intel Hex file" +msgstr "%s:%u: felaktig längd på utökad startadress i hexadecimal Intel-fil" + +#: ihex.c:460 +#, c-format +msgid "%s:%u: bad extended linear address record length in Intel Hex file" +msgstr "%s:%u: felaktig längd på post för utökad linjär adress i hexadecimal Intel-fil" + +#: ihex.c:477 +#, c-format +msgid "%s:%u: bad extended linear start address length in Intel Hex file" +msgstr "%s:%u: felaktig längd på post för utökad linjär startadress i hexadecimal Intel-fil" + +#: ihex.c:494 +#, c-format +msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n" +msgstr "%s:%u: okänd ihex-typ %u i hexadecimal Intel-fil\n" + +#: ihex.c:619 +#, c-format +msgid "%s: internal error in ihex_read_section" +msgstr "%s: internt fel i ihex_read_section" + +#: ihex.c:654 +#, c-format +msgid "%s: bad section length in ihex_read_section" +msgstr "%s: felaktig sektionslängd i ihex_read_sektion" + +#: ihex.c:872 +#, c-format +msgid "%s: address 0x%s out of range for Intel Hex file" +msgstr "%s: adressen 0x%s är utanför intervallet för hexadecimal Intel-fil" + +#: libbfd.c:861 +#, c-format +msgid "Deprecated %s called at %s line %d in %s\n" +msgstr "Föråldrad %s anropad vid %s rad %d i %s\n" + +#: libbfd.c:864 +#, c-format +msgid "Deprecated %s called\n" +msgstr "Föråldrad %s anropad\n" + +#: linker.c:1829 +#, c-format +msgid "%s: indirect symbol `%s' to `%s' is a loop" +msgstr "%s: indirekt symbol \"%s\" till \"%s\" är en slinga" + +#: linker.c:2697 +#, c-format +msgid "Attempt to do relocatable link with %s input and %s output" +msgstr "Försök att göra en omlokaliseringsbar länk med %s-indata och %s-utdata" + +#: merge.c:896 +#, c-format +msgid "%s: access beyond end of merged section (%ld + %ld)" +msgstr "%s: åtkomst bortom slut på sammanslagen sektion (%ld + %ld)" + +#: mmo.c:503 +#, c-format +msgid "%s: No core to allocate section name %s\n" +msgstr "%s: Ingen kärna för att allokera sektionsnamn %s\n" + +#: mmo.c:579 +#, c-format +msgid "%s: No core to allocate a symbol %d bytes long\n" +msgstr "%s: Ingen kärna för att allokera en %d byte lång symbol\n" + +#: mmo.c:1287 +#, c-format +msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n" +msgstr "%s: ogiltig mmo-fil: initieringsvärde för $255 är inte \"Main\"\n" + +#: mmo.c:1433 +#, c-format +msgid "%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name starting with `%s'\n" +msgstr "%s: bred teckensekvens som inte stöds 0x%02X 0x%02X efter symbolnamnet som börjar med \"%s\"\n" + +#: mmo.c:1674 +#, c-format +msgid "%s: invalid mmo file: unsupported lopcode `%d'\n" +msgstr "%s: ogiltig mmo-fil: lopkod \"%d\" stöds inte\n" + +#: mmo.c:1684 +#, c-format +msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n" +msgstr "%s: ogiltig mmo-fil: förväntade YZ = 1 fick YZ = %d för lop_quote\n" + +#: mmo.c:1720 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n" +msgstr "%s: ogiltig mmo-fil: förväntade z = 1 eller z = 2, fick z = %d för lop_loc\n" + +#: mmo.c:1766 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n" +msgstr "%s: ogiltig mmo-fil: förväntade z = 1 eller z = 2, fick z = %d för lop_fixo\n" + +#: mmo.c:1805 +#, c-format +msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n" +msgstr "%s: ogiltig mmo-fil: förväntade y = 0, fick y = %d för lop_fixrx\n" + +#: mmo.c:1814 +#, c-format +msgid "%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n" +msgstr "%s: ogiltig mmo-fil: förväntade z = 16 eller z = 24, fick z = %d för lop_fixr\n" + +#: mmo.c:1837 +#, c-format +msgid "%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d for lop_fixrx\n" +msgstr "%s: ogiltig mmo-fil: inledande byte i operandord måste vara 0 eller 1, fick %d för lop_fixrx\n" + +#: mmo.c:1860 +#, c-format +msgid "%s: cannot allocate file name for file number %d, %d bytes\n" +msgstr "%s: kan inte allokera filnamn för fil nummer %d, %d byte\n" + +#: mmo.c:1880 +#, c-format +msgid "%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n" +msgstr "%s: ogiltig mmo-fil: fil nummer %d \"%s\", var redan angiven som \"%s\"\n" + +#: mmo.c:1893 +#, c-format +msgid "%s: invalid mmo file: file name for number %d was not specified before use\n" +msgstr "%s: ogiltig mmo-fil: filnamnet för nummer %d angavs inte innan användning\n" + +#: mmo.c:1999 +#, c-format +msgid "%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n" +msgstr "%s: ogiltig mmo-fil: fälten y och z i lop_stab är icke-tomma, y: %d, z: %d\n" + +#: mmo.c:2035 +#, c-format +msgid "%s: invalid mmo file: lop_end not last item in file\n" +msgstr "%s: ogiltig mmo-fil: lop_end är inte sista objektet i fil\n" + +#: mmo.c:2048 +#, c-format +msgid "%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras to the preceding lop_stab (%ld)\n" +msgstr "%s: ogiltig mmo-fil: YZ i lop_end (%ld) är inte lika med antalet tetra till den föregående lop_stab (%ld)\n" + +#: mmo.c:2698 +#, c-format +msgid "%s: invalid symbol table: duplicate symbol `%s'\n" +msgstr "%s: ogiltig symboltabell: dublettsymbol \"%s\"\n" + +#: mmo.c:2949 +#, c-format +msgid "%s: Bad symbol definition: `Main' set to %s rather than the start address %s\n" +msgstr "%s: Felaktig symboldefinition: \"Main\" är inställd till %s istället för startadressen %s\n" + +#: mmo.c:3039 +#, c-format +msgid "%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: %d. Only `Main' will be emitted.\n" +msgstr "%s: varning: symboltabellen är för stor för mmo, större än 65535 32-bitars ord: %d. Endast \"Main\" kommer att skickas.\n" + +#: mmo.c:3084 +#, c-format +msgid "%s: internal error, symbol table changed size from %d to %d words\n" +msgstr "%s: internt fel, symboltabellen ändrade storlek från %d till %d ord\n" + +#: mmo.c:3139 +#, c-format +msgid "%s: internal error, internal register section %s had contents\n" +msgstr "%s: internt fel, interna registersektionen %s hade innehåll\n" + +#: mmo.c:3191 +#, c-format +msgid "%s: no initialized registers; section length 0\n" +msgstr "%s: inga initierade register; sektionslängd 0\n" + +#: mmo.c:3197 +#, c-format +msgid "%s: too many initialized registers; section length %ld\n" +msgstr "%s: för många initierade register; sektionslängd %ld\n" + +#: mmo.c:3202 +#, c-format +msgid "%s: invalid start address for initialized registers of length %ld: 0x%lx%08lx\n" +msgstr "%s: ogiltig startadress för initierade register med längden %ld: 0x%lx%08lx\n" + +#: oasys.c:1052 +#, c-format +msgid "%s: can not represent section `%s' in oasys" +msgstr "%s: kan inte representera sektionen \"%s\" i oasys" + +#: osf-core.c:137 +#, c-format +msgid "Unhandled OSF/1 core file section type %d\n" +msgstr "Ohanterad sektionstyp %d för OSF/1-minnesfil\n" + +#: pe-mips.c:659 +#, c-format +msgid "%s: `ld -r' not supported with PE MIPS objects\n" +msgstr "%s: \"ld -r\" stöds inte med PE MIPS-objekt\n" + +#. OK, at this point the following variables are set up: +#. src = VMA of the memory we're fixing up +#. mem = pointer to memory we're fixing up +#. val = VMA of what we need to refer to +#. +#: pe-mips.c:795 +#, c-format +msgid "%s: unimplemented %s\n" +msgstr "%s: oimplementerat %s\n" + +#: pe-mips.c:821 +#, c-format +msgid "%s: jump too far away\n" +msgstr "%s: hopp för långt bort\n" + +#: pe-mips.c:848 +#, c-format +msgid "%s: bad pair/reflo after refhi\n" +msgstr "%s: felaktigt par/reflo efter refhi\n" + +#. XXX code yet to be written. +#: peicode.h:787 +#, c-format +msgid "%s: Unhandled import type; %x" +msgstr "%s: Ohanterad importtyp; %x" + +#: peicode.h:792 +#, c-format +msgid "%s: Unrecognised import type; %x" +msgstr "%s: Okänd importtyp; %x" + +#: peicode.h:806 +#, c-format +msgid "%s: Unrecognised import name type; %x" +msgstr "%s: Okänd importnamnstyp; %x" + +#: peicode.h:1164 +#, c-format +msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive" +msgstr "%s: Okänd maskintyp (0x%x) i Import Library Format-arkiv" + +#: peicode.h:1176 +#, c-format +msgid "%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive" +msgstr "%s: Känd men ohanterad maskintyp (0x%x) i Import Library Format-arkiv" + +#: peicode.h:1193 +#, c-format +msgid "%s: size field is zero in Import Library Format header" +msgstr "%s: storleksfältet är noll i Import Library Format-huvud" + +#: peicode.h:1224 +#, c-format +msgid "%s: string not null terminated in ILF object file." +msgstr "%s: sträng inte nollterminerad i ILF-objektfil." + +#: ppcboot.c:416 +msgid "" +"\n" +"ppcboot header:\n" +msgstr "" +"\n" +"ppcboot-huvud:\n" + +#: ppcboot.c:417 +#, c-format +msgid "Entry offset = 0x%.8lx (%ld)\n" +msgstr "Startavstånd = 0x%.8lx (%ld)\n" + +#: ppcboot.c:418 +#, c-format +msgid "Length = 0x%.8lx (%ld)\n" +msgstr "Längd = 0x%.8lx (%ld)\n" + +#: ppcboot.c:421 +#, c-format +msgid "Flag field = 0x%.2x\n" +msgstr "Flaggfält = 0x%.2x\n" + +#: ppcboot.c:427 +#, c-format +msgid "Partition name = \"%s\"\n" +msgstr "Partitionsnamn = \"%s\"\n" + +#: ppcboot.c:446 +#, c-format +msgid "" +"\n" +"Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "" +"\n" +"Start på partition[%d] = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:452 +#, c-format +msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "Slut på partition[%d] = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:458 +#, c-format +msgid "Partition[%d] sector = 0x%.8lx (%ld)\n" +msgstr "Sektor för partition[%d] = 0x%.8lx (%ld)\n" + +#: ppcboot.c:459 +#, c-format +msgid "Partition[%d] length = 0x%.8lx (%ld)\n" +msgstr "Längd på partition[%d] = 0x%.8lx (%ld)\n" + +#: som.c:5422 +msgid "som_sizeof_headers unimplemented" +msgstr "som_sizeof_headers är inte implementerat" + +#: srec.c:302 +#, c-format +msgid "%s:%d: Unexpected character `%s' in S-record file\n" +msgstr "%s:%d: Oväntat tecken \"%s\" i S-postfil\n" + +# Vad är stabs? +#: stabs.c:319 +#, c-format +msgid "%s(%s+0x%lx): Stabs entry has invalid string index." +msgstr "%s(%s+0x%lx): Stabbpost har ogiltigt strängindex." + +#: syms.c:1019 +msgid "Unsupported .stab relocation" +msgstr ".stab-omlokalisering som inte stöds" + +#: vms-gsd.c:356 +#, c-format +msgid "bfd_make_section (%s) failed" +msgstr "bfd_make_section (%s) misslyckades" + +#: vms-gsd.c:371 +#, c-format +msgid "bfd_set_section_flags (%s, %x) failed" +msgstr "bfd_set_section_flags (%s, %x) misslyckades" + +#: vms-gsd.c:407 +#, c-format +msgid "Size mismatch section %s=%lx, %s=%lx" +msgstr "Storleken passar inte på sektion %s=%lx, %s=%lx" + +#: vms-gsd.c:704 +#, c-format +msgid "unknown gsd/egsd subtype %d" +msgstr "okänd gsd/egsd-undertyp %d" + +#: vms-hdr.c:408 +msgid "Object module NOT error-free !\n" +msgstr "Objektmodulen INTE felfri!\n" + +#: vms-misc.c:541 +#, c-format +msgid "Stack overflow (%d) in _bfd_vms_push" +msgstr "Stacken ger överspill (%d) i _bfd_vms_push" + +#: vms-misc.c:559 +msgid "Stack underflow in _bfd_vms_pop" +msgstr "Stacken ger underspill i _bfd_vms_pop" + +#: vms-misc.c:918 +msgid "_bfd_vms_output_counted called with zero bytes" +msgstr "_bfd_vms_output_counted anropad med noll byte" + +#: vms-misc.c:923 +msgid "_bfd_vms_output_counted called with too many bytes" +msgstr "_bfd_vms_output_counted called anropad med för många byte" + +#: vms-misc.c:1054 +#, c-format +msgid "Symbol %s replaced by %s\n" +msgstr "Symbolen %s ersatt med %s\n" + +#: vms-misc.c:1117 +#, c-format +msgid "failed to enter %s" +msgstr "misslyckades med att gå in i %s" + +#: vms-tir.c:102 +msgid "No Mem !" +msgstr "Inget minne!" + +#: vms-tir.c:383 +#, c-format +msgid "bad section index in %s" +msgstr "felaktigt sektionsindex i %s" + +#: vms-tir.c:396 +#, c-format +msgid "unsupported STA cmd %s" +msgstr "STA-kommando %s stöds inte" + +#: vms-tir.c:401 vms-tir.c:1261 +#, c-format +msgid "reserved STA cmd %d" +msgstr "reserverat STA-kommando %d" + +#: vms-tir.c:512 vms-tir.c:535 +#, c-format +msgid "%s: no symbol \"%s\"" +msgstr "%s: ingen symbol \"%s\"" + +#. unsigned shift +#. rotate +#. Redefine symbol to current location. +#. Define a literal. +#: vms-tir.c:602 vms-tir.c:714 vms-tir.c:824 vms-tir.c:842 vms-tir.c:850 +#: vms-tir.c:859 vms-tir.c:1584 +#, c-format +msgid "%s: not supported" +msgstr "%s: stöds inte" + +#: vms-tir.c:607 vms-tir.c:1439 +#, c-format +msgid "%s: not implemented" +msgstr "%s: inte implementerad" + +#: vms-tir.c:611 vms-tir.c:1443 +#, c-format +msgid "reserved STO cmd %d" +msgstr "reserverat STO-kommando %d" + +#: vms-tir.c:729 vms-tir.c:1589 +#, c-format +msgid "reserved OPR cmd %d" +msgstr "reserverat OPR-kommando %d" + +#: vms-tir.c:797 vms-tir.c:1653 +#, c-format +msgid "reserved CTL cmd %d" +msgstr "reserverat CTL-kommando %d" + +#. stack byte from image +#. arg: none. +#: vms-tir.c:1169 +msgid "stack-from-image not implemented" +msgstr "stack-from-image är inte implementerat" + +#: vms-tir.c:1187 +msgid "stack-entry-mask not fully implemented" +msgstr "stack-entry-mask är inte helt implementerat" + +#. compare procedure argument +#. arg: cs symbol name +#. by argument index +#. da argument descriptor +#. +#. compare argument descriptor with symbol argument (ARG$V_PASSMECH) +#. and stack TRUE (args match) or FALSE (args dont match) value. +#: vms-tir.c:1201 +msgid "PASSMECH not fully implemented" +msgstr "PASSMECH är inte helt implementerat" + +#: vms-tir.c:1220 +msgid "stack-local-symbol not fully implemented" +msgstr "stack-local-symbol är inte helt implementerat" + +#: vms-tir.c:1233 +msgid "stack-literal not fully implemented" +msgstr "stack-literal är inte helt implementerat" + +#: vms-tir.c:1254 +msgid "stack-local-symbol-entry-point-mask not fully implemented" +msgstr "stack-local-symbol-entry-point-mask är inte helt implementerat" + +#: vms-tir.c:1531 vms-tir.c:1543 vms-tir.c:1555 vms-tir.c:1567 vms-tir.c:1632 +#: vms-tir.c:1640 vms-tir.c:1648 +#, c-format +msgid "%s: not fully implemented" +msgstr "%s: inte helt implementerat" + +#: vms-tir.c:1705 +#, c-format +msgid "obj code %d not found" +msgstr "objektkod %d kunde inte hittas" + +#: vms-tir.c:2043 +#, c-format +msgid "SEC_RELOC with no relocs in section %s" +msgstr "SEC_RELOC utan omlokaliseringar i sektion %s" + +#: vms-tir.c:2331 +#, c-format +msgid "Unhandled relocation %s" +msgstr "Ohanterad omlokalisering %s" + +#: xcofflink.c:1244 +#, c-format +msgid "%s: `%s' has line numbers but no enclosing section" +msgstr "%s: \"%s\" har radnummer men ingen inneslutande sektion" + +#: xcofflink.c:1297 +#, c-format +msgid "%s: class %d symbol `%s' has no aux entries" +msgstr "%s: klass %d-symbolen \"%s\" har inga yttre poster" + +#: xcofflink.c:1320 +#, c-format +msgid "%s: symbol `%s' has unrecognized csect type %d" +msgstr "%s: symbolen \"%s\" har okänd csect-typ %d" + +#: xcofflink.c:1332 +#, c-format +msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d" +msgstr "%s: felaktig XTY_ER-symbol \"%s\": klass %d scnum %d scnlen %d" + +#: xcofflink.c:1368 +#, c-format +msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d" +msgstr "%s: XMC_TC0-symbolen \"%s\" är klass %d scnlen %d" + +#: xcofflink.c:1520 +#, c-format +msgid "%s: csect `%s' not in enclosing section" +msgstr "%s: csect \"%s\" är inte i inneslutande sektion" + +#: xcofflink.c:1627 +#, c-format +msgid "%s: misplaced XTY_LD `%s'" +msgstr "%s: felaktigt placerat XTY_LD \"%s\"" + +#: xcofflink.c:1958 +#, c-format +msgid "%s: reloc %s:%d not in csect" +msgstr "%s: omlokaliseringen %s:%d är inte i csect" + +#: xcofflink.c:2095 +#, c-format +msgid "%s: XCOFF shared object when not producing XCOFF output" +msgstr "%s: XCOFF delade objekt när inte XCOFF-utdata produceras" + +#: xcofflink.c:2116 +#, c-format +msgid "%s: dynamic object with no .loader section" +msgstr "%s: dynamiskt objekt utan någon .loader-sektion" + +#: xcofflink.c:2761 +#, c-format +msgid "%s: no such symbol" +msgstr "%s: ingen sådan symbol" + +#: xcofflink.c:2894 +msgid "error: undefined symbol __rtinit" +msgstr "fel: odefinierad symbol __rtinit" + +#: xcofflink.c:3455 +#, c-format +msgid "warning: attempt to export undefined symbol `%s'" +msgstr "varning: försök att exportera odefinierade symbolen \"%s\"" + +#: xcofflink.c:4448 +#, c-format +msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling" +msgstr "TOC ger överspill: 0x%lx > 0x10000; prova -mminimal-toc vid kompilering" + +#: xcofflink.c:5288 xcofflink.c:5755 xcofflink.c:5817 xcofflink.c:6119 +#, c-format +msgid "%s: loader reloc in unrecognized section `%s'" +msgstr "%s: inläsaromlokalisering i okända sektionen \"%s\"" + +#: xcofflink.c:5310 xcofflink.c:6130 +#, c-format +msgid "%s: `%s' in loader reloc but not loader sym" +msgstr "%s: \"%s\" i inläsaromlokalisering men inte inläsarsym" + +#: xcofflink.c:5325 +#, c-format +msgid "%s: loader reloc in read-only section %s" +msgstr "%s: inläsaromlokalisering i skrivskyddade sektionen %s" + +#: elf32-ia64.c:2392 elf64-ia64.c:2392 +msgid "@pltoff reloc against local symbol" +msgstr "@pltoff-omlokalisering mot lokal symbol" + +#: elf32-ia64.c:3804 elf64-ia64.c:3804 +#, c-format +msgid "%s: short data segment overflowed (0x%lx >= 0x400000)" +msgstr "%s: kort datasegment spillde över (0x%lx >= 0x400000)" + +#: elf32-ia64.c:3815 elf64-ia64.c:3815 +#, c-format +msgid "%s: __gp does not cover short data segment" +msgstr "%s: __gp täcker inte kort datasegment" + +#: elf32-ia64.c:4131 elf64-ia64.c:4131 +#, c-format +msgid "%s: linking non-pic code in a shared library" +msgstr "%s: länkar icke-pic-kod i delat bibliotek" + +#: elf32-ia64.c:4164 elf64-ia64.c:4164 +#, c-format +msgid "%s: @gprel relocation against dynamic symbol %s" +msgstr "%s: @gprel-omlokalisering mot dynamiska symbolen %s" + +#: elf32-ia64.c:4224 elf64-ia64.c:4224 +#, c-format +msgid "%s: linking non-pic code in a position independent executable" +msgstr "%s: länkar icke-pic-kod i en positionsoberoende körbar fil" + +#: elf32-ia64.c:4363 elf64-ia64.c:4363 +#, c-format +msgid "%s: @internal branch to dynamic symbol %s" +msgstr "%s: @internal-gren till dynamiska symbolen %s" + +#: elf32-ia64.c:4365 elf64-ia64.c:4365 +#, c-format +msgid "%s: speculation fixup to dynamic symbol %s" +msgstr "%s: spekulationsfix till dynamiska symbolen %s" + +#: elf32-ia64.c:4367 elf64-ia64.c:4367 +#, c-format +msgid "%s: @pcrel relocation against dynamic symbol %s" +msgstr "%s: @pcrel-omlokalisering mot dynamiska symbolen %s" + +#: elf32-ia64.c:4579 elf64-ia64.c:4579 +msgid "unsupported reloc" +msgstr "omlokaliseringen stöds inte" + +#: elf32-ia64.c:4858 elf64-ia64.c:4858 +#, c-format +msgid "%s: linking trap-on-NULL-dereference with non-trapping files" +msgstr "%s: länkar fånga-vid-NULL-dereferens med ickefångande filer" + +#: elf32-ia64.c:4867 elf64-ia64.c:4867 +#, c-format +msgid "%s: linking big-endian files with little-endian files" +msgstr "%s: länkar big endian-filer med little endian-filer" + +#: elf32-ia64.c:4876 elf64-ia64.c:4876 +#, c-format +msgid "%s: linking 64-bit files with 32-bit files" +msgstr "%s: länkar 64-bitarsfiler med 32-bitarsfiler" + +#: elf32-ia64.c:4885 elf64-ia64.c:4885 +#, c-format +msgid "%s: linking constant-gp files with non-constant-gp files" +msgstr "%s: länkar konstant-gp-filer med icke-konstant-gp-filer" + +#: elf32-ia64.c:4895 elf64-ia64.c:4895 +#, c-format +msgid "%s: linking auto-pic files with non-auto-pic files" +msgstr "%s: länkar auto-pic-filer med icke-auto-pic-filer" + +#: peigen.c:985 pepigen.c:985 +#, c-format +msgid "%s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: radnummer ger överspill: 0x%lx > 0xffff" + +#: peigen.c:1002 pepigen.c:1002 +#, c-format +msgid "%s: reloc overflow 1: 0x%lx > 0xffff" +msgstr "%s: omlokalisering ger överspill 1: 0x%lx > 0xffff" + +#: peigen.c:1016 pepigen.c:1016 +msgid "Export Directory [.edata (or where ever we found it)]" +msgstr "Exportkatalog [.edata (eller där vi hittade det)]" + +#: peigen.c:1017 pepigen.c:1017 +msgid "Import Directory [parts of .idata]" +msgstr "Importkatalog [delar av .idata]" + +#: peigen.c:1018 pepigen.c:1018 +msgid "Resource Directory [.rsrc]" +msgstr "Resurskatalog [.rsrc]" + +#: peigen.c:1019 pepigen.c:1019 +msgid "Exception Directory [.pdata]" +msgstr "Undantagskatalog [.pdata]" + +#: peigen.c:1020 pepigen.c:1020 +msgid "Security Directory" +msgstr "Säkerhetskatalog" + +#: peigen.c:1021 pepigen.c:1021 +msgid "Base Relocation Directory [.reloc]" +msgstr "Basomlokaliseringskatalog [.reloc]" + +#: peigen.c:1022 pepigen.c:1022 +msgid "Debug Directory" +msgstr "Felsökningskatalog" + +#: peigen.c:1023 pepigen.c:1023 +msgid "Description Directory" +msgstr "Beskrivningskatalog" + +#: peigen.c:1024 pepigen.c:1024 +msgid "Special Directory" +msgstr "Specialkatalog" + +#: peigen.c:1025 pepigen.c:1025 +msgid "Thread Storage Directory [.tls]" +msgstr "Trådlagringskatalog [.tls]" + +#: peigen.c:1026 pepigen.c:1026 +msgid "Load Configuration Directory" +msgstr "Inläsningskonfigurationskatalog" + +#: peigen.c:1027 pepigen.c:1027 +msgid "Bound Import Directory" +msgstr "Katalog över bundna importer" + +#: peigen.c:1028 pepigen.c:1028 +msgid "Import Address Table Directory" +msgstr "Importadresstabellkatalog" + +#: peigen.c:1029 pepigen.c:1029 +msgid "Delay Import Directory" +msgstr "Katalog över fördröjda importer" + +#: peigen.c:1030 peigen.c:1031 pepigen.c:1030 pepigen.c:1031 +msgid "Reserved" +msgstr "Reserverad" + +#: peigen.c:1094 pepigen.c:1094 +msgid "" +"\n" +"There is an import table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Det finns en importtabell, men sektionen som innehåller den kunde inte hittas\n" + +#: peigen.c:1099 pepigen.c:1099 +#, c-format +msgid "" +"\n" +"There is an import table in %s at 0x%lx\n" +msgstr "" +"\n" +"Det finns en importtabell i %s på 0x%lx\n" + +#: peigen.c:1136 pepigen.c:1136 +#, c-format +msgid "" +"\n" +"Function descriptor located at the start address: %04lx\n" +msgstr "" +"\n" +"Funktionsidentifierare hittad på startadressen: %04lx\n" + +#: peigen.c:1139 pepigen.c:1139 +#, c-format +msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n" +msgstr "\tkodbas %08lx toc (inläsningsbar/verklig) %08lx/%08lx\n" + +#: peigen.c:1145 pepigen.c:1145 +msgid "" +"\n" +"No reldata section! Function descriptor not decoded.\n" +msgstr "" +"\n" +"Ingen reldata-sektion! Funktionsidentifierare avkodades inte.\n" + +#: peigen.c:1150 pepigen.c:1150 +#, c-format +msgid "" +"\n" +"The Import Tables (interpreted %s section contents)\n" +msgstr "" +"\n" +"Importtabellerna (tolkade innehåll i %s-sektion)\n" + +# Vad är thunk? +#: peigen.c:1153 pepigen.c:1153 +msgid "" +" vma: Hint Time Forward DLL First\n" +" Table Stamp Chain Name Thunk\n" +msgstr "" +" vma: Tips- Tids- Framåt- DLL- Första\n" +" tabell stämpel kedja namn thunk\n" + +#: peigen.c:1204 pepigen.c:1204 +#, c-format +msgid "" +"\n" +"\tDLL Name: %s\n" +msgstr "" +"\n" +"\tDLL-namn: %s\n" + +#: peigen.c:1215 pepigen.c:1215 +msgid "\tvma: Hint/Ord Member-Name Bound-To\n" +msgstr "\tvma: Tips/Ordn Medlemsnamn Bundet till\n" + +#: peigen.c:1240 pepigen.c:1240 +msgid "" +"\n" +"There is a first thunk, but the section containing it could not be found\n" +msgstr "" +"\n" +"Det finns en första thunk, men sektionen som innehåller den kunde inte hittas\n" + +#: peigen.c:1380 pepigen.c:1380 +msgid "" +"\n" +"There is an export table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Det finns en exporttabell, men sektionen som innehåller den kunde inte hittas\n" + +#: peigen.c:1385 pepigen.c:1385 +#, c-format +msgid "" +"\n" +"There is an export table in %s at 0x%lx\n" +msgstr "" +"\n" +"Det finns en exporttabell i %s vid 0x%lx\n" + +#: peigen.c:1416 pepigen.c:1416 +#, c-format +msgid "" +"\n" +"The Export Tables (interpreted %s section contents)\n" +"\n" +msgstr "" +"\n" +"Exporttabellerna (tolkade innehåll i %s-sektion)\n" + +#: peigen.c:1420 pepigen.c:1420 +#, c-format +msgid "Export Flags \t\t\t%lx\n" +msgstr "Exportflaggor \t\t\t%lx\n" + +#: peigen.c:1423 pepigen.c:1423 +#, c-format +msgid "Time/Date stamp \t\t%lx\n" +msgstr "Tid-/Datumstämpel \t\t%lx\n" + +#: peigen.c:1426 pepigen.c:1426 +#, c-format +msgid "Major/Minor \t\t\t%d/%d\n" +msgstr "Övre/Undre \t\t\t%d/%d\n" + +#: peigen.c:1429 pepigen.c:1429 +msgid "Name \t\t\t\t" +msgstr "Namn \t\t\t\t" + +#: peigen.c:1435 pepigen.c:1435 +#, c-format +msgid "Ordinal Base \t\t\t%ld\n" +msgstr "Ordningsbas \t\t\t%ld\n" + +#: peigen.c:1438 pepigen.c:1438 +msgid "Number in:\n" +msgstr "Tal i:\n" + +#: peigen.c:1441 pepigen.c:1441 +#, c-format +msgid "\tExport Address Table \t\t%08lx\n" +msgstr "\tExportadresstabell \t\t%08lx\n" + +#: peigen.c:1445 pepigen.c:1445 +#, c-format +msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n" +msgstr "\t[Namnpekare/Ordningstal]-tabell\t%08lx\n" + +#: peigen.c:1448 pepigen.c:1448 +msgid "Table Addresses\n" +msgstr "Tabelladresser\n" + +#: peigen.c:1451 pepigen.c:1451 +msgid "\tExport Address Table \t\t" +msgstr "\tExportadresstabell \t\t" + +#: peigen.c:1456 pepigen.c:1456 +msgid "\tName Pointer Table \t\t" +msgstr "\tNamnpekartabell \t\t" + +#: peigen.c:1461 pepigen.c:1461 +msgid "\tOrdinal Table \t\t\t" +msgstr "\tOrdningstalstabell \t\t\t" + +#: peigen.c:1476 pepigen.c:1476 +#, c-format +msgid "" +"\n" +"Export Address Table -- Ordinal Base %ld\n" +msgstr "" +"\n" +"Exportadresstabell -- Orningsbas %ld\n" + +#: peigen.c:1495 pepigen.c:1495 +msgid "Forwarder RVA" +msgstr "Vidarebefordrar-RVA" + +#: peigen.c:1506 pepigen.c:1506 +msgid "Export RVA" +msgstr "Export-RVA" + +#: peigen.c:1513 pepigen.c:1513 +msgid "" +"\n" +"[Ordinal/Name Pointer] Table\n" +msgstr "" +"\n" +"[Ordningstals-/Namnpekar-]tabell\n" + +#: peigen.c:1568 pepigen.c:1568 +#, c-format +msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n" +msgstr "Varning, storleken på .pdata-sektionen (%ld) är inte en multipel av %d\n" + +#: peigen.c:1572 pepigen.c:1572 +msgid "" +"\n" +"The Function Table (interpreted .pdata section contents)\n" +msgstr "" +"\n" +"Funktionstabellen (tolkade innehåll från .pdata-sektionen)\n" + +#: peigen.c:1575 pepigen.c:1575 +msgid " vma:\t\t\tBegin Address End Address Unwind Info\n" +msgstr " vma:\t\t\tStartadress Slutadress Ospola information\n" + +#: peigen.c:1577 pepigen.c:1577 +msgid "" +" vma:\t\tBegin End EH EH PrologEnd Exception\n" +" \t\tAddress Address Handler Data Address Mask\n" +msgstr "" +" vma:\t\tStart- Slut- EH- EH- Prologsluts- Undantags-\n" +" \t\tadress adress hanterare data adress mask\n" + +#: peigen.c:1647 pepigen.c:1647 +msgid " Register save millicode" +msgstr " Registerspara millikod" + +#: peigen.c:1650 pepigen.c:1650 +msgid " Register restore millicode" +msgstr " Registeråterställ millikod" + +#: peigen.c:1653 pepigen.c:1653 +msgid " Glue code sequence" +msgstr " Klisterkodsekvens" + +#: peigen.c:1705 pepigen.c:1705 +msgid "" +"\n" +"\n" +"PE File Base Relocations (interpreted .reloc section contents)\n" +msgstr "" +"\n" +"\n" +"PE-filbasomlokaliseringar (tolkat innehåll i .reloc-sektionen)\n" + +#: peigen.c:1735 pepigen.c:1735 +#, c-format +msgid "" +"\n" +"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n" +msgstr "" +"\n" +"Virtuell adress: %08lx Områdesstorlek %ld (0x%lx) Antal fixar %ld\n" + +#: peigen.c:1748 pepigen.c:1748 +#, c-format +msgid "\treloc %4d offset %4x [%4lx] %s" +msgstr "\tomlokalisering %4d avstånd %4x [%4lx] %s" + +#. The MS dumpbin program reportedly ands with 0xff0f before +#. printing the characteristics field. Not sure why. No reason to +#. emulate it here. +#: peigen.c:1788 pepigen.c:1788 +#, c-format +msgid "" +"\n" +"Characteristics 0x%x\n" +msgstr "" +"\n" +"Karakteristik 0x%x\n" + +#~ msgid "%s: Unknown special linker type %d" +#~ msgstr "%s: Okänd speciallänkartyp %d" + +#~ msgid "v850ea architecture" +#~ msgstr "v850ea-arkitektur" + +#~ msgid "%s: Section %s is too large to add hole of %ld bytes" +#~ msgstr "%s: Sektionen %s är för stor för att stoppa hål med %ld byte i" + +#~ msgid "Error: out of memory" +#~ msgstr "Fel: slut på minne" + +#~ msgid "warning: relocation against removed section; zeroing" +#~ msgstr "varning: omlokalisering mot borttagen sektion; nollställer" + +#~ msgid "warning: relocation against removed section" +#~ msgstr "varning: omlokalisering mot borttagen sektion" + +#~ msgid "local symbols in discarded section %s" +#~ msgstr "lokala symboler i bortkastade sektionen %s" + +#~ msgid "%s: linking abicalls files with non-abicalls files" +#~ msgstr "%s: länkar abicalls-filer med icke-abicalls-filer" + +#~ msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)" +#~ msgstr "%s: ISA (-mips%d) passar inte med tidigare moduler (-mips%d)" + +#~ msgid "%s: ISA mismatch (%d) with previous modules (%d)" +#~ msgstr "%s: ISA (%d) passar inte med tidigare moduler (%d)" + +#~ msgid "%s: dynamic relocation against speculation fixup" +#~ msgstr "%s: dynamisk omlokalisering utan spekulationsfixar" + +#~ msgid "%s: speculation fixup against undefined weak symbol" +#~ msgstr "%s: spekulationsfix mot odefinierad svag symbol" + +#~ msgid "\tThe Import Address Table (difference found)\n" +#~ msgstr "\tImportadresstabellen (skillnad hittad)\n" + +#~ msgid "\t>>> Ran out of IAT members!\n" +#~ msgstr "\t>>> Slut på IAT-medlemmar!\n" + +#~ msgid "\tThe Import Address Table is identical\n" +#~ msgstr "\tImportadresstabellen är identisk\n" + +# Ska vara blanksteg här tror jag +#~ msgid "BFD %sinternal error, aborting at %s line %d\n" +#~ msgstr "Internt BFD %s-fel, avbryter vid %s rad %d\n" + +#~ msgid "GP relative relocation when GP not defined" +#~ msgstr "GP-relativ omlokalisering då GP inte är definierad" + +#~ msgid "%s: ERROR: passes floats in float registers whereas target %s uses integer registers" +#~ msgstr "%s: FEL: skickar flyttal i flyttalsregister där målet %s istället använder heltalsregister" + +#~ msgid "%s: ERROR: passes floats in integer registers whereas target %s uses float registers" +#~ msgstr "%s: FEL: skickar flyttal i heltalsregister där målet %s istället använder flyttalsregister" + +#~ msgid "Warning: input file %s supports interworking, whereas %s does not." +#~ msgstr "Varning: indatafilen %s stöder samverkande, medan %s däremot inte gör det." + +#~ msgid "Warning: input file %s does not support interworking, whereas %s does." +#~ msgstr "Varning: indatafilen %s stöder inte samverkande, medan %s däremot gör det." + +#~ msgid "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld" +#~ msgstr "AUX tagndx %ld ttlsiz 0x%lx radnummer %ld nästa %ld" + +#~ msgid "elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = 0x%.8lx%s\n" +#~ msgstr "elf_symbol_from_bfd_symbol 0x%.8lx, namn = %s, symbolnr = %d, flaggor = 0x%.8lx%s\n" + +#~ msgid "Warning: Not setting interwork flag of %s since it has already been specified as non-interworking" +#~ msgstr "Varning: Ställer inte in samverkandeflaggan för %s eftersom den redan har angivits som inte samverkande" + +#~ msgid "Warning: Clearing the interwork flag of %s due to outside request" +#~ msgstr "Varning: Stänger av samverkandeflaggan för %s på grund av utomstående begäran" + +#~ msgid " [APCS-26]" +#~ msgstr " [APCS-26]" + +#~ msgid " [APCS-32]" +#~ msgstr " [APCS-32]" + +#~ msgid "(unknown)" +#~ msgstr "(okänd)" + +# Skumt! +#~ msgid " previously %s in %s" +#~ msgstr " tidigare %s i %s" + +#~ msgid "Symbol `%s' has differing types: %s in %s" +#~ msgstr "Symbolen \"%s\" har olika typer: %s i %s" + +# Alla dessa känns onödiga, borde rapporteras +#~ msgid "ETIR_S_C_STO_GBL: no symbol \"%s\"" +#~ msgstr "ETIR_S_C_STO_GBL: ingen symbol \"%s\"" + +#~ msgid "ETIR_S_C_STO_CA: no symbol \"%s\"" +#~ msgstr "ETIR_S_C_STO_CA: ingen symbol \"%s\"" + +#~ msgid "ETIR_S_C_STO_RB/AB: Not supported" +#~ msgstr "ETIR_S_C_STO_RB/AB: Stöds inte" + +#~ msgid "ETIR_S_C_STO_LP_PSB: Not supported" +#~ msgstr "ETIR_S_C_STO_LP_PSB: Stöds inte" + +#~ msgid "ETIR_S_C_STO_HINT_GBL: not implemented" +#~ msgstr "ETIR_S_C_STO_HINT_GBL: inte implementerat" + +#~ msgid "ETIR_S_C_STO_HINT_PS: not implemented" +#~ msgstr "ETIR_S_C_STO_HINT_PS: inte implementerat" + +#~ msgid "ETIR_S_C_OPR_INSV: Not supported" +#~ msgstr "ETIR_S_C_OPR_INSV: Stöds inte" + +#~ msgid "ETIR_S_C_OPR_USH: Not supported" +#~ msgstr "ETIR_S_C_OPR_USH: Stöds inte" + +#~ msgid "ETIR_S_C_OPR_ROT: Not supported" +#~ msgstr "ETIR_S_C_OPR_ROT: Stöds inte" + +#~ msgid "ETIR_S_C_OPR_REDEF: Not supported" +#~ msgstr "ETIR_S_C_OPR_REDEF: Stöds inte" + +#~ msgid "ETIR_S_C_OPR_DFLIT: Not supported" +#~ msgstr "ETIR_S_C_OPR_DFLIT: Stöds inte" + +#~ msgid "ETIR_S_C_STC_LP: not supported" +#~ msgstr "ETIR_S_C_STC_LP: stöds inte" + +#~ msgid "ETIR_S_C_STC_GBL: not supported" +#~ msgstr "ETIR_S_C_STC_GBL: stöds inte" + +#~ msgid "ETIR_S_C_STC_GCA: not supported" +#~ msgstr "ETIR_S_C_STC_GCA: stöds inte" + +#~ msgid "ETIR_S_C_STC_PS: not supported" +#~ msgstr "ETIR_S_C_STC_PS: stöds inte" + +#~ msgid "Unimplemented STO cmd %d" +#~ msgstr "Oimplementerat STO-kommando %d" + +#~ msgid "TIR_S_C_OPR_ASH incomplete" +#~ msgstr "TIR_S_C_OPR_ASH ofullständigt" + +#~ msgid "TIR_S_C_OPR_USH incomplete" +#~ msgstr "TIR_S_C_OPR_USH ofullständigt" + +#~ msgid "TIR_S_C_OPR_ROT incomplete" +#~ msgstr "TIR_S_C_OPR_ROT ofullständigt" + +#~ msgid "TIR_S_C_OPR_REDEF not supported" +#~ msgstr "TIR_S_C_OPR_REDEF stöds inte" + +#~ msgid "TIR_S_C_OPR_DFLIT not supported" +#~ msgstr "TIR_S_C_OPR_DFLIT stöds inte" + +#~ msgid "TIR_S_C_CTL_DFLOC not fully implemented" +#~ msgstr "TIR_S_C_CTL_DFLOC är inte fullständigt implementerat" + +#~ msgid "TIR_S_C_CTL_STLOC not fully implemented" +#~ msgstr "TIR_S_C_CTL_STLOC är inte fullständigt implementerat" + +#~ msgid "TIR_S_C_CTL_STKDL not fully implemented" +#~ msgstr "TIR_S_C_CTL_STKDL är inte fulständigt implementerat" + +# This is broken +# +# fprintf (file, +# _("\nThe Import Tables (interpreted %s section contents)\n"), +# section->name); +# fprintf (file, +# _(" vma: Hint Time Forward DLL First\n")); +# fprintf (file, +# _(" Table Stamp Chain Name Thunk\n")); +# +#~ msgid " vma: Hint Time Forward DLL First\n" +#~ msgstr " vma: Tips- Tids- V.bef.- DLL- Första\n" + +#~ msgid " \t\tAddress Address Handler Data Address Mask\n" +#~ msgstr " \t\tadress adress hanterare data adress mask\n" + +#~ msgid "integer" +#~ msgstr "heltal" + +#~ msgid "float" +#~ msgstr "flyttal" + +#~ msgid "soft" +#~ msgstr "mjuk" + +#~ msgid "hard" +#~ msgstr "hård" + +# _bfd_error_handler (_("# Warning: %s %s interworking, whereas %s %s"), +# bfd_get_filename (ibfd), +# in_flags & EF_INTERWORK ? _("supports") : _("does not support"), +# bfd_get_filename (obfd), +# out_flags & EF_INTERWORK ? _("does not") : _("does")); +# +# This is broken +# +# Don't split a sentence like this, use multiple full messages instead +# +#~ msgid "Warning: %s %s interworking, whereas %s %s" +#~ msgstr "Varning: %s %s samverkande, medan %s %s" + +#~ msgid "supports" +#~ msgstr "stöder" + +#~ msgid "does not" +#~ msgstr "inte gör det" + +#~ msgid "does" +#~ msgstr "gör det" + +#~ msgid "%s(%s+0x%lx): cannot find stub entry %s" +#~ msgstr "%s(%s+0x%lx): kan inte hitta stubbstarten %s" + +#~ msgid "%s(%s+0x%lx): cannot relocate %s, recompile with -ffunction-sections" +#~ msgstr "%s(%s+0x%lx): kan inte omlokalisera %s, kompilera om med -ffunction-sections" + +#~ msgid "creating section symbol, name = %s, value = 0x%.8lx, index = %d, section = 0x%.8lx\n" +#~ msgstr "skapar sektionssymbol, namn = %s, värde = 0x%.8lx, index = %d, sektion = 0x%.8lx\n" + +# Hmm +#~ msgid " whereas segment starts at 0x%x" +#~ msgstr " där segmentet börjar vid 0x%x" diff --git a/bfd/po/tr.gmo b/bfd/po/tr.gmo new file mode 100644 index 0000000000000..74c0ea8fc2dd2 Binary files /dev/null and b/bfd/po/tr.gmo differ diff --git a/bfd/po/tr.po b/bfd/po/tr.po new file mode 100644 index 0000000000000..11630c6ab40f8 --- /dev/null +++ b/bfd/po/tr.po @@ -0,0 +1,3193 @@ +# translation of bfd-2.14rel030712.tr.po to Turkish +# Copyright (C) 2003 Free Software Foundation, Inc. +# Deniz Akkus Kanca , 2001,2003. +# +msgid "" +msgstr "" +"Project-Id-Version: bfd 2.14rel030712\n" +"POT-Creation-Date: 2003-07-11 13:53+0930\n" +"PO-Revision-Date: 2003-07-13 22:07+0300\n" +"Last-Translator: Deniz Akkus Kanca \n" +"Language-Team: Turkish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.0\n" + +#: aout-adobe.c:204 +#, c-format +msgid "%s: Unknown section type in a.out.adobe file: %x\n" +msgstr "%s: a.out.adobe dosyasında bilinmeyen bölüm türü: %x\n" + +#: aout-cris.c:207 +#, c-format +msgid "%s: Invalid relocation type exported: %d" +msgstr "%s: Geçersiz yer deÄŸiÅŸtirme türü ihraç edilmiÅŸ: %d" + +#: aout-cris.c:251 +#, c-format +msgid "%s: Invalid relocation type imported: %d" +msgstr "%s: Geçersiz yer deÄŸiÅŸtirme türü ithal edilmiÅŸ: %d" + +#: aout-cris.c:262 +#, c-format +msgid "%s: Bad relocation record imported: %d" +msgstr "%s: Geçersiz yer deÄŸiÅŸtirme kaydı ithal edilmiÅŸ: %d" + +#: aoutx.h:1295 aoutx.h:1716 +#, c-format +msgid "%s: can not represent section `%s' in a.out object file format" +msgstr "%s: `%s' bölümü a.out nesne dosya biçeminde gösterilemez" + +#: aoutx.h:1682 +#, c-format +msgid "%s: can not represent section for symbol `%s' in a.out object file format" +msgstr "%s: `%s' sembol bölümü a.out nesne dosyasında gösterilemez" + +#: aoutx.h:1684 +msgid "*unknown*" +msgstr "*bilinmeyen*" + +#: aoutx.h:3776 +#, c-format +msgid "%s: relocatable link from %s to %s not supported" +msgstr "%s: %s'dan %s'ya yeri deÄŸiÅŸtirilebilen baÄŸ desteklenmiyor" + +#: archive.c:1751 +msgid "Warning: writing archive was slow: rewriting timestamp\n" +msgstr "Uyarı: arÅŸiv yazma iÅŸlemi yavaÅŸ: zaman damgası yeniden yazılıyor\n" + +#: archive.c:2014 +msgid "Reading archive file mod timestamp" +msgstr "ArÅŸiv dosyası deÄŸiÅŸim zaman damgası okunuyor" + +#: archive.c:2040 +msgid "Writing updated armap timestamp" +msgstr "GüncellenmiÅŸ armap zaman damgası yazılıyor" + +#: bfd.c:280 +msgid "No error" +msgstr "Hata yok" + +#: bfd.c:281 +msgid "System call error" +msgstr "Sistem çaÄŸrı hatası" + +#: bfd.c:282 +msgid "Invalid bfd target" +msgstr "Geçersiz bfd hedefi" + +#: bfd.c:283 +msgid "File in wrong format" +msgstr "Dosya yanlış biçemde" + +#: bfd.c:284 +msgid "Archive object file in wrong format" +msgstr "ArÅŸiv nesne dosyası yanlış biçemde" + +#: bfd.c:285 +msgid "Invalid operation" +msgstr "Geçersiz iÅŸlem" + +#: bfd.c:286 +msgid "Memory exhausted" +msgstr "Bellek tükendi" + +#: bfd.c:287 +msgid "No symbols" +msgstr "Sembol yok" + +#: bfd.c:288 +msgid "Archive has no index; run ranlib to add one" +msgstr "ArÅŸivin indeksi yok; ranlib çalıştırarak indeks ekleyin" + +#: bfd.c:289 +msgid "No more archived files" +msgstr "BaÅŸka arÅŸivlenmiÅŸ dosya yok" + +#: bfd.c:290 +msgid "Malformed archive" +msgstr "Bozuk arÅŸiv" + +#: bfd.c:291 +msgid "File format not recognized" +msgstr "Dosya biçemi tanınmıyor" + +#: bfd.c:292 +msgid "File format is ambiguous" +msgstr "Dosya biçemi belirsiz" + +#: bfd.c:293 +msgid "Section has no contents" +msgstr "Bölümde içerik yok" + +#: bfd.c:294 +msgid "Nonrepresentable section on output" +msgstr "Çıktıda gösterilemeyen bölüm" + +#: bfd.c:295 +msgid "Symbol needs debug section which does not exist" +msgstr "Sembol, olmayan hata ayıklama bölümünü istiyor" + +#: bfd.c:296 +msgid "Bad value" +msgstr "Geçersiz deÄŸer" + +#: bfd.c:297 +msgid "File truncated" +msgstr "Dosya budandı" + +#: bfd.c:298 +msgid "File too big" +msgstr "Dosya fazla büyük" + +#: bfd.c:299 +msgid "#" +msgstr "#" + +#: bfd.c:687 +#, c-format +msgid "BFD %s assertion fail %s:%d" +msgstr "BFD %s, olumlama baÅŸarısız %s:%d" + +#: bfd.c:703 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d in %s\n" +msgstr "BFD %s iç hatası, %s'da, %d satırı, %s içerisinde iÅŸlem durduruldu\n" + +#: bfd.c:707 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d\n" +msgstr "BFD %s iç hatası, %s, %d satırında iÅŸlem durduruldu\n" + +#: bfd.c:709 +msgid "Please report this bug.\n" +msgstr "Lütfen bu hatayı bildirin.\n" + +#: bfdwin.c:202 +#, c-format +msgid "not mapping: data=%lx mapped=%d\n" +msgstr "eÅŸlenmeyen: veri=%lx eÅŸleÅŸen=%d\n" + +#: bfdwin.c:205 +msgid "not mapping: env var not set\n" +msgstr "eÅŸlenmeyen: çevre deÄŸiÅŸkeni atanmamış\n" + +#: binary.c:306 +#, c-format +msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx." +msgstr "Uyarı: `%s' bölümü çok büyük (negatif) dosya göreli konumu 0x%lx'e yazılıyor." + +#: coff-a29k.c:120 +msgid "Missing IHCONST" +msgstr "IHCONST yok" + +#: coff-a29k.c:181 +msgid "Missing IHIHALF" +msgstr "IHIHALF yok" + +#: coff-a29k.c:213 coff-or32.c:236 +msgid "Unrecognized reloc" +msgstr "Tanınmayan yer deÄŸiÅŸtirme" + +#: coff-a29k.c:409 +msgid "missing IHCONST reloc" +msgstr "eksik IHCONST yer deÄŸiÅŸtirmesi" + +#: coff-a29k.c:499 +msgid "missing IHIHALF reloc" +msgstr "eksik IHIHALF yer deÄŸiÅŸtirmesi" + +#: coff-alpha.c:884 coff-alpha.c:921 coff-alpha.c:1992 coff-mips.c:1397 +msgid "GP relative relocation used when GP not defined" +msgstr "GP tanımlanmamışken GP göreli yer deÄŸiÅŸtirmesi kullanılmış" + +#: coff-alpha.c:1488 +msgid "using multiple gp values" +msgstr "birden fazla gp deÄŸeri kullanılıyor" + +#: coff-arm.c:1066 elf32-arm.h:294 +#, c-format +msgid "%s: unable to find THUMB glue '%s' for `%s'" +msgstr "%1$s: `%3$s' için THUMB birleÅŸtiricisi '%2$s' bulunamadı " + +#: coff-arm.c:1096 elf32-arm.h:329 +#, c-format +msgid "%s: unable to find ARM glue '%s' for `%s'" +msgstr "%1$s: `%3$s' için ARM birleÅŸtiricisi '%2$s' bulunamadı" + +#: coff-arm.c:1394 coff-arm.c:1489 elf32-arm.h:892 elf32-arm.h:999 +#, c-format +msgid "%s(%s): warning: interworking not enabled." +msgstr "%s(%s): uyarı: beraber çalışma kipi etkin deÄŸil." + +#: coff-arm.c:1398 elf32-arm.h:1002 +#, c-format +msgid " first occurrence: %s: arm call to thumb" +msgstr " ilk ortaya çıkış: %s: thumb'a arm'dan çaÄŸrı" + +#: coff-arm.c:1493 elf32-arm.h:895 +#, c-format +msgid " first occurrence: %s: thumb call to arm" +msgstr " ilk ortaya çıkış: %s: arm'a thumb'dan çaÄŸrı" + +#: coff-arm.c:1496 +msgid " consider relinking with --support-old-code enabled" +msgstr " --support-old-code seçeneÄŸi ile yeniden baÄŸlamayı deneyin" + +#: coff-arm.c:1788 coff-tic80.c:687 cofflink.c:3038 +#, c-format +msgid "%s: bad reloc address 0x%lx in section `%s'" +msgstr "%1$s: `%3$s' bölümünde geçersiz yer deÄŸiÅŸtirme adresi 0x%2$lx" + +#: coff-arm.c:2132 +#, c-format +msgid "%s: illegal symbol index in reloc: %d" +msgstr "%s: yer deÄŸiÅŸtirmede geçersiz sembol indeksi: %d" + +#: coff-arm.c:2265 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d" +msgstr "Hata: %s APCS-%d için derlenmiÅŸ, fakat %s APCS-%d için derlenmiÅŸ" + +#: coff-arm.c:2280 elf32-arm.h:2328 +#, c-format +msgid "ERROR: %s passes floats in float registers, whereas %s passes them in integer registers" +msgstr "" +"Hata: %s kayan sayıları kayan sayı yazmaçlarında geçiriyor, \n" +" fakat %s tamsayı yazmaçlarında geçiriyor" + +#: coff-arm.c:2283 elf32-arm.h:2333 +#, c-format +msgid "ERROR: %s passes floats in integer registers, whereas %s passes them in float registers" +msgstr "" +"Hata: %s kayan sayıları tamsayı yazmaçlarında geçiriyor, \n" +" fakat %s kayan sayı yazmaçlarında geçiriyor" + +#: coff-arm.c:2298 +#, c-format +msgid "ERROR: %s is compiled as position independent code, whereas target %s is absolute position" +msgstr "HATA: %s yerden bağımsız kod olarak derlendi, fakat hedef %s yere bağımlı" + +#: coff-arm.c:2301 +#, c-format +msgid "ERROR: %s is compiled as absolute position code, whereas target %s is position independent" +msgstr "HATA: %s yere bağımlı kod olarak derlendi, fakat hedef %s yerden bağımsız" + +#: coff-arm.c:2330 elf32-arm.h:2405 +#, c-format +msgid "Warning: %s supports interworking, whereas %s does not" +msgstr "Uyarı: %s girdi dosyası beraber çalışmayı destekliyor, fakat %s desteklemiyor." + +#: coff-arm.c:2333 elf32-arm.h:2412 +#, c-format +msgid "Warning: %s does not support interworking, whereas %s does" +msgstr "Uyarı: %s girdi dosyası beraber çalışmayı desteklemiyor, fakat %s destekliyor." + +#: coff-arm.c:2360 +#, c-format +msgid "private flags = %x:" +msgstr "özel bayraklar = %x:" + +#: coff-arm.c:2368 elf32-arm.h:2467 +msgid " [floats passed in float registers]" +msgstr " [kayan sayılar kayan yazmaçlarda geçirildi]" + +#: coff-arm.c:2370 +msgid " [floats passed in integer registers]" +msgstr " [kayan sayılar tamsayı yazmaçlarda geçirildi]" + +#: coff-arm.c:2373 elf32-arm.h:2470 +msgid " [position independent]" +msgstr " [yerden bağımsız]" + +#: coff-arm.c:2375 +msgid " [absolute position]" +msgstr " [yere bağımlı]" + +#: coff-arm.c:2379 +msgid " [interworking flag not initialised]" +msgstr " [beraber çalışma bayrağına öndeÄŸer atanmamış]" + +#: coff-arm.c:2381 +msgid " [interworking supported]" +msgstr " [beraber çalışma destekleniyor]" + +#: coff-arm.c:2383 +msgid " [interworking not supported]" +msgstr " [beraber çalışma desteklenmiyor]" + +#: coff-arm.c:2431 elf32-arm.h:2150 +#, c-format +msgid "Warning: Not setting interworking flag of %s since it has already been specified as non-interworking" +msgstr "Uyarı: %s beraber çalışma bayrağı atanmadı, çünkü beraber çalışma olmayacağı önceden belirtilmiÅŸ" + +#: coff-arm.c:2435 elf32-arm.h:2154 +#, c-format +msgid "Warning: Clearing the interworking flag of %s due to outside request" +msgstr "Uyarı: %s beraber çalışma bayrağı dış istek üzerine temizlendi" + +#: coff-h8300.c:1096 +#, c-format +msgid "cannot handle R_MEM_INDIRECT reloc when using %s output" +msgstr "%s çıktısı kullanılırken R_MEM_INDIRECT yerdeÄŸiÅŸtirmesi kullanılamıyor" + +#: coff-i960.c:137 coff-i960.c:486 +msgid "uncertain calling convention for non-COFF symbol" +msgstr "COFF olmayan sembol için belirsiz çaÄŸrı davranışı" + +#: coff-m68k.c:482 coff-mips.c:2394 elf32-m68k.c:2193 elf32-mips.c:1783 +msgid "unsupported reloc type" +msgstr "desteklenmeyen yer deÄŸiÅŸtirme türü" + +#: coff-mips.c:839 elf32-mips.c:1088 elf64-mips.c:1590 elfn32-mips.c:1554 +msgid "GP relative relocation when _gp not defined" +msgstr "_gp tanımsız iken GP göreli yer deÄŸiÅŸtirmesi" + +#. No other sections should appear in -membedded-pic +#. code. +#: coff-mips.c:2431 +msgid "reloc against unsupported section" +msgstr "desteklenmeyen bölümde yer deÄŸiÅŸtirme" + +#: coff-mips.c:2439 +msgid "reloc not properly aligned" +msgstr "yer deÄŸiÅŸtirme doÄŸru hizalanmamış" + +#: coff-rs6000.c:2790 +#, c-format +msgid "%s: unsupported relocation type 0x%02x" +msgstr "%s: desteklenmeyen yükleyici yerdeÄŸiÅŸimi 0x%02x" + +#: coff-rs6000.c:2883 +#, c-format +msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry" +msgstr "%s: 0x%x'da TOC girdisi olmayan `%s' sembolüne TOC yerdeÄŸiÅŸimi" + +#: coff-rs6000.c:3616 coff64-rs6000.c:2109 +#, c-format +msgid "%s: symbol `%s' has unrecognized smclas %d" +msgstr "%s: `%s' sembolünde bilinmeyen %d var" + +#: coff-tic4x.c:170 coff-tic54x.c:288 coff-tic80.c:450 +#, c-format +msgid "Unrecognized reloc type 0x%x" +msgstr "Bilinmeyen yer deÄŸiÅŸtirme türü 0x%x" + +#: coff-tic4x.c:218 coff-tic54x.c:373 coffcode.h:5045 +#, c-format +msgid "%s: warning: illegal symbol index %ld in relocs" +msgstr "%s: uyarı: yer deÄŸiÅŸtirmelerde geçersiz sembol indeksi %ld" + +#: coff-w65.c:364 +#, c-format +msgid "ignoring reloc %s\n" +msgstr "yer deÄŸiÅŸtirme %s yoksayıldı\n" + +#: coffcode.h:1108 +#, c-format +msgid "%s (%s): Section flag %s (0x%x) ignored" +msgstr "%s (%s): Bölüm bayrağı %s (0x%x) yoksayıldı" + +#: coffcode.h:2214 +#, c-format +msgid "Unrecognized TI COFF target id '0x%x'" +msgstr "Tanınmayan TI COFF hedef kimliÄŸi '0x%x'" + +#: coffcode.h:4437 +#, c-format +msgid "%s: warning: illegal symbol index %ld in line numbers" +msgstr "%s: uyarı: satır numaralarında geçersiz sembol indeksi %ld" + +#: coffcode.h:4451 +#, c-format +msgid "%s: warning: duplicate line number information for `%s'" +msgstr "%s: uyarı: `%s' için tekrarlanmış satır numarası bilgisi" + +#: coffcode.h:4805 +#, c-format +msgid "%s: Unrecognized storage class %d for %s symbol `%s'" +msgstr "%1$s: %3$s sembolü `%4$s' için bilinmeyen saklama sınıfı %2$d" + +#: coffcode.h:4938 +#, c-format +msgid "warning: %s: local symbol `%s' has no section" +msgstr "uyarı: %s: `%s' yerel sembolünün bölümü yok" + +#: coffcode.h:5083 +#, c-format +msgid "%s: illegal relocation type %d at address 0x%lx" +msgstr "%1$s: 0x%3$lx adresinde geçersiz yer deÄŸiÅŸtirme türü %2$d" + +#: coffgen.c:1666 +#, c-format +msgid "%s: bad string table size %lu" +msgstr "%s: geçersiz dizge tablo boyu %lu" + +#: cofflink.c:538 elflink.h:1276 +#, c-format +msgid "Warning: type of symbol `%s' changed from %d to %d in %s" +msgstr "Uyarı: %4$s içerisinde `%1$s' sembolünün türü %2$d'den %3$d'e deÄŸiÅŸtirildi" + +#: cofflink.c:2328 +#, c-format +msgid "%s: relocs in section `%s', but it has no contents" +msgstr "%s: `%s' bölümünde yer deÄŸiÅŸtirmeler mevcut, fakat içi boÅŸ" + +#: cofflink.c:2671 coffswap.h:890 +#, c-format +msgid "%s: %s: reloc overflow: 0x%lx > 0xffff" +msgstr "%s: %s: yer deÄŸiÅŸtirme taÅŸması: 0x%lx > 0xffff" + +#: cofflink.c:2680 coffswap.h:876 +#, c-format +msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: uyarı: %s: satır numarası taÅŸması: 0x%lx > 0xffff" + +#: cpu-arm.c:196 cpu-arm.c:206 +#, c-format +msgid "ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale" +msgstr "Hata: %s EP9312 için derlenmiÅŸ, fakat %s XScale için derlenmiÅŸ" + +#: cpu-arm.c:344 +#, c-format +msgid "warning: unable to update contents of %s section in %s" +msgstr "uyarı: %2$s içinde %1$s bölümünün içeriÄŸi güncellenemedi" + +#: dwarf2.c:380 +msgid "Dwarf Error: Can't find .debug_str section." +msgstr "Dwarf Hatası: .debug_str bölümü bulunamadı." + +#: dwarf2.c:397 +#, c-format +msgid "Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str size (%lu)." +msgstr "" +"Dwarf Hatası: DW_FORM_strp göreli konumu (%lu) .debug_str boyutundan (%lu) \n" +" daha büyük veya eÅŸit." + +#: dwarf2.c:541 +msgid "Dwarf Error: Can't find .debug_abbrev section." +msgstr "Dwarf Hatası: .debug_abbrev bölümü bulunamadı." + +#: dwarf2.c:556 +#, c-format +msgid "Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size (%lu)." +msgstr "" +"Dwarf Hatası: Kısaltma göreli konumu (%lu) kısaltma boyutundan (%lu) \n" +" daha büyük veya eÅŸit." + +#: dwarf2.c:756 +#, c-format +msgid "Dwarf Error: Invalid or unhandled FORM value: %u." +msgstr "Dwarf Hatası: Geçersiz veya desteklenmeyen FORM deÄŸeri: %u." + +#: dwarf2.c:933 +msgid "Dwarf Error: mangled line number section (bad file number)." +msgstr "Dwarf Hatası: bozulmuÅŸ satır numarası bölümü (geçersiz dosya numarası)." + +#: dwarf2.c:1032 +msgid "Dwarf Error: Can't find .debug_line section." +msgstr "Dwarf Hatası: .debug_line bölümü bulunamadı." + +#: dwarf2.c:1049 +#, c-format +msgid "Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)." +msgstr "" +"Dwarf Hatası: Satır göreli konumu (%lu) satır boyutundan (%lu)\n" +" daha büyük veya eÅŸit." + +#: dwarf2.c:1255 +msgid "Dwarf Error: mangled line number section." +msgstr "Dwarf Hatası: bozuk satır numarası bölümü." + +#: dwarf2.c:1470 dwarf2.c:1620 +#, c-format +msgid "Dwarf Error: Could not find abbrev number %u." +msgstr "Dwarf Hatası: Kısaltma numarası %u bulunamadı." + +#: dwarf2.c:1581 +#, c-format +msgid "Dwarf Error: found dwarf version '%u', this reader only handles version 2 information." +msgstr "Dwarf Hatası: dwarf sürümü '%u' bulundu, bu okuyucu yalnızca sürüm 2 bilgisini anlayabiliyor." + +#: dwarf2.c:1588 +#, c-format +msgid "Dwarf Error: found address size '%u', this reader can not handle sizes greater than '%u'." +msgstr "Dwarf Hatası: adres boyu '%u' bulundu, bu okuyucu '%u'dan daha büyük boyları okuyamıyor." + +#: dwarf2.c:1611 +#, c-format +msgid "Dwarf Error: Bad abbrev number: %u." +msgstr "Dwarf Hatası: Geçersiz kısaltma numarası: %u." + +#: ecoff.c:1339 +#, c-format +msgid "Unknown basic type %d" +msgstr "Bilinmeyen temel tür %d" + +#: ecoff.c:1599 +#, c-format +msgid "" +"\n" +" End+1 symbol: %ld" +msgstr "" +"\n" +" Son+1 sembolü: %ld" + +#: ecoff.c:1606 ecoff.c:1609 +#, c-format +msgid "" +"\n" +" First symbol: %ld" +msgstr "" +"\n" +" İlk sembol: %ld" + +#: ecoff.c:1621 +#, c-format +msgid "" +"\n" +" End+1 symbol: %-7ld Type: %s" +msgstr "" +"\n" +" Son+1 sembolü: %-7ld Tür: %s" + +#: ecoff.c:1628 +#, c-format +msgid "" +"\n" +" Local symbol: %ld" +msgstr "" +"\n" +" Yerel sembol: %ld" + +#: ecoff.c:1636 +#, c-format +msgid "" +"\n" +" struct; End+1 symbol: %ld" +msgstr "" +"\n" +" yapı; Son+1 sembolü: %ld" + +#: ecoff.c:1641 +#, c-format +msgid "" +"\n" +" union; End+1 symbol: %ld" +msgstr "" +"\n" +" birleÅŸim; Son+1 sembolü: %ld" + +#: ecoff.c:1646 +#, c-format +msgid "" +"\n" +" enum; End+1 symbol: %ld" +msgstr "" +"\n" +" enum; Son+1 sembolü: %ld" + +#: ecoff.c:1652 +#, c-format +msgid "" +"\n" +" Type: %s" +msgstr "" +"\n" +" Tür: %s" + +#: elf-hppa.h:1458 elf-hppa.h:1491 elf-m10300.c:1628 elf64-sh64.c:1704 +#, c-format +msgid "%s: warning: unresolvable relocation against symbol `%s' from %s section" +msgstr "%1$s: uyarı: %3$s bölümünden `%2$s' sembolüne çözümlenemeyen yer deÄŸiÅŸimi" + +#: elf-m10200.c:442 elf-m10300.c:1695 elf32-arm.h:2088 elf32-avr.c:812 +#: elf32-cris.c:1390 elf32-d10v.c:570 elf32-fr30.c:634 elf32-frv.c:815 +#: elf32-h8300.c:528 elf32-i860.c:1028 elf32-ip2k.c:1586 elf32-iq2000.c:699 +#: elf32-m32r.c:1283 elf32-m68hc1x.c:1305 elf32-msp430.c:510 +#: elf32-openrisc.c:436 elf32-v850.c:1777 elf32-xstormy16.c:976 +#: elf64-mmix.c:1332 +msgid "internal error: out of range error" +msgstr "iç hata: kapsam dışı hatası" + +#: elf-m10200.c:446 elf-m10300.c:1699 elf32-arm.h:2092 elf32-avr.c:816 +#: elf32-cris.c:1394 elf32-d10v.c:574 elf32-fr30.c:638 elf32-frv.c:819 +#: elf32-h8300.c:532 elf32-i860.c:1032 elf32-iq2000.c:703 elf32-m32r.c:1287 +#: elf32-m68hc1x.c:1309 elf32-msp430.c:514 elf32-openrisc.c:440 +#: elf32-v850.c:1781 elf32-xstormy16.c:980 elf64-mmix.c:1336 elfxx-mips.c:6452 +msgid "internal error: unsupported relocation error" +msgstr "iç hata: desteklenmeyen yer deÄŸiÅŸim hatası" + +#: elf-m10200.c:450 elf-m10300.c:1703 elf32-arm.h:2096 elf32-d10v.c:578 +#: elf32-h8300.c:536 elf32-m32r.c:1291 elf32-m68hc1x.c:1313 +msgid "internal error: dangerous error" +msgstr "iç hata: ölümcül hata" + +#: elf-m10200.c:454 elf-m10300.c:1707 elf32-arm.h:2100 elf32-avr.c:824 +#: elf32-cris.c:1402 elf32-d10v.c:582 elf32-fr30.c:646 elf32-frv.c:827 +#: elf32-h8300.c:540 elf32-i860.c:1040 elf32-ip2k.c:1601 elf32-iq2000.c:711 +#: elf32-m32r.c:1295 elf32-m68hc1x.c:1317 elf32-msp430.c:522 +#: elf32-openrisc.c:448 elf32-v850.c:1801 elf32-xstormy16.c:988 +#: elf64-mmix.c:1344 +msgid "internal error: unknown error" +msgstr "iç hata: bilinmeyen hata" + +#: elf.c:372 +#, c-format +msgid "%s: invalid string offset %u >= %lu for section `%s'" +msgstr "%1$s: `%4$s' bölümünde geçersiz dizge göreli konumu %2$u >= %3$lu" + +#: elf.c:624 +#, c-format +msgid "%s: invalid SHT_GROUP entry" +msgstr "%s: geçersiz SHT_GROUP girdisi" + +#: elf.c:695 +#, c-format +msgid "%s: no group info for section %s" +msgstr "%s: %s bölümünde grup bilgisi yok" + +#: elf.c:1055 +msgid "" +"\n" +"Program Header:\n" +msgstr "" +"\n" +"Yazılım BaÅŸlığı:\n" + +#: elf.c:1106 +msgid "" +"\n" +"Dynamic Section:\n" +msgstr "" +"\n" +"Dinamik Bölüm:\n" + +#: elf.c:1235 +msgid "" +"\n" +"Version definitions:\n" +msgstr "" +"\n" +"Sürüm tanımları:\n" + +#: elf.c:1258 +msgid "" +"\n" +"Version References:\n" +msgstr "" +"\n" +"Sürüm Referansları:\n" + +#: elf.c:1263 +#, c-format +msgid " required from %s:\n" +msgstr " %s'den isteniyor:\n" + +#: elf.c:1944 +#, c-format +msgid "%s: invalid link %lu for reloc section %s (index %u)" +msgstr "%1$s: yerdeÄŸiÅŸim bölümü %3$s (indeks %4$u) için geçersiz baÄŸ %2$lu" + +#: elf.c:3686 +#, c-format +msgid "%s: Not enough room for program headers (allocated %u, need %u)" +msgstr "%s: Yazılım baÅŸlıkları için yeterli yer yok (%u ayrıldı, %u gerekli)" + +#: elf.c:3791 +#, c-format +msgid "%s: Not enough room for program headers, try linking with -N" +msgstr "%s: yazılım baÅŸlıkları için gerekli yer yok, -N ile baÄŸlamayı deneyin" + +#: elf.c:3922 +#, c-format +msgid "Error: First section in segment (%s) starts at 0x%x whereas the segment starts at 0x%x" +msgstr "Hata: Parçadaki (%s) ilk bölüm 0x%x'de, parça ise 0x%x'de baÅŸlıyor" + +#: elf.c:4242 +#, c-format +msgid "%s: warning: allocated section `%s' not in segment" +msgstr "%s: uyarı: ayrılmış `%s' bölümü parça içinde deÄŸil" + +#: elf.c:4566 +#, c-format +msgid "%s: symbol `%s' required but not present" +msgstr "%s: `%s' sembolü gerekli fakat mevcut deÄŸil" + +#: elf.c:4854 +#, c-format +msgid "%s: warning: Empty loadable segment detected, is this intentional ?\n" +msgstr "%s: uyarı: BoÅŸ yüklenebilir parça bulundu, bu isteyerek mi yapılıyor?\n" + +#: elf.c:5485 +#, c-format +msgid "Unable to find equivalent output section for symbol '%s' from section '%s'" +msgstr "'%2$s' bölümünden '%1$s' sembolü için eÅŸdeÄŸer çıktı bölümü bulunamadı" + +#: elf.c:6298 +#, c-format +msgid "%s: unsupported relocation type %s" +msgstr "%s: desteklenmeyen yerdeÄŸiÅŸim türü %s" + +#: elf32-arm.h:1228 +#, c-format +msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'." +msgstr "%s: Uyarı: Arm BLX iÅŸlemi Arm iÅŸlevi '%s' hedefliyor." + +#: elf32-arm.h:1424 +#, c-format +msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'." +msgstr "%s: Uyarı: Thumb BLX iÅŸlemi thumb iÅŸlevi '%s'ı hedefliyor." + +#: elf32-arm.h:1918 elf32-sh.c:4706 elf64-sh64.c:1613 +#, c-format +msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section" +msgstr "%s(%s+0x%lx): SEC_MERGE bölümüne %s yerdeÄŸiÅŸimi" + +#: elf32-arm.h:2012 +#, c-format +msgid "%s: warning: unresolvable relocation %d against symbol `%s' from %s section" +msgstr "%1$s: uyarı: %4$s bölümünden `%3$s' sembolüne çözümlenemeyen %2$d yer deÄŸiÅŸimi" + +#: elf32-arm.h:2202 +#, c-format +msgid "Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it" +msgstr "Uyarı: %2$s'deki beraber çalışmaz kod ona baÄŸlandığı için %1$s'nin beraber çalışma bayrağı temizlendi" + +#: elf32-arm.h:2302 +#, c-format +msgid "ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d" +msgstr "Hata: %s EABI sürüm %d için derlenmiÅŸ, fakat %s %d sürümü için derlenmiÅŸ" + +#: elf32-arm.h:2316 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d" +msgstr "HATA: %s, APCS-%d için derlenmiÅŸ fakat hedef %s APCS-%d kullanıyor" + +#: elf32-arm.h:2344 +#, c-format +msgid "ERROR: %s uses VFP instructions, whereas %s does not" +msgstr "Hata: %s VFP iÅŸlemi kullanıyor, fakat %s kullanmıyor" + +#: elf32-arm.h:2349 +#, c-format +msgid "ERROR: %s uses FPA instructions, whereas %s does not" +msgstr "Hata: %s FPA iÅŸlemi kullanıyor, fakat %s kullanmıyor" + +#: elf32-arm.h:2360 elf32-arm.h:2365 +#, c-format +msgid "ERROR: %s uses Maverick instructions, whereas %s does not" +msgstr "Hata: %s Maverick iÅŸlemi kullanıyor, fakat %s kullanmıyor" + +#: elf32-arm.h:2385 +#, c-format +msgid "ERROR: %s uses software FP, whereas %s uses hardware FP" +msgstr "" +"Hata: %s yazılımda kayan sayı kullanıyor,\n" +" fakat %s donanımda kayan sayı kullanıyor" + +#: elf32-arm.h:2390 +#, c-format +msgid "ERROR: %s uses hardware FP, whereas %s uses software FP" +msgstr "" +"Hata: %s donanımda kayan sayı kullanıyor,\n" +" fakat %s yazılımda kayan sayı kullanıyor" + +#. Ignore init flag - it may not be set, despite the flags field +#. containing valid data. +#: elf32-arm.h:2443 elf32-cris.c:2975 elf32-m68hc1x.c:1459 elf32-m68k.c:397 +#: elf32-vax.c:546 elfxx-mips.c:9238 +#, c-format +msgid "private flags = %lx:" +msgstr "özel bayraklar = %lx:" + +#: elf32-arm.h:2452 +msgid " [interworking enabled]" +msgstr " [beraber çalışma etkinleÅŸtirilmiÅŸ]" + +#: elf32-arm.h:2460 +msgid " [VFP float format]" +msgstr " [VFP kayan nokta biçemi]" + +#: elf32-arm.h:2462 +msgid " [Maverick float format]" +msgstr " [Maverick kayan nokta biçemi]" + +#: elf32-arm.h:2464 +msgid " [FPA float format]" +msgstr " [FPA kayan nokta biçemi]" + +#: elf32-arm.h:2473 +msgid " [new ABI]" +msgstr " [yeni ABI]" + +#: elf32-arm.h:2476 +msgid " [old ABI]" +msgstr " [eski ABI]" + +#: elf32-arm.h:2479 +msgid " [software FP]" +msgstr " [yazılım FP]" + +#: elf32-arm.h:2488 +msgid " [Version1 EABI]" +msgstr " [Sürüm1 EABI]" + +#: elf32-arm.h:2491 elf32-arm.h:2502 +msgid " [sorted symbol table]" +msgstr " [sıralanmış sembol tablosu]" + +#: elf32-arm.h:2493 elf32-arm.h:2504 +msgid " [unsorted symbol table]" +msgstr " [sıralanmamış sembol tablosu]" + +#: elf32-arm.h:2499 +msgid " [Version2 EABI]" +msgstr " [Sürüm2 EABI]" + +#: elf32-arm.h:2507 +msgid " [dynamic symbols use segment index]" +msgstr " [dinamik semboller bölüm indeksini kullanıyor]" + +#: elf32-arm.h:2510 +msgid " [mapping symbols precede others]" +msgstr " [eÅŸleÅŸme sembolleri diÄŸerlerinden önceliklidir]" + +#: elf32-arm.h:2517 +msgid " " +msgstr " " + +#: elf32-arm.h:2524 +msgid " [relocatable executable]" +msgstr " [yer deÄŸiÅŸtirebilir uygulama]" + +#: elf32-arm.h:2527 +msgid " [has entry point]" +msgstr " [girdi noktası var]" + +#: elf32-arm.h:2532 +msgid "" +msgstr "" + +#: elf32-avr.c:820 elf32-cris.c:1398 elf32-fr30.c:642 elf32-frv.c:823 +#: elf32-i860.c:1036 elf32-ip2k.c:1597 elf32-iq2000.c:707 elf32-msp430.c:518 +#: elf32-openrisc.c:444 elf32-v850.c:1785 elf32-xstormy16.c:984 +#: elf64-mmix.c:1340 +msgid "internal error: dangerous relocation" +msgstr "iç hata: tehlikeli yer deÄŸiÅŸim" + +#: elf32-cris.c:931 +#, c-format +msgid "%s: unresolvable relocation %s against symbol `%s' from %s section" +msgstr "%1$s: uyarı: %4$s bölümünden `%3$s' sembolüne çözümlenemeyen %2$s yer deÄŸiÅŸimi" + +#: elf32-cris.c:993 +#, c-format +msgid "%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section" +msgstr "%1$s: %4$s bölümünden `%3$s' sembolüne %2$s yer deÄŸiÅŸimi için PLT veya GOT yok" + +#: elf32-cris.c:996 elf32-cris.c:1122 +msgid "[whose name is lost]" +msgstr "[adı kaybolmuÅŸ]" + +#: elf32-cris.c:1111 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against local symbol from %s section" +msgstr "" +"%1$s: %4$s bölümünden yerel sembol sıfır olmayan %3$d eklemesi ile\n" +" %2$s yerdeÄŸiÅŸimi" + +#: elf32-cris.c:1118 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against symbol `%s' from %s section" +msgstr "%1$s: %5$s bölümünden `%4$s' sembolüne sıfır olmayan %3$d eklemesi ile %2$s yerdeÄŸiÅŸimi" + +#: elf32-cris.c:1143 +#, c-format +msgid "%s: relocation %s is not allowed for global symbol: `%s' from %s section" +msgstr "%1$s: %4$s bölümünden %3$s evrensel sembolü için %2$s yerdeÄŸiÅŸimi yapılamaz" + +#: elf32-cris.c:1158 +#, c-format +msgid "%s: relocation %s in section %s with no GOT created" +msgstr "%1$s: `%3$s' bölümünde %2$s yer deÄŸiÅŸtirmesi mevcut, fakat GOT oluÅŸturulmamış" + +#: elf32-cris.c:1277 +#, c-format +msgid "%s: Internal inconsistency; no relocation section %s" +msgstr "%s: İç tutarsızlık; %s yerdeÄŸiÅŸim bölümü yok" + +#: elf32-cris.c:2500 +#, c-format +msgid "" +"%s, section %s:\n" +" relocation %s should not be used in a shared object; recompile with -fPIC" +msgstr "" +"%s, %s bölümü:\n" +" %s yer deÄŸiÅŸimi paylaşımlı nesne oluÅŸtururken kullanılamaz;\n" +" -fPIC ile yeniden derleyin" + +#: elf32-cris.c:2978 +msgid " [symbols have a _ prefix]" +msgstr " [semboller _ önekine sahip]" + +#: elf32-cris.c:3017 +#, c-format +msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols" +msgstr "%s: _-önekli sembolleri kullanıyor, fakat dosyaya öneksiz sembolleri yazıyor" + +#: elf32-cris.c:3018 +#, c-format +msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols" +msgstr "%s: öneksiz sembolleri kullanıyor, fakat dosyaya _-önekli sembolleri yazıyor" + +#: elf32-frv.c:1223 +#, c-format +msgid "%s: compiled with %s and linked with modules that use non-pic relocations" +msgstr "%s: %s ile derlendi ve normal derlenmiÅŸ modüllerle baÄŸlandı" + +#: elf32-frv.c:1273 elf32-iq2000.c:895 +#, c-format +msgid "%s: compiled with %s and linked with modules compiled with %s" +msgstr "%s: %s ile derlendi ve %s ile derlenmiÅŸ modüllerle baÄŸlandı" + +#: elf32-frv.c:1285 +#, c-format +msgid "%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%s: önceki modüllerden farklı bilinmeyen e_flags (0x%lx) alanları kullanılıyor (0x%lx)" + +#: elf32-frv.c:1321 elf32-iq2000.c:933 +#, c-format +msgid "private flags = 0x%lx:" +msgstr "özel bayraklar = 0x%lx:" + +#: elf32-gen.c:83 elf64-gen.c:82 +#, c-format +msgid "%s: Relocations in generic ELF (EM: %d)" +msgstr "%s: Normal ELF'de yerdeÄŸiÅŸimler (EM: %d)" + +#: elf32-hppa.c:672 elf32-m68hc1x.c:176 elf64-ppc.c:3118 +#, c-format +msgid "%s: cannot create stub entry %s" +msgstr "%s: koçan giriÅŸi %s oluÅŸturulamadı" + +#: elf32-hppa.c:957 elf32-hppa.c:3538 +#, c-format +msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections" +msgstr "%s(%s+0x%lx): %s'e ulaşılamadı, -ffunction-sections ile derleyin" + +#: elf32-hppa.c:1340 elf64-x86-64.c:672 elf64-x86-64.c:797 +#, c-format +msgid "%s: relocation %s can not be used when making a shared object; recompile with -fPIC" +msgstr "%s: %s yer deÄŸiÅŸimi paylaşımlı nesne oluÅŸturulurken kullanılamaz; -fPIC ile yeniden derleyin" + +#: elf32-hppa.c:1360 +#, c-format +msgid "%s: relocation %s should not be used when making a shared object; recompile with -fPIC" +msgstr "%s: %s yer deÄŸiÅŸimi paylaşımlı nesne oluÅŸtururken kullanılamaz; -fPIC ile yeniden derleyin" + +#: elf32-hppa.c:1553 +#, c-format +msgid "Could not find relocation section for %s" +msgstr "%s için yer deÄŸiÅŸtirme bölümü bulunamadı" + +#: elf32-hppa.c:2828 +#, c-format +msgid "%s: duplicate export stub %s" +msgstr "%s: birden fazla ihraç koçanı %s" + +#: elf32-hppa.c:3416 +#, c-format +msgid "%s(%s+0x%lx): fixing %s" +msgstr "%s(%s+0x%lx): %s düzeltiliyor" + +#: elf32-hppa.c:4039 +#, c-format +msgid "%s(%s+0x%lx): cannot handle %s for %s" +msgstr "%1$s(%2$s+0x%3$lx): %5$s için %4$s iÅŸlenemedi" + +#: elf32-hppa.c:4357 +msgid ".got section not immediately after .plt section" +msgstr ".got bölümü .plt bölümünün hemen arkasında deÄŸil" + +#: elf32-i386.c:326 +#, c-format +msgid "%s: invalid relocation type %d" +msgstr "%s: geçersiz yer deÄŸiÅŸim türü %d" + +#: elf32-i386.c:841 elf32-s390.c:990 elf32-sparc.c:887 elf32-xtensa.c:637 +#: elf64-s390.c:943 elf64-x86-64.c:650 +#, c-format +msgid "%s: bad symbol index: %d" +msgstr "%s: geçersiz sembol indeksi: %d" + +#: elf32-i386.c:949 elf32-s390.c:1168 elf32-sh.c:6426 elf32-sparc.c:1011 +#: elf64-s390.c:1129 +#, c-format +msgid "%s: `%s' accessed both as normal and thread local symbol" +msgstr "%s: `%s'a hem normal, hem de dal yerel sembolü olarak eriÅŸildi" + +#: elf32-i386.c:1064 elf32-s390.c:1279 elf64-ppc.c:3929 elf64-s390.c:1243 +#: elf64-x86-64.c:886 +#, c-format +msgid "%s: bad relocation section name `%s'" +msgstr "%s: geçersiz yerdeÄŸiÅŸim bölümü adı `%s'" + +#: elf32-i386.c:2908 elf32-m68k.c:1757 elf32-s390.c:3022 elf32-sparc.c:2879 +#: elf32-xtensa.c:2193 elf64-s390.c:3018 elf64-sparc.c:2664 +#: elf64-x86-64.c:2452 +#, c-format +msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'" +msgstr "%s(%s+0x%lx): `%s' sembolüne çözümlenemeyen yer deÄŸiÅŸimi" + +#: elf32-i386.c:2947 elf32-m68k.c:1796 elf32-s390.c:3072 elf64-s390.c:3068 +#: elf64-x86-64.c:2490 +#, c-format +msgid "%s(%s+0x%lx): reloc against `%s': error %d" +msgstr "%s(%s+0x%lx): %s'e yer deÄŸiÅŸimi: %d hatası" + +#: elf32-ip2k.c:565 elf32-ip2k.c:571 elf32-ip2k.c:734 elf32-ip2k.c:740 +msgid "ip2k relaxer: switch table without complete matching relocation information." +msgstr "ip2k esneticisi: tamamen eÅŸleÅŸen yerdeÄŸiÅŸim bilgisi olmadan tabloyu deÄŸiÅŸtirir." + +#: elf32-ip2k.c:588 elf32-ip2k.c:767 +msgid "ip2k relaxer: switch table header corrupt." +msgstr "ip2k esneticisi: deÄŸiÅŸiklik tablosu baÅŸlığı bozuk." + +#: elf32-ip2k.c:1395 +#, c-format +msgid "ip2k linker: missing page instruction at 0x%08lx (dest = 0x%08lx)." +msgstr "ip2k baÄŸlayıcısı: 0x%08lx adresinde sayfa iÅŸlemi eksik (hedef = 0x%08lx)." + +#: elf32-ip2k.c:1409 +#, c-format +msgid "ip2k linker: redundant page instruction at 0x%08lx (dest = 0x%08lx)." +msgstr "ip2k baÄŸlayıcısı: 0x%08lx adresinde gereksiz sayfa iÅŸlemi (hedef = 0x%08lx)." + +#. Only if it's not an unresolved symbol. +#: elf32-ip2k.c:1593 +msgid "unsupported relocation between data/insn address spaces" +msgstr "veri/iÅŸlem adres yerleri arasında desteklenmeyen yerdeÄŸiÅŸim" + +#: elf32-iq2000.c:907 elf32-m68hc1x.c:1431 elf32-ppc.c:2175 elf64-sparc.c:3072 +#: elfxx-mips.c:9195 +#, c-format +msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "%1$s: önceki modüllerden (0x%3$lx) farklı e_flags (0x%2$lx) alanları kullanılıyor" + +#: elf32-m32r.c:930 +msgid "SDA relocation when _SDA_BASE_ not defined" +msgstr "_SDA_BASE_ tanımlanmamış iken SDA yer deÄŸiÅŸimi" + +#: elf32-m32r.c:1018 elf64-alpha.c:4279 elf64-alpha.c:4407 elf32-ia64.c:3958 +#: elf64-ia64.c:3958 +#, c-format +msgid "%s: unknown relocation type %d" +msgstr "%s: bilinmeyen yer deÄŸiÅŸim türü %d" + +#: elf32-m32r.c:1226 +#, c-format +msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)" +msgstr "%1$s: Bir %3$s yer deÄŸiÅŸiminin hedefi (%2$s) yanlış bölümde (%4$s)" + +#: elf32-m32r.c:1952 +#, c-format +msgid "%s: Instruction set mismatch with previous modules" +msgstr "%s: Önceki modüllerle iÅŸlem uyuÅŸmazlığı" + +#: elf32-m32r.c:1975 +#, c-format +msgid "private flags = %lx" +msgstr "özel bayraklar = %lx" + +#: elf32-m32r.c:1980 +msgid ": m32r instructions" +msgstr ": m32r iÅŸlemleri" + +#: elf32-m32r.c:1981 +msgid ": m32rx instructions" +msgstr ": m32rx iÅŸlemleri" + +#: elf32-m68hc1x.c:1217 +#, c-format +msgid "Reference to the far symbol `%s' using a wrong relocation may result in incorrect execution" +msgstr "Uzak sembol `%s''ye yanlış bir yerdeÄŸiÅŸim ile referans yanlış iÅŸlemeye yol açabilir." + +#: elf32-m68hc1x.c:1240 +#, c-format +msgid "banked address [%lx:%04lx] (%lx) is not in the same bank as current banked address [%lx:%04lx] (%lx)" +msgstr "saklanmış adres [%lx:%04lx] (%lx) ÅŸimdiki saklanmış adres [%lx:%04lx] (%lx) ile aynı saklama bankında deÄŸil" + +#: elf32-m68hc1x.c:1259 +#, c-format +msgid "reference to a banked address [%lx:%04lx] in the normal address space at %04lx" +msgstr "%3$04lx normal adresinde saklanmış adres [%1$lx:%2$04lx]'e referans var" + +#: elf32-m68hc1x.c:1396 +#, c-format +msgid "%s: linking files compiled for 16-bit integers (-mshort) and others for 32-bit integers" +msgstr "%s: 16-bit tamsayı için derlenmiÅŸ (-mshort) dosyalar, 32 bit tamsayı için derlenmiÅŸ baÅŸka dosyalarla baÄŸlanıyor" + +#: elf32-m68hc1x.c:1404 +#, c-format +msgid "%s: linking files compiled for 32-bit double (-fshort-double) and others for 64-bit double" +msgstr "%s: 32-bit double (-fshort-double) için derlenmiÅŸ dosyalar 64-bit double için derlenmiÅŸ dosyalarla baÄŸlanıyor" + +#: elf32-m68hc1x.c:1414 +#, c-format +msgid "%s: linking files compiled for HCS12 with others compiled for HC12" +msgstr "%s: HCS12 için derlenmiÅŸ dosyalar HC12 için derlenmiÅŸ dosyalarla baÄŸlanıyor" + +#: elf32-m68hc1x.c:1462 +msgid "[abi=32-bit int, " +msgstr "[abi=32-bit int, " + +#: elf32-m68hc1x.c:1464 +msgid "[abi=16-bit int, " +msgstr "[abi=16-bit int, " + +#: elf32-m68hc1x.c:1467 +msgid "64-bit double, " +msgstr "64-bit double, " + +#: elf32-m68hc1x.c:1469 +msgid "32-bit double, " +msgstr "32-bit double, " + +#: elf32-m68hc1x.c:1472 +msgid "cpu=HC11]" +msgstr "cpu=HC11]" + +#: elf32-m68hc1x.c:1474 +msgid "cpu=HCS12]" +msgstr "cpu=HCS12]" + +#: elf32-m68hc1x.c:1476 +msgid "cpu=HC12]" +msgstr "cpu=HC12]" + +#: elf32-m68hc1x.c:1479 +msgid " [memory=bank-model]" +msgstr " [bellek=bank türü]" + +#: elf32-m68hc1x.c:1481 +msgid " [memory=flat]" +msgstr " [bellek=düz]" + +#: elf32-m68k.c:400 +msgid " [cpu32]" +msgstr " [cpu32]" + +#: elf32-m68k.c:403 +msgid " [m68000]" +msgstr " [m68000]" + +#: elf32-mcore.c:353 elf32-mcore.c:456 +#, c-format +msgid "%s: Relocation %s (%d) is not currently supported.\n" +msgstr "%s: %s (%d) yer deÄŸiÅŸimi henüz desteklenmiyor.\n" + +#: elf32-mcore.c:441 +#, c-format +msgid "%s: Unknown relocation type %d\n" +msgstr "%s: Bilinmeyen yer deÄŸiÅŸim türü %d\n" + +#: elf32-mips.c:1170 elf64-mips.c:1717 elfn32-mips.c:1664 +msgid "32bits gp relative relocation occurs for an external symbol" +msgstr "32 bitlik gp göreceli yer deÄŸiÅŸim bir dış sembol için yapılıyor" + +#: elf32-mips.c:1314 elf64-mips.c:1830 elfn32-mips.c:1783 +#, c-format +msgid "Linking mips16 objects into %s format is not supported" +msgstr "mips16 nesnelerini %s biçemine baÄŸlamak desteklenmiyor" + +#: elf32-ppc.c:2056 +#, c-format +msgid "generic linker can't handle %s" +msgstr "jenerik baÄŸlayıcı %s desteklemiyor" + +#: elf32-ppc.c:2138 +#, c-format +msgid "%s: compiled with -mrelocatable and linked with modules compiled normally" +msgstr "%s: -mrelocatable ile derlendi ve normal derlenmiÅŸ modüllerle baÄŸlandı" + +#: elf32-ppc.c:2147 +#, c-format +msgid "%s: compiled normally and linked with modules compiled with -mrelocatable" +msgstr "%s: normal derlendi ve -mrelocatable ile derlenmiÅŸ modüllere baÄŸlandı" + +#: elf32-ppc.c:3413 +#, c-format +msgid "%s: relocation %s cannot be used when making a shared object" +msgstr "%s: %s yerdeÄŸiÅŸimi paylaşımlı nesne oluÅŸturulurken kullanılamaz" + +#. It does not make sense to have a procedure linkage +#. table entry for a local symbol. +#: elf32-ppc.c:3619 +#, c-format +msgid "%s(%s+0x%lx): %s reloc against local symbol" +msgstr "%s(%s+0x%lx): %s yerel sembole yerdeÄŸiÅŸimi" + +#: elf32-ppc.c:4862 elf64-ppc.c:7789 +#, c-format +msgid "%s: unknown relocation type %d for symbol %s" +msgstr "%1$s: %3$s sembolü için bilinmeyen %2$d türünde yerdeÄŸiÅŸimi" + +#: elf32-ppc.c:5113 +#, c-format +msgid "%s(%s+0x%lx): non-zero addend on %s reloc against `%s'" +msgstr "%1$s(%2$s+0x%3$lx): %5$s'ye yerdeÄŸiÅŸimde `%4$s'de sıfır olmayan ekleme" + +#: elf32-ppc.c:5399 elf32-ppc.c:5425 elf32-ppc.c:5484 +#, c-format +msgid "%s: the target (%s) of a %s relocation is in the wrong output section (%s)" +msgstr "%1$s: %3$s yerdeÄŸiÅŸiminin hedefi (%2$s) yanlış çıktı bölümünde (%4$s)" + +#: elf32-ppc.c:5539 +#, c-format +msgid "%s: relocation %s is not yet supported for symbol %s." +msgstr "%s: %s yerdeÄŸiÅŸimi %s sembolü için henüz desteklenmiyor." + +#: elf32-ppc.c:5594 elf64-ppc.c:8461 +#, c-format +msgid "%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'" +msgstr "%1$s(%2$s+0x%3$lx): `%5$s' sembolüne çözümlenemeyen yer deÄŸiÅŸimi %4$s" + +#: elf32-ppc.c:5644 elf64-ppc.c:8507 +#, c-format +msgid "%s(%s+0x%lx): %s reloc against `%s': error %d" +msgstr "%1$s(%2$s+0x%3$lx): %5$s'e %4$s yer deÄŸiÅŸimi: %6$d hatası" + +#: elf32-ppc.c:5888 +#, c-format +msgid "corrupt or empty %s section in %s" +msgstr "%2$s içinde bozuk veya boÅŸ %1$s bölümü" + +#: elf32-ppc.c:5895 +#, c-format +msgid "unable to read in %s section from %s" +msgstr "%s bölümü %s'den okunamadı" + +#: elf32-ppc.c:5901 +#, c-format +msgid "corrupt %s section in %s" +msgstr "%2$s içinde bozuk %1$s bölümü" + +#: elf32-ppc.c:5944 +#, c-format +msgid "warning: unable to set size of %s section in %s" +msgstr "uyarı: %2$s içinde %1$s bölümünün boyu atanamadı" + +#: elf32-ppc.c:5994 +msgid "failed to allocate space for new APUinfo section." +msgstr "yeni APUinfo bölümü için yer ayrılamadı." + +#: elf32-ppc.c:6013 +msgid "failed to compute new APUinfo section." +msgstr "yeni APUinfo bölümü hesaplanamadı." + +#: elf32-ppc.c:6016 +msgid "failed to install new APUinfo section." +msgstr "yeni APUinfo bölümü kurulamadı." + +#: elf32-s390.c:2256 elf64-s390.c:2226 +#, c-format +msgid "%s(%s+0x%lx): invalid instruction for TLS relocation %s" +msgstr "%s(%s+0x%lx): TLS yerdeÄŸiÅŸimi %s için geçersiz iÅŸlem" + +#: elf32-sh.c:2103 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES offset" +msgstr "%s: 0x%lx: uyarı: hatalı R_SH_USES göreli konumu" + +#: elf32-sh.c:2115 +#, c-format +msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x" +msgstr "%s: 0x%lx: uyarı: R_SH_USES bilinmeyen insn 0x%x'ı imliyor" + +#: elf32-sh.c:2132 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES load offset" +msgstr "%s: 0x%lx: uyarı: hatalı R_SH_USES yükleme göreli konumu" + +#: elf32-sh.c:2147 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected reloc" +msgstr "%s: 0x%lx: uyarı: beklenen yerdeÄŸiÅŸim bulunamadı" + +#: elf32-sh.c:2175 +#, c-format +msgid "%s: 0x%lx: warning: symbol in unexpected section" +msgstr "%s: 0x%lx: uyarı: beklenmeyen bölümde sembol" + +#: elf32-sh.c:2300 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected COUNT reloc" +msgstr "%s: 0x%lx: uyarı: beklenen COUNT yerdeÄŸiÅŸimi bulunamadı" + +#: elf32-sh.c:2309 +#, c-format +msgid "%s: 0x%lx: warning: bad count" +msgstr "%s: 0x%lx: uyarı: hatalı sayım" + +#: elf32-sh.c:2712 elf32-sh.c:3088 +#, c-format +msgid "%s: 0x%lx: fatal: reloc overflow while relaxing" +msgstr "%s: 0x%lx: ölümcül: gevÅŸetilirken yerdeÄŸiÅŸim taÅŸması" + +#: elf32-sh.c:4654 elf64-sh64.c:1585 +msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled" +msgstr "Yerel sembolde STO_SH5_ISA32 desteklenmiyor" + +#: elf32-sh.c:4809 +#, c-format +msgid "%s: unresolvable relocation against symbol `%s' from %s section" +msgstr "%1$s: %3$s bölümünden `%2$s' sembolüne çözümlenemeyen yer deÄŸiÅŸimi" + +#: elf32-sh.c:4881 +#, c-format +msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation" +msgstr "%s: 0x%lx: ölümcül: gevÅŸetme destek yerdeÄŸiÅŸimi için hizalanmamış dal" + +#: elf32-sh.c:6627 elf64-alpha.c:4848 +#, c-format +msgid "%s: TLS local exec code cannot be linked into shared objects" +msgstr "%s: TLS yerel çalıştırma kodu paylaşımlı nesnelere baÄŸlanamaz" + +#: elf32-sh64.c:221 elf64-sh64.c:2407 +#, c-format +msgid "%s: compiled as 32-bit object and %s is 64-bit" +msgstr "%s: 32 bitlik sistem için derlenmiÅŸ ve %s 64 bit" + +#: elf32-sh64.c:224 elf64-sh64.c:2410 +#, c-format +msgid "%s: compiled as 64-bit object and %s is 32-bit" +msgstr "%s: 64 bitlik sistem için derlenmiÅŸ ve %s 32 bit" + +#: elf32-sh64.c:226 elf64-sh64.c:2412 +#, c-format +msgid "%s: object size does not match that of target %s" +msgstr "%s: nesne boyu hedef %s'nin boyuyla eÅŸleÅŸmiyor" + +#: elf32-sh64.c:461 elf64-sh64.c:2990 +#, c-format +msgid "%s: encountered datalabel symbol in input" +msgstr "%s: girdide veri etiketi sembolüne rastlandı" + +#: elf32-sh64.c:544 +msgid "PTB mismatch: a SHmedia address (bit 0 == 1)" +msgstr "PTB uyumsuzluÄŸu: SHmedia adresi (bit 0 == 1)" + +#: elf32-sh64.c:547 +msgid "PTA mismatch: a SHcompact address (bit 0 == 0)" +msgstr "PTA uyumsuzluÄŸu: SHcompact adresi (bit 0 == 0)" + +#: elf32-sh64.c:565 +#, c-format +msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16" +msgstr "%s: GAS hatası: R_SH_PT_16 içeren PTB yönergesi beklenmiyordu" + +#: elf32-sh64.c:614 elf64-sh64.c:1748 +#, c-format +msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n" +msgstr "%1$s: %3$08x ve %4$08x yerdeÄŸiÅŸtirmesinde hizalanmamış yer deÄŸiÅŸtirme türü %2$d\n" + +#: elf32-sh64.c:698 +#, c-format +msgid "%s: could not write out added .cranges entries" +msgstr "%s: eklenen .cranges girdileri yazılamadı" + +#: elf32-sh64.c:760 +#, c-format +msgid "%s: could not write out sorted .cranges entries" +msgstr "%s: sıralanmış .cranges girdileri yazılamadı" + +#: elf32-sparc.c:2521 elf64-sparc.c:2314 +#, c-format +msgid "%s: probably compiled without -fPIC?" +msgstr "%s: acaba -fPIC olmaksızın mı derlenmiÅŸ?" + +#: elf32-sparc.c:3348 +#, c-format +msgid "%s: compiled for a 64 bit system and target is 32 bit" +msgstr "%s: 64 bitlik sistem için derlenmiÅŸ ve hedef 32 bit" + +#: elf32-sparc.c:3362 +#, c-format +msgid "%s: linking little endian files with big endian files" +msgstr "%s: küçük sonlu dosyalar büyük sonlu dosyalarla baÄŸlanıyor" + +#: elf32-v850.c:753 +#, c-format +msgid "Variable `%s' cannot occupy in multiple small data regions" +msgstr "`%s' deÄŸiÅŸkeni birden fazla küçük veri sahasını kapsayamaz" + +#: elf32-v850.c:756 +#, c-format +msgid "Variable `%s' can only be in one of the small, zero, and tiny data regions" +msgstr "`%s' deÄŸiÅŸkeni küçük, sıfır ve ufak veri sahalarından yalnız birinde olabilir" + +#: elf32-v850.c:759 +#, c-format +msgid "Variable `%s' cannot be in both small and zero data regions simultaneously" +msgstr "`%s' deÄŸiÅŸkeni aynı anda hem küçük hem sıfır veri sahalarında bulunamaz" + +#: elf32-v850.c:762 +#, c-format +msgid "Variable `%s' cannot be in both small and tiny data regions simultaneously" +msgstr "`%s' deÄŸiÅŸkeni aynı anda hem küçük hem ufak veri sahalarında bulunamaz" + +#: elf32-v850.c:765 +#, c-format +msgid "Variable `%s' cannot be in both zero and tiny data regions simultaneously" +msgstr "`%s' deÄŸiÅŸkeni aynı anda hem sıfır hem ufak veri sahalarında bulunamaz" + +#: elf32-v850.c:1144 +msgid "FAILED to find previous HI16 reloc\n" +msgstr "önceki HI16 yerdeÄŸiÅŸimi BULUNAMADI\n" + +#: elf32-v850.c:1789 +msgid "could not locate special linker symbol __gp" +msgstr "özel baÄŸlayıcı sembolü __gp bulunamadı" + +#: elf32-v850.c:1793 +msgid "could not locate special linker symbol __ep" +msgstr "özel baÄŸlayıcı sembolü __ep bulunamadı" + +#: elf32-v850.c:1797 +msgid "could not locate special linker symbol __ctbp" +msgstr "özel baÄŸlayıcı sembolü __ctbp bulunamadı" + +#: elf32-v850.c:1963 +#, c-format +msgid "%s: Architecture mismatch with previous modules" +msgstr "%s: Önceki modüllerle platform uyumsuzluÄŸu" + +#: elf32-v850.c:1983 +#, c-format +msgid "private flags = %lx: " +msgstr "özel bayraklar = %lx:" + +#: elf32-v850.c:1988 +msgid "v850 architecture" +msgstr "v850 platformu" + +#: elf32-v850.c:1989 +msgid "v850e architecture" +msgstr "v850e platformu" + +#: elf32-vax.c:549 +msgid " [nonpic]" +msgstr " [nonpic]" + +#: elf32-vax.c:552 +msgid " [d-float]" +msgstr " [d-float]" + +#: elf32-vax.c:555 +msgid " [g-float]" +msgstr " [g-float]" + +#: elf32-vax.c:663 +#, c-format +msgid "%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of %ld" +msgstr "%1$s: uyarı: `%3$s'ye GOT %2$ld eklentisi bir önceki %4$ld GOT eklentisiyle eÅŸleÅŸmiyor" + +#: elf32-vax.c:1667 +#, c-format +msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored" +msgstr "%1$s: uyarı: %4$s bölümünden `%3$s' sembolüne PLT eklentisi %2$d yok sayıldı" + +#: elf32-vax.c:1802 +#, c-format +msgid "%s: warning: %s relocation against symbol `%s' from %s section" +msgstr "%1$s: uyarı: %4$s bölümünden `%3$s' sembolüne %2$s yer deÄŸiÅŸimi" + +#: elf32-vax.c:1808 +#, c-format +msgid "%s: warning: %s relocation to 0x%x from %s section" +msgstr "%1$s: uyarı: %4$s bölümünden 0x%3$x'e %2$s yer deÄŸiÅŸimi" + +#: elf32-xstormy16.c:462 elf32-ia64.c:2450 elf64-ia64.c:2450 +msgid "non-zero addend in @fptr reloc" +msgstr "@fptr yerdeÄŸiÅŸiminde sıfır olmayan eklenti" + +#: elf64-alpha.c:1108 +msgid "GPDISP relocation did not find ldah and lda instructions" +msgstr "GPDISP yerdeÄŸiÅŸimi ldah ve lda iÅŸlemlerini bulamadı" + +#: elf64-alpha.c:3731 +#, c-format +msgid "%s: .got subsegment exceeds 64K (size %d)" +msgstr "%s: .got alt parçası 64K'yı aşıyor (boy %d)" + +#: elf64-alpha.c:4602 elf64-alpha.c:4614 +#, c-format +msgid "%s: gp-relative relocation against dynamic symbol %s" +msgstr "%s: %s dinamik sembolüne gp göreceli yer deÄŸiÅŸimi" + +#: elf64-alpha.c:4640 elf64-alpha.c:4773 +#, c-format +msgid "%s: pc-relative relocation against dynamic symbol %s" +msgstr "%s: %s dinamik sembolüne pc göreceli yer deÄŸiÅŸimi" + +#: elf64-alpha.c:4668 +#, c-format +msgid "%s: change in gp: BRSGP %s" +msgstr "%s: gp içinde deÄŸiÅŸiklik: BRSGP %s" + +#: elf64-alpha.c:4693 +msgid "" +msgstr "" + +#: elf64-alpha.c:4698 +#, c-format +msgid "%s: !samegp reloc against symbol without .prologue: %s" +msgstr "%s: .prologue olmaksızın sembole !samegp yerdeÄŸiÅŸimi: %s" + +#: elf64-alpha.c:4749 +#, c-format +msgid "%s: unhandled dynamic relocation against %s" +msgstr "%s: %s'e desteklenmeyen dinamik yerdeÄŸiÅŸim" + +#: elf64-alpha.c:4832 +#, c-format +msgid "%s: dtp-relative relocation against dynamic symbol %s" +msgstr "%s: %s dinamik sembolüne dtp göreceli yer deÄŸiÅŸimi" + +#: elf64-alpha.c:4855 +#, c-format +msgid "%s: tp-relative relocation against dynamic symbol %s" +msgstr "%s: %s dinamik sembolüne tp göreceli yer deÄŸiÅŸimi" + +#: elf64-hppa.c:2086 +#, c-format +msgid "stub entry for %s cannot load .plt, dp offset = %ld" +msgstr "%s için koçan girdisi .plt'yi yükleyemedi, dp görecesi = %ld" + +#: elf64-mmix.c:1032 +#, c-format +msgid "" +"%s: Internal inconsistency error for value for\n" +" linker-allocated global register: linked: 0x%lx%08lx != relaxed: 0x%lx%08lx\n" +msgstr "" +"%s: baÄŸlayıcı tarafından ayrılmış global yazmaç deÄŸeri için iç tutarsızlık hatası:\n" +" 0x%lx%08lx != gevÅŸetilmiÅŸ: 0x%lx%08lx\n" + +#: elf64-mmix.c:1416 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: (unknown) in %s" +msgstr "%s: yazmaç sembolüne temel artı görece yerdeÄŸiÅŸimi: %s içinde (bilinmeyen)" + +#: elf64-mmix.c:1421 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: %s in %s" +msgstr "%1$s: yazmaç sembolüne temel artı görece yerdeÄŸiÅŸimi: %3$s içinde %2$s" + +#: elf64-mmix.c:1465 +#, c-format +msgid "%s: register relocation against non-register symbol: (unknown) in %s" +msgstr "%s: yazmaç olmayan sembole yazmaç yerdeÄŸiÅŸimi: %s içinde (bilinmeyen)" + +#: elf64-mmix.c:1470 +#, c-format +msgid "%s: register relocation against non-register symbol: %s in %s" +msgstr "%1$s: yazmaç olmayan sembole yazmaç yerdeÄŸiÅŸimi: %3$s içinde %2$s" + +#: elf64-mmix.c:1507 +#, c-format +msgid "%s: directive LOCAL valid only with a register or absolute value" +msgstr "%s: YEREL (LOCAL) yönergesi yalnız bir yazmaç veya kesin deÄŸerle geçerlidir" + +#: elf64-mmix.c:1535 +#, c-format +msgid "%s: LOCAL directive: Register $%ld is not a local register. First global register is $%ld." +msgstr "" +"%s: YEREL (LOCAL) yönergesi: $%ld yazmacı yerel yazmaç deÄŸil.\n" +" İlk evrensel yazmaç: $%ld." + +#: elf64-mmix.c:1994 +#, c-format +msgid "%s: Error: multiple definition of `%s'; start of %s is set in a earlier linked file\n" +msgstr "" +"%s: Hata: `%s' birden fazla defa tanımlanmış; %s'nin baÅŸlangıcı daha önce\n" +" baÄŸlanan bir dosyada.\n" + +#: elf64-mmix.c:2053 +msgid "Register section has contents\n" +msgstr "Yazmaç bölümünde içerik yok\n" + +#: elf64-mmix.c:2216 +#, c-format +msgid "" +"Internal inconsistency: remaining %u != max %u.\n" +" Please report this bug." +msgstr "" +"İç uyumsuzluk: kalan %u != maksimum %u. \n" +" Lütfen bu hatayı bildirin." + +#: elf64-ppc.c:2388 libbfd.c:831 +#, c-format +msgid "%s: compiled for a big endian system and target is little endian" +msgstr "%s: büyük sonlu sistem için derlenmiÅŸ ve hedef küçük sonlu" + +#: elf64-ppc.c:2391 libbfd.c:833 +#, c-format +msgid "%s: compiled for a little endian system and target is big endian" +msgstr "%s: küçük sonlu sistem için derlenmiÅŸ ve hedef büyük sonlu" + +#: elf64-ppc.c:4857 +#, c-format +msgid "%s: unexpected reloc type %u in .opd section" +msgstr "%s: opd bölümünde beklenmeyen yerdeÄŸiÅŸim türü %u" + +#: elf64-ppc.c:4877 +#, c-format +msgid "%s: .opd is not a regular array of opd entries" +msgstr "%s: opd, opd girdilerinin düzenli dizisi deÄŸil" + +#: elf64-ppc.c:4897 +#, c-format +msgid "%s: undefined sym `%s' in .opd section" +msgstr "%s: opd bölümünde tanımlanmamış `%s' sembolü" + +#: elf64-ppc.c:6136 +#, c-format +msgid "can't find branch stub `%s'" +msgstr "`%s' dal koçanı bulunamadı" + +#: elf64-ppc.c:6175 elf64-ppc.c:6250 +#, c-format +msgid "linkage table error against `%s'" +msgstr "`%s'ye baÄŸlama tablosu hatası" + +#: elf64-ppc.c:6340 +#, c-format +msgid "can't build branch stub `%s'" +msgstr "`%s' dal koçanı derlenemedi" + +#: elf64-ppc.c:7047 +msgid ".glink and .plt too far apart" +msgstr " glink ve plt birbirine fazla uzak" + +#: elf64-ppc.c:7135 +msgid "stubs don't match calculated size" +msgstr "koçanlar hesaplanan boyla eÅŸleÅŸmiyor" + +#: elf64-ppc.c:7147 +#, c-format +msgid "" +"linker stubs in %u groups\n" +" branch %lu\n" +" toc adjust %lu\n" +" long branch %lu\n" +" long toc adj %lu\n" +" plt call %lu" +msgstr "" +"%u grupta baÄŸlayıcı koçanları\n" +" dal %lu\n" +" toc ayarlama %lu\n" +" uzun dal %lu\n" +" uzun toc ayar%lu\n" +" plt çaÄŸrısı %lu" + +#: elf64-ppc.c:7723 +#, c-format +msgid "%s(%s+0x%lx): automatic multiple TOCs not supported using your crt files; recompile with -mminimal-toc or upgrade gcc" +msgstr "%s(%s+0x%lx): otomatik çoklu TOC sizin crt dosyalarınızı kullanarak desteklenmez; -mminimal-toc kullanarak yeniden derleyin veya gcc'de sürüm yükseltmesi yapın" + +#: elf64-ppc.c:7731 +#, c-format +msgid "%s(%s+0x%lx): sibling call optimization to `%s' does not allow automatic multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, or make `%s' extern" +msgstr "%s(%s+0x%lx): `%s'e kardeÅŸ çaÄŸrı iyileÅŸtirmesi otomatik çoklu TOCa izin vermez; -mminimal-toc veya -fno-optimize-sibling-calls ile yeniden derleyin, veya make `%s' extern" + +#: elf64-ppc.c:8329 +#, c-format +msgid "%s: relocation %s is not supported for symbol %s." +msgstr "%s: %s yerdeÄŸiÅŸimi %s sembolü için desteklenmiyor." + +#: elf64-ppc.c:8408 +#, c-format +msgid "%s: error: relocation %s not a multiple of %d" +msgstr "%s: hata: %s yerdeÄŸiÅŸimi %d'nin katı deÄŸil" + +#: elf64-sparc.c:1370 +#, c-format +msgid "%s: check_relocs: unhandled reloc type %d" +msgstr "%s: check_relocs: desteklenmeyen yerdeÄŸiÅŸim türü %d" + +#: elf64-sparc.c:1407 +#, c-format +msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER" +msgstr "%s: Yalnız %%g[2367] yazmaçları STT_REGISTER ile bildirilebilir" + +#: elf64-sparc.c:1427 +#, c-format +msgid "Register %%g%d used incompatibly: %s in %s, previously %s in %s" +msgstr "%%g%1$d yazmacı uyumsuz kullanılmış: %3$s içinde %2$s, daha önce %5$s içinde %4$s idi" + +#: elf64-sparc.c:1450 +#, c-format +msgid "Symbol `%s' has differing types: REGISTER in %s, previously %s in %s" +msgstr "`%1$s' sembolünün farklı türleri var: %2$s içinde REGISTER (yazmaç), daha önce %4$s içinde %3$s" + +#: elf64-sparc.c:1496 +#, c-format +msgid "Symbol `%s' has differing types: %s in %s, previously REGISTER in %s" +msgstr "" +"`%1$s' sembolünün farklı türleri var: %3$s içinde %2$s, \n" +" daha önce %4$s içinde REGISTER (yazmaç)" + +#: elf64-sparc.c:3053 +#, c-format +msgid "%s: linking UltraSPARC specific with HAL specific code" +msgstr "%s: UltraSPARC'a özel kod HAL'e özel kod ile baÄŸlanıyor" + +#: elf64-x86-64.c:739 +#, c-format +msgid "%s: %s' accessed both as normal and thread local symbol" +msgstr "%s: `%s'a hem normal, hem de iplikçik yerel sembolü olarak eriÅŸildi" + +#: elfcode.h:1113 +#, c-format +msgid "%s: version count (%ld) does not match symbol count (%ld)" +msgstr "%s: sürüm sayısı (%ld) sembol sayısı (%ld) ile eÅŸleÅŸmiyor" + +#: elfcode.h:1342 +#, c-format +msgid "%s(%s): relocation %d has invalid symbol index %ld" +msgstr "%s(%s): %d yerdeÄŸiÅŸimi geçersiz sembol indeksi %ld'ye sahip" + +#: elflink.c:1456 +#, c-format +msgid "%s: warning: unexpected redefinition of indirect versioned symbol `%s'" +msgstr "%s: uyarı: endirekt sürümlü sembol `%s' için beklenmeyen yeniden tanımlama" + +#: elflink.c:1807 +#, c-format +msgid "%s: undefined versioned symbol name %s" +msgstr "%s: sürümlü sembol ismi %s tanımlı deÄŸil" + +#: elflink.c:2142 +#, c-format +msgid "%s: relocation size mismatch in %s section %s" +msgstr "%1$s: %3$s bölümünde %2$s içinde yerdeÄŸiÅŸim boy uyuÅŸmazlığı" + +#: elflink.c:2434 +#, c-format +msgid "warning: type and size of dynamic symbol `%s' are not defined" +msgstr "uyarı: `%s' dinamik sembolünün türü ve boyu tanımlı deÄŸil" + +#: elflink.h:1022 +#, c-format +msgid "%s: %s: invalid version %u (max %d)" +msgstr "%s: %s: geçersiz sürüm %u (maksimum %d)" + +#: elflink.h:1063 +#, c-format +msgid "%s: %s: invalid needed version %d" +msgstr "%s: %s: geçersiz gerekli sürüm %d" + +#: elflink.h:1238 +#, c-format +msgid "Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s" +msgstr "Uyarı: %3$s içinde `%2$s' sembolünün %1$u hizalaması %5$s içinde %4$u'dan daha küçük" + +#: elflink.h:1252 +#, c-format +msgid "Warning: size of symbol `%s' changed from %lu in %s to %lu in %s" +msgstr "Uyarı: `%1$s' sembolünün boyu %3$s içinde %2$lu'dan %5$s içinde %4$lu'ya deÄŸiÅŸti" + +#: elflink.h:2160 +#, c-format +msgid "%s: undefined version: %s" +msgstr "%s: tanımsız sürüm: %s" + +#: elflink.h:2226 +#, c-format +msgid "%s: .preinit_array section is not allowed in DSO" +msgstr "%s: DSO içinde preinit_array'e izin verilmiyor" + +#: elflink.h:3078 +msgid "Not enough memory to sort relocations" +msgstr "YerdeÄŸiÅŸimleri sıralamak için gerekli bellek yok" + +#: elflink.h:3958 elflink.h:4001 +#, c-format +msgid "%s: could not find output section %s" +msgstr "%s: çıktı bölümü %s bulunamadı" + +#: elflink.h:3964 +#, c-format +msgid "warning: %s section has zero size" +msgstr "uyarı: %s bölümü sıfır boyunda" + +#: elflink.h:4483 +#, c-format +msgid "%s: %s symbol `%s' in %s is referenced by DSO" +msgstr "%1$s: %4$s içinde %2$s sembolü `%3$s' DSO tarafından referans ediliyor" + +#: elflink.h:4564 +#, c-format +msgid "%s: could not find output section %s for input section %s" +msgstr "%1$s: girdi bölümü %3$s için çıktı bölümü %2$s bulunamadı" + +#: elflink.h:4666 +#, c-format +msgid "%s: %s symbol `%s' isn't defined" +msgstr "%s: %s sembol `%s' tanımlı deÄŸil" + +#: elflink.h:5053 elflink.h:5095 +msgid "%T: discarded in section `%s' from %s\n" +msgstr "%1$T: %3$s `%2$s' bölümünde atıldı\n" + +#: elfxx-mips.c:887 +msgid "static procedure (no name)" +msgstr "statik altyordam (isimsiz)" + +#: elfxx-mips.c:1897 +msgid "not enough GOT space for local GOT entries" +msgstr "yerel GOT girdileri için yeterli GOT yeri yok" + +#: elfxx-mips.c:3691 +#, c-format +msgid "%s: %s+0x%lx: jump to stub routine which is not jal" +msgstr "%s: %s+0x%lx: jal olmayan koçan yordamına sıçrama" + +#: elfxx-mips.c:5192 +#, c-format +msgid "%s: Malformed reloc detected for section %s" +msgstr "%s: %s bölümü için geçersiz yer deÄŸiÅŸim bulundu" + +#: elfxx-mips.c:5266 +#, c-format +msgid "%s: CALL16 reloc at 0x%lx not against global symbol" +msgstr "%s: 0x%lx'deki CALL16 yerdeÄŸiÅŸimi evrensel sembole göre deÄŸil" + +#: elfxx-mips.c:8692 +#, c-format +msgid "%s: illegal section name `%s'" +msgstr "%s: geçersiz bölüm adı `%s'" + +#: elfxx-mips.c:9025 +#, c-format +msgid "%s: endianness incompatible with that of the selected emulation" +msgstr "%s: seçilen öykünüm ile sonluluk uyumlu deÄŸil" + +#: elfxx-mips.c:9037 +#, c-format +msgid "%s: ABI is incompatible with that of the selected emulation" +msgstr "%s: ABI, seçilen öykünümle uyumlu deÄŸil" + +#: elfxx-mips.c:9104 +#, c-format +msgid "%s: warning: linking PIC files with non-PIC files" +msgstr "%s: uyarı: PIC dosyaları PIC olmayan dosyalarla baÄŸlanıyor" + +#: elfxx-mips.c:9121 +#, c-format +msgid "%s: linking 32-bit code with 64-bit code" +msgstr "%s: 64 bitlik dosyalar 32 bitlik dosyalarla baÄŸlanıyor" + +#: elfxx-mips.c:9149 +#, c-format +msgid "%s: linking %s module with previous %s modules" +msgstr "%s: %s modülü önceki %s modülle baÄŸlanıyor" + +#: elfxx-mips.c:9172 +#, c-format +msgid "%s: ABI mismatch: linking %s module with previous %s modules" +msgstr "%s: ABI uyumsuzluÄŸu: %s modülü önceki %s modülle baÄŸlanıyor" + +#: elfxx-mips.c:9241 +msgid " [abi=O32]" +msgstr " [abi=O32]" + +#: elfxx-mips.c:9243 +msgid " [abi=O64]" +msgstr " [abi=O64]" + +#: elfxx-mips.c:9245 +msgid " [abi=EABI32]" +msgstr " [abi=EABI32]" + +#: elfxx-mips.c:9247 +msgid " [abi=EABI64]" +msgstr " [abi=EABI64]" + +#: elfxx-mips.c:9249 +msgid " [abi unknown]" +msgstr " [abi bilinmiyor]" + +#: elfxx-mips.c:9251 +msgid " [abi=N32]" +msgstr " [abi=N32]" + +#: elfxx-mips.c:9253 +msgid " [abi=64]" +msgstr " [abi=64]" + +#: elfxx-mips.c:9255 +msgid " [no abi set]" +msgstr " [abi atanmamış]" + +#: elfxx-mips.c:9258 +msgid " [mips1]" +msgstr " [mips1]" + +#: elfxx-mips.c:9260 +msgid " [mips2]" +msgstr " [mips2]" + +#: elfxx-mips.c:9262 +msgid " [mips3]" +msgstr " [mips3]" + +#: elfxx-mips.c:9264 +msgid " [mips4]" +msgstr " [mips4]" + +#: elfxx-mips.c:9266 +msgid " [mips5]" +msgstr " [mips5]" + +#: elfxx-mips.c:9268 +msgid " [mips32]" +msgstr " [mips32]" + +#: elfxx-mips.c:9270 +msgid " [mips64]" +msgstr " [mips64]" + +#: elfxx-mips.c:9272 +msgid " [mips32r2]" +msgstr " [mips32r2]" + +#: elfxx-mips.c:9274 +msgid " [unknown ISA]" +msgstr " [bilinmeyen ISA]" + +#: elfxx-mips.c:9277 +msgid " [mdmx]" +msgstr " [mdmx]" + +#: elfxx-mips.c:9280 +msgid " [mips16]" +msgstr " [mips16]" + +#: elfxx-mips.c:9283 +msgid " [32bitmode]" +msgstr " [32bitkipi]" + +#: elfxx-mips.c:9285 +msgid " [not 32bitmode]" +msgstr " [32bitkipi deÄŸil]" + +#: i386linux.c:457 m68klinux.c:461 sparclinux.c:458 +#, c-format +msgid "Output file requires shared library `%s'\n" +msgstr "Çıktı dosyası için paylaşımlı kitaplık `%s' gerekli\n" + +#: i386linux.c:465 m68klinux.c:469 sparclinux.c:466 +#, c-format +msgid "Output file requires shared library `%s.so.%s'\n" +msgstr "Çıktı dosyası için paylaşımlı kitaplık `%s.so.%s' gerekli\n" + +#: i386linux.c:654 i386linux.c:704 m68klinux.c:661 m68klinux.c:709 +#: sparclinux.c:656 sparclinux.c:706 +#, c-format +msgid "Symbol %s not defined for fixups\n" +msgstr "%s sembolü düzeltmeler için tanımlı deÄŸil\n" + +#: i386linux.c:728 m68klinux.c:733 sparclinux.c:730 +msgid "Warning: fixup count mismatch\n" +msgstr "Uyarı: düzeltme sayı uyumsuzluÄŸu\n" + +#: ieee.c:293 +#, c-format +msgid "%s: string too long (%d chars, max 65535)" +msgstr "%s: dizge fazla uzun (%d karakter, en fazla 65535)" + +#: ieee.c:428 +#, c-format +msgid "%s: unrecognized symbol `%s' flags 0x%x" +msgstr "%s: bilinmeyen `%s' sembol bayrakları 0x%x" + +#: ieee.c:938 +#, c-format +msgid "%s: unimplemented ATI record %u for symbol %u" +msgstr "%1$s: %3$u sembolü için desteklenmeyen ATI kaydı %2$u" + +#: ieee.c:963 +#, c-format +msgid "%s: unexpected ATN type %d in external part" +msgstr "%s: dış parçada beklenmeyen ATN türü %d" + +#: ieee.c:985 +#, c-format +msgid "%s: unexpected type after ATN" +msgstr "%s: ATN'den sonra beklenmeyen tür" + +#: ihex.c:264 +#, c-format +msgid "%s:%d: unexpected character `%s' in Intel Hex file\n" +msgstr "%s:%d: Intel Onaltılık dosyasında beklenmeyen `%s' karakteri\n" + +#: ihex.c:372 +#, c-format +msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)" +msgstr "" +"%s:%u: Intel Onaltılık dosyasında hatalı saÄŸlama toplamı\n" +" (%u beklendi, %u bulundu)" + +#: ihex.c:426 +#, c-format +msgid "%s:%u: bad extended address record length in Intel Hex file" +msgstr "%s:%u: Intel Onaltılık dosyasında hatalı uzun adres kaydı uzunluÄŸu" + +#: ihex.c:443 +#, c-format +msgid "%s:%u: bad extended start address length in Intel Hex file" +msgstr "%s:%u: Intel Onaltılık dosyasında hatalı uzun baÅŸlangıç adresi uzunluÄŸu" + +#: ihex.c:460 +#, c-format +msgid "%s:%u: bad extended linear address record length in Intel Hex file" +msgstr "%s:%u: Intel Onaltılık dosyasında hatalı uzun lineer adres kaydı uzunluÄŸu" + +#: ihex.c:477 +#, c-format +msgid "%s:%u: bad extended linear start address length in Intel Hex file" +msgstr "%s:%u: Intel Onaltılık dosyasında hatalı uzun lineer baÅŸlangıç adres uzunluÄŸu" + +#: ihex.c:494 +#, c-format +msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n" +msgstr "%s:%u: Intel Onaltılık dosyasında bilinmeyen onaltılık türü %u\n" + +#: ihex.c:619 +#, c-format +msgid "%s: internal error in ihex_read_section" +msgstr "%s: ihex_read_section'da iç hata" + +#: ihex.c:654 +#, c-format +msgid "%s: bad section length in ihex_read_section" +msgstr "%s: ihex_read_section'da hatalı bölüm uzunluÄŸu" + +#: ihex.c:872 +#, c-format +msgid "%s: address 0x%s out of range for Intel Hex file" +msgstr "%s: Intex Onaltılık dosyası için 0x%s adresi kapsamdışı" + +#: libbfd.c:861 +#, c-format +msgid "Deprecated %s called at %s line %d in %s\n" +msgstr "GeçersizleÅŸmiÅŸ %s, %s'da, %d satırı, %s içerisinde çaÄŸrıldı\n" + +#: libbfd.c:864 +#, c-format +msgid "Deprecated %s called\n" +msgstr "GeçerliliÄŸi kalkmış %s çaÄŸrıldı\n" + +#: linker.c:1829 +#, c-format +msgid "%s: indirect symbol `%s' to `%s' is a loop" +msgstr "%1$s: `%3$s'den endirekt sembol `%2$s'e çevrim" + +#: linker.c:2697 +#, c-format +msgid "Attempt to do relocatable link with %s input and %s output" +msgstr "%s girdi ve %s çıktısı ile yerdeÄŸiÅŸimli baÄŸ deneniyor" + +#: merge.c:896 +#, c-format +msgid "%s: access beyond end of merged section (%ld + %ld)" +msgstr "%s: karıştırılmış bölümün sonundan ileride eriÅŸim (%ld + %ld)" + +#: mmo.c:503 +#, c-format +msgid "%s: No core to allocate section name %s\n" +msgstr "%s: %s bölüm adını ayıracak `core' yok\n" + +#: mmo.c:579 +#, c-format +msgid "%s: No core to allocate a symbol %d bytes long\n" +msgstr "%s: %d bayt uzunluÄŸunda bir sembole yer ayırmak için `core' yok\n" + +#: mmo.c:1287 +#, c-format +msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n" +msgstr "%s: geçersiz mmo dosyası: $255 için baÅŸlangıç deÄŸeri `Main' deÄŸil\n" + +#: mmo.c:1433 +#, c-format +msgid "%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name starting with `%s'\n" +msgstr "" +"%1$s: `%4$s' ile baÅŸlayan sembol adından sonra desteklenmeyen\n" +" geniÅŸ karakter dizisi 0x%2$02X 0x%3$02X\n" + +#: mmo.c:1674 +#, c-format +msgid "%s: invalid mmo file: unsupported lopcode `%d'\n" +msgstr "%s: geçersiz mmo dosyası: desteklenmeyen lopkod `%d'\n" + +#: mmo.c:1684 +#, c-format +msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n" +msgstr "%s: geçersiz mmo dosyası: YZ = 1 beklendi, lop_quote için YZ = %d bulundu\n" + +#: mmo.c:1720 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n" +msgstr "" +"%s: geçersiz mmo dosyası: z = 1 veya z = 2 beklendi, \n" +" lop_loc için z = %d bulundu\n" + +#: mmo.c:1766 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n" +msgstr "%s: geçersiz mmo dosyası: z = 1 veya z = 2 beklendi; lop_fixo için z = %d bulundu\n" + +#: mmo.c:1805 +#, c-format +msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n" +msgstr "%s: geçersiz mmo dosyası: y = 0 beklendi; lop_fixrx için y = %d bulundu\n" + +#: mmo.c:1814 +#, c-format +msgid "%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n" +msgstr "" +"%s: geçersiz mmo dosyası: z = 16 veya z = 24 beklendi;\n" +" lop_fixrx için z = %d bulundu\n" + +#: mmo.c:1837 +#, c-format +msgid "%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d for lop_fixrx\n" +msgstr "" +"%s: geçersiz mmo dosyası: iÅŸlenen word'un ilk baytı 0 veya 1 olmalı; \n" +" lop_fixrx için %d bulundu\n" + +#: mmo.c:1860 +#, c-format +msgid "%s: cannot allocate file name for file number %d, %d bytes\n" +msgstr "%s: %d sayılı dosya için dosya adı ayrılamadı, %d bayt\n" + +#: mmo.c:1880 +#, c-format +msgid "%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n" +msgstr "%s: geçersiz mmo dosyası: %d sayılı dosya, `%s', zaten `%s' olarak girilmiÅŸ\n" + +#: mmo.c:1893 +#, c-format +msgid "%s: invalid mmo file: file name for number %d was not specified before use\n" +msgstr "" +"%s: geçersiz mmo dosyası: %d sayısı için dosya adı kullanımdan\n" +" önce belirtilmemiÅŸ\n" + +#: mmo.c:1999 +#, c-format +msgid "%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n" +msgstr "" +"%s: geçersiz mmo dosyası: lop_stab'in y ve z alanları sıfır deÄŸil;\n" +" y: %d, z: %d\n" + +#: mmo.c:2035 +#, c-format +msgid "%s: invalid mmo file: lop_end not last item in file\n" +msgstr "%s: geçersiz mmo dosyası: lop_end dosyadaki son girdi deÄŸil\n" + +#: mmo.c:2048 +#, c-format +msgid "%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras to the preceding lop_stab (%ld)\n" +msgstr "" +"%s: geçersiz mmo dosyası: lop_end'in YZ'si (%ld); bir önceki \n" +" lop_stab'in (%ld) dörtlü sayısına eÅŸit deÄŸil\n" + +#: mmo.c:2698 +#, c-format +msgid "%s: invalid symbol table: duplicate symbol `%s'\n" +msgstr "%s: geçersiz sembol tablosu: tekrarlanmış sembol `%s'\n" + +#: mmo.c:2949 +#, c-format +msgid "%s: Bad symbol definition: `Main' set to %s rather than the start address %s\n" +msgstr "" +"%1$s: Hatalı sembol tanımı: `Main' baÅŸlangıç adresi %3$s yerine \n" +" %2$s olarak tanımlanmış\n" + +#: mmo.c:3039 +#, c-format +msgid "%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: %d. Only `Main' will be emitted.\n" +msgstr "" +"%s: uyarı: sembol tablosu mmo için fazla büyük, 65535 32-bit word'den\n" +" fazla: %d. Yalnız `Main' üretilecek. \n" + +#: mmo.c:3084 +#, c-format +msgid "%s: internal error, symbol table changed size from %d to %d words\n" +msgstr "%s: iç hata, sembol tablosu büyüklüğü %d'den %d word'e deÄŸiÅŸti\n" + +#: mmo.c:3139 +#, c-format +msgid "%s: internal error, internal register section %s had contents\n" +msgstr "%s: iç hata, %s iç yazmaç bölümü içerik taşıyor\n" + +#: mmo.c:3191 +#, c-format +msgid "%s: no initialized registers; section length 0\n" +msgstr "%s: ilklenen yazmaç yok; bölüm uzunluÄŸu 0\n" + +#: mmo.c:3197 +#, c-format +msgid "%s: too many initialized registers; section length %ld\n" +msgstr "%s: çok fazla ilklenmiÅŸ yazmaç; bölüm uzunluÄŸu %ld\n" + +#: mmo.c:3202 +#, c-format +msgid "%s: invalid start address for initialized registers of length %ld: 0x%lx%08lx\n" +msgstr "%s: %ld uzunluÄŸunda ilklenmiÅŸ yazmaçlar için hatalı baÅŸlangıç adresi: 0x%lx%08lx\n" + +#: oasys.c:1052 +#, c-format +msgid "%s: can not represent section `%s' in oasys" +msgstr "%s: oasys'de `%s' bölümü gösterilemiyor" + +#: osf-core.c:137 +#, c-format +msgid "Unhandled OSF/1 core file section type %d\n" +msgstr "Desteklenmeyen OSF/1 core dosyası bölüm türü %d\n" + +#: pe-mips.c:659 +#, c-format +msgid "%s: `ld -r' not supported with PE MIPS objects\n" +msgstr "%s: `ld -r' PE MIPS nesneleri ile birlikte desteklenmiyor\n" + +#. OK, at this point the following variables are set up: +#. src = VMA of the memory we're fixing up +#. mem = pointer to memory we're fixing up +#. val = VMA of what we need to refer to +#. +#: pe-mips.c:795 +#, c-format +msgid "%s: unimplemented %s\n" +msgstr "%s: tamamlanmamış %s\n" + +#: pe-mips.c:821 +#, c-format +msgid "%s: jump too far away\n" +msgstr "%s: sıçrama fazla uzak\n" + +#: pe-mips.c:848 +#, c-format +msgid "%s: bad pair/reflo after refhi\n" +msgstr "%s: refhi'den sonra hatalı çift/reflo\n" + +#. XXX code yet to be written. +#: peicode.h:787 +#, c-format +msgid "%s: Unhandled import type; %x" +msgstr "%s: Desteklenmeyen ithal türü; %x" + +#: peicode.h:792 +#, c-format +msgid "%s: Unrecognised import type; %x" +msgstr "%s: Tanınmayan ithal türü; %x" + +#: peicode.h:806 +#, c-format +msgid "%s: Unrecognised import name type; %x" +msgstr "%s: Tanınmayan ithal isim türü; %x" + +#: peicode.h:1164 +#, c-format +msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive" +msgstr "%s: İthal Kitaplık Biçem (ILF) arÅŸivinde tanınmayan makina türü (0x%x) " + +#: peicode.h:1176 +#, c-format +msgid "%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive" +msgstr "%s: İthal Kitaplık Biçem (ILF) arÅŸivinde bilinen fakat desteklenmeyen makina türü (0x%x)" + +#: peicode.h:1193 +#, c-format +msgid "%s: size field is zero in Import Library Format header" +msgstr "%s: İthal Kitaplık Biçem (ILF) baÅŸlığında boy alanı sıfır" + +#: peicode.h:1224 +#, c-format +msgid "%s: string not null terminated in ILF object file." +msgstr "%s: ILF nesne dosyasında dizge boÅŸ deÄŸerle sonlanmamış." + +#: ppcboot.c:416 +msgid "" +"\n" +"ppcboot header:\n" +msgstr "" +"\n" +"ppcboot baÅŸlığı:\n" + +#: ppcboot.c:417 +#, c-format +msgid "Entry offset = 0x%.8lx (%ld)\n" +msgstr "Girdi göreli konumu = 0x%.8lx (%ld)\n" + +#: ppcboot.c:418 +#, c-format +msgid "Length = 0x%.8lx (%ld)\n" +msgstr "Uzunluk = 0x%.8lx (%ld)\n" + +#: ppcboot.c:421 +#, c-format +msgid "Flag field = 0x%.2x\n" +msgstr "Bayrak alanı = 0x%.2x\n" + +#: ppcboot.c:427 +#, c-format +msgid "Partition name = \"%s\"\n" +msgstr "Bölüm adı = \"%s\"\n" + +#: ppcboot.c:446 +#, c-format +msgid "" +"\n" +"Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "" +"\n" +"Bölüm[%d] baÅŸlangıcı = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:452 +#, c-format +msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "Bölüm[%d] sonu = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:458 +#, c-format +msgid "Partition[%d] sector = 0x%.8lx (%ld)\n" +msgstr "Bölüm[%d] sektörü = 0x%.8lx (%ld)\n" + +#: ppcboot.c:459 +#, c-format +msgid "Partition[%d] length = 0x%.8lx (%ld)\n" +msgstr "Bölüm[%d] uzunluÄŸu = 0x%.8lx (%ld)\n" + +#: som.c:5422 +msgid "som_sizeof_headers unimplemented" +msgstr "som_sizeof_headers tamamlanmamış" + +#: srec.c:302 +#, c-format +msgid "%s:%d: Unexpected character `%s' in S-record file\n" +msgstr "%s:%d: S-kayıt dosyasında beklenmeyen `%s' karakteri\n" + +#: stabs.c:319 +#, c-format +msgid "%s(%s+0x%lx): Stabs entry has invalid string index." +msgstr "%s(%s+0x%lx): Stabs girdisinde geçersiz dizge indeksi." + +#: syms.c:1019 +msgid "Unsupported .stab relocation" +msgstr "Desteklenmeyen .stab yerdeÄŸiÅŸimi" + +#: vms-gsd.c:356 +#, c-format +msgid "bfd_make_section (%s) failed" +msgstr "bfd_make_section (%s) baÅŸarısız" + +#: vms-gsd.c:371 +#, c-format +msgid "bfd_set_section_flags (%s, %x) failed" +msgstr "bfd_set_section_flags (%s, %x) baÅŸarısız" + +#: vms-gsd.c:407 +#, c-format +msgid "Size mismatch section %s=%lx, %s=%lx" +msgstr "Boy uyumsuzluÄŸu bölümü %s=%lx, %s=%lx" + +#: vms-gsd.c:704 +#, c-format +msgid "unknown gsd/egsd subtype %d" +msgstr "bilinmeyen gsd/egsd alt türü %d" + +#: vms-hdr.c:408 +msgid "Object module NOT error-free !\n" +msgstr "Nesne modülü hatasız DEĞİL !\n" + +#: vms-misc.c:541 +#, c-format +msgid "Stack overflow (%d) in _bfd_vms_push" +msgstr "_bfd_vms_push'da yığıt taÅŸması (%d)" + +#: vms-misc.c:559 +msgid "Stack underflow in _bfd_vms_pop" +msgstr "_bfd_vms_pop'da yığıt alt taÅŸması" + +#: vms-misc.c:918 +msgid "_bfd_vms_output_counted called with zero bytes" +msgstr "_bfd_vms_output_counted sıfır bayt ile çaÄŸrıldı" + +#: vms-misc.c:923 +msgid "_bfd_vms_output_counted called with too many bytes" +msgstr "_bfd_vms_output_counted fazla bayt ile çaÄŸrıldı" + +#: vms-misc.c:1054 +#, c-format +msgid "Symbol %s replaced by %s\n" +msgstr "%s sembolü %s ile deÄŸiÅŸtirildi\n" + +#: vms-misc.c:1117 +#, c-format +msgid "failed to enter %s" +msgstr "%s'e giriÅŸ baÅŸarısız" + +#: vms-tir.c:102 +msgid "No Mem !" +msgstr "Hafıza Yok !" + +#: vms-tir.c:383 +#, c-format +msgid "bad section index in %s" +msgstr "%s içinde hatalı bölüm indeksi" + +#: vms-tir.c:396 +#, c-format +msgid "unsupported STA cmd %s" +msgstr "Desteklenmeyen STA komutu %s" + +#: vms-tir.c:401 vms-tir.c:1261 +#, c-format +msgid "reserved STA cmd %d" +msgstr "Ayrılmış STA komutu %d" + +#: vms-tir.c:512 vms-tir.c:535 +#, c-format +msgid "%s: no symbol \"%s\"" +msgstr "%s: \"%s\" sembolü yok" + +#. unsigned shift +#. rotate +#. Redefine symbol to current location. +#. Define a literal. +#: vms-tir.c:602 vms-tir.c:714 vms-tir.c:824 vms-tir.c:842 vms-tir.c:850 +#: vms-tir.c:859 vms-tir.c:1584 +#, c-format +msgid "%s: not supported" +msgstr "%s: desteklenmiyor" + +#: vms-tir.c:607 vms-tir.c:1439 +#, c-format +msgid "%s: not implemented" +msgstr "%s: tamamlanmamış" + +#: vms-tir.c:611 vms-tir.c:1443 +#, c-format +msgid "reserved STO cmd %d" +msgstr "Ayrılmış STO komutu %d" + +#: vms-tir.c:729 vms-tir.c:1589 +#, c-format +msgid "reserved OPR cmd %d" +msgstr "Ayrılmış OPR komutu %d" + +#: vms-tir.c:797 vms-tir.c:1653 +#, c-format +msgid "reserved CTL cmd %d" +msgstr "Ayrılmış CTL komutu %d" + +#. stack byte from image +#. arg: none. +#: vms-tir.c:1169 +msgid "stack-from-image not implemented" +msgstr "Görüntüden-yığıt tamamlanmamış" + +#: vms-tir.c:1187 +msgid "stack-entry-mask not fully implemented" +msgstr "Yığın girdi maskı tamamlanmamış" + +#. compare procedure argument +#. arg: cs symbol name +#. by argument index +#. da argument descriptor +#. +#. compare argument descriptor with symbol argument (ARG$V_PASSMECH) +#. and stack TRUE (args match) or FALSE (args dont match) value. +#: vms-tir.c:1201 +msgid "PASSMECH not fully implemented" +msgstr "PASSMECH tamamlanmamış" + +#: vms-tir.c:1220 +msgid "stack-local-symbol not fully implemented" +msgstr "Yerel sembol yığıtı tamamlanmamış" + +#: vms-tir.c:1233 +msgid "stack-literal not fully implemented" +msgstr "Yığıt sabiti tamamlanmamış" + +#: vms-tir.c:1254 +msgid "stack-local-symbol-entry-point-mask not fully implemented" +msgstr "Yığın yerel sembol girdi noktası maskı tamamlanmamış" + +#: vms-tir.c:1531 vms-tir.c:1543 vms-tir.c:1555 vms-tir.c:1567 vms-tir.c:1632 +#: vms-tir.c:1640 vms-tir.c:1648 +#, c-format +msgid "%s: not fully implemented" +msgstr "%s: tamamlanmamış" + +#: vms-tir.c:1705 +#, c-format +msgid "obj code %d not found" +msgstr "Nesne kodu %d bulunmadı" + +#: vms-tir.c:2043 +#, c-format +msgid "SEC_RELOC with no relocs in section %s" +msgstr "%s bölümünde yerdeÄŸiÅŸim olmaksızın SEC_RELOC" + +#: vms-tir.c:2331 +#, c-format +msgid "Unhandled relocation %s" +msgstr "Desteklenmeyen yerdeÄŸiÅŸim %s" + +#: xcofflink.c:1244 +#, c-format +msgid "%s: `%s' has line numbers but no enclosing section" +msgstr "%s: `%s' satır numaralarına sahip fakat onu içeren bölümü yok" + +#: xcofflink.c:1297 +#, c-format +msgid "%s: class %d symbol `%s' has no aux entries" +msgstr "%s: sınıf %d sembol `%s'un alternatif girdileri yok" + +#: xcofflink.c:1320 +#, c-format +msgid "%s: symbol `%s' has unrecognized csect type %d" +msgstr "%s: `%s' sembolünde bilinmeyen csect türü %d var" + +#: xcofflink.c:1332 +#, c-format +msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d" +msgstr "%s: hatalı XTY_ER sembolü `%s': sınıf %d scnum %d scnlen %d" + +#: xcofflink.c:1368 +#, c-format +msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d" +msgstr "%s: XMC_TC0 sembolü `%s': sınıf %d scnlen %d" + +#: xcofflink.c:1520 +#, c-format +msgid "%s: csect `%s' not in enclosing section" +msgstr "%s: csect `%s' onu içeren bölümde deÄŸil" + +#: xcofflink.c:1627 +#, c-format +msgid "%s: misplaced XTY_LD `%s'" +msgstr "%s: XTY_LD `%s'yanlış yerde" + +#: xcofflink.c:1958 +#, c-format +msgid "%s: reloc %s:%d not in csect" +msgstr "%s: yerdeÄŸiÅŸim %s:%d csect içinde deÄŸil" + +#: xcofflink.c:2095 +#, c-format +msgid "%s: XCOFF shared object when not producing XCOFF output" +msgstr "%s: XCOFF çıktısı oluÅŸturulmazken XCOFF paylaşımlı nesnesi" + +#: xcofflink.c:2116 +#, c-format +msgid "%s: dynamic object with no .loader section" +msgstr "%s: .loader bölümü olmayan dinamik nesne" + +#: xcofflink.c:2761 +#, c-format +msgid "%s: no such symbol" +msgstr "%s: böyle bir sembol yok" + +#: xcofflink.c:2894 +msgid "error: undefined symbol __rtinit" +msgstr "hata: tanımlanmamış sembol __rtinit" + +#: xcofflink.c:3455 +#, c-format +msgid "warning: attempt to export undefined symbol `%s'" +msgstr "uyarı: tanımlanmamış `%s' sembolünü ihraç denemesi" + +#: xcofflink.c:4448 +#, c-format +msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling" +msgstr "TOC taÅŸması: 0x%lx > 0x10000; -mminimal-toc ile derlemeyi deneyin" + +#: xcofflink.c:5288 xcofflink.c:5755 xcofflink.c:5817 xcofflink.c:6119 +#, c-format +msgid "%s: loader reloc in unrecognized section `%s'" +msgstr "%s: bilinmeyen `%s' bölümünde yükleyici yerdeÄŸiÅŸimi" + +#: xcofflink.c:5310 xcofflink.c:6130 +#, c-format +msgid "%s: `%s' in loader reloc but not loader sym" +msgstr "%s: `%s' yükleyici yerdeÄŸiÅŸiminde fakat yükleyici sembolü deÄŸil" + +#: xcofflink.c:5325 +#, c-format +msgid "%s: loader reloc in read-only section %s" +msgstr "%s: %s salt-okunur bölümünde yükleyici yerdeÄŸiÅŸimi" + +#: elf32-ia64.c:2392 elf64-ia64.c:2392 +msgid "@pltoff reloc against local symbol" +msgstr "yerel sembole @pltoff yerdegisimi" + +#: elf32-ia64.c:3804 elf64-ia64.c:3804 +#, c-format +msgid "%s: short data segment overflowed (0x%lx >= 0x400000)" +msgstr "%s: kısa veri bölümünde taÅŸma (0x%lx >= 0x400000)" + +#: elf32-ia64.c:3815 elf64-ia64.c:3815 +#, c-format +msgid "%s: __gp does not cover short data segment" +msgstr "%s: __gp kısa veri bölümünü kapsamıyor" + +#: elf32-ia64.c:4131 elf64-ia64.c:4131 +#, c-format +msgid "%s: linking non-pic code in a shared library" +msgstr "%s: pic olmayan kod paylaÅŸmalı kitaplıkta baÄŸlanıyor" + +#: elf32-ia64.c:4164 elf64-ia64.c:4164 +#, c-format +msgid "%s: @gprel relocation against dynamic symbol %s" +msgstr "%s: %s dinamik sembolüne @gprel yerdeÄŸiÅŸimi" + +#: elf32-ia64.c:4224 elf64-ia64.c:4224 +#, c-format +msgid "%s: linking non-pic code in a position independent executable" +msgstr "%s: pic olmayan kod yer bağımsız uygulamaya baÄŸlanıyor" + +#: elf32-ia64.c:4363 elf64-ia64.c:4363 +#, c-format +msgid "%s: @internal branch to dynamic symbol %s" +msgstr "%s: %s dinamik sembolüne @internal dalı" + +#: elf32-ia64.c:4365 elf64-ia64.c:4365 +#, c-format +msgid "%s: speculation fixup to dynamic symbol %s" +msgstr "%s: %s dinamik sembolüne spekülasyon düzeltmesi" + +#: elf32-ia64.c:4367 elf64-ia64.c:4367 +#, c-format +msgid "%s: @pcrel relocation against dynamic symbol %s" +msgstr "%s: %s dinamik sembolüne @pcrel yerdeÄŸiÅŸimi" + +#: elf32-ia64.c:4579 elf64-ia64.c:4579 +msgid "unsupported reloc" +msgstr "desteklenmeyen yerdeÄŸiÅŸim" + +#: elf32-ia64.c:4858 elf64-ia64.c:4858 +#, c-format +msgid "%s: linking trap-on-NULL-dereference with non-trapping files" +msgstr "%s: NULL-halinde-tuzakla karşı-baÅŸvurusu tuzaklamayan dosyalarla baÄŸlandı" + +#: elf32-ia64.c:4867 elf64-ia64.c:4867 +#, c-format +msgid "%s: linking big-endian files with little-endian files" +msgstr "%s: büyük sonlu dosyalar küçük sonlu dosyalarla baÄŸlanıyor" + +#: elf32-ia64.c:4876 elf64-ia64.c:4876 +#, c-format +msgid "%s: linking 64-bit files with 32-bit files" +msgstr "%s: 64 bitlik dosyalar 32 bitlik dosyalarla baÄŸlanıyor" + +#: elf32-ia64.c:4885 elf64-ia64.c:4885 +#, c-format +msgid "%s: linking constant-gp files with non-constant-gp files" +msgstr "%s: constant-gp dosyaları constant-gp olmayan dosyalarla baÄŸlanıyor" + +#: elf32-ia64.c:4895 elf64-ia64.c:4895 +#, c-format +msgid "%s: linking auto-pic files with non-auto-pic files" +msgstr "%s: auto-pic dosyaları auto-pic olmayan dosyalarla baÄŸlanıyor" + +#: peigen.c:985 pepigen.c:985 +#, c-format +msgid "%s: line number overflow: 0x%lx > 0xffff" +msgstr "%s: satır numarası taÅŸması: 0x%lx > 0xffff" + +#: peigen.c:1002 pepigen.c:1002 +#, c-format +msgid "%s: reloc overflow 1: 0x%lx > 0xffff" +msgstr "%s: yerdeÄŸiÅŸim taÅŸması 1: 0x%lx > 0xffff" + +#: peigen.c:1016 pepigen.c:1016 +msgid "Export Directory [.edata (or where ever we found it)]" +msgstr "İhraç Dizini [.edata (veya nerede bulundu ise)]" + +#: peigen.c:1017 pepigen.c:1017 +msgid "Import Directory [parts of .idata]" +msgstr "İthal Dizini [.idata'nın parçaları]" + +#: peigen.c:1018 pepigen.c:1018 +msgid "Resource Directory [.rsrc]" +msgstr "Kaynak Dizini [.rsrc]" + +#: peigen.c:1019 pepigen.c:1019 +msgid "Exception Directory [.pdata]" +msgstr "İstisna Dizini [.pdata]" + +#: peigen.c:1020 pepigen.c:1020 +msgid "Security Directory" +msgstr "Güvenlik Dizini" + +#: peigen.c:1021 pepigen.c:1021 +msgid "Base Relocation Directory [.reloc]" +msgstr "Temel YerdeÄŸiÅŸim Dizini [.reloc]" + +#: peigen.c:1022 pepigen.c:1022 +msgid "Debug Directory" +msgstr "Hata Ayıklama Dizini" + +#: peigen.c:1023 pepigen.c:1023 +msgid "Description Directory" +msgstr "Açıklama Dizini" + +#: peigen.c:1024 pepigen.c:1024 +msgid "Special Directory" +msgstr "Özel Dizin" + +#: peigen.c:1025 pepigen.c:1025 +msgid "Thread Storage Directory [.tls]" +msgstr "Dal Saklama Dizini [.tls]" + +#: peigen.c:1026 pepigen.c:1026 +msgid "Load Configuration Directory" +msgstr "Ayar Yükleme Dizini" + +#: peigen.c:1027 pepigen.c:1027 +msgid "Bound Import Directory" +msgstr "Sınır İthal Dizini" + +#: peigen.c:1028 pepigen.c:1028 +msgid "Import Address Table Directory" +msgstr "Adres Tablosu İthal Dizini" + +#: peigen.c:1029 pepigen.c:1029 +msgid "Delay Import Directory" +msgstr "Gecikmeli İthal Dizini" + +#: peigen.c:1030 peigen.c:1031 pepigen.c:1030 pepigen.c:1031 +msgid "Reserved" +msgstr "Ayrılmış" + +#: peigen.c:1094 pepigen.c:1094 +msgid "" +"\n" +"There is an import table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Bir ithal tablosu var, fakat onu içeren bölüm bulunamadı\n" + +#: peigen.c:1099 pepigen.c:1099 +#, c-format +msgid "" +"\n" +"There is an import table in %s at 0x%lx\n" +msgstr "" +"\n" +"%s içerisinde 0x%lx'de bir ithal tablosu var\n" + +#: peigen.c:1136 pepigen.c:1136 +#, c-format +msgid "" +"\n" +"Function descriptor located at the start address: %04lx\n" +msgstr "" +"\n" +"BaÅŸlangıç adresinde iÅŸlev betimleyicisi bulundu: %04lx\n" + +#: peigen.c:1139 pepigen.c:1139 +#, c-format +msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n" +msgstr "\tkod temeli %08lx toc (yüklenebilir/gerçek) %08lx/%08lx\n" + +#: peigen.c:1145 pepigen.c:1145 +msgid "" +"\n" +"No reldata section! Function descriptor not decoded.\n" +msgstr "" +"\n" +"Reldata bölümü yok! İşlev betimleyicisi çözümlenemedi.\n" + +#: peigen.c:1150 pepigen.c:1150 +#, c-format +msgid "" +"\n" +"The Import Tables (interpreted %s section contents)\n" +msgstr "" +"\n" +"İthal Tabloları (%s bölüm içeriÄŸi çözümlendi)\n" + +#: peigen.c:1153 pepigen.c:1153 +msgid "" +" vma: Hint Time Forward DLL First\n" +" Table Stamp Chain Name Thunk\n" +msgstr "" +" vma: İpucu Zaman İleri DLL İlk\n" +" Tablo Damga Zincir İsim Parça\n" + +#: peigen.c:1204 pepigen.c:1204 +#, c-format +msgid "" +"\n" +"\tDLL Name: %s\n" +msgstr "" +"\n" +"\tDLL Adı: %s\n" + +#: peigen.c:1215 pepigen.c:1215 +msgid "\tvma: Hint/Ord Member-Name Bound-To\n" +msgstr "\tvma: İpucu/Sıra Üye-Adı Sınır\n" + +#: peigen.c:1240 pepigen.c:1240 +msgid "" +"\n" +"There is a first thunk, but the section containing it could not be found\n" +msgstr "" +"\n" +"Bir ilk parça var, fakat onu içeren bölüm bulunamadı\n" + +#: peigen.c:1380 pepigen.c:1380 +msgid "" +"\n" +"There is an export table, but the section containing it could not be found\n" +msgstr "" +"\n" +"Bir ihraç tablosu var, fakat onu içeren bölüm bulunamadı\n" + +#: peigen.c:1385 pepigen.c:1385 +#, c-format +msgid "" +"\n" +"There is an export table in %s at 0x%lx\n" +msgstr "" +"\n" +"%s içinde 0x%lx'de bir ihraç tablosu var\n" + +#: peigen.c:1416 pepigen.c:1416 +#, c-format +msgid "" +"\n" +"The Export Tables (interpreted %s section contents)\n" +"\n" +msgstr "" +"\n" +"İhraç Tabloları (%s bölüm içeriÄŸi çözümlendi)\n" +"\n" + +#: peigen.c:1420 pepigen.c:1420 +#, c-format +msgid "Export Flags \t\t\t%lx\n" +msgstr "İhraç Bayrakları \t\t\t%lx\n" + +#: peigen.c:1423 pepigen.c:1423 +#, c-format +msgid "Time/Date stamp \t\t%lx\n" +msgstr "Saat/Tarih damgası \t\t%lx\n" + +#: peigen.c:1426 pepigen.c:1426 +#, c-format +msgid "Major/Minor \t\t\t%d/%d\n" +msgstr "Majör/Minör \t\t\t%d/%d\n" + +#: peigen.c:1429 pepigen.c:1429 +msgid "Name \t\t\t\t" +msgstr "İsim \t\t\t\t" + +#: peigen.c:1435 pepigen.c:1435 +#, c-format +msgid "Ordinal Base \t\t\t%ld\n" +msgstr "Onluk Sistem \t\t\t%ld\n" + +#: peigen.c:1438 pepigen.c:1438 +msgid "Number in:\n" +msgstr "Sayı içinde:\n" + +#: peigen.c:1441 pepigen.c:1441 +#, c-format +msgid "\tExport Address Table \t\t%08lx\n" +msgstr "\tİhraç Adres Tablosu \t\t%08lx\n" + +#: peigen.c:1445 pepigen.c:1445 +#, c-format +msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n" +msgstr "\t[İsim Gösterge/Onluk] Tablo\t%08lx\n" + +#: peigen.c:1448 pepigen.c:1448 +msgid "Table Addresses\n" +msgstr "Tablo Adresleri\n" + +#: peigen.c:1451 pepigen.c:1451 +msgid "\tExport Address Table \t\t" +msgstr "\tİhraç Adres Tablosu \t\t" + +#: peigen.c:1456 pepigen.c:1456 +msgid "\tName Pointer Table \t\t" +msgstr "\tİsim Gösterge Tablosu \t\t" + +#: peigen.c:1461 pepigen.c:1461 +msgid "\tOrdinal Table \t\t\t" +msgstr "\tOnluk Tablo \t\t\t" + +#: peigen.c:1476 pepigen.c:1476 +#, c-format +msgid "" +"\n" +"Export Address Table -- Ordinal Base %ld\n" +msgstr "" +"\n" +"İhraç Adres Tablosu -- Onluk Sistem %ld\n" + +#: peigen.c:1495 pepigen.c:1495 +msgid "Forwarder RVA" +msgstr "RVA Yönlendiricisi" + +#: peigen.c:1506 pepigen.c:1506 +msgid "Export RVA" +msgstr "RVA İhracı" + +#: peigen.c:1513 pepigen.c:1513 +msgid "" +"\n" +"[Ordinal/Name Pointer] Table\n" +msgstr "" +"\n" +"[Onluk/İsim Gösterge] Tablosu\n" + +#: peigen.c:1568 pepigen.c:1568 +#, c-format +msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n" +msgstr "Uyarı, .pdata bölüm boyu (%ld) %d'nin katı deÄŸil\n" + +#: peigen.c:1572 pepigen.c:1572 +msgid "" +"\n" +"The Function Table (interpreted .pdata section contents)\n" +msgstr "" +"\n" +"İşlev Tablosu (.pdata bölüm içeriÄŸi çözümlendi)\n" + +#: peigen.c:1575 pepigen.c:1575 +msgid " vma:\t\t\tBegin Address End Address Unwind Info\n" +msgstr " vma:\t\t\tBaÅŸlangıç Adresi Sonlanma Adresi Geri Al Bilgisi\n" + +#: peigen.c:1577 pepigen.c:1577 +msgid "" +" vma:\t\tBegin End EH EH PrologEnd Exception\n" +" \t\tAddress Address Handler Data Address Mask\n" +msgstr "" +" vma:\t\tBaÅŸl. Son EH EH PrologSon İstisna\n" +" \t\tAdres Adres Yakalay Veri Adres Maske\n" + +#: peigen.c:1647 pepigen.c:1647 +msgid " Register save millicode" +msgstr " Yazma milikodunu kaydet" + +#: peigen.c:1650 pepigen.c:1650 +msgid " Register restore millicode" +msgstr " Geri alma milikodunu kaydet" + +#: peigen.c:1653 pepigen.c:1653 +msgid " Glue code sequence" +msgstr " BirleÅŸtirici kod dizisi" + +#: peigen.c:1705 pepigen.c:1705 +msgid "" +"\n" +"\n" +"PE File Base Relocations (interpreted .reloc section contents)\n" +msgstr "" +"\n" +"\n" +"PE Dosya Temel YerdeÄŸiÅŸimi (.reloc bölüm içeriÄŸi çözümlendi)\n" + +#: peigen.c:1735 pepigen.c:1735 +#, c-format +msgid "" +"\n" +"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n" +msgstr "" +"\n" +"Sanal Adres: %08lx Parça boyu %ld (0x%lx) Düzeltme Sayısı %ld\n" + +#: peigen.c:1748 pepigen.c:1748 +#, c-format +msgid "\treloc %4d offset %4x [%4lx] %s" +msgstr "\tyer deÄŸiÅŸim %4d göreli konum %4x [%4lx] %s" + +#. The MS dumpbin program reportedly ands with 0xff0f before +#. printing the characteristics field. Not sure why. No reason to +#. emulate it here. +#: peigen.c:1788 pepigen.c:1788 +#, c-format +msgid "" +"\n" +"Characteristics 0x%x\n" +msgstr "" +"\n" +"Özellikler 0x%x\n" + +#~ msgid "%s: Unknown special linker type %d" +#~ msgstr "%s: Bilinmeyen özel baÄŸlayıcı türü %d" + +#~ msgid "v850ea architecture" +#~ msgstr "v850ea platformu" + +#~ msgid "%s: Section %s is too large to add hole of %ld bytes" +#~ msgstr "%s: %s bölümü içine %ld baytlık bir delik koymak için fazla büyük" + +#~ msgid "Error: out of memory" +#~ msgstr "Hata: bellek tükendi" + +#~ msgid "warning: relocation against removed section; zeroing" +#~ msgstr "uyarı: silinmiÅŸ bölüme yer deÄŸiÅŸim; sıfırlandı" + +#~ msgid "warning: relocation against removed section" +#~ msgstr "%1$s: silinmiÅŸ bölüme yerdeÄŸiÅŸim" + +#~ msgid "local symbols in discarded section %s" +#~ msgstr "atılmış %s bölümünde yerel semboller" + +#~ msgid "%s: linking abicalls files with non-abicalls files" +#~ msgstr "%s: abicalls dosyaları abicalls olmayan dosyalarla baÄŸlanıyor" + +#~ msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)" +#~ msgstr "%1$s: Önceki modüllerle (-mips%3$d) ile ISA uyumsuzluÄŸu (-mips%2$d)" + +#~ msgid "%s: ISA mismatch (%d) with previous modules (%d)" +#~ msgstr "%1$s: Önceki modüllerle (%3$d) ile ISA uyumsuzluÄŸu (%2$d)" + +#~ msgid "%s: dynamic relocation against speculation fixup" +#~ msgstr "%s: kuÅŸkulu düzeltmeye dinamik yerdeÄŸiÅŸim" + +#~ msgid "%s: speculation fixup against undefined weak symbol" +#~ msgstr "%s: tanımlanmamış gevÅŸek sembole tartışmalı düzeltme" + +#~ msgid "GP relative relocation when GP not defined" +#~ msgstr "GP tanımlanmamışken GP göreli yer deÄŸiÅŸtirmesi" + +#~ msgid "%s: ERROR: passes floats in float registers whereas target %s uses integer registers" +#~ msgstr "%s: HATA: kayan sayıları kayan yazmaçlarda geçiriyor fakat hedef %s tamsayı yazmaç kullanıyor" + +#~ msgid "%s: ERROR: passes floats in integer registers whereas target %s uses float registers" +#~ msgstr "%s: HATA: kayan sayıları tamsayı yazmaçlarda geçiriyor fakat hedef %s kayan yazmaç kullanıyor" + +#~ msgid "Warning: input file %s supports interworking, whereas %s does not." +#~ msgstr "Uyarı: %s girdi dosyası beraber çalışmayı destekliyor, fakat %s desteklemiyor." + +#~ msgid "Warning: input file %s does not support interworking, whereas %s does." +#~ msgstr "Uyarı: %s girdi dosyası beraber çalışmayı desteklemiyor, fakat %s destekliyor." + +#~ msgid "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld" +#~ msgstr "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld sonraki %ld" + +#~ msgid "elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = 0x%.8lx%s\n" +#~ msgstr "bfd sembolünden elf sembolü:0x%.8lx, isim= %s, sem num = %d, bayrak = 0x%.8lx%s\n" + +#~ msgid "Warning: Not setting interwork flag of %s since it has already been specified as non-interworking" +#~ msgstr "Uyarı: beraber çalışmaz diye önceden belirtilmiÅŸ olduÄŸundan %s'nin beraber çalışma bayrağı atanmadı" + +#~ msgid "Warning: Clearing the interwork flag of %s due to outside request" +#~ msgstr "Uyarı: Dış isteÄŸe uyularak %s'nin beraber çalışma bayrağı temizlendi" + +#~ msgid " [APCS-26]" +#~ msgstr " [APCS-26]" + +#~ msgid " [APCS-32]" +#~ msgstr " [APCS-32]" + +#~ msgid "(unknown)" +#~ msgstr "(bilinmeyen)" + +#~ msgid " previously %s in %s" +#~ msgstr " daha önce %2$s içinde %1$s" + +#~ msgid "ETIR_S_C_STO_GBL: no symbol \"%s\"" +#~ msgstr "ETIR_S_C_STO_GBL: sembol yok \"%s\"" + +#~ msgid "ETIR_S_C_STO_CA: no symbol \"%s\"" +#~ msgstr "ETIR_S_C_STO_CA: sembol yok \"%s\"" + +#~ msgid "ETIR_S_C_STO_RB/AB: Not supported" +#~ msgstr "ETIR_S_C_STO_RB/AB: Desteklenmiyor" + +#~ msgid "ETIR_S_C_STO_LP_PSB: Not supported" +#~ msgstr "ETIR_S_C_STO_LP_PSB: Desteklenmiyor" + +#~ msgid "ETIR_S_C_STO_HINT_GBL: not implemented" +#~ msgstr "ETIR_S_C_STO_HINT_GBL: tamamlanmamış" + +#~ msgid "ETIR_S_C_STO_HINT_PS: not implemented" +#~ msgstr "ETIR_S_C_STO_HINT_PS: tamamlanmamış" + +#~ msgid "ETIR_S_C_OPR_INSV: Not supported" +#~ msgstr "ETIR_S_C_OPR_INSV: Desteklenmiyor" + +#~ msgid "ETIR_S_C_OPR_USH: Not supported" +#~ msgstr "ETIR_S_C_OPR_USH: Desteklenmiyor" + +#~ msgid "ETIR_S_C_OPR_ROT: Not supported" +#~ msgstr "ETIR_S_C_OPR_ROT: Desteklenmiyor" + +#~ msgid "ETIR_S_C_OPR_REDEF: Not supported" +#~ msgstr "ETIR_S_C_OPR_REDEF: Desteklenmiyor" + +#~ msgid "ETIR_S_C_OPR_DFLIT: Not supported" +#~ msgstr "ETIR_S_C_OPR_DFLIT: Desteklenmiyor" + +#~ msgid "ETIR_S_C_STC_GBL: not supported" +#~ msgstr "ETIR_S_C_STC_GBL: desteklenmiyor" + +#~ msgid "ETIR_S_C_STC_GCA: not supported" +#~ msgstr "ETIR_S_C_STC_GCA: desteklenmiyor" + +#~ msgid "ETIR_S_C_STC_PS: not supported" +#~ msgstr "ETIR_S_C_STC_PS: desteklenmiyor" + +#~ msgid "Unimplemented STO cmd %d" +#~ msgstr "Tamamlanmamış STO komutu %d" + +#~ msgid "TIR_S_C_OPR_ASH incomplete" +#~ msgstr "TIR_S_C_OPR_ASH tamamlanmamış" + +#~ msgid "TIR_S_C_OPR_USH incomplete" +#~ msgstr "TIR_S_C_OPR_USH tamamlanmamış" + +#~ msgid "TIR_S_C_OPR_ROT incomplete" +#~ msgstr "TIR_S_C_OPR_ROT tamamlanmamış" + +#~ msgid "TIR_S_C_OPR_REDEF not supported" +#~ msgstr "TIR_S_C_OPR_REDEF desteklenmiyor" + +#~ msgid "TIR_S_C_OPR_DFLIT not supported" +#~ msgstr "TIR_S_C_OPR_DFLIT desteklenmiyor" + +#~ msgid "TIR_S_C_CTL_DFLOC not fully implemented" +#~ msgstr "TIR_S_C_CTL_DFLOC tamamlanmamış" + +#~ msgid "TIR_S_C_CTL_STLOC not fully implemented" +#~ msgstr "TIR_S_C_CTL_STLOC tamamlanmamış" + +#~ msgid "TIR_S_C_CTL_STKDL not fully implemented" +#~ msgstr "TIR_S_C_CTL_STKDL tamamlanmamış" + +#~ msgid " vma: Hint Time Forward DLL First\n" +#~ msgstr " vma: İpucu Zaman İleri DLL İlk\n" + +#~ msgid "\tThe Import Address Table (difference found)\n" +#~ msgstr "\tİthal Adres Tablosu (fark bulundu)\n" + +#~ msgid "\t>>> Ran out of IAT members!\n" +#~ msgstr "\t>>> IAT üyeleri bitti!\n" + +#~ msgid "\tThe Import Address Table is identical\n" +#~ msgstr "\tİthal Adres Tablosu aynı\n" + +#~ msgid " \t\tAddress Address Handler Data Address Mask\n" +#~ msgstr " \t\tAdres Adres Yön. Veri Adres Mask\n" diff --git a/bfd/po/zh_CN.gmo b/bfd/po/zh_CN.gmo new file mode 100644 index 0000000000000..501f89d427f55 Binary files /dev/null and b/bfd/po/zh_CN.gmo differ diff --git a/bfd/po/zh_CN.po b/bfd/po/zh_CN.po new file mode 100644 index 0000000000000..a7ca6d71ab825 --- /dev/null +++ b/bfd/po/zh_CN.po @@ -0,0 +1,2702 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2003 Free Software Foundation, Inc. +# Wang Li , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: bfd 2.12.91\n" +"POT-Creation-Date: 2002-07-23 15:55-0400\n" +"PO-Revision-Date: 2003-03-11 09:46+0800\n" +"Last-Translator: Wang Li \n" +"Language-Team: Chinese (simplified) \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=gb2312\n" +"Content-Transfer-Encoding: 8bit\n" + +#: aout-adobe.c:197 +#, c-format +msgid "%s: Unknown section type in a.out.adobe file: %x\n" +msgstr "%s£ºa.out.adobe ÎļþÖнڵÄÀàÐÍδ֪£º%x\n" + +#: aout-cris.c:208 +#, c-format +msgid "%s: Invalid relocation type exported: %d" +msgstr "%s£ºµ¼³öÎÞЧµÄÖØ¶¨Î»ÀàÐÍ£º%d" + +#: aout-cris.c:252 +#, c-format +msgid "%s: Invalid relocation type imported: %d" +msgstr "%s£ºµ¼ÈëÎÞЧµÄÖØ¶¨Î»ÀàÐÍ£º%d" + +#: aout-cris.c:263 +#, c-format +msgid "%s: Bad relocation record imported: %d" +msgstr "%s£ºµ¼Èë´íÎóµÄÖØ¶¨Î»¼Ç¼£º%d" + +#: aoutx.h:1282 aoutx.h:1699 +#, c-format +msgid "%s: can not represent section `%s' in a.out object file format" +msgstr "%s£ºÎÞ·¨ÔÚ a.out ¶ÔÏóÎļþ¸ñʽÖбíʾ½Ú¡°%s¡±" + +#: aoutx.h:1669 +#, c-format +msgid "%s: can not represent section for symbol `%s' in a.out object file format" +msgstr "%s£ºÎÞ·¨ÔÚ a.out ¶ÔÏóÎļþ¸ñʽÖÐΪ·ûºÅ¡°%s¡±±íʾ½Ú" + +#: aoutx.h:1671 +msgid "*unknown*" +msgstr "*δ֪*" + +#: aoutx.h:3732 +#, c-format +msgid "%s: relocateable link from %s to %s not supported" +msgstr "%s£º²»Ö§³Ö´Ó %s µ½ %s µÄ¿ÉÖØ¶¨Î»µÄÁ¬½Ó" + +#: archive.c:1826 +msgid "Warning: writing archive was slow: rewriting timestamp\n" +msgstr "¾¯¸æ£ºÐ´Èë¹éµµ¹ýÂý£ºÖØÐÂдÈëʱ¼ä´Á\n" + +#: archive.c:2093 +msgid "Reading archive file mod timestamp" +msgstr "ÕýÔÚ¶ÁÈëÎļþÐÞ¸Äʱ¼ä´Á" + +#. FIXME: bfd can't call perror. +#: archive.c:2120 +msgid "Writing updated armap timestamp" +msgstr "ÕýÔÚ¸üРarmap ʱ¼ä´Á" + +#: bfd.c:274 +msgid "No error" +msgstr "ÎÞ´íÎó" + +#: bfd.c:275 +msgid "System call error" +msgstr "ϵͳµ÷ÓôíÎó" + +#: bfd.c:276 +msgid "Invalid bfd target" +msgstr "ÎÞЧµÄ bfd Ä¿±ê" + +#: bfd.c:277 +msgid "File in wrong format" +msgstr "Îļþ¸ñʽ´íÎó" + +#: bfd.c:278 +msgid "Archive object file in wrong format" +msgstr "¹éµµÄ¿±êÎļþ¸ñʽ´íÎó" + +#: bfd.c:279 +msgid "Invalid operation" +msgstr "ÎÞЧµÄ²Ù×÷" + +#: bfd.c:280 +msgid "Memory exhausted" +msgstr "ÄÚ´æºÄ¾¡" + +#: bfd.c:281 +msgid "No symbols" +msgstr "ÎÞ·ûºÅ" + +#: bfd.c:282 +msgid "Archive has no index; run ranlib to add one" +msgstr "¹éµµÃ»ÓÐË÷Òý£»ÔËÐÐ ranlib ÒÔÌí¼ÓÒ»¸ö" + +#: bfd.c:283 +msgid "No more archived files" +msgstr "ûÓиü¶àµÄ¹éµµÎļþ" + +#: bfd.c:284 +msgid "Malformed archive" +msgstr "»ûÐεĹ鵵" + +#: bfd.c:285 +msgid "File format not recognized" +msgstr "²»¿Éʶ±ðµÄÎļþ¸ñʽ" + +#: bfd.c:286 +msgid "File format is ambiguous" +msgstr "¶þÒåÐÔµÄÎļþ¸ñʽ" + +#: bfd.c:287 +msgid "Section has no contents" +msgstr "½ÚûÓÐÄÚÈÝ" + +#: bfd.c:288 +msgid "Nonrepresentable section on output" +msgstr "Êä³ö²»¿É±íʾµÄ½Ú" + +#: bfd.c:289 +msgid "Symbol needs debug section which does not exist" +msgstr "·ûºÅÐèÒª²»´æÔڵĵ÷ÊÔ½Ú" + +#: bfd.c:290 +msgid "Bad value" +msgstr "´íÎóµÄÖµ" + +#: bfd.c:291 +msgid "File truncated" +msgstr "Îļþ±»½Ø¶Ï" + +#: bfd.c:292 +msgid "File too big" +msgstr "Îļþ¹ý´ó" + +#: bfd.c:293 +msgid "#" +msgstr "#<ÎÞЧµÄ´íÎóÂë>" + +#: bfd.c:700 +#, c-format +msgid "BFD %s assertion fail %s:%d" +msgstr "BFD %s ¶ÏÑÔʧ°Ü %s£º%d" + +#: bfd.c:719 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d in %s\n" +msgstr "BFD %1$s ÄÚ²¿´íÎó£¬Òì³£ÖÐÖ¹ÓÚ %4$s µÄ %3$d ÐÐµÄ %2$s\n" + +#: bfd.c:723 +#, c-format +msgid "BFD %s internal error, aborting at %s line %d\n" +msgstr "BFD %1$s ÄÚ²¿´íÎó£¬Òì³£ÖÐÖ¹ÓÚ %3$d ÐÐµÄ %2$s\n" + +#: bfd.c:725 +msgid "Please report this bug.\n" +msgstr "Ç뱨¸æ¸Ã BUG¡£\n" + +#: binary.c:306 +#, c-format +msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx." +msgstr "¾¯¸æ£º½«½Ú¡°%s¡±Ð´Èë¹ý´ó(ÀýÈ縺Êý)ÎļþÆ«ÒÆÁ¿µÄλÖà 0x%lx¡£" + +#: coff-a29k.c:119 +msgid "Missing IHCONST" +msgstr "ÒÅʧ IHCONST" + +#: coff-a29k.c:180 +msgid "Missing IHIHALF" +msgstr "ÒÅʧ IHIHALF" + +#: coff-a29k.c:212 coff-or32.c:229 +msgid "Unrecognized reloc" +msgstr "ÎÞ·¨Ê¶±ðµÄÖØ¶¨Î»" + +#: coff-a29k.c:408 +msgid "missing IHCONST reloc" +msgstr "ÒÅʧ IHCONST ÖØ¶¨Î»" + +#: coff-a29k.c:498 +msgid "missing IHIHALF reloc" +msgstr "ÒÅʧ IHIHALF ÖØ¶¨Î»" + +#: coff-alpha.c:881 coff-alpha.c:918 coff-alpha.c:1989 coff-mips.c:1432 +msgid "GP relative relocation used when GP not defined" +msgstr "ÔÚ GP 䶨ÒåµÄÇé¿öÏÂʹÓÃÁË GP Ïà¶ÔÖØ¶¨Î»" + +#: coff-alpha.c:1485 +msgid "using multiple gp values" +msgstr "ʹÓÃÁ˶à¸ö GP Öµ" + +#: coff-arm.c:1066 elf32-arm.h:285 +#, c-format +msgid "%s: unable to find THUMB glue '%s' for `%s'" +msgstr "" + +#: coff-arm.c:1096 elf32-arm.h:320 +#, c-format +msgid "%s: unable to find ARM glue '%s' for `%s'" +msgstr "" + +#: coff-arm.c:1391 coff-arm.c:1486 elf32-arm.h:887 elf32-arm.h:991 +#, c-format +msgid "%s(%s): warning: interworking not enabled." +msgstr "" + +#: coff-arm.c:1395 elf32-arm.h:994 +#, c-format +msgid " first occurrence: %s: arm call to thumb" +msgstr "" + +#: coff-arm.c:1490 elf32-arm.h:890 +#, c-format +msgid " first occurrence: %s: thumb call to arm" +msgstr "" + +#: coff-arm.c:1493 +msgid " consider relinking with --support-old-code enabled" +msgstr " ³¢ÊÔÆôÓà --support-old-code ÖØÐÂÁ¬½Ó" + +#: coff-arm.c:1785 coff-tic80.c:686 cofflink.c:3031 +#, c-format +msgid "%s: bad reloc address 0x%lx in section `%s'" +msgstr "" + +#: coff-arm.c:2127 +#, c-format +msgid "%s: illegal symbol index in reloc: %d" +msgstr "%s£ºÖض¨Î»ÖзǷ¨µÄ·ûºÅË÷Òý£º%d" + +#: coff-arm.c:2255 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d" +msgstr "´íÎó£º%s ÊÇΪ APCS-%d ±àÒëµÄ£¬¶ø %s ÊÇΪ APCS-%d ±àÒëµÄ" + +#: coff-arm.c:2270 elf32-arm.h:2297 +#, c-format +msgid "ERROR: %s passes floats in float registers, whereas %s passes them in integer registers" +msgstr "´íÎó£º%s ÔÚ¸¡µã¼Ä´æÆ÷Öд«µÝ¸¡µãÊý£¬¶ø %s ÔÚÕûÊý¼Ä´æÆ÷Öд«µÝËüÃÇ" + +#: coff-arm.c:2273 elf32-arm.h:2302 +#, c-format +msgid "ERROR: %s passes floats in integer registers, whereas %s passes them in float registers" +msgstr "´íÎó£º%s ÔÚÕûÊý¼Ä´æÆ÷Öд«µÝ¸¡µãÊý£¬¶ø %s ÔÚ¸¡µãÊý¼Ä´æÆ÷Öд«µÝËüÃÇ" + +#: coff-arm.c:2288 +#, c-format +msgid "ERROR: %s is compiled as position independent code, whereas target %s is absolute position" +msgstr "´íÎó£º%s ±»±àÒëΪλÖÃÎ޹شúÂ룬¶øÄ¿±ê %s ²ÉÓþø¶ÔλÖÃ" + +#: coff-arm.c:2291 +#, c-format +msgid "ERROR: %s is compiled as absolute position code, whereas target %s is position independent" +msgstr "´íÎó£º%s ±»±àÒëΪ¾ø¶ÔλÖôúÂ룬¶øÄ¿±ê %s ÊÇλÖÃÎ޹صÄ" + +#: coff-arm.c:2320 elf32-arm.h:2358 +#, c-format +msgid "Warning: %s supports interworking, whereas %s does not" +msgstr "¾¯¸æ£º%s Ö§³Ö»¥²Ù×÷£¬¶ø %s ²»Ö§³Ö" + +#: coff-arm.c:2323 elf32-arm.h:2365 +#, c-format +msgid "Warning: %s does not support interworking, whereas %s does" +msgstr "¾¯¸æ£º%s ²»Ö§³Ö»¥²Ù×÷£¬¶ø %s Ö§³Ö" + +#: coff-arm.c:2350 +#, c-format +msgid "private flags = %x:" +msgstr "˽ÓбêÖ¾ = %x£º" + +#: coff-arm.c:2358 elf32-arm.h:2418 +msgid " [floats passed in float registers]" +msgstr " [ÔÚ¸¡µã¼Ä´æÆ÷Öд«µÝ¸¡µãÊý]" + +#: coff-arm.c:2360 +msgid " [floats passed in integer registers]" +msgstr " [ÔÚÕûÊý¼Ä´æÆ÷Öд«µÝ¸¡µãÊý]" + +#: coff-arm.c:2363 elf32-arm.h:2421 +msgid " [position independent]" +msgstr " [λÖÃÎÞ¹Ø]" + +#: coff-arm.c:2365 +msgid " [absolute position]" +msgstr " [¾ø¶ÔλÖÃ]" + +#: coff-arm.c:2369 +msgid " [interworking flag not initialised]" +msgstr " [»¥²Ù×÷±ê־δ³õʼ»¯]" + +#: coff-arm.c:2371 +msgid " [interworking supported]" +msgstr " [Ö§³Ö»¥²Ù×÷]" + +#: coff-arm.c:2373 +msgid " [interworking not supported]" +msgstr " [²»Ö§³Ö»¥²Ù×÷]" + +#: coff-arm.c:2421 elf32-arm.h:2124 +#, c-format +msgid "Warning: Not setting interworking flag of %s since it has already been specified as non-interworking" +msgstr "¾¯¸æ£ºÓÉÓÚ %s ÒѾ­±»Ö¸¶¨Îª²»¿É»¥²Ù×÷µÄ£¬Òò¶øÃ»ÓÐÉ趨»¥²Ù×÷±êÖ¾" + +#: coff-arm.c:2425 elf32-arm.h:2128 +#, c-format +msgid "Warning: Clearing the interworking flag of %s due to outside request" +msgstr "¾¯¸æ£ºÕýÔÚ¸ù¾ÝÍâ½çÇëÇóÇå³ý %s µÄ»¥²Ù×÷±êÖ¾" + +#: coff-i960.c:136 coff-i960.c:485 +msgid "uncertain calling convention for non-COFF symbol" +msgstr "¹ØÓÚ·Ç-COFF ·ûºÅ²»È·¶¨µÄµ÷ÓÃÔ¼¶¨" + +#: coff-m68k.c:481 coff-mips.c:2429 elf32-m68k.c:2157 elf32-mips.c:1844 +msgid "unsupported reloc type" +msgstr "²»Ö§³ÖµÄÖØ¶¨Î»ÀàÐÍ" + +#: coff-mips.c:874 elf32-mips.c:1062 elf64-mips.c:1609 +msgid "GP relative relocation when _gp not defined" +msgstr "" + +#. No other sections should appear in -membedded-pic +#. code. +#: coff-mips.c:2466 +msgid "reloc against unsupported section" +msgstr "¹ØÓÚ²»Ö§³Ö½ÚµÄÖØ¶¨Î»" + +#: coff-mips.c:2474 +msgid "reloc not properly aligned" +msgstr "ÖØ¶¨Î»Ã»ÓÐÕýÈ·¶ÔÆë" + +#: coff-rs6000.c:2766 +#, c-format +msgid "%s: unsupported relocation type 0x%02x" +msgstr "%s£º²»Ö§³ÖµÄÖØ¶¨Î»ÀàÐÍ 0x%02x" + +#: coff-rs6000.c:2859 +#, c-format +msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry" +msgstr "" + +#: coff-rs6000.c:3590 coff64-rs6000.c:2091 +#, c-format +msgid "%s: symbol `%s' has unrecognized smclas %d" +msgstr "" + +#: coff-tic54x.c:279 coff-tic80.c:449 +#, c-format +msgid "Unrecognized reloc type 0x%x" +msgstr "ÎÞ·¨Ê¶±ðµÄÖØ¶¨Î»ÀàÐÍ 0x%x" + +#: coff-tic54x.c:390 coffcode.h:4974 +#, c-format +msgid "%s: warning: illegal symbol index %ld in relocs" +msgstr "%s£º¾¯¸æ£ºÖض¨Î»ÖзǷ¨µÄ·ûºÅË÷Òý %ld" + +#: coff-w65.c:363 +#, c-format +msgid "ignoring reloc %s\n" +msgstr "ÕýÔÚºöÂÔÖØ¶¨Î» %s\n" + +#: coffcode.h:1086 +#, c-format +msgid "%s (%s): Section flag %s (0x%x) ignored" +msgstr "%s (%s)£ººöÂÔ½Ú±êÖ¾ %s (0x%x)" + +#: coffcode.h:2143 +#, c-format +msgid "Unrecognized TI COFF target id '0x%x'" +msgstr "ÎÞ·¨Ê¶±ðµÄ TI COFF Ä¿±ê id ¡°0x%x¡±" + +#: coffcode.h:4365 +#, c-format +msgid "%s: warning: illegal symbol index %ld in line numbers" +msgstr "%s£º¾¯¸æ£ºÐкÅÖеķǷ¨·ûºÅË÷Òý %ld" + +#: coffcode.h:4379 +#, c-format +msgid "%s: warning: duplicate line number information for `%s'" +msgstr "%s£º¾¯¸æ£ºÎª¡°%s¡±¸´ÖÆÐкÅÐÅÏ¢" + +#: coffcode.h:4736 +#, c-format +msgid "%s: Unrecognized storage class %d for %s symbol `%s'" +msgstr "" + +#: coffcode.h:4867 +#, c-format +msgid "warning: %s: local symbol `%s' has no section" +msgstr "¾¯¸æ£º%s£º±¾µØ·ûºÅ¡°%s¡±Ã»ÓнÚ" + +#: coffcode.h:5012 +#, c-format +msgid "%s: illegal relocation type %d at address 0x%lx" +msgstr "%1$s£ºÎ»ÓÚµØÖ· 0x%3$lx ´¦µÄ·Ç·¨Öض¨Î»ÀàÐÍ %2$d" + +#: coffgen.c:1661 +#, c-format +msgid "%s: bad string table size %lu" +msgstr "%s£º×Ö·û´®±íµÄ´óС´íÎó %lu" + +#: cofflink.c:534 elflink.h:1912 +#, c-format +msgid "Warning: type of symbol `%s' changed from %d to %d in %s" +msgstr "¾¯¸æ£º%4$s ÖеķûºÅ¡°%1$s¡±µÄÀàÐÍÓÉ %2$d ±äΪ %3$d" + +#: cofflink.c:2321 +#, c-format +msgid "%s: relocs in section `%s', but it has no contents" +msgstr "" + +#: cofflink.c:2664 coffswap.h:877 +#, c-format +msgid "%s: %s: reloc overflow: 0x%lx > 0xffff" +msgstr "%s£º%s£ºÖض¨Î»Òç³ö£º0x%lx > 0xffff" + +#: cofflink.c:2673 coffswap.h:864 +#, c-format +msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff" +msgstr "%s£º¾¯¸æ£º%s£ºÐкÅÒç³ö£º0x%lx > 0xffff" + +#: dwarf2.c:382 +msgid "Dwarf Error: Can't find .debug_str section." +msgstr "С´íÎó£ºÎÞ·¨ÕÒµ½ .debug_str ½Ú¡£" + +#: dwarf2.c:399 +#, c-format +msgid "Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str size (%lu)." +msgstr "" + +#: dwarf2.c:543 +msgid "Dwarf Error: Can't find .debug_abbrev section." +msgstr "С´íÎó£ºÎÞ·¨ÕÒµ½ .debug_abbrev ½Ú¡£" + +#: dwarf2.c:560 +#, c-format +msgid "Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size (%lu)." +msgstr "" + +#: dwarf2.c:757 +#, c-format +msgid "Dwarf Error: Invalid or unhandled FORM value: %u." +msgstr "С´íÎó£ºÎÞЧ»òδ´¦ÀíµÄ±íµ¥Öµ£º%u¡£" + +#: dwarf2.c:852 +msgid "Dwarf Error: mangled line number section (bad file number)." +msgstr "" + +#: dwarf2.c:938 +msgid "Dwarf Error: Can't find .debug_line section." +msgstr "С´íÎó£ºÎÞ·¨ÕÒµ½ .debug_line ½Ú¡£" + +#: dwarf2.c:961 +#, c-format +msgid "Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%lu)." +msgstr "" + +#: dwarf2.c:1159 +msgid "Dwarf Error: mangled line number section." +msgstr "" + +#: dwarf2.c:1355 dwarf2.c:1566 +#, c-format +msgid "Dwarf Error: Could not find abbrev number %u." +msgstr "" + +#: dwarf2.c:1527 +#, c-format +msgid "Dwarf Error: found dwarf version '%u', this reader only handles version 2 information." +msgstr "" + +#: dwarf2.c:1534 +#, c-format +msgid "Dwarf Error: found address size '%u', this reader can not handle sizes greater than '%u'." +msgstr "" + +#: dwarf2.c:1557 +#, c-format +msgid "Dwarf Error: Bad abbrev number: %u." +msgstr "С´íÎ󣺴íÎóµÄËõд±àºÅ£º%u¡£" + +#: ecoff.c:1318 +#, c-format +msgid "Unknown basic type %d" +msgstr "δ֪µÄ»ù±¾ÀàÐÍ %d" + +#: ecoff.c:1578 +#, c-format +msgid "" +"\n" +" End+1 symbol: %ld" +msgstr "" +"\n" +" End+1 ·ûºÅ£º%ld" + +#: ecoff.c:1585 ecoff.c:1588 +#, c-format +msgid "" +"\n" +" First symbol: %ld" +msgstr "" +"\n" +" µÚÒ»¸ö·ûºÅ£º%ld" + +#: ecoff.c:1600 +#, c-format +msgid "" +"\n" +" End+1 symbol: %-7ld Type: %s" +msgstr "" +"\n" +" End+1 ·ûºÅ£º%-7ld ÀàÐÍ£º%s" + +#: ecoff.c:1607 +#, c-format +msgid "" +"\n" +" Local symbol: %ld" +msgstr "" +"\n" +" ±¾µØ·ûºÅ£º%ld" + +#: ecoff.c:1615 +#, c-format +msgid "" +"\n" +" struct; End+1 symbol: %ld" +msgstr "" +"\n" +" ½á¹¹£»End+1 ·ûºÅ£º%ld" + +#: ecoff.c:1620 +#, c-format +msgid "" +"\n" +" union; End+1 symbol: %ld" +msgstr "" +"\n" +" ÁªºÏ£»End+1 ·ûºÅ£º%ld" + +#: ecoff.c:1625 +#, c-format +msgid "" +"\n" +" enum; End+1 symbol: %ld" +msgstr "" +"\n" +" ö¾Ù£»End+1 ·ûºÅ£º%ld" + +#: ecoff.c:1631 +#, c-format +msgid "" +"\n" +" Type: %s" +msgstr "" +"\n" +" ÀàÐÍ£º%s" + +#: elf-hppa.h:1476 elf-hppa.h:1509 elf32-ppc.c:3091 elf32-sh.c:4213 +#: elf64-sh64.c:1659 +#, c-format +msgid "%s: warning: unresolvable relocation against symbol `%s' from %s section" +msgstr "%1$s£º¾¯¸æ£ºÀ´×Ô %3$s ½ÚµÄ¹ØÓÚ·ûºÅ¡°%2$s¡±µÄ²»¿É½âÎöµÄÖØ¶¨Î»" + +#: elf-m10200.c:446 elf-m10300.c:656 elf32-arm.h:2084 elf32-avr.c:833 +#: elf32-cris.c:1403 elf32-d10v.c:481 elf32-fr30.c:635 elf32-frv.c:809 +#: elf32-h8300.c:548 elf32-i860.c:1031 elf32-m32r.c:1278 elf32-openrisc.c:439 +#: elf32-v850.c:1691 elf32-xstormy16.c:933 elf64-mmix.c:1302 +msgid "internal error: out of range error" +msgstr "ÄÚ²¿´íÎ󣺳¬³ö·¶Î§´íÎó" + +#: elf-m10200.c:450 elf-m10300.c:660 elf32-arm.h:2088 elf32-avr.c:837 +#: elf32-cris.c:1407 elf32-d10v.c:485 elf32-fr30.c:639 elf32-frv.c:813 +#: elf32-h8300.c:552 elf32-i860.c:1035 elf32-m32r.c:1282 elf32-openrisc.c:443 +#: elf32-v850.c:1695 elf32-xstormy16.c:937 elf64-mmix.c:1306 elfxx-mips.c:5264 +msgid "internal error: unsupported relocation error" +msgstr "ÄÚ²¿´íÎ󣺲»Ö§³ÖµÄÖØ¶¨Î»´íÎó" + +#: elf-m10200.c:454 elf-m10300.c:664 elf32-arm.h:2092 elf32-d10v.c:489 +#: elf32-h8300.c:556 elf32-m32r.c:1286 +msgid "internal error: dangerous error" +msgstr "ÄÚ²¿´íÎó£ºÎ£ÏյĴíÎó" + +#: elf-m10200.c:458 elf-m10300.c:668 elf32-arm.h:2096 elf32-avr.c:845 +#: elf32-cris.c:1415 elf32-d10v.c:493 elf32-fr30.c:647 elf32-frv.c:821 +#: elf32-h8300.c:560 elf32-i860.c:1043 elf32-m32r.c:1290 elf32-openrisc.c:451 +#: elf32-v850.c:1715 elf32-xstormy16.c:945 elf64-mmix.c:1314 +msgid "internal error: unknown error" +msgstr "ÄÚ²¿´íÎó£ºÎ´ÖªµÄ´íÎó" + +#: elf.c:343 +#, c-format +msgid "%s: invalid string offset %u >= %lu for section `%s'" +msgstr "" + +#: elf.c:589 +#, c-format +msgid "%s: invalid SHT_GROUP entry" +msgstr "%s£ºÎÞЧµÄ SHT_GROUP ÌõÄ¿" + +#: elf.c:660 +#, c-format +msgid "%s: no group info for section %s" +msgstr "%s£ºÃ»ÓйØÓÚ½Ú %s µÄ×éÐÅÏ¢" + +#: elf.c:1023 +msgid "" +"\n" +"Program Header:\n" +msgstr "" +"\n" +"³ÌÐòÍ·£º\n" + +#: elf.c:1073 +msgid "" +"\n" +"Dynamic Section:\n" +msgstr "" +"\n" +"¶¯Ì¬½Ú£º\n" + +#: elf.c:1202 +msgid "" +"\n" +"Version definitions:\n" +msgstr "" +"\n" +"°æ±¾¶¨Ò壺\n" + +#: elf.c:1225 +msgid "" +"\n" +"Version References:\n" +msgstr "" +"\n" +"°æ±¾ÒýÓãº\n" + +#: elf.c:1230 +#, c-format +msgid " required from %s:\n" +msgstr "" + +#: elf.c:1902 +#, c-format +msgid "%s: invalid link %lu for reloc section %s (index %u)" +msgstr "" + +#: elf.c:3603 +#, c-format +msgid "%s: Not enough room for program headers (allocated %u, need %u)" +msgstr "%s£ºÃ»ÓÐ×ã¹»µÄ¿Õ¼ä±£´æ³ÌÐòÍ·£¨·ÖÅä %u£¬ÐèÒª %u£©" + +#: elf.c:3708 +#, c-format +msgid "%s: Not enough room for program headers, try linking with -N" +msgstr "%s£ºÃ»ÓÐ×ã¹»µÄ¿Õ¼ä±£´æ³ÌÐòÍ·£¬ÊÔÓà -N ½øÐÐÁ¬½Ó" + +#: elf.c:3833 +#, c-format +msgid "Error: First section in segment (%s) starts at 0x%x whereas the segment starts at 0x%x" +msgstr "´íÎ󣺶Π(%s) ÖеĵÚÒ»¸ö½Ú¿ªÊ¼ÓÚ 0x%x£¬È»¶ø¶Î¿ªÊ¼ÓÚ 0x%x" + +#: elf.c:4148 +#, c-format +msgid "%s: warning: allocated section `%s' not in segment" +msgstr "%s£º¾¯¸æ£ºÒÑ·ÖÅäµÄ½Ú¡°%s¡±²»ÔÚ¶ÎÖÐ" + +#: elf.c:4472 +#, c-format +msgid "%s: symbol `%s' required but not present" +msgstr "%s£º±ØÐèµÄ·ûºÅ¡°%s¡±²»´æÔÚ" + +#: elf.c:4749 +#, c-format +msgid "%s: warning: Empty loadable segment detected, is this intentional ?\n" +msgstr "%s£º¾¯¸æ£º·¢ÏֿյĿÉ×°Èë¶Î£¬ËüÊÇÄÚ²¿µÄ£¿\n" + +#: elf.c:6193 +#, c-format +msgid "%s: unsupported relocation type %s" +msgstr "%s£º²»Ö§³ÖµÄÖØ¶¨Î»µÄÀàÐÍ %s" + +#: elf32-arm.h:1221 +#, c-format +msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'." +msgstr "" + +#: elf32-arm.h:1417 +#, c-format +msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'." +msgstr "" + +#: elf32-arm.h:1914 elf32-sh.c:4125 +#, c-format +msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section" +msgstr "%s(%s+0x%lx)£º¹ØÓÚ SEC_MERGE ½ÚµÄÖØ¶¨Î» %s" + +#: elf32-arm.h:2008 +#, c-format +msgid "%s: warning: unresolvable relocation %d against symbol `%s' from %s section" +msgstr "" + +#: elf32-arm.h:2176 +#, c-format +msgid "Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it" +msgstr "" + +#: elf32-arm.h:2271 +#, c-format +msgid "ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d" +msgstr "´íÎó£º%s ÊÇΪ EABI °æ±¾ %d ±àÒëµÄ£¬¶ø %s ÔòÊÇΪ°æ±¾ %d ±àÒëµÄ" + +#: elf32-arm.h:2285 +#, c-format +msgid "ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d" +msgstr "´íÎó£º%s ÊÇΪ APCS-%d ±àÒëµÄ£¬¶øÄ¿±ê %s ʹÓà APCS-%d" + +#: elf32-arm.h:2313 +#, c-format +msgid "ERROR: %s uses VFP instructions, whereas %s uses FPA instructions" +msgstr "´íÎó£º%s ʹÓà VFP Ö¸Á¶ø %s ʹÓà FPA Ö¸Áî" + +#: elf32-arm.h:2318 +#, c-format +msgid "ERROR: %s uses FPA instructions, whereas %s uses VFP instructions" +msgstr "´íÎó£º%s ʹÓà FPA Ö¸Á¶ø %s ʹÓà VFP Ö¸Áî" + +#: elf32-arm.h:2338 +#, c-format +msgid "ERROR: %s uses software FP, whereas %s uses hardware FP" +msgstr "´íÎó£º%s ʹÓÃÈí¼þ FP£¬¶ø %s ʹÓÃÓ²¼þ FP" + +#: elf32-arm.h:2343 +#, c-format +msgid "ERROR: %s uses hardware FP, whereas %s uses software FP" +msgstr "´íÎó£º%s ʹÓÃÓ²¼þ FP£¬¶ø %s ʹÓÃÈí¼þ FP" + +#. Ignore init flag - it may not be set, despite the flags field +#. containing valid data. +#: elf32-arm.h:2396 elf32-cris.c:2988 elf32-m68k.c:410 elf32-vax.c:543 +#: elfxx-mips.c:7756 +#, c-format +msgid "private flags = %lx:" +msgstr "˽ÓбêÖ¾ = %lx£º" + +#: elf32-arm.h:2405 +msgid " [interworking enabled]" +msgstr " [ÆôÓû¥²Ù×÷]" + +#: elf32-arm.h:2413 +msgid " [VFP float format]" +msgstr " [VFP ¸¡µã¸ñʽ]" + +#: elf32-arm.h:2415 +msgid " [FPA float format]" +msgstr " [FPA ¸¡µã¸ñʽ]" + +#: elf32-arm.h:2424 +msgid " [new ABI]" +msgstr " [РABI]" + +#: elf32-arm.h:2427 +msgid " [old ABI]" +msgstr " [¾É ABI]" + +#: elf32-arm.h:2430 +msgid " [software FP]" +msgstr " [Èí¼þ FP]" + +#: elf32-arm.h:2438 +msgid " [Version1 EABI]" +msgstr " [°æ±¾1 EABI]" + +#: elf32-arm.h:2441 elf32-arm.h:2452 +msgid " [sorted symbol table]" +msgstr " [ÅÅÐò¹ýµÄ·ûºÅ±í]" + +#: elf32-arm.h:2443 elf32-arm.h:2454 +msgid " [unsorted symbol table]" +msgstr " [δÅÅÐòµÄ·ûºÅ±í]" + +#: elf32-arm.h:2449 +msgid " [Version2 EABI]" +msgstr " [°æ±¾2 EABI]" + +#: elf32-arm.h:2457 +msgid " [dynamic symbols use segment index]" +msgstr " [¶¯Ì¬·ûºÅʹÓöÎË÷Òý]" + +#: elf32-arm.h:2460 +msgid " [mapping symbols precede others]" +msgstr "" + +#: elf32-arm.h:2467 +msgid " " +msgstr " <²»¿Éʶ±ðµÄ EABI °æ±¾>" + +#: elf32-arm.h:2474 +msgid " [relocatable executable]" +msgstr " [¿ÉÖØÐ¶¨Î»µÄ¿ÉÖ´ÐгÌÐò]" + +#: elf32-arm.h:2477 +msgid " [has entry point]" +msgstr " [º¬ÓÐÈë¿Úµã]" + +#: elf32-arm.h:2482 +msgid "" +msgstr "<ÎÞ·¨Ê¶±ðµÄ±ê־λ¼¯ºÏ>" + +#: elf32-avr.c:841 elf32-cris.c:1411 elf32-fr30.c:643 elf32-frv.c:817 +#: elf32-i860.c:1039 elf32-openrisc.c:447 elf32-v850.c:1699 +#: elf32-xstormy16.c:941 elf64-mmix.c:1310 +msgid "internal error: dangerous relocation" +msgstr "ÄÚ²¿´íÎó£ºÎ£ÏÕµÄÖØ¶¨Î»" + +#: elf32-cris.c:949 +#, c-format +msgid "%s: unresolvable relocation %s against symbol `%s' from %s section" +msgstr "%1$s£ºÀ´×Ô %4$s ½ÚµÄ¹ØÓÚ·ûºÅ¡°%3$s¡±µÄÎÞ·¨½âÎöµÄÖØ¶¨Î» %2$s" + +#: elf32-cris.c:1012 +#, c-format +msgid "%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section" +msgstr "" + +#: elf32-cris.c:1015 elf32-cris.c:1141 +msgid "[whose name is lost]" +msgstr "" + +#: elf32-cris.c:1130 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against local symbol from %s section" +msgstr "" + +#: elf32-cris.c:1137 +#, c-format +msgid "%s: relocation %s with non-zero addend %d against symbol `%s' from %s section" +msgstr "" + +#: elf32-cris.c:1155 +#, c-format +msgid "%s: relocation %s is not allowed for global symbol: `%s' from %s section" +msgstr "" + +#: elf32-cris.c:1170 +#, c-format +msgid "%s: relocation %s in section %s with no GOT created" +msgstr "" + +#: elf32-cris.c:1288 +#, c-format +msgid "%s: Internal inconsistency; no relocation section %s" +msgstr "%s£ºÄÚ²¿²»Ò»Ö£»Ã»ÓÐÖØ¶¨Î»½Ú %s" + +#: elf32-cris.c:2514 +#, c-format +msgid "" +"%s, section %s:\n" +" relocation %s should not be used in a shared object; recompile with -fPIC" +msgstr "" + +#: elf32-cris.c:2991 +msgid " [symbols have a _ prefix]" +msgstr " [·ûºÅÓиö _ ǰ׺]" + +#: elf32-cris.c:3030 +#, c-format +msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols" +msgstr "%s£ºÊ¹Óôø _ ǰ׺µÄ·ûºÅ£¬µ«ÒÔÎÞǰ׺·ûºÅдÈëÎļþ" + +#: elf32-cris.c:3031 +#, c-format +msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols" +msgstr "%s£ºÊ¹ÓÃÎÞǰ׺·ûºÅ£¬µ«ÒÔ´ø _ ǰ׺µÄ·ûºÅдÈëÎļþ" + +#: elf32-frv.c:1217 +#, c-format +msgid "%s: compiled with %s and linked with modules that use non-pic relocations" +msgstr "" + +#: elf32-frv.c:1267 +#, c-format +msgid "%s: compiled with %s and linked with modules compiled with %s" +msgstr "%s£ºÒÔ %s ±àÒ벢ͬÒÔ %s ±àÒëµÄÄ£¿éÁ¬½Ó" + +#: elf32-frv.c:1279 +#, c-format +msgid "%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "" + +#: elf32-frv.c:1315 +#, c-format +msgid "private flags = 0x%lx:" +msgstr "˽ÓбêÖ¾ = 0x%lx£º" + +#: elf32-gen.c:82 elf64-gen.c:82 +#, c-format +msgid "%s: Relocations in generic ELF (EM: %d)" +msgstr "" + +#: elf32-hppa.c:671 elf64-ppc.c:2323 +#, c-format +msgid "%s: cannot create stub entry %s" +msgstr "" + +#: elf32-hppa.c:956 elf32-hppa.c:3555 +#, c-format +msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections" +msgstr "" + +#: elf32-hppa.c:1338 elf64-x86-64.c:673 +#, c-format +msgid "%s: relocation %s can not be used when making a shared object; recompile with -fPIC" +msgstr "" + +#: elf32-hppa.c:1358 +#, c-format +msgid "%s: relocation %s should not be used when making a shared object; recompile with -fPIC" +msgstr "" + +#: elf32-hppa.c:1551 +#, c-format +msgid "Could not find relocation section for %s" +msgstr "ÎÞ·¨Îª %s ÕÒµ½Öض¨Î»½Ú" + +#: elf32-hppa.c:2855 +#, c-format +msgid "%s: duplicate export stub %s" +msgstr "" + +#: elf32-hppa.c:3433 +#, c-format +msgid "%s(%s+0x%lx): fixing %s" +msgstr "%s(%s+0x%lx)£ºÕýÔÚÐÞ¸´ %s" + +#: elf32-hppa.c:4080 +#, c-format +msgid "%s(%s+0x%lx): cannot handle %s for %s" +msgstr "" + +#: elf32-hppa.c:4393 +msgid ".got section not immediately after .plt section" +msgstr ".got ½Ú²»Äܽô½ÓÔÚ .plt ½ÚÖ®ºó" + +#: elf32-i386.c:379 +#, c-format +msgid "%s: invalid relocation type %d" +msgstr "%s£ºÎÞЧµÄÖØ¶¨Î»ÀàÐÍ %d" + +#: elf32-i386.c:876 elf32-s390.c:649 elf64-s390.c:595 elf64-x86-64.c:591 +#, c-format +msgid "%s: bad symbol index: %d" +msgstr "%s£º´íÎóµÄ·ûºÅË÷Òý£º%d" + +#: elf32-i386.c:948 +#, c-format +msgid "%s: `%s' accessed both as normal and thread local symbol" +msgstr "" + +#: elf32-i386.c:1072 elf32-s390.c:808 elf64-ppc.c:2827 elf64-s390.c:759 +#: elf64-x86-64.c:761 +#, c-format +msgid "%s: bad relocation section name `%s'" +msgstr "%s£º´íÎóµÄÖØ¶¨Î»½ÚÃû³Æ¡°%s¡±" + +#: elf32-i386.c:1159 elf64-alpha.c:4768 +#, c-format +msgid "%s: TLS local exec code cannot be linked into shared objects" +msgstr "" + +#: elf32-i386.c:2747 elf32-s390.c:1981 elf32-sparc.c:1571 elf64-ppc.c:5918 +#: elf64-s390.c:1945 elf64-sparc.c:2578 elf64-x86-64.c:1948 +#, c-format +msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'" +msgstr "" + +#: elf32-i386.c:2784 elf32-s390.c:2019 elf64-ppc.c:5977 elf64-s390.c:1983 +#: elf64-x86-64.c:1986 +#, c-format +msgid "%s(%s+0x%lx): reloc against `%s': error %d" +msgstr "" + +#: elf32-m32r.c:924 +msgid "SDA relocation when _SDA_BASE_ not defined" +msgstr "ÔÚ _SDA_BASE_ 䶨Òåʱ³öÏÖ SDA ÖØ¶¨Î»" + +#: elf32-ia64.c:3687 elf32-m32r.c:1013 elf32-ppc.c:2987 elf64-alpha.c:4185 +#: elf64-alpha.c:4313 elf64-ia64.c:3687 +#, c-format +msgid "%s: unknown relocation type %d" +msgstr "%s£ºÎ´ÖªµÄÖØ¶¨Î»ÀàÐÍ %d" + +#: elf32-m32r.c:1221 +#, c-format +msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)" +msgstr "" + +#: elf32-m32r.c:1947 +#, c-format +msgid "%s: Instruction set mismatch with previous modules" +msgstr "" + +#: elf32-m32r.c:1970 +#, c-format +msgid "private flags = %lx" +msgstr "˽ÓбêÖ¾ = %lx" + +#: elf32-m32r.c:1975 +msgid ": m32r instructions" +msgstr "£ºm32r Ö¸Áî" + +#: elf32-m32r.c:1976 +msgid ": m32rx instructions" +msgstr "£ºm32rx Ö¸Áî" + +#: elf32-m68k.c:413 +msgid " [cpu32]" +msgstr " [cpu32]" + +#: elf32-m68k.c:416 +msgid " [m68000]" +msgstr " [m68000]" + +#: elf32-mcore.c:354 elf32-mcore.c:457 +#, c-format +msgid "%s: Relocation %s (%d) is not currently supported.\n" +msgstr "" + +#: elf32-mcore.c:442 +#, c-format +msgid "%s: Unknown relocation type %d\n" +msgstr "%s£ºÎ´ÖªµÄÖØ¶¨Î»ÀàÐÍ %d\n" + +#: elf32-mips.c:1152 elf64-mips.c:1783 +msgid "32bits gp relative relocation occurs for an external symbol" +msgstr "" + +#: elf32-mips.c:1301 +#, c-format +msgid "Linking mips16 objects into %s format is not supported" +msgstr "½« mips16 Ä¿±êÎļþÁ¬½Óµ½ %s ¸ñʽÊDz»Ö§³ÖµÄ" + +#: elf32-ppc.c:1460 +#, c-format +msgid "%s: compiled with -mrelocatable and linked with modules compiled normally" +msgstr "" + +#: elf32-ppc.c:1468 +#, c-format +msgid "%s: compiled normally and linked with modules compiled with -mrelocatable" +msgstr "" + +#: elf32-ppc.c:1494 elf64-sparc.c:2989 elfxx-mips.c:7713 +#, c-format +msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "" + +#: elf32-ppc.c:1592 +#, c-format +msgid "%s: Unknown special linker type %d" +msgstr "%s£ºÎ´ÖªµÄÌØ¶¨Á¬½ÓÆ÷ÀàÐÍ %d" + +#: elf32-ppc.c:2273 elf32-ppc.c:2307 elf32-ppc.c:2342 +#, c-format +msgid "%s: relocation %s cannot be used when making a shared object" +msgstr "%s£º´´½¨¹²ÏíÄ¿±êÎļþʱ²»ÄÜʹÓÃÖØ¶¨Î» %s" + +#: elf32-ppc.c:3126 elf64-ppc.c:5473 +#, c-format +msgid "%s: unknown relocation type %d for symbol %s" +msgstr "%1$s£º¹ØÓÚ·ûºÅ %3$s µÄÎ´ÖªÖØ¶¨Î»ÀàÐÍ %2$d" + +#: elf32-ppc.c:3482 elf32-ppc.c:3503 elf32-ppc.c:3553 +#, c-format +msgid "%s: The target (%s) of a %s relocation is in the wrong output section (%s)" +msgstr "" + +#: elf32-ppc.c:3619 +#, c-format +msgid "%s: Relocation %s is not yet supported for symbol %s." +msgstr "%s£ºÉв»Ö§³Ö¹ØÓÚ·ûºÅ %s µÄÖØ¶¨Î» %s¡£" + +#: elf32-sh.c:1964 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES offset" +msgstr "%s£º0x%lx£º¾¯¸æ£º´íÎóµÄ R_SH_USES Æ«ÒÆÁ¿" + +#: elf32-sh.c:1976 +#, c-format +msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x" +msgstr "%s£º0x%lx£º¾¯¸æ£ºR_SH_USES Ö¸ÏòÎÞ·¨Ê¶±ðµÄÖ¸Áî 0x%x" + +#: elf32-sh.c:1993 +#, c-format +msgid "%s: 0x%lx: warning: bad R_SH_USES load offset" +msgstr "%s£º0x%lx£º¾¯¸æ£º´íÎóµÄ R_SH_USES ×°ÈëÆ«ÒÆÁ¿" + +#: elf32-sh.c:2008 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected reloc" +msgstr "%s£º0x%lx£º¾¯¸æ£ºÎÞ·¨ÕÒµ½Ô¤ÆÚµÄÖØ¶¨Î»" + +#: elf32-sh.c:2036 +#, c-format +msgid "%s: 0x%lx: warning: symbol in unexpected section" +msgstr "%s£º0x%lx£º¾¯¸æ£ºÒâÍâ½ÚÖгöÏÖ·ûºÅ" + +#: elf32-sh.c:2153 +#, c-format +msgid "%s: 0x%lx: warning: could not find expected COUNT reloc" +msgstr "%s£º0x%lx£º¾¯¸æ£ºÎÞ·¨ÕÒµ½Ô¤ÆÚµÄ COUNT ÖØ¶¨Î»" + +#: elf32-sh.c:2162 +#, c-format +msgid "%s: 0x%lx: warning: bad count" +msgstr "%s£º0x%lx£º¾¯¸æ£º´íÎó¼ÆÊý" + +#: elf32-sh.c:2550 elf32-sh.c:2926 +#, c-format +msgid "%s: 0x%lx: fatal: reloc overflow while relaxing" +msgstr "" + +#: elf32-sh.c:4073 elf64-sh64.c:1576 +msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled" +msgstr "" + +#: elf32-sh.c:4284 +#, c-format +msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation" +msgstr "" + +#: elf32-sh64.c:203 elf64-sh64.c:2364 +#, c-format +msgid "%s: compiled as 32-bit object and %s is 64-bit" +msgstr "%s£º±àÒëΪ 32-λĿ±êÎļþµ« %s ÊÇ 64-λµÄ" + +#: elf32-sh64.c:206 elf64-sh64.c:2367 +#, c-format +msgid "%s: compiled as 64-bit object and %s is 32-bit" +msgstr "%s£º±àÒëΪ 64-λĿ±êÎļþµ« %s ÊÇ 32-λµÄ" + +#: elf32-sh64.c:208 elf64-sh64.c:2369 +#, c-format +msgid "%s: object size does not match that of target %s" +msgstr "%s£ºÄ¿±êÎļþ´óСºÍÄ¿±ê %s ²»Æ¥Åä" + +#: elf32-sh64.c:440 elf64-sh64.c:2941 +#, c-format +msgid "%s: encountered datalabel symbol in input" +msgstr "%s£ºÔÚÊäÈëÖÐÓöµ½Êý¾Ý±êÇ©·ûºÅ" + +#: elf32-sh64.c:523 +msgid "PTB mismatch: a SHmedia address (bit 0 == 1)" +msgstr "PTB ²»Æ¥Å䣺SHmedia µØÖ· (λ 0 == 1)" + +#: elf32-sh64.c:526 +msgid "PTA mismatch: a SHcompact address (bit 0 == 0)" +msgstr "PTA ²»Æ¥Å䣺SHcompact µØÖ· (λ 0 == 0)" + +#: elf32-sh64.c:544 +#, c-format +msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16" +msgstr "%s£ºGAS ´íÎó£ºÒâÍâµÄ´øÓÐ R_SH_PT_16 µÄ PTB Ö¸Áî" + +#: elf32-sh64.c:593 elf64-sh64.c:1703 +#, c-format +msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n" +msgstr "" + +#: elf32-sh64.c:677 +#, c-format +msgid "%s: could not write out added .cranges entries" +msgstr "%s£ºÎÞ·¨Ð´³ö .cranges ÌõÄ¿" + +#: elf32-sh64.c:739 +#, c-format +msgid "%s: could not write out sorted .cranges entries" +msgstr "%s£ºÎÞ·¨Ð´³ö¾­ÅÅÐòµÄ .cranges ÌõÄ¿" + +#: elf32-sparc.c:1535 elf64-sparc.c:2224 +#, c-format +msgid "%s: probably compiled without -fPIC?" +msgstr "" + +#: elf32-sparc.c:2002 +#, c-format +msgid "%s: compiled for a 64 bit system and target is 32 bit" +msgstr "%s£ºÎª 64 λϵͳ±àÒ뵫Ŀ±êƽ̨ÊÇ 32 λµÄ" + +#: elf32-sparc.c:2016 +#, c-format +msgid "%s: linking little endian files with big endian files" +msgstr "%s£ºÁ¬½ÓС¶ËÎļþºÍ´ó¶ËÎļþ" + +#: elf32-v850.c:682 +#, c-format +msgid "Variable `%s' cannot occupy in multiple small data regions" +msgstr "±äÁ¿¡°%s¡±²»ÄÜÕ¼¾Ý¶à¸öСÊý¾ÝÇø" + +#: elf32-v850.c:685 +#, c-format +msgid "Variable `%s' can only be in one of the small, zero, and tiny data regions" +msgstr "±äÁ¿¡°%s¡±Ö»ÄܳöÏÖÔÚСÊý¾ÝÇø¡¢ÁãÊý¾ÝÇø¡¢Î¢Êý¾ÝÇøÖ®Ò»" + +#: elf32-v850.c:688 +#, c-format +msgid "Variable `%s' cannot be in both small and zero data regions simultaneously" +msgstr "±äÁ¿¡°%s¡±²»ÄÜͬʱ³öÏÖÔÚСÊý¾ÝÇøºÍÁãÊý¾ÝÇø" + +#: elf32-v850.c:691 +#, c-format +msgid "Variable `%s' cannot be in both small and tiny data regions simultaneously" +msgstr "±äÁ¿¡°%s¡±²»ÄÜͬʱ³öÏÖÔÚСÊý¾ÝÇøºÍ΢Êý¾ÝÇø" + +#: elf32-v850.c:694 +#, c-format +msgid "Variable `%s' cannot be in both zero and tiny data regions simultaneously" +msgstr "±äÁ¿¡°%s¡±²»ÄÜͬʱ³öÏÖÔÚÁãÊý¾ÝÇøºÍ΢Êý¾ÝÇø" + +#: elf32-v850.c:1072 +msgid "FAILED to find previous HI16 reloc\n" +msgstr "ѰÕÒÉÏÒ»¸ö HI16 ÖØ¶¨Î»Ê§°Ü\n" + +#: elf32-v850.c:1703 +msgid "could not locate special linker symbol __gp" +msgstr "ÎÞ·¨¶¨Î»ÌØÊâÁ¬½ÓÆ÷·ûºÅ __gp" + +#: elf32-v850.c:1707 +msgid "could not locate special linker symbol __ep" +msgstr "ÎÞ·¨¶¨Î»ÌØÊâÁ¬½ÓÆ÷·ûºÅ __ep" + +#: elf32-v850.c:1711 +msgid "could not locate special linker symbol __ctbp" +msgstr "ÎÞ·¨¶¨Î»ÌØÊâÁª»úÆ÷·ûºÅ __ctbp" + +#: elf32-v850.c:1875 +#, c-format +msgid "%s: Architecture mismatch with previous modules" +msgstr "%s£ºÌåϵ½á¹¹Í¬Ç°Ò»¸öÄ£¿é²»Æ¥Åä" + +#: elf32-v850.c:1895 +#, c-format +msgid "private flags = %lx: " +msgstr "˽ÓбêÖ¾ = %lx£º" + +#: elf32-v850.c:1900 +msgid "v850 architecture" +msgstr "v850 Ìåϵ½á¹¹" + +#: elf32-v850.c:1901 +msgid "v850e architecture" +msgstr "v850e Ìåϵ½á¹¹" + +#: elf32-v850.c:1902 +msgid "v850ea architecture" +msgstr "v850ea Ìåϵ½á¹¹" + +#: elf32-vax.c:546 +msgid " [nonpic]" +msgstr "" + +#: elf32-vax.c:549 +msgid " [d-float]" +msgstr "" + +#: elf32-vax.c:552 +msgid " [g-float]" +msgstr "" + +#: elf32-vax.c:674 +#, c-format +msgid "%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of %ld" +msgstr "" + +#: elf32-vax.c:1679 +#, c-format +msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored" +msgstr "" + +#: elf32-vax.c:1814 +#, c-format +msgid "%s: warning: %s relocation against symbol `%s' from %s section" +msgstr "" + +#: elf32-vax.c:1820 +#, c-format +msgid "%s: warning: %s relocation to 0x%x from %s section" +msgstr "" + +#: elf32-ia64.c:2280 elf32-xstormy16.c:414 elf64-ia64.c:2280 +msgid "non-zero addend in @fptr reloc" +msgstr "" + +#: elf64-alpha.c:1097 +msgid "GPDISP relocation did not find ldah and lda instructions" +msgstr "GPDISP ÖØ¶¨Î»ÎÞ·¨ÕÒµ½ ldah ºÍ lda Ö¸Áî" + +#: elf64-alpha.c:3675 +#, c-format +msgid "%s: .got subsegment exceeds 64K (size %d)" +msgstr "%s£º.got ×Ó½Ú³¬¹ýÁË 64K (´óС %d)" + +#: elf64-alpha.c:4498 elf64-alpha.c:4510 +#, c-format +msgid "%s: gp-relative relocation against dynamic symbol %s" +msgstr "" + +#: elf64-alpha.c:4536 elf64-alpha.c:4676 +#, c-format +msgid "%s: pc-relative relocation against dynamic symbol %s" +msgstr "" + +#: elf64-alpha.c:4564 +#, c-format +msgid "%s: change in gp: BRSGP %s" +msgstr "" + +#: elf64-alpha.c:4589 +msgid "" +msgstr "<δ֪>" + +#: elf64-alpha.c:4594 +#, c-format +msgid "%s: !samegp reloc against symbol without .prologue: %s" +msgstr "" + +#: elf64-alpha.c:4639 +#, c-format +msgid "%s: unhandled dynamic relocation against %s" +msgstr "%s£ºÎ´´¦ÀíµÄ¹ØÓÚ %s µÄ¶¯Ì¬Öض¨Î»" + +#: elf64-alpha.c:4752 +#, c-format +msgid "%s: dtp-relative relocation against dynamic symbol %s" +msgstr "" + +#: elf64-alpha.c:4775 +#, c-format +msgid "%s: tp-relative relocation against dynamic symbol %s" +msgstr "" + +#: elf64-hppa.c:2080 +#, c-format +msgid "stub entry for %s cannot load .plt, dp offset = %ld" +msgstr "" + +#: elf64-mmix.c:1002 +#, c-format +msgid "" +"%s: Internal inconsistency error for value for\n" +" linker-allocated global register: linked: 0x%lx%08lx != relaxed: 0x%lx%08lx\n" +msgstr "" + +#: elf64-mmix.c:1386 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: (unknown) in %s" +msgstr "" + +#: elf64-mmix.c:1391 +#, c-format +msgid "%s: base-plus-offset relocation against register symbol: %s in %s" +msgstr "" + +#: elf64-mmix.c:1435 +#, c-format +msgid "%s: register relocation against non-register symbol: (unknown) in %s" +msgstr "" + +#: elf64-mmix.c:1440 +#, c-format +msgid "%s: register relocation against non-register symbol: %s in %s" +msgstr "" + +#: elf64-mmix.c:1477 +#, c-format +msgid "%s: directive LOCAL valid only with a register or absolute value" +msgstr "%s£ºÖ¸Áî LOCAL Ö»¶Ô¼Ä´æÆ÷»ò¾ø¶ÔÖµÓÐЧ" + +#: elf64-mmix.c:1505 +#, c-format +msgid "%s: LOCAL directive: Register $%ld is not a local register. First global register is $%ld." +msgstr "%s£ºLOCAL Ö¸Á¼Ä´æÆ÷ $%ld ²»ÊDZ¾µØ¼Ä´æÆ÷¡£ µÚÒ»¸öÈ«¾Ö¼Ä´æÆ÷ÊÇ $%ld¡£" + +#: elf64-mmix.c:1965 +#, c-format +msgid "%s: Error: multiple definition of `%s'; start of %s is set in a earlier linked file\n" +msgstr "%s£º´íÎó£ºÖظ´¶¨Òå¡°%s¡±£»%s µÄÆðµãÔÚ´ËǰÁ¬½ÓµÄÎļþÖÐÒÑÉ趨\n" + +#: elf64-mmix.c:2024 +msgid "Register section has contents\n" +msgstr "¼Ä´æÆ÷½ÚÓÐÄÚÈÝ\n" + +#: elf64-mmix.c:2186 +#, c-format +msgid "" +"Internal inconsistency: remaining %u != max %u.\n" +" Please report this bug." +msgstr "" +"ÄÚ²¿²»Ò»Ö£ºÊ£Óà %u != ×î´ó %u¡£\n" +" Ç뱨¸æ¸Ã bug¡£" + +#: elf64-ppc.c:1669 libbfd.c:1435 +#, c-format +msgid "%s: compiled for a big endian system and target is little endian" +msgstr "%s£ºÎª´ó¶Ëϵͳ±àÒ뵫Ŀ±êƽ̨ÊÇС¶ËµÄ" + +#: elf64-ppc.c:1671 libbfd.c:1437 +#, c-format +msgid "%s: compiled for a little endian system and target is big endian" +msgstr "%s£ºÎªÐ¡¶Ëϵͳ±àÒ뵫Ŀ±êƽ̨ÊÇ´ó¶ËµÄ" + +#: elf64-ppc.c:3610 +#, c-format +msgid "%s: unexpected reloc type %u in .opd section" +msgstr "%s£º.opd ½ÚÖÐÒâÍâµÄÖØ¶¨Î»ÀàÐÍ %u" + +#: elf64-ppc.c:3630 +#, c-format +msgid "%s: .opd is not a regular array of opd entries" +msgstr "%s£º.opd ²»ÊÇ opd ÌõÄ¿µÄÆÕͨÊý×é" + +#: elf64-ppc.c:3672 +#, c-format +msgid "%s: undefined sym `%s' in .opd section" +msgstr "%s£º.opd ½ÚÖÐ䶨ÒåµÄ¡°%s¡±" + +#: elf64-ppc.c:4397 +#, c-format +msgid "can't find branch stub `%s'" +msgstr "" + +#: elf64-ppc.c:4436 elf64-ppc.c:4501 +#, c-format +msgid "linkage table error against `%s'" +msgstr "" + +#: elf64-ppc.c:4573 +#, c-format +msgid "can't build branch stub `%s'" +msgstr "" + +#: elf64-ppc.c:5179 +msgid "stubs don't match calculated size" +msgstr "" + +#: elf64-ppc.c:5828 +#, c-format +msgid "%s: Relocation %s is not supported for symbol %s." +msgstr "%s£ºÖض¨Î» %s ²»Ö§³Ö·ûºÅ %s¡£" + +#: elf64-ppc.c:5872 +#, c-format +msgid "%s: error: relocation %s not a multiple of 4" +msgstr "%s£º´íÎó£ºÖض¨Î» %s ²»ÊÇ 4 µÄ±¶Êý" + +#: elf64-sparc.c:1280 +#, c-format +msgid "%s: check_relocs: unhandled reloc type %d" +msgstr "%s£ºcheck_relocs£ºÎ´´¦ÀíµÄÖØ¶¨Î»ÀàÐÍ %d" + +#: elf64-sparc.c:1317 +#, c-format +msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER" +msgstr "%s£ºÖ»ÓмĴæÆ÷ %%g[2367] ¿ÉÒÔÓà STT_REGISTER À´ÉùÃ÷" + +#: elf64-sparc.c:1337 +#, c-format +msgid "Register %%g%d used incompatibly: %s in %s, previously %s in %s" +msgstr "²»¼æÈݵØÊ¹ÓüĴæÆ÷ %%g%1$d£ºÔÚ %3$s ÖÐΪ %2$s£¬ÔÚÇ°ÃæµÄ %5$s ÖÐΪ %4$s" + +#: elf64-sparc.c:1360 +#, c-format +msgid "Symbol `%s' has differing types: REGISTER in %s, previously %s in %s" +msgstr "·ûºÅ¡°%1$s¡±µÄÀàÐͲ»Í¬£º%2$s ÖÐΪ¼Ä´æÆ÷£¬ÔÚÇ°ÃæµÄ %4$s ÖÐΪ %3$s" + +#: elf64-sparc.c:1406 +#, c-format +msgid "Symbol `%s' has differing types: %s in %s, previously REGISTER in %s" +msgstr "" + +#: elf64-sparc.c:2970 +#, c-format +msgid "%s: linking UltraSPARC specific with HAL specific code" +msgstr "" + +#: elfcode.h:1198 +#, c-format +msgid "%s: version count (%ld) does not match symbol count (%ld)" +msgstr "%s£º°æ±¾¼ÆÊý (%ld) ÎÞ·¨Æ¥Åä·ûºÅ¼ÆÊý (%ld)" + +#: elflink.c:440 +#, c-format +msgid "%s: Section %s is too large to add hole of %ld bytes" +msgstr "" + +#: elflink.h:1090 +#, c-format +msgid "%s: warning: unexpected redefinition of `%s'" +msgstr "%s£º¾¯¸æ£ºÒâÍâµÄÖØÐ¶¨Òå¡°%s¡±" + +#: elflink.h:1727 +#, c-format +msgid "%s: %s: invalid version %u (max %d)" +msgstr "%s£º%s£ºÎÞЧµÄ°æ±¾ %u (×î´ó %d)" + +#: elflink.h:1768 +#, c-format +msgid "%s: %s: invalid needed version %d" +msgstr "%s£º%s£ºÎÞЧµÄ±Ø±¸°æ±¾ %d" + +#: elflink.h:1890 +#, c-format +msgid "Warning: size of symbol `%s' changed from %lu to %lu in %s" +msgstr "¾¯¸æ£º%4$s ÖеķûºÅ¡°%1$s¡±µÄ´óСÓÉ %2$lu ±äΪ %3$lu" + +#: elflink.h:3174 +#, c-format +msgid "%s: .preinit_array section is not allowed in DSO" +msgstr "%s£ºDSO Öв»ÔÊÐí³öÏÖ .preinit_array ½Ú" + +#: elflink.h:4030 +#, c-format +msgid "warning: type and size of dynamic symbol `%s' are not defined" +msgstr "¾¯¸æ£º¶¯Ì¬·ûºÅ¡°%s¡±µÄÀàÐͺʹóС䶨Òå" + +#: elflink.h:4345 +#, c-format +msgid "%s: undefined versioned symbol name %s" +msgstr "%s£ºÎ´¶¨ÒåµÄÓа汾·ûºÅÃû %s" + +#: elflink.h:4611 elflink.h:4619 elflink.h:6508 elflink.h:7600 +msgid "Error: out of memory" +msgstr "´íÎó£ºÃ»ÓÐÄÚ´æ" + +#: elflink.h:4781 +msgid "Not enough memory to sort relocations" +msgstr "ûÓÐ×ã¹»µÄÄÚ´æ½øÐÐÖØ¶¨Î»ÅÅÐò" + +#: elflink.h:5682 elflink.h:5725 +#, c-format +msgid "%s: could not find output section %s" +msgstr "%s£ºÎÞ·¨ÕÒµ½Êä³ö½Ú %s" + +#: elflink.h:5688 +#, c-format +msgid "warning: %s section has zero size" +msgstr "¾¯¸æ£º%s ½ÚµÄ´óСΪÁã" + +#: elflink.h:6275 +#, c-format +msgid "%s: could not find output section %s for input section %s" +msgstr "%1$s£ºÎÞ·¨ÎªÊäÈë½Ú %3$s ÕÒµ½Êä³ö½Ú %2$s" + +#: elflink.h:6486 +#, c-format +msgid "%s: relocation size mismatch in %s section %s" +msgstr "" + +#: elflink.h:6849 +msgid "warning: relocation against removed section; zeroing" +msgstr "¾¯¸æ£º¹ØÓÚÒÑɾ³ýµÄ½ÚµÄÖØ¶¨Î»£»ÕýÔÚÇåÁã" + +#: elflink.h:6879 +msgid "warning: relocation against removed section" +msgstr "¾¯¸æ£º¹ØÓÚÒÑɾ³ýµÄ½ÚµÄÖØ¶¨Î»" + +#: elflink.h:6892 +#, c-format +msgid "local symbols in discarded section %s" +msgstr "ÒѽûÓÃµÄ½Ú %s Öеı¾µØ·ûºÅ" + +#: elfxx-mips.c:734 +msgid "static procedure (no name)" +msgstr "¾²Ì¬¹ý³Ì (ÎÞÃû³Æ)" + +#: elfxx-mips.c:1601 +msgid "not enough GOT space for local GOT entries" +msgstr "ûÓÐ×ã¹»µÄ GOT ¿Õ¼äÓÃÓÚ GOT ÌõÄ¿" + +#: elfxx-mips.c:2750 +#, c-format +msgid "%s: %s+0x%lx: jump to stub routine which is not jal" +msgstr "" + +#: elfxx-mips.c:4270 +#, c-format +msgid "%s: Malformed reloc detected for section %s" +msgstr "" + +#: elfxx-mips.c:4348 +#, c-format +msgid "%s: CALL16 reloc at 0x%lx not against global symbol" +msgstr "" + +#: elfxx-mips.c:7301 +#, c-format +msgid "%s: illegal section name `%s'" +msgstr "%s£º·Ç·¨µÄ½ÚÃû¡°%s¡±" + +#: elfxx-mips.c:7615 +#, c-format +msgid "%s: linking PIC files with non-PIC files" +msgstr "%s£º½« PIC Îļþͬ·Ç-PIC ÎļþÁ¬½Ó" + +#: elfxx-mips.c:7625 +#, c-format +msgid "%s: linking abicalls files with non-abicalls files" +msgstr "" + +#: elfxx-mips.c:7654 +#, c-format +msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)" +msgstr "%s£ºISA (-mips%d) Í¬Ç°ÃæµÄÄ£¿é(-mips%d)²»Æ¥Åä" + +#: elfxx-mips.c:7676 +#, c-format +msgid "%s: ISA mismatch (%d) with previous modules (%d)" +msgstr "%s£ºISA (%d) Í¬Ç°ÃæµÄÄ£¿é (%d) ²»Æ¥Åä" + +#: elfxx-mips.c:7699 +#, c-format +msgid "%s: ABI mismatch: linking %s module with previous %s modules" +msgstr "%s£ºABI ²»Æ¥Å䣺ÕýÔÚ½«Ä£¿é %s ͬǰһ¸öÄ£¿é %s ½øÐÐÁ¬½Ó" + +#: elfxx-mips.c:7759 +msgid " [abi=O32]" +msgstr " [abi=O32]" + +#: elfxx-mips.c:7761 +msgid " [abi=O64]" +msgstr " [abi=O64]" + +#: elfxx-mips.c:7763 +msgid " [abi=EABI32]" +msgstr " [abi=EABI32]" + +#: elfxx-mips.c:7765 +msgid " [abi=EABI64]" +msgstr " [abi=EABI64]" + +#: elfxx-mips.c:7767 +msgid " [abi unknown]" +msgstr " [abi δ֪]" + +#: elfxx-mips.c:7769 +msgid " [abi=N32]" +msgstr " [abi=N32]" + +#: elfxx-mips.c:7771 +msgid " [abi=64]" +msgstr " [abi=64]" + +#: elfxx-mips.c:7773 +msgid " [no abi set]" +msgstr "" + +#: elfxx-mips.c:7776 +msgid " [mips1]" +msgstr " [mips1]" + +#: elfxx-mips.c:7778 +msgid " [mips2]" +msgstr " [mips2]" + +#: elfxx-mips.c:7780 +msgid " [mips3]" +msgstr " [mips3]" + +#: elfxx-mips.c:7782 +msgid " [mips4]" +msgstr " [mips4]" + +#: elfxx-mips.c:7784 +msgid " [mips5]" +msgstr " [mips5]" + +#: elfxx-mips.c:7786 +msgid " [mips32]" +msgstr " [mips32]" + +#: elfxx-mips.c:7788 +msgid " [mips64]" +msgstr " [mips64]" + +#: elfxx-mips.c:7790 +msgid " [unknown ISA]" +msgstr " [δ֪µÄ ISA]" + +#: elfxx-mips.c:7793 +msgid " [mdmx]" +msgstr " [mdmx]" + +#: elfxx-mips.c:7796 +msgid " [mips16]" +msgstr " [mips16]" + +#: elfxx-mips.c:7799 +msgid " [32bitmode]" +msgstr " [32λģʽ]" + +#: elfxx-mips.c:7801 +msgid " [not 32bitmode]" +msgstr " [·Ç 32λģʽ]" + +#: i386linux.c:458 m68klinux.c:462 sparclinux.c:459 +#, c-format +msgid "Output file requires shared library `%s'\n" +msgstr "Êä³öÎļþÐèÒª¹²Ïí¿â¡°%s¡±\n" + +#: i386linux.c:466 m68klinux.c:470 sparclinux.c:467 +#, c-format +msgid "Output file requires shared library `%s.so.%s'\n" +msgstr "Êä³öÎļþÐèÒª¹²Ïí¿â¡°%s.so.%s¡±\n" + +#: i386linux.c:655 i386linux.c:705 m68klinux.c:662 m68klinux.c:710 +#: sparclinux.c:657 sparclinux.c:707 +#, c-format +msgid "Symbol %s not defined for fixups\n" +msgstr "" + +#: i386linux.c:729 m68klinux.c:734 sparclinux.c:731 +msgid "Warning: fixup count mismatch\n" +msgstr "" + +#: ieee.c:235 +#, c-format +msgid "%s: string too long (%d chars, max 65535)" +msgstr "%s£º×Ö·û´®¹ý³¤ (%d ×Ö·û£¬×î´ó 65535)" + +#: ieee.c:365 +#, c-format +msgid "%s: unrecognized symbol `%s' flags 0x%x" +msgstr "%s£ºÎÞ·¨Ê¶±ðµÄ¡°%s¡±±êÖ¾ 0x%x" + +#: ieee.c:877 +#, c-format +msgid "%s: unimplemented ATI record %u for symbol %u" +msgstr "" + +#: ieee.c:902 +#, c-format +msgid "%s: unexpected ATN type %d in external part" +msgstr "" + +#: ieee.c:924 +#, c-format +msgid "%s: unexpected type after ATN" +msgstr "%s£ºATN Ö®ºó³öÏÖÒâÍâµÄÀàÐÍ" + +#: ihex.c:258 +#, c-format +msgid "%s:%d: unexpected character `%s' in Intel Hex file\n" +msgstr "%s£º%d£ºIntel Ê®Áù½øÖÆÎļþÖеÄÒâÍâ×Ö·û¡°%s\n" + +#: ihex.c:366 +#, c-format +msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)" +msgstr "%s£º%u£ºIntel Ê®Áù½øÖÆÎļþÖеÄУÑéºÍ´íÎó (ӦΪ %u¡¢ÊµÎª %u)" + +#: ihex.c:420 +#, c-format +msgid "%s:%u: bad extended address record length in Intel Hex file" +msgstr "" + +#: ihex.c:437 +#, c-format +msgid "%s:%u: bad extended start address length in Intel Hex file" +msgstr "" + +#: ihex.c:454 +#, c-format +msgid "%s:%u: bad extended linear address record length in Intel Hex file" +msgstr "" + +#: ihex.c:471 +#, c-format +msgid "%s:%u: bad extended linear start address length in Intel Hex file" +msgstr "" + +#: ihex.c:488 +#, c-format +msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n" +msgstr "" + +#: ihex.c:607 +#, c-format +msgid "%s: internal error in ihex_read_section" +msgstr "" + +#: ihex.c:642 +#, c-format +msgid "%s: bad section length in ihex_read_section" +msgstr "" + +#: ihex.c:860 +#, c-format +msgid "%s: address 0x%s out of range for Intel Hex file" +msgstr "" + +#: libbfd.c:492 +#, c-format +msgid "not mapping: data=%lx mapped=%d\n" +msgstr "" + +#: libbfd.c:495 +msgid "not mapping: env var not set\n" +msgstr "" + +#: libbfd.c:1466 +#, c-format +msgid "Deprecated %s called at %s line %d in %s\n" +msgstr "" + +#: libbfd.c:1469 +#, c-format +msgid "Deprecated %s called\n" +msgstr "" + +#: linker.c:1873 +#, c-format +msgid "%s: indirect symbol `%s' to `%s' is a loop" +msgstr "" + +#: linker.c:2776 +#, c-format +msgid "Attempt to do relocateable link with %s input and %s output" +msgstr "" + +#: merge.c:892 +#, c-format +msgid "%s: access beyond end of merged section (%ld + %ld)" +msgstr "" + +#: mmo.c:460 +#, c-format +msgid "%s: No core to allocate section name %s\n" +msgstr "" + +#: mmo.c:536 +#, c-format +msgid "%s: No core to allocate a symbol %d bytes long\n" +msgstr "" + +#: mmo.c:1245 +#, c-format +msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n" +msgstr "" + +#: mmo.c:1391 +#, c-format +msgid "%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name starting with `%s'\n" +msgstr "" + +#: mmo.c:1633 +#, c-format +msgid "%s: invalid mmo file: unsupported lopcode `%d'\n" +msgstr "" + +#: mmo.c:1643 +#, c-format +msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n" +msgstr "" + +#: mmo.c:1679 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n" +msgstr "" + +#: mmo.c:1725 +#, c-format +msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n" +msgstr "" + +#: mmo.c:1764 +#, c-format +msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n" +msgstr "" + +#: mmo.c:1773 +#, c-format +msgid "%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n" +msgstr "" + +#: mmo.c:1796 +#, c-format +msgid "%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d for lop_fixrx\n" +msgstr "" + +#: mmo.c:1819 +#, c-format +msgid "%s: cannot allocate file name for file number %d, %d bytes\n" +msgstr "" + +#: mmo.c:1839 +#, c-format +msgid "%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n" +msgstr "" + +#: mmo.c:1852 +#, c-format +msgid "%s: invalid mmo file: file name for number %d was not specified before use\n" +msgstr "" + +#: mmo.c:1958 +#, c-format +msgid "%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n" +msgstr "" + +#: mmo.c:1994 +#, c-format +msgid "%s: invalid mmo file: lop_end not last item in file\n" +msgstr "" + +#: mmo.c:2007 +#, c-format +msgid "%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras to the preceding lop_stab (%ld)\n" +msgstr "" + +#: mmo.c:2670 +#, c-format +msgid "%s: invalid symbol table: duplicate symbol `%s'\n" +msgstr "" + +#: mmo.c:2921 +#, c-format +msgid "%s: Bad symbol definition: `Main' set to %s rather than the start address %s\n" +msgstr "" + +#: mmo.c:3011 +#, c-format +msgid "%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: %d. Only `Main' will be emitted.\n" +msgstr "" + +#: mmo.c:3056 +#, c-format +msgid "%s: internal error, symbol table changed size from %d to %d words\n" +msgstr "" + +#: mmo.c:3111 +#, c-format +msgid "%s: internal error, internal register section %s had contents\n" +msgstr "" + +#: mmo.c:3163 +#, c-format +msgid "%s: no initialized registers; section length 0\n" +msgstr "" + +#: mmo.c:3169 +#, c-format +msgid "%s: too many initialized registers; section length %ld\n" +msgstr "" + +#: mmo.c:3174 +#, c-format +msgid "%s: invalid start address for initialized registers of length %ld: 0x%lx%08lx\n" +msgstr "" + +#: oasys.c:1029 +#, c-format +msgid "%s: can not represent section `%s' in oasys" +msgstr "" + +#: osf-core.c:132 +#, c-format +msgid "Unhandled OSF/1 core file section type %d\n" +msgstr "" + +#: pe-mips.c:658 +#, c-format +msgid "%s: `ld -r' not supported with PE MIPS objects\n" +msgstr "" + +#. OK, at this point the following variables are set up: +#. src = VMA of the memory we're fixing up +#. mem = pointer to memory we're fixing up +#. val = VMA of what we need to refer to +#. +#: pe-mips.c:794 +#, c-format +msgid "%s: unimplemented %s\n" +msgstr "%s£ºÎ´ÊµÏÖµÄ %s\n" + +#: pe-mips.c:820 +#, c-format +msgid "%s: jump too far away\n" +msgstr "%s£ºÌø×ª¹ýÔ¶\n" + +#: pe-mips.c:847 +#, c-format +msgid "%s: bad pair/reflo after refhi\n" +msgstr "" + +#. XXX code yet to be written. +#: peicode.h:785 +#, c-format +msgid "%s: Unhandled import type; %x" +msgstr "%s£ºÎ´´¦ÀíµÄµ¼ÈëÀàÐÍ£»%x" + +#: peicode.h:790 +#, c-format +msgid "%s: Unrecognised import type; %x" +msgstr "%s£ºÎ´Ê¶±ðµÄµ¼ÈëÀàÐÍ£»%x" + +#: peicode.h:804 +#, c-format +msgid "%s: Unrecognised import name type; %x" +msgstr "%s£ºÎ´Ê¶±ðµÄµ¼ÈëÃû×ÖÀàÐÍ£»%x" + +#: peicode.h:1162 +#, c-format +msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive" +msgstr "" + +#: peicode.h:1174 +#, c-format +msgid "%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive" +msgstr "" + +#: peicode.h:1191 +#, c-format +msgid "%s: size field is zero in Import Library Format header" +msgstr "" + +#: peicode.h:1219 +#, c-format +msgid "%s: string not null terminated in ILF object file." +msgstr "" + +#: ppcboot.c:416 +msgid "" +"\n" +"ppcboot header:\n" +msgstr "" + +#: ppcboot.c:417 +#, c-format +msgid "Entry offset = 0x%.8lx (%ld)\n" +msgstr "ÌõÄ¿Æ«ÒÆÁ¿ = 0x%.8lx (%ld)\n" + +#: ppcboot.c:418 +#, c-format +msgid "Length = 0x%.8lx (%ld)\n" +msgstr "³¤¶È = 0x%.8lx (%ld)\n" + +#: ppcboot.c:421 +#, c-format +msgid "Flag field = 0x%.2x\n" +msgstr "±êÖ¾Óò = 0x%.2x\n" + +#: ppcboot.c:427 +#, c-format +msgid "Partition name = \"%s\"\n" +msgstr "·ÖÇøÃû = \"%s\"\n" + +#: ppcboot.c:446 +#, c-format +msgid "" +"\n" +"Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "" +"\n" +"·ÖÇø[%d] Æðµã = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:452 +#, c-format +msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" +msgstr "·ÖÇø[%d] ÖÕµã = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" + +#: ppcboot.c:458 +#, c-format +msgid "Partition[%d] sector = 0x%.8lx (%ld)\n" +msgstr "·ÖÇø[%d] ÉÈÇø = 0x%.8lx (%ld)\n" + +#: ppcboot.c:459 +#, c-format +msgid "Partition[%d] length = 0x%.8lx (%ld)\n" +msgstr "·ÖÇø[%d] ³¤¶È = 0x%.8lx (%ld)\n" + +#: som.c:5398 +msgid "som_sizeof_headers unimplemented" +msgstr "" + +#: srec.c:301 +#, c-format +msgid "%s:%d: Unexpected character `%s' in S-record file\n" +msgstr "" + +#: stabs.c:319 +#, c-format +msgid "%s(%s+0x%lx): Stabs entry has invalid string index." +msgstr "" + +#: syms.c:1044 +msgid "Unsupported .stab relocation" +msgstr "²»Ö§³ÖµÄ .stab ÖØ¶¨Î»" + +#: vms-gsd.c:356 +#, c-format +msgid "bfd_make_section (%s) failed" +msgstr "" + +#: vms-gsd.c:371 +#, c-format +msgid "bfd_set_section_flags (%s, %x) failed" +msgstr "" + +#: vms-gsd.c:407 +#, c-format +msgid "Size mismatch section %s=%lx, %s=%lx" +msgstr "" + +#: vms-gsd.c:702 +#, c-format +msgid "unknown gsd/egsd subtype %d" +msgstr "" + +#: vms-hdr.c:406 +msgid "Object module NOT error-free !\n" +msgstr "" + +#: vms-misc.c:543 +#, c-format +msgid "Stack overflow (%d) in _bfd_vms_push" +msgstr "" + +#: vms-misc.c:561 +msgid "Stack underflow in _bfd_vms_pop" +msgstr "" + +#: vms-misc.c:919 +msgid "_bfd_vms_output_counted called with zero bytes" +msgstr "" + +#: vms-misc.c:924 +msgid "_bfd_vms_output_counted called with too many bytes" +msgstr "" + +#: vms-misc.c:1055 +#, c-format +msgid "Symbol %s replaced by %s\n" +msgstr "" + +#: vms-misc.c:1117 +#, c-format +msgid "failed to enter %s" +msgstr "" + +#: vms-tir.c:81 +msgid "No Mem !" +msgstr "" + +#: vms-tir.c:362 +#, c-format +msgid "bad section index in %s" +msgstr "%s ÖеĴíÎó½ÚË÷Òý" + +#: vms-tir.c:375 +#, c-format +msgid "unsupported STA cmd %s" +msgstr "²»Ö§³ÖµÄ STA ÃüÁî %s" + +#: vms-tir.c:380 vms-tir.c:1240 +#, c-format +msgid "reserved STA cmd %d" +msgstr "" + +#: vms-tir.c:491 vms-tir.c:514 +#, c-format +msgid "%s: no symbol \"%s\"" +msgstr "" + +#. unsigned shift +#. rotate +#. Redefine symbol to current location. +#. Define a literal. +#: vms-tir.c:581 vms-tir.c:693 vms-tir.c:803 vms-tir.c:821 vms-tir.c:829 +#: vms-tir.c:838 vms-tir.c:1563 +#, c-format +msgid "%s: not supported" +msgstr "%s£º²»Ö§³Ö" + +#: vms-tir.c:586 vms-tir.c:1418 +#, c-format +msgid "%s: not implemented" +msgstr "%s£ºÎ´ÊµÏÖ" + +#: vms-tir.c:590 vms-tir.c:1422 +#, c-format +msgid "reserved STO cmd %d" +msgstr "±£ÁôµÄ STO ÃüÁî %d" + +#: vms-tir.c:708 vms-tir.c:1568 +#, c-format +msgid "reserved OPR cmd %d" +msgstr "±£ÁôµÄ OPR ÃüÁî %d" + +#: vms-tir.c:776 vms-tir.c:1632 +#, c-format +msgid "reserved CTL cmd %d" +msgstr "±£ÁôµÄ CTL ÃüÁî %d" + +#. stack byte from image +#. arg: none. +#: vms-tir.c:1148 +msgid "stack-from-image not implemented" +msgstr "δʵÏÖ stack-from-image" + +#: vms-tir.c:1166 +msgid "stack-entry-mask not fully implemented" +msgstr "ÉÐδÍêȫʵÏÖ stack-entry-mask" + +#. compare procedure argument +#. arg: cs symbol name +#. by argument index +#. da argument descriptor +#. +#. compare argument descriptor with symbol argument (ARG$V_PASSMECH) +#. and stack TRUE (args match) or FALSE (args dont match) value. +#: vms-tir.c:1180 +msgid "PASSMECH not fully implemented" +msgstr "ÉÐδÍêȫʵÏÖ PASSMECH" + +#: vms-tir.c:1199 +msgid "stack-local-symbol not fully implemented" +msgstr "ÉÐδÍêȫʵÏÖ stack-local-symbol" + +#: vms-tir.c:1212 +msgid "stack-literal not fully implemented" +msgstr "ÉÐδÍêȫʵÏÖ stack-literal" + +#: vms-tir.c:1233 +msgid "stack-local-symbol-entry-point-mask not fully implemented" +msgstr "ÉÐδÍêȫʵÏÖ stack-local-symbol-entry-point-mask" + +#: vms-tir.c:1510 vms-tir.c:1522 vms-tir.c:1534 vms-tir.c:1546 vms-tir.c:1611 +#: vms-tir.c:1619 vms-tir.c:1627 +#, c-format +msgid "%s: not fully implemented" +msgstr "%s£ºÉÐδÍêȫʵÏÖ" + +#: vms-tir.c:1684 +#, c-format +msgid "obj code %d not found" +msgstr "" + +#: vms-tir.c:2019 +#, c-format +msgid "SEC_RELOC with no relocs in section %s" +msgstr "" + +#: vms-tir.c:2307 +#, c-format +msgid "Unhandled relocation %s" +msgstr "δ´¦ÀíµÄÖØ¶¨Î» %s" + +#: xcofflink.c:1243 +#, c-format +msgid "%s: `%s' has line numbers but no enclosing section" +msgstr "" + +#: xcofflink.c:1296 +#, c-format +msgid "%s: class %d symbol `%s' has no aux entries" +msgstr "" + +#: xcofflink.c:1319 +#, c-format +msgid "%s: symbol `%s' has unrecognized csect type %d" +msgstr "" + +#: xcofflink.c:1331 +#, c-format +msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d" +msgstr "" + +#: xcofflink.c:1367 +#, c-format +msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d" +msgstr "" + +#: xcofflink.c:1519 +#, c-format +msgid "%s: csect `%s' not in enclosing section" +msgstr "" + +#: xcofflink.c:1626 +#, c-format +msgid "%s: misplaced XTY_LD `%s'" +msgstr "" + +#: xcofflink.c:1957 +#, c-format +msgid "%s: reloc %s:%d not in csect" +msgstr "" + +#: xcofflink.c:2092 +#, c-format +msgid "%s: XCOFF shared object when not producing XCOFF output" +msgstr "" + +#: xcofflink.c:2113 +#, c-format +msgid "%s: dynamic object with no .loader section" +msgstr "" + +#: xcofflink.c:2758 +#, c-format +msgid "%s: no such symbol" +msgstr "" + +#: xcofflink.c:2891 +msgid "error: undefined symbol __rtinit" +msgstr "´íÎó£ºÎ´¶¨ÒåµÄ·ûºÅ __rtinit" + +#: xcofflink.c:3453 +#, c-format +msgid "warning: attempt to export undefined symbol `%s'" +msgstr "¾¯¸æ£ºÊÔͼµ¼³ö䶨ÒåµÄ·ûºÅ¡°%s¡±" + +#: xcofflink.c:4447 +#, c-format +msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling" +msgstr "" + +#: xcofflink.c:5287 xcofflink.c:5756 xcofflink.c:5818 xcofflink.c:6119 +#, c-format +msgid "%s: loader reloc in unrecognized section `%s'" +msgstr "" + +#: xcofflink.c:5309 xcofflink.c:6130 +#, c-format +msgid "%s: `%s' in loader reloc but not loader sym" +msgstr "" + +#: xcofflink.c:5324 +#, c-format +msgid "%s: loader reloc in read-only section %s" +msgstr "" + +#: elf32-ia64.c:2222 elf64-ia64.c:2222 +msgid "@pltoff reloc against local symbol" +msgstr "" + +#: elf32-ia64.c:3562 elf64-ia64.c:3562 +#, c-format +msgid "%s: short data segment overflowed (0x%lx >= 0x400000)" +msgstr "" + +#: elf32-ia64.c:3573 elf64-ia64.c:3573 +#, c-format +msgid "%s: __gp does not cover short data segment" +msgstr "" + +#: elf32-ia64.c:3858 elf64-ia64.c:3858 +#, c-format +msgid "%s: linking non-pic code in a shared library" +msgstr "" + +#: elf32-ia64.c:3891 elf64-ia64.c:3891 +#, c-format +msgid "%s: @gprel relocation against dynamic symbol %s" +msgstr "" + +#: elf32-ia64.c:4030 elf64-ia64.c:4030 +#, c-format +msgid "%s: dynamic relocation against speculation fixup" +msgstr "" + +#: elf32-ia64.c:4038 elf64-ia64.c:4038 +#, c-format +msgid "%s: speculation fixup against undefined weak symbol" +msgstr "" + +#: elf32-ia64.c:4271 elf64-ia64.c:4271 +msgid "unsupported reloc" +msgstr "²»Ö§³ÖµÄÖØ¶¨Î»" + +#: elf32-ia64.c:4551 elf64-ia64.c:4551 +#, c-format +msgid "%s: linking trap-on-NULL-dereference with non-trapping files" +msgstr "" + +#: elf32-ia64.c:4560 elf64-ia64.c:4560 +#, c-format +msgid "%s: linking big-endian files with little-endian files" +msgstr "%s£º½«´ó¶ËÎļþͬС¶ËÎļþ" + +#: elf32-ia64.c:4569 elf64-ia64.c:4569 +#, c-format +msgid "%s: linking 64-bit files with 32-bit files" +msgstr "%s£º½« 64-λÎļþͬ 32-λÎļþÁ¬½Ó" + +#: elf32-ia64.c:4578 elf64-ia64.c:4578 +#, c-format +msgid "%s: linking constant-gp files with non-constant-gp files" +msgstr "" + +#: elf32-ia64.c:4588 elf64-ia64.c:4588 +#, c-format +msgid "%s: linking auto-pic files with non-auto-pic files" +msgstr "" + +#: peigen.c:962 pepigen.c:962 +#, c-format +msgid "%s: line number overflow: 0x%lx > 0xffff" +msgstr "%s£ºÐкÅÒç³ö£º0x%lx > 0xffff" + +#: peigen.c:979 pepigen.c:979 +#, c-format +msgid "%s: reloc overflow 1: 0x%lx > 0xffff" +msgstr "" + +#: peigen.c:993 pepigen.c:993 +msgid "Export Directory [.edata (or where ever we found it)]" +msgstr "µ¼³öĿ¼ [.edata (»òÕ߯äËüÈκÎÄÜÕÒµ½ËüµÄµØ·½)]" + +#: peigen.c:994 pepigen.c:994 +msgid "Import Directory [parts of .idata]" +msgstr "µ¼ÈëĿ¼ [.idata µÄÒ»²¿·Ö]" + +#: peigen.c:995 pepigen.c:995 +msgid "Resource Directory [.rsrc]" +msgstr "×ÊԴĿ¼ [.rsrc]" + +#: peigen.c:996 pepigen.c:996 +msgid "Exception Directory [.pdata]" +msgstr "" + +#: peigen.c:997 pepigen.c:997 +msgid "Security Directory" +msgstr "°²È«Ä¿Â¼" + +#: peigen.c:998 pepigen.c:998 +msgid "Base Relocation Directory [.reloc]" +msgstr "" + +#: peigen.c:999 pepigen.c:999 +msgid "Debug Directory" +msgstr "µ÷ÊÔĿ¼" + +#: peigen.c:1000 pepigen.c:1000 +msgid "Description Directory" +msgstr "ÃèÊöĿ¼" + +#: peigen.c:1001 pepigen.c:1001 +msgid "Special Directory" +msgstr "ÌØÊâĿ¼" + +#: peigen.c:1002 pepigen.c:1002 +msgid "Thread Storage Directory [.tls]" +msgstr "Ï̴߳洢Ŀ¼ [.tls]" + +#: peigen.c:1003 pepigen.c:1003 +msgid "Load Configuration Directory" +msgstr "×°ÈëÅäÖÃĿ¼" + +#: peigen.c:1004 pepigen.c:1004 +msgid "Bound Import Directory" +msgstr "" + +#: peigen.c:1005 pepigen.c:1005 +msgid "Import Address Table Directory" +msgstr "µ¼ÈëµØÖ·±íĿ¼" + +#: peigen.c:1006 pepigen.c:1006 +msgid "Delay Import Directory" +msgstr "ÑÓ³Ùµ¼ÈëĿ¼" + +#: peigen.c:1007 peigen.c:1008 pepigen.c:1007 pepigen.c:1008 +msgid "Reserved" +msgstr "±£Áô" + +#: peigen.c:1071 pepigen.c:1071 +msgid "" +"\n" +"There is an import table, but the section containing it could not be found\n" +msgstr "" + +#: peigen.c:1076 pepigen.c:1076 +#, c-format +msgid "" +"\n" +"There is an import table in %s at 0x%lx\n" +msgstr "" + +#: peigen.c:1113 pepigen.c:1113 +#, c-format +msgid "" +"\n" +"Function descriptor located at the start address: %04lx\n" +msgstr "" + +#: peigen.c:1116 pepigen.c:1116 +#, c-format +msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n" +msgstr "" + +#: peigen.c:1122 pepigen.c:1122 +msgid "" +"\n" +"No reldata section! Function descriptor not decoded.\n" +msgstr "" + +#: peigen.c:1127 pepigen.c:1127 +#, c-format +msgid "" +"\n" +"The Import Tables (interpreted %s section contents)\n" +msgstr "" + +#: peigen.c:1130 pepigen.c:1130 +msgid "" +" vma: Hint Time Forward DLL First\n" +" Table Stamp Chain Name Thunk\n" +msgstr "" + +#: peigen.c:1181 pepigen.c:1181 +#, c-format +msgid "" +"\n" +"\tDLL Name: %s\n" +msgstr "" +"\n" +"\tDLL Ãû³Æ£º%s\n" + +#: peigen.c:1192 pepigen.c:1192 +msgid "\tvma: Hint/Ord Member-Name Bound-To\n" +msgstr "" + +#: peigen.c:1217 pepigen.c:1217 +msgid "" +"\n" +"There is a first thunk, but the section containing it could not be found\n" +msgstr "" + +#: peigen.c:1357 pepigen.c:1357 +msgid "" +"\n" +"There is an export table, but the section containing it could not be found\n" +msgstr "" + +#: peigen.c:1362 pepigen.c:1362 +#, c-format +msgid "" +"\n" +"There is an export table in %s at 0x%lx\n" +msgstr "" +"\n" +"%s Öеĵ¼³ö±íλÓÚ 0x%lx\n" + +#: peigen.c:1393 pepigen.c:1393 +#, c-format +msgid "" +"\n" +"The Export Tables (interpreted %s section contents)\n" +"\n" +msgstr "" + +#: peigen.c:1397 pepigen.c:1397 +#, c-format +msgid "Export Flags \t\t\t%lx\n" +msgstr "µ¼³ö±êÖ¾ \t\t\t%lx\n" + +#: peigen.c:1400 pepigen.c:1400 +#, c-format +msgid "Time/Date stamp \t\t%lx\n" +msgstr "ÈÕÆÚ/ʱ¼ä´Á \t\t%lx\n" + +#: peigen.c:1403 pepigen.c:1403 +#, c-format +msgid "Major/Minor \t\t\t%d/%d\n" +msgstr "" + +#: peigen.c:1406 pepigen.c:1406 +msgid "Name \t\t\t\t" +msgstr "Ãû³Æ \t\t\t\t" + +#: peigen.c:1412 pepigen.c:1412 +#, c-format +msgid "Ordinal Base \t\t\t%ld\n" +msgstr "" + +#: peigen.c:1415 pepigen.c:1415 +msgid "Number in:\n" +msgstr "" + +#: peigen.c:1418 pepigen.c:1418 +#, c-format +msgid "\tExport Address Table \t\t%08lx\n" +msgstr "" + +#: peigen.c:1422 pepigen.c:1422 +#, c-format +msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n" +msgstr "" + +#: peigen.c:1425 pepigen.c:1425 +msgid "Table Addresses\n" +msgstr "±íµØÖ·\n" + +#: peigen.c:1428 pepigen.c:1428 +msgid "\tExport Address Table \t\t" +msgstr "\tµ¼³öµØÖ·±í \t\t" + +#: peigen.c:1433 pepigen.c:1433 +msgid "\tName Pointer Table \t\t" +msgstr "\tÃû³ÆÖ¸Õë±í \t\t" + +#: peigen.c:1438 pepigen.c:1438 +msgid "\tOrdinal Table \t\t\t" +msgstr "" + +#: peigen.c:1453 pepigen.c:1453 +#, c-format +msgid "" +"\n" +"Export Address Table -- Ordinal Base %ld\n" +msgstr "" + +#: peigen.c:1472 pepigen.c:1472 +msgid "Forwarder RVA" +msgstr "" + +#: peigen.c:1483 pepigen.c:1483 +msgid "Export RVA" +msgstr "µ¼³ö RVA" + +#: peigen.c:1490 pepigen.c:1490 +msgid "" +"\n" +"[Ordinal/Name Pointer] Table\n" +msgstr "" + +#: peigen.c:1545 pepigen.c:1545 +#, c-format +msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n" +msgstr "" + +#: peigen.c:1549 pepigen.c:1549 +msgid "" +"\n" +"The Function Table (interpreted .pdata section contents)\n" +msgstr "" + +#: peigen.c:1552 pepigen.c:1552 +msgid " vma:\t\t\tBegin Address End Address Unwind Info\n" +msgstr "" + +#: peigen.c:1554 pepigen.c:1554 +msgid "" +" vma:\t\tBegin End EH EH PrologEnd Exception\n" +" \t\tAddress Address Handler Data Address Mask\n" +msgstr "" + +#: peigen.c:1624 pepigen.c:1624 +msgid " Register save millicode" +msgstr "" + +#: peigen.c:1627 pepigen.c:1627 +msgid " Register restore millicode" +msgstr "" + +#: peigen.c:1630 pepigen.c:1630 +msgid " Glue code sequence" +msgstr "" + +#: peigen.c:1682 pepigen.c:1682 +msgid "" +"\n" +"\n" +"PE File Base Relocations (interpreted .reloc section contents)\n" +msgstr "" + +#: peigen.c:1712 pepigen.c:1712 +#, c-format +msgid "" +"\n" +"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n" +msgstr "" + +#: peigen.c:1725 pepigen.c:1725 +#, c-format +msgid "\treloc %4d offset %4x [%4lx] %s" +msgstr "" + +#. The MS dumpbin program reportedly ands with 0xff0f before +#. printing the characteristics field. Not sure why. No reason to +#. emulate it here. +#: peigen.c:1765 pepigen.c:1765 +#, c-format +msgid "" +"\n" +"Characteristics 0x%x\n" +msgstr "" diff --git a/bfd/riscix.c b/bfd/riscix.c new file mode 100644 index 0000000000000..519514e4cf6d6 --- /dev/null +++ b/bfd/riscix.c @@ -0,0 +1,666 @@ +/* BFD back-end for RISC iX (Acorn, arm) binaries. + Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002 + Free Software Foundation, Inc. + Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +/* RISC iX overloads the MAGIC field to indicate more than just the usual + [ZNO]MAGIC values. Also included are squeezing information and + shared library usage. */ + +/* The following come from the man page. */ +#define SHLIBLEN 60 + +#define MF_IMPURE 00200 +#define MF_SQUEEZED 01000 +#define MF_USES_SL 02000 +#define MF_IS_SL 04000 + +/* Common combinations. */ +#define IMAGIC (MF_IMPURE|ZMAGIC) /* Demand load (impure text) */ +#define SPOMAGIC (MF_USES_SL|OMAGIC) /* OMAGIC with large header */ + /* -- may contain a ref to a */ + /* shared lib required by the */ + /* object. */ +#define SLOMAGIC (MF_IS_SL|OMAGIC) /* A reference to a shared library */ + /* The text portion of the object */ + /* contains "overflow text" from */ + /* the shared library to be linked */ + /* in with an object */ +#define QMAGIC (MF_SQUEEZED|ZMAGIC) /* Sqeezed demand paged. */ + /* NOTE: This interpretation of */ + /* QMAGIC seems to be at variance */ + /* With that used on other */ + /* architectures. */ +#define SPZMAGIC (MF_USES_SL|ZMAGIC) /* program which uses sl */ +#define SPQMAGIC (MF_USES_SL|QMAGIC) /* sqeezed ditto */ +#define SLZMAGIC (MF_IS_SL|ZMAGIC) /* shared lib part of prog */ +#define SLPZMAGIC (MF_USES_SL|SLZMAGIC) /* sl which uses another */ + +#define N_SHARED_LIB(x) ((x).a_info & MF_USES_SL) + +/* Only a pure OMAGIC file has the minimal header */ +#define N_TXTOFF(x) \ + ((x).a_info == OMAGIC \ + ? 32 \ + : (N_MAGIC(x) == ZMAGIC \ + ? TARGET_PAGE_SIZE \ + : 999)) + +#define N_TXTADDR(x) \ + (N_MAGIC(x) != ZMAGIC \ + ? (bfd_vma) 0 /* object file or NMAGIC */ \ + /* Programs with shared libs are loaded at the first page after all the \ + text segments of the shared library programs. Without looking this \ + up we can't know exactly what the address will be. A reasonable guess \ + is that a_entry will be in the first page of the executable. */ \ + : (N_SHARED_LIB(x) \ + ? ((x).a_entry & ~(bfd_vma) (TARGET_PAGE_SIZE - 1)) \ + : (bfd_vma) TEXT_START_ADDR)) + +#define N_SYMOFF(x) \ + (N_TXTOFF (x) + (x).a_text + (x).a_data + (x).a_trsize + (x).a_drsize) + +#define N_STROFF(x) (N_SYMOFF (x) + (x).a_syms) + +#define TEXT_START_ADDR 32768 +#define TARGET_PAGE_SIZE 32768 +#define SEGMENT_SIZE TARGET_PAGE_SIZE +#define DEFAULT_ARCH bfd_arch_arm + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (riscix_,OP) +#define TARGETNAME "a.out-riscix" +#define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) && \ + (((x).a_info & ~006000) != OMAGIC) && \ + ((x).a_info != NMAGIC)) +#define N_MAGIC(x) ((x).a_info & ~07200) + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#define WRITE_HEADERS(abfd, execp) \ + { \ + bfd_size_type text_size; /* dummy vars */ \ + file_ptr text_end; \ + if (adata(abfd).magic == undecided_magic) \ + NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \ + \ + execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \ + execp->a_entry = bfd_get_start_address (abfd); \ + \ + execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \ + obj_reloc_entry_size (abfd)); \ + execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \ + obj_reloc_entry_size (abfd)); \ + NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \ + \ + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \ + || bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \ + abfd) != EXEC_BYTES_SIZE) \ + return FALSE; \ + /* Now write out reloc info, followed by syms and strings */ \ + \ + if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \ + && bfd_get_symcount (abfd) != 0) \ + { \ + if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0) \ + return FALSE; \ + \ + if (! NAME(aout,write_syms) (abfd)) return FALSE; \ + \ + if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \ + return FALSE; \ + \ + if (! riscix_squirt_out_relocs (abfd, obj_textsec (abfd))) \ + return FALSE; \ + if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \ + return FALSE; \ + \ + if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \ + return FALSE; \ + } \ + } + +#include "libaout.h" +#include "aout/aout64.h" + +static bfd_reloc_status_type +riscix_fix_pcrel_26_done PARAMS ((bfd *, arelent *, asymbol *, PTR, + asection *, bfd *, char **)); + +static bfd_reloc_status_type +riscix_fix_pcrel_26 PARAMS ((bfd *, arelent *, asymbol *, PTR, + asection *, bfd *, char **)); +static const bfd_target * +MY (object_p) PARAMS ((bfd *)); + +reloc_howto_type * +riscix_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); + +void +riscix_swap_std_reloc_out PARAMS ((bfd *, arelent *, struct reloc_std_external *)); + +bfd_boolean +riscix_squirt_out_relocs PARAMS ((bfd *, asection *)); + +long +MY (canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); + +const bfd_target * +riscix_some_aout_object_p PARAMS ((bfd *, struct internal_exec *, const bfd_target *(*) (bfd *))); + + +static reloc_howto_type riscix_std_reloc_howto[] = { + /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */ + HOWTO( 0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", TRUE, 0x000000ff,0x000000ff, FALSE), + HOWTO( 1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"16", TRUE, 0x0000ffff,0x0000ffff, FALSE), + HOWTO( 2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"32", TRUE, 0xffffffff,0xffffffff, FALSE), + HOWTO( 3, 2, 3, 26, TRUE, 0, complain_overflow_signed, riscix_fix_pcrel_26 , "ARM26", TRUE, 0x00ffffff,0x00ffffff, FALSE), + HOWTO( 4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0,"DISP8", TRUE, 0x000000ff,0x000000ff, TRUE), + HOWTO( 5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0,"DISP16", TRUE, 0x0000ffff,0x0000ffff, TRUE), + HOWTO( 6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0,"DISP32", TRUE, 0xffffffff,0xffffffff, TRUE), + HOWTO( 7, 2, 3, 26, FALSE, 0, complain_overflow_signed, riscix_fix_pcrel_26_done, "ARM26D",TRUE,0x00ffffff,0x00ffffff, FALSE), + EMPTY_HOWTO (-1), + HOWTO( 9, 0, -1, 16, FALSE, 0, complain_overflow_bitfield,0,"NEG16", TRUE, 0x0000ffff,0x0000ffff, FALSE), + HOWTO( 10, 0, -2, 32, FALSE, 0, complain_overflow_bitfield,0,"NEG32", TRUE, 0xffffffff,0xffffffff, FALSE) +}; + +#define RISCIX_TABLE_SIZE \ + (sizeof (riscix_std_reloc_howto) / sizeof (reloc_howto_type)) + +static bfd_reloc_status_type +riscix_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry ATTRIBUTE_UNUSED; + asymbol *symbol ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection *input_section ATTRIBUTE_UNUSED; + bfd *output_bfd ATTRIBUTE_UNUSED; + char **error_message ATTRIBUTE_UNUSED; +{ + /* This is dead simple at present. */ + return bfd_reloc_ok; +} + +static bfd_reloc_status_type +riscix_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + bfd_vma relocation; + bfd_size_type addr = reloc_entry->address; + long target = bfd_get_32 (abfd, (bfd_byte *) data + addr); + bfd_reloc_status_type flag = bfd_reloc_ok; + + /* If this is an undefined symbol, return error */ + if (symbol->section == &bfd_und_section + && (symbol->flags & BSF_WEAK) == 0) + return output_bfd ? bfd_reloc_continue : bfd_reloc_undefined; + + /* If the sections are different, and we are doing a partial relocation, + just ignore it for now. */ + if (symbol->section->name != input_section->name + && output_bfd != (bfd *)NULL) + return bfd_reloc_continue; + + relocation = (target & 0x00ffffff) << 2; + relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend */ + relocation += symbol->value; + relocation += symbol->section->output_section->vma; + relocation += symbol->section->output_offset; + relocation += reloc_entry->addend; + relocation -= input_section->output_section->vma; + relocation -= input_section->output_offset; + relocation -= addr; + if (relocation & 3) + return bfd_reloc_overflow; + + /* Check for overflow */ + if (relocation & 0x02000000) + { + if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff) + flag = bfd_reloc_overflow; + } + else if (relocation & ~ (bfd_vma) 0x03ffffff) + flag = bfd_reloc_overflow; + + target &= ~0x00ffffff; + target |= (relocation >> 2) & 0x00ffffff; + bfd_put_32 (abfd, (bfd_vma) target, (bfd_byte *) data + addr); + + /* Now the ARM magic... Change the reloc type so that it is marked as done. + Strictly this is only necessary if we are doing a partial relocation. */ + reloc_entry->howto = &riscix_std_reloc_howto[7]; + + return flag; +} + +reloc_howto_type * +riscix_reloc_type_lookup (abfd, code) + bfd *abfd; + bfd_reloc_code_real_type code; +{ +#define ASTD(i,j) case i: return &riscix_std_reloc_howto[j] + if (code == BFD_RELOC_CTOR) + switch (bfd_get_arch_info (abfd)->bits_per_address) + { + case 32: + code = BFD_RELOC_32; + break; + default: return (reloc_howto_type *) NULL; + } + + switch (code) + { + ASTD (BFD_RELOC_16, 1); + ASTD (BFD_RELOC_32, 2); + ASTD (BFD_RELOC_ARM_PCREL_BRANCH, 3); + ASTD (BFD_RELOC_8_PCREL, 4); + ASTD (BFD_RELOC_16_PCREL, 5); + ASTD (BFD_RELOC_32_PCREL, 6); + default: return (reloc_howto_type *) NULL; + } +} + +#define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define MY_final_link_callback should_not_be_used +#define MY_bfd_final_link _bfd_generic_final_link + +#define MY_bfd_reloc_type_lookup riscix_reloc_type_lookup +#define MY_canonicalize_reloc riscix_canonicalize_reloc +#define MY_object_p riscix_object_p + +static const bfd_target *riscix_callback PARAMS ((bfd *)); + +void +riscix_swap_std_reloc_out (abfd, g, natptr) + bfd *abfd; + arelent *g; + struct reloc_std_external *natptr; +{ + int r_index; + asymbol *sym = *(g->sym_ptr_ptr); + int r_extern; + int r_length; + int r_pcrel; + int r_neg = 0; /* Negative relocs use the BASEREL bit. */ + asection *output_section = sym->section->output_section; + + PUT_WORD(abfd, g->address, natptr->r_address); + + r_length = g->howto->size ; /* Size as a power of two */ + if (r_length < 0) + { + r_length = -r_length; + r_neg = 1; + } + + r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */ + + /* For RISC iX, in pc-relative relocs the r_pcrel bit means that the + relocation has been done already (Only for the 26-bit one I think)???!!! + */ + + if (r_length == 3) + r_pcrel = r_pcrel ? 0 : 1; + +#if 0 + /* For a standard reloc, the addend is in the object file. */ + r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma; +#endif + + /* name was clobbered by aout_write_syms to be symbol index */ + + /* If this relocation is relative to a symbol then set the + r_index to the symbols index, and the r_extern bit. + + Absolute symbols can come in in two ways, either as an offset + from the abs section, or as a symbol which has an abs value. + check for that here + */ + + if (bfd_is_com_section (output_section) + || output_section == &bfd_abs_section + || output_section == &bfd_und_section) + { + if (bfd_abs_section.symbol == sym) + { + /* Whoops, looked like an abs symbol, but is really an offset + from the abs section */ + r_index = 0; + r_extern = 0; + } + else + { + /* Fill in symbol */ + r_extern = 1; + r_index = (*g->sym_ptr_ptr)->udata.i; + } + } + else + { + /* Just an ordinary section */ + r_extern = 0; + r_index = output_section->target_index; + } + + /* now the fun stuff */ + if (bfd_header_big_endian (abfd)) + { + natptr->r_index[0] = r_index >> 16; + natptr->r_index[1] = r_index >> 8; + natptr->r_index[2] = r_index; + natptr->r_type[0] = + ( (r_extern ? RELOC_STD_BITS_EXTERN_BIG: 0) + | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG: 0) + | (r_neg ? RELOC_STD_BITS_BASEREL_BIG: 0) + | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG)); + } + else + { + natptr->r_index[2] = r_index >> 16; + natptr->r_index[1] = r_index >> 8; + natptr->r_index[0] = r_index; + natptr->r_type[0] = + ( (r_extern ? RELOC_STD_BITS_EXTERN_LITTLE: 0) + | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE: 0) + | (r_neg ? RELOC_STD_BITS_BASEREL_LITTLE: 0) + | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE)); + } +} + +bfd_boolean +riscix_squirt_out_relocs (abfd, section) + bfd *abfd; + asection *section; +{ + arelent **generic; + unsigned char *native, *natptr; + size_t each_size; + + unsigned int count = section->reloc_count; + bfd_size_type natsize; + + if (count == 0) + return TRUE; + + each_size = obj_reloc_entry_size (abfd); + natsize = each_size; + natsize *= count; + native = (unsigned char *) bfd_zalloc (abfd, natsize); + if (!native) + return FALSE; + + generic = section->orelocation; + + for (natptr = native; + count != 0; + --count, natptr += each_size, ++generic) + riscix_swap_std_reloc_out (abfd, *generic, + (struct reloc_std_external *) natptr); + + if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize) + { + bfd_release (abfd, native); + return FALSE; + } + + bfd_release (abfd, native); + return TRUE; +} + +/* + * This is just like the standard aoutx.h version but we need to do our + * own mapping of external reloc type values to howto entries. + */ +long +MY(canonicalize_reloc) (abfd, section, relptr, symbols) + bfd *abfd; + sec_ptr section; + arelent **relptr; + asymbol **symbols; +{ + arelent *tblptr = section->relocation; + unsigned int count, c; + extern reloc_howto_type NAME(aout,std_howto_table)[]; + + /* If we have already read in the relocation table, return the values. */ + if (section->flags & SEC_CONSTRUCTOR) { + arelent_chain *chain = section->constructor_chain; + + for (count = 0; count < section->reloc_count; count++) { + *relptr++ = &chain->relent; + chain = chain->next; + } + *relptr = 0; + return section->reloc_count; + } + if (tblptr && section->reloc_count) { + for (count = 0; count++ < section->reloc_count;) + *relptr++ = tblptr++; + *relptr = 0; + return section->reloc_count; + } + + if (!NAME(aout,slurp_reloc_table) (abfd, section, symbols)) + return -1; + tblptr = section->relocation; + + /* fix up howto entries */ + for (count = 0; count++ < section->reloc_count;) + { + c = tblptr->howto - NAME(aout,std_howto_table); + BFD_ASSERT (c < RISCIX_TABLE_SIZE); + tblptr->howto = &riscix_std_reloc_howto[c]; + + *relptr++ = tblptr++; + } + *relptr = 0; + return section->reloc_count; +} + +/* This is the same as NAME(aout,some_aout_object_p), but has different + expansions of the macro definitions. */ + +const bfd_target * +riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p) + bfd *abfd; + struct internal_exec *execp; + const bfd_target *(*callback_to_real_object_p) PARAMS ((bfd *)); +{ + struct aout_data_struct *rawptr, *oldrawptr; + const bfd_target *result; + bfd_size_type amt = sizeof (struct aout_data_struct); + + rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); + + if (rawptr == NULL) + return 0; + + oldrawptr = abfd->tdata.aout_data; + abfd->tdata.aout_data = rawptr; + + /* Copy the contents of the old tdata struct. + In particular, we want the subformat, since for hpux it was set in + hp300hpux.c:swap_exec_header_in and will be used in + hp300hpux.c:callback. */ + if (oldrawptr != NULL) + *abfd->tdata.aout_data = *oldrawptr; + + abfd->tdata.aout_data->a.hdr = &rawptr->e; + *(abfd->tdata.aout_data->a.hdr) = *execp; /* Copy in the internal_exec + struct */ + execp = abfd->tdata.aout_data->a.hdr; + + /* Set the file flags */ + abfd->flags = BFD_NO_FLAGS; + if (execp->a_drsize || execp->a_trsize) + abfd->flags |= HAS_RELOC; + /* Setting of EXEC_P has been deferred to the bottom of this function */ + if (execp->a_syms) + abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; + if (N_DYNAMIC(*execp)) + abfd->flags |= DYNAMIC; + + if ((execp->a_info & MF_SQUEEZED) != 0) /* Squeezed files aren't supported + (yet)! */ + { + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + else if ((execp->a_info & MF_IS_SL) != 0) /* Nor are shared libraries */ + { + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + else if (N_MAGIC (*execp) == ZMAGIC) + { + abfd->flags |= D_PAGED | WP_TEXT; + adata (abfd).magic = z_magic; + } + else if (N_MAGIC (*execp) == NMAGIC) + { + abfd->flags |= WP_TEXT; + adata (abfd).magic = n_magic; + } + else if (N_MAGIC (*execp) == OMAGIC) + adata (abfd).magic = o_magic; + else + { + /* Should have been checked with N_BADMAG before this routine + was called. */ + abort (); + } + + bfd_get_start_address (abfd) = execp->a_entry; + + obj_aout_symbols (abfd) = (aout_symbol_type *)NULL; + bfd_get_symcount (abfd) = execp->a_syms / sizeof (struct external_nlist); + + /* The default relocation entry size is that of traditional V7 Unix. */ + obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; + + /* The default symbol entry size is that of traditional Unix. */ + obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE; + + obj_aout_external_syms (abfd) = NULL; + obj_aout_external_strings (abfd) = NULL; + obj_aout_sym_hashes (abfd) = NULL; + + if (! NAME(aout,make_sections) (abfd)) + return NULL; + + obj_datasec (abfd)->_raw_size = execp->a_data; + obj_bsssec (abfd)->_raw_size = execp->a_bss; + + obj_textsec (abfd)->flags = + (execp->a_trsize != 0 + ? (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_RELOC) + : (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)); + obj_datasec (abfd)->flags = + (execp->a_drsize != 0 + ? (SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS | SEC_RELOC) + : (SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS)); + obj_bsssec (abfd)->flags = SEC_ALLOC; + + result = (*callback_to_real_object_p) (abfd); + +#if defined(MACH) || defined(STAT_FOR_EXEC) + /* The original heuristic doesn't work in some important cases. The + * a.out file has no information about the text start address. For + * files (like kernels) linked to non-standard addresses (ld -Ttext + * nnn) the entry point may not be between the default text start + * (obj_textsec(abfd)->vma) and (obj_textsec(abfd)->vma) + text size + * This is not just a mach issue. Many kernels are loaded at non + * standard addresses. + */ + { + struct stat stat_buf; + if (abfd->iostream != NULL + && (abfd->flags & BFD_IN_MEMORY) == 0 + && (fstat(fileno((FILE *) (abfd->iostream)), &stat_buf) == 0) + && ((stat_buf.st_mode & 0111) != 0)) + abfd->flags |= EXEC_P; + } +#else /* ! MACH */ + /* Now that the segment addresses have been worked out, take a better + guess at whether the file is executable. If the entry point + is within the text segment, assume it is. (This makes files + executable even if their entry point address is 0, as long as + their text starts at zero.) + + At some point we should probably break down and stat the file and + declare it executable if (one of) its 'x' bits are on... */ + if ((execp->a_entry >= obj_textsec(abfd)->vma) && + (execp->a_entry < obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size)) + abfd->flags |= EXEC_P; +#endif /* MACH */ + if (result) + { + } + else + { + free (rawptr); + abfd->tdata.aout_data = oldrawptr; + } + return result; +} + +static const bfd_target * +MY(object_p) (abfd) + bfd *abfd; +{ + struct external_exec exec_bytes; /* Raw exec header from file */ + struct internal_exec exec; /* Cleaned-up exec header */ + const bfd_target *target; + + if (bfd_bread ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd) + != EXEC_BYTES_SIZE) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + exec.a_info = H_GET_32 (abfd, exec_bytes.e_info); + + if (N_BADMAG (exec)) return 0; +#ifdef MACHTYPE_OK + if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0; +#endif + + NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec); + + target = riscix_some_aout_object_p (abfd, &exec, MY(callback)); + + return target; +} + +#include "aout-target.h" diff --git a/bfd/som.c b/bfd/som.c new file mode 100644 index 0000000000000..90662575bbd1c --- /dev/null +++ b/bfd/som.c @@ -0,0 +1,6413 @@ +/* bfd back-end for HP PA-RISC SOM objects. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + Contributed by the Center for Software Science at the + University of Utah. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "alloca-conf.h" +#include "bfd.h" +#include "sysdep.h" + +#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined(HOST_HPPAMPEIX) + +#include "libbfd.h" +#include "som.h" +#include "safe-ctype.h" + +#include +#include +#include +#include + +/* Magic not defined in standard HP-UX header files until 8.0. */ + +#ifndef CPU_PA_RISC1_0 +#define CPU_PA_RISC1_0 0x20B +#endif /* CPU_PA_RISC1_0 */ + +#ifndef CPU_PA_RISC1_1 +#define CPU_PA_RISC1_1 0x210 +#endif /* CPU_PA_RISC1_1 */ + +#ifndef CPU_PA_RISC2_0 +#define CPU_PA_RISC2_0 0x214 +#endif /* CPU_PA_RISC2_0 */ + +#ifndef _PA_RISC1_0_ID +#define _PA_RISC1_0_ID CPU_PA_RISC1_0 +#endif /* _PA_RISC1_0_ID */ + +#ifndef _PA_RISC1_1_ID +#define _PA_RISC1_1_ID CPU_PA_RISC1_1 +#endif /* _PA_RISC1_1_ID */ + +#ifndef _PA_RISC2_0_ID +#define _PA_RISC2_0_ID CPU_PA_RISC2_0 +#endif /* _PA_RISC2_0_ID */ + +#ifndef _PA_RISC_MAXID +#define _PA_RISC_MAXID 0x2FF +#endif /* _PA_RISC_MAXID */ + +#ifndef _PA_RISC_ID +#define _PA_RISC_ID(__m_num) \ + (((__m_num) == _PA_RISC1_0_ID) || \ + ((__m_num) >= _PA_RISC1_1_ID && (__m_num) <= _PA_RISC_MAXID)) +#endif /* _PA_RISC_ID */ + +/* HIUX in it's infinite stupidity changed the names for several "well + known" constants. Work around such braindamage. Try the HPUX version + first, then the HIUX version, and finally provide a default. */ +#ifdef HPUX_AUX_ID +#define EXEC_AUX_ID HPUX_AUX_ID +#endif + +#if !defined (EXEC_AUX_ID) && defined (HIUX_AUX_ID) +#define EXEC_AUX_ID HIUX_AUX_ID +#endif + +#ifndef EXEC_AUX_ID +#define EXEC_AUX_ID 0 +#endif + +/* Size (in chars) of the temporary buffers used during fixup and string + table writes. */ + +#define SOM_TMP_BUFSIZE 8192 + +/* Size of the hash table in archives. */ +#define SOM_LST_HASH_SIZE 31 + +/* Max number of SOMs to be found in an archive. */ +#define SOM_LST_MODULE_LIMIT 1024 + +/* Generic alignment macro. */ +#define SOM_ALIGN(val, alignment) \ + (((val) + (alignment) - 1) &~ ((unsigned long) (alignment) - 1)) + +/* SOM allows any one of the four previous relocations to be reused + with a "R_PREV_FIXUP" relocation entry. Since R_PREV_FIXUP + relocations are always a single byte, using a R_PREV_FIXUP instead + of some multi-byte relocation makes object files smaller. + + Note one side effect of using a R_PREV_FIXUP is the relocation that + is being repeated moves to the front of the queue. */ +struct reloc_queue { + unsigned char *reloc; + unsigned int size; +} reloc_queue[4]; + +/* This fully describes the symbol types which may be attached to + an EXPORT or IMPORT directive. Only SOM uses this formation + (ELF has no need for it). */ +typedef enum { + SYMBOL_TYPE_UNKNOWN, + SYMBOL_TYPE_ABSOLUTE, + SYMBOL_TYPE_CODE, + SYMBOL_TYPE_DATA, + SYMBOL_TYPE_ENTRY, + SYMBOL_TYPE_MILLICODE, + SYMBOL_TYPE_PLABEL, + SYMBOL_TYPE_PRI_PROG, + SYMBOL_TYPE_SEC_PROG, +} pa_symbol_type; + +struct section_to_type { + char *section; + char type; +}; + +/* Assorted symbol information that needs to be derived from the BFD symbol + and/or the BFD backend private symbol data. */ +struct som_misc_symbol_info { + unsigned int symbol_type; + unsigned int symbol_scope; + unsigned int arg_reloc; + unsigned int symbol_info; + unsigned int symbol_value; + unsigned int priv_level; + unsigned int secondary_def; +}; + +/* Forward declarations. */ + +static bfd_boolean som_mkobject + PARAMS ((bfd *)); +static const bfd_target * som_object_setup + PARAMS ((bfd *, struct header *, struct som_exec_auxhdr *, unsigned long)); +static bfd_boolean setup_sections + PARAMS ((bfd *, struct header *, unsigned long)); +static const bfd_target * som_object_p + PARAMS ((bfd *)); +static bfd_boolean som_write_object_contents + PARAMS ((bfd *)); +static bfd_boolean som_slurp_string_table + PARAMS ((bfd *)); +static unsigned int som_slurp_symbol_table + PARAMS ((bfd *)); +static long som_get_symtab_upper_bound + PARAMS ((bfd *)); +static long som_canonicalize_reloc + PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); +static long som_get_reloc_upper_bound + PARAMS ((bfd *, sec_ptr)); +static unsigned int som_set_reloc_info + PARAMS ((unsigned char *, unsigned int, arelent *, asection *, + asymbol **, bfd_boolean)); +static bfd_boolean som_slurp_reloc_table + PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); +static long som_canonicalize_symtab + PARAMS ((bfd *, asymbol **)); +static asymbol * som_make_empty_symbol + PARAMS ((bfd *)); +static void som_print_symbol + PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); +static bfd_boolean som_new_section_hook + PARAMS ((bfd *, asection *)); +static bfd_boolean som_bfd_copy_private_symbol_data + PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); +static bfd_boolean som_bfd_copy_private_section_data + PARAMS ((bfd *, asection *, bfd *, asection *)); +static bfd_boolean som_bfd_copy_private_bfd_data + PARAMS ((bfd *, bfd *)); +#define som_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data +#define som_bfd_set_private_flags _bfd_generic_bfd_set_private_flags +static bfd_boolean som_bfd_is_local_label_name + PARAMS ((bfd *, const char *)); +static bfd_boolean som_set_section_contents + PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); +static bfd_boolean som_get_section_contents + PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); +static bfd_boolean som_set_arch_mach + PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +static bfd_boolean som_find_nearest_line + PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, + const char **, unsigned int *)); +static void som_get_symbol_info + PARAMS ((bfd *, asymbol *, symbol_info *)); +static asection * bfd_section_from_som_symbol + PARAMS ((bfd *, struct symbol_dictionary_record *)); +static int log2 + PARAMS ((unsigned int)); +static bfd_reloc_status_type hppa_som_reloc + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static void som_initialize_reloc_queue + PARAMS ((struct reloc_queue *)); +static void som_reloc_queue_insert + PARAMS ((unsigned char *, unsigned int, struct reloc_queue *)); +static void som_reloc_queue_fix + PARAMS ((struct reloc_queue *, unsigned int)); +static int som_reloc_queue_find + PARAMS ((unsigned char *, unsigned int, struct reloc_queue *)); +static unsigned char * try_prev_fixup + PARAMS ((bfd *, int *, unsigned char *, unsigned int, struct reloc_queue *)); +static unsigned char * som_reloc_skip + PARAMS ((bfd *, unsigned int, unsigned char *, unsigned int *, + struct reloc_queue *)); +static unsigned char * som_reloc_addend + PARAMS ((bfd *, bfd_vma, unsigned char *, unsigned int *, + struct reloc_queue *)); +static unsigned char * som_reloc_call + PARAMS ((bfd *, unsigned char *, unsigned int *, arelent *, int, + struct reloc_queue *)); +static unsigned long som_count_spaces + PARAMS ((bfd *)); +static unsigned long som_count_subspaces + PARAMS ((bfd *)); +static int compare_syms + PARAMS ((const void *, const void *)); +static int compare_subspaces + PARAMS ((const void *, const void *)); +static unsigned long som_compute_checksum + PARAMS ((bfd *)); +static bfd_boolean som_prep_headers + PARAMS ((bfd *)); +static int som_sizeof_headers + PARAMS ((bfd *, bfd_boolean)); +static bfd_boolean som_finish_writing + PARAMS ((bfd *)); +static bfd_boolean som_build_and_write_symbol_table + PARAMS ((bfd *)); +static void som_prep_for_fixups + PARAMS ((bfd *, asymbol **, unsigned long)); +static bfd_boolean som_write_fixups + PARAMS ((bfd *, unsigned long, unsigned int *)); +static bfd_boolean som_write_space_strings + PARAMS ((bfd *, unsigned long, unsigned int *)); +static bfd_boolean som_write_symbol_strings + PARAMS ((bfd *, unsigned long, asymbol **, unsigned int, unsigned *, + COMPUNIT *)); +static bfd_boolean som_begin_writing + PARAMS ((bfd *)); +static reloc_howto_type * som_bfd_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static char som_section_type + PARAMS ((const char *)); +static int som_decode_symclass + PARAMS ((asymbol *)); +static bfd_boolean som_bfd_count_ar_symbols + PARAMS ((bfd *, struct lst_header *, symindex *)); +static bfd_boolean som_bfd_fill_in_ar_symbols + PARAMS ((bfd *, struct lst_header *, carsym **)); +static bfd_boolean som_slurp_armap + PARAMS ((bfd *)); +static bfd_boolean som_write_armap + PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); +static void som_bfd_derive_misc_symbol_info + PARAMS ((bfd *, asymbol *, struct som_misc_symbol_info *)); +static bfd_boolean som_bfd_prep_for_ar_write + PARAMS ((bfd *, unsigned int *, unsigned int *)); +static unsigned int som_bfd_ar_symbol_hash + PARAMS ((asymbol *)); +static bfd_boolean som_bfd_ar_write_symbol_stuff + PARAMS ((bfd *, unsigned int, unsigned int, struct lst_header, + unsigned int)); +static bfd_boolean som_is_space + PARAMS ((asection *)); +static bfd_boolean som_is_subspace + PARAMS ((asection *)); +static bfd_boolean som_is_container + PARAMS ((asection *, asection *)); +static bfd_boolean som_bfd_free_cached_info + PARAMS ((bfd *)); +static bfd_boolean som_bfd_link_split_section + PARAMS ((bfd *, asection *)); + +/* Map SOM section names to POSIX/BSD single-character symbol types. + + This table includes all the standard subspaces as defined in the + current "PRO ABI for PA-RISC Systems", $UNWIND$ which for + some reason was left out, and sections specific to embedded stabs. */ + +static const struct section_to_type stt[] = { + {"$TEXT$", 't'}, + {"$SHLIB_INFO$", 't'}, + {"$MILLICODE$", 't'}, + {"$LIT$", 't'}, + {"$CODE$", 't'}, + {"$UNWIND_START$", 't'}, + {"$UNWIND$", 't'}, + {"$PRIVATE$", 'd'}, + {"$PLT$", 'd'}, + {"$SHLIB_DATA$", 'd'}, + {"$DATA$", 'd'}, + {"$SHORTDATA$", 'g'}, + {"$DLT$", 'd'}, + {"$GLOBAL$", 'g'}, + {"$SHORTBSS$", 's'}, + {"$BSS$", 'b'}, + {"$GDB_STRINGS$", 'N'}, + {"$GDB_SYMBOLS$", 'N'}, + {0, 0} +}; + +/* About the relocation formatting table... + + There are 256 entries in the table, one for each possible + relocation opcode available in SOM. We index the table by + the relocation opcode. The names and operations are those + defined by a.out_800 (4). + + Right now this table is only used to count and perform minimal + processing on relocation streams so that they can be internalized + into BFD and symbolically printed by utilities. To make actual use + of them would be much more difficult, BFD's concept of relocations + is far too simple to handle SOM relocations. The basic assumption + that a relocation can be completely processed independent of other + relocations before an object file is written is invalid for SOM. + + The SOM relocations are meant to be processed as a stream, they + specify copying of data from the input section to the output section + while possibly modifying the data in some manner. They also can + specify that a variable number of zeros or uninitialized data be + inserted on in the output segment at the current offset. Some + relocations specify that some previous relocation be re-applied at + the current location in the input/output sections. And finally a number + of relocations have effects on other sections (R_ENTRY, R_EXIT, + R_UNWIND_AUX and a variety of others). There isn't even enough room + in the BFD relocation data structure to store enough information to + perform all the relocations. + + Each entry in the table has three fields. + + The first entry is an index into this "class" of relocations. This + index can then be used as a variable within the relocation itself. + + The second field is a format string which actually controls processing + of the relocation. It uses a simple postfix machine to do calculations + based on variables/constants found in the string and the relocation + stream. + + The third field specifys whether or not this relocation may use + a constant (V) from the previous R_DATA_OVERRIDE rather than a constant + stored in the instruction. + + Variables: + + L = input space byte count + D = index into class of relocations + M = output space byte count + N = statement number (unused?) + O = stack operation + R = parameter relocation bits + S = symbol index + T = first 32 bits of stack unwind information + U = second 32 bits of stack unwind information + V = a literal constant (usually used in the next relocation) + P = a previous relocation + + Lower case letters (starting with 'b') refer to following + bytes in the relocation stream. 'b' is the next 1 byte, + c is the next 2 bytes, d is the next 3 bytes, etc... + This is the variable part of the relocation entries that + makes our life a living hell. + + numerical constants are also used in the format string. Note + the constants are represented in decimal. + + '+', "*" and "=" represents the obvious postfix operators. + '<' represents a left shift. + + Stack Operations: + + Parameter Relocation Bits: + + Unwind Entries: + + Previous Relocations: The index field represents which in the queue + of 4 previous fixups should be re-applied. + + Literal Constants: These are generally used to represent addend + parts of relocations when these constants are not stored in the + fields of the instructions themselves. For example the instruction + addil foo-$global$-0x1234 would use an override for "0x1234" rather + than storing it into the addil itself. */ + +struct fixup_format { + int D; + const char *format; +}; + +static const struct fixup_format som_fixup_formats[256] = { + /* R_NO_RELOCATION */ + { 0, "LD1+4*=" }, /* 0x00 */ + { 1, "LD1+4*=" }, /* 0x01 */ + { 2, "LD1+4*=" }, /* 0x02 */ + { 3, "LD1+4*=" }, /* 0x03 */ + { 4, "LD1+4*=" }, /* 0x04 */ + { 5, "LD1+4*=" }, /* 0x05 */ + { 6, "LD1+4*=" }, /* 0x06 */ + { 7, "LD1+4*=" }, /* 0x07 */ + { 8, "LD1+4*=" }, /* 0x08 */ + { 9, "LD1+4*=" }, /* 0x09 */ + { 10, "LD1+4*=" }, /* 0x0a */ + { 11, "LD1+4*=" }, /* 0x0b */ + { 12, "LD1+4*=" }, /* 0x0c */ + { 13, "LD1+4*=" }, /* 0x0d */ + { 14, "LD1+4*=" }, /* 0x0e */ + { 15, "LD1+4*=" }, /* 0x0f */ + { 16, "LD1+4*=" }, /* 0x10 */ + { 17, "LD1+4*=" }, /* 0x11 */ + { 18, "LD1+4*=" }, /* 0x12 */ + { 19, "LD1+4*=" }, /* 0x13 */ + { 20, "LD1+4*=" }, /* 0x14 */ + { 21, "LD1+4*=" }, /* 0x15 */ + { 22, "LD1+4*=" }, /* 0x16 */ + { 23, "LD1+4*=" }, /* 0x17 */ + { 0, "LD8= 0x1000000) + { + skip -= 0x1000000; + bfd_put_8 (abfd, R_NO_RELOCATION + 31, p); + bfd_put_8 (abfd, 0xff, p + 1); + bfd_put_16 (abfd, (bfd_vma) 0xffff, p + 2); + p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 4, queue); + while (skip >= 0x1000000) + { + skip -= 0x1000000; + bfd_put_8 (abfd, R_PREV_FIXUP, p); + p++; + *subspace_reloc_sizep += 1; + /* No need to adjust queue here since we are repeating the + most recent fixup. */ + } + } + + /* The difference must be less than 0x1000000. Use one + more R_NO_RELOCATION entry to get to the right difference. */ + if ((skip & 3) == 0 && skip <= 0xc0000 && skip > 0) + { + /* Difference can be handled in a simple single-byte + R_NO_RELOCATION entry. */ + if (skip <= 0x60) + { + bfd_put_8 (abfd, R_NO_RELOCATION + (skip >> 2) - 1, p); + *subspace_reloc_sizep += 1; + p++; + } + /* Handle it with a two byte R_NO_RELOCATION entry. */ + else if (skip <= 0x1000) + { + bfd_put_8 (abfd, R_NO_RELOCATION + 24 + (((skip >> 2) - 1) >> 8), p); + bfd_put_8 (abfd, (skip >> 2) - 1, p + 1); + p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 2, queue); + } + /* Handle it with a three byte R_NO_RELOCATION entry. */ + else + { + bfd_put_8 (abfd, R_NO_RELOCATION + 28 + (((skip >> 2) - 1) >> 16), p); + bfd_put_16 (abfd, (bfd_vma) (skip >> 2) - 1, p + 1); + p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 3, queue); + } + } + /* Ugh. Punt and use a 4 byte entry. */ + else if (skip > 0) + { + bfd_put_8 (abfd, R_NO_RELOCATION + 31, p); + bfd_put_8 (abfd, (skip - 1) >> 16, p + 1); + bfd_put_16 (abfd, (bfd_vma) skip - 1, p + 2); + p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 4, queue); + } + return p; +} + +/* Emit the proper R_DATA_OVERRIDE fixups to handle a nonzero addend + from a BFD relocation. Update the size of the subspace relocation + stream via SUBSPACE_RELOC_SIZE_P; also return the current pointer + into the relocation stream. */ + +static unsigned char * +som_reloc_addend (abfd, addend, p, subspace_reloc_sizep, queue) + bfd *abfd; + bfd_vma addend; + unsigned char *p; + unsigned int *subspace_reloc_sizep; + struct reloc_queue *queue; +{ + if (addend + 0x80 < 0x100) + { + bfd_put_8 (abfd, R_DATA_OVERRIDE + 1, p); + bfd_put_8 (abfd, addend, p + 1); + p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 2, queue); + } + else if (addend + 0x8000 < 0x10000) + { + bfd_put_8 (abfd, R_DATA_OVERRIDE + 2, p); + bfd_put_16 (abfd, addend, p + 1); + p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 3, queue); + } + else if (addend + 0x800000 < 0x1000000) + { + bfd_put_8 (abfd, R_DATA_OVERRIDE + 3, p); + bfd_put_8 (abfd, addend >> 16, p + 1); + bfd_put_16 (abfd, addend, p + 2); + p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 4, queue); + } + else + { + bfd_put_8 (abfd, R_DATA_OVERRIDE + 4, p); + bfd_put_32 (abfd, addend, p + 1); + p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 5, queue); + } + return p; +} + +/* Handle a single function call relocation. */ + +static unsigned char * +som_reloc_call (abfd, p, subspace_reloc_sizep, bfd_reloc, sym_num, queue) + bfd *abfd; + unsigned char *p; + unsigned int *subspace_reloc_sizep; + arelent *bfd_reloc; + int sym_num; + struct reloc_queue *queue; +{ + int arg_bits = HPPA_R_ARG_RELOC (bfd_reloc->addend); + int rtn_bits = arg_bits & 0x3; + int type, done = 0; + + /* You'll never believe all this is necessary to handle relocations + for function calls. Having to compute and pack the argument + relocation bits is the real nightmare. + + If you're interested in how this works, just forget it. You really + do not want to know about this braindamage. */ + + /* First see if this can be done with a "simple" relocation. Simple + relocations have a symbol number < 0x100 and have simple encodings + of argument relocations. */ + + if (sym_num < 0x100) + { + switch (arg_bits) + { + case 0: + case 1: + type = 0; + break; + case 1 << 8: + case 1 << 8 | 1: + type = 1; + break; + case 1 << 8 | 1 << 6: + case 1 << 8 | 1 << 6 | 1: + type = 2; + break; + case 1 << 8 | 1 << 6 | 1 << 4: + case 1 << 8 | 1 << 6 | 1 << 4 | 1: + type = 3; + break; + case 1 << 8 | 1 << 6 | 1 << 4 | 1 << 2: + case 1 << 8 | 1 << 6 | 1 << 4 | 1 << 2 | 1: + type = 4; + break; + default: + /* Not one of the easy encodings. This will have to be + handled by the more complex code below. */ + type = -1; + break; + } + if (type != -1) + { + /* Account for the return value too. */ + if (rtn_bits) + type += 5; + + /* Emit a 2 byte relocation. Then see if it can be handled + with a relocation which is already in the relocation queue. */ + bfd_put_8 (abfd, bfd_reloc->howto->type + type, p); + bfd_put_8 (abfd, sym_num, p + 1); + p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 2, queue); + done = 1; + } + } + + /* If this could not be handled with a simple relocation, then do a hard + one. Hard relocations occur if the symbol number was too high or if + the encoding of argument relocation bits is too complex. */ + if (! done) + { + /* Don't ask about these magic sequences. I took them straight + from gas-1.36 which took them from the a.out man page. */ + type = rtn_bits; + if ((arg_bits >> 6 & 0xf) == 0xe) + type += 9 * 40; + else + type += (3 * (arg_bits >> 8 & 3) + (arg_bits >> 6 & 3)) * 40; + if ((arg_bits >> 2 & 0xf) == 0xe) + type += 9 * 4; + else + type += (3 * (arg_bits >> 4 & 3) + (arg_bits >> 2 & 3)) * 4; + + /* Output the first two bytes of the relocation. These describe + the length of the relocation and encoding style. */ + bfd_put_8 (abfd, bfd_reloc->howto->type + 10 + + 2 * (sym_num >= 0x100) + (type >= 0x100), + p); + bfd_put_8 (abfd, type, p + 1); + + /* Now output the symbol index and see if this bizarre relocation + just happened to be in the relocation queue. */ + if (sym_num < 0x100) + { + bfd_put_8 (abfd, sym_num, p + 2); + p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 3, queue); + } + else + { + bfd_put_8 (abfd, sym_num >> 16, p + 2); + bfd_put_16 (abfd, (bfd_vma) sym_num, p + 3); + p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 5, queue); + } + } + return p; +} + +/* Return the logarithm of X, base 2, considering X unsigned. + Abort -1 if X is not a power or two or is zero. */ + +static int +log2 (x) + unsigned int x; +{ + int log = 0; + + /* Test for 0 or a power of 2. */ + if (x == 0 || x != (x & -x)) + return -1; + + while ((x >>= 1) != 0) + log++; + return log; +} + +static bfd_reloc_status_type +hppa_som_reloc (abfd, reloc_entry, symbol_in, data, + input_section, output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc_entry; + asymbol *symbol_in ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection *input_section; + bfd *output_bfd; + char **error_message ATTRIBUTE_UNUSED; +{ + if (output_bfd) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + return bfd_reloc_ok; +} + +/* Given a generic HPPA relocation type, the instruction format, + and a field selector, return one or more appropriate SOM relocations. */ + +int ** +hppa_som_gen_reloc_type (abfd, base_type, format, field, sym_diff, sym) + bfd *abfd; + int base_type; + int format; + enum hppa_reloc_field_selector_type_alt field; + int sym_diff; + asymbol *sym; +{ + int *final_type, **final_types; + + final_types = (int **) bfd_alloc (abfd, (bfd_size_type) sizeof (int *) * 6); + final_type = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); + if (!final_types || !final_type) + return NULL; + + /* The field selector may require additional relocations to be + generated. It's impossible to know at this moment if additional + relocations will be needed, so we make them. The code to actually + write the relocation/fixup stream is responsible for removing + any redundant relocations. */ + switch (field) + { + case e_fsel: + case e_psel: + case e_lpsel: + case e_rpsel: + final_types[0] = final_type; + final_types[1] = NULL; + final_types[2] = NULL; + *final_type = base_type; + break; + + case e_tsel: + case e_ltsel: + case e_rtsel: + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); + if (!final_types[0]) + return NULL; + if (field == e_tsel) + *final_types[0] = R_FSEL; + else if (field == e_ltsel) + *final_types[0] = R_LSEL; + else + *final_types[0] = R_RSEL; + final_types[1] = final_type; + final_types[2] = NULL; + *final_type = base_type; + break; + + case e_lssel: + case e_rssel: + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); + if (!final_types[0]) + return NULL; + *final_types[0] = R_S_MODE; + final_types[1] = final_type; + final_types[2] = NULL; + *final_type = base_type; + break; + + case e_lsel: + case e_rsel: + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); + if (!final_types[0]) + return NULL; + *final_types[0] = R_N_MODE; + final_types[1] = final_type; + final_types[2] = NULL; + *final_type = base_type; + break; + + case e_ldsel: + case e_rdsel: + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); + if (!final_types[0]) + return NULL; + *final_types[0] = R_D_MODE; + final_types[1] = final_type; + final_types[2] = NULL; + *final_type = base_type; + break; + + case e_lrsel: + case e_rrsel: + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); + if (!final_types[0]) + return NULL; + *final_types[0] = R_R_MODE; + final_types[1] = final_type; + final_types[2] = NULL; + *final_type = base_type; + break; + + case e_nsel: + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); + if (!final_types[0]) + return NULL; + *final_types[0] = R_N1SEL; + final_types[1] = final_type; + final_types[2] = NULL; + *final_type = base_type; + break; + + case e_nlsel: + case e_nlrsel: + final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); + if (!final_types[0]) + return NULL; + *final_types[0] = R_N0SEL; + final_types[1] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); + if (!final_types[1]) + return NULL; + if (field == e_nlsel) + *final_types[1] = R_N_MODE; + else + *final_types[1] = R_R_MODE; + final_types[2] = final_type; + final_types[3] = NULL; + *final_type = base_type; + break; + } + + switch (base_type) + { + case R_HPPA: + /* The difference of two symbols needs *very* special handling. */ + if (sym_diff) + { + bfd_size_type amt = sizeof (int); + final_types[0] = (int *) bfd_alloc (abfd, amt); + final_types[1] = (int *) bfd_alloc (abfd, amt); + final_types[2] = (int *) bfd_alloc (abfd, amt); + final_types[3] = (int *) bfd_alloc (abfd, amt); + if (!final_types[0] || !final_types[1] || !final_types[2]) + return NULL; + if (field == e_fsel) + *final_types[0] = R_FSEL; + else if (field == e_rsel) + *final_types[0] = R_RSEL; + else if (field == e_lsel) + *final_types[0] = R_LSEL; + *final_types[1] = R_COMP2; + *final_types[2] = R_COMP2; + *final_types[3] = R_COMP1; + final_types[4] = final_type; + if (format == 32) + *final_types[4] = R_DATA_EXPR; + else + *final_types[4] = R_CODE_EXPR; + final_types[5] = NULL; + break; + } + /* PLABELs get their own relocation type. */ + else if (field == e_psel + || field == e_lpsel + || field == e_rpsel) + { + /* A PLABEL relocation that has a size of 32 bits must + be a R_DATA_PLABEL. All others are R_CODE_PLABELs. */ + if (format == 32) + *final_type = R_DATA_PLABEL; + else + *final_type = R_CODE_PLABEL; + } + /* PIC stuff. */ + else if (field == e_tsel + || field == e_ltsel + || field == e_rtsel) + *final_type = R_DLT_REL; + /* A relocation in the data space is always a full 32bits. */ + else if (format == 32) + { + *final_type = R_DATA_ONE_SYMBOL; + + /* If there's no SOM symbol type associated with this BFD + symbol, then set the symbol type to ST_DATA. + + Only do this if the type is going to default later when + we write the object file. + + This is done so that the linker never encounters an + R_DATA_ONE_SYMBOL reloc involving an ST_CODE symbol. + + This allows the compiler to generate exception handling + tables. + + Note that one day we may need to also emit BEGIN_BRTAB and + END_BRTAB to prevent the linker from optimizing away insns + in exception handling regions. */ + if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_UNKNOWN + && (sym->flags & BSF_SECTION_SYM) == 0 + && (sym->flags & BSF_FUNCTION) == 0 + && ! bfd_is_com_section (sym->section)) + som_symbol_data (sym)->som_type = SYMBOL_TYPE_DATA; + } + break; + + case R_HPPA_GOTOFF: + /* More PLABEL special cases. */ + if (field == e_psel + || field == e_lpsel + || field == e_rpsel) + *final_type = R_DATA_PLABEL; + break; + + case R_HPPA_COMPLEX: + /* The difference of two symbols needs *very* special handling. */ + if (sym_diff) + { + bfd_size_type amt = sizeof (int); + final_types[0] = (int *) bfd_alloc (abfd, amt); + final_types[1] = (int *) bfd_alloc (abfd, amt); + final_types[2] = (int *) bfd_alloc (abfd, amt); + final_types[3] = (int *) bfd_alloc (abfd, amt); + if (!final_types[0] || !final_types[1] || !final_types[2]) + return NULL; + if (field == e_fsel) + *final_types[0] = R_FSEL; + else if (field == e_rsel) + *final_types[0] = R_RSEL; + else if (field == e_lsel) + *final_types[0] = R_LSEL; + *final_types[1] = R_COMP2; + *final_types[2] = R_COMP2; + *final_types[3] = R_COMP1; + final_types[4] = final_type; + if (format == 32) + *final_types[4] = R_DATA_EXPR; + else + *final_types[4] = R_CODE_EXPR; + final_types[5] = NULL; + break; + } + else + break; + + case R_HPPA_NONE: + case R_HPPA_ABS_CALL: + /* Right now we can default all these. */ + break; + + case R_HPPA_PCREL_CALL: + { +#ifndef NO_PCREL_MODES + /* If we have short and long pcrel modes, then generate the proper + mode selector, then the pcrel relocation. Redundant selectors + will be eliminated as the relocs are sized and emitted. */ + bfd_size_type amt = sizeof (int); + final_types[0] = (int *) bfd_alloc (abfd, amt); + if (!final_types[0]) + return NULL; + if (format == 17) + *final_types[0] = R_SHORT_PCREL_MODE; + else + *final_types[0] = R_LONG_PCREL_MODE; + final_types[1] = final_type; + final_types[2] = NULL; + *final_type = base_type; +#endif + break; + } + } + return final_types; +} + +/* Return the address of the correct entry in the PA SOM relocation + howto table. */ + +static reloc_howto_type * +som_bfd_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + if ((int) code < (int) R_NO_RELOCATION + 255) + { + BFD_ASSERT ((int) som_hppa_howto_table[(int) code].type == (int) code); + return &som_hppa_howto_table[(int) code]; + } + + return (reloc_howto_type *) 0; +} + +/* Perform some initialization for an object. Save results of this + initialization in the BFD. */ + +static const bfd_target * +som_object_setup (abfd, file_hdrp, aux_hdrp, current_offset) + bfd *abfd; + struct header *file_hdrp; + struct som_exec_auxhdr *aux_hdrp; + unsigned long current_offset; +{ + asection *section; + int found; + + /* som_mkobject will set bfd_error if som_mkobject fails. */ + if (! som_mkobject (abfd)) + return 0; + + /* Set BFD flags based on what information is available in the SOM. */ + abfd->flags = BFD_NO_FLAGS; + if (file_hdrp->symbol_total) + abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; + + switch (file_hdrp->a_magic) + { + case DEMAND_MAGIC: + abfd->flags |= (D_PAGED | WP_TEXT | EXEC_P); + break; + case SHARE_MAGIC: + abfd->flags |= (WP_TEXT | EXEC_P); + break; + case EXEC_MAGIC: + abfd->flags |= (EXEC_P); + break; + case RELOC_MAGIC: + abfd->flags |= HAS_RELOC; + break; +#ifdef SHL_MAGIC + case SHL_MAGIC: +#endif +#ifdef DL_MAGIC + case DL_MAGIC: +#endif + abfd->flags |= DYNAMIC; + break; + + default: + break; + } + + /* Allocate space to hold the saved exec header information. */ + obj_som_exec_data (abfd) = (struct som_exec_data *) + bfd_zalloc (abfd, (bfd_size_type) sizeof (struct som_exec_data)); + if (obj_som_exec_data (abfd) == NULL) + return NULL; + + /* The braindamaged OSF1 linker switched exec_flags and exec_entry! + + We used to identify OSF1 binaries based on NEW_VERSION_ID, but + apparently the latest HPUX linker is using NEW_VERSION_ID now. + + It's about time, OSF has used the new id since at least 1992; + HPUX didn't start till nearly 1995!. + + The new approach examines the entry field. If it's zero or not 4 + byte aligned then it's not a proper code address and we guess it's + really the executable flags. */ + found = 0; + for (section = abfd->sections; section; section = section->next) + { + if ((section->flags & SEC_CODE) == 0) + continue; + if (aux_hdrp->exec_entry >= section->vma + && aux_hdrp->exec_entry < section->vma + section->_cooked_size) + found = 1; + } + if (aux_hdrp->exec_entry == 0 + || (aux_hdrp->exec_entry & 0x3) != 0 + || ! found) + { + bfd_get_start_address (abfd) = aux_hdrp->exec_flags; + obj_som_exec_data (abfd)->exec_flags = aux_hdrp->exec_entry; + } + else + { + bfd_get_start_address (abfd) = aux_hdrp->exec_entry + current_offset; + obj_som_exec_data (abfd)->exec_flags = aux_hdrp->exec_flags; + } + + obj_som_exec_data (abfd)->version_id = file_hdrp->version_id; + + bfd_default_set_arch_mach (abfd, bfd_arch_hppa, pa10); + bfd_get_symcount (abfd) = file_hdrp->symbol_total; + + /* Initialize the saved symbol table and string table to NULL. + Save important offsets and sizes from the SOM header into + the BFD. */ + obj_som_stringtab (abfd) = (char *) NULL; + obj_som_symtab (abfd) = (som_symbol_type *) NULL; + obj_som_sorted_syms (abfd) = NULL; + obj_som_stringtab_size (abfd) = file_hdrp->symbol_strings_size; + obj_som_sym_filepos (abfd) = file_hdrp->symbol_location + current_offset; + obj_som_str_filepos (abfd) = (file_hdrp->symbol_strings_location + + current_offset); + obj_som_reloc_filepos (abfd) = (file_hdrp->fixup_request_location + + current_offset); + obj_som_exec_data (abfd)->system_id = file_hdrp->system_id; + + return abfd->xvec; +} + +/* Convert all of the space and subspace info into BFD sections. Each space + contains a number of subspaces, which in turn describe the mapping between + regions of the exec file, and the address space that the program runs in. + BFD sections which correspond to spaces will overlap the sections for the + associated subspaces. */ + +static bfd_boolean +setup_sections (abfd, file_hdr, current_offset) + bfd *abfd; + struct header *file_hdr; + unsigned long current_offset; +{ + char *space_strings; + unsigned int space_index, i; + unsigned int total_subspaces = 0; + asection **subspace_sections = NULL; + asection *section; + bfd_size_type amt; + + /* First, read in space names. */ + + amt = file_hdr->space_strings_size; + space_strings = bfd_malloc (amt); + if (!space_strings && amt != 0) + goto error_return; + + if (bfd_seek (abfd, current_offset + file_hdr->space_strings_location, + SEEK_SET) != 0) + goto error_return; + if (bfd_bread (space_strings, amt, abfd) != amt) + goto error_return; + + /* Loop over all of the space dictionaries, building up sections. */ + for (space_index = 0; space_index < file_hdr->space_total; space_index++) + { + struct space_dictionary_record space; + struct subspace_dictionary_record subspace, save_subspace; + int subspace_index; + asection *space_asect; + char *newname; + + /* Read the space dictionary element. */ + if (bfd_seek (abfd, + (current_offset + file_hdr->space_location + + space_index * sizeof space), + SEEK_SET) != 0) + goto error_return; + amt = sizeof space; + if (bfd_bread (&space, amt, abfd) != amt) + goto error_return; + + /* Setup the space name string. */ + space.name.n_name = space.name.n_strx + space_strings; + + /* Make a section out of it. */ + amt = strlen (space.name.n_name) + 1; + newname = bfd_alloc (abfd, amt); + if (!newname) + goto error_return; + strcpy (newname, space.name.n_name); + + space_asect = bfd_make_section_anyway (abfd, newname); + if (!space_asect) + goto error_return; + + if (space.is_loadable == 0) + space_asect->flags |= SEC_DEBUGGING; + + /* Set up all the attributes for the space. */ + if (! bfd_som_set_section_attributes (space_asect, space.is_defined, + space.is_private, space.sort_key, + space.space_number)) + goto error_return; + + /* If the space has no subspaces, then we're done. */ + if (space.subspace_quantity == 0) + continue; + + /* Now, read in the first subspace for this space. */ + if (bfd_seek (abfd, + (current_offset + file_hdr->subspace_location + + space.subspace_index * sizeof subspace), + SEEK_SET) != 0) + goto error_return; + amt = sizeof subspace; + if (bfd_bread (&subspace, amt, abfd) != amt) + goto error_return; + /* Seek back to the start of the subspaces for loop below. */ + if (bfd_seek (abfd, + (current_offset + file_hdr->subspace_location + + space.subspace_index * sizeof subspace), + SEEK_SET) != 0) + goto error_return; + + /* Setup the start address and file loc from the first subspace + record. */ + space_asect->vma = subspace.subspace_start; + space_asect->filepos = subspace.file_loc_init_value + current_offset; + space_asect->alignment_power = log2 (subspace.alignment); + if (space_asect->alignment_power == (unsigned) -1) + goto error_return; + + /* Initialize save_subspace so we can reliably determine if this + loop placed any useful values into it. */ + memset (&save_subspace, 0, sizeof (struct subspace_dictionary_record)); + + /* Loop over the rest of the subspaces, building up more sections. */ + for (subspace_index = 0; subspace_index < space.subspace_quantity; + subspace_index++) + { + asection *subspace_asect; + + /* Read in the next subspace. */ + amt = sizeof subspace; + if (bfd_bread (&subspace, amt, abfd) != amt) + goto error_return; + + /* Setup the subspace name string. */ + subspace.name.n_name = subspace.name.n_strx + space_strings; + + amt = strlen (subspace.name.n_name) + 1; + newname = bfd_alloc (abfd, amt); + if (!newname) + goto error_return; + strcpy (newname, subspace.name.n_name); + + /* Make a section out of this subspace. */ + subspace_asect = bfd_make_section_anyway (abfd, newname); + if (!subspace_asect) + goto error_return; + + /* Store private information about the section. */ + if (! bfd_som_set_subsection_attributes (subspace_asect, space_asect, + subspace.access_control_bits, + subspace.sort_key, + subspace.quadrant)) + goto error_return; + + /* Keep an easy mapping between subspaces and sections. + Note we do not necessarily read the subspaces in the + same order in which they appear in the object file. + + So to make the target index come out correctly, we + store the location of the subspace header in target + index, then sort using the location of the subspace + header as the key. Then we can assign correct + subspace indices. */ + total_subspaces++; + subspace_asect->target_index = bfd_tell (abfd) - sizeof (subspace); + + /* Set SEC_READONLY and SEC_CODE/SEC_DATA as specified + by the access_control_bits in the subspace header. */ + switch (subspace.access_control_bits >> 4) + { + /* Readonly data. */ + case 0x0: + subspace_asect->flags |= SEC_DATA | SEC_READONLY; + break; + + /* Normal data. */ + case 0x1: + subspace_asect->flags |= SEC_DATA; + break; + + /* Readonly code and the gateways. + Gateways have other attributes which do not map + into anything BFD knows about. */ + case 0x2: + case 0x4: + case 0x5: + case 0x6: + case 0x7: + subspace_asect->flags |= SEC_CODE | SEC_READONLY; + break; + + /* dynamic (writable) code. */ + case 0x3: + subspace_asect->flags |= SEC_CODE; + break; + } + + if (subspace.dup_common || subspace.is_common) + subspace_asect->flags |= SEC_IS_COMMON; + else if (subspace.subspace_length > 0) + subspace_asect->flags |= SEC_HAS_CONTENTS; + + if (subspace.is_loadable) + subspace_asect->flags |= SEC_ALLOC | SEC_LOAD; + else + subspace_asect->flags |= SEC_DEBUGGING; + + if (subspace.code_only) + subspace_asect->flags |= SEC_CODE; + + /* Both file_loc_init_value and initialization_length will + be zero for a BSS like subspace. */ + if (subspace.file_loc_init_value == 0 + && subspace.initialization_length == 0) + subspace_asect->flags &= ~(SEC_DATA | SEC_LOAD | SEC_HAS_CONTENTS); + + /* This subspace has relocations. + The fixup_request_quantity is a byte count for the number of + entries in the relocation stream; it is not the actual number + of relocations in the subspace. */ + if (subspace.fixup_request_quantity != 0) + { + subspace_asect->flags |= SEC_RELOC; + subspace_asect->rel_filepos = subspace.fixup_request_index; + som_section_data (subspace_asect)->reloc_size + = subspace.fixup_request_quantity; + /* We can not determine this yet. When we read in the + relocation table the correct value will be filled in. */ + subspace_asect->reloc_count = (unsigned) -1; + } + + /* Update save_subspace if appropriate. */ + if (subspace.file_loc_init_value > save_subspace.file_loc_init_value) + save_subspace = subspace; + + subspace_asect->vma = subspace.subspace_start; + subspace_asect->_cooked_size = subspace.subspace_length; + subspace_asect->_raw_size = subspace.subspace_length; + subspace_asect->filepos = (subspace.file_loc_init_value + + current_offset); + subspace_asect->alignment_power = log2 (subspace.alignment); + if (subspace_asect->alignment_power == (unsigned) -1) + goto error_return; + } + + /* This can happen for a .o which defines symbols in otherwise + empty subspaces. */ + if (!save_subspace.file_loc_init_value) + { + space_asect->_cooked_size = 0; + space_asect->_raw_size = 0; + } + else + { + /* Setup the sizes for the space section based upon the info in the + last subspace of the space. */ + space_asect->_cooked_size = (save_subspace.subspace_start + - space_asect->vma + + save_subspace.subspace_length); + space_asect->_raw_size = (save_subspace.file_loc_init_value + - space_asect->filepos + + save_subspace.initialization_length); + } + } + /* Now that we've read in all the subspace records, we need to assign + a target index to each subspace. */ + amt = total_subspaces; + amt *= sizeof (asection *); + subspace_sections = (asection **) bfd_malloc (amt); + if (subspace_sections == NULL) + goto error_return; + + for (i = 0, section = abfd->sections; section; section = section->next) + { + if (!som_is_subspace (section)) + continue; + + subspace_sections[i] = section; + i++; + } + qsort (subspace_sections, total_subspaces, + sizeof (asection *), compare_subspaces); + + /* subspace_sections is now sorted in the order in which the subspaces + appear in the object file. Assign an index to each one now. */ + for (i = 0; i < total_subspaces; i++) + subspace_sections[i]->target_index = i; + + if (space_strings != NULL) + free (space_strings); + + if (subspace_sections != NULL) + free (subspace_sections); + + return TRUE; + + error_return: + if (space_strings != NULL) + free (space_strings); + + if (subspace_sections != NULL) + free (subspace_sections); + return FALSE; +} + +/* Read in a SOM object and make it into a BFD. */ + +static const bfd_target * +som_object_p (abfd) + bfd *abfd; +{ + struct header file_hdr; + struct som_exec_auxhdr aux_hdr; + unsigned long current_offset = 0; + struct lst_header lst_header; + struct som_entry som_entry; + bfd_size_type amt; +#define ENTRY_SIZE sizeof (struct som_entry) + + amt = FILE_HDR_SIZE; + if (bfd_bread ((PTR) &file_hdr, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + if (!_PA_RISC_ID (file_hdr.system_id)) + { + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + switch (file_hdr.a_magic) + { + case RELOC_MAGIC: + case EXEC_MAGIC: + case SHARE_MAGIC: + case DEMAND_MAGIC: +#ifdef DL_MAGIC + case DL_MAGIC: +#endif +#ifdef SHL_MAGIC + case SHL_MAGIC: +#endif +#ifdef SHARED_MAGIC_CNX + case SHARED_MAGIC_CNX: +#endif + break; + +#ifdef EXECLIBMAGIC + case EXECLIBMAGIC: + /* Read the lst header and determine where the SOM directory begins. */ + + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + amt = SLSTHDR; + if (bfd_bread ((PTR) &lst_header, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + /* Position to and read the first directory entry. */ + + if (bfd_seek (abfd, lst_header.dir_loc, SEEK_SET) != 0) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + amt = ENTRY_SIZE; + if (bfd_bread ((PTR) &som_entry, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + /* Now position to the first SOM. */ + + if (bfd_seek (abfd, som_entry.location, SEEK_SET) != 0) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + current_offset = som_entry.location; + + /* And finally, re-read the som header. */ + amt = FILE_HDR_SIZE; + if (bfd_bread ((PTR) &file_hdr, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + break; +#endif + + default: + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + if (file_hdr.version_id != VERSION_ID + && file_hdr.version_id != NEW_VERSION_ID) + { + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + /* If the aux_header_size field in the file header is zero, then this + object is an incomplete executable (a .o file). Do not try to read + a non-existant auxiliary header. */ + memset (&aux_hdr, 0, sizeof (struct som_exec_auxhdr)); + if (file_hdr.aux_header_size != 0) + { + amt = AUX_HDR_SIZE; + if (bfd_bread ((PTR) &aux_hdr, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + } + + if (!setup_sections (abfd, &file_hdr, current_offset)) + { + /* setup_sections does not bubble up a bfd error code. */ + bfd_set_error (bfd_error_bad_value); + return 0; + } + + /* This appears to be a valid SOM object. Do some initialization. */ + return som_object_setup (abfd, &file_hdr, &aux_hdr, current_offset); +} + +/* Create a SOM object. */ + +static bfd_boolean +som_mkobject (abfd) + bfd *abfd; +{ + /* Allocate memory to hold backend information. */ + abfd->tdata.som_data = (struct som_data_struct *) + bfd_zalloc (abfd, (bfd_size_type) sizeof (struct som_data_struct)); + if (abfd->tdata.som_data == NULL) + return FALSE; + return TRUE; +} + +/* Initialize some information in the file header. This routine makes + not attempt at doing the right thing for a full executable; it + is only meant to handle relocatable objects. */ + +static bfd_boolean +som_prep_headers (abfd) + bfd *abfd; +{ + struct header *file_hdr; + asection *section; + bfd_size_type amt = sizeof (struct header); + + /* Make and attach a file header to the BFD. */ + file_hdr = (struct header *) bfd_zalloc (abfd, amt); + if (file_hdr == NULL) + return FALSE; + obj_som_file_hdr (abfd) = file_hdr; + + if (abfd->flags & (EXEC_P | DYNAMIC)) + { + /* Make and attach an exec header to the BFD. */ + amt = sizeof (struct som_exec_auxhdr); + obj_som_exec_hdr (abfd) = + (struct som_exec_auxhdr *) bfd_zalloc (abfd, amt); + if (obj_som_exec_hdr (abfd) == NULL) + return FALSE; + + if (abfd->flags & D_PAGED) + file_hdr->a_magic = DEMAND_MAGIC; + else if (abfd->flags & WP_TEXT) + file_hdr->a_magic = SHARE_MAGIC; +#ifdef SHL_MAGIC + else if (abfd->flags & DYNAMIC) + file_hdr->a_magic = SHL_MAGIC; +#endif + else + file_hdr->a_magic = EXEC_MAGIC; + } + else + file_hdr->a_magic = RELOC_MAGIC; + + /* These fields are optional, and embedding timestamps is not always + a wise thing to do, it makes comparing objects during a multi-stage + bootstrap difficult. */ + file_hdr->file_time.secs = 0; + file_hdr->file_time.nanosecs = 0; + + file_hdr->entry_space = 0; + file_hdr->entry_subspace = 0; + file_hdr->entry_offset = 0; + file_hdr->presumed_dp = 0; + + /* Now iterate over the sections translating information from + BFD sections to SOM spaces/subspaces. */ + + for (section = abfd->sections; section != NULL; section = section->next) + { + /* Ignore anything which has not been marked as a space or + subspace. */ + if (!som_is_space (section) && !som_is_subspace (section)) + continue; + + if (som_is_space (section)) + { + /* Allocate space for the space dictionary. */ + amt = sizeof (struct space_dictionary_record); + som_section_data (section)->space_dict = + (struct space_dictionary_record *) bfd_zalloc (abfd, amt); + if (som_section_data (section)->space_dict == NULL) + return FALSE; + /* Set space attributes. Note most attributes of SOM spaces + are set based on the subspaces it contains. */ + som_section_data (section)->space_dict->loader_fix_index = -1; + som_section_data (section)->space_dict->init_pointer_index = -1; + + /* Set more attributes that were stuffed away in private data. */ + som_section_data (section)->space_dict->sort_key = + som_section_data (section)->copy_data->sort_key; + som_section_data (section)->space_dict->is_defined = + som_section_data (section)->copy_data->is_defined; + som_section_data (section)->space_dict->is_private = + som_section_data (section)->copy_data->is_private; + som_section_data (section)->space_dict->space_number = + som_section_data (section)->copy_data->space_number; + } + else + { + /* Allocate space for the subspace dictionary. */ + amt = sizeof (struct subspace_dictionary_record); + som_section_data (section)->subspace_dict = + (struct subspace_dictionary_record *) bfd_zalloc (abfd, amt); + if (som_section_data (section)->subspace_dict == NULL) + return FALSE; + + /* Set subspace attributes. Basic stuff is done here, additional + attributes are filled in later as more information becomes + available. */ + if (section->flags & SEC_IS_COMMON) + { + som_section_data (section)->subspace_dict->dup_common = 1; + som_section_data (section)->subspace_dict->is_common = 1; + } + + if (section->flags & SEC_ALLOC) + som_section_data (section)->subspace_dict->is_loadable = 1; + + if (section->flags & SEC_CODE) + som_section_data (section)->subspace_dict->code_only = 1; + + som_section_data (section)->subspace_dict->subspace_start = + section->vma; + som_section_data (section)->subspace_dict->subspace_length = + bfd_section_size (abfd, section); + som_section_data (section)->subspace_dict->initialization_length = + bfd_section_size (abfd, section); + som_section_data (section)->subspace_dict->alignment = + 1 << section->alignment_power; + + /* Set more attributes that were stuffed away in private data. */ + som_section_data (section)->subspace_dict->sort_key = + som_section_data (section)->copy_data->sort_key; + som_section_data (section)->subspace_dict->access_control_bits = + som_section_data (section)->copy_data->access_control_bits; + som_section_data (section)->subspace_dict->quadrant = + som_section_data (section)->copy_data->quadrant; + } + } + return TRUE; +} + +/* Return TRUE if the given section is a SOM space, FALSE otherwise. */ + +static bfd_boolean +som_is_space (section) + asection *section; +{ + /* If no copy data is available, then it's neither a space nor a + subspace. */ + if (som_section_data (section)->copy_data == NULL) + return FALSE; + + /* If the containing space isn't the same as the given section, + then this isn't a space. */ + if (som_section_data (section)->copy_data->container != section + && (som_section_data (section)->copy_data->container->output_section + != section)) + return FALSE; + + /* OK. Must be a space. */ + return TRUE; +} + +/* Return TRUE if the given section is a SOM subspace, FALSE otherwise. */ + +static bfd_boolean +som_is_subspace (section) + asection *section; +{ + /* If no copy data is available, then it's neither a space nor a + subspace. */ + if (som_section_data (section)->copy_data == NULL) + return FALSE; + + /* If the containing space is the same as the given section, + then this isn't a subspace. */ + if (som_section_data (section)->copy_data->container == section + || (som_section_data (section)->copy_data->container->output_section + == section)) + return FALSE; + + /* OK. Must be a subspace. */ + return TRUE; +} + +/* Return TRUE if the given space contains the given subspace. It + is safe to assume space really is a space, and subspace really + is a subspace. */ + +static bfd_boolean +som_is_container (space, subspace) + asection *space, *subspace; +{ + return (som_section_data (subspace)->copy_data->container == space + || (som_section_data (subspace)->copy_data->container->output_section + == space)); +} + +/* Count and return the number of spaces attached to the given BFD. */ + +static unsigned long +som_count_spaces (abfd) + bfd *abfd; +{ + int count = 0; + asection *section; + + for (section = abfd->sections; section != NULL; section = section->next) + count += som_is_space (section); + + return count; +} + +/* Count the number of subspaces attached to the given BFD. */ + +static unsigned long +som_count_subspaces (abfd) + bfd *abfd; +{ + int count = 0; + asection *section; + + for (section = abfd->sections; section != NULL; section = section->next) + count += som_is_subspace (section); + + return count; +} + +/* Return -1, 0, 1 indicating the relative ordering of sym1 and sym2. + + We desire symbols to be ordered starting with the symbol with the + highest relocation count down to the symbol with the lowest relocation + count. Doing so compacts the relocation stream. */ + +static int +compare_syms (arg1, arg2) + const PTR arg1; + const PTR arg2; + +{ + asymbol **sym1 = (asymbol **) arg1; + asymbol **sym2 = (asymbol **) arg2; + unsigned int count1, count2; + + /* Get relocation count for each symbol. Note that the count + is stored in the udata pointer for section symbols! */ + if ((*sym1)->flags & BSF_SECTION_SYM) + count1 = (*sym1)->udata.i; + else + count1 = som_symbol_data (*sym1)->reloc_count; + + if ((*sym2)->flags & BSF_SECTION_SYM) + count2 = (*sym2)->udata.i; + else + count2 = som_symbol_data (*sym2)->reloc_count; + + /* Return the appropriate value. */ + if (count1 < count2) + return 1; + else if (count1 > count2) + return -1; + return 0; +} + +/* Return -1, 0, 1 indicating the relative ordering of subspace1 + and subspace. */ + +static int +compare_subspaces (arg1, arg2) + const PTR arg1; + const PTR arg2; + +{ + asection **subspace1 = (asection **) arg1; + asection **subspace2 = (asection **) arg2; + + if ((*subspace1)->target_index < (*subspace2)->target_index) + return -1; + else if ((*subspace2)->target_index < (*subspace1)->target_index) + return 1; + else + return 0; +} + +/* Perform various work in preparation for emitting the fixup stream. */ + +static void +som_prep_for_fixups (abfd, syms, num_syms) + bfd *abfd; + asymbol **syms; + unsigned long num_syms; +{ + unsigned long i; + asection *section; + asymbol **sorted_syms; + bfd_size_type amt; + + /* Most SOM relocations involving a symbol have a length which is + dependent on the index of the symbol. So symbols which are + used often in relocations should have a small index. */ + + /* First initialize the counters for each symbol. */ + for (i = 0; i < num_syms; i++) + { + /* Handle a section symbol; these have no pointers back to the + SOM symbol info. So we just use the udata field to hold the + relocation count. */ + if (som_symbol_data (syms[i]) == NULL + || syms[i]->flags & BSF_SECTION_SYM) + { + syms[i]->flags |= BSF_SECTION_SYM; + syms[i]->udata.i = 0; + } + else + som_symbol_data (syms[i])->reloc_count = 0; + } + + /* Now that the counters are initialized, make a weighted count + of how often a given symbol is used in a relocation. */ + for (section = abfd->sections; section != NULL; section = section->next) + { + int j; + + /* Does this section have any relocations? */ + if ((int) section->reloc_count <= 0) + continue; + + /* Walk through each relocation for this section. */ + for (j = 1; j < (int) section->reloc_count; j++) + { + arelent *reloc = section->orelocation[j]; + int scale; + + /* A relocation against a symbol in the *ABS* section really + does not have a symbol. Likewise if the symbol isn't associated + with any section. */ + if (reloc->sym_ptr_ptr == NULL + || bfd_is_abs_section ((*reloc->sym_ptr_ptr)->section)) + continue; + + /* Scaling to encourage symbols involved in R_DP_RELATIVE + and R_CODE_ONE_SYMBOL relocations to come first. These + two relocations have single byte versions if the symbol + index is very small. */ + if (reloc->howto->type == R_DP_RELATIVE + || reloc->howto->type == R_CODE_ONE_SYMBOL) + scale = 2; + else + scale = 1; + + /* Handle section symbols by storing the count in the udata + field. It will not be used and the count is very important + for these symbols. */ + if ((*reloc->sym_ptr_ptr)->flags & BSF_SECTION_SYM) + { + (*reloc->sym_ptr_ptr)->udata.i = + (*reloc->sym_ptr_ptr)->udata.i + scale; + continue; + } + + /* A normal symbol. Increment the count. */ + som_symbol_data (*reloc->sym_ptr_ptr)->reloc_count += scale; + } + } + + /* Sort a copy of the symbol table, rather than the canonical + output symbol table. */ + amt = num_syms; + amt *= sizeof (asymbol *); + sorted_syms = (asymbol **) bfd_zalloc (abfd, amt); + memcpy (sorted_syms, syms, num_syms * sizeof (asymbol *)); + qsort (sorted_syms, num_syms, sizeof (asymbol *), compare_syms); + obj_som_sorted_syms (abfd) = sorted_syms; + + /* Compute the symbol indexes, they will be needed by the relocation + code. */ + for (i = 0; i < num_syms; i++) + { + /* A section symbol. Again, there is no pointer to backend symbol + information, so we reuse the udata field again. */ + if (sorted_syms[i]->flags & BSF_SECTION_SYM) + sorted_syms[i]->udata.i = i; + else + som_symbol_data (sorted_syms[i])->index = i; + } +} + +static bfd_boolean +som_write_fixups (abfd, current_offset, total_reloc_sizep) + bfd *abfd; + unsigned long current_offset; + unsigned int *total_reloc_sizep; +{ + unsigned int i, j; + /* Chunk of memory that we can use as buffer space, then throw + away. */ + unsigned char tmp_space[SOM_TMP_BUFSIZE]; + unsigned char *p; + unsigned int total_reloc_size = 0; + unsigned int subspace_reloc_size = 0; + unsigned int num_spaces = obj_som_file_hdr (abfd)->space_total; + asection *section = abfd->sections; + bfd_size_type amt; + + memset (tmp_space, 0, SOM_TMP_BUFSIZE); + p = tmp_space; + + /* All the fixups for a particular subspace are emitted in a single + stream. All the subspaces for a particular space are emitted + as a single stream. + + So, to get all the locations correct one must iterate through all the + spaces, for each space iterate through its subspaces and output a + fixups stream. */ + for (i = 0; i < num_spaces; i++) + { + asection *subsection; + + /* Find a space. */ + while (!som_is_space (section)) + section = section->next; + + /* Now iterate through each of its subspaces. */ + for (subsection = abfd->sections; + subsection != NULL; + subsection = subsection->next) + { + int reloc_offset; + unsigned int current_rounding_mode; +#ifndef NO_PCREL_MODES + int current_call_mode; +#endif + + /* Find a subspace of this space. */ + if (!som_is_subspace (subsection) + || !som_is_container (section, subsection)) + continue; + + /* If this subspace does not have real data, then we are + finished with it. */ + if ((subsection->flags & SEC_HAS_CONTENTS) == 0) + { + som_section_data (subsection)->subspace_dict->fixup_request_index + = -1; + continue; + } + + /* This subspace has some relocations. Put the relocation stream + index into the subspace record. */ + som_section_data (subsection)->subspace_dict->fixup_request_index + = total_reloc_size; + + /* To make life easier start over with a clean slate for + each subspace. Seek to the start of the relocation stream + for this subspace in preparation for writing out its fixup + stream. */ + if (bfd_seek (abfd, current_offset + total_reloc_size, SEEK_SET) != 0) + return FALSE; + + /* Buffer space has already been allocated. Just perform some + initialization here. */ + p = tmp_space; + subspace_reloc_size = 0; + reloc_offset = 0; + som_initialize_reloc_queue (reloc_queue); + current_rounding_mode = R_N_MODE; +#ifndef NO_PCREL_MODES + current_call_mode = R_SHORT_PCREL_MODE; +#endif + + /* Translate each BFD relocation into one or more SOM + relocations. */ + for (j = 0; j < subsection->reloc_count; j++) + { + arelent *bfd_reloc = subsection->orelocation[j]; + unsigned int skip; + int sym_num; + + /* Get the symbol number. Remember it's stored in a + special place for section symbols. */ + if ((*bfd_reloc->sym_ptr_ptr)->flags & BSF_SECTION_SYM) + sym_num = (*bfd_reloc->sym_ptr_ptr)->udata.i; + else + sym_num = som_symbol_data (*bfd_reloc->sym_ptr_ptr)->index; + + /* If there is not enough room for the next couple relocations, + then dump the current buffer contents now. Also reinitialize + the relocation queue. + + No single BFD relocation could ever translate into more + than 100 bytes of SOM relocations (20bytes is probably the + upper limit, but leave lots of space for growth). */ + if (p - tmp_space + 100 > SOM_TMP_BUFSIZE) + { + amt = p - tmp_space; + if (bfd_bwrite ((PTR) tmp_space, amt, abfd) != amt) + return FALSE; + + p = tmp_space; + som_initialize_reloc_queue (reloc_queue); + } + + /* Emit R_NO_RELOCATION fixups to map any bytes which were + skipped. */ + skip = bfd_reloc->address - reloc_offset; + p = som_reloc_skip (abfd, skip, p, + &subspace_reloc_size, reloc_queue); + + /* Update reloc_offset for the next iteration. + + Many relocations do not consume input bytes. They + are markers, or set state necessary to perform some + later relocation. */ + switch (bfd_reloc->howto->type) + { + case R_ENTRY: + case R_ALT_ENTRY: + case R_EXIT: + case R_N_MODE: + case R_S_MODE: + case R_D_MODE: + case R_R_MODE: + case R_FSEL: + case R_LSEL: + case R_RSEL: + case R_COMP1: + case R_COMP2: + case R_BEGIN_BRTAB: + case R_END_BRTAB: + case R_BEGIN_TRY: + case R_END_TRY: + case R_N0SEL: + case R_N1SEL: +#ifndef NO_PCREL_MODES + case R_SHORT_PCREL_MODE: + case R_LONG_PCREL_MODE: +#endif + reloc_offset = bfd_reloc->address; + break; + + default: + reloc_offset = bfd_reloc->address + 4; + break; + } + + /* Now the actual relocation we care about. */ + switch (bfd_reloc->howto->type) + { + case R_PCREL_CALL: + case R_ABS_CALL: + p = som_reloc_call (abfd, p, &subspace_reloc_size, + bfd_reloc, sym_num, reloc_queue); + break; + + case R_CODE_ONE_SYMBOL: + case R_DP_RELATIVE: + /* Account for any addend. */ + if (bfd_reloc->addend) + p = som_reloc_addend (abfd, bfd_reloc->addend, p, + &subspace_reloc_size, reloc_queue); + + if (sym_num < 0x20) + { + bfd_put_8 (abfd, bfd_reloc->howto->type + sym_num, p); + subspace_reloc_size += 1; + p += 1; + } + else if (sym_num < 0x100) + { + bfd_put_8 (abfd, bfd_reloc->howto->type + 32, p); + bfd_put_8 (abfd, sym_num, p + 1); + p = try_prev_fixup (abfd, &subspace_reloc_size, p, + 2, reloc_queue); + } + else if (sym_num < 0x10000000) + { + bfd_put_8 (abfd, bfd_reloc->howto->type + 33, p); + bfd_put_8 (abfd, sym_num >> 16, p + 1); + bfd_put_16 (abfd, (bfd_vma) sym_num, p + 2); + p = try_prev_fixup (abfd, &subspace_reloc_size, + p, 4, reloc_queue); + } + else + abort (); + break; + + case R_DATA_ONE_SYMBOL: + case R_DATA_PLABEL: + case R_CODE_PLABEL: + case R_DLT_REL: + /* Account for any addend using R_DATA_OVERRIDE. */ + if (bfd_reloc->howto->type != R_DATA_ONE_SYMBOL + && bfd_reloc->addend) + p = som_reloc_addend (abfd, bfd_reloc->addend, p, + &subspace_reloc_size, reloc_queue); + + if (sym_num < 0x100) + { + bfd_put_8 (abfd, bfd_reloc->howto->type, p); + bfd_put_8 (abfd, sym_num, p + 1); + p = try_prev_fixup (abfd, &subspace_reloc_size, p, + 2, reloc_queue); + } + else if (sym_num < 0x10000000) + { + bfd_put_8 (abfd, bfd_reloc->howto->type + 1, p); + bfd_put_8 (abfd, sym_num >> 16, p + 1); + bfd_put_16 (abfd, (bfd_vma) sym_num, p + 2); + p = try_prev_fixup (abfd, &subspace_reloc_size, + p, 4, reloc_queue); + } + else + abort (); + break; + + case R_ENTRY: + { + unsigned int tmp; + arelent *tmp_reloc = NULL; + bfd_put_8 (abfd, R_ENTRY, p); + + /* R_ENTRY relocations have 64 bits of associated + data. Unfortunately the addend field of a bfd + relocation is only 32 bits. So, we split up + the 64bit unwind information and store part in + the R_ENTRY relocation, and the rest in the R_EXIT + relocation. */ + bfd_put_32 (abfd, bfd_reloc->addend, p + 1); + + /* Find the next R_EXIT relocation. */ + for (tmp = j; tmp < subsection->reloc_count; tmp++) + { + tmp_reloc = subsection->orelocation[tmp]; + if (tmp_reloc->howto->type == R_EXIT) + break; + } + + if (tmp == subsection->reloc_count) + abort (); + + bfd_put_32 (abfd, tmp_reloc->addend, p + 5); + p = try_prev_fixup (abfd, &subspace_reloc_size, + p, 9, reloc_queue); + break; + } + + case R_N_MODE: + case R_S_MODE: + case R_D_MODE: + case R_R_MODE: + /* If this relocation requests the current rounding + mode, then it is redundant. */ + if (bfd_reloc->howto->type != current_rounding_mode) + { + bfd_put_8 (abfd, bfd_reloc->howto->type, p); + subspace_reloc_size += 1; + p += 1; + current_rounding_mode = bfd_reloc->howto->type; + } + break; + +#ifndef NO_PCREL_MODES + case R_LONG_PCREL_MODE: + case R_SHORT_PCREL_MODE: + if (bfd_reloc->howto->type != current_call_mode) + { + bfd_put_8 (abfd, bfd_reloc->howto->type, p); + subspace_reloc_size += 1; + p += 1; + current_call_mode = bfd_reloc->howto->type; + } + break; +#endif + + case R_EXIT: + case R_ALT_ENTRY: + case R_FSEL: + case R_LSEL: + case R_RSEL: + case R_BEGIN_BRTAB: + case R_END_BRTAB: + case R_BEGIN_TRY: + case R_N0SEL: + case R_N1SEL: + bfd_put_8 (abfd, bfd_reloc->howto->type, p); + subspace_reloc_size += 1; + p += 1; + break; + + case R_END_TRY: + /* The end of an exception handling region. The reloc's + addend contains the offset of the exception handling + code. */ + if (bfd_reloc->addend == 0) + bfd_put_8 (abfd, bfd_reloc->howto->type, p); + else if (bfd_reloc->addend < 1024) + { + bfd_put_8 (abfd, bfd_reloc->howto->type + 1, p); + bfd_put_8 (abfd, bfd_reloc->addend / 4, p + 1); + p = try_prev_fixup (abfd, &subspace_reloc_size, + p, 2, reloc_queue); + } + else + { + bfd_put_8 (abfd, bfd_reloc->howto->type + 2, p); + bfd_put_8 (abfd, (bfd_reloc->addend / 4) >> 16, p + 1); + bfd_put_16 (abfd, bfd_reloc->addend / 4, p + 2); + p = try_prev_fixup (abfd, &subspace_reloc_size, + p, 4, reloc_queue); + } + break; + + case R_COMP1: + /* The only time we generate R_COMP1, R_COMP2 and + R_CODE_EXPR relocs is for the difference of two + symbols. Hence we can cheat here. */ + bfd_put_8 (abfd, bfd_reloc->howto->type, p); + bfd_put_8 (abfd, 0x44, p + 1); + p = try_prev_fixup (abfd, &subspace_reloc_size, + p, 2, reloc_queue); + break; + + case R_COMP2: + /* The only time we generate R_COMP1, R_COMP2 and + R_CODE_EXPR relocs is for the difference of two + symbols. Hence we can cheat here. */ + bfd_put_8 (abfd, bfd_reloc->howto->type, p); + bfd_put_8 (abfd, 0x80, p + 1); + bfd_put_8 (abfd, sym_num >> 16, p + 2); + bfd_put_16 (abfd, (bfd_vma) sym_num, p + 3); + p = try_prev_fixup (abfd, &subspace_reloc_size, + p, 5, reloc_queue); + break; + + case R_CODE_EXPR: + case R_DATA_EXPR: + /* The only time we generate R_COMP1, R_COMP2 and + R_CODE_EXPR relocs is for the difference of two + symbols. Hence we can cheat here. */ + bfd_put_8 (abfd, bfd_reloc->howto->type, p); + subspace_reloc_size += 1; + p += 1; + break; + + /* Put a "R_RESERVED" relocation in the stream if + we hit something we do not understand. The linker + will complain loudly if this ever happens. */ + default: + bfd_put_8 (abfd, 0xff, p); + subspace_reloc_size += 1; + p += 1; + break; + } + } + + /* Last BFD relocation for a subspace has been processed. + Map the rest of the subspace with R_NO_RELOCATION fixups. */ + p = som_reloc_skip (abfd, (bfd_section_size (abfd, subsection) + - reloc_offset), + p, &subspace_reloc_size, reloc_queue); + + /* Scribble out the relocations. */ + amt = p - tmp_space; + if (bfd_bwrite ((PTR) tmp_space, amt, abfd) != amt) + return FALSE; + p = tmp_space; + + total_reloc_size += subspace_reloc_size; + som_section_data (subsection)->subspace_dict->fixup_request_quantity + = subspace_reloc_size; + } + section = section->next; + } + *total_reloc_sizep = total_reloc_size; + return TRUE; +} + +/* Write out the space/subspace string table. */ + +static bfd_boolean +som_write_space_strings (abfd, current_offset, string_sizep) + bfd *abfd; + unsigned long current_offset; + unsigned int *string_sizep; +{ + /* Chunk of memory that we can use as buffer space, then throw + away. */ + size_t tmp_space_size = SOM_TMP_BUFSIZE; + unsigned char *tmp_space = alloca (tmp_space_size); + unsigned char *p = tmp_space; + unsigned int strings_size = 0; + asection *section; + bfd_size_type amt; + + /* Seek to the start of the space strings in preparation for writing + them out. */ + if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) + return FALSE; + + /* Walk through all the spaces and subspaces (order is not important) + building up and writing string table entries for their names. */ + for (section = abfd->sections; section != NULL; section = section->next) + { + size_t length; + + /* Only work with space/subspaces; avoid any other sections + which might have been made (.text for example). */ + if (!som_is_space (section) && !som_is_subspace (section)) + continue; + + /* Get the length of the space/subspace name. */ + length = strlen (section->name); + + /* If there is not enough room for the next entry, then dump the + current buffer contents now and maybe allocate a larger + buffer. Each entry will take 4 bytes to hold the string + length + the string itself + null terminator. */ + if (p - tmp_space + 5 + length > tmp_space_size) + { + /* Flush buffer before refilling or reallocating. */ + amt = p - tmp_space; + if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) + return FALSE; + + /* Reallocate if now empty buffer still too small. */ + if (5 + length > tmp_space_size) + { + /* Ensure a minimum growth factor to avoid O(n**2) space + consumption for n strings. The optimal minimum + factor seems to be 2, as no other value can guarantee + wasting less than 50% space. (Note that we cannot + deallocate space allocated by `alloca' without + returning from this function.) The same technique is + used a few more times below when a buffer is + reallocated. */ + tmp_space_size = MAX (2 * tmp_space_size, 5 + length); + tmp_space = alloca (tmp_space_size); + } + + /* Reset to beginning of the (possibly new) buffer space. */ + p = tmp_space; + } + + /* First element in a string table entry is the length of the + string. Alignment issues are already handled. */ + bfd_put_32 (abfd, (bfd_vma) length, p); + p += 4; + strings_size += 4; + + /* Record the index in the space/subspace records. */ + if (som_is_space (section)) + som_section_data (section)->space_dict->name.n_strx = strings_size; + else + som_section_data (section)->subspace_dict->name.n_strx = strings_size; + + /* Next comes the string itself + a null terminator. */ + strcpy (p, section->name); + p += length + 1; + strings_size += length + 1; + + /* Always align up to the next word boundary. */ + while (strings_size % 4) + { + bfd_put_8 (abfd, 0, p); + p++; + strings_size++; + } + } + + /* Done with the space/subspace strings. Write out any information + contained in a partial block. */ + amt = p - tmp_space; + if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) + return FALSE; + *string_sizep = strings_size; + return TRUE; +} + +/* Write out the symbol string table. */ + +static bfd_boolean +som_write_symbol_strings (abfd, current_offset, syms, num_syms, string_sizep, + compilation_unit) + bfd *abfd; + unsigned long current_offset; + asymbol **syms; + unsigned int num_syms; + unsigned int *string_sizep; + COMPUNIT *compilation_unit; +{ + unsigned int i; + + /* Chunk of memory that we can use as buffer space, then throw + away. */ + size_t tmp_space_size = SOM_TMP_BUFSIZE; + unsigned char *tmp_space = alloca (tmp_space_size); + unsigned char *p = tmp_space; + + unsigned int strings_size = 0; + unsigned char *comp[4]; + bfd_size_type amt; + + /* This gets a bit gruesome because of the compilation unit. The + strings within the compilation unit are part of the symbol + strings, but don't have symbol_dictionary entries. So, manually + write them and update the compilation unit header. On input, the + compilation unit header contains local copies of the strings. + Move them aside. */ + if (compilation_unit) + { + comp[0] = compilation_unit->name.n_name; + comp[1] = compilation_unit->language_name.n_name; + comp[2] = compilation_unit->product_id.n_name; + comp[3] = compilation_unit->version_id.n_name; + } + + /* Seek to the start of the space strings in preparation for writing + them out. */ + if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) + return FALSE; + + if (compilation_unit) + { + for (i = 0; i < 4; i++) + { + size_t length = strlen (comp[i]); + + /* If there is not enough room for the next entry, then dump + the current buffer contents now and maybe allocate a + larger buffer. */ + if (p - tmp_space + 5 + length > tmp_space_size) + { + /* Flush buffer before refilling or reallocating. */ + amt = p - tmp_space; + if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) + return FALSE; + + /* Reallocate if now empty buffer still too small. */ + if (5 + length > tmp_space_size) + { + /* See alloca above for discussion of new size. */ + tmp_space_size = MAX (2 * tmp_space_size, 5 + length); + tmp_space = alloca (tmp_space_size); + } + + /* Reset to beginning of the (possibly new) buffer + space. */ + p = tmp_space; + } + + /* First element in a string table entry is the length of + the string. This must always be 4 byte aligned. This is + also an appropriate time to fill in the string index + field in the symbol table entry. */ + bfd_put_32 (abfd, (bfd_vma) length, p); + strings_size += 4; + p += 4; + + /* Next comes the string itself + a null terminator. */ + strcpy (p, comp[i]); + + switch (i) + { + case 0: + obj_som_compilation_unit (abfd)->name.n_strx = strings_size; + break; + case 1: + obj_som_compilation_unit (abfd)->language_name.n_strx = + strings_size; + break; + case 2: + obj_som_compilation_unit (abfd)->product_id.n_strx = + strings_size; + break; + case 3: + obj_som_compilation_unit (abfd)->version_id.n_strx = + strings_size; + break; + } + + p += length + 1; + strings_size += length + 1; + + /* Always align up to the next word boundary. */ + while (strings_size % 4) + { + bfd_put_8 (abfd, 0, p); + strings_size++; + p++; + } + } + } + + for (i = 0; i < num_syms; i++) + { + size_t length = strlen (syms[i]->name); + + /* If there is not enough room for the next entry, then dump the + current buffer contents now and maybe allocate a larger buffer. */ + if (p - tmp_space + 5 + length > tmp_space_size) + { + /* Flush buffer before refilling or reallocating. */ + amt = p - tmp_space; + if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) + return FALSE; + + /* Reallocate if now empty buffer still too small. */ + if (5 + length > tmp_space_size) + { + /* See alloca above for discussion of new size. */ + tmp_space_size = MAX (2 * tmp_space_size, 5 + length); + tmp_space = alloca (tmp_space_size); + } + + /* Reset to beginning of the (possibly new) buffer space. */ + p = tmp_space; + } + + /* First element in a string table entry is the length of the + string. This must always be 4 byte aligned. This is also + an appropriate time to fill in the string index field in the + symbol table entry. */ + bfd_put_32 (abfd, (bfd_vma) length, p); + strings_size += 4; + p += 4; + + /* Next comes the string itself + a null terminator. */ + strcpy (p, syms[i]->name); + + som_symbol_data (syms[i])->stringtab_offset = strings_size; + p += length + 1; + strings_size += length + 1; + + /* Always align up to the next word boundary. */ + while (strings_size % 4) + { + bfd_put_8 (abfd, 0, p); + strings_size++; + p++; + } + } + + /* Scribble out any partial block. */ + amt = p - tmp_space; + if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) + return FALSE; + + *string_sizep = strings_size; + return TRUE; +} + +/* Compute variable information to be placed in the SOM headers, + space/subspace dictionaries, relocation streams, etc. Begin + writing parts of the object file. */ + +static bfd_boolean +som_begin_writing (abfd) + bfd *abfd; +{ + unsigned long current_offset = 0; + int strings_size = 0; + unsigned long num_spaces, num_subspaces, i; + asection *section; + unsigned int total_subspaces = 0; + struct som_exec_auxhdr *exec_header = NULL; + + /* The file header will always be first in an object file, + everything else can be in random locations. To keep things + "simple" BFD will lay out the object file in the manner suggested + by the PRO ABI for PA-RISC Systems. */ + + /* Before any output can really begin offsets for all the major + portions of the object file must be computed. So, starting + with the initial file header compute (and sometimes write) + each portion of the object file. */ + + /* Make room for the file header, it's contents are not complete + yet, so it can not be written at this time. */ + current_offset += sizeof (struct header); + + /* Any auxiliary headers will follow the file header. Right now + we support only the copyright and version headers. */ + obj_som_file_hdr (abfd)->aux_header_location = current_offset; + obj_som_file_hdr (abfd)->aux_header_size = 0; + if (abfd->flags & (EXEC_P | DYNAMIC)) + { + /* Parts of the exec header will be filled in later, so + delay writing the header itself. Fill in the defaults, + and write it later. */ + current_offset += sizeof (struct som_exec_auxhdr); + obj_som_file_hdr (abfd)->aux_header_size + += sizeof (struct som_exec_auxhdr); + exec_header = obj_som_exec_hdr (abfd); + exec_header->som_auxhdr.type = EXEC_AUX_ID; + exec_header->som_auxhdr.length = 40; + } + if (obj_som_version_hdr (abfd) != NULL) + { + bfd_size_type len; + + if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) + return FALSE; + + /* Write the aux_id structure and the string length. */ + len = sizeof (struct aux_id) + sizeof (unsigned int); + obj_som_file_hdr (abfd)->aux_header_size += len; + current_offset += len; + if (bfd_bwrite ((PTR) obj_som_version_hdr (abfd), len, abfd) != len) + return FALSE; + + /* Write the version string. */ + len = obj_som_version_hdr (abfd)->header_id.length - sizeof (int); + obj_som_file_hdr (abfd)->aux_header_size += len; + current_offset += len; + if (bfd_bwrite ((PTR) obj_som_version_hdr (abfd)->user_string, len, abfd) + != len) + return FALSE; + } + + if (obj_som_copyright_hdr (abfd) != NULL) + { + bfd_size_type len; + + if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) + return FALSE; + + /* Write the aux_id structure and the string length. */ + len = sizeof (struct aux_id) + sizeof (unsigned int); + obj_som_file_hdr (abfd)->aux_header_size += len; + current_offset += len; + if (bfd_bwrite ((PTR) obj_som_copyright_hdr (abfd), len, abfd) != len) + return FALSE; + + /* Write the copyright string. */ + len = obj_som_copyright_hdr (abfd)->header_id.length - sizeof (int); + obj_som_file_hdr (abfd)->aux_header_size += len; + current_offset += len; + if (bfd_bwrite ((PTR) obj_som_copyright_hdr (abfd)->copyright, len, abfd) + != len) + return FALSE; + } + + /* Next comes the initialization pointers; we have no initialization + pointers, so current offset does not change. */ + obj_som_file_hdr (abfd)->init_array_location = current_offset; + obj_som_file_hdr (abfd)->init_array_total = 0; + + /* Next are the space records. These are fixed length records. + + Count the number of spaces to determine how much room is needed + in the object file for the space records. + + The names of the spaces are stored in a separate string table, + and the index for each space into the string table is computed + below. Therefore, it is not possible to write the space headers + at this time. */ + num_spaces = som_count_spaces (abfd); + obj_som_file_hdr (abfd)->space_location = current_offset; + obj_som_file_hdr (abfd)->space_total = num_spaces; + current_offset += num_spaces * sizeof (struct space_dictionary_record); + + /* Next are the subspace records. These are fixed length records. + + Count the number of subspaes to determine how much room is needed + in the object file for the subspace records. + + A variety if fields in the subspace record are still unknown at + this time (index into string table, fixup stream location/size, etc). */ + num_subspaces = som_count_subspaces (abfd); + obj_som_file_hdr (abfd)->subspace_location = current_offset; + obj_som_file_hdr (abfd)->subspace_total = num_subspaces; + current_offset += num_subspaces * sizeof (struct subspace_dictionary_record); + + /* Next is the string table for the space/subspace names. We will + build and write the string table on the fly. At the same time + we will fill in the space/subspace name index fields. */ + + /* The string table needs to be aligned on a word boundary. */ + if (current_offset % 4) + current_offset += (4 - (current_offset % 4)); + + /* Mark the offset of the space/subspace string table in the + file header. */ + obj_som_file_hdr (abfd)->space_strings_location = current_offset; + + /* Scribble out the space strings. */ + if (! som_write_space_strings (abfd, current_offset, &strings_size)) + return FALSE; + + /* Record total string table size in the header and update the + current offset. */ + obj_som_file_hdr (abfd)->space_strings_size = strings_size; + current_offset += strings_size; + + /* Next is the compilation unit. */ + obj_som_file_hdr (abfd)->compiler_location = current_offset; + obj_som_file_hdr (abfd)->compiler_total = 0; + if (obj_som_compilation_unit (abfd)) + { + obj_som_file_hdr (abfd)->compiler_total = 1; + current_offset += COMPUNITSZ; + } + + /* Now compute the file positions for the loadable subspaces, taking + care to make sure everything stays properly aligned. */ + + section = abfd->sections; + for (i = 0; i < num_spaces; i++) + { + asection *subsection; + int first_subspace; + unsigned int subspace_offset = 0; + + /* Find a space. */ + while (!som_is_space (section)) + section = section->next; + + first_subspace = 1; + /* Now look for all its subspaces. */ + for (subsection = abfd->sections; + subsection != NULL; + subsection = subsection->next) + { + + if (!som_is_subspace (subsection) + || !som_is_container (section, subsection) + || (subsection->flags & SEC_ALLOC) == 0) + continue; + + /* If this is the first subspace in the space, and we are + building an executable, then take care to make sure all + the alignments are correct and update the exec header. */ + if (first_subspace + && (abfd->flags & (EXEC_P | DYNAMIC))) + { + /* Demand paged executables have each space aligned to a + page boundary. Sharable executables (write-protected + text) have just the private (aka data & bss) space aligned + to a page boundary. Ugh. Not true for HPUX. + + The HPUX kernel requires the text to always be page aligned + within the file regardless of the executable's type. */ + if (abfd->flags & (D_PAGED | DYNAMIC) + || (subsection->flags & SEC_CODE) + || ((abfd->flags & WP_TEXT) + && (subsection->flags & SEC_DATA))) + current_offset = SOM_ALIGN (current_offset, PA_PAGESIZE); + + /* Update the exec header. */ + if (subsection->flags & SEC_CODE && exec_header->exec_tfile == 0) + { + exec_header->exec_tmem = section->vma; + exec_header->exec_tfile = current_offset; + } + if (subsection->flags & SEC_DATA && exec_header->exec_dfile == 0) + { + exec_header->exec_dmem = section->vma; + exec_header->exec_dfile = current_offset; + } + + /* Keep track of exactly where we are within a particular + space. This is necessary as the braindamaged HPUX + loader will create holes between subspaces *and* + subspace alignments are *NOT* preserved. What a crock. */ + subspace_offset = subsection->vma; + + /* Only do this for the first subspace within each space. */ + first_subspace = 0; + } + else if (abfd->flags & (EXEC_P | DYNAMIC)) + { + /* The braindamaged HPUX loader may have created a hole + between two subspaces. It is *not* sufficient to use + the alignment specifications within the subspaces to + account for these holes -- I've run into at least one + case where the loader left one code subspace unaligned + in a final executable. + + To combat this we keep a current offset within each space, + and use the subspace vma fields to detect and preserve + holes. What a crock! + + ps. This is not necessary for unloadable space/subspaces. */ + current_offset += subsection->vma - subspace_offset; + if (subsection->flags & SEC_CODE) + exec_header->exec_tsize += subsection->vma - subspace_offset; + else + exec_header->exec_dsize += subsection->vma - subspace_offset; + subspace_offset += subsection->vma - subspace_offset; + } + + subsection->target_index = total_subspaces++; + /* This is real data to be loaded from the file. */ + if (subsection->flags & SEC_LOAD) + { + /* Update the size of the code & data. */ + if (abfd->flags & (EXEC_P | DYNAMIC) + && subsection->flags & SEC_CODE) + exec_header->exec_tsize += subsection->_cooked_size; + else if (abfd->flags & (EXEC_P | DYNAMIC) + && subsection->flags & SEC_DATA) + exec_header->exec_dsize += subsection->_cooked_size; + som_section_data (subsection)->subspace_dict->file_loc_init_value + = current_offset; + subsection->filepos = current_offset; + current_offset += bfd_section_size (abfd, subsection); + subspace_offset += bfd_section_size (abfd, subsection); + } + /* Looks like uninitialized data. */ + else + { + /* Update the size of the bss section. */ + if (abfd->flags & (EXEC_P | DYNAMIC)) + exec_header->exec_bsize += subsection->_cooked_size; + + som_section_data (subsection)->subspace_dict->file_loc_init_value + = 0; + som_section_data (subsection)->subspace_dict-> + initialization_length = 0; + } + } + /* Goto the next section. */ + section = section->next; + } + + /* Finally compute the file positions for unloadable subspaces. + If building an executable, start the unloadable stuff on its + own page. */ + + if (abfd->flags & (EXEC_P | DYNAMIC)) + current_offset = SOM_ALIGN (current_offset, PA_PAGESIZE); + + obj_som_file_hdr (abfd)->unloadable_sp_location = current_offset; + section = abfd->sections; + for (i = 0; i < num_spaces; i++) + { + asection *subsection; + + /* Find a space. */ + while (!som_is_space (section)) + section = section->next; + + if (abfd->flags & (EXEC_P | DYNAMIC)) + current_offset = SOM_ALIGN (current_offset, PA_PAGESIZE); + + /* Now look for all its subspaces. */ + for (subsection = abfd->sections; + subsection != NULL; + subsection = subsection->next) + { + + if (!som_is_subspace (subsection) + || !som_is_container (section, subsection) + || (subsection->flags & SEC_ALLOC) != 0) + continue; + + subsection->target_index = total_subspaces++; + /* This is real data to be loaded from the file. */ + if ((subsection->flags & SEC_LOAD) == 0) + { + som_section_data (subsection)->subspace_dict->file_loc_init_value + = current_offset; + subsection->filepos = current_offset; + current_offset += bfd_section_size (abfd, subsection); + } + /* Looks like uninitialized data. */ + else + { + som_section_data (subsection)->subspace_dict->file_loc_init_value + = 0; + som_section_data (subsection)->subspace_dict-> + initialization_length = bfd_section_size (abfd, subsection); + } + } + /* Goto the next section. */ + section = section->next; + } + + /* If building an executable, then make sure to seek to and write + one byte at the end of the file to make sure any necessary + zeros are filled in. Ugh. */ + if (abfd->flags & (EXEC_P | DYNAMIC)) + current_offset = SOM_ALIGN (current_offset, PA_PAGESIZE); + if (bfd_seek (abfd, (file_ptr) current_offset - 1, SEEK_SET) != 0) + return FALSE; + if (bfd_bwrite ((PTR) "", (bfd_size_type) 1, abfd) != 1) + return FALSE; + + obj_som_file_hdr (abfd)->unloadable_sp_size + = current_offset - obj_som_file_hdr (abfd)->unloadable_sp_location; + + /* Loader fixups are not supported in any way shape or form. */ + obj_som_file_hdr (abfd)->loader_fixup_location = 0; + obj_som_file_hdr (abfd)->loader_fixup_total = 0; + + /* Done. Store the total size of the SOM so far. */ + obj_som_file_hdr (abfd)->som_length = current_offset; + + return TRUE; +} + +/* Finally, scribble out the various headers to the disk. */ + +static bfd_boolean +som_finish_writing (abfd) + bfd *abfd; +{ + int num_spaces = som_count_spaces (abfd); + asymbol **syms = bfd_get_outsymbols (abfd); + int i, num_syms, strings_size; + int subspace_index = 0; + file_ptr location; + asection *section; + unsigned long current_offset; + unsigned int total_reloc_size; + bfd_size_type amt; + + /* We must set up the version identifier here as objcopy/strip copy + private BFD data too late for us to handle this in som_begin_writing. */ + if (obj_som_exec_data (abfd) + && obj_som_exec_data (abfd)->version_id) + obj_som_file_hdr (abfd)->version_id = obj_som_exec_data (abfd)->version_id; + else + obj_som_file_hdr (abfd)->version_id = NEW_VERSION_ID; + + /* Next is the symbol table. These are fixed length records. + + Count the number of symbols to determine how much room is needed + in the object file for the symbol table. + + The names of the symbols are stored in a separate string table, + and the index for each symbol name into the string table is computed + below. Therefore, it is not possible to write the symbol table + at this time. + + These used to be output before the subspace contents, but they + were moved here to work around a stupid bug in the hpux linker + (fixed in hpux10). */ + current_offset = obj_som_file_hdr (abfd)->som_length; + + /* Make sure we're on a word boundary. */ + if (current_offset % 4) + current_offset += (4 - (current_offset % 4)); + + num_syms = bfd_get_symcount (abfd); + obj_som_file_hdr (abfd)->symbol_location = current_offset; + obj_som_file_hdr (abfd)->symbol_total = num_syms; + current_offset += num_syms * sizeof (struct symbol_dictionary_record); + + /* Next are the symbol strings. + Align them to a word boundary. */ + if (current_offset % 4) + current_offset += (4 - (current_offset % 4)); + obj_som_file_hdr (abfd)->symbol_strings_location = current_offset; + + /* Scribble out the symbol strings. */ + if (! som_write_symbol_strings (abfd, current_offset, syms, + num_syms, &strings_size, + obj_som_compilation_unit (abfd))) + return FALSE; + + /* Record total string table size in header and update the + current offset. */ + obj_som_file_hdr (abfd)->symbol_strings_size = strings_size; + current_offset += strings_size; + + /* Do prep work before handling fixups. */ + som_prep_for_fixups (abfd, + bfd_get_outsymbols (abfd), + bfd_get_symcount (abfd)); + + /* At the end of the file is the fixup stream which starts on a + word boundary. */ + if (current_offset % 4) + current_offset += (4 - (current_offset % 4)); + obj_som_file_hdr (abfd)->fixup_request_location = current_offset; + + /* Write the fixups and update fields in subspace headers which + relate to the fixup stream. */ + if (! som_write_fixups (abfd, current_offset, &total_reloc_size)) + return FALSE; + + /* Record the total size of the fixup stream in the file header. */ + obj_som_file_hdr (abfd)->fixup_request_total = total_reloc_size; + + /* Done. Store the total size of the SOM. */ + obj_som_file_hdr (abfd)->som_length = current_offset + total_reloc_size; + + /* Now that the symbol table information is complete, build and + write the symbol table. */ + if (! som_build_and_write_symbol_table (abfd)) + return FALSE; + + /* Subspaces are written first so that we can set up information + about them in their containing spaces as the subspace is written. */ + + /* Seek to the start of the subspace dictionary records. */ + location = obj_som_file_hdr (abfd)->subspace_location; + if (bfd_seek (abfd, location, SEEK_SET) != 0) + return FALSE; + + section = abfd->sections; + /* Now for each loadable space write out records for its subspaces. */ + for (i = 0; i < num_spaces; i++) + { + asection *subsection; + + /* Find a space. */ + while (!som_is_space (section)) + section = section->next; + + /* Now look for all its subspaces. */ + for (subsection = abfd->sections; + subsection != NULL; + subsection = subsection->next) + { + + /* Skip any section which does not correspond to a space + or subspace. Or does not have SEC_ALLOC set (and therefore + has no real bits on the disk). */ + if (!som_is_subspace (subsection) + || !som_is_container (section, subsection) + || (subsection->flags & SEC_ALLOC) == 0) + continue; + + /* If this is the first subspace for this space, then save + the index of the subspace in its containing space. Also + set "is_loadable" in the containing space. */ + + if (som_section_data (section)->space_dict->subspace_quantity == 0) + { + som_section_data (section)->space_dict->is_loadable = 1; + som_section_data (section)->space_dict->subspace_index + = subspace_index; + } + + /* Increment the number of subspaces seen and the number of + subspaces contained within the current space. */ + subspace_index++; + som_section_data (section)->space_dict->subspace_quantity++; + + /* Mark the index of the current space within the subspace's + dictionary record. */ + som_section_data (subsection)->subspace_dict->space_index = i; + + /* Dump the current subspace header. */ + amt = sizeof (struct subspace_dictionary_record); + if (bfd_bwrite ((PTR) som_section_data (subsection)->subspace_dict, + amt, abfd) != amt) + return FALSE; + } + /* Goto the next section. */ + section = section->next; + } + + /* Now repeat the process for unloadable subspaces. */ + section = abfd->sections; + /* Now for each space write out records for its subspaces. */ + for (i = 0; i < num_spaces; i++) + { + asection *subsection; + + /* Find a space. */ + while (!som_is_space (section)) + section = section->next; + + /* Now look for all its subspaces. */ + for (subsection = abfd->sections; + subsection != NULL; + subsection = subsection->next) + { + + /* Skip any section which does not correspond to a space or + subspace, or which SEC_ALLOC set (and therefore handled + in the loadable spaces/subspaces code above). */ + + if (!som_is_subspace (subsection) + || !som_is_container (section, subsection) + || (subsection->flags & SEC_ALLOC) != 0) + continue; + + /* If this is the first subspace for this space, then save + the index of the subspace in its containing space. Clear + "is_loadable". */ + + if (som_section_data (section)->space_dict->subspace_quantity == 0) + { + som_section_data (section)->space_dict->is_loadable = 0; + som_section_data (section)->space_dict->subspace_index + = subspace_index; + } + + /* Increment the number of subspaces seen and the number of + subspaces contained within the current space. */ + som_section_data (section)->space_dict->subspace_quantity++; + subspace_index++; + + /* Mark the index of the current space within the subspace's + dictionary record. */ + som_section_data (subsection)->subspace_dict->space_index = i; + + /* Dump this subspace header. */ + amt = sizeof (struct subspace_dictionary_record); + if (bfd_bwrite ((PTR) som_section_data (subsection)->subspace_dict, + amt, abfd) != amt) + return FALSE; + } + /* Goto the next section. */ + section = section->next; + } + + /* All the subspace dictionary records are written, and all the + fields are set up in the space dictionary records. + + Seek to the right location and start writing the space + dictionary records. */ + location = obj_som_file_hdr (abfd)->space_location; + if (bfd_seek (abfd, location, SEEK_SET) != 0) + return FALSE; + + section = abfd->sections; + for (i = 0; i < num_spaces; i++) + { + /* Find a space. */ + while (!som_is_space (section)) + section = section->next; + + /* Dump its header. */ + amt = sizeof (struct space_dictionary_record); + if (bfd_bwrite ((PTR) som_section_data (section)->space_dict, + amt, abfd) != amt) + return FALSE; + + /* Goto the next section. */ + section = section->next; + } + + /* Write the compilation unit record if there is one. */ + if (obj_som_compilation_unit (abfd)) + { + location = obj_som_file_hdr (abfd)->compiler_location; + if (bfd_seek (abfd, location, SEEK_SET) != 0) + return FALSE; + + amt = COMPUNITSZ; + if (bfd_bwrite ((PTR) obj_som_compilation_unit (abfd), amt, abfd) != amt) + return FALSE; + } + + /* Setting of the system_id has to happen very late now that copying of + BFD private data happens *after* section contents are set. */ + if (abfd->flags & (EXEC_P | DYNAMIC)) + obj_som_file_hdr (abfd)->system_id = obj_som_exec_data (abfd)->system_id; + else if (bfd_get_mach (abfd) == pa20) + obj_som_file_hdr (abfd)->system_id = CPU_PA_RISC2_0; + else if (bfd_get_mach (abfd) == pa11) + obj_som_file_hdr (abfd)->system_id = CPU_PA_RISC1_1; + else + obj_som_file_hdr (abfd)->system_id = CPU_PA_RISC1_0; + + /* Compute the checksum for the file header just before writing + the header to disk. */ + obj_som_file_hdr (abfd)->checksum = som_compute_checksum (abfd); + + /* Only thing left to do is write out the file header. It is always + at location zero. Seek there and write it. */ + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + return FALSE; + amt = sizeof (struct header); + if (bfd_bwrite ((PTR) obj_som_file_hdr (abfd), amt, abfd) != amt) + return FALSE; + + /* Now write the exec header. */ + if (abfd->flags & (EXEC_P | DYNAMIC)) + { + long tmp, som_length; + struct som_exec_auxhdr *exec_header; + + exec_header = obj_som_exec_hdr (abfd); + exec_header->exec_entry = bfd_get_start_address (abfd); + exec_header->exec_flags = obj_som_exec_data (abfd)->exec_flags; + + /* Oh joys. Ram some of the BSS data into the DATA section + to be compatible with how the hp linker makes objects + (saves memory space). */ + tmp = exec_header->exec_dsize; + tmp = SOM_ALIGN (tmp, PA_PAGESIZE); + exec_header->exec_bsize -= (tmp - exec_header->exec_dsize); + if (exec_header->exec_bsize < 0) + exec_header->exec_bsize = 0; + exec_header->exec_dsize = tmp; + + /* Now perform some sanity checks. The idea is to catch bogons now and + inform the user, instead of silently generating a bogus file. */ + som_length = obj_som_file_hdr (abfd)->som_length; + if (exec_header->exec_tfile + exec_header->exec_tsize > som_length + || exec_header->exec_dfile + exec_header->exec_dsize > som_length) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + if (bfd_seek (abfd, obj_som_file_hdr (abfd)->aux_header_location, + SEEK_SET) != 0) + return FALSE; + + amt = AUX_HDR_SIZE; + if (bfd_bwrite ((PTR) exec_header, amt, abfd) != amt) + return FALSE; + } + return TRUE; +} + +/* Compute and return the checksum for a SOM file header. */ + +static unsigned long +som_compute_checksum (abfd) + bfd *abfd; +{ + unsigned long checksum, count, i; + unsigned long *buffer = (unsigned long *) obj_som_file_hdr (abfd); + + checksum = 0; + count = sizeof (struct header) / sizeof (unsigned long); + for (i = 0; i < count; i++) + checksum ^= *(buffer + i); + + return checksum; +} + +static void +som_bfd_derive_misc_symbol_info (abfd, sym, info) + bfd *abfd ATTRIBUTE_UNUSED; + asymbol *sym; + struct som_misc_symbol_info *info; +{ + /* Initialize. */ + memset (info, 0, sizeof (struct som_misc_symbol_info)); + + /* The HP SOM linker requires detailed type information about + all symbols (including undefined symbols!). Unfortunately, + the type specified in an import/export statement does not + always match what the linker wants. Severe braindamage. */ + + /* Section symbols will not have a SOM symbol type assigned to + them yet. Assign all section symbols type ST_DATA. */ + if (sym->flags & BSF_SECTION_SYM) + info->symbol_type = ST_DATA; + else + { + /* Common symbols must have scope SS_UNSAT and type + ST_STORAGE or the linker will choke. */ + if (bfd_is_com_section (sym->section)) + { + info->symbol_scope = SS_UNSAT; + info->symbol_type = ST_STORAGE; + } + + /* It is possible to have a symbol without an associated + type. This happens if the user imported the symbol + without a type and the symbol was never defined + locally. If BSF_FUNCTION is set for this symbol, then + assign it type ST_CODE (the HP linker requires undefined + external functions to have type ST_CODE rather than ST_ENTRY). */ + else if ((som_symbol_data (sym)->som_type == SYMBOL_TYPE_UNKNOWN + || som_symbol_data (sym)->som_type == SYMBOL_TYPE_CODE) + && bfd_is_und_section (sym->section) + && sym->flags & BSF_FUNCTION) + info->symbol_type = ST_CODE; + + /* Handle function symbols which were defined in this file. + They should have type ST_ENTRY. Also retrieve the argument + relocation bits from the SOM backend information. */ + else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_ENTRY + || (som_symbol_data (sym)->som_type == SYMBOL_TYPE_CODE + && (sym->flags & BSF_FUNCTION)) + || (som_symbol_data (sym)->som_type == SYMBOL_TYPE_UNKNOWN + && (sym->flags & BSF_FUNCTION))) + { + info->symbol_type = ST_ENTRY; + info->arg_reloc = som_symbol_data (sym)->tc_data.ap.hppa_arg_reloc; + info->priv_level= som_symbol_data (sym)->tc_data.ap.hppa_priv_level; + } + + /* For unknown symbols set the symbol's type based on the symbol's + section (ST_DATA for DATA sections, ST_CODE for CODE sections). */ + else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_UNKNOWN) + { + if (sym->section->flags & SEC_CODE) + info->symbol_type = ST_CODE; + else + info->symbol_type = ST_DATA; + } + + else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_UNKNOWN) + info->symbol_type = ST_DATA; + + /* From now on it's a very simple mapping. */ + else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_ABSOLUTE) + info->symbol_type = ST_ABSOLUTE; + else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_CODE) + info->symbol_type = ST_CODE; + else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_DATA) + info->symbol_type = ST_DATA; + else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_MILLICODE) + info->symbol_type = ST_MILLICODE; + else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_PLABEL) + info->symbol_type = ST_PLABEL; + else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_PRI_PROG) + info->symbol_type = ST_PRI_PROG; + else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_SEC_PROG) + info->symbol_type = ST_SEC_PROG; + } + + /* Now handle the symbol's scope. Exported data which is not + in the common section has scope SS_UNIVERSAL. Note scope + of common symbols was handled earlier! */ + if (bfd_is_und_section (sym->section)) + info->symbol_scope = SS_UNSAT; + else if (sym->flags & (BSF_EXPORT | BSF_WEAK) + && ! bfd_is_com_section (sym->section)) + info->symbol_scope = SS_UNIVERSAL; + /* Anything else which is not in the common section has scope + SS_LOCAL. */ + else if (! bfd_is_com_section (sym->section)) + info->symbol_scope = SS_LOCAL; + + /* Now set the symbol_info field. It has no real meaning + for undefined or common symbols, but the HP linker will + choke if it's not set to some "reasonable" value. We + use zero as a reasonable value. */ + if (bfd_is_com_section (sym->section) + || bfd_is_und_section (sym->section) + || bfd_is_abs_section (sym->section)) + info->symbol_info = 0; + /* For all other symbols, the symbol_info field contains the + subspace index of the space this symbol is contained in. */ + else + info->symbol_info = sym->section->target_index; + + /* Set the symbol's value. */ + info->symbol_value = sym->value + sym->section->vma; + + /* The secondary_def field is for weak symbols. */ + if (sym->flags & BSF_WEAK) + info->secondary_def = TRUE; + else + info->secondary_def = FALSE; + +} + +/* Build and write, in one big chunk, the entire symbol table for + this BFD. */ + +static bfd_boolean +som_build_and_write_symbol_table (abfd) + bfd *abfd; +{ + unsigned int num_syms = bfd_get_symcount (abfd); + file_ptr symtab_location = obj_som_file_hdr (abfd)->symbol_location; + asymbol **bfd_syms = obj_som_sorted_syms (abfd); + struct symbol_dictionary_record *som_symtab = NULL; + unsigned int i; + bfd_size_type symtab_size; + + /* Compute total symbol table size and allocate a chunk of memory + to hold the symbol table as we build it. */ + symtab_size = num_syms; + symtab_size *= sizeof (struct symbol_dictionary_record); + som_symtab = (struct symbol_dictionary_record *) bfd_zmalloc (symtab_size); + if (som_symtab == NULL && symtab_size != 0) + goto error_return; + + /* Walk over each symbol. */ + for (i = 0; i < num_syms; i++) + { + struct som_misc_symbol_info info; + + /* This is really an index into the symbol strings table. + By the time we get here, the index has already been + computed and stored into the name field in the BFD symbol. */ + som_symtab[i].name.n_strx = som_symbol_data(bfd_syms[i])->stringtab_offset; + + /* Derive SOM information from the BFD symbol. */ + som_bfd_derive_misc_symbol_info (abfd, bfd_syms[i], &info); + + /* Now use it. */ + som_symtab[i].symbol_type = info.symbol_type; + som_symtab[i].symbol_scope = info.symbol_scope; + som_symtab[i].arg_reloc = info.arg_reloc; + som_symtab[i].symbol_info = info.symbol_info; + som_symtab[i].xleast = 3; + som_symtab[i].symbol_value = info.symbol_value | info.priv_level; + som_symtab[i].secondary_def = info.secondary_def; + } + + /* Everything is ready, seek to the right location and + scribble out the symbol table. */ + if (bfd_seek (abfd, symtab_location, SEEK_SET) != 0) + return FALSE; + + if (bfd_bwrite ((PTR) som_symtab, symtab_size, abfd) != symtab_size) + goto error_return; + + if (som_symtab != NULL) + free (som_symtab); + return TRUE; + error_return: + if (som_symtab != NULL) + free (som_symtab); + return FALSE; +} + +/* Write an object in SOM format. */ + +static bfd_boolean +som_write_object_contents (abfd) + bfd *abfd; +{ + if (! abfd->output_has_begun) + { + /* Set up fixed parts of the file, space, and subspace headers. + Notify the world that output has begun. */ + som_prep_headers (abfd); + abfd->output_has_begun = TRUE; + /* Start writing the object file. This include all the string + tables, fixup streams, and other portions of the object file. */ + som_begin_writing (abfd); + } + + return (som_finish_writing (abfd)); +} + +/* Read and save the string table associated with the given BFD. */ + +static bfd_boolean +som_slurp_string_table (abfd) + bfd *abfd; +{ + char *stringtab; + bfd_size_type amt; + + /* Use the saved version if its available. */ + if (obj_som_stringtab (abfd) != NULL) + return TRUE; + + /* I don't think this can currently happen, and I'm not sure it should + really be an error, but it's better than getting unpredictable results + from the host's malloc when passed a size of zero. */ + if (obj_som_stringtab_size (abfd) == 0) + { + bfd_set_error (bfd_error_no_symbols); + return FALSE; + } + + /* Allocate and read in the string table. */ + amt = obj_som_stringtab_size (abfd); + stringtab = bfd_zmalloc (amt); + if (stringtab == NULL) + return FALSE; + + if (bfd_seek (abfd, obj_som_str_filepos (abfd), SEEK_SET) != 0) + return FALSE; + + if (bfd_bread (stringtab, amt, abfd) != amt) + return FALSE; + + /* Save our results and return success. */ + obj_som_stringtab (abfd) = stringtab; + return TRUE; +} + +/* Return the amount of data (in bytes) required to hold the symbol + table for this object. */ + +static long +som_get_symtab_upper_bound (abfd) + bfd *abfd; +{ + if (!som_slurp_symbol_table (abfd)) + return -1; + + return (bfd_get_symcount (abfd) + 1) * (sizeof (asymbol *)); +} + +/* Convert from a SOM subspace index to a BFD section. */ + +static asection * +bfd_section_from_som_symbol (abfd, symbol) + bfd *abfd; + struct symbol_dictionary_record *symbol; +{ + asection *section; + + /* The meaning of the symbol_info field changes for functions + within executables. So only use the quick symbol_info mapping for + incomplete objects and non-function symbols in executables. */ + if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 + || (symbol->symbol_type != ST_ENTRY + && symbol->symbol_type != ST_PRI_PROG + && symbol->symbol_type != ST_SEC_PROG + && symbol->symbol_type != ST_MILLICODE)) + { + unsigned int index = symbol->symbol_info; + for (section = abfd->sections; section != NULL; section = section->next) + if (section->target_index == index && som_is_subspace (section)) + return section; + + /* Could be a symbol from an external library (such as an OMOS + shared library). Don't abort. */ + return bfd_abs_section_ptr; + + } + else + { + unsigned int value = symbol->symbol_value; + + /* For executables we will have to use the symbol's address and + find out what section would contain that address. Yuk. */ + for (section = abfd->sections; section; section = section->next) + { + if (value >= section->vma + && value <= section->vma + section->_cooked_size + && som_is_subspace (section)) + return section; + } + + /* Could be a symbol from an external library (such as an OMOS + shared library). Don't abort. */ + return bfd_abs_section_ptr; + + } +} + +/* Read and save the symbol table associated with the given BFD. */ + +static unsigned int +som_slurp_symbol_table (abfd) + bfd *abfd; +{ + int symbol_count = bfd_get_symcount (abfd); + int symsize = sizeof (struct symbol_dictionary_record); + char *stringtab; + struct symbol_dictionary_record *buf = NULL, *bufp, *endbufp; + som_symbol_type *sym, *symbase; + bfd_size_type amt; + + /* Return saved value if it exists. */ + if (obj_som_symtab (abfd) != NULL) + goto successful_return; + + /* Special case. This is *not* an error. */ + if (symbol_count == 0) + goto successful_return; + + if (!som_slurp_string_table (abfd)) + goto error_return; + + stringtab = obj_som_stringtab (abfd); + + amt = symbol_count; + amt *= sizeof (som_symbol_type); + symbase = (som_symbol_type *) bfd_zmalloc (amt); + if (symbase == NULL) + goto error_return; + + /* Read in the external SOM representation. */ + amt = symbol_count; + amt *= symsize; + buf = bfd_malloc (amt); + if (buf == NULL && amt != 0) + goto error_return; + if (bfd_seek (abfd, obj_som_sym_filepos (abfd), SEEK_SET) != 0) + goto error_return; + if (bfd_bread (buf, amt, abfd) != amt) + goto error_return; + + /* Iterate over all the symbols and internalize them. */ + endbufp = buf + symbol_count; + for (bufp = buf, sym = symbase; bufp < endbufp; ++bufp) + { + + /* I don't think we care about these. */ + if (bufp->symbol_type == ST_SYM_EXT + || bufp->symbol_type == ST_ARG_EXT) + continue; + + /* Set some private data we care about. */ + if (bufp->symbol_type == ST_NULL) + som_symbol_data (sym)->som_type = SYMBOL_TYPE_UNKNOWN; + else if (bufp->symbol_type == ST_ABSOLUTE) + som_symbol_data (sym)->som_type = SYMBOL_TYPE_ABSOLUTE; + else if (bufp->symbol_type == ST_DATA) + som_symbol_data (sym)->som_type = SYMBOL_TYPE_DATA; + else if (bufp->symbol_type == ST_CODE) + som_symbol_data (sym)->som_type = SYMBOL_TYPE_CODE; + else if (bufp->symbol_type == ST_PRI_PROG) + som_symbol_data (sym)->som_type = SYMBOL_TYPE_PRI_PROG; + else if (bufp->symbol_type == ST_SEC_PROG) + som_symbol_data (sym)->som_type = SYMBOL_TYPE_SEC_PROG; + else if (bufp->symbol_type == ST_ENTRY) + som_symbol_data (sym)->som_type = SYMBOL_TYPE_ENTRY; + else if (bufp->symbol_type == ST_MILLICODE) + som_symbol_data (sym)->som_type = SYMBOL_TYPE_MILLICODE; + else if (bufp->symbol_type == ST_PLABEL) + som_symbol_data (sym)->som_type = SYMBOL_TYPE_PLABEL; + else + som_symbol_data (sym)->som_type = SYMBOL_TYPE_UNKNOWN; + som_symbol_data (sym)->tc_data.ap.hppa_arg_reloc = bufp->arg_reloc; + + /* Some reasonable defaults. */ + sym->symbol.the_bfd = abfd; + sym->symbol.name = bufp->name.n_strx + stringtab; + sym->symbol.value = bufp->symbol_value; + sym->symbol.section = 0; + sym->symbol.flags = 0; + + switch (bufp->symbol_type) + { + case ST_ENTRY: + case ST_MILLICODE: + sym->symbol.flags |= BSF_FUNCTION; + som_symbol_data (sym)->tc_data.ap.hppa_priv_level = + sym->symbol.value & 0x3; + sym->symbol.value &= ~0x3; + break; + + case ST_STUB: + case ST_CODE: + case ST_PRI_PROG: + case ST_SEC_PROG: + som_symbol_data (sym)->tc_data.ap.hppa_priv_level = + sym->symbol.value & 0x3; + sym->symbol.value &= ~0x3; + /* If the symbol's scope is SS_UNSAT, then these are + undefined function symbols. */ + if (bufp->symbol_scope == SS_UNSAT) + sym->symbol.flags |= BSF_FUNCTION; + + default: + break; + } + + /* Handle scoping and section information. */ + switch (bufp->symbol_scope) + { + /* symbol_info field is undefined for SS_EXTERNAL and SS_UNSAT symbols, + so the section associated with this symbol can't be known. */ + case SS_EXTERNAL: + if (bufp->symbol_type != ST_STORAGE) + sym->symbol.section = bfd_und_section_ptr; + else + sym->symbol.section = bfd_com_section_ptr; + sym->symbol.flags |= (BSF_EXPORT | BSF_GLOBAL); + break; + + case SS_UNSAT: + if (bufp->symbol_type != ST_STORAGE) + sym->symbol.section = bfd_und_section_ptr; + else + sym->symbol.section = bfd_com_section_ptr; + break; + + case SS_UNIVERSAL: + sym->symbol.flags |= (BSF_EXPORT | BSF_GLOBAL); + sym->symbol.section = bfd_section_from_som_symbol (abfd, bufp); + sym->symbol.value -= sym->symbol.section->vma; + break; + +#if 0 + /* SS_GLOBAL and SS_LOCAL are two names for the same thing. + Sound dumb? It is. */ + case SS_GLOBAL: +#endif + case SS_LOCAL: + sym->symbol.flags |= BSF_LOCAL; + sym->symbol.section = bfd_section_from_som_symbol (abfd, bufp); + sym->symbol.value -= sym->symbol.section->vma; + break; + } + + /* Check for a weak symbol. */ + if (bufp->secondary_def) + sym->symbol.flags |= BSF_WEAK; + + /* Mark section symbols and symbols used by the debugger. + Note $START$ is a magic code symbol, NOT a section symbol. */ + if (sym->symbol.name[0] == '$' + && sym->symbol.name[strlen (sym->symbol.name) - 1] == '$' + && !strcmp (sym->symbol.name, sym->symbol.section->name)) + sym->symbol.flags |= BSF_SECTION_SYM; + else if (!strncmp (sym->symbol.name, "L$0\002", 4)) + { + sym->symbol.flags |= BSF_SECTION_SYM; + sym->symbol.name = sym->symbol.section->name; + } + else if (!strncmp (sym->symbol.name, "L$0\001", 4)) + sym->symbol.flags |= BSF_DEBUGGING; + + /* Note increment at bottom of loop, since we skip some symbols + we can not include it as part of the for statement. */ + sym++; + } + + /* We modify the symbol count to record the number of BFD symbols we + created. */ + bfd_get_symcount (abfd) = sym - symbase; + + /* Save our results and return success. */ + obj_som_symtab (abfd) = symbase; + successful_return: + if (buf != NULL) + free (buf); + return (TRUE); + + error_return: + if (buf != NULL) + free (buf); + return FALSE; +} + +/* Canonicalize a SOM symbol table. Return the number of entries + in the symbol table. */ + +static long +som_canonicalize_symtab (abfd, location) + bfd *abfd; + asymbol **location; +{ + int i; + som_symbol_type *symbase; + + if (!som_slurp_symbol_table (abfd)) + return -1; + + i = bfd_get_symcount (abfd); + symbase = obj_som_symtab (abfd); + + for (; i > 0; i--, location++, symbase++) + *location = &symbase->symbol; + + /* Final null pointer. */ + *location = 0; + return (bfd_get_symcount (abfd)); +} + +/* Make a SOM symbol. There is nothing special to do here. */ + +static asymbol * +som_make_empty_symbol (abfd) + bfd *abfd; +{ + bfd_size_type amt = sizeof (som_symbol_type); + som_symbol_type *new = (som_symbol_type *) bfd_zalloc (abfd, amt); + if (new == NULL) + return 0; + new->symbol.the_bfd = abfd; + + return &new->symbol; +} + +/* Print symbol information. */ + +static void +som_print_symbol (abfd, afile, symbol, how) + bfd *abfd; + PTR afile; + asymbol *symbol; + bfd_print_symbol_type how; +{ + FILE *file = (FILE *) afile; + switch (how) + { + case bfd_print_symbol_name: + fprintf (file, "%s", symbol->name); + break; + case bfd_print_symbol_more: + fprintf (file, "som "); + fprintf_vma (file, symbol->value); + fprintf (file, " %lx", (long) symbol->flags); + break; + case bfd_print_symbol_all: + { + const char *section_name; + section_name = symbol->section ? symbol->section->name : "(*none*)"; + bfd_print_symbol_vandf (abfd, (PTR) file, symbol); + fprintf (file, " %s\t%s", section_name, symbol->name); + break; + } + } +} + +static bfd_boolean +som_bfd_is_local_label_name (abfd, name) + bfd *abfd ATTRIBUTE_UNUSED; + const char *name; +{ + return (name[0] == 'L' && name[1] == '$'); +} + +/* Count or process variable-length SOM fixup records. + + To avoid code duplication we use this code both to compute the number + of relocations requested by a stream, and to internalize the stream. + + When computing the number of relocations requested by a stream the + variables rptr, section, and symbols have no meaning. + + Return the number of relocations requested by the fixup stream. When + not just counting + + This needs at least two or three more passes to get it cleaned up. */ + +static unsigned int +som_set_reloc_info (fixup, end, internal_relocs, section, symbols, just_count) + unsigned char *fixup; + unsigned int end; + arelent *internal_relocs; + asection *section; + asymbol **symbols; + bfd_boolean just_count; +{ + unsigned int op, varname, deallocate_contents = 0; + unsigned char *end_fixups = &fixup[end]; + const struct fixup_format *fp; + const char *cp; + unsigned char *save_fixup; + int variables[26], stack[20], c, v, count, prev_fixup, *sp, saved_unwind_bits; + const int *subop; + arelent *rptr = internal_relocs; + unsigned int offset = 0; + +#define var(c) variables[(c) - 'A'] +#define push(v) (*sp++ = (v)) +#define pop() (*--sp) +#define emptystack() (sp == stack) + + som_initialize_reloc_queue (reloc_queue); + memset (variables, 0, sizeof (variables)); + memset (stack, 0, sizeof (stack)); + count = 0; + prev_fixup = 0; + saved_unwind_bits = 0; + sp = stack; + + while (fixup < end_fixups) + { + + /* Save pointer to the start of this fixup. We'll use + it later to determine if it is necessary to put this fixup + on the queue. */ + save_fixup = fixup; + + /* Get the fixup code and its associated format. */ + op = *fixup++; + fp = &som_fixup_formats[op]; + + /* Handle a request for a previous fixup. */ + if (*fp->format == 'P') + { + /* Get pointer to the beginning of the prev fixup, move + the repeated fixup to the head of the queue. */ + fixup = reloc_queue[fp->D].reloc; + som_reloc_queue_fix (reloc_queue, fp->D); + prev_fixup = 1; + + /* Get the fixup code and its associated format. */ + op = *fixup++; + fp = &som_fixup_formats[op]; + } + + /* If this fixup will be passed to BFD, set some reasonable defaults. */ + if (! just_count + && som_hppa_howto_table[op].type != R_NO_RELOCATION + && som_hppa_howto_table[op].type != R_DATA_OVERRIDE) + { + rptr->address = offset; + rptr->howto = &som_hppa_howto_table[op]; + rptr->addend = 0; + rptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + } + + /* Set default input length to 0. Get the opcode class index + into D. */ + var ('L') = 0; + var ('D') = fp->D; + var ('U') = saved_unwind_bits; + + /* Get the opcode format. */ + cp = fp->format; + + /* Process the format string. Parsing happens in two phases, + parse RHS, then assign to LHS. Repeat until no more + characters in the format string. */ + while (*cp) + { + /* The variable this pass is going to compute a value for. */ + varname = *cp++; + + /* Start processing RHS. Continue until a NULL or '=' is found. */ + do + { + c = *cp++; + + /* If this is a variable, push it on the stack. */ + if (ISUPPER (c)) + push (var (c)); + + /* If this is a lower case letter, then it represents + additional data from the fixup stream to be pushed onto + the stack. */ + else if (ISLOWER (c)) + { + int bits = (c - 'a') * 8; + for (v = 0; c > 'a'; --c) + v = (v << 8) | *fixup++; + if (varname == 'V') + v = sign_extend (v, bits); + push (v); + } + + /* A decimal constant. Push it on the stack. */ + else if (ISDIGIT (c)) + { + v = c - '0'; + while (ISDIGIT (*cp)) + v = (v * 10) + (*cp++ - '0'); + push (v); + } + else + /* An operator. Pop two two values from the stack and + use them as operands to the given operation. Push + the result of the operation back on the stack. */ + switch (c) + { + case '+': + v = pop (); + v += pop (); + push (v); + break; + case '*': + v = pop (); + v *= pop (); + push (v); + break; + case '<': + v = pop (); + v = pop () << v; + push (v); + break; + default: + abort (); + } + } + while (*cp && *cp != '='); + + /* Move over the equal operator. */ + cp++; + + /* Pop the RHS off the stack. */ + c = pop (); + + /* Perform the assignment. */ + var (varname) = c; + + /* Handle side effects. and special 'O' stack cases. */ + switch (varname) + { + /* Consume some bytes from the input space. */ + case 'L': + offset += c; + break; + /* A symbol to use in the relocation. Make a note + of this if we are not just counting. */ + case 'S': + if (! just_count) + rptr->sym_ptr_ptr = &symbols[c]; + break; + /* Argument relocation bits for a function call. */ + case 'R': + if (! just_count) + { + unsigned int tmp = var ('R'); + rptr->addend = 0; + + if ((som_hppa_howto_table[op].type == R_PCREL_CALL + && R_PCREL_CALL + 10 > op) + || (som_hppa_howto_table[op].type == R_ABS_CALL + && R_ABS_CALL + 10 > op)) + { + /* Simple encoding. */ + if (tmp > 4) + { + tmp -= 5; + rptr->addend |= 1; + } + if (tmp == 4) + rptr->addend |= 1 << 8 | 1 << 6 | 1 << 4 | 1 << 2; + else if (tmp == 3) + rptr->addend |= 1 << 8 | 1 << 6 | 1 << 4; + else if (tmp == 2) + rptr->addend |= 1 << 8 | 1 << 6; + else if (tmp == 1) + rptr->addend |= 1 << 8; + } + else + { + unsigned int tmp1, tmp2; + + /* First part is easy -- low order two bits are + directly copied, then shifted away. */ + rptr->addend = tmp & 0x3; + tmp >>= 2; + + /* Diving the result by 10 gives us the second + part. If it is 9, then the first two words + are a double precision paramater, else it is + 3 * the first arg bits + the 2nd arg bits. */ + tmp1 = tmp / 10; + tmp -= tmp1 * 10; + if (tmp1 == 9) + rptr->addend += (0xe << 6); + else + { + /* Get the two pieces. */ + tmp2 = tmp1 / 3; + tmp1 -= tmp2 * 3; + /* Put them in the addend. */ + rptr->addend += (tmp2 << 8) + (tmp1 << 6); + } + + /* What's left is the third part. It's unpacked + just like the second. */ + if (tmp == 9) + rptr->addend += (0xe << 2); + else + { + tmp2 = tmp / 3; + tmp -= tmp2 * 3; + rptr->addend += (tmp2 << 4) + (tmp << 2); + } + } + rptr->addend = HPPA_R_ADDEND (rptr->addend, 0); + } + break; + /* Handle the linker expression stack. */ + case 'O': + switch (op) + { + case R_COMP1: + subop = comp1_opcodes; + break; + case R_COMP2: + subop = comp2_opcodes; + break; + case R_COMP3: + subop = comp3_opcodes; + break; + default: + abort (); + } + while (*subop <= (unsigned char) c) + ++subop; + --subop; + break; + /* The lower 32unwind bits must be persistent. */ + case 'U': + saved_unwind_bits = var ('U'); + break; + + default: + break; + } + } + + /* If we used a previous fixup, clean up after it. */ + if (prev_fixup) + { + fixup = save_fixup + 1; + prev_fixup = 0; + } + /* Queue it. */ + else if (fixup > save_fixup + 1) + som_reloc_queue_insert (save_fixup, fixup - save_fixup, reloc_queue); + + /* We do not pass R_DATA_OVERRIDE or R_NO_RELOCATION + fixups to BFD. */ + if (som_hppa_howto_table[op].type != R_DATA_OVERRIDE + && som_hppa_howto_table[op].type != R_NO_RELOCATION) + { + /* Done with a single reloction. Loop back to the top. */ + if (! just_count) + { + if (som_hppa_howto_table[op].type == R_ENTRY) + rptr->addend = var ('T'); + else if (som_hppa_howto_table[op].type == R_EXIT) + rptr->addend = var ('U'); + else if (som_hppa_howto_table[op].type == R_PCREL_CALL + || som_hppa_howto_table[op].type == R_ABS_CALL) + ; + else if (som_hppa_howto_table[op].type == R_DATA_ONE_SYMBOL) + { + /* Try what was specified in R_DATA_OVERRIDE first + (if anything). Then the hard way using the + section contents. */ + rptr->addend = var ('V'); + + if (rptr->addend == 0 && !section->contents) + { + /* Got to read the damn contents first. We don't + bother saving the contents (yet). Add it one + day if the need arises. */ + section->contents = bfd_malloc (section->_raw_size); + if (section->contents == NULL) + return (unsigned) -1; + + deallocate_contents = 1; + bfd_get_section_contents (section->owner, + section, + section->contents, + (bfd_vma) 0, + section->_raw_size); + } + else if (rptr->addend == 0) + rptr->addend = bfd_get_32 (section->owner, + (section->contents + + offset - var ('L'))); + + } + else + rptr->addend = var ('V'); + rptr++; + } + count++; + /* Now that we've handled a "full" relocation, reset + some state. */ + memset (variables, 0, sizeof (variables)); + memset (stack, 0, sizeof (stack)); + } + } + if (deallocate_contents) + free (section->contents); + + return count; + +#undef var +#undef push +#undef pop +#undef emptystack +} + +/* Read in the relocs (aka fixups in SOM terms) for a section. + + som_get_reloc_upper_bound calls this routine with JUST_COUNT + set to TRUE to indicate it only needs a count of the number + of actual relocations. */ + +static bfd_boolean +som_slurp_reloc_table (abfd, section, symbols, just_count) + bfd *abfd; + asection *section; + asymbol **symbols; + bfd_boolean just_count; +{ + char *external_relocs; + unsigned int fixup_stream_size; + arelent *internal_relocs; + unsigned int num_relocs; + bfd_size_type amt; + + fixup_stream_size = som_section_data (section)->reloc_size; + /* If there were no relocations, then there is nothing to do. */ + if (section->reloc_count == 0) + return TRUE; + + /* If reloc_count is -1, then the relocation stream has not been + parsed. We must do so now to know how many relocations exist. */ + if (section->reloc_count == (unsigned) -1) + { + amt = fixup_stream_size; + external_relocs = (char *) bfd_malloc (amt); + if (external_relocs == (char *) NULL) + return FALSE; + /* Read in the external forms. */ + if (bfd_seek (abfd, + obj_som_reloc_filepos (abfd) + section->rel_filepos, + SEEK_SET) + != 0) + return FALSE; + if (bfd_bread (external_relocs, amt, abfd) != amt) + return FALSE; + + /* Let callers know how many relocations found. + also save the relocation stream as we will + need it again. */ + section->reloc_count = som_set_reloc_info (external_relocs, + fixup_stream_size, + NULL, NULL, NULL, TRUE); + + som_section_data (section)->reloc_stream = external_relocs; + } + + /* If the caller only wanted a count, then return now. */ + if (just_count) + return TRUE; + + num_relocs = section->reloc_count; + external_relocs = som_section_data (section)->reloc_stream; + /* Return saved information about the relocations if it is available. */ + if (section->relocation != (arelent *) NULL) + return TRUE; + + amt = num_relocs; + amt *= sizeof (arelent); + internal_relocs = (arelent *) bfd_zalloc (abfd, (amt)); + if (internal_relocs == (arelent *) NULL) + return FALSE; + + /* Process and internalize the relocations. */ + som_set_reloc_info (external_relocs, fixup_stream_size, + internal_relocs, section, symbols, FALSE); + + /* We're done with the external relocations. Free them. */ + free (external_relocs); + som_section_data (section)->reloc_stream = NULL; + + /* Save our results and return success. */ + section->relocation = internal_relocs; + return TRUE; +} + +/* Return the number of bytes required to store the relocation + information associated with the given section. */ + +static long +som_get_reloc_upper_bound (abfd, asect) + bfd *abfd; + sec_ptr asect; +{ + /* If section has relocations, then read in the relocation stream + and parse it to determine how many relocations exist. */ + if (asect->flags & SEC_RELOC) + { + if (! som_slurp_reloc_table (abfd, asect, NULL, TRUE)) + return -1; + return (asect->reloc_count + 1) * sizeof (arelent *); + } + /* There are no relocations. */ + return 0; +} + +/* Convert relocations from SOM (external) form into BFD internal + form. Return the number of relocations. */ + +static long +som_canonicalize_reloc (abfd, section, relptr, symbols) + bfd *abfd; + sec_ptr section; + arelent **relptr; + asymbol **symbols; +{ + arelent *tblptr; + int count; + + if (! som_slurp_reloc_table (abfd, section, symbols, FALSE)) + return -1; + + count = section->reloc_count; + tblptr = section->relocation; + + while (count--) + *relptr++ = tblptr++; + + *relptr = (arelent *) NULL; + return section->reloc_count; +} + +extern const bfd_target som_vec; + +/* A hook to set up object file dependent section information. */ + +static bfd_boolean +som_new_section_hook (abfd, newsect) + bfd *abfd; + asection *newsect; +{ + bfd_size_type amt = sizeof (struct som_section_data_struct); + newsect->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); + if (!newsect->used_by_bfd) + return FALSE; + newsect->alignment_power = 3; + + /* We allow more than three sections internally. */ + return TRUE; +} + +/* Copy any private info we understand from the input symbol + to the output symbol. */ + +static bfd_boolean +som_bfd_copy_private_symbol_data (ibfd, isymbol, obfd, osymbol) + bfd *ibfd; + asymbol *isymbol; + bfd *obfd; + asymbol *osymbol; +{ + struct som_symbol *input_symbol = (struct som_symbol *) isymbol; + struct som_symbol *output_symbol = (struct som_symbol *) osymbol; + + /* One day we may try to grok other private data. */ + if (ibfd->xvec->flavour != bfd_target_som_flavour + || obfd->xvec->flavour != bfd_target_som_flavour) + return FALSE; + + /* The only private information we need to copy is the argument relocation + bits. */ + output_symbol->tc_data.ap.hppa_arg_reloc = + input_symbol->tc_data.ap.hppa_arg_reloc; + + return TRUE; +} + +/* Copy any private info we understand from the input section + to the output section. */ + +static bfd_boolean +som_bfd_copy_private_section_data (ibfd, isection, obfd, osection) + bfd *ibfd; + asection *isection; + bfd *obfd; + asection *osection; +{ + bfd_size_type amt; + + /* One day we may try to grok other private data. */ + if (ibfd->xvec->flavour != bfd_target_som_flavour + || obfd->xvec->flavour != bfd_target_som_flavour + || (!som_is_space (isection) && !som_is_subspace (isection))) + return TRUE; + + amt = sizeof (struct som_copyable_section_data_struct); + som_section_data (osection)->copy_data = + (struct som_copyable_section_data_struct *) bfd_zalloc (obfd, amt); + if (som_section_data (osection)->copy_data == NULL) + return FALSE; + + memcpy (som_section_data (osection)->copy_data, + som_section_data (isection)->copy_data, + sizeof (struct som_copyable_section_data_struct)); + + /* Reparent if necessary. */ + if (som_section_data (osection)->copy_data->container) + som_section_data (osection)->copy_data->container = + som_section_data (osection)->copy_data->container->output_section; + + return TRUE; +} + +/* Copy any private info we understand from the input bfd + to the output bfd. */ + +static bfd_boolean +som_bfd_copy_private_bfd_data (ibfd, obfd) + bfd *ibfd, *obfd; +{ + /* One day we may try to grok other private data. */ + if (ibfd->xvec->flavour != bfd_target_som_flavour + || obfd->xvec->flavour != bfd_target_som_flavour) + return TRUE; + + /* Allocate some memory to hold the data we need. */ + obj_som_exec_data (obfd) = (struct som_exec_data *) + bfd_zalloc (obfd, (bfd_size_type) sizeof (struct som_exec_data)); + if (obj_som_exec_data (obfd) == NULL) + return FALSE; + + /* Now copy the data. */ + memcpy (obj_som_exec_data (obfd), obj_som_exec_data (ibfd), + sizeof (struct som_exec_data)); + + return TRUE; +} + +/* Set backend info for sections which can not be described + in the BFD data structures. */ + +bfd_boolean +bfd_som_set_section_attributes (section, defined, private, sort_key, spnum) + asection *section; + int defined; + int private; + unsigned int sort_key; + int spnum; +{ + /* Allocate memory to hold the magic information. */ + if (som_section_data (section)->copy_data == NULL) + { + bfd_size_type amt = sizeof (struct som_copyable_section_data_struct); + som_section_data (section)->copy_data = + (struct som_copyable_section_data_struct *) bfd_zalloc (section->owner, + amt); + if (som_section_data (section)->copy_data == NULL) + return FALSE; + } + som_section_data (section)->copy_data->sort_key = sort_key; + som_section_data (section)->copy_data->is_defined = defined; + som_section_data (section)->copy_data->is_private = private; + som_section_data (section)->copy_data->container = section; + som_section_data (section)->copy_data->space_number = spnum; + return TRUE; +} + +/* Set backend info for subsections which can not be described + in the BFD data structures. */ + +bfd_boolean +bfd_som_set_subsection_attributes (section, container, access, + sort_key, quadrant) + asection *section; + asection *container; + int access; + unsigned int sort_key; + int quadrant; +{ + /* Allocate memory to hold the magic information. */ + if (som_section_data (section)->copy_data == NULL) + { + bfd_size_type amt = sizeof (struct som_copyable_section_data_struct); + som_section_data (section)->copy_data = + (struct som_copyable_section_data_struct *) bfd_zalloc (section->owner, + amt); + if (som_section_data (section)->copy_data == NULL) + return FALSE; + } + som_section_data (section)->copy_data->sort_key = sort_key; + som_section_data (section)->copy_data->access_control_bits = access; + som_section_data (section)->copy_data->quadrant = quadrant; + som_section_data (section)->copy_data->container = container; + return TRUE; +} + +/* Set the full SOM symbol type. SOM needs far more symbol information + than any other object file format I'm aware of. It is mandatory + to be able to know if a symbol is an entry point, millicode, data, + code, absolute, storage request, or procedure label. If you get + the symbol type wrong your program will not link. */ + +void +bfd_som_set_symbol_type (symbol, type) + asymbol *symbol; + unsigned int type; +{ + som_symbol_data (symbol)->som_type = type; +} + +/* Attach an auxiliary header to the BFD backend so that it may be + written into the object file. */ + +bfd_boolean +bfd_som_attach_aux_hdr (abfd, type, string) + bfd *abfd; + int type; + char *string; +{ + bfd_size_type amt; + + if (type == VERSION_AUX_ID) + { + size_t len = strlen (string); + int pad = 0; + + if (len % 4) + pad = (4 - (len % 4)); + amt = sizeof (struct aux_id) + sizeof (unsigned int) + len + pad; + obj_som_version_hdr (abfd) = + (struct user_string_aux_hdr *) bfd_zalloc (abfd, amt); + if (!obj_som_version_hdr (abfd)) + return FALSE; + obj_som_version_hdr (abfd)->header_id.type = VERSION_AUX_ID; + obj_som_version_hdr (abfd)->header_id.length = len + pad; + obj_som_version_hdr (abfd)->header_id.length += sizeof (int); + obj_som_version_hdr (abfd)->string_length = len; + strncpy (obj_som_version_hdr (abfd)->user_string, string, len); + } + else if (type == COPYRIGHT_AUX_ID) + { + int len = strlen (string); + int pad = 0; + + if (len % 4) + pad = (4 - (len % 4)); + amt = sizeof (struct aux_id) + sizeof (unsigned int) + len + pad; + obj_som_copyright_hdr (abfd) = + (struct copyright_aux_hdr *) bfd_zalloc (abfd, amt); + if (!obj_som_copyright_hdr (abfd)) + return FALSE; + obj_som_copyright_hdr (abfd)->header_id.type = COPYRIGHT_AUX_ID; + obj_som_copyright_hdr (abfd)->header_id.length = len + pad; + obj_som_copyright_hdr (abfd)->header_id.length += sizeof (int); + obj_som_copyright_hdr (abfd)->string_length = len; + strcpy (obj_som_copyright_hdr (abfd)->copyright, string); + } + return TRUE; +} + +/* Attach a compilation unit header to the BFD backend so that it may be + written into the object file. */ + +bfd_boolean +bfd_som_attach_compilation_unit (abfd, name, language_name, product_id, + version_id) + bfd *abfd; + const char *name; + const char *language_name; + const char *product_id; + const char *version_id; +{ + COMPUNIT *n = (COMPUNIT *) bfd_zalloc (abfd, (bfd_size_type) COMPUNITSZ); + if (n == NULL) + return FALSE; + +#define STRDUP(f) \ + if (f != NULL) \ + { \ + n->f.n_name = bfd_alloc (abfd, (bfd_size_type) strlen (f) + 1); \ + if (n->f.n_name == NULL) \ + return FALSE; \ + strcpy (n->f.n_name, f); \ + } + + STRDUP (name); + STRDUP (language_name); + STRDUP (product_id); + STRDUP (version_id); + +#undef STRDUP + + obj_som_compilation_unit (abfd) = n; + + return TRUE; +} + +static bfd_boolean +som_get_section_contents (abfd, section, location, offset, count) + bfd *abfd; + sec_ptr section; + PTR location; + file_ptr offset; + bfd_size_type count; +{ + if (count == 0 || ((section->flags & SEC_HAS_CONTENTS) == 0)) + return TRUE; + if ((bfd_size_type) (offset+count) > section->_raw_size + || bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0 + || bfd_bread (location, count, abfd) != count) + return FALSE; /* On error. */ + return TRUE; +} + +static bfd_boolean +som_set_section_contents (abfd, section, location, offset, count) + bfd *abfd; + sec_ptr section; + PTR location; + file_ptr offset; + bfd_size_type count; +{ + if (! abfd->output_has_begun) + { + /* Set up fixed parts of the file, space, and subspace headers. + Notify the world that output has begun. */ + som_prep_headers (abfd); + abfd->output_has_begun = TRUE; + /* Start writing the object file. This include all the string + tables, fixup streams, and other portions of the object file. */ + som_begin_writing (abfd); + } + + /* Only write subspaces which have "real" contents (eg. the contents + are not generated at run time by the OS). */ + if (!som_is_subspace (section) + || ((section->flags & SEC_HAS_CONTENTS) == 0)) + return TRUE; + + /* Seek to the proper offset within the object file and write the + data. */ + offset += som_section_data (section)->subspace_dict->file_loc_init_value; + if (bfd_seek (abfd, offset, SEEK_SET) != 0) + return FALSE; + + if (bfd_bwrite ((PTR) location, count, abfd) != count) + return FALSE; + return TRUE; +} + +static bfd_boolean +som_set_arch_mach (abfd, arch, machine) + bfd *abfd; + enum bfd_architecture arch; + unsigned long machine; +{ + /* Allow any architecture to be supported by the SOM backend. */ + return bfd_default_set_arch_mach (abfd, arch, machine); +} + +static bfd_boolean +som_find_nearest_line (abfd, section, symbols, offset, filename_ptr, + functionname_ptr, line_ptr) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section ATTRIBUTE_UNUSED; + asymbol **symbols ATTRIBUTE_UNUSED; + bfd_vma offset ATTRIBUTE_UNUSED; + const char **filename_ptr ATTRIBUTE_UNUSED; + const char **functionname_ptr ATTRIBUTE_UNUSED; + unsigned int *line_ptr ATTRIBUTE_UNUSED; +{ + return FALSE; +} + +static int +som_sizeof_headers (abfd, reloc) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_boolean reloc ATTRIBUTE_UNUSED; +{ + (*_bfd_error_handler) (_("som_sizeof_headers unimplemented")); + fflush (stderr); + abort (); + return 0; +} + +/* Return the single-character symbol type corresponding to + SOM section S, or '?' for an unknown SOM section. */ + +static char +som_section_type (s) + const char *s; +{ + const struct section_to_type *t; + + for (t = &stt[0]; t->section; t++) + if (!strcmp (s, t->section)) + return t->type; + return '?'; +} + +static int +som_decode_symclass (symbol) + asymbol *symbol; +{ + char c; + + if (bfd_is_com_section (symbol->section)) + return 'C'; + if (bfd_is_und_section (symbol->section)) + return 'U'; + if (bfd_is_ind_section (symbol->section)) + return 'I'; + if (symbol->flags & BSF_WEAK) + return 'W'; + if (!(symbol->flags & (BSF_GLOBAL | BSF_LOCAL))) + return '?'; + + if (bfd_is_abs_section (symbol->section) + || (som_symbol_data (symbol) != NULL + && som_symbol_data (symbol)->som_type == SYMBOL_TYPE_ABSOLUTE)) + c = 'a'; + else if (symbol->section) + c = som_section_type (symbol->section->name); + else + return '?'; + if (symbol->flags & BSF_GLOBAL) + c = TOUPPER (c); + return c; +} + +/* Return information about SOM symbol SYMBOL in RET. */ + +static void +som_get_symbol_info (ignore_abfd, symbol, ret) + bfd *ignore_abfd ATTRIBUTE_UNUSED; + asymbol *symbol; + symbol_info *ret; +{ + ret->type = som_decode_symclass (symbol); + if (ret->type != 'U') + ret->value = symbol->value + symbol->section->vma; + else + ret->value = 0; + ret->name = symbol->name; +} + +/* Count the number of symbols in the archive symbol table. Necessary + so that we can allocate space for all the carsyms at once. */ + +static bfd_boolean +som_bfd_count_ar_symbols (abfd, lst_header, count) + bfd *abfd; + struct lst_header *lst_header; + symindex *count; +{ + unsigned int i; + unsigned int *hash_table = NULL; + bfd_size_type amt; + file_ptr lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header); + + amt = lst_header->hash_size; + amt *= sizeof (unsigned int); + hash_table = (unsigned int *) bfd_malloc (amt); + if (hash_table == NULL && lst_header->hash_size != 0) + goto error_return; + + /* Don't forget to initialize the counter! */ + *count = 0; + + /* Read in the hash table. The has table is an array of 32bit file offsets + which point to the hash chains. */ + if (bfd_bread ((PTR) hash_table, amt, abfd) != amt) + goto error_return; + + /* Walk each chain counting the number of symbols found on that particular + chain. */ + for (i = 0; i < lst_header->hash_size; i++) + { + struct lst_symbol_record lst_symbol; + + /* An empty chain has zero as it's file offset. */ + if (hash_table[i] == 0) + continue; + + /* Seek to the first symbol in this hash chain. */ + if (bfd_seek (abfd, lst_filepos + hash_table[i], SEEK_SET) != 0) + goto error_return; + + /* Read in this symbol and update the counter. */ + amt = sizeof (lst_symbol); + if (bfd_bread ((PTR) &lst_symbol, amt, abfd) != amt) + goto error_return; + + (*count)++; + + /* Now iterate through the rest of the symbols on this chain. */ + while (lst_symbol.next_entry) + { + + /* Seek to the next symbol. */ + if (bfd_seek (abfd, lst_filepos + lst_symbol.next_entry, SEEK_SET) + != 0) + goto error_return; + + /* Read the symbol in and update the counter. */ + amt = sizeof (lst_symbol); + if (bfd_bread ((PTR) &lst_symbol, amt, abfd) != amt) + goto error_return; + + (*count)++; + } + } + if (hash_table != NULL) + free (hash_table); + return TRUE; + + error_return: + if (hash_table != NULL) + free (hash_table); + return FALSE; +} + +/* Fill in the canonical archive symbols (SYMS) from the archive described + by ABFD and LST_HEADER. */ + +static bfd_boolean +som_bfd_fill_in_ar_symbols (abfd, lst_header, syms) + bfd *abfd; + struct lst_header *lst_header; + carsym **syms; +{ + unsigned int i, len; + carsym *set = syms[0]; + unsigned int *hash_table = NULL; + struct som_entry *som_dict = NULL; + bfd_size_type amt; + file_ptr lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header); + + amt = lst_header->hash_size; + amt *= sizeof (unsigned int); + hash_table = (unsigned int *) bfd_malloc (amt); + if (hash_table == NULL && lst_header->hash_size != 0) + goto error_return; + + /* Read in the hash table. The has table is an array of 32bit file offsets + which point to the hash chains. */ + if (bfd_bread ((PTR) hash_table, amt, abfd) != amt) + goto error_return; + + /* Seek to and read in the SOM dictionary. We will need this to fill + in the carsym's filepos field. */ + if (bfd_seek (abfd, lst_filepos + lst_header->dir_loc, SEEK_SET) != 0) + goto error_return; + + amt = lst_header->module_count; + amt *= sizeof (struct som_entry); + som_dict = (struct som_entry *) bfd_malloc (amt); + if (som_dict == NULL && lst_header->module_count != 0) + goto error_return; + + if (bfd_bread ((PTR) som_dict, amt, abfd) != amt) + goto error_return; + + /* Walk each chain filling in the carsyms as we go along. */ + for (i = 0; i < lst_header->hash_size; i++) + { + struct lst_symbol_record lst_symbol; + + /* An empty chain has zero as it's file offset. */ + if (hash_table[i] == 0) + continue; + + /* Seek to and read the first symbol on the chain. */ + if (bfd_seek (abfd, lst_filepos + hash_table[i], SEEK_SET) != 0) + goto error_return; + + amt = sizeof (lst_symbol); + if (bfd_bread ((PTR) &lst_symbol, amt, abfd) != amt) + goto error_return; + + /* Get the name of the symbol, first get the length which is stored + as a 32bit integer just before the symbol. + + One might ask why we don't just read in the entire string table + and index into it. Well, according to the SOM ABI the string + index can point *anywhere* in the archive to save space, so just + using the string table would not be safe. */ + if (bfd_seek (abfd, lst_filepos + lst_header->string_loc + + lst_symbol.name.n_strx - 4, SEEK_SET) != 0) + goto error_return; + + if (bfd_bread (&len, (bfd_size_type) 4, abfd) != 4) + goto error_return; + + /* Allocate space for the name and null terminate it too. */ + set->name = bfd_zalloc (abfd, (bfd_size_type) len + 1); + if (!set->name) + goto error_return; + if (bfd_bread (set->name, (bfd_size_type) len, abfd) != len) + goto error_return; + + set->name[len] = 0; + + /* Fill in the file offset. Note that the "location" field points + to the SOM itself, not the ar_hdr in front of it. */ + set->file_offset = som_dict[lst_symbol.som_index].location + - sizeof (struct ar_hdr); + + /* Go to the next symbol. */ + set++; + + /* Iterate through the rest of the chain. */ + while (lst_symbol.next_entry) + { + /* Seek to the next symbol and read it in. */ + if (bfd_seek (abfd, lst_filepos + lst_symbol.next_entry, SEEK_SET) + != 0) + goto error_return; + + amt = sizeof (lst_symbol); + if (bfd_bread ((PTR) &lst_symbol, amt, abfd) != amt) + goto error_return; + + /* Seek to the name length & string and read them in. */ + if (bfd_seek (abfd, lst_filepos + lst_header->string_loc + + lst_symbol.name.n_strx - 4, SEEK_SET) != 0) + goto error_return; + + if (bfd_bread (&len, (bfd_size_type) 4, abfd) != 4) + goto error_return; + + /* Allocate space for the name and null terminate it too. */ + set->name = bfd_zalloc (abfd, (bfd_size_type) len + 1); + if (!set->name) + goto error_return; + + if (bfd_bread (set->name, (bfd_size_type) len, abfd) != len) + goto error_return; + set->name[len] = 0; + + /* Fill in the file offset. Note that the "location" field points + to the SOM itself, not the ar_hdr in front of it. */ + set->file_offset = som_dict[lst_symbol.som_index].location + - sizeof (struct ar_hdr); + + /* Go on to the next symbol. */ + set++; + } + } + /* If we haven't died by now, then we successfully read the entire + archive symbol table. */ + if (hash_table != NULL) + free (hash_table); + if (som_dict != NULL) + free (som_dict); + return TRUE; + + error_return: + if (hash_table != NULL) + free (hash_table); + if (som_dict != NULL) + free (som_dict); + return FALSE; +} + +/* Read in the LST from the archive. */ + +static bfd_boolean +som_slurp_armap (abfd) + bfd *abfd; +{ + struct lst_header lst_header; + struct ar_hdr ar_header; + unsigned int parsed_size; + struct artdata *ardata = bfd_ardata (abfd); + char nextname[17]; + bfd_size_type amt = 16; + int i = bfd_bread ((PTR) nextname, amt, abfd); + + /* Special cases. */ + if (i == 0) + return TRUE; + if (i != 16) + return FALSE; + + if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) + return FALSE; + + /* For archives without .o files there is no symbol table. */ + if (strncmp (nextname, "/ ", 16)) + { + bfd_has_map (abfd) = FALSE; + return TRUE; + } + + /* Read in and sanity check the archive header. */ + amt = sizeof (struct ar_hdr); + if (bfd_bread ((PTR) &ar_header, amt, abfd) != amt) + return FALSE; + + if (strncmp (ar_header.ar_fmag, ARFMAG, 2)) + { + bfd_set_error (bfd_error_malformed_archive); + return FALSE; + } + + /* How big is the archive symbol table entry? */ + errno = 0; + parsed_size = strtol (ar_header.ar_size, NULL, 10); + if (errno != 0) + { + bfd_set_error (bfd_error_malformed_archive); + return FALSE; + } + + /* Save off the file offset of the first real user data. */ + ardata->first_file_filepos = bfd_tell (abfd) + parsed_size; + + /* Read in the library symbol table. We'll make heavy use of this + in just a minute. */ + amt = sizeof (struct lst_header); + if (bfd_bread ((PTR) &lst_header, amt, abfd) != amt) + return FALSE; + + /* Sanity check. */ + if (lst_header.a_magic != LIBMAGIC) + { + bfd_set_error (bfd_error_malformed_archive); + return FALSE; + } + + /* Count the number of symbols in the library symbol table. */ + if (! som_bfd_count_ar_symbols (abfd, &lst_header, &ardata->symdef_count)) + return FALSE; + + /* Get back to the start of the library symbol table. */ + if (bfd_seek (abfd, (ardata->first_file_filepos - parsed_size + + sizeof (struct lst_header)), SEEK_SET) != 0) + return FALSE; + + /* Initialize the cache and allocate space for the library symbols. */ + ardata->cache = 0; + amt = ardata->symdef_count; + amt *= sizeof (carsym); + ardata->symdefs = (carsym *) bfd_alloc (abfd, amt); + if (!ardata->symdefs) + return FALSE; + + /* Now fill in the canonical archive symbols. */ + if (! som_bfd_fill_in_ar_symbols (abfd, &lst_header, &ardata->symdefs)) + return FALSE; + + /* Seek back to the "first" file in the archive. Note the "first" + file may be the extended name table. */ + if (bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET) != 0) + return FALSE; + + /* Notify the generic archive code that we have a symbol map. */ + bfd_has_map (abfd) = TRUE; + return TRUE; +} + +/* Begin preparing to write a SOM library symbol table. + + As part of the prep work we need to determine the number of symbols + and the size of the associated string section. */ + +static bfd_boolean +som_bfd_prep_for_ar_write (abfd, num_syms, stringsize) + bfd *abfd; + unsigned int *num_syms, *stringsize; +{ + bfd *curr_bfd = abfd->archive_head; + + /* Some initialization. */ + *num_syms = 0; + *stringsize = 0; + + /* Iterate over each BFD within this archive. */ + while (curr_bfd != NULL) + { + unsigned int curr_count, i; + som_symbol_type *sym; + + /* Don't bother for non-SOM objects. */ + if (curr_bfd->format != bfd_object + || curr_bfd->xvec->flavour != bfd_target_som_flavour) + { + curr_bfd = curr_bfd->next; + continue; + } + + /* Make sure the symbol table has been read, then snag a pointer + to it. It's a little slimey to grab the symbols via obj_som_symtab, + but doing so avoids allocating lots of extra memory. */ + if (! som_slurp_symbol_table (curr_bfd)) + return FALSE; + + sym = obj_som_symtab (curr_bfd); + curr_count = bfd_get_symcount (curr_bfd); + + /* Examine each symbol to determine if it belongs in the + library symbol table. */ + for (i = 0; i < curr_count; i++, sym++) + { + struct som_misc_symbol_info info; + + /* Derive SOM information from the BFD symbol. */ + som_bfd_derive_misc_symbol_info (curr_bfd, &sym->symbol, &info); + + /* Should we include this symbol? */ + if (info.symbol_type == ST_NULL + || info.symbol_type == ST_SYM_EXT + || info.symbol_type == ST_ARG_EXT) + continue; + + /* Only global symbols and unsatisfied commons. */ + if (info.symbol_scope != SS_UNIVERSAL + && info.symbol_type != ST_STORAGE) + continue; + + /* Do no include undefined symbols. */ + if (bfd_is_und_section (sym->symbol.section)) + continue; + + /* Bump the various counters, being careful to honor + alignment considerations in the string table. */ + (*num_syms)++; + *stringsize = *stringsize + strlen (sym->symbol.name) + 5; + while (*stringsize % 4) + (*stringsize)++; + } + + curr_bfd = curr_bfd->next; + } + return TRUE; +} + +/* Hash a symbol name based on the hashing algorithm presented in the + SOM ABI. */ + +static unsigned int +som_bfd_ar_symbol_hash (symbol) + asymbol *symbol; +{ + unsigned int len = strlen (symbol->name); + + /* Names with length 1 are special. */ + if (len == 1) + return 0x1000100 | (symbol->name[0] << 16) | symbol->name[0]; + + return ((len & 0x7f) << 24) | (symbol->name[1] << 16) + | (symbol->name[len - 2] << 8) | symbol->name[len - 1]; +} + +/* Do the bulk of the work required to write the SOM library + symbol table. */ + +static bfd_boolean +som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst, elength) + bfd *abfd; + unsigned int nsyms, string_size; + struct lst_header lst; + unsigned elength; +{ + file_ptr lst_filepos; + char *strings = NULL, *p; + struct lst_symbol_record *lst_syms = NULL, *curr_lst_sym; + bfd *curr_bfd; + unsigned int *hash_table = NULL; + struct som_entry *som_dict = NULL; + struct lst_symbol_record **last_hash_entry = NULL; + unsigned int curr_som_offset, som_index = 0; + bfd_size_type amt; + + amt = lst.hash_size; + amt *= sizeof (unsigned int); + hash_table = (unsigned int *) bfd_zmalloc (amt); + if (hash_table == NULL && lst.hash_size != 0) + goto error_return; + + amt = lst.module_count; + amt *= sizeof (struct som_entry); + som_dict = (struct som_entry *) bfd_zmalloc (amt); + if (som_dict == NULL && lst.module_count != 0) + goto error_return; + + amt = lst.hash_size; + amt *= sizeof (struct lst_symbol_record *); + last_hash_entry = ((struct lst_symbol_record **) bfd_zmalloc (amt)); + if (last_hash_entry == NULL && lst.hash_size != 0) + goto error_return; + + /* Lots of fields are file positions relative to the start + of the lst record. So save its location. */ + lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header); + + /* Symbols have som_index fields, so we have to keep track of the + index of each SOM in the archive. + + The SOM dictionary has (among other things) the absolute file + position for the SOM which a particular dictionary entry + describes. We have to compute that information as we iterate + through the SOMs/symbols. */ + som_index = 0; + + /* We add in the size of the archive header twice as the location + in the SOM dictionary is the actual offset of the SOM, not the + archive header before the SOM. */ + curr_som_offset = 8 + 2 * sizeof (struct ar_hdr) + lst.file_end; + + /* Make room for the archive header and the contents of the + extended string table. Note that elength includes the size + of the archive header for the extended name table! */ + if (elength) + curr_som_offset += elength; + + /* Make sure we're properly aligned. */ + curr_som_offset = (curr_som_offset + 0x1) & ~0x1; + + /* FIXME should be done with buffers just like everything else... */ + amt = nsyms; + amt *= sizeof (struct lst_symbol_record); + lst_syms = bfd_malloc (amt); + if (lst_syms == NULL && nsyms != 0) + goto error_return; + strings = bfd_malloc ((bfd_size_type) string_size); + if (strings == NULL && string_size != 0) + goto error_return; + + p = strings; + curr_lst_sym = lst_syms; + + curr_bfd = abfd->archive_head; + while (curr_bfd != NULL) + { + unsigned int curr_count, i; + som_symbol_type *sym; + + /* Don't bother for non-SOM objects. */ + if (curr_bfd->format != bfd_object + || curr_bfd->xvec->flavour != bfd_target_som_flavour) + { + curr_bfd = curr_bfd->next; + continue; + } + + /* Make sure the symbol table has been read, then snag a pointer + to it. It's a little slimey to grab the symbols via obj_som_symtab, + but doing so avoids allocating lots of extra memory. */ + if (! som_slurp_symbol_table (curr_bfd)) + goto error_return; + + sym = obj_som_symtab (curr_bfd); + curr_count = bfd_get_symcount (curr_bfd); + + for (i = 0; i < curr_count; i++, sym++) + { + struct som_misc_symbol_info info; + + /* Derive SOM information from the BFD symbol. */ + som_bfd_derive_misc_symbol_info (curr_bfd, &sym->symbol, &info); + + /* Should we include this symbol? */ + if (info.symbol_type == ST_NULL + || info.symbol_type == ST_SYM_EXT + || info.symbol_type == ST_ARG_EXT) + continue; + + /* Only global symbols and unsatisfied commons. */ + if (info.symbol_scope != SS_UNIVERSAL + && info.symbol_type != ST_STORAGE) + continue; + + /* Do no include undefined symbols. */ + if (bfd_is_und_section (sym->symbol.section)) + continue; + + /* If this is the first symbol from this SOM, then update + the SOM dictionary too. */ + if (som_dict[som_index].location == 0) + { + som_dict[som_index].location = curr_som_offset; + som_dict[som_index].length = arelt_size (curr_bfd); + } + + /* Fill in the lst symbol record. */ + curr_lst_sym->hidden = 0; + curr_lst_sym->secondary_def = info.secondary_def; + curr_lst_sym->symbol_type = info.symbol_type; + curr_lst_sym->symbol_scope = info.symbol_scope; + curr_lst_sym->check_level = 0; + curr_lst_sym->must_qualify = 0; + curr_lst_sym->initially_frozen = 0; + curr_lst_sym->memory_resident = 0; + curr_lst_sym->is_common = bfd_is_com_section (sym->symbol.section); + curr_lst_sym->dup_common = 0; + curr_lst_sym->xleast = 3; + curr_lst_sym->arg_reloc = info.arg_reloc; + curr_lst_sym->name.n_strx = p - strings + 4; + curr_lst_sym->qualifier_name.n_strx = 0; + curr_lst_sym->symbol_info = info.symbol_info; + curr_lst_sym->symbol_value = info.symbol_value | info.priv_level; + curr_lst_sym->symbol_descriptor = 0; + curr_lst_sym->reserved = 0; + curr_lst_sym->som_index = som_index; + curr_lst_sym->symbol_key = som_bfd_ar_symbol_hash (&sym->symbol); + curr_lst_sym->next_entry = 0; + + /* Insert into the hash table. */ + if (hash_table[curr_lst_sym->symbol_key % lst.hash_size]) + { + struct lst_symbol_record *tmp; + + /* There is already something at the head of this hash chain, + so tack this symbol onto the end of the chain. */ + tmp = last_hash_entry[curr_lst_sym->symbol_key % lst.hash_size]; + tmp->next_entry + = (curr_lst_sym - lst_syms) * sizeof (struct lst_symbol_record) + + lst.hash_size * 4 + + lst.module_count * sizeof (struct som_entry) + + sizeof (struct lst_header); + } + else + { + /* First entry in this hash chain. */ + hash_table[curr_lst_sym->symbol_key % lst.hash_size] + = (curr_lst_sym - lst_syms) * sizeof (struct lst_symbol_record) + + lst.hash_size * 4 + + lst.module_count * sizeof (struct som_entry) + + sizeof (struct lst_header); + } + + /* Keep track of the last symbol we added to this chain so we can + easily update its next_entry pointer. */ + last_hash_entry[curr_lst_sym->symbol_key % lst.hash_size] + = curr_lst_sym; + + /* Update the string table. */ + bfd_put_32 (abfd, strlen (sym->symbol.name), p); + p += 4; + strcpy (p, sym->symbol.name); + p += strlen (sym->symbol.name) + 1; + while ((int) p % 4) + { + bfd_put_8 (abfd, 0, p); + p++; + } + + /* Head to the next symbol. */ + curr_lst_sym++; + } + + /* Keep track of where each SOM will finally reside; then look + at the next BFD. */ + curr_som_offset += arelt_size (curr_bfd) + sizeof (struct ar_hdr); + + /* A particular object in the archive may have an odd length; the + linker requires objects begin on an even boundary. So round + up the current offset as necessary. */ + curr_som_offset = (curr_som_offset + 0x1) &~ (unsigned) 1; + curr_bfd = curr_bfd->next; + som_index++; + } + + /* Now scribble out the hash table. */ + amt = lst.hash_size * 4; + if (bfd_bwrite ((PTR) hash_table, amt, abfd) != amt) + goto error_return; + + /* Then the SOM dictionary. */ + amt = lst.module_count * sizeof (struct som_entry); + if (bfd_bwrite ((PTR) som_dict, amt, abfd) != amt) + goto error_return; + + /* The library symbols. */ + amt = nsyms * sizeof (struct lst_symbol_record); + if (bfd_bwrite ((PTR) lst_syms, amt, abfd) != amt) + goto error_return; + + /* And finally the strings. */ + amt = string_size; + if (bfd_bwrite ((PTR) strings, amt, abfd) != amt) + goto error_return; + + if (hash_table != NULL) + free (hash_table); + if (som_dict != NULL) + free (som_dict); + if (last_hash_entry != NULL) + free (last_hash_entry); + if (lst_syms != NULL) + free (lst_syms); + if (strings != NULL) + free (strings); + return TRUE; + + error_return: + if (hash_table != NULL) + free (hash_table); + if (som_dict != NULL) + free (som_dict); + if (last_hash_entry != NULL) + free (last_hash_entry); + if (lst_syms != NULL) + free (lst_syms); + if (strings != NULL) + free (strings); + + return FALSE; +} + +/* Write out the LST for the archive. + + You'll never believe this is really how armaps are handled in SOM... */ + +static bfd_boolean +som_write_armap (abfd, elength, map, orl_count, stridx) + bfd *abfd; + unsigned int elength; + struct orl *map ATTRIBUTE_UNUSED; + unsigned int orl_count ATTRIBUTE_UNUSED; + int stridx ATTRIBUTE_UNUSED; +{ + bfd *curr_bfd; + struct stat statbuf; + unsigned int i, lst_size, nsyms, stringsize; + struct ar_hdr hdr; + struct lst_header lst; + int *p; + bfd_size_type amt; + + /* We'll use this for the archive's date and mode later. */ + if (stat (abfd->filename, &statbuf) != 0) + { + bfd_set_error (bfd_error_system_call); + return FALSE; + } + /* Fudge factor. */ + bfd_ardata (abfd)->armap_timestamp = statbuf.st_mtime + 60; + + /* Account for the lst header first. */ + lst_size = sizeof (struct lst_header); + + /* Start building the LST header. */ + /* FIXME: Do we need to examine each element to determine the + largest id number? */ + lst.system_id = CPU_PA_RISC1_0; + lst.a_magic = LIBMAGIC; + lst.version_id = VERSION_ID; + lst.file_time.secs = 0; + lst.file_time.nanosecs = 0; + + lst.hash_loc = lst_size; + lst.hash_size = SOM_LST_HASH_SIZE; + + /* Hash table is a SOM_LST_HASH_SIZE 32bit offsets. */ + lst_size += 4 * SOM_LST_HASH_SIZE; + + /* We need to count the number of SOMs in this archive. */ + curr_bfd = abfd->archive_head; + lst.module_count = 0; + while (curr_bfd != NULL) + { + /* Only true SOM objects count. */ + if (curr_bfd->format == bfd_object + && curr_bfd->xvec->flavour == bfd_target_som_flavour) + lst.module_count++; + curr_bfd = curr_bfd->next; + } + lst.module_limit = lst.module_count; + lst.dir_loc = lst_size; + lst_size += sizeof (struct som_entry) * lst.module_count; + + /* We don't support import/export tables, auxiliary headers, + or free lists yet. Make the linker work a little harder + to make our life easier. */ + + lst.export_loc = 0; + lst.export_count = 0; + lst.import_loc = 0; + lst.aux_loc = 0; + lst.aux_size = 0; + + /* Count how many symbols we will have on the hash chains and the + size of the associated string table. */ + if (! som_bfd_prep_for_ar_write (abfd, &nsyms, &stringsize)) + return FALSE; + + lst_size += sizeof (struct lst_symbol_record) * nsyms; + + /* For the string table. One day we might actually use this info + to avoid small seeks/reads when reading archives. */ + lst.string_loc = lst_size; + lst.string_size = stringsize; + lst_size += stringsize; + + /* SOM ABI says this must be zero. */ + lst.free_list = 0; + lst.file_end = lst_size; + + /* Compute the checksum. Must happen after the entire lst header + has filled in. */ + p = (int *) &lst; + lst.checksum = 0; + for (i = 0; i < sizeof (struct lst_header) / sizeof (int) - 1; i++) + lst.checksum ^= *p++; + + sprintf (hdr.ar_name, "/ "); + sprintf (hdr.ar_date, "%ld", bfd_ardata (abfd)->armap_timestamp); + sprintf (hdr.ar_uid, "%ld", (long) getuid ()); + sprintf (hdr.ar_gid, "%ld", (long) getgid ()); + sprintf (hdr.ar_mode, "%-8o", (unsigned int) statbuf.st_mode); + sprintf (hdr.ar_size, "%-10d", (int) lst_size); + hdr.ar_fmag[0] = '`'; + hdr.ar_fmag[1] = '\012'; + + /* Turn any nulls into spaces. */ + for (i = 0; i < sizeof (struct ar_hdr); i++) + if (((char *) (&hdr))[i] == '\0') + (((char *) (&hdr))[i]) = ' '; + + /* Scribble out the ar header. */ + amt = sizeof (struct ar_hdr); + if (bfd_bwrite ((PTR) &hdr, amt, abfd) != amt) + return FALSE; + + /* Now scribble out the lst header. */ + amt = sizeof (struct lst_header); + if (bfd_bwrite ((PTR) &lst, amt, abfd) != amt) + return FALSE; + + /* Build and write the armap. */ + if (!som_bfd_ar_write_symbol_stuff (abfd, nsyms, stringsize, lst, elength)) + return FALSE; + + /* Done. */ + return TRUE; +} + +/* Free all information we have cached for this BFD. We can always + read it again later if we need it. */ + +static bfd_boolean +som_bfd_free_cached_info (abfd) + bfd *abfd; +{ + asection *o; + + if (bfd_get_format (abfd) != bfd_object) + return TRUE; + +#define FREE(x) if (x != NULL) { free (x); x = NULL; } + /* Free the native string and symbol tables. */ + FREE (obj_som_symtab (abfd)); + FREE (obj_som_stringtab (abfd)); + for (o = abfd->sections; o != (asection *) NULL; o = o->next) + { + /* Free the native relocations. */ + o->reloc_count = (unsigned) -1; + FREE (som_section_data (o)->reloc_stream); + /* Free the generic relocations. */ + FREE (o->relocation); + } +#undef FREE + + return TRUE; +} + +/* End of miscellaneous support functions. */ + +/* Linker support functions. */ + +static bfd_boolean +som_bfd_link_split_section (abfd, sec) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec; +{ + return (som_is_subspace (sec) && sec->_raw_size > 240000); +} + +#define som_close_and_cleanup som_bfd_free_cached_info + +#define som_read_ar_hdr _bfd_generic_read_ar_hdr +#define som_openr_next_archived_file bfd_generic_openr_next_archived_file +#define som_get_elt_at_index _bfd_generic_get_elt_at_index +#define som_generic_stat_arch_elt bfd_generic_stat_arch_elt +#define som_truncate_arname bfd_bsd_truncate_arname +#define som_slurp_extended_name_table _bfd_slurp_extended_name_table +#define som_construct_extended_name_table \ + _bfd_archive_coff_construct_extended_name_table +#define som_update_armap_timestamp bfd_true +#define som_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data + +#define som_get_lineno _bfd_nosymbols_get_lineno +#define som_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define som_read_minisymbols _bfd_generic_read_minisymbols +#define som_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol +#define som_get_section_contents_in_window \ + _bfd_generic_get_section_contents_in_window + +#define som_bfd_get_relocated_section_contents \ + bfd_generic_get_relocated_section_contents +#define som_bfd_relax_section bfd_generic_relax_section +#define som_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define som_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define som_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define som_bfd_link_just_syms _bfd_generic_link_just_syms +#define som_bfd_final_link _bfd_generic_final_link + +#define som_bfd_gc_sections bfd_generic_gc_sections +#define som_bfd_merge_sections bfd_generic_merge_sections +#define som_bfd_discard_group bfd_generic_discard_group + +const bfd_target som_vec = { + "som", /* name */ + bfd_target_som_flavour, + BFD_ENDIAN_BIG, /* target byte order */ + BFD_ENDIAN_BIG, /* target headers byte order */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED | DYNAMIC), + (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS + | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + +/* leading_symbol_char: is the first char of a user symbol + predictable, and if so what is it. */ + 0, + '/', /* ar_pad_char */ + 14, /* ar_max_namelen */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + {_bfd_dummy_target, + som_object_p, /* bfd_check_format */ + bfd_generic_archive_p, + _bfd_dummy_target + }, + { + bfd_false, + som_mkobject, + _bfd_generic_mkarchive, + bfd_false + }, + { + bfd_false, + som_write_object_contents, + _bfd_write_archive_contents, + bfd_false, + }, +#undef som + + BFD_JUMP_TABLE_GENERIC (som), + BFD_JUMP_TABLE_COPY (som), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (som), + BFD_JUMP_TABLE_SYMBOLS (som), + BFD_JUMP_TABLE_RELOCS (som), + BFD_JUMP_TABLE_WRITE (som), + BFD_JUMP_TABLE_LINK (som), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + (PTR) 0 +}; + +#endif /* HOST_HPPAHPUX || HOST_HPPABSD || HOST_HPPAOSF */ diff --git a/bfd/som.h b/bfd/som.h new file mode 100644 index 0000000000000..537ddaad1f020 --- /dev/null +++ b/bfd/som.h @@ -0,0 +1,243 @@ +/* HP PA-RISC SOM object file format: definitions internal to BFD. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, + 2002, 2003 Free Software Foundation, Inc. + + Contributed by the Center for Software Science at the + University of Utah (pa-gdb-bugs@cs.utah.edu). + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#ifndef _SOM_H +#define _SOM_H + +#include "libhppa.h" + +/* Enable PA2.0 if available */ +#define PA_2_0 + +#include +#include +#include + +/* The SOM BFD backend doesn't currently use anything from these + two include files, but it's likely to need them in the future. */ +#ifdef R_DLT_REL +#include +#include +#endif + +#if defined(HOST_HPPABSD) || defined (HOST_HPPAOSF) +/* BSD uses a completely different scheme for object file identification. + so for now, define _PA_RISC_ID to accept any random value for a model + number. */ +#undef _PA_RISC_ID +#define _PA_RISC_ID(__m_num) 1 +#endif /* HOST_HPPABSD */ + +#define FILE_HDR_SIZE sizeof (struct header) +#define AUX_HDR_SIZE sizeof (struct som_exec_auxhdr) + +typedef struct som_symbol + { + asymbol symbol; + unsigned int som_type; + + /* Structured like the ELF tc_data union. Allows more code sharing + in GAS this way. */ + union + { + struct + { + unsigned int hppa_arg_reloc; + unsigned int hppa_priv_level; + } ap; + PTR any; + } + tc_data; + + /* Index of this symbol in the symbol table. Only used when + building relocation streams for incomplete objects. */ + int index; + + /* How many times this symbol is used in a relocation. By sorting + the symbols from most used to least used we can significantly + reduce the size of the relocation stream for incomplete objects. */ + int reloc_count; + + /* During object file writing, the offset of the name of this symbol + in the SOM string table. */ + int stringtab_offset; + } +som_symbol_type; + +/* A structure containing all the magic information stored in a BFD's + private data which needs to be copied during an objcopy/strip run. */ +struct som_exec_data + { + /* Sort-of a magic number. BSD uses it to distinguish between + native executables and hpux executables. */ + short system_id; + + /* Magic exec flags. These control things like whether or not + null pointer dereferencing is allowed and the like. */ + long exec_flags; + + /* We must preserve the version identifier too. Some versions + of the HP linker do not grok NEW_VERSION_ID for reasons unknown. */ + unsigned int version_id; + + /* Add more stuff here as needed. Good examples of information + we might want to pass would be presumed_dp, entry_* and maybe + others from the file header. */ + }; + +struct somdata + { + /* All the magic information about an executable which lives + in the private BFD structure and needs to be copied from + the input bfd to the output bfd during an objcopy/strip. */ + struct som_exec_data *exec_data; + + /* These three fields are only used when writing files and are + generated from scratch. They need not be copied for objcopy + or strip to work. */ + struct header *file_hdr; + struct copyright_aux_hdr *copyright_aux_hdr; + struct user_string_aux_hdr *version_aux_hdr; + struct som_exec_auxhdr *exec_hdr; + COMPUNIT *comp_unit; + + /* Pointers to a saved copy of the symbol and string tables. These + need not be copied for objcopy or strip to work. */ + som_symbol_type *symtab; + char *stringtab; + asymbol **sorted_syms; + + /* We remember these offsets so that after check_file_format, we have + no dependencies on the particular format of the exec_hdr. + These offsets need not be copied for objcopy or strip to work. */ + + file_ptr sym_filepos; + file_ptr str_filepos; + file_ptr reloc_filepos; + unsigned stringtab_size; + }; + +struct som_data_struct + { + struct somdata a; + }; + +/* Substructure of som_section_data_struct used to hold information + which can't be represented by the generic BFD section structure, + but which must be copied during objcopy or strip. */ +struct som_copyable_section_data_struct + { + /* Various fields in space and subspace headers that we need + to pass around. */ + unsigned int sort_key : 8; + unsigned int access_control_bits : 7; + unsigned int is_defined : 1; + unsigned int is_private : 1; + unsigned int quadrant : 2; + + /* For subspaces, this points to the section which represents the + space in which the subspace is contained. For spaces it points + back to the section for this space. */ + asection *container; + + /* The user-specified space number. It is wrong to use this as + an index since duplicates and holes are allowed. */ + int space_number; + + /* Add more stuff here as needed. Good examples of information + we might want to pass would be initialization pointers, + and the many subspace flags we do not represent yet. */ + }; + +/* Used to keep extra SOM specific information for a given section. + + reloc_size holds the size of the relocation stream, note this + is very different from the number of relocations as SOM relocations + are variable length. + + reloc_stream is the actual stream of relocation entries. */ + +struct som_section_data_struct + { + struct som_copyable_section_data_struct *copy_data; + unsigned int reloc_size; + char *reloc_stream; + struct space_dictionary_record *space_dict; + struct subspace_dictionary_record *subspace_dict; + }; + +#define somdata(bfd) ((bfd)->tdata.som_data->a) +#define obj_som_exec_data(bfd) (somdata(bfd).exec_data) +#define obj_som_file_hdr(bfd) (somdata(bfd).file_hdr) +#define obj_som_exec_hdr(bfd) (somdata(bfd).exec_hdr) +#define obj_som_copyright_hdr(bfd) (somdata(bfd).copyright_aux_hdr) +#define obj_som_version_hdr(bfd) (somdata(bfd).version_aux_hdr) +#define obj_som_compilation_unit(bfd) (somdata(bfd).comp_unit) +#define obj_som_symtab(bfd) (somdata(bfd).symtab) +#define obj_som_stringtab(bfd) (somdata(bfd).stringtab) +#define obj_som_sym_filepos(bfd) (somdata(bfd).sym_filepos) +#define obj_som_str_filepos(bfd) (somdata(bfd).str_filepos) +#define obj_som_stringtab_size(bfd) (somdata(bfd).stringtab_size) +#define obj_som_reloc_filepos(bfd) (somdata(bfd).reloc_filepos) +#define obj_som_sorted_syms(bfd) (somdata(bfd).sorted_syms) +#define som_section_data(sec) \ + ((struct som_section_data_struct *)sec->used_by_bfd) +#define som_symbol_data(symbol) ((som_symbol_type *) symbol) + +/* Defines groups of basic relocations. FIXME: These should + be the only basic relocations created by GAS. The rest + should be internal to the BFD backend. + + The idea is both SOM and ELF define these basic relocation + types so they map into a SOM or ELF specific relocation as + appropriate. This allows GAS to share much more code + between the two object formats. */ + +#define R_HPPA_NONE R_NO_RELOCATION +#define R_HPPA R_CODE_ONE_SYMBOL +#define R_HPPA_PCREL_CALL R_PCREL_CALL +#define R_HPPA_ABS_CALL R_ABS_CALL +#define R_HPPA_GOTOFF R_DP_RELATIVE +#define R_HPPA_ENTRY R_ENTRY +#define R_HPPA_EXIT R_EXIT +#define R_HPPA_COMPLEX R_COMP1 +#define R_HPPA_BEGIN_BRTAB R_BEGIN_BRTAB +#define R_HPPA_END_BRTAB R_END_BRTAB +#define R_HPPA_BEGIN_TRY R_BEGIN_TRY +#define R_HPPA_END_TRY R_END_TRY + +/* Exported functions, mostly for use by GAS. */ +bfd_boolean bfd_som_set_section_attributes + PARAMS ((asection *, int, int, unsigned int, int)); +bfd_boolean bfd_som_set_subsection_attributes + PARAMS ((asection *, asection *, int, unsigned int, int)); +void bfd_som_set_symbol_type PARAMS ((asymbol *, unsigned int)); +bfd_boolean bfd_som_attach_aux_hdr PARAMS ((bfd *, int, char *)); +int ** hppa_som_gen_reloc_type + PARAMS ((bfd *, int, int, enum hppa_reloc_field_selector_type_alt, + int, asymbol *)); +bfd_boolean bfd_som_attach_compilation_unit + PARAMS ((bfd *, const char *, const char *, const char *, const char *)); + +#endif /* _SOM_H */ diff --git a/bfd/sparclynx.c b/bfd/sparclynx.c new file mode 100644 index 0000000000000..a7d78c6fadb6c --- /dev/null +++ b/bfd/sparclynx.c @@ -0,0 +1,269 @@ +/* BFD support for Sparc binaries under LynxOS. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, + 2001, 2002, 2003 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#if 0 +#define N_SHARED_LIB(x) 0 + +#define TEXT_START_ADDR 0 +#define TARGET_PAGE_SIZE 4096 +#define SEGMENT_SIZE TARGET_PAGE_SIZE +#define DEFAULT_ARCH bfd_arch_sparc + +#endif + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (sparclynx_aout_,OP) +#define TARGETNAME "a.out-sparc-lynx" + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#include "aout/sun4.h" +#include "libaout.h" /* BFD a.out internal data structures */ + +#include "aout/aout64.h" +#include "aout/stab_gnu.h" +#include "aout/ar.h" + +void NAME (lynx,set_arch_mach) PARAMS ((bfd *, unsigned long)); +static void choose_reloc_size PARAMS ((bfd *)); +static bfd_boolean NAME (aout,sparclynx_write_object_contents) PARAMS ((bfd *)); + +/* This is needed to reject a NewsOS file, e.g. in + gdb/testsuite/gdb.t10/crossload.exp. + I needed to add M_UNKNOWN to recognize a 68000 object, so this will + probably no longer reject a NewsOS object. . */ +#define MACHTYPE_OK(mtype) ((mtype) == M_UNKNOWN \ + || (mtype) == M_68010 \ + || (mtype) == M_68020 \ + || (mtype) == M_SPARC) + +/* The file @code{aoutf1.h} contains the code for BFD's + a.out back end. Control over the generated back end is given by these + two preprocessor names: + @table @code + @item ARCH_SIZE + This value should be either 32 or 64, depending upon the size of an + int in the target format. It changes the sizes of the structs which + perform the memory/disk mapping of structures. + + The 64 bit backend may only be used if the host compiler supports 64 + ints (eg long long with gcc), by defining the name @code{BFD_HOST_64_BIT} in @code{bfd.h}. + With this name defined, @emph{all} bfd operations are performed with 64bit + arithmetic, not just those to a 64bit target. + + @item TARGETNAME + The name put into the target vector. + @item + @end table */ + +void +NAME(lynx,set_arch_mach) (abfd, machtype) + bfd *abfd; + unsigned long machtype; +{ + /* Determine the architecture and machine type of the object file. */ + enum bfd_architecture arch; + unsigned long machine; + + switch (machtype) + { + case M_UNKNOWN: + /* Some Sun3s make magic numbers without cpu types in them, so + we'll default to the 68000. */ + arch = bfd_arch_m68k; + machine = bfd_mach_m68000; + break; + + case M_68010: + case M_HP200: + arch = bfd_arch_m68k; + machine = bfd_mach_m68010; + break; + + case M_68020: + case M_HP300: + arch = bfd_arch_m68k; + machine = bfd_mach_m68020; + break; + + case M_SPARC: + arch = bfd_arch_sparc; + machine = 0; + break; + + case M_386: + case M_386_DYNIX: + arch = bfd_arch_i386; + machine = 0; + break; + + case M_29K: + arch = bfd_arch_a29k; + machine = 0; + break; + + case M_HPUX: + arch = bfd_arch_m68k; + machine = 0; + break; + + default: + arch = bfd_arch_obscure; + machine = 0; + break; + } + bfd_set_arch_mach (abfd, arch, machine); +} + +#define SET_ARCH_MACH(ABFD, EXEC) \ + NAME(lynx,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \ + choose_reloc_size(ABFD); + +/* Determine the size of a relocation entry, based on the architecture. */ + +static void +choose_reloc_size (abfd) + bfd *abfd; +{ + switch (bfd_get_arch (abfd)) + { + case bfd_arch_sparc: + case bfd_arch_a29k: + obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; + break; + default: + obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; + break; + } +} + +/* Write an object file in LynxOS format. + Section contents have already been written. We write the + file header, symbols, and relocation. */ + +static bfd_boolean +NAME(aout,sparclynx_write_object_contents) (abfd) + bfd *abfd; +{ + struct external_exec exec_bytes; + struct internal_exec *execp = exec_hdr (abfd); + + /* Magic number, maestro, please! */ + switch (bfd_get_arch (abfd)) + { + case bfd_arch_m68k: + switch (bfd_get_mach (abfd)) + { + case bfd_mach_m68010: + N_SET_MACHTYPE (*execp, M_68010); + break; + default: + case bfd_mach_m68020: + N_SET_MACHTYPE (*execp, M_68020); + break; + } + break; + case bfd_arch_sparc: + N_SET_MACHTYPE (*execp, M_SPARC); + break; + case bfd_arch_i386: + N_SET_MACHTYPE (*execp, M_386); + break; + case bfd_arch_a29k: + N_SET_MACHTYPE (*execp, M_29K); + break; + default: + N_SET_MACHTYPE (*execp, M_UNKNOWN); + } + + choose_reloc_size (abfd); + + N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags); + + WRITE_HEADERS (abfd, execp); + + return TRUE; +} + +#define MY_set_sizes sparclynx_set_sizes +static bfd_boolean sparclynx_set_sizes PARAMS ((bfd *)); + +static bfd_boolean +sparclynx_set_sizes (abfd) + bfd *abfd; +{ + switch (bfd_get_arch (abfd)) + { + default: + return FALSE; + case bfd_arch_sparc: + adata (abfd).page_size = 0x2000; + adata (abfd).segment_size = 0x2000; + adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE; + return TRUE; + case bfd_arch_m68k: + adata (abfd).page_size = 0x2000; + adata (abfd).segment_size = 0x20000; + adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE; + return TRUE; + } +} + +static const struct aout_backend_data sparclynx_aout_backend = + { + 0, 1, 0, 1, 0, sparclynx_set_sizes, 0, + 0, /* add_dynamic_symbols */ + 0, /* add_one_symbol */ + 0, /* link_dynamic_object */ + 0, /* write_dynamic_symbol */ + 0, /* check_dynamic_reloc */ + 0 /* finish_dynamic_link */ + }; + + +#define MY_bfd_debug_info_start bfd_void +#define MY_bfd_debug_info_end bfd_void +#define MY_bfd_debug_info_accumulate \ + (void (*) PARAMS ((bfd *, struct bfd_section *))) bfd_void + +#define MY_write_object_contents NAME(aout,sparclynx_write_object_contents) +#define MY_backend_data &sparclynx_aout_backend + +#define TARGET_IS_BIG_ENDIAN_P + +#ifdef LYNX_CORE + +char * lynx_core_file_failing_command (); +int lynx_core_file_failing_signal (); +bfd_boolean lynx_core_file_matches_executable_p (); +const bfd_target * lynx_core_file_p (); + +#define MY_core_file_failing_command lynx_core_file_failing_command +#define MY_core_file_failing_signal lynx_core_file_failing_signal +#define MY_core_file_matches_executable_p lynx_core_file_matches_executable_p +#define MY_core_file_p lynx_core_file_p + +#endif /* LYNX_CORE */ + +#include "aout-target.h" diff --git a/bfd/ticoff.h b/bfd/ticoff.h new file mode 100644 index 0000000000000..81c53b57d0015 --- /dev/null +++ b/bfd/ticoff.h @@ -0,0 +1,130 @@ +/* Copyright 2002 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#undef F_LSYMS +#define F_LSYMS F_LSYMS_TICOFF + +static bfd_boolean +ticoff0_bad_format_hook (abfd, filehdr) + bfd *abfd; + PTR filehdr; +{ + struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; + + if (COFF0_BADMAG (*internal_f)) + return FALSE; + + return TRUE; +} + +static bfd_boolean +ticoff1_bad_format_hook (abfd, filehdr) + bfd *abfd ATTRIBUTE_UNUSED; + PTR filehdr; +{ + struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; + + if (COFF1_BADMAG (*internal_f)) + return FALSE; + + return TRUE; +} + +/* Replace the stock _bfd_coff_is_local_label_name + to recognize TI COFF local labels. */ +static bfd_boolean +ticoff_bfd_is_local_label_name (abfd, name) + bfd *abfd ATTRIBUTE_UNUSED; + const char *name; +{ + if (TICOFF_LOCAL_LABEL_P(name)) + return TRUE; + return FALSE; +} + +#define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name + +/* Customize coffcode.h; the default coff_ functions are set up to use COFF2; + coff_bad_format_hook uses BADMAG, so set that for COFF2. The COFF1 + and COFF0 vectors use custom _bad_format_hook procs instead of setting + BADMAG. */ +#define BADMAG(x) COFF2_BADMAG(x) +#include "coffcode.h" + +/* COFF0 differs in file/section header size and relocation entry size. */ +static const bfd_coff_backend_data ticoff0_swap_table = +{ + coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, + coff_SWAP_aux_out, coff_SWAP_sym_out, + coff_SWAP_lineno_out, coff_SWAP_reloc_out, + coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out, + coff_SWAP_scnhdr_out, + FILHSZ_V0, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ_V0, LINESZ, FILNMLEN, +#ifdef COFF_LONG_FILENAMES + TRUE, +#else + FALSE, +#endif +#ifdef COFF_LONG_SECTION_NAMES + TRUE, +#else + FALSE, +#endif + COFF_DEFAULT_SECTION_ALIGNMENT_POWER, + coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, + coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook, + coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, + coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, + coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, + coff_classify_symbol, coff_compute_section_file_positions, + coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, + coff_adjust_symndx, coff_link_add_one_symbol, + coff_link_output_has_begun, coff_final_link_postscript +}; + +/* COFF1 differs in section header size. */ +static const bfd_coff_backend_data ticoff1_swap_table = +{ + coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, + coff_SWAP_aux_out, coff_SWAP_sym_out, + coff_SWAP_lineno_out, coff_SWAP_reloc_out, + coff_SWAP_filehdr_out, coff_SWAP_aouthdr_out, + coff_SWAP_scnhdr_out, + FILHSZ, AOUTSZ, SCNHSZ_V01, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN, +#ifdef COFF_LONG_FILENAMES + TRUE, +#else + FALSE, +#endif +#ifdef COFF_LONG_SECTION_NAMES + TRUE, +#else + FALSE, +#endif + COFF_DEFAULT_SECTION_ALIGNMENT_POWER, + coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, + coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook, + coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, + coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, + coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, + coff_classify_symbol, coff_compute_section_file_positions, + coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, + coff_adjust_symndx, coff_link_add_one_symbol, + coff_link_output_has_begun, coff_final_link_postscript +}; + diff --git a/bfd/vax1knetbsd.c b/bfd/vax1knetbsd.c new file mode 100644 index 0000000000000..e20cd171d8624 --- /dev/null +++ b/bfd/vax1knetbsd.c @@ -0,0 +1,37 @@ +/* BFD back-end for NetBSD/VAX (1K page size) a.out-ish binaries. + Copyright 1998, 2000, 2001, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define BYTES_IN_WORD 4 +#undef TARGET_IS_BIG_ENDIAN_P + +#define TARGET_PAGE_SIZE 1024 +#define SEGMENT_SIZE TARGET_PAGE_SIZE + +#define DEFAULT_ARCH bfd_arch_vax +#define DEFAULT_MID M_VAX_NETBSD + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (vax1knetbsd_,OP) + +/* This needs to start with a.out so GDB knows it is an a.out variant. */ +#define TARGETNAME "a.out-vax1k-netbsd" + +#include "netbsd.h" diff --git a/bfd/vaxbsd.c b/bfd/vaxbsd.c new file mode 100644 index 0000000000000..a97408fa0685d --- /dev/null +++ b/bfd/vaxbsd.c @@ -0,0 +1,40 @@ +/* BFD back-end for BSD and Ultrix/VAX (1K page size) a.out-ish binaries. + Copyright 2002, 2003 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define N_HEADER_IN_TEXT(x) 0 +#define ENTRY_CAN_BE_ZERO +#define N_SHARED_LIB(x) 0 /* Avoids warning */ +#define TEXT_START_ADDR 0 +#define TARGET_PAGE_SIZE 1024 +#define SEGMENT_SIZE TARGET_PAGE_SIZE +#define DEFAULT_ARCH bfd_arch_vax + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate the + tokens. */ +#define MY(OP) CONCAT2 (vaxbsd_,OP) + +#define TARGETNAME "a.out-vax-bsd" + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "libaout.h" + +#include "aout-target.h" diff --git a/bfd/vaxnetbsd.c b/bfd/vaxnetbsd.c new file mode 100644 index 0000000000000..48a1ed637a25c --- /dev/null +++ b/bfd/vaxnetbsd.c @@ -0,0 +1,37 @@ +/* BFD back-end for NetBSD/VAX (4K page size) a.out-ish binaries. + Copyright 1998, 2000, 2001, 2002 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#define BYTES_IN_WORD 4 +#undef TARGET_IS_BIG_ENDIAN_P + +#define TARGET_PAGE_SIZE 0x1000 +#define SEGMENT_SIZE TARGET_PAGE_SIZE + +#define DEFAULT_ARCH bfd_arch_vax +#define DEFAULT_MID M_VAX4K_NETBSD + +/* Do not "beautify" the CONCAT* macro args. Traditional C will not + remove whitespace added here, and thus will fail to concatenate + the tokens. */ +#define MY(OP) CONCAT2 (vaxnetbsd_,OP) + +/* This needs to start with a.out so GDB knows it is an a.out variant. */ +#define TARGETNAME "a.out-vax-netbsd" + +#include "netbsd.h" diff --git a/bfd/versados.c b/bfd/versados.c new file mode 100644 index 0000000000000..19df300b5dd9f --- /dev/null +++ b/bfd/versados.c @@ -0,0 +1,936 @@ +/* BFD back-end for VERSAdos-E objects. + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Written by Steve Chamberlain of Cygnus Support . + + Versados is a Motorola trademark. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +/* + SUBSECTION + VERSAdos-E relocatable object file format + + DESCRIPTION + + This module supports reading of VERSAdos relocatable + object files. + + A VERSAdos file looks like contains + + o Identification Record + o External Symbol Definition Record + o Object Text Record + o End Record + + */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "libiberty.h" + +static bfd_boolean versados_mkobject PARAMS ((bfd *)); +static bfd_boolean versados_scan PARAMS ((bfd *)); +static const bfd_target *versados_object_p PARAMS ((bfd *)); +static asymbol *versados_new_symbol + PARAMS ((bfd *, int, const char *, bfd_vma, asection *)); +static char *new_symbol_string PARAMS ((bfd *, const char *)); +static const bfd_target *versados_object_p PARAMS ((bfd *)); +static bfd_boolean versados_pass_2 PARAMS ((bfd *)); +static bfd_boolean versados_get_section_contents + PARAMS ((bfd *, asection *, void *, file_ptr, bfd_size_type)); +static bfd_boolean versados_set_section_contents + PARAMS ((bfd *, sec_ptr, const void *, file_ptr, bfd_size_type)); +static int versados_sizeof_headers PARAMS ((bfd *, bfd_boolean)); +static long int versados_get_symtab_upper_bound PARAMS ((bfd *)); +static long int versados_canonicalize_symtab PARAMS ((bfd *, asymbol **)); +static void versados_get_symbol_info + PARAMS ((bfd *, asymbol *, symbol_info *)); +static void versados_print_symbol + PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); +static long versados_get_reloc_upper_bound + PARAMS ((bfd *, sec_ptr)); +static long versados_canonicalize_reloc + PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); + +#define VHEADER '1' +#define VESTDEF '2' +#define VOTR '3' +#define VEND '4' + +#define ES_BASE 17 /* first symbol has esdid 17 */ + +/* Per file target dependent information */ + +/* one for each section */ +struct esdid + { + asection *section; /* ptr to bfd version */ + unsigned char *contents; /* used to build image */ + int pc; + int relocs; /* reloc count, valid end of pass 1 */ + int donerel; /* have relocs been translated */ + }; + +typedef struct versados_data_struct + { + int es_done; /* count of symbol index, starts at ES_BASE */ + asymbol *symbols; /* pointer to local symbols */ + char *strings; /* strings of all the above */ + int stringlen; /* len of string table (valid end of pass1) */ + int nsecsyms; /* number of sections */ + + int ndefs; /* number of exported symbols (they dont get esdids) */ + int nrefs; /* number of imported symbols (valid end of pass1) */ + + int ref_idx; /* current processed value of the above */ + int def_idx; + + int pass_2_done; + + struct esdid e[16]; /* per section info */ + int alert; /* to see if we're trampling */ + asymbol *rest[256 - 16]; /* per symbol info */ + + } +tdata_type; + +#define VDATA(abfd) (abfd->tdata.versados_data) +#define EDATA(abfd, n) (abfd->tdata.versados_data->e[n]) +#define RDATA(abfd, n) (abfd->tdata.versados_data->rest[n]) + +struct ext_otr + { + unsigned char size; + char type; + unsigned char map[4]; + unsigned char esdid; + unsigned char data[200]; + }; + +struct ext_vheader + { + unsigned char size; + char type; /* record type */ + char name[10]; /* module name */ + char rev; /* module rev number */ + char lang; + char vol[4]; + char user[2]; + char cat[8]; + char fname[8]; + char ext[2]; + char time[3]; + char date[3]; + char rest[211]; + }; + +struct ext_esd + { + unsigned char size; + char type; + unsigned char esd_entries[1]; + }; +#define ESD_ABS 0 +#define ESD_COMMON 1 +#define ESD_STD_REL_SEC 2 +#define ESD_SHRT_REL_SEC 3 +#define ESD_XDEF_IN_SEC 4 +#define ESD_XREF_SYM 7 +#define ESD_XREF_SEC 6 +#define ESD_XDEF_IN_ABS 5 +union ext_any + { + unsigned char size; + struct ext_vheader header; + struct ext_esd esd; + struct ext_otr otr; + }; + +static int get_record PARAMS ((bfd *, union ext_any *)); +static int get_4 PARAMS ((unsigned char **)); +static void get_10 PARAMS ((unsigned char **, char *)); +static void process_esd PARAMS ((bfd *, struct ext_esd *, int)); +static int get_offset PARAMS ((int, unsigned char *)); +static void process_otr PARAMS ((bfd *, struct ext_otr *, int)); + +/* Initialize by filling in the hex conversion array. */ + +/* Set up the tdata information. */ + +static bfd_boolean +versados_mkobject (abfd) + bfd *abfd; +{ + if (abfd->tdata.versados_data == NULL) + { + bfd_size_type amt = sizeof (tdata_type); + tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, amt); + if (tdata == NULL) + return FALSE; + abfd->tdata.versados_data = tdata; + tdata->symbols = NULL; + VDATA (abfd)->alert = 0x12345678; + } + + bfd_default_set_arch_mach (abfd, bfd_arch_m68k, 0); + return TRUE; +} + +/* Report a problem in an S record file. FIXME: This probably should + not call fprintf, but we really do need some mechanism for printing + error messages. */ + +static asymbol * +versados_new_symbol (abfd, snum, name, val, sec) + bfd *abfd; + int snum; + const char *name; + bfd_vma val; + asection *sec; +{ + asymbol *n = VDATA (abfd)->symbols + snum; + n->name = name; + n->value = val; + n->section = sec; + n->the_bfd = abfd; + n->flags = 0; + return n; +} + +static int +get_record (abfd, ptr) + bfd *abfd; + union ext_any *ptr; +{ + if (bfd_bread (&ptr->size, (bfd_size_type) 1, abfd) != 1 + || (bfd_bread ((char *) ptr + 1, (bfd_size_type) ptr->size, abfd) + != ptr->size)) + return 0; + return 1; +} + +static int +get_4 (pp) + unsigned char **pp; +{ + unsigned char *p = *pp; + *pp += 4; + return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0); +} + +static void +get_10 (pp, name) + unsigned char **pp; + char *name; +{ + char *p = (char *) *pp; + int len = 10; + *pp += len; + while (*p != ' ' + && len) + { + *name++ = *p++; + len--; + } + *name = 0; +} + +static char * +new_symbol_string (abfd, name) + bfd *abfd; + const char *name; +{ + char *n = VDATA (abfd)->strings; + strcpy (VDATA (abfd)->strings, name); + VDATA (abfd)->strings += strlen (VDATA (abfd)->strings) + 1; + return n; +} + +static void +process_esd (abfd, esd, pass) + bfd *abfd; + struct ext_esd *esd; + int pass; +{ + /* Read through the ext def for the est entries */ + int togo = esd->size - 2; + bfd_vma size; + bfd_vma start; + asection *sec; + char name[11]; + unsigned char *ptr = esd->esd_entries; + unsigned char *end = ptr + togo; + while (ptr < end) + { + int scn = *ptr & 0xf; + int typ = (*ptr >> 4) & 0xf; + + /* Declare this section */ + sprintf (name, "%d", scn); + sec = bfd_make_section_old_way (abfd, strdup (name)); + sec->target_index = scn; + EDATA (abfd, scn).section = sec; + ptr++; + switch (typ) + { + default: + abort (); + case ESD_XREF_SEC: + case ESD_XREF_SYM: + { + int snum = VDATA (abfd)->ref_idx++; + get_10 (&ptr, name); + if (pass == 1) + { + VDATA (abfd)->stringlen += strlen (name) + 1; + } + else + { + int esidx; + asymbol *s; + char *n = new_symbol_string (abfd, name); + s = versados_new_symbol (abfd, snum, n, (bfd_vma) 0, + bfd_und_section_ptr); + esidx = VDATA (abfd)->es_done++; + RDATA (abfd, esidx - ES_BASE) = s; + } + } + break; + + case ESD_ABS: + size = get_4 (&ptr); + start = get_4 (&ptr); + break; + case ESD_STD_REL_SEC: + case ESD_SHRT_REL_SEC: + { + sec->_raw_size = get_4 (&ptr); + sec->flags |= SEC_ALLOC; + } + break; + case ESD_XDEF_IN_ABS: + sec = (asection *) & bfd_abs_section; + case ESD_XDEF_IN_SEC: + { + int snum = VDATA (abfd)->def_idx++; + bfd_vma val; + get_10 (&ptr, name); + val = get_4 (&ptr); + if (pass == 1) + { + /* Just remember the symbol */ + VDATA (abfd)->stringlen += strlen (name) + 1; + } + else + { + asymbol *s; + char *n = new_symbol_string (abfd, name); + s = versados_new_symbol (abfd, snum + VDATA (abfd)->nrefs, n, + val, sec); + s->flags |= BSF_GLOBAL; + } + } + break; + } + } +} + +#define R_RELWORD 1 +#define R_RELLONG 2 +#define R_RELWORD_NEG 3 +#define R_RELLONG_NEG 4 + +reloc_howto_type versados_howto_table[] = +{ + HOWTO (R_RELWORD, 0, 1, 16, FALSE, + 0, complain_overflow_dont, 0, + "+v16", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (R_RELLONG, 0, 2, 32, FALSE, + 0, complain_overflow_dont, 0, + "+v32", TRUE, 0xffffffff, 0xffffffff, FALSE), + + HOWTO (R_RELWORD_NEG, 0, -1, 16, FALSE, + 0, complain_overflow_dont, 0, + "-v16", TRUE, 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (R_RELLONG_NEG, 0, -2, 32, FALSE, + 0, complain_overflow_dont, 0, + "-v32", TRUE, 0xffffffff, 0xffffffff, FALSE), +}; + +static int +get_offset (len, ptr) + int len; + unsigned char *ptr; +{ + int val = 0; + if (len) + { + int i; + val = *ptr++; + if (val & 0x80) + val |= ~0xff; + for (i = 1; i < len; i++) + val = (val << 8) | *ptr++; + } + + return val; +} + +static void +process_otr (abfd, otr, pass) + bfd *abfd; + struct ext_otr *otr; + int pass; +{ + unsigned long shift; + unsigned char *srcp = otr->data; + unsigned char *endp = (unsigned char *) otr + otr->size; + unsigned int bits = (otr->map[0] << 24) + | (otr->map[1] << 16) + | (otr->map[2] << 8) + | (otr->map[3] << 0); + + struct esdid *esdid = &EDATA (abfd, otr->esdid - 1); + unsigned char *contents = esdid->contents; + int need_contents = 0; + unsigned int dst_idx = esdid->pc; + + for (shift = ((unsigned long) 1 << 31); shift && srcp < endp; shift >>= 1) + { + if (bits & shift) + { + int flag = *srcp++; + int esdids = (flag >> 5) & 0x7; + int sizeinwords = ((flag >> 3) & 1) ? 2 : 1; + int offsetlen = flag & 0x7; + int j; + + if (esdids == 0) + { + /* A zero esdid means the new pc is the offset given */ + dst_idx += get_offset (offsetlen, srcp); + srcp += offsetlen; + } + else + { + int val = get_offset (offsetlen, srcp + esdids); + if (pass == 1) + need_contents = 1; + else + for (j = 0; j < sizeinwords * 2; j++) + { + contents[dst_idx + (sizeinwords * 2) - j - 1] = val; + val >>= 8; + } + + for (j = 0; j < esdids; j++) + { + int esdid = *srcp++; + + if (esdid) + { + int rn = EDATA (abfd, otr->esdid - 1).relocs++; + if (pass == 1) + { + /* this is the first pass over the data, + just remember that we need a reloc */ + } + else + { + arelent *n = + EDATA (abfd, otr->esdid - 1).section->relocation + rn; + n->address = dst_idx; + + n->sym_ptr_ptr = (asymbol **) esdid; + n->addend = 0; + n->howto = versados_howto_table + ((j & 1) * 2) + (sizeinwords - 1); + } + } + } + srcp += offsetlen; + dst_idx += sizeinwords * 2; + } + } + else + { + need_contents = 1; + if (dst_idx < esdid->section->_raw_size) + if (pass == 2) + { + /* absolute code, comes in 16 bit lumps */ + contents[dst_idx] = srcp[0]; + contents[dst_idx + 1] = srcp[1]; + } + dst_idx += 2; + srcp += 2; + } + } + EDATA (abfd, otr->esdid - 1).pc = dst_idx; + + if (!contents && need_contents) + { + bfd_size_type size = esdid->section->_raw_size; + esdid->contents = (unsigned char *) bfd_alloc (abfd, size); + } +} + +static bfd_boolean +versados_scan (abfd) + bfd *abfd; +{ + int loop = 1; + int i; + int j; + int nsecs = 0; + bfd_size_type amt; + + VDATA (abfd)->stringlen = 0; + VDATA (abfd)->nrefs = 0; + VDATA (abfd)->ndefs = 0; + VDATA (abfd)->ref_idx = 0; + VDATA (abfd)->def_idx = 0; + VDATA (abfd)->pass_2_done = 0; + + while (loop) + { + union ext_any any; + if (!get_record (abfd, &any)) + return TRUE; + switch (any.header.type) + { + case VHEADER: + break; + case VEND: + loop = 0; + break; + case VESTDEF: + process_esd (abfd, &any.esd, 1); + break; + case VOTR: + process_otr (abfd, &any.otr, 1); + break; + } + } + + /* Now allocate space for the relocs and sections */ + + VDATA (abfd)->nrefs = VDATA (abfd)->ref_idx; + VDATA (abfd)->ndefs = VDATA (abfd)->def_idx; + VDATA (abfd)->ref_idx = 0; + VDATA (abfd)->def_idx = 0; + + abfd->symcount = VDATA (abfd)->nrefs + VDATA (abfd)->ndefs; + + for (i = 0; i < 16; i++) + { + struct esdid *esdid = &EDATA (abfd, i); + if (esdid->section) + { + amt = (bfd_size_type) esdid->relocs * sizeof (arelent); + esdid->section->relocation = (arelent *) bfd_alloc (abfd, amt); + + esdid->pc = 0; + + if (esdid->contents) + esdid->section->flags |= SEC_HAS_CONTENTS | SEC_LOAD; + + esdid->section->reloc_count = esdid->relocs; + if (esdid->relocs) + esdid->section->flags |= SEC_RELOC; + + esdid->relocs = 0; + + /* Add an entry into the symbol table for it */ + nsecs++; + VDATA (abfd)->stringlen += strlen (esdid->section->name) + 1; + } + } + + abfd->symcount += nsecs; + + amt = abfd->symcount; + amt *= sizeof (asymbol); + VDATA (abfd)->symbols = (asymbol *) bfd_alloc (abfd, amt); + + amt = VDATA (abfd)->stringlen; + VDATA (abfd)->strings = bfd_alloc (abfd, amt); + + if ((VDATA (abfd)->symbols == NULL && abfd->symcount > 0) + || (VDATA (abfd)->strings == NULL && VDATA (abfd)->stringlen > 0)) + return FALSE; + + /* Actually fill in the section symbols, + we stick them at the end of the table */ + + for (j = VDATA (abfd)->nrefs + VDATA (abfd)->ndefs, i = 0; i < 16; i++) + { + struct esdid *esdid = &EDATA (abfd, i); + asection *sec = esdid->section; + if (sec) + { + asymbol *s = VDATA (abfd)->symbols + j; + s->name = new_symbol_string (abfd, sec->name); + s->section = sec; + s->flags = BSF_LOCAL; + s->value = 0; + s->the_bfd = abfd; + j++; + } + } + if (abfd->symcount) + abfd->flags |= HAS_SYMS; + + /* Set this to nsecs - since we've already planted the section + symbols */ + VDATA (abfd)->nsecsyms = nsecs; + + VDATA (abfd)->ref_idx = 0; + + return 1; +} + +/* Check whether an existing file is a versados file. */ + +static const bfd_target * +versados_object_p (abfd) + bfd *abfd; +{ + struct ext_vheader ext; + unsigned char len; + tdata_type *tdata_save; + + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + return NULL; + + if (bfd_bread (&len, (bfd_size_type) 1, abfd) != 1) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + if (bfd_bread (&ext.type, (bfd_size_type) len, abfd) != len) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + /* We guess that the language field will never be larger than 10. + In sample files, it is always either 0 or 1. Checking for this + prevents confusion with Intel Hex files. */ + if (ext.type != VHEADER + || ext.lang > 10) + { + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + + /* OK, looks like a record, build the tdata and read in. */ + + tdata_save = abfd->tdata.versados_data; + if (!versados_mkobject (abfd) || !versados_scan (abfd)) + { + abfd->tdata.versados_data = tdata_save; + return NULL; + } + + return abfd->xvec; +} + +static bfd_boolean +versados_pass_2 (abfd) + bfd *abfd; +{ + union ext_any any; + + if (VDATA (abfd)->pass_2_done) + return 1; + + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + return 0; + + VDATA (abfd)->es_done = ES_BASE; + + /* read records till we get to where we want to be */ + + while (1) + { + get_record (abfd, &any); + switch (any.header.type) + { + case VEND: + VDATA (abfd)->pass_2_done = 1; + return 1; + case VESTDEF: + process_esd (abfd, &any.esd, 2); + break; + case VOTR: + process_otr (abfd, &any.otr, 2); + break; + } + } +} + +static bfd_boolean +versados_get_section_contents (abfd, section, location, offset, count) + bfd *abfd; + asection *section; + PTR location; + file_ptr offset; + bfd_size_type count; +{ + if (!versados_pass_2 (abfd)) + return FALSE; + + memcpy (location, + EDATA (abfd, section->target_index).contents + offset, + (size_t) count); + + return TRUE; +} + +#define versados_get_section_contents_in_window \ + _bfd_generic_get_section_contents_in_window + +static bfd_boolean +versados_set_section_contents (abfd, section, location, offset, bytes_to_do) + bfd *abfd ATTRIBUTE_UNUSED; + sec_ptr section ATTRIBUTE_UNUSED; + const PTR location ATTRIBUTE_UNUSED; + file_ptr offset ATTRIBUTE_UNUSED; + bfd_size_type bytes_to_do ATTRIBUTE_UNUSED; +{ + return FALSE; +} + +static int +versados_sizeof_headers (abfd, exec) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_boolean exec ATTRIBUTE_UNUSED; +{ + return 0; +} + +/* Return the amount of memory needed to read the symbol table. */ + +static long +versados_get_symtab_upper_bound (abfd) + bfd *abfd; +{ + return (bfd_get_symcount (abfd) + 1) * sizeof (asymbol *); +} + +/* Return the symbol table. */ + +static long +versados_canonicalize_symtab (abfd, alocation) + bfd *abfd; + asymbol **alocation; +{ + unsigned int symcount = bfd_get_symcount (abfd); + unsigned int i; + asymbol *s; + + versados_pass_2 (abfd); + + for (i = 0, s = VDATA (abfd)->symbols; + i < symcount; + s++, i++) + { + *alocation++ = s; + } + + *alocation = NULL; + + return symcount; +} + +static void +versados_get_symbol_info (ignore_abfd, symbol, ret) + bfd *ignore_abfd ATTRIBUTE_UNUSED; + asymbol *symbol; + symbol_info *ret; +{ + bfd_symbol_info (symbol, ret); +} + +static void +versados_print_symbol (abfd, afile, symbol, how) + bfd *abfd; + PTR afile; + asymbol *symbol; + bfd_print_symbol_type how; +{ + FILE *file = (FILE *) afile; + switch (how) + { + case bfd_print_symbol_name: + fprintf (file, "%s", symbol->name); + break; + default: + bfd_print_symbol_vandf (abfd, (PTR) file, symbol); + fprintf (file, " %-5s %s", + symbol->section->name, + symbol->name); + + } +} + +static long +versados_get_reloc_upper_bound (abfd, asect) + bfd *abfd ATTRIBUTE_UNUSED; + sec_ptr asect; +{ + return (asect->reloc_count + 1) * sizeof (arelent *); +} + +static long +versados_canonicalize_reloc (abfd, section, relptr, symbols) + bfd *abfd; + sec_ptr section; + arelent **relptr; + asymbol **symbols; +{ + unsigned int count; + arelent *src; + + versados_pass_2 (abfd); + src = section->relocation; + if (!EDATA (abfd, section->target_index).donerel) + { + EDATA (abfd, section->target_index).donerel = 1; + /* translate from indexes to symptr ptrs */ + for (count = 0; count < section->reloc_count; count++) + { + int esdid = (int) src[count].sym_ptr_ptr; + + if (esdid == 0) + { + src[count].sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr; + } + else if (esdid < ES_BASE) /* Section relative thing */ + { + struct esdid *e = &EDATA (abfd, esdid - 1); + if (!section) + { + /** relocation relative to section which was + never declared ! */ + } + src[count].sym_ptr_ptr = e->section->symbol_ptr_ptr; + } + else + { + src[count].sym_ptr_ptr = symbols + esdid - ES_BASE; + } + + } + } + + for (count = 0; count < section->reloc_count; count++) + { + *relptr++ = src++; + } + *relptr = 0; + return section->reloc_count; +} + +#define versados_close_and_cleanup _bfd_generic_close_and_cleanup +#define versados_bfd_free_cached_info _bfd_generic_bfd_free_cached_info +#define versados_new_section_hook _bfd_generic_new_section_hook + +#define versados_bfd_is_local_label_name bfd_generic_is_local_label_name +#define versados_get_lineno _bfd_nosymbols_get_lineno +#define versados_find_nearest_line _bfd_nosymbols_find_nearest_line +#define versados_make_empty_symbol _bfd_generic_make_empty_symbol +#define versados_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define versados_read_minisymbols _bfd_generic_read_minisymbols +#define versados_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol + +#define versados_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup + +#define versados_set_arch_mach bfd_default_set_arch_mach + +#define versados_bfd_get_relocated_section_contents \ + bfd_generic_get_relocated_section_contents +#define versados_bfd_relax_section bfd_generic_relax_section +#define versados_bfd_gc_sections bfd_generic_gc_sections +#define versados_bfd_merge_sections bfd_generic_merge_sections +#define versados_bfd_discard_group bfd_generic_discard_group +#define versados_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define versados_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define versados_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define versados_bfd_link_just_syms _bfd_generic_link_just_syms +#define versados_bfd_final_link _bfd_generic_final_link +#define versados_bfd_link_split_section _bfd_generic_link_split_section + +const bfd_target versados_vec = +{ + "versados", /* name */ + bfd_target_versados_flavour, + BFD_ENDIAN_BIG, /* target byte order */ + BFD_ENDIAN_BIG, /* target headers byte order */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), + (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS + | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ + 0, /* leading underscore */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + + { + _bfd_dummy_target, + versados_object_p, /* bfd_check_format */ + _bfd_dummy_target, + _bfd_dummy_target, + }, + { + bfd_false, + versados_mkobject, + _bfd_generic_mkarchive, + bfd_false, + }, + { /* bfd_write_contents */ + bfd_false, + bfd_false, + _bfd_write_archive_contents, + bfd_false, + }, + + BFD_JUMP_TABLE_GENERIC (versados), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (versados), + BFD_JUMP_TABLE_RELOCS (versados), + BFD_JUMP_TABLE_WRITE (versados), + BFD_JUMP_TABLE_LINK (versados), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + (PTR) 0 +}; diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c new file mode 100644 index 0000000000000..660c06cbc4c21 --- /dev/null +++ b/bfd/vms-gsd.c @@ -0,0 +1,930 @@ +/* vms-gsd.c -- BFD back-end for VAX (openVMS/VAX) and + EVAX (openVMS/Alpha) files. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. + + go and read the openVMS linker manual (esp. appendix B) + if you don't know what's going on here :-) + + Written by Klaus K"ampf (kkaempf@rmi.de) + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" + +#include "vms.h" + +/*-----------------------------------------------------------------------------*/ + +/* typical sections for vax object files */ + +#define VAX_CODE_NAME "$CODE" +#define VAX_DATA_NAME "$DATA" +#define VAX_ADDRESS_DATA_NAME "$ADDRESS_DATA" + +/* typical sections for evax object files */ + +#define EVAX_ABS_NAME "$ABS$" +#define EVAX_CODE_NAME "$CODE$" +#define EVAX_LINK_NAME "$LINK$" +#define EVAX_DATA_NAME "$DATA$" +#define EVAX_BSS_NAME "$BSS$" +#define EVAX_READONLYADDR_NAME "$READONLY_ADDR$" +#define EVAX_READONLY_NAME "$READONLY$" +#define EVAX_LITERAL_NAME "$LITERAL$" +#define EVAX_COMMON_NAME "$COMMON$" +#define EVAX_LOCAL_NAME "$LOCAL$" + +struct sec_flags_struct { + char *name; /* name of section */ + int vflags_always; + flagword flags_always; /* flags we set always */ + int vflags_hassize; + flagword flags_hassize; /* flags we set if the section has a size > 0 */ +}; + +/* These flags are deccrtl/vaxcrtl (openVMS 6.2 VAX) compatible */ + +static struct sec_flags_struct vax_section_flags[] = { + { VAX_CODE_NAME, + (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_SHR|GPS_S_M_EXE|GPS_S_M_RD), + (SEC_CODE), + (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_SHR|GPS_S_M_EXE|GPS_S_M_RD), + (SEC_IN_MEMORY|SEC_CODE|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) }, + { VAX_DATA_NAME, + (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_RD|GPS_S_M_WRT), + (SEC_DATA), + (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_RD|GPS_S_M_WRT), + (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) }, + { VAX_ADDRESS_DATA_NAME, + (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_RD), + (SEC_DATA|SEC_READONLY), + (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_RD), + (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_READONLY|SEC_LOAD) }, + { NULL, + (GPS_S_M_PIC|GPS_S_M_OVR|GPS_S_M_REL|GPS_S_M_GBL|GPS_S_M_RD|GPS_S_M_WRT), + (SEC_DATA), + (GPS_S_M_PIC|GPS_S_M_OVR|GPS_S_M_REL|GPS_S_M_GBL|GPS_S_M_RD|GPS_S_M_WRT), + (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) } +}; + +/* These flags are deccrtl/vaxcrtl (openVMS 6.2 Alpha) compatible */ + +static struct sec_flags_struct evax_section_flags[] = { + { EVAX_ABS_NAME, + (EGPS_S_V_SHR), + (SEC_DATA), + (EGPS_S_V_SHR), + (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) }, + { EVAX_CODE_NAME, + (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_SHR|EGPS_S_V_EXE), + (SEC_CODE), + (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_SHR|EGPS_S_V_EXE), + (SEC_IN_MEMORY|SEC_CODE|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) }, + { EVAX_LITERAL_NAME, + (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_SHR|EGPS_S_V_RD|EGPS_S_V_NOMOD), + (SEC_DATA|SEC_READONLY), + (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_SHR|EGPS_S_V_RD), + (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_READONLY|SEC_LOAD) }, + { EVAX_LINK_NAME, + (EGPS_S_V_REL|EGPS_S_V_RD), + (SEC_DATA|SEC_READONLY), + (EGPS_S_V_REL|EGPS_S_V_RD), + (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_READONLY|SEC_LOAD) }, + { EVAX_DATA_NAME, + (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT|EGPS_S_V_NOMOD), + (SEC_DATA), + (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT), + (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) }, + { EVAX_BSS_NAME, + (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT|EGPS_S_V_NOMOD), + (SEC_NO_FLAGS), + (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT|EGPS_S_V_NOMOD), + (SEC_IN_MEMORY|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) }, + { EVAX_READONLYADDR_NAME, + (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_RD), + (SEC_DATA|SEC_READONLY), + (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_RD), + (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_READONLY|SEC_LOAD) }, + { EVAX_READONLY_NAME, + (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_SHR|EGPS_S_V_RD|EGPS_S_V_NOMOD), + (SEC_DATA|SEC_READONLY), + (EGPS_S_V_PIC|EGPS_S_V_REL|EGPS_S_V_SHR|EGPS_S_V_RD), + (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_READONLY|SEC_LOAD) }, + { EVAX_LOCAL_NAME, + (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT), + (SEC_DATA), + (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT), + (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) }, + { NULL, + (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT), + (SEC_DATA), + (EGPS_S_V_REL|EGPS_S_V_RD|EGPS_S_V_WRT), + (SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) } +}; + +static flagword vms_secflag_by_name PARAMS ((bfd *, struct sec_flags_struct *, char *, int)); +static flagword vms_esecflag_by_name PARAMS ((struct sec_flags_struct *, char *, int)); + +/* Retrieve bfd section flags by name and size */ + +static flagword +vms_secflag_by_name (abfd, section_flags, name, hassize) + bfd *abfd; + struct sec_flags_struct *section_flags; + char *name; + int hassize; +{ + int i = 0; + + while (section_flags[i].name != NULL) + { + if ((PRIV(is_vax)? + strcasecmp (name, section_flags[i].name): + strcmp (name, section_flags[i].name)) == 0) + { + if (hassize) + return section_flags[i].flags_hassize; + else + return section_flags[i].flags_always; + } + i++; + } + if (hassize) + return section_flags[i].flags_hassize; + return section_flags[i].flags_always; +} + +/* Retrieve vms section flags by name and size */ + +static flagword +vms_esecflag_by_name (section_flags, name, hassize) + struct sec_flags_struct *section_flags; + char *name; + int hassize; +{ + int i = 0; + + while (section_flags[i].name != NULL) + { + if (strcmp (name, section_flags[i].name) == 0) + { + if (hassize) + return section_flags[i].vflags_hassize; + else + return section_flags[i].vflags_always; + } + i++; + } + if (hassize) + return section_flags[i].vflags_hassize; + return section_flags[i].vflags_always; +} + +/*-----------------------------------------------------------------------------*/ +#if VMS_DEBUG +/* debug */ + +struct flagdescstruct { char *name; flagword value; }; + +/* Convert flag to printable string */ + +static char * +flag2str(flagdesc, flags) + struct flagdescstruct *flagdesc; + flagword flags; +{ + + static char res[64]; + int next = 0; + + res[0] = 0; + while (flagdesc->name != NULL) + { + if ((flags & flagdesc->value) != 0) + { + if (next) + strcat(res, ","); + else + next = 1; + strcat (res, flagdesc->name); + } + flagdesc++; + } + return res; +} +#endif + +/*-----------------------------------------------------------------------------*/ +/* input routines */ + +/* Process GSD/EGSD record + return 0 on success, -1 on error */ + +int +_bfd_vms_slurp_gsd (abfd, objtype) + bfd *abfd; + int objtype; +{ +#if VMS_DEBUG + static struct flagdescstruct gpsflagdesc[] = + { + { "PIC", 0x0001 }, + { "LIB", 0x0002 }, + { "OVR", 0x0004 }, + { "REL", 0x0008 }, + { "GBL", 0x0010 }, + { "SHR", 0x0020 }, + { "EXE", 0x0040 }, + { "RD", 0x0080 }, + { "WRT", 0x0100 }, + { "VEC", 0x0200 }, + { "NOMOD", 0x0400 }, + { "COM", 0x0800 }, + { NULL, 0 } + }; + + static struct flagdescstruct gsyflagdesc[] = + { + { "WEAK", 0x0001 }, + { "DEF", 0x0002 }, + { "UNI", 0x0004 }, + { "REL", 0x0008 }, + { "COMM", 0x0010 }, + { "VECEP", 0x0020 }, + { "NORM", 0x0040 }, + { NULL, 0 } + }; +#endif + + int gsd_type, gsd_size; + asection *section; + unsigned char *vms_rec; + flagword new_flags, old_flags; + char *name; + asymbol *symbol; + vms_symbol_entry *entry; + unsigned long base_addr; + unsigned long align_addr; + static unsigned int psect_idx = 0; + +#if VMS_DEBUG + vms_debug (2, "GSD/EGSD (%d/%x)\n", objtype, objtype); +#endif + + switch (objtype) + { + case EOBJ_S_C_EGSD: + PRIV(vms_rec) += 8; /* skip type, size, l_temp */ + PRIV(rec_size) -= 8; + break; + case OBJ_S_C_GSD: + PRIV(vms_rec) += 1; + PRIV(rec_size) -= 1; + break; + default: + return -1; + } + + /* calculate base address for each section */ + base_addr = 0L; + + abfd->symcount = 0; + + while (PRIV(rec_size) > 0) + { + vms_rec = PRIV(vms_rec); + + if (objtype == OBJ_S_C_GSD) + { + gsd_type = *vms_rec; + } + else + { + _bfd_vms_get_header_values (abfd, vms_rec, &gsd_type, &gsd_size); + gsd_type += EVAX_OFFSET; + } + +#if VMS_DEBUG + vms_debug (3, "gsd_type %d\n", gsd_type); +#endif + + switch (gsd_type) + { + case GSD_S_C_PSC: + { + /* + * program section definition + */ + + asection *old_section = 0; + +#if VMS_DEBUG + vms_debug (4, "GSD_S_C_PSC\n"); +#endif + /* If this section isn't a bfd section. */ + + if (PRIV(is_vax) && (psect_idx < (abfd->section_count-1))) + { + /* check for temporary section from TIR record. */ + + if (psect_idx < PRIV(section_count)) + old_section = PRIV(sections)[psect_idx]; + else + old_section = 0; + } + + name = _bfd_vms_save_counted_string (vms_rec + 8); + section = bfd_make_section (abfd, name); + if (!section) + { + (*_bfd_error_handler) (_("bfd_make_section (%s) failed"), + name); + return -1; + } + old_flags = bfd_getl16 (vms_rec + 2); + section->_raw_size = bfd_getl32 (vms_rec + 4); /* allocation */ + new_flags = vms_secflag_by_name (abfd, vax_section_flags, name, + section->_raw_size > 0); + if (old_flags & EGPS_S_V_REL) + new_flags |= SEC_RELOC; + if (old_flags & GPS_S_M_OVR) + new_flags |= SEC_IS_COMMON; + if (!bfd_set_section_flags (abfd, section, new_flags)) + { + (*_bfd_error_handler) + (_("bfd_set_section_flags (%s, %x) failed"), + name, new_flags); + return -1; + } + section->alignment_power = vms_rec[1]; + align_addr = (1 << section->alignment_power); + if ((base_addr % align_addr) != 0) + base_addr += (align_addr - (base_addr % align_addr)); + section->vma = (bfd_vma)base_addr; + base_addr += section->_raw_size; + + /* global section is common symbol */ + + if (old_flags & GPS_S_M_GBL) + { + entry = _bfd_vms_enter_symbol (abfd, name); + if (entry == (vms_symbol_entry *)NULL) + { + bfd_set_error (bfd_error_no_memory); + return -1; + } + symbol = entry->symbol; + + symbol->value = 0; + symbol->section = section; + symbol->flags = (BSF_GLOBAL|BSF_SECTION_SYM|BSF_OLD_COMMON); + } + + /* copy saved contents if old_section set */ + + if (old_section != 0) + { + section->contents = old_section->contents; + if (section->_raw_size < old_section->_raw_size) + { + (*_bfd_error_handler) + (_("Size mismatch section %s=%lx, %s=%lx"), + old_section->name, + (unsigned long) old_section->_raw_size, + section->name, + (unsigned long) section->_raw_size); + return -1; + } + else if (section->_raw_size > old_section->_raw_size) + { + section->contents = ((unsigned char *) + bfd_realloc (old_section->contents, + section->_raw_size)); + if (section->contents == NULL) + { + bfd_set_error (bfd_error_no_memory); + return -1; + } + } + } + else + { + section->contents = ((unsigned char *) + bfd_zmalloc (section->_raw_size)); + if (section->contents == NULL) + { + bfd_set_error (bfd_error_no_memory); + return -1; + } + } + section->_cooked_size = section->_raw_size; +#if VMS_DEBUG + vms_debug (4, "gsd psc %d (%s, flags %04x=%s) ", + section->index, name, old_flags, flag2str (gpsflagdesc, old_flags)); + vms_debug (4, "%d bytes at 0x%08lx (mem %p)\n", + section->_raw_size, section->vma, section->contents); +#endif + + gsd_size = vms_rec[8] + 9; + + psect_idx++; + } + break; + + case GSD_S_C_EPM: + case GSD_S_C_EPMW: +#if VMS_DEBUG + vms_debug(4, "gsd epm\n"); +#endif + /*FALLTHRU*/ + case GSD_S_C_SYM: + case GSD_S_C_SYMW: + { + int name_offset = 0, value_offset = 0; + + /* + * symbol specification (definition or reference) + */ + +#if VMS_DEBUG + vms_debug (4, "GSD_S_C_SYM(W)\n"); +#endif + old_flags = bfd_getl16 (vms_rec + 2); + new_flags = BSF_NO_FLAGS; + + if (old_flags & GSY_S_M_WEAK) + new_flags |= BSF_WEAK; + + switch (gsd_type) + { + case GSD_S_C_EPM: + name_offset = 11; + value_offset = 5; + new_flags |= BSF_FUNCTION; + break; + case GSD_S_C_EPMW: + name_offset = 12; + value_offset = 6; + new_flags |= BSF_FUNCTION; + break; + case GSD_S_C_SYM: + if (old_flags & GSY_S_M_DEF) /* symbol definition */ + name_offset = 9; + else + name_offset = 4; + value_offset = 5; + break; + case GSD_S_C_SYMW: + if (old_flags & GSY_S_M_DEF) /* symbol definition */ + name_offset = 10; + else + name_offset = 5; + value_offset = 6; + break; + } + + /* save symbol in vms_symbol_table */ + + entry = _bfd_vms_enter_symbol (abfd, + _bfd_vms_save_counted_string (vms_rec + name_offset)); + if (entry == (vms_symbol_entry *)NULL) + { + bfd_set_error (bfd_error_no_memory); + return -1; + } + symbol = entry->symbol; + + if (old_flags & GSY_S_M_DEF) /* symbol definition */ + { + int psect; + + symbol->value = bfd_getl32 (vms_rec+value_offset); + if ((gsd_type == GSD_S_C_SYMW) + || (gsd_type == GSD_S_C_EPMW)) + psect = bfd_getl16 (vms_rec + value_offset - 2); + else + psect = vms_rec[value_offset-1]; + + symbol->section = (asection *)psect; +#if VMS_DEBUG + vms_debug(4, "gsd sym def #%d (%s, %d [%p], %04x=%s)\n", abfd->symcount, + symbol->name, (int)symbol->section, symbol->section, old_flags, flag2str(gsyflagdesc, old_flags)); +#endif + } + else /* symbol reference */ + { + symbol->section = bfd_make_section (abfd, BFD_UND_SECTION_NAME); +#if VMS_DEBUG + vms_debug (4, "gsd sym ref #%d (%s, %s [%p], %04x=%s)\n", abfd->symcount, + symbol->name, symbol->section->name, symbol->section, old_flags, flag2str (gsyflagdesc, old_flags)); +#endif + } + + gsd_size = vms_rec[name_offset] + name_offset + 1; + symbol->flags = new_flags; + } + + break; + + case GSD_S_C_PRO: + case GSD_S_C_PROW: +#if VMS_DEBUG + vms_debug(4, "gsd pro\n"); +#endif + break; + case GSD_S_C_IDC: +#if VMS_DEBUG + vms_debug(4, "gsd idc\n"); +#endif + break; + case GSD_S_C_ENV: +#if VMS_DEBUG + vms_debug(4, "gsd env\n"); +#endif + break; + case GSD_S_C_LSY: +#if VMS_DEBUG + vms_debug(4, "gsd lsy\n"); +#endif + break; + case GSD_S_C_LEPM: +#if VMS_DEBUG + vms_debug(4, "gsd lepm\n"); +#endif + break; + case GSD_S_C_LPRO: +#if VMS_DEBUG + vms_debug(4, "gsd lpro\n"); +#endif + break; + case GSD_S_C_SPSC: +#if VMS_DEBUG + vms_debug(4, "gsd spsc\n"); +#endif + break; + case GSD_S_C_SYMV: +#if VMS_DEBUG + vms_debug(4, "gsd symv\n"); +#endif + break; + case GSD_S_C_EPMV: +#if VMS_DEBUG + vms_debug(4, "gsd epmv\n"); +#endif + break; + case GSD_S_C_PROV: +#if VMS_DEBUG + vms_debug(4, "gsd prov\n"); +#endif + break; + + case EGSD_S_C_PSC + EVAX_OFFSET: + { + /* program section definition */ + + name = _bfd_vms_save_counted_string (vms_rec+12); + section = bfd_make_section (abfd, name); + if (!section) + return -1; + old_flags = bfd_getl16 (vms_rec + 6); + section->_raw_size = bfd_getl32 (vms_rec + 8); /* allocation */ + new_flags = vms_secflag_by_name (abfd, evax_section_flags, name, + section->_raw_size > 0); + if (old_flags & EGPS_S_V_REL) + new_flags |= SEC_RELOC; + if (!bfd_set_section_flags (abfd, section, new_flags)) + return -1; + section->alignment_power = vms_rec[4]; + align_addr = (1 << section->alignment_power); + if ((base_addr % align_addr) != 0) + base_addr += (align_addr - (base_addr % align_addr)); + section->vma = (bfd_vma)base_addr; + base_addr += section->_raw_size; + section->contents = ((unsigned char *) + bfd_zmalloc (section->_raw_size)); + if (section->contents == NULL) + return -1; + section->_cooked_size = section->_raw_size; +#if VMS_DEBUG + vms_debug(4, "egsd psc %d (%s, flags %04x=%s) ", + section->index, name, old_flags, flag2str(gpsflagdesc, old_flags)); + vms_debug(4, "%d bytes at 0x%08lx (mem %p)\n", + section->_raw_size, section->vma, section->contents); +#endif + } + break; + + case EGSD_S_C_SYM + EVAX_OFFSET: + { + /* symbol specification (definition or reference) */ + + symbol = bfd_make_empty_symbol (abfd); + if (symbol == 0) + return -1; + + old_flags = bfd_getl16 (vms_rec + 6); + new_flags = BSF_NO_FLAGS; + + if (old_flags & EGSY_S_V_WEAK) + new_flags |= BSF_WEAK; + + if (vms_rec[6] & EGSY_S_V_DEF) /* symbol definition */ + { + symbol->name = + _bfd_vms_save_counted_string (vms_rec+32); + if (old_flags & EGSY_S_V_NORM) + { /* proc def */ + new_flags |= BSF_FUNCTION; + } + symbol->value = bfd_getl64 (vms_rec+8); + symbol->section = (asection *) ((unsigned long) bfd_getl32 (vms_rec+28)); +#if VMS_DEBUG + vms_debug(4, "egsd sym def #%d (%s, %d, %04x=%s)\n", abfd->symcount, + symbol->name, (int)symbol->section, old_flags, flag2str(gsyflagdesc, old_flags)); +#endif + } + else /* symbol reference */ + { + symbol->name = + _bfd_vms_save_counted_string (vms_rec+8); +#if VMS_DEBUG + vms_debug(4, "egsd sym ref #%d (%s, %04x=%s)\n", abfd->symcount, + symbol->name, old_flags, flag2str(gsyflagdesc, old_flags)); +#endif + symbol->section = bfd_make_section (abfd, BFD_UND_SECTION_NAME); + } + + symbol->flags = new_flags; + + /* save symbol in vms_symbol_table */ + + entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV(vms_symbol_table), + symbol->name, + TRUE, FALSE); + if (entry == (vms_symbol_entry *)NULL) + { + bfd_set_error (bfd_error_no_memory); + return -1; + } + if (entry->symbol != (asymbol *)NULL) + { /* FIXME ?, DEC C generates this */ +#if VMS_DEBUG + vms_debug(4, "EGSD_S_C_SYM: duplicate \"%s\"\n", symbol->name); +#endif + } + else + { + entry->symbol = symbol; + PRIV(gsd_sym_count)++; + abfd->symcount++; + } + } + break; + + case EGSD_S_C_IDC + EVAX_OFFSET: + break; + + default: + (*_bfd_error_handler) (_("unknown gsd/egsd subtype %d"), gsd_type); + bfd_set_error (bfd_error_bad_value); + return -1; + + } /* switch */ + + PRIV(rec_size) -= gsd_size; + PRIV(vms_rec) += gsd_size; + + } /* while (recsize > 0) */ + + if (abfd->symcount > 0) + abfd->flags |= HAS_SYMS; + + return 0; +} + +/*-----------------------------------------------------------------------------*/ +/* output routines */ + +/* Write section and symbol directory of bfd abfd */ + +int +_bfd_vms_write_gsd (abfd, objtype) + bfd *abfd; + int objtype ATTRIBUTE_UNUSED; +{ + asection *section; + asymbol *symbol; + unsigned int symnum; + int last_index = -1; + char dummy_name[10]; + char *sname; + flagword new_flags, old_flags; + +#if VMS_DEBUG + vms_debug (2, "vms_write_gsd (%p, %d)\n", abfd, objtype); +#endif + + /* output sections */ + + section = abfd->sections; +#if VMS_DEBUG + vms_debug (3, "%d sections found\n", abfd->section_count); +#endif + + /* egsd is quadword aligned */ + + _bfd_vms_output_alignment (abfd, 8); + + _bfd_vms_output_begin (abfd, EOBJ_S_C_EGSD, -1); + _bfd_vms_output_long (abfd, 0); + _bfd_vms_output_push (abfd); /* prepare output for subrecords */ + + while (section != 0) + { +#if VMS_DEBUG + vms_debug (3, "Section #%d %s, %d bytes\n", section->index, section->name, (int)section->_raw_size); +#endif + + /* 13 bytes egsd, max 31 chars name -> should be 44 bytes */ + if (_bfd_vms_output_check (abfd, 64) < 0) + { + _bfd_vms_output_pop (abfd); + _bfd_vms_output_end (abfd); + _bfd_vms_output_begin (abfd, EOBJ_S_C_EGSD, -1); + _bfd_vms_output_long (abfd, 0); + _bfd_vms_output_push (abfd); /* prepare output for subrecords */ + } + + /* Create dummy sections to keep consecutive indices */ + + while (section->index - last_index > 1) + { +#if VMS_DEBUG + vms_debug (3, "index %d, last %d\n", section->index, last_index); +#endif + _bfd_vms_output_begin (abfd, EGSD_S_C_PSC, -1); + _bfd_vms_output_short (abfd, 0); + _bfd_vms_output_short (abfd, 0); + _bfd_vms_output_long (abfd, 0); + sprintf (dummy_name, ".DUMMY%02d", last_index); + _bfd_vms_output_counted (abfd, dummy_name); + _bfd_vms_output_flush (abfd); + last_index++; + } + + /* Don't know if this is necessary for the linker but for now it keeps + vms_slurp_gsd happy */ + + sname = (char *)section->name; + if (*sname == '.') + { + sname++; + if ((*sname == 't') && (strcmp (sname, "text") == 0)) + sname = PRIV(is_vax)?VAX_CODE_NAME:EVAX_CODE_NAME; + else if ((*sname == 'd') && (strcmp (sname, "data") == 0)) + sname = PRIV(is_vax)?VAX_DATA_NAME:EVAX_DATA_NAME; + else if ((*sname == 'b') && (strcmp (sname, "bss") == 0)) + sname = EVAX_BSS_NAME; + else if ((*sname == 'l') && (strcmp (sname, "link") == 0)) + sname = EVAX_LINK_NAME; + else if ((*sname == 'r') && (strcmp (sname, "rdata") == 0)) + sname = EVAX_READONLY_NAME; + else if ((*sname == 'l') && (strcmp (sname, "literal") == 0)) + sname = EVAX_LITERAL_NAME; + else if ((*sname == 'c') && (strcmp (sname, "comm") == 0)) + sname = EVAX_COMMON_NAME; + else if ((*sname == 'l') && (strcmp (sname, "lcomm") == 0)) + sname = EVAX_LOCAL_NAME; + } + else + sname = _bfd_vms_length_hash_symbol (abfd, sname, EOBJ_S_C_SECSIZ); + + _bfd_vms_output_begin (abfd, EGSD_S_C_PSC, -1); + _bfd_vms_output_short (abfd, section->alignment_power & 0xff); + if (bfd_is_com_section (section)) + { + new_flags = (EGPS_S_V_OVR|EGPS_S_V_REL|EGPS_S_V_GBL|EGPS_S_V_RD|EGPS_S_V_WRT|EGPS_S_V_NOMOD|EGPS_S_V_COM); + } + else + { + new_flags = vms_esecflag_by_name (evax_section_flags, sname, + section->_raw_size > 0); + } + _bfd_vms_output_short (abfd, new_flags); + _bfd_vms_output_long (abfd, (unsigned long) section->_raw_size); + _bfd_vms_output_counted (abfd, sname); + _bfd_vms_output_flush (abfd); + + last_index = section->index; + section = section->next; + } + + /* output symbols */ + +#if VMS_DEBUG + vms_debug (3, "%d symbols found\n", abfd->symcount); +#endif + + bfd_set_start_address (abfd, (bfd_vma)-1); + + for (symnum = 0; symnum < abfd->symcount; symnum++) + { + char *hash; + + symbol = abfd->outsymbols[symnum]; + if (*(symbol->name) == '_') + { + if (strcmp (symbol->name, "__main") == 0) + bfd_set_start_address (abfd, (bfd_vma)symbol->value); + } + old_flags = symbol->flags; + + if (old_flags & BSF_FILE) + continue; + + if (((old_flags & (BSF_GLOBAL|BSF_WEAK)) == 0) /* not xdef */ + && (!bfd_is_und_section (symbol->section))) /* and not xref */ + continue; /* dont output */ + + /* 13 bytes egsd, max 64 chars name -> should be 77 bytes */ + + if (_bfd_vms_output_check (abfd, 80) < 0) + { + _bfd_vms_output_pop (abfd); + _bfd_vms_output_end (abfd); + _bfd_vms_output_begin (abfd, EOBJ_S_C_EGSD, -1); + _bfd_vms_output_long (abfd, 0); + _bfd_vms_output_push (abfd); /* prepare output for subrecords */ + } + + _bfd_vms_output_begin (abfd, EGSD_S_C_SYM, -1); + + _bfd_vms_output_short (abfd, 0); /* data type, alignment */ + + new_flags = 0; + + if (old_flags & BSF_WEAK) + new_flags |= EGSY_S_V_WEAK; + if (bfd_is_com_section (symbol->section)) /* .comm */ + new_flags |= (EGSY_S_V_WEAK|EGSY_S_V_COMM); + + if (old_flags & BSF_FUNCTION) + { + new_flags |= EGSY_S_V_NORM; + new_flags |= EGSY_S_V_REL; + } + if (old_flags & (BSF_GLOBAL|BSF_WEAK)) + { + new_flags |= EGSY_S_V_DEF; + if (!bfd_is_abs_section (symbol->section)) + new_flags |= EGSY_S_V_REL; + } + _bfd_vms_output_short (abfd, new_flags); + + if (old_flags & (BSF_GLOBAL | BSF_WEAK)) /* symbol definition */ + { + uquad code_address = 0; + unsigned long ca_psindx = 0; + unsigned long psindx; + + if ((old_flags & BSF_FUNCTION) && symbol->udata.p != NULL) + { + code_address = ((asymbol *) (symbol->udata.p))->value; + ca_psindx = ((asymbol *) (symbol->udata.p))->section->index; + } + psindx = symbol->section->index; + + _bfd_vms_output_quad (abfd, symbol->value); + _bfd_vms_output_quad (abfd, code_address); + _bfd_vms_output_long (abfd, ca_psindx); + _bfd_vms_output_long (abfd, psindx); + } + hash = _bfd_vms_length_hash_symbol (abfd, symbol->name, EOBJ_S_C_SYMSIZ); + _bfd_vms_output_counted (abfd, hash); + + _bfd_vms_output_flush (abfd); + + } + + _bfd_vms_output_alignment (abfd, 8); + _bfd_vms_output_pop (abfd); + _bfd_vms_output_end (abfd); + + return 0; +} diff --git a/bfd/vms-hdr.c b/bfd/vms-hdr.c new file mode 100644 index 0000000000000..c2611115a9063 --- /dev/null +++ b/bfd/vms-hdr.c @@ -0,0 +1,461 @@ +/* vms-hdr.c -- BFD back-end for VMS/VAX (openVMS/VAX) and + EVAX (openVMS/Alpha) files. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. + + HDR record handling functions + EMH record handling functions + and + EOM record handling functions + EEOM record handling functions + + Written by Klaus K"ampf (kkaempf@rmi.de) + +This program is free software; 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. */ + +#include "bfd.h" +#include "bfdver.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "safe-ctype.h" +#include "libbfd.h" + +#include "vms.h" + +#ifdef HAVE_ALLOCA_H +#include +#endif + +static unsigned char *get_vms_time_string PARAMS ((void)); + + +/*---------------------------------------------------------------------------*/ + +/* Read & process emh record + return 0 on success, -1 on error */ + +int +_bfd_vms_slurp_hdr (abfd, objtype) + bfd *abfd; + int objtype; +{ + unsigned char *ptr; + unsigned char *vms_rec; + int subtype; + + vms_rec = PRIV(vms_rec); + +#if VMS_DEBUG + vms_debug(2, "HDR/EMH\n"); +#endif + + switch (objtype) + { + case OBJ_S_C_HDR: + subtype = vms_rec[1]; + break; + case EOBJ_S_C_EMH: + subtype = bfd_getl16 (vms_rec + 4) + EVAX_OFFSET; + break; + default: + subtype = -1; + } + +#if VMS_DEBUG + vms_debug(3, "subtype %d\n", subtype); +#endif + + switch (subtype) + { + + case MHD_S_C_MHD: + /* + * module header + */ + PRIV(hdr_data).hdr_b_strlvl = vms_rec[2]; + PRIV(hdr_data).hdr_l_recsiz = bfd_getl16 (vms_rec + 3); + PRIV(hdr_data).hdr_t_name = _bfd_vms_save_counted_string (vms_rec + 5); + ptr = vms_rec + 5 + vms_rec[5] + 1; + PRIV(hdr_data).hdr_t_version = _bfd_vms_save_counted_string (ptr); + ptr += *ptr + 1; + PRIV(hdr_data).hdr_t_date = _bfd_vms_save_sized_string (ptr, 17); + + break; + + case MHD_S_C_LNM: + /* + * + */ + PRIV(hdr_data).hdr_c_lnm = _bfd_vms_save_sized_string (vms_rec, PRIV(rec_length-2)); + break; + + case MHD_S_C_SRC: + /* + * + */ + PRIV(hdr_data).hdr_c_src = _bfd_vms_save_sized_string (vms_rec, PRIV(rec_length-2)); + break; + + case MHD_S_C_TTL: + /* + * + */ + PRIV(hdr_data).hdr_c_ttl = _bfd_vms_save_sized_string (vms_rec, PRIV(rec_length-2)); + break; + + case MHD_S_C_CPR: + /* + * + */ + break; + + case MHD_S_C_MTC: + /* + * + */ + break; + + case MHD_S_C_GTX: + /* + * + */ + break; + + case EMH_S_C_MHD + EVAX_OFFSET: + /* + * module header + */ + PRIV(hdr_data).hdr_b_strlvl = vms_rec[6]; + PRIV(hdr_data).hdr_l_arch1 = bfd_getl32 (vms_rec + 8); + PRIV(hdr_data).hdr_l_arch2 = bfd_getl32 (vms_rec + 12); + PRIV(hdr_data).hdr_l_recsiz = bfd_getl32 (vms_rec + 16); + PRIV(hdr_data).hdr_t_name = + _bfd_vms_save_counted_string (vms_rec + 20); + ptr = vms_rec + 20 + vms_rec[20] + 1; + PRIV(hdr_data).hdr_t_version = + _bfd_vms_save_counted_string (ptr); + ptr += *ptr + 1; + PRIV(hdr_data).hdr_t_date = + _bfd_vms_save_sized_string (ptr, 17); + + break; + + case EMH_S_C_LNM + EVAX_OFFSET: + /* + * + */ + PRIV(hdr_data).hdr_c_lnm = + _bfd_vms_save_sized_string (vms_rec, PRIV(rec_length-6)); + break; + + case EMH_S_C_SRC + EVAX_OFFSET: + /* + * + */ + PRIV(hdr_data).hdr_c_src = + _bfd_vms_save_sized_string (vms_rec, PRIV(rec_length-6)); + break; + + case EMH_S_C_TTL + EVAX_OFFSET: + /* + * + */ + PRIV(hdr_data).hdr_c_ttl = + _bfd_vms_save_sized_string (vms_rec, PRIV(rec_length-6)); + break; + + case EMH_S_C_CPR + EVAX_OFFSET: + /* + * + */ + break; + + case EMH_S_C_MTC + EVAX_OFFSET: + /* + * + */ + break; + + case EMH_S_C_GTX + EVAX_OFFSET: + /* + * + */ + break; + + default: + bfd_set_error (bfd_error_wrong_format); + return -1; + + } /* switch */ + + return 0; +} + +/*-----------------------------------------------------------------------------*/ +/* Output routines. */ + +/* Manufacture a VMS like time on a unix based system. + stolen from obj-vms.c */ + +static unsigned char * +get_vms_time_string () +{ + static unsigned char tbuf[18]; +#ifndef VMS +#include + + char *pnt; + time_t timeb; + time (&timeb); + pnt = ctime (&timeb); + pnt[3] = 0; + pnt[7] = 0; + pnt[10] = 0; + pnt[16] = 0; + pnt[24] = 0; + sprintf (tbuf, "%2s-%3s-%s %s", pnt + 8, pnt + 4, pnt + 20, pnt + 11); +#else +#include + struct + { + int Size; + unsigned char *Ptr; + } Descriptor; + Descriptor.Size = 17; + Descriptor.Ptr = tbuf; + SYS$ASCTIM (0, &Descriptor, 0, 0); +#endif /* not VMS */ + +#if VMS_DEBUG + vms_debug (6, "vmstimestring:'%s'\n", tbuf); +#endif + + return tbuf; +} + +/* write object header for bfd abfd */ + +int +_bfd_vms_write_hdr (abfd, objtype) + bfd *abfd; + int objtype; +{ + asymbol *symbol; + unsigned int symnum; + int had_case = 0; + int had_file = 0; + +#if VMS_DEBUG + vms_debug (2, "vms_write_hdr (%p)\n", abfd); +#endif + + _bfd_vms_output_alignment (abfd, 2); + + /* MHD */ + + if (objtype == OBJ_S_C_HDR) + { + } + else + { + _bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_MHD); + _bfd_vms_output_short (abfd, EOBJ_S_C_STRLVL); + _bfd_vms_output_long (abfd, 0); + _bfd_vms_output_long (abfd, 0); + _bfd_vms_output_long (abfd, MAX_OUTREC_SIZE); + } + + if (bfd_get_filename (abfd) != 0) + { + /* strip path and suffix information */ + + char *fname, *fout, *fptr; + + fptr = bfd_get_filename (abfd); + fname = (char *) alloca (strlen (fptr) + 1); + strcpy (fname, fptr); + fout = strrchr (fname, ']'); + if (fout == 0) + fout = strchr (fname, ':'); + if (fout != 0) + fout++; + else + fout = fname; + + /* strip .obj suffix */ + + fptr = strrchr (fname, '.'); + if ((fptr != 0) + && (strcasecmp (fptr, ".OBJ") == 0)) + *fptr = 0; + + fptr = fout; + while (*fptr != 0) + { + *fptr = TOUPPER (*fptr); + fptr++; + if ((*fptr == ';') + || ((fptr - fout) > 31)) + *fptr = 0; + } + _bfd_vms_output_counted (abfd, fout); + } + else + _bfd_vms_output_counted (abfd, "NONAME"); + + _bfd_vms_output_counted (abfd, BFD_VERSION_STRING); + _bfd_vms_output_dump (abfd, get_vms_time_string (), 17); + _bfd_vms_output_fill (abfd, 0, 17); + _bfd_vms_output_flush (abfd); + + /* LMN */ + + _bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_LNM); + _bfd_vms_output_dump (abfd, (unsigned char *)"GAS proGIS", 10); + _bfd_vms_output_flush (abfd); + + /* SRC */ + + _bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_SRC); + + for (symnum = 0; symnum < abfd->symcount; symnum++) + { + symbol = abfd->outsymbols[symnum]; + + if (symbol->flags & BSF_FILE) + { + if (strncmp ((char *)symbol->name, "name[6] - '0'; + PRIV(flag_show_after_trunc) = symbol->name[7] - '0'; + + if (had_file) + break; + had_case = 1; + continue; + } + + _bfd_vms_output_dump (abfd, (unsigned char *) symbol->name, + (int) strlen (symbol->name)); + if (had_case) + break; + had_file = 1; + } + } + + if (symnum == abfd->symcount) + _bfd_vms_output_dump (abfd, (unsigned char *)"noname", 6); + + _bfd_vms_output_flush (abfd); + + /* TTL */ + + _bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_TTL); + _bfd_vms_output_dump (abfd, (unsigned char *)"TTL", 3); + _bfd_vms_output_flush (abfd); + + /* CPR */ + + _bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_CPR); + _bfd_vms_output_dump (abfd, + (unsigned char *)"GNU BFD ported by Klaus Kämpf 1994-1996", + 39); + _bfd_vms_output_flush (abfd); + + return 0; +} + +/*-----------------------------------------------------------------------------*/ + +/* Process EOM/EEOM record + return 0 on success, -1 on error */ + +int +_bfd_vms_slurp_eom (abfd, objtype) + bfd *abfd; + int objtype; +{ + unsigned char *vms_rec; + +#if VMS_DEBUG + vms_debug(2, "EOM/EEOM\n"); +#endif + + vms_rec = PRIV(vms_rec); + + if ((objtype == OBJ_S_C_EOM) + || (objtype == OBJ_S_C_EOMW)) + { + } + else + { + PRIV(eom_data).eom_l_total_lps = bfd_getl32 (vms_rec + 4); + PRIV(eom_data).eom_b_comcod = *(vms_rec + 8); + if (PRIV(eom_data).eom_b_comcod > 1) + { + (*_bfd_error_handler) (_("Object module NOT error-free !\n")); + bfd_set_error (bfd_error_bad_value); + return -1; + } + PRIV(eom_data).eom_has_transfer = FALSE; + if (PRIV(rec_size) > 10) + { + PRIV(eom_data).eom_has_transfer = TRUE; + PRIV(eom_data).eom_b_tfrflg = *(vms_rec + 9); + PRIV(eom_data).eom_l_psindx = bfd_getl32 (vms_rec + 12); + PRIV(eom_data).eom_l_tfradr = bfd_getl32 (vms_rec + 16); + + abfd->start_address = PRIV(eom_data).eom_l_tfradr; + } + } + return 0; +} + +/* Write eom record for bfd abfd */ + +int +_bfd_vms_write_eom (abfd, objtype) + bfd *abfd; + int objtype; +{ +#if VMS_DEBUG + vms_debug (2, "vms_write_eom (%p, %d)\n", abfd, objtype); +#endif + + _bfd_vms_output_begin (abfd, objtype, -1); + _bfd_vms_output_long (abfd, (unsigned long) (PRIV(vms_linkage_index) >> 1)); + _bfd_vms_output_byte (abfd, 0); /* completion code */ + _bfd_vms_output_byte (abfd, 0); /* fill byte */ + + if (bfd_get_start_address (abfd) != (bfd_vma)-1) + { + asection *section; + + section = bfd_get_section_by_name (abfd, ".link"); + if (section == 0) + { + bfd_set_error (bfd_error_nonrepresentable_section); + return -1; + } + _bfd_vms_output_short (abfd, 0); + _bfd_vms_output_long (abfd, (unsigned long) (section->index)); + _bfd_vms_output_long (abfd, + (unsigned long) bfd_get_start_address (abfd)); + _bfd_vms_output_long (abfd, 0); + } + + _bfd_vms_output_end (abfd); + return 0; +} diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c new file mode 100644 index 0000000000000..d0a24c7efa09e --- /dev/null +++ b/bfd/vms-misc.c @@ -0,0 +1,1130 @@ +/* vms-misc.c -- Miscellaneous functions for VAX (openVMS/VAX) and + EVAX (openVMS/Alpha) files. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + Written by Klaus K"ampf (kkaempf@rmi.de) + +This program is free software; 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. */ + +#if __STDC__ +#include +#endif + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" + +#include "vms.h" + +static vms_section *add_new_contents PARAMS ((bfd *, sec_ptr)); +static int hash_string PARAMS ((const char *)); +static asymbol *new_symbol PARAMS ((bfd *, char *)); + +/*-----------------------------------------------------------------------------*/ +#if VMS_DEBUG +/* debug functions */ + +/* debug function for all vms extensions + evaluates environment variable VMS_DEBUG for a + numerical value on the first call + all error levels below this value are printed + + levels: + 1 toplevel bfd calls (functions from the bfd vector) + 2 functions called by bfd calls + ... + 9 almost everything + + level is also indentation level. Indentation is performed + if level > 0 + */ + +#if __STDC__ +void +_bfd_vms_debug (int level, char *format, ...) +{ + static int min_level = -1; + static FILE *output = NULL; + char *eptr; + va_list args; + int abslvl = (level > 0)?level:-level; + + if (min_level == -1) + { + if ((eptr = getenv("VMS_DEBUG")) != NULL) + { + min_level = atoi(eptr); + output = stderr; + } + else + min_level = 0; + } + if (output == NULL) + return; + if (abslvl > min_level) + return; + + while (--level>0) + fprintf (output, " "); + va_start(args, format); + vfprintf (output, format, args); + fflush(output); + va_end(args); + + return; +} + +#else /* not __STDC__ */ + +void +_bfd_vms_debug (level, format, a1, a2, a3, a4, a5, a6) + int level; + char *format; + long a1; long a2; long a3; + long a4; long a5; long a6; +{ + static int min_level = -1; + static FILE *output = NULL; + char *eptr; + + if (min_level == -1) + { + if ((eptr = getenv("VMS_DEBUG")) != NULL) + { + min_level = atoi(eptr); + output = stderr; + } + else + min_level = 0; + } + if (output == NULL) + return; + if (level > min_level) + return; + + while (--level>0) + fprintf (output, " "); + fprintf (output, format, a1, a2, a3, a4, a5, a6); + fflush(output); + + return; +} +#endif /* __STDC__ */ + +/* a debug function + hex dump 'size' bytes starting at 'ptr' */ + +void +_bfd_hexdump (level, ptr, size, offset) + int level; + unsigned char *ptr; + int size; + int offset; +{ + unsigned char *lptr = ptr; + int count = 0; + long start = offset; + + while (size-- > 0) + { + if ((count%16) == 0) + vms_debug (level, "%08lx:", start); + vms_debug (-level, " %02x", *ptr++); + count++; + start++; + if (size == 0) + { + while ((count%16) != 0) + { + vms_debug (-level, " "); + count++; + } + } + if ((count%16) == 0) + { + vms_debug (-level, " "); + while (lptr < ptr) + { + vms_debug (-level, "%c", (*lptr < 32)?'.':*lptr); + lptr++; + } + vms_debug (-level, "\n"); + } + } + if ((count%16) != 0) + vms_debug (-level, "\n"); + + return; +} +#endif + +/* hash functions + + These are needed when reading an object file. */ + +/* allocate new vms_hash_entry + keep the symbol name and a pointer to the bfd symbol in the table */ + +struct bfd_hash_entry * +_bfd_vms_hash_newfunc (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + vms_symbol_entry *ret; + +#if VMS_DEBUG + vms_debug (5, "_bfd_vms_hash_newfunc(%p, %p, %s)\n", entry, table, string); +#endif + + if (entry == (struct bfd_hash_entry *)NULL) + { + ret = (vms_symbol_entry *) + bfd_hash_allocate (table, sizeof (vms_symbol_entry)); + if (ret == (vms_symbol_entry *) NULL) + { + bfd_set_error (bfd_error_no_memory); + return (struct bfd_hash_entry *)NULL; + } + entry = (struct bfd_hash_entry *) ret; + } + + /* Call the allocation method of the base class. */ + + ret = (vms_symbol_entry *) bfd_hash_newfunc (entry, table, string); +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_hash_newfunc ret %p\n", ret); +#endif + + ret->symbol = (asymbol *)NULL; + + return (struct bfd_hash_entry *)ret; +} + +/* object file input functions */ + +/* Return type and length from record header (buf) on Alpha. */ + +void +_bfd_vms_get_header_values (abfd, buf, type, length) + bfd *abfd ATTRIBUTE_UNUSED; + unsigned char *buf; + int *type; + int *length; +{ + if (type != 0) + *type = bfd_getl16 (buf); + buf += 2; + if (length != 0) + *length = bfd_getl16 (buf); + +#if VMS_DEBUG + vms_debug (10, "_bfd_vms_get_header_values type %x, length %x\n", (type?*type:0), (length?*length:0)); +#endif + + return; +} + +/* Get next record from object file to vms_buf + set PRIV(buf_size) and return it + + this is a little tricky since it should be portable. + + the openVMS object file has 'variable length' which means that + read() returns data in chunks of (hopefully) correct and expected + size. The linker (and other tools on vms) depend on that. Unix doesn't + know about 'formatted' files, so reading and writing such an object + file in a unix environment is not trivial. + + With the tool 'file' (available on all vms ftp sites), one + can view and change the attributes of a file. Changing from + 'variable length' to 'fixed length, 512 bytes' reveals the + record length at the first 2 bytes of every record. The same + happens during the transfer of object files from vms to unix, + at least with ucx, dec's implementation of tcp/ip. + + The vms format repeats the length at bytes 2 & 3 of every record. + + On the first call (file_format == FF_UNKNOWN) we check if + the first and the third byte pair (!) of the record match. + If they do it's an object file in an unix environment or with + wrong attributes (FF_FOREIGN), else we should be in a vms + environment where read() returns the record size (FF_NATIVE). + + reading is always done in 2 steps. + first just the record header is read and the length extracted + by get_header_values + then the read buffer is adjusted and the remaining bytes are + read in. + + all file i/o is always done on even file positions */ + +int +_bfd_vms_get_record (abfd) + bfd *abfd; +{ + int test_len, test_start, remaining; + unsigned char *vms_buf; + +#if VMS_DEBUG + vms_debug (8, "_bfd_vms_get_record\n"); +#endif + + /* minimum is 6 bytes on Alpha + (2 bytes length, 2 bytes record id, 2 bytes length repeated) + + on VAX there's no length information in the record + so start with OBJ_S_C_MAXRECSIZ */ + + if (PRIV (buf_size) == 0) + { + bfd_size_type amt; + + if (PRIV (is_vax)) + { + amt = OBJ_S_C_MAXRECSIZ; + PRIV (file_format) = FF_VAX; + } + else + amt = 6; + PRIV (vms_buf) = (unsigned char *) bfd_malloc (amt); + PRIV (buf_size) = amt; + } + + vms_buf = PRIV (vms_buf); + + if (vms_buf == 0) + return -1; + + switch (PRIV (file_format)) + { + case FF_UNKNOWN: + case FF_FOREIGN: + test_len = 6; /* probe 6 bytes */ + test_start = 2; /* where the record starts */ + break; + + case FF_NATIVE: + test_len = 4; + test_start = 0; + break; + + default: + case FF_VAX: + test_len = 0; + test_start = 0; + break; + } + + /* skip odd alignment byte */ + + if (bfd_tell (abfd) & 1) + { + if (bfd_bread (PRIV (vms_buf), (bfd_size_type) 1, abfd) != 1) + { + bfd_set_error (bfd_error_file_truncated); + return 0; + } + } + + /* read the record header on Alpha. */ + + if ((test_len != 0) + && (bfd_bread (PRIV (vms_buf), (bfd_size_type) test_len, abfd) + != (bfd_size_type) test_len)) + { + bfd_set_error (bfd_error_file_truncated); + return 0; + } + + /* check file format on first call */ + + if (PRIV (file_format) == FF_UNKNOWN) + { /* record length repeats ? */ + if (vms_buf[0] == vms_buf[4] + && vms_buf[1] == vms_buf[5]) + { + PRIV (file_format) = FF_FOREIGN; /* Y: foreign environment */ + test_start = 2; + } + else + { + PRIV (file_format) = FF_NATIVE; /* N: native environment */ + test_start = 0; + } + } + + if (PRIV (is_vax)) + { + PRIV (rec_length) = bfd_bread (vms_buf, (bfd_size_type) PRIV (buf_size), + abfd); + if (PRIV (rec_length) <= 0) + { + bfd_set_error (bfd_error_file_truncated); + return 0; + } + PRIV (vms_rec) = vms_buf; + } + else /* Alpha */ + { + /* extract vms record length */ + + _bfd_vms_get_header_values (abfd, vms_buf + test_start, NULL, + &PRIV (rec_length)); + + if (PRIV (rec_length) <= 0) + { + bfd_set_error (bfd_error_file_truncated); + return 0; + } + + /* that's what the linker manual says */ + + if (PRIV (rec_length) > EOBJ_S_C_MAXRECSIZ) + { + bfd_set_error (bfd_error_file_truncated); + return 0; + } + + /* adjust the buffer */ + + if (PRIV (rec_length) > PRIV (buf_size)) + { + PRIV (vms_buf) = ((unsigned char *) + bfd_realloc (vms_buf, + (bfd_size_type) PRIV (rec_length))); + vms_buf = PRIV (vms_buf); + if (vms_buf == 0) + return -1; + PRIV (buf_size) = PRIV (rec_length); + } + + /* read the remaining record */ + + remaining = PRIV (rec_length) - test_len + test_start; + +#if VMS_DEBUG + vms_debug (10, "bfd_bread remaining %d\n", remaining); +#endif + if (bfd_bread (vms_buf + test_len, (bfd_size_type) remaining, abfd) != + (bfd_size_type) remaining) + { + bfd_set_error (bfd_error_file_truncated); + return 0; + } + PRIV (vms_rec) = vms_buf + test_start; + } + +#if VMS_DEBUG + vms_debug (11, "bfd_bread rec_length %d\n", PRIV (rec_length)); +#endif + + return PRIV (rec_length); +} + +/* get next vms record from file + update vms_rec and rec_length to new (remaining) values */ + +int +_bfd_vms_next_record (abfd) + bfd *abfd; +{ +#if VMS_DEBUG + vms_debug (8, "_bfd_vms_next_record (len %d, size %d)\n", + PRIV (rec_length), PRIV (rec_size)); +#endif + + if (PRIV (rec_length) > 0) + { + PRIV (vms_rec) += PRIV (rec_size); + } + else + { + if (_bfd_vms_get_record (abfd) <= 0) + return -1; + } + + if (!PRIV (vms_rec) || !PRIV (vms_buf) + || PRIV (vms_rec) >= (PRIV (vms_buf) + PRIV (buf_size))) + return -1; + + if (PRIV (is_vax)) + { + PRIV (rec_type) = *(PRIV (vms_rec)); + PRIV (rec_size) = PRIV (rec_length); + } + else + { + _bfd_vms_get_header_values (abfd, PRIV (vms_rec), &PRIV (rec_type), + &PRIV (rec_size)); + } + PRIV (rec_length) -= PRIV (rec_size); + +#if VMS_DEBUG + vms_debug (8, "_bfd_vms_next_record: rec %p, size %d, length %d, type %d\n", + PRIV (vms_rec), PRIV (rec_size), PRIV (rec_length), + PRIV (rec_type)); +#endif + + return PRIV (rec_type); +} + +/* Copy sized string (string with fixed length) to new allocated area + size is string length (size of record) */ + +char * +_bfd_vms_save_sized_string (str, size) + unsigned char *str; + int size; +{ + char *newstr = bfd_malloc ((bfd_size_type) size + 1); + + if (newstr == NULL) + return 0; + strncpy (newstr, (char *) str, (size_t) size); + newstr[size] = 0; + + return newstr; +} + +/* Copy counted string (string with length at first byte) to new allocated area + ptr points to length byte on entry */ + +char * +_bfd_vms_save_counted_string (ptr) + unsigned char *ptr; +{ + int len = *ptr++; + + return _bfd_vms_save_sized_string (ptr, len); +} + +/* stack routines for vms ETIR commands */ + +/* Push value and section index */ + +void +_bfd_vms_push (abfd, val, psect) + bfd *abfd; + uquad val; + int psect; +{ + static int last_psect; + +#if VMS_DEBUG + vms_debug (4, "\n", val, psect, PRIV (stackptr)); +#endif + + if (psect >= 0) + last_psect = psect; + + PRIV (stack[PRIV (stackptr)]).value = val; + PRIV (stack[PRIV (stackptr)]).psect = last_psect; + PRIV (stackptr)++; + if (PRIV (stackptr) >= STACKSIZE) + { + bfd_set_error (bfd_error_bad_value); + (*_bfd_error_handler) (_("Stack overflow (%d) in _bfd_vms_push"), PRIV (stackptr)); + exit (1); + } + return; +} + +/* Pop value and section index */ + +uquad +_bfd_vms_pop (abfd, psect) + bfd *abfd; + int *psect; +{ + uquad value; + + if (PRIV (stackptr) == 0) + { + bfd_set_error (bfd_error_bad_value); + (*_bfd_error_handler) (_("Stack underflow in _bfd_vms_pop")); + exit (1); + } + PRIV (stackptr)--; + value = PRIV (stack[PRIV (stackptr)]).value; + if ((psect != NULL) && (PRIV (stack[PRIV (stackptr)]).psect >= 0)) + *psect = PRIV (stack[PRIV (stackptr)]).psect; + +#if VMS_DEBUG + vms_debug (4, "\n", value, PRIV (stack[PRIV (stackptr)]).psect); +#endif + + return value; +} + +/* object file output functions */ + +/* GAS tends to write sections in little chunks (bfd_set_section_contents) + which we can't use directly. So we save the little chunks in linked + lists (one per section) and write them later. */ + +/* Add a new vms_section structure to vms_section_table + - forward chaining - */ + +static vms_section * +add_new_contents (abfd, section) + bfd *abfd; + sec_ptr section; +{ + vms_section *sptr, *newptr; + + sptr = PRIV (vms_section_table)[section->index]; + if (sptr != NULL) + return sptr; + + newptr = (vms_section *) bfd_alloc (abfd, + (bfd_size_type) sizeof (vms_section)); + if (newptr == (vms_section *) NULL) + return NULL; + newptr->contents = (unsigned char *) bfd_alloc (abfd, section->_raw_size); + if (newptr->contents == (unsigned char *) NULL) + return NULL; + newptr->offset = 0; + newptr->size = section->_raw_size; + newptr->next = 0; + PRIV (vms_section_table)[section->index] = newptr; + return newptr; +} + +/* Save section data & offset to a vms_section structure + vms_section_table[] holds the vms_section chain. */ + +bfd_boolean +_bfd_save_vms_section (abfd, section, data, offset, count) + bfd *abfd; + sec_ptr section; + const PTR data; + file_ptr offset; + bfd_size_type count; +{ + vms_section *sptr; + + if (section->index >= VMS_SECTION_COUNT) + { + bfd_set_error (bfd_error_nonrepresentable_section); + return FALSE; + } + if (count == (bfd_size_type)0) + return TRUE; + sptr = add_new_contents (abfd, section); + if (sptr == NULL) + return FALSE; + memcpy (sptr->contents + offset, data, (size_t) count); + + return TRUE; +} + +/* Get vms_section pointer to saved contents for section # index */ + +vms_section * +_bfd_get_vms_section (abfd, index) + bfd *abfd; + int index; +{ + if (index >= VMS_SECTION_COUNT) + { + bfd_set_error (bfd_error_nonrepresentable_section); + return NULL; + } + return PRIV (vms_section_table)[index]; +} + +/* Object output routines */ + +/* Begin new record or record header + write 2 bytes rectype + write 2 bytes record length (filled in at flush) + write 2 bytes header type (ommitted if rechead == -1) */ + +void +_bfd_vms_output_begin (abfd, rectype, rechead) + bfd *abfd; + int rectype; + int rechead; +{ +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_output_begin(type %d, head %d)\n", rectype, + rechead); +#endif + + _bfd_vms_output_short (abfd, (unsigned int) rectype); + + /* save current output position to fill in length later */ + + if (PRIV (push_level) > 0) + PRIV (length_pos) = PRIV (output_size); + +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_output_begin: length_pos = %d\n", + PRIV (length_pos)); +#endif + + _bfd_vms_output_short (abfd, 0); /* placeholder for length */ + + if (rechead != -1) + _bfd_vms_output_short (abfd, (unsigned int) rechead); + + return; +} + +/* Set record/subrecord alignment */ + +void +_bfd_vms_output_alignment (abfd, alignto) + bfd *abfd; + int alignto; +{ +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_output_alignment(%d)\n", alignto); +#endif + + PRIV (output_alignment) = alignto; + return; +} + +/* Prepare for subrecord fields */ + +void +_bfd_vms_output_push (abfd) + bfd *abfd; +{ +#if VMS_DEBUG + vms_debug (6, "vms_output_push(pushed_size = %d)\n", PRIV (output_size)); +#endif + + PRIV (push_level)++; + PRIV (pushed_size) = PRIV (output_size); + return; +} + +/* End of subrecord fields */ + +void +_bfd_vms_output_pop (abfd) + bfd *abfd; +{ +#if VMS_DEBUG + vms_debug (6, "vms_output_pop(pushed_size = %d)\n", PRIV (pushed_size)); +#endif + + _bfd_vms_output_flush (abfd); + PRIV (length_pos) = 2; + +#if VMS_DEBUG + vms_debug (6, "vms_output_pop: length_pos = %d\n", PRIV (length_pos)); +#endif + + PRIV (pushed_size) = 0; + PRIV (push_level)--; + return; +} + +/* Flush unwritten output, ends current record */ + +void +_bfd_vms_output_flush (abfd) + bfd *abfd; +{ + int real_size = PRIV (output_size); + int aligncount; + int length; + +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_output_flush(real_size = %d, pushed_size %d at lenpos %d)\n", + real_size, PRIV (pushed_size), PRIV (length_pos)); +#endif + + if (PRIV (push_level) > 0) + length = real_size - PRIV (pushed_size); + else + length = real_size; + + if (length == 0) + return; + aligncount = (PRIV (output_alignment) + - (length % PRIV (output_alignment))) % PRIV (output_alignment); + +#if VMS_DEBUG + vms_debug (6, "align: adding %d bytes\n", aligncount); +#endif + + while (aligncount-- > 0) + { + PRIV (output_buf)[real_size++] = 0; +#if 0 + /* this is why I *love* vms: inconsistency :-} + alignment is added to the subrecord length + but not to the record length */ + if (PRIV (push_level) > 0) +#endif + length++; + } + + /* put length to buffer */ + PRIV (output_size) = PRIV (length_pos); + _bfd_vms_output_short (abfd, (unsigned int) length); + + if (PRIV (push_level) == 0) + { +#ifndef VMS + /* write length first, see FF_FOREIGN in the input routines */ + fwrite (PRIV (output_buf) + 2, 2, 1, (FILE *) abfd->iostream); +#endif + fwrite (PRIV (output_buf), (size_t) real_size, 1, + (FILE *) abfd->iostream); + + PRIV (output_size) = 0; + } + else + { + PRIV (output_size) = real_size; + PRIV (pushed_size) = PRIV (output_size); + } + + return; +} + +/* End record output */ + +void +_bfd_vms_output_end (abfd) + bfd *abfd; +{ +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_output_end\n"); +#endif + + _bfd_vms_output_flush (abfd); + + return; +} + +/* check remaining buffer size + + return what's left. */ + +int +_bfd_vms_output_check (abfd, size) + bfd *abfd; + int size; +{ +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_output_check(%d)\n", size); +#endif + + return (MAX_OUTREC_SIZE - (PRIV (output_size) + size + MIN_OUTREC_LUFT)); +} + +/* Output byte (8 bit) value */ + +void +_bfd_vms_output_byte (abfd, value) + bfd *abfd; + unsigned int value; +{ +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_output_byte(%02x)\n", value); +#endif + + bfd_put_8 (abfd, value & 0xff, PRIV (output_buf) + PRIV (output_size)); + PRIV (output_size) += 1; + return; +} + +/* Output short (16 bit) value */ + +void +_bfd_vms_output_short (abfd, value) + bfd *abfd; + unsigned int value; +{ +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_output_short (%04x)\n", value); +#endif + + bfd_put_16 (abfd, (bfd_vma) value & 0xffff, + PRIV (output_buf) + PRIV (output_size)); + PRIV (output_size) += 2; + return; +} + +/* Output long (32 bit) value */ + +void +_bfd_vms_output_long (abfd, value) + bfd *abfd; + unsigned long value; +{ +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_output_long (%08lx)\n", value); +#endif + + bfd_put_32 (abfd, (bfd_vma) value, PRIV (output_buf) + PRIV (output_size)); + PRIV (output_size) += 4; + return; +} + +/* Output quad (64 bit) value */ + +void +_bfd_vms_output_quad (abfd, value) + bfd *abfd; + uquad value; +{ +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_output_quad(%016lx)\n", value); +#endif + + bfd_put_64(abfd, value, PRIV (output_buf) + PRIV (output_size)); + PRIV (output_size) += 8; + return; +} + +/* Output c-string as counted string */ + +void +_bfd_vms_output_counted (abfd, value) + bfd *abfd; + char *value; +{ +int len; + +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_output_counted(%s)\n", value); +#endif + + len = strlen (value); + if (len == 0) + { + (*_bfd_error_handler) (_("_bfd_vms_output_counted called with zero bytes")); + return; + } + if (len > 255) + { + (*_bfd_error_handler) (_("_bfd_vms_output_counted called with too many bytes")); + return; + } + _bfd_vms_output_byte (abfd, (unsigned int) len & 0xff); + _bfd_vms_output_dump (abfd, (unsigned char *)value, len); +} + +/* Output character area */ + +void +_bfd_vms_output_dump (abfd, data, length) + bfd *abfd; + unsigned char *data; + int length; +{ +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_output_dump(%d)\n", length); +#endif + + if (length == 0) + return; + + memcpy (PRIV (output_buf) + PRIV (output_size), data, (size_t) length); + PRIV (output_size) += length; + + return; +} + +/* Output count bytes of value */ + +void +_bfd_vms_output_fill (abfd, value, count) + bfd *abfd; + int value; + int count; +{ +#if VMS_DEBUG + vms_debug (6, "_bfd_vms_output_fill(val %02x times %d)\n", value, count); +#endif + + if (count == 0) + return; + memset (PRIV (output_buf) + PRIV (output_size), value, (size_t) count); + PRIV (output_size) += count; + + return; +} + +/* this hash routine borrowed from GNU-EMACS, and strengthened slightly ERY*/ + +static int +hash_string (ptr) + const char *ptr; +{ + register const unsigned char *p = (unsigned char *) ptr; + register const unsigned char *end = p + strlen (ptr); + register unsigned char c; + register int hash = 0; + + while (p != end) + { + c = *p++; + hash = ((hash << 3) + (hash << 15) + (hash >> 28) + c); + } + return hash; +} + +/* Generate a length-hashed VMS symbol name (limited to maxlen chars). */ + +char * +_bfd_vms_length_hash_symbol (abfd, in, maxlen) + bfd *abfd; + const char *in; + int maxlen; +{ + long int result; + int in_len; + char *new_name; + const char *old_name; + int i; + static char outbuf[EOBJ_S_C_SYMSIZ+1]; + char *out = outbuf; + +#if VMS_DEBUG + vms_debug(4, "_bfd_vms_length_hash_symbol \"%s\"\n", in); +#endif + + if (maxlen > EOBJ_S_C_SYMSIZ) + maxlen = EOBJ_S_C_SYMSIZ; + + new_name = out; /* save this for later. */ + + /* We may need to truncate the symbol, save the hash for later. */ + + in_len = strlen (in); + + result = (in_len > maxlen) ? hash_string (in) : 0; + + old_name = in; + + /* Do the length checking. */ + + if (in_len <= maxlen) + { + i = in_len; + } + else + { + if (PRIV (flag_hash_long_names)) + i = maxlen-9; + else + i = maxlen; + } + + strncpy (out, in, (size_t) i); + in += i; + out += i; + + if ((in_len > maxlen) + && PRIV (flag_hash_long_names)) + sprintf (out, "_%08lx", result); + else + *out = 0; + +#if VMS_DEBUG + vms_debug(4, "--> [%d]\"%s\"\n", strlen (outbuf), outbuf); +#endif + + if (in_len > maxlen + && PRIV (flag_hash_long_names) + && PRIV (flag_show_after_trunc)) + printf (_("Symbol %s replaced by %s\n"), old_name, new_name); + + return outbuf; +} + +/* Allocate and initialize a new symbol. */ + +static asymbol * +new_symbol (abfd, name) + bfd *abfd; + char *name; +{ + asymbol *symbol; + +#if VMS_DEBUG + _bfd_vms_debug (7, "new_symbol %s\n", name); +#endif + + symbol = bfd_make_empty_symbol (abfd); + if (symbol == 0) + return symbol; + symbol->name = name; + symbol->section = bfd_make_section (abfd, BFD_UND_SECTION_NAME); + + return symbol; +} + +/* Allocate and enter a new private symbol. */ + +vms_symbol_entry * +_bfd_vms_enter_symbol (abfd, name) + bfd *abfd; + char *name; +{ + vms_symbol_entry *entry; + +#if VMS_DEBUG + _bfd_vms_debug (6, "_bfd_vms_enter_symbol %s\n", name); +#endif + + entry = (vms_symbol_entry *) + bfd_hash_lookup (PRIV (vms_symbol_table), name, FALSE, FALSE); + if (entry == 0) + { +#if VMS_DEBUG + _bfd_vms_debug (8, "creating hash entry for %s\n", name); +#endif + entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table), + name, TRUE, FALSE); + if (entry != 0) + { + asymbol *symbol; + symbol = new_symbol (abfd, name); + if (symbol != 0) + { + entry->symbol = symbol; + PRIV (gsd_sym_count)++; + abfd->symcount++; + } + else + entry = 0; + } + else + (*_bfd_error_handler) (_("failed to enter %s"), name); + } + else + { +#if VMS_DEBUG + _bfd_vms_debug (8, "found hash entry for %s\n", name); +#endif + } + +#if VMS_DEBUG + _bfd_vms_debug (7, "-> entry %p, entry->symbol %p\n", entry, entry->symbol); +#endif + return entry; +} diff --git a/bfd/vms-tir.c b/bfd/vms-tir.c new file mode 100644 index 0000000000000..bd748ca3fa703 --- /dev/null +++ b/bfd/vms-tir.c @@ -0,0 +1,2416 @@ +/* vms-tir.c -- BFD back-end for VAX (openVMS/VAX) and + EVAX (openVMS/Alpha) files. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Free Software Foundation, Inc. + + TIR record handling functions + ETIR record handling functions + + go and read the openVMS linker manual (esp. appendix B) + if you don't know what's going on here :-) + + Written by Klaus K"ampf (kkaempf@rmi.de) + + This program is free software; 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. */ + +/* The following type abbreviations are used: + + cs counted string (ascii string with length byte) + by byte (1 byte) + sh short (2 byte, 16 bit) + lw longword (4 byte, 32 bit) + qw quadword (8 byte, 64 bit) + da data stream */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" + +#include "vms.h" + +static void image_set_ptr + PARAMS ((bfd *abfd, int psect, uquad offset)); +static void image_inc_ptr + PARAMS ((bfd *abfd, uquad offset)); +static void image_dump + PARAMS ((bfd *abfd, unsigned char *ptr, int size, int offset)); +static void image_write_b + PARAMS ((bfd *abfd, unsigned int value)); +static void image_write_w + PARAMS ((bfd *abfd, unsigned int value)); +static void image_write_l + PARAMS ((bfd *abfd, unsigned long value)); +static void image_write_q + PARAMS ((bfd *abfd, uquad value)); +static int check_section + PARAMS ((bfd *, int)); +static bfd_boolean etir_sta + PARAMS ((bfd *, int, unsigned char *)); +static bfd_boolean etir_sto + PARAMS ((bfd *, int, unsigned char *)); +static bfd_boolean etir_opr + PARAMS ((bfd *, int, unsigned char *)); +static bfd_boolean etir_ctl + PARAMS ((bfd *, int, unsigned char *)); +static bfd_boolean etir_stc + PARAMS ((bfd *, int, unsigned char *)); +static asection *new_section + PARAMS ((bfd *, int)); +static int alloc_section + PARAMS ((bfd *, unsigned int)); +static int etir_cmd + PARAMS ((bfd *, int, unsigned char *)); +static int analyze_tir + PARAMS ((bfd *, unsigned char *, unsigned int)); +static int analyze_etir + PARAMS ((bfd *, unsigned char *, unsigned int)); +static unsigned char * tir_opr + PARAMS ((bfd *, unsigned char *)); +static const char * tir_cmd_name + PARAMS ((int)); +static const char * cmd_name + PARAMS ((int)); + + +static int +check_section (abfd, size) + bfd *abfd; + int size; +{ + bfd_size_type offset; + + offset = PRIV (image_ptr) - PRIV (image_section)->contents; + if (offset + size > PRIV (image_section)->_raw_size) + { + PRIV (image_section)->contents + = bfd_realloc (PRIV (image_section)->contents, offset + size); + if (PRIV (image_section)->contents == 0) + { + (*_bfd_error_handler) (_("No Mem !")); + return -1; + } + PRIV (image_section)->_raw_size = offset + size; + PRIV (image_ptr) = PRIV (image_section)->contents + offset; + } + + return 0; +} + +/* Routines to fill sections contents during tir/etir read. */ + +/* Initialize image buffer pointer to be filled. */ + +static void +image_set_ptr (abfd, psect, offset) + bfd *abfd; + int psect; + uquad offset; +{ +#if VMS_DEBUG + _bfd_vms_debug (4, "image_set_ptr (%d=%s, %d)\n", + psect, PRIV (sections)[psect]->name, offset); +#endif + + PRIV (image_ptr) = PRIV (sections)[psect]->contents + offset; + PRIV (image_section) = PRIV (sections)[psect]; + return; +} + +/* Increment image buffer pointer by offset. */ + +static void +image_inc_ptr (abfd, offset) + bfd *abfd; + uquad offset; +{ +#if VMS_DEBUG + _bfd_vms_debug (4, "image_inc_ptr (%d)\n", offset); +#endif + + PRIV (image_ptr) += offset; + + return; +} + +/* Dump multiple bytes to section image. */ + +static void +image_dump (abfd, ptr, size, offset) + bfd *abfd; + unsigned char *ptr; + int size; + int offset ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + _bfd_vms_debug (8, "image_dump from (%p, %d) to (%p)\n", ptr, size, + PRIV (image_ptr)); + _bfd_hexdump (9, ptr, size, offset); +#endif + + if (PRIV (is_vax) && check_section (abfd, size)) + return; + + while (size-- > 0) + *PRIV (image_ptr)++ = *ptr++; + return; +} + +/* Write byte to section image. */ + +static void +image_write_b (abfd, value) + bfd *abfd; + unsigned int value; +{ +#if VMS_DEBUG + _bfd_vms_debug (6, "image_write_b(%02x)\n", (int) value); +#endif + + if (PRIV (is_vax) && check_section (abfd, 1)) + return; + + *PRIV (image_ptr)++ = (value & 0xff); + return; +} + +/* Write 2-byte word to image. */ + +static void +image_write_w (abfd, value) + bfd *abfd; + unsigned int value; +{ +#if VMS_DEBUG + _bfd_vms_debug (6, "image_write_w(%04x)\n", (int) value); +#endif + + if (PRIV (is_vax) && check_section (abfd, 2)) + return; + + bfd_putl16 ((bfd_vma) value, PRIV (image_ptr)); + PRIV (image_ptr) += 2; + + return; +} + +/* Write 4-byte long to image. */ + +static void +image_write_l (abfd, value) + bfd *abfd; + unsigned long value; +{ +#if VMS_DEBUG + _bfd_vms_debug (6, "image_write_l (%08lx)\n", value); +#endif + + if (PRIV (is_vax) && check_section (abfd, 4)) + return; + + bfd_putl32 ((bfd_vma) value, PRIV (image_ptr)); + PRIV (image_ptr) += 4; + + return; +} + +/* Write 8-byte quad to image. */ + +static void +image_write_q (abfd, value) + bfd *abfd; + uquad value; +{ +#if VMS_DEBUG + _bfd_vms_debug (6, "image_write_q (%016lx)\n", value); +#endif + + if (PRIV (is_vax) && check_section (abfd, 8)) + return; + + bfd_putl64 (value, PRIV (image_ptr)); + PRIV (image_ptr) += 8; + + return; +} + +static const char * +cmd_name (cmd) + int cmd; +{ + switch (cmd) + { + case ETIR_S_C_STA_GBL: return "ETIR_S_C_STA_GBL"; + case ETIR_S_C_STA_PQ: return "ETIR_S_C_STA_PQ"; + case ETIR_S_C_STA_LI: return "ETIR_S_C_STA_LI"; + case ETIR_S_C_STA_MOD: return "ETIR_S_C_STA_MOD"; + case ETIR_S_C_STA_CKARG: return "ETIR_S_C_STA_CKARG"; + case ETIR_S_C_STO_B: return "ETIR_S_C_STO_B"; + case ETIR_S_C_STO_W: return "ETIR_S_C_STO_W"; + case ETIR_S_C_STO_GBL: return "ETIR_S_C_STO_GBL"; + case ETIR_S_C_STO_CA: return "ETIR_S_C_STO_CA"; + case ETIR_S_C_STO_RB: return "ETIR_S_C_STO_RB"; + case ETIR_S_C_STO_AB: return "ETIR_S_C_STO_AB"; + case ETIR_S_C_STO_GBL_LW: return "ETIR_S_C_STO_GBL_LW"; + case ETIR_S_C_STO_LP_PSB: return "ETIR_S_C_STO_LP_PSB"; + case ETIR_S_C_STO_HINT_GBL: return "ETIR_S_C_STO_HINT_GBL"; + case ETIR_S_C_STO_HINT_PS: return "ETIR_S_C_STO_HINT_PS"; + case ETIR_S_C_OPR_INSV: return "ETIR_S_C_OPR_INSV"; + case ETIR_S_C_OPR_USH: return "ETIR_S_C_OPR_USH"; + case ETIR_S_C_OPR_ROT: return "ETIR_S_C_OPR_ROT"; + case ETIR_S_C_OPR_REDEF: return "ETIR_S_C_OPR_REDEF"; + case ETIR_S_C_OPR_DFLIT: return "ETIR_S_C_OPR_DFLIT"; + case ETIR_S_C_STC_LP: return "ETIR_S_C_STC_LP"; + case ETIR_S_C_STC_GBL: return "ETIR_S_C_STC_GBL"; + case ETIR_S_C_STC_GCA: return "ETIR_S_C_STC_GCA"; + case ETIR_S_C_STC_PS: return "ETIR_S_C_STC_PS"; + case ETIR_S_C_STC_NBH_PS: return "ETIR_S_C_STC_NBH_PS"; + case ETIR_S_C_STC_NOP_GBL: return "ETIR_S_C_STC_NOP_GBL"; + case ETIR_S_C_STC_NOP_PS: return "ETIR_S_C_STC_NOP_PS"; + case ETIR_S_C_STC_BSR_GBL: return "ETIR_S_C_STC_BSR_GBL"; + case ETIR_S_C_STC_BSR_PS: return "ETIR_S_C_STC_BSR_PS"; + case ETIR_S_C_STC_LDA_GBL: return "ETIR_S_C_STC_LDA_GBL"; + case ETIR_S_C_STC_LDA_PS: return "ETIR_S_C_STC_LDA_PS"; + case ETIR_S_C_STC_BOH_GBL: return "ETIR_S_C_STC_BOH_GBL"; + case ETIR_S_C_STC_BOH_PS: return "ETIR_S_C_STC_BOH_PS"; + case ETIR_S_C_STC_NBH_GBL: return "ETIR_S_C_STC_NBH_GBL"; + + default: + /* These names have not yet been added to this switch statement. */ + abort (); + } +} +#define HIGHBIT(op) ((op & 0x80000000L) == 0x80000000L) + +/* etir_sta + + vms stack commands + + handle sta_xxx commands in etir section + ptr points to data area in record + + see table B-8 of the openVMS linker manual. */ + +static bfd_boolean +etir_sta (abfd, cmd, ptr) + bfd *abfd; + int cmd; + unsigned char *ptr; +{ + +#if VMS_DEBUG + _bfd_vms_debug (5, "etir_sta %d/%x\n", cmd, cmd); + _bfd_hexdump (8, ptr, 16, (int) ptr); +#endif + + switch (cmd) + { + /* stack */ + + /* stack global + arg: cs symbol name + + stack 32 bit value of symbol (high bits set to 0) */ + + case ETIR_S_C_STA_GBL: + { + char *name; + vms_symbol_entry *entry; + + name = _bfd_vms_save_counted_string (ptr); + entry = (vms_symbol_entry *) + bfd_hash_lookup (PRIV (vms_symbol_table), name, FALSE, FALSE); + if (entry == (vms_symbol_entry *) NULL) + { +#if VMS_DEBUG + _bfd_vms_debug (3, "%s: no symbol \"%s\"\n", + cmd_name (cmd), name); +#endif + _bfd_vms_push (abfd, (uquad) 0, -1); + } + else + { + _bfd_vms_push (abfd, (uquad) (entry->symbol->value), -1); + } + } + break; + + /* stack longword + arg: lw value + + stack 32 bit value, sign extend to 64 bit */ + + case ETIR_S_C_STA_LW: + _bfd_vms_push (abfd, (uquad) bfd_getl32 (ptr), -1); + break; + + /* stack global + arg: qw value + + stack 64 bit value of symbol */ + + case ETIR_S_C_STA_QW: + _bfd_vms_push (abfd, (uquad) bfd_getl64 (ptr), -1); + break; + + /* stack psect base plus quadword offset + arg: lw section index + qw signed quadword offset (low 32 bits) + + stack qw argument and section index + (see ETIR_S_C_STO_OFF, ETIR_S_C_CTL_SETRB) */ + + case ETIR_S_C_STA_PQ: + { + uquad dummy; + unsigned int psect; + + psect = bfd_getl32 (ptr); + if (psect >= PRIV (section_count)) + { + (*_bfd_error_handler) (_("bad section index in %s"), + cmd_name (cmd)); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + dummy = bfd_getl64 (ptr+4); + _bfd_vms_push (abfd, dummy, (int) psect); + } + break; + + case ETIR_S_C_STA_LI: + case ETIR_S_C_STA_MOD: + case ETIR_S_C_STA_CKARG: + (*_bfd_error_handler) (_("unsupported STA cmd %s"), cmd_name (cmd)); + return FALSE; + break; + + default: + (*_bfd_error_handler) (_("reserved STA cmd %d"), cmd); + return FALSE; + break; + } +#if VMS_DEBUG + _bfd_vms_debug (5, "etir_sta true\n"); +#endif + return TRUE; +} + +/* + etir_sto + + vms store commands + + handle sto_xxx commands in etir section + ptr points to data area in record + + see table B-9 of the openVMS linker manual. */ + +static bfd_boolean +etir_sto (abfd, cmd, ptr) + bfd *abfd; + int cmd; + unsigned char *ptr; +{ + uquad dummy; + int psect; + +#if VMS_DEBUG + _bfd_vms_debug (5, "etir_sto %d/%x\n", cmd, cmd); + _bfd_hexdump (8, ptr, 16, (int) ptr); +#endif + + switch (cmd) + { + /* store byte: pop stack, write byte + arg: - */ + + case ETIR_S_C_STO_B: + dummy = _bfd_vms_pop (abfd, &psect); +#if 0 + if (is_share) /* FIXME */ + (*_bfd_error_handler) ("%s: byte fixups not supported", + cmd_name (cmd)); +#endif + /* FIXME: check top bits */ + image_write_b (abfd, (unsigned int) dummy & 0xff); + break; + + /* store word: pop stack, write word + arg: - */ + + case ETIR_S_C_STO_W: + dummy = _bfd_vms_pop (abfd, &psect); +#if 0 + if (is_share) /* FIXME */ + (*_bfd_error_handler) ("%s: word fixups not supported", + cmd_name (cmd)); +#endif + /* FIXME: check top bits */ + image_write_w (abfd, (unsigned int) dummy & 0xffff); + break; + + /* store longword: pop stack, write longword + arg: - */ + + case ETIR_S_C_STO_LW: + dummy = _bfd_vms_pop (abfd, &psect); + dummy += (PRIV (sections)[psect])->vma; + /* FIXME: check top bits. */ + image_write_l (abfd, (unsigned int) dummy & 0xffffffff); + break; + + /* store quadword: pop stack, write quadword + arg: - */ + + case ETIR_S_C_STO_QW: + dummy = _bfd_vms_pop (abfd, &psect); + dummy += (PRIV (sections)[psect])->vma; + image_write_q (abfd, dummy); /* FIXME: check top bits */ + break; + + /* store immediate repeated: pop stack for repeat count + arg: lw byte count + da data */ + + case ETIR_S_C_STO_IMMR: + { + int size; + + size = bfd_getl32 (ptr); + dummy = (unsigned long) _bfd_vms_pop (abfd, NULL); + while (dummy-- > 0) + image_dump (abfd, ptr+4, size, 0); + } + break; + + /* store global: write symbol value + arg: cs global symbol name. */ + + case ETIR_S_C_STO_GBL: + { + vms_symbol_entry *entry; + char *name; + + name = _bfd_vms_save_counted_string (ptr); + entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table), + name, FALSE, FALSE); + if (entry == (vms_symbol_entry *) NULL) + { + (*_bfd_error_handler) (_("%s: no symbol \"%s\""), + cmd_name (cmd), name); + return FALSE; + } + else + /* FIXME, reloc. */ + image_write_q (abfd, (uquad) (entry->symbol->value)); + } + break; + + /* store code address: write address of entry point + arg: cs global symbol name (procedure). */ + + case ETIR_S_C_STO_CA: + { + vms_symbol_entry *entry; + char *name; + + name = _bfd_vms_save_counted_string (ptr); + entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table), + name, FALSE, FALSE); + if (entry == (vms_symbol_entry *) NULL) + { + (*_bfd_error_handler) (_("%s: no symbol \"%s\""), + cmd_name (cmd), name); + return FALSE; + } + else + image_write_q (abfd, (uquad) (entry->symbol->value)); /* FIXME, reloc */ + } + break; + + /* Store offset to psect: pop stack, add low 32 bits to base of psect + arg: none. */ + + case ETIR_S_C_STO_OFF: + { + uquad q; + int psect1; + + q = _bfd_vms_pop (abfd, &psect1); + q += (PRIV (sections)[psect1])->vma; + image_write_q (abfd, q); + } + break; + + /* Store immediate + arg: lw count of bytes + da data. */ + + case ETIR_S_C_STO_IMM: + { + int size; + + size = bfd_getl32 (ptr); + image_dump (abfd, ptr+4, size, 0); + } + break; + + /* This code is 'reserved to digital' according to the openVMS + linker manual, however it is generated by the DEC C compiler + and defined in the include file. + FIXME, since the following is just a guess + store global longword: store 32bit value of symbol + arg: cs symbol name. */ + + case ETIR_S_C_STO_GBL_LW: + { + vms_symbol_entry *entry; + char *name; + + name = _bfd_vms_save_counted_string (ptr); + entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table), + name, FALSE, FALSE); + if (entry == (vms_symbol_entry *) NULL) + { +#if VMS_DEBUG + _bfd_vms_debug (3, "%s: no symbol \"%s\"\n", cmd_name (cmd), name); +#endif + image_write_l (abfd, (unsigned long) 0); /* FIXME, reloc */ + } + else + /* FIXME, reloc. */ + image_write_l (abfd, (unsigned long) (entry->symbol->value)); + } + break; + + case ETIR_S_C_STO_RB: + case ETIR_S_C_STO_AB: + case ETIR_S_C_STO_LP_PSB: + (*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd)); + break; + + case ETIR_S_C_STO_HINT_GBL: + case ETIR_S_C_STO_HINT_PS: + (*_bfd_error_handler) (_("%s: not implemented"), cmd_name (cmd)); + break; + + default: + (*_bfd_error_handler) (_("reserved STO cmd %d"), cmd); + break; + } + + return TRUE; +} + +/* Stack operator commands + all 32 bit signed arithmetic + all word just like a stack calculator + arguments are popped from stack, results are pushed on stack + + see table B-10 of the openVMS linker manual. */ + +static bfd_boolean +etir_opr (abfd, cmd, ptr) + bfd *abfd; + int cmd; + unsigned char *ptr ATTRIBUTE_UNUSED; +{ + long op1, op2; + +#if VMS_DEBUG + _bfd_vms_debug (5, "etir_opr %d/%x\n", cmd, cmd); + _bfd_hexdump (8, ptr, 16, (int) ptr); +#endif + + switch (cmd) + { + case ETIR_S_C_OPR_NOP: /* no-op */ + break; + + case ETIR_S_C_OPR_ADD: /* add */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 + op2), -1); + break; + + case ETIR_S_C_OPR_SUB: /* subtract */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op2 - op1), -1); + break; + + case ETIR_S_C_OPR_MUL: /* multiply */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 * op2), -1); + break; + + case ETIR_S_C_OPR_DIV: /* divide */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + if (op2 == 0) + _bfd_vms_push (abfd, (uquad) 0, -1); + else + _bfd_vms_push (abfd, (uquad) (op2 / op1), -1); + break; + + case ETIR_S_C_OPR_AND: /* logical and */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 & op2), -1); + break; + + case ETIR_S_C_OPR_IOR: /* logical inclusive or */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 | op2), -1); + break; + + case ETIR_S_C_OPR_EOR: /* logical exclusive or */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 ^ op2), -1); + break; + + case ETIR_S_C_OPR_NEG: /* negate */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (-op1), -1); + break; + + case ETIR_S_C_OPR_COM: /* complement */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 ^ -1L), -1); + break; + + case ETIR_S_C_OPR_ASH: /* arithmetic shift */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + if (op2 < 0) /* shift right */ + op1 >>= -op2; + else /* shift left */ + op1 <<= op2; + _bfd_vms_push (abfd, (uquad) op1, -1); + break; + + case ETIR_S_C_OPR_INSV: /* insert field */ + (void) _bfd_vms_pop (abfd, NULL); + case ETIR_S_C_OPR_USH: /* unsigned shift */ + case ETIR_S_C_OPR_ROT: /* rotate */ + case ETIR_S_C_OPR_REDEF: /* Redefine symbol to current location. */ + case ETIR_S_C_OPR_DFLIT: /* Define a literal. */ + (*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd)); + break; + + case ETIR_S_C_OPR_SEL: /* select */ + if ((long) _bfd_vms_pop (abfd, NULL) & 0x01L) + (void) _bfd_vms_pop (abfd, NULL); + else + { + op1 = (long) _bfd_vms_pop (abfd, NULL); + (void) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) op1, -1); + } + break; + + default: + (*_bfd_error_handler) (_("reserved OPR cmd %d"), cmd); + break; + } + + return TRUE; +} + +/* Control commands. + + See table B-11 of the openVMS linker manual. */ + +static bfd_boolean +etir_ctl (abfd, cmd, ptr) + bfd *abfd; + int cmd; + unsigned char *ptr; +{ + uquad dummy; + int psect; + +#if VMS_DEBUG + _bfd_vms_debug (5, "etir_ctl %d/%x\n", cmd, cmd); + _bfd_hexdump (8, ptr, 16, (int) ptr); +#endif + + switch (cmd) + { + /* set relocation base: pop stack, set image location counter + arg: none. */ + + case ETIR_S_C_CTL_SETRB: + dummy = _bfd_vms_pop (abfd, &psect); + image_set_ptr (abfd, psect, dummy); + break; + + /* augment relocation base: increment image location counter by offset + arg: lw offset value */ + + case ETIR_S_C_CTL_AUGRB: + dummy = bfd_getl32 (ptr); + image_inc_ptr (abfd, dummy); + break; + + /* define location: pop index, save location counter under index + arg: none. */ + + case ETIR_S_C_CTL_DFLOC: + dummy = _bfd_vms_pop (abfd, NULL); + /* FIXME */ + break; + + /* set location: pop index, restore location counter from index + arg: none. */ + + case ETIR_S_C_CTL_STLOC: + dummy = _bfd_vms_pop (abfd, &psect); + /* FIXME */ + break; + + /* stack defined location: pop index, push location counter from index + arg: none. */ + + case ETIR_S_C_CTL_STKDL: + dummy = _bfd_vms_pop (abfd, &psect); + /* FIXME */ + break; + + default: + (*_bfd_error_handler) (_("reserved CTL cmd %d"), cmd); + break; + } + return TRUE; +} + +/* store conditional commands + + See table B-12 and B-13 of the openVMS linker manual. */ + +static bfd_boolean +etir_stc (abfd, cmd, ptr) + bfd *abfd; + int cmd; + unsigned char *ptr ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + _bfd_vms_debug (5, "etir_stc %d/%x\n", cmd, cmd); + _bfd_hexdump (8, ptr, 16, (int) ptr); +#endif + + switch (cmd) + { + /* 200 Store-conditional Linkage Pair + arg: none. */ + + case ETIR_S_C_STC_LP: + (*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd)); + break; + + /* 201 Store-conditional Linkage Pair with Procedure Signature + arg: lw linkage index + cs procedure name + by signature length + da signature. */ + + case ETIR_S_C_STC_LP_PSB: + image_inc_ptr (abfd, (uquad) 16); /* skip entry,procval */ + break; + + /* 202 Store-conditional Address at global address + arg: lw linkage index + cs global name. */ + + case ETIR_S_C_STC_GBL: + (*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd)); + break; + + /* 203 Store-conditional Code Address at global address + arg: lw linkage index + cs procedure name. */ + + case ETIR_S_C_STC_GCA: + (*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd)); + break; + + /* 204 Store-conditional Address at psect + offset + arg: lw linkage index + lw psect index + qw offset. */ + + case ETIR_S_C_STC_PS: + (*_bfd_error_handler) (_("%s: not supported"), cmd_name (cmd)); + break; + + /* 205 Store-conditional NOP at address of global + arg: none. */ + + case ETIR_S_C_STC_NOP_GBL: + + /* 206 Store-conditional NOP at pect + offset + arg: none. */ + + case ETIR_S_C_STC_NOP_PS: + + /* 207 Store-conditional BSR at global address + arg: none. */ + + case ETIR_S_C_STC_BSR_GBL: + + /* 208 Store-conditional BSR at pect + offset + arg: none. */ + + case ETIR_S_C_STC_BSR_PS: + + /* 209 Store-conditional LDA at global address + arg: none. */ + + case ETIR_S_C_STC_LDA_GBL: + + /* 210 Store-conditional LDA at psect + offset + arg: none. */ + + case ETIR_S_C_STC_LDA_PS: + + /* 211 Store-conditional BSR or Hint at global address + arg: none. */ + + case ETIR_S_C_STC_BOH_GBL: + + /* 212 Store-conditional BSR or Hint at pect + offset + arg: none. */ + + case ETIR_S_C_STC_BOH_PS: + + /* 213 Store-conditional NOP,BSR or HINT at global address + arg: none. */ + + case ETIR_S_C_STC_NBH_GBL: + + /* 214 Store-conditional NOP,BSR or HINT at psect + offset + arg: none. */ + + case ETIR_S_C_STC_NBH_PS: + /* FIXME */ +#if 0 + (*_bfd_error_handler) ("%s: not supported", cmd_name (cmd)); +#endif + break; + + default: +#if VMS_DEBUG + _bfd_vms_debug (3, "reserved STC cmd %d", cmd); +#endif + break; + } + return TRUE; +} + +static asection * +new_section (abfd, idx) + bfd *abfd ATTRIBUTE_UNUSED; + int idx; +{ + asection *section; + char sname[16]; + char *name; + +#if VMS_DEBUG + _bfd_vms_debug (5, "new_section %d\n", idx); +#endif + sprintf (sname, SECTION_NAME_TEMPLATE, idx); + + name = bfd_malloc ((bfd_size_type) strlen (sname) + 1); + if (name == 0) + return 0; + strcpy (name, sname); + + section = bfd_malloc ((bfd_size_type) sizeof (asection)); + if (section == 0) + { +#if VMS_DEBUG + _bfd_vms_debug (6, "bfd_make_section (%s) failed", name); +#endif + return 0; + } + + section->_raw_size = 0; + section->vma = 0; + section->contents = 0; + section->_cooked_size = 0; + section->name = name; + section->index = idx; + + return section; +} + +static int +alloc_section (abfd, idx) + bfd *abfd; + unsigned int idx; +{ + bfd_size_type amt; + +#if VMS_DEBUG + _bfd_vms_debug (4, "alloc_section %d\n", idx); +#endif + + amt = idx + 1; + amt *= sizeof (asection *); + PRIV (sections) = (asection **) bfd_realloc (PRIV (sections), amt); + if (PRIV (sections) == 0) + return -1; + + while (PRIV (section_count) <= idx) + { + PRIV (sections)[PRIV (section_count)] + = new_section (abfd, (int) PRIV (section_count)); + if (PRIV (sections)[PRIV (section_count)] == 0) + return -1; + PRIV (section_count)++; + } + + return 0; +} + +/* tir_sta + + vax stack commands + + Handle sta_xxx commands in tir section + ptr points to data area in record + + See table 7-3 of the VAX/VMS linker manual. */ + +static unsigned char * +tir_sta (bfd *abfd, unsigned char *ptr) +{ + int cmd = *ptr++; + +#if VMS_DEBUG + _bfd_vms_debug (5, "tir_sta %d\n", cmd); +#endif + + switch (cmd) + { + /* stack */ + case TIR_S_C_STA_GBL: + /* stack global + arg: cs symbol name + + stack 32 bit value of symbol (high bits set to 0). */ + { + char *name; + vms_symbol_entry *entry; + + name = _bfd_vms_save_counted_string (ptr); + + entry = _bfd_vms_enter_symbol (abfd, name); + if (entry == (vms_symbol_entry *) NULL) + return 0; + + _bfd_vms_push (abfd, (uquad) (entry->symbol->value), -1); + ptr += *ptr + 1; + } + break; + + case TIR_S_C_STA_SB: + /* stack signed byte + arg: by value + + stack byte value, sign extend to 32 bit. */ + _bfd_vms_push (abfd, (uquad) *ptr++, -1); + break; + + case TIR_S_C_STA_SW: + /* stack signed short word + arg: sh value + + stack 16 bit value, sign extend to 32 bit. */ + _bfd_vms_push (abfd, (uquad) bfd_getl16 (ptr), -1); + ptr += 2; + break; + + case TIR_S_C_STA_LW: + /* stack signed longword + arg: lw value + + stack 32 bit value. */ + _bfd_vms_push (abfd, (uquad) bfd_getl32 (ptr), -1); + ptr += 4; + break; + + case TIR_S_C_STA_PB: + case TIR_S_C_STA_WPB: + /* stack psect base plus byte offset (word index) + arg: by section index + (sh section index) + by signed byte offset. */ + { + unsigned long dummy; + unsigned int psect; + + if (cmd == TIR_S_C_STA_PB) + psect = *ptr++; + else + { + psect = bfd_getl16 (ptr); + ptr += 2; + } + + if (psect >= PRIV (section_count)) + alloc_section (abfd, psect); + + dummy = (long) *ptr++; + dummy += (PRIV (sections)[psect])->vma; + _bfd_vms_push (abfd, (uquad) dummy, (int) psect); + } + break; + + case TIR_S_C_STA_PW: + case TIR_S_C_STA_WPW: + /* stack psect base plus word offset (word index) + arg: by section index + (sh section index) + sh signed short offset. */ + { + unsigned long dummy; + unsigned int psect; + + if (cmd == TIR_S_C_STA_PW) + psect = *ptr++; + else + { + psect = bfd_getl16 (ptr); + ptr += 2; + } + + if (psect >= PRIV (section_count)) + alloc_section (abfd, psect); + + dummy = bfd_getl16 (ptr); ptr+=2; + dummy += (PRIV (sections)[psect])->vma; + _bfd_vms_push (abfd, (uquad) dummy, (int) psect); + } + break; + + case TIR_S_C_STA_PL: + case TIR_S_C_STA_WPL: + /* stack psect base plus long offset (word index) + arg: by section index + (sh section index) + lw signed longword offset. */ + { + unsigned long dummy; + unsigned int psect; + + if (cmd == TIR_S_C_STA_PL) + psect = *ptr++; + else + { + psect = bfd_getl16 (ptr); + ptr += 2; + } + + if (psect >= PRIV (section_count)) + alloc_section (abfd, psect); + + dummy = bfd_getl32 (ptr); ptr += 4; + dummy += (PRIV (sections)[psect])->vma; + _bfd_vms_push (abfd, (uquad) dummy, (int) psect); + } + break; + + case TIR_S_C_STA_UB: + /* stack unsigned byte + arg: by value + + stack byte value. */ + _bfd_vms_push (abfd, (uquad) *ptr++, -1); + break; + + case TIR_S_C_STA_UW: + /* stack unsigned short word + arg: sh value + + stack 16 bit value. */ + _bfd_vms_push (abfd, (uquad) bfd_getl16 (ptr), -1); + ptr += 2; + break; + + case TIR_S_C_STA_BFI: + /* stack byte from image + arg: none. */ + /* FALLTHRU */ + case TIR_S_C_STA_WFI: + /* stack byte from image + arg: none. */ + /* FALLTHRU */ + case TIR_S_C_STA_LFI: + /* stack byte from image + arg: none. */ + (*_bfd_error_handler) (_("stack-from-image not implemented")); + return NULL; + + case TIR_S_C_STA_EPM: + /* stack entry point mask + arg: cs symbol name + + stack (unsigned) entry point mask of symbol + err if symbol is no entry point. */ + { + char *name; + vms_symbol_entry *entry; + + name = _bfd_vms_save_counted_string (ptr); + entry = _bfd_vms_enter_symbol (abfd, name); + if (entry == (vms_symbol_entry *) NULL) + return 0; + + (*_bfd_error_handler) (_("stack-entry-mask not fully implemented")); + _bfd_vms_push (abfd, (uquad) 0, -1); + ptr += *ptr + 1; + } + break; + + case TIR_S_C_STA_CKARG: + /* compare procedure argument + arg: cs symbol name + by argument index + da argument descriptor + + compare argument descriptor with symbol argument (ARG$V_PASSMECH) + and stack TRUE (args match) or FALSE (args dont match) value. */ + (*_bfd_error_handler) (_("PASSMECH not fully implemented")); + _bfd_vms_push (abfd, (uquad) 1, -1); + break; + + case TIR_S_C_STA_LSY: + /* stack local symbol value + arg: sh environment index + cs symbol name. */ + { + int envidx; + char *name; + vms_symbol_entry *entry; + + envidx = bfd_getl16 (ptr); + ptr += 2; + name = _bfd_vms_save_counted_string (ptr); + entry = _bfd_vms_enter_symbol (abfd, name); + if (entry == (vms_symbol_entry *) NULL) + return 0; + (*_bfd_error_handler) (_("stack-local-symbol not fully implemented")); + _bfd_vms_push (abfd, (uquad) 0, -1); + ptr += *ptr + 1; + } + break; + + case TIR_S_C_STA_LIT: + /* stack literal + arg: by literal index + + stack literal. */ + ptr++; + _bfd_vms_push (abfd, (uquad) 0, -1); + (*_bfd_error_handler) (_("stack-literal not fully implemented")); + break; + + case TIR_S_C_STA_LEPM: + /* stack local symbol entry point mask + arg: sh environment index + cs symbol name + + stack (unsigned) entry point mask of symbol + err if symbol is no entry point. */ + { + int envidx; + char *name; + vms_symbol_entry *entry; + + envidx = bfd_getl16 (ptr); + ptr += 2; + name = _bfd_vms_save_counted_string (ptr); + entry = _bfd_vms_enter_symbol (abfd, name); + if (entry == (vms_symbol_entry *) NULL) + return 0; + (*_bfd_error_handler) (_("stack-local-symbol-entry-point-mask not fully implemented")); + _bfd_vms_push (abfd, (uquad) 0, -1); + ptr += *ptr + 1; + } + break; + + default: + (*_bfd_error_handler) (_("reserved STA cmd %d"), ptr[-1]); + return NULL; + break; + } + + return ptr; +} + +static const char * +tir_cmd_name (cmd) + int cmd; +{ + switch (cmd) + { + case TIR_S_C_STO_RSB: return "TIR_S_C_STO_RSB"; + case TIR_S_C_STO_RSW: return "TIR_S_C_STO_RSW"; + case TIR_S_C_STO_RL: return "TIR_S_C_STO_RL"; + case TIR_S_C_STO_VPS: return "TIR_S_C_STO_VPS"; + case TIR_S_C_STO_USB: return "TIR_S_C_STO_USB"; + case TIR_S_C_STO_USW: return "TIR_S_C_STO_USW"; + case TIR_S_C_STO_RUB: return "TIR_S_C_STO_RUB"; + case TIR_S_C_STO_RUW: return "TIR_S_C_STO_RUW"; + case TIR_S_C_STO_PIRR: return "TIR_S_C_STO_PIRR"; + case TIR_S_C_OPR_INSV: return "TIR_S_C_OPR_INSV"; + case TIR_S_C_OPR_DFLIT: return "TIR_S_C_OPR_DFLIT"; + case TIR_S_C_OPR_REDEF: return "TIR_S_C_OPR_REDEF"; + case TIR_S_C_OPR_ROT: return "TIR_S_C_OPR_ROT"; + case TIR_S_C_OPR_USH: return "TIR_S_C_OPR_USH"; + case TIR_S_C_OPR_ASH: return "TIR_S_C_OPR_ASH"; + case TIR_S_C_CTL_DFLOC: return "TIR_S_C_CTL_DFLOC"; + case TIR_S_C_CTL_STLOC: return "TIR_S_C_CTL_STLOC"; + case TIR_S_C_CTL_STKDL: return "TIR_S_C_CTL_STKDL"; + + default: + /* These strings have not been added yet. */ + abort (); + } +} + +/* tir_sto + + vax store commands + + handle sto_xxx commands in tir section + ptr points to data area in record + + See table 7-4 of the VAX/VMS linker manual. */ + +static unsigned char * +tir_sto (bfd *abfd, unsigned char *ptr) +{ + unsigned long dummy; + int size; + int psect; + +#if VMS_DEBUG + _bfd_vms_debug (5, "tir_sto %d\n", *ptr); +#endif + + switch (*ptr++) + { + case TIR_S_C_STO_SB: + /* store signed byte: pop stack, write byte + arg: none. */ + dummy = _bfd_vms_pop (abfd, &psect); + image_write_b (abfd, dummy & 0xff); /* FIXME: check top bits */ + break; + + case TIR_S_C_STO_SW: + /* store signed word: pop stack, write word + arg: none. */ + dummy = _bfd_vms_pop (abfd, &psect); + image_write_w (abfd, dummy & 0xffff); /* FIXME: check top bits */ + break; + + case TIR_S_C_STO_LW: + /* store longword: pop stack, write longword + arg: none. */ + dummy = _bfd_vms_pop (abfd, &psect); + image_write_l (abfd, dummy & 0xffffffff); /* FIXME: check top bits */ + break; + + case TIR_S_C_STO_BD: + /* store byte displaced: pop stack, sub lc+1, write byte + arg: none. */ + dummy = _bfd_vms_pop (abfd, &psect); + dummy -= ((PRIV (sections)[psect])->vma + 1); + image_write_b (abfd, dummy & 0xff);/* FIXME: check top bits */ + break; + + case TIR_S_C_STO_WD: + /* store word displaced: pop stack, sub lc+2, write word + arg: none. */ + dummy = _bfd_vms_pop (abfd, &psect); + dummy -= ((PRIV (sections)[psect])->vma + 2); + image_write_w (abfd, dummy & 0xffff);/* FIXME: check top bits */ + break; + + case TIR_S_C_STO_LD: + /* store long displaced: pop stack, sub lc+4, write long + arg: none. */ + dummy = _bfd_vms_pop (abfd, &psect); + dummy -= ((PRIV (sections)[psect])->vma + 4); + image_write_l (abfd, dummy & 0xffffffff);/* FIXME: check top bits */ + break; + + case TIR_S_C_STO_LI: + /* store short literal: pop stack, write byte + arg: none. */ + dummy = _bfd_vms_pop (abfd, &psect); + image_write_b (abfd, dummy & 0xff);/* FIXME: check top bits */ + break; + + case TIR_S_C_STO_PIDR: + /* store position independent data reference: pop stack, write longword + arg: none. + FIXME: incomplete ! */ + dummy = _bfd_vms_pop (abfd, &psect); + image_write_l (abfd, dummy & 0xffffffff); + break; + + case TIR_S_C_STO_PICR: + /* store position independent code reference: pop stack, write longword + arg: none. + FIXME: incomplete ! */ + dummy = _bfd_vms_pop (abfd, &psect); + image_write_b (abfd, 0x9f); + image_write_l (abfd, dummy & 0xffffffff); + break; + + case TIR_S_C_STO_RIVB: + /* store repeated immediate variable bytes + 1-byte count n field followed by n bytes of data + pop stack, write n bytes times. */ + size = *ptr++; + dummy = (unsigned long) _bfd_vms_pop (abfd, NULL); + while (dummy-- > 0L) + image_dump (abfd, ptr, size, 0); + ptr += size; + break; + + case TIR_S_C_STO_B: + /* store byte from top longword. */ + dummy = (unsigned long) _bfd_vms_pop (abfd, NULL); + image_write_b (abfd, dummy & 0xff); + break; + + case TIR_S_C_STO_W: + /* store word from top longword. */ + dummy = (unsigned long) _bfd_vms_pop (abfd, NULL); + image_write_w (abfd, dummy & 0xffff); + break; + + case TIR_S_C_STO_RB: + /* store repeated byte from top longword. */ + size = (unsigned long) _bfd_vms_pop (abfd, NULL); + dummy = (unsigned long) _bfd_vms_pop (abfd, NULL); + while (size-- > 0) + image_write_b (abfd, dummy & 0xff); + break; + + case TIR_S_C_STO_RW: + /* store repeated word from top longword. */ + size = (unsigned long) _bfd_vms_pop (abfd, NULL); + dummy = (unsigned long) _bfd_vms_pop (abfd, NULL); + while (size-- > 0) + image_write_w (abfd, dummy & 0xffff); + break; + + case TIR_S_C_STO_RSB: + case TIR_S_C_STO_RSW: + case TIR_S_C_STO_RL: + case TIR_S_C_STO_VPS: + case TIR_S_C_STO_USB: + case TIR_S_C_STO_USW: + case TIR_S_C_STO_RUB: + case TIR_S_C_STO_RUW: + case TIR_S_C_STO_PIRR: + (*_bfd_error_handler) (_("%s: not implemented"), tir_cmd_name (ptr[-1])); + break; + + default: + (*_bfd_error_handler) (_("reserved STO cmd %d"), ptr[-1]); + break; + } + + return ptr; +} + +/* stack operator commands + all 32 bit signed arithmetic + all word just like a stack calculator + arguments are popped from stack, results are pushed on stack + + See table 7-5 of the VAX/VMS linker manual. */ + +static unsigned char * +tir_opr (abfd, ptr) + bfd *abfd; + unsigned char *ptr; +{ + long op1, op2; + +#if VMS_DEBUG + _bfd_vms_debug (5, "tir_opr %d\n", *ptr); +#endif + + switch (*ptr++) + { + /* operation */ + case TIR_S_C_OPR_NOP: /* no-op */ + break; + + case TIR_S_C_OPR_ADD: /* add */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 + op2), -1); + break; + + case TIR_S_C_OPR_SUB: /* subtract */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op2 - op1), -1); + break; + + case TIR_S_C_OPR_MUL: /* multiply */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 * op2), -1); + break; + + case TIR_S_C_OPR_DIV: /* divide */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + if (op2 == 0) + _bfd_vms_push (abfd, (uquad) 0, -1); + else + _bfd_vms_push (abfd, (uquad) (op2 / op1), -1); + break; + + case TIR_S_C_OPR_AND: /* logical and */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 & op2), -1); + break; + + case TIR_S_C_OPR_IOR: /* logical inclusive or */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 | op2), -1); + break; + + case TIR_S_C_OPR_EOR: /* logical exclusive or */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 ^ op2), -1); + break; + + case TIR_S_C_OPR_NEG: /* negate */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (-op1), -1); + break; + + case TIR_S_C_OPR_COM: /* complement */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) (op1 ^ -1L), -1); + break; + + case TIR_S_C_OPR_INSV: /* insert field */ + (void) _bfd_vms_pop (abfd, NULL); + (*_bfd_error_handler) (_("%s: not fully implemented"), + tir_cmd_name (ptr[-1])); + break; + + case TIR_S_C_OPR_ASH: /* arithmetic shift */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + if (HIGHBIT (op1)) /* shift right */ + op2 >>= op1; + else /* shift left */ + op2 <<= op1; + _bfd_vms_push (abfd, (uquad) op2, -1); + (*_bfd_error_handler) (_("%s: not fully implemented"), + tir_cmd_name (ptr[-1])); + break; + + case TIR_S_C_OPR_USH: /* unsigned shift */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + if (HIGHBIT (op1)) /* shift right */ + op2 >>= op1; + else /* shift left */ + op2 <<= op1; + _bfd_vms_push (abfd, (uquad) op2, -1); + (*_bfd_error_handler) (_("%s: not fully implemented"), + tir_cmd_name (ptr[-1])); + break; + + case TIR_S_C_OPR_ROT: /* rotate */ + op1 = (long) _bfd_vms_pop (abfd, NULL); + op2 = (long) _bfd_vms_pop (abfd, NULL); + if (HIGHBIT (0)) /* shift right */ + op2 >>= op1; + else /* shift left */ + op2 <<= op1; + _bfd_vms_push (abfd, (uquad) op2, -1); + (*_bfd_error_handler) (_("%s: not fully implemented"), + tir_cmd_name (ptr[-1])); + break; + + case TIR_S_C_OPR_SEL: /* select */ + if ((long) _bfd_vms_pop (abfd, NULL) & 0x01L) + (void) _bfd_vms_pop (abfd, NULL); + else + { + op1 = (long) _bfd_vms_pop (abfd, NULL); + (void) _bfd_vms_pop (abfd, NULL); + _bfd_vms_push (abfd, (uquad) op1, -1); + } + break; + + case TIR_S_C_OPR_REDEF: /* Redefine symbol to current location. */ + case TIR_S_C_OPR_DFLIT: /* Define a literal. */ + (*_bfd_error_handler) (_("%s: not supported"), + tir_cmd_name (ptr[-1])); + break; + + default: + (*_bfd_error_handler) (_("reserved OPR cmd %d"), ptr[-1]); + break; + } + + return ptr; +} + +/* control commands + + See table 7-6 of the VAX/VMS linker manual. */ + +static unsigned char * +tir_ctl (bfd *abfd, unsigned char *ptr) +{ + unsigned long dummy; + unsigned int psect; + +#if VMS_DEBUG + _bfd_vms_debug (5, "tir_ctl %d\n", *ptr); +#endif + + switch (*ptr++) + { + case TIR_S_C_CTL_SETRB: + /* Set relocation base: pop stack, set image location counter + arg: none. */ + dummy = _bfd_vms_pop (abfd, &psect); + if (psect >= PRIV (section_count)) + alloc_section (abfd, psect); + image_set_ptr (abfd, (int) psect, (uquad) dummy); + break; + + case TIR_S_C_CTL_AUGRB: + /* Augment relocation base: increment image location counter by offset + arg: lw offset value. */ + dummy = bfd_getl32 (ptr); + image_inc_ptr (abfd, (uquad) dummy); + break; + + case TIR_S_C_CTL_DFLOC: + /* Define location: pop index, save location counter under index + arg: none. */ + dummy = _bfd_vms_pop (abfd, NULL); + (*_bfd_error_handler) (_("%s: not fully implemented"), + tir_cmd_name (ptr[-1])); + break; + + case TIR_S_C_CTL_STLOC: + /* Set location: pop index, restore location counter from index + arg: none. */ + dummy = _bfd_vms_pop (abfd, &psect); + (*_bfd_error_handler) (_("%s: not fully implemented"), + tir_cmd_name (ptr[-1])); + break; + + case TIR_S_C_CTL_STKDL: + /* Stack defined location: pop index, push location counter from index + arg: none. */ + dummy = _bfd_vms_pop (abfd, &psect); + (*_bfd_error_handler) (_("%s: not fully implemented"), + tir_cmd_name (ptr[-1])); + break; + + default: + (*_bfd_error_handler) (_("reserved CTL cmd %d"), ptr[-1]); + break; + } + return ptr; +} + +/* Handle command from TIR section. */ + +static unsigned char * +tir_cmd (bfd *abfd, unsigned char *ptr) +{ + struct + { + int mincod; + int maxcod; + unsigned char * (*explain) (bfd *, unsigned char *); + } + tir_table[] = + { + { 0, TIR_S_C_MAXSTACOD, tir_sta }, + { TIR_S_C_MINSTOCOD, TIR_S_C_MAXSTOCOD, tir_sto }, + { TIR_S_C_MINOPRCOD, TIR_S_C_MAXOPRCOD, tir_opr }, + { TIR_S_C_MINCTLCOD, TIR_S_C_MAXCTLCOD, tir_ctl }, + { -1, -1, NULL } + }; + int i = 0; + +#if VMS_DEBUG + _bfd_vms_debug (4, "tir_cmd %d/%x\n", *ptr, *ptr); + _bfd_hexdump (8, ptr, 16, (int) ptr); +#endif + + if (*ptr & 0x80) /* store immediate */ + { + i = 128 - (*ptr++ & 0x7f); + image_dump (abfd, ptr, i, 0); + ptr += i; + } + else + { + while (tir_table[i].mincod >= 0) + { + if ( (tir_table[i].mincod <= *ptr) + && (*ptr <= tir_table[i].maxcod)) + { + ptr = tir_table[i].explain (abfd, ptr); + break; + } + i++; + } + if (tir_table[i].mincod < 0) + { + (*_bfd_error_handler) (_("obj code %d not found"), *ptr); + ptr = 0; + } + } + + return ptr; +} + +/* Handle command from ETIR section. */ + +static int +etir_cmd (abfd, cmd, ptr) + bfd *abfd; + int cmd; + unsigned char *ptr; +{ + static struct + { + int mincod; + int maxcod; + bfd_boolean (*explain) PARAMS ((bfd *, int, unsigned char *)); + } + etir_table[] = + { + { ETIR_S_C_MINSTACOD, ETIR_S_C_MAXSTACOD, etir_sta }, + { ETIR_S_C_MINSTOCOD, ETIR_S_C_MAXSTOCOD, etir_sto }, + { ETIR_S_C_MINOPRCOD, ETIR_S_C_MAXOPRCOD, etir_opr }, + { ETIR_S_C_MINCTLCOD, ETIR_S_C_MAXCTLCOD, etir_ctl }, + { ETIR_S_C_MINSTCCOD, ETIR_S_C_MAXSTCCOD, etir_stc }, + { -1, -1, NULL } + }; + + int i = 0; + +#if VMS_DEBUG + _bfd_vms_debug (4, "etir_cmd %d/%x\n", cmd, cmd); + _bfd_hexdump (8, ptr, 16, (int) ptr); +#endif + + while (etir_table[i].mincod >= 0) + { + if ( (etir_table[i].mincod <= cmd) + && (cmd <= etir_table[i].maxcod)) + { + if (!etir_table[i].explain (abfd, cmd, ptr)) + return -1; + break; + } + i++; + } + +#if VMS_DEBUG + _bfd_vms_debug (4, "etir_cmd: = 0\n"); +#endif + return 0; +} + +/* Text Information and Relocation Records (OBJ$C_TIR) + handle tir record. */ + +static int +analyze_tir (abfd, ptr, length) + bfd *abfd; + unsigned char *ptr; + unsigned int length; +{ + unsigned char *maxptr; + +#if VMS_DEBUG + _bfd_vms_debug (3, "analyze_tir: %d bytes\n", length); +#endif + + maxptr = ptr + length; + + while (ptr < maxptr) + { + ptr = tir_cmd (abfd, ptr); + if (ptr == 0) + return -1; + } + + return 0; +} + +/* Text Information and Relocation Records (EOBJ$C_ETIR) + handle etir record. */ + +static int +analyze_etir (abfd, ptr, length) + bfd *abfd; + unsigned char *ptr; + unsigned int length; +{ + int cmd; + unsigned char *maxptr; + int result = 0; + +#if VMS_DEBUG + _bfd_vms_debug (3, "analyze_etir: %d bytes\n", length); +#endif + + maxptr = ptr + length; + + while (ptr < maxptr) + { + cmd = bfd_getl16 (ptr); + length = bfd_getl16 (ptr + 2); + result = etir_cmd (abfd, cmd, ptr+4); + if (result != 0) + break; + ptr += length; + } + +#if VMS_DEBUG + _bfd_vms_debug (3, "analyze_etir: = %d\n", result); +#endif + + return result; +} + +/* Process ETIR record + Return 0 on success, -1 on error. */ + +int +_bfd_vms_slurp_tir (abfd, objtype) + bfd *abfd; + int objtype; +{ + int result; + +#if VMS_DEBUG + _bfd_vms_debug (2, "TIR/ETIR\n"); +#endif + + switch (objtype) + { + case EOBJ_S_C_ETIR: + PRIV (vms_rec) += 4; /* skip type, size */ + PRIV (rec_size) -= 4; + result = analyze_etir (abfd, PRIV (vms_rec), (unsigned) PRIV (rec_size)); + break; + case OBJ_S_C_TIR: + PRIV (vms_rec) += 1; /* skip type */ + PRIV (rec_size) -= 1; + result = analyze_tir (abfd, PRIV (vms_rec), (unsigned) PRIV (rec_size)); + break; + default: + result = -1; + break; + } + + return result; +} + +/* Process EDBG record + Return 0 on success, -1 on error + + Not implemented yet. */ + +int +_bfd_vms_slurp_dbg (abfd, objtype) + bfd *abfd; + int objtype ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + _bfd_vms_debug (2, "DBG/EDBG\n"); +#endif + + abfd->flags |= (HAS_DEBUG | HAS_LINENO); + return 0; +} + +/* Process ETBT record + Return 0 on success, -1 on error + + Not implemented yet. */ + +int +_bfd_vms_slurp_tbt (abfd, objtype) + bfd *abfd ATTRIBUTE_UNUSED; + int objtype ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + _bfd_vms_debug (2, "TBT/ETBT\n"); +#endif + + return 0; +} + +/* Process LNK record + Return 0 on success, -1 on error + + Not implemented yet. */ + +int +_bfd_vms_slurp_lnk (abfd, objtype) + bfd *abfd ATTRIBUTE_UNUSED; + int objtype ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + _bfd_vms_debug (2, "LNK\n"); +#endif + + return 0; +} + +/* WRITE ETIR SECTION + + This is still under construction and therefore not documented. */ + +static void start_etir_record + PARAMS ((bfd *abfd, int index, uquad offset, bfd_boolean justoffset)); +static void sto_imm + PARAMS ((bfd *abfd, vms_section *sptr, bfd_vma vaddr, int index)); +static void end_etir_record + PARAMS ((bfd *abfd)); + +static void +sto_imm (abfd, sptr, vaddr, index) + bfd *abfd; + vms_section *sptr; + bfd_vma vaddr; + int index; +{ + int size; + int ssize; + unsigned char *cptr; + +#if VMS_DEBUG + _bfd_vms_debug (8, "sto_imm %d bytes\n", sptr->size); + _bfd_hexdump (9, sptr->contents, (int) sptr->size, (int) vaddr); +#endif + + ssize = sptr->size; + cptr = sptr->contents; + + while (ssize > 0) + { + size = ssize; /* try all the rest */ + + if (_bfd_vms_output_check (abfd, size) < 0) + { /* doesn't fit, split ! */ + end_etir_record (abfd); + start_etir_record (abfd, index, vaddr, FALSE); + size = _bfd_vms_output_check (abfd, 0); /* get max size */ + if (size > ssize) /* more than what's left ? */ + size = ssize; + } + + _bfd_vms_output_begin (abfd, ETIR_S_C_STO_IMM, -1); + _bfd_vms_output_long (abfd, (unsigned long) (size)); + _bfd_vms_output_dump (abfd, cptr, size); + _bfd_vms_output_flush (abfd); + +#if VMS_DEBUG + _bfd_vms_debug (10, "dumped %d bytes\n", size); + _bfd_hexdump (10, cptr, (int) size, (int) vaddr); +#endif + + vaddr += size; + ssize -= size; + cptr += size; + } +} + +/* Start ETIR record for section #index at virtual addr offset. */ + +static void +start_etir_record (abfd, index, offset, justoffset) + bfd *abfd; + int index; + uquad offset; + bfd_boolean justoffset; +{ + if (!justoffset) + { + _bfd_vms_output_begin (abfd, EOBJ_S_C_ETIR, -1); /* one ETIR per section */ + _bfd_vms_output_push (abfd); + } + + _bfd_vms_output_begin (abfd, ETIR_S_C_STA_PQ, -1); /* push start offset */ + _bfd_vms_output_long (abfd, (unsigned long) index); + _bfd_vms_output_quad (abfd, (uquad) offset); + _bfd_vms_output_flush (abfd); + + _bfd_vms_output_begin (abfd, ETIR_S_C_CTL_SETRB, -1); /* start = pop () */ + _bfd_vms_output_flush (abfd); +} + +/* End etir record. */ + +static void +end_etir_record (abfd) + bfd *abfd; +{ + _bfd_vms_output_pop (abfd); + _bfd_vms_output_end (abfd); +} + +/* Write section contents for bfd abfd. */ + +int +_bfd_vms_write_tir (abfd, objtype) + bfd *abfd; + int objtype ATTRIBUTE_UNUSED; +{ + asection *section; + vms_section *sptr; + int nextoffset; + +#if VMS_DEBUG + _bfd_vms_debug (2, "vms_write_tir (%p, %d)\n", abfd, objtype); +#endif + + _bfd_vms_output_alignment (abfd, 4); + + nextoffset = 0; + PRIV (vms_linkage_index) = 1; + + /* Dump all other sections. */ + + section = abfd->sections; + + while (section != NULL) + { + +#if VMS_DEBUG + _bfd_vms_debug (4, "writing %d. section '%s' (%d bytes)\n", + section->index, section->name, + (int) (section->_raw_size)); +#endif + + if (section->flags & SEC_RELOC) + { + int i; + + if ((i = section->reloc_count) <= 0) + { + (*_bfd_error_handler) (_("SEC_RELOC with no relocs in section %s"), + section->name); + } +#if VMS_DEBUG + else + { + arelent **rptr; + _bfd_vms_debug (4, "%d relocations:\n", i); + rptr = section->orelocation; + while (i-- > 0) + { + _bfd_vms_debug (4, "sym %s in sec %s, value %08lx, addr %08lx, off %08lx, len %d: %s\n", + (*(*rptr)->sym_ptr_ptr)->name, + (*(*rptr)->sym_ptr_ptr)->section->name, + (long) (*(*rptr)->sym_ptr_ptr)->value, + (*rptr)->address, (*rptr)->addend, + bfd_get_reloc_size ((*rptr)->howto), + (*rptr)->howto->name); + rptr++; + } + } +#endif + } + + if ((section->flags & SEC_HAS_CONTENTS) + && (! bfd_is_com_section (section))) + { + bfd_vma vaddr; /* Virtual addr in section. */ + + sptr = _bfd_get_vms_section (abfd, section->index); + if (sptr == NULL) + { + bfd_set_error (bfd_error_no_contents); + return -1; + } + + vaddr = (bfd_vma) (sptr->offset); + + start_etir_record (abfd, section->index, (uquad) sptr->offset, + FALSE); + + while (sptr != NULL) /* one STA_PQ, CTL_SETRB per vms_section */ + { + + if (section->flags & SEC_RELOC) /* check for relocs */ + { + arelent **rptr = section->orelocation; + int i = section->reloc_count; + + for (;;) + { + bfd_size_type addr = (*rptr)->address; + bfd_size_type len = bfd_get_reloc_size ((*rptr)->howto); + if (sptr->offset < addr) /* sptr starts before reloc */ + { + bfd_size_type before = addr - sptr->offset; + if (sptr->size <= before) /* complete before */ + { + sto_imm (abfd, sptr, vaddr, section->index); + vaddr += sptr->size; + break; + } + else /* partly before */ + { + int after = sptr->size - before; + sptr->size = before; + sto_imm (abfd, sptr, vaddr, section->index); + vaddr += sptr->size; + sptr->contents += before; + sptr->offset += before; + sptr->size = after; + } + } + else if (sptr->offset == addr) /* sptr starts at reloc */ + { + asymbol *sym = *(*rptr)->sym_ptr_ptr; + asection *sec = sym->section; + + switch ((*rptr)->howto->type) + { + case ALPHA_R_IGNORE: + break; + + case ALPHA_R_REFLONG: + { + if (bfd_is_und_section (sym->section)) + { + int slen = strlen ((char *) sym->name); + char *hash; + + if (_bfd_vms_output_check (abfd, slen) < 0) + { + end_etir_record (abfd); + start_etir_record (abfd, + section->index, + vaddr, FALSE); + } + _bfd_vms_output_begin (abfd, + ETIR_S_C_STO_GBL_LW, + -1); + hash = (_bfd_vms_length_hash_symbol + (abfd, sym->name, EOBJ_S_C_SYMSIZ)); + _bfd_vms_output_counted (abfd, hash); + _bfd_vms_output_flush (abfd); + } + else if (bfd_is_abs_section (sym->section)) + { + if (_bfd_vms_output_check (abfd, 16) < 0) + { + end_etir_record (abfd); + start_etir_record (abfd, + section->index, + vaddr, FALSE); + } + _bfd_vms_output_begin (abfd, + ETIR_S_C_STA_LW, + -1); + _bfd_vms_output_quad (abfd, + (uquad) sym->value); + _bfd_vms_output_flush (abfd); + _bfd_vms_output_begin (abfd, + ETIR_S_C_STO_LW, + -1); + _bfd_vms_output_flush (abfd); + } + else + { + if (_bfd_vms_output_check (abfd, 32) < 0) + { + end_etir_record (abfd); + start_etir_record (abfd, + section->index, + vaddr, FALSE); + } + _bfd_vms_output_begin (abfd, + ETIR_S_C_STA_PQ, + -1); + _bfd_vms_output_long (abfd, + (unsigned long) (sec->index)); + _bfd_vms_output_quad (abfd, + ((uquad) (*rptr)->addend + + (uquad) sym->value)); + _bfd_vms_output_flush (abfd); + _bfd_vms_output_begin (abfd, + ETIR_S_C_STO_LW, + -1); + _bfd_vms_output_flush (abfd); + } + } + break; + + case ALPHA_R_REFQUAD: + { + if (bfd_is_und_section (sym->section)) + { + int slen = strlen ((char *) sym->name); + char *hash; + if (_bfd_vms_output_check (abfd, slen) < 0) + { + end_etir_record (abfd); + start_etir_record (abfd, + section->index, + vaddr, FALSE); + } + _bfd_vms_output_begin (abfd, + ETIR_S_C_STO_GBL, + -1); + hash = (_bfd_vms_length_hash_symbol + (abfd, sym->name, EOBJ_S_C_SYMSIZ)); + _bfd_vms_output_counted (abfd, hash); + _bfd_vms_output_flush (abfd); + } + else if (bfd_is_abs_section (sym->section)) + { + if (_bfd_vms_output_check (abfd, 16) < 0) + { + end_etir_record (abfd); + start_etir_record (abfd, + section->index, + vaddr, FALSE); + } + _bfd_vms_output_begin (abfd, + ETIR_S_C_STA_QW, + -1); + _bfd_vms_output_quad (abfd, + (uquad) sym->value); + _bfd_vms_output_flush (abfd); + _bfd_vms_output_begin (abfd, + ETIR_S_C_STO_QW, + -1); + _bfd_vms_output_flush (abfd); + } + else + { + if (_bfd_vms_output_check (abfd, 32) < 0) + { + end_etir_record (abfd); + start_etir_record (abfd, + section->index, + vaddr, FALSE); + } + _bfd_vms_output_begin (abfd, + ETIR_S_C_STA_PQ, + -1); + _bfd_vms_output_long (abfd, + (unsigned long) (sec->index)); + _bfd_vms_output_quad (abfd, + ((uquad) (*rptr)->addend + + (uquad) sym->value)); + _bfd_vms_output_flush (abfd); + _bfd_vms_output_begin (abfd, + ETIR_S_C_STO_OFF, + -1); + _bfd_vms_output_flush (abfd); + } + } + break; + + case ALPHA_R_HINT: + { + int hint_size; + char *hash ATTRIBUTE_UNUSED; + + hint_size = sptr->size; + sptr->size = len; + sto_imm (abfd, sptr, vaddr, section->index); + sptr->size = hint_size; +#if 0 + vms_output_begin (abfd, + ETIR_S_C_STO_HINT_GBL, -1); + vms_output_long (abfd, + (unsigned long) (sec->index)); + vms_output_quad (abfd, (uquad) addr); + + hash = (_bfd_vms_length_hash_symbol + (abfd, sym->name, EOBJ_S_C_SYMSIZ)); + vms_output_counted (abfd, hash); + + vms_output_flush (abfd); +#endif + } + break; + case ALPHA_R_LINKAGE: + { + char *hash; + + if (_bfd_vms_output_check (abfd, 64) < 0) + { + end_etir_record (abfd); + start_etir_record (abfd, section->index, + vaddr, FALSE); + } + _bfd_vms_output_begin (abfd, + ETIR_S_C_STC_LP_PSB, + -1); + _bfd_vms_output_long (abfd, + (unsigned long) PRIV (vms_linkage_index)); + PRIV (vms_linkage_index) += 2; + hash = (_bfd_vms_length_hash_symbol + (abfd, sym->name, EOBJ_S_C_SYMSIZ)); + _bfd_vms_output_counted (abfd, hash); + _bfd_vms_output_byte (abfd, 0); + _bfd_vms_output_flush (abfd); + } + break; + + case ALPHA_R_CODEADDR: + { + int slen = strlen ((char *) sym->name); + char *hash; + if (_bfd_vms_output_check (abfd, slen) < 0) + { + end_etir_record (abfd); + start_etir_record (abfd, + section->index, + vaddr, FALSE); + } + _bfd_vms_output_begin (abfd, + ETIR_S_C_STO_CA, + -1); + hash = (_bfd_vms_length_hash_symbol + (abfd, sym->name, EOBJ_S_C_SYMSIZ)); + _bfd_vms_output_counted (abfd, hash); + _bfd_vms_output_flush (abfd); + } + break; + + default: + (*_bfd_error_handler) (_("Unhandled relocation %s"), + (*rptr)->howto->name); + break; + } + + vaddr += len; + + if (len == sptr->size) + { + break; + } + else + { + sptr->contents += len; + sptr->offset += len; + sptr->size -= len; + i--; + rptr++; + } + } + else /* sptr starts after reloc */ + { + i--; /* check next reloc */ + rptr++; + } + + if (i==0) /* all reloc checked */ + { + if (sptr->size > 0) + { + /* dump rest */ + sto_imm (abfd, sptr, vaddr, section->index); + vaddr += sptr->size; + } + break; + } + } /* for (;;) */ + } /* if SEC_RELOC */ + else /* no relocs, just dump */ + { + sto_imm (abfd, sptr, vaddr, section->index); + vaddr += sptr->size; + } + + sptr = sptr->next; + + } /* while (sptr != 0) */ + + end_etir_record (abfd); + + } /* has_contents */ + + section = section->next; + } + + _bfd_vms_output_alignment (abfd, 2); + return 0; +} + +/* Write traceback data for bfd abfd. */ + +int +_bfd_vms_write_tbt (abfd, objtype) + bfd *abfd ATTRIBUTE_UNUSED; + int objtype ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + _bfd_vms_debug (2, "vms_write_tbt (%p, %d)\n", abfd, objtype); +#endif + + return 0; +} + +/* Write debug info for bfd abfd. */ + +int +_bfd_vms_write_dbg (abfd, objtype) + bfd *abfd ATTRIBUTE_UNUSED; + int objtype ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + _bfd_vms_debug (2, "vms_write_dbg (%p, objtype)\n", abfd, objtype); +#endif + + return 0; +} diff --git a/bfd/vms.c b/bfd/vms.c new file mode 100644 index 0000000000000..a55b94b0989f3 --- /dev/null +++ b/bfd/vms.c @@ -0,0 +1,1873 @@ +/* vms.c -- BFD back-end for VAX (openVMS/VAX) and + EVAX (openVMS/Alpha) files. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + Written by Klaus K"ampf (kkaempf@rmi.de) + +This program is free software; 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. */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" + +#include "vms.h" + +static bfd_boolean vms_initialize + PARAMS ((bfd *)); +static unsigned int priv_section_count; +static bfd_boolean fill_section_ptr + PARAMS ((struct bfd_hash_entry *, PTR)); +static bfd_boolean vms_fixup_sections + PARAMS ((bfd *)); +static bfd_boolean copy_symbols + PARAMS ((struct bfd_hash_entry *, PTR)); +static bfd_reloc_status_type reloc_nil + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static const struct bfd_target *vms_object_p + PARAMS ((bfd *abfd)); +static const struct bfd_target *vms_archive_p + PARAMS ((bfd *abfd)); +static bfd_boolean vms_mkobject + PARAMS ((bfd *abfd)); +static bfd_boolean vms_write_object_contents + PARAMS ((bfd *abfd)); +static bfd_boolean vms_close_and_cleanup + PARAMS ((bfd *abfd)); +static bfd_boolean vms_bfd_free_cached_info + PARAMS ((bfd *abfd)); +static bfd_boolean vms_new_section_hook + PARAMS ((bfd *abfd, asection *section)); +static bfd_boolean vms_get_section_contents + PARAMS ((bfd *abfd, asection *section, PTR x1, file_ptr x2, + bfd_size_type x3)); +static bfd_boolean vms_get_section_contents_in_window + PARAMS ((bfd *abfd, asection *section, bfd_window *w, file_ptr offset, + bfd_size_type count)); +static bfd_boolean vms_bfd_copy_private_bfd_data + PARAMS ((bfd *src, bfd *dest)); +static bfd_boolean vms_bfd_copy_private_section_data + PARAMS ((bfd *srcbfd, asection *srcsec, bfd *dstbfd, asection *dstsec)); +static bfd_boolean vms_bfd_copy_private_symbol_data + PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym)); +static bfd_boolean vms_bfd_print_private_bfd_data + PARAMS ((bfd *abfd, void *file)); +static char *vms_core_file_failing_command + PARAMS ((bfd *abfd)); +static int vms_core_file_failing_signal + PARAMS ((bfd *abfd)); +static bfd_boolean vms_core_file_matches_executable_p + PARAMS ((bfd *abfd, bfd *bbfd)); +static bfd_boolean vms_slurp_armap + PARAMS ((bfd *abfd)); +static bfd_boolean vms_slurp_extended_name_table + PARAMS ((bfd *abfd)); +static bfd_boolean vms_construct_extended_name_table + PARAMS ((bfd *abfd, char **tabloc, bfd_size_type *tablen, + const char **name)); +static void vms_truncate_arname + PARAMS ((bfd *abfd, const char *pathname, char *arhdr)); +static bfd_boolean vms_write_armap + PARAMS ((bfd *arch, unsigned int elength, struct orl *map, + unsigned int orl_count, int stridx)); +static PTR vms_read_ar_hdr + PARAMS ((bfd *abfd)); +static bfd *vms_get_elt_at_index + PARAMS ((bfd *abfd, symindex index)); +static bfd *vms_openr_next_archived_file + PARAMS ((bfd *arch, bfd *prev)); +static bfd_boolean vms_update_armap_timestamp + PARAMS ((bfd *abfd)); +static int vms_generic_stat_arch_elt + PARAMS ((bfd *, struct stat *)); +static long vms_get_symtab_upper_bound + PARAMS ((bfd *abfd)); +static long vms_canonicalize_symtab + PARAMS ((bfd *abfd, asymbol **symbols)); +static void vms_print_symbol + PARAMS ((bfd *abfd, PTR file, asymbol *symbol, bfd_print_symbol_type how)); +static void vms_get_symbol_info + PARAMS ((bfd *abfd, asymbol *symbol, symbol_info *ret)); +static bfd_boolean vms_bfd_is_local_label_name + PARAMS ((bfd *abfd, const char *)); +static alent *vms_get_lineno + PARAMS ((bfd *abfd, asymbol *symbol)); +static bfd_boolean vms_find_nearest_line + PARAMS ((bfd *abfd, asection *section, asymbol **symbols, bfd_vma offset, + const char **file, const char **func, unsigned int *line)); +static asymbol *vms_bfd_make_debug_symbol + PARAMS ((bfd *abfd, void *ptr, unsigned long size)); +static long vms_read_minisymbols + PARAMS ((bfd *abfd, bfd_boolean dynamic, PTR *minisymsp, + unsigned int *sizep)); +static asymbol *vms_minisymbol_to_symbol + PARAMS ((bfd *abfd, bfd_boolean dynamic, const PTR minisym, asymbol *sym)); +static long vms_get_reloc_upper_bound + PARAMS ((bfd *abfd, asection *sect)); +static long vms_canonicalize_reloc + PARAMS ((bfd *abfd, asection *srcsec, arelent **location, + asymbol **symbols)); +static const struct reloc_howto_struct *vms_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static bfd_boolean vms_set_arch_mach + PARAMS ((bfd *abfd, enum bfd_architecture arch, unsigned long mach)); +static bfd_boolean vms_set_section_contents + PARAMS ((bfd *abfd, asection *section, const PTR location, file_ptr offset, + bfd_size_type count)); +static int vms_sizeof_headers + PARAMS ((bfd *abfd, bfd_boolean reloc)); +static bfd_byte *vms_bfd_get_relocated_section_contents + PARAMS ((bfd *abfd, struct bfd_link_info *link_info, + struct bfd_link_order *link_order, bfd_byte *data, + bfd_boolean relocatable, asymbol **symbols)); +static bfd_boolean vms_bfd_relax_section + PARAMS ((bfd *abfd, asection *section, struct bfd_link_info *link_info, + bfd_boolean *again)); +static bfd_boolean vms_bfd_gc_sections + PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); +static bfd_boolean vms_bfd_merge_sections + PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); +static struct bfd_link_hash_table *vms_bfd_link_hash_table_create + PARAMS ((bfd *abfd)); +static void vms_bfd_link_hash_table_free + PARAMS ((struct bfd_link_hash_table *hash)); +static bfd_boolean vms_bfd_link_add_symbols + PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); +static bfd_boolean vms_bfd_final_link + PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); +static bfd_boolean vms_bfd_link_split_section + PARAMS ((bfd *abfd, asection *section)); +static long vms_get_dynamic_symtab_upper_bound + PARAMS ((bfd *abfd)); +static long vms_canonicalize_dynamic_symtab + PARAMS ((bfd *abfd, asymbol **symbols)); +static long vms_get_dynamic_reloc_upper_bound + PARAMS ((bfd *abfd)); +static long vms_canonicalize_dynamic_reloc + PARAMS ((bfd *abfd, arelent **arel, asymbol **symbols)); +static bfd_boolean vms_bfd_merge_private_bfd_data + PARAMS ((bfd *ibfd, bfd *obfd)); +static bfd_boolean vms_bfd_set_private_flags + PARAMS ((bfd *abfd, flagword flags)); + +#define vms_make_empty_symbol _bfd_generic_make_empty_symbol +#define vms_bfd_link_just_syms _bfd_generic_link_just_syms +#define vms_bfd_discard_group bfd_generic_discard_group + +/*===========================================================================*/ + +const bfd_target vms_alpha_vec = +{ + "vms-alpha", /* name */ + bfd_target_evax_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_LITTLE, /* header byte order is little */ + + (HAS_RELOC | HAS_SYMS + | WP_TEXT | D_PAGED), /* object flags */ + (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_READONLY | SEC_CODE | SEC_DATA + | SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* sect flags */ + 0, /* symbol_leading_char */ + ' ', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, + + {_bfd_dummy_target, vms_object_p, /* bfd_check_format */ + vms_archive_p, _bfd_dummy_target}, + {bfd_false, vms_mkobject, /* bfd_set_format */ + _bfd_generic_mkarchive, bfd_false}, + {bfd_false, vms_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (vms), + BFD_JUMP_TABLE_COPY (vms), + BFD_JUMP_TABLE_CORE (vms), + BFD_JUMP_TABLE_ARCHIVE (vms), + BFD_JUMP_TABLE_SYMBOLS (vms), + BFD_JUMP_TABLE_RELOCS (vms), + BFD_JUMP_TABLE_WRITE (vms), + BFD_JUMP_TABLE_LINK (vms), + BFD_JUMP_TABLE_DYNAMIC (vms), + + NULL, + + (PTR) 0 +}; + +const bfd_target vms_vax_vec = +{ + "vms-vax", /* name */ + bfd_target_ovax_flavour, + BFD_ENDIAN_LITTLE, /* data byte order is little */ + BFD_ENDIAN_LITTLE, /* header byte order is little */ + + (HAS_RELOC | HAS_SYMS /* object flags */ + | WP_TEXT | D_PAGED + | HAS_LINENO | HAS_DEBUG | HAS_LOCALS), + + (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_READONLY | SEC_CODE | SEC_DATA + | SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* sect flags */ + 0, /* symbol_leading_char */ + ' ', /* ar_pad_char */ + 15, /* ar_max_namelen */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ + + {_bfd_dummy_target, vms_object_p, /* bfd_check_format */ + vms_archive_p, _bfd_dummy_target}, + {bfd_false, vms_mkobject, /* bfd_set_format */ + _bfd_generic_mkarchive, bfd_false}, + {bfd_false, vms_write_object_contents, /* bfd_write_contents */ + _bfd_write_archive_contents, bfd_false}, + + BFD_JUMP_TABLE_GENERIC (vms), + BFD_JUMP_TABLE_COPY (vms), + BFD_JUMP_TABLE_CORE (vms), + BFD_JUMP_TABLE_ARCHIVE (vms), + BFD_JUMP_TABLE_SYMBOLS (vms), + BFD_JUMP_TABLE_RELOCS (vms), + BFD_JUMP_TABLE_WRITE (vms), + BFD_JUMP_TABLE_LINK (vms), + BFD_JUMP_TABLE_DYNAMIC (vms), + + NULL, + + (PTR) 0 +}; + +/*===========================================================================*/ + +/* Initialize private data */ + +static bfd_boolean +vms_initialize (abfd) + bfd *abfd; +{ + int i; + bfd_size_type amt; + + bfd_set_start_address (abfd, (bfd_vma) -1); + + amt = sizeof (struct vms_private_data_struct); + abfd->tdata.any = (struct vms_private_data_struct*) bfd_alloc (abfd, amt); + if (abfd->tdata.any == 0) + return FALSE; + +#ifdef __ALPHA + PRIV (is_vax) = 0; +#else + PRIV (is_vax) = 1; +#endif + PRIV (vms_buf) = 0; + PRIV (buf_size) = 0; + PRIV (rec_length) = 0; + PRIV (file_format) = FF_UNKNOWN; + PRIV (fixup_done) = FALSE; + PRIV (sections) = NULL; + + amt = sizeof (struct stack_struct) * STACKSIZE; + PRIV (stack) = (struct stack_struct *) bfd_alloc (abfd, amt); + if (PRIV (stack) == 0) + goto error_ret1; + PRIV (stackptr) = 0; + + amt = sizeof (struct bfd_hash_table); + PRIV (vms_symbol_table) = (struct bfd_hash_table *) bfd_alloc (abfd, amt); + if (PRIV (vms_symbol_table) == 0) + goto error_ret1; + + if (!bfd_hash_table_init (PRIV (vms_symbol_table), _bfd_vms_hash_newfunc)) + goto error_ret1; + + amt = sizeof (struct location_struct) * LOCATION_SAVE_SIZE; + PRIV (location_stack) = (struct location_struct *) bfd_alloc (abfd, amt); + if (PRIV (location_stack) == 0) + goto error_ret2; + + for (i = 0; i < VMS_SECTION_COUNT; i++) + PRIV (vms_section_table)[i] = NULL; + + amt = MAX_OUTREC_SIZE; + PRIV (output_buf) = (unsigned char *) bfd_alloc (abfd, amt); + if (PRIV (output_buf) == 0) + goto error_ret2; + + PRIV (push_level) = 0; + PRIV (pushed_size) = 0; + PRIV (length_pos) = 2; + PRIV (output_size) = 0; + PRIV (output_alignment) = 1; + + return TRUE; + + error_ret2: + bfd_hash_table_free (PRIV (vms_symbol_table)); + error_ret1: + bfd_release (abfd, abfd->tdata.any); + abfd->tdata.any = 0; + return FALSE; +} + +/* Fill symbol->section with section ptr + symbol->section is filled with the section index for defined symbols + during reading the GSD/EGSD section. But we need the pointer to the + bfd section later. + + It has the correct value for referenced (undefined section) symbols + + called from bfd_hash_traverse in vms_fixup_sections */ + +static bfd_boolean +fill_section_ptr (entry, sections) + struct bfd_hash_entry *entry; + PTR sections; +{ + asection *sec; + asymbol *sym; + + sym = ((vms_symbol_entry *)entry)->symbol; + sec = sym->section; + +#if VMS_DEBUG + vms_debug (6, "fill_section_ptr: sym %p, sec %p\n", sym, sec); +#endif + + /* fill forward references (these contain section number, not section ptr). */ + + if ((unsigned int) sec < priv_section_count) + { + sec = ((vms_symbol_entry *)entry)->symbol->section = + ((asection **)sections)[(int)sec]; + } + + if (strcmp (sym->name, sec->name) == 0) + sym->flags |= BSF_SECTION_SYM; + + return TRUE; +} + +/* Fixup sections + set up all pointers and arrays, counters and sizes are fixed now + + we build a private sections vector for easy access since sections + are always referenced by an index number. + + alloc PRIV(sections) according to abfd->section_count + copy abfd->sections to PRIV(sections) */ + +static bfd_boolean +vms_fixup_sections (abfd) + bfd *abfd; +{ + if (PRIV (fixup_done)) + return TRUE; + + /* + * traverse symbol table and fill in all section pointers + */ + + /* can't provide section count as argument to fill_section_ptr(). */ + priv_section_count = PRIV (section_count); + bfd_hash_traverse (PRIV (vms_symbol_table), fill_section_ptr, + (PTR) (PRIV (sections))); + + PRIV (fixup_done) = TRUE; + + return TRUE; +} + +/*===========================================================================*/ + +/* Check the format for a file being read. + Return a (bfd_target *) if it's an object file or zero if not. */ + +static const struct bfd_target * +vms_object_p (abfd) + bfd *abfd; +{ + int err = 0; + int prev_type; + const struct bfd_target *target_vector = 0; + const bfd_arch_info_type *arch = 0; + PTR tdata_save = abfd->tdata.any; + bfd_vma saddr_save = bfd_get_start_address (abfd); + +#if VMS_DEBUG + vms_debug (1, "vms_object_p(%p)\n", abfd); +#endif + + if (!vms_initialize (abfd)) + goto error_ret; + + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET)) + goto err_wrong_format; + + prev_type = -1; + + do + { +#if VMS_DEBUG + vms_debug (7, "reading at %08lx\n", bfd_tell(abfd)); +#endif + if (_bfd_vms_next_record (abfd) < 0) + { +#if VMS_DEBUG + vms_debug (2, "next_record failed\n"); +#endif + goto err_wrong_format; + } + + if ((prev_type == EOBJ_S_C_EGSD) + && (PRIV (rec_type) != EOBJ_S_C_EGSD)) + { + if (! vms_fixup_sections (abfd)) + { +#if VMS_DEBUG + vms_debug (2, "vms_fixup_sections failed\n"); +#endif + goto err_wrong_format; + } + } + + prev_type = PRIV (rec_type); + + if (target_vector == 0) + { + if (prev_type <= OBJ_S_C_MAXRECTYP) + target_vector = &vms_vax_vec; + else + target_vector = &vms_alpha_vec; + } + + switch (prev_type) + { + case OBJ_S_C_HDR: + case EOBJ_S_C_EMH: + err = _bfd_vms_slurp_hdr (abfd, prev_type); + break; + case OBJ_S_C_EOM: + case OBJ_S_C_EOMW: + case EOBJ_S_C_EEOM: + err = _bfd_vms_slurp_eom (abfd, prev_type); + break; + case OBJ_S_C_GSD: + case EOBJ_S_C_EGSD: + err = _bfd_vms_slurp_gsd (abfd, prev_type); + break; + case OBJ_S_C_TIR: + case EOBJ_S_C_ETIR: + err = _bfd_vms_slurp_tir (abfd, prev_type); + break; + case OBJ_S_C_DBG: + case EOBJ_S_C_EDBG: + err = _bfd_vms_slurp_dbg (abfd, prev_type); + break; + case OBJ_S_C_TBT: + case EOBJ_S_C_ETBT: + err = _bfd_vms_slurp_tbt (abfd, prev_type); + break; + case OBJ_S_C_LNK: + err = _bfd_vms_slurp_lnk (abfd, prev_type); + break; + default: + err = -1; + } + if (err != 0) + { +#if VMS_DEBUG + vms_debug (2, "slurp type %d failed with %d\n", prev_type, err); +#endif + goto err_wrong_format; + } + } + while ((prev_type != EOBJ_S_C_EEOM) && (prev_type != OBJ_S_C_EOM) && (prev_type != OBJ_S_C_EOMW)); + + if (target_vector == &vms_vax_vec) + { + if (! vms_fixup_sections (abfd)) + { +#if VMS_DEBUG + vms_debug (2, "vms_fixup_sections failed\n"); +#endif + goto err_wrong_format; + } + + /* set arch_info to vax */ + + arch = bfd_scan_arch ("vax"); + PRIV (is_vax) = 1; +#if VMS_DEBUG + vms_debug (2, "arch is vax\n"); +#endif + } + else if (target_vector == &vms_alpha_vec) + { + /* set arch_info to alpha */ + + arch = bfd_scan_arch ("alpha"); + PRIV (is_vax) = 0; +#if VMS_DEBUG + vms_debug (2, "arch is alpha\n"); +#endif + } + + if (arch == 0) + { +#if VMS_DEBUG + vms_debug (2, "arch not found\n"); +#endif + goto err_wrong_format; + } + abfd->arch_info = arch; + + return target_vector; + + err_wrong_format: + bfd_set_error (bfd_error_wrong_format); + error_ret: + if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL) + bfd_release (abfd, abfd->tdata.any); + abfd->tdata.any = tdata_save; + bfd_set_start_address (abfd, saddr_save); + return NULL; +} + +/* Check the format for a file being read. + Return a (bfd_target *) if it's an archive file or zero. */ + +static const struct bfd_target * +vms_archive_p (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_archive_p(%p)\n", abfd); +#endif + + return 0; +} + +/* Set the format of a file being written. */ + +static bfd_boolean +vms_mkobject (abfd) + bfd *abfd; +{ +#if VMS_DEBUG + vms_debug (1, "vms_mkobject(%p)\n", abfd); +#endif + + if (!vms_initialize (abfd)) + return 0; + + { +#ifdef __VAX + const bfd_arch_info_type *arch = bfd_scan_arch ("vax"); +#else + const bfd_arch_info_type *arch = bfd_scan_arch ("alpha"); +#endif + if (arch == 0) + { + bfd_set_error(bfd_error_wrong_format); + return 0; + } + abfd->arch_info = arch; + } + + return TRUE; +} + +/* Write cached information into a file being written, at bfd_close. */ + +static bfd_boolean +vms_write_object_contents (abfd) + bfd *abfd; +{ +#if VMS_DEBUG + vms_debug (1, "vms_write_object_contents(%p)\n", abfd); +#endif + + if (abfd->section_count > 0) /* we have sections */ + { + if (PRIV (is_vax)) + { + if (_bfd_vms_write_hdr (abfd, OBJ_S_C_HDR) != 0) + return FALSE; + if (_bfd_vms_write_gsd (abfd, OBJ_S_C_GSD) != 0) + return FALSE; + if (_bfd_vms_write_tir (abfd, OBJ_S_C_TIR) != 0) + return FALSE; + if (_bfd_vms_write_tbt (abfd, OBJ_S_C_TBT) != 0) + return FALSE; + if (_bfd_vms_write_dbg (abfd, OBJ_S_C_DBG) != 0) + return FALSE; + if (abfd->section_count > 255) + { + if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOMW) != 0) + return FALSE; + } + else + { + if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOM) != 0) + return FALSE; + } + } + else + { + if (_bfd_vms_write_hdr (abfd, EOBJ_S_C_EMH) != 0) + return FALSE; + if (_bfd_vms_write_gsd (abfd, EOBJ_S_C_EGSD) != 0) + return FALSE; + if (_bfd_vms_write_tir (abfd, EOBJ_S_C_ETIR) != 0) + return FALSE; + if (_bfd_vms_write_tbt (abfd, EOBJ_S_C_ETBT) != 0) + return FALSE; + if (_bfd_vms_write_dbg (abfd, EOBJ_S_C_EDBG) != 0) + return FALSE; + if (_bfd_vms_write_eom (abfd, EOBJ_S_C_EEOM) != 0) + return FALSE; + } + } + return TRUE; +} + +/*-- 4.1, generic -----------------------------------------------------------*/ + +/* Called when the BFD is being closed to do any necessary cleanup. */ + +static bfd_boolean +vms_close_and_cleanup (abfd) + bfd *abfd; +{ +#if VMS_DEBUG + vms_debug (1, "vms_close_and_cleanup(%p)\n", abfd); +#endif + if (abfd == 0) + return TRUE; + + if (PRIV (vms_buf) != NULL) + free (PRIV (vms_buf)); + + if (PRIV (sections) != NULL) + free (PRIV (sections)); + + if (PRIV (vms_symbol_table)) + bfd_hash_table_free (PRIV (vms_symbol_table)); + + bfd_release (abfd, abfd->tdata.any); + abfd->tdata.any = NULL; + + return TRUE; +} + +/* Ask the BFD to free all cached information. */ +static bfd_boolean +vms_bfd_free_cached_info (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_free_cached_info(%p)\n", abfd); +#endif + return TRUE; +} + +/* Called when a new section is created. */ + +static bfd_boolean +vms_new_section_hook (abfd, section) + bfd *abfd; + asection *section; +{ + /* Count hasn't been incremented yet. */ + unsigned int section_count = abfd->section_count + 1; + +#if VMS_DEBUG + vms_debug (1, "vms_new_section_hook (%p, [%d]%s), count %d\n", + abfd, section->index, section->name, section_count); +#endif + bfd_set_section_alignment (abfd, section, 4); + + if (section_count > PRIV (section_count)) + { + bfd_size_type amt = section_count; + amt *= sizeof (asection *); + PRIV (sections) = (asection **) bfd_realloc (PRIV (sections), amt); + if (PRIV (sections) == 0) + return FALSE; + PRIV (section_count) = section_count; + } +#if VMS_DEBUG + vms_debug (6, "section_count: %d\n", PRIV (section_count)); +#endif + PRIV (sections)[section->index] = section; +#if VMS_DEBUG + vms_debug (7, "%d: %s\n", section->index, section->name); +#endif + + return TRUE; +} + +/* Read the contents of a section. + buf points to a buffer of buf_size bytes to be filled with + section data (starting at offset into section) */ + +static bfd_boolean +vms_get_section_contents (abfd, section, buf, offset, buf_size) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section ATTRIBUTE_UNUSED; + PTR buf ATTRIBUTE_UNUSED; + file_ptr offset ATTRIBUTE_UNUSED; + bfd_size_type buf_size ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_get_section_contents(%p, %s, %p, off %ld, size %d)\n", + abfd, section->name, buf, offset, (int)buf_size); +#endif + + /* shouldn't be called, since all sections are IN_MEMORY */ + + return FALSE; +} + +/* Read the contents of a section. + buf points to a buffer of buf_size bytes to be filled with + section data (starting at offset into section) */ + +static bfd_boolean +vms_get_section_contents_in_window (abfd, section, w, offset, count) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section ATTRIBUTE_UNUSED; + bfd_window *w ATTRIBUTE_UNUSED; + file_ptr offset ATTRIBUTE_UNUSED; + bfd_size_type count ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_get_section_contents_in_window(%p, %s, %p, off %ld, count %d)\n", + abfd, section->name, w, offset, (int)count); +#endif + + /* shouldn't be called, since all sections are IN_MEMORY */ + + return FALSE; +} + +/*-- Part 4.2, copy private data --------------------------------------------*/ + +/* Called to copy BFD general private data from one object file + to another. */ + +static bfd_boolean +vms_bfd_copy_private_bfd_data (src, dest) + bfd *src ATTRIBUTE_UNUSED; + bfd *dest ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_copy_private_bfd_data(%p, %p)\n", src, dest); +#endif + return TRUE; +} + +/* Merge private BFD information from the BFD @var{ibfd} to the + the output file BFD @var{obfd} when linking. Return <> + on success, <> on error. Possible error returns are: + + o <> - + Not enough memory exists to create private data for @var{obfd}. */ + +static bfd_boolean +vms_bfd_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd ATTRIBUTE_UNUSED; + bfd *obfd ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1,"vms_bfd_merge_private_bfd_data(%p, %p)\n", ibfd, obfd); +#endif + return TRUE; +} + +/* Set private BFD flag information in the BFD @var{abfd}. + Return <> on success, <> on error. Possible error + returns are: + + o <> - + Not enough memory exists to create private data for @var{obfd}. */ + +static bfd_boolean +vms_bfd_set_private_flags (abfd, flags) + bfd *abfd ATTRIBUTE_UNUSED; + flagword flags ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1,"vms_bfd_set_private_flags(%p, %lx)\n", abfd, (long)flags); +#endif + return TRUE; +} + +/* Called to copy BFD private section data from one object file + to another. */ + +static bfd_boolean +vms_bfd_copy_private_section_data (srcbfd, srcsec, dstbfd, dstsec) + bfd *srcbfd ATTRIBUTE_UNUSED; + asection *srcsec ATTRIBUTE_UNUSED; + bfd *dstbfd ATTRIBUTE_UNUSED; + asection *dstsec ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_copy_private_section_data(%p, %s, %p, %s)\n", + srcbfd, srcsec->name, dstbfd, dstsec->name); +#endif + return TRUE; +} + +/* Called to copy BFD private symbol data from one object file + to another. */ + +static bfd_boolean +vms_bfd_copy_private_symbol_data (ibfd, isym, obfd, osym) + bfd *ibfd ATTRIBUTE_UNUSED; + asymbol *isym ATTRIBUTE_UNUSED; + bfd *obfd ATTRIBUTE_UNUSED; + asymbol *osym ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_copy_private_symbol_data(%p, %s, %p, %s)\n", + ibfd, isym->name, obfd, osym->name); +#endif + return TRUE; +} + +/*-- Part 4.3, core file ----------------------------------------------------*/ + +/* Return a read-only string explaining which program was running + when it failed and produced the core file abfd. */ + +static char * +vms_core_file_failing_command (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_core_file_failing_command(%p)\n", abfd); +#endif + return 0; +} + +/* Returns the signal number which caused the core dump which + generated the file the BFD abfd is attached to. */ + +static int +vms_core_file_failing_signal (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_core_file_failing_signal(%p)\n", abfd); +#endif + return 0; +} + +/* Return TRUE if the core file attached to core_bfd was generated + by a run of the executable file attached to exec_bfd, FALSE otherwise. */ + +static bfd_boolean +vms_core_file_matches_executable_p (abfd, bbfd) + bfd *abfd ATTRIBUTE_UNUSED; + bfd *bbfd ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_core_file_matches_executable_p(%p, %p)\n", abfd, bbfd); +#endif + return FALSE; +} + +/*-- Part 4.4, archive ------------------------------------------------------*/ + +/* ??? do something with an archive map. + Return FALSE on error, TRUE otherwise. */ + +static bfd_boolean +vms_slurp_armap (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_slurp_armap(%p)\n", abfd); +#endif + return FALSE; +} + +/* ??? do something with an extended name table. + Return FALSE on error, TRUE otherwise. */ + +static bfd_boolean +vms_slurp_extended_name_table (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_slurp_extended_name_table(%p)\n", abfd); +#endif + return FALSE; +} + +/* ??? do something with an extended name table. + Return FALSE on error, TRUE otherwise. */ + +static bfd_boolean +vms_construct_extended_name_table (abfd, tabloc, tablen, name) + bfd *abfd ATTRIBUTE_UNUSED; + char **tabloc ATTRIBUTE_UNUSED; + bfd_size_type *tablen ATTRIBUTE_UNUSED; + const char **name ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_construct_extended_name_table(%p)\n", abfd); +#endif + return FALSE; +} + +/* Truncate the name of an archive to match system-dependent restrictions */ + +static void +vms_truncate_arname (abfd, pathname, arhdr) + bfd *abfd ATTRIBUTE_UNUSED; + const char *pathname ATTRIBUTE_UNUSED; + char *arhdr ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_truncate_arname(%p, %s, %s)\n", abfd, pathname, arhdr); +#endif + return; +} + +/* ??? write archive map */ + +static bfd_boolean +vms_write_armap (arch, elength, map, orl_count, stridx) + bfd *arch ATTRIBUTE_UNUSED; + unsigned int elength ATTRIBUTE_UNUSED; + struct orl *map ATTRIBUTE_UNUSED; + unsigned int orl_count ATTRIBUTE_UNUSED; + int stridx ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_write_armap(%p, %d, %p, %d %d)\n", + arch, elength, map, orl_count, stridx); +#endif + return TRUE; +} + +/* Read archive header ??? */ + +static PTR +vms_read_ar_hdr (abfd) + bfd * abfd ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_read_ar_hdr(%p)\n", abfd); +#endif + return (PTR)0; +} + +/* Provided a BFD, @var{archive}, containing an archive and NULL, open + an input BFD on the first contained element and returns that. + Subsequent calls should pass the archive and the previous return value + to return a created BFD to the next contained element. + NULL is returned when there are no more. */ + +static bfd * +vms_openr_next_archived_file (arch, prev) + bfd *arch ATTRIBUTE_UNUSED; + bfd *prev ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_openr_next_archived_file(%p, %p)\n", arch, prev); +#endif + return NULL; +} + +/* Return the BFD which is referenced by the symbol in ABFD indexed by + INDEX. INDEX should have been returned by bfd_get_next_mapent. */ + +static bfd * +vms_get_elt_at_index (abfd, index) + bfd *abfd; + symindex index; +{ +#if VMS_DEBUG + vms_debug (1, "vms_get_elt_at_index(%p, %p)\n", abfd, index); +#endif + return _bfd_generic_get_elt_at_index(abfd, index); +} + +/* ??? + -> bfd_generic_stat_arch_elt */ + +static int +vms_generic_stat_arch_elt (abfd, st) + bfd *abfd; + struct stat *st; +{ +#if VMS_DEBUG + vms_debug (1, "vms_generic_stat_arch_elt(%p, %p)\n", abfd, st); +#endif + return bfd_generic_stat_arch_elt (abfd, st); +} + +/* This is a new function in bfd 2.5 */ + +static bfd_boolean +vms_update_armap_timestamp (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_update_armap_timestamp(%p)\n", abfd); +#endif + return TRUE; +} + +/*-- Part 4.5, symbols --------------------------------------------------------*/ + +/* Return the number of bytes required to store a vector of pointers + to asymbols for all the symbols in the BFD abfd, including a + terminal NULL pointer. If there are no symbols in the BFD, + then return 0. If an error occurs, return -1. */ + +static long +vms_get_symtab_upper_bound (abfd) + bfd *abfd; +{ +#if VMS_DEBUG + vms_debug (1, "vms_get_symtab_upper_bound(%p), %d symbols\n", abfd, PRIV (gsd_sym_count)); +#endif + return (PRIV (gsd_sym_count)+1) * sizeof (asymbol *); +} + +/* Copy symbols from hash table to symbol vector + + called from bfd_hash_traverse in vms_canonicalize_symtab + init counter to 0 if entry == 0 */ + +static bfd_boolean +copy_symbols (entry, arg) + struct bfd_hash_entry *entry; + PTR arg; +{ + bfd *abfd = (bfd *) arg; + + if (entry == NULL) /* init counter */ + PRIV (symnum) = 0; + else /* fill vector, inc counter */ + PRIV (symcache)[PRIV (symnum)++] = ((vms_symbol_entry *)entry)->symbol; + + return TRUE; +} + +/* Read the symbols from the BFD abfd, and fills in the vector + location with pointers to the symbols and a trailing NULL. + + return # of symbols read */ + +static long +vms_canonicalize_symtab (abfd, symbols) + bfd *abfd; + asymbol **symbols; +{ +#if VMS_DEBUG + vms_debug (1, "vms_canonicalize_symtab(%p, )\n", abfd); +#endif + + /* init counter */ + (void)copy_symbols((struct bfd_hash_entry *)0, abfd); + + /* traverse table and fill symbols vector */ + + PRIV (symcache) = symbols; + bfd_hash_traverse(PRIV (vms_symbol_table), copy_symbols, (PTR)abfd); + + symbols[PRIV (gsd_sym_count)] = NULL; + + return PRIV (gsd_sym_count); +} + +/* Print symbol to file according to how. how is one of + bfd_print_symbol_name just print the name + bfd_print_symbol_more print more (???) + bfd_print_symbol_all print all we know, which is not much right now :-) */ + +static void +vms_print_symbol (abfd, file, symbol, how) + bfd *abfd; + PTR file; + asymbol *symbol; + bfd_print_symbol_type how; +{ +#if VMS_DEBUG + vms_debug (1, "vms_print_symbol(%p, %p, %p, %d)\n", abfd, file, symbol, how); +#endif + + switch (how) + { + case bfd_print_symbol_name: + case bfd_print_symbol_more: + fprintf ((FILE *)file," %s", symbol->name); + break; + + case bfd_print_symbol_all: + { + const char *section_name = symbol->section->name; + + bfd_print_symbol_vandf (abfd, (PTR)file, symbol); + + fprintf ((FILE *)file," %-8s %s", section_name, symbol->name); + } + break; + } + return; +} + +/* Return information about symbol in ret. + + fill type, value and name + type: + A absolute + B bss segment symbol + C common symbol + D data segment symbol + f filename + t a static function symbol + T text segment symbol + U undefined + - debug */ + +static void +vms_get_symbol_info (abfd, symbol, ret) + bfd *abfd ATTRIBUTE_UNUSED; + asymbol *symbol; + symbol_info *ret; +{ + asection *sec; + +#if VMS_DEBUG + vms_debug (1, "vms_get_symbol_info(%p, %p, %p)\n", abfd, symbol, ret); +#endif + + sec = symbol->section; + + if (ret == 0) + return; + + if (bfd_is_com_section (sec)) + ret->type = 'C'; + else if (bfd_is_abs_section (sec)) + ret->type = 'A'; + else if (bfd_is_und_section (sec)) + ret->type = 'U'; + else if (bfd_is_ind_section (sec)) + ret->type = 'I'; + else if (bfd_get_section_flags (abfd, sec) & SEC_CODE) + ret->type = 'T'; + else if (bfd_get_section_flags (abfd, sec) & SEC_DATA) + ret->type = 'D'; + else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + ret->type = 'B'; + else + ret->type = '-'; + + if (ret->type != 'U') + ret->value = symbol->value + symbol->section->vma; + else + ret->value = 0; + ret->name = symbol->name; + + return; +} + +/* Return TRUE if the given symbol sym in the BFD abfd is + a compiler generated local label, else return FALSE. */ + +static bfd_boolean +vms_bfd_is_local_label_name (abfd, name) + bfd *abfd ATTRIBUTE_UNUSED; + const char *name; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_is_local_label_name(%p, %s)\n", abfd, name); +#endif + return name[0] == '$'; +} + +/* Get source line number for symbol */ + +static alent * +vms_get_lineno (abfd, symbol) + bfd *abfd ATTRIBUTE_UNUSED; + asymbol *symbol ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_get_lineno(%p, %p)\n", abfd, symbol); +#endif + return 0; +} + +/* Provided a BFD, a section and an offset into the section, calculate and + return the name of the source file and the line nearest to the wanted + location. */ + +static bfd_boolean +vms_find_nearest_line (abfd, section, symbols, offset, file, func, line) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section ATTRIBUTE_UNUSED; + asymbol **symbols ATTRIBUTE_UNUSED; + bfd_vma offset ATTRIBUTE_UNUSED; + const char **file ATTRIBUTE_UNUSED; + const char **func ATTRIBUTE_UNUSED; + unsigned int *line ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_find_nearest_line(%p, %s, %p, %ld, , , )\n", + abfd, section->name, symbols, (long int)offset); +#endif + return FALSE; +} + +/* Back-door to allow format-aware applications to create debug symbols + while using BFD for everything else. Currently used by the assembler + when creating COFF files. */ + +static asymbol * +vms_bfd_make_debug_symbol (abfd, ptr, size) + bfd *abfd ATTRIBUTE_UNUSED; + void *ptr ATTRIBUTE_UNUSED; + unsigned long size ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_make_debug_symbol(%p, %p, %ld)\n", abfd, ptr, size); +#endif + return 0; +} + +/* Read minisymbols. For minisymbols, we use the unmodified a.out + symbols. The minisymbol_to_symbol function translates these into + BFD asymbol structures. */ + +static long +vms_read_minisymbols (abfd, dynamic, minisymsp, sizep) + bfd *abfd; + bfd_boolean dynamic; + PTR *minisymsp; + unsigned int *sizep; +{ +#if VMS_DEBUG + vms_debug (1, "vms_read_minisymbols(%p, %d, %p, %d)\n", abfd, dynamic, minisymsp, *sizep); +#endif + return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep); +} + +/* Convert a minisymbol to a BFD asymbol. A minisymbol is just an + unmodified a.out symbol. The SYM argument is a structure returned + by bfd_make_empty_symbol, which we fill in here. */ + +static asymbol * +vms_minisymbol_to_symbol (abfd, dynamic, minisym, sym) + bfd *abfd; + bfd_boolean dynamic; + const PTR minisym; + asymbol *sym; +{ +#if VMS_DEBUG + vms_debug (1, "vms_minisymbol_to_symbol(%p, %d, %p, %p)\n", abfd, dynamic, minisym, sym); +#endif + return _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym); +} + +/*-- Part 4.6, relocations --------------------------------------------------*/ + +/* Return the number of bytes required to store the relocation information + associated with section sect attached to bfd abfd. + If an error occurs, return -1. */ + +static long +vms_get_reloc_upper_bound (abfd, section) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_get_reloc_upper_bound(%p, %s)\n", abfd, section->name); +#endif + return -1L; +} + +/* Call the back end associated with the open BFD abfd and translate the + external form of the relocation information attached to sec into the + internal canonical form. Place the table into memory at loc, which has + been preallocated, usually by a call to bfd_get_reloc_upper_bound. + Returns the number of relocs, or -1 on error. */ + +static long +vms_canonicalize_reloc (abfd, section, location, symbols) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section ATTRIBUTE_UNUSED; + arelent **location ATTRIBUTE_UNUSED; + asymbol **symbols ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_canonicalize_reloc(%p, %s, , )\n", abfd, section->name); +#endif + return FALSE; +} + +/*---------------------------------------------------------------------------*/ +/* this is just copied from ecoff-alpha, needs to be fixed probably */ + +/* How to process the various reloc types. */ + +static bfd_reloc_status_type +reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *reloc ATTRIBUTE_UNUSED; + asymbol *sym ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + bfd *output_bfd ATTRIBUTE_UNUSED; + char **error_message ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "reloc_nil(abfd %p, output_bfd %p)\n", abfd, output_bfd); + vms_debug (2, "In section %s, symbol %s\n", + sec->name, sym->name); + vms_debug (2, "reloc sym %s, addr %08lx, addend %08lx, reloc is a %s\n", + reloc->sym_ptr_ptr[0]->name, + (unsigned long)reloc->address, + (unsigned long)reloc->addend, reloc->howto->name); + vms_debug (2, "data at %p\n", data); +/* _bfd_hexdump (2, data, bfd_get_reloc_size(reloc->howto),0); */ +#endif + + return bfd_reloc_ok; +} + +/* In case we're on a 32-bit machine, construct a 64-bit "-1" value + from smaller values. Start with zero, widen, *then* decrement. */ +#define MINUS_ONE (((bfd_vma)0) - 1) + +static reloc_howto_type alpha_howto_table[] = +{ + HOWTO (ALPHA_R_IGNORE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + reloc_nil, /* special_function */ + "IGNORE", /* name */ + TRUE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* A 64 bit reference to a symbol. */ + HOWTO (ALPHA_R_REFQUAD, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + reloc_nil, /* special_function */ + "REFQUAD", /* name */ + TRUE, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 21 bit branch. The native assembler generates these for + branches within the text segment, and also fills in the PC + relative offset in the instruction. */ + HOWTO (ALPHA_R_BRADDR, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 21, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + reloc_nil, /* special_function */ + "BRADDR", /* name */ + TRUE, /* partial_inplace */ + 0x1fffff, /* src_mask */ + 0x1fffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A hint for a jump to a register. */ + HOWTO (ALPHA_R_HINT, /* type */ + 2, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 14, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + reloc_nil, /* special_function */ + "HINT", /* name */ + TRUE, /* partial_inplace */ + 0x3fff, /* src_mask */ + 0x3fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16 bit PC relative offset. */ + HOWTO (ALPHA_R_SREL16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + reloc_nil, /* special_function */ + "SREL16", /* name */ + TRUE, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 32 bit PC relative offset. */ + HOWTO (ALPHA_R_SREL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + reloc_nil, /* special_function */ + "SREL32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 64 bit PC relative offset. */ + HOWTO (ALPHA_R_SREL64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + reloc_nil, /* special_function */ + "SREL64", /* name */ + TRUE, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Push a value on the reloc evaluation stack. */ + HOWTO (ALPHA_R_OP_PUSH, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + reloc_nil, /* special_function */ + "OP_PUSH", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Store the value from the stack at the given address. Store it in + a bitfield of size r_size starting at bit position r_offset. */ + HOWTO (ALPHA_R_OP_STORE, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + reloc_nil, /* special_function */ + "OP_STORE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + MINUS_ONE, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Subtract the reloc address from the value on the top of the + relocation stack. */ + HOWTO (ALPHA_R_OP_PSUB, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + reloc_nil, /* special_function */ + "OP_PSUB", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Shift the value on the top of the relocation stack right by the + given value. */ + HOWTO (ALPHA_R_OP_PRSHIFT, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + reloc_nil, /* special_function */ + "OP_PRSHIFT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Hack. Linkage is done by linker. */ + HOWTO (ALPHA_R_LINKAGE, /* type */ + 0, /* rightshift */ + 8, /* size (0 = byte, 1 = short, 2 = long) */ + 256, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + reloc_nil, /* special_function */ + "LINKAGE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 32 bit reference to a symbol. */ + HOWTO (ALPHA_R_REFLONG, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + reloc_nil, /* special_function */ + "REFLONG", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A 64 bit reference to a procedure, written as 32 bit value. */ + HOWTO (ALPHA_R_CODEADDR, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + reloc_nil, /* special_function */ + "CODEADDR", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + +}; + +/* Return a pointer to a howto structure which, when invoked, will perform + the relocation code on data from the architecture noted. */ + +static const struct reloc_howto_struct * +vms_bfd_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + int alpha_type; + +#if VMS_DEBUG + vms_debug (1, "vms_bfd_reloc_type_lookup(%p, %d)\t", abfd, code); +#endif + + switch (code) + { + case BFD_RELOC_16: alpha_type = ALPHA_R_SREL16; break; + case BFD_RELOC_32: alpha_type = ALPHA_R_REFLONG; break; + case BFD_RELOC_64: alpha_type = ALPHA_R_REFQUAD; break; + case BFD_RELOC_CTOR: alpha_type = ALPHA_R_REFQUAD; break; + case BFD_RELOC_23_PCREL_S2: alpha_type = ALPHA_R_BRADDR; break; + case BFD_RELOC_ALPHA_HINT: alpha_type = ALPHA_R_HINT; break; + case BFD_RELOC_16_PCREL: alpha_type = ALPHA_R_SREL16; break; + case BFD_RELOC_32_PCREL: alpha_type = ALPHA_R_SREL32; break; + case BFD_RELOC_64_PCREL: alpha_type = ALPHA_R_SREL64; break; + case BFD_RELOC_ALPHA_LINKAGE: alpha_type = ALPHA_R_LINKAGE; break; + case BFD_RELOC_ALPHA_CODEADDR: alpha_type = ALPHA_R_CODEADDR; break; + default: + (*_bfd_error_handler) ("reloc (%d) is *UNKNOWN*", code); + return (const struct reloc_howto_struct *) NULL; + } +#if VMS_DEBUG + vms_debug (2, "reloc is %s\n", alpha_howto_table[alpha_type].name); +#endif + return &alpha_howto_table[alpha_type]; +} + +/*-- Part 4.7, writing an object file ---------------------------------------*/ + +/* Set the architecture and machine type in BFD abfd to arch and mach. + Find the correct pointer to a structure and insert it into the arch_info + pointer. */ + +static bfd_boolean +vms_set_arch_mach (abfd, arch, mach) + bfd *abfd; + enum bfd_architecture arch ATTRIBUTE_UNUSED; + unsigned long mach ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_set_arch_mach(%p, %d, %ld)\n", abfd, arch, mach); +#endif + abfd->arch_info = bfd_scan_arch("alpha"); + + return TRUE; +} + +/* Sets the contents of the section section in BFD abfd to the data starting + in memory at data. The data is written to the output section starting at + offset offset for count bytes. + + Normally TRUE is returned, else FALSE. Possible error returns are: + o bfd_error_no_contents - The output section does not have the + SEC_HAS_CONTENTS attribute, so nothing can be written to it. + o and some more too */ + +static bfd_boolean +vms_set_section_contents (abfd, section, location, offset, count) + bfd *abfd; + asection *section; + const PTR location; + file_ptr offset; + bfd_size_type count; +{ +#if VMS_DEBUG + vms_debug (1, "vms_set_section_contents(%p, sec %s, loc %p, off %ld, count %d)\n", + abfd, section->name, location, (long int)offset, (int)count); + vms_debug (2, "secraw %d, seccooked %d\n", (int)section->_raw_size, (int)section->_cooked_size); +#endif + return _bfd_save_vms_section(abfd, section, location, offset, count); +} + +/*-- Part 4.8, linker -------------------------------------------------------*/ + +/* Get the size of the section headers. */ + +static int +vms_sizeof_headers (abfd, reloc) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_boolean reloc ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_sizeof_headers(%p, %s)\n", abfd, (reloc)?"True":"False"); +#endif + return 0; +} + +/* Provides default handling of relocation effort for back ends + which can't be bothered to do it efficiently. */ + +static bfd_byte * +vms_bfd_get_relocated_section_contents (abfd, link_info, link_order, data, + relocatable, symbols) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *link_info ATTRIBUTE_UNUSED; + struct bfd_link_order *link_order ATTRIBUTE_UNUSED; + bfd_byte *data ATTRIBUTE_UNUSED; + bfd_boolean relocatable ATTRIBUTE_UNUSED; + asymbol **symbols ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_get_relocated_section_contents(%p, %p, %p, %p, %s, %p)\n", + abfd, link_info, link_order, data, (relocatable)?"True":"False", symbols); +#endif + return 0; +} + +/* ??? */ + +static bfd_boolean +vms_bfd_relax_section (abfd, section, link_info, again) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section ATTRIBUTE_UNUSED; + struct bfd_link_info *link_info ATTRIBUTE_UNUSED; + bfd_boolean *again ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_relax_section(%p, %s, %p, )\n", + abfd, section->name, link_info); +#endif + return TRUE; +} + +static bfd_boolean +vms_bfd_gc_sections (abfd, link_info) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *link_info ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_gc_sections(%p, %p)\n", abfd, link_info); +#endif + return TRUE; +} + +static bfd_boolean +vms_bfd_merge_sections (abfd, link_info) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *link_info ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_merge_sections(%p, %p)\n", abfd, link_info); +#endif + return TRUE; +} + +/* Create a hash table for the linker. Different backends store + different information in this table. */ + +static struct bfd_link_hash_table * +vms_bfd_link_hash_table_create (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_link_hash_table_create(%p)\n", abfd); +#endif + return 0; +} + +/* Free a linker hash table. */ + +static void +vms_bfd_link_hash_table_free (hash) + struct bfd_link_hash_table *hash ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_link_hash_table_free(%p)\n", abfd); +#endif +} + +/* Add symbols from this object file into the hash table. */ + +static bfd_boolean +vms_bfd_link_add_symbols (abfd, link_info) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *link_info ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_link_add_symbols(%p, %p)\n", abfd, link_info); +#endif + return FALSE; +} + +/* Do a link based on the link_order structures attached to each + section of the BFD. */ + +static bfd_boolean +vms_bfd_final_link (abfd, link_info) + bfd *abfd ATTRIBUTE_UNUSED; + struct bfd_link_info *link_info ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_final_link(%p, %p)\n", abfd, link_info); +#endif + return TRUE; +} + +/* Should this section be split up into smaller pieces during linking. */ + +static bfd_boolean +vms_bfd_link_split_section (abfd, section) + bfd *abfd ATTRIBUTE_UNUSED; + asection *section ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_link_split_section(%p, %s)\n", abfd, section->name); +#endif + return FALSE; +} + +/*-- Part 4.9, dynamic symbols and relocations ------------------------------*/ + +/* Get the amount of memory required to hold the dynamic symbols. */ + +static long +vms_get_dynamic_symtab_upper_bound (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_get_dynamic_symtab_upper_bound(%p)\n", abfd); +#endif + return 0; +} + +static bfd_boolean +vms_bfd_print_private_bfd_data (abfd, file) + bfd *abfd ATTRIBUTE_UNUSED; + void *file ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_bfd_print_private_bfd_data(%p)\n", abfd); +#endif + return 0; +} + +/* Read in the dynamic symbols. */ + +static long +vms_canonicalize_dynamic_symtab (abfd, symbols) + bfd *abfd ATTRIBUTE_UNUSED; + asymbol **symbols ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_canonicalize_dynamic_symtab(%p, )\n", abfd); +#endif + return 0L; +} + +/* Get the amount of memory required to hold the dynamic relocs. */ + +static long +vms_get_dynamic_reloc_upper_bound (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_get_dynamic_reloc_upper_bound(%p)\n", abfd); +#endif + return 0L; +} + +/* Read in the dynamic relocs. */ + +static long +vms_canonicalize_dynamic_reloc (abfd, arel, symbols) + bfd *abfd ATTRIBUTE_UNUSED; + arelent **arel ATTRIBUTE_UNUSED; + asymbol **symbols ATTRIBUTE_UNUSED; +{ +#if VMS_DEBUG + vms_debug (1, "vms_canonicalize_dynamic_reloc(%p)\n", abfd); +#endif + return 0L; +} diff --git a/bfd/vms.h b/bfd/vms.h new file mode 100644 index 0000000000000..afd1628756034 --- /dev/null +++ b/bfd/vms.h @@ -0,0 +1,671 @@ +#undef vms +/* vms.h -- Header file for VMS (Alpha and Vax) support. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + Written by Klaus K"ampf (kkaempf@rmi.de) + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; 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. */ + +#ifndef VMS_H +#define VMS_H + +/* Constants starting with 'Exxx_' are for openVMS/Alpha (EVAX object language) */ + +/* VMS Text, information and relocation record (TIR/ETIR) definitions. */ + +#define TIR_S_C_STA_GBL 0 +#define TIR_S_C_STA_SB 1 +#define TIR_S_C_STA_SW 2 +#define TIR_S_C_STA_LW 3 +#define TIR_S_C_STA_PB 4 +#define TIR_S_C_STA_PW 5 +#define TIR_S_C_STA_PL 6 +#define TIR_S_C_STA_UB 7 +#define TIR_S_C_STA_UW 8 +#define TIR_S_C_STA_BFI 9 +#define TIR_S_C_STA_WFI 10 +#define TIR_S_C_STA_LFI 11 +#define TIR_S_C_STA_EPM 12 +#define TIR_S_C_STA_CKARG 13 +#define TIR_S_C_STA_WPB 14 +#define TIR_S_C_STA_WPW 15 +#define TIR_S_C_STA_WPL 16 +#define TIR_S_C_STA_LSY 17 +#define TIR_S_C_STA_LIT 18 +#define TIR_S_C_STA_LEPM 19 +#define TIR_S_C_MAXSTACOD 19 +#define TIR_S_C_MINSTOCOD 20 +#define TIR_S_C_STO_SB 20 +#define TIR_S_C_STO_SW 21 +#define TIR_S_C_STO_L 22 +#define TIR_S_C_STO_LW 22 +#define TIR_S_C_STO_BD 23 +#define TIR_S_C_STO_WD 24 +#define TIR_S_C_STO_LD 25 +#define TIR_S_C_STO_LI 26 +#define TIR_S_C_STO_PIDR 27 +#define TIR_S_C_STO_PICR 28 +#define TIR_S_C_STO_RSB 29 +#define TIR_S_C_STO_RSW 30 +#define TIR_S_C_STO_RL 31 +#define TIR_S_C_STO_VPS 32 +#define TIR_S_C_STO_USB 33 +#define TIR_S_C_STO_USW 34 +#define TIR_S_C_STO_RUB 35 +#define TIR_S_C_STO_RUW 36 +#define TIR_S_C_STO_B 37 +#define TIR_S_C_STO_W 38 +#define TIR_S_C_STO_RB 39 +#define TIR_S_C_STO_RW 40 +#define TIR_S_C_STO_RIVB 41 +#define TIR_S_C_STO_PIRR 42 +#define TIR_S_C_MAXSTOCOD 42 +#define TIR_S_C_MINOPRCOD 50 +#define TIR_S_C_OPR_NOP 50 +#define TIR_S_C_OPR_ADD 51 +#define TIR_S_C_OPR_SUB 52 +#define TIR_S_C_OPR_MUL 53 +#define TIR_S_C_OPR_DIV 54 +#define TIR_S_C_OPR_AND 55 +#define TIR_S_C_OPR_IOR 56 +#define TIR_S_C_OPR_EOR 57 +#define TIR_S_C_OPR_NEG 58 +#define TIR_S_C_OPR_COM 59 +#define TIR_S_C_OPR_INSV 60 +#define TIR_S_C_OPR_ASH 61 +#define TIR_S_C_OPR_USH 62 +#define TIR_S_C_OPR_ROT 63 +#define TIR_S_C_OPR_SEL 64 +#define TIR_S_C_OPR_REDEF 65 +#define TIR_S_C_OPR_DFLIT 66 +#define TIR_S_C_MAXOPRCOD 66 +#define TIR_S_C_MINCTLCOD 80 +#define TIR_S_C_CTL_SETRB 80 +#define TIR_S_C_CTL_AUGRB 81 +#define TIR_S_C_CTL_DFLOC 82 +#define TIR_S_C_CTL_STLOC 83 +#define TIR_S_C_CTL_STKDL 84 +#define TIR_S_C_MAXCTLCOD 84 + +#define ETIR_S_C_MINSTACOD 0 /* Minimum store code */ +#define ETIR_S_C_STA_GBL 0 /* Stack global symbol value */ +#define ETIR_S_C_STA_LW 1 /* Stack longword */ +#define ETIR_S_C_STA_QW 2 /* Stack quadword */ +#define ETIR_S_C_STA_PQ 3 /* Stack psect base plus quadword offset */ +#define ETIR_S_C_STA_LI 4 /* Stack literal */ +#define ETIR_S_C_STA_MOD 5 /* Stack module */ +#define ETIR_S_C_STA_CKARG 6 /* Check Arguments */ +#define ETIR_S_C_MAXSTACOD 6 /* Maximum stack code */ +#define ETIR_S_C_MINSTOCOD 50 /* Minimum store code */ +#define ETIR_S_C_STO_B 50 /* Store byte */ +#define ETIR_S_C_STO_W 51 /* Store word */ +#define ETIR_S_C_STO_LW 52 /* Store longword */ +#define ETIR_S_C_STO_QW 53 /* Store quadword */ +#define ETIR_S_C_STO_IMMR 54 /* Store immediate Repeated */ +#define ETIR_S_C_STO_GBL 55 /* Store global */ +#define ETIR_S_C_STO_CA 56 /* Store code address */ +#define ETIR_S_C_STO_RB 57 /* Store relative branch */ +#define ETIR_S_C_STO_AB 58 /* Store absolute branch */ +#define ETIR_S_C_STO_OFF 59 /* Store offset within psect */ +#define ETIR_S_C_STO_IMM 61 /* Store immediate */ +#define ETIR_S_C_STO_GBL_LW 62 /* Store global Longword */ +#define ETIR_S_C_STO_LP_PSB 63 /* STO_LP_PSB not valid in level 2 use STC_LP_PSB */ +#define ETIR_S_C_STO_HINT_GBL 64 /* Store 14 bit HINT at global address */ +#define ETIR_S_C_STO_HINT_PS 65 /* Store 14 bit HINT at psect + offset */ +#define ETIR_S_C_MAXSTOCOD 65 /* Maximum store code */ +#define ETIR_S_C_MINOPRCOD 100 /* Minimum operate code */ +#define ETIR_S_C_OPR_NOP 100 /* No-op */ +#define ETIR_S_C_OPR_ADD 101 /* Add */ +#define ETIR_S_C_OPR_SUB 102 /* Subtract */ +#define ETIR_S_C_OPR_MUL 103 /* Multiply */ +#define ETIR_S_C_OPR_DIV 104 /* Divide */ +#define ETIR_S_C_OPR_AND 105 /* Logical AND */ +#define ETIR_S_C_OPR_IOR 106 /* Logical inclusive OR */ +#define ETIR_S_C_OPR_EOR 107 /* Logical exclusive OR */ +#define ETIR_S_C_OPR_NEG 108 /* Negate */ +#define ETIR_S_C_OPR_COM 109 /* Complement */ +#define ETIR_S_C_OPR_INSV 110 /* Insert bit field */ +#define ETIR_S_C_OPR_ASH 111 /* Arithmetic shift */ +#define ETIR_S_C_OPR_USH 112 /* Unsigned shift */ +#define ETIR_S_C_OPR_ROT 113 /* Rotate */ +#define ETIR_S_C_OPR_SEL 114 /* Select one of three longwords on top of stack */ +#define ETIR_S_C_OPR_REDEF 115 /* Redefine this symbol after pass 2 */ +#define ETIR_S_C_OPR_DFLIT 116 /* Define a literal */ +#define ETIR_S_C_MAXOPRCOD 116 /* Maximum operate code */ +#define ETIR_S_C_MINCTLCOD 150 /* Minimum control code */ +#define ETIR_S_C_CTL_SETRB 150 /* Set relocation base */ +#define ETIR_S_C_CTL_AUGRB 151 /* Augment relocation base */ +#define ETIR_S_C_CTL_DFLOC 152 /* Define debug location */ +#define ETIR_S_C_CTL_STLOC 153 /* Set debug location */ +#define ETIR_S_C_CTL_STKDL 154 /* Stack debug location */ +#define ETIR_S_C_MAXCTLCOD 154 /* Maximum control code */ +#define ETIR_S_C_MINSTCCOD 200 /* Minimum store-conditional code */ +#define ETIR_S_C_STC_LP 200 /* Store-conditional Linkage Pair */ +#define ETIR_S_C_STC_LP_PSB 201 /* Store-conditional Linkage Pair with Procedure Signature */ +#define ETIR_S_C_STC_GBL 202 /* Store-conditional Address at global address */ +#define ETIR_S_C_STC_GCA 203 /* Store-conditional Code Address at global address */ +#define ETIR_S_C_STC_PS 204 /* Store-conditional Address at psect + offset */ +#define ETIR_S_C_STC_NOP_GBL 205 /* Store-conditional NOP at address of global */ +#define ETIR_S_C_STC_NOP_PS 206 /* Store-conditional NOP at pect + offset */ +#define ETIR_S_C_STC_BSR_GBL 207 /* Store-conditional BSR at global address */ +#define ETIR_S_C_STC_BSR_PS 208 /* Store-conditional BSR at pect + offset */ +#define ETIR_S_C_STC_LDA_GBL 209 /* Store-conditional LDA at global address */ +#define ETIR_S_C_STC_LDA_PS 210 /* Store-conditional LDA at psect + offset */ +#define ETIR_S_C_STC_BOH_GBL 211 /* Store-conditional BSR or Hint at global address */ +#define ETIR_S_C_STC_BOH_PS 212 /* Store-conditional BSR or Hint at pect + offset */ +#define ETIR_S_C_STC_NBH_GBL 213 /* Store-conditional NOP,BSR or HINT at global address */ +#define ETIR_S_C_STC_NBH_PS 214 /* Store-conditional NOP,BSR or HINT at psect + offset */ +#define ETIR_S_C_MAXSTCCOD 214 /* Maximum store-conditional code */ + +/* VMS Global symbol definition record (GSD/EGSD). */ + +#define GSD_S_K_ENTRIES 1 +#define GSD_S_C_ENTRIES 1 +#define GSD_S_C_PSC 0 +#define GSD_S_C_SYM 1 +#define GSD_S_C_EPM 2 +#define GSD_S_C_PRO 3 +#define GSD_S_C_SYMW 4 +#define GSD_S_C_EPMW 5 +#define GSD_S_C_PROW 6 +#define GSD_S_C_IDC 7 +#define GSD_S_C_ENV 8 +#define GSD_S_C_LSY 9 +#define GSD_S_C_LEPM 10 +#define GSD_S_C_LPRO 11 +#define GSD_S_C_SPSC 12 +#define GSD_S_C_SYMV 13 +#define GSD_S_C_EPMV 14 +#define GSD_S_C_PROV 15 +#define GSD_S_C_MAXRECTYP 15 + +#define EGSD_S_K_ENTRIES 2 /* Offset to first entry in record */ +#define EGSD_S_C_ENTRIES 2 /* Offset to first entry in record */ +#define EGSD_S_C_PSC 0 /* Psect definition */ +#define EGSD_S_C_SYM 1 /* Symbol specification */ +#define EGSD_S_C_IDC 2 /* Random entity check */ +#define EGSD_S_C_SPSC 5 /* Shareable image psect definition */ +#define EGSD_S_C_SYMV 6 /* Vectored (dual-valued) versions of SYM, */ +#define EGSD_S_C_SYMM 7 /* Masked versions of SYM, */ +#define EGSD_S_C_SYMG 8 /* EGST - gst version of SYM */ +#define EGSD_S_C_MAXRECTYP 8 /* Maximum entry type defined */ + +#define GPS_S_M_PIC 1 +#define GPS_S_M_LIB 2 +#define GPS_S_M_OVR 4 +#define GPS_S_M_REL 8 +#define GPS_S_M_GBL 16 +#define GPS_S_M_SHR 32 +#define GPS_S_M_EXE 64 +#define GPS_S_M_RD 128 +#define GPS_S_M_WRT 256 +#define GPS_S_M_VEC 512 +#define GPS_S_K_NAME 9 +#define GPS_S_C_NAME 9 + +#define EGPS_S_V_PIC 0x0001 +#define EGPS_S_V_LIB 0x0002 +#define EGPS_S_V_OVR 0x0004 +#define EGPS_S_V_REL 0x0008 +#define EGPS_S_V_GBL 0x0010 +#define EGPS_S_V_SHR 0x0020 +#define EGPS_S_V_EXE 0x0040 +#define EGPS_S_V_RD 0x0080 +#define EGPS_S_V_WRT 0x0100 +#define EGPS_S_V_VEC 0x0200 +#define EGPS_S_V_NOMOD 0x0400 +#define EGPS_S_V_COM 0x0800 + +#define GSY_S_M_WEAK 1 +#define GSY_S_M_DEF 2 +#define GSY_S_M_UNI 4 +#define GSY_S_M_REL 8 + +#define EGSY_S_V_WEAK 0x0001 +#define EGSY_S_V_DEF 0x0002 +#define EGSY_S_V_UNI 0x0004 +#define EGSY_S_V_REL 0x0008 +#define EGSY_S_V_COMM 0x0010 +#define EGSY_S_V_VECEP 0x0020 +#define EGSY_S_V_NORM 0x0040 + +#define LSY_S_M_DEF 2 +#define LSY_S_M_REL 8 + +#define ENV_S_M_DEF 1 +#define ENV_S_M_NESTED 2 + +/* + * Debugger symbol definitions: These are done by hand, as no + * machine-readable version seems + * to be available. + */ +#define DST_S_C_C 7 /* Language == "C" */ +#define DST_S_C_CXX 15 /* Language == "C++" */ +#define DST_S_C_VERSION 153 +#define DST_S_C_SOURCE 155 /* Source file */ +#define DST_S_C_PROLOG 162 +#define DST_S_C_BLKBEG 176 /* Beginning of block */ +#define DST_S_C_BLKEND 177 /* End of block */ +#define DST_S_C_ENTRY 181 +#define DST_S_C_PSECT 184 +#define DST_S_C_LINE_NUM 185 /* Line Number */ +#define DST_S_C_LBLORLIT 186 +#define DST_S_C_LABEL 187 +#define DST_S_C_MODBEG 188 /* Beginning of module */ +#define DST_S_C_MODEND 189 /* End of module */ +#define DST_S_C_RTNBEG 190 /* Beginning of routine */ +#define DST_S_C_RTNEND 191 /* End of routine */ +#define DST_S_C_DELTA_PC_W 1 /* Incr PC */ +#define DST_S_C_INCR_LINUM 2 /* Incr Line # */ +#define DST_S_C_INCR_LINUM_W 3 /* Incr Line # */ +#define DST_S_C_SET_LINUM_INCR 4 +#define DST_S_C_SET_LINUM_INCR_W 5 +#define DST_S_C_RESET_LINUM_INCR 6 +#define DST_S_C_BEG_STMT_MODE 7 +#define DST_S_C_END_STMT_MODE 8 +#define DST_S_C_SET_LINE_NUM 9 /* Set Line # */ +#define DST_S_C_SET_PC 10 +#define DST_S_C_SET_PC_W 11 +#define DST_S_C_SET_PC_L 12 +#define DST_S_C_SET_STMTNUM 13 +#define DST_S_C_TERM 14 /* End of lines */ +#define DST_S_C_TERM_W 15 /* End of lines */ +#define DST_S_C_SET_ABS_PC 16 /* Set PC */ +#define DST_S_C_DELTA_PC_L 17 /* Incr PC */ +#define DST_S_C_INCR_LINUM_L 18 /* Incr Line # */ +#define DST_S_C_SET_LINUM_B 19 /* Set Line # */ +#define DST_S_C_SET_LINUM_L 20 /* Set Line # */ +#define DST_S_C_TERM_L 21 /* End of lines */ +/* these are used with DST_S_C_SOURCE */ +#define DST_S_C_SRC_DECLFILE 1 /* Declare source file */ +#define DST_S_C_SRC_SETFILE 2 /* Set source file */ +#define DST_S_C_SRC_SETREC_L 3 /* Set record, longword value */ +#define DST_S_C_SRC_SETREC_W 4 /* Set record, word value */ +#define DST_S_C_SRC_DEFLINES_W 10 /* # of line, word counter */ +#define DST_S_C_SRC_DEFLINES_B 11 /* # of line, byte counter */ +#define DST_S_C_SRC_FORMFEED 16 /* ^L counts as a record */ +/* the following are the codes for the various data types. Anything not on + * the list is included under 'advanced_type' + */ +#define DBG_S_C_UCHAR 0x02 +#define DBG_S_C_USINT 0x03 +#define DBG_S_C_ULINT 0x04 +#define DBG_S_C_UQUAD 0x05 +#define DBG_S_C_SCHAR 0x06 +#define DBG_S_C_SSINT 0x07 +#define DBG_S_C_SLINT 0x08 +#define DBG_S_C_SQUAD 0x09 +#define DBG_S_C_REAL4 0x0a +#define DBG_S_C_REAL8 0x0b /* D_float double */ +#define DBG_S_C_COMPLX4 0x0c /* 2xF_float complex float */ +#define DBG_S_C_COMPLX8 0x0d /* 2xD_float complex double */ +#define DBG_S_C_REAL8_G 0x1b /* G_float double */ +#define DBG_S_C_COMPLX8_G 0x1d /* 2xG_float complex double */ +#define DBG_S_C_FUNCTION_ADDR 0x17 +#define DBG_S_C_ADVANCED_TYPE 0xa3 +/* Some of these are just for future reference. [pr] + */ +#define DBG_S_C_UBITA 0x01 /* unsigned, aligned bit field */ +#define DBG_S_C_UBITU 0x22 /* unsigned, unaligned bit field */ +#define DBG_S_C_SBITA 0x29 /* signed, aligned bit field */ +#define DBG_S_C_SBITU 0x2a /* signed, unaligned bit field */ +#define DBG_S_C_CSTRING 0x2e /* asciz ('\0' terminated) string */ +#define DBG_S_C_WCHAR 0x38 /* wchar_t */ +/* These are descriptor class codes. + */ +#define DSC_K_CLASS_S 0x01 /* static (fixed length) */ +#define DSC_K_CLASS_D 0x02 /* dynamic string (not via malloc!) */ +#define DSC_K_CLASS_A 0x04 /* array */ +#define DSC_K_CLASS_UBS 0x0d /* unaligned bit string */ +/* These are the codes that are used to generate the definitions of struct + * union and enum records + */ +#define DBG_S_C_ENUM_ITEM 0xa4 +#define DBG_S_C_ENUM_START 0xa5 +#define DBG_S_C_ENUM_END 0xa6 +#define DBG_S_C_STRUCT_ITEM DST_K_VFLAGS_BITOFFS /* 0xff */ +#define DBG_S_C_STRUCT_START 0xab +#define DBG_S_C_STRUCT_END 0xac +#define DST_K_TYPSPEC 0xaf /* type specification */ +/* These codes are used in the generation of the symbol definition records + */ +#define DST_K_VFLAGS_NOVAL 0x80 /* struct definition only */ +#define DST_K_VFLAGS_DSC 0xfa /* descriptor used */ +#define DST_K_VFLAGS_TVS 0xfb /* trailing value specified */ +#define DST_K_VS_FOLLOWS 0xfd /* value spec follows */ +#define DST_K_VFLAGS_BITOFFS 0xff /* value contains bit offset */ +#define DST_K_VALKIND_LITERAL 0 +#define DST_K_VALKIND_ADDR 1 +#define DST_K_VALKIND_DESC 2 +#define DST_K_VALKIND_REG 3 +#define DST_K_REG_VAX_AP 0x0c /* R12 */ +#define DST_K_REG_VAX_FP 0x0d /* R13 */ +#define DST_K_REG_VAX_SP 0x0e /* R14 */ +#define DST_V_VALKIND 0 /* offset of valkind field */ +#define DST_V_INDIRECT 2 /* offset to indirect bit */ +#define DST_V_DISP 3 /* offset to displacement bit */ +#define DST_V_REGNUM 4 /* offset to register number */ +#define DST_M_INDIRECT (1<contents */ + + unsigned char pdsc[8]; /* procedure descriptor */ + + /* Output routine storage */ + + unsigned char *output_buf; /* output data */ + int push_level; + int pushed_size; + int length_pos; + int output_size; + int output_alignment; + + /* linkage index counter + used by conditional store commands (ETIR_S_C_STC_) */ + + int vms_linkage_index; + + /* see tc-alpha.c of gas for a description. */ + int flag_hash_long_names; /* -+, hash instead of truncate */ + int flag_show_after_trunc; /* -H, show hashing/truncation */ +}; + +#define PRIV(name) ((struct vms_private_data_struct *)abfd->tdata.any)->name + +#define SECTION_NAME_TEMPLATE "__SEC__%d" + +#if VMS_DEBUG +extern void _bfd_vms_debug PARAMS((int level, char *format, ...)); +extern void _bfd_hexdump + PARAMS ((int level, unsigned char *ptr, int size, int offset)); + +#define vms_debug _bfd_vms_debug +#endif + +extern struct bfd_hash_entry *_bfd_vms_hash_newfunc + PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table, + const char *string)); +extern void _bfd_vms_get_header_values + PARAMS ((bfd *abfd, unsigned char *buf, int *type, int *length)); +extern int _bfd_vms_get_record PARAMS ((bfd *abfd)); +extern int _bfd_vms_next_record PARAMS ((bfd *abfd)); + +extern char *_bfd_vms_save_sized_string PARAMS ((unsigned char *str, int size)); +extern char *_bfd_vms_save_counted_string PARAMS ((unsigned char *ptr)); +extern void _bfd_vms_push PARAMS ((bfd *abfd, uquad val, int psect)); +extern uquad _bfd_vms_pop PARAMS ((bfd *abfd, int *psect)); + +extern bfd_boolean _bfd_save_vms_section + PARAMS ((bfd *abfd, asection *section, const PTR data, file_ptr offset, + bfd_size_type count)); +extern void _bfd_vms_output_begin + PARAMS ((bfd *abfd, int rectype, int rechead)); +extern void _bfd_vms_output_alignment PARAMS ((bfd *abfd, int alignto)); +extern void _bfd_vms_output_push PARAMS ((bfd *abfd)); +extern void _bfd_vms_output_pop PARAMS ((bfd *abfd)); +extern void _bfd_vms_output_flush PARAMS ((bfd *abfd)); +extern void _bfd_vms_output_end PARAMS ((bfd *abfd)); +extern int _bfd_vms_output_check PARAMS ((bfd *abfd, int size)); +extern void _bfd_vms_output_byte PARAMS ((bfd *abfd, unsigned int value)); +extern void _bfd_vms_output_short PARAMS ((bfd *abfd, unsigned int value)); +extern void _bfd_vms_output_long PARAMS ((bfd *abfd, unsigned long value)); +extern void _bfd_vms_output_quad PARAMS ((bfd *abfd, uquad value)); +extern void _bfd_vms_output_counted PARAMS ((bfd *abfd, char *value)); +extern void _bfd_vms_output_dump PARAMS ((bfd *abfd, unsigned char *data, + int length)); +extern void _bfd_vms_output_fill PARAMS ((bfd *abfd, int value, int length)); +extern char *_bfd_vms_length_hash_symbol PARAMS ((bfd *abfd, const char *in, int maxlen)); + +extern vms_symbol_entry *_bfd_vms_enter_symbol PARAMS ((bfd *abfd, char *name)); + +#endif /* VMS_H */ diff --git a/bfd/xsym.c b/bfd/xsym.c new file mode 100644 index 0000000000000..a4058dd395481 --- /dev/null +++ b/bfd/xsym.c @@ -0,0 +1,2484 @@ +/* xSYM symbol-file support for BFD. + Copyright 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "xsym.h" +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +#define bfd_sym_close_and_cleanup _bfd_generic_close_and_cleanup +#define bfd_sym_bfd_free_cached_info _bfd_generic_bfd_free_cached_info +#define bfd_sym_new_section_hook _bfd_generic_new_section_hook +#define bfd_sym_bfd_is_local_label_name bfd_generic_is_local_label_name +#define bfd_sym_get_lineno _bfd_nosymbols_get_lineno +#define bfd_sym_find_nearest_line _bfd_nosymbols_find_nearest_line +#define bfd_sym_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define bfd_sym_read_minisymbols _bfd_generic_read_minisymbols +#define bfd_sym_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol +#define bfd_sym_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound +#define bfd_sym_canonicalize_reloc _bfd_norelocs_canonicalize_reloc +#define bfd_sym_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +#define bfd_sym_set_arch_mach _bfd_generic_set_arch_mach +#define bfd_sym_get_section_contents _bfd_generic_get_section_contents +#define bfd_sym_set_section_contents _bfd_generic_set_section_contents +#define bfd_sym_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents +#define bfd_sym_bfd_relax_section bfd_generic_relax_section +#define bfd_sym_bfd_gc_sections bfd_generic_gc_sections +#define bfd_sym_bfd_merge_sections bfd_generic_merge_sections +#define bfd_sym_bfd_discard_group bfd_generic_discard_group +#define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define bfd_sym_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms +#define bfd_sym_bfd_final_link _bfd_generic_final_link +#define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section +#define bfd_sym_get_section_contents_in_window _bfd_generic_get_section_contents_in_window + +static int pstrcmp PARAMS ((unsigned char *, unsigned char *)); +static unsigned long compute_offset + PARAMS ((unsigned long, unsigned long, unsigned long, unsigned long)); + +extern const bfd_target sym_vec; + +static int +pstrcmp (a, b) + unsigned char *a; + unsigned char *b; +{ + unsigned char clen; + int ret; + + clen = (a[0] > b[0]) ? a[0] : b[0]; + ret = memcmp (a + 1, b + 1, clen); + if (ret != 0) + return ret; + + if (a[0] == b[0]) + return 0; + else if (a[0] < b[0]) + return -1; + else + return 0; +} + +static unsigned long +compute_offset (first_page, page_size, entry_size, index) + unsigned long first_page; + unsigned long page_size; + unsigned long entry_size; + unsigned long index; +{ + unsigned long entries_per_page = page_size / entry_size; + unsigned long page_number = first_page + (index / entries_per_page); + unsigned long page_offset = (index % entries_per_page) * entry_size; + + return (page_number * page_size) + page_offset; +} + +bfd_boolean +bfd_sym_mkobject (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ + return 1; +} + +void +bfd_sym_print_symbol (abfd, afile, symbol, how) + bfd *abfd ATTRIBUTE_UNUSED; + PTR afile ATTRIBUTE_UNUSED; + asymbol *symbol ATTRIBUTE_UNUSED; + bfd_print_symbol_type how ATTRIBUTE_UNUSED; +{ + return; +} + +bfd_boolean +bfd_sym_valid (abfd) + bfd *abfd; +{ + if (abfd == NULL || abfd->xvec == NULL) + return 0; + + return abfd->xvec == &sym_vec; +} + +unsigned char * +bfd_sym_read_name_table (abfd, dshb) + bfd *abfd; + bfd_sym_header_block *dshb; +{ + unsigned char *rstr; + long ret; + size_t table_size = dshb->dshb_nte.dti_page_count * dshb->dshb_page_size; + size_t table_offset = dshb->dshb_nte.dti_first_page * dshb->dshb_page_size; + + rstr = (unsigned char *) bfd_alloc (abfd, table_size); + if (rstr == NULL) + return rstr; + + bfd_seek (abfd, table_offset, SEEK_SET); + ret = bfd_bread (rstr, table_size, abfd); + if (ret < 0 || (unsigned long) ret != table_size) + { + bfd_release (abfd, rstr); + return NULL; + } + + return rstr; +} + +void +bfd_sym_parse_file_reference_v32 (buf, len, entry) + unsigned char *buf; + size_t len; + bfd_sym_file_reference *entry; +{ + BFD_ASSERT (len == 6); + + entry->fref_frte_index = bfd_getb16 (buf); + entry->fref_offset = bfd_getb32 (buf + 2); +} + +void +bfd_sym_parse_disk_table_v32 (buf, len, table) + unsigned char *buf; + size_t len; + bfd_sym_table_info *table; +{ + BFD_ASSERT (len == 8); + + table->dti_first_page = bfd_getb16 (buf); + table->dti_page_count = bfd_getb16 (buf + 2); + table->dti_object_count = bfd_getb32 (buf + 4); +} + +void +bfd_sym_parse_header_v32 (buf, len, header) + unsigned char *buf; + size_t len; + bfd_sym_header_block *header; +{ + BFD_ASSERT (len == 154); + + memcpy (header->dshb_id, buf, 32); + header->dshb_page_size = bfd_getb16 (buf + 32); + header->dshb_hash_page = bfd_getb16 (buf + 34); + header->dshb_root_mte = bfd_getb16 (buf + 36); + header->dshb_mod_date = bfd_getb32 (buf + 38); + + bfd_sym_parse_disk_table_v32 (buf + 42, 8, &header->dshb_frte); + bfd_sym_parse_disk_table_v32 (buf + 50, 8, &header->dshb_rte); + bfd_sym_parse_disk_table_v32 (buf + 58, 8, &header->dshb_mte); + bfd_sym_parse_disk_table_v32 (buf + 66, 8, &header->dshb_cmte); + bfd_sym_parse_disk_table_v32 (buf + 74, 8, &header->dshb_cvte); + bfd_sym_parse_disk_table_v32 (buf + 82, 8, &header->dshb_csnte); + bfd_sym_parse_disk_table_v32 (buf + 90, 8, &header->dshb_clte); + bfd_sym_parse_disk_table_v32 (buf + 98, 8, &header->dshb_ctte); + bfd_sym_parse_disk_table_v32 (buf + 106, 8, &header->dshb_tte); + bfd_sym_parse_disk_table_v32 (buf + 114, 8, &header->dshb_nte); + bfd_sym_parse_disk_table_v32 (buf + 122, 8, &header->dshb_tinfo); + bfd_sym_parse_disk_table_v32 (buf + 130, 8, &header->dshb_fite); + bfd_sym_parse_disk_table_v32 (buf + 138, 8, &header->dshb_const); + + memcpy (&header->dshb_file_creator, buf + 146, 4); + memcpy (&header->dshb_file_type, buf + 150, 4); +} + +int +bfd_sym_read_header_v32 (abfd, header) + bfd *abfd; + bfd_sym_header_block *header; +{ + unsigned char buf[154]; + long ret; + + ret = bfd_bread (buf, 154, abfd); + if (ret != 154) + return -1; + + bfd_sym_parse_header_v32 (buf, 154, header); + + return 0; +} + +int +bfd_sym_read_header_v34 (abfd, header) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_sym_header_block *header ATTRIBUTE_UNUSED; +{ + abort (); +} + +int +bfd_sym_read_header (abfd, header, version) + bfd *abfd; + bfd_sym_header_block *header; + bfd_sym_version version; +{ + switch (version) + { + case BFD_SYM_VERSION_3_5: + case BFD_SYM_VERSION_3_4: + return bfd_sym_read_header_v34 (abfd, header); + case BFD_SYM_VERSION_3_3: + case BFD_SYM_VERSION_3_2: + return bfd_sym_read_header_v32 (abfd, header); + case BFD_SYM_VERSION_3_1: + default: + return FALSE; + } +} + +int +bfd_sym_read_version (abfd, version) + bfd *abfd; + bfd_sym_version *version; +{ + unsigned char version_string[32]; + long ret; + + ret = bfd_bread (version_string, sizeof (version_string), abfd); + if (ret != sizeof (version_string)) + return -1; + + if (pstrcmp (version_string, BFD_SYM_VERSION_STR_3_1) == 0) + *version = BFD_SYM_VERSION_3_1; + else if (pstrcmp (version_string, BFD_SYM_VERSION_STR_3_2) == 0) + *version = BFD_SYM_VERSION_3_2; + else if (pstrcmp (version_string, BFD_SYM_VERSION_STR_3_3) == 0) + *version = BFD_SYM_VERSION_3_3; + else if (pstrcmp (version_string, BFD_SYM_VERSION_STR_3_4) == 0) + *version = BFD_SYM_VERSION_3_4; + else if (pstrcmp (version_string, BFD_SYM_VERSION_STR_3_5) == 0) + *version = BFD_SYM_VERSION_3_5; + else + return -1; + + return 0; +} + +void +bfd_sym_display_table_summary (f, dti, name) + FILE *f; + bfd_sym_table_info *dti; + const char *name; +{ + fprintf (f, "%-6s %13ld %13ld %13ld\n", + name, + dti->dti_first_page, + dti->dti_page_count, + dti->dti_object_count); +} + +void +bfd_sym_display_header (f, dshb) + FILE *f; + bfd_sym_header_block *dshb; +{ + fprintf (f, " Version: %.*s\n", dshb->dshb_id[0], dshb->dshb_id + 1); + fprintf (f, " Page Size: 0x%x\n", dshb->dshb_page_size); + fprintf (f, " Hash Page: %lu\n", dshb->dshb_hash_page); + fprintf (f, " Root MTE: %lu\n", dshb->dshb_root_mte); + fprintf (f, " Modification Date: "); + fprintf (f, "[unimplemented]"); + fprintf (f, " (0x%lx)\n", dshb->dshb_mod_date); + + fprintf (f, " File Creator: %.4s Type: %.4s\n\n", + dshb->dshb_file_creator, dshb->dshb_file_type); + + fprintf (f, "Table Name First Page Page Count Object Count\n"); + fprintf (f, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); + + bfd_sym_display_table_summary (f, &dshb->dshb_nte, "NTE"); + bfd_sym_display_table_summary (f, &dshb->dshb_rte, "RTE"); + bfd_sym_display_table_summary (f, &dshb->dshb_mte, "MTE"); + bfd_sym_display_table_summary (f, &dshb->dshb_frte, "FRTE"); + bfd_sym_display_table_summary (f, &dshb->dshb_cmte, "CMTE"); + bfd_sym_display_table_summary (f, &dshb->dshb_cvte, "CVTE"); + bfd_sym_display_table_summary (f, &dshb->dshb_csnte, "CSNTE"); + bfd_sym_display_table_summary (f, &dshb->dshb_clte, "CLTE"); + bfd_sym_display_table_summary (f, &dshb->dshb_ctte, "CTTE"); + bfd_sym_display_table_summary (f, &dshb->dshb_tte, "TTE"); + bfd_sym_display_table_summary (f, &dshb->dshb_tinfo, "TINFO"); + bfd_sym_display_table_summary (f, &dshb->dshb_fite, "FITE"); + bfd_sym_display_table_summary (f, &dshb->dshb_const, "CONST"); + + fprintf (f, "\n"); +} + +void +bfd_sym_parse_resources_table_entry_v32 (buf, len, entry) + unsigned char *buf; + size_t len; + bfd_sym_resources_table_entry *entry; +{ + BFD_ASSERT (len == 18); + + memcpy (&entry->rte_res_type, buf, 4); + entry->rte_res_number = bfd_getb16 (buf + 4); + entry->rte_nte_index = bfd_getb32 (buf + 6); + entry->rte_mte_first = bfd_getb16 (buf + 10); + entry->rte_mte_last = bfd_getb16 (buf + 12); + entry->rte_res_size = bfd_getb32 (buf + 14); +} + +void +bfd_sym_parse_modules_table_entry_v33 (buf, len, entry) + unsigned char *buf; + size_t len; + bfd_sym_modules_table_entry *entry; +{ + BFD_ASSERT (len == 46); + + entry->mte_rte_index = bfd_getb16 (buf); + entry->mte_res_offset = bfd_getb32 (buf + 2); + entry->mte_size = bfd_getb32 (buf + 6); + entry->mte_kind = buf[10]; + entry->mte_scope = buf[11]; + entry->mte_parent = bfd_getb16 (buf + 12); + bfd_sym_parse_file_reference_v32 (buf + 14, 6, &entry->mte_imp_fref); + entry->mte_imp_end = bfd_getb32 (buf + 20); + entry->mte_nte_index = bfd_getb32 (buf + 24); + entry->mte_cmte_index = bfd_getb16 (buf + 28); + entry->mte_cvte_index = bfd_getb32 (buf + 30); + entry->mte_clte_index = bfd_getb16 (buf + 34); + entry->mte_ctte_index = bfd_getb16 (buf + 36); + entry->mte_csnte_idx_1 = bfd_getb32 (buf + 38); + entry->mte_csnte_idx_2 = bfd_getb32 (buf + 42); +} + +void +bfd_sym_parse_file_references_table_entry_v32 (buf, len, entry) + unsigned char *buf; + size_t len; + bfd_sym_file_references_table_entry *entry; +{ + unsigned int type; + + BFD_ASSERT (len == 10); + + memset (entry, 0, sizeof (bfd_sym_file_references_table_entry)); + type = bfd_getb16 (buf); + + switch (type) + { + case BFD_SYM_END_OF_LIST_3_2: + entry->generic.type = BFD_SYM_END_OF_LIST; + break; + + case BFD_SYM_FILE_NAME_INDEX_3_2: + entry->filename.type = BFD_SYM_FILE_NAME_INDEX; + entry->filename.nte_index = bfd_getb32 (buf + 2); + entry->filename.mod_date = bfd_getb32 (buf + 6); + break; + + default: + entry->entry.mte_index = type; + entry->entry.file_offset = bfd_getb32 (buf + 2); + } +} + +void +bfd_sym_parse_contained_modules_table_entry_v32 (buf, len, entry) + unsigned char *buf; + size_t len; + bfd_sym_contained_modules_table_entry *entry; +{ + unsigned int type; + + BFD_ASSERT (len == 6); + + memset (entry, 0, sizeof (bfd_sym_contained_modules_table_entry)); + type = bfd_getb16 (buf); + + switch (type) + { + case BFD_SYM_END_OF_LIST_3_2: + entry->generic.type = BFD_SYM_END_OF_LIST; + break; + + default: + entry->entry.mte_index = type; + entry->entry.nte_index = bfd_getb32 (buf + 2); + break; + } +} + +void +bfd_sym_parse_contained_variables_table_entry_v32 (buf, len, entry) + unsigned char *buf; + size_t len; + bfd_sym_contained_variables_table_entry *entry; +{ + unsigned int type; + + BFD_ASSERT (len == 26); + + memset (entry, 0, sizeof (bfd_sym_contained_variables_table_entry)); + type = bfd_getb16 (buf); + + switch (type) + { + case BFD_SYM_END_OF_LIST_3_2: + entry->generic.type = BFD_SYM_END_OF_LIST; + break; + + case BFD_SYM_SOURCE_FILE_CHANGE_3_2: + entry->file.type = BFD_SYM_SOURCE_FILE_CHANGE; + bfd_sym_parse_file_reference_v32 (buf + 2, 6, &entry->file.fref); + break; + + default: + entry->entry.tte_index = type; + entry->entry.nte_index = bfd_getb32 (buf + 2); + entry->entry.file_delta = bfd_getb16 (buf + 6); + entry->entry.scope = buf[8]; + entry->entry.la_size = buf[9]; + + if (entry->entry.la_size == BFD_SYM_CVTE_SCA) + { + entry->entry.address.scstruct.sca_kind = buf[10]; + entry->entry.address.scstruct.sca_class = buf[11]; + entry->entry.address.scstruct.sca_offset = bfd_getb32 (buf + 12); + } + else if (entry->entry.la_size <= BFD_SYM_CVTE_SCA) + { + memcpy (&entry->entry.address.lastruct.la, buf + 10, BFD_SYM_CVTE_SCA); + entry->entry.address.lastruct.la_kind = buf[23]; + } + else if (entry->entry.la_size == BFD_SYM_CVTE_BIG_LA) + { + entry->entry.address.biglastruct.big_la = bfd_getb32 (buf + 10); + entry->entry.address.biglastruct.big_la_kind = buf[12]; + } + } +} + +void +bfd_sym_parse_contained_statements_table_entry_v32 (buf, len, entry) + unsigned char *buf; + size_t len; + bfd_sym_contained_statements_table_entry *entry; +{ + unsigned int type; + + BFD_ASSERT (len == 8); + + memset (entry, 0, sizeof (bfd_sym_contained_statements_table_entry)); + type = bfd_getb16 (buf); + + switch (type) + { + case BFD_SYM_END_OF_LIST_3_2: + entry->generic.type = BFD_SYM_END_OF_LIST; + break; + + case BFD_SYM_SOURCE_FILE_CHANGE_3_2: + entry->file.type = BFD_SYM_SOURCE_FILE_CHANGE; + bfd_sym_parse_file_reference_v32 (buf + 2, 6, &entry->file.fref); + break; + + default: + entry->entry.mte_index = type; + entry->entry.mte_offset = bfd_getb16 (buf + 2); + entry->entry.file_delta = bfd_getb32 (buf + 4); + break; + } +} + +void +bfd_sym_parse_contained_labels_table_entry_v32 (buf, len, entry) + unsigned char *buf; + size_t len; + bfd_sym_contained_labels_table_entry *entry; +{ + unsigned int type; + + BFD_ASSERT (len == 12); + + memset (entry, 0, sizeof (bfd_sym_contained_labels_table_entry)); + type = bfd_getb16 (buf); + + switch (type) + { + case BFD_SYM_END_OF_LIST_3_2: + entry->generic.type = BFD_SYM_END_OF_LIST; + break; + + case BFD_SYM_SOURCE_FILE_CHANGE_3_2: + entry->file.type = BFD_SYM_SOURCE_FILE_CHANGE; + bfd_sym_parse_file_reference_v32 (buf + 2, 6, &entry->file.fref); + break; + + default: + entry->entry.mte_index = type; + entry->entry.mte_offset = bfd_getb16 (buf + 2); + entry->entry.nte_index = bfd_getb32 (buf + 4); + entry->entry.file_delta = bfd_getb16 (buf + 8); + entry->entry.scope = bfd_getb16 (buf + 10); + break; + } +} + +void +bfd_sym_parse_type_table_entry_v32 (buf, len, entry) + unsigned char *buf; + size_t len; + bfd_sym_type_table_entry *entry; +{ + BFD_ASSERT (len == 4); + + *entry = bfd_getb32 (buf); +} + +int +bfd_sym_fetch_resources_table_entry (abfd, entry, index) + bfd *abfd; + bfd_sym_resources_table_entry *entry; + unsigned long index; +{ + void (*parser) PARAMS ((unsigned char *, size_t, + bfd_sym_resources_table_entry *)); + unsigned long offset; + unsigned long entry_size; + unsigned char buf[18]; + bfd_sym_data_struct *sdata = NULL; + + parser = NULL; + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (index == 0) + return -1; + + switch (sdata->version) + { + case BFD_SYM_VERSION_3_5: + case BFD_SYM_VERSION_3_4: + return -1; + + case BFD_SYM_VERSION_3_3: + case BFD_SYM_VERSION_3_2: + entry_size = 18; + parser = bfd_sym_parse_resources_table_entry_v32; + break; + + case BFD_SYM_VERSION_3_1: + default: + return -1; + } + if (parser == NULL) + return -1; + + offset = compute_offset (sdata->header.dshb_rte.dti_first_page, + sdata->header.dshb_page_size, + entry_size, index); + + if (bfd_seek (abfd, offset, SEEK_SET) < 0) + return -1; + if (bfd_bread (buf, entry_size, abfd) != entry_size) + return -1; + + (*parser) (buf, entry_size, entry); + + return 0; +} + +int +bfd_sym_fetch_modules_table_entry (abfd, entry, index) + bfd *abfd; + bfd_sym_modules_table_entry *entry; + unsigned long index; +{ + void (*parser) PARAMS ((unsigned char *, size_t, + bfd_sym_modules_table_entry *)); + unsigned long offset; + unsigned long entry_size; + unsigned char buf[46]; + bfd_sym_data_struct *sdata = NULL; + + parser = NULL; + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (index == 0) + return -1; + + switch (sdata->version) + { + case BFD_SYM_VERSION_3_5: + case BFD_SYM_VERSION_3_4: + return -1; + + case BFD_SYM_VERSION_3_3: + entry_size = 46; + parser = bfd_sym_parse_modules_table_entry_v33; + break; + + case BFD_SYM_VERSION_3_2: + case BFD_SYM_VERSION_3_1: + default: + return -1; + } + if (parser == NULL) + return -1; + + offset = compute_offset (sdata->header.dshb_mte.dti_first_page, + sdata->header.dshb_page_size, + entry_size, index); + + if (bfd_seek (abfd, offset, SEEK_SET) < 0) + return -1; + if (bfd_bread (buf, entry_size, abfd) != entry_size) + return -1; + + (*parser) (buf, entry_size, entry); + + return 0; +} + +int +bfd_sym_fetch_file_references_table_entry (abfd, entry, index) + bfd *abfd; + bfd_sym_file_references_table_entry *entry; + unsigned long index; +{ + void (*parser) PARAMS ((unsigned char *, size_t, + bfd_sym_file_references_table_entry *)); + unsigned long offset; + unsigned long entry_size = 0; + unsigned char buf[8]; + bfd_sym_data_struct *sdata = NULL; + + parser = NULL; + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (index == 0) + return -1; + + switch (sdata->version) + { + case BFD_SYM_VERSION_3_3: + case BFD_SYM_VERSION_3_2: + entry_size = 10; + parser = bfd_sym_parse_file_references_table_entry_v32; + break; + + case BFD_SYM_VERSION_3_5: + case BFD_SYM_VERSION_3_4: + case BFD_SYM_VERSION_3_1: + default: + break; + } + + if (parser == NULL) + return -1; + + offset = compute_offset (sdata->header.dshb_frte.dti_first_page, + sdata->header.dshb_page_size, + entry_size, index); + + if (bfd_seek (abfd, offset, SEEK_SET) < 0) + return -1; + if (bfd_bread (buf, entry_size, abfd) != entry_size) + return -1; + + (*parser) (buf, entry_size, entry); + + return 0; +} + +int +bfd_sym_fetch_contained_modules_table_entry (abfd, entry, index) + bfd *abfd; + bfd_sym_contained_modules_table_entry *entry; + unsigned long index; +{ + void (*parser) PARAMS ((unsigned char *, size_t, + bfd_sym_contained_modules_table_entry *)); + unsigned long offset; + unsigned long entry_size = 0; + unsigned char buf[6]; + bfd_sym_data_struct *sdata = NULL; + + parser = NULL; + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (index == 0) + return -1; + + switch (sdata->version) + { + case BFD_SYM_VERSION_3_3: + case BFD_SYM_VERSION_3_2: + entry_size = 6; + parser = bfd_sym_parse_contained_modules_table_entry_v32; + break; + + case BFD_SYM_VERSION_3_5: + case BFD_SYM_VERSION_3_4: + case BFD_SYM_VERSION_3_1: + default: + break; + } + + if (parser == NULL) + return -1; + + offset = compute_offset (sdata->header.dshb_cmte.dti_first_page, + sdata->header.dshb_page_size, + entry_size, index); + + if (bfd_seek (abfd, offset, SEEK_SET) < 0) + return -1; + if (bfd_bread (buf, entry_size, abfd) != entry_size) + return -1; + + (*parser) (buf, entry_size, entry); + + return 0; +} + +int +bfd_sym_fetch_contained_variables_table_entry (abfd, entry, index) + bfd *abfd; + bfd_sym_contained_variables_table_entry *entry; + unsigned long index; +{ + void (*parser) PARAMS ((unsigned char *, size_t, + bfd_sym_contained_variables_table_entry *)); + unsigned long offset; + unsigned long entry_size = 0; + unsigned char buf[26]; + bfd_sym_data_struct *sdata = NULL; + + parser = NULL; + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (index == 0) + return -1; + + switch (sdata->version) + { + case BFD_SYM_VERSION_3_3: + case BFD_SYM_VERSION_3_2: + entry_size = 26; + parser = bfd_sym_parse_contained_variables_table_entry_v32; + break; + + case BFD_SYM_VERSION_3_5: + case BFD_SYM_VERSION_3_4: + case BFD_SYM_VERSION_3_1: + default: + break; + } + + if (parser == NULL) + return -1; + + offset = compute_offset (sdata->header.dshb_cvte.dti_first_page, + sdata->header.dshb_page_size, + entry_size, index); + + if (bfd_seek (abfd, offset, SEEK_SET) < 0) + return -1; + if (bfd_bread (buf, entry_size, abfd) != entry_size) + return -1; + + (*parser) (buf, entry_size, entry); + + return 0; +} + +int +bfd_sym_fetch_contained_statements_table_entry (abfd, entry, index) + bfd *abfd; + bfd_sym_contained_statements_table_entry *entry; + unsigned long index; +{ + void (*parser) PARAMS ((unsigned char *, size_t, + bfd_sym_contained_statements_table_entry *)); + unsigned long offset; + unsigned long entry_size = 0; + unsigned char buf[8]; + bfd_sym_data_struct *sdata = NULL; + + parser = NULL; + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (index == 0) + return -1; + + switch (sdata->version) + { + case BFD_SYM_VERSION_3_3: + case BFD_SYM_VERSION_3_2: + entry_size = 8; + parser = bfd_sym_parse_contained_statements_table_entry_v32; + break; + + case BFD_SYM_VERSION_3_5: + case BFD_SYM_VERSION_3_4: + case BFD_SYM_VERSION_3_1: + default: + break; + } + + if (parser == NULL) + return -1; + + offset = compute_offset (sdata->header.dshb_csnte.dti_first_page, + sdata->header.dshb_page_size, + entry_size, index); + + if (bfd_seek (abfd, offset, SEEK_SET) < 0) + return -1; + if (bfd_bread (buf, entry_size, abfd) != entry_size) + return -1; + + (*parser) (buf, entry_size, entry); + + return 0; +} + +int +bfd_sym_fetch_contained_labels_table_entry (abfd, entry, index) + bfd *abfd; + bfd_sym_contained_labels_table_entry *entry; + unsigned long index; +{ + void (*parser) PARAMS ((unsigned char *, size_t, + bfd_sym_contained_labels_table_entry *)); + unsigned long offset; + unsigned long entry_size = 0; + unsigned char buf[12]; + bfd_sym_data_struct *sdata = NULL; + + parser = NULL; + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (index == 0) + return -1; + + switch (sdata->version) + { + case BFD_SYM_VERSION_3_3: + case BFD_SYM_VERSION_3_2: + entry_size = 12; + parser = bfd_sym_parse_contained_labels_table_entry_v32; + break; + + case BFD_SYM_VERSION_3_5: + case BFD_SYM_VERSION_3_4: + case BFD_SYM_VERSION_3_1: + default: + break; + } + + if (parser == NULL) + return -1; + + offset = compute_offset (sdata->header.dshb_clte.dti_first_page, + sdata->header.dshb_page_size, + entry_size, index); + + if (bfd_seek (abfd, offset, SEEK_SET) < 0) + return -1; + if (bfd_bread (buf, entry_size, abfd) != entry_size) + return -1; + + (*parser) (buf, entry_size, entry); + + return 0; +} + +int +bfd_sym_fetch_contained_types_table_entry (abfd, entry, index) + bfd *abfd; + bfd_sym_contained_types_table_entry *entry; + unsigned long index; +{ + void (*parser) PARAMS ((unsigned char *, size_t, + bfd_sym_contained_types_table_entry *)); + unsigned long offset; + unsigned long entry_size = 0; + unsigned char buf[0]; + bfd_sym_data_struct *sdata = NULL; + + parser = NULL; + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (index == 0) + return -1; + + switch (sdata->version) + { + case BFD_SYM_VERSION_3_3: + case BFD_SYM_VERSION_3_2: + entry_size = 0; + parser = NULL; + break; + + case BFD_SYM_VERSION_3_5: + case BFD_SYM_VERSION_3_4: + case BFD_SYM_VERSION_3_1: + default: + break; + } + + if (parser == NULL) + return -1; + + offset = compute_offset (sdata->header.dshb_ctte.dti_first_page, + sdata->header.dshb_page_size, + entry_size, index); + + if (bfd_seek (abfd, offset, SEEK_SET) < 0) + return -1; + if (bfd_bread (buf, entry_size, abfd) != entry_size) + return -1; + + (*parser) (buf, entry_size, entry); + + return 0; +} + +int +bfd_sym_fetch_file_references_index_table_entry (abfd, entry, index) + bfd *abfd; + bfd_sym_file_references_index_table_entry *entry; + unsigned long index; +{ + void (*parser) PARAMS ((unsigned char *, size_t, + bfd_sym_file_references_index_table_entry *)); + unsigned long offset; + unsigned long entry_size = 0; + unsigned char buf[0]; + bfd_sym_data_struct *sdata = NULL; + + parser = NULL; + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (index == 0) + return -1; + + switch (sdata->version) + { + case BFD_SYM_VERSION_3_3: + case BFD_SYM_VERSION_3_2: + entry_size = 0; + parser = NULL; + break; + + case BFD_SYM_VERSION_3_5: + case BFD_SYM_VERSION_3_4: + case BFD_SYM_VERSION_3_1: + default: + break; + } + + if (parser == NULL) + return -1; + + offset = compute_offset (sdata->header.dshb_fite.dti_first_page, + sdata->header.dshb_page_size, + entry_size, index); + + if (bfd_seek (abfd, offset, SEEK_SET) < 0) + return -1; + if (bfd_bread (buf, entry_size, abfd) != entry_size) + return -1; + + (*parser) (buf, entry_size, entry); + + return 0; +} + +int +bfd_sym_fetch_constant_pool_entry (abfd, entry, index) + bfd *abfd; + bfd_sym_constant_pool_entry *entry; + unsigned long index; +{ + void (*parser) PARAMS ((unsigned char *, size_t, + bfd_sym_constant_pool_entry *)); + unsigned long offset; + unsigned long entry_size = 0; + unsigned char buf[0]; + bfd_sym_data_struct *sdata = NULL; + + parser = NULL; + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (index == 0) + return -1; + + switch (sdata->version) + { + case BFD_SYM_VERSION_3_3: + case BFD_SYM_VERSION_3_2: + entry_size = 0; + parser = NULL; + break; + + case BFD_SYM_VERSION_3_5: + case BFD_SYM_VERSION_3_4: + case BFD_SYM_VERSION_3_1: + default: + break; + } + + if (parser == NULL) + return -1; + + offset = compute_offset (sdata->header.dshb_fite.dti_first_page, + sdata->header.dshb_page_size, + entry_size, index); + + if (bfd_seek (abfd, offset, SEEK_SET) < 0) + return -1; + if (bfd_bread (buf, entry_size, abfd) != entry_size) + return -1; + + (*parser) (buf, entry_size, entry); + + return 0; +} + +int +bfd_sym_fetch_type_table_entry (abfd, entry, index) + bfd *abfd; + bfd_sym_type_table_entry *entry; + unsigned long index; +{ + void (*parser) PARAMS ((unsigned char *, size_t, + bfd_sym_type_table_entry *)); + unsigned long offset; + unsigned long entry_size = 0; + unsigned char buf[4]; + bfd_sym_data_struct *sdata = NULL; + + parser = NULL; + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + switch (sdata->version) + { + case BFD_SYM_VERSION_3_3: + case BFD_SYM_VERSION_3_2: + entry_size = 4; + parser = bfd_sym_parse_type_table_entry_v32; + break; + + case BFD_SYM_VERSION_3_5: + case BFD_SYM_VERSION_3_4: + case BFD_SYM_VERSION_3_1: + default: + break; + } + + if (parser == NULL) + return -1; + + offset = compute_offset (sdata->header.dshb_tte.dti_first_page, + sdata->header.dshb_page_size, + entry_size, index); + + if (bfd_seek (abfd, offset, SEEK_SET) < 0) + return -1; + if (bfd_bread (buf, entry_size, abfd) != entry_size) + return -1; + + (*parser) (buf, entry_size, entry); + + return 0; +} + +int +bfd_sym_fetch_type_information_table_entry (abfd, entry, offset) + bfd *abfd; + bfd_sym_type_information_table_entry *entry; + unsigned long offset; +{ + unsigned char buf[4]; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (offset == 0) + return -1; + + if (bfd_seek (abfd, offset, SEEK_SET) < 0) + return -1; + + if (bfd_bread (buf, 4, abfd) != 4) + return -1; + entry->nte_index = bfd_getb32 (buf); + + if (bfd_bread (buf, 2, abfd) != 2) + return -1; + entry->physical_size = bfd_getb16 (buf); + + if (entry->physical_size & 0x8000) + { + if (bfd_bread (buf, 4, abfd) != 4) + return -1; + entry->physical_size &= 0x7fff; + entry->logical_size = bfd_getb32 (buf); + entry->offset = offset + 10; + } + else + { + if (bfd_bread (buf, 2, abfd) != 2) + return -1; + entry->physical_size &= 0x7fff; + entry->logical_size = bfd_getb16 (buf); + entry->offset = offset + 8; + } + + return 0; +} + +int +bfd_sym_fetch_type_table_information (abfd, entry, index) + bfd *abfd; + bfd_sym_type_information_table_entry *entry; + unsigned long index; +{ + bfd_sym_type_table_entry tindex; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (sdata->header.dshb_tte.dti_object_count <= 99) + return -1; + if (index < 100) + return -1; + + if (bfd_sym_fetch_type_table_entry (abfd, &tindex, index - 100) < 0) + return -1; + if (bfd_sym_fetch_type_information_table_entry (abfd, entry, tindex) < 0) + return -1; + + return 0; +} + +const unsigned char * +bfd_sym_symbol_name (abfd, index) + bfd *abfd; + unsigned long index; +{ + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (index == 0) + return ""; + + index *= 2; + if ((index / sdata->header.dshb_page_size) + > sdata->header.dshb_nte.dti_page_count) + return "\009[INVALID]"; + + return (const unsigned char *) sdata->name_table + index; +} + +const unsigned char * +bfd_sym_module_name (abfd, index) + bfd *abfd; + unsigned long index; +{ + bfd_sym_modules_table_entry entry; + + if (bfd_sym_fetch_modules_table_entry (abfd, &entry, index) < 0) + return "\011[INVALID]"; + + return bfd_sym_symbol_name (abfd, entry.mte_nte_index); +} + +const char * +bfd_sym_unparse_storage_kind (kind) + enum bfd_sym_storage_kind kind; +{ + switch (kind) + { + case BFD_SYM_STORAGE_KIND_LOCAL: return "LOCAL"; + case BFD_SYM_STORAGE_KIND_VALUE: return "VALUE"; + case BFD_SYM_STORAGE_KIND_REFERENCE: return "REFERENCE"; + case BFD_SYM_STORAGE_KIND_WITH: return "WITH"; + default: return "[UNKNOWN]"; + } +} + +const char * +bfd_sym_unparse_storage_class (kind) + enum bfd_sym_storage_class kind; +{ + switch (kind) + { + case BFD_SYM_STORAGE_CLASS_REGISTER: return "REGISTER"; + case BFD_SYM_STORAGE_CLASS_GLOBAL: return "GLOBAL"; + case BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE: return "FRAME_RELATIVE"; + case BFD_SYM_STORAGE_CLASS_STACK_RELATIVE: return "STACK_RELATIVE"; + case BFD_SYM_STORAGE_CLASS_ABSOLUTE: return "ABSOLUTE"; + case BFD_SYM_STORAGE_CLASS_CONSTANT: return "CONSTANT"; + case BFD_SYM_STORAGE_CLASS_RESOURCE: return "RESOURCE"; + case BFD_SYM_STORAGE_CLASS_BIGCONSTANT: return "BIGCONSTANT"; + default: return "[UNKNOWN]"; + } +} + +const char * +bfd_sym_unparse_module_kind (kind) + enum bfd_sym_module_kind kind; +{ + switch (kind) + { + case BFD_SYM_MODULE_KIND_NONE: return "NONE"; + case BFD_SYM_MODULE_KIND_PROGRAM: return "PROGRAM"; + case BFD_SYM_MODULE_KIND_UNIT: return "UNIT"; + case BFD_SYM_MODULE_KIND_PROCEDURE: return "PROCEDURE"; + case BFD_SYM_MODULE_KIND_FUNCTION: return "FUNCTION"; + case BFD_SYM_MODULE_KIND_DATA: return "DATA"; + case BFD_SYM_MODULE_KIND_BLOCK: return "BLOCK"; + default: return "[UNKNOWN]"; + } +} + +const char * +bfd_sym_unparse_symbol_scope (scope) + enum bfd_sym_symbol_scope scope; +{ + switch (scope) + { + case BFD_SYM_SYMBOL_SCOPE_LOCAL: return "LOCAL"; + case BFD_SYM_SYMBOL_SCOPE_GLOBAL: return "GLOBAL"; + default: + return "[UNKNOWN]"; + } +} + +void +bfd_sym_print_file_reference (abfd, f, entry) + bfd *abfd; + FILE *f; + bfd_sym_file_reference *entry; +{ + bfd_sym_file_references_table_entry frtentry; + int ret; + + ret = bfd_sym_fetch_file_references_table_entry (abfd, &frtentry, + entry->fref_frte_index); + fprintf (f, "FILE "); + + if ((ret < 0) || (frtentry.generic.type != BFD_SYM_FILE_NAME_INDEX)) + fprintf (f, "[INVALID]"); + else + fprintf (f, "\"%.*s\"", + bfd_sym_symbol_name (abfd, frtentry.filename.nte_index)[0], + &bfd_sym_symbol_name (abfd, frtentry.filename.nte_index)[1]); + + fprintf (f, " (FRTE %lu)", entry->fref_frte_index); +} + +void +bfd_sym_print_resources_table_entry (abfd, f, entry) + bfd *abfd; + FILE *f; + bfd_sym_resources_table_entry *entry; +{ + fprintf (f, " \"%.*s\" (NTE %lu), type \"%.4s\", num %u, size %lu, MTE %lu -- %lu", + bfd_sym_symbol_name (abfd, entry->rte_nte_index)[0], + &bfd_sym_symbol_name (abfd, entry->rte_nte_index)[1], + entry->rte_nte_index, entry->rte_res_type, entry->rte_res_number, + entry->rte_res_size, entry->rte_mte_first, entry->rte_mte_last); +} + +void +bfd_sym_print_modules_table_entry (abfd, f, entry) + bfd *abfd; + FILE *f; + bfd_sym_modules_table_entry *entry; +{ + fprintf (f, "\"%.*s\" (NTE %lu)", + bfd_sym_symbol_name (abfd, entry->mte_nte_index)[0], + &bfd_sym_symbol_name (abfd, entry->mte_nte_index)[1], + entry->mte_nte_index); + + fprintf (f, "\n "); + + bfd_sym_print_file_reference (abfd, f, &entry->mte_imp_fref); + fprintf (f, " range %lu -- %lu", + entry->mte_imp_fref.fref_offset, entry->mte_imp_end); + + fprintf (f, "\n "); + + fprintf (f, "kind %s", bfd_sym_unparse_module_kind (entry->mte_kind)); + fprintf (f, ", scope %s", bfd_sym_unparse_symbol_scope (entry->mte_scope)); + + fprintf (f, ", RTE %lu, offset %lu, size %lu", + entry->mte_rte_index, entry->mte_res_offset, entry->mte_size); + + fprintf (f, "\n "); + + fprintf (f, "CMTE %lu, CVTE %lu, CLTE %lu, CTTE %lu, CSNTE1 %lu, CSNTE2 %lu", + entry->mte_cmte_index, entry->mte_cvte_index, + entry->mte_clte_index, entry->mte_ctte_index, + entry->mte_csnte_idx_1, entry->mte_csnte_idx_2); + + if (entry->mte_parent != 0) + fprintf (f, ", parent %lu", entry->mte_parent); + else + fprintf (f, ", no parent"); + + if (entry->mte_cmte_index != 0) + fprintf (f, ", child %lu", entry->mte_cmte_index); + else + fprintf (f, ", no child"); + +#if 0 + { + MTE bfd_sym_modules_table_entry pentry; + + ret = bfd_sym_fetch_modules_table_entry (abfd, &pentry, entry->mte_parent); + if (ret < 0) + fprintf (f, " parent MTE %lu [INVALID]\n", entry->mte_parent); + else + fprintf (f, " parent MTE %lu \"%.*s\"\n", + entry->mte_parent, + bfd_sym_symbol_name (abfd, pentry.mte_nte_index)[0], + &bfd_sym_symbol_name (abfd, pentry.mte_nte_index)[1]); + } +#endif +} + +void +bfd_sym_print_file_references_table_entry (abfd, f, entry) + bfd *abfd; + FILE *f; + bfd_sym_file_references_table_entry *entry; +{ + switch (entry->generic.type) + { + case BFD_SYM_FILE_NAME_INDEX: + fprintf (f, "FILE \"%.*s\" (NTE %lu), modtime ", + bfd_sym_symbol_name (abfd, entry->filename.nte_index)[0], + &bfd_sym_symbol_name (abfd, entry->filename.nte_index)[1], + entry->filename.nte_index); + + fprintf (f, "[UNIMPLEMENTED]"); + /* printModDate (entry->filename.mod_date); */ + fprintf (f, " (0x%lx)", entry->filename.mod_date); + break; + + case BFD_SYM_END_OF_LIST: + fprintf (f, "END"); + break; + + default: + fprintf (f, "\"%.*s\" (MTE %lu), offset %lu", + bfd_sym_module_name (abfd, entry->entry.mte_index)[0], + &bfd_sym_module_name (abfd, entry->entry.mte_index)[1], + entry->entry.mte_index, + entry->entry.file_offset); + break; + } +} + +void +bfd_sym_print_contained_modules_table_entry (abfd, f, entry) + bfd *abfd; + FILE *f; + bfd_sym_contained_modules_table_entry *entry; +{ + switch (entry->generic.type) + { + case BFD_SYM_END_OF_LIST: + fprintf (f, "END"); + break; + + default: + fprintf (f, "\"%.*s\" (MTE %lu, NTE %lu)", + bfd_sym_module_name (abfd, entry->entry.mte_index)[0], + &bfd_sym_module_name (abfd, entry->entry.mte_index)[1], + entry->entry.mte_index, + entry->entry.nte_index); + break; + } +} + +void +bfd_sym_print_contained_variables_table_entry (abfd, f, entry) + bfd *abfd; + FILE *f; + bfd_sym_contained_variables_table_entry *entry; +{ + if (entry->generic.type == BFD_SYM_END_OF_LIST) + { + fprintf (f, "END"); + return; + } + + if (entry->generic.type == BFD_SYM_SOURCE_FILE_CHANGE) + { + bfd_sym_print_file_reference (abfd, f, &entry->file.fref); + fprintf (f, " offset %lu", entry->file.fref.fref_offset); + return; + } + + fprintf (f, "\"%.*s\" (NTE %lu)", + bfd_sym_symbol_name (abfd, entry->entry.nte_index)[0], + &bfd_sym_symbol_name (abfd, entry->entry.nte_index)[1], + entry->entry.nte_index); + + fprintf (f, ", TTE %lu", entry->entry.tte_index); + fprintf (f, ", offset %lu", entry->entry.file_delta); + fprintf (f, ", scope %s", bfd_sym_unparse_symbol_scope (entry->entry.scope)); + + if (entry->entry.la_size == BFD_SYM_CVTE_SCA) + fprintf (f, ", latype %s, laclass %s, laoffset %lu", + bfd_sym_unparse_storage_kind (entry->entry.address.scstruct.sca_kind), + bfd_sym_unparse_storage_class (entry->entry.address.scstruct.sca_class), + entry->entry.address.scstruct.sca_offset); + else if (entry->entry.la_size <= BFD_SYM_CVTE_LA_MAX_SIZE) + { + unsigned long i; + + fprintf (f, ", la ["); + for (i = 0; i < entry->entry.la_size; i++) + fprintf (f, "0x%02x ", entry->entry.address.lastruct.la[i]); + fprintf (f, "]"); + } + else if (entry->entry.la_size == BFD_SYM_CVTE_BIG_LA) + fprintf (f, ", bigla %lu, biglakind %u", + entry->entry.address.biglastruct.big_la, + entry->entry.address.biglastruct.big_la_kind); + + else + fprintf (f, ", la [INVALID]"); +} + +void +bfd_sym_print_contained_statements_table_entry (abfd, f, entry) + bfd *abfd; + FILE *f; + bfd_sym_contained_statements_table_entry *entry; +{ + if (entry->generic.type == BFD_SYM_END_OF_LIST) + { + fprintf (f, "END"); + return; + } + + if (entry->generic.type == BFD_SYM_SOURCE_FILE_CHANGE) + { + bfd_sym_print_file_reference (abfd, f, &entry->file.fref); + fprintf (f, " offset %lu", entry->file.fref.fref_offset); + return; + } + + fprintf (f, "\"%.*s\" (MTE %lu), offset %lu, delta %lu", + bfd_sym_module_name (abfd, entry->entry.mte_index)[0], + &bfd_sym_module_name (abfd, entry->entry.mte_index)[1], + entry->entry.mte_index, + entry->entry.mte_offset, + entry->entry.file_delta); +} + +void +bfd_sym_print_contained_labels_table_entry (abfd, f, entry) + bfd *abfd; + FILE *f; + bfd_sym_contained_labels_table_entry *entry; +{ + if (entry->generic.type == BFD_SYM_END_OF_LIST) + { + fprintf (f, "END"); + return; + } + + if (entry->generic.type == BFD_SYM_SOURCE_FILE_CHANGE) + { + bfd_sym_print_file_reference (abfd, f, &entry->file.fref); + fprintf (f, " offset %lu", entry->file.fref.fref_offset); + return; + } + + fprintf (f, "\"%.*s\" (MTE %lu), offset %lu, delta %lu, scope %s", + bfd_sym_module_name (abfd, entry->entry.mte_index)[0], + &bfd_sym_module_name (abfd, entry->entry.mte_index)[1], + entry->entry.mte_index, + entry->entry.mte_offset, + entry->entry.file_delta, + bfd_sym_unparse_symbol_scope (entry->entry.scope)); +} + +void +bfd_sym_print_contained_types_table_entry (abfd, f, entry) + bfd *abfd ATTRIBUTE_UNUSED; + FILE *f; + bfd_sym_contained_types_table_entry *entry ATTRIBUTE_UNUSED; +{ + fprintf (f, "[UNIMPLEMENTED]"); +} + +const char * +bfd_sym_type_operator_name (num) + unsigned char num; +{ + switch (num) + { + case 1: return "TTE"; + case 2: return "PointerTo"; + case 3: return "ScalarOf"; + case 4: return "ConstantOf"; + case 5: return "EnumerationOf"; + case 6: return "VectorOf"; + case 7: return "RecordOf"; + case 8: return "UnionOf"; + case 9: return "SubRangeOf"; + case 10: return "SetOf"; + case 11: return "NamedTypeOf"; + case 12: return "ProcOf"; + case 13: return "ValueOf"; + case 14: return "ArrayOf"; + default: return "[UNKNOWN OPERATOR]"; + } +} + +const char * +bfd_sym_type_basic_name (num) + unsigned char num; +{ + switch (num) + { + case 0: return "void"; + case 1: return "pascal string"; + case 2: return "unsigned long"; + case 3: return "signed long"; + case 4: return "extended (10 bytes)"; + case 5: return "pascal boolean (1 byte)"; + case 6: return "unsigned byte"; + case 7: return "signed byte"; + case 8: return "character (1 byte)"; + case 9: return "wide character (2 bytes)"; + case 10: return "unsigned short"; + case 11: return "signed short"; + case 12: return "singled"; + case 13: return "double"; + case 14: return "extended (12 bytes)"; + case 15: return "computational (8 bytes)"; + case 16: return "c string"; + case 17: return "as-is string"; + default: return "[UNKNOWN BASIC TYPE]"; + } +} + +int +bfd_sym_fetch_long (buf, len, offset, offsetptr, value) + unsigned char *buf; + unsigned long len; + unsigned long offset; + unsigned long *offsetptr; + long *value; +{ + int ret; + + if (offset >= len) + { + *value = 0; + offset += 0; + ret = -1; + } + else if (! (buf[offset] & 0x80)) + { + *value = buf[offset]; + offset += 1; + ret = 0; + } + else if (buf[offset] == 0xc0) + { + if ((offset + 5) > len) + { + *value = 0; + offset = len; + ret = -1; + } + else + { + *value = bfd_getb32 (buf + offset + 1); + offset += 5; + ret = 0; + } + } + else if ((buf[offset] & 0xc0) == 0xc0) + { + *value = -(buf[offset] & 0x3f); + offset += 1; + ret = 0; + } + else if ((buf[offset] & 0xc0) == 0x80) + { + if ((offset + 2) > len) + { + *value = 0; + offset = len; + ret = -1; + } + else + { + *value = bfd_getb16 (buf + offset) & 0x3fff; + offset += 2; + ret = 0; + } + } + else + abort (); + + if (offsetptr != NULL) + *offsetptr = offset; + + return ret; +} + +void +bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr) + bfd *abfd; + FILE *f; + unsigned char *buf; + unsigned long len; + unsigned long offset; + unsigned long *offsetptr; +{ + unsigned int type; + + if (offset >= len) + { + fprintf (f, "[NULL]"); + + if (offsetptr != NULL) + *offsetptr = offset; + return; + } + + type = buf[offset]; + offset++; + + if (! (type & 0x80)) + { + fprintf (f, "[%s] (0x%x)", bfd_sym_type_basic_name (type & 0x7f), type); + + if (offsetptr != NULL) + *offsetptr = offset; + return; + } + + if (type & 0x40) + fprintf (f, "[packed "); + else + fprintf (f, "["); + + switch (type & 0x3f) + { + case 1: + { + long value; + bfd_sym_type_information_table_entry tinfo; + + bfd_sym_fetch_long (buf, len, offset, &offset, &value); + if (value <= 0) + fprintf (f, "[INVALID]"); + else + { + if (bfd_sym_fetch_type_table_information (abfd, &tinfo, value) < 0) + fprintf (f, "[INVALID]"); + else + fprintf (f, "\"%.*s\"", + bfd_sym_symbol_name (abfd, tinfo.nte_index)[0], + &bfd_sym_symbol_name (abfd, tinfo.nte_index)[1]); + } + fprintf (f, " (TTE %lu)", value); + break; + } + + case 2: + fprintf (f, "pointer (0x%x) to ", type); + bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); + break; + + case 3: + { + unsigned long value; + + fprintf (f, "scalar (0x%x) of ", type); + bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); + bfd_sym_fetch_long (buf, len, offset, &offset, &value); + fprintf (f, " (%lu)", value); + break; + } + + case 5: + { + unsigned long lower, upper, nelem; + unsigned long i; + + fprintf (f, "enumeration (0x%x) of ", type); + bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); + bfd_sym_fetch_long (buf, len, offset, &offset, &lower); + bfd_sym_fetch_long (buf, len, offset, &offset, &upper); + bfd_sym_fetch_long (buf, len, offset, &offset, &nelem); + fprintf (f, " from %lu to %lu with %lu elements: ", lower, upper, nelem); + + for (i = 0; i < nelem; i++) + { + fprintf (f, "\n "); + bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); + } + break; + } + + case 6: + fprintf (f, "vector (0x%x)", type); + fprintf (f, "\n index "); + bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); + fprintf (f, "\n target "); + bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); + break; + + case 7: + case 8: + { + long nrec, eloff, i; + + if ((type & 0x3f) == 7) + fprintf (f, "record (0x%x) of ", type); + else + fprintf (f, "union (0x%x) of ", type); + + bfd_sym_fetch_long (buf, len, offset, &offset, &nrec); + fprintf (f, "%lu elements: ", nrec); + + for (i = 0; i < nrec; i++) + { + bfd_sym_fetch_long (buf, len, offset, &offset, &eloff); + fprintf (f, "\n "); + fprintf (f, "offset %lu: ", eloff); + bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); + } + break; + } + + case 9: + fprintf (f, "subrange (0x%x) of ", type); + bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); + fprintf (f, " lower "); + bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); + fprintf (f, " upper "); + bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); + break; + + case 11: + { + long value; + + fprintf (f, "named type (0x%x) ", type); + bfd_sym_fetch_long (buf, len, offset, &offset, &value); + if (value <= 0) + fprintf (f, "[INVALID]"); + else + fprintf (f, "\"%.*s\"", + bfd_sym_symbol_name (abfd, value)[0], + &bfd_sym_symbol_name (abfd, value)[1]); + + fprintf (f, " (NTE %lu) with type ", value); + bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); + break; + } + + default: + fprintf (f, "%s (0x%x)", bfd_sym_type_operator_name (type), type); + break; + } + + if (type == (0x40 | 0x6)) + { + /* Vector. */ + long n, width, m; + long l; + long i; + + bfd_sym_fetch_long (buf, len, offset, &offset, &n); + bfd_sym_fetch_long (buf, len, offset, &offset, &width); + bfd_sym_fetch_long (buf, len, offset, &offset, &m); + /* fprintf (f, "\n "); */ + fprintf (f, " N %ld, width %ld, M %ld, ", n, width, m); + for (i = 0; i < m; i++) + { + bfd_sym_fetch_long (buf, len, offset, &offset, &l); + if (i != 0) + fprintf (f, " "); + fprintf (f, "%ld", l); + } + } + else if (type & 0x40) + { + /* Other packed type. */ + long msb, lsb; + + bfd_sym_fetch_long (buf, len, offset, &offset, &msb); + bfd_sym_fetch_long (buf, len, offset, &offset, &lsb); + /* fprintf (f, "\n "); */ + fprintf (f, " msb %ld, lsb %ld", msb, lsb); + } + + fprintf (f, "]"); + + if (offsetptr != NULL) + *offsetptr = offset; +} + +void +bfd_sym_print_type_information_table_entry (abfd, f, entry) + bfd *abfd; + FILE *f; + bfd_sym_type_information_table_entry *entry; +{ + unsigned char *buf; + unsigned long offset; + unsigned int i; + + fprintf (f, "\"%.*s\" (NTE %lu), %lu bytes at %lu, logical size %lu", + bfd_sym_symbol_name (abfd, entry->nte_index)[0], + &bfd_sym_symbol_name (abfd, entry->nte_index)[1], + entry->nte_index, + entry->physical_size, entry->offset, entry->logical_size); + + fprintf (f, "\n "); + + buf = alloca (entry->physical_size); + if (buf == NULL) + { + fprintf (f, "[ERROR]\n"); + return; + } + if (bfd_seek (abfd, entry->offset, SEEK_SET) < 0) + { + fprintf (f, "[ERROR]\n"); + return; + } + if (bfd_bread (buf, entry->physical_size, abfd) != entry->physical_size) + { + fprintf (f, "[ERROR]\n"); + return; + } + + fprintf (f, "["); + for (i = 0; i < entry->physical_size; i++) + { + if (i == 0) + fprintf (f, "0x%02x", buf[i]); + else + fprintf (f, " 0x%02x", buf[i]); + } + + fprintf (f, "]"); + fprintf (f, "\n "); + + bfd_sym_print_type_information (abfd, f, buf, entry->physical_size, 0, &offset); + + if (offset != entry->physical_size) + fprintf (f, "\n [parser used %lu bytes instead of %lu]", offset, entry->physical_size); } + +void +bfd_sym_print_file_references_index_table_entry (abfd, f, entry) + bfd *abfd ATTRIBUTE_UNUSED; + FILE *f; + bfd_sym_file_references_index_table_entry *entry ATTRIBUTE_UNUSED; +{ + fprintf (f, "[UNIMPLEMENTED]"); +} + +void +bfd_sym_print_constant_pool_entry (abfd, f, entry) + bfd *abfd ATTRIBUTE_UNUSED; + FILE *f; + bfd_sym_constant_pool_entry *entry ATTRIBUTE_UNUSED; +{ + fprintf (f, "[UNIMPLEMENTED]"); +} + +unsigned char * +bfd_sym_display_name_table_entry (abfd, f, entry) + bfd *abfd; + FILE *f; + unsigned char *entry; +{ + unsigned long index; + unsigned long offset; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + index = (entry - sdata->name_table) / 2; + + if (sdata->version >= BFD_SYM_VERSION_3_4 && entry[0] == 255 && entry[1] == 0) + { + unsigned short length = bfd_getb16 (entry + 2); + fprintf (f, "[%8lu] \"%.*s\"\n", index, length, entry + 4); + offset = 2 + length + 1; + } + else + { + if (! (entry[0] == 0 || (entry[0] == 1 && entry[1] == '\0'))) + fprintf (f, "[%8lu] \"%.*s\"\n", index, entry[0], entry + 1); + + if (sdata->version >= BFD_SYM_VERSION_3_4) + offset = entry[0] + 2; + else + offset = entry[0] + 1; + } + + return (entry + offset + (offset % 2)); +} + +void +bfd_sym_display_name_table (abfd, f) + bfd *abfd; + FILE *f; +{ + unsigned long name_table_len; + unsigned char *name_table, *name_table_end, *cur; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + name_table_len = sdata->header.dshb_nte.dti_page_count * sdata->header.dshb_page_size; + name_table = sdata->name_table; + name_table_end = name_table + name_table_len; + + fprintf (f, "name table (NTE) contains %lu bytes:\n\n", name_table_len); + + cur = name_table; + for (;;) + { + cur = bfd_sym_display_name_table_entry (abfd, f, cur); + if (cur >= name_table_end) + break; + } +} + +void +bfd_sym_display_resources_table (abfd, f) + bfd *abfd; + FILE *f; +{ + unsigned long i; + bfd_sym_resources_table_entry entry; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + fprintf (f, "resource table (RTE) contains %lu objects:\n\n", + sdata->header.dshb_rte.dti_object_count); + + for (i = 1; i <= sdata->header.dshb_rte.dti_object_count; i++) + { + if (bfd_sym_fetch_resources_table_entry (abfd, &entry, i) < 0) + fprintf (f, " [%8lu] [INVALID]\n", i); + else + { + fprintf (f, " [%8lu] ", i); + bfd_sym_print_resources_table_entry (abfd, f, &entry); + fprintf (f, "\n"); + } + } +} + +void +bfd_sym_display_modules_table (abfd, f) + bfd *abfd; + FILE *f; +{ + unsigned long i; + bfd_sym_modules_table_entry entry; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + fprintf (f, "module table (MTE) contains %lu objects:\n\n", + sdata->header.dshb_mte.dti_object_count); + + for (i = 1; i <= sdata->header.dshb_mte.dti_object_count; i++) + { + if (bfd_sym_fetch_modules_table_entry (abfd, &entry, i) < 0) + fprintf (f, " [%8lu] [INVALID]\n", i); + else + { + fprintf (f, " [%8lu] ", i); + bfd_sym_print_modules_table_entry (abfd, f, &entry); + fprintf (f, "\n"); + } + } +} + +void +bfd_sym_display_file_references_table (abfd, f) + bfd *abfd; + FILE *f; +{ + unsigned long i; + bfd_sym_file_references_table_entry entry; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + fprintf (f, "file reference table (FRTE) contains %lu objects:\n\n", + sdata->header.dshb_frte.dti_object_count); + + for (i = 1; i <= sdata->header.dshb_frte.dti_object_count; i++) + { + if (bfd_sym_fetch_file_references_table_entry (abfd, &entry, i) < 0) + fprintf (f, " [%8lu] [INVALID]\n", i); + else + { + fprintf (f, " [%8lu] ", i); + bfd_sym_print_file_references_table_entry (abfd, f, &entry); + fprintf (f, "\n"); + } + } +} + +void +bfd_sym_display_contained_modules_table (abfd, f) + bfd *abfd; + FILE *f; +{ + unsigned long i; + bfd_sym_contained_modules_table_entry entry; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + fprintf (f, "contained modules table (CMTE) contains %lu objects:\n\n", + sdata->header.dshb_cmte.dti_object_count); + + for (i = 1; i <= sdata->header.dshb_cmte.dti_object_count; i++) + { + if (bfd_sym_fetch_contained_modules_table_entry (abfd, &entry, i) < 0) + fprintf (f, " [%8lu] [INVALID]\n", i); + else + { + fprintf (f, " [%8lu] ", i); + bfd_sym_print_contained_modules_table_entry (abfd, f, &entry); + fprintf (f, "\n"); + } + } +} + +void +bfd_sym_display_contained_variables_table (abfd, f) + bfd *abfd; + FILE *f; +{ + unsigned long i; + bfd_sym_contained_variables_table_entry entry; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + fprintf (f, "contained variables table (CVTE) contains %lu objects:\n\n", + sdata->header.dshb_cvte.dti_object_count); + + for (i = 1; i <= sdata->header.dshb_cvte.dti_object_count; i++) + { + if (bfd_sym_fetch_contained_variables_table_entry (abfd, &entry, i) < 0) + fprintf (f, " [%8lu] [INVALID]\n", i); + else + { + fprintf (f, " [%8lu] ", i); + bfd_sym_print_contained_variables_table_entry (abfd, f, &entry); + fprintf (f, "\n"); + } + } + + fprintf (f, "\n"); +} + +void +bfd_sym_display_contained_statements_table (abfd, f) + bfd *abfd; + FILE *f; +{ + unsigned long i; + bfd_sym_contained_statements_table_entry entry; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + fprintf (f, "contained statements table (CSNTE) contains %lu objects:\n\n", + sdata->header.dshb_csnte.dti_object_count); + + for (i = 1; i <= sdata->header.dshb_csnte.dti_object_count; i++) + { + if (bfd_sym_fetch_contained_statements_table_entry (abfd, &entry, i) < 0) + fprintf (f, " [%8lu] [INVALID]\n", i); + else + { + fprintf (f, " [%8lu] ", i); + bfd_sym_print_contained_statements_table_entry (abfd, f, &entry); + fprintf (f, "\n"); + } + } +} + +void +bfd_sym_display_contained_labels_table (abfd, f) + bfd *abfd; + FILE *f; +{ + unsigned long i; + bfd_sym_contained_labels_table_entry entry; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + fprintf (f, "contained labels table (CLTE) contains %lu objects:\n\n", + sdata->header.dshb_clte.dti_object_count); + + for (i = 1; i <= sdata->header.dshb_clte.dti_object_count; i++) + { + if (bfd_sym_fetch_contained_labels_table_entry (abfd, &entry, i) < 0) + fprintf (f, " [%8lu] [INVALID]\n", i); + else + { + fprintf (f, " [%8lu] ", i); + bfd_sym_print_contained_labels_table_entry (abfd, f, &entry); + fprintf (f, "\n"); + } + } +} + +void +bfd_sym_display_contained_types_table (abfd, f) + bfd *abfd; + FILE *f; +{ + unsigned long i; + bfd_sym_contained_types_table_entry entry; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + fprintf (f, "contained types table (CTTE) contains %lu objects:\n\n", + sdata->header.dshb_ctte.dti_object_count); + + for (i = 1; i <= sdata->header.dshb_ctte.dti_object_count; i++) + { + if (bfd_sym_fetch_contained_types_table_entry (abfd, &entry, i) < 0) + fprintf (f, " [%8lu] [INVALID]\n", i); + else + { + fprintf (f, " [%8lu] ", i); + bfd_sym_print_contained_types_table_entry (abfd, f, &entry); + fprintf (f, "\n"); + } + } +} + +void +bfd_sym_display_file_references_index_table (abfd, f) + bfd *abfd; + FILE *f; +{ + unsigned long i; + bfd_sym_file_references_index_table_entry entry; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + fprintf (f, "file references index table (FITE) contains %lu objects:\n\n", + sdata->header.dshb_fite.dti_object_count); + + for (i = 1; i <= sdata->header.dshb_fite.dti_object_count; i++) + { + if (bfd_sym_fetch_file_references_index_table_entry (abfd, &entry, i) < 0) + fprintf (f, " [%8lu] [INVALID]\n", i); + else + { + fprintf (f, " [%8lu] ", i); + bfd_sym_print_file_references_index_table_entry (abfd, f, &entry); + fprintf (f, "\n"); + } + } +} + +void +bfd_sym_display_constant_pool (abfd, f) + bfd *abfd; + FILE *f; +{ + unsigned long i; + bfd_sym_constant_pool_entry entry; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + fprintf (f, "constant pool (CONST) contains %lu objects:\n\n", + sdata->header.dshb_const.dti_object_count); + + for (i = 1; i <= sdata->header.dshb_const.dti_object_count; i++) + { + if (bfd_sym_fetch_constant_pool_entry (abfd, &entry, i) < 0) + fprintf (f, " [%8lu] [INVALID]\n", i); + else + { + fprintf (f, " [%8lu] ", i); + bfd_sym_print_constant_pool_entry (abfd, f, &entry); + fprintf (f, "\n"); + } + } +} + +void +bfd_sym_display_type_information_table (abfd, f) + bfd *abfd; + FILE *f; +{ + unsigned long i; + bfd_sym_type_table_entry index; + bfd_sym_type_information_table_entry entry; + bfd_sym_data_struct *sdata = NULL; + + BFD_ASSERT (bfd_sym_valid (abfd)); + sdata = abfd->tdata.sym_data; + + if (sdata->header.dshb_tte.dti_object_count > 99) + fprintf (f, "type table (TINFO) contains %lu objects:\n\n", + sdata->header.dshb_tte.dti_object_count - 99); + else + { + fprintf (f, "type table (TINFO) contains [INVALID] objects:\n\n"); + return; + } + + for (i = 100; i <= sdata->header.dshb_tte.dti_object_count; i++) + { + if (bfd_sym_fetch_type_table_entry (abfd, &index, i - 100) < 0) + fprintf (f, " [%8lu] [INVALID]\n", i); + else + { + fprintf (f, " [%8lu] (TINFO %lu) ", i, index); + + if (bfd_sym_fetch_type_information_table_entry (abfd, &entry, index) < 0) + fprintf (f, "[INVALID]"); + else + bfd_sym_print_type_information_table_entry (abfd, f, &entry); + + fprintf (f, "\n"); + } + } +} + +int +bfd_sym_scan (abfd, version, mdata) + bfd *abfd; + bfd_sym_version version; + bfd_sym_data_struct *mdata; +{ + asection *bfdsec; + const char *name = "symbols"; + + mdata->name_table = 0; + mdata->sbfd = abfd; + mdata->version = version; + + bfd_seek (abfd, 0, SEEK_SET); + if (bfd_sym_read_header (abfd, &mdata->header, mdata->version) != 0) + return -1; + + mdata->name_table = bfd_sym_read_name_table (abfd, &mdata->header); + if (mdata->name_table == NULL) + return -1; + + bfdsec = bfd_make_section_anyway (abfd, name); + if (bfdsec == NULL) + return -1; + + bfdsec->vma = 0; + bfdsec->lma = 0; + bfdsec->_raw_size = 0; + bfdsec->filepos = 0; + bfdsec->alignment_power = 0; + + bfdsec->flags = SEC_HAS_CONTENTS; + + abfd->tdata.sym_data = mdata; + + return 0; +} + +const bfd_target * +bfd_sym_object_p (abfd) + bfd *abfd; +{ + struct bfd_preserve preserve; + bfd_sym_version version = -1; + + preserve.marker = NULL; + bfd_seek (abfd, 0, SEEK_SET); + if (bfd_sym_read_version (abfd, &version) != 0) + goto wrong; + + preserve.marker = bfd_alloc (abfd, sizeof (bfd_sym_data_struct)); + if (preserve.marker == NULL + || ! bfd_preserve_save (abfd, &preserve)) + goto fail; + + if (bfd_sym_scan (abfd, version, + (bfd_sym_data_struct *) preserve.marker) != 0) + goto wrong; + + bfd_preserve_finish (abfd, &preserve); + return abfd->xvec; + + wrong: + bfd_set_error (bfd_error_wrong_format); + + fail: + if (preserve.marker != NULL) + bfd_preserve_restore (abfd, &preserve); + return NULL; +} + +asymbol * +bfd_sym_make_empty_symbol (abfd) + bfd *abfd; +{ + return (asymbol *) bfd_alloc (abfd, sizeof (asymbol)); +} + +void +bfd_sym_get_symbol_info (abfd, symbol, ret) + bfd *abfd ATTRIBUTE_UNUSED; + asymbol *symbol; + symbol_info *ret; +{ + bfd_symbol_info (symbol, ret); +} + +long +bfd_sym_get_symtab_upper_bound (abfd) + bfd *abfd ATTRIBUTE_UNUSED; +{ + return 0; +} + +long +bfd_sym_canonicalize_symtab (abfd, sym) + bfd *abfd ATTRIBUTE_UNUSED; + asymbol **sym ATTRIBUTE_UNUSED; +{ + return 0; +} + +int +bfd_sym_sizeof_headers (abfd, exec) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_boolean exec ATTRIBUTE_UNUSED; +{ + return 0; +} + +const bfd_target sym_vec = +{ + "sym", /* name */ + bfd_target_sym_flavour, /* flavour */ + BFD_ENDIAN_BIG, /* byteorder */ + BFD_ENDIAN_BIG, /* header_byteorder */ + (HAS_RELOC | EXEC_P | /* object flags */ + HAS_LINENO | HAS_DEBUG | + HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), + (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA + | SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */ + 0, /* symbol_leading_char */ + ' ', /* ar_pad_char */ + 16, /* ar_max_namelen */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_getb64, bfd_getb_signed_64, bfd_putb64, + bfd_getb32, bfd_getb_signed_32, bfd_putb32, + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ + { /* bfd_check_format */ + _bfd_dummy_target, + bfd_sym_object_p, /* bfd_check_format */ + _bfd_dummy_target, + _bfd_dummy_target, + }, + { /* bfd_set_format */ + bfd_false, + bfd_sym_mkobject, + bfd_false, + bfd_false, + }, + { /* bfd_write_contents */ + bfd_false, + bfd_true, + bfd_false, + bfd_false, + }, + + BFD_JUMP_TABLE_GENERIC (bfd_sym), + BFD_JUMP_TABLE_COPY (_bfd_generic), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), + BFD_JUMP_TABLE_SYMBOLS (bfd_sym), + BFD_JUMP_TABLE_RELOCS (bfd_sym), + BFD_JUMP_TABLE_WRITE (bfd_sym), + BFD_JUMP_TABLE_LINK (bfd_sym), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + NULL +}; + diff --git a/bfd/xsym.h b/bfd/xsym.h new file mode 100644 index 0000000000000..7b36467588003 --- /dev/null +++ b/bfd/xsym.h @@ -0,0 +1,701 @@ +/* xSYM symbol-file support for BFD. + Copyright 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include "bfd.h" +#include + +#ifndef __xSYM_H__ +#define __xSYM_H__ + +#define BFD_SYM_VERSION_STR_3_1 "\013Version 3.1" +#define BFD_SYM_VERSION_STR_3_2 "\013Version 3.2" +#define BFD_SYM_VERSION_STR_3_3 "\013Version 3.3" +#define BFD_SYM_VERSION_STR_3_4 "\013Version 3.4" +#define BFD_SYM_VERSION_STR_3_5 "\013Version 3.5" +#define BFD_SYM_END_OF_LIST_3_2 0xffff +#define BFD_SYM_END_OF_LIST_3_4 0xffffffff +#define BFD_SYM_END_OF_LIST BFD_SYM_END_OF_LIST_3_4 +#define BFD_SYM_FILE_NAME_INDEX_3_2 0xfffe +#define BFD_SYM_FILE_NAME_INDEX_3_4 0xfffffffe +#define BFD_SYM_FILE_NAME_INDEX BFD_SYM_FILE_NAME_INDEX_3_4 +#define BFD_SYM_SOURCE_FILE_CHANGE_3_2 0xfffe +#define BFD_SYM_SOURCE_FILE_CHANGE_3_4 0xfffffffe +#define BFD_SYM_SOURCE_FILE_CHANGE BFD_SYM_SOURCE_FILE_CHANGE_3_4 +#define BFD_SYM_MAXIMUM_LEGAL_INDEX_3_2 0xfffd +#define BFD_SYM_MAXIMUM_LEGAL_INDEX_3_4 0xfffffffd +#define BFD_SYM_MAXIMUM_LEGAL_INDEX BFD_SYM_MAXIMUM_LEGAL_INDEX_3_4 + +enum bfd_sym_storage_class +{ + BFD_SYM_STORAGE_CLASS_REGISTER = 0, + BFD_SYM_STORAGE_CLASS_GLOBAL = 1, + BFD_SYM_STORAGE_CLASS_FRAME_RELATIVE = 2, + BFD_SYM_STORAGE_CLASS_STACK_RELATIVE = 3, + BFD_SYM_STORAGE_CLASS_ABSOLUTE = 4, + BFD_SYM_STORAGE_CLASS_CONSTANT = 5, + BFD_SYM_STORAGE_CLASS_BIGCONSTANT = 6, + BFD_SYM_STORAGE_CLASS_RESOURCE = 99 +}; +typedef enum bfd_sym_storage_class bfd_sym_storage_class; + +enum bfd_sym_storage_kind +{ + BFD_SYM_STORAGE_KIND_LOCAL = 0, + BFD_SYM_STORAGE_KIND_VALUE = 1, + BFD_SYM_STORAGE_KIND_REFERENCE = 2, + BFD_SYM_STORAGE_KIND_WITH = 3 +}; +typedef enum bfd_sym_storage_kind bfd_sym_storage_kind; + +enum bfd_sym_version +{ + BFD_SYM_VERSION_3_1, + BFD_SYM_VERSION_3_2, + BFD_SYM_VERSION_3_3, + BFD_SYM_VERSION_3_4, + BFD_SYM_VERSION_3_5 +}; +typedef enum bfd_sym_version bfd_sym_version; + +enum bfd_sym_module_kind +{ + BFD_SYM_MODULE_KIND_NONE = 0, + BFD_SYM_MODULE_KIND_PROGRAM = 1, + BFD_SYM_MODULE_KIND_UNIT = 2, + BFD_SYM_MODULE_KIND_PROCEDURE = 3, + BFD_SYM_MODULE_KIND_FUNCTION = 4, + BFD_SYM_MODULE_KIND_DATA = 5, + BFD_SYM_MODULE_KIND_BLOCK = 6 +}; +typedef enum bfd_sym_module_kind bfd_sym_module_kind; + +enum bfd_sym_symbol_scope +{ + BFD_SYM_SYMBOL_SCOPE_LOCAL = 0, /* Object is seen only inside current scope. */ + BFD_SYM_SYMBOL_SCOPE_GLOBAL = 1 /* Object has global scope. */ +}; +typedef enum bfd_sym_symbol_scope bfd_sym_symbol_scope; + +struct bfd_sym_file_reference +{ + unsigned long fref_frte_index; /* File reference table index. */ + unsigned long fref_offset; /* Absolute offset into source file. */ +}; +typedef struct bfd_sym_file_reference bfd_sym_file_reference; + +/* NAME TABLE (NTE). */ + +/* RESOURCES TABLE (RTE) + + All code and data is *defined* to reside in a resource. Even A5 + relative data is defined to reside in a dummy resource of ResType + 'gbld'. Code always resides in a resource. Because a code/data + is built of many modules, when walking through a resource we must + point back to the modules in the order they were defined. This is + done by requiring the entries in the Modules Entry table to be + ordered by resource/resource-number and by the location in that + resource. Hence, the resource table entry points to the first + module making up that resource. All modules table entries following + that first one with the same restype/resnum are contiguous and offset + from that first entry. */ + +struct bfd_sym_resources_table_entry +{ + unsigned char rte_res_type[4]; /* Resource Type. */ + unsigned short rte_res_number; /* Resource Number. */ + unsigned long rte_nte_index; /* Name of the resource. */ + unsigned long rte_mte_first; /* Index of first module in the resource. */ + unsigned long rte_mte_last; /* Index of the last module in the resource. */ + unsigned long rte_res_size; /* Size of the resource. */ +}; +typedef struct bfd_sym_resources_table_entry bfd_sym_resources_table_entry; + +/* MODULES TABLE (MTE) + + Modules table entries are ordered by their appearance in a resource. + (Note that having a single module copied into two resources is not + possible). Modules map back to their resource via an index into the + resource table and an offset into the resource. Modules also point + to their source files, both the definition module and implementation + module. Because modules can be textually nested within other + modules, a link to the parent (containing) module is required. This + module can textually contain other modules. A link to the contiguous + list of child (contained) modules is required. Variables, statements, + and types defined in the module are pointed to by indexing the head of + the contiguous lists of contained variables, contained statements, + and contained types. */ + +struct bfd_sym_modules_table_entry +{ + unsigned long mte_rte_index; /* Which resource it is in. */ + unsigned long mte_res_offset; /* Offset into the resource. */ + unsigned long mte_size; /* Size of module. */ + char mte_kind; /* What kind of module this is. */ + char mte_scope; /* How visible is it? */ + unsigned long mte_parent; /* Containing module. */ + bfd_sym_file_reference mte_imp_fref; /* Implementation source. */ + unsigned long mte_imp_end; /* End of implementation source. */ + unsigned long mte_nte_index; /* The name of the module. */ + unsigned long mte_cmte_index; /* Modules contained in this. */ + unsigned long mte_cvte_index; /* Variables contained in this. */ + unsigned long mte_clte_index; /* Local labels defined here. */ + unsigned long mte_ctte_index; /* Types contained in this. */ + unsigned long mte_csnte_idx_1; /* CSNTE index of mte_snbr_first. */ + unsigned long mte_csnte_idx_2; /* CSNTE index of mte_snbr_last. */ +}; +typedef struct bfd_sym_modules_table_entry bfd_sym_modules_table_entry; + +/* FILE REFERENCES TABLE (FRTE) + + The FILE REFERENCES TABLE maps from source file to module & offset. + The table is ordered by increasing file offset. Each new offset + references a module. + + FRT = FILE_SOURCE_START + FILE_SOURCE_INCREMENT* + END_OF_LIST. + + *** THIS MECHANISM IS VERY SLOW FOR FILE+STATEMENT_NUMBER TO + *** MODULE/CODE ADDRESS OPERATIONS. ANOTHER MECHANISM IS + *** REQUIRED!! */ + +union bfd_sym_file_references_table_entry +{ + struct + { + /* END_OF_LIST, FILE_NAME_INDEX, or module table entry. */ + unsigned long type; + } + generic; + + struct + { + /* FILE_NAME_INDEX. */ + unsigned long type; + unsigned long nte_index; + unsigned long mod_date; + } + filename; + + struct + { + /* < FILE_NAME_INDEX. */ + unsigned long mte_index; + unsigned long file_offset; + } + entry; +}; +typedef union bfd_sym_file_references_table_entry bfd_sym_file_references_table_entry; + +/* CONTAINED MODULES TABLE (CMTE) + + Contained Modules are lists of indices into the modules table. The + lists are terminated by an END_OF_LIST index. All entries are of the + same size, hence mapping an index into a CMTE list is simple. + + CMT = MTE_INDEX* END_OF_LIST. */ + +union bfd_sym_contained_modules_table_entry +{ + struct + { + /* END_OF_LIST, index. */ + unsigned long type; + } + generic; + + struct + { + unsigned long mte_index; /* Index into the Modules Table. */ + unsigned long nte_index; /* The name of the module. */ + } + entry; +}; +typedef union bfd_sym_contained_modules_table_entry bfd_sym_contained_modules_table_entry; + +/* CONTAINED VARIABLES TABLE (CVTE) + + Contained Variables map into the module table, file table, name table, and type + table. Contained Variables are a contiguous list of source file change record, + giving the name of and offset into the source file corresponding to all variables + following. Variable definition records contain an index into the name table (giving + the text of the variable as it appears in the source code), an index into the type + table giving the type of the variable, an increment added to the source file + offset giving the start of the implementation of the variable, and a storage + class address, giving information on variable's runtime address. + + CVT = SOURCE_FILE_CHANGE SYMBOL_INFO* END_OF_LIST. + SYMBOL_INFO = SYMBOL_DEFINITION | SOURCE_FILE_CHANGE . + + All entries are of the same size, making the fetching of data simple. The + variable entries in the list are in ALPHABETICAL ORDER to simplify the display of + available variables for several of the debugger's windows. */ + +/* 'la_size' determines the variant used below: + + == BFD_SYM_CVTE_SCA + Traditional STORAGE_CLASS_ADDRESS; + + <= BFD_SYM_CVTE_LA_MAX_SIZE + That many logical address bytes ("in-situ"); + + == BFD_SYM_CVTE_BIG_LA + Logical address bytes in constant pool, at offset 'big_la'. */ + +#define BFD_SYM_CVTE_SCA 0 /* Indicate SCA variant of CVTE. */ +#define BFD_SYM_CVTE_LA_MAX_SIZE 13 /* Max# of logical address bytes in a CVTE. */ +#define BFD_SYM_CVTE_BIG_LA 127 /* Indicates LA redirection to constant pool. */ + +union bfd_sym_contained_variables_table_entry +{ + struct + { + /* END_OF_LIST, SOURCE_FILE_CHANGE, or type table entry. */ + unsigned long type; + } + generic; + + struct + { + /* SOURCE_FILE_CHANGE. */ + unsigned long type; + bfd_sym_file_reference fref; + } + file; + + struct + { + /* < SOURCE_FILE_CHANGE. */ + unsigned long tte_index; + unsigned long nte_index; + unsigned long file_delta; /* Increment from previous source. */ + unsigned char scope; + unsigned char la_size; /* #bytes of LAs below. */ + + union + { + /* la_size == BFD_SYM_CVTE_SCA. */ + struct + { + unsigned char sca_kind; /* Distinguish local from value/var formal. */ + unsigned char sca_class; /* The storage class itself. */ + unsigned long sca_offset; + } + scstruct; + + /* la_size <= BFD_SYM_CVTE_LA_MAX_SIZE. */ + struct { + unsigned char la[BFD_SYM_CVTE_LA_MAX_SIZE]; /* Logical address bytes. */ + unsigned char la_kind; /* Eqv. cvte_location.sca_kind. */ + } + lastruct; + + /* la_size == BFD_SYM_CVTE_BIG_LA 127. */ + struct + { + unsigned long big_la; /* Logical address bytes in constant pool. */ + unsigned char big_la_kind; /* Eqv. cvte_location.sca_kind. */ + } + biglastruct; + } + address; + } + entry; +}; +typedef union bfd_sym_contained_variables_table_entry bfd_sym_contained_variables_table_entry; + +/* CONTAINED STATEMENTS TABLE (CSNTE) + + Contained Statements table. This table is similar to the Contained + Variables table except that instead of VARIABLE_DEFINITION entries, this + module contains STATEMENT_NUMBER_DEFINITION entries. A statement number + definition points back to the containing module (via an index into + the module entry table) and contains the file and resource deltas + to add to the previous values to get to this statement. + All entries are of the same size, making the fetching of data simple. The + entries in the table are in order of increasing statement number within the + source file. + + The Contained Statements table is indexed from two places. An MTE contains + an index to the first statement number within the module. An FRTE contains + an index to the first statement in the table (Possibly. This is slow.) Or + a table of fast statement number to CSNTE entry mappings indexes into the + table. Choice not yet made. */ + +union bfd_sym_contained_statements_table_entry +{ + struct + { + /* END_OF_LIST, SOURCE_FILE_CHANGE, or statement table entry. */ + unsigned long type; + } + generic; + + struct + { + /* SOURCE_FILE_CHANGE. */ + unsigned long type; + bfd_sym_file_reference fref; /* File name table. */ + } + file; + + struct + { + unsigned long mte_index; /* Which module contains it. */ + unsigned long file_delta; /* Where it is defined. */ + unsigned long mte_offset; /* Where it is in the module. */ + } + entry; +}; +typedef union bfd_sym_contained_statements_table_entry bfd_sym_contained_statements_table_entry; + +/* CONTAINED LABELS TABLE (CLTE) + + Contained Labels table names those labels local to the module. It is similar + to the Contained Statements table. */ + +union bfd_sym_contained_labels_table_entry +{ + struct + { + /* END_OF_LIST, SOURCE_FILE_CHANGE, index. */ + unsigned long type; + } + generic; + + struct + { + /* SOURCE_FILE_CHANGE. */ + unsigned long type; + bfd_sym_file_reference fref; + } + file; + + struct + { + /* < SOURCE_FILE_CHANGE. */ + unsigned long mte_index; /* Which module contains us. */ + unsigned long mte_offset; /* Where it is in the module. */ + unsigned long nte_index; /* The name of the label. */ + unsigned long file_delta; /* Where it is defined. */ + unsigned short scope; /* How visible the label is. */ + } + entry; +}; +typedef union bfd_sym_contained_labels_table_entry bfd_sym_contained_labels_table_entry; + +/* CONTAINED TYPES TABLE (CTTE) + + Contained Types define the named types that are in the module. It is used to + map name indices into type indices. The type entries in the table are in + alphabetical order by type name. */ + +union bfd_sym_contained_types_table_entry +{ + struct + { + /* END_OF_LIST, SOURCE_FILE_CHANGE, or type table entry. */ + unsigned long type; + } + generic; + + struct + { + /* SOURCE_FILE_CHANGE. */ + unsigned long type; + bfd_sym_file_reference fref; + } + file; + + struct + { + /* < SOURCE_FILE_CHANGE. */ + unsigned long tte_index; + unsigned long nte_index; + unsigned long file_delta; /* From last file definition. */ + } + entry; +}; +typedef union bfd_sym_contained_types_table_entry bfd_sym_contained_types_table_entry; + +/* TYPE TABLE (TTE). */ + +typedef unsigned long bfd_sym_type_table_entry; + +/* TYPE INFORMATION TABLE (TINFO). */ + +struct bfd_sym_type_information_table_entry +{ + unsigned long nte_index; + unsigned long physical_size; + unsigned long logical_size; + unsigned long offset; +}; +typedef struct bfd_sym_type_information_table_entry bfd_sym_type_information_table_entry; + +/* FILE REFERENCES INDEX TABLE (FITE) + + The FRTE INDEX TABLE indexes into the FILE REFERENCE TABLE above. The FRTE + at that index is the FILE_SOURCE_START for a series of files. The FRTEs are + indexed from 1. The list is terminated with an END_OF_LIST. */ + +union bfd_sym_file_references_index_table_entry +{ + struct + { + unsigned long type; + } + generic; + + struct + { + unsigned long frte_index; /* Index into the FRTE table. */ + unsigned long nte_index; /* Name table index, gives filename. */ + } + entry; +}; +typedef union bfd_sym_file_references_index_table_entry bfd_sym_file_references_index_table_entry; + +/* CONSTANT POOL (CONST) + + The CONSTANT_POOL consists of entries that start on word boundaries. The entries + are referenced by byte index into the constant pool, not by record number. + + Each entry takes the form: + + <16-bit size> + + + Entries do not cross page boundaries. */ + +typedef short bfd_sym_constant_pool_entry; + +/* The DISK_SYMBOL_HEADER_BLOCK is the first record in a .SYM file, + defining the physical characteristics of the symbolic information. + The remainder of the * .SYM file is stored in fixed block + allocations. For the purposes of paging, the * file is considered + to be an array of dshb_page_size blocks, with block 0 (and * + possibly more) devoted to the DISK_SYMBOL_HEADER_BLOCK. + + The dti_object_count field means that the allowed indices for that + type of object are 0 .. dti_object_count. An index of 0, although + allowed, is never done. However, an 0th entry is created in the + table. That entry is filled with all zeroes. The reason for this + is to avoid off-by-one programming errors that would otherwise + occur: an index of k *MEANS* k, not k-1 when going to the disk + table. */ + +struct bfd_sym_table_info +{ + unsigned long dti_first_page; /* First page for this table. */ + unsigned long dti_page_count; /* Number of pages for the table. */ + unsigned long dti_object_count; /* Number of objects in the table. */ +}; +typedef struct bfd_sym_table_info bfd_sym_table_info; + +struct bfd_sym_header_block +{ + unsigned char dshb_id[32]; /* Version information. */ + unsigned short dshb_page_size; /* Size of the pages/blocks. */ + unsigned long dshb_hash_page; /* Disk page for the hash table. */ + unsigned long dshb_root_mte; /* MTE index of the program root. */ + unsigned long dshb_mod_date; /* modification date of executable. */ + bfd_sym_table_info dshb_frte; /* Per TABLE information. */ + bfd_sym_table_info dshb_rte; + bfd_sym_table_info dshb_mte; + bfd_sym_table_info dshb_cmte; + bfd_sym_table_info dshb_cvte; + bfd_sym_table_info dshb_csnte; + bfd_sym_table_info dshb_clte; + bfd_sym_table_info dshb_ctte; + bfd_sym_table_info dshb_tte; + bfd_sym_table_info dshb_nte; + bfd_sym_table_info dshb_tinfo; + bfd_sym_table_info dshb_fite; /* File information. */ + bfd_sym_table_info dshb_const; /* Constant pool. */ + + unsigned char dshb_file_creator[4]; /* Executable's creator. */ + unsigned char dshb_file_type[4]; /* Executable's file type. */ +}; +typedef struct bfd_sym_header_block bfd_sym_header_block; + +struct bfd_sym_data_struct +{ + unsigned char *name_table; + bfd_sym_header_block header; + bfd_sym_version version; + bfd *sbfd; +}; +typedef struct bfd_sym_data_struct bfd_sym_data_struct; + +extern bfd_boolean bfd_sym_mkobject + PARAMS ((bfd *)); +extern void bfd_sym_print_symbol + PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); +extern bfd_boolean bfd_sym_valid + PARAMS ((bfd *)); +extern unsigned char * bfd_sym_read_name_table + PARAMS ((bfd *, bfd_sym_header_block *)); +extern void bfd_sym_parse_file_reference_v32 + PARAMS ((unsigned char *, size_t, bfd_sym_file_reference *)); +extern void bfd_sym_parse_disk_table_v32 + PARAMS ((unsigned char *, size_t, bfd_sym_table_info *)); +extern void bfd_sym_parse_header_v32 + PARAMS ((unsigned char *, size_t, bfd_sym_header_block *)); +extern int bfd_sym_read_header_v32 + PARAMS ((bfd *, bfd_sym_header_block *)); +extern int bfd_sym_read_header_v34 + PARAMS ((bfd *, bfd_sym_header_block *)); +extern int bfd_sym_read_header + PARAMS ((bfd *, bfd_sym_header_block *, bfd_sym_version)); +extern int bfd_sym_read_version + PARAMS ((bfd *, bfd_sym_version *)); +extern void bfd_sym_display_table_summary + PARAMS ((FILE *, bfd_sym_table_info *, const char *)); +extern void bfd_sym_display_header + PARAMS ((FILE *, bfd_sym_header_block *)); +extern void bfd_sym_parse_resources_table_entry_v32 + PARAMS ((unsigned char *, size_t, bfd_sym_resources_table_entry *)); +extern void bfd_sym_parse_modules_table_entry_v33 + PARAMS ((unsigned char *, size_t, bfd_sym_modules_table_entry *)); +extern void bfd_sym_parse_file_references_table_entry_v32 + PARAMS ((unsigned char *, size_t, bfd_sym_file_references_table_entry *)); +extern void bfd_sym_parse_contained_modules_table_entry_v32 + PARAMS ((unsigned char *, size_t, bfd_sym_contained_modules_table_entry *)); +extern void bfd_sym_parse_contained_variables_table_entry_v32 + PARAMS ((unsigned char *, size_t, bfd_sym_contained_variables_table_entry *)); +extern void bfd_sym_parse_contained_statements_table_entry_v32 + PARAMS ((unsigned char *, size_t, bfd_sym_contained_statements_table_entry *)); +extern void bfd_sym_parse_contained_labels_table_entry_v32 + PARAMS ((unsigned char *, size_t, bfd_sym_contained_labels_table_entry *)); +extern void bfd_sym_parse_type_table_entry_v32 + PARAMS ((unsigned char *, size_t, bfd_sym_type_table_entry *)); +extern int bfd_sym_fetch_resources_table_entry + PARAMS ((bfd *, bfd_sym_resources_table_entry *, unsigned long)); +extern int bfd_sym_fetch_modules_table_entry + PARAMS ((bfd *, bfd_sym_modules_table_entry *, unsigned long)); +extern int bfd_sym_fetch_file_references_table_entry + PARAMS ((bfd *, bfd_sym_file_references_table_entry *, unsigned long)); +extern int bfd_sym_fetch_contained_modules_table_entry + PARAMS ((bfd *, bfd_sym_contained_modules_table_entry *, unsigned long)); +extern int bfd_sym_fetch_contained_variables_table_entry + PARAMS ((bfd *, bfd_sym_contained_variables_table_entry *, unsigned long)); +extern int bfd_sym_fetch_contained_statements_table_entry + PARAMS ((bfd *, bfd_sym_contained_statements_table_entry *, unsigned long)); +extern int bfd_sym_fetch_contained_labels_table_entry + PARAMS ((bfd *, bfd_sym_contained_labels_table_entry *, unsigned long)); +extern int bfd_sym_fetch_contained_types_table_entry + PARAMS ((bfd *, bfd_sym_contained_types_table_entry *, unsigned long)); +extern int bfd_sym_fetch_file_references_index_table_entry + PARAMS ((bfd *, bfd_sym_file_references_index_table_entry *, unsigned long)); +extern int bfd_sym_fetch_constant_pool_entry + PARAMS ((bfd *, bfd_sym_constant_pool_entry *, unsigned long)); +extern int bfd_sym_fetch_type_table_entry + PARAMS ((bfd *, bfd_sym_type_table_entry *, unsigned long)); +extern int bfd_sym_fetch_type_information_table_entry + PARAMS ((bfd *, bfd_sym_type_information_table_entry *, unsigned long)); +extern int bfd_sym_fetch_type_table_information + PARAMS ((bfd *, bfd_sym_type_information_table_entry *, unsigned long)); +extern const unsigned char * bfd_sym_symbol_name + PARAMS ((bfd *, unsigned long)); +extern const unsigned char * bfd_sym_module_name + PARAMS ((bfd *, unsigned long)); +extern const char * bfd_sym_unparse_storage_kind + PARAMS ((enum bfd_sym_storage_kind)); +extern const char * bfd_sym_unparse_storage_class + PARAMS ((enum bfd_sym_storage_class)); +extern const char * bfd_sym_unparse_module_kind + PARAMS ((enum bfd_sym_module_kind)); +extern const char * bfd_sym_unparse_symbol_scope + PARAMS ((enum bfd_sym_symbol_scope)); +extern void bfd_sym_print_file_reference + PARAMS ((bfd *, FILE *, bfd_sym_file_reference *)); +extern void bfd_sym_print_resources_table_entry + PARAMS ((bfd *, FILE *, bfd_sym_resources_table_entry *)); +extern void bfd_sym_print_modules_table_entry + PARAMS ((bfd *, FILE *, bfd_sym_modules_table_entry *)); +extern void bfd_sym_print_file_references_table_entry + PARAMS ((bfd *, FILE *, bfd_sym_file_references_table_entry *)); +extern void bfd_sym_print_contained_modules_table_entry + PARAMS ((bfd *, FILE *, bfd_sym_contained_modules_table_entry *)); +extern void bfd_sym_print_contained_variables_table_entry + PARAMS ((bfd *, FILE *f, bfd_sym_contained_variables_table_entry *)); +extern void bfd_sym_print_contained_statements_table_entry + PARAMS ((bfd *, FILE *, bfd_sym_contained_statements_table_entry *)); +extern void bfd_sym_print_contained_labels_table_entry + PARAMS ((bfd *, FILE *, bfd_sym_contained_labels_table_entry *)); +extern void bfd_sym_print_contained_types_table_entry + PARAMS ((bfd *, FILE *, bfd_sym_contained_types_table_entry *)); +extern const char * bfd_sym_type_operator_name + PARAMS ((unsigned char)); +extern const char * bfd_sym_type_basic_name + PARAMS ((unsigned char)); +extern int bfd_sym_fetch_long + PARAMS ((unsigned char *, unsigned long, unsigned long, unsigned long *, long *)); +extern void bfd_sym_print_type_information + PARAMS ((bfd *, FILE *, unsigned char *, unsigned long, unsigned long, unsigned long *)); +extern void bfd_sym_print_type_information_table_entry + PARAMS ((bfd *, FILE *, bfd_sym_type_information_table_entry *)); +extern void bfd_sym_print_file_references_index_table_entry + PARAMS ((bfd *, FILE *, bfd_sym_file_references_index_table_entry *)); +extern void bfd_sym_print_constant_pool_entry + PARAMS ((bfd *, FILE *, bfd_sym_constant_pool_entry *)); +extern unsigned char * bfd_sym_display_name_table_entry + PARAMS ((bfd *, FILE *, unsigned char *)); +extern void bfd_sym_display_name_table + PARAMS ((bfd *, FILE *)); +extern void bfd_sym_display_resources_table + PARAMS ((bfd *, FILE *)); +extern void bfd_sym_display_modules_table + PARAMS ((bfd *, FILE *)); +extern void bfd_sym_display_file_references_table + PARAMS ((bfd *, FILE *)); +extern void bfd_sym_display_contained_modules_table + PARAMS ((bfd *, FILE *)); +extern void bfd_sym_display_contained_variables_table + PARAMS ((bfd *, FILE *)); +extern void bfd_sym_display_contained_statements_table + PARAMS ((bfd *, FILE *)); +extern void bfd_sym_display_contained_labels_table + PARAMS ((bfd *, FILE *)); +extern void bfd_sym_display_contained_types_table + PARAMS ((bfd *, FILE *)); +extern void bfd_sym_display_file_references_index_table + PARAMS ((bfd *, FILE *)); +extern void bfd_sym_display_constant_pool + PARAMS ((bfd *, FILE *)); +extern void bfd_sym_display_type_information_table + PARAMS ((bfd *, FILE *)); +extern int bfd_sym_scan + PARAMS ((bfd *, bfd_sym_version, bfd_sym_data_struct *)); +extern const bfd_target * bfd_sym_object_p + PARAMS ((bfd *)); +extern asymbol * bfd_sym_make_empty_symbol + PARAMS ((bfd *)); +extern void bfd_sym_get_symbol_info + PARAMS ((bfd *, asymbol *, symbol_info *)); +extern long bfd_sym_get_symtab_upper_bound + PARAMS ((bfd *)); +extern long bfd_sym_canonicalize_symtab + PARAMS ((bfd *, asymbol **)); +extern int bfd_sym_sizeof_headers + PARAMS ((bfd *, bfd_boolean)); + +#endif /* __xSYM_H__ */ diff --git a/bfd/xtensa-isa.c b/bfd/xtensa-isa.c new file mode 100644 index 0000000000000..761e5c6bb697e --- /dev/null +++ b/bfd/xtensa-isa.c @@ -0,0 +1,593 @@ +/* Configurable Xtensa ISA support. + Copyright 2003 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include +#include +#include +#include + +#include "xtensa-isa.h" +#include "xtensa-isa-internal.h" + +xtensa_isa xtensa_default_isa = NULL; + +static int +opname_lookup_compare (const void *v1, const void *v2) +{ + opname_lookup_entry *e1 = (opname_lookup_entry *)v1; + opname_lookup_entry *e2 = (opname_lookup_entry *)v2; + + return strcmp (e1->key, e2->key); +} + + +xtensa_isa +xtensa_isa_init (void) +{ + xtensa_isa isa; + int mod; + + isa = xtensa_load_isa (0); + if (isa == 0) + { + fprintf (stderr, "Failed to initialize Xtensa base ISA module\n"); + return NULL; + } + + for (mod = 1; xtensa_isa_modules[mod].get_num_opcodes_fn; mod++) + { + if (!xtensa_extend_isa (isa, mod)) + { + fprintf (stderr, "Failed to initialize Xtensa TIE ISA module\n"); + return NULL; + } + } + + return isa; +} + +/* ISA information. */ + +static int +xtensa_check_isa_config (xtensa_isa_internal *isa, + struct config_struct *config_table) +{ + int i, j; + + if (!config_table) + { + fprintf (stderr, "Error: Empty configuration table in ISA DLL\n"); + return 0; + } + + /* For the first module, save a pointer to the table and record the + specified endianness and availability of the density option. */ + + if (isa->num_modules == 0) + { + int found_memory_order = 0; + + isa->config = config_table; + isa->has_density = 1; /* Default to have density option. */ + + for (i = 0; config_table[i].param_name; i++) + { + if (!strcmp (config_table[i].param_name, "IsaMemoryOrder")) + { + isa->is_big_endian = + (strcmp (config_table[i].param_value, "BigEndian") == 0); + found_memory_order = 1; + } + if (!strcmp (config_table[i].param_name, "IsaUseDensityInstruction")) + { + isa->has_density = atoi (config_table[i].param_value); + } + } + if (!found_memory_order) + { + fprintf (stderr, "Error: \"IsaMemoryOrder\" missing from " + "configuration table in ISA DLL\n"); + return 0; + } + + return 1; + } + + /* For subsequent modules, check that the parameters match. Note: This + code is sufficient to handle the current model where there are never + more than 2 modules; we might at some point want to handle cases where + module N > 0 specifies some parameters not included in the base table, + and we would then add those to isa->config so that subsequent modules + would check against them. */ + + for (i = 0; config_table[i].param_name; i++) + { + for (j = 0; isa->config[j].param_name; j++) + { + if (!strcmp (config_table[i].param_name, isa->config[j].param_name)) + { + int mismatch; + if (!strcmp (config_table[i].param_name, "IsaCoprocessorCount")) + { + /* Only require the coprocessor count to be <= the base. */ + int tiecnt = atoi (config_table[i].param_value); + int basecnt = atoi (isa->config[j].param_value); + mismatch = (tiecnt > basecnt); + } + else + mismatch = strcmp (config_table[i].param_value, + isa->config[j].param_value); + if (mismatch) + { +#define MISMATCH_MESSAGE \ +"Error: Configuration mismatch in the \"%s\" parameter:\n\ +the configuration used when the TIE file was compiled had a value of\n\ +\"%s\", while the current configuration has a value of\n\ +\"%s\". Please rerun the TIE compiler with a matching\n\ +configuration.\n" + fprintf (stderr, MISMATCH_MESSAGE, + config_table[i].param_name, + config_table[i].param_value, + isa->config[j].param_value); + return 0; + } + break; + } + } + } + + return 1; +} + + +static int +xtensa_add_isa (xtensa_isa_internal *isa, libisa_module_specifier libisa) +{ + int (*get_num_opcodes_fn) (void); + struct config_struct *(*get_config_table_fn) (void); + xtensa_opcode_internal **(*get_opcodes_fn) (void); + int (*decode_insn_fn) (const xtensa_insnbuf); + xtensa_opcode_internal **opcodes; + int opc, insn_size, prev_num_opcodes, new_num_opcodes, this_module; + + get_num_opcodes_fn = xtensa_isa_modules[libisa].get_num_opcodes_fn; + get_opcodes_fn = xtensa_isa_modules[libisa].get_opcodes_fn; + decode_insn_fn = xtensa_isa_modules[libisa].decode_insn_fn; + get_config_table_fn = xtensa_isa_modules[libisa].get_config_table_fn; + + if (!get_num_opcodes_fn || !get_opcodes_fn || !decode_insn_fn + || (!get_config_table_fn && isa->num_modules == 0)) + return 0; + + if (get_config_table_fn + && !xtensa_check_isa_config (isa, get_config_table_fn ())) + return 0; + + prev_num_opcodes = isa->num_opcodes; + new_num_opcodes = (*get_num_opcodes_fn) (); + + isa->num_opcodes += new_num_opcodes; + isa->opcode_table = (xtensa_opcode_internal **) + realloc (isa->opcode_table, isa->num_opcodes * + sizeof (xtensa_opcode_internal *)); + isa->opname_lookup_table = (opname_lookup_entry *) + realloc (isa->opname_lookup_table, isa->num_opcodes * + sizeof (opname_lookup_entry)); + + opcodes = (*get_opcodes_fn) (); + + insn_size = isa->insn_size; + for (opc = 0; opc < new_num_opcodes; opc++) + { + xtensa_opcode_internal *intopc = opcodes[opc]; + int newopc = prev_num_opcodes + opc; + isa->opcode_table[newopc] = intopc; + isa->opname_lookup_table[newopc].key = intopc->name; + isa->opname_lookup_table[newopc].opcode = newopc; + if (intopc->length > insn_size) + insn_size = intopc->length; + } + + isa->insn_size = insn_size; + isa->insnbuf_size = ((isa->insn_size + sizeof (xtensa_insnbuf_word) - 1) / + sizeof (xtensa_insnbuf_word)); + + qsort (isa->opname_lookup_table, isa->num_opcodes, + sizeof (opname_lookup_entry), opname_lookup_compare); + + /* Check for duplicate opcode names. */ + for (opc = 1; opc < isa->num_opcodes; opc++) + { + if (!opname_lookup_compare (&isa->opname_lookup_table[opc-1], + &isa->opname_lookup_table[opc])) + { + fprintf (stderr, "Error: Duplicate TIE opcode \"%s\"\n", + isa->opname_lookup_table[opc].key); + return 0; + } + } + + this_module = isa->num_modules; + isa->num_modules += 1; + + isa->module_opcode_base = (int *) realloc (isa->module_opcode_base, + isa->num_modules * sizeof (int)); + isa->module_decode_fn = (xtensa_insn_decode_fn *) + realloc (isa->module_decode_fn, isa->num_modules * + sizeof (xtensa_insn_decode_fn)); + + isa->module_opcode_base[this_module] = prev_num_opcodes; + isa->module_decode_fn[this_module] = decode_insn_fn; + + xtensa_default_isa = isa; + + return 1; /* Library was successfully added. */ +} + + +xtensa_isa +xtensa_load_isa (libisa_module_specifier libisa) +{ + xtensa_isa_internal *isa; + + isa = (xtensa_isa_internal *) malloc (sizeof (xtensa_isa_internal)); + memset (isa, 0, sizeof (xtensa_isa_internal)); + if (!xtensa_add_isa (isa, libisa)) + { + xtensa_isa_free (isa); + return NULL; + } + return (xtensa_isa) isa; +} + + +int +xtensa_extend_isa (xtensa_isa isa, libisa_module_specifier libisa) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + return xtensa_add_isa (intisa, libisa); +} + + +void +xtensa_isa_free (xtensa_isa isa) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + if (intisa->opcode_table) + free (intisa->opcode_table); + if (intisa->opname_lookup_table) + free (intisa->opname_lookup_table); + if (intisa->module_opcode_base) + free (intisa->module_opcode_base); + if (intisa->module_decode_fn) + free (intisa->module_decode_fn); + free (intisa); +} + + +int +xtensa_insn_maxlength (xtensa_isa isa) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + return intisa->insn_size; +} + + +int +xtensa_insnbuf_size (xtensa_isa isa) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *)isa; + return intisa->insnbuf_size; +} + + +int +xtensa_num_opcodes (xtensa_isa isa) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + return intisa->num_opcodes; +} + + +xtensa_opcode +xtensa_opcode_lookup (xtensa_isa isa, const char *opname) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + opname_lookup_entry entry, *result; + + entry.key = opname; + result = bsearch (&entry, intisa->opname_lookup_table, intisa->num_opcodes, + sizeof (opname_lookup_entry), opname_lookup_compare); + if (!result) return XTENSA_UNDEFINED; + return result->opcode; +} + + +xtensa_opcode +xtensa_decode_insn (xtensa_isa isa, const xtensa_insnbuf insn) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + int n, opc; + for (n = 0; n < intisa->num_modules; n++) { + opc = (intisa->module_decode_fn[n]) (insn); + if (opc != XTENSA_UNDEFINED) + return intisa->module_opcode_base[n] + opc; + } + return XTENSA_UNDEFINED; +} + + +/* Opcode information. */ + +void +xtensa_encode_insn (xtensa_isa isa, xtensa_opcode opc, xtensa_insnbuf insn) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + xtensa_insnbuf template = intisa->opcode_table[opc]->template(); + int len = intisa->opcode_table[opc]->length; + int n; + + /* Convert length to 32-bit words. */ + len = (len + 3) / 4; + + /* Copy the template. */ + for (n = 0; n < len; n++) + insn[n] = template[n]; + + /* Fill any unused buffer space with zeros. */ + for ( ; n < intisa->insnbuf_size; n++) + insn[n] = 0; +} + + +const char * +xtensa_opcode_name (xtensa_isa isa, xtensa_opcode opc) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + return intisa->opcode_table[opc]->name; +} + + +int +xtensa_insn_length (xtensa_isa isa, xtensa_opcode opc) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + return intisa->opcode_table[opc]->length; +} + + +int +xtensa_insn_length_from_first_byte (xtensa_isa isa, char first_byte) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + int is_density = (first_byte & (intisa->is_big_endian ? 0x80 : 0x08)) != 0; + return (intisa->has_density && is_density ? 2 : 3); +} + + +int +xtensa_num_operands (xtensa_isa isa, xtensa_opcode opc) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + return intisa->opcode_table[opc]->iclass->num_operands; +} + + +xtensa_operand +xtensa_get_operand (xtensa_isa isa, xtensa_opcode opc, int opnd) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + xtensa_iclass_internal *iclass = intisa->opcode_table[opc]->iclass; + if (opnd >= iclass->num_operands) + return NULL; + return (xtensa_operand) iclass->operands[opnd]; +} + + +/* Operand information. */ + +char * +xtensa_operand_kind (xtensa_operand opnd) +{ + xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd; + return intop->operand_kind; +} + + +char +xtensa_operand_inout (xtensa_operand opnd) +{ + xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd; + return intop->inout; +} + + +uint32 +xtensa_operand_get_field (xtensa_operand opnd, const xtensa_insnbuf insn) +{ + xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd; + return (*intop->get_field) (insn); +} + + +void +xtensa_operand_set_field (xtensa_operand opnd, xtensa_insnbuf insn, uint32 val) +{ + xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd; + return (*intop->set_field) (insn, val); +} + + +xtensa_encode_result +xtensa_operand_encode (xtensa_operand opnd, uint32 *valp) +{ + xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd; + return (*intop->encode) (valp); +} + + +uint32 +xtensa_operand_decode (xtensa_operand opnd, uint32 val) +{ + xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd; + return (*intop->decode) (val); +} + + +int +xtensa_operand_isPCRelative (xtensa_operand opnd) +{ + xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd; + return intop->isPCRelative; +} + + +uint32 +xtensa_operand_do_reloc (xtensa_operand opnd, uint32 addr, uint32 pc) +{ + xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd; + if (!intop->isPCRelative) + return addr; + return (*intop->do_reloc) (addr, pc); +} + + +uint32 +xtensa_operand_undo_reloc (xtensa_operand opnd, uint32 offset, uint32 pc) +{ + xtensa_operand_internal *intop = (xtensa_operand_internal *) opnd; + if (!intop->isPCRelative) + return offset; + return (*intop->undo_reloc) (offset, pc); +} + + +/* Instruction buffers. */ + +xtensa_insnbuf +xtensa_insnbuf_alloc (xtensa_isa isa) +{ + return (xtensa_insnbuf) malloc (xtensa_insnbuf_size (isa) * + sizeof (xtensa_insnbuf_word)); +} + + +void +xtensa_insnbuf_free (xtensa_insnbuf buf) +{ + free( buf ); +} + + +/* Given , the index of a byte in a xtensa_insnbuf, our + internal representation of a xtensa instruction word, return the index of + its word and the bit index of its low order byte in the xtensa_insnbuf. */ + +static inline int +byte_to_word_index (int byte_index) +{ + return byte_index / sizeof (xtensa_insnbuf_word); +} + + +static inline int +byte_to_bit_index (int byte_index) +{ + return (byte_index & 0x3) * 8; +} + + +/* Copy an instruction in the 32 bit words pointed at by to characters + pointed at by . This is more complicated than you might think because + we want 16 bit instructions in bytes 2,3 for big endian. This function + allows us to specify which byte in to start with and which way to + increment, allowing trivial implementation for both big and little endian. + And it seems to make pretty good code for both. */ + +void +xtensa_insnbuf_to_chars (xtensa_isa isa, const xtensa_insnbuf insn, char *cp) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + int insn_size = xtensa_insn_maxlength (intisa); + int fence_post, start, increment, i, byte_count; + xtensa_opcode opc; + + if (intisa->is_big_endian) + { + start = insn_size - 1; + increment = -1; + } + else + { + start = 0; + increment = 1; + } + + /* Find the opcode; do nothing if the buffer does not contain a valid + instruction since we need to know how many bytes to copy. */ + opc = xtensa_decode_insn (isa, insn); + if (opc == XTENSA_UNDEFINED) + return; + + byte_count = xtensa_insn_length (isa, opc); + fence_post = start + (byte_count * increment); + + for (i = start; i != fence_post; i += increment, ++cp) + { + int word_inx = byte_to_word_index (i); + int bit_inx = byte_to_bit_index (i); + + *cp = (insn[word_inx] >> bit_inx) & 0xff; + } +} + +/* Inward conversion from byte stream to xtensa_insnbuf. See + xtensa_insnbuf_to_chars for a discussion of why this is + complicated by endianness. */ + +void +xtensa_insnbuf_from_chars (xtensa_isa isa, xtensa_insnbuf insn, const char* cp) +{ + xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; + int insn_size = xtensa_insn_maxlength (intisa); + int fence_post, start, increment, i; + + if (intisa->is_big_endian) + { + start = insn_size - 1; + increment = -1; + } + else + { + start = 0; + increment = 1; + } + + fence_post = start + (insn_size * increment); + memset (insn, 0, xtensa_insnbuf_size (isa) * sizeof (xtensa_insnbuf_word)); + + for ( i = start; i != fence_post; i += increment, ++cp ) + { + int word_inx = byte_to_word_index (i); + int bit_inx = byte_to_bit_index (i); + + insn[word_inx] |= (*cp & 0xff) << bit_inx; + } +} + diff --git a/bfd/xtensa-modules.c b/bfd/xtensa-modules.c new file mode 100644 index 0000000000000..e5d7682f09a3b --- /dev/null +++ b/bfd/xtensa-modules.c @@ -0,0 +1,6088 @@ +/* Xtensa configuration-specific ISA information. + Copyright 2003 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; 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. */ + +#include +#include "xtensa-isa-internal.h" +#include "ansidecl.h" + +#define BPW 32 +#define WINDEX(_n) ((_n) / BPW) +#define BINDEX(_n) ((_n) %% BPW) + +static uint32 tie_do_reloc_l (uint32, uint32) ATTRIBUTE_UNUSED; +static uint32 tie_undo_reloc_l (uint32, uint32) ATTRIBUTE_UNUSED; + +static uint32 +tie_do_reloc_l (uint32 addr, uint32 pc) +{ + return (addr - pc); +} + +static uint32 +tie_undo_reloc_l (uint32 offset, uint32 pc) +{ + return (pc + offset); +} + +xtensa_opcode_internal** get_opcodes (void); +int get_num_opcodes (void); +int decode_insn (const xtensa_insnbuf); +int interface_version (void); + +uint32 get_bbi_field (const xtensa_insnbuf); +void set_bbi_field (xtensa_insnbuf, uint32); +uint32 get_bbi4_field (const xtensa_insnbuf); +void set_bbi4_field (xtensa_insnbuf, uint32); +uint32 get_i_field (const xtensa_insnbuf); +void set_i_field (xtensa_insnbuf, uint32); +uint32 get_imm12_field (const xtensa_insnbuf); +void set_imm12_field (xtensa_insnbuf, uint32); +uint32 get_imm12b_field (const xtensa_insnbuf); +void set_imm12b_field (xtensa_insnbuf, uint32); +uint32 get_imm16_field (const xtensa_insnbuf); +void set_imm16_field (xtensa_insnbuf, uint32); +uint32 get_imm4_field (const xtensa_insnbuf); +void set_imm4_field (xtensa_insnbuf, uint32); +uint32 get_imm6_field (const xtensa_insnbuf); +void set_imm6_field (xtensa_insnbuf, uint32); +uint32 get_imm6hi_field (const xtensa_insnbuf); +void set_imm6hi_field (xtensa_insnbuf, uint32); +uint32 get_imm6lo_field (const xtensa_insnbuf); +void set_imm6lo_field (xtensa_insnbuf, uint32); +uint32 get_imm7_field (const xtensa_insnbuf); +void set_imm7_field (xtensa_insnbuf, uint32); +uint32 get_imm7hi_field (const xtensa_insnbuf); +void set_imm7hi_field (xtensa_insnbuf, uint32); +uint32 get_imm7lo_field (const xtensa_insnbuf); +void set_imm7lo_field (xtensa_insnbuf, uint32); +uint32 get_imm8_field (const xtensa_insnbuf); +void set_imm8_field (xtensa_insnbuf, uint32); +uint32 get_m_field (const xtensa_insnbuf); +void set_m_field (xtensa_insnbuf, uint32); +uint32 get_mn_field (const xtensa_insnbuf); +void set_mn_field (xtensa_insnbuf, uint32); +uint32 get_n_field (const xtensa_insnbuf); +void set_n_field (xtensa_insnbuf, uint32); +uint32 get_none_field (const xtensa_insnbuf); +void set_none_field (xtensa_insnbuf, uint32); +uint32 get_offset_field (const xtensa_insnbuf); +void set_offset_field (xtensa_insnbuf, uint32); +uint32 get_op0_field (const xtensa_insnbuf); +void set_op0_field (xtensa_insnbuf, uint32); +uint32 get_op1_field (const xtensa_insnbuf); +void set_op1_field (xtensa_insnbuf, uint32); +uint32 get_op2_field (const xtensa_insnbuf); +void set_op2_field (xtensa_insnbuf, uint32); +uint32 get_r_field (const xtensa_insnbuf); +void set_r_field (xtensa_insnbuf, uint32); +uint32 get_s_field (const xtensa_insnbuf); +void set_s_field (xtensa_insnbuf, uint32); +uint32 get_sa4_field (const xtensa_insnbuf); +void set_sa4_field (xtensa_insnbuf, uint32); +uint32 get_sae_field (const xtensa_insnbuf); +void set_sae_field (xtensa_insnbuf, uint32); +uint32 get_sae4_field (const xtensa_insnbuf); +void set_sae4_field (xtensa_insnbuf, uint32); +uint32 get_sal_field (const xtensa_insnbuf); +void set_sal_field (xtensa_insnbuf, uint32); +uint32 get_sar_field (const xtensa_insnbuf); +void set_sar_field (xtensa_insnbuf, uint32); +uint32 get_sas_field (const xtensa_insnbuf); +void set_sas_field (xtensa_insnbuf, uint32); +uint32 get_sas4_field (const xtensa_insnbuf); +void set_sas4_field (xtensa_insnbuf, uint32); +uint32 get_sr_field (const xtensa_insnbuf); +void set_sr_field (xtensa_insnbuf, uint32); +uint32 get_t_field (const xtensa_insnbuf); +void set_t_field (xtensa_insnbuf, uint32); +uint32 get_thi3_field (const xtensa_insnbuf); +void set_thi3_field (xtensa_insnbuf, uint32); +uint32 get_z_field (const xtensa_insnbuf); +void set_z_field (xtensa_insnbuf, uint32); + + +uint32 +get_bbi_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf0000) >> 16) | + ((insn[0] & 0x100) >> 4); +} + +void +set_bbi_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfff0ffff) | ((val << 16) & 0xf0000); + insn[0] = (insn[0] & 0xfffffeff) | ((val << 4) & 0x100); +} + +uint32 +get_bbi4_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0x100) >> 8); +} + +void +set_bbi4_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffffeff) | ((val << 8) & 0x100); +} + +uint32 +get_i_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0x80000) >> 19); +} + +void +set_i_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfff7ffff) | ((val << 19) & 0x80000); +} + +uint32 +get_imm12_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xfff)); +} + +void +set_imm12_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffff000) | (val & 0xfff); +} + +uint32 +get_imm12b_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xff)) | + ((insn[0] & 0xf000) >> 4); +} + +void +set_imm12b_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xffffff00) | (val & 0xff); + insn[0] = (insn[0] & 0xffff0fff) | ((val << 4) & 0xf000); +} + +uint32 +get_imm16_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xffff)); +} + +void +set_imm16_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xffff0000) | (val & 0xffff); +} + +uint32 +get_imm4_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf00) >> 8); +} + +void +set_imm4_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00); +} + +uint32 +get_imm6_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf00) >> 8) | + ((insn[0] & 0x30000) >> 12); +} + +void +set_imm6_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00); + insn[0] = (insn[0] & 0xfffcffff) | ((val << 12) & 0x30000); +} + +uint32 +get_imm6hi_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0x30000) >> 16); +} + +void +set_imm6hi_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffcffff) | ((val << 16) & 0x30000); +} + +uint32 +get_imm6lo_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf00) >> 8); +} + +void +set_imm6lo_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00); +} + +uint32 +get_imm7_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf00) >> 8) | + ((insn[0] & 0x70000) >> 12); +} + +void +set_imm7_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00); + insn[0] = (insn[0] & 0xfff8ffff) | ((val << 12) & 0x70000); +} + +uint32 +get_imm7hi_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0x70000) >> 16); +} + +void +set_imm7hi_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfff8ffff) | ((val << 16) & 0x70000); +} + +uint32 +get_imm7lo_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf00) >> 8); +} + +void +set_imm7lo_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00); +} + +uint32 +get_imm8_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xff)); +} + +void +set_imm8_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xffffff00) | (val & 0xff); +} + +uint32 +get_m_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0x30000) >> 16); +} + +void +set_m_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffcffff) | ((val << 16) & 0x30000); +} + +uint32 +get_mn_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0x30000) >> 16) | + ((insn[0] & 0xc0000) >> 16); +} + +void +set_mn_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffcffff) | ((val << 16) & 0x30000); + insn[0] = (insn[0] & 0xfff3ffff) | ((val << 16) & 0xc0000); +} + +uint32 +get_n_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xc0000) >> 18); +} + +void +set_n_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfff3ffff) | ((val << 18) & 0xc0000); +} + +uint32 +get_none_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0x0)); +} + +void +set_none_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xffffffff) | (val & 0x0); +} + +uint32 +get_offset_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0x3ffff)); +} + +void +set_offset_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffc0000) | (val & 0x3ffff); +} + +uint32 +get_op0_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf00000) >> 20); +} + +void +set_op0_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xff0fffff) | ((val << 20) & 0xf00000); +} + +uint32 +get_op1_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf0) >> 4); +} + +void +set_op1_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xffffff0f) | ((val << 4) & 0xf0); +} + +uint32 +get_op2_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf)); +} + +void +set_op2_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffffff0) | (val & 0xf); +} + +uint32 +get_r_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf00) >> 8); +} + +void +set_r_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00); +} + +uint32 +get_s_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf000) >> 12); +} + +void +set_s_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xffff0fff) | ((val << 12) & 0xf000); +} + +uint32 +get_sa4_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0x1)); +} + +void +set_sa4_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffffffe) | (val & 0x1); +} + +uint32 +get_sae_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf000) >> 12) | + ((insn[0] & 0x10)); +} + +void +set_sae_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xffff0fff) | ((val << 12) & 0xf000); + insn[0] = (insn[0] & 0xffffffef) | (val & 0x10); +} + +uint32 +get_sae4_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0x10) >> 4); +} + +void +set_sae4_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xffffffef) | ((val << 4) & 0x10); +} + +uint32 +get_sal_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf0000) >> 16) | + ((insn[0] & 0x1) << 4); +} + +void +set_sal_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfff0ffff) | ((val << 16) & 0xf0000); + insn[0] = (insn[0] & 0xfffffffe) | ((val >> 4) & 0x1); +} + +uint32 +get_sar_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf000) >> 12) | + ((insn[0] & 0x1) << 4); +} + +void +set_sar_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xffff0fff) | ((val << 12) & 0xf000); + insn[0] = (insn[0] & 0xfffffffe) | ((val >> 4) & 0x1); +} + +uint32 +get_sas_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf000) >> 12) | + ((insn[0] & 0x10000) >> 12); +} + +void +set_sas_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xffff0fff) | ((val << 12) & 0xf000); + insn[0] = (insn[0] & 0xfffeffff) | ((val << 12) & 0x10000); +} + +uint32 +get_sas4_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0x10000) >> 16); +} + +void +set_sas4_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffeffff) | ((val << 16) & 0x10000); +} + +uint32 +get_sr_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf00) >> 8) | + ((insn[0] & 0xf000) >> 8); +} + +void +set_sr_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffff0ff) | ((val << 8) & 0xf00); + insn[0] = (insn[0] & 0xffff0fff) | ((val << 8) & 0xf000); +} + +uint32 +get_t_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xf0000) >> 16); +} + +void +set_t_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfff0ffff) | ((val << 16) & 0xf0000); +} + +uint32 +get_thi3_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0xe0000) >> 17); +} + +void +set_thi3_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfff1ffff) | ((val << 17) & 0xe0000); +} + +uint32 +get_z_field (const xtensa_insnbuf insn) +{ + return ((insn[0] & 0x40000) >> 18); +} + +void +set_z_field (xtensa_insnbuf insn, uint32 val) +{ + insn[0] = (insn[0] & 0xfffbffff) | ((val << 18) & 0x40000); +} + +uint32 decode_b4constu (uint32); +xtensa_encode_result encode_b4constu (uint32 *); +uint32 decode_simm8x256 (uint32); +xtensa_encode_result encode_simm8x256 (uint32 *); +uint32 decode_soffset (uint32); +xtensa_encode_result encode_soffset (uint32 *); +uint32 decode_imm4 (uint32); +xtensa_encode_result encode_imm4 (uint32 *); +uint32 decode_op0 (uint32); +xtensa_encode_result encode_op0 (uint32 *); +uint32 decode_op1 (uint32); +xtensa_encode_result encode_op1 (uint32 *); +uint32 decode_imm6 (uint32); +xtensa_encode_result encode_imm6 (uint32 *); +uint32 decode_op2 (uint32); +xtensa_encode_result encode_op2 (uint32 *); +uint32 decode_imm7 (uint32); +xtensa_encode_result encode_imm7 (uint32 *); +uint32 decode_simm4 (uint32); +xtensa_encode_result encode_simm4 (uint32 *); +uint32 decode_ai4const (uint32); +xtensa_encode_result encode_ai4const (uint32 *); +uint32 decode_imm8 (uint32); +xtensa_encode_result encode_imm8 (uint32 *); +uint32 decode_sae (uint32); +xtensa_encode_result encode_sae (uint32 *); +uint32 decode_imm7lo (uint32); +xtensa_encode_result encode_imm7lo (uint32 *); +uint32 decode_simm7 (uint32); +xtensa_encode_result encode_simm7 (uint32 *); +uint32 decode_simm8 (uint32); +xtensa_encode_result encode_simm8 (uint32 *); +uint32 decode_uimm12x8 (uint32); +xtensa_encode_result encode_uimm12x8 (uint32 *); +uint32 decode_sal (uint32); +xtensa_encode_result encode_sal (uint32 *); +uint32 decode_uimm6 (uint32); +xtensa_encode_result encode_uimm6 (uint32 *); +uint32 decode_sas4 (uint32); +xtensa_encode_result encode_sas4 (uint32 *); +uint32 decode_uimm8 (uint32); +xtensa_encode_result encode_uimm8 (uint32 *); +uint32 decode_uimm16x4 (uint32); +xtensa_encode_result encode_uimm16x4 (uint32 *); +uint32 decode_sar (uint32); +xtensa_encode_result encode_sar (uint32 *); +uint32 decode_sa4 (uint32); +xtensa_encode_result encode_sa4 (uint32 *); +uint32 decode_sas (uint32); +xtensa_encode_result encode_sas (uint32 *); +uint32 decode_imm6hi (uint32); +xtensa_encode_result encode_imm6hi (uint32 *); +uint32 decode_bbi (uint32); +xtensa_encode_result encode_bbi (uint32 *); +uint32 decode_uimm8x2 (uint32); +xtensa_encode_result encode_uimm8x2 (uint32 *); +uint32 decode_uimm8x4 (uint32); +xtensa_encode_result encode_uimm8x4 (uint32 *); +uint32 decode_msalp32 (uint32); +xtensa_encode_result encode_msalp32 (uint32 *); +uint32 decode_bbi4 (uint32); +xtensa_encode_result encode_bbi4 (uint32 *); +uint32 decode_op2p1 (uint32); +xtensa_encode_result encode_op2p1 (uint32 *); +uint32 decode_soffsetx4 (uint32); +xtensa_encode_result encode_soffsetx4 (uint32 *); +uint32 decode_imm6lo (uint32); +xtensa_encode_result encode_imm6lo (uint32 *); +uint32 decode_imm12 (uint32); +xtensa_encode_result encode_imm12 (uint32 *); +uint32 decode_b4const (uint32); +xtensa_encode_result encode_b4const (uint32 *); +uint32 decode_i (uint32); +xtensa_encode_result encode_i (uint32 *); +uint32 decode_imm16 (uint32); +xtensa_encode_result encode_imm16 (uint32 *); +uint32 decode_mn (uint32); +xtensa_encode_result encode_mn (uint32 *); +uint32 decode_m (uint32); +xtensa_encode_result encode_m (uint32 *); +uint32 decode_n (uint32); +xtensa_encode_result encode_n (uint32 *); +uint32 decode_none (uint32); +xtensa_encode_result encode_none (uint32 *); +uint32 decode_imm12b (uint32); +xtensa_encode_result encode_imm12b (uint32 *); +uint32 decode_r (uint32); +xtensa_encode_result encode_r (uint32 *); +uint32 decode_s (uint32); +xtensa_encode_result encode_s (uint32 *); +uint32 decode_t (uint32); +xtensa_encode_result encode_t (uint32 *); +uint32 decode_thi3 (uint32); +xtensa_encode_result encode_thi3 (uint32 *); +uint32 decode_sae4 (uint32); +xtensa_encode_result encode_sae4 (uint32 *); +uint32 decode_offset (uint32); +xtensa_encode_result encode_offset (uint32 *); +uint32 decode_imm7hi (uint32); +xtensa_encode_result encode_imm7hi (uint32 *); +uint32 decode_uimm4x16 (uint32); +xtensa_encode_result encode_uimm4x16 (uint32 *); +uint32 decode_simm12b (uint32); +xtensa_encode_result encode_simm12b (uint32 *); +uint32 decode_lsi4x4 (uint32); +xtensa_encode_result encode_lsi4x4 (uint32 *); +uint32 decode_z (uint32); +xtensa_encode_result encode_z (uint32 *); +uint32 decode_simm12 (uint32); +xtensa_encode_result encode_simm12 (uint32 *); +uint32 decode_sr (uint32); +xtensa_encode_result encode_sr (uint32 *); +uint32 decode_nimm4x2 (uint32); +xtensa_encode_result encode_nimm4x2 (uint32 *); + + +static const uint32 b4constu_table[] = { + 32768, + 65536, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10, + 12, + 16, + 32, + 64, + 128, + 256 +}; + +uint32 +decode_b4constu (uint32 val) +{ + val = b4constu_table[val]; + return val; +} + +xtensa_encode_result +encode_b4constu (uint32 *valp) +{ + uint32 val = *valp; + unsigned i; + for (i = 0; i < (1 << 4); i += 1) + if (b4constu_table[i] == val) goto found; + return xtensa_encode_result_not_in_table; + found: + val = i; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_simm8x256 (uint32 val) +{ + val = (val ^ 0x80) - 0x80; + val <<= 8; + return val; +} + +xtensa_encode_result +encode_simm8x256 (uint32 *valp) +{ + uint32 val = *valp; + if ((val & ((1 << 8) - 1)) != 0) + return xtensa_encode_result_align; + val = (signed int) val >> 8; + if (((val + (1 << 7)) >> 8) != 0) + { + if ((signed int) val > 0) + return xtensa_encode_result_too_high; + else + return xtensa_encode_result_too_low; + } + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_soffset (uint32 val) +{ + val = (val ^ 0x20000) - 0x20000; + return val; +} + +xtensa_encode_result +encode_soffset (uint32 *valp) +{ + uint32 val = *valp; + if (((val + (1 << 17)) >> 18) != 0) + { + if ((signed int) val > 0) + return xtensa_encode_result_too_high; + else + return xtensa_encode_result_too_low; + } + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_imm4 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_imm4 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 4) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_op0 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_op0 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 4) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_op1 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_op1 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 4) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_imm6 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_imm6 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 6) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_op2 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_op2 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 4) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_imm7 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_imm7 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 7) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_simm4 (uint32 val) +{ + val = (val ^ 0x8) - 0x8; + return val; +} + +xtensa_encode_result +encode_simm4 (uint32 *valp) +{ + uint32 val = *valp; + if (((val + (1 << 3)) >> 4) != 0) + { + if ((signed int) val > 0) + return xtensa_encode_result_too_high; + else + return xtensa_encode_result_too_low; + } + *valp = val; + return xtensa_encode_result_ok; +} + +static const uint32 ai4const_table[] = { + -1, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15 +}; + +uint32 +decode_ai4const (uint32 val) +{ + val = ai4const_table[val]; + return val; +} + +xtensa_encode_result +encode_ai4const (uint32 *valp) +{ + uint32 val = *valp; + unsigned i; + for (i = 0; i < (1 << 4); i += 1) + if (ai4const_table[i] == val) goto found; + return xtensa_encode_result_not_in_table; + found: + val = i; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_imm8 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_imm8 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 8) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_sae (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_sae (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 5) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_imm7lo (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_imm7lo (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 4) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_simm7 (uint32 val) +{ + if (val > 95) + val |= -32; + return val; +} + +xtensa_encode_result +encode_simm7 (uint32 *valp) +{ + uint32 val = *valp; + if ((signed int) val < -32) + return xtensa_encode_result_too_low; + if ((signed int) val > 95) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_simm8 (uint32 val) +{ + val = (val ^ 0x80) - 0x80; + return val; +} + +xtensa_encode_result +encode_simm8 (uint32 *valp) +{ + uint32 val = *valp; + if (((val + (1 << 7)) >> 8) != 0) + { + if ((signed int) val > 0) + return xtensa_encode_result_too_high; + else + return xtensa_encode_result_too_low; + } + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_uimm12x8 (uint32 val) +{ + val <<= 3; + return val; +} + +xtensa_encode_result +encode_uimm12x8 (uint32 *valp) +{ + uint32 val = *valp; + if ((val & ((1 << 3) - 1)) != 0) + return xtensa_encode_result_align; + val = (signed int) val >> 3; + if ((val >> 12) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_sal (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_sal (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 5) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_uimm6 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_uimm6 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 6) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_sas4 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_sas4 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 1) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_uimm8 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_uimm8 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 8) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_uimm16x4 (uint32 val) +{ + val |= -1 << 16; + val <<= 2; + return val; +} + +xtensa_encode_result +encode_uimm16x4 (uint32 *valp) +{ + uint32 val = *valp; + if ((val & ((1 << 2) - 1)) != 0) + return xtensa_encode_result_align; + val = (signed int) val >> 2; + if ((signed int) val >> 16 != -1) + { + if ((signed int) val >= 0) + return xtensa_encode_result_too_high; + else + return xtensa_encode_result_too_low; + } + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_sar (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_sar (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 5) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_sa4 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_sa4 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 1) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_sas (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_sas (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 5) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_imm6hi (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_imm6hi (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 2) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_bbi (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_bbi (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 5) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_uimm8x2 (uint32 val) +{ + val <<= 1; + return val; +} + +xtensa_encode_result +encode_uimm8x2 (uint32 *valp) +{ + uint32 val = *valp; + if ((val & ((1 << 1) - 1)) != 0) + return xtensa_encode_result_align; + val = (signed int) val >> 1; + if ((val >> 8) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_uimm8x4 (uint32 val) +{ + val <<= 2; + return val; +} + +xtensa_encode_result +encode_uimm8x4 (uint32 *valp) +{ + uint32 val = *valp; + if ((val & ((1 << 2) - 1)) != 0) + return xtensa_encode_result_align; + val = (signed int) val >> 2; + if ((val >> 8) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +static const uint32 mip32const_table[] = { + 32, + 31, + 30, + 29, + 28, + 27, + 26, + 25, + 24, + 23, + 22, + 21, + 20, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 +}; + +uint32 +decode_msalp32 (uint32 val) +{ + val = mip32const_table[val]; + return val; +} + +xtensa_encode_result +encode_msalp32 (uint32 *valp) +{ + uint32 val = *valp; + unsigned i; + for (i = 0; i < (1 << 5); i += 1) + if (mip32const_table[i] == val) goto found; + return xtensa_encode_result_not_in_table; + found: + val = i; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_bbi4 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_bbi4 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 1) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +static const uint32 i4p1const_table[] = { + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 +}; + +uint32 +decode_op2p1 (uint32 val) +{ + val = i4p1const_table[val]; + return val; +} + +xtensa_encode_result +encode_op2p1 (uint32 *valp) +{ + uint32 val = *valp; + unsigned i; + for (i = 0; i < (1 << 4); i += 1) + if (i4p1const_table[i] == val) goto found; + return xtensa_encode_result_not_in_table; + found: + val = i; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_soffsetx4 (uint32 val) +{ + val = (val ^ 0x20000) - 0x20000; + val <<= 2; + return val; +} + +xtensa_encode_result +encode_soffsetx4 (uint32 *valp) +{ + uint32 val = *valp; + if ((val & ((1 << 2) - 1)) != 0) + return xtensa_encode_result_align; + val = (signed int) val >> 2; + if (((val + (1 << 17)) >> 18) != 0) + { + if ((signed int) val > 0) + return xtensa_encode_result_too_high; + else + return xtensa_encode_result_too_low; + } + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_imm6lo (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_imm6lo (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 4) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_imm12 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_imm12 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 12) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +static const uint32 b4const_table[] = { + -1, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10, + 12, + 16, + 32, + 64, + 128, + 256 +}; + +uint32 +decode_b4const (uint32 val) +{ + val = b4const_table[val]; + return val; +} + +xtensa_encode_result +encode_b4const (uint32 *valp) +{ + uint32 val = *valp; + unsigned i; + for (i = 0; i < (1 << 4); i += 1) + if (b4const_table[i] == val) goto found; + return xtensa_encode_result_not_in_table; + found: + val = i; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_i (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_i (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 1) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_imm16 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_imm16 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 16) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_mn (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_mn (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 4) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_m (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_m (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 2) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_n (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_n (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 2) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_none (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_none (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 0) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_imm12b (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_imm12b (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 12) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_r (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_r (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 4) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_s (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_s (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 4) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_t (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_t (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 4) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_thi3 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_thi3 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 3) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_sae4 (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_sae4 (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 1) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_offset (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_offset (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 18) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_imm7hi (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_imm7hi (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 3) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_uimm4x16 (uint32 val) +{ + val <<= 4; + return val; +} + +xtensa_encode_result +encode_uimm4x16 (uint32 *valp) +{ + uint32 val = *valp; + if ((val & ((1 << 4) - 1)) != 0) + return xtensa_encode_result_align; + val = (signed int) val >> 4; + if ((val >> 4) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_simm12b (uint32 val) +{ + val = (val ^ 0x800) - 0x800; + return val; +} + +xtensa_encode_result +encode_simm12b (uint32 *valp) +{ + uint32 val = *valp; + if (((val + (1 << 11)) >> 12) != 0) + { + if ((signed int) val > 0) + return xtensa_encode_result_too_high; + else + return xtensa_encode_result_too_low; + } + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_lsi4x4 (uint32 val) +{ + val <<= 2; + return val; +} + +xtensa_encode_result +encode_lsi4x4 (uint32 *valp) +{ + uint32 val = *valp; + if ((val & ((1 << 2) - 1)) != 0) + return xtensa_encode_result_align; + val = (signed int) val >> 2; + if ((val >> 4) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_z (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_z (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 1) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_simm12 (uint32 val) +{ + val = (val ^ 0x800) - 0x800; + return val; +} + +xtensa_encode_result +encode_simm12 (uint32 *valp) +{ + uint32 val = *valp; + if (((val + (1 << 11)) >> 12) != 0) + { + if ((signed int) val > 0) + return xtensa_encode_result_too_high; + else + return xtensa_encode_result_too_low; + } + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_sr (uint32 val) +{ + return val; +} + +xtensa_encode_result +encode_sr (uint32 *valp) +{ + uint32 val = *valp; + if ((val >> 8) != 0) + return xtensa_encode_result_too_high; + *valp = val; + return xtensa_encode_result_ok; +} + +uint32 +decode_nimm4x2 (uint32 val) +{ + val |= -1 << 4; + val <<= 2; + return val; +} + +xtensa_encode_result +encode_nimm4x2 (uint32 *valp) +{ + uint32 val = *valp; + if ((val & ((1 << 2) - 1)) != 0) + return xtensa_encode_result_align; + val = (signed int) val >> 2; + if ((signed int) val >> 4 != -1) + { + if ((signed int) val >= 0) + return xtensa_encode_result_too_high; + else + return xtensa_encode_result_too_low; + } + *valp = val; + return xtensa_encode_result_ok; +} + + + +uint32 do_reloc_l (uint32, uint32); +uint32 undo_reloc_l (uint32, uint32); +uint32 do_reloc_L (uint32, uint32); +uint32 undo_reloc_L (uint32, uint32); +uint32 do_reloc_r (uint32, uint32); +uint32 undo_reloc_r (uint32, uint32); + + +uint32 +do_reloc_l (uint32 addr, uint32 pc) +{ + return addr - pc - 4; +} + +uint32 +undo_reloc_l (uint32 offset, uint32 pc) +{ + return pc + offset + 4; +} + +uint32 +do_reloc_L (uint32 addr, uint32 pc) +{ + return addr - (pc & -4) - 4; +} + +uint32 +undo_reloc_L (uint32 offset, uint32 pc) +{ + return (pc & -4) + offset + 4; +} + +uint32 +do_reloc_r (uint32 addr, uint32 pc) +{ + return addr - ((pc+3) & -4); +} + +uint32 +undo_reloc_r (uint32 offset, uint32 pc) +{ + return ((pc+3) & -4) + offset; +} + +static xtensa_operand_internal iib4const_operand = { + "i", + '<', + 0, + get_r_field, + set_r_field, + encode_b4const, + decode_b4const, + 0, + 0 +}; + +static xtensa_operand_internal iiuimm8_operand = { + "i", + '<', + 0, + get_imm8_field, + set_imm8_field, + encode_uimm8, + decode_uimm8, + 0, + 0 +}; + +static xtensa_operand_internal lisoffsetx4_operand = { + "L", + '<', + 1, + get_offset_field, + set_offset_field, + encode_soffsetx4, + decode_soffsetx4, + do_reloc_L, + undo_reloc_L, +}; + +static xtensa_operand_internal iisimm8x256_operand = { + "i", + '<', + 0, + get_imm8_field, + set_imm8_field, + encode_simm8x256, + decode_simm8x256, + 0, + 0 +}; + +static xtensa_operand_internal lisimm12_operand = { + "l", + '<', + 1, + get_imm12_field, + set_imm12_field, + encode_simm12, + decode_simm12, + do_reloc_l, + undo_reloc_l, +}; + +static xtensa_operand_internal iiop2p1_operand = { + "i", + '<', + 0, + get_op2_field, + set_op2_field, + encode_op2p1, + decode_op2p1, + 0, + 0 +}; + +static xtensa_operand_internal iisae_operand = { + "i", + '<', + 0, + get_sae_field, + set_sae_field, + encode_sae, + decode_sae, + 0, + 0 +}; + +static xtensa_operand_internal iis_operand = { + "i", + '<', + 0, + get_s_field, + set_s_field, + encode_s, + decode_s, + 0, + 0 +}; + +static xtensa_operand_internal iit_operand = { + "i", + '<', + 0, + get_t_field, + set_t_field, + encode_t, + decode_t, + 0, + 0 +}; + +static xtensa_operand_internal iisimm12b_operand = { + "i", + '<', + 0, + get_imm12b_field, + set_imm12b_field, + encode_simm12b, + decode_simm12b, + 0, + 0 +}; + +static xtensa_operand_internal iinimm4x2_operand = { + "i", + '<', + 0, + get_imm4_field, + set_imm4_field, + encode_nimm4x2, + decode_nimm4x2, + 0, + 0 +}; + +static xtensa_operand_internal iiuimm4x16_operand = { + "i", + '<', + 0, + get_op2_field, + set_op2_field, + encode_uimm4x16, + decode_uimm4x16, + 0, + 0 +}; + +static xtensa_operand_internal abs_operand = { + "a", + '=', + 0, + get_s_field, + set_s_field, + encode_s, + decode_s, + 0, + 0 +}; + +static xtensa_operand_internal iisar_operand = { + "i", + '<', + 0, + get_sar_field, + set_sar_field, + encode_sar, + decode_sar, + 0, + 0 +}; + +static xtensa_operand_internal abt_operand = { + "a", + '=', + 0, + get_t_field, + set_t_field, + encode_t, + decode_t, + 0, + 0 +}; + +static xtensa_operand_internal iisas_operand = { + "i", + '<', + 0, + get_sas_field, + set_sas_field, + encode_sas, + decode_sas, + 0, + 0 +}; + +static xtensa_operand_internal amr_operand = { + "a", + '=', + 0, + get_r_field, + set_r_field, + encode_r, + decode_r, + 0, + 0 +}; + +static xtensa_operand_internal iib4constu_operand = { + "i", + '<', + 0, + get_r_field, + set_r_field, + encode_b4constu, + decode_b4constu, + 0, + 0 +}; + +static xtensa_operand_internal iisr_operand = { + "i", + '<', + 0, + get_sr_field, + set_sr_field, + encode_sr, + decode_sr, + 0, + 0 +}; + +static xtensa_operand_internal iibbi_operand = { + "i", + '<', + 0, + get_bbi_field, + set_bbi_field, + encode_bbi, + decode_bbi, + 0, + 0 +}; + +static xtensa_operand_internal iiai4const_operand = { + "i", + '<', + 0, + get_t_field, + set_t_field, + encode_ai4const, + decode_ai4const, + 0, + 0 +}; + +static xtensa_operand_internal iiuimm12x8_operand = { + "i", + '<', + 0, + get_imm12_field, + set_imm12_field, + encode_uimm12x8, + decode_uimm12x8, + 0, + 0 +}; + +static xtensa_operand_internal riuimm16x4_operand = { + "r", + '<', + 1, + get_imm16_field, + set_imm16_field, + encode_uimm16x4, + decode_uimm16x4, + do_reloc_r, + undo_reloc_r, +}; + +static xtensa_operand_internal lisimm8_operand = { + "l", + '<', + 1, + get_imm8_field, + set_imm8_field, + encode_simm8, + decode_simm8, + do_reloc_l, + undo_reloc_l, +}; + +static xtensa_operand_internal iilsi4x4_operand = { + "i", + '<', + 0, + get_r_field, + set_r_field, + encode_lsi4x4, + decode_lsi4x4, + 0, + 0 +}; + +static xtensa_operand_internal iiuimm8x2_operand = { + "i", + '<', + 0, + get_imm8_field, + set_imm8_field, + encode_uimm8x2, + decode_uimm8x2, + 0, + 0 +}; + +static xtensa_operand_internal iisimm4_operand = { + "i", + '<', + 0, + get_mn_field, + set_mn_field, + encode_simm4, + decode_simm4, + 0, + 0 +}; + +static xtensa_operand_internal iimsalp32_operand = { + "i", + '<', + 0, + get_sal_field, + set_sal_field, + encode_msalp32, + decode_msalp32, + 0, + 0 +}; + +static xtensa_operand_internal liuimm6_operand = { + "l", + '<', + 1, + get_imm6_field, + set_imm6_field, + encode_uimm6, + decode_uimm6, + do_reloc_l, + undo_reloc_l, +}; + +static xtensa_operand_internal iiuimm8x4_operand = { + "i", + '<', + 0, + get_imm8_field, + set_imm8_field, + encode_uimm8x4, + decode_uimm8x4, + 0, + 0 +}; + +static xtensa_operand_internal lisoffset_operand = { + "l", + '<', + 1, + get_offset_field, + set_offset_field, + encode_soffset, + decode_soffset, + do_reloc_l, + undo_reloc_l, +}; + +static xtensa_operand_internal iisimm7_operand = { + "i", + '<', + 0, + get_imm7_field, + set_imm7_field, + encode_simm7, + decode_simm7, + 0, + 0 +}; + +static xtensa_operand_internal ais_operand = { + "a", + '<', + 0, + get_s_field, + set_s_field, + encode_s, + decode_s, + 0, + 0 +}; + +static xtensa_operand_internal liuimm8_operand = { + "l", + '<', + 1, + get_imm8_field, + set_imm8_field, + encode_uimm8, + decode_uimm8, + do_reloc_l, + undo_reloc_l, +}; + +static xtensa_operand_internal ait_operand = { + "a", + '<', + 0, + get_t_field, + set_t_field, + encode_t, + decode_t, + 0, + 0 +}; + +static xtensa_operand_internal iisimm8_operand = { + "i", + '<', + 0, + get_imm8_field, + set_imm8_field, + encode_simm8, + decode_simm8, + 0, + 0 +}; + +static xtensa_operand_internal aor_operand = { + "a", + '>', + 0, + get_r_field, + set_r_field, + encode_r, + decode_r, + 0, + 0 +}; + +static xtensa_operand_internal aos_operand = { + "a", + '>', + 0, + get_s_field, + set_s_field, + encode_s, + decode_s, + 0, + 0 +}; + +static xtensa_operand_internal aot_operand = { + "a", + '>', + 0, + get_t_field, + set_t_field, + encode_t, + decode_t, + 0, + 0 +}; + +static xtensa_iclass_internal nopn_iclass = { + 0, + 0 +}; + +static xtensa_operand_internal *movi_operand_list[] = { + &aot_operand, + &iisimm12b_operand +}; + +static xtensa_iclass_internal movi_iclass = { + 2, + &movi_operand_list[0] +}; + +static xtensa_operand_internal *bsi8u_operand_list[] = { + &ais_operand, + &iib4constu_operand, + &lisimm8_operand +}; + +static xtensa_iclass_internal bsi8u_iclass = { + 3, + &bsi8u_operand_list[0] +}; + +static xtensa_operand_internal *itlb_operand_list[] = { + &ais_operand +}; + +static xtensa_iclass_internal itlb_iclass = { + 1, + &itlb_operand_list[0] +}; + +static xtensa_operand_internal *shiftst_operand_list[] = { + &aor_operand, + &ais_operand, + &ait_operand +}; + +static xtensa_iclass_internal shiftst_iclass = { + 3, + &shiftst_operand_list[0] +}; + +static xtensa_operand_internal *l32r_operand_list[] = { + &aot_operand, + &riuimm16x4_operand +}; + +static xtensa_iclass_internal l32r_iclass = { + 2, + &l32r_operand_list[0] +}; + +static xtensa_iclass_internal rfe_iclass = { + 0, + 0 +}; + +static xtensa_operand_internal *wait_operand_list[] = { + &iis_operand +}; + +static xtensa_iclass_internal wait_iclass = { + 1, + &wait_operand_list[0] +}; + +static xtensa_operand_internal *rfi_operand_list[] = { + &iis_operand +}; + +static xtensa_iclass_internal rfi_iclass = { + 1, + &rfi_operand_list[0] +}; + +static xtensa_operand_internal *movz_operand_list[] = { + &amr_operand, + &ais_operand, + &ait_operand +}; + +static xtensa_iclass_internal movz_iclass = { + 3, + &movz_operand_list[0] +}; + +static xtensa_operand_internal *callx_operand_list[] = { + &ais_operand +}; + +static xtensa_iclass_internal callx_iclass = { + 1, + &callx_operand_list[0] +}; + +static xtensa_operand_internal *mov_n_operand_list[] = { + &aot_operand, + &ais_operand +}; + +static xtensa_iclass_internal mov_n_iclass = { + 2, + &mov_n_operand_list[0] +}; + +static xtensa_operand_internal *loadi4_operand_list[] = { + &aot_operand, + &ais_operand, + &iilsi4x4_operand +}; + +static xtensa_iclass_internal loadi4_iclass = { + 3, + &loadi4_operand_list[0] +}; + +static xtensa_operand_internal *exti_operand_list[] = { + &aor_operand, + &ait_operand, + &iisae_operand, + &iiop2p1_operand +}; + +static xtensa_iclass_internal exti_iclass = { + 4, + &exti_operand_list[0] +}; + +static xtensa_operand_internal *break_operand_list[] = { + &iis_operand, + &iit_operand +}; + +static xtensa_iclass_internal break_iclass = { + 2, + &break_operand_list[0] +}; + +static xtensa_operand_internal *slli_operand_list[] = { + &aor_operand, + &ais_operand, + &iimsalp32_operand +}; + +static xtensa_iclass_internal slli_iclass = { + 3, + &slli_operand_list[0] +}; + +static xtensa_operand_internal *s16i_operand_list[] = { + &ait_operand, + &ais_operand, + &iiuimm8x2_operand +}; + +static xtensa_iclass_internal s16i_iclass = { + 3, + &s16i_operand_list[0] +}; + +static xtensa_operand_internal *call_operand_list[] = { + &lisoffsetx4_operand +}; + +static xtensa_iclass_internal call_iclass = { + 1, + &call_operand_list[0] +}; + +static xtensa_operand_internal *shifts_operand_list[] = { + &aor_operand, + &ais_operand +}; + +static xtensa_iclass_internal shifts_iclass = { + 2, + &shifts_operand_list[0] +}; + +static xtensa_operand_internal *shiftt_operand_list[] = { + &aor_operand, + &ait_operand +}; + +static xtensa_iclass_internal shiftt_iclass = { + 2, + &shiftt_operand_list[0] +}; + +static xtensa_operand_internal *rotw_operand_list[] = { + &iisimm4_operand +}; + +static xtensa_iclass_internal rotw_iclass = { + 1, + &rotw_operand_list[0] +}; + +static xtensa_operand_internal *addsub_operand_list[] = { + &aor_operand, + &ais_operand, + &ait_operand +}; + +static xtensa_iclass_internal addsub_iclass = { + 3, + &addsub_operand_list[0] +}; + +static xtensa_operand_internal *l8i_operand_list[] = { + &aot_operand, + &ais_operand, + &iiuimm8_operand +}; + +static xtensa_iclass_internal l8i_iclass = { + 3, + &l8i_operand_list[0] +}; + +static xtensa_operand_internal *sari_operand_list[] = { + &iisas_operand +}; + +static xtensa_iclass_internal sari_iclass = { + 1, + &sari_operand_list[0] +}; + +static xtensa_operand_internal *xsr_operand_list[] = { + &abt_operand, + &iisr_operand +}; + +static xtensa_iclass_internal xsr_iclass = { + 2, + &xsr_operand_list[0] +}; + +static xtensa_operand_internal *rsil_operand_list[] = { + &aot_operand, + &iis_operand +}; + +static xtensa_iclass_internal rsil_iclass = { + 2, + &rsil_operand_list[0] +}; + +static xtensa_operand_internal *bst8_operand_list[] = { + &ais_operand, + &ait_operand, + &lisimm8_operand +}; + +static xtensa_iclass_internal bst8_iclass = { + 3, + &bst8_operand_list[0] +}; + +static xtensa_operand_internal *addi_operand_list[] = { + &aot_operand, + &ais_operand, + &iisimm8_operand +}; + +static xtensa_iclass_internal addi_iclass = { + 3, + &addi_operand_list[0] +}; + +static xtensa_operand_internal *callx12_operand_list[] = { + &ais_operand +}; + +static xtensa_iclass_internal callx12_iclass = { + 1, + &callx12_operand_list[0] +}; + +static xtensa_operand_internal *bsi8_operand_list[] = { + &ais_operand, + &iib4const_operand, + &lisimm8_operand +}; + +static xtensa_iclass_internal bsi8_iclass = { + 3, + &bsi8_operand_list[0] +}; + +static xtensa_operand_internal *jumpx_operand_list[] = { + &ais_operand +}; + +static xtensa_iclass_internal jumpx_iclass = { + 1, + &jumpx_operand_list[0] +}; + +static xtensa_iclass_internal retn_iclass = { + 0, + 0 +}; + +static xtensa_operand_internal *nsa_operand_list[] = { + &aot_operand, + &ais_operand +}; + +static xtensa_iclass_internal nsa_iclass = { + 2, + &nsa_operand_list[0] +}; + +static xtensa_operand_internal *storei4_operand_list[] = { + &ait_operand, + &ais_operand, + &iilsi4x4_operand +}; + +static xtensa_iclass_internal storei4_iclass = { + 3, + &storei4_operand_list[0] +}; + +static xtensa_operand_internal *wtlb_operand_list[] = { + &ait_operand, + &ais_operand +}; + +static xtensa_iclass_internal wtlb_iclass = { + 2, + &wtlb_operand_list[0] +}; + +static xtensa_operand_internal *dce_operand_list[] = { + &ais_operand, + &iiuimm4x16_operand +}; + +static xtensa_iclass_internal dce_iclass = { + 2, + &dce_operand_list[0] +}; + +static xtensa_operand_internal *l16i_operand_list[] = { + &aot_operand, + &ais_operand, + &iiuimm8x2_operand +}; + +static xtensa_iclass_internal l16i_iclass = { + 3, + &l16i_operand_list[0] +}; + +static xtensa_operand_internal *callx4_operand_list[] = { + &ais_operand +}; + +static xtensa_iclass_internal callx4_iclass = { + 1, + &callx4_operand_list[0] +}; + +static xtensa_operand_internal *callx8_operand_list[] = { + &ais_operand +}; + +static xtensa_iclass_internal callx8_iclass = { + 1, + &callx8_operand_list[0] +}; + +static xtensa_operand_internal *movsp_operand_list[] = { + &aot_operand, + &ais_operand +}; + +static xtensa_iclass_internal movsp_iclass = { + 2, + &movsp_operand_list[0] +}; + +static xtensa_operand_internal *wsr_operand_list[] = { + &ait_operand, + &iisr_operand +}; + +static xtensa_iclass_internal wsr_iclass = { + 2, + &wsr_operand_list[0] +}; + +static xtensa_operand_internal *call12_operand_list[] = { + &lisoffsetx4_operand +}; + +static xtensa_iclass_internal call12_iclass = { + 1, + &call12_operand_list[0] +}; + +static xtensa_operand_internal *call4_operand_list[] = { + &lisoffsetx4_operand +}; + +static xtensa_iclass_internal call4_iclass = { + 1, + &call4_operand_list[0] +}; + +static xtensa_operand_internal *addmi_operand_list[] = { + &aot_operand, + &ais_operand, + &iisimm8x256_operand +}; + +static xtensa_iclass_internal addmi_iclass = { + 3, + &addmi_operand_list[0] +}; + +static xtensa_operand_internal *bit_operand_list[] = { + &aor_operand, + &ais_operand, + &ait_operand +}; + +static xtensa_iclass_internal bit_iclass = { + 3, + &bit_operand_list[0] +}; + +static xtensa_operand_internal *call8_operand_list[] = { + &lisoffsetx4_operand +}; + +static xtensa_iclass_internal call8_iclass = { + 1, + &call8_operand_list[0] +}; + +static xtensa_iclass_internal itlba_iclass = { + 0, + 0 +}; + +static xtensa_operand_internal *break_n_operand_list[] = { + &iis_operand +}; + +static xtensa_iclass_internal break_n_iclass = { + 1, + &break_n_operand_list[0] +}; + +static xtensa_operand_internal *sar_operand_list[] = { + &ais_operand +}; + +static xtensa_iclass_internal sar_iclass = { + 1, + &sar_operand_list[0] +}; + +static xtensa_operand_internal *s32e_operand_list[] = { + &ait_operand, + &ais_operand, + &iinimm4x2_operand +}; + +static xtensa_iclass_internal s32e_iclass = { + 3, + &s32e_operand_list[0] +}; + +static xtensa_operand_internal *bz6_operand_list[] = { + &ais_operand, + &liuimm6_operand +}; + +static xtensa_iclass_internal bz6_iclass = { + 2, + &bz6_operand_list[0] +}; + +static xtensa_operand_internal *loop_operand_list[] = { + &ais_operand, + &liuimm8_operand +}; + +static xtensa_iclass_internal loop_iclass = { + 2, + &loop_operand_list[0] +}; + +static xtensa_operand_internal *rsr_operand_list[] = { + &aot_operand, + &iisr_operand +}; + +static xtensa_iclass_internal rsr_iclass = { + 2, + &rsr_operand_list[0] +}; + +static xtensa_operand_internal *icache_operand_list[] = { + &ais_operand, + &iiuimm8x4_operand +}; + +static xtensa_iclass_internal icache_iclass = { + 2, + &icache_operand_list[0] +}; + +static xtensa_operand_internal *s8i_operand_list[] = { + &ait_operand, + &ais_operand, + &iiuimm8_operand +}; + +static xtensa_iclass_internal s8i_iclass = { + 3, + &s8i_operand_list[0] +}; + +static xtensa_iclass_internal return_iclass = { + 0, + 0 +}; + +static xtensa_operand_internal *dcache_operand_list[] = { + &ais_operand, + &iiuimm8x4_operand +}; + +static xtensa_iclass_internal dcache_iclass = { + 2, + &dcache_operand_list[0] +}; + +static xtensa_operand_internal *s32i_operand_list[] = { + &ait_operand, + &ais_operand, + &iiuimm8x4_operand +}; + +static xtensa_iclass_internal s32i_iclass = { + 3, + &s32i_operand_list[0] +}; + +static xtensa_operand_internal *jump_operand_list[] = { + &lisoffset_operand +}; + +static xtensa_iclass_internal jump_iclass = { + 1, + &jump_operand_list[0] +}; + +static xtensa_operand_internal *addi_n_operand_list[] = { + &aor_operand, + &ais_operand, + &iiai4const_operand +}; + +static xtensa_iclass_internal addi_n_iclass = { + 3, + &addi_n_operand_list[0] +}; + +static xtensa_iclass_internal sync_iclass = { + 0, + 0 +}; + +static xtensa_operand_internal *neg_operand_list[] = { + &aor_operand, + &ait_operand +}; + +static xtensa_iclass_internal neg_iclass = { + 2, + &neg_operand_list[0] +}; + +static xtensa_iclass_internal syscall_iclass = { + 0, + 0 +}; + +static xtensa_operand_internal *bsz12_operand_list[] = { + &ais_operand, + &lisimm12_operand +}; + +static xtensa_iclass_internal bsz12_iclass = { + 2, + &bsz12_operand_list[0] +}; + +static xtensa_iclass_internal excw_iclass = { + 0, + 0 +}; + +static xtensa_operand_internal *movi_n_operand_list[] = { + &aos_operand, + &iisimm7_operand +}; + +static xtensa_iclass_internal movi_n_iclass = { + 2, + &movi_n_operand_list[0] +}; + +static xtensa_operand_internal *rtlb_operand_list[] = { + &aot_operand, + &ais_operand +}; + +static xtensa_iclass_internal rtlb_iclass = { + 2, + &rtlb_operand_list[0] +}; + +static xtensa_operand_internal *actl_operand_list[] = { + &aot_operand, + &ais_operand +}; + +static xtensa_iclass_internal actl_iclass = { + 2, + &actl_operand_list[0] +}; + +static xtensa_operand_internal *srli_operand_list[] = { + &aor_operand, + &ait_operand, + &iis_operand +}; + +static xtensa_iclass_internal srli_iclass = { + 3, + &srli_operand_list[0] +}; + +static xtensa_operand_internal *bsi8b_operand_list[] = { + &ais_operand, + &iibbi_operand, + &lisimm8_operand +}; + +static xtensa_iclass_internal bsi8b_iclass = { + 3, + &bsi8b_operand_list[0] +}; + +static xtensa_operand_internal *acts_operand_list[] = { + &ait_operand, + &ais_operand +}; + +static xtensa_iclass_internal acts_iclass = { + 2, + &acts_operand_list[0] +}; + +static xtensa_operand_internal *add_n_operand_list[] = { + &aor_operand, + &ais_operand, + &ait_operand +}; + +static xtensa_iclass_internal add_n_iclass = { + 3, + &add_n_operand_list[0] +}; + +static xtensa_operand_internal *srai_operand_list[] = { + &aor_operand, + &ait_operand, + &iisar_operand +}; + +static xtensa_iclass_internal srai_iclass = { + 3, + &srai_operand_list[0] +}; + +static xtensa_operand_internal *entry_operand_list[] = { + &abs_operand, + &iiuimm12x8_operand +}; + +static xtensa_iclass_internal entry_iclass = { + 2, + &entry_operand_list[0] +}; + +static xtensa_operand_internal *l32e_operand_list[] = { + &aot_operand, + &ais_operand, + &iinimm4x2_operand +}; + +static xtensa_iclass_internal l32e_iclass = { + 3, + &l32e_operand_list[0] +}; + +static xtensa_operand_internal *dpf_operand_list[] = { + &ais_operand, + &iiuimm8x4_operand +}; + +static xtensa_iclass_internal dpf_iclass = { + 2, + &dpf_operand_list[0] +}; + +static xtensa_operand_internal *l32i_operand_list[] = { + &aot_operand, + &ais_operand, + &iiuimm8x4_operand +}; + +static xtensa_iclass_internal l32i_iclass = { + 3, + &l32i_operand_list[0] +}; + +static xtensa_insnbuf abs_template (void); +static xtensa_insnbuf add_template (void); +static xtensa_insnbuf add_n_template (void); +static xtensa_insnbuf addi_template (void); +static xtensa_insnbuf addi_n_template (void); +static xtensa_insnbuf addmi_template (void); +static xtensa_insnbuf addx2_template (void); +static xtensa_insnbuf addx4_template (void); +static xtensa_insnbuf addx8_template (void); +static xtensa_insnbuf and_template (void); +static xtensa_insnbuf ball_template (void); +static xtensa_insnbuf bany_template (void); +static xtensa_insnbuf bbc_template (void); +static xtensa_insnbuf bbci_template (void); +static xtensa_insnbuf bbs_template (void); +static xtensa_insnbuf bbsi_template (void); +static xtensa_insnbuf beq_template (void); +static xtensa_insnbuf beqi_template (void); +static xtensa_insnbuf beqz_template (void); +static xtensa_insnbuf beqz_n_template (void); +static xtensa_insnbuf bge_template (void); +static xtensa_insnbuf bgei_template (void); +static xtensa_insnbuf bgeu_template (void); +static xtensa_insnbuf bgeui_template (void); +static xtensa_insnbuf bgez_template (void); +static xtensa_insnbuf blt_template (void); +static xtensa_insnbuf blti_template (void); +static xtensa_insnbuf bltu_template (void); +static xtensa_insnbuf bltui_template (void); +static xtensa_insnbuf bltz_template (void); +static xtensa_insnbuf bnall_template (void); +static xtensa_insnbuf bne_template (void); +static xtensa_insnbuf bnei_template (void); +static xtensa_insnbuf bnez_template (void); +static xtensa_insnbuf bnez_n_template (void); +static xtensa_insnbuf bnone_template (void); +static xtensa_insnbuf break_template (void); +static xtensa_insnbuf break_n_template (void); +static xtensa_insnbuf call0_template (void); +static xtensa_insnbuf call12_template (void); +static xtensa_insnbuf call4_template (void); +static xtensa_insnbuf call8_template (void); +static xtensa_insnbuf callx0_template (void); +static xtensa_insnbuf callx12_template (void); +static xtensa_insnbuf callx4_template (void); +static xtensa_insnbuf callx8_template (void); +static xtensa_insnbuf dhi_template (void); +static xtensa_insnbuf dhwb_template (void); +static xtensa_insnbuf dhwbi_template (void); +static xtensa_insnbuf dii_template (void); +static xtensa_insnbuf diwb_template (void); +static xtensa_insnbuf diwbi_template (void); +static xtensa_insnbuf dpfr_template (void); +static xtensa_insnbuf dpfro_template (void); +static xtensa_insnbuf dpfw_template (void); +static xtensa_insnbuf dpfwo_template (void); +static xtensa_insnbuf dsync_template (void); +static xtensa_insnbuf entry_template (void); +static xtensa_insnbuf esync_template (void); +static xtensa_insnbuf excw_template (void); +static xtensa_insnbuf extui_template (void); +static xtensa_insnbuf idtlb_template (void); +static xtensa_insnbuf idtlba_template (void); +static xtensa_insnbuf ihi_template (void); +static xtensa_insnbuf iii_template (void); +static xtensa_insnbuf iitlb_template (void); +static xtensa_insnbuf iitlba_template (void); +static xtensa_insnbuf ipf_template (void); +static xtensa_insnbuf isync_template (void); +static xtensa_insnbuf j_template (void); +static xtensa_insnbuf jx_template (void); +static xtensa_insnbuf l16si_template (void); +static xtensa_insnbuf l16ui_template (void); +static xtensa_insnbuf l32e_template (void); +static xtensa_insnbuf l32i_template (void); +static xtensa_insnbuf l32i_n_template (void); +static xtensa_insnbuf l32r_template (void); +static xtensa_insnbuf l8ui_template (void); +static xtensa_insnbuf ldct_template (void); +static xtensa_insnbuf lict_template (void); +static xtensa_insnbuf licw_template (void); +static xtensa_insnbuf loop_template (void); +static xtensa_insnbuf loopgtz_template (void); +static xtensa_insnbuf loopnez_template (void); +static xtensa_insnbuf memw_template (void); +static xtensa_insnbuf mov_n_template (void); +static xtensa_insnbuf moveqz_template (void); +static xtensa_insnbuf movgez_template (void); +static xtensa_insnbuf movi_template (void); +static xtensa_insnbuf movi_n_template (void); +static xtensa_insnbuf movltz_template (void); +static xtensa_insnbuf movnez_template (void); +static xtensa_insnbuf movsp_template (void); +static xtensa_insnbuf neg_template (void); +static xtensa_insnbuf nop_n_template (void); +static xtensa_insnbuf nsa_template (void); +static xtensa_insnbuf nsau_template (void); +static xtensa_insnbuf or_template (void); +static xtensa_insnbuf pdtlb_template (void); +static xtensa_insnbuf pitlb_template (void); +static xtensa_insnbuf rdtlb0_template (void); +static xtensa_insnbuf rdtlb1_template (void); +static xtensa_insnbuf ret_template (void); +static xtensa_insnbuf ret_n_template (void); +static xtensa_insnbuf retw_template (void); +static xtensa_insnbuf retw_n_template (void); +static xtensa_insnbuf rfde_template (void); +static xtensa_insnbuf rfe_template (void); +static xtensa_insnbuf rfi_template (void); +static xtensa_insnbuf rfwo_template (void); +static xtensa_insnbuf rfwu_template (void); +static xtensa_insnbuf ritlb0_template (void); +static xtensa_insnbuf ritlb1_template (void); +static xtensa_insnbuf rotw_template (void); +static xtensa_insnbuf rsil_template (void); +static xtensa_insnbuf rsr_template (void); +static xtensa_insnbuf rsync_template (void); +static xtensa_insnbuf s16i_template (void); +static xtensa_insnbuf s32e_template (void); +static xtensa_insnbuf s32i_template (void); +static xtensa_insnbuf s32i_n_template (void); +static xtensa_insnbuf s8i_template (void); +static xtensa_insnbuf sdct_template (void); +static xtensa_insnbuf sict_template (void); +static xtensa_insnbuf sicw_template (void); +static xtensa_insnbuf simcall_template (void); +static xtensa_insnbuf sll_template (void); +static xtensa_insnbuf slli_template (void); +static xtensa_insnbuf sra_template (void); +static xtensa_insnbuf srai_template (void); +static xtensa_insnbuf src_template (void); +static xtensa_insnbuf srl_template (void); +static xtensa_insnbuf srli_template (void); +static xtensa_insnbuf ssa8b_template (void); +static xtensa_insnbuf ssa8l_template (void); +static xtensa_insnbuf ssai_template (void); +static xtensa_insnbuf ssl_template (void); +static xtensa_insnbuf ssr_template (void); +static xtensa_insnbuf sub_template (void); +static xtensa_insnbuf subx2_template (void); +static xtensa_insnbuf subx4_template (void); +static xtensa_insnbuf subx8_template (void); +static xtensa_insnbuf syscall_template (void); +static xtensa_insnbuf waiti_template (void); +static xtensa_insnbuf wdtlb_template (void); +static xtensa_insnbuf witlb_template (void); +static xtensa_insnbuf wsr_template (void); +static xtensa_insnbuf xor_template (void); +static xtensa_insnbuf xsr_template (void); + +static xtensa_insnbuf +abs_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00001006 }; + return &template[0]; +} + +static xtensa_insnbuf +add_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000008 }; + return &template[0]; +} + +static xtensa_insnbuf +add_n_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00a00000 }; + return &template[0]; +} + +static xtensa_insnbuf +addi_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00200c00 }; + return &template[0]; +} + +static xtensa_insnbuf +addi_n_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00b00000 }; + return &template[0]; +} + +static xtensa_insnbuf +addmi_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00200d00 }; + return &template[0]; +} + +static xtensa_insnbuf +addx2_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000009 }; + return &template[0]; +} + +static xtensa_insnbuf +addx4_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000000a }; + return &template[0]; +} + +static xtensa_insnbuf +addx8_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000000b }; + return &template[0]; +} + +static xtensa_insnbuf +and_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000001 }; + return &template[0]; +} + +static xtensa_insnbuf +ball_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700400 }; + return &template[0]; +} + +static xtensa_insnbuf +bany_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700800 }; + return &template[0]; +} + +static xtensa_insnbuf +bbc_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700500 }; + return &template[0]; +} + +static xtensa_insnbuf +bbci_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700600 }; + return &template[0]; +} + +static xtensa_insnbuf +bbs_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700d00 }; + return &template[0]; +} + +static xtensa_insnbuf +bbsi_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700e00 }; + return &template[0]; +} + +static xtensa_insnbuf +beq_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700100 }; + return &template[0]; +} + +static xtensa_insnbuf +beqi_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00680000 }; + return &template[0]; +} + +static xtensa_insnbuf +beqz_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00640000 }; + return &template[0]; +} + +static xtensa_insnbuf +beqz_n_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00c80000 }; + return &template[0]; +} + +static xtensa_insnbuf +bge_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700a00 }; + return &template[0]; +} + +static xtensa_insnbuf +bgei_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x006b0000 }; + return &template[0]; +} + +static xtensa_insnbuf +bgeu_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700b00 }; + return &template[0]; +} + +static xtensa_insnbuf +bgeui_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x006f0000 }; + return &template[0]; +} + +static xtensa_insnbuf +bgez_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00670000 }; + return &template[0]; +} + +static xtensa_insnbuf +blt_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700200 }; + return &template[0]; +} + +static xtensa_insnbuf +blti_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x006a0000 }; + return &template[0]; +} + +static xtensa_insnbuf +bltu_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700300 }; + return &template[0]; +} + +static xtensa_insnbuf +bltui_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x006e0000 }; + return &template[0]; +} + +static xtensa_insnbuf +bltz_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00660000 }; + return &template[0]; +} + +static xtensa_insnbuf +bnall_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700c00 }; + return &template[0]; +} + +static xtensa_insnbuf +bne_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700900 }; + return &template[0]; +} + +static xtensa_insnbuf +bnei_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00690000 }; + return &template[0]; +} + +static xtensa_insnbuf +bnez_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00650000 }; + return &template[0]; +} + +static xtensa_insnbuf +bnez_n_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00cc0000 }; + return &template[0]; +} + +static xtensa_insnbuf +bnone_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00700000 }; + return &template[0]; +} + +static xtensa_insnbuf +break_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000400 }; + return &template[0]; +} + +static xtensa_insnbuf +break_n_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00d20f00 }; + return &template[0]; +} + +static xtensa_insnbuf +call0_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00500000 }; + return &template[0]; +} + +static xtensa_insnbuf +call12_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x005c0000 }; + return &template[0]; +} + +static xtensa_insnbuf +call4_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00540000 }; + return &template[0]; +} + +static xtensa_insnbuf +call8_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00580000 }; + return &template[0]; +} + +static xtensa_insnbuf +callx0_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00030000 }; + return &template[0]; +} + +static xtensa_insnbuf +callx12_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x000f0000 }; + return &template[0]; +} + +static xtensa_insnbuf +callx4_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00070000 }; + return &template[0]; +} + +static xtensa_insnbuf +callx8_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x000b0000 }; + return &template[0]; +} + +static xtensa_insnbuf +dhi_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00260700 }; + return &template[0]; +} + +static xtensa_insnbuf +dhwb_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00240700 }; + return &template[0]; +} + +static xtensa_insnbuf +dhwbi_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00250700 }; + return &template[0]; +} + +static xtensa_insnbuf +dii_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00270700 }; + return &template[0]; +} + +static xtensa_insnbuf +diwb_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00280740 }; + return &template[0]; +} + +static xtensa_insnbuf +diwbi_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00280750 }; + return &template[0]; +} + +static xtensa_insnbuf +dpfr_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00200700 }; + return &template[0]; +} + +static xtensa_insnbuf +dpfro_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00220700 }; + return &template[0]; +} + +static xtensa_insnbuf +dpfw_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00210700 }; + return &template[0]; +} + +static xtensa_insnbuf +dpfwo_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00230700 }; + return &template[0]; +} + +static xtensa_insnbuf +dsync_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00030200 }; + return &template[0]; +} + +static xtensa_insnbuf +entry_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x006c0000 }; + return &template[0]; +} + +static xtensa_insnbuf +esync_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00020200 }; + return &template[0]; +} + +static xtensa_insnbuf +excw_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00080200 }; + return &template[0]; +} + +static xtensa_insnbuf +extui_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000040 }; + return &template[0]; +} + +static xtensa_insnbuf +idtlb_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000c05 }; + return &template[0]; +} + +static xtensa_insnbuf +idtlba_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000805 }; + return &template[0]; +} + +static xtensa_insnbuf +ihi_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x002e0700 }; + return &template[0]; +} + +static xtensa_insnbuf +iii_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x002f0700 }; + return &template[0]; +} + +static xtensa_insnbuf +iitlb_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000405 }; + return &template[0]; +} + +static xtensa_insnbuf +iitlba_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000005 }; + return &template[0]; +} + +static xtensa_insnbuf +ipf_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x002c0700 }; + return &template[0]; +} + +static xtensa_insnbuf +isync_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000200 }; + return &template[0]; +} + +static xtensa_insnbuf +j_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00600000 }; + return &template[0]; +} + +static xtensa_insnbuf +jx_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x000a0000 }; + return &template[0]; +} + +static xtensa_insnbuf +l16si_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00200900 }; + return &template[0]; +} + +static xtensa_insnbuf +l16ui_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00200100 }; + return &template[0]; +} + +static xtensa_insnbuf +l32e_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000090 }; + return &template[0]; +} + +static xtensa_insnbuf +l32i_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00200200 }; + return &template[0]; +} + +static xtensa_insnbuf +l32i_n_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00800000 }; + return &template[0]; +} + +static xtensa_insnbuf +l32r_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00100000 }; + return &template[0]; +} + +static xtensa_insnbuf +l8ui_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00200000 }; + return &template[0]; +} + +static xtensa_insnbuf +ldct_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000081f }; + return &template[0]; +} + +static xtensa_insnbuf +lict_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000001f }; + return &template[0]; +} + +static xtensa_insnbuf +licw_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000021f }; + return &template[0]; +} + +static xtensa_insnbuf +loop_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x006d0800 }; + return &template[0]; +} + +static xtensa_insnbuf +loopgtz_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x006d0a00 }; + return &template[0]; +} + +static xtensa_insnbuf +loopnez_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x006d0900 }; + return &template[0]; +} + +static xtensa_insnbuf +memw_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x000c0200 }; + return &template[0]; +} + +static xtensa_insnbuf +mov_n_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00d00000 }; + return &template[0]; +} + +static xtensa_insnbuf +moveqz_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000038 }; + return &template[0]; +} + +static xtensa_insnbuf +movgez_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000003b }; + return &template[0]; +} + +static xtensa_insnbuf +movi_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00200a00 }; + return &template[0]; +} + +static xtensa_insnbuf +movi_n_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00c00000 }; + return &template[0]; +} + +static xtensa_insnbuf +movltz_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000003a }; + return &template[0]; +} + +static xtensa_insnbuf +movnez_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000039 }; + return &template[0]; +} + +static xtensa_insnbuf +movsp_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000100 }; + return &template[0]; +} + +static xtensa_insnbuf +neg_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000006 }; + return &template[0]; +} + +static xtensa_insnbuf +nop_n_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00d30f00 }; + return &template[0]; +} + +static xtensa_insnbuf +nsa_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000e04 }; + return &template[0]; +} + +static xtensa_insnbuf +nsau_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000f04 }; + return &template[0]; +} + +static xtensa_insnbuf +or_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000002 }; + return &template[0]; +} + +static xtensa_insnbuf +pdtlb_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000d05 }; + return &template[0]; +} + +static xtensa_insnbuf +pitlb_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000505 }; + return &template[0]; +} + +static xtensa_insnbuf +rdtlb0_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000b05 }; + return &template[0]; +} + +static xtensa_insnbuf +rdtlb1_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000f05 }; + return &template[0]; +} + +static xtensa_insnbuf +ret_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00020000 }; + return &template[0]; +} + +static xtensa_insnbuf +ret_n_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00d00f00 }; + return &template[0]; +} + +static xtensa_insnbuf +retw_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00060000 }; + return &template[0]; +} + +static xtensa_insnbuf +retw_n_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00d10f00 }; + return &template[0]; +} + +static xtensa_insnbuf +rfde_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00002300 }; + return &template[0]; +} + +static xtensa_insnbuf +rfe_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000300 }; + return &template[0]; +} + +static xtensa_insnbuf +rfi_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00010300 }; + return &template[0]; +} + +static xtensa_insnbuf +rfwo_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00004300 }; + return &template[0]; +} + +static xtensa_insnbuf +rfwu_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00005300 }; + return &template[0]; +} + +static xtensa_insnbuf +ritlb0_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000305 }; + return &template[0]; +} + +static xtensa_insnbuf +ritlb1_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000705 }; + return &template[0]; +} + +static xtensa_insnbuf +rotw_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000804 }; + return &template[0]; +} + +static xtensa_insnbuf +rsil_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000600 }; + return &template[0]; +} + +static xtensa_insnbuf +rsr_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000030 }; + return &template[0]; +} + +static xtensa_insnbuf +rsync_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00010200 }; + return &template[0]; +} + +static xtensa_insnbuf +s16i_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00200500 }; + return &template[0]; +} + +static xtensa_insnbuf +s32e_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000094 }; + return &template[0]; +} + +static xtensa_insnbuf +s32i_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00200600 }; + return &template[0]; +} + +static xtensa_insnbuf +s32i_n_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00900000 }; + return &template[0]; +} + +static xtensa_insnbuf +s8i_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00200400 }; + return &template[0]; +} + +static xtensa_insnbuf +sdct_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000091f }; + return &template[0]; +} + +static xtensa_insnbuf +sict_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000011f }; + return &template[0]; +} + +static xtensa_insnbuf +sicw_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000031f }; + return &template[0]; +} + +static xtensa_insnbuf +simcall_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00001500 }; + return &template[0]; +} + +static xtensa_insnbuf +sll_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000001a }; + return &template[0]; +} + +static xtensa_insnbuf +slli_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000010 }; + return &template[0]; +} + +static xtensa_insnbuf +sra_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000001b }; + return &template[0]; +} + +static xtensa_insnbuf +srai_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000012 }; + return &template[0]; +} + +static xtensa_insnbuf +src_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000018 }; + return &template[0]; +} + +static xtensa_insnbuf +srl_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000019 }; + return &template[0]; +} + +static xtensa_insnbuf +srli_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000014 }; + return &template[0]; +} + +static xtensa_insnbuf +ssa8b_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000304 }; + return &template[0]; +} + +static xtensa_insnbuf +ssa8l_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000204 }; + return &template[0]; +} + +static xtensa_insnbuf +ssai_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000404 }; + return &template[0]; +} + +static xtensa_insnbuf +ssl_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000104 }; + return &template[0]; +} + +static xtensa_insnbuf +ssr_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000004 }; + return &template[0]; +} + +static xtensa_insnbuf +sub_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000000c }; + return &template[0]; +} + +static xtensa_insnbuf +subx2_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000000d }; + return &template[0]; +} + +static xtensa_insnbuf +subx4_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000000e }; + return &template[0]; +} + +static xtensa_insnbuf +subx8_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x0000000f }; + return &template[0]; +} + +static xtensa_insnbuf +syscall_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000500 }; + return &template[0]; +} + +static xtensa_insnbuf +waiti_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000700 }; + return &template[0]; +} + +static xtensa_insnbuf +wdtlb_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000e05 }; + return &template[0]; +} + +static xtensa_insnbuf +witlb_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000605 }; + return &template[0]; +} + +static xtensa_insnbuf +wsr_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000031 }; + return &template[0]; +} + +static xtensa_insnbuf +xor_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000003 }; + return &template[0]; +} + +static xtensa_insnbuf +xsr_template (void) +{ + static xtensa_insnbuf_word template[] = { 0x00000016 }; + return &template[0]; +} + +static xtensa_opcode_internal abs_opcode = { + "abs", + 3, + abs_template, + &neg_iclass +}; + +static xtensa_opcode_internal add_opcode = { + "add", + 3, + add_template, + &addsub_iclass +}; + +static xtensa_opcode_internal add_n_opcode = { + "add.n", + 2, + add_n_template, + &add_n_iclass +}; + +static xtensa_opcode_internal addi_opcode = { + "addi", + 3, + addi_template, + &addi_iclass +}; + +static xtensa_opcode_internal addi_n_opcode = { + "addi.n", + 2, + addi_n_template, + &addi_n_iclass +}; + +static xtensa_opcode_internal addmi_opcode = { + "addmi", + 3, + addmi_template, + &addmi_iclass +}; + +static xtensa_opcode_internal addx2_opcode = { + "addx2", + 3, + addx2_template, + &addsub_iclass +}; + +static xtensa_opcode_internal addx4_opcode = { + "addx4", + 3, + addx4_template, + &addsub_iclass +}; + +static xtensa_opcode_internal addx8_opcode = { + "addx8", + 3, + addx8_template, + &addsub_iclass +}; + +static xtensa_opcode_internal and_opcode = { + "and", + 3, + and_template, + &bit_iclass +}; + +static xtensa_opcode_internal ball_opcode = { + "ball", + 3, + ball_template, + &bst8_iclass +}; + +static xtensa_opcode_internal bany_opcode = { + "bany", + 3, + bany_template, + &bst8_iclass +}; + +static xtensa_opcode_internal bbc_opcode = { + "bbc", + 3, + bbc_template, + &bst8_iclass +}; + +static xtensa_opcode_internal bbci_opcode = { + "bbci", + 3, + bbci_template, + &bsi8b_iclass +}; + +static xtensa_opcode_internal bbs_opcode = { + "bbs", + 3, + bbs_template, + &bst8_iclass +}; + +static xtensa_opcode_internal bbsi_opcode = { + "bbsi", + 3, + bbsi_template, + &bsi8b_iclass +}; + +static xtensa_opcode_internal beq_opcode = { + "beq", + 3, + beq_template, + &bst8_iclass +}; + +static xtensa_opcode_internal beqi_opcode = { + "beqi", + 3, + beqi_template, + &bsi8_iclass +}; + +static xtensa_opcode_internal beqz_opcode = { + "beqz", + 3, + beqz_template, + &bsz12_iclass +}; + +static xtensa_opcode_internal beqz_n_opcode = { + "beqz.n", + 2, + beqz_n_template, + &bz6_iclass +}; + +static xtensa_opcode_internal bge_opcode = { + "bge", + 3, + bge_template, + &bst8_iclass +}; + +static xtensa_opcode_internal bgei_opcode = { + "bgei", + 3, + bgei_template, + &bsi8_iclass +}; + +static xtensa_opcode_internal bgeu_opcode = { + "bgeu", + 3, + bgeu_template, + &bst8_iclass +}; + +static xtensa_opcode_internal bgeui_opcode = { + "bgeui", + 3, + bgeui_template, + &bsi8u_iclass +}; + +static xtensa_opcode_internal bgez_opcode = { + "bgez", + 3, + bgez_template, + &bsz12_iclass +}; + +static xtensa_opcode_internal blt_opcode = { + "blt", + 3, + blt_template, + &bst8_iclass +}; + +static xtensa_opcode_internal blti_opcode = { + "blti", + 3, + blti_template, + &bsi8_iclass +}; + +static xtensa_opcode_internal bltu_opcode = { + "bltu", + 3, + bltu_template, + &bst8_iclass +}; + +static xtensa_opcode_internal bltui_opcode = { + "bltui", + 3, + bltui_template, + &bsi8u_iclass +}; + +static xtensa_opcode_internal bltz_opcode = { + "bltz", + 3, + bltz_template, + &bsz12_iclass +}; + +static xtensa_opcode_internal bnall_opcode = { + "bnall", + 3, + bnall_template, + &bst8_iclass +}; + +static xtensa_opcode_internal bne_opcode = { + "bne", + 3, + bne_template, + &bst8_iclass +}; + +static xtensa_opcode_internal bnei_opcode = { + "bnei", + 3, + bnei_template, + &bsi8_iclass +}; + +static xtensa_opcode_internal bnez_opcode = { + "bnez", + 3, + bnez_template, + &bsz12_iclass +}; + +static xtensa_opcode_internal bnez_n_opcode = { + "bnez.n", + 2, + bnez_n_template, + &bz6_iclass +}; + +static xtensa_opcode_internal bnone_opcode = { + "bnone", + 3, + bnone_template, + &bst8_iclass +}; + +static xtensa_opcode_internal break_opcode = { + "break", + 3, + break_template, + &break_iclass +}; + +static xtensa_opcode_internal break_n_opcode = { + "break.n", + 2, + break_n_template, + &break_n_iclass +}; + +static xtensa_opcode_internal call0_opcode = { + "call0", + 3, + call0_template, + &call_iclass +}; + +static xtensa_opcode_internal call12_opcode = { + "call12", + 3, + call12_template, + &call12_iclass +}; + +static xtensa_opcode_internal call4_opcode = { + "call4", + 3, + call4_template, + &call4_iclass +}; + +static xtensa_opcode_internal call8_opcode = { + "call8", + 3, + call8_template, + &call8_iclass +}; + +static xtensa_opcode_internal callx0_opcode = { + "callx0", + 3, + callx0_template, + &callx_iclass +}; + +static xtensa_opcode_internal callx12_opcode = { + "callx12", + 3, + callx12_template, + &callx12_iclass +}; + +static xtensa_opcode_internal callx4_opcode = { + "callx4", + 3, + callx4_template, + &callx4_iclass +}; + +static xtensa_opcode_internal callx8_opcode = { + "callx8", + 3, + callx8_template, + &callx8_iclass +}; + +static xtensa_opcode_internal dhi_opcode = { + "dhi", + 3, + dhi_template, + &dcache_iclass +}; + +static xtensa_opcode_internal dhwb_opcode = { + "dhwb", + 3, + dhwb_template, + &dcache_iclass +}; + +static xtensa_opcode_internal dhwbi_opcode = { + "dhwbi", + 3, + dhwbi_template, + &dcache_iclass +}; + +static xtensa_opcode_internal dii_opcode = { + "dii", + 3, + dii_template, + &dcache_iclass +}; + +static xtensa_opcode_internal diwb_opcode = { + "diwb", + 3, + diwb_template, + &dce_iclass +}; + +static xtensa_opcode_internal diwbi_opcode = { + "diwbi", + 3, + diwbi_template, + &dce_iclass +}; + +static xtensa_opcode_internal dpfr_opcode = { + "dpfr", + 3, + dpfr_template, + &dpf_iclass +}; + +static xtensa_opcode_internal dpfro_opcode = { + "dpfro", + 3, + dpfro_template, + &dpf_iclass +}; + +static xtensa_opcode_internal dpfw_opcode = { + "dpfw", + 3, + dpfw_template, + &dpf_iclass +}; + +static xtensa_opcode_internal dpfwo_opcode = { + "dpfwo", + 3, + dpfwo_template, + &dpf_iclass +}; + +static xtensa_opcode_internal dsync_opcode = { + "dsync", + 3, + dsync_template, + &sync_iclass +}; + +static xtensa_opcode_internal entry_opcode = { + "entry", + 3, + entry_template, + &entry_iclass +}; + +static xtensa_opcode_internal esync_opcode = { + "esync", + 3, + esync_template, + &sync_iclass +}; + +static xtensa_opcode_internal excw_opcode = { + "excw", + 3, + excw_template, + &excw_iclass +}; + +static xtensa_opcode_internal extui_opcode = { + "extui", + 3, + extui_template, + &exti_iclass +}; + +static xtensa_opcode_internal idtlb_opcode = { + "idtlb", + 3, + idtlb_template, + &itlb_iclass +}; + +static xtensa_opcode_internal idtlba_opcode = { + "idtlba", + 3, + idtlba_template, + &itlba_iclass +}; + +static xtensa_opcode_internal ihi_opcode = { + "ihi", + 3, + ihi_template, + &icache_iclass +}; + +static xtensa_opcode_internal iii_opcode = { + "iii", + 3, + iii_template, + &icache_iclass +}; + +static xtensa_opcode_internal iitlb_opcode = { + "iitlb", + 3, + iitlb_template, + &itlb_iclass +}; + +static xtensa_opcode_internal iitlba_opcode = { + "iitlba", + 3, + iitlba_template, + &itlba_iclass +}; + +static xtensa_opcode_internal ipf_opcode = { + "ipf", + 3, + ipf_template, + &icache_iclass +}; + +static xtensa_opcode_internal isync_opcode = { + "isync", + 3, + isync_template, + &sync_iclass +}; + +static xtensa_opcode_internal j_opcode = { + "j", + 3, + j_template, + &jump_iclass +}; + +static xtensa_opcode_internal jx_opcode = { + "jx", + 3, + jx_template, + &jumpx_iclass +}; + +static xtensa_opcode_internal l16si_opcode = { + "l16si", + 3, + l16si_template, + &l16i_iclass +}; + +static xtensa_opcode_internal l16ui_opcode = { + "l16ui", + 3, + l16ui_template, + &l16i_iclass +}; + +static xtensa_opcode_internal l32e_opcode = { + "l32e", + 3, + l32e_template, + &l32e_iclass +}; + +static xtensa_opcode_internal l32i_opcode = { + "l32i", + 3, + l32i_template, + &l32i_iclass +}; + +static xtensa_opcode_internal l32i_n_opcode = { + "l32i.n", + 2, + l32i_n_template, + &loadi4_iclass +}; + +static xtensa_opcode_internal l32r_opcode = { + "l32r", + 3, + l32r_template, + &l32r_iclass +}; + +static xtensa_opcode_internal l8ui_opcode = { + "l8ui", + 3, + l8ui_template, + &l8i_iclass +}; + +static xtensa_opcode_internal ldct_opcode = { + "ldct", + 3, + ldct_template, + &actl_iclass +}; + +static xtensa_opcode_internal lict_opcode = { + "lict", + 3, + lict_template, + &actl_iclass +}; + +static xtensa_opcode_internal licw_opcode = { + "licw", + 3, + licw_template, + &actl_iclass +}; + +static xtensa_opcode_internal loop_opcode = { + "loop", + 3, + loop_template, + &loop_iclass +}; + +static xtensa_opcode_internal loopgtz_opcode = { + "loopgtz", + 3, + loopgtz_template, + &loop_iclass +}; + +static xtensa_opcode_internal loopnez_opcode = { + "loopnez", + 3, + loopnez_template, + &loop_iclass +}; + +static xtensa_opcode_internal memw_opcode = { + "memw", + 3, + memw_template, + &sync_iclass +}; + +static xtensa_opcode_internal mov_n_opcode = { + "mov.n", + 2, + mov_n_template, + &mov_n_iclass +}; + +static xtensa_opcode_internal moveqz_opcode = { + "moveqz", + 3, + moveqz_template, + &movz_iclass +}; + +static xtensa_opcode_internal movgez_opcode = { + "movgez", + 3, + movgez_template, + &movz_iclass +}; + +static xtensa_opcode_internal movi_opcode = { + "movi", + 3, + movi_template, + &movi_iclass +}; + +static xtensa_opcode_internal movi_n_opcode = { + "movi.n", + 2, + movi_n_template, + &movi_n_iclass +}; + +static xtensa_opcode_internal movltz_opcode = { + "movltz", + 3, + movltz_template, + &movz_iclass +}; + +static xtensa_opcode_internal movnez_opcode = { + "movnez", + 3, + movnez_template, + &movz_iclass +}; + +static xtensa_opcode_internal movsp_opcode = { + "movsp", + 3, + movsp_template, + &movsp_iclass +}; + +static xtensa_opcode_internal neg_opcode = { + "neg", + 3, + neg_template, + &neg_iclass +}; + +static xtensa_opcode_internal nop_n_opcode = { + "nop.n", + 2, + nop_n_template, + &nopn_iclass +}; + +static xtensa_opcode_internal nsa_opcode = { + "nsa", + 3, + nsa_template, + &nsa_iclass +}; + +static xtensa_opcode_internal nsau_opcode = { + "nsau", + 3, + nsau_template, + &nsa_iclass +}; + +static xtensa_opcode_internal or_opcode = { + "or", + 3, + or_template, + &bit_iclass +}; + +static xtensa_opcode_internal pdtlb_opcode = { + "pdtlb", + 3, + pdtlb_template, + &rtlb_iclass +}; + +static xtensa_opcode_internal pitlb_opcode = { + "pitlb", + 3, + pitlb_template, + &rtlb_iclass +}; + +static xtensa_opcode_internal rdtlb0_opcode = { + "rdtlb0", + 3, + rdtlb0_template, + &rtlb_iclass +}; + +static xtensa_opcode_internal rdtlb1_opcode = { + "rdtlb1", + 3, + rdtlb1_template, + &rtlb_iclass +}; + +static xtensa_opcode_internal ret_opcode = { + "ret", + 3, + ret_template, + &return_iclass +}; + +static xtensa_opcode_internal ret_n_opcode = { + "ret.n", + 2, + ret_n_template, + &retn_iclass +}; + +static xtensa_opcode_internal retw_opcode = { + "retw", + 3, + retw_template, + &return_iclass +}; + +static xtensa_opcode_internal retw_n_opcode = { + "retw.n", + 2, + retw_n_template, + &retn_iclass +}; + +static xtensa_opcode_internal rfde_opcode = { + "rfde", + 3, + rfde_template, + &rfe_iclass +}; + +static xtensa_opcode_internal rfe_opcode = { + "rfe", + 3, + rfe_template, + &rfe_iclass +}; + +static xtensa_opcode_internal rfi_opcode = { + "rfi", + 3, + rfi_template, + &rfi_iclass +}; + +static xtensa_opcode_internal rfwo_opcode = { + "rfwo", + 3, + rfwo_template, + &rfe_iclass +}; + +static xtensa_opcode_internal rfwu_opcode = { + "rfwu", + 3, + rfwu_template, + &rfe_iclass +}; + +static xtensa_opcode_internal ritlb0_opcode = { + "ritlb0", + 3, + ritlb0_template, + &rtlb_iclass +}; + +static xtensa_opcode_internal ritlb1_opcode = { + "ritlb1", + 3, + ritlb1_template, + &rtlb_iclass +}; + +static xtensa_opcode_internal rotw_opcode = { + "rotw", + 3, + rotw_template, + &rotw_iclass +}; + +static xtensa_opcode_internal rsil_opcode = { + "rsil", + 3, + rsil_template, + &rsil_iclass +}; + +static xtensa_opcode_internal rsr_opcode = { + "rsr", + 3, + rsr_template, + &rsr_iclass +}; + +static xtensa_opcode_internal rsync_opcode = { + "rsync", + 3, + rsync_template, + &sync_iclass +}; + +static xtensa_opcode_internal s16i_opcode = { + "s16i", + 3, + s16i_template, + &s16i_iclass +}; + +static xtensa_opcode_internal s32e_opcode = { + "s32e", + 3, + s32e_template, + &s32e_iclass +}; + +static xtensa_opcode_internal s32i_opcode = { + "s32i", + 3, + s32i_template, + &s32i_iclass +}; + +static xtensa_opcode_internal s32i_n_opcode = { + "s32i.n", + 2, + s32i_n_template, + &storei4_iclass +}; + +static xtensa_opcode_internal s8i_opcode = { + "s8i", + 3, + s8i_template, + &s8i_iclass +}; + +static xtensa_opcode_internal sdct_opcode = { + "sdct", + 3, + sdct_template, + &acts_iclass +}; + +static xtensa_opcode_internal sict_opcode = { + "sict", + 3, + sict_template, + &acts_iclass +}; + +static xtensa_opcode_internal sicw_opcode = { + "sicw", + 3, + sicw_template, + &acts_iclass +}; + +static xtensa_opcode_internal simcall_opcode = { + "simcall", + 3, + simcall_template, + &syscall_iclass +}; + +static xtensa_opcode_internal sll_opcode = { + "sll", + 3, + sll_template, + &shifts_iclass +}; + +static xtensa_opcode_internal slli_opcode = { + "slli", + 3, + slli_template, + &slli_iclass +}; + +static xtensa_opcode_internal sra_opcode = { + "sra", + 3, + sra_template, + &shiftt_iclass +}; + +static xtensa_opcode_internal srai_opcode = { + "srai", + 3, + srai_template, + &srai_iclass +}; + +static xtensa_opcode_internal src_opcode = { + "src", + 3, + src_template, + &shiftst_iclass +}; + +static xtensa_opcode_internal srl_opcode = { + "srl", + 3, + srl_template, + &shiftt_iclass +}; + +static xtensa_opcode_internal srli_opcode = { + "srli", + 3, + srli_template, + &srli_iclass +}; + +static xtensa_opcode_internal ssa8b_opcode = { + "ssa8b", + 3, + ssa8b_template, + &sar_iclass +}; + +static xtensa_opcode_internal ssa8l_opcode = { + "ssa8l", + 3, + ssa8l_template, + &sar_iclass +}; + +static xtensa_opcode_internal ssai_opcode = { + "ssai", + 3, + ssai_template, + &sari_iclass +}; + +static xtensa_opcode_internal ssl_opcode = { + "ssl", + 3, + ssl_template, + &sar_iclass +}; + +static xtensa_opcode_internal ssr_opcode = { + "ssr", + 3, + ssr_template, + &sar_iclass +}; + +static xtensa_opcode_internal sub_opcode = { + "sub", + 3, + sub_template, + &addsub_iclass +}; + +static xtensa_opcode_internal subx2_opcode = { + "subx2", + 3, + subx2_template, + &addsub_iclass +}; + +static xtensa_opcode_internal subx4_opcode = { + "subx4", + 3, + subx4_template, + &addsub_iclass +}; + +static xtensa_opcode_internal subx8_opcode = { + "subx8", + 3, + subx8_template, + &addsub_iclass +}; + +static xtensa_opcode_internal syscall_opcode = { + "syscall", + 3, + syscall_template, + &syscall_iclass +}; + +static xtensa_opcode_internal waiti_opcode = { + "waiti", + 3, + waiti_template, + &wait_iclass +}; + +static xtensa_opcode_internal wdtlb_opcode = { + "wdtlb", + 3, + wdtlb_template, + &wtlb_iclass +}; + +static xtensa_opcode_internal witlb_opcode = { + "witlb", + 3, + witlb_template, + &wtlb_iclass +}; + +static xtensa_opcode_internal wsr_opcode = { + "wsr", + 3, + wsr_template, + &wsr_iclass +}; + +static xtensa_opcode_internal xor_opcode = { + "xor", + 3, + xor_template, + &bit_iclass +}; + +static xtensa_opcode_internal xsr_opcode = { + "xsr", + 3, + xsr_template, + &xsr_iclass +}; + +static xtensa_opcode_internal * opcodes[149] = { + &abs_opcode, + &add_opcode, + &add_n_opcode, + &addi_opcode, + &addi_n_opcode, + &addmi_opcode, + &addx2_opcode, + &addx4_opcode, + &addx8_opcode, + &and_opcode, + &ball_opcode, + &bany_opcode, + &bbc_opcode, + &bbci_opcode, + &bbs_opcode, + &bbsi_opcode, + &beq_opcode, + &beqi_opcode, + &beqz_opcode, + &beqz_n_opcode, + &bge_opcode, + &bgei_opcode, + &bgeu_opcode, + &bgeui_opcode, + &bgez_opcode, + &blt_opcode, + &blti_opcode, + &bltu_opcode, + &bltui_opcode, + &bltz_opcode, + &bnall_opcode, + &bne_opcode, + &bnei_opcode, + &bnez_opcode, + &bnez_n_opcode, + &bnone_opcode, + &break_opcode, + &break_n_opcode, + &call0_opcode, + &call12_opcode, + &call4_opcode, + &call8_opcode, + &callx0_opcode, + &callx12_opcode, + &callx4_opcode, + &callx8_opcode, + &dhi_opcode, + &dhwb_opcode, + &dhwbi_opcode, + &dii_opcode, + &diwb_opcode, + &diwbi_opcode, + &dpfr_opcode, + &dpfro_opcode, + &dpfw_opcode, + &dpfwo_opcode, + &dsync_opcode, + &entry_opcode, + &esync_opcode, + &excw_opcode, + &extui_opcode, + &idtlb_opcode, + &idtlba_opcode, + &ihi_opcode, + &iii_opcode, + &iitlb_opcode, + &iitlba_opcode, + &ipf_opcode, + &isync_opcode, + &j_opcode, + &jx_opcode, + &l16si_opcode, + &l16ui_opcode, + &l32e_opcode, + &l32i_opcode, + &l32i_n_opcode, + &l32r_opcode, + &l8ui_opcode, + &ldct_opcode, + &lict_opcode, + &licw_opcode, + &loop_opcode, + &loopgtz_opcode, + &loopnez_opcode, + &memw_opcode, + &mov_n_opcode, + &moveqz_opcode, + &movgez_opcode, + &movi_opcode, + &movi_n_opcode, + &movltz_opcode, + &movnez_opcode, + &movsp_opcode, + &neg_opcode, + &nop_n_opcode, + &nsa_opcode, + &nsau_opcode, + &or_opcode, + &pdtlb_opcode, + &pitlb_opcode, + &rdtlb0_opcode, + &rdtlb1_opcode, + &ret_opcode, + &ret_n_opcode, + &retw_opcode, + &retw_n_opcode, + &rfde_opcode, + &rfe_opcode, + &rfi_opcode, + &rfwo_opcode, + &rfwu_opcode, + &ritlb0_opcode, + &ritlb1_opcode, + &rotw_opcode, + &rsil_opcode, + &rsr_opcode, + &rsync_opcode, + &s16i_opcode, + &s32e_opcode, + &s32i_opcode, + &s32i_n_opcode, + &s8i_opcode, + &sdct_opcode, + &sict_opcode, + &sicw_opcode, + &simcall_opcode, + &sll_opcode, + &slli_opcode, + &sra_opcode, + &srai_opcode, + &src_opcode, + &srl_opcode, + &srli_opcode, + &ssa8b_opcode, + &ssa8l_opcode, + &ssai_opcode, + &ssl_opcode, + &ssr_opcode, + &sub_opcode, + &subx2_opcode, + &subx4_opcode, + &subx8_opcode, + &syscall_opcode, + &waiti_opcode, + &wdtlb_opcode, + &witlb_opcode, + &wsr_opcode, + &xor_opcode, + &xsr_opcode +}; + +xtensa_opcode_internal ** +get_opcodes (void) +{ + return &opcodes[0]; +} + +int +get_num_opcodes (void) +{ + return 149; +} + +#define xtensa_abs_op 0 +#define xtensa_add_op 1 +#define xtensa_add_n_op 2 +#define xtensa_addi_op 3 +#define xtensa_addi_n_op 4 +#define xtensa_addmi_op 5 +#define xtensa_addx2_op 6 +#define xtensa_addx4_op 7 +#define xtensa_addx8_op 8 +#define xtensa_and_op 9 +#define xtensa_ball_op 10 +#define xtensa_bany_op 11 +#define xtensa_bbc_op 12 +#define xtensa_bbci_op 13 +#define xtensa_bbs_op 14 +#define xtensa_bbsi_op 15 +#define xtensa_beq_op 16 +#define xtensa_beqi_op 17 +#define xtensa_beqz_op 18 +#define xtensa_beqz_n_op 19 +#define xtensa_bge_op 20 +#define xtensa_bgei_op 21 +#define xtensa_bgeu_op 22 +#define xtensa_bgeui_op 23 +#define xtensa_bgez_op 24 +#define xtensa_blt_op 25 +#define xtensa_blti_op 26 +#define xtensa_bltu_op 27 +#define xtensa_bltui_op 28 +#define xtensa_bltz_op 29 +#define xtensa_bnall_op 30 +#define xtensa_bne_op 31 +#define xtensa_bnei_op 32 +#define xtensa_bnez_op 33 +#define xtensa_bnez_n_op 34 +#define xtensa_bnone_op 35 +#define xtensa_break_op 36 +#define xtensa_break_n_op 37 +#define xtensa_call0_op 38 +#define xtensa_call12_op 39 +#define xtensa_call4_op 40 +#define xtensa_call8_op 41 +#define xtensa_callx0_op 42 +#define xtensa_callx12_op 43 +#define xtensa_callx4_op 44 +#define xtensa_callx8_op 45 +#define xtensa_dhi_op 46 +#define xtensa_dhwb_op 47 +#define xtensa_dhwbi_op 48 +#define xtensa_dii_op 49 +#define xtensa_diwb_op 50 +#define xtensa_diwbi_op 51 +#define xtensa_dpfr_op 52 +#define xtensa_dpfro_op 53 +#define xtensa_dpfw_op 54 +#define xtensa_dpfwo_op 55 +#define xtensa_dsync_op 56 +#define xtensa_entry_op 57 +#define xtensa_esync_op 58 +#define xtensa_excw_op 59 +#define xtensa_extui_op 60 +#define xtensa_idtlb_op 61 +#define xtensa_idtlba_op 62 +#define xtensa_ihi_op 63 +#define xtensa_iii_op 64 +#define xtensa_iitlb_op 65 +#define xtensa_iitlba_op 66 +#define xtensa_ipf_op 67 +#define xtensa_isync_op 68 +#define xtensa_j_op 69 +#define xtensa_jx_op 70 +#define xtensa_l16si_op 71 +#define xtensa_l16ui_op 72 +#define xtensa_l32e_op 73 +#define xtensa_l32i_op 74 +#define xtensa_l32i_n_op 75 +#define xtensa_l32r_op 76 +#define xtensa_l8ui_op 77 +#define xtensa_ldct_op 78 +#define xtensa_lict_op 79 +#define xtensa_licw_op 80 +#define xtensa_loop_op 81 +#define xtensa_loopgtz_op 82 +#define xtensa_loopnez_op 83 +#define xtensa_memw_op 84 +#define xtensa_mov_n_op 85 +#define xtensa_moveqz_op 86 +#define xtensa_movgez_op 87 +#define xtensa_movi_op 88 +#define xtensa_movi_n_op 89 +#define xtensa_movltz_op 90 +#define xtensa_movnez_op 91 +#define xtensa_movsp_op 92 +#define xtensa_neg_op 93 +#define xtensa_nop_n_op 94 +#define xtensa_nsa_op 95 +#define xtensa_nsau_op 96 +#define xtensa_or_op 97 +#define xtensa_pdtlb_op 98 +#define xtensa_pitlb_op 99 +#define xtensa_rdtlb0_op 100 +#define xtensa_rdtlb1_op 101 +#define xtensa_ret_op 102 +#define xtensa_ret_n_op 103 +#define xtensa_retw_op 104 +#define xtensa_retw_n_op 105 +#define xtensa_rfde_op 106 +#define xtensa_rfe_op 107 +#define xtensa_rfi_op 108 +#define xtensa_rfwo_op 109 +#define xtensa_rfwu_op 110 +#define xtensa_ritlb0_op 111 +#define xtensa_ritlb1_op 112 +#define xtensa_rotw_op 113 +#define xtensa_rsil_op 114 +#define xtensa_rsr_op 115 +#define xtensa_rsync_op 116 +#define xtensa_s16i_op 117 +#define xtensa_s32e_op 118 +#define xtensa_s32i_op 119 +#define xtensa_s32i_n_op 120 +#define xtensa_s8i_op 121 +#define xtensa_sdct_op 122 +#define xtensa_sict_op 123 +#define xtensa_sicw_op 124 +#define xtensa_simcall_op 125 +#define xtensa_sll_op 126 +#define xtensa_slli_op 127 +#define xtensa_sra_op 128 +#define xtensa_srai_op 129 +#define xtensa_src_op 130 +#define xtensa_srl_op 131 +#define xtensa_srli_op 132 +#define xtensa_ssa8b_op 133 +#define xtensa_ssa8l_op 134 +#define xtensa_ssai_op 135 +#define xtensa_ssl_op 136 +#define xtensa_ssr_op 137 +#define xtensa_sub_op 138 +#define xtensa_subx2_op 139 +#define xtensa_subx4_op 140 +#define xtensa_subx8_op 141 +#define xtensa_syscall_op 142 +#define xtensa_waiti_op 143 +#define xtensa_wdtlb_op 144 +#define xtensa_witlb_op 145 +#define xtensa_wsr_op 146 +#define xtensa_xor_op 147 +#define xtensa_xsr_op 148 + +int +decode_insn (const xtensa_insnbuf insn) +{ + switch (get_op0_field (insn)) { + case 0: /* QRST: op0=0000 */ + switch (get_op1_field (insn)) { + case 3: /* RST3: op1=0011 */ + switch (get_op2_field (insn)) { + case 8: /* MOVEQZ: op2=1000 */ + return xtensa_moveqz_op; + case 9: /* MOVNEZ: op2=1001 */ + return xtensa_movnez_op; + case 10: /* MOVLTZ: op2=1010 */ + return xtensa_movltz_op; + case 11: /* MOVGEZ: op2=1011 */ + return xtensa_movgez_op; + case 0: /* RSR: op2=0000 */ + return xtensa_rsr_op; + case 1: /* WSR: op2=0001 */ + return xtensa_wsr_op; + } + break; + case 9: /* LSI4: op1=1001 */ + switch (get_op2_field (insn)) { + case 4: /* S32E: op2=0100 */ + return xtensa_s32e_op; + case 0: /* L32E: op2=0000 */ + return xtensa_l32e_op; + } + break; + case 4: /* EXTUI: op1=010x */ + case 5: /* EXTUI: op1=010x */ + return xtensa_extui_op; + case 0: /* RST0: op1=0000 */ + switch (get_op2_field (insn)) { + case 15: /* SUBX8: op2=1111 */ + return xtensa_subx8_op; + case 0: /* ST0: op2=0000 */ + switch (get_r_field (insn)) { + case 0: /* SNM0: r=0000 */ + switch (get_m_field (insn)) { + case 2: /* JR: m=10 */ + switch (get_n_field (insn)) { + case 0: /* RET: n=00 */ + return xtensa_ret_op; + case 1: /* RETW: n=01 */ + return xtensa_retw_op; + case 2: /* JX: n=10 */ + return xtensa_jx_op; + } + break; + case 3: /* CALLX: m=11 */ + switch (get_n_field (insn)) { + case 0: /* CALLX0: n=00 */ + return xtensa_callx0_op; + case 1: /* CALLX4: n=01 */ + return xtensa_callx4_op; + case 2: /* CALLX8: n=10 */ + return xtensa_callx8_op; + case 3: /* CALLX12: n=11 */ + return xtensa_callx12_op; + } + break; + } + break; + case 1: /* MOVSP: r=0001 */ + return xtensa_movsp_op; + case 2: /* SYNC: r=0010 */ + switch (get_s_field (insn)) { + case 0: /* SYNCT: s=0000 */ + switch (get_t_field (insn)) { + case 2: /* ESYNC: t=0010 */ + return xtensa_esync_op; + case 3: /* DSYNC: t=0011 */ + return xtensa_dsync_op; + case 8: /* EXCW: t=1000 */ + return xtensa_excw_op; + case 12: /* MEMW: t=1100 */ + return xtensa_memw_op; + case 0: /* ISYNC: t=0000 */ + return xtensa_isync_op; + case 1: /* RSYNC: t=0001 */ + return xtensa_rsync_op; + } + break; + } + break; + case 4: /* BREAK: r=0100 */ + return xtensa_break_op; + case 3: /* RFEI: r=0011 */ + switch (get_t_field (insn)) { + case 0: /* RFET: t=0000 */ + switch (get_s_field (insn)) { + case 2: /* RFDE: s=0010 */ + return xtensa_rfde_op; + case 4: /* RFWO: s=0100 */ + return xtensa_rfwo_op; + case 5: /* RFWU: s=0101 */ + return xtensa_rfwu_op; + case 0: /* RFE: s=0000 */ + return xtensa_rfe_op; + } + break; + case 1: /* RFI: t=0001 */ + return xtensa_rfi_op; + } + break; + case 5: /* SCALL: r=0101 */ + switch (get_s_field (insn)) { + case 0: /* SYSCALL: s=0000 */ + return xtensa_syscall_op; + case 1: /* SIMCALL: s=0001 */ + return xtensa_simcall_op; + } + break; + case 6: /* RSIL: r=0110 */ + return xtensa_rsil_op; + case 7: /* WAITI: r=0111 */ + return xtensa_waiti_op; + } + break; + case 1: /* AND: op2=0001 */ + return xtensa_and_op; + case 2: /* OR: op2=0010 */ + return xtensa_or_op; + case 3: /* XOR: op2=0011 */ + return xtensa_xor_op; + case 4: /* ST1: op2=0100 */ + switch (get_r_field (insn)) { + case 15: /* NSAU: r=1111 */ + return xtensa_nsau_op; + case 0: /* SSR: r=0000 */ + return xtensa_ssr_op; + case 1: /* SSL: r=0001 */ + return xtensa_ssl_op; + case 2: /* SSA8L: r=0010 */ + return xtensa_ssa8l_op; + case 3: /* SSA8B: r=0011 */ + return xtensa_ssa8b_op; + case 4: /* SSAI: r=0100 */ + return xtensa_ssai_op; + case 8: /* ROTW: r=1000 */ + return xtensa_rotw_op; + case 14: /* NSA: r=1110 */ + return xtensa_nsa_op; + } + break; + case 8: /* ADD: op2=1000 */ + return xtensa_add_op; + case 5: /* ST4: op2=0101 */ + switch (get_r_field (insn)) { + case 15: /* RDTLB1: r=1111 */ + return xtensa_rdtlb1_op; + case 0: /* IITLBA: r=0000 */ + return xtensa_iitlba_op; + case 3: /* RITLB0: r=0011 */ + return xtensa_ritlb0_op; + case 4: /* IITLB: r=0100 */ + return xtensa_iitlb_op; + case 8: /* IDTLBA: r=1000 */ + return xtensa_idtlba_op; + case 5: /* PITLB: r=0101 */ + return xtensa_pitlb_op; + case 6: /* WITLB: r=0110 */ + return xtensa_witlb_op; + case 7: /* RITLB1: r=0111 */ + return xtensa_ritlb1_op; + case 11: /* RDTLB0: r=1011 */ + return xtensa_rdtlb0_op; + case 12: /* IDTLB: r=1100 */ + return xtensa_idtlb_op; + case 13: /* PDTLB: r=1101 */ + return xtensa_pdtlb_op; + case 14: /* WDTLB: r=1110 */ + return xtensa_wdtlb_op; + } + break; + case 6: /* RT0: op2=0110 */ + switch (get_s_field (insn)) { + case 0: /* NEG: s=0000 */ + return xtensa_neg_op; + case 1: /* ABS: s=0001 */ + return xtensa_abs_op; + } + break; + case 9: /* ADDX2: op2=1001 */ + return xtensa_addx2_op; + case 10: /* ADDX4: op2=1010 */ + return xtensa_addx4_op; + case 11: /* ADDX8: op2=1011 */ + return xtensa_addx8_op; + case 12: /* SUB: op2=1100 */ + return xtensa_sub_op; + case 13: /* SUBX2: op2=1101 */ + return xtensa_subx2_op; + case 14: /* SUBX4: op2=1110 */ + return xtensa_subx4_op; + } + break; + case 1: /* RST1: op1=0001 */ + switch (get_op2_field (insn)) { + case 15: /* IMP: op2=1111 */ + switch (get_r_field (insn)) { + case 0: /* LICT: r=0000 */ + return xtensa_lict_op; + case 1: /* SICT: r=0001 */ + return xtensa_sict_op; + case 2: /* LICW: r=0010 */ + return xtensa_licw_op; + case 3: /* SICW: r=0011 */ + return xtensa_sicw_op; + case 8: /* LDCT: r=1000 */ + return xtensa_ldct_op; + case 9: /* SDCT: r=1001 */ + return xtensa_sdct_op; + } + break; + case 0: /* SLLI: op2=000x */ + case 1: /* SLLI: op2=000x */ + return xtensa_slli_op; + case 2: /* SRAI: op2=001x */ + case 3: /* SRAI: op2=001x */ + return xtensa_srai_op; + case 4: /* SRLI: op2=0100 */ + return xtensa_srli_op; + case 8: /* SRC: op2=1000 */ + return xtensa_src_op; + case 9: /* SRL: op2=1001 */ + return xtensa_srl_op; + case 6: /* XSR: op2=0110 */ + return xtensa_xsr_op; + case 10: /* SLL: op2=1010 */ + return xtensa_sll_op; + case 11: /* SRA: op2=1011 */ + return xtensa_sra_op; + } + break; + } + break; + case 1: /* L32R: op0=0001 */ + return xtensa_l32r_op; + case 2: /* LSAI: op0=0010 */ + switch (get_r_field (insn)) { + case 0: /* L8UI: r=0000 */ + return xtensa_l8ui_op; + case 1: /* L16UI: r=0001 */ + return xtensa_l16ui_op; + case 2: /* L32I: r=0010 */ + return xtensa_l32i_op; + case 4: /* S8I: r=0100 */ + return xtensa_s8i_op; + case 5: /* S16I: r=0101 */ + return xtensa_s16i_op; + case 9: /* L16SI: r=1001 */ + return xtensa_l16si_op; + case 6: /* S32I: r=0110 */ + return xtensa_s32i_op; + case 7: /* CACHE: r=0111 */ + switch (get_t_field (insn)) { + case 15: /* III: t=1111 */ + return xtensa_iii_op; + case 0: /* DPFR: t=0000 */ + return xtensa_dpfr_op; + case 1: /* DPFW: t=0001 */ + return xtensa_dpfw_op; + case 2: /* DPFRO: t=0010 */ + return xtensa_dpfro_op; + case 4: /* DHWB: t=0100 */ + return xtensa_dhwb_op; + case 3: /* DPFWO: t=0011 */ + return xtensa_dpfwo_op; + case 8: /* DCE: t=1000 */ + switch (get_op1_field (insn)) { + case 4: /* DIWB: op1=0100 */ + return xtensa_diwb_op; + case 5: /* DIWBI: op1=0101 */ + return xtensa_diwbi_op; + } + break; + case 5: /* DHWBI: t=0101 */ + return xtensa_dhwbi_op; + case 6: /* DHI: t=0110 */ + return xtensa_dhi_op; + case 7: /* DII: t=0111 */ + return xtensa_dii_op; + case 12: /* IPF: t=1100 */ + return xtensa_ipf_op; + case 14: /* IHI: t=1110 */ + return xtensa_ihi_op; + } + break; + case 10: /* MOVI: r=1010 */ + return xtensa_movi_op; + case 12: /* ADDI: r=1100 */ + return xtensa_addi_op; + case 13: /* ADDMI: r=1101 */ + return xtensa_addmi_op; + } + break; + case 8: /* L32I.N: op0=1000 */ + return xtensa_l32i_n_op; + case 5: /* CALL: op0=0101 */ + switch (get_n_field (insn)) { + case 0: /* CALL0: n=00 */ + return xtensa_call0_op; + case 1: /* CALL4: n=01 */ + return xtensa_call4_op; + case 2: /* CALL8: n=10 */ + return xtensa_call8_op; + case 3: /* CALL12: n=11 */ + return xtensa_call12_op; + } + break; + case 6: /* SI: op0=0110 */ + switch (get_n_field (insn)) { + case 0: /* J: n=00 */ + return xtensa_j_op; + case 1: /* BZ: n=01 */ + switch (get_m_field (insn)) { + case 0: /* BEQZ: m=00 */ + return xtensa_beqz_op; + case 1: /* BNEZ: m=01 */ + return xtensa_bnez_op; + case 2: /* BLTZ: m=10 */ + return xtensa_bltz_op; + case 3: /* BGEZ: m=11 */ + return xtensa_bgez_op; + } + break; + case 2: /* BI0: n=10 */ + switch (get_m_field (insn)) { + case 0: /* BEQI: m=00 */ + return xtensa_beqi_op; + case 1: /* BNEI: m=01 */ + return xtensa_bnei_op; + case 2: /* BLTI: m=10 */ + return xtensa_blti_op; + case 3: /* BGEI: m=11 */ + return xtensa_bgei_op; + } + break; + case 3: /* BI1: n=11 */ + switch (get_m_field (insn)) { + case 0: /* ENTRY: m=00 */ + return xtensa_entry_op; + case 1: /* B1: m=01 */ + switch (get_r_field (insn)) { + case 8: /* LOOP: r=1000 */ + return xtensa_loop_op; + case 9: /* LOOPNEZ: r=1001 */ + return xtensa_loopnez_op; + case 10: /* LOOPGTZ: r=1010 */ + return xtensa_loopgtz_op; + } + break; + case 2: /* BLTUI: m=10 */ + return xtensa_bltui_op; + case 3: /* BGEUI: m=11 */ + return xtensa_bgeui_op; + } + break; + } + break; + case 9: /* S32I.N: op0=1001 */ + return xtensa_s32i_n_op; + case 10: /* ADD.N: op0=1010 */ + return xtensa_add_n_op; + case 7: /* B: op0=0111 */ + switch (get_r_field (insn)) { + case 6: /* BBCI: r=011x */ + case 7: /* BBCI: r=011x */ + return xtensa_bbci_op; + case 0: /* BNONE: r=0000 */ + return xtensa_bnone_op; + case 1: /* BEQ: r=0001 */ + return xtensa_beq_op; + case 2: /* BLT: r=0010 */ + return xtensa_blt_op; + case 4: /* BALL: r=0100 */ + return xtensa_ball_op; + case 14: /* BBSI: r=111x */ + case 15: /* BBSI: r=111x */ + return xtensa_bbsi_op; + case 3: /* BLTU: r=0011 */ + return xtensa_bltu_op; + case 5: /* BBC: r=0101 */ + return xtensa_bbc_op; + case 8: /* BANY: r=1000 */ + return xtensa_bany_op; + case 9: /* BNE: r=1001 */ + return xtensa_bne_op; + case 10: /* BGE: r=1010 */ + return xtensa_bge_op; + case 11: /* BGEU: r=1011 */ + return xtensa_bgeu_op; + case 12: /* BNALL: r=1100 */ + return xtensa_bnall_op; + case 13: /* BBS: r=1101 */ + return xtensa_bbs_op; + } + break; + case 11: /* ADDI.N: op0=1011 */ + return xtensa_addi_n_op; + case 12: /* ST2: op0=1100 */ + switch (get_i_field (insn)) { + case 0: /* MOVI.N: i=0 */ + return xtensa_movi_n_op; + case 1: /* BZ6: i=1 */ + switch (get_z_field (insn)) { + case 0: /* BEQZ.N: z=0 */ + return xtensa_beqz_n_op; + case 1: /* BNEZ.N: z=1 */ + return xtensa_bnez_n_op; + } + break; + } + break; + case 13: /* ST3: op0=1101 */ + switch (get_r_field (insn)) { + case 15: /* S3: r=1111 */ + switch (get_t_field (insn)) { + case 0: /* RET.N: t=0000 */ + return xtensa_ret_n_op; + case 1: /* RETW.N: t=0001 */ + return xtensa_retw_n_op; + case 2: /* BREAK.N: t=0010 */ + return xtensa_break_n_op; + case 3: /* NOP.N: t=0011 */ + return xtensa_nop_n_op; + } + break; + case 0: /* MOV.N: r=0000 */ + return xtensa_mov_n_op; + } + break; + } + return XTENSA_UNDEFINED; +} + +int +interface_version (void) +{ + return 3; +} + +static struct config_struct config_table[] = { + {"IsaMemoryOrder", "BigEndian"}, + {"PIFReadDataBits", "128"}, + {"PIFWriteDataBits", "128"}, + {"IsaCoprocessorCount", "0"}, + {"IsaUseBooleans", "0"}, + {"IsaUseDensityInstruction", "1"}, + {0, 0} +}; + +struct config_struct * get_config_table (void); + +struct config_struct * +get_config_table (void) +{ + return config_table; +} + +xtensa_isa_module xtensa_isa_modules[] = { + { get_num_opcodes, get_opcodes, decode_insn, get_config_table }, + { 0, 0, 0, 0 } +}; diff --git a/binutils/acconfig.h b/binutils/acconfig.h deleted file mode 100644 index c38c529c901c7..0000000000000 --- a/binutils/acconfig.h +++ /dev/null @@ -1,34 +0,0 @@ - -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Configured target name. */ -#undef TARGET - -/* Whether strstr must be declared even if is included. */ -#undef NEED_DECLARATION_STRSTR - -/* Whether fprintf must be declared even if is included. */ -#undef NEED_DECLARATION_FPRINTF - -/* Whether sbrk must be declared even if is included. */ -#undef NEED_DECLARATION_SBRK - -/* Whether getenv must be declared even if is included. */ -#undef NEED_DECLARATION_GETENV -@TOP@ - -/* Is the type time_t defined in ? */ -#undef HAVE_TIME_T_IN_TIME_H - -/* Is the type time_t defined in ? */ -#undef HAVE_TIME_T_IN_TYPES_H - -/* Does define struct utimbuf? */ -#undef HAVE_GOOD_UTIME_H - -/* Do we need to use the b modifier when opening binary files? */ -#undef USE_BINARY_FOPEN diff --git a/binutils/addr2line.1 b/binutils/addr2line.1 deleted file mode 100644 index 4294a502ecaeb..0000000000000 --- a/binutils/addr2line.1 +++ /dev/null @@ -1,502 +0,0 @@ -.\" Copyright (c) 1997, 2000 Free Software Foundation -.\" See COPYING for conditions for redistribution -.TH addr2line 1 "27 March 1997" "Free Software Foundation" "GNU Development Tools" -.de BP -.sp -.ti \-.2i -\(** -.. - -.SH NAME -addr2line \- convert addresses into file names and line numbers - -.SH SYNOPSIS -.hy 0 -.na -.B addr2line -.RB "[\|" "\-b\ "\c -.I bfdname\c -.RB " | " "\-\-target="\c -.I bfdname\c -\&\|] -.RB "[\|" \-C | \-\-demangle "\|]" -.RB "[\|" "\-e\ "\c -.I filename\c -.RB " | " "\-\-exe="\c -.I filename\c -\&\|] -.RB "[\|" \-f | \-\-functions "\|]" -.RB "[\|" \-s | \-\-basenames "\|]" -.RB "[\|" \-H | \-\-help "\|]" -.RB "[\|" \-V | \-\-version "\|]" -.RB "[\|" addr addr ... "\|]" -.ad b -.hy 1 -.SH DESCRIPTION -\c -.B addr2line -translates program addresses into file names and line numbers. Given -an address and an executable, it uses the debugging information in the -executable to figure out which file name and line number are -associated with a given address. - -The executable to use is specified with the -.B \-e -option. The default is -.B a.out\c -\&. - -.B addr2line -has two modes of operation. - -In the first, hexadecimal addresses are specified on the command line, -and -.B addr2line -displays the file name and line number for each address. - -In the second, -.B addr2line -reads hexadecimal addresses from standard input, and prints the file -name and line number for each address on standard output. In this -mode, -.B addr2line -may be used in a pipe to convert dynamically chosen addresses. - -The format of the output is FILENAME:LINENO. The file name and line -number for each address is printed on a separate line. If the -.B \-f -option is used, then each FILENAME:LINENO line is preceded by a -FUNCTIONNAME line which is the name of the function containing the -address. - -If the file name or function name can not be determined, -.B addr2line -will print two question marks in their place. If the line number can -not be determined, -.B addr2line -will print 0. - -.SH OPTIONS -.TP -.BI "\-b " "bfdname"\c -.TP -.BI "\-\-target=" "bfdname" -Specify the object-code format for the object files to be -\c -.I bfdname\c -\&. - -.TP -.B \-C -.TP -.B \-\-demangle -Decode (\fIdemangle\fP) low-level symbol names into user-level names. -Besides removing any initial underscore prepended by the system, this -makes C++ function names readable. - -.TP -.BI "\-e " "filename"\c -.TP -.BI "\-\-exe=" "filename" -Specify the name of the executable for which addresses should be -translated. The default file is -.B a.out\c -\&. - -.TP -.B \-f -.TP -.B \-\-functions -Display function names as well as file and line number information. - -.TP -.B \-s -.TP -.B \-\-basenames -Display only the base of each file name. - -.SH "SEE ALSO" -.RB "`\|" binutils "\|'" -entry in -.B -info\c -\&; -.I -The GNU Binary Utilities\c -\&, Roland H. Pesch (October 1991). - -.SH COPYING -Copyright (c) 1993, 94, 95, 96, 97, 98, 1999, 2000 Free Software Foundation, Inc. -.PP -This document is distributed under the terms of the GNU Free -Documentation License, version 1.1. That license is described in the -sources for this manual page, but it is not displayed here in order to -make this manual more consise. Copies of this license can also be -obtained from: http://www.gnu.org/copyleft/. - -\" .SH GNU Free Documentation License -\" Version 1.1, March 2000 - -\" Copyright (C) 2000 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. -\" .PP -\" 0. PREAMBLE -\" .PP -\" The purpose of this License is to make a manual, textbook, or other -\" written document "free" in the sense of freedom: to assure everyone -\" the effective freedom to copy and redistribute it, with or without -\" modifying it, either commercially or noncommercially. Secondarily, -\" this License preserves for the author and publisher a way to get -\" credit for their work, while not being considered responsible for -\" modifications made by others. -\" .PP -\" This License is a kind of "copyleft", which means that derivative -\" works of the document must themselves be free in the same sense. It -\" complements the GNU General Public License, which is a copyleft -\" license designed for free software. -\" .PP -\" We have designed this License in order to use it for manuals for free -\" software, because free software needs free documentation: a free -\" program should come with manuals providing the same freedoms that the -\" software does. But this License is not limited to software manuals; -\" it can be used for any textual work, regardless of subject matter or -\" whether it is published as a printed book. We recommend this License -\" principally for works whose purpose is instruction or reference. -\" .PP -\" 1. APPLICABILITY AND DEFINITIONS -\" .PP -\" This License applies to any manual or other work that contains a -\" notice placed by the copyright holder saying it can be distributed -\" under the terms of this License. The "Document", below, refers to any -\" such manual or work. Any member of the public is a licensee, and is -\" addressed as "you". -\" .PP -\" A "Modified Version" of the Document means any work containing the -\" Document or a portion of it, either copied verbatim, or with -\" modifications and/or translated into another language. -\" .PP -\" A "Secondary Section" is a named appendix or a front-matter section of -\" the Document that deals exclusively with the relationship of the -\" publishers or authors of the Document to the Document's overall subject -\" (or to related matters) and contains nothing that could fall directly -\" within that overall subject. (For example, if the Document is in part a -\" textbook of mathematics, a Secondary Section may not explain any -\" mathematics.) The relationship could be a matter of historical -\" connection with the subject or with related matters, or of legal, -\" commercial, philosophical, ethical or political position regarding -\" them. -\" .PP -\" The "Invariant Sections" are certain Secondary Sections whose titles -\" are designated, as being those of Invariant Sections, in the notice -\" that says that the Document is released under this License. -\" .PP -\" The "Cover Texts" are certain short passages of text that are listed, -\" as Front-Cover Texts or Back-Cover Texts, in the notice that says that -\" the Document is released under this License. -\" .PP -\" A "Transparent" copy of the Document means a machine-readable copy, -\" represented in a format whose specification is available to the -\" general public, whose contents can be viewed and edited directly and -\" straightforwardly with generic text editors or (for images composed of -\" pixels) generic paint programs or (for drawings) some widely available -\" drawing editor, and that is suitable for input to text formatters or -\" for automatic translation to a variety of formats suitable for input -\" to text formatters. A copy made in an otherwise Transparent file -\" format whose markup has been designed to thwart or discourage -\" subsequent modification by readers is not Transparent. A copy that is -\" not "Transparent" is called "Opaque". -\" .PP -\" Examples of suitable formats for Transparent copies include plain -\" ASCII without markup, Texinfo input format, LaTeX input format, SGML -\" or XML using a publicly available DTD, and standard-conforming simple -\" HTML designed for human modification. Opaque formats include -\" PostScript, PDF, proprietary formats that can be read and edited only -\" by proprietary word processors, SGML or XML for which the DTD and/or -\" processing tools are not generally available, and the -\" machine-generated HTML produced by some word processors for output -\" purposes only. -\" .PP -\" The "Title Page" means, for a printed book, the title page itself, -\" plus such following pages as are needed to hold, legibly, the material -\" this License requires to appear in the title page. For works in -\" formats which do not have any title page as such, "Title Page" means -\" the text near the most prominent appearance of the work's title, -\" preceding the beginning of the body of the text. -\" .PP -\" 2. VERBATIM COPYING -\" .PP -\" You may copy and distribute the Document in any medium, either -\" commercially or noncommercially, provided that this License, the -\" copyright notices, and the license notice saying this License applies -\" to the Document are reproduced in all copies, and that you add no other -\" conditions whatsoever to those of this License. You may not use -\" technical measures to obstruct or control the reading or further -\" copying of the copies you make or distribute. However, you may accept -\" compensation in exchange for copies. If you distribute a large enough -\" number of copies you must also follow the conditions in section 3. -\" .PP -\" You may also lend copies, under the same conditions stated above, and -\" you may publicly display copies. -\" .PP -\" 3. COPYING IN QUANTITY -\" .PP -\" If you publish printed copies of the Document numbering more than 100, -\" and the Document's license notice requires Cover Texts, you must enclose -\" the copies in covers that carry, clearly and legibly, all these Cover -\" Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -\" the back cover. Both covers must also clearly and legibly identify -\" you as the publisher of these copies. The front cover must present -\" the full title with all words of the title equally prominent and -\" visible. You may add other material on the covers in addition. -\" Copying with changes limited to the covers, as long as they preserve -\" the title of the Document and satisfy these conditions, can be treated -\" as verbatim copying in other respects. -\" .PP -\" If the required texts for either cover are too voluminous to fit -\" legibly, you should put the first ones listed (as many as fit -\" reasonably) on the actual cover, and continue the rest onto adjacent -\" pages. -\" .PP -\" If you publish or distribute Opaque copies of the Document numbering -\" more than 100, you must either include a machine-readable Transparent -\" copy along with each Opaque copy, or state in or with each Opaque copy -\" a publicly-accessible computer-network location containing a complete -\" Transparent copy of the Document, free of added material, which the -\" general network-using public has access to download anonymously at no -\" charge using public-standard network protocols. If you use the latter -\" option, you must take reasonably prudent steps, when you begin -\" distribution of Opaque copies in quantity, to ensure that this -\" Transparent copy will remain thus accessible at the stated location -\" until at least one year after the last time you distribute an Opaque -\" copy (directly or through your agents or retailers) of that edition to -\" the public. -\" .PP -\" It is requested, but not required, that you contact the authors of the -\" Document well before redistributing any large number of copies, to give -\" them a chance to provide you with an updated version of the Document. -\" .PP -\" 4. MODIFICATIONS -\" .PP -\" You may copy and distribute a Modified Version of the Document under -\" the conditions of sections 2 and 3 above, provided that you release -\" the Modified Version under precisely this License, with the Modified -\" Version filling the role of the Document, thus licensing distribution -\" and modification of the Modified Version to whoever possesses a copy -\" of it. In addition, you must do these things in the Modified Version: -\" .PP -\" A. Use in the Title Page (and on the covers, if any) a title distinct -\" from that of the Document, and from those of previous versions -\" (which should, if there were any, be listed in the History section -\" of the Document). You may use the same title as a previous version -\" if the original publisher of that version gives permission. -\" .PP -\" B. List on the Title Page, as authors, one or more persons or entities -\" responsible for authorship of the modifications in the Modified -\" Version, together with at least five of the principal authors of the -\" Document (all of its principal authors, if it has less than five). -\" .PP -\" C. State on the Title page the name of the publisher of the -\" Modified Version, as the publisher. -\" .PP -\" D. Preserve all the copyright notices of the Document. -\" .PP -\" E. Add an appropriate copyright notice for your modifications -\" adjacent to the other copyright notices. -\" .PP -\" F. Include, immediately after the copyright notices, a license notice -\" giving the public permission to use the Modified Version under the -\" terms of this License, in the form shown in the Addendum below. -\" Preserve in that license notice the full lists of Invariant Sections -\" and required Cover Texts given in the Document's license notice. -\" .PP -\" H. Include an unaltered copy of this License. -\" .PP -\" I. Preserve the section entitled "History", and its title, and add to -\" it an item stating at least the title, year, new authors, and -\" publisher of the Modified Version as given on the Title Page. If -\" there is no section entitled "History" in the Document, create one -\" stating the title, year, authors, and publisher of the Document as -\" given on its Title Page, then add an item describing the Modified -\" Version as stated in the previous sentence. -\" .PP -\" J. Preserve the network location, if any, given in the Document for -\" public access to a Transparent copy of the Document, and likewise -\" the network locations given in the Document for previous versions -\" it was based on. These may be placed in the "History" section. -\" You may omit a network location for a work that was published at -\" least four years before the Document itself, or if the original -\" publisher of the version it refers to gives permission. -\" .PP -\" K. In any section entitled "Acknowledgements" or "Dedications", -\" preserve the section's title, and preserve in the section all the -\" substance and tone of each of the contributor acknowledgements -\" and/or dedications given therein. -\" .PP -\" L. Preserve all the Invariant Sections of the Document, -\" unaltered in their text and in their titles. Section numbers -\" or the equivalent are not considered part of the section titles. -\" .PP -\" M. Delete any section entitled "Endorsements". Such a section -\" may not be included in the Modified Version. -\" .PP -\" N. Do not retitle any existing section as "Endorsements" -\" or to conflict in title with any Invariant Section. -\" .PP -\" If the Modified Version includes new front-matter sections or -\" appendices that qualify as Secondary Sections and contain no material -\" copied from the Document, you may at your option designate some or all -\" of these sections as invariant. To do this, add their titles to the -\" list of Invariant Sections in the Modified Version's license notice. -\" These titles must be distinct from any other section titles. -\" .PP -\" You may add a section entitled "Endorsements", provided it contains -\" nothing but endorsements of your Modified Version by various -\" parties--for example, statements of peer review or that the text has -\" been approved by an organization as the authoritative definition of a -\" standard. -\" .PP -\" You may add a passage of up to five words as a Front-Cover Text, and a -\" passage of up to 25 words as a Back-Cover Text, to the end of the list -\" of Cover Texts in the Modified Version. Only one passage of -\" Front-Cover Text and one of Back-Cover Text may be added by (or -\" through arrangements made by) any one entity. If the Document already -\" includes a cover text for the same cover, previously added by you or -\" by arrangement made by the same entity you are acting on behalf of, -\" you may not add another; but you may replace the old one, on explicit -\" permission from the previous publisher that added the old one. -\" .PP -\" The author(s) and publisher(s) of the Document do not by this License -\" give permission to use their names for publicity for or to assert or -\" imply endorsement of any Modified Version. -\" .PP - -\" 5. COMBINING DOCUMENTS -\" .PP -\" You may combine the Document with other documents released under this -\" License, under the terms defined in section 4 above for modified -\" versions, provided that you include in the combination all of the -\" Invariant Sections of all of the original documents, unmodified, and -\" list them all as Invariant Sections of your combined work in its -\" license notice. -\" .PP -\" The combined work need only contain one copy of this License, and -\" multiple identical Invariant Sections may be replaced with a single -\" copy. If there are multiple Invariant Sections with the same name but -\" different contents, make the title of each such section unique by -\" adding at the end of it, in parentheses, the name of the original -\" author or publisher of that section if known, or else a unique number. -\" Make the same adjustment to the section titles in the list of -\" Invariant Sections in the license notice of the combined work. -\" .PP -\" In the combination, you must combine any sections entitled "History" -\" in the various original documents, forming one section entitled -\" "History"; likewise combine any sections entitled "Acknowledgements", -\" and any sections entitled "Dedications". You must delete all sections -\" entitled "Endorsements." -\" .PP - -\" 6. COLLECTIONS OF DOCUMENTS -\" .PP -\" You may make a collection consisting of the Document and other documents -\" released under this License, and replace the individual copies of this -\" License in the various documents with a single copy that is included in -\" the collection, provided that you follow the rules of this License for -\" verbatim copying of each of the documents in all other respects. -\" .PP -\" You may extract a single document from such a collection, and distribute -\" it individually under this License, provided you insert a copy of this -\" License into the extracted document, and follow this License in all -\" other respects regarding verbatim copying of that document. -\" .PP - -\" 7. AGGREGATION WITH INDEPENDENT WORKS -\" .PP -\" A compilation of the Document or its derivatives with other separate -\" and independent documents or works, in or on a volume of a storage or -\" distribution medium, does not as a whole count as a Modified Version -\" of the Document, provided no compilation copyright is claimed for the -\" compilation. Such a compilation is called an "aggregate", and this -\" License does not apply to the other self-contained works thus compiled -\" with the Document, on account of their being thus compiled, if they -\" are not themselves derivative works of the Document. -\" .PP -\" If the Cover Text requirement of section 3 is applicable to these -\" copies of the Document, then if the Document is less than one quarter -\" of the entire aggregate, the Document's Cover Texts may be placed on -\" covers that surround only the Document within the aggregate. -\" Otherwise they must appear on covers around the whole aggregate. -\" .PP - -\" 8. TRANSLATION -\" .PP -\" Translation is considered a kind of modification, so you may -\" distribute translations of the Document under the terms of section 4. -\" Replacing Invariant Sections with translations requires special -\" permission from their copyright holders, but you may include -\" translations of some or all Invariant Sections in addition to the -\" original versions of these Invariant Sections. You may include a -\" translation of this License provided that you also include the -\" original English version of this License. In case of a disagreement -\" between the translation and the original English version of this -\" License, the original English version will prevail. -\" .PP - -\" 9. TERMINATION -\" .PP -\" You may not copy, modify, sublicense, or distribute the Document except -\" as expressly provided for under this License. Any other attempt to -\" copy, modify, sublicense or distribute the Document 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. -\" .PP - -\" 10. FUTURE REVISIONS OF THIS LICENSE -\" .PP -\" The Free Software Foundation may publish new, revised versions -\" of the GNU Free Documentation 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. See -\" http://www.gnu.org/copyleft/. -\" .PP -\" Each version of the License is given a distinguishing version number. -\" If the Document specifies that a particular numbered version of this -\" License "or any later version" applies to it, you have the option of -\" following the terms and conditions either of that specified version or -\" of any later version that has been published (not as a draft) by the -\" Free Software Foundation. If the Document does not specify a version -\" number of this License, you may choose any version ever published (not -\" as a draft) by the Free Software Foundation. -\" .PP - -\" ADDENDUM: How to use this License for your documents -\" .PP -\" To use this License in a document you have written, include a copy of -\" the License in the document and put the following copyright and -\" license notices just after the title page: -\" .PP -\" Copyright (c) YEAR YOUR NAME. -\" Permission is granted to copy, distribute and/or -\" modify this document under the terms of the GNU -\" Free Documentation License, Version 1.1 or any later -\" version published by the Free Software Foundation; -\" with the Invariant Sections being LIST THEIR TITLES, -\" with the Front-Cover Texts being LIST, and with the -\" Back-Cover Texts being LIST. A copy of the license -\" is included in the section entitled "GNU Free -\" Documentation License". -\" .PP -\" If you have no Invariant Sections, write "with no Invariant Sections" -\" instead of saying which ones are invariant. If you have no -\" Front-Cover Texts, write "no Front-Cover Texts" instead of -\" "Front-Cover Texts being LIST"; likewise for Back-Cover Texts. -\" .PP -\" If your document contains nontrivial examples of program code, we -\" recommend releasing these examples in parallel under your choice of -\" free software license, such as the GNU General Public License, -\" to permit their use in free software. diff --git a/binutils/ar.1 b/binutils/ar.1 deleted file mode 100644 index d7b2caff8e64b..0000000000000 --- a/binutils/ar.1 +++ /dev/null @@ -1,891 +0,0 @@ -.\" Copyright (c) 1991, 1992, 1993, 1995, 1998, 1999, 2000 Free Software Foundation -.\" See section COPYING for conditions for redistribution -.TH ar 1 "1999" "Free Software Foundation" "GNU Development Tools" -.de BP -.sp -.ti \-.2i -\(** -.. - -.SH NAME -ar \- create, modify, and extract from archives. - -.SH SYNOPSIS -.hy 0 -.na -.BR ar " [\|" "-" "\|]"\c -.I {dmpqrtx}[abcfilNoPsSuvV] \c -[\|\c -.I membername\c -\&\|] \c -[\|\c -.I count\c -\&\|] \c -.I archive\c -\& \c -.I files\c -\&.\|.\|. - -.ad b -.hy 1 -.SH DESCRIPTION -The GNU \c -.B ar\c -\& program creates, modifies, and extracts from -archives. An \c -.I archive\c -\& is a single file holding a collection of -other files in a structure that makes it possible to retrieve -the original individual files (called \c -.I members\c -\& of the archive). - -The original files' contents, mode (permissions), timestamp, owner, and -group are preserved in the archive, and may be reconstituted on -extraction. - -GNU \c -.B ar\c -\& can maintain archives whose members have names of any -length; however, depending on how \c -.B ar\c -\& is configured on your -system, a limit on member-name length may be imposed (for compatibility -with archive formats maintained with other tools). If it exists, the -limit is often 15 characters (typical of formats related to a.out) or 16 -characters (typical of formats related to coff). - -\c -.B ar\c -\& is considered a binary utility because archives of this sort -are most often used as \c -.I libraries\c -\& holding commonly needed -subroutines. - -\c -.B ar\c -\& will create an index to the symbols defined in relocatable -object modules in the archive when you specify the modifier `\|\c -.B s\c -\|'. -Once created, this index is updated in the archive whenever \c -.B ar\c -\& -makes a change to its contents (save for the `\|\c -.B q\c -\|' update operation). -An archive with such an index speeds up linking to the library, and -allows routines in the library to call each other without regard to -their placement in the archive. - -You may use `\|\c -.B nm \-s\c -\|' or `\|\c -.B nm \-\-print\-armap\c -\|' to list this index -table. If an archive lacks the table, another form of \c -.B ar\c -\& called -\c -.B ranlib\c -\& can be used to add just the table. - -\c -.B ar\c -\& insists on at least two arguments to execute: one -keyletter specifying the \c -.I operation\c -\& (optionally accompanied by other -keyletters specifying \c -.I modifiers\c -\&), and the archive name to act on. - -Most operations can also accept further \c -.I files\c -\& arguments, -specifying particular files to operate on. - -.SH OPTIONS -GNU \c -.B ar\c -\& allows you to mix the operation code \c -.I p\c -\& and modifier -flags \c -.I mod\c -\& in any order, within the first command-line argument. - -If you wish, you may begin the first command-line argument with a -dash. - -The \c -.I p\c -\& keyletter specifies what operation to execute; it may be -any of the following, but you must specify only one of them: - -.TP -.B d -\c -.I Delete\c -\& modules from the archive. Specify the names of modules to -be deleted as \c -.I files\c -\&; the archive is untouched if you -specify no files to delete. - -If you specify the `\|\c -.B v\c -\|' modifier, \c -.B ar\c -\& will list each module -as it is deleted. - -.TP -.B m -Use this operation to \c -.I move\c -\& members in an archive. - -The ordering of members in an archive can make a difference in how -programs are linked using the library, if a symbol is defined in more -than one member. - -If no modifiers are used with \c -.B m\c -\&, any members you name in the -\c -.I files\c -\& arguments are moved to the \c -.I end\c -\& of the archive; -you can use the `\|\c -.B a\c -\|', `\|\c -.B b\c -\|', or `\|\c -.B i\c -\|' modifiers to move them to a -specified place instead. - -.TP -.B p -\c -.I Print\c -\& the specified members of the archive, to the standard -output file. If the `\|\c -.B v\c -\|' modifier is specified, show the member -name before copying its contents to standard output. - -If you specify no \c -.I files\c -\&, all the files in the archive are printed. - -.TP -.B q -\c -.I Quick append\c -\&; add \c -.I files\c -\& to the end of \c -.I archive\c -\&, -without checking for replacement. - -The modifiers `\|\c -.B a\c -\|', `\|\c -.B b\c -\|', and `\|\c -.B i\c -\|' do \c -.I not\c -\& affect this -operation; new members are always placed at the end of the archive. - -The modifier `\|\c -.B v\c -\|' makes \c -.B ar\c -\& list each file as it is appended. - -Since the point of this operation is speed, the archive's symbol table -index is not updated, even if it already existed; you can use `\|\c -.B ar s\c -\|' or -\c -.B ranlib\c -\& explicitly to update the symbol table index. - -However, too many different systems assume quick append rebuilds the -index, so GNU -.B ar -implements `\|\c -.B q\c -\|' as a synonym for `\|\c -.B r\c -\|'. - -.TP -.B r -Insert \c -.I files\c -\& into \c -.I archive\c -\& (with \c -.I replacement\c -\&). This -operation differs from `\|\c -.B q\c -\|' in that any previously existing members -are deleted if their names match those being added. - -If one of the files named in \c -.I files\c -\& doesn't exist, \c -.B ar\c -\& -displays an error message, and leaves undisturbed any existing members -of the archive matching that name. - -By default, new members are added at the end of the file; but you may -use one of the modifiers `\|\c -.B a\c -\|', `\|\c -.B b\c -\|', or `\|\c -.B i\c -\|' to request -placement relative to some existing member. - -The modifier `\|\c -.B v\c -\|' used with this operation elicits a line of -output for each file inserted, along with one of the letters `\|\c -.B a\c -\|' or -`\|\c -.B r\c -\|' to indicate whether the file was appended (no old member -deleted) or replaced. - -.TP -.B t -Display a \c -.I table\c -\& listing the contents of \c -.I archive\c -\&, or those -of the files listed in \c -.I files\c -\& that are present in the -archive. Normally only the member name is shown; if you also want to -see the modes (permissions), timestamp, owner, group, and size, you can -request that by also specifying the `\|\c -.B v\c -\|' modifier. - -If you do not specify any \c -.I files\c -\&, all files in the archive -are listed. - -If there is more than one file with the same name (say, `\|\c -.B fie\c -\|') in -an archive (say `\|\c -.B b.a\c -\|'), `\|\c -.B ar t b.a fie\c -\|' will list only the -first instance; to see them all, you must ask for a complete -listing\(em\&in our example, `\|\c -.B ar t b.a\c -\|'. - -.TP -.B x -\c -.I Extract\c -\& members (named \c -.I files\c -\&) from the archive. You can -use the `\|\c -.B v\c -\|' modifier with this operation, to request that -\c -.B ar\c -\& list each name as it extracts it. - -If you do not specify any \c -.I files\c -\&, all files in the archive -are extracted. - -.PP - -A number of modifiers (\c -.I mod\c -\&) may immediately follow the \c -.I p\c -\& -keyletter, to specify variations on an operation's behavior: - -.TP -.B a -Add new files \c -.I after\c -\& an existing member of the -archive. If you use the modifier \c -.B a\c -\&, the name of an existing archive -member must be present as the \c -.I membername\c -\& argument, before the -\c -.I archive\c -\& specification. - -.TP -.B b -Add new files \c -.I before\c -\& an existing member of the -archive. If you use the modifier \c -.B b\c -\&, the name of an existing archive -member must be present as the \c -.I membername\c -\& argument, before the -\c -.I archive\c -\& specification. (same as `\|\c -.B i\c -\|'). - -.TP -.B c -\c -.I Create\c -\& the archive. The specified \c -.I archive\c -\& is always -created if it didn't exist, when you request an update. But a warning is -issued unless you specify in advance that you expect to create it, by -using this modifier. - -.TP -.B f -Truncate names in the archive. -.B ar -will normally permit file names of any length. This will cause it to -create archives which are not compatible with the native -.B ar -program on some systems. If this is a concern, the -.B f -modifier may be used to truncate file names when putting them in the -archive. - -.TP -.B i -Insert new files \c -.I before\c -\& an existing member of the -archive. If you use the modifier \c -.B i\c -\&, the name of an existing archive -member must be present as the \c -.I membername\c -\& argument, before the -\c -.I archive\c -\& specification. (same as `\|\c -.B b\c -\|'). - -.TP -.B l -This modifier is accepted but not used. - -.TP -.B N -Uses the -.I count -parameter. This is used if there are multiple entries in the archive -with the same name. Extract or delete instance -.I count -of the given name from the archive. - -.TP -.B o -Preserve the \c -.I original\c -\& dates of members when extracting them. If -you do not specify this modifier, files extracted from the archive -will be stamped with the time of extraction. - -.TP -.B P -Use the full path name when matching names in the archive. -.B ar -can not create an archive with a full path name (such archives are not -POSIX complaint), but other archive creators can. This option will -cause -.B ar -to match file names using a complete path name, which can be -convenient when extracting a single file from an archive created by -another tool. - -.TP -.B s -Write an object-file index into the archive, or update an existing one, -even if no other change is made to the archive. You may use this modifier -flag either with any operation, or alone. Running `\|\c -.B ar s\c -\|' on an -archive is equivalent to running `\|\c -.B ranlib\c -\|' on it. - -.TP -.B S -Do not generate an archive symbol table. This can speed up building a -large library in several steps. The resulting archive can not be used -with the linker. In order to build a symbol table, you must omit the -`\|\c -.B S\c -\|' modifier on the last execution of `\|\c -.B ar\c -\|', or you must run `\|\c -.B ranlib\c -\|' on the archive. - -.TP -.B u -Normally, \c -.B ar r\c -\&.\|.\|. inserts all files -listed into the archive. If you would like to insert \c -.I only\c -\& those -of the files you list that are newer than existing members of the same -names, use this modifier. The `\|\c -.B u\c -\|' modifier is allowed only for the -operation `\|\c -.B r\c -\|' (replace). In particular, the combination `\|\c -.B qu\c -\|' is -not allowed, since checking the timestamps would lose any speed -advantage from the operation `\|\c -.B q\c -\|'. - -.TP -.B v -This modifier requests the \c -.I verbose\c -\& version of an operation. Many -operations display additional information, such as filenames processed, -when the modifier `\|\c -.B v\c -\|' is appended. - -.TP -.B V -This modifier shows the version number of -.BR ar . - -.PP - -.SH "SEE ALSO" -.RB "`\|" binutils "\|'" -entry in -.B -info\c -\&; -.I -The GNU Binary Utilities\c -, Roland H. Pesch (October 1991). -.BR nm ( 1 )\c -\&, -.BR ranlib ( 1 )\c -\&. - -.SH COPYING -Copyright (c) 1991, 1992, 1993, 1995, 1998, 1999, 2000 Free Software Foundation, Inc. -.PP -This document is distributed under the terms of the GNU Free -Documentation License, version 1.1. That license is described in the -sources for this manual page, but it is not displayed here in order to -make this manual more consise. Copies of this license can also be -obtained from: http://www.gnu.org/copyleft/. - -\" .SH GNU Free Documentation License -\" Version 1.1, March 2000 - -\" Copyright (C) 2000 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. -\" .PP -\" 0. PREAMBLE -\" .PP -\" The purpose of this License is to make a manual, textbook, or other -\" written document "free" in the sense of freedom: to assure everyone -\" the effective freedom to copy and redistribute it, with or without -\" modifying it, either commercially or noncommercially. Secondarily, -\" this License preserves for the author and publisher a way to get -\" credit for their work, while not being considered responsible for -\" modifications made by others. -\" .PP -\" This License is a kind of "copyleft", which means that derivative -\" works of the document must themselves be free in the same sense. It -\" complements the GNU General Public License, which is a copyleft -\" license designed for free software. -\" .PP -\" We have designed this License in order to use it for manuals for free -\" software, because free software needs free documentation: a free -\" program should come with manuals providing the same freedoms that the -\" software does. But this License is not limited to software manuals; -\" it can be used for any textual work, regardless of subject matter or -\" whether it is published as a printed book. We recommend this License -\" principally for works whose purpose is instruction or reference. -\" .PP -\" 1. APPLICABILITY AND DEFINITIONS -\" .PP -\" This License applies to any manual or other work that contains a -\" notice placed by the copyright holder saying it can be distributed -\" under the terms of this License. The "Document", below, refers to any -\" such manual or work. Any member of the public is a licensee, and is -\" addressed as "you". -\" .PP -\" A "Modified Version" of the Document means any work containing the -\" Document or a portion of it, either copied verbatim, or with -\" modifications and/or translated into another language. -\" .PP -\" A "Secondary Section" is a named appendix or a front-matter section of -\" the Document that deals exclusively with the relationship of the -\" publishers or authors of the Document to the Document's overall subject -\" (or to related matters) and contains nothing that could fall directly -\" within that overall subject. (For example, if the Document is in part a -\" textbook of mathematics, a Secondary Section may not explain any -\" mathematics.) The relationship could be a matter of historical -\" connection with the subject or with related matters, or of legal, -\" commercial, philosophical, ethical or political position regarding -\" them. -\" .PP -\" The "Invariant Sections" are certain Secondary Sections whose titles -\" are designated, as being those of Invariant Sections, in the notice -\" that says that the Document is released under this License. -\" .PP -\" The "Cover Texts" are certain short passages of text that are listed, -\" as Front-Cover Texts or Back-Cover Texts, in the notice that says that -\" the Document is released under this License. -\" .PP -\" A "Transparent" copy of the Document means a machine-readable copy, -\" represented in a format whose specification is available to the -\" general public, whose contents can be viewed and edited directly and -\" straightforwardly with generic text editors or (for images composed of -\" pixels) generic paint programs or (for drawings) some widely available -\" drawing editor, and that is suitable for input to text formatters or -\" for automatic translation to a variety of formats suitable for input -\" to text formatters. A copy made in an otherwise Transparent file -\" format whose markup has been designed to thwart or discourage -\" subsequent modification by readers is not Transparent. A copy that is -\" not "Transparent" is called "Opaque". -\" .PP -\" Examples of suitable formats for Transparent copies include plain -\" ASCII without markup, Texinfo input format, LaTeX input format, SGML -\" or XML using a publicly available DTD, and standard-conforming simple -\" HTML designed for human modification. Opaque formats include -\" PostScript, PDF, proprietary formats that can be read and edited only -\" by proprietary word processors, SGML or XML for which the DTD and/or -\" processing tools are not generally available, and the -\" machine-generated HTML produced by some word processors for output -\" purposes only. -\" .PP -\" The "Title Page" means, for a printed book, the title page itself, -\" plus such following pages as are needed to hold, legibly, the material -\" this License requires to appear in the title page. For works in -\" formats which do not have any title page as such, "Title Page" means -\" the text near the most prominent appearance of the work's title, -\" preceding the beginning of the body of the text. -\" .PP -\" 2. VERBATIM COPYING -\" .PP -\" You may copy and distribute the Document in any medium, either -\" commercially or noncommercially, provided that this License, the -\" copyright notices, and the license notice saying this License applies -\" to the Document are reproduced in all copies, and that you add no other -\" conditions whatsoever to those of this License. You may not use -\" technical measures to obstruct or control the reading or further -\" copying of the copies you make or distribute. However, you may accept -\" compensation in exchange for copies. If you distribute a large enough -\" number of copies you must also follow the conditions in section 3. -\" .PP -\" You may also lend copies, under the same conditions stated above, and -\" you may publicly display copies. -\" .PP -\" 3. COPYING IN QUANTITY -\" .PP -\" If you publish printed copies of the Document numbering more than 100, -\" and the Document's license notice requires Cover Texts, you must enclose -\" the copies in covers that carry, clearly and legibly, all these Cover -\" Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -\" the back cover. Both covers must also clearly and legibly identify -\" you as the publisher of these copies. The front cover must present -\" the full title with all words of the title equally prominent and -\" visible. You may add other material on the covers in addition. -\" Copying with changes limited to the covers, as long as they preserve -\" the title of the Document and satisfy these conditions, can be treated -\" as verbatim copying in other respects. -\" .PP -\" If the required texts for either cover are too voluminous to fit -\" legibly, you should put the first ones listed (as many as fit -\" reasonably) on the actual cover, and continue the rest onto adjacent -\" pages. -\" .PP -\" If you publish or distribute Opaque copies of the Document numbering -\" more than 100, you must either include a machine-readable Transparent -\" copy along with each Opaque copy, or state in or with each Opaque copy -\" a publicly-accessible computer-network location containing a complete -\" Transparent copy of the Document, free of added material, which the -\" general network-using public has access to download anonymously at no -\" charge using public-standard network protocols. If you use the latter -\" option, you must take reasonably prudent steps, when you begin -\" distribution of Opaque copies in quantity, to ensure that this -\" Transparent copy will remain thus accessible at the stated location -\" until at least one year after the last time you distribute an Opaque -\" copy (directly or through your agents or retailers) of that edition to -\" the public. -\" .PP -\" It is requested, but not required, that you contact the authors of the -\" Document well before redistributing any large number of copies, to give -\" them a chance to provide you with an updated version of the Document. -\" .PP -\" 4. MODIFICATIONS -\" .PP -\" You may copy and distribute a Modified Version of the Document under -\" the conditions of sections 2 and 3 above, provided that you release -\" the Modified Version under precisely this License, with the Modified -\" Version filling the role of the Document, thus licensing distribution -\" and modification of the Modified Version to whoever possesses a copy -\" of it. In addition, you must do these things in the Modified Version: -\" .PP -\" A. Use in the Title Page (and on the covers, if any) a title distinct -\" from that of the Document, and from those of previous versions -\" (which should, if there were any, be listed in the History section -\" of the Document). You may use the same title as a previous version -\" if the original publisher of that version gives permission. -\" .PP -\" B. List on the Title Page, as authors, one or more persons or entities -\" responsible for authorship of the modifications in the Modified -\" Version, together with at least five of the principal authors of the -\" Document (all of its principal authors, if it has less than five). -\" .PP -\" C. State on the Title page the name of the publisher of the -\" Modified Version, as the publisher. -\" .PP -\" D. Preserve all the copyright notices of the Document. -\" .PP -\" E. Add an appropriate copyright notice for your modifications -\" adjacent to the other copyright notices. -\" .PP -\" F. Include, immediately after the copyright notices, a license notice -\" giving the public permission to use the Modified Version under the -\" terms of this License, in the form shown in the Addendum below. -\" Preserve in that license notice the full lists of Invariant Sections -\" and required Cover Texts given in the Document's license notice. -\" .PP -\" H. Include an unaltered copy of this License. -\" .PP -\" I. Preserve the section entitled "History", and its title, and add to -\" it an item stating at least the title, year, new authors, and -\" publisher of the Modified Version as given on the Title Page. If -\" there is no section entitled "History" in the Document, create one -\" stating the title, year, authors, and publisher of the Document as -\" given on its Title Page, then add an item describing the Modified -\" Version as stated in the previous sentence. -\" .PP -\" J. Preserve the network location, if any, given in the Document for -\" public access to a Transparent copy of the Document, and likewise -\" the network locations given in the Document for previous versions -\" it was based on. These may be placed in the "History" section. -\" You may omit a network location for a work that was published at -\" least four years before the Document itself, or if the original -\" publisher of the version it refers to gives permission. -\" .PP -\" K. In any section entitled "Acknowledgements" or "Dedications", -\" preserve the section's title, and preserve in the section all the -\" substance and tone of each of the contributor acknowledgements -\" and/or dedications given therein. -\" .PP -\" L. Preserve all the Invariant Sections of the Document, -\" unaltered in their text and in their titles. Section numbers -\" or the equivalent are not considered part of the section titles. -\" .PP -\" M. Delete any section entitled "Endorsements". Such a section -\" may not be included in the Modified Version. -\" .PP -\" N. Do not retitle any existing section as "Endorsements" -\" or to conflict in title with any Invariant Section. -\" .PP -\" If the Modified Version includes new front-matter sections or -\" appendices that qualify as Secondary Sections and contain no material -\" copied from the Document, you may at your option designate some or all -\" of these sections as invariant. To do this, add their titles to the -\" list of Invariant Sections in the Modified Version's license notice. -\" These titles must be distinct from any other section titles. -\" .PP -\" You may add a section entitled "Endorsements", provided it contains -\" nothing but endorsements of your Modified Version by various -\" parties--for example, statements of peer review or that the text has -\" been approved by an organization as the authoritative definition of a -\" standard. -\" .PP -\" You may add a passage of up to five words as a Front-Cover Text, and a -\" passage of up to 25 words as a Back-Cover Text, to the end of the list -\" of Cover Texts in the Modified Version. Only one passage of -\" Front-Cover Text and one of Back-Cover Text may be added by (or -\" through arrangements made by) any one entity. If the Document already -\" includes a cover text for the same cover, previously added by you or -\" by arrangement made by the same entity you are acting on behalf of, -\" you may not add another; but you may replace the old one, on explicit -\" permission from the previous publisher that added the old one. -\" .PP -\" The author(s) and publisher(s) of the Document do not by this License -\" give permission to use their names for publicity for or to assert or -\" imply endorsement of any Modified Version. -\" .PP - -\" 5. COMBINING DOCUMENTS -\" .PP -\" You may combine the Document with other documents released under this -\" License, under the terms defined in section 4 above for modified -\" versions, provided that you include in the combination all of the -\" Invariant Sections of all of the original documents, unmodified, and -\" list them all as Invariant Sections of your combined work in its -\" license notice. -\" .PP -\" The combined work need only contain one copy of this License, and -\" multiple identical Invariant Sections may be replaced with a single -\" copy. If there are multiple Invariant Sections with the same name but -\" different contents, make the title of each such section unique by -\" adding at the end of it, in parentheses, the name of the original -\" author or publisher of that section if known, or else a unique number. -\" Make the same adjustment to the section titles in the list of -\" Invariant Sections in the license notice of the combined work. -\" .PP -\" In the combination, you must combine any sections entitled "History" -\" in the various original documents, forming one section entitled -\" "History"; likewise combine any sections entitled "Acknowledgements", -\" and any sections entitled "Dedications". You must delete all sections -\" entitled "Endorsements." -\" .PP - -\" 6. COLLECTIONS OF DOCUMENTS -\" .PP -\" You may make a collection consisting of the Document and other documents -\" released under this License, and replace the individual copies of this -\" License in the various documents with a single copy that is included in -\" the collection, provided that you follow the rules of this License for -\" verbatim copying of each of the documents in all other respects. -\" .PP -\" You may extract a single document from such a collection, and distribute -\" it individually under this License, provided you insert a copy of this -\" License into the extracted document, and follow this License in all -\" other respects regarding verbatim copying of that document. -\" .PP - -\" 7. AGGREGATION WITH INDEPENDENT WORKS -\" .PP -\" A compilation of the Document or its derivatives with other separate -\" and independent documents or works, in or on a volume of a storage or -\" distribution medium, does not as a whole count as a Modified Version -\" of the Document, provided no compilation copyright is claimed for the -\" compilation. Such a compilation is called an "aggregate", and this -\" License does not apply to the other self-contained works thus compiled -\" with the Document, on account of their being thus compiled, if they -\" are not themselves derivative works of the Document. -\" .PP -\" If the Cover Text requirement of section 3 is applicable to these -\" copies of the Document, then if the Document is less than one quarter -\" of the entire aggregate, the Document's Cover Texts may be placed on -\" covers that surround only the Document within the aggregate. -\" Otherwise they must appear on covers around the whole aggregate. -\" .PP - -\" 8. TRANSLATION -\" .PP -\" Translation is considered a kind of modification, so you may -\" distribute translations of the Document under the terms of section 4. -\" Replacing Invariant Sections with translations requires special -\" permission from their copyright holders, but you may include -\" translations of some or all Invariant Sections in addition to the -\" original versions of these Invariant Sections. You may include a -\" translation of this License provided that you also include the -\" original English version of this License. In case of a disagreement -\" between the translation and the original English version of this -\" License, the original English version will prevail. -\" .PP - -\" 9. TERMINATION -\" .PP -\" You may not copy, modify, sublicense, or distribute the Document except -\" as expressly provided for under this License. Any other attempt to -\" copy, modify, sublicense or distribute the Document 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. -\" .PP - -\" 10. FUTURE REVISIONS OF THIS LICENSE -\" .PP -\" The Free Software Foundation may publish new, revised versions -\" of the GNU Free Documentation 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. See -\" http://www.gnu.org/copyleft/. -\" .PP -\" Each version of the License is given a distinguishing version number. -\" If the Document specifies that a particular numbered version of this -\" License "or any later version" applies to it, you have the option of -\" following the terms and conditions either of that specified version or -\" of any later version that has been published (not as a draft) by the -\" Free Software Foundation. If the Document does not specify a version -\" number of this License, you may choose any version ever published (not -\" as a draft) by the Free Software Foundation. -\" .PP - -\" ADDENDUM: How to use this License for your documents -\" .PP -\" To use this License in a document you have written, include a copy of -\" the License in the document and put the following copyright and -\" license notices just after the title page: -\" .PP -\" Copyright (c) YEAR YOUR NAME. -\" Permission is granted to copy, distribute and/or -\" modify this document under the terms of the GNU -\" Free Documentation License, Version 1.1 or any later -\" version published by the Free Software Foundation; -\" with the Invariant Sections being LIST THEIR TITLES, -\" with the Front-Cover Texts being LIST, and with the -\" Back-Cover Texts being LIST. A copy of the license -\" is included in the section entitled "GNU Free -\" Documentation License". -\" .PP -\" If you have no Invariant Sections, write "with no Invariant Sections" -\" instead of saying which ones are invariant. If you have no -\" Front-Cover Texts, write "no Front-Cover Texts" instead of -\" "Front-Cover Texts being LIST"; likewise for Back-Cover Texts. -\" .PP -\" If your document contains nontrivial examples of program code, we -\" recommend releasing these examples in parallel under your choice of -\" free software license, such as the GNU General Public License, -\" to permit their use in free software. diff --git a/binutils/arlex.c b/binutils/arlex.c new file mode 100644 index 0000000000000..9710e6ea7410a --- /dev/null +++ b/binutils/arlex.c @@ -0,0 +1,1857 @@ +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /cvs/src/src/binutils/Attic/arlex.c,v 1.1.12.1 2004/04/09 19:32:15 drow Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include +#include + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include +#ifndef _WIN32 +#include +#endif + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#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 + +/* 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 yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#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. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *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 */ \ + } \ + 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; + + +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; + + /* 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 yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* 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". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* 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_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 ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_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 ) + +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 )); + +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 * )); + +#define yy_new_buffer yy_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; \ + } + +#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; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +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[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 40 +#define YY_END_OF_BUFFER 41 +static yyconst short int yy_accept[177] = + { 0, + 0, 0, 41, 40, 39, 38, 35, 32, 33, 36, + 40, 34, 37, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 36, 31, 37, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 7, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 22, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, + + 35, 35, 35, 10, 11, 12, 35, 15, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 25, 26, 27, + 35, 30, 35, 35, 35, 3, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 18, 35, 35, 35, 35, + 35, 35, 35, 1, 2, 4, 5, 35, 35, 35, + 35, 35, 16, 17, 19, 20, 35, 35, 35, 35, + 35, 35, 8, 9, 13, 14, 35, 23, 24, 28, + 29, 35, 35, 6, 21, 0 + } ; + +static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 1, 1, 1, 4, 1, 1, 1, 5, + 6, 7, 8, 9, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 10, 1, + 1, 1, 1, 1, 11, 12, 13, 14, 15, 16, + 4, 17, 18, 4, 4, 19, 20, 21, 22, 23, + 4, 24, 25, 26, 27, 28, 4, 29, 30, 4, + 1, 4, 1, 1, 4, 1, 31, 32, 33, 34, + + 35, 36, 4, 37, 38, 4, 4, 39, 40, 41, + 42, 43, 4, 44, 45, 46, 47, 48, 4, 49, + 50, 4, 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, 1, 1, 1 + } ; + +static yyconst int yy_meta[51] = + { 0, + 1, 2, 1, 3, 1, 1, 1, 1, 1, 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, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 + } ; + +static yyconst short int yy_base[180] = + { 0, + 0, 0, 193, 194, 194, 194, 0, 194, 194, 0, + 190, 194, 0, 177, 32, 37, 32, 163, 174, 170, + 164, 171, 174, 169, 149, 15, 22, 17, 135, 146, + 142, 136, 143, 146, 141, 0, 0, 194, 0, 161, + 159, 158, 153, 147, 156, 143, 149, 148, 141, 150, + 141, 135, 138, 127, 125, 124, 119, 113, 122, 109, + 115, 114, 107, 116, 107, 101, 104, 43, 136, 135, + 130, 129, 0, 119, 123, 118, 114, 118, 119, 122, + 124, 25, 104, 103, 98, 97, 0, 87, 91, 86, + 82, 86, 87, 90, 92, 105, 100, 97, 94, 93, + + 105, 106, 102, 0, 0, 0, 104, 0, 92, 75, + 70, 67, 64, 63, 75, 76, 72, 0, 0, 0, + 74, 0, 62, 91, 88, 0, 86, 85, 73, 85, + 79, 83, 70, 62, 59, 0, 57, 56, 44, 56, + 50, 54, 41, 0, 0, 0, 0, 63, 58, 59, + 67, 66, 0, 0, 0, 0, 38, 33, 34, 42, + 41, 51, 0, 0, 0, 0, 30, 0, 0, 0, + 0, 43, 21, 0, 0, 194, 65, 66, 69 + } ; + +static yyconst short int yy_def[180] = + { 0, + 176, 1, 176, 176, 176, 176, 177, 176, 176, 178, + 176, 176, 179, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 178, 176, 179, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 177, 0, 176, 176, 176 + } ; + +static yyconst short int yy_nxt[245] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 7, 15, 16, 17, 18, 19, 7, 20, 7, + 7, 21, 7, 22, 23, 7, 7, 24, 7, 7, + 25, 7, 26, 27, 28, 29, 30, 7, 31, 7, + 7, 32, 7, 33, 34, 7, 7, 35, 7, 7, + 41, 43, 45, 55, 44, 42, 57, 59, 56, 58, + 46, 96, 97, 110, 111, 60, 37, 36, 37, 39, + 175, 39, 174, 173, 172, 171, 170, 169, 168, 167, + 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, + 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, + + 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, + 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, + 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, + 116, 115, 114, 113, 112, 109, 108, 107, 106, 105, + 104, 103, 102, 101, 100, 99, 98, 95, 94, 93, + 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, + 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, + 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, + 62, 61, 54, 53, 52, 51, 50, 49, 48, 47, + 40, 38, 176, 3, 176, 176, 176, 176, 176, 176, + + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176 + } ; + +static yyconst short int yy_chk[245] = + { 0, + 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, + 15, 16, 17, 26, 16, 15, 27, 28, 26, 27, + 17, 68, 68, 82, 82, 28, 178, 177, 178, 179, + 173, 179, 172, 167, 162, 161, 160, 159, 158, 157, + 152, 151, 150, 149, 148, 143, 142, 141, 140, 139, + 138, 137, 135, 134, 133, 132, 131, 130, 129, 128, + + 127, 125, 124, 123, 121, 117, 116, 115, 114, 113, + 112, 111, 110, 109, 107, 103, 102, 101, 100, 99, + 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, + 88, 86, 85, 84, 83, 81, 80, 79, 78, 77, + 76, 75, 74, 72, 71, 70, 69, 67, 66, 65, + 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, + 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, + 44, 43, 42, 41, 40, 35, 34, 33, 32, 31, + 30, 29, 25, 24, 23, 22, 21, 20, 19, 18, + 14, 11, 3, 176, 176, 176, 176, 176, 176, 176, + + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 176, 176, 176, 176 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* 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 "arlex.l" +#define INITIAL 0 +#line 2 "arlex.l" +/* arlex.l - Strange script language lexer */ + +/* Copyright 1992, 1997, 2000, 2002, 2003 Free Software Foundation, Inc. + +This file is part of GNU Binutils. + +This program is free software; 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. */ + + +/* Contributed by Steve Chamberlain + sac@cygnus.com + +*/ +#define DONTDECLARE_MALLOC +#include "ansidecl.h" +#include "libiberty.h" +#include "arparse.h" + +#define YY_NO_UNPUT + +extern int yylex (void); + +int linenumber; +#line 512 "lex.yy.c" + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( 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 + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#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. */ +#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 (void) fwrite( yytext, yyleng, 1, yyout ) +#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->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + } +#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 + +/* 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 + +/* Code executed at the beginning of each rule, after yytext and yyleng + * 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 \ + YY_USER_ACTION + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 42 "arlex.l" + + +#line 677 "lex.yy.c" + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *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_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 >= 177 ) + 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_base[yy_current_state] != 194 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + +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 44 "arlex.l" +{ return ADDLIB; } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 45 "arlex.l" +{ return ADDMOD; } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 46 "arlex.l" +{ return CLEAR; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 47 "arlex.l" +{ return CREATE; } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 48 "arlex.l" +{ return DELETE; } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 49 "arlex.l" +{ return DIRECTORY; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 50 "arlex.l" +{ return END; } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 51 "arlex.l" +{ return EXTRACT; } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 52 "arlex.l" +{ return FULLDIR; } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 53 "arlex.l" +{ return HELP; } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 54 "arlex.l" +{ return LIST; } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 55 "arlex.l" +{ return OPEN; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 56 "arlex.l" +{ return REPLACE; } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 57 "arlex.l" +{ return VERBOSE; } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 58 "arlex.l" +{ return SAVE; } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 59 "arlex.l" +{ return ADDLIB; } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 60 "arlex.l" +{ return ADDMOD; } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 61 "arlex.l" +{ return CLEAR; } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 62 "arlex.l" +{ return CREATE; } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 63 "arlex.l" +{ return DELETE; } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 64 "arlex.l" +{ return DIRECTORY; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 65 "arlex.l" +{ return END; } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 66 "arlex.l" +{ return EXTRACT; } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 67 "arlex.l" +{ return FULLDIR; } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 68 "arlex.l" +{ return HELP; } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 69 "arlex.l" +{ return LIST; } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 70 "arlex.l" +{ return OPEN; } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 71 "arlex.l" +{ return REPLACE; } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 72 "arlex.l" +{ return VERBOSE; } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 73 "arlex.l" +{ return SAVE; } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 74 "arlex.l" +{ linenumber ++; } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 75 "arlex.l" +{ return '('; } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 76 "arlex.l" +{ return ')'; } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 77 "arlex.l" +{ return ','; } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 78 "arlex.l" +{ + yylval.name = xstrdup (yytext); + return FILENAME; + } + YY_BREAK +case 36: +YY_RULE_SETUP +#line 82 "arlex.l" +{ } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 83 "arlex.l" +{ } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 84 "arlex.l" +{ } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 85 "arlex.l" +{ linenumber ++; return NEWLINE; } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 87 "arlex.l" +ECHO; + YY_BREAK +#line 963 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + 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->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 + * 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; + } + + /* 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->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_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, 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->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 yylex */ + + +/* 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() + { + register char *dest = yy_current_buffer->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] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->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->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; + + else + { + int num_to_read = + yy_current_buffer->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; + + 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. */ + yy_flex_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->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_current_buffer->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; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + 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; + + yytext_ptr = &yy_current_buffer->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() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + + 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 >= 177 ) + 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 ); + */ + +#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 + { + 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 >= 177 ) + 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 == 176); + + 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; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->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 char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->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; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#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->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. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + 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 yytext */ + yy_hold_char = *++yy_c_buf_p; + + + return c; + } + + +#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 ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_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 ) + return; + + 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_current_buffer = new_buffer; + yy_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 + * 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; + } + + +#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 + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_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 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_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 + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +#ifndef _WIN32 +#include +#else +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif +#endif + +#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 + + + { + yy_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 + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + 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 ) + yy_load_buffer_state(); + } + + +#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; + + 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 ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_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; + + yy_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 + + +#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 + { + 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 ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_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; + } +#endif + + +#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; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (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 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 ) + + +/* 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 + { + 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 + { + 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 + { + 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 + { + /* 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 ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 87 "arlex.l" + +#ifndef yywrap +/* Needed for lex, though not flex. */ +int yywrap(void) { return 1; } +#endif diff --git a/binutils/arparse.c b/binutils/arparse.c new file mode 100644 index 0000000000000..2b3282bb676d8 --- /dev/null +++ b/binutils/arparse.c @@ -0,0 +1,1290 @@ +/* A Bison parser, made from arparse.y + by GNU bison 1.35. */ + +#define YYBISON 1 /* Identify Bison output. */ + +# define NEWLINE 257 +# define VERBOSE 258 +# define FILENAME 259 +# define ADDLIB 260 +# define LIST 261 +# define ADDMOD 262 +# define CLEAR 263 +# define CREATE 264 +# define DELETE 265 +# define DIRECTORY 266 +# define END 267 +# define EXTRACT 268 +# define FULLDIR 269 +# define HELP 270 +# define QUIT 271 +# define REPLACE 272 +# define SAVE 273 +# define OPEN 274 + +#line 1 "arparse.y" + +/* arparse.y - Stange script language parser */ + +/* Copyright 1992, 1993, 1995, 1997, 1999, 2003 + Free Software Foundation, Inc. + +This file is part of GNU Binutils. + +This program is free software; 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. */ + + +/* Contributed by Steve Chamberlain + sac@cygnus.com + +*/ +#define DONTDECLARE_MALLOC +#include "bfd.h" +#include "bucomm.h" +#include "arsup.h" +extern int verbose; +extern int yylex (void); +static int yyerror (const char *); + +#line 37 "arparse.y" +#ifndef YYSTYPE +typedef union { + char *name; +struct list *list ; + +} yystype; +# define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 +#endif +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + + + +#define YYFINAL 53 +#define YYFLAG -32768 +#define YYNTBASE 24 + +/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ +#define YYTRANSLATE(x) ((unsigned)(x) <= 274 ? yytranslate[x] : 45) + +/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ +static const char 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, 2, 2, + 21, 22, 2, 2, 23, 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, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20 +}; + +#if YYDEBUG +static const short yyprhs[] = +{ + 0, 0, 1, 4, 7, 8, 11, 13, 15, 17, + 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, + 39, 41, 42, 45, 48, 50, 53, 56, 58, 60, + 63, 66, 70, 75, 77, 78, 82, 83, 87, 88, + 90, 91 +}; +static const short yyrhs[] = +{ + -1, 25, 26, 0, 26, 27, 0, 0, 28, 3, + 0, 36, 0, 37, 0, 44, 0, 39, 0, 38, + 0, 31, 0, 33, 0, 35, 0, 29, 0, 30, + 0, 32, 0, 34, 0, 13, 0, 1, 0, 5, + 0, 0, 14, 42, 0, 18, 42, 0, 9, 0, + 11, 42, 0, 8, 42, 0, 7, 0, 19, 0, + 20, 5, 0, 10, 5, 0, 6, 5, 41, 0, + 12, 5, 41, 40, 0, 5, 0, 0, 21, 42, + 22, 0, 0, 42, 43, 5, 0, 0, 23, 0, + 0, 4, 0 +}; + +#endif + +#if YYDEBUG +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const short yyrline[] = +{ + 0, 67, 67, 71, 73, 76, 80, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 100, 105, 110, 115, 119, 124, 129, 136, + 141, 147, 151, 158, 161, 164, 167, 171, 178, 182, + 184, 188 +}; +#endif + + +#if (YYDEBUG) || defined YYERROR_VERBOSE + +/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ +static const char *const yytname[] = +{ + "$", "error", "$undefined.", "NEWLINE", "VERBOSE", "FILENAME", "ADDLIB", + "LIST", "ADDMOD", "CLEAR", "CREATE", "DELETE", "DIRECTORY", "END", + "EXTRACT", "FULLDIR", "HELP", "QUIT", "REPLACE", "SAVE", "OPEN", "'('", + "')'", "','", "start", "@1", "session", "command_line", "command", + "extract_command", "replace_command", "clear_command", "delete_command", + "addmod_command", "list_command", "save_command", "open_command", + "create_command", "addlib_command", "directory_command", + "optional_filename", "modulelist", "modulename", "optcomma", + "verbose_command", 0 +}; +#endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const short yyr1[] = +{ + 0, 25, 24, 26, 26, 27, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 40, 41, 41, 42, 42, 43, + 43, 44 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const short yyr2[] = +{ + 0, 0, 2, 2, 0, 2, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 0, 2, 2, 1, 2, 2, 1, 1, 2, + 2, 3, 4, 1, 0, 3, 0, 3, 0, 1, + 0, 1 +}; + +/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE + doesn't specify something else to do. Zero means the default is an + error. */ +static const short yydefact[] = +{ + 1, 4, 0, 19, 41, 20, 0, 27, 38, 24, + 0, 38, 0, 18, 38, 38, 28, 0, 3, 0, + 14, 15, 11, 16, 12, 17, 13, 6, 7, 10, + 9, 8, 36, 26, 30, 25, 36, 22, 23, 29, + 5, 38, 31, 39, 0, 34, 40, 37, 33, 32, + 35, 0, 0, 0 +}; + +static const short yydefgoto[] = +{ + 51, 1, 2, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 49, 42, 33, 44, + 31 +}; + +static const short yypact[] = +{ + -32768,-32768, 5,-32768,-32768,-32768, -4,-32768,-32768,-32768, + 2,-32768, 21,-32768,-32768,-32768,-32768, 22,-32768, 25, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768, 8, -3,-32768, -3, 8, -3, -3,-32768, + -32768,-32768,-32768,-32768, 26, 27, -1,-32768,-32768,-32768, + -32768, 33, 34,-32768 +}; + +static const short yypgoto[] = +{ + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768, 0, -11,-32768, + -32768 +}; + + +#define YYLAST 36 + + +static const short yytable[] = +{ + 35, 32, -40, 37, 38, -2, 3, 34, -21, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 43, 50, 43, 15, 16, 17, 36, 39, 40, 41, + 46, 47, 48, 52, 53, 0, 45 +}; + +static const short yycheck[] = +{ + 11, 5, 5, 14, 15, 0, 1, 5, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 23, 22, 23, 18, 19, 20, 5, 5, 3, 21, + 41, 5, 5, 0, 0, -1, 36 +}; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/share/bison-1.35/bison.simple" + +/* Skeleton output parser for bison, + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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. */ + +/* 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 is the parser code that is written into each bison parser when + the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* 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. */ + +#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# else +# ifndef YYSTACK_USE_ALLOCA +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# 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 /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free +# endif +#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short yyss; + YYSTYPE yyvs; +# if YYLSP_NEEDED + YYLTYPE yyls; +# endif +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# if YYLSP_NEEDED +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAX) +# else +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAX) +# endif + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if 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; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (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_MAX; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + + +#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 /* 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 +#define YYEOF 0 +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* 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); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror ("syntax error: cannot back up"); \ + YYERROR; \ + } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). + + When YYLLOC_DEFAULT is run, CURRENT is set the location of the + first token. By default, to implement support for ranges, extend + its range to the last symbol. */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + Current.last_line = Rhs[N].last_line; \ + Current.last_column = Rhs[N].last_column; +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#if YYPURE +# if YYLSP_NEEDED +# ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +# else +# define YYLEX yylex (&yylval, &yylloc) +# endif +# else /* !YYLSP_NEEDED */ +# ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, YYLEX_PARAM) +# else +# define YYLEX yylex (&yylval) +# endif +# endif /* !YYLSP_NEEDED */ +#else /* !YYPURE */ +# define YYLEX yylex () +#endif /* !YYPURE */ + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +#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 + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#if YYMAXDEPTH == 0 +# undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + +#ifdef YYERROR_VERBOSE + +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif +{ + register const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; +} +# 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. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif +{ + register char *yyd = yydest; + register const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif +#endif + +#line 315 "/usr/share/bison-1.35/bison.simple" + + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +# define YYPARSE_PARAM_DECL +# else +# define YYPARSE_PARAM_ARG YYPARSE_PARAM +# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +# endif +#else /* !YYPARSE_PARAM */ +# define YYPARSE_PARAM_ARG +# define YYPARSE_PARAM_DECL +#endif /* !YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +# ifdef YYPARSE_PARAM +int yyparse (void *); +# else +int yyparse (void); +# endif +#endif + +/* YY_DECL_VARIABLES -- depending whether we use a pure parser, + variables are global, or local to YYPARSE. */ + +#define YY_DECL_NON_LSP_VARIABLES \ +/* The lookahead symbol. */ \ +int yychar; \ + \ +/* The semantic value of the lookahead symbol. */ \ +YYSTYPE yylval; \ + \ +/* Number of parse errors so far. */ \ +int yynerrs; + +#if YYLSP_NEEDED +# define YY_DECL_VARIABLES \ +YY_DECL_NON_LSP_VARIABLES \ + \ +/* Location data for the lookahead symbol. */ \ +YYLTYPE yylloc; +#else +# define YY_DECL_VARIABLES \ +YY_DECL_NON_LSP_VARIABLES +#endif + + +/* If nonreentrant, generate the variables here. */ + +#if !YYPURE +YY_DECL_VARIABLES +#endif /* !YYPURE */ + +int +yyparse (YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + /* If reentrant, generate the variables here. */ +#if YYPURE + YY_DECL_VARIABLES +#endif /* !YYPURE */ + + register int yystate; + register int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Lookahead token as an internal (translated) token number. */ + int yychar1 = 0; + + /* 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. */ + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; + register short *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; + +#if YYLSP_NEEDED + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; +#endif + +#if YYLSP_NEEDED +# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +# define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + YYSIZE_T yystacksize = YYINITDEPTH; + + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; +#if YYLSP_NEEDED + YYLTYPE yyloc; +#endif + + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; + + 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; +#if YYLSP_NEEDED + yylsp = yyls; +#endif + 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 (yyssp >= yyss + yystacksize - 1) + { + /* 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; + short *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. */ +# if YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; + /* 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", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + yyls = yyls1; +# else + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); +# endif + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + goto yyoverflowlab; + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + + { + short *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); +# if YYLSP_NEEDED + YYSTACK_RELOCATE (yyls); +# endif +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; +#if YYLSP_NEEDED + yylsp = yyls + yysize - 1; +#endif + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; + + +/*-----------. +| yybackup. | +`-----------*/ +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. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yychar1 = YYTRANSLATE (yychar); + +#if YYDEBUG + /* We have to keep this `#if YYDEBUG', since we use variables + which are defined only if `YYDEBUG' is set. */ + if (yydebug) + { + YYFPRINTF (stderr, "Next token is %d (%s", + yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise + meaning of a token, for further debugging info. */ +# ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +# endif + YYFPRINTF (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + YYDPRINTF ((stderr, "Shifting token %d (%s), ", + yychar, yytname[yychar1])); + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#if YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + yystate = yyn; + 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 the semantic value of + the lookahead token. 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]; + +#if YYLSP_NEEDED + /* Similarly for the default location. Let the user run additional + commands if for instance locations are ranges. */ + yyloc = yylsp[1-yylen]; + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); +#endif + +#if YYDEBUG + /* We have to keep this `#if YYDEBUG', since we use variables which + are defined only if `YYDEBUG' is set. */ + if (yydebug) + { + int yyi; + + YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + switch (yyn) { + +case 1: +#line 68 "arparse.y" +{ prompt(); } + break; +case 5: +#line 77 "arparse.y" +{ prompt(); } + break; +case 18: +#line 93 "arparse.y" +{ ar_end(); return 0; } + break; +case 20: +#line 95 "arparse.y" +{ yyerror("foo"); } + break; +case 22: +#line 102 "arparse.y" +{ ar_extract(yyvsp[0].list); } + break; +case 23: +#line 107 "arparse.y" +{ ar_replace(yyvsp[0].list); } + break; +case 24: +#line 112 "arparse.y" +{ ar_clear(); } + break; +case 25: +#line 117 "arparse.y" +{ ar_delete(yyvsp[0].list); } + break; +case 26: +#line 121 "arparse.y" +{ ar_addmod(yyvsp[0].list); } + break; +case 27: +#line 126 "arparse.y" +{ ar_list(); } + break; +case 28: +#line 131 "arparse.y" +{ ar_save(); } + break; +case 29: +#line 138 "arparse.y" +{ ar_open(yyvsp[0].name,0); } + break; +case 30: +#line 143 "arparse.y" +{ ar_open(yyvsp[0].name,1); } + break; +case 31: +#line 149 "arparse.y" +{ ar_addlib(yyvsp[-1].name,yyvsp[0].list); } + break; +case 32: +#line 153 "arparse.y" +{ ar_directory(yyvsp[-2].name, yyvsp[-1].list, yyvsp[0].name); } + break; +case 33: +#line 160 "arparse.y" +{ yyval.name = yyvsp[0].name; } + break; +case 34: +#line 161 "arparse.y" +{ yyval.name = 0; } + break; +case 35: +#line 166 "arparse.y" +{ yyval.list = yyvsp[-1].list; } + break; +case 36: +#line 168 "arparse.y" +{ yyval.list = 0; } + break; +case 37: +#line 173 "arparse.y" +{ struct list *n = (struct list *) malloc(sizeof(struct list)); + n->next = yyvsp[-2].list; + n->name = yyvsp[0].name; + yyval.list = n; + } + break; +case 38: +#line 178 "arparse.y" +{ yyval.list = 0; } + break; +case 41: +#line 190 "arparse.y" +{ verbose = !verbose; } + break; +} + +#line 705 "/usr/share/bison-1.35/bison.simple" + + + yyvsp -= yylen; + yyssp -= yylen; +#if YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG + if (yydebug) + { + short *yyssp1 = yyss - 1; + YYFPRINTF (stderr, "state stack now"); + while (yyssp1 != yyssp) + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; +#if YYLSP_NEEDED + *++yylsp = yyloc; +#endif + + /* 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 - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + char *yymsg; + int yyx, yycount; + + yycount = 0; + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) + if (yycheck[yyx + yyn] == yyx) + yysize += yystrlen (yytname[yyx]) + 15, yycount++; + yysize += yystrlen ("parse error, unexpected ") + 1; + yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "parse error, unexpected "); + yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); + + if (yycount < 5) + { + yycount = 0; + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); + yyx++) + if (yycheck[yyx + yyn] == yyx) + { + const char *yyq = ! yycount ? ", expecting " : " or "; + yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yytname[yyx]); + yycount++; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("parse error; also virtual memory exhausted"); + } + else +#endif /* defined (YYERROR_VERBOSE) */ + yyerror ("parse error"); + } + goto yyerrlab1; + + +/*--------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action | +`--------------------------------------------------*/ +yyerrlab1: + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + YYDPRINTF ((stderr, "Discarding token %d (%s).\n", + yychar, yytname[yychar1])); + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + + +/*-------------------------------------------------------------------. +| yyerrdefault -- current state does not do anything special for the | +| error token. | +`-------------------------------------------------------------------*/ +yyerrdefault: +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + + /* If its default is to accept any token, ok. Otherwise pop it. */ + yyn = yydefact[yystate]; + if (yyn) + goto yydefault; +#endif + + +/*---------------------------------------------------------------. +| yyerrpop -- pop the current state because it cannot handle the | +| error token | +`---------------------------------------------------------------*/ +yyerrpop: + if (yyssp == yyss) + YYABORT; + yyvsp--; + yystate = *--yyssp; +#if YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG + if (yydebug) + { + short *yyssp1 = yyss - 1; + YYFPRINTF (stderr, "Error: state stack now"); + while (yyssp1 != yyssp) + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); + } +#endif + +/*--------------. +| yyerrhandle. | +`--------------*/ +yyerrhandle: + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + + YYDPRINTF ((stderr, "Shifting error token, ")); + + *++yyvsp = yylval; +#if YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +/*---------------------------------------------. +| yyoverflowab -- parser overflow comes here. | +`---------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; +} +#line 194 "arparse.y" + + +static int +yyerror (const char *x ATTRIBUTE_UNUSED) +{ + extern int linenumber; + + printf (_("Syntax error in archive script, line %d\n"), linenumber + 1); + return 0; +} diff --git a/binutils/arparse.h b/binutils/arparse.h new file mode 100644 index 0000000000000..0b9c3fd3eda0e --- /dev/null +++ b/binutils/arparse.h @@ -0,0 +1,35 @@ +#ifndef BISON_Y_TAB_H +# define BISON_Y_TAB_H + +#ifndef YYSTYPE +typedef union { + char *name; +struct list *list ; + +} yystype; +# define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 +#endif +# define NEWLINE 257 +# define VERBOSE 258 +# define FILENAME 259 +# define ADDLIB 260 +# define LIST 261 +# define ADDMOD 262 +# define CLEAR 263 +# define CREATE 264 +# define DELETE 265 +# define DIRECTORY 266 +# define END 267 +# define EXTRACT 268 +# define FULLDIR 269 +# define HELP 270 +# define QUIT 271 +# define REPLACE 272 +# define SAVE 273 +# define OPEN 274 + + +extern YYSTYPE yylval; + +#endif /* not BISON_Y_TAB_H */ diff --git a/binutils/binutils.texi b/binutils/binutils.texi deleted file mode 100644 index 74e7cda41ee1d..0000000000000 --- a/binutils/binutils.texi +++ /dev/null @@ -1,3469 +0,0 @@ -\input texinfo @c -*- Texinfo -*- -@setfilename binutils.info -@include config.texi - -@ifinfo -@format -START-INFO-DIR-ENTRY -* Binutils: (binutils). The GNU binary utilities. -* ar: (binutils)ar. Create, modify, and extract from archives -* nm: (binutils)nm. List symbols from object files -* objcopy: (binutils)objcopy. Copy and translate object files -* objdump: (binutils)objdump. Display information from object files -* ranlib: (binutils)ranlib. Generate index to archive contents -* readelf: (binutils)readelf. Display the contents of ELF format files. -* size: (binutils)size. List section sizes and total size -* strings: (binutils)strings. List printable strings from files -* strip: (binutils)strip. Discard symbols -* c++filt: (binutils)c++filt. Filter to demangle encoded C++ symbols -* cxxfilt: (binutils)c++filt. MS-DOS name for c++filt -* addr2line: (binutils)addr2line. Convert addresses to file and line -* nlmconv: (binutils)nlmconv. Converts object code into an NLM -* windres: (binutils)windres. Manipulate Windows resources -* dlltool: (binutils)dlltool. Create files needed to build and use DLLs -END-INFO-DIR-ENTRY -@end format -@end ifinfo - -@ifinfo -Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc. - - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.1 - or any later version published by the Free Software Foundation; - with no Invariant Sections, with no Front-Cover Texts, and with no - Back-Cover Texts. A copy of the license is included in the - section entitled "GNU Free Documentation License". - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries a copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -@end ifinfo - -@synindex ky cp -@c -@c This file documents the GNU binary utilities "ar", "ld", "objcopy", -@c "objdump", "nm", "size", "strings", "strip", "readelf" and "ranlib". -@c -@c Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc. -@c -@c This text may be freely distributed under the terms of the GNU -@c Free Documentation License. -@c - -@setchapternewpage odd -@settitle @sc{gnu} Binary Utilities -@titlepage -@finalout -@title The @sc{gnu} Binary Utilities -@subtitle Version @value{VERSION} -@sp 1 -@subtitle May 1993 -@author Roland H. Pesch -@author Jeffrey M. Osier -@author Cygnus Support -@page - -@tex -{\parskip=0pt \hfill Cygnus Support\par \hfill -\TeX{}info \texinfoversion\par } -@end tex - -@vskip 0pt plus 1filll -Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 1998, 2000, 2001 Free Software Foundation, Inc. - - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.1 - or any later version published by the Free Software Foundation; - with no Invariant Sections, with no Front-Cover Texts, and with no - Back-Cover Texts. A copy of the license is included in the - section entitled "GNU Free Documentation License". - -@end titlepage - -@node Top -@top Introduction - -@cindex version -This brief manual contains preliminary documentation for the @sc{gnu} binary -utilities (collectively version @value{VERSION}): - -@iftex -@table @code -@item ar -Create, modify, and extract from archives - -@item nm -List symbols from object files - -@item objcopy -Copy and translate object files - -@item objdump -Display information from object files - -@item ranlib -Generate index to archive contents - -@item readelf -Display the contents of ELF format files. - -@item size -List file section sizes and total size - -@item strings -List printable strings from files - -@item strip -Discard symbols - -@item c++filt -Demangle encoded C++ symbols (on MS-DOS, this program is named -@code{cxxfilt}) - -@item addr2line -Convert addresses into file names and line numbers - -@item nlmconv -Convert object code into a Netware Loadable Module - -@item windres -Manipulate Windows resources - -@item dlltool -Create the files needed to build and use Dynamic Link Libraries -@end table -@end iftex - -This document is distributed under the terms of the GNU Free -Documentation License. A copy of the license is included in the -section entitled "GNU Free Documentation License". - -@menu -* ar:: Create, modify, and extract from archives -* nm:: List symbols from object files -* objcopy:: Copy and translate object files -* objdump:: Display information from object files -* ranlib:: Generate index to archive contents -* readelf:: Display the contents of ELF format files. -* size:: List section sizes and total size -* strings:: List printable strings from files -* strip:: Discard symbols -* c++filt:: Filter to demangle encoded C++ symbols -* cxxfilt: c++filt. MS-DOS name for c++filt -* addr2line:: Convert addresses to file and line -* nlmconv:: Converts object code into an NLM -* windres:: Manipulate Windows resources -* dlltool:: Create files needed to build and use DLLs -* Selecting The Target System:: How these utilities determine the target. -* Reporting Bugs:: Reporting Bugs -* GNU Free Documentation License:: GNU Free Documentation License -* Index:: Index -@end menu - -@node ar -@chapter ar - -@kindex ar -@cindex archives -@cindex collections of files -@smallexample -ar [-]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] @var{archive} [@var{member}@dots{}] -ar -M [ }), and continues executing even after -errors. If you redirect standard input to a script file, no prompts are -issued, and @code{ar} abandons execution (with a nonzero exit code) -on any error. - -The @code{ar} command language is @emph{not} designed to be equivalent -to the command-line options; in fact, it provides somewhat less control -over archives. The only purpose of the command language is to ease the -transition to @sc{gnu} @code{ar} for developers who already have scripts -written for the MRI ``librarian'' program. - -The syntax for the @code{ar} command language is straightforward: -@itemize @bullet -@item -commands are recognized in upper or lower case; for example, @code{LIST} -is the same as @code{list}. In the following descriptions, commands are -shown in upper case for clarity. - -@item -a single command may appear on each line; it is the first word on the -line. - -@item -empty lines are allowed, and have no effect. - -@item -comments are allowed; text after either of the characters @samp{*} -or @samp{;} is ignored. - -@item -Whenever you use a list of names as part of the argument to an @code{ar} -command, you can separate the individual names with either commas or -blanks. Commas are shown in the explanations below, for clarity. - -@item -@samp{+} is used as a line continuation character; if @samp{+} appears -at the end of a line, the text on the following line is considered part -of the current command. -@end itemize - -Here are the commands you can use in @code{ar} scripts, or when using -@code{ar} interactively. Three of them have special significance: - -@code{OPEN} or @code{CREATE} specify a @dfn{current archive}, which is -a temporary file required for most of the other commands. - -@code{SAVE} commits the changes so far specified by the script. Prior -to @code{SAVE}, commands affect only the temporary copy of the current -archive. - -@table @code -@item ADDLIB @var{archive} -@itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module}) -Add all the contents of @var{archive} (or, if specified, each named -@var{module} from @var{archive}) to the current archive. - -Requires prior use of @code{OPEN} or @code{CREATE}. - -@item ADDMOD @var{member}, @var{member}, @dots{} @var{member} -@c FIXME! w/Replacement?? If so, like "ar r @var{archive} @var{names}" -@c else like "ar q..." -Add each named @var{member} as a module in the current archive. - -Requires prior use of @code{OPEN} or @code{CREATE}. - -@item CLEAR -Discard the contents of the current archive, canceling the effect of -any operations since the last @code{SAVE}. May be executed (with no -effect) even if no current archive is specified. - -@item CREATE @var{archive} -Creates an archive, and makes it the current archive (required for many -other commands). The new archive is created with a temporary name; it -is not actually saved as @var{archive} until you use @code{SAVE}. -You can overwrite existing archives; similarly, the contents of any -existing file named @var{archive} will not be destroyed until @code{SAVE}. - -@item DELETE @var{module}, @var{module}, @dots{} @var{module} -Delete each listed @var{module} from the current archive; equivalent to -@samp{ar -d @var{archive} @var{module} @dots{} @var{module}}. - -Requires prior use of @code{OPEN} or @code{CREATE}. - -@item DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) -@itemx DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) @var{outputfile} -List each named @var{module} present in @var{archive}. The separate -command @code{VERBOSE} specifies the form of the output: when verbose -output is off, output is like that of @samp{ar -t @var{archive} -@var{module}@dots{}}. When verbose output is on, the listing is like -@samp{ar -tv @var{archive} @var{module}@dots{}}. - -Output normally goes to the standard output stream; however, if you -specify @var{outputfile} as a final argument, @code{ar} directs the -output to that file. - -@item END -Exit from @code{ar}, with a @code{0} exit code to indicate successful -completion. This command does not save the output file; if you have -changed the current archive since the last @code{SAVE} command, those -changes are lost. - -@item EXTRACT @var{module}, @var{module}, @dots{} @var{module} -Extract each named @var{module} from the current archive, writing them -into the current directory as separate files. Equivalent to @samp{ar -x -@var{archive} @var{module}@dots{}}. - -Requires prior use of @code{OPEN} or @code{CREATE}. - -@ignore -@c FIXME Tokens but no commands??? -@item FULLDIR - -@item HELP -@end ignore - -@item LIST -Display full contents of the current archive, in ``verbose'' style -regardless of the state of @code{VERBOSE}. The effect is like @samp{ar -tv @var{archive}}. (This single command is a @sc{gnu} @code{ar} -enhancement, rather than present for MRI compatibility.) - -Requires prior use of @code{OPEN} or @code{CREATE}. - -@item OPEN @var{archive} -Opens an existing archive for use as the current archive (required for -many other commands). Any changes as the result of subsequent commands -will not actually affect @var{archive} until you next use @code{SAVE}. - -@item REPLACE @var{module}, @var{module}, @dots{} @var{module} -In the current archive, replace each existing @var{module} (named in -the @code{REPLACE} arguments) from files in the current working directory. -To execute this command without errors, both the file, and the module in -the current archive, must exist. - -Requires prior use of @code{OPEN} or @code{CREATE}. - -@item VERBOSE -Toggle an internal flag governing the output from @code{DIRECTORY}. -When the flag is on, @code{DIRECTORY} output matches output from -@samp{ar -tv }@dots{}. - -@item SAVE -Commit your changes to the current archive, and actually save it as a -file with the name specified in the last @code{CREATE} or @code{OPEN} -command. - -Requires prior use of @code{OPEN} or @code{CREATE}. - -@end table - -@iftex -@node ld -@chapter ld -@cindex linker -@kindex ld -The @sc{gnu} linker @code{ld} is now described in a separate manual. -@xref{Top,, Overview,, Using LD: the @sc{gnu} linker}. -@end iftex - -@node nm -@chapter nm -@cindex symbols -@kindex nm - -@smallexample -nm [ -a | --debug-syms ] [ -g | --extern-only ] - [ -B ] [ -C | --demangle[=@var{style}] ] [ -D | --dynamic ] - [ -s | --print-armap ] [ -A | -o | --print-file-name ] - [ -n | -v | --numeric-sort ] [ -p | --no-sort ] - [ -r | --reverse-sort ] [ --size-sort ] [ -u | --undefined-only ] - [ -t @var{radix} | --radix=@var{radix} ] [ -P | --portability ] - [ --target=@var{bfdname} ] [ -f @var{format} | --format=@var{format} ] - [ --defined-only ] [-l | --line-numbers ] [ --no-demangle ] - [ -V | --version ] [ -X 32_64 ] [ --help ] [ @var{objfile}@dots{} ] -@end smallexample - -@sc{gnu} @code{nm} lists the symbols from object files @var{objfile}@dots{}. -If no object files are listed as arguments, @code{nm} assumes the file -@file{a.out}. - -For each symbol, @code{nm} shows: - -@itemize @bullet -@item -The symbol value, in the radix selected by options (see below), or -hexadecimal by default. - -@item -The symbol type. At least the following types are used; others are, as -well, depending on the object file format. If lowercase, the symbol is -local; if uppercase, the symbol is global (external). - -@c Some more detail on exactly what these symbol types are used for -@c would be nice. -@table @code -@item A -The symbol's value is absolute, and will not be changed by further -linking. - -@item B -The symbol is in the uninitialized data section (known as BSS). - -@item C -The symbol is common. Common symbols are uninitialized data. When -linking, multiple common symbols may appear with the same name. If the -symbol is defined anywhere, the common symbols are treated as undefined -references. For more details on common symbols, see the discussion of ---warn-common in @ref{Options,,Linker options,ld.info,The GNU linker}. - -@item D -The symbol is in the initialized data section. - -@item G -The symbol is in an initialized data section for small objects. Some -object file formats permit more efficient access to small data objects, -such as a global int variable as opposed to a large global array. - -@item I -The symbol is an indirect reference to another symbol. This is a GNU -extension to the a.out object file format which is rarely used. - -@item N -The symbol is a debugging symbol. - -@item R -The symbol is in a read only data section. - -@item S -The symbol is in an uninitialized data section for small objects. - -@item T -The symbol is in the text (code) section. - -@item U -The symbol is undefined. - -@item V -The symbol is a weak object. When a weak defined symbol is linked with -a normal defined symbol, the normal defined symbol is used with no error. -When a weak undefined symbol is linked and the symbol is not defined, -the value of the weak symbol becomes zero with no error. - -@item W -The symbol is a weak symbol that has not been specifically tagged as a -weak object symbol. When a weak defined symbol is linked with a normal -defined symbol, the normal defined symbol is used with no error. -When a weak undefined symbol is linked and the symbol is not defined, -the value of the weak symbol becomes zero with no error. - -@item - -The symbol is a stabs symbol in an a.out object file. In this case, the -next values printed are the stabs other field, the stabs desc field, and -the stab type. Stabs symbols are used to hold debugging information; -for more information, see @ref{Top,Stabs,Stabs Overview,stabs.info, The -``stabs'' debug format}. - -@item ? -The symbol type is unknown, or object file format specific. -@end table - -@item -The symbol name. -@end itemize - -The long and short forms of options, shown here as alternatives, are -equivalent. - -@table @code -@item -A -@itemx -o -@itemx --print-file-name -@cindex input file name -@cindex file name -@cindex source file name -Precede each symbol by the name of the input file (or archive member) -in which it was found, rather than identifying the input file once only, -before all of its symbols. - -@item -a -@itemx --debug-syms -@cindex debugging symbols -Display all symbols, even debugger-only symbols; normally these are not -listed. - -@item -B -@cindex @code{nm} format -@cindex @code{nm} compatibility -The same as @samp{--format=bsd} (for compatibility with the MIPS @code{nm}). - -@item -C -@itemx --demangle[=@var{style}] -@cindex demangling in nm -Decode (@dfn{demangle}) low-level symbol names into user-level names. -Besides removing any initial underscore prepended by the system, this -makes C++ function names readable. Different compilers have different -mangling styles. The optional demangling style argument can be used to -choose an appropriate demangling style for your compiler. @xref{c++filt}, -for more information on demangling. - -@item --no-demangle -Do not demangle low-level symbol names. This is the default. - -@item -D -@itemx --dynamic -@cindex dynamic symbols -Display the dynamic symbols rather than the normal symbols. This is -only meaningful for dynamic objects, such as certain types of shared -libraries. - -@item -f @var{format} -@itemx --format=@var{format} -@cindex @code{nm} format -@cindex @code{nm} compatibility -Use the output format @var{format}, which can be @code{bsd}, -@code{sysv}, or @code{posix}. The default is @code{bsd}. -Only the first character of @var{format} is significant; it can be -either upper or lower case. - -@item -g -@itemx --extern-only -@cindex external symbols -Display only external symbols. - -@item -l -@itemx --line-numbers -@cindex symbol line numbers -For each symbol, use debugging information to try to find a filename and -line number. For a defined symbol, look for the line number of the -address of the symbol. For an undefined symbol, look for the line -number of a relocation entry which refers to the symbol. If line number -information can be found, print it after the other symbol information. - -@item -n -@itemx -v -@itemx --numeric-sort -Sort symbols numerically by their addresses, rather than alphabetically -by their names. - -@item -p -@itemx --no-sort -@cindex sorting symbols -Do not bother to sort the symbols in any order; print them in the order -encountered. - -@item -P -@itemx --portability -Use the POSIX.2 standard output format instead of the default format. -Equivalent to @samp{-f posix}. - -@item -s -@itemx --print-armap -@cindex symbol index, listing -When listing symbols from archive members, include the index: a mapping -(stored in the archive by @code{ar} or @code{ranlib}) of which modules -contain definitions for which names. - -@item -r -@itemx --reverse-sort -Reverse the order of the sort (whether numeric or alphabetic); let the -last come first. - -@item --size-sort -Sort symbols by size. The size is computed as the difference between -the value of the symbol and the value of the symbol with the next higher -value. The size of the symbol is printed, rather than the value. - -@item -t @var{radix} -@itemx --radix=@var{radix} -Use @var{radix} as the radix for printing the symbol values. It must be -@samp{d} for decimal, @samp{o} for octal, or @samp{x} for hexadecimal. - -@item --target=@var{bfdname} -@cindex object code format -Specify an object code format other than your system's default format. -@xref{Target Selection}, for more information. - -@item -u -@itemx --undefined-only -@cindex external symbols -@cindex undefined symbols -Display only undefined symbols (those external to each object file). - -@item --defined-only -@cindex external symbols -@cindex undefined symbols -Display only defined symbols for each object file. - -@item -V -@itemx --version -Show the version number of @code{nm} and exit. - -@item -X -This option is ignored for compatibility with the AIX version of -@code{nm}. It takes one parameter which must be the string -@code{32_64}. The default mode of AIX @code{nm} corresponds -to @code{-X 32}, which is not supported by @sc{gnu} @code{nm}. - -@item --help -Show a summary of the options to @code{nm} and exit. -@end table - -@node objcopy -@chapter objcopy - -@smallexample -objcopy [ -F @var{bfdname} | --target=@var{bfdname} ] - [ -I @var{bfdname} | --input-target=@var{bfdname} ] - [ -O @var{bfdname} | --output-target=@var{bfdname} ] - [ -S | --strip-all ] [ -g | --strip-debug ] - [ -K @var{symbolname} | --keep-symbol=@var{symbolname} ] - [ -N @var{symbolname} | --strip-symbol=@var{symbolname} ] - [ -G @var{symbolname} | --keep-global-symbol=@var{symbolname}] - [ -L @var{symbolname} | --localize-symbol=@var{symbolname} ] - [ -W @var{symbolname} | --weaken-symbol=@var{symbolname} ] - [ -x | --discard-all ] [ -X | --discard-locals ] - [ -b @var{byte} | --byte=@var{byte} ] - [ -i @var{interleave} | --interleave=@var{interleave} ] - [ -j @var{sectionname} | --only-section=@var{sectionname} ] - [ -R @var{sectionname} | --remove-section=@var{sectionname} ] - [ -p | --preserve-dates ] [ --debugging ] - [ --gap-fill=@var{val} ] [ --pad-to=@var{address} ] - [ --set-start=@var{val} ] [ --adjust-start=@var{incr} ] - [ --change-addresses=@var{incr} ] - [ --change-section-address @var{section}@{=,+,-@}@var{val} ] - [ --change-section-lma @var{section}@{=,+,-@}@var{val} ] - [ --change-section-vma @var{section}@{=,+,-@}@var{val} ] - [ --change-warnings ] [ --no-change-warnings ] - [ --set-section-flags @var{section}=@var{flags} ] - [ --add-section @var{sectionname}=@var{filename} ] - [ --change-leading-char ] [ --remove-leading-char ] - [ --srec-len=@var{ival} ] [ --srec-forceS3 ] - [ --redefine-sym @var{old}=@var{new} ] [ --weaken ] - [ --keep-symbols=@var{filename} ] - [ --strip-symbols=@var{filename} ] - [ --keep-global-symbols=@var{filename} ] - [ --localize-symbols=@var{filename} ] - [ --weaken-symbols=@var{filename} ] - [ -v | --verbose ] [ -V | --version ] [ --help ] - @var{infile} [@var{outfile}] -@end smallexample - -The @sc{gnu} @code{objcopy} utility copies the contents of an object -file to another. @code{objcopy} uses the @sc{gnu} @sc{bfd} Library to -read and write the object files. It can write the destination object -file in a format different from that of the source object file. The -exact behavior of @code{objcopy} is controlled by command-line options. -Note that @code{objcopy} should be able to copy a fully linked file -between any two formats. However, copying a relocatable object file -between any two formats may not work as expected. - -@code{objcopy} creates temporary files to do its translations and -deletes them afterward. @code{objcopy} uses @sc{bfd} to do all its -translation work; it has access to all the formats described in @sc{bfd} -and thus is able to recognize most formats without being told -explicitly. @xref{BFD,,BFD,ld.info,Using LD}. - -@code{objcopy} can be used to generate S-records by using an output -target of @samp{srec} (e.g., use @samp{-O srec}). - -@code{objcopy} can be used to generate a raw binary file by using an -output target of @samp{binary} (e.g., use @samp{-O binary}). When -@code{objcopy} generates a raw binary file, it will essentially produce -a memory dump of the contents of the input object file. All symbols and -relocation information will be discarded. The memory dump will start at -the load address of the lowest section copied into the output file. - -When generating an S-record or a raw binary file, it may be helpful to -use @samp{-S} to remove sections containing debugging information. In -some cases @samp{-R} will be useful to remove sections which contain -information that is not needed by the binary file. - -Note - @code{objcopy} is not able to change the endianness of its input -files. If the input format has an endianness, (some formats do not), -@code{objcopy} can only copy the inputs into file formats that have the -same endianness or which have no endianness (eg @samp{srec}). - -@table @code -@item @var{infile} -@itemx @var{outfile} -The input and output files, respectively. -If you do not specify @var{outfile}, @code{objcopy} creates a -temporary file and destructively renames the result with -the name of @var{infile}. - -@item -I @var{bfdname} -@itemx --input-target=@var{bfdname} -Consider the source file's object format to be @var{bfdname}, rather than -attempting to deduce it. @xref{Target Selection}, for more information. - -@item -O @var{bfdname} -@itemx --output-target=@var{bfdname} -Write the output file using the object format @var{bfdname}. -@xref{Target Selection}, for more information. - -@item -F @var{bfdname} -@itemx --target=@var{bfdname} -Use @var{bfdname} as the object format for both the input and the output -file; i.e., simply transfer data from source to destination with no -translation. @xref{Target Selection}, for more information. - -@item -j @var{sectionname} -@itemx --only-section=@var{sectionname} -Copy only the named section from the input file to the output file. -This option may be given more than once. Note that using this option -inappropriately may make the output file unusable. - -@item -R @var{sectionname} -@itemx --remove-section=@var{sectionname} -Remove any section named @var{sectionname} from the output file. This -option may be given more than once. Note that using this option -inappropriately may make the output file unusable. - -@item -S -@itemx --strip-all -Do not copy relocation and symbol information from the source file. - -@item -g -@itemx --strip-debug -Do not copy debugging symbols from the source file. - -@item --strip-unneeded -Strip all symbols that are not needed for relocation processing. - -@item -K @var{symbolname} -@itemx --keep-symbol=@var{symbolname} -Copy only symbol @var{symbolname} from the source file. This option may -be given more than once. - -@item -N @var{symbolname} -@itemx --strip-symbol=@var{symbolname} -Do not copy symbol @var{symbolname} from the source file. This option -may be given more than once. - -@item -G @var{symbolname} -@itemx --keep-global-symbol=@var{symbolname} -Keep only symbol @var{symbolname} global. Make all other symbols local -to the file, so that they are not visible externally. This option may -be given more than once. - -@item -L @var{symbolname} -@itemx --localize-symbol=@var{symbolname} -Make symbol @var{symbolname} local to the file, so that it is not -visible externally. This option may be given more than once. - -@item -W @var{symbolname} -@itemx --weaken-symbol=@var{symbolname} -Make symbol @var{symbolname} weak. This option may be given more than once. - -@item -x -@itemx --discard-all -Do not copy non-global symbols from the source file. -@c FIXME any reason to prefer "non-global" to "local" here? - -@item -X -@itemx --discard-locals -Do not copy compiler-generated local symbols. -(These usually start with @samp{L} or @samp{.}.) - -@item -b @var{byte} -@itemx --byte=@var{byte} -Keep only every @var{byte}th byte of the input file (header data is not -affected). @var{byte} can be in the range from 0 to @var{interleave}-1, -where @var{interleave} is given by the @samp{-i} or @samp{--interleave} -option, or the default of 4. This option is useful for creating files -to program @sc{rom}. It is typically used with an @code{srec} output -target. - -@item -i @var{interleave} -@itemx --interleave=@var{interleave} -Only copy one out of every @var{interleave} bytes. Select which byte to -copy with the @var{-b} or @samp{--byte} option. The default is 4. -@code{objcopy} ignores this option if you do not specify either @samp{-b} or -@samp{--byte}. - -@item -p -@itemx --preserve-dates -Set the access and modification dates of the output file to be the same -as those of the input file. - -@item --debugging -Convert debugging information, if possible. This is not the default -because only certain debugging formats are supported, and the -conversion process can be time consuming. - -@item --gap-fill @var{val} -Fill gaps between sections with @var{val}. This operation applies to -the @emph{load address} (LMA) of the sections. It is done by increasing -the size of the section with the lower address, and filling in the extra -space created with @var{val}. - -@item --pad-to @var{address} -Pad the output file up to the load address @var{address}. This is -done by increasing the size of the last section. The extra space is -filled in with the value specified by @samp{--gap-fill} (default zero). - -@item --set-start @var{val} -Set the start address of the new file to @var{val}. Not all object file -formats support setting the start address. - -@item --change-start @var{incr} -@itemx --adjust-start @var{incr} -@cindex changing start address -Change the start address by adding @var{incr}. Not all object file -formats support setting the start address. - -@item --change-addresses @var{incr} -@itemx --adjust-vma @var{incr} -@cindex changing object addresses -Change the VMA and LMA addresses of all sections, as well as the start -address, by adding @var{incr}. Some object file formats do not permit -section addresses to be changed arbitrarily. Note that this does not -relocate the sections; if the program expects sections to be loaded at a -certain address, and this option is used to change the sections such -that they are loaded at a different address, the program may fail. - -@item --change-section-address @var{section}@{=,+,-@}@var{val} -@itemx --adjust-section-vma @var{section}@{=,+,-@}@var{val} -@cindex changing section address -Set or change both the VMA address and the LMA address of the named -@var{section}. If @samp{=} is used, the section address is set to -@var{val}. Otherwise, @var{val} is added to or subtracted from the -section address. See the comments under @samp{--change-addresses}, -above. If @var{section} does not exist in the input file, a warning will -be issued, unless @samp{--no-change-warnings} is used. - -@item --change-section-lma @var{section}@{=,+,-@}@var{val} -@cindex changing section LMA -Set or change the LMA address of the named @var{section}. The LMA -address is the address where the section will be loaded into memory at -program load time. Normally this is the same as the VMA address, which -is the address of the section at program run time, but on some systems, -especially those where a program is held in ROM, the two can be -different. If @samp{=} is used, the section address is set to -@var{val}. Otherwise, @var{val} is added to or subtracted from the -section address. See the comments under @samp{--change-addresses}, -above. If @var{section} does not exist in the input file, a warning -will be issued, unless @samp{--no-change-warnings} is used. - -@item --change-section-vma @var{section}@{=,+,-@}@var{val} -@cindex changing section VMA -Set or change the VMA address of the named @var{section}. The VMA -address is the address where the section will be located once the -program has started executing. Normally this is the same as the LMA -address, which is the address where the section will be loaded into -memory, but on some systems, especially those where a program is held in -ROM, the two can be different. If @samp{=} is used, the section address -is set to @var{val}. Otherwise, @var{val} is added to or subtracted -from the section address. See the comments under -@samp{--change-addresses}, above. If @var{section} does not exist in -the input file, a warning will be issued, unless -@samp{--no-change-warnings} is used. - -@item --change-warnings -@itemx --adjust-warnings -If @samp{--change-section-address} or @samp{--change-section-lma} or -@samp{--change-section-vma} is used, and the named section does not -exist, issue a warning. This is the default. - -@item --no-change-warnings -@itemx --no-adjust-warnings -Do not issue a warning if @samp{--change-section-address} or -@samp{--adjust-section-lma} or @samp{--adjust-section-vma} is used, even -if the named section does not exist. - -@item --set-section-flags @var{section}=@var{flags} -Set the flags for the named section. The @var{flags} argument is a -comma separated string of flag names. The recognized names are -@samp{alloc}, @samp{contents}, @samp{load}, @samp{noload}, -@samp{readonly}, @samp{code}, @samp{data}, @samp{rom}, @samp{share}, and -@samp{debug}. You can set the @samp{contents} flag for a section which -does not have contents, but it is not meaningful to clear the -@samp{contents} flag of a section which does have contents--just remove -the section instead. Not all flags are meaningful for all object file -formats. - -@item --add-section @var{sectionname}=@var{filename} -Add a new section named @var{sectionname} while copying the file. The -contents of the new section are taken from the file @var{filename}. The -size of the section will be the size of the file. This option only -works on file formats which can support sections with arbitrary names. - -@item --change-leading-char -Some object file formats use special characters at the start of -symbols. The most common such character is underscore, which compilers -often add before every symbol. This option tells @code{objcopy} to -change the leading character of every symbol when it converts between -object file formats. If the object file formats use the same leading -character, this option has no effect. Otherwise, it will add a -character, or remove a character, or change a character, as -appropriate. - -@item --remove-leading-char -If the first character of a global symbol is a special symbol leading -character used by the object file format, remove the character. The -most common symbol leading character is underscore. This option will -remove a leading underscore from all global symbols. This can be useful -if you want to link together objects of different file formats with -different conventions for symbol names. This is different from -@code{--change-leading-char} because it always changes the symbol name -when appropriate, regardless of the object file format of the output -file. - -@item --srec-len=@var{ival} -Meaningful only for srec output. Set the maximum length of the Srecords -being produced to @var{ival}. This length covers both address, data and -crc fields. - -@item --srec-forceS3 -Meaningful only for srec output. Avoid generation of S1/S2 records, -creating S3-only record format. - -@item --redefine-sym @var{old}=@var{new} -Change the name of a symbol @var{old}, to @var{new}. This can be useful -when one is trying link two things together for which you have no -source, and there are name collisions. - -@item --weaken -Change all global symbols in the file to be weak. This can be useful -when building an object which will be linked against other objects using -the @code{-R} option to the linker. This option is only effective when -using an object file format which supports weak symbols. - -@item --keep-symbols=@var{filename} -Apply @samp{--keep-symbol} option to each symbol listed in the file -@var{filename}. @var{filename} is simply a flat file, with one symbol -name per line. Line comments may be introduced by the hash character. -This option may be given more than once. - -@item --strip-symbols=@var{filename} -Apply @samp{--strip-symbol} option to each symbol listed in the file -@var{filename}. @var{filename} is simply a flat file, with one symbol -name per line. Line comments may be introduced by the hash character. -This option may be given more than once. - -@item --keep-global-symbols=@var{filename} -Apply @samp{--keep-global-symbol} option to each symbol listed in the -file @var{filename}. @var{filename} is simply a flat file, with one -symbol name per line. Line comments may be introduced by the hash -character. This option may be given more than once. - -@item --localize-symbols=@var{filename} -Apply @samp{--localize-symbol} option to each symbol listed in the file -@var{filename}. @var{filename} is simply a flat file, with one symbol -name per line. Line comments may be introduced by the hash character. -This option may be given more than once. - -@item --weaken-symbols=@var{filename} -Apply @samp{--weaken-symbol} option to each symbol listed in the file -@var{filename}. @var{filename} is simply a flat file, with one symbol -name per line. Line comments may be introduced by the hash character. -This option may be given more than once. - -@item -V -@itemx --version -Show the version number of @code{objcopy}. - -@item -v -@itemx --verbose -Verbose output: list all object files modified. In the case of -archives, @samp{objcopy -V} lists all members of the archive. - -@item --help -Show a summary of the options to @code{objcopy}. -@end table - -@node objdump -@chapter objdump - -@cindex object file information -@kindex objdump - -@smallexample -objdump [ -a | --archive-headers ] - [ -b @var{bfdname} | --target=@var{bfdname} ] - [ -C | --demangle[=@var{style}] ] - [ -d | --disassemble ] - [ -D | --disassemble-all ] - [ -z | --disassemble-zeroes ] - [ -EB | -EL | --endian=@{big | little @} ] - [ -f | --file-headers ] - [ --file-start-context ] - [ -g | --debugging ] - [ -h | --section-headers | --headers ] - [ -i | --info ] - [ -j @var{section} | --section=@var{section} ] - [ -l | --line-numbers ] - [ -S | --source ] - [ -m @var{machine} | --architecture=@var{machine} ] - [ -M @var{options} | --disassembler-options=@var{options}] - [ -p | --private-headers ] - [ -r | --reloc ] - [ -R | --dynamic-reloc ] - [ -s | --full-contents ] - [ -G | --stabs ] - [ -t | --syms ] - [ -T | --dynamic-syms ] - [ -x | --all-headers ] - [ -w | --wide ] - [ --start-address=@var{address} ] - [ --stop-address=@var{address} ] - [ --prefix-addresses] - [ --[no-]show-raw-insn ] - [ --adjust-vma=@var{offset} ] - [ -V | --version ] - [ -H | --help ] - @var{objfile}@dots{} -@end smallexample - -@code{objdump} displays information about one or more object files. -The options control what particular information to display. This -information is mostly useful to programmers who are working on the -compilation tools, as opposed to programmers who just want their -program to compile and work. - -@var{objfile}@dots{} are the object files to be examined. When you -specify archives, @code{objdump} shows information on each of the member -object files. - -The long and short forms of options, shown here as alternatives, are -equivalent. At least one option from the list -@samp{-a,-d,-D,-f,-g,-G,-h,-H,-p,-r,-R,-S,-t,-T,-V,-x} must be given. - -@table @code -@item -a -@itemx --archive-header -@cindex archive headers -If any of the @var{objfile} files are archives, display the archive -header information (in a format similar to @samp{ls -l}). Besides the -information you could list with @samp{ar tv}, @samp{objdump -a} shows -the object file format of each archive member. - -@item --adjust-vma=@var{offset} -@cindex section addresses in objdump -@cindex VMA in objdump -When dumping information, first add @var{offset} to all the section -addresses. This is useful if the section addresses do not correspond to -the symbol table, which can happen when putting sections at particular -addresses when using a format which can not represent section addresses, -such as a.out. - -@item -b @var{bfdname} -@itemx --target=@var{bfdname} -@cindex object code format -Specify that the object-code format for the object files is -@var{bfdname}. This option may not be necessary; @var{objdump} can -automatically recognize many formats. - -For example, -@example -objdump -b oasys -m vax -h fu.o -@end example -@noindent -displays summary information from the section headers (@samp{-h}) of -@file{fu.o}, which is explicitly identified (@samp{-m}) as a VAX object -file in the format produced by Oasys compilers. You can list the -formats available with the @samp{-i} option. -@xref{Target Selection}, for more information. - -@item -C -@itemx --demangle[=@var{style}] -@cindex demangling in objdump -Decode (@dfn{demangle}) low-level symbol names into user-level names. -Besides removing any initial underscore prepended by the system, this -makes C++ function names readable. Different compilers have different -mangling styles. The optional demangling style argument can be used to -choose an appropriate demangling style for your compiler. @xref{c++filt}, -for more information on demangling. - -@item -G -@item --debugging -Display debugging information. This attempts to parse debugging -information stored in the file and print it out using a C like syntax. -Only certain types of debugging information have been implemented. - -@item -d -@itemx --disassemble -@cindex disassembling object code -@cindex machine instructions -Display the assembler mnemonics for the machine instructions from -@var{objfile}. This option only disassembles those sections which are -expected to contain instructions. - -@item -D -@itemx --disassemble-all -Like @samp{-d}, but disassemble the contents of all sections, not just -those expected to contain instructions. - -@item --prefix-addresses -When disassembling, print the complete address on each line. This is -the older disassembly format. - -@item --disassemble-zeroes -Normally the disassembly output will skip blocks of zeroes. This -option directs the disassembler to disassemble those blocks, just like -any other data. - -@item -EB -@itemx -EL -@itemx --endian=@{big|little@} -@cindex endianness -@cindex disassembly endianness -Specify the endianness of the object files. This only affects -disassembly. This can be useful when disassembling a file format which -does not describe endianness information, such as S-records. - -@item -f -@itemx --file-header -@cindex object file header -Display summary information from the overall header of -each of the @var{objfile} files. - -@item --file-start-context -@cindex source code context -Specify that when displaying interlisted source code/disassembly -(assumes '-S') from a file that has not yet been displayed, extend the -context to the start of the file. - -@item -h -@itemx --section-header -@itemx --header -@cindex section headers -Display summary information from the section headers of the -object file. - -File segments may be relocated to nonstandard addresses, for example by -using the @samp{-Ttext}, @samp{-Tdata}, or @samp{-Tbss} options to -@code{ld}. However, some object file formats, such as a.out, do not -store the starting address of the file segments. In those situations, -although @code{ld} relocates the sections correctly, using @samp{objdump --h} to list the file section headers cannot show the correct addresses. -Instead, it shows the usual addresses, which are implicit for the -target. - -@item --help -Print a summary of the options to @code{objdump} and exit. - -@item -i -@itemx --info -@cindex architectures available -@cindex object formats available -Display a list showing all architectures and object formats available -for specification with @samp{-b} or @samp{-m}. - -@item -j @var{name} -@itemx --section=@var{name} -@cindex section information -Display information only for section @var{name}. - -@item -l -@itemx --line-numbers -@cindex source filenames for object files -Label the display (using debugging information) with the filename and -source line numbers corresponding to the object code or relocs shown. -Only useful with @samp{-d}, @samp{-D}, or @samp{-r}. - -@item -m @var{machine} -@itemx --architecture=@var{machine} -@cindex architecture -@cindex disassembly architecture -Specify the architecture to use when disassembling object files. This -can be useful when disassembling object files which do not describe -architecture information, such as S-records. You can list the available -architectures with the @samp{-i} option. - -@item -M @var{options} -@itemx --disassembler-options=@var{options} -Pass target specific information to the disassembler. Only supported on -some targets. - -If the target is an ARM architecture then this switch can be used to -select which register name set is used during disassembler. Specifying -@samp{-M reg-name-std} (the default) will select the register names as -used in ARM's instruction set documentation, but with register 13 called -'sp', register 14 called 'lr' and register 15 called 'pc'. Specifying -@samp{-M reg-names-apcs} will select the name set used by the ARM -Procedure Call Standard, whilst specifying @samp{-M reg-names-raw} will -just use @samp{r} followed by the register number. - -There are also two variants on the APCS register naming scheme enabled -by @samp{-M reg-names-atpcs} and @samp{-M reg-names-special-atpcs} which -use the ARM/Thumb Procedure Call Standard naming conventions. (Either -with the normal register names or the special register names). - -This option can also be used for ARM architectures to force the -disassembler to interpret all instructions as Thumb instructions by -using the switch @samp{--disassembler-options=force-thumb}. This can be -useful when attempting to disassemble thumb code produced by other -compilers. - -@item -p -@itemx --private-headers -Print information that is specific to the object file format. The exact -information printed depends upon the object file format. For some -object file formats, no additional information is printed. - -@item -r -@itemx --reloc -@cindex relocation entries, in object file -Print the relocation entries of the file. If used with @samp{-d} or -@samp{-D}, the relocations are printed interspersed with the -disassembly. - -@item -R -@itemx --dynamic-reloc -@cindex dynamic relocation entries, in object file -Print the dynamic relocation entries of the file. This is only -meaningful for dynamic objects, such as certain types of shared -libraries. - -@item -s -@itemx --full-contents -@cindex sections, full contents -@cindex object file sections -Display the full contents of any sections requested. - -@item -S -@itemx --source -@cindex source disassembly -@cindex disassembly, with source -Display source code intermixed with disassembly, if possible. Implies -@samp{-d}. - -@item --show-raw-insn -When disassembling instructions, print the instruction in hex as well as -in symbolic form. This is the default except when -@code{--prefix-addresses} is used. - -@item --no-show-raw-insn -When disassembling instructions, do not print the instruction bytes. -This is the default when @code{--prefix-addresses} is used. - -@item -G -@item --stabs -@cindex stab -@cindex .stab -@cindex debug symbols -@cindex ELF object file format -Display the full contents of any sections requested. Display the -contents of the .stab and .stab.index and .stab.excl sections from an -ELF file. This is only useful on systems (such as Solaris 2.0) in which -@code{.stab} debugging symbol-table entries are carried in an ELF -section. In most other file formats, debugging symbol-table entries are -interleaved with linkage symbols, and are visible in the @samp{--syms} -output. For more information on stabs symbols, see @ref{Top,Stabs,Stabs -Overview,stabs.info, The ``stabs'' debug format}. - -@item --start-address=@var{address} -@cindex start-address -Start displaying data at the specified address. This affects the output -of the @code{-d}, @code{-r} and @code{-s} options. - -@item --stop-address=@var{address} -@cindex stop-address -Stop displaying data at the specified address. This affects the output -of the @code{-d}, @code{-r} and @code{-s} options. - -@item -t -@itemx --syms -@cindex symbol table entries, printing -Print the symbol table entries of the file. -This is similar to the information provided by the @samp{nm} program. - -@item -T -@itemx --dynamic-syms -@cindex dynamic symbol table entries, printing -Print the dynamic symbol table entries of the file. This is only -meaningful for dynamic objects, such as certain types of shared -libraries. This is similar to the information provided by the @samp{nm} -program when given the @samp{-D} (@samp{--dynamic}) option. - -@item --version -Print the version number of @code{objdump} and exit. - -@item -x -@itemx --all-header -@cindex all header information, object file -@cindex header information, all -Display all available header information, including the symbol table and -relocation entries. Using @samp{-x} is equivalent to specifying all of -@samp{-a -f -h -r -t}. - -@item -w -@itemx --wide -@cindex wide output, printing -Format some lines for output devices that have more than 80 columns. -@end table - -@node ranlib -@chapter ranlib - -@kindex ranlib -@cindex archive contents -@cindex symbol index - -@smallexample -ranlib [-vV] @var{archive} -@end smallexample - -@code{ranlib} generates an index to the contents of an archive and -stores it in the archive. The index lists each symbol defined by a -member of an archive that is a relocatable object file. - -You may use @samp{nm -s} or @samp{nm --print-armap} to list this index. - -An archive with such an index speeds up linking to the library and -allows routines in the library to call each other without regard to -their placement in the archive. - -The @sc{gnu} @code{ranlib} program is another form of @sc{gnu} @code{ar}; running -@code{ranlib} is completely equivalent to executing @samp{ar -s}. -@xref{ar}. - -@table @code -@item -v -@itemx -V -@itemx --version -Show the version number of @code{ranlib}. -@end table - -@node size -@chapter size - -@kindex size -@cindex section sizes - -@smallexample -size [ -A | -B | --format=@var{compatibility} ] - [ --help ] [ -d | -o | -x | --radix=@var{number} ] - [ --target=@var{bfdname} ] [ -V | --version ] - [ @var{objfile}@dots{} ] -@end smallexample - -The @sc{gnu} @code{size} utility lists the section sizes---and the total -size---for each of the object or archive files @var{objfile} in its -argument list. By default, one line of output is generated for each -object file or each module in an archive. - -@var{objfile}@dots{} are the object files to be examined. -If none are specified, the file @code{a.out} will be used. - -The command line options have the following meanings: - -@table @code -@item -A -@itemx -B -@itemx --format=@var{compatibility} -@cindex @code{size} display format -Using one of these options, you can choose whether the output from @sc{gnu} -@code{size} resembles output from System V @code{size} (using @samp{-A}, -or @samp{--format=sysv}), or Berkeley @code{size} (using @samp{-B}, or -@samp{--format=berkeley}). The default is the one-line format similar to -Berkeley's. -@c Bonus for doc-source readers: you can also say --format=strange (or -@c anything else that starts with 's') for sysv, and --format=boring (or -@c anything else that starts with 'b') for Berkeley. - -Here is an example of the Berkeley (default) format of output from -@code{size}: -@smallexample -$ size --format=Berkeley ranlib size -text data bss dec hex filename -294880 81920 11592 388392 5ed28 ranlib -294880 81920 11888 388688 5ee50 size -@end smallexample - -@noindent -This is the same data, but displayed closer to System V conventions: - -@smallexample -$ size --format=SysV ranlib size -ranlib : -section size addr -.text 294880 8192 -.data 81920 303104 -.bss 11592 385024 -Total 388392 - - -size : -section size addr -.text 294880 8192 -.data 81920 303104 -.bss 11888 385024 -Total 388688 -@end smallexample - -@item --help -Show a summary of acceptable arguments and options. - -@item -d -@itemx -o -@itemx -x -@itemx --radix=@var{number} -@cindex @code{size} number format -@cindex radix for section sizes -Using one of these options, you can control whether the size of each -section is given in decimal (@samp{-d}, or @samp{--radix=10}); octal -(@samp{-o}, or @samp{--radix=8}); or hexadecimal (@samp{-x}, or -@samp{--radix=16}). In @samp{--radix=@var{number}}, only the three -values (8, 10, 16) are supported. The total size is always given in two -radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or -octal and hexadecimal if you're using @samp{-o}. - -@item --target=@var{bfdname} -@cindex object code format -Specify that the object-code format for @var{objfile} is -@var{bfdname}. This option may not be necessary; @code{size} can -automatically recognize many formats. -@xref{Target Selection}, for more information. - -@item -V -@itemx --version -Display the version number of @code{size}. -@end table - -@node strings -@chapter strings -@kindex strings -@cindex listings strings -@cindex printing strings -@cindex strings, printing - -@smallexample -strings [-afov] [-@var{min-len}] [-n @var{min-len}] [-t @var{radix}] [-] - [--all] [--print-file-name] [--bytes=@var{min-len}] - [--radix=@var{radix}] [--target=@var{bfdname}] - [--help] [--version] @var{file}@dots{} -@end smallexample - -For each @var{file} given, @sc{gnu} @code{strings} prints the printable -character sequences that are at least 4 characters long (or the number -given with the options below) and are followed by an unprintable -character. By default, it only prints the strings from the initialized -and loaded sections of object files; for other types of files, it prints -the strings from the whole file. - -@code{strings} is mainly useful for determining the contents of non-text -files. - -@table @code -@item -a -@itemx --all -@itemx - -Do not scan only the initialized and loaded sections of object files; -scan the whole files. - -@item -f -@itemx --print-file-name -Print the name of the file before each string. - -@item --help -Print a summary of the program usage on the standard output and exit. - -@item -@var{min-len} -@itemx -n @var{min-len} -@itemx --bytes=@var{min-len} -Print sequences of characters that are at least @var{min-len} characters -long, instead of the default 4. - -@item -o -Like @samp{-t o}. Some other versions of @code{strings} have @samp{-o} -act like @samp{-t d} instead. Since we can not be compatible with both -ways, we simply chose one. - -@item -t @var{radix} -@itemx --radix=@var{radix} -Print the offset within the file before each string. The single -character argument specifies the radix of the offset---@samp{o} for -octal, @samp{x} for hexadecimal, or @samp{d} for decimal. - -@item --target=@var{bfdname} -@cindex object code format -Specify an object code format other than your system's default format. -@xref{Target Selection}, for more information. - -@item -v -@itemx --version -Print the program version number on the standard output and exit. -@end table - -@node strip -@chapter strip - -@kindex strip -@cindex removing symbols -@cindex discarding symbols -@cindex symbols, discarding - -@smallexample -strip [ -F @var{bfdname} | --target=@var{bfdname} ] - [ -I @var{bfdname} | --input-target=@var{bfdname} ] - [ -O @var{bfdname} | --output-target=@var{bfdname} ] - [ -s | --strip-all ] [ -S | -g | --strip-debug ] - [ -K @var{symbolname} | --keep-symbol=@var{symbolname} ] - [ -N @var{symbolname} | --strip-symbol=@var{symbolname} ] - [ -x | --discard-all ] [ -X | --discard-locals ] - [ -R @var{sectionname} | --remove-section=@var{sectionname} ] - [ -o @var{file} ] [ -p | --preserve-dates ] - [ -v | --verbose ] [ -V | --version ] [ --help ] - @var{objfile}@dots{} -@end smallexample - -@sc{gnu} @code{strip} discards all symbols from object files -@var{objfile}. The list of object files may include archives. -At least one object file must be given. - -@code{strip} modifies the files named in its argument, -rather than writing modified copies under different names. - -@table @code -@item -F @var{bfdname} -@itemx --target=@var{bfdname} -Treat the original @var{objfile} as a file with the object -code format @var{bfdname}, and rewrite it in the same format. -@xref{Target Selection}, for more information. - -@item --help -Show a summary of the options to @code{strip} and exit. - -@item -I @var{bfdname} -@itemx --input-target=@var{bfdname} -Treat the original @var{objfile} as a file with the object -code format @var{bfdname}. -@xref{Target Selection}, for more information. - -@item -O @var{bfdname} -@itemx --output-target=@var{bfdname} -Replace @var{objfile} with a file in the output format @var{bfdname}. -@xref{Target Selection}, for more information. - -@item -R @var{sectionname} -@itemx --remove-section=@var{sectionname} -Remove any section named @var{sectionname} from the output file. This -option may be given more than once. Note that using this option -inappropriately may make the output file unusable. - -@item -s -@itemx --strip-all -Remove all symbols. - -@item -g -@itemx -S -@itemx --strip-debug -Remove debugging symbols only. - -@item --strip-unneeded -Remove all symbols that are not needed for relocation processing. - -@item -K @var{symbolname} -@itemx --keep-symbol=@var{symbolname} -Keep only symbol @var{symbolname} from the source file. This option may -be given more than once. - -@item -N @var{symbolname} -@itemx --strip-symbol=@var{symbolname} -Remove symbol @var{symbolname} from the source file. This option may be -given more than once, and may be combined with strip options other than -@code{-K}. - -@item -o @var{file} -Put the stripped output in @var{file}, rather than replacing the -existing file. When this argument is used, only one @var{objfile} -argument may be specified. - -@item -p -@itemx --preserve-dates -Preserve the access and modification dates of the file. - -@item -x -@itemx --discard-all -Remove non-global symbols. - -@item -X -@itemx --discard-locals -Remove compiler-generated local symbols. -(These usually start with @samp{L} or @samp{.}.) - -@item -V -@itemx --version -Show the version number for @code{strip}. - -@item -v -@itemx --verbose -Verbose output: list all object files modified. In the case of -archives, @samp{strip -v} lists all members of the archive. -@end table - -@node c++filt, addr2line, strip, Top -@chapter c++filt - -@kindex c++filt -@cindex demangling C++ symbols - -@smallexample -c++filt [ -_ | --strip-underscores ] - [ -j | --java ] - [ -n | --no-strip-underscores ] - [ -s @var{format} | --format=@var{format} ] - [ --help ] [ --version ] [ @var{symbol}@dots{} ] -@end smallexample - -@kindex cxxfilt -The C++ and Java languages provides function overloading, which means -that you can write many functions with the same name (providing each -takes parameters of different types). All C++ and Java function names -are encoded into a low-level assembly label (this process is known as -@dfn{mangling}). The @code{c++filt} -@footnote{MS-DOS does not allow @kbd{+} characters in file names, so on -MS-DOS this program is named @code{cxxfilt}.} -program does the inverse mapping: it decodes (@dfn{demangles}) low-level -names into user-level names so that the linker can keep these overloaded -functions from clashing. - -Every alphanumeric word (consisting of letters, digits, underscores, -dollars, or periods) seen in the input is a potential label. If the -label decodes into a C++ name, the C++ name replaces the low-level -name in the output. - -You can use @code{c++filt} to decipher individual symbols: - -@example -c++filt @var{symbol} -@end example - -If no @var{symbol} arguments are given, @code{c++filt} reads symbol -names from the standard input and writes the demangled names to the -standard output. All results are printed on the standard output. - -@table @code -@item -_ -@itemx --strip-underscores -On some systems, both the C and C++ compilers put an underscore in front -of every name. For example, the C name @code{foo} gets the low-level -name @code{_foo}. This option removes the initial underscore. Whether -@code{c++filt} removes the underscore by default is target dependent. - -@item -j -@itemx --java -Prints demangled names using Java syntax. The default is to use C++ -syntax. - -@item -n -@itemx --no-strip-underscores -Do not remove the initial underscore. - -@item -s @var{format} -@itemx --format=@var{format} -@sc{gnu} @code{nm} can decode three different methods of mangling, used by -different C++ compilers. The argument to this option selects which -method it uses: - -@table @code -@item gnu -the one used by the @sc{gnu} compiler (the default method) -@item lucid -the one used by the Lucid compiler -@item arm -the one specified by the C++ Annotated Reference Manual -@item hp -the one used by the HP compiler -@item edg -the one used by the EDG compiler -@item gnu-new-abi -the one used by the @sc{gnu} compiler with the new ABI. -@end table - -@item --help -Print a summary of the options to @code{c++filt} and exit. - -@item --version -Print the version number of @code{c++filt} and exit. -@end table - -@quotation -@emph{Warning:} @code{c++filt} is a new utility, and the details of its -user interface are subject to change in future releases. In particular, -a command-line option may be required in the the future to decode a name -passed as an argument on the command line; in other words, - -@example -c++filt @var{symbol} -@end example - -@noindent -may in a future release become - -@example -c++filt @var{option} @var{symbol} -@end example -@end quotation - -@node addr2line -@chapter addr2line - -@kindex addr2line -@cindex address to file name and line number - -@smallexample -addr2line [ -b @var{bfdname} | --target=@var{bfdname} ] - [ -C | --demangle[=@var{style} ] - [ -e @var{filename} | --exe=@var{filename} ] - [ -f | --functions ] [ -s | --basename ] - [ -H | --help ] [ -V | --version ] - [ addr addr ... ] -@end smallexample - -@code{addr2line} translates program addresses into file names and line -numbers. Given an address and an executable, it uses the debugging -information in the executable to figure out which file name and line -number are associated with a given address. - -The executable to use is specified with the @code{-e} option. The -default is the file @file{a.out}. - -@code{addr2line} has two modes of operation. - -In the first, hexadecimal addresses are specified on the command line, -and @code{addr2line} displays the file name and line number for each -address. - -In the second, @code{addr2line} reads hexadecimal addresses from -standard input, and prints the file name and line number for each -address on standard output. In this mode, @code{addr2line} may be used -in a pipe to convert dynamically chosen addresses. - -The format of the output is @samp{FILENAME:LINENO}. The file name and -line number for each address is printed on a separate line. If the -@code{-f} option is used, then each @samp{FILENAME:LINENO} line is -preceded by a @samp{FUNCTIONNAME} line which is the name of the function -containing the address. - -If the file name or function name can not be determined, -@code{addr2line} will print two question marks in their place. If the -line number can not be determined, @code{addr2line} will print 0. - -The long and short forms of options, shown here as alternatives, are -equivalent. - -@table @code -@item -b @var{bfdname} -@itemx --target=@var{bfdname} -@cindex object code format -Specify that the object-code format for the object files is -@var{bfdname}. - -@item -C -@itemx --demangle[=@var{style}] -@cindex demangling in objdump -Decode (@dfn{demangle}) low-level symbol names into user-level names. -Besides removing any initial underscore prepended by the system, this -makes C++ function names readable. Different compilers have different -mangling styles. The optional demangling style argument can be used to -choose an appropriate demangling style for your compiler. @xref{c++filt}, -for more information on demangling. - -@item -e @var{filename} -@itemx --exe=@var{filename} -Specify the name of the executable for which addresses should be -translated. The default file is @file{a.out}. - -@item -f -@itemx --functions -Display function names as well as file and line number information. - -@item -s -@itemx --basenames -Display only the base of each file name. -@end table - -@node nlmconv -@chapter nlmconv - -@code{nlmconv} converts a relocatable object file into a NetWare -Loadable Module. - -@ignore -@code{nlmconv} currently works with @samp{i386} object -files in @code{coff}, @sc{elf}, or @code{a.out} format, and @sc{SPARC} -object files in @sc{elf}, or @code{a.out} format@footnote{ -@code{nlmconv} should work with any @samp{i386} or @sc{sparc} object -format in the Binary File Descriptor library. It has only been tested -with the above formats.}. -@end ignore - -@quotation -@emph{Warning:} @code{nlmconv} is not always built as part of the binary -utilities, since it is only useful for NLM targets. -@end quotation - -@smallexample -nlmconv [ -I @var{bfdname} | --input-target=@var{bfdname} ] - [ -O @var{bfdname} | --output-target=@var{bfdname} ] - [ -T @var{headerfile} | --header-file=@var{headerfile} ] - [ -d | --debug] [ -l @var{linker} | --linker=@var{linker} ] - [ -h | --help ] [ -V | --version ] - @var{infile} @var{outfile} -@end smallexample - -@code{nlmconv} converts the relocatable @samp{i386} object file -@var{infile} into the NetWare Loadable Module @var{outfile}, optionally -reading @var{headerfile} for NLM header information. For instructions -on writing the NLM command file language used in header files, see the -@samp{linkers} section, @samp{NLMLINK} in particular, of the @cite{NLM -Development and Tools Overview}, which is part of the NLM Software -Developer's Kit (``NLM SDK''), available from Novell, Inc. -@code{nlmconv} uses the @sc{gnu} Binary File Descriptor library to read -@var{infile}; see @ref{BFD,,BFD,ld.info,Using LD}, for -more information. - -@code{nlmconv} can perform a link step. In other words, you can list -more than one object file for input if you list them in the definitions -file (rather than simply specifying one input file on the command line). -In this case, @code{nlmconv} calls the linker for you. - -@table @code -@item -I @var{bfdname} -@itemx --input-target=@var{bfdname} -Object format of the input file. @code{nlmconv} can usually determine -the format of a given file (so no default is necessary). -@xref{Target Selection}, for more information. - -@item -O @var{bfdname} -@itemx --output-target=@var{bfdname} -Object format of the output file. @code{nlmconv} infers the output -format based on the input format, e.g. for a @samp{i386} input file the -output format is @samp{nlm32-i386}. -@xref{Target Selection}, for more information. - -@item -T @var{headerfile} -@itemx --header-file=@var{headerfile} -Reads @var{headerfile} for NLM header information. For instructions on -writing the NLM command file language used in header files, see@ see the -@samp{linkers} section, of the @cite{NLM Development and Tools -Overview}, which is part of the NLM Software Developer's Kit, available -from Novell, Inc. - -@item -d -@itemx --debug -Displays (on standard error) the linker command line used by @code{nlmconv}. - -@item -l @var{linker} -@itemx --linker=@var{linker} -Use @var{linker} for any linking. @var{linker} can be an absolute or a -relative pathname. - -@item -h -@itemx --help -Prints a usage summary. - -@item -V -@itemx --version -Prints the version number for @code{nlmconv}. -@end table - -@node windres -@chapter windres - -@code{windres} may be used to manipulate Windows resources. - -@quotation -@emph{Warning:} @code{windres} is not always built as part of the binary -utilities, since it is only useful for Windows targets. -@end quotation - -@smallexample -windres [options] [input-file] [output-file] -@end smallexample - -@code{windres} reads resources from an input file and copies them into -an output file. Either file may be in one of three formats: - -@table @code -@item rc -A text format read by the Resource Compiler. - -@item res -A binary format generated by the Resource Compiler. - -@item coff -A COFF object or executable. -@end table - -The exact description of these different formats is available in -documentation from Microsoft. - -When @code{windres} converts from the @code{rc} format to the @code{res} -format, it is acting like the Windows Resource Compiler. When -@code{windres} converts from the @code{res} format to the @code{coff} -format, it is acting like the Windows @code{CVTRES} program. - -When @code{windres} generates an @code{rc} file, the output is similar -but not identical to the format expected for the input. When an input -@code{rc} file refers to an external filename, an output @code{rc} file -will instead include the file contents. - -If the input or output format is not specified, @code{windres} will -guess based on the file name, or, for the input file, the file contents. -A file with an extension of @file{.rc} will be treated as an @code{rc} -file, a file with an extension of @file{.res} will be treated as a -@code{res} file, and a file with an extension of @file{.o} or -@file{.exe} will be treated as a @code{coff} file. - -If no output file is specified, @code{windres} will print the resources -in @code{rc} format to standard output. - -The normal use is for you to write an @code{rc} file, use @code{windres} -to convert it to a COFF object file, and then link the COFF file into -your application. This will make the resources described in the -@code{rc} file available to Windows. - -@table @code -@item -i @var{filename} -@itemx --input @var{filename} -The name of the input file. If this option is not used, then -@code{windres} will use the first non-option argument as the input file -name. If there are no non-option arguments, then @code{windres} will -read from standard input. @code{windres} can not read a COFF file from -standard input. - -@item -o @var{filename} -@itemx --output @var{filename} -The name of the output file. If this option is not used, then -@code{windres} will use the first non-option argument, after any used -for the input file name, as the output file name. If there is no -non-option argument, then @code{windres} will write to standard output. -@code{windres} can not write a COFF file to standard output. - -@item -I @var{format} -@itemx --input-format @var{format} -The input format to read. @var{format} may be @samp{res}, @samp{rc}, or -@samp{coff}. If no input format is specified, @code{windres} will -guess, as described above. - -@item -O @var{format} -@itemx --output-format @var{format} -The output format to generate. @var{format} may be @samp{res}, -@samp{rc}, or @samp{coff}. If no output format is specified, -@code{windres} will guess, as described above. - -@item -F @var{target} -@itemx --target @var{target} -Specify the BFD format to use for a COFF file as input or output. This -is a BFD target name; you can use the @code{--help} option to see a list -of supported targets. Normally @code{windres} will use the default -format, which is the first one listed by the @code{--help} option. -@ref{Target Selection}. - -@item --preprocessor @var{program} -When @code{windres} reads an @code{rc} file, it runs it through the C -preprocessor first. This option may be used to specify the preprocessor -to use, including any leading arguments. The default preprocessor -argument is @code{gcc -E -xc-header -DRC_INVOKED}. - -@item --include-dir @var{directory} -Specify an include directory to use when reading an @code{rc} file. -@code{windres} will pass this to the preprocessor as an @code{-I} -option. @code{windres} will also search this directory when looking for -files named in the @code{rc} file. - -@item -D @var{target} -@itemx --define @var{sym}[=@var{val}] -Specify a @code{-D} option to pass to the preprocessor when reading an -@code{rc} file. - -@item -v -Enable verbose mode. This tells you what the preprocessor is if you -didn't specify one. - -@item --language @var{val} -Specify the default language to use when reading an @code{rc} file. -@var{val} should be a hexadecimal language code. The low eight bits are -the language, and the high eight bits are the sublanguage. - -@item --use-temp-file -Use a temporary file to instead of using popen to read the output of -the preprocessor. Use this option if the popen implementation is buggy -on the host (eg., certain non-English language versions of Windows 95 and -Windows 98 are known to have buggy popen where the output will instead -go the console). - -@item --no-use-temp-file -Use popen, not a temporary file, to read the output of the preprocessor. -This is the default behaviour. - -@item --help -Prints a usage summary. - -@item --version -Prints the version number for @code{windres}. - -@item --yydebug -If @code{windres} is compiled with @code{YYDEBUG} defined as @code{1}, -this will turn on parser debugging. -@end table - - -@node dlltool -@chapter Create files needed to build and use DLLs -@cindex DLL -@kindex dlltool - -@code{dlltool} may be used to create the files needed to build and use -dynamic link libraries (DLLs). - -@quotation -@emph{Warning:} @code{dlltool} is not always built as part of the binary -utilities, since it is only useful for those targets which support DLLs. -@end quotation - -@smallexample -dlltool [-d|--input-def @var{def-file-name}] - [-b|--base-file @var{base-file-name}] - [-e|--output-exp @var{exports-file-name}] - [-z|--output-def @var{def-file-name}] - [-l|--output-lib @var{library-file-name}] - [--export-all-symbols] [--no-export-all-symbols] - [--exclude-symbols @var{list}] - [--no-default-excludes] - [-S|--as @var{path-to-assembler}] [-f|--as-flags @var{options}] - [-D|--dllname @var{name}] [-m|--machine @var{machine}] - [-a|--add-indirect] [-U|--add-underscore] [-k|--kill-at] - [-A|--add-stdcall-alias] - [-x|--no-idata4] [-c|--no-idata5] [-i|--interwork] - [-n|--nodelete] [-v|--verbose] [-h|--help] [-V|--version] - [object-file @dots{}] -@end smallexample - -@code{dlltool} reads its inputs, which can come from the @samp{-d} and -@samp{-b} options as well as object files specified on the command -line. It then processes these inputs and if the @samp{-e} option has -been specified it creates a exports file. If the @samp{-l} option -has been specified it creates a library file and if the @samp{-z} option -has been specified it creates a def file. Any or all of the -e, -l -and -z options can be present in one invocation of dlltool. - -When creating a DLL, along with the source for the DLL, it is necessary -to have three other files. @code{dlltool} can help with the creation of -these files. - -The first file is a @samp{.def} file which specifies which functions are -exported from the DLL, which functions the DLL imports, and so on. This -is a text file and can be created by hand, or @code{dlltool} can be used -to create it using the @samp{-z} option. In this case @code{dlltool} -will scan the object files specified on its command line looking for -those functions which have been specially marked as being exported and -put entries for them in the .def file it creates. - -In order to mark a function as being exported from a DLL, it needs to -have an @samp{-export:} entry in the @samp{.drectve} -section of the object file. This can be done in C by using the -asm() operator: - -@smallexample - asm (".section .drectve"); - asm (".ascii \"-export:my_func\""); - - int my_func (void) @{ @dots{} @} -@end smallexample - -The second file needed for DLL creation is an exports file. This file -is linked with the object files that make up the body of the DLL and it -handles the interface between the DLL and the outside world. This is a -binary file and it can be created by giving the @samp{-e} option to -@code{dlltool} when it is creating or reading in a .def file. - -The third file needed for DLL creation is the library file that programs -will link with in order to access the functions in the DLL. This file -can be created by giving the @samp{-l} option to dlltool when it -is creating or reading in a .def file. - -@code{dlltool} builds the library file by hand, but it builds the -exports file by creating temporary files containing assembler statements -and then assembling these. The @samp{-S} command line option can be -used to specify the path to the assembler that dlltool will use, -and the @samp{-f} option can be used to pass specific flags to that -assembler. The @samp{-n} can be used to prevent dlltool from deleting -these temporary assembler files when it is done, and if @samp{-n} is -specified twice then this will prevent dlltool from deleting the -temporary object files it used to build the library. - -Here is an example of creating a DLL from a source file @samp{dll.c} and -also creating a program (from an object file called @samp{program.o}) -that uses that DLL: - -@smallexample - gcc -c dll.c - dlltool -e exports.o -l dll.lib dll.o - gcc dll.o exports.o -o dll.dll - gcc program.o dll.lib -o program -@end smallexample - -The command line options have the following meanings: - -@table @code - -@item -d @var{filename} -@itemx --input-def @var{filename} -@cindex input .def file -Specifies the name of a .def file to be read in and processed. - -@item -b @var{filename} -@itemx --base-file @var{filename} -@cindex base files -Specifies the name of a base file to be read in and processed. The -contents of this file will be added to the relocation section in the -exports file generated by dlltool. - -@item -e @var{filename} -@itemx --output-exp @var{filename} -Specifies the name of the export file to be created by dlltool. - -@item -z @var{filename} -@itemx --output-def @var{filename} -Specifies the name of the .def file to be created by dlltool. - -@item -l @var{filename} -@itemx --output-lib @var{filename} -Specifies the name of the library file to be created by dlltool. - -@item --export-all-symbols -Treat all global and weak defined symbols found in the input object -files as symbols to be exported. There is a small list of symbols which -are not exported by default; see the @code{--no-default-excludes} -option. You may add to the list of symbols to not export by using the -@code{--exclude-symbols} option. - -@item --no-export-all-symbols -Only export symbols explicitly listed in an input .def file or in -@samp{.drectve} sections in the input object files. This is the default -behaviour. The @samp{.drectve} sections are created by @samp{dllexport} -attributes in the source code. - -@item --exclude-symbols @var{list} -Do not export the symbols in @var{list}. This is a list of symbol names -separated by comma or colon characters. The symbol names should not -contain a leading underscore. This is only meaningful when -@code{--export-all-symbols} is used. - -@item --no-default-excludes -When @code{--export-all-symbols} is used, it will by default avoid -exporting certain special symbols. The current list of symbols to avoid -exporting is @samp{DllMain@@12}, @samp{DllEntryPoint@@0}, -@samp{impure_ptr}. You may use the @code{--no-default-excludes} option -to go ahead and export these special symbols. This is only meaningful -when @code{--export-all-symbols} is used. - -@item -S @var{path} -@itemx --as @var{path} -Specifies the path, including the filename, of the assembler to be used -to create the exports file. - -@item -f @var{switches} -@itemx --as-flags @var{switches} -Specifies any specific command line switches to be passed to the -assembler when building the exports file. This option will work even if -the @samp{-S} option is not used. This option only takes one argument, -and if it occurs more than once on the command line, then later -occurrences will override earlier occurrences. So if it is necessary to -pass multiple switches to the assembler they should be enclosed in -double quotes. - -@item -D @var{name} -@itemx --dll-name @var{name} -Specifies the name to be stored in the .def file as the name of the DLL -when the @samp{-e} option is used. If this option is not present, then -the filename given to the @samp{-e} option will be used as the name of -the DLL. - -@item -m @var{machine} -@itemx -machine @var{machine} -Specifies the type of machine for which the library file should be -built. @code{dlltool} has a built in default type, depending upon how -it was created, but this option can be used to override that. This is -normally only useful when creating DLLs for an ARM processor, when the -contents of the DLL are actually encode using Thumb instructions. - -@item -a -@itemx --add-indirect -Specifies that when @code{dlltool} is creating the exports file it -should add a section which allows the exported functions to be -referenced without using the import library. Whatever the hell that -means! - -@item -U -@itemx --add-underscore -Specifies that when @code{dlltool} is creating the exports file it -should prepend an underscore to the names of the exported functions. - -@item -k -@itemx --kill-at -Specifies that when @code{dlltool} is creating the exports file it -should not append the string @samp{@@ }. These numbers are -called ordinal numbers and they represent another way of accessing the -function in a DLL, other than by name. - -@item -A -@itemx --add-stdcall-alias -Specifies that when @code{dlltool} is creating the exports file it -should add aliases for stdcall symbols without @samp{@@ } -in addition to the symbols with @samp{@@ }. - -@item -x -@itemx --no-idata4 -Specifies that when @code{dlltool} is creating the exports and library -files it should omit the .idata4 section. This is for compatibility -with certain operating systems. - -@item -c -@itemx --no-idata5 -Specifies that when @code{dlltool} is creating the exports and library -files it should omit the .idata5 section. This is for compatibility -with certain operating systems. - -@item -i -@itemx --interwork -Specifies that @code{dlltool} should mark the objects in the library -file and exports file that it produces as supporting interworking -between ARM and Thumb code. - -@item -n -@itemx --nodelete -Makes @code{dlltool} preserve the temporary assembler files it used to -create the exports file. If this option is repeated then dlltool will -also preserve the temporary object files it uses to create the library -file. - -@item -v -@itemx --verbose -Make dlltool describe what it is doing. - -@item -h -@itemx --help -Displays a list of command line options and then exits. - -@item -V -@itemx --version -Displays dlltool's version number and then exits. - -@end table - -@node readelf -@chapter readelf - -@cindex ELF file information -@kindex readelf - -@smallexample -readelf [ -a | --all ] - [ -h | --file-header] - [ -l | --program-headers | --segments] - [ -S | --section-headers | --sections] - [ -e | --headers] - [ -s | --syms | --symbols] - [ -n | --notes] - [ -r | --relocs] - [ -d | --dynamic] - [ -V | --version-info] - [ -D | --use-dynamic] - [ -x | --hex-dump=] - [ -w[liaprf] | --debug-dump[=info,=line,=abbrev,=pubnames,=ranges,=frames]] - [ --histogram] - [ -v | --version] - [ -H | --help] - @var{elffile}@dots{} -@end smallexample - -@code{readelf} displays information about one or more ELF format object -files. The options control what particular information to display. - -@var{elffile}@dots{} are the object files to be examined. At the -moment, @code{readelf} does not support examining archives, nor does it -support examing 64 bit ELF files. - -The long and short forms of options, shown here as alternatives, are -equivalent. At least one option besides @samp{-v} or @samp{-H} must be -given. - -@table @code -@item -a -@itemx --all -Equivalent to specifiying @samp{--file-header}, -@samp{--program-headers}, @samp{--sections}, @samp{--symbols}, -@samp{--relocs}, @samp{--dynamic}, @samp{--notes} and -@samp{--version-info}. - -@item -h -@itemx --file-header -@cindex ELF file header information -Displays the information contained in the ELF header at the start of the -file. - -@item -l -@itemx --program-headers -@itemx --segments -@cindex ELF program header information -@cindex ELF segment information -Displays the information contained in the file's segment headers, if it -has any. - -@item -S -@itemx --sections -@itemx --section-headers -@cindex ELF section information -Displays the information contained in the file's section headers, if it -has any. - -@item -s -@itemx --symbols -@itemx --syms -@cindex ELF symbol table information -Displays the entries in symbol table section of the file, if it has one. - -@item -e -@itemx --headers -Display all the headers in the file. Equivalent to @samp{-h -l -S}. - -@item -n -@itemx --notes -@cindex ELF core notes -Displays the contents of the NOTE segment, if it exists. - -@item -r -@itemx --relocs -@cindex ELF reloc information -Displays the contents of the file's relocation section, if it ha one. - -@item -d -@itemx --dynamic -@cindex ELF dynamic section information -Displays the contents of the file's dynamic section, if it has one. - -@item -V -@itemx --version-info -@cindex ELF version sections informations -Displays the contents of the version sections in the file, it they -exist. - -@item -D -@itemx --use-dynamic -When displaying symbols, this option makes @code{readelf} use the -symbol table in the file's dynamic section, rather than the one in the -symbols section. - -@item -x -@itemx --hex-dump= -Displays the contents of the indicated section as a hexadecimal dump. - -@item -w[liaprf] -@itemx --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=frames] -Displays the contents of the debug sections in the file, if any are -present. If one of the optional letters or words follows the switch -then only data found in those specific sections will be dumped. - -@item --histogram -Display a histogram of bucket list lengths when displaying the contents -of the symbol tables. - -@item -v -@itemx --version -Display the version number of readelf. - -@item -H -@itemx --help -Display the command line options understood by @code{readelf}. - -@end table - - -@node Selecting The Target System -@chapter Selecting the target system - -You can specify three aspects of the target system to the @sc{gnu} -binary file utilities, each in several ways: - -@itemize @bullet -@item -the target - -@item -the architecture - -@item -the linker emulation (which applies to the linker only) -@end itemize - -In the following summaries, the lists of ways to specify values are in -order of decreasing precedence. The ways listed first override those -listed later. - -The commands to list valid values only list the values for which the -programs you are running were configured. If they were configured with -@samp{--enable-targets=all}, the commands list most of the available -values, but a few are left out; not all targets can be configured in at -once because some of them can only be configured @dfn{native} (on hosts -with the same type as the target system). - -@menu -* Target Selection:: -* Architecture Selection:: -* Linker Emulation Selection:: -@end menu - -@node Target Selection -@section Target Selection - -A @dfn{target} is an object file format. A given target may be -supported for multiple architectures (@pxref{Architecture Selection}). -A target selection may also have variations for different operating -systems or architectures. - -The command to list valid target values is @samp{objdump -i} -(the first column of output contains the relevant information). - -Some sample values are: @samp{a.out-hp300bsd}, @samp{ecoff-littlemips}, -@samp{a.out-sunos-big}. - -You can also specify a target using a configuration triplet. This is -the same sort of name that is passed to @file{configure} to specify a -target. When you use a configuration triplet as an argument, it must be -fully canonicalized. You can see the canonical version of a triplet by -running the shell script @file{config.sub} which is included with the -sources. - -Some sample configuration triplets are: @samp{m68k-hp-bsd}, -@samp{mips-dec-ultrix}, @samp{sparc-sun-sunos}. - -@subheading @code{objdump} Target - -Ways to specify: - -@enumerate -@item -command line option: @samp{-b} or @samp{--target} - -@item -environment variable @code{GNUTARGET} - -@item -deduced from the input file -@end enumerate - -@subheading @code{objcopy} and @code{strip} Input Target - -Ways to specify: - -@enumerate -@item -command line options: @samp{-I} or @samp{--input-target}, or @samp{-F} or @samp{--target} - -@item -environment variable @code{GNUTARGET} - -@item -deduced from the input file -@end enumerate - -@subheading @code{objcopy} and @code{strip} Output Target - -Ways to specify: - -@enumerate -@item -command line options: @samp{-O} or @samp{--output-target}, or @samp{-F} or @samp{--target} - -@item -the input target (see ``@code{objcopy} and @code{strip} Input Target'' above) - -@item -environment variable @code{GNUTARGET} - -@item -deduced from the input file -@end enumerate - -@subheading @code{nm}, @code{size}, and @code{strings} Target - -Ways to specify: - -@enumerate -@item -command line option: @samp{--target} - -@item -environment variable @code{GNUTARGET} - -@item -deduced from the input file -@end enumerate - -@subheading Linker Input Target - -Ways to specify: - -@enumerate -@item -command line option: @samp{-b} or @samp{--format} -(@pxref{Options,,Options,ld.info,Using LD}) - -@item -script command @code{TARGET} -(@pxref{Option Commands,,Option Commands,ld.info,Using LD}) - -@item -environment variable @code{GNUTARGET} -(@pxref{Environment,,Environment,ld.info,Using LD}) - -@item -the default target of the selected linker emulation -(@pxref{Linker Emulation Selection}) -@end enumerate - -@subheading Linker Output Target - -Ways to specify: - -@enumerate -@item -command line option: @samp{-oformat} -(@pxref{Options,,Options,ld.info,Using LD}) - -@item -script command @code{OUTPUT_FORMAT} -(@pxref{Option Commands,,Option Commands,ld.info,Using LD}) - -@item -the linker input target (see ``Linker Input Target'' above) -@end enumerate - -@node Architecture Selection -@section Architecture selection - -An @dfn{architecture} is a type of @sc{cpu} on which an object file is -to run. Its name may contain a colon, separating the name of the -processor family from the name of the particular @sc{cpu}. - -The command to list valid architecture values is @samp{objdump -i} (the -second column contains the relevant information). - -Sample values: @samp{m68k:68020}, @samp{mips:3000}, @samp{sparc}. - -@subheading @code{objdump} Architecture - -Ways to specify: - -@enumerate -@item -command line option: @samp{-m} or @samp{--architecture} - -@item -deduced from the input file -@end enumerate - -@subheading @code{objcopy}, @code{nm}, @code{size}, @code{strings} Architecture - -Ways to specify: - -@enumerate -@item -deduced from the input file -@end enumerate - -@subheading Linker Input Architecture - -Ways to specify: - -@enumerate -@item -deduced from the input file -@end enumerate - -@subheading Linker Output Architecture - -Ways to specify: - -@enumerate -@item -script command @code{OUTPUT_ARCH} -(@pxref{Option Commands,,Option Commands,ld.info,Using LD}) - -@item -the default architecture from the linker output target -(@pxref{Target Selection}) -@end enumerate - -@node Linker Emulation Selection -@section Linker emulation selection - -A linker @dfn{emulation} is a ``personality'' of the linker, which gives -the linker default values for the other aspects of the target system. -In particular, it consists of - -@itemize @bullet -@item -the linker script - -@item -the target - -@item -several ``hook'' functions that are run at certain stages of the linking -process to do special things that some targets require -@end itemize - -The command to list valid linker emulation values is @samp{ld -V}. - -Sample values: @samp{hp300bsd}, @samp{mipslit}, @samp{sun4}. - -Ways to specify: - -@enumerate -@item -command line option: @samp{-m} -(@pxref{Options,,Options,ld.info,Using LD}) - -@item -environment variable @code{LDEMULATION} - -@item -compiled-in @code{DEFAULT_EMULATION} from @file{Makefile}, -which comes from @code{EMUL} in @file{config/@var{target}.mt} -@end enumerate - -@node Reporting Bugs -@chapter Reporting Bugs -@cindex bugs -@cindex reporting bugs - -Your bug reports play an essential role in making the binary utilities -reliable. - -Reporting a bug may help you by bringing a solution to your problem, or -it may not. But in any case the principal function of a bug report is -to help the entire community by making the next version of the binary -utilities work better. Bug reports are your contribution to their -maintenance. - -In order for a bug report to serve its purpose, you must include the -information that enables us to fix the bug. - -@menu -* Bug Criteria:: Have you found a bug? -* Bug Reporting:: How to report bugs -@end menu - -@node Bug Criteria -@section Have you found a bug? -@cindex bug criteria - -If you are not sure whether you have found a bug, here are some guidelines: - -@itemize @bullet -@cindex fatal signal -@cindex crash -@item -If a binary utility gets a fatal signal, for any input whatever, that is -a bug. Reliable utilities never crash. - -@cindex error on valid input -@item -If a binary utility produces an error message for valid input, that is a -bug. - -@item -If you are an experienced user of binary utilities, your suggestions for -improvement are welcome in any case. -@end itemize - -@node Bug Reporting -@section How to report bugs -@cindex bug reports -@cindex bugs, reporting - -A number of companies and individuals offer support for @sc{gnu} -products. If you obtained the binary utilities from a support -organization, we recommend you contact that organization first. - -You can find contact information for many support companies and -individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs -distribution. - -In any event, we also recommend that you send bug reports for the binary -utilities to @samp{bug-binutils@@gnu.org}. - -The fundamental principle of reporting bugs usefully is this: -@strong{report all the facts}. If you are not sure whether to state a -fact or leave it out, state it! - -Often people omit facts because they think they know what causes the -problem and assume that some details do not matter. Thus, you might -assume that the name of a file you use in an example does not matter. -Well, probably it does not, but one cannot be sure. Perhaps the bug is -a stray memory reference which happens to fetch from the location where -that pathname is stored in memory; perhaps, if the pathname were -different, the contents of that location would fool the utility into -doing the right thing despite the bug. Play it safe and give a -specific, complete example. That is the easiest thing for you to do, -and the most helpful. - -Keep in mind that the purpose of a bug report is to enable us to fix the bug if -it is new to us. Therefore, always write your bug reports on the assumption -that the bug has not been reported previously. - -Sometimes people give a few sketchy facts and ask, ``Does this ring a -bell?'' Those bug reports are useless, and we urge everyone to -@emph{refuse to respond to them} except to chide the sender to report -bugs properly. - -To enable us to fix the bug, you should include all these things: - -@itemize @bullet -@item -The version of the utility. Each utility announces it if you start it -with the @samp{--version} argument. - -Without this, we will not know whether there is any point in looking for -the bug in the current version of the binary utilities. - -@item -Any patches you may have applied to the source, including any patches -made to the @code{BFD} library. - -@item -The type of machine you are using, and the operating system name and -version number. - -@item -What compiler (and its version) was used to compile the utilities---e.g. -``@code{gcc-2.7}''. - -@item -The command arguments you gave the utility to observe the bug. To -guarantee you will not omit something important, list them all. A copy -of the Makefile (or the output from make) is sufficient. - -If we were to try to guess the arguments, we would probably guess wrong -and then we might not encounter the bug. - -@item -A complete input file, or set of input files, that will reproduce the -bug. If the utility is reading an object file or files, then it is -generally most helpful to send the actual object files, uuencoded if -necessary to get them through the mail system. Note that -@samp{bug-binutils@@gnu.org} is a mailing list, so you should avoid -sending very large files to it. Making the files available for -anonymous FTP is OK. - -If the source files were produced exclusively using @sc{gnu} programs -(e.g., @code{gcc}, @code{gas}, and/or the @sc{gnu} @code{ld}), then it -may be OK to send the source files rather than the object files. In -this case, be sure to say exactly what version of @code{gcc}, or -whatever, was used to produce the object files. Also say how -@code{gcc}, or whatever, was configured. - -@item -A description of what behavior you observe that you believe is -incorrect. For example, ``It gets a fatal signal.'' - -Of course, if the bug is that the utility gets a fatal signal, then we -will certainly notice it. But if the bug is incorrect output, we might -not notice unless it is glaringly wrong. You might as well not give us -a chance to make a mistake. - -Even if the problem you experience is a fatal signal, you should still -say so explicitly. Suppose something strange is going on, such as your -copy of the utility is out of synch, or you have encountered a bug in -the C library on your system. (This has happened!) Your copy might -crash and ours would not. If you told us to expect a crash, then when -ours fails to crash, we would know that the bug was not happening for -us. If you had not told us to expect a crash, then we would not be able -to draw any conclusion from our observations. - -@item -If you wish to suggest changes to the source, send us context diffs, as -generated by @code{diff} with the @samp{-u}, @samp{-c}, or @samp{-p} -option. Always send diffs from the old file to the new file. If you -wish to discuss something in the @code{ld} source, refer to it by -context, not by line number. - -The line numbers in our development sources will not match those in your -sources. Your line numbers would convey no useful information to us. -@end itemize - -Here are some things that are not necessary: - -@itemize @bullet -@item -A description of the envelope of the bug. - -Often people who encounter a bug spend a lot of time investigating -which changes to the input file will make the bug go away and which -changes will not affect it. - -This is often time consuming and not very useful, because the way we -will find the bug is by running a single example under the debugger -with breakpoints, not by pure deduction from a series of examples. -We recommend that you save your time for something else. - -Of course, if you can find a simpler example to report @emph{instead} -of the original one, that is a convenience for us. Errors in the -output will be easier to spot, running under the debugger will take -less time, and so on. - -However, simplification is not vital; if you do not want to do this, -report the bug anyway and send us the entire test case you used. - -@item -A patch for the bug. - -A patch for the bug does help us if it is a good one. But do not omit -the necessary information, such as the test case, on the assumption that -a patch is all we need. We might see problems with your patch and decide -to fix the problem another way, or we might not understand it at all. - -Sometimes with programs as complicated as the binary utilities it is -very hard to construct an example that will make the program follow a -certain path through the code. If you do not send us the example, we -will not be able to construct one, so we will not be able to verify that -the bug is fixed. - -And if we cannot understand what bug you are trying to fix, or why your -patch should be an improvement, we will not install it. A test case will -help us to understand. - -@item -A guess about what the bug is or what it depends on. - -Such guesses are usually wrong. Even we cannot guess right about such -things without first using the debugger to find the facts. -@end itemize - -@node GNU Free Documentation License -@chapter GNU Free Documentation License -@cindex GNU Free Documentation License - - GNU Free Documentation License - - Version 1.1, March 2000 - - Copyright (C) 2000 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. - - -0. PREAMBLE - -The purpose of this License is to make a manual, textbook, or other -written document "free" in the sense of freedom: to assure everyone -the effective freedom to copy and redistribute it, with or without -modifying it, either commercially or noncommercially. Secondarily, -this License preserves for the author and publisher a way to get -credit for their work, while not being considered responsible for -modifications made by others. - -This License is a kind of "copyleft", which means that derivative -works of the document must themselves be free in the same sense. It -complements the GNU General Public License, which is a copyleft -license designed for free software. - -We have designed this License in order to use it for manuals for free -software, because free software needs free documentation: a free -program should come with manuals providing the same freedoms that the -software does. But this License is not limited to software manuals; -it can be used for any textual work, regardless of subject matter or -whether it is published as a printed book. We recommend this License -principally for works whose purpose is instruction or reference. - - -1. APPLICABILITY AND DEFINITIONS - -This License applies to any manual or other work that contains a -notice placed by the copyright holder saying it can be distributed -under the terms of this License. The "Document", below, refers to any -such manual or work. Any member of the public is a licensee, and is -addressed as "you". - -A "Modified Version" of the Document means any work containing the -Document or a portion of it, either copied verbatim, or with -modifications and/or translated into another language. - -A "Secondary Section" is a named appendix or a front-matter section of -the Document that deals exclusively with the relationship of the -publishers or authors of the Document to the Document's overall subject -(or to related matters) and contains nothing that could fall directly -within that overall subject. (For example, if the Document is in part a -textbook of mathematics, a Secondary Section may not explain any -mathematics.) The relationship could be a matter of historical -connection with the subject or with related matters, or of legal, -commercial, philosophical, ethical or political position regarding -them. - -The "Invariant Sections" are certain Secondary Sections whose titles -are designated, as being those of Invariant Sections, in the notice -that says that the Document is released under this License. - -The "Cover Texts" are certain short passages of text that are listed, -as Front-Cover Texts or Back-Cover Texts, in the notice that says that -the Document is released under this License. - -A "Transparent" copy of the Document means a machine-readable copy, -represented in a format whose specification is available to the -general public, whose contents can be viewed and edited directly and -straightforwardly with generic text editors or (for images composed of -pixels) generic paint programs or (for drawings) some widely available -drawing editor, and that is suitable for input to text formatters or -for automatic translation to a variety of formats suitable for input -to text formatters. A copy made in an otherwise Transparent file -format whose markup has been designed to thwart or discourage -subsequent modification by readers is not Transparent. A copy that is -not "Transparent" is called "Opaque". - -Examples of suitable formats for Transparent copies include plain -ASCII without markup, Texinfo input format, LaTeX input format, SGML -or XML using a publicly available DTD, and standard-conforming simple -HTML designed for human modification. Opaque formats include -PostScript, PDF, proprietary formats that can be read and edited only -by proprietary word processors, SGML or XML for which the DTD and/or -processing tools are not generally available, and the -machine-generated HTML produced by some word processors for output -purposes only. - -The "Title Page" means, for a printed book, the title page itself, -plus such following pages as are needed to hold, legibly, the material -this License requires to appear in the title page. For works in -formats which do not have any title page as such, "Title Page" means -the text near the most prominent appearance of the work's title, -preceding the beginning of the body of the text. - - -2. VERBATIM COPYING - -You may copy and distribute the Document in any medium, either -commercially or noncommercially, provided that this License, the -copyright notices, and the license notice saying this License applies -to the Document are reproduced in all copies, and that you add no other -conditions whatsoever to those of this License. You may not use -technical measures to obstruct or control the reading or further -copying of the copies you make or distribute. However, you may accept -compensation in exchange for copies. If you distribute a large enough -number of copies you must also follow the conditions in section 3. - -You may also lend copies, under the same conditions stated above, and -you may publicly display copies. - - -3. COPYING IN QUANTITY - -If you publish printed copies of the Document numbering more than 100, -and the Document's license notice requires Cover Texts, you must enclose -the copies in covers that carry, clearly and legibly, all these Cover -Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -the back cover. Both covers must also clearly and legibly identify -you as the publisher of these copies. The front cover must present -the full title with all words of the title equally prominent and -visible. You may add other material on the covers in addition. -Copying with changes limited to the covers, as long as they preserve -the title of the Document and satisfy these conditions, can be treated -as verbatim copying in other respects. - -If the required texts for either cover are too voluminous to fit -legibly, you should put the first ones listed (as many as fit -reasonably) on the actual cover, and continue the rest onto adjacent -pages. - -If you publish or distribute Opaque copies of the Document numbering -more than 100, you must either include a machine-readable Transparent -copy along with each Opaque copy, or state in or with each Opaque copy -a publicly-accessible computer-network location containing a complete -Transparent copy of the Document, free of added material, which the -general network-using public has access to download anonymously at no -charge using public-standard network protocols. If you use the latter -option, you must take reasonably prudent steps, when you begin -distribution of Opaque copies in quantity, to ensure that this -Transparent copy will remain thus accessible at the stated location -until at least one year after the last time you distribute an Opaque -copy (directly or through your agents or retailers) of that edition to -the public. - -It is requested, but not required, that you contact the authors of the -Document well before redistributing any large number of copies, to give -them a chance to provide you with an updated version of the Document. - - -4. MODIFICATIONS - -You may copy and distribute a Modified Version of the Document under -the conditions of sections 2 and 3 above, provided that you release -the Modified Version under precisely this License, with the Modified -Version filling the role of the Document, thus licensing distribution -and modification of the Modified Version to whoever possesses a copy -of it. In addition, you must do these things in the Modified Version: - -A. Use in the Title Page (and on the covers, if any) a title distinct - from that of the Document, and from those of previous versions - (which should, if there were any, be listed in the History section - of the Document). You may use the same title as a previous version - if the original publisher of that version gives permission. -B. List on the Title Page, as authors, one or more persons or entities - responsible for authorship of the modifications in the Modified - Version, together with at least five of the principal authors of the - Document (all of its principal authors, if it has less than five). -C. State on the Title page the name of the publisher of the - Modified Version, as the publisher. -D. Preserve all the copyright notices of the Document. -E. Add an appropriate copyright notice for your modifications - adjacent to the other copyright notices. -F. Include, immediately after the copyright notices, a license notice - giving the public permission to use the Modified Version under the - terms of this License, in the form shown in the Addendum below. -G. Preserve in that license notice the full lists of Invariant Sections - and required Cover Texts given in the Document's license notice. -H. Include an unaltered copy of this License. -I. Preserve the section entitled "History", and its title, and add to - it an item stating at least the title, year, new authors, and - publisher of the Modified Version as given on the Title Page. If - there is no section entitled "History" in the Document, create one - stating the title, year, authors, and publisher of the Document as - given on its Title Page, then add an item describing the Modified - Version as stated in the previous sentence. -J. Preserve the network location, if any, given in the Document for - public access to a Transparent copy of the Document, and likewise - the network locations given in the Document for previous versions - it was based on. These may be placed in the "History" section. - You may omit a network location for a work that was published at - least four years before the Document itself, or if the original - publisher of the version it refers to gives permission. -K. In any section entitled "Acknowledgements" or "Dedications", - preserve the section's title, and preserve in the section all the - substance and tone of each of the contributor acknowledgements - and/or dedications given therein. -L. Preserve all the Invariant Sections of the Document, - unaltered in their text and in their titles. Section numbers - or the equivalent are not considered part of the section titles. -M. Delete any section entitled "Endorsements". Such a section - may not be included in the Modified Version. -N. Do not retitle any existing section as "Endorsements" - or to conflict in title with any Invariant Section. - -If the Modified Version includes new front-matter sections or -appendices that qualify as Secondary Sections and contain no material -copied from the Document, you may at your option designate some or all -of these sections as invariant. To do this, add their titles to the -list of Invariant Sections in the Modified Version's license notice. -These titles must be distinct from any other section titles. - -You may add a section entitled "Endorsements", provided it contains -nothing but endorsements of your Modified Version by various -parties--for example, statements of peer review or that the text has -been approved by an organization as the authoritative definition of a -standard. - -You may add a passage of up to five words as a Front-Cover Text, and a -passage of up to 25 words as a Back-Cover Text, to the end of the list -of Cover Texts in the Modified Version. Only one passage of -Front-Cover Text and one of Back-Cover Text may be added by (or -through arrangements made by) any one entity. If the Document already -includes a cover text for the same cover, previously added by you or -by arrangement made by the same entity you are acting on behalf of, -you may not add another; but you may replace the old one, on explicit -permission from the previous publisher that added the old one. - -The author(s) and publisher(s) of the Document do not by this License -give permission to use their names for publicity for or to assert or -imply endorsement of any Modified Version. - - -5. COMBINING DOCUMENTS - -You may combine the Document with other documents released under this -License, under the terms defined in section 4 above for modified -versions, provided that you include in the combination all of the -Invariant Sections of all of the original documents, unmodified, and -list them all as Invariant Sections of your combined work in its -license notice. - -The combined work need only contain one copy of this License, and -multiple identical Invariant Sections may be replaced with a single -copy. If there are multiple Invariant Sections with the same name but -different contents, make the title of each such section unique by -adding at the end of it, in parentheses, the name of the original -author or publisher of that section if known, or else a unique number. -Make the same adjustment to the section titles in the list of -Invariant Sections in the license notice of the combined work. - -In the combination, you must combine any sections entitled "History" -in the various original documents, forming one section entitled -"History"; likewise combine any sections entitled "Acknowledgements", -and any sections entitled "Dedications". You must delete all sections -entitled "Endorsements." - - -6. COLLECTIONS OF DOCUMENTS - -You may make a collection consisting of the Document and other documents -released under this License, and replace the individual copies of this -License in the various documents with a single copy that is included in -the collection, provided that you follow the rules of this License for -verbatim copying of each of the documents in all other respects. - -You may extract a single document from such a collection, and distribute -it individually under this License, provided you insert a copy of this -License into the extracted document, and follow this License in all -other respects regarding verbatim copying of that document. - - -7. AGGREGATION WITH INDEPENDENT WORKS - -A compilation of the Document or its derivatives with other separate -and independent documents or works, in or on a volume of a storage or -distribution medium, does not as a whole count as a Modified Version -of the Document, provided no compilation copyright is claimed for the -compilation. Such a compilation is called an "aggregate", and this -License does not apply to the other self-contained works thus compiled -with the Document, on account of their being thus compiled, if they -are not themselves derivative works of the Document. - -If the Cover Text requirement of section 3 is applicable to these -copies of the Document, then if the Document is less than one quarter -of the entire aggregate, the Document's Cover Texts may be placed on -covers that surround only the Document within the aggregate. -Otherwise they must appear on covers around the whole aggregate. - - -8. TRANSLATION - -Translation is considered a kind of modification, so you may -distribute translations of the Document under the terms of section 4. -Replacing Invariant Sections with translations requires special -permission from their copyright holders, but you may include -translations of some or all Invariant Sections in addition to the -original versions of these Invariant Sections. You may include a -translation of this License provided that you also include the -original English version of this License. In case of a disagreement -between the translation and the original English version of this -License, the original English version will prevail. - - -9. TERMINATION - -You may not copy, modify, sublicense, or distribute the Document except -as expressly provided for under this License. Any other attempt to -copy, modify, sublicense or distribute the Document 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. - - -10. FUTURE REVISIONS OF THIS LICENSE - -The Free Software Foundation may publish new, revised versions -of the GNU Free Documentation 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. See -http://www.gnu.org/copyleft/. - -Each version of the License is given a distinguishing version number. -If the Document specifies that a particular numbered version of this -License "or any later version" applies to it, you have the option of -following the terms and conditions either of that specified version or -of any later version that has been published (not as a draft) by the -Free Software Foundation. If the Document does not specify a version -number of this License, you may choose any version ever published (not -as a draft) by the Free Software Foundation. - - -ADDENDUM: How to use this License for your documents - -To use this License in a document you have written, include a copy of -the License in the document and put the following copyright and -license notices just after the title page: - -@smallexample - Copyright (c) YEAR YOUR NAME. - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.1 - or any later version published by the Free Software Foundation; - with the Invariant Sections being LIST THEIR TITLES, with the - Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. - A copy of the license is included in the section entitled "GNU - Free Documentation License". -@end smallexample - -If you have no Invariant Sections, write "with no Invariant Sections" -instead of saying which ones are invariant. If you have no -Front-Cover Texts, write "no Front-Cover Texts" instead of -"Front-Cover Texts being LIST"; likewise for Back-Cover Texts. - -If your document contains nontrivial examples of program code, we -recommend releasing these examples in parallel under your choice of -free software license, such as the GNU General Public License, -to permit their use in free software. - -@node Index -@unnumbered Index - -@printindex cp - -@contents -@bye diff --git a/binutils/config.texi b/binutils/config.texi deleted file mode 100644 index 56bdd12e9e397..0000000000000 --- a/binutils/config.texi +++ /dev/null @@ -1 +0,0 @@ -@set VERSION 2.11.2 diff --git a/binutils/configure.com b/binutils/configure.com new file mode 100644 index 0000000000000..99463d5ecdb31 --- /dev/null +++ b/binutils/configure.com @@ -0,0 +1,76 @@ +$! +$! This file configures binutils for use with openVMS/Alpha +$! We do not use the configure script, since we do not have /bin/sh +$! to execute it. +$! +$! Written by Klaus K"ampf (kkaempf@rmi.de) +$! +$arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2 +$arch = f$element(arch_indx,"|","|VAX|Alpha|") +$! +$! +$! Generate config.h +$! +$ create []config.h +/* config.h. Generated automatically by configure. */ +/* config.in. Generated automatically from configure.in by autoheader. */ +/* Is the type time_t defined in ? */ +#define HAVE_TIME_T_IN_TIME_H 1 +/* Is the type time_t defined in ? */ +#define HAVE_TIME_T_IN_TYPES_H 1 +/* Does define struct utimbuf? */ +#define HAVE_GOOD_UTIME_H 1 +/* Whether fprintf must be declared even if is included. */ +#define NEED_DECLARATION_FPRINTF 1 +/* Whether sbrk must be declared even if is included. */ +#undef NEED_DECLARATION_SBRK +/* Do we need to use the b modifier when opening binary files? */ +/* #undef USE_BINARY_FOPEN */ +/* Define if you have the sbrk function. */ +/* #undef HAVE_SBRK 1 */ +/* Define if you have the utimes function. */ +#define HAVE_UTIMES 1 +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 +/* Define if you have the header file. */ +#define HAVE_STRINGS_H 1 +/* Define if you have the header file. */ +#define HAVE_SYS_FILE_H 1 +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 +$ write sys$output "Generated `config.h'" +$! +$! +$! Edit VERSION in makefile.vms-in +$! +$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input - + []makefile.vms-in /output=[]makefile.vms +$DECK +! +! Get VERSION from configure.in +! + mfile := CREATE_BUFFER("mfile", "CONFIGURE.IN"); + rang := CREATE_RANGE(BEGINNING_OF(mfile), END_OF(mfile)); + match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(binutils, ', FORWARD, EXACT, rang); + IF match_pos <> 0 THEN; + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + vers := CURRENT_LINE-")"; + ELSE; + vers := "unknown"; + ENDIF; + + file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name")); + rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file)); + match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang); + POSITION(BEGINNING_OF(match_pos)); + ERASE(match_pos); + COPY_TEXT(vers); + WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file")); + QUIT +$ EOD +$ write sys$output "Created `makefile.vms'" diff --git a/binutils/cxxfilt.man b/binutils/cxxfilt.man deleted file mode 100644 index a4d5d45106b64..0000000000000 --- a/binutils/cxxfilt.man +++ /dev/null @@ -1,114 +0,0 @@ -.\" Copyright (c) 1991 Free Software Foundation -.\" See section COPYING for conditions for redistribution -.TH @PROGRAM@ 1 "June 1993" "cygnus support" "GNU Development Tools" -.de BP -.sp -.ti \-.2i -\(** -.. - -.SH NAME -@PROGRAM@ \- demangle C++ symbols - -.SH SYNOPSIS -.hy 0 -.na -.TP -.B @PROGRAM@ -.RB "[\|" \-_ | \-\-strip-underscores "\|]" -.RB "[\|" "\-s {gnu,lucid,arm} " | " \-\-format={gnu,lucid,arm}" "\|]" -.RB "[\|" \-\-help "\|]" -.RB "[\|" \-\-version "\|]" -.RB "[\|" symbol "...\|]" -.SH DESCRIPTION -The C++ language provides function overloading, which means that you can -write many functions with the same name (providing each takes parameters -of different types). All C++ function names are encoded into a -low-level assembly label (this process is known as -.I mangling\c -). The -.B @PROGRAM@ -program does the inverse mapping: it decodes (\fIdemangles\fR) -low-level names into user-level names so that the linker can keep -these overloaded functions from clashing. -.PP -Every alphanumeric word (consisting of letters, digits, underscores, -dollars, or periods) seen in the input is a potential label. If the -label decodes into a C++ name, the C++ name replaces the low-level -name in the output. -.PP -You can use -.B @PROGRAM@ -to decipher individual symbols by specifying these symbols on the -command line. -.PP -If no -.B symbol -arguments are given, -.B @PROGRAM@ -reads symbol names from the standard input and writes the demangled -names to the standard output. All results are printed on the standard -output. -.SH OPTIONS -.TP -.B \-_ -.TP -.B \-\-strip\-underscores -On some systems, both the C and C++ compilers put an -underscore in front of every name. For example, the C name -.B foo -gets the low-level name -.BR _foo . -This option removes the leading underscore. - -.TP -.B "\-s {gnu,lucid,arm}" -.TP -.B \-\-format={gnu,lucid,arm} -GNU -.B nm -can decode three different methods of mangling, used by different C++ -compilers. This option selects which method it uses: the one used by -the GNU compiler, the one used by the Lucid compiler, or the one -specified by the C++ Annotated Reference Manual. The default is the -GNU style. - -.TP -.B \-\-help -Print a summary of the options to -.B @PROGRAM@ -and exit. - -.TP -.B \-\-version -Print the version number of -.B @PROGRAM@ -and exit. - -.SH "SEE ALSO" -.RB "`\|" binutils "\|'" -entry in -.B -info\c -\&; -.I -The GNU Binary Utilities\c -\&, Roland H. Pesch (June 1993). - -.SH COPYING -Copyright (c) 1993 Free Software Foundation, Inc. -.PP -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. -.PP -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the -entire resulting derived work is distributed under the terms of a -permission notice identical to this one. -.PP -Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be included in -translations approved by the Free Software Foundation instead of in -the original English. diff --git a/binutils/deflex.c b/binutils/deflex.c new file mode 100644 index 0000000000000..d7821ba49b975 --- /dev/null +++ b/binutils/deflex.c @@ -0,0 +1,1874 @@ +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /cvs/src/src/binutils/Attic/deflex.c,v 1.1.12.2 2004/05/17 19:46:22 drow Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include +#include + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include +#ifndef _WIN32 +#include +#endif + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#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 + +/* 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 yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#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. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *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 */ \ + } \ + 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; + + +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; + + /* 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 yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* 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". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* 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_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 ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_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 ) + +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 )); + +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 * )); + +#define yy_new_buffer yy_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; \ + } + +#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; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +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[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 40 +#define YY_END_OF_BUFFER 41 +static yyconst short int yy_accept[197] = + { 0, + 0, 0, 41, 40, 34, 35, 33, 40, 28, 40, + 31, 39, 37, 27, 32, 36, 38, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 0, 29, 28, 0, 30, 31, 27, 32, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 12, 6, 28, 7, 28, + 28, 28, 28, 28, 28, 28, 28, 1, 28, 28, + + 28, 16, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 17, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 14, 28, 28, 28, 19, 21, 28, 28, 28, 28, + 28, 28, 18, 9, 28, 10, 28, 28, 2, 28, + 28, 15, 28, 28, 28, 28, 11, 13, 28, 5, + 28, 28, 22, 28, 8, 28, 28, 28, 28, 28, + 28, 20, 4, 28, 28, 28, 24, 28, 26, 28, + 3, 28, 28, 23, 25, 0 + + } ; + +static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 1, 5, 1, 6, 1, 1, 7, 1, + 1, 8, 1, 9, 6, 10, 11, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 6, 13, 1, + 14, 1, 6, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 6, 25, 26, 27, 28, 29, 30, + 6, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 1, 1, 1, 1, 6, 1, 21, 21, 21, 21, + + 21, 21, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 21, + 6, 6, 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, 1, 1, 1 + } ; + +static yyconst int yy_meta[40] = + { 0, + 1, 1, 2, 1, 1, 3, 1, 1, 1, 1, + 4, 5, 1, 1, 4, 6, 6, 6, 6, 6, + 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3 + } ; + +static yyconst short int yy_base[204] = + { 0, + 0, 0, 228, 229, 229, 229, 229, 222, 0, 219, + 0, 229, 229, 0, 0, 229, 0, 209, 195, 24, + 186, 202, 14, 197, 186, 27, 188, 198, 25, 197, + 196, 184, 209, 229, 0, 206, 229, 0, 0, 0, + 0, 180, 27, 178, 178, 27, 193, 178, 183, 189, + 179, 177, 175, 178, 185, 182, 183, 170, 181, 165, + 164, 170, 173, 172, 159, 174, 171, 170, 158, 156, + 156, 151, 152, 149, 161, 34, 145, 160, 145, 146, + 154, 157, 147, 141, 139, 0, 0, 138, 0, 139, + 135, 137, 135, 135, 29, 149, 140, 0, 136, 139, + + 145, 0, 136, 139, 132, 132, 30, 132, 135, 138, + 129, 119, 118, 126, 116, 122, 119, 115, 115, 124, + 127, 109, 112, 121, 119, 106, 111, 108, 106, 0, + 106, 103, 112, 99, 91, 97, 99, 95, 88, 99, + 0, 93, 103, 94, 0, 0, 97, 91, 87, 90, + 84, 83, 0, 0, 95, 0, 97, 80, 0, 92, + 91, 0, 78, 70, 91, 74, 0, 0, 82, 0, + 89, 88, 0, 84, 0, 82, 85, 83, 69, 66, + 56, 0, 0, 39, 36, 35, 0, 44, 0, 43, + 0, 40, 39, 0, 0, 229, 66, 70, 76, 82, + + 84, 90, 94 + } ; + +static yyconst short int yy_def[204] = + { 0, + 196, 1, 196, 196, 196, 196, 196, 197, 198, 199, + 200, 196, 196, 201, 202, 196, 203, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 197, 196, 198, 199, 196, 200, 201, 202, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 0, 196, 196, 196, 196, + + 196, 196, 196 + } ; + +static yyconst short int yy_nxt[269] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 4, 14, 15, 16, 17, 9, 18, 19, 20, 21, + 9, 9, 22, 23, 9, 24, 25, 26, 9, 27, + 28, 29, 30, 9, 31, 32, 9, 9, 9, 44, + 48, 49, 52, 45, 56, 64, 68, 57, 58, 99, + 116, 127, 117, 128, 65, 53, 69, 59, 195, 194, + 193, 192, 191, 190, 189, 100, 33, 33, 33, 33, + 33, 33, 35, 35, 35, 35, 36, 36, 36, 36, + 36, 36, 38, 188, 38, 38, 38, 38, 39, 39, + 40, 187, 40, 40, 40, 40, 41, 186, 185, 41, + + 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, + 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, + 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, + 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, + 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, + 134, 133, 132, 131, 130, 129, 126, 125, 124, 123, + 122, 121, 120, 119, 118, 115, 114, 113, 112, 111, + 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, + 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, + 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, + + 78, 77, 76, 75, 74, 73, 72, 71, 70, 67, + 66, 63, 37, 34, 62, 61, 60, 55, 54, 51, + 50, 47, 46, 43, 42, 37, 34, 196, 3, 196, + 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 196, 196, 196, 196, 196, 196, 196, 196 + } ; + +static yyconst short int yy_chk[269] = + { 0, + 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, 20, + 23, 23, 26, 20, 29, 43, 46, 29, 29, 76, + 95, 107, 95, 107, 43, 26, 46, 29, 193, 192, + 190, 188, 186, 185, 184, 76, 197, 197, 197, 197, + 197, 197, 198, 198, 198, 198, 199, 199, 199, 199, + 199, 199, 200, 181, 200, 200, 200, 200, 201, 201, + 202, 180, 202, 202, 202, 202, 203, 179, 178, 203, + + 177, 176, 174, 172, 171, 169, 166, 165, 164, 163, + 161, 160, 158, 157, 155, 152, 151, 150, 149, 148, + 147, 144, 143, 142, 140, 139, 138, 137, 136, 135, + 134, 133, 132, 131, 129, 128, 127, 126, 125, 124, + 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, + 113, 112, 111, 110, 109, 108, 106, 105, 104, 103, + 101, 100, 99, 97, 96, 94, 93, 92, 91, 90, + 88, 85, 84, 83, 82, 81, 80, 79, 78, 77, + 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, + 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, + + 55, 54, 53, 52, 51, 50, 49, 48, 47, 45, + 44, 42, 36, 33, 32, 31, 30, 28, 27, 25, + 24, 22, 21, 19, 18, 10, 8, 3, 196, 196, + 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 196, 196, 196, 196, 196, 196, 196, 196 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* 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 "deflex.l" +#define INITIAL 0 +#line 2 "deflex.l" + +/* Copyright 1995, 1997, 1998, 1999, 2002, 2003, 2004 + Free Software Foundation, Inc. + + This file is part of GNU Binutils. + + This program is free software; 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. */ + + +/* Contributed by Steve Chamberlain: sac@cygnus.com */ + +#define DONTDECLARE_MALLOC +#include "libiberty.h" +#include "defparse.h" +#include "dlltool.h" + +int linenumber; + +#line 521 "lex.yy.c" + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( 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 + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#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. */ +#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 (void) fwrite( yytext, yyleng, 1, yyout ) +#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->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + } +#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 + +/* 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 + +/* Code executed at the beginning of each rule, after yytext and yyleng + * 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 \ + YY_USER_ACTION + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 33 "deflex.l" + +#line 685 "lex.yy.c" + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *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_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 >= 197 ) + 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_base[yy_current_state] != 229 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + +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 34 "deflex.l" +{ return NAME;} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 35 "deflex.l" +{ return LIBRARY;} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 36 "deflex.l" +{ return DESCRIPTION;} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 37 "deflex.l" +{ return STACKSIZE;} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 38 "deflex.l" +{ return HEAPSIZE;} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 39 "deflex.l" +{ return CODE;} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 40 "deflex.l" +{ return DATA;} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 41 "deflex.l" +{ return SECTIONS;} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 42 "deflex.l" +{ return EXPORTS;} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 43 "deflex.l" +{ return IMPORTS;} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 44 "deflex.l" +{ return VERSIONK;} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 45 "deflex.l" +{ return BASE;} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 46 "deflex.l" +{ return CONSTANT; } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 47 "deflex.l" +{ return NONAME; } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 48 "deflex.l" +{ return PRIVATE; } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 49 "deflex.l" +{ return READ;} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 50 "deflex.l" +{ return WRITE;} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 51 "deflex.l" +{ return EXECUTE;} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 52 "deflex.l" +{ return SHARED;} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 53 "deflex.l" +{ return NONSHARED;} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 54 "deflex.l" +{ return SINGLE;} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 55 "deflex.l" +{ return MULTIPLE;} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 56 "deflex.l" +{ return INITINSTANCE;} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 57 "deflex.l" +{ return INITGLOBAL;} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 58 "deflex.l" +{ return TERMINSTANCE;} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 59 "deflex.l" +{ return TERMGLOBAL;} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 61 "deflex.l" +{ yylval.number = strtol (yytext,0,0); + return NUMBER; } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 64 "deflex.l" +{ + yylval.id = xstrdup (yytext); + return ID; + } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 69 "deflex.l" +{ + yylval.id = xstrdup (yytext+1); + yylval.id[yyleng-2] = 0; + return ID; + } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 75 "deflex.l" +{ + yylval.id = xstrdup (yytext+1); + yylval.id[yyleng-2] = 0; + return ID; + } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 80 "deflex.l" +{ } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 81 "deflex.l" +{ } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 82 "deflex.l" +{ } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 83 "deflex.l" +{ } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 84 "deflex.l" +{ linenumber ++ ;} + YY_BREAK +case 36: +YY_RULE_SETUP +#line 85 "deflex.l" +{ return '=';} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 86 "deflex.l" +{ return '.';} + YY_BREAK +case 38: +YY_RULE_SETUP +#line 87 "deflex.l" +{ return '@';} + YY_BREAK +case 39: +YY_RULE_SETUP +#line 88 "deflex.l" +{ return ',';} + YY_BREAK +case 40: +YY_RULE_SETUP +#line 89 "deflex.l" +ECHO; + YY_BREAK +#line 980 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + 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->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 + * 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; + } + + /* 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->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_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, 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->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 yylex */ + + +/* 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() + { + register char *dest = yy_current_buffer->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] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->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->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; + + else + { + int num_to_read = + yy_current_buffer->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; + + 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. */ + yy_flex_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->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_current_buffer->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; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + 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; + + yytext_ptr = &yy_current_buffer->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() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + + 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 >= 197 ) + 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 ); + */ + +#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 + { + 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 >= 197 ) + 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 == 196); + + 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; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->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 char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->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; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#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->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. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + 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 yytext */ + yy_hold_char = *++yy_c_buf_p; + + + return c; + } + + +#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 ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_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 ) + return; + + 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_current_buffer = new_buffer; + yy_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 + * 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; + } + + +#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 + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_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 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_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 + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +#ifndef _WIN32 +#include +#else +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif +#endif + +#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 + + + { + yy_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 + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + 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 ) + yy_load_buffer_state(); + } + + +#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; + + 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 ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_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; + + yy_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 + + +#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 + { + 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 ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_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; + } +#endif + + +#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; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (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 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 ) + + +/* 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 + { + 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 + { + 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 + { + 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 + { + /* 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 ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 89 "deflex.l" + +#ifndef yywrap +/* Needed for lex, though not flex. */ +int yywrap(void) { return 1; } +#endif diff --git a/binutils/defparse.c b/binutils/defparse.c index f51ee33cd9e50..7cd3a253139ae 100644 --- a/binutils/defparse.c +++ b/binutils/defparse.c @@ -22,41 +22,43 @@ # define SHARED 273 # define NONSHARED 274 # define NONAME 275 -# define SINGLE 276 -# define MULTIPLE 277 -# define INITINSTANCE 278 -# define INITGLOBAL 279 -# define TERMINSTANCE 280 -# define TERMGLOBAL 281 -# define ID 282 -# define NUMBER 283 +# define PRIVATE 276 +# define SINGLE 277 +# define MULTIPLE 278 +# define INITINSTANCE 279 +# define INITGLOBAL 280 +# define TERMINSTANCE 281 +# define TERMGLOBAL 282 +# define ID 283 +# define NUMBER 284 #line 1 "defparse.y" /* defparse.y - parser for .def files */ -/* Copyright 1995, 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright 1995, 1997, 1998, 1999, 2004 + Free Software Foundation, Inc. -This file is part of GNU Binutils. + This file is part of GNU Binutils. -This program is free software; 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 free software; 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. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "bucomm.h" #include "dlltool.h" -#line 26 "defparse.y" +#line 27 "defparse.y" #ifndef YYSTYPE typedef union { char *id; @@ -71,12 +73,12 @@ typedef union { -#define YYFINAL 96 +#define YYFINAL 98 #define YYFLAG -32768 -#define YYNTBASE 34 +#define YYNTBASE 35 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ -#define YYTRANSLATE(x) ((unsigned)(x) <= 283 ? yytranslate[x] : 55) +#define YYTRANSLATE(x) ((unsigned)(x) <= 284 ? yytranslate[x] : 57) /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ static const char yytranslate[] = @@ -85,9 +87,9 @@ static const char yytranslate[] = 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, 32, 2, 30, 2, 2, 2, + 2, 2, 2, 2, 33, 2, 31, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 31, 2, 2, 33, 2, 2, 2, 2, 2, + 2, 32, 2, 2, 34, 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, @@ -109,42 +111,42 @@ static const char yytranslate[] = 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29 + 26, 27, 28, 29, 30 }; #if YYDEBUG static const short yyprhs[] = { 0, 0, 3, 5, 9, 14, 17, 20, 24, 28, - 31, 34, 37, 40, 43, 48, 49, 52, 59, 62, - 64, 72, 80, 86, 92, 98, 104, 108, 112, 115, - 117, 120, 124, 126, 128, 129, 132, 133, 135, 137, - 139, 141, 143, 145, 147, 149, 150, 152, 153, 155, - 156, 158, 162, 163, 166, 167, 170, 175, 176, 180, - 181, 182, 186, 188, 190, 192 + 31, 34, 37, 40, 43, 48, 49, 52, 60, 63, + 65, 73, 81, 87, 93, 99, 105, 109, 113, 116, + 118, 121, 125, 127, 129, 130, 133, 134, 136, 138, + 140, 142, 144, 146, 148, 150, 151, 153, 154, 156, + 157, 159, 160, 162, 166, 167, 170, 171, 174, 179, + 180, 184, 185, 186, 190, 192, 194, 196 }; static const short yyrhs[] = { - 34, 35, 0, 35, 0, 3, 49, 52, 0, 4, - 49, 52, 53, 0, 11, 36, 0, 5, 28, 0, - 6, 29, 44, 0, 7, 29, 44, 0, 8, 42, - 0, 9, 42, 0, 10, 40, 0, 12, 38, 0, - 13, 29, 0, 13, 29, 30, 29, 0, 0, 36, - 37, 0, 28, 51, 50, 47, 46, 48, 0, 38, - 39, 0, 39, 0, 28, 31, 28, 30, 28, 30, - 28, 0, 28, 31, 28, 30, 28, 30, 29, 0, - 28, 31, 28, 30, 28, 0, 28, 31, 28, 30, - 29, 0, 28, 30, 28, 30, 28, 0, 28, 30, - 28, 30, 29, 0, 28, 30, 28, 0, 28, 30, - 29, 0, 40, 41, 0, 41, 0, 28, 42, 0, - 42, 43, 45, 0, 45, 0, 32, 0, 0, 32, - 29, 0, 0, 16, 0, 17, 0, 18, 0, 19, - 0, 20, 0, 22, 0, 23, 0, 15, 0, 0, - 21, 0, 0, 9, 0, 0, 28, 0, 28, 30, - 28, 0, 0, 33, 29, 0, 0, 31, 28, 0, - 31, 28, 30, 28, 0, 0, 14, 31, 29, 0, - 0, 0, 53, 43, 54, 0, 24, 0, 25, 0, - 26, 0, 27, 0 + 35, 36, 0, 36, 0, 3, 51, 54, 0, 4, + 51, 54, 55, 0, 11, 37, 0, 5, 29, 0, + 6, 30, 45, 0, 7, 30, 45, 0, 8, 43, + 0, 9, 43, 0, 10, 41, 0, 12, 39, 0, + 13, 30, 0, 13, 30, 31, 30, 0, 0, 37, + 38, 0, 29, 53, 52, 48, 47, 49, 50, 0, + 39, 40, 0, 40, 0, 29, 32, 29, 31, 29, + 31, 29, 0, 29, 32, 29, 31, 29, 31, 30, + 0, 29, 32, 29, 31, 29, 0, 29, 32, 29, + 31, 30, 0, 29, 31, 29, 31, 29, 0, 29, + 31, 29, 31, 30, 0, 29, 31, 29, 0, 29, + 31, 30, 0, 41, 42, 0, 42, 0, 29, 43, + 0, 43, 44, 46, 0, 46, 0, 33, 0, 0, + 33, 30, 0, 0, 16, 0, 17, 0, 18, 0, + 19, 0, 20, 0, 23, 0, 24, 0, 15, 0, + 0, 21, 0, 0, 9, 0, 0, 22, 0, 0, + 29, 0, 29, 31, 29, 0, 0, 34, 30, 0, + 0, 32, 29, 0, 32, 29, 31, 29, 0, 0, + 14, 32, 30, 0, 0, 0, 55, 44, 56, 0, + 25, 0, 26, 0, 27, 0, 28, 0 }; #endif @@ -153,13 +155,13 @@ static const short yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { - 0, 43, 44, 47, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 63, 65, 68, 72, 74, - 77, 79, 80, 81, 82, 83, 84, 85, 88, 90, - 93, 97, 99, 102, 104, 106, 107, 110, 112, 113, - 114, 115, 116, 117, 120, 122, 125, 127, 130, 132, - 135, 136, 142, 145, 147, 150, 152, 158, 161, 162, - 165, 167, 170, 172, 173, 174 + 0, 44, 45, 48, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 64, 66, 69, 73, 75, + 78, 80, 81, 82, 83, 84, 85, 86, 89, 91, + 94, 98, 100, 103, 105, 107, 108, 111, 113, 114, + 115, 116, 117, 118, 121, 123, 126, 128, 131, 133, + 136, 138, 141, 142, 148, 151, 153, 156, 158, 164, + 167, 168, 171, 173, 176, 178, 179, 180 }; #endif @@ -172,38 +174,38 @@ static const char *const yytname[] = "$", "error", "$undefined.", "NAME", "LIBRARY", "DESCRIPTION", "STACKSIZE", "HEAPSIZE", "CODE", "DATA", "SECTIONS", "EXPORTS", "IMPORTS", "VERSIONK", "BASE", "CONSTANT", "READ", "WRITE", "EXECUTE", - "SHARED", "NONSHARED", "NONAME", "SINGLE", "MULTIPLE", "INITINSTANCE", - "INITGLOBAL", "TERMINSTANCE", "TERMGLOBAL", "ID", "NUMBER", "'.'", - "'='", "','", "'@'", "start", "command", "explist", "expline", - "implist", "impline", "seclist", "secline", "attr_list", "opt_comma", - "opt_number", "attr", "opt_CONSTANT", "opt_NONAME", "opt_DATA", - "opt_name", "opt_ordinal", "opt_equal_name", "opt_base", "option_list", - "option", 0 + "SHARED", "NONSHARED", "NONAME", "PRIVATE", "SINGLE", "MULTIPLE", + "INITINSTANCE", "INITGLOBAL", "TERMINSTANCE", "TERMGLOBAL", "ID", + "NUMBER", "'.'", "'='", "','", "'@'", "start", "command", "explist", + "expline", "implist", "impline", "seclist", "secline", "attr_list", + "opt_comma", "opt_number", "attr", "opt_CONSTANT", "opt_NONAME", + "opt_DATA", "opt_PRIVATE", "opt_name", "opt_ordinal", "opt_equal_name", + "opt_base", "option_list", "option", 0 }; #endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const short yyr1[] = { - 0, 34, 34, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 36, 36, 37, 38, 38, - 39, 39, 39, 39, 39, 39, 39, 39, 40, 40, - 41, 42, 42, 43, 43, 44, 44, 45, 45, 45, - 45, 45, 45, 45, 46, 46, 47, 47, 48, 48, - 49, 49, 49, 50, 50, 51, 51, 51, 52, 52, - 53, 53, 54, 54, 54, 54 + 0, 35, 35, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 37, 37, 38, 39, 39, + 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, + 42, 43, 43, 44, 44, 45, 45, 46, 46, 46, + 46, 46, 46, 46, 47, 47, 48, 48, 49, 49, + 50, 50, 51, 51, 51, 52, 52, 53, 53, 53, + 54, 54, 55, 55, 56, 56, 56, 56 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const short yyr2[] = { 0, 2, 1, 3, 4, 2, 2, 3, 3, 2, - 2, 2, 2, 2, 4, 0, 2, 6, 2, 1, + 2, 2, 2, 2, 4, 0, 2, 7, 2, 1, 7, 7, 5, 5, 5, 5, 3, 3, 2, 1, 2, 3, 1, 1, 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, - 1, 3, 0, 2, 0, 2, 4, 0, 3, 0, - 0, 3, 1, 1, 1, 1 + 1, 0, 1, 3, 0, 2, 0, 2, 4, 0, + 3, 0, 0, 3, 1, 1, 1, 1 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE @@ -211,81 +213,83 @@ static const short yyr2[] = error. */ static const short yydefact[] = { - 0, 52, 52, 0, 0, 0, 0, 0, 0, 15, - 0, 0, 0, 2, 50, 59, 59, 6, 36, 36, + 0, 54, 54, 0, 0, 0, 0, 0, 0, 15, + 0, 0, 0, 2, 52, 61, 61, 6, 36, 36, 37, 38, 39, 40, 41, 42, 43, 9, 32, 10, 0, 11, 29, 5, 0, 12, 19, 13, 1, 0, - 0, 3, 60, 0, 7, 8, 33, 0, 30, 28, - 57, 16, 0, 0, 18, 0, 51, 0, 4, 35, - 31, 0, 54, 26, 27, 0, 14, 58, 0, 55, - 0, 47, 0, 0, 62, 63, 64, 65, 61, 0, - 53, 46, 45, 24, 25, 22, 23, 56, 44, 49, - 0, 48, 17, 20, 21, 0, 0 + 0, 3, 62, 0, 7, 8, 33, 0, 30, 28, + 59, 16, 0, 0, 18, 0, 53, 0, 4, 35, + 31, 0, 56, 26, 27, 0, 14, 60, 0, 57, + 0, 47, 0, 0, 64, 65, 66, 67, 63, 0, + 55, 46, 45, 24, 25, 22, 23, 58, 44, 49, + 0, 48, 51, 20, 21, 50, 17, 0, 0 }; static const short yydefgoto[] = { 12, 13, 33, 51, 35, 36, 31, 32, 27, 47, - 44, 28, 89, 82, 92, 15, 71, 62, 41, 58, - 78 + 44, 28, 89, 82, 92, 96, 15, 71, 62, 41, + 58, 78 }; static const short yypact[] = { - 32, -22, -22, -19, -13, 22, 30, 30, -6,-32768, - 26, 38, 21,-32768, 29, 46, 46,-32768, 36, 36, + 32, -12, -12, 17, -8, 33, -4, -4, 35,-32768, + 36, 37, 21,-32768, 38, 48, 48,-32768, 39, 39, -32768,-32768,-32768,-32768,-32768,-32768,-32768, -15,-32768, -15, - 30, -6,-32768, 41, -16, 26,-32768, 40,-32768, 43, - 42,-32768,-32768, 45,-32768,-32768,-32768, 30, -15,-32768, - 44,-32768, -9, 48,-32768, 49,-32768, 50, -14,-32768, - -32768, 52, 39, 47,-32768, 51,-32768,-32768, 31, 53, - 55, 61, 33, 35,-32768,-32768,-32768,-32768,-32768, 57, - -32768,-32768, 71,-32768,-32768, 58,-32768,-32768,-32768, 78, - 37,-32768,-32768,-32768,-32768, 89,-32768 + -4, 35,-32768, 41, -25, 36,-32768, 40,-32768, 44, + 34,-32768,-32768, 45,-32768,-32768,-32768, -4, -15,-32768, + 42,-32768, -19, 47,-32768, 49,-32768, 50, 22,-32768, + -32768, 52, 43, 51,-32768, 53,-32768,-32768, 26, 54, + 56, 57, 27, 29,-32768,-32768,-32768,-32768,-32768, 58, + -32768,-32768, 68,-32768,-32768, 59,-32768,-32768,-32768, 79, + 31,-32768, 46,-32768,-32768,-32768,-32768, 89,-32768 }; static const short yypgoto[] = { - -32768, 79,-32768,-32768,-32768, 59,-32768, 62, -7, 34, - 76, 54,-32768,-32768,-32768, 88,-32768,-32768, 80,-32768, - -32768 + -32768, 80,-32768,-32768,-32768, 60,-32768, 62, -7, 55, + 72, 61,-32768,-32768,-32768,-32768, 92,-32768,-32768, 81, + -32768,-32768 }; -#define YYLAST 101 +#define YYLAST 113 static const short yytable[] = { - 29, -34, -34, -34, -34, -34, 14, -34, -34, 17, - -34, -34, -34, -34, 52, 53, 18, 46, 46, 63, - 64, 95, 30, 48, 1, 2, 3, 4, 5, 6, + 29, -34, -34, -34, -34, -34, 52, 53, -34, -34, + 63, 64, 20, 21, 22, 23, 24, 14, 46, 25, + 26, 97, 18, 48, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 20, 21, 22, 23, - 24, 19, 25, 26, 34, 74, 75, 76, 77, 39, - 40, 83, 84, 85, 86, 93, 94, 37, 43, 50, - 55, 56, 70, 57, 59, 61, 65, 72, 66, 67, - 69, 73, 81, 79, 80, 87, 88, 91, 90, 96, - 16, 38, 68, 49, 54, 45, 42, 0, 0, 0, - 0, 60 + 6, 7, 8, 9, 10, 11, 17, -34, -34, -34, + -34, 74, 75, 76, 77, 46, 83, 84, 85, 86, + 93, 94, 40, 19, 30, 34, 57, 37, 95, 39, + 50, 55, 43, 56, 61, 59, 65, 70, 81, 66, + 67, 69, 72, 88, 73, 79, 80, 87, 91, 98, + 90, 45, 38, 49, 16, 54, 0, 42, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, + 0, 0, 0, 68 }; static const short yycheck[] = { - 7, 16, 17, 18, 19, 20, 28, 22, 23, 28, - 24, 25, 26, 27, 30, 31, 29, 32, 32, 28, - 29, 0, 28, 30, 3, 4, 5, 6, 7, 8, + 7, 16, 17, 18, 19, 20, 31, 32, 23, 24, + 29, 30, 16, 17, 18, 19, 20, 29, 33, 23, + 24, 0, 30, 30, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, - 20, 29, 22, 23, 28, 24, 25, 26, 27, 30, - 14, 28, 29, 28, 29, 28, 29, 29, 32, 28, - 30, 28, 33, 31, 29, 31, 28, 30, 29, 29, - 28, 30, 21, 30, 29, 28, 15, 9, 30, 0, - 2, 12, 58, 31, 35, 19, 16, -1, -1, -1, - -1, 47 + 8, 9, 10, 11, 12, 13, 29, 25, 26, 27, + 28, 25, 26, 27, 28, 33, 29, 30, 29, 30, + 29, 30, 14, 30, 29, 29, 32, 30, 22, 31, + 29, 31, 33, 29, 32, 30, 29, 34, 21, 30, + 30, 29, 31, 15, 31, 31, 30, 29, 9, 0, + 31, 19, 12, 31, 2, 35, -1, 16, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 47, -1, + -1, -1, -1, 58 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/bison/bison.simple" +#line 3 "/usr/share/bison-1.35/bison.simple" /* Skeleton output parser for bison, @@ -598,7 +602,7 @@ yystpcpy (yydest, yysrc) # endif #endif -#line 315 "/usr/share/bison/bison.simple" +#line 315 "/usr/share/bison-1.35/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed @@ -992,192 +996,200 @@ yyreduce: switch (yyn) { case 3: -#line 48 "defparse.y" +#line 49 "defparse.y" { def_name (yyvsp[-1].id, yyvsp[0].number); } break; case 4: -#line 49 "defparse.y" +#line 50 "defparse.y" { def_library (yyvsp[-2].id, yyvsp[-1].number); } break; case 6: -#line 51 "defparse.y" +#line 52 "defparse.y" { def_description (yyvsp[0].id);} break; case 7: -#line 52 "defparse.y" +#line 53 "defparse.y" { def_stacksize (yyvsp[-1].number, yyvsp[0].number);} break; case 8: -#line 53 "defparse.y" +#line 54 "defparse.y" { def_heapsize (yyvsp[-1].number, yyvsp[0].number);} break; case 9: -#line 54 "defparse.y" +#line 55 "defparse.y" { def_code (yyvsp[0].number);} break; case 10: -#line 55 "defparse.y" +#line 56 "defparse.y" { def_data (yyvsp[0].number);} break; case 13: -#line 58 "defparse.y" +#line 59 "defparse.y" { def_version (yyvsp[0].number,0);} break; case 14: -#line 59 "defparse.y" +#line 60 "defparse.y" { def_version (yyvsp[-2].number,yyvsp[0].number);} break; case 17: -#line 70 "defparse.y" -{ def_exports (yyvsp[-5].id, yyvsp[-4].id, yyvsp[-3].number, yyvsp[-2].number, yyvsp[-1].number, yyvsp[0].number);} +#line 71 "defparse.y" +{ def_exports (yyvsp[-6].id, yyvsp[-5].id, yyvsp[-4].number, yyvsp[-3].number, yyvsp[-2].number, yyvsp[-1].number, yyvsp[0].number);} break; case 20: -#line 78 "defparse.y" +#line 79 "defparse.y" { def_import (yyvsp[-6].id,yyvsp[-4].id,yyvsp[-2].id,yyvsp[0].id, 0); } break; case 21: -#line 79 "defparse.y" +#line 80 "defparse.y" { def_import (yyvsp[-6].id,yyvsp[-4].id,yyvsp[-2].id, 0,yyvsp[0].number); } break; case 22: -#line 80 "defparse.y" +#line 81 "defparse.y" { def_import (yyvsp[-4].id,yyvsp[-2].id, 0,yyvsp[0].id, 0); } break; case 23: -#line 81 "defparse.y" +#line 82 "defparse.y" { def_import (yyvsp[-4].id,yyvsp[-2].id, 0, 0,yyvsp[0].number); } break; case 24: -#line 82 "defparse.y" +#line 83 "defparse.y" { def_import ( 0,yyvsp[-4].id,yyvsp[-2].id,yyvsp[0].id, 0); } break; case 25: -#line 83 "defparse.y" +#line 84 "defparse.y" { def_import ( 0,yyvsp[-4].id,yyvsp[-2].id, 0,yyvsp[0].number); } break; case 26: -#line 84 "defparse.y" +#line 85 "defparse.y" { def_import ( 0,yyvsp[-2].id, 0,yyvsp[0].id, 0); } break; case 27: -#line 85 "defparse.y" +#line 86 "defparse.y" { def_import ( 0,yyvsp[-2].id, 0, 0,yyvsp[0].number); } break; case 30: -#line 94 "defparse.y" +#line 95 "defparse.y" { def_section (yyvsp[-1].id,yyvsp[0].number);} break; case 35: -#line 106 "defparse.y" +#line 107 "defparse.y" { yyval.number=yyvsp[0].number;} break; case 36: -#line 107 "defparse.y" +#line 108 "defparse.y" { yyval.number=-1;} break; case 37: -#line 111 "defparse.y" +#line 112 "defparse.y" { yyval.number = 1; } break; case 38: -#line 112 "defparse.y" +#line 113 "defparse.y" { yyval.number = 2; } break; case 39: -#line 113 "defparse.y" +#line 114 "defparse.y" { yyval.number = 4; } break; case 40: -#line 114 "defparse.y" +#line 115 "defparse.y" { yyval.number = 8; } break; case 41: -#line 115 "defparse.y" +#line 116 "defparse.y" { yyval.number = 0; } break; case 42: -#line 116 "defparse.y" +#line 117 "defparse.y" { yyval.number = 0; } break; case 43: -#line 117 "defparse.y" +#line 118 "defparse.y" { yyval.number = 0; } break; case 44: -#line 121 "defparse.y" +#line 122 "defparse.y" {yyval.number=1;} break; case 45: -#line 122 "defparse.y" +#line 123 "defparse.y" {yyval.number=0;} break; case 46: -#line 126 "defparse.y" +#line 127 "defparse.y" {yyval.number=1;} break; case 47: -#line 127 "defparse.y" +#line 128 "defparse.y" {yyval.number=0;} break; case 48: -#line 131 "defparse.y" +#line 132 "defparse.y" { yyval.number = 1; } break; case 49: -#line 132 "defparse.y" +#line 133 "defparse.y" { yyval.number = 0; } break; case 50: -#line 135 "defparse.y" -{ yyval.id =yyvsp[0].id; } +#line 137 "defparse.y" +{ yyval.number = 1; } break; case 51: -#line 137 "defparse.y" +#line 138 "defparse.y" +{ yyval.number = 0; } + break; +case 52: +#line 141 "defparse.y" +{ yyval.id =yyvsp[0].id; } + break; +case 53: +#line 143 "defparse.y" { char *name = xmalloc (strlen (yyvsp[-2].id) + 1 + strlen (yyvsp[0].id) + 1); sprintf (name, "%s.%s", yyvsp[-2].id, yyvsp[0].id); yyval.id = name; } break; -case 52: -#line 142 "defparse.y" +case 54: +#line 148 "defparse.y" { yyval.id=""; } break; -case 53: -#line 146 "defparse.y" +case 55: +#line 152 "defparse.y" { yyval.number=yyvsp[0].number;} break; -case 54: -#line 147 "defparse.y" +case 56: +#line 153 "defparse.y" { yyval.number=-1;} break; -case 55: -#line 151 "defparse.y" +case 57: +#line 157 "defparse.y" { yyval.id = yyvsp[0].id; } break; -case 56: -#line 153 "defparse.y" +case 58: +#line 159 "defparse.y" { char *name = xmalloc (strlen (yyvsp[-2].id) + 1 + strlen (yyvsp[0].id) + 1); sprintf (name, "%s.%s", yyvsp[-2].id, yyvsp[0].id); yyval.id = name; } break; -case 57: -#line 158 "defparse.y" +case 59: +#line 164 "defparse.y" { yyval.id = 0; } break; -case 58: -#line 161 "defparse.y" +case 60: +#line 167 "defparse.y" { yyval.number= yyvsp[0].number;} break; -case 59: -#line 162 "defparse.y" +case 61: +#line 168 "defparse.y" { yyval.number=-1;} break; } -#line 705 "/usr/share/bison/bison.simple" +#line 705 "/usr/share/bison-1.35/bison.simple" yyvsp -= yylen; @@ -1408,4 +1420,4 @@ yyreturn: #endif return yyresult; } -#line 176 "defparse.y" +#line 182 "defparse.y" diff --git a/binutils/defparse.h b/binutils/defparse.h index ee1465291e44b..71a82752954b4 100644 --- a/binutils/defparse.h +++ b/binutils/defparse.h @@ -28,14 +28,15 @@ typedef union { # define SHARED 273 # define NONSHARED 274 # define NONAME 275 -# define SINGLE 276 -# define MULTIPLE 277 -# define INITINSTANCE 278 -# define INITGLOBAL 279 -# define TERMINSTANCE 280 -# define TERMGLOBAL 281 -# define ID 282 -# define NUMBER 283 +# define PRIVATE 276 +# define SINGLE 277 +# define MULTIPLE 278 +# define INITINSTANCE 279 +# define INITGLOBAL 280 +# define TERMINSTANCE 281 +# define TERMGLOBAL 282 +# define ID 283 +# define NUMBER 284 extern YYSTYPE yylval; diff --git a/binutils/defparse.y b/binutils/defparse.y index d0bccd95a7063..b58aaee7146d1 100644 --- a/binutils/defparse.y +++ b/binutils/defparse.y @@ -1,22 +1,23 @@ %{ /* defparse.y - parser for .def files */ -/* Copyright 1995, 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright 1995, 1997, 1998, 1999, 2004 + Free Software Foundation, Inc. -This file is part of GNU Binutils. + This file is part of GNU Binutils. -This program is free software; 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 free software; 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. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "bucomm.h" @@ -30,11 +31,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ %token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATA %token SECTIONS, EXPORTS, IMPORTS, VERSIONK, BASE, CONSTANT -%token READ WRITE EXECUTE SHARED NONSHARED NONAME +%token READ WRITE EXECUTE SHARED NONSHARED NONAME PRIVATE %token SINGLE MULTIPLE INITINSTANCE INITGLOBAL TERMINSTANCE TERMGLOBAL %token ID %token NUMBER -%type opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA +%type opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA opt_PRIVATE %type attr attr_list opt_number %type opt_name opt_equal_name @@ -66,8 +67,8 @@ explist: ; expline: - ID opt_equal_name opt_ordinal opt_NONAME opt_CONSTANT opt_DATA - { def_exports ($1, $2, $3, $4, $5, $6);} + ID opt_equal_name opt_ordinal opt_NONAME opt_CONSTANT opt_DATA opt_PRIVATE + { def_exports ($1, $2, $3, $4, $5, $6, $7);} ; implist: implist impline @@ -132,6 +133,11 @@ opt_DATA: | { $$ = 0; } ; +opt_PRIVATE: + PRIVATE { $$ = 1; } + | { $$ = 0; } + ; + opt_name: ID { $$ =$1; } | ID '.' ID { diff --git a/binutils/doc/binutils.info b/binutils/doc/binutils.info new file mode 100644 index 0000000000000..9a2e8e25ac633 --- /dev/null +++ b/binutils/doc/binutils.info @@ -0,0 +1,3584 @@ +This is binutils.info, produced by makeinfo version 4.6 from +binutils.texi. + +START-INFO-DIR-ENTRY +* Binutils: (binutils). The GNU binary utilities. +* ar: (binutils)ar. Create, modify, and extract from archives +* nm: (binutils)nm. List symbols from object files +* objcopy: (binutils)objcopy. Copy and translate object files +* objdump: (binutils)objdump. Display information from object files +* ranlib: (binutils)ranlib. Generate index to archive contents +* readelf: (binutils)readelf. Display the contents of ELF format files. +* size: (binutils)size. List section sizes and total size +* strings: (binutils)strings. List printable strings from files +* strip: (binutils)strip. Discard symbols +* c++filt: (binutils)c++filt. Filter to demangle encoded C++ symbols +* cxxfilt: (binutils)c++filt. MS-DOS name for c++filt +* addr2line: (binutils)addr2line. Convert addresses to file and line +* nlmconv: (binutils)nlmconv. Converts object code into an NLM +* windres: (binutils)windres. Manipulate Windows resources +* dlltool: (binutils)dlltool. Create files needed to build and use DLLs +END-INFO-DIR-ENTRY + + Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, +2002, 2003 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the section entitled "GNU +Free Documentation License". + + +File: binutils.info, Node: Top, Next: ar, Up: (dir) + +Introduction +************ + +This brief manual contains documentation for the GNU binary utilities +(collectively version 2.15): + + This document is distributed under the terms of the GNU Free +Documentation License. A copy of the license is included in the +section entitled "GNU Free Documentation License". + +* Menu: + +* ar:: Create, modify, and extract from archives +* nm:: List symbols from object files +* objcopy:: Copy and translate object files +* objdump:: Display information from object files +* ranlib:: Generate index to archive contents +* readelf:: Display the contents of ELF format files. +* size:: List section sizes and total size +* strings:: List printable strings from files +* strip:: Discard symbols +* c++filt:: Filter to demangle encoded C++ symbols +* cxxfilt: c++filt. MS-DOS name for c++filt +* addr2line:: Convert addresses to file and line +* nlmconv:: Converts object code into an NLM +* windres:: Manipulate Windows resources +* dlltool:: Create files needed to build and use DLLs +* Selecting The Target System:: How these utilities determine the target. +* Reporting Bugs:: Reporting Bugs +* GNU Free Documentation License:: GNU Free Documentation License +* Index:: Index + + +File: binutils.info, Node: ar, Next: nm, Prev: Top, Up: Top + +ar +** + + ar [-]P[MOD [RELPOS] [COUNT]] ARCHIVE [MEMBER...] + ar -M [ '), and continues executing even after errors. If you +redirect standard input to a script file, no prompts are issued, and +`ar' abandons execution (with a nonzero exit code) on any error. + + The `ar' command language is _not_ designed to be equivalent to the +command-line options; in fact, it provides somewhat less control over +archives. The only purpose of the command language is to ease the +transition to GNU `ar' for developers who already have scripts written +for the MRI "librarian" program. + + The syntax for the `ar' command language is straightforward: + * commands are recognized in upper or lower case; for example, `LIST' + is the same as `list'. In the following descriptions, commands are + shown in upper case for clarity. + + * a single command may appear on each line; it is the first word on + the line. + + * empty lines are allowed, and have no effect. + + * comments are allowed; text after either of the characters `*' or + `;' is ignored. + + * Whenever you use a list of names as part of the argument to an `ar' + command, you can separate the individual names with either commas + or blanks. Commas are shown in the explanations below, for + clarity. + + * `+' is used as a line continuation character; if `+' appears at + the end of a line, the text on the following line is considered + part of the current command. + + Here are the commands you can use in `ar' scripts, or when using +`ar' interactively. Three of them have special significance: + + `OPEN' or `CREATE' specify a "current archive", which is a temporary +file required for most of the other commands. + + `SAVE' commits the changes so far specified by the script. Prior to +`SAVE', commands affect only the temporary copy of the current archive. + +`ADDLIB ARCHIVE' +`ADDLIB ARCHIVE (MODULE, MODULE, ... MODULE)' + Add all the contents of ARCHIVE (or, if specified, each named + MODULE from ARCHIVE) to the current archive. + + Requires prior use of `OPEN' or `CREATE'. + +`ADDMOD MEMBER, MEMBER, ... MEMBER' + Add each named MEMBER as a module in the current archive. + + Requires prior use of `OPEN' or `CREATE'. + +`CLEAR' + Discard the contents of the current archive, canceling the effect + of any operations since the last `SAVE'. May be executed (with no + effect) even if no current archive is specified. + +`CREATE ARCHIVE' + Creates an archive, and makes it the current archive (required for + many other commands). The new archive is created with a temporary + name; it is not actually saved as ARCHIVE until you use `SAVE'. + You can overwrite existing archives; similarly, the contents of any + existing file named ARCHIVE will not be destroyed until `SAVE'. + +`DELETE MODULE, MODULE, ... MODULE' + Delete each listed MODULE from the current archive; equivalent to + `ar -d ARCHIVE MODULE ... MODULE'. + + Requires prior use of `OPEN' or `CREATE'. + +`DIRECTORY ARCHIVE (MODULE, ... MODULE)' +`DIRECTORY ARCHIVE (MODULE, ... MODULE) OUTPUTFILE' + List each named MODULE present in ARCHIVE. The separate command + `VERBOSE' specifies the form of the output: when verbose output is + off, output is like that of `ar -t ARCHIVE MODULE...'. When + verbose output is on, the listing is like `ar -tv ARCHIVE + MODULE...'. + + Output normally goes to the standard output stream; however, if you + specify OUTPUTFILE as a final argument, `ar' directs the output to + that file. + +`END' + Exit from `ar', with a `0' exit code to indicate successful + completion. This command does not save the output file; if you + have changed the current archive since the last `SAVE' command, + those changes are lost. + +`EXTRACT MODULE, MODULE, ... MODULE' + Extract each named MODULE from the current archive, writing them + into the current directory as separate files. Equivalent to `ar -x + ARCHIVE MODULE...'. + + Requires prior use of `OPEN' or `CREATE'. + +`LIST' + Display full contents of the current archive, in "verbose" style + regardless of the state of `VERBOSE'. The effect is like `ar tv + ARCHIVE'. (This single command is a GNU `ar' enhancement, rather + than present for MRI compatibility.) + + Requires prior use of `OPEN' or `CREATE'. + +`OPEN ARCHIVE' + Opens an existing archive for use as the current archive (required + for many other commands). Any changes as the result of subsequent + commands will not actually affect ARCHIVE until you next use + `SAVE'. + +`REPLACE MODULE, MODULE, ... MODULE' + In the current archive, replace each existing MODULE (named in the + `REPLACE' arguments) from files in the current working directory. + To execute this command without errors, both the file, and the + module in the current archive, must exist. + + Requires prior use of `OPEN' or `CREATE'. + +`VERBOSE' + Toggle an internal flag governing the output from `DIRECTORY'. + When the flag is on, `DIRECTORY' output matches output from `ar + -tv '.... + +`SAVE' + Commit your changes to the current archive, and actually save it + as a file with the name specified in the last `CREATE' or `OPEN' + command. + + Requires prior use of `OPEN' or `CREATE'. + + + +File: binutils.info, Node: nm, Next: objcopy, Prev: ar, Up: Top + +nm +** + + nm [`-a'|`--debug-syms'] [`-g'|`--extern-only'] + [`-B'] [`-C'|`--demangle'[=STYLE]] [`-D'|`--dynamic'] + [`-S'|`--print-size'] [`-s'|`--print-armap'] + [`-A'|`-o'|`--print-file-name'] + [`-n'|`-v'|`--numeric-sort'] [`-p'|`--no-sort'] + [`-r'|`--reverse-sort'] [`--size-sort'] [`-u'|`--undefined-only'] + [`-t' RADIX|`--radix='RADIX] [`-P'|`--portability'] + [`--target='BFDNAME] [`-f'FORMAT|`--format='FORMAT] + [`--defined-only'] [`-l'|`--line-numbers'] [`--no-demangle'] + [`-V'|`--version'] [`-X 32_64'] [`--help'] [OBJFILE...] + + GNU `nm' lists the symbols from object files OBJFILE.... If no +object files are listed as arguments, `nm' assumes the file `a.out'. + + For each symbol, `nm' shows: + + * The symbol value, in the radix selected by options (see below), or + hexadecimal by default. + + * The symbol type. At least the following types are used; others + are, as well, depending on the object file format. If lowercase, + the symbol is local; if uppercase, the symbol is global (external). + + `A' + The symbol's value is absolute, and will not be changed by + further linking. + + `B' + The symbol is in the uninitialized data section (known as + BSS). + + `C' + The symbol is common. Common symbols are uninitialized data. + When linking, multiple common symbols may appear with the + same name. If the symbol is defined anywhere, the common + symbols are treated as undefined references. For more + details on common symbols, see the discussion of -warn-common + in *Note Linker options: (ld.info)Options. + + `D' + The symbol is in the initialized data section. + + `G' + The symbol is in an initialized data section for small + objects. Some object file formats permit more efficient + access to small data objects, such as a global int variable + as opposed to a large global array. + + `I' + The symbol is an indirect reference to another symbol. This + is a GNU extension to the a.out object file format which is + rarely used. + + `N' + The symbol is a debugging symbol. + + `R' + The symbol is in a read only data section. + + `S' + The symbol is in an uninitialized data section for small + objects. + + `T' + The symbol is in the text (code) section. + + `U' + The symbol is undefined. + + `V' + The symbol is a weak object. When a weak defined symbol is + linked with a normal defined symbol, the normal defined + symbol is used with no error. When a weak undefined symbol + is linked and the symbol is not defined, the value of the + weak symbol becomes zero with no error. + + `W' + The symbol is a weak symbol that has not been specifically + tagged as a weak object symbol. When a weak defined symbol + is linked with a normal defined symbol, the normal defined + symbol is used with no error. When a weak undefined symbol + is linked and the symbol is not defined, the value of the + weak symbol becomes zero with no error. + + `-' + The symbol is a stabs symbol in an a.out object file. In + this case, the next values printed are the stabs other field, + the stabs desc field, and the stab type. Stabs symbols are + used to hold debugging information. For more information, + see *Note Stabs: (stabs.info)Top. + + `?' + The symbol type is unknown, or object file format specific. + + * The symbol name. + + The long and short forms of options, shown here as alternatives, are +equivalent. + +`-A' +`-o' +`--print-file-name' + Precede each symbol by the name of the input file (or archive + member) in which it was found, rather than identifying the input + file once only, before all of its symbols. + +`-a' +`--debug-syms' + Display all symbols, even debugger-only symbols; normally these + are not listed. + +`-B' + The same as `--format=bsd' (for compatibility with the MIPS `nm'). + +`-C' +`--demangle[=STYLE]' + Decode ("demangle") low-level symbol names into user-level names. + Besides removing any initial underscore prepended by the system, + this makes C++ function names readable. Different compilers have + different mangling styles. The optional demangling style argument + can be used to choose an appropriate demangling style for your + compiler. *Note c++filt::, for more information on demangling. + +`--no-demangle' + Do not demangle low-level symbol names. This is the default. + +`-D' +`--dynamic' + Display the dynamic symbols rather than the normal symbols. This + is only meaningful for dynamic objects, such as certain types of + shared libraries. + +`-f FORMAT' +`--format=FORMAT' + Use the output format FORMAT, which can be `bsd', `sysv', or + `posix'. The default is `bsd'. Only the first character of + FORMAT is significant; it can be either upper or lower case. + +`-g' +`--extern-only' + Display only external symbols. + +`-l' +`--line-numbers' + For each symbol, use debugging information to try to find a + filename and line number. For a defined symbol, look for the line + number of the address of the symbol. For an undefined symbol, + look for the line number of a relocation entry which refers to the + symbol. If line number information can be found, print it after + the other symbol information. + +`-n' +`-v' +`--numeric-sort' + Sort symbols numerically by their addresses, rather than + alphabetically by their names. + +`-p' +`--no-sort' + Do not bother to sort the symbols in any order; print them in the + order encountered. + +`-P' +`--portability' + Use the POSIX.2 standard output format instead of the default + format. Equivalent to `-f posix'. + +`-S' +`--print-size' + Print size, not the value, of defined symbols for the `bsd' output + format. + +`-s' +`--print-armap' + When listing symbols from archive members, include the index: a + mapping (stored in the archive by `ar' or `ranlib') of which + modules contain definitions for which names. + +`-r' +`--reverse-sort' + Reverse the order of the sort (whether numeric or alphabetic); let + the last come first. + +`--size-sort' + Sort symbols by size. The size is computed as the difference + between the value of the symbol and the value of the symbol with + the next higher value. If the `bsd' output format is used the + size of the symbol is printed, rather than the value, and `-S' + must be used in order both size and value to be printed. + +`-t RADIX' +`--radix=RADIX' + Use RADIX as the radix for printing the symbol values. It must be + `d' for decimal, `o' for octal, or `x' for hexadecimal. + +`--target=BFDNAME' + Specify an object code format other than your system's default + format. *Note Target Selection::, for more information. + +`-u' +`--undefined-only' + Display only undefined symbols (those external to each object + file). + +`--defined-only' + Display only defined symbols for each object file. + +`-V' +`--version' + Show the version number of `nm' and exit. + +`-X' + This option is ignored for compatibility with the AIX version of + `nm'. It takes one parameter which must be the string `32_64'. + The default mode of AIX `nm' corresponds to `-X 32', which is not + supported by GNU `nm'. + +`--help' + Show a summary of the options to `nm' and exit. + + +File: binutils.info, Node: objcopy, Next: objdump, Prev: nm, Up: Top + +objcopy +******* + + objcopy [`-F' BFDNAME|`--target='BFDNAME] + [`-I' BFDNAME|`--input-target='BFDNAME] + [`-O' BFDNAME|`--output-target='BFDNAME] + [`-B' BFDARCH|`--binary-architecture='BFDARCH] + [`-S'|`--strip-all'] + [`-g'|`--strip-debug'] + [`-K' SYMBOLNAME|`--keep-symbol='SYMBOLNAME] + [`-N' SYMBOLNAME|`--strip-symbol='SYMBOLNAME] + [`-G' SYMBOLNAME|`--keep-global-symbol='SYMBOLNAME] + [`-L' SYMBOLNAME|`--localize-symbol='SYMBOLNAME] + [`-W' SYMBOLNAME|`--weaken-symbol='SYMBOLNAME] + [`-w'|`--wildcard'] + [`-x'|`--discard-all'] + [`-X'|`--discard-locals'] + [`-b' BYTE|`--byte='BYTE] + [`-i' INTERLEAVE|`--interleave='INTERLEAVE] + [`-j' SECTIONNAME|`--only-section='SECTIONNAME] + [`-R' SECTIONNAME|`--remove-section='SECTIONNAME] + [`-p'|`--preserve-dates'] + [`--debugging'] + [`--gap-fill='VAL] + [`--pad-to='ADDRESS] + [`--set-start='VAL] + [`--adjust-start='INCR] + [`--change-addresses='INCR] + [`--change-section-address' SECTION{=,+,-}VAL] + [`--change-section-lma' SECTION{=,+,-}VAL] + [`--change-section-vma' SECTION{=,+,-}VAL] + [`--change-warnings'] [`--no-change-warnings'] + [`--set-section-flags' SECTION=FLAGS] + [`--add-section' SECTIONNAME=FILENAME] + [`--rename-section' OLDNAME=NEWNAME[,FLAGS]] + [`--change-leading-char'] [`--remove-leading-char'] + [`--srec-len='IVAL] [`--srec-forceS3'] + [`--redefine-sym' OLD=NEW] + [`--redefine-syms='FILENAME] + [`--weaken'] + [`--keep-symbols='FILENAME] + [`--strip-symbols='FILENAME] + [`--keep-global-symbols='FILENAME] + [`--localize-symbols='FILENAME] + [`--weaken-symbols='FILENAME] + [`--alt-machine-code='INDEX] + [`--prefix-symbols='STRING] + [`--prefix-sections='STRING] + [`--prefix-alloc-sections='STRING] + [`--add-gnu-debuglink='PATH-TO-FILE] + [`--only-keep-debug'] + [`--writable-text'] + [`--readonly-text'] + [`--pure'] + [`--impure'] + [`-v'|`--verbose'] + [`-V'|`--version'] + [`--help'] [`--info'] + INFILE [OUTFILE] + + The GNU `objcopy' utility copies the contents of an object file to +another. `objcopy' uses the GNU BFD Library to read and write the +object files. It can write the destination object file in a format +different from that of the source object file. The exact behavior of +`objcopy' is controlled by command-line options. Note that `objcopy' +should be able to copy a fully linked file between any two formats. +However, copying a relocatable object file between any two formats may +not work as expected. + + `objcopy' creates temporary files to do its translations and deletes +them afterward. `objcopy' uses BFD to do all its translation work; it +has access to all the formats described in BFD and thus is able to +recognize most formats without being told explicitly. *Note BFD: +(ld.info)BFD. + + `objcopy' can be used to generate S-records by using an output +target of `srec' (e.g., use `-O srec'). + + `objcopy' can be used to generate a raw binary file by using an +output target of `binary' (e.g., use `-O binary'). When `objcopy' +generates a raw binary file, it will essentially produce a memory dump +of the contents of the input object file. All symbols and relocation +information will be discarded. The memory dump will start at the load +address of the lowest section copied into the output file. + + When generating an S-record or a raw binary file, it may be helpful +to use `-S' to remove sections containing debugging information. In +some cases `-R' will be useful to remove sections which contain +information that is not needed by the binary file. + + Note--`objcopy' is not able to change the endianness of its input +files. If the input format has an endianness (some formats do not), +`objcopy' can only copy the inputs into file formats that have the same +endianness or which have no endianness (e.g., `srec'). + +`INFILE' +`OUTFILE' + The input and output files, respectively. If you do not specify + OUTFILE, `objcopy' creates a temporary file and destructively + renames the result with the name of INFILE. + +`-I BFDNAME' +`--input-target=BFDNAME' + Consider the source file's object format to be BFDNAME, rather than + attempting to deduce it. *Note Target Selection::, for more + information. + +`-O BFDNAME' +`--output-target=BFDNAME' + Write the output file using the object format BFDNAME. *Note + Target Selection::, for more information. + +`-F BFDNAME' +`--target=BFDNAME' + Use BFDNAME as the object format for both the input and the output + file; i.e., simply transfer data from source to destination with no + translation. *Note Target Selection::, for more information. + +`-B BFDARCH' +`--binary-architecture=BFDARCH' + Useful when transforming a raw binary input file into an object + file. In this case the output architecture can be set to BFDARCH. + This option will be ignored if the input file has a known BFDARCH. + You can access this binary data inside a program by referencing + the special symbols that are created by the conversion process. + These symbols are called _binary_OBJFILE_start, + _binary_OBJFILE_end and _binary_OBJFILE_size. e.g. you can + transform a picture file into an object file and then access it in + your code using these symbols. + +`-j SECTIONNAME' +`--only-section=SECTIONNAME' + Copy only the named section from the input file to the output file. + This option may be given more than once. Note that using this + option inappropriately may make the output file unusable. + +`-R SECTIONNAME' +`--remove-section=SECTIONNAME' + Remove any section named SECTIONNAME from the output file. This + option may be given more than once. Note that using this option + inappropriately may make the output file unusable. + +`-S' +`--strip-all' + Do not copy relocation and symbol information from the source file. + +`-g' +`--strip-debug' + Do not copy debugging symbols or sections from the source file. + +`--strip-unneeded' + Strip all symbols that are not needed for relocation processing. + +`-K SYMBOLNAME' +`--keep-symbol=SYMBOLNAME' + Copy only symbol SYMBOLNAME from the source file. This option may + be given more than once. + +`-N SYMBOLNAME' +`--strip-symbol=SYMBOLNAME' + Do not copy symbol SYMBOLNAME from the source file. This option + may be given more than once. + +`-G SYMBOLNAME' +`--keep-global-symbol=SYMBOLNAME' + Keep only symbol SYMBOLNAME global. Make all other symbols local + to the file, so that they are not visible externally. This option + may be given more than once. + +`-L SYMBOLNAME' +`--localize-symbol=SYMBOLNAME' + Make symbol SYMBOLNAME local to the file, so that it is not + visible externally. This option may be given more than once. + +`-W SYMBOLNAME' +`--weaken-symbol=SYMBOLNAME' + Make symbol SYMBOLNAME weak. This option may be given more than + once. + +`-w' +`--wildcard' + Permit regular expressions in SYMBOLNAMEs used in other command + line options. The question mark (?), asterisk (*), backslash (\) + and square brackets ([]) operators can be used anywhere in the + symbol name. If the first character of the symbol name is the + exclamation point (!) then the sense of the switch is reversed for + that symbol. For example: + + -w -W !foo -W fo* + + would cause objcopy to weaken all symbols that start with "fo" + except for the symbol "foo". + +`-x' +`--discard-all' + Do not copy non-global symbols from the source file. + +`-X' +`--discard-locals' + Do not copy compiler-generated local symbols. (These usually + start with `L' or `.'.) + +`-b BYTE' +`--byte=BYTE' + Keep only every BYTEth byte of the input file (header data is not + affected). BYTE can be in the range from 0 to INTERLEAVE-1, where + INTERLEAVE is given by the `-i' or `--interleave' option, or the + default of 4. This option is useful for creating files to program + ROM. It is typically used with an `srec' output target. + +`-i INTERLEAVE' +`--interleave=INTERLEAVE' + Only copy one out of every INTERLEAVE bytes. Select which byte to + copy with the `-b' or `--byte' option. The default is 4. + `objcopy' ignores this option if you do not specify either `-b' or + `--byte'. + +`-p' +`--preserve-dates' + Set the access and modification dates of the output file to be the + same as those of the input file. + +`--debugging' + Convert debugging information, if possible. This is not the + default because only certain debugging formats are supported, and + the conversion process can be time consuming. + +`--gap-fill VAL' + Fill gaps between sections with VAL. This operation applies to + the _load address_ (LMA) of the sections. It is done by increasing + the size of the section with the lower address, and filling in the + extra space created with VAL. + +`--pad-to ADDRESS' + Pad the output file up to the load address ADDRESS. This is done + by increasing the size of the last section. The extra space is + filled in with the value specified by `--gap-fill' (default zero). + +`--set-start VAL' + Set the start address of the new file to VAL. Not all object file + formats support setting the start address. + +`--change-start INCR' +`--adjust-start INCR' + Change the start address by adding INCR. Not all object file + formats support setting the start address. + +`--change-addresses INCR' +`--adjust-vma INCR' + Change the VMA and LMA addresses of all sections, as well as the + start address, by adding INCR. Some object file formats do not + permit section addresses to be changed arbitrarily. Note that + this does not relocate the sections; if the program expects + sections to be loaded at a certain address, and this option is + used to change the sections such that they are loaded at a + different address, the program may fail. + +`--change-section-address SECTION{=,+,-}VAL' +`--adjust-section-vma SECTION{=,+,-}VAL' + Set or change both the VMA address and the LMA address of the named + SECTION. If `=' is used, the section address is set to VAL. + Otherwise, VAL is added to or subtracted from the section address. + See the comments under `--change-addresses', above. If SECTION + does not exist in the input file, a warning will be issued, unless + `--no-change-warnings' is used. + +`--change-section-lma SECTION{=,+,-}VAL' + Set or change the LMA address of the named SECTION. The LMA + address is the address where the section will be loaded into + memory at program load time. Normally this is the same as the VMA + address, which is the address of the section at program run time, + but on some systems, especially those where a program is held in + ROM, the two can be different. If `=' is used, the section + address is set to VAL. Otherwise, VAL is added to or subtracted + from the section address. See the comments under + `--change-addresses', above. If SECTION does not exist in the + input file, a warning will be issued, unless + `--no-change-warnings' is used. + +`--change-section-vma SECTION{=,+,-}VAL' + Set or change the VMA address of the named SECTION. The VMA + address is the address where the section will be located once the + program has started executing. Normally this is the same as the + LMA address, which is the address where the section will be loaded + into memory, but on some systems, especially those where a program + is held in ROM, the two can be different. If `=' is used, the + section address is set to VAL. Otherwise, VAL is added to or + subtracted from the section address. See the comments under + `--change-addresses', above. If SECTION does not exist in the + input file, a warning will be issued, unless + `--no-change-warnings' is used. + +`--change-warnings' +`--adjust-warnings' + If `--change-section-address' or `--change-section-lma' or + `--change-section-vma' is used, and the named section does not + exist, issue a warning. This is the default. + +`--no-change-warnings' +`--no-adjust-warnings' + Do not issue a warning if `--change-section-address' or + `--adjust-section-lma' or `--adjust-section-vma' is used, even if + the named section does not exist. + +`--set-section-flags SECTION=FLAGS' + Set the flags for the named section. The FLAGS argument is a + comma separated string of flag names. The recognized names are + `alloc', `contents', `load', `noload', `readonly', `code', `data', + `rom', `share', and `debug'. You can set the `contents' flag for + a section which does not have contents, but it is not meaningful + to clear the `contents' flag of a section which does have + contents-just remove the section instead. Not all flags are + meaningful for all object file formats. + +`--add-section SECTIONNAME=FILENAME' + Add a new section named SECTIONNAME while copying the file. The + contents of the new section are taken from the file FILENAME. The + size of the section will be the size of the file. This option only + works on file formats which can support sections with arbitrary + names. + +`--rename-section OLDNAME=NEWNAME[,FLAGS]' + Rename a section from OLDNAME to NEWNAME, optionally changing the + section's flags to FLAGS in the process. This has the advantage + over usng a linker script to perform the rename in that the output + stays as an object file and does not become a linked executable. + + This option is particularly helpful when the input format is + binary, since this will always create a section called .data. If + for example, you wanted instead to create a section called .rodata + containing binary data you could use the following command line to + achieve it: + + objcopy -I binary -O -B \ + --rename-section .data=.rodata,alloc,load,readonly,data,contents \ + + +`--change-leading-char' + Some object file formats use special characters at the start of + symbols. The most common such character is underscore, which + compilers often add before every symbol. This option tells + `objcopy' to change the leading character of every symbol when it + converts between object file formats. If the object file formats + use the same leading character, this option has no effect. + Otherwise, it will add a character, or remove a character, or + change a character, as appropriate. + +`--remove-leading-char' + If the first character of a global symbol is a special symbol + leading character used by the object file format, remove the + character. The most common symbol leading character is + underscore. This option will remove a leading underscore from all + global symbols. This can be useful if you want to link together + objects of different file formats with different conventions for + symbol names. This is different from `--change-leading-char' + because it always changes the symbol name when appropriate, + regardless of the object file format of the output file. + +`--srec-len=IVAL' + Meaningful only for srec output. Set the maximum length of the + Srecords being produced to IVAL. This length covers both address, + data and crc fields. + +`--srec-forceS3' + Meaningful only for srec output. Avoid generation of S1/S2 + records, creating S3-only record format. + +`--redefine-sym OLD=NEW' + Change the name of a symbol OLD, to NEW. This can be useful when + one is trying link two things together for which you have no + source, and there are name collisions. + +`--redefine-syms=FILENAME' + Apply `--redefine-sym' to each symbol pair "OLD NEW" listed in the + file FILENAME. FILENAME is simply a flat file, with one symbol + pair per line. Line comments may be introduced by the hash + character. This option may be given more than once. + +`--weaken' + Change all global symbols in the file to be weak. This can be + useful when building an object which will be linked against other + objects using the `-R' option to the linker. This option is only + effective when using an object file format which supports weak + symbols. + +`--keep-symbols=FILENAME' + Apply `--keep-symbol' option to each symbol listed in the file + FILENAME. FILENAME is simply a flat file, with one symbol name + per line. Line comments may be introduced by the hash character. + This option may be given more than once. + +`--strip-symbols=FILENAME' + Apply `--strip-symbol' option to each symbol listed in the file + FILENAME. FILENAME is simply a flat file, with one symbol name + per line. Line comments may be introduced by the hash character. + This option may be given more than once. + +`--keep-global-symbols=FILENAME' + Apply `--keep-global-symbol' option to each symbol listed in the + file FILENAME. FILENAME is simply a flat file, with one symbol + name per line. Line comments may be introduced by the hash + character. This option may be given more than once. + +`--localize-symbols=FILENAME' + Apply `--localize-symbol' option to each symbol listed in the file + FILENAME. FILENAME is simply a flat file, with one symbol name + per line. Line comments may be introduced by the hash character. + This option may be given more than once. + +`--weaken-symbols=FILENAME' + Apply `--weaken-symbol' option to each symbol listed in the file + FILENAME. FILENAME is simply a flat file, with one symbol name + per line. Line comments may be introduced by the hash character. + This option may be given more than once. + +`--alt-machine-code=INDEX' + If the output architecture has alternate machine codes, use the + INDEXth code instead of the default one. This is useful in case a + machine is assigned an official code and the tool-chain adopts the + new code, but other applications still depend on the original code + being used. + +`--writable-text' + Mark the output text as writable. This option isn't meaningful + for all object file formats. + +`--readonly-text' + Make the output text write protected. This option isn't + meaningful for all object file formats. + +`--pure' + Mark the output file as demand paged. This option isn't + meaningful for all object file formats. + +`--impure' + Mark the output file as impure. This option isn't meaningful for + all object file formats. + +`--prefix-symbols=STRING' + Prefix all symbols in the output file with STRING. + +`--prefix-sections=STRING' + Prefix all section names in the output file with STRING. + +`--prefix-alloc-sections=STRING' + Prefix all the names of all allocated sections in the output file + with STRING. + +`--add-gnu-debuglink=PATH-TO-FILE' + Creates a .gnu_debuglink section which contains a reference to + PATH-TO-FILE and adds it to the output file. + +`--only-keep-debug' + Strip a file, removing any sections that would be stripped by + `--strip-debug' and leaving the debugging sections. + + The intention is that this option will be used in conjunction with + `--add-gnu-debuglink' to create a two part executable. One a + stripped binary which will occupy less space in RAM and in a + distribution and the second a debugging information file which is + only needed if debugging abilities are required. The suggested + procedure to create these files is as follows: + + 1. Link the executable as normal. Assuming that is is called + `foo' then... + + 2. Run `objcopy --only-keep-debug foo foo.dbg' to create a file + containing the debugging info. + + 3. Run `objcopy --strip-debug foo' to create a stripped + executable. + + 4. Run `objcopy --add-gnu-debuglink=foo.dbg foo' to add a link + to the debugging info into the stripped executable. + + Note - the choice of `.dbg' as an extension for the debug info + file is arbitrary. Also the `--only-keep-debug' step is optional. + You could instead do this: + + 1. Link the executable as normal. + + 2. Copy `foo' to `foo.full' + + 3. Run `objcopy --strip-debug foo' + + 4. Run `objcopy --add-gnu-debuglink=foo.full foo' + + ie the file pointed to by the `--add-gnu-debuglink' can be the + full executable. It does not have to be a file created by the + `--only-keep-debug' switch. + +`-V' +`--version' + Show the version number of `objcopy'. + +`-v' +`--verbose' + Verbose output: list all object files modified. In the case of + archives, `objcopy -V' lists all members of the archive. + +`--help' + Show a summary of the options to `objcopy'. + +`--info' + Display a list showing all architectures and object formats + available. + + +File: binutils.info, Node: objdump, Next: ranlib, Prev: objcopy, Up: Top + +objdump +******* + + objdump [`-a'|`--archive-headers'] + [`-b' BFDNAME|`--target=BFDNAME'] + [`-C'|`--demangle'[=STYLE] ] + [`-d'|`--disassemble'] + [`-D'|`--disassemble-all'] + [`-z'|`--disassemble-zeroes'] + [`-EB'|`-EL'|`--endian='{big | little }] + [`-f'|`--file-headers'] + [`--file-start-context'] + [`-g'|`--debugging'] + [`-e'|`--debugging-tags'] + [`-h'|`--section-headers'|`--headers'] + [`-i'|`--info'] + [`-j' SECTION|`--section='SECTION] + [`-l'|`--line-numbers'] + [`-S'|`--source'] + [`-m' MACHINE|`--architecture='MACHINE] + [`-M' OPTIONS|`--disassembler-options='OPTIONS] + [`-p'|`--private-headers'] + [`-r'|`--reloc'] + [`-R'|`--dynamic-reloc'] + [`-s'|`--full-contents'] + [`-G'|`--stabs'] + [`-t'|`--syms'] + [`-T'|`--dynamic-syms'] + [`-x'|`--all-headers'] + [`-w'|`--wide'] + [`--start-address='ADDRESS] + [`--stop-address='ADDRESS] + [`--prefix-addresses'] + [`--[no-]show-raw-insn'] + [`--adjust-vma='OFFSET] + [`-V'|`--version'] + [`-H'|`--help'] + OBJFILE... + + `objdump' displays information about one or more object files. The +options control what particular information to display. This +information is mostly useful to programmers who are working on the +compilation tools, as opposed to programmers who just want their +program to compile and work. + + OBJFILE... are the object files to be examined. When you specify +archives, `objdump' shows information on each of the member object +files. + + The long and short forms of options, shown here as alternatives, are +equivalent. At least one option from the list +`-a,-d,-D,-e,-f,-g,-G,-h,-H,-p,-r,-R,-s,-S,-t,-T,-V,-x' must be given. + +`-a' +`--archive-header' + If any of the OBJFILE files are archives, display the archive + header information (in a format similar to `ls -l'). Besides the + information you could list with `ar tv', `objdump -a' shows the + object file format of each archive member. + +`--adjust-vma=OFFSET' + When dumping information, first add OFFSET to all the section + addresses. This is useful if the section addresses do not + correspond to the symbol table, which can happen when putting + sections at particular addresses when using a format which can not + represent section addresses, such as a.out. + +`-b BFDNAME' +`--target=BFDNAME' + Specify that the object-code format for the object files is + BFDNAME. This option may not be necessary; OBJDUMP can + automatically recognize many formats. + + For example, + objdump -b oasys -m vax -h fu.o + + displays summary information from the section headers (`-h') of + `fu.o', which is explicitly identified (`-m') as a VAX object file + in the format produced by Oasys compilers. You can list the + formats available with the `-i' option. *Note Target Selection::, + for more information. + +`-C' +`--demangle[=STYLE]' + Decode ("demangle") low-level symbol names into user-level names. + Besides removing any initial underscore prepended by the system, + this makes C++ function names readable. Different compilers have + different mangling styles. The optional demangling style argument + can be used to choose an appropriate demangling style for your + compiler. *Note c++filt::, for more information on demangling. + +`-g' +`--debugging' + Display debugging information. This attempts to parse debugging + information stored in the file and print it out using a C like + syntax. Only certain types of debugging information have been + implemented. Some other types are supported by `readelf -w'. + *Note readelf::. + +`-e' +`--debugging-tags' + Like `-g', but the information is generated in a format compatible + with ctags tool. + +`-d' +`--disassemble' + Display the assembler mnemonics for the machine instructions from + OBJFILE. This option only disassembles those sections which are + expected to contain instructions. + +`-D' +`--disassemble-all' + Like `-d', but disassemble the contents of all sections, not just + those expected to contain instructions. + +`--prefix-addresses' + When disassembling, print the complete address on each line. This + is the older disassembly format. + +`-EB' +`-EL' +`--endian={big|little}' + Specify the endianness of the object files. This only affects + disassembly. This can be useful when disassembling a file format + which does not describe endianness information, such as S-records. + +`-f' +`--file-headers' + Display summary information from the overall header of each of the + OBJFILE files. + +`--file-start-context' + Specify that when displaying interlisted source code/disassembly + (assumes `-S') from a file that has not yet been displayed, extend + the context to the start of the file. + +`-h' +`--section-headers' +`--headers' + Display summary information from the section headers of the object + file. + + File segments may be relocated to nonstandard addresses, for + example by using the `-Ttext', `-Tdata', or `-Tbss' options to + `ld'. However, some object file formats, such as a.out, do not + store the starting address of the file segments. In those + situations, although `ld' relocates the sections correctly, using + `objdump -h' to list the file section headers cannot show the + correct addresses. Instead, it shows the usual addresses, which + are implicit for the target. + +`-H' +`--help' + Print a summary of the options to `objdump' and exit. + +`-i' +`--info' + Display a list showing all architectures and object formats + available for specification with `-b' or `-m'. + +`-j NAME' +`--section=NAME' + Display information only for section NAME. + +`-l' +`--line-numbers' + Label the display (using debugging information) with the filename + and source line numbers corresponding to the object code or relocs + shown. Only useful with `-d', `-D', or `-r'. + +`-m MACHINE' +`--architecture=MACHINE' + Specify the architecture to use when disassembling object files. + This can be useful when disassembling object files which do not + describe architecture information, such as S-records. You can + list the available architectures with the `-i' option. + +`-M OPTIONS' +`--disassembler-options=OPTIONS' + Pass target specific information to the disassembler. Only + supported on some targets. If it is necessary to specify more + than one disassembler option then multiple `-M' options can be + used or can be placed together into a comma separated list. + + If the target is an ARM architecture then this switch can be used + to select which register name set is used during disassembler. + Specifying `-M reg-name-std' (the default) will select the + register names as used in ARM's instruction set documentation, but + with register 13 called 'sp', register 14 called 'lr' and register + 15 called 'pc'. Specifying `-M reg-names-apcs' will select the + name set used by the ARM Procedure Call Standard, whilst + specifying `-M reg-names-raw' will just use `r' followed by the + register number. + + There are also two variants on the APCS register naming scheme + enabled by `-M reg-names-atpcs' and `-M reg-names-special-atpcs' + which use the ARM/Thumb Procedure Call Standard naming + conventions. (Either with the normal register names or the + special register names). + + This option can also be used for ARM architectures to force the + disassembler to interpret all instructions as Thumb instructions by + using the switch `--disassembler-options=force-thumb'. This can be + useful when attempting to disassemble thumb code produced by other + compilers. + + For the x86, some of the options duplicate functions of the `-m' + switch, but allow finer grained control. Multiple selections from + the following may be specified as a comma separated string. + `x86-64', `i386' and `i8086' select disassembly for the given + architecture. `intel' and `att' select between intel syntax mode + and AT&T syntax mode. `addr32', `addr16', `data32' and `data16' + specify the default address size and operand size. These four + options will be overridden if `x86-64', `i386' or `i8086' appear + later in the option string. Lastly, `suffix', when in AT&T mode, + instructs the disassembler to print a mnemonic suffix even when the + suffix could be inferred by the operands. + + For PPC, `booke', `booke32' and `booke64' select disassembly of + BookE instructions. `32' and `64' select PowerPC and PowerPC64 + disassembly, respectively. + + For MIPS, this option controls the printing of register names in + disassembled instructions. Multiple selections from the following + may be specified as a comma separated string, and invalid options + are ignored: + + `gpr-names=ABI' + Print GPR (general-purpose register) names as appropriate for + the specified ABI. By default, GPR names are selected + according to the ABI of the binary being disassembled. + + `fpr-names=ABI' + Print FPR (floating-point register) names as appropriate for + the specified ABI. By default, FPR numbers are printed + rather than names. + + `cp0-names=ARCH' + Print CP0 (system control coprocessor; coprocessor 0) + register names as appropriate for the CPU or architecture + specified by ARCH. By default, CP0 register names are + selected according to the architecture and CPU of the binary + being disassembled. + + `hwr-names=ARCH' + Print HWR (hardware register, used by the `rdhwr' + instruction) names as appropriate for the CPU or architecture + specified by ARCH. By default, HWR names are selected + according to the architecture and CPU of the binary being + disassembled. + + `reg-names=ABI' + Print GPR and FPR names as appropriate for the selected ABI. + + `reg-names=ARCH' + Print CPU-specific register names (CP0 register and HWR names) + as appropriate for the selected CPU or architecture. + + For any of the options listed above, ABI or ARCH may be specified + as `numeric' to have numbers printed rather than names, for the + selected types of registers. You can list the available values of + ABI and ARCH using the `--help' option. + +`-p' +`--private-headers' + Print information that is specific to the object file format. The + exact information printed depends upon the object file format. + For some object file formats, no additional information is printed. + +`-r' +`--reloc' + Print the relocation entries of the file. If used with `-d' or + `-D', the relocations are printed interspersed with the + disassembly. + +`-R' +`--dynamic-reloc' + Print the dynamic relocation entries of the file. This is only + meaningful for dynamic objects, such as certain types of shared + libraries. + +`-s' +`--full-contents' + Display the full contents of any sections requested. By default + all non-empty sections are displayed. + +`-S' +`--source' + Display source code intermixed with disassembly, if possible. + Implies `-d'. + +`--show-raw-insn' + When disassembling instructions, print the instruction in hex as + well as in symbolic form. This is the default except when + `--prefix-addresses' is used. + +`--no-show-raw-insn' + When disassembling instructions, do not print the instruction + bytes. This is the default when `--prefix-addresses' is used. + +`-G' +`--stabs' + Display the full contents of any sections requested. Display the + contents of the .stab and .stab.index and .stab.excl sections from + an ELF file. This is only useful on systems (such as Solaris 2.0) + in which `.stab' debugging symbol-table entries are carried in an + ELF section. In most other file formats, debugging symbol-table + entries are interleaved with linkage symbols, and are visible in + the `--syms' output. For more information on stabs symbols, see + *Note Stabs: (stabs.info)Top. + +`--start-address=ADDRESS' + Start displaying data at the specified address. This affects the + output of the `-d', `-r' and `-s' options. + +`--stop-address=ADDRESS' + Stop displaying data at the specified address. This affects the + output of the `-d', `-r' and `-s' options. + +`-t' +`--syms' + Print the symbol table entries of the file. This is similar to + the information provided by the `nm' program. + +`-T' +`--dynamic-syms' + Print the dynamic symbol table entries of the file. This is only + meaningful for dynamic objects, such as certain types of shared + libraries. This is similar to the information provided by the `nm' + program when given the `-D' (`--dynamic') option. + +`-V' +`--version' + Print the version number of `objdump' and exit. + +`-x' +`--all-headers' + Display all available header information, including the symbol + table and relocation entries. Using `-x' is equivalent to + specifying all of `-a -f -h -r -t'. + +`-w' +`--wide' + Format some lines for output devices that have more than 80 + columns. Also do not truncate symbol names when they are + displayed. + +`-z' +`--disassemble-zeroes' + Normally the disassembly output will skip blocks of zeroes. This + option directs the disassembler to disassemble those blocks, just + like any other data. + + +File: binutils.info, Node: ranlib, Next: readelf, Prev: objdump, Up: Top + +ranlib +****** + + ranlib [`-vV'] ARCHIVE + + `ranlib' generates an index to the contents of an archive and stores +it in the archive. The index lists each symbol defined by a member of +an archive that is a relocatable object file. + + You may use `nm -s' or `nm --print-armap' to list this index. + + An archive with such an index speeds up linking to the library and +allows routines in the library to call each other without regard to +their placement in the archive. + + The GNU `ranlib' program is another form of GNU `ar'; running +`ranlib' is completely equivalent to executing `ar -s'. *Note ar::. + +`-v' +`-V' +`--version' + Show the version number of `ranlib'. + + +File: binutils.info, Node: size, Next: strings, Prev: readelf, Up: Top + +size +**** + + size [`-A'|`-B'|`--format='COMPATIBILITY] + [`--help'] + [`-d'|`-o'|`-x'|`--radix='NUMBER] + [`-t'|`--totals'] + [`--target='BFDNAME] [`-V'|`--version'] + [OBJFILE...] + + The GNU `size' utility lists the section sizes--and the total +size--for each of the object or archive files OBJFILE in its argument +list. By default, one line of output is generated for each object file +or each module in an archive. + + OBJFILE... are the object files to be examined. If none are +specified, the file `a.out' will be used. + + The command line options have the following meanings: + +`-A' +`-B' +`--format=COMPATIBILITY' + Using one of these options, you can choose whether the output from + GNU `size' resembles output from System V `size' (using `-A', or + `--format=sysv'), or Berkeley `size' (using `-B', or + `--format=berkeley'). The default is the one-line format similar + to Berkeley's. + + Here is an example of the Berkeley (default) format of output from + `size': + $ size --format=Berkeley ranlib size + text data bss dec hex filename + 294880 81920 11592 388392 5ed28 ranlib + 294880 81920 11888 388688 5ee50 size + + This is the same data, but displayed closer to System V + conventions: + + $ size --format=SysV ranlib size + ranlib : + section size addr + .text 294880 8192 + .data 81920 303104 + .bss 11592 385024 + Total 388392 + + + size : + section size addr + .text 294880 8192 + .data 81920 303104 + .bss 11888 385024 + Total 388688 + +`--help' + Show a summary of acceptable arguments and options. + +`-d' +`-o' +`-x' +`--radix=NUMBER' + Using one of these options, you can control whether the size of + each section is given in decimal (`-d', or `--radix=10'); octal + (`-o', or `--radix=8'); or hexadecimal (`-x', or `--radix=16'). + In `--radix=NUMBER', only the three values (8, 10, 16) are + supported. The total size is always given in two radices; decimal + and hexadecimal for `-d' or `-x' output, or octal and hexadecimal + if you're using `-o'. + +`-t' +`--totals' + Show totals of all objects listed (Berkeley format listing mode + only). + +`--target=BFDNAME' + Specify that the object-code format for OBJFILE is BFDNAME. This + option may not be necessary; `size' can automatically recognize + many formats. *Note Target Selection::, for more information. + +`-V' +`--version' + Display the version number of `size'. + + +File: binutils.info, Node: strings, Next: strip, Prev: size, Up: Top + +strings +******* + + strings [`-afov'] [`-'MIN-LEN] + [`-n' MIN-LEN] [`--bytes='MIN-LEN] + [`-t' RADIX] [`--radix='RADIX] + [`-e' ENCODING] [`--encoding='ENCODING] + [`-'] [`--all'] [`--print-file-name'] + [`--target='BFDNAME] + [`--help'] [`--version'] FILE... + + For each FILE given, GNU `strings' prints the printable character +sequences that are at least 4 characters long (or the number given with +the options below) and are followed by an unprintable character. By +default, it only prints the strings from the initialized and loaded +sections of object files; for other types of files, it prints the +strings from the whole file. + + `strings' is mainly useful for determining the contents of non-text +files. + +`-a' +`--all' +`-' + Do not scan only the initialized and loaded sections of object + files; scan the whole files. + +`-f' +`--print-file-name' + Print the name of the file before each string. + +`--help' + Print a summary of the program usage on the standard output and + exit. + +`-MIN-LEN' +`-n MIN-LEN' +`--bytes=MIN-LEN' + Print sequences of characters that are at least MIN-LEN characters + long, instead of the default 4. + +`-o' + Like `-t o'. Some other versions of `strings' have `-o' act like + `-t d' instead. Since we can not be compatible with both ways, we + simply chose one. + +`-t RADIX' +`--radix=RADIX' + Print the offset within the file before each string. The single + character argument specifies the radix of the offset--`o' for + octal, `x' for hexadecimal, or `d' for decimal. + +`-e ENCODING' +`--encoding=ENCODING' + Select the character encoding of the strings that are to be found. + Possible values for ENCODING are: `s' = single-7-bit-byte + characters (ASCII, ISO 8859, etc., default), `S' = + single-8-bit-byte characters, `b' = 16-bit bigendian, `l' = 16-bit + littleendian, `B' = 32-bit bigendian, `L' = 32-bit littleendian. + Useful for finding wide character strings. + +`--target=BFDNAME' + Specify an object code format other than your system's default + format. *Note Target Selection::, for more information. + +`-v' +`--version' + Print the program version number on the standard output and exit. + + +File: binutils.info, Node: strip, Next: c++filt, Prev: strings, Up: Top + +strip +***** + + strip [`-F' BFDNAME |`--target='BFDNAME] + [`-I' BFDNAME |`--input-target='BFDNAME] + [`-O' BFDNAME |`--output-target='BFDNAME] + [`-s'|`--strip-all'] + [`-S'|`-g'|`-d'|`--strip-debug'] + [`-K' SYMBOLNAME |`--keep-symbol='SYMBOLNAME] + [`-N' SYMBOLNAME |`--strip-symbol='SYMBOLNAME] + [`-w'|`--wildcard'] + [`-x'|`--discard-all'] [`-X' |`--discard-locals'] + [`-R' SECTIONNAME |`--remove-section='SECTIONNAME] + [`-o' FILE] [`-p'|`--preserve-dates'] + [`--only-keep-debug'] + [`-v' |`--verbose'] [`-V'|`--version'] + [`--help'] [`--info'] + OBJFILE... + + GNU `strip' discards all symbols from object files OBJFILE. The +list of object files may include archives. At least one object file +must be given. + + `strip' modifies the files named in its argument, rather than +writing modified copies under different names. + +`-F BFDNAME' +`--target=BFDNAME' + Treat the original OBJFILE as a file with the object code format + BFDNAME, and rewrite it in the same format. *Note Target + Selection::, for more information. + +`--help' + Show a summary of the options to `strip' and exit. + +`--info' + Display a list showing all architectures and object formats + available. + +`-I BFDNAME' +`--input-target=BFDNAME' + Treat the original OBJFILE as a file with the object code format + BFDNAME. *Note Target Selection::, for more information. + +`-O BFDNAME' +`--output-target=BFDNAME' + Replace OBJFILE with a file in the output format BFDNAME. *Note + Target Selection::, for more information. + +`-R SECTIONNAME' +`--remove-section=SECTIONNAME' + Remove any section named SECTIONNAME from the output file. This + option may be given more than once. Note that using this option + inappropriately may make the output file unusable. + +`-s' +`--strip-all' + Remove all symbols. + +`-g' +`-S' +`-d' +`--strip-debug' + Remove debugging symbols only. + +`--strip-unneeded' + Remove all symbols that are not needed for relocation processing. + +`-K SYMBOLNAME' +`--keep-symbol=SYMBOLNAME' + Keep only symbol SYMBOLNAME from the source file. This option may + be given more than once. + +`-N SYMBOLNAME' +`--strip-symbol=SYMBOLNAME' + Remove symbol SYMBOLNAME from the source file. This option may be + given more than once, and may be combined with strip options other + than `-K'. + +`-o FILE' + Put the stripped output in FILE, rather than replacing the + existing file. When this argument is used, only one OBJFILE + argument may be specified. + +`-p' +`--preserve-dates' + Preserve the access and modification dates of the file. + +`-w' +`--wildcard' + Permit regular expressions in SYMBOLNAMEs used in other command + line options. The question mark (?), asterisk (*), backslash (\) + and square brackets ([]) operators can be used anywhere in the + symbol name. If the first character of the symbol name is the + exclamation point (!) then the sense of the switch is reversed for + that symbol. For example: + + -w -K !foo -K fo* + + would cause strip to only keep symbols that start with the letters + "fo", but to discard the symbol "foo". + +`-x' +`--discard-all' + Remove non-global symbols. + +`-X' +`--discard-locals' + Remove compiler-generated local symbols. (These usually start + with `L' or `.'.) + +`--only-keep-debug' + Strip a file, removing any sections that would be stripped by + `--strip-debug' and leaving the debugging sections. + + The intention is that this option will be used in conjunction with + `--add-gnu-debuglink' to create a two part executable. One a + stripped binary which will occupy less space in RAM and in a + distribution and the second a debugging information file which is + only needed if debugging abilities are required. The suggested + procedure to create these files is as follows: + + 1. Link the executable as normal. Assuming that is is called + `foo' then... + + 2. Run `objcopy --only-keep-debug foo foo.dbg' to create a file + containing the debugging info. + + 3. Run `objcopy --strip-debug foo' to create a stripped + executable. + + 4. Run `objcopy --add-gnu-debuglink=foo.dbg foo' to add a link + to the debugging info into the stripped executable. + + Note - the choice of `.dbg' as an extension for the debug info + file is arbitrary. Also the `--only-keep-debug' step is optional. + You could instead do this: + + 1. Link the executable as normal. + + 2. Copy `foo' to `foo.full' + + 3. Run `strip --strip-debug foo' + + 4. Run `objcopy --add-gnu-debuglink=foo.full foo' + + ie the file pointed to by the `--add-gnu-debuglink' can be the + full executable. It does not have to be a file created by the + `--only-keep-debug' switch. + +`-V' +`--version' + Show the version number for `strip'. + +`-v' +`--verbose' + Verbose output: list all object files modified. In the case of + archives, `strip -v' lists all members of the archive. + + +File: binutils.info, Node: c++filt, Next: addr2line, Prev: strip, Up: Top + +c++filt +******* + + c++filt [`-_'|`--strip-underscores'] + [`-j'|`--java'] + [`-n'|`--no-strip-underscores'] + [`-p'|`--no-params'] + [`-s' FORMAT|`--format='FORMAT] + [`--help'] [`--version'] [SYMBOL...] + + The C++ and Java languages provides function overloading, which means +that you can write many functions with the same name (providing each +takes parameters of different types). All C++ and Java function names +are encoded into a low-level assembly label (this process is known as +"mangling"). The `c++filt' (1) program does the inverse mapping: it +decodes ("demangles") low-level names into user-level names so that the +linker can keep these overloaded functions from clashing. + + Every alphanumeric word (consisting of letters, digits, underscores, +dollars, or periods) seen in the input is a potential label. If the +label decodes into a C++ name, the C++ name replaces the low-level name +in the output. + + You can use `c++filt' to decipher individual symbols: + + c++filt SYMBOL + + If no SYMBOL arguments are given, `c++filt' reads symbol names from +the standard input and writes the demangled names to the standard +output. All results are printed on the standard output. + +`-_' +`--strip-underscores' + On some systems, both the C and C++ compilers put an underscore in + front of every name. For example, the C name `foo' gets the + low-level name `_foo'. This option removes the initial + underscore. Whether `c++filt' removes the underscore by default + is target dependent. + +`-j' +`--java' + Prints demangled names using Java syntax. The default is to use + C++ syntax. + +`-n' +`--no-strip-underscores' + Do not remove the initial underscore. + +`-p' +`--no-params' + When demangling the name of a function, do not display the types of + the function's parameters. + +`-s FORMAT' +`--format=FORMAT' + `c++filt' can decode various methods of mangling, used by + different compilers. The argument to this option selects which + method it uses: + + `auto' + Automatic selection based on executable (the default method) + + `gnu' + the one used by the GNU C++ compiler (g++) + + `lucid' + the one used by the Lucid compiler (lcc) + + `arm' + the one specified by the C++ Annotated Reference Manual + + `hp' + the one used by the HP compiler (aCC) + + `edg' + the one used by the EDG compiler + + `gnu-v3' + the one used by the GNU C++ compiler (g++) with the V3 ABI. + + `java' + the one used by the GNU Java compiler (gcj) + + `gnat' + the one used by the GNU Ada compiler (GNAT). + +`--help' + Print a summary of the options to `c++filt' and exit. + +`--version' + Print the version number of `c++filt' and exit. + + _Warning:_ `c++filt' is a new utility, and the details of its user + interface are subject to change in future releases. In particular, + a command-line option may be required in the the future to decode + a name passed as an argument on the command line; in other words, + + c++filt SYMBOL + + may in a future release become + + c++filt OPTION SYMBOL + + ---------- Footnotes ---------- + + (1) MS-DOS does not allow `+' characters in file names, so on MS-DOS +this program is named `cxxfilt'. + + +File: binutils.info, Node: addr2line, Next: nlmconv, Prev: c++filt, Up: Top + +addr2line +********* + + addr2line [`-b' BFDNAME|`--target='BFDNAME] + [`-C'|`--demangle'[=STYLE]] + [`-e' FILENAME|`--exe='FILENAME] + [`-f'|`--functions'] [`-s'|`--basename'] + [`-H'|`--help'] [`-V'|`--version'] + [addr addr ...] + + `addr2line' translates program addresses into file names and line +numbers. Given an address and an executable, it uses the debugging +information in the executable to figure out which file name and line +number are associated with a given address. + + The executable to use is specified with the `-e' option. The +default is the file `a.out'. + + `addr2line' has two modes of operation. + + In the first, hexadecimal addresses are specified on the command +line, and `addr2line' displays the file name and line number for each +address. + + In the second, `addr2line' reads hexadecimal addresses from standard +input, and prints the file name and line number for each address on +standard output. In this mode, `addr2line' may be used in a pipe to +convert dynamically chosen addresses. + + The format of the output is `FILENAME:LINENO'. The file name and +line number for each address is printed on a separate line. If the +`-f' option is used, then each `FILENAME:LINENO' line is preceded by a +`FUNCTIONNAME' line which is the name of the function containing the +address. + + If the file name or function name can not be determined, `addr2line' +will print two question marks in their place. If the line number can +not be determined, `addr2line' will print 0. + + The long and short forms of options, shown here as alternatives, are +equivalent. + +`-b BFDNAME' +`--target=BFDNAME' + Specify that the object-code format for the object files is + BFDNAME. + +`-C' +`--demangle[=STYLE]' + Decode ("demangle") low-level symbol names into user-level names. + Besides removing any initial underscore prepended by the system, + this makes C++ function names readable. Different compilers have + different mangling styles. The optional demangling style argument + can be used to choose an appropriate demangling style for your + compiler. *Note c++filt::, for more information on demangling. + +`-e FILENAME' +`--exe=FILENAME' + Specify the name of the executable for which addresses should be + translated. The default file is `a.out'. + +`-f' +`--functions' + Display function names as well as file and line number information. + +`-s' +`--basenames' + Display only the base of each file name. + + +File: binutils.info, Node: nlmconv, Next: windres, Prev: addr2line, Up: Top + +nlmconv +******* + +`nlmconv' converts a relocatable object file into a NetWare Loadable +Module. + + _Warning:_ `nlmconv' is not always built as part of the binary + utilities, since it is only useful for NLM targets. + + nlmconv [`-I' BFDNAME|`--input-target='BFDNAME] + [`-O' BFDNAME|`--output-target='BFDNAME] + [`-T' HEADERFILE|`--header-file='HEADERFILE] + [`-d'|`--debug'] [`-l' LINKER|`--linker='LINKER] + [`-h'|`--help'] [`-V'|`--version'] + INFILE OUTFILE + + `nlmconv' converts the relocatable `i386' object file INFILE into +the NetWare Loadable Module OUTFILE, optionally reading HEADERFILE for +NLM header information. For instructions on writing the NLM command +file language used in header files, see the `linkers' section, +`NLMLINK' in particular, of the `NLM Development and Tools Overview', +which is part of the NLM Software Developer's Kit ("NLM SDK"), +available from Novell, Inc. `nlmconv' uses the GNU Binary File +Descriptor library to read INFILE; see *Note BFD: (ld.info)BFD, for +more information. + + `nlmconv' can perform a link step. In other words, you can list +more than one object file for input if you list them in the definitions +file (rather than simply specifying one input file on the command line). +In this case, `nlmconv' calls the linker for you. + +`-I BFDNAME' +`--input-target=BFDNAME' + Object format of the input file. `nlmconv' can usually determine + the format of a given file (so no default is necessary). *Note + Target Selection::, for more information. + +`-O BFDNAME' +`--output-target=BFDNAME' + Object format of the output file. `nlmconv' infers the output + format based on the input format, e.g. for a `i386' input file the + output format is `nlm32-i386'. *Note Target Selection::, for more + information. + +`-T HEADERFILE' +`--header-file=HEADERFILE' + Reads HEADERFILE for NLM header information. For instructions on + writing the NLM command file language used in header files, see + see the `linkers' section, of the `NLM Development and Tools + Overview', which is part of the NLM Software Developer's Kit, + available from Novell, Inc. + +`-d' +`--debug' + Displays (on standard error) the linker command line used by + `nlmconv'. + +`-l LINKER' +`--linker=LINKER' + Use LINKER for any linking. LINKER can be an absolute or a + relative pathname. + +`-h' +`--help' + Prints a usage summary. + +`-V' +`--version' + Prints the version number for `nlmconv'. + + +File: binutils.info, Node: windres, Next: dlltool, Prev: nlmconv, Up: Top + +windres +******* + +`windres' may be used to manipulate Windows resources. + + _Warning:_ `windres' is not always built as part of the binary + utilities, since it is only useful for Windows targets. + + windres [options] [input-file] [output-file] + + `windres' reads resources from an input file and copies them into an +output file. Either file may be in one of three formats: + +`rc' + A text format read by the Resource Compiler. + +`res' + A binary format generated by the Resource Compiler. + +`coff' + A COFF object or executable. + + The exact description of these different formats is available in +documentation from Microsoft. + + When `windres' converts from the `rc' format to the `res' format, it +is acting like the Windows Resource Compiler. When `windres' converts +from the `res' format to the `coff' format, it is acting like the +Windows `CVTRES' program. + + When `windres' generates an `rc' file, the output is similar but not +identical to the format expected for the input. When an input `rc' +file refers to an external filename, an output `rc' file will instead +include the file contents. + + If the input or output format is not specified, `windres' will guess +based on the file name, or, for the input file, the file contents. A +file with an extension of `.rc' will be treated as an `rc' file, a file +with an extension of `.res' will be treated as a `res' file, and a file +with an extension of `.o' or `.exe' will be treated as a `coff' file. + + If no output file is specified, `windres' will print the resources +in `rc' format to standard output. + + The normal use is for you to write an `rc' file, use `windres' to +convert it to a COFF object file, and then link the COFF file into your +application. This will make the resources described in the `rc' file +available to Windows. + +`-i FILENAME' +`--input FILENAME' + The name of the input file. If this option is not used, then + `windres' will use the first non-option argument as the input file + name. If there are no non-option arguments, then `windres' will + read from standard input. `windres' can not read a COFF file from + standard input. + +`-o FILENAME' +`--output FILENAME' + The name of the output file. If this option is not used, then + `windres' will use the first non-option argument, after any used + for the input file name, as the output file name. If there is no + non-option argument, then `windres' will write to standard output. + `windres' can not write a COFF file to standard output. Note, for + compatability with `rc' the option `-fo' is also accepted, but its + use is not recommended. + +`-J FORMAT' +`--input-format FORMAT' + The input format to read. FORMAT may be `res', `rc', or `coff'. + If no input format is specified, `windres' will guess, as + described above. + +`-O FORMAT' +`--output-format FORMAT' + The output format to generate. FORMAT may be `res', `rc', or + `coff'. If no output format is specified, `windres' will guess, + as described above. + +`-F TARGET' +`--target TARGET' + Specify the BFD format to use for a COFF file as input or output. + This is a BFD target name; you can use the `--help' option to see + a list of supported targets. Normally `windres' will use the + default format, which is the first one listed by the `--help' + option. *Note Target Selection::. + +`--preprocessor PROGRAM' + When `windres' reads an `rc' file, it runs it through the C + preprocessor first. This option may be used to specify the + preprocessor to use, including any leading arguments. The default + preprocessor argument is `gcc -E -xc-header -DRC_INVOKED'. + +`-I DIRECTORY' +`--include-dir DIRECTORY' + Specify an include directory to use when reading an `rc' file. + `windres' will pass this to the preprocessor as an `-I' option. + `windres' will also search this directory when looking for files + named in the `rc' file. If the argument passed to this command + matches any of the supported FORMATS (as descrived in the `-J' + option), it will issue a deprecation warning, and behave just like + the `-J' option. New programs should not use this behaviour. If a + directory happens to match a FORMAT, simple prefix it with `./' to + disable the backward compatibility. + +`-D TARGET' +`--define SYM[=VAL]' + Specify a `-D' option to pass to the preprocessor when reading an + `rc' file. + +`-U TARGET' +`--undefine SYM' + Specify a `-U' option to pass to the preprocessor when reading an + `rc' file. + +`-r' + Ignored for compatibility with rc. + +`-v' + Enable verbose mode. This tells you what the preprocessor is if + you didn't specify one. + +`-l VAL' + +`--language VAL' + Specify the default language to use when reading an `rc' file. + VAL should be a hexadecimal language code. The low eight bits are + the language, and the high eight bits are the sublanguage. + +`--use-temp-file' + Use a temporary file to instead of using popen to read the output + of the preprocessor. Use this option if the popen implementation + is buggy on the host (eg., certain non-English language versions + of Windows 95 and Windows 98 are known to have buggy popen where + the output will instead go the console). + +`--no-use-temp-file' + Use popen, not a temporary file, to read the output of the + preprocessor. This is the default behaviour. + +`-h' + +`--help' + Prints a usage summary. + +`-V' + +`--version' + Prints the version number for `windres'. + +`--yydebug' + If `windres' is compiled with `YYDEBUG' defined as `1', this will + turn on parser debugging. + + +File: binutils.info, Node: dlltool, Next: Selecting The Target System, Prev: windres, Up: Top + +Create files needed to build and use DLLs +***************************************** + +`dlltool' may be used to create the files needed to build and use +dynamic link libraries (DLLs). + + _Warning:_ `dlltool' is not always built as part of the binary + utilities, since it is only useful for those targets which support + DLLs. + + dlltool [`-d'|`--input-def' DEF-FILE-NAME] + [`-b'|`--base-file' BASE-FILE-NAME] + [`-e'|`--output-exp' EXPORTS-FILE-NAME] + [`-z'|`--output-def' DEF-FILE-NAME] + [`-l'|`--output-lib' LIBRARY-FILE-NAME] + [`--export-all-symbols'] [`--no-export-all-symbols'] + [`--exclude-symbols' LIST] + [`--no-default-excludes'] + [`-S'|`--as' PATH-TO-ASSEMBLER] [`-f'|`--as-flags' OPTIONS] + [`-D'|`--dllname' NAME] [`-m'|`--machine' MACHINE] + [`-a'|`--add-indirect'] [`-U'|`--add-underscore'] [`-k'|`--kill-at'] + [`-A'|`--add-stdcall-alias'] + [`-x'|`--no-idata4'] [`-c'|`--no-idata5'] [`-i'|`--interwork'] + [`-n'|`--nodelete'] [`-t'|`--temp-prefix' PREFIX] + [`-v'|`--verbose'] + [`-h'|`--help'] [`-V'|`--version'] + [object-file ...] + + `dlltool' reads its inputs, which can come from the `-d' and `-b' +options as well as object files specified on the command line. It then +processes these inputs and if the `-e' option has been specified it +creates a exports file. If the `-l' option has been specified it +creates a library file and if the `-z' option has been specified it +creates a def file. Any or all of the `-e', `-l' and `-z' options can +be present in one invocation of dlltool. + + When creating a DLL, along with the source for the DLL, it is +necessary to have three other files. `dlltool' can help with the +creation of these files. + + The first file is a `.def' file which specifies which functions are +exported from the DLL, which functions the DLL imports, and so on. This +is a text file and can be created by hand, or `dlltool' can be used to +create it using the `-z' option. In this case `dlltool' will scan the +object files specified on its command line looking for those functions +which have been specially marked as being exported and put entries for +them in the .def file it creates. + + In order to mark a function as being exported from a DLL, it needs to +have an `-export:' entry in the `.drectve' section of +the object file. This can be done in C by using the asm() operator: + + asm (".section .drectve"); + asm (".ascii \"-export:my_func\""); + + int my_func (void) { ... } + + The second file needed for DLL creation is an exports file. This +file is linked with the object files that make up the body of the DLL +and it handles the interface between the DLL and the outside world. +This is a binary file and it can be created by giving the `-e' option to +`dlltool' when it is creating or reading in a .def file. + + The third file needed for DLL creation is the library file that +programs will link with in order to access the functions in the DLL. +This file can be created by giving the `-l' option to dlltool when it +is creating or reading in a .def file. + + `dlltool' builds the library file by hand, but it builds the exports +file by creating temporary files containing assembler statements and +then assembling these. The `-S' command line option can be used to +specify the path to the assembler that dlltool will use, and the `-f' +option can be used to pass specific flags to that assembler. The `-n' +can be used to prevent dlltool from deleting these temporary assembler +files when it is done, and if `-n' is specified twice then this will +prevent dlltool from deleting the temporary object files it used to +build the library. + + Here is an example of creating a DLL from a source file `dll.c' and +also creating a program (from an object file called `program.o') that +uses that DLL: + + gcc -c dll.c + dlltool -e exports.o -l dll.lib dll.o + gcc dll.o exports.o -o dll.dll + gcc program.o dll.lib -o program + + The command line options have the following meanings: + +`-d FILENAME' +`--input-def FILENAME' + Specifies the name of a .def file to be read in and processed. + +`-b FILENAME' +`--base-file FILENAME' + Specifies the name of a base file to be read in and processed. The + contents of this file will be added to the relocation section in + the exports file generated by dlltool. + +`-e FILENAME' +`--output-exp FILENAME' + Specifies the name of the export file to be created by dlltool. + +`-z FILENAME' +`--output-def FILENAME' + Specifies the name of the .def file to be created by dlltool. + +`-l FILENAME' +`--output-lib FILENAME' + Specifies the name of the library file to be created by dlltool. + +`--export-all-symbols' + Treat all global and weak defined symbols found in the input object + files as symbols to be exported. There is a small list of symbols + which are not exported by default; see the `--no-default-excludes' + option. You may add to the list of symbols to not export by using + the `--exclude-symbols' option. + +`--no-export-all-symbols' + Only export symbols explicitly listed in an input .def file or in + `.drectve' sections in the input object files. This is the default + behaviour. The `.drectve' sections are created by `dllexport' + attributes in the source code. + +`--exclude-symbols LIST' + Do not export the symbols in LIST. This is a list of symbol names + separated by comma or colon characters. The symbol names should + not contain a leading underscore. This is only meaningful when + `--export-all-symbols' is used. + +`--no-default-excludes' + When `--export-all-symbols' is used, it will by default avoid + exporting certain special symbols. The current list of symbols to + avoid exporting is `DllMain@12', `DllEntryPoint@0', `impure_ptr'. + You may use the `--no-default-excludes' option to go ahead and + export these special symbols. This is only meaningful when + `--export-all-symbols' is used. + +`-S PATH' +`--as PATH' + Specifies the path, including the filename, of the assembler to be + used to create the exports file. + +`-f OPTIONS' +`--as-flags OPTIONS' + Specifies any specific command line options to be passed to the + assembler when building the exports file. This option will work + even if the `-S' option is not used. This option only takes one + argument, and if it occurs more than once on the command line, + then later occurrences will override earlier occurrences. So if + it is necessary to pass multiple options to the assembler they + should be enclosed in double quotes. + +`-D NAME' +`--dll-name NAME' + Specifies the name to be stored in the .def file as the name of + the DLL when the `-e' option is used. If this option is not + present, then the filename given to the `-e' option will be used + as the name of the DLL. + +`-m MACHINE' +`-machine MACHINE' + Specifies the type of machine for which the library file should be + built. `dlltool' has a built in default type, depending upon how + it was created, but this option can be used to override that. + This is normally only useful when creating DLLs for an ARM + processor, when the contents of the DLL are actually encode using + Thumb instructions. + +`-a' +`--add-indirect' + Specifies that when `dlltool' is creating the exports file it + should add a section which allows the exported functions to be + referenced without using the import library. Whatever the hell + that means! + +`-U' +`--add-underscore' + Specifies that when `dlltool' is creating the exports file it + should prepend an underscore to the names of the exported + functions. + +`-k' +`--kill-at' + Specifies that when `dlltool' is creating the exports file it + should not append the string `@ '. These numbers are + called ordinal numbers and they represent another way of accessing + the function in a DLL, other than by name. + +`-A' +`--add-stdcall-alias' + Specifies that when `dlltool' is creating the exports file it + should add aliases for stdcall symbols without `@ ' in + addition to the symbols with `@ '. + +`-x' +`--no-idata4' + Specifies that when `dlltool' is creating the exports and library + files it should omit the `.idata4' section. This is for + compatibility with certain operating systems. + +`-c' +`--no-idata5' + Specifies that when `dlltool' is creating the exports and library + files it should omit the `.idata5' section. This is for + compatibility with certain operating systems. + +`-i' +`--interwork' + Specifies that `dlltool' should mark the objects in the library + file and exports file that it produces as supporting interworking + between ARM and Thumb code. + +`-n' +`--nodelete' + Makes `dlltool' preserve the temporary assembler files it used to + create the exports file. If this option is repeated then dlltool + will also preserve the temporary object files it uses to create + the library file. + +`-t PREFIX' +`--temp-prefix PREFIX' + Makes `dlltool' use PREFIX when constructing the names of + temporary assembler and object files. By default, the temp file + prefix is generated from the pid. + +`-v' +`--verbose' + Make dlltool describe what it is doing. + +`-h' +`--help' + Displays a list of command line options and then exits. + +`-V' +`--version' + Displays dlltool's version number and then exits. + + + +File: binutils.info, Node: readelf, Next: size, Prev: ranlib, Up: Top + +readelf +******* + + readelf [`-a'|`--all'] + [`-h'|`--file-header'] + [`-l'|`--program-headers'|`--segments'] + [`-S'|`--section-headers'|`--sections'] + [`-e'|`--headers'] + [`-s'|`--syms'|`--symbols'] + [`-n'|`--notes'] + [`-r'|`--relocs'] + [`-u'|`--unwind'] + [`-d'|`--dynamic'] + [`-V'|`--version-info'] + [`-A'|`--arch-specific'] + [`-D'|`--use-dynamic'] + [`-x' |`--hex-dump='] + [`-w[liaprmfFso]'| + `--debug-dump'[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=frames-interp,=str,=loc]] + [`-I'|`-histogram'] + [`-v'|`--version'] + [`-W'|`--wide'] + [`-H'|`--help'] + ELFFILE... + + `readelf' displays information about one or more ELF format object +files. The options control what particular information to display. + + ELFFILE... are the object files to be examined. 32-bit and 64-bit +ELF files are supported, as are archives containing ELF files. + + This program performs a similar function to `objdump' but it goes +into more detail and it exists independently of the BFD library, so if +there is a bug in BFD then readelf will not be affected. + + The long and short forms of options, shown here as alternatives, are +equivalent. At least one option besides `-v' or `-H' must be given. + +`-a' +`--all' + Equivalent to specifiying `--file-header', `--program-headers', + `--sections', `--symbols', `--relocs', `--dynamic', `--notes' and + `--version-info'. + +`-h' +`--file-header' + Displays the information contained in the ELF header at the start + of the file. + +`-l' +`--program-headers' +`--segments' + Displays the information contained in the file's segment headers, + if it has any. + +`-S' +`--sections' +`--section-headers' + Displays the information contained in the file's section headers, + if it has any. + +`-s' +`--symbols' +`--syms' + Displays the entries in symbol table section of the file, if it + has one. + +`-e' +`--headers' + Display all the headers in the file. Equivalent to `-h -l -S'. + +`-n' +`--notes' + Displays the contents of the NOTE segment, if it exists. + +`-r' +`--relocs' + Displays the contents of the file's relocation section, if it has + one. + +`-u' +`--unwind' + Displays the contents of the file's unwind section, if it has one. + Only the unwind sections for IA64 ELF files are currently + supported. + +`-u' +`--unwind' + Displays the contents of the file's unwind section, if it has one. + Only the unwind sections for IA64 ELF files are currently + supported. + +`-d' +`--dynamic' + Displays the contents of the file's dynamic section, if it has one. + +`-V' +`--version-info' + Displays the contents of the version sections in the file, it they + exist. + +`-A' +`--arch-specific' + Displays architecture-specific information in the file, if there + is any. + +`-D' +`--use-dynamic' + When displaying symbols, this option makes `readelf' use the + symbol table in the file's dynamic section, rather than the one in + the symbols section. + +`-x ' +`--hex-dump=' + Displays the contents of the indicated section as a hexadecimal + dump. + +`-w[liaprmfFso]' +`--debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=frames-interp,=str,=loc]' + Displays the contents of the debug sections in the file, if any are + present. If one of the optional letters or words follows the + switch then only data found in those specific sections will be + dumped. + +`-I' +`--histogram' + Display a histogram of bucket list lengths when displaying the + contents of the symbol tables. + +`-v' +`--version' + Display the version number of readelf. + +`-W' +`--wide' + Don't break output lines to fit into 80 columns. By default + `readelf' breaks section header and segment listing lines for + 64-bit ELF files, so that they fit into 80 columns. This option + causes `readelf' to print each section header resp. each segment + one a single line, which is far more readable on terminals wider + than 80 columns. + +`-H' +`--help' + Display the command line options understood by `readelf'. + + + +File: binutils.info, Node: Selecting The Target System, Next: Reporting Bugs, Prev: dlltool, Up: Top + +Selecting the Target System +*************************** + +You can specify two aspects of the target system to the GNU binary file +utilities, each in several ways: + + * the target + + * the architecture + + In the following summaries, the lists of ways to specify values are +in order of decreasing precedence. The ways listed first override those +listed later. + + The commands to list valid values only list the values for which the +programs you are running were configured. If they were configured with +`--enable-targets=all', the commands list most of the available values, +but a few are left out; not all targets can be configured in at once +because some of them can only be configured "native" (on hosts with the +same type as the target system). + +* Menu: + +* Target Selection:: +* Architecture Selection:: + + +File: binutils.info, Node: Target Selection, Next: Architecture Selection, Up: Selecting The Target System + +Target Selection +================ + +A "target" is an object file format. A given target may be supported +for multiple architectures (*note Architecture Selection::). A target +selection may also have variations for different operating systems or +architectures. + + The command to list valid target values is `objdump -i' (the first +column of output contains the relevant information). + + Some sample values are: `a.out-hp300bsd', `ecoff-littlemips', +`a.out-sunos-big'. + + You can also specify a target using a configuration triplet. This is +the same sort of name that is passed to `configure' to specify a +target. When you use a configuration triplet as an argument, it must be +fully canonicalized. You can see the canonical version of a triplet by +running the shell script `config.sub' which is included with the +sources. + + Some sample configuration triplets are: `m68k-hp-bsd', +`mips-dec-ultrix', `sparc-sun-sunos'. + +`objdump' Target +---------------- + +Ways to specify: + + 1. command line option: `-b' or `--target' + + 2. environment variable `GNUTARGET' + + 3. deduced from the input file + +`objcopy' and `strip' Input Target +---------------------------------- + +Ways to specify: + + 1. command line options: `-I' or `--input-target', or `-F' or + `--target' + + 2. environment variable `GNUTARGET' + + 3. deduced from the input file + +`objcopy' and `strip' Output Target +----------------------------------- + +Ways to specify: + + 1. command line options: `-O' or `--output-target', or `-F' or + `--target' + + 2. the input target (see "`objcopy' and `strip' Input Target" above) + + 3. environment variable `GNUTARGET' + + 4. deduced from the input file + +`nm', `size', and `strings' Target +---------------------------------- + +Ways to specify: + + 1. command line option: `--target' + + 2. environment variable `GNUTARGET' + + 3. deduced from the input file + + +File: binutils.info, Node: Architecture Selection, Prev: Target Selection, Up: Selecting The Target System + +Architecture Selection +====================== + +An "architecture" is a type of CPU on which an object file is to run. +Its name may contain a colon, separating the name of the processor +family from the name of the particular CPU. + + The command to list valid architecture values is `objdump -i' (the +second column contains the relevant information). + + Sample values: `m68k:68020', `mips:3000', `sparc'. + +`objdump' Architecture +---------------------- + +Ways to specify: + + 1. command line option: `-m' or `--architecture' + + 2. deduced from the input file + +`objcopy', `nm', `size', `strings' Architecture +----------------------------------------------- + +Ways to specify: + + 1. deduced from the input file + + +File: binutils.info, Node: Reporting Bugs, Next: GNU Free Documentation License, Prev: Selecting The Target System, Up: Top + +Reporting Bugs +************** + +Your bug reports play an essential role in making the binary utilities +reliable. + + Reporting a bug may help you by bringing a solution to your problem, +or it may not. But in any case the principal function of a bug report +is to help the entire community by making the next version of the binary +utilities work better. Bug reports are your contribution to their +maintenance. + + In order for a bug report to serve its purpose, you must include the +information that enables us to fix the bug. + +* Menu: + +* Bug Criteria:: Have you found a bug? +* Bug Reporting:: How to report bugs + + +File: binutils.info, Node: Bug Criteria, Next: Bug Reporting, Up: Reporting Bugs + +Have You Found a Bug? +===================== + +If you are not sure whether you have found a bug, here are some +guidelines: + + * If a binary utility gets a fatal signal, for any input whatever, + that is a bug. Reliable utilities never crash. + + * If a binary utility produces an error message for valid input, + that is a bug. + + * If you are an experienced user of binary utilities, your + suggestions for improvement are welcome in any case. + + +File: binutils.info, Node: Bug Reporting, Prev: Bug Criteria, Up: Reporting Bugs + +How to Report Bugs +================== + +A number of companies and individuals offer support for GNU products. +If you obtained the binary utilities from a support organization, we +recommend you contact that organization first. + + You can find contact information for many support companies and +individuals in the file `etc/SERVICE' in the GNU Emacs distribution. + + In any event, we also recommend that you send bug reports for the +binary utilities to `bug-binutils@gnu.org'. + + The fundamental principle of reporting bugs usefully is this: +*report all the facts*. If you are not sure whether to state a fact or +leave it out, state it! + + Often people omit facts because they think they know what causes the +problem and assume that some details do not matter. Thus, you might +assume that the name of a file you use in an example does not matter. +Well, probably it does not, but one cannot be sure. Perhaps the bug is +a stray memory reference which happens to fetch from the location where +that pathname is stored in memory; perhaps, if the pathname were +different, the contents of that location would fool the utility into +doing the right thing despite the bug. Play it safe and give a +specific, complete example. That is the easiest thing for you to do, +and the most helpful. + + Keep in mind that the purpose of a bug report is to enable us to fix +the bug if it is new to us. Therefore, always write your bug reports +on the assumption that the bug has not been reported previously. + + Sometimes people give a few sketchy facts and ask, "Does this ring a +bell?" This cannot help us fix a bug, so it is basically useless. We +respond by asking for enough details to enable us to investigate. You +might as well expedite matters by sending them to begin with. + + To enable us to fix the bug, you should include all these things: + + * The version of the utility. Each utility announces it if you + start it with the `--version' argument. + + Without this, we will not know whether there is any point in + looking for the bug in the current version of the binary utilities. + + * Any patches you may have applied to the source, including any + patches made to the `BFD' library. + + * The type of machine you are using, and the operating system name + and version number. + + * What compiler (and its version) was used to compile the + utilities--e.g. "`gcc-2.7'". + + * The command arguments you gave the utility to observe the bug. To + guarantee you will not omit something important, list them all. A + copy of the Makefile (or the output from make) is sufficient. + + If we were to try to guess the arguments, we would probably guess + wrong and then we might not encounter the bug. + + * A complete input file, or set of input files, that will reproduce + the bug. If the utility is reading an object file or files, then + it is generally most helpful to send the actual object files, + uuencoded if necessary to get them through the mail system. Note + that `bug-binutils@gnu.org' is a mailing list, so you should avoid + sending very large files to it. Making the files available for + anonymous FTP is OK. + + If the source files were produced exclusively using GNU programs + (e.g., `gcc', `gas', and/or the GNU `ld'), then it may be OK to + send the source files rather than the object files. In this case, + be sure to say exactly what version of `gcc', or whatever, was + used to produce the object files. Also say how `gcc', or + whatever, was configured. + + * A description of what behavior you observe that you believe is + incorrect. For example, "It gets a fatal signal." + + Of course, if the bug is that the utility gets a fatal signal, + then we will certainly notice it. But if the bug is incorrect + output, we might not notice unless it is glaringly wrong. You + might as well not give us a chance to make a mistake. + + Even if the problem you experience is a fatal signal, you should + still say so explicitly. Suppose something strange is going on, + such as your copy of the utility is out of synch, or you have + encountered a bug in the C library on your system. (This has + happened!) Your copy might crash and ours would not. If you told + us to expect a crash, then when ours fails to crash, we would know + that the bug was not happening for us. If you had not told us to + expect a crash, then we would not be able to draw any conclusion + from our observations. + + * If you wish to suggest changes to the source, send us context + diffs, as generated by `diff' with the `-u', `-c', or `-p' option. + Always send diffs from the old file to the new file. If you wish + to discuss something in the `ld' source, refer to it by context, + not by line number. + + The line numbers in our development sources will not match those + in your sources. Your line numbers would convey no useful + information to us. + + Here are some things that are not necessary: + + * A description of the envelope of the bug. + + Often people who encounter a bug spend a lot of time investigating + which changes to the input file will make the bug go away and which + changes will not affect it. + + This is often time consuming and not very useful, because the way + we will find the bug is by running a single example under the + debugger with breakpoints, not by pure deduction from a series of + examples. We recommend that you save your time for something else. + + Of course, if you can find a simpler example to report _instead_ + of the original one, that is a convenience for us. Errors in the + output will be easier to spot, running under the debugger will take + less time, and so on. + + However, simplification is not vital; if you do not want to do + this, report the bug anyway and send us the entire test case you + used. + + * A patch for the bug. + + A patch for the bug does help us if it is a good one. But do not + omit the necessary information, such as the test case, on the + assumption that a patch is all we need. We might see problems + with your patch and decide to fix the problem another way, or we + might not understand it at all. + + Sometimes with programs as complicated as the binary utilities it + is very hard to construct an example that will make the program + follow a certain path through the code. If you do not send us the + example, we will not be able to construct one, so we will not be + able to verify that the bug is fixed. + + And if we cannot understand what bug you are trying to fix, or why + your patch should be an improvement, we will not install it. A + test case will help us to understand. + + * A guess about what the bug is or what it depends on. + + Such guesses are usually wrong. Even we cannot guess right about + such things without first using the debugger to find the facts. + + +File: binutils.info, Node: GNU Free Documentation License, Next: Index, Prev: Reporting Bugs, Up: Top + +GNU Free Documentation License +****************************** + + Version 1.1, March 2000 + Copyright (C) 2000 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. + + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or other + written document "free" in the sense of freedom: to assure everyone + the effective freedom to copy and redistribute it, with or without + modifying it, either commercially or noncommercially. Secondarily, + this License preserves for the author and publisher a way to get + credit for their work, while not being considered responsible for + modifications made by others. + + This License is a kind of "copyleft", which means that derivative + works of the document must themselves be free in the same sense. + It complements the GNU General Public License, which is a copyleft + license designed for free software. + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same freedoms + that the software does. But this License is not limited to + software manuals; it can be used for any textual work, regardless + of subject matter or whether it is published as a printed book. + We recommend this License principally for works whose purpose is + instruction or reference. + + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work that contains a + notice placed by the copyright holder saying it can be distributed + under the terms of this License. The "Document", below, refers to + any such manual or work. Any member of the public is a licensee, + and is addressed as "you." + + A "Modified Version" of the Document means any work containing the + Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. + + A "Secondary Section" is a named appendix or a front-matter + section of the Document that deals exclusively with the + relationship of the publishers or authors of the Document to the + Document's overall subject (or to related matters) and contains + nothing that could fall directly within that overall subject. + (For example, if the Document is in part a textbook of + mathematics, a Secondary Section may not explain any mathematics.) + The relationship could be a matter of historical connection with + the subject or with related matters, or of legal, commercial, + philosophical, ethical or political position regarding them. + + The "Invariant Sections" are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in + the notice that says that the Document is released under this + License. + + The "Cover Texts" are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice + that says that the Document is released under this License. + + A "Transparent" copy of the Document means a machine-readable copy, + represented in a format whose specification is available to the + general public, whose contents can be viewed and edited directly + and straightforwardly with generic text editors or (for images + composed of pixels) generic paint programs or (for drawings) some + widely available drawing editor, and that is suitable for input to + text formatters or for automatic translation to a variety of + formats suitable for input to text formatters. A copy made in an + otherwise Transparent file format whose markup has been designed + to thwart or discourage subsequent modification by readers is not + Transparent. A copy that is not "Transparent" is called "Opaque." + + Examples of suitable formats for Transparent copies include plain + ASCII without markup, Texinfo input format, LaTeX input format, + SGML or XML using a publicly available DTD, and + standard-conforming simple HTML designed for human modification. + Opaque formats include PostScript, PDF, proprietary formats that + can be read and edited only by proprietary word processors, SGML + or XML for which the DTD and/or processing tools are not generally + available, and the machine-generated HTML produced by some word + processors for output purposes only. + + The "Title Page" means, for a printed book, the title page itself, + plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For + works in formats which do not have any title page as such, "Title + Page" means the text near the most prominent appearance of the + work's title, preceding the beginning of the body of the text. + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that you + add no other conditions whatsoever to those of this License. You + may not use technical measures to obstruct or control the reading + or further copying of the copies you make or distribute. However, + you may accept compensation in exchange for copies. If you + distribute a large enough number of copies you must also follow + the conditions in section 3. + + You may also lend copies, under the same conditions stated above, + and you may publicly display copies. + + 3. COPYING IN QUANTITY + + If you publish printed copies of the Document numbering more than + 100, and the Document's license notice requires Cover Texts, you + must enclose the copies in covers that carry, clearly and legibly, + all these Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also clearly + and legibly identify you as the publisher of these copies. The + front cover must present the full title with all words of the + title equally prominent and visible. You may add other material + on the covers in addition. Copying with changes limited to the + covers, as long as they preserve the title of the Document and + satisfy these conditions, can be treated as verbatim copying in + other respects. + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + If you publish or distribute Opaque copies of the Document + numbering more than 100, you must either include a + machine-readable Transparent copy along with each Opaque copy, or + state in or with each Opaque copy a publicly-accessible + computer-network location containing a complete Transparent copy + of the Document, free of added material, which the general + network-using public has access to download anonymously at no + charge using public-standard network protocols. If you use the + latter option, you must take reasonably prudent steps, when you + begin distribution of Opaque copies in quantity, to ensure that + this Transparent copy will remain thus accessible at the stated + location until at least one year after the last time you + distribute an Opaque copy (directly or through your agents or + retailers) of that edition to the public. + + It is requested, but not required, that you contact the authors of + the Document well before redistributing any large number of + copies, to give them a chance to provide you with an updated + version of the Document. + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document + under the conditions of sections 2 and 3 above, provided that you + release the Modified Version under precisely this License, with + the Modified Version filling the role of the Document, thus + licensing distribution and modification of the Modified Version to + whoever possesses a copy of it. In addition, you must do these + things in the Modified Version: + + A. Use in the Title Page (and on the covers, if any) a title + distinct from that of the Document, and from those of previous + versions (which should, if there were any, be listed in the + History section of the Document). You may use the same title + as a previous version if the original publisher of that version + gives permission. + B. List on the Title Page, as authors, one or more persons or + entities responsible for authorship of the modifications in the + Modified Version, together with at least five of the principal + authors of the Document (all of its principal authors, if it + has less than five). + C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. + D. Preserve all the copyright notices of the Document. + E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + F. Include, immediately after the copyright notices, a license + notice giving the public permission to use the Modified Version + under the terms of this License, in the form shown in the + Addendum below. + G. Preserve in that license notice the full lists of Invariant + Sections and required Cover Texts given in the Document's + license notice. + H. Include an unaltered copy of this License. + I. Preserve the section entitled "History", and its title, and add + to it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. + If there is no section entitled "History" in the Document, + create one stating the title, year, authors, and publisher of + the Document as given on its Title Page, then add an item + describing the Modified Version as stated in the previous + sentence. + J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and + likewise the network locations given in the Document for + previous versions it was based on. These may be placed in the + "History" section. You may omit a network location for a work + that was published at least four years before the Document + itself, or if the original publisher of the version it refers + to gives permission. + K. In any section entitled "Acknowledgements" or "Dedications", + preserve the section's title, and preserve in the section all the + substance and tone of each of the contributor acknowledgements + and/or dedications given therein. + L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. + M. Delete any section entitled "Endorsements." Such a section + may not be included in the Modified Version. + N. Do not retitle any existing section as "Endorsements" or to + conflict in title with any Invariant Section. + + If the Modified Version includes new front-matter sections or + appendices that qualify as Secondary Sections and contain no + material copied from the Document, you may at your option + designate some or all of these sections as invariant. To do this, + add their titles to the list of Invariant Sections in the Modified + Version's license notice. These titles must be distinct from any + other section titles. + + You may add a section entitled "Endorsements", provided it contains + nothing but endorsements of your Modified Version by various + parties-for example, statements of peer review or that the text has + been approved by an organization as the authoritative definition + of a standard. + + You may add a passage of up to five words as a Front-Cover Text, + and a passage of up to 25 words as a Back-Cover Text, to the end + of the list of Cover Texts in the Modified Version. Only one + passage of Front-Cover Text and one of Back-Cover Text may be + added by (or through arrangements made by) any one entity. If the + Document already includes a cover text for the same cover, + previously added by you or by arrangement made by the same entity + you are acting on behalf of, you may not add another; but you may + replace the old one, on explicit permission from the previous + publisher that added the old one. + + The author(s) and publisher(s) of the Document do not by this + License give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version. + + 5. COMBINING DOCUMENTS + + You may combine the Document with other documents released under + this License, under the terms defined in section 4 above for + modified versions, provided that you include in the combination + all of the Invariant Sections of all of the original documents, + unmodified, and list them all as Invariant Sections of your + combined work in its license notice. + + The combined work need only contain one copy of this License, and + multiple identical Invariant Sections may be replaced with a single + copy. If there are multiple Invariant Sections with the same name + but different contents, make the title of each such section unique + by adding at the end of it, in parentheses, the name of the + original author or publisher of that section if known, or else a + unique number. Make the same adjustment to the section titles in + the list of Invariant Sections in the license notice of the + combined work. + + In the combination, you must combine any sections entitled + "History" in the various original documents, forming one section + entitled "History"; likewise combine any sections entitled + "Acknowledgements", and any sections entitled "Dedications." You + must delete all sections entitled "Endorsements." + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other + documents released under this License, and replace the individual + copies of this License in the various documents with a single copy + that is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the + documents in all other respects. + + You may extract a single document from such a collection, and + distribute it individually under this License, provided you insert + a copy of this License into the extracted document, and follow + this License in all other respects regarding verbatim copying of + that document. + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with other + separate and independent documents or works, in or on a volume of + a storage or distribution medium, does not as a whole count as a + Modified Version of the Document, provided no compilation + copyright is claimed for the compilation. Such a compilation is + called an "aggregate", and this License does not apply to the + other self-contained works thus compiled with the Document, on + account of their being thus compiled, if they are not themselves + derivative works of the Document. + + If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one + quarter of the entire aggregate, the Document's Cover Texts may be + placed on covers that surround only the Document within the + aggregate. Otherwise they must appear on covers around the whole + aggregate. + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section + 4. Replacing Invariant Sections with translations requires special + permission from their copyright holders, but you may include + translations of some or all Invariant Sections in addition to the + original versions of these Invariant Sections. You may include a + translation of this License provided that you also include the + original English version of this License. In case of a + disagreement between the translation and the original English + version of this License, the original English version will prevail. + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document + except as expressly provided for under this License. Any other + attempt to copy, modify, sublicense or distribute the Document 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. + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software Foundation may publish new, revised versions of + the GNU Free Documentation 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. See + http://www.gnu.org/copyleft/. + + Each version of the License is given a distinguishing version + number. If the Document specifies that a particular numbered + version of this License "or any later version" applies to it, you + have the option of following the terms and conditions either of + that specified version or of any later version that has been + published (not as a draft) by the Free Software Foundation. If + the Document does not specify a version number of this License, + you may choose any version ever published (not as a draft) by the + Free Software Foundation. + + +ADDENDUM: How to use this License for your documents +==================================================== + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and license +notices just after the title page: + + Copyright (C) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 + or any later version published by the Free Software Foundation; + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. + A copy of the license is included in the section entitled "GNU + Free Documentation License." + + If you have no Invariant Sections, write "with no Invariant Sections" +instead of saying which ones are invariant. If you have no Front-Cover +Texts, write "no Front-Cover Texts" instead of "Front-Cover Texts being +LIST"; likewise for Back-Cover Texts. + + If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, to +permit their use in free software. + + +File: binutils.info, Node: Index, Prev: GNU Free Documentation License, Up: Top + +Index +***** + +* Menu: + +* .stab: objdump. +* addr2line: addr2line. +* address to file name and line number: addr2line. +* all header information, object file: objdump. +* ar: ar. +* ar compatibility: ar. +* architecture: objdump. +* architectures available: objdump. +* archive contents: ranlib. +* archive headers: objdump. +* archives: ar. +* base files: dlltool. +* bug criteria: Bug Criteria. +* bug reports: Bug Reporting. +* bugs: Reporting Bugs. +* bugs, reporting: Bug Reporting. +* c++filt: c++filt. +* changing object addresses: objcopy. +* changing section address: objcopy. +* changing section LMA: objcopy. +* changing section VMA: objcopy. +* changing start address: objcopy. +* collections of files: ar. +* compatibility, ar: ar. +* contents of archive: ar cmdline. +* crash: Bug Criteria. +* creating archives: ar cmdline. +* cxxfilt: c++filt. +* dates in archive: ar cmdline. +* debug symbols: objdump. +* debugging symbols: nm. +* deleting from archive: ar cmdline. +* demangling C++ symbols: c++filt. +* demangling in nm: nm. +* demangling in objdump <1>: addr2line. +* demangling in objdump: objdump. +* disassembling object code: objdump. +* disassembly architecture: objdump. +* disassembly endianness: objdump. +* disassembly, with source: objdump. +* discarding symbols: strip. +* DLL: dlltool. +* dlltool: dlltool. +* dynamic relocation entries, in object file: objdump. +* dynamic symbol table entries, printing: objdump. +* dynamic symbols: nm. +* ELF core notes: readelf. +* ELF dynamic section information: readelf. +* ELF file header information: readelf. +* ELF file information: readelf. +* ELF object file format: objdump. +* ELF program header information: readelf. +* ELF reloc information: readelf. +* ELF section information: readelf. +* ELF segment information: readelf. +* ELF symbol table information: readelf. +* ELF version sections informations: readelf. +* endianness: objdump. +* error on valid input: Bug Criteria. +* external symbols: nm. +* extract from archive: ar cmdline. +* fatal signal: Bug Criteria. +* file name: nm. +* header information, all: objdump. +* input .def file: dlltool. +* input file name: nm. +* libraries: ar. +* listings strings: strings. +* machine instructions: objdump. +* moving in archive: ar cmdline. +* MRI compatibility, ar: ar scripts. +* name duplication in archive: ar cmdline. +* name length: ar. +* nm: nm. +* nm compatibility: nm. +* nm format: nm. +* not writing archive index: ar cmdline. +* objdump: objdump. +* object code format <1>: addr2line. +* object code format <2>: strings. +* object code format <3>: size. +* object code format <4>: objdump. +* object code format: nm. +* object file header: objdump. +* object file information: objdump. +* object file sections: objdump. +* object formats available: objdump. +* operations on archive: ar cmdline. +* printing from archive: ar cmdline. +* printing strings: strings. +* quick append to archive: ar cmdline. +* radix for section sizes: size. +* ranlib: ranlib. +* readelf: readelf. +* relative placement in archive: ar cmdline. +* relocation entries, in object file: objdump. +* removing symbols: strip. +* repeated names in archive: ar cmdline. +* replacement in archive: ar cmdline. +* reporting bugs: Reporting Bugs. +* scripts, ar: ar scripts. +* section addresses in objdump: objdump. +* section headers: objdump. +* section information: objdump. +* section sizes: size. +* sections, full contents: objdump. +* size: size. +* size display format: size. +* size number format: size. +* sorting symbols: nm. +* source code context: objdump. +* source disassembly: objdump. +* source file name: nm. +* source filenames for object files: objdump. +* stab: objdump. +* start-address: objdump. +* stop-address: objdump. +* strings: strings. +* strings, printing: strings. +* strip: strip. +* symbol index <1>: ranlib. +* symbol index: ar. +* symbol index, listing: nm. +* symbol line numbers: nm. +* symbol table entries, printing: objdump. +* symbols: nm. +* symbols, discarding: strip. +* undefined symbols: nm. +* Unix compatibility, ar: ar cmdline. +* unwind information: readelf. +* updating an archive: ar cmdline. +* version: Top. +* VMA in objdump: objdump. +* wide output, printing: objdump. +* writing archive index: ar cmdline. + + + +Tag Table: +Node: Top1675 +Node: ar3157 +Node: ar cmdline5331 +Node: ar scripts13466 +Node: nm19146 +Node: objcopy26797 +Node: objdump48201 +Node: ranlib62059 +Node: size62810 +Node: strings65673 +Node: strip68019 +Node: c++filt73225 +Ref: c++filt-Footnote-176536 +Node: addr2line76642 +Node: nlmconv79236 +Node: windres81836 +Node: dlltool87563 +Node: readelf97260 +Node: Selecting The Target System101626 +Node: Target Selection102545 +Node: Architecture Selection104517 +Node: Reporting Bugs105335 +Node: Bug Criteria106108 +Node: Bug Reporting106651 +Node: GNU Free Documentation License113735 +Node: Index133438 + +End Tag Table diff --git a/binutils/doc/nlmconv.1 b/binutils/doc/nlmconv.1 new file mode 100644 index 0000000000000..ded0289e79046 --- /dev/null +++ b/binutils/doc/nlmconv.1 @@ -0,0 +1,230 @@ +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. | will give a +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to +.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' +.\" expand to `' in nroff, nothing in troff, for use with C<>. +.tr \(*W-|\(bv\*(Tr +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.hy 0 +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "NLMCONV 1" +.TH NLMCONV 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.SH "NAME" +nlmconv \- converts object code into an NLM. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +nlmconv [\fB\-I\fR \fIbfdname\fR|\fB\-\-input\-target=\fR\fIbfdname\fR] + [\fB\-O\fR \fIbfdname\fR|\fB\-\-output\-target=\fR\fIbfdname\fR] + [\fB\-T\fR \fIheaderfile\fR|\fB\-\-header\-file=\fR\fIheaderfile\fR] + [\fB\-d\fR|\fB\-\-debug\fR] [\fB\-l\fR \fIlinker\fR|\fB\-\-linker=\fR\fIlinker\fR] + [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] + \fIinfile\fR \fIoutfile\fR +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBnlmconv\fR converts the relocatable \fBi386\fR object file +\&\fIinfile\fR into the NetWare Loadable Module \fIoutfile\fR, optionally +reading \fIheaderfile\fR for \s-1NLM\s0 header information. For instructions +on writing the \s-1NLM\s0 command file language used in header files, see the +\&\fBlinkers\fR section, \fB\s-1NLMLINK\s0\fR in particular, of the \fI\s-1NLM\s0 +Development and Tools Overview\fR, which is part of the \s-1NLM\s0 Software +Developer's Kit (``\s-1NLM\s0 \s-1SDK\s0''), available from Novell, Inc. +\&\fBnlmconv\fR uses the \s-1GNU\s0 Binary File Descriptor library to read +\&\fIinfile\fR; +.PP +\&\fBnlmconv\fR can perform a link step. In other words, you can list +more than one object file for input if you list them in the definitions +file (rather than simply specifying one input file on the command line). +In this case, \fBnlmconv\fR calls the linker for you. +.SH "OPTIONS" +.IX Header "OPTIONS" +.IP "\fB\-I\fR \fIbfdname\fR" 4 +.IX Item "-I bfdname" +.PD 0 +.IP "\fB\-\-input\-target=\fR\fIbfdname\fR" 4 +.IX Item "--input-target=bfdname" +.PD +Object format of the input file. \fBnlmconv\fR can usually determine +the format of a given file (so no default is necessary). +.IP "\fB\-O\fR \fIbfdname\fR" 4 +.IX Item "-O bfdname" +.PD 0 +.IP "\fB\-\-output\-target=\fR\fIbfdname\fR" 4 +.IX Item "--output-target=bfdname" +.PD +Object format of the output file. \fBnlmconv\fR infers the output +format based on the input format, e.g. for a \fBi386\fR input file the +output format is \fBnlm32\-i386\fR. +.IP "\fB\-T\fR \fIheaderfile\fR" 4 +.IX Item "-T headerfile" +.PD 0 +.IP "\fB\-\-header\-file=\fR\fIheaderfile\fR" 4 +.IX Item "--header-file=headerfile" +.PD +Reads \fIheaderfile\fR for \s-1NLM\s0 header information. For instructions on +writing the \s-1NLM\s0 command file language used in header files, see see the +\&\fBlinkers\fR section, of the \fI\s-1NLM\s0 Development and Tools +Overview\fR, which is part of the \s-1NLM\s0 Software Developer's Kit, available +from Novell, Inc. +.IP "\fB\-d\fR" 4 +.IX Item "-d" +.PD 0 +.IP "\fB\-\-debug\fR" 4 +.IX Item "--debug" +.PD +Displays (on standard error) the linker command line used by \fBnlmconv\fR. +.IP "\fB\-l\fR \fIlinker\fR" 4 +.IX Item "-l linker" +.PD 0 +.IP "\fB\-\-linker=\fR\fIlinker\fR" 4 +.IX Item "--linker=linker" +.PD +Use \fIlinker\fR for any linking. \fIlinker\fR can be an absolute or a +relative pathname. +.IP "\fB\-h\fR" 4 +.IX Item "-h" +.PD 0 +.IP "\fB\-\-help\fR" 4 +.IX Item "--help" +.PD +Prints a usage summary. +.IP "\fB\-V\fR" 4 +.IX Item "-V" +.PD 0 +.IP "\fB\-\-version\fR" 4 +.IX Item "--version" +.PD +Prints the version number for \fBnlmconv\fR. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +the Info entries for \fIbinutils\fR. +.SH "COPYRIGHT" +.IX Header "COPYRIGHT" +Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, +2001, 2002, 2003 Free Software Foundation, Inc. +.PP +Permission is granted to copy, distribute and/or modify this document +under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 +or any later version published by the Free Software Foundation; +with no Invariant Sections, with no Front-Cover Texts, and with no +Back-Cover Texts. A copy of the license is included in the +section entitled ``\s-1GNU\s0 Free Documentation License''. diff --git a/binutils/doc/windres.1 b/binutils/doc/windres.1 new file mode 100644 index 0000000000000..ebaa5ebd289e8 --- /dev/null +++ b/binutils/doc/windres.1 @@ -0,0 +1,330 @@ +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. | will give a +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to +.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' +.\" expand to `' in nroff, nothing in troff, for use with C<>. +.tr \(*W-|\(bv\*(Tr +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.hy 0 +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "WINDRES 1" +.TH WINDRES 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.SH "NAME" +windres \- manipulate Windows resources. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +windres [options] [input\-file] [output\-file] +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBwindres\fR reads resources from an input file and copies them into +an output file. Either file may be in one of three formats: +.ie n .IP """rc""" 4 +.el .IP "\f(CWrc\fR" 4 +.IX Item "rc" +A text format read by the Resource Compiler. +.ie n .IP """res""" 4 +.el .IP "\f(CWres\fR" 4 +.IX Item "res" +A binary format generated by the Resource Compiler. +.ie n .IP """coff""" 4 +.el .IP "\f(CWcoff\fR" 4 +.IX Item "coff" +A \s-1COFF\s0 object or executable. +.PP +The exact description of these different formats is available in +documentation from Microsoft. +.PP +When \fBwindres\fR converts from the \f(CW\*(C`rc\*(C'\fR format to the \f(CW\*(C`res\*(C'\fR +format, it is acting like the Windows Resource Compiler. When +\&\fBwindres\fR converts from the \f(CW\*(C`res\*(C'\fR format to the \f(CW\*(C`coff\*(C'\fR +format, it is acting like the Windows \f(CW\*(C`CVTRES\*(C'\fR program. +.PP +When \fBwindres\fR generates an \f(CW\*(C`rc\*(C'\fR file, the output is similar +but not identical to the format expected for the input. When an input +\&\f(CW\*(C`rc\*(C'\fR file refers to an external filename, an output \f(CW\*(C`rc\*(C'\fR file +will instead include the file contents. +.PP +If the input or output format is not specified, \fBwindres\fR will +guess based on the file name, or, for the input file, the file contents. +A file with an extension of \fI.rc\fR will be treated as an \f(CW\*(C`rc\*(C'\fR +file, a file with an extension of \fI.res\fR will be treated as a +\&\f(CW\*(C`res\*(C'\fR file, and a file with an extension of \fI.o\fR or +\&\fI.exe\fR will be treated as a \f(CW\*(C`coff\*(C'\fR file. +.PP +If no output file is specified, \fBwindres\fR will print the resources +in \f(CW\*(C`rc\*(C'\fR format to standard output. +.PP +The normal use is for you to write an \f(CW\*(C`rc\*(C'\fR file, use \fBwindres\fR +to convert it to a \s-1COFF\s0 object file, and then link the \s-1COFF\s0 file into +your application. This will make the resources described in the +\&\f(CW\*(C`rc\*(C'\fR file available to Windows. +.SH "OPTIONS" +.IX Header "OPTIONS" +.IP "\fB\-i\fR \fIfilename\fR" 4 +.IX Item "-i filename" +.PD 0 +.IP "\fB\-\-input\fR \fIfilename\fR" 4 +.IX Item "--input filename" +.PD +The name of the input file. If this option is not used, then +\&\fBwindres\fR will use the first non-option argument as the input file +name. If there are no non-option arguments, then \fBwindres\fR will +read from standard input. \fBwindres\fR can not read a \s-1COFF\s0 file from +standard input. +.IP "\fB\-o\fR \fIfilename\fR" 4 +.IX Item "-o filename" +.PD 0 +.IP "\fB\-\-output\fR \fIfilename\fR" 4 +.IX Item "--output filename" +.PD +The name of the output file. If this option is not used, then +\&\fBwindres\fR will use the first non-option argument, after any used +for the input file name, as the output file name. If there is no +non-option argument, then \fBwindres\fR will write to standard output. +\&\fBwindres\fR can not write a \s-1COFF\s0 file to standard output. Note, +for compatability with \fBrc\fR the option \fB\-fo\fR is also +accepted, but its use is not recommended. +.IP "\fB\-J\fR \fIformat\fR" 4 +.IX Item "-J format" +.PD 0 +.IP "\fB\-\-input\-format\fR \fIformat\fR" 4 +.IX Item "--input-format format" +.PD +The input format to read. \fIformat\fR may be \fBres\fR, \fBrc\fR, or +\&\fBcoff\fR. If no input format is specified, \fBwindres\fR will +guess, as described above. +.IP "\fB\-O\fR \fIformat\fR" 4 +.IX Item "-O format" +.PD 0 +.IP "\fB\-\-output\-format\fR \fIformat\fR" 4 +.IX Item "--output-format format" +.PD +The output format to generate. \fIformat\fR may be \fBres\fR, +\&\fBrc\fR, or \fBcoff\fR. If no output format is specified, +\&\fBwindres\fR will guess, as described above. +.IP "\fB\-F\fR \fItarget\fR" 4 +.IX Item "-F target" +.PD 0 +.IP "\fB\-\-target\fR \fItarget\fR" 4 +.IX Item "--target target" +.PD +Specify the \s-1BFD\s0 format to use for a \s-1COFF\s0 file as input or output. This +is a \s-1BFD\s0 target name; you can use the \fB\-\-help\fR option to see a list +of supported targets. Normally \fBwindres\fR will use the default +format, which is the first one listed by the \fB\-\-help\fR option. +.IP "\fB\-\-preprocessor\fR \fIprogram\fR" 4 +.IX Item "--preprocessor program" +When \fBwindres\fR reads an \f(CW\*(C`rc\*(C'\fR file, it runs it through the C +preprocessor first. This option may be used to specify the preprocessor +to use, including any leading arguments. The default preprocessor +argument is \f(CW\*(C`gcc \-E \-xc\-header \-DRC_INVOKED\*(C'\fR. +.IP "\fB\-I\fR \fIdirectory\fR" 4 +.IX Item "-I directory" +.PD 0 +.IP "\fB\-\-include\-dir\fR \fIdirectory\fR" 4 +.IX Item "--include-dir directory" +.PD +Specify an include directory to use when reading an \f(CW\*(C`rc\*(C'\fR file. +\&\fBwindres\fR will pass this to the preprocessor as an \fB\-I\fR +option. \fBwindres\fR will also search this directory when looking for +files named in the \f(CW\*(C`rc\*(C'\fR file. If the argument passed to this command +matches any of the supported \fIformats\fR (as descrived in the \fB\-J\fR +option), it will issue a deprecation warning, and behave just like the +\&\fB\-J\fR option. New programs should not use this behaviour. If a +directory happens to match a \fIformat\fR, simple prefix it with \fB./\fR +to disable the backward compatibility. +.IP "\fB\-D\fR \fItarget\fR" 4 +.IX Item "-D target" +.PD 0 +.IP "\fB\-\-define\fR \fIsym\fR\fB[=\fR\fIval\fR\fB]\fR" 4 +.IX Item "--define sym[=val]" +.PD +Specify a \fB\-D\fR option to pass to the preprocessor when reading an +\&\f(CW\*(C`rc\*(C'\fR file. +.IP "\fB\-U\fR \fItarget\fR" 4 +.IX Item "-U target" +.PD 0 +.IP "\fB\-\-undefine\fR \fIsym\fR" 4 +.IX Item "--undefine sym" +.PD +Specify a \fB\-U\fR option to pass to the preprocessor when reading an +\&\f(CW\*(C`rc\*(C'\fR file. +.IP "\fB\-r\fR" 4 +.IX Item "-r" +Ignored for compatibility with rc. +.IP "\fB\-v\fR" 4 +.IX Item "-v" +Enable verbose mode. This tells you what the preprocessor is if you +didn't specify one. +.IP "\fB\-l\fR \fIval\fR" 4 +.IX Item "-l val" +.PD 0 +.IP "\fB\-\-language\fR \fIval\fR" 4 +.IX Item "--language val" +.PD +Specify the default language to use when reading an \f(CW\*(C`rc\*(C'\fR file. +\&\fIval\fR should be a hexadecimal language code. The low eight bits are +the language, and the high eight bits are the sublanguage. +.IP "\fB\-\-use\-temp\-file\fR" 4 +.IX Item "--use-temp-file" +Use a temporary file to instead of using popen to read the output of +the preprocessor. Use this option if the popen implementation is buggy +on the host (eg., certain non-English language versions of Windows 95 and +Windows 98 are known to have buggy popen where the output will instead +go the console). +.IP "\fB\-\-no\-use\-temp\-file\fR" 4 +.IX Item "--no-use-temp-file" +Use popen, not a temporary file, to read the output of the preprocessor. +This is the default behaviour. +.IP "\fB\-h\fR" 4 +.IX Item "-h" +.PD 0 +.IP "\fB\-\-help\fR" 4 +.IX Item "--help" +.PD +Prints a usage summary. +.IP "\fB\-V\fR" 4 +.IX Item "-V" +.PD 0 +.IP "\fB\-\-version\fR" 4 +.IX Item "--version" +.PD +Prints the version number for \fBwindres\fR. +.IP "\fB\-\-yydebug\fR" 4 +.IX Item "--yydebug" +If \fBwindres\fR is compiled with \f(CW\*(C`YYDEBUG\*(C'\fR defined as \f(CW1\fR, +this will turn on parser debugging. +.SH "SEE ALSO" +.IX Header "SEE ALSO" +the Info entries for \fIbinutils\fR. +.SH "COPYRIGHT" +.IX Header "COPYRIGHT" +Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, +2001, 2002, 2003 Free Software Foundation, Inc. +.PP +Permission is granted to copy, distribute and/or modify this document +under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 +or any later version published by the Free Software Foundation; +with no Invariant Sections, with no Front-Cover Texts, and with no +Back-Cover Texts. A copy of the license is included in the +section entitled ``\s-1GNU\s0 Free Documentation License''. diff --git a/binutils/dyn-string.c b/binutils/dyn-string.c deleted file mode 100644 index a164018276571..0000000000000 --- a/binutils/dyn-string.c +++ /dev/null @@ -1,107 +0,0 @@ -/* An abstract string datatype. - Copyright (C) 1998 Free Software Foundation, Inc. - Contributed by Mark Mitchell (mark@markmitchell.com). - - This file is part of GNU CC. - - GNU CC is free software; 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. - - GNU CC is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file lives in at least two places: binutils and gcc. - Don't change one without the other. */ - -#include "config.h" -#ifdef IN_GCC -#include "system.h" -#include "gansidecl.h" -#else -#include "ansidecl.h" -#endif -#include "dyn-string.h" - -extern char *xmalloc (); -extern char *xrealloc (); - -/* Create a new dynamic string capable of holding at least SPACE - characters, including the terminating NUL. If SPACE is 0, it - will be silently increased to 1. */ - -dyn_string_t -dyn_string_new (space) - int space; -{ - dyn_string_t result = (dyn_string_t) xmalloc (sizeof (struct dyn_string)); - - if (space == 0) - /* We need at least one byte in which to store the terminating - NUL. */ - space = 1; - - result->allocated = space; - result->s = (char*) xmalloc (space); - result->length = 0; - result->s[0] = '\0'; - - return result; -} - -/* Free the memory used by DS. */ - -void -dyn_string_delete (ds) - dyn_string_t ds; -{ - free (ds->s); - free (ds); -} - -/* Append the NUL-terminated string S to DS, resizing DS if - necessary. */ - -dyn_string_t -dyn_string_append (ds, s) - dyn_string_t ds; - char *s; -{ - int len = strlen (s); - dyn_string_resize (ds, ds->length + len + 1 /* '\0' */); - strcpy (ds->s + ds->length, s); - ds->length += len; - - return ds; -} - -/* Increase the capacity of DS so that it can hold at least SPACE - characters, including the terminating NUL. This function will not - (at present) reduce the capacity of DS. */ - -dyn_string_t -dyn_string_resize (ds, space) - dyn_string_t ds; - int space; -{ - int new_allocated = ds->allocated; - - while (space > new_allocated) - new_allocated *= 2; - - if (new_allocated != ds->allocated) - { - /* We actually need more space. */ - ds->allocated = new_allocated; - ds->s = (char*) xrealloc (ds->s, ds->allocated); - } - - return ds; -} diff --git a/binutils/dyn-string.h b/binutils/dyn-string.h deleted file mode 100644 index cbd25c347344f..0000000000000 --- a/binutils/dyn-string.h +++ /dev/null @@ -1,34 +0,0 @@ -/* An abstract string datatype. - Copyright (C) 1998 Free Software Foundation, Inc. - Contributed by Mark Mitchell (mark@markmitchell.com). - - This file is part of GNU CC. - - GNU CC is free software; 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. - - GNU CC is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* This file lives in at least two places: binutils and gcc. - Don't change one without the other. */ - -typedef struct dyn_string -{ - int allocated; /* The amount of space allocated for the string. */ - int length; /* The actual length of the string. */ - char *s; /* The string itself, NUL-terminated. */ -}* dyn_string_t; - -extern dyn_string_t dyn_string_new PARAMS((int)); -extern void dyn_string_delete PARAMS((dyn_string_t)); -extern dyn_string_t dyn_string_append PARAMS((dyn_string_t, char*)); -extern dyn_string_t dyn_string_resize PARAMS((dyn_string_t, int)); diff --git a/binutils/emul_aix.c b/binutils/emul_aix.c new file mode 100644 index 0000000000000..e7150aebaeb33 --- /dev/null +++ b/binutils/emul_aix.c @@ -0,0 +1,175 @@ +/* Binutils emulation layer. + Copyright 2002, 2003 Free Software Foundation, Inc. + Written by Tom Rix, Redhat. + + This file is part of GNU Binutils. + + This program is free software; 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. */ + +#include "binemul.h" +#include "bfdlink.h" +#include "coff/internal.h" +#include "coff/xcoff.h" +#include "libcoff.h" +#include "libxcoff.h" + +/* Default to . */ +static bfd_boolean big_archive = TRUE; + +/* Whether to include 32 bit objects. */ +static bfd_boolean X32 = TRUE; + +/* Whether to include 64 bit objects. */ +static bfd_boolean X64 = FALSE; + +static void ar_emul_aix_usage (FILE *); +static bfd_boolean ar_emul_aix_append (bfd **, char *, bfd_boolean); +static bfd_boolean ar_emul_aix5_append (bfd **, char *, bfd_boolean); +static bfd_boolean ar_emul_aix_replace (bfd **, char *, bfd_boolean); +static bfd_boolean ar_emul_aix5_replace (bfd **, char *, bfd_boolean); +static bfd_boolean ar_emul_aix_parse_arg (char *); +static bfd_boolean ar_emul_aix_internal + (bfd **, char *, bfd_boolean, const char *, bfd_boolean); + +static void +ar_emul_aix_usage (FILE *fp) +{ + AR_EMUL_USAGE_PRINT_OPTION_HEADER (fp); + /* xgettext:c-format */ + fprintf (fp, _(" [-g] - 32 bit small archive\n")); + fprintf (fp, _(" [-X32] - ignores 64 bit objects\n")); + fprintf (fp, _(" [-X64] - ignores 32 bit objects\n")); + fprintf (fp, _(" [-X32_64] - accepts 32 and 64 bit objects\n")); +} + +static bfd_boolean +ar_emul_aix_internal (bfd **after_bfd, char *file_name, bfd_boolean verbose, + const char * target_name, bfd_boolean is_append) +{ + bfd *temp; + bfd *try_bfd; + + temp = *after_bfd; + + /* Try 64 bit. */ + try_bfd = bfd_openr (file_name, target_name); + + /* Failed or the object is possibly 32 bit. */ + if (NULL == try_bfd || ! bfd_check_format (try_bfd, bfd_object)) + try_bfd = bfd_openr (file_name, "aixcoff-rs6000"); + + AR_EMUL_ELEMENT_CHECK (try_bfd, file_name); + + if (bfd_xcoff_is_xcoff64 (try_bfd) && (! X64)) + return FALSE; + + if (bfd_xcoff_is_xcoff32 (try_bfd) + && bfd_check_format (try_bfd, bfd_object) && (! X32)) + return FALSE; + + if (is_append) + { + AR_EMUL_APPEND_PRINT_VERBOSE (verbose, file_name); + } + else + { + AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, file_name); + } + + *after_bfd = try_bfd; + (*after_bfd)->next = temp; + + return TRUE; +} + + +static bfd_boolean +ar_emul_aix_append (bfd **after_bfd, char *file_name, bfd_boolean verbose) +{ + return ar_emul_aix_internal (after_bfd, file_name, verbose, + "aixcoff64-rs6000", TRUE); +} + +static bfd_boolean +ar_emul_aix5_append (bfd **after_bfd, char *file_name, bfd_boolean verbose) +{ + return ar_emul_aix_internal (after_bfd, file_name, verbose, + "aix5coff64-rs6000", TRUE); +} + +static bfd_boolean +ar_emul_aix_replace (bfd **after_bfd, char *file_name, bfd_boolean verbose) +{ + return ar_emul_aix_internal (after_bfd, file_name, verbose, + "aixcoff64-rs6000", FALSE); +} + +static bfd_boolean +ar_emul_aix5_replace (bfd **after_bfd, char *file_name, bfd_boolean verbose) +{ + return ar_emul_aix_internal (after_bfd, file_name, verbose, + "aix5coff64-rs6000", FALSE); +} + +static bfd_boolean +ar_emul_aix_parse_arg (char *arg) +{ + if (strncmp (arg, "-X32_64", 6) == 0) + { + big_archive = TRUE; + X32 = TRUE; + X64 = TRUE; + } + else if (strncmp (arg, "-X32", 3) == 0) + { + big_archive = TRUE; + X32 = TRUE; + X64 = FALSE; + } + else if (strncmp (arg, "-X64", 3) == 0) + { + big_archive = TRUE; + X32 = FALSE; + X64 = TRUE; + } + else if (strncmp (arg, "-g", 2) == 0) + { + big_archive = FALSE; + X32 = TRUE; + X64 = FALSE; + } + else + return FALSE; + + return TRUE; +} + +struct bin_emulation_xfer_struct bin_aix_emulation = +{ + ar_emul_aix_usage, + ar_emul_aix_append, + ar_emul_aix_replace, + ar_emul_default_create, + ar_emul_aix_parse_arg, +}; + +struct bin_emulation_xfer_struct bin_aix5_emulation = +{ + ar_emul_aix_usage, + ar_emul_aix5_append, + ar_emul_aix5_replace, + ar_emul_default_create, + ar_emul_aix_parse_arg, +}; diff --git a/binutils/mac-binutils.r b/binutils/mac-binutils.r new file mode 100644 index 0000000000000..7b1a3035e2813 --- /dev/null +++ b/binutils/mac-binutils.r @@ -0,0 +1,42 @@ +/* Resources for GNU binutils. */ + +#include "SysTypes.r" + +/* Version resources. */ + +resource 'vers' (1) { + 0, + 0, + 0, + 0, + verUs, + VERSION_STRING, + VERSION_STRING " (C) 1986-95 FSF, Inc." +}; + +resource 'vers' (2, purgeable) { + 0, + 0, + 0, + 0, + verUs, + VERSION_STRING, + "binutils " VERSION_STRING " for MPW" +}; + +#ifdef WANT_CFRG + +#include "CodeFragmentTypes.r" + +resource 'cfrg' (0) { + { + kPowerPC, + kFullLib, + kNoVersionNum, kNoVersionNum, + 0,0, + kIsApp, kOnDiskFlat, kZeroOffset, kWholeFork, + PROG_NAME + } +}; + +#endif /* WANT_CFRG */ diff --git a/binutils/makefile.vms-in b/binutils/makefile.vms-in new file mode 100644 index 0000000000000..a809d1b13cd49 --- /dev/null +++ b/binutils/makefile.vms-in @@ -0,0 +1,98 @@ +# +# Makefile for binutils under openVMS (Alpha and Vax) +# +# For use with gnu-make for vms +# +# Created by Klaus K"ampf, kkaempf@rmi.de +# +# + +# Distribution version, filled in by configure.com +VERSION=@VERSION@ + +ifeq ($(ARCH),ALPHA) +TARGET=""vms-alpha"" +else +TARGET=""vms-vax"" +endif + +ifeq ($(CC),gcc) +CFLAGS=/include=([],[-.include],[-.bfd])$(DEFS) +DEFS=/define=("TARGET=$(TARGET)") +LIBS=,gnu_cc_library:libgcc/lib,sys$$library:vaxcrtl.olb/lib,gnu_cc_library:crt0.obj +else +CFLAGS=/noopt/debug/include=([],[-.include],[-.bfd])$(DEFS)\ +/warnings=disable=(missingreturn,implicitfunc,longextern) +DEFS=/define=("TARGET=$(TARGET)","const=","unlink=remove") +LIBS=,sys$$library:vaxcrtl.olb/lib +endif + +BFDLIB = [-.bfd]libbfd.olb/lib +BFDLIB_DEP = [-.bfd]libbfd.olb +LIBIBERTY_DEP = [-.libiberty]libiberty.olb +LIBIBERTY = [-.libiberty]libiberty.olb/lib +OPCODES_DEP = [-.opcodes]libopcodes.olb +OPCODES = [-.opcodes]libopcodes.olb/lib + +DEBUG_OBJS = rddbg.obj,debug.obj,stabs.obj,ieee.obj,rdcoff.obj + +WRITE_DEBUG_OBJS = $(DEBUG_OBJS),wrstabs.obj + +BULIBS = []bucomm.obj,version.obj,filemode.obj + +ADDL_DEPS = $(BULIBS),$(BFDLIB_DEP),$(LIBIBERTY_DEP) +ADDL_LIBS = $(BULIBS),$(BFDLIB),$(LIBIBERTY) + +SIZEOBJS = $(ADDL_DEPS),size.obj + +STRINGSOBJS = $(ADDL_DEPS),strings.obj + +NMOBJS = $(ADDL_DEPS),nm.obj + +OBJDUMPOBJS = $(ADDL_DEPS),objdump.obj,prdbg.obj,$(DEBUG_OBJS),$(OPCODES_DEP) + +all: config.h size.exe strings.exe objdump.exe nm.exe + +size.exe: $(SIZEOBJS) + link/exe=$@ size.obj,$(ADDL_LIBS)$(LIBS) + +strings.exe: $(STRINGSOBJS) + link/exe=$@ strings.obj,$(ADDL_LIBS)$(LIBS) + +nm.exe: $(NMOBJS) + link/exe=$@ nm.obj,$(ADDL_LIBS)$(LIBS) + +objdump.exe: $(OBJDUMPOBJS) + link/exe=$@ objdump.obj,prdbg.obj,$(DEBUG_OBJS),$(BFDLIB),$(OPCODES),$(ADDL_LIBS)$(LIBS) + + +version.obj: version.c + $(CC) $(CFLAGS)/define=(VERSION="""$(VERSION)""") $< + +config.h: + $$ @configure + $(MAKE) -f makefile.vms "CC=$(CC)" + +[-.bfd]libbfd.olb: + $(CD) [-.bfd] + $(MAKE) -f makefile.vms "CC=$(CC)" + $(CD) [-.binutils] + +[-.libiberty]libiberty.olb: + $(CD) [-.libiberty] + $(MAKE) -f makefile.vms "CC=$(CC)" + $(CD) [-.binutils] + +[-.opcodes]libopcodes.olb: + $(CD) [-.opcodes] + $(MAKE) -f makefile.vms "CC=$(CC)" + $(CD) [-.binutils] + +clean: + $$ purge + $(RM) *.obj; + $(RM) *.exe; + +distclean: clean + $(RM) config.h; + $(RM) makefile.vms; diff --git a/binutils/mpw-config.in b/binutils/mpw-config.in new file mode 100644 index 0000000000000..21a067ddd6bc7 --- /dev/null +++ b/binutils/mpw-config.in @@ -0,0 +1,27 @@ +# Configuration fragment for binutils. + +Set target_arch `echo {target_canonical} | sed -e 's/-.*-.*//'` + +# (should canonicalize arch name) */ + +Set archname ARCH_{target_arch} + +Set underscore 0 + +If "{target_canonical}" =~ /sh-hitachi-hms/ + Set underscore 1 +End If + +Echo '# From mpw-config.in' > "{o}"mk.tmp +Echo "ARCHDEFS = -d" {archname} >> "{o}"mk.tmp +Echo "UNDERSCORE = " {underscore} >> "{o}"mk.tmp +Echo "BUILD_NLMCONV = " >> "{o}"mk.tmp +Echo "BUILD_SRCONV = " >> "{o}"mk.tmp +Echo "SYSINFO_PROG = " >> "{o}"mk.tmp +Echo "BUILD_DLLTOOL = " >> "{o}"mk.tmp +Echo '# End from mpw-config.in' >> "{o}"mk.tmp + +Echo '/* config.h. Generated by mpw-configure. */' > "{o}"config.new +Echo '#include "mpw.h"' >> "{o}"config.new + +MoveIfChange "{o}"config.new "{o}"config.h diff --git a/binutils/mpw-make.sed b/binutils/mpw-make.sed new file mode 100644 index 0000000000000..03abffe18f8a2 --- /dev/null +++ b/binutils/mpw-make.sed @@ -0,0 +1,115 @@ +# Sed commands to finish translating the binutils Unix makefile into MPW syntax. + +# Add a rule. +/^#### .*/a\ +\ +"{o}"underscore.c.o \\Option-f "{o}"underscore.c\ + +# Comment out any alias settings. +/^host_alias =/s/^/#/ +/^target_alias =/s/^/#/ + +# Whack out unused host define bits. +/HDEFINES/s/@HDEFINES@// + +# Don't build specialized tools. +/BUILD_NLMCONV/s/@BUILD_NLMCONV@// +/BUILD_SRCONV/s/@BUILD_SRCONV@// +/BUILD_DLLTOOL/s/@BUILD_DLLTOOL@// + +/UNDERSCORE/s/@UNDERSCORE@/{UNDERSCORE}/ + +# Don't need this. +/@HLDFLAGS@/s/@HLDFLAGS@// + +# Point at the libraries directly. +/@BFDLIB@/s/@BFDLIB@/::bfd:libbfd.o/ +/@OPCODES@/s/@OPCODES@/::opcodes:libopcodes.o/ + +# Whack out target makefile fragment. +/target_makefile_fragment/s/target_makefile_fragment@// + +# Fix and add to the include paths. +/^INCLUDES = .*$/s/$/ -i "{INCDIR}":mpw: -i ::extra-include:/ +/BFDDIR/s/-i {BFDDIR} /-i "{BFDDIR}": / +/INCDIR/s/-i {INCDIR} /-i "{INCDIR}": / + +# Use byacc instead of bison (for now anyway). +/BISON/s/^BISON =.*$/BISON = byacc/ +#/BISONFLAGS/s/^BISONFLAGS =.*$/BISONFLAGS = / + +# Embed the version in symbolic doublequotes that will expand to +# the right thing for each compiler. +/VERSION/s/'"{VERSION}"'/{dq}{VERSION}{dq}/ + +# '+' is a special char to MPW, don't use it ever. +/c++filt/s/c++filt/cplusfilt/ + +# All of the binutils use the same Rez file, change names to refer to it. +/^{[A-Z]*_PROG}/s/$/ "{s}"mac-binutils.r/ +/{[A-Z]*_PROG}\.r/s/{[A-Z]*_PROG}\.r/mac-binutils.r/ + +# There are auto-generated references to BFD .h files that are not +# in the objdir (like bfd.h) but are in the source dir. +/::bfd:lib/s/::bfd:lib\([a-z]*\)\.h/{BFDDIR}:lib\1.h/g + +# Fix the locations of generated files. +/config/s/"{s}"config\.h/"{o}"config.h/g +/config/s/^config\.h/"{o}"config\.h/ +/underscore/s/"{s}"underscore\.c/"{o}"underscore.c/g +/underscore/s/^underscore\.c/"{o}"underscore\.c/ + +# Fix paths to generated source files. +/lex.yy.c/s/"{s}"lex\.yy\.c/"{o}"lex.yy.c/g +/lex.yy.c/s/^lex\.yy\.c/"{o}"lex.yy.c/ +/arlex.c/s/"{s}"arlex\.c/"{o}"arlex.c/g +/arlex.c/s/^arlex\.c/"{o}"arlex.c/ +/y.tab.c/s/"{s}"y\.tab\.c/"{o}"y.tab.c/g +/y.tab.c/s/^y\.tab\.c/"{o}"y.tab.c/ +/arparse.c/s/"{s}"arparse\.c/"{o}"arparse.c/g +/arparse.c/s/^arparse\.c/"{o}"arparse.c/ +/y.tab.h/s/"{s}"y\.tab\.h/"{o}"y.tab.h/g +/y.tab.h/s/^y\.tab\.h/"{o}"y.tab.h/ +/arparse.h/s/"{s}"arparse\.h/"{o}"arparse.h/g +/arparse.h/s/^arparse\.h/"{o}"arparse.h/ + +/"{s}"{INCDIR}/s/"{s}"{INCDIR}/"{INCDIR}"/g + +# The generated lexer may include an ifdef for older Mac compilers that +# needs to work with newer compilers also. +/lex.yy.c/s/Rename -y \([^ ]*\) \([^ ]*\)$/sed -e 's,ifdef macintosh,if defined(macintosh) || defined(__MWERKS__),' \1 > \2/ + +# Fix an over-eagerness. +/echo.*WARNING.*This file/s/'.*'/' '/ + +# Add a "stamps" target. +$a\ +stamps \\Option-f stamp-under\ + +/^install \\Option-f /,/^$/c\ +install \\Option-f all install-only\ +\ +install-only \\Option-f\ + NewFolderRecursive "{bindir}"\ + # Need to copy all the tools\ + For prog in {PROGS}\ + Set progname `echo {prog} | sed -e 's/.new//'`\ + Duplicate -y :{prog} "{bindir}"{progname}\ + End For\ + + +/true/s/ ; @true$// + +# dot files are trouble, remove them and their actions. +/^\.dep/,/^$/d + +# Remove un-useful targets. +/^Makefile \\Option-f/,/^$/d +/^"{o}"config.h \\Option-f/,/^$/d +/^config.status \\Option-f/,/^$/d + +# Don't try to make the demangler's man page, it's useless. +/^{DEMANGLER_PROG}\.1 \\Option-f/,/^$/d +# Don't depend on it either. +/{DEMANGLER_PROG}/s/ {DEMANGLER_PROG}\.1// + diff --git a/binutils/nlmconv.c b/binutils/nlmconv.c new file mode 100644 index 0000000000000..5a644e44669f8 --- /dev/null +++ b/binutils/nlmconv.c @@ -0,0 +1,2128 @@ +/* nlmconv.c -- NLM conversion program + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + This file is part of GNU Binutils. + + This program is free software; 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. */ + +/* Written by Ian Lance Taylor . + + This program can be used to convert any appropriate object file + into a NetWare Loadable Module (an NLM). It will accept a linker + specification file which is identical to that accepted by the + NetWare linker, NLMLINK. */ + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# ifdef _AIX + #pragma alloca +#endif +#endif + +#include "bfd.h" +#include "libiberty.h" +#include "bucomm.h" +#include "safe-ctype.h" + +#include "ansidecl.h" +#include +#include +#include +#include +#include "getopt.h" + +/* Internal BFD NLM header. */ +#include "libnlm.h" +#include "nlmconv.h" + +#ifdef NLMCONV_ALPHA +#include "coff/sym.h" +#include "coff/ecoff.h" +#endif + +/* If strerror is just a macro, we want to use the one from libiberty + since it will handle undefined values. */ +#undef strerror +extern char *strerror (int); + +#ifndef localtime +extern struct tm *localtime (); +#endif + +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif + +#ifndef R_OK +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#endif + +/* Global variables. */ + +/* The name used to invoke the program. */ +char *program_name; + +/* Local variables. */ + +/* Whether to print out debugging information (currently just controls + whether it prints the linker command if there is one). */ +static int debug; + +/* The symbol table. */ +static asymbol **symbols; + +/* A section we create in the output file to hold pointers to where + the sections of the input file end up. We will put a pointer to + this section in the NLM header. These is an entry for each input + section. The format is + null terminated section name + zeroes to adjust to 4 byte boundary + 4 byte section data file pointer + 4 byte section size + We don't need a version number. The way we find this information + is by finding a stamp in the NLM header information. If we need to + change the format of this information, we can simply change the + stamp. */ +static asection *secsec; + +/* A temporary file name to be unlinked on exit. Actually, for most + errors, we leave it around. It's not clear whether that is helpful + or not. */ +static char *unlink_on_exit; + +/* The list of long options. */ +static struct option long_options[] = +{ + { "debug", no_argument, 0, 'd' }, + { "header-file", required_argument, 0, 'T' }, + { "help", no_argument, 0, 'h' }, + { "input-target", required_argument, 0, 'I' }, + { "input-format", required_argument, 0, 'I' }, /* Obsolete */ + { "linker", required_argument, 0, 'l' }, + { "output-target", required_argument, 0, 'O' }, + { "output-format", required_argument, 0, 'O' }, /* Obsolete */ + { "version", no_argument, 0, 'V' }, + { NULL, no_argument, 0, 0 } +}; + +/* Local routines. */ + +int main (int, char **); + +static void show_usage (FILE *, int); +static const char *select_output_format + (enum bfd_architecture, unsigned long, bfd_boolean); +static void setup_sections (bfd *, asection *, void *); +static void copy_sections (bfd *, asection *, void *); +static void mangle_relocs + (bfd *, asection *, arelent ***, long *, char *, bfd_size_type); +static void default_mangle_relocs + (bfd *, asection *, arelent ***, long *, char *, bfd_size_type); +static char *link_inputs (struct string_list *, char *); + +#ifdef NLMCONV_I386 +static void i386_mangle_relocs (bfd *, asection *, arelent ***, long *, char *, bfd_size_type); +#endif + +#ifdef NLMCONV_ALPHA +static void alpha_mangle_relocs (bfd *, asection *, arelent ***, long *, char *, bfd_size_type); +#endif + +#ifdef NLMCONV_POWERPC +static void powerpc_build_stubs (bfd *, bfd *, asymbol ***, long *); +static void powerpc_resolve_stubs (bfd *, bfd *); +static void powerpc_mangle_relocs (bfd *, asection *, arelent ***, long *, char *, bfd_size_type); +#endif + +/* The main routine. */ + +int +main (int argc, char **argv) +{ + int opt; + char *input_file = NULL; + const char *input_format = NULL; + const char *output_format = NULL; + const char *header_file = NULL; + char *ld_arg = NULL; + Nlm_Internal_Fixed_Header fixed_hdr_struct; + Nlm_Internal_Variable_Header var_hdr_struct; + Nlm_Internal_Version_Header version_hdr_struct; + Nlm_Internal_Copyright_Header copyright_hdr_struct; + Nlm_Internal_Extended_Header extended_hdr_struct; + bfd *inbfd; + bfd *outbfd; + asymbol **newsyms, **outsyms; + long symcount, newsymalloc, newsymcount; + long symsize; + asection *text_sec, *bss_sec, *data_sec; + bfd_vma vma; + bfd_size_type align; + asymbol *endsym; + long i; + char inlead, outlead; + bfd_boolean gotstart, gotexit, gotcheck; + struct stat st; + FILE *custom_data = NULL; + FILE *help_data = NULL; + FILE *message_data = NULL; + FILE *rpc_data = NULL; + FILE *shared_data = NULL; + size_t custom_size = 0; + size_t help_size = 0; + size_t message_size = 0; + size_t module_size = 0; + size_t rpc_size = 0; + asection *custom_section = NULL; + asection *help_section = NULL; + asection *message_section = NULL; + asection *module_section = NULL; + asection *rpc_section = NULL; + asection *shared_section = NULL; + bfd *sharedbfd; + size_t shared_offset = 0; + size_t shared_size = 0; + Nlm_Internal_Fixed_Header sharedhdr; + int len; + char *modname; + char **matching; + +#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) + setlocale (LC_MESSAGES, ""); +#endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + + program_name = argv[0]; + xmalloc_set_program_name (program_name); + + bfd_init (); + set_default_bfd_target (); + + while ((opt = getopt_long (argc, argv, "dHhI:l:O:T:Vv", long_options, + (int *) NULL)) + != EOF) + { + switch (opt) + { + case 'd': + debug = 1; + break; + case 'H': + case 'h': + show_usage (stdout, 0); + break; + case 'I': + input_format = optarg; + break; + case 'l': + ld_arg = optarg; + break; + case 'O': + output_format = optarg; + break; + case 'T': + header_file = optarg; + break; + case 'v': + case 'V': + print_version ("nlmconv"); + break; + case 0: + break; + default: + show_usage (stderr, 1); + break; + } + } + + /* The input and output files may be named on the command line. */ + output_file = NULL; + if (optind < argc) + { + input_file = argv[optind]; + ++optind; + if (optind < argc) + { + output_file = argv[optind]; + ++optind; + if (optind < argc) + show_usage (stderr, 1); + if (strcmp (input_file, output_file) == 0) + { + fatal (_("input and output files must be different")); + } + } + } + + /* Initialize the header information to default values. */ + fixed_hdr = &fixed_hdr_struct; + memset ((void *) &fixed_hdr_struct, 0, sizeof fixed_hdr_struct); + var_hdr = &var_hdr_struct; + memset ((void *) &var_hdr_struct, 0, sizeof var_hdr_struct); + version_hdr = &version_hdr_struct; + memset ((void *) &version_hdr_struct, 0, sizeof version_hdr_struct); + copyright_hdr = ©right_hdr_struct; + memset ((void *) ©right_hdr_struct, 0, sizeof copyright_hdr_struct); + extended_hdr = &extended_hdr_struct; + memset ((void *) &extended_hdr_struct, 0, sizeof extended_hdr_struct); + check_procedure = NULL; + custom_file = NULL; + debug_info = FALSE; + exit_procedure = "_Stop"; + export_symbols = NULL; + map_file = NULL; + full_map = FALSE; + help_file = NULL; + import_symbols = NULL; + message_file = NULL; + modules = NULL; + sharelib_file = NULL; + start_procedure = "_Prelude"; + verbose = FALSE; + rpc_file = NULL; + + parse_errors = 0; + + /* Parse the header file (if there is one). */ + if (header_file != NULL) + { + if (! nlmlex_file (header_file) + || yyparse () != 0 + || parse_errors != 0) + exit (1); + } + + if (input_files != NULL) + { + if (input_file != NULL) + { + fatal (_("input file named both on command line and with INPUT")); + } + if (input_files->next == NULL) + input_file = input_files->string; + else + input_file = link_inputs (input_files, ld_arg); + } + else if (input_file == NULL) + { + non_fatal (_("no input file")); + show_usage (stderr, 1); + } + + inbfd = bfd_openr (input_file, input_format); + if (inbfd == NULL) + bfd_fatal (input_file); + + if (! bfd_check_format_matches (inbfd, bfd_object, &matching)) + { + bfd_nonfatal (input_file); + if (bfd_get_error () == bfd_error_file_ambiguously_recognized) + { + list_matching_formats (matching); + free (matching); + } + exit (1); + } + + if (output_format == NULL) + output_format = select_output_format (bfd_get_arch (inbfd), + bfd_get_mach (inbfd), + bfd_big_endian (inbfd)); + + assert (output_format != NULL); + + /* Use the output file named on the command line if it exists. + Otherwise use the file named in the OUTPUT statement. */ + if (output_file == NULL) + { + non_fatal (_("no name for output file")); + show_usage (stderr, 1); + } + + outbfd = bfd_openw (output_file, output_format); + if (outbfd == NULL) + bfd_fatal (output_file); + if (! bfd_set_format (outbfd, bfd_object)) + bfd_fatal (output_file); + + assert (bfd_get_flavour (outbfd) == bfd_target_nlm_flavour); + + /* XXX: Should we accept the unknown bfd format here ? */ + if (bfd_arch_get_compatible (inbfd, outbfd, TRUE) == NULL) + non_fatal (_("warning: input and output formats are not compatible")); + + /* Move the values read from the command file into outbfd. */ + *nlm_fixed_header (outbfd) = fixed_hdr_struct; + *nlm_variable_header (outbfd) = var_hdr_struct; + *nlm_version_header (outbfd) = version_hdr_struct; + *nlm_copyright_header (outbfd) = copyright_hdr_struct; + *nlm_extended_header (outbfd) = extended_hdr_struct; + + /* Start copying the input BFD to the output BFD. */ + if (! bfd_set_file_flags (outbfd, bfd_get_file_flags (inbfd))) + bfd_fatal (bfd_get_filename (outbfd)); + + symsize = bfd_get_symtab_upper_bound (inbfd); + if (symsize < 0) + bfd_fatal (input_file); + symbols = (asymbol **) xmalloc (symsize); + symcount = bfd_canonicalize_symtab (inbfd, symbols); + if (symcount < 0) + bfd_fatal (input_file); + + /* Make sure we have a .bss section. */ + bss_sec = bfd_get_section_by_name (outbfd, NLM_UNINITIALIZED_DATA_NAME); + if (bss_sec == NULL) + { + bss_sec = bfd_make_section (outbfd, NLM_UNINITIALIZED_DATA_NAME); + if (bss_sec == NULL + || ! bfd_set_section_flags (outbfd, bss_sec, SEC_ALLOC) + || ! bfd_set_section_alignment (outbfd, bss_sec, 1)) + bfd_fatal (_("make .bss section")); + } + + /* We store the original section names in the .nlmsections section, + so that programs which understand it can resurrect the original + sections from the NLM. We will put a pointer to .nlmsections in + the NLM header area. */ + secsec = bfd_make_section (outbfd, ".nlmsections"); + if (secsec == NULL) + bfd_fatal (_("make .nlmsections section")); + if (! bfd_set_section_flags (outbfd, secsec, SEC_HAS_CONTENTS)) + bfd_fatal (_("set .nlmsections flags")); + +#ifdef NLMCONV_POWERPC + /* For PowerPC NetWare we need to build stubs for calls to undefined + symbols. Because each stub requires an entry in the TOC section + which must be at the same location as other entries in the TOC + section, we must do this before determining where the TOC section + goes in setup_sections. */ + if (bfd_get_arch (inbfd) == bfd_arch_powerpc) + powerpc_build_stubs (inbfd, outbfd, &symbols, &symcount); +#endif + + /* Set up the sections. */ + bfd_map_over_sections (inbfd, setup_sections, (void *) outbfd); + + text_sec = bfd_get_section_by_name (outbfd, NLM_CODE_NAME); + + /* The .bss section immediately follows the .data section. */ + data_sec = bfd_get_section_by_name (outbfd, NLM_INITIALIZED_DATA_NAME); + if (data_sec != NULL) + { + bfd_size_type add; + + vma = bfd_get_section_size_before_reloc (data_sec); + align = 1 << bss_sec->alignment_power; + add = ((vma + align - 1) &~ (align - 1)) - vma; + vma += add; + if (! bfd_set_section_vma (outbfd, bss_sec, vma)) + bfd_fatal (_("set .bss vma")); + if (add != 0) + { + bfd_size_type data_size; + + data_size = bfd_get_section_size_before_reloc (data_sec); + if (! bfd_set_section_size (outbfd, data_sec, data_size + add)) + bfd_fatal (_("set .data size")); + } + } + + /* Adjust symbol information. */ + inlead = bfd_get_symbol_leading_char (inbfd); + outlead = bfd_get_symbol_leading_char (outbfd); + gotstart = FALSE; + gotexit = FALSE; + gotcheck = FALSE; + newsymalloc = 10; + newsyms = (asymbol **) xmalloc (newsymalloc * sizeof (asymbol *)); + newsymcount = 0; + endsym = NULL; + for (i = 0; i < symcount; i++) + { + register asymbol *sym; + + sym = symbols[i]; + + /* Add or remove a leading underscore. */ + if (inlead != outlead) + { + if (inlead != '\0') + { + if (bfd_asymbol_name (sym)[0] == inlead) + { + if (outlead == '\0') + ++sym->name; + else + { + char *new; + + new = xmalloc (strlen (bfd_asymbol_name (sym)) + 1); + new[0] = outlead; + strcpy (new + 1, bfd_asymbol_name (sym) + 1); + sym->name = new; + } + } + } + else + { + char *new; + + new = xmalloc (strlen (bfd_asymbol_name (sym)) + 2); + new[0] = outlead; + strcpy (new + 1, bfd_asymbol_name (sym)); + sym->name = new; + } + } + + /* NLM's have an uninitialized data section, but they do not + have a common section in the Unix sense. Move all common + symbols into the .bss section, and mark them as exported. */ + if (bfd_is_com_section (bfd_get_section (sym))) + { + bfd_vma size; + + sym->section = bss_sec; + size = sym->value; + sym->value = bss_sec->_raw_size; + bss_sec->_raw_size += size; + align = 1 << bss_sec->alignment_power; + bss_sec->_raw_size = (bss_sec->_raw_size + align - 1) &~ (align - 1); + sym->flags |= BSF_EXPORT | BSF_GLOBAL; + } + else if (bfd_get_section (sym)->output_section != NULL) + { + /* Move the symbol into the output section. */ + sym->value += bfd_get_section (sym)->output_offset; + sym->section = bfd_get_section (sym)->output_section; + /* This is no longer a section symbol. */ + sym->flags &=~ BSF_SECTION_SYM; + } + + /* Force _edata and _end to be defined. This would normally be + done by the linker, but the manipulation of the common + symbols will confuse it. */ + if ((sym->flags & BSF_DEBUGGING) == 0 + && bfd_asymbol_name (sym)[0] == '_' + && bfd_is_und_section (bfd_get_section (sym))) + { + if (strcmp (bfd_asymbol_name (sym), "_edata") == 0) + { + sym->section = bss_sec; + sym->value = 0; + } + if (strcmp (bfd_asymbol_name (sym), "_end") == 0) + { + sym->section = bss_sec; + endsym = sym; + } + +#ifdef NLMCONV_POWERPC + /* For PowerPC NetWare, we define __GOT0. This is the start + of the .got section. */ + if (bfd_get_arch (inbfd) == bfd_arch_powerpc + && strcmp (bfd_asymbol_name (sym), "__GOT0") == 0) + { + asection *got_sec; + + got_sec = bfd_get_section_by_name (inbfd, ".got"); + assert (got_sec != (asection *) NULL); + sym->value = got_sec->output_offset; + sym->section = got_sec->output_section; + } +#endif + } + + /* If this is a global symbol, check the export list. */ + if ((sym->flags & (BSF_EXPORT | BSF_GLOBAL)) != 0) + { + register struct string_list *l; + int found_simple; + + /* Unfortunately, a symbol can appear multiple times on the + export list, with and without prefixes. */ + found_simple = 0; + for (l = export_symbols; l != NULL; l = l->next) + { + if (strcmp (l->string, bfd_asymbol_name (sym)) == 0) + found_simple = 1; + else + { + char *zbase; + + zbase = strchr (l->string, '@'); + if (zbase != NULL + && strcmp (zbase + 1, bfd_asymbol_name (sym)) == 0) + { + /* We must add a symbol with this prefix. */ + if (newsymcount >= newsymalloc) + { + newsymalloc += 10; + newsyms = ((asymbol **) + xrealloc ((void *) newsyms, + (newsymalloc + * sizeof (asymbol *)))); + } + newsyms[newsymcount] = + (asymbol *) xmalloc (sizeof (asymbol)); + *newsyms[newsymcount] = *sym; + newsyms[newsymcount]->name = l->string; + ++newsymcount; + } + } + } + if (! found_simple) + { + /* The unmodified symbol is actually not exported at + all. */ + sym->flags &=~ (BSF_GLOBAL | BSF_EXPORT); + sym->flags |= BSF_LOCAL; + } + } + + /* If it's an undefined symbol, see if it's on the import list. + Change the prefix if necessary. */ + if (bfd_is_und_section (bfd_get_section (sym))) + { + register struct string_list *l; + + for (l = import_symbols; l != NULL; l = l->next) + { + if (strcmp (l->string, bfd_asymbol_name (sym)) == 0) + break; + else + { + char *zbase; + + zbase = strchr (l->string, '@'); + if (zbase != NULL + && strcmp (zbase + 1, bfd_asymbol_name (sym)) == 0) + { + sym->name = l->string; + break; + } + } + } + if (l == NULL) + non_fatal (_("warning: symbol %s imported but not in import list"), + bfd_asymbol_name (sym)); + } + + /* See if it's one of the special named symbols. */ + if ((sym->flags & BSF_DEBUGGING) == 0) + { + bfd_vma val; + + /* FIXME: If these symbols are not in the .text section, we + add the .text section size to the value. This may not be + correct for all targets. I'm not sure how this should + really be handled. */ + if (strcmp (bfd_asymbol_name (sym), start_procedure) == 0) + { + val = bfd_asymbol_value (sym); + if (bfd_get_section (sym) == data_sec + && text_sec != (asection *) NULL) + val += bfd_section_size (outbfd, text_sec); + if (! bfd_set_start_address (outbfd, val)) + bfd_fatal (_("set start address")); + gotstart = TRUE; + } + if (strcmp (bfd_asymbol_name (sym), exit_procedure) == 0) + { + val = bfd_asymbol_value (sym); + if (bfd_get_section (sym) == data_sec + && text_sec != (asection *) NULL) + val += bfd_section_size (outbfd, text_sec); + nlm_fixed_header (outbfd)->exitProcedureOffset = val; + gotexit = TRUE; + } + if (check_procedure != NULL + && strcmp (bfd_asymbol_name (sym), check_procedure) == 0) + { + val = bfd_asymbol_value (sym); + if (bfd_get_section (sym) == data_sec + && text_sec != (asection *) NULL) + val += bfd_section_size (outbfd, text_sec); + nlm_fixed_header (outbfd)->checkUnloadProcedureOffset = val; + gotcheck = TRUE; + } + } + } + + if (endsym != NULL) + { + endsym->value = bfd_get_section_size_before_reloc (bss_sec); + + /* FIXME: If any relocs referring to _end use inplace addends, + then I think they need to be updated. This is handled by + i386_mangle_relocs. Is it needed for any other object + formats? */ + } + + if (newsymcount == 0) + outsyms = symbols; + else + { + outsyms = (asymbol **) xmalloc ((symcount + newsymcount + 1) + * sizeof (asymbol *)); + memcpy (outsyms, symbols, symcount * sizeof (asymbol *)); + memcpy (outsyms + symcount, newsyms, newsymcount * sizeof (asymbol *)); + outsyms[symcount + newsymcount] = NULL; + } + + bfd_set_symtab (outbfd, outsyms, symcount + newsymcount); + + if (! gotstart) + non_fatal (_("warning: START procedure %s not defined"), start_procedure); + if (! gotexit) + non_fatal (_("warning: EXIT procedure %s not defined"), exit_procedure); + if (check_procedure != NULL && ! gotcheck) + non_fatal (_("warning: CHECK procedure %s not defined"), check_procedure); + + /* Add additional sections required for the header information. */ + if (custom_file != NULL) + { + custom_data = fopen (custom_file, "r"); + if (custom_data == NULL + || fstat (fileno (custom_data), &st) < 0) + { + fprintf (stderr, "%s:%s: %s\n", program_name, custom_file, + strerror (errno)); + custom_file = NULL; + } + else + { + custom_size = st.st_size; + custom_section = bfd_make_section (outbfd, ".nlmcustom"); + if (custom_section == NULL + || ! bfd_set_section_size (outbfd, custom_section, custom_size) + || ! bfd_set_section_flags (outbfd, custom_section, + SEC_HAS_CONTENTS)) + bfd_fatal (_("custom section")); + } + } + if (help_file != NULL) + { + help_data = fopen (help_file, "r"); + if (help_data == NULL + || fstat (fileno (help_data), &st) < 0) + { + fprintf (stderr, "%s:%s: %s\n", program_name, help_file, + strerror (errno)); + help_file = NULL; + } + else + { + help_size = st.st_size; + help_section = bfd_make_section (outbfd, ".nlmhelp"); + if (help_section == NULL + || ! bfd_set_section_size (outbfd, help_section, help_size) + || ! bfd_set_section_flags (outbfd, help_section, + SEC_HAS_CONTENTS)) + bfd_fatal (_("help section")); + strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8); + } + } + if (message_file != NULL) + { + message_data = fopen (message_file, "r"); + if (message_data == NULL + || fstat (fileno (message_data), &st) < 0) + { + fprintf (stderr, "%s:%s: %s\n", program_name, message_file, + strerror (errno)); + message_file = NULL; + } + else + { + message_size = st.st_size; + message_section = bfd_make_section (outbfd, ".nlmmessages"); + if (message_section == NULL + || ! bfd_set_section_size (outbfd, message_section, message_size) + || ! bfd_set_section_flags (outbfd, message_section, + SEC_HAS_CONTENTS)) + bfd_fatal (_("message section")); + strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8); + } + } + if (modules != NULL) + { + struct string_list *l; + + module_size = 0; + for (l = modules; l != NULL; l = l->next) + module_size += strlen (l->string) + 1; + module_section = bfd_make_section (outbfd, ".nlmmodules"); + if (module_section == NULL + || ! bfd_set_section_size (outbfd, module_section, module_size) + || ! bfd_set_section_flags (outbfd, module_section, + SEC_HAS_CONTENTS)) + bfd_fatal (_("module section")); + } + if (rpc_file != NULL) + { + rpc_data = fopen (rpc_file, "r"); + if (rpc_data == NULL + || fstat (fileno (rpc_data), &st) < 0) + { + fprintf (stderr, "%s:%s: %s\n", program_name, rpc_file, + strerror (errno)); + rpc_file = NULL; + } + else + { + rpc_size = st.st_size; + rpc_section = bfd_make_section (outbfd, ".nlmrpc"); + if (rpc_section == NULL + || ! bfd_set_section_size (outbfd, rpc_section, rpc_size) + || ! bfd_set_section_flags (outbfd, rpc_section, + SEC_HAS_CONTENTS)) + bfd_fatal (_("rpc section")); + strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8); + } + } + if (sharelib_file != NULL) + { + sharedbfd = bfd_openr (sharelib_file, output_format); + if (sharedbfd == NULL + || ! bfd_check_format (sharedbfd, bfd_object)) + { + fprintf (stderr, "%s:%s: %s\n", program_name, sharelib_file, + bfd_errmsg (bfd_get_error ())); + sharelib_file = NULL; + } + else + { + sharedhdr = *nlm_fixed_header (sharedbfd); + bfd_close (sharedbfd); + shared_data = fopen (sharelib_file, "r"); + if (shared_data == NULL + || (fstat (fileno (shared_data), &st) < 0)) + { + fprintf (stderr, "%s:%s: %s\n", program_name, sharelib_file, + strerror (errno)); + sharelib_file = NULL; + } + else + { + /* If we were clever, we could just copy out the + sections of the shared library which we actually + need. However, we would have to figure out the sizes + of the external and public information, and that can + not be done without reading through them. */ + if (sharedhdr.uninitializedDataSize > 0) + { + /* There is no place to record this information. */ + non_fatal (_("%s: warning: shared libraries can not have uninitialized data"), + sharelib_file); + } + shared_offset = st.st_size; + if (shared_offset > (size_t) sharedhdr.codeImageOffset) + shared_offset = sharedhdr.codeImageOffset; + if (shared_offset > (size_t) sharedhdr.dataImageOffset) + shared_offset = sharedhdr.dataImageOffset; + if (shared_offset > (size_t) sharedhdr.relocationFixupOffset) + shared_offset = sharedhdr.relocationFixupOffset; + if (shared_offset > (size_t) sharedhdr.externalReferencesOffset) + shared_offset = sharedhdr.externalReferencesOffset; + if (shared_offset > (size_t) sharedhdr.publicsOffset) + shared_offset = sharedhdr.publicsOffset; + shared_size = st.st_size - shared_offset; + shared_section = bfd_make_section (outbfd, ".nlmshared"); + if (shared_section == NULL + || ! bfd_set_section_size (outbfd, shared_section, + shared_size) + || ! bfd_set_section_flags (outbfd, shared_section, + SEC_HAS_CONTENTS)) + bfd_fatal (_("shared section")); + strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8); + } + } + } + + /* Check whether a version was given. */ + if (strncmp (version_hdr->stamp, "VeRsIoN#", 8) != 0) + non_fatal (_("warning: No version number given")); + + /* At least for now, always create an extended header, because that + is what NLMLINK does. */ + strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8); + + strncpy (nlm_cygnus_ext_header (outbfd)->stamp, "CyGnUsEx", 8); + + /* If the date was not given, force it in. */ + if (nlm_version_header (outbfd)->month == 0 + && nlm_version_header (outbfd)->day == 0 + && nlm_version_header (outbfd)->year == 0) + { + time_t now; + struct tm *ptm; + + time (&now); + ptm = localtime (&now); + nlm_version_header (outbfd)->month = ptm->tm_mon + 1; + nlm_version_header (outbfd)->day = ptm->tm_mday; + nlm_version_header (outbfd)->year = ptm->tm_year + 1900; + strncpy (version_hdr->stamp, "VeRsIoN#", 8); + } + +#ifdef NLMCONV_POWERPC + /* Resolve the stubs we build for PowerPC NetWare. */ + if (bfd_get_arch (inbfd) == bfd_arch_powerpc) + powerpc_resolve_stubs (inbfd, outbfd); +#endif + + /* Copy over the sections. */ + bfd_map_over_sections (inbfd, copy_sections, (void *) outbfd); + + /* Finish up the header information. */ + if (custom_file != NULL) + { + void *data; + + data = xmalloc (custom_size); + if (fread (data, 1, custom_size, custom_data) != custom_size) + non_fatal (_("%s: read: %s"), custom_file, strerror (errno)); + else + { + if (! bfd_set_section_contents (outbfd, custom_section, data, + (file_ptr) 0, custom_size)) + bfd_fatal (_("custom section")); + nlm_fixed_header (outbfd)->customDataOffset = + custom_section->filepos; + nlm_fixed_header (outbfd)->customDataSize = custom_size; + } + free (data); + } + if (! debug_info) + { + /* As a special hack, the backend recognizes a debugInfoOffset + of -1 to mean that it should not output any debugging + information. This can not be handling by fiddling with the + symbol table because exported symbols appear in both the + export information and the debugging information. */ + nlm_fixed_header (outbfd)->debugInfoOffset = (file_ptr) -1; + } + if (map_file != NULL) + non_fatal (_("warning: MAP and FULLMAP are not supported; try ld -M")); + if (help_file != NULL) + { + void *data; + + data = xmalloc (help_size); + if (fread (data, 1, help_size, help_data) != help_size) + non_fatal (_("%s: read: %s"), help_file, strerror (errno)); + else + { + if (! bfd_set_section_contents (outbfd, help_section, data, + (file_ptr) 0, help_size)) + bfd_fatal (_("help section")); + nlm_extended_header (outbfd)->helpFileOffset = + help_section->filepos; + nlm_extended_header (outbfd)->helpFileLength = help_size; + } + free (data); + } + if (message_file != NULL) + { + void *data; + + data = xmalloc (message_size); + if (fread (data, 1, message_size, message_data) != message_size) + non_fatal (_("%s: read: %s"), message_file, strerror (errno)); + else + { + if (! bfd_set_section_contents (outbfd, message_section, data, + (file_ptr) 0, message_size)) + bfd_fatal (_("message section")); + nlm_extended_header (outbfd)->messageFileOffset = + message_section->filepos; + nlm_extended_header (outbfd)->messageFileLength = message_size; + + /* FIXME: Are these offsets correct on all platforms? Are + they 32 bits on all platforms? What endianness? */ + nlm_extended_header (outbfd)->languageID = + bfd_h_get_32 (outbfd, (bfd_byte *) data + 106); + nlm_extended_header (outbfd)->messageCount = + bfd_h_get_32 (outbfd, (bfd_byte *) data + 110); + } + free (data); + } + if (modules != NULL) + { + void *data; + unsigned char *set; + struct string_list *l; + bfd_size_type c; + + data = xmalloc (module_size); + c = 0; + set = (unsigned char *) data; + for (l = modules; l != NULL; l = l->next) + { + *set = strlen (l->string); + strncpy (set + 1, l->string, *set); + set += *set + 1; + ++c; + } + if (! bfd_set_section_contents (outbfd, module_section, data, + (file_ptr) 0, module_size)) + bfd_fatal (_("module section")); + nlm_fixed_header (outbfd)->moduleDependencyOffset = + module_section->filepos; + nlm_fixed_header (outbfd)->numberOfModuleDependencies = c; + } + if (rpc_file != NULL) + { + void *data; + + data = xmalloc (rpc_size); + if (fread (data, 1, rpc_size, rpc_data) != rpc_size) + non_fatal (_("%s: read: %s"), rpc_file, strerror (errno)); + else + { + if (! bfd_set_section_contents (outbfd, rpc_section, data, + (file_ptr) 0, rpc_size)) + bfd_fatal (_("rpc section")); + nlm_extended_header (outbfd)->RPCDataOffset = + rpc_section->filepos; + nlm_extended_header (outbfd)->RPCDataLength = rpc_size; + } + free (data); + } + if (sharelib_file != NULL) + { + void *data; + + data = xmalloc (shared_size); + if (fseek (shared_data, shared_offset, SEEK_SET) != 0 + || fread (data, 1, shared_size, shared_data) != shared_size) + non_fatal (_("%s: read: %s"), sharelib_file, strerror (errno)); + else + { + if (! bfd_set_section_contents (outbfd, shared_section, data, + (file_ptr) 0, shared_size)) + bfd_fatal (_("shared section")); + } + nlm_extended_header (outbfd)->sharedCodeOffset = + sharedhdr.codeImageOffset - shared_offset + shared_section->filepos; + nlm_extended_header (outbfd)->sharedCodeLength = + sharedhdr.codeImageSize; + nlm_extended_header (outbfd)->sharedDataOffset = + sharedhdr.dataImageOffset - shared_offset + shared_section->filepos; + nlm_extended_header (outbfd)->sharedDataLength = + sharedhdr.dataImageSize; + nlm_extended_header (outbfd)->sharedRelocationFixupOffset = + (sharedhdr.relocationFixupOffset + - shared_offset + + shared_section->filepos); + nlm_extended_header (outbfd)->sharedRelocationFixupCount = + sharedhdr.numberOfRelocationFixups; + nlm_extended_header (outbfd)->sharedExternalReferenceOffset = + (sharedhdr.externalReferencesOffset + - shared_offset + + shared_section->filepos); + nlm_extended_header (outbfd)->sharedExternalReferenceCount = + sharedhdr.numberOfExternalReferences; + nlm_extended_header (outbfd)->sharedPublicsOffset = + sharedhdr.publicsOffset - shared_offset + shared_section->filepos; + nlm_extended_header (outbfd)->sharedPublicsCount = + sharedhdr.numberOfPublics; + nlm_extended_header (outbfd)->sharedDebugRecordOffset = + sharedhdr.debugInfoOffset - shared_offset + shared_section->filepos; + nlm_extended_header (outbfd)->sharedDebugRecordCount = + sharedhdr.numberOfDebugRecords; + nlm_extended_header (outbfd)->SharedInitializationOffset = + sharedhdr.codeStartOffset; + nlm_extended_header (outbfd)->SharedExitProcedureOffset = + sharedhdr.exitProcedureOffset; + free (data); + } + len = strlen (output_file); + if (len > NLM_MODULE_NAME_SIZE - 2) + len = NLM_MODULE_NAME_SIZE - 2; + nlm_fixed_header (outbfd)->moduleName[0] = len; + + strncpy (nlm_fixed_header (outbfd)->moduleName + 1, output_file, + NLM_MODULE_NAME_SIZE - 2); + nlm_fixed_header (outbfd)->moduleName[NLM_MODULE_NAME_SIZE - 1] = '\0'; + for (modname = nlm_fixed_header (outbfd)->moduleName; + *modname != '\0'; + modname++) + *modname = TOUPPER (*modname); + + strncpy (nlm_variable_header (outbfd)->oldThreadName, " LONG", + NLM_OLD_THREAD_NAME_LENGTH); + + nlm_cygnus_ext_header (outbfd)->offset = secsec->filepos; + nlm_cygnus_ext_header (outbfd)->length = bfd_section_size (outbfd, secsec); + + if (! bfd_close (outbfd)) + bfd_fatal (output_file); + if (! bfd_close (inbfd)) + bfd_fatal (input_file); + + if (unlink_on_exit != NULL) + unlink (unlink_on_exit); + + return 0; +} + + +/* Show a usage message and exit. */ + +static void +show_usage (FILE *file, int status) +{ + fprintf (file, _("Usage: %s [option(s)] [in-file [out-file]]\n"), program_name); + fprintf (file, _(" Convert an object file into a NetWare Loadable Module\n")); + fprintf (file, _(" The options are:\n\ + -I --input-target= Set the input binary file format\n\ + -O --output-target= Set the output binary file format\n\ + -T --header-file= Read for NLM header information\n\ + -l --linker= Use for any linking\n\ + -d --debug Display on stderr the linker command line\n\ + -h --help Display this information\n\ + -v --version Display the program's version\n\ +")); + if (status == 0) + fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO); + exit (status); +} + +/* Select the output format based on the input architecture, machine, + and endianness. This chooses the appropriate NLM target. */ + +static const char * +select_output_format (enum bfd_architecture arch, unsigned long mach, + bfd_boolean bigendian ATTRIBUTE_UNUSED) +{ + switch (arch) + { +#ifdef NLMCONV_I386 + case bfd_arch_i386: + return "nlm32-i386"; +#endif +#ifdef NLMCONV_SPARC + case bfd_arch_sparc: + return "nlm32-sparc"; +#endif +#ifdef NLMCONV_ALPHA + case bfd_arch_alpha: + return "nlm32-alpha"; +#endif +#ifdef NLMCONV_POWERPC + case bfd_arch_powerpc: + return "nlm32-powerpc"; +#endif + default: + fatal (_("support not compiled in for %s"), + bfd_printable_arch_mach (arch, mach)); + } + /*NOTREACHED*/ +} + +/* The BFD sections are copied in two passes. This function selects + the output section for each input section, and sets up the section + name, size, etc. */ + +static void +setup_sections (bfd *inbfd ATTRIBUTE_UNUSED, asection *insec, void *data_ptr) +{ + bfd *outbfd = (bfd *) data_ptr; + flagword f; + const char *outname; + asection *outsec; + bfd_vma offset; + bfd_size_type align; + bfd_size_type add; + bfd_size_type secsecsize; + + f = bfd_get_section_flags (inbfd, insec); + if (f & SEC_CODE) + outname = NLM_CODE_NAME; + else if ((f & SEC_LOAD) && (f & SEC_HAS_CONTENTS)) + outname = NLM_INITIALIZED_DATA_NAME; + else if (f & SEC_ALLOC) + outname = NLM_UNINITIALIZED_DATA_NAME; + else + outname = bfd_section_name (inbfd, insec); + + outsec = bfd_get_section_by_name (outbfd, outname); + if (outsec == NULL) + { + outsec = bfd_make_section (outbfd, outname); + if (outsec == NULL) + bfd_fatal (_("make section")); + } + + insec->output_section = outsec; + + offset = bfd_section_size (outbfd, outsec); + align = 1 << bfd_section_alignment (inbfd, insec); + add = ((offset + align - 1) &~ (align - 1)) - offset; + insec->output_offset = offset + add; + + if (! bfd_set_section_size (outbfd, outsec, + (bfd_section_size (outbfd, outsec) + + bfd_section_size (inbfd, insec) + + add))) + bfd_fatal (_("set section size")); + + if ((bfd_section_alignment (inbfd, insec) + > bfd_section_alignment (outbfd, outsec)) + && ! bfd_set_section_alignment (outbfd, outsec, + bfd_section_alignment (inbfd, insec))) + bfd_fatal (_("set section alignment")); + + if (! bfd_set_section_flags (outbfd, outsec, + f | bfd_get_section_flags (outbfd, outsec))) + bfd_fatal (_("set section flags")); + + bfd_set_reloc (outbfd, outsec, (arelent **) NULL, 0); + + /* For each input section we allocate space for an entry in + .nlmsections. */ + secsecsize = bfd_section_size (outbfd, secsec); + secsecsize += strlen (bfd_section_name (inbfd, insec)) + 1; + secsecsize = (secsecsize + 3) &~ 3; + secsecsize += 8; + if (! bfd_set_section_size (outbfd, secsec, secsecsize)) + bfd_fatal (_("set .nlmsections size")); +} + +/* Copy the section contents. */ + +static void +copy_sections (bfd *inbfd, asection *insec, void *data_ptr) +{ + static bfd_size_type secsecoff = 0; + bfd *outbfd = (bfd *) data_ptr; + const char *inname; + asection *outsec; + bfd_size_type size; + void *contents; + long reloc_size; + bfd_byte buf[4]; + bfd_size_type add; + + inname = bfd_section_name (inbfd, insec); + + outsec = insec->output_section; + assert (outsec != NULL); + + size = bfd_get_section_size_before_reloc (insec); + + /* FIXME: Why are these necessary? */ + insec->_cooked_size = insec->_raw_size; + insec->reloc_done = TRUE; + + if ((bfd_get_section_flags (inbfd, insec) & SEC_HAS_CONTENTS) == 0) + contents = NULL; + else + { + contents = xmalloc (size); + if (! bfd_get_section_contents (inbfd, insec, contents, + (file_ptr) 0, size)) + bfd_fatal (bfd_get_filename (inbfd)); + } + + reloc_size = bfd_get_reloc_upper_bound (inbfd, insec); + if (reloc_size < 0) + bfd_fatal (bfd_get_filename (inbfd)); + if (reloc_size != 0) + { + arelent **relocs; + long reloc_count; + + relocs = (arelent **) xmalloc (reloc_size); + reloc_count = bfd_canonicalize_reloc (inbfd, insec, relocs, symbols); + if (reloc_count < 0) + bfd_fatal (bfd_get_filename (inbfd)); + mangle_relocs (outbfd, insec, &relocs, &reloc_count, (char *) contents, + size); + + /* FIXME: refers to internal BFD fields. */ + if (outsec->orelocation != (arelent **) NULL) + { + bfd_size_type total_count; + arelent **combined; + + total_count = reloc_count + outsec->reloc_count; + combined = (arelent **) xmalloc (total_count * sizeof (arelent *)); + memcpy (combined, outsec->orelocation, + outsec->reloc_count * sizeof (arelent *)); + memcpy (combined + outsec->reloc_count, relocs, + (size_t) (reloc_count * sizeof (arelent *))); + free (outsec->orelocation); + reloc_count = total_count; + relocs = combined; + } + + bfd_set_reloc (outbfd, outsec, relocs, reloc_count); + } + + if (contents != NULL) + { + if (! bfd_set_section_contents (outbfd, outsec, contents, + insec->output_offset, size)) + bfd_fatal (bfd_get_filename (outbfd)); + free (contents); + } + + /* Add this section to .nlmsections. */ + if (! bfd_set_section_contents (outbfd, secsec, (void *) inname, secsecoff, + strlen (inname) + 1)) + bfd_fatal (_("set .nlmsection contents")); + secsecoff += strlen (inname) + 1; + + add = ((secsecoff + 3) &~ 3) - secsecoff; + if (add != 0) + { + bfd_h_put_32 (outbfd, (bfd_vma) 0, buf); + if (! bfd_set_section_contents (outbfd, secsec, buf, secsecoff, add)) + bfd_fatal (_("set .nlmsection contents")); + secsecoff += add; + } + + if (contents != NULL) + bfd_h_put_32 (outbfd, (bfd_vma) outsec->filepos, buf); + else + bfd_h_put_32 (outbfd, (bfd_vma) 0, buf); + if (! bfd_set_section_contents (outbfd, secsec, buf, secsecoff, 4)) + bfd_fatal (_("set .nlmsection contents")); + secsecoff += 4; + + bfd_h_put_32 (outbfd, (bfd_vma) size, buf); + if (! bfd_set_section_contents (outbfd, secsec, buf, secsecoff, 4)) + bfd_fatal (_("set .nlmsection contents")); + secsecoff += 4; +} + +/* Some, perhaps all, NetWare targets require changing the relocs used + by the input formats. */ + +static void +mangle_relocs (bfd *outbfd, asection *insec, arelent ***relocs_ptr, + long *reloc_count_ptr, char *contents, + bfd_size_type contents_size) +{ + switch (bfd_get_arch (outbfd)) + { +#ifdef NLMCONV_I386 + case bfd_arch_i386: + i386_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr, + contents, contents_size); + break; +#endif +#ifdef NLMCONV_ALPHA + case bfd_arch_alpha: + alpha_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr, + contents, contents_size); + break; +#endif +#ifdef NLMCONV_POWERPC + case bfd_arch_powerpc: + powerpc_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr, + contents, contents_size); + break; +#endif + default: + default_mangle_relocs (outbfd, insec, relocs_ptr, reloc_count_ptr, + contents, contents_size); + break; + } +} + +/* By default all we need to do for relocs is change the address by + the output_offset. */ + +static void +default_mangle_relocs (bfd *outbfd ATTRIBUTE_UNUSED, asection *insec, + arelent ***relocs_ptr, long *reloc_count_ptr, + char *contents ATTRIBUTE_UNUSED, + bfd_size_type contents_size ATTRIBUTE_UNUSED) +{ + if (insec->output_offset != 0) + { + long reloc_count; + register arelent **relocs; + register long i; + + reloc_count = *reloc_count_ptr; + relocs = *relocs_ptr; + for (i = 0; i < reloc_count; i++, relocs++) + (*relocs)->address += insec->output_offset; + } +} + +#ifdef NLMCONV_I386 + +/* NetWare on the i386 supports a restricted set of relocs, which are + different from those used on other i386 targets. This routine + converts the relocs. It is, obviously, very target dependent. At + the moment, the nlm32-i386 backend performs similar translations; + however, it is more reliable and efficient to do them here. */ + +static reloc_howto_type nlm_i386_pcrel_howto = + HOWTO (1, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "DISP32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE); /* pcrel_offset */ + +static void +i386_mangle_relocs (bfd *outbfd, asection *insec, arelent ***relocs_ptr, + long *reloc_count_ptr, char *contents, + bfd_size_type contents_size) +{ + long reloc_count, i; + arelent **relocs; + + reloc_count = *reloc_count_ptr; + relocs = *relocs_ptr; + for (i = 0; i < reloc_count; i++) + { + arelent *rel; + asymbol *sym; + bfd_size_type address; + bfd_vma addend; + + rel = *relocs++; + sym = *rel->sym_ptr_ptr; + + /* We're moving the relocs from the input section to the output + section, so we must adjust the address accordingly. */ + address = rel->address; + rel->address += insec->output_offset; + + /* Note that no serious harm will ensue if we fail to change a + reloc. The backend will fail when writing out the reloc. */ + + /* Make sure this reloc is within the data we have. We use only + 4 byte relocs here, so we insist on having 4 bytes. */ + if (address + 4 > contents_size) + continue; + + /* A PC relative reloc entirely within a single section is + completely unnecessary. This can be generated by ld -r. */ + if (sym == insec->symbol + && rel->howto != NULL + && rel->howto->pc_relative + && ! rel->howto->pcrel_offset) + { + --*reloc_count_ptr; + --relocs; + memmove (relocs, relocs + 1, + (size_t) ((reloc_count - i) * sizeof (arelent *))); + continue; + } + + /* Get the amount the relocation will add in. */ + addend = rel->addend + sym->value; + + /* NetWare doesn't support PC relative relocs against defined + symbols, so we have to eliminate them by doing the relocation + now. We can only do this if the reloc is within a single + section. */ + if (rel->howto != NULL + && rel->howto->pc_relative + && bfd_get_section (sym) == insec->output_section) + { + bfd_vma val; + + if (rel->howto->pcrel_offset) + addend -= address; + + val = bfd_get_32 (outbfd, (bfd_byte *) contents + address); + val += addend; + bfd_put_32 (outbfd, val, (bfd_byte *) contents + address); + + --*reloc_count_ptr; + --relocs; + memmove (relocs, relocs + 1, + (size_t) ((reloc_count - i) * sizeof (arelent *))); + continue; + } + + /* NetWare doesn't support reloc addends, so we get rid of them + here by simply adding them into the object data. We handle + the symbol value, if any, the same way. */ + if (addend != 0 + && rel->howto != NULL + && rel->howto->rightshift == 0 + && rel->howto->size == 2 + && rel->howto->bitsize == 32 + && rel->howto->bitpos == 0 + && rel->howto->src_mask == 0xffffffff + && rel->howto->dst_mask == 0xffffffff) + { + bfd_vma val; + + val = bfd_get_32 (outbfd, (bfd_byte *) contents + address); + val += addend; + bfd_put_32 (outbfd, val, (bfd_byte *) contents + address); + + /* Adjust the reloc for the changes we just made. */ + rel->addend = 0; + if (! bfd_is_und_section (bfd_get_section (sym))) + rel->sym_ptr_ptr = bfd_get_section (sym)->symbol_ptr_ptr; + } + + /* NetWare uses a reloc with pcrel_offset set. We adjust + pc_relative relocs accordingly. We are going to change the + howto field, so we can only do this if the current one is + compatible. We should check that special_function is NULL + here, but at the moment coff-i386 uses a special_function + which does not affect what we are doing here. */ + if (rel->howto != NULL + && rel->howto->pc_relative + && ! rel->howto->pcrel_offset + && rel->howto->rightshift == 0 + && rel->howto->size == 2 + && rel->howto->bitsize == 32 + && rel->howto->bitpos == 0 + && rel->howto->src_mask == 0xffffffff + && rel->howto->dst_mask == 0xffffffff) + { + bfd_vma val; + + /* When pcrel_offset is not set, it means that the negative + of the address of the memory location is stored in the + memory location. We must add it back in. */ + val = bfd_get_32 (outbfd, (bfd_byte *) contents + address); + val += address; + bfd_put_32 (outbfd, val, (bfd_byte *) contents + address); + + /* We must change to a new howto. */ + rel->howto = &nlm_i386_pcrel_howto; + } + } +} + +#endif /* NLMCONV_I386 */ + +#ifdef NLMCONV_ALPHA + +/* On the Alpha the first reloc for every section must be a special + relocs which hold the GP address. Also, the first reloc in the + file must be a special reloc which holds the address of the .lita + section. */ + +static reloc_howto_type nlm32_alpha_nw_howto = + HOWTO (ALPHA_R_NW_RELOC, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + 0, /* special_function */ + "NW_RELOC", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE); /* pcrel_offset */ + +static void +alpha_mangle_relocs (bfd *outbfd, asection *insec, + register arelent ***relocs_ptr, long *reloc_count_ptr, + char *contents ATTRIBUTE_UNUSED, + bfd_size_type contents_size ATTRIBUTE_UNUSED) +{ + long old_reloc_count; + arelent **old_relocs; + register arelent **relocs; + + old_reloc_count = *reloc_count_ptr; + old_relocs = *relocs_ptr; + relocs = (arelent **) xmalloc ((old_reloc_count + 3) * sizeof (arelent *)); + *relocs_ptr = relocs; + + if (nlm_alpha_backend_data (outbfd)->lita_address == 0) + { + bfd *inbfd; + asection *lita_section; + + inbfd = insec->owner; + lita_section = bfd_get_section_by_name (inbfd, _LITA); + if (lita_section != (asection *) NULL) + { + nlm_alpha_backend_data (outbfd)->lita_address = + bfd_get_section_vma (inbfd, lita_section); + nlm_alpha_backend_data (outbfd)->lita_size = + bfd_section_size (inbfd, lita_section); + } + else + { + /* Avoid outputting this reloc again. */ + nlm_alpha_backend_data (outbfd)->lita_address = 4; + } + + *relocs = (arelent *) xmalloc (sizeof (arelent)); + (*relocs)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + (*relocs)->address = nlm_alpha_backend_data (outbfd)->lita_address; + (*relocs)->addend = nlm_alpha_backend_data (outbfd)->lita_size + 1; + (*relocs)->howto = &nlm32_alpha_nw_howto; + ++relocs; + ++(*reloc_count_ptr); + } + + /* Get the GP value from bfd. */ + if (nlm_alpha_backend_data (outbfd)->gp == 0) + nlm_alpha_backend_data (outbfd)->gp = + bfd_ecoff_get_gp_value (insec->owner); + + *relocs = (arelent *) xmalloc (sizeof (arelent)); + (*relocs)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + (*relocs)->address = nlm_alpha_backend_data (outbfd)->gp; + (*relocs)->addend = 0; + (*relocs)->howto = &nlm32_alpha_nw_howto; + ++relocs; + ++(*reloc_count_ptr); + + memcpy (relocs, old_relocs, (size_t) old_reloc_count * sizeof (arelent *)); + relocs[old_reloc_count] = (arelent *) NULL; + + free (old_relocs); + + if (insec->output_offset != 0) + { + register bfd_size_type i; + + for (i = 0; i < (bfd_size_type) old_reloc_count; i++, relocs++) + (*relocs)->address += insec->output_offset; + } +} + +#endif /* NLMCONV_ALPHA */ + +#ifdef NLMCONV_POWERPC + +/* We keep a linked list of stubs which we must build. Because BFD + requires us to know the sizes of all sections before we can set the + contents of any, we must figure out which stubs we want to build + before we can actually build any of them. */ + +struct powerpc_stub +{ + /* Next stub in linked list. */ + struct powerpc_stub *next; + + /* Symbol whose value is the start of the stub. This is a symbol + whose name begins with `.'. */ + asymbol *start; + + /* Symbol we are going to create a reloc against. This is a symbol + with the same name as START but without the leading `.'. */ + asymbol *reloc; + + /* The TOC index for this stub. This is the index into the TOC + section at which the reloc is created. */ + unsigned int toc_index; +}; + +/* The linked list of stubs. */ + +static struct powerpc_stub *powerpc_stubs; + +/* This is what a stub looks like. The first instruction will get + adjusted with the correct TOC index. */ + +static unsigned long powerpc_stub_insns[] = +{ + 0x81820000, /* lwz r12,0(r2) */ + 0x90410014, /* stw r2,20(r1) */ + 0x800c0000, /* lwz r0,0(r12) */ + 0x804c0004, /* lwz r2,r(r12) */ + 0x7c0903a6, /* mtctr r0 */ + 0x4e800420, /* bctr */ + 0, /* Traceback table. */ + 0xc8000, + 0 +}; + +#define POWERPC_STUB_INSN_COUNT \ + (sizeof powerpc_stub_insns / sizeof powerpc_stub_insns[0]) + +#define POWERPC_STUB_SIZE (4 * POWERPC_STUB_INSN_COUNT) + +/* Each stub uses a four byte TOC entry. */ +#define POWERPC_STUB_TOC_ENTRY_SIZE (4) + +/* The original size of the .got section. */ +static bfd_size_type powerpc_initial_got_size; + +/* Look for all undefined symbols beginning with `.', and prepare to + build a stub for each one. */ + +static void +powerpc_build_stubs (bfd *inbfd, bfd *outbfd ATTRIBUTE_UNUSED, + asymbol ***symbols_ptr, long *symcount_ptr) +{ + asection *stub_sec; + asection *got_sec; + unsigned int got_base; + long i; + long symcount; + long stubcount; + + /* Make a section to hold stubs. We don't set SEC_HAS_CONTENTS for + the section to prevent copy_sections from reading from it. */ + stub_sec = bfd_make_section (inbfd, ".stubs"); + if (stub_sec == (asection *) NULL + || ! bfd_set_section_flags (inbfd, stub_sec, + (SEC_CODE + | SEC_RELOC + | SEC_ALLOC + | SEC_LOAD)) + || ! bfd_set_section_alignment (inbfd, stub_sec, 2)) + bfd_fatal (".stubs"); + + /* Get the TOC section, which is named .got. */ + got_sec = bfd_get_section_by_name (inbfd, ".got"); + if (got_sec == (asection *) NULL) + { + got_sec = bfd_make_section (inbfd, ".got"); + if (got_sec == (asection *) NULL + || ! bfd_set_section_flags (inbfd, got_sec, + (SEC_DATA + | SEC_RELOC + | SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS)) + || ! bfd_set_section_alignment (inbfd, got_sec, 2)) + bfd_fatal (".got"); + } + + powerpc_initial_got_size = bfd_section_size (inbfd, got_sec); + got_base = powerpc_initial_got_size; + got_base = (got_base + 3) &~ 3; + + stubcount = 0; + + symcount = *symcount_ptr; + for (i = 0; i < symcount; i++) + { + asymbol *sym; + asymbol *newsym; + char *newname; + struct powerpc_stub *item; + + sym = (*symbols_ptr)[i]; + + /* We must make a stub for every undefined symbol whose name + starts with '.'. */ + if (bfd_asymbol_name (sym)[0] != '.' + || ! bfd_is_und_section (bfd_get_section (sym))) + continue; + + /* Make a new undefined symbol with the same name but without + the leading `.'. */ + newsym = (asymbol *) xmalloc (sizeof (asymbol)); + *newsym = *sym; + newname = (char *) xmalloc (strlen (bfd_asymbol_name (sym))); + strcpy (newname, bfd_asymbol_name (sym) + 1); + newsym->name = newname; + + /* Define the `.' symbol to be in the stub section. */ + sym->section = stub_sec; + sym->value = stubcount * POWERPC_STUB_SIZE; + /* We set the BSF_DYNAMIC flag here so that we can check it when + we are mangling relocs. FIXME: This is a hack. */ + sym->flags = BSF_LOCAL | BSF_DYNAMIC; + + /* Add this stub to the linked list. */ + item = (struct powerpc_stub *) xmalloc (sizeof (struct powerpc_stub)); + item->start = sym; + item->reloc = newsym; + item->toc_index = got_base + stubcount * POWERPC_STUB_TOC_ENTRY_SIZE; + + item->next = powerpc_stubs; + powerpc_stubs = item; + + ++stubcount; + } + + if (stubcount > 0) + { + asymbol **s; + struct powerpc_stub *l; + + /* Add the new symbols we just created to the symbol table. */ + *symbols_ptr = (asymbol **) xrealloc ((char *) *symbols_ptr, + ((symcount + stubcount) + * sizeof (asymbol))); + *symcount_ptr += stubcount; + s = &(*symbols_ptr)[symcount]; + for (l = powerpc_stubs; l != (struct powerpc_stub *) NULL; l = l->next) + *s++ = l->reloc; + + /* Set the size of the .stubs section and increase the size of + the .got section. */ + if (! bfd_set_section_size (inbfd, stub_sec, + stubcount * POWERPC_STUB_SIZE) + || ! bfd_set_section_size (inbfd, got_sec, + (got_base + + (stubcount + * POWERPC_STUB_TOC_ENTRY_SIZE)))) + bfd_fatal (_("stub section sizes")); + } +} + +/* Resolve all the stubs for PowerPC NetWare. We fill in the contents + of the output section, and create new relocs in the TOC. */ + +static void +powerpc_resolve_stubs (bfd *inbfd, bfd *outbfd) +{ + bfd_byte buf[POWERPC_STUB_SIZE]; + unsigned int i; + unsigned int stubcount; + arelent **relocs; + asection *got_sec; + arelent **r; + struct powerpc_stub *l; + + if (powerpc_stubs == (struct powerpc_stub *) NULL) + return; + + for (i = 0; i < POWERPC_STUB_INSN_COUNT; i++) + bfd_put_32 (outbfd, (bfd_vma) powerpc_stub_insns[i], buf + i * 4); + + got_sec = bfd_get_section_by_name (inbfd, ".got"); + assert (got_sec != (asection *) NULL); + assert (got_sec->output_section->orelocation == (arelent **) NULL); + + stubcount = 0; + for (l = powerpc_stubs; l != (struct powerpc_stub *) NULL; l = l->next) + ++stubcount; + relocs = (arelent **) xmalloc (stubcount * sizeof (arelent *)); + + r = relocs; + for (l = powerpc_stubs; l != (struct powerpc_stub *) NULL; l = l->next) + { + arelent *reloc; + + /* Adjust the first instruction to use the right TOC index. */ + bfd_put_32 (outbfd, (bfd_vma) powerpc_stub_insns[0] + l->toc_index, buf); + + /* Write this stub out. */ + if (! bfd_set_section_contents (outbfd, + bfd_get_section (l->start), + buf, + l->start->value, + POWERPC_STUB_SIZE)) + bfd_fatal (_("writing stub")); + + /* Create a new reloc for the TOC entry. */ + reloc = (arelent *) xmalloc (sizeof (arelent)); + reloc->sym_ptr_ptr = &l->reloc; + reloc->address = l->toc_index + got_sec->output_offset; + reloc->addend = 0; + reloc->howto = bfd_reloc_type_lookup (inbfd, BFD_RELOC_32); + + *r++ = reloc; + } + + bfd_set_reloc (outbfd, got_sec->output_section, relocs, stubcount); +} + +/* Adjust relocation entries for PowerPC NetWare. We do not output + TOC relocations. The object code already contains the offset from + the TOC pointer. When the function is called, the TOC register, + r2, will be set to the correct TOC value, so there is no need for + any further reloc. */ + +static void +powerpc_mangle_relocs (bfd *outbfd, asection *insec, + register arelent ***relocs_ptr, + long *reloc_count_ptr, char *contents, + bfd_size_type contents_size ATTRIBUTE_UNUSED) +{ + reloc_howto_type *toc_howto; + long reloc_count; + register arelent **relocs; + register long i; + + toc_howto = bfd_reloc_type_lookup (insec->owner, BFD_RELOC_PPC_TOC16); + if (toc_howto == (reloc_howto_type *) NULL) + abort (); + + /* If this is the .got section, clear out all the contents beyond + the initial size. We must do this here because copy_sections is + going to write out whatever we return in the contents field. */ + if (strcmp (bfd_get_section_name (insec->owner, insec), ".got") == 0) + memset (contents + powerpc_initial_got_size, 0, + (size_t) (bfd_get_section_size_after_reloc (insec) + - powerpc_initial_got_size)); + + reloc_count = *reloc_count_ptr; + relocs = *relocs_ptr; + for (i = 0; i < reloc_count; i++) + { + arelent *rel; + asymbol *sym; + bfd_vma sym_value; + + rel = *relocs++; + sym = *rel->sym_ptr_ptr; + + /* Convert any relocs against the .bss section into relocs + against the .data section. */ + if (strcmp (bfd_get_section_name (outbfd, bfd_get_section (sym)), + NLM_UNINITIALIZED_DATA_NAME) == 0) + { + asection *datasec; + + datasec = bfd_get_section_by_name (outbfd, + NLM_INITIALIZED_DATA_NAME); + if (datasec != NULL) + { + rel->addend += (bfd_get_section_vma (outbfd, + bfd_get_section (sym)) + + sym->value); + rel->sym_ptr_ptr = datasec->symbol_ptr_ptr; + sym = *rel->sym_ptr_ptr; + } + } + + /* We must be able to resolve all PC relative relocs at this + point. If we get a branch to an undefined symbol we build a + stub, since NetWare will resolve undefined symbols into a + pointer to a function descriptor. */ + if (rel->howto->pc_relative) + { + /* This check for whether a symbol is in the same section as + the reloc will be wrong if there is a PC relative reloc + between two sections both of which were placed in the + same output section. This should not happen. */ + if (bfd_get_section (sym) != insec->output_section) + non_fatal (_("unresolved PC relative reloc against %s"), + bfd_asymbol_name (sym)); + else + { + bfd_vma val; + + assert (rel->howto->size == 2 && rel->howto->pcrel_offset); + val = bfd_get_32 (outbfd, (bfd_byte *) contents + rel->address); + val = ((val &~ rel->howto->dst_mask) + | (((val & rel->howto->src_mask) + + (sym->value - rel->address) + + rel->addend) + & rel->howto->dst_mask)); + bfd_put_32 (outbfd, val, (bfd_byte *) contents + rel->address); + + /* If this reloc is against an stubbed symbol and the + next instruction is + cror 31,31,31 + then we replace the next instruction with + lwz r2,20(r1) + This reloads the TOC pointer after a stub call. */ + if (bfd_asymbol_name (sym)[0] == '.' + && (sym->flags & BSF_DYNAMIC) != 0 + && (bfd_get_32 (outbfd, + (bfd_byte *) contents + rel->address + 4) + == 0x4ffffb82)) /* cror 31,31,31 */ + bfd_put_32 (outbfd, (bfd_vma) 0x80410014, /* lwz r2,20(r1) */ + (bfd_byte *) contents + rel->address + 4); + + --*reloc_count_ptr; + --relocs; + memmove (relocs, relocs + 1, + (size_t) ((reloc_count - 1) * sizeof (arelent *))); + continue; + } + } + + /* When considering a TOC reloc, we do not want to include the + symbol value. The symbol will be start of the TOC section + (which is named .got). We do want to include the addend. */ + if (rel->howto == toc_howto) + sym_value = 0; + else + sym_value = sym->value; + + /* If this is a relocation against a symbol with a value, or + there is a reloc addend, we need to update the addend in the + object file. */ + if (sym_value + rel->addend != 0) + { + bfd_vma val; + + switch (rel->howto->size) + { + case 1: + val = bfd_get_16 (outbfd, + (bfd_byte *) contents + rel->address); + val = ((val &~ rel->howto->dst_mask) + | (((val & rel->howto->src_mask) + + sym_value + + rel->addend) + & rel->howto->dst_mask)); + if ((bfd_signed_vma) val < - 0x8000 + || (bfd_signed_vma) val >= 0x8000) + non_fatal (_("overflow when adjusting relocation against %s"), + bfd_asymbol_name (sym)); + bfd_put_16 (outbfd, val, (bfd_byte *) contents + rel->address); + break; + + case 2: + val = bfd_get_32 (outbfd, + (bfd_byte *) contents + rel->address); + val = ((val &~ rel->howto->dst_mask) + | (((val & rel->howto->src_mask) + + sym_value + + rel->addend) + & rel->howto->dst_mask)); + bfd_put_32 (outbfd, val, (bfd_byte *) contents + rel->address); + break; + + default: + abort (); + } + + if (! bfd_is_und_section (bfd_get_section (sym))) + rel->sym_ptr_ptr = bfd_get_section (sym)->symbol_ptr_ptr; + rel->addend = 0; + } + + /* Now that we have incorporated the addend, remove any TOC + relocs. */ + if (rel->howto == toc_howto) + { + --*reloc_count_ptr; + --relocs; + memmove (relocs, relocs + 1, + (size_t) ((reloc_count - i) * sizeof (arelent *))); + continue; + } + + rel->address += insec->output_offset; + } +} + +#endif /* NLMCONV_POWERPC */ + +/* Name of linker. */ +#ifndef LD_NAME +#define LD_NAME "ld" +#endif + +/* The user has specified several input files. Invoke the linker to + link them all together, and convert and delete the resulting output + file. */ + +static char * +link_inputs (struct string_list *inputs, char *ld) +{ + size_t c; + struct string_list *q; + char **argv; + size_t i; + int pid; + int status; + char *errfmt; + char *errarg; + + c = 0; + for (q = inputs; q != NULL; q = q->next) + ++c; + + argv = (char **) alloca ((c + 5) * sizeof(char *)); + +#ifndef __MSDOS__ + if (ld == NULL) + { + char *p; + + /* Find the linker to invoke based on how nlmconv was run. */ + p = program_name + strlen (program_name); + while (p != program_name) + { + if (p[-1] == '/') + { + ld = (char *) xmalloc (p - program_name + strlen (LD_NAME) + 1); + memcpy (ld, program_name, p - program_name); + strcpy (ld + (p - program_name), LD_NAME); + break; + } + --p; + } + } +#endif + + if (ld == NULL) + ld = (char *) LD_NAME; + + unlink_on_exit = make_temp_file (".O"); + + argv[0] = ld; + argv[1] = (char *) "-Ur"; + argv[2] = (char *) "-o"; + argv[3] = unlink_on_exit; + i = 4; + for (q = inputs; q != NULL; q = q->next, i++) + argv[i] = q->string; + argv[i] = NULL; + + if (debug) + { + for (i = 0; argv[i] != NULL; i++) + fprintf (stderr, " %s", argv[i]); + fprintf (stderr, "\n"); + } + + pid = pexecute (ld, argv, program_name, (char *) NULL, &errfmt, &errarg, + PEXECUTE_SEARCH | PEXECUTE_ONE); + if (pid == -1) + { + fprintf (stderr, _("%s: execution of %s failed: "), program_name, ld); + fprintf (stderr, errfmt, errarg); + unlink (unlink_on_exit); + exit (1); + } + + if (pwait (pid, &status, 0) < 0) + { + perror ("pwait"); + unlink (unlink_on_exit); + exit (1); + } + + if (status != 0) + { + non_fatal (_("Execution of %s failed"), ld); + unlink (unlink_on_exit); + exit (1); + } + + return unlink_on_exit; +} diff --git a/binutils/nlmconv.h b/binutils/nlmconv.h new file mode 100644 index 0000000000000..35c84ec0f40ea --- /dev/null +++ b/binutils/nlmconv.h @@ -0,0 +1,84 @@ +/* nlmconv.h -- header file for NLM conversion program + Copyright 1993, 2002, 2003 Free Software Foundation, Inc. + +This file is part of GNU Binutils. + +This program is free software; 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. */ + +/* Written by Ian Lance Taylor . + + bfd.h, nlm/common.h and nlm/internal.h must be included before this + file. */ + +/* A linked list of strings. */ + +struct string_list +{ + struct string_list *next; + char *string; +}; + +/* The NLM header parser in nlmheader.y stores information in the + following variables. */ + +extern Nlm_Internal_Fixed_Header *fixed_hdr; +extern Nlm_Internal_Variable_Header *var_hdr; +extern Nlm_Internal_Version_Header *version_hdr; +extern Nlm_Internal_Copyright_Header *copyright_hdr; +extern Nlm_Internal_Extended_Header *extended_hdr; + +/* Procedure named by CHECK. */ +extern char *check_procedure; +/* File named by CUSTOM. */ +extern char *custom_file; +/* Whether to generate debugging information (DEBUG). */ +extern bfd_boolean debug_info; +/* Procedure named by EXIT. */ +extern char *exit_procedure; +/* Exported symbols (EXPORT). */ +extern struct string_list *export_symbols; +/* List of files from INPUT. */ +extern struct string_list *input_files; +/* Map file name (MAP, FULLMAP). */ +extern char *map_file; +/* Whether a full map has been requested (FULLMAP). */ +extern bfd_boolean full_map; +/* File named by HELP. */ +extern char *help_file; +/* Imported symbols (IMPORT). */ +extern struct string_list *import_symbols; +/* File named by MESSAGES. */ +extern char *message_file; +/* Autoload module list (MODULE). */ +extern struct string_list *modules; +/* File named by OUTPUT. */ +extern char *output_file; +/* File named by SHARELIB. */ +extern char *sharelib_file; +/* Start procedure name (START). */ +extern char *start_procedure; +/* VERBOSE. */ +extern bfd_boolean verbose; +/* RPC description file (XDCDATA). */ +extern char *rpc_file; + +/* The number of serious parse errors. */ +extern int parse_errors; + +/* The parser. */ +extern int yyparse (void); + +/* Tell the lexer what file to read. */ +extern bfd_boolean nlmlex_file (const char *); diff --git a/binutils/nlmheader.c b/binutils/nlmheader.c new file mode 100644 index 0000000000000..b522586453f8f --- /dev/null +++ b/binutils/nlmheader.c @@ -0,0 +1,2171 @@ +/* A Bison parser, made from nlmheader.y + by GNU bison 1.35. */ + +#define YYBISON 1 /* Identify Bison output. */ + +# define CHECK 257 +# define CODESTART 258 +# define COPYRIGHT 259 +# define CUSTOM 260 +# define DATE 261 +# define DEBUG 262 +# define DESCRIPTION 263 +# define EXIT 264 +# define EXPORT 265 +# define FLAG_ON 266 +# define FLAG_OFF 267 +# define FULLMAP 268 +# define HELP 269 +# define IMPORT 270 +# define INPUT 271 +# define MAP 272 +# define MESSAGES 273 +# define MODULE 274 +# define MULTIPLE 275 +# define OS_DOMAIN 276 +# define OUTPUT 277 +# define PSEUDOPREEMPTION 278 +# define REENTRANT 279 +# define SCREENNAME 280 +# define SHARELIB 281 +# define STACK 282 +# define START 283 +# define SYNCHRONIZE 284 +# define THREADNAME 285 +# define TYPE 286 +# define VERBOSE 287 +# define VERSIONK 288 +# define XDCDATA 289 +# define STRING 290 +# define QUOTED_STRING 291 + +#line 1 "nlmheader.y" +/* nlmheader.y - parse NLM header specification keywords. + Copyright 1993, 1994, 1995, 1997, 1998, 2001, 2002, 2003 + Free Software Foundation, Inc. + +This file is part of GNU Binutils. + +This program is free software; 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. */ + +/* Written by Ian Lance Taylor . + + This bison file parses the commands recognized by the NetWare NLM + linker, except for lists of object files. It stores the + information in global variables. + + This implementation is based on the description in the NetWare Tool + Maker Specification manual, edition 1.0. */ + +#include "ansidecl.h" +#include +#include "safe-ctype.h" +#include "bfd.h" +#include "bucomm.h" +#include "nlm/common.h" +#include "nlm/internal.h" +#include "nlmconv.h" + +/* Information is stored in the structures pointed to by these + variables. */ + +Nlm_Internal_Fixed_Header *fixed_hdr; +Nlm_Internal_Variable_Header *var_hdr; +Nlm_Internal_Version_Header *version_hdr; +Nlm_Internal_Copyright_Header *copyright_hdr; +Nlm_Internal_Extended_Header *extended_hdr; + +/* Procedure named by CHECK. */ +char *check_procedure; +/* File named by CUSTOM. */ +char *custom_file; +/* Whether to generate debugging information (DEBUG). */ +bfd_boolean debug_info; +/* Procedure named by EXIT. */ +char *exit_procedure; +/* Exported symbols (EXPORT). */ +struct string_list *export_symbols; +/* List of files from INPUT. */ +struct string_list *input_files; +/* Map file name (MAP, FULLMAP). */ +char *map_file; +/* Whether a full map has been requested (FULLMAP). */ +bfd_boolean full_map; +/* File named by HELP. */ +char *help_file; +/* Imported symbols (IMPORT). */ +struct string_list *import_symbols; +/* File named by MESSAGES. */ +char *message_file; +/* Autoload module list (MODULE). */ +struct string_list *modules; +/* File named by OUTPUT. */ +char *output_file; +/* File named by SHARELIB. */ +char *sharelib_file; +/* Start procedure name (START). */ +char *start_procedure; +/* VERBOSE. */ +bfd_boolean verbose; +/* RPC description file (XDCDATA). */ +char *rpc_file; + +/* The number of serious errors that have occurred. */ +int parse_errors; + +/* The current symbol prefix when reading a list of import or export + symbols. */ +static char *symbol_prefix; + +/* Parser error message handler. */ +#define yyerror(msg) nlmheader_error (msg); + +/* Local functions. */ +static int yylex (void); +static void nlmlex_file_push (const char *); +static bfd_boolean nlmlex_file_open (const char *); +static int nlmlex_buf_init (void); +static char nlmlex_buf_add (int); +static long nlmlex_get_number (const char *); +static void nlmheader_identify (void); +static void nlmheader_warn (const char *, int); +static void nlmheader_error (const char *); +static struct string_list * string_list_cons (char *, struct string_list *); +static struct string_list * string_list_append (struct string_list *, + struct string_list *); +static struct string_list * string_list_append1 (struct string_list *, + char *); +static char *xstrdup (const char *); + + +#line 112 "nlmheader.y" +#ifndef YYSTYPE +typedef union +{ + char *string; + struct string_list *list; +} yystype; +# define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 +#endif +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + + + +#define YYFINAL 82 +#define YYFLAG -32768 +#define YYNTBASE 40 + +/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ +#define YYTRANSLATE(x) ((unsigned)(x) <= 291 ? yytranslate[x] : 50) + +/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ +static const char 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, 2, 2, + 38, 39, 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, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37 +}; + +#if YYDEBUG +static const short yyprhs[] = +{ + 0, 0, 2, 3, 6, 9, 12, 15, 18, 23, + 25, 28, 31, 32, 36, 39, 42, 44, 47, 50, + 51, 55, 58, 60, 63, 66, 69, 71, 73, 76, + 78, 80, 83, 86, 89, 92, 94, 97, 100, 102, + 107, 111, 114, 115, 117, 119, 121, 124, 127, 131, + 133, 134 +}; +static const short yyrhs[] = +{ + 41, 0, 0, 42, 41, 0, 3, 36, 0, 4, + 36, 0, 5, 37, 0, 6, 36, 0, 7, 36, + 36, 36, 0, 8, 0, 9, 37, 0, 10, 36, + 0, 0, 11, 43, 45, 0, 12, 36, 0, 13, + 36, 0, 14, 0, 14, 36, 0, 15, 36, 0, + 0, 16, 44, 45, 0, 17, 49, 0, 18, 0, + 18, 36, 0, 19, 36, 0, 20, 49, 0, 21, + 0, 22, 0, 23, 36, 0, 24, 0, 25, 0, + 26, 37, 0, 27, 36, 0, 28, 36, 0, 29, + 36, 0, 30, 0, 31, 37, 0, 32, 36, 0, + 33, 0, 34, 36, 36, 36, 0, 34, 36, 36, + 0, 35, 36, 0, 0, 46, 0, 48, 0, 47, + 0, 46, 48, 0, 46, 47, 0, 38, 36, 39, + 0, 36, 0, 0, 36, 49, 0 +}; + +#endif + +#if YYDEBUG +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const short yyrline[] = +{ + 0, 143, 149, 151, 156, 161, 166, 183, 187, 205, + 209, 225, 229, 229, 237, 242, 247, 252, 257, 261, + 261, 269, 273, 277, 281, 285, 289, 293, 297, 304, + 308, 312, 328, 332, 337, 341, 345, 361, 366, 370, + 394, 410, 418, 423, 433, 438, 442, 446, 454, 465, + 481, 486 +}; +#endif + + +#if (YYDEBUG) || defined YYERROR_VERBOSE + +/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ +static const char *const yytname[] = +{ + "$", "error", "$undefined.", "CHECK", "CODESTART", "COPYRIGHT", "CUSTOM", + "DATE", "DEBUG", "DESCRIPTION", "EXIT", "EXPORT", "FLAG_ON", "FLAG_OFF", + "FULLMAP", "HELP", "IMPORT", "INPUT", "MAP", "MESSAGES", "MODULE", + "MULTIPLE", "OS_DOMAIN", "OUTPUT", "PSEUDOPREEMPTION", "REENTRANT", + "SCREENNAME", "SHARELIB", "STACK", "START", "SYNCHRONIZE", "THREADNAME", + "TYPE", "VERBOSE", "VERSIONK", "XDCDATA", "STRING", "QUOTED_STRING", + "'('", "')'", "file", "commands", "command", "@1", "@2", + "symbol_list_opt", "symbol_list", "symbol_prefix", "symbol", + "string_list", 0 +}; +#endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const short yyr1[] = +{ + 0, 40, 41, 41, 42, 42, 42, 42, 42, 42, + 42, 42, 43, 42, 42, 42, 42, 42, 42, 44, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 45, 45, 46, 46, 46, 46, 47, 48, + 49, 49 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const short yyr2[] = +{ + 0, 1, 0, 2, 2, 2, 2, 2, 4, 1, + 2, 2, 0, 3, 2, 2, 1, 2, 2, 0, + 3, 2, 1, 2, 2, 2, 1, 1, 2, 1, + 1, 2, 2, 2, 2, 1, 2, 2, 1, 4, + 3, 2, 0, 1, 1, 1, 2, 2, 3, 1, + 0, 2 +}; + +/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE + doesn't specify something else to do. Zero means the default is an + error. */ +static const short yydefact[] = +{ + 2, 0, 0, 0, 0, 0, 9, 0, 0, 12, + 0, 0, 16, 0, 19, 50, 22, 0, 50, 26, + 27, 0, 29, 30, 0, 0, 0, 0, 35, 0, + 0, 38, 0, 0, 1, 2, 4, 5, 6, 7, + 0, 10, 11, 42, 14, 15, 17, 18, 42, 50, + 21, 23, 24, 25, 28, 31, 32, 33, 34, 36, + 37, 0, 41, 3, 0, 49, 0, 13, 43, 45, + 44, 20, 51, 40, 8, 0, 47, 46, 39, 48, + 0, 0, 0 +}; + +static const short yydefgoto[] = +{ + 80, 34, 35, 43, 48, 67, 68, 69, 70, 50 +}; + +static const short yypact[] = +{ + -3, -1, 1, 2, 4, 5,-32768, 6, 8,-32768, + 9, 10, 11, 12,-32768, 13, 14, 16, 13,-32768, + -32768, 17,-32768,-32768, 18, 20, 21, 22,-32768, 23, + 25,-32768, 26, 27,-32768, -3,-32768,-32768,-32768,-32768, + 29,-32768,-32768, -2,-32768,-32768,-32768,-32768, -2, 13, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768, 30,-32768,-32768, 31,-32768, 32,-32768, -2,-32768, + -32768,-32768,-32768, 33,-32768, 3,-32768,-32768,-32768,-32768, + 38, 51,-32768 +}; + +static const short yypgoto[] = +{ + -32768, 19,-32768,-32768,-32768, 24,-32768, -9, 7, 15 +}; + + +#define YYLAST 75 + + +static const short yytable[] = +{ + 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, 27, 28, 29, 30, + 31, 32, 33, 53, 65, 36, 66, 37, 81, 38, + 39, 40, 79, 41, 42, 44, 45, 46, 47, 49, + 51, 82, 52, 54, 63, 55, 56, 57, 58, 76, + 59, 60, 61, 62, 72, 64, 73, 74, 75, 78, + 0, 0, 71, 0, 0, 77 +}; + +static const short yycheck[] = +{ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 18, 36, 36, 38, 36, 0, 37, + 36, 36, 39, 37, 36, 36, 36, 36, 36, 36, + 36, 0, 36, 36, 35, 37, 36, 36, 36, 68, + 37, 36, 36, 36, 49, 36, 36, 36, 36, 36, + -1, -1, 48, -1, -1, 68 +}; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/share/bison-1.35/bison.simple" + +/* Skeleton output parser for bison, + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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. */ + +/* 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 is the parser code that is written into each bison parser when + the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* 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. */ + +#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# else +# ifndef YYSTACK_USE_ALLOCA +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# 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 /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free +# endif +#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short yyss; + YYSTYPE yyvs; +# if YYLSP_NEEDED + YYLTYPE yyls; +# endif +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# if YYLSP_NEEDED +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAX) +# else +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAX) +# endif + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if 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; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (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_MAX; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + + +#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 /* 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 +#define YYEOF 0 +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* 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); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror ("syntax error: cannot back up"); \ + YYERROR; \ + } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). + + When YYLLOC_DEFAULT is run, CURRENT is set the location of the + first token. By default, to implement support for ranges, extend + its range to the last symbol. */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + Current.last_line = Rhs[N].last_line; \ + Current.last_column = Rhs[N].last_column; +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#if YYPURE +# if YYLSP_NEEDED +# ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +# else +# define YYLEX yylex (&yylval, &yylloc) +# endif +# else /* !YYLSP_NEEDED */ +# ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, YYLEX_PARAM) +# else +# define YYLEX yylex (&yylval) +# endif +# endif /* !YYLSP_NEEDED */ +#else /* !YYPURE */ +# define YYLEX yylex () +#endif /* !YYPURE */ + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +#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 + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#if YYMAXDEPTH == 0 +# undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + +#ifdef YYERROR_VERBOSE + +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif +{ + register const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; +} +# 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. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif +{ + register char *yyd = yydest; + register const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif +#endif + +#line 315 "/usr/share/bison-1.35/bison.simple" + + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +# define YYPARSE_PARAM_DECL +# else +# define YYPARSE_PARAM_ARG YYPARSE_PARAM +# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +# endif +#else /* !YYPARSE_PARAM */ +# define YYPARSE_PARAM_ARG +# define YYPARSE_PARAM_DECL +#endif /* !YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +# ifdef YYPARSE_PARAM +int yyparse (void *); +# else +int yyparse (void); +# endif +#endif + +/* YY_DECL_VARIABLES -- depending whether we use a pure parser, + variables are global, or local to YYPARSE. */ + +#define YY_DECL_NON_LSP_VARIABLES \ +/* The lookahead symbol. */ \ +int yychar; \ + \ +/* The semantic value of the lookahead symbol. */ \ +YYSTYPE yylval; \ + \ +/* Number of parse errors so far. */ \ +int yynerrs; + +#if YYLSP_NEEDED +# define YY_DECL_VARIABLES \ +YY_DECL_NON_LSP_VARIABLES \ + \ +/* Location data for the lookahead symbol. */ \ +YYLTYPE yylloc; +#else +# define YY_DECL_VARIABLES \ +YY_DECL_NON_LSP_VARIABLES +#endif + + +/* If nonreentrant, generate the variables here. */ + +#if !YYPURE +YY_DECL_VARIABLES +#endif /* !YYPURE */ + +int +yyparse (YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + /* If reentrant, generate the variables here. */ +#if YYPURE + YY_DECL_VARIABLES +#endif /* !YYPURE */ + + register int yystate; + register int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Lookahead token as an internal (translated) token number. */ + int yychar1 = 0; + + /* 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. */ + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; + register short *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; + +#if YYLSP_NEEDED + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; +#endif + +#if YYLSP_NEEDED +# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +# define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + YYSIZE_T yystacksize = YYINITDEPTH; + + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; +#if YYLSP_NEEDED + YYLTYPE yyloc; +#endif + + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; + + 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; +#if YYLSP_NEEDED + yylsp = yyls; +#endif + 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 (yyssp >= yyss + yystacksize - 1) + { + /* 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; + short *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. */ +# if YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; + /* 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", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + yyls = yyls1; +# else + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); +# endif + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + goto yyoverflowlab; + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + + { + short *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); +# if YYLSP_NEEDED + YYSTACK_RELOCATE (yyls); +# endif +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; +#if YYLSP_NEEDED + yylsp = yyls + yysize - 1; +#endif + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; + + +/*-----------. +| yybackup. | +`-----------*/ +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. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yychar1 = YYTRANSLATE (yychar); + +#if YYDEBUG + /* We have to keep this `#if YYDEBUG', since we use variables + which are defined only if `YYDEBUG' is set. */ + if (yydebug) + { + YYFPRINTF (stderr, "Next token is %d (%s", + yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise + meaning of a token, for further debugging info. */ +# ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +# endif + YYFPRINTF (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + YYDPRINTF ((stderr, "Shifting token %d (%s), ", + yychar, yytname[yychar1])); + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#if YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + yystate = yyn; + 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 the semantic value of + the lookahead token. 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]; + +#if YYLSP_NEEDED + /* Similarly for the default location. Let the user run additional + commands if for instance locations are ranges. */ + yyloc = yylsp[1-yylen]; + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); +#endif + +#if YYDEBUG + /* We have to keep this `#if YYDEBUG', since we use variables which + are defined only if `YYDEBUG' is set. */ + if (yydebug) + { + int yyi; + + YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + switch (yyn) { + +case 4: +#line 158 "nlmheader.y" +{ + check_procedure = yyvsp[0].string; + } + break; +case 5: +#line 162 "nlmheader.y" +{ + nlmheader_warn (_("CODESTART is not implemented; sorry"), -1); + free (yyvsp[0].string); + } + break; +case 6: +#line 167 "nlmheader.y" +{ + int len; + + strncpy (copyright_hdr->stamp, "CoPyRiGhT=", 10); + len = strlen (yyvsp[0].string); + if (len >= NLM_MAX_COPYRIGHT_MESSAGE_LENGTH) + { + nlmheader_warn (_("copyright string is too long"), + NLM_MAX_COPYRIGHT_MESSAGE_LENGTH - 1); + len = NLM_MAX_COPYRIGHT_MESSAGE_LENGTH - 1; + } + copyright_hdr->copyrightMessageLength = len; + strncpy (copyright_hdr->copyrightMessage, yyvsp[0].string, len); + copyright_hdr->copyrightMessage[len] = '\0'; + free (yyvsp[0].string); + } + break; +case 7: +#line 184 "nlmheader.y" +{ + custom_file = yyvsp[0].string; + } + break; +case 8: +#line 188 "nlmheader.y" +{ + /* We don't set the version stamp here, because we use the + version stamp to detect whether the required VERSION + keyword was given. */ + version_hdr->month = nlmlex_get_number (yyvsp[-2].string); + version_hdr->day = nlmlex_get_number (yyvsp[-1].string); + version_hdr->year = nlmlex_get_number (yyvsp[0].string); + free (yyvsp[-2].string); + free (yyvsp[-1].string); + free (yyvsp[0].string); + if (version_hdr->month < 1 || version_hdr->month > 12) + nlmheader_warn (_("illegal month"), -1); + if (version_hdr->day < 1 || version_hdr->day > 31) + nlmheader_warn (_("illegal day"), -1); + if (version_hdr->year < 1900 || version_hdr->year > 3000) + nlmheader_warn (_("illegal year"), -1); + } + break; +case 9: +#line 206 "nlmheader.y" +{ + debug_info = TRUE; + } + break; +case 10: +#line 210 "nlmheader.y" +{ + int len; + + len = strlen (yyvsp[0].string); + if (len > NLM_MAX_DESCRIPTION_LENGTH) + { + nlmheader_warn (_("description string is too long"), + NLM_MAX_DESCRIPTION_LENGTH); + len = NLM_MAX_DESCRIPTION_LENGTH; + } + var_hdr->descriptionLength = len; + strncpy (var_hdr->descriptionText, yyvsp[0].string, len); + var_hdr->descriptionText[len] = '\0'; + free (yyvsp[0].string); + } + break; +case 11: +#line 226 "nlmheader.y" +{ + exit_procedure = yyvsp[0].string; + } + break; +case 12: +#line 230 "nlmheader.y" +{ + symbol_prefix = NULL; + } + break; +case 13: +#line 234 "nlmheader.y" +{ + export_symbols = string_list_append (export_symbols, yyvsp[0].list); + } + break; +case 14: +#line 238 "nlmheader.y" +{ + fixed_hdr->flags |= nlmlex_get_number (yyvsp[0].string); + free (yyvsp[0].string); + } + break; +case 15: +#line 243 "nlmheader.y" +{ + fixed_hdr->flags &=~ nlmlex_get_number (yyvsp[0].string); + free (yyvsp[0].string); + } + break; +case 16: +#line 248 "nlmheader.y" +{ + map_file = ""; + full_map = TRUE; + } + break; +case 17: +#line 253 "nlmheader.y" +{ + map_file = yyvsp[0].string; + full_map = TRUE; + } + break; +case 18: +#line 258 "nlmheader.y" +{ + help_file = yyvsp[0].string; + } + break; +case 19: +#line 262 "nlmheader.y" +{ + symbol_prefix = NULL; + } + break; +case 20: +#line 266 "nlmheader.y" +{ + import_symbols = string_list_append (import_symbols, yyvsp[0].list); + } + break; +case 21: +#line 270 "nlmheader.y" +{ + input_files = string_list_append (input_files, yyvsp[0].list); + } + break; +case 22: +#line 274 "nlmheader.y" +{ + map_file = ""; + } + break; +case 23: +#line 278 "nlmheader.y" +{ + map_file = yyvsp[0].string; + } + break; +case 24: +#line 282 "nlmheader.y" +{ + message_file = yyvsp[0].string; + } + break; +case 25: +#line 286 "nlmheader.y" +{ + modules = string_list_append (modules, yyvsp[0].list); + } + break; +case 26: +#line 290 "nlmheader.y" +{ + fixed_hdr->flags |= 0x2; + } + break; +case 27: +#line 294 "nlmheader.y" +{ + fixed_hdr->flags |= 0x10; + } + break; +case 28: +#line 298 "nlmheader.y" +{ + if (output_file == NULL) + output_file = yyvsp[0].string; + else + nlmheader_warn (_("ignoring duplicate OUTPUT statement"), -1); + } + break; +case 29: +#line 305 "nlmheader.y" +{ + fixed_hdr->flags |= 0x8; + } + break; +case 30: +#line 309 "nlmheader.y" +{ + fixed_hdr->flags |= 0x1; + } + break; +case 31: +#line 313 "nlmheader.y" +{ + int len; + + len = strlen (yyvsp[0].string); + if (len >= NLM_MAX_SCREEN_NAME_LENGTH) + { + nlmheader_warn (_("screen name is too long"), + NLM_MAX_SCREEN_NAME_LENGTH); + len = NLM_MAX_SCREEN_NAME_LENGTH; + } + var_hdr->screenNameLength = len; + strncpy (var_hdr->screenName, yyvsp[0].string, len); + var_hdr->screenName[NLM_MAX_SCREEN_NAME_LENGTH] = '\0'; + free (yyvsp[0].string); + } + break; +case 32: +#line 329 "nlmheader.y" +{ + sharelib_file = yyvsp[0].string; + } + break; +case 33: +#line 333 "nlmheader.y" +{ + var_hdr->stackSize = nlmlex_get_number (yyvsp[0].string); + free (yyvsp[0].string); + } + break; +case 34: +#line 338 "nlmheader.y" +{ + start_procedure = yyvsp[0].string; + } + break; +case 35: +#line 342 "nlmheader.y" +{ + fixed_hdr->flags |= 0x4; + } + break; +case 36: +#line 346 "nlmheader.y" +{ + int len; + + len = strlen (yyvsp[0].string); + if (len >= NLM_MAX_THREAD_NAME_LENGTH) + { + nlmheader_warn (_("thread name is too long"), + NLM_MAX_THREAD_NAME_LENGTH); + len = NLM_MAX_THREAD_NAME_LENGTH; + } + var_hdr->threadNameLength = len; + strncpy (var_hdr->threadName, yyvsp[0].string, len); + var_hdr->threadName[len] = '\0'; + free (yyvsp[0].string); + } + break; +case 37: +#line 362 "nlmheader.y" +{ + fixed_hdr->moduleType = nlmlex_get_number (yyvsp[0].string); + free (yyvsp[0].string); + } + break; +case 38: +#line 367 "nlmheader.y" +{ + verbose = TRUE; + } + break; +case 39: +#line 371 "nlmheader.y" +{ + long val; + + strncpy (version_hdr->stamp, "VeRsIoN#", 8); + version_hdr->majorVersion = nlmlex_get_number (yyvsp[-2].string); + val = nlmlex_get_number (yyvsp[-1].string); + if (val < 0 || val > 99) + nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"), + -1); + else + version_hdr->minorVersion = val; + val = nlmlex_get_number (yyvsp[0].string); + if (val < 0) + nlmheader_warn (_("illegal revision number (must be between 0 and 26)"), + -1); + else if (val > 26) + version_hdr->revision = 0; + else + version_hdr->revision = val; + free (yyvsp[-2].string); + free (yyvsp[-1].string); + free (yyvsp[0].string); + } + break; +case 40: +#line 395 "nlmheader.y" +{ + long val; + + strncpy (version_hdr->stamp, "VeRsIoN#", 8); + version_hdr->majorVersion = nlmlex_get_number (yyvsp[-1].string); + val = nlmlex_get_number (yyvsp[0].string); + if (val < 0 || val > 99) + nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"), + -1); + else + version_hdr->minorVersion = val; + version_hdr->revision = 0; + free (yyvsp[-1].string); + free (yyvsp[0].string); + } + break; +case 41: +#line 411 "nlmheader.y" +{ + rpc_file = yyvsp[0].string; + } + break; +case 42: +#line 420 "nlmheader.y" +{ + yyval.list = NULL; + } + break; +case 43: +#line 424 "nlmheader.y" +{ + yyval.list = yyvsp[0].list; + } + break; +case 44: +#line 435 "nlmheader.y" +{ + yyval.list = string_list_cons (yyvsp[0].string, NULL); + } + break; +case 45: +#line 439 "nlmheader.y" +{ + yyval.list = NULL; + } + break; +case 46: +#line 443 "nlmheader.y" +{ + yyval.list = string_list_append1 (yyvsp[-1].list, yyvsp[0].string); + } + break; +case 47: +#line 447 "nlmheader.y" +{ + yyval.list = yyvsp[-1].list; + } + break; +case 48: +#line 456 "nlmheader.y" +{ + if (symbol_prefix != NULL) + free (symbol_prefix); + symbol_prefix = yyvsp[-1].string; + } + break; +case 49: +#line 467 "nlmheader.y" +{ + if (symbol_prefix == NULL) + yyval.string = yyvsp[0].string; + else + { + yyval.string = xmalloc (strlen (symbol_prefix) + strlen (yyvsp[0].string) + 2); + sprintf (yyval.string, "%s@%s", symbol_prefix, yyvsp[0].string); + free (yyvsp[0].string); + } + } + break; +case 50: +#line 483 "nlmheader.y" +{ + yyval.list = NULL; + } + break; +case 51: +#line 487 "nlmheader.y" +{ + yyval.list = string_list_cons (yyvsp[-1].string, yyvsp[0].list); + } + break; +} + +#line 705 "/usr/share/bison-1.35/bison.simple" + + + yyvsp -= yylen; + yyssp -= yylen; +#if YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG + if (yydebug) + { + short *yyssp1 = yyss - 1; + YYFPRINTF (stderr, "state stack now"); + while (yyssp1 != yyssp) + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; +#if YYLSP_NEEDED + *++yylsp = yyloc; +#endif + + /* 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 - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + char *yymsg; + int yyx, yycount; + + yycount = 0; + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) + if (yycheck[yyx + yyn] == yyx) + yysize += yystrlen (yytname[yyx]) + 15, yycount++; + yysize += yystrlen ("parse error, unexpected ") + 1; + yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "parse error, unexpected "); + yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); + + if (yycount < 5) + { + yycount = 0; + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); + yyx++) + if (yycheck[yyx + yyn] == yyx) + { + const char *yyq = ! yycount ? ", expecting " : " or "; + yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yytname[yyx]); + yycount++; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("parse error; also virtual memory exhausted"); + } + else +#endif /* defined (YYERROR_VERBOSE) */ + yyerror ("parse error"); + } + goto yyerrlab1; + + +/*--------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action | +`--------------------------------------------------*/ +yyerrlab1: + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + YYDPRINTF ((stderr, "Discarding token %d (%s).\n", + yychar, yytname[yychar1])); + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + + +/*-------------------------------------------------------------------. +| yyerrdefault -- current state does not do anything special for the | +| error token. | +`-------------------------------------------------------------------*/ +yyerrdefault: +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + + /* If its default is to accept any token, ok. Otherwise pop it. */ + yyn = yydefact[yystate]; + if (yyn) + goto yydefault; +#endif + + +/*---------------------------------------------------------------. +| yyerrpop -- pop the current state because it cannot handle the | +| error token | +`---------------------------------------------------------------*/ +yyerrpop: + if (yyssp == yyss) + YYABORT; + yyvsp--; + yystate = *--yyssp; +#if YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG + if (yydebug) + { + short *yyssp1 = yyss - 1; + YYFPRINTF (stderr, "Error: state stack now"); + while (yyssp1 != yyssp) + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); + } +#endif + +/*--------------. +| yyerrhandle. | +`--------------*/ +yyerrhandle: + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + + YYDPRINTF ((stderr, "Shifting error token, ")); + + *++yyvsp = yylval; +#if YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +/*---------------------------------------------. +| yyoverflowab -- parser overflow comes here. | +`---------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; +} +#line 492 "nlmheader.y" + + +/* If strerror is just a macro, we want to use the one from libiberty + since it will handle undefined values. */ +#undef strerror +extern char *strerror PARAMS ((int)); + +/* The lexer is simple, too simple for flex. Keywords are only + recognized at the start of lines. Everything else must be an + argument. A comma is treated as whitespace. */ + +/* The states the lexer can be in. */ + +enum lex_state +{ + /* At the beginning of a line. */ + BEGINNING_OF_LINE, + /* In the middle of a line. */ + IN_LINE +}; + +/* We need to keep a stack of files to handle file inclusion. */ + +struct input +{ + /* The file to read from. */ + FILE *file; + /* The name of the file. */ + char *name; + /* The current line number. */ + int lineno; + /* The current state. */ + enum lex_state state; + /* The next file on the stack. */ + struct input *next; +}; + +/* The current input file. */ + +static struct input current; + +/* The character which introduces comments. */ +#define COMMENT_CHAR '#' + +/* Start the lexer going on the main input file. */ + +bfd_boolean +nlmlex_file (const char *name) +{ + current.next = NULL; + return nlmlex_file_open (name); +} + +/* Start the lexer going on a subsidiary input file. */ + +static void +nlmlex_file_push (const char *name) +{ + struct input *push; + + push = (struct input *) xmalloc (sizeof (struct input)); + *push = current; + if (nlmlex_file_open (name)) + current.next = push; + else + { + current = *push; + free (push); + } +} + +/* Start lexing from a file. */ + +static bfd_boolean +nlmlex_file_open (const char *name) +{ + current.file = fopen (name, "r"); + if (current.file == NULL) + { + fprintf (stderr, "%s:%s: %s\n", program_name, name, strerror (errno)); + ++parse_errors; + return FALSE; + } + current.name = xstrdup (name); + current.lineno = 1; + current.state = BEGINNING_OF_LINE; + return TRUE; +} + +/* Table used to turn keywords into tokens. */ + +struct keyword_tokens_struct +{ + const char *keyword; + int token; +}; + +struct keyword_tokens_struct keyword_tokens[] = +{ + { "CHECK", CHECK }, + { "CODESTART", CODESTART }, + { "COPYRIGHT", COPYRIGHT }, + { "CUSTOM", CUSTOM }, + { "DATE", DATE }, + { "DEBUG", DEBUG }, + { "DESCRIPTION", DESCRIPTION }, + { "EXIT", EXIT }, + { "EXPORT", EXPORT }, + { "FLAG_ON", FLAG_ON }, + { "FLAG_OFF", FLAG_OFF }, + { "FULLMAP", FULLMAP }, + { "HELP", HELP }, + { "IMPORT", IMPORT }, + { "INPUT", INPUT }, + { "MAP", MAP }, + { "MESSAGES", MESSAGES }, + { "MODULE", MODULE }, + { "MULTIPLE", MULTIPLE }, + { "OS_DOMAIN", OS_DOMAIN }, + { "OUTPUT", OUTPUT }, + { "PSEUDOPREEMPTION", PSEUDOPREEMPTION }, + { "REENTRANT", REENTRANT }, + { "SCREENNAME", SCREENNAME }, + { "SHARELIB", SHARELIB }, + { "STACK", STACK }, + { "STACKSIZE", STACK }, + { "START", START }, + { "SYNCHRONIZE", SYNCHRONIZE }, + { "THREADNAME", THREADNAME }, + { "TYPE", TYPE }, + { "VERBOSE", VERBOSE }, + { "VERSION", VERSIONK }, + { "XDCDATA", XDCDATA } +}; + +#define KEYWORD_COUNT (sizeof (keyword_tokens) / sizeof (keyword_tokens[0])) + +/* The lexer accumulates strings in these variables. */ +static char *lex_buf; +static int lex_size; +static int lex_pos; + +/* Start accumulating strings into the buffer. */ +#define BUF_INIT() \ + ((void) (lex_buf != NULL ? lex_pos = 0 : nlmlex_buf_init ())) + +static int +nlmlex_buf_init (void) +{ + lex_size = 10; + lex_buf = xmalloc (lex_size + 1); + lex_pos = 0; + return 0; +} + +/* Finish a string in the buffer. */ +#define BUF_FINISH() ((void) (lex_buf[lex_pos] = '\0')) + +/* Accumulate a character into the buffer. */ +#define BUF_ADD(c) \ + ((void) (lex_pos < lex_size \ + ? lex_buf[lex_pos++] = (c) \ + : nlmlex_buf_add (c))) + +static char +nlmlex_buf_add (int c) +{ + if (lex_pos >= lex_size) + { + lex_size *= 2; + lex_buf = xrealloc (lex_buf, lex_size + 1); + } + + return lex_buf[lex_pos++] = c; +} + +/* The lexer proper. This is called by the bison generated parsing + code. */ + +static int +yylex (void) +{ + int c; + +tail_recurse: + + c = getc (current.file); + + /* Commas are treated as whitespace characters. */ + while (ISSPACE (c) || c == ',') + { + current.state = IN_LINE; + if (c == '\n') + { + ++current.lineno; + current.state = BEGINNING_OF_LINE; + } + c = getc (current.file); + } + + /* At the end of the file we either pop to the previous file or + finish up. */ + if (c == EOF) + { + fclose (current.file); + free (current.name); + if (current.next == NULL) + return 0; + else + { + struct input *next; + + next = current.next; + current = *next; + free (next); + goto tail_recurse; + } + } + + /* A comment character always means to drop everything until the + next newline. */ + if (c == COMMENT_CHAR) + { + do + { + c = getc (current.file); + } + while (c != '\n'); + ++current.lineno; + current.state = BEGINNING_OF_LINE; + goto tail_recurse; + } + + /* An '@' introduces an include file. */ + if (c == '@') + { + do + { + c = getc (current.file); + if (c == '\n') + ++current.lineno; + } + while (ISSPACE (c)); + BUF_INIT (); + while (! ISSPACE (c) && c != EOF) + { + BUF_ADD (c); + c = getc (current.file); + } + BUF_FINISH (); + + ungetc (c, current.file); + + nlmlex_file_push (lex_buf); + goto tail_recurse; + } + + /* A non-space character at the start of a line must be the start of + a keyword. */ + if (current.state == BEGINNING_OF_LINE) + { + BUF_INIT (); + while (ISALNUM (c) || c == '_') + { + BUF_ADD (TOUPPER (c)); + c = getc (current.file); + } + BUF_FINISH (); + + if (c != EOF && ! ISSPACE (c) && c != ',') + { + nlmheader_identify (); + fprintf (stderr, _("%s:%d: illegal character in keyword: %c\n"), + current.name, current.lineno, c); + } + else + { + unsigned int i; + + for (i = 0; i < KEYWORD_COUNT; i++) + { + if (lex_buf[0] == keyword_tokens[i].keyword[0] + && strcmp (lex_buf, keyword_tokens[i].keyword) == 0) + { + /* Pushing back the final whitespace avoids worrying + about \n here. */ + ungetc (c, current.file); + current.state = IN_LINE; + return keyword_tokens[i].token; + } + } + + nlmheader_identify (); + fprintf (stderr, _("%s:%d: unrecognized keyword: %s\n"), + current.name, current.lineno, lex_buf); + } + + ++parse_errors; + /* Treat the rest of this line as a comment. */ + ungetc (COMMENT_CHAR, current.file); + goto tail_recurse; + } + + /* Parentheses just represent themselves. */ + if (c == '(' || c == ')') + return c; + + /* Handle quoted strings. */ + if (c == '"' || c == '\'') + { + int quote; + int start_lineno; + + quote = c; + start_lineno = current.lineno; + + c = getc (current.file); + BUF_INIT (); + while (c != quote && c != EOF) + { + BUF_ADD (c); + if (c == '\n') + ++current.lineno; + c = getc (current.file); + } + BUF_FINISH (); + + if (c == EOF) + { + nlmheader_identify (); + fprintf (stderr, _("%s:%d: end of file in quoted string\n"), + current.name, start_lineno); + ++parse_errors; + } + + /* FIXME: Possible memory leak. */ + yylval.string = xstrdup (lex_buf); + return QUOTED_STRING; + } + + /* Gather a generic argument. */ + BUF_INIT (); + while (! ISSPACE (c) + && c != ',' + && c != COMMENT_CHAR + && c != '(' + && c != ')') + { + BUF_ADD (c); + c = getc (current.file); + } + BUF_FINISH (); + + ungetc (c, current.file); + + /* FIXME: Possible memory leak. */ + yylval.string = xstrdup (lex_buf); + return STRING; +} + +/* Get a number from a string. */ + +static long +nlmlex_get_number (const char *s) +{ + long ret; + char *send; + + ret = strtol (s, &send, 10); + if (*send != '\0') + nlmheader_warn (_("bad number"), -1); + return ret; +} + +/* Prefix the nlmconv warnings with a note as to where they come from. + We don't use program_name on every warning, because then some + versions of the emacs next-error function can't recognize the line + number. */ + +static void +nlmheader_identify (void) +{ + static int done; + + if (! done) + { + fprintf (stderr, _("%s: problems in NLM command language input:\n"), + program_name); + done = 1; + } +} + +/* Issue a warning. */ + +static void +nlmheader_warn (const char *s, int imax) +{ + nlmheader_identify (); + fprintf (stderr, "%s:%d: %s", current.name, current.lineno, s); + if (imax != -1) + fprintf (stderr, " (max %d)", imax); + fprintf (stderr, "\n"); +} + +/* Report an error. */ + +static void +nlmheader_error (const char *s) +{ + nlmheader_warn (s, -1); + ++parse_errors; +} + +/* Add a string to a string list. */ + +static struct string_list * +string_list_cons (char *s, struct string_list *l) +{ + struct string_list *ret; + + ret = (struct string_list *) xmalloc (sizeof (struct string_list)); + ret->next = l; + ret->string = s; + return ret; +} + +/* Append a string list to another string list. */ + +static struct string_list * +string_list_append (struct string_list *l1, struct string_list *l2) +{ + register struct string_list **pp; + + for (pp = &l1; *pp != NULL; pp = &(*pp)->next) + ; + *pp = l2; + return l1; +} + +/* Append a string to a string list. */ + +static struct string_list * +string_list_append1 (struct string_list *l, char *s) +{ + struct string_list *n; + register struct string_list **pp; + + n = (struct string_list *) xmalloc (sizeof (struct string_list)); + n->next = NULL; + n->string = s; + for (pp = &l; *pp != NULL; pp = &(*pp)->next) + ; + *pp = n; + return l; +} + +/* Duplicate a string in memory. */ + +static char * +xstrdup (const char *s) +{ + unsigned long len; + char *ret; + + len = strlen (s); + ret = xmalloc (len + 1); + strcpy (ret, s); + return ret; +} diff --git a/binutils/nlmheader.h b/binutils/nlmheader.h new file mode 100644 index 0000000000000..df8807234eced --- /dev/null +++ b/binutils/nlmheader.h @@ -0,0 +1,52 @@ +#ifndef BISON_Y_TAB_H +# define BISON_Y_TAB_H + +#ifndef YYSTYPE +typedef union +{ + char *string; + struct string_list *list; +} yystype; +# define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 +#endif +# define CHECK 257 +# define CODESTART 258 +# define COPYRIGHT 259 +# define CUSTOM 260 +# define DATE 261 +# define DEBUG 262 +# define DESCRIPTION 263 +# define EXIT 264 +# define EXPORT 265 +# define FLAG_ON 266 +# define FLAG_OFF 267 +# define FULLMAP 268 +# define HELP 269 +# define IMPORT 270 +# define INPUT 271 +# define MAP 272 +# define MESSAGES 273 +# define MODULE 274 +# define MULTIPLE 275 +# define OS_DOMAIN 276 +# define OUTPUT 277 +# define PSEUDOPREEMPTION 278 +# define REENTRANT 279 +# define SCREENNAME 280 +# define SHARELIB 281 +# define STACK 282 +# define START 283 +# define SYNCHRONIZE 284 +# define THREADNAME 285 +# define TYPE 286 +# define VERBOSE 287 +# define VERSIONK 288 +# define XDCDATA 289 +# define STRING 290 +# define QUOTED_STRING 291 + + +extern YYSTYPE yylval; + +#endif /* not BISON_Y_TAB_H */ diff --git a/binutils/nlmheader.y b/binutils/nlmheader.y new file mode 100644 index 0000000000000..64101dbf3bcf0 --- /dev/null +++ b/binutils/nlmheader.y @@ -0,0 +1,960 @@ +%{/* nlmheader.y - parse NLM header specification keywords. + Copyright 1993, 1994, 1995, 1997, 1998, 2001, 2002, 2003 + Free Software Foundation, Inc. + +This file is part of GNU Binutils. + +This program is free software; 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. */ + +/* Written by Ian Lance Taylor . + + This bison file parses the commands recognized by the NetWare NLM + linker, except for lists of object files. It stores the + information in global variables. + + This implementation is based on the description in the NetWare Tool + Maker Specification manual, edition 1.0. */ + +#include "ansidecl.h" +#include +#include "safe-ctype.h" +#include "bfd.h" +#include "bucomm.h" +#include "nlm/common.h" +#include "nlm/internal.h" +#include "nlmconv.h" + +/* Information is stored in the structures pointed to by these + variables. */ + +Nlm_Internal_Fixed_Header *fixed_hdr; +Nlm_Internal_Variable_Header *var_hdr; +Nlm_Internal_Version_Header *version_hdr; +Nlm_Internal_Copyright_Header *copyright_hdr; +Nlm_Internal_Extended_Header *extended_hdr; + +/* Procedure named by CHECK. */ +char *check_procedure; +/* File named by CUSTOM. */ +char *custom_file; +/* Whether to generate debugging information (DEBUG). */ +bfd_boolean debug_info; +/* Procedure named by EXIT. */ +char *exit_procedure; +/* Exported symbols (EXPORT). */ +struct string_list *export_symbols; +/* List of files from INPUT. */ +struct string_list *input_files; +/* Map file name (MAP, FULLMAP). */ +char *map_file; +/* Whether a full map has been requested (FULLMAP). */ +bfd_boolean full_map; +/* File named by HELP. */ +char *help_file; +/* Imported symbols (IMPORT). */ +struct string_list *import_symbols; +/* File named by MESSAGES. */ +char *message_file; +/* Autoload module list (MODULE). */ +struct string_list *modules; +/* File named by OUTPUT. */ +char *output_file; +/* File named by SHARELIB. */ +char *sharelib_file; +/* Start procedure name (START). */ +char *start_procedure; +/* VERBOSE. */ +bfd_boolean verbose; +/* RPC description file (XDCDATA). */ +char *rpc_file; + +/* The number of serious errors that have occurred. */ +int parse_errors; + +/* The current symbol prefix when reading a list of import or export + symbols. */ +static char *symbol_prefix; + +/* Parser error message handler. */ +#define yyerror(msg) nlmheader_error (msg); + +/* Local functions. */ +static int yylex (void); +static void nlmlex_file_push (const char *); +static bfd_boolean nlmlex_file_open (const char *); +static int nlmlex_buf_init (void); +static char nlmlex_buf_add (int); +static long nlmlex_get_number (const char *); +static void nlmheader_identify (void); +static void nlmheader_warn (const char *, int); +static void nlmheader_error (const char *); +static struct string_list * string_list_cons (char *, struct string_list *); +static struct string_list * string_list_append (struct string_list *, + struct string_list *); +static struct string_list * string_list_append1 (struct string_list *, + char *); +static char *xstrdup (const char *); + +%} + +%union +{ + char *string; + struct string_list *list; +}; + +/* The reserved words. */ + +%token CHECK CODESTART COPYRIGHT CUSTOM DATE DEBUG DESCRIPTION EXIT +%token EXPORT FLAG_ON FLAG_OFF FULLMAP HELP IMPORT INPUT MAP MESSAGES +%token MODULE MULTIPLE OS_DOMAIN OUTPUT PSEUDOPREEMPTION REENTRANT +%token SCREENNAME SHARELIB STACK START SYNCHRONIZE +%token THREADNAME TYPE VERBOSE VERSIONK XDCDATA + +/* Arguments. */ + +%token STRING +%token QUOTED_STRING + +/* Typed non-terminals. */ +%type symbol_list_opt symbol_list string_list +%type symbol + +%% + +/* Keywords must start in the leftmost column of the file. Arguments + may appear anywhere else. The lexer uses this to determine what + token to return, so we don't have to worry about it here. */ + +/* The entire file is just a list of commands. */ + +file: + commands + ; + +/* A possibly empty list of commands. */ + +commands: + /* May be empty. */ + | command commands + ; + +/* A single command. There is where most of the work takes place. */ + +command: + CHECK STRING + { + check_procedure = $2; + } + | CODESTART STRING + { + nlmheader_warn (_("CODESTART is not implemented; sorry"), -1); + free ($2); + } + | COPYRIGHT QUOTED_STRING + { + int len; + + strncpy (copyright_hdr->stamp, "CoPyRiGhT=", 10); + len = strlen ($2); + if (len >= NLM_MAX_COPYRIGHT_MESSAGE_LENGTH) + { + nlmheader_warn (_("copyright string is too long"), + NLM_MAX_COPYRIGHT_MESSAGE_LENGTH - 1); + len = NLM_MAX_COPYRIGHT_MESSAGE_LENGTH - 1; + } + copyright_hdr->copyrightMessageLength = len; + strncpy (copyright_hdr->copyrightMessage, $2, len); + copyright_hdr->copyrightMessage[len] = '\0'; + free ($2); + } + | CUSTOM STRING + { + custom_file = $2; + } + | DATE STRING STRING STRING + { + /* We don't set the version stamp here, because we use the + version stamp to detect whether the required VERSION + keyword was given. */ + version_hdr->month = nlmlex_get_number ($2); + version_hdr->day = nlmlex_get_number ($3); + version_hdr->year = nlmlex_get_number ($4); + free ($2); + free ($3); + free ($4); + if (version_hdr->month < 1 || version_hdr->month > 12) + nlmheader_warn (_("illegal month"), -1); + if (version_hdr->day < 1 || version_hdr->day > 31) + nlmheader_warn (_("illegal day"), -1); + if (version_hdr->year < 1900 || version_hdr->year > 3000) + nlmheader_warn (_("illegal year"), -1); + } + | DEBUG + { + debug_info = TRUE; + } + | DESCRIPTION QUOTED_STRING + { + int len; + + len = strlen ($2); + if (len > NLM_MAX_DESCRIPTION_LENGTH) + { + nlmheader_warn (_("description string is too long"), + NLM_MAX_DESCRIPTION_LENGTH); + len = NLM_MAX_DESCRIPTION_LENGTH; + } + var_hdr->descriptionLength = len; + strncpy (var_hdr->descriptionText, $2, len); + var_hdr->descriptionText[len] = '\0'; + free ($2); + } + | EXIT STRING + { + exit_procedure = $2; + } + | EXPORT + { + symbol_prefix = NULL; + } + symbol_list_opt + { + export_symbols = string_list_append (export_symbols, $3); + } + | FLAG_ON STRING + { + fixed_hdr->flags |= nlmlex_get_number ($2); + free ($2); + } + | FLAG_OFF STRING + { + fixed_hdr->flags &=~ nlmlex_get_number ($2); + free ($2); + } + | FULLMAP + { + map_file = ""; + full_map = TRUE; + } + | FULLMAP STRING + { + map_file = $2; + full_map = TRUE; + } + | HELP STRING + { + help_file = $2; + } + | IMPORT + { + symbol_prefix = NULL; + } + symbol_list_opt + { + import_symbols = string_list_append (import_symbols, $3); + } + | INPUT string_list + { + input_files = string_list_append (input_files, $2); + } + | MAP + { + map_file = ""; + } + | MAP STRING + { + map_file = $2; + } + | MESSAGES STRING + { + message_file = $2; + } + | MODULE string_list + { + modules = string_list_append (modules, $2); + } + | MULTIPLE + { + fixed_hdr->flags |= 0x2; + } + | OS_DOMAIN + { + fixed_hdr->flags |= 0x10; + } + | OUTPUT STRING + { + if (output_file == NULL) + output_file = $2; + else + nlmheader_warn (_("ignoring duplicate OUTPUT statement"), -1); + } + | PSEUDOPREEMPTION + { + fixed_hdr->flags |= 0x8; + } + | REENTRANT + { + fixed_hdr->flags |= 0x1; + } + | SCREENNAME QUOTED_STRING + { + int len; + + len = strlen ($2); + if (len >= NLM_MAX_SCREEN_NAME_LENGTH) + { + nlmheader_warn (_("screen name is too long"), + NLM_MAX_SCREEN_NAME_LENGTH); + len = NLM_MAX_SCREEN_NAME_LENGTH; + } + var_hdr->screenNameLength = len; + strncpy (var_hdr->screenName, $2, len); + var_hdr->screenName[NLM_MAX_SCREEN_NAME_LENGTH] = '\0'; + free ($2); + } + | SHARELIB STRING + { + sharelib_file = $2; + } + | STACK STRING + { + var_hdr->stackSize = nlmlex_get_number ($2); + free ($2); + } + | START STRING + { + start_procedure = $2; + } + | SYNCHRONIZE + { + fixed_hdr->flags |= 0x4; + } + | THREADNAME QUOTED_STRING + { + int len; + + len = strlen ($2); + if (len >= NLM_MAX_THREAD_NAME_LENGTH) + { + nlmheader_warn (_("thread name is too long"), + NLM_MAX_THREAD_NAME_LENGTH); + len = NLM_MAX_THREAD_NAME_LENGTH; + } + var_hdr->threadNameLength = len; + strncpy (var_hdr->threadName, $2, len); + var_hdr->threadName[len] = '\0'; + free ($2); + } + | TYPE STRING + { + fixed_hdr->moduleType = nlmlex_get_number ($2); + free ($2); + } + | VERBOSE + { + verbose = TRUE; + } + | VERSIONK STRING STRING STRING + { + long val; + + strncpy (version_hdr->stamp, "VeRsIoN#", 8); + version_hdr->majorVersion = nlmlex_get_number ($2); + val = nlmlex_get_number ($3); + if (val < 0 || val > 99) + nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"), + -1); + else + version_hdr->minorVersion = val; + val = nlmlex_get_number ($4); + if (val < 0) + nlmheader_warn (_("illegal revision number (must be between 0 and 26)"), + -1); + else if (val > 26) + version_hdr->revision = 0; + else + version_hdr->revision = val; + free ($2); + free ($3); + free ($4); + } + | VERSIONK STRING STRING + { + long val; + + strncpy (version_hdr->stamp, "VeRsIoN#", 8); + version_hdr->majorVersion = nlmlex_get_number ($2); + val = nlmlex_get_number ($3); + if (val < 0 || val > 99) + nlmheader_warn (_("illegal minor version number (must be between 0 and 99)"), + -1); + else + version_hdr->minorVersion = val; + version_hdr->revision = 0; + free ($2); + free ($3); + } + | XDCDATA STRING + { + rpc_file = $2; + } + ; + +/* A possibly empty list of symbols. */ + +symbol_list_opt: + /* Empty. */ + { + $$ = NULL; + } + | symbol_list + { + $$ = $1; + } + ; + +/* A list of symbols in an import or export list. Prefixes may appear + in parentheses. We need to use left recursion here to avoid + building up a large import list on the parser stack. */ + +symbol_list: + symbol + { + $$ = string_list_cons ($1, NULL); + } + | symbol_prefix + { + $$ = NULL; + } + | symbol_list symbol + { + $$ = string_list_append1 ($1, $2); + } + | symbol_list symbol_prefix + { + $$ = $1; + } + ; + +/* A prefix for subsequent symbols. */ + +symbol_prefix: + '(' STRING ')' + { + if (symbol_prefix != NULL) + free (symbol_prefix); + symbol_prefix = $2; + } + ; + +/* A single symbol. */ + +symbol: + STRING + { + if (symbol_prefix == NULL) + $$ = $1; + else + { + $$ = xmalloc (strlen (symbol_prefix) + strlen ($1) + 2); + sprintf ($$, "%s@%s", symbol_prefix, $1); + free ($1); + } + } + ; + +/* A list of strings. */ + +string_list: + /* May be empty. */ + { + $$ = NULL; + } + | STRING string_list + { + $$ = string_list_cons ($1, $2); + } + ; + +%% + +/* If strerror is just a macro, we want to use the one from libiberty + since it will handle undefined values. */ +#undef strerror +extern char *strerror PARAMS ((int)); + +/* The lexer is simple, too simple for flex. Keywords are only + recognized at the start of lines. Everything else must be an + argument. A comma is treated as whitespace. */ + +/* The states the lexer can be in. */ + +enum lex_state +{ + /* At the beginning of a line. */ + BEGINNING_OF_LINE, + /* In the middle of a line. */ + IN_LINE +}; + +/* We need to keep a stack of files to handle file inclusion. */ + +struct input +{ + /* The file to read from. */ + FILE *file; + /* The name of the file. */ + char *name; + /* The current line number. */ + int lineno; + /* The current state. */ + enum lex_state state; + /* The next file on the stack. */ + struct input *next; +}; + +/* The current input file. */ + +static struct input current; + +/* The character which introduces comments. */ +#define COMMENT_CHAR '#' + +/* Start the lexer going on the main input file. */ + +bfd_boolean +nlmlex_file (const char *name) +{ + current.next = NULL; + return nlmlex_file_open (name); +} + +/* Start the lexer going on a subsidiary input file. */ + +static void +nlmlex_file_push (const char *name) +{ + struct input *push; + + push = (struct input *) xmalloc (sizeof (struct input)); + *push = current; + if (nlmlex_file_open (name)) + current.next = push; + else + { + current = *push; + free (push); + } +} + +/* Start lexing from a file. */ + +static bfd_boolean +nlmlex_file_open (const char *name) +{ + current.file = fopen (name, "r"); + if (current.file == NULL) + { + fprintf (stderr, "%s:%s: %s\n", program_name, name, strerror (errno)); + ++parse_errors; + return FALSE; + } + current.name = xstrdup (name); + current.lineno = 1; + current.state = BEGINNING_OF_LINE; + return TRUE; +} + +/* Table used to turn keywords into tokens. */ + +struct keyword_tokens_struct +{ + const char *keyword; + int token; +}; + +struct keyword_tokens_struct keyword_tokens[] = +{ + { "CHECK", CHECK }, + { "CODESTART", CODESTART }, + { "COPYRIGHT", COPYRIGHT }, + { "CUSTOM", CUSTOM }, + { "DATE", DATE }, + { "DEBUG", DEBUG }, + { "DESCRIPTION", DESCRIPTION }, + { "EXIT", EXIT }, + { "EXPORT", EXPORT }, + { "FLAG_ON", FLAG_ON }, + { "FLAG_OFF", FLAG_OFF }, + { "FULLMAP", FULLMAP }, + { "HELP", HELP }, + { "IMPORT", IMPORT }, + { "INPUT", INPUT }, + { "MAP", MAP }, + { "MESSAGES", MESSAGES }, + { "MODULE", MODULE }, + { "MULTIPLE", MULTIPLE }, + { "OS_DOMAIN", OS_DOMAIN }, + { "OUTPUT", OUTPUT }, + { "PSEUDOPREEMPTION", PSEUDOPREEMPTION }, + { "REENTRANT", REENTRANT }, + { "SCREENNAME", SCREENNAME }, + { "SHARELIB", SHARELIB }, + { "STACK", STACK }, + { "STACKSIZE", STACK }, + { "START", START }, + { "SYNCHRONIZE", SYNCHRONIZE }, + { "THREADNAME", THREADNAME }, + { "TYPE", TYPE }, + { "VERBOSE", VERBOSE }, + { "VERSION", VERSIONK }, + { "XDCDATA", XDCDATA } +}; + +#define KEYWORD_COUNT (sizeof (keyword_tokens) / sizeof (keyword_tokens[0])) + +/* The lexer accumulates strings in these variables. */ +static char *lex_buf; +static int lex_size; +static int lex_pos; + +/* Start accumulating strings into the buffer. */ +#define BUF_INIT() \ + ((void) (lex_buf != NULL ? lex_pos = 0 : nlmlex_buf_init ())) + +static int +nlmlex_buf_init (void) +{ + lex_size = 10; + lex_buf = xmalloc (lex_size + 1); + lex_pos = 0; + return 0; +} + +/* Finish a string in the buffer. */ +#define BUF_FINISH() ((void) (lex_buf[lex_pos] = '\0')) + +/* Accumulate a character into the buffer. */ +#define BUF_ADD(c) \ + ((void) (lex_pos < lex_size \ + ? lex_buf[lex_pos++] = (c) \ + : nlmlex_buf_add (c))) + +static char +nlmlex_buf_add (int c) +{ + if (lex_pos >= lex_size) + { + lex_size *= 2; + lex_buf = xrealloc (lex_buf, lex_size + 1); + } + + return lex_buf[lex_pos++] = c; +} + +/* The lexer proper. This is called by the bison generated parsing + code. */ + +static int +yylex (void) +{ + int c; + +tail_recurse: + + c = getc (current.file); + + /* Commas are treated as whitespace characters. */ + while (ISSPACE (c) || c == ',') + { + current.state = IN_LINE; + if (c == '\n') + { + ++current.lineno; + current.state = BEGINNING_OF_LINE; + } + c = getc (current.file); + } + + /* At the end of the file we either pop to the previous file or + finish up. */ + if (c == EOF) + { + fclose (current.file); + free (current.name); + if (current.next == NULL) + return 0; + else + { + struct input *next; + + next = current.next; + current = *next; + free (next); + goto tail_recurse; + } + } + + /* A comment character always means to drop everything until the + next newline. */ + if (c == COMMENT_CHAR) + { + do + { + c = getc (current.file); + } + while (c != '\n'); + ++current.lineno; + current.state = BEGINNING_OF_LINE; + goto tail_recurse; + } + + /* An '@' introduces an include file. */ + if (c == '@') + { + do + { + c = getc (current.file); + if (c == '\n') + ++current.lineno; + } + while (ISSPACE (c)); + BUF_INIT (); + while (! ISSPACE (c) && c != EOF) + { + BUF_ADD (c); + c = getc (current.file); + } + BUF_FINISH (); + + ungetc (c, current.file); + + nlmlex_file_push (lex_buf); + goto tail_recurse; + } + + /* A non-space character at the start of a line must be the start of + a keyword. */ + if (current.state == BEGINNING_OF_LINE) + { + BUF_INIT (); + while (ISALNUM (c) || c == '_') + { + BUF_ADD (TOUPPER (c)); + c = getc (current.file); + } + BUF_FINISH (); + + if (c != EOF && ! ISSPACE (c) && c != ',') + { + nlmheader_identify (); + fprintf (stderr, _("%s:%d: illegal character in keyword: %c\n"), + current.name, current.lineno, c); + } + else + { + unsigned int i; + + for (i = 0; i < KEYWORD_COUNT; i++) + { + if (lex_buf[0] == keyword_tokens[i].keyword[0] + && strcmp (lex_buf, keyword_tokens[i].keyword) == 0) + { + /* Pushing back the final whitespace avoids worrying + about \n here. */ + ungetc (c, current.file); + current.state = IN_LINE; + return keyword_tokens[i].token; + } + } + + nlmheader_identify (); + fprintf (stderr, _("%s:%d: unrecognized keyword: %s\n"), + current.name, current.lineno, lex_buf); + } + + ++parse_errors; + /* Treat the rest of this line as a comment. */ + ungetc (COMMENT_CHAR, current.file); + goto tail_recurse; + } + + /* Parentheses just represent themselves. */ + if (c == '(' || c == ')') + return c; + + /* Handle quoted strings. */ + if (c == '"' || c == '\'') + { + int quote; + int start_lineno; + + quote = c; + start_lineno = current.lineno; + + c = getc (current.file); + BUF_INIT (); + while (c != quote && c != EOF) + { + BUF_ADD (c); + if (c == '\n') + ++current.lineno; + c = getc (current.file); + } + BUF_FINISH (); + + if (c == EOF) + { + nlmheader_identify (); + fprintf (stderr, _("%s:%d: end of file in quoted string\n"), + current.name, start_lineno); + ++parse_errors; + } + + /* FIXME: Possible memory leak. */ + yylval.string = xstrdup (lex_buf); + return QUOTED_STRING; + } + + /* Gather a generic argument. */ + BUF_INIT (); + while (! ISSPACE (c) + && c != ',' + && c != COMMENT_CHAR + && c != '(' + && c != ')') + { + BUF_ADD (c); + c = getc (current.file); + } + BUF_FINISH (); + + ungetc (c, current.file); + + /* FIXME: Possible memory leak. */ + yylval.string = xstrdup (lex_buf); + return STRING; +} + +/* Get a number from a string. */ + +static long +nlmlex_get_number (const char *s) +{ + long ret; + char *send; + + ret = strtol (s, &send, 10); + if (*send != '\0') + nlmheader_warn (_("bad number"), -1); + return ret; +} + +/* Prefix the nlmconv warnings with a note as to where they come from. + We don't use program_name on every warning, because then some + versions of the emacs next-error function can't recognize the line + number. */ + +static void +nlmheader_identify (void) +{ + static int done; + + if (! done) + { + fprintf (stderr, _("%s: problems in NLM command language input:\n"), + program_name); + done = 1; + } +} + +/* Issue a warning. */ + +static void +nlmheader_warn (const char *s, int imax) +{ + nlmheader_identify (); + fprintf (stderr, "%s:%d: %s", current.name, current.lineno, s); + if (imax != -1) + fprintf (stderr, " (max %d)", imax); + fprintf (stderr, "\n"); +} + +/* Report an error. */ + +static void +nlmheader_error (const char *s) +{ + nlmheader_warn (s, -1); + ++parse_errors; +} + +/* Add a string to a string list. */ + +static struct string_list * +string_list_cons (char *s, struct string_list *l) +{ + struct string_list *ret; + + ret = (struct string_list *) xmalloc (sizeof (struct string_list)); + ret->next = l; + ret->string = s; + return ret; +} + +/* Append a string list to another string list. */ + +static struct string_list * +string_list_append (struct string_list *l1, struct string_list *l2) +{ + register struct string_list **pp; + + for (pp = &l1; *pp != NULL; pp = &(*pp)->next) + ; + *pp = l2; + return l1; +} + +/* Append a string to a string list. */ + +static struct string_list * +string_list_append1 (struct string_list *l, char *s) +{ + struct string_list *n; + register struct string_list **pp; + + n = (struct string_list *) xmalloc (sizeof (struct string_list)); + n->next = NULL; + n->string = s; + for (pp = &l; *pp != NULL; pp = &(*pp)->next) + ; + *pp = n; + return l; +} + +/* Duplicate a string in memory. */ + +static char * +xstrdup (const char *s) +{ + unsigned long len; + char *ret; + + len = strlen (s); + ret = xmalloc (len + 1); + strcpy (ret, s); + return ret; +} diff --git a/binutils/nm.1 b/binutils/nm.1 deleted file mode 100644 index d6f4eba7e52b5..0000000000000 --- a/binutils/nm.1 +++ /dev/null @@ -1,587 +0,0 @@ -.\" Copyright (c) 1991, 2000 Free Software Foundation -.\" See section COPYING for conditions for redistribution -.TH nm 1 "5 November 1991" "Free Software Foundation" "GNU Development Tools" -.de BP -.sp -.ti \-.2i -\(** -.. - -.SH NAME -nm \- list symbols from object files. - -.SH SYNOPSIS -.hy 0 -.na -.B nm -.RB "[\|" \-a | \-\-debug\-syms "\|]" -.RB "[\|" \-g | \-\-extern\-only "\|]" -.RB "[\|" \-B "\|]" -.RB "[\|" \-C | \-\-demangle "\|]" -.RB "[\|" \-D | \-\-dynamic "\|]" -.RB "[\|" \-s | \-\-print\-armap "\|]" -.RB "[\|" \-o | \-\-print\-file\-name "\|]" -.RB "[\|" \-n | \-\-numeric\-sort "\|]" -.RB "[\|" \-p | \-\-no\-sort "\|]" -.RB "[\|" \-r | \-\-reverse\-sort "\|]" -.RB "[\|" \-\-size\-sort "\|]" -.RB "[\|" \-u | \-\-undefined\-only "\|]" -.RB "[\|" \-l | \-\-line\-numbers "\|]" -.RB "[\|" \-\-help "\|]" -.RB "[\|" \-\-version "\|]" -.RB "[\|" "\-t \fIradix" | \-\-radix=\fIradix "\|]" -.RB "[\|" \-P | --portability "\|]" -.RB "[\|" "\-f \fIformat" | \-\-format=\fIformat "\|]" -.RB "[\|" "\-\-target=\fIbfdname" "\|]" -.RB "[\|" \c -.I objfile\c -\&.\|.\|.\|] -.ad b -.hy 1 -.SH DESCRIPTION -GNU \c -.B nm\c -\& lists the symbols from object files \c -.I objfile\c -\&. If no object files are given as arguments, \c -.B nm\c -\& assumes `\|\c -.B a.out\c -\|'. - -.SH OPTIONS -The long and short forms of options, shown here as alternatives, are -equivalent. - -.TP -.B \-A -.TP -.B \-o -.TP -.B \-\-print\-file\-name -Precede each symbol by the name of the input file where it was found, -rather than identifying the input file once only before all of its -symbols. - -.TP -.B \-a -.TP -.B \-\-debug\-syms -Display debugger-only symbols; normally these are not listed. - -.TP -.B \-B -The same as -.B \-\-format=bsd -(for compatibility with the MIPS \fBnm\fP). - -.TP -.B \-C -.TP -.B \-\-demangle -Decode (\fIdemangle\fP) low-level symbol names into user-level names. -Besides removing any initial underscore prepended by the system, this -makes C++ function names readable. - -.TP -.B \-D -.TP -.B \-\-dynamic -Display the dynamic symbols rather than the normal symbols. This is -only meaningful for dynamic objects, such as certain types of shared -libraries. - -.TP -.B "\-f \fIformat" -Use the output format \fIformat\fP, which can be ``bsd'', -``sysv'', or ``posix''. The default is ``bsd''. -Only the first character of \fIformat\fP is significant; it can be -either upper or lower case. - -.TP -.B \-g -.TP -.B \-\-extern\-only -Display only external symbols. - -.TP -.B \-n -.TP -.B \-v -.TP -.B \-\-numeric\-sort -Sort symbols numerically by their addresses, not alphabetically by their -names. - -.TP -.B \-p -.TP -.B \-\-no\-sort -Don't bother to sort the symbols in any order; just print them in the -order encountered. - -.TP -.B \-P -.TP -.B \-\-portability -Use the POSIX.2 standard output format instead of the default format. -Equivalent to ``\-f posix''. - -.TP -.B \-s -.TP -.B \-\-print\-armap -When listing symbols from archive members, include the index: a mapping -(stored in the archive by \c -.B ar\c -\& or \c -.B ranlib\c -\&) of what modules -contain definitions for what names. - -.TP -.B \-r -.TP -.B \-\-reverse\-sort -Reverse the sense of the sort (whether numeric or alphabetic); let the -last come first. - -.TP -.B \-\-size\-sort -Sort symbols by size. The size is computed as the difference between -the value of the symbol and the value of the symbol with the next higher -value. The size of the symbol is printed, rather than the value. - -.TP -.B "\-t \fIradix" -.TP -.B "\-\-radix=\fIradix" -Use \fIradix\fP as the radix for printing the symbol values. It must be -``d'' for decimal, ``o'' for octal, or ``x'' for hexadecimal. - -.TP -.BI "\-\-target=" "bfdname" -Specify an object code format other than your system's default format. -See -.BR objdump ( 1 ), -for information on listing available formats. - -.TP -.B \-u -.TP -.B \-\-undefined\-only -Display only undefined symbols (those external to each object file). - -.TP -.B \-l -.TP -.B \-\-line\-numbers -For each symbol, use debugging information to try to find a filename and -line number. For a defined symbol, look for the line number of the -address of the symbol. For an undefined symbol, look for the line -number of a relocation entry which refers to the symbol. If line number -information can be found, print it after the other symbol information. - -.TP -.B \-V -.TP -.B \-\-version -Show the version number of -.B nm -and exit. - -.TP -.B \-\-help -Show a summary of the options to -.B nm -and exit. - -.SH "SEE ALSO" -.RB "`\|" binutils "\|'" -entry in -.B -info\c -\&; -.I -The GNU Binary Utilities\c -\&, Roland H. Pesch (October 1991); -.BR ar "(" 1 ")," -.BR objdump ( 1 ), -.BR ranlib "(" 1 ")." - - -.SH COPYING -Copyright (c) 1991, 2000 Free Software Foundation, Inc. -.PP -This document is distributed under the terms of the GNU Free -Documentation License, version 1.1. That license is described in the -sources for this manual page, but it is not displayed here in order to -make this manual more consise. Copies of this license can also be -obtained from: http://www.gnu.org/copyleft/. - -\" .SH GNU Free Documentation License -\" Version 1.1, March 2000 - -\" Copyright (C) 2000 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. -\" .PP -\" 0. PREAMBLE -\" .PP -\" The purpose of this License is to make a manual, textbook, or other -\" written document "free" in the sense of freedom: to assure everyone -\" the effective freedom to copy and redistribute it, with or without -\" modifying it, either commercially or noncommercially. Secondarily, -\" this License preserves for the author and publisher a way to get -\" credit for their work, while not being considered responsible for -\" modifications made by others. -\" .PP -\" This License is a kind of "copyleft", which means that derivative -\" works of the document must themselves be free in the same sense. It -\" complements the GNU General Public License, which is a copyleft -\" license designed for free software. -\" .PP -\" We have designed this License in order to use it for manuals for free -\" software, because free software needs free documentation: a free -\" program should come with manuals providing the same freedoms that the -\" software does. But this License is not limited to software manuals; -\" it can be used for any textual work, regardless of subject matter or -\" whether it is published as a printed book. We recommend this License -\" principally for works whose purpose is instruction or reference. -\" .PP -\" 1. APPLICABILITY AND DEFINITIONS -\" .PP -\" This License applies to any manual or other work that contains a -\" notice placed by the copyright holder saying it can be distributed -\" under the terms of this License. The "Document", below, refers to any -\" such manual or work. Any member of the public is a licensee, and is -\" addressed as "you". -\" .PP -\" A "Modified Version" of the Document means any work containing the -\" Document or a portion of it, either copied verbatim, or with -\" modifications and/or translated into another language. -\" .PP -\" A "Secondary Section" is a named appendix or a front-matter section of -\" the Document that deals exclusively with the relationship of the -\" publishers or authors of the Document to the Document's overall subject -\" (or to related matters) and contains nothing that could fall directly -\" within that overall subject. (For example, if the Document is in part a -\" textbook of mathematics, a Secondary Section may not explain any -\" mathematics.) The relationship could be a matter of historical -\" connection with the subject or with related matters, or of legal, -\" commercial, philosophical, ethical or political position regarding -\" them. -\" .PP -\" The "Invariant Sections" are certain Secondary Sections whose titles -\" are designated, as being those of Invariant Sections, in the notice -\" that says that the Document is released under this License. -\" .PP -\" The "Cover Texts" are certain short passages of text that are listed, -\" as Front-Cover Texts or Back-Cover Texts, in the notice that says that -\" the Document is released under this License. -\" .PP -\" A "Transparent" copy of the Document means a machine-readable copy, -\" represented in a format whose specification is available to the -\" general public, whose contents can be viewed and edited directly and -\" straightforwardly with generic text editors or (for images composed of -\" pixels) generic paint programs or (for drawings) some widely available -\" drawing editor, and that is suitable for input to text formatters or -\" for automatic translation to a variety of formats suitable for input -\" to text formatters. A copy made in an otherwise Transparent file -\" format whose markup has been designed to thwart or discourage -\" subsequent modification by readers is not Transparent. A copy that is -\" not "Transparent" is called "Opaque". -\" .PP -\" Examples of suitable formats for Transparent copies include plain -\" ASCII without markup, Texinfo input format, LaTeX input format, SGML -\" or XML using a publicly available DTD, and standard-conforming simple -\" HTML designed for human modification. Opaque formats include -\" PostScript, PDF, proprietary formats that can be read and edited only -\" by proprietary word processors, SGML or XML for which the DTD and/or -\" processing tools are not generally available, and the -\" machine-generated HTML produced by some word processors for output -\" purposes only. -\" .PP -\" The "Title Page" means, for a printed book, the title page itself, -\" plus such following pages as are needed to hold, legibly, the material -\" this License requires to appear in the title page. For works in -\" formats which do not have any title page as such, "Title Page" means -\" the text near the most prominent appearance of the work's title, -\" preceding the beginning of the body of the text. -\" .PP -\" 2. VERBATIM COPYING -\" .PP -\" You may copy and distribute the Document in any medium, either -\" commercially or noncommercially, provided that this License, the -\" copyright notices, and the license notice saying this License applies -\" to the Document are reproduced in all copies, and that you add no other -\" conditions whatsoever to those of this License. You may not use -\" technical measures to obstruct or control the reading or further -\" copying of the copies you make or distribute. However, you may accept -\" compensation in exchange for copies. If you distribute a large enough -\" number of copies you must also follow the conditions in section 3. -\" .PP -\" You may also lend copies, under the same conditions stated above, and -\" you may publicly display copies. -\" .PP -\" 3. COPYING IN QUANTITY -\" .PP -\" If you publish printed copies of the Document numbering more than 100, -\" and the Document's license notice requires Cover Texts, you must enclose -\" the copies in covers that carry, clearly and legibly, all these Cover -\" Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -\" the back cover. Both covers must also clearly and legibly identify -\" you as the publisher of these copies. The front cover must present -\" the full title with all words of the title equally prominent and -\" visible. You may add other material on the covers in addition. -\" Copying with changes limited to the covers, as long as they preserve -\" the title of the Document and satisfy these conditions, can be treated -\" as verbatim copying in other respects. -\" .PP -\" If the required texts for either cover are too voluminous to fit -\" legibly, you should put the first ones listed (as many as fit -\" reasonably) on the actual cover, and continue the rest onto adjacent -\" pages. -\" .PP -\" If you publish or distribute Opaque copies of the Document numbering -\" more than 100, you must either include a machine-readable Transparent -\" copy along with each Opaque copy, or state in or with each Opaque copy -\" a publicly-accessible computer-network location containing a complete -\" Transparent copy of the Document, free of added material, which the -\" general network-using public has access to download anonymously at no -\" charge using public-standard network protocols. If you use the latter -\" option, you must take reasonably prudent steps, when you begin -\" distribution of Opaque copies in quantity, to ensure that this -\" Transparent copy will remain thus accessible at the stated location -\" until at least one year after the last time you distribute an Opaque -\" copy (directly or through your agents or retailers) of that edition to -\" the public. -\" .PP -\" It is requested, but not required, that you contact the authors of the -\" Document well before redistributing any large number of copies, to give -\" them a chance to provide you with an updated version of the Document. -\" .PP -\" 4. MODIFICATIONS -\" .PP -\" You may copy and distribute a Modified Version of the Document under -\" the conditions of sections 2 and 3 above, provided that you release -\" the Modified Version under precisely this License, with the Modified -\" Version filling the role of the Document, thus licensing distribution -\" and modification of the Modified Version to whoever possesses a copy -\" of it. In addition, you must do these things in the Modified Version: -\" .PP -\" A. Use in the Title Page (and on the covers, if any) a title distinct -\" from that of the Document, and from those of previous versions -\" (which should, if there were any, be listed in the History section -\" of the Document). You may use the same title as a previous version -\" if the original publisher of that version gives permission. -\" .PP -\" B. List on the Title Page, as authors, one or more persons or entities -\" responsible for authorship of the modifications in the Modified -\" Version, together with at least five of the principal authors of the -\" Document (all of its principal authors, if it has less than five). -\" .PP -\" C. State on the Title page the name of the publisher of the -\" Modified Version, as the publisher. -\" .PP -\" D. Preserve all the copyright notices of the Document. -\" .PP -\" E. Add an appropriate copyright notice for your modifications -\" adjacent to the other copyright notices. -\" .PP -\" F. Include, immediately after the copyright notices, a license notice -\" giving the public permission to use the Modified Version under the -\" terms of this License, in the form shown in the Addendum below. -\" Preserve in that license notice the full lists of Invariant Sections -\" and required Cover Texts given in the Document's license notice. -\" .PP -\" H. Include an unaltered copy of this License. -\" .PP -\" I. Preserve the section entitled "History", and its title, and add to -\" it an item stating at least the title, year, new authors, and -\" publisher of the Modified Version as given on the Title Page. If -\" there is no section entitled "History" in the Document, create one -\" stating the title, year, authors, and publisher of the Document as -\" given on its Title Page, then add an item describing the Modified -\" Version as stated in the previous sentence. -\" .PP -\" J. Preserve the network location, if any, given in the Document for -\" public access to a Transparent copy of the Document, and likewise -\" the network locations given in the Document for previous versions -\" it was based on. These may be placed in the "History" section. -\" You may omit a network location for a work that was published at -\" least four years before the Document itself, or if the original -\" publisher of the version it refers to gives permission. -\" .PP -\" K. In any section entitled "Acknowledgements" or "Dedications", -\" preserve the section's title, and preserve in the section all the -\" substance and tone of each of the contributor acknowledgements -\" and/or dedications given therein. -\" .PP -\" L. Preserve all the Invariant Sections of the Document, -\" unaltered in their text and in their titles. Section numbers -\" or the equivalent are not considered part of the section titles. -\" .PP -\" M. Delete any section entitled "Endorsements". Such a section -\" may not be included in the Modified Version. -\" .PP -\" N. Do not retitle any existing section as "Endorsements" -\" or to conflict in title with any Invariant Section. -\" .PP -\" If the Modified Version includes new front-matter sections or -\" appendices that qualify as Secondary Sections and contain no material -\" copied from the Document, you may at your option designate some or all -\" of these sections as invariant. To do this, add their titles to the -\" list of Invariant Sections in the Modified Version's license notice. -\" These titles must be distinct from any other section titles. -\" .PP -\" You may add a section entitled "Endorsements", provided it contains -\" nothing but endorsements of your Modified Version by various -\" parties--for example, statements of peer review or that the text has -\" been approved by an organization as the authoritative definition of a -\" standard. -\" .PP -\" You may add a passage of up to five words as a Front-Cover Text, and a -\" passage of up to 25 words as a Back-Cover Text, to the end of the list -\" of Cover Texts in the Modified Version. Only one passage of -\" Front-Cover Text and one of Back-Cover Text may be added by (or -\" through arrangements made by) any one entity. If the Document already -\" includes a cover text for the same cover, previously added by you or -\" by arrangement made by the same entity you are acting on behalf of, -\" you may not add another; but you may replace the old one, on explicit -\" permission from the previous publisher that added the old one. -\" .PP -\" The author(s) and publisher(s) of the Document do not by this License -\" give permission to use their names for publicity for or to assert or -\" imply endorsement of any Modified Version. -\" .PP - -\" 5. COMBINING DOCUMENTS -\" .PP -\" You may combine the Document with other documents released under this -\" License, under the terms defined in section 4 above for modified -\" versions, provided that you include in the combination all of the -\" Invariant Sections of all of the original documents, unmodified, and -\" list them all as Invariant Sections of your combined work in its -\" license notice. -\" .PP -\" The combined work need only contain one copy of this License, and -\" multiple identical Invariant Sections may be replaced with a single -\" copy. If there are multiple Invariant Sections with the same name but -\" different contents, make the title of each such section unique by -\" adding at the end of it, in parentheses, the name of the original -\" author or publisher of that section if known, or else a unique number. -\" Make the same adjustment to the section titles in the list of -\" Invariant Sections in the license notice of the combined work. -\" .PP -\" In the combination, you must combine any sections entitled "History" -\" in the various original documents, forming one section entitled -\" "History"; likewise combine any sections entitled "Acknowledgements", -\" and any sections entitled "Dedications". You must delete all sections -\" entitled "Endorsements." -\" .PP - -\" 6. COLLECTIONS OF DOCUMENTS -\" .PP -\" You may make a collection consisting of the Document and other documents -\" released under this License, and replace the individual copies of this -\" License in the various documents with a single copy that is included in -\" the collection, provided that you follow the rules of this License for -\" verbatim copying of each of the documents in all other respects. -\" .PP -\" You may extract a single document from such a collection, and distribute -\" it individually under this License, provided you insert a copy of this -\" License into the extracted document, and follow this License in all -\" other respects regarding verbatim copying of that document. -\" .PP - -\" 7. AGGREGATION WITH INDEPENDENT WORKS -\" .PP -\" A compilation of the Document or its derivatives with other separate -\" and independent documents or works, in or on a volume of a storage or -\" distribution medium, does not as a whole count as a Modified Version -\" of the Document, provided no compilation copyright is claimed for the -\" compilation. Such a compilation is called an "aggregate", and this -\" License does not apply to the other self-contained works thus compiled -\" with the Document, on account of their being thus compiled, if they -\" are not themselves derivative works of the Document. -\" .PP -\" If the Cover Text requirement of section 3 is applicable to these -\" copies of the Document, then if the Document is less than one quarter -\" of the entire aggregate, the Document's Cover Texts may be placed on -\" covers that surround only the Document within the aggregate. -\" Otherwise they must appear on covers around the whole aggregate. -\" .PP - -\" 8. TRANSLATION -\" .PP -\" Translation is considered a kind of modification, so you may -\" distribute translations of the Document under the terms of section 4. -\" Replacing Invariant Sections with translations requires special -\" permission from their copyright holders, but you may include -\" translations of some or all Invariant Sections in addition to the -\" original versions of these Invariant Sections. You may include a -\" translation of this License provided that you also include the -\" original English version of this License. In case of a disagreement -\" between the translation and the original English version of this -\" License, the original English version will prevail. -\" .PP - -\" 9. TERMINATION -\" .PP -\" You may not copy, modify, sublicense, or distribute the Document except -\" as expressly provided for under this License. Any other attempt to -\" copy, modify, sublicense or distribute the Document 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. -\" .PP - -\" 10. FUTURE REVISIONS OF THIS LICENSE -\" .PP -\" The Free Software Foundation may publish new, revised versions -\" of the GNU Free Documentation 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. See -\" http://www.gnu.org/copyleft/. -\" .PP -\" Each version of the License is given a distinguishing version number. -\" If the Document specifies that a particular numbered version of this -\" License "or any later version" applies to it, you have the option of -\" following the terms and conditions either of that specified version or -\" of any later version that has been published (not as a draft) by the -\" Free Software Foundation. If the Document does not specify a version -\" number of this License, you may choose any version ever published (not -\" as a draft) by the Free Software Foundation. -\" .PP - -\" ADDENDUM: How to use this License for your documents -\" .PP -\" To use this License in a document you have written, include a copy of -\" the License in the document and put the following copyright and -\" license notices just after the title page: -\" .PP -\" Copyright (c) YEAR YOUR NAME. -\" Permission is granted to copy, distribute and/or -\" modify this document under the terms of the GNU -\" Free Documentation License, Version 1.1 or any later -\" version published by the Free Software Foundation; -\" with the Invariant Sections being LIST THEIR TITLES, -\" with the Front-Cover Texts being LIST, and with the -\" Back-Cover Texts being LIST. A copy of the license -\" is included in the section entitled "GNU Free -\" Documentation License". -\" .PP -\" If you have no Invariant Sections, write "with no Invariant Sections" -\" instead of saying which ones are invariant. If you have no -\" Front-Cover Texts, write "no Front-Cover Texts" instead of -\" "Front-Cover Texts being LIST"; likewise for Back-Cover Texts. -\" .PP -\" If your document contains nontrivial examples of program code, we -\" recommend releasing these examples in parallel under your choice of -\" free software license, such as the GNU General Public License, -\" to permit their use in free software. diff --git a/binutils/objcopy.1 b/binutils/objcopy.1 deleted file mode 100644 index a6aa1815fa805..0000000000000 --- a/binutils/objcopy.1 +++ /dev/null @@ -1,548 +0,0 @@ -.\" Automatically generated by Pod::Man version 1.02 -.\" Wed May 30 12:24:28 2001 -.\" -.\" Standard preamble: -.\" ====================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. -.de Sp \" Vertical space (when we can't use .PP) -.if t .sp .5v -.if n .sp -.. -.de Ip \" List item -.br -.ie \\n(.$>=3 .ne \\$3 -.el .ne 3 -.IP "\\$1" \\$2 -.. -.de Vb \" Begin verbatim text -.ft CW -.nf -.ne \\$1 -.. -.de Ve \" End verbatim text -.ft R - -.fi -.. -.\" Set up some character translations and predefined strings. \*(-- will -.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used -.\" to do unbreakable dashes and therefore won't be available. \*(C` and -.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<> -.tr \(*W-|\(bv\*(Tr -.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' -.ie n \{\ -. ds -- \(*W- -. ds PI pi -. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch -. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch -. ds L" "" -. ds R" "" -. ds C` ` -. ds C' ' -'br\} -.el\{\ -. ds -- \|\(em\| -. ds PI \(*p -. ds L" `` -. ds R" '' -'br\} -.\" -.\" If the F register is turned on, we'll generate index entries on stderr -.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and -.\" index entries marked with X<> in POD. Of course, you'll have to process -.\" the output yourself in some meaningful fashion. -.if \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" -. . -. nr % 0 -. rr F -.\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it -.\" makes way too many mistakes in technical documents. -.hy 0 -.\" -.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). -.\" Fear. Run. Save yourself. No user-serviceable parts. -.bd B 3 -. \" fudge factors for nroff and troff -.if n \{\ -. ds #H 0 -. ds #V .8m -. ds #F .3m -. ds #[ \f1 -. ds #] \fP -.\} -.if t \{\ -. ds #H ((1u-(\\\\n(.fu%2u))*.13m) -. ds #V .6m -. ds #F 0 -. ds #[ \& -. ds #] \& -.\} -. \" simple accents for nroff and troff -.if n \{\ -. ds ' \& -. ds ` \& -. ds ^ \& -. ds , \& -. ds ~ ~ -. ds / -.\} -.if t \{\ -. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" -. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' -. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' -. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' -. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' -. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' -.\} -. \" troff and (daisy-wheel) nroff accents -.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' -.ds 8 \h'\*(#H'\(*b\h'-\*(#H' -.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] -.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' -.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' -.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] -.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] -.ds ae a\h'-(\w'a'u*4/10)'e -.ds Ae A\h'-(\w'A'u*4/10)'E -. \" corrections for vroff -.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' -.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' -. \" for low resolution devices (crt and lpr) -.if \n(.H>23 .if \n(.V>19 \ -\{\ -. ds : e -. ds 8 ss -. ds o a -. ds d- d\h'-1'\(ga -. ds D- D\h'-1'\(hy -. ds th \o'bp' -. ds Th \o'LP' -. ds ae ae -. ds Ae AE -.\} -.rm #[ #] #H #V #F C -.\" ====================================================================== -.\" -.IX Title "OBJCOPY.1 1" -.TH OBJCOPY.1 1 "binutils-2.11.90" "2001-05-30" "GNU" -.UC -.SH "NAME" -objcopy \- copy and translate object files -.SH "SYNOPSIS" -.IX Header "SYNOPSIS" -objcopy [ \-F \fIbfdname\fR | \-\-target=\fIbfdname\fR ] - [ \-I \fIbfdname\fR | \-\-input-target=\fIbfdname\fR ] - [ \-O \fIbfdname\fR | \-\-output-target=\fIbfdname\fR ] - [ \-B \fIbfdarch\fR | \-\-binary-architecture=\fIbfdarch\fR ] - [ \-S | \-\-strip-all ] [ \-g | \-\-strip-debug ] - [ \-K \fIsymbolname\fR | \-\-keep-symbol=\fIsymbolname\fR ] - [ \-N \fIsymbolname\fR | \-\-strip-symbol=\fIsymbolname\fR ] - [ \-G \fIsymbolname\fR | \-\-keep-global-symbol=\fIsymbolname\fR] - [ \-L \fIsymbolname\fR | \-\-localize-symbol=\fIsymbolname\fR ] - [ \-W \fIsymbolname\fR | \-\-weaken-symbol=\fIsymbolname\fR ] - [ \-x | \-\-discard-all ] [ \-X | \-\-discard-locals ] - [ \-b \fIbyte\fR | \-\-byte=\fIbyte\fR ] - [ \-i \fIinterleave\fR | \-\-interleave=\fIinterleave\fR ] - [ \-j \fIsectionname\fR | \-\-only-section=\fIsectionname\fR ] - [ \-R \fIsectionname\fR | \-\-remove-section=\fIsectionname\fR ] - [ \-p | \-\-preserve-dates ] [ \-\-debugging ] - [ \-\-gap-fill=\fIval\fR ] [ \-\-pad-to=\fIaddress\fR ] - [ \-\-set-start=\fIval\fR ] [ \-\-adjust-start=\fIincr\fR ] - [ \-\-change-addresses=\fIincr\fR ] - [ \-\-change-section-address \fIsection\fR{=,+,\-}\fIval\fR ] - [ \-\-change-section-lma \fIsection\fR{=,+,\-}\fIval\fR ] - [ \-\-change-section-vma \fIsection\fR{=,+,\-}\fIval\fR ] - [ \-\-change-warnings ] [ \-\-no-change-warnings ] - [ \-\-set-section-flags \fIsection\fR=\fIflags\fR ] - [ \-\-add-section \fIsectionname\fR=\fIfilename\fR ] - [ \-\-change-leading-char ] [ \-\-remove-leading-char ] - [ \-\-srec-len=\fIival\fR ] [ \-\-srec-forceS3 ] - [ \-\-redefine-sym \fIold\fR=\fInew\fR ] [ \-\-weaken ] - [ \-\-keep-symbols=\fIfilename\fR ] - [ \-\-strip-symbols=\fIfilename\fR ] - [ \-\-keep-global-symbols=\fIfilename\fR ] - [ \-\-localize-symbols=\fIfilename\fR ] - [ \-\-weaken-symbols=\fIfilename\fR ] - [ \-v | \-\-verbose ] [ \-V | \-\-version ] [ \-\-help ] - \fIinfile\fR [\fIoutfile\fR] -.SH "DESCRIPTION" -.IX Header "DESCRIPTION" -The \s-1GNU\s0 \f(CW\*(C`objcopy\*(C'\fR utility copies the contents of an object -file to another. \f(CW\*(C`objcopy\*(C'\fR uses the \s-1GNU\s0 \s-1BFD\s0 Library to -read and write the object files. It can write the destination object -file in a format different from that of the source object file. The -exact behavior of \f(CW\*(C`objcopy\*(C'\fR is controlled by command-line options. -Note that \f(CW\*(C`objcopy\*(C'\fR should be able to copy a fully linked file -between any two formats. However, copying a relocatable object file -between any two formats may not work as expected. -.PP -\&\f(CW\*(C`objcopy\*(C'\fR creates temporary files to do its translations and -deletes them afterward. \f(CW\*(C`objcopy\*(C'\fR uses \s-1BFD\s0 to do all its -translation work; it has access to all the formats described in \s-1BFD\s0 -and thus is able to recognize most formats without being told -explicitly. -.PP -\&\f(CW\*(C`objcopy\*(C'\fR can be used to generate S-records by using an output -target of \fBsrec\fR (e.g., use \fB\-O srec\fR). -.PP -\&\f(CW\*(C`objcopy\*(C'\fR can be used to generate a raw binary file by using an -output target of \fBbinary\fR (e.g., use \fB\-O binary\fR). When -\&\f(CW\*(C`objcopy\*(C'\fR generates a raw binary file, it will essentially produce -a memory dump of the contents of the input object file. All symbols and -relocation information will be discarded. The memory dump will start at -the load address of the lowest section copied into the output file. -.PP -When generating an S-record or a raw binary file, it may be helpful to -use \fB\-S\fR to remove sections containing debugging information. In -some cases \fB\-R\fR will be useful to remove sections which contain -information that is not needed by the binary file. -.PP -Note \- \f(CW\*(C`objcopy\*(C'\fR is not able to change the endianness of its input -files. If the input format has an endianness, (some formats do not), -\&\f(CW\*(C`objcopy\*(C'\fR can only copy the inputs into file formats that have the -same endianness or which have no endianness (eg \fBsrec\fR). -.SH "OPTIONS" -.IX Header "OPTIONS" -.Ip "\f(CW\*(C`\f(CIinfile\f(CW\*(C'\fR" 4 -.IX Item "infile" -.Ip "\f(CW\*(C`\f(CIoutfile\f(CW\*(C'\fR" 4 -.IX Item "outfile" -The input and output files, respectively. -If you do not specify \fIoutfile\fR, \f(CW\*(C`objcopy\*(C'\fR creates a -temporary file and destructively renames the result with -the name of \fIinfile\fR. -.Ip "\f(CW\*(C`\-I \f(CIbfdname\f(CW \*(C'\fR" 4 -.IX Item "-I bfdname " -.Ip "\f(CW\*(C`\-\-input\-target=\f(CIbfdname\f(CW\*(C'\fR" 4 -.IX Item "--input-target=bfdname" -Consider the source file's object format to be \fIbfdname\fR, rather than -attempting to deduce it. -.Ip "\f(CW\*(C`\-O \f(CIbfdname\f(CW\*(C'\fR" 4 -.IX Item "-O bfdname" -.Ip "\f(CW\*(C`\-\-output\-target=\f(CIbfdname\f(CW\*(C'\fR" 4 -.IX Item "--output-target=bfdname" -Write the output file using the object format \fIbfdname\fR. -.Ip "\f(CW\*(C`\-F \f(CIbfdname\f(CW\*(C'\fR" 4 -.IX Item "-F bfdname" -.Ip "\f(CW\*(C`\-\-target=\f(CIbfdname\f(CW\*(C'\fR" 4 -.IX Item "--target=bfdname" -Use \fIbfdname\fR as the object format for both the input and the output -file; i.e., simply transfer data from source to destination with no -translation. -.Ip "\f(CW\*(C`\-B \f(CIbfdarch\f(CW\*(C'\fR" 4 -.IX Item "-B bfdarch" -.Ip "\f(CW\*(C`\-\-binary\-architecture=\f(CIbfdarch\f(CW\*(C'\fR" 4 -.IX Item "--binary-architecture=bfdarch" -Useful when transforming a raw binary input file into an object file. -In this case the output architecture can be set to \fIbfdarch\fR. This -option will be ignored if the input file has a known \fIbfdarch\fR. You -can access this binary data inside a program by referencing the special -symbols that are created by the conversion process. These symbols are -called _binary_\fIobjfile\fR_start, _binary_\fIobjfile\fR_end and -_binary_\fIobjfile\fR_size. e.g. you can transform a picture file into -an object file and then access it in your code using these symbols. -.Ip "\f(CW\*(C`\-j \f(CIsectionname\f(CW\*(C'\fR" 4 -.IX Item "-j sectionname" -.Ip "\f(CW\*(C`\-\-only\-section=\f(CIsectionname\f(CW\*(C'\fR" 4 -.IX Item "--only-section=sectionname" -Copy only the named section from the input file to the output file. -This option may be given more than once. Note that using this option -inappropriately may make the output file unusable. -.Ip "\f(CW\*(C`\-R \f(CIsectionname\f(CW\*(C'\fR" 4 -.IX Item "-R sectionname" -.Ip "\f(CW\*(C`\-\-remove\-section=\f(CIsectionname\f(CW\*(C'\fR" 4 -.IX Item "--remove-section=sectionname" -Remove any section named \fIsectionname\fR from the output file. This -option may be given more than once. Note that using this option -inappropriately may make the output file unusable. -.Ip "\f(CW\*(C`\-S\*(C'\fR" 4 -.IX Item "-S" -.Ip "\f(CW\*(C`\-\-strip\-all\*(C'\fR" 4 -.IX Item "--strip-all" -Do not copy relocation and symbol information from the source file. -.Ip "\f(CW\*(C`\-g\*(C'\fR" 4 -.IX Item "-g" -.Ip "\f(CW\*(C`\-\-strip\-debug\*(C'\fR" 4 -.IX Item "--strip-debug" -Do not copy debugging symbols from the source file. -.Ip "\f(CW\*(C`\-\-strip\-unneeded\*(C'\fR" 4 -.IX Item "--strip-unneeded" -Strip all symbols that are not needed for relocation processing. -.Ip "\f(CW\*(C`\-K \f(CIsymbolname\f(CW\*(C'\fR" 4 -.IX Item "-K symbolname" -.Ip "\f(CW\*(C`\-\-keep\-symbol=\f(CIsymbolname\f(CW\*(C'\fR" 4 -.IX Item "--keep-symbol=symbolname" -Copy only symbol \fIsymbolname\fR from the source file. This option may -be given more than once. -.Ip "\f(CW\*(C`\-N \f(CIsymbolname\f(CW\*(C'\fR" 4 -.IX Item "-N symbolname" -.Ip "\f(CW\*(C`\-\-strip\-symbol=\f(CIsymbolname\f(CW\*(C'\fR" 4 -.IX Item "--strip-symbol=symbolname" -Do not copy symbol \fIsymbolname\fR from the source file. This option -may be given more than once. -.Ip "\f(CW\*(C`\-G \f(CIsymbolname\f(CW\*(C'\fR" 4 -.IX Item "-G symbolname" -.Ip "\f(CW\*(C`\-\-keep\-global\-symbol=\f(CIsymbolname\f(CW\*(C'\fR" 4 -.IX Item "--keep-global-symbol=symbolname" -Keep only symbol \fIsymbolname\fR global. Make all other symbols local -to the file, so that they are not visible externally. This option may -be given more than once. -.Ip "\f(CW\*(C`\-L \f(CIsymbolname\f(CW\*(C'\fR" 4 -.IX Item "-L symbolname" -.Ip "\f(CW\*(C`\-\-localize\-symbol=\f(CIsymbolname\f(CW\*(C'\fR" 4 -.IX Item "--localize-symbol=symbolname" -Make symbol \fIsymbolname\fR local to the file, so that it is not -visible externally. This option may be given more than once. -.Ip "\f(CW\*(C`\-W \f(CIsymbolname\f(CW\*(C'\fR" 4 -.IX Item "-W symbolname" -.Ip "\f(CW\*(C`\-\-weaken\-symbol=\f(CIsymbolname\f(CW\*(C'\fR" 4 -.IX Item "--weaken-symbol=symbolname" -Make symbol \fIsymbolname\fR weak. This option may be given more than once. -.Ip "\f(CW\*(C`\-x\*(C'\fR" 4 -.IX Item "-x" -.Ip "\f(CW\*(C`\-\-discard\-all\*(C'\fR" 4 -.IX Item "--discard-all" -Do not copy non-global symbols from the source file. -.Ip "\f(CW\*(C`\-X\*(C'\fR" 4 -.IX Item "-X" -.Ip "\f(CW\*(C`\-\-discard\-locals\*(C'\fR" 4 -.IX Item "--discard-locals" -Do not copy compiler-generated local symbols. -(These usually start with \fBL\fR or \fB.\fR.) -.Ip "\f(CW\*(C`\-b \f(CIbyte\f(CW\*(C'\fR" 4 -.IX Item "-b byte" -.Ip "\f(CW\*(C`\-\-byte=\f(CIbyte\f(CW\*(C'\fR" 4 -.IX Item "--byte=byte" -Keep only every \fIbyte\fRth byte of the input file (header data is not -affected). \fIbyte\fR can be in the range from 0 to \fIinterleave\fR\-1, -where \fIinterleave\fR is given by the \fB\-i\fR or \fB\*(--interleave\fR -option, or the default of 4. This option is useful for creating files -to program \s-1ROM\s0. It is typically used with an \f(CW\*(C`srec\*(C'\fR output -target. -.Ip "\f(CW\*(C`\-i \f(CIinterleave\f(CW\*(C'\fR" 4 -.IX Item "-i interleave" -.Ip "\f(CW\*(C`\-\-interleave=\f(CIinterleave\f(CW\*(C'\fR" 4 -.IX Item "--interleave=interleave" -Only copy one out of every \fIinterleave\fR bytes. Select which byte to -copy with the \fI\-b\fR or \fB\*(--byte\fR option. The default is 4. -\&\f(CW\*(C`objcopy\*(C'\fR ignores this option if you do not specify either \fB\-b\fR or -\&\fB\*(--byte\fR. -.Ip "\f(CW\*(C`\-p\*(C'\fR" 4 -.IX Item "-p" -.Ip "\f(CW\*(C`\-\-preserve\-dates\*(C'\fR" 4 -.IX Item "--preserve-dates" -Set the access and modification dates of the output file to be the same -as those of the input file. -.Ip "\f(CW\*(C`\-\-debugging\*(C'\fR" 4 -.IX Item "--debugging" -Convert debugging information, if possible. This is not the default -because only certain debugging formats are supported, and the -conversion process can be time consuming. -.Ip "\f(CW\*(C`\-\-gap\-fill \f(CIval\f(CW\*(C'\fR" 4 -.IX Item "--gap-fill val" -Fill gaps between sections with \fIval\fR. This operation applies to -the \fIload address\fR (\s-1LMA\s0) of the sections. It is done by increasing -the size of the section with the lower address, and filling in the extra -space created with \fIval\fR. -.Ip "\f(CW\*(C`\-\-pad\-to \f(CIaddress\f(CW\*(C'\fR" 4 -.IX Item "--pad-to address" -Pad the output file up to the load address \fIaddress\fR. This is -done by increasing the size of the last section. The extra space is -filled in with the value specified by \fB\*(--gap-fill\fR (default zero). -.Ip "\f(CW\*(C`\-\-set\-start \f(CIval\f(CW\*(C'\fR" 4 -.IX Item "--set-start val" -Set the start address of the new file to \fIval\fR. Not all object file -formats support setting the start address. -.Ip "\f(CW\*(C`\-\-change\-start \f(CIincr\f(CW\*(C'\fR" 4 -.IX Item "--change-start incr" -.Ip "\f(CW\*(C`\-\-adjust\-start \f(CIincr\f(CW\*(C'\fR" 4 -.IX Item "--adjust-start incr" -Change the start address by adding \fIincr\fR. Not all object file -formats support setting the start address. -.Ip "\f(CW\*(C`\-\-change\-addresses \f(CIincr\f(CW\*(C'\fR" 4 -.IX Item "--change-addresses incr" -.Ip "\f(CW\*(C`\-\-adjust\-vma \f(CIincr\f(CW\*(C'\fR" 4 -.IX Item "--adjust-vma incr" -Change the \s-1VMA\s0 and \s-1LMA\s0 addresses of all sections, as well as the start -address, by adding \fIincr\fR. Some object file formats do not permit -section addresses to be changed arbitrarily. Note that this does not -relocate the sections; if the program expects sections to be loaded at a -certain address, and this option is used to change the sections such -that they are loaded at a different address, the program may fail. -.Ip "\f(CW\*(C`\-\-change\-section\-address \f(CIsection\f(CW{=,+,\-}\f(CIval\f(CW\*(C'\fR" 4 -.IX Item "--change-section-address section{=,+,-}val" -.Ip "\f(CW\*(C`\-\-adjust\-section\-vma \f(CIsection\f(CW{=,+,\-}\f(CIval\f(CW\*(C'\fR" 4 -.IX Item "--adjust-section-vma section{=,+,-}val" -Set or change both the \s-1VMA\s0 address and the \s-1LMA\s0 address of the named -\&\fIsection\fR. If \fB=\fR is used, the section address is set to -\&\fIval\fR. Otherwise, \fIval\fR is added to or subtracted from the -section address. See the comments under \fB\*(--change-addresses\fR, -above. If \fIsection\fR does not exist in the input file, a warning will -be issued, unless \fB\*(--no-change-warnings\fR is used. -.Ip "\f(CW\*(C`\-\-change\-section\-lma \f(CIsection\f(CW{=,+,\-}\f(CIval\f(CW\*(C'\fR" 4 -.IX Item "--change-section-lma section{=,+,-}val" -Set or change the \s-1LMA\s0 address of the named \fIsection\fR. The \s-1LMA\s0 -address is the address where the section will be loaded into memory at -program load time. Normally this is the same as the \s-1VMA\s0 address, which -is the address of the section at program run time, but on some systems, -especially those where a program is held in \s-1ROM\s0, the two can be -different. If \fB=\fR is used, the section address is set to -\&\fIval\fR. Otherwise, \fIval\fR is added to or subtracted from the -section address. See the comments under \fB\*(--change-addresses\fR, -above. If \fIsection\fR does not exist in the input file, a warning -will be issued, unless \fB\*(--no-change-warnings\fR is used. -.Ip "\f(CW\*(C`\-\-change\-section\-vma \f(CIsection\f(CW{=,+,\-}\f(CIval\f(CW\*(C'\fR" 4 -.IX Item "--change-section-vma section{=,+,-}val" -Set or change the \s-1VMA\s0 address of the named \fIsection\fR. The \s-1VMA\s0 -address is the address where the section will be located once the -program has started executing. Normally this is the same as the \s-1LMA\s0 -address, which is the address where the section will be loaded into -memory, but on some systems, especially those where a program is held in -\&\s-1ROM\s0, the two can be different. If \fB=\fR is used, the section address -is set to \fIval\fR. Otherwise, \fIval\fR is added to or subtracted -from the section address. See the comments under -\&\fB\*(--change-addresses\fR, above. If \fIsection\fR does not exist in -the input file, a warning will be issued, unless -\&\fB\*(--no-change-warnings\fR is used. -.Ip "\f(CW\*(C`\-\-change\-warnings\*(C'\fR" 4 -.IX Item "--change-warnings" -.Ip "\f(CW\*(C`\-\-adjust\-warnings\*(C'\fR" 4 -.IX Item "--adjust-warnings" -If \fB\*(--change-section-address\fR or \fB\*(--change-section-lma\fR or -\&\fB\*(--change-section-vma\fR is used, and the named section does not -exist, issue a warning. This is the default. -.Ip "\f(CW\*(C`\-\-no\-change\-warnings\*(C'\fR" 4 -.IX Item "--no-change-warnings" -.Ip "\f(CW\*(C`\-\-no\-adjust\-warnings\*(C'\fR" 4 -.IX Item "--no-adjust-warnings" -Do not issue a warning if \fB\*(--change-section-address\fR or -\&\fB\*(--adjust-section-lma\fR or \fB\*(--adjust-section-vma\fR is used, even -if the named section does not exist. -.Ip "\f(CW\*(C`\-\-set\-section\-flags \f(CIsection\f(CW=\f(CIflags\f(CW\*(C'\fR" 4 -.IX Item "--set-section-flags section=flags" -Set the flags for the named section. The \fIflags\fR argument is a -comma separated string of flag names. The recognized names are -\&\fBalloc\fR, \fBcontents\fR, \fBload\fR, \fBnoload\fR, -\&\fBreadonly\fR, \fBcode\fR, \fBdata\fR, \fBrom\fR, \fBshare\fR, and -\&\fBdebug\fR. You can set the \fBcontents\fR flag for a section which -does not have contents, but it is not meaningful to clear the -\&\fBcontents\fR flag of a section which does have contents\*(--just remove -the section instead. Not all flags are meaningful for all object file -formats. -.Ip "\f(CW\*(C`\-\-add\-section \f(CIsectionname\f(CW=\f(CIfilename\f(CW\*(C'\fR" 4 -.IX Item "--add-section sectionname=filename" -Add a new section named \fIsectionname\fR while copying the file. The -contents of the new section are taken from the file \fIfilename\fR. The -size of the section will be the size of the file. This option only -works on file formats which can support sections with arbitrary names. -.Ip "\f(CW\*(C`\-\-change\-leading\-char\*(C'\fR" 4 -.IX Item "--change-leading-char" -Some object file formats use special characters at the start of -symbols. The most common such character is underscore, which compilers -often add before every symbol. This option tells \f(CW\*(C`objcopy\*(C'\fR to -change the leading character of every symbol when it converts between -object file formats. If the object file formats use the same leading -character, this option has no effect. Otherwise, it will add a -character, or remove a character, or change a character, as -appropriate. -.Ip "\f(CW\*(C`\-\-remove\-leading\-char\*(C'\fR" 4 -.IX Item "--remove-leading-char" -If the first character of a global symbol is a special symbol leading -character used by the object file format, remove the character. The -most common symbol leading character is underscore. This option will -remove a leading underscore from all global symbols. This can be useful -if you want to link together objects of different file formats with -different conventions for symbol names. This is different from -\&\f(CW\*(C`\-\-change\-leading\-char\*(C'\fR because it always changes the symbol name -when appropriate, regardless of the object file format of the output -file. -.Ip "\f(CW\*(C`\-\-srec\-len=\f(CIival\f(CW\*(C'\fR" 4 -.IX Item "--srec-len=ival" -Meaningful only for srec output. Set the maximum length of the Srecords -being produced to \fIival\fR. This length covers both address, data and -crc fields. -.Ip "\f(CW\*(C`\-\-srec\-forceS3\*(C'\fR" 4 -.IX Item "--srec-forceS3" -Meaningful only for srec output. Avoid generation of S1/S2 records, -creating S3\-only record format. -.Ip "\f(CW\*(C`\-\-redefine\-sym \f(CIold\f(CW=\f(CInew\f(CW\*(C'\fR" 4 -.IX Item "--redefine-sym old=new" -Change the name of a symbol \fIold\fR, to \fInew\fR. This can be useful -when one is trying link two things together for which you have no -source, and there are name collisions. -.Ip "\f(CW\*(C`\-\-weaken\*(C'\fR" 4 -.IX Item "--weaken" -Change all global symbols in the file to be weak. This can be useful -when building an object which will be linked against other objects using -the \f(CW\*(C`\-R\*(C'\fR option to the linker. This option is only effective when -using an object file format which supports weak symbols. -.Ip "\f(CW\*(C`\-\-keep\-symbols=\f(CIfilename\f(CW\*(C'\fR" 4 -.IX Item "--keep-symbols=filename" -Apply \fB\*(--keep-symbol\fR option to each symbol listed in the file -\&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol -name per line. Line comments may be introduced by the hash character. -This option may be given more than once. -.Ip "\f(CW\*(C`\-\-strip\-symbols=\f(CIfilename\f(CW\*(C'\fR" 4 -.IX Item "--strip-symbols=filename" -Apply \fB\*(--strip-symbol\fR option to each symbol listed in the file -\&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol -name per line. Line comments may be introduced by the hash character. -This option may be given more than once. -.Ip "\f(CW\*(C`\-\-keep\-global\-symbols=\f(CIfilename\f(CW\*(C'\fR" 4 -.IX Item "--keep-global-symbols=filename" -Apply \fB\*(--keep-global-symbol\fR option to each symbol listed in the -file \fIfilename\fR. \fIfilename\fR is simply a flat file, with one -symbol name per line. Line comments may be introduced by the hash -character. This option may be given more than once. -.Ip "\f(CW\*(C`\-\-localize\-symbols=\f(CIfilename\f(CW\*(C'\fR" 4 -.IX Item "--localize-symbols=filename" -Apply \fB\*(--localize-symbol\fR option to each symbol listed in the file -\&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol -name per line. Line comments may be introduced by the hash character. -This option may be given more than once. -.Ip "\f(CW\*(C`\-\-weaken\-symbols=\f(CIfilename\f(CW\*(C'\fR" 4 -.IX Item "--weaken-symbols=filename" -Apply \fB\*(--weaken-symbol\fR option to each symbol listed in the file -\&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol -name per line. Line comments may be introduced by the hash character. -This option may be given more than once. -.Ip "\f(CW\*(C`\-V\*(C'\fR" 4 -.IX Item "-V" -.Ip "\f(CW\*(C`\-\-version\*(C'\fR" 4 -.IX Item "--version" -Show the version number of \f(CW\*(C`objcopy\*(C'\fR. -.Ip "\f(CW\*(C`\-v\*(C'\fR" 4 -.IX Item "-v" -.Ip "\f(CW\*(C`\-\-verbose\*(C'\fR" 4 -.IX Item "--verbose" -Verbose output: list all object files modified. In the case of -archives, \fBobjcopy \-V\fR lists all members of the archive. -.Ip "\f(CW\*(C`\-\-help\*(C'\fR" 4 -.IX Item "--help" -Show a summary of the options to \f(CW\*(C`objcopy\*(C'\fR. -.SH "SEE ALSO" -.IX Header "SEE ALSO" -\&\fIld\fR\|(1), \fIobjdump\fR\|(1), and the Info entries for \fIbinutils\fR. -.SH "COPYRIGHT" -.IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc. -.PP -Permission is granted to copy, distribute and/or modify this document -under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 -or any later version published by the Free Software Foundation; -with no Invariant Sections, with no Front-Cover Texts, and with no -Back-Cover Texts. A copy of the license is included in the -section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/binutils/objdump.1 b/binutils/objdump.1 deleted file mode 100644 index 591a0f44bbde1..0000000000000 --- a/binutils/objdump.1 +++ /dev/null @@ -1,770 +0,0 @@ -.\" Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 1998, 2000 Free Software Foundation -.\" See section COPYING for conditions for redistribution -.TH objdump 1 "5 November 1991" "Free Software Foundation" "GNU Development Tools" -.de BP -.sp -.ti \-.2i -\(** -.. - -.SH NAME -objdump \- display information from object files. - -.SH SYNOPSIS -.hy 0 -.na -.B objdump -.RB "[\|" \-a | \-\-archive\-headers "\|]" -.RB "[\|" "\-b\ "\c -.I bfdname\c -.RB " | " "\-\-target="\c -.I bfdname\c -\&\|] -.RB "[\|" \-C | \-\-demangle "\|]" -.RB "[\|" \-\-debugging "\|]" -.RB "[\|" \-d | \-\-disassemble "\|]" -.RB "[\|" \-D | \-\-disassemble-all "\|]" -.RB "[\|" \-\-disassemble\-zeroes "\|]" -.RB "[\|" \-EB | \-EL | \-\-endian=\c -.I {big|little}\c -\&\|] -.RB "[\|" \-f | \-\-file\-headers "\|]" -.RB "[\|" \-h | \-\-section\-headers -.RB "| " \-\-headers "\|]" -.RB "[\|" \-i | \-\-info "\|]" -.RB "[\|" "\-j\ "\c -.I section\c -.RB " | " "\-\-section="\c -.I section\c -\&\|] -.RB "[\|" \-l | \-\-line\-numbers "\|]" -.RB "[\|" "\-m\ "\c -.I machine\c -.RB " | " "\-\-architecture="\c -.I machine\c -\&\|] -.RB "[\|" \-p | \-\-private\-headers "\|]" -.RB "[\|" \-\-prefix\-addresses "\|]" -.RB "[\|" \-r | \-\-reloc "\|]" -.RB "[\|" \-R | \-\-dynamic\-reloc "\|]" -.RB "[\|" \-s | \-\-full\-contents "\|]" -.RB "[\|" \-S | \-\-source "\|]" -.RB "[\|" \-\-[no\-]show\-raw\-insn "\|]" -.RB "[\|" \-\-stabs "\|]" -.RB "[\|" \-t | \-\-syms "\|]" -.RB "[\|" \-T | \-\-dynamic\-syms "\|]" -.RB "[\|" \-x | \-\-all\-headers "\|]" -.RB "[\|" "\-\-start\-address="\c -.I address\c -\&\|] -.RB "[\|" "\-\-stop\-address="\c -.I address\c -\&\|] -.RB "[\|" "\-\-adjust\-vma="\c -.I offset\c -\&\|] -.RB "[\|" \-\-version "\|]" -.RB "[\|" \-\-help "\|]" -.I objfile\c -\&.\|.\|. -.ad b -.hy 1 -.SH DESCRIPTION -\c -.B objdump\c -\& displays information about one or more object files. -The options control what particular information to display. This -information is mostly useful to programmers who are working on the -compilation tools, as opposed to programmers who just want their -program to compile and work. -.PP -.IR "objfile" .\|.\|. -are the object files to be examined. When you specify archives, -\c -.B objdump\c -\& shows information on each of the member object files. - -.SH OPTIONS -Where long and short forms of an option are shown together, they are -equivalent. At least one option besides -.B \-l -(\fB\-\-line\-numbers\fP) must be given. - -.TP -.B \-a -.TP -.B \-\-archive\-headers -If any files from \c -.I objfile\c -\& are archives, display the archive -header information (in a format similar to `\|\c -.B ls \-l\c -\|'). Besides the -information you could list with `\|\c -.B ar tv\c -\|', `\|\c -.B objdump \-a\c -\|' shows -the object file format of each archive member. - -.TP -.BI "\-\-adjust\-vma=" "offset" -When dumping information, first add -.I offset -to all the section addresses. This is useful if the section addresses -do not correspond to the symbol table, which can happen when putting -sections at particular addresses when using a format which can not -represent section addresses, such as a.out. - -.TP -.BI "\-b " "bfdname"\c -.TP -.BI "\-\-target=" "bfdname" -Specify the object-code format for the object files to be -\c -.I bfdname\c -\&. This may not be necessary; \c -.I objdump\c -\& can -automatically recognize many formats. For example, -.sp -.br -objdump\ \-b\ oasys\ \-m\ vax\ \-h\ fu.o -.br -.sp -display summary information from the section headers (`\|\c -.B \-h\c -\|') of -`\|\c -.B fu.o\c -\|', which is explicitly identified (`\|\c -.B \-m\c -\|') as a Vax object -file in the format produced by Oasys compilers. You can list the -formats available with the `\|\c -.B \-i\c -\|' option. - -.TP -.B \-C -.TP -.B \-\-demangle -Decode (\fIdemangle\fP) low-level symbol names into user-level names. -Besides removing any initial underscore prepended by the system, this -makes C++ function names readable. - -.TP -.B \-\-debugging -Display debugging information. This attempts to parse debugging -information stored in the file and print it out using a C like syntax. -Only certain types of debugging information have been implemented. - -.TP -.B \-d -.TP -.B \-\-disassemble -Display the assembler mnemonics for the machine -instructions from \c -.I objfile\c -\&. -This option only disassembles those sections which are -expected to contain instructions. - -.TP -.B \-D -.TP -.B \-\-disassemble-all -Like \fB\-d\fP, but disassemble the contents of all sections, not just -those expected to contain instructions. - -.TP -.B \-\-prefix\-addresses -When disassembling, print the complete address on each line. This is -the older disassembly format. - -.TP -.B \-\-disassemble\-zeroes -Normally the disassembly output will skip blocks of zeroes. This -option directs the disassembler to disassemble those blocks, just like -any other data. - -.TP -.B \-EB -.TP -.B \-EL -.TP -.BI "\-\-endian=" "{big|little}" -Specify the endianness of the object files. This only affects -disassembly. This can be useful when disassembling a file format which -does not describe endianness information, such as S-records. - -.TP -.B \-f -.TP -.B \-\-file\-headers -Display summary information from the overall header of -each file in \c -.I objfile\c -\&. - -.TP -.B \-h -.TP -.B \-\-section\-headers -.TP -.B \-\-headers -Display summary information from the section headers of the -object file. - -.TP -.B \-\-help -Print a summary of the options to -.B objdump -and exit. - -.TP -.B \-i -.TP -.B \-\-info -Display a list showing all architectures and object formats available -for specification with \c -.B \-b\c -\& or \c -.B \-m\c -\&. - -.TP -.BI "\-j " "name"\c -.TP -.BI "\-\-section=" "name" -Display information only for section \c -.I name\c -\&. - -.TP -.B \-l -.TP -.B \-\-line\-numbers -Label the display (using debugging information) with the filename -and source line numbers corresponding to the object code shown. -Only useful with \fB\-d\fP, \fB\-D\fP, or \fB\-r\fP. - -.TP -.BI "\-m " "machine"\c -.TP -.BI "\-\-architecture=" "machine" -Specify the architecture to use when disassembling object files. This -can be useful when disassembling object files which do not describe -architecture information, such as S-records. You can list the available -architectures with the \fB\-i\fP option. - -.TP -.B \-p -.TP -.B \-\-private\-headers -Print information that is specific to the object file format. The -exact information printed depends upon the object file format. For -some object file formats, no additional information is printed. - -.TP -.B \-r -.TP -.B \-\-reloc -Print the relocation entries of the file. If used with \fB\-d\fP or -\fB\-D\fP, the relocations are printed interspersed with the -disassembly. - -.TP -.B \-R -.TP -.B \-\-dynamic\-reloc -Print the dynamic relocation entries of the file. This is only -meaningful for dynamic objects, such as certain types of shared -libraries. - -.TP -.B \-s -.TP -.B \-\-full\-contents -Display the full contents of any sections requested. - -.TP -.B \-S -.TP -.B \-\-source -Display source code intermixed with disassembly, if possible. Implies -\fB-d\fP. - -.TP -.B \-\-show\-raw\-insn -When disassembling instructions, print the instruction in hex as well as -in symbolic form. This is the default except when -.B \-\-prefix\-addresses -is used. - -.TP -.B \-\-no\-show\-raw\-insn -When disassembling instructions, do not print the instruction bytes. -This is the default when -.B \-\-prefix\-addresses -is used. - -.TP -.B \-\-stabs -Display the contents of the .stab, .stab.index, and .stab.excl -sections from an ELF file. This is only useful on systems (such as -Solaris 2.0) in which .stab debugging symbol-table entries are carried -in an ELF section. In most other file formats, debugging symbol-table -entries are interleaved with linkage symbols, and are visible in the -.B \-\-syms -output. - -.TP -.BI "\-\-start\-address=" "address" -Start displaying data at the specified address. This affects the output -of the -.B \-d\c -, -.B \-r -and -.B \-s -options. - -.TP -.BI "\-\-stop\-address=" "address" -Stop displaying data at the specified address. This affects the output -of the -.B \-d\c -, -.B \-r -and -.B \-s -options. - -.TP -.B \-t -.TP -.B \-\-syms -Symbol Table. Print the symbol table entries of the file. -This is similar to the information provided by the `\|\c -.B nm\c -\|' program. - -.TP -.B \-T -.TP -.B \-\-dynamic\-syms -Dynamic Symbol Table. Print the dynamic symbol table entries of the -file. This is only meaningful for dynamic objects, such as certain -types of shared libraries. This is similar to the information -provided by the `\|\c -.B nm\c -\|' program when given the -.B \-D (\-\-dynamic) -option. - -.TP -.B \-\-version -Print the version number of -.B objdump -and exit. - -.TP -.B \-x -.TP -.B \-\-all\-headers -Display all available header information, including the symbol table and -relocation entries. Using `\|\c -.B \-x\c -\|' is equivalent to specifying all of -`\|\c -.B \-a \-f \-h \-r \-t\c -\|'. - -.SH "SEE ALSO" -.RB "`\|" binutils "\|'" -entry in -.B -info\c -\&; -.I -The GNU Binary Utilities\c -\&, Roland H. Pesch (October 1991); -.BR nm "(" 1 ")." - -.SH COPYING -Copyright (c) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. -.PP -.PP -This document is distributed under the terms of the GNU Free -Documentation License, version 1.1. That license is described in the -sources for this manual page, but it is not displayed here in order to -make this manual more consise. Copies of this license can also be -obtained from: http://www.gnu.org/copyleft/. - -\" .SH GNU Free Documentation License -\" Version 1.1, March 2000 - -\" Copyright (C) 2000 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. -\" .PP -\" 0. PREAMBLE -\" .PP -\" The purpose of this License is to make a manual, textbook, or other -\" written document "free" in the sense of freedom: to assure everyone -\" the effective freedom to copy and redistribute it, with or without -\" modifying it, either commercially or noncommercially. Secondarily, -\" this License preserves for the author and publisher a way to get -\" credit for their work, while not being considered responsible for -\" modifications made by others. -\" .PP -\" This License is a kind of "copyleft", which means that derivative -\" works of the document must themselves be free in the same sense. It -\" complements the GNU General Public License, which is a copyleft -\" license designed for free software. -\" .PP -\" We have designed this License in order to use it for manuals for free -\" software, because free software needs free documentation: a free -\" program should come with manuals providing the same freedoms that the -\" software does. But this License is not limited to software manuals; -\" it can be used for any textual work, regardless of subject matter or -\" whether it is published as a printed book. We recommend this License -\" principally for works whose purpose is instruction or reference. -\" .PP -\" 1. APPLICABILITY AND DEFINITIONS -\" .PP -\" This License applies to any manual or other work that contains a -\" notice placed by the copyright holder saying it can be distributed -\" under the terms of this License. The "Document", below, refers to any -\" such manual or work. Any member of the public is a licensee, and is -\" addressed as "you". -\" .PP -\" A "Modified Version" of the Document means any work containing the -\" Document or a portion of it, either copied verbatim, or with -\" modifications and/or translated into another language. -\" .PP -\" A "Secondary Section" is a named appendix or a front-matter section of -\" the Document that deals exclusively with the relationship of the -\" publishers or authors of the Document to the Document's overall subject -\" (or to related matters) and contains nothing that could fall directly -\" within that overall subject. (For example, if the Document is in part a -\" textbook of mathematics, a Secondary Section may not explain any -\" mathematics.) The relationship could be a matter of historical -\" connection with the subject or with related matters, or of legal, -\" commercial, philosophical, ethical or political position regarding -\" them. -\" .PP -\" The "Invariant Sections" are certain Secondary Sections whose titles -\" are designated, as being those of Invariant Sections, in the notice -\" that says that the Document is released under this License. -\" .PP -\" The "Cover Texts" are certain short passages of text that are listed, -\" as Front-Cover Texts or Back-Cover Texts, in the notice that says that -\" the Document is released under this License. -\" .PP -\" A "Transparent" copy of the Document means a machine-readable copy, -\" represented in a format whose specification is available to the -\" general public, whose contents can be viewed and edited directly and -\" straightforwardly with generic text editors or (for images composed of -\" pixels) generic paint programs or (for drawings) some widely available -\" drawing editor, and that is suitable for input to text formatters or -\" for automatic translation to a variety of formats suitable for input -\" to text formatters. A copy made in an otherwise Transparent file -\" format whose markup has been designed to thwart or discourage -\" subsequent modification by readers is not Transparent. A copy that is -\" not "Transparent" is called "Opaque". -\" .PP -\" Examples of suitable formats for Transparent copies include plain -\" ASCII without markup, Texinfo input format, LaTeX input format, SGML -\" or XML using a publicly available DTD, and standard-conforming simple -\" HTML designed for human modification. Opaque formats include -\" PostScript, PDF, proprietary formats that can be read and edited only -\" by proprietary word processors, SGML or XML for which the DTD and/or -\" processing tools are not generally available, and the -\" machine-generated HTML produced by some word processors for output -\" purposes only. -\" .PP -\" The "Title Page" means, for a printed book, the title page itself, -\" plus such following pages as are needed to hold, legibly, the material -\" this License requires to appear in the title page. For works in -\" formats which do not have any title page as such, "Title Page" means -\" the text near the most prominent appearance of the work's title, -\" preceding the beginning of the body of the text. -\" .PP -\" 2. VERBATIM COPYING -\" .PP -\" You may copy and distribute the Document in any medium, either -\" commercially or noncommercially, provided that this License, the -\" copyright notices, and the license notice saying this License applies -\" to the Document are reproduced in all copies, and that you add no other -\" conditions whatsoever to those of this License. You may not use -\" technical measures to obstruct or control the reading or further -\" copying of the copies you make or distribute. However, you may accept -\" compensation in exchange for copies. If you distribute a large enough -\" number of copies you must also follow the conditions in section 3. -\" .PP -\" You may also lend copies, under the same conditions stated above, and -\" you may publicly display copies. -\" .PP -\" 3. COPYING IN QUANTITY -\" .PP -\" If you publish printed copies of the Document numbering more than 100, -\" and the Document's license notice requires Cover Texts, you must enclose -\" the copies in covers that carry, clearly and legibly, all these Cover -\" Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -\" the back cover. Both covers must also clearly and legibly identify -\" you as the publisher of these copies. The front cover must present -\" the full title with all words of the title equally prominent and -\" visible. You may add other material on the covers in addition. -\" Copying with changes limited to the covers, as long as they preserve -\" the title of the Document and satisfy these conditions, can be treated -\" as verbatim copying in other respects. -\" .PP -\" If the required texts for either cover are too voluminous to fit -\" legibly, you should put the first ones listed (as many as fit -\" reasonably) on the actual cover, and continue the rest onto adjacent -\" pages. -\" .PP -\" If you publish or distribute Opaque copies of the Document numbering -\" more than 100, you must either include a machine-readable Transparent -\" copy along with each Opaque copy, or state in or with each Opaque copy -\" a publicly-accessible computer-network location containing a complete -\" Transparent copy of the Document, free of added material, which the -\" general network-using public has access to download anonymously at no -\" charge using public-standard network protocols. If you use the latter -\" option, you must take reasonably prudent steps, when you begin -\" distribution of Opaque copies in quantity, to ensure that this -\" Transparent copy will remain thus accessible at the stated location -\" until at least one year after the last time you distribute an Opaque -\" copy (directly or through your agents or retailers) of that edition to -\" the public. -\" .PP -\" It is requested, but not required, that you contact the authors of the -\" Document well before redistributing any large number of copies, to give -\" them a chance to provide you with an updated version of the Document. -\" .PP -\" 4. MODIFICATIONS -\" .PP -\" You may copy and distribute a Modified Version of the Document under -\" the conditions of sections 2 and 3 above, provided that you release -\" the Modified Version under precisely this License, with the Modified -\" Version filling the role of the Document, thus licensing distribution -\" and modification of the Modified Version to whoever possesses a copy -\" of it. In addition, you must do these things in the Modified Version: -\" .PP -\" A. Use in the Title Page (and on the covers, if any) a title distinct -\" from that of the Document, and from those of previous versions -\" (which should, if there were any, be listed in the History section -\" of the Document). You may use the same title as a previous version -\" if the original publisher of that version gives permission. -\" .PP -\" B. List on the Title Page, as authors, one or more persons or entities -\" responsible for authorship of the modifications in the Modified -\" Version, together with at least five of the principal authors of the -\" Document (all of its principal authors, if it has less than five). -\" .PP -\" C. State on the Title page the name of the publisher of the -\" Modified Version, as the publisher. -\" .PP -\" D. Preserve all the copyright notices of the Document. -\" .PP -\" E. Add an appropriate copyright notice for your modifications -\" adjacent to the other copyright notices. -\" .PP -\" F. Include, immediately after the copyright notices, a license notice -\" giving the public permission to use the Modified Version under the -\" terms of this License, in the form shown in the Addendum below. -\" Preserve in that license notice the full lists of Invariant Sections -\" and required Cover Texts given in the Document's license notice. -\" .PP -\" H. Include an unaltered copy of this License. -\" .PP -\" I. Preserve the section entitled "History", and its title, and add to -\" it an item stating at least the title, year, new authors, and -\" publisher of the Modified Version as given on the Title Page. If -\" there is no section entitled "History" in the Document, create one -\" stating the title, year, authors, and publisher of the Document as -\" given on its Title Page, then add an item describing the Modified -\" Version as stated in the previous sentence. -\" .PP -\" J. Preserve the network location, if any, given in the Document for -\" public access to a Transparent copy of the Document, and likewise -\" the network locations given in the Document for previous versions -\" it was based on. These may be placed in the "History" section. -\" You may omit a network location for a work that was published at -\" least four years before the Document itself, or if the original -\" publisher of the version it refers to gives permission. -\" .PP -\" K. In any section entitled "Acknowledgements" or "Dedications", -\" preserve the section's title, and preserve in the section all the -\" substance and tone of each of the contributor acknowledgements -\" and/or dedications given therein. -\" .PP -\" L. Preserve all the Invariant Sections of the Document, -\" unaltered in their text and in their titles. Section numbers -\" or the equivalent are not considered part of the section titles. -\" .PP -\" M. Delete any section entitled "Endorsements". Such a section -\" may not be included in the Modified Version. -\" .PP -\" N. Do not retitle any existing section as "Endorsements" -\" or to conflict in title with any Invariant Section. -\" .PP -\" If the Modified Version includes new front-matter sections or -\" appendices that qualify as Secondary Sections and contain no material -\" copied from the Document, you may at your option designate some or all -\" of these sections as invariant. To do this, add their titles to the -\" list of Invariant Sections in the Modified Version's license notice. -\" These titles must be distinct from any other section titles. -\" .PP -\" You may add a section entitled "Endorsements", provided it contains -\" nothing but endorsements of your Modified Version by various -\" parties--for example, statements of peer review or that the text has -\" been approved by an organization as the authoritative definition of a -\" standard. -\" .PP -\" You may add a passage of up to five words as a Front-Cover Text, and a -\" passage of up to 25 words as a Back-Cover Text, to the end of the list -\" of Cover Texts in the Modified Version. Only one passage of -\" Front-Cover Text and one of Back-Cover Text may be added by (or -\" through arrangements made by) any one entity. If the Document already -\" includes a cover text for the same cover, previously added by you or -\" by arrangement made by the same entity you are acting on behalf of, -\" you may not add another; but you may replace the old one, on explicit -\" permission from the previous publisher that added the old one. -\" .PP -\" The author(s) and publisher(s) of the Document do not by this License -\" give permission to use their names for publicity for or to assert or -\" imply endorsement of any Modified Version. -\" .PP - -\" 5. COMBINING DOCUMENTS -\" .PP -\" You may combine the Document with other documents released under this -\" License, under the terms defined in section 4 above for modified -\" versions, provided that you include in the combination all of the -\" Invariant Sections of all of the original documents, unmodified, and -\" list them all as Invariant Sections of your combined work in its -\" license notice. -\" .PP -\" The combined work need only contain one copy of this License, and -\" multiple identical Invariant Sections may be replaced with a single -\" copy. If there are multiple Invariant Sections with the same name but -\" different contents, make the title of each such section unique by -\" adding at the end of it, in parentheses, the name of the original -\" author or publisher of that section if known, or else a unique number. -\" Make the same adjustment to the section titles in the list of -\" Invariant Sections in the license notice of the combined work. -\" .PP -\" In the combination, you must combine any sections entitled "History" -\" in the various original documents, forming one section entitled -\" "History"; likewise combine any sections entitled "Acknowledgements", -\" and any sections entitled "Dedications". You must delete all sections -\" entitled "Endorsements." -\" .PP - -\" 6. COLLECTIONS OF DOCUMENTS -\" .PP -\" You may make a collection consisting of the Document and other documents -\" released under this License, and replace the individual copies of this -\" License in the various documents with a single copy that is included in -\" the collection, provided that you follow the rules of this License for -\" verbatim copying of each of the documents in all other respects. -\" .PP -\" You may extract a single document from such a collection, and distribute -\" it individually under this License, provided you insert a copy of this -\" License into the extracted document, and follow this License in all -\" other respects regarding verbatim copying of that document. -\" .PP - -\" 7. AGGREGATION WITH INDEPENDENT WORKS -\" .PP -\" A compilation of the Document or its derivatives with other separate -\" and independent documents or works, in or on a volume of a storage or -\" distribution medium, does not as a whole count as a Modified Version -\" of the Document, provided no compilation copyright is claimed for the -\" compilation. Such a compilation is called an "aggregate", and this -\" License does not apply to the other self-contained works thus compiled -\" with the Document, on account of their being thus compiled, if they -\" are not themselves derivative works of the Document. -\" .PP -\" If the Cover Text requirement of section 3 is applicable to these -\" copies of the Document, then if the Document is less than one quarter -\" of the entire aggregate, the Document's Cover Texts may be placed on -\" covers that surround only the Document within the aggregate. -\" Otherwise they must appear on covers around the whole aggregate. -\" .PP - -\" 8. TRANSLATION -\" .PP -\" Translation is considered a kind of modification, so you may -\" distribute translations of the Document under the terms of section 4. -\" Replacing Invariant Sections with translations requires special -\" permission from their copyright holders, but you may include -\" translations of some or all Invariant Sections in addition to the -\" original versions of these Invariant Sections. You may include a -\" translation of this License provided that you also include the -\" original English version of this License. In case of a disagreement -\" between the translation and the original English version of this -\" License, the original English version will prevail. -\" .PP - -\" 9. TERMINATION -\" .PP -\" You may not copy, modify, sublicense, or distribute the Document except -\" as expressly provided for under this License. Any other attempt to -\" copy, modify, sublicense or distribute the Document 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. -\" .PP - -\" 10. FUTURE REVISIONS OF THIS LICENSE -\" .PP -\" The Free Software Foundation may publish new, revised versions -\" of the GNU Free Documentation 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. See -\" http://www.gnu.org/copyleft/. -\" .PP -\" Each version of the License is given a distinguishing version number. -\" If the Document specifies that a particular numbered version of this -\" License "or any later version" applies to it, you have the option of -\" following the terms and conditions either of that specified version or -\" of any later version that has been published (not as a draft) by the -\" Free Software Foundation. If the Document does not specify a version -\" number of this License, you may choose any version ever published (not -\" as a draft) by the Free Software Foundation. -\" .PP - -\" ADDENDUM: How to use this License for your documents -\" .PP -\" To use this License in a document you have written, include a copy of -\" the License in the document and put the following copyright and -\" license notices just after the title page: -\" .PP -\" Copyright (c) YEAR YOUR NAME. -\" Permission is granted to copy, distribute and/or -\" modify this document under the terms of the GNU -\" Free Documentation License, Version 1.1 or any later -\" version published by the Free Software Foundation; -\" with the Invariant Sections being LIST THEIR TITLES, -\" with the Front-Cover Texts being LIST, and with the -\" Back-Cover Texts being LIST. A copy of the license -\" is included in the section entitled "GNU Free -\" Documentation License". -\" .PP -\" If you have no Invariant Sections, write "with no Invariant Sections" -\" instead of saying which ones are invariant. If you have no -\" Front-Cover Texts, write "no Front-Cover Texts" instead of -\" "Front-Cover Texts being LIST"; likewise for Back-Cover Texts. -\" .PP -\" If your document contains nontrivial examples of program code, we -\" recommend releasing these examples in parallel under your choice of -\" free software license, such as the GNU General Public License, -\" to permit their use in free software. diff --git a/binutils/po/.cvsignore b/binutils/po/.cvsignore new file mode 100644 index 0000000000000..becd1537dbec1 --- /dev/null +++ b/binutils/po/.cvsignore @@ -0,0 +1 @@ +*.gmo diff --git a/binutils/po/da.gmo b/binutils/po/da.gmo new file mode 100644 index 0000000000000..8f9b965b6edf3 Binary files /dev/null and b/binutils/po/da.gmo differ diff --git a/binutils/po/da.po b/binutils/po/da.po new file mode 100644 index 0000000000000..67dc5de327e96 --- /dev/null +++ b/binutils/po/da.po @@ -0,0 +1,4800 @@ +# Danish messages for binutils. +# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Keld Simonsen , 2002-2003. +# +msgid "" +msgstr "" +"Project-Id-Version: binutils 2.12.91\n" +"POT-Creation-Date: 2002-07-23 15:55-0400\n" +"PO-Revision-Date: 2003-03-08 19:55+0100\n" +"Last-Translator: Keld Simonsen \n" +"Language-Team: Danish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: addr2line.c:74 +#, c-format +msgid "Usage: %s [option(s)] [addr(s)]\n" +msgstr "Brug: %s inddatafil(er)\n" + +#: addr2line.c:75 +msgid " Convert addresses into line number/file name pairs.\n" +msgstr " Konvertér adresser til linjenummer/filnavns-par.\n" + +#: addr2line.c:76 +msgid " If no addresses are specified on the command line, they will be read from stdin\n" +msgstr " Hvis ingen adresser er angivet på komandolinjen, vil de blive læst fra stdind\n" + +#: addr2line.c:77 +msgid "" +" The options are:\n" +" -b --target= Set the binary file format\n" +" -e --exe= Set the input file name (default is a.out)\n" +" -s --basenames Strip directory names\n" +" -f --functions Show function names\n" +" -C --demangle[=style] Demangle function names\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" + +#: addr2line.c:89 ar.c:297 coffdump.c:479 nlmconv.c:1119 objcopy.c:424 +#: objcopy.c:457 readelf.c:2310 size.c:104 srconv.c:1962 strings.c:666 +#: sysdump.c:774 windres.c:733 +#, c-format +msgid "Report bugs to %s\n" +msgstr "" +"Rapportere fejl til %s\n" +"Rapporter fejl i oversættelsen til dansk@klid.dk\n" + +#: addr2line.c:248 +#, c-format +msgid "%s: can not get addresses from archive" +msgstr "%s: kan ikke få fat på adresserne i arkivet" + +#: addr2line.c:320 nm.c:395 objdump.c:2782 +#, c-format +msgid "unknown demangling style `%s'" +msgstr "ukendt afkodningsstil \"%s\"" + +#: ar.c:238 +#, c-format +msgid "no entry %s in archive\n" +msgstr "ingen post %s i arkivet\n" + +#: ar.c:255 +#, c-format +msgid "Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n" +msgstr "" + +#: ar.c:258 +#, c-format +msgid " %s -M [\n" +"\n" +msgstr "" +"\n" +"\n" +"\n" + +#: ar.c:857 ar.c:925 +#, c-format +msgid "%s is not a valid archive" +msgstr "%s er ikke et gyldigt arkiv" + +#: ar.c:893 +#, c-format +msgid "stat returns negative size for %s" +msgstr "stat returnerer negativ størrelse på %s" + +#: ar.c:1020 +#, c-format +msgid "%s is not an archive" +msgstr "%s er ikke et arkiv" + +#: ar.c:1027 +#, c-format +msgid "creating %s" +msgstr "opretter %s" + +#: ar.c:1233 +#, c-format +msgid "No member named `%s'\n" +msgstr "Intet medlem hedder \"%s\"\n" + +#: ar.c:1285 +#, c-format +msgid "no entry %s in archive %s!" +msgstr "ingen %s i arkiv %s!" + +# archive map virker være vad indekset kaldes i kildekodeen +#: ar.c:1422 +#, c-format +msgid "%s: no archive map to update" +msgstr "%s: intet indeks at opdatere" + +#: arsup.c:86 +#, c-format +msgid "No entry %s in archive.\n" +msgstr "Ingen %s i arkivet.\n" + +#: arsup.c:117 +#, c-format +msgid "Can't open file %s\n" +msgstr "Kan ikke åbne fil %s\n" + +#: arsup.c:172 +#, c-format +msgid "%s: Can't open output archive %s\n" +msgstr "%s: Kan ikke åbne uddataarkivet %s\n" + +#: arsup.c:189 +#, c-format +msgid "%s: Can't open input archive %s\n" +msgstr "%s: Kan ikke åbne inddataarkivet %s\n" + +#: arsup.c:198 +#, c-format +msgid "%s: file %s is not an archive\n" +msgstr "%s: fil %s er ikke et arkiv\n" + +#: arsup.c:241 +#, c-format +msgid "%s: no output archive specified yet\n" +msgstr "%s: intet uddataarkiv angivet endnu\n" + +#: arsup.c:262 arsup.c:301 arsup.c:343 arsup.c:364 arsup.c:430 +#, c-format +msgid "%s: no open output archive\n" +msgstr "%s: intet åbent uddataarkiv\n" + +#: arsup.c:273 arsup.c:385 arsup.c:411 +#, c-format +msgid "%s: can't open file %s\n" +msgstr "%s: kan ikke åbne fil %s\n" + +# module file er detsamme som member +#: arsup.c:328 arsup.c:407 arsup.c:489 +#, c-format +msgid "%s: can't find module file %s\n" +msgstr "%s: kan ikke finde medlem %s\n" + +#: arsup.c:439 +#, c-format +msgid "Current open archive is %s\n" +msgstr "Det aktuelle åbne arkiv er %s\n" + +# BUGG: dubbelt blanksteg +#: arsup.c:464 +#, c-format +msgid "%s: no open archive\n" +msgstr "%s: intet åbent arkiv\n" + +#: binemul.c:39 +#, c-format +msgid " No emulation specific options\n" +msgstr "" + +#. Macros for common output. +#: binemul.h:42 +#, c-format +msgid " emulation options: \n" +msgstr "" + +#: bucomm.c:106 +#, c-format +msgid "can't set BFD default target to `%s': %s" +msgstr "kan ikke sætte BFD's standardmål til \"%s\": %s" + +#: bucomm.c:118 +#, c-format +msgid "%s: Matching formats:" +msgstr "%s: Passende format:" + +#: bucomm.c:135 +msgid "Supported targets:" +msgstr "Mål som håndteres:" + +#: bucomm.c:137 +#, c-format +msgid "%s: supported targets:" +msgstr "%s: mål som håndteres:" + +#: bucomm.c:153 +msgid "Supported architectures:" +msgstr "Arkitekturer som håndteres:" + +#: bucomm.c:155 +#, c-format +msgid "%s: supported architectures:" +msgstr "%s: arkitekturer som håndteres:" + +#: bucomm.c:262 +#, c-format +msgid "%s: bad number: %s" +msgstr "%s: fejlagtigt tal: %s" + +#: coffdump.c:107 +#, c-format +msgid "#lines %d " +msgstr "#linjer %d " + +#: coffdump.c:471 sysdump.c:767 +#, c-format +msgid "Usage: %s [option(s)] in-file\n" +msgstr "Brug: %s [flag] inddatafil\n" + +#: coffdump.c:472 +msgid " Print a human readable interpretation of a SYSROFF object file\n" +msgstr " Skriv en menneskeligt læsbar tolkning af en SYSROFF-objektfil\n" + +#: coffdump.c:473 +msgid "" +" The options are:\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" + +#: coffdump.c:541 srconv.c:2052 sysdump.c:831 +msgid "no input file specified" +msgstr "ingen inddatafil angaves" + +#: debug.c:653 +msgid "debug_add_to_current_namespace: no current file" +msgstr "debug_add_to_current_namespace: ingen aktuel fil" + +#: debug.c:736 +msgid "debug_start_source: no debug_set_filename call" +msgstr "debug_start_source: intet kald til debug_set_filename" + +#: debug.c:795 +msgid "debug_record_function: no debug_set_filename call" +msgstr "debug_record_function: intet kald til debug_set_filename" + +#: debug.c:851 +msgid "debug_record_parameter: no current function" +msgstr "debug_record_parameter: ingen aktuel funktion" + +#: debug.c:885 +msgid "debug_end_function: no current function" +msgstr "debug_end_function: ingen aktuel funktion" + +#: debug.c:891 +msgid "debug_end_function: some blocks were not closed" +msgstr "debug_end_function: nogen blokke afsluttedes ikke" + +#: debug.c:921 +msgid "debug_start_block: no current block" +msgstr "debug_start_block: ingen aktuel blok" + +#: debug.c:959 +msgid "debug_end_block: no current block" +msgstr "debug_end_block: ingen aktuel blok" + +#: debug.c:966 +msgid "debug_end_block: attempt to close top level block" +msgstr "debug_end_block: forsøg gjordes på at afslutte øverste blok" + +#: debug.c:992 +msgid "debug_record_line: no current unit" +msgstr "debug_record_line: ingen aktuel oversættelsesenhed" + +#. FIXME +#: debug.c:1046 +msgid "debug_start_common_block: not implemented" +msgstr "debug_start_common_block: ikke implementeret" + +#. FIXME +#: debug.c:1058 +msgid "debug_end_common_block: not implemented" +msgstr "debug_end_common_block: ikke implementeret" + +# BUGG: Kolon mangler antagligen +#. FIXME. +#: debug.c:1152 +msgid "debug_record_label: not implemented" +msgstr "debug_record_label: ikke implementeret" + +#: debug.c:1178 +msgid "debug_record_variable: no current file" +msgstr "debug_record_variable: ingen aktuel fil" + +#: debug.c:1194 +msgid "debug_record_variable: no current block" +msgstr "debug_record_variable: ingen aktuel blok" + +#: debug.c:1763 +msgid "debug_make_undefined_type: unsupported kind" +msgstr "debug_make_undefined_type: slagsen kan ikke håndteres" + +#: debug.c:1964 +msgid "debug_name_type: no current file" +msgstr "debug_name_type: ingen aktuel fil" + +#: debug.c:2012 +msgid "debug_tag_type: no current file" +msgstr "debug_tag_type: ingen aktuel fil" + +#: debug.c:2020 +msgid "debug_tag_type: extra tag attempted" +msgstr "debug_tag_type: forsøg gjordes på at sætte et ekstra mærke" + +#: debug.c:2059 +#, c-format +msgid "Warning: changing type size from %d to %d\n" +msgstr "Advarsel: ændrer datatypens størrelse fra %d til %d\n" + +#: debug.c:2083 +msgid "debug_find_named_type: no current compilation unit" +msgstr "debug_find_named_type: ingen aktuel oversættelsesenhed" + +#: debug.c:2190 +#, c-format +msgid "debug_get_real_type: circular debug information for %s\n" +msgstr "debug_get_real_type: %s har cirkulær fejlsøgningsinformation\n" + +#: debug.c:2650 +msgid "debug_write_type: illegal type encountered" +msgstr "debug_write_type: mødte en ugyldig type" + +#: dlltool.c:735 dlltool.c:760 dlltool.c:786 +#, c-format +msgid "Internal error: Unknown machine type: %d" +msgstr "Intern fejl: Ukendt maskintype: %d" + +#: dlltool.c:823 +#, c-format +msgid "Can't open def file: %s" +msgstr "Kan ikke åbne def-fil: %s" + +#: dlltool.c:828 +#, c-format +msgid "Processing def file: %s" +msgstr "Behandler def-fil: %s" + +#: dlltool.c:832 +msgid "Processed def file" +msgstr "Def-filen er behandlet" + +#: dlltool.c:858 +#, c-format +msgid "Syntax error in def file %s:%d" +msgstr "Syntaktisk fejl i def-fil %s:%d" + +#: dlltool.c:897 +#, c-format +msgid "NAME: %s base: %x" +msgstr "NAME: %s bas: %x" + +#: dlltool.c:900 dlltool.c:919 +msgid "Can't have LIBRARY and NAME" +msgstr "Kan ikke have både LIBRARY og NAME" + +#: dlltool.c:916 +#, c-format +msgid "LIBRARY: %s base: %x" +msgstr "LIBRARY: %s bas: %x" + +#: dlltool.c:1174 resrc.c:271 +#, c-format +msgid "wait: %s" +msgstr "wait: %s" + +#: dlltool.c:1179 dllwrap.c:430 resrc.c:276 +#, c-format +msgid "subprocess got fatal signal %d" +msgstr "subprocessen fik fatalt signal %d" + +#: dlltool.c:1185 dllwrap.c:437 resrc.c:283 +#, c-format +msgid "%s exited with status %d" +msgstr "%s afsluttede med status %d" + +#: dlltool.c:1217 +#, c-format +msgid "Sucking in info from %s section in %s" +msgstr "Suger ind info fra sektion %s i %s" + +#: dlltool.c:1341 +#, c-format +msgid "Excluding symbol: %s" +msgstr "Undtager symbol: %s" + +#: dlltool.c:1436 dlltool.c:1447 nm.c:959 nm.c:970 objdump.c:386 objdump.c:401 +#, c-format +msgid "%s: no symbols" +msgstr "%s: ingen symboler" + +#. FIXME: we ought to read in and block out the base relocations +#: dlltool.c:1474 +#, c-format +msgid "Done reading %s" +msgstr "Færdig med at læse %s" + +#: dlltool.c:1485 +#, c-format +msgid "Unable to open object file: %s" +msgstr "Kan ikke åbne objektfil: %s" + +#: dlltool.c:1488 +#, c-format +msgid "Scanning object file %s" +msgstr "Aflæser objektfil %s" + +#: dlltool.c:1503 +#, c-format +msgid "Cannot produce mcore-elf dll from archive file: %s" +msgstr "Kan ikke producere en mcore-elf-dll fra arkivfil: %s" + +#: dlltool.c:1595 +msgid "Adding exports to output file" +msgstr "Tilføjer eksportering til uddatafilen" + +#: dlltool.c:1640 +msgid "Added exports to output file" +msgstr "Tilføjede eksportering til uddatafilen" + +#: dlltool.c:1764 +#, c-format +msgid "Generating export file: %s" +msgstr "Genererer eksportfil: %s" + +#: dlltool.c:1769 +#, c-format +msgid "Unable to open temporary assembler file: %s" +msgstr "Kan ikke åbne temporær assemblerfil: %s" + +#: dlltool.c:1772 +#, c-format +msgid "Opened temporary file: %s" +msgstr "Åbnede temporær fil: %s" + +#: dlltool.c:1996 +msgid "Generated exports file" +msgstr "Genererede eksportfil" + +#: dlltool.c:2258 +#, c-format +msgid "bfd_open failed open stub file: %s" +msgstr "bfd_open mislykkedes at åbne stubfil: %s" + +#: dlltool.c:2261 +#, c-format +msgid "Creating stub file: %s" +msgstr "Opretter stubfil: %s" + +#: dlltool.c:2650 +#, c-format +msgid "failed to open temporary head file: %s" +msgstr "mislykkedes at åbne temporær hovedfil: %s" + +#: dlltool.c:2709 +#, c-format +msgid "failed to open temporary tail file: %s" +msgstr "mislykkedes at åbne temporær halefil: %s" + +#: dlltool.c:2777 +#, c-format +msgid "Can't open .lib file: %s" +msgstr "Kan ikke åbne .lib-fil: %s" + +#: dlltool.c:2780 +#, c-format +msgid "Creating library file: %s" +msgstr "Opretter biblioteksfil: %s" + +#: dlltool.c:2839 +#, c-format +msgid "cannot delete %s: %s" +msgstr "kan ikke slette %s: %s" + +#: dlltool.c:2843 +msgid "Created lib file" +msgstr "Oprettede biblioteksfilen" + +#: dlltool.c:2948 +#, c-format +msgid "Warning, ignoring duplicate EXPORT %s %d,%d" +msgstr "Advarsel, ignorerer duplikeret EXPORT %s %d,%d" + +#: dlltool.c:2954 +#, c-format +msgid "Error, duplicate EXPORT with oridinals: %s" +msgstr "Fejl, duplikeret EXPORT med ordningstal: %s" + +#: dlltool.c:3081 +msgid "Processing definitions" +msgstr "Behandler definitioner" + +#: dlltool.c:3119 +msgid "Processed definitions" +msgstr "Definitionerne er behandlede" + +# BUGG: Kolon fattas +#. xgetext:c-format +#: dlltool.c:3130 dllwrap.c:495 +#, c-format +msgid "Usage %s \n" +msgstr "Brug: %s \n" + +#. xgetext:c-format +#: dlltool.c:3132 +#, c-format +msgid " -m --machine Create as DLL for . [default: %s]\n" +msgstr " -m --machine Opret som DLL for . [forvalgt: %s]\n" + +#: dlltool.c:3133 +msgid " possible : arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" +msgstr " mulige : arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" + +#: dlltool.c:3134 +msgid " -e --output-exp Generate an export file.\n" +msgstr " -e --output-exp Generer en eksportfil.\n" + +#: dlltool.c:3135 +msgid " -l --output-lib Generate an interface library.\n" +msgstr " -l --output-lib Generere et grænsesnitsbibliotek.\n" + +#: dlltool.c:3136 +msgid " -a --add-indirect Add dll indirects to export file.\n" +msgstr " -a --add-indirect Tilføj inddirekte dll til eksportfilen.\n" + +#: dlltool.c:3137 +msgid " -D --dllname Name of input dll to put into interface lib.\n" +msgstr " -D --dllname Navn på inddata-dll at indsætte i grænsesnitsbiblioteket.\n" + +#: dlltool.c:3138 +msgid " -d --input-def Name of .def file to be read in.\n" +msgstr " -d --input-def Navn på .def-fil at læse ind.\n" + +#: dlltool.c:3139 +msgid " -z --output-def Name of .def file to be created.\n" +msgstr " -z --output-def Navn på .def-fil at oprette.\n" + +#: dlltool.c:3140 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols Eksportér alle symboler til .def\n" + +# Føljende streng har den beskrivende delen indenteret to tegn +# extra i den engelska texten til at to flag er for lange. I den +# svenska oversættelsen er de indenterede tre tegn extra til at +# den ena flaget blev yderligere et tegn for lang. +#: dlltool.c:3141 +msgid " --no-export-all-symbols Only export listed symbols\n" +msgstr " --no-export-all-symbols Eksportér kun listede symboler\n" + +# Føljende streng har den beskrivende delen indenteret to tegn +# extra i den engelska texten til at to flag er for lange. I den +# svenska oversættelsen er de indenterede tre tegn extra til at +# den ena flaget blev yderligere et tegn for lang. +#: dlltool.c:3142 +msgid " --exclude-symbols Don't export \n" +msgstr " --exclude-symbols Eksportér ikke symboler i \n" + +#: dlltool.c:3143 +msgid " --no-default-excludes Clear default exclude symbols\n" +msgstr "" + +#: dlltool.c:3144 +msgid " -b --base-file Read linker generated base file.\n" +msgstr " -b --base-file Læs den lænker-genererede basefil.\n" + +#: dlltool.c:3145 +msgid " -x --no-idata4 Don't generate idata$4 section.\n" +msgstr " -x --no-idata4 Generér ingen idata$4-sektion.\n" + +#: dlltool.c:3146 +msgid " -c --no-idata5 Don't generate idata$5 section.\n" +msgstr " -c --no-idata5 Generér ingen idata$5-sektion.\n" + +#: dlltool.c:3147 +msgid " -U --add-underscore Add underscores to symbols in interface library.\n" +msgstr " -U --add-underscore Sæt dit understreg på symboler i grænsesnitsbiblioteket.\n" + +#: dlltool.c:3148 +msgid " -k --kill-at Kill @ from exported names.\n" +msgstr " -k --kill-at Fjern @ fra eksporterede navne.\n" + +#: dlltool.c:3149 +msgid " -A --add-stdcall-alias Add aliases without @.\n" +msgstr " -A --add-stdcall-alias Tilføj aliaser uden @.\n" + +#: dlltool.c:3150 +msgid " -S --as Use for assembler.\n" +msgstr " -S --as Brug som assembler.\n" + +#: dlltool.c:3151 +msgid " -f --as-flags Pass to the assembler.\n" +msgstr " -f --as-flags Send til assembleren.\n" + +#: dlltool.c:3152 +msgid " -C --compat-implib Create backward compatible import library.\n" +msgstr " -C --compat-implib Opret bagudkompatibelt importbibliotek.\n" + +#: dlltool.c:3153 +msgid " -n --no-delete Keep temp files (repeat for extra preservation).\n" +msgstr " -n --no-delete Behold temp.-filer (repetér for øget antal).\n" + +#: dlltool.c:3154 +msgid " -v --verbose Be verbose.\n" +msgstr " -v --verbose Beskriv udførligt\n" + +#: dlltool.c:3155 +msgid " -V --version Display the program version.\n" +msgstr " -V --version Vis versionsinformation om programmet.\n" + +#: dlltool.c:3156 +msgid " -h --help Display this information.\n" +msgstr " -h --help Vis denne information.\n" + +#: dlltool.c:3158 +msgid " -M --mcore-elf Process mcore-elf object files into .\n" +msgstr " -M --mcore-elf Behandl mcore-elf-objektfiler til .\n" + +#: dlltool.c:3159 +msgid " -L --linker Use as the linker.\n" +msgstr " -L --linker Brug som lænker.\n" + +# Justeringen bliver fejl hér for flaget er for lang. +#: dlltool.c:3160 +msgid " -F --linker-flags Pass to the linker.\n" +msgstr " -F --linker-flags Send til lænkeren.\n" + +#: dlltool.c:3310 +#, c-format +msgid "Unable to open base-file: %s" +msgstr "Kan ikke åbne basefilen: %s" + +#: dlltool.c:3339 +#, c-format +msgid "Machine '%s' not supported" +msgstr "Maskine \"%s\" håndteres ikke" + +#: dlltool.c:3442 dllwrap.c:214 +#, c-format +msgid "Tried file: %s" +msgstr "Prøvede fil: %s" + +#: dlltool.c:3449 dllwrap.c:221 +#, c-format +msgid "Using file: %s" +msgstr "Bruger fil: %s" + +#: dllwrap.c:308 +#, c-format +msgid "Keeping temporary base file %s" +msgstr "Beholder temporær basefil %s" + +#: dllwrap.c:310 +#, c-format +msgid "Deleting temporary base file %s" +msgstr "Fjerner temporær basefil %s" + +#: dllwrap.c:324 +#, c-format +msgid "Keeping temporary exp file %s" +msgstr "Beholder temporær eksportfil %s" + +#: dllwrap.c:326 +#, c-format +msgid "Deleting temporary exp file %s" +msgstr "Fjerner temporær eksportfil %s" + +#: dllwrap.c:339 +#, c-format +msgid "Keeping temporary def file %s" +msgstr "Beholder temporær def-fil %s" + +#: dllwrap.c:341 +#, c-format +msgid "Deleting temporary def file %s" +msgstr "Fjerner temporær def-fil %s" + +#: dllwrap.c:496 +msgid " Generic options:\n" +msgstr " Generelle flag:\n" + +#: dllwrap.c:497 +msgid " --quiet, -q Work quietly\n" +msgstr " --quiet, -q Arbejd stille\n" + +#: dllwrap.c:498 +msgid " --verbose, -v Verbose\n" +msgstr " --verbose, -v Udførlig\n" + +#: dllwrap.c:499 +msgid " --version Print dllwrap version\n" +msgstr " --version Vis versionsinformation for dllwrap\n" + +#: dllwrap.c:500 +msgid " --implib Synonym for --output-lib\n" +msgstr " --implib Synonym for --output-lib\n" + +#: dllwrap.c:501 +#, c-format +msgid " Options for %s:\n" +msgstr " Flag for %s:\n" + +#: dllwrap.c:502 +msgid " --driver-name Defaults to \"gcc\"\n" +msgstr " --driver-name Forvalgt til \"gcc\"\n" + +#: dllwrap.c:503 +msgid " --driver-flags Override default ld flags\n" +msgstr " --driver-flags Forbigå forvalgte flag for ld\n" + +#: dllwrap.c:504 +msgid " --dlltool-name Defaults to \"dlltool\"\n" +msgstr " --dlltool-name Forvalgt til \"dlltool\"\n" + +#: dllwrap.c:505 +msgid " --entry Specify alternate DLL entry point\n" +msgstr " --entry Giv alternativ indgangspunkt i DLL'en\n" + +#: dllwrap.c:506 +msgid " --image-base Specify image base address\n" +msgstr " --image-base Giv billedets baseadresse\n" + +#: dllwrap.c:507 +msgid " --target i386-cygwin32 or i386-mingw32\n" +msgstr " --target i386-cygwin32 eller i386-mingw32\n" + +#: dllwrap.c:508 +msgid " --dry-run Show what needs to be run\n" +msgstr " --dry-run Gør intet andet end at vise hvad som bliver kørt\n" + +#: dllwrap.c:509 +msgid " --mno-cygwin Create Mingw DLL\n" +msgstr " --mno-cygwin Opret Mingw-DLL\n" + +#: dllwrap.c:510 +msgid " Options passed to DLLTOOL:\n" +msgstr " Flag som sendes til DLLTOOL:\n" + +#: dllwrap.c:511 +msgid " --machine \n" +msgstr " --machine \n" + +#: dllwrap.c:512 +msgid " --output-exp Generate export file.\n" +msgstr " --output-exp Generér eksportfil.\n" + +#: dllwrap.c:513 +msgid " --output-lib Generate input library.\n" +msgstr " --output-lib Generér inddatabibliotek.\n" + +#: dllwrap.c:514 +msgid " --add-indirect Add dll indirects to export file.\n" +msgstr " --add-indirect Tilføj indirekte dll til eksportfilen.\n" + +#: dllwrap.c:515 +msgid " --dllname Name of input dll to put into output lib.\n" +msgstr " --dllname Navn på inddata-dll som skal indsættes i uddatabiblioteket.\n" + +#: dllwrap.c:516 +msgid " --def Name input .def file\n" +msgstr " --def Navngiv .def-inddatafilen\n" + +#: dllwrap.c:517 +msgid " --output-def Name output .def file\n" +msgstr " --output-def Navngiv .def-uddatafilen\n" + +#: dllwrap.c:518 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols Eksporter alle symboler til .def\n" + +#: dllwrap.c:519 +msgid " --no-export-all-symbols Only export .drectve symbols\n" +msgstr " --no-export-all-symbols Eksporter kun .drectve-symboler\n" + +#: dllwrap.c:520 +msgid " --exclude-symbols Exclude from .def\n" +msgstr " --exclude-symbols Undtag symbolerne i fra .def\n" + +#: dllwrap.c:521 +msgid " --no-default-excludes Zap default exclude symbols\n" +msgstr " --no-default-excludes Bortse fra forvalgte undtagne symboler\n" + +#: dllwrap.c:522 +msgid " --base-file Read linker generated base file\n" +msgstr " --base-file Læs lænkergenereret basefil\n" + +#: dllwrap.c:523 +msgid " --no-idata4 Don't generate idata$4 section\n" +msgstr " --no-idata4 Generér ingen idata$4-sektion\n" + +#: dllwrap.c:524 +msgid " --no-idata5 Don't generate idata$5 section\n" +msgstr " --no-idata5 Generér ingen idata$5-sektion\n" + +#: dllwrap.c:525 +msgid " -U Add underscores to .lib\n" +msgstr " -U Sæt understregninger i .lib\n" + +#: dllwrap.c:526 +msgid " -k Kill @ from exported names\n" +msgstr " -k Fjern @ fra eksporterede navne\n" + +#: dllwrap.c:527 +msgid " --add-stdcall-alias Add aliases without @\n" +msgstr " --add-stdcall-alias Tilføj aliaser uden @\n" + +#: dllwrap.c:528 +msgid " --as Use for assembler\n" +msgstr " --as Brug som assembler\n" + +#: dllwrap.c:529 +msgid " --nodelete Keep temp files.\n" +msgstr " --nodelete Behold temporære filer.\n" + +#: dllwrap.c:530 +msgid " Rest are passed unmodified to the language driver\n" +msgstr " Øvrige flag sendes uændrede til programeringsprogsenheden\n" + +#: dllwrap.c:802 +msgid "Must provide at least one of -o or --dllname options" +msgstr "Angiv mindst et af flagene -o eller --dllname" + +#: dllwrap.c:830 +msgid "" +"no export definition file provided.\n" +"Creating one, but that may not be what you want" +msgstr "" +"ingen eksport-definitionsfil angaves.\n" +"Opretter én, men det er måske ikke hvad du ønsker" + +# Indenteringen er øged til at oversættelsen skal få plads fremfor +# kolonet på alle 4 strenge. +#: dllwrap.c:992 +#, c-format +msgid "DLLTOOL name : %s\n" +msgstr "DLLVÆRKTØJ navn : %s\n" + +# Indenteringen er øged til at oversættelsen skal få plads fremfor +# kolonet på alle 4 strenge. +#: dllwrap.c:993 +#, c-format +msgid "DLLTOOL options : %s\n" +msgstr "DLLTOOL flag: %s\n" + +# Indenteringen er øged til at oversættelsen skal få plads fremfor +# kolonet på alle 4 strenge. +#: dllwrap.c:994 +#, c-format +msgid "DRIVER name : %s\n" +msgstr "ENHED navn : %s\n" + +# Indenteringen er øged til at oversættelsen skal få plads fremfor +# kolonet på alle 4 strenge. +#: dllwrap.c:995 +#, c-format +msgid "DRIVER options : %s\n" +msgstr "ENHED flag : %s\n" + +#: emul_aix.c:52 +#, c-format +msgid " [-g] - 32 bit small archive\n" +msgstr "" + +#: emul_aix.c:53 +msgid " [-X32] - ignores 64 bit objects\n" +msgstr "" + +#: emul_aix.c:54 +msgid " [-X64] - ignores 32 bit objects\n" +msgstr "" + +#: emul_aix.c:55 +msgid " [-X32_64] - accepts 32 and 64 bit objects\n" +msgstr "" + +#: ieee.c:317 +msgid "unexpected end of debugging information" +msgstr "uventet slut på fejlsøgningsinformationen" + +#: ieee.c:412 +msgid "invalid number" +msgstr "ugyldigt tal" + +#: ieee.c:471 +msgid "invalid string length" +msgstr "ugyldig strenglængde" + +#: ieee.c:528 ieee.c:569 +msgid "expression stack overflow" +msgstr "overløb i udtryksstakken" + +#: ieee.c:548 +msgid "unsupported IEEE expression operator" +msgstr "IEEE-udtryksoperator som ikke understøttes" + +#: ieee.c:563 +msgid "unknown section" +msgstr "ukendt sektion" + +#: ieee.c:584 +msgid "expression stack underflow" +msgstr "underløb i udtryksstakken" + +#: ieee.c:598 +msgid "expression stack mismatch" +msgstr "fejlbalanceret udtryksstak" + +#: ieee.c:637 +msgid "unknown builtin type" +msgstr "ukendt indbygget type" + +#: ieee.c:782 +msgid "BCD float type not supported" +msgstr "flydendetalstype BCD understøttes ikke" + +#: ieee.c:928 +msgid "unexpected number" +msgstr "uventet tal" + +#: ieee.c:935 +msgid "unexpected record type" +msgstr "uventet posttype" + +#: ieee.c:968 +msgid "blocks left on stack at end" +msgstr "block stadig på stakken ved slutningen" + +#: ieee.c:1233 +msgid "unknown BB type" +msgstr "ukendt BB-type" + +#: ieee.c:1242 +msgid "stack overflow" +msgstr "overløb i stakken" + +#: ieee.c:1267 +msgid "stack underflow" +msgstr "underløb i stakken" + +#: ieee.c:1381 ieee.c:1453 ieee.c:2152 +msgid "illegal variable index" +msgstr "ikke tilladt variabelindeks" + +#: ieee.c:1431 +msgid "illegal type index" +msgstr "ikke tilladt typeindeks" + +#: ieee.c:1441 ieee.c:1478 +msgid "unknown TY code" +msgstr "ukendt TY-kode" + +#: ieee.c:1460 +msgid "undefined variable in TY" +msgstr "udefineret variabel i TY" + +#. Pascal file name. FIXME. +#: ieee.c:1871 +msgid "Pascal file name not supported" +msgstr "Pascal-filnavn understøttes ikke" + +# BUGG: qualif>i Set the input binary file format\n" +" -O --output-target= Set the output binary file format\n" +" -T --header-file= Read for NLM header information\n" +" -l --linker= Use for any linking\n" +" -d --debug Display on stderr the linker command line\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +msgstr "" + +#: nlmconv.c:1151 +#, c-format +msgid "support not compiled in for %s" +msgstr "ikke oversat med understøttelse for %s" + +#: nlmconv.c:1191 +msgid "make section" +msgstr "opret sektion" + +#: nlmconv.c:1205 +msgid "set section size" +msgstr "sæt sektionsstørrelse" + +#: nlmconv.c:1211 +msgid "set section alignment" +msgstr "" + +#: nlmconv.c:1215 +msgid "set section flags" +msgstr "sæt sektionsflag" + +#: nlmconv.c:1226 +msgid "set .nlmsections size" +msgstr "sæt .nlmsektions størrelse" + +#: nlmconv.c:1314 nlmconv.c:1322 nlmconv.c:1331 nlmconv.c:1336 +msgid "set .nlmsection contents" +msgstr "sæt .nlmsektions indhold" + +#: nlmconv.c:1837 +msgid "stub section sizes" +msgstr "sektionsstørrelser for stub" + +#: nlmconv.c:1886 +msgid "writing stub" +msgstr "skriver stub" + +#: nlmconv.c:1975 +#, c-format +msgid "unresolved PC relative reloc against %s" +msgstr "uløst PC-relativ relokering mod %s" + +#: nlmconv.c:2039 +#, c-format +msgid "overflow when adjusting relocation against %s" +msgstr "overløb ved justeringen af relokering mod %s" + +#: nlmconv.c:2156 +#, c-format +msgid "%s: execution of %s failed: " +msgstr "%s: udførsel af %s mislykkedes: " + +#: nlmconv.c:2171 +#, c-format +msgid "Execution of %s failed" +msgstr "Eksekvering af %s mislykkedes" + +#: nm.c:246 size.c:85 strings.c:650 +#, c-format +msgid "Usage: %s [option(s)] [file(s)]\n" +msgstr "Brug: %s [flag] [inddatafiler]\n" + +#: nm.c:247 +msgid " List symbols in [file(s)] (a.out by default).\n" +msgstr " List symboler i FILerne (eller a.out).\n" + +#: nm.c:248 +#, fuzzy +msgid "" +" The options are:\n" +" -a, --debug-syms Display debugger-only symbols\n" +" -A, --print-file-name Print name of the input file before every symbol\n" +" -B Same as --format=bsd\n" +" -C, --demangle[=STYLE] Decode low-level symbol names into user-level names\n" +" The STYLE, if specified, can be `auto' (the default),\n" +" `gnu', 'lucid', 'arm', 'hp', 'edg' or 'gnu-new-abi'\n" +" --no-demangle Do not demangle low-level symbol names\n" +" -D, --dynamic Display dynamic symbols instead of normal symbols\n" +" --defined-only Display only defined symbols\n" +" -e (ignored)\n" +" -f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',\n" +" `sysv' or `posix'. The default is `bsd'\n" +" -g, --extern-only Display only external symbols\n" +" -l, --line-numbers Use debugging information to find a filename and\n" +" line number for each symbol\n" +" -n, --numeric-sort Sort symbols numerically by address\n" +" -o Same as -A\n" +" -p, --no-sort Do not sort the symbols\n" +" -P, --portability Same as --format=posix\n" +" -r, --reverse-sort Reverse the sense of the sort\n" +" -S, --print-size Print size of defined symbols\n" +" -s, --print-armap Include index for symbols from archive members\n" +" --size-sort Sort symbols by size\n" +" -t, --radix=RADIX Use RADIX for printing symbol values\n" +" --target=BFDNAME Specify the target object format as BFDNAME\n" +" -u, --undefined-only Display only undefined symbols\n" +" -X 32_64 (ignored)\n" +" -h, --help Display this information\n" +" -V, --version Display this program's version number\n" +"\n" +msgstr "" +"\n" +" -a, --debug-syms Vis kun fejlsøgningssymboler\n" +" -A, --print-file-name Skriv navnet på inddatafilen for hvert symbol\n" +" -B Samme som --format=bsd\n" +" -C, --demangle[=STIL] Afkod lavniveausymbolnavn til brugerniveaunavn\n" +" STIL kan være \"auto\" (det forvalgte), \"gnu\",\n" +" \"lucid\", \"arm\", \"hp\", \"edg\" eller \"gnu-new-abi\"\n" +" --no-demangle Afkod ikke lavniveausymbolnavn\n" +" -D, --dynamic Vis dynamiske symboler i stedet for normale symboler\n" +" --defined-only Vis kun definerede symboler\n" +" -e (ignoreres)\n" +" -f, --format=FORMAT Brug FORMAT som uddataformat. FORMAT kan være\n" +" \"bsd\", \"sysv\" eller \"posix\". Forvalet er \"bsd\"\n" +" -g, --extern-only Vis kun externe symboler\n" +" -h, --help Vis denne hjælpen\n" +" -l, --line-numbers Brug fejlsøgningsinformationen til at slå op\n" +" filnavn og linjenummer for hvert symbol\n" +" -n, --numeric-sort Sortere symboler numerisk efter adress\n" +" -o Samma som -A\n" +" -p, --no-sort Sortere ikke symbolerne\n" +" -P, --portability Samme som --format=posix\n" +" -r, --reverse-sort Sortere åt andre hållet\n" +" -s, --print-armap Ta med indeks for symboler i arkivmedlemmer\n" +" --size-sort Sortere symboler efter størrelse\n" +" -t, --radix=BAS Skriv tal i talbasen BAS\n" +" --target=BFD-NAVN Specificere målobjektets format som BFD-NAVN\n" +" -u, --undefined-only Vis kun udefinerede symboler\n" +" -V, --version Vis programmets versionsinformation\n" +" -X 32_64 (ignoreres)\n" +"\n" + +#: nm.c:281 objdump.c:217 +#, c-format +msgid "Report bugs to %s.\n" +msgstr "" +"Rapportér fejl til %s.\n" +"Rapportér fejl i oversættelsen til dansk@klid.dk.\n" + +#: nm.c:314 +#, c-format +msgid "%s: invalid radix" +msgstr "%s: ugyldig talbase" + +#: nm.c:339 +#, c-format +msgid "%s: invalid output format" +msgstr "%s: ugyldigt uddataformat" + +#: nm.c:456 +msgid "Only -X 32_64 is supported" +msgstr "Kun -X 32_64 understøttes" + +#: nm.c:498 +#, c-format +msgid "data size %ld" +msgstr "datastørrelse %ld" + +#: nm.c:523 readelf.c:5306 readelf.c:5342 +#, c-format +msgid ": %d" +msgstr ": %d" + +#: nm.c:525 readelf.c:5308 readelf.c:5354 +#, c-format +msgid ": %d" +msgstr ": %d" + +#: nm.c:527 readelf.c:5310 readelf.c:5357 +#, c-format +msgid ": %d" +msgstr ": %d" + +#: nm.c:1339 +#, c-format +msgid "" +"\n" +"\n" +"Undefined symbols from %s:\n" +"\n" +msgstr "" +"\n" +"\n" +"Udefinerede symboler fra %s:\n" +"\n" + +#: nm.c:1341 +#, c-format +msgid "" +"\n" +"\n" +"Symbols from %s:\n" +"\n" +msgstr "" +"\n" +"\n" +"Symboler fra %s:\n" +"\n" + +#: nm.c:1343 nm.c:1401 +msgid "" +"Name Value Class Type Size Line Section\n" +"\n" +msgstr "" +"Navn Værdi Klasse Type Størr. Linje Sektion\n" +"\n" + +#: nm.c:1346 nm.c:1404 +msgid "" +"Name Value Class Type Size Line Section\n" +"\n" +msgstr "" +"Navn Værdi Klasse Type Størr. Linje Sektion\n" +"\n" + +#: nm.c:1397 +#, c-format +msgid "" +"\n" +"\n" +"Undefined symbols from %s[%s]:\n" +"\n" +msgstr "" +"\n" +"\n" +"Udefinerede symboler fra %s[%s]:\n" +"\n" + +#: nm.c:1399 +#, c-format +msgid "" +"\n" +"\n" +"Symbols from %s[%s]:\n" +"\n" +msgstr "" +"\n" +"\n" +"Symboler fra %s[%s]:\n" +"\n" + +#: nm.c:1614 +msgid "" +"\n" +"Archive index:\n" +msgstr "" +"\n" +"Arkivindeks:\n" + +#: objcopy.c:363 srconv.c:1952 +#, c-format +msgid "Usage: %s [option(s)] in-file [out-file]\n" +msgstr "Brug: %s [flag] inddatafil [uddatafil]\n" + +#: objcopy.c:364 +msgid " Copies a binary file, possibly transforming it in the process\n" +msgstr "" + +#: objcopy.c:365 objcopy.c:435 +msgid " The options are:\n" +msgstr " Flagene er:\n" + +#: objcopy.c:366 +#, fuzzy +msgid "" +" -I --input-target Assume input file is in format \n" +" -O --output-target Create an output file in format \n" +" -B --binary-architecture Set arch of output file, when input is binary\n" +" -F --target Set both input and output format to \n" +" --debugging Convert debugging information, if possible\n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -j --only-section Only copy section into the output\n" +" -R --remove-section Remove section from the output\n" +" -S --strip-all Remove all symbol and relocation information\n" +" -g --strip-debug Remove all debugging symbols\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol Do not copy symbol \n" +" -K --keep-symbol Only copy symbol \n" +" -L --localize-symbol Force symbol to be marked as a local\n" +" -G --keep-global-symbol Localize all symbols except \n" +" -W --weaken-symbol Force symbol to be marked as a weak\n" +" --weaken Force all global symbols to be marked as weak\n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -i --interleave Only copy one out of every bytes\n" +" -b --byte Select byte in every interleaved block\n" +" --gap-fill Fill gaps between sections with \n" +" --pad-to Pad the last section up to address \n" +" --set-start Set the start address to \n" +" {--change-start|--adjust-start} \n" +" Add to the start address\n" +" {--change-addresses|--adjust-vma} \n" +" Add to LMA, VMA and start addresses\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" Change LMA and VMA of section by \n" +" --change-section-lma {=|+|-}\n" +" Change the LMA of section by \n" +" --change-section-vma {=|+|-}\n" +" Change the VMA of section by \n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" Warn if a named section does not exist\n" +" --set-section-flags =\n" +" Set section 's properties to \n" +" --add-section = Add section found in to output\n" +" --rename-section =[,] Rename section to \n" +" --change-leading-char Force output format's leading character style\n" +" --remove-leading-char Remove leading character from global symbols\n" +" --redefine-sym = Redefine symbol name to \n" +" --srec-len Restrict the length of generated Srecords\n" +" --srec-forceS3 Restrict the type of generated Srecords to S3\n" +" --strip-symbols -N for all symbols listed in \n" +" --keep-symbols -K for all symbols listed in \n" +" --localize-symbols -L for all symbols listed in \n" +" --keep-global-symbols -G for all symbols listed in \n" +" --weaken-symbols -W for all symbols listed in \n" +" --alt-machine-code Use alternate machine code for output\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +msgstr "" +" -I --input-target Antag inddatafilens format er \n" +" -O --output-target Opret uddatafilen i formatet \n" +" -B --binary-architecture Vælg arkitektur for udfil når inddata er binær\n" +" -F --target Sætt både in- og udformatet til \n" +" --debugging Konvertere fejlsøgningsinfo, om muligt\n" +" -p --preserve-dates Kopiér ændrings/adgangtider til uddatan\n" +" -j --only-section Kopiér kun sektion til uddatan\n" +" -R --remove-section Fjern sektion fra uddatan\n" +" -S --strip-all Fjern all symbol- og relokeringsinfo\n" +" -g --strip-debug Fjern alle fejlsøgningssymboler\n" +" --strip-unneeded Fjern symboler onødiga for relokering\n" +" -N --strip-symbol Kopiér ikke symbol \n" +" -K --keep-symbol Kopiér kun symbol \n" +" -L --localize-symbol Markere symbol som lokal\n" +" -G --keep-global-symbol Gør alle symboler lokale, forutom \n" +" -W --weaken-symbol Markere symbol som vek\n" +" --weaken Markere alle globale symboler som veka\n" +" -x --discard-all Fjern alle ikke-globale symboler\n" +" -X --discard-locals Fjern alle oversættergenererede symboler\n" +" -i --interleave Kopiér kun en af hvert byte\n" +" -b --byte Vælg ud 'e byten i hvert intervall\n" +" --gap-fill Fyll luckor mellem sektionerne med \n" +" --pad-to Fyll ud efter sidste sektionen frem til \n" +" --set-start Sætt startadressen til \n" +" {--change-start|--adjust-start} <økn>\n" +" Tilføj <økn> til startadressen\n" +" {--change-addresses|--adjust-vma} <økn>\n" +" Tilføj <økn> til LMA, VMA og startedr.\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" Ændra LMA og VMA på sektion med \n" +" --change-section-lma {=|+|-}\n" +" Ændra LMA på sektion med \n" +" --change-section-vma {=|+|-}\n" +" Ændra VMA på sektion med \n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" Advar (inte/[no-]) om en sektion ikke findes\n" +" --set-section-flags =\n" +" Sætt sektion s attribut til \n" +" --add-section = Tilføj sektion i til uddatan\n" +" --rename-section =[,] Skift navn på sektion til \n" +" --change-leading-char Ændra til udformatets type af inledningstegn\n" +" --remove-leading-char Fjern inledningstegn fra globale symboler\n" +" --redefine-sym = Definere om ssymbolet med navn til \n" +" --srec-len Begrænsa længden på genererede S-poster\n" +" --srec-forceS3 Begrænsa typen af genererede S-poster til S3\n" +" --strip-symbols -N for alle symboler som listes i \n" +" --keep-symbols -K for alle symboler som listes i \n" +" --localize-symbols -L for alle symboler som listes i \n" +" --keep-global-symbols -G for alle symboler som listes i \n" +" --weaken-symbols -W for alle symboler som listes i \n" +" --alt-machine-code Brug alternativ maskinkode for uddata\n" +" -v --verbose Lista alle forændrede objektfiler\n" +" -V --version Vis programmets versionsinformation\n" +" -h --help Vis denne hjælp\n" + +#: objcopy.c:433 +#, c-format +msgid "Usage: %s in-file(s)\n" +msgstr "Brug: %s inddatafiler\n" + +#: objcopy.c:434 +msgid " Removes symbols and sections from files\n" +msgstr " Fjern symboler og afsnit fra filer\n" + +#: objcopy.c:436 +#, fuzzy +msgid "" +" -I --input-target= Assume input file is in format \n" +" -O --output-target= Create an output file in format \n" +" -F --target= Set both input and output format to \n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -R --remove-section= Remove section from the output\n" +" -s --strip-all Remove all symbol and relocation information\n" +" -g -S -d --strip-debug Remove all debugging symbols\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol= Do not copy symbol \n" +" -K --keep-symbol= Only copy symbol \n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +" -o Place stripped output into \n" +msgstr "" +" -I --input-target Antag inddatafilens format er \n" +" -O --output-target Opret uddatafilen i formatet \n" +" -F --target Sæt både in- og udformatet til \n" +" -p --preserve-dates Kopiér ændrings/adgangtider til uddata\n" +" -R --remove-section Fjern sektion fra uddata\n" +" -s --strip-all Fjern alle symbol- og relokeringsinfo\n" +" -g -S --strip-debug Fjern alle fejlsøgningssymboler\n" +" --strip-unneeded Fjern symboler unødige for relokeringen\n" +" -N --strip-symbol Kopiér ikke symbol \n" +" -K --keep-symbol Kopiér kun symbol \n" +" -x --discard-all Fjern alle ikke-globale symboler\n" +" -X --discard-locals Fjern alle oversættergenererede symboler\n" +" -v --verbose Lista alle forændrede objektfiler\n" +" -V --version Vis programmets versionsinformation\n" +" -h --help Vis denne hjælp\n" +" -o gem den udrensede uddata i \n" + +#: objcopy.c:506 +#, c-format +msgid "unrecognized section flag `%s'" +msgstr "ukendt sektionsflag \"%s\"" + +#: objcopy.c:507 +#, c-format +msgid "supported flags: %s" +msgstr "flag som håndteres: %s" + +#: objcopy.c:584 objcopy.c:2243 +#, c-format +msgid "cannot stat: %s: %s" +msgstr "kan ikke tage status: %s: %s" + +#: objcopy.c:591 objcopy.c:2261 +#, c-format +msgid "cannot open: %s: %s" +msgstr "kan ikke åbne: %s: %s" + +#: objcopy.c:594 objcopy.c:2265 +#, c-format +msgid "%s: fread failed" +msgstr "%s: fread mislykkedes" + +#: objcopy.c:667 +#, c-format +msgid "Ignoring rubbish found on line %d of %s" +msgstr "Ignorerer snavs fundet på linje %d i %s" + +#: objcopy.c:888 +#, c-format +msgid "%s: Multiple redefinition of symbol \"%s\"" +msgstr "%s: Flere omdefineringer af symbol \"%s\"" + +#: objcopy.c:893 +#, c-format +msgid "%s: Symbol \"%s\" is target of more than one redefinition" +msgstr "%s: Symbol \"%s\" er mål for mere end en omdefinering" + +#: objcopy.c:945 +msgid "Unable to change endianness of input file(s)" +msgstr "Kan ikke ændre endian-type på inddatafilerne" + +#: objcopy.c:953 +#, c-format +msgid "copy from %s(%s) to %s(%s)\n" +msgstr "kopierer fra %s(%s) til %s(%s)\n" + +#: objcopy.c:977 +#, c-format +msgid "Warning: Output file cannot represent architecture %s" +msgstr "Advarsel: Uddatafilen kan ikke repræsentere arkitektur %s" + +#: objcopy.c:1004 +#, c-format +msgid "can't create section `%s': %s" +msgstr "kan ikke oprette sektion \"%s\": %s" + +#: objcopy.c:1090 +#, c-format +msgid "Can't fill gap after %s: %s" +msgstr "Kan ikke fylde hullet efter %s: %s" + +#: objcopy.c:1115 +#, c-format +msgid "Can't add padding to %s: %s" +msgstr "Kan ikke fylde ud efter %s: %s" + +#: objcopy.c:1254 +#, c-format +msgid "%s: error copying private BFD data: %s" +msgstr "%s: fejl ved kopiering af privat BFD-data: %s" + +#: objcopy.c:1267 +msgid "unknown alternate machine code, ignored" +msgstr "ukendt alternativ maskinkode, ignoreret" + +#: objcopy.c:1300 objcopy.c:1330 +#, c-format +msgid "cannot mkdir %s for archive copying (error: %s)" +msgstr "kan ikke oprette katalog %s for arkivkopiering (fejl: %s)" + +#: objcopy.c:1497 +#, c-format +msgid "Multiple renames of section %s" +msgstr "Flere navneskift på sektion %s" + +#: objcopy.c:1581 +msgid "making" +msgstr "fremstilling" + +#: objcopy.c:1590 +msgid "size" +msgstr "størrelse" + +#: objcopy.c:1604 +msgid "vma" +msgstr "vma" + +#: objcopy.c:1630 +msgid "alignment" +msgstr "justering" + +#: objcopy.c:1638 +msgid "flags" +msgstr "flag" + +#: objcopy.c:1655 +msgid "private data" +msgstr "privat data" + +#: objcopy.c:1663 +#, c-format +msgid "%s: section `%s': error in %s: %s" +msgstr "%s: sektion \"%s\": fejl på %s: %s" + +#: objcopy.c:1946 +#, c-format +msgid "%s: can't create debugging section: %s" +msgstr "%s: kan ikke oprette fejlsøgningssektion: %s" + +#: objcopy.c:1961 +#, c-format +msgid "%s: can't set debugging section contents: %s" +msgstr "%s: kan ikke sætte indeholdet i fejlsøgningssektionen: %s" + +#: objcopy.c:1970 +#, c-format +msgid "%s: don't know how to write debugging information for %s" +msgstr "%s: véd ikke hvordan man skriver fejlsøgningsinformation for %s" + +#: objcopy.c:2078 +#, c-format +msgid "%s: cannot stat: %s" +msgstr "%s: kan ikke tage status: %s" + +#: objcopy.c:2129 +msgid "byte number must be non-negative" +msgstr "byte-nr må ikke være negativt" + +#: objcopy.c:2139 +msgid "interleave must be positive" +msgstr "intervalstørrelsen skal være positiv" + +#: objcopy.c:2159 objcopy.c:2167 +#, c-format +msgid "%s both copied and removed" +msgstr "%s både kopieret og fjernet" + +#: objcopy.c:2240 objcopy.c:2310 objcopy.c:2410 objcopy.c:2437 objcopy.c:2461 +#: objcopy.c:2465 objcopy.c:2485 +#, c-format +msgid "bad format for %s" +msgstr "fejlagtigt format på %s" + +#: objcopy.c:2379 +#, c-format +msgid "Warning: truncating gap-fill from 0x%s to 0x%x" +msgstr "Advarsel: afkorter udfyldningsværdien fra 0x%s til 0x%x" + +#: objcopy.c:2531 +msgid "alternate machine code index must be positive" +msgstr "indeks for alternativ maskinkode skal være positivt" + +#: objcopy.c:2550 +msgid "byte number must be less than interleave" +msgstr "byte-nr skal være mindre end antal byte i intervallet" + +#: objcopy.c:2577 +#, c-format +msgid "architecture %s unknown" +msgstr "arkitektur %s er ukendt" + +#: objcopy.c:2581 +msgid "Warning: input target 'binary' required for binary architecture parameter." +msgstr "Advarsel: inddata skal have formatet 'binary' for binærarkitektursparametre." + +#: objcopy.c:2582 +#, c-format +msgid " Argument %s ignored" +msgstr " Argument %s ignoreres" + +#: objcopy.c:2588 +#, c-format +msgid "Cannot stat: %s: %s" +msgstr "Kan ikke tage status: %s: %s" + +#: objcopy.c:2628 objcopy.c:2642 +#, c-format +msgid "%s %s%c0x%s never used" +msgstr "%s %s%c0x%s bruges aldrig" + +#: objdump.c:165 +#, c-format +msgid "Usage: %s \n" +msgstr "Brug: %s \n" + +#: objdump.c:166 +msgid " Display information from object .\n" +msgstr " Vis information fra .\n" + +#: objdump.c:167 +msgid " At least one of the following switches must be given:\n" +msgstr " Mindst et af følgende flag skal angives:\n" + +#: objdump.c:168 +#, fuzzy +msgid "" +" -a, --archive-headers Display archive header information\n" +" -f, --file-headers Display the contents of the overall file header\n" +" -p, --private-headers Display object format specific file header contents\n" +" -h, --[section-]headers Display the contents of the section headers\n" +" -x, --all-headers Display the contents of all headers\n" +" -d, --disassemble Display assembler contents of executable sections\n" +" -D, --disassemble-all Display assembler contents of all sections\n" +" -S, --source Intermix source code with disassembly\n" +" -s, --full-contents Display the full contents of all sections requested\n" +" -g, --debugging Display debug information in object file\n" +" -G, --stabs Display (in raw form) any STABS info in the file\n" +" -t, --syms Display the contents of the symbol table(s)\n" +" -T, --dynamic-syms Display the contents of the dynamic symbol table\n" +" -r, --reloc Display the relocation entries in the file\n" +" -R, --dynamic-reloc Display the dynamic relocation entries in the file\n" +" -v, --version Display this program's version number\n" +" -i, --info List object formats and architectures supported\n" +" -H, --help Display this information\n" +msgstr "" +" -a, --archive-headers Vis information fra arkivhoveden\n" +" -f, --file-headers Vis indeholdet i det overgripende filhovedet\n" +" -p, --private-headers Vis indeholdet i objektformatspecifikke filhoveden\n" +" -h, --[section-]headers Vis indeholdet i sektionshoveden\n" +" -x, --all-headers Vis indeholdet i alle hoveden\n" +" -d, --disassemble Vis disassemblering af exekverbara sektioner\n" +" -D, --disassemble-all Vis disassemblering af alle sektioner\n" +" -S, --source Varva kildekode med disassemblering\n" +" -s, --full-contents Vis hele indeholdet i alle udvalgte sektioner\n" +" -g, --debugging Vis fejlsøgningsinformation fra objektfilen\n" +" -G, --stabs Vis (ubehandlet) eventuell STABS-info fra filen\n" +" -t, --syms Vis indeholdet i symboltabellen(erna)\n" +" -T, --dynamic-syms Vis indeholdet i tabellen med dynamiske symboler\n" +" -r, --reloc Vis relokeringsposterne i filen\n" +" -R, --dynamic-reloc Vis de dynamiske relokeringsposterne i filen\n" +" -V, --version Vis programmets versionsinformation\n" +" -i, --info Lista de objektformat og arkitekturer som håndteres\n" +" -H, --help Vis denne hjælp\n" + +#: objdump.c:190 +msgid "" +"\n" +" The following switches are optional:\n" +msgstr "" +"\n" +" Følgende flag er frivillige:\n" + +#: objdump.c:191 +msgid "" +" -b, --target=BFDNAME Specify the target object format as BFDNAME\n" +" -m, --architecture=MACHINE Specify the target architecture as MACHINE\n" +" -j, --section=NAME Only display information for section NAME\n" +" -M, --disassembler-options=OPT Pass text OPT on to the disassembler\n" +" -EB --endian=big Assume big endian format when disassembling\n" +" -EL --endian=little Assume little endian format when disassembling\n" +" --file-start-context Include context from start of file (with -S)\n" +" -l, --line-numbers Include line numbers and filenames in output\n" +" -C, --demangle[=STYLE] Decode mangled/processed symbol names\n" +" The STYLE, if specified, can be `auto', 'gnu',\n" +" 'lucid', 'arm', 'hp', 'edg', or 'gnu-new-abi'\n" +" -w, --wide Format output for more than 80 columns\n" +" -z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling\n" +" --start-address=ADDR Only process data whoes address is >= ADDR\n" +" --stop-address=ADDR Only process data whoes address is <= ADDR\n" +" --prefix-addresses Print complete address alongside disassembly\n" +" --[no-]show-raw-insn Display hex alongside symbolic disassembly\n" +" --adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n" +"\n" +msgstr "" +" -b, --target=BFDNAVN Specificér at målobjektets format er BFDNAVN\n" +" -m, --architecture=MASKINE Specificér at målarkitekturen er MASKINE\n" +" -j, --section=NAVN Vis kun information om sektion NAVN\n" +" -M, --disassembler-options=FLG Videresend FLG til disassembleren\n" +" -EB --endian=big Antag big endian-format ved disassemblering\n" +" -EL --endian=little Antag little endian-format ved disassemblering\n" +" --file-start-context Medtag omgivelsen i begyndelsen af filen (med -S)\n" +" -l, --line-numbers Medtag linjenumre og filnavne i uddata\n" +" -C, --demangle[=STIL] Afkod kodede symbolnavne\n" +" STIL, hvis givet, kan være: \"auto\", \"gnu\",\n" +" \"lucid\", \"arm\", \"hp\", \"edg\", \"gnu-new-abi\"\n" +" -w, --wide Tilpas uddata til mere end 80 kolonner\n" +" -z, --disassemble-zeroes Hop ikke over blokke af nuller ved\n" +" disassemblering\n" +" --start-address=ADR Behandl kun data på adresser >= ADR\n" +" --stop-address=ADR Behandl kun data på adresser <= ADR\n" +" --prefix-addresses Vis fuldstændige adresser sammen med disassemblering.\n" +" --[no-]show-raw-insn Vis hex.-kode sammen med disassemblering\n" +" --adjust-vma=OFFSET Tilføj OFFSET til alle viste sektionsadresser\n" +"\n" + +#: objdump.c:358 +msgid "Sections:\n" +msgstr "Sektioner:\n" + +#: objdump.c:361 objdump.c:365 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "Idx Navn Størrelse VMA LMA Filoffs Just" + +#: objdump.c:367 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "Idx Navn Størrelse VMA LMA Filoffs Just" + +#: objdump.c:371 +msgid " Flags" +msgstr " Flag" + +#: objdump.c:419 +#, c-format +msgid "%s: not a dynamic object" +msgstr "%s: ikke et dynamisk objekt" + +#: objdump.c:433 +#, c-format +msgid "%s: No dynamic symbols" +msgstr "%s: Ingen dynamiske symboler" + +#: objdump.c:1114 +msgid "Out of virtual memory" +msgstr "Slut på virtuel hukommelse" + +#: objdump.c:1543 +#, c-format +msgid "Can't use supplied machine %s" +msgstr "Kan ikke bruge den opgivne maskine %s" + +#: objdump.c:1561 +#, c-format +msgid "Can't disassemble for architecture %s\n" +msgstr "Kan ikke disassemblere for arkitektur %s\n" + +#: objdump.c:1643 +#, c-format +msgid "Disassembly of section %s:\n" +msgstr "Disassemblering af sektion %s:\n" + +#: objdump.c:1818 +#, c-format +msgid "" +"No %s section present\n" +"\n" +msgstr "" +"Der findes ingen %s-sektion\n" +"\n" + +#: objdump.c:1825 +#, c-format +msgid "%s has no %s section" +msgstr "%s har ingen %s-sektion" + +#: objdump.c:1839 +#, c-format +msgid "Reading %s section of %s failed: %s" +msgstr "Læsning af %s-sektionen i %s mislykkedes: %s" + +#: objdump.c:1851 +#, c-format +msgid "Reading %s section of %s failed: %s\n" +msgstr "Læsning af %s-sektionen i %s mislykkedes: %s\n" + +#: objdump.c:1894 +#, c-format +msgid "" +"Contents of %s section:\n" +"\n" +msgstr "" +"Indhold i %s-sektionen:\n" +"\n" + +#: objdump.c:1994 +#, c-format +msgid "architecture: %s, " +msgstr "arkitektur: %s, " + +#: objdump.c:1997 +#, c-format +msgid "flags 0x%08x:\n" +msgstr "flag 0x%08x:\n" + +#: objdump.c:2010 +msgid "" +"\n" +"start address 0x" +msgstr "" +"\n" +"startadresse 0x" + +#: objdump.c:2042 +#, c-format +msgid "" +"\n" +"%s: file format %s\n" +msgstr "" +"\n" +"%s: filformat %s\n" + +#: objdump.c:2084 +#, c-format +msgid "%s: printing debugging information failed" +msgstr "%s: udskrift af fejlsøgningsinformationen mislykkedes" + +#: objdump.c:2161 +#, c-format +msgid "In archive %s:\n" +msgstr "I arkiv %s:\n" + +#: objdump.c:2213 +#, c-format +msgid "Contents of section %s:\n" +msgstr "Indhold i %s-sektionen:\n" + +#: objdump.c:2718 +#, c-format +msgid "BFD header file version %s\n" +msgstr "BFD-hovedfil version %s\n" + +#: objdump.c:2807 +msgid "unrecognized -E option" +msgstr "ukendt -E-flag" + +#: objdump.c:2818 +#, c-format +msgid "unrecognized --endian type `%s'" +msgstr "ukendt --endian-type \"%s\"" + +#: rdcoff.c:204 +#, c-format +msgid "parse_coff_type: Bad type code 0x%x" +msgstr "parse_coff_type: Fejlagtig typekode 0x%x" + +#: rdcoff.c:422 rdcoff.c:530 rdcoff.c:729 +#, c-format +msgid "bfd_coff_get_syment failed: %s" +msgstr "bfd_coff_get_syment mislykkedes: %s" + +#: rdcoff.c:438 rdcoff.c:749 +#, c-format +msgid "bfd_coff_get_auxent failed: %s" +msgstr "bfd_coff_get_auxent mislykkedes: %s" + +#: rdcoff.c:816 +#, c-format +msgid "%ld: .bf without preceding function" +msgstr "%ld: .bf mangler indledende funktion" + +#: rdcoff.c:866 +#, c-format +msgid "%ld: unexpected .ef\n" +msgstr "%ld: uventet .ef\n" + +#: rddbg.c:87 +#, c-format +msgid "%s: no recognized debugging information" +msgstr "%s: ingen kendt fejlsøgningsinformation" + +#: rddbg.c:410 +msgid "Last stabs entries before error:\n" +msgstr "De sidste stabs-poster inden fejlen:\n" + +#: readelf.c:328 +#, c-format +msgid "%s: Error: " +msgstr "%s: Fejl: " + +#: readelf.c:339 +#, c-format +msgid "%s: Warning: " +msgstr "%s: Advarsel: " + +#: readelf.c:361 +#, c-format +msgid "Unable to seek to %x for %s\n" +msgstr "Kan ikke søge til %x for %s\n" + +#: readelf.c:372 +#, c-format +msgid "Out of memory allocating %d bytes for %s\n" +msgstr "Slut på hukommelse ved allokering af %d byte for %s\n" + +#: readelf.c:380 +#, c-format +msgid "Unable to read in %d bytes of %s\n" +msgstr "Kan ikke indlæse %d byte af %s\n" + +#: readelf.c:433 readelf.c:591 +#, c-format +msgid "Unhandled data length: %d\n" +msgstr "Størrelse på data som ikke kan behandles: %d\n" + +#: readelf.c:675 +msgid "Don't know about relocations on this machine architecture\n" +msgstr "Ved ikke hvordan man relokaliserer på denne maskinarkitektur\n" + +#: readelf.c:697 readelf.c:726 readelf.c:772 readelf.c:799 +msgid "relocs" +msgstr "relokeringer" + +#: readelf.c:708 readelf.c:737 readelf.c:782 readelf.c:809 +msgid "out of memory parsing relocs" +msgstr "slut på hukommelse ved tolkning af relokeringer" + +#: readelf.c:861 +msgid " Offset Info Type Sym. Value Symbol's Name + Addend\n" +msgstr " Offset Info Type Symbolværdi Symbolnavn + Tillæg\n" + +#: readelf.c:863 +msgid " Offset Info Type Sym.Value Sym. Name + Addend\n" +msgstr " Offset Info Type Symbolværdi Symbolnavn + Tillæg\n" + +#: readelf.c:868 +msgid " Offset Info Type Sym. Value Symbol's Name\n" +msgstr " Offset Info Type Symbolværdi Symbolnavn\n" + +#: readelf.c:870 +msgid " Offset Info Type Sym.Value Sym. Name\n" +msgstr " Offset Info Type Symbolværdi Symbolnavn\n" + +#: readelf.c:878 +msgid " Offset Info Type Symbol's Value Symbol's Name + Addend\n" +msgstr " Offset Info Type Symbolværdi Symbolnavn + Tillæg\n" + +#: readelf.c:880 +msgid " Offset Info Type Sym. Value Sym. Name + Addend\n" +msgstr " Offset Info Type Symbolværdi Symbolnavn+ Tillæg\n" + +#: readelf.c:885 +msgid " Offset Info Type Symbol's Value Symbol's Name\n" +msgstr " Offset Info Type Symbolværdi Symbolnavn\n" + +#: readelf.c:887 +msgid " Offset Info Type Sym. Value Sym. Name\n" +msgstr " Offset Info Type Symbolværdi Symbolnavn\n" + +#: readelf.c:1134 readelf.c:1136 readelf.c:1184 readelf.c:1186 readelf.c:1195 +#: readelf.c:1197 +#, c-format +msgid "unrecognized: %-7lx" +msgstr "ukendt: %-7lx" + +#: readelf.c:1158 +#, c-format +msgid "" +msgstr "" + +#: readelf.c:1423 +#, c-format +msgid "Processor Specific: %lx" +msgstr "processorspecifik: %lx" + +#: readelf.c:1442 +#, c-format +msgid "Operating System specific: %lx" +msgstr "Operativsystemsspecifik: %lx" + +#: readelf.c:1445 readelf.c:2086 +#, c-format +msgid ": %lx" +msgstr ": %lx" + +#: readelf.c:1459 +msgid "NONE (None)" +msgstr "NONE (ingen)" + +#: readelf.c:1460 +msgid "REL (Relocatable file)" +msgstr "REL (relokérbar fil)" + +#: readelf.c:1461 +msgid "EXEC (Executable file)" +msgstr "EXEC (eksekverbar fil)" + +#: readelf.c:1462 +msgid "DYN (Shared object file)" +msgstr "DYN (delt objektfil)" + +#: readelf.c:1463 +msgid "CORE (Core file)" +msgstr "CORE (hukommelsesfil)" + +#: readelf.c:1467 +#, c-format +msgid "Processor Specific: (%x)" +msgstr "processorspecifik: (%x)" + +#: readelf.c:1469 +#, c-format +msgid "OS Specific: (%x)" +msgstr "OS-specifikt: (%x)" + +#: readelf.c:1471 readelf.c:1573 readelf.c:2238 +#, c-format +msgid ": %x" +msgstr ": %x" + +#: readelf.c:1484 +msgid "None" +msgstr "Ingen" + +#: readelf.c:2278 +msgid "Usage: readelf elf-file(s)\n" +msgstr "Brug: readelf elf-filer\n" + +#: readelf.c:2279 +msgid " Display information about the contents of ELF format files\n" +msgstr "" + +#: readelf.c:2280 +msgid "" +" Options are:\n" +" -a --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" +" -h --file-header Display the ELF file header\n" +" -l --program-headers Display the program headers\n" +" --segments An alias for --program-headers\n" +" -S --section-headers Display the sections' header\n" +" --sections An alias for --section-headers\n" +" -e --headers Equivalent to: -h -l -S\n" +" -s --syms Display the symbol table\n" +" --symbols An alias for --syms\n" +" -n --notes Display the core notes (if present)\n" +" -r --relocs Display the relocations (if present)\n" +" -u --unwind Display the unwind info (if present)\n" +" -d --dynamic Display the dynamic segment (if present)\n" +" -V --version-info Display the version sections (if present)\n" +" -A --arch-specific Display architecture specific information (if any).\n" +" -D --use-dynamic Use the dynamic section info when displaying symbols\n" +" -x --hex-dump= Dump the contents of section \n" +" -w --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n" +" Display the contents of DWARF2 debug sections\n" +msgstr "" + +#: readelf.c:2301 +msgid "" +" -i --instruction-dump=\n" +" Disassemble the contents of section \n" +msgstr "" +" -i --instruction-dump=\n" +" Disassemblér indeholdet i sektion \n" + +#: readelf.c:2305 +msgid "" +" -I --histogram Display histogram of bucket list lengths\n" +" -W --wide Allow output width to exceed 80 characters\n" +" -H --help Display this information\n" +" -v --version Display the version number of readelf\n" +msgstr "" + +#: readelf.c:2327 +msgid "Out of memory allocating dump request table." +msgstr "Slut på hukommelse ved allokering af tabel for ønskede udskrifter." + +#: readelf.c:2491 +#, c-format +msgid "Unrecognized debug option '%s'\n" +msgstr "Ukendt fejlsøgningsargument \"%s\"\n" + +#: readelf.c:2519 +#, c-format +msgid "Invalid option '-%c'\n" +msgstr "Ugyldigt flag \"-%c\"\n" + +#: readelf.c:2532 +msgid "Nothing to do.\n" +msgstr "Intet at gøre.\n" + +#: readelf.c:2545 readelf.c:2562 readelf.c:4867 +msgid "none" +msgstr "ingen" + +#: readelf.c:2549 readelf.c:2566 readelf.c:2594 +#, c-format +msgid "" +msgstr "" + +#: readelf.c:2563 +msgid "2's complement, little endian" +msgstr "2-komplement, little endian" + +#: readelf.c:2564 +msgid "2's complement, big endian" +msgstr "2-komplement, big endian" + +#: readelf.c:2591 +msgid "Standalone App" +msgstr "Selvstændig app." + +#: readelf.c:2609 +msgid "Not an ELF file - it has the wrong magic bytes at the start\n" +msgstr "Ikke en ELF-fil - den har forkerte magiske byte i begyndelsen\n" + +#: readelf.c:2617 +msgid "ELF Header:\n" +msgstr "ELF-hoved:\n" + +#: readelf.c:2618 +msgid " Magic: " +msgstr " Magi: " + +#: readelf.c:2622 +#, c-format +msgid " Class: %s\n" +msgstr " Klasse: %s\n" + +#: readelf.c:2624 +#, c-format +msgid " Data: %s\n" +msgstr " Data: %s\n" + +#: readelf.c:2626 +#, c-format +msgid " Version: %d %s\n" +msgstr " Version: %d %s\n" + +#: readelf.c:2633 +#, c-format +msgid " OS/ABI: %s\n" +msgstr " OS/ABI: %s\n" + +#: readelf.c:2635 +#, c-format +msgid " ABI Version: %d\n" +msgstr " ABI-version: %d\n" + +#: readelf.c:2637 +#, c-format +msgid " Type: %s\n" +msgstr " Type: %s\n" + +#: readelf.c:2639 +#, c-format +msgid " Machine: %s\n" +msgstr " Maskine: %s\n" + +#: readelf.c:2641 +#, c-format +msgid " Version: 0x%lx\n" +msgstr " Version: 0x%lx\n" + +#: readelf.c:2644 +msgid " Entry point address: " +msgstr " Indgangsodresse: " + +#: readelf.c:2646 +msgid "" +"\n" +" Start of program headers: " +msgstr "" +"\n" +" Start for programhoveder: " + +#: readelf.c:2648 +msgid "" +" (bytes into file)\n" +" Start of section headers: " +msgstr "" +" (byte inde i filen)\n" +" Start for sektionshoveder: " + +#: readelf.c:2650 +msgid " (bytes into file)\n" +msgstr " (byte inde i filen)\n" + +#: readelf.c:2652 +#, c-format +msgid " Flags: 0x%lx%s\n" +msgstr " Flag: 0x%lx%s\n" + +#: readelf.c:2655 +#, c-format +msgid " Size of this header: %ld (bytes)\n" +msgstr " Dette hoveds størrelse: %ld (byte)\n" + +#: readelf.c:2657 +#, c-format +msgid " Size of program headers: %ld (bytes)\n" +msgstr " Programhovedernes størrelse: %ld (byte)\n" + +#: readelf.c:2659 +#, c-format +msgid " Number of program headers: %ld\n" +msgstr " Antal programhoveder: %ld\n" + +#: readelf.c:2661 +#, c-format +msgid " Size of section headers: %ld (bytes)\n" +msgstr " Sektionshovedernes størrelse: %ld (byte)\n" + +#: readelf.c:2663 +#, c-format +msgid " Number of section headers: %ld" +msgstr " Antal sektionshoveder: %ld" + +#: readelf.c:2668 +#, c-format +msgid " Section header string table index: %ld" +msgstr " Sektionshovedets strengtabelsindeks: %ld" + +#: readelf.c:2702 readelf.c:2738 +msgid "program headers" +msgstr "programhoveder" + +#: readelf.c:2772 +msgid "" +"\n" +"There are no program headers in this file.\n" +msgstr "" +"\n" +"Der findes ingen programhoveder i denne fil.\n" + +#: readelf.c:2778 +#, c-format +msgid "" +"\n" +"Elf file type is %s\n" +msgstr "" +"\n" +"Elf-filtype er %s\n" + +#: readelf.c:2779 +msgid "Entry point " +msgstr "Indgangspunkt " + +#: readelf.c:2781 +#, c-format +msgid "" +"\n" +"There are %d program headers, starting at offset " +msgstr "" +"\n" +"Der findes %d programhoveder, med begyndelse på offset " + +#: readelf.c:2792 readelf.c:3019 readelf.c:3065 readelf.c:3128 readelf.c:3195 +#: readelf.c:4229 readelf.c:4272 readelf.c:4461 readelf.c:5414 readelf.c:5428 +#: readelf.c:9659 readelf.c:9699 +msgid "Out of memory\n" +msgstr "Slut på hukommelse\n" + +# BUGG: plural-s +#: readelf.c:2810 readelf.c:2812 +msgid "" +"\n" +"Program Headers:\n" +msgstr "" +"\n" +"Programhoveder:\n" + +#: readelf.c:2816 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr " Type Offset VirtAdr FysAdr FilSt HukommelseSt Flg Just\n" + +#: readelf.c:2819 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr " Type Offset VirtAdr FysAdr FilStrl HukommelseSt Flg Just\n" + +#: readelf.c:2823 +msgid " Type Offset VirtAddr PhysAddr\n" +msgstr " Type Offset VirtAdr FysAdr\n" + +#: readelf.c:2825 +msgid " FileSiz MemSiz Flags Align\n" +msgstr " FilStrl HukommelseStrl Flag Just\n" + +#: readelf.c:2925 +msgid "more than one dynamic segment\n" +msgstr "mere end et dynamisk segment\n" + +#: readelf.c:2933 +msgid "Unable to find program interpreter name\n" +msgstr "Kan ikke finde navnet på programtolken\n" + +#: readelf.c:2940 +#, c-format +msgid "" +"\n" +" [Requesting program interpreter: %s]" +msgstr "" +"\n" +" [Anmoder programtolkere: %s]" + +#: readelf.c:2958 +msgid "" +"\n" +" Section to Segment mapping:\n" +msgstr "" +"\n" +" Sektion til segment-afbildning:\n" + +#: readelf.c:2959 +msgid " Segment Sections...\n" +msgstr " Segmentsektioner...\n" + +#: readelf.c:3010 readelf.c:3056 +msgid "section headers" +msgstr "sektionshoveder" + +#: readelf.c:3104 readelf.c:3171 +msgid "symbols" +msgstr "symboler" + +#: readelf.c:3115 readelf.c:3182 +msgid "symtab shndx" +msgstr "symtab shndx" + +#: readelf.c:3284 +msgid "" +"\n" +"There are no sections in this file.\n" +msgstr "" +"\n" +"Der findes ingen sektioner i denne fil.\n" + +#: readelf.c:3290 +#, c-format +msgid "There are %d section headers, starting at offset 0x%lx:\n" +msgstr "Der findes %d sektionshoveder, med begyndelse på offset 0x%lx:\n" + +#: readelf.c:3307 readelf.c:3621 readelf.c:3968 readelf.c:5565 +msgid "string table" +msgstr "strengtabel" + +#: readelf.c:3328 +msgid "File contains multiple dynamic symbol tables\n" +msgstr "Filen indeholder flere tabeller med dynamiske symboler\n" + +#: readelf.c:3340 +msgid "File contains multiple dynamic string tables\n" +msgstr "Filen indeholder flere dynamiske strengtabeller\n" + +#: readelf.c:3346 +msgid "dynamic strings" +msgstr "dynamiske strenge" + +#: readelf.c:3352 +msgid "File contains multiple symtab shndx tables\n" +msgstr "Filen indeholder flere symtab-shndx-tabeller\n" + +# BUGG: plural-s +#: readelf.c:3390 +msgid "" +"\n" +"Section Headers:\n" +msgstr "" +"\n" +"Sektionshoveder:\n" + +# BUGG: plural-s +#: readelf.c:3392 +msgid "" +"\n" +"Section Header:\n" +msgstr "" +"\n" +"Sektionshoved:\n" + +#: readelf.c:3396 +msgid " [Nr] Name Type Addr Off Size ES Flg Lk Inf Al\n" +msgstr " [Nr] Navn Type Adr Off Strl PS Flg Lk Inf Ju\n" + +#: readelf.c:3399 +msgid " [Nr] Name Type Address Off Size ES Flg Lk Inf Al\n" +msgstr " [Nr] Navn Type Adresse Off Strl PS Flg Lk Inf Ju\n" + +#: readelf.c:3402 +msgid " [Nr] Name Type Address Offset\n" +msgstr " [Nr] Navn Type Adresse Offset\n" + +#: readelf.c:3403 +msgid " Size EntSize Flags Link Info Align\n" +msgstr " Størrelse Poststørrelse Flag Lænk Info Just\n" + +#: readelf.c:3498 +msgid "" +"Key to Flags:\n" +" W (write), A (alloc), X (execute), M (merge), S (strings)\n" +" I (info), L (link order), G (group), x (unknown)\n" +" O (extra OS processing required) o (OS specific), p (processor specific)\n" +msgstr "" +"Nøgle til flagene:\n" +" W (skriv), A (allokér), X (eksekvér), M (flet), S (strenge)\n" +" I (info), L (lænkerorden), G (gruppe), x (ukendt)\n" +" O (ekstra OS-behandling kræves) o (OS-specifik), p (processor-specifik)\n" + +#: readelf.c:3559 +#, c-format +msgid "" +"\n" +"Relocation section at offset 0x%lx contains %ld bytes:\n" +msgstr "" +"\n" +"Relokeringssektionen på offset 0x%lx indeholder %ld byte:\n" + +#: readelf.c:3566 +msgid "" +"\n" +"There are no dynamic relocations in this file.\n" +msgstr "" +"\n" +"Der findes ingen dynamiske relokeringer i denne fil.\n" + +#: readelf.c:3593 +msgid "" +"\n" +"Relocation section " +msgstr "" +"\n" +"Relokeringssektion " + +#: readelf.c:3598 readelf.c:4031 readelf.c:4045 +#, c-format +msgid "'%s'" +msgstr "" + +#: readelf.c:3600 readelf.c:4047 +#, c-format +msgid " at offset 0x%lx contains %lu entries:\n" +msgstr " på offset 0x%lx indeholder %lu poster:\n" + +#: readelf.c:3638 +msgid "" +"\n" +"There are no relocations in this file.\n" +msgstr "" +"\n" +"Der findes ingen relokeringer i denne fil.\n" + +#: readelf.c:3834 +msgid "unwind table" +msgstr "tilbagerulningstabel" + +#: readelf.c:3885 readelf.c:3897 readelf.c:7890 readelf.c:7901 +#, c-format +msgid "Skipping unexpected symbol type %u\n" +msgstr "Hopper over uventet symboltype %u\n" + +#: readelf.c:3905 +#, c-format +msgid "Skipping unexpected relocation type %s\n" +msgstr "Hopper over uventet relokeringstype %s\n" + +#: readelf.c:3950 readelf.c:3975 +msgid "" +"\n" +"There are no unwind sections in this file.\n" +msgstr "" +"\n" +"Der findes ingen tilbagerulningssektioner i denne fil.\n" + +# BUG: Fortsættelsen er ikke markeret for oversættelse i koden og indeholder '-citattegn. +#: readelf.c:4026 +msgid "" +"\n" +"Could not find unwind info section for " +msgstr "" +"\n" +"Kunne ikke finde tilbagerulningssektion til " + +#: readelf.c:4038 +msgid "unwind info" +msgstr "tilbagerulningsinfo" + +#: readelf.c:4040 +msgid "" +"\n" +"Unwind section " +msgstr "" +"\n" +"Tilbagerulningssektion " + +#: readelf.c:4213 readelf.c:4256 +msgid "dynamic segment" +msgstr "dynamisk segment" + +#: readelf.c:4334 +msgid "" +"\n" +"There is no dynamic segment in this file.\n" +msgstr "" +"\n" +"Der findes intet dynamisk segment i denne fil.\n" + +#: readelf.c:4368 +msgid "Unable to seek to end of file!" +msgstr "Kan ikke søge til slutningen af filen!" + +#: readelf.c:4379 +msgid "Unable to determine the number of symbols to load\n" +msgstr "Kan ikke bestemme hvor mange symboler som skal læses ind\n" + +#: readelf.c:4409 +msgid "Unable to seek to end of file\n" +msgstr "Kan ikke søge til slutningen af filen\n" + +#: readelf.c:4415 +msgid "Unable to determine the length of the dynamic string table\n" +msgstr "Kan ikke bestemme længden på den dynamiske strengtabel\n" + +#: readelf.c:4420 +msgid "dynamic string table" +msgstr "dynamisk strengtabel" + +#: readelf.c:4454 +msgid "symbol information" +msgstr "symbolinformation" + +#: readelf.c:4478 +#, c-format +msgid "" +"\n" +"Dynamic segment at offset 0x%x contains %ld entries:\n" +msgstr "" +"\n" +"Dynamisk segment på offset 0x%x indeholder %ld poster:\n" + +#: readelf.c:4481 +msgid " Tag Type Name/Value\n" +msgstr " Mærke Type Navn/Værdi\n" + +#: readelf.c:4517 +msgid "Auxiliary library" +msgstr "Eksternt bibliotek" + +#: readelf.c:4521 +msgid "Filter library" +msgstr "Filterbibliotek" + +#: readelf.c:4525 +msgid "Configuration file" +msgstr "Konfigurationsfil" + +#: readelf.c:4529 +msgid "Dependency audit library" +msgstr "Afhængighedskontrolsbibliotek" + +#: readelf.c:4533 +msgid "Audit library" +msgstr "Kontrolbibliotek" + +#: readelf.c:4551 readelf.c:4577 readelf.c:4603 +msgid "Flags:" +msgstr "Flag:" + +#: readelf.c:4553 readelf.c:4579 readelf.c:4605 +msgid " None\n" +msgstr " Ingen\n" + +#: readelf.c:4724 +#, c-format +msgid "Shared library: [%s]" +msgstr "Delt bibliotek: [%s]" + +#: readelf.c:4727 +msgid " program interpreter" +msgstr " Programfortolker" + +#: readelf.c:4731 +#, c-format +msgid "Library soname: [%s]" +msgstr "Bibliotekets so-navn: [%s]" + +#: readelf.c:4735 +#, c-format +msgid "Library rpath: [%s]" +msgstr "Bibliotekets rpath: [%s]" + +#: readelf.c:4739 +#, c-format +msgid "Library runpath: [%s]" +msgstr "Bibliotekets runpath: [%s]" + +#: readelf.c:4802 +#, c-format +msgid "Not needed object: [%s]\n" +msgstr "Unødvendigt objekt: [%s]\n" + +#: readelf.c:4913 +#, c-format +msgid "" +"\n" +"Version definition section '%s' contains %ld entries:\n" +msgstr "" +"\n" +"Versiondefinitionssektion \"%s\" indeholder %ld poster:\n" + +#: readelf.c:4916 +msgid " Addr: 0x" +msgstr " Adr: 0x" + +#: readelf.c:4918 readelf.c:5113 +#, c-format +msgid " Offset: %#08lx Link: %lx (%s)\n" +msgstr " Offset: %#08lx Lænk: %lx (%s)\n" + +#: readelf.c:4925 +msgid "version definition section" +msgstr "versiondefinitionssektion" + +#: readelf.c:4951 +#, c-format +msgid " %#06x: Rev: %d Flags: %s" +msgstr " %#06x: Rev: %d Flag: %s" + +#: readelf.c:4954 +#, c-format +msgid " Index: %d Cnt: %d " +msgstr " Indeks: %d Ant: %d " + +#: readelf.c:4965 +#, c-format +msgid "Name: %s\n" +msgstr "Navn: %s\n" + +#: readelf.c:4967 +#, c-format +msgid "Name index: %ld\n" +msgstr "Navneindeks: %ld\n" + +#: readelf.c:4982 +#, c-format +msgid " %#06x: Parent %d: %s\n" +msgstr " %#06x: Forælder %d: %s\n" + +#: readelf.c:4985 +#, c-format +msgid " %#06x: Parent %d, name index: %ld\n" +msgstr " %#06x: Forælder %d, navneindeks: %ld\n" + +#: readelf.c:5004 +#, c-format +msgid "" +"\n" +"Version needs section '%s' contains %ld entries:\n" +msgstr "" +"\n" +"Versionbehovssektion \"%s\" indeholder %ld poster:\n" + +#: readelf.c:5007 +msgid " Addr: 0x" +msgstr " Adr: 0x" + +#: readelf.c:5009 +#, c-format +msgid " Offset: %#08lx Link to section: %ld (%s)\n" +msgstr " Offset: %#08lx Lænke til sektion: %ld (%s)\n" + +#: readelf.c:5015 +msgid "version need section" +msgstr "versionsbehovssektion" + +#: readelf.c:5037 +#, c-format +msgid " %#06x: Version: %d" +msgstr " %#06x: Version: %d" + +#: readelf.c:5040 +#, c-format +msgid " File: %s" +msgstr " Fil: %s" + +#: readelf.c:5042 +#, c-format +msgid " File: %lx" +msgstr " Fil: %lx" + +#: readelf.c:5044 +#, c-format +msgid " Cnt: %d\n" +msgstr " Ant: %d\n" + +#: readelf.c:5062 +#, c-format +msgid " %#06x: Name: %s" +msgstr " %#06x: Navn: %s" + +#: readelf.c:5065 +#, c-format +msgid " %#06x: Name index: %lx" +msgstr " %#06x: Navneindeks: %lx" + +#: readelf.c:5068 +#, c-format +msgid " Flags: %s Version: %d\n" +msgstr " Flag: %s Version: %d\n" + +#: readelf.c:5104 +msgid "version string table" +msgstr "versionsstrengtabel" + +#: readelf.c:5108 +#, c-format +msgid "" +"\n" +"Version symbols section '%s' contains %d entries:\n" +msgstr "" +"\n" +"Versionsymbolssektion \"%s\" indeholder %d poster:\n" + +#: readelf.c:5111 +msgid " Addr: " +msgstr " Adr: " + +#: readelf.c:5121 +msgid "version symbol data" +msgstr "versionsymbolsdata" + +#: readelf.c:5148 +msgid " 0 (*local*) " +msgstr " 0 (*lokal*) " + +#: readelf.c:5152 +msgid " 1 (*global*) " +msgstr " 1 (*global*) " + +#: readelf.c:5187 readelf.c:5622 +msgid "version need" +msgstr "versionsbehov" + +#: readelf.c:5197 +msgid "version need aux (2)" +msgstr "ydre versionsbehov (2)" + +#: readelf.c:5238 readelf.c:5684 +msgid "version def" +msgstr "versionsdef." + +#: readelf.c:5257 readelf.c:5699 +msgid "version def aux" +msgstr "ydre versionsdef." + +#: readelf.c:5288 +msgid "" +"\n" +"No version information found in this file.\n" +msgstr "" +"\n" +"Der fandtes ingen versionsinformation i denne fil.\n" + +#: readelf.c:5420 +msgid "Unable to read in dynamic data\n" +msgstr "Kan ikke indlæse de dynamiske data\n" + +#: readelf.c:5462 +msgid "Unable to seek to start of dynamic information" +msgstr "Kan ikke søge til begyndelsen af den dynamiske information" + +#: readelf.c:5468 +msgid "Failed to read in number of buckets\n" +msgstr "Mislykkedes at indlæse antal spande\n" + +#: readelf.c:5474 +msgid "Failed to read in number of chains\n" +msgstr "Mislykkedes at indlæse antal kæder\n" + +#: readelf.c:5494 +msgid "" +"\n" +"Symbol table for image:\n" +msgstr "" +"\n" +"Symboltabel for filbilleder:\n" + +#: readelf.c:5496 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " Nr Spd: Værdi Strl Type Bind Synl Idx Navn\n" + +#: readelf.c:5498 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " Nr Spd: Værdi Strl Type Bind Synl Idx Navn\n" + +#: readelf.c:5543 +#, c-format +msgid "" +"\n" +"Symbol table '%s' contains %lu entries:\n" +msgstr "" +"\n" +"Symboltabel \"%s\" indeholder %lu poster:\n" + +#: readelf.c:5547 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " Nr: Værdi Strl Type Bind Synl Idx Navn\n" + +#: readelf.c:5549 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " Nr: Værdi Strl Type Bind Synl Idx Navn\n" + +#: readelf.c:5595 +msgid "version data" +msgstr "versionsdata" + +#: readelf.c:5635 +msgid "version need aux (3)" +msgstr "ydre versionsbehov (3)" + +#: readelf.c:5660 +msgid "bad dynamic symbol" +msgstr "fejlagtigt dynamisk symbol" + +#: readelf.c:5722 +msgid "" +"\n" +"Dynamic symbol information is not available for displaying symbols.\n" +msgstr "" +"\n" +"Informationen om dynamiske symboler er ikke tilgænglig til at vise symboler.\n" + +#: readelf.c:5734 +#, c-format +msgid "" +"\n" +"Histogram for bucket list length (total of %d buckets):\n" +msgstr "" +"\n" +"Histogram over spandenes listelængde (totalt %d spande):\n" + +#: readelf.c:5736 +#, c-format +msgid " Length Number %% of total Coverage\n" +msgstr " Længde Nummer %% af alle Dækning\n" + +#: readelf.c:5741 readelf.c:5760 readelf.c:9146 readelf.c:9338 +msgid "Out of memory" +msgstr "Slut på hukommelse" + +#: readelf.c:5809 +#, c-format +msgid "" +"\n" +"Dynamic info segment at offset 0x%lx contains %d entries:\n" +msgstr "" +"\n" +"Dynamisk info-segment på offset 0x%lx indeholder %d poster:\n" + +#: readelf.c:5812 +msgid " Num: Name BoundTo Flags\n" +msgstr " Nr: Navn Bind til Flag\n" + +#: readelf.c:5864 +#, c-format +msgid "" +"\n" +"Assembly dump of section %s\n" +msgstr "" +"\n" +"Disassembleringsudskrift af sektion %s\n" + +#: readelf.c:5887 +#, c-format +msgid "" +"\n" +"Section '%s' has no data to dump.\n" +msgstr "" +"\n" +"Sektion \"%s\" har ingen data at skrive ud.\n" + +#: readelf.c:5892 +#, c-format +msgid "" +"\n" +"Hex dump of section '%s':\n" +msgstr "" +"\n" +"Hex.udskrift af sektion \"%s\":\n" + +#: readelf.c:5897 +msgid "section data" +msgstr "sektionsdata" + +#: readelf.c:6046 +msgid "badly formed extended line op encountered!\n" +msgstr "fejlagtigt udformet udvidet linje-op mødtes!\n" + +#: readelf.c:6053 +#, c-format +msgid " Extended opcode %d: " +msgstr " Udvidet op-kode %d: " + +#: readelf.c:6058 +msgid "" +"End of Sequence\n" +"\n" +msgstr "" +"Slut på sekvensen\n" +"\n" + +#: readelf.c:6064 +#, c-format +msgid "set Address to 0x%lx\n" +msgstr "sæt Adresse til 0x%lx\n" + +#: readelf.c:6069 +msgid " define new File Table entry\n" +msgstr " definer ny filtabelspost\n" + +#: readelf.c:6070 readelf.c:6199 +msgid " Entry\tDir\tTime\tSize\tName\n" +msgstr " Post\tKatalog\tTid\tStrl.\tNavn\n" + +#: readelf.c:6072 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:6075 readelf.c:6077 readelf.c:6079 readelf.c:6211 readelf.c:6213 +#: readelf.c:6215 +#, c-format +msgid "%lu\t" +msgstr "%lu\t" + +#: readelf.c:6080 +#, c-format +msgid "" +"%s\n" +"\n" +msgstr "" +"%s\n" +"\n" + +#: readelf.c:6084 +#, c-format +msgid "UNKNOWN: length %d\n" +msgstr "UKENDT: længde %d\n" + +#: readelf.c:6110 +#, c-format +msgid "" +"\n" +"Dump of debug contents of section %s:\n" +"\n" +msgstr "" +"\n" +"Udskrift af fejlsøgningsindhold i sektion %s:\n" +"\n" + +#: readelf.c:6122 +msgid "64-bit DWARF line info is not supported yet.\n" +msgstr "64-bit DWARF-linjeinformation understøttes ikke endnu.\n" + +#: readelf.c:6129 +msgid "The line info appears to be corrupt - the section is too small\n" +msgstr "Linjeinformationen virker være i stykker - sektionen er for lille\n" + +#: readelf.c:6137 +msgid "Only DWARF version 2 line info is currently supported.\n" +msgstr "Kun DWARF version 2's linjeinfo understøttes i øjeblikket.\n" + +#: readelf.c:6152 +#, c-format +msgid " Length: %ld\n" +msgstr " Længde: %ld\n" + +#: readelf.c:6153 +#, c-format +msgid " DWARF Version: %d\n" +msgstr " DWARF version: %d\n" + +#: readelf.c:6154 +#, c-format +msgid " Prologue Length: %d\n" +msgstr " Prologlængde: %d\n" + +#: readelf.c:6155 +#, c-format +msgid " Minimum Instruction Length: %d\n" +msgstr " Min.-instruktionslængde: %d\n" + +# BUG: Ska det ikke være `' på engelsk? +#: readelf.c:6156 +#, c-format +msgid " Initial value of 'is_stmt': %d\n" +msgstr " initialværdi på \"is_stmt\": %d\n" + +#: readelf.c:6157 +#, c-format +msgid " Line Base: %d\n" +msgstr " linjebase: %d\n" + +#: readelf.c:6158 +#, c-format +msgid " Line Range: %d\n" +msgstr " linjeområde: %d\n" + +#: readelf.c:6159 +#, c-format +msgid " Opcode Base: %d\n" +msgstr " op-kodebase: %d\n" + +#: readelf.c:6168 +msgid "" +"\n" +" Opcodes:\n" +msgstr "" +"\n" +" Op-koder:\n" + +#: readelf.c:6171 +#, c-format +msgid " Opcode %d has %d args\n" +msgstr " Op-kode %d har %d argumenter\n" + +#: readelf.c:6177 +msgid "" +"\n" +" The Directory Table is empty.\n" +msgstr "" +"\n" +" Katalogtabellen er tom.\n" + +#: readelf.c:6180 +msgid "" +"\n" +" The Directory Table:\n" +msgstr "" +"\n" +" Katalogtabellen:\n" + +#: readelf.c:6184 +#, c-format +msgid " %s\n" +msgstr " %s\n" + +#: readelf.c:6195 +msgid "" +"\n" +" The File Name Table is empty.\n" +msgstr "" +"\n" +" Filnavnstabellen er tom.\n" + +#: readelf.c:6198 +msgid "" +"\n" +" The File Name Table:\n" +msgstr "" +"\n" +" Filnavnstabellen:\n" + +#: readelf.c:6206 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:6217 +#, c-format +msgid "%s\n" +msgstr "%s\n" + +#. Now display the statements. +#: readelf.c:6225 +msgid "" +"\n" +" Line Number Statements:\n" +msgstr "" +"\n" +" Linjenummersætninger:\n" + +#: readelf.c:6241 +#, c-format +msgid " Special opcode %d: advance Address by %d to 0x%lx" +msgstr " Særlig op-kode %d: øg adressen med %d til 0x%lx" + +#: readelf.c:6245 +#, c-format +msgid " and Line by %d to %d\n" +msgstr " og linjenumret med %d til %d\n" + +#: readelf.c:6256 +msgid " Copy\n" +msgstr " Kopiér\n" + +#: readelf.c:6263 +#, c-format +msgid " Advance PC by %d to %lx\n" +msgstr " Øg PC med %d til %lx\n" + +#: readelf.c:6271 +#, c-format +msgid " Advance Line by %d to %d\n" +msgstr " Øg linjenumret med %d til %d\n" + +#: readelf.c:6278 +#, c-format +msgid " Set File Name to entry %d in the File Name Table\n" +msgstr " Sæt filnavnet til post %d i filnavnstabellen\n" + +#: readelf.c:6286 +#, c-format +msgid " Set column to %d\n" +msgstr " Sæt kolonnen til %d\n" + +#: readelf.c:6293 +#, c-format +msgid " Set is_stmt to %d\n" +msgstr " Sæt is_stmt til %d\n" + +#: readelf.c:6298 +msgid " Set basic block\n" +msgstr " Sæt baseblokken\n" + +#: readelf.c:6306 +#, c-format +msgid " Advance PC by constant %d to 0x%lx\n" +msgstr " Øg PC med konstant %d til 0x%lx\n" + +#: readelf.c:6314 +#, c-format +msgid " Advance PC by fixed size amount %d to 0x%lx\n" +msgstr " Øg PC med fastlængdeantal %d til 0x%lx\n" + +#: readelf.c:6319 +msgid " Set prologue_end to true\n" +msgstr " Sæt prologue_end til sand\n" + +#: readelf.c:6323 +msgid " Set epilogue_begin to true\n" +msgstr " Sæt epilogue_begin til sand\n" + +#: readelf.c:6329 +#, c-format +msgid " Set ISA to %d\n" +msgstr " Sæt ISA til %d\n" + +#: readelf.c:6333 +#, c-format +msgid " Unknown opcode %d with operands: " +msgstr " Ukendt op-kode %d med operand: " + +#: readelf.c:6365 readelf.c:6827 readelf.c:6899 +#, c-format +msgid "" +"Contents of the %s section:\n" +"\n" +msgstr "" +"%s-sektionens indhold:\n" +"\n" + +#: readelf.c:6384 +msgid "64-bit DWARF pubnames are not supported yet.\n" +msgstr "64-bit DWARF-offentlige navne understøttes ikke endnu.\n" + +#: readelf.c:6394 +msgid "Only DWARF 2 pubnames are currently supported\n" +msgstr "Kun DWARF 2 pub.-navn understøttes i øjeblikket\n" + +#: readelf.c:6401 +#, c-format +msgid " Length: %ld\n" +msgstr " Længde: %ld\n" + +#: readelf.c:6403 +#, c-format +msgid " Version: %d\n" +msgstr " Version: %d\n" + +#: readelf.c:6405 +#, c-format +msgid " Offset into .debug_info section: %ld\n" +msgstr " Offset i .debug_info-sektionen: %ld\n" + +#: readelf.c:6407 +#, c-format +msgid " Size of area in .debug_info section: %ld\n" +msgstr " Strl. på omr. i .debug_info-sekt.: %ld\n" + +#: readelf.c:6410 +msgid "" +"\n" +" Offset\tName\n" +msgstr "" +"\n" +" Offset\tNavn\n" + +#: readelf.c:6501 +#, c-format +msgid "Unknown TAG value: %lx" +msgstr "Ukendt TAG-værdi: %lx" + +#: readelf.c:6612 +#, c-format +msgid "Unknown AT value: %lx" +msgstr "Ukendt AT-værdi: %lx" + +#: readelf.c:6649 +#, c-format +msgid "Unknown FORM value: %lx" +msgstr "Ukendt FORM-værdi: %lx" + +#: readelf.c:6848 +#, c-format +msgid " DW_MACINFO_start_file - lineno: %d filenum: %d\n" +msgstr " DW_MACINFO_start_file - linje: %d filnr: %d\n" + +#: readelf.c:6853 +msgid " DW_MACINFO_end_file\n" +msgstr " DW_MACINFO_end_file\n" + +#: readelf.c:6861 +#, c-format +msgid " DW_MACINFO_define - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_define - linje : %d makro : %s\n" + +#: readelf.c:6869 +#, c-format +msgid " DW_MACINFO_undef - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_undef - linje : %d makro : %s\n" + +#: readelf.c:6880 +#, c-format +msgid " DW_MACINFO_vendor_ext - constant : %d string : %s\n" +msgstr " DW_MACINFO_vendor_ext - konstant : %d streng : %s\n" + +#: readelf.c:6908 +msgid " Number TAG\n" +msgstr " Nummer TAG\n" + +#: readelf.c:6914 +#, c-format +msgid " %ld %s [%s]\n" +msgstr " %ld %s [%s]\n" + +#: readelf.c:6917 +msgid "has children" +msgstr "har børn" + +#: readelf.c:6917 +msgid "no children" +msgstr "ingen børn" + +#: readelf.c:6921 +#, c-format +msgid " %-18s %s\n" +msgstr " %-18s %s\n" + +#: readelf.c:6942 +#, c-format +msgid " %lu byte block: " +msgstr " %lu byte-blok: " + +#: readelf.c:7265 +msgid "(User defined location op)" +msgstr "(Brugerdefineret plads-op)" + +#: readelf.c:7267 +msgid "(Unknown location op)" +msgstr "(Ukendt plads-op)" + +#: readelf.c:7305 +msgid "debug_loc section data" +msgstr "debug_loc sektionsdata" + +#: readelf.c:7336 +msgid "" +"\n" +"The .debug_loc section is empty.\n" +msgstr "" +"\n" +".debug_loc-sektionen er tom.\n" + +#: readelf.c:7339 +msgid "" +"Contents of the .debug_loc section:\n" +"\n" +msgstr "" +"Indhold i .debug_loc-sektionen:\n" +"\n" + +#: readelf.c:7340 +msgid "" +"\n" +" Offset Begin End Expression\n" +msgstr "" + +#: readelf.c:7412 +msgid "debug_str section data" +msgstr "debug_str sektionsdata" + +#: readelf.c:7431 +msgid "" +msgstr "" + +#: readelf.c:7434 +msgid "" +msgstr "" + +#: readelf.c:7454 +msgid "" +"\n" +"The .debug_str section is empty.\n" +msgstr "" +"\n" +".debug_str-sektionen er tom.\n" + +#: readelf.c:7458 +msgid "" +"Contents of the .debug_str section:\n" +"\n" +msgstr "" +"Indhold i .debug_str-sektionen:\n" +"\n" + +#: readelf.c:7629 +#, c-format +msgid " (indirect string, offset: 0x%lx): " +msgstr " (indirekte streng, offset: 0x%lx): " + +#: readelf.c:7638 +#, c-format +msgid "Unrecognized form: %d\n" +msgstr "Ukendt formular: %d\n" + +#: readelf.c:7651 +msgid "(not inlined)" +msgstr "(ikke inlined)" + +#: readelf.c:7652 +msgid "(inlined)" +msgstr "(inlined)" + +#: readelf.c:7653 +msgid "(declared as inline but ignored)" +msgstr "(deklareret som inline, men ignoreret)" + +#: readelf.c:7654 +msgid "(declared as inline and inlined)" +msgstr "(deklareret som inline og inlined)" + +#: readelf.c:7655 +#, c-format +msgid " (Unknown inline attribute value: %lx)" +msgstr " (ukendt inlineattributværdi: %lx)" + +#: readelf.c:7826 readelf.c:8029 +#, c-format +msgid "" +"The section %s contains:\n" +"\n" +msgstr "" +"Sektion %s indeholder:\n" +"\n" + +#: readelf.c:7850 +msgid "64-bit DWARF debug info is not supported yet.\n" +msgstr "64-bit DWARF-fejlsøgningsinfo understøttes ikke endnu.\n" + +#: readelf.c:7919 +#, c-format +msgid " Compilation Unit @ %lx:\n" +msgstr " Oversættelsesenhed @ %lx:\n" + +#: readelf.c:7920 +#, c-format +msgid " Length: %ld\n" +msgstr " Længde: %ld\n" + +#: readelf.c:7921 +#, c-format +msgid " Version: %d\n" +msgstr " Version: %d\n" + +#: readelf.c:7922 +#, c-format +msgid " Abbrev Offset: %ld\n" +msgstr " Fork.-offset: %ld\n" + +#: readelf.c:7923 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " Pegerstørrelse: %d\n" + +#: readelf.c:7927 +msgid "Only version 2 DWARF debug information is currently supported.\n" +msgstr "Kun version 2 af DWARF fejlsøgningsinformation understøttes i øjeblikket.\n" + +#: readelf.c:7948 +msgid "Unable to locate .debug_abbrev section!\n" +msgstr "Kan ikke finde nogen .debug_abbrev-sektion!\n" + +#: readelf.c:7954 +msgid "debug_abbrev section data" +msgstr "debug_abbrev sektionsdata" + +#: readelf.c:7991 +#, c-format +msgid "Unable to locate entry %lu in the abbreviation table\n" +msgstr "Kan ikke finde post %lu i forkortelsestabellen\n" + +#: readelf.c:7996 +#, c-format +msgid " <%d><%lx>: Abbrev Number: %lu (%s)\n" +msgstr " <%d><%lx>: Fork.-nummer: %lu (%s)\n" + +#: readelf.c:8050 +msgid "64-bit DWARF aranges are not supported yet.\n" +msgstr "64-bit DWARF-a-intervaller understøttes ikke endnu.\n" + +#: readelf.c:8056 +msgid "Only DWARF 2 aranges are currently supported.\n" +msgstr "Kun DWARF2's a-intervaller understøttes i øjeblikket.\n" + +#: readelf.c:8060 +#, c-format +msgid " Length: %ld\n" +msgstr " Længde: %ld\n" + +#: readelf.c:8061 +#, c-format +msgid " Version: %d\n" +msgstr " Version: %d\n" + +#: readelf.c:8062 +#, c-format +msgid " Offset into .debug_info: %lx\n" +msgstr " Offset i .debug_info: %lx\n" + +#: readelf.c:8063 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " Pegerstørrelse: %d\n" + +#: readelf.c:8064 +#, c-format +msgid " Segment Size: %d\n" +msgstr " Segmentstørrelse: %d\n" + +#: readelf.c:8066 +msgid "" +"\n" +" Address Length\n" +msgstr "" +"\n" +" Adresselængde\n" + +#: readelf.c:8248 +#, c-format +msgid "The section %s contains:\n" +msgstr "Sektion %s indeholder:\n" + +#: readelf.c:8271 +msgid "64-bit DWARF format frames are not supported yet.\n" +msgstr "64-bit DWARF-formatskabeloner understøttes ikke endnu.\n" + +#: readelf.c:8820 +#, c-format +msgid "Displaying the debug contents of section %s is not yet supported.\n" +msgstr "Visning af fejlsøgningsindeholdet i sektion %s understøttes ikke endnu.\n" + +#: readelf.c:8886 +#, c-format +msgid "" +"\n" +"Section '%s' has no debugging data.\n" +msgstr "" +"\n" +"Sektion \"%s\" indeholder ingen fejlsøgningsdata.\n" + +#: readelf.c:8891 readelf.c:8953 +msgid "debug section data" +msgstr "fejlsøgningssektionsdata" + +#: readelf.c:8907 +#, c-format +msgid "Unrecognized debug section: %s\n" +msgstr "Ukendt fejlsøgningssektion: %s\n" + +#: readelf.c:8981 +msgid "Some sections were not dumped because they do not exist!\n" +msgstr "Nogen sektioner blev ikke skrevet ud da de ikke eksisterer!\n" + +#: readelf.c:9054 readelf.c:9418 +msgid "liblist" +msgstr "biblioteksliste" + +#: readelf.c:9139 +msgid "options" +msgstr "flag" + +#: readelf.c:9170 +#, c-format +msgid "" +"\n" +"Section '%s' contains %d entries:\n" +msgstr "" +"\n" +"Sektion \"%s\" indeholder %d poster:\n" + +# BUGG: Fejl i originalet? +#: readelf.c:9331 +#, fuzzy +msgid "conflict list found without a dynamic symbol table" +msgstr "konfliktliste uden tabel" + +#: readelf.c:9349 readelf.c:9365 +msgid "conflict" +msgstr "konflikt" + +#: readelf.c:9375 +#, c-format +msgid "" +"\n" +"Section '.conflict' contains %ld entries:\n" +msgstr "" +"\n" +"Sektion \".conflict\" indeholder %ld poster:\n" + +#: readelf.c:9377 +msgid " Num: Index Value Name" +msgstr " Num: Indeks Værdi Navn" + +#: readelf.c:9426 +#, fuzzy +msgid "liblist string table" +msgstr "strengtabel" + +#: readelf.c:9435 +#, fuzzy, c-format +msgid "" +"\n" +"Library list section '%s' contains %lu entries:\n" +msgstr "" +"\n" +"Versionbehovssektion \"%s\" indeholder %ld poster:\n" + +#: readelf.c:9484 +msgid "NT_PRSTATUS (prstatus structure)" +msgstr "NT_PRSTATUS (prstatus-struktur)" + +#: readelf.c:9485 +msgid "NT_FPREGSET (floating point registers)" +msgstr "NT_FPREGSET (flydendetalsregister)" + +#: readelf.c:9486 +msgid "NT_PRPSINFO (prpsinfo structure)" +msgstr "NT_PRPSINFO (prpsinfo-struktur)" + +#: readelf.c:9487 +msgid "NT_TASKSTRUCT (task structure)" +msgstr "NT_TASKSTRUCT (task-struktur)" + +#: readelf.c:9488 +msgid "NT_PRXFPREG (user_xfpregs structure)" +msgstr "NT_PRXFPREG (user_xfpregs-struktur)" + +#: readelf.c:9489 +msgid "NT_PSTATUS (pstatus structure)" +msgstr "NT_PSTATUS (pstatus-struktur)" + +#: readelf.c:9490 +msgid "NT_FPREGS (floating point registers)" +msgstr "NT_FPREGS (flydendetalsregister)" + +#: readelf.c:9491 +msgid "NT_PSINFO (psinfo structure)" +msgstr "NT_PSINFO (psinfo-struktur)" + +#: readelf.c:9492 +msgid "NT_LWPSTATUS (lwpstatus_t structure)" +msgstr "NT_LWPSTATUS (lwpstatus_t-struktur)" + +#: readelf.c:9493 +msgid "NT_LWPSINFO (lwpsinfo_t structure)" +msgstr "NT_LWPSINFO (lwpsinfo_t-struktur)" + +# BUG: Stavfejl i originalet (str>uc Set the binary file format\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" + +#: size.c:160 +#, c-format +msgid "invalid argument to --format: %s" +msgstr "ugyldigt argument til --format: %s" + +#: size.c:187 +#, c-format +msgid "Invalid radix: %s\n" +msgstr "Ugyldig talbase: %s\n" + +#: srconv.c:1953 +#, fuzzy +msgid "Convert a COFF object file into a SYSROFF object file\n" +msgstr "%s: Konverterer en COFF-objektfil til en SYSROFF-objektfil\n" + +#: srconv.c:1954 +msgid "" +" The options are:\n" +" -q --quick (Obsolete - ignoerd)\n" +" -n --noprescan Do not perform a scan to convert commons into defs\n" +" -d --debug Display information about what is being done\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" + +#: srconv.c:2099 +#, c-format +msgid "unable to open output file %s" +msgstr "kan ikke åbne uddatafil %s" + +#: stabs.c:343 stabs.c:1759 +msgid "numeric overflow" +msgstr "numerisk overløb" + +# FIXME +#: stabs.c:354 +#, c-format +msgid "Bad stab: %s\n" +msgstr "Fejlagtig stab: %s\n" + +#: stabs.c:364 +#, c-format +msgid "Warning: %s: %s\n" +msgstr "Advarsel: %s: %s\n" + +#: stabs.c:485 +msgid "N_LBRAC not within function\n" +msgstr "N_LBRAC ikke inde i funktion\n" + +#: stabs.c:524 +msgid "Too many N_RBRACs\n" +msgstr "For mange N_RBRAC's\n" + +#: stabs.c:769 +msgid "unknown C++ encoded name" +msgstr "ukendt C++-kodet navn" + +#. Complain and keep going, so compilers can invent new +#. cross-reference types. +#: stabs.c:1296 +msgid "unrecognized cross reference type" +msgstr "ukendt krydsreferencetype" + +#. Does this actually ever happen? Is that why we are worrying +#. about dealing with it rather than just calling error_type? +#: stabs.c:1851 +msgid "missing index type" +msgstr "manglende indekstype" + +#: stabs.c:2178 +msgid "unknown virtual character for baseclass" +msgstr "ukendt virtuelt tegn for baseklasse" + +# FIXME +#: stabs.c:2196 +msgid "unknown visibility character for baseclass" +msgstr "ukendt synlighedskarakter for baseklasse" + +#: stabs.c:2388 +msgid "unnamed $vb type" +msgstr "$vb-type uden navn" + +#: stabs.c:2394 +msgid "unrecognized C++ abbreviation" +msgstr "ukendt C++-forkortelse" + +# FIXME +#: stabs.c:2474 +msgid "unknown visibility character for field" +msgstr "ukendt synlighedskarakter for felt" + +#: stabs.c:2730 +msgid "const/volatile indicator missing" +msgstr "const/volatile-indikator mangler" + +#: stabs.c:2970 +#, c-format +msgid "No mangling for \"%s\"\n" +msgstr "Ingen kodning af \"%s\"\n" + +#: stabs.c:3283 +msgid "Undefined N_EXCL" +msgstr "Udefineret N_EXCL" + +#: stabs.c:3371 +#, c-format +msgid "Type file number %d out of range\n" +msgstr "Typens filnummer %d uden for sit interval\n" + +#: stabs.c:3376 +#, c-format +msgid "Type index number %d out of range\n" +msgstr "Typens indeksnummer %d uden for sit interval\n" + +#: stabs.c:3463 +#, c-format +msgid "Unrecognized XCOFF type %d\n" +msgstr "Ukendt XCOFF-type %d\n" + +#: stabs.c:3762 +#, c-format +msgid "bad mangled name `%s'\n" +msgstr "fejlagtigt kodet navn \"%s\"\n" + +#: stabs.c:3858 +msgid "no argument types in mangled string\n" +msgstr "ingen argumenttype i kodet streng\n" + +#: strings.c:200 +#, c-format +msgid "invalid number %s" +msgstr "ugyldigt tal %s" + +#: strings.c:640 +#, c-format +msgid "invalid integer argument %s" +msgstr "ugyldigt heltalsargument %s" + +#: strings.c:651 +msgid " Display printable strings in [file(s)] (stdin by default)\n" +msgstr "" + +#: strings.c:652 +msgid "" +" The options are:\n" +" -a - --all Scan the entire file, not just the data section\n" +" -f --print-file-name Print the name of the file before each string\n" +" -n --bytes=[number] Locate & print any NUL-terminated sequence of at\n" +" - least [number] characters (default 4).\n" +" -t --radix={o,x,d} Print the location of the string in base 8, 10 or 16\n" +" -o An alias for --radix=o\n" +" -T --target= Specify the binary file format\n" +" -e --encoding={s,b,l,B,L} Select character size and endianness:\n" +" s = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" + +#: sysdump.c:768 +#, fuzzy +msgid "Print a human readable interpretation of a SYSROFF object file\n" +msgstr "%s: Skriv en menneskeligt læsbar tolkning af en SYSROFF-objektfil\n" + +#: sysdump.c:769 +msgid "" +" The options are:\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" + +#: sysdump.c:836 +#, c-format +msgid "cannot open input file %s" +msgstr "kan ikke åbne inddatafil %s" + +#: version.c:35 +msgid "Copyright 2002 Free Software Foundation, Inc.\n" +msgstr "Copyright 2002 Free Software Foundation, Inc.\n" + +#: version.c:36 +msgid "" +"This program is free software; you may redistribute it under the terms of\n" +"the GNU General Public License. This program has absolutely no warranty.\n" +msgstr "" +"Dette program er frit programmel; du kan distribuere det videre under betingelserne\n" +"i GNU General Public License. Dette program har ingen som helst garantier.\n" + +#: windres.c:239 +#, c-format +msgid "can't open %s `%s': %s" +msgstr "kan ikke åbne %s \"%s\": %s" + +#: windres.c:418 +msgid ": expected to be a directory\n" +msgstr ": forventedes at være et katalog\n" + +#: windres.c:430 +msgid ": expected to be a leaf\n" +msgstr ": forventedes at være et blad\n" + +#: windres.c:439 +#, c-format +msgid "%s: warning: " +msgstr "%s: advarsel: " + +#: windres.c:441 +msgid ": duplicate value\n" +msgstr ": dublet af værdi\n" + +#: windres.c:602 +#, c-format +msgid "unknown format type `%s'" +msgstr "ukendt formattype \"%s\"" + +#: windres.c:603 +#, c-format +msgid "%s: supported formats:" +msgstr "%s: formater som håndteres:" + +#. Otherwise, we give up. +#: windres.c:688 +#, c-format +msgid "can not determine type of file `%s'; use the -I option" +msgstr "kan ikke bestemme \"%s\"'s filtype; brug flag -I" + +#: windres.c:702 +#, fuzzy, c-format +msgid "Usage: %s [option(s)] [input-file] [output-file]\n" +msgstr "Brug: %s [flag] [in-fil] [ud-fil]\n" + +#: windres.c:704 +#, fuzzy +msgid "" +" The options are:\n" +" -i --input= Name input file\n" +" -o --output= Name output file\n" +" -I --input-format= Specify input format\n" +" -O --output-format= Specify output format\n" +" -F --target= Specify COFF target\n" +" --preprocessor= Program to use to preprocess rc file\n" +" --include-dir= Include directory when preprocessing rc file\n" +" -D --define [=] Define SYM when preprocessing rc file\n" +" -v --verbose Verbose - tells you what it's doing\n" +" --language= Set language when reading rc file\n" +" --use-temp-file Use a temporary file instead of popen to read\n" +" the preprocessor output\n" +" --no-use-temp-file Use popen (default)\n" +msgstr "" +"Flag:\n" +" -i FIL, --input FIL Navngiv inddatafilen\n" +" -o FIL, --output FIL Navngiv uddatafilen\n" +" -I FORMAT, --input-format FORMAT\n" +" Specificér inddataformatet\n" +" -O FORMAT, --output-format FORMAT\n" +" Specificér uddataformatet\n" +" -F MÅL, --target MÅL Specificér COFF-målet\n" +" --preprocessor PROGRAM Program at bruge som præprocessor på rc-filen\n" +" --include-dir KATALOG Inkludér katalog når rc-filen præprocesses\n" +" -DSYM[=VÆRDI], --define SYM[=VÆRDI]\n" +" Definér SYM når rc-filen præprocesses\n" +" -v Udførlig - beretter vad den gør\n" +" --language SPROG Sæt sproget når rc-filen læses\n" +" --use-temp-file Brug en tem.fil i stedet for popen ved læsning\n" +" af uddata fra præprocessoren\n" +" --no-use-temp-file Brug popen (standard)\n" + +#: windres.c:719 +msgid " --yydebug Turn on parser debugging\n" +msgstr " --yydebug Aktivér tolkens fejlsøgning\n" + +#: windres.c:722 +msgid "" +" -h --help Print this help message\n" +" -V --version Print version information\n" +msgstr "" +" -h --help Vis denne hjælpetekst\n" +" -V --version Vis versionsinformation\n" + +#: windres.c:725 +msgid "" +"FORMAT is one of rc, res, or coff, and is deduced from the file name\n" +"extension if not specified. A single file name is an input file.\n" +"No input-file is stdin, default rc. No output-file is stdout, default rc.\n" +msgstr "" +"FORMAT er én af rc, res eller coff, og afledes fra filnavnsendelsen\n" +"hvis det ikke specificeres. Et enkelt filnavn er en inddatafil. Ingen\n" +"inddatafil betyder standard-ind, med format rc. Ingen uddatafil betyder\n" +"standard-ud, med format rc.\n" + +#: windres.c:988 +msgid "no resources" +msgstr "ingen resurser" + +#: wrstabs.c:366 wrstabs.c:2026 +#, c-format +msgid "string_hash_lookup failed: %s" +msgstr "string_hash_lookup mislykkedes: %s" + +#: wrstabs.c:666 +#, c-format +msgid "stab_int_type: bad size %u" +msgstr "stab_int_type: fejlagtig størrelse %u" + +#: wrstabs.c:1466 +#, c-format +msgid "%s: warning: unknown size for field `%s' in struct" +msgstr "%s: advarsel: ukendt størrelsen på felt \"%s\" i strukturen" diff --git a/binutils/po/es.gmo b/binutils/po/es.gmo new file mode 100644 index 0000000000000..622e305344f83 Binary files /dev/null and b/binutils/po/es.gmo differ diff --git a/binutils/po/es.po b/binutils/po/es.po new file mode 100644 index 0000000000000..bdc03cba8a675 --- /dev/null +++ b/binutils/po/es.po @@ -0,0 +1,5176 @@ +# Mensajes en español para binutils 2.14rel030712. +# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Cristian Othón Martínez Vera , 2002, 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: binutils 2.14rel030712\n" +"POT-Creation-Date: 2003-07-11 13:56+0930\n" +"PO-Revision-Date: 2003-07-14 18:41-0500\n" +"Last-Translator: Cristian Othón Martínez Vera \n" +"Language-Team: Spanish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: addr2line.c:74 +#, c-format +msgid "Usage: %s [option(s)] [addr(s)]\n" +msgstr "Modo de empleo: %s [opcion(es)] [direccion(es)]\n" + +#: addr2line.c:75 +msgid " Convert addresses into line number/file name pairs.\n" +msgstr " Convierte direcciones en pares de nombre número/fila.\n" + +#: addr2line.c:76 +msgid " If no addresses are specified on the command line, they will be read from stdin\n" +msgstr " Si no se especifican direcciones en la línea de órdenes, se leerán de la entrada estándar\n" + +#: addr2line.c:77 +msgid "" +" The options are:\n" +" -b --target= Set the binary file format\n" +" -e --exe= Set the input file name (default is a.out)\n" +" -s --basenames Strip directory names\n" +" -f --functions Show function names\n" +" -C --demangle[=style] Demangle function names\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +" Las opciones son:\n" +" -b --target= Establece el formato del fichero binario\n" +" -e --exe= Establece el nombre del fichero de entrada\n" +" (por omisión es a.out)\n" +" -s --basenames Elimina los nombres de directorio\n" +" -f --functions Muestra los nombres de función\n" +" -C --demangle[=estilo] Desenreda los nombres de función\n" +" -h --help Muestra esta información\n" +" -v --version Muestra la versión del programa\n" +"\n" + +#: addr2line.c:89 ar.c:297 coffdump.c:479 nlmconv.c:1121 objcopy.c:484 +#: objcopy.c:518 readelf.c:2649 size.c:104 srconv.c:1962 strings.c:673 +#: sysdump.c:774 windres.c:702 +#, c-format +msgid "Report bugs to %s\n" +msgstr "Reportar bichos a %s\n" + +#: addr2line.c:245 +#, c-format +msgid "%s: can not get addresses from archive" +msgstr "%s: no se pueden obtener las direcciones del archivo" + +#: addr2line.c:317 nm.c:433 objdump.c:2693 +#, c-format +msgid "unknown demangling style `%s'" +msgstr "estilo de desenredo `%s' desconocido" + +#: ar.c:238 +#, c-format +msgid "no entry %s in archive\n" +msgstr "no existe la entrada %s en el archivo\n" + +#: ar.c:255 +#, c-format +msgid "Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n" +msgstr "Modo de empleo: %s [opciones emulación] [-]{dmpqrstx}[abcfilNoPsSuvV] [nombre-miembro] [cuenta] fichero-archivo fichero...\n" + +#: ar.c:258 +#, c-format +msgid " %s -M []\n" + +#: ar.c:259 +msgid " commands:\n" +msgstr " órdenes:\n" + +#: ar.c:260 +msgid " d - delete file(s) from the archive\n" +msgstr " d - borra fichero(s) del archivo\n" + +#: ar.c:261 +msgid " m[ab] - move file(s) in the archive\n" +msgstr " m[ab] - mueve fichero(s) en el archivo\n" + +#: ar.c:262 +msgid " p - print file(s) found in the archive\n" +msgstr " p - muestra fichero(s) encontrados en el archivo\n" + +#: ar.c:263 +msgid " q[f] - quick append file(s) to the archive\n" +msgstr " q[f] - agrega rápidamente fichero(s) al archivo\n" + +#: ar.c:264 +msgid " r[ab][f][u] - replace existing or insert new file(s) into the archive\n" +msgstr " r[ab][f][u] - reemplaza fichero(s) existente(s) o inserta fichero(s) nuevo(s) en el archivo\n" + +#: ar.c:265 +msgid " t - display contents of archive\n" +msgstr " t - muestra los contenidos del archivo\n" + +#: ar.c:266 +msgid " x[o] - extract file(s) from the archive\n" +msgstr " x[o] - extrae fichero(s) del archivo\n" + +#: ar.c:267 +msgid " command specific modifiers:\n" +msgstr " modificadores específicos de la orden:\n" + +#: ar.c:268 +msgid " [a] - put file(s) after [member-name]\n" +msgstr " [a] - coloca fichero(s) despúes de [nombre-miembro]\n" + +#: ar.c:269 +msgid " [b] - put file(s) before [member-name] (same as [i])\n" +msgstr " [b] - coloca fichero(s) antes de [nombre-miembro] (igual que [i])\n" + +#: ar.c:270 +msgid " [N] - use instance [count] of name\n" +msgstr " [N] - usa la instancia [cuenta] del nombre\n" + +#: ar.c:271 +msgid " [f] - truncate inserted file names\n" +msgstr " [f] - trunca los nombres de fichero insertados\n" + +#: ar.c:272 +msgid " [P] - use full path names when matching\n" +msgstr " [P] - utiliza nombres completos de ruta cuando se buscan coincidencias\n" + +#: ar.c:273 +msgid " [o] - preserve original dates\n" +msgstr " [o] - conserva las fechas originales\n" + +#: ar.c:274 +msgid " [u] - only replace files that are newer than current archive contents\n" +msgstr " [u] - sólo reemplaza ficheros que sean más nuevos que el contenido actual del archivo\n" + +#: ar.c:275 +msgid " generic modifiers:\n" +msgstr " modificadores genéricos:\n" + +#: ar.c:276 +msgid " [c] - do not warn if the library had to be created\n" +msgstr " [c] - no avisa si se tiene que crear la biblioteca\n" + +#: ar.c:277 +msgid " [s] - create an archive index (cf. ranlib)\n" +msgstr " [s] - crea un índice del archivo (cf. ranlib)\n" + +#: ar.c:278 +msgid " [S] - do not build a symbol table\n" +msgstr " [S] - no construye una tabla de símbolos\n" + +#: ar.c:279 +msgid " [v] - be verbose\n" +msgstr " [v] - detallado\n" + +#: ar.c:280 +msgid " [V] - display the version number\n" +msgstr " [V] - muestra el número de versión\n" + +#: ar.c:287 +#, c-format +msgid "Usage: %s [options] archive\n" +msgstr "Modo de empleo: %s [opciones] archivo\n" + +#: ar.c:288 +msgid " Generate an index to speed access to archives\n" +msgstr " Generar un índice para acelerar el acceso a los archivos\n" + +#: ar.c:289 +msgid "" +" The options are:\n" +" -h --help Print this help message\n" +" -V --version Print version information\n" +msgstr "" +" Las opciones son:\n" +" -h --help Muestra este mensaje de ayuda\n" +" -V --version Muestra la información de versión\n" + +#: ar.c:512 +msgid "two different operation options specified" +msgstr "se especificaron dos opciones de operación diferentes" + +#: ar.c:587 +#, c-format +msgid "illegal option -- %c" +msgstr "opción ilegal -- %c" + +#: ar.c:619 +msgid "no operation specified" +msgstr "no se especificó una operación" + +#: ar.c:622 +msgid "`u' is only meaningful with the `r' option." +msgstr "`u' sólo tiene significado con la opción `r'." + +#: ar.c:632 +msgid "`N' is only meaningful with the `x' and `d' options." +msgstr "`N' sólo tiene significado con las opciones `x' y `d'." + +#: ar.c:635 +msgid "Value for `N' must be positive." +msgstr "El valor para `N' debe ser positivo." + +#: ar.c:718 +#, c-format +msgid "internal error -- this option not implemented" +msgstr "error interno -- esta opción no está implementada" + +#: ar.c:837 ar.c:888 ar.c:1333 objcopy.c:1579 +#, c-format +msgid "internal stat error on %s" +msgstr "error interno de stat en %s" + +#: ar.c:841 +#, c-format +msgid "" +"\n" +"\n" +"\n" +msgstr "" +"\n" +"\n" +"\n" + +#: ar.c:857 ar.c:925 +#, c-format +msgid "%s is not a valid archive" +msgstr "%s no es un archivo válido" + +#: ar.c:893 +#, c-format +msgid "stat returns negative size for %s" +msgstr "stat devuelve un valor negativo para %s" + +#: ar.c:1020 +#, c-format +msgid "%s is not an archive" +msgstr "%s no es un archivo" + +#: ar.c:1027 +#, c-format +msgid "creating %s" +msgstr "creando %s" + +#: ar.c:1233 +#, c-format +msgid "No member named `%s'\n" +msgstr "No hay un miembro llamado `%s'\n" + +#: ar.c:1285 +#, c-format +msgid "no entry %s in archive %s!" +msgstr "¡no hay una entrada %s en el archivo %s!" + +#: ar.c:1422 +#, c-format +msgid "%s: no archive map to update" +msgstr "%s: no hay un mapa de archivo para actualizar" + +#: arsup.c:86 +#, c-format +msgid "No entry %s in archive.\n" +msgstr "No hay una entrada %s en el archivo.\n" + +#: arsup.c:117 +#, c-format +msgid "Can't open file %s\n" +msgstr "No se puede abrir el fichero %s\n" + +#: arsup.c:172 +#, c-format +msgid "%s: Can't open output archive %s\n" +msgstr "%s: No se puede abrir el fichero de salida %s\n" + +#: arsup.c:189 +#, c-format +msgid "%s: Can't open input archive %s\n" +msgstr "%s: No se puede abrir el fichero de entrada %s\n" + +#: arsup.c:198 +#, c-format +msgid "%s: file %s is not an archive\n" +msgstr "%s: el fichero %s no es un archivo\n" + +#: arsup.c:241 +#, c-format +msgid "%s: no output archive specified yet\n" +msgstr "%s: no se ha especificado aún un archivo de salida\n" + +#: arsup.c:262 arsup.c:301 arsup.c:343 arsup.c:364 arsup.c:430 +#, c-format +msgid "%s: no open output archive\n" +msgstr "%s: no hay un archivo de salida abierto\n" + +#: arsup.c:273 arsup.c:385 arsup.c:411 +#, c-format +msgid "%s: can't open file %s\n" +msgstr "%s: no se puede abrir el fichero %s\n" + +#: arsup.c:328 arsup.c:407 arsup.c:489 +#, c-format +msgid "%s: can't find module file %s\n" +msgstr "%s: no se puede encontrar el fichero de módulo %s\n" + +#: arsup.c:439 +#, c-format +msgid "Current open archive is %s\n" +msgstr "El archivo actualmente abierto es %s\n" + +#: arsup.c:464 +#, c-format +msgid "%s: no open archive\n" +msgstr "%s: no hay un archivo abierto\n" + +#: binemul.c:39 +#, c-format +msgid " No emulation specific options\n" +msgstr " No hay opciones específicas de la emulación\n" + +#. Macros for common output. +#: binemul.h:52 +#, c-format +msgid " emulation options: \n" +msgstr " opciones de emulación:\n" + +#: bucomm.c:113 +#, c-format +msgid "can't set BFD default target to `%s': %s" +msgstr "no se puede establecer el objetivo BFD por omisión a `%s': %s" + +#: bucomm.c:125 +#, c-format +msgid "%s: Matching formats:" +msgstr "%s: Formatos coincidentes:" + +#: bucomm.c:142 +msgid "Supported targets:" +msgstr "Objetivos con soporte:" + +#: bucomm.c:144 +#, c-format +msgid "%s: supported targets:" +msgstr "%s: objetivos con soporte:" + +#: bucomm.c:162 +msgid "Supported architectures:" +msgstr "Arquitecturas con soporte:" + +#: bucomm.c:164 +#, c-format +msgid "%s: supported architectures:" +msgstr "%s: arquitecturas con soporte:" + +#: bucomm.c:360 +#, c-format +msgid "BFD header file version %s\n" +msgstr "encabezado del fichero BFD versión %s\n" + +#: bucomm.c:467 +#, c-format +msgid "%s: bad number: %s" +msgstr "%s: número erróneo: %s" + +#: coffdump.c:107 +#, c-format +msgid "#lines %d " +msgstr "#líneas %d " + +#: coffdump.c:471 sysdump.c:767 +#, c-format +msgid "Usage: %s [option(s)] in-file\n" +msgstr "Modo de empleo: %s [opcion(es)] fichero-entrada\n" + +#: coffdump.c:472 +msgid " Print a human readable interpretation of a SYSROFF object file\n" +msgstr " Muestra una interpretación legible por humanos de un fichero objeto SYSROFF\n" + +#: coffdump.c:473 +msgid "" +" The options are:\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +" Las opciones son:\n" +" -h --help Muestra esta información\n" +" -v --version Muestra la versión del programa\n" +"\n" + +#: coffdump.c:541 srconv.c:2052 sysdump.c:831 +msgid "no input file specified" +msgstr "no se especificó un fichero de entrada" + +#: debug.c:654 +msgid "debug_add_to_current_namespace: no current file" +msgstr "debug_add_to_current_namespace: no hay un fichero actual" + +#: debug.c:737 +msgid "debug_start_source: no debug_set_filename call" +msgstr "debug_start_source: no hay una llamada debug_set_filename" + +#: debug.c:796 +msgid "debug_record_function: no debug_set_filename call" +msgstr "debug_record_function: no hay una llamada debug_set_filename" + +#: debug.c:852 +msgid "debug_record_parameter: no current function" +msgstr "debug_record_parameter: no hay una función actual" + +#: debug.c:886 +msgid "debug_end_function: no current function" +msgstr "debug_end_function: no hay una función actual" + +#: debug.c:892 +msgid "debug_end_function: some blocks were not closed" +msgstr "debug_end_function: algunos bloques no fueron cerrados" + +#: debug.c:922 +msgid "debug_start_block: no current block" +msgstr "debug_start_block: no hay un bloque actual" + +#: debug.c:960 +msgid "debug_end_block: no current block" +msgstr "debug_end_block: no hay un bloque actual" + +#: debug.c:967 +msgid "debug_end_block: attempt to close top level block" +msgstr "debug_end_block: intento de cerrar el bloque del nivel principal" + +#: debug.c:993 +msgid "debug_record_line: no current unit" +msgstr "debug_record_line: no hay una unidad actual" + +#. FIXME +#: debug.c:1047 +msgid "debug_start_common_block: not implemented" +msgstr "debug_start_common_block: no está implementado" + +#. FIXME +#: debug.c:1059 +msgid "debug_end_common_block: not implemented" +msgstr "debug_end_common_block: no está implementado" + +#. FIXME. +#: debug.c:1153 +msgid "debug_record_label: not implemented" +msgstr "debug_record_label: no está implementado" + +#: debug.c:1179 +msgid "debug_record_variable: no current file" +msgstr "debug_record_variable: no hay un fichero actual" + +#: debug.c:1762 +msgid "debug_make_undefined_type: unsupported kind" +msgstr "debug_make_undefined_type: género sin soporte" + +#: debug.c:1963 +msgid "debug_name_type: no current file" +msgstr "debug_name_type: no hay fichero actual" + +#: debug.c:2011 +msgid "debug_tag_type: no current file" +msgstr "debug_tag_type: no hay fichero actual" + +#: debug.c:2019 +msgid "debug_tag_type: extra tag attempted" +msgstr "debug_tag_type: se intentó una marca extra" + +#: debug.c:2058 +#, c-format +msgid "Warning: changing type size from %d to %d\n" +msgstr "Aviso: cambiando el tamaño del tipo de %d a %d\n" + +#: debug.c:2082 +msgid "debug_find_named_type: no current compilation unit" +msgstr "debug_find_named_type: no hay una unidad de compilación actual" + +#: debug.c:2189 +#, c-format +msgid "debug_get_real_type: circular debug information for %s\n" +msgstr "debug_get_real_type: información de depuración circular para %s\n" + +#: debug.c:2650 +msgid "debug_write_type: illegal type encountered" +msgstr "debug_write_type: se encontró un tipo ilegal" + +#: dlltool.c:812 dlltool.c:837 dlltool.c:863 +#, c-format +msgid "Internal error: Unknown machine type: %d" +msgstr "Error interno: Tipo de máquina desconocido: %d" + +#: dlltool.c:900 +#, c-format +msgid "Can't open def file: %s" +msgstr "No se puede abrir el fichero def: %s" + +#: dlltool.c:905 +#, c-format +msgid "Processing def file: %s" +msgstr "Procesando el fichero def: %s" + +#: dlltool.c:909 +msgid "Processed def file" +msgstr "Fichero def procesado" + +#: dlltool.c:935 +#, c-format +msgid "Syntax error in def file %s:%d" +msgstr "Error sintáctico en el fichero def %s:%d" + +#: dlltool.c:974 +#, c-format +msgid "NAME: %s base: %x" +msgstr "NOMBRE: %s base: %x" + +#: dlltool.c:977 dlltool.c:996 +msgid "Can't have LIBRARY and NAME" +msgstr "No se puede tener BIBLIOTECA y NOMBRE" + +#: dlltool.c:993 +#, c-format +msgid "LIBRARY: %s base: %x" +msgstr "BIBLIOTECA: %s base %x" + +#: dlltool.c:1251 resrc.c:271 +#, c-format +msgid "wait: %s" +msgstr "espera: %s" + +#: dlltool.c:1256 dllwrap.c:430 resrc.c:276 +#, c-format +msgid "subprocess got fatal signal %d" +msgstr "el subproceso recibió la señal fatal %d" + +#: dlltool.c:1262 dllwrap.c:437 resrc.c:283 +#, c-format +msgid "%s exited with status %d" +msgstr "%s terminó con estado %d" + +#: dlltool.c:1294 +#, c-format +msgid "Sucking in info from %s section in %s" +msgstr "Succionando la información de la sección %s en %s" + +#: dlltool.c:1423 +#, c-format +msgid "Excluding symbol: %s" +msgstr "Excluyendo el símbolo: %s" + +#: dlltool.c:1518 dlltool.c:1529 nm.c:1004 nm.c:1015 +#, c-format +msgid "%s: no symbols" +msgstr "%s: no hay símbolos" + +#. FIXME: we ought to read in and block out the base relocations. +#: dlltool.c:1556 +#, c-format +msgid "Done reading %s" +msgstr "%s leído" + +#: dlltool.c:1567 +#, c-format +msgid "Unable to open object file: %s" +msgstr "No se puede abrir el fichero objeto: %s" + +#: dlltool.c:1570 +#, c-format +msgid "Scanning object file %s" +msgstr "Revisando el fichero objeto %s" + +#: dlltool.c:1585 +#, c-format +msgid "Cannot produce mcore-elf dll from archive file: %s" +msgstr "No se puede producir una dll mcore-elf del fichero archivo: %s" + +#: dlltool.c:1677 +msgid "Adding exports to output file" +msgstr "Agregando exportaciones al fichero de salida" + +#: dlltool.c:1724 +msgid "Added exports to output file" +msgstr "Exportaciones agregadas al fichero de salida" + +#: dlltool.c:1848 +#, c-format +msgid "Generating export file: %s" +msgstr "Generando el fichero de exportación: %s" + +#: dlltool.c:1853 +#, c-format +msgid "Unable to open temporary assembler file: %s" +msgstr "No se puede abrir el fichero temporal de ensamblador: %s" + +#: dlltool.c:1856 +#, c-format +msgid "Opened temporary file: %s" +msgstr "Se abrió el fichero temporal: %s" + +#: dlltool.c:2086 +msgid "Generated exports file" +msgstr "Fichero de exportación generado" + +#: dlltool.c:2378 +#, c-format +msgid "bfd_open failed open stub file: %s" +msgstr "falló bfd_open al abrirl el fichero de cabos: %s" + +#: dlltool.c:2381 +#, c-format +msgid "Creating stub file: %s" +msgstr "Creando el ficheor de cabos: %s" + +#: dlltool.c:2766 +#, c-format +msgid "failed to open temporary head file: %s" +msgstr "falló la apertura del inicio del fichero temporal: %s" + +#: dlltool.c:2825 +#, c-format +msgid "failed to open temporary tail file: %s" +msgstr "falló la apertura del final del fichero temporal: %s" + +#: dlltool.c:2892 +#, c-format +msgid "Can't open .lib file: %s" +msgstr "No se puede abrir el fichero .lib: %s" + +#: dlltool.c:2895 +#, c-format +msgid "Creating library file: %s" +msgstr "Creando el fichero de biblioteca: %s" + +#: dlltool.c:2951 +#, c-format +msgid "cannot delete %s: %s" +msgstr "no se puede borrar %s: %s" + +#: dlltool.c:2955 +msgid "Created lib file" +msgstr "Fichero de biblioteca creado" + +#: dlltool.c:3062 +#, c-format +msgid "Warning, ignoring duplicate EXPORT %s %d,%d" +msgstr "Aviso, ignorando las EXPORTaciones duplicadas %s %d,%d" + +#: dlltool.c:3068 +#, c-format +msgid "Error, duplicate EXPORT with oridinals: %s" +msgstr "Error, EXPORTaciones duplicadas con ordinales: %s" + +#: dlltool.c:3191 +msgid "Processing definitions" +msgstr "Procesando definiciones" + +#: dlltool.c:3223 +msgid "Processed definitions" +msgstr "Definiciones procesadas" + +#. xgetext:c-format +#: dlltool.c:3234 dllwrap.c:495 +#, c-format +msgid "Usage %s \n" +msgstr "Modo de empleo %s \n" + +#. xgetext:c-format +#: dlltool.c:3236 +#, c-format +msgid " -m --machine Create as DLL for . [default: %s]\n" +msgstr " -m --machine Crear una DLL para la . [por omisión: %s]\n" + +#: dlltool.c:3237 +msgid " possible : arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" +msgstr " posible: arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" + +#: dlltool.c:3238 +msgid " -e --output-exp Generate an export file.\n" +msgstr " -e --output-exp Generar un fichero de exportación.\n" + +#: dlltool.c:3239 +msgid " -l --output-lib Generate an interface library.\n" +msgstr " -l --output-lib Generar un fichero de interfaz.\n" + +#: dlltool.c:3240 +msgid " -a --add-indirect Add dll indirects to export file.\n" +msgstr " -a --add-indirect Agregar indirecciones dll al fichero de exportación.\n" + +#: dlltool.c:3241 +msgid " -D --dllname Name of input dll to put into interface lib.\n" +msgstr " -D --dllname Nombre de la dll de entrada a colocar en la biblioteca de interfaz.\n" + +#: dlltool.c:3242 +msgid " -d --input-def Name of .def file to be read in.\n" +msgstr " -d --input-def Nombre del fichero .def para leer.\n" + +#: dlltool.c:3243 +msgid " -z --output-def Name of .def file to be created.\n" +msgstr " -z --output-def Nombre del fichero .def para crear.\n" + +#: dlltool.c:3244 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols Exportar todos los símbolos a un .def\n" + +#: dlltool.c:3245 +msgid " --no-export-all-symbols Only export listed symbols\n" +msgstr " --no-export-all-symbols Sólo exportar los símbolos enlistados\n" + +#: dlltool.c:3246 +msgid " --exclude-symbols Don't export \n" +msgstr " --exclude-symbols No exportar la a\n" + +#: dlltool.c:3247 +msgid " --no-default-excludes Clear default exclude symbols\n" +msgstr " --no-default-excludes Limpiar los símbolos excluídos por omisión\n" + +#: dlltool.c:3248 +msgid " -b --base-file Read linker generated base file.\n" +msgstr " -b --base-file Leer el fichero base generado por el enlazador.\n" + +#: dlltool.c:3249 +msgid " -x --no-idata4 Don't generate idata$4 section.\n" +msgstr " -x --no-idata4 No generar la sección idata$4.\n" + +#: dlltool.c:3250 +msgid " -c --no-idata5 Don't generate idata$5 section.\n" +msgstr " -c --no-idata5 No generar la sección idata$5.\n" + +#: dlltool.c:3251 +msgid " -U --add-underscore Add underscores to symbols in interface library.\n" +msgstr " -U --add-underscore Agregar subrayado a los símbolos en la biblioteca de interfaz.\n" + +#: dlltool.c:3252 +msgid " -k --kill-at Kill @ from exported names.\n" +msgstr " -k --kill-at Eliminar @ de los nombres exportados.\n" + +#: dlltool.c:3253 +msgid " -A --add-stdcall-alias Add aliases without @.\n" +msgstr " -A --add-stdcall-alias Agregar aliases sin @.\n" + +#: dlltool.c:3254 +msgid " -S --as Use for assembler.\n" +msgstr " -S --as Usar para ensamblador.\n" + +#: dlltool.c:3255 +msgid " -f --as-flags Pass to the assembler.\n" +msgstr " -f --as-flags Pasar al ensamblador.\n" + +#: dlltool.c:3256 +msgid " -C --compat-implib Create backward compatible import library.\n" +msgstr " -C --compat-implib Crear biblioteca de importación compatible hacia atrás.\n" + +#: dlltool.c:3257 +msgid " -n --no-delete Keep temp files (repeat for extra preservation).\n" +msgstr " -n --no-delete Conservar los ficheros temporales (repetir para conservación extra).\n" + +#: dlltool.c:3258 +msgid " -v --verbose Be verbose.\n" +msgstr " -v --verbose Detallado.\n" + +#: dlltool.c:3259 +msgid " -V --version Display the program version.\n" +msgstr " -V --version Muestra la versión del programa.\n" + +#: dlltool.c:3260 +msgid " -h --help Display this information.\n" +msgstr " -h --help Muestra esta información.\n" + +#: dlltool.c:3262 +msgid " -M --mcore-elf Process mcore-elf object files into .\n" +msgstr " -M --mcore-elf Procesa los ficheros objeto mcore-elf hacia .\n" + +#: dlltool.c:3263 +msgid " -L --linker Use as the linker.\n" +msgstr " -L --linker Usa como el enlazador.\n" + +#: dlltool.c:3264 +msgid " -F --linker-flags Pass to the linker.\n" +msgstr " -F --linker-flags Pasa al enlazador.\n" + +#: dlltool.c:3418 +#, c-format +msgid "Unable to open base-file: %s" +msgstr "No se puede abrir el fichero-base: %s" + +#: dlltool.c:3450 +#, c-format +msgid "Machine '%s' not supported" +msgstr "La máquina '%s' no tiene soporte" + +#: dlltool.c:3553 dllwrap.c:214 +#, c-format +msgid "Tried file: %s" +msgstr "Fichero intentado: %s" + +#: dlltool.c:3560 dllwrap.c:221 +#, c-format +msgid "Using file: %s" +msgstr "Usando el fichero: %s" + +#: dllwrap.c:308 +#, c-format +msgid "Keeping temporary base file %s" +msgstr "Conservando el fichero base temporal %s" + +#: dllwrap.c:310 +#, c-format +msgid "Deleting temporary base file %s" +msgstr "Borrando el fichero base temporal %s" + +#: dllwrap.c:324 +#, c-format +msgid "Keeping temporary exp file %s" +msgstr "Conservando el fichero exp temporal %s" + +#: dllwrap.c:326 +#, c-format +msgid "Deleting temporary exp file %s" +msgstr "Borrando el fichero exp temporal %s" + +#: dllwrap.c:339 +#, c-format +msgid "Keeping temporary def file %s" +msgstr "Conservando el fichero def temporal %s" + +#: dllwrap.c:341 +#, c-format +msgid "Deleting temporary def file %s" +msgstr "Borrando el fichero def temporal %s" + +#: dllwrap.c:496 +msgid " Generic options:\n" +msgstr " Opciones genéricas:\n" + +#: dllwrap.c:497 +msgid " --quiet, -q Work quietly\n" +msgstr " --quiet, -q Trabajar silenciosamente\n" + +#: dllwrap.c:498 +msgid " --verbose, -v Verbose\n" +msgstr " --verbose, -v Con detalle\n" + +#: dllwrap.c:499 +msgid " --version Print dllwrap version\n" +msgstr " --version Muestra la versión de dllwrap\n" + +#: dllwrap.c:500 +msgid " --implib Synonym for --output-lib\n" +msgstr " --impllib Sinónimo para --output-lib\n" + +#: dllwrap.c:501 +#, c-format +msgid " Options for %s:\n" +msgstr " Opciones para %s:\n" + +#: dllwrap.c:502 +msgid " --driver-name Defaults to \"gcc\"\n" +msgstr " --driver-name Por omisión es \"gcc\"\n" + +#: dllwrap.c:503 +msgid " --driver-flags Override default ld flags\n" +msgstr " --driver-flags Cambia las opciones por omisión de ld\n" + +#: dllwrap.c:504 +msgid " --dlltool-name Defaults to \"dlltool\"\n" +msgstr " --dlltool-name Por omisión es \"dlltool\"\n" + +#: dllwrap.c:505 +msgid " --entry Specify alternate DLL entry point\n" +msgstr " --entry Especifica un punto de entrada alternativo para la DLL\n" + +#: dllwrap.c:506 +msgid " --image-base Specify image base address\n" +msgstr " --image-base Especifica la dirección de la imagen base\n" + +#: dllwrap.c:507 +msgid " --target i386-cygwin32 or i386-mingw32\n" +msgstr " --target i386-cygwin32 ó i386-mingw32\n" + +#: dllwrap.c:508 +msgid " --dry-run Show what needs to be run\n" +msgstr " --dry-run Muestra lo que se necesita ejecutar\n" + +#: dllwrap.c:509 +msgid " --mno-cygwin Create Mingw DLL\n" +msgstr " --mno-cygwin Crea una DLL Mingw\n" + +#: dllwrap.c:510 +msgid " Options passed to DLLTOOL:\n" +msgstr " Opciones pasadas a DLLTOOL:\n" + +#: dllwrap.c:511 +msgid " --machine \n" +msgstr " --machine \n" + +#: dllwrap.c:512 +msgid " --output-exp Generate export file.\n" +msgstr " --output-exp Genera un fichero de exportación.\n" + +# ¿No será acaso una biblioteca de salida? cfuga +#: dllwrap.c:513 +msgid " --output-lib Generate input library.\n" +msgstr " --output-lib Genera una biblioteca de entrada.\n" + +#: dllwrap.c:514 +msgid " --add-indirect Add dll indirects to export file.\n" +msgstr " --add-indirect Agrega indirecciones de dll al fichero de exportación.\n" + +#: dllwrap.c:515 +msgid " --dllname Name of input dll to put into output lib.\n" +msgstr " --dllname Nombre del fichero dll de entrada a colocar en la biblioteca de salida.\n" + +#: dllwrap.c:516 +msgid " --def Name input .def file\n" +msgstr " --def Nombre del fichero .def de entrada\n" + +#: dllwrap.c:517 +msgid " --output-def Name output .def file\n" +msgstr " --output-def Nombre del fichero .def de salida\n" + +#: dllwrap.c:518 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols Exporta todos los símbolos a un .def\n" + +#: dllwrap.c:519 +msgid " --no-export-all-symbols Only export .drectve symbols\n" +msgstr " --no-export-all-symbols Sólo exporta los símbolos .drectve\n" + +#: dllwrap.c:520 +msgid " --exclude-symbols Exclude from .def\n" +msgstr " --exclude-symbols Excluye la a del .def\n" + +#: dllwrap.c:521 +msgid " --no-default-excludes Zap default exclude symbols\n" +msgstr " --no-default-excludes Elimina los símbolos excluídos por omisión\n" + +#: dllwrap.c:522 +msgid " --base-file Read linker generated base file\n" +msgstr " --base-file Lee el fichero base generado por el enlazador\n" + +#: dllwrap.c:523 +msgid " --no-idata4 Don't generate idata$4 section\n" +msgstr " --no-idata4 No genera la sección idata$4\n" + +#: dllwrap.c:524 +msgid " --no-idata5 Don't generate idata$5 section\n" +msgstr " --no-idata5 No genera la sección idata$5\n" + +#: dllwrap.c:525 +msgid " -U Add underscores to .lib\n" +msgstr " -U Agrega subrayados a .lib\n" + +#: dllwrap.c:526 +msgid " -k Kill @ from exported names\n" +msgstr " -k Elimina @ de los nombres exportados\n" + +#: dllwrap.c:527 +msgid " --add-stdcall-alias Add aliases without @\n" +msgstr " --add-stdcall-alias Agrega aliases sin @\n" + +#: dllwrap.c:528 +msgid " --as Use for assembler\n" +msgstr " --as Usa como ensamblador\n" + +#: dllwrap.c:529 +msgid " --nodelete Keep temp files.\n" +msgstr " --nodelete Conserva los ficheros temporales.\n" + +#: dllwrap.c:530 +msgid " Rest are passed unmodified to the language driver\n" +msgstr " El resto se pasa sin modificación al controlador del lenguaje\n" + +#: dllwrap.c:802 +msgid "Must provide at least one of -o or --dllname options" +msgstr "Se debe proveer por lo menos una de las opciones -o ó --dllname" + +#: dllwrap.c:830 +msgid "" +"no export definition file provided.\n" +"Creating one, but that may not be what you want" +msgstr "" +"no se provee un fichero de definición de exportación.\n" +"Creando uno, pero tal vez eso no es lo que quiere" + +#: dllwrap.c:992 +#, c-format +msgid "DLLTOOL name : %s\n" +msgstr "nombre DLLTOOL : %s\n" + +#: dllwrap.c:993 +#, c-format +msgid "DLLTOOL options : %s\n" +msgstr "opciones DLLTOOL: %s\n" + +#: dllwrap.c:994 +#, c-format +msgid "DRIVER name : %s\n" +msgstr "nombre DRIVER : %s\n" + +#: dllwrap.c:995 +#, c-format +msgid "DRIVER options : %s\n" +msgstr "opciones DRIVER : %s\n" + +#: emul_aix.c:58 +#, c-format +msgid " [-g] - 32 bit small archive\n" +msgstr " [-g] - archivo small de 32 bit\n" + +#: emul_aix.c:59 +msgid " [-X32] - ignores 64 bit objects\n" +msgstr " [-X32] - ignora los objetos de 64 bit\n" + +#: emul_aix.c:60 +msgid " [-X64] - ignores 32 bit objects\n" +msgstr " [-X64] - ignora los objetos de 32 bit\n" + +#: emul_aix.c:61 +msgid " [-X32_64] - accepts 32 and 64 bit objects\n" +msgstr " [-X32_64] -acepta objetos de 32 y 64 bit\n" + +#: ieee.c:326 +msgid "unexpected end of debugging information" +msgstr "fin inesperado de la información de depuración" + +#: ieee.c:421 +msgid "invalid number" +msgstr "número inválido" + +#: ieee.c:480 +msgid "invalid string length" +msgstr "longitud de cadena inválida" + +#: ieee.c:537 ieee.c:578 +msgid "expression stack overflow" +msgstr "desbordamiento de la pila de expresión" + +#: ieee.c:557 +msgid "unsupported IEEE expression operator" +msgstr "operador de expresión IEEE sin soporte" + +#: ieee.c:572 +msgid "unknown section" +msgstr "sección desconocida" + +#: ieee.c:593 +msgid "expression stack underflow" +msgstr "desbordamiento por debajo de la pila de expresión" + +#: ieee.c:607 +msgid "expression stack mismatch" +msgstr "no hay coincidencia en la pila de expresión" + +#: ieee.c:646 +msgid "unknown builtin type" +msgstr "tipo interno desconocido" + +#: ieee.c:791 +msgid "BCD float type not supported" +msgstr "tipo de coma flotante BCD sin soporte" + +#: ieee.c:937 +msgid "unexpected number" +msgstr "número inesperado" + +#: ieee.c:944 +msgid "unexpected record type" +msgstr "tipo de grabación inesperado" + +#: ieee.c:977 +msgid "blocks left on stack at end" +msgstr "se dejaron bloques en la pila al final" + +#: ieee.c:1242 +msgid "unknown BB type" +msgstr "typo BB desconocido" + +#: ieee.c:1251 +msgid "stack overflow" +msgstr "desbordamiento de la pila" + +#: ieee.c:1276 +msgid "stack underflow" +msgstr "desbordamiento de la pila por debajo" + +#: ieee.c:1390 ieee.c:1462 ieee.c:2161 +msgid "illegal variable index" +msgstr "índice de variable ilegal" + +#: ieee.c:1440 +msgid "illegal type index" +msgstr "índice de tipo ilegal" + +#: ieee.c:1450 ieee.c:1487 +msgid "unknown TY code" +msgstr "código TY desconocido" + +#: ieee.c:1469 +msgid "undefined variable in TY" +msgstr "variable indefinida en TY" + +#. Pascal file name. FIXME. +#: ieee.c:1880 +msgid "Pascal file name not supported" +msgstr "El nombre de fichero Pascal no tiene soporte" + +#: ieee.c:1928 +msgid "unsupported qualifier" +msgstr "calificador sin soporte" + +#: ieee.c:2199 +msgid "undefined variable in ATN" +msgstr "variable indefinida en ATN" + +#: ieee.c:2242 +msgid "unknown ATN type" +msgstr "tipo ATN desconocido" + +#. Reserved for FORTRAN common. +#: ieee.c:2364 +msgid "unsupported ATN11" +msgstr "ATN11 sin soporte" + +#. We have no way to record this information. FIXME. +#: ieee.c:2391 +msgid "unsupported ATN12" +msgstr "ATN12 sin soporte" + +#: ieee.c:2451 +msgid "unexpected string in C++ misc" +msgstr "cadena inesperada en misc de C++" + +#: ieee.c:2464 +msgid "bad misc record" +msgstr "grabación misc errónea" + +#: ieee.c:2507 +msgid "unrecognized C++ misc record" +msgstr "grabación misc de C++ no reconocida" + +#: ieee.c:2624 +msgid "undefined C++ object" +msgstr "objeto C++ no definido" + +#: ieee.c:2658 +msgid "unrecognized C++ object spec" +msgstr "especificación de objeto C++ no reconocida" + +#: ieee.c:2694 +msgid "unsupported C++ object type" +msgstr "tipo de objeto C++ sin soporte" + +#: ieee.c:2704 +msgid "C++ base class not defined" +msgstr "no está definida la clase base de C++" + +#: ieee.c:2716 ieee.c:2821 +msgid "C++ object has no fields" +msgstr "el objeto C++ no tiene campos" + +#: ieee.c:2735 +msgid "C++ base class not found in container" +msgstr "no se encuentra la clase base C++ en el contenedor" + +#: ieee.c:2842 +msgid "C++ data member not found in container" +msgstr "no se encuentra los datos miembros C++ en el contenedor" + +#: ieee.c:2883 ieee.c:3033 +msgid "unknown C++ visibility" +msgstr "visibilidad C++ desconocida" + +#: ieee.c:2917 +msgid "bad C++ field bit pos or size" +msgstr "posición o tamaño erróneo del campo de bit C++" + +#: ieee.c:3009 +msgid "bad type for C++ method function" +msgstr "tipo erróneo para la función del método C++" + +#: ieee.c:3019 +msgid "no type information for C++ method function" +msgstr "no hay información de tipo para la función del método C++" + +#: ieee.c:3058 +msgid "C++ static virtual method" +msgstr "método virtual static de C++" + +#: ieee.c:3153 +msgid "unrecognized C++ object overhead spec" +msgstr "especificación de adelanto de objeto C++ no reconocida" + +#: ieee.c:3192 +msgid "undefined C++ vtable" +msgstr "vtable C++ no definida" + +#: ieee.c:3263 +msgid "C++ default values not in a function" +msgstr "valores C++ por omisión no están en una función" + +#: ieee.c:3303 +msgid "unrecognized C++ default type" +msgstr "tipo por omisión de C++ no reconocido" + +#: ieee.c:3334 +msgid "reference parameter is not a pointer" +msgstr "el parámetro de referencia no es un apuntador" + +#: ieee.c:3419 +msgid "unrecognized C++ reference type" +msgstr "tipo de referencia de C++ no reconocido" + +#: ieee.c:3501 +msgid "C++ reference not found" +msgstr "no se encontró la referencia C++" + +#: ieee.c:3509 +msgid "C++ reference is not pointer" +msgstr "la referencia C++ no es un apuntador" + +#: ieee.c:3538 ieee.c:3546 +msgid "missing required ASN" +msgstr "falta el ASN requerido" + +#: ieee.c:3576 ieee.c:3584 +msgid "missing required ATN65" +msgstr "falta el ATN65 requerido" + +#: ieee.c:3598 +msgid "bad ATN65 record" +msgstr "registro ATN65 erróneo" + +#: ieee.c:4286 +msgid "IEEE numeric overflow: 0x" +msgstr "desbordamiento numérico IEEE: 0x" + +#: ieee.c:4332 +#, c-format +msgid "IEEE string length overflow: %u\n" +msgstr "desbordamiento de longitud de cadena IEEE: %u\n" + +#: ieee.c:5382 +#, c-format +msgid "IEEE unsupported integer type size %u\n" +msgstr "tamaño de tipo entero IEEE %u sin soporte\n" + +#: ieee.c:5418 +#, c-format +msgid "IEEE unsupported float type size %u\n" +msgstr "tamaño de tipo coma flotante IEEE %u sin soporte\n" + +#: ieee.c:5454 +#, c-format +msgid "IEEE unsupported complex type size %u\n" +msgstr "tamaño de tipo complejo IEEE %u sin soporte\n" + +#: nlmconv.c:282 srconv.c:2043 +msgid "input and output files must be different" +msgstr "los ficheros de entrada y salida deben ser diferentes" + +#: nlmconv.c:329 +msgid "input file named both on command line and with INPUT" +msgstr "fichero de entrada nombrado en la línea de comandos y con INPUT" + +#: nlmconv.c:338 +msgid "no input file" +msgstr "no hay fichero de entrada" + +#: nlmconv.c:368 +msgid "no name for output file" +msgstr "no hay nombre para el fichero de salida" + +#: nlmconv.c:382 +msgid "warning: input and output formats are not compatible" +msgstr "aviso: los formatos de entrada y salida no son compatibles" + +#: nlmconv.c:411 +msgid "make .bss section" +msgstr "hacer sección .bss" + +#: nlmconv.c:420 +msgid "make .nlmsections section" +msgstr "hacer sección .nlmsections" + +#: nlmconv.c:422 +msgid "set .nlmsections flags" +msgstr "establecer opciones .nlmsections" + +#: nlmconv.c:450 +msgid "set .bss vma" +msgstr "establecer vma .bss" + +#: nlmconv.c:457 +msgid "set .data size" +msgstr "establecer tamaño de .data" + +#: nlmconv.c:637 +#, c-format +msgid "warning: symbol %s imported but not in import list" +msgstr "aviso: se importó el símbolo %s pero no está en la lista de importación" + +#: nlmconv.c:657 +msgid "set start address" +msgstr "establecer la dirección de inicio" + +#: nlmconv.c:706 +#, c-format +msgid "warning: START procedure %s not defined" +msgstr "aviso: el procedimiento START %s no está definido" + +#: nlmconv.c:708 +#, c-format +msgid "warning: EXIT procedure %s not defined" +msgstr "aviso: el procedimiento EXIT %s no está definido" + +#: nlmconv.c:710 +#, c-format +msgid "warning: CHECK procedure %s not defined" +msgstr "aviso: el procedimiento CHECK %s no está definido" + +#: nlmconv.c:731 nlmconv.c:920 +msgid "custom section" +msgstr "sección a la medida" + +#: nlmconv.c:752 nlmconv.c:949 +msgid "help section" +msgstr "sección de ayuda" + +#: nlmconv.c:774 nlmconv.c:967 +msgid "message section" +msgstr "sección de mensajes" + +#: nlmconv.c:790 nlmconv.c:1000 +msgid "module section" +msgstr "sección de módulos" + +#: nlmconv.c:810 nlmconv.c:1016 +msgid "rpc section" +msgstr "sección de rpc" + +#. There is no place to record this information. +#: nlmconv.c:846 +#, c-format +msgid "%s: warning: shared libraries can not have uninitialized data" +msgstr "%s: aviso: las bibliotecas compartidas no pueden tener datos sin iniciar" + +#: nlmconv.c:867 nlmconv.c:1035 +msgid "shared section" +msgstr "sección compartida" + +#: nlmconv.c:875 +msgid "warning: No version number given" +msgstr "aviso: No se dió un número de versión" + +#: nlmconv.c:915 nlmconv.c:944 nlmconv.c:962 nlmconv.c:1011 nlmconv.c:1030 +#, c-format +msgid "%s: read: %s" +msgstr "%s: leído: %s" + +#: nlmconv.c:937 +msgid "warning: MAP and FULLMAP are not supported; try ld -M" +msgstr "aviso: MAP y FULLMAP no tienen soporte; pruebe ld -M" + +#: nlmconv.c:1109 +#, c-format +msgid "Usage: %s [option(s)] [in-file [out-file]]\n" +msgstr "Modo de empleo: %s [opcion(es)] [fichero-entrada [fichero-salida]]\n" + +#: nlmconv.c:1110 +msgid " Convert an object file into a NetWare Loadable Module\n" +msgstr "Convertir un fichero objeto en un Módulo Cargable de NetWare (NLM)\n" + +#: nlmconv.c:1111 +msgid "" +" The options are:\n" +" -I --input-target= Set the input binary file format\n" +" -O --output-target= Set the output binary file format\n" +" -T --header-file= Read for NLM header information\n" +" -l --linker= Use for any linking\n" +" -d --debug Display on stderr the linker command line\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +msgstr "" +" Las opciones son:\n" +" -I --input-target= Establece el formato del fichero binario de entrada\n" +" -O --output-target= Establece el formato del fichero binario de salida\n" +" -T --header-file= Lee el para la información del encabezado NLM\n" +" -l --linker= Usa el para cualquier enlazado\n" +" -d --debug Muestra en salida estándar la línea de comando del enlazador\n" +" -h --help Muestra esta información\n" +" -v --version Muestra la versión del programa\n" + +#: nlmconv.c:1153 +#, c-format +msgid "support not compiled in for %s" +msgstr "soporte no compilado para %s" + +#: nlmconv.c:1193 +msgid "make section" +msgstr "sección make" + +#: nlmconv.c:1207 +msgid "set section size" +msgstr "establecer el tamaño de la sección" + +#: nlmconv.c:1213 +msgid "set section alignment" +msgstr "establecer la alineación de la sección" + +#: nlmconv.c:1217 +msgid "set section flags" +msgstr "establecer las opciones de la sección" + +#: nlmconv.c:1228 +msgid "set .nlmsections size" +msgstr "establecer el tamaño de .nlmsections" + +#: nlmconv.c:1316 nlmconv.c:1324 nlmconv.c:1333 nlmconv.c:1338 +msgid "set .nlmsection contents" +msgstr "establecer el contenido de .nlmsection" + +#: nlmconv.c:1839 +msgid "stub section sizes" +msgstr "tamaños de la sección de cabos" + +#: nlmconv.c:1888 +msgid "writing stub" +msgstr "escribiendo cabo" + +#: nlmconv.c:1977 +#, c-format +msgid "unresolved PC relative reloc against %s" +msgstr "reubicación relativa PC contra %s sin resolver" + +#: nlmconv.c:2041 +#, c-format +msgid "overflow when adjusting relocation against %s" +msgstr "desbordamiento al ajustar la reubicación contra %s" + +#: nlmconv.c:2158 +#, c-format +msgid "%s: execution of %s failed: " +msgstr "%s: falló la ejecución de %s: " + +#: nlmconv.c:2173 +#, c-format +msgid "Execution of %s failed" +msgstr "Falló la ejecución de %s" + +#: nm.c:283 size.c:85 strings.c:657 +#, c-format +msgid "Usage: %s [option(s)] [file(s)]\n" +msgstr "Modo de empleo: %s [opcion(es)] [fichero(s)]\n" + +#: nm.c:284 +msgid " List symbols in [file(s)] (a.out by default).\n" +msgstr "Lista de símbolos en [fichero(s)] (a.out por omisión).\n" + +#: nm.c:285 +msgid "" +" The options are:\n" +" -a, --debug-syms Display debugger-only symbols\n" +" -A, --print-file-name Print name of the input file before every symbol\n" +" -B Same as --format=bsd\n" +" -C, --demangle[=STYLE] Decode low-level symbol names into user-level names\n" +" The STYLE, if specified, can be `auto' (the default),\n" +" `gnu', `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n" +" or `gnat'\n" +" --no-demangle Do not demangle low-level symbol names\n" +" -D, --dynamic Display dynamic symbols instead of normal symbols\n" +" --defined-only Display only defined symbols\n" +" -e (ignored)\n" +" -f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',\n" +" `sysv' or `posix'. The default is `bsd'\n" +" -g, --extern-only Display only external symbols\n" +" -l, --line-numbers Use debugging information to find a filename and\n" +" line number for each symbol\n" +" -n, --numeric-sort Sort symbols numerically by address\n" +" -o Same as -A\n" +" -p, --no-sort Do not sort the symbols\n" +" -P, --portability Same as --format=posix\n" +" -r, --reverse-sort Reverse the sense of the sort\n" +" -S, --print-size Print size of defined symbols\n" +" -s, --print-armap Include index for symbols from archive members\n" +" --size-sort Sort symbols by size\n" +" -t, --radix=RADIX Use RADIX for printing symbol values\n" +" --target=BFDNAME Specify the target object format as BFDNAME\n" +" -u, --undefined-only Display only undefined symbols\n" +" -X 32_64 (ignored)\n" +" -h, --help Display this information\n" +" -V, --version Display this program's version number\n" +"\n" +msgstr "" +"Las opciones son:\n" +" -a, --debug-syms Muestra símbolos sólo para el depurador\n" +" -A, --print-file-name Muestra el nombre del fichero de entrada antes de\n" +" cada símbolo\n" +" -B Igual que --format=bsd\n" +" -C, --demangle[=ESTILO] Decodifica los nombres de símbolo de bajo nivel en\n" +" nombres de nivel de usuario\n" +" El ESTILO, si se especifica, puede ser `auto'\n" +" (por omisión), `gnu', `lucid', `arm', `hp', `edg',\n" +" `gnu-v3', `java' o `gnat'\n" +" --no-demangle No decodifica los nombres de símbolo de bajo nivel\n" +" -D, --dynamic Muestra los símbolos dinámicos en lugar de los\n" +" símbolos normales\n" +" --defined-only Muestra solamente los símbolos definidos\n" +" -e (ignorado)\n" +" -f, --format=FORMATO Usa el formato de salida FORMATO. FORMATO puede ser\n" +" `bsd', `sysv' o `posix'. Por omisión es `bsd'\n" +" -g, --extern-only Muestra solamente los símbolos externos\n" +" -l, --line-numbers Utiliza la información de depuración para encontrar\n" +" un nombre de fichero y un número de línea para cada\n" +" símbolo\n" +" -n, --numeric-sort Ordena los símbolos numéricamente por dirección\n" +" -o Igual que -A\n" +" -p, --no-sort No ordena los símbolos\n" +" -P, --portability Igual que --format=posix\n" +" -r, --reverse-sort Cambia el sentido de la ordenación\n" +" -S, --print-size Muestra el tamaño de los símbolos definidos\n" +" -s, --print-armap Incluye el índice de los símbolos de miembros\n" +" del archivo\n" +" --size-sort Ordena los símbolos por tamaño\n" +" -t, --radix=RADICAL Utiliza el RADICAL para mostrar los valores de\n" +" los símbolos\n" +" --target=NOMBREBFD Especifica el formato de objeto objetivo como\n" +" NOMBREBFD\n" +" -u, --undefined-only Muestra sólo los símbolos indefinidos\n" +" -X 32_64 (ignorado)\n" +" -h, --help Muestra esta información\n" +" -V, --version Muestra el número de versión de este programa\n" +"\n" + +#: nm.c:319 objdump.c:250 +#, c-format +msgid "Report bugs to %s.\n" +msgstr "Reportar bichos a %s.\n" + +#: nm.c:352 +#, c-format +msgid "%s: invalid radix" +msgstr "%s: radical inválido" + +#: nm.c:377 +#, c-format +msgid "%s: invalid output format" +msgstr "%s: formato de salida inválido" + +#: nm.c:494 +msgid "Only -X 32_64 is supported" +msgstr "Solamente -X 32_64 tiene soporte" + +#: nm.c:514 +msgid "Using the --size-sort and --undefined-only options together" +msgstr "Al usar juntas las opciones --size-sort y --undefined-only" + +#: nm.c:515 +msgid "will produce no output, since undefined symbols have no size." +msgstr "no se producirá salida, porque los símbolos indefinidos no tienen tamaño." + +#: nm.c:543 +#, c-format +msgid "data size %ld" +msgstr "tamaño de datos %ld" + +#: nm.c:568 readelf.c:5809 readelf.c:5845 +#, c-format +msgid ": %d" +msgstr " %d:" + +#: nm.c:570 readelf.c:5811 readelf.c:5857 +#, c-format +msgid ": %d" +msgstr ": %d" + +#: nm.c:572 readelf.c:5813 readelf.c:5860 +#, c-format +msgid ": %d" +msgstr ": %d" + +#: nm.c:1376 +#, c-format +msgid "" +"\n" +"\n" +"Undefined symbols from %s:\n" +"\n" +msgstr "" +"\n" +"\n" +"Símbolos indefinidos de %s:\n" +"\n" + +#: nm.c:1378 +#, c-format +msgid "" +"\n" +"\n" +"Symbols from %s:\n" +"\n" +msgstr "" +"\n" +"\n" +"Símbolos de %s:\n" +"\n" + +#: nm.c:1380 nm.c:1438 +msgid "" +"Name Value Class Type Size Line Section\n" +"\n" +msgstr "" +"Nombre Valor Clase Tipo Tamaño Línea Sección\n" +"\n" + +#: nm.c:1383 nm.c:1441 +msgid "" +"Name Value Class Type Size Line Section\n" +"\n" +msgstr "" +"Nombre Valor Clase Tipo Tamaño Línea Sección\n" +"\n" + +#: nm.c:1434 +#, c-format +msgid "" +"\n" +"\n" +"Undefined symbols from %s[%s]:\n" +"\n" +msgstr "" +"\n" +"\n" +"Símbolos indefinidos de %s[%s]:\n" +"\n" + +#: nm.c:1436 +#, c-format +msgid "" +"\n" +"\n" +"Symbols from %s[%s]:\n" +"\n" +msgstr "" +"\n" +"\n" +"Símbolos de %s[%s]:\n" +"\n" + +#: nm.c:1658 +msgid "" +"\n" +"Archive index:\n" +msgstr "" +"\n" +"Índice del archivo:\n" + +#: objcopy.c:414 srconv.c:1952 +#, c-format +msgid "Usage: %s [option(s)] in-file [out-file]\n" +msgstr "Modo de empleo: %s [opcion(es)] fichero-entrada [fichero-salida]\n" + +#: objcopy.c:415 +msgid " Copies a binary file, possibly transforming it in the process\n" +msgstr " Copia un fichero binario, posiblemente transformándolo en el proceso\n" + +#: objcopy.c:416 objcopy.c:495 +msgid " The options are:\n" +msgstr " Las opciones son:\n" + +#: objcopy.c:417 +msgid "" +" -I --input-target Assume input file is in format \n" +" -O --output-target Create an output file in format \n" +" -B --binary-architecture Set arch of output file, when input is binary\n" +" -F --target Set both input and output format to \n" +" --debugging Convert debugging information, if possible\n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -j --only-section Only copy section into the output\n" +" --add-gnu-debuglink= Add section .gnu_debuglink linking to \n" +" -R --remove-section Remove section from the output\n" +" -S --strip-all Remove all symbol and relocation information\n" +" -g --strip-debug Remove all debugging symbols & sections\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol Do not copy symbol \n" +" -K --keep-symbol Only copy symbol \n" +" -L --localize-symbol Force symbol to be marked as a local\n" +" -G --keep-global-symbol Localize all symbols except \n" +" -W --weaken-symbol Force symbol to be marked as a weak\n" +" --weaken Force all global symbols to be marked as weak\n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -i --interleave Only copy one out of every bytes\n" +" -b --byte Select byte in every interleaved block\n" +" --gap-fill Fill gaps between sections with \n" +" --pad-to Pad the last section up to address \n" +" --set-start Set the start address to \n" +" {--change-start|--adjust-start} \n" +" Add to the start address\n" +" {--change-addresses|--adjust-vma} \n" +" Add to LMA, VMA and start addresses\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" Change LMA and VMA of section by \n" +" --change-section-lma {=|+|-}\n" +" Change the LMA of section by \n" +" --change-section-vma {=|+|-}\n" +" Change the VMA of section by \n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" Warn if a named section does not exist\n" +" --set-section-flags =\n" +" Set section 's properties to \n" +" --add-section = Add section found in to output\n" +" --rename-section =[,] Rename section to \n" +" --change-leading-char Force output format's leading character style\n" +" --remove-leading-char Remove leading character from global symbols\n" +" --redefine-sym = Redefine symbol name to \n" +" --redefine-syms --redefine-sym for all symbol pairs \n" +" listed in \n" +" --srec-len Restrict the length of generated Srecords\n" +" --srec-forceS3 Restrict the type of generated Srecords to S3\n" +" --strip-symbols -N for all symbols listed in \n" +" --keep-symbols -K for all symbols listed in \n" +" --localize-symbols -L for all symbols listed in \n" +" --keep-global-symbols -G for all symbols listed in \n" +" --weaken-symbols -W for all symbols listed in \n" +" --alt-machine-code Use alternate machine code for output\n" +" --prefix-symbols Add to start of every symbol name\n" +" --prefix-sections Add to start of every section name\n" +" --prefix-alloc-sections \n" +" Add to start of every allocatable\n" +" section name\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +" --info List object formats & architectures supported\n" +msgstr "" +" -I --input-target Asume que el fichero de entrada está en\n" +" el formato \n" +" -O --output-target Crea un fichero de salida en el formato\n" +" \n" +" -B --binary-architecture Establece la arquitectura del fichero de\n" +" salida, cuando la entrada es binaria\n" +" -F --target Establece tanto el formato de salida como\n" +" el de entrada a \n" +" --debugging Convertir la información de depuración, si\n" +" es posible\n" +" -p --preserve-dates Copiar las marcas de tiempo de modificación y\n" +" acceso a la salida\n" +" -j --only-section Sólo copiar la sección en la salida\n" +" --add-gnu-debuglink= Agregar la sección de enlazado .gnu_debuglink\n" +" al ero\n" +" -R --remove-section Borrar la sección de la salida\n" +" -S --strip-all Borrar todos los símbolos y la información de\n" +" reubicación\n" +" -g --strip-debug Borrar todos los símbolos y secciones de\n" +" depuración\n" +" --strip-unneeded Borrar todos los símbolos innecesarios para\n" +" las reubicaciones\n" +" -N --strip-symbol No copiar el símbolo \n" +" -K --keep-symbol Sólo copiar el símbolo \n" +" -L --localize-symbol Forzar que el símbolo se marque como local\n" +" -G --keep-global-symbol Volver locales todos los símbolos excepto \n" +" -W --weaken-symbol Forzar que el símbolo se marque como débil\n" +" --weaken Forzar que todos los símbolos se marquen como débiles\n" +" -x --discard-all Borra todos los símbolos que no son globales\n" +" -X --discard-locals Borra cualquier símbolo generado por el compilador\n" +" -i --interleave Sólo copia uno de cada bytes\n" +" -b --byte Selecciona el byte en cada bloque espaciado\n" +" --gap-fill Rellena los huecos entre secciones con \n" +" --pad-to Rellena la última sección hasta la dirección \n" +" --set-start Establece la dirección de inicio en \n" +" {--change-start|--adjust-start} \n" +" Agrega a la dirección de inicio\n" +" {--change-addresses|--adjust-vma} \n" +" Agrega a las direcciones LMA, VMA y la de inicio\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" Cambia el LMA y el VMA de la sección por \n" +" --change-section-lma {=|+|-}\n" +" Cambia el LMA de la sección por \n" +" --change-section-vma {=|+|-}\n" +" Cambia el VMA de la sección por \n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" Avisar si no existe una sección nombrada\n" +" --set-section-flags =\n" +" Establece las propiedades de la sección \n" +" a \n" +" --add-section =\n" +" Agrega la sección que se encuentra\n" +" en el a la salida\n" +" --rename-section =[,] Renombra la sección a \n" +" --change-leading-char Fuerza el carácter de estilo inicial en\n" +" el formato de salida\n" +" --remove-leading-char Borra el carácter inicial de los símbolos globales\n" +" --redefine-sym =\n" +" Redefine el nombre de símbolo a \n" +" --srec-len Restringe la longitud de los Srecords generados\n" +" --srec-forceS3 Restringe el tipo de los Srecords generados a S3\n" +" --strip-symbols -N para todos los símbolos enlistados en el \n" +" --keep-symbols -K para todos los símbolos enlistados en el \n" +" --localize-symbols -L para todos los símbolos enlistados en el \n" +" --keep-global-symbols -G para todos los símbolos enlistados en el ero\n" +" --weaken-symbols -W para todos los símbolos enlistados en el \n" +" --alt-machine-code <índice> Utiliza código máquina alternativo para la salida\n" +" --prefix-symbols Agrega al inicio de cada nombre de símbolo\n" +" --prefix-sections Agrega al inicio de cada nombre de sección\n" +" --prefix-alloc-sections \n" +" Agrega al inicio de cada nombre de\n" +" sección alojable\n" +" -v --verbose Enlista todos los ficheros objeto modificados\n" +" -V --version Muestra el número de versión de este programa\n" +" -h --help Muestra esta salida\n" +" --info Enlista los formatos objeto y arquitecturas\n" +" que se soportan\n" + +#: objcopy.c:493 +#, c-format +msgid "Usage: %s in-file(s)\n" +msgstr "Modo de empleo: %s fichero(s)-entrada\n" + +#: objcopy.c:494 +msgid " Removes symbols and sections from files\n" +msgstr " Remueve símbolos y secciones de los ficheros\n" + +#: objcopy.c:496 +msgid "" +" -I --input-target= Assume input file is in format \n" +" -O --output-target= Create an output file in format \n" +" -F --target= Set both input and output format to \n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -R --remove-section= Remove section from the output\n" +" -s --strip-all Remove all symbol and relocation information\n" +" -g -S -d --strip-debug Remove all debugging symbols & sections\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol= Do not copy symbol \n" +" -K --keep-symbol= Only copy symbol \n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +" --info List object formats & architectures supported\n" +" -o Place stripped output into \n" +msgstr "" +" -I --input-target Asume que el fichero de entrada está en\n" +" el formato \n" +" -O --output-target Crea un fichero de salida en el formato\n" +" \n" +" -F --target Establece tanto el formato de salida como\n" +" el de entrada a \n" +" -p --preserve-dates Copiar las marcas de tiempo de modificación y\n" +" acceso a la salida\n" +" -R --remove-section Borra la sección de la salida\n" +" -s --strip-all Borra todos los símbolos y la información\n" +" de reubicación\n" +" -g -S --strip-debug Borra todos los símbolos y secciones de\n" +" depuración\n" +" --strip-unneeded Borra todos los símbolos innecesarios para\n" +" las reubicaciones\n" +" -N --strip-symbol No copia el símbolo \n" +" -K --keep-symbol Sólo copia el símbolo \n" +" -x --discard-all Borra todos los símbolos que no son globales\n" +" -X --discard-locals Borra cualquier símbolo generado por\n" +" el compilador\n" +" -v --verbose Enlista todos los ficheros objeto modificados\n" +" -V --version Muestra el número de versión de este programa\n" +" -h --help Muestra esta salida\n" +" -o Coloca la salida limpia en el \n" + +#: objcopy.c:567 +#, c-format +msgid "unrecognized section flag `%s'" +msgstr "opción de sección `%s' desconocida" + +#: objcopy.c:568 +#, c-format +msgid "supported flags: %s" +msgstr "opciones con soporte: %s" + +#: objcopy.c:645 objcopy.c:2526 +#, c-format +msgid "cannot stat: %s: %s" +msgstr "no se puede obtener la información de stat: %s: %s" + +#: objcopy.c:652 objcopy.c:2544 +#, c-format +msgid "cannot open: %s: %s" +msgstr "no se puede abrir: %s: %s" + +#: objcopy.c:655 objcopy.c:2548 +#, c-format +msgid "%s: fread failed" +msgstr "%s: fread falló" + +#: objcopy.c:728 +#, c-format +msgid "Ignoring rubbish found on line %d of %s" +msgstr "Ignorando la basura encontrada en la línea %d de %s" + +#: objcopy.c:979 +#, c-format +msgid "%s: Multiple redefinition of symbol \"%s\"" +msgstr "%s: Redefiniciones múltiples del símbolo \"%s\"" + +#: objcopy.c:983 +#, c-format +msgid "%s: Symbol \"%s\" is target of more than one redefinition" +msgstr "%s: El símbolo \"%s\" es objetivo de más de una redefinición" + +#: objcopy.c:1010 +#, c-format +msgid "couldn't open symbol redefinition file %s (error: %s)" +msgstr "no se puede abrir el fichero de redefinición de símbolos %s (error: %s)" + +#: objcopy.c:1088 +#, c-format +msgid "%s: garbage at end of line %d" +msgstr "%s: basura al final de la línea %d" + +#: objcopy.c:1091 +#, c-format +msgid "%s: missing new symbol name at line %d" +msgstr "%s: falta el nombre del símbolo nuevo en la línea %d" + +#: objcopy.c:1101 +#, c-format +msgid "%s: premature end of file at line %d" +msgstr "%s: fin de fichero prematuro en la línea %d" + +#: objcopy.c:1147 +msgid "Unable to change endianness of input file(s)" +msgstr "No se puede cambiar la endianez del (los) fichero(s) de entrada" + +#: objcopy.c:1155 +#, c-format +msgid "copy from %s(%s) to %s(%s)\n" +msgstr "copiar de %s(%s) a %s(%s)\n" + +#: objcopy.c:1182 +#, c-format +msgid "Warning: Output file cannot represent architecture %s" +msgstr "Aviso: El fichero de salida no puede representar a la arquitectura %s" + +#: objcopy.c:1211 +#, c-format +msgid "can't create section `%s': %s" +msgstr "no se puede crear la sección `%s' %s" + +#: objcopy.c:1304 +#, c-format +msgid "Can't fill gap after %s: %s" +msgstr "No se puede llenar el espacio después de %s: %s" + +#: objcopy.c:1329 +#, c-format +msgid "Can't add padding to %s: %s" +msgstr "No se puede agregar relleno a %s: %s" + +#: objcopy.c:1485 +#, c-format +msgid "%s: error copying private BFD data: %s" +msgstr "%s: error al copiar los datos privados BFD: %s" + +#: objcopy.c:1498 +msgid "unknown alternate machine code, ignored" +msgstr "código máquina alternativo desconocido, ignorado" + +#: objcopy.c:1531 objcopy.c:1561 +#, c-format +msgid "cannot mkdir %s for archive copying (error: %s)" +msgstr "no se puede crear el directorio %s para copiar el archivo (error: %s)" + +#: objcopy.c:1749 +#, c-format +msgid "Multiple renames of section %s" +msgstr "Renombrado múltiple de la sección %s" + +#: objcopy.c:1840 +msgid "making" +msgstr "haciendo" + +#: objcopy.c:1849 +msgid "size" +msgstr "tamaño" + +#: objcopy.c:1863 +msgid "vma" +msgstr "vma" + +#: objcopy.c:1888 +msgid "alignment" +msgstr "alineación" + +#: objcopy.c:1896 +msgid "flags" +msgstr "opciones" + +#: objcopy.c:1918 +msgid "private data" +msgstr "datos privados" + +#: objcopy.c:1926 +#, c-format +msgid "%s: section `%s': error in %s: %s" +msgstr "%s: sección `%s': error en %s: %s" + +#: objcopy.c:2199 +#, c-format +msgid "%s: can't create debugging section: %s" +msgstr "%s: no se puede crear la sección de depuración: %s" + +#: objcopy.c:2214 +#, c-format +msgid "%s: can't set debugging section contents: %s" +msgstr "%s: no se puede establecer el contenido de la sección de depuración: %s" + +#: objcopy.c:2223 +#, c-format +msgid "%s: don't know how to write debugging information for %s" +msgstr "%s: se ignora cómo escribir la información de depuración para %s" + +#: objcopy.c:2346 +#, c-format +msgid "%s: cannot stat: %s" +msgstr "%s: no se puede obtener la información de stat: %s" + +#: objcopy.c:2400 +msgid "byte number must be non-negative" +msgstr "el número de bytes no debe ser negativo" + +#: objcopy.c:2410 +msgid "interleave must be positive" +msgstr "el espacio debe ser positivo" + +#: objcopy.c:2430 objcopy.c:2438 +#, c-format +msgid "%s both copied and removed" +msgstr "%s copiado y borrado" + +#: objcopy.c:2523 objcopy.c:2593 objcopy.c:2693 objcopy.c:2724 objcopy.c:2748 +#: objcopy.c:2752 objcopy.c:2772 +#, c-format +msgid "bad format for %s" +msgstr "formato erróneo para %s" + +#: objcopy.c:2662 +#, c-format +msgid "Warning: truncating gap-fill from 0x%s to 0x%x" +msgstr "Aviso: truncando el relleno de espacio de 0x%s a 0x%x" + +#: objcopy.c:2818 +msgid "alternate machine code index must be positive" +msgstr "el índice de código máquina alternativo debe ser positivo" + +#: objcopy.c:2856 +msgid "byte number must be less than interleave" +msgstr "el número de bytes debe ser menor al espacio" + +#: objcopy.c:2883 +#, c-format +msgid "architecture %s unknown" +msgstr "arquitectura %s desconocida" + +#: objcopy.c:2887 +msgid "Warning: input target 'binary' required for binary architecture parameter." +msgstr "Aviso: se requiere el objetivo de entrada 'binary' para el parámeto binario de arquitectura." + +#: objcopy.c:2888 +#, c-format +msgid " Argument %s ignored" +msgstr " Se ignora el argumento %s" + +#: objcopy.c:2894 +#, c-format +msgid "Cannot stat: %s: %s" +msgstr "No se puede obtener la información de stat: %s: %s" + +#: objcopy.c:2934 objcopy.c:2948 +#, c-format +msgid "%s %s%c0x%s never used" +msgstr "%s nunca se usa %s%c0x%s" + +#: objdump.c:197 +#, c-format +msgid "Usage: %s \n" +msgstr "Modo de empleo: %s \n" + +#: objdump.c:198 +msgid " Display information from object .\n" +msgstr "Muestra la información de objeto.\n" + +#: objdump.c:199 +msgid " At least one of the following switches must be given:\n" +msgstr "Por lo menos se requiere una de los siguientes opciones:\n" + +#: objdump.c:200 +msgid "" +" -a, --archive-headers Display archive header information\n" +" -f, --file-headers Display the contents of the overall file header\n" +" -p, --private-headers Display object format specific file header contents\n" +" -h, --[section-]headers Display the contents of the section headers\n" +" -x, --all-headers Display the contents of all headers\n" +" -d, --disassemble Display assembler contents of executable sections\n" +" -D, --disassemble-all Display assembler contents of all sections\n" +" -S, --source Intermix source code with disassembly\n" +" -s, --full-contents Display the full contents of all sections requested\n" +" -g, --debugging Display debug information in object file\n" +" -G, --stabs Display (in raw form) any STABS info in the file\n" +" -t, --syms Display the contents of the symbol table(s)\n" +" -T, --dynamic-syms Display the contents of the dynamic symbol table\n" +" -r, --reloc Display the relocation entries in the file\n" +" -R, --dynamic-reloc Display the dynamic relocation entries in the file\n" +" -v, --version Display this program's version number\n" +" -i, --info List object formats and architectures supported\n" +" -H, --help Display this information\n" +msgstr "" +" -a, --archive-headers Muestra información de los encabezados del archivo\n" +" -f, --file-headers Muestra el contenido de todos los encabezados del\n" +" fichero\n" +" -p, --private-headers Muestra el contenido de los encabezados del fichero\n" +" específicos del formato objeto\n" +" -h, --[section-]headers Muestra el contenido de los encabezados de sección\n" +" -x, --all-headers Muestra el contenido de todos los encabezados\n" +" -d, --disassemble Muestra el contenido de ensamblador de las secciones\n" +" ejecutables\n" +" -D, --disassemble-all Muestra el contenido de ensamblador de todas las\n" +" secciones\n" +" -S, --source Intermezclar código fuente con el desensamblado\n" +" -s, --full-contents Muestra el contenido completo de todas las secciones\n" +" requeridas\n" +" -g, --debugging Muestra la información de depuración en el fichero\n" +" objeto\n" +" -G, --stabs Muestra (sin formato) cualquier información de STABS\n" +" en el fichero\n" +" -t, --syms Muestra el contenido de la(s) tabla(s) de símbolos\n" +" -T, --dynamic-syms Muestra el contenido de la tabla de símbolos dinámicos\n" +" -r, --reloc Muestra las entradas de reubicación en el fichero\n" +" -R, --dynamic-reloc Muestra las entradas de reubicación dinámica en el\n" +" fichero\n" +" -v, --version Muestra el número de versión de este programa\n" +" -i, --info Enlista los formatos objeto y las arquitecturas\n" +" con soporte\n" +" -H, --help Muestra esta información\n" + +#: objdump.c:222 +msgid "" +"\n" +" The following switches are optional:\n" +msgstr "" +"\n" +" Los siguientes interruptores son opcionales:\n" + +#: objdump.c:223 +msgid "" +" -b, --target=BFDNAME Specify the target object format as BFDNAME\n" +" -m, --architecture=MACHINE Specify the target architecture as MACHINE\n" +" -j, --section=NAME Only display information for section NAME\n" +" -M, --disassembler-options=OPT Pass text OPT on to the disassembler\n" +" -EB --endian=big Assume big endian format when disassembling\n" +" -EL --endian=little Assume little endian format when disassembling\n" +" --file-start-context Include context from start of file (with -S)\n" +" -l, --line-numbers Include line numbers and filenames in output\n" +" -C, --demangle[=STYLE] Decode mangled/processed symbol names\n" +" The STYLE, if specified, can be `auto', `gnu',\n" +" `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n" +" or `gnat'\n" +" -w, --wide Format output for more than 80 columns\n" +" -z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling\n" +" --start-address=ADDR Only process data whose address is >= ADDR\n" +" --stop-address=ADDR Only process data whose address is <= ADDR\n" +" --prefix-addresses Print complete address alongside disassembly\n" +" --[no-]show-raw-insn Display hex alongside symbolic disassembly\n" +" --adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n" +"\n" +msgstr "" +" -b, --target=NOMBREBFD Especifica el formato objeto objetivo como NOMBREBFD\n" +" -m, --architecture=MÁQUINA Especifica la arquitectura objetivo como MÁQUINA\n" +" -j, --section=NOMBRE Sólo muestra la información de la sección NOMBRE\n" +" -M, --disassembler-options=OPT Pasa el texto OPT al desensamblador\n" +" -EB --endian=big Asume el formato big endian al desensamblar\n" +" -EL --endian=little Asume el formato little endian al desensamblar\n" +" --file-start-context Incluye el contexto del inicio del fichero (con -S)\n" +" -l, --line-numbers Incluye los números de línea y los nombres de fichero\n" +" en la salida\n" +" -C, --demangle[=ESTILO] Decodifica los nombres de símbolo obtenidos/procesados\n" +" El ESTILO, si se especifica, puede ser `auto', 'gnu',\n" +" `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n" +" o `gnat'\n" +" -w, --wide Da formato a la salida para más de 80 columnas\n" +" -z, --disassemble-zeroes No salta los bloques de ceros al desensamblar\n" +" --start-address=DIR Sólo procesa los datos cuya dirección es >= DIR\n" +" --stop-address=DIR Sólo procesa los datos cuya dirección es <= DIR\n" +" --prefix-addresses Muestra las direcciones completas a lo largo del desensamblado\n" +" --[no-]show-raw-insn Muestra en hexadecimal a lo largo del desensamblado simbólico\n" +" --adjust-vma=DESPL Agrega el DESPLazamiento a todas las direcciones\n" +" mostradas de sección\n" +"\n" + +#: objdump.c:391 +msgid "Sections:\n" +msgstr "Secciones:\n" + +#: objdump.c:394 objdump.c:398 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "Ind Nombre Tamaño VMA LMA Desp fich Alin" + +#: objdump.c:400 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "Ind Nombre Tamaño VMA LMA Desp fich Alin" + +#: objdump.c:404 +msgid " Flags" +msgstr " Opciones" + +#: objdump.c:406 +msgid " Pg" +msgstr " Pg" + +#: objdump.c:451 +#, c-format +msgid "%s: not a dynamic object" +msgstr "%s: no es un objeto dinámico" + +#: objdump.c:1144 +msgid "Out of virtual memory" +msgstr "Memoria agotada" + +#: objdump.c:1574 +#, c-format +msgid "Can't use supplied machine %s" +msgstr "No se puede utilizar la máquina %s proporcionada" + +#: objdump.c:1592 +#, c-format +msgid "Can't disassemble for architecture %s\n" +msgstr "No se puede desensamblar para la arquitectura %s\n" + +#: objdump.c:1682 +#, c-format +msgid "Disassembly of section %s:\n" +msgstr "Desensamblado de la sección %s:\n" + +#: objdump.c:1847 +#, c-format +msgid "" +"No %s section present\n" +"\n" +msgstr "" +"No está presente la sección %s\n" +"\n" + +#: objdump.c:1854 +#, c-format +msgid "%s has no %s section" +msgstr "%s no tiene una sección %s" + +#: objdump.c:1868 +#, c-format +msgid "Reading %s section of %s failed: %s" +msgstr "Falló al leer la sección %s de %s: %s" + +#: objdump.c:1880 +#, c-format +msgid "Reading %s section of %s failed: %s\n" +msgstr "Falló al leer la sección %s de %s: %s\n" + +#: objdump.c:1923 +#, c-format +msgid "" +"Contents of %s section:\n" +"\n" +msgstr "" +"Contenido de la sección %s:\n" +"\n" + +#: objdump.c:2021 +#, c-format +msgid "architecture: %s, " +msgstr "arquitectura: %s, " + +#: objdump.c:2024 +#, c-format +msgid "flags 0x%08x:\n" +msgstr "opciones 0x%08x:\n" + +#: objdump.c:2038 +msgid "" +"\n" +"start address 0x" +msgstr "" +"\n" +"dirección de inicio 0x" + +#: objdump.c:2071 +#, c-format +msgid "" +"\n" +"%s: file format %s\n" +msgstr "" +"\n" +"%s: formato del fichero %s\n" + +#: objdump.c:2111 +#, c-format +msgid "%s: printing debugging information failed" +msgstr "%s: falló al mostrar la información de depuración" + +#: objdump.c:2190 +#, c-format +msgid "In archive %s:\n" +msgstr "En el fichero %s:\n" + +#: objdump.c:2249 +#, c-format +msgid "Contents of section %s:\n" +msgstr "Contenido de la sección %s:\n" + +#: objdump.c:2369 +msgid "no symbols\n" +msgstr "no hay símbolos\n" + +#: objdump.c:2718 +msgid "unrecognized -E option" +msgstr "opción -E no reconocida" + +#: objdump.c:2729 +#, c-format +msgid "unrecognized --endian type `%s'" +msgstr "tipo --endian `%s' no reconocido" + +#: rdcoff.c:206 +#, c-format +msgid "parse_coff_type: Bad type code 0x%x" +msgstr "parse_coff_type: Código de tipo 0x%x erróneo" + +#: rdcoff.c:424 rdcoff.c:532 rdcoff.c:731 +#, c-format +msgid "bfd_coff_get_syment failed: %s" +msgstr "bfd_coff_get_syment falló: %s" + +#: rdcoff.c:440 rdcoff.c:751 +#, c-format +msgid "bfd_coff_get_auxent failed: %s" +msgstr "bfd_coff_get_auxent falló: %s" + +#: rdcoff.c:818 +#, c-format +msgid "%ld: .bf without preceding function" +msgstr "%ld: .bf sin una función precedente" + +#: rdcoff.c:868 +#, c-format +msgid "%ld: unexpected .ef\n" +msgstr "%ld: .ef inesperado\n" + +#: rddbg.c:91 +#, c-format +msgid "%s: no recognized debugging information" +msgstr "%s: no se reconoce la información de depuración" + +#: rddbg.c:415 +msgid "Last stabs entries before error:\n" +msgstr "Últimas entradas stabs antes del error:\n" + +#: readelf.c:455 +#, c-format +msgid "%s: Error: " +msgstr "%s: Error: " + +#: readelf.c:466 +#, c-format +msgid "%s: Warning: " +msgstr "%s: Aviso: " + +#: readelf.c:488 +#, c-format +msgid "Unable to seek to 0x%x for %s\n" +msgstr "No se puede buscar a 0x%x para %s\n" + +#: readelf.c:499 +#, c-format +msgid "Out of memory allocating 0x%x bytes for %s\n" +msgstr "Memoria agotada al asignar 0x%x bytes para %s\n" + +#: readelf.c:507 +#, c-format +msgid "Unable to read in 0x%x bytes of %s\n" +msgstr "No se pueden leer 0x%x bytes de %s\n" + +#: readelf.c:560 readelf.c:614 readelf.c:798 readelf.c:833 +#, c-format +msgid "Unhandled data length: %d\n" +msgstr "Longitud de datos sin manejar: %d\n" + +#: readelf.c:924 +msgid "Don't know about relocations on this machine architecture\n" +msgstr "No se conocen las reubicaciones en esta arquitectura de máquina\n" + +#: readelf.c:946 readelf.c:975 readelf.c:1021 readelf.c:1049 +msgid "relocs" +msgstr "reubicaciones" + +#: readelf.c:957 readelf.c:986 readelf.c:1031 readelf.c:1059 +msgid "out of memory parsing relocs" +msgstr "memoria agotada al decodificar reubicaciones" + +#: readelf.c:1112 +msgid " Offset Info Type Sym. Value Symbol's Name + Addend\n" +msgstr " Desplaz Info Tipo Val. Símbolo Nombre Símbolo + Adend\n" + +#: readelf.c:1114 +msgid " Offset Info Type Sym.Value Sym. Name + Addend\n" +msgstr " Desplaz Info Tipo Val.Símbolo Nom.Símbolo + Adend\n" + +#: readelf.c:1119 +msgid " Offset Info Type Sym. Value Symbol's Name\n" +msgstr " Desplaz Info Tipo Val. Símbolo Nombre Símbolo\n" + +#: readelf.c:1121 +msgid " Offset Info Type Sym.Value Sym. Name\n" +msgstr " Desplaz Info Tipo Val.Símbolo Nom. Símbolo\n" + +#: readelf.c:1129 +msgid " Offset Info Type Symbol's Value Symbol's Name + Addend\n" +msgstr " Desplaz Info Tipo Valor Símbolo Nombre Símbolo + Adend\n" + +#: readelf.c:1131 +msgid " Offset Info Type Sym. Value Sym. Name + Addend\n" +msgstr " Desplaz Info Tipo Val. Símbolo Nom. Símbolo + Adend\n" + +#: readelf.c:1136 +msgid " Offset Info Type Symbol's Value Symbol's Name\n" +msgstr " Desplaz Info Tipo Valor Símbolo Nombre Símbolo\n" + +#: readelf.c:1138 +msgid " Offset Info Type Sym. Value Sym. Name\n" +msgstr " Desplaz Info Tipo Val. Símbolo Nom. Símbolo\n" + +#: readelf.c:1414 readelf.c:1416 readelf.c:1492 readelf.c:1494 readelf.c:1503 +#: readelf.c:1505 +#, c-format +msgid "unrecognized: %-7lx" +msgstr "no reconocido: %-7lx" + +#: readelf.c:1466 +#, c-format +msgid "" +msgstr "<índice de la tabla de cadenas %3ld>" + +#: readelf.c:1743 +#, c-format +msgid "Processor Specific: %lx" +msgstr "Específico del Procesador: %lx" + +#: readelf.c:1762 +#, c-format +msgid "Operating System specific: %lx" +msgstr "específico del Sistema Operativo: %lx" + +#: readelf.c:1765 readelf.c:2417 +#, c-format +msgid ": %lx" +msgstr ": %lx" + +#: readelf.c:1779 +msgid "NONE (None)" +msgstr "NONE (Ninguno)" + +#: readelf.c:1780 +msgid "REL (Relocatable file)" +msgstr "REL (Fichero reubicable)" + +#: readelf.c:1781 +msgid "EXEC (Executable file)" +msgstr "EXEC (Fichero ejecutable)" + +#: readelf.c:1782 +msgid "DYN (Shared object file)" +msgstr "DYN (Fichero objeto compartido)" + +#: readelf.c:1783 +msgid "CORE (Core file)" +msgstr "CORE (Fichero núcleo)" + +#: readelf.c:1787 +#, c-format +msgid "Processor Specific: (%x)" +msgstr "Específico del Procesado: (%x)" + +#: readelf.c:1789 +#, c-format +msgid "OS Specific: (%x)" +msgstr "Específico del SO: (%x)" + +#: readelf.c:1791 readelf.c:1898 readelf.c:2574 +#, c-format +msgid ": %x" +msgstr ": %x" + +#: readelf.c:1804 +msgid "None" +msgstr "Ninguno" + +#: readelf.c:2616 +msgid "Usage: readelf elf-file(s)\n" +msgstr "Modo de empleo: readelf fichero(s)-elf\n" + +#: readelf.c:2617 +msgid " Display information about the contents of ELF format files\n" +msgstr " Muestra información sobre el contenido de los ficheros de formato ELF\n" + +#: readelf.c:2618 +msgid "" +" Options are:\n" +" -a --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" +" -h --file-header Display the ELF file header\n" +" -l --program-headers Display the program headers\n" +" --segments An alias for --program-headers\n" +" -S --section-headers Display the sections' header\n" +" --sections An alias for --section-headers\n" +" -e --headers Equivalent to: -h -l -S\n" +" -s --syms Display the symbol table\n" +" --symbols An alias for --syms\n" +" -n --notes Display the core notes (if present)\n" +" -r --relocs Display the relocations (if present)\n" +" -u --unwind Display the unwind info (if present)\n" +" -d --dynamic Display the dynamic segment (if present)\n" +" -V --version-info Display the version sections (if present)\n" +" -A --arch-specific Display architecture specific information (if any).\n" +" -D --use-dynamic Use the dynamic section info when displaying symbols\n" +" -x --hex-dump= Dump the contents of section \n" +" -w[liaprmfFso] or\n" +" --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n" +" Display the contents of DWARF2 debug sections\n" +msgstr "" +" Las opciones son:\n" +" -a --all Equivalente a: -h -l -S -s -r -d -V -A -I\n" +" -h --file-header Muestra el encabezado del fichero ELF\n" +" -l --program-headers Muestra los encabezados del programa\n" +" --segments Un alias para --program-headers\n" +" -S --section-headers Muestra el encabezado de las secciones\n" +" --sections Un alias para --section-headers\n" +" -e --headers Equivalente a: -h -l -S\n" +" -s --syms Muestra la tabla de símbolos\n" +" --symbols Un alias para --syms\n" +" -n --notes Muestra las notas de núcleo (si están presentes)\n" +" -r --relocs Muestra las reubicaciones (si están presentes)\n" +" -u --unwind Muestra la información de desenredo (si está presente)\n" +" -d --dynamic Muestra el segmento dinámico (si está presente)\n" +" -V --version-info Muestra las secciones de versión (si están presentes)\n" +" -A --arch-specific Muestra la información específica de la arquitectura\n" +" (si hay alguna).\n" +" -D --use-dynamic Usa la información de la sección dinámica cuando\n" +" muestra símbolos\n" +" -x --hex-dump= Vuelca el contenido de la sección \n" +" -w[liaprmfFso] ó\n" +" --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n" +" Muestra el contenido de las secciones de depuración\n" +" DWARF2\n" + +#: readelf.c:2640 +msgid "" +" -i --instruction-dump=\n" +" Disassemble the contents of section \n" +msgstr "" +" -i --instruction-dump=\n" +" Desensambla el contenido de la sección \n" + +#: readelf.c:2644 +msgid "" +" -I --histogram Display histogram of bucket list lengths\n" +" -W --wide Allow output width to exceed 80 characters\n" +" -H --help Display this information\n" +" -v --version Display the version number of readelf\n" +msgstr "" +" -I --histogram Muestra un histograma de longitudes de la lista de\n" +" cubetas\n" +" -W --wide Permite que el ancho de la salida exceda 80 caracteres\n" +" -H --help Muestra esta información\n" +" -v --version Muestra el número de versión de readelf\n" + +#: readelf.c:2666 readelf.c:10765 +msgid "Out of memory allocating dump request table." +msgstr "Memoria agotada al asignar la tabla de petición de volcado." + +#: readelf.c:2830 readelf.c:2906 +#, c-format +msgid "Unrecognized debug option '%s'\n" +msgstr "Opción de depuración '%s' no reconocida\n" + +#: readelf.c:2940 +#, c-format +msgid "Invalid option '-%c'\n" +msgstr "Opción '-%c' inválida\n" + +#: readelf.c:2953 +msgid "Nothing to do.\n" +msgstr "Nada por hacer.\n" + +#: readelf.c:2966 readelf.c:2983 readelf.c:5366 +msgid "none" +msgstr "ninguno" + +#: readelf.c:2970 readelf.c:2987 readelf.c:3018 +#, c-format +msgid "" +msgstr "" + +#: readelf.c:2984 +msgid "2's complement, little endian" +msgstr "complemento a 2, little endian" + +#: readelf.c:2985 +msgid "2's complement, big endian" +msgstr "complemento a 2, big endian" + +#: readelf.c:3015 +msgid "Standalone App" +msgstr "Aplicación por Sí Sola" + +#: readelf.c:3034 +msgid "Not an ELF file - it has the wrong magic bytes at the start\n" +msgstr "No es un fichero ELF - tiene los bytes mágicos erróneos en el inicio\n" + +#: readelf.c:3042 +msgid "ELF Header:\n" +msgstr "Encabezado ELF:\n" + +#: readelf.c:3043 +msgid " Magic: " +msgstr " Mágico: " + +#: readelf.c:3047 +#, c-format +msgid " Class: %s\n" +msgstr " Clase: %s\n" + +#: readelf.c:3049 +#, c-format +msgid " Data: %s\n" +msgstr " Datos: %s\n" + +#: readelf.c:3051 +#, c-format +msgid " Version: %d %s\n" +msgstr " Versión: %d %s\n" + +#: readelf.c:3058 +#, c-format +msgid " OS/ABI: %s\n" +msgstr " OS/ABI: %s\n" + +#: readelf.c:3060 +#, c-format +msgid " ABI Version: %d\n" +msgstr " Versión ABI: %d\n" + +#: readelf.c:3062 +#, c-format +msgid " Type: %s\n" +msgstr " Tipo: %s\n" + +#: readelf.c:3064 +#, c-format +msgid " Machine: %s\n" +msgstr " Máquina: %s\n" + +#: readelf.c:3066 +#, c-format +msgid " Version: 0x%lx\n" +msgstr " Versión: 0x%lx\n" + +#: readelf.c:3069 +msgid " Entry point address: " +msgstr " Dirección del punto de entrada: " + +#: readelf.c:3071 +msgid "" +"\n" +" Start of program headers: " +msgstr "" +"\n" +" Inicio de encabezados de programa: " + +#: readelf.c:3073 +msgid "" +" (bytes into file)\n" +" Start of section headers: " +msgstr "" +" (bytes en el fichero)\n" +" Inicio de encabezados de sección: " + +#: readelf.c:3075 +msgid " (bytes into file)\n" +msgstr " (bytes en el fichero)\n" + +#: readelf.c:3077 +#, c-format +msgid " Flags: 0x%lx%s\n" +msgstr " Opciones: 0x%lx%s\n" + +#: readelf.c:3080 +#, c-format +msgid " Size of this header: %ld (bytes)\n" +msgstr " Tamaño de este encabezado: %ld (bytes)\n" + +#: readelf.c:3082 +#, c-format +msgid " Size of program headers: %ld (bytes)\n" +msgstr " Tamaño de encabezados de programa: %ld (bytes)\n" + +#: readelf.c:3084 +#, c-format +msgid " Number of program headers: %ld\n" +msgstr " Número de encabezados de programa: %ld\n" + +#: readelf.c:3086 +#, c-format +msgid " Size of section headers: %ld (bytes)\n" +msgstr " Tamaño de encabezados de sección: %ld (bytes)\n" + +#: readelf.c:3088 +#, c-format +msgid " Number of section headers: %ld" +msgstr " Número de encabezados de sección: %ld" + +#: readelf.c:3093 +#, c-format +msgid " Section header string table index: %ld" +msgstr " Índice de tabla de cadenas de sección de encabezado: %ld" + +#: readelf.c:3127 readelf.c:3163 +msgid "program headers" +msgstr "encabezados de programa" + +#: readelf.c:3203 readelf.c:3480 readelf.c:3526 readelf.c:3589 readelf.c:3656 +#: readelf.c:4715 readelf.c:4758 readelf.c:4948 readelf.c:5917 readelf.c:5931 +#: readelf.c:10411 +msgid "Out of memory\n" +msgstr "Memoria agotada\n" + +#: readelf.c:3231 +msgid "" +"\n" +"There are no program headers in this file.\n" +msgstr "" +"\n" +"No hay encabezados de programa en este fichero.\n" + +#: readelf.c:3237 +#, c-format +msgid "" +"\n" +"Elf file type is %s\n" +msgstr "" +"\n" +"El tipo del fichero elf es %s\n" + +#: readelf.c:3238 +msgid "Entry point " +msgstr "Punto de entrada " + +#: readelf.c:3240 +#, c-format +msgid "" +"\n" +"There are %d program headers, starting at offset " +msgstr "" +"\n" +"Hay %d encabezados de programa, empezando en el desplazamiento " + +#: readelf.c:3252 readelf.c:3254 +msgid "" +"\n" +"Program Headers:\n" +msgstr "" +"\n" +"Encabezados de Programa:\n" + +#: readelf.c:3258 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr " Tipo Desplaz DirVirt DirFísica TamFich TamMem Opt Alin\n" + +#: readelf.c:3261 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr " Tipo Desplaz DirVirt DirFísica TamFich TamMem Opt Alin\n" + +#: readelf.c:3265 +msgid " Type Offset VirtAddr PhysAddr\n" +msgstr " Tipo Desplazamiento DirVirtual DirFísica\n" + +#: readelf.c:3267 +msgid " FileSiz MemSiz Flags Align\n" +msgstr " TamFichero TamMemoria Opts Alineación\n" + +#: readelf.c:3360 +msgid "more than one dynamic segment\n" +msgstr "más de un segmento dinámico\n" + +#: readelf.c:3368 +msgid "Unable to find program interpreter name\n" +msgstr "No se puede encontrar el nombre del programa intérprete\n" + +#: readelf.c:3375 +#, c-format +msgid "" +"\n" +" [Requesting program interpreter: %s]" +msgstr "" +"\n" +" [Solicitando el programa intérprete: %s]" + +#: readelf.c:3387 +msgid "" +"\n" +" Section to Segment mapping:\n" +msgstr "" +"\n" +" mapeo de Sección a Segmento:\n" + +#: readelf.c:3388 +msgid " Segment Sections...\n" +msgstr " Segmento Secciones...\n" + +#: readelf.c:3437 +msgid "Cannot interpret virtual addresses without program headers.\n" +msgstr "No se pueden interpretar direcciones virtuales sin encabezados de programa.\n" + +#: readelf.c:3453 +#, c-format +msgid "Virtual address 0x%lx not located in any PT_LOAD segment.\n" +msgstr "La dirección virtual 0x%lx no está ubicada en ningún segmento PT_LOAD.\n" + +#: readelf.c:3471 readelf.c:3517 +msgid "section headers" +msgstr "encabezados de sección" + +#: readelf.c:3565 readelf.c:3632 +msgid "symbols" +msgstr "símbolos" + +# ¿Cómo se traduce esto? cfuga +#: readelf.c:3576 readelf.c:3643 +msgid "symtab shndx" +msgstr "symtab shndx" + +#: readelf.c:3745 +msgid "" +"\n" +"There are no sections in this file.\n" +msgstr "" +"\n" +"No hay secciones en este fichero.\n" + +#: readelf.c:3751 +#, c-format +msgid "There are %d section headers, starting at offset 0x%lx:\n" +msgstr "Hay %d encabezados de sección, comenzando en el desplazamiento: 0x%lx:\n" + +#: readelf.c:3768 readelf.c:4098 readelf.c:4433 readelf.c:6070 +msgid "string table" +msgstr "tabla de cadenas" + +#: readelf.c:3793 +msgid "File contains multiple dynamic symbol tables\n" +msgstr "El fichero contiene múltiples tablas dinámicas de símbolos\n" + +#: readelf.c:3805 +msgid "File contains multiple dynamic string tables\n" +msgstr "El fichero contiene múltiples tablas dinámicas de cadenas\n" + +#: readelf.c:3811 +msgid "dynamic strings" +msgstr "cadenas dinámicas" + +#: readelf.c:3817 +msgid "File contains multiple symtab shndx tables\n" +msgstr "El fichero contiene múltiples tablas symtab shndx\n" + +#: readelf.c:3855 +msgid "" +"\n" +"Section Headers:\n" +msgstr "" +"\n" +"Encabezados de Sección:\n" + +#: readelf.c:3857 +msgid "" +"\n" +"Section Header:\n" +msgstr "" +"\n" +"Encabezados de Sección:\n" + +#: readelf.c:3861 +msgid " [Nr] Name Type Addr Off Size ES Flg Lk Inf Al\n" +msgstr " [Nr] Nombre Tipo Direc Desp Tam ES Opt En Inf Al\n" + +#: readelf.c:3864 +msgid " [Nr] Name Type Address Off Size ES Flg Lk Inf Al\n" +msgstr " [Nr] Nombre Tipo Direc Desp Tam ES Opt En Inf Al\n" + +#: readelf.c:3867 +msgid " [Nr] Name Type Address Offset\n" +msgstr " [Nr] Nombre Tipo Dirección Despl\n" + +#: readelf.c:3868 +msgid " Size EntSize Flags Link Info Align\n" +msgstr " Tamaño TamEnt Opts Enl Info Alin\n" + +#: readelf.c:3963 +msgid "" +"Key to Flags:\n" +" W (write), A (alloc), X (execute), M (merge), S (strings)\n" +" I (info), L (link order), G (group), x (unknown)\n" +" O (extra OS processing required) o (OS specific), p (processor specific)\n" +msgstr "" +"Clave para Opciones:\n" +" W (escribir), A (asignar), X (ejecutar), M (mezclar), S (cadenas)\n" +" I (info), L (orden enlazado), G (grupo), x (desconocido)\n" +" O (se requiere procesamiento extra del SO) o (específico del SO)\n" +" p (específico del procesador)\n" + +#: readelf.c:4031 +#, c-format +msgid "" +"\n" +"'%s' relocation section at offset 0x%lx contains %ld bytes:\n" +msgstr "" +"\n" +"'%s' la sección de reubicación en el desplazamiento 0x%lx contiene %ld bytes:\n" + +#: readelf.c:4043 +msgid "" +"\n" +"There are no dynamic relocations in this file.\n" +msgstr "" +"\n" +"No hay reubicaciones dinámicas en este fichero.\n" + +#: readelf.c:4070 +msgid "" +"\n" +"Relocation section " +msgstr "" +"\n" +"La sección de reubicación " + +#: readelf.c:4075 readelf.c:4496 readelf.c:4510 +#, c-format +msgid "'%s'" +msgstr "'%s'" + +#: readelf.c:4077 readelf.c:4512 +#, c-format +msgid " at offset 0x%lx contains %lu entries:\n" +msgstr " en el desplazamiento 0x%lx contiene %lu entradas:\n" + +#: readelf.c:4115 +msgid "" +"\n" +"There are no relocations in this file.\n" +msgstr "" +"\n" +"No hay reubicaciones en este fichero.\n" + +#: readelf.c:4299 +msgid "unwind table" +msgstr "tabla desenredada" + +#: readelf.c:4350 readelf.c:4362 readelf.c:8499 readelf.c:8511 +#, c-format +msgid "Skipping unexpected symbol type %u\n" +msgstr "Saltando el tipo de símbolo %u inesperado\n" + +#: readelf.c:4370 +#, c-format +msgid "Skipping unexpected relocation type %s\n" +msgstr "Saltando el tipo de reubicación %s inesperado\n" + +#: readelf.c:4415 readelf.c:4440 +msgid "" +"\n" +"There are no unwind sections in this file.\n" +msgstr "" +"\n" +"No hay secciones de desenredo en este fichero.\n" + +#: readelf.c:4491 +msgid "" +"\n" +"Could not find unwind info section for " +msgstr "" +"\n" +"No se puede encontrar la sección de información de desenredo para " + +#: readelf.c:4503 +msgid "unwind info" +msgstr "información de desenredo" + +#: readelf.c:4505 +msgid "" +"\n" +"Unwind section " +msgstr "" +"\n" +"Sección de desenredo " + +#: readelf.c:4699 readelf.c:4742 +msgid "dynamic segment" +msgstr "segmento dinámico" + +#: readelf.c:4820 +msgid "" +"\n" +"There is no dynamic segment in this file.\n" +msgstr "" +"\n" +"No hay segmento dinámico en este fichero.\n" + +#: readelf.c:4854 +msgid "Unable to seek to end of file!" +msgstr "¡No se puede alcanzar el final del fichero!" + +#: readelf.c:4865 +msgid "Unable to determine the number of symbols to load\n" +msgstr "No se puede determinar el número de símbolos a cargar\n" + +#: readelf.c:4895 +msgid "Unable to seek to end of file\n" +msgstr "No se puede alcanzar el final del fichero\n" + +#: readelf.c:4901 +msgid "Unable to determine the length of the dynamic string table\n" +msgstr "No se puede determinar la longitud de la tabla dinámica de cadenas\n" + +#: readelf.c:4906 +msgid "dynamic string table" +msgstr "tabla de cadena dinámicas" + +#: readelf.c:4941 +msgid "symbol information" +msgstr "información del símbolo" + +#: readelf.c:4965 +#, c-format +msgid "" +"\n" +"Dynamic segment at offset 0x%lx contains %ld entries:\n" +msgstr "" +"\n" +"El segmento dinámico en el desplazamiento 0x%lx contiene %ld entradas:\n" + +#: readelf.c:4968 +msgid " Tag Type Name/Value\n" +msgstr " Marca Tipo Nombre/Valor\n" + +#: readelf.c:5004 +msgid "Auxiliary library" +msgstr "Biblioteca auxiliar" + +#: readelf.c:5008 +msgid "Filter library" +msgstr "Biblioteca de filtro" + +#: readelf.c:5012 +msgid "Configuration file" +msgstr "Fichero de configuración" + +#: readelf.c:5016 +msgid "Dependency audit library" +msgstr "Biblioteca de auditoría de dependencias" + +#: readelf.c:5020 +msgid "Audit library" +msgstr "Biblioteca de auditoría" + +#: readelf.c:5038 readelf.c:5066 readelf.c:5094 +msgid "Flags:" +msgstr "Opciones:" + +#: readelf.c:5041 readelf.c:5069 readelf.c:5096 +msgid " None\n" +msgstr " Ninguna\n" + +#: readelf.c:5217 +#, c-format +msgid "Shared library: [%s]" +msgstr "Biblioteca compartida: [%s]" + +#: readelf.c:5220 +msgid " program interpreter" +msgstr " programa intérprete" + +#: readelf.c:5224 +#, c-format +msgid "Library soname: [%s]" +msgstr "Nombre-so de la biblioteca: [%s]" + +#: readelf.c:5228 +#, c-format +msgid "Library rpath: [%s]" +msgstr "Rpath de la biblioteca: [%s]" + +#: readelf.c:5232 +#, c-format +msgid "Library runpath: [%s]" +msgstr "Ruta de ejecución de la biblioteca: [%s]" + +#: readelf.c:5296 +#, c-format +msgid "Not needed object: [%s]\n" +msgstr "Objeto innecesario: [%s]\n" + +#: readelf.c:5412 +#, c-format +msgid "" +"\n" +"Version definition section '%s' contains %ld entries:\n" +msgstr "" +"\n" +"La sección de definición de la versión '%s' contiene %ld entradas:\n" + +#: readelf.c:5415 +msgid " Addr: 0x" +msgstr " Dir: 0x" + +#: readelf.c:5417 readelf.c:5612 +#, c-format +msgid " Offset: %#08lx Link: %lx (%s)\n" +msgstr " Despl: %#08lx Enl: %lx (%s)\n" + +#: readelf.c:5424 +msgid "version definition section" +msgstr "sección de definición de versión" + +#: readelf.c:5450 +#, c-format +msgid " %#06x: Rev: %d Flags: %s" +msgstr " %#06x: Rev: %d Opts: %s" + +#: readelf.c:5453 +#, c-format +msgid " Index: %d Cnt: %d " +msgstr " Ind: %d Cnt: %d " + +#: readelf.c:5464 +#, c-format +msgid "Name: %s\n" +msgstr "Nombre: %s\n" + +#: readelf.c:5466 +#, c-format +msgid "Name index: %ld\n" +msgstr "Índice de nombres: %ld\n" + +#: readelf.c:5481 +#, c-format +msgid " %#06x: Parent %d: %s\n" +msgstr " %#06x: Padre %d: %s\n" + +#: readelf.c:5484 +#, c-format +msgid " %#06x: Parent %d, name index: %ld\n" +msgstr " %#06x: Padre %d, índice de nombres: %ld\n" + +#: readelf.c:5503 +#, c-format +msgid "" +"\n" +"Version needs section '%s' contains %ld entries:\n" +msgstr "" +"\n" +"La sección de requerimientos de versión '%s' contiene %ld entradas:\n" + +#: readelf.c:5506 +msgid " Addr: 0x" +msgstr " Dir: 0x" + +#: readelf.c:5508 +#, c-format +msgid " Offset: %#08lx Link to section: %ld (%s)\n" +msgstr " Despl: %#08lx Enlace a sección: %ld (%s)\n" + +#: readelf.c:5514 +msgid "version need section" +msgstr "sección de versiones necesarias" + +#: readelf.c:5536 +#, c-format +msgid " %#06x: Version: %d" +msgstr " %#06x: Versión: %d" + +#: readelf.c:5539 +#, c-format +msgid " File: %s" +msgstr " Fichero: %s" + +#: readelf.c:5541 +#, c-format +msgid " File: %lx" +msgstr " Fichero: %lx" + +#: readelf.c:5543 +#, c-format +msgid " Cnt: %d\n" +msgstr " Cnt: %d\n" + +#: readelf.c:5561 +#, c-format +msgid " %#06x: Name: %s" +msgstr " %#06x: Nombre: %s" + +#: readelf.c:5564 +#, c-format +msgid " %#06x: Name index: %lx" +msgstr " %#06x: Índice de nombres: %lx" + +#: readelf.c:5567 +#, c-format +msgid " Flags: %s Version: %d\n" +msgstr " Opts: %s Versión: %d\n" + +#: readelf.c:5603 +msgid "version string table" +msgstr "versión de tabla de cadenas" + +#: readelf.c:5607 +#, c-format +msgid "" +"\n" +"Version symbols section '%s' contains %d entries:\n" +msgstr "" +"\n" +"La sección de símbolos de versión '%s' contiene %d entradas:\n" + +#: readelf.c:5610 +msgid " Addr: " +msgstr " Dir: " + +#: readelf.c:5622 +msgid "version symbol data" +msgstr "datos de símbolos de versión" + +#: readelf.c:5649 +msgid " 0 (*local*) " +msgstr " 0 (*local*) " + +#: readelf.c:5653 +msgid " 1 (*global*) " +msgstr " 1 (*global*) " + +#: readelf.c:5689 readelf.c:6129 +msgid "version need" +msgstr "la versión necesita" + +#: readelf.c:5699 +msgid "version need aux (2)" +msgstr "la versión necesita aux (2)" + +#: readelf.c:5741 readelf.c:6192 +msgid "version def" +msgstr "versión definida" + +#: readelf.c:5760 readelf.c:6207 +msgid "version def aux" +msgstr "versión definida auxiliar" + +#: readelf.c:5791 +msgid "" +"\n" +"No version information found in this file.\n" +msgstr "" +"\n" +"No se encontró información de versión en este fichero.\n" + +#: readelf.c:5923 +msgid "Unable to read in dynamic data\n" +msgstr "No se pueden leer los datos dinámicos\n" + +#: readelf.c:5967 +msgid "Unable to seek to start of dynamic information" +msgstr "No se puede encontrar el inicio de la información dinámica" + +#: readelf.c:5973 +msgid "Failed to read in number of buckets\n" +msgstr "Falló la lectura en el número de cubos\n" + +#: readelf.c:5979 +msgid "Failed to read in number of chains\n" +msgstr "Falló la lectura en el número de cadenas\n" + +#: readelf.c:5999 +msgid "" +"\n" +"Symbol table for image:\n" +msgstr "" +"\n" +"Tabla de símbolos por imagen:\n" + +#: readelf.c:6001 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " Num Cub: Valor Tamaño Tipo Uni Vis Nombre Ind\n" + +#: readelf.c:6003 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " Num Cub: Valor Tamaño Typo Uni Vis Nombre Ind\n" + +#: readelf.c:6048 +#, c-format +msgid "" +"\n" +"Symbol table '%s' contains %lu entries:\n" +msgstr "" +"\n" +"La tabla de símbolos '%s' contiene %lu entradas:\n" + +#: readelf.c:6052 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " Num: Valor Tam Tipo Unión Vis Nombre Ind\n" + +#: readelf.c:6054 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " Num: Valor Tam Tipo Unión Vis Nombre Ind\n" + +#: readelf.c:6101 +msgid "version data" +msgstr "datos de versión" + +#: readelf.c:6142 +msgid "version need aux (3)" +msgstr "la versión necesita aux (3)" + +#: readelf.c:6167 +msgid "bad dynamic symbol" +msgstr "símbolo dinámico erróneo" + +#: readelf.c:6230 +msgid "" +"\n" +"Dynamic symbol information is not available for displaying symbols.\n" +msgstr "" +"\n" +"La información de símbolos dinámicos no está disponible para mostrar los símbolos.\n" + +#: readelf.c:6242 +#, c-format +msgid "" +"\n" +"Histogram for bucket list length (total of %d buckets):\n" +msgstr "" +"\n" +"Histograma para la longitud de lista de cubos (total de %d cubos):\n" + +#: readelf.c:6244 +#, c-format +msgid " Length Number %% of total Coverage\n" +msgstr " Long Número %% del total Cobertura\n" + +#: readelf.c:6249 readelf.c:6268 readelf.c:9898 readelf.c:10090 +msgid "Out of memory" +msgstr "Memoria agotada" + +#: readelf.c:6317 +#, c-format +msgid "" +"\n" +"Dynamic info segment at offset 0x%lx contains %d entries:\n" +msgstr "" +"\n" +"El segmento de información dinámica en el desplazamiento 0x%lx contiene %d entradas:\n" + +#: readelf.c:6320 +msgid " Num: Name BoundTo Flags\n" +msgstr " Num: Nombre EnlaceA Opts\n" + +#: readelf.c:6373 +#, c-format +msgid "" +"\n" +"Assembly dump of section %s\n" +msgstr "" +"\n" +"Volcado ensamblador de la sección %s\n" + +#: readelf.c:6396 +#, c-format +msgid "" +"\n" +"Section '%s' has no data to dump.\n" +msgstr "" +"\n" +"La sección '%s' no tiene datos para volcar.\n" + +#: readelf.c:6401 +#, c-format +msgid "" +"\n" +"Hex dump of section '%s':\n" +msgstr "" +"\n" +"Volcado hexadecimal de la sección '%s':\n" + +#: readelf.c:6406 +msgid "section data" +msgstr "datos de sección" + +#: readelf.c:6555 +msgid "badly formed extended line op encountered!\n" +msgstr "¡se encontró un operador extendido de línea mal formado!\n" + +#: readelf.c:6562 +#, c-format +msgid " Extended opcode %d: " +msgstr " Código de operación extendido %d: " + +#: readelf.c:6567 +msgid "" +"End of Sequence\n" +"\n" +msgstr "" +"Fin de la Secuencia\n" +"\n" + +#: readelf.c:6573 +#, c-format +msgid "set Address to 0x%lx\n" +msgstr "establecer la Dirección a 0x%lx\n" + +#: readelf.c:6578 +msgid " define new File Table entry\n" +msgstr " definir la nueva entrada en la Tabla de Ficheros\n" + +#: readelf.c:6579 readelf.c:6726 +msgid " Entry\tDir\tTime\tSize\tName\n" +msgstr " Entr\tDir\tHora\tTam\tNombre\n" + +#: readelf.c:6581 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:6584 readelf.c:6586 readelf.c:6588 readelf.c:6738 readelf.c:6740 +#: readelf.c:6742 +#, c-format +msgid "%lu\t" +msgstr "%lu\t" + +#: readelf.c:6589 +#, c-format +msgid "" +"%s\n" +"\n" +msgstr "" +"%s\n" +"\n" + +#: readelf.c:6593 +#, c-format +msgid "UNKNOWN: length %d\n" +msgstr "UNKNOWN: longitud %d\n" + +#: readelf.c:6621 +#, c-format +msgid "" +"\n" +"Dump of debug contents of section %s:\n" +"\n" +msgstr "" +"\n" +"Volcado del contenido de depuración de la sección %s:\n" +"\n" + +#: readelf.c:6649 +msgid "The line info appears to be corrupt - the section is too small\n" +msgstr "La información de línea parece estar corrupta - esta sección es demasiado pequeña\n" + +#: readelf.c:6658 +msgid "Only DWARF version 2 and 3 line info is currently supported.\n" +msgstr "Solamente la información de línea de DWARF versión 2 y 3 tiene soporte actualmente.\n" + +#: readelf.c:6679 +#, c-format +msgid " Length: %ld\n" +msgstr " Longitud: %ld\n" + +#: readelf.c:6680 +#, c-format +msgid " DWARF Version: %d\n" +msgstr " Versión DWARF: %d\n" + +#: readelf.c:6681 +#, c-format +msgid " Prologue Length: %d\n" +msgstr " Longitud del Prólogo: %d\n" + +#: readelf.c:6682 +#, c-format +msgid " Minimum Instruction Length: %d\n" +msgstr " Longitud Mínima Instrucción: %d\n" + +#: readelf.c:6683 +#, c-format +msgid " Initial value of 'is_stmt': %d\n" +msgstr " Valor inicial de 'is_stmt': %d\n" + +#: readelf.c:6684 +#, c-format +msgid " Line Base: %d\n" +msgstr " Base Línea: %d\n" + +#: readelf.c:6685 +#, c-format +msgid " Line Range: %d\n" +msgstr " Rango Lìnea: %d\n" + +#: readelf.c:6686 +#, c-format +msgid " Opcode Base: %d\n" +msgstr " Base de Código de Operación: %d\n" + +#: readelf.c:6695 +msgid "" +"\n" +" Opcodes:\n" +msgstr "" +"\n" +" Códigos de operación:\n" + +#: readelf.c:6698 +#, c-format +msgid " Opcode %d has %d args\n" +msgstr " El código de operación %d tiene %d argumentos\n" + +#: readelf.c:6704 +msgid "" +"\n" +" The Directory Table is empty.\n" +msgstr "" +"\n" +" La Tabla de Directorios está vacía.\n" + +#: readelf.c:6707 +msgid "" +"\n" +" The Directory Table:\n" +msgstr "" +"\n" +" La Tabla de Directorios:\n" + +#: readelf.c:6711 +#, c-format +msgid " %s\n" +msgstr " %s\n" + +#: readelf.c:6722 +msgid "" +"\n" +" The File Name Table is empty.\n" +msgstr "" +"\n" +" La Tabla de Nombres de Fichero está vacía.\n" + +#: readelf.c:6725 +msgid "" +"\n" +" The File Name Table:\n" +msgstr "" +"\n" +" La Tabla de Nombres de Fichero:\n" + +#: readelf.c:6733 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:6744 +#, c-format +msgid "%s\n" +msgstr "%s\n" + +#. Now display the statements. +#: readelf.c:6752 +msgid "" +"\n" +" Line Number Statements:\n" +msgstr "" +"\n" +" Declaraciones de Número de Línea:\n" + +#: readelf.c:6768 +#, c-format +msgid " Special opcode %d: advance Address by %d to 0x%lx" +msgstr " código de Operación especial %d: Dirección de avance por %d a 0x%lx" + +#: readelf.c:6772 +#, c-format +msgid " and Line by %d to %d\n" +msgstr " y Línea por %d a %d\n" + +#: readelf.c:6783 +msgid " Copy\n" +msgstr " Copiar\n" + +#: readelf.c:6790 +#, c-format +msgid " Advance PC by %d to %lx\n" +msgstr " Avanzar el PC por %d para %lx\n" + +#: readelf.c:6798 +#, c-format +msgid " Advance Line by %d to %d\n" +msgstr " Línea de Avance por %d para %d\n" + +#: readelf.c:6805 +#, c-format +msgid " Set File Name to entry %d in the File Name Table\n" +msgstr " Establecer el Nombre de Fichero para la entrada %d en la Tabla de Nombres de Fichero\n" + +#: readelf.c:6813 +#, c-format +msgid " Set column to %d\n" +msgstr " Establecer la columna a %d\n" + +#: readelf.c:6820 +#, c-format +msgid " Set is_stmt to %d\n" +msgstr " Establecer is_stmt a %d\n" + +#: readelf.c:6825 +msgid " Set basic block\n" +msgstr " Establecer el bloque básico\n" + +#: readelf.c:6833 +#, c-format +msgid " Advance PC by constant %d to 0x%lx\n" +msgstr " Avanzar el PC por la constante %d a 0x%lx\n" + +#: readelf.c:6841 +#, c-format +msgid " Advance PC by fixed size amount %d to 0x%lx\n" +msgstr " Avanzar el PC por la cantidad de tamaño fijo %d a 0x%lx\n" + +#: readelf.c:6846 +msgid " Set prologue_end to true\n" +msgstr " Establecer prologue_end a true\n" + +#: readelf.c:6850 +msgid " Set epilogue_begin to true\n" +msgstr " Establecer epilogue_begin a true\n" + +#: readelf.c:6856 +#, c-format +msgid " Set ISA to %d\n" +msgstr " Establecer ISA a %d\n" + +#: readelf.c:6860 +#, c-format +msgid " Unknown opcode %d with operands: " +msgstr " Código de operación desconocido %d con los operandos: " + +#: readelf.c:6891 readelf.c:7371 readelf.c:7443 +#, c-format +msgid "" +"Contents of the %s section:\n" +"\n" +msgstr "" +"Contenido de la sección %s:\n" +"\n" + +#: readelf.c:6931 +msgid "Only DWARF 2 and 3 pubnames are currently supported\n" +msgstr "Actualmente sólo tienen soporte los nombres públicos DWARF 2 y 3\n" + +#: readelf.c:6938 +#, c-format +msgid " Length: %ld\n" +msgstr " Longitud: %ld\n" + +#: readelf.c:6940 +#, c-format +msgid " Version: %d\n" +msgstr " Versión: %d\n" + +#: readelf.c:6942 +#, c-format +msgid " Offset into .debug_info section: %ld\n" +msgstr " Desplazamiento en sección .debug_info: %ld\n" + +#: readelf.c:6944 +#, c-format +msgid " Size of area in .debug_info section: %ld\n" +msgstr " Tamaño de área en sección .debug_info: %ld\n" + +#: readelf.c:6947 +msgid "" +"\n" +" Offset\tName\n" +msgstr "" +"\n" +" Desplazamiento\tNombre\n" + +#: readelf.c:7042 +#, c-format +msgid "Unknown TAG value: %lx" +msgstr "Valor TAG desconocido: %lx" + +#: readelf.c:7156 +#, c-format +msgid "Unknown AT value: %lx" +msgstr "Valor AT desconocido: %lx" + +#: readelf.c:7193 +#, c-format +msgid "Unknown FORM value: %lx" +msgstr "Valor FORM desconocido: %lx" + +#: readelf.c:7392 +#, c-format +msgid " DW_MACINFO_start_file - lineno: %d filenum: %d\n" +msgstr " DW_MACINFO_start_file - numlinea: %d numfichero: %d\n" + +#: readelf.c:7397 +msgid " DW_MACINFO_end_file\n" +msgstr " DW_MACINFO_end_file\n" + +#: readelf.c:7405 +#, c-format +msgid " DW_MACINFO_define - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_define - numlinea : %d macro : %s\n" + +#: readelf.c:7413 +#, c-format +msgid " DW_MACINFO_undef - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_undef - numlinea : %d macro : %s\n" + +#: readelf.c:7424 +#, c-format +msgid " DW_MACINFO_vendor_ext - constant : %d string : %s\n" +msgstr " DW_MACINFO_vendor_ext - constante : %d cadena : %s\n" + +#: readelf.c:7452 +msgid " Number TAG\n" +msgstr " Número TAG\n" + +#: readelf.c:7458 +#, c-format +msgid " %ld %s [%s]\n" +msgstr " %ld %s [%s]\n" + +#: readelf.c:7461 +msgid "has children" +msgstr "tiene hijos" + +#: readelf.c:7461 +msgid "no children" +msgstr "sin hijos" + +#: readelf.c:7465 +#, c-format +msgid " %-18s %s\n" +msgstr " %-18s %s\n" + +#: readelf.c:7486 +#, c-format +msgid " %lu byte block: " +msgstr " bloque de bytes %lu: " + +#: readelf.c:7814 +msgid "(User defined location op)" +msgstr "(Operador de ubicación definido por el usuario)" + +#: readelf.c:7816 +msgid "(Unknown location op)" +msgstr "(Operador de ubicación desconocido)" + +#: readelf.c:7855 +msgid "debug_loc section data" +msgstr "sección de datos debug_loc" + +#: readelf.c:7887 +msgid "" +"\n" +"The .debug_loc section is empty.\n" +msgstr "" +"\n" +"La sección .debug_loc está vacía.\n" + +#: readelf.c:7891 +msgid "" +"Contents of the .debug_loc section:\n" +"\n" +msgstr "" +"Contenido de la sección .debug_loc:\n" +"\n" + +#: readelf.c:7892 +msgid "" +"\n" +" Offset Begin End Expression\n" +msgstr "" +"\n" +" Desplaz Inicio Fin Expresión\n" + +#: readelf.c:7968 +msgid "debug_str section data" +msgstr "sección de datos debug_str" + +#: readelf.c:7987 +msgid "" +msgstr "" + +#: readelf.c:7990 +msgid "" +msgstr "" + +#: readelf.c:8009 +msgid "" +"\n" +"The .debug_str section is empty.\n" +msgstr "" +"\n" +"La sección .debug_str está vacía.\n" + +#: readelf.c:8013 +msgid "" +"Contents of the .debug_str section:\n" +"\n" +msgstr "" +"Contenido de la sección .debug_str:\n" +"\n" + +#: readelf.c:8088 +msgid "Internal error: DWARF version is not 2 or 3.\n" +msgstr "Error interno: la versión DWARF no es 2 ó 3.\n" + +#: readelf.c:8203 +#, c-format +msgid " (indirect string, offset: 0x%lx): %s" +msgstr " (cadena indirecta, desplazamiento 0x%lx): %s" + +#: readelf.c:8212 +#, c-format +msgid "Unrecognized form: %d\n" +msgstr "Form no reconocido: %d\n" + +#: readelf.c:8226 +msgid "(not inlined)" +msgstr "(no es inlined)" + +#: readelf.c:8229 +msgid "(inlined)" +msgstr "(inlined)" + +#: readelf.c:8232 +msgid "(declared as inline but ignored)" +msgstr "(declarado como inline pero ignorado)" + +#: readelf.c:8235 +msgid "(declared as inline and inlined)" +msgstr "(declarado como inline y es inline)" + +#: readelf.c:8238 +#, c-format +msgid " (Unknown inline attribute value: %lx)" +msgstr " (Valor desconocido de atributo inline: %lx)" + +#: readelf.c:8419 readelf.c:8646 +#, c-format +msgid "" +"The section %s contains:\n" +"\n" +msgstr "" +"La sección %s contiene:\n" +"\n" + +#: readelf.c:8535 +#, c-format +msgid " Compilation Unit @ %lx:\n" +msgstr " Unidad de Compilación @ %lx:\n" + +#: readelf.c:8536 +#, c-format +msgid " Length: %ld\n" +msgstr " Longitud: %ld\n" + +#: readelf.c:8537 +#, c-format +msgid " Version: %d\n" +msgstr " Versión: %d\n" + +#: readelf.c:8538 +#, c-format +msgid " Abbrev Offset: %ld\n" +msgstr " Desplaz Abrev: %ld\n" + +#: readelf.c:8539 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " Tamaño de Apuntador: %d\n" + +#: readelf.c:8543 +msgid "Only version 2 and 3 DWARF debug information is currently supported.\n" +msgstr "Sólo la información de depuración DWARF versión 2 y 3 tiene soporte actualmente.\n" + +#: readelf.c:8563 +msgid "Unable to locate .debug_abbrev section!\n" +msgstr "¡No se puede localizar la sección .debug_abbrev!\n" + +#: readelf.c:8569 +msgid "debug_abbrev section data" +msgstr "sección de datos debug_abbrev" + +#: readelf.c:8606 +#, c-format +msgid "Unable to locate entry %lu in the abbreviation table\n" +msgstr "No se puede localizar la entrada %lu en la tabla de abreviaciones\n" + +#: readelf.c:8611 +#, c-format +msgid " <%d><%lx>: Abbrev Number: %lu (%s)\n" +msgstr " <%d><%lx>: Número de Abrev: %lu (%s)\n" + +#: readelf.c:8691 +msgid "Only DWARF 2 and 3 aranges are currently supported.\n" +msgstr "Sólo los rangos-a de DWARF 2 y 3 tienen soporte actualmente.\n" + +#: readelf.c:8695 +#, c-format +msgid " Length: %ld\n" +msgstr " Longitud: %ld\n" + +#: readelf.c:8696 +#, c-format +msgid " Version: %d\n" +msgstr " Versión: %d\n" + +#: readelf.c:8697 +#, c-format +msgid " Offset into .debug_info: %lx\n" +msgstr " Desplaz. en .debug_info: %lx\n" + +#: readelf.c:8698 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " Tamaño del Apuntador: %d\n" + +#: readelf.c:8699 +#, c-format +msgid " Segment Size: %d\n" +msgstr " Tamaño del Segmento: %d\n" + +#: readelf.c:8701 +msgid "" +"\n" +" Address Length\n" +msgstr "" +"\n" +" Longitud de la Dirección\n" + +#: readelf.c:8903 +#, c-format +msgid "The section %s contains:\n" +msgstr "La sección %s contiene:\n" + +#: readelf.c:9538 +#, c-format +msgid "Displaying the debug contents of section %s is not yet supported.\n" +msgstr "Aún no tiene soporte el mostrar el contenido de depuración de la sección %s.\n" + +#: readelf.c:9634 +#, c-format +msgid "" +"\n" +"Section '%s' has no debugging data.\n" +msgstr "" +"\n" +"La sección '%s' no tiene datos de depuración.\n" + +#: readelf.c:9639 readelf.c:9701 +msgid "debug section data" +msgstr "sección de datos de depuración" + +#: readelf.c:9655 +#, c-format +msgid "Unrecognized debug section: %s\n" +msgstr "Sección de depuración no reconocida: %s\n" + +#: readelf.c:9729 +msgid "Some sections were not dumped because they do not exist!\n" +msgstr "¡Algunas secciones no se volcaron porque no existen!\n" + +#: readelf.c:9806 readelf.c:10170 +msgid "liblist" +msgstr "lista de bibliotecas" + +#: readelf.c:9891 +msgid "options" +msgstr "opciones" + +#: readelf.c:9922 +#, c-format +msgid "" +"\n" +"Section '%s' contains %d entries:\n" +msgstr "" +"\n" +"La sección '%s' contiene %d entradas:\n" + +#: readelf.c:10083 +msgid "conflict list found without a dynamic symbol table" +msgstr "se encontró una lista de conflictos sin una tabla de símbolos dinámicos" + +#: readelf.c:10101 readelf.c:10117 +msgid "conflict" +msgstr "tiene conflictos con" + +#: readelf.c:10127 +#, c-format +msgid "" +"\n" +"Section '.conflict' contains %ld entries:\n" +msgstr "" +"\n" +"La sección '.conflict' contiene %ld entradas:\n" + +#: readelf.c:10129 +msgid " Num: Index Value Name" +msgstr " Num: Índice Valor Nombre" + +#: readelf.c:10178 +msgid "liblist string table" +msgstr "tabla de cadenas liblist" + +#: readelf.c:10187 +#, c-format +msgid "" +"\n" +"Library list section '%s' contains %lu entries:\n" +msgstr "" +"\n" +"La sección de lista de bibliotecas '%s' contiene %lu entradas:\n" + +#: readelf.c:10236 +msgid "NT_PRSTATUS (prstatus structure)" +msgstr "NT_PRSTATUS (estructura prstatus)" + +#: readelf.c:10237 +msgid "NT_FPREGSET (floating point registers)" +msgstr "NT_FPREGSET (registros de coma flotante)" + +#: readelf.c:10238 +msgid "NT_PRPSINFO (prpsinfo structure)" +msgstr "NT_PRPSINFO (estructura prpsinfo)" + +#: readelf.c:10239 +msgid "NT_TASKSTRUCT (task structure)" +msgstr "NT_TASKSTRUCT (estructura task)" + +#: readelf.c:10240 +msgid "NT_PRXFPREG (user_xfpregs structure)" +msgstr "NT_PRXFPREG (estructura user_xfpregs)" + +#: readelf.c:10241 +msgid "NT_PSTATUS (pstatus structure)" +msgstr "NT_PSTATUS (estructura pstatus)" + +#: readelf.c:10242 +msgid "NT_FPREGS (floating point registers)" +msgstr "NT_FPREGS (registros de coma flotante)" + +#: readelf.c:10243 +msgid "NT_PSINFO (psinfo structure)" +msgstr "NT_PSINFO (estructura psinfo)" + +#: readelf.c:10244 +msgid "NT_LWPSTATUS (lwpstatus_t structure)" +msgstr "NT_LWPSTATUS (estructura lwpstatus_t)" + +#: readelf.c:10245 +msgid "NT_LWPSINFO (lwpsinfo_t structure)" +msgstr "NT_LWPSINFO (estructura lwpsinfo_t)" + +#: readelf.c:10246 +msgid "NT_WIN32PSTATUS (win32_pstatus structure)" +msgstr "NT_WIN32PSTATUS (estructura win32_pstatus)" + +#: readelf.c:10248 readelf.c:10272 +#, c-format +msgid "Unknown note type: (0x%08x)" +msgstr "Tipo de nota desconocido: (0x%08x)" + +#. NetBSD core "procinfo" structure. +#: readelf.c:10262 +msgid "NetBSD procinfo structure" +msgstr "estructura procinfo de NetBSD" + +#: readelf.c:10289 readelf.c:10303 +msgid "PT_GETREGS (reg structure)" +msgstr "PT_GETREGS (estructura reg)" + +#: readelf.c:10291 readelf.c:10305 +msgid "PT_GETFPREGS (fpreg structure)" +msgstr "PT_GETFPREGS (estructura fpreg)" + +#: readelf.c:10311 +#, c-format +msgid "PT_FIRSTMACH+%d" +msgstr "PT_FIRSTMACH+%d" + +#: readelf.c:10365 +msgid "notes" +msgstr "notas" + +#: readelf.c:10371 +#, c-format +msgid "" +"\n" +"Notes at offset 0x%08lx with length 0x%08lx:\n" +msgstr "" +"\n" +"Notas en el desplazamiento 0x%08lx con longitud 0x%08lx:\n" + +#: readelf.c:10373 +msgid " Owner\t\tData size\tDescription\n" +msgstr " Prop\t\tTamaño datos\tDescripción\n" + +#: readelf.c:10392 +#, c-format +msgid "corrupt note found at offset %x into core notes\n" +msgstr "se encontró una nota corrupta en el desplazamiento %x en las notas de núcleo\n" + +#: readelf.c:10394 +#, c-format +msgid " type: %x, namesize: %08lx, descsize: %08lx\n" +msgstr " tipo: %x, tamañonombre: %08lx, tamañodesc: %08lx\n" + +#: readelf.c:10476 +msgid "No note segments present in the core file.\n" +msgstr "No hay segmentos de notas presentes el el fichero core.\n" + +#: readelf.c:10560 +msgid "" +"This instance of readelf has been built without support for a\n" +"64 bit data type and so it cannot read 64 bit ELF files.\n" +msgstr "" +"Esta instancia de readelf ha sido construida sin soporte para un\n" +"tipo de datos de 64 bit y por eso no puede leer ficheros ELF de 64 bit.\n" + +#: readelf.c:10606 +#, c-format +msgid "Cannot stat input file %s.\n" +msgstr "No se puede obtener la información stat del fichero de entrada %s.\n" + +#: readelf.c:10613 +#, c-format +msgid "Input file %s not found.\n" +msgstr "No se encuentra el fichero de entrada %s.\n" + +#: readelf.c:10619 +#, c-format +msgid "%s: Failed to read file header\n" +msgstr "%s: Falló al leer el encabezado del fichero\n" + +#: readelf.c:10633 +#, c-format +msgid "" +"\n" +"File: %s\n" +msgstr "" +"\n" +"Fichero: %s\n" + +#: rename.c:132 +#, c-format +msgid "%s: cannot set time: %s" +msgstr "%s: no se puede establecer la hora: %s" + +#. We have to clean up here. +#: rename.c:171 rename.c:204 +#, c-format +msgid "%s: rename: %s" +msgstr "%s: rename: %s" + +#: rename.c:212 +#, c-format +msgid "%s: simple_copy: %s" +msgstr "%s: simple_copy: %s" + +#: resbin.c:134 +#, c-format +msgid "%s: not enough binary data" +msgstr "%s: no hay suficientes datos binarios" + +#: resbin.c:153 +msgid "null terminated unicode string" +msgstr "cadena unicode terminada en null" + +#: resbin.c:183 resbin.c:189 +msgid "resource ID" +msgstr "ID de recurso" + +#: resbin.c:233 +msgid "cursor" +msgstr "cursor" + +#: resbin.c:267 resbin.c:274 +msgid "menu header" +msgstr "encabezado de menú" + +#: resbin.c:284 +msgid "menuex header" +msgstr "encabezado de menuex" + +#: resbin.c:288 +msgid "menuex offset" +msgstr "desplazamiento de menuex" + +#: resbin.c:295 +#, c-format +msgid "unsupported menu version %d" +msgstr "versión de menú %d sin soporte" + +#: resbin.c:323 resbin.c:338 resbin.c:404 +msgid "menuitem header" +msgstr "encabezado de elemento de menú" + +#: resbin.c:434 +msgid "menuitem" +msgstr "elemento de menú" + +#: resbin.c:475 resbin.c:503 +msgid "dialog header" +msgstr "encabezado de diálogo" + +#: resbin.c:493 +#, c-format +msgid "unexpected DIALOGEX version %d" +msgstr "versión DIALOGEX %d inesperada" + +#: resbin.c:538 +msgid "dialog font point size" +msgstr "tamaño de punto de la tipografía del diálogo" + +#: resbin.c:546 +msgid "dialogex font information" +msgstr "información de tipografía del dialogex" + +#: resbin.c:572 resbin.c:590 +msgid "dialog control" +msgstr "control del diálogo" + +#: resbin.c:582 +msgid "dialogex control" +msgstr "control del dialogex" + +#: resbin.c:611 +msgid "dialog control end" +msgstr "fin del control del diálogo" + +#: resbin.c:623 +msgid "dialog control data" +msgstr "datos de control del diálogo" + +#: resbin.c:666 +msgid "stringtable string length" +msgstr "longitud de la cadena stringtable" + +#: resbin.c:676 +msgid "stringtable string" +msgstr "cadena stringtable" + +#: resbin.c:709 +msgid "fontdir header" +msgstr "encabezado fontdir" + +#: resbin.c:722 +msgid "fontdir" +msgstr "fontdir" + +#: resbin.c:738 +msgid "fontdir device name" +msgstr "nombre de dispositivo fontdir" + +#: resbin.c:744 +msgid "fontdir face name" +msgstr "nombre de rostro fontdir" + +#: resbin.c:787 +msgid "accelerator" +msgstr "acelerador" + +#: resbin.c:851 +msgid "group cursor header" +msgstr "encabezado de grupo de cursores" + +#: resbin.c:855 +#, c-format +msgid "unexpected group cursor type %d" +msgstr "tipo de grupo de cursores %d inesperado" + +#: resbin.c:870 +msgid "group cursor" +msgstr "grupo de cursores" + +#: resbin.c:909 +msgid "group icon header" +msgstr "encabezado de grupo de iconos" + +#: resbin.c:913 +#, c-format +msgid "unexpected group icon type %d" +msgstr "tipo de grupo de iconos %d inesperado" + +#: resbin.c:928 +msgid "group icon" +msgstr "grupo de iconos" + +#: resbin.c:999 resbin.c:1218 +msgid "unexpected version string" +msgstr "cadena de versión inesperada" + +#: resbin.c:1033 +#, c-format +msgid "version length %d does not match resource length %lu" +msgstr "la longitud de la versión %d no coincide con la longitud del recurso %lu" + +#: resbin.c:1037 +#, c-format +msgid "unexpected version type %d" +msgstr "tipo de versión %d inesperada" + +#: resbin.c:1049 +#, c-format +msgid "unexpected fixed version information length %d" +msgstr "longitud de la información de versión fija %d inesperada" + +#: resbin.c:1052 +msgid "fixed version info" +msgstr "información de versión fija" + +#: resbin.c:1056 +#, c-format +msgid "unexpected fixed version signature %lu" +msgstr "firma de versión fija %lu inesperada" + +#: resbin.c:1060 +#, c-format +msgid "unexpected fixed version info version %lu" +msgstr "información de versión de versión fija %lu inesperada" + +#: resbin.c:1089 +msgid "version var info" +msgstr "información de versión variable" + +#: resbin.c:1106 +#, c-format +msgid "unexpected stringfileinfo value length %d" +msgstr "longitud del valor stringfileinfo %d inesperada" + +#: resbin.c:1116 +#, c-format +msgid "unexpected version stringtable value length %d" +msgstr "valor de longitud de versión stringtable %d inesperada" + +#: resbin.c:1150 +#, c-format +msgid "unexpected version string length %d != %d + %d" +msgstr "longitud de cadena de versión %d != %d + %d inesperada" + +#: resbin.c:1161 +#, c-format +msgid "unexpected version string length %d < %d" +msgstr "longitud de cadena de versión %d < %d inesperada" + +#: resbin.c:1178 +#, c-format +msgid "unexpected varfileinfo value length %d" +msgstr "longitud de valor varfileinfo %d inesperada" + +#: resbin.c:1197 +msgid "version varfileinfo" +msgstr "versión varfileinfo" + +#: resbin.c:1212 +#, c-format +msgid "unexpected version value length %d" +msgstr "longitud de valor de versión %d inesperada" + +#: rescoff.c:128 +msgid "filename required for COFF input" +msgstr "se requiere un nombre de fichero para la entrada COFF" + +#: rescoff.c:145 +#, c-format +msgid "%s: no resource section" +msgstr "%s: no hay sección de recursos" + +#: rescoff.c:152 +msgid "can't read resource section" +msgstr "no se puede leer la sección de recursos" + +#: rescoff.c:178 +#, c-format +msgid "%s: %s: address out of bounds" +msgstr "%s: %s: dirección fuera de los límites" + +#: rescoff.c:197 +msgid "directory" +msgstr "directorio" + +#: rescoff.c:225 +msgid "named directory entry" +msgstr "entrada nombrada de directorio" + +#: rescoff.c:234 +msgid "directory entry name" +msgstr "nombre de entrada de directorio" + +#: rescoff.c:254 +msgid "named subdirectory" +msgstr "subdirectorio nombrado" + +#: rescoff.c:262 +msgid "named resource" +msgstr "recurso nombrado" + +#: rescoff.c:277 +msgid "ID directory entry" +msgstr "entrada de ID de directorio" + +#: rescoff.c:294 +msgid "ID subdirectory" +msgstr "ID de subdirectorio" + +#: rescoff.c:302 +msgid "ID resource" +msgstr "ID de recurso" + +#: rescoff.c:328 +msgid "resource type unknown" +msgstr "tipo de recurso desconocido" + +#: rescoff.c:331 +msgid "data entry" +msgstr "entrada de datos" + +#: rescoff.c:339 +msgid "resource data" +msgstr "datos de recursos" + +#: rescoff.c:344 +msgid "resource data size" +msgstr "tamaño de datos de recursos" + +#: rescoff.c:439 +msgid "filename required for COFF output" +msgstr "se requiere un nombre de fichero para la salida COFF" + +#: rescoff.c:738 +msgid "can't get BFD_RELOC_RVA relocation type" +msgstr "no se puede obtener el tipo de reubicación BFD_RELOC_RVA" + +#: resrc.c:240 resrc.c:312 +#, c-format +msgid "can't open temporary file `%s': %s" +msgstr "no se puede abrir el fichero temporal `%s': %s" + +#: resrc.c:246 +#, c-format +msgid "can't redirect stdout: `%s': %s" +msgstr "no se puede redirigir la salida estándar: `%s': %s" + +#: resrc.c:262 +#, c-format +msgid "%s %s: %s" +msgstr "%s %s: %s" + +#: resrc.c:308 +#, c-format +msgid "can't execute `%s': %s" +msgstr "no se puede ejecutar `%s': %s" + +#: resrc.c:317 +#, c-format +msgid "Using temporary file `%s' to read preprocessor output\n" +msgstr "Utilizando el fichero temporal `%s' para leer la salida del preprocesador\n" + +#: resrc.c:324 +#, c-format +msgid "can't popen `%s': %s" +msgstr "no se puede hacer popen de `%s': %s" + +#: resrc.c:326 +msgid "Using popen to read preprocessor output\n" +msgstr "Utilizando popen para leer la salida del preprocesador\n" + +#: resrc.c:369 +#, c-format +msgid "Tried `%s'\n" +msgstr "Se intentó `%s'\n" + +#: resrc.c:380 +#, c-format +msgid "Using `%s'\n" +msgstr "Utilizando `%s'\n" + +#: resrc.c:542 +#, c-format +msgid "%s:%d: %s\n" +msgstr "%s:%d: %s\n" + +#: resrc.c:551 +#, c-format +msgid "%s: unexpected EOF" +msgstr "%s: fin de fichero inesperado" + +#: resrc.c:608 +#, c-format +msgid "%s: read of %lu returned %lu" +msgstr "%s: la lectura de %lu devolvió %lu" + +#: resrc.c:650 resrc.c:905 resrc.c:1178 resrc.c:1332 +#, c-format +msgid "stat failed on bitmap file `%s': %s" +msgstr "stat falló en el fichero bitmap `%s': %s" + +#: resrc.c:703 +#, c-format +msgid "cursor file `%s' does not contain cursor data" +msgstr "el fichero de cursor `%s' no contiene datos de cursor" + +#: resrc.c:735 resrc.c:1049 +#, c-format +msgid "%s: fseek to %lu failed: %s" +msgstr "%s: falló fseek para %lu: %s" + +#: resrc.c:873 +msgid "help ID requires DIALOGEX" +msgstr "el ID de ayuda requiere DIALOGEX" + +#: resrc.c:875 +msgid "control data requires DIALOGEX" +msgstr "los datos de control requieren DIALOGEX" + +#: resrc.c:1018 +#, c-format +msgid "icon file `%s' does not contain icon data" +msgstr "el fichero de icono `%s' no contiene datos de icono" + +#: resrc.c:1537 +#, c-format +msgid "can't open `%s' for output: %s" +msgstr "no se puede abrir `%s' para salida: %s" + +#: size.c:86 +msgid " Displays the sizes of sections inside binary files\n" +msgstr " Muestra los tamaños de las secciones dentro de los ficheros binarios\n" + +#: size.c:87 +msgid " If no input file(s) are specified, a.out is assumed\n" +msgstr "Si no se especifica(n) fichero(s) de salida, se asume a.out\n" + +#: size.c:88 +#, c-format +msgid "" +" The options are:\n" +" -A|-B --format={sysv|berkeley} Select output style (default is %s)\n" +" -o|-d|-x --radix={8|10|16} Display numbers in octal, decimal or hex\n" +" -t --totals Display the total sizes (Berkeley only)\n" +" --target= Set the binary file format\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +" Las opciones son:\n" +" -A|-B --format={sysv|berkeley} Selecciona el estilo de salida output\n" +" (por omisión es %s)\n" +" -o|-d|-x --radix={8|10|16} Muestra los números en octal, decimal o\n" +" hexadecimal\n" +" -t --totals Muestra los tamaños totales\n" +" (sólo Berkeley)\n" +" --target= Establece el formato del fichero binario\n" +" -h --help Muestra esta información\n" +" -v --version Muestra la versión del programa\n" +"\n" + +#: size.c:160 +#, c-format +msgid "invalid argument to --format: %s" +msgstr "argumento inválido para --format: %s" + +#: size.c:187 +#, c-format +msgid "Invalid radix: %s\n" +msgstr "Radical inválido: %s\n" + +#: srconv.c:1953 +msgid "Convert a COFF object file into a SYSROFF object file\n" +msgstr "Convierte un fichero objeto COFF a un fichero objeto SYSROFF\n" + +#: srconv.c:1954 +msgid "" +" The options are:\n" +" -q --quick (Obsolete - ignoerd)\n" +" -n --noprescan Do not perform a scan to convert commons into defs\n" +" -d --debug Display information about what is being done\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +" Las opciones son:\n" +" -q --quick (Obsoleto - ignorado)\n" +" -n --noprescan No realizar una revisión para convertir comunes en definiciones\n" +" -d --debug Muestra información acerca de lo que se ha hecho\n" +" -h --help Muestra esta información\n" +" -v --version Muestra el número de versión del programa\n" + +#: srconv.c:2099 +#, c-format +msgid "unable to open output file %s" +msgstr "no se puede abrir el fichero de salida %s" + +#: stabs.c:346 stabs.c:1755 +msgid "numeric overflow" +msgstr "desbordamiento numérico" + +#: stabs.c:357 +#, c-format +msgid "Bad stab: %s\n" +msgstr "Stab erróneo: %s\n" + +#: stabs.c:367 +#, c-format +msgid "Warning: %s: %s\n" +msgstr "Aviso: %s: %s\n" + +#: stabs.c:488 +msgid "N_LBRAC not within function\n" +msgstr "N_LBRAC no está dentro de una función\n" + +#: stabs.c:527 +msgid "Too many N_RBRACs\n" +msgstr "Demasiados N_RBRACs\n" + +#: stabs.c:773 +msgid "unknown C++ encoded name" +msgstr "nombre C++ codificado desconocido" + +#. Complain and keep going, so compilers can invent new +#. cross-reference types. +#: stabs.c:1293 +msgid "unrecognized cross reference type" +msgstr "tipo de referencia cruzada no reconocido" + +#. Does this actually ever happen? Is that why we are worrying +#. about dealing with it rather than just calling error_type? +#: stabs.c:1847 +msgid "missing index type" +msgstr "tipo de índice desconocido" + +#: stabs.c:2174 +msgid "unknown virtual character for baseclass" +msgstr "carácter virtual desconocido para la clase base" + +#: stabs.c:2192 +msgid "unknown visibility character for baseclass" +msgstr "carácter de visibilidad desconocido para la clase base" + +#: stabs.c:2384 +msgid "unnamed $vb type" +msgstr "tipo $vb sin nombre" + +#: stabs.c:2390 +msgid "unrecognized C++ abbreviation" +msgstr "abreviación C++ no reconocida" + +#: stabs.c:2470 +msgid "unknown visibility character for field" +msgstr "carácter de visibilidad desconocido para el campo" + +#: stabs.c:2726 +msgid "const/volatile indicator missing" +msgstr "falta el indicador const/volatile" + +#: stabs.c:2967 +#, c-format +msgid "No mangling for \"%s\"\n" +msgstr "No hay desenredo para \"%s\"\n" + +#: stabs.c:3281 +msgid "Undefined N_EXCL" +msgstr "N_EXCL indefinido" + +#: stabs.c:3369 +#, c-format +msgid "Type file number %d out of range\n" +msgstr "Número de tipo de fichero %d fuera de rango\n" + +#: stabs.c:3374 +#, c-format +msgid "Type index number %d out of range\n" +msgstr "Número de tipo de índice %d fuera de rango\n" + +#: stabs.c:3461 +#, c-format +msgid "Unrecognized XCOFF type %d\n" +msgstr "Tipo XCOFF %d no reconocido\n" + +#: stabs.c:3762 +#, c-format +msgid "bad mangled name `%s'\n" +msgstr "nombre desenredado erróneamente `%s'\n" + +#: stabs.c:3859 +msgid "no argument types in mangled string\n" +msgstr "no hay tipos de argumento en la cadena desenredada\n" + +#: strings.c:208 +#, c-format +msgid "invalid number %s" +msgstr "número %s inválido" + +#: strings.c:647 +#, c-format +msgid "invalid integer argument %s" +msgstr "argumento entero %s inválido" + +#: strings.c:658 +msgid " Display printable strings in [file(s)] (stdin by default)\n" +msgstr " Muestra las cadenas imprimibles en [fichero(s)] (por omisión entrada estándar)\n" + +#: strings.c:659 +msgid "" +" The options are:\n" +" -a - --all Scan the entire file, not just the data section\n" +" -f --print-file-name Print the name of the file before each string\n" +" -n --bytes=[number] Locate & print any NUL-terminated sequence of at\n" +" - least [number] characters (default 4).\n" +" -t --radix={o,x,d} Print the location of the string in base 8, 10 or 16\n" +" -o An alias for --radix=o\n" +" -T --target= Specify the binary file format\n" +" -e --encoding={s,S,b,l,B,L} Select character size and endianness:\n" +" s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +" Las opciones son:\n" +" -a - --all Revisa el fichero completo, no sólo la sección de\n" +" datos\n" +" -f --print-file-name Muestra el nombre de fichero antes de cada cadena\n" +" -n --bytes=[número] Localiza e imprime cualquier secuencia terminada en\n" +" - NUL de por lo menos [número] caracteres (4 por omisión).\n" +" -t --radix={o,x,d} Muestra la ubicación de la cadena en base 8, 10 ó 16\n" +" -o Un alias para --radix=o\n" +" -T --target= Especifica el formato de fichero binario\n" +" -e --encoding={s,S,b,l,B,L} Selecciona el tamaño del carácter y la \"endianez\":\n" +" s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n" +" -h --help Muestra esta información\n" +" -v --version Muestra el número de versión del programa\n" + +#: sysdump.c:768 +msgid "Print a human readable interpretation of a SYSROFF object file\n" +msgstr "Muestra una interpretación legible por humanos de un fichero objeto SYSROFF\n" + +#: sysdump.c:769 +msgid "" +" The options are:\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +" Las opciones son:\n" +" -h --help Muestra esta información\n" +" -v --version Muestra el número de versión del programa\n" + +#: sysdump.c:836 +#, c-format +msgid "cannot open input file %s" +msgstr "no se puede abrir el fichero de entrada %s" + +#: version.c:36 +msgid "Copyright 2002 Free Software Foundation, Inc.\n" +msgstr "Copyright 2002 Free Software Foundation, Inc.\n" + +#: version.c:37 +msgid "" +"This program is free software; you may redistribute it under the terms of\n" +"the GNU General Public License. This program has absolutely no warranty.\n" +msgstr "" +"Este programa es software libre; se puede redistribuir bajo los términos de\n" +"la Licencia Pública General de GNU. Este programa no tiene ninguna garantía.\n" + +#: windres.c:205 +#, c-format +msgid "can't open %s `%s': %s" +msgstr "no se puede abrir %s `%s': %s" + +#: windres.c:384 +msgid ": expected to be a directory\n" +msgstr ": se esperaba que fuera un directorio\n" + +#: windres.c:396 +msgid ": expected to be a leaf\n" +msgstr ": se esperaba que fuera una hoja\n" + +#: windres.c:405 +#, c-format +msgid "%s: warning: " +msgstr "%s: aviso: " + +#: windres.c:407 +msgid ": duplicate value\n" +msgstr ": valor duplicado\n" + +#: windres.c:569 +#, c-format +msgid "unknown format type `%s'" +msgstr "tipo de formato `%s' desconocido" + +#: windres.c:570 +#, c-format +msgid "%s: supported formats:" +msgstr "%s: formatos con soporte:" + +#. Otherwise, we give up. +#: windres.c:655 +#, c-format +msgid "can not determine type of file `%s'; use the -I option" +msgstr "no se puede determinar el tipo del fichero `%s'; use la opción -I" + +#: windres.c:669 +#, c-format +msgid "Usage: %s [option(s)] [input-file] [output-file]\n" +msgstr "Modo de empleo: %s [opcion(es)] [fichero-entrada] [fichero-salida]\n" + +#: windres.c:671 +msgid "" +" The options are:\n" +" -i --input= Name input file\n" +" -o --output= Name output file\n" +" -J --input-format= Specify input format\n" +" -O --output-format= Specify output format\n" +" -F --target= Specify COFF target\n" +" --preprocessor= Program to use to preprocess rc file\n" +" -I --include-dir= Include directory when preprocessing rc file\n" +" -D --define [=] Define SYM when preprocessing rc file\n" +" -U --undefine Undefine SYM when preprocessing rc file\n" +" -v --verbose Verbose - tells you what it's doing\n" +" -l --language= Set language when reading rc file\n" +" --use-temp-file Use a temporary file instead of popen to read\n" +" the preprocessor output\n" +" --no-use-temp-file Use popen (default)\n" +msgstr "" +"Las opciones son:\n" +" -i --input= Nombra el fichero de entrada\n" +" -o --output= Nombra el fichero de salida\n" +" -I --input-format= Especifica el formato de entrada\n" +" -O --output-format= Especifica el formato de salida\n" +" -F --target= Especifica el objetivo COFF\n" +" --preprocessor= Programa a utilizar para preprocesar el fichero rc\n" +" -I --include-dir= Incluye el directorio al preprocesar el fichero rc\n" +" -D --define [=val] Define un SIMbolo al preprocesar el fichero rc\n" +" -U --undefine No define el SIMbolo al preprocesar el fichero rc\n" +" -v --verbose Detallado - dice lo que está haciendo\n" +" -l --language= Establece el lenguaje al leer el fichero rc\n" +" --use-temp-file Usa un fichero temporal en lugar de popen para\n" +" leer la salida del preprocesador\n" +" --no-use-temp-file Usa popen (por omisión)\n" + +#: windres.c:687 +msgid " --yydebug Turn on parser debugging\n" +msgstr " --yydebug Activa el decodificador de depuración\n" + +#: windres.c:690 +msgid "" +" -r Ignored for compatibility with rc\n" +" -h --help Print this help message\n" +" -V --version Print version information\n" +msgstr "" +" Las opciones son:\n" +" -r Se ignora por compatibilidad con rc\n" +" -h --help Muestra este mensaje de ayuda\n" +" -V --version Muestra la información de versión\n" + +#: windres.c:694 +msgid "" +"FORMAT is one of rc, res, or coff, and is deduced from the file name\n" +"extension if not specified. A single file name is an input file.\n" +"No input-file is stdin, default rc. No output-file is stdout, default rc.\n" +msgstr "" +"El FORMATO es uno de rc, res, o coff, y se deduce de la extensión del nombre\n" +"de fichero si no se especifica. Un solo nombre de fichero es un fichero de\n" +"entrada. Sin fichero de entrada es la entrada estándar, por omisión rc.\n" +"Sin fichero de salida es la salida estándar, por omisión rc.\n" + +#: windres.c:833 +msgid "invalid option -f\n" +msgstr "opción -f inválida\n" + +#: windres.c:838 +msgid "No filename following the -fo option.\n" +msgstr "No hay un nombre de fichero a continuación de la opción -fo.\n" + +#: windres.c:896 +msgid "Option -I is deprecated for setting the input format, please use -J instead.\n" +msgstr "La opción -I es obsoleta para establecer el formato de salida, por favor use -J en su lugar.\n" + +#: windres.c:1014 +msgid "no resources" +msgstr "no hay recursos" + +#: wrstabs.c:395 wrstabs.c:2055 +#, c-format +msgid "string_hash_lookup failed: %s" +msgstr "string_hash_lookup falló: %s" + +#: wrstabs.c:695 +#, c-format +msgid "stab_int_type: bad size %u" +msgstr "stab_int_type: tipo %u erróneo" + +#: wrstabs.c:1495 +#, c-format +msgid "%s: warning: unknown size for field `%s' in struct" +msgstr "%s: aviso: tamaño desconocido para el campo `%s' en la estructura" + +#~ msgid "debug_record_variable: no current block" +#~ msgstr "debug_record_variable: no hay un bloque actual" + +#~ msgid "%s: No dynamic symbols" +#~ msgstr "%s: No hay símbolos dinámicos" + +#~ msgid "64-bit DWARF line info is not supported yet.\n" +#~ msgstr "La información de línea de DWARF 64-bit aún no tiene soporte.\n" + +#~ msgid "64-bit DWARF pubnames are not supported yet.\n" +#~ msgstr "Los nombres públicos DWARF de 64-bit no tienen soporte aún.\n" + +#~ msgid "64-bit DWARF debug info is not supported yet.\n" +#~ msgstr "La información de depuración DWARF 64-bit aún no tiene soporte.\n" + +#~ msgid "64-bit DWARF aranges are not supported yet.\n" +#~ msgstr "Los rangos-a de DWARF 64-bit aún no tienen soporte.\n" + +#~ msgid "64-bit DWARF format frames are not supported yet.\n" +#~ msgstr "Los marcos de formato de DWARF 64-bit aú no tienen soporte.\n" + +#~ msgid "" +#~ " -h --help Print this help message\n" +#~ " -V --version Print version information\n" +#~ msgstr "" +#~ " -h --help Muestra este mensaje de ayuda\n" +#~ " -V --version Muestra la información de versión\n" + +#~ msgid "" +#~ "Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n" +#~ " [-e executable] [--exe=executable] [--demangle[=style]]\n" +#~ " [--basenames] [--functions] [addr addr ...]\n" +#~ msgstr "" +#~ "Modo de empleo: %s [-CfsHV] [-b nombrebfd] [--target=nombrebfd]\n" +#~ " [-e ejecutable] [--exe=ejecutable] [--demangle[=estilo]]\n" +#~ " [--basenames] [--functions] [dirección dirección ...]\n" + +#~ msgid "" +#~ "Usage: %s [-dhV] [-I bfdname] [-O bfdname] [-T header-file] [-l linker]\n" +#~ " [--input-target=bfdname] [--output-target=bfdname]\n" +#~ " [--header-file=file] [--linker=linker] [--debug]\n" +#~ " [--help] [--version]\n" +#~ " [in-file [out-file]]\n" +#~ msgstr "" +#~ "Modo de empleo: %s [-dhV] [-I nombrebfd] [-O nombrebfd] [-T fichero-encabezado] [-l enlazador]\n" +#~ " [--input-target=nombrebfd] [--output-target=nombrebfd]\n" +#~ " [--header-file=fichero] [--linker=enlazador] [--debug]\n" +#~ " [--help] [--version]\n" +#~ " [fichero-entrada [fichero-salida]]\n" + +#~ msgid "Usage: %s [OPTION]... [FILE]...\n" +#~ msgstr "Modo de empleo: %s [OPCIÓN]... [FICHERO]...\n" + +#~ msgid "Usage: %s OPTION... FILE...\n" +#~ msgstr "Modo de empleo: %s OPCIÓN... FICHERO...\n" + +#~ msgid " Options are:\n" +#~ msgstr " Las opciones son:\n" + +#~ msgid " -a or --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" +#~ msgstr " -a ó --all Equivalente a: -h -l -S -s -r -d -V -A -I\n" + +#~ msgid " -h or --file-header Display the ELF file header\n" +#~ msgstr " -h ó --file-header Muestra el encabezado del fichero ELF\n" + +#~ msgid " -l or --program-headers or --segments\n" +#~ msgstr " -l ó --program-headers ó --segments\n" + +#~ msgid " Display the program headers\n" +#~ msgstr " Muestra los encabezados del programa\n" + +#~ msgid " -S or --section-headers or --sections\n" +#~ msgstr " -S ó --section-headers ó --sections\n" + +#~ msgid " Display the sections' header\n" +#~ msgstr " Muestra el encabezado de las secciones\n" + +#~ msgid " -e or --headers Equivalent to: -h -l -S\n" +#~ msgstr " -e ó --headers Equivalente a: -h -l -S\n" + +#~ msgid " -s or --syms or --symbols Display the symbol table\n" +#~ msgstr " -s ó --syms ó --symbols Muestra la tabla de símbolos\n" + +#~ msgid " -n or --notes Display the core notes (if present)\n" +#~ msgstr " -n ó --notes Muestra las notas de núcleo (si están presentes)\n" + +#~ msgid " -r or --relocs Display the relocations (if present)\n" +#~ msgstr " -r ó --relocs Muestra las reubicaciones (si están presentes)\n" + +#~ msgid " -u or --unwind Display the unwind info (if present)\n" +#~ msgstr " -u ó --unwind Muestra la información de desenredo (si está presente)\n" + +#~ msgid " -d or --dynamic Display the dynamic segment (if present)\n" +#~ msgstr " -d ó --dynamic Muestra el segmento dinámico (si está presente)\n" + +#~ msgid " -V or --version-info Display the version sections (if present)\n" +#~ msgstr " -V ó --version-info Muestra las secciones de versión (si están presentes)\n" + +#~ msgid " -A or --arch-specific Display architecture specific information (if any).\n" +#~ msgstr " -A ó --arch-specific Muestra la información específica de la arquitectura (si hay alguna).\n" + +#~ msgid " -D or --use-dynamic Use the dynamic section info when displaying symbols\n" +#~ msgstr " -D ó --use-dynamic Usa la información de la sección dinámica al mostrar los símbolos\n" + +#~ msgid " -x or --hex-dump=\n" +#~ msgstr " -x ó --hex-dump=\n" + +#~ msgid " Dump the contents of section \n" +#~ msgstr " Vuelca el contenido de la sección \n" + +#~ msgid " -w[liaprmfs] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str]\n" +#~ msgstr " -w[liaprmfs] ó --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str]\n" + +#~ msgid " Display the contents of DWARF2 debug sections\n" +#~ msgstr " Muestra el contenido de las secciones de depuración DWARF2\n" + +#~ msgid " -i or --instruction-dump=\n" +#~ msgstr " -i ó --instruction-dump=\n" + +#~ msgid " -I or --histogram Display histogram of bucket list lengths\n" +#~ msgstr " -I ó --histogram Muestra el histograma de las longitudes de la lista de cubos\n" + +#~ msgid " -v or --version Display the version number of readelf\n" +#~ msgstr " -v ó --version Muestra el número de versión de readelf\n" + +#~ msgid " -W or --wide Don't split lines or truncate symbols to fit into 80 columns\n" +#~ msgstr " -W ó --wide No divide las líneas o trunca los símbolos para ajustarlos a 80 columnas\n" + +#~ msgid " -H or --help Display this information\n" +#~ msgstr " -H ó --help Muestra esta información\n" + +#~ msgid "unexpected dialog signature %d" +#~ msgstr "firma de diálogo %d inesperada" + +#~ msgid "" +#~ "Usage: %s [-A | --format=sysv | -B | --format=berkeley]\n" +#~ " [-o | --radix=8 | -d | --radix=10 | -h | --radix=16]\n" +#~ " [-V | --version] [--target=bfdname] [--help] [file...]\n" +#~ msgstr "" +#~ "Modo de empleo: %s [-A | --format=sysv | -B | --format=berkeley]\n" +#~ " [-o | --radix=8 | -d | --radix=10 | -h | --radix=16]\n" +#~ " [-V | --version] [--target=nombrebfd] [--help] [fichero...]\n" + +#~ msgid "default is --format=berkeley\n" +#~ msgstr "por omisión es --format=berkeley\n" + +#~ msgid "default is --format=sysv\n" +#~ msgstr "por omisión es --format=sysv\n" + +#~ msgid "Usage: %s [-dhVq] in-file [out-file]\n" +#~ msgstr "Modo de empleo: %s [-dhVq] fichero-entrada [fichero-salida]\n" + +#~ msgid "" +#~ "Usage: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-e {s,b,l,B,L}]\n" +#~ " [-] [--all] [--print-file-name] [--bytes=min-len] [--radix={o,x,d}]\n" +#~ " [--target=bfdname] [--encoding {s,b,l,B,L}] [--help] [--version] file...\n" +#~ msgstr "" +#~ "Modo de empleo: %s [-afov] [-n long-min] [-long-min] [-t {o,x,d}] [-e {s,b,l,B,L}]\n" +#~ " [-] [--all] [--print-file-name] [--bytes=long-min] [--radix={o,x,d}]\n" +#~ " [--target=nombrebfd] [--encoding {s,b,l,B,L}] [--help] [--version] fichero...\n" + +#~ msgid "Usage: %s [-hV] in-file\n" +#~ msgstr "Modo de empleo: %s [-hV] fichero-entrada\n" + +#~ msgid "GNU %s version %s\n" +#~ msgstr "GNU %s versión %s\n" + +#~ msgid "no export definition file provided" +#~ msgstr "no se provee un fichero de definición de exportación" + +#~ msgid " The switches are:\n" +#~ msgstr " Los interruptores son:\n" + +#~ msgid "Unable to seek to start of %s at %x\n" +#~ msgstr "No se puede buscar para el inicio de %s en %x\n" + +#~ msgid "Unable to read data at %x for %s\n" +#~ msgstr "No se pueden leer datos en %x para %s\n" + +#~ msgid "ELF32" +#~ msgstr "ELF32" + +#~ msgid "ELF64" +#~ msgstr "ELF64" + +#~ msgid "UNIX - System V" +#~ msgstr "UNIX - System V" + +#~ msgid "UNIX - HP-UX" +#~ msgstr "UNIX - HP-UX" + +#~ msgid "UNIX - NetBSD" +#~ msgstr "UNIX - NetBSD" + +#~ msgid "UNIX - Linux" +#~ msgstr "UNIX - Linux" + +#~ msgid "GNU/Hurd" +#~ msgstr "GNU/Hurd" + +#~ msgid "UNIX - Solaris" +#~ msgstr "UNIX - Solaris" + +#~ msgid "UNIX - AIX" +#~ msgstr "UNIX - AIX" + +#~ msgid "UNIX - IRIX" +#~ msgstr "UNIX - IRIX" + +#~ msgid "UNIX - FreeBSD" +#~ msgstr "UNIX - FreeBSD" + +#~ msgid "UNIX - TRU64" +#~ msgstr "UNIX - TRU64" + +#~ msgid "Novell - Modesto" +#~ msgstr "Novell - Modesto" + +#~ msgid "UNIX - OpenBSD" +#~ msgstr "UNIX - OpenBSD" + +#~ msgid "ARM" +#~ msgstr "ARM" + +#~ msgid "Key to Flags:\n" +#~ msgstr "Clave para las Opciones:\n" + +#~ msgid " W (write), A (alloc), X (execute), M (merge), S (strings)\n" +#~ msgstr " W (escribir), A (asignar), X (ejecutar), M (mezclar), S (cadenas)\n" + +#~ msgid " I (info), L (link order), G (group), x (unknown)\n" +#~ msgstr " I (información), L (orden de enlazado), G (grupo), x (desconocido)\n" + +#~ msgid " O (extra OS processing required) o (OS specific), p (processor specific)\n" +#~ msgstr " O (se requiere procesamiento extra de SO) o (específico SO), p (específico procesador)\n" + +#~ msgid "Unable to handle FORM: %d" +#~ msgstr "No se puede manejar FORM: %d" + +#~ msgid "64 bit data type and so it cannot read 64 bit ELF files.\n" +#~ msgstr "tipo de datos de 64 bit así que no puede leer fichero ELF de 64 bit.\n" diff --git a/binutils/po/fr.gmo b/binutils/po/fr.gmo new file mode 100644 index 0000000000000..4425835e7cd11 Binary files /dev/null and b/binutils/po/fr.gmo differ diff --git a/binutils/po/fr.po b/binutils/po/fr.po new file mode 100644 index 0000000000000..26881292aeeb5 --- /dev/null +++ b/binutils/po/fr.po @@ -0,0 +1,5125 @@ +# Messages français pour GNU concernant binutils. +# Copyright © 2004 Free Software Foundation, Inc. +# Michel Robitaille , traducteur depuis/since 1996. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU binutils 2.14rel030712\n" +"POT-Creation-Date: 2003-07-11 13:56+0930\n" +"PO-Revision-Date: 2004-05-10 08:00-0500\n" +"Last-Translator: Michel Robitaille \n" +"Language-Team: French \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: addr2line.c:74 +#, c-format +msgid "Usage: %s [option(s)] [addr(s)]\n" +msgstr "Usage: %s [options] [adresses]\n" + +#: addr2line.c:75 +msgid " Convert addresses into line number/file name pairs.\n" +msgstr "Convertir les adresses en paires numéro de ligne/fichier.\n" + +#: addr2line.c:76 +msgid " If no addresses are specified on the command line, they will be read from stdin\n" +msgstr "Si aucune adresse n'est spécifiée sur la ligne de commande, elles seront lues de stdin\n" + +#: addr2line.c:77 +msgid "" +" The options are:\n" +" -b --target= Set the binary file format\n" +" -e --exe= Set the input file name (default is a.out)\n" +" -s --basenames Strip directory names\n" +" -f --functions Show function names\n" +" -C --demangle[=style] Demangle function names\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +"Les options sont:\n" +" -b --target= sélectionner le format du fichier binaire\n" +" -e --exe= sélectionner le nom du fichier d'entrée (par défaut est a.out)\n" +" -s --basenames élaguer les noms de répertoires\n" +" -f --functions afficher les noms de fonctions\n" +" -C --demangle[=style] décoder les noms de fonction\n" +" -h --help afficher l'aide-mémoire\n" +" -V --version afficher le nom et la version du logiciel\n" +"\n" + +#: addr2line.c:89 ar.c:297 coffdump.c:479 nlmconv.c:1121 objcopy.c:484 +#: objcopy.c:518 readelf.c:2649 size.c:104 srconv.c:1962 strings.c:673 +#: sysdump.c:774 windres.c:702 +#, c-format +msgid "Report bugs to %s\n" +msgstr "Rapporter toutes anomalies à %s\n" + +#: addr2line.c:245 +#, c-format +msgid "%s: can not get addresses from archive" +msgstr "%s: ne peut obtenir l'adresse à partir de l'archive" + +#: addr2line.c:317 nm.c:433 objdump.c:2693 +#, c-format +msgid "unknown demangling style `%s'" +msgstr "style de d'encodage par mutilation inconnu « %s »" + +#: ar.c:238 +#, c-format +msgid "no entry %s in archive\n" +msgstr "pas d'entrée %s dans l'archive\n" + +#: ar.c:255 +#, c-format +msgid "Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n" +msgstr "Usage: %s [options d'émulation] [-]{dmpqrstx}[abcfilNoPsSuvV] [nom-du-membre] [compteur] fichier-archive fichier...\n" + +#: ar.c:258 +#, c-format +msgid " %s -M [\n" +"\n" +msgstr "" +"\n" +"\n" +"\n" + +#: ar.c:857 ar.c:925 +#, c-format +msgid "%s is not a valid archive" +msgstr "%s n'est pas une archive valide" + +#: ar.c:893 +#, c-format +msgid "stat returns negative size for %s" +msgstr "stat() a retourné une taille négative for %s" + +#: ar.c:1020 +#, c-format +msgid "%s is not an archive" +msgstr "%s n'est pas une archive" + +#: ar.c:1027 +#, c-format +msgid "creating %s" +msgstr "création de %s" + +#: ar.c:1233 +#, c-format +msgid "No member named `%s'\n" +msgstr "Aucun membre ayant le nom « %s »\n" + +#: ar.c:1285 +#, c-format +msgid "no entry %s in archive %s!" +msgstr "aucune entrée %s dans l'archive %s!" + +#: ar.c:1422 +#, c-format +msgid "%s: no archive map to update" +msgstr "%s: aucune table d'archive à mettre à jour" + +#: arsup.c:86 +#, c-format +msgid "No entry %s in archive.\n" +msgstr "Aucune entrée %s dans l'archive.\n" + +#: arsup.c:117 +#, c-format +msgid "Can't open file %s\n" +msgstr "Ne peut ouvrir le fichier %s\n" + +#: arsup.c:172 +#, c-format +msgid "%s: Can't open output archive %s\n" +msgstr "%s: ne peut ouvrir l'archive de sortie %s\n" + +#: arsup.c:189 +#, c-format +msgid "%s: Can't open input archive %s\n" +msgstr "%s: ne peut ouvrir l'archive en entrée %s\n" + +#: arsup.c:198 +#, c-format +msgid "%s: file %s is not an archive\n" +msgstr "%s: le fichier %s n'est pas une archive\n" + +#: arsup.c:241 +#, c-format +msgid "%s: no output archive specified yet\n" +msgstr "%s: aucun fichier d'archive de sortie n'a encore été spécifié\n" + +#: arsup.c:262 arsup.c:301 arsup.c:343 arsup.c:364 arsup.c:430 +#, c-format +msgid "%s: no open output archive\n" +msgstr "%s: aucun fichier d'archive de sortie ouvert\n" + +#: arsup.c:273 arsup.c:385 arsup.c:411 +#, c-format +msgid "%s: can't open file %s\n" +msgstr "%s: ne peut ouvrir le fichier %s\n" + +#: arsup.c:328 arsup.c:407 arsup.c:489 +#, c-format +msgid "%s: can't find module file %s\n" +msgstr "%s: ne peut trouver le fichier module %s\n" + +#: arsup.c:439 +#, c-format +msgid "Current open archive is %s\n" +msgstr "L'archive actuellement ouverte est %s\n" + +#: arsup.c:464 +#, c-format +msgid "%s: no open archive\n" +msgstr "%s: aucune archive ouverte\n" + +#: binemul.c:39 +#, c-format +msgid " No emulation specific options\n" +msgstr " Pas d'options d'émulation spécifiques\n" + +#. Macros for common output. +#: binemul.h:52 +#, c-format +msgid " emulation options: \n" +msgstr " Options d'émulation: \n" + +#: bucomm.c:113 +#, c-format +msgid "can't set BFD default target to `%s': %s" +msgstr "ne peut initialiser les paramètres par défaut BDF cible vers « %s »: %s" + +#: bucomm.c:125 +#, c-format +msgid "%s: Matching formats:" +msgstr "%s: formats concordant:" + +#: bucomm.c:142 +msgid "Supported targets:" +msgstr "Cibles supportés:" + +#: bucomm.c:144 +#, c-format +msgid "%s: supported targets:" +msgstr "%s: cibles supportés:" + +#: bucomm.c:162 +msgid "Supported architectures:" +msgstr "Architectures supportées:" + +#: bucomm.c:164 +#, c-format +msgid "%s: supported architectures:" +msgstr "%s: architectures supportées:" + +#: bucomm.c:360 +#, c-format +msgid "BFD header file version %s\n" +msgstr "Version de l'en-tête du fichier BFD %s\n" + +#: bucomm.c:467 +#, c-format +msgid "%s: bad number: %s" +msgstr "%s: mauvais numéro: %s" + +#: coffdump.c:107 +#, c-format +msgid "#lines %d " +msgstr "# de lignes %d " + +#: coffdump.c:471 sysdump.c:767 +#, c-format +msgid "Usage: %s [option(s)] in-file\n" +msgstr "Usage: %s [options] fichier\n" + +#: coffdump.c:472 +msgid " Print a human readable interpretation of a SYSROFF object file\n" +msgstr "Aficher dans un format humainement lisible une interprétation du fichier objet SYSROFF\n" + +#: coffdump.c:473 +msgid "" +" The options are:\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +"Les options sont:\n" +" -h --help afficher l'aide-mémoire\n" +" -V --version afficher le nom et la version du logiciel\n" +"\n" + +#: coffdump.c:541 srconv.c:2052 sysdump.c:831 +msgid "no input file specified" +msgstr "Aucune fichier spécifié à l'entrée" + +#: debug.c:654 +msgid "debug_add_to_current_namespace: no current file" +msgstr "debug_add_to_current_namespace: aucun fichier courant" + +#: debug.c:737 +msgid "debug_start_source: no debug_set_filename call" +msgstr "debug_start_source: aucun appel no debug_set_filename" + +#: debug.c:796 +msgid "debug_record_function: no debug_set_filename call" +msgstr "debug_record_function: aucun appel debug_set_filename" + +#: debug.c:852 +msgid "debug_record_parameter: no current function" +msgstr "debug_record_parameter: aucune fonction courante" + +#: debug.c:886 +msgid "debug_end_function: no current function" +msgstr "debug_end_function: aucune fonction courante" + +#: debug.c:892 +msgid "debug_end_function: some blocks were not closed" +msgstr "debug_end_function: quelques blocs n'ont pas été fermés" + +#: debug.c:922 +msgid "debug_start_block: no current block" +msgstr "debug_start_block: aucun bloc couratn" + +#: debug.c:960 +msgid "debug_end_block: no current block" +msgstr "debug_end_block: aucun bloc courant" + +#: debug.c:967 +msgid "debug_end_block: attempt to close top level block" +msgstr "debug_end_block: tentative de fermeture du bloc du niveau supérieur" + +#: debug.c:993 +msgid "debug_record_line: no current unit" +msgstr "debug_record_line: aucune unité courante" + +#. FIXME +#: debug.c:1047 +msgid "debug_start_common_block: not implemented" +msgstr "debug_start_common_block: pas implanté" + +#. FIXME +#: debug.c:1059 +msgid "debug_end_common_block: not implemented" +msgstr "debug_end_common_block: pas implanté" + +#. FIXME. +#: debug.c:1153 +msgid "debug_record_label: not implemented" +msgstr "debug_record_label: pas implanté" + +#: debug.c:1179 +msgid "debug_record_variable: no current file" +msgstr "debug_record_variable: aucun fichier courant" + +#: debug.c:1762 +msgid "debug_make_undefined_type: unsupported kind" +msgstr "debug_make_undefined_type: type non supportée" + +#: debug.c:1963 +msgid "debug_name_type: no current file" +msgstr "debug_name_type: aucun fichier courant" + +#: debug.c:2011 +msgid "debug_tag_type: no current file" +msgstr "debug_tag_type: aucune fichier courant" + +#: debug.c:2019 +msgid "debug_tag_type: extra tag attempted" +msgstr "debug_tag_type: tentative d'étiquetage additionnelle" + +#: debug.c:2058 +#, c-format +msgid "Warning: changing type size from %d to %d\n" +msgstr "AVERTISSEMENT: changement de taille du type de %d à %d\n" + +#: debug.c:2082 +msgid "debug_find_named_type: no current compilation unit" +msgstr "debug_find_named_type: aucune unité de compilation courante" + +#: debug.c:2189 +#, c-format +msgid "debug_get_real_type: circular debug information for %s\n" +msgstr "debug_get_real_type: information circulaire de débogage pour %s\n" + +#: debug.c:2650 +msgid "debug_write_type: illegal type encountered" +msgstr "debug_write_type: type illégal rencontré" + +#: dlltool.c:812 dlltool.c:837 dlltool.c:863 +#, c-format +msgid "Internal error: Unknown machine type: %d" +msgstr "erreur interne: type de machine inconnue: %d" + +#: dlltool.c:900 +#, c-format +msgid "Can't open def file: %s" +msgstr "Ne peut ouvrir le fichier de définition: %s" + +#: dlltool.c:905 +#, c-format +msgid "Processing def file: %s" +msgstr "Traitement du fichier de définition: %s" + +#: dlltool.c:909 +msgid "Processed def file" +msgstr "Traitement complété du fichier de définition" + +#: dlltool.c:935 +#, c-format +msgid "Syntax error in def file %s:%d" +msgstr "Erreur de syntaxe dans le fichier de définition %s:%d" + +#: dlltool.c:974 +#, c-format +msgid "NAME: %s base: %x" +msgstr "NOM: %s base: %x" + +#: dlltool.c:977 dlltool.c:996 +msgid "Can't have LIBRARY and NAME" +msgstr "Ne peut trouver la LIBRAIRIE et le NOM" + +#: dlltool.c:993 +#, c-format +msgid "LIBRARY: %s base: %x" +msgstr "LIBRAIRIE: %s base %x" + +#: dlltool.c:1251 resrc.c:271 +#, c-format +msgid "wait: %s" +msgstr "en attente: %s" + +#: dlltool.c:1256 dllwrap.c:430 resrc.c:276 +#, c-format +msgid "subprocess got fatal signal %d" +msgstr "sous-processus a reçu le signal fatal %d" + +#: dlltool.c:1262 dllwrap.c:437 resrc.c:283 +#, c-format +msgid "%s exited with status %d" +msgstr "%s a terminé avec le statut %d" + +#: dlltool.c:1294 +#, c-format +msgid "Sucking in info from %s section in %s" +msgstr "Aspirer les informations de la section %s dans %s" + +#: dlltool.c:1423 +#, c-format +msgid "Excluding symbol: %s" +msgstr "Exclusion de symbole: %s" + +#: dlltool.c:1518 dlltool.c:1529 nm.c:1004 nm.c:1015 +#, c-format +msgid "%s: no symbols" +msgstr "%s: aucun symbole" + +#. FIXME: we ought to read in and block out the base relocations. +#: dlltool.c:1556 +#, c-format +msgid "Done reading %s" +msgstr "Lecture complétée %s" + +#: dlltool.c:1567 +#, c-format +msgid "Unable to open object file: %s" +msgstr "Incapable d'ouvrir le fichier objet: %s" + +#: dlltool.c:1570 +#, c-format +msgid "Scanning object file %s" +msgstr "Scrutation du fichier objet %s" + +#: dlltool.c:1585 +#, c-format +msgid "Cannot produce mcore-elf dll from archive file: %s" +msgstr "Ne peutproduire mcore-elf dll à partir du fichier d'archive: %s" + +#: dlltool.c:1677 +msgid "Adding exports to output file" +msgstr "Ajout des exports au fichier de sortie" + +#: dlltool.c:1724 +msgid "Added exports to output file" +msgstr "Exports ajoutés au fichier de sortie" + +#: dlltool.c:1848 +#, c-format +msgid "Generating export file: %s" +msgstr "Génération du fichier d'exports: %s" + +#: dlltool.c:1853 +#, c-format +msgid "Unable to open temporary assembler file: %s" +msgstr "Incapable d'ouvrir le fichier assembleur temporaire: %s" + +#: dlltool.c:1856 +#, c-format +msgid "Opened temporary file: %s" +msgstr "Fichier temporaire ouvert: %s" + +#: dlltool.c:2086 +msgid "Generated exports file" +msgstr "Fichier d'exports généré" + +#: dlltool.c:2378 +#, c-format +msgid "bfd_open failed open stub file: %s" +msgstr "échec de bfd_open lors de l'ouverture du fichier stub: %s" + +#: dlltool.c:2381 +#, c-format +msgid "Creating stub file: %s" +msgstr "Création du fichier stub: %s" + +#: dlltool.c:2766 +#, c-format +msgid "failed to open temporary head file: %s" +msgstr "échec d'ouverture du fichier de tête temporaire: %s" + +#: dlltool.c:2825 +#, c-format +msgid "failed to open temporary tail file: %s" +msgstr "échec d'ouverture du fichier de queue temporaire: %s" + +#: dlltool.c:2892 +#, c-format +msgid "Can't open .lib file: %s" +msgstr "Ne peut ouvrir le fichier .lib: %s" + +#: dlltool.c:2895 +#, c-format +msgid "Creating library file: %s" +msgstr "Création du fichier de librairie: %s" + +#: dlltool.c:2951 +#, c-format +msgid "cannot delete %s: %s" +msgstr "ne peut détruire %s: %s" + +#: dlltool.c:2955 +msgid "Created lib file" +msgstr "Fichier de libraire créé" + +#: dlltool.c:3062 +#, c-format +msgid "Warning, ignoring duplicate EXPORT %s %d,%d" +msgstr "AVERTISSEMENT: EXPORT en duplication ignoré %s %d,%d" + +#: dlltool.c:3068 +#, c-format +msgid "Error, duplicate EXPORT with oridinals: %s" +msgstr "ERREUR, EXPORT en duplication avec ordinals: %s" + +#: dlltool.c:3191 +msgid "Processing definitions" +msgstr "Traitement des définitions" + +#: dlltool.c:3223 +msgid "Processed definitions" +msgstr "Définitions traitées" + +#. xgetext:c-format +#: dlltool.c:3234 dllwrap.c:495 +#, c-format +msgid "Usage %s \n" +msgstr "Usage %s \n" + +#. xgetext:c-format +#: dlltool.c:3236 +#, c-format +msgid " -m --machine Create as DLL for . [default: %s]\n" +msgstr " -m --machine créer comme DLL pour la . [défaut: %s]\n" + +#: dlltool.c:3237 +msgid " possible : arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" +msgstr " possible : arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" + +#: dlltool.c:3238 +msgid " -e --output-exp Generate an export file.\n" +msgstr " -e --output-exp générer un fichier d'export.\n" + +#: dlltool.c:3239 +msgid " -l --output-lib Generate an interface library.\n" +msgstr " -l --output-lib générer une librairie d'interface.\n" + +#: dlltool.c:3240 +msgid " -a --add-indirect Add dll indirects to export file.\n" +msgstr " -a --add-indirect ajouter les dll indirectes au fichier d'exports.\n" + +#: dlltool.c:3241 +msgid " -D --dllname Name of input dll to put into interface lib.\n" +msgstr " -D --dllname nom du dll à placer dans la libraire d'interface.\n" + +#: dlltool.c:3242 +msgid " -d --input-def Name of .def file to be read in.\n" +msgstr " -d --input-def nom du fichier .def à lire\n" + +#: dlltool.c:3243 +msgid " -z --output-def Name of .def file to be created.\n" +msgstr " -z --output-def nom du fichier .def à créer.\n" + +#: dlltool.c:3244 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols exporter tous les symboles vers le fichier .def\n" + +#: dlltool.c:3245 +msgid " --no-export-all-symbols Only export listed symbols\n" +msgstr " --no-export-all-symbols exporter seulement la liste des symboles\n" + +#: dlltool.c:3246 +msgid " --exclude-symbols Don't export \n" +msgstr " --exclude-symbols ne pas exporter la \n" + +#: dlltool.c:3247 +msgid " --no-default-excludes Clear default exclude symbols\n" +msgstr " --no-default-excludes ne pas tenir compte des symboles d'exclusion par défaut\n" + +#: dlltool.c:3248 +msgid " -b --base-file Read linker generated base file.\n" +msgstr " -b --base-file lire le fichier de base généré par l'éditeur de liens\n" + +#: dlltool.c:3249 +msgid " -x --no-idata4 Don't generate idata$4 section.\n" +msgstr " -x --no-idata4 ne pas générer la section idata$4\n" + +#: dlltool.c:3250 +msgid " -c --no-idata5 Don't generate idata$5 section.\n" +msgstr " -c --no-idata5 ne pas générer la section idata$5\n" + +#: dlltool.c:3251 +msgid " -U --add-underscore Add underscores to symbols in interface library.\n" +msgstr " -U --add-underscore ajouter des soulignés aux symboles dans la librairie d'interface\n" + +#: dlltool.c:3252 +msgid " -k --kill-at Kill @ from exported names.\n" +msgstr " -k --kill-at stopper @ à partir des noms exportés\n" + +#: dlltool.c:3253 +msgid " -A --add-stdcall-alias Add aliases without @.\n" +msgstr " -A --add-stdcall-alias ajouter des aliases sans @\n" + +#: dlltool.c:3254 +msgid " -S --as Use for assembler.\n" +msgstr " -S --as utiliser le pour l'assembleur\n" + +#: dlltool.c:3255 +msgid " -f --as-flags Pass to the assembler.\n" +msgstr " -f --as-flags relayer les à l'assembleur\n" + +#: dlltool.c:3256 +msgid " -C --compat-implib Create backward compatible import library.\n" +msgstr " -C --compat-implib créer une compatibilité arrière à la librairie d'importation\n" + +#: dlltool.c:3257 +msgid " -n --no-delete Keep temp files (repeat for extra preservation).\n" +msgstr " -n --no-delete conserver les fichier temporaires\n" + +#: dlltool.c:3258 +msgid " -v --verbose Be verbose.\n" +msgstr " -v --verbose passer en mode bavard\n" + +#: dlltool.c:3259 +msgid " -V --version Display the program version.\n" +msgstr " -V --version afficher le nom et la version du logiciel\n" + +#: dlltool.c:3260 +msgid " -h --help Display this information.\n" +msgstr " -h --help afficher l'aide-mémoire\n" + +#: dlltool.c:3262 +msgid " -M --mcore-elf Process mcore-elf object files into .\n" +msgstr " -M --mcore-elf traiter le fichier objet mcore-elf selon le \n" + +#: dlltool.c:3263 +msgid " -L --linker Use as the linker.\n" +msgstr " -L --linker utiliser comme éditeur de liens\n" + +#: dlltool.c:3264 +msgid " -F --linker-flags Pass to the linker.\n" +msgstr " -F --linker-flags relayer les à l'éditeur de liens\n" + +#: dlltool.c:3418 +#, c-format +msgid "Unable to open base-file: %s" +msgstr "Incapable d'ouvrir le fichier de base: %s" + +#: dlltool.c:3450 +#, c-format +msgid "Machine '%s' not supported" +msgstr "Machine « %s » n'est pas supportée" + +#: dlltool.c:3553 dllwrap.c:214 +#, c-format +msgid "Tried file: %s" +msgstr "Essai avec le fichier: %s" + +#: dlltool.c:3560 dllwrap.c:221 +#, c-format +msgid "Using file: %s" +msgstr "Utilisation du fichier: %s" + +#: dllwrap.c:308 +#, c-format +msgid "Keeping temporary base file %s" +msgstr "Conservation temportaire du fichier de base %s" + +#: dllwrap.c:310 +#, c-format +msgid "Deleting temporary base file %s" +msgstr "Destruction du fichier de base temporaire %s" + +#: dllwrap.c:324 +#, c-format +msgid "Keeping temporary exp file %s" +msgstr "Conservation du fichier temporaire exp %s" + +#: dllwrap.c:326 +#, c-format +msgid "Deleting temporary exp file %s" +msgstr "Destruction du fichier exp temporaire %s" + +#: dllwrap.c:339 +#, c-format +msgid "Keeping temporary def file %s" +msgstr "Conservation du fichier temporaire def %s" + +#: dllwrap.c:341 +#, c-format +msgid "Deleting temporary def file %s" +msgstr "Destruction du fichier temporaire def %s" + +#: dllwrap.c:496 +msgid " Generic options:\n" +msgstr " Option génériques:\n" + +#: dllwrap.c:497 +msgid " --quiet, -q Work quietly\n" +msgstr " --quiet, -q travailler en silence\n" + +#: dllwrap.c:498 +msgid " --verbose, -v Verbose\n" +msgstr " --verbose, -v travailler en mode bavard\n" + +#: dllwrap.c:499 +msgid " --version Print dllwrap version\n" +msgstr " --version afficher la version du dllwrap\n" + +#: dllwrap.c:500 +msgid " --implib Synonym for --output-lib\n" +msgstr " --implib identique à --output-lib\n" + +#: dllwrap.c:501 +#, c-format +msgid " Options for %s:\n" +msgstr " Options pour %s:\n" + +#: dllwrap.c:502 +msgid " --driver-name Defaults to \"gcc\"\n" +msgstr " --driver-name par défaut « gcc »\n" + +#: dllwrap.c:503 +msgid " --driver-flags Override default ld flags\n" +msgstr " --driver-flags écrasesr les fanions par défaut de ld\n" + +#: dllwrap.c:504 +msgid " --dlltool-name Defaults to \"dlltool\"\n" +msgstr " --dlltool-name par défaut « dlltool »\n" + +#: dllwrap.c:505 +msgid " --entry Specify alternate DLL entry point\n" +msgstr " --entry spécifier une entrée alternative au point d'entrée du DLL\n" + +#: dllwrap.c:506 +msgid " --image-base Specify image base address\n" +msgstr " --image-base spécifier une adresse de l'image de base\n" + +#: dllwrap.c:507 +msgid " --target i386-cygwin32 or i386-mingw32\n" +msgstr " --target i386-cygwin32 ou i386-mingw32\n" + +#: dllwrap.c:508 +msgid " --dry-run Show what needs to be run\n" +msgstr " --dry-run afficher ce qui est nécessaire pour l'exécution\n" + +#: dllwrap.c:509 +msgid " --mno-cygwin Create Mingw DLL\n" +msgstr " --mno-cygwin créer une DLL de type Mingw\n" + +#: dllwrap.c:510 +msgid " Options passed to DLLTOOL:\n" +msgstr " Options relayées à DLLTOOL:\n" + +#: dllwrap.c:511 +msgid " --machine \n" +msgstr " --machine \n" + +#: dllwrap.c:512 +msgid " --output-exp Generate export file.\n" +msgstr " --output-exp générer un fichier d'exports.\n" + +#: dllwrap.c:513 +msgid " --output-lib Generate input library.\n" +msgstr " --output-lib générer une librairie d'entrée.\n" + +#: dllwrap.c:514 +msgid " --add-indirect Add dll indirects to export file.\n" +msgstr " --add-indirect ajouter les dll indirectes au fichier d'exports.\n" + +#: dllwrap.c:515 +msgid " --dllname Name of input dll to put into output lib.\n" +msgstr " --dllname nom du dll d'entrée à ajouter dans le fichier lib de sortie.\n" + +#: dllwrap.c:516 +msgid " --def Name input .def file\n" +msgstr " --def nom du fichier d'entrée .def\n" + +#: dllwrap.c:517 +msgid " --output-def Name output .def file\n" +msgstr " --output-def nom du fichier de sortie .def\n" + +#: dllwrap.c:518 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols exporter tous les symboles au fichier .def\n" + +#: dllwrap.c:519 +msgid " --no-export-all-symbols Only export .drectve symbols\n" +msgstr " --no-export-all-symbols exporter seulement les symboles .drectve\n" + +#: dllwrap.c:520 +msgid " --exclude-symbols Exclude from .def\n" +msgstr " --exclude-symbols exclure la de .def\n" + +#: dllwrap.c:521 +msgid " --no-default-excludes Zap default exclude symbols\n" +msgstr " --no-default-excludes ignorer les symboles par défaut d'exclusion\n" + +#: dllwrap.c:522 +msgid " --base-file Read linker generated base file\n" +msgstr " --base-file lire le fichier de base généré par l'éditeur de liens\n" + +#: dllwrap.c:523 +msgid " --no-idata4 Don't generate idata$4 section\n" +msgstr " --no-idata4 ne pas générer la section idata$4\n" + +#: dllwrap.c:524 +msgid " --no-idata5 Don't generate idata$5 section\n" +msgstr " --no-idata5 ne pas générer la section idata$5\n" + +#: dllwrap.c:525 +msgid " -U Add underscores to .lib\n" +msgstr " -U ajouter des soulignés au fichier .lib\n" + +#: dllwrap.c:526 +msgid " -k Kill @ from exported names\n" +msgstr " -k stopper @ à partir des noms exportés\n" + +#: dllwrap.c:527 +msgid " --add-stdcall-alias Add aliases without @\n" +msgstr " --add-stdcall-alias ajouter les aliases sans @\n" + +#: dllwrap.c:528 +msgid " --as Use for assembler\n" +msgstr " --as utiliser comme assembleur\n" + +#: dllwrap.c:529 +msgid " --nodelete Keep temp files.\n" +msgstr " --nodelete conserver les fichiers temporaires.\n" + +#: dllwrap.c:530 +msgid " Rest are passed unmodified to the language driver\n" +msgstr " le reste est passé sans modification au pilote du langage\n" + +#: dllwrap.c:802 +msgid "Must provide at least one of -o or --dllname options" +msgstr "Obligation de fournir au moins une des options -o or --dllname" + +#: dllwrap.c:830 +msgid "" +"no export definition file provided.\n" +"Creating one, but that may not be what you want" +msgstr "" +"aucun fichier d'exportation de définitions fourni.\n" +"Création du fichier, mais il ne correspondra pas nécessairement à ce que vous désirez." + +#: dllwrap.c:992 +#, c-format +msgid "DLLTOOL name : %s\n" +msgstr "OUTILDLL nom : %s\n" + +#: dllwrap.c:993 +#, c-format +msgid "DLLTOOL options : %s\n" +msgstr "OUTILDLL options : %s\n" + +#: dllwrap.c:994 +#, c-format +msgid "DRIVER name : %s\n" +msgstr "PILOTE name : %s\n" + +#: dllwrap.c:995 +#, c-format +msgid "DRIVER options : %s\n" +msgstr "PILOTE options : %s\n" + +#: emul_aix.c:58 +#, c-format +msgid " [-g] - 32 bit small archive\n" +msgstr " [-g] - petite archive de 32 bits\n" + +#: emul_aix.c:59 +msgid " [-X32] - ignores 64 bit objects\n" +msgstr " [-X32] - ignore les objets de 64 bits\n" + +#: emul_aix.c:60 +msgid " [-X64] - ignores 32 bit objects\n" +msgstr " [-X64] - ignore les objets de 32 bits\n" + +#: emul_aix.c:61 +msgid " [-X32_64] - accepts 32 and 64 bit objects\n" +msgstr " [-X32_64] - accepter les objets de 32 et 64 bits\n" + +#: ieee.c:326 +msgid "unexpected end of debugging information" +msgstr "fin inattendue des informations de débug" + +#: ieee.c:421 +msgid "invalid number" +msgstr "numéro invalide" + +#: ieee.c:480 +msgid "invalid string length" +msgstr "longueur de chaîne invalide" + +#: ieee.c:537 ieee.c:578 +msgid "expression stack overflow" +msgstr "débordement de pile de l'expression" + +#: ieee.c:557 +msgid "unsupported IEEE expression operator" +msgstr "opérateur d'espression IEEE non supporté" + +#: ieee.c:572 +msgid "unknown section" +msgstr "section inconnue" + +#: ieee.c:593 +msgid "expression stack underflow" +msgstr "sous dépilage de l'expression" + +#: ieee.c:607 +msgid "expression stack mismatch" +msgstr "non concordance de l'expression dans la pile" + +#: ieee.c:646 +msgid "unknown builtin type" +msgstr "type de construit interne inconnu" + +#: ieee.c:791 +msgid "BCD float type not supported" +msgstr "type de numérotaion flottante BCD inconnue" + +#: ieee.c:937 +msgid "unexpected number" +msgstr "numéro inattendu" + +#: ieee.c:944 +msgid "unexpected record type" +msgstr "type d'enregistrement inattendu" + +#: ieee.c:977 +msgid "blocks left on stack at end" +msgstr "des blocs sont demeurés sur la pile à la fin" + +#: ieee.c:1242 +msgid "unknown BB type" +msgstr "type BB inconnu" + +#: ieee.c:1251 +msgid "stack overflow" +msgstr "débordement de la pile" + +#: ieee.c:1276 +msgid "stack underflow" +msgstr "sous dépilage de la pile" + +#: ieee.c:1390 ieee.c:1462 ieee.c:2161 +msgid "illegal variable index" +msgstr "variable d'index illégale" + +#: ieee.c:1440 +msgid "illegal type index" +msgstr "type d'index illégal" + +#: ieee.c:1450 ieee.c:1487 +msgid "unknown TY code" +msgstr "code TY inconnu" + +#: ieee.c:1469 +msgid "undefined variable in TY" +msgstr "variable non définie dans TY" + +#. Pascal file name. FIXME. +#: ieee.c:1880 +msgid "Pascal file name not supported" +msgstr "Nom de fichier Pascal non supporté" + +#: ieee.c:1928 +msgid "unsupported qualifier" +msgstr "qualificateur non supporté" + +#: ieee.c:2199 +msgid "undefined variable in ATN" +msgstr "variable non définie dans ATN" + +#: ieee.c:2242 +msgid "unknown ATN type" +msgstr "type ATN inconnu" + +#. Reserved for FORTRAN common. +#: ieee.c:2364 +msgid "unsupported ATN11" +msgstr "ATN11 non supporté" + +#. We have no way to record this information. FIXME. +#: ieee.c:2391 +msgid "unsupported ATN12" +msgstr "ATN2 non supporté" + +#: ieee.c:2451 +msgid "unexpected string in C++ misc" +msgstr "chaîne inattendue dans misc en C++" + +#: ieee.c:2464 +msgid "bad misc record" +msgstr "mauvais enregistrement misc" + +#: ieee.c:2507 +msgid "unrecognized C++ misc record" +msgstr "enregistrement misc non reconnu en C++" + +#: ieee.c:2624 +msgid "undefined C++ object" +msgstr "objet indéfini en C++" + +#: ieee.c:2658 +msgid "unrecognized C++ object spec" +msgstr "spécification d'objet non reconnu en C++" + +#: ieee.c:2694 +msgid "unsupported C++ object type" +msgstr "type d'objet non supporté en C++" + +#: ieee.c:2704 +msgid "C++ base class not defined" +msgstr "classe de base non définie en C++" + +#: ieee.c:2716 ieee.c:2821 +msgid "C++ object has no fields" +msgstr "objet n'ayant pas de champ en C++" + +#: ieee.c:2735 +msgid "C++ base class not found in container" +msgstr "classe de base non repéré dans le conteneur en C++" + +#: ieee.c:2842 +msgid "C++ data member not found in container" +msgstr "membre des données non repéré dans le conteneur en C++" + +#: ieee.c:2883 ieee.c:3033 +msgid "unknown C++ visibility" +msgstr "visibilité C++ inconnue" + +#: ieee.c:2917 +msgid "bad C++ field bit pos or size" +msgstr "mauvais champ de bit pos ou de taille en C++" + +#: ieee.c:3009 +msgid "bad type for C++ method function" +msgstr "mauvais type pour le méthode d'une fonction en C++" + +#: ieee.c:3019 +msgid "no type information for C++ method function" +msgstr "aucune information sur le type pour la méthode de la fonction en C++" + +#: ieee.c:3058 +msgid "C++ static virtual method" +msgstr "méthode statique virtuelle en C++" + +#: ieee.c:3153 +msgid "unrecognized C++ object overhead spec" +msgstr "spécification de l'en-tête de l'objet en C++ n'est pas reconnue" + +#: ieee.c:3192 +msgid "undefined C++ vtable" +msgstr "vtable non définie en C++" + +#: ieee.c:3263 +msgid "C++ default values not in a function" +msgstr "valeurs par défaut ne sont pas dans une fonction en C++" + +#: ieee.c:3303 +msgid "unrecognized C++ default type" +msgstr "type par défaut en C++ n'est pas reconnu" + +#: ieee.c:3334 +msgid "reference parameter is not a pointer" +msgstr "paramètre de la référence n'est pas un pointeur" + +#: ieee.c:3419 +msgid "unrecognized C++ reference type" +msgstr "référence du type en C++ n'est pas reconnue" + +#: ieee.c:3501 +msgid "C++ reference not found" +msgstr "la référence n'a pas été retrouvée en C++" + +#: ieee.c:3509 +msgid "C++ reference is not pointer" +msgstr "la référence n'est pas un pointeur en C++" + +#: ieee.c:3538 ieee.c:3546 +msgid "missing required ASN" +msgstr "ASN requis est absent" + +#: ieee.c:3576 ieee.c:3584 +msgid "missing required ATN65" +msgstr "ATN65 requis est absent" + +#: ieee.c:3598 +msgid "bad ATN65 record" +msgstr "mauvais enregistrement ATN65" + +#: ieee.c:4286 +msgid "IEEE numeric overflow: 0x" +msgstr "débordement numériquie IEEE: Ox" + +#: ieee.c:4332 +#, c-format +msgid "IEEE string length overflow: %u\n" +msgstr "débordement de la longueur de la chaîne IEEE: %u\n" + +#: ieee.c:5382 +#, c-format +msgid "IEEE unsupported integer type size %u\n" +msgstr "taille de type d'entier IEEE non supporté %u\n" + +#: ieee.c:5418 +#, c-format +msgid "IEEE unsupported float type size %u\n" +msgstr "taille de type de nombre IEEE en notation flottante non supporté %u\n" + +#: ieee.c:5454 +#, c-format +msgid "IEEE unsupported complex type size %u\n" +msgstr "taille de nombre complexe IEEE non supportée %u\n" + +#: nlmconv.c:282 srconv.c:2043 +msgid "input and output files must be different" +msgstr "fichiers d'entrée et de sortie doivent être différents" + +#: nlmconv.c:329 +msgid "input file named both on command line and with INPUT" +msgstr "fichier d'entrée nommé à la fois sur la ligne de commande et dans la champ INPUT" + +#: nlmconv.c:338 +msgid "no input file" +msgstr "aucun fichier d'entrée" + +#: nlmconv.c:368 +msgid "no name for output file" +msgstr "aucun nom pour le fichier de sortie" + +#: nlmconv.c:382 +msgid "warning: input and output formats are not compatible" +msgstr "AVERTISSEMENT: les formats d'entrée et de sortie sont incompatibles" + +#: nlmconv.c:411 +msgid "make .bss section" +msgstr "générer la section .bss" + +#: nlmconv.c:420 +msgid "make .nlmsections section" +msgstr "générer la section .nlmsections" + +#: nlmconv.c:422 +msgid "set .nlmsections flags" +msgstr "initialiser les fanions .nlmsections" + +#: nlmconv.c:450 +msgid "set .bss vma" +msgstr "initialiser le vma de la section .bss" + +#: nlmconv.c:457 +msgid "set .data size" +msgstr "initialiser la taille de la section .data" + +#: nlmconv.c:637 +#, c-format +msgid "warning: symbol %s imported but not in import list" +msgstr "AVERTISSEMENT: symbole %s importé mais n'est pas dans la liste d'importation" + +#: nlmconv.c:657 +msgid "set start address" +msgstr "initialiser l'adresse de départ" + +#: nlmconv.c:706 +#, c-format +msgid "warning: START procedure %s not defined" +msgstr "AVERTISSEMENT: procédure START %s n'est pas définie" + +#: nlmconv.c:708 +#, c-format +msgid "warning: EXIT procedure %s not defined" +msgstr "AVERTISSEMENT: procédure EXIT %s n'est pas définie" + +#: nlmconv.c:710 +#, c-format +msgid "warning: CHECK procedure %s not defined" +msgstr "AVERTISSEMENT: procédure CHECK %s n'est pas définie" + +#: nlmconv.c:731 nlmconv.c:920 +msgid "custom section" +msgstr "section « custom »" + +#: nlmconv.c:752 nlmconv.c:949 +msgid "help section" +msgstr "section d'aide" + +#: nlmconv.c:774 nlmconv.c:967 +msgid "message section" +msgstr "section message" + +#: nlmconv.c:790 nlmconv.c:1000 +msgid "module section" +msgstr "section module" + +#: nlmconv.c:810 nlmconv.c:1016 +msgid "rpc section" +msgstr "section rpc" + +#. There is no place to record this information. +#: nlmconv.c:846 +#, c-format +msgid "%s: warning: shared libraries can not have uninitialized data" +msgstr "%s: AVERTISSEMENT: les librairies partagées ne peuvent avoir des données non initialisées" + +#: nlmconv.c:867 nlmconv.c:1035 +msgid "shared section" +msgstr "section partagée" + +#: nlmconv.c:875 +msgid "warning: No version number given" +msgstr "AVERTISSEMENT: aucun numéro de version fourni" + +#: nlmconv.c:915 nlmconv.c:944 nlmconv.c:962 nlmconv.c:1011 nlmconv.c:1030 +#, c-format +msgid "%s: read: %s" +msgstr "%s: lu: %s" + +#: nlmconv.c:937 +msgid "warning: MAP and FULLMAP are not supported; try ld -M" +msgstr "AVERTISSEMENT: MAP et FULLMAP ne sont pas supportées; essayer ld -M" + +#: nlmconv.c:1109 +#, c-format +msgid "Usage: %s [option(s)] [in-file [out-file]]\n" +msgstr "Usage: %s [options] fichier_entrée [fichier_sortie]\n" + +#: nlmconv.c:1110 +msgid " Convert an object file into a NetWare Loadable Module\n" +msgstr "Convertir un fichier objet en un module NetWare Loadable\n" + +#: nlmconv.c:1111 +msgid "" +" The options are:\n" +" -I --input-target= Set the input binary file format\n" +" -O --output-target= Set the output binary file format\n" +" -T --header-file= Read for NLM header information\n" +" -l --linker= Use for any linking\n" +" -d --debug Display on stderr the linker command line\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +msgstr "" +"Les options sont:\n" +" -I --input-target= sélectionner le format binaire du fichier d'entrée\n" +" -O --output-target= sélectionner le format binaire du fichier de sortie\n" +" -T --header-file= lire les informations NLM du \n" +" -l --linker= utiliser l'éditeur de pour toutes éditions\n" +" -d --debug afficher la ligne de commande sur stderr\n" +" -h --help afficher l'aide-mémoire\n" +" -V --version afficher le nom et la version du logiciel\n" + +#: nlmconv.c:1153 +#, c-format +msgid "support not compiled in for %s" +msgstr "soutien non compilé pour %s" + +#: nlmconv.c:1193 +msgid "make section" +msgstr "section make" + +#: nlmconv.c:1207 +msgid "set section size" +msgstr "initialisation de la taille de la section" + +#: nlmconv.c:1213 +msgid "set section alignment" +msgstr "initialisation de l'alignement de la section" + +#: nlmconv.c:1217 +msgid "set section flags" +msgstr "initialisation des fanions de la section" + +#: nlmconv.c:1228 +msgid "set .nlmsections size" +msgstr "initialisation de la taille de .nlmsections" + +#: nlmconv.c:1316 nlmconv.c:1324 nlmconv.c:1333 nlmconv.c:1338 +msgid "set .nlmsection contents" +msgstr "initialisation du contenu de .nlmsection" + +#: nlmconv.c:1839 +msgid "stub section sizes" +msgstr "taille de la section stub" + +#: nlmconv.c:1888 +msgid "writing stub" +msgstr "écriture du stub" + +#: nlmconv.c:1977 +#, c-format +msgid "unresolved PC relative reloc against %s" +msgstr "relocalisation relative sur PC non résolue de %s" + +#: nlmconv.c:2041 +#, c-format +msgid "overflow when adjusting relocation against %s" +msgstr "débordement lors de la relocalisation de %s" + +#: nlmconv.c:2158 +#, c-format +msgid "%s: execution of %s failed: " +msgstr "%s: échec d'exécution de %s :" + +#: nlmconv.c:2173 +#, c-format +msgid "Execution of %s failed" +msgstr "Échec d'exécution de %s" + +#: nm.c:283 size.c:85 strings.c:657 +#, c-format +msgid "Usage: %s [option(s)] [file(s)]\n" +msgstr "Usage: %s [options] fichiers\n" + +#: nm.c:284 +msgid " List symbols in [file(s)] (a.out by default).\n" +msgstr "Afficher les symboles des [fichiers] (a.out par défaut).\n" + +#: nm.c:285 +msgid "" +" The options are:\n" +" -a, --debug-syms Display debugger-only symbols\n" +" -A, --print-file-name Print name of the input file before every symbol\n" +" -B Same as --format=bsd\n" +" -C, --demangle[=STYLE] Decode low-level symbol names into user-level names\n" +" The STYLE, if specified, can be `auto' (the default),\n" +" `gnu', `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n" +" or `gnat'\n" +" --no-demangle Do not demangle low-level symbol names\n" +" -D, --dynamic Display dynamic symbols instead of normal symbols\n" +" --defined-only Display only defined symbols\n" +" -e (ignored)\n" +" -f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',\n" +" `sysv' or `posix'. The default is `bsd'\n" +" -g, --extern-only Display only external symbols\n" +" -l, --line-numbers Use debugging information to find a filename and\n" +" line number for each symbol\n" +" -n, --numeric-sort Sort symbols numerically by address\n" +" -o Same as -A\n" +" -p, --no-sort Do not sort the symbols\n" +" -P, --portability Same as --format=posix\n" +" -r, --reverse-sort Reverse the sense of the sort\n" +" -S, --print-size Print size of defined symbols\n" +" -s, --print-armap Include index for symbols from archive members\n" +" --size-sort Sort symbols by size\n" +" -t, --radix=RADIX Use RADIX for printing symbol values\n" +" --target=BFDNAME Specify the target object format as BFDNAME\n" +" -u, --undefined-only Display only undefined symbols\n" +" -X 32_64 (ignored)\n" +" -h, --help Display this information\n" +" -V, --version Display this program's version number\n" +"\n" +msgstr "" +"Les options sont:\n" +" -a, --debug-syms afficher seulement les symboles de débug\n" +" -A, --print-file-name afficher le nom du fichier d'entrée avant chaque symbole\n" +" -B identique à --format=bsd\n" +" -C, --demangle[=STYLE] décoder les noms des symboles de bas niveau en noms de ceux\n" +" du niveau usager. Le STYLE, si spécifié, peut être « auto »\n" +" (par défaut), « gnu », « lucid », « arm », « hp », « edg » ou « gnu-new-abi »,\n" +" --no-demangle ne pas encoder par mutilation les noms des symboles de bas niveau\n" +" -D, --dynamic afficher les symboles dynamiques au lieu des symboles normaux\n" +" --defined-only afficher seulement les symboles définis\n" +" -e (ignoré)\n" +" -f, --format=FORMAT utiliser le FORMAT de sortie qui peut être « bsd » (par défaut),\n" +" « sysv » ou « posix ».\n" +" -g, --extern-only afficher seulement les symboles externes\n" +" -l, --line-numbers utiliser les informations de débug pour repérer le nom de fichier\n" +" et un numéro de ligne pour chaque symbole\n" +" -n, --numeric-sort trier les symboles numériquement par adresse\n" +" -o identique à -A\n" +" -p, --no-sort ne pas trier les symboles\n" +" -P, --portability identique à --format=posix\n" +" -r, --reverse-sort trier en ordre inverse\n" +" -S, --print-size afficher la taille des symboles définis\n" +" -s, --print-armap inclure un index pour les symboles à partir des membres de l'archive\n" +" --size-sort trier les symboles par leur taille\n" +" -t, --radix=BASE utiliser la BASE numérique pour afficher la valeur des symboles\n" +" --target=NOM_BFD spécifier la cible du format de l'objet par le NOM_BFD\n" +" -u, --undefined-only afficher seulement les symboles indéfinis\n" +" -V, --version afficher le nom et la version du logiciel\n" +" -X 32_64 (ignoré)\n" +" -h --help afficher l'aide-mémoire\n" +" -V --version afficher le nom et la version du logiciel\n" +"\n" + +#: nm.c:319 objdump.c:250 +#, c-format +msgid "Report bugs to %s.\n" +msgstr "Rapporter toutes anomalies à %s\n" + +#: nm.c:352 +#, c-format +msgid "%s: invalid radix" +msgstr "%s: base numérique invalide" + +#: nm.c:377 +#, c-format +msgid "%s: invalid output format" +msgstr "%s: format de sortie invalide" + +#: nm.c:494 +msgid "Only -X 32_64 is supported" +msgstr "Seul -X 32_64 est supporté" + +#: nm.c:514 +msgid "Using the --size-sort and --undefined-only options together" +msgstr "Utiliser ensemble les options --size-sort et --undefined-only" + +#: nm.c:515 +msgid "will produce no output, since undefined symbols have no size." +msgstr "ne produira aucune sortie étant donnée que les symboles n'ont aucune taille." + +#: nm.c:543 +#, c-format +msgid "data size %ld" +msgstr "taille des donnée %ld" + +#: nm.c:568 readelf.c:5809 readelf.c:5845 +#, c-format +msgid ": %d" +msgstr ": %d" + +#: nm.c:570 readelf.c:5811 readelf.c:5857 +#, c-format +msgid ": %d" +msgstr ": %d" + +#: nm.c:572 readelf.c:5813 readelf.c:5860 +#, c-format +msgid ": %d" +msgstr ": %d" + +#: nm.c:1376 +#, c-format +msgid "" +"\n" +"\n" +"Undefined symbols from %s:\n" +"\n" +msgstr "" +"\n" +"\n" +"Symboles indéfinis dans %s:\n" +"\n" + +#: nm.c:1378 +#, c-format +msgid "" +"\n" +"\n" +"Symbols from %s:\n" +"\n" +msgstr "" +"\n" +"\n" +"Symboles de %s:\n" +"\n" + +#: nm.c:1380 nm.c:1438 +msgid "" +"Name Value Class Type Size Line Section\n" +"\n" +msgstr "" +"Nom Valeur Classe Type Taille Ligne Section\n" +"\n" + +#: nm.c:1383 nm.c:1441 +msgid "" +"Name Value Class Type Size Line Section\n" +"\n" +msgstr "" +"Nom Valeur Classe Type Taille Ligne Section\n" +"\n" + +#: nm.c:1434 +#, c-format +msgid "" +"\n" +"\n" +"Undefined symbols from %s[%s]:\n" +"\n" +msgstr "" +"\n" +"\n" +"Symboles indéfinis dans %s[%s]:\n" +"\n" + +#: nm.c:1436 +#, c-format +msgid "" +"\n" +"\n" +"Symbols from %s[%s]:\n" +"\n" +msgstr "" +"\n" +"\n" +"Symboles de %s[%s]:\n" +"\n" + +#: nm.c:1658 +msgid "" +"\n" +"Archive index:\n" +msgstr "" +"\n" +"Indexe de l'archive:\n" + +#: objcopy.c:414 srconv.c:1952 +#, c-format +msgid "Usage: %s [option(s)] in-file [out-file]\n" +msgstr "Usage: %s [options] fichier_d_entrée [fichier_de_sortie]\n" + +#: objcopy.c:415 +msgid " Copies a binary file, possibly transforming it in the process\n" +msgstr "Copier un fichier binaire, possiblement le transformer durant le traitement\n" + +#: objcopy.c:416 objcopy.c:495 +msgid " The options are:\n" +msgstr " Les options sont:\n" + +#: objcopy.c:417 +msgid "" +" -I --input-target Assume input file is in format \n" +" -O --output-target Create an output file in format \n" +" -B --binary-architecture Set arch of output file, when input is binary\n" +" -F --target Set both input and output format to \n" +" --debugging Convert debugging information, if possible\n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -j --only-section Only copy section into the output\n" +" --add-gnu-debuglink= Add section .gnu_debuglink linking to \n" +" -R --remove-section Remove section from the output\n" +" -S --strip-all Remove all symbol and relocation information\n" +" -g --strip-debug Remove all debugging symbols & sections\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol Do not copy symbol \n" +" -K --keep-symbol Only copy symbol \n" +" -L --localize-symbol Force symbol to be marked as a local\n" +" -G --keep-global-symbol Localize all symbols except \n" +" -W --weaken-symbol Force symbol to be marked as a weak\n" +" --weaken Force all global symbols to be marked as weak\n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -i --interleave Only copy one out of every bytes\n" +" -b --byte Select byte in every interleaved block\n" +" --gap-fill Fill gaps between sections with \n" +" --pad-to Pad the last section up to address \n" +" --set-start Set the start address to \n" +" {--change-start|--adjust-start} \n" +" Add to the start address\n" +" {--change-addresses|--adjust-vma} \n" +" Add to LMA, VMA and start addresses\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" Change LMA and VMA of section by \n" +" --change-section-lma {=|+|-}\n" +" Change the LMA of section by \n" +" --change-section-vma {=|+|-}\n" +" Change the VMA of section by \n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" Warn if a named section does not exist\n" +" --set-section-flags =\n" +" Set section 's properties to \n" +" --add-section = Add section found in to output\n" +" --rename-section =[,] Rename section to \n" +" --change-leading-char Force output format's leading character style\n" +" --remove-leading-char Remove leading character from global symbols\n" +" --redefine-sym = Redefine symbol name to \n" +" --redefine-syms --redefine-sym for all symbol pairs \n" +" listed in \n" +" --srec-len Restrict the length of generated Srecords\n" +" --srec-forceS3 Restrict the type of generated Srecords to S3\n" +" --strip-symbols -N for all symbols listed in \n" +" --keep-symbols -K for all symbols listed in \n" +" --localize-symbols -L for all symbols listed in \n" +" --keep-global-symbols -G for all symbols listed in \n" +" --weaken-symbols -W for all symbols listed in \n" +" --alt-machine-code Use alternate machine code for output\n" +" --prefix-symbols Add to start of every symbol name\n" +" --prefix-sections Add to start of every section name\n" +" --prefix-alloc-sections \n" +" Add to start of every allocatable\n" +" section name\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +" --info List object formats & architectures supported\n" +msgstr "" +" -I --input-target assumer que le fichier d'entrée est de format \n" +" -O --output-target créer un fichier de sortie de format \n" +" -B --binary-architecture sélectionner l'architecture du fichier de sortie lorsque binaire\n" +" -F --target initialiser les formats d'entrée et de sortie à \n" +" --debugging convertir les informations de débug, si possible\n" +" -p --preserve-dates conserver les dates d'accès et de modification de fichiers\n" +" -j --only-section copier seulement la section dans le fichier de sortie\n" +" --add-gnu-debuglink= ajouter la section .gnu_debuglink d'édition de liens au \n" +" -R --remove-section retirer la section du fichier de sortie\n" +" -S --strip-all retirer tous les symboles et les informations de relocalisation\n" +" -g --strip-debug retirer tous les symboles de débug\n" +" --strip-unneeded retirer tous les symboles qui ne sont pas nécessaires pour la relocalisation\n" +" -N --strip-symbol ne pas copier le symbole \n" +" -K --keep-symbol copier seulement le symbole \n" +" -L --localize-symbol marquer le symbole comme symbole local\n" +" -G --keep-global-symbol localiser tous les symboles sauf celui ayant pour \n" +" -W --weaken-symbol marquer le symbole comme symbole faible\n" +" --weaken marquer tous les symboles globaux comme symboles faibles\n" +" -x --discard-all retirer tous les symboles qui ne sont pas globaux\n" +" -X --discard-locals retirer tous les symboles générés par le compilateur\n" +" -i --interleave copier seulement 1 octet à chaque d'octets\n" +" -b --byte sélectionner l'octet dans chaque bloc intercalé\n" +" --gap-fill remplir les trous entre les sections avec la \n" +" --pad-to remplir la dernière section jusqu'à l'\n" +" --set-start utiliser l' de départ\n" +" {--change-start|--adjust-start} \n" +" ajouter l' à l'adresse de départ\n" +" {--change-addresses|--adjust-vma} \n" +" ajouter l' aux adresses LMA, VMA et de départ\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" modifier LMA et VMA de la section par la \n" +" --change-section-lma {=|+|-}\n" +" modifier LMA de la section par la \n" +" --change-section-vma {=|+|-}\n" +" modifier VMA de la section par la \n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" avertir si le nom de la section n'existe pas\n" +" --set-section-flags =\n" +" initialiser les propriétés de la section avec les \n" +" --add-section = ajouter la section repérée dans le vers la sortie\n" +" --rename-section =[,] renommer l' section à la \n" +" --change-leading-char forcer le format de sortie du style des caractères de préfixe\n" +" --remove-leading-char retirer les caractères de préfixe des symboles globaux\n" +" --redefine-sym =\n" +" redéfinir le nom du symbole à \n" +" --srec-len restreindre la longueur des Srecords générés\n" +" --srec-forceS3 restreindre le type de Srecords générés à S3\n" +" --strip-symbols -N pour tous les symboles listés dans le \n" +" --keep-symbols -K pour tous les symboles listés dans le \n" +" --localize-symbols -L pour tous les symboles listés dans le \n" +" --keep-global-symbols \n" +" -G pour tous les symboles listés dans le \n" +" --weaken-symbols -W pour tous les symboles listés dans le \n" +" --alt-machine-code Use alternate machine code for output\n" +" -v --verbose afficher la liste de tous les objets modifiés\n" +" -V --version afficher le nom et la version du logiciel\n" +" -h --help afficher l'aide-mémoire\n" + +#: objcopy.c:493 +#, c-format +msgid "Usage: %s in-file(s)\n" +msgstr "Usage: %s fichiers\n" + +#: objcopy.c:494 +msgid " Removes symbols and sections from files\n" +msgstr "Enlever les symboles et les sections des fichiers\n" + +#: objcopy.c:496 +msgid "" +" -I --input-target= Assume input file is in format \n" +" -O --output-target= Create an output file in format \n" +" -F --target= Set both input and output format to \n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -R --remove-section= Remove section from the output\n" +" -s --strip-all Remove all symbol and relocation information\n" +" -g -S -d --strip-debug Remove all debugging symbols & sections\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol= Do not copy symbol \n" +" -K --keep-symbol= Only copy symbol \n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +" --info List object formats & architectures supported\n" +" -o Place stripped output into \n" +msgstr "" +" -I --input-target assumer que le format du fichier d'entrée est \n" +" -O --output-target créer un fichier de sortie ayant le format \n" +" -F --target utiliser à l'entrée et à la sortie le format \n" +" -p --preserve-dates préserver les dates d'accès et de modification lors de la copie\n" +" -R --remove-section retirer la section du fichier de sortie\n" +" -s --strip-all retirer tous les symboles et les informations de relocalisation\n" +" -g -S -d --strip-debug retirer tous les symboles de débug\n" +" --strip-unneeded retirer tous les symboles qui ne sont pas nécessaire à la relocalisation\n" +" -N --strip-symbol ne pas copier le symbole \n" +" -K --keep-symbol copier seulement le symbole \n" +" -x --discard-all retirer tous les symboles qui ne sont pas globaux\n" +" -X --discard-locals retirer tous les symboles qui sont générés par le compilateur\n" +" -v --verbose afficher tous les fichiers objets modifiés\n" +" -V --version afficher le nom et la version du logiciel\n" +" -h --help afficher l'aide-mémoire\n" +" --info lister le format des objets et les architectures supportés\n" +" -o placer la sortie élaguée dans le \n" + +#: objcopy.c:567 +#, c-format +msgid "unrecognized section flag `%s'" +msgstr "fanion de section non reconnnu « %s »" + +#: objcopy.c:568 +#, c-format +msgid "supported flags: %s" +msgstr "fanions supportés: %s" + +#: objcopy.c:645 objcopy.c:2526 +#, c-format +msgid "cannot stat: %s: %s" +msgstr "ne peut évaluer par stat(): %s: %s" + +#: objcopy.c:652 objcopy.c:2544 +#, c-format +msgid "cannot open: %s: %s" +msgstr "ne peut ouvrir: %s: %s" + +#: objcopy.c:655 objcopy.c:2548 +#, c-format +msgid "%s: fread failed" +msgstr "%s: fread en échec" + +#: objcopy.c:728 +#, c-format +msgid "Ignoring rubbish found on line %d of %s" +msgstr "Rebus ignorés trouvés sur la ligne %d de %s" + +#: objcopy.c:979 +#, c-format +msgid "%s: Multiple redefinition of symbol \"%s\"" +msgstr "%s: re-définition multiples du symbole « %s »" + +#: objcopy.c:983 +#, c-format +msgid "%s: Symbol \"%s\" is target of more than one redefinition" +msgstr "%s: symbole « %s » cible plus d'une re-définition" + +#: objcopy.c:1010 +#, c-format +msgid "couldn't open symbol redefinition file %s (error: %s)" +msgstr "ne peut ouvrir le fichier de redéfinition de symboles %s (erreur: %s)" + +#: objcopy.c:1088 +#, c-format +msgid "%s: garbage at end of line %d" +msgstr "%s: rebus à la fin de la ligne %d" + +#: objcopy.c:1091 +#, c-format +msgid "%s: missing new symbol name at line %d" +msgstr "%s: nom du nouveau symbole manquant à la ligne %d" + +#: objcopy.c:1101 +#, c-format +msgid "%s: premature end of file at line %d" +msgstr "%s: fin prématuré de fichier à la ligne %d" + +#: objcopy.c:1147 +msgid "Unable to change endianness of input file(s)" +msgstr "Incapable de changer de systèmes d'encodage (poids fort- faible) des fichiers d'entrée" + +#: objcopy.c:1155 +#, c-format +msgid "copy from %s(%s) to %s(%s)\n" +msgstr "copie de %s(%s) vers %s(%s)\n" + +#: objcopy.c:1182 +#, c-format +msgid "Warning: Output file cannot represent architecture %s" +msgstr "AVERTISSEMENT: fichier de sortie ne peut représenter l'architecture %s" + +#: objcopy.c:1211 +#, c-format +msgid "can't create section `%s': %s" +msgstr "Ne peut créer la section « %s »: %s" + +#: objcopy.c:1304 +#, c-format +msgid "Can't fill gap after %s: %s" +msgstr "Ne peut remplir le vide après %s: %s" + +#: objcopy.c:1329 +#, c-format +msgid "Can't add padding to %s: %s" +msgstr "Ne peut ajouter de remplissage pour %s: %s" + +#: objcopy.c:1485 +#, c-format +msgid "%s: error copying private BFD data: %s" +msgstr "%s: erreur de copie des données privées BFD: %s" + +#: objcopy.c:1498 +msgid "unknown alternate machine code, ignored" +msgstr "code machine alternatif inconnu, ignoré" + +#: objcopy.c:1531 objcopy.c:1561 +#, c-format +msgid "cannot mkdir %s for archive copying (error: %s)" +msgstr "ne peut créer le répertoire mkdir %s pour copie d'archivage (erreur: %s)" + +#: objcopy.c:1749 +#, c-format +msgid "Multiple renames of section %s" +msgstr "Changement multiples de noms de la section %s" + +#: objcopy.c:1840 +msgid "making" +msgstr "génération" + +#: objcopy.c:1849 +msgid "size" +msgstr "taille" + +#: objcopy.c:1863 +msgid "vma" +msgstr "vma" + +#: objcopy.c:1888 +msgid "alignment" +msgstr "alignement" + +#: objcopy.c:1896 +msgid "flags" +msgstr "fanions" + +#: objcopy.c:1918 +msgid "private data" +msgstr "données privées" + +#: objcopy.c:1926 +#, c-format +msgid "%s: section `%s': error in %s: %s" +msgstr "%s: section « %s »: erreur dans %s: %s" + +#: objcopy.c:2199 +#, c-format +msgid "%s: can't create debugging section: %s" +msgstr "%s: ne peut créer la section de débug: %s" + +#: objcopy.c:2214 +#, c-format +msgid "%s: can't set debugging section contents: %s" +msgstr "%s: ne peut initialiser le contenu de la section de débug: %s" + +#: objcopy.c:2223 +#, c-format +msgid "%s: don't know how to write debugging information for %s" +msgstr "%s: ne sait comment écrire les informations de débug de %s" + +#: objcopy.c:2346 +#, c-format +msgid "%s: cannot stat: %s" +msgstr "%s: ne peut évaluer par stat(): %s" + +#: objcopy.c:2400 +msgid "byte number must be non-negative" +msgstr "le nombre d'octet ne peut être négatif" + +#: objcopy.c:2410 +msgid "interleave must be positive" +msgstr "l'intercalage doit être positif" + +#: objcopy.c:2430 objcopy.c:2438 +#, c-format +msgid "%s both copied and removed" +msgstr "%s les deux doivent être copiés et enlevés" + +#: objcopy.c:2523 objcopy.c:2593 objcopy.c:2693 objcopy.c:2724 objcopy.c:2748 +#: objcopy.c:2752 objcopy.c:2772 +#, c-format +msgid "bad format for %s" +msgstr "mauvais format pour %s" + +#: objcopy.c:2662 +#, c-format +msgid "Warning: truncating gap-fill from 0x%s to 0x%x" +msgstr "AVERTISSEMENT: réduction du remplissage de 0x%s à 0x%x" + +#: objcopy.c:2818 +msgid "alternate machine code index must be positive" +msgstr "le code alternatif d'index du code machine doit être positif" + +#: objcopy.c:2856 +msgid "byte number must be less than interleave" +msgstr "le nombre d'octets ne peut être plus petit que celui de l'intercalage" + +#: objcopy.c:2883 +#, c-format +msgid "architecture %s unknown" +msgstr "architecture %s inconnue" + +#: objcopy.c:2887 +msgid "Warning: input target 'binary' required for binary architecture parameter." +msgstr "AVERTISSEMENT: la cible d'entrée « binary » requiert un paramètre pour une architecture binaire." + +#: objcopy.c:2888 +#, c-format +msgid " Argument %s ignored" +msgstr " Argument %s ignoré" + +#: objcopy.c:2894 +#, c-format +msgid "Cannot stat: %s: %s" +msgstr "Ne peut évaluer par stat(): %s: %s" + +#: objcopy.c:2934 objcopy.c:2948 +#, c-format +msgid "%s %s%c0x%s never used" +msgstr "%s %s%c0x%s jamais utilisé" + +#: objdump.c:197 +#, c-format +msgid "Usage: %s \n" +msgstr "Usage: %s \n" + +#: objdump.c:198 +msgid " Display information from object .\n" +msgstr "Afficher les informations depuis les objet.\n" + +#: objdump.c:199 +msgid " At least one of the following switches must be given:\n" +msgstr "Au moins un des commutateurs suivants doit être fourni:\n" + +#: objdump.c:200 +msgid "" +" -a, --archive-headers Display archive header information\n" +" -f, --file-headers Display the contents of the overall file header\n" +" -p, --private-headers Display object format specific file header contents\n" +" -h, --[section-]headers Display the contents of the section headers\n" +" -x, --all-headers Display the contents of all headers\n" +" -d, --disassemble Display assembler contents of executable sections\n" +" -D, --disassemble-all Display assembler contents of all sections\n" +" -S, --source Intermix source code with disassembly\n" +" -s, --full-contents Display the full contents of all sections requested\n" +" -g, --debugging Display debug information in object file\n" +" -G, --stabs Display (in raw form) any STABS info in the file\n" +" -t, --syms Display the contents of the symbol table(s)\n" +" -T, --dynamic-syms Display the contents of the dynamic symbol table\n" +" -r, --reloc Display the relocation entries in the file\n" +" -R, --dynamic-reloc Display the dynamic relocation entries in the file\n" +" -v, --version Display this program's version number\n" +" -i, --info List object formats and architectures supported\n" +" -H, --help Display this information\n" +msgstr "" +" -a, --archive-headers afficher l'information de l'en-tête de l'archive\n" +" -f, --file-headers afficher le contenu global du fichier d'en-tête\n" +" -p, --private-headers afficher le format spécifique du contenu de l'en-tête de l'objet\n" +" -h, --[section-]headers afficher le contenu des en-têtes de section\n" +" -x, --all-headers afficher le contenu de toutes les en-têtes\n" +" -d, --disassemble afficher le contenu en assembleur des sections exécutables\n" +" -D, --disassemble-all afficher le contenu en assembleur de toutes les sections\n" +" -S, --source inter-mêler le code source avec le déassemblage\n" +" -s, --full-contents afficher le contenu complet de toutes les sections voulus\n" +" -g, --debugging afficher information de débug du fichier objet\n" +" -G, --stabs afficher (en format brut) toutes les infos à inclure du fichier\n" +" -t, --syms afficher le contenu de(s) table(s) de symboles\n" +" -T, --dynamic-syms afficher le contenu de la table dynamique de symboles\n" +" -r, --reloc afficher les entrées de relocalisation du fichier\n" +" -R, --dynamic-reloc afficher les entrées dynamiques de relocalisation du fichier\n" +" -V, --version afficher le nom et la version du logiciel\n" +" -i, --info afficher les formats objets et les architectures supportées\n" +" -H, --help afficher cette information\n" + +#: objdump.c:222 +msgid "" +"\n" +" The following switches are optional:\n" +msgstr "" +"\n" +" Les commutateurs suivants sont optionnels:\n" + +#: objdump.c:223 +msgid "" +" -b, --target=BFDNAME Specify the target object format as BFDNAME\n" +" -m, --architecture=MACHINE Specify the target architecture as MACHINE\n" +" -j, --section=NAME Only display information for section NAME\n" +" -M, --disassembler-options=OPT Pass text OPT on to the disassembler\n" +" -EB --endian=big Assume big endian format when disassembling\n" +" -EL --endian=little Assume little endian format when disassembling\n" +" --file-start-context Include context from start of file (with -S)\n" +" -l, --line-numbers Include line numbers and filenames in output\n" +" -C, --demangle[=STYLE] Decode mangled/processed symbol names\n" +" The STYLE, if specified, can be `auto', `gnu',\n" +" `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n" +" or `gnat'\n" +" -w, --wide Format output for more than 80 columns\n" +" -z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling\n" +" --start-address=ADDR Only process data whose address is >= ADDR\n" +" --stop-address=ADDR Only process data whose address is <= ADDR\n" +" --prefix-addresses Print complete address alongside disassembly\n" +" --[no-]show-raw-insn Display hex alongside symbolic disassembly\n" +" --adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n" +"\n" +msgstr "" +" -b, --target=NOMBFD spécifier le format de l'objet cible comme NOMBFD\n" +" -m, --architecture=MACHINE spécifier l'architecture cible de la MACHINE\n" +" -j, --section=NOM afficher seulement les informations de la section du NOM\n" +" -M, --disassembler-options=OPT relayer l'OPTion au dé-assembleur\n" +" -EB --endian=big assumer le format « big endian » lors du dé-assemblage\n" +" -EL --endian=little assumer le format « little endian » lors du dé-assemblage\n" +" --file-start-context inclure le contexte à partir du début du fichier (avec -S)\n" +" -l, --line-numbers inclure les numéros de ligne et les noms de fichier dans la sortie\n" +" -C, --demangle[=STYLE] décoder les mutilations/traitements des noms de symboles\n" +" Le STYLE, si spécifé, peut être « auto », « gnu »,\n" +" « lucid », « arm », « hp », « edg », ou « gnu-v3 »,\n" +" « gnu-new-abi » ou « gnat »\n" +" -w, --wide formatter la sortie pour plus de 80 colonnes\n" +" -z, --disassemble-zeroes ne pas escamoter les blocs de zéros lors du dé-assemblage\n" +" --start-address=ADR traiter seulement les données dont les adresses sont >= ADR\n" +" --stop-address=ADR traiter seulement les données dont les adresses sont <= ADR\n" +" --prefix-addresses afficher les adresses complètes dans le dé-assemblage\n" +" --[no-]show-raw-insn afficher en hexadécimale le dé-assemblage symbolique\n" +" --adjust-vma=DÉCALAGE ajouter un DÉCALAGE à toutes les adresses affichés des sections\n" +"\n" + +#: objdump.c:391 +msgid "Sections:\n" +msgstr "Sections:\n" + +#: objdump.c:394 objdump.c:398 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "Idx Nom Taille VMA LMA Fich off Algn" + +#: objdump.c:400 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "Idx Nom Taille VMA LMA Fich off Algn" + +#: objdump.c:404 +msgid " Flags" +msgstr " Fanions" + +#: objdump.c:406 +msgid " Pg" +msgstr " Pg" + +#: objdump.c:451 +#, c-format +msgid "%s: not a dynamic object" +msgstr "%s: n'est pas un objet dynamique" + +#: objdump.c:1144 +msgid "Out of virtual memory" +msgstr "Mémoire virtuelle épuisée" + +#: objdump.c:1574 +#, c-format +msgid "Can't use supplied machine %s" +msgstr "Ne peut utiliser la machine %s" + +#: objdump.c:1592 +#, c-format +msgid "Can't disassemble for architecture %s\n" +msgstr "Ne peut déassembler pour l'architecture %s\n" + +#: objdump.c:1682 +#, c-format +msgid "Disassembly of section %s:\n" +msgstr "Déassemblage de la section %s:\n" + +#: objdump.c:1847 +#, c-format +msgid "" +"No %s section present\n" +"\n" +msgstr "" +"Aucune section %s présente\n" +"\n" + +#: objdump.c:1854 +#, c-format +msgid "%s has no %s section" +msgstr "%s n'as pas de section %s" + +#: objdump.c:1868 +#, c-format +msgid "Reading %s section of %s failed: %s" +msgstr "Lecture de la section %s de %s a échouée: %s" + +#: objdump.c:1880 +#, c-format +msgid "Reading %s section of %s failed: %s\n" +msgstr "Lecture de la section %s de %s a échouée: %s\n" + +#: objdump.c:1923 +#, c-format +msgid "" +"Contents of %s section:\n" +"\n" +msgstr "" +"Contenu de la section %s:\n" +"\n" + +#: objdump.c:2021 +#, c-format +msgid "architecture: %s, " +msgstr "architecture: %s, " + +#: objdump.c:2024 +#, c-format +msgid "flags 0x%08x:\n" +msgstr "fanions 0x%08x:\n" + +#: objdump.c:2038 +msgid "" +"\n" +"start address 0x" +msgstr "" +"\n" +"adresse de départ 0x" + +#: objdump.c:2071 +#, c-format +msgid "" +"\n" +"%s: file format %s\n" +msgstr "" +"\n" +"%s: format de fichier %s\n" + +#: objdump.c:2111 +#, c-format +msgid "%s: printing debugging information failed" +msgstr "%s: échec d'affichage des information de débug" + +#: objdump.c:2190 +#, c-format +msgid "In archive %s:\n" +msgstr "Dans l'archive %s:\n" + +#: objdump.c:2249 +#, c-format +msgid "Contents of section %s:\n" +msgstr "Contenu de la section %s:\n" + +#: objdump.c:2369 +msgid "no symbols\n" +msgstr "aucun symbole\n" + +#: objdump.c:2718 +msgid "unrecognized -E option" +msgstr "option -E non reconnue" + +#: objdump.c:2729 +#, c-format +msgid "unrecognized --endian type `%s'" +msgstr "type non reconnu --endian « %s »" + +#: rdcoff.c:206 +#, c-format +msgid "parse_coff_type: Bad type code 0x%x" +msgstr "parse_coff_type: mauvais type de code 0x%x" + +#: rdcoff.c:424 rdcoff.c:532 rdcoff.c:731 +#, c-format +msgid "bfd_coff_get_syment failed: %s" +msgstr "bfd_coff_get_syment en échec: %s" + +#: rdcoff.c:440 rdcoff.c:751 +#, c-format +msgid "bfd_coff_get_auxent failed: %s" +msgstr "bfd_coff_get_auxent en échec: %s" + +#: rdcoff.c:818 +#, c-format +msgid "%ld: .bf without preceding function" +msgstr "%ld: .bf aucune fonction qui précède" + +#: rdcoff.c:868 +#, c-format +msgid "%ld: unexpected .ef\n" +msgstr "%ld: .ef inattendu\n" + +#: rddbg.c:91 +#, c-format +msgid "%s: no recognized debugging information" +msgstr "%s: aucune information de débug reconnue" + +#: rddbg.c:415 +msgid "Last stabs entries before error:\n" +msgstr "Dernière entrées à inclure avant erreur:\n" + +#: readelf.c:455 +#, c-format +msgid "%s: Error: " +msgstr "%s: ERREUR: " + +#: readelf.c:466 +#, c-format +msgid "%s: Warning: " +msgstr "%s: AVERTISSEMENT: " + +#: readelf.c:488 +#, c-format +msgid "Unable to seek to 0x%x for %s\n" +msgstr "Incapable de repérer 0x%x pour %s\n" + +#: readelf.c:499 +#, c-format +msgid "Out of memory allocating 0x%x bytes for %s\n" +msgstr "Mémoire épuisée lors de l'allocation de 0x%x octets pour %s\n" + +#: readelf.c:507 +#, c-format +msgid "Unable to read in 0x%x bytes of %s\n" +msgstr "Incapable de lire 0x%x octets de %s\n" + +#: readelf.c:560 readelf.c:614 readelf.c:798 readelf.c:833 +#, c-format +msgid "Unhandled data length: %d\n" +msgstr "Taille de données non traitées: %d\n" + +#: readelf.c:924 +msgid "Don't know about relocations on this machine architecture\n" +msgstr "Ne connaît pas de méthode pour la relocalisation sur l'architecture de cette machine\n" + +#: readelf.c:946 readelf.c:975 readelf.c:1021 readelf.c:1049 +msgid "relocs" +msgstr "relocalisations" + +#: readelf.c:957 readelf.c:986 readelf.c:1031 readelf.c:1059 +msgid "out of memory parsing relocs" +msgstr "Mémoire épuisée lors de l'analyse syntaxique des relocalisations" + +#: readelf.c:1112 +msgid " Offset Info Type Sym. Value Symbol's Name + Addend\n" +msgstr " Décalage Info Type Val.-sym. Noms-symb. + Addenda\n" + +#: readelf.c:1114 +msgid " Offset Info Type Sym.Value Sym. Name + Addend\n" +msgstr " Décalage Info Type Val.-sym Noms-symb + Addenda\n" + +#: readelf.c:1119 +msgid " Offset Info Type Sym. Value Symbol's Name\n" +msgstr " Décalage Info Type Val.-sym. Noms-symboles\n" + +#: readelf.c:1121 +msgid " Offset Info Type Sym.Value Sym. Name\n" +msgstr " Décalage Info Type Val.-sym Noms-symboles\n" + +#: readelf.c:1129 +msgid " Offset Info Type Symbol's Value Symbol's Name + Addend\n" +msgstr " Décalage Info Type Valeurs symbols Noms symboles + Addenda\n" + +#: readelf.c:1131 +msgid " Offset Info Type Sym. Value Sym. Name + Addend\n" +msgstr " Décalage Info Type Val.-symboles Noms-symb.+ Addenda\n" + +#: readelf.c:1136 +msgid " Offset Info Type Symbol's Value Symbol's Name\n" +msgstr " Décalage Info Type Valeurs symbols Noms symbols\n" + +#: readelf.c:1138 +msgid " Offset Info Type Sym. Value Sym. Name\n" +msgstr " Décalage Info Type Val.-symboles Noms-symboles\n" + +#: readelf.c:1414 readelf.c:1416 readelf.c:1492 readelf.c:1494 readelf.c:1503 +#: readelf.c:1505 +#, c-format +msgid "unrecognized: %-7lx" +msgstr "non reconnue: %-7lx" + +#: readelf.c:1466 +#, c-format +msgid "" +msgstr "" + +#: readelf.c:1743 +#, c-format +msgid "Processor Specific: %lx" +msgstr "Spécificités du processeur: %lx" + +#: readelf.c:1762 +#, c-format +msgid "Operating System specific: %lx" +msgstr "Spécificités du systèmes d'exploitation: %lx" + +#: readelf.c:1765 readelf.c:2417 +#, c-format +msgid ": %lx" +msgstr ": %lx" + +#: readelf.c:1779 +msgid "NONE (None)" +msgstr "NONE (Aucun)" + +#: readelf.c:1780 +msgid "REL (Relocatable file)" +msgstr "REL (Fichier de relocalisation)" + +#: readelf.c:1781 +msgid "EXEC (Executable file)" +msgstr "EXEC (fichier exécutable)" + +#: readelf.c:1782 +msgid "DYN (Shared object file)" +msgstr "DYN (fichier objet partagé)" + +#: readelf.c:1783 +msgid "CORE (Core file)" +msgstr "CORE (fichier core)" + +#: readelf.c:1787 +#, c-format +msgid "Processor Specific: (%x)" +msgstr "Spécificités du processor: (%x)" + +#: readelf.c:1789 +#, c-format +msgid "OS Specific: (%x)" +msgstr "Spécificités du système d'exploitation: (%x)" + +#: readelf.c:1791 readelf.c:1898 readelf.c:2574 +#, c-format +msgid ": %x" +msgstr ": %x" + +#: readelf.c:1804 +msgid "None" +msgstr "Aucun" + +#: readelf.c:2616 +msgid "Usage: readelf elf-file(s)\n" +msgstr "Usage: readelf fichiers-elf\n" + +#: readelf.c:2617 +msgid " Display information about the contents of ELF format files\n" +msgstr "Afficher les informations à propos du contenu du format des fichiers ELF\n" + +#: readelf.c:2618 +msgid "" +" Options are:\n" +" -a --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" +" -h --file-header Display the ELF file header\n" +" -l --program-headers Display the program headers\n" +" --segments An alias for --program-headers\n" +" -S --section-headers Display the sections' header\n" +" --sections An alias for --section-headers\n" +" -e --headers Equivalent to: -h -l -S\n" +" -s --syms Display the symbol table\n" +" --symbols An alias for --syms\n" +" -n --notes Display the core notes (if present)\n" +" -r --relocs Display the relocations (if present)\n" +" -u --unwind Display the unwind info (if present)\n" +" -d --dynamic Display the dynamic segment (if present)\n" +" -V --version-info Display the version sections (if present)\n" +" -A --arch-specific Display architecture specific information (if any).\n" +" -D --use-dynamic Use the dynamic section info when displaying symbols\n" +" -x --hex-dump= Dump the contents of section \n" +" -w[liaprmfFso] or\n" +" --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n" +" Display the contents of DWARF2 debug sections\n" +msgstr "" +"Les options sont:\n" +" -a --all équivalent à: -h -l -S -s -r -d -V -A -I\n" +" -h --file-header afficher l'en-tête du fichier ELF\n" +" -l --program-headers afficher les en-têtes du programme\n" +" --segments un alias pour --program-headers\n" +" -S --section-headers afficher les en-têtes des sections\n" +" --sections un alias pour --section-headers\n" +" -e --headers équivalent à: -h -l -S\n" +" -s --syms afficher la table des symboles\n" +" --symbols un alias pour --syms\n" +" -n --notes afficher les notes du core (si présentes)\n" +" -r --relocs afficher les relocalisation (si présentes)\n" +" -u --unwind afficher les informations de type unwind (si présentes)\n" +" -d --dynamic afficher le segment dynamique (si présent)\n" +" -V --version-info afficher la version des sections (si présentes)\n" +" -A --arch-specific afficher les informations spécifiques d'architecture (si présentes)\n" +" -D --use-dynamic utiliser les informations de la section\n" +" dynamique lors de l'affichage des symboles\n" +" -x --hex-dump= vidanger le contenu de la section \n" +" -w[liaprmfFso] ou\n" +" --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n" +" afficher le contenu des sections débug DWARF2\n" + +#: readelf.c:2640 +msgid "" +" -i --instruction-dump=\n" +" Disassemble the contents of section \n" +msgstr "" +" -i --instruction-dump=\n" +" déassembler le contenu de la section \n" + +#: readelf.c:2644 +msgid "" +" -I --histogram Display histogram of bucket list lengths\n" +" -W --wide Allow output width to exceed 80 characters\n" +" -H --help Display this information\n" +" -v --version Display the version number of readelf\n" +msgstr "" +" -I --histogram afficher l'histogramme des bacs selon la longueur de la liste\n" +" -W --wide permettre d'afficher plus de 80 caractères\n" +" -H --help afficher l'aide-mémoire\n" +" -V --version afficher le nom et la version du logiciel\n" + +#: readelf.c:2666 readelf.c:10765 +msgid "Out of memory allocating dump request table." +msgstr "Mémoire épuisée allocation d'une table pour requêtes de vidange" + +#: readelf.c:2830 readelf.c:2906 +#, c-format +msgid "Unrecognized debug option '%s'\n" +msgstr "Option de débug non reconnue « %s »\n" + +#: readelf.c:2940 +#, c-format +msgid "Invalid option '-%c'\n" +msgstr "Option invalide '-%c»\n" + +#: readelf.c:2953 +msgid "Nothing to do.\n" +msgstr "Rien à faire.\n" + +#: readelf.c:2966 readelf.c:2983 readelf.c:5366 +msgid "none" +msgstr "aucun" + +#: readelf.c:2970 readelf.c:2987 readelf.c:3018 +#, c-format +msgid "" +msgstr "" + +#: readelf.c:2984 +msgid "2's complement, little endian" +msgstr "complément à 2, système à octets de poids faible d'abord (little endian)" + +#: readelf.c:2985 +msgid "2's complement, big endian" +msgstr "complément à 2, système à octets de poids fort d'abord (big endian)" + +#: readelf.c:3015 +msgid "Standalone App" +msgstr "Tache autonome" + +#: readelf.c:3034 +msgid "Not an ELF file - it has the wrong magic bytes at the start\n" +msgstr "N'est pas un fichier ELF - a les mauvais octets magiques au départ\n" + +#: readelf.c:3042 +msgid "ELF Header:\n" +msgstr "En-tête ELF:\n" + +#: readelf.c:3043 +msgid " Magic: " +msgstr " Magique: " + +#: readelf.c:3047 +#, c-format +msgid " Class: %s\n" +msgstr " Classe: %s\n" + +#: readelf.c:3049 +#, c-format +msgid " Data: %s\n" +msgstr " Données: %s\n" + +#: readelf.c:3051 +#, c-format +msgid " Version: %d %s\n" +msgstr " Version: %d %s\n" + +#: readelf.c:3058 +#, c-format +msgid " OS/ABI: %s\n" +msgstr " OS/ABI: %s\n" + +#: readelf.c:3060 +#, c-format +msgid " ABI Version: %d\n" +msgstr " Version ABI: %d\n" + +#: readelf.c:3062 +#, c-format +msgid " Type: %s\n" +msgstr " Type: %s\n" + +#: readelf.c:3064 +#, c-format +msgid " Machine: %s\n" +msgstr " Machine: %s\n" + +#: readelf.c:3066 +#, c-format +msgid " Version: 0x%lx\n" +msgstr " Version: 0x%lx\n" + +#: readelf.c:3069 +msgid " Entry point address: " +msgstr " Adresse du point d'entrée: " + +#: readelf.c:3071 +msgid "" +"\n" +" Start of program headers: " +msgstr "" +"\n" +" Début des en-têtes de programme: " + +#: readelf.c:3073 +msgid "" +" (bytes into file)\n" +" Start of section headers: " +msgstr "" +" (octets dans le fichier)\n" +" Début des en-têtes de section: " + +#: readelf.c:3075 +msgid " (bytes into file)\n" +msgstr " (octets dans le fichier)\n" + +#: readelf.c:3077 +#, c-format +msgid " Flags: 0x%lx%s\n" +msgstr " Fanions: 0x%lx%s\n" + +#: readelf.c:3080 +#, c-format +msgid " Size of this header: %ld (bytes)\n" +msgstr " Taille de cet en-tête: %ld (bytes)\n" + +#: readelf.c:3082 +#, c-format +msgid " Size of program headers: %ld (bytes)\n" +msgstr " Taille de l'en-tête du programme: %ld (bytes)\n" + +#: readelf.c:3084 +#, c-format +msgid " Number of program headers: %ld\n" +msgstr " Nombre d'en-tête du programme: %ld\n" + +#: readelf.c:3086 +#, c-format +msgid " Size of section headers: %ld (bytes)\n" +msgstr " Taille des en-têtes de section: %ld (bytes)\n" + +#: readelf.c:3088 +#, c-format +msgid " Number of section headers: %ld" +msgstr " Nombre d'en-têtes de section: %ld" + +#: readelf.c:3093 +#, c-format +msgid " Section header string table index: %ld" +msgstr " Table d'indexes des chaînes d'en-tête de section: %ld" + +#: readelf.c:3127 readelf.c:3163 +msgid "program headers" +msgstr "En-tête de programme" + +#: readelf.c:3203 readelf.c:3480 readelf.c:3526 readelf.c:3589 readelf.c:3656 +#: readelf.c:4715 readelf.c:4758 readelf.c:4948 readelf.c:5917 readelf.c:5931 +#: readelf.c:10411 +msgid "Out of memory\n" +msgstr "Mémoire épuisée\n" + +#: readelf.c:3231 +msgid "" +"\n" +"There are no program headers in this file.\n" +msgstr "" +"\n" +"Il n'y a pas d'en-têtes de programme dans ce fichier.\n" + +#: readelf.c:3237 +#, c-format +msgid "" +"\n" +"Elf file type is %s\n" +msgstr "" +"\n" +"Type de fichier ELF est %s\n" + +#: readelf.c:3238 +msgid "Entry point " +msgstr "Point d'entrée " + +#: readelf.c:3240 +#, c-format +msgid "" +"\n" +"There are %d program headers, starting at offset " +msgstr "" +"\n" +"Il y a %d en-têtes de programme, débutant à l'adresse de décalage" + +#: readelf.c:3252 readelf.c:3254 +msgid "" +"\n" +"Program Headers:\n" +msgstr "" +"\n" +"En-têtes de programme:\n" + +#: readelf.c:3258 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr " Type Décalage Adr. vir. Adr.phys. T.Fich. T.Mém. Fan Alignement\n" + +#: readelf.c:3261 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr " Type Décalage Adr. vir. Adr.phys. T.Fich. T.Mém. Fan Alignement\n" + +#: readelf.c:3265 +msgid " Type Offset VirtAddr PhysAddr\n" +msgstr " Type Décalage Adr.virt Adr.phys.\n" + +#: readelf.c:3267 +msgid " FileSiz MemSiz Flags Align\n" +msgstr " Taille fichier Taille mémoire Fanion Alignement\n" + +#: readelf.c:3360 +msgid "more than one dynamic segment\n" +msgstr "plus d'un segment dynamique\n" + +#: readelf.c:3368 +msgid "Unable to find program interpreter name\n" +msgstr "Incapable de repérer le nom de l'interpréteur du programme\n" + +#: readelf.c:3375 +#, c-format +msgid "" +"\n" +" [Requesting program interpreter: %s]" +msgstr "" +"\n" +" [Réquisition de l'interpréteur de programme: %s]" + +#: readelf.c:3387 +msgid "" +"\n" +" Section to Segment mapping:\n" +msgstr "" +"\n" +" Section à la projection de segement:\n" + +#: readelf.c:3388 +msgid " Segment Sections...\n" +msgstr " Sections de segment...\n" + +#: readelf.c:3437 +msgid "Cannot interpret virtual addresses without program headers.\n" +msgstr "Ne peut interpréter les adresses virtuelles sans l'en-tête du programme.\n" + +#: readelf.c:3453 +#, c-format +msgid "Virtual address 0x%lx not located in any PT_LOAD segment.\n" +msgstr "L'adresse virtuelle 0x%lx ne peut être localisé dans chaque segment PT_LOAD.\n" + +#: readelf.c:3471 readelf.c:3517 +msgid "section headers" +msgstr "En-têtes de section" + +#: readelf.c:3565 readelf.c:3632 +msgid "symbols" +msgstr "symboles" + +#: readelf.c:3576 readelf.c:3643 +msgid "symtab shndx" +msgstr "symtab shndx" + +#: readelf.c:3745 +msgid "" +"\n" +"There are no sections in this file.\n" +msgstr "" +"\n" +"Il n'y a pas de section dans ce fichier.\n" + +#: readelf.c:3751 +#, c-format +msgid "There are %d section headers, starting at offset 0x%lx:\n" +msgstr "Il y a %d en-têtes de section, débutant à l'adresse de décalage 0x%lx:\n" + +#: readelf.c:3768 readelf.c:4098 readelf.c:4433 readelf.c:6070 +msgid "string table" +msgstr "table de chaînes" + +#: readelf.c:3793 +msgid "File contains multiple dynamic symbol tables\n" +msgstr "Le fichier contient plusieurs tables dynamiques de symboles\n" + +#: readelf.c:3805 +msgid "File contains multiple dynamic string tables\n" +msgstr "Le fichier contient plusieurs tables de chaînes dynamiques\n" + +#: readelf.c:3811 +msgid "dynamic strings" +msgstr "chaînes dynamiques" + +#: readelf.c:3817 +msgid "File contains multiple symtab shndx tables\n" +msgstr "Le fichier contient de multiples tables symboliques shndx\n" + +#: readelf.c:3855 +msgid "" +"\n" +"Section Headers:\n" +msgstr "" +"\n" +"En-têtes de section:\n" + +#: readelf.c:3857 +msgid "" +"\n" +"Section Header:\n" +msgstr "" +"\n" +"En-têtes de section:\n" + +#: readelf.c:3861 +msgid " [Nr] Name Type Addr Off Size ES Flg Lk Inf Al\n" +msgstr " [Nr] Nom Type Adr Décala.Taille ES Fan LN Inf Al\n" + +#: readelf.c:3864 +msgid " [Nr] Name Type Address Off Size ES Flg Lk Inf Al\n" +msgstr " [Nr] Nom Type Adr Décala.Taille ES Fan LN Inf Al\n" + +#: readelf.c:3867 +msgid " [Nr] Name Type Address Offset\n" +msgstr " [Nr] Nom Type Adresse Décalage\n" + +#: readelf.c:3868 +msgid " Size EntSize Flags Link Info Align\n" +msgstr " Taille TaillEntré Fanion Lien Info Alignement\n" + +#: readelf.c:3963 +msgid "" +"Key to Flags:\n" +" W (write), A (alloc), X (execute), M (merge), S (strings)\n" +" I (info), L (link order), G (group), x (unknown)\n" +" O (extra OS processing required) o (OS specific), p (processor specific)\n" +msgstr "" +"Clé des fanions:\n" +" W (écriture), A (allocation), X (exécution), M (fusion), S (chaînes)\n" +" I (info), L (ordre des liens), G (groupe), x (inconnu)\n" +" O (traiterment additionnel requis pour l'OS) o (spécifique à l'OS), p (spécifique au processeur)\n" + +#: readelf.c:4031 +#, c-format +msgid "" +"\n" +"'%s' relocation section at offset 0x%lx contains %ld bytes:\n" +msgstr "" +"\n" +"'%s' section de relocalisation à l'adresse de décalage 0x%lx contient %ld octets:\n" + +#: readelf.c:4043 +msgid "" +"\n" +"There are no dynamic relocations in this file.\n" +msgstr "" +"\n" +"Il n'y a pas d'informations de relocalisation dynamique dans ce fichier.\n" + +#: readelf.c:4070 +msgid "" +"\n" +"Relocation section " +msgstr "" +"\n" +"Section de relocalisation " + +#: readelf.c:4075 readelf.c:4496 readelf.c:4510 +#, c-format +msgid "'%s'" +msgstr "« %s »" + +#: readelf.c:4077 readelf.c:4512 +#, c-format +msgid " at offset 0x%lx contains %lu entries:\n" +msgstr " à l'adresse de décalage 0x%lx contient %lu entrées:\n" + +#: readelf.c:4115 +msgid "" +"\n" +"There are no relocations in this file.\n" +msgstr "" +"\n" +"Il n'y a pas de relocalisation dans ce fichier.\n" + +#: readelf.c:4299 +msgid "unwind table" +msgstr "table unwind" + +#: readelf.c:4350 readelf.c:4362 readelf.c:8499 readelf.c:8511 +#, c-format +msgid "Skipping unexpected symbol type %u\n" +msgstr "Escamotage du type de symbole inattendu %u\n" + +#: readelf.c:4370 +#, c-format +msgid "Skipping unexpected relocation type %s\n" +msgstr "Escamotage du type de relocalisation inattendue %s\n" + +#: readelf.c:4415 readelf.c:4440 +msgid "" +"\n" +"There are no unwind sections in this file.\n" +msgstr "" +"\n" +"Il n'y a pas de section unwind dans ce fichier.\n" + +#: readelf.c:4491 +msgid "" +"\n" +"Could not find unwind info section for " +msgstr "" +"\n" +"N'a pu repérer les infos d'une section unwind pour " + +#: readelf.c:4503 +msgid "unwind info" +msgstr "info unwind" + +#: readelf.c:4505 +msgid "" +"\n" +"Unwind section " +msgstr "" +"\n" +"Section unwind" + +#: readelf.c:4699 readelf.c:4742 +msgid "dynamic segment" +msgstr "segment dynamique" + +#: readelf.c:4820 +msgid "" +"\n" +"There is no dynamic segment in this file.\n" +msgstr "" +"\n" +"Il n'y a pas de segement dynamique dans ce fichier.\n" + +#: readelf.c:4854 +msgid "Unable to seek to end of file!" +msgstr "Incapable de repérer la fin du fichier!" + +#: readelf.c:4865 +msgid "Unable to determine the number of symbols to load\n" +msgstr "Incapable de déterminer le nombre de symboles à charger\n" + +#: readelf.c:4895 +msgid "Unable to seek to end of file\n" +msgstr "Incapable de repérer la fin du fichier\n" + +#: readelf.c:4901 +msgid "Unable to determine the length of the dynamic string table\n" +msgstr "Incapable de déterminer la longueur de la table de chaînes dynamiques\n" + +#: readelf.c:4906 +msgid "dynamic string table" +msgstr "table dynamique de chaînes" + +#: readelf.c:4941 +msgid "symbol information" +msgstr "information de symbole" + +#: readelf.c:4965 +#, c-format +msgid "" +"\n" +"Dynamic segment at offset 0x%lx contains %ld entries:\n" +msgstr "" +"\n" +"Segment dynamique à l'adresse de décalage 0x%lx contient %ld entrées:\n" + +#: readelf.c:4968 +msgid " Tag Type Name/Value\n" +msgstr " Étiquettes Type Nom/Valeur\n" + +#: readelf.c:5004 +msgid "Auxiliary library" +msgstr "Librairie auxiliaire" + +#: readelf.c:5008 +msgid "Filter library" +msgstr "Librairie de filtre" + +#: readelf.c:5012 +msgid "Configuration file" +msgstr "Fichier de configuration" + +#: readelf.c:5016 +msgid "Dependency audit library" +msgstr "Librairie d'audit des dépendances" + +#: readelf.c:5020 +msgid "Audit library" +msgstr "Librairie des audits" + +#: readelf.c:5038 readelf.c:5066 readelf.c:5094 +msgid "Flags:" +msgstr "Fanions:" + +#: readelf.c:5041 readelf.c:5069 readelf.c:5096 +msgid " None\n" +msgstr "Aucun\n" + +#: readelf.c:5217 +#, c-format +msgid "Shared library: [%s]" +msgstr "Librairie partagées: [%s]" + +#: readelf.c:5220 +msgid " program interpreter" +msgstr " programme interpréteur" + +#: readelf.c:5224 +#, c-format +msgid "Library soname: [%s]" +msgstr "Librairie soname: [%s]" + +#: readelf.c:5228 +#, c-format +msgid "Library rpath: [%s]" +msgstr "Librairie rpath: [%s]" + +#: readelf.c:5232 +#, c-format +msgid "Library runpath: [%s]" +msgstr "Librairie runpath:[%s]" + +#: readelf.c:5296 +#, c-format +msgid "Not needed object: [%s]\n" +msgstr "Objet non nécessaire: [%s]\n" + +#: readelf.c:5412 +#, c-format +msgid "" +"\n" +"Version definition section '%s' contains %ld entries:\n" +msgstr "" +"\n" +"Section des définitions de version « %s » contient %ld entrées:\n" + +#: readelf.c:5415 +msgid " Addr: 0x" +msgstr " Adr: 0x" + +#: readelf.c:5417 readelf.c:5612 +#, c-format +msgid " Offset: %#08lx Link: %lx (%s)\n" +msgstr " Décalage: %#08lx Lien: %lx (%s)\n" + +#: readelf.c:5424 +msgid "version definition section" +msgstr "section de définition de version" + +#: readelf.c:5450 +#, c-format +msgid " %#06x: Rev: %d Flags: %s" +msgstr " %#06x: Rev: %d Fanions: %s" + +#: readelf.c:5453 +#, c-format +msgid " Index: %d Cnt: %d " +msgstr " Index: %d Compteur: %d " + +#: readelf.c:5464 +#, c-format +msgid "Name: %s\n" +msgstr "Nom: %s\n" + +#: readelf.c:5466 +#, c-format +msgid "Name index: %ld\n" +msgstr "Nom de l'index: %ld\n" + +#: readelf.c:5481 +#, c-format +msgid " %#06x: Parent %d: %s\n" +msgstr " %#06x: Parent %d: %s\n" + +#: readelf.c:5484 +#, c-format +msgid " %#06x: Parent %d, name index: %ld\n" +msgstr " %#06x: Parent %d, name index: %ld\n" + +#: readelf.c:5503 +#, c-format +msgid "" +"\n" +"Version needs section '%s' contains %ld entries:\n" +msgstr "" +"\n" +"Version nécessitant la section « %s » contenant %ld entrées:\n" + +#: readelf.c:5506 +msgid " Addr: 0x" +msgstr " Adr: 0x" + +#: readelf.c:5508 +#, c-format +msgid " Offset: %#08lx Link to section: %ld (%s)\n" +msgstr " Décalage: %#08lx Lien vers la section: %ld (%s)\n" + +#: readelf.c:5514 +msgid "version need section" +msgstr "version nécessite une section" + +#: readelf.c:5536 +#, c-format +msgid " %#06x: Version: %d" +msgstr " %#06x: Version: %d" + +#: readelf.c:5539 +#, c-format +msgid " File: %s" +msgstr " Fichier: %s" + +#: readelf.c:5541 +#, c-format +msgid " File: %lx" +msgstr " Fichier: %lx" + +#: readelf.c:5543 +#, c-format +msgid " Cnt: %d\n" +msgstr " Compteur: %d\n" + +#: readelf.c:5561 +#, c-format +msgid " %#06x: Name: %s" +msgstr " %#06x: Nom: %s" + +#: readelf.c:5564 +#, c-format +msgid " %#06x: Name index: %lx" +msgstr " %#06x: Nom de l'index: %lx" + +#: readelf.c:5567 +#, c-format +msgid " Flags: %s Version: %d\n" +msgstr " Fanions: %s Version: %d\n" + +#: readelf.c:5603 +msgid "version string table" +msgstr "table chaîne de version" + +#: readelf.c:5607 +#, c-format +msgid "" +"\n" +"Version symbols section '%s' contains %d entries:\n" +msgstr "" +"\n" +"La version de section « %s » des symboles contient %d entrée:\n" + +#: readelf.c:5610 +msgid " Addr: " +msgstr " Adr: " + +#: readelf.c:5622 +msgid "version symbol data" +msgstr "données de symbole de version" + +#: readelf.c:5649 +msgid " 0 (*local*) " +msgstr " 0 (*local*) " + +#: readelf.c:5653 +msgid " 1 (*global*) " +msgstr " 1 (*global*) " + +#: readelf.c:5689 readelf.c:6129 +msgid "version need" +msgstr "version nécessaire" + +#: readelf.c:5699 +msgid "version need aux (2)" +msgstr "version nécessite aux (2)" + +#: readelf.c:5741 readelf.c:6192 +msgid "version def" +msgstr "définition de version" + +#: readelf.c:5760 readelf.c:6207 +msgid "version def aux" +msgstr "définition de version aux" + +#: readelf.c:5791 +msgid "" +"\n" +"No version information found in this file.\n" +msgstr "" +"\n" +"Aucune information de version repérée dans ce fichier.\n" + +#: readelf.c:5923 +msgid "Unable to read in dynamic data\n" +msgstr "Incapable de lire les données dynamiques\n" + +#: readelf.c:5967 +msgid "Unable to seek to start of dynamic information" +msgstr "Incapable de repérer le début des informations dynamiques" + +#: readelf.c:5973 +msgid "Failed to read in number of buckets\n" +msgstr "Échec de lecture parmi tous les baquets\n" + +#: readelf.c:5979 +msgid "Failed to read in number of chains\n" +msgstr "Échec de lecture du nombre de chaînes\n" + +#: readelf.c:5999 +msgid "" +"\n" +"Symbol table for image:\n" +msgstr "" +"\n" +"Table de symbole de l'image:\n" + +#: readelf.c:6001 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " Nb Buc: Valeur Taille Type Lien Vis Ndx Nom\n" + +#: readelf.c:6003 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " Nb Buc: Valeur Taille Type Lien Vis Ndx Nom\n" + +#: readelf.c:6048 +#, c-format +msgid "" +"\n" +"Symbol table '%s' contains %lu entries:\n" +msgstr "" +"\n" +"Table de symboles « %s » contient %lu entrées:\n" + +#: readelf.c:6052 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " Num: Valeur Tail Type Lien Vis Ndx Nom\n" + +#: readelf.c:6054 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " Num: Valeur Tail Type Lien Vis Ndx Nom\n" + +#: readelf.c:6101 +msgid "version data" +msgstr "données de version" + +#: readelf.c:6142 +msgid "version need aux (3)" +msgstr "version nécessite aux (3)" + +#: readelf.c:6167 +msgid "bad dynamic symbol" +msgstr "mauvais symbole dynamique" + +#: readelf.c:6230 +msgid "" +"\n" +"Dynamic symbol information is not available for displaying symbols.\n" +msgstr "" +"\n" +"L'information dynamique des symboles n'est pas disponible pour l'affichage des symboles.\n" + +#: readelf.c:6242 +#, c-format +msgid "" +"\n" +"Histogram for bucket list length (total of %d buckets):\n" +msgstr "" +"\n" +"Histogramme de la longeur de la liste des baquets (total de %d baquets):\n" + +#: readelf.c:6244 +#, c-format +msgid " Length Number %% of total Coverage\n" +msgstr " Long. Nombre %% de couverture totale\n" + +#: readelf.c:6249 readelf.c:6268 readelf.c:9898 readelf.c:10090 +msgid "Out of memory" +msgstr "Mémoire épuisée" + +#: readelf.c:6317 +#, c-format +msgid "" +"\n" +"Dynamic info segment at offset 0x%lx contains %d entries:\n" +msgstr "" +"\n" +"Segment d'informations dynamiques à l'adresse de décalage 0x%lx contient %d entrées:\n" + +#: readelf.c:6320 +msgid " Num: Name BoundTo Flags\n" +msgstr " Num: Nom Lier à Fanions\n" + +#: readelf.c:6373 +#, c-format +msgid "" +"\n" +"Assembly dump of section %s\n" +msgstr "" +"\n" +"Vidange de la section assembleur %s\n" + +#: readelf.c:6396 +#, c-format +msgid "" +"\n" +"Section '%s' has no data to dump.\n" +msgstr "" +"\n" +"La section « %s » n'a pas de données à être videngé.\n" + +#: readelf.c:6401 +#, c-format +msgid "" +"\n" +"Hex dump of section '%s':\n" +msgstr "" +"\n" +"Vidange hexadécimale de la section « %s »:\n" + +#: readelf.c:6406 +msgid "section data" +msgstr "données de section" + +#: readelf.c:6555 +msgid "badly formed extended line op encountered!\n" +msgstr "ligne rencontrée de l'extension de l'opérateur est mal composée!\n" + +#: readelf.c:6562 +#, c-format +msgid " Extended opcode %d: " +msgstr " Code op étendu %d: " + +#: readelf.c:6567 +msgid "" +"End of Sequence\n" +"\n" +msgstr "" +"Fin de séquence\n" +"\n" + +#: readelf.c:6573 +#, c-format +msgid "set Address to 0x%lx\n" +msgstr "initialisé l'adresse à 0x%lx\n" + +#: readelf.c:6578 +msgid " define new File Table entry\n" +msgstr " définir une entrée pour un nouveau fichier de table\n" + +#: readelf.c:6579 readelf.c:6726 +msgid " Entry\tDir\tTime\tSize\tName\n" +msgstr " Entrée\tRép.\tDate\tTaille\tNom\n" + +#: readelf.c:6581 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:6584 readelf.c:6586 readelf.c:6588 readelf.c:6738 readelf.c:6740 +#: readelf.c:6742 +#, c-format +msgid "%lu\t" +msgstr "%lu\t" + +#: readelf.c:6589 +#, c-format +msgid "" +"%s\n" +"\n" +msgstr "" +"%s\n" +"\n" + +#: readelf.c:6593 +#, c-format +msgid "UNKNOWN: length %d\n" +msgstr "UNKNOWN: longueur %d\n" + +#: readelf.c:6621 +#, c-format +msgid "" +"\n" +"Dump of debug contents of section %s:\n" +"\n" +msgstr "" +"\n" +"Vidange du contenu de débug de la section %s:\n" +"\n" + +#: readelf.c:6649 +msgid "The line info appears to be corrupt - the section is too small\n" +msgstr "La ligne d'information semble corrompue - la section est trop petite\n" + +#: readelf.c:6658 +msgid "Only DWARF version 2 and 3 line info is currently supported.\n" +msgstr "Seule la ligne d'info DWARF de version 2 et 3 est couramment supportée.\n" + +#: readelf.c:6679 +#, c-format +msgid " Length: %ld\n" +msgstr " Longueur: %ld\n" + +#: readelf.c:6680 +#, c-format +msgid " DWARF Version: %d\n" +msgstr " Version DWARF: %d\n" + +#: readelf.c:6681 +#, c-format +msgid " Prologue Length: %d\n" +msgstr " Longueur du prologue: %d\n" + +#: readelf.c:6682 +#, c-format +msgid " Minimum Instruction Length: %d\n" +msgstr " Longueur minimale des instructions: %d\n" + +#: readelf.c:6683 +#, c-format +msgid " Initial value of 'is_stmt': %d\n" +msgstr " Valeur initiale de « is_stmt »: %d\n" + +#: readelf.c:6684 +#, c-format +msgid " Line Base: %d\n" +msgstr " Ligne de base: %d\n" + +#: readelf.c:6685 +#, c-format +msgid " Line Range: %d\n" +msgstr " Ligne d'étendue: %d\n" + +#: readelf.c:6686 +#, c-format +msgid " Opcode Base: %d\n" +msgstr " Code op Base: %d\n" + +#: readelf.c:6695 +msgid "" +"\n" +" Opcodes:\n" +msgstr "" +"\n" +" Codes op:\n" + +#: readelf.c:6698 +#, c-format +msgid " Opcode %d has %d args\n" +msgstr " Code op %d a %d arguments\n" + +#: readelf.c:6704 +msgid "" +"\n" +" The Directory Table is empty.\n" +msgstr "" +"\n" +" La table des répertoires est vide.\n" + +#: readelf.c:6707 +msgid "" +"\n" +" The Directory Table:\n" +msgstr "" +"\n" +" La table des répertoire:\n" + +#: readelf.c:6711 +#, c-format +msgid " %s\n" +msgstr " %s\n" + +#: readelf.c:6722 +msgid "" +"\n" +" The File Name Table is empty.\n" +msgstr "" +"\n" +" La talbe des noms de fichiers est vide.\n" + +#: readelf.c:6725 +msgid "" +"\n" +" The File Name Table:\n" +msgstr "" +"\n" +" La table des noms de fichiers:\n" + +#: readelf.c:6733 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:6744 +#, c-format +msgid "%s\n" +msgstr "%s\n" + +#. Now display the statements. +#: readelf.c:6752 +msgid "" +"\n" +" Line Number Statements:\n" +msgstr "" +"\n" +" Numéro de ligne des déclarations:\n" + +#: readelf.c:6768 +#, c-format +msgid " Special opcode %d: advance Address by %d to 0x%lx" +msgstr " Code op spécial %d: avancé l'Adresse par %d à 0x%lx" + +#: readelf.c:6772 +#, c-format +msgid " and Line by %d to %d\n" +msgstr " et Ligne par %d à %d\n" + +#: readelf.c:6783 +msgid " Copy\n" +msgstr " Copie\n" + +#: readelf.c:6790 +#, c-format +msgid " Advance PC by %d to %lx\n" +msgstr " Avancer le compteur PC de %d à %lx\n" + +#: readelf.c:6798 +#, c-format +msgid " Advance Line by %d to %d\n" +msgstr " Avancer la ligne de %d à %d\n" + +#: readelf.c:6805 +#, c-format +msgid " Set File Name to entry %d in the File Name Table\n" +msgstr " Initialisé le nom du fichier à l'entrée %d dans la table des noms de fichiers\n" + +#: readelf.c:6813 +#, c-format +msgid " Set column to %d\n" +msgstr " Initialisé la colonne à %d\n" + +#: readelf.c:6820 +#, c-format +msgid " Set is_stmt to %d\n" +msgstr " Initialisé is_stmt avec %d\n" + +#: readelf.c:6825 +msgid " Set basic block\n" +msgstr " Initialisé le bloc de base\n" + +#: readelf.c:6833 +#, c-format +msgid " Advance PC by constant %d to 0x%lx\n" +msgstr " Avancer le compteur PC par constante de %d à 0x%lx\n" + +#: readelf.c:6841 +#, c-format +msgid " Advance PC by fixed size amount %d to 0x%lx\n" +msgstr " Avancer le compteur PC par une taille fixe de %d à 0x%lx\n" + +#: readelf.c:6846 +msgid " Set prologue_end to true\n" +msgstr " Initialiser prologue_end à VRAI\n" + +#: readelf.c:6850 +msgid " Set epilogue_begin to true\n" +msgstr " Initialiser epilogue_begin à VRAI\n" + +#: readelf.c:6856 +#, c-format +msgid " Set ISA to %d\n" +msgstr " Initialiser ISA à %d\n" + +#: readelf.c:6860 +#, c-format +msgid " Unknown opcode %d with operands: " +msgstr " opcode inconnu %d avec les opérandes:" + +#: readelf.c:6891 readelf.c:7371 readelf.c:7443 +#, c-format +msgid "" +"Contents of the %s section:\n" +"\n" +msgstr "" +"Contenue de la section %s:\n" +"\n" + +#: readelf.c:6931 +msgid "Only DWARF 2 and 3 pubnames are currently supported\n" +msgstr "Seuls les noms publics DWARF 2 et 3 sont couramment supportés\n" + +#: readelf.c:6938 +#, c-format +msgid " Length: %ld\n" +msgstr " Longueur: %ld\n" + +#: readelf.c:6940 +#, c-format +msgid " Version: %d\n" +msgstr " Version: %d\n" + +#: readelf.c:6942 +#, c-format +msgid " Offset into .debug_info section: %ld\n" +msgstr " Décalage dans la section .debug_info:%ld\n" + +#: readelf.c:6944 +#, c-format +msgid " Size of area in .debug_info section: %ld\n" +msgstr " Taille de la zone dans la section .debug_info: %ld\n" + +#: readelf.c:6947 +msgid "" +"\n" +" Offset\tName\n" +msgstr "" +"\n" +" Décalage\tNom\n" + +#: readelf.c:7042 +#, c-format +msgid "Unknown TAG value: %lx" +msgstr "Valeur d'étiquette (« TAG ») inconnue: %lx" + +#: readelf.c:7156 +#, c-format +msgid "Unknown AT value: %lx" +msgstr "Valeur AT inconnue: %lx" + +#: readelf.c:7193 +#, c-format +msgid "Unknown FORM value: %lx" +msgstr "Valeur FORM inconnue: %lx" + +#: readelf.c:7392 +#, c-format +msgid " DW_MACINFO_start_file - lineno: %d filenum: %d\n" +msgstr " DW_MACINFO_start_file - no de ligne: %d no de fichier: %d\n" + +#: readelf.c:7397 +msgid " DW_MACINFO_end_file\n" +msgstr " DW_MACINFO_end_file\n" + +#: readelf.c:7405 +#, c-format +msgid " DW_MACINFO_define - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_define - no de ligne : %d macro : %s\n" + +#: readelf.c:7413 +#, c-format +msgid " DW_MACINFO_undef - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_undef - no de ligne : %d macro : %s\n" + +#: readelf.c:7424 +#, c-format +msgid " DW_MACINFO_vendor_ext - constant : %d string : %s\n" +msgstr " DW_MACINFO_vendor_ext - constante : %d chaîne : %s\n" + +#: readelf.c:7452 +msgid " Number TAG\n" +msgstr " Numéro d'étiquette\n" + +#: readelf.c:7458 +#, c-format +msgid " %ld %s [%s]\n" +msgstr " %ld %s [%s]\n" + +#: readelf.c:7461 +msgid "has children" +msgstr "a des rejetons" + +#: readelf.c:7461 +msgid "no children" +msgstr "aucun rejeton" + +#: readelf.c:7465 +#, c-format +msgid " %-18s %s\n" +msgstr " %-18s %s\n" + +#: readelf.c:7486 +#, c-format +msgid " %lu byte block: " +msgstr " %lu bloc d'octets: " + +#: readelf.c:7814 +msgid "(User defined location op)" +msgstr "(Op de localisation défini par l'usager)" + +#: readelf.c:7816 +msgid "(Unknown location op)" +msgstr "(Op de localisation inconnu)" + +#: readelf.c:7855 +msgid "debug_loc section data" +msgstr "données de la section debug_loc" + +#: readelf.c:7887 +msgid "" +"\n" +"The .debug_loc section is empty.\n" +msgstr "" +"\n" +"La section .debug_loc est vide.\n" + +#: readelf.c:7891 +msgid "" +"Contents of the .debug_loc section:\n" +"\n" +msgstr "" +"Contenu de la section .debug_loc:\n" +"\n" + +#: readelf.c:7892 +msgid "" +"\n" +" Offset Begin End Expression\n" +msgstr "" +"\n" +" Décalage Début Fin Expression\n" + +#: readelf.c:7968 +msgid "debug_str section data" +msgstr "données de la section debug_str" + +#: readelf.c:7987 +msgid "" +msgstr "" + +#: readelf.c:7990 +msgid "" +msgstr "" + +#: readelf.c:8009 +msgid "" +"\n" +"The .debug_str section is empty.\n" +msgstr "" +"\n" +"La section .debug_str est vide.\n" + +#: readelf.c:8013 +msgid "" +"Contents of the .debug_str section:\n" +"\n" +msgstr "" +"Contenu de la section .debug_str:\n" +"\n" + +#: readelf.c:8088 +msgid "Internal error: DWARF version is not 2 or 3.\n" +msgstr "Erreur interne: DWARF version n'est ni 2 ou 3.\n" + +#: readelf.c:8203 +#, c-format +msgid " (indirect string, offset: 0x%lx): %s" +msgstr " (chaîne indirecte, décalage: 0x%lx): %s" + +#: readelf.c:8212 +#, c-format +msgid "Unrecognized form: %d\n" +msgstr "Forme non reconnue: %d\n" + +#: readelf.c:8226 +msgid "(not inlined)" +msgstr "(pas en ligne)" + +#: readelf.c:8229 +msgid "(inlined)" +msgstr "(en ligne)" + +#: readelf.c:8232 +msgid "(declared as inline but ignored)" +msgstr "(déclaré comme en ligne mais ignoré)" + +#: readelf.c:8235 +msgid "(declared as inline and inlined)" +msgstr "(déclaré comme en-ligne et en-ligné" + +#: readelf.c:8238 +#, c-format +msgid " (Unknown inline attribute value: %lx)" +msgstr " (valeur d'attibut en ligne inconnu: %lx)" + +#: readelf.c:8419 readelf.c:8646 +#, c-format +msgid "" +"The section %s contains:\n" +"\n" +msgstr "" +"La section %s contient:\n" +"\n" + +#: readelf.c:8535 +#, c-format +msgid " Compilation Unit @ %lx:\n" +msgstr " Unité de compilation @ %lx:\n" + +#: readelf.c:8536 +#, c-format +msgid " Length: %ld\n" +msgstr " Longueur: %ld\n" + +#: readelf.c:8537 +#, c-format +msgid " Version: %d\n" +msgstr " Version: %d\n" + +#: readelf.c:8538 +#, c-format +msgid " Abbrev Offset: %ld\n" +msgstr " Décalage agrégé: %ld\n" + +#: readelf.c:8539 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " Taille des pointeurs: %d\n" + +#: readelf.c:8543 +msgid "Only version 2 and 3 DWARF debug information is currently supported.\n" +msgstr "Seuls les informations de débug de la version DWARF 2 et 3 sont couramment supportés.\n" + +#: readelf.c:8563 +msgid "Unable to locate .debug_abbrev section!\n" +msgstr "Incapable de localiser la section .debug_abbrev!\n" + +#: readelf.c:8569 +msgid "debug_abbrev section data" +msgstr "données de la section debug_abbrev" + +#: readelf.c:8606 +#, c-format +msgid "Unable to locate entry %lu in the abbreviation table\n" +msgstr "Incapable de localiser l'entrée %lu dans la table d'abréviation\n" + +#: readelf.c:8611 +#, c-format +msgid " <%d><%lx>: Abbrev Number: %lu (%s)\n" +msgstr " <%d><%lx>: Numéro d'abréviation: %lu (%s)\n" + +#: readelf.c:8691 +msgid "Only DWARF 2 and 3 aranges are currently supported.\n" +msgstr "Seuls les aranges DWARF de version 2 et 3 sont couramment supportés.\n" + +#: readelf.c:8695 +#, c-format +msgid " Length: %ld\n" +msgstr " Longueur %ld\n" + +#: readelf.c:8696 +#, c-format +msgid " Version: %d\n" +msgstr " Version: %d\n" + +#: readelf.c:8697 +#, c-format +msgid " Offset into .debug_info: %lx\n" +msgstr " Décalage dans .debug_info: %lx\n" + +#: readelf.c:8698 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " Taille des pointeurs: %d\n" + +#: readelf.c:8699 +#, c-format +msgid " Segment Size: %d\n" +msgstr " Taille des segments: %d\n" + +#: readelf.c:8701 +msgid "" +"\n" +" Address Length\n" +msgstr "" +"\n" +" Longueur d'adresse\n" + +#: readelf.c:8903 +#, c-format +msgid "The section %s contains:\n" +msgstr "La section %s contient:\n" + +#: readelf.c:9538 +#, c-format +msgid "Displaying the debug contents of section %s is not yet supported.\n" +msgstr "L'affichage du contenu de la section de débug %s n'est pas encore supporté.\n" + +#: readelf.c:9634 +#, c-format +msgid "" +"\n" +"Section '%s' has no debugging data.\n" +msgstr "" +"\n" +"La section « %s » n'a aucune donnée de débug.\n" + +#: readelf.c:9639 readelf.c:9701 +msgid "debug section data" +msgstr "données de la section debug" + +#: readelf.c:9655 +#, c-format +msgid "Unrecognized debug section: %s\n" +msgstr "Section de débug non reconnue: %s\n" + +#: readelf.c:9729 +msgid "Some sections were not dumped because they do not exist!\n" +msgstr "Quelques sections n'ont pas été vidangées parce qu'inexistantes!\n" + +#: readelf.c:9806 readelf.c:10170 +msgid "liblist" +msgstr "liblist" + +#: readelf.c:9891 +msgid "options" +msgstr "options" + +#: readelf.c:9922 +#, c-format +msgid "" +"\n" +"Section '%s' contains %d entries:\n" +msgstr "" +"\n" +"Section « %s » contient %d entrées:\n" + +#: readelf.c:10083 +msgid "conflict list found without a dynamic symbol table" +msgstr "conflit de liste repéré sans symbole de table dynamique" + +#: readelf.c:10101 readelf.c:10117 +msgid "conflict" +msgstr "conflit" + +#: readelf.c:10127 +#, c-format +msgid "" +"\n" +"Section '.conflict' contains %ld entries:\n" +msgstr "" +"\n" +"La section « .conflict » contient %ld entrées:\n" + +#: readelf.c:10129 +msgid " Num: Index Value Name" +msgstr " Nombre: Index Valeur Nom" + +#: readelf.c:10178 +msgid "liblist string table" +msgstr "table de chaînes liblist" + +#: readelf.c:10187 +#, c-format +msgid "" +"\n" +"Library list section '%s' contains %lu entries:\n" +msgstr "" +"\n" +"Liste de libraire de la section « %s » contenant %lu entrées:\n" + +#: readelf.c:10236 +msgid "NT_PRSTATUS (prstatus structure)" +msgstr "NT_PRSTATUS (structure prstatus)" + +#: readelf.c:10237 +msgid "NT_FPREGSET (floating point registers)" +msgstr "NT_FPREGSET (régistres en virgule flottante)" + +#: readelf.c:10238 +msgid "NT_PRPSINFO (prpsinfo structure)" +msgstr "NT_PRPSINFO (structure prpsinfo)" + +#: readelf.c:10239 +msgid "NT_TASKSTRUCT (task structure)" +msgstr "NT_TASKSTRUCT (structure de taches)" + +#: readelf.c:10240 +msgid "NT_PRXFPREG (user_xfpregs structure)" +msgstr "NT_PRXFPREG (structure user_xfpregs)" + +#: readelf.c:10241 +msgid "NT_PSTATUS (pstatus structure)" +msgstr "NT_PSTATUS (structure pstatus)" + +#: readelf.c:10242 +msgid "NT_FPREGS (floating point registers)" +msgstr "NT_FPREGS (registres en virgule flottante)" + +#: readelf.c:10243 +msgid "NT_PSINFO (psinfo structure)" +msgstr "NT_PSINFO (structure psinfo)" + +#: readelf.c:10244 +msgid "NT_LWPSTATUS (lwpstatus_t structure)" +msgstr "NT_LWPSTATUS (structure lwpstatus_t)" + +#: readelf.c:10245 +msgid "NT_LWPSINFO (lwpsinfo_t structure)" +msgstr "NT_LWPSINFO (structure lwpsinfo_t)" + +#: readelf.c:10246 +msgid "NT_WIN32PSTATUS (win32_pstatus structure)" +msgstr "NT_WIN32PSTATUS (structure win32_pstatus)" + +#: readelf.c:10248 readelf.c:10272 +#, c-format +msgid "Unknown note type: (0x%08x)" +msgstr "Type de note inconnu: (0x%08x)" + +#. NetBSD core "procinfo" structure. +#: readelf.c:10262 +msgid "NetBSD procinfo structure" +msgstr "structure proinfo NetBSD" + +#: readelf.c:10289 readelf.c:10303 +msgid "PT_GETREGS (reg structure)" +msgstr "PT_GETREGS (structure reg)" + +#: readelf.c:10291 readelf.c:10305 +msgid "PT_GETFPREGS (fpreg structure)" +msgstr "PT_GETFPPREGS (structure fpreg)" + +#: readelf.c:10311 +#, c-format +msgid "PT_FIRSTMACH+%d" +msgstr "PT_FIRSTMACH+%d" + +#: readelf.c:10365 +msgid "notes" +msgstr "notes" + +#: readelf.c:10371 +#, c-format +msgid "" +"\n" +"Notes at offset 0x%08lx with length 0x%08lx:\n" +msgstr "" +"\n" +"Notes au décalage 0x%08lx de longueur 0x%08lx:\n" + +#: readelf.c:10373 +msgid " Owner\t\tData size\tDescription\n" +msgstr " Propriétaire\t\tTaille de données\tDescription\n" + +#: readelf.c:10392 +#, c-format +msgid "corrupt note found at offset %x into core notes\n" +msgstr "note corrompue repérée au décalage %x dans les notes du core\n" + +#: readelf.c:10394 +#, c-format +msgid " type: %x, namesize: %08lx, descsize: %08lx\n" +msgstr " type: %x, taille de noms: %08lx, taille de descriptions: %08lx\n" + +#: readelf.c:10476 +msgid "No note segments present in the core file.\n" +msgstr "Aucun note de segment présent dans le fichier core.\n" + +#: readelf.c:10560 +msgid "" +"This instance of readelf has been built without support for a\n" +"64 bit data type and so it cannot read 64 bit ELF files.\n" +msgstr "" +"Cette instance de readelf a été contstruite sans soutien pour des\n" +"types de données de 64 bits et ne peut donc lire des fichiers de 64 bits ELF.\n" + +#: readelf.c:10606 +#, c-format +msgid "Cannot stat input file %s.\n" +msgstr "Ne peut évaluer par stat() le fichier d'entrée %s.\n" + +#: readelf.c:10613 +#, c-format +msgid "Input file %s not found.\n" +msgstr "Fichier d'entrée %s non repéré.\n" + +#: readelf.c:10619 +#, c-format +msgid "%s: Failed to read file header\n" +msgstr "%s: échec de lecture de l'en-tête du fichier\n" + +#: readelf.c:10633 +#, c-format +msgid "" +"\n" +"File: %s\n" +msgstr "" +"\n" +"Fichier: %s\n" + +#: rename.c:132 +#, c-format +msgid "%s: cannot set time: %s" +msgstr "%s: ne peut initialisé l'heure: %s" + +#. We have to clean up here. +#: rename.c:171 rename.c:204 +#, c-format +msgid "%s: rename: %s" +msgstr "%s: changé de nom: %s" + +#: rename.c:212 +#, c-format +msgid "%s: simple_copy: %s" +msgstr "%s: simple copie: %s" + +#: resbin.c:134 +#, c-format +msgid "%s: not enough binary data" +msgstr "%s: pas assez de données binaires" + +#: resbin.c:153 +msgid "null terminated unicode string" +msgstr "chaîne unicode terminée par un null" + +#: resbin.c:183 resbin.c:189 +msgid "resource ID" +msgstr "IDentificateur de ressource" + +#: resbin.c:233 +msgid "cursor" +msgstr "curseur" + +#: resbin.c:267 resbin.c:274 +msgid "menu header" +msgstr "en-tête de menu" + +#: resbin.c:284 +msgid "menuex header" +msgstr "en-tête menuex" + +#: resbin.c:288 +msgid "menuex offset" +msgstr "décalage menuex" + +#: resbin.c:295 +#, c-format +msgid "unsupported menu version %d" +msgstr "version de menu non supportée %d" + +#: resbin.c:323 resbin.c:338 resbin.c:404 +msgid "menuitem header" +msgstr "en-tête d'item du menu" + +#: resbin.c:434 +msgid "menuitem" +msgstr "item du menu" + +#: resbin.c:475 resbin.c:503 +msgid "dialog header" +msgstr "en-tête de dialogue" + +#: resbin.c:493 +#, c-format +msgid "unexpected DIALOGEX version %d" +msgstr "version DIALOGEX inattendue %d" + +#: resbin.c:538 +msgid "dialog font point size" +msgstr "taille en point de fonte de dialogue" + +#: resbin.c:546 +msgid "dialogex font information" +msgstr "information de fonte de type dialogex" + +#: resbin.c:572 resbin.c:590 +msgid "dialog control" +msgstr "contrôle de dialogue" + +#: resbin.c:582 +msgid "dialogex control" +msgstr "contrôle dialogex" + +#: resbin.c:611 +msgid "dialog control end" +msgstr "fin de contrôle du dialogue" + +#: resbin.c:623 +msgid "dialog control data" +msgstr "données de contrôle du dialogue" + +#: resbin.c:666 +msgid "stringtable string length" +msgstr "longueur de chaîne de la table des chaînes" + +#: resbin.c:676 +msgid "stringtable string" +msgstr "chaîne de la table des chaînes" + +#: resbin.c:709 +msgid "fontdir header" +msgstr "en-tête fontdir" + +#: resbin.c:722 +msgid "fontdir" +msgstr "fontdir" + +#: resbin.c:738 +msgid "fontdir device name" +msgstr "nom du périphérique fontdir" + +#: resbin.c:744 +msgid "fontdir face name" +msgstr "nom de la sélection du répertoire de fontes" + +#: resbin.c:787 +msgid "accelerator" +msgstr "accélérateur" + +#: resbin.c:851 +msgid "group cursor header" +msgstr "en-tête du groupe de curseurs" + +#: resbin.c:855 +#, c-format +msgid "unexpected group cursor type %d" +msgstr "type de groupe de curseur inattendu %d" + +#: resbin.c:870 +msgid "group cursor" +msgstr "groupe de curseur" + +#: resbin.c:909 +msgid "group icon header" +msgstr "en-tête du groupe d'icônes" + +#: resbin.c:913 +#, c-format +msgid "unexpected group icon type %d" +msgstr "type de groupe d'icône inattendu %d" + +#: resbin.c:928 +msgid "group icon" +msgstr "groupe d'icônes" + +#: resbin.c:999 resbin.c:1218 +msgid "unexpected version string" +msgstr "chaîne de version inattendue" + +#: resbin.c:1033 +#, c-format +msgid "version length %d does not match resource length %lu" +msgstr "longueur de la version %d ne concorde pas avec la longueur de la ressource %lu" + +#: resbin.c:1037 +#, c-format +msgid "unexpected version type %d" +msgstr "type de version inattendu %d" + +#: resbin.c:1049 +#, c-format +msgid "unexpected fixed version information length %d" +msgstr "longueur d'information fixe de version inattendue %d" + +#: resbin.c:1052 +msgid "fixed version info" +msgstr "information fixe de version" + +#: resbin.c:1056 +#, c-format +msgid "unexpected fixed version signature %lu" +msgstr "signature de version fixe inattendue %lu" + +#: resbin.c:1060 +#, c-format +msgid "unexpected fixed version info version %lu" +msgstr "information de version inattendue dans la version fixe %lu" + +#: resbin.c:1089 +msgid "version var info" +msgstr "information de variable de version" + +#: resbin.c:1106 +#, c-format +msgid "unexpected stringfileinfo value length %d" +msgstr "longueur de la valeur stringfileinfo inattendue %d" + +#: resbin.c:1116 +#, c-format +msgid "unexpected version stringtable value length %d" +msgstr "longueur inattendue de la valeur de la table de chaîne de version %d" + +#: resbin.c:1150 +#, c-format +msgid "unexpected version string length %d != %d + %d" +msgstr "longueur inattendue de la chaîne de version %d != %d +%d" + +#: resbin.c:1161 +#, c-format +msgid "unexpected version string length %d < %d" +msgstr "longueur inattendue de la chaîne de version %d < %d" + +#: resbin.c:1178 +#, c-format +msgid "unexpected varfileinfo value length %d" +msgstr "longueur inattendue de la chaîne varfileinfo %d" + +#: resbin.c:1197 +msgid "version varfileinfo" +msgstr "version varfileinfo" + +#: resbin.c:1212 +#, c-format +msgid "unexpected version value length %d" +msgstr "longueur inattendue de la chaîne de version %d" + +#: rescoff.c:128 +msgid "filename required for COFF input" +msgstr "nom de fichier requis pour l'entrée COFF" + +#: rescoff.c:145 +#, c-format +msgid "%s: no resource section" +msgstr "%s: aucune section ressource" + +#: rescoff.c:152 +msgid "can't read resource section" +msgstr "ne peutlire la section ressource" + +#: rescoff.c:178 +#, c-format +msgid "%s: %s: address out of bounds" +msgstr "%s: %s: adresse est hors limite" + +#: rescoff.c:197 +msgid "directory" +msgstr "répertoire" + +#: rescoff.c:225 +msgid "named directory entry" +msgstr "nom du répertoire d'entrée" + +#: rescoff.c:234 +msgid "directory entry name" +msgstr "nom de l'entrée du répertoire" + +#: rescoff.c:254 +msgid "named subdirectory" +msgstr "nom de sous-répertoire" + +#: rescoff.c:262 +msgid "named resource" +msgstr "nom de ressource" + +#: rescoff.c:277 +msgid "ID directory entry" +msgstr "IDentificateur d'entrée de répertoire" + +#: rescoff.c:294 +msgid "ID subdirectory" +msgstr "IDentificateur de sous-répertoire" + +#: rescoff.c:302 +msgid "ID resource" +msgstr "IDentificateur ressource" + +#: rescoff.c:328 +msgid "resource type unknown" +msgstr "type de ressource inconnue" + +#: rescoff.c:331 +msgid "data entry" +msgstr "aucune donnée" + +#: rescoff.c:339 +msgid "resource data" +msgstr "donnée ressource" + +#: rescoff.c:344 +msgid "resource data size" +msgstr "taille de données ressources" + +#: rescoff.c:439 +msgid "filename required for COFF output" +msgstr "nom de fichier requis pour la sortie de COFF" + +#: rescoff.c:738 +msgid "can't get BFD_RELOC_RVA relocation type" +msgstr "ne peut obtenir le type de la relocalisation BFD_RELOC_RVA" + +#: resrc.c:240 resrc.c:312 +#, c-format +msgid "can't open temporary file `%s': %s" +msgstr "ne peut ouvrir un fichier temporaire « %s »: %s" + +#: resrc.c:246 +#, c-format +msgid "can't redirect stdout: `%s': %s" +msgstr "ne peut rediriger sur stdout: « %s »: %s" + +#: resrc.c:262 +#, c-format +msgid "%s %s: %s" +msgstr "%s %s: %s" + +#: resrc.c:308 +#, c-format +msgid "can't execute `%s': %s" +msgstr "ne peut exécuter « %s »: %s" + +#: resrc.c:317 +#, c-format +msgid "Using temporary file `%s' to read preprocessor output\n" +msgstr "Utilisation d'un fichier temporaire « %s » pour lire la sortie du préprocesseur\n" + +#: resrc.c:324 +#, c-format +msgid "can't popen `%s': %s" +msgstr "ne peut ouvrir un pipe par popen() « %s »: %s" + +#: resrc.c:326 +msgid "Using popen to read preprocessor output\n" +msgstr "Utilisation de popen pour lire la sortie du préprocesseur\n" + +#: resrc.c:369 +#, c-format +msgid "Tried `%s'\n" +msgstr "Essayé « %s »\n" + +#: resrc.c:380 +#, c-format +msgid "Using `%s'\n" +msgstr "Utilisation de « %s »\n" + +#: resrc.c:542 +#, c-format +msgid "%s:%d: %s\n" +msgstr "%s:%d: %s\n" + +#: resrc.c:551 +#, c-format +msgid "%s: unexpected EOF" +msgstr "%s: fin de fichier EOF prématuré" + +#: resrc.c:608 +#, c-format +msgid "%s: read of %lu returned %lu" +msgstr "%s: lecture de %lu retourné %lu" + +#: resrc.c:650 resrc.c:905 resrc.c:1178 resrc.c:1332 +#, c-format +msgid "stat failed on bitmap file `%s': %s" +msgstr "échec d'évaluation par stat() du fichier bitmap « %s »: %s" + +#: resrc.c:703 +#, c-format +msgid "cursor file `%s' does not contain cursor data" +msgstr "fichier curseur « %s » ne contient aucune donnée de type curseur" + +#: resrc.c:735 resrc.c:1049 +#, c-format +msgid "%s: fseek to %lu failed: %s" +msgstr "%s: échec %lu de repérage: %s" + +#: resrc.c:873 +msgid "help ID requires DIALOGEX" +msgstr "identificateur d'aide requiert DIALOGEX" + +#: resrc.c:875 +msgid "control data requires DIALOGEX" +msgstr "donnée de contrôle requiert DIALOGEX" + +#: resrc.c:1018 +#, c-format +msgid "icon file `%s' does not contain icon data" +msgstr "fichier d'icônes « %s » ne contient pas de données de type icône" + +#: resrc.c:1537 +#, c-format +msgid "can't open `%s' for output: %s" +msgstr "ne peut ouvrir « %s » pour la sortie: %s" + +#: size.c:86 +msgid " Displays the sizes of sections inside binary files\n" +msgstr "Afficher les tailles des sections à l'intérieur des fichiers binaires\n" + +#: size.c:87 +msgid " If no input file(s) are specified, a.out is assumed\n" +msgstr "Aucune fichier spécifié à l'entrée a.out est assumé\n" + +#: size.c:88 +#, c-format +msgid "" +" The options are:\n" +" -A|-B --format={sysv|berkeley} Select output style (default is %s)\n" +" -o|-d|-x --radix={8|10|16} Display numbers in octal, decimal or hex\n" +" -t --totals Display the total sizes (Berkeley only)\n" +" --target= Set the binary file format\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +"Les options sont:\n" +" -A|-B --format={sysv|berkeley} sélection le style de sortie (par défaut %s)\n" +" -o|-d|-h --radix={8|10|16} afficher les nombres en octal, décimal ou hexadécimal\n" +" -t --totals afficher les tailles totales (Berkeley seulement)\n" +" --target= sélectionner le format de fichier binaire\n" +" -h --help afficher l'aide-mémoire\n" +" -V --version afficher le nom et la version du logiciel\n" +"\n" + +#: size.c:160 +#, c-format +msgid "invalid argument to --format: %s" +msgstr "argument invalide pour --format: %s" + +#: size.c:187 +#, c-format +msgid "Invalid radix: %s\n" +msgstr "Base numérique invalide: %s\n" + +#: srconv.c:1953 +msgid "Convert a COFF object file into a SYSROFF object file\n" +msgstr "Convertir un fichier objet COFF en un fichier objet SYSROFF\n" + +#: srconv.c:1954 +msgid "" +" The options are:\n" +" -q --quick (Obsolete - ignoerd)\n" +" -n --noprescan Do not perform a scan to convert commons into defs\n" +" -d --debug Display information about what is being done\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +"Les options sont:\n" +" -q --quick (obsolète - ignoré)\n" +" -n --noprescan ne pas faire de scrutation pour convertir les commun en defs\n" +" -d --debug afficher de l'information à propos de ce qui a été fait\n" +" -h --help afficher l'aide-mémoire\n" +" -V --version afficher le nom et la version du logiciel\n" + +#: srconv.c:2099 +#, c-format +msgid "unable to open output file %s" +msgstr "incapable d'ouvrir le fichier de sortie %s" + +#: stabs.c:346 stabs.c:1755 +msgid "numeric overflow" +msgstr "débordement numérique" + +#: stabs.c:357 +#, c-format +msgid "Bad stab: %s\n" +msgstr "Mauvaise inclusion (« stab »): %s\n" + +#: stabs.c:367 +#, c-format +msgid "Warning: %s: %s\n" +msgstr "AVERTISSEMENT: %s: %s\n" + +#: stabs.c:488 +msgid "N_LBRAC not within function\n" +msgstr "N_LBRAC n'est pas dans la fonction\n" + +#: stabs.c:527 +msgid "Too many N_RBRACs\n" +msgstr "Trop de N_RBRAC\n" + +#: stabs.c:773 +msgid "unknown C++ encoded name" +msgstr "nom encode C++ inconnu" + +#. Complain and keep going, so compilers can invent new +#. cross-reference types. +#: stabs.c:1293 +msgid "unrecognized cross reference type" +msgstr "type de référence croisée non reconnue" + +#. Does this actually ever happen? Is that why we are worrying +#. about dealing with it rather than just calling error_type? +#: stabs.c:1847 +msgid "missing index type" +msgstr "type d'index manquant" + +#: stabs.c:2174 +msgid "unknown virtual character for baseclass" +msgstr "caractère virtuel inconnu pour la classe de base" + +#: stabs.c:2192 +msgid "unknown visibility character for baseclass" +msgstr "caractère de visibilité inconnu pour la classe de base" + +#: stabs.c:2384 +msgid "unnamed $vb type" +msgstr "type $vb inconnu" + +#: stabs.c:2390 +msgid "unrecognized C++ abbreviation" +msgstr "abréviation C++ inconnue" + +#: stabs.c:2470 +msgid "unknown visibility character for field" +msgstr "caractère de visibilité inconnu pour le champ" + +#: stabs.c:2726 +msgid "const/volatile indicator missing" +msgstr "indicateur de const/volatile manquant" + +#: stabs.c:2967 +#, c-format +msgid "No mangling for \"%s\"\n" +msgstr "Pas de mutilation pour \"n%s\"\n" + +#: stabs.c:3281 +msgid "Undefined N_EXCL" +msgstr "N_EXCL indéfini" + +#: stabs.c:3369 +#, c-format +msgid "Type file number %d out of range\n" +msgstr "Nombre de type de fichier %d hors limite\n" + +#: stabs.c:3374 +#, c-format +msgid "Type index number %d out of range\n" +msgstr "Nombre de type index %d hors limite\n" + +#: stabs.c:3461 +#, c-format +msgid "Unrecognized XCOFF type %d\n" +msgstr "Type XCOFF non reconnu %d\n" + +#: stabs.c:3762 +#, c-format +msgid "bad mangled name `%s'\n" +msgstr "mauvais codage par mutilation du nom « %s »\n" + +#: stabs.c:3859 +msgid "no argument types in mangled string\n" +msgstr "aucun type d'argument dans la chaîne encodé par mutilation\n" + +#: strings.c:208 +#, c-format +msgid "invalid number %s" +msgstr "nombre invalide %s" + +#: strings.c:647 +#, c-format +msgid "invalid integer argument %s" +msgstr "argument en valeur entière invalide %s" + +#: strings.c:658 +msgid " Display printable strings in [file(s)] (stdin by default)\n" +msgstr "Afficher les chaîne imprimables des [fichier] (stdin par défaut)\n" + +#: strings.c:659 +msgid "" +" The options are:\n" +" -a - --all Scan the entire file, not just the data section\n" +" -f --print-file-name Print the name of the file before each string\n" +" -n --bytes=[number] Locate & print any NUL-terminated sequence of at\n" +" - least [number] characters (default 4).\n" +" -t --radix={o,x,d} Print the location of the string in base 8, 10 or 16\n" +" -o An alias for --radix=o\n" +" -T --target= Specify the binary file format\n" +" -e --encoding={s,S,b,l,B,L} Select character size and endianness:\n" +" s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +"Les options sont:\n" +" -a - --all scruter entièrement le fichier, pas seulement les sections de données\n" +" -f --print-file-name afficher le nom du fichier avant chaque chaîne\n" +" -n --bytes=[nombre] localiser et afficher toute séquence terminées par NULL d'au\n" +" - moins [nombre] de caractères (par défault 4).\n" +" -t --radix={o,x,d} afficher la localisation de la chaîne en base 8, 10 ou 16\n" +" -o un alias pour --radix=o\n" +" -T --target= spécifier le format du fichier binaire\n" +" -e --encoding={s,S,b,l,B,L} sélectionner la taille des caractères et le\n" +" système de poids fort ou faible:\n" +" s = 8-bits, {b,l} = 16-bits, {B,L} = 32-bits\n" +" -h --help afficher l'aide-mémoire\n" +" -v --version afficher le nom et la version du logiciel\n" + +#: sysdump.c:768 +msgid "Print a human readable interpretation of a SYSROFF object file\n" +msgstr "Afficher dans un format humainement lisible l'interprétation du fichier objet SYSROFF\n" + +#: sysdump.c:769 +msgid "" +" The options are:\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +"Les options sont:\n" +" -h --help afficher l'aide-mémoire\n" +" -v --version afficher le nom et la version du logiciel\n" + +#: sysdump.c:836 +#, c-format +msgid "cannot open input file %s" +msgstr "ne peut ouvrir le fichier d'entrée %s" + +#: version.c:36 +msgid "Copyright 2002 Free Software Foundation, Inc.\n" +msgstr "Copyright 2002 © Free Software Foundation, Inc.\n" + +#: version.c:37 +msgid "" +"This program is free software; you may redistribute it under the terms of\n" +"the GNU General Public License. This program has absolutely no warranty.\n" +msgstr "" +"Ce logiciel est libre; vous pouvez le redistribuer selon les termes de la\n" +"licence GNU General Public License. AUCUNE garantie n'est donnée.\n" + +#: windres.c:205 +#, c-format +msgid "can't open %s `%s': %s" +msgstr "ne peut ouvrir %s « %s »: %s" + +#: windres.c:384 +msgid ": expected to be a directory\n" +msgstr ": espérait un répertoire\n" + +#: windres.c:396 +msgid ": expected to be a leaf\n" +msgstr ": espérait une feuille\n" + +#: windres.c:405 +#, c-format +msgid "%s: warning: " +msgstr "%s: AVERTISSEMENT: " + +#: windres.c:407 +msgid ": duplicate value\n" +msgstr ": valeur dupliquée\n" + +#: windres.c:569 +#, c-format +msgid "unknown format type `%s'" +msgstr "type de format inconnu « %s »" + +#: windres.c:570 +#, c-format +msgid "%s: supported formats:" +msgstr "%s: formats supportés:" + +#. Otherwise, we give up. +#: windres.c:655 +#, c-format +msgid "can not determine type of file `%s'; use the -I option" +msgstr "ne peut déterminer le type de fichier « %s »; utiliser l'option -I" + +#: windres.c:669 +#, c-format +msgid "Usage: %s [option(s)] [input-file] [output-file]\n" +msgstr "Usage: %s [options] [fichier-d-entrée] [fichier-de-sortie]\n" + +#: windres.c:671 +msgid "" +" The options are:\n" +" -i --input= Name input file\n" +" -o --output= Name output file\n" +" -J --input-format= Specify input format\n" +" -O --output-format= Specify output format\n" +" -F --target= Specify COFF target\n" +" --preprocessor= Program to use to preprocess rc file\n" +" -I --include-dir= Include directory when preprocessing rc file\n" +" -D --define [=] Define SYM when preprocessing rc file\n" +" -U --undefine Undefine SYM when preprocessing rc file\n" +" -v --verbose Verbose - tells you what it's doing\n" +" -l --language= Set language when reading rc file\n" +" --use-temp-file Use a temporary file instead of popen to read\n" +" the preprocessor output\n" +" --no-use-temp-file Use popen (default)\n" +msgstr "" +"Les options sont:\n" +" -i --input= nommer le fichier d'entrée\n" +" -o --output= nommer le fichier de sortie\n" +" -J --input-format=\n" +" spécifier le format d'entrée\n" +" -O --output-format=\n" +" spécifier le format de sortie\n" +" -F --target= spécifier la CIBLE en COFF\n" +" --preprocessor= programme à utiliser pour pré-traiter le fichier rc\n" +" -I --include-dir= inclure le RÉPERTOIRE lors du pré-traitement du fichier rc\n" +" -D --define SYM[=VALEUR]\n" +" définir le SYMbole ayant la VALEUR lors du\n" +" du pré-traitement du fichier rc\n" +" -v --verbose utiliser le mode bavard\n" +" -l --language= initialiser le langage lors de la lecture du fichier rc\n" +" --use-temp-file utiliser un fichier temporaire au lieu de la lecture via\n" +" popen de la sortie du pré-processeur\n" +" --no-use-temp-file utiliser popen (par défaut)\n" + +#: windres.c:687 +msgid " --yydebug Turn on parser debugging\n" +msgstr " --yydebug activer le mode de débug de l'analyseur syntaxique\n" + +#: windres.c:690 +msgid "" +" -r Ignored for compatibility with rc\n" +" -h --help Print this help message\n" +" -V --version Print version information\n" +msgstr "" +"Les options sont:\n" +" -r ignoré pour la compatibilité avec rc\n" +" -h --help afficher l'aide-mémoire\n" +" -V --version afficher le nom et la version du logiciel\n" + +#: windres.c:694 +msgid "" +"FORMAT is one of rc, res, or coff, and is deduced from the file name\n" +"extension if not specified. A single file name is an input file.\n" +"No input-file is stdin, default rc. No output-file is stdout, default rc.\n" +msgstr "" +"FORMAT est soit rc, res, ou coff, et est dédui à partir l'extension\n" +"du nom de fichier, si non spécifié. Un nom simple de fichier comme fichier d'entrée\n" +"L'entrée par défaut se fait à partir de stdin, par défaut pour rc.\n" +"La sortie par défaut est stdout, par défaut pour rc.\n" + +#: windres.c:833 +msgid "invalid option -f\n" +msgstr "option invalide -f\n" + +#: windres.c:838 +msgid "No filename following the -fo option.\n" +msgstr "Pas de nom de fichier après l'option -fo.\n" + +#: windres.c:896 +msgid "Option -I is deprecated for setting the input format, please use -J instead.\n" +msgstr "L'option -I est dépréciée pour fixer le format d'entrée, svp utiliser -J à la place.\n" + +#: windres.c:1014 +msgid "no resources" +msgstr "aucune ressource" + +#: wrstabs.c:395 wrstabs.c:2055 +#, c-format +msgid "string_hash_lookup failed: %s" +msgstr "échec de string_hash_lookup: %s" + +#: wrstabs.c:695 +#, c-format +msgid "stab_int_type: bad size %u" +msgstr "stab_int_type: mauvaise taille %u" + +#: wrstabs.c:1495 +#, c-format +msgid "%s: warning: unknown size for field `%s' in struct" +msgstr "%s: AVERTISSEMENT: taille inconnue pour le champ « %s » dans le struct" + +#~ msgid "debug_record_variable: no current block" +#~ msgstr "debug_record_variable: aucun bloc courant" + +#~ msgid "%s: No dynamic symbols" +#~ msgstr "%s: aucun symboles dynamiques" + +#~ msgid "64-bit DWARF line info is not supported yet.\n" +#~ msgstr "ligne info DWARF 64 bits n'est pas encore supportée.\n" + +#~ msgid "64-bit DWARF pubnames are not supported yet.\n" +#~ msgstr "noms publics DWARF 64 bits ne sont pas encore supportés\n" + +#~ msgid "64-bit DWARF debug info is not supported yet.\n" +#~ msgstr "info de débug DWARF 64 bits n'est pas encore supportée.\n" + +#~ msgid "64-bit DWARF aranges are not supported yet.\n" +#~ msgstr "gamme aranges DWARF de 64 bits n'est pas encore supportée.\n" + +#~ msgid "64-bit DWARF format frames are not supported yet.\n" +#~ msgstr "gamme aranges DWARF de 64 bits n'est pas encore supportée.\n" + +#~ msgid "" +#~ " -h --help Print this help message\n" +#~ " -V --version Print version information\n" +#~ msgstr "" +#~ " -h --help afficher l'aide-mémoire\n" +#~ " -V --version afficher le nom et la version du logiciel\n" + +#~ msgid "" +#~ "Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n" +#~ " [-e executable] [--exe=executable] [--demangle[=style]]\n" +#~ " [--basenames] [--functions] [addr addr ...]\n" +#~ msgstr "" +#~ "Usage: %s [-CfsHV] [-b nombdf] [--target=nombdf]\n" +#~ " [-e executable] [--exe=executable] [--demangle[=style]]\n" +#~ " [--basenames] [--functions] [adr adr ...]\n" + +#~ msgid "" +#~ "Usage: %s [-dhV] [-I bfdname] [-O bfdname] [-T header-file] [-l linker]\n" +#~ " [--input-target=bfdname] [--output-target=bfdname]\n" +#~ " [--header-file=file] [--linker=linker] [--debug]\n" +#~ " [--help] [--version]\n" +#~ " [in-file [out-file]]\n" +#~ msgstr "" +#~ "Usage: %s [-dhV] [-I nombfd] [-O nombfd] [-T fichier_en_tete] [-l editeur_de_lien]\n" +#~ " [--input-target=nombfd] [--output-target=nombfd]\n" +#~ " [--header-file=fichier] [--linker=editeur_de_liens] [--debug]\n" +#~ " [--help] [--version]\n" +#~ " [fichier_d_entree [fichier_de_sortie]]\n" + +#~ msgid "Usage: %s [OPTION]... [FILE]...\n" +#~ msgstr "Usage: %s [OPTIONS]... [FICHIER]...\n" + +#~ msgid "Usage: %s OPTION... FILE...\n" +#~ msgstr "Usage: %s OPTION... FICHIER...\n" + +#~ msgid " Options are:\n" +#~ msgstr " Les options sont:\n" + +#~ msgid " -a or --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" +#~ msgstr " -a ou --all équivalent à: -h -l -S -s -r -d -V -A -I\n" + +#~ msgid " -h or --file-header Display the ELF file header\n" +#~ msgstr " -h ou --file-header afficher l'en-tête du fichier ELF\n" + +#~ msgid " -l or --program-headers or --segments\n" +#~ msgstr " -l ou --program-headers ou --segments\n" + +#~ msgid " Display the program headers\n" +#~ msgstr " afficher les en-têtes du programme\n" + +#~ msgid " -S or --section-headers or --sections\n" +#~ msgstr " -S ou --section-headers ou --sections\n" + +#~ msgid " Display the sections' header\n" +#~ msgstr " afficher l'en-tête des sections\n" + +#~ msgid " -e or --headers Equivalent to: -h -l -S\n" +#~ msgstr " -e ou --headers équivalent à: -h -l -S\n" + +#~ msgid " -s or --syms or --symbols Display the symbol table\n" +#~ msgstr " -s ou --syms ou --symbols afficher la table de symboles\n" + +#~ msgid " -n or --notes Display the core notes (if present)\n" +#~ msgstr " -n ou --notes afficher les notes du core (si disponible)\n" + +#~ msgid " -r or --relocs Display the relocations (if present)\n" +#~ msgstr " -r ou --relocs afficher les relocalisations (si disponibles)\n" + +#~ msgid " -u or --unwind Display the unwind info (if present)\n" +#~ msgstr " -u ou --unwind afficher les infos unwind (si disponibles)\n" + +#~ msgid " -d or --dynamic Display the dynamic segment (if present)\n" +#~ msgstr " -d ou --dynamic afficher le segement dynamique (si disponible)\n" + +#~ msgid " -V or --version-info Display the version sections (if present)\n" +#~ msgstr " -V ou --version-info afficher la version des sections (si disponible)\n" + +#~ msgid " -A or --arch-specific Display architecture specific information (if any).\n" +#~ msgstr " -A ou --arch-specific afficher les informations de spécificités d'architecture (si disponible).\n" + +#~ msgid " -D or --use-dynamic Use the dynamic section info when displaying symbols\n" +#~ msgstr " -D ou --use-dynamic utiliser les infos de la section dynamique lors de l'affichage des symboles\n" + +#~ msgid " -x or --hex-dump=\n" +#~ msgstr " -x ou --hex-dump=\n" + +#~ msgid " Dump the contents of section \n" +#~ msgstr " vidanger le contenu de la section \n" + +#~ msgid " -w[liaprmfs] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str]\n" +#~ msgstr " -w[liaprmfs] ou --debug-dump[=ligne,=info,=abbrev,=nompub,=plages,=macro,=trames,=str]\n" + +#~ msgid " Display the contents of DWARF2 debug sections\n" +#~ msgstr " afficher le contenu des sections DWARF2 de débug\n" + +#~ msgid " -i or --instruction-dump=\n" +#~ msgstr " -i ou --instruction-dump=\n" + +#~ msgid " -I or --histogram Display histogram of bucket list lengths\n" +#~ msgstr " -I ou --histogram afficher l'histogramme of bucket list lengths\n" + +#~ msgid " -v or --version Display the version number of readelf\n" +#~ msgstr " -v ou --version afficher le numéro de version de readelf\n" + +#~ msgid " -W or --wide Don't split lines or truncate symbols to fit into 80 columns\n" +#~ msgstr " -W ou --wide ne pas couper les lignes ou tronquer les symboles pour s'insérer dans 80 colonnes\n" + +#~ msgid " -H or --help Display this information\n" +#~ msgstr " -H ou --help afficher cette information\n" + +#~ msgid "unexpected dialog signature %d" +#~ msgstr "signature de dialogue inattendue %d" + +#~ msgid "" +#~ "Usage: %s [-A | --format=sysv | -B | --format=berkeley]\n" +#~ " [-o | --radix=8 | -d | --radix=10 | -h | --radix=16]\n" +#~ " [-V | --version] [--target=bfdname] [--help] [file...]\n" +#~ msgstr "" +#~ "Usage: %s [-A | --format=sysv | -B | --format=berkeley]\n" +#~ " [-o | --radix=8 | -d | --radix=10 | -h | --radix=16]\n" +#~ " [-V | --version] [--target=nombfd] [--help] [FICHIER...]\n" + +#~ msgid "default is --format=berkeley\n" +#~ msgstr "par défaut --format=berkeley\n" + +#~ msgid "default is --format=sysv\n" +#~ msgstr "par défaut --format=sysv\n" + +#~ msgid "Usage: %s [-dhVq] in-file [out-file]\n" +#~ msgstr "Usage: %s [-dhVq] fichier-entrée [fichier-sortie]\n" + +#~ msgid "" +#~ "Usage: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-e {s,b,l,B,L}]\n" +#~ " [-] [--all] [--print-file-name] [--bytes=min-len] [--radix={o,x,d}]\n" +#~ " [--target=bfdname] [--encoding {s,b,l,B,L}] [--help] [--version] file...\n" +#~ msgstr "" +#~ "Usage: %s [-afov] [-n longueur-min] [-min-len] [-t {o,x,d}] [-e {s,b,l,B,L}]\n" +#~ " [-] [--all] [--print-file-name] [--bytes=longueur-min] [--radix={o,x,d}]\n" +#~ " [--target=nom_bfd] [--encoding {s,b,l,B,L}] [--help] [--version] file...\n" + +#~ msgid "Usage: %s [-hV] in-file\n" +#~ msgstr "Usage: %s [-hV] fichier-entrée\n" + +#~ msgid "GNU %s version %s\n" +#~ msgstr "GNU %s version %s\n" + +#~ msgid "no export definition file provided" +#~ msgstr "aucun fichier de définition d'exports fourni" + +#~ msgid " The switches are:\n" +#~ msgstr " Les commutateurs sont:\n" + +#~ msgid "Unable to seek to start of %s at %x\n" +#~ msgstr "Incapable de repérer le début de %s à %x\n" + +#~ msgid "Unable to read data at %x for %s\n" +#~ msgstr "Incapable de lire les données à %x de %s\n" + +#~ msgid "ELF32" +#~ msgstr "ELF32" + +#~ msgid "ELF64" +#~ msgstr "ELF64" + +#~ msgid "UNIX - System V" +#~ msgstr "UNIX - System V" + +#~ msgid "UNIX - HP-UX" +#~ msgstr "UNIX - HP-UX" + +#~ msgid "UNIX - NetBSD" +#~ msgstr "UNIX - NetBSD" + +#~ msgid "UNIX - Linux" +#~ msgstr "UNIX - Linux" + +#~ msgid "GNU/Hurd" +#~ msgstr "GNU/Hurd" + +#~ msgid "UNIX - Solaris" +#~ msgstr "UNIX - Solaris" + +#~ msgid "UNIX - AIX" +#~ msgstr "UNIX - AIX" + +#~ msgid "UNIX - IRIX" +#~ msgstr "UNIX - IRIX" + +#~ msgid "UNIX - FreeBSD" +#~ msgstr "UNIX - FreeBSD" + +#~ msgid "UNIX - TRU64" +#~ msgstr "UNIX - TRU64" + +#~ msgid "Novell - Modesto" +#~ msgstr "Novell - Modesto" + +#~ msgid "UNIX - OpenBSD" +#~ msgstr "UNIX - OpenBSD" + +#~ msgid "ARM" +#~ msgstr "ARM" + +#~ msgid "Key to Flags:\n" +#~ msgstr "Clé des fanions:\n" + +#~ msgid " W (write), A (alloc), X (execute), M (merge), S (strings)\n" +#~ msgstr " W (écrit), A (alloc), X (exécution), M (fusion), S (chaînes)\n" + +#~ msgid " I (info), L (link order), G (group), x (unknown)\n" +#~ msgstr " I (info), L (ordre de liens), G (groupe), x (inconnu)\n" + +#~ msgid " O (extra OS processing required) o (OS specific), p (processor specific)\n" +#~ msgstr " O (traitement additionnel sys. exploit. requis) o (spécificités sys. esploit.), p (spécificités de processeur)\n" + +#~ msgid "Unable to handle FORM: %d" +#~ msgstr "Incapable de traiter la FORME: %d" + +#~ msgid "64 bit data type and so it cannot read 64 bit ELF files.\n" +#~ msgstr "type de données de 64 bits et ne peut lire un fichier ELF de 64 bits.\n" diff --git a/binutils/po/ja.gmo b/binutils/po/ja.gmo new file mode 100644 index 0000000000000..5152d33babf88 Binary files /dev/null and b/binutils/po/ja.gmo differ diff --git a/binutils/po/ja.po b/binutils/po/ja.po new file mode 100644 index 0000000000000..a140b41e1ece6 --- /dev/null +++ b/binutils/po/ja.po @@ -0,0 +1,4110 @@ +# Japanese message for binutils 2.11 +# Copyright (C) 2001 Free Software Foundation, Inc. +# Daisuke Yamashita , 2001. +# +msgid "" +msgstr "" +"Project-Id-Version: binutils 2.11\n" +"POT-Creation-Date: 2001-01-11 12:02-0800\n" +"PO-Revision-Date: 2001-12-16 16:10+0900\n" +"Last-Translator: Daisuke Yamashita \n" +"Language-Team: Japanese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=EUC-JP\n" +"Content-Transfer-Encoding: 8bit\n" + +#: addr2line.c:76 +#, c-format +msgid "" +"Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n" +" [-e executable] [--exe=executable] [--demangle[=style]]\n" +" [--basenames] [--functions] [addr addr ...]\n" +msgstr "" +"»È¤¤Êý: %s [-CfsHV] [-b bfd̾] [--target=bfd̾]\n" +" [-e ¼Â¹Ô¥Õ¥¡¥¤¥ë] [--exe=¼Â¹Ô¥Õ¥¡¥¤¥ë] [--demangle[=Êý¼°]]\n" +" [--basenames] [--functions] [¥¢¥É¥ì¥¹ ¥¢¥É¥ì¥¹ ...]\n" + +#: addr2line.c:83 ar.c:288 nlmconv.c:1119 objcopy.c:373 objcopy.c:405 +#: readelf.c:1876 size.c:91 strings.c:530 windres.c:737 +#, c-format +msgid "Report bugs to %s\n" +msgstr "¥Ð¥°¥ì¥Ý¡¼¥È¤Ï %s ¤Þ¤Ç\n" + +#: addr2line.c:243 +#, c-format +msgid "%s: can not get addresses from archive" +msgstr "%s: ¥¢¡¼¥«¥¤¥Ö¤«¤é¥¢¥É¥ì¥¹¤ò¼èÆÀ¤Ç¤­¤Þ¤»¤ó" + +#: addr2line.c:310 nm.c:436 objdump.c:2857 +#, c-format +msgid "unknown demangling style `%s'" +msgstr "̾Á°Éü¸µ (demangle) ¤ÎÊý¼° `%s' ¤¬ÉÔÌÀ¤Ç¤¹" + +#: ar.c:236 +#, c-format +msgid "no entry %s in archive\n" +msgstr "¹àÌÜ %s ¤¬¥¢¡¼¥«¥¤¥ÖÃæ¤Ë¤¢¤ê¤Þ¤»¤ó\n" + +#: ar.c:253 +#, c-format +msgid "Usage: %s [-X32_64] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n" +msgstr "»È¤¤Êý: %s [-X32_64] [-]{dmpqrstx}[abcfilNoPsSuvV] [¥á¥ó¥Ð̾] [¥«¥¦¥ó¥È] ½ñ¸Ë¥Õ¥¡¥¤¥ë ¥Õ¥¡¥¤¥ë...\n" + +#: ar.c:256 +#, c-format +msgid " %s -M [\n\n" +msgstr "\n<¥á¥ó¥Ð %s>\n\n" + +#: ar.c:845 ar.c:913 +#, c-format +msgid "%s is not a valid archive" +msgstr "%s ¤ÏÀµ¾ï¤Ê½ñ¸Ë¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó" + +#: ar.c:881 +#, c-format +msgid "stat returns negative size for %s" +msgstr "stat(2) ¤¬ %s ¤Î¥µ¥¤¥º¤È¤·¤ÆÉé¤Î¿ô¤òÊÖ¤·¤Þ¤·¤¿" + +#: ar.c:1008 +#, c-format +msgid "%s is not an archive" +msgstr "%s ¤Ï½ñ¸Ë¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó" + +#: ar.c:1015 +#, c-format +msgid "creating %s" +msgstr "%s ¤òºîÀ®¤·¤Þ¤¹" + +#: ar.c:1221 +#, c-format +msgid "No member named `%s'\n" +msgstr "`%s' ¤È¤¤¤¦Ì¾Á°¤Î¥á¥ó¥Ð¤Ï¤¢¤ê¤Þ¤»¤ó\n" + +#: ar.c:1273 +#, c-format +msgid "no entry %s in archive %s!" +msgstr "¥¨¥ó¥È¥ê %s ¤Ï½ñ¸Ë %s ¤Ë¤¢¤ê¤Þ¤»¤ó!" + +#: ar.c:1434 +#, c-format +msgid "%s: no archive map to update" +msgstr "%s: ¹¹¿·¤¹¤Ù¤­½ñ¸Ë¥Þ¥Ã¥×¤¬¤¢¤ê¤Þ¤»¤ó" + +#: arsup.c:88 +#, c-format +msgid "No entry %s in archive.\n" +msgstr "¥¨¥ó¥È¥ê %s ¤Ï½ñ¸ËÆâ¤Ë¤¢¤ê¤Þ¤»¤ó¡£\n" + +#: arsup.c:120 +#, c-format +msgid "Can't open file %s\n" +msgstr "¥Õ¥¡¥¤¥ë %s¤ò³«¤±¤Þ¤»¤ó\n" + +#: arsup.c:170 +#, c-format +msgid "%s: Can't open output archive %s\n" +msgstr "%s: ½ÐÎϽñ¸Ë %s ¤ò³«¤±¤Þ¤»¤ó\n" + +#: arsup.c:182 +#, c-format +msgid "%s: Can't open input archive %s\n" +msgstr "%s: ÆþÎϽñ¸Ë %s ¤ò³«¤±¤Þ¤»¤ó\n" + +#: arsup.c:188 +#, c-format +msgid "%s: file %s is not an archive\n" +msgstr "%s: ¥Õ¥¡¥¤¥ë %s ¤Ï½ñ¸Ë¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó\n" + +#: arsup.c:229 +#, c-format +msgid "%s: no output archive specified yet\n" +msgstr "%s: ½ÐÎϽñ¸Ë¤¬¤Þ¤À»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó\n" + +#: arsup.c:249 arsup.c:284 arsup.c:320 arsup.c:340 arsup.c:398 +#, c-format +msgid "%s: no open output archive\n" +msgstr "%s: ½ÐÎÏÍѽñ¸Ë¤¬³«¤«¤ì¤Æ¤¤¤Þ¤»¤ó\n" + +#: arsup.c:257 arsup.c:358 arsup.c:378 +#, c-format +msgid "%s: can't open file %s\n" +msgstr "%s: ¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó\n" + +#: arsup.c:305 arsup.c:374 arsup.c:453 +#, c-format +msgid "%s: can't find module file %s\n" +msgstr "%s: ¥â¥¸¥å¡¼¥ë¥Õ¥¡¥¤¥ë %s ¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó\n" + +#: arsup.c:405 +#, c-format +msgid "Current open archive is %s\n" +msgstr "¸½ºß³«¤«¤ì¤¿½ñ¸Ë¤Ï %s ¤Ç¤¹\n" + +#: arsup.c:432 +#, c-format +msgid "%s: no open archive\n" +msgstr "%s: ³«¤¤¤Æ¤¤¤ë½ñ¸Ë¤¬¤¢¤ê¤Þ¤»¤ó\n" + +#: bucomm.c:135 +#, c-format +msgid "can't set BFD default target to `%s': %s" +msgstr "BFD ¥Ç¥Õ¥©¥ë¥È¥¿¡¼¥²¥Ã¥È¤ò `%s' ¤ËÀßÄê¤Ç¤­¤Þ¤»¤ó: %s" + +#: bucomm.c:147 +#, c-format +msgid "%s: Matching formats:" +msgstr "%s: ·Á¼°¤ò¾È¹ç¤·¤Þ¤¹:" + +#: bucomm.c:164 +msgid "Supported targets:" +msgstr "¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¥¿¡¼¥²¥Ã¥È:" + +#: bucomm.c:166 +#, c-format +msgid "%s: supported targets:" +msgstr "%s: ¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¥¿¡¼¥²¥Ã¥È:" + +#: bucomm.c:272 +#, c-format +msgid "%s: bad number: %s" +msgstr "%s: ÉÔÀµ¤ÊÈÖ¹æ: %s" + +#: coffdump.c:94 +#, c-format +msgid "#lines %d " +msgstr "#¹Ô %d " + +#: coffdump.c:456 sysdump.c:719 +#, c-format +msgid "%s: Print a human readable interpretation of a SYSROFF object file\n" +msgstr "%s: SYSROFF ¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤Î²ò¼á¤ò¿Í´Ö¤¬ÆÉ¤ß¤ä¤¹¤¤·Á¼°¤Çɽ¼¨¤¹¤ë\n" + +#: coffdump.c:498 srconv.c:1941 sysdump.c:755 +#, c-format +msgid "GNU %s version %s\n" +msgstr "GNU %s ¥Ð¡¼¥¸¥ç¥ó %s\n" + +#: coffdump.c:516 srconv.c:1975 sysdump.c:775 +msgid "no input file specified" +msgstr "ÆþÎÏ¥Õ¥¡¥¤¥ë¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: debug.c:653 +msgid "debug_add_to_current_namespace: no current file" +msgstr "debug_add_to_current_namespace: ¸½ºß¤Î¥Õ¥¡¥¤¥ë¤¬¤¢¤ê¤Þ¤»¤ó" + +#: debug.c:736 +msgid "debug_start_source: no debug_set_filename call" +msgstr "debug_start_source: debug_set_filename ¸Æ¤Ó½Ð¤·¤¬¤¢¤ê¤Þ¤»¤ó" + +#: debug.c:795 +msgid "debug_record_function: no debug_set_filename call" +msgstr "debug_record_function: debug_set_filename ¸Æ¤Ó½Ð¤·¤¬¤¢¤ê¤Þ¤»¤ó" + +#: debug.c:851 +msgid "debug_record_parameter: no current function" +msgstr "debug_record_parameter: ¸½ºß¤Î´Ø¿ô¤¬¤¢¤ê¤Þ¤»¤ó" + +#: debug.c:885 +msgid "debug_end_function: no current function" +msgstr "debug_end_function: ¸½ºß¤Î´Ø¿ô¤¬¤¢¤ê¤Þ¤»¤ó" + +#: debug.c:891 +msgid "debug_end_function: some blocks were not closed" +msgstr "debug_end_function: ÊĤ¸¤é¤ì¤Æ¤¤¤Ê¤¤¥Ö¥í¥Ã¥¯¤¬¤¢¤ê¤Þ¤¹" + +#: debug.c:921 +msgid "debug_start_block: no current block" +msgstr "debug_start_block: ¸½ºß¤Î¥Ö¥í¥Ã¥¯¤¬¤¢¤ê¤Þ¤»¤ó" + +#: debug.c:959 +msgid "debug_end_block: no current block" +msgstr "debug_end_block: ¸½ºß¤Î¥Ö¥í¥Ã¥¯¤¬¤¢¤ê¤Þ¤»¤ó" + +#: debug.c:966 +msgid "debug_end_block: attempt to close top level block" +msgstr "debug_end_block: ¥È¥Ã¥×¥ì¥Ù¥ë¥Ö¥í¥Ã¥¯¤òÊĤ¸¤è¤¦¤È¤·¤Þ¤·¤¿" + +#: debug.c:992 +msgid "debug_record_line: no current unit" +msgstr "debug_record_line: ¸½ºß¤Î¥æ¥Ë¥Ã¥È¤¬¤¢¤ê¤Þ¤»¤ó" + +#. FIXME +#: debug.c:1046 +msgid "debug_start_common_block: not implemented" +msgstr "debug_start_common_block: ¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#. FIXME +#: debug.c:1058 +msgid "debug_end_common_block: not implemented" +msgstr "debug_end_common_block: ¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#. FIXME. +#: debug.c:1152 +msgid "debug_record_label not implemented" +msgstr "debug_record_label ¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: debug.c:1178 +msgid "debug_record_variable: no current file" +msgstr "debug_record_variable: ¸½ºß¤Î¥Õ¥¡¥¤¥ë¤¬¤¢¤ê¤Þ¤»¤ó" + +#: debug.c:1194 +msgid "debug_record_variable: no current block" +msgstr "debug_record_variable: ¸½ºß¤Î¥Õ¥¡¥¤¥ë¤¬¤¢¤ê¤Þ¤»¤ó" + +#: debug.c:1764 +msgid "debug_make_undefined_type: unsupported kind" +msgstr "debug_make_undefined_type: ¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¼ïÎà¤Ç¤¹" + +#: debug.c:1970 +msgid "debug_name_type: no current file" +msgstr "debug_name_type: ¸½ºß¤Î¥Õ¥¡¥¤¥ë¤¬¤¢¤ê¤Þ¤»¤ó" + +#: debug.c:2018 +msgid "debug_tag_type: no current file" +msgstr "debug_tag_type: ¸½ºß¤Î¥Õ¥¡¥¤¥ë¤¬¤¢¤ê¤Þ¤»¤ó" + +#: debug.c:2026 +msgid "debug_tag_type: extra tag attempted" +msgstr "debug_tag_type: ;ʬ¤Ê¥¿¥°¤¬»î¤µ¤ì¤Þ¤·¤¿" + +#: debug.c:2066 +#, c-format +msgid "Warning: changing type size from %d to %d\n" +msgstr "·Ù¹ð: ·¿¤Î¥µ¥¤¥º¤ò %d ¤«¤é %d ¤ËÊѹ¹¤·¤Þ¤¹\n" + +#: debug.c:2090 +msgid "debug_find_named_type: no current compilation unit" +msgstr "debug_find_named_type: ¸½ºß¤Î¥³¥ó¥Ñ¥¤¥ëñ°Ì¤¬¤¢¤ê¤Þ¤»¤ó" + +#: debug.c:2197 +#, c-format +msgid "debug_get_real_type: circular debug information for %s\n" +msgstr "debug_get_real_type: %s ¤Î¥Ç¥Ð¥Ã¥°¾ðÊ󤬽۴Ĥ·¤Æ¤¤¤Þ¤¹\n" + +#: debug.c:2662 +msgid "debug_write_type: illegal type encountered" +msgstr "debug_write_type: ÉÔÀµ¤Ê·¿¤ËÁø¶ø¤·¤Þ¤·¤¿" + +#: dlltool.c:737 dlltool.c:762 dlltool.c:788 +#, c-format +msgid "Internal error: Unknown machine type: %d" +msgstr "ÆâÉô¥¨¥é¡¼: ÉÔÌÀ¤Ê¥Þ¥·¥ó·¿¤Ç¤¹: %d" + +#: dlltool.c:825 +#, c-format +msgid "Can't open def file: %s" +msgstr "ÄêµÁ¥Õ¥¡¥¤¥ë¤ò³«¤±¤Þ¤»¤ó: %s" + +#: dlltool.c:830 +#, c-format +msgid "Processing def file: %s" +msgstr "ÄêµÁ¥Õ¥¡¥¤¥ë¤ò½èÍý¤·¤Þ¤¹: %s" + +#: dlltool.c:834 +msgid "Processed def file" +msgstr "ÄêµÁ¥Õ¥¡¥¤¥ë¤ò½èÍý¤·¤Þ¤·¤¿" + +#: dlltool.c:859 +#, c-format +msgid "Syntax error in def file %s:%d" +msgstr "ÄêµÁ¥Õ¥¡¥¤¥ë¤Çʸˡ¥¨¥é¡¼¤Ç¤¹ %s:%d" + +#: dlltool.c:892 +#, c-format +msgid "NAME: %s base: %x" +msgstr "NAME: %s ¥Ù¡¼¥¹: %x" + +#: dlltool.c:895 dlltool.c:914 +msgid "Can't have LIBRARY and NAME" +msgstr "LIBRARY ¤ä NAME ¤ò»ý¤Æ¤Þ¤»¤ó" + +#: dlltool.c:911 +#, c-format +msgid "LIBRARY: %s base: %x" +msgstr "LIBRARY: %s ¥Ù¡¼¥¹: %x" + +#: dlltool.c:1169 resrc.c:271 +#, c-format +msgid "wait: %s" +msgstr "wait: %s" + +#: dlltool.c:1174 dllwrap.c:456 resrc.c:276 +#, c-format +msgid "subprocess got fatal signal %d" +msgstr "»Ò¥×¥í¥»¥¹¤¬Ã×̿Ū¤Ê¥·¥°¥Ê¥ë¤ò %d ¼õ¤±¼è¤ê¤Þ¤·¤¿" + +#: dlltool.c:1180 dllwrap.c:463 resrc.c:283 +#, c-format +msgid "%s exited with status %d" +msgstr "%s ¤Ï¥¹¥Æ¡¼¥¿¥¹ %d ¤Ç½ªÎ»¤·¤Þ¤·¤¿" + +#: dlltool.c:1212 +#, c-format +msgid "Sucking in info from %s section in %s" +msgstr "%s ¥»¥¯¥·¥ç¥ó(%s Æâ) ¤«¤é¾ðÊó¤ò¼è¤ê¹þ¤ß¤Þ¤¹" + +#: dlltool.c:1336 +#, c-format +msgid "Excluding symbol: %s" +msgstr "¥·¥ó¥Ü¥ë¤ò½ü³°¤·¤Þ¤¹: %s" + +#: dlltool.c:1431 dlltool.c:1442 nm.c:946 nm.c:957 objdump.c:443 objdump.c:460 +#, c-format +msgid "%s: no symbols" +msgstr "%s: ¥·¥ó¥Ü¥ë¤¬¤¢¤ê¤Þ¤»¤ó" + +#. FIXME: we ought to read in and block out the base relocations +#: dlltool.c:1469 +#, c-format +msgid "Done reading %s" +msgstr "%s ¤ÎÆÉ¼è¤ê¤¬´°Î»¤·¤Þ¤·¤¿" + +#: dlltool.c:1480 +#, c-format +msgid "Unable to open object file: %s" +msgstr "¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤ò³«¤±¤Þ¤»¤ó: %s" + +#: dlltool.c:1483 +#, c-format +msgid "Scanning object file %s" +msgstr "¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë %s ¤òÁöºº¤·¤Þ¤¹" + +#: dlltool.c:1498 +#, c-format +msgid "Cannot produce mcore-elf dll from archive file: %s" +msgstr "½ñ¸Ë¥Õ¥¡¥¤¥ë¤«¤é mcore-elf dll ¤òÀ¸À®¤Ç¤­¤Þ¤»¤ó: %s" + +#: dlltool.c:1590 +msgid "Adding exports to output file" +msgstr "½ÐÎÏ¥Õ¥¡¥¤¥ë¤Ë exports ¤òÄɲä·¤Þ¤¹" + +#: dlltool.c:1635 +msgid "Added exports to output file" +msgstr "½ÐÎÏ¥Õ¥¡¥¤¥ë¤Ë exports ¤òÄɲä·¤Þ¤·¤¿" + +#: dlltool.c:1759 +#, c-format +msgid "Generating export file: %s" +msgstr "export ¥Õ¥¡¥¤¥ë¤òÀ¸À®¤·¤Þ¤¹: %s" + +#: dlltool.c:1764 +#, c-format +msgid "Unable to open temporary assembler file: %s" +msgstr "°ì»þ¥¢¥»¥ó¥Ö¥ê¥Õ¥¡¥¤¥ë¤ò³«¤±¤Þ¤»¤ó: %s" + +#: dlltool.c:1767 +#, c-format +msgid "Opened temporary file: %s" +msgstr "°ì»þ¥Õ¥¡¥¤¥ë¤ò³«¤­¤Þ¤·¤¿: %s" + +#: dlltool.c:1981 +msgid "Generated exports file" +msgstr "exports ¥Õ¥¡¥¤¥ë¤¬À¸À®¤µ¤ì¤Þ¤·¤¿" + +#: dlltool.c:2236 +#, c-format +msgid "bfd_open failed open stub file: %s" +msgstr "bfd_open ¤¬¥¹¥¿¥Ö¥Õ¥¡¥¤¥ë¤ò³«¤±¤Þ¤»¤ó¤Ç¤·¤¿: %s" + +#: dlltool.c:2239 +#, c-format +msgid "Creating stub file: %s" +msgstr "¥¹¥¿¥Ö¥Õ¥¡¥¤¥ë¤òºîÀ®¤·¤Þ¤¹: %s" + +#: dlltool.c:2626 +#, c-format +msgid "failed to open temporary head file: %s" +msgstr "°ì»þ head ¥Õ¥¡¥¤¥ë¤ò³«¤±¤Þ¤»¤ó: %s" + +#: dlltool.c:2685 +#, c-format +msgid "failed to open temporary tail file: %s" +msgstr "°ì»þ tail ¥Õ¥¡¥¤¥ë¤ò³«¤±¤Þ¤»¤ó: %s" + +#: dlltool.c:2753 +#, c-format +msgid "Can't open .lib file: %s" +msgstr ".lib ¥Õ¥¡¥¤¥ë¤ò³«¤±¤Þ¤»¤ó: %s" + +#: dlltool.c:2756 +#, c-format +msgid "Creating library file: %s" +msgstr "¥é¥¤¥Ö¥é¥ê¥Õ¥¡¥¤¥ë¤òºîÀ®¤·¤Þ¤¹: %s" + +#: dlltool.c:2815 +#, c-format +msgid "cannot delete %s: %s" +msgstr "%s ¤òºï½ü¤Ç¤­¤Þ¤»¤ó: %s" + +#: dlltool.c:2819 +msgid "Created lib file" +msgstr "lib ¥Õ¥¡¥¤¥ë¤òºîÀ®¤·¤Þ¤·¤¿" + +#: dlltool.c:2924 +#, c-format +msgid "Warning, ignoring duplicate EXPORT %s %d,%d" +msgstr "·Ù¹ð¡¢½ÅÊ£¤·¤¿ EXPORT %s %d,%d ¤ò̵»ë¤·¤Þ¤¹" + +#: dlltool.c:2930 +#, c-format +msgid "Error, duplicate EXPORT with oridinals: %s" +msgstr "¥¨¥é¡¼¡¢½ø¿ôÉÕ¤­ EXPORT ¤¬½ÅÊ£¤·¤Þ¤·¤¿: %s" + +#: dlltool.c:3057 +msgid "Processing definitions" +msgstr "ÄêµÁ¤ò½èÍý¤·¤Þ¤¹" + +#: dlltool.c:3095 +msgid "Processed definitions" +msgstr "ÄêµÁ¤ò½èÍý¤·¤Þ¤·¤¿" + +#. xgetext:c-format +#: dlltool.c:3106 dllwrap.c:520 +#, c-format +msgid "Usage %s \n" +msgstr "»È¤¤Êý %s <¥ª¥×¥·¥ç¥ó> <¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë>...\n" + +#. xgetext:c-format +#: dlltool.c:3108 +#, c-format +msgid " -m --machine Create as DLL for . [default: %s]\n" +msgstr " -m --machine <¥Þ¥·¥ó> <¥Þ¥·¥ó> ÍÑ DLL ¤òºîÀ®¤¹¤ë¡£ [default: %s]\n" + +#: dlltool.c:3109 +msgid " possible : arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" +msgstr " ²Äǽ¤Ê <¥Þ¥·¥ó>: arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" + +#: dlltool.c:3110 +msgid " -e --output-exp Generate an export file.\n" +msgstr " -e --output-exp <½ÐÎÏ̾> export ¥Õ¥¡¥¤¥ë¤òÀ¸À®¤¹¤ë¡£\n" + +#: dlltool.c:3111 +msgid " -l --output-lib Generate an interface library.\n" +msgstr " -l --output-lib <½ÐÎÏ̾> interface ¥é¥¤¥Ö¥é¥ê¤òÀ¸À®¤¹¤ë¡£\n" + +#: dlltool.c:3112 +msgid " -a --add-indirect Add dll indirects to export file.\n" +msgstr " -a --add-indirect export ¥Õ¥¡¥¤¥ë¤Ë´ÖÀÜ dll ¤òÄɲ乤롣\n" + +#: dlltool.c:3113 +msgid " -D --dllname Name of input dll to put into interface lib.\n" +msgstr " -D --dllname <̾Á°> interface ¥é¥¤¥Ö¥é¥ê¤ËÃÖ¤¯ÆþÎÏ dll ¤Î̾Á°¡£\n" + +#: dlltool.c:3114 +msgid " -d --input-def Name of .def file to be read in.\n" +msgstr " -d --input-def ÆÉ¹þ¤Þ¤ì¤ë .def ¥Õ¥¡¥¤¥ë¤Î̾Á°¡£\n" + +#: dlltool.c:3115 +msgid " -z --output-def Name of .def file to be created.\n" +msgstr " -z --output-def ºîÀ®¤µ¤ì¤ë .def ¥Õ¥¡¥¤¥ë¤Î̾Á°¡£\n" + +#: dlltool.c:3116 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols .def ¤ËÁ´¤Æ¤Î¥·¥ó¥Ü¥ë¤ò export ¤¹¤ë\n" + +#: dlltool.c:3117 +msgid " --no-export-all-symbols Only export listed symbols\n" +msgstr " --no-export-all-symbols ¥ê¥¹¥È¤µ¤ì¤¿¥·¥ó¥Ü¥ë¤À¤±¤ò export ¤¹¤ë\n" + +#: dlltool.c:3118 +msgid " --exclude-symbols Don't export \n" +msgstr " --exclude-symbols <¥ê¥¹¥È> <¥ê¥¹¥È> ¤ò export ¤·¤Ê¤¤\n" + +#: dlltool.c:3119 +msgid " --no-default-excludes Clear default exclude symbols\n" +msgstr " --no-default-excludes ¥Ç¥Õ¥©¥ë¥È¤Ç½ü³°¤µ¤ì¤ë¥·¥ó¥Ü¥ë¤ò¥¯¥ê¥¢¤¹¤ë\n" + +#: dlltool.c:3120 +msgid " -b --base-file Read linker generated base file.\n" +msgstr " -b --base-file ¥ê¥ó¥«¤¬À¸À®¤·¤¿¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë¤òÆÉ¤ß¼è¤ë\n" + +#: dlltool.c:3121 +msgid " -x --no-idata4 Don't generate idata$4 section.\n" +msgstr " -x --no-idata4 idata$4 ¥»¥¯¥·¥ç¥ó¤òÀ¸À®¤·¤Ê¤¤¡£\n" + +#: dlltool.c:3122 +msgid " -c --no-idata5 Don't generate idata$5 section.\n" +msgstr " -c --no-idata5 idata$5 ¥»¥¯¥·¥ç¥ó¤òÀ¸À®¤·¤Ê¤¤¡£\n" + +#: dlltool.c:3123 +msgid " -U --add-underscore Add underscores to symbols in interface library.\n" +msgstr " -U --add-underscore interface Æâ¤Î¥·¥ó¥Ü¥ë¤Ë²¼Àþ¤ò¤Ä¤±¤ë\n" + +#: dlltool.c:3124 +msgid " -k --kill-at Kill @ from exported names.\n" +msgstr " -k --kill-at export ¤µ¤ì¤¿Ì¾Á°¤«¤é @ ¤òºï¤ë¡£\n" + +#: dlltool.c:3125 +msgid " -A --add-stdcall-alias Add aliases without @.\n" +msgstr " -A --add-stdcall-alias @ ̵¤·¤Î¥¨¥¤¥ê¥¢¥¹¤òÄɲ乤롣\n" + +#: dlltool.c:3126 +msgid " -S --as Use for assembler.\n" +msgstr " -S --as <̾Á°> ¥¢¥»¥ó¥Ö¥éÍѤΠ<̾Á°> ¤ò»È¤¦¡£\n" + +#: dlltool.c:3127 +msgid " -f --as-flags Pass to the assembler.\n" +msgstr " -f --as-flags <¥Õ¥é¥°> ¥¢¥»¥ó¥Ö¥é¤Ë <¥Õ¥é¥°> ¤òÅϤ¹¡£\n" + +#: dlltool.c:3128 +msgid " -C --compat-implib Create backward compatible import library.\n" +msgstr " -C --compat-implib ¸åÊý¸ß´¹ import ¥é¥¤¥Ö¥é¥ê¤òºîÀ®¤¹¤ë¡£\n" + +#: dlltool.c:3129 +msgid " -n --no-delete Keep temp files (repeat for extra preservation).\n" +msgstr " -n --no-delete °ì»þ¥Õ¥¡¥¤¥ë¤ò¾Ãµî¤·¤Ê¤¤ (;ʬ¤Ê¤â¤Î¤âÊݸ¤¹¤ë¤Ê¤é·«¤êÊÖ¤¹¤³¤È)¡£\n" + +#: dlltool.c:3130 +msgid " -v --verbose Be verbose.\n" +msgstr " -v --verbose ñÁÀå¥â¡¼¥É¡£\n" + +#: dlltool.c:3131 +msgid " -V --version Display the program version.\n" +msgstr " -V --version ¥×¥í¥°¥é¥à¥Ð¡¼¥¸¥ç¥ó¤òɽ¼¨¤¹¤ë¡£\n" + +#: dlltool.c:3132 +msgid " -h --help Display this information.\n" +msgstr " -h --help ¤³¤Î¾ðÊó¤òɽ¼¨¤¹¤ë¡£\n" + +#: dlltool.c:3134 +msgid " -M --mcore-elf Process mcore-elf object files into .\n" +msgstr " -M --mcore-elf <½ÐÎÏ̾> <½ÐÎÏ̾> ¤Ø mcore-elf ¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤ò½èÍý¤¹¤ë\n" + +#: dlltool.c:3135 +msgid " -L --linker Use as the linker.\n" +msgstr " -L --linker <̾Á°> <̾Á°> ¤ò¥ê¥ó¥«¤È¤·¤Æ»ÈÍѤ¹¤ë¡£\n" + +#: dlltool.c:3136 +msgid " -F --linker-flags Pass to the linker.\n" +msgstr " -F --linker-flags <¥Õ¥é¥°> <¥Õ¥é¥°> ¤ò¥ê¥ó¥«¤ËÅϤ¹¡£\n" + +#: dlltool.c:3280 +#, c-format +msgid "Unable to open base-file: %s" +msgstr "¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë¤ò³«¤±¤Þ¤»¤ó: %s" + +#: dlltool.c:3309 +#, c-format +msgid "Machine '%s' not supported" +msgstr "¥Þ¥·¥ó '%s' ¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#: dlltool.c:3412 dllwrap.c:241 +#, c-format +msgid "Tried file: %s" +msgstr "»î¤·¤¿¥Õ¥¡¥¤¥ë: %s" + +#: dlltool.c:3419 dllwrap.c:248 +#, c-format +msgid "Using file: %s" +msgstr "»ÈÍѤ¹¤ë¥Õ¥¡¥¤¥ë: %s" + +#: dllwrap.c:335 +#, c-format +msgid "Keeping temporary base file %s" +msgstr "°ì»þ¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë %s ¤òÊݸ¤·¤Þ¤¹" + +#: dllwrap.c:337 +#, c-format +msgid "Deleting temporary base file %s" +msgstr "°ì»þ¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë %s ¤òºï½ü¤·¤Þ¤¹" + +#: dllwrap.c:351 +#, c-format +msgid "Keeping temporary exp file %s" +msgstr "°ì»þ exp ¥Õ¥¡¥¤¥ë %s ¤òÊݸ¤·¤Þ¤¹" + +#: dllwrap.c:353 +#, c-format +msgid "Deleting temporary exp file %s" +msgstr "°ì»þ exp ¥Õ¥¡¥¤¥ë %s ¤òºï½ü¤·¤Þ¤¹" + +#: dllwrap.c:366 +#, c-format +msgid "Keeping temporary def file %s" +msgstr "°ì»þ def ¥Õ¥¡¥¤¥ë %s ¤òÊݸ¤·¤Þ¤¹" + +#: dllwrap.c:368 +#, c-format +msgid "Deleting temporary def file %s" +msgstr "°ì»þ def ¥Õ¥¡¥¤¥ë %s ¤òºï½ü¤·¤Þ¤¹" + +#: dllwrap.c:521 +msgid " Generic options:\n" +msgstr " °ìÈÌ¥ª¥×¥·¥ç¥ó:\n" + +#: dllwrap.c:522 +msgid " --quiet, -q Work quietly\n" +msgstr " --quiet, -q ÀŤ«¤Ëưºî¤¹¤ë\n" + +#: dllwrap.c:523 +msgid " --verbose, -v Verbose\n" +msgstr " --verbose, -v ñÁÀå\n" + +#: dllwrap.c:524 +msgid " --version Print dllwrap version\n" +msgstr " --version dllwrap ¤Î¥Ð¡¼¥¸¥ç¥ó¤òɽ¼¨\n" + +#: dllwrap.c:525 +msgid " --implib Synonym for --output-lib\n" +msgstr " --implib <½ÐÎÏ̾> --output-lib ¤ÈƱµÁ¸ì\n" + +#: dllwrap.c:526 +#, c-format +msgid " Options for %s:\n" +msgstr " %s ÍÑ¥ª¥×¥·¥ç¥ó:\n" + +#: dllwrap.c:527 +msgid " --driver-name Defaults to \"gcc\"\n" +msgstr " --driver-name <¥É¥é¥¤¥Ð> \"gcc\" ¤¬¥Ç¥Õ¥©¥ë¥È\n" + +#: dllwrap.c:528 +msgid " --driver-flags Override default ld flags\n" +msgstr " --driver-flags <¥Õ¥é¥°> ¥Ç¥Õ¥©¥ë¥È ld ¥Õ¥é¥°¤ò¾å½ñ¤­¤¹¤ë\n" + +#: dllwrap.c:529 +msgid " --dlltool-name Defaults to \"dlltool\"\n" +msgstr " --dlltool-name \"dlltool\" ¤¬¥Ç¥Õ¥©¥ë¥È\n" + +#: dllwrap.c:530 +msgid " --entry Specify alternate DLL entry point\n" +msgstr " --entry ÂåÂØ DLL ¥¨¥ó¥È¥ê¥Ý¥¤¥ó¥È¤ò»ØÄꤹ¤ë\n" + +#: dllwrap.c:531 +msgid " --image-base Specify image base address\n" +msgstr " --image-base image ¥Ù¡¼¥¹¥¢¥É¥ì¥¹¤ò»ØÄꤹ¤ë\n" + +#: dllwrap.c:532 +msgid " --target i386-cygwin32 or i386-mingw32\n" +msgstr " --target <¥Þ¥·¥ó> i386-cygwin32 Ëô¤Ï i386-mingw32\n" + +#: dllwrap.c:533 +msgid " --dry-run Show what needs to be run\n" +msgstr " --dry-run ưºî¤ËɬÍפʤ³¤È¤òÌÀ¤é¤«¤Ë¤¹¤ë\n" + +#: dllwrap.c:534 +msgid " --mno-cygwin Create Mingw DLL\n" +msgstr " --mno-cygwin Mingw DLL ¤òºîÀ®¤¹¤ë\n" + +#: dllwrap.c:535 +msgid " Options passed to DLLTOOL:\n" +msgstr " DLLTOOL ¤ËÅϤµ¤ì¤ë¥ª¥×¥·¥ç¥ó:\n" + +#: dllwrap.c:536 +msgid " --machine \n" +msgstr " --machine <¥Þ¥·¥ó>\n" + +#: dllwrap.c:537 +msgid " --output-exp Generate export file.\n" +msgstr " --output-exp <½ÐÎÏ̾> export ¥Õ¥¡¥¤¥ë¤òÀ¸À®¤¹¤ë¡£\n" + +#: dllwrap.c:538 +msgid " --output-lib Generate input library.\n" +msgstr " --output-lib <½ÐÎÏ̾> input ¥é¥¤¥Ö¥é¥ê¤òÀ¸À®¤¹¤ë¡£\n" + +#: dllwrap.c:539 +msgid " --add-indirect Add dll indirects to export file.\n" +msgstr " --add-indirect export ¥Õ¥¡¥¤¥ë¤Ë´ÖÀÜ dll ¤òÄɲ乤롣\n" + +#: dllwrap.c:540 +msgid " --dllname Name of input dll to put into output lib.\n" +msgstr " --dllname <̾Á°> ½ÐÎÏ lib ¤ËÃÖ¤¯ÆþÎÏ dll ¤Î̾Á°¡£\n" + +#: dllwrap.c:541 +msgid " --def Name input .def file\n" +msgstr " --def ÆþÎÏ .def ¥Õ¥¡¥¤¥ë¤Î̾Á°\n" + +#: dllwrap.c:542 +msgid " --output-def Name output .def file\n" +msgstr " --output-def ½ÐÎÏ .def ¥Õ¥¡¥¤¥ë¤Î̾Á°¡£\n" + +#: dllwrap.c:543 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols .def ¤ËÁ´¥·¥ó¥Ü¥ë¤ò export ¤¹¤ë\n" + +#: dllwrap.c:544 +msgid " --no-export-all-symbols Only export .drectve symbols\n" +msgstr " --no-export-all-symbols .drectve ¥·¥ó¥Ü¥ë¤Î¤ß¤ò export ¤¹¤ë\n" + +#: dllwrap.c:545 +msgid " --exclude-symbols Exclude from .def\n" +msgstr " --exclude-symbols .def ¤«¤é ¤ò½ü³°¤¹¤ë\n" + +#: dllwrap.c:546 +msgid " --no-default-excludes Zap default exclude symbols\n" +msgstr " --no-default-excludes ¥Ç¥Õ¥©¥ë¥È¤Ç½ü³°¤µ¤ì¤ë¥·¥ó¥Ü¥ë¤ò̵¤¯¤¹\n" + +#: dllwrap.c:547 +msgid " --base-file Read linker generated base file\n" +msgstr " --base-file ¥ê¥ó¥«¤¬ºîÀ®¤·¤¿¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë¤òÆÉ¤ß¼è¤ë\n" + +#: dllwrap.c:548 +msgid " --no-idata4 Don't generate idata$4 section\n" +msgstr " --no-idata4 idata$4 ¥»¥¯¥·¥ç¥ó¤òÀ¸À®¤·¤Ê¤¤\n" + +#: dllwrap.c:549 +msgid " --no-idata5 Don't generate idata$5 section\n" +msgstr " --no-idata5 idata$5 ¥»¥¯¥·¥ç¥ó¤òÀ¸À®¤·¤Ê¤¤\n" + +#: dllwrap.c:550 +msgid " -U Add underscores to .lib\n" +msgstr " -U .lib ¤Ë²¼Àþ¤òÄɲ乤ë\n" + +#: dllwrap.c:551 +msgid " -k Kill @ from exported names\n" +msgstr " -k export ¤µ¤ì¤¿Ì¾Á°¤«¤é @ ¤òºï¤ë\n" + +#: dllwrap.c:552 +msgid " --add-stdcall-alias Add aliases without @\n" +msgstr " --add-stdcall-alias @ ¤Ê¤·¤Î¥¨¥¤¥ê¥¢¥¹¤òÄɲ乤ë\n" + +#: dllwrap.c:553 +msgid " --as Use for assembler\n" +msgstr " --as <̾Á°> ¥¢¥»¥ó¥Ö¥é¤È¤·¤Æ <̾Á°> ¤ò»È¤¦\n" + +#: dllwrap.c:554 +msgid " --nodelete Keep temp files.\n" +msgstr " --nodelete °ì»þ¥Õ¥¡¥¤¥ë¤òºï½ü¤·¤Ê¤¤¡£\n" + +#: dllwrap.c:555 +msgid " Rest are passed unmodified to the language driver\n" +msgstr " »Ä¤ê¤Ï¤½¤Î¤Þ¤Þ¸À¸ì¥É¥é¥¤¥Ð¤ËÅϤµ¤ì¤Þ¤¹\n" + +#: dllwrap.c:816 +msgid "Must provide at least one of -o or --dllname options" +msgstr "¾¯¤Ê¤¯¤È¤â -o ¤« --dllname ¥ª¥×¥·¥ç¥ó¤Î¤É¤Á¤é¤«¤Ï»ØÄꤷ¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó" + +#: dllwrap.c:844 +msgid "no export definition file provided" +msgstr "export ÄêµÁ¥Õ¥¡¥¤¥ë¤¬Ä󶡤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: dllwrap.c:845 +msgid "creating one, but that may not be what you want" +msgstr "°ì¤ÄºîÀ®¤·¤Þ¤¹¤¬¡¢¤³¤ì¤Ï¤¢¤Ê¤¿¤¬Ë¾¤à¤â¤Î¤Ç¤Ï¤Ê¤¤¤È»×¤ï¤ì¤Þ¤¹" + +#: dllwrap.c:1006 +#, c-format +msgid "DLLTOOL name : %s\n" +msgstr "DLLTOOL ̾ : %s\n" + +#: dllwrap.c:1007 +#, c-format +msgid "DLLTOOL options : %s\n" +msgstr "DLLTOOL ¥ª¥×¥·¥ç¥ó: %s\n" + +#: dllwrap.c:1008 +#, c-format +msgid "DRIVER name : %s\n" +msgstr "DRIVER ̾ : %s\n" + +#: dllwrap.c:1009 +#, c-format +msgid "DRIVER options : %s\n" +msgstr "DRIVER ¥ª¥×¥·¥ç¥ó: %s\n" + +#: ieee.c:317 +msgid "unexpected end of debugging information" +msgstr "¥Ç¥Ð¥Ã¥°¾ðÊó¤¬Í½´ü¤·¤Ê¤¤½ê¤Ç½ª¤ï¤Ã¤Æ¤¤¤Þ¤¹" + +#: ieee.c:412 +msgid "invalid number" +msgstr "ÉÔŬÀÚ¤ÊÈÖ¹æ" + +#: ieee.c:471 +msgid "invalid string length" +msgstr "ÉÔŬÀÚ¤Êʸ»úÎóĹ" + +#: ieee.c:528 ieee.c:569 +msgid "expression stack overflow" +msgstr "¼°¥¹¥¿¥Ã¥¯¤¬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿" + +#: ieee.c:548 +msgid "unsupported IEEE expression operator" +msgstr "¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ IEEE ¼°±é»»»Ò¤Ç¤¹" + +#: ieee.c:563 +msgid "unknown section" +msgstr "ÉÔÌÀ¤Ê¥»¥¯¥·¥ç¥ó¤Ç¤¹" + +#: ieee.c:584 +msgid "expression stack underflow" +msgstr "¼°¥¹¥¿¥Ã¥¯¤¬¥¢¥ó¥À¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿" + +#: ieee.c:598 +msgid "expression stack mismatch" +msgstr "¼°¥¹¥¿¥Ã¥¯¤¬°ìÃפ·¤Þ¤»¤ó" + +#: ieee.c:637 +msgid "unknown builtin type" +msgstr "ÉÔÌÀ¤ÊÁȤ߹þ¤ß·¿¤Ç¤¹" + +#: ieee.c:782 +msgid "BCD float type not supported" +msgstr "BCD ÉâÆ°¾®¿ô·¿¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#: ieee.c:928 +msgid "unexpected number" +msgstr "ͽ´ü¤·¤Ê¤¤ÈÖ¹æ¤Ç¤¹" + +#: ieee.c:935 +msgid "unexpected record type" +msgstr "ͽ´ü¤·¤Ê¤¤¥ì¥³¡¼¥É·¿¤Ç¤¹" + +#: ieee.c:968 +msgid "blocks left on stack at end" +msgstr "¥Ö¥í¥Ã¥¯¤¬¥¹¥¿¥Ã¥¯¤Î½ª¤ê¤Ë»Ä¤Ã¤Æ¤¤¤Þ¤¹" + +#: ieee.c:1233 +msgid "unknown BB type" +msgstr "ÉÔÌÀ¤Ê BB ·¿¤Ç¤¹" + +#: ieee.c:1242 +msgid "stack overflow" +msgstr "¥¹¥¿¥Ã¥¯¤¬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿" + +#: ieee.c:1267 +msgid "stack underflow" +msgstr "¥¹¥¿¥Ã¥¯¤¬¥¢¥ó¥À¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿" + +#: ieee.c:1381 ieee.c:1453 ieee.c:2152 +msgid "illegal variable index" +msgstr "ÊÑ¿ô¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬ÉÔÀµ¤Ç¤¹" + +#: ieee.c:1431 +msgid "illegal type index" +msgstr "·¿¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬ÉÔÀµ¤Ç¤¹" + +#: ieee.c:1441 ieee.c:1478 +msgid "unknown TY code" +msgstr "ÉÔÌÀ¤Ê TY ¥³¡¼¥É¤Ç¤¹" + +#: ieee.c:1460 +msgid "undefined variable in TY" +msgstr "TY ¤Ë̤ÄêµÁ¤ÎÊÑ¿ô¤¬¤¢¤ê¤Þ¤¹" + +#. Pascal file name. FIXME. +#: ieee.c:1871 +msgid "Pascal file name not supported" +msgstr "Pascal ¥Õ¥¡¥¤¥ë̾¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: ieee.c:1919 +msgid "unsupported qualifer" +msgstr "¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤½¤¾þ»Ò¤Ç¤¹" + +#: ieee.c:2190 +msgid "undefined variable in ATN" +msgstr "ATN ¤Ë̤ÄêµÁ¤ÎÊÑ¿ô¤¬¤¢¤ê¤Þ¤¹" + +#: ieee.c:2233 +msgid "unknown ATN type" +msgstr "ÉÔÌÀ¤Ê ATN ·¿¤Ç¤¹" + +#. Reserved for FORTRAN common. +#: ieee.c:2355 +msgid "unsupported ATN11" +msgstr "¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ ATN11 ¤Ç¤¹" + +#. We have no way to record this information. FIXME. +#: ieee.c:2382 +msgid "unsupported ATN12" +msgstr "¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ ATN12 ¤Ç¤¹" + +#: ieee.c:2442 +msgid "unexpected string in C++ misc" +msgstr "C++ misc ¤Ëͽ´ü¤·¤Ê¤¤Ê¸»úÎ󤬤¢¤ê¤Þ¤¹" + +#: ieee.c:2455 +msgid "bad misc record" +msgstr "ÉÔÀµ¤Ê misc ¥ì¥³¡¼¥É¤Ç¤¹" + +#: ieee.c:2498 +msgid "unrecognized C++ misc record" +msgstr "ǧ¼±¤Ç¤­¤Ê¤¤ C++ misc ¥ì¥³¡¼¥É¤Ç¤¹" + +#: ieee.c:2615 +msgid "undefined C++ object" +msgstr "̤ÄêµÁ¤Î C++ ¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¹" + +#: ieee.c:2649 +msgid "unrecognized C++ object spec" +msgstr "ǧ¼±¤Ç¤­¤Ê¤¤ C++ ¥ª¥Ö¥¸¥§¥¯¥È»ÅÍͤǤ¹" + +#: ieee.c:2685 +msgid "unsupported C++ object type" +msgstr "¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ C++ ¥ª¥Ö¥¸¥§¥¯¥È·¿¤Ç¤¹" + +#: ieee.c:2695 +msgid "C++ base class not defined" +msgstr "C++ ¥Ù¡¼¥¹¥¯¥é¥¹¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: ieee.c:2707 ieee.c:2812 +msgid "C++ object has no fields" +msgstr "C++ ¥ª¥Ö¥¸¥§¥¯¥È¤¬¥Õ¥£¡¼¥ë¥É¤ò»ý¤Ã¤Æ¤¤¤Þ¤»¤ó" + +#: ieee.c:2726 +msgid "C++ base class not found in container" +msgstr "C++ ¥Ù¡¼¥¹¥¯¥é¥¹¤¬¥³¥ó¥Æ¥ÊÆâ¤Ë¸«¤Ä¤«¤ê¤Þ¤»¤ó" + +#: ieee.c:2833 +msgid "C++ data member not found in container" +msgstr "C++ ¥Ç¡¼¥¿¥á¥ó¥Ð¤¬¥³¥ó¥Æ¥ÊÆâ¤Ë¸«¤Ä¤«¤ê¤Þ¤»¤ó" + +#: ieee.c:2874 ieee.c:3024 +msgid "unknown C++ visibility" +msgstr "ÉÔÌÀ¤Ê C++ ²Ä»ëÀ­¤Ç¤¹" + +#: ieee.c:2908 +msgid "bad C++ field bit pos or size" +msgstr "C++ ¥Õ¥£¡¼¥ë¥É¥Ó¥Ã¥È°ÌÃÖËô¤Ï¥µ¥¤¥º¤¬ÉÔÀµ¤Ç¤¹" + +#: ieee.c:3000 +msgid "bad type for C++ method function" +msgstr "C++ ¥á¥½¥Ã¥É´Ø¿ô¤Î·¿¤¬ÉÔÀµ¤Ç¤¹" + +#: ieee.c:3010 +msgid "no type information for C++ method function" +msgstr "C++ ¥á¥½¥Ã¥É´Ø¿ô¤Î·¿¾ðÊ󤬤¢¤ê¤Þ¤»¤ó" + +#: ieee.c:3049 +msgid "C++ static virtual method" +msgstr "C++ static virtual ¥á¥½¥Ã¥É¤Ç¤¹" + +#: ieee.c:3144 +msgid "unrecognized C++ object overhead spec" +msgstr "C++ ¥ª¥Ö¥¸¥§¥¯¥È¥ª¡¼¥Ð¡¼¥Ø¥Ã¥É»ÅÍͤòǧ¼±¤Ç¤­¤Þ¤»¤ó" + +#: ieee.c:3183 +msgid "undefined C++ vtable" +msgstr "C++ ²¾ÁÛ´Ø¿ô¥Æ¡¼¥Ö¥ë(vtable) ¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: ieee.c:3254 +msgid "C++ default values not in a function" +msgstr "C++ ¥Ç¥Õ¥©¥ë¥ÈÃͤ¬´Ø¿ôÆâ¤Ë¤¢¤ê¤Þ¤»¤ó" + +#: ieee.c:3294 +msgid "unrecognized C++ default type" +msgstr "ǧ¼±¤Ç¤­¤Ê¤¤ C++ ¥Ç¥Õ¥©¥ë¥È·¿¤Ç¤¹" + +#: ieee.c:3325 +msgid "reference parameter is not a pointer" +msgstr "»²¾È¥Ñ¥é¥á¥¿¤¬¥Ý¥¤¥ó¥¿¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó" + +#: ieee.c:3410 +msgid "unrecognized C++ reference type" +msgstr "ǧ¼±¤Ç¤­¤Ê¤¤ C++ »²¾È·¿¤Ç¤¹" + +#: ieee.c:3492 +msgid "C++ reference not found" +msgstr "C++ »²¾È¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó" + +#: ieee.c:3500 +msgid "C++ reference is not pointer" +msgstr "C++ »²¾È¤¬¥Ý¥¤¥ó¥¿¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó" + +#: ieee.c:3529 ieee.c:3537 +msgid "missing required ASN" +msgstr "Í׵ᤵ¤ì¤¿ ASN ¤ò·ç¤¤¤Æ¤¤¤Þ¤¹" + +#: ieee.c:3567 ieee.c:3575 +msgid "missing required ATN65" +msgstr "Í׵ᤵ¤ì¤¿ ATN65 ¤ò·ç¤¤¤Æ¤¤¤Þ¤¹" + +#: ieee.c:3589 +msgid "bad ATN65 record" +msgstr "ATN65 ¥ì¥³¡¼¥É¤¬ÉÔÀµ¤Ç¤¹" + +#: ieee.c:4236 +msgid "IEEE numeric overflow: 0x" +msgstr "IEEE ¿ôÃͤ¬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿: 0x" + +#: ieee.c:4282 +#, c-format +msgid "IEEE string length overflow: %u\n" +msgstr "IEEE ʸ»úÎóŤ¬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿: %u\n" + +#: ieee.c:5324 +#, c-format +msgid "IEEE unsupported integer type size %u\n" +msgstr "IEEE ¤ÏÀ°¿ô·¿¥µ¥¤¥º %u ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó\n" + +#: ieee.c:5360 +#, c-format +msgid "IEEE unsupported float type size %u\n" +msgstr "IEEE ¤ÏÉâÆ°¾®¿ô·¿¥µ¥¤¥º %u ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó\n" + +#: ieee.c:5396 +#, c-format +msgid "IEEE unsupported complex type size %u\n" +msgstr "IEEE ¤ÏÊ£ÁÇ¿ô·¿¥µ¥¤¥º %u ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó\n" + +#: nlmconv.c:275 srconv.c:1966 +msgid "input and output files must be different" +msgstr "ÆþÎϤȽÐÎϤϰۤʤë¥Õ¥¡¥¤¥ë¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó" + +#: nlmconv.c:322 +msgid "input file named both on command line and with INPUT" +msgstr "ÆþÎÏ¥Õ¥¡¥¤¥ë̾¤¬¥³¥Þ¥ó¥É¥é¥¤¥ó¤È INPUT ¤ÎξÊý¤ÇÍ¿¤¨¤é¤ì¤Þ¤·¤¿" + +#: nlmconv.c:331 +msgid "no input file" +msgstr "ÆþÎÏ¥Õ¥¡¥¤¥ë¤¬¤¢¤ê¤Þ¤»¤ó" + +#: nlmconv.c:361 +msgid "no name for output file" +msgstr "½ÐÎÏ¥Õ¥¡¥¤¥ëÍѤÎ̾Á°¤¬¤¢¤ê¤Þ¤»¤ó" + +#: nlmconv.c:374 +msgid "warning: input and output formats are not compatible" +msgstr "·Ù¹ð: ÆþÎϤȽÐÎϤηÁ¼°¤Ë¸ß´¹À­¤¬¤¢¤ê¤Þ¤»¤ó" + +#: nlmconv.c:403 +msgid "make .bss section" +msgstr ".bss ¥»¥¯¥·¥ç¥ó¤ÎºîÀ®" + +#: nlmconv.c:412 +msgid "make .nlmsections section" +msgstr ".nlmsections ¥»¥¯¥·¥ç¥ó¤ÎºîÀ®" + +#: nlmconv.c:414 +msgid "set .nlmsections flags" +msgstr ".nlmsections ¥Õ¥é¥°¤òÀßÄê" + +#: nlmconv.c:442 +msgid "set .bss vma" +msgstr ".bss vma ¤òÀßÄê" + +#: nlmconv.c:449 +msgid "set .data size" +msgstr ".data size ¤òÀßÄê" + +#: nlmconv.c:629 +#, c-format +msgid "warning: symbol %s imported but not in import list" +msgstr "·Ù¹ð: ¥·¥ó¥Ü¥ë %s ¤¬ import ¤µ¤ì¤Þ¤·¤¿¤¬ import ¥ê¥¹¥È¤Ë¤¢¤ê¤Þ¤»¤ó" + +#: nlmconv.c:649 +msgid "set start address" +msgstr "³«»Ï¥¢¥É¥ì¥¹¤òÀßÄê" + +#: nlmconv.c:698 +#, c-format +msgid "warning: START procedure %s not defined" +msgstr "·Ù¹ð: START ¥×¥í¥·¡¼¥¸¥ã %s ¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: nlmconv.c:700 +#, c-format +msgid "warning: EXIT procedure %s not defined" +msgstr "·Ù¹ð: EXIT ¥×¥í¥·¡¼¥¸¥ã %s ¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: nlmconv.c:702 +#, c-format +msgid "warning: CHECK procedure %s not defined" +msgstr "·Ù¹ð: CHECK ¥×¥í¥·¡¼¥¸¥ã %s ¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: nlmconv.c:723 nlmconv.c:912 +msgid "custom section" +msgstr "¥«¥¹¥¿¥à¥»¥¯¥·¥ç¥ó" + +#: nlmconv.c:744 nlmconv.c:941 +msgid "help section" +msgstr "¥Ø¥ë¥×¥»¥¯¥·¥ç¥ó" + +#: nlmconv.c:766 nlmconv.c:959 +msgid "message section" +msgstr "¥á¥Ã¥»¡¼¥¸¥»¥¯¥·¥ç¥ó" + +#: nlmconv.c:782 nlmconv.c:992 +msgid "module section" +msgstr "¥â¥¸¥å¡¼¥ë¥»¥¯¥·¥ç¥ó" + +#: nlmconv.c:802 nlmconv.c:1008 +msgid "rpc section" +msgstr "rpc ¥»¥¯¥·¥ç¥ó" + +#. There is no place to record this information. +#: nlmconv.c:838 +#, c-format +msgid "%s: warning: shared libraries can not have uninitialized data" +msgstr "%s: ·Ù¹ð: ¶¦Í­¥é¥¤¥Ö¥é¥ê¤Ï̤½é´ü²½¥Ç¡¼¥¿¤ò»ý¤Ä¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó" + +#: nlmconv.c:859 nlmconv.c:1027 +msgid "shared section" +msgstr "¶¦Í­¥»¥¯¥·¥ç¥ó" + +#: nlmconv.c:867 +msgid "warning: No version number given" +msgstr "·Ù¹ð: ¥Ð¡¼¥¸¥ç¥óÈֹ椬Ϳ¤¨¤é¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: nlmconv.c:907 nlmconv.c:936 nlmconv.c:954 nlmconv.c:1003 nlmconv.c:1022 +#, c-format +msgid "%s: read: %s" +msgstr "%s: ÆÉ¹þ¤ß: %s" + +#: nlmconv.c:929 +msgid "warning: MAP and FULLMAP are not supported; try ld -M" +msgstr "·Ù¹ð: MAP ¤È FULLMAP ¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó -- ld -M ¤ò»î¤·¤Æ¤¯¤À¤µ¤¤" + +#: nlmconv.c:1099 +#, c-format +msgid "%s: Convert an object file into a NetWare Loadable Module\n" +msgstr "%s: ¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤ò NetWare ¥í¡¼¥À¥Ö¥ë¥â¥¸¥å¡¼¥ë¤ËÊÑ´¹¤·¤Þ¤¹\n" + +#: nlmconv.c:1111 +#, c-format +msgid "" +"Usage: %s [-dhV] [-I bfdname] [-O bfdname] [-T header-file] [-l linker]\n" +" [--input-target=bfdname] [--output-target=bfdname]\n" +" [--header-file=file] [--linker=linker] [--debug]\n" +" [--help] [--version]\n" +" [in-file [out-file]]\n" +msgstr "" +"Usage: %s [-dhV] [-I bfd̾] [-O bfd̾] [-T ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë] [-l ¥ê¥ó¥«]\n" +" [--input-target=bfd̾] [--output-target=bfd̾]\n" +" [--header-file=¥Õ¥¡¥¤¥ë] [--linker=¥ê¥ó¥«] [--debug]\n" +" [--help] [--version]\n" +" [ÆþÎÏ¥Õ¥¡¥¤¥ë [½ÐÎÏ¥Õ¥¡¥¤¥ë]]\n" + +#: nlmconv.c:1151 +#, c-format +msgid "support not compiled in for %s" +msgstr "%s ÍÑ¥µ¥Ý¡¼¥È¤Ï¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: nlmconv.c:1191 +msgid "make section" +msgstr "make ¥»¥¯¥·¥ç¥ó" + +#: nlmconv.c:1205 +msgid "set section size" +msgstr "¥»¥¯¥·¥ç¥ó¥µ¥¤¥º¤òÀßÄê" + +#: nlmconv.c:1211 +msgid "set section alignment" +msgstr "¥»¥¯¥·¥ç¥ó¥¢¥é¥¤¥ó¥á¥ó¥È¤òÀßÄê" + +#: nlmconv.c:1215 +msgid "set section flags" +msgstr "¥»¥¯¥·¥ç¥ó¥Õ¥é¥°¤òÀßÄê" + +#: nlmconv.c:1226 +msgid "set .nlmsections size" +msgstr ".nlmsections ¥µ¥¤¥º¤òÀßÄê" + +#: nlmconv.c:1314 nlmconv.c:1322 nlmconv.c:1331 nlmconv.c:1336 +msgid "set .nlmsection contents" +msgstr ".nlmsection ¤ÎÆâÍÆ¤òÀßÄê" + +#: nlmconv.c:1839 +msgid "stub section sizes" +msgstr "¥¹¥¿¥Ö¥»¥¯¥·¥ç¥ó¥µ¥¤¥º" + +#: nlmconv.c:1888 +msgid "writing stub" +msgstr "¥¹¥¿¥Ö¤Î½ñ¹þ¤ßÃæ" + +#: nlmconv.c:1978 +#, c-format +msgid "unresolved PC relative reloc against %s" +msgstr "%s ¤ËÂФ¹¤ë PC ´ØÏ¢ºÆÇÛÃÖ¤ò²ò·è¤Ç¤­¤Þ¤»¤ó" + +#: nlmconv.c:2042 +#, c-format +msgid "overflow when adjusting relocation against %s" +msgstr "%s ¤ËÂФ¹¤ëºÆÇÛÃÖ¤òÄ´À°Ãæ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿" + +#: nlmconv.c:2159 +#, c-format +msgid "%s: execution of %s failed: " +msgstr "%s: %s ¤Î¼Â¹Ô¤¬¼ºÇÔ¤·¤Þ¤·¤¿: " + +#: nlmconv.c:2174 +#, c-format +msgid "Execution of %s failed" +msgstr "%s ¤Î¼Â¹Ô¤¬¼ºÇÔ¤·¤Þ¤·¤¿" + +#: nm.c:294 +#, c-format +msgid "Usage: %s [OPTION]... [FILE]...\n" +msgstr "»È¤¤Êý: %s [¥ª¥×¥·¥ç¥ó]... [¥Õ¥¡¥¤¥ë]...\n" + +#: nm.c:295 +msgid "List symbols from FILEs (a.out by default).\n" +msgstr "¥Õ¥¡¥¤¥ë(¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï a.out)¤«¤é¥·¥ó¥Ü¥ë¤ò¥ê¥¹¥Èɽ¼¨¤·¤Þ¤¹¡£\n" + +#: nm.c:296 +msgid "" +"\n" +" -a, --debug-syms Display debugger-only symbols\n" +" -A, --print-file-name Print name of the input file before every symbol\n" +" -B Same as --format=bsd\n" +" -C, --demangle[=STYLE] Decode low-level symbol names into user-level names\n" +" The STYLE, if specified, can be `auto' (the default),\n" +" `gnu', 'lucid', 'arm', 'hp', 'edg' or 'gnu-new-abi'\n" +" --no-demangle Do not demangle low-level symbol names\n" +" -D, --dynamic Display dynamic symbols instead of normal symbols\n" +" --defined-only Display only defined symbols\n" +" -e (ignored)\n" +" -f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',\n" +" `sysv' or `posix'. The default is `bsd'\n" +" -g, --extern-only Display only external symbols\n" +" -h, --help Display this information\n" +" -l, --line-numbers Use debugging information to find a filename and\n" +" line number for each symbol\n" +" -n, --numeric-sort Sort symbols numerically by address\n" +" -o Same as -A\n" +" -p, --no-sort Do not sort the symbols\n" +" -P, --portability Same as --format=posix\n" +" -r, --reverse-sort Reverse the sense of the sort\n" +" -s, --print-armap Include index for symbols from archive members\n" +" --size-sort Sort symbols by size\n" +" -t, --radix=RADIX Use RADIX for printing symbol values\n" +" --target=BFDNAME Specify the target object format as BFDNAME\n" +" -u, --undefined-only Display only undefined symbols\n" +" -V, --version Display this program's version number\n" +" -X 32_64 (ignored)\n" +"\n" +msgstr "" +"\n" +" -a, --debug-syms ¥Ç¥Ð¥Ã¥°ÀìÍÑ¥·¥ó¥Ü¥ë¤òɽ¼¨¤¹¤ë\n" +" -A, --print-file-name ³Æ¥·¥ó¥Ü¥ë¤ÎÁ°¤ËÆþÎÏ¥Õ¥¡¥¤¥ë̾¤òɽ¼¨¤¹¤ë\n" +" -B --format=bsd ¤ÈƱ¤¸\n" +" -C, --demangle[=STYLE] Äã°Ì¥·¥ó¥Ü¥ë̾¤ò¥æ¡¼¥¶¥ì¥Ù¥ë̾¤ËÉü¸µ¤¹¤ë\n" +" STYLE ¤Ë°Ê²¼¤Î¤â¤Î¤ò»ØÄê¤Ç¤­¤ë -- `auto'(default),\n" +" `gnu', 'lucid', 'arm', 'hp', 'edg', 'gnu-new-abi'\n" +" --no-demangle Äã°Ì¥·¥ó¥Ü¥ë̾¤òÉü¸µ¤·¤Ê¤¤\n" +" -D, --dynamic Ä̾亮¥ó¥Ü¥ë¤Ç¤Ï¤Ê¤¯Æ°Åª¥·¥ó¥Ü¥ë¤òɽ¼¨¤¹¤ë¡£\n" +" --defined-only ÄêµÁºÑ¥·¥ó¥Ü¥ë¤Î¤ß¤òɽ¼¨¤¹¤ë\n" +" -e (̵»ë¤µ¤ì¤ë)\n" +" -f, --format=FORMAT ½ÐÎÏ·Á¼°¤ò FORMAT ¤È¤¹¤ë¡£FORMAT ¤Ë¤Ï `bsd',\n" +" `sysv', `posix' ¤ò»ØÄê¤Ç¤­¤ë¡£¥Ç¥Õ¥©¥ë¥È¤Ï `bsd'\n" +" -g, --extern-only ³°Éô¥·¥ó¥Ü¥ë¤Î¤ß¤òɽ¼¨¤¹¤ë\n" +" -h, --help ¤³¤Î¾ðÊó¤òɽ¼¨¤¹¤ë\n" +" -l, --line-numbers ³Æ¥·¥ó¥Ü¥ë¤Î¥Ç¥Ð¥Ã¥°¾ðÊ󤫤顢¥·¥ó¥Ü¥ë¤Î¥Õ¥¡¥¤¥ë̾¤È\n" +" ¹ÔÈÖ¹æ¤ò¸«¤Ä¤±¤ë\n" +" -n, --numeric-sort ¥¢¥É¥ì¥¹Ãͤˤè¤Ã¤Æ¥½¡¼¥È¤¹¤ë\n" +" -o -A ¤ÈƱ¤¸\n" +" -p, --no-sort ¥·¥ó¥Ü¥ë¤Ë¤è¤ë¥½¡¼¥È¤ò¹Ô¤ï¤Ê¤¤\n" +" -P, --portability --format=posix ¤ÈƱ¤¸\n" +" -r, --reverse-sort ¥½¡¼¥È½ç¤òµÕ¤Ë¤¹¤ë\n" +" -s, --print-armap ½ñ¸Ë¥á¥ó¥Ð¤«¤é¤Î¥·¥ó¥Ü¥ëÍѤκ÷°ú¤ò´Þ¤á¤ë\n" +" --size-sort ¥µ¥¤¥º¤Ë¤è¤Ã¤Æ¥½¡¼¥È¤¹¤ë\n" +" -t, --radix=RADIX ¥·¥ó¥Ü¥ëÃͤÎɽ¼¨´ð¿ô¤Ë RADIX ¤ò»È¤¦\n" +" --target=BFDNAME ¥¿¡¼¥²¥Ã¥È¥ª¥Ö¥¸¥§¥¯¥È·Á¼°¤ò BFDNAME ¤È¤·¤Æ»ØÄꤹ¤ë\n" +" -u, --undefined-only ̤ÄêµÁ¥·¥ó¥Ü¥ë¤Î¤ß¤òɽ¼¨¤¹¤ë\n" +" -V, --version ¤³¤Î¥×¥í¥°¥é¥à¤Î¥Ð¡¼¥¸¥ç¥ó¤òɽ¼¨¤¹¤ë\n" +" -X 32_64 (̵»ë¤µ¤ì¤ë)\n" +"\n" + +#: nm.c:328 objdump.c:274 +#, c-format +msgid "Report bugs to %s.\n" +msgstr "¥Ð¥°Êó¹ð¤Ï %s ¤Þ¤Ç¡£\n" + +#: nm.c:361 +#, c-format +msgid "%s: invalid radix" +msgstr "%s: ´ð¿ô¤¬ÉÔŬÀڤǤ¹" + +#: nm.c:386 +#, c-format +msgid "%s: invalid output format" +msgstr "%s: ½ÐÎÏ·Á¼°¤¬ÉÔŬÀڤǤ¹" + +#: nm.c:493 +msgid "Only -X 32_64 is supported" +msgstr "-X 32_64 ¤·¤«¥µ¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó" + +#: nm.c:535 +#, c-format +msgid "data size %ld" +msgstr "¥Ç¡¼¥¿¥µ¥¤¥º %ld" + +#: nm.c:1325 +#, c-format +msgid "\n\nUndefined symbols from %s:\n\n" +msgstr "\n\n%s ¤«¤é¤Î̤ÄêµÁ¥·¥ó¥Ü¥ë:\n\n" + +#: nm.c:1327 +#, c-format +msgid "\n\nSymbols from %s:\n\n" +msgstr "\n\n%s ¤«¤é¤Î¥·¥ó¥Ü¥ë:\n\n" + +#: nm.c:1328 nm.c:1382 +msgid "Name Value Class Type Size Line Section\n\n" +msgstr "̾Á° ÃÍ ¥¯¥é¥¹ ·¿ ¥µ¥¤¥º ¹Ô ¥»¥¯¥·¥ç¥ó\n\n" + +#: nm.c:1379 +#, c-format +msgid "\n\nUndefined symbols from %s[%s]:\n\n" +msgstr "\n\n%s[%s] ¤«¤é¤Î̤ÄêµÁ¥·¥ó¥Ü¥ë:\n\n" + +#: nm.c:1381 +#, c-format +msgid "\n\nSymbols from %s[%s]:\n\n" +msgstr "\n\n%s[%s] ¤«¤é¤Î¥·¥ó¥Ü¥ë:\n\n" + +#: nm.c:1552 +msgid "\nArchive index:\n" +msgstr "\n½ñ¸Ë¥¤¥ó¥Ç¥Ã¥¯¥¹:\n" + +#: objcopy.c:322 +#, c-format +msgid "Usage: %s in-file [out-file]\n" +msgstr "»È¤¤Êý: %s <¥¹¥¤¥Ã¥Á> ÆþÎÏ¥Õ¥¡¥¤¥ë [½ÐÎÏ¥Õ¥¡¥¤¥ë]\n" + +#: objcopy.c:323 objcopy.c:383 +msgid " The switches are:\n" +msgstr " ¥¹¥¤¥Ã¥Á¤Ï°Ê²¼¤ÎÄ̤ê:\n" + +#: objcopy.c:324 +msgid "" +" -I --input-target Assume input file is in format \n" +" -O --output-target Create an output file in format \n" +" -F --target Set both input and output format to \n" +" --debugging Convert debugging information, if possible\n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -j --only-section Only copy section into the output\n" +" -R --remove-section Remove section from the output\n" +" -S --strip-all Remove all symbol and relocation information\n" +" -g --strip-debug Remove all debugging symbols\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol Do not copy symbol \n" +" -K --keep-symbol Only copy symbol \n" +" -L --localize-symbol Force symbol to be marked as a local\n" +" -W --weaken-symbol Force symbol to be marked as a weak\n" +" --weaken Force all global symbols to be marked as weak\n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -i --interleave Only copy one out of every bytes\n" +" -b --byte Select byte in every interleaved block\n" +" --gap-fill Fill gaps between sections with \n" +" --pad-to Pad the last section up to address \n" +" --set-start Set the start address to \n" +" {--change-start|--adjust-start} \n" +" Add to the start address\n" +" {--change-addresses|--adjust-vma} \n" +" Add to LMA, VMA and start addresses\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" Change LMA and VMA of section by \n" +" --change-section-lma {=|+|-}\n" +" Change the LMA of section by \n" +" --change-section-vma {=|+|-}\n" +" Change the VMA of section by \n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" Warn if a named section does not exist\n" +" --set-section-flags =\n" +" Set section 's properties to \n" +" --add-section = Add section found in to output\n" +" --change-leading-char Force output format's leading character style\n" +" --remove-leading-char Remove leading character from global symbols\n" +" --redefine-sym = Redefine symbol name to \n" +" --srec-len Restrict the length of generated Srecords\n" +" --srec-forceS3 Restrict the type of generated Srecords to S3\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +msgstr "" +" -I --input-target ÆþÎÏ¥Õ¥¡¥¤¥ë¤ò ·Á¼°¤ò¤È¤ß¤Ê¤¹\n" +" -O --output-target ½ÐÎÏ·Á¼°¤ò ¤È¤·¤ÆºîÀ®¤¹¤ë\n" +" -F --target ÆþÎÏ¡¦½ÐÎÏξÊý¤Ë ·Á¼°¤ò»ÈÍѤ¹¤ë\n" +" --debugging ²Äǽ¤Ç¤¢¤ì¤Ð¥Ç¥Ð¥Ã¥°¾ðÊó¤òÊÑ´¹¤¹¤ë\n" +" -p --preserve-dates ½¤Àµ/¥¢¥¯¥»¥¹»þ¹ï¾ðÊó¤ò½ÐÎϤ˥³¥Ô¡¼¤¹¤ë\n" +" -j --only-section <̾Á°> <̾Á°> ¤Î¥»¥¯¥·¥ç¥ó¤À¤±¤ò½ÐÎϤ¹¤ë\n" +" -R --remove-section <̾Á°> <̾Á°> ¤Î¥»¥¯¥·¥ç¥ó¤ò½ÐÎϤ«¤é¼è¤ê½ü¤¯\n" +" -S --strip-all Á´¤Æ¤Î¥·¥ó¥Ü¥ëµÚ¤ÓºÆÇÛÃÖ¾ðÊó¤ò¼è¤ê½ü¤¯\n" +" -g --strip-debug Á´¤Æ¤Î¥Ç¥Ð¥Ã¥°¥·¥ó¥Ü¥ë¤ò¼è¤ê½ü¤¯\n" +" --strip-unneeded ºÆÇÛÃÖ¤ËɬÍפʥ·¥ó¥Ü¥ë°Ê³°¤òÁ´¤Æ¼è¤ê½ü¤¯\n" +" -N --strip-symbol <̾Á°> <̾Á°> ¤Î¥·¥ó¥Ü¥ë¤ò¥³¥Ô¡¼¤·¤Ê¤¤\n" +" -K --keep-symbol <̾Á°> <̾Á°> ¤Î¥·¥ó¥Ü¥ë¤ò¥³¥Ô¡¼¤¹¤ë\n" +" -L --localize-symbol <̾Á°> <̾Á°> ¤Î¥·¥ó¥Ü¥ë¤Ë local ¥Þ¡¼¥¯¤ò¤Ä¤±¤ë\n" +" -W --weaken-symbol <̾Á°> <̾Á°> ¤Î¥·¥ó¥Ü¥ë¤Ë weak ¥Þ¡¼¥¯¤ò¤Ä¤±¤ë\n" +" --weaken Á´¤Æ¤ÎÂç°è¥·¥ó¥Ü¥ë¤Ë weak ¥Þ¡¼¥¯¤ò¤Ä¤±¤ë\n" +" -x --discard-all Á´¤Æ¤ÎÈóÂç°è¥·¥ó¥Ü¥ë¤ò¼è¤ê½ü¤¯\n" +" -X --discard-locals ¤¢¤ë¼ï¤Î¥³¥ó¥Ñ¥¤¥éÀ¸À®¥·¥ó¥Ü¥ë¤ò¼è¤ê½ü¤¯\n" +" -i --interleave <¿ôÃÍ> <¿ôÃÍ> ¥Ð¥¤¥Èʬ¤´¤È¤Ë¥³¥Ô¡¼¤¹¤ë\n" +" -b --byte <¿ôÃÍ> ³Æ interleave ¥Ö¥í¥Ã¥¯¤Ç¤Î¥Ð¥¤¥È¿ô¤òÁªÂò\n" +" --gap-fill <ÃÍ> ¥»¥¯¥·¥ç¥ó´Ö¤Î·ä´Ö¤ò <ÃÍ> ¤ÇËä¤á¤ë\n" +" --pad-to <¥¢¥É¥ì¥¹> ľÁ°¤Î¥»¥¯¥·¥ç¥ó¤«¤é <¥¢¥É¥ì¥¹> ¤Þ¤ÇËä¤á¤ë\n" +" --set-start <¥¢¥É¥ì¥¹> ³«»Ï¥¢¥É¥ì¥¹¤ò <¥¢¥É¥ì¥¹> ¤ËÀßÄꤹ¤ë\n" +" {--change-start|--adjust-start} <Áýʬ>\n" +" ³«»Ï¥¢¥É¥ì¥¹¤Ë <Áýʬ> ²Ã¤¨¤ë\n" +" {--change-addresses|--adjust-vma} <Áýʬ>\n" +" LMA, VMA µÚ¤Ó³«»Ï¥¢¥É¥ì¥¹¤Ë <Áýʬ> ²Ã¤¨¤ë\n" +" {--change-section-address|--adjust-section-vma} <̾Á°>{=|+|-}<ÃÍ>\n" +" ¥»¥¯¥·¥ç¥ó<̾Á°>¤Î LMA, VMA ¤ò<ÃÍ>¤ËÊѹ¹\n" +" --change-section-lma {=|+|-}\n" +" ¥»¥¯¥·¥ç¥ó <̾Á°> ¤Î LMA ¤ò <ÃÍ> ¤ËÊѹ¹\n" +" --change-section-vma {=|+|-}\n" +" ¥»¥¯¥·¥ç¥ó <̾Á°> ¤Î VMA ¤ò <ÃÍ> ¤ËÊѹ¹\n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" ̾Á°ÉÕ¤­¥»¥¯¥·¥ç¥ó¤¬Ìµ¤±¤ì¤Ð·Ù¹ð¤¹¤ë\n" +" --set-section-flags <̾Á°>=<¥Õ¥é¥°>\n" +" ¥»¥¯¥·¥ç¥ó<̾Á°> ¤ÎÆÃ¼Á¤ò <¥Õ¥é¥°> ¤ËÀßÄê\n" +" --add-section = ¥»¥¯¥·¥ç¥ó<̾Á°> ¤ò½ÐÎÏ<¥Õ¥¡¥¤¥ë>¤ËÄɲÃ\n" +" --change-leading-char ½ÐÎÏ·Á¼°¤ÎÀèÆ¬Ê¸»úÊý¼°¤ò¶¯À©¤¹¤ë\n" +" --remove-leading-char Âç°è¥·¥ó¥Ü¥ë¤«¤éÀèÆ¬Ê¸»ú¤ò¼è¤ê½ü¤¯\n" +" --redefine-sym <µì>=<¿·> ¥·¥ó¥Ü¥ë̾ <µì> ¤ò <¿·> ¤ËºÆÄêµÁ¤¹¤ë\n" +" --srec-len <¿ôÃÍ> À¸À®¤µ¤ì¤ë S¥ì¥³¡¼¥ÉŤò¸·Ì©¤Ë<¿ôÃÍ>¤È¤¹¤ë\n" +" --srec-forceS3 À¸À®¤µ¤ì¤ë S3 ÍÑ S¥ì¥³¡¼¥É·¿¤ò¸·Ì©¤Ë¤¹¤ë\n" +" -v --verbose ½¤Àµ¤µ¤ì¤¿Á´¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤ò¥ê¥¹¥È\n" +" -V --version ¤³¤Î¥×¥í¥°¥é¥à¤Î¥Ð¡¼¥¸¥ç¥óÈÖ¹æ¤òɽ¼¨¤¹¤ë\n" +" -h --help ¤³¤Î»È¤¤Êý¤òɽ¼¨¤¹¤ë\n" + +#: objcopy.c:382 +#, c-format +msgid "Usage: %s in-file(s)\n" +msgstr "»È¤¤Êý: %s <¥¹¥¤¥Ã¥Á> ÆþÎÏ¥Õ¥¡¥¤¥ë...\n" + +#: objcopy.c:384 +msgid "" +" -I --input-target Assume input file is in format \n" +" -O --output-target Create an output file in format \n" +" -F --target Set both input and output format to \n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -R --remove-section Remove section from the output\n" +" -s --strip-all Remove all symbol and relocation information\n" +" -g -S --strip-debug Remove all debugging symbols\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol Do not copy symbol \n" +" -K --keep-symbol Only copy symbol \n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +" -o Place stripped output into \n" +msgstr "" +" -I --input-target ÆþÎÏ¥Õ¥¡¥¤¥ë¤ò ·Á¼°¤È¤ß¤Ê¤¹\n" +" -O --output-target ½ÐÎϤò ·Á¼°¤ÇºîÀ®¤¹¤ë\n" +" -F --target ÆþÎÏ¡¦½ÐÎÏξÊý¤Ë ·Á¼°¤ò»ÈÍѤ¹¤ë\n" +" -p --preserve-dates ½¤Àµ/¥¢¥¯¥»¥¹»þ¹ï¾ðÊó¤ò½ÐÎϤ˥³¥Ô¡¼¤¹¤ë\n" +" -R --remove-section <̾Á°> <̾Á°> ¤Î¥»¥¯¥·¥ç¥ó¤ò½ÐÎϤ«¤é¼è¤ê½ü¤¯\n" +" -s --strip-all Á´¤Æ¤Î¥·¥ó¥Ü¥ëµÚ¤ÓºÆÇÛÃÖ¾ðÊó¤ò¼è¤ê½ü¤¯\n" +" -g -S --strip-debug Á´¤Æ¤Î¥Ç¥Ð¥Ã¥°¥·¥ó¥Ü¥ë¤ò¼è¤ê½ü¤¯\n" +" --strip-unneeded ºÆÇÛÃÖ¤ËɬÍפʥ·¥ó¥Ü¥ë°Ê³°¤òÁ´¤Æ¼è¤ê½ü¤¯ \n" +" -N --strip-symbol <̾Á°> <̾Á°> ¤Î¥·¥ó¥Ü¥ë¤ò¥³¥Ô¡¼¤·¤Ê¤¤\n" +" -K --keep-symbol <̾Á°> <̾Á°> ¤Î¥·¥ó¥Ü¥ë¤ò¥³¥Ô¡¼¤¹¤ë\n" +" -x --discard-all Á´¤Æ¤ÎÈóÂç°è¥·¥ó¥Ü¥ë¤ò¼è¤ê½ü¤¯\n" +" -X --discard-locals ¤¢¤ë¼ï¤Î¥³¥ó¥Ñ¥¤¥éÀ¸À®¥·¥ó¥Ü¥ë¤ò¼è¤ê½ü¤¯\n" +" -v --verbose ½¤Àµ¤µ¤ì¤¿Á´¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤ò¥ê¥¹¥È\n" +" -V --version ¤³¤Î¥×¥í¥°¥é¥à¤Î¥Ð¡¼¥¸¥ç¥óÈÖ¹æ¤òɽ¼¨¤¹¤ë\n" +" -h --help ¤³¤Î»È¤¤Êý¤òɽ¼¨¤¹¤ë\n" +" -o <¥Õ¥¡¥¤¥ë> strip ºÑ½ÐÎϤò <¥Õ¥¡¥¤¥ë> ¤Ë½ñ¤­¹þ¤à\n" + +#: objcopy.c:454 +#, c-format +msgid "unrecognized section flag `%s'" +msgstr "¥»¥¯¥·¥ç¥ó¥Õ¥é¥° `%s' ¤òǧ¼±¤Ç¤­¤Þ¤»¤ó" + +#: objcopy.c:455 +#, c-format +msgid "supported flags: %s" +msgstr "¥µ¥Ý¡¼¥È¤µ¤ì¤ë¥Õ¥é¥°: %s" + +#: objcopy.c:712 +#, c-format +msgid "%s: Multiple redefinition of symbol \"%s\"" +msgstr "%s: ¥·¥ó¥Ü¥ë \"%s\" ¤ÎºÆÄêµÁ¤Ç¤¹" + +#: objcopy.c:719 +#, c-format +msgid "%s: Symbol \"%s\" is target of more than one redefinition" +msgstr "%s: ¥·¥ó¥Ü¥ë \"%s\" ²¿ÅÙ¤«ºÆÄêµÁ¤µ¤ì¤¿¥¿¡¼¥²¥Ã¥È¤Ç¤¹" + +#: objcopy.c:773 +#, c-format +msgid "copy from %s(%s) to %s(%s)\n" +msgstr "%s(%s) ¤«¤é %s(%s) ¤Ø¥³¥Ô¡¼¤·¤Þ¤¹\n" + +#: objcopy.c:792 +#, c-format +msgid "Warning: Output file cannot represent architecture %s" +msgstr "·Ù¹ð: ½ÐÎÏ¥Õ¥¡¥¤¥ë¤¬¥¢¡¼¥­¥Æ¥¯¥Á¥ã %s ¤ËÂбþ¤·¤Æ¤¤¤Þ¤»¤ó" + +#: objcopy.c:819 +#, c-format +msgid "can't create section `%s': %s" +msgstr "¥»¥¯¥·¥ç¥ó `%s' ¤òºîÀ®¤Ç¤­¤Þ¤»¤ó: %s" + +#: objcopy.c:905 +#, c-format +msgid "Can't fill gap after %s: %s" +msgstr "%s °Ê¹ß¤Î·ä´Ö¤òËä¤á¤é¤ì¤Þ¤»¤ó: %s" + +#: objcopy.c:930 +#, c-format +msgid "Can't add padding to %s: %s" +msgstr "%s ¤Ë¥Ñ¥Ç¥£¥ó¥°¤Ç¤­¤Þ¤»¤ó: %s" + +#: objcopy.c:1068 +#, c-format +msgid "%s: error copying private BFD data: %s" +msgstr "%s: ¥×¥é¥¤¥Ù¡¼¥È BFD ¥Ç¡¼¥¿¥³¥Ô¡¼Ãæ¤Î¥¨¥é¡¼: %s" + +#: objcopy.c:1102 +#, c-format +msgid "cannot mkdir %s for archive copying (error: %s)" +msgstr "½ñ¸Ë¥³¥Ô¡¼¤Î°Ù¤Î mkdir %s ¤¬¤Ç¤­¤Þ¤»¤ó (¥¨¥é¡¼: %s)" + +#: objcopy.c:1291 +msgid "making" +msgstr "ºîÀ®Ãæ" + +#: objcopy.c:1300 +msgid "size" +msgstr "¥µ¥¤¥º" + +#: objcopy.c:1314 +msgid "vma" +msgstr "vma " + +#: objcopy.c:1340 +msgid "alignment" +msgstr "¥¢¥é¥¤¥ó¥á¥ó¥È" + +#: objcopy.c:1349 +msgid "flags" +msgstr "¥Õ¥é¥°" + +#: objcopy.c:1363 +msgid "private data" +msgstr "¥×¥é¥¤¥Ù¡¼¥È¥Ç¡¼¥¿" + +#: objcopy.c:1371 +#, c-format +msgid "%s: section `%s': error in %s: %s" +msgstr "%s: ¥»¥¯¥·¥ç¥ó `%s': %s¤Î¥¨¥é¡¼: %s" + +#: objcopy.c:1645 +#, c-format +msgid "%s: can't create debugging section: %s" +msgstr "%s: ¥Ç¥Ð¥Ã¥°¥»¥¯¥·¥ç¥ó¤òºîÀ®¤Ç¤­¤Þ¤»¤ó: %s" + +#: objcopy.c:1660 +#, c-format +msgid "%s: can't set debugging section contents: %s" +msgstr "%s: ¥Ç¥Ð¥Ã¥°¥»¥¯¥·¥ç¥ó¤ÎÆâÍÆ¤òÀßÄê¤Ç¤­¤Þ¤»¤ó: %s" + +#: objcopy.c:1669 +#, c-format +msgid "%s: don't know how to write debugging information for %s" +msgstr "%s: %s ÍѥǥХå°¾ðÊó¤Î½ñ¤­Êý¤¬²ò¤ê¤Þ¤»¤ó" + +#: objcopy.c:1775 +#, c-format +msgid "%s: cannot stat: %s" +msgstr "%s: stat(2) ¤¬¤Ç¤­¤Þ¤»¤ó: %s" + +#: objcopy.c:1825 +msgid "byte number must be non-negative" +msgstr "¥Ð¥¤¥È¿ô¤ÏÈóÉé¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó" + +#: objcopy.c:1831 +msgid "interleave must be positive" +msgstr "interleave ¤ÏÀµ¤Î¿ôÃͤǤʤ±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó" + +#: objcopy.c:1851 objcopy.c:1859 +#, c-format +msgid "%s both copied and removed" +msgstr "%s ¥³¥Ô¡¼¤Èºï½ü¤ÎξÊý¤¬»ØÄꤵ¤ì¤Þ¤·¤¿" + +#: objcopy.c:1928 objcopy.c:1998 objcopy.c:2099 objcopy.c:2127 +#, c-format +msgid "bad format for %s" +msgstr "%s ÍѤȤ·¤Æ¤ÏÉÔÀµ¤Ê·Á¼°¤Ç¤¹" + +#: objcopy.c:1931 +#, c-format +msgid "cannot stat: %s: %s" +msgstr "stat(2) ¤Ç¤­¤Þ¤»¤ó: %s: %s" + +#: objcopy.c:1949 +#, c-format +msgid "cannot open: %s: %s" +msgstr "open ¤Ç¤­¤Þ¤»¤ó: %s: %s" + +#: objcopy.c:1953 +#, c-format +msgid "%s: fread failed" +msgstr "%s: fread(3) ¤¬¼ºÇÔ¤·¤Þ¤·¤¿" + +#: objcopy.c:2067 +#, c-format +msgid "Warning: truncating gap-fill from 0x%s to 0x%x" +msgstr "·Ù¹ð: 0x%s ¤«¤é 0x%x ¤Þ¤Ç¤Î·ä´Ö¤ÎËä¤á¹þ¤ß¤òÀÚ¤êµÍ¤á¤Þ¤¹" + +#: objcopy.c:2169 +msgid "byte number must be less than interleave" +msgstr "¥Ð¥¤¥È¿ô¤Ï interleave ̤Ëþ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó" + +#: objcopy.c:2188 +#, c-format +msgid "Cannot stat: %s: %s" +msgstr "stat(2) ¤Ç¤­¤Þ¤»¤ó: %s: %s" + +#: objcopy.c:2228 objcopy.c:2242 +#, c-format +msgid "%s %s%c0x%s never used" +msgstr "%s %s%c0x%s ¤Ï»È¤ï¤ì¤ë¤³¤È¤¬¤¢¤ê¤Þ¤»¤ó" + +#: objdump.c:223 +#, c-format +msgid "Usage: %s OPTION... FILE...\n" +msgstr "»È¤¤Êý: %s ¥ª¥×¥·¥ç¥ó... ¥Õ¥¡¥¤¥ë...\n" + +#: objdump.c:224 +msgid "Display information from object FILE.\n" +msgstr "¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤«¤é¤Î¾ðÊó¤òɽ¼¨¤¹¤ë¡£\n" + +#: objdump.c:225 +msgid "\n At least one of the following switches must be given:\n" +msgstr "\n °Ê²¼¤Î¥¹¥¤¥Ã¥Á¤«¤é¾¯¤Ê¤¯¤È¤â°ì¤Ä¤Ï»ØÄꤵ¤ì¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó:\n" + +#: objdump.c:226 +msgid "" +" -a, --archive-headers Display archive header information\n" +" -f, --file-headers Display the contents of the overall file header\n" +" -p, --private-headers Display object format specific file header contents\n" +" -h, --[section-]headers Display the contents of the section headers\n" +" -x, --all-headers Display the contents of all headers\n" +" -d, --disassemble Display assembler contents of executable sections\n" +" -D, --disassemble-all Display assembler contents of all sections\n" +" -S, --source Intermix source code with disassembly\n" +" -s, --full-contents Display the full contents of all sections requested\n" +" -g, --debugging Display debug information in object file\n" +" -G, --stabs Display (in raw form) any STABS info in the file\n" +" -t, --syms Display the contents of the symbol table(s)\n" +" -T, --dynamic-syms Display the contents of the dynamic symbol table\n" +" -r, --reloc Display the relocation entries in the file\n" +" -R, --dynamic-reloc Display the dynamic relocation entries in the file\n" +" -V, --version Display this program's version number\n" +" -i, --info List object formats and architectures supported\n" +" -H, --help Display this information\n" +msgstr "" +" -a, --archive-headers ½ñ¸Ë¥Ø¥Ã¥À¾ðÊó¤òɽ¼¨¤¹¤ë\n" +" -f, --file-headers ¥Õ¥¡¥¤¥ë¥Ø¥Ã¥ÀÁ´ÂΤξðÊó¤òɽ¼¨¤¹¤ë\n" +" -p, --private-headers ¥ª¥Ö¥¸¥§¥¯¥È·Á¼°ÆÃÍ­¤Î¥Õ¥¡¥¤¥ë¥Ø¥Ã¥ÀÆâÍÆ¤òɽ¼¨¤¹¤ë\n" +" -h, --[section-]headers ¥»¥¯¥·¥ç¥ó¥Ø¥Ã¥À¤ÎÆâÍÆ¤òɽ¼¨¤¹¤ë\n" +" -x, --all-headers Á´¥Ø¥Ã¥À¤ÎÆâÍÆ¤òɽ¼¨¤¹¤ë\n" +" -d, --disassemble executable ¥»¥¯¥·¥ç¥ó¤ÎÆâÍÆ¤ò¥¢¥»¥ó¥Ö¥ê·Á¼°É½¼¨\n" +" -D, --disassemble-all Á´¥»¥¯¥·¥ç¥ó¤ÎÆâÍÆ¤ò¥¢¥»¥ó¥Ö¥ê·Á¼°É½¼¨\n" +" -S, --source µÕ¥¢¥»¥ó¥Ö¥ë¤È¥½¡¼¥¹¥³¡¼¥É¤òº®ºß¤µ¤»¤ÆÉ½¼¨¤¹¤ë\n" +" -s, --full-contents Í׵ᤵ¤ì¤¿Á´¥»¥¯¥·¥ç¥ó¤ÎÁ´¤Æ¤ÎÆâÍÆ¤òɽ¼¨¤¹¤ë\n" +" -g, --debugging ¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤Î¥Ç¥Ð¥Ã¥°¾ðÊó¤òɽ¼¨\n" +" -G, --stabs ¥Õ¥¡¥¤¥ë¤Î STABS ¾ðÊó¤òÁǤηÁ¼°¤Çɽ¼¨¤¹¤ë\n" +" -t, --syms ¥·¥ó¥Ü¥ë¥Æ¡¼¥Ö¥ë¤ÎÆâÍÆ¤òɽ¼¨¤¹¤ë\n" +" -T, --dynamic-syms ưŪ¥·¥ó¥Ü¥ë¥Æ¡¼¥Ö¥ë¤ÎÆâÍÆ¤òɽ¼¨¤¹¤ë\n" +" -r, --reloc ¥Õ¥¡¥¤¥ë¤ÎºÆÇÛÃÖ¥¨¥ó¥È¥ê¤òɽ¼¨¤¹¤ë\n" +" -R, --dynamic-reloc ¥Õ¥¡¥¤¥ë¤ÎưŪºÆÇÛÃÖ¥¨¥ó¥È¥ê¤òɽ¼¨¤¹¤ë\n" +" -V, --version ¤³¤Î¥×¥í¥°¥é¥à¤Î¥Ð¡¼¥¸¥ç¥óÈÖ¹æ¤òɽ¼¨¤¹¤ë\n" +" -i, --info ¥µ¥Ý¡¼¥È¤µ¤ì¤ë¥ª¥Ö¥¸¥§¥¯¥È·Á¼°¤È¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤òɽ¼¨\n" +" -H, --help ¤³¤Î¾ðÊó¤òɽ¼¨¤¹¤ë\n" + +#: objdump.c:248 +msgid "\n The following switches are optional:\n" +msgstr "\n °Ê²¼¤Î¥¹¥¤¥Ã¥Á¤Ï¥ª¥×¥·¥ç¥ó¤Ç¤¹:\n" + +#: objdump.c:249 +msgid "" +" -b, --target=BFDNAME Specify the target object format as BFDNAME\n" +" -m, --architecture=MACHINE Specify the target architecture as MACHINE\n" +" -j, --section=NAME Only display information for section NAME\n" +" -M, --disassembler-options=OPT Pass text OPT on to the disassembler\n" +" -EB --endian=big Assume big endian format when disassembling\n" +" -EL --endian=little Assume little endian format when disassembling\n" +" --file-start-context Include context from start of file (with -S)\n" +" -l, --line-numbers Include line numbers and filenames in output\n" +" -C, --demangle[=STYLE] Decode mangled/processed symbol names\n" +" The STYLE, if specified, can be `auto', 'gnu',\n" +" 'lucid', 'arm', 'hp', 'edg', or 'gnu-new-abi'\n" +" -w, --wide Format output for more than 80 columns\n" +" -z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling\n" +" --start-address=ADDR Only process data whoes address is >= ADDR\n" +" --stop-address=ADDR Only process data whoes address is <= ADDR\n" +" --prefix-addresses Print complete address alongside disassembly\n" +" --[no-]show-raw-insn Display hex alongside symbolic disassembly\n" +" --adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n" +"\n" +msgstr "" +" -b, --target=BFDNAME ¥¿¡¼¥²¥Ã¥È¥ª¥Ö¥¸¥§¥¯¥È·Á¼°¤ò BFDNAME ¤È»ØÄê\n" +" -m, --architecture=MACHINE ¥¿¡¼¥²¥Ã¥È¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤ò MACHINE ¤È»ØÄê\n" +" -j, --section=NAME ¥»¥¯¥·¥ç¥ó NAME ¤Î¾ðÊó¤À¤±¤òɽ¼¨¤¹¤ë\n" +" -M, --disassembler-options=OPT µÕ¥¢¥»¥ó¥Ö¥é¤Ë OPT ʸ»úÎó¤òÅϤ¹\n" +" -EB --endian=big µÕ¥¢¥»¥ó¥Ö¥ë»þ¤Ë¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó·Á¼°¤È¤¹¤ë\n" +" -EL --endian=little µÕ¥¢¥»¥ó¥Ö¥ë»þ¤Ë¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó·Á¼°¤È¤¹¤ë\n" +" --file-start-context ¥Õ¥¡¥¤¥ë»ÏÅÀ¤«¤é¤Îʸ̮¤ò´Þ¤á¤ë(-S ¤È¶¦¤Ë»ÈÍÑ)\n" +" -l, --line-numbers ½ÐÎϤ˹ÔÈÖ¹æ¤È¥Õ¥¡¥¤¥ë̾¤ò´Þ¤á¤ë\n" +" -C, --demangle[=STYLE] ÊÑ·Á/½èÍý¤µ¤ì¤¿¥·¥ó¥Ü¥ë̾¤òÉü¸µ(demangle)¤¹¤ë\n" +" STYLE ¤ò»ØÄꤹ¤ë¾ì¹ç `auto', 'gnu', 'lucid',\n" +" 'arm', 'hp', 'edg', or 'gnu-new-abi'\n" +" -w, --wide ½ÐÎÏÉý 80 ·å°Ê¾å¤Ç½ÐÎϤòÀ°·Á¤¹¤ë\n" +" -z, --disassemble-zeroes µÕ¥¢¥»¥ó¥Ö¥ë»þ¤Ë¥¼¥í¤Î¥Ö¥í¥Ã¥¯¤òÈô¤Ð¤µ¤Ê¤¤\n" +" --start-address=ADDR ADDR °Ê¾å¤Î¥¢¥É¥ì¥¹¤À¤±¤ò½èÍý¤¹¤ë\n" +" --stop-address=ADDR ADDR °Ê²¼¤Î¥¢¥É¥ì¥¹¤À¤±¤ò½èÍý¤¹¤ë\n" +" --prefix-addresses µÕ¥¢¥»¥ó¥Ö¥ë·ë²Ì¤Î¦¤Ë´°Á´¥¢¥É¥ì¥¹¤òɽ¼¨¤¹¤ë\n" +" --[no-]show-raw-insn µÕ¥¢¥»¥ó¥Ö¥ëÌ¿Îá̾¤Î¦¤Ë 16 ¿Ê¿ô¥³¡¼¥É¤âɽ¼¨\n" +" --adjust-vma=OFFSET Á´¤Æ¤Î¥»¥¯¥·¥ç¥ó¥¢¥É¥ì¥¹¤Ë OFFSET ¤ò²Ã»»¤¹¤ë\n" +"\n" + +#: objdump.c:419 +msgid "Sections:\n" +msgstr "¥»¥¯¥·¥ç¥ó:\n" + +#: objdump.c:422 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "º÷°ú̾ ¥µ¥¤¥º VMA LMA File off Algn" + +#: objdump.c:424 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "º÷°ú̾ ¥µ¥¤¥º VMA LMA File off Algn" + +#: objdump.c:428 +msgid " Flags" +msgstr " ¥Õ¥é¥°" + +#: objdump.c:478 +#, c-format +msgid "%s: not a dynamic object" +msgstr "%s: ưŪ¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó" + +#: objdump.c:494 +#, c-format +msgid "%s: No dynamic symbols" +msgstr "%s: ưŪ¥·¥ó¥Ü¥ë¤Ï¤¢¤ê¤Þ¤»¤ó" + +#: objdump.c:1197 +msgid "Out of virtual memory" +msgstr "²¾ÁÛ¥á¥â¥ê¤¬Â­¤ê¤Þ¤»¤ó" + +#: objdump.c:1616 +#, c-format +msgid "Can't use supplied machine %s" +msgstr "Í¿¤¨¤é¤ì¤¿¥Þ¥·¥ó %s ¤ò»È¤¨¤Þ¤»¤ó" + +#: objdump.c:1634 +#, c-format +msgid "Can't disassemble for architecture %s\n" +msgstr "%s ¥¢¡¼¥­¥Æ¥¯¥Á¥ãÍѤˤϵե¢¥»¥ó¥Ö¥ë¤Ç¤­¤Þ¤»¤ó\n" + +#: objdump.c:1716 +#, c-format +msgid "Disassembly of section %s:\n" +msgstr "¥»¥¯¥·¥ç¥ó %s ¤ÎµÕ¥¢¥»¥ó¥Ö¥ë:\n" + +#: objdump.c:1890 +#, c-format +msgid "No %s section present\n\n" +msgstr "%s ¥»¥¯¥·¥ç¥ó¤¬¤¢¤ê¤Þ¤»¤ó\n\n" + +#: objdump.c:1897 +#, c-format +msgid "%s has no %s section" +msgstr "%s ¤Ë¤Ï %s ¥»¥¯¥·¥ç¥ó¤¬¤¢¤ê¤Þ¤»¤ó" + +#: objdump.c:1911 +#, c-format +msgid "Reading %s section of %s failed: %s" +msgstr "%s ¥»¥¯¥·¥ç¥ó (%s) ÆÉ¹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿: %s" + +#: objdump.c:1923 +#, c-format +msgid "Reading %s section of %s failed: %s\n" +msgstr "%s ¥»¥¯¥·¥ç¥ó (%s) ÆÉ¹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿: %s\n" + +#: objdump.c:1966 +#, c-format +msgid "Contents of %s section:\n\n" +msgstr "%s ¥»¥¯¥·¥ç¥ó¤ÎÆâÍÆ:\n\n" + +#: objdump.c:2066 +#, c-format +msgid "architecture: %s, " +msgstr "¥¢¡¼¥­¥Æ¥¯¥Á¥ã: %s, " + +#: objdump.c:2069 +#, c-format +msgid "flags 0x%08x:\n" +msgstr "¥Õ¥é¥° 0x%08x:\n" + +#: objdump.c:2082 +msgid "\nstart address 0x" +msgstr "\n³«»Ï¥¢¥É¥ì¥¹ 0x" + +#: objdump.c:2114 +#, c-format +msgid "\n%s: file format %s\n" +msgstr "\n%s: ¥Õ¥¡¥¤¥ë·Á¼° %s\n" + +#: objdump.c:2156 +#, c-format +msgid "%s: printing debugging information failed" +msgstr "%s: ¥Ç¥Ð¥Ã¥°¾ðÊó¤Î½ÐÎϤ˼ºÇÔ¤·¤Þ¤·¤¿" + +#: objdump.c:2233 +#, c-format +msgid "In archive %s:\n" +msgstr "½ñ¸Ë %s Æâ:\n" + +#: objdump.c:2285 +#, c-format +msgid "Contents of section %s:\n" +msgstr "¥»¥¯¥·¥ç¥ó %s ¤ÎÆâÍÆ:\n" + +#: objdump.c:2798 +#, c-format +msgid "BFD header file version %s\n" +msgstr "BFD ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¥Ð¡¼¥¸¥ç¥ó %s\n" + +#: objdump.c:2882 +msgid "unrecognized -E option" +msgstr "-E ¤Î¥ª¥×¥·¥ç¥ó¤òǧ¼±¤Ç¤­¤Þ¤»¤ó" + +#: objdump.c:2893 +#, c-format +msgid "unrecognized --endian type `%s'" +msgstr "--endian ¥¿¥¤¥× `%s' ¤òǧ¼±¤Ç¤­¤Þ¤»¤ó" + +#: rdcoff.c:205 +#, c-format +msgid "parse_coff_type: Bad type code 0x%x" +msgstr "parse_coff_type: ÉÔÀµ¤Ê¥¿¥¤¥×¥³¡¼¥É 0x%x" + +#: rdcoff.c:423 rdcoff.c:531 rdcoff.c:730 +#, c-format +msgid "bfd_coff_get_syment failed: %s" +msgstr "bfd_coff_get_syment ¤¬¼ºÇÔ¤·¤Þ¤·¤¿: %s" + +#: rdcoff.c:439 rdcoff.c:750 +#, c-format +msgid "bfd_coff_get_auxent failed: %s" +msgstr "bfd_coff_get_auxent ¤¬¼ºÇÔ¤·¤Þ¤·¤¿: %s" + +#: rdcoff.c:817 +#, c-format +msgid "%ld: .bf without preceding function" +msgstr "%ld: Á°Êý¤Ë´Ø¿ô¤¬¤Ê¤¤ .bf ¤¬¤¢¤ê¤Þ¤¹" + +#: rdcoff.c:867 +#, c-format +msgid "%ld: unexpected .ef\n" +msgstr "%ld: ͽ´ü¤·¤Ê¤¤ .ef ¤Ç¤¹\n" + +#: rddbg.c:87 +#, c-format +msgid "%s: no recognized debugging information" +msgstr "%s: ǧ¼±¤µ¤ì¤¿¥Ç¥Ð¥Ã¥°¾ðÊó¤Ï¤¢¤ê¤Þ¤»¤ó" + +#: rddbg.c:410 +msgid "Last stabs entries before error:\n" +msgstr "¥¨¥é¡¼¤ÎľÁ°¤Î¥¹¥¿¥Ö¥¨¥ó¥È¥ê:\n" + +#: readelf.c:260 +#, c-format +msgid "Unable to seek to start of %s at %x\n" +msgstr "%s ¤Î»ÏÅÀ¤Ø seek ¤Ç¤­¤Þ¤»¤ó(%x)\n" + +#: readelf.c:268 +#, c-format +msgid "Out of memory allocating %d bytes for %s\n" +msgstr "%d ¥Ð¥¤¥È¤Î¥á¥â¥ê³ÎÊݤ¬¤Ç¤­¤Þ¤»¤ó (%s)\n" + +#: readelf.c:274 +#, c-format +msgid "Unable to read in %d bytes of %s\n" +msgstr "%d ¥Ð¥¤¥È¤ÎÆÉ¹þ¤ß¤Ë¼ºÇÔ (%s)\n" + +#: readelf.c:284 +#, c-format +msgid "Unable to seek to %x for %s\n" +msgstr "%x ¤Ø seek ¤Ç¤­¤Þ¤»¤ó (%s)\n" + +#: readelf.c:289 +#, c-format +msgid "Unable to read data at %x for %s\n" +msgstr "%x ¤Ç¤Î¥Ç¡¼¥¿¤è¸«¹þ¤ß¤¬¤Ç¤­¤Þ¤»¤ó (%s)\n" + +#: readelf.c:304 readelf.c:330 +#, c-format +msgid "%s: Error: " +msgstr "%s: ¥¨¥é¡¼: " + +#: readelf.c:316 readelf.c:345 +#, c-format +msgid "%s: Warning: " +msgstr "%s: ·Ù¹ð: " + +#: readelf.c:395 readelf.c:533 +#, c-format +msgid "Unhandled data length: %d\n" +msgstr "¼è¤ê°·¤ï¤ì¤Ê¤«¤Ã¤¿¥Ç¡¼¥¿Ä¹: %d\n" + +#: readelf.c:597 +msgid "Don't know about relocations on this machine architecture\n" +msgstr "¤³¤Î¥Þ¥·¥ó¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤Ç¤ÎºÆÇÛÃ֤ˤĤ¤¤Æ²ò¤Ã¤Æ¤¤¤Þ¤»¤ó\n" + +#: readelf.c:637 readelf.c:666 readelf.c:698 readelf.c:726 +msgid "out of memory parsing relocs" +msgstr "ºÆÇÛÃ֥ǡ¼¥¿²òÀÏÃæ¤Ë¥á¥â¥êÉÔ­¤Ë´Ù¤ê¤Þ¤·¤¿" + +#: readelf.c:744 +msgid " Offset Info Type Symbol's Value Symbol's Name Addend\n" +msgstr " Offset ¾ðÊó ¥¿¥¤¥× ¥·¥ó¥Ü¥ë¤ÎÃÍ ¥·¥ó¥Ü¥ë̾ Addend\n" + +#: readelf.c:747 +msgid " Offset Info Type Symbol's Value Symbol's Name\n" +msgstr " Offset ¾ðÊó ¥¿¥¤¥× ¥·¥ó¥Ü¥ë¤ÎÃÍ ¥·¥ó¥Ü¥ë̾\n" + +#: readelf.c:907 readelf.c:909 +#, c-format +msgid "unrecognised: %-7lx" +msgstr "ǧ¼±¤Ç¤­¤Þ¤»¤ó: %-7lx" + +#: readelf.c:934 +#, c-format +msgid "" +msgstr "<ʸ»úÎ󥯡¼¥Ö¥ë¤Îº÷°ú %3ld>" + +#: readelf.c:1147 +#, c-format +msgid "Processor Specific: %lx" +msgstr "¥×¥í¥»¥Ã¥µ¸ÇÍ­: %lx" + +#: readelf.c:1166 +#, c-format +msgid "Operating System specific: %lx" +msgstr "¥ª¥Ú¥ì¡¼¥Æ¥£¥ó¥°¥·¥¹¥Æ¥à¸ÇÍ­: %lx" + +#: readelf.c:1169 readelf.c:1677 +#, c-format +msgid ": %lx" +msgstr "<ÉÔÌÀ>: %lx" + +#: readelf.c:1183 +msgid "NONE (None)" +msgstr "NONE (̵¤·)" + +#: readelf.c:1184 +msgid "REL (Relocatable file)" +msgstr "REL (ºÆÇÛÃÖ²Äǽ¥Õ¥¡¥¤¥ë)" + +#: readelf.c:1185 +msgid "EXEC (Executable file)" +msgstr "EXEC (¼Â¹Ô²Äǽ¥Õ¥¡¥¤¥ë)" + +#: readelf.c:1186 +msgid "DYN (Shared object file)" +msgstr "DYN (¶¦Í­¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë)" + +#: readelf.c:1187 +msgid "CORE (Core file)" +msgstr "CORE (¥³¥¢¥Õ¥¡¥¤¥ë)" + +#: readelf.c:1191 +#, c-format +msgid "Processor Specific: (%x)" +msgstr "¥×¥í¥»¥Ã¥µ¸ÇÍ­: (%x)" + +#: readelf.c:1193 +#, c-format +msgid "OS Specific: (%x)" +msgstr "OS ¸ÇÍ­: (%x)" + +#: readelf.c:1195 readelf.c:1281 readelf.c:1811 +#, c-format +msgid ": %x" +msgstr "<ÉÔÌÀ>: %x" + +#: readelf.c:1208 +msgid "None" +msgstr "¤Ê¤·" + +#: readelf.c:1849 +msgid "Usage: readelf {options} elf-file(s)\n" +msgstr "»È¤¤Êý: readelf {¥ª¥×¥·¥ç¥ó} elf¥Õ¥¡¥¤¥ë\n" + +#: readelf.c:1850 +msgid " Options are:\n" +msgstr " ¥ª¥×¥·¥ç¥ó:\n" + +#: readelf.c:1851 +msgid " -a or --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" +msgstr " -a Ëô¤Ï --all -h -l -S -s -r -d -V -A -I ¤ÈƱ¤¸\n" + +#: readelf.c:1852 +msgid " -h or --file-header Display the ELF file header\n" +msgstr " -h Ëô¤Ï --file-header ELF ¥Õ¥¡¥¤¥ë¥Ø¥Ã¥À¤òɽ¼¨¤¹¤ë\n" + +#: readelf.c:1853 +msgid " -l or --program-headers or --segments\n" +msgstr " -l Ëô¤Ï --program-headers Ëô¤Ï --segments\n" + +#: readelf.c:1854 +msgid " Display the program headers\n" +msgstr " ¥×¥í¥°¥é¥à¥Ø¥Ã¥À¤òɽ¼¨¤¹¤ë\n" + +#: readelf.c:1855 +msgid " -S or --section-headers or --sections\n" +msgstr " -S Ëô¤Ï --section-headers Ëô¤Ï --sections\n" + +#: readelf.c:1856 +msgid " Display the sections' header\n" +msgstr " ¥»¥¯¥·¥ç¥ó¤Î¥Ø¥Ã¥À¤òɽ¼¨¤¹¤ë\n" + +#: readelf.c:1857 +msgid " -e or --headers Equivalent to: -h -l -S\n" +msgstr " -e Ëô¤Ï --headers -h -l -S ¤ÈƱ¤¸\n" + +#: readelf.c:1858 +msgid " -s or --syms or --symbols Display the symbol table\n" +msgstr " -s Ëô¤Ï --syms Ëô¤Ï --symbols ¥·¥ó¥Ü¥ë¥Æ¡¼¥Ö¥ë¤òɽ¼¨¤¹¤ë\n" + +#: readelf.c:1859 +msgid " -n or --notes Display the core notes (if present)\n" +msgstr " -n Ëô¤Ï --notes ¥³¥¢ note ¥»¥°¥á¥ó¥È¤¬¤¢¤ì¤Ðɽ¼¨¤¹¤ë\n" + +#: readelf.c:1860 +msgid " -r or --relocs Display the relocations (if present)\n" +msgstr " -r Ëô¤Ï --relocs ºÆÇÛÃÖ¥»¥¯¥·¥ç¥ó¤¬¤¢¤ì¤Ðɽ¼¨¤¹¤ë\n" + +#: readelf.c:1861 +msgid " -d or --dynamic Display the dynamic segment (if present)\n" +msgstr " -d Ëô¤Ï --dynamic ưŪ¥»¥°¥á¥ó¥È¤¬¤¢¤ì¤Ðɽ¼¨¤¹¤ë\n" + +#: readelf.c:1862 +msgid " -V or --version-info Display the version sections (if present)\n" +msgstr " -V Ëô¤Ï --version-info ¥Ð¡¼¥¸¥ç¥ó¥»¥¯¥·¥ç¥ó¤¬¤¢¤ì¤Ðɽ¼¨¤¹¤ë\n" + +#: readelf.c:1863 +msgid " -A or --arch-specific Display architecture specific information (if any).\n" +msgstr " -A Ëô¤Ï --arch-specific ¥¢¡¼¥­¥Æ¥¯¥Á¥ã¸ÇÍ­¾ðÊ󤬤¢¤ì¤Ðɽ¼¨¤¹¤ë\n" + +#: readelf.c:1864 +msgid " -D or --use-dynamic Use the dynamic section info when displaying symbols\n" +msgstr " -D Ëô¤Ï --use-dynamic ¥·¥ó¥Ü¥ëɽ¼¨¤ËưŪ¥»¥¯¥·¥ç¥ó¾ðÊó¤ò»ÈÍѤ¹¤ë\n" + +#: readelf.c:1865 +msgid " -x or --hex-dump=\n" +msgstr " -x <ÈÖ¹æ> Ëô¤Ï --hex-dump=<ÈÖ¹æ>\n" + +#: readelf.c:1866 +msgid " Dump the contents of section \n" +msgstr " ¥»¥¯¥·¥ç¥ó <ÈÖ¹æ> ¤ÎÆâÍÆ¤ò¥À¥ó¥×¤¹¤ë\n" + +#: readelf.c:1867 +msgid " -w[liaprf] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=frames]\n" +msgstr " -w[liaprf] Ëô¤Ï --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=frames]\n" + +#: readelf.c:1868 +msgid " Display the contents of DWARF2 debug sections\n" +msgstr " DWARF2 ¥Ç¥Ð¥Ã¥°¥»¥¯¥·¥ç¥ó¤ÎÆâÍÆ¤òɽ¼¨¤¹¤ë\n" + +#: readelf.c:1870 +msgid " -i or --instruction-dump=\n" +msgstr " -i <ÈÖ¹æ> or --instruction-dump=<ÈÖ¹æ>\n" + +#: readelf.c:1871 +msgid " Disassemble the contents of section \n" +msgstr " ¥»¥¯¥·¥ç¥ó <ÈÖ¹æ> ¤ÎÆâÍÆ¤òµÕ¥¢¥»¥ó¥Ö¥ë¤¹¤ë\n" + +#: readelf.c:1873 +msgid " -I or --histogram Display histogram of bucket list lengths\n" +msgstr " -I Ëô¤Ï --histogram ¥Ð¥±¥Ã¥È¥ê¥¹¥ÈŤÎÅÙ¿ôʬÉÛ¤òɽ¼¨¤¹¤ë\n" + +#: readelf.c:1874 +msgid " -v or --version Display the version number of readelf\n" +msgstr " -v Ëô¤Ï --version readelf ¤Î¥Ð¡¼¥¸¥ç¥óÈÖ¹æ¤òɽ¼¨¤¹¤ë\n" + +#: readelf.c:1875 +msgid " -H or --help Display this information\n" +msgstr " -H Ëô¤Ï --help ¤³¤Î»È¤¤Êý¤òɽ¼¨¤¹¤ë\n" + +#: readelf.c:1893 +msgid "Out of memory allocating dump request table." +msgstr "Í׵ᤵ¤ì¤¿¥Æ¡¼¥Ö¥ë¤Î¥À¥ó¥×Ãæ¤Ë¥á¥â¥ê³ÎÊݤ¬¼ºÇÔ¤·¤Þ¤·¤¿¡£" + +#: readelf.c:2033 +#, c-format +msgid "Unrecognised debug option '%s'\n" +msgstr "¥Ç¥Ð¥Ã¥°¥ª¥×¥·¥ç¥ó '%s' ¤òǧ¼±¤Ç¤­¤Þ¤»¤ó\n" + +#: readelf.c:2058 +#, c-format +msgid "Invalid option '-%c'\n" +msgstr "¥ª¥×¥·¥ç¥ó '-%c' ¤¬ÉÔŬÀڤǤ¹\n" + +#: readelf.c:2071 +msgid "Nothing to do.\n" +msgstr "¹Ô¤Ê¤¦¤Ù¤­»ö¤Ï¤¢¤ê¤Þ¤»¤ó¡£\n" + +#: readelf.c:2084 readelf.c:2101 readelf.c:3740 +msgid "none" +msgstr "¤Ê¤·" + +#: readelf.c:2085 +msgid "ELF32" +msgstr "ELF32" + +#: readelf.c:2086 +msgid "ELF64" +msgstr "ELF64" + +#: readelf.c:2088 readelf.c:2105 readelf.c:2133 +#, c-format +msgid "" +msgstr "<ÉÔÌÀ: %x>" + +#: readelf.c:2102 +msgid "2's complement, little endian" +msgstr "2 ¤ÎÊä¿ô¡¢¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó" + +#: readelf.c:2103 +msgid "2's complement, big endian" +msgstr "2 ¤ÎÊä¿ô¡¢¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó" + +#: readelf.c:2118 +msgid "UNIX - System V" +msgstr "UNIX - System V" + +#: readelf.c:2119 +msgid "UNIX - HP-UX" +msgstr "UNIX - HP-UX" + +#: readelf.c:2120 +msgid "UNIX - NetBSD" +msgstr "UNIX - NetBSD" + +#: readelf.c:2121 +msgid "UNIX - Linux" +msgstr "UNIX - Linux" + +#: readelf.c:2122 +msgid "GNU/Hurd" +msgstr "GNU/Hurd" + +#: readelf.c:2123 +msgid "UNIX - Solaris" +msgstr "UNIX - Solaris" + +#: readelf.c:2124 +msgid "UNIX - AIX" +msgstr "UNIX - AIX" + +#: readelf.c:2125 +msgid "UNIX - IRIX" +msgstr "UNIX - IRIX" + +#: readelf.c:2126 +msgid "UNIX - FreeBSD" +msgstr "UNIX - FreeBSD" + +#: readelf.c:2127 +msgid "UNIX - TRU64" +msgstr "UNIX - TRU64" + +#: readelf.c:2128 +msgid "Novell - Modesto" +msgstr "Novell - Modesto" + +#: readelf.c:2129 +msgid "UNIX - OpenBSD" +msgstr "UNIX - OpenBSD" + +#: readelf.c:2130 +msgid "Standalone App" +msgstr "Standalone App" + +#: readelf.c:2131 +msgid "ARM" +msgstr "ARM" + +#: readelf.c:2148 +msgid "Not an ELF file - it has the wrong magic bytes at the start\n" +msgstr "ELF ¥Õ¥¡¥¤¥ë¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó - »ÏÅÀ¤Ë¤¢¤ë¥Þ¥¸¥Ã¥¯Èֹ椬°Û¤Ê¤ê¤Þ¤¹\n" + +#: readelf.c:2156 +msgid "ELF Header:\n" +msgstr "ELF ¥Ø¥Ã¥À:\n" + +#: readelf.c:2157 +msgid " Magic: " +msgstr " ¥Þ¥¸¥Ã¥¯: " + +#: readelf.c:2161 +#, c-format +msgid " Class: %s\n" +msgstr " ¥¯¥é¥¹: %s\n" + +#: readelf.c:2163 +#, c-format +msgid " Data: %s\n" +msgstr " ¥Ç¡¼¥¿: %s\n" + +#: readelf.c:2165 +#, c-format +msgid " Version: %d %s\n" +msgstr " ¥Ð¡¼¥¸¥ç¥ó: %d %s\n" + +#: readelf.c:2172 +#, c-format +msgid " OS/ABI: %s\n" +msgstr " OS/ABI: %s\n" + +#: readelf.c:2174 +#, c-format +msgid " ABI Version: %d\n" +msgstr " ABI ¥Ð¡¼¥¸¥ç¥ó: %d\n" + +#: readelf.c:2176 +#, c-format +msgid " Type: %s\n" +msgstr " ¥¿¥¤¥×: %s\n" + +#: readelf.c:2178 +#, c-format +msgid " Machine: %s\n" +msgstr " ¥Þ¥·¥ó: %s\n" + +#: readelf.c:2180 +#, c-format +msgid " Version: 0x%lx\n" +msgstr " ¥Ð¡¼¥¸¥ç¥ó: 0x%lx\n" + +#: readelf.c:2183 +msgid " Entry point address: " +msgstr " ¥¨¥ó¥È¥ê¥Ý¥¤¥ó¥È¥¢¥É¥ì¥¹: " + +#: readelf.c:2185 +msgid "\n Start of program headers: " +msgstr "\n ¥×¥í¥°¥é¥à¤Î³«»Ï¥Ø¥Ã¥À: " + +#: readelf.c:2187 +msgid "" +" (bytes into file)\n" +" Start of section headers: " +msgstr "" +" (¥Ð¥¤¥È)\n" +" ¥»¥¯¥·¥ç¥ó¥Ø¥Ã¥À»ÏÅÀ: " + +#: readelf.c:2189 +msgid " (bytes into file)\n" +msgstr " (¥Ð¥¤¥È)\n" + +#: readelf.c:2191 +#, c-format +msgid " Flags: 0x%lx%s\n" +msgstr " ¥Õ¥é¥°: 0x%lx%s\n" + +#: readelf.c:2194 +#, c-format +msgid " Size of this header: %ld (bytes)\n" +msgstr " ¤³¤Î¥Ø¥Ã¥À¤Î¥µ¥¤¥º: %ld (¥Ð¥¤¥È)\n" + +#: readelf.c:2196 +#, c-format +msgid " Size of program headers: %ld (bytes)\n" +msgstr " ¥×¥í¥°¥é¥à¥Ø¥Ã¥À¥µ¥¤¥º: %ld (¥Ð¥¤¥È)\n" + +#: readelf.c:2198 +#, c-format +msgid " Number of program headers: %ld\n" +msgstr " ¥×¥í¥°¥é¥à¥Ø¥Ã¥À¿ô: %ld\n" + +#: readelf.c:2200 +#, c-format +msgid " Size of section headers: %ld (bytes)\n" +msgstr " ¥»¥¯¥·¥ç¥ó¥Ø¥Ã¥À: %ld (¥Ð¥¤¥È)\n" + +#: readelf.c:2202 +#, c-format +msgid " Number of section headers: %ld\n" +msgstr " ¥»¥¯¥·¥ç¥ó¥Ø¥Ã¥À¥µ¥¤¥º: %ld\n" + +#: readelf.c:2204 +#, c-format +msgid " Section header string table index: %ld\n" +msgstr " ¥»¥¯¥·¥ç¥ó¥Ø¥Ã¥Àʸ»úÎ󥯡¼¥Ö¥ëº÷°ú:%ld\n" + +#: readelf.c:2289 +msgid "\nThere are no program headers in this file.\n" +msgstr "\n¤³¤Î¥Õ¥¡¥¤¥ë¤Ë¤Ï¥×¥í¥°¥é¥à¥Ø¥Ã¥À¤Ï¤¢¤ê¤Þ¤»¤ó¡£\n" + +#: readelf.c:2295 +#, c-format +msgid "\nElf file type is %s\n" +msgstr "\nElf ¥Õ¥¡¥¤¥ë¥¿¥¤¥×¤Ï %s ¤Ç¤¹\n" + +#: readelf.c:2296 +msgid "Entry point " +msgstr "¥¨¥ó¥È¥ê¥Ý¥¤¥ó¥È " + +#: readelf.c:2298 +#, c-format +msgid "\nThere are %d program headers, starting at offset " +msgstr "\n%d ¸Ä¤Î¥×¥í¥°¥é¥à¥Ø¥Ã¥À¡¢»ÏÅÀ¥ª¥Õ¥»¥Ã¥È " + +#: readelf.c:2309 readelf.c:2485 readelf.c:2527 readelf.c:2570 readelf.c:2611 +#: readelf.c:3133 readelf.c:3174 readelf.c:3350 readelf.c:4358 readelf.c:4372 +#: readelf.c:7741 readelf.c:7781 +msgid "Out of memory\n" +msgstr "¥á¥â¥ê¤¬Â­¤ê¤Þ¤»¤ó\n" + +#: readelf.c:2327 +#, c-format +msgid "\nProgram Header%s:\n" +msgstr "\n¥×¥í¥°¥é¥à¥Ø¥Ã¥À%.0s:\n" + +#: readelf.c:2331 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr " ¥¿¥¤¥× ¥ª¥Õ¥»¥Ã¥È ²¾ÁÛAddr ʪÍýAddr FileSiz MemSiz Flg Align\n" + +#: readelf.c:2335 +msgid " Type Offset VirtAddr PhysAddr\n" +msgstr " ¥¿¥¤¥× ¥ª¥Õ¥»¥Ã¥È ²¾ÁÛAddr ʪÍýAddr\n" + +#: readelf.c:2337 +msgid " FileSiz MemSiz Flags Align\n" +msgstr " ¥Õ¥¡¥¤¥ë¥µ¥¤¥º ¥á¥â¥ê¥µ¥¤¥º ¥Õ¥é¥° ¥¢¥é¥¤¥ó\n" + +#: readelf.c:2395 +msgid "more than one dynamic segment\n" +msgstr "Ê£¿ô¤ÎưŪ¥»¥°¥á¥ó¥È\n" + +#: readelf.c:2403 +msgid "Unable to find program interpreter name\n" +msgstr "¥×¥í¥°¥é¥à¥¤¥ó¥¿¥×¥ê¥¿Ì¾¤Ï¸«¤Ä¤«¤ê¤Þ¤»¤ó\n" + +#: readelf.c:2410 +#, c-format +msgid "\n [Requesting program interpreter: %s]" +msgstr "\n [Í׵ᤵ¤ì¤ë¥×¥í¥°¥é¥à¥¤¥ó¥¿¥×¥ê¥¿: %s]" + +#: readelf.c:2428 +msgid "\n Section to Segment mapping:\n" +msgstr "\n ¥»¥°¥á¥ó¥È¥Þ¥Ã¥Ô¥ó¥°¤Ø¤Î¥»¥¯¥·¥ç¥ó:\n" + +#: readelf.c:2429 +msgid " Segment Sections...\n" +msgstr " ¥»¥°¥á¥ó¥È¥»¥¯¥·¥ç¥ó...\n" + +#: readelf.c:2693 +msgid "\nThere are no sections in this file.\n" +msgstr "\n¤³¤Î¥Õ¥¡¥¤¥ë¤Ë¤Ï¥»¥¯¥·¥ç¥ó¤¬¤¢¤ê¤Þ¤»¤ó¡£\n" + +#: readelf.c:2699 +#, c-format +msgid "There are %d section headers, starting at offset 0x%lx:\n" +msgstr "%d ¸Ä¤Î¥»¥¯¥·¥ç¥ó¥Ø¥Ã¥À¡¢»ÏÅÀ¥ª¥Õ¥»¥Ã¥È 0x%lx:\n" + +#: readelf.c:2739 +msgid "File contains multiple dynamic symbol tables\n" +msgstr "¥Õ¥¡¥¤¥ë¤¬Ê£¿ô¤ÎưŪ¥·¥ó¥Ü¥ë¥Æ¡¼¥Ö¥ë¤ò´Þ¤ó¤Ç¤¤¤Þ¤¹\n" + +#: readelf.c:2752 +msgid "File contains multiple dynamic string tables\n" +msgstr "¥Õ¥¡¥¤¥ë¤¬Ê£¿ô¤ÎưŪʸ»úÎ󥯡¼¥Ö¥ë¤ò´Þ¤ó¤Ç¤¤¤Þ¤¹\n" + +#: readelf.c:2786 +#, c-format +msgid "\nSection Header%s:\n" +msgstr "\n¥»¥¯¥·¥ç¥ó¥Ø¥Ã¥À%.0s:\n" + +#: readelf.c:2790 +msgid " [Nr] Name Type Addr Off Size ES Flg Lk Inf Al\n" +msgstr " [ÈÖ] ̾Á° ¥¿¥¤¥× ¥¢¥É¥ì¥¹ Off ¥µ¥¤¥º ES Flg Lk Inf Al\n" + +#: readelf.c:2793 +msgid " [Nr] Name Type Address Offset\n" +msgstr " [ÈÖ] ̾Á° ¥¿¥¤¥× ¥¢¥É¥ì¥¹ Offset\n" + +#: readelf.c:2794 +msgid " Size EntSize Flags Link Info Align\n" +msgstr " ¥µ¥¤¥º EntSize ¥Õ¥é¥° Link Info Align\n" + +#: readelf.c:2841 +msgid "Key to Flags:\n" +msgstr "¥Õ¥é¥°¤Î¥­¡¼:\n" + +#: readelf.c:2842 +msgid " W (write), A (alloc), X (execute), M (merge), S (strings)\n" +msgstr " W (write), A (alloc), X (execute), M (merge), S (strings)\n" + +#: readelf.c:2843 +msgid " I (info), L (link order), G (group), x (unknown)\n" +msgstr " I (info), L (link order), G (group), x (ÉÔÌÀ)\n" + +#: readelf.c:2844 +msgid " O (extra OS processing required) o (OS specific), p (processor specific)\n" +msgstr " O (OS ¤ÎÆÃ¼ì½èÍý¤ËɬÍ×) o (OS ¸ÇÍ­), p (processor ¸ÇÍ­)\n" + +#: readelf.c:2902 +#, c-format +msgid "\nRelocation section at offset 0x%lx contains %ld bytes:\n" +msgstr "\n¥ª¥Õ¥»¥Ã¥È 0x%lx ¤ÎºÆÇÛÃÖ¥»¥¯¥·¥ç¥ó¤Ï %ld ¥Ð¥¤¥È¤Ç¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹:\n" + +#: readelf.c:2909 +msgid "\nThere are no dynamic relocations in this file.\n" +msgstr "\n¤³¤Î¥Õ¥¡¥¤¥ë¤Ë¤ÏưŪºÆÇÛÃÖ¤¬¤¢¤ê¤Þ¤»¤ó¡£\n" + +#: readelf.c:2937 +msgid "\nRelocation section " +msgstr "\nºÆÇÛÃÖ¥»¥¯¥·¥ç¥ó " + +#: readelf.c:2944 +#, c-format +msgid " at offset 0x%lx contains %lu entries:\n" +msgstr " (¥ª¥Õ¥»¥Ã¥È 0x%lx) ¤Ï %lu ¸Ä¤Î¥¨¥ó¥È¥ê¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹:\n" + +#: readelf.c:2972 +msgid "\nThere are no relocations in this file.\n" +msgstr "\n¤³¤Î¥Õ¥¡¥¤¥ë¤Ë¤ÏºÆÇÛÃÖ¤µ¤ì¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤»¤ó¡£\n" + +#: readelf.c:3227 +msgid "\nThere is no dynamic segment in this file.\n" +msgstr "\n¤³¤Î¥Õ¥¡¥¤¥ë¤Ë¤ÏưŪ¥»¥°¥á¥ó¥È¤¬¤¢¤ê¤Þ¤»¤ó¡£\n" + +#: readelf.c:3261 +msgid "Unable to seek to end of file!" +msgstr "¥Õ¥¡¥¤¥ëËöÈø¤Ë seek ¤Ç¤­¤Þ¤»¤ó!" + +#: readelf.c:3270 +msgid "Unable to determine the number of symbols to load\n" +msgstr "¥í¡¼¥É¤¹¤Ù¤­¥·¥ó¥Ü¥ë¤Î¿ô¤ò·èÄê¤Ç¤­¤Þ¤»¤ó\n" + +#: readelf.c:3300 +msgid "Unable to seek to end of file\n" +msgstr "¥Õ¥¡¥¤¥ëËöÈø¤Ë seek ¤Ç¤­¤Þ¤»¤ó\n" + +#: readelf.c:3306 +msgid "Unable to determine the length of the dynamic string table\n" +msgstr "ưŪʸ»úÎ󥯡¼¥Ö¥ë¤ÎŤµ¤ò·èÄê¤Ç¤­¤Þ¤»¤ó\n" + +#: readelf.c:3367 +#, c-format +msgid "\nDynamic segment at offset 0x%x contains %ld entries:\n" +msgstr "\n¥ª¥Õ¥»¥Ã¥È 0x%x ¤ÎưŪ¥»¥°¥á¥ó¥È¤Ï %ld ¸Ä¤Î¥¨¥ó¥È¥ê¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹:\n" + +#: readelf.c:3370 +msgid " Tag Type Name/Value\n" +msgstr " ¥¿¥° ¥¿¥¤¥× ̾Á°/ÃÍ\n" + +#: readelf.c:3406 +msgid "Auxiliary library" +msgstr "Êä½õ¥é¥¤¥Ö¥é¥ê" + +#: readelf.c:3410 +msgid "Filter library" +msgstr "¥Õ¥£¥ë¥¿¥é¥¤¥Ö¥é¥ê" + +#: readelf.c:3414 +msgid "Configuration file" +msgstr "ÀßÄê¥Õ¥¡¥¤¥ë" + +#: readelf.c:3418 +msgid "Dependency audit library" +msgstr "°Í¸´Ø·¸´Æºº¥é¥¤¥Ö¥é¥ê" + +#: readelf.c:3422 +msgid "Audit library" +msgstr "´Æºº¥é¥¤¥Ö¥é¥ê" + +#: readelf.c:3440 readelf.c:3466 readelf.c:3492 +msgid "Flags:" +msgstr "¥Õ¥é¥°:" + +#: readelf.c:3442 readelf.c:3468 readelf.c:3494 +msgid " None\n" +msgstr " ̵¤·\n" + +#: readelf.c:3613 +#, c-format +msgid "Shared library: [%s]" +msgstr "¶¦Í­¥é¥¤¥Ö¥é¥ê: [%s]" + +#: readelf.c:3616 +msgid " program interpreter" +msgstr " ¥×¥í¥°¥é¥à¥¤¥ó¥¿¥×¥ê¥¿" + +#: readelf.c:3620 +#, c-format +msgid "Library soname: [%s]" +msgstr "¥é¥¤¥Ö¥é¥ê¤Î soname: [%s]" + +#: readelf.c:3624 +#, c-format +msgid "Library rpath: [%s]" +msgstr "¥é¥¤¥Ö¥é¥ê¤Î rpath: [%s]" + +#: readelf.c:3628 +#, c-format +msgid "Library runpath: [%s]" +msgstr "¥é¥¤¥Ö¥é¥ê¤Î runpath: [%s]" + +#: readelf.c:3689 +#, c-format +msgid "Not needed object: [%s]\n" +msgstr "ÉÔÍפʥª¥Ö¥¸¥§¥¯¥È: [%s]\n" + +#: readelf.c:3786 +#, c-format +msgid "\nVersion definition section '%s' contains %ld entries:\n" +msgstr "\n¥Ð¡¼¥¸¥ç¥óÄêµÁ¥»¥¯¥·¥ç¥ó '%s' ¤Ï %ld ¸Ä¤Î¥¨¥ó¥È¥ê¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹:\n" + +#: readelf.c:3789 +msgid " Addr: 0x" +msgstr " ¥¢¥É¥ì¥¹: 0x" + +#: readelf.c:3791 readelf.c:3979 +#, c-format +msgid " Offset: %#08lx Link: %lx (%s)\n" +msgstr " ¥ª¥Õ¥»¥Ã¥È: %#08lx ¥ê¥ó¥¯: %lx (%s)\n" + +#: readelf.c:3821 +#, c-format +msgid " %#06x: Rev: %d Flags: %s" +msgstr " %#06x: Rev: %d ¥Õ¥é¥°: %s" + +#: readelf.c:3824 +#, c-format +msgid " Index: %d Cnt: %d " +msgstr " º÷°ú: %d Cnt: %d " + +#: readelf.c:3835 +#, c-format +msgid "Name: %s\n" +msgstr "̾Á°: %s\n" + +#: readelf.c:3837 +#, c-format +msgid "Name index: %ld\n" +msgstr "̾Á°º÷°ú: %ld\n" + +#: readelf.c:3852 +#, c-format +msgid " %#06x: Parent %d: %s\n" +msgstr " %#06x: ¿Æ %d: %s\n" + +#: readelf.c:3855 +#, c-format +msgid " %#06x: Parent %d, name index: %ld\n" +msgstr " %#06x: ¿Æ %d, ̾Á°º÷°ú: %ld\n" + +#: readelf.c:3874 +#, c-format +msgid "\nVersion needs section '%s' contains %ld entries:\n" +msgstr "\nɬÍץС¼¥¸¥ç¥ó¥»¥¯¥·¥ç¥ó '%s' ¤Ï %ld ¸Ä¤Î¥¨¥ó¥È¥ê¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹:\n" + +#: readelf.c:3877 +msgid " Addr: 0x" +msgstr " ¥¢¥É¥ì¥¹: 0x" + +#: readelf.c:3879 +#, c-format +msgid " Offset: %#08lx Link to section: %ld (%s)\n" +msgstr " Offset: %#08lx ¥»¥¯¥·¥ç¥ó¤Ø¤Î¥ê¥ó¥¯: %ld (%s)\n" + +#: readelf.c:3905 +#, c-format +msgid " %#06x: Version: %d" +msgstr " %#06x: ¥Ð¡¼¥¸¥ç¥ó: %d" + +#: readelf.c:3908 +#, c-format +msgid " File: %s" +msgstr " ¥Õ¥¡¥¤¥ë: %s" + +#: readelf.c:3910 +#, c-format +msgid " File: %lx" +msgstr " ¥Õ¥¡¥¤¥ë: %lx" + +#: readelf.c:3912 +#, c-format +msgid " Cnt: %d\n" +msgstr " ¸Ä¿ô: %d\n" + +#: readelf.c:3930 +#, c-format +msgid " %#06x: Name: %s" +msgstr " %#06x: ̾Á°: %s" + +#: readelf.c:3933 +#, c-format +msgid " %#06x: Name index: %lx" +msgstr " %#06x: ̾Á°º÷°ú: %lx" + +#: readelf.c:3936 +#, c-format +msgid " Flags: %s Version: %d\n" +msgstr " ¥Õ¥é¥°: %s ¥Ð¡¼¥¸¥ç¥ó: %d\n" + +#: readelf.c:3974 +#, c-format +msgid "\nVersion symbols section '%s' contains %d entries:\n" +msgstr "\n¥Ð¡¼¥¸¥ç¥ó¥·¥ó¥Ü¥ë¥»¥¯¥·¥ç¥ó '%s' ¤Ï %d ¸Ä¤Î¥¨¥ó¥È¥ê¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹:\n" + +#: readelf.c:3977 +msgid " Addr: " +msgstr " ¥¢¥É¥ì¥¹: " + +#: readelf.c:4007 +msgid " 0 (*local*) " +msgstr " 0 (*¶É ½ê*) " + +#: readelf.c:4011 +msgid " 1 (*global*) " +msgstr " 1 (*Âç °è*) " + +#: readelf.c:4233 +msgid "\nNo version information found in this file.\n" +msgstr "\n¤³¤Î¥Õ¥¡¥¤¥ë¤«¤é¤Ï¥Ð¡¼¥¸¥ç¥ó¾ðÊ󤬸«¤Ä¤«¤ê¤Þ¤»¤ó¡£\n" + +#: readelf.c:4251 readelf.c:4286 +#, c-format +msgid ": %d" +msgstr "<¥×¥í¥»¥Ã¥µ¸ÇÍ­>: %d" + +#: readelf.c:4253 readelf.c:4298 +#, c-format +msgid ": %d" +msgstr ": %d" + +#: readelf.c:4255 readelf.c:4301 +#, c-format +msgid ": %d" +msgstr "<ÉÔÌÀ>: %d" + +#: readelf.c:4364 +msgid "Unable to read in dynamic data\n" +msgstr "ưŪ¥Ç¡¼¥¿¤òÆÉ¹þ¤á¤Þ¤»¤ó\n" + +#: readelf.c:4406 +msgid "Unable to seek to start of dynamic information" +msgstr "ưŪ¾ðÊó¤Î³«»Ï°ÌÃÖ¤Ë seek ¤Ç¤­¤Þ¤»¤ó" + +#: readelf.c:4412 +msgid "Failed to read in number of buckets\n" +msgstr "¥Ð¥±¥Ã¥È¿ô¤ÎÆÉ¹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿\n" + +#: readelf.c:4418 +msgid "Failed to read in number of chains\n" +msgstr "¥Á¥§¥¤¥ó¿ô¤ÎÆÉ¹þ¤ß¤Ë¼ºÇÔ¤·¤Þ¤·¤¿\n" + +#: readelf.c:4438 +msgid "\nSymbol table for image:\n" +msgstr "\n¥¤¥á¡¼¥¸¤Î¥·¥ó¥Ü¥ë¥Æ¡¼¥Ö¥ë:\n" + +#: readelf.c:4440 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " bucket¿ô: ÃÍ ¥µ¥¤¥º ¥¿¥¤¥× Bind Vis º÷°ú̾\n" + +#: readelf.c:4442 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " bucket¿ô: ÃÍ ¥µ¥¤¥º ¥¿¥¤¥× Bind Vis º÷°ú̾\n" + +#: readelf.c:4486 +#, c-format +msgid "\nSymbol table '%s' contains %lu entries:\n" +msgstr "\n¥·¥ó¥Ü¥ë¥Æ¡¼¥Ö¥ë '%s' ¤Ï %lu ¸Ä¤Î¥¨¥ó¥È¥ê¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹:\n" + +#: readelf.c:4490 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " ÈÖ¹æ: ÃÍ ¥µ¥¤¥º ¥¿¥¤¥× Bind Vis º÷°ú̾\n" + +#: readelf.c:4492 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " ÈÖ¹æ: ÃÍ ¥µ¥¤¥º ¥¿¥¤¥× Bind Vis º÷°ú̾\n" + +#: readelf.c:4601 +msgid "bad dynamic symbol" +msgstr "ÉÔÀµ¤ÊưŪ¥·¥ó¥Ü¥ë¤Ç¤¹" + +#: readelf.c:4660 +msgid "\nDynamic symbol information is not available for displaying symbols.\n" +msgstr "\nưŪ¥·¥ó¥Ü¥ë¾ðÊó¤Ïɽ¼¨ÍÑ¥·¥ó¥Ü¥ë¤È¤·¤Æ¤ÏÍøÍѤǤ­¤Þ¤»¤ó¡£\n" + +#: readelf.c:4672 +#, c-format +msgid "\nHistogram for bucket list length (total of %d buckets):\n" +msgstr "\n¥Ð¥±¥Ã¥È¥ê¥¹¥È¤ÎÅÙ¿ôʬÉÛ (Á´ %d ¸Ä¤Î¥Ð¥±¥Ã¥È):\n" + +#: readelf.c:4674 +msgid " Length Number %% of total Coverage\n" +msgstr " Ťµ ¸Ä¿ô ÀêͭΨ ÈϰÏ\n" + +#: readelf.c:4679 readelf.c:4698 readelf.c:7423 readelf.c:7616 +msgid "Out of memory" +msgstr "¥á¥â¥ê¤¬Â­¤ê¤Þ¤»¤ó" + +#: readelf.c:4747 +#, c-format +msgid "\nDynamic info segment at offset 0x%lx contains %d entries:\n" +msgstr "\n¥ª¥Õ¥»¥Ã¥È 0x%lx ¤ÎưŪ¾ðÊ󥻥°¥á¥ó¥È¤Ï %d ¸Ä¤Î¥¨¥ó¥È¥ê¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹:\n" + +#: readelf.c:4750 +msgid " Num: Name BoundTo Flags\n" +msgstr "ÈÖ¹æ: ̾Á° ¶­³¦¤Þ¤Ç ¥Õ¥é¥°\n" + +#: readelf.c:4798 +#, c-format +msgid "\nAssembly dump of section %s\n" +msgstr "\n¥»¥¯¥·¥ç¥ó %s ¤Î¥¢¥»¥ó¥Ö¥ê¥À¥ó¥×\n" + +#: readelf.c:4821 +#, c-format +msgid "\nSection '%s' has no data to dump.\n" +msgstr "\n¥»¥¯¥·¥ç¥ó '%s' ¤Ï¥À¥ó¥×¤Ç¤­¤ë¥Ç¡¼¥¿¤ò»ý¤Ã¤Æ¤¤¤Þ¤»¤ó¡£\n" + +#: readelf.c:4826 +#, c-format +msgid "\nHex dump of section '%s':\n" +msgstr "\n¥»¥¯¥·¥ç¥ó '%s' ¤Î 16 ¿Ê¿ô¥À¥ó¥×:\n" + +#: readelf.c:4978 +msgid "badly formed extended line op encountered!" +msgstr "ÉÔÀµ¤Ê·Á¼°¤Î³ÈÄ¥ line ¥ª¥Ú¥³¡¼¥É¤ËÁø¶ø¤·¤Þ¤·¤¿!" + +#: readelf.c:4985 +#, c-format +msgid " Extended opcode %d: " +msgstr " ³ÈÄ¥¥ª¥Ú¥³¡¼¥É %d: " + +#: readelf.c:4990 +msgid "End of Sequence\n\n" +msgstr "Îó¤Î½ª¤ê\n\n" + +#: readelf.c:4996 +#, c-format +msgid "set Address to 0x%lx\n" +msgstr "ÀßÄꥢ¥É¥ì¥¹ 0x%lx\n" + +#: readelf.c:5001 +msgid " define new File Table entry\n" +msgstr " ¿·¤¿¤Ê¥Õ¥¡¥¤¥ë¥Æ¡¼¥Ö¥ë¥¨¥ó¥È¥ê¤ÎÄêµÁ\n" + +#: readelf.c:5002 readelf.c:5124 +msgid " Entry\tDir\tTime\tSize\tName\n" +msgstr " Entry\tDir\t»þ¹ï\t¥µ¥¤¥º\t̾Á°\n" + +#: readelf.c:5004 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:5007 readelf.c:5009 readelf.c:5011 readelf.c:5136 readelf.c:5138 +#: readelf.c:5140 +#, c-format +msgid "%lu\t" +msgstr "%lu\t" + +#: readelf.c:5012 +#, c-format +msgid "%s\n\n" +msgstr "%s\n\n" + +#: readelf.c:5016 +#, c-format +msgid "UNKNOWN: length %d\n" +msgstr "UNKNOWN: Ťµ %d\n" + +#: readelf.c:5042 +#, c-format +msgid "\nDump of debug contents of section %s:\n\n" +msgstr "\n¥»¥¯¥·¥ç¥óÆâÍÆ¤Î¥Ç¥Ð¥Ã¥°¥À¥ó¥× %s:\n\n" + +#: readelf.c:5054 +msgid "The line info appears to be corrupt - the section is too small\n" +msgstr "line ¾ðÊó¤Ï²õ¤ì¤Æ¤¤¤Þ¤¹ - ¥»¥¯¥·¥ç¥ó¤¬¾®¤µ¤¹¤®¤Þ¤¹\n" + +#: readelf.c:5062 +msgid "Only DWARF version 2 line info is currently supported.\n" +msgstr "¸½ºß¤Î¤È¤³¤í¡¢DWARF ¥Ð¡¼¥¸¥ç¥ó 2 ¤À¤±¤¬ line ¾ðÊó¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£\n" + +#: readelf.c:5077 +#, c-format +msgid " Length: %ld\n" +msgstr " Ťµ: %ld\n" + +#: readelf.c:5078 +#, c-format +msgid " DWARF Version: %d\n" +msgstr " DWARF ¥Ð¡¼¥¸¥ç¥ó: %d\n" + +#: readelf.c:5079 +#, c-format +msgid " Prolgue Length: %d\n" +msgstr " Prolgue ¤ÎŤµ: %d\n" + +#: readelf.c:5080 +#, c-format +msgid " Minimum Instruction Length: %d\n" +msgstr " ºÇ¾®Ì¿ÎáĹ: %d\n" + +#: readelf.c:5081 +#, c-format +msgid " Initial value of 'is_stmt': %d\n" +msgstr " 'is_stmt' ¤Î½é´üÃÍ: %d\n" + +#: readelf.c:5082 +#, c-format +msgid " Line Base: %d\n" +msgstr " Line ¥Ù¡¼¥¹: %d\n" + +#: readelf.c:5083 +#, c-format +msgid " Line Range: %d\n" +msgstr " Line ÈϰÏ: %d\n" + +#: readelf.c:5084 +#, c-format +msgid " Opcode Base: %d\n" +msgstr " ¥ª¥Ú¥³¡¼¥É¥Ù¡¼¥¹: %d\n" + +#: readelf.c:5093 +msgid "\n Opcodes:\n" +msgstr "\n ¥ª¥Ú¥³¡¼¥É:\n" + +#: readelf.c:5096 +#, c-format +msgid " Opcode %d has %d args\n" +msgstr " ¥ª¥Ú¥³¡¼¥É %d ¤Ï %d ¸Ä¤Î°ú¿ô¤ò»ý¤Á¤Þ¤¹\n" + +#: readelf.c:5102 +msgid "\n The Directory Table is empty.\n" +msgstr "\n ¥Ç¥£¥ì¥¯¥È¥ê¥Æ¡¼¥Ö¥ë¤Ï¶õ¤Ç¤¹¡£\n" + +#: readelf.c:5105 +msgid "\n The Directory Table:\n" +msgstr "\n ¥Ç¥£¥ì¥¯¥È¥ê¥Æ¡¼¥Ö¥ë:\n" + +#: readelf.c:5109 +#, c-format +msgid " %s\n" +msgstr " %s\n" + +#: readelf.c:5120 +msgid "\n The File Name Table is empty.\n" +msgstr "\n ¥Õ¥¡¥¤¥ë̾¥Æ¡¼¥Ö¥ë¤Ï¶õ¤Ç¤¹¡£\n" + +#: readelf.c:5123 +msgid "\n The File Name Table:\n" +msgstr "\n ¥Õ¥¡¥¤¥ë̾¥Æ¡¼¥Ö¥ë:\n" + +#: readelf.c:5131 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:5142 +#, c-format +msgid "%s\n" +msgstr "%s\n" + +#. Now display the statements. +#: readelf.c:5150 +msgid "\n Line Number Statements:\n" +msgstr "\n ¹ÔÈֹ楹¥Æ¡¼¥È¥á¥ó¥È:\n" + +#: readelf.c:5169 +msgid " Copy\n" +msgstr " ¥³¥Ô¡¼\n" + +#: readelf.c:5176 +#, c-format +msgid " Advance PC by %d to %lx\n" +msgstr " PC ¤ò %d ʬ¿Ê¤á %lx ¤È¤·¤Þ¤¹\n" + +#: readelf.c:5184 +#, c-format +msgid " Advance Line by %d to %d\n" +msgstr " ¹Ô¤ò %d ¿Ê¤á %d ¤È¤·¤Þ¤¹\n" + +#: readelf.c:5191 +#, c-format +msgid " Set File Name to entry %d in the File Name Table\n" +msgstr " ¥¨¥ó¥È¥ê %d ¤Î¥Õ¥¡¥¤¥ë̾¤ò¥Õ¥¡¥¤¥ë̾¥Æ¡¼¥Ö¥ë¤Ë¥»¥Ã¥È\n" + +#: readelf.c:5199 +#, c-format +msgid " Set column to %d\n" +msgstr " ·åÉý¤ò %d ¤ËÀßÄê\n" + +#: readelf.c:5206 +#, c-format +msgid " Set is_stmt to %d\n" +msgstr " is_stmt ¤ò %d ¤Ë¥»¥Ã¥È\n" + +#: readelf.c:5211 +msgid " Set basic block\n" +msgstr " ´ðËÜ¥Ö¥í¥Ã¥¯¤òÀßÄê\n" + +#: readelf.c:5219 +#, c-format +msgid " Advance PC by constant %d to 0x%lx\n" +msgstr " PC ¤òÄê¿ô %d ʬ¿Ê¤á 0x%lx ¤È¤·¤Þ¤¹\n" + +#: readelf.c:5227 +#, c-format +msgid " Advance PC by fixed size amount %d to 0x%lx\n" +msgstr " PC ¤ò¸ÇÄꥵ¥¤¥º %d ʬ¿Ê¤á 0x%lx ¤È¤·¤Þ¤¹\n" + +#: readelf.c:5235 +#, c-format +msgid " Special opcode %d: advance Address by %d to 0x%lx" +msgstr " ÆÃ¼ì¥ª¥Ú¥³¡¼¥É %d: ¥¢¥É¥ì¥¹¤ò %d ʬ¿Ê¤á 0x%lx ¤È¤·" + +#: readelf.c:5239 +#, c-format +msgid " and Line by %d to %d\n" +msgstr " ¹Ô¤ò %d ʬ¿Ê¤á %d ¤È¤·¤Þ¤¹\n" + +#: readelf.c:5262 readelf.c:5691 +#, c-format +msgid "Contents of the %s section:\n\n" +msgstr "%s ¥»¥¯¥·¥ç¥ó¤ÎÆâÍÆ:\n\n" + +#: readelf.c:5285 +msgid "Only DWARF 2 pubnames are currently supported\n" +msgstr "¸½ºß¤Î¤È¤³¤í¡¢DWARF 2 ¤À¤±¤¬ pubnames ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹\n" + +#: readelf.c:5292 +#, c-format +msgid " Length: %ld\n" +msgstr " Ťµ: %ld\n" + +#: readelf.c:5294 +#, c-format +msgid " Version: %d\n" +msgstr " ¥Ð¡¼¥¸¥ç¥ó: %d\n" + +#: readelf.c:5296 +#, c-format +msgid " Offset into .debug_info section: %ld\n" +msgstr " .debug_info ¥»¥¯¥·¥ç¥ó¤Ø¤Î¥ª¥Õ¥»¥Ã¥È:%ld\n" + +#: readelf.c:5298 +#, c-format +msgid " Size of area in .debug_info section: %ld\n" +msgstr " .debug_info ¥»¥¯¥·¥ç¥óÎΰ襵¥¤¥º: %ld\n" + +#: readelf.c:5301 +msgid "\n Offset\tName\n" +msgstr "\n ¥ª¥Õ¥»¥Ã¥È\t̾Á°\n" + +#: readelf.c:5383 +#, c-format +msgid "Unknown TAG value: %lx" +msgstr "ÉÔÌÀ¤Ê TAG ÃÍ: %lx" + +#: readelf.c:5478 +#, c-format +msgid "Unknown AT value: %lx" +msgstr "ÉÔÌÀ¤Ê AT ÃÍ: %lx" + +#: readelf.c:5515 +#, c-format +msgid "Unknown FORM value: %lx" +msgstr "ÉÔÌÀ¤Ê FORM ÃÍ: %lx" + +#: readelf.c:5697 +msgid " Number TAG\n" +msgstr " ÈÖ¹æ TAG\n" + +#: readelf.c:5703 +#, c-format +msgid " %ld %s [%s]\n" +msgstr " %ld %s [%s]\n" + +#: readelf.c:5706 +msgid "has children" +msgstr "»Ò¤¢¤ê" + +#: readelf.c:5706 +msgid "no children" +msgstr "»Ò¤Ê¤·" + +#: readelf.c:5710 +#, c-format +msgid " %-18s %s\n" +msgstr " %-18s %s\n" + +#: readelf.c:5729 +#, c-format +msgid " %lu byte block: " +msgstr " %lu ¥Ð¥¤¥È¥Ö¥í¥Ã¥¯: " + +#: readelf.c:6036 +msgid "(User defined location op)" +msgstr "(¥æ¡¼¥¶ÄêµÁ location op)" + +#: readelf.c:6038 +msgid "(Unknown location op)" +msgstr "(ÉÔÌÀ¤Ê location op)" + +#: readelf.c:6165 +#, c-format +msgid "Unable to handle FORM: %d" +msgstr "FORM ¤ò°·¤¨¤Þ¤»¤ó: %d" + +#: readelf.c:6169 +#, c-format +msgid "Unrecognised form: %d" +msgstr "ǧ¼±¤Ç¤­¤Ê¤¤·Á¼°: %d" + +#: readelf.c:6182 +msgid "(not inlined)" +msgstr "(Èó inline)" + +#: readelf.c:6183 +msgid "(inlined)" +msgstr "(inlined ²½)" + +#: readelf.c:6184 +msgid "(declared as inline but ignored)" +msgstr "(inline Àë¸À¤µ¤ì¤¿¤¬Ìµ»ë¤µ¤ì¤¿)" + +#: readelf.c:6185 +msgid "(declared as inline and inlined)" +msgstr "(inline Àë¸À¤µ¤ì inline ²½)" + +#: readelf.c:6186 +#, c-format +msgid " (Unknown inline attribute value: %lx)" +msgstr " (ÉÔÌÀ¤Ê inline °À­ÃÍ: %lx)" + +#: readelf.c:6315 readelf.c:6441 +#, c-format +msgid "The section %s contains:\n\n" +msgstr "¥»¥¯¥·¥ç¥ó %s ¤ÎÆâÍÆ:\n\n" + +#: readelf.c:6337 +#, c-format +msgid " Compilation Unit @ %lx:\n" +msgstr " ¥³¥ó¥Ñ¥¤¥ëñ°Ì @ %lx:\n" + +#: readelf.c:6338 +#, c-format +msgid " Length: %ld\n" +msgstr " Ťµ: %ld\n" + +#: readelf.c:6339 +#, c-format +msgid " Version: %d\n" +msgstr " ¥Ð¡¼¥¸¥ç¥ó: %d\n" + +#: readelf.c:6340 +#, c-format +msgid " Abbrev Offset: %ld\n" +msgstr " ¾Êά offset: %ld\n" + +#: readelf.c:6341 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " ¥Ý¥¤¥ó¥¿¥µ¥¤¥º:%d\n" + +#: readelf.c:6345 +msgid "Only version 2 DWARF debug information is currently supported.\n" +msgstr "¸½ºß¤Î¤È¤³¤í¡¢¥Ð¡¼¥¸¥ç¥ó 2 DWARF ¤À¤±¤¬¥Ç¥Ð¥Ã¥°¾ðÊó¤ò¥µ¥Ý¡¼¥È¤·¤Þ¤¹¡£\n" + +#: readelf.c:6367 +msgid "Unable to locate .debug_abbrev section!\n" +msgstr ".debug_abbrev ¥»¥¯¥·¥ç¥ó¤Î°ÌÃÖ¤òÆÃÄê¤Ç¤­¤Þ¤»¤ó!\n" + +#: readelf.c:6407 +#, c-format +msgid "Unable to locate entry %lu in the abbreviation table\n" +msgstr "¾Êά¥Æ¡¼¥Ö¥ëÆâ¤Î¥¨¥ó¥È¥ê %lu ¤Î°ÌÃÖ¤òÆÃÄê¤Ç¤­¤Þ¤»¤ó\n" + +#: readelf.c:6412 +#, c-format +msgid " <%d><%x>: Abbrev Number: %lu (%s)\n" +msgstr " <%d><%x>: ¾ÊάÈÖ¹æ: %lu (%s)\n" + +#: readelf.c:6462 +msgid "Only DWARF 2 aranges are currently supported.\n" +msgstr "¸½ºß¤Î¤È¤³¤í DWARF 2 ¤À¤±¤¬ arange ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£\n" + +#: readelf.c:6466 +#, c-format +msgid " Length: %ld\n" +msgstr " Ťµ: %ld\n" + +#: readelf.c:6467 +#, c-format +msgid " Version: %d\n" +msgstr " ¥Ð¡¼¥¸¥ç¥ó: %d\n" + +#: readelf.c:6468 +#, c-format +msgid " Offset into .debug_info: %lx\n" +msgstr " .debug_info Æâ¤Ø¤Îoffset: %lx\n" + +#: readelf.c:6469 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " ¥Ý¥¤¥ó¥¿¥µ¥¤¥º: %d\n" + +#: readelf.c:6470 +#, c-format +msgid " Segment Size: %d\n" +msgstr " ¥»¥°¥á¥ó¥È¥µ¥¤¥º: %d\n" + +#: readelf.c:6472 +msgid "\n Address Length\n" +msgstr "\n ¥¢¥É¥ì¥¹Ä¹\n" + +#: readelf.c:6634 +#, c-format +msgid "The section %s contains:\n" +msgstr "¥»¥¯¥·¥ç¥ó %s ¤ÎÆâÍÆ:\n" + +#: readelf.c:7109 +#, c-format +msgid "Displaying the debug contents of section %s is not yet supported.\n" +msgstr "¥»¥¯¥·¥ç¥ó %s ¤Î¥Ç¥Ð¥Ã¥°ÆâÍÆ¤Îɽ¼¨¤Ï¤Þ¤À¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£\n" + +#: readelf.c:7173 +#, c-format +msgid "\nSection '%s' has no debugging data.\n" +msgstr "\n¥»¥¯¥·¥ç¥ó '%s' ¤Ï¥Ç¥Ð¥Ã¥°¥Ç¡¼¥¿¤ò»ý¤Ã¤Æ¤¤¤Þ¤»¤ó¡£\n" + +#: readelf.c:7192 +#, c-format +msgid "Unrecognised debug section: %s\n" +msgstr "ǧ¼±¤Ç¤­¤Ê¤¤¥Ç¥Ð¥Ã¥°¥»¥¯¥·¥ç¥ó: %s\n" + +#: readelf.c:7264 +msgid "Some sections were not dumped because they do not exist!\n" +msgstr "¸ºß¤·¤Ê¤¤¤¿¤á¥À¥ó¥×¤µ¤ì¤Ê¤«¤Ã¤¿¥»¥¯¥·¥ç¥ó¤â¤¢¤ê¤Þ¤¹!\n" + +#: readelf.c:7447 +#, c-format +msgid "\nSection '%s' contains %d entries:\n" +msgstr "\n¥»¥¯¥·¥ç¥ó '%s' ¤Ï %d ¸Ä¤Î¥¨¥ó¥È¥ê¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹:\n" + +#: readelf.c:7609 +msgid "conflict list with without table" +msgstr "¥Æ¡¼¥Ö¥ë¤Î̵ͭ¤Î conflict ¥ê¥¹¥È" + +#: readelf.c:7637 +#, c-format +msgid "\nSection '.conflict' contains %d entries:\n" +msgstr "\n¥»¥¯¥·¥ç¥ó '.conflict' ¤Ï %d ¸Ä¤Î¥¨¥ó¥È¥ê¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹:\n" + +#: readelf.c:7638 +msgid " Num: Index Value Name" +msgstr " ÈÖ¹æ: º÷°ú ÃÍ Ì¾Á°" + +#: readelf.c:7663 +msgid "NT_PRSTATUS (prstatus structure)" +msgstr "NT_PRSTATUS (prstatus ¹½Â¤ÂÎ)" + +#: readelf.c:7664 +msgid "NT_FPREGSET (floating point registers)" +msgstr "NT_FPREGSET (ÉâÆ°¾®¿ôÅÀ¥ì¥¸¥¹¥¿)" + +#: readelf.c:7665 +msgid "NT_PRPSINFO (prpsinfo structure)" +msgstr "NT_PRPSINFO (prpsinfo ¹½Â¤ÂÎ)" + +#: readelf.c:7666 +msgid "NT_TASKSTRUCT (task structure)" +msgstr "NT_TASKSTRUCT (task ¹½Â¤ÂÎ)" + +#: readelf.c:7667 +msgid "NT_PRXFPREG (user_xfpregs structure)" +msgstr "NT_PRXFPREG (user_xfpregs ¹½Â¤ÂÎ)" + +#: readelf.c:7668 +msgid "NT_PSTATUS (pstatus structure)" +msgstr "NT_PSTATUS (pstatus ¹½Â¤ÂÎ)" + +#: readelf.c:7669 +msgid "NT_FPREGS (floating point registers)" +msgstr "NT_FPREGS (ÉâÆ°¾®¿ôÅÀ¥ì¥¸¥¹¥¿)" + +#: readelf.c:7670 +msgid "NT_PSINFO (psinfo structure)" +msgstr "NT_PSINFO (psinfo ¹½Â¤ÂÎ)" + +#: readelf.c:7671 +msgid "NT_LWPSTATUS (lwpstatus_t structure)" +msgstr "NT_LWPSTATUS (lwpstatus_t ¹½Â¤ÂÎ)" + +#: readelf.c:7672 +msgid "NT_LWPSINFO (lwpsinfo_t structure)" +msgstr "NT_LWPSINFO (lwpsinfo_t ¹½Â¤ÂÎ)" + +#: readelf.c:7673 +msgid "NT_WIN32PSTATUS (win32_pstatus strcuture)" +msgstr "NT_WIN32PSTATUS (win32_pstatus ¹½Â¤ÂÎ)" + +#: readelf.c:7675 +#, c-format +msgid "Unknown note type: (0x%08x)" +msgstr "ÉÔÌÀ¤Ê note ¥¿¥¤¥×: (0x%08x)" + +#: readelf.c:7713 +#, c-format +msgid "\nNotes at offset 0x%08lx with length 0x%08lx:\n" +msgstr "\n¥ª¥Õ¥»¥Ã¥È 0x%08lx, Ťµ 0x%08lx ¤Î note:\n" + +#: readelf.c:7715 +msgid " Owner\t\tData size\tDescription\n" +msgstr " ½êÍ­¼Ô\t\t¥Ç¡¼¥¿¥µ¥¤¥º\tÀâÌÀ\n" + +#: readelf.c:7826 +msgid "No note segments present in the core file.\n" +msgstr "¤³¤Î¥³¥¢¥Õ¥¡¥¤¥ë¤Ë note ¥»¥°¥á¥ó¥È¤¬Í­¤ê¤Þ¤»¤ó¡£\n" + +#: readelf.c:7904 +msgid "This instance of readelf has been built without support for a\n" +msgstr "¤³¤Î readelf ¤Î¼ÂÂÎ¤Ï 64 bit ¥Ç¡¼¥¿·¿¥µ¥Ý¡¼¥È̵¤·¤Ç¥Ó¥ë¥É¤µ¤ì¤Æ¤ª¤ê¡¢\n" + +#: readelf.c:7905 +msgid "64 bit data type and so it cannot read 64 bit ELF files.\n" +msgstr "64 bit ELF ¥Õ¥¡¥¤¥ë¤òÆÉ¤à¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó¡£\n" + +#: readelf.c:7940 +#, c-format +msgid "Cannot stat input file %s.\n" +msgstr "ÆþÎÏ¥Õ¥¡¥¤¥ë %s ¤ò stat(2) ¤Ç¤­¤Þ¤»¤ó¡£\n" + +#: readelf.c:7947 +#, c-format +msgid "Input file %s not found.\n" +msgstr "ÆþÎÏ¥Õ¥¡¥¤¥ë %s ¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£\n" + +#: readelf.c:7953 +#, c-format +msgid "%s: Failed to read file header\n" +msgstr "%s: ¥Õ¥¡¥¤¥ë¥Ø¥Ã¥À¤ÎÆÉ¹þ¤ß¤¬¼ºÇÔ¤·¤Þ¤·¤¿\n" + +#: readelf.c:7967 +#, c-format +msgid "\nFile: %s\n" +msgstr "\n¥Õ¥¡¥¤¥ë: %s\n" + +#: rename.c:131 +#, c-format +msgid "%s: cannot set time: %s" +msgstr "%s: »þ¹ï¤òÀßÄê¤Ç¤­¤Þ¤»¤ó: %s" + +#. We have to clean up here. +#: rename.c:170 rename.c:203 +#, c-format +msgid "%s: rename: %s" +msgstr "%s: rename: %s" + +#: rename.c:211 +#, c-format +msgid "%s: simple_copy: %s" +msgstr "%s: simple_copy: %s" + +#: resbin.c:130 +#, c-format +msgid "%s: not enough binary data" +msgstr "%s: ¥Ð¥¤¥Ê¥ê¥Ç¡¼¥¿¤¬ÉÔ½½Ê¬¤Ç¤¹" + +#: resbin.c:149 +msgid "null terminated unicode string" +msgstr "½ªÃ¼¤¬ null ¤Î unicode ʸ»úÎó¤Ç¤¹" + +#: resbin.c:179 resbin.c:185 +msgid "resource ID" +msgstr "¥ê¥½¡¼¥¹ ID" + +#: resbin.c:229 +msgid "cursor" +msgstr "¥«¡¼¥½¥ë" + +#: resbin.c:263 resbin.c:270 +msgid "menu header" +msgstr "menu ¥Ø¥Ã¥À" + +#: resbin.c:280 +msgid "menuex header" +msgstr "¥á¥Ë¥å¡¼ ex ¥Ø¥Ã¥À" + +#: resbin.c:284 +msgid "menuex offset" +msgstr "¥á¥Ë¥å¡¼ ex ¥ª¥Õ¥»¥Ã¥È" + +#: resbin.c:291 +#, c-format +msgid "unsupported menu version %d" +msgstr "¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¥á¥Ë¥å¡¼¥Ð¡¼¥¸¥ç¥ó %d" + +#: resbin.c:319 resbin.c:334 resbin.c:400 +msgid "menuitem header" +msgstr "¥á¥Ë¥å¡¼¥¢¥¤¥Æ¥à¥Ø¥Ã¥À" + +#: resbin.c:430 +msgid "menuitem" +msgstr "¥á¥Ë¥å¡¼¥¢¥¤¥Æ¥à" + +#: resbin.c:471 resbin.c:499 +msgid "dialog header" +msgstr "¥À¥¤¥¢¥í¥°¥Ø¥Ã¥À" + +#: resbin.c:489 +#, c-format +msgid "unexpected dialog signature %d" +msgstr "ͽ´ü¤·¤Ê¤¤¥À¥¤¥¢¥í¥°¼±ÊÌÈÖ¹æ %d" + +#: resbin.c:531 +msgid "dialog font point size" +msgstr "¥À¥¤¥¢¥í¥°¥Õ¥©¥ó¥È¥Ý¥¤¥ó¥È¥µ¥¤¥º" + +#: resbin.c:539 +msgid "dialogex font information" +msgstr "¥À¥¤¥¢¥í¥° ex ¥Õ¥©¥ó¥È¾ðÊó" + +#: resbin.c:564 resbin.c:582 +msgid "dialog control" +msgstr "¥À¥¤¥¢¥í¥°¥³¥ó¥È¥í¡¼¥ë" + +#: resbin.c:574 +msgid "dialogex control" +msgstr "¥À¥¤¥¢¥í¥° ex ¥³¥ó¥È¥í¡¼¥ë" + +#: resbin.c:603 +msgid "dialog control end" +msgstr "¥À¥¤¥¢¥í¥°¥³¥ó¥È¥í¡¼¥ëËöÈø" + +#: resbin.c:615 +msgid "dialog control data" +msgstr "¥À¥¤¥¢¥í¥°¥³¥ó¥È¥í¡¼¥ë¥Ç¡¼¥¿" + +#: resbin.c:658 +msgid "stringtable string length" +msgstr "stringtable ʸ»úÎóĹ" + +#: resbin.c:668 +msgid "stringtable string" +msgstr "stringtable ʸ»úÎó" + +#: resbin.c:701 +msgid "fontdir header" +msgstr "fontdir ¥Ø¥Ã¥À" + +#: resbin.c:714 +msgid "fontdir" +msgstr "fontdir" + +#: resbin.c:730 +msgid "fontdir device name" +msgstr "fontdir ¥Ç¥Ð¥¤¥¹Ì¾" + +#: resbin.c:736 +msgid "fontdir face name" +msgstr "fontdir ¥Õ¥§¥¤¥¹Ì¾" + +#: resbin.c:779 +msgid "accelerator" +msgstr "¥¢¥¯¥»¥é¥ì¡¼¥¿" + +#: resbin.c:843 +msgid "group cursor header" +msgstr "¥°¥ë¡¼¥×¥«¡¼¥½¥ë¥Ø¥Ã¥À" + +#: resbin.c:847 +#, c-format +msgid "unexpected group cursor type %d" +msgstr "ͽ´ü¤·¤Ê¤¤¥°¥ë¡¼¥×¥«¡¼¥½¥ë·¿ %d" + +#: resbin.c:862 +msgid "group cursor" +msgstr "¥°¥ë¡¼¥×¥«¡¼¥½¥ë" + +#: resbin.c:901 +msgid "group icon header" +msgstr "¥°¥ë¡¼¥×¥¢¥¤¥³¥ó¥Ø¥Ã¥À" + +#: resbin.c:905 +#, c-format +msgid "unexpected group icon type %d" +msgstr "ͽ´ü¤·¤Ê¤¤¥Ð¡¼¥¸¥ç¥óʸ»úÎó %d" + +#: resbin.c:920 +msgid "group icon" +msgstr "¥°¥ë¡¼¥×¥¢¥¤¥³¥ó" + +#: resbin.c:991 resbin.c:1210 +msgid "unexpected version string" +msgstr "ͽ´ü¤·¤Ê¤¤¥Ð¡¼¥¸¥ç¥óʸ»úÎó" + +#: resbin.c:1025 +#, c-format +msgid "version length %d does not match resource length %lu" +msgstr "¥Ð¡¼¥¸¥çĹ %d ¤Ï¥ê¥½¡¼¥¹Ä¹ %lu ¤Î°ìÃפ·¤Þ¤»¤ó" + +#: resbin.c:1029 +#, c-format +msgid "unexpected version type %d" +msgstr "ͽ´ü¤·¤Ê¤¤¥Ð¡¼¥¸¥ç¥ó¥¿¥¤¥× %d" + +#: resbin.c:1041 +#, c-format +msgid "unexpected fixed version information length %d" +msgstr "ͽ´ü¤·¤Ê¤¤¸ÇÄê¥Ð¡¼¥¸¥ç¥ó¾ðÊóĹ %d" + +#: resbin.c:1044 +msgid "fixed version info" +msgstr "¸ÇÄê¥Ð¡¼¥¸¥ç¥ó¾ðÊó" + +#: resbin.c:1048 +#, c-format +msgid "unexpected fixed version signature %lu" +msgstr "ͽ´ü¤·¤Ê¤¤¸ÇÄê¥Ð¡¼¥¸¥ç¥ó¼±ÊÌÈÖ¹æ %lu" + +#: resbin.c:1052 +#, c-format +msgid "unexpected fixed version info version %lu" +msgstr "ͽ´ü¤·¤Ê¤¤¸ÇÄê¥Ð¡¼¥¸¥ç¥ó¾ðÊó¥Ð¡¼¥¸¥ç¥ó %lu" + +#: resbin.c:1081 +msgid "version var info" +msgstr "¥Ð¡¼¥¸¥ç¥ó var ¾ðÊó" + +#: resbin.c:1098 +#, c-format +msgid "unexpected stringfileinfo value length %d" +msgstr "ͽ´ü¤·¤Ê¤¤ stringfileinfo ÃͤÎŤµ %d" + +#: resbin.c:1108 +#, c-format +msgid "unexpected version stringtable value length %d" +msgstr "ͽ´ü¤·¤Ê¤¤¥Ð¡¼¥¸¥ç¥ó stringtable ÃͤÎŤµ %d" + +#: resbin.c:1142 +#, c-format +msgid "unexpected version string length %d != %d + %d" +msgstr "ͽ´ü¤·¤Ê¤¤¥Ð¡¼¥¸¥ç¥óʸ»úÎóĹ %d != %d + %d" + +#: resbin.c:1153 +#, c-format +msgid "unexpected version string length %d < %d" +msgstr "ͽ´ü¤·¤Ê¤¤ÊÑ¿ô¥Õ¥¡¥¤¥ë¾ðÊóÃͤÎŤµ %d < %d" + +#: resbin.c:1170 +#, c-format +msgid "unexpected varfileinfo value length %d" +msgstr "ͽ´ü¤·¤Ê¤¤ varfileinfo ÃͤÎŤµ %d" + +#: resbin.c:1189 +msgid "version varfileinfo" +msgstr "¥Ð¡¼¥¸¥ç¥ó varfileinfo" + +#: resbin.c:1204 +#, c-format +msgid "unexpected version value length %d" +msgstr "ͽ´ü¤·¤Ê¤¤¥Ð¡¼¥¸¥ç¥óÃͤÎŤµ %d" + +#: rescoff.c:128 +msgid "filename required for COFF input" +msgstr "COFF ÆþÎÏÍѤΥե¡¥¤¥ë̾¤¬É¬ÍפǤ¹" + +#: rescoff.c:145 +#, c-format +msgid "%s: no resource section" +msgstr "%s: ¥ê¥½¡¼¥¹¥»¥¯¥·¥ç¥ó¤¬Í­¤ê¤Þ¤»¤ó" + +#: rescoff.c:152 +msgid "can't read resource section" +msgstr "¥ê¥½¡¼¥¹¥»¥¯¥·¥ç¥ó¤òÆÉ¹þ¤á¤Þ¤»¤ó" + +#: rescoff.c:178 +#, c-format +msgid "%s: %s: address out of bounds" +msgstr "%s: %s: ¥¢¥É¥ì¥¹¤¬¶­³¦¤ò±Û¤¨¤Æ¤¤¤Þ¤¹" + +#: rescoff.c:197 +msgid "directory" +msgstr "¥Ç¥£¥ì¥¯¥È¥ê" + +#: rescoff.c:225 +msgid "named directory entry" +msgstr "̾Á°¤Ä¤­¥Ç¥£¥ì¥¯¥È¥ê¹àÌÜ" + +#: rescoff.c:234 +msgid "directory entry name" +msgstr "¥Ç¥£¥ì¥¯¥È¥ê¹àÌÜ̾" + +#: rescoff.c:254 +msgid "named subdirectory" +msgstr "̾Á°¤Ä¤­¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê" + +#: rescoff.c:262 +msgid "named resource" +msgstr "̾Á°¤Ä¤­¥ê¥½¡¼¥¹" + +#: rescoff.c:277 +msgid "ID directory entry" +msgstr "ID ¥Ç¥£¥ì¥¯¥È¥ê¹àÌÜ" + +#: rescoff.c:294 +msgid "ID subdirectory" +msgstr "ID ¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê" + +#: rescoff.c:302 +msgid "ID resource" +msgstr "ID ¥ê¥½¡¼¥¹" + +#: rescoff.c:328 +msgid "resource type unknown" +msgstr "¥ê¥½¡¼¥¹·¿¤¬ÉÔÌÀ¤Ç¤¹" + +#: rescoff.c:331 +msgid "data entry" +msgstr "¥Ç¡¼¥¿¹àÌÜ" + +#: rescoff.c:339 +msgid "resource data" +msgstr "¥ê¥½¡¼¥¹¥Ç¡¼¥¿" + +#: rescoff.c:344 +msgid "resource data size" +msgstr "¥ê¥½¡¼¥¹¥Ç¡¼¥¿¥µ¥¤¥º" + +#: rescoff.c:439 +msgid "filename required for COFF output" +msgstr "COFF ½ÐÎÏÍѤΥե¡¥¤¥ë̾¤¬É¬ÍפǤ¹" + +#: rescoff.c:738 +msgid "can't get BFD_RELOC_RVA relocation type" +msgstr "BFD_RELOC_RVA ºÆÇÛÃÖ¥¿¥¤¥×¤ò¼èÆÀ¤Ç¤­¤Þ¤»¤ó" + +#: resrc.c:240 resrc.c:312 +#, c-format +msgid "can't open temporary file `%s': %s" +msgstr "°ì»þ¥Õ¥¡¥¤¥ë¤ò³«¤±¤Þ¤»¤ó `%s': %s" + +#: resrc.c:246 +#, c-format +msgid "can't redirect stdout: `%s': %s" +msgstr "ɸ½à½ÐÎϤ˥ê¥À¥¤¥ì¥¯¥È¤Ç¤­¤Þ¤»¤ó: `%s': %s" + +#: resrc.c:262 +#, c-format +msgid "%s %s: %s" +msgstr "%s %s: %s" + +#: resrc.c:308 +#, c-format +msgid "can't execute `%s': %s" +msgstr "`%s' ¤ò¼Â¹Ô¤Ç¤­¤Þ¤»¤ó: %s" + +#: resrc.c:317 +#, c-format +msgid "Using temporary file `%s' to read preprocessor output\n" +msgstr "¥×¥ê¥×¥í¥»¥Ã¥µ½ÐÎϤòÆÉ¹þ¤à¤¿¤á¤Ë°ì»þ¥Õ¥¡¥¤¥ë `%s' ¤ò»È¤¤¤Þ¤¹\n" + +#: resrc.c:324 +#, c-format +msgid "can't popen `%s': %s" +msgstr "`%s' ¤ò popen ¤Ç¤­¤Þ¤»¤ó: %s" + +#: resrc.c:326 +msgid "Using popen to read preprocessor output\n" +msgstr "¥×¥ê¥×¥í¥»¥Ã¥µ½ÐÎϤòÆÉ¹þ¤à¤¿¤á¤Ë popen ¤ò»È¤¤¤Þ¤¹\n" + +#: resrc.c:369 +#, c-format +msgid "Tried `%s'\n" +msgstr "`%s' ¤ò»î¤·¤Þ¤·¤¿\n" + +#: resrc.c:380 +#, c-format +msgid "Using `%s'\n" +msgstr "`%s' ¤ò»È¤¤¤Þ¤¹\n" + +#: resrc.c:541 +#, c-format +msgid "%s:%d: %s\n" +msgstr "%s:%d: %s\n" + +#: resrc.c:550 +#, c-format +msgid "%s: unexpected EOF" +msgstr "%s: ͽ´ü¤·¤Ê¤¤ EOF ¤Ç¤¹" + +#: resrc.c:607 +#, c-format +msgid "%s: read of %lu returned %lu" +msgstr "%s: %lu ¸Ä¤ÎÆÉ¹þ¤ß¤Ç %lu ¤¬Ê֤äƤ­¤Þ¤·¤¿" + +#: resrc.c:649 resrc.c:903 resrc.c:1176 resrc.c:1330 +#, c-format +msgid "stat failed on bitmap file `%s': %s" +msgstr "¥Ó¥Ã¥È¥Þ¥Ã¥×¥Õ¥¡¥¤¥ë `%s' ¤Î stat(2) ¤¬¼ºÇÔ¤·¤Þ¤·¤¿: %s" + +#: resrc.c:702 +#, c-format +msgid "cursor file `%s' does not contain cursor data" +msgstr "¥«¡¼¥½¥ë¥Õ¥¡¥¤¥ë `%s' ¤¬¥«¡¼¥½¥ë¥Ç¡¼¥¿¤ò´Þ¤ó¤Ç¤¤¤Þ¤»¤ó" + +#: resrc.c:734 resrc.c:1047 +#, c-format +msgid "%s: fseek to %lu failed: %s" +msgstr "%s: %lu ¤Ø¤Î fseek ¤¬¼ºÇÔ¤·¤Þ¤·¤¿: %s" + +#: resrc.c:871 +msgid "help ID requires DIALOGEX" +msgstr "¥Ø¥ë¥× ID ¤Ë¤Ï DIALOGEX ¤¬É¬ÍפȤʤê¤Þ¤¹" + +#: resrc.c:873 +msgid "control data requires DIALOGEX" +msgstr "¥³¥ó¥È¥í¡¼¥ë¥Ç¡¼¥¿¤Ë¤Ï DIALOGEX ¤¬É¬ÍפȤʤê¤Þ¤¹" + +#: resrc.c:1016 +#, c-format +msgid "icon file `%s' does not contain icon data" +msgstr "¥¢¥¤¥³¥ó¥Õ¥¡¥¤¥ë `%s' ¤¬¥¢¥¤¥³¥ó¥Ç¡¼¥¿¤ò´Þ¤ó¤Ç¤¤¤Þ¤»¤ó" + +#: resrc.c:1535 +#, c-format +msgid "can't open `%s' for output: %s" +msgstr "½ÐÎÏÍѤΠ`%s' ¤ò³«¤±¤Þ¤»¤ó: %s" + +#: size.c:79 +#, c-format +msgid "" +"Usage: %s [-A | --format=sysv | -B | --format=berkeley]\n" +" [-o | --radix=8 | -d | --radix=10 | -h | --radix=16]\n" +" [-V | --version] [--target=bfdname] [--help] [file...]\n" +msgstr "" +"»È¤¤Êý: %s [-A | --format=sysv | -B | --format=berkeley]\n" +" [-o | --radix=8 | -d | --radix=10 | -h | --radix=16]\n" +" [-V | --version] [--target=bfdname] [--help] [¥Õ¥¡¥¤¥ë...]\n" + +#: size.c:85 +msgid "default is --format=berkeley\n" +msgstr "¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï --format=berkeley ¤Ç¤¹\n" + +#: size.c:87 +msgid "default is --format=sysv\n" +msgstr "¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï --format=sysv ¤Ç¤¹\n" + +#: size.c:141 +#, c-format +msgid "invalid argument to --format: %s" +msgstr "--format ¤ËÂФ·¤ÆÉÔŬÀڤʰú¿ô¤Ç¤¹: %s" + +#: size.c:168 +#, c-format +msgid "Invalid radix: %s\n" +msgstr "ÉÔŬÀڤʴð¿ô¤Ç¤¹: %s\n" + +#: srconv.c:1880 +#, c-format +msgid "Usage: %s [-dhVq] in-file [out-file]\n" +msgstr "»È¤¤Êý: %s [-dhVq] ÆþÎÏ¥Õ¥¡¥¤¥ë [½ÐÎÏ¥Õ¥¡¥¤¥ë]\n" + +#: srconv.c:1887 +#, c-format +msgid "%s: Convert a COFF object file into a SYSROFF object file\n" +msgstr "%s: COFF ¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤ò SYSROFF ¥ª¥Ö¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¤ËÊÑ´¹¤·¤Þ¤¹\n" + +#: srconv.c:2020 +#, c-format +msgid "unable to open output file %s" +msgstr "½ÐÎÏ¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó" + +#: stabs.c:349 stabs.c:1770 +msgid "numeric overflow" +msgstr "¿ôÃͤ¬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Þ¤·¤¿" + +#: stabs.c:360 +#, c-format +msgid "Bad stab: %s\n" +msgstr "ÉÔÀµ¤Ê¥¹¥¿¥Ö¤Ç¤¹: %s\n" + +#: stabs.c:370 +#, c-format +msgid "Warning: %s: %s\n" +msgstr "·Ù¹ð: %s: %s\n" + +#: stabs.c:492 +msgid "N_LBRAC not within function\n" +msgstr "N_LBRAC ¤¬´Ø¿ôÆâ¤Ë¤¢¤ê¤Þ¤»¤ó\n" + +#: stabs.c:531 +msgid "Too many N_RBRACs\n" +msgstr "N_RBRAC ¤Î¿ô¤¬Â¿¤¹¤®¤Þ¤¹\n" + +#: stabs.c:780 +msgid "unknown C++ encoded name" +msgstr "ÉÔÌÀ¤Ê C++ ¥¨¥ó¥³¡¼¥É̾¤Ç¤¹" + +#. Complain and keep going, so compilers can invent new +#. cross-reference types. +#: stabs.c:1307 +msgid "unrecognized cross reference type" +msgstr "Áê¸ß»²¾È·¿¤òǧ¼±¤Ç¤­¤Þ¤»¤ó" + +#. Does this actually ever happen? Is that why we are worrying +#. about dealing with it rather than just calling error_type? +#: stabs.c:1862 +msgid "missing index type" +msgstr "¥¤¥ó¥Ç¥Ã¥¯¥¹·¿¤ò·ç¤¤¤Æ¤¤¤Þ¤¹" + +#: stabs.c:2189 +msgid "unknown virtual character for baseclass" +msgstr "´ðÄ쥯¥é¥¹ÍѲ¾ÁÛʸ»ú¤¬ÉÔÌÀ¤Ç¤¹" + +#: stabs.c:2207 +msgid "unknown visibility character for baseclass" +msgstr "´ðÄ쥯¥é¥¹ÍѲĻëÀ­Ê¸»ú¤¬ÉÔÌÀ¤Ç¤¹" + +#: stabs.c:2399 +msgid "unnamed $vb type" +msgstr "$vb ·¿¤Î̾Á°¤¬¤¢¤ê¤Þ¤»¤ó" + +#: stabs.c:2405 +msgid "unrecognized C++ abbreviation" +msgstr "C++ ¾Êά̾¤òǧ¼±¤Ç¤­¤Þ¤»¤ó" + +#: stabs.c:2485 +msgid "unknown visibility character for field" +msgstr "¥Õ¥£¡¼¥ë¥ÉÍѤβĻëÀ­Ê¸»ú¤¬ÉÔÌÀ¤Ç¤¹" + +#: stabs.c:2741 +msgid "const/volatile indicator missing" +msgstr "const/volatile »Ø¼¨»Ò¤ò·ç¤¤¤Æ¤¤¤Þ¤¹" + +#: stabs.c:2981 +#, c-format +msgid "No mangling for \"%s\"\n" +msgstr "\"%s\" ¤Î̾Á°¤ÎÊÑ·Á(mangling) ¤¬¤¢¤ê¤Þ¤»¤ó\n" + +#: stabs.c:3294 +msgid "Undefined N_EXCL" +msgstr "N_EXCL ¤¬Ì¤ÄêµÁ¤Ç¤¹" + +#: stabs.c:3382 +#, c-format +msgid "Type file number %d out of range\n" +msgstr "¥Õ¥¡¥¤¥ëÈֹ淿 %d ¤¬Èϰϳ°¤Ç¤¹\n" + +#: stabs.c:3387 +#, c-format +msgid "Type index number %d out of range\n" +msgstr "¥¤¥ó¥Ç¥Ã¥¯¥¹Èֹ淿 %d ¤¬Èϰϳ°¤Ç¤¹\n" + +#: stabs.c:3474 +#, c-format +msgid "Unrecognized XCOFF type %d\n" +msgstr "XCOFF ¥¿¥¤¥× %d ¤òǧ¼±¤Ç¤­¤Þ¤»¤ó\n" + +#: stabs.c:3773 +#, c-format +msgid "bad mangled name `%s'\n" +msgstr "ÉÔÀµ¤ÊÊÑ·Á̾ (mangled name) `%s'\n" + +#: stabs.c:3869 +msgid "no argument types in mangled string\n" +msgstr "ÊÑ·Á¤µ¤ì¤¿(mangled) ʸ»úÎó¤Ë°ú¿ô¤Î·¿¤¬¤¢¤ê¤Þ¤»¤ó\n" + +#: strings.c:177 +#, c-format +msgid "invalid number %s" +msgstr "ÉÔŬÀÚ¤ÊÃÍ %s" + +#: strings.c:513 +#, c-format +msgid "invalid integer argument %s" +msgstr "ÉÔŬÀÚ¤ÊÀ°¿ô°ú¿ô %s" + +#: strings.c:523 +#, c-format +msgid "" +"Usage: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-]\n" +" [--all] [--print-file-name] [--bytes=min-len] [--radix={o,x,d}]\n" +" [--target=bfdname] [--help] [--version] file...\n" +msgstr "" +"»È¤¤Êý: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-]\n" +" [--all] [--print-file-name] [--bytes=min-len] [--radix={o,x,d}]\n" +" [--target=bfdname] [--help] [--version] ¥Õ¥¡¥¤¥ë...\n" + +#: sysdump.c:712 +#, c-format +msgid "Usage: %s [-hV] in-file\n" +msgstr "»È¤¤Êý: %s [-hV] ÆþÎÏ¥Õ¥¡¥¤¥ë\n" + +#: sysdump.c:781 +#, c-format +msgid "cannot open input file %s" +msgstr "ÆþÎÏ¥Õ¥¡¥¤¥ë %s ¤ò³«¤±¤Þ¤»¤ó" + +#: version.c:39 +msgid "Copyright 1997, 98, 99, 2000 Free Software Foundation, Inc.\n" +msgstr "Copyright 1997, 98, 99, 2000 Free Software Foundation, Inc.\n" + +#: version.c:40 +msgid "" +"This program is free software; you may redistribute it under the terms of\n" +"the GNU General Public License. This program has absolutely no warranty.\n" +msgstr "" +"This program is free software; you may redistribute it under the terms of\n" +"the GNU General Public License. This program has absolutely no warranty.\n" +"[»²¹ÍÌõ -- ˡŪ¸úÎϤȤ·¤Æ¤Ï±Ñʸ¤¬Å¬ÍѤµ¤ì¤Þ¤¹]\n" +"¤³¤ì¤Ï¥Õ¥ê¡¼¥½¥Õ¥È¥¦¥§¥¢¤Ç¤¹ -- GNU GPL ¤Îʸ¸À¤Ë½¾¤Ã¤ÆÊ£À½¤¬µö²Ä¤µ¤ì¤Þ¤¹¡£\n" +"¤³¤Î¥×¥í¥°¥é¥à¤Ë¤Ï¤¤¤«¤Ê¤ëÊݾڤ⤢¤ê¤Þ¤»¤ó¡£\n" + +#: windres.c:237 +#, c-format +msgid "can't open %s `%s': %s" +msgstr "%s `%s' ¤ò³«¤±¤Þ¤»¤ó: %s" + +#: windres.c:416 +msgid ": expected to be a directory\n" +msgstr ": ¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¢¤ë¤Ù¤­¤Ç¤¹\n" + +#: windres.c:428 +msgid ": expected to be a leaf\n" +msgstr ": ËöÈøÍ×ÁǤǤ¢¤ë¤Ù¤­¤Ç¤¹\n" + +#: windres.c:437 +#, c-format +msgid "%s: warning: " +msgstr "%s: ·Ù¹ð: " + +#: windres.c:439 +msgid ": duplicate value\n" +msgstr ": ½ÅÊ£¤·¤¿ÃͤǤ¹\n" + +#: windres.c:602 +#, c-format +msgid "unknown format type `%s'" +msgstr "ÉÔÌÀ¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È·¿ `%s'" + +#: windres.c:603 +#, c-format +msgid "%s: supported formats:" +msgstr "%s: ¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¥Õ¥©¡¼¥Þ¥Ã¥È:" + +#. Otherwise, we give up. +#: windres.c:690 +#, c-format +msgid "can not determine type of file `%s'; use the -I option" +msgstr "¥Õ¥¡¥¤¥ë `%s' ¤Î·¿¤ò·èÄê¤Ç¤­¤Þ¤»¤ó -- -I ¥ª¥×¥·¥ç¥ó¤ò»È¤¤¤Þ¤·¤ç¤¦" + +#: windres.c:704 +#, c-format +msgid "Usage: %s [options] [input-file] [output-file]\n" +msgstr "»È¤¤Êý: %s [¥ª¥×¥·¥ç¥ó] [ÆþÎÏ¥Õ¥¡¥¤¥ë] [½ÐÎÏ¥Õ¥¡¥¤¥ë]\n" + +#: windres.c:706 +msgid "" +"Options:\n" +" -i FILE, --input FILE Name input file\n" +" -o FILE, --output FILE Name output file\n" +" -I FORMAT, --input-format FORMAT\n" +" Specify input format\n" +" -O FORMAT, --output-format FORMAT\n" +" Specify output format\n" +" -F TARGET, --target TARGET Specify COFF target\n" +" --preprocessor PROGRAM Program to use to preprocess rc file\n" +" --include-dir DIR Include directory when preprocessing rc file\n" +" -DSYM[=VAL], --define SYM[=VAL]\n" +" Define SYM when preprocessing rc file\n" +" -v Verbose - tells you what it's doing\n" +" --language VAL Set language when reading rc file\n" +" --use-temp-file Use a temporary file instead of popen to read\n" +" the preprocessor output\n" +" --no-use-temp-file Use popen (default)\n" +msgstr "" +"¥ª¥×¥·¥ç¥ó:\n" +" -i FILE, --input FILE ÆþÎÏ¥Õ¥¡¥¤¥ë̾\n" +" -o FILE, --output FILE ½ÐÎÏ¥Õ¥¡¥¤¥ë̾\n" +" -I FORMAT, --input-format FORMAT\n" +" ÆþÎÏ¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤹ¤ë\n" +" -O FORMAT, --output-format FORMAT\n" +" ½ÐÎÏ¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤹ¤ë\n" +" -F TARGET, --target TARGET COFF ¥¿¡¼¥²¥Ã¥È¤ò»ØÄꤹ¤ë\n" +" --preprocessor PROGRAM rc ¥Õ¥¡¥¤¥ë¤ÎÁ°½èÍý¤Ë»È¤¦¥×¥í¥°¥é¥à\n" +" --include-dir DIR rc ¥Õ¥¡¥¤¥ëÁ°½èÍý»þ¤Î¥¤¥ó¥¯¥ë¡¼¥É¥Ç¥£¥ì¥¯¥È¥ê\n" +" -DSYM[=VAL], --define SYM[=VAL]\n" +" rc ¥Õ¥¡¥¤¥ëÁ°½èÍý»þ¤Ë SYM ¤òÄêµÁ¤¹¤ë\n" +" -v ñÁÀå --¹Ô¤ï¤ì¤ë¤³¤È¤òÃΤ餻¤ë\n" +" --language VAL rc ÆÉ¹þ¤ß»þ¤Î¸À¸ì¤òÀßÄꤹ¤ë\n" +" --use-temp-file Á°½èÍý½ÐÎÏ¤ÎÆÉ¹þ¤ß¤Ë popen ¤Ç¤Ï¤Ê¤¯\n" +" °ì»þ¥Õ¥¡¥¤¥ë¤ò»È¤¦\n" +" --no-use-temp-file popen ¤ò»È¤¦ (¥Ç¥Õ¥©¥ë¥È)\n" + +#: windres.c:725 +msgid " --yydebug Turn on parser debugging\n" +msgstr " --yydebug ¹½Ê¸²òÀÏ´ï¤Î¥Ç¥Ð¥Ã¥°¤òÍ­¸ú¤Ë¤¹¤ë\n" + +#: windres.c:728 +msgid "" +" --help Print this help message\n" +" --version Print version information\n" +msgstr "" +" --help ¤³¤Î»È¤¤Êý¤òɽ¼¨¤¹¤ë\n" +" --version ¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤òɽ¼¨¤¹¤ë\n" + +#: windres.c:731 +msgid "" +"FORMAT is one of rc, res, or coff, and is deduced from the file name\n" +"extension if not specified. A single file name is an input file.\n" +"No input-file is stdin, default rc. No output-file is stdout, default rc.\n" +msgstr "" +"FORMAT ¤Ï rc, res ¤¢¤ë¤¤¤Ï coff ¤Î¤¤¤º¤ì¤«¤È¤Ê¤ê¡¢¤³¤ì¤¬»ØÄꤵ¤ì¤Ê¤¤¾ì¹ç¡¢\n" +"¥Õ¥¡¥¤¥ë̾¤Î³ÈÄ¥»Ò¤«¤é¿äÄꤵ¤ì¤Þ¤¹¡£ÆþÎÏ¥Õ¥¡¥¤¥ë¤ò»ØÄꤷ¤Ê¤±¤ì¤Ðɸ½àÆþÎϤ¬\n" +"»ÈÍѤµ¤ì¡¢rc ·Á¼°¤¬¥Ç¥Õ¥©¥ë¥È¤Ë¤Ê¤ê¤Þ¤¹¡£½ÐÎÏ¥Õ¥¡¥¤¥ë¤¬»ØÄꤵ¤ì¤Ê¤±¤ì¤Ð\n" +"ɸ½à½ÐÎϤ¬»ÈÍѤµ¤ì¡¢rc ·Á¼°¤¬¥Ç¥Õ¥©¥ë¥È¤Ë¤Ê¤ê¤Þ¤¹¡£\n" + +#: windres.c:980 +msgid "no resources" +msgstr "¥ê¥½¡¼¥¹¤¬¤¢¤ê¤Þ¤»¤ó" + +#: wrstabs.c:366 wrstabs.c:2027 +#, c-format +msgid "string_hash_lookup failed: %s" +msgstr "string_hash_lookup ¤¬¼ºÇÔ¤·¤Þ¤·¤¿: %s" + +#: wrstabs.c:666 +#, c-format +msgid "stab_int_type: bad size %u" +msgstr "stab_int_type: ÉÔÀµ¤Ê¥µ¥¤¥º %u ¤Ç¤¹" + +#: wrstabs.c:1467 +#, c-format +msgid "%s: warning: unknown size for field `%s' in struct" +msgstr "%s: ·Ù¹ð: ¹½Â¤ÂΤΥե£¡¼¥ë¥É `%s' ¤Î¥µ¥¤¥º¤¬ÉÔÌÀ¤Ç¤¹" diff --git a/binutils/po/ru.gmo b/binutils/po/ru.gmo new file mode 100644 index 0000000000000..5ea07a1ee401a Binary files /dev/null and b/binutils/po/ru.gmo differ diff --git a/binutils/po/ru.po b/binutils/po/ru.po new file mode 100644 index 0000000000000..a3be42124be06 --- /dev/null +++ b/binutils/po/ru.po @@ -0,0 +1,4889 @@ +# Translation of binutils-2.14rel030712.ru.po to Russian +# Copyright (C) 2003 Free Software Foundation, Inc. +# This file is distributed under the same license as the binutils package. +# Pavel Maryanov , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: binutils 2.14rel030712\n" +"POT-Creation-Date: 2003-07-11 13:56+0930\n" +"PO-Revision-Date: 2003-12-29 13:06+0200\n" +"Last-Translator: Pavel Maryanov \n" +"Language-Team: Russian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=KOI8-R\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.0.2\n" + +#: addr2line.c:74 +#, c-format +msgid "Usage: %s [option(s)] [addr(s)]\n" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ: %s [ÏÐÃÉÉ] [ÁÄÒÅÓ(Á)]\n" + +#: addr2line.c:75 +msgid " Convert addresses into line number/file name pairs.\n" +msgstr "ëÏÎ×ÅÒÔÉÒÕÅÔ ÁÄÒÅÓÁ × ÐÁÒÙ ÎÏÍÅÒ_ÓÔÒÏËÉ/ÉÍÑ_ÆÁÊÌÁ.\n" + +#: addr2line.c:76 +msgid " If no addresses are specified on the command line, they will be read from stdin\n" +msgstr " åÓÌÉ ÁÄÒÅÓÁ ÎÅ ÕËÁÚÁÎÙ × ËÏÍÁÎÄÎÏÊ ÓÔÒÏËÅ, ÏÎÉ ÂÕÄÕÔ ÐÒÏÞÉÔÁÎÙ ÉÚ stdin\n" + +#: addr2line.c:77 +msgid "" +" The options are:\n" +" -b --target= Set the binary file format\n" +" -e --exe= Set the input file name (default is a.out)\n" +" -s --basenames Strip directory names\n" +" -f --functions Show function names\n" +" -C --demangle[=style] Demangle function names\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +" ïÐÃÉÉ:\n" +" -b --target= õÓÔÁÎÏ×ÉÔØ ÆÏÒÍÁÔ Ä×ÏÉÞÎÏÇÏ ÆÁÊÌÁ\n" +" -e --exe= õÓÔÁÎÏ×ÉÔØ ÉÍÑ ×ÈÏÄÎÏÇÏ ÆÁÊÌÁ (ÐÏ ÕÍÏÌÞÁÎÉÀ ÉÓÐÏÌØÚÕÅÔÓÑ a.out)\n" +" -s --basenames ÷ÙÄÅÌÉÔØ ÉÍÅÎÁ ËÁÔÁÌÏÇÏ×\n" +" -f --functions ðÏËÁÚÁÔØ ÉÍÅÎÁ ÆÕÎËÃÉÊ\n" +" -C --demangle[=ÓÔÉÌØ] òÁÓÛÉÆÒÏ×ÁÔØ ÉÍÅÎÁ ÆÕÎËÃÉÊ\n" +" -h --help ðÏËÁÚÁÔØ ÜÔÕ ÉÎÆÏÒÍÁÃÉÀ\n" +" -v --version ðÏËÁÚÁÔØ ×ÅÒÓÉÀ ÐÒÏÇÒÁÍÍÙ\n" +"\n" + +#: addr2line.c:89 ar.c:297 coffdump.c:479 nlmconv.c:1121 objcopy.c:484 +#: objcopy.c:518 readelf.c:2649 size.c:104 srconv.c:1962 strings.c:673 +#: sysdump.c:774 windres.c:702 +#, c-format +msgid "Report bugs to %s\n" +msgstr "ïÔÞÅÔÙ Ï ÏÛÉÂËÁÈ ÏÔÐÒÁ×ÌÑÊÔÅ × %s\n" + +#: addr2line.c:245 +#, c-format +msgid "%s: can not get addresses from archive" +msgstr "%s: ÎÅ×ÏÚÍÏÖÎÏ ÐÏÌÕÞÉÔØ ÁÄÒÅÓÁ ÉÚ ÁÒÈÉ×Á" + +#: addr2line.c:317 nm.c:433 objdump.c:2693 +#, c-format +msgid "unknown demangling style `%s'" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ÓÔÉÌØ ÒÁÓÛÉÆÒÏ×ËÉ `%s'" + +#: ar.c:238 +#, c-format +msgid "no entry %s in archive\n" +msgstr "× ÁÒÈÉ×Å ÎÅÔ ÐÕÎËÔÁ %s\n" + +#: ar.c:255 +#, c-format +msgid "Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n" +msgstr "" +"éÓÐÏÌØÚÏ×ÁÎÉÅ: %s [ÏÐÃÉÉ ÜÍÕÌÑÃÉÉ] [-]{dmpqrstx}[abcfilNoPsSuvV] [ÉÍÑ_ÞÌÅÎÁ]\n" +" [ÓÞÅÔ] ÆÁÊÌ_ÁÒÈÉ×Á ÆÁÊÌ...\n" + +#: ar.c:258 +#, c-format +msgid " %s -M [\n" +"\n" +msgstr "" +"\n" +"<ÞÌÅÎ %s>\n" +"\n" + +#: ar.c:857 ar.c:925 +#, c-format +msgid "%s is not a valid archive" +msgstr "%s ÎÅ Ñ×ÌÑÅÔÓÑ ×ÅÒÎÙÍ ÁÒÈÉ×ÏÍ" + +#: ar.c:893 +#, c-format +msgid "stat returns negative size for %s" +msgstr "stat ×ÏÚ×ÒÁÔÉÌ ÏÔÒÉÃÁÔÅÌØÎÙÊ ÒÁÚÍÅÒ ÄÌÑ %s" + +#: ar.c:1020 +#, c-format +msgid "%s is not an archive" +msgstr "%s ÎÅ Ñ×ÌÑÅÔÓÑ ÁÒÈÉ×ÏÍ" + +#: ar.c:1027 +#, c-format +msgid "creating %s" +msgstr "ÓÏÚÄÁÅÔÓÑ %s" + +#: ar.c:1233 +#, c-format +msgid "No member named `%s'\n" +msgstr "îÅÔ ÞÌÅÎÁ Ó ÉÍÅÎÅÍ `%s'\n" + +#: ar.c:1285 +#, c-format +msgid "no entry %s in archive %s!" +msgstr "ÐÕÎËÔÁ %s ÎÅÔ × ÁÒÈÉ×Å %s!" + +#: ar.c:1422 +#, c-format +msgid "%s: no archive map to update" +msgstr "%s: ÎÅÔ ËÁÒÔÙ ÁÒÈÉ×Á ÄÌÑ ÏÂÎÏ×ÌÅÎÉÑ" + +#: arsup.c:86 +#, c-format +msgid "No entry %s in archive.\n" +msgstr "ÐÕÎËÔÁ %s ÎÅÔ × ÁÒÈÉ×Å.\n" + +#: arsup.c:117 +#, c-format +msgid "Can't open file %s\n" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ÆÁÊÌ %s\n" + +#: arsup.c:172 +#, c-format +msgid "%s: Can't open output archive %s\n" +msgstr "%s: îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ×ÙÈÏÄÎÏÊ ÁÒÈÉ× %s\n" + +#: arsup.c:189 +#, c-format +msgid "%s: Can't open input archive %s\n" +msgstr "%s: îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ×ÈÏÄÎÏÊ ÁÒÈÉ× %s\n" + +#: arsup.c:198 +#, c-format +msgid "%s: file %s is not an archive\n" +msgstr "%s: ÆÁÊÌ %s ÎÅ Ñ×ÌÑÅÔÓÑ ÁÒÈÉ×ÏÍ\n" + +#: arsup.c:241 +#, c-format +msgid "%s: no output archive specified yet\n" +msgstr "%s: ×ÙÈÏÄÎÏÊ ÁÒÈÉ× ÅÝÅ ÎÅ ÕËÁÚÁÎ\n" + +#: arsup.c:262 arsup.c:301 arsup.c:343 arsup.c:364 arsup.c:430 +#, c-format +msgid "%s: no open output archive\n" +msgstr "%s: ÎÅÔ ÏÔËÒÙÔÏÇÏ ×ÙÈÏÄÎÏÇÏ ÁÒÈÉ×Á\n" + +#: arsup.c:273 arsup.c:385 arsup.c:411 +#, c-format +msgid "%s: can't open file %s\n" +msgstr "%s: ÎÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ÆÁÊÌ %s\n" + +#: arsup.c:328 arsup.c:407 arsup.c:489 +#, c-format +msgid "%s: can't find module file %s\n" +msgstr "%s: ÎÅ×ÏÚÍÏÖÎÏ ÎÁÊÔÉ ÆÁÊÌ ÍÏÄÕÌÑ %s\n" + +#: arsup.c:439 +#, c-format +msgid "Current open archive is %s\n" +msgstr "ôÅËÕÝÉÊ ÏÔËÒÙÔÙÊ ÁÒÈÉ× - %s\n" + +#: arsup.c:464 +#, c-format +msgid "%s: no open archive\n" +msgstr "%s: ÎÅÔ ÏÔËÒÙÔÏÇÏ ÁÒÈÉ×Á\n" + +#: binemul.c:39 +#, c-format +msgid " No emulation specific options\n" +msgstr " îÅÔ ÏÐÃÉÊ, ÓÐÅÃÉÆÉÞÎÙÈ ÄÌÑ ÜÍÕÌÑÃÉÉ\n" + +#. Macros for common output. +#: binemul.h:52 +#, c-format +msgid " emulation options: \n" +msgstr " ÏÐÃÉÉ ÜÍÕÌÑÃÉÉ: \n" + +#: bucomm.c:113 +#, c-format +msgid "can't set BFD default target to `%s': %s" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÕÓÔÁÎÏ×ÉÔØ ÃÅÌØ BFD ÐÏ ÕÍÏÌÞÁÎÉÀ ÎÁ `%s': %s" + +#: bucomm.c:125 +#, c-format +msgid "%s: Matching formats:" +msgstr "%s: æÏÒÍÁÔÙ ÓÏ×ÐÁÄÅÎÉÑ:" + +#: bucomm.c:142 +msgid "Supported targets:" +msgstr "ðÏÄÄÅÒÖÉ×ÁÅÍÙÅ ÃÅÌÉ:" + +#: bucomm.c:144 +#, c-format +msgid "%s: supported targets:" +msgstr "%s: ÐÏÄÄÅÒÖÉ×ÁÅÍÙÅ ÃÅÌÉ:" + +#: bucomm.c:162 +msgid "Supported architectures:" +msgstr "ðÏÄÄÅÒÖÉ×ÁÅÍÙÅ ÁÒÈÉÔÅËÔÕÒÙ:" + +#: bucomm.c:164 +#, c-format +msgid "%s: supported architectures:" +msgstr "%s: ÐÏÄÄÅÒÖÉ×ÁÅÍÙÅ ÁÒÈÉÔÅËÔÕÒÙ:" + +#: bucomm.c:360 +#, c-format +msgid "BFD header file version %s\n" +msgstr "æÁÊÌ ÚÁÇÏÌÏ×ËÁ BFD ×ÅÒÓÉÑ %s\n" + +#: bucomm.c:467 +#, c-format +msgid "%s: bad number: %s" +msgstr "%s: ÐÌÏÈÏÅ ÞÉÓÌÏ: %s" + +#: coffdump.c:107 +#, c-format +msgid "#lines %d " +msgstr "#ÓÔÒÏËÉ %d " + +#: coffdump.c:471 sysdump.c:767 +#, c-format +msgid "Usage: %s [option(s)] in-file\n" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ: %s [ÏÐÃÉÉ] in-ÆÁÊÌ\n" + +#: coffdump.c:472 +msgid " Print a human readable interpretation of a SYSROFF object file\n" +msgstr " ÷Ù×ÏÄÉÔ ÕÄÏÂÏÞÉÔÁÅÍÕÀ ÄÌÑ ÞÅÌÏ×ÅËÁ ÉÎÔÅÒÐÒÅÔÁÃÉÀ ÏÂßÅËÔÎÏÇÏ ÆÁÊÌÁ SYSROFF\n" + +#: coffdump.c:473 +msgid "" +" The options are:\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +" ïÐÃÉÉ:\n" +" -h --help ÷Ù×ÏÄ ÜÔÏÊ ÉÎÆÏÒÍÁÃÉÉ\n" +" -v --version ÷Ù×ÏÄ ×ÅÒÓÉÉ ÐÒÏÇÒÁÍÍÙ\n" +"\n" + +#: coffdump.c:541 srconv.c:2052 sysdump.c:831 +msgid "no input file specified" +msgstr "ÎÅ ÕËÁÚÁÎ ×ÈÏÄÎÏÊ ÆÁÊÌ" + +#: debug.c:654 +msgid "debug_add_to_current_namespace: no current file" +msgstr "debug_add_to_current_namespace: ÎÅÔ ÔÅËÕÝÅÇÏ ÆÁÊÌÁ" + +#: debug.c:737 +msgid "debug_start_source: no debug_set_filename call" +msgstr "debug_start_source: ÎÅÔ ×ÙÚÏ×Á debug_set_filename" + +#: debug.c:796 +msgid "debug_record_function: no debug_set_filename call" +msgstr "debug_record_function: ÎÅÔ ×ÙÚÏ×Á debug_set_filename" + +#: debug.c:852 +msgid "debug_record_parameter: no current function" +msgstr "debug_record_parameter: ÎÅÔ ÔÅËÕÝÅÊ ÆÕÎËÃÉÉ" + +#: debug.c:886 +msgid "debug_end_function: no current function" +msgstr "debug_end_function: ÎÅÔ ÔÅËÕÝÅÊ ÆÕÎËÃÉÉ" + +#: debug.c:892 +msgid "debug_end_function: some blocks were not closed" +msgstr "debug_end_function: ÎÅËÏÔÏÒÙÅ ÂÌÏËÉ ÎÅ ÂÙÌÉ ÚÁËÒÙÔÙ" + +#: debug.c:922 +msgid "debug_start_block: no current block" +msgstr "debug_start_block: ÎÅÔ ÔÅËÕÝÅÇÏ ÂÌÏËÁ" + +#: debug.c:960 +msgid "debug_end_block: no current block" +msgstr "debug_end_block: ÎÅÔ ÔÅËÕÝÅÇÏ ÂÌÏËÁ" + +#: debug.c:967 +msgid "debug_end_block: attempt to close top level block" +msgstr "debug_end_block: ÐÏÐÙÔËÁ ÚÁËÒÙÔØ ÂÌÏË ×ÅÒÈÎÅÇÏ ÕÒÏ×ÎÑ" + +#: debug.c:993 +msgid "debug_record_line: no current unit" +msgstr "debug_record_line: ÎÅÔ ÔÅËÕÝÅÇÏ ÍÏÄÕÌÑ" + +#. FIXME +#: debug.c:1047 +msgid "debug_start_common_block: not implemented" +msgstr "debug_start_common_block: ÎÅ ×ÙÐÏÌÎÅÎ" + +#. FIXME +#: debug.c:1059 +msgid "debug_end_common_block: not implemented" +msgstr "debug_end_common_block: ÎÅ ×ÙÐÏÌÎÅÎ" + +#. FIXME. +#: debug.c:1153 +msgid "debug_record_label: not implemented" +msgstr "debug_record_label: ÎÅ ×ÙÐÏÌÎÅÎ" + +#: debug.c:1179 +msgid "debug_record_variable: no current file" +msgstr "debug_record_variable: ÎÅÔ ÔÅËÕÝÅÇÏ ÆÁÊÌÁ" + +#: debug.c:1762 +msgid "debug_make_undefined_type: unsupported kind" +msgstr "debug_make_undefined_type: ÎÅÐÏÄÄÅÒÖÉ×ÁÅÍÙÊ ÔÉÐ" + +#: debug.c:1963 +msgid "debug_name_type: no current file" +msgstr "debug_name_type: ÎÅÔ ÔÅËÕÝÅÇÏ ÆÁÊÌÁ" + +#: debug.c:2011 +msgid "debug_tag_type: no current file" +msgstr "debug_tag_type: ÎÅÔ ÔÅËÕÝÅÇÏ ÆÁÊÌÁ" + +#: debug.c:2019 +msgid "debug_tag_type: extra tag attempted" +msgstr "debug_tag_type: ÏÐÒÏÂÏ×ÁÎ ÄÏÐÏÌÎÉÔÅÌØÎÙÊ ÔÜÇ" + +#: debug.c:2058 +#, c-format +msgid "Warning: changing type size from %d to %d\n" +msgstr "ðÒÅÄÕÐÒÅÖÄÅÎÉÅ: ÉÚÍÅÎÑÅÔÓÑ ÒÁÚÍÅÒ ÔÉÐÁ Ó %d ÎÁ %d\n" + +#: debug.c:2082 +msgid "debug_find_named_type: no current compilation unit" +msgstr "debug_find_named_type: ÎÅÔ ÔÅËÕÝÅÇÏ ÍÏÄÕÌÑ ËÏÍÐÉÌÑÃÉÉ" + +#: debug.c:2189 +#, c-format +msgid "debug_get_real_type: circular debug information for %s\n" +msgstr "debug_get_real_type: ÃÉÒËÕÌÑÒÎÁÑ ÏÔÌÁÄÏÞÎÁÑ ÉÎÆÏÒÍÁÃÉÑ ÄÌÑ %s\n" + +#: debug.c:2650 +msgid "debug_write_type: illegal type encountered" +msgstr "debug_write_type: ×ÓÔÒÅÞÅÎ ÎÅ×ÅÒÎÙÊ ÔÉÐ" + +#: dlltool.c:812 dlltool.c:837 dlltool.c:863 +#, c-format +msgid "Internal error: Unknown machine type: %d" +msgstr "÷ÎÕÔÒÅÎÎÑÑ ÏÛÉÂËÁ: îÅÉÚ×ÅÓÔÎÙÊ ÔÉÐ ÍÁÛÉÎÙ: %d" + +#: dlltool.c:900 +#, c-format +msgid "Can't open def file: %s" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ÆÁÊÌ def: %s" + +#: dlltool.c:905 +#, c-format +msgid "Processing def file: %s" +msgstr "ïÂÒÁÂÁÔÙ×ÁÅÔÓÑ ÆÁÊÌ def: %s" + +#: dlltool.c:909 +msgid "Processed def file" +msgstr "ïÂÒÁÂÏÔÁÎ ÆÁÊÌ def" + +#: dlltool.c:935 +#, c-format +msgid "Syntax error in def file %s:%d" +msgstr "ïÛÉÂËÁ ÓÉÎÔÁËÓÉÓÁ × ÆÁÊÌÅ def %s:%d" + +#: dlltool.c:974 +#, c-format +msgid "NAME: %s base: %x" +msgstr "NAME: %s base: %x" + +#: dlltool.c:977 dlltool.c:996 +msgid "Can't have LIBRARY and NAME" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÉÍÅÔØ LIBRARY É NAME" + +#: dlltool.c:993 +#, c-format +msgid "LIBRARY: %s base: %x" +msgstr "LIBRARY: %s base: %x" + +#: dlltool.c:1251 resrc.c:271 +#, c-format +msgid "wait: %s" +msgstr "ÏÖÉÄÁÎÉÅ: %s" + +#: dlltool.c:1256 dllwrap.c:430 resrc.c:276 +#, c-format +msgid "subprocess got fatal signal %d" +msgstr "ÐÏÄÐÒÏÃÅÓÓ ÐÏÌÕÞÉÌ ÆÁÔÁÌØÎÙÊ ÓÉÇÎÁÌ %d" + +#: dlltool.c:1262 dllwrap.c:437 resrc.c:283 +#, c-format +msgid "%s exited with status %d" +msgstr "%s ÚÁ×ÅÒÛÅÎ ÓÏ ÓÔÁÔÕÓÏÍ %d" + +#: dlltool.c:1294 +#, c-format +msgid "Sucking in info from %s section in %s" +msgstr "÷ÓÁÓÙ×ÁÅÔÓÑ ÉÎÆÏÒÍÁÃÉÑ ÉÚ ÒÁÚÄÅÌÁ %s × %s" + +#: dlltool.c:1423 +#, c-format +msgid "Excluding symbol: %s" +msgstr "óÉÍ×ÏÌ ÉÓËÌÀÞÅÎÉÑ: %s" + +#: dlltool.c:1518 dlltool.c:1529 nm.c:1004 nm.c:1015 +#, c-format +msgid "%s: no symbols" +msgstr "%s: ÎÅÔ ÓÉÍ×ÏÌÏ×" + +#. FIXME: we ought to read in and block out the base relocations. +#: dlltool.c:1556 +#, c-format +msgid "Done reading %s" +msgstr "þÔÅÎÉÅ ×ÙÐÏÌÎÅÎÏ %s" + +#: dlltool.c:1567 +#, c-format +msgid "Unable to open object file: %s" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ÏÂßÅËÔÎÙÊ ÆÁÊÌ: %s" + +#: dlltool.c:1570 +#, c-format +msgid "Scanning object file %s" +msgstr "óËÁÎÉÒÕÅÔÓÑ ÏÂßÅËÔÎÙÊ ÆÁÊÌ %s" + +#: dlltool.c:1585 +#, c-format +msgid "Cannot produce mcore-elf dll from archive file: %s" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÓÆÏÒÍÉÒÏ×ÁÔØ mcore-elf dll ÉÚ ÆÁÊÌÁ ÁÒÈÉ×Á: %s" + +#: dlltool.c:1677 +msgid "Adding exports to output file" +msgstr "üËÓÐÏÒÔÎÙÅ ÄÁÎÎÙÅ ÄÏÂÁ×ÌÑÀÔÓÑ × ×ÙÈÏÄÎÏÊ ÆÁÊÌ" + +#: dlltool.c:1724 +msgid "Added exports to output file" +msgstr "üËÓÐÏÒÔÎÙÅ ÄÁÎÎÙÅ ÄÏÂÁ×ÌÅÎÙ × ×ÙÈÏÄÎÏÊ ÆÁÊÌ" + +#: dlltool.c:1848 +#, c-format +msgid "Generating export file: %s" +msgstr "çÅÎÅÒÉÒÕÅÔÓÑ ÆÁÊÌ ÜËÓÐÏÒÔÁ: %s" + +#: dlltool.c:1853 +#, c-format +msgid "Unable to open temporary assembler file: %s" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ×ÒÅÍÅÎÎÙÊ ÆÁÊÌ ÁÓÓÅÍÂÌÅÒÁ: %s" + +#: dlltool.c:1856 +#, c-format +msgid "Opened temporary file: %s" +msgstr "ïÔËÒÙÔÙÊ ×ÒÅÍÅÎÎÙÊ ÆÁÊÌ: %s" + +#: dlltool.c:2086 +msgid "Generated exports file" +msgstr "óÇÅÎÅÒÉÒÏ×ÁÎ ÆÁÊÌ ÜËÓÐÏÒÔÁ" + +#: dlltool.c:2378 +#, c-format +msgid "bfd_open failed open stub file: %s" +msgstr "bfd_open ÎÅ ÓÍÏÇ ÏÔËÒÙÔØ ÆÁÊÌ stub: %s" + +#: dlltool.c:2381 +#, c-format +msgid "Creating stub file: %s" +msgstr "óÏÚÄÁÅÔÓÑ ÆÁÊÌ stub: %s" + +#: dlltool.c:2766 +#, c-format +msgid "failed to open temporary head file: %s" +msgstr "ÓÂÏÊ ÐÒÉ ÏÔËÒÙÔÉÉ ×ÒÅÍÅÎÎÏÇÏ ÇÏÌÏ×ÎÏÇÏ ÆÁÊÌÁ: %s" + +#: dlltool.c:2825 +#, c-format +msgid "failed to open temporary tail file: %s" +msgstr "ÓÂÏÊ ÐÒÉ ÏÔËÒÙÔÉÉ ×ÒÅÍÅÎÎÏÇÏ ËÏÎÅÞÎÏÇÏ ÆÁÊÌÁ: %s" + +#: dlltool.c:2892 +#, c-format +msgid "Can't open .lib file: %s" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ÆÁÊÌ .lib: %s" + +#: dlltool.c:2895 +#, c-format +msgid "Creating library file: %s" +msgstr "óÏÚÄÁÅÔÓÑ ÆÁÊÌ ÂÉÂÌÉÏÔÅËÉ: %s" + +#: dlltool.c:2951 +#, c-format +msgid "cannot delete %s: %s" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÕÄÁÌÉÔØ %s: %s" + +#: dlltool.c:2955 +msgid "Created lib file" +msgstr "óÏÚÄÁÎ lib-ÆÁÊÌ" + +#: dlltool.c:3062 +#, c-format +msgid "Warning, ignoring duplicate EXPORT %s %d,%d" +msgstr "ðÒÅÄÕÐÒÅÖÄÅÎÉÅ, ÐÒÏÐÕÓËÁÅÔÓÑ ÐÏ×ÔÏÒÑÀÝÉÊÓÑ EXPORT %s %d,%d" + +#: dlltool.c:3068 +#, c-format +msgid "Error, duplicate EXPORT with oridinals: %s" +msgstr "ïÛÉÂËÁ, EXPORT ÐÏ×ÔÏÒÑÅÔÓÑ Ó ÐÏÒÑÄËÏ×ÙÍÉ ÞÉÓÌÉÔÅÌØÎÙÍÉ: %s" + +#: dlltool.c:3191 +msgid "Processing definitions" +msgstr "ïÂÒÁÂÁÔÙ×ÁÀÔÓÑ ÏÐÉÓÁÎÉÑ" + +#: dlltool.c:3223 +msgid "Processed definitions" +msgstr "ïÐÉÓÁÎÉÑ ÏÂÒÁÂÏÔÁÎÙ" + +#. xgetext:c-format +#: dlltool.c:3234 dllwrap.c:495 +#, c-format +msgid "Usage %s \n" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ %s <ÏÐÃÉÉ> <ÏÂßÅËÔÎÙÅ_ÆÁÊÌÙ>\n" + +#. xgetext:c-format +#: dlltool.c:3236 +#, c-format +msgid " -m --machine Create as DLL for . [default: %s]\n" +msgstr " -m --machine <ÍÁÛÉÎÁ> óÏÚÄÁÎÉÅ ËÁË DLL ÄÌÑ <ÍÁÛÉÎÙ>. [ÐÏ ÕÍÏÌÞÁÎÉÀ: %s]\n" + +#: dlltool.c:3237 +msgid " possible : arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" +msgstr " ×ÏÚÍÏÖÎÏ <ÍÁÛÉÎÁ>: arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" + +#: dlltool.c:3238 +msgid " -e --output-exp Generate an export file.\n" +msgstr " -e --output-exp <×ÙÈ_ÉÍÑ> óÏÚÄÁÎÉÅ ÆÁÊÌÁ ÜËÓÐÏÒÔÁ.\n" + +#: dlltool.c:3239 +msgid " -l --output-lib Generate an interface library.\n" +msgstr " -l --output-lib <×ÙÈ_ÉÍÑ> óÏÚÄÁÎÉÅ ÂÉÂÌÉÏÔÅËÉ ÉÎÔÅÒÆÅÊÓÁ.\n" + +#: dlltool.c:3240 +msgid " -a --add-indirect Add dll indirects to export file.\n" +msgstr " -a --add-indirect äÏÂÁ×ÌÅÎÉÅ ÎÅÐÒÑÍÙÈ dll × ÆÁÊÌ ÜËÓÐÏÒÔÁ.\n" + +#: dlltool.c:3241 +msgid " -D --dllname Name of input dll to put into interface lib.\n" +msgstr " -D --dllname <ÉÍÑ> éÍÑ ×ÈÏÄÎÏÊ dll ÄÌÑ ÐÏÍÅÝÅÎÉÑ × ÂÉÂÌÉÏÔÅËÕ ÉÎÔÅÒÆÅÊÓÁ.\n" + +#: dlltool.c:3242 +msgid " -d --input-def Name of .def file to be read in.\n" +msgstr " -d --input-def éÍÑ ÆÁÊÌÁ .def ÄÌÑ ÓÞÉÔÙ×ÁÎÉÑ.\n" + +#: dlltool.c:3243 +msgid " -z --output-def Name of .def file to be created.\n" +msgstr " -z --output-def éÍÑ ÓÏÚÄÁ×ÁÅÍÏÇÏ ÆÁÊÌÁ .def.\n" + +#: dlltool.c:3244 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols üËÓÐÏÒÔ ×ÓÅÈ ÓÉÍ×ÏÌÏ× × .def\n" + +#: dlltool.c:3245 +msgid " --no-export-all-symbols Only export listed symbols\n" +msgstr " --no-export-all-symbols üËÓÐÏÒÔ ÔÏÌØËÏ ÐÅÒÅÞÉÓÌÅÎÎÙÈ ÓÉÍ×ÏÌÏ×\n" + +#: dlltool.c:3246 +msgid " --exclude-symbols Don't export \n" +msgstr " --exclude-symbols <ÓÐÉÓÏË> îÅ ÜËÓÐÏÒÔÉÒÏ×ÁÔØ <ÓÐÉÓÏË>\n" + +#: dlltool.c:3247 +msgid " --no-default-excludes Clear default exclude symbols\n" +msgstr " --no-default-excludes ïÞÉÓÔËÁ ÓÉÍ×ÏÌÏ× ÉÓËÌÀÞÅÎÉÑ ÐÏ ÕÍÏÌÞÁÎÉÀ\n" + +#: dlltool.c:3248 +msgid " -b --base-file Read linker generated base file.\n" +msgstr " -b --base-file þÔÅÎÉÅ ÓÏÚÄÁÎÎÏÇÏ ËÏÍÐÏÎÏ×ÝÉËÏÍ base-ÆÁÊÌÁ.\n" + +#: dlltool.c:3249 +msgid " -x --no-idata4 Don't generate idata$4 section.\n" +msgstr " -x --no-idata4 îÅ ÓÏÚÄÁ×ÁÔØ ÒÁÚÄÅÌ idata$4.\n" + +#: dlltool.c:3250 +msgid " -c --no-idata5 Don't generate idata$5 section.\n" +msgstr " -c --no-idata5 îÅ ÓÏÚÄÁ×ÁÔØ ÒÁÚÄÅÌ idata$5.\n" + +#: dlltool.c:3251 +msgid " -U --add-underscore Add underscores to symbols in interface library.\n" +msgstr " -U --add-underscore äÏÂÁ×ÌÅÎÉÅ ÓÉÍ×ÏÌÏ× ÐÏÄÞÅÒËÉ×ÁÎÉÑ Ë ÓÉÍ×ÏÌÁÍ × ÂÉÂÌÉÏÔÅËÅ ÉÎÔÅÒÆÅÊÓÁ.\n" + +#: dlltool.c:3252 +msgid " -k --kill-at Kill @ from exported names.\n" +msgstr " -k --kill-at õÄÁÌÅÎÉÅ @ ÉÚ ÜËÓÐÏÒÔÉÒÏ×ÁÎÎÙÈ ÉÍÅÎ.\n" + +#: dlltool.c:3253 +msgid " -A --add-stdcall-alias Add aliases without @.\n" +msgstr " -A --add-stdcall-alias äÏÂÁ×ÌÅÎÉÅ ÁÌÉÁÓÏ× ÂÅÚ @.\n" + +#: dlltool.c:3254 +msgid " -S --as Use for assembler.\n" +msgstr " -S --as <ÉÍÑ> éÓÐÏÌØÚÏ×ÁÎÉÅ <ÉÍÅÎÉ> ÄÌÑ ÁÓÓÅÍÂÌÅÒÁ.\n" + +#: dlltool.c:3255 +msgid " -f --as-flags Pass to the assembler.\n" +msgstr " -f --as-flags <ÆÌÁÇÉ> ðÅÒÅÄÁÞÁ <ÆÌÁÇÏ×> × ÁÓÓÅÍÂÌÅÒ.\n" + +#: dlltool.c:3256 +msgid " -C --compat-implib Create backward compatible import library.\n" +msgstr " -C --compat-implib óÏÚÄÁÎÉÅ ÂÉÂÌÉÏÔÅËÉ ÉÍÐÏÒÔÁ Ó ÏÂÒÁÔÎÏÊ ÓÏ×ÍÅÓÔÉÍÏÓÔØÀ.\n" + +#: dlltool.c:3257 +msgid " -n --no-delete Keep temp files (repeat for extra preservation).\n" +msgstr " -n --no-delete ïÓÔÁ×ÌÑÔØ ×ÒÅÍÅÎÎÙÅ ÆÁÊÌÙ (ÐÏ×ÔÏÒ ÄÌÑ ÄÏÐ. ÚÁÝÉÔÙ).\n" + +#: dlltool.c:3258 +msgid " -v --verbose Be verbose.\n" +msgstr " -v --verbose ðÏÄÒÏÂÎÙÊ ÒÅÖÉÍ.\n" + +#: dlltool.c:3259 +msgid " -V --version Display the program version.\n" +msgstr " -V --version ÷Ù×ÏÄ ×ÅÒÓÉÉ ÐÒÏÇÒÁÍÍÙ.\n" + +#: dlltool.c:3260 +msgid " -h --help Display this information.\n" +msgstr " -h --help ÷Ù×ÏÄ ÜÔÏÊ ÉÎÆÏÒÍÁÃÉÉ.\n" + +#: dlltool.c:3262 +msgid " -M --mcore-elf Process mcore-elf object files into .\n" +msgstr " -M --mcore-elf <×ÙÈ_ÉÍÑ> ïÂÒÁÂÏÔËÁ ÏÂßÅËÔÎÏÇÏ ÆÁÊÌÁ mcore-elf × <×ÙÈ_ÉÍÑ>.\n" + +#: dlltool.c:3263 +msgid " -L --linker Use as the linker.\n" +msgstr " -L --linker <ÉÍÑ> éÓÐÏÌØÚÏ×ÁÎÉÅ <ÉÍÅÎÉ> × ËÁÞÅÓÔ×Å ËÏÍÐÏÎÏ×ÝÉËÁ.\n" + +#: dlltool.c:3264 +msgid " -F --linker-flags Pass to the linker.\n" +msgstr " -F --linker-flags <ÆÌÁÇÉ> ðÅÒÅÄÁÞÁ <ÆÌÁÇÏ×> ËÏÍÐÏÎÏ×ÝÉËÕ.\n" + +#: dlltool.c:3418 +#, c-format +msgid "Unable to open base-file: %s" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ base-ÆÁÊÌ: %s" + +#: dlltool.c:3450 +#, c-format +msgid "Machine '%s' not supported" +msgstr "íÁÛÉÎÁ '%s' ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ" + +#: dlltool.c:3553 dllwrap.c:214 +#, c-format +msgid "Tried file: %s" +msgstr "ïÐÒÏÂÏ×ÁÎÎÙÊ ÆÁÊÌ: %s" + +#: dlltool.c:3560 dllwrap.c:221 +#, c-format +msgid "Using file: %s" +msgstr "éÓÐÏÌØÚÕÅÔÓÑ ÆÁÊÌ: %s" + +#: dllwrap.c:308 +#, c-format +msgid "Keeping temporary base file %s" +msgstr "ïÓÔÁ×ÌÑÅÔÓÑ ×ÒÅÍÅÎÎÙÊ base-ÆÁÊÌ %s" + +#: dllwrap.c:310 +#, c-format +msgid "Deleting temporary base file %s" +msgstr "õÄÁÌÑÅÔÓÑ ×ÒÅÍÅÎÎÙÊ base-ÆÁÊÌ %s" + +#: dllwrap.c:324 +#, c-format +msgid "Keeping temporary exp file %s" +msgstr "ïÓÔÁ×ÌÑÅÔÓÑ ×ÒÅÍÅÎÎÙÊ exp-ÆÁÊÌ %s" + +#: dllwrap.c:326 +#, c-format +msgid "Deleting temporary exp file %s" +msgstr "õÄÁÌÑÅÔÓÑ ×ÒÅÍÅÎÎÙÊ exp-ÆÁÊÌ %s" + +#: dllwrap.c:339 +#, c-format +msgid "Keeping temporary def file %s" +msgstr "ïÓÔÁ×ÌÑÅÔÓÑ ×ÒÅÍÅÎÎÙÊ def-ÆÁÊÌ %s" + +#: dllwrap.c:341 +#, c-format +msgid "Deleting temporary def file %s" +msgstr "õÄÁÌÑÅÔÓÑ ×ÒÅÍÅÎÎÙÊ def-ÆÁÊÌ %s" + +#: dllwrap.c:496 +msgid " Generic options:\n" +msgstr " ïÂÝÉÅ ÏÐÃÉÉ:\n" + +#: dllwrap.c:497 +msgid " --quiet, -q Work quietly\n" +msgstr " --quiet, -q íÏÌÞÁÌÉ×ÙÊ ÒÅÖÉÍ\n" + +#: dllwrap.c:498 +msgid " --verbose, -v Verbose\n" +msgstr " --verbose, -v ðÏÄÒÏÂÎÙÊ ÒÅÖÉÍ\n" + +#: dllwrap.c:499 +msgid " --version Print dllwrap version\n" +msgstr " --version ÷Ù×ÏÄ ×ÅÒÓÉÉ dllwrap\n" + +#: dllwrap.c:500 +msgid " --implib Synonym for --output-lib\n" +msgstr " --implib <×ÙÈ_ÉÍÑ> óÉÎÏÎÉÍ ÄÌÑ --output-lib\n" + +#: dllwrap.c:501 +#, c-format +msgid " Options for %s:\n" +msgstr " ïÐÃÉÉ ÄÌÑ %s:\n" + +#: dllwrap.c:502 +msgid " --driver-name Defaults to \"gcc\"\n" +msgstr " --driver-name <ÄÒÁÊ×ÅÒ> úÎÁÞÅÎÉÑ ÄÌÑ \"gcc\" ÐÏ ÕÍÏÌÞÁÎÉÀ\n" + +#: dllwrap.c:503 +msgid " --driver-flags Override default ld flags\n" +msgstr " --driver-flags <ÆÌÁÇÉ> ðÅÒÅÏÐÒÅÄÅÌÅÎÉÅ ÆÌÁÇÏ× ld ÐÏ ÕÍÏÌÞÁÎÉÀ\n" + +#: dllwrap.c:504 +msgid " --dlltool-name Defaults to \"dlltool\"\n" +msgstr " --dlltool-name úÎÁÞÅÎÉÑ ÄÌÑ \"dlltool\" ÐÏ ÕÍÏÌÞÁÎÉÀ\n" + +#: dllwrap.c:505 +msgid " --entry Specify alternate DLL entry point\n" +msgstr " --entry <ÐÕÎËÔ> õËÁÚÁÎÉÅ ÁÌØÔÅÒÎÁÔÉ×ÎÏÊ ÔÏÞËÉ ×ÈÏÄÁ DLL\n" + +#: dllwrap.c:506 +msgid " --image-base Specify image base address\n" +msgstr " --image-base õËÁÚÁÎÉÅ ÂÁÚÏ×ÏÇÏ ÁÄÒÅÓÁ ÏÂÒÁÚÁ\n" + +#: dllwrap.c:507 +msgid " --target i386-cygwin32 or i386-mingw32\n" +msgstr " --target <ÍÁÛÉÎÁ> i386-cygwin32 ÉÌÉ i386-mingw32\n" + +#: dllwrap.c:508 +msgid " --dry-run Show what needs to be run\n" +msgstr " --dry-run ðÏËÁÚÁÔØ, ÞÔÏ ÄÏÌÖÎÏ ÂÙÔØ ÚÁÐÕÝÅÎÏ\n" + +#: dllwrap.c:509 +msgid " --mno-cygwin Create Mingw DLL\n" +msgstr " --mno-cygwin óÏÚÄÁÎÉÅ Mingw DLL\n" + +#: dllwrap.c:510 +msgid " Options passed to DLLTOOL:\n" +msgstr " ïÐÃÉÉ, ÐÅÒÅÄÁ×ÁÅÍÙÅ × DLLTOOL:\n" + +#: dllwrap.c:511 +msgid " --machine \n" +msgstr " --machine <ÍÁÛÉÎÁ>\n" + +#: dllwrap.c:512 +msgid " --output-exp Generate export file.\n" +msgstr " --output-exp <×ÙÈ_ÉÍÑ> óÏÚÄÁÎÉÅ ÆÁÊÌÁ ÜËÓÐÏÒÔÁ.\n" + +#: dllwrap.c:513 +msgid " --output-lib Generate input library.\n" +msgstr " --output-lib <×ÙÈ_ÉÍÑ> óÏÚÄÁÎÉÅ ×ÈÏÄÎÏÊ ÂÉÂÌÉÏÔÅËÉ.\n" + +#: dllwrap.c:514 +msgid " --add-indirect Add dll indirects to export file.\n" +msgstr " --add-indirect äÏÂÁ×ÌÅÎÉÅ ÎÅÐÒÑÍÙÈ dll × ÆÁÊÌ ÜËÓÐÏÒÔÁ.\n" + +#: dllwrap.c:515 +msgid " --dllname Name of input dll to put into output lib.\n" +msgstr " --dllname <ÉÍÑ> éÍÑ ×ÈÏÄÎÏÊ dll ÄÌÑ ÐÏÍÅÝÅÎÉÑ × ×ÙÈÏÄÎÕÀ ÂÉÂÌÉÏÔÅËÕ.\n" + +#: dllwrap.c:516 +msgid " --def Name input .def file\n" +msgstr " --def éÍÑ ×ÈÏÄÎÏÇÏ ÆÁÊÌÁ .def\n" + +#: dllwrap.c:517 +msgid " --output-def Name output .def file\n" +msgstr " --output-def éÍÑ ×ÙÈÏÄÎÏÇÏ ÆÁÊÌÁ .def\n" + +#: dllwrap.c:518 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols üËÓÐÏÒÔ ×ÓÅÈ ÓÉÍ×ÏÌÏ× × .def\n" + +#: dllwrap.c:519 +msgid " --no-export-all-symbols Only export .drectve symbols\n" +msgstr " --no-export-all-symbols üËÓÐÏÒÔ ÔÏÌØËÏ ÓÉÍ×ÏÌÏ× .drectve\n" + +#: dllwrap.c:520 +msgid " --exclude-symbols Exclude from .def\n" +msgstr " --exclude-symbols <ÓÐÉÓÏË> éÓËÌÀÞÉÔØ <ÓÐÉÓÏË> ÉÚ .def\n" + +#: dllwrap.c:521 +msgid " --no-default-excludes Zap default exclude symbols\n" +msgstr " --no-default-excludes õÄÁÌÅÎÉÅ ÓÉÍ×ÏÌÏ× ÉÓËÌÀÞÅÎÉÑ ÐÏ ÕÍÏÌÞÁÎÉÀ\n" + +#: dllwrap.c:522 +msgid " --base-file Read linker generated base file\n" +msgstr " --base-file þÔÅÎÉÅ ÓÏÚÄÁÎÎÏÇÏ ËÏÍÐÏÎÏ×ÝÉËÏÍ base-ÆÁÊÌÁ.\n" + +#: dllwrap.c:523 +msgid " --no-idata4 Don't generate idata$4 section\n" +msgstr " --no-idata4 îÅ ÓÏÚÄÁ×ÁÔØ ÒÁÚÄÅÌ idata$4.\n" + +#: dllwrap.c:524 +msgid " --no-idata5 Don't generate idata$5 section\n" +msgstr " --no-idata5 îÅ ÓÏÚÄÁ×ÁÔØ ÒÁÚÄÅÌ idata$5.\n" + +#: dllwrap.c:525 +msgid " -U Add underscores to .lib\n" +msgstr " -U äÏÂÁ×ÌÅÎÉÅ ÓÉÍ×ÏÌÏ× ÐÏÄÞÅÒËÉ×ÁÎÉÑ × .lib\n" + +#: dllwrap.c:526 +msgid " -k Kill @ from exported names\n" +msgstr " -k õÄÁÌÅÎÉÅ @ ÉÚ ÜËÓÐÏÒÔÉÒÏ×ÁÎÎÙÈ ÉÍÅÎ.\n" + +#: dllwrap.c:527 +msgid " --add-stdcall-alias Add aliases without @\n" +msgstr " --add-stdcall-alias äÏÂÁ×ÌÅÎÉÅ ÁÌÉÁÓÏ× ÂÅÚ @\n" + +#: dllwrap.c:528 +msgid " --as Use for assembler\n" +msgstr " --as <ÉÍÑ> éÓÐÏÌØÚÏ×ÁÎÉÅ <ÉÍÅÎÉ> ÄÌÑ ÁÓÓÅÍÂÌÅÒÁ\n" + +#: dllwrap.c:529 +msgid " --nodelete Keep temp files.\n" +msgstr " --nodelete ïÓÔÁ×ÌÑÔØ ×ÒÅÍÅÎÎÙÅ ÆÁÊÌÙ.\n" + +#: dllwrap.c:530 +msgid " Rest are passed unmodified to the language driver\n" +msgstr " ïÓÔÁÌØÎÏÅ ÂÅÚ ÉÚÍÅÎÅÎÉÊ ÐÅÒÅÄÁÎÏ ÑÚÙËÏ×ÏÍÕ ÄÒÁÊ×ÅÒÕ\n" + +#: dllwrap.c:802 +msgid "Must provide at least one of -o or --dllname options" +msgstr "îÅÏÂÈÏÄÉÍÏ ÐÒÅÄÏÓÔÁ×ÉÔØ ÐÏ ËÒÁÊÎÅÊ ÍÅÒÅ ÏÄÎÕ ÉÚ ÏÐÃÉÊ -o ÉÌÉ --dllname" + +#: dllwrap.c:830 +msgid "" +"no export definition file provided.\n" +"Creating one, but that may not be what you want" +msgstr "" +"ÎÅ ÐÒÅÄÏÓÔÁ×ÌÅÎ ÆÁÊÌ ÏÐÉÓÁÎÉÑ ÜËÓÐÏÒÔÁ.\n" +"ïÎ ÓÏÚÄÁÅÔÓÑ, ÎÏ ÜÔÏ ÍÏÖÅÔ ÂÙÔØ ÎÅ ÔÏ, ÞÔÏ ×ÁÍ ÎÕÖÎÏ" + +#: dllwrap.c:992 +#, c-format +msgid "DLLTOOL name : %s\n" +msgstr "DLLTOOL ÉÍÑ : %s\n" + +#: dllwrap.c:993 +#, c-format +msgid "DLLTOOL options : %s\n" +msgstr "DLLTOOL ÏÐÃÉÉ : %s\n" + +#: dllwrap.c:994 +#, c-format +msgid "DRIVER name : %s\n" +msgstr "DRIVER ÉÍÑ : %s\n" + +#: dllwrap.c:995 +#, c-format +msgid "DRIVER options : %s\n" +msgstr "DRIVER ÏÐÃÉÉ : %s\n" + +#: emul_aix.c:58 +#, c-format +msgid " [-g] - 32 bit small archive\n" +msgstr " [-g] - 32-ÂÉÔÎÙÊ ÍÁÌÅÎØËÉÊ ÁÒÈÉ×\n" + +#: emul_aix.c:59 +msgid " [-X32] - ignores 64 bit objects\n" +msgstr " [-X32] - ÐÒÏÐÕÓËÁÅÔ 64-ÂÉÔÎÙÅ ÏÂßÅËÔÙ\n" + +#: emul_aix.c:60 +msgid " [-X64] - ignores 32 bit objects\n" +msgstr " [-X64] - ÐÒÏÐÕÓËÁÅÔ 32-ÂÉÔÎÙÅ ÏÂßÅËÔÙ\n" + +#: emul_aix.c:61 +msgid " [-X32_64] - accepts 32 and 64 bit objects\n" +msgstr " [-X32_64] - ÄÏÐÕÓËÁÅÔ 32- É 64-ÂÉÔÎÙÅ ÏÂßÅËÔÙ\n" + +#: ieee.c:326 +msgid "unexpected end of debugging information" +msgstr "ÎÅÏÖÉÄÁÎÎÏÅ ÏËÏÎÞÁÎÉÅ ÏÔÌÁÄÏÞÎÏÊ ÉÎÆÏÒÍÁÃÉÉ" + +#: ieee.c:421 +msgid "invalid number" +msgstr "ÎÅ×ÅÒÎÙÊ ÎÏÍÅÒ" + +#: ieee.c:480 +msgid "invalid string length" +msgstr "ÎÅ×ÅÒÎÁÑ ÄÌÉÎÁ ÓÔÒÏËÉ" + +#: ieee.c:537 ieee.c:578 +msgid "expression stack overflow" +msgstr "ÐÅÒÅÐÏÌÎÅÎÉÅ ÓÔÅËÁ ×ÙÒÁÖÅÎÉÑ" + +#: ieee.c:557 +msgid "unsupported IEEE expression operator" +msgstr "ÎÅÐÏÄÄÅÒÖÉ×ÁÅÍÙÊ ÏÐÅÒÁÔÏÒ ×ÙÒÁÖÅÎÉÑ IEEE" + +#: ieee.c:572 +msgid "unknown section" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ÒÁÚÄÅÌ" + +#: ieee.c:593 +msgid "expression stack underflow" +msgstr "ÏÐÕÓÔÏÛÅÎÉÅ ÓÔÅËÁ ×ÙÒÁÖÅÎÉÑ" + +#: ieee.c:607 +msgid "expression stack mismatch" +msgstr "ÎÅÓÏ×ÐÁÄÅÎÉÅ ÓÔÅËÁ ×ÙÒÁÖÅÎÉÑ" + +#: ieee.c:646 +msgid "unknown builtin type" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ×ÓÔÒÏÅÎÎÙÊ ÔÉÐ" + +#: ieee.c:791 +msgid "BCD float type not supported" +msgstr "ä×ÏÉÞÎÏ-ËÏÄÉÒÏ×ÁÎÎÙÊ ÄÅÓÑÔÉÞÎÙÊ ÔÉÐ Ó ÐÌÁ×ÁÀÝÅÊ ÚÁÐÑÔÏÊ ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ" + +#: ieee.c:937 +msgid "unexpected number" +msgstr "ÎÅÏÖÉÄÁÎÎÏÅ ÞÉÓÌÏ" + +#: ieee.c:944 +msgid "unexpected record type" +msgstr "ÎÅÏÖÉÄÁÎÎÙÊ ËÏÍÂÉÎÉÒÏ×ÁÎÎÙÊ ÔÉÐ" + +#: ieee.c:977 +msgid "blocks left on stack at end" +msgstr "× ËÏÎÃÅ ÓÔÅËÁ ÏÓÔÁÌÉÓØ ÂÌÏËÉ" + +#: ieee.c:1242 +msgid "unknown BB type" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ÔÉÐ BB" + +#: ieee.c:1251 +msgid "stack overflow" +msgstr "ÐÅÒÅÐÏÌÎÅÎÉÅ ÓÔÅËÁ" + +#: ieee.c:1276 +msgid "stack underflow" +msgstr "ÏÐÕÓÔÏÛÅÎÉÅ ÓÔÅËÁ" + +#: ieee.c:1390 ieee.c:1462 ieee.c:2161 +msgid "illegal variable index" +msgstr "ÎÅ×ÅÒÎÙÊ ÉÎÄÅËÓ ÐÅÒÅÍÅÎÎÏÊ" + +#: ieee.c:1440 +msgid "illegal type index" +msgstr "ÎÅ×ÅÒÎÙÊ ÉÎÄÅËÓ ÔÉÐÁ" + +#: ieee.c:1450 ieee.c:1487 +msgid "unknown TY code" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ËÏÄ TY" + +#: ieee.c:1469 +msgid "undefined variable in TY" +msgstr "ÎÅÏÐÒÅÄÅÌÅÎÎÁÑ ÐÅÒÅÍÅÎÎÁÑ × TY" + +#. Pascal file name. FIXME. +#: ieee.c:1880 +msgid "Pascal file name not supported" +msgstr "éÍÑ ÆÁÊÌÁ Pascal ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ" + +#: ieee.c:1928 +msgid "unsupported qualifier" +msgstr "ÎÅÐÏÄÄÅÒÖÉ×ÁÅÍÙÊ ËÌÁÓÓÉÆÉËÁÔÏÒ" + +#: ieee.c:2199 +msgid "undefined variable in ATN" +msgstr "ÎÅÏÐÒÅÄÅÌÅÎÎÁÑ ÐÅÒÅÍÅÎÎÁÑ × ATN" + +#: ieee.c:2242 +msgid "unknown ATN type" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ÔÉÐ ATN" + +#. Reserved for FORTRAN common. +#: ieee.c:2364 +msgid "unsupported ATN11" +msgstr "ÎÅÐÏÄÄÅÒÖÉ×ÁÅÍÙÊ ATN11" + +#. We have no way to record this information. FIXME. +#: ieee.c:2391 +msgid "unsupported ATN12" +msgstr "ÎÅÐÏÄÄÅÒÖÉ×ÁÅÍÙÊ ATN12" + +#: ieee.c:2451 +msgid "unexpected string in C++ misc" +msgstr "ÎÅÏÖÉÄÁÎÎÁÑ ÓÔÒÏËÁ × C++ misc" + +#: ieee.c:2464 +msgid "bad misc record" +msgstr "ÐÌÏÈÁÑ ÚÁÐÉÓØ misc" + +#: ieee.c:2507 +msgid "unrecognized C++ misc record" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÁÑ C++ ÚÁÐÉÓØ misc" + +#: ieee.c:2624 +msgid "undefined C++ object" +msgstr "ÎÅÏÐÒÅÄÅÌÅÎÎÙÊ ÏÂßÅËÔ C++" + +#: ieee.c:2658 +msgid "unrecognized C++ object spec" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÁÑ ÓÐÅÃÉÆÉËÁÃÉÑ ÏÂßÅËÔÁ C++" + +#: ieee.c:2694 +msgid "unsupported C++ object type" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÙÊ ÔÉÐ ÏÂßÅËÔÁ C++" + +#: ieee.c:2704 +msgid "C++ base class not defined" +msgstr "ÂÁÚÏ×ÙÊ ËÌÁÓÓ C++ ÎÅ ÏÐÒÅÄÅÌÅÎ" + +#: ieee.c:2716 ieee.c:2821 +msgid "C++ object has no fields" +msgstr "ÏÂßÅËÔ C++ ÎÅ ÉÍÅÅÔ ÐÏÌÅÊ" + +#: ieee.c:2735 +msgid "C++ base class not found in container" +msgstr "ÂÁÚÏ×ÙÊ ËÌÁÓÓ C++ ÎÅ ÎÁÊÄÅÎ × ËÏÎÅÊÎÅÒÅ" + +#: ieee.c:2842 +msgid "C++ data member not found in container" +msgstr "ÜÌÅÍÅÎÔ ËÌÁÓÓÁ C++ ÎÅ ÎÁÊÄÅÎ × ËÏÎÔÅÊÎÅÒÅ" + +#: ieee.c:2883 ieee.c:3033 +msgid "unknown C++ visibility" +msgstr "ÎÅÉÚ×ÅÓÔÎÁÑ ×ÉÄÉÍÏÓÔØ C++" + +#: ieee.c:2917 +msgid "bad C++ field bit pos or size" +msgstr "ÎÅ×ÅÒÎÙÊ Ä×ÏÉÞÎÙÊ ÒÁÚÒÑÄ ÉÌÉ ÒÁÚÍÅÒ ÐÏÌÑ C++" + +#: ieee.c:3009 +msgid "bad type for C++ method function" +msgstr "ÎÅ×ÅÒÎÙÊ ÔÉÐ ÆÕÎËÃÉÉ ÍÅÔÏÄÁ C++" + +#: ieee.c:3019 +msgid "no type information for C++ method function" +msgstr "ÎÅÔ ÉÎÆÏÒÍÁÃÉÉ Ï ÔÉÐÅ ÄÌÑ ÆÕÎËÃÉÉ ÍÅÔÏÄÁ C++" + +#: ieee.c:3058 +msgid "C++ static virtual method" +msgstr "ÓÔÁÔÉÞÅÓËÉÊ ×ÉÒÔÕÁÌØÎÙÊ ÍÅÔÏÄ C++" + +#: ieee.c:3153 +msgid "unrecognized C++ object overhead spec" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÁÑ ÓÌÕÖÅÂÎÁÑ ÓÐÅÃÉÆÉËÁÃÉÑ ÏÂßÅËÔÁ C++" + +#: ieee.c:3192 +msgid "undefined C++ vtable" +msgstr "ÎÅÏÐÒÅÄÅÌÅÎÎÁÑ ×ÉÒÔÕÁÌØÎÁÑ ÔÁÂÌÉÃÁ C++" + +#: ieee.c:3263 +msgid "C++ default values not in a function" +msgstr "ÚÎÁÞÅÎÉÑ C++ ÐÏ ÕÍÏÌÞÁÎÉÀ ÎÅ × ÆÕÎËÃÉÉ" + +#: ieee.c:3303 +msgid "unrecognized C++ default type" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÙÊ ÔÉÐ C++ ÐÏ ÕÍÏÌÞÁÎÉÀ" + +#: ieee.c:3334 +msgid "reference parameter is not a pointer" +msgstr "ÓÓÙÌÏÞÎÙÊ ÐÁÒÁÍÅÔÒ ÎÅ Ñ×ÌÑÅÔÓÑ ÕËÁÚÁÔÅÌÅÍ" + +#: ieee.c:3419 +msgid "unrecognized C++ reference type" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÙÊ ÓÓÙÌÏÞÎÙÊ ÔÉÐ C++" + +#: ieee.c:3501 +msgid "C++ reference not found" +msgstr "ÓÓÙÌËÁ C++ ÎÅ ÎÁÊÄÅÎÁ" + +#: ieee.c:3509 +msgid "C++ reference is not pointer" +msgstr "ÓÓÙÌËÁ C++ ÎÅ Ñ×ÌÑÅÔÓÑ ÕËÁÚÁÔÅÌÅÍ" + +#: ieee.c:3538 ieee.c:3546 +msgid "missing required ASN" +msgstr "ÏÔÓÕÔÓÔ×ÕÅÔ ÔÒÅÂÕÅÍÙÊ ASN" + +#: ieee.c:3576 ieee.c:3584 +msgid "missing required ATN65" +msgstr "ÏÔÓÕÔÓÔ×ÕÅÔ ÔÒÅÂÕÅÍÙÊ ATN65" + +#: ieee.c:3598 +msgid "bad ATN65 record" +msgstr "ÐÌÏÈÁÑ ÚÁÐÉÓØ ATN65" + +#: ieee.c:4286 +msgid "IEEE numeric overflow: 0x" +msgstr "ÞÉÓÌÏ×ÏÅ ÐÅÒÅÐÏÌÎÅÎÉÅ IEEE: 0x" + +#: ieee.c:4332 +#, c-format +msgid "IEEE string length overflow: %u\n" +msgstr "ÐÅÒÅÐÏÌÎÅÎÉÅ ÄÌÉÎÙ ÓÔÒÏËÉ IEEE: %u\n" + +#: ieee.c:5382 +#, c-format +msgid "IEEE unsupported integer type size %u\n" +msgstr "ÎÅÐÏÄÄÅÒÖÉ×ÁÅÍÙÊ ÒÁÚÍÅÒ ÃÅÌÏÇÏ ÔÉÐÁ IEEE %u\n" + +#: ieee.c:5418 +#, c-format +msgid "IEEE unsupported float type size %u\n" +msgstr "ÎÅÐÏÄÄÅÒÖÉ×ÁÅÍÙÊ ÒÁÚÍÅÒ ÔÉÐÁ Ó ÐÌÁ×ÁÀÝÅÊ ÚÁÐÑÔÏÊ IEEE %u\n" + +#: ieee.c:5454 +#, c-format +msgid "IEEE unsupported complex type size %u\n" +msgstr "ÎÅÐÏÄÄÅÒÖÉ×ÁÅÍÙÊ ÒÁÚÍÅÒ ËÏÍÐÌÅËÓÎÏÇÏ ÔÉÐÁ IEEE%u\n" + +#: nlmconv.c:282 srconv.c:2043 +msgid "input and output files must be different" +msgstr "×ÈÏÄÎÏÊ É ×ÙÈÏÄÎÏÊ ÆÁÊÌÙ ÄÏÌÖÎÙ ÂÙÔØ ÒÁÚÌÉÞÎÙÍÉ" + +#: nlmconv.c:329 +msgid "input file named both on command line and with INPUT" +msgstr "×ÈÏÄÎÏÊ ÆÁÊÌ ÎÁÚ×ÁÎ × ËÏÍÁÎÄÎÏÊ ÓÔÒÏËÅ É × INPUT" + +#: nlmconv.c:338 +msgid "no input file" +msgstr "ÎÅÔ ×ÈÏÄÎÏÇÏ ÆÁÊÌÁ" + +#: nlmconv.c:368 +msgid "no name for output file" +msgstr "ÎÅÔ ÉÍÅÎÉ ÄÌÑ ×ÙÈÏÄÎÏÇÏ ÆÁÊÌÁ" + +#: nlmconv.c:382 +msgid "warning: input and output formats are not compatible" +msgstr "ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ: ×ÈÏÄÎÏÊ É ×ÙÈÏÄÎÏÊ ÆÏÒÍÁÔÙ ÎÅ ÓÏ×ÍÅÓÔÉÍÙ" + +#: nlmconv.c:411 +msgid "make .bss section" +msgstr "ÓÏÚÄÁÎÉÅ ÒÁÚÄÅÌÁ .bss" + +#: nlmconv.c:420 +msgid "make .nlmsections section" +msgstr "ÓÏÚÄÁÎÉÅ ÒÁÚÄÅÌÁ .nlmsections" + +#: nlmconv.c:422 +msgid "set .nlmsections flags" +msgstr "ÕÓÔÁÎÏ×ËÁ ÆÌÁÇÏ× .nlmsections" + +#: nlmconv.c:450 +msgid "set .bss vma" +msgstr "ÕÓÔÁÎÏ×ËÁ .bss vma" + +#: nlmconv.c:457 +msgid "set .data size" +msgstr "ÕÓÔÁÎÏ×ËÁ ÒÁÚÍÅÒÁ .data" + +#: nlmconv.c:637 +#, c-format +msgid "warning: symbol %s imported but not in import list" +msgstr "ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ: ÓÉÍ×ÏÌ %s ÉÍÐÏÒÔÉÒÏ×ÁÎ, ÎÏ ÅÇÏ ÎÅÔ × ÓÐÉÓËÅ ÉÍÐÏÒÔÁ" + +#: nlmconv.c:657 +msgid "set start address" +msgstr "ÕÓÔÁÎÏ×ËÁ ÎÁÞÁÌØÎÏÇÏ ÁÄÒÅÓÁ" + +#: nlmconv.c:706 +#, c-format +msgid "warning: START procedure %s not defined" +msgstr "ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ: START-ÐÒÏÃÅÄÕÒÁ %s ÎÅ ÏÐÒÅÄÅÌÅÎÁ" + +#: nlmconv.c:708 +#, c-format +msgid "warning: EXIT procedure %s not defined" +msgstr "ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ: EXIT-ÐÒÏÃÅÄÕÒÁ %s ÎÅ ÏÐÒÅÄÅÌÅÎÁ" + +#: nlmconv.c:710 +#, c-format +msgid "warning: CHECK procedure %s not defined" +msgstr "ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ: CHECK-ÐÒÏÃÅÄÕÒÁ %s ÎÅ ÏÐÒÅÄÅÌÅÎÁ" + +#: nlmconv.c:731 nlmconv.c:920 +msgid "custom section" +msgstr "ÒÁÚÄÅÌ custom" + +#: nlmconv.c:752 nlmconv.c:949 +msgid "help section" +msgstr "ÒÁÚÄÅÌ help" + +#: nlmconv.c:774 nlmconv.c:967 +msgid "message section" +msgstr "ÒÁÚÄÅÌ message" + +#: nlmconv.c:790 nlmconv.c:1000 +msgid "module section" +msgstr "ÒÁÚÄÅÌ module" + +#: nlmconv.c:810 nlmconv.c:1016 +msgid "rpc section" +msgstr "ÒÁÚÄÅÌ rpc" + +#. There is no place to record this information. +#: nlmconv.c:846 +#, c-format +msgid "%s: warning: shared libraries can not have uninitialized data" +msgstr "%s: ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ: ÓÏ×ÍÅÓÔÎÏ ÉÓÐÏÌØÚÕÅÍÙÅ ÂÉÂÌÉÏÔÅËÉ ÎÅ ÍÏÇÕÔ ÉÍÅÔØ ÎÅÉÎÉÃÉÁÌÉÚÉÒÏ×ÁÎÎÙÅ ÄÁÎÎÙÅ" + +#: nlmconv.c:867 nlmconv.c:1035 +msgid "shared section" +msgstr "ÒÁÚÄÅÌ shared" + +#: nlmconv.c:875 +msgid "warning: No version number given" +msgstr "ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ: îÅ ÕËÁÚÁÎ ÎÏÍÅÒ ×ÅÒÓÉÉ" + +#: nlmconv.c:915 nlmconv.c:944 nlmconv.c:962 nlmconv.c:1011 nlmconv.c:1030 +#, c-format +msgid "%s: read: %s" +msgstr "%s: ÞÔÅÎÉÅ: %s" + +#: nlmconv.c:937 +msgid "warning: MAP and FULLMAP are not supported; try ld -M" +msgstr "ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ: MAP É FULLMAP ÎÅ ÐÏÄÄÅÒÖÉ×ÁÀÔÓÑ; ÐÏÐÒÏÂÕÊÔÅ ld -M" + +#: nlmconv.c:1109 +#, c-format +msgid "Usage: %s [option(s)] [in-file [out-file]]\n" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ: %s [ÏÐÃÉÉ] [in-ÆÁÊÌ [out-ÆÁÊÌ]]\n" + +#: nlmconv.c:1110 +msgid " Convert an object file into a NetWare Loadable Module\n" +msgstr " ëÏÎ×ÅÒÔÉÒÕÅÔ ÏÂßÅËÔÎÙÊ ÆÁÊÌ × ÚÁÇÒÕÖÁÅÍÙÊ ÍÏÄÕÌØ ÓÉÓÔÅÍÙ NetWare\n" + +#: nlmconv.c:1111 +msgid "" +" The options are:\n" +" -I --input-target= Set the input binary file format\n" +" -O --output-target= Set the output binary file format\n" +" -T --header-file= Read for NLM header information\n" +" -l --linker= Use for any linking\n" +" -d --debug Display on stderr the linker command line\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +msgstr "" +" ïÐÃÉÉ:\n" +" -I --input-target= õÓÔÁÎÏ×ËÁ ÆÏÒÍÁÔÁ ×ÈÏÄÎÏÇÏ Ä×ÏÉÞÎÏÇÏ ÆÁÊÌÁ\n" +" -O --output-target= õÓÔÁÎÏ×ËÁ ÆÏÒÍÁÔÁ ×ÙÈÏÄÎÏÇÏ Ä×ÏÉÞÎÏÇÏ ÆÁÊÌÁ\n" +" -T --header-file=<ÆÁÊÌ> þÔÅÎÉÅ <ÆÁÊÌÁ> Ó ÉÎÆÏÒÍÁÃÉÅÊ ÚÁÇÏÌÏ×ËÁ NLM\n" +" -l --linker=<ËÏÍÐÏÎÏ×ÝÉË> éÓÐÏÌØÚÏ×ÁÎÉÅ <ËÏÍÐÏÎÏ×ÝÉËÁ> ÄÌÑ ÌÀÂÏÇÏ Ó×ÑÚÙ×ÁÎÉÑ\n" +" -d --debug ÷Ù×ÏÄ ÎÁ stderr ËÏÍÁÎÄÎÏÊ ÓÔÒÏËÉ ËÏÍÐÏÎÏ×ÝÉËÁ\n" +" -h --help ÷Ù×ÏÄ ÜÔÏÊ ÉÎÆÏÒÍÁÃÉÉ\n" +" -v --version ÷Ù×ÏÄ ×ÅÒÓÉÉ ÐÒÏÇÒÁÍÍÙ\n" + +#: nlmconv.c:1153 +#, c-format +msgid "support not compiled in for %s" +msgstr "ÏÔËÏÍÐÉÌÉÒÏ×ÁÎ ÂÅÚ ÐÏÄÄÅÒÖËÉ %s" + +#: nlmconv.c:1193 +msgid "make section" +msgstr "ÒÁÚÄÅÌ make" + +#: nlmconv.c:1207 +msgid "set section size" +msgstr "ÕÓÔÁÎÏ×ËÁ ÒÁÚÍÅÒÁ ÒÁÚÄÅÌÁ" + +#: nlmconv.c:1213 +msgid "set section alignment" +msgstr "ÕÓÔÁÎÏ×ËÁ ÏÒÉÅÎÔÁÃÉÉ ÒÁÚÄÅÌÁ" + +#: nlmconv.c:1217 +msgid "set section flags" +msgstr "ÕÓÔÁÎÏ×ËÁ ÆÌÁÇÏ× ÒÁÚÄÅÌÁ" + +#: nlmconv.c:1228 +msgid "set .nlmsections size" +msgstr "ÕÓÔÁÎÏ×ËÁ ÒÁÚÍÅÒÁ .nlmsections" + +#: nlmconv.c:1316 nlmconv.c:1324 nlmconv.c:1333 nlmconv.c:1338 +msgid "set .nlmsection contents" +msgstr "ÕÓÔÁÎÏ×ËÁ ÓÏÄÅÒÖÉÍÏÇÏ .nlmsections" + +#: nlmconv.c:1839 +msgid "stub section sizes" +msgstr "ÒÁÚÍÅÒÙ ÒÁÚÄÅÌÁ ÚÁÇÌÕÛËÉ" + +#: nlmconv.c:1888 +msgid "writing stub" +msgstr "ÚÁÐÉÓÙ×ÁÅÔÓÑ ÚÁÇÌÕÛËÁ" + +#: nlmconv.c:1977 +#, c-format +msgid "unresolved PC relative reloc against %s" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÏÅ ÏÔÎÏÓÉÔÅÌØÎÏÅ ÐÅÒÅÍÅÝÅÎÉÅ ÐÏ ÓÞÅÔÞÉËÕ ËÏÍÁÎÄ × %s" + +#: nlmconv.c:2041 +#, c-format +msgid "overflow when adjusting relocation against %s" +msgstr "ÐÅÒÅÐÏÌÎÅÎÉÅ ÐÒÉ ÒÅÇÕÌÉÒÏ×ËÅ ÐÅÒÅÍÅÝÅÎÉÑ × %s" + +#: nlmconv.c:2158 +#, c-format +msgid "%s: execution of %s failed: " +msgstr "%s: ×ÙÐÏÌÎÅÎÉÅ %s ÚÁ×ÅÒÛÉÌÏÓØ ÎÅÕÄÁÞÅÊ: " + +#: nlmconv.c:2173 +#, c-format +msgid "Execution of %s failed" +msgstr "÷ÙÐÏÌÎÅÎÉÅ %s ÚÁ×ÅÒÛÉÌÏÓØ ÎÅÕÄÁÞÅÊ" + +#: nm.c:283 size.c:85 strings.c:657 +#, c-format +msgid "Usage: %s [option(s)] [file(s)]\n" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ: %s [ÏÐÃÉÉ] [ÆÁÊÌ(Ù)]\n" + +#: nm.c:284 +msgid " List symbols in [file(s)] (a.out by default).\n" +msgstr " ÷Ù×ÏÄÉÔ ÓÐÉÓÏË ÓÉÍ×ÏÌÏ× × [ÆÁÊÌ(Ù)] (ÐÏ ÕÍÏÌÞÁÎÉÀ × a.out).\n" + +#: nm.c:285 +msgid "" +" The options are:\n" +" -a, --debug-syms Display debugger-only symbols\n" +" -A, --print-file-name Print name of the input file before every symbol\n" +" -B Same as --format=bsd\n" +" -C, --demangle[=STYLE] Decode low-level symbol names into user-level names\n" +" The STYLE, if specified, can be `auto' (the default),\n" +" `gnu', `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n" +" or `gnat'\n" +" --no-demangle Do not demangle low-level symbol names\n" +" -D, --dynamic Display dynamic symbols instead of normal symbols\n" +" --defined-only Display only defined symbols\n" +" -e (ignored)\n" +" -f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',\n" +" `sysv' or `posix'. The default is `bsd'\n" +" -g, --extern-only Display only external symbols\n" +" -l, --line-numbers Use debugging information to find a filename and\n" +" line number for each symbol\n" +" -n, --numeric-sort Sort symbols numerically by address\n" +" -o Same as -A\n" +" -p, --no-sort Do not sort the symbols\n" +" -P, --portability Same as --format=posix\n" +" -r, --reverse-sort Reverse the sense of the sort\n" +" -S, --print-size Print size of defined symbols\n" +" -s, --print-armap Include index for symbols from archive members\n" +" --size-sort Sort symbols by size\n" +" -t, --radix=RADIX Use RADIX for printing symbol values\n" +" --target=BFDNAME Specify the target object format as BFDNAME\n" +" -u, --undefined-only Display only undefined symbols\n" +" -X 32_64 (ignored)\n" +" -h, --help Display this information\n" +" -V, --version Display this program's version number\n" +"\n" +msgstr "" +" ïÐÃÉÉ:\n" +" -a, --debug-syms ÷Ù×ÏÄ ÔÏÌØËÏ ÏÔÌÁÄÏÞÎÙÈ ÓÉÍ×ÏÌÏ×\n" +" -A, --print-file-name ÷Ù×ÏÄ ÉÍÅÎÉ ×ÈÏÄÎÏÇÏ ÆÁÊÌÁ ÐÅÒÅÄ ËÁÖÄÙÍ ÓÉÍ×ÏÌÏÍ\n" +" -B ôÏ ÖÅ, ÞÔÏ É --format=bsd\n" +" -C, --demangle[=óôéìø] äÅËÏÄÉÒÏ×ÁÎÉÅ ÎÉÚËÏÕÒÏ×ÎÅ×ÙÈ ÉÍÅÎ ÓÉÍ×ÏÌÏ× × ÉÍÅÎÁ\n" +" ÕÒÏ×ÎÑ ÐÏÌØÚÏ×ÁÔÅÌÑ\n" +" óôéìø, ÅÓÌÉ ÕËÁÚÁÎ, ÍÏÖÅÔ ÂÙÔØ `auto' (ÐÏ ÕÍÏÌÞÁÎÉÀ),\n" +" `gnu', `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n" +" ÉÌÉ `gnat'\n" +" --no-demangle îÅ ÒÁÓÛÉÆÒÏ×Ù×ÁÔØ ÎÉÚËÏÕÒÏ×ÎÅ×ÙÅ ÉÍÅÎÁ ÓÉÍ×ÏÌÏ×\n" +" -D, --dynamic ÷Ù×ÏÄ ÄÉÎÁÍÉÞÅÓËÉÈ ÓÉÍ×ÏÌÏ× ×ÍÅÓÔÏ ÎÏÒÍÁÌØÎÙÈ ÓÉÍ×ÏÌÏ×\n" +" --defined-only ÷Ù×ÏÄ ÔÏÌØËÏ ÏÐÒÅÄÅÌÅÎÎÙÈ ÓÉÍ×ÏÌÏ×\n" +" -e (ÐÒÏÐÕÝÅÎÁ)\n" +" -f, --format=æïòíáô éÓÐÏÌØÚÏ×ÁÎÉÅ æïòíáô × ËÁÞÅÓÔ×Å ×ÙÈÏÄÎÏÇÏ ÆÏÒÍÁÔÁ.\n" +" æïòíáô ÍÏÖÅÔ ÂÙÔØ `bsd', `sysv' ÉÌÉ `posix'. ðÏ ÕÍÏÌÞÁÎÉÀ `bsd'\n" +" -g, --extern-only ÷Ù×ÏÄ ÔÏÌØËÏ ×ÎÅÛÎÉÈ ÓÉÍ×ÏÌÏ×\n" +" -l, --line-numbers éÓÐÏÌØÚÏ×ÁÎÉÅ ÏÔÌÁÄÏÞÎÏÊ ÉÎÆÏÒÍÁÃÉÉ ÄÌÑ ÎÁÈÏÖÄÅÎÉÑ\n" +" ÉÍÅÎÉ ÆÁÊÌÁ É ÎÏÍÅÒÁ ÓÔÒÏËÉ ÄÌÑ ËÁÖÄÏÇÏ ÓÉÍ×ÏÌÁ\n" +" -n, --numeric-sort óÏÒÔÉÒÏ×ËÁ ÓÉÍ×ÏÌÏ× ÐÏ ÁÄÒÅÓÕ\n" +" -o ôÏ ÖÅ, ÞÔÏ É -A\n" +" -p, --no-sort âÅÚ ÓÏÒÔÉÒÏ×ËÉ ÓÉÍ×ÏÌÏ×\n" +" -P, --portability ôÏ ÖÅ, ÞÔÏ É --format=posix\n" +" -r, --reverse-sort óÏÒÔÉÒÏ×ËÁ × ÏÂÒÁÔÎÏÍ ÐÏÒÑÄËÅ\n" +" -S, --print-size ÷Ù×ÏÄ ÒÁÚÍÅÒÁ ÏÐÒÅÄÅÌÅÎÎÙÈ ÓÉÍ×ÏÌÏ×\n" +" -s, --print-armap ÷ËÌÀÞÅÎÉÅ ÉÎÄÅËÓÁ ÄÌÑ ÓÉÍ×ÏÌÏ× ÉÚ ÞÌÅÎÏ× ÁÒÈÉ×Á\n" +" --size-sort óÏÒÔÉÒÏ×ËÁ ÓÉÍ×ÏÌÏ× ÐÏ ÒÁÚÍÅÒÕ\n" +" -t, --radix=RADIX éÓÐÏÌØÚÏ×ÁÎÉÅ RADIX ÄÌÑ ×Ù×ÏÄÁ ÚÎÁÞÅÎÉÊ ÓÉÍ×ÏÌÏ×\n" +" --target=BFD-éíñ õËÁÚÁÎÉÅ ÃÅÌÅ×ÏÇÏ ÆÏÒÍÁÔÁ ÏÂßÅËÔÁ ËÁË BFD-éíñ\n" +" -u, --undefined-only ÷Ù×ÏÄ ÔÏÌØËÏ ÎÅ ÏÐÒÅÄÅÌÅÎÎÙÈ ÓÉÍ×ÏÌÏ×\n" +" -X 32_64 (ÐÒÏÐÕÝÅÎÁ)\n" +" -h, --help ÷Ù×ÏÄ ÜÔÏÊ ÉÎÆÏÒÍÁÃÉÉ\n" +" -V, --version ÷Ù×ÏÄ ÎÏÍÅÒÁ ×ÅÒÓÉÉ ÜÔÏÊ ÐÒÏÇÒÁÍÍÙ\n" +"\n" + +#: nm.c:319 objdump.c:250 +#, c-format +msgid "Report bugs to %s.\n" +msgstr "ïÔÞÅÔÙ Ï ÏÛÉÂËÁÈ ÏÔÐÒÁ×ÌÑÊÔÅ × %s\n" + +#: nm.c:352 +#, c-format +msgid "%s: invalid radix" +msgstr "%s: ÎÅ×ÅÒÎÙÊ radix" + +#: nm.c:377 +#, c-format +msgid "%s: invalid output format" +msgstr "%s: ÎÅ×ÅÒÎÙÊ ×ÙÈÏÄÎÏÊ ÆÏÒÍÁÔ" + +#: nm.c:494 +msgid "Only -X 32_64 is supported" +msgstr "ðÏÄÄÅÒÖÉ×ÁÅÔÓÑ ÔÏÌØËÏ -X 32_64" + +#: nm.c:514 +msgid "Using the --size-sort and --undefined-only options together" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ ×ÍÅÓÔÅ ÏÐÃÉÊ --size-sort É --undefined-only" + +#: nm.c:515 +msgid "will produce no output, since undefined symbols have no size." +msgstr "ÎÅ ÄÁÓÔ ×ÙÈÏÄÎÙÈ ÄÁÎÎÙÈ, Ô.Ë. ÎÅÏÐÒÅÄÅÌÅÎÎÙÅ ÓÉÍ×ÏÌÙ ÎÅ ÉÍÅÀÔ ÒÁÚÍÅÒÁ." + +#: nm.c:543 +#, c-format +msgid "data size %ld" +msgstr "ÒÁÚÍÅÒ ÄÁÎÎÙÈ %ld" + +#: nm.c:568 readelf.c:5809 readelf.c:5845 +#, c-format +msgid ": %d" +msgstr "<ÓÐÅÃÉÆÉÞÎÙÊ ÄÌÑ ÐÒÏÃÅÓÓÏÒÁ>: %d" + +#: nm.c:570 readelf.c:5811 readelf.c:5857 +#, c-format +msgid ": %d" +msgstr "<ÓÐÅÃÉÆÉÞÎÙÊ ÄÌÑ ïó>: %d" + +#: nm.c:572 readelf.c:5813 readelf.c:5860 +#, c-format +msgid ": %d" +msgstr "<ÎÅÉÚ×ÅÓÔÎÙÊ>: %d" + +#: nm.c:1376 +#, c-format +msgid "" +"\n" +"\n" +"Undefined symbols from %s:\n" +"\n" +msgstr "" +"\n" +"\n" +"îÅÏÐÒÅÄÅÌÅÎÎÙÅ ÓÉÍ×ÏÌÙ ÉÚ %s:\n" +"\n" + +#: nm.c:1378 +#, c-format +msgid "" +"\n" +"\n" +"Symbols from %s:\n" +"\n" +msgstr "" +"\n" +"\n" +"óÉÍ×ÏÌÙ ÉÚ %s:\n" +"\n" + +#: nm.c:1380 nm.c:1438 +msgid "" +"Name Value Class Type Size Line Section\n" +"\n" +msgstr "" +"éÍÑ úÎÁÞ. ëÌÁÓÓ ôÉÐ òÁÚÍÅÒ óÔÒÏËÁ òÁÚÄÅÌ\n" +"\n" + +#: nm.c:1383 nm.c:1441 +msgid "" +"Name Value Class Type Size Line Section\n" +"\n" +msgstr "" +"éÍÑ úÎÁÞ. ëÌÁÓÓ ôÉÐ òÁÚÍÅÒ óÔÒÏËÁ òÁÚÄÅÌ\n" +"\n" + +#: nm.c:1434 +#, c-format +msgid "" +"\n" +"\n" +"Undefined symbols from %s[%s]:\n" +"\n" +msgstr "" +"\n" +"\n" +"îÅÏÐÒÅÄÅÌÅÎÎÙÅ ÓÉÍ×ÏÌÙ ÉÚ %s[%s]:\n" +"\n" + +#: nm.c:1436 +#, c-format +msgid "" +"\n" +"\n" +"Symbols from %s[%s]:\n" +"\n" +msgstr "" +"\n" +"\n" +"óÉÍ×ÏÌÙ ÉÚ %s[%s]:\n" +"\n" + +#: nm.c:1658 +msgid "" +"\n" +"Archive index:\n" +msgstr "" +"\n" +"éÎÄÅËÓ ÁÒÈÉ×Á:\n" + +#: objcopy.c:414 srconv.c:1952 +#, c-format +msgid "Usage: %s [option(s)] in-file [out-file]\n" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ: %s [ÏÐÃÉÉ] in-ÆÁÊÌ [out-ÆÁÊÌ]\n" + +#: objcopy.c:415 +msgid " Copies a binary file, possibly transforming it in the process\n" +msgstr " ëÏÐÉÒÕÅÔ Ä×ÏÉÞÎÙÊ ÆÁÊÌ, ×ÏÚÍÏÖÎÏ, ÐÒÅÏÂÒÁÚÏ×Ù×ÁÑ ÅÇÏ × ÐÒÏÃÅÓÓÅ\n" + +#: objcopy.c:416 objcopy.c:495 +msgid " The options are:\n" +msgstr " ïÐÃÉÉ:\n" + +#: objcopy.c:417 +msgid "" +" -I --input-target Assume input file is in format \n" +" -O --output-target Create an output file in format \n" +" -B --binary-architecture Set arch of output file, when input is binary\n" +" -F --target Set both input and output format to \n" +" --debugging Convert debugging information, if possible\n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -j --only-section Only copy section into the output\n" +" --add-gnu-debuglink= Add section .gnu_debuglink linking to \n" +" -R --remove-section Remove section from the output\n" +" -S --strip-all Remove all symbol and relocation information\n" +" -g --strip-debug Remove all debugging symbols & sections\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol Do not copy symbol \n" +" -K --keep-symbol Only copy symbol \n" +" -L --localize-symbol Force symbol to be marked as a local\n" +" -G --keep-global-symbol Localize all symbols except \n" +" -W --weaken-symbol Force symbol to be marked as a weak\n" +" --weaken Force all global symbols to be marked as weak\n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -i --interleave Only copy one out of every bytes\n" +" -b --byte Select byte in every interleaved block\n" +" --gap-fill Fill gaps between sections with \n" +" --pad-to Pad the last section up to address \n" +" --set-start Set the start address to \n" +" {--change-start|--adjust-start} \n" +" Add to the start address\n" +" {--change-addresses|--adjust-vma} \n" +" Add to LMA, VMA and start addresses\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" Change LMA and VMA of section by \n" +" --change-section-lma {=|+|-}\n" +" Change the LMA of section by \n" +" --change-section-vma {=|+|-}\n" +" Change the VMA of section by \n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" Warn if a named section does not exist\n" +" --set-section-flags =\n" +" Set section 's properties to \n" +" --add-section = Add section found in to output\n" +" --rename-section =[,] Rename section to \n" +" --change-leading-char Force output format's leading character style\n" +" --remove-leading-char Remove leading character from global symbols\n" +" --redefine-sym = Redefine symbol name to \n" +" --redefine-syms --redefine-sym for all symbol pairs \n" +" listed in \n" +" --srec-len Restrict the length of generated Srecords\n" +" --srec-forceS3 Restrict the type of generated Srecords to S3\n" +" --strip-symbols -N for all symbols listed in \n" +" --keep-symbols -K for all symbols listed in \n" +" --localize-symbols -L for all symbols listed in \n" +" --keep-global-symbols -G for all symbols listed in \n" +" --weaken-symbols -W for all symbols listed in \n" +" --alt-machine-code Use alternate machine code for output\n" +" --prefix-symbols Add to start of every symbol name\n" +" --prefix-sections Add to start of every section name\n" +" --prefix-alloc-sections \n" +" Add to start of every allocatable\n" +" section name\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +" --info List object formats & architectures supported\n" +msgstr "" +" -I --input-target ðÏÄÒÁÚÕÍÅ×ÁÅÔÓÑ ×ÈÏÄÎÏÊ ÆÁÊÌ × ÆÏÒÍÁÔÅ \n" +" -O --output-target óÏÚÄÁÔØ ×ÙÈÏÄÎÏÊ ÆÁÊÌ × ÆÏÒÍÁÔÅ \n" +" -B --binary-architecture <ÁÒÈ> õÓÔÁÎÏ×ÉÔØ ÁÒÈÉÔÅËÔÕÒÕ ÄÌÑ ×ÙÈÏÄÎÏÇÏ ÆÁÊÌÁ, ËÏÇÄÁ ×ÈÏÄÎÏÊ ÆÁÊÌ Ä×ÏÉÞÎÙÊ\n" +" -F --target õÓÔÁÎÏ×ÉÔØ ×ÈÏÄÎÏÊ É ×ÙÈÏÄÎÏÊ ÆÏÒÍÁÔÙ × \n" +" --debugging ðÒÅÏÂÒÁÚÏ×ÁÔØ ÏÔÌÁÄÏÞÎÕÀ ÉÎÆÏÒÍÁÃÉÀ, ÅÓÌÉ ÜÔÏ ×ÏÚÍÏÖÎÏ\n" +" -p --preserve-dates ëÏÐÉÒÏ×ÁÔØ ×ÒÅÍÑ ÍÏÄÉÆÉËÁÃÉÉ/ÄÏÓÔÕÐÁ ÎÁ ×Ù×ÏÄ\n" +" -j --only-section <ÉÍÑ> ëÏÐÉÒÏ×ÁÔØ ÒÁÚÄÅÌ <ÉÍÑ> ÎÁ ×Ù×ÏÄ\n" +" --add-gnu-debuglink=<ÆÁÊÌ> äÏÂÁ×ÌÅÎÉÅ Ó×ÑÚÙ×ÁÎÉÑ ÒÁÚÄÅÌÁ .gnu_debuglink × <ÆÁÊÌ>\n" +" -R --remove-section <ÉÍÑ> õÄÁÌÉÔØ ÒÁÚÄÅÌ <ÉÍÑ> ÉÚ ×Ù×ÏÄÁ\n" +" -S --strip-all õÄÁÌÉÔØ ×ÓÅ ÓÉÍ×ÏÌÙ É ÉÎÆÏÒÍÁÃÉÀ Ï ÐÅÒÅÍÅÝÅÎÉÉ\n" +" -g --strip-debug õÄÁÌÉÔØ ×ÓÅ ÏÔÌÁÄÏÞÎÙÅ ÓÉÍ×ÏÌÙ É ÒÁÚÄÅÌÙ\n" +" --strip-unneeded õÄÁÌÉÔØ ×ÓÅ ÓÉÍ×ÏÌÙ, ÎÅ ÎÕÖÎÙÅ ÄÌÑ ÐÅÒÅÍÅÝÅÎÉÊ\n" +" -N --strip-symbol <ÉÍÑ> îÅ ËÏÐÉÒÏ×ÁÔØ ÓÉÍ×ÏÌ <ÉÍÑ>\n" +" -K --keep-symbol <ÉÍÑ> ëÏÐÉÒÏ×ÁÔØ ÔÏÌØËÏ ÓÉÍ×ÏÌ <ÉÍÑ>\n" +" -L --localize-symbol <ÉÍÑ> ðÒÉÎÕÄÉÔÅÌØÎÏ ÐÏÍÅÞÁÔØ ÓÉÍ×ÏÌ <ÉÍÑ> ËÁË ÌÏËÁÌØÎÙÊ\n" +" -G --keep-global-symbol <ÉÍÑ> ìÏËÁÌÉÚÏ×ÁÔØ ×ÓÅ ÓÉÍ×ÏÌÙ ËÒÏÍÅ <ÉÍÑ>\n" +" -W --weaken-symbol <ÉÍÑ> ðÒÉÎÕÄÉÔÅÌØÎÏ ÐÏÍÅÔÉÔØ ÓÉÍ×ÏÌ <ÉÍÑ> ËÁË ÓÌÁÂÙÊ\n" +" --weaken ðÒÉÎÕÄÉÔÅÌØÎÏ ÐÏÍÅÔÉÔØ ÇÌÏÂÁÌØÎÙÅ ÓÉÍ×ÏÌÙ ËÁË ÓÌÁÂÙÅ\n" +" -x --discard-all õÄÁÌÉÔØ ×ÓÅ ÎÅÇÌÏÂÁÌØÎÙÅ ÓÉÍ×ÏÌÙ\n" +" -X --discard-locals õÄÁÌÉÔØ ÌÀÂÙÅ ÓÉÍ×ÏÌÙ, ÓÇÅÎÅÒÉÒÏ×ÁÎÎÙÅ ËÏÍÐÉÌÑÔÏÒÏÍ\n" +" -i --interleave <ÞÉÓÌÏ> ëÏÐÉÒÏ×ÁÔØ ÔÏÌØËÏ ÏÄÉÎ ÂÁÊÔ ÞÅÒÅÚ ËÁÖÄÏÅ <ÞÉÓÌÏ> ÂÁÊÔ\n" +" -b --byte <ÎÏÍÅÒ> ÷ÙÂÒÁÔØ ÂÁÊÔ <ÎÏÍÅÒ> × ËÁÖÄÏÍ ÞÅÒÅÄÕÀÝÅÍÓÑ ÂÌÏËÅ\n" +" --gap-fill <ÚÎÁÞÅÎÉÅ> úÁÐÏÌÎÉÔØ ÐÒÏÍÅÖÕÔËÉ ÍÅÖÄÕ ÒÁÚÄÅÌÁÍÉ <ÚÎÁÞÅÎÉÅÍ>\n" +" --pad-to <ÁÄÒÅÓ> úÁÐÏÌÎÉÔØ ÐÏÓÌÅÄÎÉÊ ÒÁÚÄÅÌ ÄÏ ÁÄÒÅÓÁ <ÁÄÒÅÓ>\n" +" --set-start <ÁÄÒÅÓ> õÓÔÁÎÏ×ÉÔØ ÎÁÞÁÌØÎÙÊ ÁÄÒÅÓ × <ÁÄÒÅÓ>\n" +" {--change-start|--adjust-start} <ÐÒÉÒÁÝÅÎÉÅ>\n" +" äÏÂÁ×ÉÔØ <ÐÒÉÒÁÝÅÎÉÅ> Ë ÎÁÞÁÌØÎÏÍÕ ÁÄÒÅÓÕ\n" +" {--change-addresses|--adjust-vma} <ÐÒÉÒÁÝÅÎÉÅ>\n" +" äÏÂÁ×ÉÔØ <ÐÒÉÒÁÝÅÎÉÅ> Ë LMA, VMA É ÎÁÞÁÌØÎÏÍÕ ÁÄÒÅÓÁÍ\n" +" {--change-section-address|--adjust-section-vma} <ÉÍÑ>{=|+|-}<ÚÎÁÞÅÎÉÅ>\n" +" éÚÍÅÎÉÔØ LMA É VMA ÒÁÚÄÅÌÁ <ÉÍÑ> ÎÁ <ÚÎÁÞÅÎÉÅ>\n" +" --change-section-lma <ÉÍÑ>{=|+|-}<ÚÎÁÞÅÎÉÅ>\n" +" éÚÍÅÎÉÔØ LMA ÒÁÚÄÅÌÁ <ÉÍÑ> ÎÁ <ÚÎÁÞÅÎÉÅ>\n" +" --change-section-vma <ÉÍÑ>{=|+|-}<ÚÎÁÞÅÎÉÅ>\n" +" éÚÍÅÎÉÔØ VMA ÒÁÚÄÅÌÁ <ÉÍÑ> ÎÁ <ÚÎÁÞÅÎÉÅ>\n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" ðÒÅÄÕÐÒÅÄÉÔØ, ÅÓÌÉ ÎÁÚ×ÁÎÎÙÊ ÒÁÚÄÅÌ ÎÅ ÓÕÝÅÓÔ×ÕÅÔ\n" +" --set-section-flags <ÉÍÑ>=<ÆÌÁÇÉ>\n" +" õÓÔÁÎÏ×ÉÔØ Ó×ÏÊÓÔ×Á ÒÁÚÄÅÌÁ <ÉÍÑ> × <ÆÌÁÇÉ>\n" +" --add-section <ÉÍÑ>=<ÆÁÊÌ> äÏÂÁ×ÉÔØ ÒÁÚÄÅÌ <ÉÍÑ>, ÎÁÊÄÅÎÎÙÊ × <ÆÁÊÌÅ>, ÎÁ ×Ù×ÏÄ\n" +" --rename-section <ÓÔÁÒ>=<ÎÏ×>[,<ÆÌÁÇÉ>] ðÅÒÅÉÍÅÎÏ×ÁÔØ ÒÁÚÄÅÌ <ÓÔÁÒ> ÎÁ <ÎÏ×>\n" +" --change-leading-char ðÒÉÎÕÄÉÔÅÌØÎÏ ÉÓÐÏÌØÚÏ×ÁÔØ ÓÔÉÌØ ÚÁÇÌÁ×ÎÏÇÏ ÓÉÍ×ÏÌÁ ÄÌÑ ×ÙÈÏÄÎÏÇÏ ÆÏÒÍÁÔÁ\n" +" --remove-leading-char õÄÁÌÉÔØ ÚÁÇÌÁ×ÎÙÊ ÓÉÍ×ÏÌ ÉÚ ÇÌÏÂÁÌØÎÙÈ ÓÉÍ×ÏÌÏ×\n" +" --redefine-sym <ÓÔÁÒ>=<ÎÏ×> ðÅÒÅÏÐÒÅÄÅÌÉÔØ ÉÍÑ ÓÉÍ×ÏÌÁ <ÓÔÁÒ> ÎÁ <ÎÏ×>\n" +" --redefine-syms <ÆÁÊÌ> --redefine-sym ÄÌÑ ×ÓÅÈ ÐÁÒ ÓÉÍ×ÏÌÏ×,\n" +" ÐÅÒÅÞÉÓÌÅÎÎÙÈ × <ÆÁÊÌÅ>\n" +" --srec-len <ÞÉÓÌÏ> ïÇÒÁÎÉÞÉÔØ ÄÌÉÎÕ ÓÏÚÄÁÎÎÙÈ S-ÚÁÐÉÓÅÊ\n" +" --srec-forceS3 ïÇÒÁÎÉÞÉÔØ ÔÉÐ ÓÏÚÄÁÎÎÙÈ S-ÚÁÐÉÓÅÊ ÄÏ S3\n" +" --strip-symbols <ÆÁÊÌ> -N ÄÌÑ ×ÓÅÈ ÓÉÍÏÌÏ×, ÐÅÒÅÞÉÓÌÅÎÎÙÈ × <ÆÁÊÌÅ>\n" +" --keep-symbols <ÆÁÊÌ> -K ÄÌÑ ×ÓÅÈ ÓÉÍÏÌÏ×, ÐÅÒÅÞÉÓÌÅÎÎÙÈ × <ÆÁÊÌÅ>\n" +" --localize-symbols <ÆÁÊÌ> -L ÄÌÑ ×ÓÅÈ ÓÉÍÏÌÏ×, ÐÅÒÅÞÉÓÌÅÎÎÙÈ × <ÆÁÊÌÅ>\n" +" --keep-global-symbols <ÆÁÊÌ> -G ÄÌÑ ×ÓÅÈ ÓÉÍÏÌÏ×, ÐÅÒÅÞÉÓÌÅÎÎÙÈ × <ÆÁÊÌÅ>\n" +" --weaken-symbols <ÆÁÊÌ> -W ÄÌÑ ×ÓÅÈ ÓÉÍÏÌÏ×, ÐÅÒÅÞÉÓÌÅÎÎÙÈ × <ÆÁÊÌÅ>\n" +" --alt-machine-code <ÉÎÄÅËÓ> éÓÐÏÌØÚÏ×ÁÔØ ÁÌØÔÅÒÎÁÔÉ×ÎÙÊ ËÏÄ ÍÁÛÉÎÙ ÄÌÑ ×Ù×ÏÄÁ\n" +" --prefix-symbols <ÐÒÅÆÉËÓ> äÏÂÁ×ÉÔØ <ÐÒÅÆÉËÓ> × ÎÁÞÁÌÏ ÉÍÅÎÉ ËÁÖÄÏÇÏ ÓÉÍ×ÏÌÁ\n" +" --prefix-sections <ÐÒÅÆÉËÓ> äÏÂÁ×ÉÔØ <ÐÒÅÆÉËÓ> × ÎÁÞÁÌÏ ÉÍÅÎÉ ËÁÖÄÏÇÏ ÒÁÚÄÅÌÁ\n" +" --prefix-alloc-sections <ÐÒÅÆÉËÓ>\n" +" äÏÂÁ×ÉÔØ <ÐÒÅÆÉËÓ> × ÎÁÞÁÌÏ ÉÍÅÎÉ ËÁÖÄÏÇÏ\n" +" ÎÁÚÎÁÞÁÅÍÏÇÏ ÒÁÚÄÅÌÁ\n" +" -v --verbose ðÅÒÅÞÉÓÌÉÔØ ×ÓÅ ÍÏÄÉÆÉÃÉÒÏ×ÁÎÎÙÅ ÏÂßÅËÔÎÙÅ ÆÁÊÌÙ\n" +" -V --version ÷Ù×ÅÓÔÉ ÎÏÍÅÒ ×ÅÒÓÉÉ ÜÔÏÊ ÐÒÏÇÒÁÍÍÙ\n" +" -h --help ÷Ù×ÅÓÔÉ ÜÔÕ ÓÐÒÁ×ËÕ\n" +" --info ðÅÒÅÞÉÓÌÉÔØ ÐÏÄÄÅÒÖÉ×ÁÅÍÙÅ ÆÏÒÍÁÔÙ ÏÂßÅËÔÏ× É ÁÒÈÉÔÅËÔÕÒÙ\n" + +#: objcopy.c:493 +#, c-format +msgid "Usage: %s in-file(s)\n" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ: %s <ÏÐÃÉÉ> in-ÆÁÊÌ(Ù)\n" + +#: objcopy.c:494 +msgid " Removes symbols and sections from files\n" +msgstr " õÄÁÌÑÅÔ ÓÉÍ×ÏÌÙ É ÒÁÚÄÅÌÙ ÉÚ ÆÁÊÌÏ×\n" + +#: objcopy.c:496 +msgid "" +" -I --input-target= Assume input file is in format \n" +" -O --output-target= Create an output file in format \n" +" -F --target= Set both input and output format to \n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -R --remove-section= Remove section from the output\n" +" -s --strip-all Remove all symbol and relocation information\n" +" -g -S -d --strip-debug Remove all debugging symbols & sections\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol= Do not copy symbol \n" +" -K --keep-symbol= Only copy symbol \n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +" --info List object formats & architectures supported\n" +" -o Place stripped output into \n" +msgstr "" +" -I --input-target= ðÏÄÒÁÚÕÍÅ×ÁÅÔÓÑ ×ÈÏÄÎÏÊ ÆÁÊÌ × ÆÏÒÍÁÔÅ \n" +" -O --output-target= óÏÚÄÁÔØ ×ÙÈÏÄÎÏÊ ÆÁÊÌ × ÆÏÒÍÁÔÅ \n" +" -F --target= õÓÔÁÎÏ×ÉÔØ ×ÈÏÄÎÏÊ É ×ÙÈÏÄÎÏÊ ÆÏÒÍÁÔÙ × \n" +" -p --preserve-dates ëÏÐÉÒÏ×ÁÔØ ×ÒÅÍÑ ÍÏÄÉÆÉËÁÃÉÉ/ÄÏÓÔÕÐÁ ÎÁ ×Ù×ÏÄ\n" +" -R --remove-section <ÉÍÑ> õÄÁÌÉÔØ ÒÁÚÄÅÌ <ÉÍÑ> ÉÚ ×Ù×ÏÄÁ\n" +" -s --strip-all õÄÁÌÉÔØ ×ÓÅ ÓÉÍ×ÏÌÙ É ÉÎÆÏÒÍÁÃÉÀ Ï ÐÅÒÅÍÅÝÅÎÉÉ\n" +" -g -S -d --strip-debug õÄÁÌÉÔØ ×ÓÅ ÏÔÌÁÄÏÞÎÙÅ ÓÉÍ×ÏÌÙ É ÒÁÚÄÅÌÙ\n" +" --strip-unneeded õÄÁÌÉÔØ ×ÓÅ ÓÉÍ×ÏÌÙ, ÎÅ ÎÕÖÎÙÅ ÄÌÑ ÐÅÒÅÍÅÝÅÎÉÊ\n" +" -N --strip-symbol=<ÉÍÑ> îÅ ËÏÐÉÒÏ×ÁÔØ ÓÉÍ×ÏÌ <ÉÍÑ>\n" +" -K --keep-symbol=<ÉÍÑ> ëÏÐÉÒÏ×ÁÔØ ÔÏÌØËÏ ÓÉÍ×ÏÌ <ÉÍÑ>\n" +" -x --discard-all õÄÁÌÉÔØ ×ÓÅ ÎÅÇÌÏÂÁÌØÎÙÅ ÓÉÍ×ÏÌÙ\n" +" -X --discard-locals õÄÁÌÉÔØ ÌÀÂÙÅ ÓÉÍ×ÏÌÙ, ÓÇÅÎÅÒÉÒÏ×ÁÎÎÙÅ ËÏÍÐÉÌÑÔÏÒÏÍ\n" +" -v --verbose ðÅÒÅÞÉÓÌÉÔØ ×ÓÅ ÍÏÄÉÆÉÃÉÒÏ×ÁÎÎÙÅ ÏÂßÅËÔÎÙÅ ÆÁÊÌÙ\n" +" -V --version ÷Ù×ÅÓÔÉ ÎÏÍÅÒ ×ÅÒÓÉÉ ÜÔÏÊ ÐÒÏÇÒÁÍÍÙ\n" +" -h --help ÷Ù×ÅÓÔÉ ÜÔÕ ÓÐÒÁ×ËÕ\n" +" --info ðÅÒÅÞÉÓÌÉÔØ ÐÏÄÄÅÒÖÉ×ÁÅÍÙÅ ÆÏÒÍÁÔÙ ÏÂßÅËÔÏ× É ÁÒÈÉÔÅËÔÕÒÙ\n" +" -o <ÆÁÊÌ> ðÏÍÅÓÔÉÔØ ÇÏÌÙÅ ×ÙÈÏÄÎÙÅ ÄÁÎÎÙÅ × <ÆÁÊÌ>\n" + +#: objcopy.c:567 +#, c-format +msgid "unrecognized section flag `%s'" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÙÊ ÆÌÁÇ ÒÁÚÄÅÌÁ `%s'" + +#: objcopy.c:568 +#, c-format +msgid "supported flags: %s" +msgstr "ÎÅÐÏÄÄÅÒÖÉ×ÁÅÍÙÅ ÆÌÁÇÉ: %s" + +#: objcopy.c:645 objcopy.c:2526 +#, c-format +msgid "cannot stat: %s: %s" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ stat: %s: %s" + +#: objcopy.c:652 objcopy.c:2544 +#, c-format +msgid "cannot open: %s: %s" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ: %s: %s" + +#: objcopy.c:655 objcopy.c:2548 +#, c-format +msgid "%s: fread failed" +msgstr "%s: fread ÚÁ×ÅÒÛÉÌÓÑ ÎÅÕÄÁÞÅÊ" + +#: objcopy.c:728 +#, c-format +msgid "Ignoring rubbish found on line %d of %s" +msgstr "ðÒÏÐÕÓËÁÅÔÓÑ ÍÕÓÏÒ, ÎÁÊÄÅÎÎÙÊ × ÓÔÒÏËÅ %d ÉÚ %s" + +#: objcopy.c:979 +#, c-format +msgid "%s: Multiple redefinition of symbol \"%s\"" +msgstr "%s: íÎÏÇÏËÒÁÔÎÏÅ ÐÅÒÅÏÐÒÅÄÅÌÅÎÉÅ ÓÉÍ×ÏÌÁ \"%s\"" + +#: objcopy.c:983 +#, c-format +msgid "%s: Symbol \"%s\" is target of more than one redefinition" +msgstr "%s: óÉÍ×ÏÌ \"%s\" Ñ×ÌÑÅÔÓÑ ÃÅÌØÀ ÂÏÌÅÅ, ÞÅÍ ÏÄÎÏÇÏ ÐÅÒÅÏÐÒÅÄÅÌÅÎÉÑ" + +#: objcopy.c:1010 +#, c-format +msgid "couldn't open symbol redefinition file %s (error: %s)" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ÆÁÊÌ ÐÅÒÅÏÐÒÅÄÅÌÅÎÉÑ ÓÉÍ×ÏÌÁ %s (ÏÛÉÂËÁ: %s)" + +#: objcopy.c:1088 +#, c-format +msgid "%s: garbage at end of line %d" +msgstr "%s: ÍÕÓÏÒ × ËÏÎÃÅ ÓÔÒÏËÉ %d" + +#: objcopy.c:1091 +#, c-format +msgid "%s: missing new symbol name at line %d" +msgstr "%s: ÏÔÓÕÔÓÔ×ÕÅÔ ÉÍÑ ÎÏ×ÏÇÏ ÓÉÍ×ÏÌÁ × ÓÔÒÏËÅ %d" + +#: objcopy.c:1101 +#, c-format +msgid "%s: premature end of file at line %d" +msgstr "%s: ÐÒÅÖÄÅ×ÒÅÍÅÎÎÙÊ ËÏÎÅà ÆÁÊÌÁ × ÓÔÒÏËÅ %d" + +#: objcopy.c:1147 +msgid "Unable to change endianness of input file(s)" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÉÚÍÅÎÉÔØ endianness ×ÈÏÄÎÏÇÏ ÆÁÊÌÁ" + +#: objcopy.c:1155 +#, c-format +msgid "copy from %s(%s) to %s(%s)\n" +msgstr "ËÏÐÉÒÏ×ÁÎÉÅ ÉÚ %s(%s) × %s(%s)\n" + +#: objcopy.c:1182 +#, c-format +msgid "Warning: Output file cannot represent architecture %s" +msgstr "ðÒÅÄÕÐÒÅÖÄÅÎÉÅ: ÷ÙÈÏÄÎÏÊ ÆÁÊÌ ÎÅ ÍÏÖÅÔ ÐÒÅÄÏÓÔÁ×ÉÔØ ÁÒÈÉÔÅËÔÕÒÕ %s" + +#: objcopy.c:1211 +#, c-format +msgid "can't create section `%s': %s" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÓÏÚÄÁÔØ ÒÁÚÄÅÌ `%s': %s" + +#: objcopy.c:1304 +#, c-format +msgid "Can't fill gap after %s: %s" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÚÁÐÏÌÎÉÔØ ÐÒÏÍÅÖÕÔÏË ÐÏÓÌÅ %s: %s" + +#: objcopy.c:1329 +#, c-format +msgid "Can't add padding to %s: %s" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÄÏÂÁ×ÉÔØ ÚÁÐÏÌÎÅÎÉÅ × %s: %s" + +#: objcopy.c:1485 +#, c-format +msgid "%s: error copying private BFD data: %s" +msgstr "%s: ÏÛÉÂËÁ ËÏÐÉÒÏ×ÁÎÉÑ ÞÁÓÔÎÙÈ ÄÁÎÎÙÈ BFD: %s" + +#: objcopy.c:1498 +msgid "unknown alternate machine code, ignored" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ÁÌØÔÅÒÎÁÔÉ×ÎÙÊ ËÏÄ ÍÁÛÉÎÙ, ÐÒÏÐÕÝÅÎ" + +#: objcopy.c:1531 objcopy.c:1561 +#, c-format +msgid "cannot mkdir %s for archive copying (error: %s)" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ mkdir %s ÄÌÑ ËÏÐÉÒÏ×ÁÎÉÑ ÁÒÈÉ×Á (ÏÛÉÂËÁ: %s)" + +#: objcopy.c:1749 +#, c-format +msgid "Multiple renames of section %s" +msgstr "íÎÏÇÏËÒÁÔÎÙÅ ÐÅÒÅÉÍÅÎÏ×ÁÎÉÑ ÒÁÚÄÅÌÁ %s" + +#: objcopy.c:1840 +msgid "making" +msgstr "ÓÏÚÄÁÅÔÓÑ" + +#: objcopy.c:1849 +msgid "size" +msgstr "ÒÁÚÍÅÒ" + +#: objcopy.c:1863 +msgid "vma" +msgstr "vma" + +#: objcopy.c:1888 +msgid "alignment" +msgstr "ÏÒÉÅÎÔÁÃÉÑ" + +#: objcopy.c:1896 +msgid "flags" +msgstr "ÆÌÁÇÉ" + +#: objcopy.c:1918 +msgid "private data" +msgstr "ÞÁÓÔÎÙÅ ÄÁÎÎÙÅ" + +#: objcopy.c:1926 +#, c-format +msgid "%s: section `%s': error in %s: %s" +msgstr "%s: ÒÁÚÄÅÌ `%s': ÏÛÉÂËÁ × %s: %s" + +#: objcopy.c:2199 +#, c-format +msgid "%s: can't create debugging section: %s" +msgstr "%s: ÎÅ×ÏÚÍÏÖÎÏ ÓÏÚÄÁÔØ ÏÔÌÁÄÏÞÎÙÊ ÒÁÚÄÅÌ: %s" + +#: objcopy.c:2214 +#, c-format +msgid "%s: can't set debugging section contents: %s" +msgstr "%s: ÎÅ×ÏÚÍÏÖÎÏ ÕÓÔÁÎÏ×ÉÔØ ÓÏÄÅÒÖÉÍÏÅ ÏÔÌÁÄÏÞÎÏÇÏ ÒÁÚÄÅÌÁ: %s" + +#: objcopy.c:2223 +#, c-format +msgid "%s: don't know how to write debugging information for %s" +msgstr "%s: ÎÅ ÉÚ×ÅÓÔÎÏ, ËÁË ÚÁÐÉÓÁÔØ ÏÔÌÁÄÏÞÎÕÀ ÉÎÆÏÒÍÁÃÉÀ ÄÌÑ %s" + +#: objcopy.c:2346 +#, c-format +msgid "%s: cannot stat: %s" +msgstr "%s: ÎÅ×ÏÚÍÏÖÎÏ stat: %s" + +#: objcopy.c:2400 +msgid "byte number must be non-negative" +msgstr "ÎÏÍÅÒ ÂÁÊÔÁ ÄÏÌÖÅÎ ÂÙÔØ ÎÅÏÔÒÉÃÁÔÅÌØÎÙÍ" + +#: objcopy.c:2410 +msgid "interleave must be positive" +msgstr "ÞÅÒÅÄÏ×ÁÎÉÅ ÄÏÌÖÎÏ ÂÙÔØ ÐÏÌÏÖÉÔÅÌØÎÙÍ" + +#: objcopy.c:2430 objcopy.c:2438 +#, c-format +msgid "%s both copied and removed" +msgstr "ÏÂÁ %s ÓËÏÐÉÒÏ×ÁÎÙ É ÕÄÁÌÅÎÙ" + +#: objcopy.c:2523 objcopy.c:2593 objcopy.c:2693 objcopy.c:2724 objcopy.c:2748 +#: objcopy.c:2752 objcopy.c:2772 +#, c-format +msgid "bad format for %s" +msgstr "ÐÌÏÈÏÊ ÆÏÒÍÁÔ ÄÌÑ %s" + +#: objcopy.c:2662 +#, c-format +msgid "Warning: truncating gap-fill from 0x%s to 0x%x" +msgstr "ðÒÅÄÕÐÒÅÖÅÄÎÉÅ: ÏÂÒÅÚÁÅÔÓÑ ÚÁÐÏÌÎÅÎÉÅ ÐÒÏÍÅÖÕÔËÁ ÏÔ 0x%s ÄÏ 0x%x" + +#: objcopy.c:2818 +msgid "alternate machine code index must be positive" +msgstr "ÉÎÄÅËÓ ÁÌØÔÅÒÎÁÔÉ×ÎÏÇÏ ËÏÄÁ ÍÁÛÉÎÙ ÄÏÌÖÅÎ ÂÙÔØ ÐÏÌÏÖÉÔÅÌØÎÙÍ" + +#: objcopy.c:2856 +msgid "byte number must be less than interleave" +msgstr "ÎÏÍÅÒ ÂÁÊÔÁ ÄÏÌÖÅÎ ÂÙÔØ ÍÅÎØÛÅ ÞÅÒÅÄÏ×ÁÎÉÑ" + +#: objcopy.c:2883 +#, c-format +msgid "architecture %s unknown" +msgstr "ÁÒÈÉÔÅËÔÕÒÁ %s ÎÅ ÉÚ×ÅÓÔÎÁ" + +#: objcopy.c:2887 +msgid "Warning: input target 'binary' required for binary architecture parameter." +msgstr "ðÒÅÄÕÐÒÅÖÄÅÎÉÅ: 'Ä×ÏÉÞÎÙÊ' ÃÅÌÅ×ÏÊ ×ÈÏÄÎÏÊ ÆÁÊÌ ÔÒÅÂÕÅÔÓÑ ÄÌÑ ÐÁÒÁÍÅÔÒÁ Ä×ÏÉÞÎÏÊ ÁÒÈÉÔÅËÔÕÒÙ." + +#: objcopy.c:2888 +#, c-format +msgid " Argument %s ignored" +msgstr " áÒÇÕÍÅÎÔ %s ÐÒÏÐÕÝÅÎ" + +#: objcopy.c:2894 +#, c-format +msgid "Cannot stat: %s: %s" +msgstr "îÅ×ÏÚÍÏÖÎÏ stat: %s: %s" + +#: objcopy.c:2934 objcopy.c:2948 +#, c-format +msgid "%s %s%c0x%s never used" +msgstr "%s %s%c0x%s ÎÉËÏÇÄÁ ÎÅ ÉÓÐÏÌØÚÕÅÔÓÑ" + +#: objdump.c:197 +#, c-format +msgid "Usage: %s \n" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ: %s <ÏÐÃÉÉ> <ÆÁÊÌ(Ù)>\n" + +#: objdump.c:198 +msgid " Display information from object .\n" +msgstr " ïÔÏÂÒÁÖÁÅÔ ÉÎÆÏÒÍÁÃÉÀ ÉÚ ÏÂßÅËÔÁ <ÆÁÊÌ(Ù)>.\n" + +#: objdump.c:199 +msgid " At least one of the following switches must be given:\n" +msgstr " äÏÌÖÅÎ ÂÙÔØ ÕËÁÚÁÎ ÐÏ ËÒÁÊÎÅÊ ÍÅÒÅ ÏÄÉÎ ÉÚ ÓÌÅÄÕÀÝÉÈ ËÌÀÞÅÊ:\n" + +#: objdump.c:200 +msgid "" +" -a, --archive-headers Display archive header information\n" +" -f, --file-headers Display the contents of the overall file header\n" +" -p, --private-headers Display object format specific file header contents\n" +" -h, --[section-]headers Display the contents of the section headers\n" +" -x, --all-headers Display the contents of all headers\n" +" -d, --disassemble Display assembler contents of executable sections\n" +" -D, --disassemble-all Display assembler contents of all sections\n" +" -S, --source Intermix source code with disassembly\n" +" -s, --full-contents Display the full contents of all sections requested\n" +" -g, --debugging Display debug information in object file\n" +" -G, --stabs Display (in raw form) any STABS info in the file\n" +" -t, --syms Display the contents of the symbol table(s)\n" +" -T, --dynamic-syms Display the contents of the dynamic symbol table\n" +" -r, --reloc Display the relocation entries in the file\n" +" -R, --dynamic-reloc Display the dynamic relocation entries in the file\n" +" -v, --version Display this program's version number\n" +" -i, --info List object formats and architectures supported\n" +" -H, --help Display this information\n" +msgstr "" +" -a, --archive-headers ÷Ù×ÅÓÔÉ ÉÎÆÏÒÍÁÃÉÀ ÚÁÇÏÌÏ×ËÁ ÁÒÈÉ×Á\n" +" -f, --file-headers ÷Ù×ÅÓÔÉ ÓÏÄÅÒÖÉÍÏÅ ÚÁÇÏÌÏ×ËÁ ×ÓÅÇÏ ÆÁÊÌÁ\n" +" -p, --private-headers ÷Ù×ÅÓÔÉ ÓÏÄÅÒÖÉÍÏÅ ÚÁÇÏÌÏ×ËÁ ÆÁÊÌÁ, ÓÐÅÃÉÆÉÞÎÏÇÏ ÄÌÑ ÆÏÒÍÁÔÁ ÏÂßÅËÔÁ\n" +" -h, --[section-]headers ÷Ù×ÅÓÔÉ ÓÏÄÅÒÖÉÍÏÅ ÚÁÇÏÌÏ×ËÏ× ÒÁÚÄÅÌÏ×\n" +" -x, --all-headers ÷Ù×ÅÓÔÉ ÓÏÄÅÒÖÉÍÏÅ ×ÓÅÈ ÚÁÇÏÌÏ×ËÏ×\n" +" -d, --disassemble ÷Ù×ÅÓÔÉ ÓÏÄÅÒÖÉÍÏÅ ÁÓÓÅÍÂÌÅÒÁ ÉÓÐÏÌÎÑÅÍÙÈ ÒÁÚÄÅÌÏ×\n" +" -D, --disassemble-all ÷Ù×ÅÓÔÉ ÓÏÄÅÒÖÉÍÏÅ ÁÓÓÅÍÂÌÅÒÁ ×ÓÅÈ ÒÁÚÄÅÌÏ×\n" +" -S, --source ðÅÒÅÍÅÛÁÔØ ÉÓÈÏÄÎÙÊ ËÏÄ Ó ÄÉÚÁÓÓÅÍÂÌÉÒÏ×ÁÎÉÅÍ\n" +" -s, --full-contents ÷Ù×ÅÓÔÉ ÐÏÌÎÏÅ ÓÏÄÅÒÖÉÍÏÅ ×ÓÅÈ ÚÁÐÒÏÛÅÎÎÙÈ ÒÁÚÄÅÌÏ×\n" +" -g, --debugging ÷Ù×ÅÓÔÉ ÏÔÌÁÄÏÞÎÕÀ ÉÎÆÏÒÍÁÃÉÀ × ÏÂßÅËÔÎÏÍ ÆÁÊÌÅ\n" +" -G, --stabs ÷Ù×ÅÓÔÉ (× ÓÙÒÏÊ ÆÏÒÍÅ) ÌÀÂÕÀ ÉÎÆÏÒÍÁÃÉÀ STABS × ÆÁÊÌÅ\n" +" -t, --syms ÷Ù×ÅÓÔÉ ÓÏÄÅÒÖÉÍÏÅ ÔÁÂÌÉÃ(Ù) ÓÉÍ×ÏÌÏ×\n" +" -T, --dynamic-syms ÷Ù×ÅÓÔÉ ÓÏÄÅÒÖÉÍÏÅ ÔÁÂÌÉÃÙ ÄÉÎÁÍÉÞÅÓËÉÈ ÓÉÍ×ÏÌÏ×\n" +" -r, --reloc ÷Ù×ÅÓÔÉ ÐÕÎËÔÙ ÐÅÒÅÍÅÝÅÎÉÑ × ÆÁÊÌÅ\n" +" -R, --dynamic-reloc ÷Ù×ÅÓÔÉ ÐÕÎËÔÙ ÄÉÎÁÍÉÞÅÓËÏÇÏ ÐÅÒÅÍÅÝÅÎÉÑ × ÆÁÊÌÅ\n" +" -v, --version ÷Ù×ÅÓÔÉ ÎÏÍÅÒ ×ÅÒÓÉÉ ÜÔÏÊ ÐÒÏÇÒÁÍÍÙ\n" +" -i, --info ÷Ù×ÅÓÔÉ ÓÐÉÓÏË ÐÏÄÄÅÒÖÉ×ÁÅÍÙÈ ÆÏÒÍÁÔÏ× ÏÂßÅËÔÏ× É ÁÒÈÉÔÅËÔÕÒ\n" +" -H, --help ÷Ù×ÅÓÔÉ ÜÔÕ ÉÎÆÏÒÍÁÃÉÀ\n" + +#: objdump.c:222 +msgid "" +"\n" +" The following switches are optional:\n" +msgstr "" +"\n" +" óÌÅÄÕÀÝÉÅ ËÌÀÞÉ Ñ×ÌÑÀÔÓÑ ÏÐÃÉÏÎÁÌØÎÙÍÉ:\n" + +#: objdump.c:223 +msgid "" +" -b, --target=BFDNAME Specify the target object format as BFDNAME\n" +" -m, --architecture=MACHINE Specify the target architecture as MACHINE\n" +" -j, --section=NAME Only display information for section NAME\n" +" -M, --disassembler-options=OPT Pass text OPT on to the disassembler\n" +" -EB --endian=big Assume big endian format when disassembling\n" +" -EL --endian=little Assume little endian format when disassembling\n" +" --file-start-context Include context from start of file (with -S)\n" +" -l, --line-numbers Include line numbers and filenames in output\n" +" -C, --demangle[=STYLE] Decode mangled/processed symbol names\n" +" The STYLE, if specified, can be `auto', `gnu',\n" +" `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n" +" or `gnat'\n" +" -w, --wide Format output for more than 80 columns\n" +" -z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling\n" +" --start-address=ADDR Only process data whose address is >= ADDR\n" +" --stop-address=ADDR Only process data whose address is <= ADDR\n" +" --prefix-addresses Print complete address alongside disassembly\n" +" --[no-]show-raw-insn Display hex alongside symbolic disassembly\n" +" --adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n" +"\n" +msgstr "" +" -b, --target=BFD-éíñ õËÁÚÁÔØ ÃÅÌÅ×ÏÊ ÆÏÒÍÁÔ ÏÂßÅËÔÁ ËÁË BFD-éíñ\n" +" -m, --architecture=íáûéîá õËÁÚÁÔØ ÃÅÌÅ×ÕÀ ÁÒÈÉÔÅËÔÕÒÕ ËÁË íáûéîá\n" +" -j, --section=éíñ ÷Ù×ÅÓÔÉ ÉÎÆÏÒÍÁÃÉÀ ÔÏÌØËÏ ÄÌÑ ÒÁÚÄÅÌÁ éíñ\n" +" -M, --disassembler-options=OPT ðÅÒÅÄÁÔØ ÔÅËÓÔ OPT × ÄÉÚÁÓÓÅÍÂÌÅÒ\n" +" -EB --endian=big ðÒÅÄÐÏÌÏÖÉÔØ ÆÏÒÍÁÔ big endian ÐÒÉ ÄÉÚÁÓÓÅÍÂÌÉÒÏ×ÁÎÉÉ\n" +" -EL --endian=little ðÒÅÄÐÏÌÏÖÉÔØ ÆÏÒÍÁÔ little endian ÐÒÉ ÄÉÚÁÓÓÅÍÂÌÉÒÏ×ÁÎÉÉ\n" +" --file-start-context ÷ËÌÀÞÉÔØ ËÏÎÔÅËÓÔ ÉÚ ÎÁÞÁÌÁ ÆÁÊÌÁ (Ó -S)\n" +" -l, --line-numbers ÷ËÌÀÞÉÔØ ÎÏÍÅÒÁ ÓÔÒÏË É ÉÍÅÎÁ ÆÁÊÌÏ× ÎÁ ×Ù×ÏÄÅ\n" +" -C, --demangle[=óôéìø] äÅËÏÄÉÒÏ×ÁÔØ ÓËÏÒÒÅËÔÉÒÏ×ÁÎÎÙÅ/ÏÂÒÁÂÏÔÁÎÎÙÅ ÉÍÅÎÁ ÓÉÍ×ÏÌÏ×\n" +" óôéìø, ÅÓÌÉ ÕËÁÚÁÎ, ÍÏÖÅÔ ÂÙÔØ `auto', `gnu',\n" +" `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n" +" ÉÌÉ `gnat'\n" +" -w, --wide æÏÒÍÁÔÉÒÏ×ÁÔØ ×Ù×ÏÄ ÄÌÑ ÂÏÌÅÅ,šÞÅÍ 80 ËÏÌÏÎÏË\n" +" -z, --disassemble-zeroes îÅ ÐÒÏÐÕÓËÁÔØ ÂÌÏËÉ ÎÕÌÅÊ ÐÒÉ ÄÉÚÁÓÓÅÍÂÌÉÒÏ×ÁÎÉÉ\n" +" --start-address=áäòåó ïÂÒÁÂÏÔÁÔØ ÔÏÌØËÏ ÄÁÎÎÙÅ, ÁÄÒÅÓ ËÏÔÏÒÙÈ >= áäòåó\n" +" --stop-address=áäòåó ïÂÒÁÂÏÔÁÔØ ÔÏÌØËÏ ÄÁÎÎÙÅ, ÁÄÒÅÓ ËÏÔÏÒÙÈ <= áäòåó\n" +" --prefix-addresses ÷Ù×ÅÓÔÉ ÐÏÌÎÙÊ ÁÄÒÅÓ ÐÒÉ ÄÉÚÁÓÓÅÍÂÌÉÒÏ×ÁÎÉÉ\n" +" --[no-]show-raw-insn ÷Ù×ÅÓÔÉ hex ÐÒÉ ÓÉÍ×ÏÌÉÞÅÓËÏÍ ÄÉÚÁÓÓÅÍÂÌÉÒÏ×ÁÎÉÉ\n" +" --adjust-vma=óíåýåîéå äÏÂÁ×ÉÔØ óíåýåîéå ËÏ ×ÓÅÍ ÁÄÒÅÓÁÍ ×Ù×ÏÄÉÍÙÈ ÒÁÚÄÅÌÏ×\n" +"\n" + +#: objdump.c:391 +msgid "Sections:\n" +msgstr "òÁÚÄÅÌÙ:\n" + +#: objdump.c:394 objdump.c:398 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "éÎÄ éÍÑ òÁÚÍÅÒ VMA LMA æÁÊÌ ÷ÙÒÁ×" + +#: objdump.c:400 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "éÎÄ éÍÑ òÁÚÍÅÒ VMA LMA æÁÊÌ ÷ÙÒÁ×" + +#: objdump.c:404 +msgid " Flags" +msgstr " æÌÁÇÉ" + +#: objdump.c:406 +msgid " Pg" +msgstr " óÔÒ" + +#: objdump.c:451 +#, c-format +msgid "%s: not a dynamic object" +msgstr "%s: ÎÅ ÄÉÎÁÍÉÞÅÓËÉÊ ÏÂßÅËÔ" + +#: objdump.c:1144 +msgid "Out of virtual memory" +msgstr "îÅÈ×ÁÔËÁ ×ÉÒÔÕÁÌØÎÏÊ ÐÁÍÑÔÉ" + +#: objdump.c:1574 +#, c-format +msgid "Can't use supplied machine %s" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÉÓÐÏÌØÚÏ×ÁÔØ ÐÒÅÄÓÔÁ×ÌÅÎÎÕÀ ÍÁÛÉÎÕ %s" + +#: objdump.c:1592 +#, c-format +msgid "Can't disassemble for architecture %s\n" +msgstr "äÉÚÁÓÓÅÍÂÌÉÒÏ×ÁÎÉÅ ÎÅ×ÏÚÍÏÖÎÏ ÄÌÑ ÁÒÈÉÔÅËÔÕÒÙ %s\n" + +#: objdump.c:1682 +#, c-format +msgid "Disassembly of section %s:\n" +msgstr "äÉÁÓÓÅÍÂÌÉÒÏ×ÁÎÉÅ ÒÁÚÄÅÌÁ %s:\n" + +#: objdump.c:1847 +#, c-format +msgid "" +"No %s section present\n" +"\n" +msgstr "" +"òÁÚÄÅÌ %s ÏÔÓÕÔÓÔ×ÕÅÔ\n" +"\n" + +#: objdump.c:1854 +#, c-format +msgid "%s has no %s section" +msgstr "%s ÎÅ ÉÍÅÅÔ ÒÁÚÄÅÌÁ %s" + +#: objdump.c:1868 +#, c-format +msgid "Reading %s section of %s failed: %s" +msgstr "þÔÅÎÉÅ %s ÒÁÚÄÅÌÁ %s ÚÁ×ÅÒÛÉÌÏÓØ ÎÅÕÄÁÞÅÊ: %s" + +#: objdump.c:1880 +#, c-format +msgid "Reading %s section of %s failed: %s\n" +msgstr "þÔÅÎÉÅ %s ÒÁÚÄÅÌÁ %s ÚÁ×ÅÒÛÉÌÏÓØ ÎÅÕÄÁÞÅÊ: %s\n" + +#: objdump.c:1923 +#, c-format +msgid "" +"Contents of %s section:\n" +"\n" +msgstr "" +"óÏÄÅÒÖÉÍÏÅ ÒÁÚÄÅÌÁ %s:\n" +"\n" + +#: objdump.c:2021 +#, c-format +msgid "architecture: %s, " +msgstr "ÁÒÈÉÔÅËÔÕÒÁ: %s, " + +#: objdump.c:2024 +#, c-format +msgid "flags 0x%08x:\n" +msgstr "ÆÌÁÇÉ 0x%08x:\n" + +#: objdump.c:2038 +msgid "" +"\n" +"start address 0x" +msgstr "" +"\n" +"ÎÁÞÁÌØÎÙÊ ÁÄÒÅÓ 0x" + +#: objdump.c:2071 +#, c-format +msgid "" +"\n" +"%s: file format %s\n" +msgstr "" +"\n" +"%s: ÆÏÒÍÁÔ ÆÁÊÌÁ %s\n" + +#: objdump.c:2111 +#, c-format +msgid "%s: printing debugging information failed" +msgstr "%s: ×Ù×ÏÄ ÏÔÌÁÄÏÞÎÏÊ ÉÎÆÏÒÍÁÃÉÉ ÚÁ×ÅÒÛÉÌÓÑ ÎÅÕÄÁÞÅÊ" + +#: objdump.c:2190 +#, c-format +msgid "In archive %s:\n" +msgstr "÷ ÁÒÈÉ×Å %s:\n" + +#: objdump.c:2249 +#, c-format +msgid "Contents of section %s:\n" +msgstr "óÏÄÅÒÖÉÍÏÅ ÒÁÚÄÅÌÁ %s:\n" + +#: objdump.c:2369 +msgid "no symbols\n" +msgstr "ÎÅÔ ÓÉÍ×ÏÌÏ×\n" + +#: objdump.c:2718 +msgid "unrecognized -E option" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÁÑ ÏÐÃÉÑ -E" + +#: objdump.c:2729 +#, c-format +msgid "unrecognized --endian type `%s'" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÙÊ --endian ÔÉÐ `%s'" + +#: rdcoff.c:206 +#, c-format +msgid "parse_coff_type: Bad type code 0x%x" +msgstr "parse_coff_type: ðÌÏÈÏÊ ËÏÄ ÔÉÐÁ 0x%x" + +#: rdcoff.c:424 rdcoff.c:532 rdcoff.c:731 +#, c-format +msgid "bfd_coff_get_syment failed: %s" +msgstr "bfd_coff_get_syment ÚÁ×ÅÒÛÉÌÓÑ ÎÅÕÄÁÞÅÊ: %s" + +#: rdcoff.c:440 rdcoff.c:751 +#, c-format +msgid "bfd_coff_get_auxent failed: %s" +msgstr "bfd_coff_get_auxent ÚÁ×ÅÒÛÉÌÓÑ ÎÅÕÄÁÞÅÊ: %s" + +#: rdcoff.c:818 +#, c-format +msgid "%ld: .bf without preceding function" +msgstr "%ld: .bf ÂÅÚ ÐÒÅÄÛÅÓÔ×ÕÀÝÅÊ ÆÕÎËÃÉÉ" + +#: rdcoff.c:868 +#, c-format +msgid "%ld: unexpected .ef\n" +msgstr "%ld: ÎÅÏÖÉÄÁÎÎÙÊ .ef\n" + +#: rddbg.c:91 +#, c-format +msgid "%s: no recognized debugging information" +msgstr "%s: ÎÅÔ ÒÁÓÐÏÚÎÁÎÎÏÊ ÏÔÌÁÄÏÞÎÏÊ ÉÎÆÏÒÍÁÃÉÉ" + +#: rddbg.c:415 +msgid "Last stabs entries before error:\n" +msgstr "ðÏÓÌÅÄÎÉÅ ÐÕÎËÔÙ stabs ÐÅÒÅÄ ÏÛÉÂËÏÊ:\n" + +#: readelf.c:455 +#, c-format +msgid "%s: Error: " +msgstr "%s: ïÛÉÂËÁ: " + +#: readelf.c:466 +#, c-format +msgid "%s: Warning: " +msgstr "%s: ðÒÅÄÕÐÒÅÖÄÅÎÉÅ: " + +#: readelf.c:488 +#, c-format +msgid "Unable to seek to 0x%x for %s\n" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÎÁÊÔÉ 0x%x ÄÌÑ %s\n" + +#: readelf.c:499 +#, c-format +msgid "Out of memory allocating 0x%x bytes for %s\n" +msgstr "îÅÈ×ÁÔËÁ ÐÁÍÑÔÉ ÐÒÉ ÒÁÓÐÒÅÄÅÌÅÎÉÉ 0x%x ÂÁÊÔ ÄÌÑ %s\n" + +#: readelf.c:507 +#, c-format +msgid "Unable to read in 0x%x bytes of %s\n" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÉÚÕÞÉÔØ ÐÏÓÒÅÄÓÔ×ÏÍ ÞÔÅÎÉÑ 0x%x ÂÁÊÔ %s\n" + +#: readelf.c:560 readelf.c:614 readelf.c:798 readelf.c:833 +#, c-format +msgid "Unhandled data length: %d\n" +msgstr "äÌÉÎÁ ÎÅÏÂÒÁÂÁÔÙ×ÁÅÍÙÈ ÄÁÎÎÙÈ: %d\n" + +#: readelf.c:924 +msgid "Don't know about relocations on this machine architecture\n" +msgstr "îÅÉÚ×ÅÓÔÎÏ Ï ÐÅÒÅÍÅÝÅÎÉÑÈ ÄÌÑ ÜÔÏÊ ÁÒÈÉÔÅËÔÕÒÙ ÍÁÛÉÎÙ\n" + +#: readelf.c:946 readelf.c:975 readelf.c:1021 readelf.c:1049 +msgid "relocs" +msgstr "ÐÅÒÅÍÅÝÅÎÉÑ" + +#: readelf.c:957 readelf.c:986 readelf.c:1031 readelf.c:1059 +msgid "out of memory parsing relocs" +msgstr "ÎÅÈ×ÁÔËÁ ÐÁÍÑÔÉ ÐÒÉ ÒÁÚÂÏÒÅ ÐÅÒÅÍÅÝÅÎÉÊ" + +#: readelf.c:1112 +msgid " Offset Info Type Sym. Value Symbol's Name + Addend\n" +msgstr " óÍÅÝÅÎÉÅ éÎÆÏ ôÉÐ úÎÁÞ.ÓÉÍ×. éÍÑ ÓÉÍ×ÏÌÁ + Addend\n" + +#: readelf.c:1114 +msgid " Offset Info Type Sym.Value Sym. Name + Addend\n" +msgstr " óÍÅÝÅÎÉÅ éÎÆÏ ôÉÐ úÎÁÞ.ÓÉÍ× éÍÑ ÓÉÍ×. + Addend\n" + +#: readelf.c:1119 +msgid " Offset Info Type Sym. Value Symbol's Name\n" +msgstr " óÍÅÝÅÎÉÅ éÎÆÏ ôÉÐ úÎÁÞ.ÓÉÍ× éÍÑ ÓÉÍ×ÏÌÁ\n" + +#: readelf.c:1121 +msgid " Offset Info Type Sym.Value Sym. Name\n" +msgstr " óÍÅÝÅÎÉÅ éÎÆÏ ôÉÐ úÎÁÞ.ÓÉÍ× éÍÑ ÓÉÍ×.\n" + +#: readelf.c:1129 +msgid " Offset Info Type Symbol's Value Symbol's Name + Addend\n" +msgstr " óÍÅÝÅÎÉÅ éÎÆÏ ôÉÐ úÎÁÞÅÎÉÅ ÓÉÍ×. éÍÑ ÓÉÍ×ÏÌÁ + Addend\n" + +#: readelf.c:1131 +msgid " Offset Info Type Sym. Value Sym. Name + Addend\n" +msgstr " óÍÅÝÅÎÉÅ éÎÆÏ ôÉÐ úÎÁÞ.ÓÉÍ×. éÍÑ ÓÉÍ×. + Addend\n" + +#: readelf.c:1136 +msgid " Offset Info Type Symbol's Value Symbol's Name\n" +msgstr " óÍÅÝÅÎÉÅ éÎÆÏ ôÉÐ úÎÁÞÅÎÉÅ ÓÉÍ×. éÍÑ ÓÉÍ×ÏÌÁ\n" + +#: readelf.c:1138 +msgid " Offset Info Type Sym. Value Sym. Name\n" +msgstr " óÍÅÝÅÎÉÅ éÎÆÏ ôÉÐ úÎÁÞ.ÓÉÍ×. éÍÑ ÓÉÍ×.\n" + +#: readelf.c:1414 readelf.c:1416 readelf.c:1492 readelf.c:1494 readelf.c:1503 +#: readelf.c:1505 +#, c-format +msgid "unrecognized: %-7lx" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÙÊ: %-7lx" + +#: readelf.c:1466 +#, c-format +msgid "" +msgstr "<ÉÎÄÅËÓ ÔÁÂÌÉÃÙ ÓÔÒÏË %3ld>" + +#: readelf.c:1743 +#, c-format +msgid "Processor Specific: %lx" +msgstr "óÐÅÃÉÆÉÞÎÙÊ ÄÌÑ ÐÒÏÃÅÓÓÏÒÁ: %lx" + +#: readelf.c:1762 +#, c-format +msgid "Operating System specific: %lx" +msgstr "óÐÅÃÉÆÉÞÎÙÊ ÄÌÑ ÏÐÅÒÁÃÉÏÎÎÏÊ ÓÉÓÔÅÍÙ: %lx" + +#: readelf.c:1765 readelf.c:2417 +#, c-format +msgid ": %lx" +msgstr "<ÎÅÉÚ×ÅÓÔÎÙÊ>: %lx" + +#: readelf.c:1779 +msgid "NONE (None)" +msgstr "îåô (îÅÔ)" + +#: readelf.c:1780 +msgid "REL (Relocatable file)" +msgstr "REL (ðÅÒÅÍÅÝÁÅÍÙÊ ÆÁÊÌ)" + +#: readelf.c:1781 +msgid "EXEC (Executable file)" +msgstr "EXEC (éÓÐÏÌÎÑÅÍÙÊ ÆÁÊÌ)" + +#: readelf.c:1782 +msgid "DYN (Shared object file)" +msgstr "DYN (óÏ×Í. ÉÓÐ. ÏÂßÅËÔÎÙÊ ÆÁÊÌ)" + +#: readelf.c:1783 +msgid "CORE (Core file)" +msgstr "CORE (ïÓÎÏ×ÎÏÊ ÆÁÊÌ)" + +#: readelf.c:1787 +#, c-format +msgid "Processor Specific: (%x)" +msgstr "óÐÅÃÉÆÉÞÎÙÊ ÄÌÑ ÐÒÏÃÅÓÓÏÒÁ: (%x)" + +#: readelf.c:1789 +#, c-format +msgid "OS Specific: (%x)" +msgstr "óÐÅÃÉÆÉÞÎÙÊ ÄÌÑ ïó: (%x)" + +#: readelf.c:1791 readelf.c:1898 readelf.c:2574 +#, c-format +msgid ": %x" +msgstr "<ÎÅÉÚ×ÅÓÔÎÙÊ>: %x" + +#: readelf.c:1804 +msgid "None" +msgstr "îÅÔ" + +#: readelf.c:2616 +msgid "Usage: readelf elf-file(s)\n" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ: readelf <ÏÐÃÉÉ> elf-ÆÁÊÌ(Ù)\n" + +#: readelf.c:2617 +msgid " Display information about the contents of ELF format files\n" +msgstr " ïÔÏÂÒÁÖÁÅÔ ÉÎÆÏÒÍÁÃÉÀ Ï ÓÏÄÅÒÖÉÍÏÍ ÆÁÊÌÏ× × ÆÏÒÍÁÔÅ ELF\n" + +#: readelf.c:2618 +msgid "" +" Options are:\n" +" -a --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" +" -h --file-header Display the ELF file header\n" +" -l --program-headers Display the program headers\n" +" --segments An alias for --program-headers\n" +" -S --section-headers Display the sections' header\n" +" --sections An alias for --section-headers\n" +" -e --headers Equivalent to: -h -l -S\n" +" -s --syms Display the symbol table\n" +" --symbols An alias for --syms\n" +" -n --notes Display the core notes (if present)\n" +" -r --relocs Display the relocations (if present)\n" +" -u --unwind Display the unwind info (if present)\n" +" -d --dynamic Display the dynamic segment (if present)\n" +" -V --version-info Display the version sections (if present)\n" +" -A --arch-specific Display architecture specific information (if any).\n" +" -D --use-dynamic Use the dynamic section info when displaying symbols\n" +" -x --hex-dump= Dump the contents of section \n" +" -w[liaprmfFso] or\n" +" --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n" +" Display the contents of DWARF2 debug sections\n" +msgstr "" +" ïÐÃÉÉ:\n" +" -a --all üË×É×ÁÌÅÎÔÎÁ: -h -l -S -s -r -d -V -A -I\n" +" -h --file-header ÷Ù×ÏÄ ÚÁÇÏÌÏ×ËÁ ÆÁÊÌÁ ELF\n" +" -l --program-headers ÷Ù×ÏÄ ÚÁÇÏÌÏ×ËÏ× ÐÒÏÇÒÁÍÍÙ\n" +" --segments áÌÉÁÓ ÄÌÑ --program-headers\n" +" -S --section-headers ÷Ù×ÏÄ ÚÁÇÏÌÏ×ËÁ ÒÁÚÄÅÌÏ×\n" +" --sections áÌÉÁÓ ÄÌÑ --section-headers\n" +" -e --headers üË×É×ÁÌÅÎÔÎÁ: -h -l -S\n" +" -s --syms ÷Ù×ÏÄ ÔÁÂÌÉÃÙ ÓÉÍ×ÏÌÏ×\n" +" --symbols áÌÉÁÓ ÄÌÑ --syms\n" +" -n --notes ÷Ù×ÏÄ ÏÓÎÏ×ÎÙÈ ÚÁÐÉÓÅÊ (ÅÓÌÉ ÉÍÅÀÔÓÑ)\n" +" -r --relocs ÷Ù×ÏÄ ÐÅÒÅÍÅÝÅÎÉÊ (ÅÓÌÉ ÉÍÅÀÔÓÑ)\n" +" -u --unwind ÷Ù×ÏÄ ÉÎÆÏÒÍÁÃÉÉ Ï ÒÁÓÐÉÓÙ×ÁÎÉÉ (ÅÓÌÉ ÉÍÅÅÔÓÑ)\n" +" -d --dynamic ÷Ù×ÏÄ ÄÉÎÁÍÉÞÅÓËÏÇÏ ÓÅÇÍÅÎÔÁ (ÅÓÌÉ ÉÍÅÅÔÓÑ)\n" +" -V --version-info ÷Ù×ÏÄ ÒÁÚÄÅÌÏ× Ó ×ÅÒÓÉÅÊ (ÅÓÌÉ ÉÍÅÀÔÓÑ)\n" +" -A --arch-specific ÷Ù×ÏÄ ÉÎÆÏÒÍÁÃÉÉ, ÓÐÅÃÉÆÉÞÎÏÊ ÄÌÑ ÁÒÈÉÔÅËÔÕÒÙ (ÅÓÌÉ ÉÍÅÅÔÓÑ).\n" +" -D --use-dynamic éÓÐÏÌØÚÏ×ÁÎÉÅ ÄÉÎÁÍÉÞÅÓËÏÊ ÉÎÆÏÒÍÁÃÉÉ ÒÁÚÄÅÌÁ ÐÒÉ ×Ù×ÏÄÅ ÓÉÍ×ÏÌÏ×\n" +" -x --hex-dump=<ÎÏÍÅÒ> äÁÍÐ ÓÏÄÅÒÖÉÍÏÇÏ ÒÁÚÄÅÌÁ <ÎÏÍÅÒ>\n" +" -w[liaprmfFso] ÉÌÉ\n" +" --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n" +" ÷Ù×ÏÄ ÓÏÄÅÒÖÉÍÏÇÏ ÏÔÌÁÄÏÞÎÙÈ ÒÁÚÄÅÌÏ× DWARF2\n" + +#: readelf.c:2640 +msgid "" +" -i --instruction-dump=\n" +" Disassemble the contents of section \n" +msgstr "" +" -i --instruction-dump=<ÎÏÍÅÒ>\n" +" äÉÚÁÓÓÅÍÂÌÉÒÏ×ÁÎÉÅ ÓÏÄÅÒÖÉÍÏÇÏ ÒÁÚÄÅÌÁ <ÎÏÍÅÒ>\n" + +#: readelf.c:2644 +msgid "" +" -I --histogram Display histogram of bucket list lengths\n" +" -W --wide Allow output width to exceed 80 characters\n" +" -H --help Display this information\n" +" -v --version Display the version number of readelf\n" +msgstr "" +" -I --histogram ÷Ù×ÏÄ ÇÉÓÔÏÇÒÁÍÍÙ ÄÌÉÎ ÓÐÉÓËÁ ÕÞÁÓÔËÁ ÐÁÍÑÔÉ\n" +" -W --wide òÁÚÒÅÛÅÎÉÅ ÛÉÒÉÎÙ ×Ù×ÏÄÁ ÂÏÌÅÅ 80 ÓÉÍ×ÏÌÏ×\n" +" -H --help ÷Ù×ÏÄ ÜÔÏÊ ÉÎÆÏÒÍÁÃÉÉ\n" +" -v --version ÷Ù×ÏÄ ÎÏÍÅÒÁ ×ÅÒÓÉÉ readelf\n" + +#: readelf.c:2666 readelf.c:10765 +msgid "Out of memory allocating dump request table." +msgstr "îÅÈ×ÁÔËÁ ÐÁÍÑÔÉ ÐÒÉ ÒÁÚÍÅÝÅÎÉÉ ÄÁÍÐÁ ÔÁÂÌÉÃÙ ÚÁÐÒÏÓÁ." + +#: readelf.c:2830 readelf.c:2906 +#, c-format +msgid "Unrecognized debug option '%s'\n" +msgstr "îÅÒÁÓÐÏÚÎÁÎÎÁÑ ÏÔÌÁÄÏÞÎÁÑ ÏÐÃÉÑ '%s'\n" + +#: readelf.c:2940 +#, c-format +msgid "Invalid option '-%c'\n" +msgstr "îÅ×ÅÒÎÁÑ ÏÐÃÉÑ '-%c'\n" + +#: readelf.c:2953 +msgid "Nothing to do.\n" +msgstr "îÅÞÅÇÏ ×ÙÐÏÌÎÑÔØ.\n" + +#: readelf.c:2966 readelf.c:2983 readelf.c:5366 +msgid "none" +msgstr "ÎÅÔ" + +#: readelf.c:2970 readelf.c:2987 readelf.c:3018 +#, c-format +msgid "" +msgstr "<ÎÅÉÚ×ÅÓÔÎÙÊ: %x>" + +#: readelf.c:2984 +msgid "2's complement, little endian" +msgstr "ÄÏÐÏÌÎÅÎÉÅ ÄÏ 2, little endian" + +#: readelf.c:2985 +msgid "2's complement, big endian" +msgstr "ÄÏÐÏÌÎÅÎÉÅ ÄÏ 2, big endian" + +#: readelf.c:3015 +msgid "Standalone App" +msgstr "éÚÏÌÉÒÏ×ÁÎÎÏÅ ÐÒÉÌÏÖÅÎÉÅ" + +#: readelf.c:3034 +msgid "Not an ELF file - it has the wrong magic bytes at the start\n" +msgstr "îÅ ELF-ÆÁÊÌ - ÏÎ ÓÏÄÅÒÖÉÔ ÎÅ×ÅÒÎÙÅ magic-ÂÁÊÔÙ × ÎÁÞÁÌÅ\n" + +#: readelf.c:3042 +msgid "ELF Header:\n" +msgstr "úÁÇÏÌÏ×ÏË ELF:\n" + +#: readelf.c:3043 +msgid " Magic: " +msgstr " Magic: " + +#: readelf.c:3047 +#, c-format +msgid " Class: %s\n" +msgstr " ëÌÁÓÓ: %s\n" + +#: readelf.c:3049 +#, c-format +msgid " Data: %s\n" +msgstr " äÁÎÎÙÅ: %s\n" + +#: readelf.c:3051 +#, c-format +msgid " Version: %d %s\n" +msgstr " ÷ÅÒÓÉÑ: %d %s\n" + +#: readelf.c:3058 +#, c-format +msgid " OS/ABI: %s\n" +msgstr " OS/ABI: %s\n" + +#: readelf.c:3060 +#, c-format +msgid " ABI Version: %d\n" +msgstr " ÷ÅÒÓÉÑ ABI: %d\n" + +#: readelf.c:3062 +#, c-format +msgid " Type: %s\n" +msgstr " ôÉÐ: %s\n" + +#: readelf.c:3064 +#, c-format +msgid " Machine: %s\n" +msgstr " íÁÛÉÎÁ: %s\n" + +#: readelf.c:3066 +#, c-format +msgid " Version: 0x%lx\n" +msgstr " ÷ÅÒÓÉÑ: 0x%lx\n" + +#: readelf.c:3069 +msgid " Entry point address: " +msgstr " áÄÒÅÓ ÔÏÞËÉ ×ÈÏÄÁ: " + +#: readelf.c:3071 +msgid "" +"\n" +" Start of program headers: " +msgstr "" +"\n" +" îÁÞÁÌÏ ÚÁÇÏÌÏ×ËÏ× ÐÒÏÇÒÁÍÍÙ: " + +#: readelf.c:3073 +msgid "" +" (bytes into file)\n" +" Start of section headers: " +msgstr "" +" (ÂÁÊÔ × ÆÁÊÌÅ)\n" +" îÁÞÁÌÏ ÚÁÇÏÌÏ×ËÏ× ÐÒÏÇÒÁÍÍÙ: " + +#: readelf.c:3075 +msgid " (bytes into file)\n" +msgstr " (ÂÁÊÔ × ÆÁÊÌÅ)\n" + +#: readelf.c:3077 +#, c-format +msgid " Flags: 0x%lx%s\n" +msgstr " æÌÁÇÉ: 0x%lx%s\n" + +#: readelf.c:3080 +#, c-format +msgid " Size of this header: %ld (bytes)\n" +msgstr " òÁÚÍÅÒ ÜÔÏÇÏ ÚÁÇÏÌÏ×ËÁ: %ld (ÂÁÊÔ)\n" + +#: readelf.c:3082 +#, c-format +msgid " Size of program headers: %ld (bytes)\n" +msgstr " òÁÚÍÅÒ ÚÁÇÏÌÏ×ËÏ× ÐÒÏÇÒÁÍÍÙ: %ld (ÂÁÊÔ)\n" + +#: readelf.c:3084 +#, c-format +msgid " Number of program headers: %ld\n" +msgstr " þÉÓÌÏ ÚÁÇÏÌÏ×ËÏ× ÐÒÏÇÒÁÍÍÙ: %ld\n" + +#: readelf.c:3086 +#, c-format +msgid " Size of section headers: %ld (bytes)\n" +msgstr " òÁÚÍÅÒ ÚÁÇÏÌÏ×ËÏ× ÒÁÚÄÅÌÁ: %ld (ÂÁÊÔ)\n" + +#: readelf.c:3088 +#, c-format +msgid " Number of section headers: %ld" +msgstr " þÉÓÌÏ ÚÁÇÏÌÏ×ËÏ× ÒÁÚÄÅÌÁ: %ld" + +#: readelf.c:3093 +#, c-format +msgid " Section header string table index: %ld" +msgstr " éÎÄÅËÓ ÔÁÂÌ. ÓÔÒÏË ÚÁÇÏÌ. ÒÁÚÄÅÌÁ: %ld" + +#: readelf.c:3127 readelf.c:3163 +msgid "program headers" +msgstr "ÚÁÇÏÌÏ×ËÉ ÐÒÏÇÒÁÍÍÙ" + +#: readelf.c:3203 readelf.c:3480 readelf.c:3526 readelf.c:3589 readelf.c:3656 +#: readelf.c:4715 readelf.c:4758 readelf.c:4948 readelf.c:5917 readelf.c:5931 +#: readelf.c:10411 +msgid "Out of memory\n" +msgstr "îÅÈ×ÁÔËÁ ÐÁÍÑÔÉ\n" + +#: readelf.c:3231 +msgid "" +"\n" +"There are no program headers in this file.\n" +msgstr "" +"\n" +"÷ ÜÔÏÍ ÆÁÊÌÅ ÎÅÔ ÚÁÇÏÌÏ×ËÏ× ÐÒÏÇÒÁÍÍÙ.\n" + +#: readelf.c:3237 +#, c-format +msgid "" +"\n" +"Elf file type is %s\n" +msgstr "" +"\n" +"ôÉÐ elf-ÆÁÊÌÁ - %s\n" + +#: readelf.c:3238 +msgid "Entry point " +msgstr "ôÏÞËÁ ×ÈÏÄÁ " + +#: readelf.c:3240 +#, c-format +msgid "" +"\n" +"There are %d program headers, starting at offset " +msgstr "" +"\n" +"éÍÅÅÔÓÑ %d ÚÁÇÏÌÏ×ËÏ× ÐÒÏÇÒÁÍÍÙ, ÎÁÞÉÎÁÑ ÓÏ ÓÍÅÝÅÎÉÑ " + +#: readelf.c:3252 readelf.c:3254 +msgid "" +"\n" +"Program Headers:\n" +msgstr "" +"\n" +"úÁÇÏÌÏ×ËÉ ÐÒÏÇÒÁÍÍÙ:\n" + +#: readelf.c:3258 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr " ôÉÐ óÍÅÝ. ÷ÉÒÔ.ÁÄÒ æÉÚ.ÁÄÒ òÚÍ.ÆÊÌ òÚÍ.ÐÍ æÌÇ ÷ÙÒÁ×Î\n" + +#: readelf.c:3261 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr " ôÉÐ óÍÅÝ. ÷ÉÒÔ.ÁÄÒ æÉÚ.ÁÄÒ òÚÍ.ÆÊÌ òÚÍ.ÐÍ æÌÇ ÷ÙÒÁ×Î\n" + +#: readelf.c:3265 +msgid " Type Offset VirtAddr PhysAddr\n" +msgstr " ôÉÐ óÍÅÝ. ÷ÉÒÔ.ÁÄÒ æÉÚ.ÁÄÒ\n" + +#: readelf.c:3267 +msgid " FileSiz MemSiz Flags Align\n" +msgstr " òÚÍ.ÆÊÌ òÚÍ.ÐÍ æÌÁÇÉ ÷ÙÒÁ×Î\n" + +#: readelf.c:3360 +msgid "more than one dynamic segment\n" +msgstr "ÂÏÌÅÅ ÏÄÎÏÇÏ ÄÉÎÁÍÉÞÅÓËÏÇÏ ÓÅÇÍÅÎÔÁ\n" + +#: readelf.c:3368 +msgid "Unable to find program interpreter name\n" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÎÁÊÔÉ ÉÍÑ ÉÎÔÅÒÐÒÅÔÁÔÏÒÁ ÐÒÏÇÒÁÍÍÙ\n" + +#: readelf.c:3375 +#, c-format +msgid "" +"\n" +" [Requesting program interpreter: %s]" +msgstr "" +"\n" +" [úÁÐÒÁÛÉ×ÁÅÍÙÊ ÉÎÔÅÒÐÒÅÔÁÔÏÒ ÐÒÏÇÒÁÍÍÙ: %s]" + +#: readelf.c:3387 +msgid "" +"\n" +" Section to Segment mapping:\n" +msgstr "" +"\n" +" óÏÏÔ×ÅÔÓÔ×ÉÅ ÒÁÚÄÅÌ-ÓÅÇÍÅÎÔ:\n" + +#: readelf.c:3388 +msgid " Segment Sections...\n" +msgstr " óÅÇÍÅÎÔ òÁÚÄÅÌÙ...\n" + +#: readelf.c:3437 +msgid "Cannot interpret virtual addresses without program headers.\n" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÉÎÔÅÒÐÒÅÔÉÒÏ×ÁÔØ ×ÉÒÔÕÁÌØÎÙÅ ÁÄÒÅÓÁ ÂÅÚ ÚÁÇÏÌÏ×ËÏ× ÐÒÏÇÒÁÍÍÙ.\n" + +#: readelf.c:3453 +#, c-format +msgid "Virtual address 0x%lx not located in any PT_LOAD segment.\n" +msgstr "÷ÉÒÔÕÁÌØÎÙÊ ÁÄÒÅÓ 0x%lx ÎÅ ÒÁÚÍÅÝÅÎ × ËÁËÏÍ-ÌÉÂÏ ÓÅÇÍÅÎÔÅ PT_LOAD.\n" + +#: readelf.c:3471 readelf.c:3517 +msgid "section headers" +msgstr "ÚÁÇÏÌÏ×ËÉ ÒÁÚÄÅÌÏ×" + +#: readelf.c:3565 readelf.c:3632 +msgid "symbols" +msgstr "ÓÉÍ×ÏÌÙ" + +#: readelf.c:3576 readelf.c:3643 +msgid "symtab shndx" +msgstr "symtab shndx" + +#: readelf.c:3745 +msgid "" +"\n" +"There are no sections in this file.\n" +msgstr "" +"\n" +"÷ ÜÔÏÍ ÆÁÊÌÅ ÎÅÔ ÒÁÚÄÅÌÏ×.\n" + +#: readelf.c:3751 +#, c-format +msgid "There are %d section headers, starting at offset 0x%lx:\n" +msgstr "éÍÅÅÔÓÑ %d ÚÁÇÏÌÏ×ËÏ× ÒÁÚÄÅÌÁ, ÎÁÞÉÎÁÑ ÓÏ ÓÍÅÝÅÎÉÑ 0x%lx:\n" + +#: readelf.c:3768 readelf.c:4098 readelf.c:4433 readelf.c:6070 +msgid "string table" +msgstr "ÔÁÂÌÉÃÁ ÓÔÒÏË" + +#: readelf.c:3793 +msgid "File contains multiple dynamic symbol tables\n" +msgstr "æÁÊÌ ÓÏÄÅÒÖÉÔ ÎÅÓËÏÌØËÏ ÔÁÂÌÉà ÄÉÎÁÍÉÞÅÓËÉÈ ÓÉÍ×ÏÌÏ×\n" + +#: readelf.c:3805 +msgid "File contains multiple dynamic string tables\n" +msgstr "æÁÊÌ ÓÏÄÅÒÖÉÔ ÎÅÓËÏÌØËÏ ÔÁÂÌÉà ÄÉÎÁÍÉÞÅÓËÉÈ ÓÔÒÏË\n" + +#: readelf.c:3811 +msgid "dynamic strings" +msgstr "ÄÉÎÁÍÉÞÅÓËÉÅ ÓÔÒÏËÉ" + +#: readelf.c:3817 +msgid "File contains multiple symtab shndx tables\n" +msgstr "æÁÊÌ ÓÏÄÅÒÖÉÔ ÎÅÓËÏÌØËÏ ÔÁÂÌÉà symtab shndx\n" + +#: readelf.c:3855 +msgid "" +"\n" +"Section Headers:\n" +msgstr "" +"\n" +"úÁÇÏÌÏ×ËÉ ÒÁÚÄÅÌÏ×:\n" + +#: readelf.c:3857 +msgid "" +"\n" +"Section Header:\n" +msgstr "" +"\n" +"úÁÇÏÌÏ×ÏË ÒÁÚÄÅÌÁ:\n" + +#: readelf.c:3861 +msgid " [Nr] Name Type Addr Off Size ES Flg Lk Inf Al\n" +msgstr " [îÍ] éÍÑ ôÉÐ áÄÒÅÓ óÍÅÝ òÁÚÍ ES æÌÇ óÓ éÎÆ Al\n" + +#: readelf.c:3864 +msgid " [Nr] Name Type Address Off Size ES Flg Lk Inf Al\n" +msgstr " [îÍ] éÍÑ ôÉÐ áÄÒÅÓ óÍÅÝ òÁÚÍ ES æÌÇ ìË éÎÆ Al\n" + +#: readelf.c:3867 +msgid " [Nr] Name Type Address Offset\n" +msgstr " [îÍ] éÍÑ ôÉÐ áÄÒÅÓ óÍÅÝÅÎÉÅ\n" + +#: readelf.c:3868 +msgid " Size EntSize Flags Link Info Align\n" +msgstr " òÁÚÍÅÒ òÁÚÍ.Ent æÌÁÇÉ óÓÙÌË éÎÆÏ ÷ÙÒÁ×Î\n" + +#: readelf.c:3963 +msgid "" +"Key to Flags:\n" +" W (write), A (alloc), X (execute), M (merge), S (strings)\n" +" I (info), L (link order), G (group), x (unknown)\n" +" O (extra OS processing required) o (OS specific), p (processor specific)\n" +msgstr "" +"ïÂÏÚÎÁÞÅÎÉÑ ÆÌÁÇÏ×:\n" +" W (ÚÁÐÉÓØ), A (ÎÁÚÎÁÞ), X (ÉÓÐÏÌÎÑÅÍÙÊ), M (ÓÌÉÑÎÉÅ), S (ÓÔÒÏËÉ)\n" +" I (ÉÎÆÏ), L (ÐÏÒÑÄÏË ÓÓÙÌÏË), G (ÇÒÕÐÐÁ), x (ÎÅÉÚ×.)\n" +" O (ÔÒÅÂ. ÄÏÐ. ÏÂÒÁÂÏÔËÁ ïó) o (ÓÐÅÃÉÆÉÞÎÙÊ ÄÌÑ ïó), p (ÓÐÅÃÉÆÉÞÎÙÊ ÄÌÑ ÐÒÏÃÅÓÓÏÒÁ)\n" + +#: readelf.c:4031 +#, c-format +msgid "" +"\n" +"'%s' relocation section at offset 0x%lx contains %ld bytes:\n" +msgstr "" +"\n" +"'%s' ÒÁÚÄÅÌ ÐÅÒÅÍÅÝÅÎÉÑ ÓÏ ÓÍÅÝÅÎÉÅÍ 0x%lx ÓÏÄÅÒÖÉÔ %ld ÂÁÊÔ:\n" + +#: readelf.c:4043 +msgid "" +"\n" +"There are no dynamic relocations in this file.\n" +msgstr "" +"\n" +"÷ ÜÔÏÍ ÆÁÊÌÅ ÎÅÔ ÄÉÎÁÍÉÞÅÓËÉÈ ÐÅÒÅÍÅÝÅÎÉÊ .\n" + +#: readelf.c:4070 +msgid "" +"\n" +"Relocation section " +msgstr "" +"\n" +"òÁÚÄÅÌ ÐÅÒÅÍÅÝÅÎÉÑ " + +#: readelf.c:4075 readelf.c:4496 readelf.c:4510 +#, c-format +msgid "'%s'" +msgstr "'%s'" + +#: readelf.c:4077 readelf.c:4512 +#, c-format +msgid " at offset 0x%lx contains %lu entries:\n" +msgstr " ÓÏ ÓÍÅÝÅÎÉÅÍ 0x%lx ÓÏÄÅÒÖÉÔ %lu ÐÕÎËÔÏ×:\n" + +#: readelf.c:4115 +msgid "" +"\n" +"There are no relocations in this file.\n" +msgstr "" +"\n" +"÷ ÜÔÏÍ ÆÁÊÌÅ ÎÅÔ ÐÅÒÅÍÅÝÅÎÉÊ.\n" + +#: readelf.c:4299 +msgid "unwind table" +msgstr "ÒÁÚ×ÅÒÎÕÔÁÑ ÔÁÂÌÉÃÁ" + +#: readelf.c:4350 readelf.c:4362 readelf.c:8499 readelf.c:8511 +#, c-format +msgid "Skipping unexpected symbol type %u\n" +msgstr "ðÒÏÐÕÓËÁÅÔÓÑ ÎÅÏÖÉÄÁÎÎÙÊ ÔÉÐ ÓÉÍ×ÏÌÁ %u\n" + +#: readelf.c:4370 +#, c-format +msgid "Skipping unexpected relocation type %s\n" +msgstr "ðÒÏÐÕÓËÁÅÔÓÑ ÎÅÏÖÉÄÁÎÎÙÊ ÔÉÐ ÐÅÒÅÍÅÝÅÎÉÑ %s\n" + +#: readelf.c:4415 readelf.c:4440 +msgid "" +"\n" +"There are no unwind sections in this file.\n" +msgstr "" +"\n" +"÷ ÜÔÏÍ ÆÁÊÌÅ ÎÅÔ ÒÁÚ×ÅÒÎÕÔÙÈ ÒÁÚÄÅÌÏ×.\n" + +#: readelf.c:4491 +msgid "" +"\n" +"Could not find unwind info section for " +msgstr "" +"\n" +"îÅ×ÏÚÍÏÖÎÏ ÂÙÌÏ ÎÁÊÔÉ ÒÁÚÄÅÌ Ó ÒÁÚ×ÅÒÎÕÔÏÊ ÉÎÆÏÒÍÁÃÉÅÊ ÄÌÑ" + +#: readelf.c:4503 +msgid "unwind info" +msgstr "ÒÁÚ×ÅÒÎÕÔÁÑ ÉÎÆÏÒÍÁÃÉÑ" + +#: readelf.c:4505 +msgid "" +"\n" +"Unwind section " +msgstr "" +"\n" +"òÁÚ×ÅÒÎÕÔÙÊ ÒÁÚÄÅÌ " + +#: readelf.c:4699 readelf.c:4742 +msgid "dynamic segment" +msgstr "ÄÉÎÁÍÉÞÅÓËÉÊ ÓÅÇÍÅÎÔ" + +#: readelf.c:4820 +msgid "" +"\n" +"There is no dynamic segment in this file.\n" +msgstr "" +"\n" +"÷ ÜÔÏÍ ÆÁÊÌÅ ÎÅÔ ÄÉÎÁÍÉÞÅÓËÏÇÏ ÓÅÇÍÅÎÔÁ.\n" + +#: readelf.c:4854 +msgid "Unable to seek to end of file!" +msgstr "îÅ×ÏÚÍÏÖÎÏ ×ÙÐÏÌÎÉÔØ ÐÏÉÓË ÄÏ ËÏÎÃÁ ÆÁÊÌÁ!" + +#: readelf.c:4865 +msgid "Unable to determine the number of symbols to load\n" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÏÐÒÅÄÅÌÉÔØ ÞÉÓÌÏ ÚÁÇÒÕÖÁÅÍÙÈ ÓÉÍ×ÏÌÏ×\n" + +#: readelf.c:4895 +msgid "Unable to seek to end of file\n" +msgstr "îÅ×ÏÚÍÏÖÎÏ ×ÙÐÏÌÎÉÔØ ÐÏÉÓË ÄÏ ËÏÎÃÁ ÆÁÊÌÁ\n" + +#: readelf.c:4901 +msgid "Unable to determine the length of the dynamic string table\n" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÏÐÒÅÄÅÌÉÔØ ÄÌÉÎÕ ÔÁÂÌÉÃÙ ÄÉÎÁÍÉÞÅÓËÉÈ ÓÔÒÏË\n" + +#: readelf.c:4906 +msgid "dynamic string table" +msgstr "ÔÁÂÌÉÃÁ ÄÉÎÁÍÉÞÅÓËÉÈ ÓÔÒÏË" + +#: readelf.c:4941 +msgid "symbol information" +msgstr "ÉÎÆÏÒÍÁÃÉÑ Ï ÓÉÍ×ÏÌÅ" + +#: readelf.c:4965 +#, c-format +msgid "" +"\n" +"Dynamic segment at offset 0x%lx contains %ld entries:\n" +msgstr "" +"\n" +"äÉÎÁÍÉÞÅÓËÉÊ ÓÅÇÍÅÎÔ ÓÏ ÓÍÅÝÅÎÉÅÍ 0x%lx ÓÏÄÅÒÖÉÔ %ld ÐÕÎËÔÏ×:\n" + +#: readelf.c:4968 +msgid " Tag Type Name/Value\n" +msgstr " ôÅÇ ôÉÐ éÍÑ/úÎÁÞ\n" + +#: readelf.c:5004 +msgid "Auxiliary library" +msgstr "÷ÓÐÏÍÏÇÁÔÅÌØÎÁÑ ÂÉÂÌÉÏÔÅËÁ" + +#: readelf.c:5008 +msgid "Filter library" +msgstr "âÉÂÌÉÏÔÅËÁ ÆÉÌØÔÒÏ×" + +#: readelf.c:5012 +msgid "Configuration file" +msgstr "æÁÊÌ ÎÁÓÔÒÏÊËÉ" + +#: readelf.c:5016 +msgid "Dependency audit library" +msgstr "âÉÂÌÉÏÔÅËÁ ÁÕÄÉÔÁ ÚÁ×ÉÓÉÍÏÓÔÅÊ" + +#: readelf.c:5020 +msgid "Audit library" +msgstr "âÉÂÌÉÏÔÅËÁ ÁÕÄÉÔÁ" + +#: readelf.c:5038 readelf.c:5066 readelf.c:5094 +msgid "Flags:" +msgstr "æÌÁÇÉ:" + +#: readelf.c:5041 readelf.c:5069 readelf.c:5096 +msgid " None\n" +msgstr " îÅÔ\n" + +#: readelf.c:5217 +#, c-format +msgid "Shared library: [%s]" +msgstr "óÏ×Í. ÉÓÐ. ÂÉÂÌÉÏÔÅËÁ: [%s]" + +#: readelf.c:5220 +msgid " program interpreter" +msgstr " ÉÎÔÅÒÐÒÅÔÁÔÏÒ ÐÒÏÇÒÁÍÍÙ" + +#: readelf.c:5224 +#, c-format +msgid "Library soname: [%s]" +msgstr "âÉÂÌÉÏÔÅËÁ soname: [%s]" + +#: readelf.c:5228 +#, c-format +msgid "Library rpath: [%s]" +msgstr "âÉÂÌÉÏÔÅËÁ rpath: [%s]" + +#: readelf.c:5232 +#, c-format +msgid "Library runpath: [%s]" +msgstr "âÉÂÌÉÏÔÅËÁ runpath: [%s]" + +#: readelf.c:5296 +#, c-format +msgid "Not needed object: [%s]\n" +msgstr "îÅÎÕÖÎÙÊ ÏÂßÅËÔ: [%s]\n" + +#: readelf.c:5412 +#, c-format +msgid "" +"\n" +"Version definition section '%s' contains %ld entries:\n" +msgstr "" +"\n" +"òÁÚÄÅÌ ÏÐÉÓÁÎÉÑ ×ÅÒÓÉÉ '%s' ÓÏÄÅÒÖÉÔ %ld ÐÕÎËÔÏ×:\n" + +#: readelf.c:5415 +msgid " Addr: 0x" +msgstr " áÄÒÅÓ: 0x" + +#: readelf.c:5417 readelf.c:5612 +#, c-format +msgid " Offset: %#08lx Link: %lx (%s)\n" +msgstr " óÍÅÝÅÎÉÅ: %#08lx óÓÙÌËÁ: %lx (%s)\n" + +#: readelf.c:5424 +msgid "version definition section" +msgstr "ÒÁÚÄÅÌ ÏÐÉÓÁÎÉÑ ×ÅÒÓÉÉ" + +#: readelf.c:5450 +#, c-format +msgid " %#06x: Rev: %d Flags: %s" +msgstr " %#06x: òÅ×ÉÚÉÑ: %d æÌÁÇÉ: %s" + +#: readelf.c:5453 +#, c-format +msgid " Index: %d Cnt: %d " +msgstr " éÎÄÅËÓ: %d óÞÅÔÞÉË: %d " + +#: readelf.c:5464 +#, c-format +msgid "Name: %s\n" +msgstr "éÍÑ: %s\n" + +#: readelf.c:5466 +#, c-format +msgid "Name index: %ld\n" +msgstr "éÎÄÅËÓ ÉÍÅÎÉ: %ld\n" + +#: readelf.c:5481 +#, c-format +msgid " %#06x: Parent %d: %s\n" +msgstr " %#06x: òÏÄÉÔÅÌØ %d: %s\n" + +#: readelf.c:5484 +#, c-format +msgid " %#06x: Parent %d, name index: %ld\n" +msgstr " %#06x: òÏÄÉÔÅÌØ %d, ÉÎÄÅËÓ ÉÍÅÎÉ: %ld\n" + +#: readelf.c:5503 +#, c-format +msgid "" +"\n" +"Version needs section '%s' contains %ld entries:\n" +msgstr "" +"\n" +"òÁÚÄÅÌ ÚÁ×ÉÓÉÍÏÓÔÅÊ ×ÅÒÓÉÉ '%s' ÓÏÄÅÒÖÉÔ %ld ÐÕÎËÔÏ×:\n" + +#: readelf.c:5506 +msgid " Addr: 0x" +msgstr " áÄÒÅÓ: 0x" + +#: readelf.c:5508 +#, c-format +msgid " Offset: %#08lx Link to section: %ld (%s)\n" +msgstr " óÍÅÝÅÎÉÅ: %#08lx óÓÙÌËÁ ÎÁ ÒÁÚÄÅÌ: %ld (%s)\n" + +#: readelf.c:5514 +msgid "version need section" +msgstr "ÒÁÚÄÅÌ ÚÁ×ÉÓÉÍÏÓÔÅÊ ×ÅÒÓÉÉ" + +#: readelf.c:5536 +#, c-format +msgid " %#06x: Version: %d" +msgstr " %#06x: ÷ÅÒÓÉÑ: %d" + +#: readelf.c:5539 +#, c-format +msgid " File: %s" +msgstr " æÁÊÌ: %s" + +#: readelf.c:5541 +#, c-format +msgid " File: %lx" +msgstr " æÁÊÌ: %lx" + +#: readelf.c:5543 +#, c-format +msgid " Cnt: %d\n" +msgstr " óÞÅÔÞÉË: %d\n" + +#: readelf.c:5561 +#, c-format +msgid " %#06x: Name: %s" +msgstr " %#06x: éÍÑ: %s" + +#: readelf.c:5564 +#, c-format +msgid " %#06x: Name index: %lx" +msgstr " %#06x: éÎÄÅËÓ ÉÍÅÎÉ: %lx" + +#: readelf.c:5567 +#, c-format +msgid " Flags: %s Version: %d\n" +msgstr " æÌÁÇÉ: %s ÷ÅÒÓÉÑ: %d\n" + +#: readelf.c:5603 +msgid "version string table" +msgstr "ÔÁÂÌÉÃÁ ÓÔÒÏË ×ÅÒÓÉÉ" + +#: readelf.c:5607 +#, c-format +msgid "" +"\n" +"Version symbols section '%s' contains %d entries:\n" +msgstr "" +"\n" +"òÁÚÄÅÌ ÓÉÍ×ÏÌÏ× ×ÅÒÓÉÉ '%s' ÓÏÄÅÒÖÉÔ %d ÐÕÎËÔÏ×:\n" + +#: readelf.c:5610 +msgid " Addr: " +msgstr " áÄÒÅÓ: " + +#: readelf.c:5622 +msgid "version symbol data" +msgstr "ÄÁÎÎÙÅ ÓÉÍ×ÏÌÁ ×ÅÒÓÉÉ" + +#: readelf.c:5649 +msgid " 0 (*local*) " +msgstr " 0 (*ÌÏËÁÌØÎÙÊ*) " + +#: readelf.c:5653 +msgid " 1 (*global*) " +msgstr " 1 (*ÇÌÏÂÁÌØÎÙÊ*) " + +#: readelf.c:5689 readelf.c:6129 +msgid "version need" +msgstr "ÚÁ×ÉÓÉÍÏÓÔØ ×ÅÒÓÉÉ" + +#: readelf.c:5699 +msgid "version need aux (2)" +msgstr "ÚÁ×ÉÓÉÍÏÓÔØ ×ÅÒÓÉÉ aux (2)" + +#: readelf.c:5741 readelf.c:6192 +msgid "version def" +msgstr "ÏÐÉÓÁÎÉÅ ×ÅÒÓÉÉ" + +#: readelf.c:5760 readelf.c:6207 +msgid "version def aux" +msgstr "ÏÐÉÓÁÎÉÅ ×ÅÒÓÉÉ aux" + +#: readelf.c:5791 +msgid "" +"\n" +"No version information found in this file.\n" +msgstr "" +"\n" +"÷ ÜÔÏÍ ÆÁÊÌÅ ÎÅ ÎÁÊÄÅÎÁ ÉÎÆÏÒÍÁÃÉÑ Ï ×ÅÒÓÉÉ.\n" + +#: readelf.c:5923 +msgid "Unable to read in dynamic data\n" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÓÞÉÔÁÔØ ÄÉÎÁÍÉÞÅÓËÉÅ ÄÁÎÎÙÅ\n" + +#: readelf.c:5967 +msgid "Unable to seek to start of dynamic information" +msgstr "îÅ×ÏÚÍÏÖÎÏ ×ÙÐÏÌÎÉÔØ ÐÏÉÓË ÏÔ ÎÁÞÁÌÁ ÄÉÎÁÍÉÞÅÓËÏÊ ÉÎÆÏÒÍÁÃÉÉ" + +#: readelf.c:5973 +msgid "Failed to read in number of buckets\n" +msgstr "óÂÏÊ ÐÒÉ ÓÞÉÔÙ×ÁÎÉÉ ÞÉÓÌÁ ÏÂÌÁÓÔÅÊ ÐÁÍÑÔÉ\n" + +#: readelf.c:5979 +msgid "Failed to read in number of chains\n" +msgstr "óÂÏÊ ÐÒÉ ÓÞÉÔÙ×ÁÎÉÉ ÞÉÓÌÁ ÃÅÐÏÞÅË\n" + +#: readelf.c:5999 +msgid "" +"\n" +"Symbol table for image:\n" +msgstr "" +"\n" +"ôÁÂÌÉÃÁ ÓÉÍ×ÏÌÏ× ÄÌÑ ÉÚÏÂÒÁÖÅÎÉÑ:\n" + +#: readelf.c:6001 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " ïÂÌÁÓÔÉ: úÎÁÞ òÁÚÍÅÒ ôÉÐ ó×ÑÚ Vis éÎÄÅËÓ ÉÍÅÎÉ\n" + +#: readelf.c:6003 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " ïÂÌÁÓÔÉ: úÎÁÞ òÁÚÍÅÒ ôÉÐ ó×ÑÚ Vis éÎÄÅËÓ ÉÍÅÎÉ\n" + +#: readelf.c:6048 +#, c-format +msgid "" +"\n" +"Symbol table '%s' contains %lu entries:\n" +msgstr "" +"\n" +"ôÁÂÌÉÃÁ ÓÉÍ×ÏÌÏ× '%s' ÓÏÄÅÒÖÉÔ %lu ÐÕÎËÔÏ×:\n" + +#: readelf.c:6052 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " þÉÓ: úÎÁÞ òÁÚÍ ôÉÐ ó×ÑÚ Vis éÎÄÅËÓ ÉÍÅÎÉ\n" + +#: readelf.c:6054 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " þÉÓ: úÎÁÞ òÁÚÍ ôÉÐ ó×ÑÚ Vis éÎÄÅËÓ ÉÍÅÎÉ\n" + +#: readelf.c:6101 +msgid "version data" +msgstr "ÄÁÎÎÙÅ ×ÅÒÓÉÉ" + +#: readelf.c:6142 +msgid "version need aux (3)" +msgstr "ÚÁ×ÉÓÉÍÏÓÔØ ×ÅÒÓÉÉ aux (3)" + +#: readelf.c:6167 +msgid "bad dynamic symbol" +msgstr "ÎÅ×ÅÒÎÙÊ ÄÉÎÁÍÉÞÅÓËÉÊ ÓÉÍ×ÏÌ" + +#: readelf.c:6230 +msgid "" +"\n" +"Dynamic symbol information is not available for displaying symbols.\n" +msgstr "" +"\n" +"éÎÆÏÒÍÁÃÉÑ ÄÉÎÁÍÉÞÅÓËÏÇÏ ÓÉÍ×ÏÌÁ ÎÅ ÄÏÓÔÕÐÎÁ ÄÌÑ ÏÔÏÂÒÁÖÅÎÉÑ ÓÉÍ×ÏÌÏ×.\n" + +#: readelf.c:6242 +#, c-format +msgid "" +"\n" +"Histogram for bucket list length (total of %d buckets):\n" +msgstr "" +"\n" +"çÉÓÔÏÇÒÁÍÍÁ ÄÌÑ ÄÌÉÎÙ ÓÐÉÓËÁ ÏÂÌÁÓÔÅÊ ÐÁÍÑÔÉ (×ÓÅÇÏ %d ÏÂÌÁÓÔÅÊ):\n" + +#: readelf.c:6244 +#, c-format +msgid " Length Number %% of total Coverage\n" +msgstr " äÌÉÎÁ þÉÓÌÏ %% ÏÔ ×ÓÅÇÏ ïÈ×ÁÔ\n" + +#: readelf.c:6249 readelf.c:6268 readelf.c:9898 readelf.c:10090 +msgid "Out of memory" +msgstr "îÅÈ×ÁÔËÁ ÐÁÍÑÔÉ" + +#: readelf.c:6317 +#, c-format +msgid "" +"\n" +"Dynamic info segment at offset 0x%lx contains %d entries:\n" +msgstr "" +"\n" +"óÅÇÍÅÎÔ ÄÉÎÁÍÉÞÅÓËÏÊ ÉÎÆÏÒÍÁÃÉÉ ÓÏ ÓÍÅÝÅÎÉÅÍ 0x%lx ÓÏÄÅÒÖÉÔ %d ÐÕÎËÔÏ×:\n" + +#: readelf.c:6320 +msgid " Num: Name BoundTo Flags\n" +msgstr " þÉÓ: éÍÑ çÒÁÎÉÃÁ æÌÁÇÉ\n" + +#: readelf.c:6373 +#, c-format +msgid "" +"\n" +"Assembly dump of section %s\n" +msgstr "" +"\n" +"óÂÏÒÏÞÎÙÊ ÄÁÍÐ ÒÁÚÄÅÌÁ %s\n" + +#: readelf.c:6396 +#, c-format +msgid "" +"\n" +"Section '%s' has no data to dump.\n" +msgstr "" +"\n" +"òÁÚÄÅÌ '%s' ÎÅ ÓÏÄÅÒÖÉÔ ÄÁÎÎÙÈ ÄÌÑ ÄÁÍÐÁ.\n" + +#: readelf.c:6401 +#, c-format +msgid "" +"\n" +"Hex dump of section '%s':\n" +msgstr "" +"\n" +"Hex-ÄÁÍÐ ÒÁÚÄÅÌÁ '%s':\n" + +#: readelf.c:6406 +msgid "section data" +msgstr "ÄÁÎÎÙÅ ÒÁÚÄÅÌÁ" + +#: readelf.c:6555 +msgid "badly formed extended line op encountered!\n" +msgstr "×ÓÔÒÅÞÅÎ ÎÅ×ÅÒÎÏ ÓÆÏÒÍÉÒÏ×ÁÎÎÙÊ ÒÁÓÛÉÒÅÎÎÙÊ line-up!\n" + +#: readelf.c:6562 +#, c-format +msgid " Extended opcode %d: " +msgstr " òÁÓÛÉÒÅÎÎÙÊ ËÏÄ ÏÐÅÒÁÃÉÉ %d: " + +#: readelf.c:6567 +msgid "" +"End of Sequence\n" +"\n" +msgstr "" +"ëÏÎÅà ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔÉ\n" +"\n" + +#: readelf.c:6573 +#, c-format +msgid "set Address to 0x%lx\n" +msgstr "ÕÓÔÁÎÏ×ËÁ ÁÄÒÅÓÁ × 0x%lx\n" + +#: readelf.c:6578 +msgid " define new File Table entry\n" +msgstr " ÏÐÒÅÄÅÌÅÎÉÅ ÎÏ×ÏÇÏ ÐÕÎËÔÁ ôÁÂÌÉÃÙ ÆÁÊÌÏ×\n" + +#: readelf.c:6579 readelf.c:6726 +msgid " Entry\tDir\tTime\tSize\tName\n" +msgstr " ðÕÎËÔ\tëÁÔÁÌÏÇ\t÷ÒÅÍÑ\tòÁÚÍÅÒ\téÍÑ\n" + +#: readelf.c:6581 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:6584 readelf.c:6586 readelf.c:6588 readelf.c:6738 readelf.c:6740 +#: readelf.c:6742 +#, c-format +msgid "%lu\t" +msgstr "%lu\t" + +#: readelf.c:6589 +#, c-format +msgid "" +"%s\n" +"\n" +msgstr "" +"%s\n" +"\n" + +#: readelf.c:6593 +#, c-format +msgid "UNKNOWN: length %d\n" +msgstr "îåéú÷åóôîùê: ÄÌÉÎÁ %d\n" + +#: readelf.c:6621 +#, c-format +msgid "" +"\n" +"Dump of debug contents of section %s:\n" +"\n" +msgstr "" +"\n" +"äÁÍÐ ÄÌÑ ÏÔÌÁÄËÉ ÓÏÄÅÒÖÉÍÏÇÏ ÒÁÚÄÅÌÁ %s:\n" +"\n" + +#: readelf.c:6649 +msgid "The line info appears to be corrupt - the section is too small\n" +msgstr "ðÏÈÏÖÅ, ÞÔÏ ÓÔÒÏËÁ ÉÎÆÏ ÐÏ×ÒÅÖÄÅÎÁ - ÒÁÚÄÅÌ ÓÌÉÛËÏÍ ÍÁÌ\n" + +#: readelf.c:6658 +msgid "Only DWARF version 2 and 3 line info is currently supported.\n" +msgstr "óÅÊÞÁÓ ÐÏÄÄÅÒÖÉ×ÁÀÔÓÑ ÓÔÒÏËÉ ÉÎÆÏ ÔÏÌØËÏ ÄÌÑ DWARF ×ÅÒÓÉÉ 2 É 3.\n" + +#: readelf.c:6679 +#, c-format +msgid " Length: %ld\n" +msgstr " äÌÉÎÁ: %ld\n" + +#: readelf.c:6680 +#, c-format +msgid " DWARF Version: %d\n" +msgstr " DWARF ×ÅÒÓÉÑ: %d\n" + +#: readelf.c:6681 +#, c-format +msgid " Prologue Length: %d\n" +msgstr " äÌÉÎÁ ÐÒÏÌÏÇÁ: %d\n" + +#: readelf.c:6682 +#, c-format +msgid " Minimum Instruction Length: %d\n" +msgstr " íÉÎÉÍ. ÄÌÉÎÁ ÉÎÓÔÒÕËÃÉÉ: %d\n" + +#: readelf.c:6683 +#, c-format +msgid " Initial value of 'is_stmt': %d\n" +msgstr " îÁÞ. ÚÎÁÞÅÎÉÅ 'is_stmt': %d\n" + +#: readelf.c:6684 +#, c-format +msgid " Line Base: %d\n" +msgstr " ïÓÎÏ×ÁÎÉÅ ÓÔÒÏËÉ: %d\n" + +#: readelf.c:6685 +#, c-format +msgid " Line Range: %d\n" +msgstr " äÉÁÐÁÚÏÎ ÓÔÒÏËÉ: %d\n" + +#: readelf.c:6686 +#, c-format +msgid " Opcode Base: %d\n" +msgstr " ïÓÎÏ×ÁÎÉÅ ËÏÄÁ ÏÐÅÒÁÃÉÉ: %d\n" + +#: readelf.c:6695 +msgid "" +"\n" +" Opcodes:\n" +msgstr "" +"\n" +" ëÏÄÙ ÏÐÅÒÁÃÉÊ:\n" + +#: readelf.c:6698 +#, c-format +msgid " Opcode %d has %d args\n" +msgstr " ëÏÄ ÏÐÅÒÁÃÉÉ %d ÓÏÄÅÒÖÉÔ %d ÁÒÇÕÍÅÎÔÏ×\n" + +#: readelf.c:6704 +msgid "" +"\n" +" The Directory Table is empty.\n" +msgstr "" +"\n" +" ôÁÂÌÉÃÁ ËÁÔÁÌÏÇÏ× ÐÕÓÔÁ.\n" + +#: readelf.c:6707 +msgid "" +"\n" +" The Directory Table:\n" +msgstr "" +"\n" +" ôÁÂÌÉÃÁ ËÁÔÁÌÏÇÏ×:\n" + +#: readelf.c:6711 +#, c-format +msgid " %s\n" +msgstr " %s\n" + +#: readelf.c:6722 +msgid "" +"\n" +" The File Name Table is empty.\n" +msgstr "" +"\n" +" ôÁÂÌÉÃÁ ÉÍÅÎ ÆÁÊÌÏ× ÐÕÓÔÁ.\n" + +#: readelf.c:6725 +msgid "" +"\n" +" The File Name Table:\n" +msgstr "" +"\n" +" ôÁÂÌÉÃÁ ÉÍÅÎ ÆÁÊÌÏ×:\n" + +#: readelf.c:6733 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:6744 +#, c-format +msgid "%s\n" +msgstr "%s\n" + +#. Now display the statements. +#: readelf.c:6752 +msgid "" +"\n" +" Line Number Statements:\n" +msgstr "" +"\n" +" ïÐÅÒÁÔÏÒÙ ÎÏÍÅÒÁ ÓÔÒÏËÉ:\n" + +#: readelf.c:6768 +#, c-format +msgid " Special opcode %d: advance Address by %d to 0x%lx" +msgstr " óÐÅÃÉÁÌØÎÙÊ ËÏÄ ÏÐÅÒÁÃÉÉ %d: ÐÒÏÄ×ÉÖÅÎÉÅ ÁÄÒÅÓÁ ÎÁ %d × 0x%lx" + +#: readelf.c:6772 +#, c-format +msgid " and Line by %d to %d\n" +msgstr " É ÓÔÒÏËÉ ÎÁ %d × %d\n" + +#: readelf.c:6783 +msgid " Copy\n" +msgstr " ëÏÐÉÑ\n" + +#: readelf.c:6790 +#, c-format +msgid " Advance PC by %d to %lx\n" +msgstr " ðÒÏÄ×ÉÖÅÎÉÅ ÓÞÅÔÞÉËÁ ËÏÍÁÎÄ ÎÁ %d × %lx\n" + +#: readelf.c:6798 +#, c-format +msgid " Advance Line by %d to %d\n" +msgstr " ðÒÏÄ×ÉÖÅÎÉÅ ÓÔÒÏËÉ ÎÁ %d × %d\n" + +#: readelf.c:6805 +#, c-format +msgid " Set File Name to entry %d in the File Name Table\n" +msgstr " õÓÔÁÎÏ×ËÁ ÉÍÅÎÉ ÆÁÊÌÁ × ÐÕÎËÔ %d × ÔÁÂÌÉÃÅ ÉÍÅÎ ÆÁÊÌÏ×\n" + +#: readelf.c:6813 +#, c-format +msgid " Set column to %d\n" +msgstr " õÓÔÁÎÏ×ËÁ ÓÔÏÌÂÃÁ × %d\n" + +#: readelf.c:6820 +#, c-format +msgid " Set is_stmt to %d\n" +msgstr " õÓÔÁÎÏ×ËÁ is_stmt × %d\n" + +#: readelf.c:6825 +msgid " Set basic block\n" +msgstr " õÓÔÁÎÏ×ËÁ ÂÁÚÏ×ÏÇÏ ÂÌÏËÁ\n" + +#: readelf.c:6833 +#, c-format +msgid " Advance PC by constant %d to 0x%lx\n" +msgstr " ðÒÏÄ×ÉÖÅÎÉÅ ÓÞÅÔÞÉËÁ ËÏÍÁÎÄ ÎÁ ÐÏÓÔÏÑÎÎÕÀ %d × 0x%lx\n" + +#: readelf.c:6841 +#, c-format +msgid " Advance PC by fixed size amount %d to 0x%lx\n" +msgstr " ðÒÏÄ×ÉÖÅÎÉÅ ÓÞÅÔÞÉËÁ ËÏÍÁÎÄ ÎÁ ×ÅÌÉÞÉÎÕ ÆÉËÓÉÒÏ×ÁÎÎÏÇÏ ÒÁÚÍÅÒÁ %d × 0x%lx\n" + +#: readelf.c:6846 +msgid " Set prologue_end to true\n" +msgstr " õÓÔÁÎÏ×ËÁ prologue_end × `ÉÓÔÉÎÁ'\n" + +#: readelf.c:6850 +msgid " Set epilogue_begin to true\n" +msgstr " õÓÔÁÎÏ×ËÁ epilogue_begin × `ÉÓÔÉÎÁ'\n" + +#: readelf.c:6856 +#, c-format +msgid " Set ISA to %d\n" +msgstr " õÓÔÁÎÏ×ËÁ ISA × %d\n" + +#: readelf.c:6860 +#, c-format +msgid " Unknown opcode %d with operands: " +msgstr " îÅÉÚ×ÅÓÔÎÙÊ ËÏÄ ÏÐÅÒÁÃÉÉ %d Ó ÏÐÅÒÁÎÄÁÍÉ: " + +#: readelf.c:6891 readelf.c:7371 readelf.c:7443 +#, c-format +msgid "" +"Contents of the %s section:\n" +"\n" +msgstr "" +"óÏÄÅÒÖÉÍÏÅ ÒÁÚÄÅÌÁ %s:\n" +"\n" + +#: readelf.c:6931 +msgid "Only DWARF 2 and 3 pubnames are currently supported\n" +msgstr "óÅÊÞÁÓ ÐÏÄÄÅÒÖÉ×ÁÀÔÓÑ pubname ÔÏÌØËÏ ÄÌÑ DWARF ×ÅÒÓÉÉ 2 É 3\n" + +#: readelf.c:6938 +#, c-format +msgid " Length: %ld\n" +msgstr " äÌÉÎÁ: %ld\n" + +#: readelf.c:6940 +#, c-format +msgid " Version: %d\n" +msgstr " ÷ÅÒÓÉÑ: %d\n" + +#: readelf.c:6942 +#, c-format +msgid " Offset into .debug_info section: %ld\n" +msgstr " óÍÅÝÅÎÉÅ × ÒÁÚÄÅÌ .debug_info: %ld\n" + +#: readelf.c:6944 +#, c-format +msgid " Size of area in .debug_info section: %ld\n" +msgstr " òÁÚÍ. ÏÂÌÁÓÔÉ × ÒÁÚÄÅÌÅ .debug_info: %ld\n" + +#: readelf.c:6947 +msgid "" +"\n" +" Offset\tName\n" +msgstr "" +"\n" +" óÍÅÝÅÎÉÅ\téÍÑ\n" + +#: readelf.c:7042 +#, c-format +msgid "Unknown TAG value: %lx" +msgstr "îÅÉÚ×ÅÓÔÎÏÅ ÚÎÁÞÅÎÉÅ TAG: %lx" + +#: readelf.c:7156 +#, c-format +msgid "Unknown AT value: %lx" +msgstr "îÅÉÚ×ÅÓÔÎÏÅ ÚÎÁÞÅÎÉÅ AT: %lx " + +#: readelf.c:7193 +#, c-format +msgid "Unknown FORM value: %lx" +msgstr "îÅÉÚ×ÅÓÔÎÏÅ ÚÎÁÞÅÎÉÅ FORM: %lx" + +#: readelf.c:7392 +#, c-format +msgid " DW_MACINFO_start_file - lineno: %d filenum: %d\n" +msgstr " DW_MACINFO_start_file - ÎÏÍÅÒ_ÓÔÒÏËÉ: %d ÎÏÍÅÒ_ÆÁÊÌÁ: %d\n" + +#: readelf.c:7397 +msgid " DW_MACINFO_end_file\n" +msgstr " DW_MACINFO_end_file\n" + +#: readelf.c:7405 +#, c-format +msgid " DW_MACINFO_define - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_define - ÎÏÍÅÒ_ÓÔÒÏËÉ : %d ÍÁËÒÏ : %s\n" + +#: readelf.c:7413 +#, c-format +msgid " DW_MACINFO_undef - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_undef - ÎÏÍÅÒ_ÓÔÒÏËÉ : %d ÍÁËÒÏ : %s\n" + +#: readelf.c:7424 +#, c-format +msgid " DW_MACINFO_vendor_ext - constant : %d string : %s\n" +msgstr " DW_MACINFO_vendor_ext - ËÏÎÓÔÁÎÔÁ : %d ÓÔÒÏËÁ : %s\n" + +#: readelf.c:7452 +msgid " Number TAG\n" +msgstr " þÉÓÌÏ TAG\n" + +#: readelf.c:7458 +#, c-format +msgid " %ld %s [%s]\n" +msgstr " %ld %s [%s]\n" + +#: readelf.c:7461 +msgid "has children" +msgstr "ÉÍÅÅÔ ÐÏÔÏÍËÏ×" + +#: readelf.c:7461 +msgid "no children" +msgstr "ÎÅÔ ÐÏÔÏÍËÏ×" + +#: readelf.c:7465 +#, c-format +msgid " %-18s %s\n" +msgstr " %-18s %s\n" + +#: readelf.c:7486 +#, c-format +msgid " %lu byte block: " +msgstr " %lu-ÂÁÊÔÏ×ÙÊ ÂÌÏË: " + +#: readelf.c:7814 +msgid "(User defined location op)" +msgstr "(ïÐÒÅÄÅÌÅÎÎÏÅ ÐÏÌØÚÏ×ÁÔÅÌÅÍ ÒÁÚÍÅÝÅÎÉÅ ÏÐÅÒÁÃÉÉ)" + +#: readelf.c:7816 +msgid "(Unknown location op)" +msgstr "(îÅÉÚ×ÅÓÔÎÏÅ ÒÁÚÍÅÝÅÎÉÅ ÏÐÅÒÁÃÉÉ)" + +#: readelf.c:7855 +msgid "debug_loc section data" +msgstr "äÁÎÎÙÅ ÒÁÚÄÅÌÁ debug_loc" + +#: readelf.c:7887 +msgid "" +"\n" +"The .debug_loc section is empty.\n" +msgstr "" +"\n" +"òÁÚÄÅÌ .debug_loc ÐÕÓÔ.\n" + +#: readelf.c:7891 +msgid "" +"Contents of the .debug_loc section:\n" +"\n" +msgstr "" +"óÏÄÅÒÖÉÍÏÅ ÒÁÚÄÅÌÁ .debug_loc:\n" +"\n" + +#: readelf.c:7892 +msgid "" +"\n" +" Offset Begin End Expression\n" +msgstr "" +"\n" +" óÍÅÝ. îÁÞÁÌÏ ëÏÎÅà òÁÓÛÉÒÅÎÉÅ\n" + +#: readelf.c:7968 +msgid "debug_str section data" +msgstr "äÁÎÎÙÅ ÒÁÚÄÅÌÁ debug_str" + +#: readelf.c:7987 +msgid "" +msgstr "<ÎÅÔ ÒÁÚÄÅÌÁ .debug_str>" + +#: readelf.c:7990 +msgid "" +msgstr "<ÓÍÅÝÅÎÉÅ ÓÌÉÛËÏÍ ×ÅÌÉËÏ>" + +#: readelf.c:8009 +msgid "" +"\n" +"The .debug_str section is empty.\n" +msgstr "" +"\n" +"òÁÚÄÅÌ .debug_str ÐÕÓÔ.\n" + +#: readelf.c:8013 +msgid "" +"Contents of the .debug_str section:\n" +"\n" +msgstr "" +"óÏÄÅÒÖÉÍÏÅ ÒÁÚÄÅÌÁ .debug_str:\n" +"\n" + +#: readelf.c:8088 +msgid "Internal error: DWARF version is not 2 or 3.\n" +msgstr "÷ÎÕÔÒÅÎÎÑÑ ÏÛÉÂËÁ: ÎÏÍÅÒ ×ÅÒÓÉÉ DWARF ÎÅ 2 ÉÌÉ 3.\n" + +#: readelf.c:8203 +#, c-format +msgid " (indirect string, offset: 0x%lx): %s" +msgstr " (ËÏÓ×ÅÎÎÁÑ ÓÔÒÏËÁ, ÓÍÅÝÅÎÉÅ: 0x%lx): %s" + +#: readelf.c:8212 +#, c-format +msgid "Unrecognized form: %d\n" +msgstr "îÅÒÁÓÐÏÚÎÁÎÎÁÑ ÆÏÒÍÁ: %d\n" + +#: readelf.c:8226 +msgid "(not inlined)" +msgstr "(ÎÅ ×ÎÕÔÒÉÓÔÒÏÞÎÙÊ)" + +#: readelf.c:8229 +msgid "(inlined)" +msgstr "(×ÎÕÔÒÉÓÔÒÏÞÎÙÊ)" + +#: readelf.c:8232 +msgid "(declared as inline but ignored)" +msgstr "(ÏÂßÑ×ÌÅÎ ËÁË ×ÎÕÔÒÉÓÔÒÏÞÎÙÊ, ÎÏ ÐÒÏÐÕÝÅÎ)" + +#: readelf.c:8235 +msgid "(declared as inline and inlined)" +msgstr "(ÏÂßÑ×ÌÅÎ ËÁË ×ÎÕÔÒÉÓÔÒÏÞÎÙÊ, ÔÁË É ÅÓÔØ)" + +#: readelf.c:8238 +#, c-format +msgid " (Unknown inline attribute value: %lx)" +msgstr " (îÅÉÚ×ÅÓÔÎÏÅ ÚÎÁÞÅÎÉÅ ×ÎÕÔÒÉÓÔÒÏÞÎÏÇÏ ÁÔÒÉÂÕÔÁ: %lx)" + +#: readelf.c:8419 readelf.c:8646 +#, c-format +msgid "" +"The section %s contains:\n" +"\n" +msgstr "" +"òÁÚÄÅÌ %s ÓÏÄÅÒÖÉÔ:\n" +"\n" + +#: readelf.c:8535 +#, c-format +msgid " Compilation Unit @ %lx:\n" +msgstr " åÄÉÎÉÃÁ ËÏÍÐÉÌÑÃÉÉ @ %lx:\n" + +#: readelf.c:8536 +#, c-format +msgid " Length: %ld\n" +msgstr " äÌÉÎÁ: %ld\n" + +#: readelf.c:8537 +#, c-format +msgid " Version: %d\n" +msgstr " ÷ÅÒÓÉÑ: %d\n" + +#: readelf.c:8538 +#, c-format +msgid " Abbrev Offset: %ld\n" +msgstr " óÍÅÝ. ÁÂÂÒÅ×: %ld\n" + +#: readelf.c:8539 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " òÁÚÍ. ÕËÁÚÁÔ: %d\n" + +#: readelf.c:8543 +msgid "Only version 2 and 3 DWARF debug information is currently supported.\n" +msgstr "óÅÊÞÁÓ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ ÏÔÌÁÄÏÞÎÁÑ ÉÎÆÏÒÍÁÃÉÑ ÔÏÌØËÏ ÄÌÑ DWARF ×ÅÒÓÉÉ 2 É 3.\n" + +#: readelf.c:8563 +msgid "Unable to locate .debug_abbrev section!\n" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÏÐÒÅÄÅÌÉÔØ ÒÁÚÍÅÝÅÎÉÅ ÒÁÚÄÅÌÁ .debug_abbrev!\n" + +#: readelf.c:8569 +msgid "debug_abbrev section data" +msgstr "äÁÎÎÙÅ ÒÁÚÄÅÌÁ debug_abbrev" + +#: readelf.c:8606 +#, c-format +msgid "Unable to locate entry %lu in the abbreviation table\n" +msgstr "îÅ×ÏÚÍÏÖÎÏ ÏÐÒÅÄÅÌÉÔØ ÒÁÚÍÅÝÅÎÉÅ ÐÕÎËÔÁ %lu × ÔÁÂÌÉÃÅ ÁÂÂÒÅ×ÉÁÃÉÉ\n" + +#: readelf.c:8611 +#, c-format +msgid " <%d><%lx>: Abbrev Number: %lu (%s)\n" +msgstr " <%d><%lx>: îÏÍÅÒ ÁÂÂÒÅ×: %lu (%s)\n" + +#: readelf.c:8691 +msgid "Only DWARF 2 and 3 aranges are currently supported.\n" +msgstr "óÅÊÞÁÓ ÐÏÄÄÅÒÖÉ×ÁÀÔÓÑ aganges ÔÏÌØËÏ ÄÌÑ DWARF ×ÅÒÓÉÉ 2 É 3.\n" + +#: readelf.c:8695 +#, c-format +msgid " Length: %ld\n" +msgstr " äÌÉÎÁ: %ld\n" + +#: readelf.c:8696 +#, c-format +msgid " Version: %d\n" +msgstr " ÷ÅÒÓÉÑ: %d\n" + +#: readelf.c:8697 +#, c-format +msgid " Offset into .debug_info: %lx\n" +msgstr " óÍÅÝÅÎÉÅ × .debug_info: %lx\n" + +#: readelf.c:8698 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " òÁÚÍ. ÕËÁÚÁÔ: %d\n" + +#: readelf.c:8699 +#, c-format +msgid " Segment Size: %d\n" +msgstr " òÁÚÍ. ÓÅÇÍ.: %d\n" + +#: readelf.c:8701 +msgid "" +"\n" +" Address Length\n" +msgstr "" +"\n" +" áÄÒÅÓ äÌÉÎÁ\n" + +#: readelf.c:8903 +#, c-format +msgid "The section %s contains:\n" +msgstr "òÁÚÄÅÌ %s ÓÏÄÅÒÖÉÔ:\n" + +#: readelf.c:9538 +#, c-format +msgid "Displaying the debug contents of section %s is not yet supported.\n" +msgstr "ïÔÏÂÒÁÖÅÎÉÅ ÏÔÌÁÄÏÞÎÏÊ ÉÎÆÏÒÍÁÃÉÉ ÒÁÚÄÅÌÁ %s ÅÝÅ ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ.\n" + +#: readelf.c:9634 +#, c-format +msgid "" +"\n" +"Section '%s' has no debugging data.\n" +msgstr "" +"\n" +"òÁÚÄÅÌ '%s' ÎÅ ÓÏÄÅÒÖÉÔ ÏÔÌÁÄÏÞÎÙÈ ÄÁÎÎÙÈ.\n" + +#: readelf.c:9639 readelf.c:9701 +msgid "debug section data" +msgstr "äÁÎÎÙÅ ÒÁÚÄÅÌÁ ÏÔÌÁÄËÉ" + +#: readelf.c:9655 +#, c-format +msgid "Unrecognized debug section: %s\n" +msgstr "îÅÒÁÓÐÏÚÎÁÎÎÙÊ ÒÁÚÄÅÌ ÏÔÌÁÄËÉ: %s\n" + +#: readelf.c:9729 +msgid "Some sections were not dumped because they do not exist!\n" +msgstr "äÌÑ ÎÅËÏÔÏÒÙÈ ÒÁÚÄÅÌÏ× ÎÅ ÂÙÌ ×ÙÐÏÌÎÅÎ ÄÁÍÐ, ÐÏÔÏÍÕ ÞÔÏ ÏÎÉ ÎÅ ÓÕÝÅÓÔ×ÕÀÔ!\n" + +#: readelf.c:9806 readelf.c:10170 +msgid "liblist" +msgstr "liblist" + +#: readelf.c:9891 +msgid "options" +msgstr "ÏÐÃÉÉ" + +#: readelf.c:9922 +#, c-format +msgid "" +"\n" +"Section '%s' contains %d entries:\n" +msgstr "" +"\n" +"òÁÚÄÅÌ '%s' ÓÏÄÅÒÖÉÔ %d ÐÕÎËÔÏ×:\n" + +#: readelf.c:10083 +msgid "conflict list found without a dynamic symbol table" +msgstr "ÓÐÉÓÏË ËÏÎÆÌÉËÔÏ× ÎÁÊÄÅÎ ÂÅÚ ÔÁÂÌÉÃÙ ÄÉÎÁÍÉÞÅÓËÉÈ ÓÉÍ×ÏÌÏ×" + +#: readelf.c:10101 readelf.c:10117 +msgid "conflict" +msgstr "ËÏÎÆÌÉËÔ" + +#: readelf.c:10127 +#, c-format +msgid "" +"\n" +"Section '.conflict' contains %ld entries:\n" +msgstr "" +"\n" +"òÁÚÄÅÌ '.conflict' ÓÏÄÅÒÖÉÔ %ld ÐÕÎËÔÏ×:\n" + +#: readelf.c:10129 +msgid " Num: Index Value Name" +msgstr " îÏÍ: éÎÄÅËÓ úÎÁÞ. éÍÑ" + +#: readelf.c:10178 +msgid "liblist string table" +msgstr "ÔÁÂÌÉÃÁ ÓÔÒÏË liblist" + +#: readelf.c:10187 +#, c-format +msgid "" +"\n" +"Library list section '%s' contains %lu entries:\n" +msgstr "" +"\n" +"òÁÚÄÅÌ ÓÐÉÓËÁ ÂÉÂÌÉÏÔÅË '%s' ÓÏÄÅÒÖÉÔ %lu ÐÕÎËÔÏ×:\n" + +#: readelf.c:10236 +msgid "NT_PRSTATUS (prstatus structure)" +msgstr "NT_PRSTATUS (ÓÔÒÕËÔÕÒÁ prstatus)" + +#: readelf.c:10237 +msgid "NT_FPREGSET (floating point registers)" +msgstr "NT_FPREGSET (ÒÅÇÉÓÔÒÙ Ó ÐÌÁ×ÁÀÝÅÊ ÔÏÞËÏÊ)" + +#: readelf.c:10238 +msgid "NT_PRPSINFO (prpsinfo structure)" +msgstr "NT_PRPSINFO (ÓÔÒÕËÔÕÒÁ prpsinfo)" + +#: readelf.c:10239 +msgid "NT_TASKSTRUCT (task structure)" +msgstr "NT_TASKSTRUCT (ÓÔÒÕËÔÕÒÁ task)" + +#: readelf.c:10240 +msgid "NT_PRXFPREG (user_xfpregs structure)" +msgstr "NT_PRXFPREG (ÓÔÒÕËÔÕÒÁ user_xfpregs)" + +#: readelf.c:10241 +msgid "NT_PSTATUS (pstatus structure)" +msgstr "NT_PSTATUS (ÓÔÒÕËÔÕÒÁ pstatus)" + +#: readelf.c:10242 +msgid "NT_FPREGS (floating point registers)" +msgstr "NT_FPREGS (ÒÅÇÉÓÔÒÙ Ó ÐÌÁ×ÁÀÝÅÊ ÔÏÞËÏÊ)" + +#: readelf.c:10243 +msgid "NT_PSINFO (psinfo structure)" +msgstr "NT_PSINFO (ÓÔÒÕËÔÕÒÁ psinfo)" + +#: readelf.c:10244 +msgid "NT_LWPSTATUS (lwpstatus_t structure)" +msgstr "NT_LWPSTATUS (ÓÔÒÕËÔÕÒÁ lwpstatus_t)" + +#: readelf.c:10245 +msgid "NT_LWPSINFO (lwpsinfo_t structure)" +msgstr "NT_LWPSINFO (ÓÔÒÕËÔÕÒÁ lwpsinfo_t)" + +#: readelf.c:10246 +msgid "NT_WIN32PSTATUS (win32_pstatus structure)" +msgstr "NT_WIN32PSTATUS (ÓÔÒÕËÔÕÒÁ win32_pstatus)" + +#: readelf.c:10248 readelf.c:10272 +#, c-format +msgid "Unknown note type: (0x%08x)" +msgstr "îÅÉÚ×ÅÓÔÎÙÊ ÔÉÐ ËÏÍÍÅÎÔÁÒÉÑ: (0x%08x)" + +#. NetBSD core "procinfo" structure. +#: readelf.c:10262 +msgid "NetBSD procinfo structure" +msgstr "óÔÒÕËÔÕÒÁ procinfo NetBSD" + +#: readelf.c:10289 readelf.c:10303 +msgid "PT_GETREGS (reg structure)" +msgstr "PT_GETREGS (ÓÔÒÕËÔÕÒÁ reg)" + +#: readelf.c:10291 readelf.c:10305 +msgid "PT_GETFPREGS (fpreg structure)" +msgstr "PT_GETFPREGS (ÓÔÒÕËÔÕÒÁ fpreg)" + +#: readelf.c:10311 +#, c-format +msgid "PT_FIRSTMACH+%d" +msgstr "PT_FIRSTMACH+%d" + +#: readelf.c:10365 +msgid "notes" +msgstr "ËÏÍÍÅÎÔÁÒÉÉ" + +#: readelf.c:10371 +#, c-format +msgid "" +"\n" +"Notes at offset 0x%08lx with length 0x%08lx:\n" +msgstr "" +"\n" +"ëÏÍÍÅÎÔÁÒÉÉ ÓÏ ÓÍÅÝÅÎÉÅÍ 0x%08lx ÄÌÉÎÏÊ 0x%08lx:\n" + +#: readelf.c:10373 +msgid " Owner\t\tData size\tDescription\n" +msgstr " ÷ÌÁÄÅÌÅÃ\t\tòÁÚÍÅÒ ÄÁÎÎÙÈ\tïÐÉÓÁÎÉÅ\n" + +#: readelf.c:10392 +#, c-format +msgid "corrupt note found at offset %x into core notes\n" +msgstr "ÎÁÊÄÅÎ ÐÏ×ÒÅÖÄÅÎÎÙÊ ËÏÍÍÅÎÔÁÒÉÊ ÓÏ ÓÍÅÝÅÎÉÅÍ %x × ÈÒÁÎÉÌÉÝÅ ËÏÍÍÅÎÔÁÒÉÅ×\n" + +#: readelf.c:10394 +#, c-format +msgid " type: %x, namesize: %08lx, descsize: %08lx\n" +msgstr " ÔÉÐ: %x, ÒÁÚÍ_ÉÍÅÎÉ: %08lx, ÒÁÚÍ_ÏÐÉÓ: %08lx\n" + +#: readelf.c:10476 +msgid "No note segments present in the core file.\n" +msgstr "÷ ÆÁÊÌÅ ÓÏÄÅÒÖÉÍÏÇÏ ÏÔÓÕÔÓÔ×ÕÀÔ ÓÅÇÍÅÎÔÙ ËÏÍÍÅÎÔÁÒÉÅ×.\n" + +#: readelf.c:10560 +msgid "" +"This instance of readelf has been built without support for a\n" +"64 bit data type and so it cannot read 64 bit ELF files.\n" +msgstr "" +"üÔÁ ËÏÐÉÑ readelf ÂÙÌÁ ÓÏÂÒÁÎÁ ÂÅÚ ÐÏÄÄÅÒÖËÉ 64-ÂÉÔÎÏÇÏ ÔÉÐÁ\n" +"ÄÁÎÎÙÈ, É ÐÏÜÔÏÍÕ ÏÎÁ ÎÅ ÍÏÖÅÔ ÞÉÔÁÔØ 64-ÂÉÔÎÙÅ ÆÁÊÌÙ ELF.\n" + +#: readelf.c:10606 +#, c-format +msgid "Cannot stat input file %s.\n" +msgstr "îÅ×ÏÚÍÏÖÎÏ ×ÙÐÏÌÎÉÔØ stat ÄÌÑ ×ÈÏÄÎÏÇÏ ÆÁÊÌÁ %s.\n" + +#: readelf.c:10613 +#, c-format +msgid "Input file %s not found.\n" +msgstr "÷ÈÏÄÎÏÊ ÆÁÊÌ %s ÎÅ ÎÁÊÄÅÎ.\n" + +#: readelf.c:10619 +#, c-format +msgid "%s: Failed to read file header\n" +msgstr "%s: óÂÏÊ ÐÒÉ ÞÔÅÎÉÉ ÚÁÇÏÌÏ×ËÁ ÆÁÊÌÁ\n" + +#: readelf.c:10633 +#, c-format +msgid "" +"\n" +"File: %s\n" +msgstr "" +"\n" +"æÁÊÌ: %s\n" + +#: rename.c:132 +#, c-format +msgid "%s: cannot set time: %s" +msgstr "%s: ÎÅ×ÏÚÍÏÖÎÏ ÕÓÔÁÎÏ×ÉÔØ ×ÒÅÍÑ: %s" + +#. We have to clean up here. +#: rename.c:171 rename.c:204 +#, c-format +msgid "%s: rename: %s" +msgstr "%s: ÐÅÒÅÉÍÅÎÏ×ÁÔØ: %s" + +#: rename.c:212 +#, c-format +msgid "%s: simple_copy: %s" +msgstr "%s: ÐÒÏÓÔÏ_ÓËÏÐÉÒÏ×ÁÔØ: %s" + +#: resbin.c:134 +#, c-format +msgid "%s: not enough binary data" +msgstr "%s: ÎÅÄÏÓÔÁÔÏÞÎÏ Ä×ÏÉÞÎÙÈ ÄÁÎÎÙÈ" + +#: resbin.c:153 +msgid "null terminated unicode string" +msgstr "ÓÔÒÏËÁ unicode, ÚÁ×ÅÒÛÅÎÎÁÑ `0'" + +#: resbin.c:183 resbin.c:189 +msgid "resource ID" +msgstr "ID ÒÅÓÕÒÓÁ" + +#: resbin.c:233 +msgid "cursor" +msgstr "ÕËÁÚÁÔÅÌØ" + +#: resbin.c:267 resbin.c:274 +msgid "menu header" +msgstr "ÚÁÇÏÌÏ×ÏË menu" + +#: resbin.c:284 +msgid "menuex header" +msgstr "ÚÁÇÏÌÏ×ÏË menuex" + +#: resbin.c:288 +msgid "menuex offset" +msgstr "ÓÍÅÝÅÎÉÅ menuex" + +#: resbin.c:295 +#, c-format +msgid "unsupported menu version %d" +msgstr "ÎÅÐÏÄÄÅÒÖÉ×ÁÅÍÁÑ ×ÅÒÓÉÑ menu %d" + +#: resbin.c:323 resbin.c:338 resbin.c:404 +msgid "menuitem header" +msgstr "ÚÁÇÏÌÏ×ÏË menuitem" + +#: resbin.c:434 +msgid "menuitem" +msgstr "menuitem" + +#: resbin.c:475 resbin.c:503 +msgid "dialog header" +msgstr "ÚÁÇÏÌÏ×ÏË ÄÉÁÌÏÇÁ" + +#: resbin.c:493 +#, c-format +msgid "unexpected DIALOGEX version %d" +msgstr "ÎÅÐÒÅÄ×ÉÄÅÎÎÁÑ ×ÅÒÓÉÑ DIALOGEX %d" + +#: resbin.c:538 +msgid "dialog font point size" +msgstr "ÒÁÚÍÅÒ × ÐÕÎËÔÁÈ ÛÒÉÆÔÁ ÄÉÁÌÏÇÁ" + +#: resbin.c:546 +msgid "dialogex font information" +msgstr "ÉÎÆÏÒÍÁÃÉÑ Ï ÛÒÉÆÔÅ dialogex" + +#: resbin.c:572 resbin.c:590 +msgid "dialog control" +msgstr "ÕÐÒÁ×ÌÅÎÉÅ ÄÉÁÌÏÇÏÍ" + +#: resbin.c:582 +msgid "dialogex control" +msgstr "ÕÐÒÁ×ÌÅÎÉÅ dialogex" + +#: resbin.c:611 +msgid "dialog control end" +msgstr "ËÏÎÅà ÕÐÒÁ×ÌÅÎÉÑ ÄÉÁÌÏÇÏÍ" + +#: resbin.c:623 +msgid "dialog control data" +msgstr "ÄÁÎÎÙÅ ÕÐÒÁ×ÌÅÎÉÑ ÄÉÁÌÏÇÏÍ" + +#: resbin.c:666 +msgid "stringtable string length" +msgstr "ÄÌÉÎÁ ÓÔÒÏËÉ stringtable" + +#: resbin.c:676 +msgid "stringtable string" +msgstr "ÓÔÒÏËÁ stringtable" + +#: resbin.c:709 +msgid "fontdir header" +msgstr "ÚÁÇÏÌÏ×ÏË fontdir" + +#: resbin.c:722 +msgid "fontdir" +msgstr "fontdir" + +#: resbin.c:738 +msgid "fontdir device name" +msgstr "ÉÍÑ ÕÓÔÒÏÊÓÔ×Á fontdir" + +#: resbin.c:744 +msgid "fontdir face name" +msgstr "ÉÍÑ ÇÁÒÎÉÔÕÒÙ fontdir" + +#: resbin.c:787 +msgid "accelerator" +msgstr "ÁËÓÅÌÅÒÁÔÏÒ" + +#: resbin.c:851 +msgid "group cursor header" +msgstr "ÚÁÇÏÌÏ×ÏË ÕËÁÚÁÔÅÌÑ ÇÒÕÐÐÙ" + +#: resbin.c:855 +#, c-format +msgid "unexpected group cursor type %d" +msgstr "ÎÅÏÖÉÄÁÎÎÙÊ ÔÉÐ ÕËÁÚÁÔÅÌÑ ÇÒÕÐÐÙ %d" + +#: resbin.c:870 +msgid "group cursor" +msgstr "ÕËÁÚÁÔÅÌØ ÇÒÕÐÐÙ" + +#: resbin.c:909 +msgid "group icon header" +msgstr "ÚÁÇÏÌÏ×ÏË ÚÎÁÞËÁ ÇÒÕÐÐÙ" + +#: resbin.c:913 +#, c-format +msgid "unexpected group icon type %d" +msgstr "ÎÅÏÖÉÄÁÎÎÙÊ ÔÉÐ ÚÎÁÞËÁ ÇÒÕÐÐÙ %d" + +#: resbin.c:928 +msgid "group icon" +msgstr "ÚÎÁÞÏË ÇÒÕÐÐÙ" + +#: resbin.c:999 resbin.c:1218 +msgid "unexpected version string" +msgstr "ÎÅÏÖÉÄÁÎÎÁÑ ÓÔÒÏËÁ ×ÅÒÓÉÉ" + +#: resbin.c:1033 +#, c-format +msgid "version length %d does not match resource length %lu" +msgstr "ÄÌÉÎÁ ×ÅÒÓÉÉ %d ÎÅ ÓÏÏÔ×ÅÔÓÔ×ÕÅÔ ÄÌÉÎÅ ÒÅÓÕÒÓÁ %lu" + +#: resbin.c:1037 +#, c-format +msgid "unexpected version type %d" +msgstr "ÎÅÏÖÉÄÁÎÎÙÊ ÔÉÐ ×ÅÒÓÉÉ %d" + +#: resbin.c:1049 +#, c-format +msgid "unexpected fixed version information length %d" +msgstr "ÎÅÏÖÉÄÁÎÎÁÑ ÄÌÉÎÁ ÉÎÆÏÒÍÁÃÉÉ Ï ÆÉËÓÉÒÏ×ÁÎÎÏÊ ×ÅÒÓÉÉ %d" + +#: resbin.c:1052 +msgid "fixed version info" +msgstr "ÉÎÆÏÒÍÁÃÉÑ Ï ÆÉËÓÉÒÏ×ÁÎÎÏÊ ×ÅÒÓÉÉ" + +#: resbin.c:1056 +#, c-format +msgid "unexpected fixed version signature %lu" +msgstr "ÎÅÏÖÉÄÁÎÎÁÑ ÓÉÇÎÁÔÕÒÁ ÆÉËÓÉÒÏ×ÁÎÎÏÊ ×ÅÒÓÉÉ %lu" + +#: resbin.c:1060 +#, c-format +msgid "unexpected fixed version info version %lu" +msgstr "ÎÅÏÖÉÄÁÎÎÁÑ ×ÅÒÓÉÑ ÉÎÆÏÒÍÁÃÉÉ Ï ÆÉËÓÉÒÏ×ÁÎÎÏÊ ×ÅÒÓÉÉ %lu" + +#: resbin.c:1089 +msgid "version var info" +msgstr "ÉÎÆÏÒÍÁÃÉÑ Ï ÐÅÒÅÍÅÎÎÏÊ ×ÅÒÓÉÉ" + +#: resbin.c:1106 +#, c-format +msgid "unexpected stringfileinfo value length %d" +msgstr "ÎÅÏÖÉÄÁÎÎÁÑ ÄÌÉÎÁ ÚÎÁÞÅÎÉÑ stringfileinfo %d" + +#: resbin.c:1116 +#, c-format +msgid "unexpected version stringtable value length %d" +msgstr "ÎÅÏÖÉÄÁÎÎÁÑ ÄÌÉÎÁ ÚÎÁÞÅÎÉÑ ×ÅÒÓÉÉ stringtable %d" + +#: resbin.c:1150 +#, c-format +msgid "unexpected version string length %d != %d + %d" +msgstr "ÎÅÏÖÉÄÁÎÎÁÑ ÄÌÉÎÁ ÓÔÒÏËÉ ×ÅÒÓÉÉ %d != %d + %d" + +#: resbin.c:1161 +#, c-format +msgid "unexpected version string length %d < %d" +msgstr "ÎÅÏÖÉÄÁÎÎÁÑ ÄÌÉÎÁ ÓÔÒÏËÉ ×ÅÒÓÉÉ %d < %d" + +#: resbin.c:1178 +#, c-format +msgid "unexpected varfileinfo value length %d" +msgstr "ÎÅÏÖÉÄÁÎÎÁÑ ÄÌÉÎÁ ÚÎÁÞÅÎÉÑ varfileinfo %d" + +#: resbin.c:1197 +msgid "version varfileinfo" +msgstr "×ÅÒÓÉÑ varfileinfo" + +#: resbin.c:1212 +#, c-format +msgid "unexpected version value length %d" +msgstr "ÎÅÏÖÉÄÁÎÎÁÑ ÄÌÉÎÁ ÚÎÁÞÅÎÉÑ ×ÅÒÓÉÉ %d" + +#: rescoff.c:128 +msgid "filename required for COFF input" +msgstr "ÔÒÅÂÕÅÔÓÑ ÉÍÑ ÄÌÑ ×ÈÏÄÎÏÇÏ COFF" + +#: rescoff.c:145 +#, c-format +msgid "%s: no resource section" +msgstr "%s: ÎÅÔ ÒÁÚÄÅÌÁ ÒÅÓÕÒÓÏ×" + +#: rescoff.c:152 +msgid "can't read resource section" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÐÒÏÞÉÔÁÔØ ÒÁÚÄÅÌ ÒÅÓÕÒÓÏ×" + +#: rescoff.c:178 +#, c-format +msgid "%s: %s: address out of bounds" +msgstr "%s: %s: ÁÄÒÅÓ ÚÁ ÐÒÅÄÅÌÁÍÉ ÇÒÁÎÉÃ" + +#: rescoff.c:197 +msgid "directory" +msgstr "ËÁÔÁÌÏÇ" + +#: rescoff.c:225 +msgid "named directory entry" +msgstr "ÉÍÅÎÏ×ÁÎÎÙÊ ÜÌÅÍÅÎÔ ËÁÔÁÌÏÇÁ" + +#: rescoff.c:234 +msgid "directory entry name" +msgstr "ÉÍÑ ÜÌÅÍÅÎÔÁ ËÁÔÁÌÏÇÁ" + +#: rescoff.c:254 +msgid "named subdirectory" +msgstr "ÉÍÅÎÏ×ÁÎÎÙÊ ÐÏÄËÁÔÁÌÏÇ" + +#: rescoff.c:262 +msgid "named resource" +msgstr "ÉÍÅÎÏ×ÁÎÎÙÊ ÒÅÓÕÒÓ" + +#: rescoff.c:277 +msgid "ID directory entry" +msgstr "ID ÜÌÅÍÅÎÔÁ ËÁÔÁÌÏÇÁ" + +#: rescoff.c:294 +msgid "ID subdirectory" +msgstr "ID ÐÏÄËÁÔÁÌÏÇÁ" + +#: rescoff.c:302 +msgid "ID resource" +msgstr "ID ÒÅÓÕÒÓÁ" + +#: rescoff.c:328 +msgid "resource type unknown" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ÔÉÐ ÒÅÓÕÒÓÁ" + +#: rescoff.c:331 +msgid "data entry" +msgstr "ÜÌÅÍÅÎÔ ÄÁÎÎÙÈ" + +#: rescoff.c:339 +msgid "resource data" +msgstr "ÄÁÎÎÙÅ ÒÅÓÕÒÓÁ" + +#: rescoff.c:344 +msgid "resource data size" +msgstr "ÒÁÚÍÅÒ ÄÁÎÎÙÈ ÒÅÓÕÒÓÁ" + +#: rescoff.c:439 +msgid "filename required for COFF output" +msgstr "ÔÒÅÂÕÅÔÓÑ ÉÍÑ ÆÁÊÌÁ ÄÌÑ ×ÙÈÏÄÎÏÇÏ COFF" + +#: rescoff.c:738 +msgid "can't get BFD_RELOC_RVA relocation type" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÐÏÌÕÞÉÔØ ÔÉÐ ÐÅÒÅÍÅÝÅÎÉÑ BFD_RELOC_RVA" + +#: resrc.c:240 resrc.c:312 +#, c-format +msgid "can't open temporary file `%s': %s" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ×ÒÅÍÅÎÎÙÊ ÆÁÊÌ `%s': %s" + +#: resrc.c:246 +#, c-format +msgid "can't redirect stdout: `%s': %s" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÐÅÒÅÎÁÐÒÁ×ÉÔØ stdout: `%s': %s" + +#: resrc.c:262 +#, c-format +msgid "%s %s: %s" +msgstr "%s %s: %s" + +#: resrc.c:308 +#, c-format +msgid "can't execute `%s': %s" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ×ÙÐÏÌÎÉÔØ `%s': %s" + +#: resrc.c:317 +#, c-format +msgid "Using temporary file `%s' to read preprocessor output\n" +msgstr "éÓÐÏÌØÚÕÅÔÓÑ ×ÒÅÍÅÎÎÙÊ ÆÁÊÌ `%s' ÄÌÑ ÞÔÅÎÉÑ ×ÙÈÏÄÎÙÈ ÄÁÎÎÙÈ ÐÒÅÐÒÏÃÅÓÓÏÒÁ\n" + +#: resrc.c:324 +#, c-format +msgid "can't popen `%s': %s" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ popen `%s': %s" + +#: resrc.c:326 +msgid "Using popen to read preprocessor output\n" +msgstr "éÓÐÏÌØÚÕÅÔÓÑ popen ÄÌÑ ÞÔÅÎÉÑ ×ÙÈÏÄÎÙÈ ÄÁÎÎÙÈ ÐÒÅÐÒÏÃÅÓÓÏÒÁ\n" + +#: resrc.c:369 +#, c-format +msgid "Tried `%s'\n" +msgstr "ïÐÒÏÂÏ×ÁÎ `%s'\n" + +#: resrc.c:380 +#, c-format +msgid "Using `%s'\n" +msgstr "éÓÐÏÌØÚÕÅÔÓÑ `%s'\n" + +#: resrc.c:542 +#, c-format +msgid "%s:%d: %s\n" +msgstr "%s:%d: %s\n" + +#: resrc.c:551 +#, c-format +msgid "%s: unexpected EOF" +msgstr "%s: ÎÅÏÖÉÄÁÎÎÙÊ ËÏÎÅà ÆÁÊÌÁ" + +#: resrc.c:608 +#, c-format +msgid "%s: read of %lu returned %lu" +msgstr "%s: ÐÒÉ ÞÔÅÎÉÉ %lu ÂÙÌÏ ×ÏÚ×ÒÁÝÅÎÏ %lu" + +#: resrc.c:650 resrc.c:905 resrc.c:1178 resrc.c:1332 +#, c-format +msgid "stat failed on bitmap file `%s': %s" +msgstr "stat ÚÁ×ÅÒÛÉÌÓÑ ÎÅÕÄÁÞÅÊ ÄÌÑ ÆÁÊÌÁ ÂÉÔÏ×ÏÇÏ ÏÂÒÁÚÁ `%s': %s" + +#: resrc.c:703 +#, c-format +msgid "cursor file `%s' does not contain cursor data" +msgstr "ÆÁÊÌ ËÕÒÓÏÒÁ `%s' ÎÅ ÓÏÄÅÒÖÉÔ ÄÁÎÎÙÈ ËÕÒÓÏÒÁ" + +#: resrc.c:735 resrc.c:1049 +#, c-format +msgid "%s: fseek to %lu failed: %s" +msgstr "%s: fseek ÄÌÑ %lu ÚÁ×ÅÒÛÉÌÓÑ ÎÅÕÄÁÞÅÊ: %s" + +#: resrc.c:873 +msgid "help ID requires DIALOGEX" +msgstr "ÄÌÑ ID ÓÐÒÁ×ËÉ ÔÒÅÂÕÅÔÓÑ DIALOGEX" + +#: resrc.c:875 +msgid "control data requires DIALOGEX" +msgstr "ÄÌÑ ÕÐÒÁ×ÌÅÎÉÑ ÄÁÎÎÙÍÉ ÔÒÅÂÕÅÔÓÑ DIALOGEX" + +#: resrc.c:1018 +#, c-format +msgid "icon file `%s' does not contain icon data" +msgstr "ÆÁÊÌ ÚÎÁÞËÁ `%s' ÎÅ ÓÏÄÅÒÖÉÔ ÄÁÎÎÙÈ ÚÎÁÞËÁ" + +#: resrc.c:1537 +#, c-format +msgid "can't open `%s' for output: %s" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ `%s' ÄÌÑ ×Ù×ÏÄÁ ÄÁÎÎÙÈ: %s" + +#: size.c:86 +msgid " Displays the sizes of sections inside binary files\n" +msgstr " ïÔÏÂÒÁÖÁÅÔ ÒÁÚÍÅÒÙ ÒÁÚÄÅÌÏ× ×ÎÕÔÒÉ Ä×ÏÉÞÎÙÈ ÆÁÊÌÏ×\n" + +#: size.c:87 +msgid " If no input file(s) are specified, a.out is assumed\n" +msgstr " åÓÌÉ ×ÈÏÄÎÙÅ ÆÁÊÌÙ ÎÅ ÕËÁÚÁÎÙ, ÐÏÄÒÁÚÕÍÅ×ÁÅÔÓÑ ÆÁÊÌ a.out\n" + +#: size.c:88 +#, c-format +msgid "" +" The options are:\n" +" -A|-B --format={sysv|berkeley} Select output style (default is %s)\n" +" -o|-d|-x --radix={8|10|16} Display numbers in octal, decimal or hex\n" +" -t --totals Display the total sizes (Berkeley only)\n" +" --target= Set the binary file format\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +" ïÐÃÉÉ:\n" +" -A|-B --format={sysv|berkeley} ÷ÙÂÏÒ ÓÔÉÌÑ ×Ù×ÏÄÁ ÄÁÎÎÙÈ (ÐÏ ÕÍÏÌÞÁÎÉÀ %s)\n" +" -o|-d|-x --radix={8|10|16} ÷Ù×ÏÄ ÞÉÓÅÌ × ×ÏÓØÍÅÒÉÞÎÏÍ, ÄÅÓÑÔÉÞÎÏÍ\n" +" ÉÌÉ ÛÅÓÔÎÁÄÃÁÔÉÒÉÞÎÏÍ ÆÏÒÍÁÔÅ\n" +" -t --totals ÷Ù×ÏÄ ÓÕÍÍÁÒÎÙÈ ÒÁÚÍÅÒÏ× (ÔÏÌØËÏ Berkeley)\n" +" --target= õÓÔÁÎÏ×ËÁ ÆÏÒÍÁÔÁ Ä×ÏÉÞÎÏÇÏ ÆÁÊÌÁ\n" +" -h --help ÷Ù×ÏÄ ÜÔÏÊ ÉÎÆÏÒÍÁÃÉÉ\n" +" -v --version ÷Ù×ÏÄ ×ÅÒÓÉÉ ÐÒÏÇÒÁÍÍÙ\n" +"\n" + +#: size.c:160 +#, c-format +msgid "invalid argument to --format: %s" +msgstr "ÎÅ×ÅÒÎÙÊ ÁÒÇÕÍÅÎÔ --format: %s" + +#: size.c:187 +#, c-format +msgid "Invalid radix: %s\n" +msgstr "îÅ×ÅÒÎÙÊ radix: %s\n" + +#: srconv.c:1953 +msgid "Convert a COFF object file into a SYSROFF object file\n" +msgstr "ðÒÅÏÂÒÁÚÏ×Ù×ÁÅÔ ÏÂßÅËÔÎÙÊ ÆÁÊÌ COFF × ÏÂßÅËÔÎÙÊ ÆÁÊÌ SYSROFF\n" + +#: srconv.c:1954 +msgid "" +" The options are:\n" +" -q --quick (Obsolete - ignoerd)\n" +" -n --noprescan Do not perform a scan to convert commons into defs\n" +" -d --debug Display information about what is being done\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +" ïÐÃÉÉ:\n" +" -q --quick (ÕÓÔÁÒÅÌÁ - ÉÇÎÏÒÉÒÕÅÔÓÑ)\n" +" -n --noprescan îÅ ×ÙÐÏÌÎÑÔØ ÓËÁÎÉÒÏ×ÁÎÉÅ ÄÌÑ ÐÒÅÏÂÒÁÚÏ×ÁÎÉÑ commons × defs\n" +" -d --debug ÷Ù×ÏÄ ÉÎÆÏÒÍÁÃÉÉ Ï ÔÏÍ, ÞÔÏ ×ÙÐÏÌÎÑÅÔÓÑ\n" +" -h --help ÷Ù×ÏÄ ÜÔÏÊ ÉÎÆÏÒÍÁÃÉÉ\n" +" -v --version ÷Ù×ÏÄ ÎÏÍÅÒÁ ×ÅÒÓÉÉ ÐÒÏÇÒÁÍÍÙ\n" + +#: srconv.c:2099 +#, c-format +msgid "unable to open output file %s" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ×ÙÈÏÄÎÏÊ ÆÁÊÌ %s" + +#: stabs.c:346 stabs.c:1755 +msgid "numeric overflow" +msgstr "ÞÉÓÌÏ×ÏÅ ÐÅÒÅÐÏÌÎÅÎÉÅ" + +#: stabs.c:357 +#, c-format +msgid "Bad stab: %s\n" +msgstr "ðÌÏÈÏÊ stab: %s\n" + +#: stabs.c:367 +#, c-format +msgid "Warning: %s: %s\n" +msgstr "ðÒÅÄÕÐÒÅÖÄÅÎÉÅ: %s: %s\n" + +#: stabs.c:488 +msgid "N_LBRAC not within function\n" +msgstr "N_LBRAC ×ÎÅ ÆÕÎËÃÉÉ\n" + +#: stabs.c:527 +msgid "Too many N_RBRACs\n" +msgstr "óÌÉÛËÏÍ ÍÎÏÇÏ N_RBRACs\n" + +#: stabs.c:773 +msgid "unknown C++ encoded name" +msgstr "ÎÅÉÚ×ÅÓÔÎÏÅ ËÏÄÉÒÏ×ÁÎÎÏÅ ÉÍÑ C++" + +#. Complain and keep going, so compilers can invent new +#. cross-reference types. +#: stabs.c:1293 +msgid "unrecognized cross reference type" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÙÊ ÔÉÐ ÐÅÒÅËÒÅÓÔÎÏÊ ÓÓÙÌËÉ" + +#. Does this actually ever happen? Is that why we are worrying +#. about dealing with it rather than just calling error_type? +#: stabs.c:1847 +msgid "missing index type" +msgstr "ÏÔÓÕÔÓÔ×ÕÅÔ ÉÎÄÅËÓÎÙÊ ÔÉÐ" + +#: stabs.c:2174 +msgid "unknown virtual character for baseclass" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ×ÉÒÔÕÁÌØÎÙÊ ÓÉÍ×ÏÌ ÄÌÑ baseclass" + +#: stabs.c:2192 +msgid "unknown visibility character for baseclass" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ÓÉÍ×ÏÌ ×ÉÄÉÍÏÓÔÉ ÄÌÑ baseclass" + +#: stabs.c:2384 +msgid "unnamed $vb type" +msgstr "ÂÅÚÙÍÑÎÎÙÊ ÔÉÐ $vb" + +#: stabs.c:2390 +msgid "unrecognized C++ abbreviation" +msgstr "ÎÅÒÁÓÐÏÚÎÁÎÎÁÑ ÁÂÂÒÅ×ÉÁÔÕÒÁ C++" + +#: stabs.c:2470 +msgid "unknown visibility character for field" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ÓÉÍ×ÏÌ ×ÉÄÉÍÏÓÔÉ ÄÌÑ field" + +#: stabs.c:2726 +msgid "const/volatile indicator missing" +msgstr "ÏÔÓÕÔÓÔ×ÕÅÔ ÉÎÄÉËÁÔÏÒ ÐÏÓÔÏÑÎÎÏÊ/ÐÅÒÅÍÅÎÎÏÊ" + +#: stabs.c:2967 +#, c-format +msgid "No mangling for \"%s\"\n" +msgstr "îÅÔ ËÏÄÉÒÏ×ÁÎÉÑ ÄÌÑ \"%s\"\n" + +#: stabs.c:3281 +msgid "Undefined N_EXCL" +msgstr "îÅÏÐÒÅÄÅÌÅÎÎÙÊ N_EXCL" + +#: stabs.c:3369 +#, c-format +msgid "Type file number %d out of range\n" +msgstr "îÏÍÅÒ ÆÁÊÌÁ ÔÉÐÁ %d ÚÁ ÐÒÅÄÅÌÁÍÉ ÄÉÁÐÁÚÏÎÁ\n" + +#: stabs.c:3374 +#, c-format +msgid "Type index number %d out of range\n" +msgstr "îÏÍÅÒ ÉÎÄÅËÓÁ ÔÉÐÁ %d ÚÁ ÐÒÅÄÅÌÁÍÉ ÄÉÁÐÁÚÏÎÁ\n" + +#: stabs.c:3461 +#, c-format +msgid "Unrecognized XCOFF type %d\n" +msgstr "îÅÒÁÓÐÏÚÎÁÎÎÙÊ ÔÉÐ XCOFF %d\n" + +#: stabs.c:3762 +#, c-format +msgid "bad mangled name `%s'\n" +msgstr "ÐÌÏÈÏÅ ÓËÏÒÒÅËÔÉÒÏ×ÁÎÎÏÅ ÉÍÑ `%s'\n" + +#: stabs.c:3859 +msgid "no argument types in mangled string\n" +msgstr "ÎÅÔ ÔÉÐÏ× ÁÒÇÕÍÅÎÔÏ× × ÓËÏÒÒÅËÔÉÒÏ×ÁÎÎÏÊ ÓÔÒÏËÅ\n" + +#: strings.c:208 +#, c-format +msgid "invalid number %s" +msgstr "ÎÅ×ÅÒÎÏÅ ÞÉÓÌÏ %s" + +#: strings.c:647 +#, c-format +msgid "invalid integer argument %s" +msgstr "ÎÅ×ÅÒÎÙÊ ÃÅÌÏÞÉÓÌÅÎÎÙÊ ÁÒÇÕÍÅÎÔ %s" + +#: strings.c:658 +msgid " Display printable strings in [file(s)] (stdin by default)\n" +msgstr " ÷Ù×ÏÄÉÔ ÐÒÉÇÏÄÎÙÅ ÄÌÑ ÐÅÞÁÔÉ ÓÔÒÏËÉ × [ÆÁÊÌ(ÁÈ)] (ÐÏ ÕÍÏÌÞÁÎÉÀ stdin)\n" + +#: strings.c:659 +msgid "" +" The options are:\n" +" -a - --all Scan the entire file, not just the data section\n" +" -f --print-file-name Print the name of the file before each string\n" +" -n --bytes=[number] Locate & print any NUL-terminated sequence of at\n" +" - least [number] characters (default 4).\n" +" -t --radix={o,x,d} Print the location of the string in base 8, 10 or 16\n" +" -o An alias for --radix=o\n" +" -T --target= Specify the binary file format\n" +" -e --encoding={s,S,b,l,B,L} Select character size and endianness:\n" +" s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +" ïÐÃÉÉ:\n" +" -a - --all óËÁÎÉÒÏ×ÁÎÉÅ ×ÓÅÇÏ ÆÁÊÌÁ, Á ÎÅ ÔÏÌØËÏ ÒÁÚÄÅÌÁ ÄÁÎÎÙÈ\n" +" -f --print-file-name ÷Ù×ÏÄ ÉÍÅÎÉ ÆÁÊÌÁ ÐÅÒÅÄ ËÁÖÄÏÊ ÓÔÒÏËÏÊ\n" +" -n --bytes=[ÞÉÓÌÏ] ïÂÎÁÒÕÖÅÎÉÅ É ×Ù×ÏÄ ÌÀÂÙÈ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔÅÊ Ó ÚÁ×ÅÒÛÁÀÝÉÍ\n" +" -<ÞÉÓÌÏ> ÎÕÌÅÍ ÄÌÉÎÏÊ × [ÞÉÓÌÏ] ÓÉÍ×ÏÌÏ× (ÐÏ ÕÍÏÌÞÁÎÉÀ 4).\n" +" -t --radix={o,x,d} ÷Ù×ÏÄ ÍÅÓÔÏÐÏÌÏÖÅÎÉÑ ÓÔÒÏËÉ ÐÏ ÏÓÎÏ×ÁÎÉÀ 8, 10 ÉÌÉ 16\n" +" -o áÌÉÁÓ ÄÌÑ --radix=o\n" +" -T --target= õËÁÚÁÎÉÅ ÆÏÒÍÁÔÁ Ä×ÏÉÞÎÏÇÏ ÆÁÊÌÁ\n" +" -e --encoding={s,S,b,l,B,L} ÷ÙÂÏÒ ÒÁÚÍÅÒÁ ÓÉÍ×ÏÌÁ É endianness:\n" +" s = 7-ÂÉÔ, S = 8-ÂÉÔ, {b,l} = 16-ÂÉÔ, {B,L} = 32-ÂÉÔ\n" +" -h --help ÷Ù×ÏÄ ÜÔÏÊ ÉÎÆÏÒÍÁÃÉÉ\n" +" -v --version ÷Ù×ÏÄ ÎÏÍÅÒÁ ×ÅÒÓÉÉ ÐÒÏÇÒÁÍÍÙ\n" + +#: sysdump.c:768 +msgid "Print a human readable interpretation of a SYSROFF object file\n" +msgstr "÷Ù×ÏÄ ÕÄÏÂÏÞÉÔÁÅÍÏÊ ÄÌÑ ÞÅÌÏ×ÅËÁ ÉÎÔÅÒÐÒÅÔÁÃÉÉ ÏÂßÅËÔÎÏÇÏ ÆÁÊÌÁ SYSROFF\n" + +#: sysdump.c:769 +msgid "" +" The options are:\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +" ïÐÃÉÉ:\n" +" -h --help ÷Ù×ÏÄ ÜÔÏÊ ÉÎÆÏÒÍÁÃÉÉ\n" +" -v --version ÷Ù×ÏÄ ÎÏÍÅÒÁ ×ÅÒÓÉÉ ÐÒÏÇÒÁÍÍÙ\n" + +#: sysdump.c:836 +#, c-format +msgid "cannot open input file %s" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ×ÈÏÄÎÏÊ ÆÁÊÌ %s" + +#: version.c:36 +msgid "Copyright 2002 Free Software Foundation, Inc.\n" +msgstr "Copyright 2002 Free Software Foundation, Inc.\n" + +#: version.c:37 +msgid "" +"This program is free software; you may redistribute it under the terms of\n" +"the GNU General Public License. This program has absolutely no warranty.\n" +msgstr "" +"üÔÁ ÐÒÏÇÒÁÍÍÁ Ñ×ÌÑÅÔÓÑ ÏÔËÒÙÔÙÍ ÐÒÏÇÒÁÍÍÎÙÍ ÏÂÅÓÐÅÞÅÎÉÅÍ; ×Ù ÍÏÖÅÔÅ\n" +"ÒÁÓÐÒÏÓÔÒÁÎÑÔØ ÅÅ ÄÁÌÅÅ ÓÏÇÌÁÓÎÏ ÕÓÌÏ×ÉÑÍÉ GNU General Public License.\n" +"üÔÁ ÐÒÏÇÒÁÍÍÁ ÎÅ ÉÍÅÅÔ ÁÂÓÏÌÀÔÎÏ ÎÉËÁËÉÈ ÇÁÒÁÎÔÉÊ.\n" + +#: windres.c:205 +#, c-format +msgid "can't open %s `%s': %s" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ %s `%s': %s " + +#: windres.c:384 +msgid ": expected to be a directory\n" +msgstr ": ÏÖÉÄÁÌÏÓØ, ÞÔÏ ÜÔÏ ËÁÔÁÌÏÇ\n" + +#: windres.c:396 +msgid ": expected to be a leaf\n" +msgstr ": ÏÖÉÄÁÌÏÓØ, ÞÔÏ ÜÔÏ leaf\n" + +#: windres.c:405 +#, c-format +msgid "%s: warning: " +msgstr "%s: ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ: " + +#: windres.c:407 +msgid ": duplicate value\n" +msgstr ": ÐÏ×ÔÏÒÑÀÝÅÅÓÑ ÚÎÁÞÅÎÉÅ\n" + +#: windres.c:569 +#, c-format +msgid "unknown format type `%s'" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ÔÉÐ ÆÏÒÍÁÔÁ `%s'" + +#: windres.c:570 +#, c-format +msgid "%s: supported formats:" +msgstr "%s: ÐÏÄÄÅÒÖÉ×ÁÅÍÙÅ ÆÏÒÍÁÔÙ:" + +#. Otherwise, we give up. +#: windres.c:655 +#, c-format +msgid "can not determine type of file `%s'; use the -I option" +msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÏÐÒÅÄÅÌÉÔØ ÔÉÐ ÆÁÊÌÁ `%s'; ÉÓÐÏÌØÚÕÊÔÅ ÏÐÃÉÀ -I" + +#: windres.c:669 +#, c-format +msgid "Usage: %s [option(s)] [input-file] [output-file]\n" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ: %s [ÏÐÃÉÉ] [×ÈÏÄÎÏÊ_ÆÁÊÌ] [×ÙÈÏÄÎÏÊ_ÆÁÊÌ]\n" + +#: windres.c:671 +msgid "" +" The options are:\n" +" -i --input= Name input file\n" +" -o --output= Name output file\n" +" -J --input-format= Specify input format\n" +" -O --output-format= Specify output format\n" +" -F --target= Specify COFF target\n" +" --preprocessor= Program to use to preprocess rc file\n" +" -I --include-dir= Include directory when preprocessing rc file\n" +" -D --define [=] Define SYM when preprocessing rc file\n" +" -U --undefine Undefine SYM when preprocessing rc file\n" +" -v --verbose Verbose - tells you what it's doing\n" +" -l --language= Set language when reading rc file\n" +" --use-temp-file Use a temporary file instead of popen to read\n" +" the preprocessor output\n" +" --no-use-temp-file Use popen (default)\n" +msgstr "" +" ïÐÃÉÉ:\n" +" -i --input=<ÆÁÊÌ> éÍÑ ×ÈÏÄÎÏÇÏ ÆÁÊÌÁ\n" +" -o --output=<ÆÁÊÌ> éÍÑ ×ÙÈÏÄÎÏÇÏ ÆÁÊÌÁ\n" +" -J --input-format=<ÆÏÒÍÁÔ> õËÁÚÁÎÉÅ ×ÈÏÄÎÏÇÏ ÆÏÒÍÁÔÁ\n" +" -O --output-format=<ÆÏÒÍÁÔ> õËÁÚÁÎÉÅ ×ÙÈÏÄÎÏÇÏ ÆÏÒÍÁÔÁ\n" +" -F --target=<ÃÅÌØ> õËÁÚÁÎÉÅ ÃÅÌÉ COFF\n" +" --preprocessor=<ÐÒÏÇÒÁÍÍÁ> ðÒÏÇÒÁÍÍÁ ÄÌÑ ÐÒÅÄ×ÁÒÉÔÅÌØÎÏÊ ÏÂÒÁÂÏÔËÉ ÆÁÊÌÁ rc\n" +" -I --include-dir=<ËÁÔÁÌÏÇ> ÷ËÌÀÞÁÅÍÙÊ ËÁÔÁÌÏÇ ÐÒÉ ÐÒÅÄ×ÁÒÉÔÅÌØÎÏÊ ÏÂÒÁÂÏÔËÅ ÆÁÊÌÁ rc\n" +" -D --define [=<ÚÎÁÞ>] ïÐÒÅÄÅÌÅÎÉÅ SYM ÐÒÉ ÐÒÅÄ×ÁÒÉÔÅÌØÎÏÊ ÏÂÒÁÂÏÔËÅ ÆÁÊÌÁ rc\n" +" -U --undefine ïÔÍÅÎÁ ÏÐÒÅÄÅÌÅÎÉÑ SYM ÐÒÉ ÐÒÅÄ×ÁÒÉÔÅÌØÎÏÊ ÏÂÒÁÂÏÔËÅ ÆÁÊÌÁ rc\n" +" -v --verbose ðÏÄÒÏÂÎÏ - ÓÏÏÂÝÁÅÔ ×ÁÍ Ï ×ÓÅÈ Ó×ÏÉÈ ÄÅÊÓÔ×ÉÑÈ\n" +" -l --language=<ÚÎÁÞ> õÓÔÁÎÏ×ËÁ ÑÚÙËÁ ÐÒÉ ÞÔÅÎÉÉ ÆÁÊÌÁ rc\n" +" --use-temp-file éÓÐÏÌØÚÏ×ÁÎÉÅ ×ÒÅÍÅÎÎÏÇÏ ÆÁÊÌÁ ×ÍÅÓÔÏ popen\n" +" ÄÌÑ ÞÔÅÎÉÑ ×ÙÈÏÄÎÙÈ ÄÁÎÎÙÈ ÐÒÅÐÒÏÃÅÓÓÏÒÁ\n" +" --no-use-temp-file éÓÐÏÌØÚÏ×ÁÎÉÅ popen (ÐÏ ÕÍÏÌÞÁÎÉÀ)\n" + +#: windres.c:687 +msgid " --yydebug Turn on parser debugging\n" +msgstr " --yydebug ÷ËÌÀÞÅÎÉÅ ÏÔÌÁÄËÉ ÐÁÒÓÅÒÁ\n" + +#: windres.c:690 +msgid "" +" -r Ignored for compatibility with rc\n" +" -h --help Print this help message\n" +" -V --version Print version information\n" +msgstr "" +" -r ðÒÏÐÕÝÅÎÁ ÄÌÑ ÓÏ×ÍÅÓÔÉÍÏÓÔÉ Ó rc\n" +" -h --help ÷Ù×ÏÄ ÜÔÏÇÏ ÓÐÒÁ×ÏÞÎÏÇÏ ÓÏÏÂÝÅÎÉÑ\n" +" -V --version ÷Ù×ÏÄ ÉÎÆÏÒÍÁÃÉÉ Ï ×ÅÒÓÉÉ\n" + +#: windres.c:694 +msgid "" +"FORMAT is one of rc, res, or coff, and is deduced from the file name\n" +"extension if not specified. A single file name is an input file.\n" +"No input-file is stdin, default rc. No output-file is stdout, default rc.\n" +msgstr "" +"FORMAT Ñ×ÌÑÅÔÓÑ ÏÄÎÉÍ ÉÚ rc, res ÉÌÉ coff, É ÏÐÒÅÄÅÌÑÅÔÓÑ ÐÏ ÒÁÓÛÉÒÅÎÉÀ\n" +"ÉÍÅÎÉ ÆÁÊÌÁ, ÅÓÌÉ ÎÅ ÂÙÌ ÕËÁÚÁÎ. ïÄÉÎÏÞÎÏÅ ÉÍÑ ÆÁÊÌÁ Ñ×ÌÑÅÔÓÑ ×ÈÏÄÎÙÍ ÆÁÊÌÏÍ.\n" +"âÅÚ ×ÈÏÄÎÏÇÏ ÆÁÊÌÁ ÉÓÐÏÌØÚÕÅÔ stdin, ÐÏ ÕÍÏÌÞÁÎÉÀ rc. âÅÚ ×ÙÈÏÄÎÏÇÏ ÆÁÊÌÁ\n" +"ÉÓÐÏÌØÚÕÅÔÓÑ stdout, ÐÏ ÕÍÏÌÞÁÎÉÀ rc.\n" + +#: windres.c:833 +msgid "invalid option -f\n" +msgstr "ÎÅ×ÅÒÎÁÑ ÏÐÃÉÑ -f\n" + +#: windres.c:838 +msgid "No filename following the -fo option.\n" +msgstr "îÅÔ ÉÍÅÎÉ ÆÁÊÌÁ ÐÏÓÌÅ ÏÐÃÉÉ -fo.\n" + +#: windres.c:896 +msgid "Option -I is deprecated for setting the input format, please use -J instead.\n" +msgstr "ïÐÃÉÑ -I ËÒÁÊÎÅ ÎÅ ÒÅËÏÍÅÎÄÕÅÔÓÑ ÄÌÑ ÕÓÔÁÎÏ×ËÉ ×ÈÏÄÎÏÇÏ ÆÏÒÍÁÔÁ, ÐÏÖÁÌÕÊÓÔÁ, ÉÓÐÏÌØÚÕÊÔÅ -J.\n" + +#: windres.c:1014 +msgid "no resources" +msgstr "ÎÅÔ ÒÅÓÕÒÓÏ×" + +#: wrstabs.c:395 wrstabs.c:2055 +#, c-format +msgid "string_hash_lookup failed: %s" +msgstr "string_hash_lookup ÚÁ×ÅÒÛÉÌÓÑ ÎÅÕÄÁÞÅÊ: %s" + +#: wrstabs.c:695 +#, c-format +msgid "stab_int_type: bad size %u" +msgstr "stab_int_type: ÎÅ×ÅÒÎÙÊ ÒÁÚÍÅÒ %u" + +#: wrstabs.c:1495 +#, c-format +msgid "%s: warning: unknown size for field `%s' in struct" +msgstr "%s: ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ: ÎÅÉÚ×ÅÓÔÎÙÊ ÒÁÚÍÅÒ ÐÏÌÑ `%s' × struct" diff --git a/binutils/po/sv.gmo b/binutils/po/sv.gmo new file mode 100644 index 0000000000000..16e6443994939 Binary files /dev/null and b/binutils/po/sv.gmo differ diff --git a/binutils/po/sv.po b/binutils/po/sv.po new file mode 100644 index 0000000000000..5f37fb53b6edf --- /dev/null +++ b/binutils/po/sv.po @@ -0,0 +1,5571 @@ +# Swedish messages for binutils. +# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Tommy Pettersson , 2001, 2002. +# +msgid "" +msgstr "" +"Project-Id-Version: binutils 2.12.1\n" +"POT-Creation-Date: 2002-01-17 13:58+0000\n" +"PO-Revision-Date: 2002-08-05 00:03+0200\n" +"Last-Translator: Tommy Pettersson \n" +"Language-Team: Swedish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +# +#: addr2line.c:73 +#, c-format +msgid "" +"Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n" +" [-e executable] [--exe=executable] [--demangle[=style]]\n" +" [--basenames] [--functions] [addr addr ...]\n" +msgstr "" +"Användning: %s [-CfsHV] [-b bfd-namn] [--target=bfd-namn]\n" +" [-e programfil] [--exe=programfil] [--demangle[=stil]]\n" +" [--basenames] [--functions] [adress adress ...]\n" + +# +#: addr2line.c:80 ar.c:289 nlmconv.c:1121 objcopy.c:423 objcopy.c:455 +#: readelf.c:2181 size.c:91 strings.c:655 windres.c:737 +#, c-format +msgid "Report bugs to %s\n" +msgstr "" +"Rapportera fel till %s\n" +"Skicka synpunkter på översättningen till sv@li.org\n" + +# +#: addr2line.c:240 +#, c-format +msgid "%s: can not get addresses from archive" +msgstr "%s: kommer inte åt adresserna i arkivet" + +# +#: addr2line.c:312 nm.c:447 objdump.c:2800 +#, c-format +msgid "unknown demangling style `%s'" +msgstr "okänd avkodningsstil \"%s\"" + +# +#: ar.c:237 +#, c-format +msgid "no entry %s in archive\n" +msgstr "ingen post %s i arkivet\n" + +# +#: ar.c:254 +#, c-format +msgid "Usage: %s [-X32_64] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n" +msgstr "Användning: %s [-X32_64] [-]{dmpqrstx}[abcfilNoPsSuvV] [medlemsnamn] [nummer] arkivfil fil...\n" + +# +#: ar.c:257 +#, c-format +msgid " %s -M [\n" +"\n" +msgstr "" +"\n" +"\n" +"\n" + +# +#: ar.c:850 ar.c:918 +#, c-format +msgid "%s is not a valid archive" +msgstr "%s är inte ett giltigt arkiv" + +# +#: ar.c:886 +#, c-format +msgid "stat returns negative size for %s" +msgstr "stat returnerar negativ storlek på %s" + +# +#: ar.c:1013 +#, c-format +msgid "%s is not an archive" +msgstr "%s är inte ett arkiv" + +# +#: ar.c:1020 +#, c-format +msgid "creating %s" +msgstr "skapar %s" + +# +#: ar.c:1226 +#, c-format +msgid "No member named `%s'\n" +msgstr "Ingen medlem heter \"%s\"\n" + +# +#: ar.c:1278 +#, c-format +msgid "no entry %s in archive %s!" +msgstr "ingen post %s i arkiv %s!" + +# +# archive map verkar vara vad indexet kallas i källkoden +#: ar.c:1439 +#, c-format +msgid "%s: no archive map to update" +msgstr "%s: inget arkivindex att uppdatera" + +# +#: arsup.c:88 +#, c-format +msgid "No entry %s in archive.\n" +msgstr "Ingen post %s i arkivet.\n" + +# +#: arsup.c:120 +#, c-format +msgid "Can't open file %s\n" +msgstr "Kan inte öppna fil %s\n" + +# +#: arsup.c:171 +#, c-format +msgid "%s: Can't open output archive %s\n" +msgstr "%s: Kan inte öppna utdataarkiv %s\n" + +# +#: arsup.c:183 +#, c-format +msgid "%s: Can't open input archive %s\n" +msgstr "%s: Kan inte öppna indataarkiv %s\n" + +# +#: arsup.c:189 +#, c-format +msgid "%s: file %s is not an archive\n" +msgstr "%s: fil %s är inte ett arkiv\n" + +# +#: arsup.c:230 +#, c-format +msgid "%s: no output archive specified yet\n" +msgstr "%s: inget utdataarkiv angivet än\n" + +# +#: arsup.c:250 arsup.c:285 arsup.c:321 arsup.c:341 arsup.c:399 +#, c-format +msgid "%s: no open output archive\n" +msgstr "%s: inget öppet utdataarkiv\n" + +# +#: arsup.c:258 arsup.c:359 arsup.c:379 +#, c-format +msgid "%s: can't open file %s\n" +msgstr "%s: kan inte öppna fil %s\n" + +# +# module file är detsamma som member +#: arsup.c:306 arsup.c:375 arsup.c:454 +#, c-format +msgid "%s: can't find module file %s\n" +msgstr "%s: hittar inte modulfil %s\n" + +# +#: arsup.c:406 +#, c-format +msgid "Current open archive is %s\n" +msgstr "Det aktuella öppna arkivet är %s\n" + +# +# BUGG: dubbelt blanksteg +#: arsup.c:433 +#, c-format +msgid "%s: no open archive\n" +msgstr "%s: inget öppet arkiv\n" + +# +#: bucomm.c:106 +#, c-format +msgid "can't set BFD default target to `%s': %s" +msgstr "kan inte sätta BFD:s standardmål till \"%s\": %s" + +# +#: bucomm.c:118 +#, c-format +msgid "%s: Matching formats:" +msgstr "%s: Passande format:" + +# +#: bucomm.c:135 +msgid "Supported targets:" +msgstr "Mål som hanteras:" + +# +#: bucomm.c:137 +#, c-format +msgid "%s: supported targets:" +msgstr "%s: mål som hanteras:" + +# +#: bucomm.c:153 +msgid "Supported architectures:" +msgstr "Arkitekturer som hanteras:" + +# +#: bucomm.c:155 +#, c-format +msgid "%s: supported architectures:" +msgstr "%s: arkitekturer som hanteras:" + +# +#: bucomm.c:262 +#, c-format +msgid "%s: bad number: %s" +msgstr "%s: felaktigt tal: %s" + +# +#: coffdump.c:106 +#, c-format +msgid "#lines %d " +msgstr "#rader %d " + +# +#: coffdump.c:468 sysdump.c:740 +#, c-format +msgid "%s: Print a human readable interpretation of a SYSROFF object file\n" +msgstr "%s: Skriv en mänskligt läsbar tolkning av en SYSROFF-objektfil\n" + +# +#: coffdump.c:531 srconv.c:2029 sysdump.c:799 +msgid "no input file specified" +msgstr "ingen indatafil angavs" + +# +#: debug.c:653 +msgid "debug_add_to_current_namespace: no current file" +msgstr "debug_add_to_current_namespace: ingen aktuell fil" + +# +#: debug.c:736 +msgid "debug_start_source: no debug_set_filename call" +msgstr "debug_start_source: inget anrop till debug_set_filename" + +# +#: debug.c:795 +msgid "debug_record_function: no debug_set_filename call" +msgstr "debug_record_function: inget anrop till debug_set_filename" + +# +#: debug.c:851 +msgid "debug_record_parameter: no current function" +msgstr "debug_record_parameter: ingen aktuell funktion" + +# +#: debug.c:885 +msgid "debug_end_function: no current function" +msgstr "debug_end_function: ingen aktuell funktion" + +# +#: debug.c:891 +msgid "debug_end_function: some blocks were not closed" +msgstr "debug_end_function: några block avslutades inte" + +# +#: debug.c:921 +msgid "debug_start_block: no current block" +msgstr "debug_start_block: inget aktuellt block" + +# +#: debug.c:959 +msgid "debug_end_block: no current block" +msgstr "debug_end_block: inget aktuellt block" + +# +#: debug.c:966 +msgid "debug_end_block: attempt to close top level block" +msgstr "debug_end_block: försök gjordes att avsluta yttersta blocket" + +# +#: debug.c:992 +msgid "debug_record_line: no current unit" +msgstr "debug_record_line: ingen aktuell kompileringsenhet" + +# +#. FIXME +#: debug.c:1046 +msgid "debug_start_common_block: not implemented" +msgstr "debug_start_common_block: inte implementerat" + +# +#. FIXME +#: debug.c:1058 +msgid "debug_end_common_block: not implemented" +msgstr "debug_end_common_block: inte implementerat" + +# +# BUGG: Kolon saknas antagligen +#. FIXME. +#: debug.c:1152 +msgid "debug_record_label not implemented" +msgstr "debug_record_label: inte implementerat" + +# +#: debug.c:1178 +msgid "debug_record_variable: no current file" +msgstr "debug_record_variable: ingen aktuell fil" + +# +#: debug.c:1194 +msgid "debug_record_variable: no current block" +msgstr "debug_record_variable: inget aktuellt block" + +# +#: debug.c:1764 +msgid "debug_make_undefined_type: unsupported kind" +msgstr "debug_make_undefined_type: sorten kan inte hanteras" + +# +#: debug.c:1970 +msgid "debug_name_type: no current file" +msgstr "debug_name_type: ingen aktuell fil" + +# +#: debug.c:2018 +msgid "debug_tag_type: no current file" +msgstr "debug_tag_type: ingen aktuell fil" + +# +#: debug.c:2026 +msgid "debug_tag_type: extra tag attempted" +msgstr "debug_tag_type: försök gjordes att sätta en extra tagg" + +# +#: debug.c:2066 +#, c-format +msgid "Warning: changing type size from %d to %d\n" +msgstr "Varning: ändrar datatypens storlek från %d till %d\n" + +# +#: debug.c:2090 +msgid "debug_find_named_type: no current compilation unit" +msgstr "debug_find_named_type: ingen aktuell kompileringsenhet" + +# +#: debug.c:2197 +#, c-format +msgid "debug_get_real_type: circular debug information for %s\n" +msgstr "debug_get_real_type: %s har cirkulär felsökningsinformation\n" + +# +#: debug.c:2662 +msgid "debug_write_type: illegal type encountered" +msgstr "debug_write_type: påträffade en ogiltig typ" + +# +#: dlltool.c:743 dlltool.c:768 dlltool.c:794 +#, c-format +msgid "Internal error: Unknown machine type: %d" +msgstr "Internt fel: Okänd maskintyp: %d" + +# +#: dlltool.c:831 +#, c-format +msgid "Can't open def file: %s" +msgstr "Kan inte öppna def-fil: %s" + +# +# Här parsas def-filen bara, så den bearbetas inte +#: dlltool.c:836 +#, c-format +msgid "Processing def file: %s" +msgstr "Behandlar def-fil: %s" + +# +#: dlltool.c:840 +msgid "Processed def file" +msgstr "Def-filen är behandlad" + +# +#: dlltool.c:866 +#, c-format +msgid "Syntax error in def file %s:%d" +msgstr "Syntaktiskt fel i def-fil %s:%d" + +# +#: dlltool.c:905 +#, c-format +msgid "NAME: %s base: %x" +msgstr "NAME: %s bas: %x" + +# +#: dlltool.c:908 dlltool.c:927 +msgid "Can't have LIBRARY and NAME" +msgstr "Kan inte ha både LIBRARY och NAME" + +# +#: dlltool.c:924 +#, c-format +msgid "LIBRARY: %s base: %x" +msgstr "LIBRARY: %s bas: %x" + +# +#: dlltool.c:1182 resrc.c:271 +#, c-format +msgid "wait: %s" +msgstr "wait: %s" + +# +#: dlltool.c:1187 dllwrap.c:455 resrc.c:276 +#, c-format +msgid "subprocess got fatal signal %d" +msgstr "barnprocessen fick fatal signal %d" + +# +#: dlltool.c:1193 dllwrap.c:462 resrc.c:283 +#, c-format +msgid "%s exited with status %d" +msgstr "%s avslutade med status %d" + +# +#: dlltool.c:1225 +#, c-format +msgid "Sucking in info from %s section in %s" +msgstr "Suger åt mig info från sektion %s i %s" + +# +#: dlltool.c:1349 +#, c-format +msgid "Excluding symbol: %s" +msgstr "Undantar symbol: %s" + +# +#: dlltool.c:1444 dlltool.c:1455 nm.c:958 nm.c:969 objdump.c:383 objdump.c:400 +#, c-format +msgid "%s: no symbols" +msgstr "%s: inga symboler" + +# +#. FIXME: we ought to read in and block out the base relocations +#: dlltool.c:1482 +#, c-format +msgid "Done reading %s" +msgstr "Klar med att läsa %s" + +# +#: dlltool.c:1493 +#, c-format +msgid "Unable to open object file: %s" +msgstr "Kan inte öppna objektfil: %s" + +# +#: dlltool.c:1496 +#, c-format +msgid "Scanning object file %s" +msgstr "Genomsöker objektfil %s" + +# +#: dlltool.c:1511 +#, c-format +msgid "Cannot produce mcore-elf dll from archive file: %s" +msgstr "Kan inte producera en mcore-elf-dll från arkivfil: %s" + +# +#: dlltool.c:1603 +msgid "Adding exports to output file" +msgstr "Lägger till exporter till utdatafilen" + +# +#: dlltool.c:1648 +msgid "Added exports to output file" +msgstr "La till exporter till utdatafilen" + +# +#: dlltool.c:1772 +#, c-format +msgid "Generating export file: %s" +msgstr "Genererar exportfil: %s" + +# +#: dlltool.c:1777 +#, c-format +msgid "Unable to open temporary assembler file: %s" +msgstr "Kan inte öppna temporär assemblerfil: %s" + +# +#: dlltool.c:1780 +#, c-format +msgid "Opened temporary file: %s" +msgstr "Öppnade temporär fil: %s" + +# +#: dlltool.c:2004 +msgid "Generated exports file" +msgstr "Genererade exportfil" + +# +#: dlltool.c:2266 +#, c-format +msgid "bfd_open failed open stub file: %s" +msgstr "bfd_open misslyckades att öppna stubbfil: %s" + +# +#: dlltool.c:2269 +#, c-format +msgid "Creating stub file: %s" +msgstr "Skapar stubbfil: %s" + +# +#: dlltool.c:2658 +#, c-format +msgid "failed to open temporary head file: %s" +msgstr "misslyckades att öppna temporär huvudfil: %s" + +# +#: dlltool.c:2717 +#, c-format +msgid "failed to open temporary tail file: %s" +msgstr "misslyckades att öppna temporär svansfil: %s" + +# +#: dlltool.c:2785 +#, c-format +msgid "Can't open .lib file: %s" +msgstr "Kan inte öppna .lib-fil: %s" + +# +#: dlltool.c:2788 +#, c-format +msgid "Creating library file: %s" +msgstr "Skapar biblioteksfil: %s" + +# +#: dlltool.c:2847 +#, c-format +msgid "cannot delete %s: %s" +msgstr "kan inte ta bort %s: %s" + +# +#: dlltool.c:2851 +msgid "Created lib file" +msgstr "Skapade biblioteksfilen" + +# +#: dlltool.c:2956 +#, c-format +msgid "Warning, ignoring duplicate EXPORT %s %d,%d" +msgstr "Varning, ignorerar dubbel EXPORT %s %d,%d" + +# +#: dlltool.c:2962 +#, c-format +msgid "Error, duplicate EXPORT with oridinals: %s" +msgstr "Fel, dubbel EXPORT med ordningstal: %s" + +# +# Här bearbetas definitionerna (sorteras bl.a.) +#: dlltool.c:3089 +msgid "Processing definitions" +msgstr "Bearbetar definitioner" + +# +#: dlltool.c:3127 +msgid "Processed definitions" +msgstr "Definitionerna är bearbetade" + +# +# BUGG: Kolon fattas +#. xgetext:c-format +#: dlltool.c:3138 dllwrap.c:519 +#, c-format +msgid "Usage %s \n" +msgstr "Användning: %s \n" + +# +#. xgetext:c-format +#: dlltool.c:3140 +#, c-format +msgid " -m --machine Create as DLL for . [default: %s]\n" +msgstr " -m --machine Skapa som DLL för . [förval: %s]\n" + +# +#: dlltool.c:3141 +msgid " possible : arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" +msgstr " möjliga : arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" + +# +#: dlltool.c:3142 +msgid " -e --output-exp Generate an export file.\n" +msgstr " -e --output-exp Generera en exportfil.\n" + +# +#: dlltool.c:3143 +msgid " -l --output-lib Generate an interface library.\n" +msgstr " -l --output-lib Generera ett gränssnittsbibliotek.\n" + +# +#: dlltool.c:3144 +msgid " -a --add-indirect Add dll indirects to export file.\n" +msgstr " -a --add-indirect Lägg till indirekta dll till exportfilen.\n" + +# +#: dlltool.c:3145 +msgid " -D --dllname Name of input dll to put into interface lib.\n" +msgstr " -D --dllname Namn på indata-dll att infoga i gränssnittsbiblioteket.\n" + +# +#: dlltool.c:3146 +msgid " -d --input-def Name of .def file to be read in.\n" +msgstr " -d --input-def Namn på .def-fil att läsa in.\n" + +# +#: dlltool.c:3147 +msgid " -z --output-def Name of .def file to be created.\n" +msgstr " -z --output-def Namn på .def-fil att skapa.\n" + +# +#: dlltool.c:3148 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols Exportera alla symboler till .def\n" + +# +# Följande sträng har den beskrivande delen indenterad två tecken +# extra i den engelska texten för att två flaggor är för långa. I den +# svenska översättningen är de indenterade tre tecken extra för att +# den ena flaggan blev ytterligare ett tecken för lång. +#: dlltool.c:3149 +msgid " --no-export-all-symbols Only export listed symbols\n" +msgstr " --no-export-all-symbols Exportera endast anvisade symboler\n" + +# +# Följande sträng har den beskrivande delen indenterad två tecken +# extra i den engelska texten för att två flaggor är för långa. I den +# svenska översättningen är de indenterade tre tecken extra för att +# den ena flaggan blev ytterligare ett tecken för lång. +#: dlltool.c:3150 +msgid " --exclude-symbols Don't export \n" +msgstr " --exclude-symbols Exportera inte symboler i \n" + +# +#: dlltool.c:3151 +msgid " --no-default-excludes Clear default exclude symbols\n" +msgstr " --no-default-excludes Inga automatiskt undantagna symboler\n" + +# +#: dlltool.c:3152 +msgid " -b --base-file Read linker generated base file.\n" +msgstr " -b --base-file Läs den länkargenererade basfilen.\n" + +# +#: dlltool.c:3153 +msgid " -x --no-idata4 Don't generate idata$4 section.\n" +msgstr " -x --no-idata4 Generera ingen idata$4-sektion.\n" + +# +#: dlltool.c:3154 +msgid " -c --no-idata5 Don't generate idata$5 section.\n" +msgstr " -c --no-idata5 Generera ingen idata$5-sektion.\n" + +# +#: dlltool.c:3155 +msgid " -U --add-underscore Add underscores to symbols in interface library.\n" +msgstr " -U --add-underscore Lägg till understreck på symboler i gränssnittsbiblioteket.\n" + +# +#: dlltool.c:3156 +msgid " -k --kill-at Kill @ from exported names.\n" +msgstr " -k --kill-at Utplåna @ från exporterade namn.\n" + +# +#: dlltool.c:3157 +msgid " -A --add-stdcall-alias Add aliases without @.\n" +msgstr " -A --add-stdcall-alias Lägg till alias utan @.\n" + +# +#: dlltool.c:3158 +msgid " -S --as Use for assembler.\n" +msgstr " -S --as Använd som assemblerare.\n" + +# +#: dlltool.c:3159 +msgid " -f --as-flags Pass to the assembler.\n" +msgstr " -f --as-flags Skicka till assembleraren.\n" + +# +#: dlltool.c:3160 +msgid " -C --compat-implib Create backward compatible import library.\n" +msgstr " -C --compat-implib Skapa bakåtkompatibelt importbibliotek.\n" + +# +#: dlltool.c:3161 +msgid " -n --no-delete Keep temp files (repeat for extra preservation).\n" +msgstr " -n --no-delete Behåll temp.-filer (repetera för ökat antal).\n" + +# +#: dlltool.c:3162 +msgid " -v --verbose Be verbose.\n" +msgstr " -v --verbose Var mångordig.\n" + +# +#: dlltool.c:3163 +msgid " -V --version Display the program version.\n" +msgstr " -V --version Visa versionsinformation om programmet.\n" + +# +#: dlltool.c:3164 +msgid " -h --help Display this information.\n" +msgstr " -h --help Visa den här informationen.\n" + +# +#: dlltool.c:3166 +msgid " -M --mcore-elf Process mcore-elf object files into .\n" +msgstr " -M --mcore-elf Behandla mcore-elf-objektfiler till .\n" + +# +#: dlltool.c:3167 +msgid " -L --linker Use as the linker.\n" +msgstr " -L --linker Använd som länkare.\n" + +# +# Justeringen blir fel här för flaggan är för lång. +#: dlltool.c:3168 +msgid " -F --linker-flags Pass to the linker.\n" +msgstr " -F --linker-flags Skicka till länkaren.\n" + +# +#: dlltool.c:3315 +#, c-format +msgid "Unable to open base-file: %s" +msgstr "Kan inte öppna basfilen: %s" + +# +#: dlltool.c:3344 +#, c-format +msgid "Machine '%s' not supported" +msgstr "Maskin \"%s\" hanteras inte" + +# +#: dlltool.c:3447 dllwrap.c:240 +#, c-format +msgid "Tried file: %s" +msgstr "Provade fil: %s" + +# +#: dlltool.c:3454 dllwrap.c:247 +#, c-format +msgid "Using file: %s" +msgstr "Använder fil: %s" + +# +#: dllwrap.c:334 +#, c-format +msgid "Keeping temporary base file %s" +msgstr "Behåller temporär basfil %s" + +# +#: dllwrap.c:336 +#, c-format +msgid "Deleting temporary base file %s" +msgstr "Tar bort temporär basfil %s" + +# +#: dllwrap.c:350 +#, c-format +msgid "Keeping temporary exp file %s" +msgstr "Behåller temporär exportfil %s" + +# +#: dllwrap.c:352 +#, c-format +msgid "Deleting temporary exp file %s" +msgstr "Tar bort temporär exportfil %s" + +# +#: dllwrap.c:365 +#, c-format +msgid "Keeping temporary def file %s" +msgstr "Behåller temporär def-fil %s" + +# +#: dllwrap.c:367 +#, c-format +msgid "Deleting temporary def file %s" +msgstr "Tar bort temporär def-fil %s" + +# +#: dllwrap.c:520 +msgid " Generic options:\n" +msgstr " Generella flaggor:\n" + +# +#: dllwrap.c:521 +msgid " --quiet, -q Work quietly\n" +msgstr " --quiet, -q Arbeta under tystnad\n" + +# +#: dllwrap.c:522 +msgid " --verbose, -v Verbose\n" +msgstr " --verbose, -v Mångordig\n" + +# +#: dllwrap.c:523 +msgid " --version Print dllwrap version\n" +msgstr " --version Visa versionsinformation för dllwrap\n" + +# +#: dllwrap.c:524 +msgid " --implib Synonym for --output-lib\n" +msgstr " --implib Synonym för --output-lib\n" + +# +#: dllwrap.c:525 +#, c-format +msgid " Options for %s:\n" +msgstr " Flaggor för %s:\n" + +# +#: dllwrap.c:526 +msgid " --driver-name Defaults to \"gcc\"\n" +msgstr " --driver-name Förvald till \"gcc\"\n" + +# +#: dllwrap.c:527 +msgid " --driver-flags Override default ld flags\n" +msgstr " --driver-flags Förbigå förvalda flaggor för ld\n" + +# +#: dllwrap.c:528 +msgid " --dlltool-name Defaults to \"dlltool\"\n" +msgstr " --dlltool-name Förvalt till \"dlltool\"\n" + +# +#: dllwrap.c:529 +msgid " --entry Specify alternate DLL entry point\n" +msgstr " --entry Ange alternativ ingångspunkt i DLL:en\n" + +# +#: dllwrap.c:530 +msgid " --image-base Specify image base address\n" +msgstr " --image-base Ange bildens basadress\n" + +# +#: dllwrap.c:531 +msgid " --target i386-cygwin32 or i386-mingw32\n" +msgstr " --target i386-cygwin32 eller i386-mingw32\n" + +# +#: dllwrap.c:532 +msgid " --dry-run Show what needs to be run\n" +msgstr " --dry-run Gör inget annat än att visa vad som måste köras\n" + +# +#: dllwrap.c:533 +msgid " --mno-cygwin Create Mingw DLL\n" +msgstr " --mno-cygwin Skapa Mingw-DLL\n" + +# +#: dllwrap.c:534 +msgid " Options passed to DLLTOOL:\n" +msgstr " Flaggor som skickas till DLLVERKTYG:\n" + +# +#: dllwrap.c:535 +msgid " --machine \n" +msgstr " --machine \n" + +# +#: dllwrap.c:536 +msgid " --output-exp Generate export file.\n" +msgstr " --output-exp Generera exportfil.\n" + +# +#: dllwrap.c:537 +msgid " --output-lib Generate input library.\n" +msgstr " --output-lib Generera indatabibliotek.\n" + +# +#: dllwrap.c:538 +msgid " --add-indirect Add dll indirects to export file.\n" +msgstr " --add-indirect Lägg till indirekta dll till exportfilen.\n" + +# +#: dllwrap.c:539 +msgid " --dllname Name of input dll to put into output lib.\n" +msgstr " --dllname Namn på indata-dll som ska infogas i utdatabiblioteket.\n" + +# +#: dllwrap.c:540 +msgid " --def Name input .def file\n" +msgstr " --def Namnge .def-indatafilen\n" + +# +#: dllwrap.c:541 +msgid " --output-def Name output .def file\n" +msgstr " --output-def Namnge .def-utdatafilen\n" + +# +#: dllwrap.c:542 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols Exportera alla symboler till .def\n" + +# +#: dllwrap.c:543 +msgid " --no-export-all-symbols Only export .drectve symbols\n" +msgstr " --no-export-all-symbols Exportera endast .drectve-symboler\n" + +# +#: dllwrap.c:544 +msgid " --exclude-symbols Exclude from .def\n" +msgstr " --exclude-symbols Undanta symbolerna i från .def\n" + +# +#: dllwrap.c:545 +msgid " --no-default-excludes Zap default exclude symbols\n" +msgstr " --no-default-excludes Inga automatiskt undantagna symboler\n" + +# +#: dllwrap.c:546 +msgid " --base-file Read linker generated base file\n" +msgstr " --base-file Läs länkargenererad basfil\n" + +# +#: dllwrap.c:547 +msgid " --no-idata4 Don't generate idata$4 section\n" +msgstr " --no-idata4 Generera ingen idata$4-sektion\n" + +# +#: dllwrap.c:548 +msgid " --no-idata5 Don't generate idata$5 section\n" +msgstr " --no-idata5 Generera ingen idata$5-sektion\n" + +# +#: dllwrap.c:549 +msgid " -U Add underscores to .lib\n" +msgstr " -U Lägg till understreck i .lib\n" + +# +#: dllwrap.c:550 +msgid " -k Kill @ from exported names\n" +msgstr " -k Utplåna @ från exporterade namn\n" + +# +#: dllwrap.c:551 +msgid " --add-stdcall-alias Add aliases without @\n" +msgstr " --add-stdcall-alias Lägg till alias utan @\n" + +# +#: dllwrap.c:552 +msgid " --as Use for assembler\n" +msgstr " --as Använd som assemblerare\n" + +# +#: dllwrap.c:553 +msgid " --nodelete Keep temp files.\n" +msgstr " --nodelete Behåll temporära filer.\n" + +# +#: dllwrap.c:554 +msgid " Rest are passed unmodified to the language driver\n" +msgstr " Övriga flaggor skickas oförändrade till programspråksenheten\n" + +# +#: dllwrap.c:824 +msgid "Must provide at least one of -o or --dllname options" +msgstr "Ange minst en av flaggorna -o eller --dllname" + +# +#: dllwrap.c:852 +msgid "" +"no export definition file provided.\n" +"Creating one, but that may not be what you want" +msgstr "" +"ingen export-definitionsfil angavs.\n" +"En sådan skapas, men det är kanske inte vad du vill" + +# +# Indenteringen är ökad för att översättningen ska få plats framför +# kolonet på alla 4 strängar. +#: dllwrap.c:1014 +#, c-format +msgid "DLLTOOL name : %s\n" +msgstr "DLLVERKTYG namn : %s\n" + +# +# Indenteringen är ökad för att översättningen ska få plats framför +# kolonet på alla 4 strängar. +#: dllwrap.c:1015 +#, c-format +msgid "DLLTOOL options : %s\n" +msgstr "DLLVERKTYG flaggor: %s\n" + +# +# Indenteringen är ökad för att översättningen ska få plats framför +# kolonet på alla 4 strängar. +#: dllwrap.c:1016 +#, c-format +msgid "DRIVER name : %s\n" +msgstr "DRIVRUTIN namn : %s\n" + +# +# Indenteringen är ökad för att översättningen ska få plats framför +# kolonet på alla 4 strängar. +#: dllwrap.c:1017 +#, c-format +msgid "DRIVER options : %s\n" +msgstr "DRIVRUTIN flaggor : %s\n" + +# +#: ieee.c:317 +msgid "unexpected end of debugging information" +msgstr "oväntat slut på felsökningsinformationen" + +# +#: ieee.c:412 +msgid "invalid number" +msgstr "ogiltigt tal" + +# +#: ieee.c:471 +msgid "invalid string length" +msgstr "ogiltig stränglängd" + +# +#: ieee.c:528 ieee.c:569 +msgid "expression stack overflow" +msgstr "överspill i uttrycksstacken" + +# +#: ieee.c:548 +msgid "unsupported IEEE expression operator" +msgstr "IEEE-uttrycksoperator som inte stöds" + +# +#: ieee.c:563 +msgid "unknown section" +msgstr "okänd sektion" + +# +#: ieee.c:584 +msgid "expression stack underflow" +msgstr "underspill i uttrycksstacken" + +# +#: ieee.c:598 +msgid "expression stack mismatch" +msgstr "felbalanserad uttrycksstack" + +# +#: ieee.c:637 +msgid "unknown builtin type" +msgstr "okänd inbyggd typ" + +# +#: ieee.c:782 +msgid "BCD float type not supported" +msgstr "flyttalstyp BCD stöds inte" + +# +#: ieee.c:928 +msgid "unexpected number" +msgstr "oväntat tal" + +# +#: ieee.c:935 +msgid "unexpected record type" +msgstr "oväntad posttyp" + +# +#: ieee.c:968 +msgid "blocks left on stack at end" +msgstr "block kvar på stacken på slutet" + +# +#: ieee.c:1233 +msgid "unknown BB type" +msgstr "okänd BB-typ" + +# +#: ieee.c:1242 +msgid "stack overflow" +msgstr "överspill i stacken" + +# +#: ieee.c:1267 +msgid "stack underflow" +msgstr "underspill i stacken" + +# +#: ieee.c:1381 ieee.c:1453 ieee.c:2152 +msgid "illegal variable index" +msgstr "otillåtet variabelindex" + +# +#: ieee.c:1431 +msgid "illegal type index" +msgstr "otillåtet typindex" + +# +#: ieee.c:1441 ieee.c:1478 +msgid "unknown TY code" +msgstr "okänd TY-kod" + +# +#: ieee.c:1460 +msgid "undefined variable in TY" +msgstr "odefinierad variabel i TY" + +# +#. Pascal file name. FIXME. +#: ieee.c:1871 +msgid "Pascal file name not supported" +msgstr "Pascal-filnamn stöds inte" + +# +# BUGG: qualif>i in-file [out-file]\n" +msgstr "Användning: %s indatafil [utdatafil]\n" + +# +#: objcopy.c:364 objcopy.c:433 +msgid " The options are:\n" +msgstr " Flaggorna är:\n" + +# +#: objcopy.c:365 +msgid "" +" -I --input-target Assume input file is in format \n" +" -O --output-target Create an output file in format \n" +" -B --binary-architecture Set arch of output file, when input is binary\n" +" -F --target Set both input and output format to \n" +" --debugging Convert debugging information, if possible\n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -j --only-section Only copy section into the output\n" +" -R --remove-section Remove section from the output\n" +" -S --strip-all Remove all symbol and relocation information\n" +" -g --strip-debug Remove all debugging symbols\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol Do not copy symbol \n" +" -K --keep-symbol Only copy symbol \n" +" -L --localize-symbol Force symbol to be marked as a local\n" +" -G --keep-global-symbol Localize all symbols except \n" +" -W --weaken-symbol Force symbol to be marked as a weak\n" +" --weaken Force all global symbols to be marked as weak\n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -i --interleave Only copy one out of every bytes\n" +" -b --byte Select byte in every interleaved block\n" +" --gap-fill Fill gaps between sections with \n" +" --pad-to Pad the last section up to address \n" +" --set-start Set the start address to \n" +" {--change-start|--adjust-start} \n" +" Add to the start address\n" +" {--change-addresses|--adjust-vma} \n" +" Add to LMA, VMA and start addresses\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" Change LMA and VMA of section by \n" +" --change-section-lma {=|+|-}\n" +" Change the LMA of section by \n" +" --change-section-vma {=|+|-}\n" +" Change the VMA of section by \n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" Warn if a named section does not exist\n" +" --set-section-flags =\n" +" Set section 's properties to \n" +" --add-section = Add section found in to output\n" +" --rename-section =[,] Rename section to \n" +" --change-leading-char Force output format's leading character style\n" +" --remove-leading-char Remove leading character from global symbols\n" +" --redefine-sym = Redefine symbol name to \n" +" --srec-len Restrict the length of generated Srecords\n" +" --srec-forceS3 Restrict the type of generated Srecords to S3\n" +" --strip-symbols -N for all symbols listed in \n" +" --keep-symbols -K for all symbols listed in \n" +" --localize-symbols -L for all symbols listed in \n" +" --keep-global-symbols -G for all symbols listed in \n" +" --weaken-symbols -W for all symbols listed in \n" +" --alt-machine-code Use alternate machine code for output\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +msgstr "" +" -I --input-target Antag indatafilens format är \n" +" -O --output-target Skapa utdatafilen i formatet \n" +" -B --binary-architecture Välj arkitektur för utfil när indata är binär\n" +" -F --target Sätt både in- och utformatet till \n" +" --debugging Konvertera felsökningsinfo, om möjligt\n" +" -p --preserve-dates Kopiera ändrings/åtkomsttider till utdatan\n" +" -j --only-section Kopiera endast sektion till utdatan\n" +" -R --remove-section Ta bort sektion från utdatan\n" +" -S --strip-all Ta bort all symbol- och omlokaliseringsinfo\n" +" -g --strip-debug Ta bort alla felsökningssymboler\n" +" --strip-unneeded Ta bort symboler onödiga för omlokalisering\n" +" -N --strip-symbol Kopiera inte symbol \n" +" -K --keep-symbol Kopiera endast symbol \n" +" -L --localize-symbol Markera symbol som lokal\n" +" -G --keep-global-symbol Gör alla symboler lokala, förutom \n" +" -W --weaken-symbol Markera symbol som vek\n" +" --weaken Markera alla globala symboler som veka\n" +" -x --discard-all Ta bort alla icke-globala symboler\n" +" -X --discard-locals Ta bort alla kompilatorgenererade symboler\n" +" -i --interleave Kopiera endast en av varje byte\n" +" -b --byte Välj ut :e byten i varje intervall\n" +" --gap-fill Fyll luckor mellan sektionerna med \n" +" --pad-to Fyll ut efter sista sektionen fram till \n" +" --set-start Sätt startadressen till \n" +" {--change-start|--adjust-start} <ökn>\n" +" Lägg till <ökn> till startadressen\n" +" {--change-addresses|--adjust-vma} <ökn>\n" +" Lägg till <ökn> till LMA, VMA och startadr.\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" Ändra LMA och VMA på sektion med \n" +" --change-section-lma {=|+|-}\n" +" Ändra LMA på sektion med \n" +" --change-section-vma {=|+|-}\n" +" Ändra VMA på sektion med \n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" Varna (inte/[no-]) om en sektion inte finns\n" +" --set-section-flags =\n" +" Sätt sektion s attribut till \n" +" --add-section = Lägg till sektion i till utdatan\n" +" --rename-section =[,] Byt namn på sektion till \n" +" --change-leading-char Ändra till utformatets typ av inledningstecken\n" +" --remove-leading-char Ta bort inledningstecken från globala symboler\n" +" --redefine-sym = Definiera om symbolen med namn till \n" +" --srec-len Begränsa längden på genererade S-poster\n" +" --srec-forceS3 Begränsa typen av genererade S-poster till S3\n" +" --strip-symbols -N för alla symboler som listas i \n" +" --keep-symbols -K för alla symboler som listas i \n" +" --localize-symbols -L för alla symboler som listas i \n" +" --keep-global-symbols -G för alla symboler som listas i \n" +" --weaken-symbols -W för alla symboler som listas i \n" +" --alt-machine-code Använd alternativ maskinkod för utdata\n" +" -v --verbose Lista alla förändrade objektfiler\n" +" -V --version Visa programmets versionsinformation\n" +" -h --help Visa denna hjälp\n" + +# +#: objcopy.c:432 +#, c-format +msgid "Usage: %s in-file(s)\n" +msgstr "Användning: %s indatafil(er)\n" + +# +#: objcopy.c:434 +msgid "" +" -I --input-target Assume input file is in format \n" +" -O --output-target Create an output file in format \n" +" -F --target Set both input and output format to \n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -R --remove-section Remove section from the output\n" +" -s --strip-all Remove all symbol and relocation information\n" +" -g -S --strip-debug Remove all debugging symbols\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol Do not copy symbol \n" +" -K --keep-symbol Only copy symbol \n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +" -o Place stripped output into \n" +msgstr "" +" -I --input-target Antag indatafilens format är \n" +" -O --output-target Skapa utdatafilen i formatet \n" +" -F --target Sätt både in- och utformatet till \n" +" -p --preserve-dates Kopiera ändrings/åtkomsttider till utdatan\n" +" -R --remove-section Ta bort sektion från utdatan\n" +" -s --strip-all Ta bort all symbol- och omlokaliseringsinfo\n" +" -g -S --strip-debug Ta bort alla felsökningssymboler\n" +" --strip-unneeded Ta bort symboler onödiga för omlokaliseringen\n" +" -N --strip-symbol Kopiera inte symbol \n" +" -K --keep-symbol Kopiera endast symbol \n" +" -x --discard-all Ta bort alla icke-globala symboler\n" +" -X --discard-locals Ta bort alla kompilatorgenererade symboler\n" +" -v --verbose Lista alla förändrade objektfiler\n" +" -V --version Visa programmets versionsinformation\n" +" -h --help Visa denna hjälp\n" +" -o Spara den utrensade utdatan i \n" + +# +#: objcopy.c:504 +#, c-format +msgid "unrecognized section flag `%s'" +msgstr "okänd sektionsflagga \"%s\"" + +# +#: objcopy.c:505 +#, c-format +msgid "supported flags: %s" +msgstr "flaggor som hanteras: %s" + +# +#: objcopy.c:582 objcopy.c:2206 +#, c-format +msgid "cannot stat: %s: %s" +msgstr "kan inte ta status: %s: %s" + +# +#: objcopy.c:589 objcopy.c:2224 +#, c-format +msgid "cannot open: %s: %s" +msgstr "kan inte öppna: %s: %s" + +# +#: objcopy.c:592 objcopy.c:2228 +#, c-format +msgid "%s: fread failed" +msgstr "%s: fread misslyckades" + +# +#: objcopy.c:665 +#, c-format +msgid "Ignoring rubbish found on line %d of %s" +msgstr "Ignorerar skräp hittat på rad %d i %s" + +# +#: objcopy.c:886 +#, c-format +msgid "%s: Multiple redefinition of symbol \"%s\"" +msgstr "%s: Flera omdefinieringar av symbol \"%s\"" + +# +#: objcopy.c:891 +#, c-format +msgid "%s: Symbol \"%s\" is target of more than one redefinition" +msgstr "%s: Symbol \"%s\" är mål för mer än en omdefiniering" + +# +#: objcopy.c:943 +msgid "Unable to change endianness of input file(s)" +msgstr "Kan inte ändra endian-typ på indatafilen(erna)" + +# +#: objcopy.c:951 +#, c-format +msgid "copy from %s(%s) to %s(%s)\n" +msgstr "kopierar från %s(%s) till %s(%s)\n" + +# +#: objcopy.c:975 +#, c-format +msgid "Warning: Output file cannot represent architecture %s" +msgstr "Varning: Utdatafilen kan inte representera arkitektur %s" + +# +#: objcopy.c:1002 +#, c-format +msgid "can't create section `%s': %s" +msgstr "kan inte skapa sektion \"%s\": %s" + +# +#: objcopy.c:1088 +#, c-format +msgid "Can't fill gap after %s: %s" +msgstr "Kan inte fylla luckan efter %s: %s" + +# +#: objcopy.c:1113 +#, c-format +msgid "Can't add padding to %s: %s" +msgstr "Kan inte fylla ut efter %s: %s" + +# +#: objcopy.c:1252 +#, c-format +msgid "%s: error copying private BFD data: %s" +msgstr "%s: fel vid kopiering av privat BFD-data: %s" + +# +#: objcopy.c:1265 +msgid "unknown alternate machine code, ignored" +msgstr "okänd alternativ maskinkod, ignorerad" + +# +#: objcopy.c:1295 +#, c-format +msgid "cannot mkdir %s for archive copying (error: %s)" +msgstr "kan inte skapa katalog %s för arkivkopiering (fel: %s)" + +# +#: objcopy.c:1466 +#, c-format +msgid "Multiple renames of section %s" +msgstr "Flera namnbyten på sektion %s" + +# +#: objcopy.c:1550 +msgid "making" +msgstr "tillverkning" + +# +#: objcopy.c:1559 +msgid "size" +msgstr "storlek" + +# +#: objcopy.c:1573 +msgid "vma" +msgstr "vma" + +# +#: objcopy.c:1599 +msgid "alignment" +msgstr "jämn gräns" + +# +#: objcopy.c:1607 +msgid "flags" +msgstr "flaggor" + +# +#: objcopy.c:1624 +msgid "private data" +msgstr "privat data" + +# +#: objcopy.c:1632 +#, c-format +msgid "%s: section `%s': error in %s: %s" +msgstr "%s: sektion \"%s\": fel på %s: %s" + +# +#: objcopy.c:1910 +#, c-format +msgid "%s: can't create debugging section: %s" +msgstr "%s: kan inte skapa felsökningssektion: %s" + +# +#: objcopy.c:1925 +#, c-format +msgid "%s: can't set debugging section contents: %s" +msgstr "%s: kan inte sätta innehållet i felsökningssektionen: %s" + +# +#: objcopy.c:1934 +#, c-format +msgid "%s: don't know how to write debugging information for %s" +msgstr "%s: vet inte hur man skriver felsökningsinformation för %s" + +# +#: objcopy.c:2041 +#, c-format +msgid "%s: cannot stat: %s" +msgstr "%s: kan inte ta status: %s" + +# +#: objcopy.c:2092 +msgid "byte number must be non-negative" +msgstr "bytenummer får inte vara negativt" + +# +#: objcopy.c:2102 +msgid "interleave must be positive" +msgstr "intervallstorleken måste vara positiv" + +# +#: objcopy.c:2122 objcopy.c:2130 +#, c-format +msgid "%s both copied and removed" +msgstr "%s både kopierad och borttagen" + +# +#: objcopy.c:2203 objcopy.c:2273 objcopy.c:2373 objcopy.c:2400 objcopy.c:2424 +#: objcopy.c:2428 objcopy.c:2448 +#, c-format +msgid "bad format for %s" +msgstr "felaktigt format på %s" + +# +#: objcopy.c:2342 +#, c-format +msgid "Warning: truncating gap-fill from 0x%s to 0x%x" +msgstr "Varning: kortar av utfyllnadsvärdet från 0x%s till 0x%x" + +# +#: objcopy.c:2494 +msgid "alternate machine code index must be positive" +msgstr "index för alternativ maskinkod måste vara positivt" + +# +#: objcopy.c:2512 +msgid "byte number must be less than interleave" +msgstr "bytenummer måste vara mindre än antalet byte i intervallet" + +# +#: objcopy.c:2539 +#, c-format +msgid "architecture %s unknown" +msgstr "arkitektur %s är okänd" + +# +#: objcopy.c:2543 +msgid "Warning: input target 'binary' required for binary architecture parameter." +msgstr "Varning: indata måste ha formatet \"binary\" för binärarkitektursparametern." + +# +#: objcopy.c:2544 +#, c-format +msgid " Argument %s ignored" +msgstr " Argument %s ignoreras" + +# +#: objcopy.c:2550 +#, c-format +msgid "Cannot stat: %s: %s" +msgstr "Kan inte ta status: %s: %s" + +# +#: objcopy.c:2590 objcopy.c:2604 +#, c-format +msgid "%s %s%c0x%s never used" +msgstr "%s %s%c0x%s användes aldrig" + +# +#: objdump.c:164 +#, c-format +msgid "Usage: %s OPTION... FILE...\n" +msgstr "Användning: %s FLAGGA... FIL...\n" + +# +#: objdump.c:165 +msgid "Display information from object FILE.\n" +msgstr "Visa information från en objektFIL.\n" + +# +#: objdump.c:166 +msgid "" +"\n" +" At least one of the following switches must be given:\n" +msgstr "" +"\n" +" Minst en av följande flaggor måste anges:\n" + +# +#: objdump.c:167 +msgid "" +" -a, --archive-headers Display archive header information\n" +" -f, --file-headers Display the contents of the overall file header\n" +" -p, --private-headers Display object format specific file header contents\n" +" -h, --[section-]headers Display the contents of the section headers\n" +" -x, --all-headers Display the contents of all headers\n" +" -d, --disassemble Display assembler contents of executable sections\n" +" -D, --disassemble-all Display assembler contents of all sections\n" +" -S, --source Intermix source code with disassembly\n" +" -s, --full-contents Display the full contents of all sections requested\n" +" -g, --debugging Display debug information in object file\n" +" -G, --stabs Display (in raw form) any STABS info in the file\n" +" -t, --syms Display the contents of the symbol table(s)\n" +" -T, --dynamic-syms Display the contents of the dynamic symbol table\n" +" -r, --reloc Display the relocation entries in the file\n" +" -R, --dynamic-reloc Display the dynamic relocation entries in the file\n" +" -V, --version Display this program's version number\n" +" -i, --info List object formats and architectures supported\n" +" -H, --help Display this information\n" +msgstr "" +" -a, --archive-headers Visa information från arkivhuvuden\n" +" -f, --file-headers Visa innehållet i det övergripande filhuvudet\n" +" -p, --private-headers Visa innehållet i objektformatspecifika filhuvuden\n" +" -h, --[section-]headers Visa innehållet i sektionshuvuden\n" +" -x, --all-headers Visa innehållet i alla huvuden\n" +" -d, --disassemble Visa disassemblering av exekverbara sektioner\n" +" -D, --disassemble-all Visa disassemblering av alla sektioner\n" +" -S, --source Varva källkod med disassemblering\n" +" -s, --full-contents Visa hela innehållet i alla utvalda sektioner\n" +" -g, --debugging Visa felsökningsinformation från objektfilen\n" +" -G, --stabs Visa (obehandlat) eventuell STABS-info från filen\n" +" -t, --syms Visa innehållet i symboltabellen(erna)\n" +" -T, --dynamic-syms Visa innehållet i tabellen med dynamiska symboler\n" +" -r, --reloc Visa omlokaliseringsposterna i filen\n" +" -R, --dynamic-reloc Visa de dynamiska omlokaliseringsposterna i filen\n" +" -V, --version Visa programmets versionsinformation\n" +" -i, --info Lista de objektformat och arkitekturer som hanteras\n" +" -H, --help Visa denna hjälp\n" + +# +#: objdump.c:189 +msgid "" +"\n" +" The following switches are optional:\n" +msgstr "" +"\n" +" Följande flaggor är frivilliga:\n" + +# +#: objdump.c:190 +msgid "" +" -b, --target=BFDNAME Specify the target object format as BFDNAME\n" +" -m, --architecture=MACHINE Specify the target architecture as MACHINE\n" +" -j, --section=NAME Only display information for section NAME\n" +" -M, --disassembler-options=OPT Pass text OPT on to the disassembler\n" +" -EB --endian=big Assume big endian format when disassembling\n" +" -EL --endian=little Assume little endian format when disassembling\n" +" --file-start-context Include context from start of file (with -S)\n" +" -l, --line-numbers Include line numbers and filenames in output\n" +" -C, --demangle[=STYLE] Decode mangled/processed symbol names\n" +" The STYLE, if specified, can be `auto', 'gnu',\n" +" 'lucid', 'arm', 'hp', 'edg', or 'gnu-new-abi'\n" +" -w, --wide Format output for more than 80 columns\n" +" -z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling\n" +" --start-address=ADDR Only process data whoes address is >= ADDR\n" +" --stop-address=ADDR Only process data whoes address is <= ADDR\n" +" --prefix-addresses Print complete address alongside disassembly\n" +" --[no-]show-raw-insn Display hex alongside symbolic disassembly\n" +" --adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n" +"\n" +msgstr "" +" -b, --target=BFDNAMN Ange att målobjektets format är BFDNAMN\n" +" -m, --architecture=MASKIN Ange att målarkitekturen är MASKIN\n" +" -j, --section=NAMN Visa endast information om sektion NAMN\n" +" -M, --disassembler-options=FLG Skicka vidare FLG till disassembleraren\n" +" -EB --endian=big Antag big endian-format vid disassemblering\n" +" -EL --endian=little Antag little endian-format vid disassemblering\n" +" --file-start-context Ta med omgivningen i början av filen (med -S)\n" +" -l, --line-numbers Ta med radnummer och filnamn i utdatan\n" +" -C, --demangle[=STIL] Avkoda kodade symbolnamn\n" +" STIL, om angivet, kan vara: \"auto\", \"gnu\",\n" +" \"lucid\", \"arm\", \"hp\", \"edg\", \"gnu-new-abi\"\n" +" -w, --wide Anpassa utdatan för mer än 80 kolumner\n" +" -z, --disassemble-zeroes Hoppa inte över block av nollor vid\n" +" disassemblering\n" +" --start-address=ADR Behandla endast data på adresser >= ADR\n" +" --stop-address=ADR Behandla endast data på adresser <= ADR\n" +" --prefix-addresses Visa fullständiga adresser jämte disassembler.\n" +" --[no-]show-raw-insn Visa hex.-kod jämte disassemblering\n" +" --adjust-vma=OFFSET Lägg till OFFSET till alla visade sektionsadresser\n" +"\n" + +# +#: objdump.c:359 +msgid "Sections:\n" +msgstr "Sektioner:\n" + +# +#: objdump.c:362 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "Idx Namn Storlek VMA LMA Filoffs Just" + +# +#: objdump.c:364 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "Idx Namn Storlek VMA LMA Filoffs Just" + +# +#: objdump.c:368 +msgid " Flags" +msgstr " Flaggor" + +# +#: objdump.c:418 +#, c-format +msgid "%s: not a dynamic object" +msgstr "%s: inte ett dynamiskt objekt" + +# +#: objdump.c:434 +#, c-format +msgid "%s: No dynamic symbols" +msgstr "%s: Inga dynamiska symboler" + +# +#: objdump.c:1124 +msgid "Out of virtual memory" +msgstr "Slut på virtuellt minne" + +# +#: objdump.c:1553 +#, c-format +msgid "Can't use supplied machine %s" +msgstr "Kan inte använda den tillhandahållna maskinen %s" + +# +#: objdump.c:1571 +#, c-format +msgid "Can't disassemble for architecture %s\n" +msgstr "Kan inte disassemblera för arkitektur %s\n" + +# +#: objdump.c:1653 +#, c-format +msgid "Disassembly of section %s:\n" +msgstr "Disassemblering av sektion %s:\n" + +# +#: objdump.c:1828 +#, c-format +msgid "" +"No %s section present\n" +"\n" +msgstr "" +"Det finns ingen %s-sektion\n" +"\n" + +# +#: objdump.c:1835 +#, c-format +msgid "%s has no %s section" +msgstr "%s har ingen %s-sektion" + +# +#: objdump.c:1849 +#, c-format +msgid "Reading %s section of %s failed: %s" +msgstr "Läsa %s-sektionen i %s misslyckades: %s" + +# +#: objdump.c:1861 +#, c-format +msgid "Reading %s section of %s failed: %s\n" +msgstr "Läsa %s-sektionen i %s misslyckades: %s\n" + +# +#: objdump.c:1904 +#, c-format +msgid "" +"Contents of %s section:\n" +"\n" +msgstr "" +"Innehåll i %s-sektionen:\n" +"\n" + +# +#: objdump.c:2004 +#, c-format +msgid "architecture: %s, " +msgstr "arkitektur: %s, " + +# +#: objdump.c:2007 +#, c-format +msgid "flags 0x%08x:\n" +msgstr "flaggor 0x%08x:\n" + +# +#: objdump.c:2020 +msgid "" +"\n" +"start address 0x" +msgstr "" +"\n" +"startadress 0x" + +# +#: objdump.c:2052 +#, c-format +msgid "" +"\n" +"%s: file format %s\n" +msgstr "" +"\n" +"%s: filformat %s\n" + +# +#: objdump.c:2094 +#, c-format +msgid "%s: printing debugging information failed" +msgstr "%s: visa felsökningsinformationen misslyckades" + +# +#: objdump.c:2171 +#, c-format +msgid "In archive %s:\n" +msgstr "I arkiv %s:\n" + +# +#: objdump.c:2223 +#, c-format +msgid "Contents of section %s:\n" +msgstr "Innehåll i %s-sektionen:\n" + +# +#: objdump.c:2736 +#, c-format +msgid "BFD header file version %s\n" +msgstr "BFD-huvudfil version %s\n" + +# +#: objdump.c:2825 +msgid "unrecognized -E option" +msgstr "okänd -E-flagga" + +# +#: objdump.c:2836 +#, c-format +msgid "unrecognized --endian type `%s'" +msgstr "okänd --endian-typ \"%s\"" + +# +#: rdcoff.c:205 +#, c-format +msgid "parse_coff_type: Bad type code 0x%x" +msgstr "parse_coff_type: Felaktig typkod 0x%x" + +# +#: rdcoff.c:423 rdcoff.c:531 rdcoff.c:730 +#, c-format +msgid "bfd_coff_get_syment failed: %s" +msgstr "bfd_coff_get_syment misslyckades: %s" + +# +#: rdcoff.c:439 rdcoff.c:750 +#, c-format +msgid "bfd_coff_get_auxent failed: %s" +msgstr "bfd_coff_get_auxent misslyckades: %s" + +# +#: rdcoff.c:817 +#, c-format +msgid "%ld: .bf without preceding function" +msgstr "%ld: .bf saknar inledande funktion" + +# +#: rdcoff.c:867 +#, c-format +msgid "%ld: unexpected .ef\n" +msgstr "%ld: oväntad .ef\n" + +# +#: rddbg.c:87 +#, c-format +msgid "%s: no recognized debugging information" +msgstr "%s: ingen känd felsökningsinformation" + +# +#: rddbg.c:410 +msgid "Last stabs entries before error:\n" +msgstr "De sista stabs-posterna innan felet:\n" + +# +#: readelf.c:318 +#, c-format +msgid "%s: Error: " +msgstr "%s: Fel: " + +# +#: readelf.c:329 +#, c-format +msgid "%s: Warning: " +msgstr "%s: Varning: " + +# +#: readelf.c:351 +#, c-format +msgid "Unable to seek to %x for %s\n" +msgstr "Kan inte uppsöka %2$s på %1$x\n" + +# +#: readelf.c:362 +#, c-format +msgid "Out of memory allocating %d bytes for %s\n" +msgstr "Slut på minne vid allokering av %d byte för %s\n" + +# +#: readelf.c:370 +#, c-format +msgid "Unable to read in %d bytes of %s\n" +msgstr "Kan inte läsa in %d byte från %s\n" + +# +#: readelf.c:423 readelf.c:581 +#, c-format +msgid "Unhandled data length: %d\n" +msgstr "Storlek på data som inte kan behandlas: %d\n" + +# +#: readelf.c:660 +msgid "Don't know about relocations on this machine architecture\n" +msgstr "Vet inte hur man omlokaliserar på den här maskinarkitekturen\n" + +# +#: readelf.c:682 readelf.c:711 readelf.c:757 readelf.c:784 +msgid "relocs" +msgstr "omlokaliseringar" + +# +#: readelf.c:693 readelf.c:722 readelf.c:767 readelf.c:794 +msgid "out of memory parsing relocs" +msgstr "slut på minne vid tolkning av omlokaliseringar" + +# +#: readelf.c:845 +msgid " Offset Info Type Symbol's Value Symbol's Name Addend\n" +msgstr " Offset Info Typ Symbolvärde Symbolnamn Tillägg\n" + +# +#: readelf.c:848 +msgid " Offset Info Type Symbol's Value Symbol's Name\n" +msgstr " Offset Info Typ Symbolvärde Symbolnamn\n" + +# +#: readelf.c:854 +msgid " Offset Info Type Symbol's Value Symbol's Name Addend\n" +msgstr " Offset Info Typ Symbolvärde Symbolnamn Tillägg\n" + +# +#: readelf.c:857 +msgid " Offset Info Type Symbol's Value Symbol's Name\n" +msgstr " Offset Info Typ Symbolvärde Symbolnamn\n" + +# +#: readelf.c:1061 readelf.c:1063 +#, c-format +msgid "unrecognised: %-7lx" +msgstr "okänd: %-7lx" + +# +#: readelf.c:1085 +#, c-format +msgid "" +msgstr "" + +# +#: readelf.c:1315 +#, c-format +msgid "Processor Specific: %lx" +msgstr "processorspecifik: %lx" + +# +#: readelf.c:1334 +#, c-format +msgid "Operating System specific: %lx" +msgstr "operativsystemsspecifik: %lx" + +# +#: readelf.c:1337 readelf.c:1961 +#, c-format +msgid ": %lx" +msgstr ": %lx" + +# +#: readelf.c:1351 +msgid "NONE (None)" +msgstr "NONE (ingen)" + +# +#: readelf.c:1352 +msgid "REL (Relocatable file)" +msgstr "REL (omlokaliseringsbar fil)" + +# +#: readelf.c:1353 +msgid "EXEC (Executable file)" +msgstr "EXEC (exekverbar fil)" + +# +#: readelf.c:1354 +msgid "DYN (Shared object file)" +msgstr "DYN (delad objektfil)" + +# +#: readelf.c:1355 +msgid "CORE (Core file)" +msgstr "CORE (minnesfil)" + +# +#: readelf.c:1359 +#, c-format +msgid "Processor Specific: (%x)" +msgstr "processorspecifik: (%x)" + +# +#: readelf.c:1361 +#, c-format +msgid "OS Specific: (%x)" +msgstr "OS-specifik: (%x)" + +# +#: readelf.c:1363 readelf.c:1460 readelf.c:2112 +#, c-format +msgid ": %x" +msgstr ": %x" + +# +#: readelf.c:1376 +msgid "None" +msgstr "ingen" + +# +#: readelf.c:2152 +msgid "Usage: readelf {options} elf-file(s)\n" +msgstr "Användning: readelf {flaggor} elf-fil(er)\n" + +# +#: readelf.c:2153 +msgid " Options are:\n" +msgstr " Flaggorna är:\n" + +# +#: readelf.c:2154 +msgid " -a or --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" +msgstr " -a eller --all Samma som: -h -l -S -s -r -d -V -A -I\n" + +# +#: readelf.c:2155 +msgid " -h or --file-header Display the ELF file header\n" +msgstr " -h eller --file-header Visa ELF-filens huvud\n" + +# +#: readelf.c:2156 +msgid " -l or --program-headers or --segments\n" +msgstr " -l eller --program-headers eller --segments\n" + +# +#: readelf.c:2157 +msgid " Display the program headers\n" +msgstr " Visa programhuvudena\n" + +# +#: readelf.c:2158 +msgid " -S or --section-headers or --sections\n" +msgstr " -S eller --section-headers eller --sections\n" + +# +#: readelf.c:2159 +msgid " Display the sections' header\n" +msgstr " Visa sektionernas huvud\n" + +# +#: readelf.c:2160 +msgid " -e or --headers Equivalent to: -h -l -S\n" +msgstr " -e eller --headers Samma som: -h -l -S\n" + +# +#: readelf.c:2161 +msgid " -s or --syms or --symbols Display the symbol table\n" +msgstr "" +" -s eller --syms eller --symbols\n" +" Visa symboltabellen\n" + +# +#: readelf.c:2162 +msgid " -n or --notes Display the core notes (if present)\n" +msgstr " -n eller --notes Visa kommentarer från minnesutskriften (om de finns)\n" + +# +#: readelf.c:2163 +msgid " -r or --relocs Display the relocations (if present)\n" +msgstr " -r eller --relocs Visa omlokaliseringsinformationen (om den finns)\n" + +# +#: readelf.c:2164 +msgid " -u or --unwind Display the unwind info (if present)\n" +msgstr " -u eller --unwind Visa tillbakarullningsinformation (om den finns)\n" + +# +#: readelf.c:2165 +msgid " -d or --dynamic Display the dynamic segment (if present)\n" +msgstr " -d eller --dynamic Visa det dynamiska segmentet (om det finns)\n" + +# +#: readelf.c:2166 +msgid " -V or --version-info Display the version sections (if present)\n" +msgstr " -V eller --version-info Visa versionssektionen (om den finns)\n" + +# +#: readelf.c:2167 +msgid " -A or --arch-specific Display architecture specific information (if any).\n" +msgstr " -A eller --arch-specific Visa arkitekturspecifik information (om den finns)\n" + +# +#: readelf.c:2168 +msgid " -D or --use-dynamic Use the dynamic section info when displaying symbols\n" +msgstr " -D eller --use-dynamic Använd den dynamiska sektionen för att visa symboler\n" + +# +#: readelf.c:2169 +msgid " -x or --hex-dump=\n" +msgstr " -x eller --hex-dump=\n" + +# +#: readelf.c:2170 +msgid " Dump the contents of section \n" +msgstr " Visa innehållet i sektion \n" + +# +#: readelf.c:2171 +msgid " -w[liaprmfs] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str]\n" +msgstr " -w[liaprmfs] eller --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str]\n" + +# +#: readelf.c:2172 +msgid " Display the contents of DWARF2 debug sections\n" +msgstr " Visa innehållet i DWARF2-felsökningssektioner\n" + +# +#: readelf.c:2174 +msgid " -i or --instruction-dump=\n" +msgstr " -i eller --instruction-dump=\n" + +# +#: readelf.c:2175 +msgid " Disassemble the contents of section \n" +msgstr " Disassemblera innehållet i sektion \n" + +# +#: readelf.c:2177 +msgid " -I or --histogram Display histogram of bucket list lengths\n" +msgstr " -I eller --histogram Visa ett histogram över hinkarnas listlängder\n" + +# +#: readelf.c:2178 +msgid " -v or --version Display the version number of readelf\n" +msgstr " -v eller --version Visa versionsinformation om readelf\n" + +# +#: readelf.c:2179 +msgid " -W or --wide Don't split lines or truncate symbols to fit into 80 columns\n" +msgstr " -W eller --wide Bryt inga rader och kapa inga symboler för att passa 80 kolumner\n" + +# +#: readelf.c:2180 +msgid " -H or --help Display this information\n" +msgstr " -H eller --help Visa denna hjälp\n" + +# +#: readelf.c:2198 +msgid "Out of memory allocating dump request table." +msgstr "Slut på minne vid allokering av tabell för önskade utskrifter." + +# +#: readelf.c:2357 +#, c-format +msgid "Unrecognised debug option '%s'\n" +msgstr "Okänt felsökningsargument \"%s\"\n" + +# +#: readelf.c:2385 +#, c-format +msgid "Invalid option '-%c'\n" +msgstr "Ogiltig flagga \"-%c\"\n" + +# +#: readelf.c:2398 +msgid "Nothing to do.\n" +msgstr "Inget att göra.\n" + +# +#: readelf.c:2411 readelf.c:2428 readelf.c:4700 +msgid "none" +msgstr "ingen" + +# +#: readelf.c:2415 readelf.c:2432 readelf.c:2460 +#, c-format +msgid "" +msgstr "" + +# +#: readelf.c:2429 +msgid "2's complement, little endian" +msgstr "tvåkomplement, little endian" + +# +#: readelf.c:2430 +msgid "2's complement, big endian" +msgstr "tvåkomplement, big endian" + +# +#: readelf.c:2457 +msgid "Standalone App" +msgstr "Självständigt program" + +# +#: readelf.c:2475 +msgid "Not an ELF file - it has the wrong magic bytes at the start\n" +msgstr "Inte en ELF-fil - den har fel magiska byte i början\n" + +# +#: readelf.c:2483 +msgid "ELF Header:\n" +msgstr "ELF-huvud:\n" + +# +#: readelf.c:2484 +msgid " Magic: " +msgstr " Magi: " + +# +#: readelf.c:2488 +#, c-format +msgid " Class: %s\n" +msgstr " Klass: %s\n" + +# +#: readelf.c:2490 +#, c-format +msgid " Data: %s\n" +msgstr " Data: %s\n" + +# +#: readelf.c:2492 +#, c-format +msgid " Version: %d %s\n" +msgstr " Version: %d %s\n" + +# +#: readelf.c:2499 +#, c-format +msgid " OS/ABI: %s\n" +msgstr " OS/ABI: %s\n" + +# +#: readelf.c:2501 +#, c-format +msgid " ABI Version: %d\n" +msgstr " ABI-version: %d\n" + +# +#: readelf.c:2503 +#, c-format +msgid " Type: %s\n" +msgstr " Typ: %s\n" + +# +#: readelf.c:2505 +#, c-format +msgid " Machine: %s\n" +msgstr " Maskin: %s\n" + +# +#: readelf.c:2507 +#, c-format +msgid " Version: 0x%lx\n" +msgstr " Version: 0x%lx\n" + +# +#: readelf.c:2510 +msgid " Entry point address: " +msgstr " Ingångsadress: " + +# +#: readelf.c:2512 +msgid "" +"\n" +" Start of program headers: " +msgstr "" +"\n" +" Start för programhuvuden: " + +# +#: readelf.c:2514 +msgid "" +" (bytes into file)\n" +" Start of section headers: " +msgstr "" +" (byte in i filen)\n" +" Start för sektionshuvuden: " + +# +#: readelf.c:2516 +msgid " (bytes into file)\n" +msgstr " (byte in i filen)\n" + +# +#: readelf.c:2518 +#, c-format +msgid " Flags: 0x%lx%s\n" +msgstr " Flaggor: 0x%lx%s\n" + +# +#: readelf.c:2521 +#, c-format +msgid " Size of this header: %ld (bytes)\n" +msgstr " Detta huvuds storlek: %ld (byte)\n" + +# +#: readelf.c:2523 +#, c-format +msgid " Size of program headers: %ld (bytes)\n" +msgstr " Programhuvudenas storlek: %ld (byte)\n" + +# +#: readelf.c:2525 +#, c-format +msgid " Number of program headers: %ld\n" +msgstr " Antal programhuvuden: %ld\n" + +# +#: readelf.c:2527 +#, c-format +msgid " Size of section headers: %ld (bytes)\n" +msgstr " Sektionshuvudenas storlek: %ld (byte)\n" + +# +#: readelf.c:2529 +#, c-format +msgid " Number of section headers: %ld" +msgstr " Antal sektionshuvuden: %ld" + +# +#: readelf.c:2534 +#, c-format +msgid " Section header string table index: %ld" +msgstr " Sektionshuvudets strängtabellsndx: %ld" + +# +#: readelf.c:2568 readelf.c:2604 +msgid "program headers" +msgstr "programhuvuden" + +# +#: readelf.c:2638 +msgid "" +"\n" +"There are no program headers in this file.\n" +msgstr "" +"\n" +"Det finns inga programhuvuden i denna fil.\n" + +# +#: readelf.c:2644 +#, c-format +msgid "" +"\n" +"Elf file type is %s\n" +msgstr "" +"\n" +"Elf-filtyp är %s\n" + +# +#: readelf.c:2645 +msgid "Entry point " +msgstr "Ingångspunkt " + +# +#: readelf.c:2647 +#, c-format +msgid "" +"\n" +"There are %d program headers, starting at offset " +msgstr "" +"\n" +"Det finns %d programhuvuden, med början på offset " + +# +#: readelf.c:2658 readelf.c:2883 readelf.c:2929 readelf.c:2992 readelf.c:3059 +#: readelf.c:4087 readelf.c:4130 readelf.c:4310 readelf.c:5246 readelf.c:5260 +#: readelf.c:9246 readelf.c:9286 +msgid "Out of memory\n" +msgstr "Slut på minne\n" + +# +# BUGG: plural-s +#: readelf.c:2676 +#, c-format +msgid "" +"\n" +"Program Header%s:\n" +msgstr "" +"\n" +"Programhuvud%0.s:\n" + +# +#: readelf.c:2680 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr " Typ Offset VirtAdr FysAdr FilSt MinneSt Flg Just\n" + +# +#: readelf.c:2683 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr " Typ Offset VirtAdress FysAdress FilStrl MinneSt Flg Just\n" + +# +#: readelf.c:2687 +msgid " Type Offset VirtAddr PhysAddr\n" +msgstr " Typ Offset VirtAdress FysAdress\n" + +# +#: readelf.c:2689 +msgid " FileSiz MemSiz Flags Align\n" +msgstr " FilStorlek MinneStorlek Flagg Justering\n" + +# +#: readelf.c:2789 +msgid "more than one dynamic segment\n" +msgstr "mer än ett dynamiskt segment\n" + +# +#: readelf.c:2797 +msgid "Unable to find program interpreter name\n" +msgstr "Kan inte hitta namnet på programtolken\n" + +# +#: readelf.c:2804 +#, c-format +msgid "" +"\n" +" [Requesting program interpreter: %s]" +msgstr "" +"\n" +" [Begär programtolkare: %s]" + +# +#: readelf.c:2822 +msgid "" +"\n" +" Section to Segment mapping:\n" +msgstr "" +"\n" +" Sektion till segment-avbildning:\n" + +# +#: readelf.c:2823 +msgid " Segment Sections...\n" +msgstr " Segmentsektioner...\n" + +# +#: readelf.c:2874 readelf.c:2920 +msgid "section headers" +msgstr "sektionshuvuden" + +# +#: readelf.c:2968 readelf.c:3035 +msgid "symbols" +msgstr "symboler" + +# +#: readelf.c:2979 readelf.c:3046 +msgid "symtab shndx" +msgstr "symtab shndx" + +# +#: readelf.c:3147 +msgid "" +"\n" +"There are no sections in this file.\n" +msgstr "" +"\n" +"Det finns inga sektioner i denna fil.\n" + +# +#: readelf.c:3153 +#, c-format +msgid "There are %d section headers, starting at offset 0x%lx:\n" +msgstr "Det finns %d sektionshuvuden, med början på offset 0x%lx:\n" + +# +#: readelf.c:3170 readelf.c:3479 readelf.c:3826 readelf.c:5397 +msgid "string table" +msgstr "strängtabell" + +# +#: readelf.c:3191 +msgid "File contains multiple dynamic symbol tables\n" +msgstr "Filen innehåller flera tabeller med dynamiska symboler\n" + +# +#: readelf.c:3203 +msgid "File contains multiple dynamic string tables\n" +msgstr "Filen innehåller flera dynamiska strängtabeller\n" + +# +#: readelf.c:3209 +msgid "dynamic strings" +msgstr "dynamiska strängar" + +# +#: readelf.c:3215 +msgid "File contains multiple symtab shndx tables\n" +msgstr "Filen innehåller flera symtab-shndx-tabeller\n" + +# +# BUGG: plural-s +#: readelf.c:3250 +#, c-format +msgid "" +"\n" +"Section Header%s:\n" +msgstr "" +"\n" +"Sektionshuvud%0.s:\n" + +# +#: readelf.c:3254 +msgid " [Nr] Name Type Addr Off Size ES Flg Lk Inf Al\n" +msgstr " [Nr] Namn Typ Adress Off Strl PS Flg Lk Inf Ju\n" + +# +#: readelf.c:3257 +msgid " [Nr] Name Type Address Off Size ES Flg Lk Inf Al\n" +msgstr " [Nr] Namn Typ Adress Off Strl PS Flg Lk Inf Ju\n" + +# +#: readelf.c:3260 +msgid " [Nr] Name Type Address Offset\n" +msgstr " [Nr] Namn Typ Adress Offset\n" + +# +#: readelf.c:3261 +msgid " Size EntSize Flags Link Info Align\n" +msgstr " Storlek Poststorlek Flagg Länk Info Just\n" + +# +#: readelf.c:3356 +msgid "" +"Key to Flags:\n" +" W (write), A (alloc), X (execute), M (merge), S (strings)\n" +" I (info), L (link order), G (group), x (unknown)\n" +" O (extra OS processing required) o (OS specific), p (processor specific)\n" +msgstr "" +"Nyckel till flaggorna:\n" +" W (skriv), A (allokera), X (exekvera), M (förena), S (strängar)\n" +" I (info), L (länkordning), G (grupp), x (okänd)\n" +" O (extra OS-bearbetning krävs) o (OS-specifik), p (processorspecifik)\n" + +# +#: readelf.c:3417 +#, c-format +msgid "" +"\n" +"Relocation section at offset 0x%lx contains %ld bytes:\n" +msgstr "" +"\n" +"Omlokaliseringssektionen på offset 0x%lx innehåller %ld byte:\n" + +# +#: readelf.c:3424 +msgid "" +"\n" +"There are no dynamic relocations in this file.\n" +msgstr "" +"\n" +"Det finns inga dynamiska omlokaliseringar i denna fil.\n" + +# +#: readelf.c:3451 +msgid "" +"\n" +"Relocation section " +msgstr "" +"\n" +"Omlokaliseringssektion " + +# +#: readelf.c:3458 readelf.c:3905 +#, c-format +msgid " at offset 0x%lx contains %lu entries:\n" +msgstr " på offset 0x%lx innehåller %lu poster:\n" + +# +#: readelf.c:3496 +msgid "" +"\n" +"There are no relocations in this file.\n" +msgstr "" +"\n" +"Det finns inga omlokaliseringar i denna fil.\n" + +# +#: readelf.c:3692 +msgid "unwind table" +msgstr "tillbakarullningstabell" + +# +#: readelf.c:3743 readelf.c:3755 readelf.c:7608 readelf.c:7619 +#, c-format +msgid "Skipping unexpected symbol type %u\n" +msgstr "Hoppar över oväntad symboltyp %u\n" + +# +#: readelf.c:3763 +#, c-format +msgid "Skipping unexpected relocation type %s\n" +msgstr "Hoppar över oväntad omlokaliseringstyp %s\n" + +# +#: readelf.c:3808 readelf.c:3833 +msgid "" +"\n" +"There are no unwind sections in this file.\n" +msgstr "" +"\n" +"Det finns inga tillbakarullningssektioner i denna fil.\n" + +# +# BUGG: Fortsättningen är inte markerad för översättning i koden och innehåller '-citattecken. +#: readelf.c:3884 +msgid "" +"\n" +"Could not find unwind info section for " +msgstr "" +"\n" +"Kunde inte hitta tillbakarullningssektion till " + +# +#: readelf.c:3896 +msgid "unwind info" +msgstr "tillbakarullningsinfo" + +# +#: readelf.c:3898 +msgid "" +"\n" +"Unwind section " +msgstr "" +"\n" +"Tillbakarullningssektion " + +# +#: readelf.c:4071 readelf.c:4114 +msgid "dynamic segment" +msgstr "dynamiskt segment" + +# +#: readelf.c:4183 +msgid "" +"\n" +"There is no dynamic segment in this file.\n" +msgstr "" +"\n" +"Det finns inget dynamiskt segment i denna fil.\n" + +# +#: readelf.c:4217 +msgid "Unable to seek to end of file!" +msgstr "Kan inte uppsöka slutet av filen!" + +# +#: readelf.c:4228 +msgid "Unable to determine the number of symbols to load\n" +msgstr "Kan inte fastställa hur många symboler som ska läsas in\n" + +# +#: readelf.c:4258 +msgid "Unable to seek to end of file\n" +msgstr "Kan inte uppsöka slutet av filen\n" + +# +#: readelf.c:4264 +msgid "Unable to determine the length of the dynamic string table\n" +msgstr "Kan inte fastställa längden på den dynamiska strängtabellen\n" + +# +#: readelf.c:4269 +msgid "dynamic string table" +msgstr "dynamisk strängtabell" + +# +#: readelf.c:4303 +msgid "symbol information" +msgstr "symbolinformation" + +# +#: readelf.c:4327 +#, c-format +msgid "" +"\n" +"Dynamic segment at offset 0x%x contains %ld entries:\n" +msgstr "" +"\n" +"Dynamiskt segment på offset 0x%x innehåller %ld poster:\n" + +# +#: readelf.c:4330 +msgid " Tag Type Name/Value\n" +msgstr " Tagg Typ Namn/Värde\n" + +# +#: readelf.c:4366 +msgid "Auxiliary library" +msgstr "yttre bibliotek" + +# +#: readelf.c:4370 +msgid "Filter library" +msgstr "filterbibliotek" + +# +#: readelf.c:4374 +msgid "Configuration file" +msgstr "konfigurationsfil" + +# +#: readelf.c:4378 +msgid "Dependency audit library" +msgstr "beroendövervakningsbibliotek" + +# +#: readelf.c:4382 +msgid "Audit library" +msgstr "övervakningsbibliotek" + +# +#: readelf.c:4400 readelf.c:4426 readelf.c:4452 +msgid "Flags:" +msgstr "flaggor:" + +# +#: readelf.c:4402 readelf.c:4428 readelf.c:4454 +msgid " None\n" +msgstr " inga\n" + +# +#: readelf.c:4573 +#, c-format +msgid "Shared library: [%s]" +msgstr "delat bibliotek: [%s]" + +# +#: readelf.c:4576 +msgid " program interpreter" +msgstr " programtolk" + +# +#: readelf.c:4580 +#, c-format +msgid "Library soname: [%s]" +msgstr "biblioteks so-namn: [%s]" + +# +#: readelf.c:4584 +#, c-format +msgid "Library rpath: [%s]" +msgstr "bibliotekets rpath: [%s]" + +# +#: readelf.c:4588 +#, c-format +msgid "Library runpath: [%s]" +msgstr "bibliotekets runpath: [%s]" + +# +#: readelf.c:4649 +#, c-format +msgid "Not needed object: [%s]\n" +msgstr "onödigt objekt: [%s]\n" + +# +#: readelf.c:4746 +#, c-format +msgid "" +"\n" +"Version definition section '%s' contains %ld entries:\n" +msgstr "" +"\n" +"Versiondefinitionssektion \"%s\" innehåller %ld poster:\n" + +# +#: readelf.c:4749 +msgid " Addr: 0x" +msgstr " Adr: 0x" + +# +#: readelf.c:4751 readelf.c:4946 +#, c-format +msgid " Offset: %#08lx Link: %lx (%s)\n" +msgstr " Offset: %#08lx Länk: %lx (%s)\n" + +# +#: readelf.c:4758 +msgid "version definition section" +msgstr "versiondefinitionssektion" + +# +#: readelf.c:4784 +#, c-format +msgid " %#06x: Rev: %d Flags: %s" +msgstr " %#06x: Rev: %d Flaggor: %s" + +# +#: readelf.c:4787 +#, c-format +msgid " Index: %d Cnt: %d " +msgstr " Index: %d Ant: %d " + +# +#: readelf.c:4798 +#, c-format +msgid "Name: %s\n" +msgstr "Namn: %s\n" + +# +#: readelf.c:4800 +#, c-format +msgid "Name index: %ld\n" +msgstr "Namnindex: %ld\n" + +# +#: readelf.c:4815 +#, c-format +msgid " %#06x: Parent %d: %s\n" +msgstr " %#06x: Förälder %d: %s\n" + +# +#: readelf.c:4818 +#, c-format +msgid " %#06x: Parent %d, name index: %ld\n" +msgstr " %#06x: Förälder %d, namnindex: %ld\n" + +# +#: readelf.c:4837 +#, c-format +msgid "" +"\n" +"Version needs section '%s' contains %ld entries:\n" +msgstr "" +"\n" +"Versionbehovssektion \"%s\" innehåller %ld poster:\n" + +# +#: readelf.c:4840 +msgid " Addr: 0x" +msgstr " Adr: 0x" + +# +#: readelf.c:4842 +#, c-format +msgid " Offset: %#08lx Link to section: %ld (%s)\n" +msgstr " Offset: %#08lx Länk till sektion: %ld (%s)\n" + +# +#: readelf.c:4848 +msgid "version need section" +msgstr "versionsbehovssektion" + +# +#: readelf.c:4870 +#, c-format +msgid " %#06x: Version: %d" +msgstr " %#06x: Version: %d" + +# +#: readelf.c:4873 +#, c-format +msgid " File: %s" +msgstr " Fil: %s" + +# +#: readelf.c:4875 +#, c-format +msgid " File: %lx" +msgstr " Fil: %lx" + +# +#: readelf.c:4877 +#, c-format +msgid " Cnt: %d\n" +msgstr " Ant: %d\n" + +# +#: readelf.c:4895 +#, c-format +msgid " %#06x: Name: %s" +msgstr " %#06x: Namn: %s" + +# +#: readelf.c:4898 +#, c-format +msgid " %#06x: Name index: %lx" +msgstr " %#06x: Namnindex: %lx" + +# +#: readelf.c:4901 +#, c-format +msgid " Flags: %s Version: %d\n" +msgstr " Flaggor: %s Version: %d\n" + +# +#: readelf.c:4937 +msgid "version string table" +msgstr "versionssträngtabell" + +# +#: readelf.c:4941 +#, c-format +msgid "" +"\n" +"Version symbols section '%s' contains %d entries:\n" +msgstr "" +"\n" +"Versionsymbolssektion \"%s\" innehåller %d poster:\n" + +# +#: readelf.c:4944 +msgid " Addr: " +msgstr " Adr: " + +# +#: readelf.c:4954 +msgid "version symbol data" +msgstr "versionsymbolsdata" + +# +#: readelf.c:4981 +msgid " 0 (*local*) " +msgstr " 0 (*lokal*) " + +# +#: readelf.c:4985 +msgid " 1 (*global*) " +msgstr " 1 (*global*) " + +# +#: readelf.c:5020 readelf.c:5454 +msgid "version need" +msgstr "versionsbehov" + +# +#: readelf.c:5030 +msgid "version need aux (2)" +msgstr "yttre versionsbehov (2)" + +# +#: readelf.c:5071 readelf.c:5516 +msgid "version def" +msgstr "versionsdef." + +# +#: readelf.c:5090 readelf.c:5531 +msgid "version def aux" +msgstr "yttre versionsdef." + +# +#: readelf.c:5121 +msgid "" +"\n" +"No version information found in this file.\n" +msgstr "" +"\n" +"Det fanns ingen versionsinformation i denna fil.\n" + +# +#: readelf.c:5139 readelf.c:5174 +#, c-format +msgid ": %d" +msgstr ": %d" + +# +#: readelf.c:5141 readelf.c:5186 +#, c-format +msgid ": %d" +msgstr ": %d" + +# +#: readelf.c:5143 readelf.c:5189 +#, c-format +msgid ": %d" +msgstr ": %d" + +# +#: readelf.c:5252 +msgid "Unable to read in dynamic data\n" +msgstr "Kan inte läsa in dynamisk data\n" + +# +#: readelf.c:5294 +msgid "Unable to seek to start of dynamic information" +msgstr "Kan inte uppsöka början av den dynamiska informationen" + +# +#: readelf.c:5300 +msgid "Failed to read in number of buckets\n" +msgstr "Misslyckades läsa in antalet hinkar\n" + +# +#: readelf.c:5306 +msgid "Failed to read in number of chains\n" +msgstr "Misslyckades Läsa in antalet kedjor\n" + +# +#: readelf.c:5326 +msgid "" +"\n" +"Symbol table for image:\n" +msgstr "" +"\n" +"Symboltabell för filbilden:\n" + +# +#: readelf.c:5328 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " Nr Hin: Värde Strl Typ Bind Synl Idx Namn\n" + +# +#: readelf.c:5330 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " Nr Hin: Värde Strl Typ Bind Synl Idx Namn\n" + +# +#: readelf.c:5375 +#, c-format +msgid "" +"\n" +"Symbol table '%s' contains %lu entries:\n" +msgstr "" +"\n" +"Symboltabell \"%s\" innehåller %lu poster:\n" + +# +#: readelf.c:5379 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " Nr: Värde Strl Typ Bind Synl Idx Namn\n" + +# +#: readelf.c:5381 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " Nr: Värde Strl Typ Bind Synl Idx Namn\n" + +# +#: readelf.c:5427 +msgid "version data" +msgstr "versionsdata" + +# +#: readelf.c:5467 +msgid "version need aux (3)" +msgstr "yttre versionsbehov (3)" + +# +#: readelf.c:5492 +msgid "bad dynamic symbol" +msgstr "felaktig dynamisk symbol" + +# +#: readelf.c:5554 +msgid "" +"\n" +"Dynamic symbol information is not available for displaying symbols.\n" +msgstr "" +"\n" +"Informationen om dynamiska symboler är inte tillgänglig för att visa symboler.\n" + +# +#: readelf.c:5566 +#, c-format +msgid "" +"\n" +"Histogram for bucket list length (total of %d buckets):\n" +msgstr "" +"\n" +"Histogram över hinkarnas listlängd (totalt %d hinkar):\n" + +# +#: readelf.c:5568 +#, c-format +msgid " Length Number %% of total Coverage\n" +msgstr " Längd Nummer %% av alla Täckning\n" + +# +#: readelf.c:5573 readelf.c:5592 readelf.c:8825 readelf.c:9017 +msgid "Out of memory" +msgstr "Slut på minne" + +# +#: readelf.c:5641 +#, c-format +msgid "" +"\n" +"Dynamic info segment at offset 0x%lx contains %d entries:\n" +msgstr "" +"\n" +"Dynamiskt info-segment på offset 0x%lx innehåller %d poster:\n" + +# +#: readelf.c:5644 +msgid " Num: Name BoundTo Flags\n" +msgstr " Nr: Namn BundenTill Flaggor\n" + +# +#: readelf.c:5696 +#, c-format +msgid "" +"\n" +"Assembly dump of section %s\n" +msgstr "" +"\n" +"Disassembleringsutskrift av sektion %s\n" + +# +#: readelf.c:5719 +#, c-format +msgid "" +"\n" +"Section '%s' has no data to dump.\n" +msgstr "" +"\n" +"Sektion \"%s\" har ingen data att skriva ut.\n" + +# +#: readelf.c:5724 +#, c-format +msgid "" +"\n" +"Hex dump of section '%s':\n" +msgstr "" +"\n" +"Hexadecimal utskrift av sektion \"%s\":\n" + +# +#: readelf.c:5729 +msgid "section data" +msgstr "sektionsdata" + +# +#: readelf.c:5878 +msgid "badly formed extended line op encountered!\n" +msgstr "felaktigt utformad utökad rad-op påträffades!\n" + +# +#: readelf.c:5885 +#, c-format +msgid " Extended opcode %d: " +msgstr " Utökad op-kod %d: " + +# +#: readelf.c:5890 +msgid "" +"End of Sequence\n" +"\n" +msgstr "" +"Slut på sekvensen\n" +"\n" + +# +#: readelf.c:5896 +#, c-format +msgid "set Address to 0x%lx\n" +msgstr "sätt Adress till 0x%lx\n" + +# +#: readelf.c:5901 +msgid " define new File Table entry\n" +msgstr " definiera ny filtabellspost\n" + +# +#: readelf.c:5902 readelf.c:6031 +msgid " Entry\tDir\tTime\tSize\tName\n" +msgstr " Post\tKatalog\tTid\tStorl.\tNamn\n" + +# +#: readelf.c:5904 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +# +#: readelf.c:5907 readelf.c:5909 readelf.c:5911 readelf.c:6043 readelf.c:6045 +#: readelf.c:6047 +#, c-format +msgid "%lu\t" +msgstr "%lu\t" + +# +#: readelf.c:5912 +#, c-format +msgid "" +"%s\n" +"\n" +msgstr "" +"%s\n" +"\n" + +# +#: readelf.c:5916 +#, c-format +msgid "UNKNOWN: length %d\n" +msgstr "OKÄND: längd %d\n" + +# +#: readelf.c:5942 +#, c-format +msgid "" +"\n" +"Dump of debug contents of section %s:\n" +"\n" +msgstr "" +"\n" +"Utskrift av felsökningsinnehåll i sektion %s:\n" +"\n" + +# +#: readelf.c:5954 +msgid "64-bit DWARF line info is not supported yet.\n" +msgstr "64-bitars DWARF-radinformation stöds inte än.\n" + +# +#: readelf.c:5961 +msgid "The line info appears to be corrupt - the section is too small\n" +msgstr "Radinformationen verkar vara trasig - sektionen är för liten\n" + +# +#: readelf.c:5969 +msgid "Only DWARF version 2 line info is currently supported.\n" +msgstr "Endast DWARF version 2:s radinfo stöds för närvarande.\n" + +# +#: readelf.c:5984 +#, c-format +msgid " Length: %ld\n" +msgstr " längd: %ld\n" + +# +#: readelf.c:5985 +#, c-format +msgid " DWARF Version: %d\n" +msgstr " DWARF version: %d\n" + +# +#: readelf.c:5986 +#, c-format +msgid " Prologue Length: %d\n" +msgstr " prologlängd: %d\n" + +# +#: readelf.c:5987 +#, c-format +msgid " Minimum Instruction Length: %d\n" +msgstr " minsta instruktionslängd: %d\n" + +# +# BUGG: Ska det inte vara `' på engelska? +#: readelf.c:5988 +#, c-format +msgid " Initial value of 'is_stmt': %d\n" +msgstr " initialvärde på \"is_stmt\": %d\n" + +# +#: readelf.c:5989 +#, c-format +msgid " Line Base: %d\n" +msgstr " radbas: %d\n" + +# +#: readelf.c:5990 +#, c-format +msgid " Line Range: %d\n" +msgstr " radintervall: %d\n" + +# +#: readelf.c:5991 +#, c-format +msgid " Opcode Base: %d\n" +msgstr " op-kodbas: %d\n" + +# +#: readelf.c:6000 +msgid "" +"\n" +" Opcodes:\n" +msgstr "" +"\n" +" Op-koder:\n" + +# +#: readelf.c:6003 +#, c-format +msgid " Opcode %d has %d args\n" +msgstr " Op-kod %d har %d argument\n" + +# +#: readelf.c:6009 +msgid "" +"\n" +" The Directory Table is empty.\n" +msgstr "" +"\n" +" Katalogtabellen är tom.\n" + +# +#: readelf.c:6012 +msgid "" +"\n" +" The Directory Table:\n" +msgstr "" +"\n" +" Katalogtabellen:\n" + +# +#: readelf.c:6016 +#, c-format +msgid " %s\n" +msgstr " %s\n" + +# +#: readelf.c:6027 +msgid "" +"\n" +" The File Name Table is empty.\n" +msgstr "" +"\n" +" Filnamnstabellen är tom.\n" + +# +#: readelf.c:6030 +msgid "" +"\n" +" The File Name Table:\n" +msgstr "" +"\n" +" Filnamnstabellen:\n" + +# +#: readelf.c:6038 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +# +#: readelf.c:6049 +#, c-format +msgid "%s\n" +msgstr "%s\n" + +# +#. Now display the statements. +#: readelf.c:6057 +msgid "" +"\n" +" Line Number Statements:\n" +msgstr "" +"\n" +" Radnummersatser:\n" + +# +#: readelf.c:6073 +#, c-format +msgid " Special opcode %d: advance Address by %d to 0x%lx" +msgstr " Särskild op-kod %d: öka adressen med %d till 0x%lx" + +# +#: readelf.c:6077 +#, c-format +msgid " and Line by %d to %d\n" +msgstr " och radnumret med %d till %d\n" + +# +#: readelf.c:6088 +msgid " Copy\n" +msgstr " Kopiera\n" + +# +#: readelf.c:6095 +#, c-format +msgid " Advance PC by %d to %lx\n" +msgstr " Öka PC med %d till %lx\n" + +# +#: readelf.c:6103 +#, c-format +msgid " Advance Line by %d to %d\n" +msgstr " Öka radnumret med %d till %d\n" + +# +#: readelf.c:6110 +#, c-format +msgid " Set File Name to entry %d in the File Name Table\n" +msgstr " Sätt filnamnet till post %d i filnamnstabellen\n" + +# +#: readelf.c:6118 +#, c-format +msgid " Set column to %d\n" +msgstr " Sätt kolumnen till %d\n" + +# +#: readelf.c:6125 +#, c-format +msgid " Set is_stmt to %d\n" +msgstr " Sätt is_stmt till %d\n" + +# +#: readelf.c:6130 +msgid " Set basic block\n" +msgstr " Sätt basblocket\n" + +# +#: readelf.c:6138 +#, c-format +msgid " Advance PC by constant %d to 0x%lx\n" +msgstr " Öka PC med konstant %d till 0x%lx\n" + +# +#: readelf.c:6146 +#, c-format +msgid " Advance PC by fixed size amount %d to 0x%lx\n" +msgstr " Öka PC med fastlängdsantal %d till 0x%lx\n" + +# +#: readelf.c:6151 +msgid " Set prologue_end to true\n" +msgstr " Sätt prologue_end till sannt\n" + +# +#: readelf.c:6155 +msgid " Set epilogue_begin to true\n" +msgstr " Sätt epilogue_begin till sannt\n" + +# +#: readelf.c:6161 +#, c-format +msgid " Set ISA to %d\n" +msgstr " Sätt ISA till %d\n" + +# +#: readelf.c:6165 +#, c-format +msgid " Unknown opcode %d with operands: " +msgstr " Okänd op-kod %d med operand: " + +# +#: readelf.c:6197 readelf.c:6658 readelf.c:6730 +#, c-format +msgid "" +"Contents of the %s section:\n" +"\n" +msgstr "" +"%s-sektionens innehåll:\n" +"\n" + +# +#: readelf.c:6216 +msgid "64-bit DWARF pubnames are not supported yet.\n" +msgstr "64-bitars publika DWARF-namn stöds inte än.\n" + +# +#: readelf.c:6226 +msgid "Only DWARF 2 pubnames are currently supported\n" +msgstr "Endast publika DWARF 2-namn stöds för närvarande\n" + +# +#: readelf.c:6233 +#, c-format +msgid " Length: %ld\n" +msgstr " längd: %ld\n" + +# +#: readelf.c:6235 +#, c-format +msgid " Version: %d\n" +msgstr " version: %d\n" + +# +#: readelf.c:6237 +#, c-format +msgid " Offset into .debug_info section: %ld\n" +msgstr " offset i .debug_info-sektionen: %ld\n" + +# +#: readelf.c:6239 +#, c-format +msgid " Size of area in .debug_info section: %ld\n" +msgstr " storl. på omr. i .debug_info-sekt.: %ld\n" + +# +#: readelf.c:6242 +msgid "" +"\n" +" Offset\tName\n" +msgstr "" +"\n" +" Offset\tNamn\n" + +# +#: readelf.c:6333 +#, c-format +msgid "Unknown TAG value: %lx" +msgstr "Okänt TAG-värde: %lx" + +# +#: readelf.c:6443 +#, c-format +msgid "Unknown AT value: %lx" +msgstr "Okänt AT-värde: %lx" + +# +#: readelf.c:6480 +#, c-format +msgid "Unknown FORM value: %lx" +msgstr "Okänt FORM-värde: %lx" + +# +#: readelf.c:6679 +#, c-format +msgid " DW_MACINFO_start_file - lineno: %d filenum: %d\n" +msgstr " DW_MACINFO_start_file - rad: %d filnummer: %d\n" + +# +#: readelf.c:6684 +msgid " DW_MACINFO_end_file\n" +msgstr " DW_MACINFO_end_file\n" + +# +#: readelf.c:6692 +#, c-format +msgid " DW_MACINFO_define - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_define - rad: %d makro: %s\n" + +# +#: readelf.c:6700 +#, c-format +msgid " DW_MACINFO_undef - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_undef - rad: %d makro: %s\n" + +# +#: readelf.c:6711 +#, c-format +msgid " DW_MACINFO_vendor_ext - constant : %d string : %s\n" +msgstr " DW_MACINFO_vendor_ext - konstant: %d sträng: %s\n" + +# +# Detta är ett tabellhuvud med två kolumner. +#: readelf.c:6739 +msgid " Number TAG\n" +msgstr " Nummer TAGG\n" + +# +#: readelf.c:6745 +#, c-format +msgid " %ld %s [%s]\n" +msgstr " %ld %s [%s]\n" + +# +#: readelf.c:6748 +msgid "has children" +msgstr "har barn" + +# +#: readelf.c:6748 +msgid "no children" +msgstr "inga barn" + +# +#: readelf.c:6752 +#, c-format +msgid " %-18s %s\n" +msgstr " %-18s %s\n" + +# +#: readelf.c:6773 +#, c-format +msgid " %lu byte block: " +msgstr " %lu byte-block: " + +# +#: readelf.c:7096 +msgid "(User defined location op)" +msgstr "(användardefinierad plats-op)" + +# +#: readelf.c:7098 +msgid "(Unknown location op)" +msgstr "(okänd plats-op)" + +# +#: readelf.c:7137 +msgid "debug_str section data" +msgstr "debug_str sektionsdata" + +# +#: readelf.c:7156 +msgid "" +msgstr "" + +# +#: readelf.c:7159 +msgid "" +msgstr "" + +# +#: readelf.c:7179 +msgid "" +"\n" +"The .debug_str section is empty.\n" +msgstr "" +"\n" +".debug_str-sektionen är tom.\n" + +# +#: readelf.c:7183 +msgid "" +"Contents of the .debug_str section:\n" +"\n" +msgstr "" +"Innehåll i .debug_str-sektionen:\n" +"\n" + +# +#: readelf.c:7354 +#, c-format +msgid " (indirect string, offset: 0x%lx): " +msgstr " (indirekt sträng, offset: 0x%lx): " + +# +#: readelf.c:7363 +#, c-format +msgid "Unrecognised form: %d\n" +msgstr "Okänt formulär: %d\n" + +# +#: readelf.c:7376 +msgid "(not inlined)" +msgstr "(inte inlajnad)" + +# +#: readelf.c:7377 +msgid "(inlined)" +msgstr "(inlajnad)" + +# +#: readelf.c:7378 +msgid "(declared as inline but ignored)" +msgstr "(deklarerad som inlajn men ignorerad)" + +# +#: readelf.c:7379 +msgid "(declared as inline and inlined)" +msgstr "(deklarerad som inlajn och inlajnad)" + +# +#: readelf.c:7380 +#, c-format +msgid " (Unknown inline attribute value: %lx)" +msgstr " (okänt inlajnattributvärde: %lx)" + +# +#: readelf.c:7545 readelf.c:7746 +#, c-format +msgid "" +"The section %s contains:\n" +"\n" +msgstr "" +"Sektion %s innehåller:\n" +"\n" + +# +#: readelf.c:7568 +msgid "64-bit DWARF debug info is not supported yet.\n" +msgstr "64-bitars DWARF-felsökningsinfo stöds inte än.\n" + +# +#: readelf.c:7637 +#, c-format +msgid " Compilation Unit @ %lx:\n" +msgstr " Kompileringsenhet @ %lx:\n" + +# +#: readelf.c:7638 +#, c-format +msgid " Length: %ld\n" +msgstr " längd: %ld\n" + +# +#: readelf.c:7639 +#, c-format +msgid " Version: %d\n" +msgstr " version: %d\n" + +# +#: readelf.c:7640 +#, c-format +msgid " Abbrev Offset: %ld\n" +msgstr " förk.-offset: %ld\n" + +# +#: readelf.c:7641 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " pekarstorlek: %d\n" + +# +#: readelf.c:7645 +msgid "Only version 2 DWARF debug information is currently supported.\n" +msgstr "Endast version 2 av DWARF-felsökningsinformation stöds för närvarande.\n" + +# +#: readelf.c:7666 +msgid "Unable to locate .debug_abbrev section!\n" +msgstr "Kan inte hitta någon .debug_abbrev-sektion!\n" + +# +#: readelf.c:7672 +msgid "debug_abbrev section data" +msgstr "debug_abbrev-sektionsdata" + +# +#: readelf.c:7709 +#, c-format +msgid "Unable to locate entry %lu in the abbreviation table\n" +msgstr "Kan inte hitta post %lu i förkortningstabellen\n" + +# +#: readelf.c:7714 +#, c-format +msgid " <%d><%lx>: Abbrev Number: %lu (%s)\n" +msgstr " <%d><%lx>: Förkortningsnummer: %lu (%s)\n" + +# +#: readelf.c:7767 +msgid "64-bit DWARF aranges are not supported yet.\n" +msgstr "64-bitars DWARF-a-intervall stöds inte än.\n" + +# +#: readelf.c:7773 +msgid "Only DWARF 2 aranges are currently supported.\n" +msgstr "Endast DWARF2:s a-intervall stöds för närvarande.\n" + +# +#: readelf.c:7777 +#, c-format +msgid " Length: %ld\n" +msgstr " längd: %ld\n" + +# +#: readelf.c:7778 +#, c-format +msgid " Version: %d\n" +msgstr " version: %d\n" + +# +#: readelf.c:7779 +#, c-format +msgid " Offset into .debug_info: %lx\n" +msgstr " offset i .debug_info: %lx\n" + +# +#: readelf.c:7780 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " pekarstorlek: %d\n" + +# +#: readelf.c:7781 +#, c-format +msgid " Segment Size: %d\n" +msgstr " segmentstorlek: %d\n" + +# +#: readelf.c:7783 +msgid "" +"\n" +" Address Length\n" +msgstr "" +"\n" +" adresslängd\n" + +# +#: readelf.c:7965 +#, c-format +msgid "The section %s contains:\n" +msgstr "Sektion %s innehåller:\n" + +# +#: readelf.c:7988 +msgid "64-bit DWARF format frames are not supported yet.\n" +msgstr "64-bitars DWARF-formatmallar stöds inte än.\n" + +# +#: readelf.c:8499 +#, c-format +msgid "Displaying the debug contents of section %s is not yet supported.\n" +msgstr "Visa felsökningsinnehållet i sektion %s stöds inte än.\n" + +# +#: readelf.c:8565 +#, c-format +msgid "" +"\n" +"Section '%s' has no debugging data.\n" +msgstr "" +"\n" +"Sektion \"%s\" innehåller ingen felsökningsdata.\n" + +# +#: readelf.c:8570 readelf.c:8632 +msgid "debug section data" +msgstr "felsökningssektionsdata" + +# +#: readelf.c:8586 +#, c-format +msgid "Unrecognised debug section: %s\n" +msgstr "Okänd felsökningssektion: %s\n" + +# +#: readelf.c:8660 +msgid "Some sections were not dumped because they do not exist!\n" +msgstr "Några sektioner skrevs inte ut eftersom de inte existerar!\n" + +# +#: readelf.c:8733 +msgid "liblist" +msgstr "bibliotekslista" + +# +#: readelf.c:8818 +msgid "options" +msgstr "flaggor" + +# +#: readelf.c:8849 +#, c-format +msgid "" +"\n" +"Section '%s' contains %d entries:\n" +msgstr "" +"\n" +"Sektion \"%s\" innehåller %d poster:\n" + +# +# BUGG: Fel i originalet? +#: readelf.c:9010 +msgid "conflict list with without table" +msgstr "konfliktlista utan tabell" + +# +#: readelf.c:9028 readelf.c:9044 +msgid "conflict" +msgstr "konflikt" + +# +#: readelf.c:9054 +#, c-format +msgid "" +"\n" +"Section '.conflict' contains %ld entries:\n" +msgstr "" +"\n" +"Sektion \".conflict\" innehåller %ld poster:\n" + +# +#: readelf.c:9056 +msgid " Num: Index Value Name" +msgstr " Num: Index Värde Namn" + +# +#: readelf.c:9083 +msgid "NT_PRSTATUS (prstatus structure)" +msgstr "NT_PRSTATUS (prstatus-struktur)" + +# +#: readelf.c:9084 +msgid "NT_FPREGSET (floating point registers)" +msgstr "NT_FPREGSET (flyttalsregister)" + +# +#: readelf.c:9085 +msgid "NT_PRPSINFO (prpsinfo structure)" +msgstr "NT_PRPSINFO (prpsinfo-struktur)" + +# +#: readelf.c:9086 +msgid "NT_TASKSTRUCT (task structure)" +msgstr "NT_TASKSTRUCT (uppgiftsstruktur)" + +# +#: readelf.c:9087 +msgid "NT_PRXFPREG (user_xfpregs structure)" +msgstr "NT_PRXFPREG (user_xfpregs-struktur)" + +# +#: readelf.c:9088 +msgid "NT_PSTATUS (pstatus structure)" +msgstr "NT_PSTATUS (pstatus-struktur)" + +# +#: readelf.c:9089 +msgid "NT_FPREGS (floating point registers)" +msgstr "NT_FPREGS (flyttalsregister)" + +# +#: readelf.c:9090 +msgid "NT_PSINFO (psinfo structure)" +msgstr "NT_PSINFO (psinfo-struktur)" + +# +#: readelf.c:9091 +msgid "NT_LWPSTATUS (lwpstatus_t structure)" +msgstr "NT_LWPSTATUS (lwpstatus_t-struktur)" + +# +#: readelf.c:9092 +msgid "NT_LWPSINFO (lwpsinfo_t structure)" +msgstr "NT_LWPSINFO (lwpsinfo_t-struktur)" + +# +# BUGG: Stavfel i originalet (str>uc, 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: binutils 2.14rel030712\n" +"POT-Creation-Date: 2003-07-11 13:56+0930\n" +"PO-Revision-Date: 2003-08-17 14:37+0300\n" +"Last-Translator: Deniz Akkus Kanca \n" +"Language-Team: Turkish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.0\n" + +#: addr2line.c:74 +#, c-format +msgid "Usage: %s [option(s)] [addr(s)]\n" +msgstr "Kullanım: %s [seçenekler] [adresler]\n" + +#: addr2line.c:75 +msgid " Convert addresses into line number/file name pairs.\n" +msgstr " adresleri satır numarası/dosya adı çiftlerine çevirir.\n" + +#: addr2line.c:76 +msgid " If no addresses are specified on the command line, they will be read from stdin\n" +msgstr " EÄŸer komut satırında adres belirtilmezse, standart girdiden okunur\n" + +#: addr2line.c:77 +msgid "" +" The options are:\n" +" -b --target= Set the binary file format\n" +" -e --exe= Set the input file name (default is a.out)\n" +" -s --basenames Strip directory names\n" +" -f --functions Show function names\n" +" -C --demangle[=style] Demangle function names\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +" Seçenekler:\n" +" -b --target= İkilik dosya biçemini belirtir\n" +" -e --exe=<çalıştırılabilir dosya> Girdi adını belirtir (öntanımlı: a.out)\n" +" -s --basenames Dizin adlarını soyar\n" +" -f --functions İşlev adlarını gösterir\n" +" -C --demangle[=tarz] İşlev adlarını düzeltir\n" +" -h --help Bu bilgiyi gösterir\n" +" -v --version Program sürüm no'sunu gösterir\n" +"\n" + +#: addr2line.c:89 ar.c:297 coffdump.c:479 nlmconv.c:1121 objcopy.c:484 +#: objcopy.c:518 readelf.c:2649 size.c:104 srconv.c:1962 strings.c:673 +#: sysdump.c:774 windres.c:702 +#, c-format +msgid "Report bugs to %s\n" +msgstr "Yazılım hatalarını %s adresine, çeviri hatalarını adresine gönderin\n" + +#: addr2line.c:245 +#, c-format +msgid "%s: can not get addresses from archive" +msgstr "%s: arÅŸivden adresler alınamadı" + +#: addr2line.c:317 nm.c:433 objdump.c:2693 +#, c-format +msgid "unknown demangling style `%s'" +msgstr "bilinmeyen düzeltme tarzı '%s'" + +#: ar.c:238 +#, c-format +msgid "no entry %s in archive\n" +msgstr "arÅŸivde %s girdisi yok\n" + +#: ar.c:255 +#, c-format +msgid "Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n" +msgstr "Kullanım: %s [öykünüm seçenekleri] [-]{dmpqrstx}[abcfilNoPsSuvV] [üye-adı] [sayı] arÅŸiv-dosyası dosya...\n" + +#: ar.c:258 +#, c-format +msgid " %s -M [\n" +"\n" +msgstr "" +"\n" +"<üye %s>\n" +"\n" + +#: ar.c:857 ar.c:925 +#, c-format +msgid "%s is not a valid archive" +msgstr "%s geçerli bir arÅŸiv deÄŸil" + +#: ar.c:893 +#, c-format +msgid "stat returns negative size for %s" +msgstr "stat komutu, %s için negatif büyüklük gösteriyor" + +#: ar.c:1020 +#, c-format +msgid "%s is not an archive" +msgstr "%s bir arÅŸiv deÄŸil" + +#: ar.c:1027 +#, c-format +msgid "creating %s" +msgstr "%s oluÅŸturuluyor" + +#: ar.c:1233 +#, c-format +msgid "No member named `%s'\n" +msgstr "`%s' adında bir üye yok\n" + +#: ar.c:1285 +#, c-format +msgid "no entry %s in archive %s!" +msgstr "arÅŸiv %2$s içerisinde %1$s girdisi yok!" + +#: ar.c:1422 +#, c-format +msgid "%s: no archive map to update" +msgstr "%s: güncellenecek arÅŸiv eÅŸlemesi yok" + +#: arsup.c:86 +#, c-format +msgid "No entry %s in archive.\n" +msgstr "ArÅŸiv içinde %s girdisi yok.\n" + +#: arsup.c:117 +#, c-format +msgid "Can't open file %s\n" +msgstr "%s dosyası açılamadı\n" + +#: arsup.c:172 +#, c-format +msgid "%s: Can't open output archive %s\n" +msgstr "%s: Çıktı arÅŸivi %s açılamadı\n" + +#: arsup.c:189 +#, c-format +msgid "%s: Can't open input archive %s\n" +msgstr "%s: Girdi arÅŸivi %s açılamadı\n" + +#: arsup.c:198 +#, c-format +msgid "%s: file %s is not an archive\n" +msgstr "%s: %s dosyası bir arÅŸiv deÄŸil\n" + +#: arsup.c:241 +#, c-format +msgid "%s: no output archive specified yet\n" +msgstr "%s: henüz bir çıktı arÅŸivi belirtilmedi\n" + +#: arsup.c:262 arsup.c:301 arsup.c:343 arsup.c:364 arsup.c:430 +#, c-format +msgid "%s: no open output archive\n" +msgstr "%s: açık çıktı arÅŸivi yok\n" + +#: arsup.c:273 arsup.c:385 arsup.c:411 +#, c-format +msgid "%s: can't open file %s\n" +msgstr "%s: %s dosyası açılamadı\n" + +#: arsup.c:328 arsup.c:407 arsup.c:489 +#, c-format +msgid "%s: can't find module file %s\n" +msgstr "%s: modül dosyası %s bulunamadı\n" + +#: arsup.c:439 +#, c-format +msgid "Current open archive is %s\n" +msgstr "Åžimdiki açık arÅŸiv %s\n" + +#: arsup.c:464 +#, c-format +msgid "%s: no open archive\n" +msgstr "%s: açık arÅŸiv yok\n" + +#: binemul.c:39 +#, c-format +msgid " No emulation specific options\n" +msgstr " Öykünüme özgü seçenekler yok\n" + +#. Macros for common output. +#: binemul.h:52 +#, c-format +msgid " emulation options: \n" +msgstr " öykünüm seçenekleri: \n" + +#: bucomm.c:113 +#, c-format +msgid "can't set BFD default target to `%s': %s" +msgstr "BFD öntanımlı hedef `%s' olarak atanamadı: %s" + +#: bucomm.c:125 +#, c-format +msgid "%s: Matching formats:" +msgstr "%s: EÅŸleÅŸen biçemler:" + +#: bucomm.c:142 +msgid "Supported targets:" +msgstr "Desteklenen hedefler:" + +#: bucomm.c:144 +#, c-format +msgid "%s: supported targets:" +msgstr "%s: desteklenen hedefler:" + +#: bucomm.c:162 +msgid "Supported architectures:" +msgstr "Desteklenen platformlar:" + +#: bucomm.c:164 +#, c-format +msgid "%s: supported architectures:" +msgstr "%s: desteklenen platformlar:" + +#: bucomm.c:360 +#, c-format +msgid "BFD header file version %s\n" +msgstr "BFD baÅŸlık dosyası sürümü %s\n" + +#: bucomm.c:467 +#, c-format +msgid "%s: bad number: %s" +msgstr "%s: hatalı sayı: %s" + +#: coffdump.c:107 +#, c-format +msgid "#lines %d " +msgstr "#satırlar %d " + +#: coffdump.c:471 sysdump.c:767 +#, c-format +msgid "Usage: %s [option(s)] in-file\n" +msgstr "Kullanım: %s girdi-dosya(ları)\n" + +#: coffdump.c:472 +msgid " Print a human readable interpretation of a SYSROFF object file\n" +msgstr " SYSROFF nesne dosyasını insan tarafından okunabilir biçemde yazdırır\n" + +#: coffdump.c:473 +msgid "" +" The options are:\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +" Seçenekler:\n" +" -h --help Bu bilgiyi gösterir\n" +" -v --version Program sürüm no'sunu gösterir\n" +"\n" + +#: coffdump.c:541 srconv.c:2052 sysdump.c:831 +msgid "no input file specified" +msgstr "girdi dosyası belirtilmedi" + +#: debug.c:654 +msgid "debug_add_to_current_namespace: no current file" +msgstr "hata_ayıkla_mevcut_isim_uzayına_ekle: mevcut dosya yok" + +#: debug.c:737 +msgid "debug_start_source: no debug_set_filename call" +msgstr "hata_ayıkla_kaynak: hata_ayıkla_dosya_adı_ata çaÄŸrılmadı" + +#: debug.c:796 +msgid "debug_record_function: no debug_set_filename call" +msgstr "hata_ayıkla_kayıt_iÅŸlevi: hata_ayıkla_dosya_adı_ata çaÄŸrılmadı" + +#: debug.c:852 +msgid "debug_record_parameter: no current function" +msgstr "hata_ayıkla_kayıt_parametresi: mevcut iÅŸlev yok" + +#: debug.c:886 +msgid "debug_end_function: no current function" +msgstr "hata_ayıkla_son_iÅŸlev: mevcut iÅŸlev yok" + +#: debug.c:892 +msgid "debug_end_function: some blocks were not closed" +msgstr "hata_ayıkla_son_iÅŸlev: bazı bloklar kapatılmamış" + +#: debug.c:922 +msgid "debug_start_block: no current block" +msgstr "hata_ayıkla_baÅŸla_blok: mevcut blok yok" + +#: debug.c:960 +msgid "debug_end_block: no current block" +msgstr "hata_ayıkla_son_blok: mevcut blok yok" + +#: debug.c:967 +msgid "debug_end_block: attempt to close top level block" +msgstr "hata_ayıkla_son_blok: tepe seviye bloÄŸu kapama denemesi" + +#: debug.c:993 +msgid "debug_record_line: no current unit" +msgstr "hata_ayıkla_kayıt_satır: mevcut birim yok" + +#. FIXME +#: debug.c:1047 +msgid "debug_start_common_block: not implemented" +msgstr "hata_ayıkla_ortak_blok_baÅŸla: henüz tamamlanmamış" + +#. FIXME +#: debug.c:1059 +msgid "debug_end_common_block: not implemented" +msgstr "hata_ayıkla_ortak_blok_son: henüz tamamlanmamış" + +#. FIXME. +#: debug.c:1153 +msgid "debug_record_label: not implemented" +msgstr "hata_ayıkla_kayıt_etiket: henüz tamamlanmamış" + +#: debug.c:1179 +msgid "debug_record_variable: no current file" +msgstr "hata_ayıkla_kayıt_deÄŸiÅŸken: mevcut dosya yok" + +#: debug.c:1762 +msgid "debug_make_undefined_type: unsupported kind" +msgstr "hata_ayıkla_tanımlanmamış_tip: desteklenmeyen tip" + +#: debug.c:1963 +msgid "debug_name_type: no current file" +msgstr "hata_ayıkla_isim_tipi: mevcut dosya yok" + +#: debug.c:2011 +msgid "debug_tag_type: no current file" +msgstr "hata_ayıkla_etiket_tipi: mevcut dosya yok" + +#: debug.c:2019 +msgid "debug_tag_type: extra tag attempted" +msgstr "hata_ayıkla_etiket_tipi: fazla etiketleme denendi" + +#: debug.c:2058 +#, c-format +msgid "Warning: changing type size from %d to %d\n" +msgstr "Uyarı: tip boyutu %d'den %d'ye deÄŸiÅŸtirildi\n" + +#: debug.c:2082 +msgid "debug_find_named_type: no current compilation unit" +msgstr "hata_ayıkla_isimli_tipi_bul: mevcut derleme birimi yok" + +#: debug.c:2189 +#, c-format +msgid "debug_get_real_type: circular debug information for %s\n" +msgstr "hata_ayıkla_gerçek_tipi_al: %s için çevrimsel hata ayıklama bilgisi\n" + +#: debug.c:2650 +msgid "debug_write_type: illegal type encountered" +msgstr "hata_ayıkla_yaz_tipi: geçersiz tip bulundu" + +#: dlltool.c:812 dlltool.c:837 dlltool.c:863 +#, c-format +msgid "Internal error: Unknown machine type: %d" +msgstr "İç hata: Bilinmeyen makina tipi: %d" + +#: dlltool.c:900 +#, c-format +msgid "Can't open def file: %s" +msgstr "Tanım dosyası açılamadı: %s" + +#: dlltool.c:905 +#, c-format +msgid "Processing def file: %s" +msgstr "Tanım dosyası iÅŸleniyor: %s" + +#: dlltool.c:909 +msgid "Processed def file" +msgstr "Tanım dosyası iÅŸlendi" + +#: dlltool.c:935 +#, c-format +msgid "Syntax error in def file %s:%d" +msgstr "Tanım dosyası %s'nda sözdizim hatası:%d" + +#: dlltool.c:974 +#, c-format +msgid "NAME: %s base: %x" +msgstr "İSİM: %s temel: %x" + +#: dlltool.c:977 dlltool.c:996 +msgid "Can't have LIBRARY and NAME" +msgstr "KİTAPLIK ve İSİM beraber olamaz" + +#: dlltool.c:993 +#, c-format +msgid "LIBRARY: %s base: %x" +msgstr "KİTAPLIK: %s temel: %x" + +#: dlltool.c:1251 resrc.c:271 +#, c-format +msgid "wait: %s" +msgstr "bekle: %s" + +#: dlltool.c:1256 dllwrap.c:430 resrc.c:276 +#, c-format +msgid "subprocess got fatal signal %d" +msgstr "Ast-iÅŸlem %d ölümcül sinyalini aldı" + +#: dlltool.c:1262 dllwrap.c:437 resrc.c:283 +#, c-format +msgid "%s exited with status %d" +msgstr "%s %d durumu ile çıktı" + +#: dlltool.c:1294 +#, c-format +msgid "Sucking in info from %s section in %s" +msgstr "%2$s'in %1$s bölümünden bilgi emiliyor" + +#: dlltool.c:1423 +#, c-format +msgid "Excluding symbol: %s" +msgstr "Sembol dışlandı: %s" + +#: dlltool.c:1518 dlltool.c:1529 nm.c:1004 nm.c:1015 +#, c-format +msgid "%s: no symbols" +msgstr "%s: sembol yok" + +#. FIXME: we ought to read in and block out the base relocations. +#: dlltool.c:1556 +#, c-format +msgid "Done reading %s" +msgstr "%s okundu" + +#: dlltool.c:1567 +#, c-format +msgid "Unable to open object file: %s" +msgstr "Nesne dosyası açılamadı: %s" + +#: dlltool.c:1570 +#, c-format +msgid "Scanning object file %s" +msgstr "Nesne dosyası %s taranıyor" + +#: dlltool.c:1585 +#, c-format +msgid "Cannot produce mcore-elf dll from archive file: %s" +msgstr "ArÅŸiv dosyasından mcore-elf dll oluÅŸturulamadı: %s" + +#: dlltool.c:1677 +msgid "Adding exports to output file" +msgstr "Çıktı dosyasına ihraçlar ekleniyor" + +#: dlltool.c:1724 +msgid "Added exports to output file" +msgstr "Çıktı dosyasına ihraçlar eklendi" + +#: dlltool.c:1848 +#, c-format +msgid "Generating export file: %s" +msgstr "İhraç dosyası oluÅŸturuluyor: %s" + +#: dlltool.c:1853 +#, c-format +msgid "Unable to open temporary assembler file: %s" +msgstr "Geçiçi üretici dosyası açılamadı: %s" + +#: dlltool.c:1856 +#, c-format +msgid "Opened temporary file: %s" +msgstr "Geçici dosya açıldı: %s" + +#: dlltool.c:2086 +msgid "Generated exports file" +msgstr "İhraç dosyası oluÅŸturuldu" + +#: dlltool.c:2378 +#, c-format +msgid "bfd_open failed open stub file: %s" +msgstr "koçan dosyası bfd_open ile açılamadı: %s" + +#: dlltool.c:2381 +#, c-format +msgid "Creating stub file: %s" +msgstr "Koçan dosyası oluÅŸturuluyor: %s" + +#: dlltool.c:2766 +#, c-format +msgid "failed to open temporary head file: %s" +msgstr "geçici baÅŸlık dosyası açılamadı: %s" + +#: dlltool.c:2825 +#, c-format +msgid "failed to open temporary tail file: %s" +msgstr "geçici kuyruk dosyası açılamadı: %s" + +#: dlltool.c:2892 +#, c-format +msgid "Can't open .lib file: %s" +msgstr ".lib dosyası açılamadı: %s" + +#: dlltool.c:2895 +#, c-format +msgid "Creating library file: %s" +msgstr "Kitaplık dosyası açılamadı: %s" + +#: dlltool.c:2951 +#, c-format +msgid "cannot delete %s: %s" +msgstr "%s silinemedi: %s" + +#: dlltool.c:2955 +msgid "Created lib file" +msgstr "Lib dosyası oluÅŸturuldu" + +#: dlltool.c:3062 +#, c-format +msgid "Warning, ignoring duplicate EXPORT %s %d,%d" +msgstr "Uyarı, EXPORT tekrarı %s %d,%d yoksayıldı" + +#: dlltool.c:3068 +#, c-format +msgid "Error, duplicate EXPORT with oridinals: %s" +msgstr "Hata, orjinal hali ile EXPORT tekrarı: %s" + +#: dlltool.c:3191 +msgid "Processing definitions" +msgstr "Tanımlar iÅŸleniyor" + +#: dlltool.c:3223 +msgid "Processed definitions" +msgstr "Tanımlar iÅŸlendi" + +#. xgetext:c-format +#: dlltool.c:3234 dllwrap.c:495 +#, c-format +msgid "Usage %s \n" +msgstr "Kullanım %s \n" + +#. xgetext:c-format +#: dlltool.c:3236 +#, c-format +msgid " -m --machine Create as DLL for . [default: %s]\n" +msgstr " -m --machine için DLL olarak oluÅŸtur. [öntanımlı: %s]\n" + +#: dlltool.c:3237 +msgid " possible : arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" +msgstr " tanımlı : arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" + +#: dlltool.c:3238 +msgid " -e --output-exp Generate an export file.\n" +msgstr " -e --output-exp <çıktıadı> İhraç dosyası oluÅŸturur.\n" + +#: dlltool.c:3239 +msgid " -l --output-lib Generate an interface library.\n" +msgstr " -l --output-lib <çıktıadı> Arayüz kitaplığı oluÅŸturur.\n" + +#: dlltool.c:3240 +msgid " -a --add-indirect Add dll indirects to export file.\n" +msgstr " -a --add-indirect İhraç dosyasına dll yönlendirmelerini ekler.\n" + +#: dlltool.c:3241 +msgid " -D --dllname Name of input dll to put into interface lib.\n" +msgstr " -D --dllname Arayüz kitaplığına eklenecek girdi dll adı.\n" + +#: dlltool.c:3242 +msgid " -d --input-def Name of .def file to be read in.\n" +msgstr " -d --input-def Okunacak .def dosyasının adı.\n" + +#: dlltool.c:3243 +msgid " -z --output-def Name of .def file to be created.\n" +msgstr " -z --output-def OluÅŸturulacak .def dosyasının adı.\n" + +#: dlltool.c:3244 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols Bütün sembolleri .def'e ihraç eder\n" + +#: dlltool.c:3245 +msgid " --no-export-all-symbols Only export listed symbols\n" +msgstr " --no-export-all-symbols Yalnızca listelenmiÅŸ sembolleri ihraç eder\n" + +#: dlltool.c:3246 +msgid " --exclude-symbols Don't export \n" +msgstr " --exclude-symbols 'yi ihraç etmez\n" + +#: dlltool.c:3247 +msgid " --no-default-excludes Clear default exclude symbols\n" +msgstr " --no-default-excludes Öntanımlı ihraç edilmeyecek sembol listesini boÅŸaltır\n" + +#: dlltool.c:3248 +msgid " -b --base-file Read linker generated base file.\n" +msgstr " -b --base-file BaÄŸlayıcının oluÅŸturduÄŸu temel dosyayı okur.\n" + +#: dlltool.c:3249 +msgid " -x --no-idata4 Don't generate idata$4 section.\n" +msgstr " -x --no-idata4 idata$4 bölümü oluÅŸturmaz.\n" + +#: dlltool.c:3250 +msgid " -c --no-idata5 Don't generate idata$5 section.\n" +msgstr " -c --no-idata5 idata$5 bölümü oluÅŸturmaz.\n" + +#: dlltool.c:3251 +msgid " -U --add-underscore Add underscores to symbols in interface library.\n" +msgstr " -U --add-underscore Arayüz kitaplığındaki sembollere alt-tire ekler.\n" + +#: dlltool.c:3252 +msgid " -k --kill-at Kill @ from exported names.\n" +msgstr " -k --kill-at İhraç edilmiÅŸ isimlerden @'da öldürür.\n" + +#: dlltool.c:3253 +msgid " -A --add-stdcall-alias Add aliases without @.\n" +msgstr " -A --add-stdcall-alias Rumuzları @ içermeksizin ekler.\n" + +#: dlltool.c:3254 +msgid " -S --as Use for assembler.\n" +msgstr " -S --as Üretici olarak kullanır.\n" + +#: dlltool.c:3255 +msgid " -f --as-flags Pass to the assembler.\n" +msgstr " -f --as-flags Üreticiye i geçirir.\n" + +#: dlltool.c:3256 +msgid " -C --compat-implib Create backward compatible import library.\n" +msgstr " -C --compat-implib GeçmiÅŸe uyumlu ithal kitaplığı oluÅŸturur.\n" + +#: dlltool.c:3257 +msgid " -n --no-delete Keep temp files (repeat for extra preservation).\n" +msgstr " -n --no-delete Geçici dosyaları tutar (daha da koruyucu olması için tekrarlanabilir).\n" + +#: dlltool.c:3258 +msgid " -v --verbose Be verbose.\n" +msgstr " -v --verbose Açıklama verir.\n" + +#: dlltool.c:3259 +msgid " -V --version Display the program version.\n" +msgstr " -V --version Sürüm bilgilerini gösterir.\n" + +#: dlltool.c:3260 +msgid " -h --help Display this information.\n" +msgstr " -h --help Bu yardımı gösterir.\n" + +#: dlltool.c:3262 +msgid " -M --mcore-elf Process mcore-elf object files into .\n" +msgstr " -M --mcore-elf <çıktı_adı> mcore-elf nesne dosyalarını <çıktı_adı>'na iÅŸler.\n" + +#: dlltool.c:3263 +msgid " -L --linker Use as the linker.\n" +msgstr " -L --linker BaÄŸlayıcı olarak kullanır.\n" + +#: dlltool.c:3264 +msgid " -F --linker-flags Pass to the linker.\n" +msgstr " -F --linker-flags i baÄŸlayıcıya geçirir.\n" + +#: dlltool.c:3418 +#, c-format +msgid "Unable to open base-file: %s" +msgstr "Temel-dosyası açılamadı: %s" + +#: dlltool.c:3450 +#, c-format +msgid "Machine '%s' not supported" +msgstr "'%s' makinası desteklenmiyor" + +#: dlltool.c:3553 dllwrap.c:214 +#, c-format +msgid "Tried file: %s" +msgstr "Dosya denendi: %s" + +#: dlltool.c:3560 dllwrap.c:221 +#, c-format +msgid "Using file: %s" +msgstr "Dosya kullanılıyor: %s" + +#: dllwrap.c:308 +#, c-format +msgid "Keeping temporary base file %s" +msgstr "Geçici temel dosya %s tutuldu" + +#: dllwrap.c:310 +#, c-format +msgid "Deleting temporary base file %s" +msgstr "Geçici temel dosya %s silindi" + +#: dllwrap.c:324 +#, c-format +msgid "Keeping temporary exp file %s" +msgstr "Geçici ihraç dosyası %s tutuldu" + +#: dllwrap.c:326 +#, c-format +msgid "Deleting temporary exp file %s" +msgstr "Geçici ihraç dosyası %s silindi" + +#: dllwrap.c:339 +#, c-format +msgid "Keeping temporary def file %s" +msgstr "Geçici tanım dosyası %s tutuldu" + +#: dllwrap.c:341 +#, c-format +msgid "Deleting temporary def file %s" +msgstr "Geçici tanım dosyası %s silindi" + +#: dllwrap.c:496 +msgid " Generic options:\n" +msgstr " Genel seçenekler: \n" + +#: dllwrap.c:497 +msgid " --quiet, -q Work quietly\n" +msgstr " --quiet, -q Sessiz çalışır\n" + +#: dllwrap.c:498 +msgid " --verbose, -v Verbose\n" +msgstr " --verbose, -v Açıklamalı\n" + +#: dllwrap.c:499 +msgid " --version Print dllwrap version\n" +msgstr " --version dllwrap sürümünü yazdırır\n" + +#: dllwrap.c:500 +msgid " --implib Synonym for --output-lib\n" +msgstr " --implib <çıktı_adı> --output-lib ile eÅŸanlamlı\n" + +#: dllwrap.c:501 +#, c-format +msgid " Options for %s:\n" +msgstr " %s için seçenekler:\n" + +#: dllwrap.c:502 +msgid " --driver-name Defaults to \"gcc\"\n" +msgstr " --driver-name \"gcc\"ye öntanımlı\n" + +#: dllwrap.c:503 +msgid " --driver-flags Override default ld flags\n" +msgstr " --driver-flags Öntanımlı ld seçeneklerinin yerine geçer\n" + +#: dllwrap.c:504 +msgid " --dlltool-name Defaults to \"dlltool\"\n" +msgstr " --dlltool-name \"dlltool\"a öntanımlı\n" + +#: dllwrap.c:505 +msgid " --entry Specify alternate DLL entry point\n" +msgstr " --entry Alternatif DLL giriÅŸ noktası belirtir\n" + +#: dllwrap.c:506 +msgid " --image-base Specify image base address\n" +msgstr " --image-base İmaj temel adresini belirtir\n" + +#: dllwrap.c:507 +msgid " --target i386-cygwin32 or i386-mingw32\n" +msgstr " --target hedef makina, i386-cygwin32 veya i386-mingw32\n" + +#: dllwrap.c:508 +msgid " --dry-run Show what needs to be run\n" +msgstr " --dry-run Çalıştırılması gerekenleri gösterir\n" + +#: dllwrap.c:509 +msgid " --mno-cygwin Create Mingw DLL\n" +msgstr " --mno-cygwin Mingw DLL oluÅŸturur\n" + +#: dllwrap.c:510 +msgid " Options passed to DLLTOOL:\n" +msgstr " DLLTOOL'a geçirilen seçenekler:\n" + +#: dllwrap.c:511 +msgid " --machine \n" +msgstr " --machine \n" + +#: dllwrap.c:512 +msgid " --output-exp Generate export file.\n" +msgstr " --output-exp <çıktı_adı> İhraç dosyası oluÅŸturur.\n" + +#: dllwrap.c:513 +msgid " --output-lib Generate input library.\n" +msgstr " --output-lib <çıktı_adı> Girdi kitaplığı oluÅŸturur.\n" + +#: dllwrap.c:514 +msgid " --add-indirect Add dll indirects to export file.\n" +msgstr " --add-indirect Dll yönlendirmelerini ihraç dosyasına ekler.\n" + +#: dllwrap.c:515 +msgid " --dllname Name of input dll to put into output lib.\n" +msgstr " --dllname Çıktı kitaplığına konulacak girdi dll adı.\n" + +#: dllwrap.c:516 +msgid " --def Name input .def file\n" +msgstr " --def Girdi .def dosyası adı\n" + +#: dllwrap.c:517 +msgid " --output-def Name output .def file\n" +msgstr " --output-def Çıktı .def dosyasının adı\n" + +#: dllwrap.c:518 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols Bütün sembolleri .def'e ihraç eder\n" + +#: dllwrap.c:519 +msgid " --no-export-all-symbols Only export .drectve symbols\n" +msgstr " --no-export-all-symbols Yalnızca .drectve sembollerini ihraç eder\n" + +#: dllwrap.c:520 +msgid " --exclude-symbols Exclude from .def\n" +msgstr " --exclude-symbols deki sembolleri .def'e ihraç etmez\n" + +#: dllwrap.c:521 +msgid " --no-default-excludes Zap default exclude symbols\n" +msgstr " --no-default-excludes Dışlanacak sembol öntanımlarını boÅŸaltır\n" + +#: dllwrap.c:522 +msgid " --base-file Read linker generated base file\n" +msgstr " --base-file BaÄŸlayıcı tarafından oluÅŸturulan temel dosyayı okur\n" + +#: dllwrap.c:523 +msgid " --no-idata4 Don't generate idata$4 section\n" +msgstr " --no-idata4 idata$4 bölümünü oluÅŸturmaz\n" + +#: dllwrap.c:524 +msgid " --no-idata5 Don't generate idata$5 section\n" +msgstr " --no-idata5 idata$5 bölümünü oluÅŸturmaz\n" + +#: dllwrap.c:525 +msgid " -U Add underscores to .lib\n" +msgstr " -U .lib'e alt-tire ekler\n" + +#: dllwrap.c:526 +msgid " -k Kill @ from exported names\n" +msgstr " -k @'i ihraç edilmiÅŸ isimlerden çıkartır\n" + +#: dllwrap.c:527 +msgid " --add-stdcall-alias Add aliases without @\n" +msgstr " --add-stdcall-alias Rumuzları @ olmaksızın ekler\n" + +#: dllwrap.c:528 +msgid " --as Use for assembler\n" +msgstr " --as Üretici olarak 'i kullanır\n" + +#: dllwrap.c:529 +msgid " --nodelete Keep temp files.\n" +msgstr " --nodelete Geçici dosyaları tutar.\n" + +#: dllwrap.c:530 +msgid " Rest are passed unmodified to the language driver\n" +msgstr " Kalanlar dil sürücüsüne deÄŸiÅŸtirilmeksizin geçirilir\n" + +#: dllwrap.c:802 +msgid "Must provide at least one of -o or --dllname options" +msgstr "-o veya --dllname (dll adı) seçeneklerinin en azından bir tanesi belirtilmelidir" + +#: dllwrap.c:830 +msgid "" +"no export definition file provided.\n" +"Creating one, but that may not be what you want" +msgstr "" +"ihraç tanım dosyası verilmemiÅŸ.\n" +"Bir tane oluÅŸturuluyor fakat istediÄŸiniz bu olmayabilir" + +#: dllwrap.c:992 +#, c-format +msgid "DLLTOOL name : %s\n" +msgstr "DLLTOOL adı : %s\n" + +#: dllwrap.c:993 +#, c-format +msgid "DLLTOOL options : %s\n" +msgstr "DLLTOOL seçenekleri : %s\n" + +#: dllwrap.c:994 +#, c-format +msgid "DRIVER name : %s\n" +msgstr "SÜRÜCÜ adı : %s\n" + +#: dllwrap.c:995 +#, c-format +msgid "DRIVER options : %s\n" +msgstr "SÜRÜCÜ seçenekleri : %s\n" + +#: emul_aix.c:58 +#, c-format +msgid " [-g] - 32 bit small archive\n" +msgstr " [-g] - 32 bitlik küçük arÅŸiv\n" + +#: emul_aix.c:59 +msgid " [-X32] - ignores 64 bit objects\n" +msgstr " [-X32] - 64 bitlik nesneleri yok sayar\n" + +#: emul_aix.c:60 +msgid " [-X64] - ignores 32 bit objects\n" +msgstr " [-X64] - 32 bitlik nesneleri yok sayar\n" + +#: emul_aix.c:61 +msgid " [-X32_64] - accepts 32 and 64 bit objects\n" +msgstr " [-X32_64] - 32 ve 64 bitlik nesneleri kabul eder\n" + +#: ieee.c:326 +msgid "unexpected end of debugging information" +msgstr "hata ayıklama bilgilerinde beklenmeyen son" + +#: ieee.c:421 +msgid "invalid number" +msgstr "geçersiz sayı" + +#: ieee.c:480 +msgid "invalid string length" +msgstr "geçersiz dizge uzunluÄŸu" + +#: ieee.c:537 ieee.c:578 +msgid "expression stack overflow" +msgstr "ifade yığıtında taÅŸma" + +#: ieee.c:557 +msgid "unsupported IEEE expression operator" +msgstr "desteklenmeyen IEEE ifade iÅŸlemimi" + +#: ieee.c:572 +msgid "unknown section" +msgstr "bilinmeyen bölüm" + +#: ieee.c:593 +msgid "expression stack underflow" +msgstr "ifade yığıt taÅŸması" + +#: ieee.c:607 +msgid "expression stack mismatch" +msgstr "ifade yığıtı uyumsuzluÄŸu" + +#: ieee.c:646 +msgid "unknown builtin type" +msgstr "bilinmeyen oluÅŸumiçi tip" + +#: ieee.c:791 +msgid "BCD float type not supported" +msgstr "BCD gerçel tipi desteklenmiyor" + +#: ieee.c:937 +msgid "unexpected number" +msgstr "beklenmeyen sayı" + +#: ieee.c:944 +msgid "unexpected record type" +msgstr "beklenmeyen kayıt tipi" + +#: ieee.c:977 +msgid "blocks left on stack at end" +msgstr "yığıt üzerinde bloklar kaldı" + +#: ieee.c:1242 +msgid "unknown BB type" +msgstr "bilinmeyen BB tipi" + +#: ieee.c:1251 +msgid "stack overflow" +msgstr "yığıt taÅŸması" + +#: ieee.c:1276 +msgid "stack underflow" +msgstr "yığıt alt taÅŸması" + +#: ieee.c:1390 ieee.c:1462 ieee.c:2161 +msgid "illegal variable index" +msgstr "geçersiz deÄŸiÅŸken endeksi" + +#: ieee.c:1440 +msgid "illegal type index" +msgstr "geçersiz tip endeksi" + +#: ieee.c:1450 ieee.c:1487 +msgid "unknown TY code" +msgstr "bilinmeyen TY kodu" + +#: ieee.c:1469 +msgid "undefined variable in TY" +msgstr "TY'de tanımsız deÄŸiÅŸken" + +#. Pascal file name. FIXME. +#: ieee.c:1880 +msgid "Pascal file name not supported" +msgstr "Pascal dosya adı desteklenmiyor" + +#: ieee.c:1928 +msgid "unsupported qualifier" +msgstr "desteklenmeyen niteleyici" + +#: ieee.c:2199 +msgid "undefined variable in ATN" +msgstr "ATN'de tanımsız deÄŸiÅŸken" + +#: ieee.c:2242 +msgid "unknown ATN type" +msgstr "bilinmeyen ATN tipi" + +#. Reserved for FORTRAN common. +#: ieee.c:2364 +msgid "unsupported ATN11" +msgstr "desteklenmeyen ATN11" + +#. We have no way to record this information. FIXME. +#: ieee.c:2391 +msgid "unsupported ATN12" +msgstr "desteklenmeyen ATN12" + +#: ieee.c:2451 +msgid "unexpected string in C++ misc" +msgstr "C++ misc içinde beklenmeyen dizge" + +#: ieee.c:2464 +msgid "bad misc record" +msgstr "hatalı misc kaydı" + +#: ieee.c:2507 +msgid "unrecognized C++ misc record" +msgstr "bilinmeyen C++ misc kaydı" + +#: ieee.c:2624 +msgid "undefined C++ object" +msgstr "tanımlanmamış C++ nesnesi" + +#: ieee.c:2658 +msgid "unrecognized C++ object spec" +msgstr "bilinmeyen C++ nesne tanımı" + +#: ieee.c:2694 +msgid "unsupported C++ object type" +msgstr "desteklenmeyen C++ nesne tipi" + +#: ieee.c:2704 +msgid "C++ base class not defined" +msgstr "C++ temel sınıfı tanımlanmamış" + +#: ieee.c:2716 ieee.c:2821 +msgid "C++ object has no fields" +msgstr "C++ nesnesinde hiç alan yok" + +#: ieee.c:2735 +msgid "C++ base class not found in container" +msgstr "C++ temel sınıfı taşıyıcı içinde bulunamadı" + +#: ieee.c:2842 +msgid "C++ data member not found in container" +msgstr "C++ veri üyesi taşıyıcı içinde bulunamadı" + +#: ieee.c:2883 ieee.c:3033 +msgid "unknown C++ visibility" +msgstr "bilinmeyen C++ görünürlüğü" + +#: ieee.c:2917 +msgid "bad C++ field bit pos or size" +msgstr "hatalı C++ alan biti konum veya boyu" + +#: ieee.c:3009 +msgid "bad type for C++ method function" +msgstr "C++ yöntem iÅŸlevi için hatalı tip" + +#: ieee.c:3019 +msgid "no type information for C++ method function" +msgstr "C++ yöntem iÅŸlevi için tip bilgisi yok" + +#: ieee.c:3058 +msgid "C++ static virtual method" +msgstr "C++ statik sanal yöntem" + +#: ieee.c:3153 +msgid "unrecognized C++ object overhead spec" +msgstr "bilinmeyen C++ nesne masraf tanımı" + +#: ieee.c:3192 +msgid "undefined C++ vtable" +msgstr "tanımlanmamış C++ vtablosu" + +#: ieee.c:3263 +msgid "C++ default values not in a function" +msgstr "C++ öntanımlı deÄŸerleri iÅŸlev içerisinde deÄŸil" + +#: ieee.c:3303 +msgid "unrecognized C++ default type" +msgstr "bilinmeyen öntanımlı C++ tipi" + +#: ieee.c:3334 +msgid "reference parameter is not a pointer" +msgstr "referans parametresi imleyici deÄŸil" + +#: ieee.c:3419 +msgid "unrecognized C++ reference type" +msgstr "bilinmeyen C++ referans tipi" + +#: ieee.c:3501 +msgid "C++ reference not found" +msgstr "C++ referansı bulunamadı" + +#: ieee.c:3509 +msgid "C++ reference is not pointer" +msgstr "C++ referansı imleyici deÄŸil" + +#: ieee.c:3538 ieee.c:3546 +msgid "missing required ASN" +msgstr "Gerekli ASN yok" + +#: ieee.c:3576 ieee.c:3584 +msgid "missing required ATN65" +msgstr "Gerekli ATN65 yok" + +#: ieee.c:3598 +msgid "bad ATN65 record" +msgstr "hatalı ATN65 kaydı" + +#: ieee.c:4286 +msgid "IEEE numeric overflow: 0x" +msgstr "IEEE sayısal taÅŸma: 0x" + +#: ieee.c:4332 +#, c-format +msgid "IEEE string length overflow: %u\n" +msgstr "IEEE dizge uzunluk taÅŸması: %u\n" + +#: ieee.c:5382 +#, c-format +msgid "IEEE unsupported integer type size %u\n" +msgstr "IEEE desteklenmeyen tamsayı tip boyu %u\n" + +#: ieee.c:5418 +#, c-format +msgid "IEEE unsupported float type size %u\n" +msgstr "IEEE desteklenmeyen gerçel tip boyu %u\n" + +#: ieee.c:5454 +#, c-format +msgid "IEEE unsupported complex type size %u\n" +msgstr "IEEE desteklenmeyen karmaşık tip boyu %u\n" + +#: nlmconv.c:282 srconv.c:2043 +msgid "input and output files must be different" +msgstr "girdi ve çıktı dosyaları farklı olmalı" + +#: nlmconv.c:329 +msgid "input file named both on command line and with INPUT" +msgstr "girdi dosyası ismi hem komut satırında hem INPUT olarak verilmiÅŸ" + +#: nlmconv.c:338 +msgid "no input file" +msgstr "girdi dosyası yok" + +#: nlmconv.c:368 +msgid "no name for output file" +msgstr "çıktı dosyası için isim yok" + +#: nlmconv.c:382 +msgid "warning: input and output formats are not compatible" +msgstr "uyarı: girdi ve çıktı biçemleri uyumlu deÄŸil" + +#: nlmconv.c:411 +msgid "make .bss section" +msgstr ".bss bölümü oluÅŸtur" + +#: nlmconv.c:420 +msgid "make .nlmsections section" +msgstr ".nlmsections bölümü oluÅŸtur" + +#: nlmconv.c:422 +msgid "set .nlmsections flags" +msgstr ".nlmsections seçenekleri atar" + +#: nlmconv.c:450 +msgid "set .bss vma" +msgstr ".bss vma atar" + +#: nlmconv.c:457 +msgid "set .data size" +msgstr ".data boyu atar" + +#: nlmconv.c:637 +#, c-format +msgid "warning: symbol %s imported but not in import list" +msgstr "uyarı: %s sembolü ithal edildi ama ithal listesinde deÄŸil" + +#: nlmconv.c:657 +msgid "set start address" +msgstr "baÅŸlangıç adresini atar" + +#: nlmconv.c:706 +#, c-format +msgid "warning: START procedure %s not defined" +msgstr "uyarı: START altyordamı %s tanımsız" + +#: nlmconv.c:708 +#, c-format +msgid "warning: EXIT procedure %s not defined" +msgstr "uyarı: EXIT altyordamı %s tanımsız" + +#: nlmconv.c:710 +#, c-format +msgid "warning: CHECK procedure %s not defined" +msgstr "warning: CHECK altyordamı %s tanımsız" + +#: nlmconv.c:731 nlmconv.c:920 +msgid "custom section" +msgstr "özel bölüm" + +#: nlmconv.c:752 nlmconv.c:949 +msgid "help section" +msgstr "yardım bölümü" + +#: nlmconv.c:774 nlmconv.c:967 +msgid "message section" +msgstr "ileti bölümü" + +#: nlmconv.c:790 nlmconv.c:1000 +msgid "module section" +msgstr "modül bölümü" + +#: nlmconv.c:810 nlmconv.c:1016 +msgid "rpc section" +msgstr "rpc bölümü" + +#. There is no place to record this information. +#: nlmconv.c:846 +#, c-format +msgid "%s: warning: shared libraries can not have uninitialized data" +msgstr "%s: uyarı: paylaşımlı kitaplıklar öndeÄŸer atanmamış veri kapsayamaz" + +#: nlmconv.c:867 nlmconv.c:1035 +msgid "shared section" +msgstr "paylaşımlı bölüm" + +#: nlmconv.c:875 +msgid "warning: No version number given" +msgstr "uyarı: Sürüm numarası verilmemiÅŸ" + +#: nlmconv.c:915 nlmconv.c:944 nlmconv.c:962 nlmconv.c:1011 nlmconv.c:1030 +#, c-format +msgid "%s: read: %s" +msgstr "%s: okundu: %s" + +#: nlmconv.c:937 +msgid "warning: MAP and FULLMAP are not supported; try ld -M" +msgstr "uyarı: MAP ve FULLMAP desteklenmiyor; ld -M komutunu deneyin" + +#: nlmconv.c:1109 +#, c-format +msgid "Usage: %s [option(s)] [in-file [out-file]]\n" +msgstr "Kullanım: %s [seçenekler] [girdi-dosyası [çıktı-dosyası]]\n" + +#: nlmconv.c:1110 +msgid " Convert an object file into a NetWare Loadable Module\n" +msgstr " Bir nesne dosyasını NetWare Yüklenebilir Modül haline getirir\n" + +#: nlmconv.c:1111 +msgid "" +" The options are:\n" +" -I --input-target= Set the input binary file format\n" +" -O --output-target= Set the output binary file format\n" +" -T --header-file= Read for NLM header information\n" +" -l --linker= Use for any linking\n" +" -d --debug Display on stderr the linker command line\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +msgstr "" +" Seçenekler:\n" +" -I --input-target= Girdi ikilik dosya biçemini belirler\n" +" -O --output-target= Çıktı ikilik dosya biçemini belirler\n" +" -T --header-file= NLM baÅŸlık bilgilerini dan okur\n" +" -l --linker= BaÄŸlama iÅŸlemi için yı kullanır\n" +" -d --debug Standart hatada baÄŸlayıcı komut satırını gösterir\n" +" -h --help Bu bilgiyi gösterir\n" +" -v --version Program sürüm no'sunu gösterir\n" + +#: nlmconv.c:1153 +#, c-format +msgid "support not compiled in for %s" +msgstr "%s için destek derlenmemiÅŸ" + +#: nlmconv.c:1193 +msgid "make section" +msgstr "bölüm oluÅŸtur" + +#: nlmconv.c:1207 +msgid "set section size" +msgstr "bölüm boyu belirtir" + +#: nlmconv.c:1213 +msgid "set section alignment" +msgstr "bölüm hizalanması atar" + +#: nlmconv.c:1217 +msgid "set section flags" +msgstr "bölüm seçeneklerini atar" + +#: nlmconv.c:1228 +msgid "set .nlmsections size" +msgstr ".nlmsections boyunu atar" + +#: nlmconv.c:1316 nlmconv.c:1324 nlmconv.c:1333 nlmconv.c:1338 +msgid "set .nlmsection contents" +msgstr ".nlmsection içeriÄŸini atar" + +#: nlmconv.c:1839 +msgid "stub section sizes" +msgstr "koçan bölüm boyları" + +#: nlmconv.c:1888 +msgid "writing stub" +msgstr "koçan yazılıyor" + +#: nlmconv.c:1977 +#, c-format +msgid "unresolved PC relative reloc against %s" +msgstr "%s'e göreli PC yer deÄŸiÅŸtirme çözümlenemedi" + +#: nlmconv.c:2041 +#, c-format +msgid "overflow when adjusting relocation against %s" +msgstr "%s'e göreli yer deÄŸiÅŸtirme ayarlanırken taÅŸma oluÅŸtu" + +#: nlmconv.c:2158 +#, c-format +msgid "%s: execution of %s failed: " +msgstr "%s: %s'in çalıştırılması baÅŸarısız oldu: " + +#: nlmconv.c:2173 +#, c-format +msgid "Execution of %s failed" +msgstr "%s'in çalıştırılması baÅŸarısız oldu" + +#: nm.c:283 size.c:85 strings.c:657 +#, c-format +msgid "Usage: %s [option(s)] [file(s)]\n" +msgstr "Kullanım: %s [seçenekler] [dosya(lar)]\n" + +#: nm.c:284 +msgid " List symbols in [file(s)] (a.out by default).\n" +msgstr " [dosya(lar)]daki sembolleri listeler (öntanımlı a.out).\n" + +#: nm.c:285 +msgid "" +" The options are:\n" +" -a, --debug-syms Display debugger-only symbols\n" +" -A, --print-file-name Print name of the input file before every symbol\n" +" -B Same as --format=bsd\n" +" -C, --demangle[=STYLE] Decode low-level symbol names into user-level names\n" +" The STYLE, if specified, can be `auto' (the default),\n" +" `gnu', `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n" +" or `gnat'\n" +" --no-demangle Do not demangle low-level symbol names\n" +" -D, --dynamic Display dynamic symbols instead of normal symbols\n" +" --defined-only Display only defined symbols\n" +" -e (ignored)\n" +" -f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',\n" +" `sysv' or `posix'. The default is `bsd'\n" +" -g, --extern-only Display only external symbols\n" +" -l, --line-numbers Use debugging information to find a filename and\n" +" line number for each symbol\n" +" -n, --numeric-sort Sort symbols numerically by address\n" +" -o Same as -A\n" +" -p, --no-sort Do not sort the symbols\n" +" -P, --portability Same as --format=posix\n" +" -r, --reverse-sort Reverse the sense of the sort\n" +" -S, --print-size Print size of defined symbols\n" +" -s, --print-armap Include index for symbols from archive members\n" +" --size-sort Sort symbols by size\n" +" -t, --radix=RADIX Use RADIX for printing symbol values\n" +" --target=BFDNAME Specify the target object format as BFDNAME\n" +" -u, --undefined-only Display only undefined symbols\n" +" -X 32_64 (ignored)\n" +" -h, --help Display this information\n" +" -V, --version Display this program's version number\n" +"\n" +msgstr "" +" Seçenekler:\n" +" -a, --debug-syms Yalnızca hata ayıklamaya dair sembolleri gösterir\n" +" -A, --print-file-name Her sembolden önce girdi dosyasının adını yazdırır\n" +" -B --format=bsd ile aynı\n" +" -C, --demangle[=TARZ] Alt düzey sembol adlarını kullanıcı seviyesinde adlara çevirir\n" +" TARZ, eÄŸer belirtilirse, 'auto' (öntanımlı),\n" +" `gnu', 'lucid', 'arm', 'hp', 'edg' veya 'gnu-new-abi' olabilir\n" +" --no-demangle Alt düzey sembol adlarını çevirmez\n" +" -D, --dynamic Normal semboller yerine dinamik sembolleri gösterir\n" +" --defined-only Yalnızca tanımlanmış sembolleri gösterir\n" +" -e (yoksayılır)\n" +" -f, --format=BİÇEM Çıktı biçemi için BİÇEM'i kullanır. BİÇEM, 'bsd' (öntanımlı),\n" +" `sysv' veya `posix' olabilir\n" +" -g, --extern-only Yalnızca harici sembolleri gösterir\n" +" -l, --line-numbers Hata ayıklama bilgisini kullanarak her sembol için bir\n" +" satır numarası ve dosya adı bulur.\n" +" -n, --numeric-sort Sembolleri adres numarasına göre sıralar\n" +" -o -A ile aynı\n" +" -p, --no-sort Sembolleri sıralamaz\n" +" -P, --portability --format=posix ile aynı\n" +" -r, --reverse-sort Ters sıralar\n" +" -S, --print-size Tanımlı sembollerin boyunu gösterir\n" +" -s, --print-armap ArÅŸiv üyelerinden gelen semboller için endeks içerir\n" +" --size-sort Sembolleri büyüklüğe göre sıralar\n" +" -t, --radix=RADIX Sembol deÄŸerlerini yazdırmak için RADIX kullanır\n" +" --target=BFD_ADI Hedef nesne biçemini BFD_ADI olarak belirler\n" +" -u, --undefined-only Yalnızca tanımlanmamış sembolleri gösterir\n" +" -X 32_64 (yok sayılır)\n" +" -h, --help Bu bilgiyi gösterir\n" +" -V, --version Sürüm bilgilerini gösterir\n" +"\n" + +#: nm.c:319 objdump.c:250 +#, c-format +msgid "Report bugs to %s.\n" +msgstr "" +"Hataları %s adresine, \n" +"çeviri hatalarını adresine bildiriniz.\n" + +#: nm.c:352 +#, c-format +msgid "%s: invalid radix" +msgstr "%s: geçersiz radix" + +#: nm.c:377 +#, c-format +msgid "%s: invalid output format" +msgstr "%s: geçersiz çıktı biçemi" + +#: nm.c:494 +msgid "Only -X 32_64 is supported" +msgstr "Yalnız -X 32_64 destekleniyor" + +#: nm.c:514 +msgid "Using the --size-sort and --undefined-only options together" +msgstr "--size-sort ve --undefined-only seçenekleri beraber kullanılıyor" + +#: nm.c:515 +msgid "will produce no output, since undefined symbols have no size." +msgstr "tanımsız sembollerin boyları olmadığından çıktı üretilmeyecek." + +#: nm.c:543 +#, c-format +msgid "data size %ld" +msgstr "veri büyüklüğü %ld" + +#: nm.c:568 readelf.c:5809 readelf.c:5845 +#, c-format +msgid ": %d" +msgstr ": %d" + +#: nm.c:570 readelf.c:5811 readelf.c:5857 +#, c-format +msgid ": %d" +msgstr "<İS'e özel>: %d" + +#: nm.c:572 readelf.c:5813 readelf.c:5860 +#, c-format +msgid ": %d" +msgstr ": %d" + +#: nm.c:1376 +#, c-format +msgid "" +"\n" +"\n" +"Undefined symbols from %s:\n" +"\n" +msgstr "" +"\n" +"\n" +"%s'de tanımlanmamış semboller:\n" +"\n" + +#: nm.c:1378 +#, c-format +msgid "" +"\n" +"\n" +"Symbols from %s:\n" +"\n" +msgstr "" +"\n" +"\n" +"%s'de semboller:\n" +"\n" + +#: nm.c:1380 nm.c:1438 +msgid "" +"Name Value Class Type Size Line Section\n" +"\n" +msgstr "" +"İsim DeÄŸer Sınıf Tip Boy Satır Bölüm\n" +"\n" + +#: nm.c:1383 nm.c:1441 +msgid "" +"Name Value Class Type Size Line Section\n" +"\n" +msgstr "" +"İsim DeÄŸer Sınıf Tip Boy Satır Bölüm\n" +"\n" + +#: nm.c:1434 +#, c-format +msgid "" +"\n" +"\n" +"Undefined symbols from %s[%s]:\n" +"\n" +msgstr "" +"\n" +"\n" +"%s[%s]'de tanımlanmamış semboller:\n" +"\n" + +#: nm.c:1436 +#, c-format +msgid "" +"\n" +"\n" +"Symbols from %s[%s]:\n" +"\n" +msgstr "" +"\n" +"\n" +"%s[%s]'de semboller:\n" +"\n" + +#: nm.c:1658 +msgid "" +"\n" +"Archive index:\n" +msgstr "" +"\n" +"ArÅŸiv endeksi:\n" + +#: objcopy.c:414 srconv.c:1952 +#, c-format +msgid "Usage: %s [option(s)] in-file [out-file]\n" +msgstr "Kullanım: %s [seçenekler] girdi-dosyası [çıktı-dosyası]\n" + +#: objcopy.c:415 +msgid " Copies a binary file, possibly transforming it in the process\n" +msgstr " İkilik dosyayı, muhtemelen deÄŸiÅŸtirerek kopyalar\n" + +#: objcopy.c:416 objcopy.c:495 +msgid " The options are:\n" +msgstr " Seçenekler:\n" + +#: objcopy.c:417 +msgid "" +" -I --input-target Assume input file is in format \n" +" -O --output-target Create an output file in format \n" +" -B --binary-architecture Set arch of output file, when input is binary\n" +" -F --target Set both input and output format to \n" +" --debugging Convert debugging information, if possible\n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -j --only-section Only copy section into the output\n" +" --add-gnu-debuglink= Add section .gnu_debuglink linking to \n" +" -R --remove-section Remove section from the output\n" +" -S --strip-all Remove all symbol and relocation information\n" +" -g --strip-debug Remove all debugging symbols & sections\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol Do not copy symbol \n" +" -K --keep-symbol Only copy symbol \n" +" -L --localize-symbol Force symbol to be marked as a local\n" +" -G --keep-global-symbol Localize all symbols except \n" +" -W --weaken-symbol Force symbol to be marked as a weak\n" +" --weaken Force all global symbols to be marked as weak\n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -i --interleave Only copy one out of every bytes\n" +" -b --byte Select byte in every interleaved block\n" +" --gap-fill Fill gaps between sections with \n" +" --pad-to Pad the last section up to address \n" +" --set-start Set the start address to \n" +" {--change-start|--adjust-start} \n" +" Add to the start address\n" +" {--change-addresses|--adjust-vma} \n" +" Add to LMA, VMA and start addresses\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" Change LMA and VMA of section by \n" +" --change-section-lma {=|+|-}\n" +" Change the LMA of section by \n" +" --change-section-vma {=|+|-}\n" +" Change the VMA of section by \n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" Warn if a named section does not exist\n" +" --set-section-flags =\n" +" Set section 's properties to \n" +" --add-section = Add section found in to output\n" +" --rename-section =[,] Rename section to \n" +" --change-leading-char Force output format's leading character style\n" +" --remove-leading-char Remove leading character from global symbols\n" +" --redefine-sym = Redefine symbol name to \n" +" --redefine-syms --redefine-sym for all symbol pairs \n" +" listed in \n" +" --srec-len Restrict the length of generated Srecords\n" +" --srec-forceS3 Restrict the type of generated Srecords to S3\n" +" --strip-symbols -N for all symbols listed in \n" +" --keep-symbols -K for all symbols listed in \n" +" --localize-symbols -L for all symbols listed in \n" +" --keep-global-symbols -G for all symbols listed in \n" +" --weaken-symbols -W for all symbols listed in \n" +" --alt-machine-code Use alternate machine code for output\n" +" --prefix-symbols Add to start of every symbol name\n" +" --prefix-sections Add to start of every section name\n" +" --prefix-alloc-sections \n" +" Add to start of every allocatable\n" +" section name\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +" --info List object formats & architectures supported\n" +msgstr "" +" -I --input-target Girdi dosyasının biçeminde\n" +" olduÄŸunu varsayar\n" +" -O --output-target Çıktı dosyasını biçeminde\n" +" oluÅŸturur\n" +" -B --binary-architecture Girdi ikilik biçeminde olduÄŸu zaman çıktı\n" +" dosyasının platformunu belirler.\n" +" -F --target Hem girdi, hem de çıktı biçemini \n" +" olarak atar\n" +" --debugging Mümkün olduÄŸu kadar hata ayıklama\n" +" bilgisini dönüştürür\n" +" -p --preserve-dates Çıktıya deÄŸiÅŸim/eriÅŸim zaman damgalarını\n" +" kopyalar\n" +" -j --only-section Çıktıya yalnızca bölümünü kopyalar\n" +" --add-gnu-debuglink=....gnu_debuglink bölümünü 'ya ekler\n" +" -R --remove-section Çıktıdan bölümünü çıkarır\n" +" -S --strip-all Bütün sembol ve yer deÄŸiÅŸtirme bilgisini\n" +" siler\n" +" -g --strip-debug Bütün hata ayıklama sembollerini siler\n" +" --strip-unneeded Yer deÄŸiÅŸtirmeler için gerekmeyen bütün\n" +" sembolleri siler\n" +" -N --strip-symbol sembolünü kopyalamaz\n" +" -K --keep-symbol Yalnızca sembolünü kopyalar\n" +" -L --localize-symbol sembolünün yerel olarak\n" +" tanımlanmasını saÄŸlar\n" +" -G --keep-global-symbol haricindeki bütün sembolleri\n" +" yerelleÅŸtirir.\n" +" -W --weaken-symbol sembolünün zayıf olarak\n" +" tanımlanmasını saÄŸlar\n" +" --weaken Bütün evrensel sembollerin zayıf olarak\n" +" tanımlanmasını saÄŸlar\n" +" -x --discard-all Evrensel olmayan bütün sembolleri siler\n" +" -X --discard-locals Derleyici tarafından oluÅŸturulan bütün\n" +" sembolleri siler\n" +" -i --interleave Her bayttan yalnız birini kopyalar\n" +" -b --byte Her serpiÅŸtirilmiÅŸ bloktan numaralı\n" +" baytı seçer\n" +" --gap-fill Bölümler arası boÅŸlukları ile\n" +" doldurur\n" +" --pad-to Son bölümü e kadar boÅŸlukla doldurur\n" +" --set-start BaÅŸlangıç adresini olarak belirtir\n" +" {--change-start|--adjust-start} \n" +" BaÅŸlangıç adresine ekler\n" +" {--change-addresses|--adjust-vma} \n" +" LMA, VMA ve baÅŸlangıç adreslerine \n" +" ekler\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" bölümünün LMA ve VMA'sını \n" +" kadar deÄŸiÅŸtirir\n" +" --change-section-lma {=|+|-}\n" +" bölümünün LMA'sını kadar\n" +" deÄŸiÅŸtirir\n" +" --change-section-vma {=|+|-}\n" +" bölümünün VMA'sını kadar\n" +" deÄŸiÅŸtirir\n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" EÄŸer isimli bir bölüm yok ise uyarı verir\n" +" --set-section-flags =\n" +" bölümünün özniteliklerini\n" +" e ayarlar\n" +" --add-section = içinde bulunan bölümünü\n" +" çıktıya ekler\n" +" --rename-section =[,] bölümünü olarak\n" +" yeniden adlandırır\n" +" --change-leading-char Çıktı biçeminin baÅŸlangıç karakter tipini\n" +" deÄŸiÅŸtirir\n" +" --remove-leading-char Evrensel sembollerden baÅŸlangıç\n" +" karakterini çıkarır\n" +" --redefine-sym = isimli sembolü isimli olarak\n" +" yeniden tanımlar\n" +" --redefine-syms içinde tanımlı bütün sembol\n" +" çiftleri için --redefine-sym uygular\n" +" --srec-len OluÅŸturulan S kayıtlarının boyutunu\n" +" kısıtlar\n" +" --srec-forceS3 OluÅŸturulan S kayıtları tipini S3 olarak\n" +" kısıtlar\n" +" --strip-symbols daki bütün semboller için -N uygular\n" +" --keep-symbols daki bütün semboller için -K uygular\n" +" --localize-symbols daki bütün semboller için -L uygular\n" +" --keep-global-symbols daki bütün semboller için -G uygular\n" +" --weaken-symbols daki bütün semboller için -W uygular\n" +" --alt-machine-code Çıktı için alternatif makina kodu kullanır\n" +" --prefix-symbols <önek> Her sembol adına <önek> ekler\n" +" --prefix-sections <önek> Her bölüm adına <önek> ekler\n" +" --prefix-alloc-sections <önek>\n" +" Her ayrılabilir bölüm adına <önek> ekler\n" +" -v --verbose DeÄŸiÅŸtirilen tüm nesne dosyalarını listeler\n" +" -V --version Bu yazılımın sürüm bilgilerini gösterir\n" +" -h --help Bu çıktıyı gösterir\n" +" --info Desteklenen nesne biçemlerini ve mimarileri\n" +" gösterir\n" + +#: objcopy.c:493 +#, c-format +msgid "Usage: %s in-file(s)\n" +msgstr "Kullanım: %s girdi-dosya(ları)\n" + +#: objcopy.c:494 +msgid " Removes symbols and sections from files\n" +msgstr " Dosyalardan sembol ve bölümleri çıkarır\n" + +#: objcopy.c:496 +msgid "" +" -I --input-target= Assume input file is in format \n" +" -O --output-target= Create an output file in format \n" +" -F --target= Set both input and output format to \n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -R --remove-section= Remove section from the output\n" +" -s --strip-all Remove all symbol and relocation information\n" +" -g -S -d --strip-debug Remove all debugging symbols & sections\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol= Do not copy symbol \n" +" -K --keep-symbol= Only copy symbol \n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +" --info List object formats & architectures supported\n" +" -o Place stripped output into \n" +msgstr "" +" -I --input-target= Girdi dosyasının biçeminde \n" +" olduÄŸunu varsayar\n" +" -O --output-target= Çıktı dosyasını biçeminde \n" +" oluÅŸturur\n" +" -F --target= Girdi ve çıktı biçemlerini olarak\n" +" atar\n" +" -p --preserve-dates Çıktıya deÄŸiÅŸim/eriÅŸim zaman damgalarını \n" +" kopyalar\n" +" -R --remove-section= Çıktıdan bölümünü çıkarır\n" +" -s --strip-all Bütün sembol ve yer deÄŸiÅŸtirme bilgisini\n" +" siler\n" +" -g -S -d --strip-debug Bütün hata ayıklama sembollerini ve\n" +" bölümlerini siler\n" +" --strip-unneeded Yer deÄŸiÅŸtirmeler için gerekmeyen bütün\n" +" sembolleri siler\n" +" -N --strip-symbol= sembolünü kopyalamaz\n" +" -K --keep-symbol= Yalnızca sembolünü kopyalar\n" +" -x --discard-all Evrensel olmayan bütün sembolleri siler\n" +" -X --discard-locals Derleyici tarafından oluÅŸturulan bütün\n" +" sembolleri siler\n" +" -v --verbose DeÄŸiÅŸtirilen tüm nesne dosyalarını listeler\n" +" -V --version Bu yazılımın sürüm bilgilerini gösterir\n" +" -h --help Bu çıktıyı gösterir\n" +" --info Desteklenen nesne biçemlerini ve\n" +" mimarileri gösterir\n" +" -o Sembolleri silinmiÅŸ çıktıyı ya \n" +" yerleÅŸtirir\n" + +#: objcopy.c:567 +#, c-format +msgid "unrecognized section flag `%s'" +msgstr "bilinmeyen bölüm seçeneÄŸi `%s'" + +#: objcopy.c:568 +#, c-format +msgid "supported flags: %s" +msgstr "desteklenen seçenekler: %s" + +#: objcopy.c:645 objcopy.c:2526 +#, c-format +msgid "cannot stat: %s: %s" +msgstr "durumlanamadı: %s: %s" + +#: objcopy.c:652 objcopy.c:2544 +#, c-format +msgid "cannot open: %s: %s" +msgstr "açılamadı: %s: %s" + +#: objcopy.c:655 objcopy.c:2548 +#, c-format +msgid "%s: fread failed" +msgstr "%s: fread baÅŸarısız" + +#: objcopy.c:728 +#, c-format +msgid "Ignoring rubbish found on line %d of %s" +msgstr "%2$s içinde %1$d satırında bulunan bozukluk yoksayıldı" + +#: objcopy.c:979 +#, c-format +msgid "%s: Multiple redefinition of symbol \"%s\"" +msgstr "%s: \"%s\" sembolü tekrar tanımlanmış" + +#: objcopy.c:983 +#, c-format +msgid "%s: Symbol \"%s\" is target of more than one redefinition" +msgstr "%s: \"%s\" sembolü birden fazla yeniden tanımlamanın hedefi" + +#: objcopy.c:1010 +#, c-format +msgid "couldn't open symbol redefinition file %s (error: %s)" +msgstr "sembol yeniden tanımlama dosyası %s açılamadı (hata: %s)" + +#: objcopy.c:1088 +#, c-format +msgid "%s: garbage at end of line %d" +msgstr "%s: %d satırının sonu bozuk" + +#: objcopy.c:1091 +#, c-format +msgid "%s: missing new symbol name at line %d" +msgstr "%s: %d satırında yeni sembol adı eksik" + +#: objcopy.c:1101 +#, c-format +msgid "%s: premature end of file at line %d" +msgstr "%s: %d satırında erken sonlanmış dosya" + +#: objcopy.c:1147 +msgid "Unable to change endianness of input file(s)" +msgstr "Girdi dosyanın küçük/büyük sonluluÄŸu deÄŸiÅŸtirilemedi" + +#: objcopy.c:1155 +#, c-format +msgid "copy from %s(%s) to %s(%s)\n" +msgstr "%s(%s)'dan %s(%s)'a kopyalar\n" + +#: objcopy.c:1182 +#, c-format +msgid "Warning: Output file cannot represent architecture %s" +msgstr "Uyarı: Çıktı dosyası %s mimarisini temsil edemez" + +#: objcopy.c:1211 +#, c-format +msgid "can't create section `%s': %s" +msgstr "`%s' bölümü oluÅŸturulamadı: %s" + +#: objcopy.c:1304 +#, c-format +msgid "Can't fill gap after %s: %s" +msgstr "%s'den sonraki boÅŸluk doldurulamadı: %s" + +#: objcopy.c:1329 +#, c-format +msgid "Can't add padding to %s: %s" +msgstr "%s'ye dolgu eklenemedi: %s" + +#: objcopy.c:1485 +#, c-format +msgid "%s: error copying private BFD data: %s" +msgstr "%s: özel BFD verisi kopyalanırken hata: %s" + +#: objcopy.c:1498 +msgid "unknown alternate machine code, ignored" +msgstr "bilinmeyen alternatif makina kodu, yoksayıldı" + +#: objcopy.c:1531 objcopy.c:1561 +#, c-format +msgid "cannot mkdir %s for archive copying (error: %s)" +msgstr "arÅŸiv kopyalaması için mkdir %s baÅŸarılı olamadı (hata: %s)" + +#: objcopy.c:1749 +#, c-format +msgid "Multiple renames of section %s" +msgstr "%s bölümünde birden fazla yeniden isimleme" + +#: objcopy.c:1840 +msgid "making" +msgstr "oluÅŸturuluyor" + +#: objcopy.c:1849 +msgid "size" +msgstr "boyut" + +#: objcopy.c:1863 +msgid "vma" +msgstr "vma" + +#: objcopy.c:1888 +msgid "alignment" +msgstr "hizalama" + +#: objcopy.c:1896 +msgid "flags" +msgstr "seçenekler" + +#: objcopy.c:1918 +msgid "private data" +msgstr "özel veri" + +#: objcopy.c:1926 +#, c-format +msgid "%s: section `%s': error in %s: %s" +msgstr "%s: bölüm `%s': %s'da hata: %s" + +#: objcopy.c:2199 +#, c-format +msgid "%s: can't create debugging section: %s" +msgstr "%s: hata ayıklama bölümü oluÅŸturulamadı: %s" + +#: objcopy.c:2214 +#, c-format +msgid "%s: can't set debugging section contents: %s" +msgstr "%s: hata ayıklama bölüm içeriÄŸi atanamadı: %s" + +#: objcopy.c:2223 +#, c-format +msgid "%s: don't know how to write debugging information for %s" +msgstr "%s: %s için hata ayıklama bilgisinin nasıl yazılacağı bilinmiyor" + +#: objcopy.c:2346 +#, c-format +msgid "%s: cannot stat: %s" +msgstr "%s: durumlanamadı: %s" + +#: objcopy.c:2400 +msgid "byte number must be non-negative" +msgstr "bayt numarası negatif olmamalı" + +#: objcopy.c:2410 +msgid "interleave must be positive" +msgstr "serpiÅŸtirme pozitif olmalı" + +#: objcopy.c:2430 objcopy.c:2438 +#, c-format +msgid "%s both copied and removed" +msgstr "%s hem kopyalandı hem silindi" + +#: objcopy.c:2523 objcopy.c:2593 objcopy.c:2693 objcopy.c:2724 objcopy.c:2748 +#: objcopy.c:2752 objcopy.c:2772 +#, c-format +msgid "bad format for %s" +msgstr "%s için hatalı biçem" + +#: objcopy.c:2662 +#, c-format +msgid "Warning: truncating gap-fill from 0x%s to 0x%x" +msgstr "Uyarı: dolgu, 0x%s'dan 0x%x'ya kırpıldı" + +#: objcopy.c:2818 +msgid "alternate machine code index must be positive" +msgstr "alternatif makina kodu indeksi pozitif olmalı" + +#: objcopy.c:2856 +msgid "byte number must be less than interleave" +msgstr "bayt numarası serpiÅŸtirmeden daha küçük olmalı" + +#: objcopy.c:2883 +#, c-format +msgid "architecture %s unknown" +msgstr "%s platformu bilinmiyor" + +#: objcopy.c:2887 +msgid "Warning: input target 'binary' required for binary architecture parameter." +msgstr "Uyarı: ikilik platform parametresi için ikilik (`binary') girdi hedefi gerekli." + +#: objcopy.c:2888 +#, c-format +msgid " Argument %s ignored" +msgstr " %s argümanı yoksayıldı" + +#: objcopy.c:2894 +#, c-format +msgid "Cannot stat: %s: %s" +msgstr "Durumlanamadı: %s: %s" + +#: objcopy.c:2934 objcopy.c:2948 +#, c-format +msgid "%s %s%c0x%s never used" +msgstr "%s %s%c0x%s hiç kullanılmadı" + +#: objdump.c:197 +#, c-format +msgid "Usage: %s \n" +msgstr "Kullanım: %s \n" + +#: objdump.c:198 +msgid " Display information from object .\n" +msgstr "Nesne 'sından bilgi gösterir.\n" + +#: objdump.c:199 +msgid " At least one of the following switches must be given:\n" +msgstr " En azından aÅŸağıdaki seçeneklerin biri verilmelidir:\n" + +#: objdump.c:200 +msgid "" +" -a, --archive-headers Display archive header information\n" +" -f, --file-headers Display the contents of the overall file header\n" +" -p, --private-headers Display object format specific file header contents\n" +" -h, --[section-]headers Display the contents of the section headers\n" +" -x, --all-headers Display the contents of all headers\n" +" -d, --disassemble Display assembler contents of executable sections\n" +" -D, --disassemble-all Display assembler contents of all sections\n" +" -S, --source Intermix source code with disassembly\n" +" -s, --full-contents Display the full contents of all sections requested\n" +" -g, --debugging Display debug information in object file\n" +" -G, --stabs Display (in raw form) any STABS info in the file\n" +" -t, --syms Display the contents of the symbol table(s)\n" +" -T, --dynamic-syms Display the contents of the dynamic symbol table\n" +" -r, --reloc Display the relocation entries in the file\n" +" -R, --dynamic-reloc Display the dynamic relocation entries in the file\n" +" -v, --version Display this program's version number\n" +" -i, --info List object formats and architectures supported\n" +" -H, --help Display this information\n" +msgstr "" +" -a, --archive-headers ArÅŸiv baÅŸlık bilgilerini gösterir\n" +" -f, --file-headers Dosya baÅŸlık bilgilerini gösterir\n" +" -p, --private-headers Nesne biçemine özgü dosya baÅŸlık bilgilerini gösterir\n" +" -h, --[section-]headers Bölüm baÅŸlıklarını gösterir\n" +" -x, --all-headers Bütün baÅŸlıkları gösterir\n" +" -d, --disassemble Uygulama bölümlerinin üretici içeriÄŸini gösterir\n" +" -D, --disassemble-all Bütün bölümlerin üretici içeriklerini gösterir\n" +" -S, --source Üretici içerikleri ile kaynak kodunu bir arada gösterir\n" +" -s, --full-contents İstenen bütün bölümlerin bütün içeriÄŸini gösterir\n" +" -g, --debugging Nesne dosyasındaki hata ayıklama bilgilerini gösterir\n" +" -G, --stabs Dosyadaki STABS bilgisini (ham hali ile) gösterir\n" +" -t, --syms Sembol tablolarının içeriÄŸini gösterir\n" +" -T, --dynamic-syms Dinamik sembol tablolarının içeriÄŸini gösterir\n" +" -r, --reloc Dosyadaki yer deÄŸiÅŸtirme girdilerini gösterir\n" +" -R, --dynamic-reloc Dosyadaki dinamik yer deÄŸiÅŸtirme bilgilerini gösterir\n" +" -V, --version Bu yazılımın sürüm bilgilerini gösterir\n" +" -i, --info Desteklenen biçem ve mimarileri gösterir\n" +" -H, --help Bu bilgiyi gösterir\n" + +#: objdump.c:222 +msgid "" +"\n" +" The following switches are optional:\n" +msgstr "" +"\n" +" AÅŸağıdaki seçenekler isteÄŸe baÄŸlı:\n" + +#: objdump.c:223 +msgid "" +" -b, --target=BFDNAME Specify the target object format as BFDNAME\n" +" -m, --architecture=MACHINE Specify the target architecture as MACHINE\n" +" -j, --section=NAME Only display information for section NAME\n" +" -M, --disassembler-options=OPT Pass text OPT on to the disassembler\n" +" -EB --endian=big Assume big endian format when disassembling\n" +" -EL --endian=little Assume little endian format when disassembling\n" +" --file-start-context Include context from start of file (with -S)\n" +" -l, --line-numbers Include line numbers and filenames in output\n" +" -C, --demangle[=STYLE] Decode mangled/processed symbol names\n" +" The STYLE, if specified, can be `auto', `gnu',\n" +" `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n" +" or `gnat'\n" +" -w, --wide Format output for more than 80 columns\n" +" -z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling\n" +" --start-address=ADDR Only process data whose address is >= ADDR\n" +" --stop-address=ADDR Only process data whose address is <= ADDR\n" +" --prefix-addresses Print complete address alongside disassembly\n" +" --[no-]show-raw-insn Display hex alongside symbolic disassembly\n" +" --adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n" +"\n" +msgstr "" +" -b, --target=BFD_ADI Hedef nesne biçemini BFD_ADI olarak belirtir\n" +" -m, --architecture=MAKİNA Hedef mimariyi MAKİNA olarak belirtir\n" +" -j, --section=İSİM Yalnızca İSİM bölümü için bilgi gösterir\n" +" -M, --disassembler-options=SEÇ Karşıt-çeviriciye metin SEÇeneklerini geçirir\n" +" -EB --endian=big Karşıt-çevirim esnasında big-endian biçemini\n" +" varsayar\n" +" -EL --endian=little Karşıt-çevirim esnasında little-endian\n" +" biçemini varsayar\n" +" --file-start-context Dosyanın baÅŸlangıcından itibaren baÄŸlamı\n" +" içerir (-S ile)\n" +" -l, --line-numbers Çıktıda dosya isimleri ve satır numaraları\n" +" gösterir\n" +" -C, --demangle[=TARZ] Karıştırılmış/iÅŸlenmiÅŸ sembol isimlerini\n" +" çözümler.\n" +" Tarz, eÄŸer belirtilmiÅŸse, `auto', 'gnu',\n" +" 'lucid', 'arm', 'hp', 'edg', 'gnu-v3', \n" +" 'java' veya 'gnat' olabilir\n" +" -w, --wide Çıktıyı 80 sütundan daha geniÅŸ olarak biçemler\n" +" -z, --disassemble-zeroes Karşıt-çevirim esnasında sıfır bloklarını \n" +" atlamaz\n" +" --start-address=ADRES Yalnızca adresi >= ADRES olan verileri iÅŸler\n" +" --stop-address=ADRES Yalnızca adresi <= ADRES olan verileri iÅŸler\n" +" --prefix-addresses Tam adresi karşıt çevirim ile birlikte\n" +" yazdırır\n" +" --[no-]show-raw-insn Onaltılık bilgi ile sembolik karşıt-çevrimi\n" +" birlikte yazdırır\n" +" --adjust-vma=BASAMAK Bütün gösterilen bölüm adreslerine BASAMAK \n" +" ekler\n" +"\n" + +#: objdump.c:391 +msgid "Sections:\n" +msgstr "Bölümler:\n" + +#: objdump.c:394 objdump.c:398 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "Idx Adı Boy VMA LMA Dosya of Hiza" + +#: objdump.c:400 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "Idx Adı Boy VMA LMA Dosya of Hiza" + +#: objdump.c:404 +msgid " Flags" +msgstr " Seçenekler" + +#: objdump.c:406 +msgid " Pg" +msgstr " Pg" + +#: objdump.c:451 +#, c-format +msgid "%s: not a dynamic object" +msgstr "%s: dinamik nesne deÄŸil" + +#: objdump.c:1144 +msgid "Out of virtual memory" +msgstr "Sanal bellek tükendi" + +#: objdump.c:1574 +#, c-format +msgid "Can't use supplied machine %s" +msgstr "Verilen makina %s kullanılamadı" + +#: objdump.c:1592 +#, c-format +msgid "Can't disassemble for architecture %s\n" +msgstr "%s mimarisi için karşıt çevirim yapılamadı\n" + +#: objdump.c:1682 +#, c-format +msgid "Disassembly of section %s:\n" +msgstr "%s bölümünün karşıt çevrimi:\n" + +#: objdump.c:1847 +#, c-format +msgid "" +"No %s section present\n" +"\n" +msgstr "" +"%s bölümü yok\n" +"\n" + +#: objdump.c:1854 +#, c-format +msgid "%s has no %s section" +msgstr "%s %s bölümü yok" + +#: objdump.c:1868 +#, c-format +msgid "Reading %s section of %s failed: %s" +msgstr "%2$s'nin %1$s bölümünün okunması baÅŸarısız: %3$s" + +#: objdump.c:1880 +#, c-format +msgid "Reading %s section of %s failed: %s\n" +msgstr "%2$s'nin %1$s bölümünün okunması baÅŸarısız: %3$s\n" + +#: objdump.c:1923 +#, c-format +msgid "" +"Contents of %s section:\n" +"\n" +msgstr "" +"%s bölümünün içeriÄŸi:\n" +"\n" + +#: objdump.c:2021 +#, c-format +msgid "architecture: %s, " +msgstr "mimari: %s," + +#: objdump.c:2024 +#, c-format +msgid "flags 0x%08x:\n" +msgstr "seçenekler 0x%08x:\n" + +#: objdump.c:2038 +msgid "" +"\n" +"start address 0x" +msgstr "" +"\n" +"baÅŸlangıç adresi 0x" + +#: objdump.c:2071 +#, c-format +msgid "" +"\n" +"%s: file format %s\n" +msgstr "" +"\n" +"%s: %s dosya biçemi\n" + +#: objdump.c:2111 +#, c-format +msgid "%s: printing debugging information failed" +msgstr "%s: hata ayıklama bilgisinin yazdırılması baÅŸarısız" + +#: objdump.c:2190 +#, c-format +msgid "In archive %s:\n" +msgstr "%s arÅŸivi içinde:\n" + +#: objdump.c:2249 +#, c-format +msgid "Contents of section %s:\n" +msgstr "%s bölümünün içeriÄŸi:\n" + +#: objdump.c:2369 +msgid "no symbols\n" +msgstr "sembol yok\n" + +#: objdump.c:2718 +msgid "unrecognized -E option" +msgstr "tanınmayan -E seçeneÄŸi" + +#: objdump.c:2729 +#, c-format +msgid "unrecognized --endian type `%s'" +msgstr "tanınmayan --endian tipi `%s'" + +#: rdcoff.c:206 +#, c-format +msgid "parse_coff_type: Bad type code 0x%x" +msgstr "parse_coff_type: Kötü tip kodu 0x%x" + +#: rdcoff.c:424 rdcoff.c:532 rdcoff.c:731 +#, c-format +msgid "bfd_coff_get_syment failed: %s" +msgstr "bfd_coff_get_syment baÅŸarısız: %s" + +#: rdcoff.c:440 rdcoff.c:751 +#, c-format +msgid "bfd_coff_get_auxent failed: %s" +msgstr "bfd_coff_get_auxent baÅŸarısız: %s" + +#: rdcoff.c:818 +#, c-format +msgid "%ld: .bf without preceding function" +msgstr "%ld: öncesinde iÅŸlev olmadan .bf" + +#: rdcoff.c:868 +#, c-format +msgid "%ld: unexpected .ef\n" +msgstr "%ld: beklenmeyen .ef\n" + +#: rddbg.c:91 +#, c-format +msgid "%s: no recognized debugging information" +msgstr "%s: tanınan hata ayıklama bilgisi yok" + +#: rddbg.c:415 +msgid "Last stabs entries before error:\n" +msgstr "Hata öncesi son stabs girdileri:\n" + +#: readelf.c:455 +#, c-format +msgid "%s: Error: " +msgstr "%s: Hata: " + +#: readelf.c:466 +#, c-format +msgid "%s: Warning: " +msgstr "%s: Uyarı: " + +#: readelf.c:488 +#, c-format +msgid "Unable to seek to 0x%x for %s\n" +msgstr "%2$s için 0x%1$x'e kadar arama yapılamadı\n" + +#: readelf.c:499 +#, c-format +msgid "Out of memory allocating 0x%x bytes for %s\n" +msgstr "%2$s için 0x%1$x bayt ayrılırken bellek tükendi\n" + +#: readelf.c:507 +#, c-format +msgid "Unable to read in 0x%x bytes of %s\n" +msgstr "%2$s'in 0x%1$x baytı okunamadı\n" + +#: readelf.c:560 readelf.c:614 readelf.c:798 readelf.c:833 +#, c-format +msgid "Unhandled data length: %d\n" +msgstr "Desteklenmeyen veri uzunluÄŸu: %d\n" + +#: readelf.c:924 +msgid "Don't know about relocations on this machine architecture\n" +msgstr "Bu makina mimarisi üzerinde yer deÄŸiÅŸtirmeler konusunda bilgi yok\n" + +#: readelf.c:946 readelf.c:975 readelf.c:1021 readelf.c:1049 +msgid "relocs" +msgstr "yerdeÄŸiÅŸimler" + +#: readelf.c:957 readelf.c:986 readelf.c:1031 readelf.c:1059 +msgid "out of memory parsing relocs" +msgstr "yer deÄŸiÅŸtirmeleri tararken bellek tükendi" + +#: readelf.c:1112 +msgid " Offset Info Type Sym. Value Symbol's Name + Addend\n" +msgstr " Görece Bilgi Tür Sembol DeÄŸeri Sembol Adı + Sonekleme\n" + +#: readelf.c:1114 +msgid " Offset Info Type Sym.Value Sym. Name + Addend\n" +msgstr " Görece Bilgi Tür Sembol DeÄŸeri Sembol Adı + Sonekleme\n" + +#: readelf.c:1119 +msgid " Offset Info Type Sym. Value Symbol's Name\n" +msgstr " Görece Bilgi Tür Sembol DeÄŸeri Sembol Adı\n" + +#: readelf.c:1121 +msgid " Offset Info Type Sym.Value Sym. Name\n" +msgstr " Görece Bilgi Tür Sembol DeÄŸeri Sembol Adı\n" + +#: readelf.c:1129 +msgid " Offset Info Type Symbol's Value Symbol's Name + Addend\n" +msgstr " Görece Bilgi Tür Sembol DeÄŸeri Sembol Adı + Sonek\n" + +#: readelf.c:1131 +msgid " Offset Info Type Sym. Value Sym. Name + Addend\n" +msgstr " Görece Bilgi Tür Sembol DeÄŸeri Sembol Adı + Sonekleme\n" + +#: readelf.c:1136 +msgid " Offset Info Type Symbol's Value Symbol's Name\n" +msgstr " Görece Bilgi Tür Sembol DeÄŸeri Sembol Adı\n" + +#: readelf.c:1138 +msgid " Offset Info Type Sym. Value Sym. Name\n" +msgstr " Görece Bilgi Tür Sembol DeÄŸeri Sembol Adı\n" + +#: readelf.c:1414 readelf.c:1416 readelf.c:1492 readelf.c:1494 readelf.c:1503 +#: readelf.c:1505 +#, c-format +msgid "unrecognized: %-7lx" +msgstr "bilinmeyen: %-7lx" + +#: readelf.c:1466 +#, c-format +msgid "" +msgstr "" + +#: readelf.c:1743 +#, c-format +msgid "Processor Specific: %lx" +msgstr "İşlemciye Özel: %lx" + +#: readelf.c:1762 +#, c-format +msgid "Operating System specific: %lx" +msgstr "İşletim Sistemine Özel: %lx" + +#: readelf.c:1765 readelf.c:2417 +#, c-format +msgid ": %lx" +msgstr ": %lx" + +#: readelf.c:1779 +msgid "NONE (None)" +msgstr "HİÇBİRİ (Hiçbiri)" + +#: readelf.c:1780 +msgid "REL (Relocatable file)" +msgstr "YER (Yer deÄŸiÅŸtirebilen dosya)" + +#: readelf.c:1781 +msgid "EXEC (Executable file)" +msgstr "UYGU (Uygulama dosyası)" + +#: readelf.c:1782 +msgid "DYN (Shared object file)" +msgstr "DİN (Paylaşımlı nesne dosyası)" + +#: readelf.c:1783 +msgid "CORE (Core file)" +msgstr "CORE (Core dosyası)" + +#: readelf.c:1787 +#, c-format +msgid "Processor Specific: (%x)" +msgstr "İşlemciye Özel: (%x)" + +#: readelf.c:1789 +#, c-format +msgid "OS Specific: (%x)" +msgstr "İşletim Sistemine Özel: (%x)" + +#: readelf.c:1791 readelf.c:1898 readelf.c:2574 +#, c-format +msgid ": %x" +msgstr ": %x" + +#: readelf.c:1804 +msgid "None" +msgstr "Hiçbiri" + +#: readelf.c:2616 +msgid "Usage: readelf elf-file(s)\n" +msgstr "Kullanım: readelf elf-dosya(ları)\n" + +#: readelf.c:2617 +msgid " Display information about the contents of ELF format files\n" +msgstr " ELF biçem dosyalarının içeriÄŸi hakkında bilgi gösterir\n" + +#: readelf.c:2618 +msgid "" +" Options are:\n" +" -a --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" +" -h --file-header Display the ELF file header\n" +" -l --program-headers Display the program headers\n" +" --segments An alias for --program-headers\n" +" -S --section-headers Display the sections' header\n" +" --sections An alias for --section-headers\n" +" -e --headers Equivalent to: -h -l -S\n" +" -s --syms Display the symbol table\n" +" --symbols An alias for --syms\n" +" -n --notes Display the core notes (if present)\n" +" -r --relocs Display the relocations (if present)\n" +" -u --unwind Display the unwind info (if present)\n" +" -d --dynamic Display the dynamic segment (if present)\n" +" -V --version-info Display the version sections (if present)\n" +" -A --arch-specific Display architecture specific information (if any).\n" +" -D --use-dynamic Use the dynamic section info when displaying symbols\n" +" -x --hex-dump= Dump the contents of section \n" +" -w[liaprmfFso] or\n" +" --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n" +" Display the contents of DWARF2 debug sections\n" +msgstr "" +" Seçenekler:\n" +" -a --all -h -l -S -s -r -d -V -A -I ile aynı\n" +" -h --file-header ELF dosya baÅŸlığını gösterir\n" +" -l --program-headers Yazılım baÅŸlıklarını gösterir\n" +" --segments --program-headers ile aynı\n" +" -S --section-headers Bölüm baÅŸlıklarını gösterir\n" +" --sections --section-headers ile aynı\n" +" -e --headers -h -l -S ile aynı\n" +" -s --syms Sembol tablosunu gösterir\n" +" --symbols --syms ile aynı\n" +" -n --notes EÄŸer varsa, 'core' dosyasını gösterir\n" +" -r --relocs EÄŸer varsa, yerdeÄŸiÅŸimleri gösterir\n" +" -u --unwind EÄŸer varsa, geri dönüşümleri gösterir\n" +" -d --dynamic EÄŸer varsa, dinamik bölümleri gösterir\n" +" -V --version-info EÄŸer varsa, sürüm bölümlerini gösterir\n" +" -A --arch-specific EÄŸer varsa, platforma özgü bilgileri gösterir\n" +" -D --use-dynamic Sembolleri gösterirken dinamik bölümleri kullanır\n" +" -x --hex-dump= no'lu bölümün içeriÄŸini gösterir\n" +" -w[liaprmfFso] veya\n" +" --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n" +" DWARF2 hata ayıklama bölümlerinin içeriÄŸini gösterir\n" + +#: readelf.c:2640 +msgid "" +" -i --instruction-dump=\n" +" Disassemble the contents of section \n" +msgstr "" +" -i --instruction-dump=\n" +" bölümünün içeriÄŸini karşıt-çevirir\n" + +#: readelf.c:2644 +msgid "" +" -I --histogram Display histogram of bucket list lengths\n" +" -W --wide Allow output width to exceed 80 characters\n" +" -H --help Display this information\n" +" -v --version Display the version number of readelf\n" +msgstr "" +" -I --histogram Küme listesi uzunluklarının geçmiÅŸ grafiÄŸini gösterir\n" +" -W --wide Çıktı geniÅŸliÄŸinin 80 karakteri geçmesine izin verir\n" +" -H --help Bu bilgiyi gösterir\n" +" -v --version readelf'in sürüm no'sunu gösterir\n" + +#: readelf.c:2666 readelf.c:10765 +msgid "Out of memory allocating dump request table." +msgstr "Döküm istek tablosu ayrılırken bellek tükendi." + +#: readelf.c:2830 readelf.c:2906 +#, c-format +msgid "Unrecognized debug option '%s'\n" +msgstr "Tanınmayan hata ayıklama seçeneÄŸi '%s'\n" + +#: readelf.c:2940 +#, c-format +msgid "Invalid option '-%c'\n" +msgstr "Geçersiz seçenek '-%c'\n" + +#: readelf.c:2953 +msgid "Nothing to do.\n" +msgstr "Yapılacak bir ÅŸey yok.\n" + +#: readelf.c:2966 readelf.c:2983 readelf.c:5366 +msgid "none" +msgstr "yok" + +#: readelf.c:2970 readelf.c:2987 readelf.c:3018 +#, c-format +msgid "" +msgstr "" + +#: readelf.c:2984 +msgid "2's complement, little endian" +msgstr "2's complement, little endian" + +#: readelf.c:2985 +msgid "2's complement, big endian" +msgstr "2's complement, big endian" + +#: readelf.c:3015 +msgid "Standalone App" +msgstr "Tekbaşına Uygulama" + +#: readelf.c:3034 +msgid "Not an ELF file - it has the wrong magic bytes at the start\n" +msgstr "ELF dosyası deÄŸil - baÅŸlangıçta yanlış sihirli baytlar var\n" + +#: readelf.c:3042 +msgid "ELF Header:\n" +msgstr "ELF BaÅŸlığı:\n" + +#: readelf.c:3043 +msgid " Magic: " +msgstr " Sihir: " + +#: readelf.c:3047 +#, c-format +msgid " Class: %s\n" +msgstr " Sınıf: %s\n" + +#: readelf.c:3049 +#, c-format +msgid " Data: %s\n" +msgstr " Veri: %s\n" + +#: readelf.c:3051 +#, c-format +msgid " Version: %d %s\n" +msgstr " Sürüm: %d %s\n" + +#: readelf.c:3058 +#, c-format +msgid " OS/ABI: %s\n" +msgstr " OS/ABI: %s\n" + +#: readelf.c:3060 +#, c-format +msgid " ABI Version: %d\n" +msgstr " ABI Sürümü: %d\n" + +#: readelf.c:3062 +#, c-format +msgid " Type: %s\n" +msgstr " Tip: %s\n" + +#: readelf.c:3064 +#, c-format +msgid " Machine: %s\n" +msgstr " Makina: %s\n" + +#: readelf.c:3066 +#, c-format +msgid " Version: 0x%lx\n" +msgstr " Sürüm: 0x%lx\n" + +#: readelf.c:3069 +msgid " Entry point address: " +msgstr " Girdi noktası adresi: " + +#: readelf.c:3071 +msgid "" +"\n" +" Start of program headers: " +msgstr "" +"\n" +" Yazılım baÅŸlıkları baÅŸlangıcı: " + +#: readelf.c:3073 +msgid "" +" (bytes into file)\n" +" Start of section headers: " +msgstr "" +" (bayt dosya içinde)\n" +" Bölüm baÅŸlıkları baÅŸlangıcı: " + +#: readelf.c:3075 +msgid " (bytes into file)\n" +msgstr " (bayt dosya içinde)\n" + +#: readelf.c:3077 +#, c-format +msgid " Flags: 0x%lx%s\n" +msgstr " Seçenekler: 0x%lx%s\n" + +#: readelf.c:3080 +#, c-format +msgid " Size of this header: %ld (bytes)\n" +msgstr " Bu baÅŸlığın boyu: %ld (bayt)\n" + +#: readelf.c:3082 +#, c-format +msgid " Size of program headers: %ld (bytes)\n" +msgstr " Yazılım baÅŸlık boyu: %ld (bayt)\n" + +#: readelf.c:3084 +#, c-format +msgid " Number of program headers: %ld\n" +msgstr " Yazılım baÅŸlık sayısı: %ld\n" + +#: readelf.c:3086 +#, c-format +msgid " Size of section headers: %ld (bytes)\n" +msgstr " Bölüm baÅŸlık boyu: %ld (bayt)\n" + +#: readelf.c:3088 +#, c-format +msgid " Number of section headers: %ld" +msgstr " Bölüm baÅŸlıkları sayısı: %ld" + +#: readelf.c:3093 +#, c-format +msgid " Section header string table index: %ld" +msgstr " Bölüm baÅŸlığı dizge tablo endeksi: %ld" + +#: readelf.c:3127 readelf.c:3163 +msgid "program headers" +msgstr "Yazılım BaÅŸlıkları" + +#: readelf.c:3203 readelf.c:3480 readelf.c:3526 readelf.c:3589 readelf.c:3656 +#: readelf.c:4715 readelf.c:4758 readelf.c:4948 readelf.c:5917 readelf.c:5931 +#: readelf.c:10411 +msgid "Out of memory\n" +msgstr "Bellek tükendi\n" + +#: readelf.c:3231 +msgid "" +"\n" +"There are no program headers in this file.\n" +msgstr "" +"\n" +"Bu dosyada yazılım baÅŸlığı yok.\n" + +#: readelf.c:3237 +#, c-format +msgid "" +"\n" +"Elf file type is %s\n" +msgstr "" +"\n" +"Elf dosya tipi: %s\n" + +#: readelf.c:3238 +msgid "Entry point " +msgstr "GiriÅŸ noktası " + +#: readelf.c:3240 +#, c-format +msgid "" +"\n" +"There are %d program headers, starting at offset " +msgstr "" +"\n" +"%d adet yazılım baÅŸlığı var, göreli konumdan baÅŸlanıyor" + +#: readelf.c:3252 readelf.c:3254 +msgid "" +"\n" +"Program Headers:\n" +msgstr "" +"\n" +"Yazılım BaÅŸlıkları:\n" + +#: readelf.c:3258 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr " Tip Basamak SanalAdr GerçAdrs DosyaBoyBelBoy Seç Hiza\n" + +#: readelf.c:3261 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr " Tür Görece SanalAdr GerçAdrs DosyaBoy BelBoy Seç Hiza\n" + +#: readelf.c:3265 +msgid " Type Offset VirtAddr PhysAddr\n" +msgstr " Tip Basamak SanalAdres GerçekAdres\n" + +#: readelf.c:3267 +msgid " FileSiz MemSiz Flags Align\n" +msgstr " DosyaBoyu BellekBoyu Seç Hiza\n" + +#: readelf.c:3360 +msgid "more than one dynamic segment\n" +msgstr "bir dinamik parçadan fazla\n" + +#: readelf.c:3368 +msgid "Unable to find program interpreter name\n" +msgstr "Yazılım yorumlayıcısı adı bulunamadı\n" + +#: readelf.c:3375 +#, c-format +msgid "" +"\n" +" [Requesting program interpreter: %s]" +msgstr "" +"\n" +" [Yazılım yorumlayıcısı isteniyor: %s]" + +#: readelf.c:3387 +msgid "" +"\n" +" Section to Segment mapping:\n" +msgstr "" +"\n" +" Bölümden parçaya eÅŸleÅŸme:\n" + +#: readelf.c:3388 +msgid " Segment Sections...\n" +msgstr " Parça Bölümleri...\n" + +#: readelf.c:3437 +msgid "Cannot interpret virtual addresses without program headers.\n" +msgstr "Yazılım baÅŸlıkları olmadan sanal adresler yorumlanamaz. \n" + +#: readelf.c:3453 +#, c-format +msgid "Virtual address 0x%lx not located in any PT_LOAD segment.\n" +msgstr "0x%lx sanal adresi hiç bir PT_LOAD bölümünde bulunamadı.\n" + +#: readelf.c:3471 readelf.c:3517 +msgid "section headers" +msgstr "Bölüm BaÅŸlıkları" + +#: readelf.c:3565 readelf.c:3632 +msgid "symbols" +msgstr "semboller" + +#: readelf.c:3576 readelf.c:3643 +msgid "symtab shndx" +msgstr "symtab shndx" + +#: readelf.c:3745 +msgid "" +"\n" +"There are no sections in this file.\n" +msgstr "" +"\n" +"Bu dosyada bölüm yok.\n" + +#: readelf.c:3751 +#, c-format +msgid "There are %d section headers, starting at offset 0x%lx:\n" +msgstr "%d adet bölüm baÅŸlığı mevcut, göreli konum 0x%lx'dan baÅŸlanıyor:\n" + +#: readelf.c:3768 readelf.c:4098 readelf.c:4433 readelf.c:6070 +msgid "string table" +msgstr "dizge tablosu" + +#: readelf.c:3793 +msgid "File contains multiple dynamic symbol tables\n" +msgstr "Dosyada birden fazla dinamik sembol tablosu var\n" + +#: readelf.c:3805 +msgid "File contains multiple dynamic string tables\n" +msgstr "Dosyada birden fazla dinamik dizge tablosu var\n" + +#: readelf.c:3811 +msgid "dynamic strings" +msgstr "dinamik dizgeler" + +#: readelf.c:3817 +msgid "File contains multiple symtab shndx tables\n" +msgstr "Dosyada birden fazla symtab shndx tablosu var\n" + +#: readelf.c:3855 +msgid "" +"\n" +"Section Headers:\n" +msgstr "" +"\n" +"Bölüm BaÅŸlıkları:\n" + +#: readelf.c:3857 +msgid "" +"\n" +"Section Header:\n" +msgstr "" +"\n" +"Bölüm BaÅŸlığı:\n" + +#: readelf.c:3861 +msgid " [Nr] Name Type Addr Off Size ES Flg Lk Inf Al\n" +msgstr " [Nr] İsim Tip Adres Bas Boy ES Seç Lk Inf Al\n" + +#: readelf.c:3864 +msgid " [Nr] Name Type Address Off Size ES Flg Lk Inf Al\n" +msgstr " [Nr] İsim Tür Adres Görece Boy ES Seç Lk Inf Al\n" + +#: readelf.c:3867 +msgid " [Nr] Name Type Address Offset\n" +msgstr " [Nr] İsim Tip Adres Basamak\n" + +#: readelf.c:3868 +msgid " Size EntSize Flags Link Info Align\n" +msgstr " Boy EntBoy Seç BaÄŸ Bilgi Hiza\n" + +#: readelf.c:3963 +msgid "" +"Key to Flags:\n" +" W (write), A (alloc), X (execute), M (merge), S (strings)\n" +" I (info), L (link order), G (group), x (unknown)\n" +" O (extra OS processing required) o (OS specific), p (processor specific)\n" +msgstr "" +"Seçenekler:\n" +" W (yazdırır), A (ayırır), X (uygular), M (birleÅŸtirir), S (dizgeler)\n" +" I (bilgi), L (baÄŸ sırası), G (grup), x (bilinmeyen)\n" +" O (daha fazla OS iÅŸlemesi gerekli) o (OS'e özgü), p (iÅŸlemciye özgü)\n" + +#: readelf.c:4031 +#, c-format +msgid "" +"\n" +"'%s' relocation section at offset 0x%lx contains %ld bytes:\n" +msgstr "" +"\n" +"Göreli konum 0x%2$lx'da bulunan `%1$s' yer deÄŸiÅŸtirme bölümü %3$ld bayt içeriyor:\n" + +#: readelf.c:4043 +msgid "" +"\n" +"There are no dynamic relocations in this file.\n" +msgstr "" +"\n" +"Bu dosyada dinamik yer deÄŸiÅŸtirmeler yok.\n" + +#: readelf.c:4070 +msgid "" +"\n" +"Relocation section " +msgstr "" +"\n" +"Yer deÄŸiÅŸtirme bölümü " + +#: readelf.c:4075 readelf.c:4496 readelf.c:4510 +#, c-format +msgid "'%s'" +msgstr "'%s'" + +#: readelf.c:4077 readelf.c:4512 +#, c-format +msgid " at offset 0x%lx contains %lu entries:\n" +msgstr "göreli konum 0x%lx %lu girdi içeriyor:\n" + +#: readelf.c:4115 +msgid "" +"\n" +"There are no relocations in this file.\n" +msgstr "" +"\n" +"Bu dosyada yer deÄŸiÅŸtirmeler yok.\n" + +#: readelf.c:4299 +msgid "unwind table" +msgstr "geri alma tablosu" + +#: readelf.c:4350 readelf.c:4362 readelf.c:8499 readelf.c:8511 +#, c-format +msgid "Skipping unexpected symbol type %u\n" +msgstr "beklenmeyen sembol türü %u atlanıyor\n" + +#: readelf.c:4370 +#, c-format +msgid "Skipping unexpected relocation type %s\n" +msgstr "beklenmeyen yerdeÄŸiÅŸim türü %s atlanıyor\n" + +#: readelf.c:4415 readelf.c:4440 +msgid "" +"\n" +"There are no unwind sections in this file.\n" +msgstr "" +"\n" +"Bu dosyada geri alma bölümü yok.\n" + +#: readelf.c:4491 +msgid "" +"\n" +"Could not find unwind info section for " +msgstr "" +"\n" +"Geri alma bilgi bölümü bulunamadı " + +#: readelf.c:4503 +msgid "unwind info" +msgstr "geri alma bilgisi" + +#: readelf.c:4505 +msgid "" +"\n" +"Unwind section " +msgstr "" +"\n" +"Geri alma bölümü " + +#: readelf.c:4699 readelf.c:4742 +msgid "dynamic segment" +msgstr "dinamik bölüm" + +#: readelf.c:4820 +msgid "" +"\n" +"There is no dynamic segment in this file.\n" +msgstr "" +"\n" +"Bu dosyada dinamik parça yok.\n" + +#: readelf.c:4854 +msgid "Unable to seek to end of file!" +msgstr "Dosya sonuna kadar aranamıyor!" + +#: readelf.c:4865 +msgid "Unable to determine the number of symbols to load\n" +msgstr "Yüklenecek sembol sayısı belirlenemedi\n" + +#: readelf.c:4895 +msgid "Unable to seek to end of file\n" +msgstr "Dosyanın sonuna kadar aranamadı\n" + +#: readelf.c:4901 +msgid "Unable to determine the length of the dynamic string table\n" +msgstr "Dinamik dizge tablosunun uzunluÄŸu belirlenemedi\n" + +#: readelf.c:4906 +msgid "dynamic string table" +msgstr "dinamik dizge tablosu" + +#: readelf.c:4941 +msgid "symbol information" +msgstr "sembol bilgisi" + +#: readelf.c:4965 +#, c-format +msgid "" +"\n" +"Dynamic segment at offset 0x%lx contains %ld entries:\n" +msgstr "" +"\n" +"Göreli konum 0x%lx'deki dinamik parça %ld girdi içeriyor:\n" + +#: readelf.c:4968 +msgid " Tag Type Name/Value\n" +msgstr " Etiket Tip İsim/DeÄŸer\n" + +#: readelf.c:5004 +msgid "Auxiliary library" +msgstr "Yardımcı kitaplık" + +#: readelf.c:5008 +msgid "Filter library" +msgstr "Filtre kitaplığı" + +#: readelf.c:5012 +msgid "Configuration file" +msgstr "Ayar dosyası" + +#: readelf.c:5016 +msgid "Dependency audit library" +msgstr "Bağımlılık denetim kitaplığı" + +#: readelf.c:5020 +msgid "Audit library" +msgstr "Denetim kitaplığı" + +#: readelf.c:5038 readelf.c:5066 readelf.c:5094 +msgid "Flags:" +msgstr "Seçenekler:" + +#: readelf.c:5041 readelf.c:5069 readelf.c:5096 +msgid " None\n" +msgstr " Hiçbiri\n" + +#: readelf.c:5217 +#, c-format +msgid "Shared library: [%s]" +msgstr "Paylaşımlı kitaplık: [%s]" + +#: readelf.c:5220 +msgid " program interpreter" +msgstr " yazılım yorumlayıcısı" + +#: readelf.c:5224 +#, c-format +msgid "Library soname: [%s]" +msgstr "Kitaplık so_adı: [%s]" + +#: readelf.c:5228 +#, c-format +msgid "Library rpath: [%s]" +msgstr "Kitaplık r_yolu: [%s]" + +#: readelf.c:5232 +#, c-format +msgid "Library runpath: [%s]" +msgstr "Kitaplık çalışım yolu: [%s]" + +#: readelf.c:5296 +#, c-format +msgid "Not needed object: [%s]\n" +msgstr "Gereksiz nesne: [%s]\n" + +#: readelf.c:5412 +#, c-format +msgid "" +"\n" +"Version definition section '%s' contains %ld entries:\n" +msgstr "" +"\n" +"Sürüm tanımı bölümü '%s' %ld girdi içeriyor:\n" + +#: readelf.c:5415 +msgid " Addr: 0x" +msgstr " Adres: 0x" + +#: readelf.c:5417 readelf.c:5612 +#, c-format +msgid " Offset: %#08lx Link: %lx (%s)\n" +msgstr " Basamak: %#08lx BaÄŸ: %lx (%s)\n" + +#: readelf.c:5424 +msgid "version definition section" +msgstr "sürüm tanımı bölümü" + +#: readelf.c:5450 +#, c-format +msgid " %#06x: Rev: %d Flags: %s" +msgstr " %#06x: Sür: %d Seçenek: %s" + +#: readelf.c:5453 +#, c-format +msgid " Index: %d Cnt: %d " +msgstr " Endeks: %d Sayı: %d " + +#: readelf.c:5464 +#, c-format +msgid "Name: %s\n" +msgstr "İsim: %s\n" + +#: readelf.c:5466 +#, c-format +msgid "Name index: %ld\n" +msgstr "İsim Endeksi: %ld\n" + +#: readelf.c:5481 +#, c-format +msgid " %#06x: Parent %d: %s\n" +msgstr " %#06x: Üst %d: %s\n" + +#: readelf.c:5484 +#, c-format +msgid " %#06x: Parent %d, name index: %ld\n" +msgstr " %#06x: Üst %d, isim endeksi: %ld\n" + +#: readelf.c:5503 +#, c-format +msgid "" +"\n" +"Version needs section '%s' contains %ld entries:\n" +msgstr "" +"\n" +"Sürüm gereksinimleri bölümü '%s' %ld girdi içeriyor:\n" + +#: readelf.c:5506 +msgid " Addr: 0x" +msgstr " Adres: 0x" + +#: readelf.c:5508 +#, c-format +msgid " Offset: %#08lx Link to section: %ld (%s)\n" +msgstr " Basamak: %#08lx Bölüme baÄŸ: %ld (%s)\n" + +#: readelf.c:5514 +msgid "version need section" +msgstr "Sürüm Gereksinim Bölüm" + +#: readelf.c:5536 +#, c-format +msgid " %#06x: Version: %d" +msgstr " %#06x: Sürüm: %d" + +#: readelf.c:5539 +#, c-format +msgid " File: %s" +msgstr " Dosya: %s" + +#: readelf.c:5541 +#, c-format +msgid " File: %lx" +msgstr " Dosya: %lx" + +#: readelf.c:5543 +#, c-format +msgid " Cnt: %d\n" +msgstr " Sayı: %d\n" + +#: readelf.c:5561 +#, c-format +msgid " %#06x: Name: %s" +msgstr " %#06x: İsim: %s" + +#: readelf.c:5564 +#, c-format +msgid " %#06x: Name index: %lx" +msgstr " %#06x: İsim endeksi: %lx" + +#: readelf.c:5567 +#, c-format +msgid " Flags: %s Version: %d\n" +msgstr " Seçenekler: %s Sürüm: %d\n" + +#: readelf.c:5603 +msgid "version string table" +msgstr "Sürüm Dizge Tablo" + +#: readelf.c:5607 +#, c-format +msgid "" +"\n" +"Version symbols section '%s' contains %d entries:\n" +msgstr "" +"\n" +"Sürüm sembolleri bölümü '%s' %d girdi içeriyor:\n" + +#: readelf.c:5610 +msgid " Addr: " +msgstr " Adres: " + +#: readelf.c:5622 +msgid "version symbol data" +msgstr "Sürüm Sembol Veri" + +#: readelf.c:5649 +msgid " 0 (*local*) " +msgstr " 0 (*yerel*) " + +#: readelf.c:5653 +msgid " 1 (*global*) " +msgstr " 1 (*evrensel*) " + +#: readelf.c:5689 readelf.c:6129 +msgid "version need" +msgstr "Sürüm Gereksinim" + +#: readelf.c:5699 +msgid "version need aux (2)" +msgstr "Sürüm Gereksinim Yardımcı (2)" + +#: readelf.c:5741 readelf.c:6192 +msgid "version def" +msgstr "sürüm tanımı" + +#: readelf.c:5760 readelf.c:6207 +msgid "version def aux" +msgstr "Sürüm yardımcı tanımı" + +#: readelf.c:5791 +msgid "" +"\n" +"No version information found in this file.\n" +msgstr "" +"\n" +"Bu dosyada sürüm bilgisi yok.\n" + +#: readelf.c:5923 +msgid "Unable to read in dynamic data\n" +msgstr "Dinamik veri okunamadı\n" + +#: readelf.c:5967 +msgid "Unable to seek to start of dynamic information" +msgstr "Dinamik bilginin baÅŸlangıcına kadar aranamadı" + +#: readelf.c:5973 +msgid "Failed to read in number of buckets\n" +msgstr "Küme sayısı okunamadı\n" + +#: readelf.c:5979 +msgid "Failed to read in number of chains\n" +msgstr "Zincir sayısı okunamadı\n" + +#: readelf.c:5999 +msgid "" +"\n" +"Symbol table for image:\n" +msgstr "" +"\n" +"İmaj için sembol tablosu:\n" + +#: readelf.c:6001 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " Küme Num: DeÄŸer Boy Tip BaÄŸ Gör Ndx İsim\n" + +#: readelf.c:6003 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr " Küme Num: DeÄŸer Boy Tip BaÄŸ Gör Ndx İsim\n" + +#: readelf.c:6048 +#, c-format +msgid "" +"\n" +"Symbol table '%s' contains %lu entries:\n" +msgstr "" +"\n" +"'%s' sembol tablosu %lu girdi içeriyor:\n" + +#: readelf.c:6052 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " Num: DeÄŸer Boy Tip BaÄŸ Gör Ndx İsim\n" + +#: readelf.c:6054 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr " Num: DeÄŸer Boy Tip BaÄŸ Gör Ndx İsim\n" + +#: readelf.c:6101 +msgid "version data" +msgstr "sürüm verisi" + +#: readelf.c:6142 +msgid "version need aux (3)" +msgstr "Sürüm Gereksinim Yardımcı (3)" + +#: readelf.c:6167 +msgid "bad dynamic symbol" +msgstr "hatalı dinamik sembol" + +#: readelf.c:6230 +msgid "" +"\n" +"Dynamic symbol information is not available for displaying symbols.\n" +msgstr "" +"\n" +"Dinamik sembolleri göstermek için dinamik sembol bilgisi mevcut deÄŸil.\n" + +#: readelf.c:6242 +#, c-format +msgid "" +"\n" +"Histogram for bucket list length (total of %d buckets):\n" +msgstr "" +"\n" +"Küme liste boyu (toplam %d küme) geçmiÅŸ grafiÄŸi:\n" + +#: readelf.c:6244 +#, c-format +msgid " Length Number %% of total Coverage\n" +msgstr "" +" Length Number %% of total Coverage\n" +" Boy Numara toplam kapsamın %%\n" + +#: readelf.c:6249 readelf.c:6268 readelf.c:9898 readelf.c:10090 +msgid "Out of memory" +msgstr "Bellek yetersiz" + +#: readelf.c:6317 +#, c-format +msgid "" +"\n" +"Dynamic info segment at offset 0x%lx contains %d entries:\n" +msgstr "" +"\n" +"Göreli konum 0x%lx'de yer alan dinamik bilgi parçası %d girdi içeriyor:\n" + +#: readelf.c:6320 +msgid " Num: Name BoundTo Flags\n" +msgstr " Num: İsim BaÄŸlı Seçenekler\n" + +#: readelf.c:6373 +#, c-format +msgid "" +"\n" +"Assembly dump of section %s\n" +msgstr "" +"\n" +"%s bölümünün üretici dökümü\n" + +#: readelf.c:6396 +#, c-format +msgid "" +"\n" +"Section '%s' has no data to dump.\n" +msgstr "" +"\n" +"'%s' bölümünde dökülecek veri yok.\n" + +#: readelf.c:6401 +#, c-format +msgid "" +"\n" +"Hex dump of section '%s':\n" +msgstr "" +"\n" +"'%s' bölümünün onaltılık dökümü:\n" + +#: readelf.c:6406 +msgid "section data" +msgstr "bölüm verisi" + +#: readelf.c:6555 +msgid "badly formed extended line op encountered!\n" +msgstr "hatalı oluÅŸturulmuÅŸ uzun satır iÅŸlevi bulundu!\n" + +#: readelf.c:6562 +#, c-format +msgid " Extended opcode %d: " +msgstr " Ek opkod %d: " + +#: readelf.c:6567 +msgid "" +"End of Sequence\n" +"\n" +msgstr "" +"Dizi Sonu\n" +"\n" + +#: readelf.c:6573 +#, c-format +msgid "set Address to 0x%lx\n" +msgstr "Adresi 0x%lx olarak atar\n" + +#: readelf.c:6578 +msgid " define new File Table entry\n" +msgstr " yeni Dosya Tablosu girdisi tanımlar\n" + +#: readelf.c:6579 readelf.c:6726 +msgid " Entry\tDir\tTime\tSize\tName\n" +msgstr " Girdi\tDizin\tZaman\tBoy\tİsim\n" + +#: readelf.c:6581 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:6584 readelf.c:6586 readelf.c:6588 readelf.c:6738 readelf.c:6740 +#: readelf.c:6742 +#, c-format +msgid "%lu\t" +msgstr "%lu\t" + +#: readelf.c:6589 +#, c-format +msgid "" +"%s\n" +"\n" +msgstr "" +"%s\n" +"\n" + +#: readelf.c:6593 +#, c-format +msgid "UNKNOWN: length %d\n" +msgstr "TANIMSIZ: uzunluk %d\n" + +#: readelf.c:6621 +#, c-format +msgid "" +"\n" +"Dump of debug contents of section %s:\n" +"\n" +msgstr "" +"\n" +"%s bölümünün hata ayıklama içeriÄŸi dökümü:\n" +"\n" + +#: readelf.c:6649 +msgid "The line info appears to be corrupt - the section is too small\n" +msgstr "Satır bilgisi bozuk - bölüm çok küçük\n" + +#: readelf.c:6658 +msgid "Only DWARF version 2 and 3 line info is currently supported.\n" +msgstr "Åžimdilik yalnızca DWARF sürüm 2 ve 3 satır bilgisi destekleniyor.\n" + +#: readelf.c:6679 +#, c-format +msgid " Length: %ld\n" +msgstr " Uzunluk: %ld\n" + +#: readelf.c:6680 +#, c-format +msgid " DWARF Version: %d\n" +msgstr " DWARF Sürümü: %d\n" + +#: readelf.c:6681 +#, c-format +msgid " Prologue Length: %d\n" +msgstr " GiriÅŸ UzunluÄŸu: %d\n" + +#: readelf.c:6682 +#, c-format +msgid " Minimum Instruction Length: %d\n" +msgstr " Minimum İşlem UzunluÄŸu: %d\n" + +#: readelf.c:6683 +#, c-format +msgid " Initial value of 'is_stmt': %d\n" +msgstr " 'is_stmt' baÅŸlangıç deÄŸeri: %d\n" + +#: readelf.c:6684 +#, c-format +msgid " Line Base: %d\n" +msgstr " Satır Temeli: %d\n" + +#: readelf.c:6685 +#, c-format +msgid " Line Range: %d\n" +msgstr " Satır Aralığı: %d\n" + +#: readelf.c:6686 +#, c-format +msgid " Opcode Base: %d\n" +msgstr " Opkod Temeli: %d\n" + +#: readelf.c:6695 +msgid "" +"\n" +" Opcodes:\n" +msgstr "" +"\n" +" Opkodlar:\n" + +#: readelf.c:6698 +#, c-format +msgid " Opcode %d has %d args\n" +msgstr " %d opkodunun %d seçeneÄŸi var\n" + +#: readelf.c:6704 +msgid "" +"\n" +" The Directory Table is empty.\n" +msgstr "" +"\n" +" Dizin Tablosu boÅŸ.\n" + +#: readelf.c:6707 +msgid "" +"\n" +" The Directory Table:\n" +msgstr "" +"\n" +" Dizin Tablosu:\n" + +#: readelf.c:6711 +#, c-format +msgid " %s\n" +msgstr " %s\n" + +#: readelf.c:6722 +msgid "" +"\n" +" The File Name Table is empty.\n" +msgstr "" +"\n" +" Dosya Adı Tablosu boÅŸ.\n" + +#: readelf.c:6725 +msgid "" +"\n" +" The File Name Table:\n" +msgstr "" +"\n" +" Dosya Adı Tablosu:\n" + +#: readelf.c:6733 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:6744 +#, c-format +msgid "%s\n" +msgstr "%s\n" + +#. Now display the statements. +#: readelf.c:6752 +msgid "" +"\n" +" Line Number Statements:\n" +msgstr "" +"\n" +" Satır Numarası Deyimleri:\n" + +#: readelf.c:6768 +#, c-format +msgid " Special opcode %d: advance Address by %d to 0x%lx" +msgstr " Özel opkod %1$d: Adresi 0x%3$lx'e kadar %2$d ilerletir" + +#: readelf.c:6772 +#, c-format +msgid " and Line by %d to %d\n" +msgstr " ve Satır'ı %2$d'ye kadar %1$d\n" + +#: readelf.c:6783 +msgid " Copy\n" +msgstr " Kopyalar\n" + +#: readelf.c:6790 +#, c-format +msgid " Advance PC by %d to %lx\n" +msgstr " PC'yi %2$lx'ye kadar, %1$d ilerletir\n" + +#: readelf.c:6798 +#, c-format +msgid " Advance Line by %d to %d\n" +msgstr " Satırı %2$d'ye kadar %1$d ilerletir\n" + +#: readelf.c:6805 +#, c-format +msgid " Set File Name to entry %d in the File Name Table\n" +msgstr " Dosya Adını, Dosya İsim Tablosunda, %d numaralı girdi olarak atar\n" + +#: readelf.c:6813 +#, c-format +msgid " Set column to %d\n" +msgstr " Sütunu %d olarak atar\n" + +#: readelf.c:6820 +#, c-format +msgid " Set is_stmt to %d\n" +msgstr " is_stmt'i %d olarak atar\n" + +#: readelf.c:6825 +msgid " Set basic block\n" +msgstr " Temel bloÄŸu atar\n" + +#: readelf.c:6833 +#, c-format +msgid " Advance PC by constant %d to 0x%lx\n" +msgstr " PC'yi 0x%2$lx'e kadar %1$d ilerletir\n" + +#: readelf.c:6841 +#, c-format +msgid " Advance PC by fixed size amount %d to 0x%lx\n" +msgstr " PC'yi 0x%2$lx'e kadar %1$d ilerletir\n" + +#: readelf.c:6846 +msgid " Set prologue_end to true\n" +msgstr " Prologue_end'i doÄŸru (true) olarak atar\n" + +#: readelf.c:6850 +msgid " Set epilogue_begin to true\n" +msgstr " Epilogue_begin'i doÄŸru (true) olarak atar\n" + +#: readelf.c:6856 +#, c-format +msgid " Set ISA to %d\n" +msgstr " ISA'yı %d olarak atar\n" + +#: readelf.c:6860 +#, c-format +msgid " Unknown opcode %d with operands: " +msgstr " Bilinmeyen %d opkodu ve iÅŸlenenleri: " + +#: readelf.c:6891 readelf.c:7371 readelf.c:7443 +#, c-format +msgid "" +"Contents of the %s section:\n" +"\n" +msgstr "" +"%s bölümünün içeriÄŸi:\n" +"\n" + +#: readelf.c:6931 +msgid "Only DWARF 2 and 3 pubnames are currently supported\n" +msgstr "Åžimdilik yalnız DWARF 2 ve 3 genel isimleri destekleniyor\n" + +#: readelf.c:6938 +#, c-format +msgid " Length: %ld\n" +msgstr " Uzunluk: %ld\n" + +#: readelf.c:6940 +#, c-format +msgid " Version: %d\n" +msgstr " Sürüm: %d\n" + +#: readelf.c:6942 +#, c-format +msgid " Offset into .debug_info section: %ld\n" +msgstr ".debug_info bölümünün içine göreli konum: %ld\n" + +#: readelf.c:6944 +#, c-format +msgid " Size of area in .debug_info section: %ld\n" +msgstr ".debug_info bölümünde alan büyüklüğü: %ld\n" + +#: readelf.c:6947 +msgid "" +"\n" +" Offset\tName\n" +msgstr "" +"\n" +" Basamak\tİsim\n" + +#: readelf.c:7042 +#, c-format +msgid "Unknown TAG value: %lx" +msgstr "Bilinmeyen TAG deÄŸeri: %lx" + +#: readelf.c:7156 +#, c-format +msgid "Unknown AT value: %lx" +msgstr "Bilinmeyen AT deÄŸeri: %lx" + +#: readelf.c:7193 +#, c-format +msgid "Unknown FORM value: %lx" +msgstr "Bilinmeyen FORM deÄŸeri: %lx" + +#: readelf.c:7392 +#, c-format +msgid " DW_MACINFO_start_file - lineno: %d filenum: %d\n" +msgstr " DW_MACINFO_start_file - satır no: %d dosya no: %d\n" + +#: readelf.c:7397 +msgid " DW_MACINFO_end_file\n" +msgstr " DW_MACINFO_end_file\n" + +#: readelf.c:7405 +#, c-format +msgid " DW_MACINFO_define - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_define - satır no : %d makro : %s\n" + +#: readelf.c:7413 +#, c-format +msgid " DW_MACINFO_undef - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_undef - satır no : %d makro : %s\n" + +#: readelf.c:7424 +#, c-format +msgid " DW_MACINFO_vendor_ext - constant : %d string : %s\n" +msgstr " DW_MACINFO_vendor_ext - sabit : %d dizge : %s\n" + +#: readelf.c:7452 +msgid " Number TAG\n" +msgstr " Sayı TAG\n" + +#: readelf.c:7458 +#, c-format +msgid " %ld %s [%s]\n" +msgstr " %ld %s [%s]\n" + +#: readelf.c:7461 +msgid "has children" +msgstr "astları var" + +#: readelf.c:7461 +msgid "no children" +msgstr "astları yok" + +#: readelf.c:7465 +#, c-format +msgid " %-18s %s\n" +msgstr " %-18s %s\n" + +#: readelf.c:7486 +#, c-format +msgid " %lu byte block: " +msgstr " %lu baytlık blok: " + +#: readelf.c:7814 +msgid "(User defined location op)" +msgstr "(Kullanıcı tanımlı yer yönergesi)" + +#: readelf.c:7816 +msgid "(Unknown location op)" +msgstr "(Bilinmeyen yer yönergesi)" + +#: readelf.c:7855 +msgid "debug_loc section data" +msgstr "hata ayıklama bölüm verisi" + +#: readelf.c:7887 +msgid "" +"\n" +"The .debug_loc section is empty.\n" +msgstr "" +"\n" +".debug_loc bölümü boÅŸ.\n" + +#: readelf.c:7891 +msgid "" +"Contents of the .debug_loc section:\n" +"\n" +msgstr "" +".debug_loc bölümünün içeriÄŸi:\n" +"\n" + +#: readelf.c:7892 +msgid "" +"\n" +" Offset Begin End Expression\n" +msgstr "" +"\n" +" Görece BaÅŸlan. Son İfade\n" + +#: readelf.c:7968 +msgid "debug_str section data" +msgstr "debug_str bölüm verisi" + +#: readelf.c:7987 +msgid "" +msgstr "<.debug_str bölümü yok>" + +#: readelf.c:7990 +msgid "" +msgstr "" + +#: readelf.c:8009 +msgid "" +"\n" +"The .debug_str section is empty.\n" +msgstr "" +"\n" +".debug_str bölümü boÅŸ.\n" + +#: readelf.c:8013 +msgid "" +"Contents of the .debug_str section:\n" +"\n" +msgstr "" +".debug_str bölümünün içeriÄŸi:\n" +"\n" + +#: readelf.c:8088 +msgid "Internal error: DWARF version is not 2 or 3.\n" +msgstr "İç hata: DWARF sürümü 2 veya 3 deÄŸil.\n" + +#: readelf.c:8203 +#, c-format +msgid " (indirect string, offset: 0x%lx): %s" +msgstr " (dolaylı dizge, görece: 0x%lx): %s" + +#: readelf.c:8212 +#, c-format +msgid "Unrecognized form: %d\n" +msgstr "Bilinmeyen form: %d\n" + +#: readelf.c:8226 +msgid "(not inlined)" +msgstr "(inline'lanamadı)" + +#: readelf.c:8229 +msgid "(inlined)" +msgstr "(inline'landı)" + +#: readelf.c:8232 +msgid "(declared as inline but ignored)" +msgstr "(inline olarak tanımlandı ama yoksayıldı)" + +#: readelf.c:8235 +msgid "(declared as inline and inlined)" +msgstr "(inline olarak tanımlandı ve inline'landı)" + +#: readelf.c:8238 +#, c-format +msgid " (Unknown inline attribute value: %lx)" +msgstr " (Bilinmeyen inline öznitelik deÄŸeri: %lx)" + +#: readelf.c:8419 readelf.c:8646 +#, c-format +msgid "" +"The section %s contains:\n" +"\n" +msgstr "" +"%s bölümü içeriyor:\n" +"\n" + +#: readelf.c:8535 +#, c-format +msgid " Compilation Unit @ %lx:\n" +msgstr " Derleme Birimi @ %lx:\n" + +#: readelf.c:8536 +#, c-format +msgid " Length: %ld\n" +msgstr " Uzunluk: %ld\n" + +#: readelf.c:8537 +#, c-format +msgid " Version: %d\n" +msgstr " Sürüm: %d\n" + +#: readelf.c:8538 +#, c-format +msgid " Abbrev Offset: %ld\n" +msgstr " Kısaltma Basamağı: %ld\n" + +#: readelf.c:8539 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " Gösterge Boyu: %d\n" + +#: readelf.c:8543 +msgid "Only version 2 and 3 DWARF debug information is currently supported.\n" +msgstr "Åžimdilik yalnızca DWARF Sürüm 2 ve 3 hata ayıklama bilgisi destekleniyor.\n" + +#: readelf.c:8563 +msgid "Unable to locate .debug_abbrev section!\n" +msgstr ".debug_abbrev bölümü bulunamadı!\n" + +#: readelf.c:8569 +msgid "debug_abbrev section data" +msgstr "debug_abbrev bölüm verisi" + +#: readelf.c:8606 +#, c-format +msgid "Unable to locate entry %lu in the abbreviation table\n" +msgstr "Kısaltma tablosunda %lu girdisi bulunamadı\n" + +#: readelf.c:8611 +#, c-format +msgid " <%d><%lx>: Abbrev Number: %lu (%s)\n" +msgstr " <%d><%lx>: Kısaltma Numarası: %lu (%s)\n" + +#: readelf.c:8691 +msgid "Only DWARF 2 and 3 aranges are currently supported.\n" +msgstr "Åžimdilik yalnızca DWARF 2 ve 3 a-aralıkları destekleniyor.\n" + +#: readelf.c:8695 +#, c-format +msgid " Length: %ld\n" +msgstr " Uzunluk: %ld\n" + +#: readelf.c:8696 +#, c-format +msgid " Version: %d\n" +msgstr " Sürüm: %d\n" + +#: readelf.c:8697 +#, c-format +msgid " Offset into .debug_info: %lx\n" +msgstr " .debug_info'nun içine göreli konum: %lx\n" + +#: readelf.c:8698 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " Gösterge Boyu: %d\n" + +#: readelf.c:8699 +#, c-format +msgid " Segment Size: %d\n" +msgstr " Parça Boyu: %d\n" + +#: readelf.c:8701 +msgid "" +"\n" +" Address Length\n" +msgstr "" +"\n" +" Adres Uzunluk\n" + +#: readelf.c:8903 +#, c-format +msgid "The section %s contains:\n" +msgstr "%s bölümü içeriyor:\n" + +#: readelf.c:9538 +#, c-format +msgid "Displaying the debug contents of section %s is not yet supported.\n" +msgstr "%s bölümünün hata ayıklama içerik bilgilerini göstermek henüz desteklenmiyor.\n" + +#: readelf.c:9634 +#, c-format +msgid "" +"\n" +"Section '%s' has no debugging data.\n" +msgstr "" +"\n" +"'%s' bölümünde hata ayıklama bilgisi yok.\n" + +#: readelf.c:9639 readelf.c:9701 +msgid "debug section data" +msgstr "hata ayıklama bölüm verisi" + +#: readelf.c:9655 +#, c-format +msgid "Unrecognized debug section: %s\n" +msgstr "Tanınmayan hata ayıklama bölümü: %s\n" + +#: readelf.c:9729 +msgid "Some sections were not dumped because they do not exist!\n" +msgstr "Bazı bölümler dökülmedi çünkü mevcut deÄŸiller!\n" + +#: readelf.c:9806 readelf.c:10170 +msgid "liblist" +msgstr "liblist" + +#: readelf.c:9891 +msgid "options" +msgstr "seçenekler" + +#: readelf.c:9922 +#, c-format +msgid "" +"\n" +"Section '%s' contains %d entries:\n" +msgstr "" +"\n" +"'%s' bölümü %d girdi içeriyor:\n" + +#: readelf.c:10083 +msgid "conflict list found without a dynamic symbol table" +msgstr "dinamik sembol tablosu olmayan çeliÅŸki listesi bulundu" + +#: readelf.c:10101 readelf.c:10117 +msgid "conflict" +msgstr "çakışma" + +#: readelf.c:10127 +#, c-format +msgid "" +"\n" +"Section '.conflict' contains %ld entries:\n" +msgstr "" +"\n" +"'.conflict' bölümü %ld girdi içeriyor:\n" + +#: readelf.c:10129 +msgid " Num: Index Value Name" +msgstr " Num: Endeks DeÄŸer İsim" + +#: readelf.c:10178 +msgid "liblist string table" +msgstr "liblist dizge tablosu" + +#: readelf.c:10187 +#, c-format +msgid "" +"\n" +"Library list section '%s' contains %lu entries:\n" +msgstr "" +"\n" +"Kitaplık liste bölümü '%s', %lu girdi içeriyor:\n" + +#: readelf.c:10236 +msgid "NT_PRSTATUS (prstatus structure)" +msgstr "NT_PRSTATUS (prstatus yapısı)" + +#: readelf.c:10237 +msgid "NT_FPREGSET (floating point registers)" +msgstr "NT_FPREGSET (kayan nokta yazmaçları)" + +#: readelf.c:10238 +msgid "NT_PRPSINFO (prpsinfo structure)" +msgstr "NT_PRPSINFO (prpsinfo yapısı)" + +#: readelf.c:10239 +msgid "NT_TASKSTRUCT (task structure)" +msgstr "NT_TASKSTRUCT (görev yapısı)" + +#: readelf.c:10240 +msgid "NT_PRXFPREG (user_xfpregs structure)" +msgstr "NT_PRXFPREG (user_xfpregs yapısı)" + +#: readelf.c:10241 +msgid "NT_PSTATUS (pstatus structure)" +msgstr "NT_PSTATUS (pstatus yapısı)" + +#: readelf.c:10242 +msgid "NT_FPREGS (floating point registers)" +msgstr "NT_FPREGS (kayan nokta yazmaçları)" + +#: readelf.c:10243 +msgid "NT_PSINFO (psinfo structure)" +msgstr "NT_PSINFO (psinfo yapısı)" + +#: readelf.c:10244 +msgid "NT_LWPSTATUS (lwpstatus_t structure)" +msgstr "NT_LWPSTATUS (lwpstatus_t yapısı)" + +#: readelf.c:10245 +msgid "NT_LWPSINFO (lwpsinfo_t structure)" +msgstr "NT_LWPSINFO (lwpsinfo_t yapısı)" + +#: readelf.c:10246 +msgid "NT_WIN32PSTATUS (win32_pstatus structure)" +msgstr "NT_WIN32PSTATUS (win32_pstatus yapısı)" + +#: readelf.c:10248 readelf.c:10272 +#, c-format +msgid "Unknown note type: (0x%08x)" +msgstr "Bilinmeyen not tipi: (0x%08x)" + +#. NetBSD core "procinfo" structure. +#: readelf.c:10262 +msgid "NetBSD procinfo structure" +msgstr "NetBSD procinfo yapısı" + +#: readelf.c:10289 readelf.c:10303 +msgid "PT_GETREGS (reg structure)" +msgstr "PT_GETREGS (yazmaç yapısı)" + +#: readelf.c:10291 readelf.c:10305 +msgid "PT_GETFPREGS (fpreg structure)" +msgstr "PT_GETFPREGS (kayan nokta yazmaç yapısı)" + +#: readelf.c:10311 +#, c-format +msgid "PT_FIRSTMACH+%d" +msgstr "PT_FIRSTMACH+%d" + +#: readelf.c:10365 +msgid "notes" +msgstr "notlar" + +#: readelf.c:10371 +#, c-format +msgid "" +"\n" +"Notes at offset 0x%08lx with length 0x%08lx:\n" +msgstr "" +"\n" +"0x%08lx göreli konumunda, 0x%08lx uzunluÄŸunda notlar:\n" + +#: readelf.c:10373 +msgid " Owner\t\tData size\tDescription\n" +msgstr " Sahip\t\tVeri Boyu\tAçıklama\n" + +#: readelf.c:10392 +#, c-format +msgid "corrupt note found at offset %x into core notes\n" +msgstr "'core' notlarının içinde, %x görecesinde bozuk not bulundu\n" + +#: readelf.c:10394 +#, c-format +msgid " type: %x, namesize: %08lx, descsize: %08lx\n" +msgstr " tür: %x, isimboyu: %08lx, tanımboyu: %08lx\n" + +#: readelf.c:10476 +msgid "No note segments present in the core file.\n" +msgstr "Core dosyasında not parçaları yok.\n" + +#: readelf.c:10560 +msgid "" +"This instance of readelf has been built without support for a\n" +"64 bit data type and so it cannot read 64 bit ELF files.\n" +msgstr "" +"Bu readelf, 64 bitlik veri türü desteÄŸi olmaksızın derlenmiÅŸtir ve\n" +"64 bitlik ELF dosyalarını okuyamaz.\n" + +#: readelf.c:10606 +#, c-format +msgid "Cannot stat input file %s.\n" +msgstr "%s girdi dosyası durumlanamadı.\n" + +#: readelf.c:10613 +#, c-format +msgid "Input file %s not found.\n" +msgstr "Girdi dosyası %s bulunamadı.\n" + +#: readelf.c:10619 +#, c-format +msgid "%s: Failed to read file header\n" +msgstr "%s: Dosya baÅŸlığı okunamadı\n" + +#: readelf.c:10633 +#, c-format +msgid "" +"\n" +"File: %s\n" +msgstr "" +"\n" +"Dosya: %s\n" + +#: rename.c:132 +#, c-format +msgid "%s: cannot set time: %s" +msgstr "%s: zaman atanamadı: %s" + +#. We have to clean up here. +#: rename.c:171 rename.c:204 +#, c-format +msgid "%s: rename: %s" +msgstr "%s: yeniden adlandırma: %s" + +#: rename.c:212 +#, c-format +msgid "%s: simple_copy: %s" +msgstr "%s: simple_copy: %s" + +#: resbin.c:134 +#, c-format +msgid "%s: not enough binary data" +msgstr "%s: yeterli ikilik veri yok" + +#: resbin.c:153 +msgid "null terminated unicode string" +msgstr "boÅŸ deÄŸerle sonlanmış unicode dizgesi" + +#: resbin.c:183 resbin.c:189 +msgid "resource ID" +msgstr "kaynak ID" + +#: resbin.c:233 +msgid "cursor" +msgstr "gösterge" + +#: resbin.c:267 resbin.c:274 +msgid "menu header" +msgstr "menü baÅŸlığı" + +#: resbin.c:284 +msgid "menuex header" +msgstr "menuex baÅŸlığı" + +#: resbin.c:288 +msgid "menuex offset" +msgstr "menuex basamağı" + +#: resbin.c:295 +#, c-format +msgid "unsupported menu version %d" +msgstr "desteklenmeyen menü sürümü %d" + +#: resbin.c:323 resbin.c:338 resbin.c:404 +msgid "menuitem header" +msgstr "menü üyesi baÅŸlığı" + +#: resbin.c:434 +msgid "menuitem" +msgstr "menü üyesi" + +#: resbin.c:475 resbin.c:503 +msgid "dialog header" +msgstr "diyalog baÅŸlığı" + +#: resbin.c:493 +#, c-format +msgid "unexpected DIALOGEX version %d" +msgstr "beklenmeyen DIALOGEX sürümü %d" + +#: resbin.c:538 +msgid "dialog font point size" +msgstr "diyalog yazıtipi büyüklüğü" + +#: resbin.c:546 +msgid "dialogex font information" +msgstr "dialogex yazıtipi bilgisi" + +#: resbin.c:572 resbin.c:590 +msgid "dialog control" +msgstr "diyalog kontrolü" + +#: resbin.c:582 +msgid "dialogex control" +msgstr "dialogex kontrolü" + +#: resbin.c:611 +msgid "dialog control end" +msgstr "diyalog kontrol sonu" + +#: resbin.c:623 +msgid "dialog control data" +msgstr "diyalog kontrol verisi" + +#: resbin.c:666 +msgid "stringtable string length" +msgstr "dizgetablosu dizge uzunluÄŸu" + +#: resbin.c:676 +msgid "stringtable string" +msgstr "dizgetablosu dizgesi" + +#: resbin.c:709 +msgid "fontdir header" +msgstr "yazıtipi dizin baÅŸlığı" + +#: resbin.c:722 +msgid "fontdir" +msgstr "yazıtipi dizini" + +#: resbin.c:738 +msgid "fontdir device name" +msgstr "yazıtipi aygıt adı" + +#: resbin.c:744 +msgid "fontdir face name" +msgstr "yazıtipi dizini aile ismi" + +#: resbin.c:787 +msgid "accelerator" +msgstr "hızlandırıcı" + +#: resbin.c:851 +msgid "group cursor header" +msgstr "grup gösterge baÅŸlığı" + +#: resbin.c:855 +#, c-format +msgid "unexpected group cursor type %d" +msgstr "beklenmeyen grup gösterge tipi %d" + +#: resbin.c:870 +msgid "group cursor" +msgstr "grup göstergesi" + +#: resbin.c:909 +msgid "group icon header" +msgstr "grup ikon baÅŸlığı" + +#: resbin.c:913 +#, c-format +msgid "unexpected group icon type %d" +msgstr "beklenmeyen grup ikon tipi %d" + +#: resbin.c:928 +msgid "group icon" +msgstr "grup ikonu" + +#: resbin.c:999 resbin.c:1218 +msgid "unexpected version string" +msgstr "dizgenin beklenmeyen sürümü" + +#: resbin.c:1033 +#, c-format +msgid "version length %d does not match resource length %lu" +msgstr "sürüm uzunluÄŸu %d, kaynak uzunluÄŸu %lu ile eÅŸleÅŸmiyor" + +#: resbin.c:1037 +#, c-format +msgid "unexpected version type %d" +msgstr "beklenmeyen sürüm tipi %d" + +#: resbin.c:1049 +#, c-format +msgid "unexpected fixed version information length %d" +msgstr "beklenmeyen sabit sürüm bilgi uzunluÄŸu %d" + +#: resbin.c:1052 +msgid "fixed version info" +msgstr "sabit sürüm bilgisi" + +#: resbin.c:1056 +#, c-format +msgid "unexpected fixed version signature %lu" +msgstr "beklenmeyen sabit sürüm imzası %lu" + +#: resbin.c:1060 +#, c-format +msgid "unexpected fixed version info version %lu" +msgstr "beklenmeyen sabit sürüm bilgisi sürümü %lu" + +#: resbin.c:1089 +msgid "version var info" +msgstr "sürüm deÄŸiÅŸken bilgisi" + +#: resbin.c:1106 +#, c-format +msgid "unexpected stringfileinfo value length %d" +msgstr "beklenmeyen dizge dosya bilgi deÄŸer uzunluÄŸu %d" + +#: resbin.c:1116 +#, c-format +msgid "unexpected version stringtable value length %d" +msgstr "beklenmeyen sürüm dizge tablo deÄŸer uzunluÄŸu %d" + +#: resbin.c:1150 +#, c-format +msgid "unexpected version string length %d != %d + %d" +msgstr "beklenmeyen sürüm dizge uzunluÄŸu %d != %d + %d" + +#: resbin.c:1161 +#, c-format +msgid "unexpected version string length %d < %d" +msgstr "beklenmeyen sürüm dizge uzunluÄŸu %d < %d" + +#: resbin.c:1178 +#, c-format +msgid "unexpected varfileinfo value length %d" +msgstr "beklenmeyen deÄŸiÅŸken dosya bilgi deÄŸer uzunluÄŸu %d" + +#: resbin.c:1197 +msgid "version varfileinfo" +msgstr "deÄŸiÅŸken dosya bilgi sürümü" + +#: resbin.c:1212 +#, c-format +msgid "unexpected version value length %d" +msgstr "beklenmeyen sürüm deÄŸer uzunluÄŸu %d" + +#: rescoff.c:128 +msgid "filename required for COFF input" +msgstr "COFF girdisi için dosya adı gerekli" + +#: rescoff.c:145 +#, c-format +msgid "%s: no resource section" +msgstr "%s: kaynak bölümü yok" + +#: rescoff.c:152 +msgid "can't read resource section" +msgstr "kaynak bölümü okunamıyor" + +#: rescoff.c:178 +#, c-format +msgid "%s: %s: address out of bounds" +msgstr "%s: %s: adres sınırların dışında" + +#: rescoff.c:197 +msgid "directory" +msgstr "dizin" + +#: rescoff.c:225 +msgid "named directory entry" +msgstr "isimli dizin girdisi" + +#: rescoff.c:234 +msgid "directory entry name" +msgstr "dizin girdi ismi" + +#: rescoff.c:254 +msgid "named subdirectory" +msgstr "isimli altdizin" + +#: rescoff.c:262 +msgid "named resource" +msgstr "isimli kaynak" + +#: rescoff.c:277 +msgid "ID directory entry" +msgstr "ID dizin girdisi" + +#: rescoff.c:294 +msgid "ID subdirectory" +msgstr "ID altdizini" + +#: rescoff.c:302 +msgid "ID resource" +msgstr "ID kaynağı" + +#: rescoff.c:328 +msgid "resource type unknown" +msgstr "kaynak tipi bilinmiyor" + +#: rescoff.c:331 +msgid "data entry" +msgstr "veri girdisi" + +#: rescoff.c:339 +msgid "resource data" +msgstr "kaynak verisi" + +#: rescoff.c:344 +msgid "resource data size" +msgstr "kaynak veri boyu" + +#: rescoff.c:439 +msgid "filename required for COFF output" +msgstr "COFF çıktı için dosya adı gerekli" + +#: rescoff.c:738 +msgid "can't get BFD_RELOC_RVA relocation type" +msgstr "BFD_RELOC_RVA yer deÄŸiÅŸtirme tipi alınamıyor" + +#: resrc.c:240 resrc.c:312 +#, c-format +msgid "can't open temporary file `%s': %s" +msgstr "`%s' geçici dosyası açılamıyor: %s" + +#: resrc.c:246 +#, c-format +msgid "can't redirect stdout: `%s': %s" +msgstr "standart çıktı yönlendirilemiyor: `%s': %s" + +#: resrc.c:262 +#, c-format +msgid "%s %s: %s" +msgstr "%s %s: %s" + +#: resrc.c:308 +#, c-format +msgid "can't execute `%s': %s" +msgstr "`%s' çalıştırılamıyor: %s" + +#: resrc.c:317 +#, c-format +msgid "Using temporary file `%s' to read preprocessor output\n" +msgstr "`%s' geçici dosyası öniÅŸlemci çıktısını okumak için kullanılıyor\n" + +#: resrc.c:324 +#, c-format +msgid "can't popen `%s': %s" +msgstr "`%s' popen yapılamıyor: %s" + +#: resrc.c:326 +msgid "Using popen to read preprocessor output\n" +msgstr "ÖniÅŸlemci çıktısı popen ile okunuyor\n" + +#: resrc.c:369 +#, c-format +msgid "Tried `%s'\n" +msgstr "`%s' denendi\n" + +#: resrc.c:380 +#, c-format +msgid "Using `%s'\n" +msgstr "`%s' kullanılıyor\n" + +#: resrc.c:542 +#, c-format +msgid "%s:%d: %s\n" +msgstr "%s:%d: %s\n" + +#: resrc.c:551 +#, c-format +msgid "%s: unexpected EOF" +msgstr "%s: beklenmeyen dosya sonu" + +#: resrc.c:608 +#, c-format +msgid "%s: read of %lu returned %lu" +msgstr "%s: %lu'nun okunması %lu döndürdü" + +#: resrc.c:650 resrc.c:905 resrc.c:1178 resrc.c:1332 +#, c-format +msgid "stat failed on bitmap file `%s': %s" +msgstr "`%s' bitmap dosyası durumlanamadı: %s" + +#: resrc.c:703 +#, c-format +msgid "cursor file `%s' does not contain cursor data" +msgstr "gösterge dosyası '%s' gösterge verisi içermiyor" + +#: resrc.c:735 resrc.c:1049 +#, c-format +msgid "%s: fseek to %lu failed: %s" +msgstr "%s: %lu'ya fseek baÅŸarısız: %s" + +#: resrc.c:873 +msgid "help ID requires DIALOGEX" +msgstr "yardım ID için DIALOGEX gerekli" + +#: resrc.c:875 +msgid "control data requires DIALOGEX" +msgstr "kontrol verisi için DIALOGEX gerekli" + +#: resrc.c:1018 +#, c-format +msgid "icon file `%s' does not contain icon data" +msgstr "ikon dosyası '%s' ikon verisi içermiyor" + +#: resrc.c:1537 +#, c-format +msgid "can't open `%s' for output: %s" +msgstr "'%s' çıktı için açılamadı: %s" + +#: size.c:86 +msgid " Displays the sizes of sections inside binary files\n" +msgstr " İkilik dosyalar içinde bölüm boylarını gösterir\n" + +#: size.c:87 +msgid " If no input file(s) are specified, a.out is assumed\n" +msgstr " EÄŸer girdi dosyası belirtilmezse, a.out varsayılır\n" + +#: size.c:88 +#, c-format +msgid "" +" The options are:\n" +" -A|-B --format={sysv|berkeley} Select output style (default is %s)\n" +" -o|-d|-x --radix={8|10|16} Display numbers in octal, decimal or hex\n" +" -t --totals Display the total sizes (Berkeley only)\n" +" --target= Set the binary file format\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +" Seçenekler:\n" +" -A|-B --format={sysv|berkeley} Çıktı tarzını belirler (%s öntanımlı)\n" +" -o|-d|-x --radix={8|10|16} Rakamları sekizlik, onluk, onaltılık\n" +" olarak gösterir\n" +" -t --totals Toplam boyları gösterir (yalnız\n" +" Berkeley'de)\n" +" --target= İkilik dosya biçemini belirler\n" +" -h --help Bu bilgileri gösterir\n" +" -v --version Sürüm bilgilerini gösterir\n" +"\n" + +#: size.c:160 +#, c-format +msgid "invalid argument to --format: %s" +msgstr "--format'a geçersiz seçenek: %s" + +#: size.c:187 +#, c-format +msgid "Invalid radix: %s\n" +msgstr "Geçersiz radix: %s\n" + +#: srconv.c:1953 +msgid "Convert a COFF object file into a SYSROFF object file\n" +msgstr "Bir COFF nesne dosyasını SYSROFF nesne dosyasına çevirir\n" + +#: srconv.c:1954 +msgid "" +" The options are:\n" +" -q --quick (Obsolete - ignoerd)\n" +" -n --noprescan Do not perform a scan to convert commons into defs\n" +" -d --debug Display information about what is being done\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +" Seçenekler:\n" +" -q --quick (Eski - yoksayılır)\n" +" -n --noprescan common'ları def'lere çevirmek için taramaz\n" +" -d --debug Ne yapıldığı hakkında bilgi verir\n" +" -h --help Bu bilgiyi gösterir\n" +" -v --version Sürüm numarasını gösterir\n" + +#: srconv.c:2099 +#, c-format +msgid "unable to open output file %s" +msgstr "çıktı dosyası %s açılamadı" + +#: stabs.c:346 stabs.c:1755 +msgid "numeric overflow" +msgstr "sayısal taÅŸma" + +#: stabs.c:357 +#, c-format +msgid "Bad stab: %s\n" +msgstr "Kötü stab: %s\n" + +#: stabs.c:367 +#, c-format +msgid "Warning: %s: %s\n" +msgstr "Uyarı: %s: %s\n" + +#: stabs.c:488 +msgid "N_LBRAC not within function\n" +msgstr "N_LBRAC iÅŸlev içerisinde deÄŸil\n" + +#: stabs.c:527 +msgid "Too many N_RBRACs\n" +msgstr "Fazla sayıda N_RBRAC\n" + +#: stabs.c:773 +msgid "unknown C++ encoded name" +msgstr "Bilinmeyen C++ ÅŸifreli ismi" + +#. Complain and keep going, so compilers can invent new +#. cross-reference types. +#: stabs.c:1293 +msgid "unrecognized cross reference type" +msgstr "tanınmayan çapraz baÅŸvuru tipi" + +#. Does this actually ever happen? Is that why we are worrying +#. about dealing with it rather than just calling error_type? +#: stabs.c:1847 +msgid "missing index type" +msgstr "eksik endeks tipi" + +#: stabs.c:2174 +msgid "unknown virtual character for baseclass" +msgstr "temel sınıf için bilinmeyen sanal karakter" + +#: stabs.c:2192 +msgid "unknown visibility character for baseclass" +msgstr "temel sınıf için bilinmeyen görünebilirlik karakteri" + +#: stabs.c:2384 +msgid "unnamed $vb type" +msgstr "isimlenmemiÅŸ $vb tipi" + +#: stabs.c:2390 +msgid "unrecognized C++ abbreviation" +msgstr "tanınmayan C++ kısaltması" + +#: stabs.c:2470 +msgid "unknown visibility character for field" +msgstr "alan için bilinmeyen görünürlük karakteri" + +#: stabs.c:2726 +msgid "const/volatile indicator missing" +msgstr "sabit/deÄŸiÅŸken belirteci eksik" + +#: stabs.c:2967 +#, c-format +msgid "No mangling for \"%s\"\n" +msgstr "\"%s\" için karıştırma yok\n" + +#: stabs.c:3281 +msgid "Undefined N_EXCL" +msgstr "N_EXCL tanımsız" + +#: stabs.c:3369 +#, c-format +msgid "Type file number %d out of range\n" +msgstr "Tip dosya numarası %d aralık dışı\n" + +#: stabs.c:3374 +#, c-format +msgid "Type index number %d out of range\n" +msgstr "Tip endeks numarası %d aralık dışı\n" + +#: stabs.c:3461 +#, c-format +msgid "Unrecognized XCOFF type %d\n" +msgstr "Bilinmeyen XCOFF tipi %d\n" + +#: stabs.c:3762 +#, c-format +msgid "bad mangled name `%s'\n" +msgstr "kötü karıştırılmış isim '%s'\n" + +#: stabs.c:3859 +msgid "no argument types in mangled string\n" +msgstr "karıştırılmış dizgede argüman tipi yok\n" + +#: strings.c:208 +#, c-format +msgid "invalid number %s" +msgstr "geçersiz sayı %s" + +#: strings.c:647 +#, c-format +msgid "invalid integer argument %s" +msgstr "geçersiz tamsayı argümanı %s" + +#: strings.c:658 +msgid " Display printable strings in [file(s)] (stdin by default)\n" +msgstr " [dosya(lar)]daki yazdırılabilir dizgeleri gösterir (öntanımlı standart girdi)\n" + +#: strings.c:659 +msgid "" +" The options are:\n" +" -a - --all Scan the entire file, not just the data section\n" +" -f --print-file-name Print the name of the file before each string\n" +" -n --bytes=[number] Locate & print any NUL-terminated sequence of at\n" +" - least [number] characters (default 4).\n" +" -t --radix={o,x,d} Print the location of the string in base 8, 10 or 16\n" +" -o An alias for --radix=o\n" +" -T --target= Specify the binary file format\n" +" -e --encoding={s,S,b,l,B,L} Select character size and endianness:\n" +" s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +" Seçenekler:\n" +" -a - --all Yalnız veri bölümünü deÄŸil, bütün dosyayı tarar\n" +" -f --print-file-name Her dizgeden önce dosya adını yazdırır\n" +" -n --bytes=[sayı] En az [sayı] karakterde ve NUL ile sonlanmış olan\n" +" - bütün dizgeleri yazdırır (öntanımlı 4)\n" +" -t --radix={o,x,d} Dizgenin yerini 8'lik, 10'luk veya 16'lık düzende\n" +" yazdırır\n" +" -o --radix=o ile aynı\n" +" -T --target= İkilik dosya biçemini belirtir\n" +" -e --encoding={s,S,b,l,B,L} Karakter boyu ve sonlamayı seçtirir:\n" +" s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n" +" -h --help Bu bilgiyi gösterir\n" +" -v --version Yazılımın sürüm no'sunu gösterir\n" + +#: sysdump.c:768 +msgid "Print a human readable interpretation of a SYSROFF object file\n" +msgstr "SYSROFF nesne dosyasını insan tarafından okunabilir biçemde yazdırır\n" + +#: sysdump.c:769 +msgid "" +" The options are:\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +" Seçenekler:\n" +" -h --help Bu bilgiyi gösterir\n" +" -v --version Yazılımın sürüm no'sunu gösterir\n" + +#: sysdump.c:836 +#, c-format +msgid "cannot open input file %s" +msgstr "%s girdi dosyası açılamadı" + +#: version.c:36 +msgid "Copyright 2002 Free Software Foundation, Inc.\n" +msgstr "Telif Hakkı (c) 2002 Free Software Foundation, Inc.\n" + +#: version.c:37 +msgid "" +"This program is free software; you may redistribute it under the terms of\n" +"the GNU General Public License. This program has absolutely no warranty.\n" +msgstr "" +"Bu, bir serbest yazılımdır; GNU Genel Kamu Lisansı koÅŸulları altında deÄŸiÅŸiklik \n" +"yapabilir ve/veya yeniden dağıtabilirsiniz. \n" +"Bu yazılımın herhangi bir garantisi yoktur.\n" + +#: windres.c:205 +#, c-format +msgid "can't open %s `%s': %s" +msgstr "%s `%s' açılamadı: %s" + +#: windres.c:384 +msgid ": expected to be a directory\n" +msgstr ": dizin beklendi\n" + +#: windres.c:396 +msgid ": expected to be a leaf\n" +msgstr ": yaprak beklendi\n" + +#: windres.c:405 +#, c-format +msgid "%s: warning: " +msgstr "%s: uyarı: " + +#: windres.c:407 +msgid ": duplicate value\n" +msgstr ": çift deÄŸer\n" + +#: windres.c:569 +#, c-format +msgid "unknown format type `%s'" +msgstr "bilinmeyen biçem tipi `%s'" + +#: windres.c:570 +#, c-format +msgid "%s: supported formats:" +msgstr "%s: desteklenen biçemler:" + +#. Otherwise, we give up. +#: windres.c:655 +#, c-format +msgid "can not determine type of file `%s'; use the -I option" +msgstr "`%s' dosyasının tipi belirlenemedi; -I seçeneÄŸini kullanın" + +#: windres.c:669 +#, c-format +msgid "Usage: %s [option(s)] [input-file] [output-file]\n" +msgstr "Kullanım: %s [seçenekler] [girdi-dosyası] [çıktı-dosyası]\n" + +#: windres.c:671 +msgid "" +" The options are:\n" +" -i --input= Name input file\n" +" -o --output= Name output file\n" +" -J --input-format= Specify input format\n" +" -O --output-format= Specify output format\n" +" -F --target= Specify COFF target\n" +" --preprocessor= Program to use to preprocess rc file\n" +" -I --include-dir= Include directory when preprocessing rc file\n" +" -D --define [=] Define SYM when preprocessing rc file\n" +" -U --undefine Undefine SYM when preprocessing rc file\n" +" -v --verbose Verbose - tells you what it's doing\n" +" -l --language= Set language when reading rc file\n" +" --use-temp-file Use a temporary file instead of popen to read\n" +" the preprocessor output\n" +" --no-use-temp-file Use popen (default)\n" +msgstr "" +"Seçenekler:\n" +" -i --input= Girdi dosyası ismi\n" +" -o --output= Çıktı dosyası ismi\n" +" -J --input-format= Girdi biçemini belirtir\n" +" -O --output-format= Çıktı biçemini belirtir\n" +" -F --target= COFF hedefini belirtir\n" +" --preprocessor= rc dosyasını öniÅŸlemek için kullanılacak yazılım\n" +" -I --include-dir= rc dosyası öniÅŸlenirken dizini dahil et\n" +" -D --define SYM[=DEÄžER] rc dosyası öniÅŸlenirken SYM'i tanımlar\n" +" -v --verbose Açıklamalı - ne yapıldığını anlatır\n" +" -l --language= rc dosyası okunurken dili belirtir\n" +" --use-temp-file ÖniÅŸlemci çıktısını okumak için popen yerine\n" +" geçici dosya kullanır\n" +" --no-use-temp-file (öntanımlı) popen kullanır\n" + +#: windres.c:687 +msgid " --yydebug Turn on parser debugging\n" +msgstr " --yydebug Tarayıcıda hata ayıklamayı etkinleÅŸtirir\n" + +#: windres.c:690 +msgid "" +" -r Ignored for compatibility with rc\n" +" -h --help Print this help message\n" +" -V --version Print version information\n" +msgstr "" +" -r rc ile uyumluluk için yok sayılır\n" +" -h --help Bu yardımı gösterir\n" +" -V --version Sürüm bilgisini gösterir\n" + +#: windres.c:694 +msgid "" +"FORMAT is one of rc, res, or coff, and is deduced from the file name\n" +"extension if not specified. A single file name is an input file.\n" +"No input-file is stdin, default rc. No output-file is stdout, default rc.\n" +msgstr "" +"BİÇEM rc, res, veya coff deÄŸerlerinden biri olup, eÄŸer belirtilmezse dosya ismi sonekinden bulunur. Tek bir dosya ismi bir girdi dosyası kabul edilir\n" +"Girdi dosya ismi verilmezse standart girdi, öntanımlı rc okunur. \n" +"Çıktı dosya ismi verilmezse standart çıktı, öntanımlı rc okunur.\n" + +#: windres.c:833 +msgid "invalid option -f\n" +msgstr "Geçersiz seçenek -f\n" + +#: windres.c:838 +msgid "No filename following the -fo option.\n" +msgstr "-fo seçeneÄŸinden sonra dosya adı verilmemiÅŸ.\n" + +#: windres.c:896 +msgid "Option -I is deprecated for setting the input format, please use -J instead.\n" +msgstr "Girdi biçemini belirlemek için -I seçeneÄŸi artık kullanılmıyor, -J kullanın.\n" + +#: windres.c:1014 +msgid "no resources" +msgstr "kaynak yok" + +#: wrstabs.c:395 wrstabs.c:2055 +#, c-format +msgid "string_hash_lookup failed: %s" +msgstr "string_hash_lookup baÅŸarısız: %s" + +#: wrstabs.c:695 +#, c-format +msgid "stab_int_type: bad size %u" +msgstr "stab_int_type: hatalı boy %u" + +#: wrstabs.c:1495 +#, c-format +msgid "%s: warning: unknown size for field `%s' in struct" +msgstr "%s: uyarı: Yapı içinde `%s' alanı için bilinmeyen boy" + +#~ msgid "debug_record_variable: no current block" +#~ msgstr "hata_ayıkla_kayıt_deÄŸiÅŸken: mevcut blok yok" + +#~ msgid "%s: No dynamic symbols" +#~ msgstr "%s: Dinamik sembol yok" + +#~ msgid "64-bit DWARF line info is not supported yet.\n" +#~ msgstr "64 bitlik DWARF satır bilgisi henüz desteklenmiyor.\n" + +#~ msgid "64-bit DWARF pubnames are not supported yet.\n" +#~ msgstr "64 bitlik DWARF genel isimleri henüz desteklenmiyor\n" + +#~ msgid "64-bit DWARF debug info is not supported yet.\n" +#~ msgstr "64 bitlik DWARF hata ayıklama bilgisi henüz desteklenmiyor.\n" + +#~ msgid "64-bit DWARF aranges are not supported yet.\n" +#~ msgstr "64 bitlik DWARF a-aralıkları henüz desteklenmiyor.\n" + +#~ msgid "64-bit DWARF format frames are not supported yet.\n" +#~ msgstr "64 bitlik DWARF biçem çerçeveleri henüz desteklenmiyor.\n" + +#~ msgid "" +#~ " -h --help Print this help message\n" +#~ " -V --version Print version information\n" +#~ msgstr "" +#~ " -h --help Bu yardımı gösterir\n" +#~ " -V --version Bu sürüm bilgisini gösterir\n" + +#~ msgid "" +#~ "Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n" +#~ " [-e executable] [--exe=executable] [--demangle[=style]]\n" +#~ " [--basenames] [--functions] [addr addr ...]\n" +#~ msgstr "" +#~ "Kullanım: %s [-CfsHV] [-b bfd_adı] \n" +#~ " [--target=bfd_adı] hedef\n" +#~ " [-e uygulama] [--exe=uygulama] \n" +#~ " [--demangle[=tarz]] düzeltme tarzı\n" +#~ " [--basenames] temel isimler\n" +#~ " [--functions] [adres adres ...] iÅŸlevler\n" + +#~ msgid "" +#~ "Usage: %s [-dhV] [-I bfdname] [-O bfdname] [-T header-file] [-l linker]\n" +#~ " [--input-target=bfdname] [--output-target=bfdname]\n" +#~ " [--header-file=file] [--linker=linker] [--debug]\n" +#~ " [--help] [--version]\n" +#~ " [in-file [out-file]]\n" +#~ msgstr "" +#~ "Kullanım: %s [-dhV] [-I bfd_adı] [-O bfd_adı] [-T baÅŸlık-dosyası]\n" +#~ " [-l baÄŸlayıcı]\n" +#~ " [--input-target=bfd_adı] girdi dosyası adı\n" +#~ " [--output-target=bfd_adı] çıktı dosyası adı\n" +#~ " [--header-file=dosya] baÅŸlık dosyası adı\n" +#~ " [--linker=baÄŸlayıcı] baÄŸlayıcı yazılım adı\n" +#~ " [--debug] hata ayıklama kipi\n" +#~ " [--help] bu yardımı gösterir\n" +#~ " [--version] sürüm bilgisini gösterir\n" +#~ " [girdi-dosyası [çıktı-dosyası]]\n" + +#~ msgid "Usage: %s [OPTION]... [FILE]...\n" +#~ msgstr "Kullanım: %s [SEÇENEK]... [DOSYA]...\n" + +#~ msgid "Usage: %s OPTION... FILE...\n" +#~ msgstr "Kullanım: %s SEÇENEK... DOSYA...\n" + +#~ msgid " Options are:\n" +#~ msgstr " Seçenekler:\n" + +#~ msgid " -a or --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" +#~ msgstr " -a veya --all Buna eÅŸit: -h -l -S -s -r -d -V -A -I\n" + +#~ msgid " -h or --file-header Display the ELF file header\n" +#~ msgstr " -h veya --file-header ELF dosyası baÅŸlığını gösterir\n" + +#~ msgid " -l or --program-headers or --segments\n" +#~ msgstr " -l veya --program-headers veya --segments\n" + +#~ msgid " Display the program headers\n" +#~ msgstr " Yazılım baÅŸlıklarını gösterir\n" + +#~ msgid " -S or --section-headers or --sections\n" +#~ msgstr " -S veya --section-headers veya --sections\n" + +#~ msgid " Display the sections' header\n" +#~ msgstr " Bölüm baÅŸlıklarını gösterir\n" + +#~ msgid " -e or --headers Equivalent to: -h -l -S\n" +#~ msgstr " -e veya --headers Buna eÅŸit: -h -l -S\n" + +#~ msgid " -s or --syms or --symbols Display the symbol table\n" +#~ msgstr " -s veya --syms veya --symbols Sembol tablosunu gösterir\n" + +#~ msgid " -n or --notes Display the core notes (if present)\n" +#~ msgstr " -n veya --notes (EÄŸer varsa) core notlarını gösterir\n" + +#~ msgid " -r or --relocs Display the relocations (if present)\n" +#~ msgstr " -r veya --relocs (EÄŸer varsa) yer deÄŸiÅŸtirmeleri gösterir\n" + +#~ msgid " -u or --unwind Display the unwind info (if present)\n" +#~ msgstr " -u veya --unwind (EÄŸer varsa) geri alma bilgisini gösterir\n" + +#~ msgid " -d or --dynamic Display the dynamic segment (if present)\n" +#~ msgstr " -d veya --dynamic (EÄŸer varsa) dinamik bölümü gösterir\n" + +#~ msgid " -V or --version-info Display the version sections (if present)\n" +#~ msgstr " -V veya --version-info (EÄŸer varsa) sürüm bölümlerini gösterir\n" + +#~ msgid " -A or --arch-specific Display architecture specific information (if any).\n" +#~ msgstr " -A veya --arch-specific (EÄŸer varsa) mimariye özel bilgiyi gösterir.\n" + +#~ msgid " -D or --use-dynamic Use the dynamic section info when displaying symbols\n" +#~ msgstr " -D veya --use-dynamic Sembolleri gösterirken dinamik bölüm bilgisini kullanır\n" + +#~ msgid " -x or --hex-dump=\n" +#~ msgstr " -x veya --hex-dump=\n" + +#~ msgid " Dump the contents of section \n" +#~ msgstr " bölümünün içeriÄŸini gösterir\n" + +#~ msgid " -w[liaprmfs] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str]\n" +#~ msgstr " -w[liaprmfs] veya --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str]\n" + +#~ msgid " Display the contents of DWARF2 debug sections\n" +#~ msgstr " DWARF2 hata ayıklama bölümlerinin içeriÄŸini gösterir\n" + +#~ msgid " -i or --instruction-dump=\n" +#~ msgstr " -i veya --instruction-dump=\n" + +#~ msgid " -I or --histogram Display histogram of bucket list lengths\n" +#~ msgstr " -I veya --histogram Küme liste uzunluÄŸu geçmiÅŸ grafiÄŸini gösterir\n" + +#~ msgid " -v or --version Display the version number of readelf\n" +#~ msgstr " -v veya --version readelf'in sürüm numarasını gösterir\n" + +#~ msgid " -W or --wide Don't split lines or truncate symbols to fit into 80 columns\n" +#~ msgstr " -W veya --wide 80 sütuna sığdırmak için satırları bölmez veya kesmez\n" + +#~ msgid " -H or --help Display this information\n" +#~ msgstr " -H veya --help Bu bilgiyi gösterir\n" + +#~ msgid "unexpected dialog signature %d" +#~ msgstr "beklenmeyen diyalog imzası %d" + +#~ msgid "" +#~ "Usage: %s [-A | --format=sysv | -B | --format=berkeley]\n" +#~ " [-o | --radix=8 | -d | --radix=10 | -h | --radix=16]\n" +#~ " [-V | --version] [--target=bfdname] [--help] [file...]\n" +#~ msgstr "" +#~ "Kullanım: %s [-A | --format=sysv | -B | --format=berkeley] Biçem\n" +#~ " [-o | --radix=8 | -d | --radix=10 | -h | --radix=16]\n" +#~ " [-V | --version] Sürüm\n" +#~ " [--target=bfd_adı] Hedef\n" +#~ " [--help] Yardım\n" +#~ " [dosya...] [dosya]\n" + +#~ msgid "default is --format=berkeley\n" +#~ msgstr "--format=berkeley öntanımlı\n" + +#~ msgid "default is --format=sysv\n" +#~ msgstr "--format=sysv öntanımlı\n" + +#~ msgid "Usage: %s [-dhVq] in-file [out-file]\n" +#~ msgstr "Kullanım: %s [-dhVq] girdi-dosyası [çıktı-dosyası]\n" + +#~ msgid "" +#~ "Usage: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-e {s,b,l,B,L}]\n" +#~ " [-] [--all] [--print-file-name] [--bytes=min-len] [--radix={o,x,d}]\n" +#~ " [--target=bfdname] [--encoding {s,b,l,B,L}] [--help] [--version] file...\n" +#~ msgstr "" +#~ "Kullanım: %s [-afov] [-n min-uzun] [-min-len] En az uzunluk\n" +#~ " [-t {o,x,d}] [-e {s,b,l,B,L}] [-]\n" +#~ " [--all] Hepsi\n" +#~ " [--print-file-name] Dosya adını yazdırır\n" +#~ " [--bytes=min-uzun] En az bayt\n" +#~ " [--radix={o,x,d}]\n" +#~ " [--target=bfd_adı] Hedef\n" +#~ " [--encoding {s,b,l,B,L}] Kodlama\n" +#~ " [--help] Yardım\n" +#~ " [--version] Sürüm bilgisi\n" +#~ " dosya... \n" + +#~ msgid "Usage: %s [-hV] in-file\n" +#~ msgstr "Kullanım: %s [-hV] girdi-dosyası\n" diff --git a/binutils/po/zh_CN.gmo b/binutils/po/zh_CN.gmo new file mode 100644 index 0000000000000..04e985e361fd5 Binary files /dev/null and b/binutils/po/zh_CN.gmo differ diff --git a/binutils/po/zh_CN.po b/binutils/po/zh_CN.po new file mode 100644 index 0000000000000..cf8589825b980 --- /dev/null +++ b/binutils/po/zh_CN.po @@ -0,0 +1,4742 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2003 Free Software Foundation, Inc. +# Wang Li , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: binutils 2.12.91\n" +"POT-Creation-Date: 2002-07-23 15:55-0400\n" +"PO-Revision-Date: 2003-05-09 17:28+0800\n" +"Last-Translator: Wang Li \n" +"Language-Team: Chinese (simplified) \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=gb2312\n" +"Content-Transfer-Encoding: 8bit\n" + +#: addr2line.c:74 +#, c-format +msgid "Usage: %s [option(s)] [addr(s)]\n" +msgstr "Ó÷¨£º%s [Ñ¡Ïî] [µØÖ·]\n" + +#: addr2line.c:75 +msgid " Convert addresses into line number/file name pairs.\n" +msgstr " ½«µØÖ·×ª»»³ÉÎļþÃû/ÐкŶԡ£\n" + +#: addr2line.c:76 +msgid " If no addresses are specified on the command line, they will be read from stdin\n" +msgstr " Èç¹ûûÓÐÔÚÃüÁîÐÐÖиø³öµØÖ·£¬¾Í´Ó±ê×¼ÊäÈëÖжÁÈ¡ËüÃÇ\n" + +#: addr2line.c:77 +msgid "" +" The options are:\n" +" -b --target= Set the binary file format\n" +" -e --exe= Set the input file name (default is a.out)\n" +" -s --basenames Strip directory names\n" +" -f --functions Show function names\n" +" -C --demangle[=style] Demangle function names\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +" Ñ¡ÏîΪ£º\n" +" -b --target= É趨¶þ½øÖÆÎļþ¸ñʽ\n" +" -e --exe= É趨ÊäÈëÎļþÃû (ĬÈÏΪ a.out)\n" +" -s --basenames È¥³ýĿ¼Ãû\n" +" -f --functions ÏÔʾº¯ÊýÃû\n" +" -C --demangle[=style] ½âÂ뺯ÊýÃû\n" +" -h --help ÏÔʾ±¾ÐÅÏ¢\n" +" -v --version ÏÔʾ³ÌÐòµÄ°æ±¾ºÅ\n" +"\n" + +#: addr2line.c:89 ar.c:297 coffdump.c:479 nlmconv.c:1119 objcopy.c:424 +#: objcopy.c:457 readelf.c:2310 size.c:104 srconv.c:1962 strings.c:666 +#: sysdump.c:774 windres.c:733 +#, c-format +msgid "Report bugs to %s\n" +msgstr "½« bug ±¨¸æµ½ %s\n" + +#: addr2line.c:248 +#, c-format +msgid "%s: can not get addresses from archive" +msgstr "%s£ºÎÞ·¨´Ó¹éµµÎļþÖеõ½µØÖ·" + +#: addr2line.c:320 nm.c:395 objdump.c:2782 +#, c-format +msgid "unknown demangling style `%s'" +msgstr "δ֪µÄ½âÂë(demangle)·ç¸ñ¡°%s¡±" + +#: ar.c:238 +#, c-format +msgid "no entry %s in archive\n" +msgstr "¹éµµÎļþÖÐûÓÐÌõÄ¿ %s\n" + +#: ar.c:255 +#, c-format +msgid "Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n" +msgstr "Ó÷¨£º%s [·ÂÕæÑ¡Ïî] [-]{dmpqrstx}[abcfilNoPsSuvV] [³ÉÔ±Ãû] [¼ÆÊý] ¹éµµÎļþ Îļþ...\n" + +#: ar.c:258 +#, c-format +msgid " %s -M [\n" +"\n" +msgstr "" +"\n" +"<³ÉÔ± %s>\n" +"\n" + +#: ar.c:857 ar.c:925 +#, c-format +msgid "%s is not a valid archive" +msgstr "%s ²»ÊÇÓÐЧµÄ¹éµµÎļþ" + +#: ar.c:893 +#, c-format +msgid "stat returns negative size for %s" +msgstr "stat %s ·µ»Ø¸ºÊý´óС" + +#: ar.c:1020 +#, c-format +msgid "%s is not an archive" +msgstr "%s ²»Êǹ鵵Îļþ" + +#: ar.c:1027 +#, c-format +msgid "creating %s" +msgstr "ÕýÔÚ´´½¨ %s" + +#: ar.c:1233 +#, c-format +msgid "No member named `%s'\n" +msgstr "ûÓÐÃûΪ¡°%s¡±µÄ³ÉÔ±\n" + +#: ar.c:1285 +#, c-format +msgid "no entry %s in archive %s!" +msgstr "¹éµµÎļþ %2$s ÖÐûÓÐÌõÄ¿ %1$s£¡" + +#: ar.c:1422 +#, c-format +msgid "%s: no archive map to update" +msgstr "%s£ºÃ»ÓÐÒª¸üеĹ鵵ӳÉä" + +#: arsup.c:86 +#, c-format +msgid "No entry %s in archive.\n" +msgstr "¹éµµÎļþÖÐûÓÐÌõÄ¿ %s¡£\n" + +#: arsup.c:117 +#, c-format +msgid "Can't open file %s\n" +msgstr "ÎÞ·¨´ò¿ªÎļþ %s\n" + +#: arsup.c:172 +#, c-format +msgid "%s: Can't open output archive %s\n" +msgstr "%s£ºÎÞ·¨´ò¿ªÊä³ö¹éµµ %s\n" + +#: arsup.c:189 +#, c-format +msgid "%s: Can't open input archive %s\n" +msgstr "%s£ºÎÞ·¨´ò¿ªÊäÈë¹éµµ %s\n" + +#: arsup.c:198 +#, c-format +msgid "%s: file %s is not an archive\n" +msgstr "%s£ºÎļþ %s ²»Êǹ鵵Îļþ\n" + +#: arsup.c:241 +#, c-format +msgid "%s: no output archive specified yet\n" +msgstr "%s£ºÉÐδָ¶¨Êä³ö¹éµµÎļþ\n" + +#: arsup.c:262 arsup.c:301 arsup.c:343 arsup.c:364 arsup.c:430 +#, c-format +msgid "%s: no open output archive\n" +msgstr "%s£ºÎ´´ò¿ªÊä³ö¹éµµÎļþ\n" + +#: arsup.c:273 arsup.c:385 arsup.c:411 +#, c-format +msgid "%s: can't open file %s\n" +msgstr "%s£ºÎÞ·¨´ò¿ªÎļþ %s\n" + +#: arsup.c:328 arsup.c:407 arsup.c:489 +#, c-format +msgid "%s: can't find module file %s\n" +msgstr "%s£ºÎÞ·¨ÕÒµ½Ä£¿éÎļþ %s\n" + +#: arsup.c:439 +#, c-format +msgid "Current open archive is %s\n" +msgstr "µ±Ç°´ò¿ªµÄ¹éµµÎļþÊÇ %s\n" + +#: arsup.c:464 +#, c-format +msgid "%s: no open archive\n" +msgstr "%s£ºÎ´´ò¿ª¹éµµÎļþ\n" + +#: binemul.c:39 +#, c-format +msgid " No emulation specific options\n" +msgstr " ûÓзÂÕæÌØÓеÄÑ¡Ïî\n" + +#. Macros for common output. +#: binemul.h:42 +#, c-format +msgid " emulation options: \n" +msgstr " ·ÂÕæÑ¡Ï\n" + +#: bucomm.c:106 +#, c-format +msgid "can't set BFD default target to `%s': %s" +msgstr "ÎÞ·¨½« BFD ĬÈϱêµÄÉèÖÃΪ¡°%s¡±£º%s" + +#: bucomm.c:118 +#, c-format +msgid "%s: Matching formats:" +msgstr "%s£ºÆ¥Åä¸ñʽ£º" + +#: bucomm.c:135 +msgid "Supported targets:" +msgstr "Ö§³ÖµÄÄ¿±ê£º" + +#: bucomm.c:137 +#, c-format +msgid "%s: supported targets:" +msgstr "%s£ºÖ§³ÖµÄÄ¿±ê£º" + +#: bucomm.c:153 +msgid "Supported architectures:" +msgstr "Ö§³ÖµÄÌåϵ½á¹¹£º" + +#: bucomm.c:155 +#, c-format +msgid "%s: supported architectures:" +msgstr "%s£ºÖ§³ÖµÄÌåϵ½á¹¹£º" + +#: bucomm.c:262 +#, c-format +msgid "%s: bad number: %s" +msgstr "%s£º´íÎóµÄ±àºÅ£º%s" + +#: coffdump.c:107 +#, c-format +msgid "#lines %d " +msgstr "#ÐкŠ%d " + +#: coffdump.c:471 sysdump.c:767 +#, c-format +msgid "Usage: %s [option(s)] in-file\n" +msgstr "Ó÷¨£º%s [Ñ¡Ïî] ÊäÈëÎļþ\n" + +#: coffdump.c:472 +msgid " Print a human readable interpretation of a SYSROFF object file\n" +msgstr " ´òÓ¡ÊÊÓÚÔĶÁµÄ¶Ô SYSROFF Ä¿±êÎļþµÄ½âÊÍ\n" + +#: coffdump.c:473 +msgid "" +" The options are:\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +" Ñ¡ÏîΪ£º\n" +" -h --help ÏÔʾ±¾ÇóÖúÐÅÏ¢\n" +" -v --version ÏÔʾ³ÌÐòµÄ°æ±¾ºÅ\n" +"\n" + +#: coffdump.c:541 srconv.c:2052 sysdump.c:831 +msgid "no input file specified" +msgstr "δָ¶¨ÊäÈëÎļþ" + +#: debug.c:653 +msgid "debug_add_to_current_namespace: no current file" +msgstr "debug_add_to_current_namespace£ºÃ»Óе±Ç°Îļþ" + +#: debug.c:736 +msgid "debug_start_source: no debug_set_filename call" +msgstr "debug_start_source£ºÃ»ÓÐ debug_set_filename µ÷ÓÃ" + +#: debug.c:795 +msgid "debug_record_function: no debug_set_filename call" +msgstr "debug_record_function£ºÃ»ÓÐ debug_set_filename µ÷ÓÃ" + +#: debug.c:851 +msgid "debug_record_parameter: no current function" +msgstr "debug_record_parameter£ºÃ»Óе±Ç°º¯Êý" + +#: debug.c:885 +msgid "debug_end_function: no current function" +msgstr "debug_end_function£ºÃ»Óе±Ç°º¯Êý" + +#: debug.c:891 +msgid "debug_end_function: some blocks were not closed" +msgstr "debug_end_function£ºÄ³Ð©¿éûÓйرÕ" + +#: debug.c:921 +msgid "debug_start_block: no current block" +msgstr "debug_start_block£ºÃ»Óе±Ç°¿é" + +#: debug.c:959 +msgid "debug_end_block: no current block" +msgstr "debug_end_block£ºÃ»Óе±Ç°¿é" + +#: debug.c:966 +msgid "debug_end_block: attempt to close top level block" +msgstr "debug_end_block£ºÊÔͼ¹Ø±Õ¶¥²ã¿é" + +#: debug.c:992 +msgid "debug_record_line: no current unit" +msgstr "debug_record_line£ºÃ»Óе±Ç°µ¥Ôª" + +#. FIXME +#: debug.c:1046 +msgid "debug_start_common_block: not implemented" +msgstr "debug_start_common_block£ºÎ´ÊµÏÖ" + +#. FIXME +#: debug.c:1058 +msgid "debug_end_common_block: not implemented" +msgstr "debug_end_common_block£ºÎ´ÊµÏÖ" + +#. FIXME. +#: debug.c:1152 +msgid "debug_record_label: not implemented" +msgstr "debug_record_label£ºÎ´ÊµÏÖ" + +#: debug.c:1178 +msgid "debug_record_variable: no current file" +msgstr "debug_record_variable£ºÃ»Óе±Ç°Îļþ" + +#: debug.c:1194 +msgid "debug_record_variable: no current block" +msgstr "debug_record_variable£ºÃ»Óе±Ç°¿é" + +#: debug.c:1763 +msgid "debug_make_undefined_type: unsupported kind" +msgstr "debug_make_undefined_type£º²»Ö§³ÖµÄÖÖÀà" + +#: debug.c:1964 +msgid "debug_name_type: no current file" +msgstr "debug_name_type£ºÃ»Óе±Ç°Îļþ" + +#: debug.c:2012 +msgid "debug_tag_type: no current file" +msgstr "debug_tag_type£ºÃ»Óе±Ç°Îļþ" + +#: debug.c:2020 +msgid "debug_tag_type: extra tag attempted" +msgstr "debug_tag_type£ºÒѳ¢ÊÔ¸ü¶àµÄ±ê¼Ç" + +#: debug.c:2059 +#, c-format +msgid "Warning: changing type size from %d to %d\n" +msgstr "¾¯¸æ£ºÀàÐÍ´óСÓÉ %d ¸ÄΪ %d\n" + +#: debug.c:2083 +msgid "debug_find_named_type: no current compilation unit" +msgstr "debug_find_named_type£ºÃ»Óе±Ç°±àÒëµ¥Ôª" + +#: debug.c:2190 +#, c-format +msgid "debug_get_real_type: circular debug information for %s\n" +msgstr "debug_get_real_type£º¹ØÓÚ %s µÄÑ­»·µ÷ÊÔÐÅÏ¢\n" + +#: debug.c:2650 +msgid "debug_write_type: illegal type encountered" +msgstr "debug_write_type£ºÓöµ½·Ç·¨ÀàÐÍ" + +#: dlltool.c:735 dlltool.c:760 dlltool.c:786 +#, c-format +msgid "Internal error: Unknown machine type: %d" +msgstr "ÄÚ²¿´íÎó£ºÎ´ÖªµÄ»úÆ÷ÀàÐÍ£º%d" + +#: dlltool.c:823 +#, c-format +msgid "Can't open def file: %s" +msgstr "ÎÞ·¨´ò¿ª def Îļþ£º%s" + +#: dlltool.c:828 +#, c-format +msgid "Processing def file: %s" +msgstr "´¦Àí def Îļþ£º%s" + +#: dlltool.c:832 +msgid "Processed def file" +msgstr "ÒÑ´¦ÀíµÄ def Îļþ" + +#: dlltool.c:858 +#, c-format +msgid "Syntax error in def file %s:%d" +msgstr "def ÎļþÖÐÓï·¨´íÎó %s£º%d" + +#: dlltool.c:897 +#, c-format +msgid "NAME: %s base: %x" +msgstr "" + +#: dlltool.c:900 dlltool.c:919 +msgid "Can't have LIBRARY and NAME" +msgstr "" + +#: dlltool.c:916 +#, c-format +msgid "LIBRARY: %s base: %x" +msgstr "" + +#: dlltool.c:1174 resrc.c:271 +#, c-format +msgid "wait: %s" +msgstr "µÈ´ý£º%s" + +#: dlltool.c:1179 dllwrap.c:430 resrc.c:276 +#, c-format +msgid "subprocess got fatal signal %d" +msgstr "×Ó½ø³ÌÊÕµ½ÖÂÃüÐźŠ%d" + +#: dlltool.c:1185 dllwrap.c:437 resrc.c:283 +#, c-format +msgid "%s exited with status %d" +msgstr "%s ÒÔ״̬ %d Í˳ö" + +#: dlltool.c:1217 +#, c-format +msgid "Sucking in info from %s section in %s" +msgstr "´Ó %2$s ÖÐµÄ %1$s ½Ú»ñÈ¡ÐÅÏ¢" + +#: dlltool.c:1341 +#, c-format +msgid "Excluding symbol: %s" +msgstr "" + +#: dlltool.c:1436 dlltool.c:1447 nm.c:959 nm.c:970 objdump.c:386 objdump.c:401 +#, c-format +msgid "%s: no symbols" +msgstr "%s£ºÎÞ·ûºÅ" + +#. FIXME: we ought to read in and block out the base relocations +#: dlltool.c:1474 +#, c-format +msgid "Done reading %s" +msgstr "¶ÁÈë %s Íê³É" + +#: dlltool.c:1485 +#, c-format +msgid "Unable to open object file: %s" +msgstr "ÎÞ·¨´ò¿ªÄ¿±êÎļþ£º%s" + +#: dlltool.c:1488 +#, c-format +msgid "Scanning object file %s" +msgstr "ÕýÔÚɨÃèÄ¿±êÎļþ %s" + +#: dlltool.c:1503 +#, c-format +msgid "Cannot produce mcore-elf dll from archive file: %s" +msgstr "ÎÞ·¨´Ó¹éµµÎļþÖÐÉú³É mcore-elf ¶¯Ì¬Á¬½Ó¿â£º%s" + +#: dlltool.c:1595 +msgid "Adding exports to output file" +msgstr "" + +#: dlltool.c:1640 +msgid "Added exports to output file" +msgstr "" + +#: dlltool.c:1764 +#, c-format +msgid "Generating export file: %s" +msgstr "ÕýÔÚÉú³Éµ¼³öÎļþ£º%s" + +#: dlltool.c:1769 +#, c-format +msgid "Unable to open temporary assembler file: %s" +msgstr "ÎÞ·¨´ò¿ªÁÙʱ»ã±àÎļþ£º%s" + +#: dlltool.c:1772 +#, c-format +msgid "Opened temporary file: %s" +msgstr "ÒÑ´ò¿ªµÄÁÙʱÎļþ£º%s" + +#: dlltool.c:1996 +msgid "Generated exports file" +msgstr "ÒÑÉú³ÉµÄµ¼³öÎļþ" + +#: dlltool.c:2258 +#, c-format +msgid "bfd_open failed open stub file: %s" +msgstr "" + +#: dlltool.c:2261 +#, c-format +msgid "Creating stub file: %s" +msgstr "" + +#: dlltool.c:2650 +#, c-format +msgid "failed to open temporary head file: %s" +msgstr "´ò¿ªÁÙʱͷÎļþʧ°Ü£º%s" + +#: dlltool.c:2709 +#, c-format +msgid "failed to open temporary tail file: %s" +msgstr "´ò¿ªÁÙʱβÎļþʧ°Ü£º%s" + +#: dlltool.c:2777 +#, c-format +msgid "Can't open .lib file: %s" +msgstr "ÎÞ·¨´ò¿ª .lib Îļþ£º%s" + +#: dlltool.c:2780 +#, c-format +msgid "Creating library file: %s" +msgstr "ÕýÔÚ´´½¨¿âÎļþ£º%s" + +#: dlltool.c:2839 +#, c-format +msgid "cannot delete %s: %s" +msgstr "ÎÞ·¨É¾³ý %s£º%s" + +#: dlltool.c:2843 +msgid "Created lib file" +msgstr "ÒÑ´´½¨µÄ lib Îļþ" + +#: dlltool.c:2948 +#, c-format +msgid "Warning, ignoring duplicate EXPORT %s %d,%d" +msgstr "" + +#: dlltool.c:2954 +#, c-format +msgid "Error, duplicate EXPORT with oridinals: %s" +msgstr "" + +#: dlltool.c:3081 +msgid "Processing definitions" +msgstr "ÕýÔÚ´¦Àí¶¨Òå" + +#: dlltool.c:3119 +msgid "Processed definitions" +msgstr "ÒÑ´¦Àí¶¨Òå" + +#. xgetext:c-format +#: dlltool.c:3130 dllwrap.c:495 +#, c-format +msgid "Usage %s \n" +msgstr "Ó÷¨ %s <Ñ¡Ïî> <Ä¿±êÎļþ>\n" + +#. xgetext:c-format +#: dlltool.c:3132 +#, c-format +msgid " -m --machine Create as DLL for . [default: %s]\n" +msgstr " -m --machine Ϊ ´´½¨ DLL¡£[ĬÈÏ£º%s]\n" + +#: dlltool.c:3133 +msgid " possible : arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb\n" +msgstr " ¿ÉÄÜµÄ £ºarm[_interwork]¡¢i386¡¢mcore[-elf]{-le|-be}¡¢ppc¡¢thumb\n" + +#: dlltool.c:3134 +msgid " -e --output-exp Generate an export file.\n" +msgstr " -e --output-exp Éú³Éµ¼³öÎļþ¡£\n" + +#: dlltool.c:3135 +msgid " -l --output-lib Generate an interface library.\n" +msgstr " -l --output-lib Éú³É½çÃæ¿â¡£\n" + +#: dlltool.c:3136 +msgid " -a --add-indirect Add dll indirects to export file.\n" +msgstr "" + +#: dlltool.c:3137 +msgid " -D --dllname Name of input dll to put into interface lib.\n" +msgstr "" + +#: dlltool.c:3138 +msgid " -d --input-def Name of .def file to be read in.\n" +msgstr " -d --input-def Ðè¶ÁÈëµÄ .def ÎļþÃû¡£\n" + +#: dlltool.c:3139 +msgid " -z --output-def Name of .def file to be created.\n" +msgstr " -z --output-def Ðè´´½¨µÄ .def ÎļþÃû¡£\n" + +#: dlltool.c:3140 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols ½«ËùÓзûºÅµ¼³öµ½ .def\n" + +#: dlltool.c:3141 +msgid " --no-export-all-symbols Only export listed symbols\n" +msgstr " --no-export-all-symbols Ö»µ¼³öÁоٵķûºÅ\n" + +#: dlltool.c:3142 +msgid " --exclude-symbols Don't export \n" +msgstr " --exclude-symbols ²»Òªµ¼³ö \n" + +#: dlltool.c:3143 +msgid " --no-default-excludes Clear default exclude symbols\n" +msgstr "" + +#: dlltool.c:3144 +msgid " -b --base-file Read linker generated base file.\n" +msgstr "" + +#: dlltool.c:3145 +msgid " -x --no-idata4 Don't generate idata$4 section.\n" +msgstr " -x --no-idata4 ²»Éú³É idata$4 ½Ú¡£\n" + +#: dlltool.c:3146 +msgid " -c --no-idata5 Don't generate idata$5 section.\n" +msgstr " -c --no-idata5 ²»Éú³É idata$5 ½Ú¡£\n" + +#: dlltool.c:3147 +msgid " -U --add-underscore Add underscores to symbols in interface library.\n" +msgstr "" + +#: dlltool.c:3148 +msgid " -k --kill-at Kill @ from exported names.\n" +msgstr "" + +#: dlltool.c:3149 +msgid " -A --add-stdcall-alias Add aliases without @.\n" +msgstr " -A --add-stdcall-alias Ìí¼Ó²»´ø @ µÄ±ðÃû¡£\n" + +#: dlltool.c:3150 +msgid " -S --as Use for assembler.\n" +msgstr " -S --as ½« ÓÃ×÷»ã±à³ÌÐò¡£\n" + +#: dlltool.c:3151 +msgid " -f --as-flags Pass to the assembler.\n" +msgstr " -f --as-flags °Ñ ´«µÝ¸ø»ã±à³ÌÐò¡£\n" + +#: dlltool.c:3152 +msgid " -C --compat-implib Create backward compatible import library.\n" +msgstr " -C --compat-implib ´´½¨Ïòºó¼æÈݵĵ¼Èë¿â¡£\n" + +#: dlltool.c:3153 +msgid " -n --no-delete Keep temp files (repeat for extra preservation).\n" +msgstr "" + +#: dlltool.c:3154 +msgid " -v --verbose Be verbose.\n" +msgstr " -v --verbose Êä³ö¸ü¶àÐÅÏ¢¡£\n" + +#: dlltool.c:3155 +msgid " -V --version Display the program version.\n" +msgstr " -V --version ÏÔʾ³ÌÐò°æ±¾ºÅ¡£\n" + +#: dlltool.c:3156 +msgid " -h --help Display this information.\n" +msgstr " -h --help ÏÔʾ±¾ÐÅÏ¢¡£\n" + +#: dlltool.c:3158 +msgid " -M --mcore-elf Process mcore-elf object files into .\n" +msgstr "" + +#: dlltool.c:3159 +msgid " -L --linker Use as the linker.\n" +msgstr " -L --linker ½« ÓÃ×÷Á¬½ÓÆ÷¡£\n" + +#: dlltool.c:3160 +msgid " -F --linker-flags Pass to the linker.\n" +msgstr " -F --linker-flags °Ñ ´«µÝ¸øÁ¬½ÓÆ÷¡£\n" + +#: dlltool.c:3310 +#, c-format +msgid "Unable to open base-file: %s" +msgstr "" + +#: dlltool.c:3339 +#, c-format +msgid "Machine '%s' not supported" +msgstr "²»Ö§³Ö»úÆ÷¡°%s¡±" + +#: dlltool.c:3442 dllwrap.c:214 +#, c-format +msgid "Tried file: %s" +msgstr "" + +#: dlltool.c:3449 dllwrap.c:221 +#, c-format +msgid "Using file: %s" +msgstr "" + +#: dllwrap.c:308 +#, c-format +msgid "Keeping temporary base file %s" +msgstr "" + +#: dllwrap.c:310 +#, c-format +msgid "Deleting temporary base file %s" +msgstr "" + +#: dllwrap.c:324 +#, c-format +msgid "Keeping temporary exp file %s" +msgstr "" + +#: dllwrap.c:326 +#, c-format +msgid "Deleting temporary exp file %s" +msgstr "" + +#: dllwrap.c:339 +#, c-format +msgid "Keeping temporary def file %s" +msgstr "±£ÁôÁÙʱ def Îļþ %s" + +#: dllwrap.c:341 +#, c-format +msgid "Deleting temporary def file %s" +msgstr "ɾ³ýÁÙʱ def Îļþ %s" + +#: dllwrap.c:496 +msgid " Generic options:\n" +msgstr " ͨÓÃÑ¡Ï\n" + +#: dllwrap.c:497 +msgid " --quiet, -q Work quietly\n" +msgstr " --quiet, -q °²¾²µØ¹¤×÷\n" + +#: dllwrap.c:498 +msgid " --verbose, -v Verbose\n" +msgstr " --verbose, -v Êä³ö½Ï¶àÐÅÏ¢\n" + +#: dllwrap.c:499 +msgid " --version Print dllwrap version\n" +msgstr " --version ´òÓ¡ dllwrap µÄ°æ±¾ºÅ\n" + +#: dllwrap.c:500 +msgid " --implib Synonym for --output-lib\n" +msgstr " --implib --output-lib µÄͬÒåÓï\n" + +#: dllwrap.c:501 +#, c-format +msgid " Options for %s:\n" +msgstr " %s µÄÑ¡Ï\n" + +#: dllwrap.c:502 +msgid " --driver-name Defaults to \"gcc\"\n" +msgstr " --driver-name ĬÈÏΪ¡°gcc¡±\n" + +#: dllwrap.c:503 +msgid " --driver-flags Override default ld flags\n" +msgstr " --driver-flags ¸²¸ÇĬÈ쵀 ld ±êÖ¾\n" + +#: dllwrap.c:504 +msgid " --dlltool-name Defaults to \"dlltool\"\n" +msgstr " --dlltool-name ĬÈÏΪ¡°dlltool¡±\n" + +#: dllwrap.c:505 +msgid " --entry Specify alternate DLL entry point\n" +msgstr "" + +#: dllwrap.c:506 +msgid " --image-base Specify image base address\n" +msgstr "" + +#: dllwrap.c:507 +msgid " --target i386-cygwin32 or i386-mingw32\n" +msgstr " --target i386-cygwin32 »ò i386-mingw32\n" + +#: dllwrap.c:508 +msgid " --dry-run Show what needs to be run\n" +msgstr " --dry-run Ö»ÏÔʾÐèÒªÔËÐÐÄÇЩ¶¯×÷\n" + +#: dllwrap.c:509 +msgid " --mno-cygwin Create Mingw DLL\n" +msgstr " --mno-cygwin ´´½¨ Mingw DLL\n" + +#: dllwrap.c:510 +msgid " Options passed to DLLTOOL:\n" +msgstr " ´«µÝ¸ø DLLTOOL µÄÑ¡Ï\n" + +#: dllwrap.c:511 +msgid " --machine \n" +msgstr " --machine \n" + +#: dllwrap.c:512 +msgid " --output-exp Generate export file.\n" +msgstr " --output-exp Éú³Éµ¼³öÎļþ¡£\n" + +#: dllwrap.c:513 +msgid " --output-lib Generate input library.\n" +msgstr " --output-lib Éú³ÉÊäÈë¿â¡£\n" + +#: dllwrap.c:514 +msgid " --add-indirect Add dll indirects to export file.\n" +msgstr "" + +#: dllwrap.c:515 +msgid " --dllname Name of input dll to put into output lib.\n" +msgstr "" + +#: dllwrap.c:516 +msgid " --def Name input .def file\n" +msgstr " --def ÊäÈë .def ÎļþµÄÎļþÃû\n" + +#: dllwrap.c:517 +msgid " --output-def Name output .def file\n" +msgstr " --output-def Êä³ö .def ÎļþµÄÎļþÃû\n" + +#: dllwrap.c:518 +msgid " --export-all-symbols Export all symbols to .def\n" +msgstr " --export-all-symbols ½«ËùÓзûºÅµ¼³öµ½ .def ÖÐ\n" + +#: dllwrap.c:519 +msgid " --no-export-all-symbols Only export .drectve symbols\n" +msgstr " --no-export-all-symbols Ö»µ¼³ö·ûºÅ .drectve\n" + +#: dllwrap.c:520 +msgid " --exclude-symbols Exclude from .def\n" +msgstr " --exclude-symbols ´Ó .def ÖÐÅųý \n" + +#: dllwrap.c:521 +msgid " --no-default-excludes Zap default exclude symbols\n" +msgstr " --no-default-excludes Çå¿ÕĬÈÏÅųý·ûºÅ\n" + +#: dllwrap.c:522 +msgid " --base-file Read linker generated base file\n" +msgstr "" + +#: dllwrap.c:523 +msgid " --no-idata4 Don't generate idata$4 section\n" +msgstr " --no-idata4 ²»Éú³É idata$4 ½Ú\n" + +#: dllwrap.c:524 +msgid " --no-idata5 Don't generate idata$5 section\n" +msgstr " --no-idata5 ²»Éú³É idata$5 ½Ú\n" + +#: dllwrap.c:525 +msgid " -U Add underscores to .lib\n" +msgstr " -U Ϊ .lib Ìí¼ÓÏ»®Ïß\n" + +#: dllwrap.c:526 +msgid " -k Kill @ from exported names\n" +msgstr " -k ɾȥµ¼³öÃû×ÖÖÐµÄ @\n" + +#: dllwrap.c:527 +msgid " --add-stdcall-alias Add aliases without @\n" +msgstr " --add-stdcall-alias Ìí¼Ó²»´ø @ µÄ±ðÃû\n" + +#: dllwrap.c:528 +msgid " --as Use for assembler\n" +msgstr " --as ½« ÓÃ×÷»ã±à³ÌÐò\n" + +#: dllwrap.c:529 +msgid " --nodelete Keep temp files.\n" +msgstr " --nodelete ±£ÁôÁÙʱÎļþ¡£\n" + +#: dllwrap.c:530 +msgid " Rest are passed unmodified to the language driver\n" +msgstr " ÆäÓàµÄ¶¼²»¼ÓÈκÎÐ޸ĵڴ«µÝ¸øÓïÑÔÇý¶¯Æ÷\n" + +#: dllwrap.c:802 +msgid "Must provide at least one of -o or --dllname options" +msgstr "±ØÐëÌṩÖÁÉÙÒ»¸ö -o »ò --dllname Ñ¡Ïî" + +#: dllwrap.c:830 +msgid "" +"no export definition file provided.\n" +"Creating one, but that may not be what you want" +msgstr "" +"δÌṩµ¼³ö¶¨ÒåÎļþ¡£\n" +"´´½¨Ò»¸ö£¬µ«¿ÉÄܲ»ÊÇÄúËùÒªµÄ" + +#: dllwrap.c:992 +#, c-format +msgid "DLLTOOL name : %s\n" +msgstr "DLLTOOL Ãû³Æ £º%s\n" + +#: dllwrap.c:993 +#, c-format +msgid "DLLTOOL options : %s\n" +msgstr "DLLTOOL Ñ¡Ïî £º%s\n" + +#: dllwrap.c:994 +#, c-format +msgid "DRIVER name : %s\n" +msgstr "Çý¶¯Æ÷Ãû³Æ £º%s\n" + +#: dllwrap.c:995 +#, c-format +msgid "DRIVER options : %s\n" +msgstr "Çý¶¯Æ÷Ñ¡Ïî £º%s\n" + +#: emul_aix.c:52 +#, c-format +msgid " [-g] - 32 bit small archive\n" +msgstr " [-g] - 32 λС¹éµµÎļþ\n" + +#: emul_aix.c:53 +msgid " [-X32] - ignores 64 bit objects\n" +msgstr " [-X32] - ºöÂÔ 64 λ¶ÔÏó\n" + +#: emul_aix.c:54 +msgid " [-X64] - ignores 32 bit objects\n" +msgstr " [-X64] - ºöÂÔ 32 λ¶ÔÏó\n" + +#: emul_aix.c:55 +msgid " [-X32_64] - accepts 32 and 64 bit objects\n" +msgstr " [-X32_64] - ½ÓÊÜ 32 λºÍ 64 λ¶ÔÏó\n" + +#: ieee.c:317 +msgid "unexpected end of debugging information" +msgstr "µ÷ÊÔÐÅÏ¢ÒâÍâ½áÊø" + +#: ieee.c:412 +msgid "invalid number" +msgstr "ÎÞЧ±àºÅ" + +#: ieee.c:471 +msgid "invalid string length" +msgstr "ÎÞЧµÄ×Ö·û´®³¤¶È" + +#: ieee.c:528 ieee.c:569 +msgid "expression stack overflow" +msgstr "±í´ïʽջÒç³ö" + +#: ieee.c:548 +msgid "unsupported IEEE expression operator" +msgstr "²»Ö§³ÖµÄ IEEE ±í´ïʽ²Ù×÷·û" + +#: ieee.c:563 +msgid "unknown section" +msgstr "δ֪µÄ½Ú" + +#: ieee.c:584 +msgid "expression stack underflow" +msgstr "±í´ïʽջÏÂÒç³ö" + +#: ieee.c:598 +msgid "expression stack mismatch" +msgstr "±í´ïʽջ²»Æ¥Åä" + +#: ieee.c:637 +msgid "unknown builtin type" +msgstr "δ֪µÄÄÚÖÃÀàÐÍ" + +#: ieee.c:782 +msgid "BCD float type not supported" +msgstr "²»Ö§³ÖµÄ BCD ¸¡µãÀàÐÍ" + +#: ieee.c:928 +msgid "unexpected number" +msgstr "ÒâÍâµÄ±àºÅ" + +#: ieee.c:935 +msgid "unexpected record type" +msgstr "ÒâÍâµÄ¼Ç¼ÀàÐÍ" + +#: ieee.c:968 +msgid "blocks left on stack at end" +msgstr "½áÊøÊ±ÈÔÁôÔÚÕ»ÖеĿé" + +#: ieee.c:1233 +msgid "unknown BB type" +msgstr "δ֪µÄ BB ÀàÐÍ" + +#: ieee.c:1242 +msgid "stack overflow" +msgstr "Õ»ÉÏÒç³ö" + +#: ieee.c:1267 +msgid "stack underflow" +msgstr "Õ»ÏÂÒç³ö" + +#: ieee.c:1381 ieee.c:1453 ieee.c:2152 +msgid "illegal variable index" +msgstr "·Ç·¨µÄ±äÁ¿Ë÷Òý" + +#: ieee.c:1431 +msgid "illegal type index" +msgstr "·Ç·¨µÄÀàÐÍË÷Òý" + +#: ieee.c:1441 ieee.c:1478 +msgid "unknown TY code" +msgstr "δ֪µÄ TY ´úÂë" + +#: ieee.c:1460 +msgid "undefined variable in TY" +msgstr "TY ÖÐ䶨ÒåµÄ±äÁ¿" + +#. Pascal file name. FIXME. +#: ieee.c:1871 +msgid "Pascal file name not supported" +msgstr "²»Ö§³Ö Pascal ÎļþÃû" + +#: ieee.c:1919 +msgid "unsupported qualifier" +msgstr "²»Ö§³ÖµÄÏÞ¶¨·û" + +#: ieee.c:2190 +msgid "undefined variable in ATN" +msgstr "ATN ÖÐ䶨ÒåµÄ±äÁ¿" + +#: ieee.c:2233 +msgid "unknown ATN type" +msgstr "δ֪µÄ ATN ÀàÐÍ" + +#. Reserved for FORTRAN common. +#: ieee.c:2355 +msgid "unsupported ATN11" +msgstr "²»Ö§³Ö ATN11" + +#. We have no way to record this information. FIXME. +#: ieee.c:2382 +msgid "unsupported ATN12" +msgstr "²»Ö§³Ö ATN12" + +#: ieee.c:2442 +msgid "unexpected string in C++ misc" +msgstr "" + +#: ieee.c:2455 +msgid "bad misc record" +msgstr "" + +#: ieee.c:2498 +msgid "unrecognized C++ misc record" +msgstr "" + +#: ieee.c:2615 +msgid "undefined C++ object" +msgstr "䶨ÒåµÄ C++ ¶ÔÏó" + +#: ieee.c:2649 +msgid "unrecognized C++ object spec" +msgstr "" + +#: ieee.c:2685 +msgid "unsupported C++ object type" +msgstr "²»Ö§³ÖµÄ C++ ¶ÔÏóÀàÐÍ" + +#: ieee.c:2695 +msgid "C++ base class not defined" +msgstr "䶨Òå C++ »ùÀà" + +#: ieee.c:2707 ieee.c:2812 +msgid "C++ object has no fields" +msgstr "C++ ¶ÔÏóûÓÐÓò" + +#: ieee.c:2726 +msgid "C++ base class not found in container" +msgstr "" + +#: ieee.c:2833 +msgid "C++ data member not found in container" +msgstr "" + +#: ieee.c:2874 ieee.c:3024 +msgid "unknown C++ visibility" +msgstr "" + +#: ieee.c:2908 +msgid "bad C++ field bit pos or size" +msgstr "" + +#: ieee.c:3000 +msgid "bad type for C++ method function" +msgstr "" + +#: ieee.c:3010 +msgid "no type information for C++ method function" +msgstr "" + +#: ieee.c:3049 +msgid "C++ static virtual method" +msgstr "C++ ¾²Ì¬ÐéÄâ·½·¨" + +#: ieee.c:3144 +msgid "unrecognized C++ object overhead spec" +msgstr "" + +#: ieee.c:3183 +msgid "undefined C++ vtable" +msgstr "䶨ÒåµÄ C++ vtable" + +#: ieee.c:3254 +msgid "C++ default values not in a function" +msgstr "" + +#: ieee.c:3294 +msgid "unrecognized C++ default type" +msgstr "ÎÞ·¨Ê¶±ðµÄ C++ ĬÈÏÀàÐÍ" + +#: ieee.c:3325 +msgid "reference parameter is not a pointer" +msgstr "ÒýÓòÎÊý²»ÊÇÖ¸Õë" + +#: ieee.c:3410 +msgid "unrecognized C++ reference type" +msgstr "ÎÞ·¨Ê¶±ðµÄ C++ ÒýÓÃÀàÐÍ" + +#: ieee.c:3492 +msgid "C++ reference not found" +msgstr "ÕÒ²»µ½ C++ ÒýÓÃ" + +#: ieee.c:3500 +msgid "C++ reference is not pointer" +msgstr "C++ ÒýÓò»ÊÇÖ¸Õë" + +#: ieee.c:3529 ieee.c:3537 +msgid "missing required ASN" +msgstr "ÒÅʧ±ØÐëµÄ ASN" + +#: ieee.c:3567 ieee.c:3575 +msgid "missing required ATN65" +msgstr "ÒÅʧ±ØÐëµÄ ATN65" + +#: ieee.c:3589 +msgid "bad ATN65 record" +msgstr "´íÎóµÄ ATN65 ¼Ç¼" + +#: ieee.c:4234 +msgid "IEEE numeric overflow: 0x" +msgstr "IEEE ÊýÖµÒç³ö£º0x" + +#: ieee.c:4280 +#, c-format +msgid "IEEE string length overflow: %u\n" +msgstr "IEEE ×Ö·û´®³¤¶ÈÒç³ö£º%u\n" + +#: ieee.c:5330 +#, c-format +msgid "IEEE unsupported integer type size %u\n" +msgstr "IEEE ²»Ö§³ÖµÄÕûÊýÀàÐÍ´óС %u\n" + +#: ieee.c:5366 +#, c-format +msgid "IEEE unsupported float type size %u\n" +msgstr "IEEE ²»Ö§³ÖµÄ¸¡µãÀàÐÍ´óС %u\n" + +#: ieee.c:5402 +#, c-format +msgid "IEEE unsupported complex type size %u\n" +msgstr "IEEE ²»Ö§³ÖµÄ¸ºÔØÀàÐÍ´óС %u\n" + +#: nlmconv.c:281 srconv.c:2043 +msgid "input and output files must be different" +msgstr "ÊäÈëÊä³öÎļþ±ØÐ벻ͬ" + +#: nlmconv.c:328 +msgid "input file named both on command line and with INPUT" +msgstr "ͬʱÔÚÃüÁîÐÐºÍ INPU ÖÐÃüÃûÊäÈëÎļþ" + +#: nlmconv.c:337 +msgid "no input file" +msgstr "ûÓÐÊäÈëÎļþ" + +#: nlmconv.c:367 +msgid "no name for output file" +msgstr "Êä³öÎļþûÓÐÃû³Æ" + +#: nlmconv.c:380 +msgid "warning: input and output formats are not compatible" +msgstr "¾¯¸æ£ºÊäÈëºÍÊä³ö¸ñʽ²»¼æÈÝ" + +#: nlmconv.c:409 +msgid "make .bss section" +msgstr "Éú³É .bss ½Ú" + +#: nlmconv.c:418 +msgid "make .nlmsections section" +msgstr "Éú³É .nlmsections ½Ú" + +#: nlmconv.c:420 +msgid "set .nlmsections flags" +msgstr "É趨 .nlmsections ±êÖ¾" + +#: nlmconv.c:448 +msgid "set .bss vma" +msgstr "É趨 .bss vma" + +#: nlmconv.c:455 +msgid "set .data size" +msgstr "É趨 .data µÄ´óС" + +#: nlmconv.c:635 +#, c-format +msgid "warning: symbol %s imported but not in import list" +msgstr "¾¯¸æ£ºµ¼ÈëµÄ·ûºÅ %s ²»ÔÚµ¼ÈëÁбíÖÐ" + +#: nlmconv.c:655 +msgid "set start address" +msgstr "É趨ÆðʼµØÖ·" + +#: nlmconv.c:704 +#, c-format +msgid "warning: START procedure %s not defined" +msgstr "¾¯¸æ£ºÎ´¶¨Òå START ×Ó³ÌÐò %s" + +#: nlmconv.c:706 +#, c-format +msgid "warning: EXIT procedure %s not defined" +msgstr "¾¯¸æ£ºÎ´¶¨Òå×Ó³ÌÐò %s" + +#: nlmconv.c:708 +#, c-format +msgid "warning: CHECK procedure %s not defined" +msgstr "¾¯¸æ£ºÎ´¶¨Òå×Ó³ÌÐò %s" + +#: nlmconv.c:729 nlmconv.c:918 +msgid "custom section" +msgstr "¶¨ÖƽÚ" + +#: nlmconv.c:750 nlmconv.c:947 +msgid "help section" +msgstr "ÇóÖú½Ú" + +#: nlmconv.c:772 nlmconv.c:965 +msgid "message section" +msgstr "ÏûÏ¢½Ú" + +#: nlmconv.c:788 nlmconv.c:998 +msgid "module section" +msgstr "Ä£¿é½Ú" + +#: nlmconv.c:808 nlmconv.c:1014 +msgid "rpc section" +msgstr "rpc ½Ú" + +#. There is no place to record this information. +#: nlmconv.c:844 +#, c-format +msgid "%s: warning: shared libraries can not have uninitialized data" +msgstr "%s£º¾¯¸æ£º¹²Ïí¿â²»Äܺ¬ÓÐδ³õʼ»¯µÄÊý¾Ý" + +#: nlmconv.c:865 nlmconv.c:1033 +msgid "shared section" +msgstr "¹²Ïí½Ú" + +#: nlmconv.c:873 +msgid "warning: No version number given" +msgstr "¾¯¸æ£ºÎ´¸ø³ö°æ±¾ºÅ" + +#: nlmconv.c:913 nlmconv.c:942 nlmconv.c:960 nlmconv.c:1009 nlmconv.c:1028 +#, c-format +msgid "%s: read: %s" +msgstr "%s£º¶ÁÈ¡£º%s" + +#: nlmconv.c:935 +msgid "warning: MAP and FULLMAP are not supported; try ld -M" +msgstr "¾¯¸æ£º²»Ö§³Ö MAP ºÍ FULLMAP£»ÇëÊÔÓà ld -M" + +#: nlmconv.c:1107 +#, c-format +msgid "Usage: %s [option(s)] [in-file [out-file]]\n" +msgstr "Ó÷¨£º%s [Ñ¡Ïî] [ÊäÈëÎļþ [Êä³öÎļþ]]\n" + +#: nlmconv.c:1108 +msgid " Convert an object file into a NetWare Loadable Module\n" +msgstr " ½«¶ÔÏóÎļþת»»Îª NetWare ¿ÉÔØÈëÄ£¿é\n" + +#: nlmconv.c:1109 +msgid "" +" The options are:\n" +" -I --input-target= Set the input binary file format\n" +" -O --output-target= Set the output binary file format\n" +" -T --header-file= Read for NLM header information\n" +" -l --linker= Use for any linking\n" +" -d --debug Display on stderr the linker command line\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +msgstr "" +" Ñ¡ÏîΪ£º\n" +" -I --input-target= É趨ÊäÈë¶þ½øÖÆÎļþ¸ñʽ\n" +" -O --output-target= É趨Êä³ö¶þ½øÖÆÎļþ¸ñʽ\n" +" -T --header-file= ´Ó ÖжÁÈë NLM Í·ÐÅÏ¢\n" +" -l --linker= ÔÚËùÓÐÁ¬½ÓÖÐʹÓà \n" +" -d --debug ÔÚ±ê×¼´íÎóÊä³öÖÐÏÔʾÁ¬½ÓÆ÷ÃüÁîÐÐ\n" +" -h --help ÏÔʾ±¾ÐÅÏ¢\n" +" -v --version ÏÔʾ³ÌÐòµÄ°æ±¾ºÅ\n" + +#: nlmconv.c:1151 +#, c-format +msgid "support not compiled in for %s" +msgstr "" + +#: nlmconv.c:1191 +msgid "make section" +msgstr "" + +#: nlmconv.c:1205 +msgid "set section size" +msgstr "É趨½Ú´óС" + +#: nlmconv.c:1211 +msgid "set section alignment" +msgstr "É趨½Ú¶ÔÆë" + +#: nlmconv.c:1215 +msgid "set section flags" +msgstr "É趨½Ú±êÖ¾" + +#: nlmconv.c:1226 +msgid "set .nlmsections size" +msgstr "É趨 .nlmsections ´óС" + +#: nlmconv.c:1314 nlmconv.c:1322 nlmconv.c:1331 nlmconv.c:1336 +msgid "set .nlmsection contents" +msgstr "É趨 .nlmsection µÄÄÚÈÝ" + +#: nlmconv.c:1837 +msgid "stub section sizes" +msgstr "ռλ½Ú´óС" + +#: nlmconv.c:1886 +msgid "writing stub" +msgstr "ÕýÔÚдÈëռλ½Ú" + +#: nlmconv.c:1975 +#, c-format +msgid "unresolved PC relative reloc against %s" +msgstr "" + +#: nlmconv.c:2039 +#, c-format +msgid "overflow when adjusting relocation against %s" +msgstr "" + +#: nlmconv.c:2156 +#, c-format +msgid "%s: execution of %s failed: " +msgstr "%s£ºÖ´ÐÐ %s ʧ°Ü£º" + +#: nlmconv.c:2171 +#, c-format +msgid "Execution of %s failed" +msgstr "Ö´ÐÐ %s ʧ°Ü" + +#: nm.c:246 size.c:85 strings.c:650 +#, c-format +msgid "Usage: %s [option(s)] [file(s)]\n" +msgstr "Ó÷¨£º%s [Ñ¡Ïî] [Îļþ]\n" + +#: nm.c:247 +msgid " List symbols in [file(s)] (a.out by default).\n" +msgstr "Áо٠[Îļþ] ÖеķûºÅ (ĬÈÏΪ a.out)¡£\n" + +#: nm.c:248 +msgid "" +" The options are:\n" +" -a, --debug-syms Display debugger-only symbols\n" +" -A, --print-file-name Print name of the input file before every symbol\n" +" -B Same as --format=bsd\n" +" -C, --demangle[=STYLE] Decode low-level symbol names into user-level names\n" +" The STYLE, if specified, can be `auto' (the default),\n" +" `gnu', 'lucid', 'arm', 'hp', 'edg' or 'gnu-new-abi'\n" +" --no-demangle Do not demangle low-level symbol names\n" +" -D, --dynamic Display dynamic symbols instead of normal symbols\n" +" --defined-only Display only defined symbols\n" +" -e (ignored)\n" +" -f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',\n" +" `sysv' or `posix'. The default is `bsd'\n" +" -g, --extern-only Display only external symbols\n" +" -l, --line-numbers Use debugging information to find a filename and\n" +" line number for each symbol\n" +" -n, --numeric-sort Sort symbols numerically by address\n" +" -o Same as -A\n" +" -p, --no-sort Do not sort the symbols\n" +" -P, --portability Same as --format=posix\n" +" -r, --reverse-sort Reverse the sense of the sort\n" +" -S, --print-size Print size of defined symbols\n" +" -s, --print-armap Include index for symbols from archive members\n" +" --size-sort Sort symbols by size\n" +" -t, --radix=RADIX Use RADIX for printing symbol values\n" +" --target=BFDNAME Specify the target object format as BFDNAME\n" +" -u, --undefined-only Display only undefined symbols\n" +" -X 32_64 (ignored)\n" +" -h, --help Display this information\n" +" -V, --version Display this program's version number\n" +"\n" +msgstr "" +" Ñ¡ÏîΪ£º\n" +" -a, --debug-syms ÏÔʾֻÓÃÓÚµ÷ÊԵķûºÅ\n" +" -A, --print-file-name ÔÚÿ¸ö·ûºÅǰ´òÓ¡ÊäÈëÎļþÃû\n" +" -B ÓÚ --format=bsd Ïàͬ\n" +" -C, --demangle[=STYLE] ½«µ×²ã·ûºÅÃû½âÂëΪÓû§¼¶Ãû³Æ\n" +" Èç¹û¸ø³ö STYLE£¬STYLE ¿ÉÄÜΪ¡°auto¡± (ĬÈÏ)¡¢\n" +" ¡°gnu¡±¡¢¡°lucid¡±¡¢¡°arm¡±¡¢¡°hp¡±¡¢¡°edg¡±»ò¡°gnu-new-abi¡±\n" +" --no-demangle ²»Òª½âÂëµ×²ã·ûºÅÃû\n" +" -D, --dynamic ÏÔʾ¶¯Ì¬·ûºÅ¶ø²»ÊÇÆÕͨ·ûºÅ\n" +" --defined-only Ö»ÏÔʾÒѶ¨ÒåµÄ·ûºÅ\n" +" -e (ºöÂÔ)\n" +" -f, --format=FORMAT ʹÓÃÊä³ö¸ñʽ FORMAT¡£FORMAT ¿ÉÄÜÊÇ¡°bsd¡±¡¢\n" +" ¡°sysv¡±»ò¡°posix¡±¡£Ä¬ÈÏΪ¡°bsd¡±\n" +" -g, --extern-only Ö»ÏÔʾÍⲿ·ûºÅ\n" +" -l, --line-numbers ʹÓõ÷ÊÔÐÅÏ¢ÒÔ±ãΪÿ¸ö·ûºÅѰÕÒÎļþÃûºÍÐкÅ\n" +" -n, --numeric-sort °´µØÖ·ÅÅÐò·ûºÅ\n" +" -o ÓÚ -A Ïàͬ\n" +" -p, --no-sort ²»Òª¶Ô·ûºÅ½øÐÐÅÅÐò\n" +" -P, --portability ÓÚ --format=posix Ïàͬ\n" +" -r, --reverse-sort ·´×ªÅÅÐò˳Ðò\n" +" -S, --print-size ´òÓ¡¶¨ÒåÁ˵ķûºÅµÄ´óС\n" +" -s, --print-armap ´òÓ¡¹éµµÎļþ³ÉÔ±ÖзûºÅµÄË÷Òý\n" +" --size-sort °´´óСÅÅÐò·ûºÅ\n" +" -t, --radix=RADIX ½« RADIX ÓÃÓÚ´òÓ¡·ûºÅÖµ\n" +" --target=BFDNAME ½«±êµÄÄ¿±ê¸ñʽָ¶¨Îª BFDNAME\n" +" -u, --undefined-only Ö»ÏÔʾ䶨ÒåµÄ·ûºÅ\n" +" -X 32_64 (ºöÂÔ)\n" +" -h, --help ÏÔʾ±¾ÐÅÏ¢\n" +" -V, --version ÏÔʾ±¾³ÌÐòµÄ°æ±¾ºÅ\n" +"\n" + +#: nm.c:281 objdump.c:217 +#, c-format +msgid "Report bugs to %s.\n" +msgstr "½« bug ±¨¸æµ½ %s¡£\n" + +#: nm.c:314 +#, c-format +msgid "%s: invalid radix" +msgstr "%s£ºÎÞЧµÄ»ùÊý" + +#: nm.c:339 +#, c-format +msgid "%s: invalid output format" +msgstr "%s£ºÎÞЧµÄÊä³ö¸ñʽ" + +#: nm.c:456 +msgid "Only -X 32_64 is supported" +msgstr "Ö»Ö§³Ö -X 32_64" + +#: nm.c:498 +#, c-format +msgid "data size %ld" +msgstr "Êý¾Ý´óС %ld" + +#: nm.c:523 readelf.c:5306 readelf.c:5342 +#, c-format +msgid ": %d" +msgstr "<´¦ÀíÆ÷רÓÃ>£º%d" + +#: nm.c:525 readelf.c:5308 readelf.c:5354 +#, c-format +msgid ": %d" +msgstr "<²Ù×÷ϵͳרÓÃ>£º%d" + +#: nm.c:527 readelf.c:5310 readelf.c:5357 +#, c-format +msgid ": %d" +msgstr "<δ֪>£º%d" + +#: nm.c:1339 +#, c-format +msgid "" +"\n" +"\n" +"Undefined symbols from %s:\n" +"\n" +msgstr "" +"\n" +"\n" +"À´×Ô %s µÄ䶨Òå·ûºÅ£º\n" +"\n" + +#: nm.c:1341 +#, c-format +msgid "" +"\n" +"\n" +"Symbols from %s:\n" +"\n" +msgstr "" +"\n" +"\n" +"À´×Ô %s µÄ·ûºÅ£º\n" +"\n" + +#: nm.c:1343 nm.c:1401 +msgid "" +"Name Value Class Type Size Line Section\n" +"\n" +msgstr "" + +#: nm.c:1346 nm.c:1404 +msgid "" +"Name Value Class Type Size Line Section\n" +"\n" +msgstr "" + +#: nm.c:1397 +#, c-format +msgid "" +"\n" +"\n" +"Undefined symbols from %s[%s]:\n" +"\n" +msgstr "" +"\n" +"\n" +"À´×Ô %s[%s] µÄ䶨ÒåµÄ·ûºÅ£º\n" +"\n" + +#: nm.c:1399 +#, c-format +msgid "" +"\n" +"\n" +"Symbols from %s[%s]:\n" +"\n" +msgstr "" +"\n" +"\n" +"À´×Ô %s[%s] µÄ·ûºÅ£º\n" +"\n" + +#: nm.c:1614 +msgid "" +"\n" +"Archive index:\n" +msgstr "" +"\n" +"¹éµµË÷Òý£º\n" + +#: objcopy.c:363 srconv.c:1952 +#, c-format +msgid "Usage: %s [option(s)] in-file [out-file]\n" +msgstr "Ó÷¨£º%s [Ñ¡Ïî] ÊäÈëÎļþ [Êä³öÎļþ]\n" + +#: objcopy.c:364 +msgid " Copies a binary file, possibly transforming it in the process\n" +msgstr " ¸´Öƶþ½øÖÆÎļþ£¬¿ÉÄÜÔڴ˹ý³ÌÖнøÐб任\n" + +#: objcopy.c:365 objcopy.c:435 +msgid " The options are:\n" +msgstr " Ñ¡ÏîΪ£º\n" + +#: objcopy.c:366 +msgid "" +" -I --input-target Assume input file is in format \n" +" -O --output-target Create an output file in format \n" +" -B --binary-architecture Set arch of output file, when input is binary\n" +" -F --target Set both input and output format to \n" +" --debugging Convert debugging information, if possible\n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -j --only-section Only copy section into the output\n" +" -R --remove-section Remove section from the output\n" +" -S --strip-all Remove all symbol and relocation information\n" +" -g --strip-debug Remove all debugging symbols\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol Do not copy symbol \n" +" -K --keep-symbol Only copy symbol \n" +" -L --localize-symbol Force symbol to be marked as a local\n" +" -G --keep-global-symbol Localize all symbols except \n" +" -W --weaken-symbol Force symbol to be marked as a weak\n" +" --weaken Force all global symbols to be marked as weak\n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -i --interleave Only copy one out of every bytes\n" +" -b --byte Select byte in every interleaved block\n" +" --gap-fill Fill gaps between sections with \n" +" --pad-to Pad the last section up to address \n" +" --set-start Set the start address to \n" +" {--change-start|--adjust-start} \n" +" Add to the start address\n" +" {--change-addresses|--adjust-vma} \n" +" Add to LMA, VMA and start addresses\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" Change LMA and VMA of section by \n" +" --change-section-lma {=|+|-}\n" +" Change the LMA of section by \n" +" --change-section-vma {=|+|-}\n" +" Change the VMA of section by \n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" Warn if a named section does not exist\n" +" --set-section-flags =\n" +" Set section 's properties to \n" +" --add-section = Add section found in to output\n" +" --rename-section =[,] Rename section to \n" +" --change-leading-char Force output format's leading character style\n" +" --remove-leading-char Remove leading character from global symbols\n" +" --redefine-sym = Redefine symbol name to \n" +" --srec-len Restrict the length of generated Srecords\n" +" --srec-forceS3 Restrict the type of generated Srecords to S3\n" +" --strip-symbols -N for all symbols listed in \n" +" --keep-symbols -K for all symbols listed in \n" +" --localize-symbols -L for all symbols listed in \n" +" --keep-global-symbols -G for all symbols listed in \n" +" --weaken-symbols -W for all symbols listed in \n" +" --alt-machine-code Use alternate machine code for output\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +msgstr "" +" -I --input-target ¼Ù¶¨ÊäÈëÎļþµÄ¸ñʽΪ \n" +" -O --output-target ´´½¨¸ñʽΪ µÄÊä³öÎļþ\n" +" -B --binary-architecture µ±ÊäÈëÎļþΪ¶þ½øÖÆÎļþʱ£¬É趨Êä³öÎļþµÄÌåϵ½á¹¹\n" +" -F --target ½«ÊäÈëÊä³ö¸ñʽÉ趨Ϊ \n" +" --debugging Èç¹û¿ÉÄÜ£¬×ª»»µ÷ÊÔÐÅÏ¢\n" +" -p --preserve-dates ½«ÐÞ¸Ä/·ÃÎÊʱ¼ä´Á¸´ÖƵ½Êä³öÎļþ\n" +" -j --only-section Ö»½« ½Ú¸´ÖƵ½Êä³öÎļþÖÐ\n" +" -R --remove-section ´ÓÊä³öÖÐɾ³ý ½Ú\n" +" -S --strip-all ɾ³ýËùÓзûºÅºÍÖØ¶¨Î»ÐÅÏ¢\n" +" -g --strip-debug ɾ³ýËùÓе÷ÊÔ·ûºÅ\n" +" --strip-unneeded ɾ³ýËùÓÐÖØ¶¨Î»²»ÐèÒªµÄ·ûºÅ\n" +" -N --strip-symbol ²»Òª¸´ÖÆ·ûºÅ \n" +" -K --keep-symbol Ö»¸´ÖÆ·ûºÅ \n" +" -L --localize-symbol ½«·ûºÅ Ç¿ÖÆ±êʶΪ±¾µØ·ûºÅ\n" +" -G --keep-global-symbol ½«³ýÁË·ûºÅ ÒÔÍâµÄËùÓзûºÅ±êʶΪ±¾µØ·ûºÅ\n" +" -W --weaken-symbol ½«·ûºÅ Ç¿ÖÆ±êʶΪÈõ·ûºÅ\n" +" --weaken ½«ËùÓÐÈ«¾Ö·ûºÅ±êʶΪÈõ·ûºÅ\n" +" -x --discard-all ɾ³ýËùÓзÇÈ«¾Ö·ûºÅ\n" +" -X --discard-locals ɾ³ýËùÓбàÒëÆ÷Éú³ÉµÄ·ûºÅ\n" +" -i --interleave Ö»ÔÚÿ ¸ö×Ö½ÚÖи´ÖÆÒ»¸ö\n" +" -b --byte ÔÚÿ¸ö²åÈë¿éÖÐÑ¡Ôñ×Ö½Ú \n" +" --gap-fill ÔÚ½Ú¿Õ϶ÖÐÒÔ Ìî³ä\n" +" --pad-to ²¹³ä×îºóÒ»½ÚÖ±µ½µØÖ· \n" +" --set-start ½«ÆðʼµØÖ·ÉèÖÃΪ \n" +" {--change-start|--adjust-start} \n" +" ½« Ôö¼Óµ½ÆðʼµØÖ·\n" +" {--change-addresses|--adjust-vma} \n" +" ½« Ôö¼Óµ½ LMA¡¢VMA ºÍÆðʼµØÖ·\n" +" {--change-section-address|--adjust-section-vma} {=|+|-}\n" +" ÒÔ ÐÞ¸Ä ½ÚµÄ LMA ºÍ VMA\n" +" --change-section-lma {=|+|-}\n" +" ÒÔ ÐÞ¸Ä ½ÚµÄ LMA\n" +" --change-section-vma {=|+|-}\n" +" ÒÔ ÐÞ¸Ä ½ÚµÄ VMA\n" +" {--[no-]change-warnings|--[no-]adjust-warnings}\n" +" Èç¹ûÃüÃû½Ú²»´æÔھ͸ø³ö¾¯¸æ\n" +" --set-section-flags =\n" +" ½« ½ÚµÄÊôÐÔÉèÖÃΪ \n" +" --add-section = ½« ÖÐµÄ ½ÚÌí¼Óµ½Êä³öÖÐ\n" +" --rename-section =[,] ½«½ÚÓÉ ¸ÄÃûΪ \n" +" --change-leading-char Ç¿ÐÐÉ趨Êä³ö¸ñʽµÄǰµ¼×Ö·û·ç¸ñ\n" +" --remove-leading-char ɾ³ýÈ«¾Ö·ûºÅµÄǰµ¼×Ö·û\n" +" --redefine-sym = ½«·ûºÅÓÉ ¸ÄÃûΪ \n" +" --srec-len ÏÞÖÆÉú³ÉµÄ Srecords µÄ³¤¶È\n" +" --srec-forceS3 ½«Éú³ÉµÄ Srecords µÄÀàÐÍÏÞÖÆÎª S3\n" +" --strip-symbols ¶ÔÁоÙÔÚ ÖеÄËùÓзûºÅÖ´ÐÐ -N\n" +" --keep-symbols ¶ÔÁоÙÔÚ ÖеÄËùÓзûºÅÖ´ÐÐ -K\n" +" --localize-symbols ¶ÔÁоÙÔÚ ÖеÄËùÓзûºÅÖ´ÐÐ -L\n" +" --keep-global-symbols ¶ÔÁоÙÔÚ ÖеÄËùÓзûºÅÖ´ÐÐ -G\n" +" --weaken-symbols ¶ÔÁоÙÔÚ ÖеÄËùÓзûºÅÖ´ÐÐ -W\n" +" --alt-machine-code Êä³öʹÓÃÌæ´úµÄ»úÆ÷Âë\n" +" -v --verbose ÁгöËùÓÐÐ޸ĵÄÄ¿±êÎļþ\n" +" -V --version ÏÔʾ±¾³ÌÐòµÄ°æ±¾ºÅ\n" +" -h --help ÏÔʾ±¾Êä³ö\n" + +#: objcopy.c:433 +#, c-format +msgid "Usage: %s in-file(s)\n" +msgstr "Ó÷¨£º%s <Ñ¡Ïî> ÊäÈëÎļþ\n" + +#: objcopy.c:434 +msgid " Removes symbols and sections from files\n" +msgstr "´ÓÎļþÖÐɾ³ý·ûºÅºÍ½Ú\n" + +#: objcopy.c:436 +msgid "" +" -I --input-target= Assume input file is in format \n" +" -O --output-target= Create an output file in format \n" +" -F --target= Set both input and output format to \n" +" -p --preserve-dates Copy modified/access timestamps to the output\n" +" -R --remove-section= Remove section from the output\n" +" -s --strip-all Remove all symbol and relocation information\n" +" -g -S -d --strip-debug Remove all debugging symbols\n" +" --strip-unneeded Remove all symbols not needed by relocations\n" +" -N --strip-symbol= Do not copy symbol \n" +" -K --keep-symbol= Only copy symbol \n" +" -x --discard-all Remove all non-global symbols\n" +" -X --discard-locals Remove any compiler-generated symbols\n" +" -v --verbose List all object files modified\n" +" -V --version Display this program's version number\n" +" -h --help Display this output\n" +" -o Place stripped output into \n" +msgstr "" +" -I --input-target= ¼Ù¶¨ÊäÈëÎļþµÄ¸ñʽΪ \n" +" -O --output-target= ´´½¨¸ñʽΪ µÄÊä³öÎļþ\n" +" -F --target= ½«ÊäÈëºÍÊä³öµÄ¸ñʽÉ趨Ϊ \n" +" -p --preserve-dates ½« ÐÞ¸Ä/·ÃÎÊ Ê±¼ä´Á¸´ÖƵ½Êä³öÎļþ\n" +" -R --remove-section= ´ÓÊä³öÖÐɾ³ý ½Ú\n" +" -s --strip-all ɾ³ýËùÓзûºÅºÍÖØ¶¨Î»ÐÅÏ¢\n" +" -g -S -d --strip-debug ɾ³ýËùÓе÷ÊÔ·ûºÅ\n" +" --strip-unneeded ɾ³ýËùÓÐÖØ¶¨Î»²»ÐèÒªµÄ·ûºÅ\n" +" -N --strip-symbol= ²»Òª¸´ÖÆ·ûºÅ \n" +" -K --keep-symbol= Ö»¸´ÖÆ·ûºÅ \n" +" -x --discard-all ɾ³ýËùÓзÇÈ«¾Ö·ûºÅ\n" +" -X --discard-locals ɾ³ýËùÓбàÒëÆ÷Éú³ÉµÄ·ûºÅ\n" +" -v --verbose ÁгöËùÓÐÐÞ¸ÄÁ˵ÄÄ¿±êÎļþ\n" +" -V --version ÏÔʾ±¾³ÌÐòµÄ°æ±¾ºÅ\n" +" -h --help ÏÔʾ±¾Êä³ö\n" +" -o ½« strip ¹ýµÄÊä³ö±£´æµ½ \n" + +#: objcopy.c:506 +#, c-format +msgid "unrecognized section flag `%s'" +msgstr "²»ÄÜʶ±ðµÄ½Ú±êÖ¾¡°%s¡±" + +#: objcopy.c:507 +#, c-format +msgid "supported flags: %s" +msgstr "Ö§³ÖµÄ±êÖ¾£º%s" + +#: objcopy.c:584 objcopy.c:2243 +#, c-format +msgid "cannot stat: %s: %s" +msgstr "ÎÞ·¨ stat£º%s£º%s" + +#: objcopy.c:591 objcopy.c:2261 +#, c-format +msgid "cannot open: %s: %s" +msgstr "ÎÞ·¨´ò¿ª£º%s£º%s" + +#: objcopy.c:594 objcopy.c:2265 +#, c-format +msgid "%s: fread failed" +msgstr "%s£ºfread ʧ°Ü" + +#: objcopy.c:667 +#, c-format +msgid "Ignoring rubbish found on line %d of %s" +msgstr "" + +#: objcopy.c:888 +#, c-format +msgid "%s: Multiple redefinition of symbol \"%s\"" +msgstr "%s£º¶à´ÎÖØ¸´¶¨Òå·ûºÅ¡°%s¡±" + +#: objcopy.c:893 +#, c-format +msgid "%s: Symbol \"%s\" is target of more than one redefinition" +msgstr "%s£º·ûºÅ¡°%s¡±ÊǶà´ÎÖØ¸´¶¨ÒåµÄ±êµÄ" + +#: objcopy.c:945 +msgid "Unable to change endianness of input file(s)" +msgstr "" + +#: objcopy.c:953 +#, c-format +msgid "copy from %s(%s) to %s(%s)\n" +msgstr "´Ó %s(%s) ¸´ÖƵ½ %s(%s)\n" + +#: objcopy.c:977 +#, c-format +msgid "Warning: Output file cannot represent architecture %s" +msgstr "¾¯¸æ£ºÊä³öÎļþÎÞ·¨±í´ïÌåϵ½á¹¹ %s" + +#: objcopy.c:1004 +#, c-format +msgid "can't create section `%s': %s" +msgstr "ÎÞ·¨´´½¨½Ú¡°%s¡±£º%s" + +#: objcopy.c:1090 +#, c-format +msgid "Can't fill gap after %s: %s" +msgstr "ÎÞ·¨Ìî³ä %s Ö®ºóµÄ¿Õ϶£º%s" + +#: objcopy.c:1115 +#, c-format +msgid "Can't add padding to %s: %s" +msgstr "" + +#: objcopy.c:1254 +#, c-format +msgid "%s: error copying private BFD data: %s" +msgstr "%s£º¸´ÖÆ BFD ˽ÓÐÊý¾Ý³ö´í£º%s" + +#: objcopy.c:1267 +msgid "unknown alternate machine code, ignored" +msgstr "" + +#: objcopy.c:1300 objcopy.c:1330 +#, c-format +msgid "cannot mkdir %s for archive copying (error: %s)" +msgstr "ÎÞ·¨Îª¹éµµ¸´ÖÆ´´½¨Ä¿Â¼ %s (´íÎó£º%s)" + +#: objcopy.c:1497 +#, c-format +msgid "Multiple renames of section %s" +msgstr "¶à´Î¸ÄÃû½Ú %s" + +#: objcopy.c:1581 +msgid "making" +msgstr "" + +#: objcopy.c:1590 +msgid "size" +msgstr "´óС" + +#: objcopy.c:1604 +msgid "vma" +msgstr "vma" + +#: objcopy.c:1630 +msgid "alignment" +msgstr "¶ÔÆë" + +#: objcopy.c:1638 +msgid "flags" +msgstr "±êÖ¾" + +#: objcopy.c:1655 +msgid "private data" +msgstr "˽ÓÐÊý¾Ý" + +#: objcopy.c:1663 +#, c-format +msgid "%s: section `%s': error in %s: %s" +msgstr "%s£º½Ú¡°%s¡±£º%s Öгö´í£º%s" + +#: objcopy.c:1946 +#, c-format +msgid "%s: can't create debugging section: %s" +msgstr "%s£ºÎÞ·¨´´½¨µ÷ÊÔ½Ú£º%s" + +#: objcopy.c:1961 +#, c-format +msgid "%s: can't set debugging section contents: %s" +msgstr "%s£ºÎÞ·¨É趨µ÷ÊÔ½ÚÄÚÈÝ£º%s" + +#: objcopy.c:1970 +#, c-format +msgid "%s: don't know how to write debugging information for %s" +msgstr "%s£º²»ÖªµÀÈçºÎΪ %s дÈëµ÷ÊÔÐÅÏ¢" + +#: objcopy.c:2078 +#, c-format +msgid "%s: cannot stat: %s" +msgstr "%s£ºÎÞ·¨ stat£º%s" + +#: objcopy.c:2129 +msgid "byte number must be non-negative" +msgstr "×Ö½Ú±àºÅ±ØÐëÊǷǸºÊý" + +#: objcopy.c:2139 +msgid "interleave must be positive" +msgstr "" + +#: objcopy.c:2159 objcopy.c:2167 +#, c-format +msgid "%s both copied and removed" +msgstr "¼´Òª¸´ÖÆ %s ÓÖҪɾ³ýËü" + +#: objcopy.c:2240 objcopy.c:2310 objcopy.c:2410 objcopy.c:2437 objcopy.c:2461 +#: objcopy.c:2465 objcopy.c:2485 +#, c-format +msgid "bad format for %s" +msgstr "%s ¸ñʽ´íÎó" + +#: objcopy.c:2379 +#, c-format +msgid "Warning: truncating gap-fill from 0x%s to 0x%x" +msgstr "¾¯¸æ£º½«¼ä϶Ìî³äÓÉ 0x%s ½Ø¶Ìµ½ 0x%x" + +#: objcopy.c:2531 +msgid "alternate machine code index must be positive" +msgstr "" + +#: objcopy.c:2550 +msgid "byte number must be less than interleave" +msgstr "" + +#: objcopy.c:2577 +#, c-format +msgid "architecture %s unknown" +msgstr "δ֪µÄÌåϵ½á¹¹ %s" + +#: objcopy.c:2581 +msgid "Warning: input target 'binary' required for binary architecture parameter." +msgstr "" + +#: objcopy.c:2582 +#, c-format +msgid " Argument %s ignored" +msgstr " ºöÂÔ²ÎÊý %s" + +#: objcopy.c:2588 +#, c-format +msgid "Cannot stat: %s: %s" +msgstr "ÎÞ·¨ stat£º%s£º%s" + +#: objcopy.c:2628 objcopy.c:2642 +#, c-format +msgid "%s %s%c0x%s never used" +msgstr "" + +#: objdump.c:165 +#, c-format +msgid "Usage: %s \n" +msgstr "Ó÷¨£º%s <Ñ¡Ïî> <Îļþ>\n" + +#: objdump.c:166 +msgid " Display information from object .\n" +msgstr " ÏÔʾÀ´×ÔÄ¿±ê <Îļþ> µÄÐÅÏ¢¡£\n" + +#: objdump.c:167 +msgid " At least one of the following switches must be given:\n" +msgstr " ÖÁÉÙ±ØÐë¸ø³öÒÔÏÂÑ¡ÏîÖ®Ò»£º\n" + +#: objdump.c:168 +msgid "" +" -a, --archive-headers Display archive header information\n" +" -f, --file-headers Display the contents of the overall file header\n" +" -p, --private-headers Display object format specific file header contents\n" +" -h, --[section-]headers Display the contents of the section headers\n" +" -x, --all-headers Display the contents of all headers\n" +" -d, --disassemble Display assembler contents of executable sections\n" +" -D, --disassemble-all Display assembler contents of all sections\n" +" -S, --source Intermix source code with disassembly\n" +" -s, --full-contents Display the full contents of all sections requested\n" +" -g, --debugging Display debug information in object file\n" +" -G, --stabs Display (in raw form) any STABS info in the file\n" +" -t, --syms Display the contents of the symbol table(s)\n" +" -T, --dynamic-syms Display the contents of the dynamic symbol table\n" +" -r, --reloc Display the relocation entries in the file\n" +" -R, --dynamic-reloc Display the dynamic relocation entries in the file\n" +" -v, --version Display this program's version number\n" +" -i, --info List object formats and architectures supported\n" +" -H, --help Display this information\n" +msgstr "" +" -a, --archive-headers ÏÔʾ¹éµµÎļþÍ·ÐÅÏ¢\n" +" -f, --file-headers ÏÔʾÕûÌåÎļþÍ·µÄÄÚÈÝ\n" +" -p, --private-headers ÏÔʾĿ±ê¸ñÊ½ÌØÓеÄÎļþÍ·ÄÚÈÝ\n" +" -h, --[section-]headers ÏÔʾ½ÚÍ·µÄÄÚÈÝ\n" +" -x, --all-headers ÏÔʾËùÓÐÍ·µÄÄÚÈÝ\n" +" -d, --disassemble ÏÔʾ¿ÉÖ´ÐнڵĻã±àÄÚÈÝ\n" +" -D, --disassemble-all ÏÔʾËùÓнڵĻã±àÄÚÈÝ\n" +" -S, --source ½«Ô´´úÂëºÍ·´»ã±à»ìºÏÆðÀ´\n" +" -s, --full-contents ÏÔʾËùÓÐÇëÇó½ÚµÄÍêÕûÄÚÈÝ\n" +" -g, --debugging ÏÔʾĿ±êÎļþµÄµ÷ÊÔÐÅÏ¢\n" +" -G, --stabs ÒÔԭʼÐÎʽÏÔʾÎļþÖÐËùÓÐµÄ STABS ÐÅÏ¢\n" +" -t, --syms ÏÔʾ·ûºÅ±íµÄÄÚÈÝ\n" +" -T, --dynamic-syms ÏÔʾ¶¯Ì¬·ûºÅ±íµÄÄÚÈÝ\n" +" -r, --reloc ÏÔʾÎļþÖеÄÖØ¶¨Î»ÌõÄ¿\n" +" -R, --dynamic-reloc ÏÔʾÎļþÖеĶ¯Ì¬Öض¨Î»ÌõÄ¿\n" +" -v, --version ÏÔʾ±¾³ÌÐòµÄ°æ±¾ºÅ\n" +" -i, --info ÁоÙÖ§³ÖµÄÄ¿±ê¸ñʽºÍÌåϵ½á¹¹\n" +" -H, --help ÏÔʾ±¾ÐÅÏ¢\n" + +#: objdump.c:190 +msgid "" +"\n" +" The following switches are optional:\n" +msgstr "" +"\n" +" ÒÔÏÂÑ¡ÏîÊÇ¿ÉÑ¡µÄ£º\n" + +#: objdump.c:191 +msgid "" +" -b, --target=BFDNAME Specify the target object format as BFDNAME\n" +" -m, --architecture=MACHINE Specify the target architecture as MACHINE\n" +" -j, --section=NAME Only display information for section NAME\n" +" -M, --disassembler-options=OPT Pass text OPT on to the disassembler\n" +" -EB --endian=big Assume big endian format when disassembling\n" +" -EL --endian=little Assume little endian format when disassembling\n" +" --file-start-context Include context from start of file (with -S)\n" +" -l, --line-numbers Include line numbers and filenames in output\n" +" -C, --demangle[=STYLE] Decode mangled/processed symbol names\n" +" The STYLE, if specified, can be `auto', 'gnu',\n" +" 'lucid', 'arm', 'hp', 'edg', or 'gnu-new-abi'\n" +" -w, --wide Format output for more than 80 columns\n" +" -z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling\n" +" --start-address=ADDR Only process data whoes address is >= ADDR\n" +" --stop-address=ADDR Only process data whoes address is <= ADDR\n" +" --prefix-addresses Print complete address alongside disassembly\n" +" --[no-]show-raw-insn Display hex alongside symbolic disassembly\n" +" --adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n" +"\n" +msgstr "" +" -b, --target=BFDNAME ½«±êµÄÄ¿±êÎļþ¸ñʽָ¶¨Îª BFDNAME\n" +" -m, --architecture=MACHINE ½«±êµÄÌåϵ½á¹¹Ö¸¶¨Îª MACHINE\n" +" -j, --section=NAME Ö»ÏÔʾ NAME ½ÚµÄÐÅÏ¢\n" +" -M, --disassembler-options=OPT ½«Îı¾´«µÝµ½ OPT ·´»ã±à³ÌÐò\n" +" -EB --endian=big ·´»ã±àʱ¼Ù¶¨¸ßλ×Ö½ÚÔÚǰ\n" +" -EL --endian=little ·´»ã±àʱ¼Ù¶¨µÍλ×Ö½ÚÔÚǰ\n" +" --file-start-context ´ÓÎļþµÄÆðµãÒýÈëÉÏÏÂÎÄ (´øÓÐ -S)\n" +" -l, --line-numbers ÔÚÊä³öÖиø³öÐкźÍÎļþÃû\n" +" -C, --demangle[=STYLE] ¶Ô mangled/´¦Àí¹ýµÄ·ûºÅÃû½øÐнâÂë\n" +" Èç¹û¸ø³öÁË STYLE£¬STYLE ¿ÉÄÜΪ¡°auto¡±¡¢¡°gnu¡±¡¢\n" +" ¡°lucid¡±¡¢¡°arm¡±¡¢¡°hp¡±¡¢¡°edg¡±»ò¡°gnu-new-abi¡±\n" +" -w, --wide ÒÔ¶àÓÚ 80 ÁеĿí¶È¶ÔÊä³ö½øÐиñʽ»¯\n" +" -z, --disassemble-zeroes ·´»ã±àʱ²»ÒªÌø¹ýΪÁãµÄ¿é\n" +" --start-address=ADDR Ö»Óнø³ÌÊý¾ÝµÄµØÖ· >= ADDR\n" +" --stop-address=ADDR Ö»Óнø³ÌÊý¾ÝµÄµØÖ· <= ADDR\n" +" --prefix-addresses ͬ·´»ã±à´úÂë²¢ÁÐÏÔʾÍêÕûµÄµØÖ·\n" +" --[no-]show-raw-insn ͬ·ûºÅ·´»ã±à²¢ÁÐÏÔʾʮÁù½øÖÆÖµ\n" +" --adjust-vma=OFFSET ΪËùÓÐÏÔʾµÄ½ÚµØÖ·Ôö¼Ó OFFSET\n" +"\n" + +#: objdump.c:358 +msgid "Sections:\n" +msgstr "½Ú£º\n" + +#: objdump.c:361 objdump.c:365 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "" + +#: objdump.c:367 +msgid "Idx Name Size VMA LMA File off Algn" +msgstr "" + +#: objdump.c:371 +msgid " Flags" +msgstr " ±êÖ¾" + +#: objdump.c:419 +#, c-format +msgid "%s: not a dynamic object" +msgstr "%s£º²»ÊǶ¯Ì¬¶ÔÏó" + +#: objdump.c:433 +#, c-format +msgid "%s: No dynamic symbols" +msgstr "%s£ºÃ»Óж¯Ì¬·ûºÅ" + +#: objdump.c:1114 +msgid "Out of virtual memory" +msgstr "Ðé´æ²»×ã" + +#: objdump.c:1543 +#, c-format +msgid "Can't use supplied machine %s" +msgstr "ÎÞ·¨Ê¹ÓÃÖ§³ÖµÄ»úÆ÷ %s" + +#: objdump.c:1561 +#, c-format +msgid "Can't disassemble for architecture %s\n" +msgstr "ÎÞ·¨·´»ã±àÌåϵ½á¹¹ %s\n" + +#: objdump.c:1643 +#, c-format +msgid "Disassembly of section %s:\n" +msgstr "·´»ã±à %s ½Ú£º\n" + +#: objdump.c:1818 +#, c-format +msgid "" +"No %s section present\n" +"\n" +msgstr "" +"%s ½Ú²»´æÔÚ\n" +"\n" + +#: objdump.c:1825 +#, c-format +msgid "%s has no %s section" +msgstr "%s ûÓÐ %s ½Ú" + +#: objdump.c:1839 +#, c-format +msgid "Reading %s section of %s failed: %s" +msgstr "¶ÁÈë %2$s µÄ %1$s ½Úʧ°Ü£º%3$s" + +#: objdump.c:1851 +#, c-format +msgid "Reading %s section of %s failed: %s\n" +msgstr "¶ÁÈë %2$s µÄ %1$s ½Úʧ°Ü£º%3$s\n" + +#: objdump.c:1894 +#, c-format +msgid "" +"Contents of %s section:\n" +"\n" +msgstr "" +"%s ½ÚµÄÄÚÈÝ£º\n" +"\n" + +#: objdump.c:1994 +#, c-format +msgid "architecture: %s, " +msgstr "Ìåϵ½á¹¹£º%s£¬" + +#: objdump.c:1997 +#, c-format +msgid "flags 0x%08x:\n" +msgstr "±êÖ¾ 0x%08x£º\n" + +#: objdump.c:2010 +msgid "" +"\n" +"start address 0x" +msgstr "" +"\n" +"ÆðʼµØÖ· 0x" + +#: objdump.c:2042 +#, c-format +msgid "" +"\n" +"%s: file format %s\n" +msgstr "" +"\n" +"%s£º Îļþ¸ñʽ %s\n" + +#: objdump.c:2084 +#, c-format +msgid "%s: printing debugging information failed" +msgstr "%s£º´òÓ¡µ÷ÊÔÐÅϢʧ°Ü" + +#: objdump.c:2161 +#, c-format +msgid "In archive %s:\n" +msgstr "Ôڹ鵵Îļþ %s ÖУº\n" + +#: objdump.c:2213 +#, c-format +msgid "Contents of section %s:\n" +msgstr "%s ½ÚµÄÄÚÈÝ£º\n" + +#: objdump.c:2718 +#, c-format +msgid "BFD header file version %s\n" +msgstr "BFD Í·Îļþ°æ±¾ %s\n" + +#: objdump.c:2807 +msgid "unrecognized -E option" +msgstr "ÎÞ·¨Ê¶±ðµÄ -E Ñ¡Ïî" + +#: objdump.c:2818 +#, c-format +msgid "unrecognized --endian type `%s'" +msgstr "ÎÞ·¨Ê¶±ðµÄ --endian ÀàÐÍ¡°%s¡±" + +#: rdcoff.c:204 +#, c-format +msgid "parse_coff_type: Bad type code 0x%x" +msgstr "parse_coff_type£º´íÎóµÄÀàÐÍÂë 0x%x" + +#: rdcoff.c:422 rdcoff.c:530 rdcoff.c:729 +#, c-format +msgid "bfd_coff_get_syment failed: %s" +msgstr "bfd_coff_get_syment ʧ°Ü£º%s" + +#: rdcoff.c:438 rdcoff.c:749 +#, c-format +msgid "bfd_coff_get_auxent failed: %s" +msgstr "bfd_coff_get_auxent ʧ°Ü£º%s" + +#: rdcoff.c:816 +#, c-format +msgid "%ld: .bf without preceding function" +msgstr "" + +#: rdcoff.c:866 +#, c-format +msgid "%ld: unexpected .ef\n" +msgstr "%ld£ºÒâÍâµÄ .ef\n" + +#: rddbg.c:87 +#, c-format +msgid "%s: no recognized debugging information" +msgstr "%s£ºÎ´Ê¶±ðµÄµ÷ÊÔÐÅÏ¢" + +#: rddbg.c:410 +msgid "Last stabs entries before error:\n" +msgstr "" + +#: readelf.c:328 +#, c-format +msgid "%s: Error: " +msgstr "%s£º´íÎó£º" + +#: readelf.c:339 +#, c-format +msgid "%s: Warning: " +msgstr "%s£º¾¯¸æ£º" + +#: readelf.c:361 +#, c-format +msgid "Unable to seek to %x for %s\n" +msgstr "" + +#: readelf.c:372 +#, c-format +msgid "Out of memory allocating %d bytes for %s\n" +msgstr "" + +#: readelf.c:380 +#, c-format +msgid "Unable to read in %d bytes of %s\n" +msgstr "" + +#: readelf.c:433 readelf.c:591 +#, c-format +msgid "Unhandled data length: %d\n" +msgstr "δ´¦ÀíµÄÊý¾Ý³¤¶È£º%d\n" + +#: readelf.c:675 +msgid "Don't know about relocations on this machine architecture\n" +msgstr "²»ÖªµÀ¹ØÓÚ±¾»úÆ÷Ìåϵ½á¹¹ÖÐÖØ¶¨Î»µÄÇé¿ö\n" + +#: readelf.c:697 readelf.c:726 readelf.c:772 readelf.c:799 +msgid "relocs" +msgstr "ÖØ¶¨Î»" + +#: readelf.c:708 readelf.c:737 readelf.c:782 readelf.c:809 +msgid "out of memory parsing relocs" +msgstr "½âÎöÖØ¶¨Î»ÄÚ´æ²»×ã" + +#: readelf.c:861 +msgid " Offset Info Type Sym. Value Symbol's Name + Addend\n" +msgstr "" + +#: readelf.c:863 +msgid " Offset Info Type Sym.Value Sym. Name + Addend\n" +msgstr "" + +#: readelf.c:868 +msgid " Offset Info Type Sym. Value Symbol's Name\n" +msgstr "" + +#: readelf.c:870 +msgid " Offset Info Type Sym.Value Sym. Name\n" +msgstr "" + +#: readelf.c:878 +msgid " Offset Info Type Symbol's Value Symbol's Name + Addend\n" +msgstr "" + +#: readelf.c:880 +msgid " Offset Info Type Sym. Value Sym. Name + Addend\n" +msgstr "" + +#: readelf.c:885 +msgid " Offset Info Type Symbol's Value Symbol's Name\n" +msgstr "" + +#: readelf.c:887 +msgid " Offset Info Type Sym. Value Sym. Name\n" +msgstr "" + +#: readelf.c:1134 readelf.c:1136 readelf.c:1184 readelf.c:1186 readelf.c:1195 +#: readelf.c:1197 +#, c-format +msgid "unrecognized: %-7lx" +msgstr "²»ÄÜʶ±ðµÄ£º%-7lx" + +#: readelf.c:1158 +#, c-format +msgid "" +msgstr "<×Ö·û´®±íË÷Òý %3ld>" + +#: readelf.c:1423 +#, c-format +msgid "Processor Specific: %lx" +msgstr "´¦ÀíÆ÷ÌØÓУº%lx" + +#: readelf.c:1442 +#, c-format +msgid "Operating System specific: %lx" +msgstr "²Ù×÷ÏµÍ³ÌØÓУº%lx" + +#: readelf.c:1445 readelf.c:2086 +#, c-format +msgid ": %lx" +msgstr "<δ֪>£º%lx" + +#: readelf.c:1459 +msgid "NONE (None)" +msgstr "NONE (ÎÞ)" + +#: readelf.c:1460 +msgid "REL (Relocatable file)" +msgstr "REL (¿ÉÖØ¶¨Î»Îļþ)" + +#: readelf.c:1461 +msgid "EXEC (Executable file)" +msgstr "EXEC (¿ÉÖ´ÐÐÎļþ)" + +#: readelf.c:1462 +msgid "DYN (Shared object file)" +msgstr "DYN (¹²ÏíÄ¿±êÎļþ)" + +#: readelf.c:1463 +msgid "CORE (Core file)" +msgstr "CORE (Core Îļþ)" + +#: readelf.c:1467 +#, c-format +msgid "Processor Specific: (%x)" +msgstr "´¦ÀíÆ÷ÌØÓУº(%x)" + +#: readelf.c:1469 +#, c-format +msgid "OS Specific: (%x)" +msgstr "²Ù×÷ÏµÍ³ÌØÓУº(%x)" + +#: readelf.c:1471 readelf.c:1573 readelf.c:2238 +#, c-format +msgid ": %x" +msgstr "<δ֪>£º%x" + +#: readelf.c:1484 +msgid "None" +msgstr "ÎÞ" + +#: readelf.c:2278 +msgid "Usage: readelf elf-file(s)\n" +msgstr "Ó÷¨£ºreadelf <Ñ¡Ïî> elf-Îļþ\n" + +#: readelf.c:2279 +msgid " Display information about the contents of ELF format files\n" +msgstr " ÏÔʾ¹ØÓÚ ELF ¸ñʽÎļþÄÚÈݵÄÐÅÏ¢\n" + +#: readelf.c:2280 +msgid "" +" Options are:\n" +" -a --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" +" -h --file-header Display the ELF file header\n" +" -l --program-headers Display the program headers\n" +" --segments An alias for --program-headers\n" +" -S --section-headers Display the sections' header\n" +" --sections An alias for --section-headers\n" +" -e --headers Equivalent to: -h -l -S\n" +" -s --syms Display the symbol table\n" +" --symbols An alias for --syms\n" +" -n --notes Display the core notes (if present)\n" +" -r --relocs Display the relocations (if present)\n" +" -u --unwind Display the unwind info (if present)\n" +" -d --dynamic Display the dynamic segment (if present)\n" +" -V --version-info Display the version sections (if present)\n" +" -A --arch-specific Display architecture specific information (if any).\n" +" -D --use-dynamic Use the dynamic section info when displaying symbols\n" +" -x --hex-dump= Dump the contents of section \n" +" -w --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n" +" Display the contents of DWARF2 debug sections\n" +msgstr "" +" Ñ¡ÏîΪ£º\n" +" -a --all µÈ¼ÛÓÚ£º-h -l -S -s -r -d -V -A -I\n" +" -h --file-header ÏÔʾ ELF ÎļþÍ·\n" +" -l --program-headers ÏÔʾ³ÌÐòÍ·\n" +" --segments --program-headers µÄ±ðÃû\n" +" -S --section-headers ÏÔʾ½ÚÍ·\n" +" --sections --section-headers µÄ±ðÃû\n" +" -e --headers µÈ¼ÛÓÚ£º-h -l -S\n" +" -s --syms ÏÔʾ·ûºÅ±í\n" +" --symbols --syms µÄ±ðÃû\n" +" -n --notes ÏÔʾºËÐÄ×¢ÊÍ (Èç¹ûÓеϰ)\n" +" -r --relocs ÏÔÊ¾ÖØ¶¨Î» (Èç¹ûÓеϰ)\n" +" -u --unwind ÏÔʾչ¿ª(unwind)ÐÅÏ¢ (Èç¹ûÓеϰ)\n" +" -d --dynamic ÏÔʾ¶¯Ì¬½Ú (Èç¹ûÓеϰ)\n" +" -V --version-info ÏÔʾ°æ±¾½Ú (Èç¹ûÓеϰ)\n" +" -A --arch-specific ÏÔʾÌåϵ½á¹¹ÌØÓеÄÐÅÏ¢ (Èç¹ûÓеϰ).\n" +" -D --use-dynamic ÏÔʾ·ûºÅµÄʱºòʹÓö¯Ì¬½ÚÐÅÏ¢\n" +" -x --hex-dump=<±àºÅ> Êä³ö <±àºÅ> ½ÚµÄÄÚÈÝ\n" +" -w --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n" +" ÏÔʾ DWARF2 µ÷ÊÔ½ÚµÄÄÚÈÝ\n" + +#: readelf.c:2301 +msgid "" +" -i --instruction-dump=\n" +" Disassemble the contents of section \n" +msgstr "" +" -i --instruction-dump=<±àºÅ>\n" +" ·´»ã±à½Ú <±àºÅ> µÄÄÚÈÝ\n" + +#: readelf.c:2305 +msgid "" +" -I --histogram Display histogram of bucket list lengths\n" +" -W --wide Allow output width to exceed 80 characters\n" +" -H --help Display this information\n" +" -v --version Display the version number of readelf\n" +msgstr "" + +#: readelf.c:2327 +msgid "Out of memory allocating dump request table." +msgstr "" + +#: readelf.c:2491 +#, c-format +msgid "Unrecognized debug option '%s'\n" +msgstr "ÎÞ·¨Ê¶±ðµÄµ÷ÊÔÑ¡Ïî¡°%s¡±\n" + +#: readelf.c:2519 +#, c-format +msgid "Invalid option '-%c'\n" +msgstr "ÎÞЧµÄÑ¡Ïî¡°-%c¡±\n" + +#: readelf.c:2532 +msgid "Nothing to do.\n" +msgstr "ÎÞÊ¿É×ö¡£\n" + +#: readelf.c:2545 readelf.c:2562 readelf.c:4867 +msgid "none" +msgstr "ÎÞ" + +#: readelf.c:2549 readelf.c:2566 readelf.c:2594 +#, c-format +msgid "" +msgstr "<δ֪£º%x>" + +#: readelf.c:2563 +msgid "2's complement, little endian" +msgstr "" + +#: readelf.c:2564 +msgid "2's complement, big endian" +msgstr "" + +#: readelf.c:2591 +msgid "Standalone App" +msgstr "¶ÀÁ¢Ó¦ÓóÌÐò" + +#: readelf.c:2609 +msgid "Not an ELF file - it has the wrong magic bytes at the start\n" +msgstr "²»ÊÇ ELF Îļþ - Ëü¿ªÍ·µÄ magic ×Ö½Ú´íÎó\n" + +#: readelf.c:2617 +msgid "ELF Header:\n" +msgstr "ELF Í·£º\n" + +#: readelf.c:2618 +msgid " Magic: " +msgstr " Magic£º " + +#: readelf.c:2622 +#, c-format +msgid " Class: %s\n" +msgstr "" + +#: readelf.c:2624 +#, c-format +msgid " Data: %s\n" +msgstr "" + +#: readelf.c:2626 +#, c-format +msgid " Version: %d %s\n" +msgstr "" + +#: readelf.c:2633 +#, c-format +msgid " OS/ABI: %s\n" +msgstr "" + +#: readelf.c:2635 +#, c-format +msgid " ABI Version: %d\n" +msgstr "" + +#: readelf.c:2637 +#, c-format +msgid " Type: %s\n" +msgstr "" + +#: readelf.c:2639 +#, c-format +msgid " Machine: %s\n" +msgstr "" + +#: readelf.c:2641 +#, c-format +msgid " Version: 0x%lx\n" +msgstr "" + +#: readelf.c:2644 +msgid " Entry point address: " +msgstr " Èë¿ÚµãµØÖ·£º " + +#: readelf.c:2646 +msgid "" +"\n" +" Start of program headers: " +msgstr "" +"\n" +" ³ÌÐòÍ·Æðµã£º " + +#: readelf.c:2648 +msgid "" +" (bytes into file)\n" +" Start of section headers: " +msgstr "" + +#: readelf.c:2650 +msgid " (bytes into file)\n" +msgstr "" + +#: readelf.c:2652 +#, c-format +msgid " Flags: 0x%lx%s\n" +msgstr " ±êÖ¾£º 0x%lx%s\n" + +#: readelf.c:2655 +#, c-format +msgid " Size of this header: %ld (bytes)\n" +msgstr " ±¾Í·µÄ´óС£º %ld (×Ö½Ú)\n" + +#: readelf.c:2657 +#, c-format +msgid " Size of program headers: %ld (bytes)\n" +msgstr " ³ÌÐòÍ·´óС£º %ld (×Ö½Ú)\n" + +#: readelf.c:2659 +#, c-format +msgid " Number of program headers: %ld\n" +msgstr " ³ÌÐòÍ·ÊýÁ¿£º %ld\n" + +#: readelf.c:2661 +#, c-format +msgid " Size of section headers: %ld (bytes)\n" +msgstr " ½ÚÍ·´óС£º %ld (×Ö½Ú)\n" + +#: readelf.c:2663 +#, c-format +msgid " Number of section headers: %ld" +msgstr " ½ÚÍ·ÊýÁ¿£º %ld" + +#: readelf.c:2668 +#, c-format +msgid " Section header string table index: %ld" +msgstr " ×Ö·û´®±íË÷Òý½ÚÍ·£º %ld" + +#: readelf.c:2702 readelf.c:2738 +msgid "program headers" +msgstr "³ÌÐòÍ·" + +#: readelf.c:2772 +msgid "" +"\n" +"There are no program headers in this file.\n" +msgstr "" +"\n" +"±¾ÎļþÖÐûÓгÌÐòÍ·¡£\n" + +#: readelf.c:2778 +#, c-format +msgid "" +"\n" +"Elf file type is %s\n" +msgstr "" +"\n" +"Elf ÎļþÀàÐÍΪ %s\n" + +#: readelf.c:2779 +msgid "Entry point " +msgstr "Èë¿Úµã " + +#: readelf.c:2781 +#, c-format +msgid "" +"\n" +"There are %d program headers, starting at offset " +msgstr "" +"\n" +"¹²ÓÐ %d ¸ö³ÌÐòÍ·£¬¿ªÊ¼ÓÚÆ«ÒÆÁ¿" + +#: readelf.c:2792 readelf.c:3019 readelf.c:3065 readelf.c:3128 readelf.c:3195 +#: readelf.c:4229 readelf.c:4272 readelf.c:4461 readelf.c:5414 readelf.c:5428 +#: readelf.c:9659 readelf.c:9699 +msgid "Out of memory\n" +msgstr "ÄÚ´æ²»×ã\n" + +#: readelf.c:2810 readelf.c:2812 +msgid "" +"\n" +"Program Headers:\n" +msgstr "" +"\n" +"³ÌÐòÍ·£º\n" + +#: readelf.c:2816 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr "" + +#: readelf.c:2819 +msgid " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" +msgstr "" + +#: readelf.c:2823 +msgid " Type Offset VirtAddr PhysAddr\n" +msgstr "" + +#: readelf.c:2825 +msgid " FileSiz MemSiz Flags Align\n" +msgstr "" + +#: readelf.c:2925 +msgid "more than one dynamic segment\n" +msgstr "¶àÓÚÒ»¸ö¶¯Ì¬¶Î\n" + +#: readelf.c:2933 +msgid "Unable to find program interpreter name\n" +msgstr "ÎÞ·¨ÕÒµ½³ÌÐò½âÊÍÆ÷Ãû³Æ\n" + +#: readelf.c:2940 +#, c-format +msgid "" +"\n" +" [Requesting program interpreter: %s]" +msgstr "" +"\n" +" [ÕýÔÚÇëÇó³ÌÐò½âÊÍÆ÷£º%s]" + +#: readelf.c:2958 +msgid "" +"\n" +" Section to Segment mapping:\n" +msgstr "" + +#: readelf.c:2959 +msgid " Segment Sections...\n" +msgstr " ¶Î½Ú...\n" + +#: readelf.c:3010 readelf.c:3056 +msgid "section headers" +msgstr "½ÚÍ·" + +#: readelf.c:3104 readelf.c:3171 +msgid "symbols" +msgstr "·ûºÅ" + +#: readelf.c:3115 readelf.c:3182 +msgid "symtab shndx" +msgstr "" + +#: readelf.c:3284 +msgid "" +"\n" +"There are no sections in this file.\n" +msgstr "" +"\n" +"±¾ÎļþÖÐûÓнڡ£\n" + +#: readelf.c:3290 +#, c-format +msgid "There are %d section headers, starting at offset 0x%lx:\n" +msgstr "¹²ÓÐ %d ¸ö½ÚÍ·£¬´ÓÆ«ÒÆÁ¿ 0x%lx ¿ªÊ¼£º\n" + +#: readelf.c:3307 readelf.c:3621 readelf.c:3968 readelf.c:5565 +msgid "string table" +msgstr "×Ö·û´®±í" + +#: readelf.c:3328 +msgid "File contains multiple dynamic symbol tables\n" +msgstr "Îļþº¬Óжà¸ö¶¯Ì¬·ûºÅ±í\n" + +#: readelf.c:3340 +msgid "File contains multiple dynamic string tables\n" +msgstr "Îļþº¬Óжà¸ö¶¯Ì¬×Ö·û´®±í\n" + +#: readelf.c:3346 +msgid "dynamic strings" +msgstr "¶¯Ì¬×Ö·û´®" + +#: readelf.c:3352 +msgid "File contains multiple symtab shndx tables\n" +msgstr "" + +#: readelf.c:3390 +msgid "" +"\n" +"Section Headers:\n" +msgstr "" +"\n" +"½ÚÍ·£º\n" + +#: readelf.c:3392 +msgid "" +"\n" +"Section Header:\n" +msgstr "" +"\n" +"½ÚÍ·£º\n" + +#: readelf.c:3396 +msgid " [Nr] Name Type Addr Off Size ES Flg Lk Inf Al\n" +msgstr "" + +#: readelf.c:3399 +msgid " [Nr] Name Type Address Off Size ES Flg Lk Inf Al\n" +msgstr "" + +#: readelf.c:3402 +msgid " [Nr] Name Type Address Offset\n" +msgstr "" + +#: readelf.c:3403 +msgid " Size EntSize Flags Link Info Align\n" +msgstr "" + +#: readelf.c:3498 +msgid "" +"Key to Flags:\n" +" W (write), A (alloc), X (execute), M (merge), S (strings)\n" +" I (info), L (link order), G (group), x (unknown)\n" +" O (extra OS processing required) o (OS specific), p (processor specific)\n" +msgstr "" + +#: readelf.c:3559 +#, c-format +msgid "" +"\n" +"Relocation section at offset 0x%lx contains %ld bytes:\n" +msgstr "" +"\n" +"λÓÚÆ«ÒÆÁ¿ 0x%lx µÄÖØ¶¨Î»½Úº¬ÓÐ %ld ¸ö×Ö½Ú£º\n" + +#: readelf.c:3566 +msgid "" +"\n" +"There are no dynamic relocations in this file.\n" +msgstr "" +"\n" +"±¾ÎļþÖÐûÓж¯Ì¬Öض¨Î»¡£\n" + +#: readelf.c:3593 +msgid "" +"\n" +"Relocation section " +msgstr "" +"\n" +"ÖØ¶¨Î»½Ú " + +#: readelf.c:3598 readelf.c:4031 readelf.c:4045 +#, c-format +msgid "'%s'" +msgstr "¡°%s¡±" + +#: readelf.c:3600 readelf.c:4047 +#, c-format +msgid " at offset 0x%lx contains %lu entries:\n" +msgstr " λÓÚÆ«ÒÆÁ¿ 0x%lx º¬ÓÐ %lu ¸öÌõÄ¿£º\n" + +#: readelf.c:3638 +msgid "" +"\n" +"There are no relocations in this file.\n" +msgstr "" +"\n" +"¸ÃÎļþÖÐûÓÐÖØ¶¨Î»ÐÅÏ¢¡£\n" + +#: readelf.c:3834 +msgid "unwind table" +msgstr "" + +#: readelf.c:3885 readelf.c:3897 readelf.c:7890 readelf.c:7901 +#, c-format +msgid "Skipping unexpected symbol type %u\n" +msgstr "Ìø¹ýÒâÍâµÄ·ûºÅÀàÐÍ %u\n" + +#: readelf.c:3905 +#, c-format +msgid "Skipping unexpected relocation type %s\n" +msgstr "Ìø¹ýÒâÍâµÄÖØ¶¨Î»ÀàÐÍ %s\n" + +#: readelf.c:3950 readelf.c:3975 +msgid "" +"\n" +"There are no unwind sections in this file.\n" +msgstr "" + +#: readelf.c:4026 +msgid "" +"\n" +"Could not find unwind info section for " +msgstr "" + +#: readelf.c:4038 +msgid "unwind info" +msgstr "" + +#: readelf.c:4040 +msgid "" +"\n" +"Unwind section " +msgstr "" + +#: readelf.c:4213 readelf.c:4256 +msgid "dynamic segment" +msgstr "¶¯Ì¬½Ú" + +#: readelf.c:4334 +msgid "" +"\n" +"There is no dynamic segment in this file.\n" +msgstr "" +"\n" +"±¾ÎļþûÓж¯Ì¬½Ú¡£\n" + +#: readelf.c:4368 +msgid "Unable to seek to end of file!" +msgstr "ÎÞ·¨¶¨Î»µÄÎļþĩβ£¡" + +#: readelf.c:4379 +msgid "Unable to determine the number of symbols to load\n" +msgstr "ÎÞ·¨È·¶¨Òª¶ÁÈëµÄ·ûºÅÊýÁ¿\n" + +#: readelf.c:4409 +msgid "Unable to seek to end of file\n" +msgstr "ÎÞ·¨¶¨Î»µ½Îļþĩβ\n" + +#: readelf.c:4415 +msgid "Unable to determine the length of the dynamic string table\n" +msgstr "ÎÞ·¨È·¶¨¶¯Ì¬×Ö·û´®±íµÄ³¤¶È\n" + +#: readelf.c:4420 +msgid "dynamic string table" +msgstr "¶¯Ì¬×Ö·û´®±í" + +#: readelf.c:4454 +msgid "symbol information" +msgstr "·ûºÅÐÅÏ¢" + +#: readelf.c:4478 +#, c-format +msgid "" +"\n" +"Dynamic segment at offset 0x%x contains %ld entries:\n" +msgstr "" +"\n" +"λÓÚÆ«ÒÆÁ¿ 0x%x ´¦µÄ¶¯Ì¬½Úº¬ÓÐ %ld ¸öÌõÄ¿£º\n" + +#: readelf.c:4481 +msgid " Tag Type Name/Value\n" +msgstr " ±ê¼Ç ÀàÐÍ Ãû³Æ/Öµ\n" + +#: readelf.c:4517 +msgid "Auxiliary library" +msgstr "¸½¼Ó¿â" + +#: readelf.c:4521 +msgid "Filter library" +msgstr "¹ýÂËÆ÷¿â" + +#: readelf.c:4525 +msgid "Configuration file" +msgstr "ÅäÖÃÎļþ" + +#: readelf.c:4529 +msgid "Dependency audit library" +msgstr "" + +#: readelf.c:4533 +msgid "Audit library" +msgstr "" + +#: readelf.c:4551 readelf.c:4577 readelf.c:4603 +msgid "Flags:" +msgstr "±êÖ¾£º" + +#: readelf.c:4553 readelf.c:4579 readelf.c:4605 +msgid " None\n" +msgstr " ÎÞ\n" + +#: readelf.c:4724 +#, c-format +msgid "Shared library: [%s]" +msgstr "¹²Ïí¿â£º[%s]" + +#: readelf.c:4727 +msgid " program interpreter" +msgstr " ³ÌÐò½âÊÍÆ÷" + +#: readelf.c:4731 +#, c-format +msgid "Library soname: [%s]" +msgstr "" + +#: readelf.c:4735 +#, c-format +msgid "Library rpath: [%s]" +msgstr "" + +#: readelf.c:4739 +#, c-format +msgid "Library runpath: [%s]" +msgstr "" + +#: readelf.c:4802 +#, c-format +msgid "Not needed object: [%s]\n" +msgstr "²»ÐèÒªµÄÄ¿±ê£º[%s]\n" + +#: readelf.c:4913 +#, c-format +msgid "" +"\n" +"Version definition section '%s' contains %ld entries:\n" +msgstr "" +"\n" +"°æ±¾¶¨Òå½Ú¡°%s¡±º¬ÓÐ %ld ¸öÌõÄ¿£º\n" + +#: readelf.c:4916 +msgid " Addr: 0x" +msgstr " µØÖ·£º0x" + +#: readelf.c:4918 readelf.c:5113 +#, c-format +msgid " Offset: %#08lx Link: %lx (%s)\n" +msgstr " Æ«ÒÆÁ¿£º%#08lx Á¬½Ó£º%lx (%s)\n" + +#: readelf.c:4925 +msgid "version definition section" +msgstr "°æ±¾¶¨Òå½Ú" + +#: readelf.c:4951 +#, c-format +msgid " %#06x: Rev: %d Flags: %s" +msgstr "" + +#: readelf.c:4954 +#, c-format +msgid " Index: %d Cnt: %d " +msgstr "" + +#: readelf.c:4965 +#, c-format +msgid "Name: %s\n" +msgstr "Ãû³Æ£º%s\n" + +#: readelf.c:4967 +#, c-format +msgid "Name index: %ld\n" +msgstr "Ãû³ÆË÷Òý£º%ld\n" + +#: readelf.c:4982 +#, c-format +msgid " %#06x: Parent %d: %s\n" +msgstr "" + +#: readelf.c:4985 +#, c-format +msgid " %#06x: Parent %d, name index: %ld\n" +msgstr "" + +#: readelf.c:5004 +#, c-format +msgid "" +"\n" +"Version needs section '%s' contains %ld entries:\n" +msgstr "" + +#: readelf.c:5007 +msgid " Addr: 0x" +msgstr " µØÖ·£º0x" + +#: readelf.c:5009 +#, c-format +msgid " Offset: %#08lx Link to section: %ld (%s)\n" +msgstr "" + +#: readelf.c:5015 +msgid "version need section" +msgstr "°æ±¾ÐèÒª½Ú" + +#: readelf.c:5037 +#, c-format +msgid " %#06x: Version: %d" +msgstr "" + +#: readelf.c:5040 +#, c-format +msgid " File: %s" +msgstr " Îļþ£º%s" + +#: readelf.c:5042 +#, c-format +msgid " File: %lx" +msgstr " Îļþ£º%lx" + +#: readelf.c:5044 +#, c-format +msgid " Cnt: %d\n" +msgstr " ¼ÆÊý£º%d\n" + +#: readelf.c:5062 +#, c-format +msgid " %#06x: Name: %s" +msgstr " %#06x£ºÃû³Æ£º%s" + +#: readelf.c:5065 +#, c-format +msgid " %#06x: Name index: %lx" +msgstr " %#06x£ºÃû³ÆË÷Òý£º%lx" + +#: readelf.c:5068 +#, c-format +msgid " Flags: %s Version: %d\n" +msgstr " ±êÖ¾£º%s °æ±¾£º%d\n" + +#: readelf.c:5104 +msgid "version string table" +msgstr "°æ±¾×Ö·û´®±í" + +#: readelf.c:5108 +#, c-format +msgid "" +"\n" +"Version symbols section '%s' contains %d entries:\n" +msgstr "" +"\n" +"°æ±¾·ûºÅ½Ú¡°%s¡±º¬ÓÐ %d ¸öÌõÄ¿£º\n" + +#: readelf.c:5111 +msgid " Addr: " +msgstr " µØÖ·£º" + +#: readelf.c:5121 +msgid "version symbol data" +msgstr "°æ±¾·ûºÅÊý¾Ý" + +#: readelf.c:5148 +msgid " 0 (*local*) " +msgstr " 0 (*±¾µØ*) " + +#: readelf.c:5152 +msgid " 1 (*global*) " +msgstr " 1 (*È«¾Ö*) " + +#: readelf.c:5187 readelf.c:5622 +msgid "version need" +msgstr "" + +#: readelf.c:5197 +msgid "version need aux (2)" +msgstr "" + +#: readelf.c:5238 readelf.c:5684 +msgid "version def" +msgstr "" + +#: readelf.c:5257 readelf.c:5699 +msgid "version def aux" +msgstr "" + +#: readelf.c:5288 +msgid "" +"\n" +"No version information found in this file.\n" +msgstr "" + +#: readelf.c:5420 +msgid "Unable to read in dynamic data\n" +msgstr "ÎÞ·¨¶ÁÈ붯̬Êý¾Ý\n" + +#: readelf.c:5462 +msgid "Unable to seek to start of dynamic information" +msgstr "ÎÞ·¨¶¨Î»µ½¶¯Ì¬ÐÅÏ¢µÄÆðµã" + +#: readelf.c:5468 +msgid "Failed to read in number of buckets\n" +msgstr "" + +#: readelf.c:5474 +msgid "Failed to read in number of chains\n" +msgstr "" + +#: readelf.c:5494 +msgid "" +"\n" +"Symbol table for image:\n" +msgstr "" + +#: readelf.c:5496 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr "" + +#: readelf.c:5498 +msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" +msgstr "" + +#: readelf.c:5543 +#, c-format +msgid "" +"\n" +"Symbol table '%s' contains %lu entries:\n" +msgstr "" + +#: readelf.c:5547 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr "" + +#: readelf.c:5549 +msgid " Num: Value Size Type Bind Vis Ndx Name\n" +msgstr "" + +#: readelf.c:5595 +msgid "version data" +msgstr "°æ±¾Êý¾Ý" + +#: readelf.c:5635 +msgid "version need aux (3)" +msgstr "" + +#: readelf.c:5660 +msgid "bad dynamic symbol" +msgstr "´íÎóµÄ¶¯Ì¬·ûºÅ" + +#: readelf.c:5722 +msgid "" +"\n" +"Dynamic symbol information is not available for displaying symbols.\n" +msgstr "" + +#: readelf.c:5734 +#, c-format +msgid "" +"\n" +"Histogram for bucket list length (total of %d buckets):\n" +msgstr "" + +#: readelf.c:5736 +#, c-format +msgid " Length Number %% of total Coverage\n" +msgstr "" + +#: readelf.c:5741 readelf.c:5760 readelf.c:9146 readelf.c:9338 +msgid "Out of memory" +msgstr "ÄÚ´æ²»×ã" + +#: readelf.c:5809 +#, c-format +msgid "" +"\n" +"Dynamic info segment at offset 0x%lx contains %d entries:\n" +msgstr "" +"\n" +"λÓÚÆ«ÒÆÁ¿ 0x%lx µÄ¶¯Ì¬ÐÅÏ¢½Úº¬ÓÐ %d ¸öÌõÄ¿£º\n" + +#: readelf.c:5812 +msgid " Num: Name BoundTo Flags\n" +msgstr "" + +#: readelf.c:5864 +#, c-format +msgid "" +"\n" +"Assembly dump of section %s\n" +msgstr "" + +#: readelf.c:5887 +#, c-format +msgid "" +"\n" +"Section '%s' has no data to dump.\n" +msgstr "" +"\n" +"¡°%s¡±½ÚûÓпÉÊä³öµÄÊý¾Ý¡£\n" + +#: readelf.c:5892 +#, c-format +msgid "" +"\n" +"Hex dump of section '%s':\n" +msgstr "" +"\n" +"¡°%s¡±½ÚµÄÊ®Áù½øÖÆÊä³ö£º\n" + +#: readelf.c:5897 +msgid "section data" +msgstr "½ÚÊä³ö" + +#: readelf.c:6046 +msgid "badly formed extended line op encountered!\n" +msgstr "" + +#: readelf.c:6053 +#, c-format +msgid " Extended opcode %d: " +msgstr "" + +#: readelf.c:6058 +msgid "" +"End of Sequence\n" +"\n" +msgstr "" +"ÐòÁнáÊø\n" +"\n" + +#: readelf.c:6064 +#, c-format +msgid "set Address to 0x%lx\n" +msgstr "" + +#: readelf.c:6069 +msgid " define new File Table entry\n" +msgstr " ¶¨ÒåÐÂÎļþ±íÌõÄ¿\n" + +#: readelf.c:6070 readelf.c:6199 +msgid " Entry\tDir\tTime\tSize\tName\n" +msgstr " ÌõÄ¿\tĿ¼\tʱ¼ä\t´óС\tÃû³Æ\n" + +#: readelf.c:6072 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:6075 readelf.c:6077 readelf.c:6079 readelf.c:6211 readelf.c:6213 +#: readelf.c:6215 +#, c-format +msgid "%lu\t" +msgstr "%lu\t" + +#: readelf.c:6080 +#, c-format +msgid "" +"%s\n" +"\n" +msgstr "" +"%s\n" +"\n" + +#: readelf.c:6084 +#, c-format +msgid "UNKNOWN: length %d\n" +msgstr "δ֪£º³¤¶È %d\n" + +#: readelf.c:6110 +#, c-format +msgid "" +"\n" +"Dump of debug contents of section %s:\n" +"\n" +msgstr "" +"\n" +"Êä³ö %s ½ÚµÄµ÷ÊÔÄÚÈÝ£º\n" +"\n" + +#: readelf.c:6122 +msgid "64-bit DWARF line info is not supported yet.\n" +msgstr "Éв»Ö§³Ö 64-λ DWARF ÐÐÐÅÏ¢¡£\n" + +#: readelf.c:6129 +msgid "The line info appears to be corrupt - the section is too small\n" +msgstr "ÐÐÐÅÏ¢ËÆºõÒÑË𻵠- ½Ú¹ýС\n" + +#: readelf.c:6137 +msgid "Only DWARF version 2 line info is currently supported.\n" +msgstr "Ŀǰֻ֧³ÖµÚ¶þ°æ DWARF ÐÐÐÅÏ¢¡£\n" + +#: readelf.c:6152 +#, c-format +msgid " Length: %ld\n" +msgstr " ³¤¶È£º %ld\n" + +#: readelf.c:6153 +#, c-format +msgid " DWARF Version: %d\n" +msgstr " DWARF °æ±¾£º %d\n" + +#: readelf.c:6154 +#, c-format +msgid " Prologue Length: %d\n" +msgstr "" + +#: readelf.c:6155 +#, c-format +msgid " Minimum Instruction Length: %d\n" +msgstr " ×îСָÁ¶È£º %d\n" + +#: readelf.c:6156 +#, c-format +msgid " Initial value of 'is_stmt': %d\n" +msgstr " ¡°is_stmt¡±µÄ³õʼֵ£º %d\n" + +#: readelf.c:6157 +#, c-format +msgid " Line Base: %d\n" +msgstr "" + +#: readelf.c:6158 +#, c-format +msgid " Line Range: %d\n" +msgstr "" + +#: readelf.c:6159 +#, c-format +msgid " Opcode Base: %d\n" +msgstr "" + +#: readelf.c:6168 +msgid "" +"\n" +" Opcodes:\n" +msgstr "" + +#: readelf.c:6171 +#, c-format +msgid " Opcode %d has %d args\n" +msgstr "" + +#: readelf.c:6177 +msgid "" +"\n" +" The Directory Table is empty.\n" +msgstr "" +"\n" +" Ŀ¼±íΪ¿Õ¡£\n" + +#: readelf.c:6180 +msgid "" +"\n" +" The Directory Table:\n" +msgstr "" +"\n" +" Ŀ¼±í£º\n" + +#: readelf.c:6184 +#, c-format +msgid " %s\n" +msgstr " %s\n" + +#: readelf.c:6195 +msgid "" +"\n" +" The File Name Table is empty.\n" +msgstr "" +"\n" +" ÎļþÃû±íΪ¿Õ¡£\n" + +#: readelf.c:6198 +msgid "" +"\n" +" The File Name Table:\n" +msgstr "" +"\n" +" ÎļþÃû±í£º\n" + +#: readelf.c:6206 +#, c-format +msgid " %d\t" +msgstr " %d\t" + +#: readelf.c:6217 +#, c-format +msgid "%s\n" +msgstr "%s\n" + +#. Now display the statements. +#: readelf.c:6225 +msgid "" +"\n" +" Line Number Statements:\n" +msgstr "" +"\n" +" ÐкÅÓï¾ä£º\n" + +#: readelf.c:6241 +#, c-format +msgid " Special opcode %d: advance Address by %d to 0x%lx" +msgstr "" + +#: readelf.c:6245 +#, c-format +msgid " and Line by %d to %d\n" +msgstr "" + +#: readelf.c:6256 +msgid " Copy\n" +msgstr " ¸´ÖÆ\n" + +#: readelf.c:6263 +#, c-format +msgid " Advance PC by %d to %lx\n" +msgstr "" + +#: readelf.c:6271 +#, c-format +msgid " Advance Line by %d to %d\n" +msgstr "" + +#: readelf.c:6278 +#, c-format +msgid " Set File Name to entry %d in the File Name Table\n" +msgstr "" + +#: readelf.c:6286 +#, c-format +msgid " Set column to %d\n" +msgstr " ½«ÁÐÉ趨Ϊ %d\n" + +#: readelf.c:6293 +#, c-format +msgid " Set is_stmt to %d\n" +msgstr " ½« is_stmt É趨Ϊ %d\n" + +#: readelf.c:6298 +msgid " Set basic block\n" +msgstr " É趨»ù±¾¿é\n" + +#: readelf.c:6306 +#, c-format +msgid " Advance PC by constant %d to 0x%lx\n" +msgstr "" + +#: readelf.c:6314 +#, c-format +msgid " Advance PC by fixed size amount %d to 0x%lx\n" +msgstr "" + +#: readelf.c:6319 +msgid " Set prologue_end to true\n" +msgstr "" + +#: readelf.c:6323 +msgid " Set epilogue_begin to true\n" +msgstr "" + +#: readelf.c:6329 +#, c-format +msgid " Set ISA to %d\n" +msgstr "" + +#: readelf.c:6333 +#, c-format +msgid " Unknown opcode %d with operands: " +msgstr "" + +#: readelf.c:6365 readelf.c:6827 readelf.c:6899 +#, c-format +msgid "" +"Contents of the %s section:\n" +"\n" +msgstr "" + +#: readelf.c:6384 +msgid "64-bit DWARF pubnames are not supported yet.\n" +msgstr "" + +#: readelf.c:6394 +msgid "Only DWARF 2 pubnames are currently supported\n" +msgstr "" + +#: readelf.c:6401 +#, c-format +msgid " Length: %ld\n" +msgstr " ³¤¶È£º %ld\n" + +#: readelf.c:6403 +#, c-format +msgid " Version: %d\n" +msgstr " °æ±¾£º %d\n" + +#: readelf.c:6405 +#, c-format +msgid " Offset into .debug_info section: %ld\n" +msgstr " ÔÚ .debug_info ½ÚÖÐµÄÆ«ÒÆÁ¿£º %ld\n" + +#: readelf.c:6407 +#, c-format +msgid " Size of area in .debug_info section: %ld\n" +msgstr " ÔÚ .debug_info ½ÚÖÐÇøÓòµÄ´óС£º %ld\n" + +#: readelf.c:6410 +msgid "" +"\n" +" Offset\tName\n" +msgstr "" +"\n" +" Æ«ÒÆÁ¿\tÃû³Æ\n" + +#: readelf.c:6501 +#, c-format +msgid "Unknown TAG value: %lx" +msgstr "δ֪µÄ TAG Öµ£º%lx" + +#: readelf.c:6612 +#, c-format +msgid "Unknown AT value: %lx" +msgstr "δ֪µÄ AT Öµ£º%lx" + +#: readelf.c:6649 +#, c-format +msgid "Unknown FORM value: %lx" +msgstr "δ֪µÄ FORM Öµ£º%lx" + +#: readelf.c:6848 +#, c-format +msgid " DW_MACINFO_start_file - lineno: %d filenum: %d\n" +msgstr " DW_MACINFO_start_file - Ðкţº%d Îļþ±àºÅ£º%d\n" + +#: readelf.c:6853 +msgid " DW_MACINFO_end_file\n" +msgstr " DW_MACINFO_end_file\n" + +#: readelf.c:6861 +#, c-format +msgid " DW_MACINFO_define - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_define - Ðкţº%d ºê£º%s\n" + +#: readelf.c:6869 +#, c-format +msgid " DW_MACINFO_undef - lineno : %d macro : %s\n" +msgstr " DW_MACINFO_undef - Ðкţº%d ºê£º%s\n" + +#: readelf.c:6880 +#, c-format +msgid " DW_MACINFO_vendor_ext - constant : %d string : %s\n" +msgstr " DW_MACINFO_vendor_ext - ³£Á¿£º%d ×Ö·û´®£º%s\n" + +#: readelf.c:6908 +msgid " Number TAG\n" +msgstr "" + +#: readelf.c:6914 +#, c-format +msgid " %ld %s [%s]\n" +msgstr "" + +#: readelf.c:6917 +msgid "has children" +msgstr "" + +#: readelf.c:6917 +msgid "no children" +msgstr "" + +#: readelf.c:6921 +#, c-format +msgid " %-18s %s\n" +msgstr " %-18s %s\n" + +#: readelf.c:6942 +#, c-format +msgid " %lu byte block: " +msgstr " %lu ×ֽڵĿ飺" + +#: readelf.c:7265 +msgid "(User defined location op)" +msgstr "" + +#: readelf.c:7267 +msgid "(Unknown location op)" +msgstr "" + +#: readelf.c:7305 +msgid "debug_loc section data" +msgstr "debug_loc ½ÚÊý¾Ý" + +#: readelf.c:7336 +msgid "" +"\n" +"The .debug_loc section is empty.\n" +msgstr "" +"\n" +".debug_loc ½ÚΪ¿Õ¡£\n" + +#: readelf.c:7339 +msgid "" +"Contents of the .debug_loc section:\n" +"\n" +msgstr "" +".debug_loc ½ÚµÄÄÚÈÝ£º\n" +"\n" + +#: readelf.c:7340 +msgid "" +"\n" +" Offset Begin End Expression\n" +msgstr "" + +#: readelf.c:7412 +msgid "debug_str section data" +msgstr "debug_str ½ÚÊý¾Ý" + +#: readelf.c:7431 +msgid "" +msgstr "<ûÓÐ .debug_str ½Ú>" + +#: readelf.c:7434 +msgid "" +msgstr "<Æ«ÒÆÁ¿¹ý´ó>" + +#: readelf.c:7454 +msgid "" +"\n" +"The .debug_str section is empty.\n" +msgstr "" +"\n" +".debug_str ½ÚΪ¿Õ¡£\n" + +#: readelf.c:7458 +msgid "" +"Contents of the .debug_str section:\n" +"\n" +msgstr "" +".debug_str ½ÚµÄÄÚÈÝ£º\n" +"\n" + +#: readelf.c:7629 +#, c-format +msgid " (indirect string, offset: 0x%lx): " +msgstr " (¼ä½Ó×Ö·û´®£¬Æ«ÒÆÁ¿£º0x%lx)£º" + +#: readelf.c:7638 +#, c-format +msgid "Unrecognized form: %d\n" +msgstr "ÎÞ·¨Ê¶±ðµÄÐÎʽ£º%d\n" + +#: readelf.c:7651 +msgid "(not inlined)" +msgstr "(δÄÚÁ¬)" + +#: readelf.c:7652 +msgid "(inlined)" +msgstr "(ÒÑÄÚÁ¬)" + +#: readelf.c:7653 +msgid "(declared as inline but ignored)" +msgstr "(ÉùÃ÷ΪÄÚÁ¬µ«±»ºöÂÔ)" + +#: readelf.c:7654 +msgid "(declared as inline and inlined)" +msgstr "(ÉùÃ÷ΪÄÚÁ¬²¢ÒÑÄÚÁ¬)" + +#: readelf.c:7655 +#, c-format +msgid " (Unknown inline attribute value: %lx)" +msgstr " (δ֪µÄÄÚÁ¬ÊôÐÔÖµ£º%lx)" + +#: readelf.c:7826 readelf.c:8029 +#, c-format +msgid "" +"The section %s contains:\n" +"\n" +msgstr "" +"%s ½Úº¬ÓУº\n" +"\n" + +#: readelf.c:7850 +msgid "64-bit DWARF debug info is not supported yet.\n" +msgstr "Éв»Ö§³Ö 64-λ DWARF µ÷ÊÔÐÅÏ¢¡£\n" + +#: readelf.c:7919 +#, c-format +msgid " Compilation Unit @ %lx:\n" +msgstr " ±àÒëµ¥Ôª @ %lx£º\n" + +#: readelf.c:7920 +#, c-format +msgid " Length: %ld\n" +msgstr " ³¤¶È£º %ld\n" + +#: readelf.c:7921 +#, c-format +msgid " Version: %d\n" +msgstr " °æ±¾£º %d\n" + +#: readelf.c:7922 +#, c-format +msgid " Abbrev Offset: %ld\n" +msgstr " ËõÐ´Æ«ÒÆÁ¿£º %ld\n" + +#: readelf.c:7923 +#, c-format +msgid " Pointer Size: %d\n" +msgstr " Ö¸Õë´óС£º %d\n" + +#: readelf.c:7927 +msgid "Only version 2 DWARF debug information is currently supported.\n" +msgstr "Ö»Ö§³ÖµÚ¶þ°æ DWARF µ÷ÊÔÐÅÏ¢¡£\n" + +#: readelf.c:7948 +msgid "Unable to locate .debug_abbrev section!\n" +msgstr "ÎÞ·¨¶¨Î» .debug_abbrev ½Ú£¡\n" + +#: readelf.c:7954 +msgid "debug_abbrev section data" +msgstr "debug_abbrev ½ÚÊý¾Ý" + +#: readelf.c:7991 +#, c-format +msgid "Unable to locate entry %lu in the abbreviation table\n" +msgstr "ÎÞ·¨ÔÚËõд±íÖж¨Î»ÌõÄ¿ %lu\n" + +#: readelf.c:7996 +#, c-format +msgid " <%d><%lx>: Abbrev Number: %lu (%s)\n" +msgstr " <%d><%lx>£ºËõд±àºÅ£º%lu (%s)\n" + +#: readelf.c:8050 +msgid "64-bit DWARF aranges are not supported yet.\n" +msgstr "" + +#: readelf.c:8056 +msgid "Only DWARF 2 aranges are currently supported.\n" +msgstr "" + +#: readelf.c:8060 +#, c-format +msgid " Length: %ld\n" +msgstr "" + +#: readelf.c:8061 +#, c-format +msgid " Version: %d\n" +msgstr "" + +#: readelf.c:8062 +#, c-format +msgid " Offset into .debug_info: %lx\n" +msgstr "" + +#: readelf.c:8063 +#, c-format +msgid " Pointer Size: %d\n" +msgstr "" + +#: readelf.c:8064 +#, c-format +msgid " Segment Size: %d\n" +msgstr "" + +#: readelf.c:8066 +msgid "" +"\n" +" Address Length\n" +msgstr "" + +#: readelf.c:8248 +#, c-format +msgid "The section %s contains:\n" +msgstr "%s ½Úº¬ÓУº\n" + +#: readelf.c:8271 +msgid "64-bit DWARF format frames are not supported yet.\n" +msgstr "" + +#: readelf.c:8820 +#, c-format +msgid "Displaying the debug contents of section %s is not yet supported.\n" +msgstr "Éв»Ö§³ÖÏÔʾ %s ½ÚµÄµ÷ÊÔÄÚÈÝ¡£\n" + +#: readelf.c:8886 +#, c-format +msgid "" +"\n" +"Section '%s' has no debugging data.\n" +msgstr "" + +#: readelf.c:8891 readelf.c:8953 +msgid "debug section data" +msgstr "µ÷ÊÔ½ÚÊý¾Ý" + +#: readelf.c:8907 +#, c-format +msgid "Unrecognized debug section: %s\n" +msgstr "ÎÞ·¨Ê¶±ðµÄµ÷ÊÔ½Ú£º%s\n" + +#: readelf.c:8981 +msgid "Some sections were not dumped because they do not exist!\n" +msgstr "ûÓÐÊä³öijЩ½ÚÊÇÒòΪËüÃDz¢²»´æÔÚ£¡\n" + +#: readelf.c:9054 readelf.c:9418 +msgid "liblist" +msgstr "" + +#: readelf.c:9139 +msgid "options" +msgstr "Ñ¡Ïî" + +#: readelf.c:9170 +#, c-format +msgid "" +"\n" +"Section '%s' contains %d entries:\n" +msgstr "" +"\n" +"¡°%s¡±½Úº¬ÓÐ %d ¸öÌõÄ¿£º\n" + +#: readelf.c:9331 +msgid "conflict list found without a dynamic symbol table" +msgstr "" + +#: readelf.c:9349 readelf.c:9365 +msgid "conflict" +msgstr "³åÍ»" + +#: readelf.c:9375 +#, c-format +msgid "" +"\n" +"Section '.conflict' contains %ld entries:\n" +msgstr "" + +#: readelf.c:9377 +msgid " Num: Index Value Name" +msgstr "" + +#: readelf.c:9426 +msgid "liblist string table" +msgstr "" + +#: readelf.c:9435 +#, c-format +msgid "" +"\n" +"Library list section '%s' contains %lu entries:\n" +msgstr "" + +#: readelf.c:9484 +msgid "NT_PRSTATUS (prstatus structure)" +msgstr "NT_PRSTATUS (prstatus ½á¹¹)" + +#: readelf.c:9485 +msgid "NT_FPREGSET (floating point registers)" +msgstr "NT_FPREGSET (¸¡µã¼Ä´æÆ÷)" + +#: readelf.c:9486 +msgid "NT_PRPSINFO (prpsinfo structure)" +msgstr "NT_PRPSINFO (prpsinfo ½á¹¹)" + +#: readelf.c:9487 +msgid "NT_TASKSTRUCT (task structure)" +msgstr "NT_TASKSTRUCT (ÈÎÎñ½á¹¹)" + +#: readelf.c:9488 +msgid "NT_PRXFPREG (user_xfpregs structure)" +msgstr "NT_PRXFPREG (user_xfpregs ½á¹¹)" + +#: readelf.c:9489 +msgid "NT_PSTATUS (pstatus structure)" +msgstr "NT_PSTATUS (pstatus ½á¹¹)" + +#: readelf.c:9490 +msgid "NT_FPREGS (floating point registers)" +msgstr "NT_FPREGS (¸¡µãÊý¼Ä´æÆ÷)" + +#: readelf.c:9491 +msgid "NT_PSINFO (psinfo structure)" +msgstr "NT_PSINFO (psinfo ½á¹¹)" + +#: readelf.c:9492 +msgid "NT_LWPSTATUS (lwpstatus_t structure)" +msgstr "NT_LWPSTATUS (lwpstatus_t ½á¹¹)" + +#: readelf.c:9493 +msgid "NT_LWPSINFO (lwpsinfo_t structure)" +msgstr "NT_LWPSINFO (lwpsinfo_t ½á¹¹)" + +#: readelf.c:9494 +msgid "NT_WIN32PSTATUS (win32_pstatus structure)" +msgstr "NT_WIN32PSTATUS (win32_pstatus ½á¹¹)" + +#: readelf.c:9496 readelf.c:9520 +#, c-format +msgid "Unknown note type: (0x%08x)" +msgstr "δ֪µÄ×¢ÊÍÀàÐÍ£º(0x%08x)" + +#. NetBSD core "procinfo" structure. +#: readelf.c:9510 +msgid "NetBSD procinfo structure" +msgstr "NetBSD procinfo ½á¹¹" + +#: readelf.c:9537 readelf.c:9551 +msgid "PT_GETREGS (reg structure)" +msgstr "PT_GETREGS (reg ½á¹¹)" + +#: readelf.c:9539 readelf.c:9553 +msgid "PT_GETFPREGS (fpreg structure)" +msgstr "PT_GETFPREGS (fpreg ½á¹¹)" + +#: readelf.c:9559 +#, c-format +msgid "PT_FIRSTMACH+%d" +msgstr "" + +#: readelf.c:9613 +msgid "notes" +msgstr "×¢ÊÍ" + +#: readelf.c:9619 +#, c-format +msgid "" +"\n" +"Notes at offset 0x%08lx with length 0x%08lx:\n" +msgstr "" +"\n" +"×¢ÊÍλÓÚÆ«ÒÆÁ¿ 0x%08lx ³¤¶ÈΪ 0x%08lx£º\n" + +#: readelf.c:9621 +msgid " Owner\t\tData size\tDescription\n" +msgstr " ËùÓÐÕß\t\tÊý¾Ý´óС\tÃèÊö\n" + +#: readelf.c:9640 +#, c-format +msgid "corrupt note found at offset %x into core notes\n" +msgstr "" + +#: readelf.c:9642 +#, c-format +msgid " type: %x, namesize: %08lx, descsize: %08lx\n" +msgstr " ÀàÐÍ£º%x£¬Ãû³Æ´óС£º%08lx£¬ÃèÊö´óС£º%08lx\n" + +#: readelf.c:9744 +msgid "No note segments present in the core file.\n" +msgstr "core ÎļþÖÐûÓÐ×¢ÊͶΡ£\n" + +#: readelf.c:9822 +msgid "" +"This instance of readelf has been built without support for a\n" +"64 bit data type and so it cannot read 64 bit ELF files.\n" +msgstr "" +"±¾ readelf ʵÀý±àÒëʱδ¼ÓÈë 64 λÊý¾ÝÀàÐÍÖ§³Ö£¬\n" +"Òò¶øÎÞ·¨¶ÁÈë 64 λ ELF Îļþ¡£\n" + +#: readelf.c:9868 +#, c-format +msgid "Cannot stat input file %s.\n" +msgstr "ÎÞ·¨¶ÔÊäÈëÎļþ %s Ö´ÐÐ stat ²Ù×÷¡£\n" + +#: readelf.c:9875 +#, c-format +msgid "Input file %s not found.\n" +msgstr "ÕÒ²»µ½ÊäÈëÎļþ %s¡£\n" + +#: readelf.c:9881 +#, c-format +msgid "%s: Failed to read file header\n" +msgstr "%s£º¶ÁÈëÎļþͷʧ°Ü\n" + +#: readelf.c:9895 +#, c-format +msgid "" +"\n" +"File: %s\n" +msgstr "" +"\n" +"Îļþ£º%s\n" + +#: rename.c:131 +#, c-format +msgid "%s: cannot set time: %s" +msgstr "%s£ºÎÞ·¨ÉèÖÃʱ¼ä£º%s" + +#. We have to clean up here. +#: rename.c:170 rename.c:203 +#, c-format +msgid "%s: rename: %s" +msgstr "%s£ºÖØÃüÃû£º%s" + +#: rename.c:211 +#, c-format +msgid "%s: simple_copy: %s" +msgstr "" + +#: resbin.c:134 +#, c-format +msgid "%s: not enough binary data" +msgstr "" + +#: resbin.c:153 +msgid "null terminated unicode string" +msgstr "ÒÔ null ÖÕÖ¹µÄ unicode ×Ö·û´®" + +#: resbin.c:183 resbin.c:189 +msgid "resource ID" +msgstr "×ÊÔ´ ID" + +#: resbin.c:233 +msgid "cursor" +msgstr "¹â±ê" + +#: resbin.c:267 resbin.c:274 +msgid "menu header" +msgstr "²Ëµ¥Í·" + +#: resbin.c:284 +msgid "menuex header" +msgstr "À©Õ¹²Ëµ¥Í·" + +#: resbin.c:288 +msgid "menuex offset" +msgstr "À©Õ¹²Ëµ¥Æ«ÒÆÁ¿" + +#: resbin.c:295 +#, c-format +msgid "unsupported menu version %d" +msgstr "²»Ö§³ÖµÄ²Ëµ¥°æ±¾ %d" + +#: resbin.c:323 resbin.c:338 resbin.c:404 +msgid "menuitem header" +msgstr "²Ëµ¥ÏîÍ·" + +#: resbin.c:434 +msgid "menuitem" +msgstr "²Ëµ¥Ïî" + +#: resbin.c:475 resbin.c:503 +msgid "dialog header" +msgstr "¶Ô»°¿òÍ·" + +#: resbin.c:493 +#, c-format +msgid "unexpected DIALOGEX version %d" +msgstr "ÒâÍâµÄÀ©Õ¹¶Ô»°¿ò°æ±¾ %d" + +#: resbin.c:538 +msgid "dialog font point size" +msgstr "" + +#: resbin.c:546 +msgid "dialogex font information" +msgstr "" + +#: resbin.c:572 resbin.c:590 +msgid "dialog control" +msgstr "¶Ô»°¿ò¿ØÖÆ" + +#: resbin.c:582 +msgid "dialogex control" +msgstr "¶Ô»°¿òÀ©Õ¹¿ØÖÆ" + +#: resbin.c:611 +msgid "dialog control end" +msgstr "¶Ô»°¿ò¿ØÖƽáÊø" + +#: resbin.c:623 +msgid "dialog control data" +msgstr "¶Ô»°¿ò¿ØÖÆÊý¾Ý" + +#: resbin.c:666 +msgid "stringtable string length" +msgstr "×Ö·û´®±í×Ö·û´®³¤¶È" + +#: resbin.c:676 +msgid "stringtable string" +msgstr "×Ö·û´®±í×Ö·û´®" + +#: resbin.c:709 +msgid "fontdir header" +msgstr "×ÖÌåĿ¼ͷ" + +#: resbin.c:722 +msgid "fontdir" +msgstr "×ÖÌåĿ¼" + +#: resbin.c:738 +msgid "fontdir device name" +msgstr "×ÖÌåĿ¼É豸Ãû" + +#: resbin.c:744 +msgid "fontdir face name" +msgstr "" + +#: resbin.c:787 +msgid "accelerator" +msgstr "¼ÓËÙ¼ü" + +#: resbin.c:851 +msgid "group cursor header" +msgstr "×é¹â±êÍ·" + +#: resbin.c:855 +#, c-format +msgid "unexpected group cursor type %d" +msgstr "ÒâÍâµÄ×é¹â±êÀàÐÍ %d" + +#: resbin.c:870 +msgid "group cursor" +msgstr "×é¹â±ê" + +#: resbin.c:909 +msgid "group icon header" +msgstr "×éͼ±êÍ·" + +#: resbin.c:913 +#, c-format +msgid "unexpected group icon type %d" +msgstr "ÒâÍâµÄ×éͼ±êÀàÐÍ %d" + +#: resbin.c:928 +msgid "group icon" +msgstr "×éͼ±ê" + +#: resbin.c:999 resbin.c:1218 +msgid "unexpected version string" +msgstr "ÒâÍâµÄ°æ±¾×Ö·û´®" + +#: resbin.c:1033 +#, c-format +msgid "version length %d does not match resource length %lu" +msgstr "°æ±¾³¤¶È %d ²»Æ¥Åä×ÊÔ´³¤¶È %lu" + +#: resbin.c:1037 +#, c-format +msgid "unexpected version type %d" +msgstr "ÒâÍâµÄ°æ±¾ÀàÐÍ %d" + +#: resbin.c:1049 +#, c-format +msgid "unexpected fixed version information length %d" +msgstr "" + +#: resbin.c:1052 +msgid "fixed version info" +msgstr "" + +#: resbin.c:1056 +#, c-format +msgid "unexpected fixed version signature %lu" +msgstr "ÒâÍâµÄ¹Ì¶¨°æ±¾Ç©Ãû %lu" + +#: resbin.c:1060 +#, c-format +msgid "unexpected fixed version info version %lu" +msgstr "ÒâÍâµÄ¹Ì¶¨°æ±¾ÐÅÏ¢°æ±¾ %lu" + +#: resbin.c:1089 +msgid "version var info" +msgstr "" + +#: resbin.c:1106 +#, c-format +msgid "unexpected stringfileinfo value length %d" +msgstr "" + +#: resbin.c:1116 +#, c-format +msgid "unexpected version stringtable value length %d" +msgstr "" + +#: resbin.c:1150 +#, c-format +msgid "unexpected version string length %d != %d + %d" +msgstr "ÒâÍâµÄ°æ±¾×Ö·û´®³¤¶È %d != %d + %d" + +#: resbin.c:1161 +#, c-format +msgid "unexpected version string length %d < %d" +msgstr "ÒâÍâµÄ°æ±¾×Ö·û´®³¤¶È %d < %d" + +#: resbin.c:1178 +#, c-format +msgid "unexpected varfileinfo value length %d" +msgstr "" + +#: resbin.c:1197 +msgid "version varfileinfo" +msgstr "" + +#: resbin.c:1212 +#, c-format +msgid "unexpected version value length %d" +msgstr "ÒâÍâµÄ°æ±¾Öµ³¤¶È %d" + +#: rescoff.c:128 +msgid "filename required for COFF input" +msgstr "COFF ÊäÈëÐèÒªÎļþÃû" + +#: rescoff.c:145 +#, c-format +msgid "%s: no resource section" +msgstr "%s£ºÃ»ÓÐ×ÊÔ´½Ú" + +#: rescoff.c:152 +msgid "can't read resource section" +msgstr "ÎÞ·¨¶ÁÈë×ÊÔ´½Ú" + +#: rescoff.c:178 +#, c-format +msgid "%s: %s: address out of bounds" +msgstr "%s£º%s£ºµØÖ·³¬³ö½çÏÞ" + +#: rescoff.c:197 +msgid "directory" +msgstr "Ŀ¼" + +#: rescoff.c:225 +msgid "named directory entry" +msgstr "ÒÑÃüÃûµÄĿ¼ÌõÄ¿" + +#: rescoff.c:234 +msgid "directory entry name" +msgstr "Ŀ¼ÌõÄ¿Ãû" + +#: rescoff.c:254 +msgid "named subdirectory" +msgstr "ÒÑÃüÃûµÄ×ÓĿ¼" + +#: rescoff.c:262 +msgid "named resource" +msgstr "ÒÑÃüÃûµÄ×ÊÔ´" + +#: rescoff.c:277 +msgid "ID directory entry" +msgstr "" + +#: rescoff.c:294 +msgid "ID subdirectory" +msgstr "" + +#: rescoff.c:302 +msgid "ID resource" +msgstr "" + +#: rescoff.c:328 +msgid "resource type unknown" +msgstr "×ÊÔ´ÀàÐÍδ֪" + +#: rescoff.c:331 +msgid "data entry" +msgstr "Êý¾ÝÌõÄ¿" + +#: rescoff.c:339 +msgid "resource data" +msgstr "×ÊÔ´Êý¾Ý" + +#: rescoff.c:344 +msgid "resource data size" +msgstr "×ÊÔ´Êý¾Ý´óС" + +#: rescoff.c:439 +msgid "filename required for COFF output" +msgstr "COFF Êä³öÐèÒªÎļþÃû" + +#: rescoff.c:738 +msgid "can't get BFD_RELOC_RVA relocation type" +msgstr "ÎÞ·¨µÃµ½ BFD_RELOC_RVA ÖØ¶¨ÏòÀàÐÍ" + +#: resrc.c:240 resrc.c:312 +#, c-format +msgid "can't open temporary file `%s': %s" +msgstr "ÎÞ·¨´ò¿ªÁÙʱÎļþ¡°%s¡±£º%s" + +#: resrc.c:246 +#, c-format +msgid "can't redirect stdout: `%s': %s" +msgstr "ÎÞ·¨Öض¨Ïò±ê×¼Êä³ö£º¡°%s¡±£º%s" + +#: resrc.c:262 +#, c-format +msgid "%s %s: %s" +msgstr "%s %s£º%s" + +#: resrc.c:308 +#, c-format +msgid "can't execute `%s': %s" +msgstr "ÎÞ·¨Ö´ÐС°%s¡±£º%s" + +#: resrc.c:317 +#, c-format +msgid "Using temporary file `%s' to read preprocessor output\n" +msgstr "ʹÓÃÁÙʱÎļþ¡°%s¡±ÒÔ¶ÁÈëÔ¤´¦ÀíÆ÷Êä³ö\n" + +#: resrc.c:324 +#, c-format +msgid "can't popen `%s': %s" +msgstr "ÎÞ·¨ popen ¡°%s¡±£º%s" + +#: resrc.c:326 +msgid "Using popen to read preprocessor output\n" +msgstr "ʹÓà popen ¶ÁÈëÔ¤´¦ÀíÆ÷Êä³ö\n" + +#: resrc.c:369 +#, c-format +msgid "Tried `%s'\n" +msgstr "" + +#: resrc.c:380 +#, c-format +msgid "Using `%s'\n" +msgstr "ʹÓá°%s¡±\n" + +#: resrc.c:542 +#, c-format +msgid "%s:%d: %s\n" +msgstr "%s£º%d£º%s\n" + +#: resrc.c:551 +#, c-format +msgid "%s: unexpected EOF" +msgstr "%s£ºÎļþÒâÍâ½áÊø" + +#: resrc.c:608 +#, c-format +msgid "%s: read of %lu returned %lu" +msgstr "%s£º¶ÁÈ¡ %lu ·µ»Ø %lu" + +#: resrc.c:650 resrc.c:904 resrc.c:1177 resrc.c:1331 +#, c-format +msgid "stat failed on bitmap file `%s': %s" +msgstr "¶ÔλͼÎļþ¡°%s¡±½øÐÐ stat ²Ù×÷ʧ°Ü£º%s" + +#: resrc.c:703 +#, c-format +msgid "cursor file `%s' does not contain cursor data" +msgstr "¹â±êÎļþ¡°%s¡±²»º¬Óйâ±êÊý¾Ý" + +#: resrc.c:735 resrc.c:1048 +#, c-format +msgid "%s: fseek to %lu failed: %s" +msgstr "" + +#: resrc.c:872 +msgid "help ID requires DIALOGEX" +msgstr "" + +#: resrc.c:874 +msgid "control data requires DIALOGEX" +msgstr "" + +#: resrc.c:1017 +#, c-format +msgid "icon file `%s' does not contain icon data" +msgstr "ͼ±êÎļþ¡°%s¡±²»º¬ÓÐͼ±êÊý¾Ý" + +#: resrc.c:1536 +#, c-format +msgid "can't open `%s' for output: %s" +msgstr "ÎÞ·¨ÎªÊä³ö´ò¿ª¡°%s¡±£º%s" + +#: size.c:86 +msgid " Displays the sizes of sections inside binary files\n" +msgstr " ÏÔʾ¶þ½øÖÆÎļþÖнڵĴóС\n" + +#: size.c:87 +msgid " If no input file(s) are specified, a.out is assumed\n" +msgstr " ûÓиø³öÊäÈëÎļþ£¬Ä¬ÈÏΪ a.out\n" + +#: size.c:88 +#, c-format +msgid "" +" The options are:\n" +" -A|-B --format={sysv|berkeley} Select output style (default is %s)\n" +" -o|-d|-h --radix={8|10|16} Display numbers in octal, decimal or hex\n" +" -t --totals Display the total sizes (Berkeley only)\n" +" --target= Set the binary file format\n" +" -h --help Display this information\n" +" -v --version Display the program's version\n" +"\n" +msgstr "" +" Ñ¡ÏîΪ£º\n" +" -A|-B --format={sysv|berkeley} Ñ¡ÔñÊä³ö·ç¸ñ (ĬÈÏΪ %s)\n" +" -o|-d|-h --radix={8|10|16} Ò԰˽øÖÆ¡¢Ê®½øÖÆ»òÊ®Áù½øÖÆÏÔʾÊýÖµ\n" +" -t --totals ÏÔʾ×Ü´óС (Ö»ÓÃÓÚ Berkeley ·ç¸ñ)\n" +" --target= É趨¶þ½øÖÆÎļþ¸ñʽ\n" +" -h --help ÏÔʾ±¾ÐÅÏ¢\n" +" -v --version ÏÔʾ³ÌÐòµÄ°æ±¾ºÅ\n" +"\n" + +#: size.c:160 +#, c-format +msgid "invalid argument to --format: %s" +msgstr "--format µÄÎÞЧ²ÎÊý£º%s" + +#: size.c:187 +#, c-format +msgid "Invalid radix: %s\n" +msgstr "" + +#: srconv.c:1953 +msgid "Convert a COFF object file into a SYSROFF object file\n" +msgstr "½« COFF Ä¿±êÎļþת»»Îª SYSROFF Ä¿±êÎļþ\n" + +#: srconv.c:1954 +msgid "" +" The options are:\n" +" -q --quick (Obsolete - ignoerd)\n" +" -n --noprescan Do not perform a scan to convert commons into defs\n" +" -d --debug Display information about what is being done\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +" Ñ¡ÏîΪ£º\n" +" -q --quick (¹ýÆÚ - ºöÂÔ)\n" +" -n --noprescan ²»Ö´ÐÐɨÃèÒÔ½« commons ת»»Îª defs\n" +" -d --debug ÏÔʾ¹ØÓÚÒÑÍê³ÉÊÂÎñµÄÐÅÏ¢\n" +" -h --help ÏÔʾ±¾ÐÅÏ¢\n" +" -v --version ´òÓ¡³ÌÐòµÄ°æ±¾ºÅ\n" + +#: srconv.c:2099 +#, c-format +msgid "unable to open output file %s" +msgstr "ÎÞ·¨´ò¿ªÊä³öÎļþ %s" + +#: stabs.c:343 stabs.c:1759 +msgid "numeric overflow" +msgstr "ÊýÖµÒç³ö" + +#: stabs.c:354 +#, c-format +msgid "Bad stab: %s\n" +msgstr "" + +#: stabs.c:364 +#, c-format +msgid "Warning: %s: %s\n" +msgstr "¾¯¸æ£º%s£º%s\n" + +#: stabs.c:485 +msgid "N_LBRAC not within function\n" +msgstr "N_LBRAC ²»ÔÚº¯ÊýÖÐ\n" + +#: stabs.c:524 +msgid "Too many N_RBRACs\n" +msgstr "¹ý¶àµÄ N_RBRAC\n" + +#: stabs.c:769 +msgid "unknown C++ encoded name" +msgstr "δ֪µÄ C++ ±àÂëÃû³Æ" + +#. Complain and keep going, so compilers can invent new +#. cross-reference types. +#: stabs.c:1296 +msgid "unrecognized cross reference type" +msgstr "ÎÞ·¨Ê¶±ðµÄ½»²æÒýÓÃÀàÐÍ" + +#. Does this actually ever happen? Is that why we are worrying +#. about dealing with it rather than just calling error_type? +#: stabs.c:1851 +msgid "missing index type" +msgstr "ÒÅ©µÄË÷ÒýÀàÐÍ" + +#: stabs.c:2178 +msgid "unknown virtual character for baseclass" +msgstr "" + +#: stabs.c:2196 +msgid "unknown visibility character for baseclass" +msgstr "" + +#: stabs.c:2388 +msgid "unnamed $vb type" +msgstr "" + +#: stabs.c:2394 +msgid "unrecognized C++ abbreviation" +msgstr "ÎÞ·¨Ê¶±ðµÄ C++ Ëõд" + +#: stabs.c:2474 +msgid "unknown visibility character for field" +msgstr "" + +#: stabs.c:2730 +msgid "const/volatile indicator missing" +msgstr "ÒÅ© const/volatile ָʾ·û" + +#: stabs.c:2970 +#, c-format +msgid "No mangling for \"%s\"\n" +msgstr "" + +#: stabs.c:3283 +msgid "Undefined N_EXCL" +msgstr "䶨Òå N_EXCL" + +#: stabs.c:3371 +#, c-format +msgid "Type file number %d out of range\n" +msgstr "ÀàÐÍÎļþ±àºÅ %d ³¬³ö·¶Î§\n" + +#: stabs.c:3376 +#, c-format +msgid "Type index number %d out of range\n" +msgstr "ÀàÐÍË÷Òý±àºÅ %d ³¬³ö·¶Î§\n" + +#: stabs.c:3463 +#, c-format +msgid "Unrecognized XCOFF type %d\n" +msgstr "ÎÞ·¨Ê¶±ðµÄ XCOFF ÀàÐÍ %d\n" + +#: stabs.c:3762 +#, c-format +msgid "bad mangled name `%s'\n" +msgstr "" + +#: stabs.c:3858 +msgid "no argument types in mangled string\n" +msgstr "" + +#: strings.c:200 +#, c-format +msgid "invalid number %s" +msgstr "ÎÞЧµÄ±àºÅ %s" + +#: strings.c:640 +#, c-format +msgid "invalid integer argument %s" +msgstr "ÎÞЧµÄÕûÊý²ÎÊý %s" + +#: strings.c:651 +msgid " Display printable strings in [file(s)] (stdin by default)\n" +msgstr " ´òÓ¡ [Îļþ] (ĬÈÏΪ±ê×¼ÊäÈë) ÖпɴòÓ¡µÄ×Ö·û´®\n" + +#: strings.c:652 +msgid "" +" The options are:\n" +" -a - --all Scan the entire file, not just the data section\n" +" -f --print-file-name Print the name of the file before each string\n" +" -n --bytes=[number] Locate & print any NUL-terminated sequence of at\n" +" - least [number] characters (default 4).\n" +" -t --radix={o,x,d} Print the location of the string in base 8, 10 or 16\n" +" -o An alias for --radix=o\n" +" -T --target= Specify the binary file format\n" +" -e --encoding={s,b,l,B,L} Select character size and endianness:\n" +" s = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" + +#: sysdump.c:768 +msgid "Print a human readable interpretation of a SYSROFF object file\n" +msgstr "´òÓ¡ÊÊÓÚÔĶÁµÄ SYSROFF Ä¿±êÎļþµÄ½âÊÍ\n" + +#: sysdump.c:769 +msgid "" +" The options are:\n" +" -h --help Display this information\n" +" -v --version Print the program's version number\n" +msgstr "" +" Ñ¡ÏîΪ£º\n" +" -h --help ÏÔʾ±¾ÐÅÏ¢\n" +" -v --version ´òÓ¡³ÌÐòµÄ°æ±¾ºÅ\n" + +#: sysdump.c:836 +#, c-format +msgid "cannot open input file %s" +msgstr "ÎÞ·¨´ò¿ªÊäÈëÎļþ %s" + +#: version.c:35 +msgid "Copyright 2002 Free Software Foundation, Inc.\n" +msgstr "°æÈ¨ËùÓÐ 2002 ×ÔÓÉÈí¼þ»ù½ð»á¡£\n" + +#: version.c:36 +msgid "" +"This program is free software; you may redistribute it under the terms of\n" +"the GNU General Public License. This program has absolutely no warranty.\n" +msgstr "" +"±¾³ÌÐòÊÇ×ÔÓÉÈí¼þ£»Äú¿ÉÒÔ°´ÕÕ GNU ͨÓù«¹²Ðí¿ÉÖ¤\n" +"µÄÌõ¿î¶ÔÆä½øÐÐÔÙ·¢ÐС£±¾³ÌÐòûÓÐÈκε£±£¡£\n" + +#: windres.c:239 +#, c-format +msgid "can't open %s `%s': %s" +msgstr "ÎÞ·¨´ò¿ª %s¡°%s¡±£º%s" + +#: windres.c:418 +msgid ": expected to be a directory\n" +msgstr "£ºÓ¦ÎªÄ¿Â¼\n" + +#: windres.c:430 +msgid ": expected to be a leaf\n" +msgstr "" + +#: windres.c:439 +#, c-format +msgid "%s: warning: " +msgstr "%s£º¾¯¸æ£º" + +#: windres.c:441 +msgid ": duplicate value\n" +msgstr "" + +#: windres.c:602 +#, c-format +msgid "unknown format type `%s'" +msgstr "δ֪µÄ¸ñʽÀàÐÍ¡°%s¡±" + +#: windres.c:603 +#, c-format +msgid "%s: supported formats:" +msgstr "%s£ºÖ§³ÖµÄ¸ñʽ£º" + +#. Otherwise, we give up. +#: windres.c:688 +#, c-format +msgid "can not determine type of file `%s'; use the -I option" +msgstr "ÎÞ·¨È·¶¨Îļþ¡°%s¡±µÄÀàÐÍ£»ÇëʹÓà -I Ñ¡Ïî" + +#: windres.c:702 +#, c-format +msgid "Usage: %s [option(s)] [input-file] [output-file]\n" +msgstr "Ó÷¨£º%s [Ñ¡Ïî] [ÊäÈëÎļþ] [Êä³öÎļþ]\n" + +#: windres.c:704 +msgid "" +" The options are:\n" +" -i --input= Name input file\n" +" -o --output= Name output file\n" +" -I --input-format= Specify input format\n" +" -O --output-format= Specify output format\n" +" -F --target= Specify COFF target\n" +" --preprocessor= Program to use to preprocess rc file\n" +" --include-dir= Include directory when preprocessing rc file\n" +" -D --define [=] Define SYM when preprocessing rc file\n" +" -v --verbose Verbose - tells you what it's doing\n" +" --language= Set language when reading rc file\n" +" --use-temp-file Use a temporary file instead of popen to read\n" +" the preprocessor output\n" +" --no-use-temp-file Use popen (default)\n" +msgstr "" + +#: windres.c:719 +msgid " --yydebug Turn on parser debugging\n" +msgstr " --yydebug ´ò¿ª½âÎöÆ÷µ÷ÊÔ\n" + +#: windres.c:722 +msgid "" +" -h --help Print this help message\n" +" -V --version Print version information\n" +msgstr "" +" -h --help ´òÓ¡±¾ÇóÖúÐÅÏ¢\n" +" -V --version ´òÓ¡°æ±¾ÐÅÏ¢\n" + +#: windres.c:725 +msgid "" +"FORMAT is one of rc, res, or coff, and is deduced from the file name\n" +"extension if not specified. A single file name is an input file.\n" +"No input-file is stdin, default rc. No output-file is stdout, default rc.\n" +msgstr "" +"FORMAT ÊÇ rc¡¢res »ò coff Ö®Ò»£¬ÔÚδָ¶¨Ê±¸ù¾ÝÎļþµÄÀ©Õ¹Ãû½øÐÐÅжϡ£\n" +"µ¥¸öÎļþÃû±»ÈÏΪÊÇÊäÈëÎļþ¡£Ã»ÓÐÊäÈëÎļþʱ¾ÍʹÓñê×¼ÊäÈ룬ĬÈϸñʽ\n" +"Ϊ rc¡£Ã»ÓÐÊä³öÎļþʱ¾ÍʹÓñê×¼Êä³ö£¬Ä¬ÈϸñʽΪ rc¡£\n" + +#: windres.c:988 +msgid "no resources" +msgstr "ûÓÐ×ÊÔ´" + +#: wrstabs.c:366 wrstabs.c:2026 +#, c-format +msgid "string_hash_lookup failed: %s" +msgstr "string_hash_lookup ʧ°Ü£º%s" + +#: wrstabs.c:666 +#, c-format +msgid "stab_int_type: bad size %u" +msgstr "stab_int_type£º´íÎó´óС %u" + +#: wrstabs.c:1466 +#, c-format +msgid "%s: warning: unknown size for field `%s' in struct" +msgstr "%s£º¾¯¸æ£º½á¹¹µÄ¡°%s¡±ÓòµÄ´óСδ֪" diff --git a/binutils/ranlib.1 b/binutils/ranlib.1 deleted file mode 100644 index 9e973c699d9b3..0000000000000 --- a/binutils/ranlib.1 +++ /dev/null @@ -1,441 +0,0 @@ -.\" Copyright (c) 1991, 2000 Free Software Foundation -.\" See section COPYING for conditions for redistribution -.TH ranlib 1 "5 November 1991" "Free Software Foundation" "GNU Development Tools" -.de BP -.sp -.ti \-.2i -\(** -.. - -.SH NAME -ranlib \- generate index to archive. - -.SH SYNOPSIS -.hy 0 -.na -.B ranlib \c -.RB "[\|" \-v | \-V "\|]" -.I archive\c -\& -.ad b -.hy 1 -.SH DESCRIPTION -.B ranlib -generates an index to the contents of an archive, and -stores it in the archive. The index lists each symbol defined by a -member of an archive that is a relocatable object file. -.PP -You may use -.RB ` "nm \-s" ' -or -.RB ` "nm \-\-print-armap" ' -to list this index. -.PP -An archive with such an index speeds up linking to the library, and -allows routines in the library to call each other without regard to -their placement in the archive. -.PP -The GNU -.B ranlib -program is another form of GNU -.BR ar ; -running -.B ranlib -is completely equivalent to executing -.RB ` "ar \-s" '. - -.SH OPTIONS -.TP -.B \-v -Print the version number of -.B ranlib -and exit. - -.SH "SEE ALSO" -.RB "`\|" binutils "\|'" -entry in -.B -info\c -\&; -.I -The GNU Binary Utilities\c -\&, Roland H. Pesch (October 1991); -.BR ar "(" 1 ")," -.BR nm "(" 1 ")." - - -.SH COPYING -Copyright (c) 1991, 2000 Free Software Foundation, Inc. -.PP -This document is distributed under the terms of the GNU Free -Documentation License, version 1.1. That license is described in the -sources for this manual page, but it is not displayed here in order to -make this manual more consise. Copies of this license can also be -obtained from: http://www.gnu.org/copyleft/. - -\" .SH GNU Free Documentation License -\" Version 1.1, March 2000 - -\" Copyright (C) 2000 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. -\" .PP -\" 0. PREAMBLE -\" .PP -\" The purpose of this License is to make a manual, textbook, or other -\" written document "free" in the sense of freedom: to assure everyone -\" the effective freedom to copy and redistribute it, with or without -\" modifying it, either commercially or noncommercially. Secondarily, -\" this License preserves for the author and publisher a way to get -\" credit for their work, while not being considered responsible for -\" modifications made by others. -\" .PP -\" This License is a kind of "copyleft", which means that derivative -\" works of the document must themselves be free in the same sense. It -\" complements the GNU General Public License, which is a copyleft -\" license designed for free software. -\" .PP -\" We have designed this License in order to use it for manuals for free -\" software, because free software needs free documentation: a free -\" program should come with manuals providing the same freedoms that the -\" software does. But this License is not limited to software manuals; -\" it can be used for any textual work, regardless of subject matter or -\" whether it is published as a printed book. We recommend this License -\" principally for works whose purpose is instruction or reference. -\" .PP -\" 1. APPLICABILITY AND DEFINITIONS -\" .PP -\" This License applies to any manual or other work that contains a -\" notice placed by the copyright holder saying it can be distributed -\" under the terms of this License. The "Document", below, refers to any -\" such manual or work. Any member of the public is a licensee, and is -\" addressed as "you". -\" .PP -\" A "Modified Version" of the Document means any work containing the -\" Document or a portion of it, either copied verbatim, or with -\" modifications and/or translated into another language. -\" .PP -\" A "Secondary Section" is a named appendix or a front-matter section of -\" the Document that deals exclusively with the relationship of the -\" publishers or authors of the Document to the Document's overall subject -\" (or to related matters) and contains nothing that could fall directly -\" within that overall subject. (For example, if the Document is in part a -\" textbook of mathematics, a Secondary Section may not explain any -\" mathematics.) The relationship could be a matter of historical -\" connection with the subject or with related matters, or of legal, -\" commercial, philosophical, ethical or political position regarding -\" them. -\" .PP -\" The "Invariant Sections" are certain Secondary Sections whose titles -\" are designated, as being those of Invariant Sections, in the notice -\" that says that the Document is released under this License. -\" .PP -\" The "Cover Texts" are certain short passages of text that are listed, -\" as Front-Cover Texts or Back-Cover Texts, in the notice that says that -\" the Document is released under this License. -\" .PP -\" A "Transparent" copy of the Document means a machine-readable copy, -\" represented in a format whose specification is available to the -\" general public, whose contents can be viewed and edited directly and -\" straightforwardly with generic text editors or (for images composed of -\" pixels) generic paint programs or (for drawings) some widely available -\" drawing editor, and that is suitable for input to text formatters or -\" for automatic translation to a variety of formats suitable for input -\" to text formatters. A copy made in an otherwise Transparent file -\" format whose markup has been designed to thwart or discourage -\" subsequent modification by readers is not Transparent. A copy that is -\" not "Transparent" is called "Opaque". -\" .PP -\" Examples of suitable formats for Transparent copies include plain -\" ASCII without markup, Texinfo input format, LaTeX input format, SGML -\" or XML using a publicly available DTD, and standard-conforming simple -\" HTML designed for human modification. Opaque formats include -\" PostScript, PDF, proprietary formats that can be read and edited only -\" by proprietary word processors, SGML or XML for which the DTD and/or -\" processing tools are not generally available, and the -\" machine-generated HTML produced by some word processors for output -\" purposes only. -\" .PP -\" The "Title Page" means, for a printed book, the title page itself, -\" plus such following pages as are needed to hold, legibly, the material -\" this License requires to appear in the title page. For works in -\" formats which do not have any title page as such, "Title Page" means -\" the text near the most prominent appearance of the work's title, -\" preceding the beginning of the body of the text. -\" .PP -\" 2. VERBATIM COPYING -\" .PP -\" You may copy and distribute the Document in any medium, either -\" commercially or noncommercially, provided that this License, the -\" copyright notices, and the license notice saying this License applies -\" to the Document are reproduced in all copies, and that you add no other -\" conditions whatsoever to those of this License. You may not use -\" technical measures to obstruct or control the reading or further -\" copying of the copies you make or distribute. However, you may accept -\" compensation in exchange for copies. If you distribute a large enough -\" number of copies you must also follow the conditions in section 3. -\" .PP -\" You may also lend copies, under the same conditions stated above, and -\" you may publicly display copies. -\" .PP -\" 3. COPYING IN QUANTITY -\" .PP -\" If you publish printed copies of the Document numbering more than 100, -\" and the Document's license notice requires Cover Texts, you must enclose -\" the copies in covers that carry, clearly and legibly, all these Cover -\" Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -\" the back cover. Both covers must also clearly and legibly identify -\" you as the publisher of these copies. The front cover must present -\" the full title with all words of the title equally prominent and -\" visible. You may add other material on the covers in addition. -\" Copying with changes limited to the covers, as long as they preserve -\" the title of the Document and satisfy these conditions, can be treated -\" as verbatim copying in other respects. -\" .PP -\" If the required texts for either cover are too voluminous to fit -\" legibly, you should put the first ones listed (as many as fit -\" reasonably) on the actual cover, and continue the rest onto adjacent -\" pages. -\" .PP -\" If you publish or distribute Opaque copies of the Document numbering -\" more than 100, you must either include a machine-readable Transparent -\" copy along with each Opaque copy, or state in or with each Opaque copy -\" a publicly-accessible computer-network location containing a complete -\" Transparent copy of the Document, free of added material, which the -\" general network-using public has access to download anonymously at no -\" charge using public-standard network protocols. If you use the latter -\" option, you must take reasonably prudent steps, when you begin -\" distribution of Opaque copies in quantity, to ensure that this -\" Transparent copy will remain thus accessible at the stated location -\" until at least one year after the last time you distribute an Opaque -\" copy (directly or through your agents or retailers) of that edition to -\" the public. -\" .PP -\" It is requested, but not required, that you contact the authors of the -\" Document well before redistributing any large number of copies, to give -\" them a chance to provide you with an updated version of the Document. -\" .PP -\" 4. MODIFICATIONS -\" .PP -\" You may copy and distribute a Modified Version of the Document under -\" the conditions of sections 2 and 3 above, provided that you release -\" the Modified Version under precisely this License, with the Modified -\" Version filling the role of the Document, thus licensing distribution -\" and modification of the Modified Version to whoever possesses a copy -\" of it. In addition, you must do these things in the Modified Version: -\" .PP -\" A. Use in the Title Page (and on the covers, if any) a title distinct -\" from that of the Document, and from those of previous versions -\" (which should, if there were any, be listed in the History section -\" of the Document). You may use the same title as a previous version -\" if the original publisher of that version gives permission. -\" .PP -\" B. List on the Title Page, as authors, one or more persons or entities -\" responsible for authorship of the modifications in the Modified -\" Version, together with at least five of the principal authors of the -\" Document (all of its principal authors, if it has less than five). -\" .PP -\" C. State on the Title page the name of the publisher of the -\" Modified Version, as the publisher. -\" .PP -\" D. Preserve all the copyright notices of the Document. -\" .PP -\" E. Add an appropriate copyright notice for your modifications -\" adjacent to the other copyright notices. -\" .PP -\" F. Include, immediately after the copyright notices, a license notice -\" giving the public permission to use the Modified Version under the -\" terms of this License, in the form shown in the Addendum below. -\" Preserve in that license notice the full lists of Invariant Sections -\" and required Cover Texts given in the Document's license notice. -\" .PP -\" H. Include an unaltered copy of this License. -\" .PP -\" I. Preserve the section entitled "History", and its title, and add to -\" it an item stating at least the title, year, new authors, and -\" publisher of the Modified Version as given on the Title Page. If -\" there is no section entitled "History" in the Document, create one -\" stating the title, year, authors, and publisher of the Document as -\" given on its Title Page, then add an item describing the Modified -\" Version as stated in the previous sentence. -\" .PP -\" J. Preserve the network location, if any, given in the Document for -\" public access to a Transparent copy of the Document, and likewise -\" the network locations given in the Document for previous versions -\" it was based on. These may be placed in the "History" section. -\" You may omit a network location for a work that was published at -\" least four years before the Document itself, or if the original -\" publisher of the version it refers to gives permission. -\" .PP -\" K. In any section entitled "Acknowledgements" or "Dedications", -\" preserve the section's title, and preserve in the section all the -\" substance and tone of each of the contributor acknowledgements -\" and/or dedications given therein. -\" .PP -\" L. Preserve all the Invariant Sections of the Document, -\" unaltered in their text and in their titles. Section numbers -\" or the equivalent are not considered part of the section titles. -\" .PP -\" M. Delete any section entitled "Endorsements". Such a section -\" may not be included in the Modified Version. -\" .PP -\" N. Do not retitle any existing section as "Endorsements" -\" or to conflict in title with any Invariant Section. -\" .PP -\" If the Modified Version includes new front-matter sections or -\" appendices that qualify as Secondary Sections and contain no material -\" copied from the Document, you may at your option designate some or all -\" of these sections as invariant. To do this, add their titles to the -\" list of Invariant Sections in the Modified Version's license notice. -\" These titles must be distinct from any other section titles. -\" .PP -\" You may add a section entitled "Endorsements", provided it contains -\" nothing but endorsements of your Modified Version by various -\" parties--for example, statements of peer review or that the text has -\" been approved by an organization as the authoritative definition of a -\" standard. -\" .PP -\" You may add a passage of up to five words as a Front-Cover Text, and a -\" passage of up to 25 words as a Back-Cover Text, to the end of the list -\" of Cover Texts in the Modified Version. Only one passage of -\" Front-Cover Text and one of Back-Cover Text may be added by (or -\" through arrangements made by) any one entity. If the Document already -\" includes a cover text for the same cover, previously added by you or -\" by arrangement made by the same entity you are acting on behalf of, -\" you may not add another; but you may replace the old one, on explicit -\" permission from the previous publisher that added the old one. -\" .PP -\" The author(s) and publisher(s) of the Document do not by this License -\" give permission to use their names for publicity for or to assert or -\" imply endorsement of any Modified Version. -\" .PP - -\" 5. COMBINING DOCUMENTS -\" .PP -\" You may combine the Document with other documents released under this -\" License, under the terms defined in section 4 above for modified -\" versions, provided that you include in the combination all of the -\" Invariant Sections of all of the original documents, unmodified, and -\" list them all as Invariant Sections of your combined work in its -\" license notice. -\" .PP -\" The combined work need only contain one copy of this License, and -\" multiple identical Invariant Sections may be replaced with a single -\" copy. If there are multiple Invariant Sections with the same name but -\" different contents, make the title of each such section unique by -\" adding at the end of it, in parentheses, the name of the original -\" author or publisher of that section if known, or else a unique number. -\" Make the same adjustment to the section titles in the list of -\" Invariant Sections in the license notice of the combined work. -\" .PP -\" In the combination, you must combine any sections entitled "History" -\" in the various original documents, forming one section entitled -\" "History"; likewise combine any sections entitled "Acknowledgements", -\" and any sections entitled "Dedications". You must delete all sections -\" entitled "Endorsements." -\" .PP - -\" 6. COLLECTIONS OF DOCUMENTS -\" .PP -\" You may make a collection consisting of the Document and other documents -\" released under this License, and replace the individual copies of this -\" License in the various documents with a single copy that is included in -\" the collection, provided that you follow the rules of this License for -\" verbatim copying of each of the documents in all other respects. -\" .PP -\" You may extract a single document from such a collection, and distribute -\" it individually under this License, provided you insert a copy of this -\" License into the extracted document, and follow this License in all -\" other respects regarding verbatim copying of that document. -\" .PP - -\" 7. AGGREGATION WITH INDEPENDENT WORKS -\" .PP -\" A compilation of the Document or its derivatives with other separate -\" and independent documents or works, in or on a volume of a storage or -\" distribution medium, does not as a whole count as a Modified Version -\" of the Document, provided no compilation copyright is claimed for the -\" compilation. Such a compilation is called an "aggregate", and this -\" License does not apply to the other self-contained works thus compiled -\" with the Document, on account of their being thus compiled, if they -\" are not themselves derivative works of the Document. -\" .PP -\" If the Cover Text requirement of section 3 is applicable to these -\" copies of the Document, then if the Document is less than one quarter -\" of the entire aggregate, the Document's Cover Texts may be placed on -\" covers that surround only the Document within the aggregate. -\" Otherwise they must appear on covers around the whole aggregate. -\" .PP - -\" 8. TRANSLATION -\" .PP -\" Translation is considered a kind of modification, so you may -\" distribute translations of the Document under the terms of section 4. -\" Replacing Invariant Sections with translations requires special -\" permission from their copyright holders, but you may include -\" translations of some or all Invariant Sections in addition to the -\" original versions of these Invariant Sections. You may include a -\" translation of this License provided that you also include the -\" original English version of this License. In case of a disagreement -\" between the translation and the original English version of this -\" License, the original English version will prevail. -\" .PP - -\" 9. TERMINATION -\" .PP -\" You may not copy, modify, sublicense, or distribute the Document except -\" as expressly provided for under this License. Any other attempt to -\" copy, modify, sublicense or distribute the Document 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. -\" .PP - -\" 10. FUTURE REVISIONS OF THIS LICENSE -\" .PP -\" The Free Software Foundation may publish new, revised versions -\" of the GNU Free Documentation 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. See -\" http://www.gnu.org/copyleft/. -\" .PP -\" Each version of the License is given a distinguishing version number. -\" If the Document specifies that a particular numbered version of this -\" License "or any later version" applies to it, you have the option of -\" following the terms and conditions either of that specified version or -\" of any later version that has been published (not as a draft) by the -\" Free Software Foundation. If the Document does not specify a version -\" number of this License, you may choose any version ever published (not -\" as a draft) by the Free Software Foundation. -\" .PP - -\" ADDENDUM: How to use this License for your documents -\" .PP -\" To use this License in a document you have written, include a copy of -\" the License in the document and put the following copyright and -\" license notices just after the title page: -\" .PP -\" Copyright (c) YEAR YOUR NAME. -\" Permission is granted to copy, distribute and/or -\" modify this document under the terms of the GNU -\" Free Documentation License, Version 1.1 or any later -\" version published by the Free Software Foundation; -\" with the Invariant Sections being LIST THEIR TITLES, -\" with the Front-Cover Texts being LIST, and with the -\" Back-Cover Texts being LIST. A copy of the license -\" is included in the section entitled "GNU Free -\" Documentation License". -\" .PP -\" If you have no Invariant Sections, write "with no Invariant Sections" -\" instead of saying which ones are invariant. If you have no -\" Front-Cover Texts, write "no Front-Cover Texts" instead of -\" "Front-Cover Texts being LIST"; likewise for Back-Cover Texts. -\" .PP -\" If your document contains nontrivial examples of program code, we -\" recommend releasing these examples in parallel under your choice of -\" free software license, such as the GNU General Public License, -\" to permit their use in free software. diff --git a/binutils/rclex.c b/binutils/rclex.c index e5070e3180105..ff20f2ae871d4 100644 --- a/binutils/rclex.c +++ b/binutils/rclex.c @@ -1,7 +1,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvs/src/src/binutils/Attic/rclex.c,v 1.1.12.1 2004/04/09 19:32:15 drow Exp $ + * $Header: /cvs/src/src/binutils/rclex.c,v 1.1.12.1 2004/04/09 19:32:15 drow Exp $ */ #define FLEX_SCANNER diff --git a/binutils/rcparse.c b/binutils/rcparse.c index 9add78f384b82..3c5d234336902 100644 --- a/binutils/rcparse.c +++ b/binutils/rcparse.c @@ -89,7 +89,7 @@ #line 1 "rcparse.y" /* rcparse.y -- parser for Windows rc files - Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -142,9 +142,14 @@ static unsigned long style; static unsigned long base_style; static unsigned long default_style; static unsigned long class; +static struct res_id res_text_field; +/* This is used for COMBOBOX, LISTBOX and EDITTEXT which + do not allow resource 'text' field in control definition. */ +static const struct res_id res_null_text = { 1, {{0, L""}}}; -#line 58 "rcparse.y" + +#line 63 "rcparse.y" #ifndef YYSTYPE typedef union { @@ -194,7 +199,7 @@ typedef union -#define YYFINAL 483 +#define YYFINAL 499 #define YYFLAG -32768 #define YYNTBASE 99 @@ -249,25 +254,25 @@ static const short yyprhs[] = 84, 86, 88, 90, 95, 100, 101, 115, 116, 130, 131, 146, 147, 151, 152, 156, 160, 164, 168, 172, 178, 185, 193, 202, 206, 210, 215, 219, 220, 223, - 224, 228, 229, 233, 234, 238, 239, 243, 244, 248, - 249, 253, 265, 278, 291, 305, 306, 310, 311, 315, - 316, 320, 321, 325, 326, 330, 337, 346, 357, 369, - 370, 374, 375, 379, 380, 384, 385, 389, 390, 394, - 395, 399, 400, 404, 405, 409, 410, 414, 415, 432, - 440, 450, 461, 462, 464, 467, 468, 472, 473, 477, - 478, 482, 483, 487, 492, 497, 501, 508, 509, 512, - 517, 520, 527, 528, 532, 535, 537, 539, 541, 543, - 545, 547, 554, 555, 558, 561, 565, 571, 574, 580, - 587, 595, 605, 610, 617, 618, 621, 622, 624, 626, - 628, 632, 636, 637, 644, 645, 649, 654, 661, 666, - 673, 674, 681, 688, 692, 696, 700, 704, 708, 709, - 718, 726, 727, 733, 734, 738, 740, 742, 744, 747, - 750, 753, 755, 756, 759, 763, 768, 772, 773, 776, - 777, 780, 782, 784, 786, 788, 790, 792, 794, 796, - 798, 800, 803, 807, 812, 814, 818, 819, 821, 824, - 826, 828, 832, 835, 838, 842, 846, 850, 854, 858, - 862, 866, 870, 873, 875, 877, 881, 884, 888, 892, - 896, 900, 904, 908, 912 + 224, 229, 230, 235, 236, 241, 242, 247, 248, 253, + 254, 258, 270, 283, 296, 310, 311, 316, 317, 322, + 323, 327, 328, 333, 334, 339, 346, 355, 366, 378, + 379, 384, 385, 389, 390, 395, 396, 401, 402, 407, + 408, 413, 414, 419, 420, 424, 425, 430, 431, 447, + 454, 463, 473, 474, 477, 479, 482, 483, 487, 488, + 492, 493, 497, 498, 502, 507, 512, 516, 523, 524, + 527, 532, 535, 542, 543, 547, 550, 552, 554, 556, + 558, 560, 562, 569, 570, 573, 576, 580, 586, 589, + 595, 602, 610, 620, 625, 632, 633, 636, 637, 639, + 641, 643, 647, 651, 652, 659, 660, 664, 669, 676, + 681, 688, 689, 696, 703, 707, 711, 715, 719, 723, + 724, 733, 741, 742, 748, 749, 753, 755, 757, 759, + 762, 765, 768, 770, 771, 774, 778, 783, 787, 788, + 791, 792, 795, 797, 799, 801, 803, 805, 807, 809, + 811, 813, 815, 818, 822, 827, 829, 833, 834, 836, + 839, 841, 843, 847, 850, 853, 857, 861, 865, 869, + 873, 877, 881, 885, 888, 890, 892, 896, 899, 903, + 907, 911, 915, 919, 923, 927 }; static const short yyrhs[] = { @@ -293,76 +298,78 @@ static const short yyrhs[] = 183, 183, 0, 113, 41, 184, 95, 80, 183, 183, 183, 0, 113, 46, 172, 0, 113, 44, 184, 0, 113, 43, 184, 183, 0, 113, 45, 184, 0, 0, - 114, 115, 0, 0, 20, 116, 137, 0, 0, 21, - 117, 137, 0, 0, 22, 118, 137, 0, 0, 38, - 119, 137, 0, 0, 23, 120, 137, 0, 0, 24, - 121, 137, 0, 10, 138, 184, 183, 140, 183, 183, - 183, 183, 182, 139, 0, 10, 138, 184, 183, 140, - 183, 183, 183, 183, 183, 183, 139, 0, 10, 138, - 184, 95, 80, 140, 183, 183, 183, 183, 182, 139, - 0, 10, 138, 184, 95, 80, 140, 183, 183, 183, - 183, 183, 183, 139, 0, 0, 25, 122, 137, 0, - 0, 26, 123, 137, 0, 0, 27, 124, 137, 0, - 0, 28, 125, 137, 0, 0, 39, 126, 137, 0, - 42, 174, 184, 183, 183, 139, 0, 42, 174, 184, - 183, 183, 183, 183, 139, 0, 42, 174, 184, 183, - 183, 183, 183, 142, 182, 139, 0, 42, 174, 184, - 183, 183, 183, 183, 142, 183, 183, 139, 0, 0, - 40, 127, 137, 0, 0, 29, 128, 137, 0, 0, - 30, 129, 137, 0, 0, 31, 130, 137, 0, 0, - 32, 131, 137, 0, 0, 33, 132, 137, 0, 0, - 34, 133, 137, 0, 0, 35, 134, 137, 0, 0, - 36, 135, 137, 0, 0, 37, 80, 95, 184, 95, - 184, 95, 184, 95, 184, 95, 184, 95, 136, 180, - 182, 0, 138, 184, 183, 183, 183, 183, 139, 0, - 138, 184, 183, 183, 183, 183, 144, 182, 139, 0, - 138, 184, 183, 183, 183, 183, 144, 183, 183, 139, - 0, 0, 80, 0, 80, 95, 0, 0, 3, 159, - 4, 0, 0, 95, 141, 180, 0, 0, 95, 143, - 180, 0, 0, 95, 145, 180, 0, 172, 41, 176, - 179, 0, 172, 42, 176, 179, 0, 43, 184, 183, - 0, 172, 46, 175, 3, 150, 4, 0, 0, 150, - 151, 0, 48, 80, 183, 152, 0, 48, 49, 0, - 50, 80, 152, 3, 150, 4, 0, 0, 152, 95, - 153, 0, 152, 153, 0, 51, 0, 52, 0, 53, - 0, 54, 0, 55, 0, 56, 0, 172, 47, 175, - 3, 155, 4, 0, 0, 155, 156, 0, 48, 80, - 0, 48, 80, 183, 0, 48, 80, 183, 183, 182, - 0, 48, 49, 0, 50, 80, 3, 155, 4, 0, - 50, 80, 183, 3, 155, 4, 0, 50, 80, 183, - 183, 3, 155, 4, 0, 50, 80, 183, 183, 183, - 182, 3, 155, 4, 0, 172, 57, 177, 179, 0, - 172, 58, 175, 3, 159, 4, 0, 0, 160, 161, - 0, 0, 162, 0, 83, 0, 185, 0, 162, 95, - 83, 0, 162, 95, 185, 0, 0, 59, 175, 3, - 164, 165, 4, 0, 0, 165, 184, 80, 0, 165, - 184, 95, 80, 0, 172, 172, 175, 3, 159, 4, - 0, 172, 172, 175, 179, 0, 172, 60, 168, 3, - 169, 4, 0, 0, 168, 61, 184, 183, 183, 183, - 0, 168, 62, 184, 183, 183, 183, 0, 168, 63, - 184, 0, 168, 64, 184, 0, 168, 65, 184, 0, - 168, 66, 184, 0, 168, 67, 184, 0, 0, 169, - 68, 3, 71, 3, 170, 4, 4, 0, 169, 69, - 3, 70, 80, 171, 4, 0, 0, 170, 70, 80, - 95, 80, 0, 0, 171, 183, 183, 0, 187, 0, - 81, 0, 80, 0, 80, 95, 0, 81, 95, 0, - 187, 95, 0, 173, 0, 0, 175, 178, 0, 175, - 44, 184, 0, 175, 43, 184, 183, 0, 175, 45, - 184, 0, 0, 176, 178, 0, 0, 177, 178, 0, - 72, 0, 73, 0, 74, 0, 75, 0, 76, 0, - 77, 0, 78, 0, 80, 0, 81, 0, 181, 0, - 79, 181, 0, 180, 85, 181, 0, 180, 85, 79, - 181, 0, 82, 0, 97, 184, 98, 0, 0, 183, - 0, 95, 184, 0, 185, 0, 82, 0, 97, 185, - 98, 0, 93, 185, 0, 89, 185, 0, 185, 90, - 185, 0, 185, 91, 185, 0, 185, 92, 185, 0, - 185, 88, 185, 0, 185, 89, 185, 0, 185, 87, - 185, 0, 185, 86, 185, 0, 185, 85, 185, 0, - 95, 187, 0, 188, 0, 82, 0, 97, 185, 98, - 0, 93, 185, 0, 188, 90, 185, 0, 188, 91, - 185, 0, 188, 92, 185, 0, 188, 88, 185, 0, - 188, 89, 185, 0, 188, 87, 185, 0, 188, 86, - 185, 0, 188, 85, 185, 0 + 114, 115, 0, 0, 20, 138, 116, 137, 0, 0, + 21, 138, 117, 137, 0, 0, 22, 138, 118, 137, + 0, 0, 38, 138, 119, 137, 0, 0, 23, 138, + 120, 137, 0, 0, 24, 121, 137, 0, 10, 138, + 184, 183, 140, 183, 183, 183, 183, 182, 139, 0, + 10, 138, 184, 183, 140, 183, 183, 183, 183, 183, + 183, 139, 0, 10, 138, 184, 95, 80, 140, 183, + 183, 183, 183, 182, 139, 0, 10, 138, 184, 95, + 80, 140, 183, 183, 183, 183, 183, 183, 139, 0, + 0, 25, 138, 122, 137, 0, 0, 26, 138, 123, + 137, 0, 0, 27, 124, 137, 0, 0, 28, 138, + 125, 137, 0, 0, 39, 138, 126, 137, 0, 42, + 174, 184, 183, 183, 139, 0, 42, 174, 184, 183, + 183, 183, 183, 139, 0, 42, 174, 184, 183, 183, + 183, 183, 142, 182, 139, 0, 42, 174, 184, 183, + 183, 183, 183, 142, 183, 183, 139, 0, 0, 40, + 138, 127, 137, 0, 0, 29, 128, 137, 0, 0, + 30, 138, 129, 137, 0, 0, 31, 138, 130, 137, + 0, 0, 32, 138, 131, 137, 0, 0, 33, 138, + 132, 137, 0, 0, 34, 138, 133, 137, 0, 0, + 35, 134, 137, 0, 0, 36, 138, 135, 137, 0, + 0, 37, 174, 184, 95, 184, 95, 184, 95, 184, + 95, 184, 95, 136, 180, 182, 0, 184, 183, 183, + 183, 183, 139, 0, 184, 183, 183, 183, 183, 144, + 182, 139, 0, 184, 183, 183, 183, 183, 144, 183, + 183, 139, 0, 0, 187, 95, 0, 80, 0, 80, + 95, 0, 0, 3, 159, 4, 0, 0, 95, 141, + 180, 0, 0, 95, 143, 180, 0, 0, 95, 145, + 180, 0, 172, 41, 176, 179, 0, 172, 42, 176, + 179, 0, 43, 184, 183, 0, 172, 46, 175, 3, + 150, 4, 0, 0, 150, 151, 0, 48, 80, 183, + 152, 0, 48, 49, 0, 50, 80, 152, 3, 150, + 4, 0, 0, 152, 95, 153, 0, 152, 153, 0, + 51, 0, 52, 0, 53, 0, 54, 0, 55, 0, + 56, 0, 172, 47, 175, 3, 155, 4, 0, 0, + 155, 156, 0, 48, 80, 0, 48, 80, 183, 0, + 48, 80, 183, 183, 182, 0, 48, 49, 0, 50, + 80, 3, 155, 4, 0, 50, 80, 183, 3, 155, + 4, 0, 50, 80, 183, 183, 3, 155, 4, 0, + 50, 80, 183, 183, 183, 182, 3, 155, 4, 0, + 172, 57, 177, 179, 0, 172, 58, 175, 3, 159, + 4, 0, 0, 160, 161, 0, 0, 162, 0, 83, + 0, 185, 0, 162, 95, 83, 0, 162, 95, 185, + 0, 0, 59, 175, 3, 164, 165, 4, 0, 0, + 165, 184, 80, 0, 165, 184, 95, 80, 0, 172, + 172, 175, 3, 159, 4, 0, 172, 172, 175, 179, + 0, 172, 60, 168, 3, 169, 4, 0, 0, 168, + 61, 184, 183, 183, 183, 0, 168, 62, 184, 183, + 183, 183, 0, 168, 63, 184, 0, 168, 64, 184, + 0, 168, 65, 184, 0, 168, 66, 184, 0, 168, + 67, 184, 0, 0, 169, 68, 3, 71, 3, 170, + 4, 4, 0, 169, 69, 3, 70, 80, 171, 4, + 0, 0, 170, 70, 80, 95, 80, 0, 0, 171, + 183, 183, 0, 187, 0, 81, 0, 80, 0, 80, + 95, 0, 81, 95, 0, 187, 95, 0, 173, 0, + 0, 175, 178, 0, 175, 44, 184, 0, 175, 43, + 184, 183, 0, 175, 45, 184, 0, 0, 176, 178, + 0, 0, 177, 178, 0, 72, 0, 73, 0, 74, + 0, 75, 0, 76, 0, 77, 0, 78, 0, 80, + 0, 81, 0, 181, 0, 79, 181, 0, 180, 85, + 181, 0, 180, 85, 79, 181, 0, 82, 0, 97, + 184, 98, 0, 0, 183, 0, 95, 184, 0, 185, + 0, 82, 0, 97, 185, 98, 0, 93, 185, 0, + 89, 185, 0, 185, 90, 185, 0, 185, 91, 185, + 0, 185, 92, 185, 0, 185, 88, 185, 0, 185, + 89, 185, 0, 185, 87, 185, 0, 185, 86, 185, + 0, 185, 85, 185, 0, 95, 187, 0, 188, 0, + 82, 0, 97, 185, 98, 0, 93, 185, 0, 188, + 90, 185, 0, 188, 91, 185, 0, 188, 92, 185, + 0, 188, 88, 185, 0, 188, 89, 185, 0, 188, + 87, 185, 0, 188, 86, 185, 0, 188, 85, 185, + 0 }; #endif @@ -371,31 +378,31 @@ static const short yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { - 0, 154, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 175, 185, 190, - 210, 216, 227, 249, 258, 263, 268, 274, 279, 284, - 288, 292, 296, 304, 316, 328, 328, 354, 354, 381, - 381, 411, 416, 422, 424, 430, 434, 439, 443, 447, - 460, 475, 490, 505, 509, 513, 517, 523, 525, 535, - 535, 546, 546, 556, 556, 566, 566, 579, 579, 589, - 589, 599, 610, 619, 632, 643, 643, 653, 653, 663, - 663, 673, 673, 683, 683, 696, 701, 707, 713, 719, - 719, 732, 732, 742, 742, 752, 752, 762, 762, 772, - 772, 782, 782, 792, 792, 802, 802, 812, 812, 829, - 842, 853, 864, 869, 873, 879, 884, 892, 892, 898, - 898, 904, 904, 912, 924, 937, 946, 956, 961, 977, - 982, 986, 992, 997, 1001, 1007, 1012, 1016, 1020, 1024, - 1028, 1036, 1046, 1051, 1067, 1072, 1076, 1080, 1084, 1088, - 1092, 1096, 1105, 1117, 1130, 1130, 1141, 1147, 1153, 1162, - 1170, 1179, 1192, 1192, 1198, 1200, 1207, 1219, 1227, 1238, - 1248, 1255, 1261, 1267, 1272, 1277, 1282, 1287, 1300, 1305, - 1309, 1315, 1320, 1326, 1331, 1339, 1345, 1360, 1365, 1369, - 1376, 1382, 1398, 1406, 1412, 1417, 1422, 1431, 1438, 1448, - 1455, 1466, 1472, 1477, 1482, 1487, 1492, 1497, 1506, 1511, - 1527, 1532, 1536, 1540, 1546, 1551, 1559, 1564, 1572, 1581, - 1590, 1595, 1599, 1604, 1609, 1614, 1619, 1624, 1629, 1634, - 1639, 1644, 1654, 1663, 1674, 1679, 1683, 1688, 1693, 1698, - 1703, 1708, 1713, 1718, 1723 + 0, 159, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 180, 190, 195, + 215, 221, 232, 254, 263, 268, 273, 279, 284, 289, + 293, 297, 301, 309, 321, 333, 333, 359, 359, 386, + 386, 416, 421, 427, 429, 435, 439, 444, 448, 452, + 465, 480, 495, 510, 514, 518, 522, 528, 530, 540, + 540, 552, 552, 563, 563, 574, 574, 588, 588, 599, + 599, 612, 623, 632, 645, 656, 656, 667, 667, 678, + 678, 689, 689, 700, 700, 714, 719, 725, 731, 737, + 737, 751, 751, 762, 762, 773, 773, 783, 783, 794, + 794, 805, 805, 816, 816, 827, 827, 838, 838, 855, + 867, 878, 889, 894, 899, 903, 909, 914, 922, 922, + 928, 928, 934, 934, 942, 954, 967, 976, 986, 991, + 1007, 1012, 1016, 1022, 1027, 1031, 1037, 1042, 1046, 1050, + 1054, 1058, 1066, 1076, 1081, 1097, 1102, 1106, 1110, 1114, + 1118, 1122, 1126, 1135, 1147, 1160, 1160, 1171, 1177, 1183, + 1192, 1200, 1209, 1222, 1222, 1228, 1230, 1237, 1249, 1257, + 1268, 1278, 1285, 1291, 1297, 1302, 1307, 1312, 1317, 1330, + 1335, 1339, 1345, 1350, 1356, 1361, 1369, 1375, 1390, 1395, + 1399, 1406, 1412, 1428, 1436, 1442, 1447, 1452, 1461, 1468, + 1478, 1485, 1496, 1502, 1507, 1512, 1517, 1522, 1527, 1536, + 1541, 1557, 1562, 1566, 1570, 1576, 1581, 1589, 1594, 1602, + 1611, 1620, 1625, 1629, 1634, 1639, 1644, 1649, 1654, 1659, + 1664, 1669, 1674, 1684, 1693, 1704, 1709, 1713, 1718, 1723, + 1728, 1733, 1738, 1743, 1748, 1753 }; #endif @@ -426,7 +433,7 @@ static const char *const yytname[] = "@3", "exstyle", "styles", "controls", "control", "@4", "@5", "@6", "@7", "@8", "@9", "@10", "@11", "@12", "@13", "@14", "@15", "@16", "@17", "@18", "@19", "@20", "@21", "@22", "@23", "@24", - "control_params", "optstringc", "opt_control_data", "control_styleexpr", + "control_params", "optresidc", "opt_control_data", "control_styleexpr", "@25", "icon_styleexpr", "@26", "control_params_styleexpr", "@27", "font", "icon", "language", "menu", "menuitems", "menuitem", "menuitem_flags", "menuitem_flag", "menuex", "menuexitems", @@ -454,20 +461,20 @@ static const short yyr1[] = 115, 125, 115, 126, 115, 115, 115, 115, 115, 127, 115, 128, 115, 129, 115, 130, 115, 131, 115, 132, 115, 133, 115, 134, 115, 135, 115, 136, 115, 137, - 137, 137, 138, 138, 138, 139, 139, 141, 140, 143, - 142, 145, 144, 146, 147, 148, 149, 150, 150, 151, - 151, 151, 152, 152, 152, 153, 153, 153, 153, 153, - 153, 154, 155, 155, 156, 156, 156, 156, 156, 156, - 156, 156, 157, 158, 160, 159, 161, 161, 162, 162, - 162, 162, 164, 163, 165, 165, 165, 166, 166, 167, - 168, 168, 168, 168, 168, 168, 168, 168, 169, 169, - 169, 170, 170, 171, 171, 172, 172, 173, 173, 173, - 174, 174, 175, 175, 175, 175, 175, 176, 176, 177, - 177, 178, 178, 178, 178, 178, 178, 178, 179, 179, - 180, 180, 180, 180, 181, 181, 182, 182, 183, 184, - 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 186, 187, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188 + 137, 137, 138, 138, 138, 138, 139, 139, 141, 140, + 143, 142, 145, 144, 146, 147, 148, 149, 150, 150, + 151, 151, 151, 152, 152, 152, 153, 153, 153, 153, + 153, 153, 154, 155, 155, 156, 156, 156, 156, 156, + 156, 156, 156, 157, 158, 160, 159, 161, 161, 162, + 162, 162, 162, 164, 163, 165, 165, 165, 166, 166, + 167, 168, 168, 168, 168, 168, 168, 168, 168, 169, + 169, 169, 170, 170, 171, 171, 172, 172, 173, 173, + 173, 174, 174, 175, 175, 175, 175, 175, 176, 176, + 177, 177, 178, 178, 178, 178, 178, 178, 178, 179, + 179, 180, 180, 180, 180, 181, 181, 182, 182, 183, + 184, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 185, 186, 187, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -479,25 +486,25 @@ static const short yyr2[] = 1, 1, 1, 4, 4, 0, 13, 0, 13, 0, 14, 0, 3, 0, 3, 3, 3, 3, 3, 5, 6, 7, 8, 3, 3, 4, 3, 0, 2, 0, - 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, - 3, 11, 12, 12, 13, 0, 3, 0, 3, 0, - 3, 0, 3, 0, 3, 6, 8, 10, 11, 0, - 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, - 3, 0, 3, 0, 3, 0, 3, 0, 16, 7, - 9, 10, 0, 1, 2, 0, 3, 0, 3, 0, - 3, 0, 3, 4, 4, 3, 6, 0, 2, 4, - 2, 6, 0, 3, 2, 1, 1, 1, 1, 1, - 1, 6, 0, 2, 2, 3, 5, 2, 5, 6, - 7, 9, 4, 6, 0, 2, 0, 1, 1, 1, - 3, 3, 0, 6, 0, 3, 4, 6, 4, 6, - 0, 6, 6, 3, 3, 3, 3, 3, 0, 8, - 7, 0, 5, 0, 3, 1, 1, 1, 2, 2, - 2, 1, 0, 2, 3, 4, 3, 0, 2, 0, - 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 3, 4, 1, 3, 0, 1, 2, 1, - 1, 3, 2, 2, 3, 3, 3, 3, 3, 3, - 3, 3, 2, 1, 1, 3, 2, 3, 3, 3, - 3, 3, 3, 3, 3 + 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, + 3, 11, 12, 12, 13, 0, 4, 0, 4, 0, + 3, 0, 4, 0, 4, 6, 8, 10, 11, 0, + 4, 0, 3, 0, 4, 0, 4, 0, 4, 0, + 4, 0, 4, 0, 3, 0, 4, 0, 15, 6, + 8, 9, 0, 2, 1, 2, 0, 3, 0, 3, + 0, 3, 0, 3, 4, 4, 3, 6, 0, 2, + 4, 2, 6, 0, 3, 2, 1, 1, 1, 1, + 1, 1, 6, 0, 2, 2, 3, 5, 2, 5, + 6, 7, 9, 4, 6, 0, 2, 0, 1, 1, + 1, 3, 3, 0, 6, 0, 3, 4, 6, 4, + 6, 0, 6, 6, 3, 3, 3, 3, 3, 0, + 8, 7, 0, 5, 0, 3, 1, 1, 1, 2, + 2, 2, 1, 0, 2, 3, 4, 3, 0, 2, + 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 3, 4, 1, 3, 0, 1, 2, + 1, 1, 3, 2, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 2, 1, 1, 3, 2, 3, 3, + 3, 3, 3, 3, 3, 3 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE @@ -505,293 +512,313 @@ static const short yyr2[] = error. */ static const short yydefact[] = { - 1, 0, 0, 192, 186, 234, 16, 0, 0, 2, + 1, 0, 0, 193, 187, 235, 16, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 0, 185, 233, 220, 0, 0, 0, - 0, 219, 0, 236, 0, 192, 199, 197, 199, 199, - 197, 197, 192, 192, 199, 192, 170, 192, 0, 0, - 0, 0, 0, 0, 0, 0, 223, 222, 0, 0, - 125, 0, 0, 0, 0, 0, 0, 0, 0, 162, - 0, 0, 0, 201, 202, 203, 204, 205, 206, 207, - 193, 235, 0, 0, 0, 41, 41, 0, 0, 0, - 0, 0, 0, 0, 0, 244, 243, 242, 240, 241, - 237, 238, 239, 221, 218, 231, 230, 229, 227, 228, - 224, 225, 226, 164, 0, 194, 196, 18, 208, 209, - 200, 33, 198, 34, 0, 0, 0, 123, 124, 127, - 142, 152, 154, 178, 0, 0, 0, 0, 0, 0, - 0, 154, 168, 0, 195, 0, 0, 0, 0, 0, - 0, 0, 156, 0, 0, 0, 173, 174, 175, 176, - 177, 0, 163, 0, 17, 22, 19, 0, 23, 42, - 0, 0, 126, 0, 0, 128, 141, 0, 0, 143, - 153, 158, 155, 157, 159, 169, 0, 0, 0, 0, - 167, 165, 0, 0, 20, 0, 0, 130, 0, 132, - 147, 144, 0, 0, 0, 0, 0, 0, 166, 232, - 0, 35, 37, 132, 0, 145, 142, 0, 160, 161, - 0, 0, 171, 172, 27, 28, 29, 30, 31, 32, - 21, 24, 43, 43, 39, 129, 127, 135, 136, 137, - 138, 139, 140, 0, 134, 216, 0, 142, 0, 181, - 183, 0, 26, 0, 0, 43, 0, 133, 146, 217, - 148, 0, 142, 216, 0, 0, 25, 57, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 57, 0, 131, - 149, 0, 0, 0, 0, 180, 0, 0, 47, 44, - 48, 45, 0, 214, 0, 46, 210, 0, 0, 54, - 56, 53, 0, 57, 150, 142, 179, 0, 184, 36, - 112, 59, 61, 63, 67, 69, 75, 77, 79, 81, - 91, 93, 95, 97, 99, 101, 103, 105, 0, 65, - 83, 89, 0, 58, 211, 0, 0, 0, 55, 38, - 0, 0, 0, 113, 0, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 0, 112, 112, 112, 187, 0, 191, 0, - 0, 215, 0, 212, 49, 40, 151, 182, 114, 0, - 60, 0, 62, 64, 68, 70, 76, 78, 80, 82, - 92, 94, 96, 98, 100, 102, 104, 106, 0, 66, - 84, 90, 188, 189, 0, 190, 213, 50, 0, 0, - 0, 0, 0, 51, 0, 117, 0, 0, 0, 115, - 52, 0, 0, 0, 0, 0, 154, 85, 0, 0, - 118, 0, 0, 0, 0, 115, 0, 0, 115, 0, - 116, 119, 86, 216, 0, 216, 121, 109, 216, 0, - 0, 115, 217, 216, 115, 217, 0, 115, 217, 0, - 120, 87, 115, 115, 217, 71, 115, 122, 110, 115, - 0, 88, 73, 115, 72, 111, 0, 74, 107, 0, - 216, 108, 0, 0 + 13, 14, 15, 0, 186, 234, 221, 0, 0, 0, + 0, 220, 0, 237, 0, 193, 200, 198, 200, 200, + 198, 198, 193, 193, 200, 193, 171, 193, 0, 0, + 0, 0, 0, 0, 0, 0, 224, 223, 0, 0, + 126, 0, 0, 0, 0, 0, 0, 0, 0, 163, + 0, 0, 0, 202, 203, 204, 205, 206, 207, 208, + 194, 236, 0, 0, 0, 41, 41, 0, 0, 0, + 0, 0, 0, 0, 0, 245, 244, 243, 241, 242, + 238, 239, 240, 222, 219, 232, 231, 230, 228, 229, + 225, 226, 227, 165, 0, 195, 197, 18, 209, 210, + 201, 33, 199, 34, 0, 0, 0, 124, 125, 128, + 143, 153, 155, 179, 0, 0, 0, 0, 0, 0, + 0, 155, 169, 0, 196, 0, 0, 0, 0, 0, + 0, 0, 157, 0, 0, 0, 174, 175, 176, 177, + 178, 0, 164, 0, 17, 22, 19, 0, 23, 42, + 0, 0, 127, 0, 0, 129, 142, 0, 0, 144, + 154, 159, 156, 158, 160, 170, 0, 0, 0, 0, + 168, 166, 0, 0, 20, 0, 0, 131, 0, 133, + 148, 145, 0, 0, 0, 0, 0, 0, 167, 233, + 0, 35, 37, 133, 0, 146, 143, 0, 161, 162, + 0, 0, 172, 173, 27, 28, 29, 30, 31, 32, + 21, 24, 43, 43, 39, 130, 128, 136, 137, 138, + 139, 140, 141, 0, 135, 217, 0, 143, 0, 182, + 184, 0, 26, 0, 0, 43, 0, 134, 147, 218, + 149, 0, 143, 217, 0, 0, 25, 57, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 57, 0, 132, + 150, 0, 0, 0, 0, 181, 0, 0, 47, 44, + 48, 45, 0, 215, 0, 46, 211, 0, 0, 54, + 56, 53, 0, 57, 151, 143, 180, 0, 185, 36, + 112, 112, 112, 112, 112, 69, 112, 112, 79, 112, + 91, 112, 112, 112, 112, 112, 103, 112, 0, 112, + 112, 112, 0, 58, 212, 0, 0, 0, 55, 38, + 0, 0, 0, 114, 0, 0, 59, 61, 63, 67, + 0, 75, 77, 0, 81, 0, 93, 95, 97, 99, + 101, 0, 105, 188, 0, 192, 0, 0, 65, 83, + 89, 0, 216, 0, 213, 49, 40, 152, 183, 115, + 0, 113, 0, 0, 0, 0, 70, 0, 0, 0, + 80, 0, 92, 0, 0, 0, 0, 0, 104, 0, + 189, 190, 0, 191, 0, 0, 0, 0, 214, 50, + 0, 0, 60, 62, 64, 68, 0, 76, 78, 82, + 94, 96, 98, 100, 102, 106, 0, 66, 84, 90, + 0, 51, 0, 118, 0, 0, 0, 116, 52, 0, + 0, 0, 0, 0, 155, 85, 0, 0, 119, 0, + 116, 0, 0, 116, 0, 0, 122, 109, 217, 0, + 117, 120, 86, 217, 0, 217, 0, 116, 218, 0, + 0, 116, 218, 217, 116, 218, 123, 110, 116, 0, + 121, 87, 116, 116, 218, 71, 116, 111, 0, 88, + 73, 116, 72, 107, 74, 0, 217, 108, 0, 0 }; static const short yydefgoto[] = { 1, 9, 145, 166, 167, 230, 231, 10, 11, 12, - 232, 233, 255, 125, 253, 287, 333, 345, 346, 347, - 363, 348, 349, 350, 351, 352, 353, 364, 365, 354, - 355, 356, 357, 358, 359, 360, 361, 479, 380, 381, - 427, 416, 422, 443, 450, 448, 456, 13, 14, 15, + 232, 233, 255, 125, 253, 287, 333, 382, 383, 384, + 404, 385, 350, 388, 389, 353, 391, 405, 406, 355, + 393, 394, 395, 396, 397, 361, 399, 495, 386, 344, + 445, 434, 440, 463, 470, 458, 466, 13, 14, 15, 16, 149, 175, 214, 244, 17, 150, 179, 18, 19, 151, 152, 182, 183, 20, 113, 143, 21, 22, 93, - 153, 264, 265, 23, 368, 369, 32, 84, 83, 80, - 121, 295, 296, 258, 259, 104, 31, 194, 24, 25 + 153, 264, 265, 23, 365, 366, 32, 84, 83, 80, + 121, 295, 296, 258, 259, 387, 31, 194, 345, 25 }; static const short yypact[] = { - -32768, 13, 412,-32768,-32768,-32768,-32768, 412, 412,-32768, + -32768, 13, 265,-32768,-32768,-32768,-32768, 265, 265,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768, 111,-32768, 511,-32768, 412, 412, 412, - -79, 600, 244,-32768, 562,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 412, 412, - 412, 412, 412, 412, 412, 412,-32768,-32768, 576, 412, - -32768, 412, 412, 412, 412, 412, 412, 412, 412,-32768, - 412, 412, 412,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768, 256, 603, 603, 297, 297, 603, 603, 280, - 337, 603, 345, 100, 231, 607, 613, 567, 172, 172, - -32768,-32768,-32768,-32768,-32768, 607, 613, 567, 172, 172, - -32768,-32768,-32768,-32768, -79,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768, -60, 63, 63,-32768,-32768,-32768, - -32768,-32768,-32768,-32768, 412, 412, 412, 412, 412, 412, - 412,-32768,-32768, 7,-32768, 5, 412, -79, -79, 33, - 34, 35, 254, 51, -79, -79,-32768,-32768,-32768,-32768, - -32768, 36,-32768, 60,-32768,-32768,-32768, -38,-32768,-32768, - -79, -79,-32768, -39, 11,-32768,-32768, 59, 25,-32768, - -32768,-32768,-32768, 27, 600,-32768, 127, 144, -79, -79, - -32768,-32768, 74, 63, 87, -79, -79,-32768, -79,-32768, - -32768, -79, 12, 294, 118, 128, -79, -79,-32768,-32768, - 700,-32768, -79,-32768, 22, -79,-32768, 14,-32768, 600, - 194, 121,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 23,-32768,-32768,-32768,-32768, 309,-32768,-32768,-32768,-32768, - -32768,-32768,-32768, 661,-32768, -79, 38,-32768, 16,-32768, - -32768, 700,-32768, 383, 472,-32768, 42,-32768,-32768,-32768, - -32768, 124,-32768, -79, 10, 4,-32768,-32768, 412, 126, - 187, 99, 412, 412, 412, 412, 200,-32768, 480,-32768, - -32768, 125, 204, 207, 135,-32768, -79, 510,-32768,-32768, - -32768,-32768, 49,-32768, 412, 136,-32768, 133, -79,-32768, - -32768,-32768, 547,-32768,-32768,-32768,-32768, 134,-32768,-32768, - 152,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 153,-32768, - -32768,-32768, 374,-32768,-32768, 140, 112, 157,-32768,-32768, - 584, 138, 160, 148, 412, 152, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, - 152, 152, 158, 152, 152, 152, 161, 163,-32768, 412, - 165,-32768, 49,-32768, -79,-32768,-32768,-32768,-32768, 170, - -32768, 412,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 412,-32768, - -32768,-32768,-32768,-32768, -79,-32768,-32768, -79, 123, 183, - -79, 184, -79, -79, 183,-32768, -79, -79, 412, 17, - -32768, -79, 99, -79, -79, 190,-32768,-32768, -79, -79, - 136, -79, -79, 412, 248, 18, -79, -79, 19, 195, - -32768,-32768,-32768, -79, -79, -79,-32768,-32768, -79, 412, - 99, 245, -79, -79, 245, -79, 99, 245, -79, 196, - 136,-32768, 245, 245, -79,-32768, 245, 136,-32768, 245, - 412,-32768,-32768, 245,-32768,-32768, 201,-32768,-32768, 99, - 64,-32768, 295,-32768 + -32768,-32768,-32768, 110,-32768, 567,-32768, 265, 265, 265, + -70, 605, 300,-32768, 657,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 265, 265, + 265, 265, 265, 265, 265, 265,-32768,-32768, 671, 265, + -32768, 265, 265, 265, 265, 265, 265, 265, 265,-32768, + 265, 265, 265,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768, 307, 698, 698, 224, 224, 698, 698, 323, + 345, 698, 445, 195, 244, 694, 700, 217, 89, 89, + -32768,-32768,-32768,-32768,-32768, 694, 700, 217, 89, 89, + -32768,-32768,-32768,-32768, -70,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768, -42, 141, 141,-32768,-32768,-32768, + -32768,-32768,-32768,-32768, 265, 265, 265, 265, 265, 265, + 265,-32768,-32768, -1,-32768, 5, 265, -70, -70, 3, + 34, 51, 186, 39, -70, -70,-32768,-32768,-32768,-32768, + -32768, 54,-32768, 10,-32768,-32768,-32768, -12,-32768,-32768, + -70, -70,-32768, -35, 11,-32768,-32768, -31, 31,-32768, + -32768,-32768,-32768, 23, 605,-32768, 128, 137, -70, -70, + -32768,-32768, 68, 141, 58, -70, -70,-32768, -70,-32768, + -32768, -70, 8, 516, 28, 85, -70, -70,-32768,-32768, + 787,-32768, -70,-32768, 158, -70,-32768, 9,-32768, 605, + 156, 80,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 22,-32768,-32768,-32768,-32768, 359,-32768,-32768,-32768,-32768, + -32768,-32768,-32768, 748,-32768, -70, 115,-32768, 14,-32768, + -32768, 787,-32768, 529, 540,-32768, 123,-32768,-32768,-32768, + -32768, 124,-32768, -70, 30, 6,-32768,-32768, 265, 86, + 65, 96, 265, 265, 265, 265, 256,-32768, 549,-32768, + -32768, 138, 166, 178, 105,-32768, -70, 604,-32768,-32768, + -32768,-32768, 57,-32768, 265, 104,-32768, 100, -70,-32768, + -32768,-32768, 641,-32768,-32768,-32768,-32768, 107,-32768,-32768, + 170, 170, 170, 170, 170,-32768, 170, 170,-32768, 170, + -32768, 170, 170, 170, 170, 170,-32768, 170, 140, 170, + 170, 170, 140,-32768,-32768, 106, 108, 139,-32768,-32768, + 678, 146, 148, 131, 265, 134,-32768,-32768,-32768,-32768, + 265,-32768,-32768, 265,-32768, 265,-32768,-32768,-32768,-32768, + -32768, 265,-32768, 147, 150,-32768, 265, 153,-32768,-32768, + -32768, 265,-32768, 57,-32768, -70,-32768,-32768,-32768,-32768, + 159,-32768, 265, 265, 265, 265,-32768, -70, 265, 265, + -32768, 265,-32768, 265, 265, 265, 265, 265,-32768, 265, + -32768,-32768, 169,-32768, 265, 265, 265, -70,-32768, -70, + 346, 181,-32768,-32768,-32768,-32768, -70,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768, 265,-32768,-32768,-32768, + -70, -70, 181,-32768, -70, -70, 183, 18,-32768, -70, + 96, -70, -70, 265,-32768,-32768, -70, -70, 104, -70, + 19, 187, 228, 21, -70, -70,-32768,-32768, -70, 265, + -32768,-32768,-32768, -70, -70, -70, 96, 240, -70, 189, + 96, 240, -70, -70, 240, -70, 104,-32768, 240, 265, + 104,-32768, 240, 240, -70,-32768, 240,-32768, 190,-32768, + -32768, 240,-32768,-32768,-32768, 96, -59,-32768, 251,-32768 }; static const short yypgoto[] = { - -32768,-32768,-32768,-32768,-32768,-32768, -206,-32768,-32768,-32768, - -32768,-32768,-32768, 212, -85, -259,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768, -207,-32768,-32768,-32768, + -32768,-32768,-32768, 179, -218, -191,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 281, -8, - -212, -104,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768, 78,-32768, 113, 92,-32768, -204,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 145, 410, + 129, -151,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768, 50,-32768, 77, 48,-32768, -212,-32768,-32768,-32768, -140,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768, -21,-32768,-32768, 350, 139, 175, 475, - 416, -329, -257, -258, 29, -2, -1,-32768, -122,-32768 + -32768,-32768,-32768, -21,-32768, -39, 288, 7, 82, 424, + 343, -424, -284, -257, 29, -2, 12,-32768, 4,-32768 }; -#define YYLAST 717 +#define YYLAST 804 static const short yytable[] = { - 30, 161, 47, 147, 148, 282, 33, 34, 285, 164, - 197, 162, 246, 482, 283, 216, 59, 247, 302, 262, - 426, 426, 426, 168, 252, 236, 56, 57, 58, 224, - 225, 226, 227, 228, 229, 334, 146, 172, 176, 180, - 190, 198, 260, 261, 340, 266, 279, 95, 96, 97, - 98, 99, 100, 101, 102, 185, 2, 193, 281, 60, - 105, 106, 107, 108, 109, 110, 111, 112, 114, 115, - 116, 209, 3, 237, 238, 239, 240, 241, 242, 373, - 284, 173, 177, 174, 178, 165, 177, 5, 178, 26, - 173, 199, 174, 430, 4, 5, 27, 6, 7, 59, - 28, 341, 8, 133, 29, 202, 7, 59, 200, 59, - 8, 59, 59, 441, 446, 406, 35, 243, 251, 186, - 187, 460, 203, 36, 37, 38, 39, 467, 280, 304, - 204, 293, 154, 155, 156, 157, 158, 159, 160, 201, - 191, 163, 376, 144, 169, 5, 294, 205, 254, 336, - 480, 184, 40, 41, 208, 192, 7, 42, 43, 59, - 8, 134, 135, 136, 137, 138, 139, 140, 44, 45, - 278, 46, 177, 177, 178, 178, 170, 171, 292, 87, - 88, 293, 210, 188, 189, 451, 177, 454, 178, 220, - 457, 372, 4, 5, 293, 463, 294, 249, 221, 195, - 196, 250, 219, 414, 7, 26, 289, 305, 8, 294, - 370, 306, 27, 85, 86, 307, 28, 206, 207, 91, - 29, 336, 481, 442, 211, 212, 447, 213, 337, 342, - 215, 217, 343, 362, 141, 222, 223, 374, 371, 461, - 377, 234, 465, 378, 245, 468, 248, 69, 426, 291, - 471, 472, 440, 398, 474, 301, 402, 475, 403, 117, - 405, 477, 66, 67, 68, 408, 288, 290, 4, 5, - 297, 298, 299, 300, 70, 71, 72, 263, 415, 418, - 7, 4, 5, 129, 8, 433, 434, 70, 71, 72, - 449, 470, 335, 7, 286, 483, 478, 8, 126, 70, - 71, 72, 344, 73, 74, 75, 76, 77, 78, 79, - 421, 118, 119, 124, 256, 308, 73, 74, 75, 76, - 77, 78, 79, 70, 71, 72, 235, 338, 73, 74, - 75, 76, 77, 78, 79, 257, 26, 181, 0, 0, - 130, 0, 379, 27, 0, 0, 0, 28, 132, 0, - 0, 29, 73, 74, 75, 76, 77, 78, 79, 0, - 237, 238, 239, 240, 241, 242, 0, 404, 0, 73, - 74, 75, 76, 77, 78, 79, 26, 218, 0, 410, - 70, 71, 72, 27, 0, 82, 267, 28, 70, 71, - 72, 29, 89, 90, 0, 92, 411, 94, 0, 268, - 269, 270, 271, 407, 243, 0, 0, 0, 409, 73, - 74, 75, 76, 77, 78, 79, 425, 73, 74, 75, - 76, 77, 78, 79, 272, 0, 273, 274, 275, 276, - 0, 439, 0, 412, 0, 0, 413, 0, 0, 417, - 0, 419, 420, 0, 0, 423, 424, 459, 428, 0, - 429, 0, 431, 432, 366, 367, 5, 435, 436, 0, - 437, 438, 0, 0, 0, 444, 445, 7, 476, 0, - 0, 8, 452, 453, 455, 277, 0, 458, 0, 0, - 0, 462, 464, 303, 466, 0, 0, 469, 268, 269, - 270, 271, 0, 473, 26, 0, 268, 269, 270, 271, - 123, 27, 0, 127, 128, 28, 0, 131, 0, 29, - 142, 0, 0, 272, 309, 273, 274, 275, 276, 0, - 310, 272, 0, 273, 274, 275, 276, 0, 0, 0, - 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, - 331, 339, 332, 0, 0, 0, 0, 310, 120, 122, - 120, 120, 122, 122, 0, 0, 120, 311, 312, 313, - 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 325, 326, 327, 328, 329, 330, 331, 375, 332, - 0, 0, 0, 0, 310, 0, 48, 49, 50, 51, - 52, 53, 54, 55, 311, 312, 313, 314, 315, 316, + 30, 161, 47, 162, 246, 24, 282, 172, 334, 164, + 285, 216, 247, 498, 197, 254, 448, 262, 200, 33, + 34, 444, 444, 252, 444, 59, 336, 24, 224, 225, + 226, 227, 228, 229, 283, 261, 59, 278, 176, 56, + 57, 58, 476, 185, 266, 198, 480, 87, 88, 201, + 281, 173, 374, 174, 146, 180, 2, 104, 190, 60, + 95, 96, 97, 98, 99, 100, 101, 102, 114, 115, + 116, 496, 3, 105, 106, 107, 108, 109, 110, 111, + 112, 26, 177, 193, 178, 165, 302, 5, 27, 408, + 191, 199, 28, 341, 4, 5, 29, 6, 7, 220, + 284, 59, 8, 59, 59, 192, 7, 186, 187, 59, + 8, 202, 340, 59, 456, 35, 461, 251, 203, 260, + 85, 86, 36, 37, 38, 39, 91, 279, 280, 147, + 148, 204, 154, 155, 156, 157, 158, 159, 160, 293, + 205, 163, 304, 144, 169, 290, 4, 5, 208, 168, + 377, 40, 41, 210, 294, 221, 42, 43, 7, 249, + 250, 236, 8, 177, 184, 178, 289, 44, 45, 305, + 46, 173, 177, 174, 178, 292, 170, 171, 293, 66, + 67, 68, 306, 188, 189, 307, 177, 373, 178, 336, + 293, 4, 5, 294, 177, 337, 178, 209, 133, 195, + 196, 467, 342, 7, 372, 294, 471, 8, 474, 237, + 238, 239, 240, 241, 242, 219, 483, 206, 207, 375, + 363, 364, 5, 5, 211, 212, 379, 213, 378, 381, + 215, 217, 460, 7, 7, 222, 223, 8, 8, 497, + 124, 234, 400, 444, 245, 401, 248, 141, 403, 291, + 343, 499, 5, 243, 410, 301, 134, 135, 136, 137, + 138, 139, 140, 7, 426, 126, 288, 8, 26, 181, + 297, 298, 299, 300, 24, 27, 433, 263, 443, 28, + 24, 439, 459, 29, 479, 493, 256, 70, 71, 72, + 235, 257, 335, 371, 286, 0, 73, 74, 75, 76, + 77, 78, 79, 69, 452, 64, 65, 66, 67, 68, + 117, 0, 0, 0, 0, 308, 73, 74, 75, 76, + 77, 78, 79, 82, 118, 119, 129, 338, 0, 0, + 89, 90, 367, 92, 0, 94, 367, 4, 5, 0, + 0, 0, 380, 70, 71, 72, 0, 26, 130, 7, + 70, 71, 72, 8, 27, 0, 0, 0, 28, 0, + 0, 0, 29, 0, 402, 0, 70, 71, 72, 407, + 0, 0, 73, 74, 75, 76, 77, 78, 79, 73, + 74, 75, 76, 77, 78, 79, 0, 0, 70, 71, + 72, 0, 0, 0, 0, 73, 74, 75, 76, 77, + 78, 79, 0, 0, 409, 0, 0, 0, 104, 411, + 237, 238, 239, 240, 241, 242, 416, 73, 74, 75, + 76, 77, 78, 79, 436, 0, 432, 123, 26, 0, + 127, 128, 0, 0, 131, 27, 430, 142, 431, 28, + 0, 451, 0, 29, 0, 435, 0, 0, 132, 0, + 0, 0, 0, 0, 243, 0, 0, 469, 0, 437, + 438, 0, 0, 441, 442, 0, 446, 0, 447, 0, + 449, 450, 0, 0, 0, 453, 454, 488, 455, 0, + 0, 0, 0, 464, 465, 0, 0, 468, 70, 71, + 72, 0, 472, 473, 475, 0, 0, 478, 390, 0, + 392, 482, 484, 0, 486, 0, 398, 120, 122, 120, + 120, 122, 122, 491, 0, 120, 0, 73, 74, 75, + 76, 77, 78, 79, 0, 0, 0, 412, 413, 414, + 415, 0, 267, 417, 418, 0, 419, 0, 420, 421, + 422, 423, 424, 277, 425, 268, 269, 270, 271, 427, + 428, 429, 303, 0, 0, 0, 268, 269, 270, 271, + 0, 0, 0, 0, 0, 268, 269, 270, 271, 0, + 272, 0, 273, 274, 275, 276, 0, 0, 0, 457, + 0, 272, 462, 273, 274, 275, 276, 0, 0, 0, + 272, 0, 273, 274, 275, 276, 477, 0, 26, 218, + 481, 0, 0, 485, 0, 27, 0, 487, 309, 28, + 0, 489, 490, 29, 310, 492, 0, 0, 0, 0, + 494, 0, 0, 0, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 329, 330, 331, 0, 332, 382, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 397, 0, 399, 400, 401, 61, 62, 63, - 64, 65, 66, 67, 68, 64, 65, 66, 67, 68, - 81, 61, 62, 63, 64, 65, 66, 67, 68, 0, - 0, 0, 0, 0, 103, 73, 74, 75, 76, 77, - 78, 79, 0, 118, 119, 61, 62, 63, 64, 65, - 66, 67, 68, 62, 63, 64, 65, 66, 67, 68, - 63, 64, 65, 66, 67, 68, 224, 225, 226, 227, - 228, 229, 237, 238, 239, 240, 241, 242 + 327, 328, 329, 330, 331, 339, 332, 0, 0, 0, + 0, 310, 48, 49, 50, 51, 52, 53, 54, 55, + 0, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 376, 332, 0, 0, 0, 0, 310, 0, + 61, 62, 63, 64, 65, 66, 67, 68, 311, 312, + 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 328, 329, 330, 331, 0, + 332, 346, 347, 348, 349, 0, 351, 352, 0, 354, + 0, 356, 357, 358, 359, 360, 0, 362, 0, 368, + 369, 370, 61, 62, 63, 64, 65, 66, 67, 68, + 0, 0, 0, 0, 0, 81, 61, 62, 63, 64, + 65, 66, 67, 68, 0, 0, 0, 0, 0, 103, + 73, 74, 75, 76, 77, 78, 79, 0, 118, 119, + 62, 63, 64, 65, 66, 67, 68, 63, 64, 65, + 66, 67, 68, 224, 225, 226, 227, 228, 229, 237, + 238, 239, 240, 241, 242 }; static const short yycheck[] = { - 2, 141, 23, 125, 126, 263, 7, 8, 4, 4, - 49, 4, 216, 0, 4, 3, 95, 3, 277, 3, - 3, 3, 3, 145, 230, 3, 27, 28, 29, 6, - 7, 8, 9, 10, 11, 292, 96, 4, 4, 4, - 4, 80, 4, 247, 303, 251, 4, 48, 49, 50, - 51, 52, 53, 54, 55, 4, 43, 95, 262, 30, - 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, - 72, 193, 59, 51, 52, 53, 54, 55, 56, 336, - 70, 48, 48, 50, 50, 80, 48, 82, 50, 82, - 48, 80, 50, 422, 81, 82, 89, 84, 93, 95, - 93, 305, 97, 3, 97, 80, 93, 95, 49, 95, - 97, 95, 95, 95, 95, 372, 5, 95, 95, 68, - 69, 450, 95, 12, 13, 14, 15, 456, 4, 4, - 3, 82, 134, 135, 136, 137, 138, 139, 140, 80, - 80, 143, 4, 114, 146, 82, 97, 3, 233, 85, - 479, 152, 41, 42, 80, 95, 93, 46, 47, 95, - 97, 61, 62, 63, 64, 65, 66, 67, 57, 58, - 255, 60, 48, 48, 50, 50, 147, 148, 79, 40, - 41, 82, 95, 154, 155, 443, 48, 445, 50, 71, - 448, 79, 81, 82, 82, 453, 97, 3, 70, 170, - 171, 80, 203, 80, 93, 82, 80, 3, 97, 97, - 332, 4, 89, 38, 39, 80, 93, 188, 189, 44, - 97, 85, 480, 435, 195, 196, 438, 198, 95, 95, - 201, 202, 80, 80, 3, 206, 207, 80, 98, 451, - 80, 212, 454, 95, 215, 457, 217, 3, 3, 270, - 462, 463, 4, 95, 466, 276, 95, 469, 95, 3, - 95, 473, 90, 91, 92, 95, 268, 80, 81, 82, - 272, 273, 274, 275, 43, 44, 45, 248, 95, 95, - 93, 81, 82, 3, 97, 95, 426, 43, 44, 45, - 95, 95, 294, 93, 265, 0, 95, 97, 86, 43, - 44, 45, 310, 72, 73, 74, 75, 76, 77, 78, - 414, 80, 81, 16, 236, 286, 72, 73, 74, 75, - 76, 77, 78, 43, 44, 45, 213, 298, 72, 73, - 74, 75, 76, 77, 78, 243, 82, 83, -1, -1, - 3, -1, 344, 89, -1, -1, -1, 93, 3, -1, - -1, 97, 72, 73, 74, 75, 76, 77, 78, -1, - 51, 52, 53, 54, 55, 56, -1, 369, -1, 72, - 73, 74, 75, 76, 77, 78, 82, 83, -1, 381, - 43, 44, 45, 89, -1, 35, 3, 93, 43, 44, - 45, 97, 42, 43, -1, 45, 398, 47, -1, 16, - 17, 18, 19, 374, 95, -1, -1, -1, 379, 72, - 73, 74, 75, 76, 77, 78, 418, 72, 73, 74, - 75, 76, 77, 78, 41, -1, 43, 44, 45, 46, - -1, 433, -1, 404, -1, -1, 407, -1, -1, 410, - -1, 412, 413, -1, -1, 416, 417, 449, 419, -1, - 421, -1, 423, 424, 80, 81, 82, 428, 429, -1, - 431, 432, -1, -1, -1, 436, 437, 93, 470, -1, - -1, 97, 443, 444, 445, 3, -1, 448, -1, -1, - -1, 452, 453, 3, 455, -1, -1, 458, 16, 17, - 18, 19, -1, 464, 82, -1, 16, 17, 18, 19, - 84, 89, -1, 87, 88, 93, -1, 91, -1, 97, - 94, -1, -1, 41, 4, 43, 44, 45, 46, -1, - 10, 41, -1, 43, 44, 45, 46, -1, -1, -1, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 4, 42, -1, -1, -1, -1, 10, 83, 84, - 85, 86, 87, 88, -1, -1, 91, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 4, 42, - -1, -1, -1, -1, 10, -1, 85, 86, 87, 88, - 89, 90, 91, 92, 20, 21, 22, 23, 24, 25, + 2, 141, 23, 4, 216, 1, 263, 4, 292, 4, + 4, 3, 3, 0, 49, 233, 440, 3, 49, 7, + 8, 3, 3, 230, 3, 95, 85, 23, 6, 7, + 8, 9, 10, 11, 4, 247, 95, 255, 4, 27, + 28, 29, 466, 4, 251, 80, 470, 40, 41, 80, + 262, 48, 336, 50, 96, 4, 43, 59, 4, 30, + 48, 49, 50, 51, 52, 53, 54, 55, 70, 71, + 72, 495, 59, 61, 62, 63, 64, 65, 66, 67, + 68, 82, 48, 95, 50, 80, 277, 82, 89, 373, + 80, 80, 93, 305, 81, 82, 97, 84, 93, 71, + 70, 95, 97, 95, 95, 95, 93, 68, 69, 95, + 97, 80, 303, 95, 95, 5, 95, 95, 95, 4, + 38, 39, 12, 13, 14, 15, 44, 4, 4, 125, + 126, 3, 134, 135, 136, 137, 138, 139, 140, 82, + 3, 143, 4, 114, 146, 80, 81, 82, 80, 145, + 4, 41, 42, 95, 97, 70, 46, 47, 93, 3, + 80, 3, 97, 48, 152, 50, 80, 57, 58, 3, + 60, 48, 48, 50, 50, 79, 147, 148, 82, 90, + 91, 92, 4, 154, 155, 80, 48, 79, 50, 85, + 82, 81, 82, 97, 48, 95, 50, 193, 3, 170, + 171, 458, 95, 93, 98, 97, 463, 97, 465, 51, + 52, 53, 54, 55, 56, 203, 473, 188, 189, 80, + 80, 81, 82, 82, 195, 196, 95, 198, 80, 95, + 201, 202, 4, 93, 93, 206, 207, 97, 97, 496, + 16, 212, 95, 3, 215, 95, 217, 3, 95, 270, + 80, 0, 82, 95, 95, 276, 61, 62, 63, 64, + 65, 66, 67, 93, 95, 86, 268, 97, 82, 83, + 272, 273, 274, 275, 270, 89, 95, 248, 95, 93, + 276, 432, 95, 97, 95, 95, 236, 43, 44, 45, + 213, 243, 294, 332, 265, -1, 72, 73, 74, 75, + 76, 77, 78, 3, 444, 88, 89, 90, 91, 92, + 3, -1, -1, -1, -1, 286, 72, 73, 74, 75, + 76, 77, 78, 35, 80, 81, 3, 298, -1, -1, + 42, 43, 328, 45, -1, 47, 332, 81, 82, -1, + -1, -1, 344, 43, 44, 45, -1, 82, 3, 93, + 43, 44, 45, 97, 89, -1, -1, -1, 93, -1, + -1, -1, 97, -1, 366, -1, 43, 44, 45, 371, + -1, -1, 72, 73, 74, 75, 76, 77, 78, 72, + 73, 74, 75, 76, 77, 78, -1, -1, 43, 44, + 45, -1, -1, -1, -1, 72, 73, 74, 75, 76, + 77, 78, -1, -1, 375, -1, -1, -1, 410, 380, + 51, 52, 53, 54, 55, 56, 387, 72, 73, 74, + 75, 76, 77, 78, 426, -1, 80, 84, 82, -1, + 87, 88, -1, -1, 91, 89, 407, 94, 409, 93, + -1, 443, -1, 97, -1, 416, -1, -1, 3, -1, + -1, -1, -1, -1, 95, -1, -1, 459, -1, 430, + 431, -1, -1, 434, 435, -1, 437, -1, 439, -1, + 441, 442, -1, -1, -1, 446, 447, 479, 449, -1, + -1, -1, -1, 454, 455, -1, -1, 458, 43, 44, + 45, -1, 463, 464, 465, -1, -1, 468, 353, -1, + 355, 472, 473, -1, 475, -1, 361, 83, 84, 85, + 86, 87, 88, 484, -1, 91, -1, 72, 73, 74, + 75, 76, 77, 78, -1, -1, -1, 382, 383, 384, + 385, -1, 3, 388, 389, -1, 391, -1, 393, 394, + 395, 396, 397, 3, 399, 16, 17, 18, 19, 404, + 405, 406, 3, -1, -1, -1, 16, 17, 18, 19, + -1, -1, -1, -1, -1, 16, 17, 18, 19, -1, + 41, -1, 43, 44, 45, 46, -1, -1, -1, 450, + -1, 41, 453, 43, 44, 45, 46, -1, -1, -1, + 41, -1, 43, 44, 45, 46, 467, -1, 82, 83, + 471, -1, -1, 474, -1, 89, -1, 478, 4, 93, + -1, 482, 483, 97, 10, 486, -1, -1, -1, -1, + 491, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, -1, 42, 346, 347, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 361, -1, 363, 364, 365, 85, 86, 87, - 88, 89, 90, 91, 92, 88, 89, 90, 91, 92, - 98, 85, 86, 87, 88, 89, 90, 91, 92, -1, - -1, -1, -1, -1, 98, 72, 73, 74, 75, 76, - 77, 78, -1, 80, 81, 85, 86, 87, 88, 89, - 90, 91, 92, 86, 87, 88, 89, 90, 91, 92, - 87, 88, 89, 90, 91, 92, 6, 7, 8, 9, - 10, 11, 51, 52, 53, 54, 55, 56 + 36, 37, 38, 39, 40, 4, 42, -1, -1, -1, + -1, 10, 85, 86, 87, 88, 89, 90, 91, 92, + -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 4, 42, -1, -1, -1, -1, 10, -1, + 85, 86, 87, 88, 89, 90, 91, 92, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, -1, + 42, 311, 312, 313, 314, -1, 316, 317, -1, 319, + -1, 321, 322, 323, 324, 325, -1, 327, -1, 329, + 330, 331, 85, 86, 87, 88, 89, 90, 91, 92, + -1, -1, -1, -1, -1, 98, 85, 86, 87, 88, + 89, 90, 91, 92, -1, -1, -1, -1, -1, 98, + 72, 73, 74, 75, 76, 77, 78, -1, 80, 81, + 86, 87, 88, 89, 90, 91, 92, 87, 88, 89, + 90, 91, 92, 6, 7, 8, 9, 10, 11, 51, + 52, 53, 54, 55, 56 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/bison/bison.simple" +#line 3 "/usr/share/bison-1.35/bison.simple" /* Skeleton output parser for bison, @@ -1104,7 +1131,7 @@ yystpcpy (yydest, yysrc) # endif #endif -#line 315 "/usr/share/bison/bison.simple" +#line 315 "/usr/share/bison-1.35/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed @@ -1498,7 +1525,7 @@ yyreduce: switch (yyn) { case 17: -#line 177 "rcparse.y" +#line 182 "rcparse.y" { define_accelerator (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].pacc); if (yychar != YYEMPTY) @@ -1507,13 +1534,13 @@ case 17: } break; case 18: -#line 187 "rcparse.y" +#line 192 "rcparse.y" { yyval.pacc = NULL; } break; case 19: -#line 191 "rcparse.y" +#line 196 "rcparse.y" { struct accelerator *a; @@ -1533,25 +1560,25 @@ case 19: } break; case 20: -#line 212 "rcparse.y" +#line 217 "rcparse.y" { yyval.acc = yyvsp[-1].acc; yyval.acc.id = yyvsp[0].il; } break; case 21: -#line 217 "rcparse.y" +#line 222 "rcparse.y" { yyval.acc = yyvsp[-3].acc; yyval.acc.id = yyvsp[-2].il; yyval.acc.flags |= yyvsp[0].is; if ((yyval.acc.flags & ACC_VIRTKEY) == 0 - && (yyval.acc.flags & (ACC_SHIFT | ACC_CONTROL | ACC_ALT)) != 0) + && (yyval.acc.flags & (ACC_SHIFT | ACC_CONTROL)) != 0) rcparse_warning (_("inappropriate modifiers for non-VIRTKEY")); } break; case 22: -#line 229 "rcparse.y" +#line 234 "rcparse.y" { const char *s = yyvsp[0].s; char ch; @@ -1574,7 +1601,7 @@ case 22: } break; case 23: -#line 250 "rcparse.y" +#line 255 "rcparse.y" { yyval.acc.next = NULL; yyval.acc.flags = 0; @@ -1583,62 +1610,62 @@ case 23: } break; case 24: -#line 260 "rcparse.y" +#line 265 "rcparse.y" { yyval.is = yyvsp[0].is; } break; case 25: -#line 264 "rcparse.y" +#line 269 "rcparse.y" { yyval.is = yyvsp[-2].is | yyvsp[0].is; } break; case 26: -#line 269 "rcparse.y" +#line 274 "rcparse.y" { yyval.is = yyvsp[-1].is | yyvsp[0].is; } break; case 27: -#line 276 "rcparse.y" +#line 281 "rcparse.y" { yyval.is = ACC_VIRTKEY; } break; case 28: -#line 280 "rcparse.y" +#line 285 "rcparse.y" { /* This is just the absence of VIRTKEY. */ yyval.is = 0; } break; case 29: -#line 285 "rcparse.y" +#line 290 "rcparse.y" { yyval.is = ACC_NOINVERT; } break; case 30: -#line 289 "rcparse.y" +#line 294 "rcparse.y" { yyval.is = ACC_SHIFT; } break; case 31: -#line 293 "rcparse.y" +#line 298 "rcparse.y" { yyval.is = ACC_CONTROL; } break; case 32: -#line 297 "rcparse.y" +#line 302 "rcparse.y" { yyval.is = ACC_ALT; } break; case 33: -#line 306 "rcparse.y" +#line 311 "rcparse.y" { define_bitmap (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); if (yychar != YYEMPTY) @@ -1647,7 +1674,7 @@ case 33: } break; case 34: -#line 318 "rcparse.y" +#line 323 "rcparse.y" { define_cursor (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); if (yychar != YYEMPTY) @@ -1656,7 +1683,7 @@ case 34: } break; case 35: -#line 331 "rcparse.y" +#line 336 "rcparse.y" { memset (&dialog, 0, sizeof dialog); dialog.x = yyvsp[-3].il; @@ -1675,7 +1702,7 @@ case 35: } break; case 36: -#line 348 "rcparse.y" +#line 353 "rcparse.y" { define_dialog (yyvsp[-12].id, &sub_res_info, &dialog); if (yychar != YYEMPTY) @@ -1684,7 +1711,7 @@ case 36: } break; case 37: -#line 356 "rcparse.y" +#line 361 "rcparse.y" { memset (&dialog, 0, sizeof dialog); dialog.x = yyvsp[-3].il; @@ -1705,7 +1732,7 @@ case 37: } break; case 38: -#line 375 "rcparse.y" +#line 380 "rcparse.y" { define_dialog (yyvsp[-12].id, &sub_res_info, &dialog); if (yychar != YYEMPTY) @@ -1714,7 +1741,7 @@ case 38: } break; case 39: -#line 383 "rcparse.y" +#line 388 "rcparse.y" { memset (&dialog, 0, sizeof dialog); dialog.x = yyvsp[-4].il; @@ -1736,7 +1763,7 @@ case 39: } break; case 40: -#line 403 "rcparse.y" +#line 408 "rcparse.y" { define_dialog (yyvsp[-13].id, &sub_res_info, &dialog); if (yychar != YYEMPTY) @@ -1745,19 +1772,19 @@ case 40: } break; case 41: -#line 413 "rcparse.y" +#line 418 "rcparse.y" { yyval.il = 0; } break; case 42: -#line 417 "rcparse.y" +#line 422 "rcparse.y" { yyval.il = yyvsp[0].il; } break; case 44: -#line 425 "rcparse.y" +#line 430 "rcparse.y" { dialog.style |= WS_CAPTION; style |= WS_CAPTION; @@ -1765,31 +1792,31 @@ case 44: } break; case 45: -#line 431 "rcparse.y" +#line 436 "rcparse.y" { dialog.class = yyvsp[0].id; } break; case 46: -#line 436 "rcparse.y" +#line 441 "rcparse.y" { dialog.style = style; } break; case 47: -#line 440 "rcparse.y" +#line 445 "rcparse.y" { dialog.exstyle = yyvsp[0].il; } break; case 48: -#line 444 "rcparse.y" +#line 449 "rcparse.y" { res_string_to_id (& dialog.class, yyvsp[0].s); } break; case 49: -#line 448 "rcparse.y" +#line 453 "rcparse.y" { dialog.style |= DS_SETFONT; style |= DS_SETFONT; @@ -1804,7 +1831,7 @@ case 49: } break; case 50: -#line 461 "rcparse.y" +#line 466 "rcparse.y" { dialog.style |= DS_SETFONT; style |= DS_SETFONT; @@ -1821,7 +1848,7 @@ case 50: } break; case 51: -#line 476 "rcparse.y" +#line 481 "rcparse.y" { dialog.style |= DS_SETFONT; style |= DS_SETFONT; @@ -1838,7 +1865,7 @@ case 51: } break; case 52: -#line 491 "rcparse.y" +#line 496 "rcparse.y" { dialog.style |= DS_SETFONT; style |= DS_SETFONT; @@ -1855,31 +1882,31 @@ case 52: } break; case 53: -#line 506 "rcparse.y" +#line 511 "rcparse.y" { dialog.menu = yyvsp[0].id; } break; case 54: -#line 510 "rcparse.y" +#line 515 "rcparse.y" { sub_res_info.characteristics = yyvsp[0].il; } break; case 55: -#line 514 "rcparse.y" +#line 519 "rcparse.y" { sub_res_info.language = yyvsp[-1].il | (yyvsp[0].il << SUBLANG_SHIFT); } break; case 56: -#line 518 "rcparse.y" +#line 523 "rcparse.y" { sub_res_info.version = yyvsp[0].il; } break; case 58: -#line 526 "rcparse.y" +#line 531 "rcparse.y" { struct dialog_control **pp; @@ -1889,57 +1916,61 @@ case 58: } break; case 59: -#line 537 "rcparse.y" +#line 542 "rcparse.y" { default_style = BS_AUTO3STATE | WS_TABSTOP; base_style = BS_AUTO3STATE; class = CTL_BUTTON; + res_text_field = yyvsp[0].id; } break; case 60: -#line 543 "rcparse.y" +#line 549 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 61: -#line 547 "rcparse.y" +#line 553 "rcparse.y" { default_style = BS_AUTOCHECKBOX | WS_TABSTOP; base_style = BS_AUTOCHECKBOX; class = CTL_BUTTON; + res_text_field = yyvsp[0].id; } break; case 62: -#line 553 "rcparse.y" +#line 560 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 63: -#line 557 "rcparse.y" +#line 564 "rcparse.y" { default_style = BS_AUTORADIOBUTTON | WS_TABSTOP; base_style = BS_AUTORADIOBUTTON; class = CTL_BUTTON; + res_text_field = yyvsp[0].id; } break; case 64: -#line 563 "rcparse.y" +#line 571 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 65: -#line 567 "rcparse.y" +#line 575 "rcparse.y" { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; + res_text_field = yyvsp[0].id; } break; case 66: -#line 573 "rcparse.y" +#line 582 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; if (dialog.ex == NULL) @@ -1948,37 +1979,41 @@ case 66: } break; case 67: -#line 580 "rcparse.y" +#line 589 "rcparse.y" { default_style = BS_CHECKBOX | WS_TABSTOP; base_style = BS_CHECKBOX | WS_TABSTOP; class = CTL_BUTTON; + res_text_field = yyvsp[0].id; } break; case 68: -#line 586 "rcparse.y" +#line 596 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 69: -#line 590 "rcparse.y" +#line 600 "rcparse.y" { + /* This is as per MSDN documentation. With some (???) + versions of MS rc.exe their is no default style. */ default_style = CBS_SIMPLE | WS_TABSTOP; base_style = 0; class = CTL_COMBOBOX; + res_text_field = res_null_text; } break; case 70: -#line 596 "rcparse.y" +#line 609 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 71: -#line 601 "rcparse.y" +#line 614 "rcparse.y" { - yyval.dialog_control = define_control (yyvsp[-9].s, yyvsp[-8].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-7].il, style, yyvsp[-1].il); + yyval.dialog_control = define_control (yyvsp[-9].id, yyvsp[-8].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-7].il, style, yyvsp[-1].il); if (yyvsp[0].rcdata_item != NULL) { if (dialog.ex == NULL) @@ -1988,9 +2023,9 @@ case 71: } break; case 72: -#line 612 "rcparse.y" +#line 625 "rcparse.y" { - yyval.dialog_control = define_control (yyvsp[-10].s, yyvsp[-9].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-8].il, style, yyvsp[-2].il); + yyval.dialog_control = define_control (yyvsp[-10].id, yyvsp[-9].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-8].il, style, yyvsp[-2].il); if (dialog.ex == NULL) rcparse_warning (_("help ID requires DIALOGEX")); yyval.dialog_control->help = yyvsp[-1].il; @@ -1998,9 +2033,9 @@ case 72: } break; case 73: -#line 621 "rcparse.y" +#line 634 "rcparse.y" { - yyval.dialog_control = define_control (yyvsp[-10].s, yyvsp[-9].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, 0, style, yyvsp[-1].il); + yyval.dialog_control = define_control (yyvsp[-10].id, yyvsp[-9].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, 0, style, yyvsp[-1].il); if (yyvsp[0].rcdata_item != NULL) { if (dialog.ex == NULL) @@ -2012,9 +2047,9 @@ case 73: } break; case 74: -#line 634 "rcparse.y" +#line 647 "rcparse.y" { - yyval.dialog_control = define_control (yyvsp[-11].s, yyvsp[-10].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, 0, style, yyvsp[-2].il); + yyval.dialog_control = define_control (yyvsp[-11].id, yyvsp[-10].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, 0, style, yyvsp[-2].il); if (dialog.ex == NULL) rcparse_warning ("help ID requires DIALOGEX"); yyval.dialog_control->help = yyvsp[-1].il; @@ -2024,71 +2059,76 @@ case 74: } break; case 75: -#line 644 "rcparse.y" +#line 657 "rcparse.y" { default_style = SS_CENTER | WS_GROUP; base_style = SS_CENTER; class = CTL_STATIC; + res_text_field = yyvsp[0].id; } break; case 76: -#line 650 "rcparse.y" +#line 664 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 77: -#line 654 "rcparse.y" +#line 668 "rcparse.y" { default_style = BS_DEFPUSHBUTTON | WS_TABSTOP; base_style = BS_DEFPUSHBUTTON | WS_TABSTOP; class = CTL_BUTTON; + res_text_field = yyvsp[0].id; } break; case 78: -#line 660 "rcparse.y" +#line 675 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 79: -#line 664 "rcparse.y" +#line 679 "rcparse.y" { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; + res_text_field = res_null_text; } break; case 80: -#line 670 "rcparse.y" +#line 686 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 81: -#line 674 "rcparse.y" +#line 690 "rcparse.y" { default_style = BS_GROUPBOX; base_style = BS_GROUPBOX; class = CTL_BUTTON; + res_text_field = yyvsp[0].id; } break; case 82: -#line 680 "rcparse.y" +#line 697 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 83: -#line 684 "rcparse.y" +#line 701 "rcparse.y" { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; + res_text_field = yyvsp[0].id; } break; case 84: -#line 690 "rcparse.y" +#line 708 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; if (dialog.ex == NULL) @@ -2097,43 +2137,44 @@ case 84: } break; case 85: -#line 697 "rcparse.y" +#line 715 "rcparse.y" { yyval.dialog_control = define_icon_control (yyvsp[-4].id, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-1].il, 0, 0, 0, yyvsp[0].rcdata_item, dialog.ex); } break; case 86: -#line 703 "rcparse.y" +#line 721 "rcparse.y" { yyval.dialog_control = define_icon_control (yyvsp[-6].id, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, 0, 0, 0, yyvsp[0].rcdata_item, dialog.ex); } break; case 87: -#line 709 "rcparse.y" +#line 727 "rcparse.y" { yyval.dialog_control = define_icon_control (yyvsp[-8].id, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, style, yyvsp[-1].il, 0, yyvsp[0].rcdata_item, dialog.ex); } break; case 88: -#line 715 "rcparse.y" +#line 733 "rcparse.y" { yyval.dialog_control = define_icon_control (yyvsp[-9].id, yyvsp[-8].il, yyvsp[-7].il, yyvsp[-6].il, style, yyvsp[-2].il, yyvsp[-1].il, yyvsp[0].rcdata_item, dialog.ex); } break; case 89: -#line 720 "rcparse.y" +#line 738 "rcparse.y" { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; + res_text_field = yyvsp[0].id; } break; case 90: -#line 726 "rcparse.y" +#line 745 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; if (dialog.ex == NULL) @@ -2142,35 +2183,37 @@ case 90: } break; case 91: -#line 733 "rcparse.y" +#line 752 "rcparse.y" { default_style = LBS_NOTIFY | WS_BORDER; base_style = LBS_NOTIFY | WS_BORDER; class = CTL_LISTBOX; + res_text_field = res_null_text; } break; case 92: -#line 739 "rcparse.y" +#line 759 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 93: -#line 743 "rcparse.y" +#line 763 "rcparse.y" { default_style = SS_LEFT | WS_GROUP; base_style = SS_LEFT; class = CTL_STATIC; + res_text_field = yyvsp[0].id; } break; case 94: -#line 749 "rcparse.y" +#line 770 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 95: -#line 753 "rcparse.y" +#line 774 "rcparse.y" { default_style = BS_PUSHBOX | WS_TABSTOP; base_style = BS_PUSHBOX; @@ -2178,96 +2221,101 @@ case 95: } break; case 96: -#line 759 "rcparse.y" +#line 780 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 97: -#line 763 "rcparse.y" +#line 784 "rcparse.y" { default_style = BS_PUSHBUTTON | WS_TABSTOP; base_style = BS_PUSHBUTTON | WS_TABSTOP; class = CTL_BUTTON; + res_text_field = yyvsp[0].id; } break; case 98: -#line 769 "rcparse.y" +#line 791 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 99: -#line 773 "rcparse.y" +#line 795 "rcparse.y" { default_style = BS_RADIOBUTTON | WS_TABSTOP; base_style = BS_RADIOBUTTON; class = CTL_BUTTON; + res_text_field = yyvsp[0].id; } break; case 100: -#line 779 "rcparse.y" +#line 802 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 101: -#line 783 "rcparse.y" +#line 806 "rcparse.y" { default_style = SS_RIGHT | WS_GROUP; base_style = SS_RIGHT; class = CTL_STATIC; + res_text_field = yyvsp[0].id; } break; case 102: -#line 789 "rcparse.y" +#line 813 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 103: -#line 793 "rcparse.y" +#line 817 "rcparse.y" { default_style = SBS_HORZ; base_style = 0; class = CTL_SCROLLBAR; + res_text_field = res_null_text; } break; case 104: -#line 799 "rcparse.y" +#line 824 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 105: -#line 803 "rcparse.y" +#line 828 "rcparse.y" { default_style = BS_3STATE | WS_TABSTOP; base_style = BS_3STATE; class = CTL_BUTTON; + res_text_field = yyvsp[0].id; } break; case 106: -#line 809 "rcparse.y" +#line 835 "rcparse.y" { yyval.dialog_control = yyvsp[0].dialog_control; } break; case 107: -#line 814 "rcparse.y" +#line 840 "rcparse.y" { style = WS_CHILD | WS_VISIBLE; } break; case 108: -#line 816 "rcparse.y" +#line 842 "rcparse.y" { - yyval.dialog_control = define_control (yyvsp[-14].s, yyvsp[-12].il, yyvsp[-10].il, yyvsp[-8].il, yyvsp[-6].il, yyvsp[-4].il, CTL_BUTTON, + yyval.dialog_control = define_control (yyvsp[-13].id, yyvsp[-12].il, yyvsp[-10].il, yyvsp[-8].il, yyvsp[-6].il, yyvsp[-4].il, CTL_BUTTON, style, yyvsp[0].il); } break; case 109: -#line 832 "rcparse.y" +#line 857 "rcparse.y" { - yyval.dialog_control = define_control (yyvsp[-6].s, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-1].il, class, + yyval.dialog_control = define_control (res_text_field, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-2].il, yyvsp[-1].il, class, default_style | WS_CHILD | WS_VISIBLE, 0); if (yyvsp[0].rcdata_item != NULL) { @@ -2278,9 +2326,9 @@ case 109: } break; case 110: -#line 844 "rcparse.y" +#line 869 "rcparse.y" { - yyval.dialog_control = define_control (yyvsp[-8].s, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, class, style, yyvsp[-1].il); + yyval.dialog_control = define_control (res_text_field, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, class, style, yyvsp[-1].il); if (yyvsp[0].rcdata_item != NULL) { if (dialog.ex == NULL) @@ -2290,9 +2338,9 @@ case 110: } break; case 111: -#line 855 "rcparse.y" +#line 880 "rcparse.y" { - yyval.dialog_control = define_control (yyvsp[-9].s, yyvsp[-8].il, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, class, style, yyvsp[-2].il); + yyval.dialog_control = define_control (res_text_field, yyvsp[-8].il, yyvsp[-7].il, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, class, style, yyvsp[-2].il); if (dialog.ex == NULL) rcparse_warning (_("help ID requires DIALOGEX")); yyval.dialog_control->help = yyvsp[-1].il; @@ -2300,49 +2348,56 @@ case 111: } break; case 112: -#line 866 "rcparse.y" +#line 891 "rcparse.y" { - yyval.s = NULL; + res_string_to_id (&yyval.id, ""); } break; case 113: -#line 870 "rcparse.y" +#line 895 "rcparse.y" { - yyval.s = yyvsp[0].s; + yyval.id.named = 0; + yyval.id.u.id = yyvsp[-1].il; } break; case 114: -#line 874 "rcparse.y" +#line 900 "rcparse.y" { - yyval.s = yyvsp[-1].s; + res_string_to_id (&yyval.id, yyvsp[0].s); } break; case 115: -#line 881 "rcparse.y" +#line 904 "rcparse.y" { - yyval.rcdata_item = NULL; + res_string_to_id (&yyval.id, yyvsp[-1].s); } break; case 116: -#line 885 "rcparse.y" +#line 911 "rcparse.y" { - yyval.rcdata_item = yyvsp[-1].rcdata.first; + yyval.rcdata_item = NULL; } break; case 117: -#line 894 "rcparse.y" +#line 915 "rcparse.y" +{ + yyval.rcdata_item = yyvsp[-1].rcdata.first; + } + break; +case 118: +#line 924 "rcparse.y" { style = WS_CHILD | WS_VISIBLE; } break; -case 119: -#line 900 "rcparse.y" +case 120: +#line 930 "rcparse.y" { style = SS_ICON | WS_CHILD | WS_VISIBLE; } break; -case 121: -#line 906 "rcparse.y" +case 122: +#line 936 "rcparse.y" { style = base_style | WS_CHILD | WS_VISIBLE; } break; -case 123: -#line 914 "rcparse.y" +case 124: +#line 944 "rcparse.y" { define_font (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); if (yychar != YYEMPTY) @@ -2350,8 +2405,8 @@ case 123: rcparse_discard_strings (); } break; -case 124: -#line 926 "rcparse.y" +case 125: +#line 956 "rcparse.y" { define_icon (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); if (yychar != YYEMPTY) @@ -2359,14 +2414,14 @@ case 124: rcparse_discard_strings (); } break; -case 125: -#line 939 "rcparse.y" +case 126: +#line 969 "rcparse.y" { language = yyvsp[-1].il | (yyvsp[0].il << SUBLANG_SHIFT); } break; -case 126: -#line 948 "rcparse.y" +case 127: +#line 978 "rcparse.y" { define_menu (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].menuitem); if (yychar != YYEMPTY) @@ -2374,14 +2429,14 @@ case 126: rcparse_discard_strings (); } break; -case 127: -#line 958 "rcparse.y" +case 128: +#line 988 "rcparse.y" { yyval.menuitem = NULL; } break; -case 128: -#line 962 "rcparse.y" +case 129: +#line 992 "rcparse.y" { if (yyvsp[-1].menuitem == NULL) yyval.menuitem = yyvsp[0].menuitem; @@ -2396,80 +2451,80 @@ case 128: } } break; -case 129: -#line 979 "rcparse.y" +case 130: +#line 1009 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-2].s, yyvsp[-1].il, yyvsp[0].is, 0, 0, NULL); } break; -case 130: -#line 983 "rcparse.y" +case 131: +#line 1013 "rcparse.y" { yyval.menuitem = define_menuitem (NULL, 0, 0, 0, 0, NULL); } break; -case 131: -#line 987 "rcparse.y" +case 132: +#line 1017 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-4].s, 0, yyvsp[-3].is, 0, 0, yyvsp[-1].menuitem); } break; -case 132: -#line 994 "rcparse.y" +case 133: +#line 1024 "rcparse.y" { yyval.is = 0; } break; -case 133: -#line 998 "rcparse.y" +case 134: +#line 1028 "rcparse.y" { yyval.is = yyvsp[-2].is | yyvsp[0].is; } break; -case 134: -#line 1002 "rcparse.y" +case 135: +#line 1032 "rcparse.y" { yyval.is = yyvsp[-1].is | yyvsp[0].is; } break; -case 135: -#line 1009 "rcparse.y" +case 136: +#line 1039 "rcparse.y" { yyval.is = MENUITEM_CHECKED; } break; -case 136: -#line 1013 "rcparse.y" +case 137: +#line 1043 "rcparse.y" { yyval.is = MENUITEM_GRAYED; } break; -case 137: -#line 1017 "rcparse.y" +case 138: +#line 1047 "rcparse.y" { yyval.is = MENUITEM_HELP; } break; -case 138: -#line 1021 "rcparse.y" +case 139: +#line 1051 "rcparse.y" { yyval.is = MENUITEM_INACTIVE; } break; -case 139: -#line 1025 "rcparse.y" +case 140: +#line 1055 "rcparse.y" { yyval.is = MENUITEM_MENUBARBREAK; } break; -case 140: -#line 1029 "rcparse.y" +case 141: +#line 1059 "rcparse.y" { yyval.is = MENUITEM_MENUBREAK; } break; -case 141: -#line 1038 "rcparse.y" +case 142: +#line 1068 "rcparse.y" { define_menu (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].menuitem); if (yychar != YYEMPTY) @@ -2477,14 +2532,14 @@ case 141: rcparse_discard_strings (); } break; -case 142: -#line 1048 "rcparse.y" +case 143: +#line 1078 "rcparse.y" { yyval.menuitem = NULL; } break; -case 143: -#line 1052 "rcparse.y" +case 144: +#line 1082 "rcparse.y" { if (yyvsp[-1].menuitem == NULL) yyval.menuitem = yyvsp[0].menuitem; @@ -2499,56 +2554,56 @@ case 143: } } break; -case 144: -#line 1069 "rcparse.y" +case 145: +#line 1099 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[0].s, 0, 0, 0, 0, NULL); } break; -case 145: -#line 1073 "rcparse.y" +case 146: +#line 1103 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-1].s, yyvsp[0].il, 0, 0, 0, NULL); } break; -case 146: -#line 1077 "rcparse.y" +case 147: +#line 1107 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-3].s, yyvsp[-2].il, yyvsp[-1].il, yyvsp[0].il, 0, NULL); } break; -case 147: -#line 1081 "rcparse.y" +case 148: +#line 1111 "rcparse.y" { yyval.menuitem = define_menuitem (NULL, 0, 0, 0, 0, NULL); } break; -case 148: -#line 1085 "rcparse.y" +case 149: +#line 1115 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-3].s, 0, 0, 0, 0, yyvsp[-1].menuitem); } break; -case 149: -#line 1089 "rcparse.y" +case 150: +#line 1119 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-4].s, yyvsp[-3].il, 0, 0, 0, yyvsp[-1].menuitem); } break; -case 150: -#line 1093 "rcparse.y" +case 151: +#line 1123 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-5].s, yyvsp[-4].il, yyvsp[-3].il, 0, 0, yyvsp[-1].menuitem); } break; -case 151: -#line 1098 "rcparse.y" +case 152: +#line 1128 "rcparse.y" { yyval.menuitem = define_menuitem (yyvsp[-7].s, yyvsp[-6].il, yyvsp[-5].il, yyvsp[-4].il, yyvsp[-3].il, yyvsp[-1].menuitem); } break; -case 152: -#line 1107 "rcparse.y" +case 153: +#line 1137 "rcparse.y" { define_messagetable (yyvsp[-3].id, &yyvsp[-1].res_info, yyvsp[0].s); if (yychar != YYEMPTY) @@ -2556,8 +2611,8 @@ case 152: rcparse_discard_strings (); } break; -case 153: -#line 1119 "rcparse.y" +case 154: +#line 1149 "rcparse.y" { define_rcdata (yyvsp[-5].id, &yyvsp[-3].res_info, yyvsp[-1].rcdata.first); if (yychar != YYEMPTY) @@ -2565,34 +2620,34 @@ case 153: rcparse_discard_strings (); } break; -case 154: -#line 1131 "rcparse.y" +case 155: +#line 1161 "rcparse.y" { rcparse_rcdata (); } break; -case 155: -#line 1135 "rcparse.y" +case 156: +#line 1165 "rcparse.y" { rcparse_normal (); yyval.rcdata = yyvsp[0].rcdata; } break; -case 156: -#line 1143 "rcparse.y" +case 157: +#line 1173 "rcparse.y" { yyval.rcdata.first = NULL; yyval.rcdata.last = NULL; } break; -case 157: -#line 1148 "rcparse.y" +case 158: +#line 1178 "rcparse.y" { yyval.rcdata = yyvsp[0].rcdata; } break; -case 158: -#line 1155 "rcparse.y" +case 159: +#line 1185 "rcparse.y" { struct rcdata_item *ri; @@ -2601,8 +2656,8 @@ case 158: yyval.rcdata.last = ri; } break; -case 159: -#line 1163 "rcparse.y" +case 160: +#line 1193 "rcparse.y" { struct rcdata_item *ri; @@ -2611,8 +2666,8 @@ case 159: yyval.rcdata.last = ri; } break; -case 160: -#line 1171 "rcparse.y" +case 161: +#line 1201 "rcparse.y" { struct rcdata_item *ri; @@ -2622,8 +2677,8 @@ case 160: yyval.rcdata.last = ri; } break; -case 161: -#line 1180 "rcparse.y" +case 162: +#line 1210 "rcparse.y" { struct rcdata_item *ri; @@ -2633,12 +2688,12 @@ case 161: yyval.rcdata.last = ri; } break; -case 162: -#line 1194 "rcparse.y" +case 163: +#line 1224 "rcparse.y" { sub_res_info = yyvsp[-1].res_info; } break; -case 165: -#line 1201 "rcparse.y" +case 166: +#line 1231 "rcparse.y" { define_stringtable (&sub_res_info, yyvsp[-1].il, yyvsp[0].s); if (yychar != YYEMPTY) @@ -2646,8 +2701,8 @@ case 165: rcparse_discard_strings (); } break; -case 166: -#line 1208 "rcparse.y" +case 167: +#line 1238 "rcparse.y" { define_stringtable (&sub_res_info, yyvsp[-2].il, yyvsp[0].s); if (yychar != YYEMPTY) @@ -2655,8 +2710,8 @@ case 166: rcparse_discard_strings (); } break; -case 167: -#line 1221 "rcparse.y" +case 168: +#line 1251 "rcparse.y" { define_user_data (yyvsp[-5].id, yyvsp[-4].id, &yyvsp[-3].res_info, yyvsp[-1].rcdata.first); if (yychar != YYEMPTY) @@ -2664,8 +2719,8 @@ case 167: rcparse_discard_strings (); } break; -case 168: -#line 1228 "rcparse.y" +case 169: +#line 1258 "rcparse.y" { define_user_file (yyvsp[-3].id, yyvsp[-2].id, &yyvsp[-1].res_info, yyvsp[0].s); if (yychar != YYEMPTY) @@ -2673,8 +2728,8 @@ case 168: rcparse_discard_strings (); } break; -case 169: -#line 1240 "rcparse.y" +case 170: +#line 1270 "rcparse.y" { define_versioninfo (yyvsp[-5].id, language, yyvsp[-3].fixver, yyvsp[-1].verinfo); if (yychar != YYEMPTY) @@ -2682,116 +2737,116 @@ case 169: rcparse_discard_strings (); } break; -case 170: -#line 1250 "rcparse.y" +case 171: +#line 1280 "rcparse.y" { yyval.fixver = ((struct fixed_versioninfo *) res_alloc (sizeof (struct fixed_versioninfo))); memset (yyval.fixver, 0, sizeof (struct fixed_versioninfo)); } break; -case 171: -#line 1256 "rcparse.y" +case 172: +#line 1286 "rcparse.y" { yyvsp[-5].fixver->file_version_ms = (yyvsp[-3].il << 16) | yyvsp[-2].il; yyvsp[-5].fixver->file_version_ls = (yyvsp[-1].il << 16) | yyvsp[0].il; yyval.fixver = yyvsp[-5].fixver; } break; -case 172: -#line 1262 "rcparse.y" +case 173: +#line 1292 "rcparse.y" { yyvsp[-5].fixver->product_version_ms = (yyvsp[-3].il << 16) | yyvsp[-2].il; yyvsp[-5].fixver->product_version_ls = (yyvsp[-1].il << 16) | yyvsp[0].il; yyval.fixver = yyvsp[-5].fixver; } break; -case 173: -#line 1268 "rcparse.y" +case 174: +#line 1298 "rcparse.y" { yyvsp[-2].fixver->file_flags_mask = yyvsp[0].il; yyval.fixver = yyvsp[-2].fixver; } break; -case 174: -#line 1273 "rcparse.y" +case 175: +#line 1303 "rcparse.y" { yyvsp[-2].fixver->file_flags = yyvsp[0].il; yyval.fixver = yyvsp[-2].fixver; } break; -case 175: -#line 1278 "rcparse.y" +case 176: +#line 1308 "rcparse.y" { yyvsp[-2].fixver->file_os = yyvsp[0].il; yyval.fixver = yyvsp[-2].fixver; } break; -case 176: -#line 1283 "rcparse.y" +case 177: +#line 1313 "rcparse.y" { yyvsp[-2].fixver->file_type = yyvsp[0].il; yyval.fixver = yyvsp[-2].fixver; } break; -case 177: -#line 1288 "rcparse.y" +case 178: +#line 1318 "rcparse.y" { yyvsp[-2].fixver->file_subtype = yyvsp[0].il; yyval.fixver = yyvsp[-2].fixver; } break; -case 178: -#line 1302 "rcparse.y" +case 179: +#line 1332 "rcparse.y" { yyval.verinfo = NULL; } break; -case 179: -#line 1306 "rcparse.y" +case 180: +#line 1336 "rcparse.y" { yyval.verinfo = append_ver_stringfileinfo (yyvsp[-7].verinfo, yyvsp[-4].s, yyvsp[-2].verstring); } break; -case 180: -#line 1310 "rcparse.y" +case 181: +#line 1340 "rcparse.y" { yyval.verinfo = append_ver_varfileinfo (yyvsp[-6].verinfo, yyvsp[-2].s, yyvsp[-1].vervar); } break; -case 181: -#line 1317 "rcparse.y" +case 182: +#line 1347 "rcparse.y" { yyval.verstring = NULL; } break; -case 182: -#line 1321 "rcparse.y" +case 183: +#line 1351 "rcparse.y" { yyval.verstring = append_verval (yyvsp[-4].verstring, yyvsp[-2].s, yyvsp[0].s); } break; -case 183: -#line 1328 "rcparse.y" +case 184: +#line 1358 "rcparse.y" { yyval.vervar = NULL; } break; -case 184: -#line 1332 "rcparse.y" +case 185: +#line 1362 "rcparse.y" { yyval.vervar = append_vertrans (yyvsp[-2].vervar, yyvsp[-1].il, yyvsp[0].il); } break; -case 185: -#line 1341 "rcparse.y" +case 186: +#line 1371 "rcparse.y" { yyval.id.named = 0; yyval.id.u.id = yyvsp[0].il; } break; -case 186: -#line 1346 "rcparse.y" +case 187: +#line 1376 "rcparse.y" { char *copy, *s; @@ -2803,33 +2858,33 @@ case 186: free (copy); } break; -case 187: -#line 1362 "rcparse.y" +case 188: +#line 1392 "rcparse.y" { yyval.s = yyvsp[0].s; } break; -case 188: -#line 1366 "rcparse.y" +case 189: +#line 1396 "rcparse.y" { yyval.s = yyvsp[-1].s; } break; -case 189: -#line 1370 "rcparse.y" +case 190: +#line 1400 "rcparse.y" { yyval.s = yyvsp[-1].s; } break; -case 190: -#line 1378 "rcparse.y" +case 191: +#line 1408 "rcparse.y" { yyval.id.named = 0; yyval.id.u.id = yyvsp[-1].il; } break; -case 191: -#line 1383 "rcparse.y" +case 192: +#line 1413 "rcparse.y" { char *copy, *s; @@ -2841,8 +2896,8 @@ case 191: free (copy); } break; -case 192: -#line 1400 "rcparse.y" +case 193: +#line 1430 "rcparse.y" { memset (&yyval.res_info, 0, sizeof (struct res_res_info)); yyval.res_info.language = language; @@ -2850,352 +2905,352 @@ case 192: yyval.res_info.memflags = MEMFLAG_MOVEABLE | MEMFLAG_PURE | MEMFLAG_DISCARDABLE; } break; -case 193: -#line 1407 "rcparse.y" +case 194: +#line 1437 "rcparse.y" { yyval.res_info = yyvsp[-1].res_info; yyval.res_info.memflags |= yyvsp[0].memflags.on; yyval.res_info.memflags &=~ yyvsp[0].memflags.off; } break; -case 194: -#line 1413 "rcparse.y" +case 195: +#line 1443 "rcparse.y" { yyval.res_info = yyvsp[-2].res_info; yyval.res_info.characteristics = yyvsp[0].il; } break; -case 195: -#line 1418 "rcparse.y" +case 196: +#line 1448 "rcparse.y" { yyval.res_info = yyvsp[-3].res_info; yyval.res_info.language = yyvsp[-1].il | (yyvsp[0].il << SUBLANG_SHIFT); } break; -case 196: -#line 1423 "rcparse.y" +case 197: +#line 1453 "rcparse.y" { yyval.res_info = yyvsp[-2].res_info; yyval.res_info.version = yyvsp[0].il; } break; -case 197: -#line 1433 "rcparse.y" +case 198: +#line 1463 "rcparse.y" { memset (&yyval.res_info, 0, sizeof (struct res_res_info)); yyval.res_info.language = language; yyval.res_info.memflags = MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE; } break; -case 198: -#line 1439 "rcparse.y" +case 199: +#line 1469 "rcparse.y" { yyval.res_info = yyvsp[-1].res_info; yyval.res_info.memflags |= yyvsp[0].memflags.on; yyval.res_info.memflags &=~ yyvsp[0].memflags.off; } break; -case 199: -#line 1450 "rcparse.y" +case 200: +#line 1480 "rcparse.y" { memset (&yyval.res_info, 0, sizeof (struct res_res_info)); yyval.res_info.language = language; yyval.res_info.memflags = MEMFLAG_MOVEABLE | MEMFLAG_PURE | MEMFLAG_DISCARDABLE; } break; -case 200: -#line 1456 "rcparse.y" +case 201: +#line 1486 "rcparse.y" { yyval.res_info = yyvsp[-1].res_info; yyval.res_info.memflags |= yyvsp[0].memflags.on; yyval.res_info.memflags &=~ yyvsp[0].memflags.off; } break; -case 201: -#line 1468 "rcparse.y" +case 202: +#line 1498 "rcparse.y" { yyval.memflags.on = MEMFLAG_MOVEABLE; yyval.memflags.off = 0; } break; -case 202: -#line 1473 "rcparse.y" +case 203: +#line 1503 "rcparse.y" { yyval.memflags.on = 0; yyval.memflags.off = MEMFLAG_MOVEABLE; } break; -case 203: -#line 1478 "rcparse.y" +case 204: +#line 1508 "rcparse.y" { yyval.memflags.on = MEMFLAG_PURE; yyval.memflags.off = 0; } break; -case 204: -#line 1483 "rcparse.y" +case 205: +#line 1513 "rcparse.y" { yyval.memflags.on = 0; yyval.memflags.off = MEMFLAG_PURE; } break; -case 205: -#line 1488 "rcparse.y" +case 206: +#line 1518 "rcparse.y" { yyval.memflags.on = MEMFLAG_PRELOAD; yyval.memflags.off = 0; } break; -case 206: -#line 1493 "rcparse.y" +case 207: +#line 1523 "rcparse.y" { yyval.memflags.on = 0; yyval.memflags.off = MEMFLAG_PRELOAD; } break; -case 207: -#line 1498 "rcparse.y" +case 208: +#line 1528 "rcparse.y" { yyval.memflags.on = MEMFLAG_DISCARDABLE; yyval.memflags.off = 0; } break; -case 208: -#line 1508 "rcparse.y" +case 209: +#line 1538 "rcparse.y" { yyval.s = yyvsp[0].s; } break; -case 209: -#line 1512 "rcparse.y" +case 210: +#line 1542 "rcparse.y" { yyval.s = yyvsp[0].s; } break; -case 210: -#line 1529 "rcparse.y" +case 211: +#line 1559 "rcparse.y" { style |= yyvsp[0].il; } break; -case 211: -#line 1533 "rcparse.y" +case 212: +#line 1563 "rcparse.y" { style &=~ yyvsp[0].il; } break; -case 212: -#line 1537 "rcparse.y" +case 213: +#line 1567 "rcparse.y" { style |= yyvsp[0].il; } break; -case 213: -#line 1541 "rcparse.y" +case 214: +#line 1571 "rcparse.y" { style &=~ yyvsp[0].il; } break; -case 214: -#line 1548 "rcparse.y" +case 215: +#line 1578 "rcparse.y" { yyval.il = yyvsp[0].i.val; } break; -case 215: -#line 1552 "rcparse.y" +case 216: +#line 1582 "rcparse.y" { yyval.il = yyvsp[-1].il; } break; -case 216: -#line 1561 "rcparse.y" +case 217: +#line 1591 "rcparse.y" { yyval.il = 0; } break; -case 217: -#line 1565 "rcparse.y" +case 218: +#line 1595 "rcparse.y" { yyval.il = yyvsp[0].il; } break; -case 218: -#line 1574 "rcparse.y" +case 219: +#line 1604 "rcparse.y" { yyval.il = yyvsp[0].il; } break; -case 219: -#line 1583 "rcparse.y" +case 220: +#line 1613 "rcparse.y" { yyval.il = yyvsp[0].i.val; } break; -case 220: -#line 1592 "rcparse.y" +case 221: +#line 1622 "rcparse.y" { yyval.i = yyvsp[0].i; } break; -case 221: -#line 1596 "rcparse.y" +case 222: +#line 1626 "rcparse.y" { yyval.i = yyvsp[-1].i; } break; -case 222: -#line 1600 "rcparse.y" +case 223: +#line 1630 "rcparse.y" { yyval.i.val = ~ yyvsp[0].i.val; yyval.i.dword = yyvsp[0].i.dword; } break; -case 223: -#line 1605 "rcparse.y" +case 224: +#line 1635 "rcparse.y" { yyval.i.val = - yyvsp[0].i.val; yyval.i.dword = yyvsp[0].i.dword; } break; -case 224: -#line 1610 "rcparse.y" +case 225: +#line 1640 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val * yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 225: -#line 1615 "rcparse.y" +case 226: +#line 1645 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val / yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 226: -#line 1620 "rcparse.y" +case 227: +#line 1650 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val % yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 227: -#line 1625 "rcparse.y" +case 228: +#line 1655 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val + yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 228: -#line 1630 "rcparse.y" +case 229: +#line 1660 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val - yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 229: -#line 1635 "rcparse.y" +case 230: +#line 1665 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val & yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 230: -#line 1640 "rcparse.y" +case 231: +#line 1670 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val ^ yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 231: -#line 1645 "rcparse.y" +case 232: +#line 1675 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val | yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 232: -#line 1656 "rcparse.y" +case 233: +#line 1686 "rcparse.y" { yyval.il = yyvsp[0].il; } break; -case 233: -#line 1665 "rcparse.y" +case 234: +#line 1695 "rcparse.y" { yyval.il = yyvsp[0].i.val; } break; -case 234: -#line 1676 "rcparse.y" +case 235: +#line 1706 "rcparse.y" { yyval.i = yyvsp[0].i; } break; -case 235: -#line 1680 "rcparse.y" +case 236: +#line 1710 "rcparse.y" { yyval.i = yyvsp[-1].i; } break; -case 236: -#line 1684 "rcparse.y" +case 237: +#line 1714 "rcparse.y" { yyval.i.val = ~ yyvsp[0].i.val; yyval.i.dword = yyvsp[0].i.dword; } break; -case 237: -#line 1689 "rcparse.y" +case 238: +#line 1719 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val * yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 238: -#line 1694 "rcparse.y" +case 239: +#line 1724 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val / yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 239: -#line 1699 "rcparse.y" +case 240: +#line 1729 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val % yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 240: -#line 1704 "rcparse.y" +case 241: +#line 1734 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val + yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 241: -#line 1709 "rcparse.y" +case 242: +#line 1739 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val - yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 242: -#line 1714 "rcparse.y" +case 243: +#line 1744 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val & yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 243: -#line 1719 "rcparse.y" +case 244: +#line 1749 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val ^ yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; } break; -case 244: -#line 1724 "rcparse.y" +case 245: +#line 1754 "rcparse.y" { yyval.i.val = yyvsp[-2].i.val | yyvsp[0].i.val; yyval.i.dword = yyvsp[-2].i.dword || yyvsp[0].i.dword; @@ -3203,7 +3258,7 @@ case 244: break; } -#line 705 "/usr/share/bison/bison.simple" +#line 705 "/usr/share/bison-1.35/bison.simple" yyvsp -= yylen; @@ -3434,14 +3489,13 @@ yyreturn: #endif return yyresult; } -#line 1730 "rcparse.y" +#line 1760 "rcparse.y" /* Set the language from the command line. */ void -rcparse_set_language (lang) - int lang; +rcparse_set_language (int lang) { language = lang; } diff --git a/binutils/rcparse.y b/binutils/rcparse.y index 1f10da7eaf3e2..7aacaaa067326 100644 --- a/binutils/rcparse.y +++ b/binutils/rcparse.y @@ -1,5 +1,5 @@ %{ /* rcparse.y -- parser for Windows rc files - Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -52,6 +52,11 @@ static unsigned long style; static unsigned long base_style; static unsigned long default_style; static unsigned long class; +static struct res_id res_text_field; + +/* This is used for COMBOBOX, LISTBOX and EDITTEXT which + do not allow resource 'text' field in control definition. */ +static const struct res_id res_null_text = { 1, {{0, L""}}}; %} @@ -135,11 +140,11 @@ static unsigned long class; %type vertrans %type suboptions memflags_move_discard memflags_move %type memflag -%type id resref +%type id optresidc resref %type exstyle parennumber %type numexpr posnumexpr cnumexpr optcnumexpr cposnumexpr %type acc_options acc_option menuitem_flags menuitem_flag -%type optstringc file_name resname +%type file_name resname %type sizednumexpr sizedposnumexpr %left '|' @@ -533,70 +538,78 @@ controls: ; control: - AUTO3STATE + AUTO3STATE optresidc { default_style = BS_AUTO3STATE | WS_TABSTOP; base_style = BS_AUTO3STATE; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | AUTOCHECKBOX + | AUTOCHECKBOX optresidc { default_style = BS_AUTOCHECKBOX | WS_TABSTOP; base_style = BS_AUTOCHECKBOX; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | AUTORADIOBUTTON + | AUTORADIOBUTTON optresidc { default_style = BS_AUTORADIOBUTTON | WS_TABSTOP; base_style = BS_AUTORADIOBUTTON; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | BEDIT + | BEDIT optresidc { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; if (dialog.ex == NULL) rcparse_warning (_("BEDIT requires DIALOGEX")); res_string_to_id (&$$->class, "BEDIT"); } - | CHECKBOX + | CHECKBOX optresidc { default_style = BS_CHECKBOX | WS_TABSTOP; base_style = BS_CHECKBOX | WS_TABSTOP; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } | COMBOBOX { + /* This is as per MSDN documentation. With some (???) + versions of MS rc.exe their is no default style. */ default_style = CBS_SIMPLE | WS_TABSTOP; base_style = 0; class = CTL_COMBOBOX; + res_text_field = res_null_text; } control_params { $$ = $3; } - | CONTROL optstringc numexpr cnumexpr control_styleexpr cnumexpr + | CONTROL optresidc numexpr cnumexpr control_styleexpr cnumexpr cnumexpr cnumexpr cnumexpr optcnumexpr opt_control_data { $$ = define_control ($2, $3, $6, $7, $8, $9, $4, style, $10); @@ -607,7 +620,7 @@ control: $$->data = $11; } } - | CONTROL optstringc numexpr cnumexpr control_styleexpr cnumexpr + | CONTROL optresidc numexpr cnumexpr control_styleexpr cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr opt_control_data { $$ = define_control ($2, $3, $6, $7, $8, $9, $4, style, $10); @@ -616,7 +629,7 @@ control: $$->help = $11; $$->data = $12; } - | CONTROL optstringc numexpr ',' QUOTEDSTRING control_styleexpr + | CONTROL optresidc numexpr ',' QUOTEDSTRING control_styleexpr cnumexpr cnumexpr cnumexpr cnumexpr optcnumexpr opt_control_data { $$ = define_control ($2, $3, $7, $8, $9, $10, 0, style, $11); @@ -629,7 +642,7 @@ control: $$->class.named = 1; unicode_from_ascii (&$$->class.u.n.length, &$$->class.u.n.name, $5); } - | CONTROL optstringc numexpr ',' QUOTEDSTRING control_styleexpr + | CONTROL optresidc numexpr ',' QUOTEDSTRING control_styleexpr cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr opt_control_data { $$ = define_control ($2, $3, $7, $8, $9, $10, 0, style, $11); @@ -640,55 +653,60 @@ control: $$->class.named = 1; unicode_from_ascii (&$$->class.u.n.length, &$$->class.u.n.name, $5); } - | CTEXT + | CTEXT optresidc { default_style = SS_CENTER | WS_GROUP; base_style = SS_CENTER; class = CTL_STATIC; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | DEFPUSHBUTTON + | DEFPUSHBUTTON optresidc { default_style = BS_DEFPUSHBUTTON | WS_TABSTOP; base_style = BS_DEFPUSHBUTTON | WS_TABSTOP; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } | EDITTEXT { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; + res_text_field = res_null_text; } control_params { $$ = $3; } - | GROUPBOX + | GROUPBOX optresidc { default_style = BS_GROUPBOX; base_style = BS_GROUPBOX; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | HEDIT + | HEDIT optresidc { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; if (dialog.ex == NULL) rcparse_warning (_("IEDIT requires DIALOGEX")); res_string_to_id (&$$->class, "HEDIT"); @@ -716,15 +734,16 @@ control: $$ = define_icon_control ($2, $3, $4, $5, style, $9, $10, $11, dialog.ex); } - | IEDIT + | IEDIT optresidc { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; if (dialog.ex == NULL) rcparse_warning (_("IEDIT requires DIALOGEX")); res_string_to_id (&$$->class, "IEDIT"); @@ -734,22 +753,24 @@ control: default_style = LBS_NOTIFY | WS_BORDER; base_style = LBS_NOTIFY | WS_BORDER; class = CTL_LISTBOX; + res_text_field = res_null_text; } control_params { $$ = $3; } - | LTEXT + | LTEXT optresidc { default_style = SS_LEFT | WS_GROUP; base_style = SS_LEFT; class = CTL_STATIC; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | PUSHBOX + | PUSHBOX optresidc { default_style = BS_PUSHBOX | WS_TABSTOP; base_style = BS_PUSHBOX; @@ -757,65 +778,70 @@ control: } control_params { - $$ = $3; + $$ = $4; } - | PUSHBUTTON + | PUSHBUTTON optresidc { default_style = BS_PUSHBUTTON | WS_TABSTOP; base_style = BS_PUSHBUTTON | WS_TABSTOP; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | RADIOBUTTON + | RADIOBUTTON optresidc { default_style = BS_RADIOBUTTON | WS_TABSTOP; base_style = BS_RADIOBUTTON; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | RTEXT + | RTEXT optresidc { default_style = SS_RIGHT | WS_GROUP; base_style = SS_RIGHT; class = CTL_STATIC; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } | SCROLLBAR { default_style = SBS_HORZ; base_style = 0; class = CTL_SCROLLBAR; + res_text_field = res_null_text; } control_params { $$ = $3; } - | STATE3 + | STATE3 optresidc { default_style = BS_3STATE | WS_TABSTOP; base_style = BS_3STATE; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | USERBUTTON QUOTEDSTRING ',' numexpr ',' numexpr ',' numexpr ',' + | USERBUTTON resref numexpr ',' numexpr ',' numexpr ',' numexpr ',' numexpr ',' { style = WS_CHILD | WS_VISIBLE; } styleexpr optcnumexpr { - $$ = define_control ($2, $4, $6, $8, $10, $12, CTL_BUTTON, - style, $16); + $$ = define_control ($2, $3, $5, $7, $9, $11, CTL_BUTTON, + style, $15); } ; @@ -827,52 +853,56 @@ control: style. CLASS is the class of the control. */ control_params: - optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr - opt_control_data + numexpr cnumexpr cnumexpr cnumexpr cnumexpr opt_control_data { - $$ = define_control ($1, $2, $3, $4, $5, $6, class, + $$ = define_control (res_text_field, $1, $2, $3, $4, $5, class, default_style | WS_CHILD | WS_VISIBLE, 0); - if ($7 != NULL) + if ($6 != NULL) { if (dialog.ex == NULL) rcparse_warning (_("control data requires DIALOGEX")); - $$->data = $7; + $$->data = $6; } } - | optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr + | numexpr cnumexpr cnumexpr cnumexpr cnumexpr control_params_styleexpr optcnumexpr opt_control_data { - $$ = define_control ($1, $2, $3, $4, $5, $6, class, style, $8); - if ($9 != NULL) + $$ = define_control (res_text_field, $1, $2, $3, $4, $5, class, style, $7); + if ($8 != NULL) { if (dialog.ex == NULL) rcparse_warning (_("control data requires DIALOGEX")); - $$->data = $9; + $$->data = $8; } } - | optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr + | numexpr cnumexpr cnumexpr cnumexpr cnumexpr control_params_styleexpr cnumexpr cnumexpr opt_control_data { - $$ = define_control ($1, $2, $3, $4, $5, $6, class, style, $8); + $$ = define_control (res_text_field, $1, $2, $3, $4, $5, class, style, $7); if (dialog.ex == NULL) rcparse_warning (_("help ID requires DIALOGEX")); - $$->help = $9; - $$->data = $10; + $$->help = $8; + $$->data = $9; } ; -optstringc: +optresidc: /* empty */ { - $$ = NULL; + res_string_to_id (&$$, ""); + } + | posnumexpr ',' + { + $$.named = 0; + $$.u.id = $1; } | QUOTEDSTRING { - $$ = $1; + res_string_to_id (&$$, $1); } | QUOTEDSTRING ',' { - $$ = $1; + res_string_to_id (&$$, $1); } ; @@ -1732,8 +1762,7 @@ sizedposnumexpr: /* Set the language from the command line. */ void -rcparse_set_language (lang) - int lang; +rcparse_set_language (int lang) { language = lang; } diff --git a/binutils/readelf.1 b/binutils/readelf.1 deleted file mode 100644 index bcef9862babb9..0000000000000 --- a/binutils/readelf.1 +++ /dev/null @@ -1,291 +0,0 @@ -.\" Automatically generated by Pod::Man version 1.02 -.\" Wed May 30 12:24:29 2001 -.\" -.\" Standard preamble: -.\" ====================================================================== -.de Sh \" Subsection heading -.br -.if t .Sp -.ne 5 -.PP -\fB\\$1\fR -.PP -.. -.de Sp \" Vertical space (when we can't use .PP) -.if t .sp .5v -.if n .sp -.. -.de Ip \" List item -.br -.ie \\n(.$>=3 .ne \\$3 -.el .ne 3 -.IP "\\$1" \\$2 -.. -.de Vb \" Begin verbatim text -.ft CW -.nf -.ne \\$1 -.. -.de Ve \" End verbatim text -.ft R - -.fi -.. -.\" Set up some character translations and predefined strings. \*(-- will -.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used -.\" to do unbreakable dashes and therefore won't be available. \*(C` and -.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<> -.tr \(*W-|\(bv\*(Tr -.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' -.ie n \{\ -. ds -- \(*W- -. ds PI pi -. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch -. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch -. ds L" "" -. ds R" "" -. ds C` ` -. ds C' ' -'br\} -.el\{\ -. ds -- \|\(em\| -. ds PI \(*p -. ds L" `` -. ds R" '' -'br\} -.\" -.\" If the F register is turned on, we'll generate index entries on stderr -.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and -.\" index entries marked with X<> in POD. Of course, you'll have to process -.\" the output yourself in some meaningful fashion. -.if \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" -. . -. nr % 0 -. rr F -.\} -.\" -.\" For nroff, turn off justification. Always turn off hyphenation; it -.\" makes way too many mistakes in technical documents. -.hy 0 -.\" -.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). -.\" Fear. Run. Save yourself. No user-serviceable parts. -.bd B 3 -. \" fudge factors for nroff and troff -.if n \{\ -. ds #H 0 -. ds #V .8m -. ds #F .3m -. ds #[ \f1 -. ds #] \fP -.\} -.if t \{\ -. ds #H ((1u-(\\\\n(.fu%2u))*.13m) -. ds #V .6m -. ds #F 0 -. ds #[ \& -. ds #] \& -.\} -. \" simple accents for nroff and troff -.if n \{\ -. ds ' \& -. ds ` \& -. ds ^ \& -. ds , \& -. ds ~ ~ -. ds / -.\} -.if t \{\ -. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" -. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' -. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' -. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' -. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' -. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' -.\} -. \" troff and (daisy-wheel) nroff accents -.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' -.ds 8 \h'\*(#H'\(*b\h'-\*(#H' -.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] -.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' -.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' -.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] -.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] -.ds ae a\h'-(\w'a'u*4/10)'e -.ds Ae A\h'-(\w'A'u*4/10)'E -. \" corrections for vroff -.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' -.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' -. \" for low resolution devices (crt and lpr) -.if \n(.H>23 .if \n(.V>19 \ -\{\ -. ds : e -. ds 8 ss -. ds o a -. ds d- d\h'-1'\(ga -. ds D- D\h'-1'\(hy -. ds th \o'bp' -. ds Th \o'LP' -. ds ae ae -. ds Ae AE -.\} -.rm #[ #] #H #V #F C -.\" ====================================================================== -.\" -.IX Title "READELF.1 1" -.TH READELF.1 1 "binutils-2.11.90" "2001-05-30" "GNU" -.UC -.SH "NAME" -readelf \- Displays information about \s-1ELF\s0 files. -.SH "SYNOPSIS" -.IX Header "SYNOPSIS" -readelf [ \-a | \-\-all ] - [ \-h | \-\-file-header] - [ \-l | \-\-program-headers | \-\-segments] - [ \-S | \-\-section-headers | \-\-sections] - [ \-e | \-\-headers] - [ \-s | \-\-syms | \-\-symbols] - [ \-n | \-\-notes] - [ \-r | \-\-relocs] - [ \-u | \-\-unwind] - [ \-d | \-\-dynamic] - [ \-V | \-\-version-info] - [ \-D | \-\-use-dynamic] - [ \-x | \-\-hex-dump=] - [ \-w[liaprf] | \-\-debug-dump[=info,=line,=abbrev,=pubnames,=ranges,=frames]] - [ \-\-histogram] - [ \-v | \-\-version] - [ \-H | \-\-help] - \fIelffile\fR... -.SH "DESCRIPTION" -.IX Header "DESCRIPTION" -\&\f(CW\*(C`readelf\*(C'\fR displays information about one or more \s-1ELF\s0 format object -files. The options control what particular information to display. -.PP -\&\fIelffile\fR... are the object files to be examined. At the -moment, \f(CW\*(C`readelf\*(C'\fR does not support examining archives, nor does it -support examing 64 bit \s-1ELF\s0 files. -.SH "OPTIONS" -.IX Header "OPTIONS" -The long and short forms of options, shown here as alternatives, are -equivalent. At least one option besides \fB\-v\fR or \fB\-H\fR must be -given. -.Ip "\f(CW\*(C`\-a\*(C'\fR" 4 -.IX Item "-a" -.Ip "\f(CW\*(C`\-\-all\*(C'\fR" 4 -.IX Item "--all" -Equivalent to specifiying \fB\*(--file-header\fR, -\&\fB\*(--program-headers\fR, \fB\*(--sections\fR, \fB\*(--symbols\fR, -\&\fB\*(--relocs\fR, \fB\*(--dynamic\fR, \fB\*(--notes\fR and -\&\fB\*(--version-info\fR. -.Ip "\f(CW\*(C`\-h\*(C'\fR" 4 -.IX Item "-h" -.Ip "\f(CW\*(C`\-\-file\-header\*(C'\fR" 4 -.IX Item "--file-header" -Displays the information contained in the \s-1ELF\s0 header at the start of the -file. -.Ip "\f(CW\*(C`\-l\*(C'\fR" 4 -.IX Item "-l" -.Ip "\f(CW\*(C`\-\-program\-headers\*(C'\fR" 4 -.IX Item "--program-headers" -.Ip "\f(CW\*(C`\-\-segments\*(C'\fR" 4 -.IX Item "--segments" -Displays the information contained in the file's segment headers, if it -has any. -.Ip "\f(CW\*(C`\-S\*(C'\fR" 4 -.IX Item "-S" -.Ip "\f(CW\*(C`\-\-sections\*(C'\fR" 4 -.IX Item "--sections" -.Ip "\f(CW\*(C`\-\-section\-headers\*(C'\fR" 4 -.IX Item "--section-headers" -Displays the information contained in the file's section headers, if it -has any. -.Ip "\f(CW\*(C`\-s\*(C'\fR" 4 -.IX Item "-s" -.Ip "\f(CW\*(C`\-\-symbols\*(C'\fR" 4 -.IX Item "--symbols" -.Ip "\f(CW\*(C`\-\-syms\*(C'\fR" 4 -.IX Item "--syms" -Displays the entries in symbol table section of the file, if it has one. -.Ip "\f(CW\*(C`\-e\*(C'\fR" 4 -.IX Item "-e" -.Ip "\f(CW\*(C`\-\-headers\*(C'\fR" 4 -.IX Item "--headers" -Display all the headers in the file. Equivalent to \fB\-h \-l \-S\fR. -.Ip "\f(CW\*(C`\-n\*(C'\fR" 4 -.IX Item "-n" -.Ip "\f(CW\*(C`\-\-notes\*(C'\fR" 4 -.IX Item "--notes" -Displays the contents of the \s-1NOTE\s0 segment, if it exists. -.Ip "\f(CW\*(C`\-r\*(C'\fR" 4 -.IX Item "-r" -.Ip "\f(CW\*(C`\-\-relocs\*(C'\fR" 4 -.IX Item "--relocs" -Displays the contents of the file's relocation section, if it has one. -.Ip "\f(CW\*(C`\-u\*(C'\fR" 4 -.IX Item "-u" -.Ip "\f(CW\*(C`\-\-unwind\*(C'\fR" 4 -.IX Item "--unwind" -Displays the contents of the file's unwind section, if it has one. Only -the unwind sections for \s-1IA64\s0 \s-1ELF\s0 files are currently supported. -.Ip "\f(CW\*(C`\-d\*(C'\fR" 4 -.IX Item "-d" -.Ip "\f(CW\*(C`\-\-dynamic\*(C'\fR" 4 -.IX Item "--dynamic" -Displays the contents of the file's dynamic section, if it has one. -.Ip "\f(CW\*(C`\-V\*(C'\fR" 4 -.IX Item "-V" -.Ip "\f(CW\*(C`\-\-version\-info\*(C'\fR" 4 -.IX Item "--version-info" -Displays the contents of the version sections in the file, it they -exist. -.Ip "\f(CW\*(C`\-D\*(C'\fR" 4 -.IX Item "-D" -.Ip "\f(CW\*(C`\-\-use\-dynamic\*(C'\fR" 4 -.IX Item "--use-dynamic" -When displaying symbols, this option makes \f(CW\*(C`readelf\*(C'\fR use the -symbol table in the file's dynamic section, rather than the one in the -symbols section. -.Ip "\f(CW\*(C`\-x \*(C'\fR" 4 -.IX Item "-x " -.Ip "\f(CW\*(C`\-\-hex\-dump=\*(C'\fR" 4 -.IX Item "--hex-dump=" -Displays the contents of the indicated section as a hexadecimal dump. -.Ip "\f(CW\*(C`\-w[liaprf]\*(C'\fR" 4 -.IX Item "-w[liaprf]" -.Ip "\f(CW\*(C`\-\-debug\-dump[=line,=info,=abbrev,=pubnames,=ranges,=frames]\*(C'\fR" 4 -.IX Item "--debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=frames]" -Displays the contents of the debug sections in the file, if any are -present. If one of the optional letters or words follows the switch -then only data found in those specific sections will be dumped. -.Ip "\f(CW\*(C`\-\-histogram\*(C'\fR" 4 -.IX Item "--histogram" -Display a histogram of bucket list lengths when displaying the contents -of the symbol tables. -.Ip "\f(CW\*(C`\-v\*(C'\fR" 4 -.IX Item "-v" -.Ip "\f(CW\*(C`\-\-version\*(C'\fR" 4 -.IX Item "--version" -Display the version number of readelf. -.Ip "\f(CW\*(C`\-H\*(C'\fR" 4 -.IX Item "-H" -.Ip "\f(CW\*(C`\-\-help\*(C'\fR" 4 -.IX Item "--help" -Display the command line options understood by \f(CW\*(C`readelf\*(C'\fR. -.SH "SEE ALSO" -.IX Header "SEE ALSO" -\&\fIobjdump\fR\|(1), and the Info entries for \fIbinutils\fR. -.SH "COPYRIGHT" -.IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc. -.PP -Permission is granted to copy, distribute and/or modify this document -under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 -or any later version published by the Free Software Foundation; -with no Invariant Sections, with no Front-Cover Texts, and with no -Back-Cover Texts. A copy of the license is included in the -section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/binutils/size.1 b/binutils/size.1 deleted file mode 100644 index 7f8f9ef4e63b2..0000000000000 --- a/binutils/size.1 +++ /dev/null @@ -1,518 +0,0 @@ -.\" Copyright (c) 1991, 2000 Free Software Foundation -.\" See section COPYING for conditions for redistribution -.TH size 1 "5 November 1991" "Free Software Foundation" "GNU Development Tools" -.de BP -.sp -.ti \-.2i -\(** -.. - -.SH NAME -size \- list section sizes and total size. - -.SH SYNOPSIS -.hy 0 -.na -.B size -.RB "[\|" \-A \||\| \-B \||\| \c -.BI "\-\-format=" compatibility\c -\&\|] -.RB "[\|" \-\-help "\|]" -.RB "[\|" \-d \||\| \-o \||\| \-x\c -\||\|\c -.BI "\-\-radix=" number\c -\&\|] -.RB "[\|" \c -.BI "\-\-target=" bfdname\c -\&\|] -.RB "[\|" \-V \||\| \-\-version "\|]" -.I objfile\c -\&.\|.\|. -.ad b -.hy 1 -.SH DESCRIPTION -The GNU \c -.B size\c -\& utility lists the section sizes\(em\&and the total -size\(em\&for each of the object files -.I objfile -in its argument list. -By default, one line of output is generated for each object file or each -module in an archive. - -.SH OPTIONS -.TP -.B \-A -.TP -.B \-B -.TP -.BI "\-\-format " "compatibility" -Using one of these options, you can choose whether the output from GNU -\c -.B size\c -\& resembles output from System V \c -.B size\c -\& (using `\|\c -.B \-A\c -\|', -or `\|\c -.B \-\-format=sysv\c -\|'), or Berkeley \c -.B size\c -\& (using `\|\c -.B \-B\c -\|', or -`\|\c -.B \-\-format=berkeley\c -\|'). The default is the one-line format similar to -Berkeley's. - -.TP -.B \-\-help -Show a summary of acceptable arguments and options. - -.TP -.B \-d -.TP -.B \-o -.TP -.B \-x -.TP -.BI "\-\-radix " "number" -Using one of these options, you can control whether the size of each -section is given in decimal (`\|\c -.B \-d\c -\|', or `\|\c -.B \-\-radix 10\c -\|'); octal -(`\|\c -.B \-o\c -\|', or `\|\c -.B \-\-radix 8\c -\|'); or hexadecimal (`\|\c -.B \-x\c -\|', or -`\|\c -.B \-\-radix 16\c -\|'). In `\|\c -.B \-\-radix \c -.I number\c -\&\c -\|', only the three -values (8, 10, 16) are supported. The total size is always given in two -radices; decimal and hexadecimal for `\|\c -.B \-d\c -\|' or `\|\c -.B \-x\c -\|' output, or -octal and hexadecimal if you're using `\|\c -.B \-o\c -\|'. - -.TP -.BI "\-\-target " "bfdname" -You can specify a particular object-code format for \c -.I objfile\c -\& as -\c -.I bfdname\c -\&. This may not be necessary; \c -.I size\c -\& can -automatically recognize many formats. See -.BR objdump ( 1 ) -for information -on listing available formats. - -.TP -.B \-V -.TP -.B \-\-version -Display version number information on \c -.B size\c -\& itself. - -.SH "SEE ALSO" -.RB "`\|" binutils "\|'" -entry in -.BR info ; -.IR "The GNU Binary Utilities" , - Roland H. Pesch (October 1991); -.BR ar "(" 1 ")," -.BR objdump ( 1 ). - -.SH COPYING -Copyright (c) 1991, 2000 Free Software Foundation, Inc. -.PP -This document is distributed under the terms of the GNU Free -Documentation License, version 1.1. That license is described in the -sources for this manual page, but it is not displayed here in order to -make this manual more consise. Copies of this license can also be -obtained from: http://www.gnu.org/copyleft/. - -\" .SH GNU Free Documentation License -\" Version 1.1, March 2000 - -\" Copyright (C) 2000 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. -\" .PP -\" 0. PREAMBLE -\" .PP -\" The purpose of this License is to make a manual, textbook, or other -\" written document "free" in the sense of freedom: to assure everyone -\" the effective freedom to copy and redistribute it, with or without -\" modifying it, either commercially or noncommercially. Secondarily, -\" this License preserves for the author and publisher a way to get -\" credit for their work, while not being considered responsible for -\" modifications made by others. -\" .PP -\" This License is a kind of "copyleft", which means that derivative -\" works of the document must themselves be free in the same sense. It -\" complements the GNU General Public License, which is a copyleft -\" license designed for free software. -\" .PP -\" We have designed this License in order to use it for manuals for free -\" software, because free software needs free documentation: a free -\" program should come with manuals providing the same freedoms that the -\" software does. But this License is not limited to software manuals; -\" it can be used for any textual work, regardless of subject matter or -\" whether it is published as a printed book. We recommend this License -\" principally for works whose purpose is instruction or reference. -\" .PP -\" 1. APPLICABILITY AND DEFINITIONS -\" .PP -\" This License applies to any manual or other work that contains a -\" notice placed by the copyright holder saying it can be distributed -\" under the terms of this License. The "Document", below, refers to any -\" such manual or work. Any member of the public is a licensee, and is -\" addressed as "you". -\" .PP -\" A "Modified Version" of the Document means any work containing the -\" Document or a portion of it, either copied verbatim, or with -\" modifications and/or translated into another language. -\" .PP -\" A "Secondary Section" is a named appendix or a front-matter section of -\" the Document that deals exclusively with the relationship of the -\" publishers or authors of the Document to the Document's overall subject -\" (or to related matters) and contains nothing that could fall directly -\" within that overall subject. (For example, if the Document is in part a -\" textbook of mathematics, a Secondary Section may not explain any -\" mathematics.) The relationship could be a matter of historical -\" connection with the subject or with related matters, or of legal, -\" commercial, philosophical, ethical or political position regarding -\" them. -\" .PP -\" The "Invariant Sections" are certain Secondary Sections whose titles -\" are designated, as being those of Invariant Sections, in the notice -\" that says that the Document is released under this License. -\" .PP -\" The "Cover Texts" are certain short passages of text that are listed, -\" as Front-Cover Texts or Back-Cover Texts, in the notice that says that -\" the Document is released under this License. -\" .PP -\" A "Transparent" copy of the Document means a machine-readable copy, -\" represented in a format whose specification is available to the -\" general public, whose contents can be viewed and edited directly and -\" straightforwardly with generic text editors or (for images composed of -\" pixels) generic paint programs or (for drawings) some widely available -\" drawing editor, and that is suitable for input to text formatters or -\" for automatic translation to a variety of formats suitable for input -\" to text formatters. A copy made in an otherwise Transparent file -\" format whose markup has been designed to thwart or discourage -\" subsequent modification by readers is not Transparent. A copy that is -\" not "Transparent" is called "Opaque". -\" .PP -\" Examples of suitable formats for Transparent copies include plain -\" ASCII without markup, Texinfo input format, LaTeX input format, SGML -\" or XML using a publicly available DTD, and standard-conforming simple -\" HTML designed for human modification. Opaque formats include -\" PostScript, PDF, proprietary formats that can be read and edited only -\" by proprietary word processors, SGML or XML for which the DTD and/or -\" processing tools are not generally available, and the -\" machine-generated HTML produced by some word processors for output -\" purposes only. -\" .PP -\" The "Title Page" means, for a printed book, the title page itself, -\" plus such following pages as are needed to hold, legibly, the material -\" this License requires to appear in the title page. For works in -\" formats which do not have any title page as such, "Title Page" means -\" the text near the most prominent appearance of the work's title, -\" preceding the beginning of the body of the text. -\" .PP -\" 2. VERBATIM COPYING -\" .PP -\" You may copy and distribute the Document in any medium, either -\" commercially or noncommercially, provided that this License, the -\" copyright notices, and the license notice saying this License applies -\" to the Document are reproduced in all copies, and that you add no other -\" conditions whatsoever to those of this License. You may not use -\" technical measures to obstruct or control the reading or further -\" copying of the copies you make or distribute. However, you may accept -\" compensation in exchange for copies. If you distribute a large enough -\" number of copies you must also follow the conditions in section 3. -\" .PP -\" You may also lend copies, under the same conditions stated above, and -\" you may publicly display copies. -\" .PP -\" 3. COPYING IN QUANTITY -\" .PP -\" If you publish printed copies of the Document numbering more than 100, -\" and the Document's license notice requires Cover Texts, you must enclose -\" the copies in covers that carry, clearly and legibly, all these Cover -\" Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -\" the back cover. Both covers must also clearly and legibly identify -\" you as the publisher of these copies. The front cover must present -\" the full title with all words of the title equally prominent and -\" visible. You may add other material on the covers in addition. -\" Copying with changes limited to the covers, as long as they preserve -\" the title of the Document and satisfy these conditions, can be treated -\" as verbatim copying in other respects. -\" .PP -\" If the required texts for either cover are too voluminous to fit -\" legibly, you should put the first ones listed (as many as fit -\" reasonably) on the actual cover, and continue the rest onto adjacent -\" pages. -\" .PP -\" If you publish or distribute Opaque copies of the Document numbering -\" more than 100, you must either include a machine-readable Transparent -\" copy along with each Opaque copy, or state in or with each Opaque copy -\" a publicly-accessible computer-network location containing a complete -\" Transparent copy of the Document, free of added material, which the -\" general network-using public has access to download anonymously at no -\" charge using public-standard network protocols. If you use the latter -\" option, you must take reasonably prudent steps, when you begin -\" distribution of Opaque copies in quantity, to ensure that this -\" Transparent copy will remain thus accessible at the stated location -\" until at least one year after the last time you distribute an Opaque -\" copy (directly or through your agents or retailers) of that edition to -\" the public. -\" .PP -\" It is requested, but not required, that you contact the authors of the -\" Document well before redistributing any large number of copies, to give -\" them a chance to provide you with an updated version of the Document. -\" .PP -\" 4. MODIFICATIONS -\" .PP -\" You may copy and distribute a Modified Version of the Document under -\" the conditions of sections 2 and 3 above, provided that you release -\" the Modified Version under precisely this License, with the Modified -\" Version filling the role of the Document, thus licensing distribution -\" and modification of the Modified Version to whoever possesses a copy -\" of it. In addition, you must do these things in the Modified Version: -\" .PP -\" A. Use in the Title Page (and on the covers, if any) a title distinct -\" from that of the Document, and from those of previous versions -\" (which should, if there were any, be listed in the History section -\" of the Document). You may use the same title as a previous version -\" if the original publisher of that version gives permission. -\" .PP -\" B. List on the Title Page, as authors, one or more persons or entities -\" responsible for authorship of the modifications in the Modified -\" Version, together with at least five of the principal authors of the -\" Document (all of its principal authors, if it has less than five). -\" .PP -\" C. State on the Title page the name of the publisher of the -\" Modified Version, as the publisher. -\" .PP -\" D. Preserve all the copyright notices of the Document. -\" .PP -\" E. Add an appropriate copyright notice for your modifications -\" adjacent to the other copyright notices. -\" .PP -\" F. Include, immediately after the copyright notices, a license notice -\" giving the public permission to use the Modified Version under the -\" terms of this License, in the form shown in the Addendum below. -\" Preserve in that license notice the full lists of Invariant Sections -\" and required Cover Texts given in the Document's license notice. -\" .PP -\" H. Include an unaltered copy of this License. -\" .PP -\" I. Preserve the section entitled "History", and its title, and add to -\" it an item stating at least the title, year, new authors, and -\" publisher of the Modified Version as given on the Title Page. If -\" there is no section entitled "History" in the Document, create one -\" stating the title, year, authors, and publisher of the Document as -\" given on its Title Page, then add an item describing the Modified -\" Version as stated in the previous sentence. -\" .PP -\" J. Preserve the network location, if any, given in the Document for -\" public access to a Transparent copy of the Document, and likewise -\" the network locations given in the Document for previous versions -\" it was based on. These may be placed in the "History" section. -\" You may omit a network location for a work that was published at -\" least four years before the Document itself, or if the original -\" publisher of the version it refers to gives permission. -\" .PP -\" K. In any section entitled "Acknowledgements" or "Dedications", -\" preserve the section's title, and preserve in the section all the -\" substance and tone of each of the contributor acknowledgements -\" and/or dedications given therein. -\" .PP -\" L. Preserve all the Invariant Sections of the Document, -\" unaltered in their text and in their titles. Section numbers -\" or the equivalent are not considered part of the section titles. -\" .PP -\" M. Delete any section entitled "Endorsements". Such a section -\" may not be included in the Modified Version. -\" .PP -\" N. Do not retitle any existing section as "Endorsements" -\" or to conflict in title with any Invariant Section. -\" .PP -\" If the Modified Version includes new front-matter sections or -\" appendices that qualify as Secondary Sections and contain no material -\" copied from the Document, you may at your option designate some or all -\" of these sections as invariant. To do this, add their titles to the -\" list of Invariant Sections in the Modified Version's license notice. -\" These titles must be distinct from any other section titles. -\" .PP -\" You may add a section entitled "Endorsements", provided it contains -\" nothing but endorsements of your Modified Version by various -\" parties--for example, statements of peer review or that the text has -\" been approved by an organization as the authoritative definition of a -\" standard. -\" .PP -\" You may add a passage of up to five words as a Front-Cover Text, and a -\" passage of up to 25 words as a Back-Cover Text, to the end of the list -\" of Cover Texts in the Modified Version. Only one passage of -\" Front-Cover Text and one of Back-Cover Text may be added by (or -\" through arrangements made by) any one entity. If the Document already -\" includes a cover text for the same cover, previously added by you or -\" by arrangement made by the same entity you are acting on behalf of, -\" you may not add another; but you may replace the old one, on explicit -\" permission from the previous publisher that added the old one. -\" .PP -\" The author(s) and publisher(s) of the Document do not by this License -\" give permission to use their names for publicity for or to assert or -\" imply endorsement of any Modified Version. -\" .PP - -\" 5. COMBINING DOCUMENTS -\" .PP -\" You may combine the Document with other documents released under this -\" License, under the terms defined in section 4 above for modified -\" versions, provided that you include in the combination all of the -\" Invariant Sections of all of the original documents, unmodified, and -\" list them all as Invariant Sections of your combined work in its -\" license notice. -\" .PP -\" The combined work need only contain one copy of this License, and -\" multiple identical Invariant Sections may be replaced with a single -\" copy. If there are multiple Invariant Sections with the same name but -\" different contents, make the title of each such section unique by -\" adding at the end of it, in parentheses, the name of the original -\" author or publisher of that section if known, or else a unique number. -\" Make the same adjustment to the section titles in the list of -\" Invariant Sections in the license notice of the combined work. -\" .PP -\" In the combination, you must combine any sections entitled "History" -\" in the various original documents, forming one section entitled -\" "History"; likewise combine any sections entitled "Acknowledgements", -\" and any sections entitled "Dedications". You must delete all sections -\" entitled "Endorsements." -\" .PP - -\" 6. COLLECTIONS OF DOCUMENTS -\" .PP -\" You may make a collection consisting of the Document and other documents -\" released under this License, and replace the individual copies of this -\" License in the various documents with a single copy that is included in -\" the collection, provided that you follow the rules of this License for -\" verbatim copying of each of the documents in all other respects. -\" .PP -\" You may extract a single document from such a collection, and distribute -\" it individually under this License, provided you insert a copy of this -\" License into the extracted document, and follow this License in all -\" other respects regarding verbatim copying of that document. -\" .PP - -\" 7. AGGREGATION WITH INDEPENDENT WORKS -\" .PP -\" A compilation of the Document or its derivatives with other separate -\" and independent documents or works, in or on a volume of a storage or -\" distribution medium, does not as a whole count as a Modified Version -\" of the Document, provided no compilation copyright is claimed for the -\" compilation. Such a compilation is called an "aggregate", and this -\" License does not apply to the other self-contained works thus compiled -\" with the Document, on account of their being thus compiled, if they -\" are not themselves derivative works of the Document. -\" .PP -\" If the Cover Text requirement of section 3 is applicable to these -\" copies of the Document, then if the Document is less than one quarter -\" of the entire aggregate, the Document's Cover Texts may be placed on -\" covers that surround only the Document within the aggregate. -\" Otherwise they must appear on covers around the whole aggregate. -\" .PP - -\" 8. TRANSLATION -\" .PP -\" Translation is considered a kind of modification, so you may -\" distribute translations of the Document under the terms of section 4. -\" Replacing Invariant Sections with translations requires special -\" permission from their copyright holders, but you may include -\" translations of some or all Invariant Sections in addition to the -\" original versions of these Invariant Sections. You may include a -\" translation of this License provided that you also include the -\" original English version of this License. In case of a disagreement -\" between the translation and the original English version of this -\" License, the original English version will prevail. -\" .PP - -\" 9. TERMINATION -\" .PP -\" You may not copy, modify, sublicense, or distribute the Document except -\" as expressly provided for under this License. Any other attempt to -\" copy, modify, sublicense or distribute the Document 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. -\" .PP - -\" 10. FUTURE REVISIONS OF THIS LICENSE -\" .PP -\" The Free Software Foundation may publish new, revised versions -\" of the GNU Free Documentation 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. See -\" http://www.gnu.org/copyleft/. -\" .PP -\" Each version of the License is given a distinguishing version number. -\" If the Document specifies that a particular numbered version of this -\" License "or any later version" applies to it, you have the option of -\" following the terms and conditions either of that specified version or -\" of any later version that has been published (not as a draft) by the -\" Free Software Foundation. If the Document does not specify a version -\" number of this License, you may choose any version ever published (not -\" as a draft) by the Free Software Foundation. -\" .PP - -\" ADDENDUM: How to use this License for your documents -\" .PP -\" To use this License in a document you have written, include a copy of -\" the License in the document and put the following copyright and -\" license notices just after the title page: -\" .PP -\" Copyright (c) YEAR YOUR NAME. -\" Permission is granted to copy, distribute and/or -\" modify this document under the terms of the GNU -\" Free Documentation License, Version 1.1 or any later -\" version published by the Free Software Foundation; -\" with the Invariant Sections being LIST THEIR TITLES, -\" with the Front-Cover Texts being LIST, and with the -\" Back-Cover Texts being LIST. A copy of the license -\" is included in the section entitled "GNU Free -\" Documentation License". -\" .PP -\" If you have no Invariant Sections, write "with no Invariant Sections" -\" instead of saying which ones are invariant. If you have no -\" Front-Cover Texts, write "no Front-Cover Texts" instead of -\" "Front-Cover Texts being LIST"; likewise for Back-Cover Texts. -\" .PP -\" If your document contains nontrivial examples of program code, we -\" recommend releasing these examples in parallel under your choice of -\" free software license, such as the GNU General Public License, -\" to permit their use in free software. diff --git a/binutils/strings.1 b/binutils/strings.1 deleted file mode 100644 index 6cbf041a4cd1f..0000000000000 --- a/binutils/strings.1 +++ /dev/null @@ -1,508 +0,0 @@ -.\" Copyright (c) 1993, 94, 95, 2000 Free Software Foundation -.\" See section COPYING for conditions for redistribution -.TH strings 1 "09 March 2000" "Free Software Foundation" "GNU Development Tools" -.de BP -.sp -.ti \-.2i -\(** -.. - -.SH NAME -strings \- print the strings of printable characters in files - -.SH SYNOPSIS -.hy 0 -.na -.B strings -.RB "[\|" \-a | \-\c -.RB | \-\-all "\|]" -.RB "[\|" \-f | \-\-print\-file\-name "\|]" -.RB "[\|" \-o "\|]" -.RB "[\|" \-\-help "\|]" -.RB "[\|" \-v | \-\-version "\|]" -.RB "[\|" \-n -.I min\-len\c -.RI | \-min\-len\c -.RB | "\-\-bytes="\c -.I min\-len\c -\&\|] -.RB "[\|" \-t -.I {o,x,d}\c -.RB "[\|" "\-\-target=\fIbfdname" "\|]" -.RB | "\-\-radix="\c -.I {o,x,d}\c -\&\|] -.I file\c -.ad b -.hy 1 -.SH DESCRIPTION -For each -.I file -given, GNU \c -.B strings -prints the printable character sequences that are at least 4 -characters long (or the number given with the options below) and are -followed by an unprintable character. By default, it only prints the -strings from the initialized and loaded sections of object files; for -other types of files, it prints the strings from the whole file. - -.PP -.B strings -is mainly useful for determining the contents of non-text files. - -.SH OPTIONS -The long and short forms of options, shown here as alternatives, are -equivalent. - -.TP -.B \-a -.TP -.B \-\-all -.TP -.B \- -Do not scan only the initialized and loaded sections of object files; -scan the whole files. - -.TP -.B \-f -.TP -.B \-\-print\-file\-name -Print the name of the file before each string. - -.TP -.B \-\-help -Print a summary of the options to -.B strings -on the standard output and exit. - -.TP -.B \-v -.TP -.B \-\-version -Print the version number -of -.B strings -on the standard output and exit. - -.TP -.B "\-n \fImin\-len\fP" -.TP -.B "\-\fImin\-len\fP" -.TP -.B "\-\-bytes=\fImin\-len\fP" -Print sequences of characters that are at least -.I min\-len -characters long, instead of the default 4. - -.TP -.BR "\-t " {o,x,d} -.TP -.BR "\-\-radix=" {o,x,d} -Print the offset within the file before each string. The single -character argument specifies the radix of the offset\(emoctal, -hexadecimal, or decimal. - -.TP -.BI "\-\-target=" "bfdname" -Specify an object code format other than your system's default format. -See -.BR objdump ( 1 ), -for information on listing available formats. - -.TP -.B \-o -Like -.BR "\-t o" . - -.PP - -.SH "SEE ALSO" -.RB "`\|" binutils "\|'" -entry in -.B -info\c -\&; -.I -The GNU Binary Utilities\c -\&, Roland H. Pesch (October 1991); -.BR ar ( 1 ), -.BR nm ( 1 ), -.BR objdump ( 1 ), -.BR ranlib ( 1 ). - - -.SH COPYING -Copyright (c) 1993, 2000 Free Software Foundation, Inc. -.PP -This document is distributed under the terms of the GNU Free -Documentation License, version 1.1. That license is described in the -sources for this manual page, but it is not displayed here in order to -make this manual more consise. Copies of this license can also be -obtained from: http://www.gnu.org/copyleft/. - -\" .SH GNU Free Documentation License -\" Version 1.1, March 2000 - -\" Copyright (C) 2000 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. -\" .PP -\" 0. PREAMBLE -\" .PP -\" The purpose of this License is to make a manual, textbook, or other -\" written document "free" in the sense of freedom: to assure everyone -\" the effective freedom to copy and redistribute it, with or without -\" modifying it, either commercially or noncommercially. Secondarily, -\" this License preserves for the author and publisher a way to get -\" credit for their work, while not being considered responsible for -\" modifications made by others. -\" .PP -\" This License is a kind of "copyleft", which means that derivative -\" works of the document must themselves be free in the same sense. It -\" complements the GNU General Public License, which is a copyleft -\" license designed for free software. -\" .PP -\" We have designed this License in order to use it for manuals for free -\" software, because free software needs free documentation: a free -\" program should come with manuals providing the same freedoms that the -\" software does. But this License is not limited to software manuals; -\" it can be used for any textual work, regardless of subject matter or -\" whether it is published as a printed book. We recommend this License -\" principally for works whose purpose is instruction or reference. -\" .PP -\" 1. APPLICABILITY AND DEFINITIONS -\" .PP -\" This License applies to any manual or other work that contains a -\" notice placed by the copyright holder saying it can be distributed -\" under the terms of this License. The "Document", below, refers to any -\" such manual or work. Any member of the public is a licensee, and is -\" addressed as "you". -\" .PP -\" A "Modified Version" of the Document means any work containing the -\" Document or a portion of it, either copied verbatim, or with -\" modifications and/or translated into another language. -\" .PP -\" A "Secondary Section" is a named appendix or a front-matter section of -\" the Document that deals exclusively with the relationship of the -\" publishers or authors of the Document to the Document's overall subject -\" (or to related matters) and contains nothing that could fall directly -\" within that overall subject. (For example, if the Document is in part a -\" textbook of mathematics, a Secondary Section may not explain any -\" mathematics.) The relationship could be a matter of historical -\" connection with the subject or with related matters, or of legal, -\" commercial, philosophical, ethical or political position regarding -\" them. -\" .PP -\" The "Invariant Sections" are certain Secondary Sections whose titles -\" are designated, as being those of Invariant Sections, in the notice -\" that says that the Document is released under this License. -\" .PP -\" The "Cover Texts" are certain short passages of text that are listed, -\" as Front-Cover Texts or Back-Cover Texts, in the notice that says that -\" the Document is released under this License. -\" .PP -\" A "Transparent" copy of the Document means a machine-readable copy, -\" represented in a format whose specification is available to the -\" general public, whose contents can be viewed and edited directly and -\" straightforwardly with generic text editors or (for images composed of -\" pixels) generic paint programs or (for drawings) some widely available -\" drawing editor, and that is suitable for input to text formatters or -\" for automatic translation to a variety of formats suitable for input -\" to text formatters. A copy made in an otherwise Transparent file -\" format whose markup has been designed to thwart or discourage -\" subsequent modification by readers is not Transparent. A copy that is -\" not "Transparent" is called "Opaque". -\" .PP -\" Examples of suitable formats for Transparent copies include plain -\" ASCII without markup, Texinfo input format, LaTeX input format, SGML -\" or XML using a publicly available DTD, and standard-conforming simple -\" HTML designed for human modification. Opaque formats include -\" PostScript, PDF, proprietary formats that can be read and edited only -\" by proprietary word processors, SGML or XML for which the DTD and/or -\" processing tools are not generally available, and the -\" machine-generated HTML produced by some word processors for output -\" purposes only. -\" .PP -\" The "Title Page" means, for a printed book, the title page itself, -\" plus such following pages as are needed to hold, legibly, the material -\" this License requires to appear in the title page. For works in -\" formats which do not have any title page as such, "Title Page" means -\" the text near the most prominent appearance of the work's title, -\" preceding the beginning of the body of the text. -\" .PP -\" 2. VERBATIM COPYING -\" .PP -\" You may copy and distribute the Document in any medium, either -\" commercially or noncommercially, provided that this License, the -\" copyright notices, and the license notice saying this License applies -\" to the Document are reproduced in all copies, and that you add no other -\" conditions whatsoever to those of this License. You may not use -\" technical measures to obstruct or control the reading or further -\" copying of the copies you make or distribute. However, you may accept -\" compensation in exchange for copies. If you distribute a large enough -\" number of copies you must also follow the conditions in section 3. -\" .PP -\" You may also lend copies, under the same conditions stated above, and -\" you may publicly display copies. -\" .PP -\" 3. COPYING IN QUANTITY -\" .PP -\" If you publish printed copies of the Document numbering more than 100, -\" and the Document's license notice requires Cover Texts, you must enclose -\" the copies in covers that carry, clearly and legibly, all these Cover -\" Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -\" the back cover. Both covers must also clearly and legibly identify -\" you as the publisher of these copies. The front cover must present -\" the full title with all words of the title equally prominent and -\" visible. You may add other material on the covers in addition. -\" Copying with changes limited to the covers, as long as they preserve -\" the title of the Document and satisfy these conditions, can be treated -\" as verbatim copying in other respects. -\" .PP -\" If the required texts for either cover are too voluminous to fit -\" legibly, you should put the first ones listed (as many as fit -\" reasonably) on the actual cover, and continue the rest onto adjacent -\" pages. -\" .PP -\" If you publish or distribute Opaque copies of the Document numbering -\" more than 100, you must either include a machine-readable Transparent -\" copy along with each Opaque copy, or state in or with each Opaque copy -\" a publicly-accessible computer-network location containing a complete -\" Transparent copy of the Document, free of added material, which the -\" general network-using public has access to download anonymously at no -\" charge using public-standard network protocols. If you use the latter -\" option, you must take reasonably prudent steps, when you begin -\" distribution of Opaque copies in quantity, to ensure that this -\" Transparent copy will remain thus accessible at the stated location -\" until at least one year after the last time you distribute an Opaque -\" copy (directly or through your agents or retailers) of that edition to -\" the public. -\" .PP -\" It is requested, but not required, that you contact the authors of the -\" Document well before redistributing any large number of copies, to give -\" them a chance to provide you with an updated version of the Document. -\" .PP -\" 4. MODIFICATIONS -\" .PP -\" You may copy and distribute a Modified Version of the Document under -\" the conditions of sections 2 and 3 above, provided that you release -\" the Modified Version under precisely this License, with the Modified -\" Version filling the role of the Document, thus licensing distribution -\" and modification of the Modified Version to whoever possesses a copy -\" of it. In addition, you must do these things in the Modified Version: -\" .PP -\" A. Use in the Title Page (and on the covers, if any) a title distinct -\" from that of the Document, and from those of previous versions -\" (which should, if there were any, be listed in the History section -\" of the Document). You may use the same title as a previous version -\" if the original publisher of that version gives permission. -\" .PP -\" B. List on the Title Page, as authors, one or more persons or entities -\" responsible for authorship of the modifications in the Modified -\" Version, together with at least five of the principal authors of the -\" Document (all of its principal authors, if it has less than five). -\" .PP -\" C. State on the Title page the name of the publisher of the -\" Modified Version, as the publisher. -\" .PP -\" D. Preserve all the copyright notices of the Document. -\" .PP -\" E. Add an appropriate copyright notice for your modifications -\" adjacent to the other copyright notices. -\" .PP -\" F. Include, immediately after the copyright notices, a license notice -\" giving the public permission to use the Modified Version under the -\" terms of this License, in the form shown in the Addendum below. -\" Preserve in that license notice the full lists of Invariant Sections -\" and required Cover Texts given in the Document's license notice. -\" .PP -\" H. Include an unaltered copy of this License. -\" .PP -\" I. Preserve the section entitled "History", and its title, and add to -\" it an item stating at least the title, year, new authors, and -\" publisher of the Modified Version as given on the Title Page. If -\" there is no section entitled "History" in the Document, create one -\" stating the title, year, authors, and publisher of the Document as -\" given on its Title Page, then add an item describing the Modified -\" Version as stated in the previous sentence. -\" .PP -\" J. Preserve the network location, if any, given in the Document for -\" public access to a Transparent copy of the Document, and likewise -\" the network locations given in the Document for previous versions -\" it was based on. These may be placed in the "History" section. -\" You may omit a network location for a work that was published at -\" least four years before the Document itself, or if the original -\" publisher of the version it refers to gives permission. -\" .PP -\" K. In any section entitled "Acknowledgements" or "Dedications", -\" preserve the section's title, and preserve in the section all the -\" substance and tone of each of the contributor acknowledgements -\" and/or dedications given therein. -\" .PP -\" L. Preserve all the Invariant Sections of the Document, -\" unaltered in their text and in their titles. Section numbers -\" or the equivalent are not considered part of the section titles. -\" .PP -\" M. Delete any section entitled "Endorsements". Such a section -\" may not be included in the Modified Version. -\" .PP -\" N. Do not retitle any existing section as "Endorsements" -\" or to conflict in title with any Invariant Section. -\" .PP -\" If the Modified Version includes new front-matter sections or -\" appendices that qualify as Secondary Sections and contain no material -\" copied from the Document, you may at your option designate some or all -\" of these sections as invariant. To do this, add their titles to the -\" list of Invariant Sections in the Modified Version's license notice. -\" These titles must be distinct from any other section titles. -\" .PP -\" You may add a section entitled "Endorsements", provided it contains -\" nothing but endorsements of your Modified Version by various -\" parties--for example, statements of peer review or that the text has -\" been approved by an organization as the authoritative definition of a -\" standard. -\" .PP -\" You may add a passage of up to five words as a Front-Cover Text, and a -\" passage of up to 25 words as a Back-Cover Text, to the end of the list -\" of Cover Texts in the Modified Version. Only one passage of -\" Front-Cover Text and one of Back-Cover Text may be added by (or -\" through arrangements made by) any one entity. If the Document already -\" includes a cover text for the same cover, previously added by you or -\" by arrangement made by the same entity you are acting on behalf of, -\" you may not add another; but you may replace the old one, on explicit -\" permission from the previous publisher that added the old one. -\" .PP -\" The author(s) and publisher(s) of the Document do not by this License -\" give permission to use their names for publicity for or to assert or -\" imply endorsement of any Modified Version. -\" .PP - -\" 5. COMBINING DOCUMENTS -\" .PP -\" You may combine the Document with other documents released under this -\" License, under the terms defined in section 4 above for modified -\" versions, provided that you include in the combination all of the -\" Invariant Sections of all of the original documents, unmodified, and -\" list them all as Invariant Sections of your combined work in its -\" license notice. -\" .PP -\" The combined work need only contain one copy of this License, and -\" multiple identical Invariant Sections may be replaced with a single -\" copy. If there are multiple Invariant Sections with the same name but -\" different contents, make the title of each such section unique by -\" adding at the end of it, in parentheses, the name of the original -\" author or publisher of that section if known, or else a unique number. -\" Make the same adjustment to the section titles in the list of -\" Invariant Sections in the license notice of the combined work. -\" .PP -\" In the combination, you must combine any sections entitled "History" -\" in the various original documents, forming one section entitled -\" "History"; likewise combine any sections entitled "Acknowledgements", -\" and any sections entitled "Dedications". You must delete all sections -\" entitled "Endorsements." -\" .PP - -\" 6. COLLECTIONS OF DOCUMENTS -\" .PP -\" You may make a collection consisting of the Document and other documents -\" released under this License, and replace the individual copies of this -\" License in the various documents with a single copy that is included in -\" the collection, provided that you follow the rules of this License for -\" verbatim copying of each of the documents in all other respects. -\" .PP -\" You may extract a single document from such a collection, and distribute -\" it individually under this License, provided you insert a copy of this -\" License into the extracted document, and follow this License in all -\" other respects regarding verbatim copying of that document. -\" .PP - -\" 7. AGGREGATION WITH INDEPENDENT WORKS -\" .PP -\" A compilation of the Document or its derivatives with other separate -\" and independent documents or works, in or on a volume of a storage or -\" distribution medium, does not as a whole count as a Modified Version -\" of the Document, provided no compilation copyright is claimed for the -\" compilation. Such a compilation is called an "aggregate", and this -\" License does not apply to the other self-contained works thus compiled -\" with the Document, on account of their being thus compiled, if they -\" are not themselves derivative works of the Document. -\" .PP -\" If the Cover Text requirement of section 3 is applicable to these -\" copies of the Document, then if the Document is less than one quarter -\" of the entire aggregate, the Document's Cover Texts may be placed on -\" covers that surround only the Document within the aggregate. -\" Otherwise they must appear on covers around the whole aggregate. -\" .PP - -\" 8. TRANSLATION -\" .PP -\" Translation is considered a kind of modification, so you may -\" distribute translations of the Document under the terms of section 4. -\" Replacing Invariant Sections with translations requires special -\" permission from their copyright holders, but you may include -\" translations of some or all Invariant Sections in addition to the -\" original versions of these Invariant Sections. You may include a -\" translation of this License provided that you also include the -\" original English version of this License. In case of a disagreement -\" between the translation and the original English version of this -\" License, the original English version will prevail. -\" .PP - -\" 9. TERMINATION -\" .PP -\" You may not copy, modify, sublicense, or distribute the Document except -\" as expressly provided for under this License. Any other attempt to -\" copy, modify, sublicense or distribute the Document 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. -\" .PP - -\" 10. FUTURE REVISIONS OF THIS LICENSE -\" .PP -\" The Free Software Foundation may publish new, revised versions -\" of the GNU Free Documentation 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. See -\" http://www.gnu.org/copyleft/. -\" .PP -\" Each version of the License is given a distinguishing version number. -\" If the Document specifies that a particular numbered version of this -\" License "or any later version" applies to it, you have the option of -\" following the terms and conditions either of that specified version or -\" of any later version that has been published (not as a draft) by the -\" Free Software Foundation. If the Document does not specify a version -\" number of this License, you may choose any version ever published (not -\" as a draft) by the Free Software Foundation. -\" .PP - -\" ADDENDUM: How to use this License for your documents -\" .PP -\" To use this License in a document you have written, include a copy of -\" the License in the document and put the following copyright and -\" license notices just after the title page: -\" .PP -\" Copyright (c) YEAR YOUR NAME. -\" Permission is granted to copy, distribute and/or -\" modify this document under the terms of the GNU -\" Free Documentation License, Version 1.1 or any later -\" version published by the Free Software Foundation; -\" with the Invariant Sections being LIST THEIR TITLES, -\" with the Front-Cover Texts being LIST, and with the -\" Back-Cover Texts being LIST. A copy of the license -\" is included in the section entitled "GNU Free -\" Documentation License". -\" .PP -\" If you have no Invariant Sections, write "with no Invariant Sections" -\" instead of saying which ones are invariant. If you have no -\" Front-Cover Texts, write "no Front-Cover Texts" instead of -\" "Front-Cover Texts being LIST"; likewise for Back-Cover Texts. -\" .PP -\" If your document contains nontrivial examples of program code, we -\" recommend releasing these examples in parallel under your choice of -\" free software license, such as the GNU General Public License, -\" to permit their use in free software. diff --git a/binutils/strip.1 b/binutils/strip.1 deleted file mode 100644 index 83c3fe6030562..0000000000000 --- a/binutils/strip.1 +++ /dev/null @@ -1,542 +0,0 @@ -.\" Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 1998, 2000 Free Software Foundation -.\" See section COPYING for conditions for redistribution -.TH strip 1 "5 November 1991" "Free Software Foundation" "GNU Development Tools" -.de BP -.sp -.ti \-.2i -\(** -.. - -.SH NAME -strip \- Discard symbols from object files. - -.SH SYNOPSIS -.hy 0 -.na -.B strip -.RB "[\|" \-F\ \fIbfdname\fR\ |\ \fB\-\-target=\fIbfdname\fP "\|]" -.RB "[\|" \-I\ \fIbfdname\fR\ |\ \fB\-\-input\-target=\fIbfdname\fP "\|]" -.RB "[\|" \-O\ \fIbfdname\fR\ |\ \fB\-\-output\-target=\fIbfdname\fP "\|]" -.RB "[\|" \-R\ \fIsectionname\fR\ |\ \fB\-\-remove\-section=\fIsectionname\fP "\|]" -.RB "[\|" \-s\fR\ |\ \fB\-\-strip\-all "\|]" -.RB "[\|" \-S\fR\ |\ \fB\-g\fR\ |\ \fB\-\-strip\-debug "\|]" -.RB "[\|" \-\-strip\-unneeded\fR "\|]" -.RB "[\|" \-x\fR\ |\ \fB\-\-discard\-all "\|]" -.RB "[\|" \-X\fR\ |\ \fB\-\-discard\-locals "\|]" -.RB "[\|" \-K\ \fIsymbolname\fR\ |\ \fB\-\-keep\-symbol=\fIsymbolname\fR "\|]" -.RB "[\|" \-N\ \fIsymbolname\fR\ |\ \fB\-\-strip\-symbol=\fIsymbolname\fR "\|]" -.RB "[\|" \-o\ \fIfile\fR "\|]" -.RB "[\|" \-p\fR\ |\ \fB\-\-preserve\-dates "\|]" -.RB "[\|" \-v\fR\ |\ \fB\-\-verbose "\|]" -.RB "[\|" \-V\fR\ |\ \fB\-\-version "\|]" -.RB "[\|" \-V\fR\ |\ \fB\-\-help "\|]" -.I objfile\c -\&.\|.\|. - -.SH DESCRIPTION -GNU -.B strip -discards all symbols from the object files -.IR objfile . -The list of object files may include archives. -At least one object file must be given. - -.P -.B strip -modifies the files named in its argument, -rather than writing modified copies under different names. - -.SH OPTIONS -.TP -.B "\-F \fIbfdname" -.TP -.B "\-\-target=\fIbfdname" -Treat the original \fIobjfile\fP as a file with the object -code format \fIbfdname\fP, and rewrite it in the same format. - -.TP -.B \-\-help -Show a summary of the options to -.B strip -and exit. - -.TP -.B "\-I \fIbfdname -.TP -.B "\-\-input\-target=\fIbfdname" -Treat the original \fIobjfile\fP as a file with the object -code format \fIbfdname\fP. - -.TP -.B "\-O \fIbfdname\fP" -.TP -.B "\-\-output\-target=\fIbfdname" -Replace \fIobjfile\fP with a file in the output format \fIbfdname\fP. - -.TP -.B "\-R \fIsectionname\fP" -.TP -.B "\-\-remove\-section=\fIsectionname" -Remove the named section from the file. This option may be given more -than once. Note that using this option inappropriately may make the -object file unusable. - -.TP -.B \-s -.TP -.B \-\-strip\-all -Remove all symbols. - -.TP -.B \-S -.TP -.B \-g -.TP -.B \-\-strip\-debug -Remove debugging symbols only. - -.TP -.B \-\-strip\-unneeded -Strip all symbols that are not needed for relocation processing. - -.TP -.B \-N \fIsymbolname\fR -.TP -.B \-\-strip\-symbol=\fIsymbolname -Remove symbol \fIsymbolname\fP from the source file. This option -may be given more than once, and may be combined with other strip -options. - -.TP -.B \-o \fIfile\fR -Put the stripped output in \fIfile\fR, rather than replacing the -existing file. When this argument is used, only one \fIobjfile\fR -argument may be specified. - -.TP -.B \-p -.TP -.B \-\-preserve-dates -Preserve the access and modification dates of the file. - -.TP -.B \-x -.TP -.B \-\-discard\-all -Remove non-global symbols. - -.TP -.B \-X -.TP -.B \-\-discard\-locals -Remove compiler-generated local symbols. -(These usually start with ``L'' or ``.''.) - -.TP -.B \-K \fIsymbolname\fR, \fB\-\-keep\-symbol=\fIsymbolname -Copy only symbol \fIsymbolname\fP from the source file. This option -may be given more than once. - -.TP -.B \-N \fIsymbolname\fR, \fB\-\-strip\-symbol=\fIsymbolname -Do not copy symbol \fIsymbolname\fP from the source file. This option -may be given more than once, and may be combined with strip options -other than \fB\-K\fR. - -.TP -.B \-v -.TP -.B \-\-verbose -Verbose output: list all object files modified. In the case of -archives, -.B "strip \-v" -lists all members of the archive. - -.TP -.B \-V -.TP -.B \-\-version -Show the version number for \fBstrip\fP and exit. - -.SH "SEE ALSO" -.RB "`\|" binutils "\|'" -entry in -.BR info ; -.IR "The GNU Binary Utilities" , -Roland H. Pesch (October 1991). - -.SH COPYING -Copyright (c) 1991, 2000 Free Software Foundation, Inc. -.PP -This document is distributed under the terms of the GNU Free -Documentation License, version 1.1. That license is described in the -sources for this manual page, but it is not displayed here in order to -make this manual more consise. Copies of this license can also be -obtained from: http://www.gnu.org/copyleft/. - -\" .SH GNU Free Documentation License -\" Version 1.1, March 2000 - -\" Copyright (C) 2000 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. -\" .PP -\" 0. PREAMBLE -\" .PP -\" The purpose of this License is to make a manual, textbook, or other -\" written document "free" in the sense of freedom: to assure everyone -\" the effective freedom to copy and redistribute it, with or without -\" modifying it, either commercially or noncommercially. Secondarily, -\" this License preserves for the author and publisher a way to get -\" credit for their work, while not being considered responsible for -\" modifications made by others. -\" .PP -\" This License is a kind of "copyleft", which means that derivative -\" works of the document must themselves be free in the same sense. It -\" complements the GNU General Public License, which is a copyleft -\" license designed for free software. -\" .PP -\" We have designed this License in order to use it for manuals for free -\" software, because free software needs free documentation: a free -\" program should come with manuals providing the same freedoms that the -\" software does. But this License is not limited to software manuals; -\" it can be used for any textual work, regardless of subject matter or -\" whether it is published as a printed book. We recommend this License -\" principally for works whose purpose is instruction or reference. -\" .PP -\" 1. APPLICABILITY AND DEFINITIONS -\" .PP -\" This License applies to any manual or other work that contains a -\" notice placed by the copyright holder saying it can be distributed -\" under the terms of this License. The "Document", below, refers to any -\" such manual or work. Any member of the public is a licensee, and is -\" addressed as "you". -\" .PP -\" A "Modified Version" of the Document means any work containing the -\" Document or a portion of it, either copied verbatim, or with -\" modifications and/or translated into another language. -\" .PP -\" A "Secondary Section" is a named appendix or a front-matter section of -\" the Document that deals exclusively with the relationship of the -\" publishers or authors of the Document to the Document's overall subject -\" (or to related matters) and contains nothing that could fall directly -\" within that overall subject. (For example, if the Document is in part a -\" textbook of mathematics, a Secondary Section may not explain any -\" mathematics.) The relationship could be a matter of historical -\" connection with the subject or with related matters, or of legal, -\" commercial, philosophical, ethical or political position regarding -\" them. -\" .PP -\" The "Invariant Sections" are certain Secondary Sections whose titles -\" are designated, as being those of Invariant Sections, in the notice -\" that says that the Document is released under this License. -\" .PP -\" The "Cover Texts" are certain short passages of text that are listed, -\" as Front-Cover Texts or Back-Cover Texts, in the notice that says that -\" the Document is released under this License. -\" .PP -\" A "Transparent" copy of the Document means a machine-readable copy, -\" represented in a format whose specification is available to the -\" general public, whose contents can be viewed and edited directly and -\" straightforwardly with generic text editors or (for images composed of -\" pixels) generic paint programs or (for drawings) some widely available -\" drawing editor, and that is suitable for input to text formatters or -\" for automatic translation to a variety of formats suitable for input -\" to text formatters. A copy made in an otherwise Transparent file -\" format whose markup has been designed to thwart or discourage -\" subsequent modification by readers is not Transparent. A copy that is -\" not "Transparent" is called "Opaque". -\" .PP -\" Examples of suitable formats for Transparent copies include plain -\" ASCII without markup, Texinfo input format, LaTeX input format, SGML -\" or XML using a publicly available DTD, and standard-conforming simple -\" HTML designed for human modification. Opaque formats include -\" PostScript, PDF, proprietary formats that can be read and edited only -\" by proprietary word processors, SGML or XML for which the DTD and/or -\" processing tools are not generally available, and the -\" machine-generated HTML produced by some word processors for output -\" purposes only. -\" .PP -\" The "Title Page" means, for a printed book, the title page itself, -\" plus such following pages as are needed to hold, legibly, the material -\" this License requires to appear in the title page. For works in -\" formats which do not have any title page as such, "Title Page" means -\" the text near the most prominent appearance of the work's title, -\" preceding the beginning of the body of the text. -\" .PP -\" 2. VERBATIM COPYING -\" .PP -\" You may copy and distribute the Document in any medium, either -\" commercially or noncommercially, provided that this License, the -\" copyright notices, and the license notice saying this License applies -\" to the Document are reproduced in all copies, and that you add no other -\" conditions whatsoever to those of this License. You may not use -\" technical measures to obstruct or control the reading or further -\" copying of the copies you make or distribute. However, you may accept -\" compensation in exchange for copies. If you distribute a large enough -\" number of copies you must also follow the conditions in section 3. -\" .PP -\" You may also lend copies, under the same conditions stated above, and -\" you may publicly display copies. -\" .PP -\" 3. COPYING IN QUANTITY -\" .PP -\" If you publish printed copies of the Document numbering more than 100, -\" and the Document's license notice requires Cover Texts, you must enclose -\" the copies in covers that carry, clearly and legibly, all these Cover -\" Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -\" the back cover. Both covers must also clearly and legibly identify -\" you as the publisher of these copies. The front cover must present -\" the full title with all words of the title equally prominent and -\" visible. You may add other material on the covers in addition. -\" Copying with changes limited to the covers, as long as they preserve -\" the title of the Document and satisfy these conditions, can be treated -\" as verbatim copying in other respects. -\" .PP -\" If the required texts for either cover are too voluminous to fit -\" legibly, you should put the first ones listed (as many as fit -\" reasonably) on the actual cover, and continue the rest onto adjacent -\" pages. -\" .PP -\" If you publish or distribute Opaque copies of the Document numbering -\" more than 100, you must either include a machine-readable Transparent -\" copy along with each Opaque copy, or state in or with each Opaque copy -\" a publicly-accessible computer-network location containing a complete -\" Transparent copy of the Document, free of added material, which the -\" general network-using public has access to download anonymously at no -\" charge using public-standard network protocols. If you use the latter -\" option, you must take reasonably prudent steps, when you begin -\" distribution of Opaque copies in quantity, to ensure that this -\" Transparent copy will remain thus accessible at the stated location -\" until at least one year after the last time you distribute an Opaque -\" copy (directly or through your agents or retailers) of that edition to -\" the public. -\" .PP -\" It is requested, but not required, that you contact the authors of the -\" Document well before redistributing any large number of copies, to give -\" them a chance to provide you with an updated version of the Document. -\" .PP -\" 4. MODIFICATIONS -\" .PP -\" You may copy and distribute a Modified Version of the Document under -\" the conditions of sections 2 and 3 above, provided that you release -\" the Modified Version under precisely this License, with the Modified -\" Version filling the role of the Document, thus licensing distribution -\" and modification of the Modified Version to whoever possesses a copy -\" of it. In addition, you must do these things in the Modified Version: -\" .PP -\" A. Use in the Title Page (and on the covers, if any) a title distinct -\" from that of the Document, and from those of previous versions -\" (which should, if there were any, be listed in the History section -\" of the Document). You may use the same title as a previous version -\" if the original publisher of that version gives permission. -\" .PP -\" B. List on the Title Page, as authors, one or more persons or entities -\" responsible for authorship of the modifications in the Modified -\" Version, together with at least five of the principal authors of the -\" Document (all of its principal authors, if it has less than five). -\" .PP -\" C. State on the Title page the name of the publisher of the -\" Modified Version, as the publisher. -\" .PP -\" D. Preserve all the copyright notices of the Document. -\" .PP -\" E. Add an appropriate copyright notice for your modifications -\" adjacent to the other copyright notices. -\" .PP -\" F. Include, immediately after the copyright notices, a license notice -\" giving the public permission to use the Modified Version under the -\" terms of this License, in the form shown in the Addendum below. -\" Preserve in that license notice the full lists of Invariant Sections -\" and required Cover Texts given in the Document's license notice. -\" .PP -\" H. Include an unaltered copy of this License. -\" .PP -\" I. Preserve the section entitled "History", and its title, and add to -\" it an item stating at least the title, year, new authors, and -\" publisher of the Modified Version as given on the Title Page. If -\" there is no section entitled "History" in the Document, create one -\" stating the title, year, authors, and publisher of the Document as -\" given on its Title Page, then add an item describing the Modified -\" Version as stated in the previous sentence. -\" .PP -\" J. Preserve the network location, if any, given in the Document for -\" public access to a Transparent copy of the Document, and likewise -\" the network locations given in the Document for previous versions -\" it was based on. These may be placed in the "History" section. -\" You may omit a network location for a work that was published at -\" least four years before the Document itself, or if the original -\" publisher of the version it refers to gives permission. -\" .PP -\" K. In any section entitled "Acknowledgements" or "Dedications", -\" preserve the section's title, and preserve in the section all the -\" substance and tone of each of the contributor acknowledgements -\" and/or dedications given therein. -\" .PP -\" L. Preserve all the Invariant Sections of the Document, -\" unaltered in their text and in their titles. Section numbers -\" or the equivalent are not considered part of the section titles. -\" .PP -\" M. Delete any section entitled "Endorsements". Such a section -\" may not be included in the Modified Version. -\" .PP -\" N. Do not retitle any existing section as "Endorsements" -\" or to conflict in title with any Invariant Section. -\" .PP -\" If the Modified Version includes new front-matter sections or -\" appendices that qualify as Secondary Sections and contain no material -\" copied from the Document, you may at your option designate some or all -\" of these sections as invariant. To do this, add their titles to the -\" list of Invariant Sections in the Modified Version's license notice. -\" These titles must be distinct from any other section titles. -\" .PP -\" You may add a section entitled "Endorsements", provided it contains -\" nothing but endorsements of your Modified Version by various -\" parties--for example, statements of peer review or that the text has -\" been approved by an organization as the authoritative definition of a -\" standard. -\" .PP -\" You may add a passage of up to five words as a Front-Cover Text, and a -\" passage of up to 25 words as a Back-Cover Text, to the end of the list -\" of Cover Texts in the Modified Version. Only one passage of -\" Front-Cover Text and one of Back-Cover Text may be added by (or -\" through arrangements made by) any one entity. If the Document already -\" includes a cover text for the same cover, previously added by you or -\" by arrangement made by the same entity you are acting on behalf of, -\" you may not add another; but you may replace the old one, on explicit -\" permission from the previous publisher that added the old one. -\" .PP -\" The author(s) and publisher(s) of the Document do not by this License -\" give permission to use their names for publicity for or to assert or -\" imply endorsement of any Modified Version. -\" .PP - -\" 5. COMBINING DOCUMENTS -\" .PP -\" You may combine the Document with other documents released under this -\" License, under the terms defined in section 4 above for modified -\" versions, provided that you include in the combination all of the -\" Invariant Sections of all of the original documents, unmodified, and -\" list them all as Invariant Sections of your combined work in its -\" license notice. -\" .PP -\" The combined work need only contain one copy of this License, and -\" multiple identical Invariant Sections may be replaced with a single -\" copy. If there are multiple Invariant Sections with the same name but -\" different contents, make the title of each such section unique by -\" adding at the end of it, in parentheses, the name of the original -\" author or publisher of that section if known, or else a unique number. -\" Make the same adjustment to the section titles in the list of -\" Invariant Sections in the license notice of the combined work. -\" .PP -\" In the combination, you must combine any sections entitled "History" -\" in the various original documents, forming one section entitled -\" "History"; likewise combine any sections entitled "Acknowledgements", -\" and any sections entitled "Dedications". You must delete all sections -\" entitled "Endorsements." -\" .PP - -\" 6. COLLECTIONS OF DOCUMENTS -\" .PP -\" You may make a collection consisting of the Document and other documents -\" released under this License, and replace the individual copies of this -\" License in the various documents with a single copy that is included in -\" the collection, provided that you follow the rules of this License for -\" verbatim copying of each of the documents in all other respects. -\" .PP -\" You may extract a single document from such a collection, and distribute -\" it individually under this License, provided you insert a copy of this -\" License into the extracted document, and follow this License in all -\" other respects regarding verbatim copying of that document. -\" .PP - -\" 7. AGGREGATION WITH INDEPENDENT WORKS -\" .PP -\" A compilation of the Document or its derivatives with other separate -\" and independent documents or works, in or on a volume of a storage or -\" distribution medium, does not as a whole count as a Modified Version -\" of the Document, provided no compilation copyright is claimed for the -\" compilation. Such a compilation is called an "aggregate", and this -\" License does not apply to the other self-contained works thus compiled -\" with the Document, on account of their being thus compiled, if they -\" are not themselves derivative works of the Document. -\" .PP -\" If the Cover Text requirement of section 3 is applicable to these -\" copies of the Document, then if the Document is less than one quarter -\" of the entire aggregate, the Document's Cover Texts may be placed on -\" covers that surround only the Document within the aggregate. -\" Otherwise they must appear on covers around the whole aggregate. -\" .PP - -\" 8. TRANSLATION -\" .PP -\" Translation is considered a kind of modification, so you may -\" distribute translations of the Document under the terms of section 4. -\" Replacing Invariant Sections with translations requires special -\" permission from their copyright holders, but you may include -\" translations of some or all Invariant Sections in addition to the -\" original versions of these Invariant Sections. You may include a -\" translation of this License provided that you also include the -\" original English version of this License. In case of a disagreement -\" between the translation and the original English version of this -\" License, the original English version will prevail. -\" .PP - -\" 9. TERMINATION -\" .PP -\" You may not copy, modify, sublicense, or distribute the Document except -\" as expressly provided for under this License. Any other attempt to -\" copy, modify, sublicense or distribute the Document 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. -\" .PP - -\" 10. FUTURE REVISIONS OF THIS LICENSE -\" .PP -\" The Free Software Foundation may publish new, revised versions -\" of the GNU Free Documentation 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. See -\" http://www.gnu.org/copyleft/. -\" .PP -\" Each version of the License is given a distinguishing version number. -\" If the Document specifies that a particular numbered version of this -\" License "or any later version" applies to it, you have the option of -\" following the terms and conditions either of that specified version or -\" of any later version that has been published (not as a draft) by the -\" Free Software Foundation. If the Document does not specify a version -\" number of this License, you may choose any version ever published (not -\" as a draft) by the Free Software Foundation. -\" .PP - -\" ADDENDUM: How to use this License for your documents -\" .PP -\" To use this License in a document you have written, include a copy of -\" the License in the document and put the following copyright and -\" license notices just after the title page: -\" .PP -\" Copyright (c) YEAR YOUR NAME. -\" Permission is granted to copy, distribute and/or -\" modify this document under the terms of the GNU -\" Free Documentation License, Version 1.1 or any later -\" version published by the Free Software Foundation; -\" with the Invariant Sections being LIST THEIR TITLES, -\" with the Front-Cover Texts being LIST, and with the -\" Back-Cover Texts being LIST. A copy of the license -\" is included in the section entitled "GNU Free -\" Documentation License". -\" .PP -\" If you have no Invariant Sections, write "with no Invariant Sections" -\" instead of saying which ones are invariant. If you have no -\" Front-Cover Texts, write "no Front-Cover Texts" instead of -\" "Front-Cover Texts being LIST"; likewise for Back-Cover Texts. -\" .PP -\" If your document contains nontrivial examples of program code, we -\" recommend releasing these examples in parallel under your choice of -\" free software license, such as the GNU General Public License, -\" to permit their use in free software. diff --git a/binutils/sysinfo.c b/binutils/sysinfo.c new file mode 100644 index 0000000000000..4a2be729d0f45 --- /dev/null +++ b/binutils/sysinfo.c @@ -0,0 +1,1512 @@ +/* A Bison parser, made from sysinfo.y + by GNU bison 1.35. */ + +#define YYBISON 1 /* Identify Bison output. */ + +# define COND 257 +# define REPEAT 258 +# define TYPE 259 +# define NAME 260 +# define NUMBER 261 +# define UNIT 262 + +#line 20 "sysinfo.y" + +#include +#include + +extern char *word; +extern char writecode; +extern int number; +extern int unit; +char nice_name[1000]; +char *it; +int sofar; +int width; +int code; +char * repeat; +char *oldrepeat; +char *name; +int rdepth; +char *loop [] = {"","n","m","/*BAD*/"}; +char *names[] = {" ","[n]","[n][m]"}; +char *pnames[]= {"","*","**"}; + +#line 43 "sysinfo.y" +#ifndef YYSTYPE +typedef union { + int i; + char *s; +} yystype; +# define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 +#endif +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + + + +#define YYFINAL 55 +#define YYFLAG -32768 +#define YYNTBASE 11 + +/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ +#define YYTRANSLATE(x) ((unsigned)(x) <= 262 ? yytranslate[x] : 29) + +/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ +static const char 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, 2, 2, + 5, 6, 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, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 3, 4, 7, + 8, 9, 10 +}; + +#if YYDEBUG +static const short yyprhs[] = +{ + 0, 0, 1, 4, 7, 8, 9, 16, 19, 22, + 25, 26, 27, 34, 35, 42, 43, 54, 56, 57, + 61, 64, 68, 69, 70, 74, 75 +}; +static const short yyrhs[] = +{ + -1, 12, 13, 0, 14, 13, 0, 0, 0, 5, + 8, 9, 15, 16, 6, 0, 21, 16, 0, 19, + 16, 0, 17, 16, 0, 0, 0, 5, 4, 8, + 18, 16, 6, 0, 0, 5, 3, 8, 20, 16, + 6, 0, 0, 5, 24, 5, 23, 25, 6, 26, + 22, 27, 6, 0, 7, 0, 0, 5, 8, 6, + 0, 9, 10, 0, 5, 8, 6, 0, 0, 0, + 5, 28, 6, 0, 0, 28, 5, 8, 8, 6, + 0 +}; + +#endif + +#if YYDEBUG +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const short yyrline[] = +{ + 0, 57, 57, 95, 96, 99, 99, 177, 179, 180, + 181, 184, 184, 231, 231, 257, 257, 365, 367, 370, + 375, 381, 383, 386, 387, 389, 390 +}; +#endif + + +#if (YYDEBUG) || defined YYERROR_VERBOSE + +/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ +static const char *const yytname[] = +{ + "$", "error", "$undefined.", "COND", "REPEAT", "'('", "')'", "TYPE", + "NAME", "NUMBER", "UNIT", "top", "@1", "it_list", "it", "@2", + "it_field_list", "repeat_it_field", "@3", "cond_it_field", "@4", + "it_field", "@5", "attr_type", "attr_desc", "attr_size", "attr_id", + "enums", "enum_list", 0 +}; +#endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const short yyr1[] = +{ + 0, 12, 11, 13, 13, 15, 14, 16, 16, 16, + 16, 18, 17, 20, 19, 22, 21, 23, 23, 24, + 25, 26, 26, 27, 27, 28, 28 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const short yyr2[] = +{ + 0, 0, 2, 2, 0, 0, 6, 2, 2, 2, + 0, 0, 6, 0, 6, 0, 10, 1, 0, 3, + 2, 3, 0, 0, 3, 0, 5 +}; + +/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE + doesn't specify something else to do. Zero means the default is an + error. */ +static const short yydefact[] = +{ + 1, 4, 0, 2, 4, 0, 3, 5, 10, 0, + 0, 10, 10, 10, 0, 0, 0, 0, 6, 9, + 8, 7, 13, 11, 0, 18, 10, 10, 19, 17, + 0, 0, 0, 0, 0, 14, 12, 20, 22, 0, + 15, 0, 23, 21, 25, 0, 0, 16, 0, 24, + 0, 0, 26, 0, 0, 0 +}; + +static const short yydefgoto[] = +{ + 53, 1, 3, 4, 8, 10, 11, 27, 12, 26, + 13, 42, 30, 17, 34, 40, 45, 46 +}; + +static const short yypact[] = +{ + -32768, 3, 2,-32768, 3, 4,-32768,-32768, 6, 0, + 8, 6, 6, 6, 9, 10, 11, 7,-32768,-32768, + -32768,-32768,-32768,-32768, 14, 15, 6, 6,-32768,-32768, + 12, 17, 18, -1, 19,-32768,-32768,-32768, 21, 20, + -32768, 23, 22,-32768,-32768, 24, 1,-32768, 25,-32768, + 26, 29,-32768, 31, 32,-32768 +}; + +static const short yypgoto[] = +{ + -32768,-32768, 33,-32768,-32768, -11,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768 +}; + + +#define YYLAST 37 + + +static const short yytable[] = +{ + 19, 20, 21, 14, 15, 16, 48, 49, 2, 37, + 5, 9, 25, 7, 18, 31, 32, 22, 23, 24, + 28, 33, 29, 35, 36, 38, 39, 44, 41, 43, + 47, 54, 55, 50, 51, 52, 0, 6 +}; + +static const short yycheck[] = +{ + 11, 12, 13, 3, 4, 5, 5, 6, 5, 10, + 8, 5, 5, 9, 6, 26, 27, 8, 8, 8, + 6, 9, 7, 6, 6, 6, 5, 5, 8, 6, + 6, 0, 0, 8, 8, 6, -1, 4 +}; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/share/bison-1.35/bison.simple" + +/* Skeleton output parser for bison, + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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. */ + +/* 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 is the parser code that is written into each bison parser when + the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* 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. */ + +#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# else +# ifndef YYSTACK_USE_ALLOCA +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# 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 /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free +# endif +#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short yyss; + YYSTYPE yyvs; +# if YYLSP_NEEDED + YYLTYPE yyls; +# endif +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# if YYLSP_NEEDED +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAX) +# else +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAX) +# endif + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if 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; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (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_MAX; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + + +#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 /* 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 +#define YYEOF 0 +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* 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); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror ("syntax error: cannot back up"); \ + YYERROR; \ + } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). + + When YYLLOC_DEFAULT is run, CURRENT is set the location of the + first token. By default, to implement support for ranges, extend + its range to the last symbol. */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + Current.last_line = Rhs[N].last_line; \ + Current.last_column = Rhs[N].last_column; +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#if YYPURE +# if YYLSP_NEEDED +# ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +# else +# define YYLEX yylex (&yylval, &yylloc) +# endif +# else /* !YYLSP_NEEDED */ +# ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, YYLEX_PARAM) +# else +# define YYLEX yylex (&yylval) +# endif +# endif /* !YYLSP_NEEDED */ +#else /* !YYPURE */ +# define YYLEX yylex () +#endif /* !YYPURE */ + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +#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 + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#if YYMAXDEPTH == 0 +# undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + +#ifdef YYERROR_VERBOSE + +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif +{ + register const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; +} +# 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. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif +{ + register char *yyd = yydest; + register const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif +#endif + +#line 315 "/usr/share/bison-1.35/bison.simple" + + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +# define YYPARSE_PARAM_DECL +# else +# define YYPARSE_PARAM_ARG YYPARSE_PARAM +# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +# endif +#else /* !YYPARSE_PARAM */ +# define YYPARSE_PARAM_ARG +# define YYPARSE_PARAM_DECL +#endif /* !YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +# ifdef YYPARSE_PARAM +int yyparse (void *); +# else +int yyparse (void); +# endif +#endif + +/* YY_DECL_VARIABLES -- depending whether we use a pure parser, + variables are global, or local to YYPARSE. */ + +#define YY_DECL_NON_LSP_VARIABLES \ +/* The lookahead symbol. */ \ +int yychar; \ + \ +/* The semantic value of the lookahead symbol. */ \ +YYSTYPE yylval; \ + \ +/* Number of parse errors so far. */ \ +int yynerrs; + +#if YYLSP_NEEDED +# define YY_DECL_VARIABLES \ +YY_DECL_NON_LSP_VARIABLES \ + \ +/* Location data for the lookahead symbol. */ \ +YYLTYPE yylloc; +#else +# define YY_DECL_VARIABLES \ +YY_DECL_NON_LSP_VARIABLES +#endif + + +/* If nonreentrant, generate the variables here. */ + +#if !YYPURE +YY_DECL_VARIABLES +#endif /* !YYPURE */ + +int +yyparse (YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + /* If reentrant, generate the variables here. */ +#if YYPURE + YY_DECL_VARIABLES +#endif /* !YYPURE */ + + register int yystate; + register int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Lookahead token as an internal (translated) token number. */ + int yychar1 = 0; + + /* 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. */ + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; + register short *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; + +#if YYLSP_NEEDED + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; +#endif + +#if YYLSP_NEEDED +# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +# define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + YYSIZE_T yystacksize = YYINITDEPTH; + + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; +#if YYLSP_NEEDED + YYLTYPE yyloc; +#endif + + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; + + 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; +#if YYLSP_NEEDED + yylsp = yyls; +#endif + 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 (yyssp >= yyss + yystacksize - 1) + { + /* 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; + short *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. */ +# if YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; + /* 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", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + yyls = yyls1; +# else + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); +# endif + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + goto yyoverflowlab; + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + + { + short *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); +# if YYLSP_NEEDED + YYSTACK_RELOCATE (yyls); +# endif +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; +#if YYLSP_NEEDED + yylsp = yyls + yysize - 1; +#endif + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; + + +/*-----------. +| yybackup. | +`-----------*/ +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. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yychar1 = YYTRANSLATE (yychar); + +#if YYDEBUG + /* We have to keep this `#if YYDEBUG', since we use variables + which are defined only if `YYDEBUG' is set. */ + if (yydebug) + { + YYFPRINTF (stderr, "Next token is %d (%s", + yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise + meaning of a token, for further debugging info. */ +# ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +# endif + YYFPRINTF (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + YYDPRINTF ((stderr, "Shifting token %d (%s), ", + yychar, yytname[yychar1])); + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#if YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + yystate = yyn; + 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 the semantic value of + the lookahead token. 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]; + +#if YYLSP_NEEDED + /* Similarly for the default location. Let the user run additional + commands if for instance locations are ranges. */ + yyloc = yylsp[1-yylen]; + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); +#endif + +#if YYDEBUG + /* We have to keep this `#if YYDEBUG', since we use variables which + are defined only if `YYDEBUG' is set. */ + if (yydebug) + { + int yyi; + + YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + switch (yyn) { + +case 1: +#line 57 "sysinfo.y" +{ + switch (writecode) + { + case 'i': + printf("#ifdef SYSROFF_SWAP_IN\n"); + break; + case 'p': + printf("#ifdef SYSROFF_p\n"); + break; + case 'd': + break; + case 'g': + printf("#ifdef SYSROFF_SWAP_OUT\n"); + break; + case 'c': + printf("#ifdef SYSROFF_PRINT\n"); + printf("#include \n"); + printf("#include \n"); + printf("#include \n"); + break; + } + } + break; +case 2: +#line 79 "sysinfo.y" +{ + switch (writecode) { + case 'i': + case 'p': + case 'g': + case 'c': + printf("#endif\n"); + break; + case 'd': + break; + } +} + break; +case 5: +#line 101 "sysinfo.y" +{ + it = yyvsp[-1].s; code = yyvsp[0].i; + switch (writecode) + { + case 'd': + printf("\n\n\n#define IT_%s_CODE 0x%x\n", it,code); + printf("struct IT_%s;\n", it); + printf("extern void sysroff_swap_%s_in PARAMS ((struct IT_%s *));\n", + yyvsp[-1].s, it); + printf("extern void sysroff_swap_%s_out PARAMS ((FILE *, struct IT_%s *));\n", + yyvsp[-1].s, it); + printf("extern void sysroff_print_%s_out PARAMS ((struct IT_%s *));\n", + yyvsp[-1].s, it); + printf("struct IT_%s { \n", it); + break; + case 'i': + printf("void sysroff_swap_%s_in(ptr)\n",yyvsp[-1].s); + printf("struct IT_%s *ptr;\n", it); + printf("{\n"); + printf("char raw[255];\n"); + printf("\tint idx = 0 ;\n"); + printf("\tint size;\n"); + printf("memset(raw,0,255);\n"); + printf("memset(ptr,0,sizeof(*ptr));\n"); + printf("size = fillup(raw);\n"); + break; + case 'g': + printf("void sysroff_swap_%s_out(file,ptr)\n",yyvsp[-1].s); + printf("FILE * file;\n"); + printf("struct IT_%s *ptr;\n", it); + printf("{\n"); + printf("\tchar raw[255];\n"); + printf("\tint idx = 16 ;\n"); + printf("\tmemset (raw, 0, 255);\n"); + printf("\tcode = IT_%s_CODE;\n", it); + break; + case 'o': + printf("void sysroff_swap_%s_out(abfd,ptr)\n",yyvsp[-1].s); + printf("bfd * abfd;\n"); + printf("struct IT_%s *ptr;\n",it); + printf("{\n"); + printf("int idx = 0 ;\n"); + break; + case 'c': + printf("void sysroff_print_%s_out(ptr)\n",yyvsp[-1].s); + printf("struct IT_%s *ptr;\n", it); + printf("{\n"); + printf("itheader(\"%s\", IT_%s_CODE);\n",yyvsp[-1].s,yyvsp[-1].s); + break; + + case 't': + break; + } + + } + break; +case 6: +#line 158 "sysinfo.y" +{ + switch (writecode) { + case 'd': + printf("};\n"); + break; + case 'g': + printf("\tchecksum(file,raw, idx, IT_%s_CODE);\n", it); + + case 'i': + + case 'o': + case 'c': + printf("}\n"); + } +} + break; +case 11: +#line 185 "sysinfo.y" +{ + rdepth++; + switch (writecode) + { + case 'c': + if (rdepth==1) + printf("\tprintf(\"repeat %%d\\n\", %s);\n",yyvsp[0].s); + if (rdepth==2) + printf("\tprintf(\"repeat %%d\\n\", %s[n]);\n",yyvsp[0].s); + case 'i': + case 'g': + case 'o': + + if (rdepth==1) + { + printf("\t{ int n; for (n = 0; n < %s; n++) {\n", yyvsp[0].s); + } + if (rdepth == 2) { + printf("\t{ int m; for (m = 0; m < %s[n]; m++) {\n", yyvsp[0].s); + } + + break; + } + + oldrepeat = repeat; + repeat = yyvsp[0].s; + } + break; +case 12: +#line 215 "sysinfo.y" +{ + repeat = oldrepeat; + oldrepeat =0; + rdepth--; + switch (writecode) + { + case 'i': + case 'g': + case 'o': + case 'c': + printf("\t}}\n"); + } + } + break; +case 13: +#line 232 "sysinfo.y" +{ + switch (writecode) + { + case 'i': + case 'g': + case 'o': + case 'c': + printf("\tif (%s) {\n", yyvsp[0].s); + break; + } + } + break; +case 14: +#line 245 "sysinfo.y" +{ + switch (writecode) + { + case 'i': + case 'g': + case 'o': + case 'c': + printf("\t}\n"); + } + } + break; +case 15: +#line 259 "sysinfo.y" +{name = yyvsp[0].s; } + break; +case 16: +#line 261 "sysinfo.y" +{ + char *desc = yyvsp[-8].s; + char *type = yyvsp[-6].s; + int size = yyvsp[-5].i; + char *id = yyvsp[-3].s; +char *p = names[rdepth]; +char *ptr = pnames[rdepth]; + switch (writecode) + { + case 'g': + if (size % 8) + { + + printf("\twriteBITS(ptr->%s%s,raw,&idx,%d);\n", + id, + names[rdepth], size); + + } + else { + printf("\twrite%s(ptr->%s%s,raw,&idx,%d,file);\n", + type, + id, + names[rdepth],size/8); + } + break; + case 'i': + { + + if (rdepth >= 1) + + { + printf("if (!ptr->%s) ptr->%s = (%s*)xcalloc(%s, sizeof(ptr->%s[0]));\n", + id, + id, + type, + repeat, + id); + } + + if (rdepth == 2) + { + printf("if (!ptr->%s[n]) ptr->%s[n] = (%s**)xcalloc(%s[n], sizeof(ptr->%s[n][0]));\n", + id, + id, + type, + repeat, + id); + } + + } + + if (size % 8) + { + printf("\tptr->%s%s = getBITS(raw,&idx, %d,size);\n", + id, + names[rdepth], + size); + } + else { + printf("\tptr->%s%s = get%s(raw,&idx, %d,size);\n", + id, + names[rdepth], + type, + size/8); + } + break; + case 'o': + printf("\tput%s(raw,%d,%d,&idx,ptr->%s%s);\n", type,size/8,size%8,id,names[rdepth]); + break; + case 'd': + if (repeat) + printf("\t/* repeat %s */\n", repeat); + + if (type[0] == 'I') { + printf("\tint %s%s; \t/* %s */\n",ptr,id, desc); + } + else if (type[0] =='C') { + printf("\tchar %s*%s;\t /* %s */\n",ptr,id, desc); + } + else { + printf("\tbarray %s%s;\t /* %s */\n",ptr,id, desc); + } + break; + case 'c': + printf("tabout();\n"); + printf("\tprintf(\"/*%-30s*/ ptr->%s = \");\n", desc, id); + + if (type[0] == 'I') + printf("\tprintf(\"%%d\\n\",ptr->%s%s);\n", id,p); + else if (type[0] == 'C') + printf("\tprintf(\"%%s\\n\",ptr->%s%s);\n", id,p); + + else if (type[0] == 'B') + { + printf("\tpbarray(&ptr->%s%s);\n", id,p); + } + else abort(); + break; + } + } + break; +case 17: +#line 366 "sysinfo.y" +{ yyval.s = yyvsp[0].s; } + break; +case 18: +#line 367 "sysinfo.y" +{ yyval.s = "INT";} + break; +case 19: +#line 372 "sysinfo.y" +{ yyval.s = yyvsp[-1].s; } + break; +case 20: +#line 377 "sysinfo.y" +{ yyval.i = yyvsp[-1].i * yyvsp[0].i; } + break; +case 21: +#line 382 "sysinfo.y" +{ yyval.s = yyvsp[-1].s; } + break; +case 22: +#line 383 "sysinfo.y" +{ yyval.s = "dummy";} + break; +case 26: +#line 391 "sysinfo.y" +{ + switch (writecode) + { + case 'd': + printf("#define %s %s\n", yyvsp[-2].s,yyvsp[-1].s); + break; + case 'c': + printf("if (ptr->%s%s == %s) { tabout(); printf(\"%s\\n\");}\n", name, names[rdepth],yyvsp[-1].s,yyvsp[-2].s); + } + } + break; +} + +#line 705 "/usr/share/bison-1.35/bison.simple" + + + yyvsp -= yylen; + yyssp -= yylen; +#if YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG + if (yydebug) + { + short *yyssp1 = yyss - 1; + YYFPRINTF (stderr, "state stack now"); + while (yyssp1 != yyssp) + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; +#if YYLSP_NEEDED + *++yylsp = yyloc; +#endif + + /* 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 - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + char *yymsg; + int yyx, yycount; + + yycount = 0; + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) + if (yycheck[yyx + yyn] == yyx) + yysize += yystrlen (yytname[yyx]) + 15, yycount++; + yysize += yystrlen ("parse error, unexpected ") + 1; + yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "parse error, unexpected "); + yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); + + if (yycount < 5) + { + yycount = 0; + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); + yyx++) + if (yycheck[yyx + yyn] == yyx) + { + const char *yyq = ! yycount ? ", expecting " : " or "; + yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yytname[yyx]); + yycount++; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("parse error; also virtual memory exhausted"); + } + else +#endif /* defined (YYERROR_VERBOSE) */ + yyerror ("parse error"); + } + goto yyerrlab1; + + +/*--------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action | +`--------------------------------------------------*/ +yyerrlab1: + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + YYDPRINTF ((stderr, "Discarding token %d (%s).\n", + yychar, yytname[yychar1])); + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + + +/*-------------------------------------------------------------------. +| yyerrdefault -- current state does not do anything special for the | +| error token. | +`-------------------------------------------------------------------*/ +yyerrdefault: +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + + /* If its default is to accept any token, ok. Otherwise pop it. */ + yyn = yydefact[yystate]; + if (yyn) + goto yydefault; +#endif + + +/*---------------------------------------------------------------. +| yyerrpop -- pop the current state because it cannot handle the | +| error token | +`---------------------------------------------------------------*/ +yyerrpop: + if (yyssp == yyss) + YYABORT; + yyvsp--; + yystate = *--yyssp; +#if YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG + if (yydebug) + { + short *yyssp1 = yyss - 1; + YYFPRINTF (stderr, "Error: state stack now"); + while (yyssp1 != yyssp) + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); + } +#endif + +/*--------------. +| yyerrhandle. | +`--------------*/ +yyerrhandle: + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + + YYDPRINTF ((stderr, "Shifting error token, ")); + + *++yyvsp = yylval; +#if YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +/*---------------------------------------------. +| yyoverflowab -- parser overflow comes here. | +`---------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; +} +#line 406 "sysinfo.y" + +/* four modes + + -d write structure definitions for sysroff in host format + -i write functions to swap into sysroff format in + -o write functions to swap into sysroff format out + -c write code to print info in human form */ + +int yydebug; +char writecode; + +int +main (int ac, char **av) +{ + yydebug=0; + if (ac > 1) + writecode = av[1][1]; +if (writecode == 'd') + { + printf("typedef struct { unsigned char *data; int len; } barray; \n"); + printf("typedef int INT;\n"); + printf("typedef char * CHARS;\n"); + + } + yyparse(); +return 0; +} + +int +yyerror (char *s) +{ + fprintf(stderr, "%s\n" , s); + return 0; +} diff --git a/binutils/sysinfo.h b/binutils/sysinfo.h new file mode 100644 index 0000000000000..6030f15c6c7f1 --- /dev/null +++ b/binutils/sysinfo.h @@ -0,0 +1,22 @@ +#ifndef BISON_Y_TAB_H +# define BISON_Y_TAB_H + +#ifndef YYSTYPE +typedef union { + int i; + char *s; +} yystype; +# define YYSTYPE yystype +# define YYSTYPE_IS_TRIVIAL 1 +#endif +# define COND 257 +# define REPEAT 258 +# define TYPE 259 +# define NAME 260 +# define NUMBER 261 +# define UNIT 262 + + +extern YYSTYPE yylval; + +#endif /* not BISON_Y_TAB_H */ diff --git a/binutils/sysinfo.y b/binutils/sysinfo.y index 4aa46073bbbe0..bf19263c5d177 100644 --- a/binutils/sysinfo.y +++ b/binutils/sysinfo.y @@ -1,4 +1,4 @@ -/* Copyright 2001 Free Software Foundation, Inc. +/* Copyright 2001, 2003 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com). This file is part of GNU binutils. @@ -406,7 +406,7 @@ enum_list: %% /* four modes - -d write structure defintions for sysroff in host format + -d write structure definitions for sysroff in host format -i write functions to swap into sysroff format in -o write functions to swap into sysroff format out -c write code to print info in human form */ @@ -415,9 +415,7 @@ int yydebug; char writecode; int -main(ac,av) -int ac; -char **av; +main (int ac, char **av) { yydebug=0; if (ac > 1) @@ -434,8 +432,7 @@ return 0; } int -yyerror(s) - char *s; +yyerror (char *s) { fprintf(stderr, "%s\n" , s); return 0; diff --git a/binutils/syslex.c b/binutils/syslex.c new file mode 100644 index 0000000000000..75d0f41d5d1ac --- /dev/null +++ b/binutils/syslex.c @@ -0,0 +1,1720 @@ +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * $Header: /cvs/src/src/binutils/Attic/syslex.c,v 1.1.12.1 2004/04/09 19:32:16 drow Exp $ + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include +#include + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include +#ifndef _WIN32 +#include +#endif + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#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 + +/* 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 yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#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. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *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 */ \ + } \ + 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; + + +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; + + /* 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 yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* 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". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* 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_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 ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_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 ) + +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 )); + +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 * )); + +#define yy_new_buffer yy_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; \ + } + +#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; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +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[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 25 +#define YY_END_OF_BUFFER 26 +static yyconst short int yy_accept[81] = + { 0, + 0, 0, 26, 25, 7, 8, 5, 25, 1, 2, + 11, 11, 6, 3, 4, 25, 25, 25, 25, 25, + 25, 25, 0, 9, 11, 0, 6, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, + 13, 0, 0, 0, 0, 16, 0, 0, 0, 0, + 0, 12, 15, 0, 23, 0, 0, 0, 0, 0, + 0, 14, 18, 0, 0, 0, 0, 0, 17, 0, + 24, 0, 0, 0, 20, 22, 0, 21, 19, 0 + } ; + +static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 1, 5, 1, 1, 1, 1, 1, 6, + 7, 1, 1, 1, 1, 1, 1, 8, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 1, 10, 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, + 11, 1, 12, 1, 1, 1, 13, 14, 15, 16, + + 17, 18, 19, 20, 21, 1, 1, 22, 1, 23, + 24, 25, 1, 26, 27, 28, 29, 30, 1, 31, + 32, 33, 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, 1, 1, 1 + } ; + +static yyconst int yy_meta[34] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 3, 3, 1, + 1, 1, 3, 3, 3, 3, 3, 3, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1 + } ; + +static yyconst short int yy_base[84] = + { 0, + 0, 0, 100, 101, 101, 101, 101, 94, 101, 101, + 26, 28, 0, 101, 101, 82, 26, 18, 74, 79, + 78, 81, 88, 101, 32, 0, 0, 76, 65, 62, + 61, 75, 20, 59, 61, 66, 58, 0, 57, 56, + 54, 63, 53, 62, 54, 101, 59, 48, 53, 46, + 59, 101, 44, 43, 101, 41, 55, 46, 53, 44, + 31, 101, 101, 39, 27, 21, 39, 19, 101, 35, + 101, 33, 26, 29, 101, 101, 28, 101, 101, 101, + 58, 61, 41 + } ; + +static yyconst short int yy_def[84] = + { 0, + 80, 1, 80, 80, 80, 80, 80, 81, 80, 80, + 80, 80, 82, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 81, 80, 80, 83, 82, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 83, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 0, + 80, 80, 80 + } ; + +static yyconst short int yy_nxt[135] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 4, 4, 4, 4, 4, + 19, 4, 4, 4, 4, 20, 21, 4, 4, 22, + 4, 4, 4, 25, 25, 25, 25, 32, 29, 25, + 25, 33, 44, 38, 79, 78, 30, 77, 45, 76, + 75, 74, 73, 72, 71, 70, 26, 31, 23, 23, + 23, 27, 69, 27, 68, 67, 66, 65, 64, 63, + 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, + 52, 51, 50, 49, 48, 47, 46, 43, 42, 41, + 40, 39, 24, 37, 36, 35, 34, 28, 24, 80, + + 3, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80 + } ; + +static yyconst short int yy_chk[135] = + { 0, + 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, 11, 11, 12, 12, 18, 17, 25, + 25, 18, 33, 83, 77, 74, 17, 73, 33, 72, + 70, 68, 67, 66, 65, 64, 11, 17, 81, 81, + 81, 82, 61, 82, 60, 59, 58, 57, 56, 54, + 53, 51, 50, 49, 48, 47, 45, 44, 43, 42, + 41, 40, 39, 37, 36, 35, 34, 32, 31, 30, + 29, 28, 23, 22, 21, 20, 19, 16, 8, 3, + + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* 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 "syslex.l" +#define INITIAL 0 +#line 2 "syslex.l" +/* Copyright 2001, 2003 Free Software Foundation, Inc. + +This file is part of GLD, the Gnu Linker. + +GLD is free software; 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. + +GLD is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GLD; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ + +#include "sysinfo.h" +char *word; +int number; +int unit; + +#ifndef yywrap +static int yywrap (void) { return 1; } +#endif +#line 448 "lex.yy.c" + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( 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 + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#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. */ +#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 (void) fwrite( yytext, yyleng, 1, yyout ) +#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->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + } +#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 + +/* 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 + +/* Code executed at the beginning of each rule, after yytext and yyleng + * 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 \ + YY_USER_ACTION + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 30 "syslex.l" + +#line 612 "lex.yy.c" + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *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_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 >= 81 ) + 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_base[yy_current_state] != 101 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + +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 31 "syslex.l" +{ return '(';} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 32 "syslex.l" +{ return ')';} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 33 "syslex.l" +{ return '[';} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 34 "syslex.l" +{ return ']';} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 35 "syslex.l" +{ ; } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 36 "syslex.l" +{ ; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 37 "syslex.l" +{ ; } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 38 "syslex.l" +{ ; } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 39 "syslex.l" +{ +yylval.s = malloc(strlen (yytext)); +strcpy(yylval.s, yytext+1); +yylval.s[strlen(yylval.s)-1] = 0; + return NAME; + } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 46 "syslex.l" +{ + yylval.i = strtol(yytext,0,16); + return NUMBER; + } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 51 "syslex.l" +{ + yylval.i = atoi(yytext); + return NUMBER; + } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 57 "syslex.l" +{ yylval.i =1 ;return UNIT;} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 58 "syslex.l" +{ yylval.i = 1; return UNIT;} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 59 "syslex.l" +{ yylval.i= 8; return UNIT;} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 60 "syslex.l" +{ yylval.i = 8; return UNIT;} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 62 "syslex.l" +{ yylval.s = "INT"; return TYPE;} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 63 "syslex.l" +{ yylval.s = "BARRAY"; return TYPE;} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 64 "syslex.l" +{ yylval.s = "CHARS"; return TYPE;} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 65 "syslex.l" +{ yylval.i = 0; return NUMBER;} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 66 "syslex.l" +{ yylval.i = -4; return NUMBER;} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 67 "syslex.l" +{ yylval.i = -2; return NUMBER; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 68 "syslex.l" +{ yylval.i = -1; return NUMBER; } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 69 "syslex.l" +{ return COND;} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 70 "syslex.l" +{ return REPEAT;} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 71 "syslex.l" +ECHO; + YY_BREAK +#line 831 "lex.yy.c" +case YY_STATE_EOF(INITIAL): + 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->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 + * 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; + } + + /* 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->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_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, 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->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 yylex */ + + +/* 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() + { + register char *dest = yy_current_buffer->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] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->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->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; + + else + { + int num_to_read = + yy_current_buffer->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; + + 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. */ + yy_flex_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->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_current_buffer->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; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + 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; + + yytext_ptr = &yy_current_buffer->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() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + + 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 >= 81 ) + 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 ); + */ + +#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 + { + 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 >= 81 ) + 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 == 80); + + 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; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->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 char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->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; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#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->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. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + 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 yytext */ + yy_hold_char = *++yy_c_buf_p; + + + return c; + } + + +#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 ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_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 ) + return; + + 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_current_buffer = new_buffer; + yy_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 + * 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; + } + + +#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 + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_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 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_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 + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +#ifndef _WIN32 +#include +#else +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif +#endif + +#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 + + + { + yy_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 + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + 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 ) + yy_load_buffer_state(); + } + + +#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; + + 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 ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_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; + + yy_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 + + +#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 + { + 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 ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_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; + } +#endif + + +#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; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (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 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 ) + + +/* 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 + { + 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 + { + 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 + { + 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 + { + /* 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 ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 71 "syslex.l" diff --git a/binutils/syslex.l b/binutils/syslex.l index 553cbdc8ddd12..ffaf4fad2d6a9 100644 --- a/binutils/syslex.l +++ b/binutils/syslex.l @@ -1,5 +1,5 @@ %{ -/* Copyright 2001 Free Software Foundation, Inc. +/* Copyright 2001, 2003 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -24,7 +24,7 @@ int number; int unit; #ifndef yywrap -static int yywrap () { return 1; } +static int yywrap (void) { return 1; } #endif %} %% diff --git a/binutils/sysroff.info b/binutils/sysroff.info new file mode 100644 index 0000000000000..390fe4201ba1f --- /dev/null +++ b/binutils/sysroff.info @@ -0,0 +1,504 @@ +("cs" 0x0 + (("size") (1 byte) ("size")) + + (("hd") (1 byte) ("hd")) + (("hs") (1 byte) ("hs")) + (("un") (1 byte) ("un")) + (("us") (1 byte) ("us")) + + (("sc") (1 byte) ("sc")) + (("ss") (1 byte) ("ss")) + (("er") (1 byte) ("er")) + (("ed") (1 byte) ("ed")) + + (("sh") (1 byte) ("sh")) + (("ob") (1 byte) ("ob")) + (("rl") (1 byte) ("rl")) + (("du") (1 byte) ("du")) + + (("dps") (1 byte) ("dps")) + (("dsy") (1 byte) ("dsy")) + (("dty") (1 byte) ("dty")) + (("dln") (1 byte) ("dln")) + + (("dso") (1 byte) ("dso")) + (("dus") (1 byte) ("dus")) + (("dss") (1 byte) ("dss")) + (("dbt") (1 byte) ("dbt")) + + (("dpp") (1 byte) ("dpp")) + (("dfp") (1 byte) ("dfp")) + (("den") (1 byte) ("den")) + (("dds") (1 byte) ("dds")) + + (("dar") (1 byte) ("dar")) + (("dpt") (1 byte) ("dpt")) + (("dul") (1 byte) ("dul")) + (("dse") (1 byte) ("dse")) + + (("dot") (1 byte) ("dot"))) + + +("hd" 0x04 + (("module type") (4 bits) ("mt") + (("MTYPE_ABS_LM" "0") + ("MTYPE_REL_LM" "1") + ("MTYPE_OMS_OR_LMS" "2") + ("MTYPE_UNSPEC" "0xf"))) + (("spare")(4 bits) ("spare1")) + (("creation date")( chars 12 bytes)( "cd")) + (("number of units") (2 bytes) ("nu")) + (("code") (1 byte) ("code")) + (("version") (chars 4 bytes) ("ver")) + (("address update") (1 byte) ("au")) + (("segment identifier") (1 bit) ("si")) + (("address field length") (4 bits) ("afl")) + (("spare")(3 bits) ("spare2")) + (("space size within segment") (1 byte) ("spcsz")) + (("segment size") (1 byte) ("segsz")) + (("segment shift") (1 byte) ("segsh")) + (("entry point") (1 byte) ("ep")) + (cond "ptr->ep" + (cond "ptr->mt != MTYPE_ABS_LM" + (("unit appearance number") (2 bytes) ("uan")) + (("section appearance number") (2 bytes) ("sa"))) + (cond "segmented_p" + (("segment address") (segsize bytes) ("sad"))) + (("address") (addrsize bytes) ("address"))) + (("os name") (chars variable bytes) ("os")) + (("sys name") (chars variable bytes) ("sys")) + (("module name") (chars variable bytes) ("mn")) + (("cpu") (chars variable bytes) ("cpu"))) + + +("hs" 0x05 + (("neg number") (2 bytes) ("neg"))) + + +("un" 0x06 + (("format") (2 bits) ("format") + (("FORMAT_LM" "0") + ("FORMAT_OM" "1") + ("FORMAT_OMS_OR_LMS" "2"))) + (("spare") (6 bits) ("spare1")) + (("number of sections") (2 bytes) ("nsections")) + (("number of external refs") (2 bytes) ("nextrefs")) + (("number of external defs") (2 bytes) ("nextdefs")) + (("unit name") (chars variable byte) ("name")) + (("tool name") (chars variable byte) ("tool")) + (("creation date") (chars 12 bytes) ("tcd")) + (("linker name") (chars variable byte) ("linker")) + (("creation date") (chars 12 bytes) ("lcd"))) + + +("us" 0x07 + (("negotiation number") (2 bytes) ("neg"))) + + +("sc" 0x08 + (("format") (2 bits) ("format")) + (("spare") (6 bits) ("spare")) + (("segment address") (segsize bytes) ("segadd")) + (("address") (addrsize bytes) ("addr")) + (("length") (addrsize bytes) ("length")) + (("alignment") (addrsize bytes) ("align")) + (("contents") (4 bits) ("contents") + (("CONTENTS_CODE" "0") + ("CONTENTS_DATA" "1") + ("CONTENTS_STACK" "2") + ("CONTENTS_DUMMY" "3") + ("CONTENTS_SPECIAL" "4") + ("CONTENTS_NONSPEC" "0xf"))) + (("concat") (4 bits) ("concat") + (("CONCAT_SIMPLE" "0") + ("CONCAT_SHAREDC" "1") + ("CONCAT_DUMMY" "2") + ("CONCAT_GROUP" "3") + ("CONCAT_SHARED" "4") + ("CONCAT_PRIVATE" "5") + ("CONCAT_UNSPEC" "0xf"))) + (("read") (2 bits) ("read")) + (("write") (2 bits) ("write")) + (("exec") (2 bits) ("exec")) + (("initialized") (2 bits) ("init")) + (("mode") (2 bits) ("mode")) + (("spare") (6 bits) ("spare1")) + (("name") (chars variable byte) ("name"))) + + +("ss" 0x09 + (("neg number") (2 bytes) ("neg"))) + + +("er" 0x0c + (("symbol type") (2 bits) ("type") + (("ER_ENTRY" "0") + ("ER_DATA" "1") + ("ER_NOTDEF" "2") + ("ER_NOTSPEC" "3"))) + (("spare") (6 bits) ("spare")) + (("symbol name") (chars variable byte) ("name"))) + + +("ed" 0x14 + (("section appearance number") (2 bytes) ("section")) + (("symbol type") (3 bits) ("type") + (("ED_TYPE_ENTRY" "0") + ("ED_TYPE_DATA" "1") + ("ED_TYPE_CONST" "2") + ("ED_TYPE_NOTSPEC" "7"))) + (("spare") (5 bits) ("spare")) + (cond "ptr->type==ED_TYPE_ENTRY || ptr->type==ED_TYPE_DATA" + (("symbol address") (addrsize bytes) ("address"))) + (cond "ptr->type==ED_TYPE_CONST" + (("constant value") (addrsize bytes) ("constant"))) + (("symbol name") (chars variable byte) ("name"))) + + +("sh" 0x1a + (("unit appearance number") (2 bytes) ("unit")) + (("section appearance number") (2 bytes) ("section"))) + + +("ob" 0x1c + (("starting address flag") (1 bit) ("saf")) + (("compression flag") (1 bit) ("cpf")) + (("spare") (6 bits) ("spare")) + (cond "ptr->saf" + ( ("starting address") (addrsize bytes) ("address"))) + (cond "ptr->cpf" + (("comp reps") (addrsize bytes) ("compreps"))) + (("data") (barray counted byte) ("data"))) + + +("rl" 0x20 + (("boundary of relocatable area") (4 bits) ("boundary")) + (("address polarity") (1 bit) ("apol")) + (("segment number") (1 bit) ("segment")) + (("sign of relocation") (1 bit) ("sign")) + (("check range") (1 bit) ("check")) + (("reloc address") (addrsize bytes) ("addr")) + + (("bit loc") (1 byte) ("bitloc")) + (("field length") (1 byte) ("flen")) + (("bcount") (1 byte) ("bcount")) + (("operator") (1 byte) ("op") + (("OP_RELOC_ADDR" "1") + ("OP_SEC_REF" "0") + ("OP_EXT_REF" "2"))) + (cond "ptr->op == OP_EXT_REF" + (("symbol number") (2 bytes) ("symn")) ) + + (cond "ptr->op == OP_SEC_REF" + (("section number") (2 bytes) ("secn")) + (("const opcode") (1 byte) ("copcode_is_3")) + (("addend length") (1 byte) ("alength_is_4")) + (("addend") (4 byte) ("addend")) + (("plus opcode") (1 byte) ("aopcode_is_0x20"))) + + (cond "ptr->op == OP_RELOC_ADDR" + (("dunno") (2 bytes) ("dunno"))) + + (("end") (1 byte) ("end"))) + + +("du" 0x30 + (("format") (2 bits) ("format")) + (("optimized") (1 bit) ("optimized")) + (("stackfrmt") (2 bits) ("stackfrmt")) + (("spare") (3 bits) ("spare")) + (("unit number") (2 bytes) ("unit")) + (("sections") (2 bytes) ("sections")) + (repeat "ptr->sections" + (("section appearance number") (2 bytes) ("san")) + (("address") (addrsize bytes) ("address")) + (("section length") (addrsize bytes) ("length"))) + (("tool name") (chars variable byte) ("tool")) + (("creation date") (chars 12 bytes) ("date"))) + + +("dsy" 0x34 + (("symbol type") (7 bits) ("type") + (("STYPE_VAR" "0") + ("STYPE_LAB" "1") + ("STYPE_PROC" "2") + ("STYPE_FUNC" "3") + ("STYPE_TYPE" "4") + ("STYPE_CONST" "5") + ("STYPE_ENTRY" "6") + ("STYPE_MEMBER" "7") + ("STYPE_ENUM" "8") + ("STYPE_TAG" "9") + ("STYPE_PACKAGE" "10") + ("STYPE_GENERIC" "11") + ("STYPE_TASK" "12") + ("STYPE_EXCEPTION" "13") + ("STYPE_PARAMETER" "14") + ("STYPE_EQUATE" "15") + ("STYPE_UNSPEC" "0x7f"))) + (("assignment info") (1 bit) ("assign")) + (("symbol id") (2 bytes) ("snumber")) + (("symbol name") (chars variable bytes) ("sname")) + (("nesting level") (2 bytes) ("nesting")) + (cond "ptr->assign" + (("assignment type") (1 byte) ("ainfo") + (("AINFO_REG" "1") + ("AINFO_STATIC_EXT_DEF" "2") + ("AINFO_STATIC_EXT_REF" "3") + ("AINFO_STATIC_INT" "4") + ("AINFO_STATIC_COM" "5") + ("AINFO_AUTO" "6") + ("AINFO_CONST" "7") + ("AINFO_UNSPEC" "0xff"))) + (("data length") (addrsize bytes) ("dlength")) + (cond "ptr->ainfo == AINFO_STATIC_EXT_DEF + || ptr->ainfo == AINFO_STATIC_INT + || ptr->ainfo == AINFO_STATIC_COM" + (("section number") (2 bytes) ("section"))) + (cond "ptr->ainfo == AINFO_STATIC_EXT_DEF + || ptr->ainfo == AINFO_STATIC_INT + || ptr->ainfo == AINFO_STATIC_COM + || ptr->ainfo == AINFO_AUTO" + (("address") (addrsize bytes) ("address"))) + (cond "ptr->ainfo == AINFO_REG" + (("register name") (chars variable bytes) ("reg"))) + (cond "ptr->ainfo == AINFO_STATIC_EXT_DEF + || ptr->ainfo == AINFO_STATIC_EXT_REF" + (("external name") (chars variable bytes) ("ename"))) + (cond "ptr->ainfo == AINFO_CONST" + (("constant") (chars variable bytes) ("constant")))) + (cond "ptr->type == STYPE_MEMBER" + (("assignment unit") (1 bit) ("bitunit")) + (("spare") (7 bits) ("spare2")) + (("field length") (addrsize bytes) ("field_len")) + (("field offset") (addrsize bytes) ("field_off")) + (cond "ptr->bitunit" + (("bit offset") (addrsize bytes) ("field_bitoff")))) + (cond "ptr->type== STYPE_ENUM" + (("value length") (1 byte) ("evallen")) + (("value") (4 bytes) ("evalue"))) + (cond "ptr->type == STYPE_CONST" + (("value") (chars variable bytes) ("cvalue"))) + (cond "ptr->type == STYPE_EQUATE" + (("value length") (1 byte) ("qvallen")) + (("value") (4 bytes) ("qvalue")) + (("basic type") (1 byte) ("btype")) + (("size information") (addrsize bytes) ("sizeinfo")) + (("sign") (2 bits) ("sign")) + (("floating point type") (6 bits) ("flt_type"))) + (("source file number") (2 bytes) ("sfn")) + (("source line number") (2 bytes) ("sln")) + (("negotiation number") (2 bytes) ("neg")) + (cond "ptr->type == STYPE_TAG" + (("magic") (1 byte) ("magic")))) + + + +("dul" 0x52 + (("max declaration type flag") (1 bit) ("max_variable")) + (("max spare") (7 bits) ("maxspare")) + (cond "ptr->max_variable == 0" + (("maximum") (addrsize bytes) ("max")) + (("max mode") (chars variable bytes) ("maxmode"))) + + (("min declaration type flag") (1 bit) ("min_variable")) + (("min spare") (7 bits) ("minspare")) + (cond "ptr->min_variable == 0" + (("minimum") (addrsize bytes) ("min")) + (("min mode") (chars variable bytes) ("minmode")))) + + +("dty" 0x36 + (("end flag") (1 bit) ("end")) + (("spare") (7 bits) ("spare")) + (cond "!ptr->end" + (("negotiation") (2 bytes) ("neg")))) + + +("dbt" 0x44 + (("basic type") (1 byte) ("btype") + (("BTYPE_VOID" "0") + ("BTYPE_UNDEF" "1") + ("BTYPE_CHAR" "2") + ("BTYPE_INT" "3") + ("BTYPE_FLOAT" "4") + ("BTYPE_BIT" "5") + ("BTYPE_STRING" "6") + ("BTYPE_DECIMAL" "7") + ("BTYPE_ENUM" "8") + ("BTYPE_STRUCT" "9") + ("BTYPE_TYPE" "10") + ("BTYPE_TAG" "11") + ("BTYPE_UNSPEC" "0xff"))) + (("size info") (addrsize bytes) ("bitsize")) + (("sign") (2 bits) ("sign") + (("SIGN_SIGNED" "0") + ("SIGN_UNSIGNED" "1") + ("SIGN_UNSPEC" "3"))) + (("floating point type") (6 bits) ("fptype") + (("FPTYPE_SINGLE" "0") + ("FPTYPE_DOUBLE" "1") + ("FPTYPE_EXTENDED" "2") + ("FPTYPE_NOTSPEC" "0x3f"))) + (cond "ptr->btype==BTYPE_TAG || ptr->btype == BTYPE_TYPE" + (("symbol id") (2 bytes) ("sid"))) + (("negotiation") (2 bytes) ("neg"))) + +("dar" 0x4e + (("element length" ) (addrsize bytes) ("length")) + (("dims") (1 byte) ("dims")) + (repeat "ptr->dims" + (("variable flag") (1 bit) ("variable") + (("VARIABLE_FIXED" "0") + ("VARIABLE_VARIABLE" "1"))) + + (("subscript type") (1 bit) ("subtype") + (("SUB_INTEGER" "0") + ("SUB_TYPE" "1"))) + + (("spare") (6 bits) ("spare")) + + (cond "ptr->subtype[n] == SUB_TYPE" + (("sub symbol id") (2 bytes) ("sid"))) + + (cond "ptr->subtype[n] == SUB_INTEGER" + (("max declaration type flag") (1 bit) ("max_variable")) + (("max spare") (7 bits) ("maxspare")) + ;; FIXME: next field should be conditional on max_variable, + (("maximum") (addrsize bytes) ("max")) + + (("min declaration type flag") (1 bit) ("min_variable")) + (("min spare") (7 bits) ("minspare")) + ;; FIXME: next field should be conditional on min_variable + (("minimum") (addrsize bytes) ("min")))) + (("negotiation") (2 bytes) ("neg"))) + + +("dso" 0x3a + (("function name") (2 bytes) ("sid")) + (("sp update count") (4 bytes) ("spupdates")) + (repeat "ptr->spupdates" + (("update address") (addrsize bytes) ("address")) + (("offset") (addrsize bytes) ("offset")))) + +("dln" 0x38 + (("number of lines") (2 bytes) ("nln")) + (repeat "ptr->nln" + (("source file number") (2 bytes) ("sfn")) + (("source line number") (2 bytes) ("sln")) + (("section number") (2 bytes) ("section")) + (("from address") (addrsize bytes) ("from_address")) + (("to address") (addrsize bytes) ("to_address")) + (("call count") (2 bytes) ("cc")) + ) + (("neg") (2 bytes) ("neg"))) + +("dpp" 0x46 + (("start/end") (1 bit) ("end")) + (("spare") (7 bits) ("spare")) + (cond "!ptr->end" + (("params") (1 byte) ("params")) + (("neg number") (2 bytes) ("neg")))) + +("den" 0x4a + (("start/end") (1 bit) ("end")) + (("spare") (7 bits) ("spare")) + (cond "!ptr->end" + (("neg number") (2 bytes) ("neg")))) + +("dfp" 0x48 + (("start/end flag") (1 bit) ("end")) + (("spare") (7 bits) ("spare")) + (cond "!ptr->end" + (("number of parameters") (1 byte) ("nparams")) + (("neg number") (2 bytes) ("neg")))) + +("dds" 0x4c + (("start/end") (1 bit) ("end")) + (("spare") (7 bits) ("spare")) + (cond "!ptr->end" + (("neg number") (2 bytes) ("neg")))) + +("dpt" 0x50 + (("neg number") (2 bytes) ("neg")) + (("dunno") (1 byte) ("dunno"))) + +("dse" 0x54 + (("neg number") (2 bytes) ("neg")) + (("dunno") (1 byte) ("dunno"))) + +("dot" 0x56 + (("unknown") (1 byte) ("unknown"))) +; FIXME: unknown field should be repeated symbol number? + + +("dss" 0x42 + (("type") (1 byte) ("type")) + (("external/internal") (1 bit) ("internal")) + (("spare") (7 bits) ("spare")) + (cond "!ptr->internal" + ( ("package name") (chars variable byte) ("package"))) + (cond "ptr->internal" + (("symbol id") (2 bytes) ("id"))) + (("record type") (2 bytes) ("record")) + (("rules") (chars variable byte) ("rules")) + (("number of symbols") (2 bytes) ("nsymbols")) + (("unknown" ) (2 bytes) ("fixme"))) + +("pss" 0x40 + (("negotiation number") (2 bytes) ("efn")) + (("number of source files") (2 bytes) ("ns")) + (repeat "ptr->ns" + (("directory reference bit") (1 bit) ("drb")) + (("spare") (7 bits) ("spare")) + (("completed file name") (chars variable byte) ("fname")) + (cond "ptr->drb[n]" + (("directory apperance number") (2 bytes) ("dan")))) + + (("number of directories") (2 bytes) ("ndir")) + (repeat "ptr->ndir" + (("directory name") (chars variable bytes) ("dname")))) + + +; FIXME: the tr block has no contents. sysinfo, etc. aren't prepared +; to deal with that. +; ("tr" 0x7f) + + +("dus" 0x40 + (("negotiation number") (2 bytes) ("efn")) + (("number of source files") (2 bytes) ("ns")) + (repeat "ptr->ns" + (("directory reference bit") (1 bit) ("drb")) + (("spare") (7 bits) ("spare")) + (("completed file name") (chars variable byte) ("fname")) + (cond "ptr->drb[n]" + (("directory apperance number") (2 bytes) ("dan")))) + (("number of directories") (2 bytes) ("ndir")) + (repeat "ptr->ndir" + (("directory name") (chars variable bytes) ("dname")))) + + +("dps" 0x32 + (("start/end flag") (1 bit) ("end")) + (("block type") (7 bits) ("type") + (("BLOCK_TYPE_COMPUNIT" "0") + ("BLOCK_TYPE_PROCEDURE" "2") + ("BLOCK_TYPE_FUNCTION" "3") + ("BLOCK_TYPE_BLOCK" "4") + ("BLOCK_TYPE_BASIC" "9"))) + (cond "!ptr->end" + (("optimization") (1 byte) ("opt")) + (("section number") (2 bytes) ("san")) + (("address") (addrsize bytes) ("address")) + (("block size") (addrsize bytes) ("block_size")) + (("nesting") (1 byte) ("nesting")) + (cond "ptr->type == BLOCK_TYPE_PROCEDURE + || ptr->type == BLOCK_TYPE_FUNCTION" + (("return address") (1 bit) ("retaddr")) + (("interrupt function flag") (1 bit) ("intrflag")) + (("stack update flag") (1 bit) ("stackflag")) + (("intra page JMP") (1 bit) ("intrpagejmp")) + (("spare") (4 bits) ("spare"))) + (("neg number") (2 bytes) ("neg")))) + diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog new file mode 100644 index 0000000000000..4007d24ebdb68 --- /dev/null +++ b/binutils/testsuite/ChangeLog @@ -0,0 +1,33 @@ +2004-05-15 Nick Clifton + + * binutils-all/readelf.ss: Allow for ARM mapping symbols. + +2004-04-14 Richard Sandiford + + * binutils-all/readelf.ss-mips: Allow named section symbols. + +2004-04-09 Daniel Jacobowitz + + Merge from mainline: + 2004-02-27 Andreas Schwab + * binutils-all/ar.exp (argument_parsing): New test. + +2004-04-08 Alan Modra + + Apply from mainline. + 2004-03-30 Jakub Jelinek + * binutils-all/objcopy.exp: Accept main as a data symbol as well. + +2004-02-20 Nathan Sidwell + + * binutils-all/objcopy.exp: Reorder arguments for POSIXLY_CORRECT + systems. + +For older changes see ChangeLog-9303 + +Local Variables: +mode: change-log +left-margin: 8 +fill-column: 74 +version-control: never +End: diff --git a/binutils/testsuite/ChangeLog-9303 b/binutils/testsuite/ChangeLog-9303 new file mode 100644 index 0000000000000..50b4e336d070d --- /dev/null +++ b/binutils/testsuite/ChangeLog-9303 @@ -0,0 +1,1044 @@ +2003-12-03 Nick Clifton + + * binutils-all/objdump.exp (cpus_expected): Add "msp". + +2003-10-06 Dave Brolley + + * binutils-all/objdump.exp (cpu_expected): Add fr550. + +2003-09-29 H.J. Lu + + * binutils-all/readelf.exp: Use is_elf_format. + + * binutils-all/readelf.h: Support IA64/ILP32. + * binutils-all/readelf.s: Likewise. + * binutils-all/readelf.ss: Likewise. + + * lib/utils-lib.exp (proc is_elf_format): Copy from ld + testsuite. Add ia64-*-hpux*. + +2003-06-29 Danny Smith + + * binutils-all/objcopy.exp: Initialise $test_prog to + testprog.exe on mingw targeted systems too. + +2003-06-28 Danny Smith + + * binutils-all/windres/checkbox.rc: New file. + * binutils-all/windres/checkbox.rsd: New file. + * binutils-all/windres/combobox.rc: New file. + * binutils-all/windres/combobox.rsd: New file. + * binutils-all/windres/edittext.rc: New file. + * binutils-all/windres/edittext.rsd: New file. + * binutils-all/windres/listbox.rc: New file. + * binutils-all/windres/listbox.rsd: New file. + * binutils-all/windres/scrollbar.rc: New file. + * binutils-all/windres/scrollbar.rsd: New file. + +2003-06-27 Thiemo Seufer + + * binutils-all/readelf.ss-tmips: Adjust symbol indices. + +2003-06-19 Nick Clifton + + * binutils-all/objcopy.exp: Replace occurances of testprog with + $test_prog. Initialise this variable to testprog.exe on Cygwin + targeted systems. + +2003-04-26 Nick Clifton + + * binutils-all/readelf.exp (prune_read_warnings): Rename to + prune_readelf_wi_warnings. + (readelf_wi_test): New proc: Test 'readelf -wi' by grepping + through its output. + Replace invocation of "readelf_test -wi" with "readelf_wi_test" + * binutils-all/readelf.wi: Delete. + +2003-04-23 Nick Clifton + + * binutils-all/readelf.exp (proc prune_readelf_warnings): New + function. + (proc readelf_test): Prune warning messages. + (readelf_test -wi): Add more expected failures. + * binutils-all/readelf.wi: Severly reduce expected output. + * binutils-all/testprog.c (string): Explicitly use unsigned + chars. + (stdio.h, string.h): Remove inclusion. + +2003-04-23 J"orn Rennecke + + * binutils-all/readelf.wi: Update. + +2003-04-22 Dimitrie O. Paun + + * binutils-all/windres/windres.exp: Add test for the new -J + option. Remove use of -I as it now generates a warning message. + +2003-04-03 Nick Clifton + + * binutils-all/windres/dialogid.rc: Replace "Static" with + "classname" so that compilation will match behaviour of the + Windows resource compiler. + +2003-03-31 Nick Clifton + + * binutils-all/windres/dialogid.rc: New test source file. + * binutils-all/windres/dialogid.rsd: New test expected results. + +2002-11-07 Casper S. Hornstrup + + * binutils-all/dlltool.exp: New file for testing dlltool. + * binutils-all/fastcall.def: New file for testing fastcall + exports. + * config/default.exp: Set DLLTOOL variable. + +2002-08-27 Alan Modra + + * binutils-all/objcopy.exp: Revert last change. + +2002-08-26 Alan Modra + + * binutils-all/objcopy.exp (strip_test): Adjust for "no symbols" on + stdout. + (strip_executable): Likewise. + +2002-08-13 Alan Modra + + * binutils-all/objdump.exp (cpus_expected): Add fr500, ip2022, + tic80, tms320c30. + * binutils-all/objcopy.exp (simple copy): Revise xfails. + +2002-05-29 Alan Modra + + * binutils-all/objcopy.exp (strip_test_with_saving_a_symbol): + Revert 2001-11-15. Instead allow `D main'. + +2002-04-16 Eric Kohl + + * binutils-all/windres/dialog0.rc: New test case: Check default + attributes for dialogs + * binutils-all/windres/dialog0.rsd: New file: Expected output. + * binutils-all/windres/dialog1.rc: New test case: Check + DISCARDABLE flag is propogated. + * binutils-all/windres/dialog1.rsd: New file: Expected output. + +2002-04-15 Eric Kohl + + * binutils-all/windres/dlgfont.rc: New test case: Checks FONT + statement in DIALOG and DIALOGEX resources. + * binutils-all/windres/dlgfont.rsd: Expected output. + +2002-04-11 Nick Clifton + + * binutils-all/ar.exp (long_filenames): Use 'file delete' instead + of 'exec rm -f'. + +2002-04-10 Nick Clifton + + * binutils-all/ar.exp (long_filenames): Delete the abc... files + upon successfully completion of the test. + + * binutils-all/windres/capstyle.rsd: Regenerate using MSVC. + * binutils-all/windres/deflang.rsd: Regenerate using MSVC. + * binutils-all/windres/dialogsignature.rsd: Regenerate using MSVC. + * binutils-all/windres/escapea.rsd: Regenerate using MSVC. + * binutils-all/windres/escapex.rsd: Regenerate using MSVC. + * binutils-all/windres/nocaption.rsd: Regenerate using MSVC. + * binutils-all/windres/printstyle.rsd: Regenerate using MSVC. + * binutils-all/windres/sublang.rsd: Regenerate using MSVC. + +2002-04-09 Nick Clifton + + * binutils-all/windres/capstyle.rc: New test case: Set default + style for captions. + * binutils-all/windres/capstyle.rsd: Expected output. + + * binutils-all/windres/deflang.rc: New test case: Check default + language. + * binutils-all/windres/deflang.rsd: Expected output. + + * binutils-all/windres/dialogsignature.rc: New test case for + decoding the dialog signature. + * binutils-all/windres/dialogsignature.rsd: Expected output. + + * binutils-all/windres/escapea.rc: New test case for encoding \a + escape sequence. + * binutils-all/windres/escapea.rsd: Expected output. + + * binutils-all/windres/escapex.rc: New test case for hex constants + in strings. + * binutils-all/windres/escapex.rsd: Expected output + + * binutils-all/windres/nocaption.rc: New test case dialogs without + captions. + * binutils-all/windres/nocaption.rsd: Expected output + + * binutils-all/windres/quoteclass.rc: New test case for quoted + CLASS definitions in DIALOG resources. + + * binutils-all/windres/sublang.rc: New test case: Check assignment + of sub-language. + * binutils-all/windres/sublang.rsd: Expected output. + +2002-02-18 Timothy Daly + + * binutils-all/readelf.r: Change expected output to match new, + narrowed-to-80-chars format. + * binutils-all/readelf.r-64: Change expected output to match new, + narrowed-to-80-chars format. + +2002-02-18 Hans-Peter Nilsson + + * binutils-all/objcopy.exp + (strip_executable_with_saving_a_symbol): Prune symbol Main in nm + output for mmix-knuth-mmixware. + +2002-02-13 Nick Clifton + + * binutils-all/readelf.ss-mips: Do not expect an explicit + ordering of the sections. + +2002-02-10 Nick Clifton + + * binutils-all/objdump.exp: Add 'xscale' to the list of expected + CPUs. + +2002-01-14 Nick Clifton + + * binutils-all/objcopy.exp: Expect xscale-coff to fail simple + objcopy test for the same reason as arm-coff. + +2001-11-29 H.J. Lu + + * binutils-all/objcopy.exp (strip_test): Add strip on archive. + +2001-11-15 Alan Modra + + * binutils-all/objcopy.exp: (strip_test_with_saving_a_symbol): + Allow '? main', to suit powerpc64. + +2001-11-14 Geoffrey Keating + + * binutils-all/readelf.exp: powerpc-*-eabi* is an ELF target. + +2001-10-03 Thiemo Seufer + + * binutils-all/readelf.exp: Exclude mips*-*-elf* from 'readelf -wi' + test. + +Tue Sep 4 20:25:41 2001 Jeffrey A Law (law@cygnus.com) + + * binutils/all/readelf.exp: Expect readelf -wi to + fail for the H8 series. + +2001-08-27 Alan Modra + + * binutils-all/readelf.s-64: Adjust offsets for powerpc64. Don't + use constructs like [45][08] when all combinations are not valid. + Instead use (48|50) to explicitly state which values are correct. + +2001-08-21 H.J. Lu + + * binutils-all/readelf.r: Updated for the readelf change. + + * binutils-all/readelf.r-64: New for the readelf change. + +2001-07-27 H.J. Lu + + * binutils-all/windres/windres.exp: Don't set xfail for + bmpalign (compare) on none-ix86/pe targets. + +2001-07-24 H.J. Lu + + * binutils-all/windres/windres.exp: Set xfail on none-ix86/pe + targets. + +2001-07-18 DJ Delorie + + * config/default.exp (WINDRES): Add. + * binutils-all/windres/windres.exp: New. + * binutils-all/windres/README: New. + * binutils-all/windres/bmp1.bmp: New. + * binutils-all/windres/bmpalign.rc: New. + * binutils-all/windres/bmpalign.rsd: New. + * binutils-all/windres/lang.rc: New. + * binutils-all/windres/lang.rsd: New. + * binutils-all/windres/msupdate: New. + * binutils-all/windres/strtab1.rc: New. + * binutils-all/windres/strtab1.rsd: New. + +2001-07-05 Ben Elliston + + * lib/utils-lib.exp (target_assemble): Remove duplicate copy. + (default_target_assemble): Likewise. + +2001-06-18 Thiemo Seufer + + * binutils-all/readelf.exp: Typo. + +2001-06-19 Andreas Jaeger + + * binutils-all/readelf.r: Don't check for specific info value to + pass testsuite on ia64 and alpha. + +2001-06-07 H.J. Lu + + * binutils-all/readelf.ss-mips: Support stabs. + * binutils-all/readelf.ss-tmips: Likewise. + +2001-05-25 H.J. Lu + + * binutils-all/readelf.exp (readelf_test): Set target_machine + to tmips for traditional mips. + + * binutils-all/readelf.s: Support traditional mips. + + * binutils-all/readelf.ss-tmips: New for traditional mips. + +2001-05-25 Alan Modra + + * binutils-all/readelf.exp: Replace linuxoldld with linux*oldld + and linuxaout with linux*aout. + * binutils-all/objcopy.exp: Remove xfail for linuxaout. + +2001-05-24 H.J. Lu + + * binutils-all/objdump.exp (cpus_expected): Add s390. + +2001-03-30 H.J. Lu + + * binutils-all/readelf.exp: Run on more ELF targets. + +2001-02-11 H.J. Lu + + * config/default.exp: Set up gcc_gas_flag. + + * binutils-all/objcopy.exp (copy_setup): Process gcc_gas_flag + for Linux only. + + * binutils-all/testprog.c: Include and don't use + exit (). + +2001-01-16 Matthew Green + + * binutils-all/readelf.s-64: Match readelf -S output. + +2000-12-09 Nick Clifton + + * binutils-all/objdump.exp (cpus_expected): Add tic54x and + tms320c54x. + +2000-11-28 Hans-Peter Nilsson + + * binutils-all/readelf.s: Adjust to readelf.c formatting changes. + +2000-11-02 Chris Demetriou + + * binutils-all/readelf.exp (regexp_diff): Add code + from gas testsuite to treat "#..." at beginning of line + as an indicator to skip extra non-matching lines at that + location. + (readelf_test): Add support for using a machine-specific + regexp comparison file. + (readelf -S test, readelf -s test): Remove v850*-*-* and + mips*-*-* from list of expected failures. + * binutils-all/readelf.s: Accomodate changes due to + additional sections (and therefore section numbering + differences) on v850*-*-* and mips*-*-* targets. + * binutils-all/readelf.ss: Likewise. + * binutils-all/readelf.ss-mips: New file, which matches + expected output of readelf -s test for mips*-*-*. + +2000-10-25 Hans-Peter Nilsson + + * binutils-all/readelf.exp (-wi test): Add cris-*-* to xfails. + +2000-10-19 Chris Demetriou + + * binutils-all/readelf.exp (readelf_test): Work properly + when multiple targets expect failtures. + (readelf -S test, readelf -s test): Expect mips*-*-* + to fail. + +2000-07-10 Alan Modra + + * lib/utils-lib.exp (default_binutils_assemble): Don't do the hppa + sed fudges for hppa-linux. + +2000-07-01 Frank Ch. Eigler + + * binutils-all/objdump.exp (cpus_expected, cpus_regex): Reorganize + syntax to display more tcl nature. + +2000-06-18 Stephane Carrez + + * binutils-all/objdump.exp (cpus_expected): Recognize m68hc11 and + m68hc12. + +2000-06-18 Nick Clifton + + * binutils-all/readelf.wi: Do not assume the compilation tag to be + unit 1. + + * binutils-all/objcopy.exp: Expect all arm variants to fail the + copying executable test. + +2000-06-14 Hans-Peter Nilsson + + * binutils-all/readelf.exp (regexp_diff): Do not break when a + mismatching line is found. + (readelf_find_size): New. + (readelf_size): New global variable. + (readelf_test): Add newline to send_log of command. + If $srcdir/$subdir/$regexp_file-$readelf_size exists, use it + instead of $srcdir/$subdir/$regexp_file. + (*-*elf test): Fix typo in message. + * binutils-all/readelf.s-64: New. + * binutils-all/readelf.ss-64: New. + +2000-05-02 Alan Modra + + * binutils-all/objcopy.exp (simple copy): Clear xfail for hppa-linux. + + * binutils-all/hppa/objdump.exp: Disable test for elf. + +2000-03-13 Nick Clifton + + * binutils-all/readelf.s: Adjust to match new format of readelf + output. + * binutils-all/readelf.ss: Adjust to match new format of readelf + output. + +1999-11-01 Nick Clifton + + * binutils-all/objcopy.exp: Expect simple objcopy test to fail + for COFF based ARM and Thumb ports. + +Tue Sep 14 00:28:17 1999 Jeffrey A Law (law@cygnus.com) + + * binutils-all/hppa/objdump.exp: Do not run for PA64. + +1999-09-04 Steve Chamberlain + + * binutils-all/objdump.exp: Add pj to cpus_expected. + +Sat Aug 28 00:24:27 1999 Jerry Quinn + + * binutils-all/hppa/freg.s: New file. + * binutils-all/hppa/objdump.exp: Add freg.s test. + +1999-08-09 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add setup_xfail for simple copy test + for i*86-*-msdos*. + +1999-07-21 H.J. Lu + + * binutils-all/testprog.c: Include . + +1999-06-29 Nick Clifton + + * binutils-all/objdump.exp: Add fr30 and MCore to expected cpus + list. + + * binutils-all/readelf.r: Do not assume a fixed number of spaces + in the output. + +1999-06-10 Nick Clifton + + * binutils-all/readelf.wi: Update to match latest output. + * binutils-all/readelf.h: Update to match latest output. + +Wed Jun 9 11:59:22 1999 Andreas Schwab + + * binutils-all/objdump.exp: Tighten regexp to match `objdump -i' + output to avoid massive exponential behaviour. + +1999-05-28 Ian Lance Taylor + + * binutils-all/readelf.h: Update for changes of 1999-04-08. + +1999-03-12 Nick Clifton + + * binutils-all/readelf.wi: Remove FR30 specific components. + * binutils-all/readelf.s: Remove RELA specific components. + +1999-02-16 Nick Clifton + + * binutils-all/readelf.s: Do not assume section alignment is 4. + * binutils-all/readelf.r: Do not assume rela's are being used. + * binutils-all/readelf.exp: disable tests for non ELF based + targets. + +1999-02-02 Nick Clifton + + * binutils-all/readelf.wi: Amend to match new readelf output. + * binutils-all/readelf.r: Do not assume that RELAs will be used. + +1999-01-29 Nick Clifton + + * config/default.exp: Add definitions of READELF and READELFFLAGS. + + * binutils-all/readelf.exp: New file: Readelf tests + * binutils-all/readelf.h: New file: Expected results for 'readelf -h' + * binutils-all/readelf.s: New file: Expected results for 'readelf -S' + * binutils-all/readelf.ss: New file: Expected results for 'readelf -s' + * binutils-all/readelf.r: New file: Expected results for 'readelf -r' + * binutils-all/readelf.wi: New file: Expected results for 'readelf -wi' + +Wed Dec 9 19:11:39 1998 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objcopy.exp (copy_executable): Expect comparison + failure for mips*-*-elf. + +Fri Oct 16 22:57:12 1998 Felix Lee + + * binutils-all/objcopy.exp: fix "no symbols" message. + +Tue Jul 28 15:14:04 1998 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objcopy.exp: Keep "main" and "_main" for strip with + saving symbol tests. Look for either "main" or "_main" in the output + file. Fix test for "no symbols" in the output file. + +1998-07-22 Vladimir N. Makarov + + * binutils-all/objcopy.exp: Polish output about fail for objcopy + (simple copy), strip with/without saving a symbol for object file + and executable. + +Wed Jul 1 16:27:40 1998 Nick Clifton + + * binutils-all/objcopy.exp: ARM simple objcopy now passes. + +Wed Jun 24 09:20:21 1998 Nick Clifton + + * binutils-all/objdump.exp: Look for '.data' rather than 'data' + when parsing output of objdump -h. + * binutils-all/size.exp: Look for '.data' rather than 'data' when + parsing output of size -A. + +1998-07-20 Vladimir N. Makarov + + * binutils-all/objcopy.exp: Two new tests - strip object file with + saving a symbol and strip executable file with saving a symbol. + +Fri May 29 14:50:24 1998 Ian Lance Taylor + + * binutils-all/objcopy.exp: Don't xfail the simple objcopy test + when cross compiling. + +Thu Nov 6 14:32:37 1997 Bob Manson + + * lib/utils-lib.exp: Temporary definition of target_assemble and + default_target_assemble so that testing can work with older + dejagnu versions. + +Wed Sep 24 12:09:15 1997 Bob Manson + + * binutils-all/objcopy.exp(strip_executable): Make a new copy of + the executable being tested. + +Mon Sep 15 21:25:20 1997 Bob Manson + + * binutils-all/objcopy.exp: Compile the executables to be tested + on the target with a status wrapper (as necessary). + + * binutils-all/ar.exp: If testing on a remote host, don't bother + looking on the local host for the program being tested. Use the + correct filenames on the remote host. + + * binutils-all/nm.exp: Ditto. + + * binutils-all/size.exp: Ditto. + + * binutils-all/objdump.exp: Ditto. + (cpus_expected): Add the target CPU to the regexp of CPUs to be + expected, if it's not already there. + +Thu Aug 28 09:57:27 1997 Doug Evans + + * binutils-all/objdump.exp (cpus_expected): Add arc. + +Tue Aug 5 00:03:20 1997 Ian Lance Taylor + + * config/default.exp: Look for nm-new and strip-new. + +Tue Jun 3 17:12:54 1997 Bob Manson + + * config/default.exp: Remove expect_before statement. + + * binutils-all/objcopy.exp: Don't use global exec_output variable; + the output is returned from remote_load instead. + +Mon May 12 22:14:20 1997 Bob Manson + + * binutils-all/objcopy.exp(strip_test): Tests that + fail to compile are untested, not unresolved. + (copy_setup): Ditto. + + * lib/utils-lib.exp(default_binutils_assemble): Call + target_assemble instead of target_compile. + +Wed Apr 30 20:37:51 1997 Bob Manson + + Changes to support multilib and remote hosted testing, along with + general cleanups and simplifications. + + * lib/utils-lib.exp(binutil_version): Use remote_exec. + (default_binutils_run): Ditto. + (default_binutils_assemble): Remove first argument; call + target_compile to actually do the assembly. + (default_binutils_compile,default_binutils_remove,prune_warnings): + Delete. + + * config/default.exp: Remove AS and ASFLAGS. + (binutils_compile,binutils_remove): Delete. + (binutils_assemble): Remove first argument. + + * binutils-all/ar.exp: See if we're running the tests on + a remote host, and download/upload files as appropriate. + Replace calls to binutils_remove with remote_file. Replace + calls to binutils_compile with target_compile. Remove initial + argument to binutils_assemble. Use remote_load to execute + programs on the target. + * binutils-all/nm.exp: Ditto. + * binutils-all/objcopy.exp: Ditto. + * binutils-all/objdump.exp: Ditto. + * binutils-all/size.exp: Ditto. + +Mon Apr 14 12:36:41 1997 Ian Lance Taylor + + * binutils-all/ar.exp (long_filenames): Check for a file system + with a 14 character file name length limit. + +Tue Apr 1 09:52:15 1997 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objdump.exp: Handle d10v. + +Fri Feb 7 16:45:34 1997 Bob Manson + + * binutils-all/ar.exp: Use prune_warnings instead of + prune_system_crud. + * binutils-all/objcopy.exp: Ditto. + +Wed Jan 29 00:16:43 1997 Bob Manson + + * binutils-all/nm.exp: Use / between $srcdir and $subdir. + * binutils-all/objcopy.exp: Ditto. + * binutils-all/objdump.exp: Ditto. + * binutils-all/size.exp: Ditto. + * binutils-all/hppa/objdump.exp: Ditto. + + +Wed Oct 16 22:57:59 1996 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objdump.exp: Add mn10200 and mn10300 to expected + cpus list. + +Tue Oct 1 15:06:55 1996 Ian Lance Taylor + + * lib/utils-lib.exp (binutil_version): Fix for current version + printing. + +Sun Aug 4 22:25:40 1996 Ian Lance Taylor + + * binutils-all/objcopy.exp: Fix end of line matching in srec tests + to work with TCL 7.5. + +Sat Jun 29 12:51:30 1996 Ian Lance Taylor + + * binutils-all/objcopy.exp: Simple copy test works for i960 b.out + targets. + +Mon Jun 24 14:33:04 1996 Ian Lance Taylor + + * binutils-all/objcopy.exp: On OSF/1, the simple copy test will + succeed with gas, and fail with /bin/as, so mark it as an expected + failure only if it fails. + +Tue Mar 26 16:55:08 1996 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objcopy.exp: No longer expect adjust-section-vma + test to fail for hppa*-*-proelf*. + +Mon Mar 11 08:25:14 1996 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objdump.exp: Look for "$CODE$", not just "CODE". + +Wed Jan 31 11:55:13 1996 Jeffrey A Law (law@cygnus.com) + + * binutils-all/objcopy.exp: Expect adjust-section-vma tests to + fail for hppa*-*-proelf* targets. + +Thu Jan 25 13:53:04 1996 Ian Lance Taylor + + * binutils-all/objdump.exp: Update for objdump -h format change. + * binutils-all/objcopy.exp: Likewise. + +Mon Jan 15 18:14:14 1996 Ian Lance Taylor + + * binutils-all/objcopy.exp: Use the lma, not the vma, when testing + address adjustments. + +Fri Dec 15 16:31:55 1995 Ian Lance Taylor + + * binutils-all/objdump.exp: Update objdump -i test for current + objdump output. + +Mon Nov 27 15:15:09 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Correct fail calls to always use the + same string as the pass call. + +Wed Nov 22 13:18:58 1995 Ian Lance Taylor + + * lib/utils-lib.exp (prune_system_crud): Discard -g -O warnings + from native compilers on OSF/1 and SunOS. + +Fri Nov 17 10:36:09 1995 Ian Lance Taylor + + * lib/utils-lib.exp (default_binutils_compiler: Change error + message to say compilation rather than assembly. + +Wed Nov 15 18:34:42 1995 Ken Raeburn + + * binutils-all/objcopy.exp: Simple copy test does appear to work + on i*86-svr4. + +Wed Nov 15 12:19:28 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: If assembly fails, call unresolved. + Test running objcopy and strip on a final executable. + * binutils-all/testprog.c: New file. + * config/default.exp (STRIP, STRIPFLAGS): Define. + (binutils_compile): New procedure. + * lib/utils-lib.exp (default_binutils_compile): New procedure. + +Fri Nov 3 13:22:33 1995 Ian Lance Taylor + + * lib/utils-lib.exp (default_binutils_run): Don't use verbose + -log, reverting part of Oct 2 change. + +Wed Nov 1 15:09:57 1995 Manfred Hollstein KS/EF4A 60/1F/110 #40283 + + * binutils-all/objcopy.exp: Add setup_xfails for + m68*-motorola-sysv* and m88*-motorola-sysv*. + +Wed Oct 4 14:38:31 1995 Ian Lance Taylor + + * binutils-all/nm.exp: Add setup_xfails for XCOFF. + +Mon Oct 2 12:41:48 1995 Ian Lance Taylor + + * binutils-all/ar.exp: New file. + * binutils-all/bintest.s: Make text_symbol and data_symbol global. + Add new static symbols static_text_symbol and static_data_symbol. + * binutils-all/nm.exp: Adjust accordingly. + * config/default.exp (AR): Set if not set. + (binutils_remove): New procedure. + * lib/utils-lib.exp (default_binutils_run): Call + prune_system_crud on program output. Use verbose -log instead of + both verbose and send_log. + (default_binutils_remove): New procedure. + + * lib/utils-lib.exp (default_binutils_assemble): Call + prune_system_crud on assembler output. + +Tue Sep 26 14:07:05 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add setup_xfails for simple copy test + for i386 COFF targets. + +Wed Sep 13 13:20:21 1995 Ian Lance Taylor + + * lib/utils-lib.exp (prune_system_crud): Define if not defined. + * binutils-all/objcopy.exp: Call prune_system_crud on cmp output. + +Sat Aug 19 17:38:06 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add xfail for i*86-*-aout* for simple + copy test. + +Wed Aug 16 16:52:53 1995 Ian Lance Taylor + + * binutils-all/nm.exp: Add setup_xfail for mips*-sony-bsd* for + tests which fail on ECOFF targets. + + * binutils-all/objcopy.exp: Change i*86-*-linux xfail for simple + copy test to check for i*86-*-linuxaout* instead. + +Tue Aug 8 17:48:37 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add setup_xfail for a29k-*-vxworks* + for simple copy test. + +Tue Jul 25 11:57:12 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Change setup_xfail for simple copy + test from i960-*-vxworks5.1 to i960-*-vxworks*. + +Mon Jul 10 12:25:46 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add setup_xfail for z8*-*-coff for + simple copy test. + * binutils-all/objdump.exp (cpus_expected): Add z8001 and z8002. + +Sun May 21 20:32:53 1995 Jeff Law (law@snake.cs.utah.edu) + + * binutils-all/hppa/objdump.exp (addendbug): Handle PA ELF targets + too. + * binutils-all/objcopy.exp (simple copy): Don't expect PA ELF + targets to fail. + +Tue Apr 4 14:52:08 1995 Jeff Law (law@snake.cs.utah.edu) + + * binutils-all/hppa: Renamed from binutils-hppa. + +Wed Mar 29 12:02:43 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add setup_xfail for simple copy test + for h8500-*-hms and h8500-*-coff. + +Tue Mar 28 11:18:28 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add setup_xfail for simple copy test + for m68*-ericsson-ose and m88*-*-coff. + +Mon Mar 27 11:27:31 1995 Ian Lance Taylor + + * binutils-all/objcopy.exp: Add setup_xfail for simple copy test + for m68*-*-vxworks*. + +Fri Mar 24 11:44:25 1995 Ian Lance Taylor + + * binutils-hppa/objdump.exp: Correct hppa*-*-* check. + +Tue Mar 21 10:48:45 1995 Jeff Law (law@snake.cs.utah.edu) + + * binutils-hppa/addendbug.s: New testcase. + * binutils-hppa/objdump.exp: Run it. + +Mon Mar 20 11:31:05 1995 Ian Lance Taylor + + * lib/utils-lib.exp (default_binutils_run): Quote any dollar signs + in progargs before passing it to exec. + +Fri Mar 17 16:39:31 1995 Jeff Law (law@snake.cs.utah.edu) + + * config/hppa.sed: Sed script to transform bintest.s into proper + PA assembly code. + * binutils-all/nm.exp: Enable these tests on the PA. + * binutils-all/objcopy.exp: Enable these tests on the PA. Expect + simple copy to fail. + * binutils-all/objdump.exp: Enable these tests on the PA. Handle + "CODE" as a section name. + * binutils-all/size.exp: Enable these tests on the PA. + * lib/utils-lib.exp (default_binutils_assemble): For "hppa*-*-*", + run the assembly through a sed script before passing it to the + assembler. + +Wed Mar 15 16:47:13 1995 Ian Lance Taylor + + * binutils-all/objdump.exp: Force section sizes to be interpreted + in hex. Change objdump -h failure mode to always use the same + string. + +Thu Jan 5 13:01:43 1995 Ian Lance Taylor + + * binutils-all/nm.exp: Just check for irix4*, rather than + irix\[0-4\]*, to avoid DejaGnu bug. + +Thu Dec 15 19:35:31 1994 Ken Raeburn + + * binutils-all/objcopy.exp: Expect simple-objcopy test to fail + for various other targets for which gas doesn't use bfd: sh-hms, + m68k-hpux, m68k-sunos, m68k-coff, i386-linux, a29k-udi, a29k-coff, + i960-vxworks5.1, i960-coff, h8300-hms, h8300-coff. + +Wed Dec 14 15:54:46 1994 Ken Raeburn + + * binutils-all/size.exp: Skip tests requiring bintest.o on hppa, + since it (correctly) generates syntax errors on that platform. + * binutils-all/objdump.exp: Ditto. + * binutils-all/nm.exp: Ditto. + * binutils-all/objcopy.exp: Ditto. Also, move setup_xfail for + sh-coff to branch where objcopy execution produced no error + messages. Expect failure for hp300 also. + +Thu Dec 8 14:36:15 1994 Ken Raeburn + + * binutils-all/objdump.exp (cpus_expected): New variable, taken + from objdump -i test, added ns32k and powerpc, sorted. + (objdump -i, -f tests): Use $cpus_expected. + + * binutils-all/objcopy.exp: For simple-copy test, expect failure + for sh-coff. + +Tue Oct 25 16:00:14 1994 Ian Lance Taylor + + * binutils-all/objcopy.exp: Adjust --adjust-section-vma tests for + new S-record section handling. + +Tue Oct 18 11:18:21 1994 Ian Lance Taylor + + * binutils-all/nm.exp: nm with no arguments and nm -P do not work + as expected on ECOFF targets; add calls to setup_xfail. + + * binutils-all/objcopy.exp: New file. + * config/default.exp: Initialize OBJCOPY and OBJCOPYFLAGS. + +Fri Oct 14 14:46:22 1994 Ian Lance Taylor + + Rewrite testsuite. + * configure.in, Makefile.in: Remove. + * binutils-all/configure.in, binutils-all/Makefile.in: Remove. + * binutils-all/bintest.c: Remove. + * binutils-all/bintest.s: New file. + * binutils-all/nm.exp, binutils-all/objdump.exp: Rewrite. + * binutils-all/size.exp: Rewrite. + * config/default.exp: Load utils-lib.exp. Set AS and ASFLAGS. + Don't go up one directory from $base_dir. Create tmpdir. + (binutils_run, binutils-assemble): New procedures. + * config/unix.exp: Remove. + * config/mt-a29k-udi, config/mt-i386-aout: Remove. + * config/mt-i960-nindy, config/mt-lynx, config/mt-m68k: Remove. + * config/mt-mips-ecoff, config/mt-slite: Remove. + * config/mt-sparc-aout, config/mt-vxworks: Remove. + * lib/utils-lib.exp (binutil_version): Don't redirect standard + input when getting version. Don't unset errorInfo. + (default_binutils_run): New procedure. + (default_binutils_assemble): New procedure. + +Thu Sep 29 12:45:39 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * VMS does not permit `.' in directory names: renamed binutils.all + to binutils-all. + * configure.in (configdirs): Change binutils.all to binutils-all. + +Fri Sep 23 16:01:14 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * configure.in: Use mt-m68k for m68k*-*-aout* and m68k*-*-coff*, + not for m68k-*-*. + +Fri Sep 23 13:54:50 1994 Ken Raeburn + + * binutils.all/objdump.exp: Added ARM to list of CPU types. + +Thu Sep 22 11:04:50 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * binutils.all/objdump.exp: Update for new usage message. + * binutils.all/size.exp: Use a double backslash in the string to + get a single backslash to the regexp matcher. Accept $TEXT$, + $DATA$ and $BSS$ as well as .text, .data and .bss, for HP/UX. + +Fri Sep 2 12:53:10 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * config/unix.exp: If nm.new does not exist, use [transform nm]. + * config/default.exp: Likewise. + +Wed Aug 24 12:41:37 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + + * configure.in, binutils.all/configure.in: Change i386 to + i[345]86. + +Tue Jul 19 15:23:53 1994 Bill Cox (bill@rtl.cygnus.com) + + * config/mt-mips-ecoff: Add -Tidp.ld option. + +Thu Jun 30 12:41:55 1994 J.T. Conklin (jtc@phishhead.cygnus.com) + + * config/default.exp: Use nm.new, not nm, from newly built tree. + +Tue May 17 14:04:05 1994 Bill Cox (bill@rtl.cygnus.com) + + * config/default.exp, config/unix.exp: Replace error + proc calls with perror. + +Tue May 10 11:20:54 1994 Stan Shebs (shebs@andros.cygnus.com) + + * configure.in (sparclite): Match on sparclite*-*-*. + +Wed Apr 13 18:25:19 1994 Ken Raeburn (raeburn@cujo.cygnus.com) + + * config/unix.exp: Use nm.new, not nm, from newly built tree. + + * binutils.all/objdump.exp: Add more wildcards to list of + single-letter options in pattern for usage message. + + * binutils.all/nm.exp: Deleted debug-symbols test, since it only + works for a.out/stabs systems. Fixed regexps to make underscores + optional, since some C compilers don't prepend them. Deleted + check for foo.o symbol, since again some systems don't generate + it. + +Mon Apr 11 10:31:00 1994 Bill Cox (bill@rtl.cygnus.com) + + * Makefile.in (check): Set TCL_LIBRARY for runtest. + +Mon Feb 14 19:34:03 1994 Rob Savoye (rob@darkstar.cygnus.com) + + * Makefile.in: Use new config features of DejaGnu in site.exp + file. "Make check" should now work for all crosses. + +Fri Jan 28 18:00:29 1994 Ken Raeburn (raeburn@cujo.cygnus.com) + + * binutils.all/objdump.exp: In usage message, accept + "section-name" as well as "section_name". + +Mon Jan 17 16:57:02 1994 Ken Raeburn (raeburn@cujo.cygnus.com) + + * binutils.all/objdump.exp: Trim list of format names expected, + and accept any known CPU type. + +Thu Dec 2 20:50:24 1993 Rob Savoye (rob@darkstar.cygnus.com) + + * Makefile.in: Remove some stuff from the site.exp file. + * config/unix.exp: Add global before seeing if the variables for + nm, objdump, and size exist. + +Wed Nov 3 11:12:32 1993 Rob Savoye (rob@darkstar.cygnus.com) + + * config/udi.exp,unix.exp: Transform tool name. + * binutils.all/*.exp: Clear errorInfo after exec. + +Fri Jul 2 12:41:20 1993 Ian Lance Taylor (ian@cygnus.com) + + * binutils.all/*.exp: Use -- for long arguments rather than +. + +Fri Jun 4 10:52:29 1993 david d `zoo' zuhn (zoo@cirdan.cygnus.com) + + * configure.in: change srctrigger to Makefile.in + +Wed May 26 17:27:46 1993 Ian Lance Taylor (ian@cygnus.com) + + * Makefile.in (FLAGS_TO_PASS): Pass down CC and CFLAGS. + +Fri May 7 13:58:44 1993 Ian Lance Taylor (ian@cygnus.com) + + * binutils.all/objdump.exp: Update for new usage message. + +Mon Apr 19 14:08:52 1993 Rob Savoye (rob@darkstar.cygnus.com) + + * binutils.all/*.exp: Use the new util_test proc. + * Makefile.in: Create a local site.exp file with config info. + +Thu Mar 25 05:38:47 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) + + * nm.all/configure.in (srcname): Delete extra quote. + +Mon Feb 22 07:54:03 1993 Mike Werner (mtw@poseidon.cygnus.com) + + * binutils/testsuite: made modifications to testcases, etc., to allow + them to work properly given the reorganization of deja-gnu and the + relocation of the testcases from deja-gnu to a "tool" subdirectory. + +Sun Feb 21 10:55:55 1993 Mike Werner (mtw@poseidon.cygnus.com) + + * binutils/testsuite: Initial creation of binutils/testsuite. + Migrated dejagnu testcases and support files for testing nm to + binutils/testsuite from deja-gnu. These files were moved "as is" + with no modifications. This migration is part of a major overhaul + of dejagnu. The modifications to these testcases, etc., which + will allow them to work with the new version of dejagnu will be + made in a future update. diff --git a/binutils/testsuite/binutils-all/ar.exp b/binutils/testsuite/binutils-all/ar.exp new file mode 100644 index 0000000000000..7f01c7640785b --- /dev/null +++ b/binutils/testsuite/binutils-all/ar.exp @@ -0,0 +1,256 @@ +# Copyright 1995, 1997, 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 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. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# Written by Ian Lance Taylor + +if ![is_remote host] { + if {[which $AR] == 0} then { + perror "$AR does not exist" + return + } +} + +# send_user "Version [binutil_version $AR]" + +# Test long file name support + +proc long_filenames { } { + global AR + global host_triplet + + set testname "ar long file names" + + set n1 "abcdefghijklmnopqrstuvwxyz1" + set n2 "abcdefghijklmnopqrstuvwxyz2" + set file1 tmpdir/$n1 + set file2 tmpdir/$n2 + + remote_file build delete $file1 + + # Some file systems truncate file names at 14 characters, which + # makes it impossible to run this test. Check for that now. + set status [catch "set f [open tmpdir/$n1 w]" errs] + if { $status != 0 } { + verbose -log "open tmpdir/$n1 returned $errs" + unsupported $testname + return + } + puts $f "first" + close $f + + + remote_file build delete $file2 + + set status [catch "set f [open tmpdir/$n2 w]" errs] + if { $status != 0 } { + verbose -log "open tmpdir/$n2 returned $errs" + unsupported $testname + return + } + puts $f "second" + close $f + + if [is_remote host] { + set file1 [remote_download host $file1]; + set file2 [remote_download host $file2]; + set dest artest.a + } else { + set dest tmpdir/artest.a + } + + remote_file host delete $dest; + + set got [binutils_run $AR "rc $dest $file1 $file2"] + if [is_remote host] { + remote_upload host $file1 tmpdir/$n1 + } + + set f [open tmpdir/$n1 r] + gets $f string + close $f + if ![string match "first" $string] { + verbose -log "reading tmpdir/$n1 returned $string" + unsupported $testname + return + } + + remote_file host delete $dest; + set got [binutils_run $AR "rc $dest $file1 $file2"] + + if ![string match "" $got] { + fail $testname + return + } + + remote_file build delete tmpdir/$n1 + remote_file build delete tmpdir/$n2 + + set got [binutils_run $AR "t $dest"] + regsub "\[\r\n \t\]*$" "$got" "" got; + if ![string match "$n1*$n2" $got] { + fail $testname + return + } + + if [is_remote host] { + remote_file host delete $file1; + remote_file host delete $file2; + } + + verbose -log "$AR x $dest" + set exec_output [binutils_run $AR "x $dest"] + set exec_output [prune_warnings $exec_output] + if ![string match "" $exec_output] { + verbose -log $exec_output + fail $testname + return + } + + if [is_remote host] { + remote_upload host $n1 tmpdir/$n1; + remote_upload host $n2 tmpdir/$n2; + set file1 tmpdir/$n1 + set file2 tmpdir/$n2 + } else { + set file1 $n1 + set file2 $n2 + } + + if ![file exists $file1] { + verbose -log "$file1 does not exist" + fail $testname + return + } + if ![file exists $file2] { + verbose -log "$file2 does not exist" + fail $testname + return + } + + set f [open $file1 r] + if { [gets $f line] == -1 || $line != "first" } { + verbose -log "$file1 contents:" + verbose -log "$line" + close $f + fail $testname + return + } + close $f + + set f [open $file2 r] + if { [gets $f line] == -1 || $line != "second" } { + verbose -log "$file2 contents:" + verbose -log "$line" + close $f + fail $testname + return + } + close $f + + file delete $file1 $file2 + pass $testname +} + +# Test building the symbol table. + +proc symbol_table { } { + global AR + global AS + global NM + global srcdir + global subdir + + set testname "ar symbol table" + + if ![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o] { + unresolved $testname + return + } + + if [is_remote host] { + set archive artest.a + set objfile [remote_download host tmpdir/bintest.o] + remote_file host delete $archive + } else { + set archive tmpdir/artest.a + set objfile tmpdir/bintest.o + } + + remote_file build delete tmpdir/artest.a + + set got [binutils_run $AR "rc $archive ${objfile}"] + if ![string match "" $got] { + fail $testname + return + } + + set got [binutils_run $NM "--print-armap $archive"] + if { ![string match "*text_symbol in bintest.o*" $got] \ + || ![string match "*data_symbol in bintest.o*" $got] \ + || ![string match "*common_symbol in bintest.o*" $got] \ + || [string match "*static_text_symbol in bintest.o*" $got] \ + || [string match "*static_data_symbol in bintest.o*" $got] \ + || [string match "*external_symbol in bintest.o*" $got] } { + fail $testname + return + } + + pass $testname +} + +# Test POSIX-compatible argument parsing. + +proc argument_parsing { } { + global AR + global AS + global srcdir + global subdir + + set testname "ar argument parsing" + + if ![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o] { + unresolved $testname + return + } + + if [is_remote host] { + set archive artest.a + set objfile [remote_download host tmpdir/bintest.o] + remote_file host delete $archive + } else { + set archive tmpdir/artest.a + set objfile tmpdir/bintest.o + } + + remote_file build delete tmpdir/artest.a + + set got [binutils_run $AR "-r -c $archive ${objfile}"] + if ![string match "" $got] { + fail $testname + return + } + + pass $testname +} + +# Run the tests. + +long_filenames +symbol_table +argument_parsing diff --git a/binutils/testsuite/binutils-all/bintest.s b/binutils/testsuite/binutils-all/bintest.s new file mode 100644 index 0000000000000..9e006502219df --- /dev/null +++ b/binutils/testsuite/binutils-all/bintest.s @@ -0,0 +1,12 @@ + .globl text_symbol + .text +text_symbol: +static_text_symbol: + .long 1 + .long external_symbol + .globl data_symbol + .data +data_symbol: +static_data_symbol: + .long 2 + .comm common_symbol,4 diff --git a/binutils/testsuite/binutils-all/dlltool.exp b/binutils/testsuite/binutils-all/dlltool.exp new file mode 100644 index 0000000000000..77b09eb40f1e6 --- /dev/null +++ b/binutils/testsuite/binutils-all/dlltool.exp @@ -0,0 +1,47 @@ +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +if {![istarget "i*86-*-*"]} { + return +} + +if {![istarget "i*86-*-*pe*"] \ + && ![istarget "i*86-*-cygwin*"] \ + && ![istarget "i*86-*-mingw32*"] } { + set target_xfail "yes" +} else { + set target_xfail "no" +} + +if {![info exists DLLTOOL]} then { + return +} + +if {[which $DLLTOOL] == 0} then { + return +} + +verbose "$DLLTOOL -d $srcdir/$subdir/fastcall.def" 1 +catch "exec $DLLTOOL -d $srcdir/$subdir/fastcall.def" err + +if ![string match "" $err] then { + send_log "$err\n" + verbose "$err" 1 + fail "dlltool (fastcall export)" + continue; +} + +pass "dlltool (fastcall export)" diff --git a/binutils/testsuite/binutils-all/fastcall.def b/binutils/testsuite/binutils-all/fastcall.def new file mode 100644 index 0000000000000..bef49682c452e --- /dev/null +++ b/binutils/testsuite/binutils-all/fastcall.def @@ -0,0 +1,2 @@ +EXPORTS +@fastcall@4 diff --git a/binutils/testsuite/binutils-all/hppa/addendbug.s b/binutils/testsuite/binutils-all/hppa/addendbug.s new file mode 100644 index 0000000000000..659306f074196 --- /dev/null +++ b/binutils/testsuite/binutils-all/hppa/addendbug.s @@ -0,0 +1,23 @@ + .SPACE $PRIVATE$ + .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31 + .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82 + .SPACE $TEXT$ + .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44 + .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY + .IMPORT $global$,DATA + .IMPORT $$dyncall,MILLICODE +; gcc_compiled.: + .SPACE $TEXT$ + .SUBSPA $CODE$ + + .align 4 + .EXPORT initialize_char_syntax,CODE + .EXPORT initialize_char_syntax,ENTRY,PRIV_LEV=3,RTNVAL=GR +initialize_char_syntax + .PROC + .CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3 + .ENTRY + addil L'is_idchar-$global$-32,%r27 + .EXIT + .PROCEND +is_idchar .comm 256 diff --git a/binutils/testsuite/binutils-all/hppa/freg.s b/binutils/testsuite/binutils-all/hppa/freg.s new file mode 100644 index 0000000000000..501e10f937d8a --- /dev/null +++ b/binutils/testsuite/binutils-all/hppa/freg.s @@ -0,0 +1,23 @@ + .LEVEL 2.0 + .SPACE $PRIVATE$ + .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31 + .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82 + .SPACE $TEXT$ + .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44 + .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY + .IMPORT $global$,DATA + .IMPORT $$dyncall,MILLICODE +; gcc_compiled.: + .SPACE $TEXT$ + .SUBSPA $CODE$ + + .align 4 + .NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY + .EXPORT main,ENTRY,PRIV_LEV=3,RTNVAL=GR +main + .PROC + .CALLINFO FRAME=64,CALLS,SAVE_RP + .ENTRY + fmpyfadd,sgl %fr4L,%fr4R,%fr5R,%fr5L + .EXIT + .PROCEND diff --git a/binutils/testsuite/binutils-all/hppa/objdump.exp b/binutils/testsuite/binutils-all/hppa/objdump.exp new file mode 100644 index 0000000000000..001e6dfd8f139 --- /dev/null +++ b/binutils/testsuite/binutils-all/hppa/objdump.exp @@ -0,0 +1,96 @@ +# Copyright 1993, 1994, 1995, 1997, 1999, 2000 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye +# and rewritten by Ian Lance Taylor + +if ![istarget hppa*-*-*] then { + return +} + +# These tests are not suitable for wide mode. +if [istarget hppa*w-*-*] then { + return +} + +# elf hppa assembler doesn't support .subspa +if {[istarget *64*-*-*] || [istarget *-*-*elf*] || [istarget *-*-linux*]} then { + return +} + +if {[which $OBJDUMP] == 0} then { + perror "$OBJDUMP does not exist" + return +} + +send_user "Version [binutil_version $OBJDUMP]" + +if {![binutils_assemble $srcdir/$subdir/addendbug.s tmpdir/addendbug.o]} then { + return +} + +if [is_remote host] { + set objfile [remote_download host tmpdir/addendbug.o] +} else { + set objfile tmpdir/addendbug.o +} + +# Make sure the SOM BFD code sign extends constants in R_DATA_OVERRIDE fixups. + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r $objfile"] + +if [istarget hppa*-*-*elf*] then { + set want "00000000 R_PARISC_DPREL21L\[ \]+is_idchar\\+0xffffffe0.*" +} else { + set want "00000000 R_DP_RELATIVE\[ \]+is_idchar\\+0xffffffe0.*" +} + + +if [regexp $want $got] then { + pass "addendbug test" +} else { + fail "addendbug test" +} + +########################### +# Set up the test of freg.s +########################### + +if {![binutils_assemble $srcdir/$subdir/freg.s tmpdir/freg.o]} then { + return +} + +if [is_remote host] { + set objfile [remote_download host tmpdir/freg.o] +} else { + set objfile tmpdir/freg.o +} + +# Make sure that we get R float regs like we're supposed to + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble $objfile"] + +set want "fmpyfadd,sgl fr4,fr4R,fr5R,fr5" + +if [regexp $want $got] then { + pass "freg test" +} else { + fail "freg test" +} diff --git a/binutils/testsuite/binutils-all/nm.exp b/binutils/testsuite/binutils-all/nm.exp new file mode 100644 index 0000000000000..8069eda608eea --- /dev/null +++ b/binutils/testsuite/binutils-all/nm.exp @@ -0,0 +1,123 @@ +# Copyright 1993, 1994, 1995, 1997 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye +# and rewritten by Ian Lance Taylor + +if ![is_remote host] { + if {[which $NM] == 0} then { + perror "$NM does not exist" + return + } +} + +send_user "Version [binutil_version $NM]" + + +if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { + return +} + +if [is_remote host] { + set tempfile [remote_download host tmpdir/bintest.o] +} else { + set tempfile tmpdir/bintest.o +} + +# Test nm with no arguments. + +# This test does not work correctly on ECOFF targets, because ECOFF +# stores most symbols twice, which messes up the nm output. +setup_xfail "alpha*-*-osf*" "alpha*-*-netware*" +setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*" +setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*" + +# This test does not work correctly on XCOFF targets, because XCOFF +# does not enter static symbols in the symbol table. +setup_xfail "*-*-aix*" + +set got [binutils_run $NM "$NMFLAGS $tempfile"] + +if [info exists vars] then { unset vars } +while {[regexp "(\[a-zA-Z\]) (\[a-z_\]*_symbol)(.*)" $got all type symbol rest]} { + set vars($symbol) $type + set got $rest +} + +if {![info exists vars(text_symbol)] \ + || $vars(text_symbol) != "T" \ + || ![info exists vars(data_symbol)] \ + || $vars(data_symbol) != "D" \ + || ![info exists vars(common_symbol)] \ + || $vars(common_symbol) != "C" \ + || ![info exists vars(external_symbol)] \ + || $vars(external_symbol) != "U" \ + || ![info exists vars(static_text_symbol)] \ + || $vars(static_text_symbol) != "t" \ + || ![info exists vars(static_data_symbol)] \ + || $vars(static_data_symbol) != "d"} { + fail "nm (no arguments)" +} else { + pass "nm (no arguments)" +} + +# Test nm -g + +set got [binutils_run $NM "$NMFLAGS -g $tempfile"] + +if [info exists vars] then { unset vars } +while {[regexp "(\[a-z_\]*_symbol)(.*)" $got all symbol rest]} { + set vars($symbol) 1 + set got $rest +} + +if {![info exists vars(text_symbol)] \ + || ![info exists vars(data_symbol)] \ + || ![info exists vars(common_symbol)] \ + || ![info exists vars(external_symbol)] \ + || [info exists vars(static_text_symbol)] \ + || [info exists vars(static_data_symbol)]} { + fail "nm -g" +} else { + pass "nm -g" +} + +# Test nm -P + +# This test does not work correctly on ECOFF targets, because ECOFF +# stores most symbols twice, which messes up the nm output. +setup_xfail "alpha*-*-osf*" "alpha*-*-netware*" +setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*" +setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*" + +# This test does not work correctly on XCOFF targets, because XCOFF +# does not enter static symbols in the symbol table. +setup_xfail "*-*-aix*" + +set got [binutils_run $NM "$NMFLAGS -P $tempfile"] + +set want "common_symbol C \[0\]*4.*data_symbol D \[0-9a-fA-F\]*.*external_symbol U.*static_data_symbol d \[0-9a-fA-F\]*.*static_text_symbol t \[0-9a-fA-F\]*.*text_symbol T \[0-9a-fA-F\]*" + +if [regexp $want $got] then { + pass "nm -P" +} else { + fail "nm -P" +} + +# There are certainly other tests that could be run. diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp new file mode 100644 index 0000000000000..e84868bba31c8 --- /dev/null +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -0,0 +1,650 @@ +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# Written by Ian Lance Taylor + +if ![is_remote host] { + if {[which $OBJCOPY] == 0} then { + perror "$OBJCOPY does not exist" + return + } +} + +send_user "Version [binutil_version $OBJCOPY]" + +if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { + perror "unresolved 1" + unresolved "objcopy (simple copy)" + return +} + +if ![is_remote host] { + set tempfile tmpdir/bintest.o; + set copyfile tmpdir/copy; +} else { + set tempfile [remote_download host tmpdir/bintest.o] + set copyfile copy +} + +# Test that objcopy does not modify a file when copying it. + +set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $tempfile ${copyfile}.o"] + +if ![string match "" $got] then { + fail "objcopy (simple copy)" +} else { + send_log "cmp $tempfile ${copyfile}.o\n" + verbose "cmp $tempfile ${copyfile}.o" + if [is_remote host] { + set src1 tmpdir/bintest.o + set src2 tmpdir/copy.o + remote_upload host $tempfile $src1; + remote_upload host ${copyfile}.o $src2; + } else { + set src1 ${tempfile} + set src2 ${copyfile}.o + } + set status [remote_exec build cmp "${src1} ${src2}"]; + set exec_output [lindex $status 1]; + set exec_output [prune_warnings $exec_output] + + # On some systems the result of objcopy will not be identical. + # Usually this is just because gas isn't using bfd to write the files + # in the first place, and may order things a little differently. + # Those systems should use setup_xfail here. + + setup_xfail "a29k-*" + setup_xfail "h8300-*-rtems*" "h8300-*-coff" + setup_xfail "h8500-*-rtems*" "h8500-*-coff" + setup_xfail "hppa*-*-*" + setup_xfail "i960-*" + setup_xfail "m68*-*-*coff" "m68*-*-hpux*" "m68*-*-lynxos*" + setup_xfail "m68*-*-sysv*" "m68*-apple-aux*" + setup_xfail "m8*-*" + setup_xfail "or32-*-rtems*" "or32-*-coff" + setup_xfail "sh-*-coff*" "sh-*-rtems*" + setup_xfail "tic4x-*-*" "tic80-*-*" "w65-*" "z8*-*" + + clear_xfail "hppa*64*-*-hpux*" "hppa*-*-linux*" "hppa*-*-lites*" + clear_xfail "hppa*-*-*n*bsd*" "hppa*-*-rtems*" "*-*-*elf*" "m68*-*-sysv4*" + + if [string match "" $exec_output] then { + pass "objcopy (simple copy)" + } else { + send_log "$exec_output\n" + verbose "$exec_output" 1 + + # On OSF/1, this succeeds with gas and fails with /bin/as. + setup_xfail "alpha*-*-osf*" + + # This fails for COFF i960-vxworks targets. + setup_xfail "i960-*-vxworks*" + + fail "objcopy (simple copy)" + } +} + +# Test generating S records. + +# We make the srec filename 8.3 compatible. Note that the header string +# matched against depends on the name of the file. Ugh. + +if [is_remote host] { + set srecfile copy.sre + set header_string S00B0000636F70792E737265C1 +} else { + set srecfile ${copyfile}.srec + set header_string S0130000746D706469722F636F70792E7372656397 +} + +set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${srecfile}"] + +if ![string match "" $got] then { + fail "objcopy -O srec" +} else { + if [is_remote host] { + remote_upload host ${srecfile} tmpdir/copy.srec; + set srecfile tmpdir/copy.srec; + } + set file [open ${srecfile} r] + + # The first S record is fixed by the file name we are using. + gets $file line + send_log "$line\n" + verbose $line + if ![regexp "$header_string.*" $line] { + send_log "bad header\n" + fail "objcopy -O srec" + } else { + while {[gets $file line] != -1 \ + && [regexp "^S\[123\]\[0-9a-fA-F\]+\[\r\n\]*$" $line]} { + send_log "$line\n" + verbose $line + set line "**EOF**" + } + send_log "$line\n" + verbose $line + if ![regexp "^S\[789\]\[0-9a-fA-F\]+\[\r\n\]*$" $line] then { + send_log "bad trailer\n" + fail "objcopy -O srec" + } else { + if {[gets $file line] != -1} then { + send_log "garbage at end\n" + send_log "$line\n" + verbose $line + fail "objcopy -O srec" + } else { + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"] + if ![regexp "file format srec" $got] then { + send_log "objdump failed\n" + fail "objcopy -O srec" + } else { + pass "objcopy -O srec" + } + } + } + } + + close $file +} + +# Test setting and adjusting the start address. We only test this +# while generating S records, because we may not be able to set the +# start address for other object file formats, and the S record case +# is the only useful one anyhow. + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f $tempfile"] +if ![regexp "start address (\[0-9a-fA-FxX\]+)" $got all origstart] then { + perror "objdump can not recognize bintest.o" + set origstart "" +} else { + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --set-start 0x7654 $tempfile ${copyfile}.srec"] + if ![string match "" $got] then { + fail "objcopy --set-start" + } else { + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"] + if ![regexp "file format srec.*start address (\[0-9a-fA-FxX\]+)" $got all srecstart] then { + fail "objcopy --set-start" + } else { + if {$srecstart != 0x7654} then { + send_log "$srecstart != 0x7654\n" + fail "objcopy --set-start" + } else { + pass "objcopy --set-start" + } + } + } + + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --adjust-start 0x123 $tempfile ${copyfile}.srec"] + if ![string match "" $got] then { + fail "objcopy --adjust-start" + } else { + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"] + if ![regexp "file format srec.*start address (\[0-9a-fA-FxX\]+)" $got all srecstart] then { + fail "objcopy --adjust-start" + } else { + if {$srecstart != $origstart + 0x123} then { + send_log "$srecstart != $origstart + 0x123\n" + fail "objcopy --adjust-start" + } else { + pass "objcopy --adjust-start" + } + } + } +} + +# Test adjusting the overall VMA, and adjusting the VMA of a +# particular section. We again only test this when generating S +# records. + +set low "" +set lowname "" + +set headers [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h $tempfile"] + +set headers_regexp "\[ 0-9\]+(\[^ \]+)\[ \]*(\[0-9a-fA-F\]+)\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)\[ \]+\[0-9a-fA-F\]+\[ \]+2\[*\]\[*\]\[0-9\]+(.*)" + +set got $headers +while {[regexp $headers_regexp $got all name size vma rest]} { + set vma 0x$vma + set size 0x$size + if {$size != 0} { + if {$low == "" || $vma < $low} { + set low $vma + set lowname $name + } + } + set got $rest +} + +if {$low == "" || $origstart == ""} then { + perror "objdump can not recognize bintest.o" +} else { + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --adjust-vma 0x123 $tempfile ${copyfile}.srec"] + if ![string match "" $got] then { + fail "objcopy --adjust-vma" + } else { + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -fh ${copyfile}.srec"] + set want "file format srec.*start address\[ \]*(\[0-9a-fA-FxX\]+).*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)" + if ![regexp $want $got all start vma] then { + fail "objcopy --adjust-vma" + } else { + set vma 0x$vma + if {$vma != $low + 0x123} then { + send_log "$vma != $low + 0x123\n" + fail "objcopy --adjust-vma" + } else { + if {$start != $origstart + 0x123} then { + send_log "$start != $origstart + 0x123\n" + fail "objcopy --adjust-vma" + } else { + pass "objcopy --adjust-vma" + } + } + } + } + + set arg "" + set got $headers + while {[regexp $headers_regexp $got all name size vma rest]} { + set vma 0x$vma + if {$vma == $low} then { + set arg "$arg --adjust-section-vma $name+4" + } + set got $rest + } + + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $arg $tempfile ${copyfile}.srec"] + if ![string match "" $got] then { + fail "objcopy --adjust-section-vma +" + } else { + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h ${copyfile}.srec"] + set want "file format srec.*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)" + if ![regexp $want $got all vma] then { + fail "objcopy --adjust-section-vma +" + } else { + set vma 0x$vma + if {$vma != $low + 4} then { + send_log "$vma != $low + 4\n" + fail "objcopy --adjust-section-vma +" + } else { + pass "objcopy --adjust-section-vma +" + } + } + } + + regsub -all "\\+4" $arg "=[expr $low + 4]" argeq + set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $argeq $tempfile ${copyfile}.srec"] + if ![string match "" $got] then { + fail "objcopy --adjust-section-vma =" + } else { + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h ${copyfile}.srec"] + set want "file format srec.*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)" + if ![regexp $want $got all vma] then { + fail "objcopy --adjust-section-vma =" + } else { + set vma 0x$vma + if {$vma != $low + 4} then { + send_log "$vma != $low + 4\n" + fail "objcopy --adjust-section-vma =" + } else { + pass "objcopy --adjust-section-vma =" + } + } + } +} + +# Test stripping an object. + +proc strip_test { } { + global AR + global CC + global STRIP + global STRIPFLAGS + global NM + global NMFLAGS + global srcdir + global subdir + + set test "strip" + + if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } { + untested $test + return + } + + if [is_remote host] { + set archive libstrip.a + set objfile [remote_download host tmpdir/testprog.o]; + remote_file host delete $archive + } else { + set archive tmpdir/libstrip.a + set objfile tmpdir/testprog.o + } + + remote_file build delete tmpdir/libstrip.a + + set exec_output [binutils_run $AR "rc $archive ${objfile}"] + if ![string match "" $exec_output] { + fail $test + return + } + + set exec_output [binutils_run $STRIP "$STRIPFLAGS $archive"] + if ![string match "" $exec_output] { + fail $test + return + } + + if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } { + untested $test + return + } + + if [is_remote host] { + set objfile [remote_download host tmpdir/testprog.o]; + } else { + set objfile tmpdir/testprog.o + } + + set exec_output [binutils_run $STRIP "$STRIPFLAGS $objfile"] + if ![string match "" $exec_output] { + fail $test + return + } + + set exec_output [binutils_run $NM "-a $NMFLAGS $objfile"] + if ![string match "*: no symbols*" $exec_output] { + fail $test + return + } + + pass $test +} + +strip_test + +# Test stripping an object file with saving a symbol + +proc strip_test_with_saving_a_symbol { } { + global CC + global STRIP + global STRIPFLAGS + global NM + global NMFLAGS + global srcdir + global subdir + + set test "strip with saving a symbol" + + if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } { + untested $test + return + } + + if [is_remote host] { + set objfile [remote_download host tmpdir/testprog.o]; + } else { + set objfile tmpdir/testprog.o + } + + set exec_output [binutils_run $STRIP "$STRIPFLAGS -K main -K _main $objfile"] + if ![string match "" $exec_output] { + fail $test + return + } + + set exec_output [binutils_run $NM "$NMFLAGS $objfile"] + if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \ + && ![regexp {^([0-9a-fA-F]+)?[ ]+T _main} $exec_output]} { + fail $test + return + } + + pass $test +} + +strip_test_with_saving_a_symbol + +# Build a final executable. + +if { [istarget *-*-cygwin] || [istarget *-*-mingw32] } { + set test_prog "testprog.exe" +} else { + set test_prog "testprog" +} + +proc copy_setup { } { + global srcdir + global subdir + global gcc_gas_flag + global test_prog + + set res [build_wrapper testglue.o]; + set flags { debug }; + + if { $res != "" } { + lappend flags "additional_flags=[lindex $res 1]"; + set add_libs "testglue.o"; + } else { + set add_libs ""; + } + + if { [istarget *-*-linux*] } { + foreach i $gcc_gas_flag { + set flags "additional_flags=$i $flags" + } + } + if { [target_compile "$srcdir/$subdir/testprog.c $add_libs" tmpdir/$test_prog executable $flags] != "" } { + return 2 + } + + set result [remote_load target tmpdir/$test_prog]; + set status [lindex $result 0]; + + if { $status != "pass" } { + perror "unresolved setup, status = $status" + return 3 + } + + return 0 +} + +# Test copying an executable. + +proc copy_executable { prog flags test1 test2 } { + global test_prog + + if [is_remote host] { + set testfile [remote_download host tmpdir/$test_prog]; + set testcopy copyprog + } else { + set testfile tmpdir/$test_prog + set testcopy tmpdir/copyprog + } + remote_file host delete $testcopy; + + set exec_output [binutils_run $prog "$flags $testfile $testcopy"] + + if ![string match "" $exec_output] { + fail $test1 + fail $test2 + return + } + + if [is_remote host] { + remote_upload host $testcopy tmpdir/copyprog + } + + set status [remote_exec build "cmp" "tmpdir/$test_prog tmpdir/copyprog"] + set exec_output [lindex $status 1]; + + if [string match "" $exec_output] then { + pass $test1 + } else { + send_log "$exec_output\n" + verbose "$exec_output" + + # This will fail for many reasons. For example, it will most + # likely fail if a non-GNU linker is used. Therefore, we do + # not insist that it pass. If you are using an assembler and + # linker based on the same BFD as objcopy, it is worth + # investigating to see why this failure occurs. If we are + # cross compiling, we assume that a GNU linker is being used, + # and expect it to succeed. + if {[isnative]} then { + setup_xfail "*-*-*" + } + + # This also fails for mips*-*-elf targets. See elf32-mips.c + # mips_elf_sym_is_global. + setup_xfail "mips*-*-elf" + + setup_xfail "*arm*-*-coff" + setup_xfail "xscale-*-coff" + setup_xfail "arm*-*-pe" + setup_xfail "thumb*-*-coff" + setup_xfail "thumb*-*-pe" + + fail $test1 + } + + set output [remote_load target tmpdir/copyprog] + set status [lindex $output 0]; + if { $status != "pass" } { + fail $test2 + } else { + pass $test2 + } +} + +# Test stripping an executable + +proc strip_executable { prog flags test } { + global NM + global NMFLAGS + + remote_download build tmpdir/copyprog tmpdir/striprog + if [is_remote host] { + set copyfile [remote_download host tmpdir/striprog]; + } else { + set copyfile tmpdir/striprog + } + + set exec_output [binutils_run $prog "$flags ${copyfile}"] + if ![string match "" $exec_output] { + fail $test + return + } + + if [is_remote host] { + remote_upload host ${copyfile} tmpdir/striprog; + } + + set result [remote_load target tmpdir/striprog] + set status [lindex $result 0]; + if { $status != "pass" } { + fail $test + return + } + + set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"] + if ![string match "*: no symbols*" $exec_output] { + fail $test + return + } + pass $test +} + +# Test stripping an executable with saving a symbol + +proc strip_executable_with_saving_a_symbol { prog flags test } { + global NM + global NMFLAGS + + remote_download build tmpdir/copyprog tmpdir/striprog + if [is_remote host] { + set copyfile [remote_download host tmpdir/striprog]; + } else { + set copyfile tmpdir/striprog + } + + set exec_output [binutils_run $prog "$flags ${copyfile}"] + if ![string match "" $exec_output] { + fail $test + return + } + + if [is_remote host] { + remote_upload host ${copyfile} tmpdir/striprog; + } + + set result [remote_load target tmpdir/striprog] + set status [lindex $result 0]; + if { $status != "pass" } { + fail $test + return + } + + set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"] + if { [istarget mmix-knuth-mmixware] } { + # Whenever there's a symbol in the mmo format, there's the symbol + # Main, so remove it manually from the expected output for sake of + # this test. + + # Using "" not {} to get the \n and \r translated. + regsub "^\[0-9a-fA-F\]+\[ \]+T Main\[\n\r\]+" $exec_output "" exec_output + } + + if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \ + && ![regexp {^([0-9a-fA-F]+)?[ ]+[TD] _main} $exec_output]} { + fail $test + return + } + pass $test +} + +set test1 "simple objcopy of executable" +set test2 "run objcopy of executable" +set test3 "run stripped executable" +set test4 "run stripped executable with saving a symbol" + +switch [copy_setup] { + "1" { + # do nothing + } + "2" { + untested $test1 + untested $test2 + untested $test3 + untested $test4 + } + "3" { + unresolved $test1 + unresolved $test2 + unresolved $test3 + unresolved $test4 + } + "0" { + copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" "$test2" + strip_executable "$STRIP" "$STRIPFLAGS" "$test3" + strip_executable_with_saving_a_symbol "$STRIP" "-K main -K _main $STRIPFLAGS" "$test4" + } +} diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp new file mode 100644 index 0000000000000..409d9d8f10b6a --- /dev/null +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -0,0 +1,163 @@ +# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye +# and rewritten by Ian Lance Taylor + +if ![is_remote host] { + if {[which $OBJDUMP] == 0} then { + perror "$OBJDUMP does not exist" + return + } +} + +send_user "Version [binutil_version $OBJDUMP]" + +# Simple test of objdump -i + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -i"] + +set cpus_expected [list] +lappend cpus_expected a29k alliant alpha arc arm convex +lappend cpus_expected d10v d30v fr30 fr500 fr550 h8 hppa i386 i860 i960 ip2022 +lappend cpus_expected m32r m68hc11 m68hc12 m68k m88k MCore +lappend cpus_expected mips mn10200 mn10300 msp ns32k pj powerpc pyramid +lappend cpus_expected romp rs6000 s390 sh sparc +lappend cpus_expected tahoe tic54x tic80 tms320c30 tms320c4x tms320c54x v850 +lappend cpus_expected vax we32k x86-64 xscale z8k z8001 z8002 + +# Make sure the target CPU shows up in the list. +lappend cpus_expected ${target_cpu} + +# Create regexp +set cpus_regex "([join $cpus_expected | ])" + +verbose -log "CPU regex: $cpus_regex" + +set want "BFD header file version.*srec\[^\n\]*\n\[^\n\]*header \[^\n\]*endian\[^\n\]*, data \[^\n\]*endian.*$cpus_regex" + +if [regexp $want $got] then { + pass "objdump -i" +} else { + fail "objdump -i" +} + +# The remaining tests require a test file. + + +if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { + return +} +if [is_remote host] { + set testfile [remote_download host tmpdir/bintest.o] +} else { + set testfile tmpdir/bintest.o +} + +# Test objdump -f + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f $testfile"] + +set want "$testfile:\[ \]*file format.*architecture:\[ \]*${cpus_regex}.*HAS_RELOC.*HAS_SYMS" + +if ![regexp $want $got] then { + fail "objdump -f" +} else { + pass "objdump -f" +} + +# Test objdump -h + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h $testfile"] + +set want "$testfile:\[ \]*file format.*Sections.*\[0-9\]+\[ \]+\[^ \]*(text|TEXT|\\\$CODE\\\$)\[^ \]*\[ \]*(\[0-9a-fA-F\]+).*\[0-9\]+\[ \]+\[^ \]*(\\.data|DATA)\[^ \]*\[ \]*(\[0-9a-fA-F\]+)" + +if ![regexp $want $got all text_name text_size data_name data_size] then { + fail "objdump -h" +} else { + verbose "text name is $text_name size is $text_size" + verbose "data name is $data_name size is $data_size" + set ets 8 + set eds 4 + # The [ti]c4x target has the property sizeof(char)=sizeof(long)=1 + if [istarget *c4x*-*-*] then { + set ets 2 + set eds 1 + } + # c54x section sizes are in bytes, not octets; adjust accordingly + if [istarget *c54x*-*-*] then { + set ets 4 + set eds 2 + } + if {[expr "0x$text_size"] < $ets || [expr "0x$data_size"] < $eds} then { + send_log "sizes too small\n" + fail "objdump -h" + } else { + pass "objdump -h" + } +} + +# Test objdump -t + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -t $testfile"] + +if [info exists vars] then { unset vars } +while {[regexp "(\[a-z\]*_symbol)(.*)" $got all symbol rest]} { + set vars($symbol) 1 + set got $rest +} + +if {![info exists vars(text_symbol)] \ + || ![info exists vars(data_symbol)] \ + || ![info exists vars(common_symbol)] \ + || ![info exists vars(external_symbol)]} then { + fail "objdump -t" +} else { + pass "objdump -t" +} + +# Test objdump -r + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r $testfile"] + +set want "$testfile:\[ \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT|\\\$CODE\\\$)\[^\]\]*\\\].*external_symbol" + +if [regexp $want $got] then { + pass "objdump -r" +} else { + fail "objdump -r" +} + +# Test objdump -s + +set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s $testfile"] + +set want "$testfile:\[ \]*file format.*Contents.*(text|TEXT|\\\$CODE\\\$)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000001|01000000|00000100).*Contents.*(data|DATA)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000002|02000000|00000200)" + +if [regexp $want $got] then { + pass "objdump -s" +} else { + fail "objdump -s" +} + +# Options which are not tested: -a -d -D -R -T -x -l --stabs +# I don't see any generic way to test any of these other than -a. +# Tests could be written for specific targets, and that should be done +# if specific problems are found. diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp new file mode 100644 index 0000000000000..4c5f99e927999 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.exp @@ -0,0 +1,343 @@ +# Copyright 1999, 2000 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# Written by Nick Clifton +# Based on scripts written by Ian Lance Taylor +# and Ken Raeburn . + +# First some helpful procedures, then the tests themselves + +# Return the contents of the filename given +proc file_contents { filename } { + set file [open $filename r] + set contents [read $file] + close $file + return $contents +} + +# regexp_diff, based on simple_diff taken from ld test suite +# compares two files line-by-line +# file1 contains strings, file2 contains regexps and #-comments +# blank lines are ignored in either file +# returns non-zero if differences exist +# +proc regexp_diff { file_1 file_2 } { + + set eof -1 + set end_1 0 + set end_2 0 + set differences 0 + set diff_pass 0 + + if [file exists $file_1] then { + set file_a [open $file_1 r] + } else { + warning "$file_1 doesn't exist" + return 1 + } + + if [file exists $file_2] then { + set file_b [open $file_2 r] + } else { + fail "$file_2 doesn't exist" + close $file_a + return 1 + } + + verbose " Regexp-diff'ing: $file_1 $file_2" 2 + + while { 1 } { + set line_a "" + set line_b "" + while { [string length $line_a] == 0 } { + if { [gets $file_a line_a] == $eof } { + set end_1 1 + break + } + } + while { [string length $line_b] == 0 || [string match "#*" $line_b] } { + if [ string match "#pass" $line_b ] { + set end_2 1 + set diff_pass 1 + break + } elseif [ string match "#..." $line_b ] { + if { [gets $file_b line_b] == $eof } { + set end_2 1 + break + } + verbose "looking for \"^$line_b$\"" 3 + while { ![regexp "^$line_b$" "$line_a"] } { + verbose "skipping \"$line_a\"" 3 + if { [gets $file_a line_a] == $eof } { + set end_1 1 + break + } + } + break + } + if { [gets $file_b line_b] == $eof } { + set end_2 1 + break + } + } + + if { $diff_pass } { + break + } elseif { $end_1 && $end_2 } { + break + } elseif { $end_1 } { + send_log "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1\n" + verbose "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1" 3 + set differences 1 + break + } elseif { $end_2 } { + send_log "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" + verbose "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" 3 + set differences 1 + break + } else { + verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3 + if ![regexp "^$line_b$" "$line_a"] { + send_log "regexp_diff match failure\n" + send_log "regexp \"^$line_b$\"\nline \"$line_a\"\n" + set differences 1 + } + } + } + + if { $differences == 0 && !$diff_pass && [eof $file_a] != [eof $file_b] } { + send_log "$file_1 and $file_2 are different lengths\n" + verbose "$file_1 and $file_2 are different lengths" 3 + set differences 1 + } + + close $file_a + close $file_b + + return $differences +} + +# Find out the size by reading the output of the EI_CLASS field. +# Similar to the test for readelf -h, but we're just looking for the +# EI_CLASS line here. +proc readelf_find_size { binary_file } { + global READELF + global READELFFLAGS + global readelf_size + + set readelf_size "" + set testname "finding out ELF size with readelf -h" + catch "exec $READELF $READELFFLAGS -h $binary_file > readelf.out" got + + if ![string match "" $got] then { + send_log $got + fail $testname + return + } + + if { ! [regexp "\n\[ \]*Class:\[ \]*ELF(\[0-9\]+)\n" \ + [file_contents readelf.out] nil readelf_size] } { + verbose -log "EI_CLASS field not found in output" + verbose -log "output is \n[file_contents readelf.out]" + fail $testname + return + } else { + verbose -log "ELF size is $readelf_size" + } + + pass $testname +} + +# Run an individual readelf test. +# Basically readelf is run on the binary_file with the given options. +# Readelf's output is captured and then compared against the contents +# of the regexp_file-readelf_size if it exists, else regexp_file. + +proc readelf_test { options binary_file regexp_file xfails } { + + global READELF + global READELFFLAGS + global readelf_size + global srcdir + global subdir + + send_log "exec $READELF $READELFFLAGS $options $binary_file > readelf.out\n" + catch "exec $READELF $READELFFLAGS $options $binary_file > readelf.out" got + + foreach xfail $xfails { + setup_xfail $xfail + } + + if ![string match "" $got] then { + fail "readelf $options (reason: unexpected output)" + send_log $got + send_log "\n" + return + } + + set target_machine "" + if [istarget "mips*-*-*"] then { + if { [istarget "mips*-*-*linux*"] } then { + set target_machine tmips + } else { + set target_machine mips + } + } + + if { $target_machine != "" && [file exists $srcdir/$subdir/$regexp_file-$readelf_size-$target_machine] } then { + set regexp_file $regexp_file-$readelf_size-$target_machine + } elseif { $target_machine != "" && [file exists $srcdir/$subdir/$regexp_file-$target_machine] } then { + set regexp_file $regexp_file-$target_machine + } elseif { [file exists $srcdir/$subdir/$regexp_file-$readelf_size] } then { + set regexp_file $regexp_file-$readelf_size + } + + if { [regexp_diff readelf.out $srcdir/$subdir/$regexp_file] } then { + fail "readelf $options" + verbose "output is \n[file_contents readelf.out]" 2 + return + } + + pass "readelf $options" +} + +# Simple proc to skip certain expected warning messages. + +proc prune_readelf_wi_warnings { text } { + regsub -all "(^|\n)(.*Skipping unexpected symbol type.*)" $text "\\1" text + return $text +} + +# Testing the "readelf -wi" option is difficult because there +# is no guaranteed order to the output, and because some ports +# will use indirect string references, whilst others will use +# direct references. So instead of having an expected output +# file, like the other readelf tests, we grep for strings that +# really ought to be there. + +proc readelf_wi_test {} { + global READELF + global READELFFLAGS + global srcdir + global subdir + + # Compile the second test file. + if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } { + verbose "Unable to compile test file." + untested "readelf -wi" + return + } + + # Download it. + set tempfile [remote_download host tmpdir/testprog.o]; + + # Run "readelf -wi" on it. + send_log "exec $READELF $READELFFLAGS -wi $tempfile > readelf.out\n" + catch "exec $READELF $READELFFLAGS -wi $tempfile > readelf.out" got + + # Upload the results. + set output [remote_upload host readelf.out]; + + file_on_host delete $tempfile; + + # Strip any superflous warnings. + set got [prune_readelf_wi_warnings $got] + + if ![string match "" $got] then { + fail "readelf $options (reason: unexpected output)" + send_log $got + send_log "\n" + return + } + + if ![file size $output] then { + # If the output file is empty, then this target does not + # generate dwarf2 output. This is not a failure. + verbose "No output from 'readelf -wi'" + untested "readelf -wi" + return + } + + # Search for strings that should be in the output. + set sought { + ".*DW_TAG_compile_unit.*" + ".*DW_TAG_subprogram.*" + ".*DW_TAG_base_type.*" + ".*DW_AT_producer.*(GNU C|indirect string).*" + ".*DW_AT_language.*ANSI C.*" + ".*DW_AT_name.*(testprog.c|indirect string).*" + ".*DW_AT_name.*fn.*" + ".*DW_AT_name.*(main|indirect string).*" + ".*\(DW_OP_addr: 0\).*" + } + + foreach looked_for $sought { + set lines [grep $output $looked_for] + if ![llength $lines] then { + fail "readelf -wi: missing: $looked_for" + send_log readelf.out + return + } + } + + file_on_host delete $output; + + # All done. + pass "readelf -wi" +} + + +# Exclude non-ELF targets. +if ![is_elf_format] { + verbose "$READELF is only intended for ELF targets" 2 + return +} + +if ![is_remote host] { + if {[which $READELF] == 0} then { + perror "$READELF does not exist" + return + } +} + +send_user "Version [binutil_version $READELF]" + +# Assemble the test file. +if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { + perror "unresolved 1" + unresolved "readelf - failed to assemble" + return +} + +if ![is_remote host] { + set tempfile tmpdir/bintest.o; +} else { + set tempfile [remote_download host tmpdir/bintest.o] +} + +# First, determine the size, so specific output matchers can be used. +readelf_find_size $tempfile + +# Run the tests. +readelf_test -h $tempfile readelf.h {} +readelf_test -S $tempfile readelf.s {} +readelf_test -s $tempfile readelf.ss {} +readelf_test -r $tempfile readelf.r {} + +readelf_wi_test diff --git a/binutils/testsuite/binutils-all/readelf.h b/binutils/testsuite/binutils-all/readelf.h new file mode 100644 index 0000000000000..01103fbab3997 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.h @@ -0,0 +1,20 @@ +ELF Header: + Magic: 7f 45 4c 46 0[12] 0[12] 01 .. .. 00 00 00 00 00 00 00 + Class: ELF[36][24] + Data: 2's complement,.* endian + Version: 1 \(current\) + OS/ABI: .* + ABI Version: .* + Type: REL \(Relocatable file\) + Machine: .* + Version: 0x1 + Entry point address: 0x0 + Start of program headers: 0 \(bytes into file\) + Start of section headers: .* \(bytes into file\) + Flags: .* + Size of this header: .* \(bytes\) + Size of program headers: 0 \(bytes\) + Number of program headers: 0 + Size of section headers: .* \(bytes\) + Number of section headers: .* + Section header string table index: .* diff --git a/binutils/testsuite/binutils-all/readelf.r b/binutils/testsuite/binutils-all/readelf.r new file mode 100644 index 0000000000000..689049f126fb0 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.r @@ -0,0 +1,4 @@ + +Relocation section '.rel.*text' at offset 0x.* contains 1 entries: + Offset Info Type Sym.Value Sym. Name.* +00000004 [0-9A-Fa-f]+ *R_.*00000000 external_symbol.* diff --git a/binutils/testsuite/binutils-all/readelf.r-64 b/binutils/testsuite/binutils-all/readelf.r-64 new file mode 100644 index 0000000000000..3e3b0a4a122e9 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.r-64 @@ -0,0 +1,4 @@ + +Relocation section '.rel.*text' at offset 0x.* contains 1 entries: + Offset Info Type Sym. Value Sym. Name.* +0+04 [0-9A-Fa-f]+ *R_.*0+00 external_symbol.* diff --git a/binutils/testsuite/binutils-all/readelf.s b/binutils/testsuite/binutils-all/readelf.s new file mode 100644 index 0000000000000..985a48bf7733c --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.s @@ -0,0 +1,24 @@ +There are .* section headers, starting at offset .*: + +Section Headers: + \[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al + \[ 0\] NULL 00000000 000000 000000 00 +0 +0 +0 +# On the normal MIPS systems, sections must be aligned to 16 byte +# boundaries. On IA64, text sections are aligned to 16 byte boundaries. + \[ 1\] .text PROGBITS 00000000 0000(34|40) 0000(08|10) 00 +AX +0 +0 +(.|..) + \[ 2\] .rel.+text +REL. +0+ 0+.* 00000. 0. +. +1 +4 +# MIPS targets put .rela.text here. +#... + \[ .\] .data PROGBITS 00000000 0000(3c|48|50) 0000(04|10) 00 WA +0 +0 +(.|..) + \[ .\] .bss NOBITS 00000000 0000(40|4c|60) 000000 00 WA +0 +0 +(.|..) +# MIPS targets put .reginfo and .mdebug here. +# v850 targets put .call_table_data and .call_table_text here. +#... + \[ .\] .shstrtab STRTAB 00000000 0+.* 0+.* 00 +0 +0 +. + \[ .\] .symtab SYMTAB 00000000 0+.* 0+.* 10 +.. +. +4 + \[..\] .strtab STRTAB 00000000 0+.* 0+.* 00 +0 +0 +1 +Key to Flags: + W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\) + I \(info\), L \(link order\), G \(group\), x \(unknown\) + O \(extra OS processing required\) o \(OS specific\), p \(processor specific\) + diff --git a/binutils/testsuite/binutils-all/readelf.s-64 b/binutils/testsuite/binutils-all/readelf.s-64 new file mode 100644 index 0000000000000..5496b41452555 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.s-64 @@ -0,0 +1,25 @@ +There are .* section headers, starting at offset .*: + +Section Headers: + \[Nr\] Name Type Address Offset + Size EntSize Flags Link Info Align + \[ 0\] NULL 0000000000000000 00000000 + 0000000000000000 0000000000000000 0 0 0 + \[ 1\] .text PROGBITS 0000000000000000 00000040 + 00000000000000.. 0000000000000000 AX 0 0 .* + \[ 2\] .rel.+text +REL. +0+ 0+.* + 000000000000001. 000000000000001. . 1 8 + \[ 3\] .data PROGBITS 0000000000000000 000000(48|50) + 000000000000000[48] 0000000000000000 WA 0 0 .* + \[ 4\] .bss NOBITS 0000000000000000 000000(4c|50|54|58) + 0000000000000000 0000000000000000 WA 0 0 .* + \[ 5\] .shstrtab STRTAB 0000000000000000 000000(4c|50|54|58) + 00000000000000.. 0000000000000000 0 0 .* + \[ 6\] .symtab SYMTAB 0000000000000000 0+.* + 0+.* 0000000000000018 7 6 8 + \[ 7\] .strtab STRTAB 0000000000000000 0+.* + 0+.* 0000000000000000 0 0 1 +Key to Flags: + W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\) + I \(info\), L \(link order\), G \(group\), x \(unknown\) + O \(extra OS processing required\) o \(OS specific\), p \(processor specific\) diff --git a/binutils/testsuite/binutils-all/readelf.ss b/binutils/testsuite/binutils-all/readelf.ss new file mode 100644 index 0000000000000..5a05910f4752a --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.ss @@ -0,0 +1,18 @@ + +Symbol table '.symtab' contains .* entries: + Num: Value Size Type Bind Vis Ndx Name + 0: 00000000 0 NOTYPE LOCAL DEFAULT UND + 1: 00000000 0 SECTION LOCAL DEFAULT 1 + 2: 00000000 0 SECTION LOCAL DEFAULT 3 + 3: 00000000 0 SECTION LOCAL DEFAULT 4 + 4: 00000000 0 NOTYPE LOCAL DEFAULT 1 static_text_symbol +# arm-elf targets add the $d mapping symbol here... +#... + .: 00000000 0 NOTYPE LOCAL DEFAULT 3 static_data_symbol +# v850 targets include extra SECTION symbols here for the .call_table_data +# and .call_table_text sections. +#... +.* .: 00000000 0 NOTYPE GLOBAL DEFAULT 1 text_symbol + .: 00000000 0 NOTYPE GLOBAL DEFAULT UND external_symbol + ..: 00000000 0 NOTYPE GLOBAL DEFAULT 3 data_symbol + ..: 00000004 4 OBJECT GLOBAL DEFAULT ( COM|ANSI_COM) common_symbol diff --git a/binutils/testsuite/binutils-all/readelf.ss-64 b/binutils/testsuite/binutils-all/readelf.ss-64 new file mode 100644 index 0000000000000..b29276d476031 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.ss-64 @@ -0,0 +1,13 @@ + +Symbol table '.symtab' contains .* entries: + Num: Value Size Type Bind Vis Ndx Name + 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND + 1: 0000000000000000 0 SECTION LOCAL DEFAULT 1 + 2: 0000000000000000 0 SECTION LOCAL DEFAULT 3 + 3: 0000000000000000 0 SECTION LOCAL DEFAULT 4 + 4: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 static_text_symbol + 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT 3 static_data_symbol +.* .: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 text_symbol + .: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND external_symbol + .: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 3 data_symbol + .: 0000000000000004 4 OBJECT GLOBAL DEFAULT COM common_symbol diff --git a/binutils/testsuite/binutils-all/readelf.ss-mips b/binutils/testsuite/binutils-all/readelf.ss-mips new file mode 100644 index 0000000000000..073ade018f9e9 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.ss-mips @@ -0,0 +1,15 @@ + +Symbol table '.symtab' contains 12 entries: + Num: Value Size Type Bind Vis Ndx Name + 0: 00000000 0 NOTYPE LOCAL DEFAULT UND + 1: 00000000 0 SECTION LOCAL DEFAULT . (|\.text) + 2: 00000000 0 SECTION LOCAL DEFAULT . (|\.data) + 3: 00000000 0 SECTION LOCAL DEFAULT . (|\.bss) + 4: 00000000 0 SECTION LOCAL DEFAULT . (|\.reginfo) + 5: 00000000 0 SECTION LOCAL DEFAULT . (|\.pdr) + 6: 00000000 0 OBJECT GLOBAL DEFAULT . text_symbol + 7: 00000000 0 NOTYPE LOCAL DEFAULT . static_text_symbol + 8: 00000000 0 NOTYPE GLOBAL DEFAULT UND external_symbol + 9: 00000000 0 OBJECT GLOBAL DEFAULT . data_symbol + 10: 00000000 0 NOTYPE LOCAL DEFAULT . static_data_symbol + 11: 00000004 4 OBJECT GLOBAL DEFAULT (PRC|COM) common_symbol diff --git a/binutils/testsuite/binutils-all/readelf.ss-tmips b/binutils/testsuite/binutils-all/readelf.ss-tmips new file mode 100644 index 0000000000000..4f2fba2228408 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.ss-tmips @@ -0,0 +1,15 @@ + +Symbol table '.symtab' contains 12 entries: + Num: Value Size Type Bind Vis Ndx Name + 0: 00000000 0 NOTYPE LOCAL DEFAULT UND + 1: 00000000 0 SECTION LOCAL DEFAULT 1 + 2: 00000000 0 SECTION LOCAL DEFAULT 3 + 3: 00000000 0 SECTION LOCAL DEFAULT 4 + 4: 00000000 0 NOTYPE LOCAL DEFAULT 1 static_text_symbol + 5: 00000000 0 NOTYPE LOCAL DEFAULT 3 static_data_symbol + 6: 00000000 0 SECTION LOCAL DEFAULT 5 + 7: 00000000 0 SECTION LOCAL DEFAULT 6 + 8: 00000000 0 OBJECT GLOBAL DEFAULT 1 text_symbol + 9: 00000000 0 NOTYPE GLOBAL DEFAULT UND external_symbol + 10: 00000000 0 OBJECT GLOBAL DEFAULT 3 data_symbol + 11: 00000004 4 OBJECT GLOBAL DEFAULT (PRC|COM) common_symbol diff --git a/binutils/testsuite/binutils-all/size.exp b/binutils/testsuite/binutils-all/size.exp new file mode 100644 index 0000000000000..b91ba23c28d74 --- /dev/null +++ b/binutils/testsuite/binutils-all/size.exp @@ -0,0 +1,78 @@ +# Copyright 1993, 1994, 1995, 1997, 1998 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye +# and rewritten by Ian Lance Taylor + +if ![is_remote host] { + if {[which $SIZE] == 0} then { + perror "$SIZE does not exist" + return + } +} + +send_user "Version [binutil_version $SIZE]" + + +if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then { + return +} + +if [is_remote host] { + set testfile [remote_download host tmpdir/bintest.o] +} else { + set testfile tmpdir/bintest.o +} + +set dec "\[0-9\]+" +set hex "\[0-9a-fA-F\]+" + +# Test size with no arguments + +set got [binutils_run $SIZE "$SIZEFLAGS $testfile"] + +set want "($dec)\[ \]+($dec)\[ \]+($dec)\[ \]+($dec)\[ \]+($hex)\[ \]+${testfile}" + +if ![regexp $want $got all text data bss dtot hextot] then { + fail "size (no arguments)" +} else { + if {$text < 8 || $data < 4} then { + fail "size (no arguments)" + } else { + pass "size (no arguments)" + } +} + +# Test size -A + +set got [binutils_run $SIZE "$SIZEFLAGS -A ${testfile}"] + +set want "${testfile}.*(text|TEXT)\[^\n\r\]*\[ \]($dec)\[ \]+$dec.*(\\.data|DATA)\[^\n\r\]*\[ \]($dec)\[ \]+$dec" + +if ![regexp $want $got all textname textsize dataname datasize] then { + fail "size -A" +} else { + verbose "text size: $textsize" + verbose "data size: $datasize" + if {$textsize < 8 || $datasize < 4} then { + fail "size -A" + } else { + pass "size -A" + } +} diff --git a/binutils/testsuite/binutils-all/testprog.c b/binutils/testsuite/binutils-all/testprog.c new file mode 100644 index 0000000000000..2a347c887e82f --- /dev/null +++ b/binutils/testsuite/binutils-all/testprog.c @@ -0,0 +1,30 @@ +/* This program is used to test objcopy, readelf and strip. */ + +extern int strcmp (char *, const char *); + +int common; +int global = 1; +static int local = 2; +static unsigned char string[] = "string"; + +int +fn () +{ + return 3; +} + +int +main () +{ + if (common != 0 + || global != 1 + || local != 2 + || strcmp (string, "string") != 0) + { + printf ("failed\n"); + return (1); + } + + printf ("ok\n"); + return (0); +} diff --git a/binutils/testsuite/binutils-all/windres/README b/binutils/testsuite/binutils-all/windres/README new file mode 100644 index 0000000000000..f99034949956d --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/README @@ -0,0 +1,26 @@ +Instructions for adding tests: + +The files *.rc are hand-edited or copied from elsewhere. + +The script msupdate is used to generate the *.rsd files, which are +dumps of the RES formatted output of MSVC's RC utility. + +Within the *.rc file, the first N lines beginning with a special +comment can control the test. Comments are // /* or # (// is +recommended, as both rc and windres support those). Each line +contains one command: + + // parse-only + // xfail *-*-* + +parse-only must preceed any xfail commands, and indicates that a +comparison with the *.rsd file will not happen. xfail indicates when +a failure is expected. This should only be used for when you are +adding a new test that is known to fail because of a bug in windres, +and it should be removed when the bug is fixed. + +You can use pfail or cfail instead of xfail to indicate that only the +parsing or comparing should be xfailed. + +The windres tests only run for ix86 targets, because the +MSVC-generated *.rsd files are generated for that. diff --git a/binutils/testsuite/binutils-all/windres/bmp1.bmp b/binutils/testsuite/binutils-all/windres/bmp1.bmp new file mode 100644 index 0000000000000..208a8aa28d7a4 Binary files /dev/null and b/binutils/testsuite/binutils-all/windres/bmp1.bmp differ diff --git a/binutils/testsuite/binutils-all/windres/bmpalign.rc b/binutils/testsuite/binutils-all/windres/bmpalign.rc new file mode 100644 index 0000000000000..7cb5583dc975c --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/bmpalign.rc @@ -0,0 +1,9 @@ +LANGUAGE 0, 0 + +A BITMAP MOVEABLE PURE DISCARDABLE "bmp1.bmp" + +AB BITMAP MOVEABLE PURE DISCARDABLE "bmp1.bmp" + +ABC BITMAP MOVEABLE PURE DISCARDABLE "bmp1.bmp" + +ABCD BITMAP MOVEABLE PURE DISCARDABLE "bmp1.bmp" diff --git a/binutils/testsuite/binutils-all/windres/bmpalign.rsd b/binutils/testsuite/binutils-all/windres/bmpalign.rsd new file mode 100644 index 0000000000000..3ee5396528fee --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/bmpalign.rsd @@ -0,0 +1,38 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 6c000000 20000000 ffff0200 41000000 l... .......A... + 0030 00000000 30100000 00000000 00000000 ....0........... + 0040 28000000 01000000 01000000 01000400 (............... + 0050 00000000 04000000 00000000 00000000 ................ + 0060 00000000 00000000 00000000 00008000 ................ + 0070 00800000 00808000 80000000 80008000 ................ + 0080 80800000 c0c0c000 80808000 0000ff00 ................ + 0090 00ff0000 00ffff00 ff000000 ff00ff00 ................ + 00a0 ffff0000 ffffff00 90000000 6c000000 ............l... + 00b0 24000000 ffff0200 41004200 00000000 $.......A.B..... + 00c0 00000000 30100000 00000000 00000000 ....0........... + 00d0 28000000 01000000 01000000 01000400 (............... + 00e0 00000000 04000000 00000000 00000000 ................ + 00f0 00000000 00000000 00000000 00008000 ................ + 0100 00800000 00808000 80000000 80008000 ................ + 0110 80800000 c0c0c000 80808000 0000ff00 ................ + 0120 00ff0000 00ffff00 ff000000 ff00ff00 ................ + 0130 ffff0000 ffffff00 90000000 6c000000 ............l... + 0140 24000000 ffff0200 41004200 43000000 $.......A.B.C... + 0150 00000000 30100000 00000000 00000000 ....0........... + 0160 28000000 01000000 01000000 01000400 (............... + 0170 00000000 04000000 00000000 00000000 ................ + 0180 00000000 00000000 00000000 00008000 ................ + 0190 00800000 00808000 80000000 80008000 ................ + 01a0 80800000 c0c0c000 80808000 0000ff00 ................ + 01b0 00ff0000 00ffff00 ff000000 ff00ff00 ................ + 01c0 ffff0000 ffffff00 90000000 6c000000 ............l... + 01d0 28000000 ffff0200 41004200 43004400 (.......A.B.C.D. + 01e0 00000000 00000000 30100000 00000000 ........0....... + 01f0 00000000 28000000 01000000 01000000 ....(........... + 0200 01000400 00000000 04000000 00000000 ................ + 0210 00000000 00000000 00000000 00000000 ................ + 0220 00008000 00800000 00808000 80000000 ................ + 0230 80008000 80800000 c0c0c000 80808000 ................ + 0240 0000ff00 00ff0000 00ffff00 ff000000 ................ + 0250 ff00ff00 ffff0000 ffffff00 90000000 ................ diff --git a/binutils/testsuite/binutils-all/windres/capstyle.rc b/binutils/testsuite/binutils-all/windres/capstyle.rc new file mode 100644 index 0000000000000..238d21eaa9a0f --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/capstyle.rc @@ -0,0 +1,5 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +CAPTION "" +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END diff --git a/binutils/testsuite/binutils-all/windres/capstyle.rsd b/binutils/testsuite/binutils-all/windres/capstyle.rsd new file mode 100644 index 0000000000000..fef81169b96a6 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/capstyle.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 0000c880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff --git a/binutils/testsuite/binutils-all/windres/checkbox.rc b/binutils/testsuite/binutils-all/windres/checkbox.rc new file mode 100644 index 0000000000000..a941d6a568098 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/checkbox.rc @@ -0,0 +1,5 @@ +501 DIALOGEX DISCARDABLE 0, 0, 168, 137 +BEGIN + CHECKBOX 108, 1002, 12, 76, 123, 41 + CHECKBOX "tick me", 1001, 12, 15, 123, 41 +END diff --git a/binutils/testsuite/binutils-all/windres/checkbox.rsd b/binutils/testsuite/binutils-all/windres/checkbox.rsd new file mode 100644 index 0000000000000..f3ea5a04edc6f --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/checkbox.rsd @@ -0,0 +1,12 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 72000000 20000000 ffff0500 fffff501 r... ........... + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 0100ffff 00000000 00000000 00008880 ................ + 0050 02000000 0000a800 89000000 00000000 ................ + 0060 00000000 00000000 02000150 0c004c00 ...........P..L. + 0070 7b002900 ea030000 ffff8000 ffff6c00 {.)...........l. + 0080 00000000 00000000 00000000 02000150 ...............P + 0090 0c000f00 7b002900 e9030000 ffff8000 ....{.)......... + 00a0 74006900 63006b00 20006d00 65000000 t.i.c.k. .m.e... + 00b0 00000000 .... diff --git a/binutils/testsuite/binutils-all/windres/combobox.rc b/binutils/testsuite/binutils-all/windres/combobox.rc new file mode 100644 index 0000000000000..f9f52d181854a --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/combobox.rc @@ -0,0 +1,8 @@ +#define CBS_SIMPLE 0x1 +#define WS_TABSTOP 0x10000 + +501 DIALOG DISCARDABLE 0, 0, 168, 137 +BEGIN + COMBOBOX 1001,10,10,50,54, CBS_SIMPLE | WS_TABSTOP +END + diff --git a/binutils/testsuite/binutils-all/windres/combobox.rsd b/binutils/testsuite/binutils-all/windres/combobox.rsd new file mode 100644 index 0000000000000..509c738268ec0 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/combobox.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 32000000 20000000 ffff0500 fffff501 2... ........... + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000a800 ................ + 0050 89000000 00000000 01000150 00000000 ...........P.... + 0060 0a000a00 32003600 e903ffff 85000000 ....2.6......... + 0070 00000000 .... diff --git a/binutils/testsuite/binutils-all/windres/deflang.rc b/binutils/testsuite/binutils-all/windres/deflang.rc new file mode 100644 index 0000000000000..1f3c20f5554a1 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/deflang.rc @@ -0,0 +1,4 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END diff --git a/binutils/testsuite/binutils-all/windres/deflang.rsd b/binutils/testsuite/binutils-all/windres/deflang.rsd new file mode 100644 index 0000000000000..270b62234aff9 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/deflang.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff --git a/binutils/testsuite/binutils-all/windres/dialog0.rc b/binutils/testsuite/binutils-all/windres/dialog0.rc new file mode 100644 index 0000000000000..fba7ed779fb1f --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dialog0.rc @@ -0,0 +1,4 @@ +101 DIALOG 0, 0, 186, 95 +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END diff --git a/binutils/testsuite/binutils-all/windres/dialog0.rsd b/binutils/testsuite/binutils-all/windres/dialog0.rsd new file mode 100644 index 0000000000000..270b62234aff9 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dialog0.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff --git a/binutils/testsuite/binutils-all/windres/dialog1.rc b/binutils/testsuite/binutils-all/windres/dialog1.rc new file mode 100644 index 0000000000000..71deb4a594704 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dialog1.rc @@ -0,0 +1,5 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + diff --git a/binutils/testsuite/binutils-all/windres/dialog1.rsd b/binutils/testsuite/binutils-all/windres/dialog1.rsd new file mode 100644 index 0000000000000..270b62234aff9 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dialog1.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff --git a/binutils/testsuite/binutils-all/windres/dialogid.rc b/binutils/testsuite/binutils-all/windres/dialogid.rc new file mode 100644 index 0000000000000..43bf1ec8e5e96 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dialogid.rc @@ -0,0 +1,9 @@ +// Test created based on bug report submitted to binutils mailing list +// See: http://sources.redhat.com/ml/binutils/2003-03/msg00312.html + +101 DIALOGEX 0, 0, 200, 200 + +BEGIN +CONTROL 108, -1, "classname", 77, 11, 11, 83, 162 +CONTROL "stringid", 102, "classname", 0x5000120e, 5, 5, 10, 10 +END diff --git a/binutils/testsuite/binutils-all/windres/dialogid.rsd b/binutils/testsuite/binutils-all/windres/dialogid.rsd new file mode 100644 index 0000000000000..1e6bb1885dc7a --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dialogid.rsd @@ -0,0 +1,18 @@ + +fred.res: file format binary + +Contents of section .data: + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 94000000 20000000 ffff0500 ffff6500 .... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 0100ffff 00000000 00000000 00008880 ................ + 0050 02000000 0000c800 c8000000 00000000 ................ + 0060 00000000 00000000 4d000050 0b000b00 ........M..P.... + 0070 5300a200 ffff0000 63006c00 61007300 S.......c.l.a.s. + 0080 73006e00 61006d00 65000000 ffff6c00 s.n.a.m.e.....l. + 0090 00000000 00000000 00000000 0e120050 ...............P + 00a0 05000500 0a000a00 66000000 63006c00 ........f...c.l. + 00b0 61007300 73006e00 61006d00 65000000 a.s.s.n.a.m.e... + 00c0 73007400 72006900 6e006700 69006400 s.t.r.i.n.g.i.d. + 00d0 00000000 .... diff --git a/binutils/testsuite/binutils-all/windres/dialogsignature.rc b/binutils/testsuite/binutils-all/windres/dialogsignature.rc new file mode 100644 index 0000000000000..a05ce19057793 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dialogsignature.rc @@ -0,0 +1,5 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +STYLE 1 +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END diff --git a/binutils/testsuite/binutils-all/windres/dialogsignature.rsd b/binutils/testsuite/binutils-all/windres/dialogsignature.rsd new file mode 100644 index 0000000000000..a01c14de8ba9d --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dialogsignature.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 01000000 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff --git a/binutils/testsuite/binutils-all/windres/dlgfont.rc b/binutils/testsuite/binutils-all/windres/dlgfont.rc new file mode 100644 index 0000000000000..9c763e593f32a --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dlgfont.rc @@ -0,0 +1,29 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma" +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + +102 DIALOGEX DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma" +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + +103 DIALOGEX DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma", 0 +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + +104 DIALOGEX DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma", 0, 0 +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + +105 DIALOGEX DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma", 0, 0, 1 +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END diff --git a/binutils/testsuite/binutils-all/windres/dlgfont.rsd b/binutils/testsuite/binutils-all/windres/dlgfont.rsd new file mode 100644 index 0000000000000..8a25cfa656183 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dlgfont.rsd @@ -0,0 +1,39 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 46000000 20000000 ffff0500 ffff6500 F... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 40008880 00000000 01000000 0000ba00 @............... + 0050 5f000000 00000000 08005400 61006800 _.........T.a.h. + 0060 6f006d00 61000000 01000150 00000000 o.m.a......P.... + 0070 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0080 4b000000 00000000 58000000 20000000 K.......X... ... + 0090 ffff0500 ffff6600 00000000 30100904 ......f.....0... + 00a0 00000000 00000000 0100ffff 00000000 ................ + 00b0 00000000 40008880 01000000 0000ba00 ....@........... + 00c0 5f000000 00000000 08000000 00015400 _.............T. + 00d0 61006800 6f006d00 61000000 00000000 a.h.o.m.a....... + 00e0 00000000 01000150 81000700 32000e00 .......P....2... + 00f0 01000000 ffff8000 4f004b00 00000000 ........O.K..... + 0100 58000000 20000000 ffff0500 ffff6700 X... .........g. + 0110 00000000 30100904 00000000 00000000 ....0........... + 0120 0100ffff 00000000 00000000 40008880 ............@... + 0130 01000000 0000ba00 5f000000 00000000 ........_....... + 0140 08000000 00015400 61006800 6f006d00 ......T.a.h.o.m. + 0150 61000000 00000000 00000000 01000150 a..............P + 0160 81000700 32000e00 01000000 ffff8000 ....2........... + 0170 4f004b00 00000000 58000000 20000000 O.K.....X... ... + 0180 ffff0500 ffff6800 00000000 30100904 ......h.....0... + 0190 00000000 00000000 0100ffff 00000000 ................ + 01a0 00000000 40008880 01000000 0000ba00 ....@........... + 01b0 5f000000 00000000 08000000 00015400 _.............T. + 01c0 61006800 6f006d00 61000000 00000000 a.h.o.m.a....... + 01d0 00000000 01000150 81000700 32000e00 .......P....2... + 01e0 01000000 ffff8000 4f004b00 00000000 ........O.K..... + 01f0 58000000 20000000 ffff0500 ffff6900 X... .........i. + 0200 00000000 30100904 00000000 00000000 ....0........... + 0210 0100ffff 00000000 00000000 40008880 ............@... + 0220 01000000 0000ba00 5f000000 00000000 ........_....... + 0230 08000000 00015400 61006800 6f006d00 ......T.a.h.o.m. + 0240 61000000 00000000 00000000 01000150 a..............P + 0250 81000700 32000e00 01000000 ffff8000 ....2........... + 0260 4f004b00 00000000 O.K..... diff --git a/binutils/testsuite/binutils-all/windres/edittext.rc b/binutils/testsuite/binutils-all/windres/edittext.rc new file mode 100644 index 0000000000000..0fd7000126a89 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/edittext.rc @@ -0,0 +1,4 @@ +501 DIALOG DISCARDABLE 0, 0, 168, 137 +BEGIN + EDITTEXT 1001, 28, 63, 137, 52 +END diff --git a/binutils/testsuite/binutils-all/windres/edittext.rsd b/binutils/testsuite/binutils-all/windres/edittext.rsd new file mode 100644 index 0000000000000..7132b20f4f95f --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/edittext.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 32000000 20000000 ffff0500 fffff501 2... ........... + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000a800 ................ + 0050 89000000 00000000 00008150 00000000 ...........P.... + 0060 1c003f00 89003400 e903ffff 81000000 ..?...4......... + 0070 00000000 .... diff --git a/binutils/testsuite/binutils-all/windres/escapea.rc b/binutils/testsuite/binutils-all/windres/escapea.rc new file mode 100644 index 0000000000000..0e3e9670cd714 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/escapea.rc @@ -0,0 +1,7 @@ +20 MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Open\a^O", 17 + END +END diff --git a/binutils/testsuite/binutils-all/windres/escapea.rsd b/binutils/testsuite/binutils-all/windres/escapea.rsd new file mode 100644 index 0000000000000..c8a7f4eb23fc2 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/escapea.rsd @@ -0,0 +1,7 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 28000000 20000000 ffff0400 ffff1400 (... ........... + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00000000 90002600 46006900 6c006500 ......&.F.i.l.e. + 0050 00008000 11002600 4f007000 65006e00 ......&.O.p.e.n. + 0060 08005e00 4f000000 ..^.O... diff --git a/binutils/testsuite/binutils-all/windres/escapex.rc b/binutils/testsuite/binutils-all/windres/escapex.rc new file mode 100644 index 0000000000000..1a025f656cffe --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/escapex.rc @@ -0,0 +1,4 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +BEGIN + LTEXT "\xB0",-1,23,46,28,8 +END diff --git a/binutils/testsuite/binutils-all/windres/escapex.rsd b/binutils/testsuite/binutils-all/windres/escapex.rsd new file mode 100644 index 0000000000000..280aead036d5c --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/escapex.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 34000000 20000000 ffff0500 ffff6500 4... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 00000250 00000000 _..........P.... + 0060 17002e00 1c000800 ffffffff 8200b000 ................ + 0070 00000000 .... diff --git a/binutils/testsuite/binutils-all/windres/lang.rc b/binutils/testsuite/binutils-all/windres/lang.rc new file mode 100644 index 0000000000000..d894315568e47 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/lang.rc @@ -0,0 +1,15 @@ +#include "windows.h" + +LANGUAGE 0, 0 + +1 MENU MOVEABLE PURE DISCARDABLE +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +BEGIN + POPUP "&Datei" { MENUITEM "foo", 1 } +END + +1 MENU MOVEABLE PURE DISCARDABLE +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +BEGIN + POPUP "&File" { MENUITEM "foo", 1 } +END diff --git a/binutils/testsuite/binutils-all/windres/lang.rsd b/binutils/testsuite/binutils-all/windres/lang.rsd new file mode 100644 index 0000000000000..9e0045f67d598 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/lang.rsd @@ -0,0 +1,10 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 20000000 20000000 ffff0400 ffff0100 ... ........... + 0030 00000000 30100704 00000000 00000000 ....0........... + 0040 00000000 90002600 44006100 74006500 ......&.D.a.t.e. + 0050 69000000 80000100 66006f00 6f000000 i.......f.o.o... + 0060 1e000000 20000000 ffff0400 ffff0100 .... ........... + 0070 00000000 30100904 00000000 00000000 ....0........... + 0080 00000000 90002600 46006900 6c006500 ......&.F.i.l.e. + 0090 00008000 01006600 6f006f00 00000000 ......f.o.o..... diff --git a/binutils/testsuite/binutils-all/windres/listbox.rc b/binutils/testsuite/binutils-all/windres/listbox.rc new file mode 100644 index 0000000000000..bb7c121e98f5c --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/listbox.rc @@ -0,0 +1,4 @@ +501 DIALOG DISCARDABLE 0, 0, 168, 137 +BEGIN + LISTBOX 1001, 28, 63, 137, 52 +END diff --git a/binutils/testsuite/binutils-all/windres/listbox.rsd b/binutils/testsuite/binutils-all/windres/listbox.rsd new file mode 100644 index 0000000000000..4c3eadfc55034 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/listbox.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 32000000 20000000 ffff0500 fffff501 2... ........... + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000a800 ................ + 0050 89000000 00000000 01008050 00000000 ...........P.... + 0060 1c003f00 89003400 e903ffff 83000000 ..?...4......... + 0070 00000000 .... diff --git a/binutils/testsuite/binutils-all/windres/msupdate b/binutils/testsuite/binutils-all/windres/msupdate new file mode 100755 index 0000000000000..649335c231637 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/msupdate @@ -0,0 +1,40 @@ +#!/bin/sh +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# Written by DJ Delorie + +# Run this on a machine with Cygwin and Microsoft Visual C to create +# the RES files we match against. + +RC="rc" +if test x"$1" != x"" +then + RC="$1" +fi + +for i in *.rc +do + o=`echo $i | sed s/.rc/.res/` + d=`echo $i | sed s/.rc/.rsd/` + echo "$i -> $o -> $d" + $RC /fo$o $i + objdump -b binary -s $o | sed -n '/^ [0-9a-f][0-9a-f]* /p' > $d + rm $o +done diff --git a/binutils/testsuite/binutils-all/windres/nocaption.rc b/binutils/testsuite/binutils-all/windres/nocaption.rc new file mode 100644 index 0000000000000..1f3c20f5554a1 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/nocaption.rc @@ -0,0 +1,4 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END diff --git a/binutils/testsuite/binutils-all/windres/nocaption.rsd b/binutils/testsuite/binutils-all/windres/nocaption.rsd new file mode 100644 index 0000000000000..270b62234aff9 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/nocaption.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff --git a/binutils/testsuite/binutils-all/windres/printstyle.rc b/binutils/testsuite/binutils-all/windres/printstyle.rc new file mode 100644 index 0000000000000..0066c995eea15 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/printstyle.rc @@ -0,0 +1,6 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +STYLE 0 +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END + diff --git a/binutils/testsuite/binutils-all/windres/printstyle.rsd b/binutils/testsuite/binutils-all/windres/printstyle.rsd new file mode 100644 index 0000000000000..6a4a919c90b4b --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/printstyle.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00000000 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff --git a/binutils/testsuite/binutils-all/windres/quoteclass.rc b/binutils/testsuite/binutils-all/windres/quoteclass.rc new file mode 100644 index 0000000000000..c1f98e19e07f8 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/quoteclass.rc @@ -0,0 +1,8 @@ +// parse-only + +101 DIALOG DISCARDABLE 0, 0, 186, 95 +CLASS "myclass" +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END + diff --git a/binutils/testsuite/binutils-all/windres/scrollbar.rc b/binutils/testsuite/binutils-all/windres/scrollbar.rc new file mode 100644 index 0000000000000..9391d1abb0951 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/scrollbar.rc @@ -0,0 +1,4 @@ +501 DIALOGEX 0, 0, 168, 137 +BEGIN + SCROLLBAR 1001,43,68,105,10,0,0,0x81f503e9 +END diff --git a/binutils/testsuite/binutils-all/windres/scrollbar.rsd b/binutils/testsuite/binutils-all/windres/scrollbar.rsd new file mode 100644 index 0000000000000..c509c4cd1050c --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/scrollbar.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 40000000 20000000 ffff0500 fffff501 @... ........... + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 0100ffff 00000000 00000000 00008880 ................ + 0050 01000000 0000a800 89000000 00000000 ................ + 0060 e903f581 00000000 00000050 2b004400 ...........P+.D. + 0070 69000a00 e9030000 ffff8400 00000000 i............... diff --git a/binutils/testsuite/binutils-all/windres/strtab1.rc b/binutils/testsuite/binutils-all/windres/strtab1.rc new file mode 100644 index 0000000000000..a1a246d8eb822 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/strtab1.rc @@ -0,0 +1,8 @@ +#include "windows.h" + +LANGUAGE 0, 0 + +STRINGTABLE MOVEABLE PURE DISCARDABLE +BEGIN + 1 "hello, world" +END diff --git a/binutils/testsuite/binutils-all/windres/strtab1.rsd b/binutils/testsuite/binutils-all/windres/strtab1.rsd new file mode 100644 index 0000000000000..4d610739352b2 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/strtab1.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 38000000 20000000 ffff0600 ffff0100 8... ........... + 0030 00000000 30100000 00000000 00000000 ....0........... + 0040 00000c00 68006500 6c006c00 6f002c00 ....h.e.l.l.o.,. + 0050 20007700 6f007200 6c006400 00000000 .w.o.r.l.d..... + 0060 00000000 00000000 00000000 00000000 ................ + 0070 00000000 00000000 ........ diff --git a/binutils/testsuite/binutils-all/windres/sublang.rc b/binutils/testsuite/binutils-all/windres/sublang.rc new file mode 100644 index 0000000000000..a37921b33d293 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/sublang.rc @@ -0,0 +1,5 @@ +LANGUAGE 9, 1 +101 DIALOG DISCARDABLE 0, 0, 186, 95 +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END diff --git a/binutils/testsuite/binutils-all/windres/sublang.rsd b/binutils/testsuite/binutils-all/windres/sublang.rsd new file mode 100644 index 0000000000000..270b62234aff9 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/sublang.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K....... diff --git a/binutils/testsuite/binutils-all/windres/windres.exp b/binutils/testsuite/binutils-all/windres/windres.exp new file mode 100644 index 0000000000000..bd761780ab22f --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/windres.exp @@ -0,0 +1,149 @@ +# Copyright 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 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. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# Written by DJ Delorie + +if {![istarget "i*86-*-*"]} { + return +} + +if {![istarget "i*86-*-*pe*"] \ + && ![istarget "i*86-*-cygwin*"] \ + && ![istarget "i*86-*-mingw32*"] } { + set target_xfail "yes" +} else { + set target_xfail "no" +} + +if {![info exists WINDRES]} then { + return +} + +if {[which $WINDRES] == 0} then { + return +} + +set wr "$WINDRES --include-dir $srcdir/$subdir" + +if [file exists "$srcdir/../../winsup/w32api/include"] { + set wr "$wr --include-dir $srcdir/../../winsup/w32api/include" + set target_xfail "no" +} else { + send_log "\nWarning: Assuming windres can find the win32 headers\n\n" +} + +set res_list [lsort [glob -nocomplain $srcdir/$subdir/*.rc]] + +proc oneline { file } { + while { 1 } { + if { [gets $file line] == -1 } { + return "" + } + if [regexp "^ \[0-9a-z\]\[0-9a-z\]* " $line] { + return $line + } + } +} + +foreach res $res_list { + set sroot [file rootname $res] + set broot [file tail $sroot] + set done 0 + + set rc [open $res] + while { [gets $rc line] != -1 } { + if ![regexp "^(//|/\*|#)" $line] { + break + } + if [regexp "\[xp\]fail *(\[^ \]*)" $line junk sys] { + setup_xfail $sys + continue; + } + } + + if { "$broot" != "bmpalign" && "$target_xfail" == "yes" } { + setup_xfail *-* + } + + verbose "$wr -J rc -O res $res tmpdir/$broot.res" 1 + catch "exec $wr -J rc -O res $res tmpdir/$broot.res" err + + if ![string match "" $err] then { + send_log "$err\n" + verbose "$err" 1 + fail "windres/$broot (parse)" + continue; + } + pass "windres/$broot (parse)" + + set rc [open $res] + while { [gets $rc line] != -1 } { + if ![regexp "^(//|/\*|#)" $line] { + break + } + if [regexp "parse-only" $line] { + file delete "tmpdir/$broot.res" + set done 1 + break; + } + if [regexp "\[xc\]fail *(\[^ \]*)" $line junk sys] { + setup_xfail $sys + continue; + } + } + if { $done != 0 } { + continue; + } + + if { "$broot" != "bmpalign" && "$target_xfail" == "yes" } { + setup_xfail *-* + } + + verbose "$OBJDUMP -b binary -s tmpdir/$broot.res > tmpdir/$broot.dump" 1 + catch "exec $OBJDUMP -b binary -s tmpdir/$broot.res > tmpdir/$broot.dump" err + + if ![string match "" $err] then { + send_log "$err\n" + verbose "$err" 1 + fail "windres/$broot (compare)" + continue; + } + + set pat [open "$sroot.rsd"] + set out [open "tmpdir/$broot.dump"] + set patline "foo" + + while { ![string match $patline ""] } { + set patline [oneline $pat] + set outline [oneline $out] + + if ![string match $patline $outline] { + send_log "< $patline\n"; + send_log "> $outline\n"; + fail "windres/$broot (compare)"; + set done 1 + break; + } + } + if { $done == 0 } { + pass "windres/$broot (compare)" + file delete "tmpdir/$broot.res" + file delete "tmpdir/$broot.dump" + } +} diff --git a/binutils/testsuite/config/default.exp b/binutils/testsuite/config/default.exp new file mode 100644 index 0000000000000..4aa9ab330d69b --- /dev/null +++ b/binutils/testsuite/config/default.exp @@ -0,0 +1,103 @@ +# Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye. (rob@cygnus.com) + +load_lib util-defs.exp +load_lib utils-lib.exp + +if ![info exists NM] then { + set NM [findfile $base_dir/nm-new $base_dir/nm-new [transform nm]] +} +if ![info exists NMFLAGS] then { + set NMFLAGS "" +} +if ![info exists SIZE] then { + set SIZE [findfile $base_dir/size] +} +if ![info exists SIZEFLAGS] then { + set SIZEFLAGS "" +} +if ![info exists OBJDUMP] then { + set OBJDUMP [findfile $base_dir/objdump] +} +if ![info exists OBJDUMPFLAGS] then { + set OBJDUMPFLAGS "" +} +if ![info exists OBJCOPY] then { + set OBJCOPY [findfile $base_dir/objcopy] +} +if ![info exists OBJCOPYFLAGS] then { + set OBJCOPYFLAGS "" +} +if ![info exists AR] then { + set AR [findfile $base_dir/ar] +} +if ![info exists STRIP] then { + set STRIP [findfile $base_dir/strip-new $base_dir/strip-new [transform strip]] +} +if ![info exists STRIPFLAGS] then { + set STRIPFLAGS "" +} +if ![info exists READELF] then { + set READELF [findfile $base_dir/readelf] +} +if ![info exists READELFFLAGS] then { + set READELFFLAGS "" +} +if ![info exists WINDRES] then { + set WINDRES [findfile $base_dir/windres] +} +if ![info exists DLLTOOL] then { + set DLLTOOL [findfile $base_dir/dlltool] +} + +if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status} + +# Make a symlink from tmpdir/gas/as and tmpdir/gas/ld to the assembler +# and linker in the build tree, so that we can use a -B option to gcc +# to force it to use the newly built assembler/linker. +if {![file isdirectory tmpdir/gas]} then { + catch "exec mkdir tmpdir/gas" status + if {[file isfile ../gas/as-new]} then { + catch "exec ln -s ../../../gas/as-new tmpdir/gas/as" status + } + if {[file isfile ../ld/ld-new]} then { + catch "exec ln -s ../../../ld/ld-new tmpdir/gas/ld" status + } +} +set gcc_gas_flag "-B[pwd]/tmpdir/gas/" + +# +# binutils_run +# run a program, returning the output +# sets binutils_run_failed if the program does not exist +# +proc binutils_run { prog progargs } { + default_binutils_run $prog $progargs +} + +# +# binutils_assemble +# assemble a file +# +proc binutils_assemble { source object } { + default_binutils_assemble $source $object +} diff --git a/binutils/testsuite/config/hppa.sed b/binutils/testsuite/config/hppa.sed new file mode 100644 index 0000000000000..d8607d85d0c6a --- /dev/null +++ b/binutils/testsuite/config/hppa.sed @@ -0,0 +1,4 @@ +s/# Old OSF sed blows up if you have a sed command starting with "#"// +s/# Avoid it by putting the comments within real sed commands.// +s/# Fix the definition of common_symbol to be correct for the PA assebmlers.// +s/ \.comm common_symbol,4/common_symbol .comm 4/ diff --git a/binutils/testsuite/lib/utils-lib.exp b/binutils/testsuite/lib/utils-lib.exp new file mode 100644 index 0000000000000..11860f7c476cd --- /dev/null +++ b/binutils/testsuite/lib/utils-lib.exp @@ -0,0 +1,151 @@ +# Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye +# and extended by Ian Lance Taylor + +proc binutil_version { prog } { + if ![is_remote host] { + set path [which $prog]; + if {$path == 0} then { + perror "$prog can't be run, file not found." + return "" + } + } else { + set path $prog + } + set state [remote_exec host $prog --version]; + set tmp "[lindex $state 1]\n"; + # Should find a way to discard constant parts, keep whatever's + # left, so the version string could be almost anything at all... + regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" "$tmp" version cyg number + if ![info exists number] then { + return "$path (no version number)\n" + } + return "$path $number\n" +} + +# +# default_binutils_run +# run a program, returning the output +# sets binutils_run_failed if the program does not exist +# +proc default_binutils_run { prog progargs } { + global binutils_run_failed + global host_triplet + + set binutils_run_failed 0 + + if ![is_remote host] { + if {[which $prog] == 0} then { + perror "$prog does not exist" + set binutils_run_failed 1 + return "" + } + } + + send_log "$prog $progargs\n" + verbose "$prog $progargs" + + # Gotta quote dollar-signs because they get mangled by the + # shell otherwise. + regsub -all "\\$" "$progargs" "\\$" progargs + + set state [remote_exec host $prog $progargs] + set exec_output [prune_warnings [lindex $state 1]]; + if {![string match "" $exec_output]} then { + send_log "$exec_output\n" + verbose "$exec_output" + } + return $exec_output +} + +# +# default_binutils_assemble +# assemble a file +# +proc default_binutils_assemble { source object } { + global srcdir + global host_triplet + + # The HPPA assembler syntax is a little different than most, to make + # the test source file assemble we need to run it through sed. + # + # This is a hack in that it won't scale well if other targets need + # similar transformations to assemble. We'll generalize the hack + # if/when other targets need similar handling. + if { [istarget "hppa*-*-*"] && ![istarget "*-*-linux*" ] } then { + set sed_file $srcdir/config/hppa.sed + send_log "sed -f $sed_file < $source > asm.s\n" + verbose "sed -f $sed_file < $source > asm.s" + catch "exec sed -f $sed_file < $source > asm.s"; + set source asm.s + } + + set exec_output [target_assemble $source $object ""]; + set exec_output [prune_warnings $exec_output] + + if [string match "" $exec_output] { + return 1 + } else { + send_log "$exec_output\n" + verbose "$exec_output" + perror "$source: assembly failed" + return 0 + } +} + +# +# is_elf_format +# true if the object format is known to be ELF +# +proc is_elf_format {} { + if { ![istarget *-*-sysv4*] \ + && ![istarget *-*-unixware*] \ + && ![istarget *-*-elf*] \ + && ![istarget *-*-eabi*] \ + && ![istarget hppa*64*-*-hpux*] \ + && ![istarget ia64-*-hpux*] \ + && ![istarget *-*-linux*] \ + && ![istarget *-*-irix5*] \ + && ![istarget *-*-irix6*] \ + && ![istarget *-*-netbsd*] \ + && ![istarget *-*-solaris2*] } { + return 0 + } + + if { [istarget *-*-linux*aout*] \ + || [istarget *-*-linux*oldld*] } { + return 0 + } + + if { ![istarget *-*-netbsdelf*] \ + && ([istarget *-*-netbsd*aout*] \ + || [istarget *-*-netbsdpe*] \ + || [istarget arm*-*-netbsd*] \ + || [istarget sparc-*-netbsd*] \ + || [istarget i*86-*-netbsd*] \ + || [istarget m68*-*-netbsd*] \ + || [istarget vax-*-netbsd*] \ + || [istarget ns32k-*-netbsd*]) } { + return 0 + } + return 1 +} diff --git a/binutils/windres.c b/binutils/windres.c new file mode 100644 index 0000000000000..1d23f10975e37 --- /dev/null +++ b/binutils/windres.c @@ -0,0 +1,1003 @@ +/* windres.c -- a program to manipulate Windows resources + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + + This file is part of GNU Binutils. + + This program is free software; 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. */ + +/* This program can read and write Windows resources in various + formats. In particular, it can act like the rc resource compiler + program, and it can act like the cvtres res to COFF conversion + program. + + It is based on information taken from the following sources: + + * Microsoft documentation. + + * The rcl program, written by Gunther Ebert + . + + * The res2coff program, written by Pedro A. Aranda . */ + +#include "bfd.h" +#include "getopt.h" +#include "bucomm.h" +#include "libiberty.h" +#include "safe-ctype.h" +#include "obstack.h" +#include "windres.h" +#include +#include + +/* Used by resrc.c at least. */ + +int verbose = 0; + +/* An enumeration of format types. */ + +enum res_format +{ + /* Unknown format. */ + RES_FORMAT_UNKNOWN, + /* Textual RC file. */ + RES_FORMAT_RC, + /* Binary RES file. */ + RES_FORMAT_RES, + /* COFF file. */ + RES_FORMAT_COFF +}; + +/* A structure used to map between format types and strings. */ + +struct format_map +{ + const char *name; + enum res_format format; +}; + +/* A mapping between names and format types. */ + +static const struct format_map format_names[] = +{ + { "rc", RES_FORMAT_RC }, + { "res", RES_FORMAT_RES }, + { "coff", RES_FORMAT_COFF }, + { NULL, RES_FORMAT_UNKNOWN } +}; + +/* A mapping from file extensions to format types. */ + +static const struct format_map format_fileexts[] = +{ + { "rc", RES_FORMAT_RC }, + { "res", RES_FORMAT_RES }, + { "exe", RES_FORMAT_COFF }, + { "obj", RES_FORMAT_COFF }, + { "o", RES_FORMAT_COFF }, + { NULL, RES_FORMAT_UNKNOWN } +}; + +/* A list of include directories. */ + +struct include_dir +{ + struct include_dir *next; + char *dir; +}; + +static struct include_dir *include_dirs; + +/* Static functions. */ + +static void res_init (void); +static int extended_menuitems (const struct menuitem *); +static enum res_format format_from_name (const char *, int); +static enum res_format format_from_filename (const char *, int); +static void usage (FILE *, int); +static int cmp_res_entry (const void *, const void *); +static struct res_directory *sort_resources (struct res_directory *); +static void reswr_init (void); +static const char * quot (const char *); + +/* When we are building a resource tree, we allocate everything onto + an obstack, so that we can free it all at once if we want. */ + +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free + +/* The resource building obstack. */ + +static struct obstack res_obstack; + +/* Initialize the resource building obstack. */ + +static void +res_init (void) +{ + obstack_init (&res_obstack); +} + +/* Allocate space on the resource building obstack. */ + +void * +res_alloc (size_t bytes) +{ + return (void *) obstack_alloc (&res_obstack, bytes); +} + +/* We also use an obstack to save memory used while writing out a set + of resources. */ + +static struct obstack reswr_obstack; + +/* Initialize the resource writing obstack. */ + +static void +reswr_init (void) +{ + obstack_init (&reswr_obstack); +} + +/* Allocate space on the resource writing obstack. */ + +void * +reswr_alloc (size_t bytes) +{ + return (void *) obstack_alloc (&reswr_obstack, bytes); +} + +/* Open a file using the include directory search list. */ + +FILE * +open_file_search (const char *filename, const char *mode, const char *errmsg, + char **real_filename) +{ + FILE *e; + struct include_dir *d; + + e = fopen (filename, mode); + if (e != NULL) + { + *real_filename = xstrdup (filename); + return e; + } + + if (errno == ENOENT) + { + for (d = include_dirs; d != NULL; d = d->next) + { + char *n; + + n = (char *) xmalloc (strlen (d->dir) + strlen (filename) + 2); + sprintf (n, "%s/%s", d->dir, filename); + e = fopen (n, mode); + if (e != NULL) + { + *real_filename = n; + return e; + } + + if (errno != ENOENT) + break; + } + } + + fatal (_("can't open %s `%s': %s"), errmsg, filename, strerror (errno)); + + /* Return a value to avoid a compiler warning. */ + return NULL; +} + +/* Compare two resource ID's. We consider name entries to come before + numeric entries, because that is how they appear in the COFF .rsrc + section. */ + +int +res_id_cmp (struct res_id a, struct res_id b) +{ + if (! a.named) + { + if (b.named) + return 1; + if (a.u.id > b.u.id) + return 1; + else if (a.u.id < b.u.id) + return -1; + else + return 0; + } + else + { + unichar *as, *ase, *bs, *bse; + + if (! b.named) + return -1; + + as = a.u.n.name; + ase = as + a.u.n.length; + bs = b.u.n.name; + bse = bs + b.u.n.length; + + while (as < ase) + { + int i; + + if (bs >= bse) + return 1; + i = (int) *as - (int) *bs; + if (i != 0) + return i; + ++as; + ++bs; + } + + if (bs < bse) + return -1; + + return 0; + } +} + +/* Print a resource ID. */ + +void +res_id_print (FILE *stream, struct res_id id, int quote) +{ + if (! id.named) + fprintf (stream, "%lu", id.u.id); + else + { + if (quote) + putc ('"', stream); + unicode_print (stream, id.u.n.name, id.u.n.length); + if (quote) + putc ('"', stream); + } +} + +/* Print a list of resource ID's. */ + +void +res_ids_print (FILE *stream, int cids, const struct res_id *ids) +{ + int i; + + for (i = 0; i < cids; i++) + { + res_id_print (stream, ids[i], 1); + if (i + 1 < cids) + fprintf (stream, ": "); + } +} + +/* Convert an ASCII string to a resource ID. */ + +void +res_string_to_id (struct res_id *res_id, const char *string) +{ + res_id->named = 1; + unicode_from_ascii (&res_id->u.n.length, &res_id->u.n.name, string); +} + +/* Define a resource. The arguments are the resource tree, RESOURCES, + and the location at which to put it in the tree, CIDS and IDS. + This returns a newly allocated res_resource structure, which the + caller is expected to initialize. If DUPOK is non-zero, then if a + resource with this ID exists, it is returned. Otherwise, a warning + is issued, and a new resource is created replacing the existing + one. */ + +struct res_resource * +define_resource (struct res_directory **resources, int cids, + const struct res_id *ids, int dupok) +{ + struct res_entry *re = NULL; + int i; + + assert (cids > 0); + for (i = 0; i < cids; i++) + { + struct res_entry **pp; + + if (*resources == NULL) + { + static unsigned long timeval; + + /* Use the same timestamp for every resource created in a + single run. */ + if (timeval == 0) + timeval = time (NULL); + + *resources = ((struct res_directory *) + res_alloc (sizeof **resources)); + (*resources)->characteristics = 0; + (*resources)->time = timeval; + (*resources)->major = 0; + (*resources)->minor = 0; + (*resources)->entries = NULL; + } + + for (pp = &(*resources)->entries; *pp != NULL; pp = &(*pp)->next) + if (res_id_cmp ((*pp)->id, ids[i]) == 0) + break; + + if (*pp != NULL) + re = *pp; + else + { + re = (struct res_entry *) res_alloc (sizeof *re); + re->next = NULL; + re->id = ids[i]; + if ((i + 1) < cids) + { + re->subdir = 1; + re->u.dir = NULL; + } + else + { + re->subdir = 0; + re->u.res = NULL; + } + + *pp = re; + } + + if ((i + 1) < cids) + { + if (! re->subdir) + { + fprintf (stderr, "%s: ", program_name); + res_ids_print (stderr, i, ids); + fprintf (stderr, _(": expected to be a directory\n")); + xexit (1); + } + + resources = &re->u.dir; + } + } + + if (re->subdir) + { + fprintf (stderr, "%s: ", program_name); + res_ids_print (stderr, cids, ids); + fprintf (stderr, _(": expected to be a leaf\n")); + xexit (1); + } + + if (re->u.res != NULL) + { + if (dupok) + return re->u.res; + + fprintf (stderr, _("%s: warning: "), program_name); + res_ids_print (stderr, cids, ids); + fprintf (stderr, _(": duplicate value\n")); + } + + re->u.res = ((struct res_resource *) + res_alloc (sizeof (struct res_resource))); + memset (re->u.res, 0, sizeof (struct res_resource)); + + re->u.res->type = RES_TYPE_UNINITIALIZED; + return re->u.res; +} + +/* Define a standard resource. This is a version of define_resource + that just takes type, name, and language arguments. */ + +struct res_resource * +define_standard_resource (struct res_directory **resources, int type, + struct res_id name, int language, int dupok) +{ + struct res_id a[3]; + + a[0].named = 0; + a[0].u.id = type; + a[1] = name; + a[2].named = 0; + a[2].u.id = language; + return define_resource (resources, 3, a, dupok); +} + +/* Comparison routine for resource sorting. */ + +static int +cmp_res_entry (const void *p1, const void *p2) +{ + const struct res_entry **re1, **re2; + + re1 = (const struct res_entry **) p1; + re2 = (const struct res_entry **) p2; + return res_id_cmp ((*re1)->id, (*re2)->id); +} + +/* Sort the resources. */ + +static struct res_directory * +sort_resources (struct res_directory *resdir) +{ + int c, i; + struct res_entry *re; + struct res_entry **a; + + if (resdir->entries == NULL) + return resdir; + + c = 0; + for (re = resdir->entries; re != NULL; re = re->next) + ++c; + + /* This is a recursive routine, so using xmalloc is probably better + than alloca. */ + a = (struct res_entry **) xmalloc (c * sizeof (struct res_entry *)); + + for (i = 0, re = resdir->entries; re != NULL; re = re->next, i++) + a[i] = re; + + qsort (a, c, sizeof (struct res_entry *), cmp_res_entry); + + resdir->entries = a[0]; + for (i = 0; i < c - 1; i++) + a[i]->next = a[i + 1]; + a[i]->next = NULL; + + free (a); + + /* Now sort the subdirectories. */ + + for (re = resdir->entries; re != NULL; re = re->next) + if (re->subdir) + re->u.dir = sort_resources (re->u.dir); + + return resdir; +} + +/* Return whether the dialog resource DIALOG is a DIALOG or a + DIALOGEX. */ + +int +extended_dialog (const struct dialog *dialog) +{ + const struct dialog_control *c; + + if (dialog->ex != NULL) + return 1; + + for (c = dialog->controls; c != NULL; c = c->next) + if (c->data != NULL || c->help != 0) + return 1; + + return 0; +} + +/* Return whether MENUITEMS are a MENU or a MENUEX. */ + +int +extended_menu (const struct menu *menu) +{ + return extended_menuitems (menu->items); +} + +static int +extended_menuitems (const struct menuitem *menuitems) +{ + const struct menuitem *mi; + + for (mi = menuitems; mi != NULL; mi = mi->next) + { + if (mi->help != 0 || mi->state != 0) + return 1; + if (mi->popup != NULL && mi->id != 0) + return 1; + if ((mi->type + & ~ (MENUITEM_CHECKED + | MENUITEM_GRAYED + | MENUITEM_HELP + | MENUITEM_INACTIVE + | MENUITEM_MENUBARBREAK + | MENUITEM_MENUBREAK)) + != 0) + return 1; + if (mi->popup != NULL) + { + if (extended_menuitems (mi->popup)) + return 1; + } + } + + return 0; +} + +/* Convert a string to a format type, or exit if it can't be done. */ + +static enum res_format +format_from_name (const char *name, int exit_on_error) +{ + const struct format_map *m; + + for (m = format_names; m->name != NULL; m++) + if (strcasecmp (m->name, name) == 0) + break; + + if (m->name == NULL && exit_on_error) + { + non_fatal (_("unknown format type `%s'"), name); + fprintf (stderr, _("%s: supported formats:"), program_name); + for (m = format_names; m->name != NULL; m++) + fprintf (stderr, " %s", m->name); + fprintf (stderr, "\n"); + xexit (1); + } + + return m->format; +} + +/* Work out a format type given a file name. If INPUT is non-zero, + it's OK to look at the file itself. */ + +static enum res_format +format_from_filename (const char *filename, int input) +{ + const char *ext; + FILE *e; + unsigned char b1, b2, b3, b4, b5; + int magic; + + /* If we have an extension, see if we recognize it as implying a + particular format. */ + ext = strrchr (filename, '.'); + if (ext != NULL) + { + const struct format_map *m; + + ++ext; + for (m = format_fileexts; m->name != NULL; m++) + if (strcasecmp (m->name, ext) == 0) + return m->format; + } + + /* If we don't recognize the name of an output file, assume it's a + COFF file. */ + if (! input) + return RES_FORMAT_COFF; + + /* Read the first few bytes of the file to see if we can guess what + it is. */ + e = fopen (filename, FOPEN_RB); + if (e == NULL) + fatal ("%s: %s", filename, strerror (errno)); + + b1 = getc (e); + b2 = getc (e); + b3 = getc (e); + b4 = getc (e); + b5 = getc (e); + + fclose (e); + + /* A PE executable starts with 0x4d 0x5a. */ + if (b1 == 0x4d && b2 == 0x5a) + return RES_FORMAT_COFF; + + /* A COFF .o file starts with a COFF magic number. */ + magic = (b2 << 8) | b1; + switch (magic) + { + case 0x14c: /* i386 */ + case 0x166: /* MIPS */ + case 0x184: /* Alpha */ + case 0x268: /* 68k */ + case 0x1f0: /* PowerPC */ + case 0x290: /* PA */ + return RES_FORMAT_COFF; + } + + /* A RES file starts with 0x0 0x0 0x0 0x0 0x20 0x0 0x0 0x0. */ + if (b1 == 0 && b2 == 0 && b3 == 0 && b4 == 0 && b5 == 0x20) + return RES_FORMAT_RES; + + /* If every character is printable or space, assume it's an RC file. */ + if ((ISPRINT (b1) || ISSPACE (b1)) + && (ISPRINT (b2) || ISSPACE (b2)) + && (ISPRINT (b3) || ISSPACE (b3)) + && (ISPRINT (b4) || ISSPACE (b4)) + && (ISPRINT (b5) || ISSPACE (b5))) + return RES_FORMAT_RC; + + /* Otherwise, we give up. */ + fatal (_("can not determine type of file `%s'; use the -I option"), + filename); + + /* Return something to silence the compiler warning. */ + return RES_FORMAT_UNKNOWN; +} + +/* Print a usage message and exit. */ + +static void +usage (FILE *stream, int status) +{ + fprintf (stream, _("Usage: %s [option(s)] [input-file] [output-file]\n"), + program_name); + fprintf (stream, _(" The options are:\n\ + -i --input= Name input file\n\ + -o --output= Name output file\n\ + -J --input-format= Specify input format\n\ + -O --output-format= Specify output format\n\ + -F --target= Specify COFF target\n\ + --preprocessor= Program to use to preprocess rc file\n\ + -I --include-dir= Include directory when preprocessing rc file\n\ + -D --define [=] Define SYM when preprocessing rc file\n\ + -U --undefine Undefine SYM when preprocessing rc file\n\ + -v --verbose Verbose - tells you what it's doing\n\ + -l --language= Set language when reading rc file\n\ + --use-temp-file Use a temporary file instead of popen to read\n\ + the preprocessor output\n\ + --no-use-temp-file Use popen (default)\n")); +#ifdef YYDEBUG + fprintf (stream, _("\ + --yydebug Turn on parser debugging\n")); +#endif + fprintf (stream, _("\ + -r Ignored for compatibility with rc\n\ + -h --help Print this help message\n\ + -V --version Print version information\n")); + fprintf (stream, _("\ +FORMAT is one of rc, res, or coff, and is deduced from the file name\n\ +extension if not specified. A single file name is an input file.\n\ +No input-file is stdin, default rc. No output-file is stdout, default rc.\n")); + + list_supported_targets (program_name, stream); + + if (status == 0) + fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO); + + exit (status); +} + +/* Quote characters that will confuse the shell when we run the preprocessor. */ + +static const char * +quot (const char *string) +{ + static char *buf = 0; + static int buflen = 0; + int slen = strlen (string); + const char *src; + char *dest; + + if ((buflen < slen * 2 + 2) || !buf) + { + buflen = slen * 2 + 2; + if (buf) + free (buf); + buf = (char *) xmalloc (buflen); + } + + for (src=string, dest=buf; *src; src++, dest++) + { + if (*src == '(' || *src == ')' || *src == ' ') + *dest++ = '\\'; + *dest = *src; + } + *dest = 0; + return buf; +} + +/* Long options. */ + +/* 150 isn't special; it's just an arbitrary non-ASCII char value. */ + +#define OPTION_PREPROCESSOR 150 +#define OPTION_USE_TEMP_FILE (OPTION_PREPROCESSOR + 1) +#define OPTION_NO_USE_TEMP_FILE (OPTION_USE_TEMP_FILE + 1) +#define OPTION_YYDEBUG (OPTION_NO_USE_TEMP_FILE + 1) + +static const struct option long_options[] = +{ + {"input", required_argument, 0, 'i'}, + {"output", required_argument, 0, 'o'}, + {"input-format", required_argument, 0, 'J'}, + {"output-format", required_argument, 0, 'O'}, + {"target", required_argument, 0, 'F'}, + {"preprocessor", required_argument, 0, OPTION_PREPROCESSOR}, + {"include-dir", required_argument, 0, 'I'}, + {"define", required_argument, 0, 'D'}, + {"undefine", required_argument, 0, 'U'}, + {"verbose", no_argument, 0, 'v'}, + {"language", required_argument, 0, 'l'}, + {"use-temp-file", no_argument, 0, OPTION_USE_TEMP_FILE}, + {"no-use-temp-file", no_argument, 0, OPTION_NO_USE_TEMP_FILE}, + {"yydebug", no_argument, 0, OPTION_YYDEBUG}, + {"version", no_argument, 0, 'V'}, + {"help", no_argument, 0, 'h'}, + {0, no_argument, 0, 0} +}; + +/* This keeps gcc happy when using -Wmissing-prototypes -Wstrict-prototypes. */ +int main (int, char **); + +/* The main function. */ + +int +main (int argc, char **argv) +{ + int c; + char *input_filename; + char *output_filename; + enum res_format input_format; + enum res_format input_format_tmp; + enum res_format output_format; + char *target; + char *preprocessor; + char *preprocargs; + const char *quotedarg; + int language; + struct res_directory *resources; + int use_temp_file; + +#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) + setlocale (LC_MESSAGES, ""); +#endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + + program_name = argv[0]; + xmalloc_set_program_name (program_name); + + bfd_init (); + set_default_bfd_target (); + + res_init (); + + input_filename = NULL; + output_filename = NULL; + input_format = RES_FORMAT_UNKNOWN; + output_format = RES_FORMAT_UNKNOWN; + target = NULL; + preprocessor = NULL; + preprocargs = NULL; + language = 0x409; /* LANG_ENGLISH, SUBLANG_ENGLISH_US. */ + use_temp_file = 0; + + while ((c = getopt_long (argc, argv, "f:i:l:o:I:J:O:F:D:U:rhHvV", long_options, + (int *) 0)) != EOF) + { + switch (c) + { + case 'i': + input_filename = optarg; + break; + + case 'f': + /* For compatibility with rc we accept "-fo " as being the + equivalent of "-o ". We do not advertise this fact + though, as we do not want users to use non-GNU like command + line switches. */ + if (*optarg != 'o') + fatal (_("invalid option -f\n")); + optarg++; + if (* optarg == 0) + { + if (optind == argc) + fatal (_("No filename following the -fo option.\n")); + optarg = argv [optind++]; + } + /* Fall through. */ + + case 'o': + output_filename = optarg; + break; + + case 'J': + input_format = format_from_name (optarg, 1); + break; + + case 'O': + output_format = format_from_name (optarg, 1); + break; + + case 'F': + target = optarg; + break; + + case OPTION_PREPROCESSOR: + preprocessor = optarg; + break; + + case 'D': + case 'U': + if (preprocargs == NULL) + { + quotedarg = quot (optarg); + preprocargs = xmalloc (strlen (quotedarg) + 3); + sprintf (preprocargs, "-%c%s", c, quotedarg); + } + else + { + char *n; + + quotedarg = quot (optarg); + n = xmalloc (strlen (preprocargs) + strlen (quotedarg) + 4); + sprintf (n, "%s -%c%s", preprocargs, c, quotedarg); + free (preprocargs); + preprocargs = n; + } + break; + + case 'r': + /* Ignored for compatibility with rc. */ + break; + + case 'v': + verbose ++; + break; + + case 'I': + /* For backward compatibility, should be removed in the future. */ + input_format_tmp = format_from_name (optarg, 0); + if (input_format_tmp != RES_FORMAT_UNKNOWN) + { + fprintf (stderr, _("Option -I is deprecated for setting the input format, please use -J instead.\n")); + input_format = input_format_tmp; + break; + } + + if (preprocargs == NULL) + { + quotedarg = quot (optarg); + preprocargs = xmalloc (strlen (quotedarg) + 3); + sprintf (preprocargs, "-I%s", quotedarg); + } + else + { + char *n; + + quotedarg = quot (optarg); + n = xmalloc (strlen (preprocargs) + strlen (quotedarg) + 4); + sprintf (n, "%s -I%s", preprocargs, quotedarg); + free (preprocargs); + preprocargs = n; + } + + { + struct include_dir *n, **pp; + + n = (struct include_dir *) xmalloc (sizeof *n); + n->next = NULL; + n->dir = optarg; + + for (pp = &include_dirs; *pp != NULL; pp = &(*pp)->next) + ; + *pp = n; + } + + break; + + case 'l': + language = strtol (optarg, (char **) NULL, 16); + break; + + case OPTION_USE_TEMP_FILE: + use_temp_file = 1; + break; + + case OPTION_NO_USE_TEMP_FILE: + use_temp_file = 0; + break; + +#ifdef YYDEBUG + case OPTION_YYDEBUG: + yydebug = 1; + break; +#endif + + case 'h': + case 'H': + usage (stdout, 0); + break; + + case 'V': + print_version ("windres"); + break; + + default: + usage (stderr, 1); + break; + } + } + + if (input_filename == NULL && optind < argc) + { + input_filename = argv[optind]; + ++optind; + } + + if (output_filename == NULL && optind < argc) + { + output_filename = argv[optind]; + ++optind; + } + + if (argc != optind) + usage (stderr, 1); + + if (input_format == RES_FORMAT_UNKNOWN) + { + if (input_filename == NULL) + input_format = RES_FORMAT_RC; + else + input_format = format_from_filename (input_filename, 1); + } + + if (output_format == RES_FORMAT_UNKNOWN) + { + if (output_filename == NULL) + output_format = RES_FORMAT_RC; + else + output_format = format_from_filename (output_filename, 0); + } + + /* Read the input file. */ + switch (input_format) + { + default: + abort (); + case RES_FORMAT_RC: + resources = read_rc_file (input_filename, preprocessor, preprocargs, + language, use_temp_file); + break; + case RES_FORMAT_RES: + resources = read_res_file (input_filename); + break; + case RES_FORMAT_COFF: + resources = read_coff_rsrc (input_filename, target); + break; + } + + if (resources == NULL) + fatal (_("no resources")); + + /* Sort the resources. This is required for COFF, convenient for + rc, and unimportant for res. */ + resources = sort_resources (resources); + + /* Write the output file. */ + reswr_init (); + + switch (output_format) + { + default: + abort (); + case RES_FORMAT_RC: + write_rc_file (output_filename, resources); + break; + case RES_FORMAT_RES: + write_res_file (output_filename, resources); + break; + case RES_FORMAT_COFF: + write_coff_file (output_filename, target, resources); + break; + } + + xexit (0); + return 0; +} diff --git a/binutils/windres.h b/binutils/windres.h new file mode 100644 index 0000000000000..bd1c636c226c5 --- /dev/null +++ b/binutils/windres.h @@ -0,0 +1,851 @@ +/* windres.h -- header file for windres program. + Copyright 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + + This file is part of GNU Binutils. + + This program is free software; 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. */ + +#include "ansidecl.h" + +/* This is the header file for the windres program. It defines + structures and declares functions used within the program. */ + +#include "winduni.h" + +/* We represent resources internally as a tree, similar to the tree + used in the .rsrc section of a COFF file. The root is a + res_directory structure. */ + +struct res_directory +{ + /* Resource flags. According to the MS docs, this is currently + always zero. */ + unsigned long characteristics; + /* Time/date stamp. */ + unsigned long time; + /* Major version number. */ + unsigned short major; + /* Minor version number. */ + unsigned short minor; + /* Directory entries. */ + struct res_entry *entries; +}; + +/* A resource ID is stored in a res_id structure. */ + +struct res_id +{ + /* Non-zero if this entry has a name rather than an ID. */ + unsigned int named : 1; + union + { + /* If the named field is non-zero, this is the name. */ + struct + { + /* Length of the name. */ + int length; + /* Pointer to the name, which is a Unicode string. */ + unichar *name; + } n; + /* If the named field is zero, this is the ID. */ + unsigned long id; + } u; +}; + +/* Each entry in the tree is a res_entry structure. We mix + directories and resources because in a COFF file all entries in a + directory are sorted together, whether the entries are + subdirectories or resources. */ + +struct res_entry +{ + /* Next entry. */ + struct res_entry *next; + /* Resource ID. */ + struct res_id id; + /* Non-zero if this entry is a subdirectory rather than a leaf. */ + unsigned int subdir : 1; + union + { + /* If the subdir field is non-zero, this is a pointer to the + subdirectory. */ + struct res_directory *dir; + /* If the subdir field is zero, this is a pointer to the resource + data. */ + struct res_resource *res; + } u; +}; + +/* Types of resources. */ + +enum res_type +{ + RES_TYPE_UNINITIALIZED, + RES_TYPE_ACCELERATOR, + RES_TYPE_BITMAP, + RES_TYPE_CURSOR, + RES_TYPE_GROUP_CURSOR, + RES_TYPE_DIALOG, + RES_TYPE_FONT, + RES_TYPE_FONTDIR, + RES_TYPE_ICON, + RES_TYPE_GROUP_ICON, + RES_TYPE_MENU, + RES_TYPE_MESSAGETABLE, + RES_TYPE_RCDATA, + RES_TYPE_STRINGTABLE, + RES_TYPE_USERDATA, + RES_TYPE_VERSIONINFO +}; + +/* A res file and a COFF file store information differently. The + res_info structures holds data which in a res file is stored with + each resource, but in a COFF file is stored elsewhere. */ + +struct res_res_info +{ + /* Language. In a COFF file, the third level of the directory is + keyed by the language, so the language of a resource is defined + by its location in the resource tree. */ + unsigned short language; + /* Characteristics of the resource. Entirely user defined. In a + COFF file, the res_directory structure has a characteristics + field, but I don't know if it's related to the one in the res + file. */ + unsigned long characteristics; + /* Version of the resource. Entirely user defined. In a COFF file, + the res_directory structure has a characteristics field, but I + don't know if it's related to the one in the res file. */ + unsigned long version; + /* Memory flags. This is a combination of the MEMFLAG values + defined below. Most of these values are historical, and are not + meaningful for win32. I don't think there is any way to store + this information in a COFF file. */ + unsigned short memflags; +}; + +/* Each resource in a COFF file has some information which can does + not appear in a res file. */ + +struct res_coff_info +{ + /* The code page used for the data. I don't really know what this + should be. */ + unsigned long codepage; + /* A resource entry in a COFF file has a reserved field, which we + record here when reading a COFF file. When writing a COFF file, + we set this field to zero. */ + unsigned long reserved; +}; + +/* Resource data is stored in a res_resource structure. */ + +struct res_resource +{ + /* The type of resource. */ + enum res_type type; + /* The data for the resource. */ + union + { + struct + { + unsigned long length; + const unsigned char *data; + } data; + struct accelerator *acc; + struct cursor *cursor; + struct group_cursor *group_cursor; + struct dialog *dialog; + struct fontdir *fontdir; + struct group_icon *group_icon; + struct menu *menu; + struct rcdata_item *rcdata; + struct stringtable *stringtable; + struct rcdata_item *userdata; + struct versioninfo *versioninfo; + } u; + /* Information from a res file. */ + struct res_res_info res_info; + /* Information from a COFF file. */ + struct res_coff_info coff_info; +}; + +#define SUBLANG_SHIFT 10 + +/* Memory flags in the memflags field of a struct res_resource. */ + +#define MEMFLAG_MOVEABLE 0x10 +#define MEMFLAG_PURE 0x20 +#define MEMFLAG_PRELOAD 0x40 +#define MEMFLAG_DISCARDABLE 0x1000 + +/* Standard resource type codes. These are used in the ID field of a + res_entry structure. */ + +#define RT_CURSOR 1 +#define RT_BITMAP 2 +#define RT_ICON 3 +#define RT_MENU 4 +#define RT_DIALOG 5 +#define RT_STRING 6 +#define RT_FONTDIR 7 +#define RT_FONT 8 +#define RT_ACCELERATOR 9 +#define RT_RCDATA 10 +#define RT_MESSAGETABLE 11 +#define RT_GROUP_CURSOR 12 +#define RT_GROUP_ICON 14 +#define RT_VERSION 16 +#define RT_DLGINCLUDE 17 +#define RT_PLUGPLAY 19 +#define RT_VXD 20 +#define RT_ANICURSOR 21 +#define RT_ANIICON 22 + +/* An accelerator resource is a linked list of these structures. */ + +struct accelerator +{ + /* Next accelerator. */ + struct accelerator *next; + /* Flags. A combination of the ACC values defined below. */ + unsigned short flags; + /* Key value. */ + unsigned short key; + /* Resource ID. */ + unsigned short id; +}; + +/* Accelerator flags in the flags field of a struct accelerator. + These are the same values that appear in a res file. I hope. */ + +#define ACC_VIRTKEY 0x01 +#define ACC_NOINVERT 0x02 +#define ACC_SHIFT 0x04 +#define ACC_CONTROL 0x08 +#define ACC_ALT 0x10 +#define ACC_LAST 0x80 + +/* A cursor resource. */ + +struct cursor +{ + /* X coordinate of hotspot. */ + short xhotspot; + /* Y coordinate of hotspot. */ + short yhotspot; + /* Length of bitmap data. */ + unsigned long length; + /* Data. */ + const unsigned char *data; +}; + +/* A group_cursor resource is a list of group_cursor structures. */ + +struct group_cursor +{ + /* Next cursor in group. */ + struct group_cursor *next; + /* Width. */ + unsigned short width; + /* Height. */ + unsigned short height; + /* Planes. */ + unsigned short planes; + /* Bits per pixel. */ + unsigned short bits; + /* Number of bytes in cursor resource. */ + unsigned long bytes; + /* Index of cursor resource. */ + unsigned short index; +}; + +/* A dialog resource. */ + +struct dialog +{ + /* Basic window style. */ + unsigned long style; + /* Extended window style. */ + unsigned long exstyle; + /* X coordinate. */ + unsigned short x; + /* Y coordinate. */ + unsigned short y; + /* Width. */ + unsigned short width; + /* Height. */ + unsigned short height; + /* Menu name. */ + struct res_id menu; + /* Class name. */ + struct res_id class; + /* Caption. */ + unichar *caption; + /* Font point size. */ + unsigned short pointsize; + /* Font name. */ + unichar *font; + /* Extended information for a dialogex. */ + struct dialog_ex *ex; + /* Controls. */ + struct dialog_control *controls; +}; + +/* An extended dialog has additional information. */ + +struct dialog_ex +{ + /* Help ID. */ + unsigned long help; + /* Font weight. */ + unsigned short weight; + /* Whether the font is italic. */ + unsigned char italic; + /* Character set. */ + unsigned char charset; +}; + +/* Window style flags, from the winsup Defines.h header file. These + can appear in the style field of a struct dialog or a struct + dialog_control. */ + +#define CW_USEDEFAULT (0x80000000) +#define WS_BORDER (0x800000L) +#define WS_CAPTION (0xc00000L) +#define WS_CHILD (0x40000000L) +#define WS_CHILDWINDOW (0x40000000L) +#define WS_CLIPCHILDREN (0x2000000L) +#define WS_CLIPSIBLINGS (0x4000000L) +#define WS_DISABLED (0x8000000L) +#define WS_DLGFRAME (0x400000L) +#define WS_GROUP (0x20000L) +#define WS_HSCROLL (0x100000L) +#define WS_ICONIC (0x20000000L) +#define WS_MAXIMIZE (0x1000000L) +#define WS_MAXIMIZEBOX (0x10000L) +#define WS_MINIMIZE (0x20000000L) +#define WS_MINIMIZEBOX (0x20000L) +#define WS_OVERLAPPED (0L) +#define WS_OVERLAPPEDWINDOW (0xcf0000L) +#define WS_POPUP (0x80000000L) +#define WS_POPUPWINDOW (0x80880000L) +#define WS_SIZEBOX (0x40000L) +#define WS_SYSMENU (0x80000L) +#define WS_TABSTOP (0x10000L) +#define WS_THICKFRAME (0x40000L) +#define WS_TILED (0L) +#define WS_TILEDWINDOW (0xcf0000L) +#define WS_VISIBLE (0x10000000L) +#define WS_VSCROLL (0x200000L) +#define MDIS_ALLCHILDSTYLES (0x1) +#define BS_3STATE (0x5L) +#define BS_AUTO3STATE (0x6L) +#define BS_AUTOCHECKBOX (0x3L) +#define BS_AUTORADIOBUTTON (0x9L) +#define BS_BITMAP (0x80L) +#define BS_BOTTOM (0x800L) +#define BS_CENTER (0x300L) +#define BS_CHECKBOX (0x2L) +#define BS_DEFPUSHBUTTON (0x1L) +#define BS_GROUPBOX (0x7L) +#define BS_ICON (0x40L) +#define BS_LEFT (0x100L) +#define BS_LEFTTEXT (0x20L) +#define BS_MULTILINE (0x2000L) +#define BS_NOTIFY (0x4000L) +#define BS_OWNERDRAW (0xbL) +#define BS_PUSHBOX (0xcL) /* FIXME! What should this be? */ +#define BS_PUSHBUTTON (0L) +#define BS_PUSHLIKE (0x1000L) +#define BS_RADIOBUTTON (0x4L) +#define BS_RIGHT (0x200L) +#define BS_RIGHTBUTTON (0x20L) +#define BS_TEXT (0L) +#define BS_TOP (0x400L) +#define BS_USERBUTTON (0x8L) +#define BS_VCENTER (0xc00L) +#define CBS_AUTOHSCROLL (0x40L) +#define CBS_DISABLENOSCROLL (0x800L) +#define CBS_DROPDOWN (0x2L) +#define CBS_DROPDOWNLIST (0x3L) +#define CBS_HASSTRINGS (0x200L) +#define CBS_LOWERCASE (0x4000L) +#define CBS_NOINTEGRALHEIGHT (0x400L) +#define CBS_OEMCONVERT (0x80L) +#define CBS_OWNERDRAWFIXED (0x10L) +#define CBS_OWNERDRAWVARIABLE (0x20L) +#define CBS_SIMPLE (0x1L) +#define CBS_SORT (0x100L) +#define CBS_UPPERCASE (0x2000L) +#define ES_AUTOHSCROLL (0x80L) +#define ES_AUTOVSCROLL (0x40L) +#define ES_CENTER (0x1L) +#define ES_LEFT (0L) +#define ES_LOWERCASE (0x10L) +#define ES_MULTILINE (0x4L) +#define ES_NOHIDESEL (0x100L) +#define ES_NUMBER (0x2000L) +#define ES_OEMCONVERT (0x400L) +#define ES_PASSWORD (0x20L) +#define ES_READONLY (0x800L) +#define ES_RIGHT (0x2L) +#define ES_UPPERCASE (0x8L) +#define ES_WANTRETURN (0x1000L) +#define LBS_DISABLENOSCROLL (0x1000L) +#define LBS_EXTENDEDSEL (0x800L) +#define LBS_HASSTRINGS (0x40L) +#define LBS_MULTICOLUMN (0x200L) +#define LBS_MULTIPLESEL (0x8L) +#define LBS_NODATA (0x2000L) +#define LBS_NOINTEGRALHEIGHT (0x100L) +#define LBS_NOREDRAW (0x4L) +#define LBS_NOSEL (0x4000L) +#define LBS_NOTIFY (0x1L) +#define LBS_OWNERDRAWFIXED (0x10L) +#define LBS_OWNERDRAWVARIABLE (0x20L) +#define LBS_SORT (0x2L) +#define LBS_STANDARD (0xa00003L) +#define LBS_USETABSTOPS (0x80L) +#define LBS_WANTKEYBOARDINPUT (0x400L) +#define SBS_BOTTOMALIGN (0x4L) +#define SBS_HORZ (0L) +#define SBS_LEFTALIGN (0x2L) +#define SBS_RIGHTALIGN (0x4L) +#define SBS_SIZEBOX (0x8L) +#define SBS_SIZEBOXBOTTOMRIGHTALIGN (0x4L) +#define SBS_SIZEBOXTOPLEFTALIGN (0x2L) +#define SBS_SIZEGRIP (0x10L) +#define SBS_TOPALIGN (0x2L) +#define SBS_VERT (0x1L) +#define SS_BITMAP (0xeL) +#define SS_BLACKFRAME (0x7L) +#define SS_BLACKRECT (0x4L) +#define SS_CENTER (0x1L) +#define SS_CENTERIMAGE (0x200L) +#define SS_ENHMETAFILE (0xfL) +#define SS_ETCHEDFRAME (0x12L) +#define SS_ETCHEDHORZ (0x10L) +#define SS_ETCHEDVERT (0x11L) +#define SS_GRAYFRAME (0x8L) +#define SS_GRAYRECT (0x5L) +#define SS_ICON (0x3L) +#define SS_LEFT (0L) +#define SS_LEFTNOWORDWRAP (0xcL) +#define SS_NOPREFIX (0x80L) +#define SS_NOTIFY (0x100L) +#define SS_OWNERDRAW (0xdL) +#define SS_REALSIZEIMAGE (0x800L) +#define SS_RIGHT (0x2L) +#define SS_RIGHTJUST (0x400L) +#define SS_SIMPLE (0xbL) +#define SS_SUNKEN (0x1000L) +#define SS_USERITEM (0xaL) +#define SS_WHITEFRAME (0x9L) +#define SS_WHITERECT (0x6L) +#define DS_3DLOOK (0x4L) +#define DS_ABSALIGN (0x1L) +#define DS_CENTER (0x800L) +#define DS_CENTERMOUSE (0x1000L) +#define DS_CONTEXTHELP (0x2000L) +#define DS_CONTROL (0x400L) +#define DS_FIXEDSYS (0x8L) +#define DS_LOCALEDIT (0x20L) +#define DS_MODALFRAME (0x80L) +#define DS_NOFAILCREATE (0x10L) +#define DS_NOIDLEMSG (0x100L) +#define DS_SETFONT (0x40L) +#define DS_SETFOREGROUND (0x200L) +#define DS_SYSMODAL (0x2L) + +/* A dialog control. */ + +struct dialog_control +{ + /* Next control. */ + struct dialog_control *next; + /* ID. */ + unsigned short id; + /* Style. */ + unsigned long style; + /* Extended style. */ + unsigned long exstyle; + /* X coordinate. */ + unsigned short x; + /* Y coordinate. */ + unsigned short y; + /* Width. */ + unsigned short width; + /* Height. */ + unsigned short height; + /* Class name. */ + struct res_id class; + /* Associated text. */ + struct res_id text; + /* Extra data for the window procedure. */ + struct rcdata_item *data; + /* Help ID. Only used in an extended dialog. */ + unsigned long help; +}; + +/* Control classes. These can be used as the ID field in a struct + dialog_control. */ + +#define CTL_BUTTON 0x80 +#define CTL_EDIT 0x81 +#define CTL_STATIC 0x82 +#define CTL_LISTBOX 0x83 +#define CTL_SCROLLBAR 0x84 +#define CTL_COMBOBOX 0x85 + +/* A fontdir resource is a list of fontdir structures. */ + +struct fontdir +{ + struct fontdir *next; + /* Index of font entry. */ + short index; + /* Length of font information. */ + unsigned long length; + /* Font information. */ + const unsigned char *data; +}; + +/* A group_icon resource is a list of group_icon structures. */ + +struct group_icon +{ + /* Next icon in group. */ + struct group_icon *next; + /* Width. */ + unsigned char width; + /* Height. */ + unsigned char height; + /* Color count. */ + unsigned char colors; + /* Planes. */ + unsigned short planes; + /* Bits per pixel. */ + unsigned short bits; + /* Number of bytes in cursor resource. */ + unsigned long bytes; + /* Index of cursor resource. */ + unsigned short index; +}; + +/* A menu resource. */ + +struct menu +{ + /* List of menuitems. */ + struct menuitem *items; + /* Help ID. I don't think there is any way to set this in an rc + file, but it can appear in the binary format. */ + unsigned long help; +}; + +/* A menu resource is a list of menuitem structures. */ + +struct menuitem +{ + /* Next menuitem. */ + struct menuitem *next; + /* Type. In a normal menu, rather than a menuex, this is the flags + field. */ + unsigned long type; + /* State. This is only used in a menuex. */ + unsigned long state; + /* Id. */ + unsigned short id; + /* Unicode text. */ + unichar *text; + /* Popup menu items for a popup. */ + struct menuitem *popup; + /* Help ID. This is only used in a menuex. */ + unsigned long help; +}; + +/* Menu item flags. These can appear in the flags field of a struct + menuitem. */ + +#define MENUITEM_GRAYED 0x001 +#define MENUITEM_INACTIVE 0x002 +#define MENUITEM_BITMAP 0x004 +#define MENUITEM_OWNERDRAW 0x100 +#define MENUITEM_CHECKED 0x008 +#define MENUITEM_POPUP 0x010 +#define MENUITEM_MENUBARBREAK 0x020 +#define MENUITEM_MENUBREAK 0x040 +#define MENUITEM_ENDMENU 0x080 +#define MENUITEM_HELP 0x4000 + +/* An rcdata resource is a pointer to a list of rcdata_item + structures. */ + +struct rcdata_item +{ + /* Next data item. */ + struct rcdata_item *next; + /* Type of data. */ + enum + { + RCDATA_WORD, + RCDATA_DWORD, + RCDATA_STRING, + RCDATA_WSTRING, + RCDATA_BUFFER + } type; + union + { + unsigned int word; + unsigned long dword; + struct + { + unsigned long length; + const char *s; + } string; + struct + { + unsigned long length; + const unichar *w; + } wstring; + struct + { + unsigned long length; + const unsigned char *data; + } buffer; + } u; +}; + +/* A stringtable resource is a pointer to a stringtable structure. */ + +struct stringtable +{ + /* Each stringtable resource is a list of 16 unicode strings. */ + struct + { + /* Length of string. */ + int length; + /* String data if length > 0. */ + unichar *string; + } strings[16]; +}; + +/* A versioninfo resource points to a versioninfo structure. */ + +struct versioninfo +{ + /* Fixed version information. */ + struct fixed_versioninfo *fixed; + /* Variable version information. */ + struct ver_info *var; +}; + +/* The fixed portion of a versioninfo resource. */ + +struct fixed_versioninfo +{ + /* The file version, which is two 32 bit integers. */ + unsigned long file_version_ms; + unsigned long file_version_ls; + /* The product version, which is two 32 bit integers. */ + unsigned long product_version_ms; + unsigned long product_version_ls; + /* The file flags mask. */ + unsigned long file_flags_mask; + /* The file flags. */ + unsigned long file_flags; + /* The OS type. */ + unsigned long file_os; + /* The file type. */ + unsigned long file_type; + /* The file subtype. */ + unsigned long file_subtype; + /* The date, which in Windows is two 32 bit integers. */ + unsigned long file_date_ms; + unsigned long file_date_ls; +}; + +/* A list of variable version information. */ + +struct ver_info +{ + /* Next item. */ + struct ver_info *next; + /* Type of data. */ + enum { VERINFO_STRING, VERINFO_VAR } type; + union + { + /* StringFileInfo data. */ + struct + { + /* Language. */ + unichar *language; + /* Strings. */ + struct ver_stringinfo *strings; + } string; + /* VarFileInfo data. */ + struct + { + /* Key. */ + unichar *key; + /* Values. */ + struct ver_varinfo *var; + } var; + } u; +}; + +/* A list of string version information. */ + +struct ver_stringinfo +{ + /* Next string. */ + struct ver_stringinfo *next; + /* Key. */ + unichar *key; + /* Value. */ + unichar *value; +}; + +/* A list of variable version information. */ + +struct ver_varinfo +{ + /* Next item. */ + struct ver_varinfo *next; + /* Language ID. */ + unsigned short language; + /* Character set ID. */ + unsigned short charset; +}; + +/* This structure is used when converting resource information to + binary. */ + +struct bindata +{ + /* Next data. */ + struct bindata *next; + /* Length of data. */ + unsigned long length; + /* Data. */ + unsigned char *data; +}; + +extern int verbose; + +/* Function declarations. */ + +extern struct res_directory *read_rc_file + (const char *, const char *, const char *, int, int); +extern struct res_directory *read_res_file (const char *); +extern struct res_directory *read_coff_rsrc (const char *, const char *); +extern void write_rc_file (const char *, const struct res_directory *); +extern void write_res_file (const char *, const struct res_directory *); +extern void write_coff_file + (const char *, const char *, const struct res_directory *); + +extern struct res_resource *bin_to_res + (struct res_id, const unsigned char *, unsigned long, int); +extern struct bindata *res_to_bin (const struct res_resource *, int); + +extern FILE *open_file_search + (const char *, const char *, const char *, char **); + +extern void *res_alloc (size_t); +extern void *reswr_alloc (size_t); + +/* Resource ID handling. */ + +extern int res_id_cmp (struct res_id, struct res_id); +extern void res_id_print (FILE *, struct res_id, int); +extern void res_ids_print (FILE *, int, const struct res_id *); +extern void res_string_to_id (struct res_id *, const char *); + +/* Manipulation of the resource tree. */ + +extern struct res_resource *define_resource + (struct res_directory **, int, const struct res_id *, int); +extern struct res_resource *define_standard_resource + (struct res_directory **, int, struct res_id, int, int); + +extern int extended_dialog (const struct dialog *); +extern int extended_menu (const struct menu *); + +/* Communication between the rc file support and the parser and lexer. */ + +extern int yydebug; +extern FILE *yyin; +extern char *rc_filename; +extern int rc_lineno; + +extern int yyparse (void); +extern int yylex (void); +extern void yyerror (const char *); +extern void rcparse_warning (const char *); +extern void rcparse_set_language (int); +extern void rcparse_discard_strings (void); +extern void rcparse_rcdata (void); +extern void rcparse_normal (void); + +extern void define_accelerator + (struct res_id, const struct res_res_info *, struct accelerator *); +extern void define_bitmap + (struct res_id, const struct res_res_info *, const char *); +extern void define_cursor + (struct res_id, const struct res_res_info *, const char *); +extern void define_dialog + (struct res_id, const struct res_res_info *, const struct dialog *); +extern struct dialog_control *define_control + (const struct res_id, unsigned long, unsigned long, unsigned long, + unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); +extern struct dialog_control *define_icon_control + (struct res_id, unsigned long, unsigned long, unsigned long, unsigned long, + unsigned long, unsigned long, struct rcdata_item *, struct dialog_ex *); +extern void define_font + (struct res_id, const struct res_res_info *, const char *); +extern void define_icon + (struct res_id, const struct res_res_info *, const char *); +extern void define_menu + (struct res_id, const struct res_res_info *, struct menuitem *); +extern struct menuitem *define_menuitem + (const char *, int, unsigned long, unsigned long, unsigned long, + struct menuitem *); +extern void define_messagetable + (struct res_id, const struct res_res_info *, const char *); +extern void define_rcdata + (struct res_id, const struct res_res_info *, struct rcdata_item *); +extern struct rcdata_item *define_rcdata_string + (const char *, unsigned long); +extern struct rcdata_item *define_rcdata_number (unsigned long, int); +extern void define_stringtable + (const struct res_res_info *, unsigned long, const char *); +extern void define_user_data + (struct res_id, struct res_id, const struct res_res_info *, + struct rcdata_item *); +extern void define_user_file + (struct res_id, struct res_id, const struct res_res_info *, const char *); +extern void define_versioninfo + (struct res_id, int, struct fixed_versioninfo *, struct ver_info *); +extern struct ver_info *append_ver_stringfileinfo + (struct ver_info *, const char *, struct ver_stringinfo *); +extern struct ver_info *append_ver_varfileinfo + (struct ver_info *, const char *, struct ver_varinfo *); +extern struct ver_stringinfo *append_verval + (struct ver_stringinfo *, const char *, const char *); +extern struct ver_varinfo *append_vertrans + (struct ver_varinfo *, unsigned long, unsigned long); diff --git a/binutils/winduni.c b/binutils/winduni.c new file mode 100644 index 0000000000000..65bc6085f3302 --- /dev/null +++ b/binutils/winduni.c @@ -0,0 +1,140 @@ +/* winduni.c -- unicode support for the windres program. + Copyright 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + + This file is part of GNU Binutils. + + This program is free software; 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. */ + +/* This file contains unicode support routines for the windres + program. Ideally, we would have generic unicode support which + would work on all systems. However, we don't. Instead, on a + Windows host, we are prepared to call some Windows routines. This + means that we will generate different output on Windows and Unix + hosts, but that seems better than not really supporting unicode at + all. */ + +#include "bfd.h" +#include "bucomm.h" +#include "winduni.h" +#include "safe-ctype.h" + +#ifdef _WIN32 +#include +#endif + +/* Convert an ASCII string to a unicode string. We just copy it, + expanding chars to shorts, rather than doing something intelligent. */ + +void +unicode_from_ascii (int *length, unichar **unicode, const char *ascii) +{ + int len; + const char *s; + unsigned short *w; + + len = strlen (ascii); + + if (length != NULL) + *length = len; + + *unicode = ((unichar *) res_alloc ((len + 1) * sizeof (unichar))); + +#ifdef _WIN32 + /* FIXME: On Windows, we should be using MultiByteToWideChar to set + the length. */ + MultiByteToWideChar (CP_ACP, 0, ascii, len + 1, *unicode, len + 1); +#else + for (s = ascii, w = *unicode; *s != '\0'; s++, w++) + *w = *s & 0xff; + *w = 0; +#endif +} + +/* Print the unicode string UNICODE to the file E. LENGTH is the + number of characters to print, or -1 if we should print until the + end of the string. FIXME: On a Windows host, we should be calling + some Windows function, probably WideCharToMultiByte. */ + +void +unicode_print (FILE *e, const unichar *unicode, int length) +{ + while (1) + { + unichar ch; + + if (length == 0) + return; + if (length > 0) + --length; + + ch = *unicode; + + if (ch == 0 && length < 0) + return; + + ++unicode; + + if ((ch & 0x7f) == ch) + { + if (ch == '\\') + fputs ("\\", e); + else if (ISPRINT (ch)) + putc (ch, e); + else + { + switch (ch) + { + case ESCAPE_A: + fputs ("\\a", e); + break; + + case ESCAPE_B: + fputs ("\\b", e); + break; + + case ESCAPE_F: + fputs ("\\f", e); + break; + + case ESCAPE_N: + fputs ("\\n", e); + break; + + case ESCAPE_R: + fputs ("\\r", e); + break; + + case ESCAPE_T: + fputs ("\\t", e); + break; + + case ESCAPE_V: + fputs ("\\v", e); + break; + + default: + fprintf (e, "\\%03o", (unsigned int) ch); + break; + } + } + } + else if ((ch & 0xff) == ch) + fprintf (e, "\\%03o", (unsigned int) ch); + else + fprintf (e, "\\x%x", (unsigned int) ch); + } +} diff --git a/binutils/winduni.h b/binutils/winduni.h new file mode 100644 index 0000000000000..c55189c273a65 --- /dev/null +++ b/binutils/winduni.h @@ -0,0 +1,60 @@ +/* winduni.h -- header file for unicode support for windres program. + Copyright 1997, 1998, 2002 Free Software Foundation, Inc. + Written by Ian Lance Taylor, Cygnus Support. + + This file is part of GNU Binutils. + + This program is free software; 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. */ + +#include "ansidecl.h" + +/* This header file declares the types and functions we use for + unicode support in windres. Our unicode support is very limited at + present. + + We don't put this stuff in windres.h so that winduni.c doesn't have + to include windres.h. winduni.c needs to includes windows.h, and + that would conflict with the definitions of Windows macros we + already have in windres.h. */ + +/* We use this type to hold a unicode character. */ + +typedef unsigned short unichar; + +/* Escape character translations. */ + +#define ESCAPE_A (007) +#define ESCAPE_B (010) +#define ESCAPE_F (014) +#define ESCAPE_N (012) +#define ESCAPE_R (015) +#define ESCAPE_T (011) +#define ESCAPE_V (013) + +/* Convert an ASCII string to a unicode string. */ + +extern void unicode_from_ascii + PARAMS ((int *, unichar **, const char *)); + +/* Print a unicode string to a file. */ + +extern void unicode_print PARAMS ((FILE *, const unichar *, int)); + +/* Windres support routine called by unicode_from_ascii. This is both + here and in windres.h. It should probably be in a separate header + file, but it hardly seems worth it for one function. */ + +extern PTR res_alloc PARAMS ((size_t)); diff --git a/config/ChangeLog b/config/ChangeLog index 129ce6168f3c6..85868b4246afb 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,82 @@ +2004-01-14 Maciej W. Rozycki + + * acinclude.m4: Quote names of macros to be defined by AC_DEFUN + throughout. + * aclocal.m4: Regenerate. + * configure: Regenerate. + +2003-10-14 Nathanael Nerode + + * gettext.m4: Properly quote arguments to AC_DEFUN. + +2003-09-24 Daniel Jacobowitz + + * acx.m4 (AC_PROG_CPP_WERROR): New. + +2003-08-27 Daniel Jacobowitz + + * no-executables.m4: New file. + +2003-07-07 Zack Weinberg + + * gettext.m4: Delete all former contents. + (ZW_GNU_GETTEXT_SISTER_DIR): New macro. + * progtest.m4: New file. + +2003-07-04 Zack Weinberg + + * gettext.m4: New file - copy of gettext.m4 from binutils + CVS, with added AC_ISC_POSIX macro from gcc/aclocal.m4. + +2003-05-14 Kelley Cook + + * acinclude.m4: Accept i[3456789]86 for machine type. + +2003-05-18 Nathanael Nerode + + * acx.m4: Introduce _GCC_TOPLEV_NONCANONICAL_BUILD, + _GCC_TOPLEV_NONCANOICAL_HOST, _GCC_TOPLEV_NONCANONICAL_TARGET, + GCC_TOPLEV_SUBDIRS. + +2003-03-04 Nathanael Nerode + + * mh-dgux: Delete. + +2002-12-28 Alexandre Oliva + + * acx.m4: Name cache variables properly. + (NCN_STRICT_CHECK_TOOL): If program is not found and + value-if-not-found is empty, use ${ncn_tool_prefix}$2 or $2, + depending on whether build != host or not. + (NCN_STRICT_CHECK_TARGET_TOOL): Ditto, with the target prefix. + +2002-12-28 Nathanael Nerode + + * acx.m4: New. + * mh-a68bsd, mh-aix386, mh-apollo68, mh-delta88, mh-hp300, + mh-hpux, mh-hpux8, mh-irix5, mh-irix6, mh-ncrsvr43, mh-openedition, + mh-riscos, mh-sysv: Delete. + * mh-cxux, mh-dgux386, mh-interix, mh-lynxrs6k, mh-ncr3000, + mh-necv4, mh-sco, mh-solaris, mh-sysv4, mh-sysv5, mt-v810: Simplify. + +2002-12-16 Christopher Faylor + + * mh-cygwin: Don't build libtermcap if it doesn't exist. + +2002-12-22 Geoffrey Keating + + * mt-aix43: Delete. + +2002-11-23 H.J. Lu + + * accross.m4: New. + +2002-11-10 Stan Shebs + + Retire common MPW configury bits. + * mpw-mh-mpw: Remove. + * mpw: Remove directory along with all of its files. + 2002-05-16 Rainer Orth * acinclude.m4: Allow for PWDCMD to override hardcoded pwd. @@ -10,33 +89,33 @@ 2002-04-29 Nathanael Nerode - * config/mh-cxux: remove dead code - * config/mh-dgux386: remove dead code - * config/mh-hp300: remove dead code - * config/mh-hpux: remove dead code - * config/mh-hpux8: remove dead code - * config/mh-irix5: remove dead code - * config/mh-irix6: remove dead code - * config/mh-ncr3000: remove dead code - * config/mh-ncrsvr43: remove dead code - * config/mh-necv4: remove dead code - * config/mh-sco: remove dead code - * config/mh-solaris: remove dead code - * config/mh-sysv: remove dead code - * config/mh-sysv4: remove dead code - * config/mh-sysv5: remove dead code - * config/mh-irix4: remove, contains only dead code - - * config/mt-armpic: Delete. - * config/mt-elfalphapic: Delete. - * config/mt-i370pic: Delete. - * config/mt-ia64pic: Delete. - * config/mt-m68kpic: Delete. - * config/mt-papic: Delete. - * config/mt-ppcpic: Delete. - * config/mt-s390pic: Delete. - * config/mt-sparcpic: Delete. - * config/mt-x86pic: Delete. + * mh-cxux: remove dead code + * mh-dgux386: remove dead code + * mh-hp300: remove dead code + * mh-hpux: remove dead code + * mh-hpux8: remove dead code + * mh-irix5: remove dead code + * mh-irix6: remove dead code + * mh-ncr3000: remove dead code + * mh-ncrsvr43: remove dead code + * mh-necv4: remove dead code + * mh-sco: remove dead code + * mh-solaris: remove dead code + * mh-sysv: remove dead code + * mh-sysv4: remove dead code + * mh-sysv5: remove dead code + * mh-irix4: remove, contains only dead code + + * mt-armpic: Delete. + * mt-elfalphapic: Delete. + * mt-i370pic: Delete. + * mt-ia64pic: Delete. + * mt-m68kpic: Delete. + * mt-papic: Delete. + * mt-ppcpic: Delete. + * mt-s390pic: Delete. + * mt-sparcpic: Delete. + * mt-x86pic: Delete. 2002-04-19 Nathanael Nerode @@ -94,13 +173,17 @@ 2000-07-21 Andrew Haley * mh-ia64pic: New file. - * mt-ia64pic: New file. + * mt-ia64pic: New file. 2001-02-09 Martin Schwidefsky * mh-s390pic: New file. * mt-s390pic: New file. +2000-09-26 David Edelsohn + + * mt-aix43 (NM_FOR_TARGET): Add -B bsd-style flag. + 2000-07-14 Mark P Mitchell * mh-irix6 (CC): Don't set it. @@ -121,7 +204,7 @@ 2000-02-22 Nick Clifton - * config/mt-wince: new file: Makefile fragment for WinCE targets. + * mt-wince: new file: Makefile fragment for WinCE targets. 2000-01-06 Geoff Keating @@ -136,6 +219,15 @@ Tue Sep 7 23:31:01 1999 Linas Vepstas * mt-d30v: New file, pass -g -Os -Wa,-C as default options. +Thu Mar 18 00:17:50 1999 Mark Elbrecht + + * mh-go32: Delete. + * mh-djgpp: New. Renamed from mh-go32. + +Wed Feb 24 12:52:17 1999 Stan Shebs + + * mh-windows: Ditto. + 1999-02-08 Syd Polk * acinclude.m4: Added macros to find itcl files. @@ -149,11 +241,23 @@ Tue Feb 2 22:51:21 1999 Philip Blundell * mh-armpic: New file. Patch from Jim Pick . * mt-armpic: Likewise. +Sat Jan 30 08:04:00 1999 Mumit Khan + + * mh-interix: New file. + Mon Jan 18 19:41:08 1999 Christopher Faylor * cygwin.mh: Activate commented out dependencies for gdb: libtermcap. +Wed Dec 30 20:34:52 1998 Christopher Faylor + + * mt-cygwin: Remove. + +Wed Dec 30 01:13:03 1998 Christopher Faylor + + * mt-cygwin: New file. libtermcap target info. + Wed Nov 18 20:29:46 1998 Christopher Faylor * cygwin.mh: Add extra libtermcap target information. @@ -162,8 +266,8 @@ Wed Nov 18 20:29:46 1998 Christopher Faylor Mon Nov 2 15:15:33 1998 Geoffrey Noer - * mh-cygwin32: delete - * mh-cygwin: was mh-cygwin32 + * mh-cygwin32: delete + * mh-cygwin: was mh-cygwin32 1998-10-26 Syd Polk @@ -190,7 +294,7 @@ Mon Aug 10 00:15:47 1998 HJ Lu (hjl@gnu.org) 1998-05-29 Rob Savoye * acinclude.m4: New collection of generic autoconf macros. - + Wed Apr 22 12:24:28 1998 Michael Meissner * mt-ospace: New file, support using -Os instead of -O2 to compile @@ -208,10 +312,29 @@ Thu Mar 26 01:54:25 1998 Geoffrey Noer * mh-cygwin32: stop configuring and building dosrel. +Fri Feb 6 01:33:52 1998 Manfred Hollstein + + * mh-sparcpic (PICFLAG): Define to properly according + to current multilib configuration. + * mt-sparcpic (PICFLAG_FOR_TARGET): Define to properly + according to current multilib configuration. + +Sun Jan 4 01:06:55 1998 Mumit Khan + + * mh-mingw32: New file. + Thu Sep 11 16:43:27 1997 Jim Wilson * mh-elfalphapic, mt-elfalphapic: New files. +1997-09-15 02:37 Ulrich Drepper + + * mt-linux: Define CXXFLAGS to make sure -fvtable-thunks is used. + +Sun Sep 14 20:53:42 1997 Geoffrey Noer + + * mh-cygwin32: ok to build split texinfo files + Wed Jul 23 12:32:18 1997 Robert Hoehne * mh-go32 (CFLAGS): Don't set -fno-omit-frame-pointer. @@ -233,8 +356,8 @@ Tue Mar 25 18:16:43 1997 Geoffrey Noer Wed Jan 8 19:56:43 1997 Geoffrey Noer - * mh-cygwin32: override CFLAGS so debug info isn't included - in cygwin32-hosted tools by default + * mh-cygwin32: override CFLAGS so debug info isn't included + in cygwin32-hosted tools by default Tue Dec 31 16:04:26 1996 Ian Lance Taylor @@ -244,6 +367,20 @@ Mon Nov 11 10:29:51 1996 Michael Meissner * mt-ppc: Delete file, options moved to newlib configure. +Mon Oct 28 17:32:46 1996 Stu Grossman (grossman@critters.cygnus.com) + + * mh-windows: Add rules for building MSVC makefiles. + +Thu Oct 24 09:02:07 1996 Stu Grossman (grossman@critters.cygnus.com) + + * mh-windows (HOST_FLAGS): Set srcroot, which is needed + for MSVC build procedure. + +Tue Oct 8 08:32:48 1996 Stu Grossman (grossman@critters.cygnus.com) + + * mh-windows: Add support for windows host + (that is a build done under the Microsoft build environment). + Fri Oct 4 12:21:03 1996 Angela Marie Thomas (angela@cygnus.com) * mh-dgux386: New file. x86 dgux specific flags @@ -257,6 +394,11 @@ Sat Aug 17 04:56:25 1996 Geoffrey Noer * mh-cygwin32: don't -D_WIN32 here anymore +Sun Aug 11 20:51:50 1996 Stu Grossman (grossman@critters.cygnus.com) + + * mh-cygwin32 (CFLAGS): Define _WIN32 to be compatible + with normal Windows compilation environment. + Thu Aug 15 19:46:44 1996 Stan Shebs * mpw-mh-mpw (SEGFLAG_68K, SEGFLAG_PPC): Remove. @@ -326,13 +468,28 @@ Thu Jan 25 16:05:33 1996 Ian Lance Taylor * mh-ncrsvr43 (CFLAGS): Remove -Hnocopyr. +Thu Nov 30 14:45:25 1995 J.T. Conklin + + * mt-v810 (CC_FOR_TARGET): Add -ansi flag. NEC compiler + defaults to K&R mode, but doesn't have varargs.h, so we have to + compile in ANSI mode. + +Wed Nov 29 13:49:08 1995 J.T. Conklin + + * mt-v810 (CC_FOR_TARGET, AS_FOR_TARGET, AR_FOR_TARGET, + RANLIB_FOR_TARGET): Set as appropriate for NEC v810 toolchain. + +Tue Nov 14 15:03:12 1995 Jason Molenda (crash@phydeaux.cygnus.com) + + * mh-i386win32: add LD_FOR_TARGET. + Tue Nov 7 15:41:30 1995 Stan Shebs * mpw-mh-mpw (CC_MWC68K, CC_MWCPPC): Remove unused include path. (CC_MWCPPC): Add -mpw_chars, disable warnings, add comments explaining reasons for various flags. (EXTRALIBS_PPC, EXTRALIBS_MWCPPC ): Put runtime library first. - + Fri Oct 13 14:44:25 1995 Jason Molenda (crash@phydeaux.cygnus.com) * mh-aix, mh-sun: Removed. @@ -341,7 +498,7 @@ Fri Oct 13 14:44:25 1995 Jason Molenda (crash@phydeaux.cygnus.com) * mh-sco, mh-solaris, mh-sysv4 (X11_EXTRA_LIBS): Define. - * mh-hp300, mh-hpux, mh-hpux8, mh-solaris, mh-sun3, mh-sysv4: Don't + * mh-hp300, mh-hpux, mh-hpux8, mh-solaris, mh-sun3, mh-sysv4: Don't hardcode location of X stuff here. Thu Sep 28 13:14:56 1995 Stan Shebs @@ -350,6 +507,10 @@ Thu Sep 28 13:14:56 1995 Stan Shebs compilers, add definitions for library and link steps for PowerMacs. +Sat Sep 16 18:31:08 PDT 1995 Angela Marie Thomas + + * mh-ncrsvr43: Removed AR_FLAGS + Thu Sep 14 08:20:04 1995 Fred Fish * mh-hp300 (CC): Add "CC = cc -Wp,-H256000" to avoid @@ -364,10 +525,14 @@ Thu Jun 22 17:47:24 1995 Stan Shebs * mpw-mh-mpw (CC): Define ANSI_PROTOTYPES. +Mon Jun 5 18:26:36 1995 Jason Merrill + + * m?-*pic: Define PICFLAG* instead of LIB*FLAGS*. + Mon Apr 10 12:29:48 1995 Stan Shebs * mpw-mh-mpw (EXTRALIBS): Always link in Math.o, CSANELIB.o, - and ToolLibs.o. + and ToolLibs.o. * mpw-mh-mpw (CC): Define ALMOST_STDC. (CFLAGS): Remove ALMOST_STDC, -mc68881. @@ -382,6 +547,15 @@ Fri Mar 31 11:35:17 1995 Jason Molenda (crash@phydeaux.cygnus.com) * mt-netware: New file. +Tue Mar 28 14:47:34 1995 Jason Molenda (crash@phydeaux.cygnus.com) + + Revert this change: + + Mon Mar 29 19:59:26 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * mh-solaris: SunPRO C needs -Xs to be able to get a + working xmakefile for Emacs. + Mon Mar 13 12:31:29 1995 Ian Lance Taylor * mh-hpux8: New file. @@ -396,6 +570,10 @@ Wed Jan 11 16:29:34 1995 Jason Merrill * m?-*pic (LIBCXXFLAGS): Add -fno-implicit-templates. +Sat Nov 5 18:43:30 1994 Jason Merrill (jason@phydeaux.cygnus.com) + + * m[th]-*pic: Support --enable-shared. + Thu Nov 3 17:27:19 1994 Ken Raeburn * mh-irix4 (CC): Increase maximum string length. @@ -417,6 +595,15 @@ Thu May 19 00:32:11 1994 Jeff Law (law@snake.cs.utah.edu) * mh-hpux (CC): Add -Wp,-H256000 to avoid "too much defining" errors from the HPUX 8 compilers. +Fri May 6 14:19:25 1994 Steve Chamberlain (sac@cygnus.com) + + * mh-go32: New fragment. + +Thu May 5 20:06:45 1994 Ken Raeburn (raeburn@cujo.cygnus.com) + + * mh-lynxrs6k: Renamed from mh-lynxosrs6k, to make it + unique in 8.3 naming schemes. + Wed May 4 20:14:47 1994 D. V. Henkel-Wallace (gumby@cygnus.com) * mh-lynxrs6k: set SHELL to /bin/bash @@ -425,10 +612,18 @@ Tue Apr 12 12:38:17 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) * mh-irix4 (CC): Change -XNh1500 to -XNh2000. +Mon Jan 31 18:40:55 1994 Stu Grossman (grossman at cygnus.com) + + * mh-lynxosrs6k: Account for lack of ranlib! + Sat Dec 25 20:03:45 1993 Jeffrey A. Law (law@snake.cs.utah.edu) * mt-hppa: Delete. +Thu Dec 2 14:35:54 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * mh-irix5: New file for Irix 5. + Tue Nov 16 22:54:39 1993 Jim Kingdon (kingdon@lioth.cygnus.com) * mh-a68bsd: Define CC to gcc. @@ -480,16 +675,62 @@ Fri Jun 4 16:09:34 1993 Ian Lance Taylor (ian@cygnus.com) * mh-sysv4 (INSTALL): Use cp, not /usr/ucb/install. +Sat Apr 17 17:19:50 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * mh-delta88: remove extraneous GCC references + Thu Apr 8 11:21:52 1993 Ian Lance Taylor (ian@cygnus.com) * mt-a29k, mt-ebmon29k, mt-os68k, mt-ose68000, mt-ose68k, mt-vxworks68, mt-vxworks960: Removed obsolete, unused target Makefile fragment files. +Wed Mar 31 12:31:56 1993 Ian Lance Taylor (ian@cygnus.com) + + * mh-irix4: Bump -XNh value to 1500 to match gcc requirements. + +Mon Mar 29 19:59:26 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * mh-sun3: cc needs -J to compile cp-parse.c correctly + + * mh-solaris: SunPRO C needs -Xs to be able to get a + working xmakefile for Emacs. + Mon Mar 8 15:05:25 1993 Ken Raeburn (raeburn@cambridge.cygnus.com) * mh-aix386: New file; old mh-aix, plus no-op RANLIB. +Tue Mar 2 21:15:58 1993 Fred Fish (fnf@cygnus.com) + + * mh-vaxult2: New file. + +Sat Jan 23 20:32:01 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * mh-sco: define X11_LIB to the mess that SCO ODT requires + +Tue Dec 29 15:06:00 1992 Ian Lance Taylor (ian@cygnus.com) + + * mh-sco: Don't override BISON definition. + +Mon Dec 7 06:43:27 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * mh-sco: don't default $(CC) to gcc + +Mon Nov 30 14:54:34 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * mh-solaris: rework standard X location to use + $OPENWINHOME, if defined. + + * mh-sun: handle X11 include locations + + * mh-decstation: define NeedFunctionPrototypes to 0, to + work around dain-bramaged DECwindows include files + +Fri Nov 27 18:35:54 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * mh-hpux, mh-solaris: define the "standard" locations for + the vendor supplied X11 headers and libraries + Thu Oct 1 13:50:48 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) * mh-solaris: INSTALL is NOT /usr/ucb/install @@ -498,6 +739,11 @@ Mon Aug 24 14:25:35 1992 Ian Lance Taylor (ian@cygnus.com) * mt-ose68000, mt-ose68k: renamed from mt-OSE*. +Mon Aug 3 15:41:28 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * mh-solaris: removed the -xs from CFLAGS (let the people + with Sun's C compiler deal with it themselved) + Tue Jul 21 02:11:01 1992 D. V. Henkel-Wallace (gumby@cygnus.com) * mt-OSE68k, mt-680000: new configs. @@ -506,20 +752,47 @@ Thu Jul 16 17:12:09 1992 K. Richard Pixley (rich@rtl.cygnus.com) * mh-irix4: merged changes from progressive. +Wed Jul 8 00:01:30 1992 Stu Grossman (grossman at cygnus.com) + + * mh-solaris: Use -xs when compiling so that Sun-C puts + a symbol-table into the executable. + +Mon Jun 15 12:31:52 1992 Fred Fish (fnf@cygnus.com) + + * mh-ncr3000 (INSTALL): Don't use /usr/ucb/install, + it is broken on ncr 3000's. + Tue Jun 9 23:29:38 1992 Per Bothner (bothner@rtl.cygnus.com) * Everywhere: Change RANLIB=echo>/dev/null (which confuses some shells - and I don't blame them) to RANLIB=true. * mh-solaris: Use /usr/ucb/install for INSTALL. +Tue Jun 9 17:18:11 1992 Fred Fish (fnf at cygnus.com) + + * mh-ncr3000, mh-sysv4: Add INSTALL. + Sun May 31 14:45:23 1992 Mark Eichin (eichin at cygnus.com) * mh-solaris2: Add new configuration for Solaris 2 (sysv, no ranlib) +Wed Apr 22 14:38:34 1992 Fred Fish (fnf@cygnus.com) + + * mh-delta88, mh-ncr3000: Replace MINUS_G with + CFLAGS per new configuration strategy. + Fri Apr 10 23:10:08 1992 Fred Fish (fnf@cygnus.com) * mh-ncr3000: Add new configuration for NCR 3000. +Thu Mar 5 12:05:58 1992 Stu Grossman (grossman at cygnus.com) + + * mh-irix4: Port to SGI Irix-4.x. + +Thu Jan 30 16:17:30 1992 Stu Grossman (grossman at cygnus.com) + + * mh-sco: Fix SCO configuration stuff. + Tue Dec 10 00:10:55 1991 K. Richard Pixley (rich at rtl.cygnus.com) * ChangeLog: fresh changelog. diff --git a/config/accross.m4 b/config/accross.m4 new file mode 100644 index 0000000000000..a4cebf692e1a4 --- /dev/null +++ b/config/accross.m4 @@ -0,0 +1,98 @@ +AC_DEFUN([AC_COMPILE_CHECK_SIZEOF], +[changequote(<<, >>)dnl +dnl The name to #define. +define(<>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl +dnl The cache variable name. +define(<>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl +changequote([, ])dnl +AC_MSG_CHECKING(size of $1) +AC_CACHE_VAL(AC_CV_NAME, +[for ac_size in 4 8 1 2 16 12 $2 ; do # List sizes in rough order of prevalence. + AC_TRY_COMPILE([#include "confdefs.h" +#include +$2 +], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size) + if test x$AC_CV_NAME != x ; then break; fi +done +]) +if test x$AC_CV_NAME = x ; then + AC_MSG_ERROR([cannot determine a size for $1]) +fi +AC_MSG_RESULT($AC_CV_NAME) +AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1]) +undefine([AC_TYPE_NAME])dnl +undefine([AC_CV_NAME])dnl +]) + +AC_DEFUN([AC_C_BIGENDIAN_CROSS], +[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, +[ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +AC_TRY_COMPILE([#include +#include ], [ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif], [# It does; now see whether it defined to BIG_ENDIAN or not. +AC_TRY_COMPILE([#include +#include ], [ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) +if test $ac_cv_c_bigendian = unknown; then +AC_TRY_RUN([main () { + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes, +[ echo $ac_n "cross-compiling... " 2>&AC_FD_MSG ]) +fi]) +if test $ac_cv_c_bigendian = unknown; then +AC_MSG_CHECKING(to probe for byte ordering) +[ +cat >conftest.c <&AC_FD_MSG + ac_cv_c_bigendian=yes + fi + if test `grep -l LiTTleEnDian conftest.o` ; then + echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG + if test $ac_cv_c_bigendian = yes ; then + ac_cv_c_bigendian=unknown; + else + ac_cv_c_bigendian=no + fi + fi + echo $ac_n 'guessing bigendian ... ' >&AC_FD_MSG + fi + fi +AC_MSG_RESULT($ac_cv_c_bigendian) +fi +if test $ac_cv_c_bigendian = yes; then + AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian]) + AC_DEFINE(HOST_WORDS_BIG_ENDIAN, 1, + [Define if the host machine stores words of multi-word integers in + big-endian order.]) + BYTEORDER=4321 +else + BYTEORDER=1234 +fi +AC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN]) +if test $ac_cv_c_bigendian = unknown; then + AC_MSG_ERROR(unknown endianess - sorry, please pre-set ac_cv_c_bigendian) +fi +]) diff --git a/config/acinclude.m4 b/config/acinclude.m4 index 00887e0dd3057..c7c0ab5dc11c6 100755 --- a/config/acinclude.m4 +++ b/config/acinclude.m4 @@ -6,7 +6,7 @@ dnl and doesn't call AC_PROG_CXX_GNU, cause we test for that in AC_PROG_CC_WORK dnl We are probably using a cross compiler, which will not be able to fully dnl link an executable. This should really be fixed in autoconf itself. dnl Find a working G++ cross compiler. This only works for the GNU C++ compiler. -AC_DEFUN(CYG_AC_PROG_CXX_CROSS, +AC_DEFUN([CYG_AC_PROG_CXX_CROSS], [AC_BEFORE([$0], [AC_PROG_CXXCPP]) AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc) @@ -35,7 +35,7 @@ fi ]) dnl See if the G++ compiler we found works. -AC_DEFUN(CYG_AC_PROG_GXX_WORKS, +AC_DEFUN([CYG_AC_PROG_GXX_WORKS], [AC_MSG_CHECKING([whether the G++ compiler ($CXX $CXXFLAGS $LDFLAGS) actually works]) AC_LANG_SAVE AC_LANG_CPLUSPLUS @@ -103,7 +103,7 @@ AC_SUBST(CXX) dnl ==================================================================== dnl Find a working GCC cross compiler. This only works for the GNU gcc compiler. dnl This is based on the macros above for G++. -AC_DEFUN(CYG_AC_PROG_CC_CROSS, +AC_DEFUN([CYG_AC_PROG_CC_CROSS], [AC_BEFORE([$0], [AC_PROG_CCPP]) AC_CHECK_PROGS(CC, cc, gcc) @@ -132,7 +132,7 @@ fi ]) dnl See if the GCC compiler we found works. -AC_DEFUN(CYG_AC_PROG_GCC_WORKS, +AC_DEFUN([CYG_AC_PROG_GCC_WORKS], [AC_MSG_CHECKING([whether the Gcc compiler ($CC $CFLAGS $LDFLAGS) actually works]) AC_LANG_SAVE AC_LANG_C @@ -199,7 +199,7 @@ AC_SUBST(CC) dnl ==================================================================== dnl Find the BFD library in the build tree. This is used to access and dnl manipulate object or executable files. -AC_DEFUN(CYG_AC_PATH_BFD, [ +AC_DEFUN([CYG_AC_PATH_BFD], [ AC_MSG_CHECKING(for the bfd header in the build tree) dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." dnl Look for the header file @@ -241,7 +241,7 @@ AC_SUBST(BFDLIB) dnl ==================================================================== dnl Find the libiberty library. This defines many commonly used C dnl functions that exists in various states based on the underlying OS. -AC_DEFUN(CYG_AC_PATH_LIBERTY, [ +AC_DEFUN([CYG_AC_PATH_LIBERTY], [ AC_MSG_CHECKING(for the liberty library in the build tree) dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." AC_CACHE_VAL(ac_cv_c_liberty,[ @@ -262,7 +262,7 @@ AC_SUBST(LIBERTY) dnl ==================================================================== dnl Find the opcodes library. This is used to do dissasemblies. -AC_DEFUN(CYG_AC_PATH_OPCODES, [ +AC_DEFUN([CYG_AC_PATH_OPCODES], [ AC_MSG_CHECKING(for the opcodes library in the build tree) dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." AC_CACHE_VAL(ac_cv_c_opc,[ @@ -284,7 +284,7 @@ AC_SUBST(OPCODESLIB) dnl ==================================================================== dnl Look for the DejaGnu header file in the source tree. This file dnl defines the functions used to testing support. -AC_DEFUN(CYG_AC_PATH_DEJAGNU, [ +AC_DEFUN([CYG_AC_PATH_DEJAGNU], [ AC_MSG_CHECKING(for the testing support files in the source tree) dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." AC_CACHE_VAL(ac_cv_c_dejagnu,[ @@ -335,7 +335,7 @@ AC_SUBST(DEJAGNUHDIR) dnl ==================================================================== dnl Find the libintl library in the build tree. This is for dnl internationalization support. -AC_DEFUN(CYG_AC_PATH_INTL, [ +AC_DEFUN([CYG_AC_PATH_INTL], [ AC_MSG_CHECKING(for the intl header in the build tree) dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." dnl Look for the header file @@ -375,7 +375,7 @@ AC_SUBST(INTLLIB) dnl ==================================================================== dnl Find the simulator library. -AC_DEFUN(CYG_AC_PATH_SIM, [ +AC_DEFUN([CYG_AC_PATH_SIM], [ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.. ../../../../../../../../../.." case "$target_cpu" in powerpc) target_dir=ppc ;; @@ -457,7 +457,7 @@ AC_SUBST(SIMLIB) dnl ==================================================================== dnl Find the libiberty library. -AC_DEFUN(CYG_AC_PATH_LIBIBERTY, [ +AC_DEFUN([CYG_AC_PATH_LIBIBERTY], [ AC_MSG_CHECKING(for the libiberty library in the build tree) dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." AC_CACHE_VAL(ac_cv_c_libib,[ @@ -477,7 +477,7 @@ AC_SUBST(LIBIBERTY) ]) dnl ==================================================================== -AC_DEFUN(CYG_AC_PATH_DEVO, [ +AC_DEFUN([CYG_AC_PATH_DEVO], [ AC_MSG_CHECKING(for devo headers in the source tree) dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." AC_CACHE_VAL(ac_cv_c_devoh,[ @@ -498,7 +498,7 @@ AC_SUBST(DEVOHDIR) dnl ==================================================================== dnl find the IDE library and headers. -AC_DEFUN(CYG_AC_PATH_IDE, [ +AC_DEFUN([CYG_AC_PATH_IDE], [ AC_MSG_CHECKING(for IDE headers in the source tree) dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." IDEHDIR= @@ -591,7 +591,7 @@ AC_SUBST(IDETCLLIB) dnl ==================================================================== dnl Find all the ILU headers and libraries -AC_DEFUN(CYG_AC_PATH_ILU, [ +AC_DEFUN([CYG_AC_PATH_ILU], [ AC_MSG_CHECKING(for ILU kernel headers in the source tree) dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." AC_CACHE_VAL(ac_cv_c_iluh,[ @@ -752,7 +752,7 @@ dnl ==================================================================== dnl This defines the byte order for the host. We can't use dnl AC_C_BIGENDIAN, cause we want to create a config file and dnl substitue the real value, so the header files work right -AC_DEFUN(CYG_AC_C_ENDIAN, [ +AC_DEFUN([CYG_AC_C_ENDIAN], [ AC_MSG_CHECKING(to see if this is a little endian host) AC_CACHE_VAL(ac_cv_c_little_endian, [ ac_cv_c_little_endian=unknown @@ -788,7 +788,7 @@ dnl Yes, this is ugly, and only used for a canadian cross anyway. This dnl is just to keep configure from stopping here. case "${host}" in changequote(,) - i[3456]86-*-*) ac_cv_c_little_endian=yes ;; + i[3456789]86-*-*) ac_cv_c_little_endian=yes ;; sparc*-*-*) ac_cv_c_little_endian=no ;; changequote([,]) *) AC_MSG_WARN(Can't cross compile this test) ;; @@ -809,7 +809,7 @@ AC_SUBST(ENDIAN) dnl ==================================================================== dnl Look for the path to libgcc, so we can use it to directly link dnl in libgcc.a with LD. -AC_DEFUN(CYG_AC_PATH_LIBGCC, +AC_DEFUN([CYG_AC_PATH_LIBGCC], [AC_MSG_CHECKING([Looking for the path to libgcc.a]) AC_LANG_SAVE AC_LANG_C @@ -844,12 +844,12 @@ dnl Warning: transition of version 9 to 10 will break this algorithm dnl because 10 sorts before 9. We also look for just tcl. We have to dnl be careful that we don't match stuff like tclX by accident. dnl the alternative search directory is involked by --with-tclinclude -AC_DEFUN(CYG_AC_PATH_TCL, [ +AC_DEFUN([CYG_AC_PATH_TCL], [ CYG_AC_PATH_TCLH CYG_AC_PATH_TCLCONFIG CYG_AC_LOAD_TCLCONFIG ]) -AC_DEFUN(CYG_AC_PATH_TCLH, [ +AC_DEFUN([CYG_AC_PATH_TCLH], [ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." no_tcl=true AC_MSG_CHECKING(for Tcl headers in the source tree) @@ -935,7 +935,7 @@ AC_SUBST(TCLHDIR) dnl ==================================================================== dnl Ok, lets find the tcl configuration -AC_DEFUN(CYG_AC_PATH_TCLCONFIG, [ +AC_DEFUN([CYG_AC_PATH_TCLCONFIG], [ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." dnl First, look for one uninstalled. dnl the alternative search directory is invoked by --with-tclconfig @@ -1024,7 +1024,7 @@ AC_SUBST(TCLCONFIG) dnl Defined as a separate macro so we don't have to cache the values dnl from PATH_TCLCONFIG (because this can also be cached). -AC_DEFUN(CYG_AC_LOAD_TCLCONFIG, [ +AC_DEFUN([CYG_AC_LOAD_TCLCONFIG], [ . $TCLCONFIG dnl AC_SUBST(TCL_VERSION) @@ -1070,12 +1070,12 @@ dnl AC_SUBST(TCL_UNSHARED_LIB_SUFFIX) ]) dnl ==================================================================== -AC_DEFUN(CYG_AC_PATH_TK, [ +AC_DEFUN([CYG_AC_PATH_TK], [ CYG_AC_PATH_TKH CYG_AC_PATH_TKCONFIG CYG_AC_LOAD_TKCONFIG ]) -AC_DEFUN(CYG_AC_PATH_TKH, [ +AC_DEFUN([CYG_AC_PATH_TKH], [ # # Ok, lets find the tk source trees so we can use the headers # If the directory (presumably symlink) named "tk" exists, use that one @@ -1168,7 +1168,7 @@ fi AC_SUBST(TKHDIR) ]) -AC_DEFUN(CYG_AC_PATH_TKCONFIG, [ +AC_DEFUN([CYG_AC_PATH_TKCONFIG], [ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." dnl First, look for one uninstalled. dnl the alternative search directory is invoked by --with-tkconfig @@ -1257,7 +1257,7 @@ AC_SUBST(TKCONFIG) dnl Defined as a separate macro so we don't have to cache the values dnl from PATH_TKCONFIG (because this can also be cached). -AC_DEFUN(CYG_AC_LOAD_TKCONFIG, [ +AC_DEFUN([CYG_AC_LOAD_TKCONFIG], [ if test -f "$TKCONFIG" ; then . $TKCONFIG fi @@ -1287,13 +1287,13 @@ dnl AC_SUBST(TK_EXEC_PREFIX) dnl ==================================================================== dnl Ok, lets find the itcl source trees so we can use the headers dnl the alternative search directory is involked by --with-itclinclude -AC_DEFUN(CYG_AC_PATH_ITCL, [ +AC_DEFUN([CYG_AC_PATH_ITCL], [ CYG_AC_PATH_ITCLH CYG_AC_PATH_ITCLLIB CYG_AC_PATH_ITCLSH CYG_AC_PATH_ITCLMKIDX ]) -AC_DEFUN(CYG_AC_PATH_ITCLH, [ +AC_DEFUN([CYG_AC_PATH_ITCLH], [ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." no_itcl=true AC_MSG_CHECKING(for Itcl headers in the source tree) @@ -1367,7 +1367,7 @@ AC_SUBST(ITCLHDIR) dnl Ok, lets find the itcl library dnl First, look for one uninstalled. dnl the alternative search directory is invoked by --with-itcllib -AC_DEFUN(CYG_AC_PATH_ITCLLIB, [ +AC_DEFUN([CYG_AC_PATH_ITCLLIB], [ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." if test x"${no_itcl}" = x ; then dnl we reset no_itcl incase something fails here @@ -1454,7 +1454,7 @@ AC_SUBST(ITCLLIB) dnl ==================================================================== dnl Ok, lets find the itcl source trees so we can use the itcl_sh script dnl the alternative search directory is involked by --with-itclinclude -AC_DEFUN(CYG_AC_PATH_ITCLSH, [ +AC_DEFUN([CYG_AC_PATH_ITCLSH], [ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." no_itcl=true AC_MSG_CHECKING(for the itcl_sh script) @@ -1516,7 +1516,7 @@ AC_SUBST(ITCLSH) dnl ==================================================================== dnl Ok, lets find the itcl source trees so we can use the itcl_sh script dnl the alternative search directory is involked by --with-itclinclude -AC_DEFUN(CYG_AC_PATH_ITCLMKIDX, [ +AC_DEFUN([CYG_AC_PATH_ITCLMKIDX], [ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." no_itcl=true AC_MSG_CHECKING(for itcl_mkindex.tcl script) @@ -1582,11 +1582,11 @@ AC_SUBST(ITCLMKIDX) dnl ==================================================================== dnl Ok, lets find the tix source trees so we can use the headers dnl the alternative search directory is involked by --with-tixinclude -AC_DEFUN(CYG_AC_PATH_TIX, [ +AC_DEFUN([CYG_AC_PATH_TIX], [ CYG_AC_PATH_TIXH CYG_AC_PATH_TIXLIB ]) -AC_DEFUN(CYG_AC_PATH_TIXH, [ +AC_DEFUN([CYG_AC_PATH_TIXH], [ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." no_tix=true AC_MSG_CHECKING(for Tix headers in the source tree) @@ -1663,7 +1663,7 @@ fi AC_SUBST(TIXHDIR) ]) -AC_DEFUN(CYG_AC_PATH_TIXCONFIG, [ +AC_DEFUN([CYG_AC_PATH_TIXCONFIG], [ # # Ok, lets find the tix configuration # First, look for one uninstalled. @@ -1737,7 +1737,7 @@ fi # Defined as a separate macro so we don't have to cache the values # from PATH_TIXCONFIG (because this can also be cached). -AC_DEFUN(CYG_AC_LOAD_TIXCONFIG, [ +AC_DEFUN([CYG_AC_LOAD_TIXCONFIG], [ if test -f "$TIXCONFIG" ; then . $TIXCONFIG fi @@ -1746,7 +1746,7 @@ AC_DEFUN(CYG_AC_LOAD_TIXCONFIG, [ AC_SUBST(TIX_LIB_FULL_PATH) ]) -AC_DEFUN(CYG_AC_PATH_ITCLCONFIG, [ +AC_DEFUN([CYG_AC_PATH_ITCLCONFIG], [ # # Ok, lets find the itcl configuration # First, look for one uninstalled. @@ -1820,7 +1820,7 @@ fi # Defined as a separate macro so we don't have to cache the values # from PATH_ITCLCONFIG (because this can also be cached). -AC_DEFUN(CYG_AC_LOAD_ITCLCONFIG, [ +AC_DEFUN([CYG_AC_LOAD_ITCLCONFIG], [ if test -f "$ITCLCONFIG" ; then . $ITCLCONFIG fi @@ -1833,7 +1833,7 @@ AC_DEFUN(CYG_AC_LOAD_ITCLCONFIG, [ ]) -AC_DEFUN(CYG_AC_PATH_ITKCONFIG, [ +AC_DEFUN([CYG_AC_PATH_ITKCONFIG], [ # # Ok, lets find the itk configuration # First, look for one uninstalled. @@ -1907,7 +1907,7 @@ fi # Defined as a separate macro so we don't have to cache the values # from PATH_ITKCONFIG (because this can also be cached). -AC_DEFUN(CYG_AC_LOAD_ITKCONFIG, [ +AC_DEFUN([CYG_AC_LOAD_ITKCONFIG], [ if test -f "$ITKCONFIG" ; then . $ITKCONFIG fi @@ -1921,11 +1921,11 @@ AC_DEFUN(CYG_AC_LOAD_ITKCONFIG, [ dnl ==================================================================== dnl Ok, lets find the libgui source trees so we can use the headers dnl the alternative search directory is involked by --with-libguiinclude -AC_DEFUN(CYG_AC_PATH_LIBGUI, [ +AC_DEFUN([CYG_AC_PATH_LIBGUI], [ CYG_AC_PATH_LIBGUIH CYG_AC_PATH_LIBGUILIB ]) -AC_DEFUN(CYG_AC_PATH_LIBGUIH, [ +AC_DEFUN([CYG_AC_PATH_LIBGUIH], [ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../..../../../../../../../../../../.." no_libgui=true AC_MSG_CHECKING(for Libgui headers in the source tree) @@ -1995,7 +1995,7 @@ AC_SUBST(LIBGUIHDIR) dnl ==================================================================== dnl find the GUI library -AC_DEFUN(CYG_AC_PATH_LIBGUILIB, [ +AC_DEFUN([CYG_AC_PATH_LIBGUILIB], [ AC_MSG_CHECKING(for GUI library in the build tree) dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.." dnl look for the library diff --git a/config/acx.m4 b/config/acx.m4 new file mode 100644 index 0000000000000..96b7c8a5caddb --- /dev/null +++ b/config/acx.m4 @@ -0,0 +1,157 @@ +# Autoconf M4 include file defining utility macros for complex Canadian +# cross builds. + +dnl #### +dnl # _GCC_TOPLEV_NONCANONICAL_BUILD +dnl # $build_alias or canonical $build if blank. +dnl # Used when we would use $build_alias, but empty is not OK. +AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_BUILD], +[AC_REQUIRE([AC_CANONICAL_BUILD]) []dnl +case ${build_alias} in + "") build_noncanonical=${build} ;; + *) build_noncanonical=${build_alias} ;; +esac +]) []dnl # _GCC_TOPLEV_NONCANONICAL_BUILD + +dnl #### +dnl # _GCC_TOPLEV_NONCANONICAL_HOST +dnl # $host_alias, or $build_noncanonical if blank. +dnl # Used when we would use $host_alias, but empty is not OK. +AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_HOST], +[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl +case ${host_alias} in + "") host_noncanonical=${build_noncanonical} ;; + *) host_noncanonical=${host_alias} ;; +esac +]) []dnl # _GCC_TOPLEV_NONCANONICAL_HOST + +dnl #### +dnl # _GCC_TOPLEV_NONCANONICAL_TARGET +dnl # $target_alias or $host_noncanonical if blank. +dnl # Used when we would use $target_alias, but empty is not OK. +AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_TARGET], +[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_HOST]) []dnl +case ${target_alias} in + "") target_noncanonical=${host_noncanonical} ;; + *) target_noncanonical=${target_alias} ;; +esac +]) []dnl # _GCC_TOPLEV_NONCANONICAL_TARGET + +dnl #### +dnl # GCC_TOPLEV_SUBDIRS +dnl # GCC & friends build 'build', 'host', and 'target' tools. These must +dnl # be separated into three well-known subdirectories of the build directory: +dnl # build_subdir, host_subdir, and target_subdir. The values are determined +dnl # here so that they can (theoretically) be changed in the future. They +dnl # were previously reproduced across many different files. +dnl # +dnl # This logic really amounts to very little with autoconf 2.13; it will +dnl # amount to a lot more with autoconf 2.5x. +AC_DEFUN([GCC_TOPLEV_SUBDIRS], +[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []dnl +AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl +# Prefix 'build-' so this never conflicts with target_subdir. +build_subdir="build-${build_noncanonical}" +# Not really a subdirectory, but here for completeness. +host_subdir=. +# No prefix. +target_subdir=${target_noncanonical} +AC_SUBST([build_subdir]) []dnl +AC_SUBST([host_subdir]) []dnl +AC_SUBST([target_subdir]) []dnl +]) []dnl # GCC_TOPLEV_SUBDIRS + + +#### +# _NCN_TOOL_PREFIXES: Some stuff that oughtta be done in AC_CANONICAL_SYSTEM +# or AC_INIT. +# These demand that AC_CANONICAL_SYSTEM be called beforehand. +AC_DEFUN([_NCN_TOOL_PREFIXES], +[ncn_tool_prefix= +test -n "$host_alias" && ncn_tool_prefix=$host_alias- +ncn_target_tool_prefix= +test -n "$target_alias" && ncn_target_tool_prefix=$target_alias- +]) []dnl # _NCN_TOOL_PREFIXES + +#### +# NCN_CHECK_TARGET_TOOL(variable, prog-to-check-for,[value-if-not-found],[path]) +# Like AC_CHECK_TOOL, but tries a prefix of the target, not the host. +# Code is pretty much lifted from autoconf2.53. + +AC_DEFUN([NCN_CHECK_TARGET_TOOL], +[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl +if test -n "$ncn_target_tool_prefix"; then + AC_CHECK_PROG([$1], [${ncn_target_tool_prefix}$2], + [${ncn_target_tool_prefix}$2], , [$4]) +fi +if test -z "$ac_cv_prog_$1" ; then + ncn_cv_$1=$$1 + AC_CHECK_PROG([ncn_cv_$1], [$2], [$2], [$3], [$4]) + $1=$ncn_cv_$1 +else + $1="$ac_cv_prog_$1" +fi +]) []dnl # NCN_CHECK_TARGET_TOOL + + +#### +# NCN_STRICT_CHECK_TOOL(variable, prog-to-check-for,[value-if-not-found],[path]) +# Like AC_CHECK_TOOL, but requires the prefix if build!=host. + +AC_DEFUN([NCN_STRICT_CHECK_TOOL], +[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl +if test -n "$ncn_tool_prefix"; then + AC_CHECK_PROG([$1], [${ncn_tool_prefix}$2], + [${ncn_tool_prefix}$2], , [$4]) +fi +if test -z "$ac_cv_prog_$1" ; then + if test $build = $host ; then + ncn_cv_$1=$$1 + AC_CHECK_PROG([ncn_cv_$1], [$2], [$2], [ifelse([$3],[],[$2],[$3])], [$4]) + $1=$ncn_cv_$1 + else + $1="ifelse([$3],[],[${ncn_tool_prefix}$2],[$3])" + fi +else + $1="$ac_cv_prog_$1" +fi +]) []dnl # NCN_STRICT_CHECK_TOOL + + +#### +# NCN_STRICT_CHECK_TARGET_TOOL(variable, prog-to-check-for,[value-if-not-found],[path]) +# Like NCN_CHECK_TARGET_TOOL, but requires the prefix if build!=target. + +AC_DEFUN([NCN_STRICT_CHECK_TARGET_TOOL], +[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl +if test -n "$ncn_target_tool_prefix"; then + AC_CHECK_PROG([$1], [${ncn_target_tool_prefix}$2], + [${ncn_target_tool_prefix}$2], , [$4]) +fi +if test -z "$ac_cv_prog_$1" ; then + if test $build = $target ; then + ncn_cv_$1=$$1 + AC_CHECK_PROG([ncn_cv_$1], [$2], [$2], [ifelse([$3],[],[$2],[$3])], [$4]) + $1=$ncn_cv_$1 + else + $1="ifelse([$3],[],[${ncn_target_tool_prefix}$2],[$3])" + fi +else + $1="$ac_cv_prog_$1" +fi +]) []dnl # NCN_STRICT_CHECK_TARGET_TOOL + +### +# AC_PROG_CPP_WERROR +# Used for autoconf 2.5x to force AC_PREPROC_IFELSE to reject code which +# triggers warnings from the preprocessor. Will be in autoconf 2.58. +# For now, using this also overrides header checks to use only the +# preprocessor (matches 2.13 behavior; matching 2.58's behavior is a +# bit harder from here). +# Eventually autoconf will default to checking headers with the compiler +# instead, and we'll have to do this differently. + +AC_DEFUN([AC_PROG_CPP_WERROR], +[AC_REQUIRE([AC_PROG_CPP])dnl +m4_define([AC_CHECK_HEADER],m4_defn([_AC_CHECK_HEADER_OLD])) +ac_c_preproc_warn_flag=yes])# AC_PROG_CPP_WERROR diff --git a/config/gettext.m4 b/config/gettext.m4 new file mode 100644 index 0000000000000..d10aae80b6b27 --- /dev/null +++ b/config/gettext.m4 @@ -0,0 +1,66 @@ +# intl sister-directory configuration rules. +# + +# The idea behind this macro is that there's no need to repeat all the +# autoconf probes done by the intl directory - it's already done them +# for us. In fact, there's no need even to look at the cache for the +# answers. All we need to do is nab a few pieces of information. +# The intl directory is set up to make this easy, by generating a +# small file which can be sourced as a shell script; then we produce +# the necessary substitutions and definitions for this directory. + +AC_DEFUN([ZW_GNU_GETTEXT_SISTER_DIR], +[# If we haven't got the data from the intl directory, +# assume NLS is disabled. +USE_NLS=no AC_SUBST(USE_NLS) +LIBINTL= AC_SUBST(LIBINTL) +LIBINTL_DEP= AC_SUBST(LIBINTL_DEP) +INCINTL= AC_SUBST(INCINTL) +XGETTEXT= AC_SUBST(XGETTEXT) +GMSGFMT= AC_SUBST(GMSGFMT) +POSUB= AC_SUBST(POSUB) +if test -f ../intl/config.intl; then + . ../intl/config.intl +fi +AC_MSG_CHECKING([whether NLS is requested]) +if test x"$USE_NLS" != xyes; then + AC_MSG_RESULT(no) +else + AC_MSG_RESULT(yes) + AC_DEFINE(ENABLE_NLS, 1, + [Define to 1 if translation of program messages to the + user's native language is requested.]) + + AC_MSG_CHECKING(for catalogs to be installed) + # Look for .po and .gmo files in the source directory. + CATALOGS= AC_SUBST(CATALOGS) + XLINGUAS= + for cat in $srcdir/po/*.gmo $srcdir/po/*.po; do + # If there aren't any .gmo files the shell will give us the + # literal string "../path/to/srcdir/po/*.gmo" which has to be + # weeded out. + case "$cat" in *\**) + continue;; + esac + # The quadruple backslash is collapsed to a double backslash + # by the backticks, then collapsed again by the double quotes, + # leaving us with one backslash in the sed expression (right + # before the dot that mustn't act as a wildcard). + cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!.gmo!"` + lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\.gmo!!"` + # The user is allowed to set LINGUAS to a list of languages to + # install catalogs for. If it's empty that means "all of them." + if test "x$LINGUAS" = x; then + CATALOGS="$CATALOGS $cat" + XLINGUAS="$XLINGUAS $lang" + else + case "$LINGUAS" in *$lang*) + CATALOGS="$CATALOGS $cat" + XLINGUAS="$XLINGUAS $lang" + ;; + esac + fi + done + LINGUAS="$XLINGUAS" + AC_MSG_RESULT($LINGUAS) +fi]) diff --git a/config/mh-cxux b/config/mh-cxux index 0a98f113bafb2..8680654fff818 100644 --- a/config/mh-cxux +++ b/config/mh-cxux @@ -1,7 +1,5 @@ # Configuration for Harris CX/UX 7 (and maybe 6), based on sysv4 configuration. -RANLIB = true - # The l flag generates a warning from the SVR4 archiver, remove it. AR_FLAGS = cq diff --git a/config/mh-cygwin b/config/mh-cygwin new file mode 100644 index 0000000000000..6c3ab8034d6f2 --- /dev/null +++ b/config/mh-cygwin @@ -0,0 +1,6 @@ +EXTRA_TARGET_HOST_ALL_MODULES=maybe-all-libtermcap +EXTRA_TARGET_HOST_INSTALL_MODULES=maybe-install-libtermcap + +all-gdb: maybe-all-libtermcap + +install-gdb: maybe-all-libtermcap diff --git a/config/mh-dgux386 b/config/mh-dgux386 new file mode 100644 index 0000000000000..b2d2a057b4c9b --- /dev/null +++ b/config/mh-dgux386 @@ -0,0 +1,5 @@ +# The l flag generates a warning from the SVR4 archiver, remove it. +AR_FLAGS = cr + +X11_EXTRA_LIBS = -lnsl + diff --git a/config/mh-djgpp b/config/mh-djgpp new file mode 100644 index 0000000000000..88d250a73da22 --- /dev/null +++ b/config/mh-djgpp @@ -0,0 +1,14 @@ +# Shorten the target alias so when it is used to set 'libsubdir' +# the name will work in both short and long filename environments. +ifeq ($(findstring -pc-msdosdjgpp,$(target_alias)),-pc-msdosdjgpp) +target_alias=djgpp +endif + +# The version string must be modified to contain just one dot +# because DOS filenames can only have one dot when long filenames +# are not available. +__version:=$(gcc_version) +__version:=$(subst ., ,$(__version)) +ifeq ($(words $(__version)),3) +gcc_version=$(word 1,$(__version)).$(word 2,$(__version))$(word 3,$(__version)) +endif diff --git a/config/mh-i370pic b/config/mh-i370pic new file mode 100644 index 0000000000000..35cf2c8ee4e34 --- /dev/null +++ b/config/mh-i370pic @@ -0,0 +1 @@ +PICFLAG=-fPIC diff --git a/config/mh-interix b/config/mh-interix new file mode 100644 index 0000000000000..67dff5c44326d --- /dev/null +++ b/config/mh-interix @@ -0,0 +1,7 @@ +# The shell may not be in /bin. +SHELL = sh + +# We also need to override LIBGCC2_DEBUG_CFLAGS so libgcc2 will be +# built without debugging information + +LIBGCC2_DEBUG_CFLAGS= diff --git a/config/mh-lynxrs6k b/config/mh-lynxrs6k new file mode 100644 index 0000000000000..fac1b973a6018 --- /dev/null +++ b/config/mh-lynxrs6k @@ -0,0 +1,2 @@ +# /bin/sh is too buggy, so use /bin/bash instead. +SHELL = /bin/bash diff --git a/config/mh-m68kpic b/config/mh-m68kpic new file mode 100644 index 0000000000000..92e48d90fbdf3 --- /dev/null +++ b/config/mh-m68kpic @@ -0,0 +1 @@ +PICFLAG=-fpic diff --git a/config/mh-ncr3000 b/config/mh-ncr3000 new file mode 100644 index 0000000000000..7c6ee12739b99 --- /dev/null +++ b/config/mh-ncr3000 @@ -0,0 +1,4 @@ +# Host configuration file for an NCR 3000 (i486/SVR4) system. + +# The l flag generates a warning from the SVR4 archiver, remove it. +AR_FLAGS = cq diff --git a/config/mh-necv4 b/config/mh-necv4 index 6845f3caa2003..d71805e052aa7 100644 --- a/config/mh-necv4 +++ b/config/mh-necv4 @@ -1,6 +1,4 @@ # Host Makefile fragment for NEC MIPS SVR4. -RANLIB = true - # NEC -lX11 needs some other libraries. X11_EXTRA_LIBS = -lsocket -lnsl diff --git a/config/mh-openedition b/config/mh-openedition deleted file mode 100644 index 40030020773ac..0000000000000 --- a/config/mh-openedition +++ /dev/null @@ -1 +0,0 @@ -RANLIB = true diff --git a/config/mh-sco b/config/mh-sco index 574b92aa71d7d..bf5a807b0e71b 100644 --- a/config/mh-sco +++ b/config/mh-sco @@ -1,4 +1,3 @@ -RANLIB = true # You may need this if you don't have bison. # BISON = yacc -Sm10400 diff --git a/config/mh-solaris b/config/mh-solaris index 16553c5f3cd9b..6e8f296a4ea2f 100644 --- a/config/mh-solaris +++ b/config/mh-solaris @@ -1,5 +1,2 @@ # Makefile changes for Suns running Solaris 2 - -RANLIB = true - X11_EXTRA_LIBS = -lnsl -lsocket diff --git a/config/mh-sysv b/config/mh-sysv deleted file mode 100644 index 40030020773ac..0000000000000 --- a/config/mh-sysv +++ /dev/null @@ -1 +0,0 @@ -RANLIB = true diff --git a/config/mh-sysv4 b/config/mh-sysv4 index 3634950d75cbb..2e9374c7f96ad 100644 --- a/config/mh-sysv4 +++ b/config/mh-sysv4 @@ -1,5 +1,3 @@ -RANLIB = true - # The l flag generates a warning from the SVR4 archiver, remove it. AR_FLAGS = cr diff --git a/config/mh-sysv5 b/config/mh-sysv5 index 3634950d75cbb..2e9374c7f96ad 100644 --- a/config/mh-sysv5 +++ b/config/mh-sysv5 @@ -1,5 +1,3 @@ -RANLIB = true - # The l flag generates a warning from the SVR4 archiver, remove it. AR_FLAGS = cr diff --git a/config/mt-armpic b/config/mt-armpic deleted file mode 100644 index 35b8c9e4dc232..0000000000000 --- a/config/mt-armpic +++ /dev/null @@ -1 +0,0 @@ -PICFLAG_FOR_TARGET=-fPIC diff --git a/config/mt-d30v b/config/mt-d30v new file mode 100644 index 0000000000000..d34b774b3f689 --- /dev/null +++ b/config/mt-d30v @@ -0,0 +1,4 @@ +# Build libraries optimizing for space, not speed. +# Turn off warnings about symbols named the same as registers + CFLAGS_FOR_TARGET = -g -Os -Wa,-C + CXXFLAGS_FOR_TARGET = -g -Os -Wa,-C diff --git a/config/mt-elfalphapic b/config/mt-elfalphapic deleted file mode 100644 index 35b8c9e4dc232..0000000000000 --- a/config/mt-elfalphapic +++ /dev/null @@ -1 +0,0 @@ -PICFLAG_FOR_TARGET=-fPIC diff --git a/config/mt-ia64pic b/config/mt-ia64pic deleted file mode 100644 index ff98727557570..0000000000000 --- a/config/mt-ia64pic +++ /dev/null @@ -1 +0,0 @@ -PICFLAG_FOR_TARGET=-fpic diff --git a/config/mt-netware b/config/mt-netware new file mode 100644 index 0000000000000..9482f9b36d244 --- /dev/null +++ b/config/mt-netware @@ -0,0 +1 @@ +GDB_NLM_DEPS = all-gcc all-ld diff --git a/config/mt-papic b/config/mt-papic deleted file mode 100644 index 35b8c9e4dc232..0000000000000 --- a/config/mt-papic +++ /dev/null @@ -1 +0,0 @@ -PICFLAG_FOR_TARGET=-fPIC diff --git a/config/mt-ppcpic b/config/mt-ppcpic deleted file mode 100644 index 35b8c9e4dc232..0000000000000 --- a/config/mt-ppcpic +++ /dev/null @@ -1 +0,0 @@ -PICFLAG_FOR_TARGET=-fPIC diff --git a/config/mt-s390pic b/config/mt-s390pic deleted file mode 100644 index ff98727557570..0000000000000 --- a/config/mt-s390pic +++ /dev/null @@ -1 +0,0 @@ -PICFLAG_FOR_TARGET=-fpic diff --git a/config/mt-sparcpic b/config/mt-sparcpic deleted file mode 100644 index a62b38bd9c1bc..0000000000000 --- a/config/mt-sparcpic +++ /dev/null @@ -1 +0,0 @@ -PICFLAG_FOR_TARGET=`case '${LIBCFLAGS} ${LIBCXXFLAGS}' in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac` diff --git a/config/mt-v810 b/config/mt-v810 index 97da6c2659211..f5714f89e8a44 100644 --- a/config/mt-v810 +++ b/config/mt-v810 @@ -1,4 +1,3 @@ CC_FOR_TARGET = ca732 -ansi AS_FOR_TARGET = as732 AR_FOR_TARGET = ar732 -RANLIB_FOR_TARGET = true diff --git a/config/mt-wince b/config/mt-wince new file mode 100644 index 0000000000000..cc7d67b588982 --- /dev/null +++ b/config/mt-wince @@ -0,0 +1,10 @@ +# For Windows CE, we need to build the program that converts, copies, +# and renames the platform SDK files into gcc directories. + +EXTRA_TARGET_HOST_ALL_MODULES:=$(EXTRA_TARGET_HOST_ALL_MODULES) all-utils +EXTRA_TARGET_HOST_INSTALL_MODULES:=$(EXTRA_TARGET_HOST_INSTALL_MODULES) install-utils + +all-utils : all-libiberty + +install-utils : all-libiberty + diff --git a/config/mt-x86pic b/config/mt-x86pic deleted file mode 100644 index ff98727557570..0000000000000 --- a/config/mt-x86pic +++ /dev/null @@ -1 +0,0 @@ -PICFLAG_FOR_TARGET=-fpic diff --git a/config/no-executables.m4 b/config/no-executables.m4 new file mode 100644 index 0000000000000..ca26b7112c6fc --- /dev/null +++ b/config/no-executables.m4 @@ -0,0 +1,61 @@ +# GCC_NO_EXECUTABLES +# ----------------- +# FIXME: The GCC team has specific needs which the current Autoconf +# framework cannot solve elegantly. This macro implements a dirty +# hack until Autoconf is able to provide the services its users +# need. +# +# Several of the support libraries that are often built with GCC can't +# assume the tool-chain is already capable of linking a program: the +# compiler often expects to be able to link with some of such +# libraries. +# +# In several of these libraries, workarounds have been introduced to +# avoid the AC_PROG_CC_WORKS test, that would just abort their +# configuration. The introduction of AC_EXEEXT, enabled either by +# libtool or by CVS autoconf, have just made matters worse. +# +# Unlike the previous AC_NO_EXECUTABLES, this test does not +# disable link tests at autoconf time, but at configure time. +# This allows AC_NO_EXECUTABLES to be invoked conditionally. +AC_DEFUN_ONCE([GCC_NO_EXECUTABLES], +[m4_divert_push([KILL]) + +AC_BEFORE([$0], [_AC_COMPILER_EXEEXT]) +AC_BEFORE([$0], [AC_LINK_IFELSE]) + +m4_define([_AC_COMPILER_EXEEXT], +AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) +# FIXME: Cleanup? +AS_IF([AC_TRY_EVAL(ac_link)], [gcc_no_link=no], [gcc_no_link=yes]) +if test x$gcc_no_link = xyes; then + # Setting cross_compile will disable run tests; it will + # also disable AC_CHECK_FILE but that's generally + # correct if we can't link. + cross_compiling=yes + EXEEXT= +else + m4_defn([_AC_COMPILER_EXEEXT])dnl +fi +) + +m4_define([AC_LINK_IFELSE], +if test x$gcc_no_link = xyes; then + AC_MSG_ERROR([Link tests are not allowed after [[$0]].]) +fi +m4_defn([AC_LINK_IFELSE])) + +dnl This is a shame. We have to provide a default for some link tests, +dnl similar to the default for run tests. +m4_define([AC_FUNC_MMAP], +if test x$gcc_no_link = xyes; then + if test "x${ac_cv_func_mmap_fixed_mapped+set}" != xset; then + ac_cv_func_mmap_fixed_mapped=no + fi +fi +if test "x${ac_cv_func_mmap_fixed_mapped+set}" != xset; then + m4_defn([AC_FUNC_MMAP]) +fi) + +m4_divert_pop()dnl +])# GCC_NO_EXECUTABLES diff --git a/config/progtest.m4 b/config/progtest.m4 new file mode 100644 index 0000000000000..8fe527ceceb92 --- /dev/null +++ b/config/progtest.m4 @@ -0,0 +1,91 @@ +# progtest.m4 serial 3 (gettext-0.12) +dnl Copyright (C) 1996-2003 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 +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 , 1996. + +# 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], +[ +# 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_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 + 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 + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) diff --git a/cpu/ChangeLog b/cpu/ChangeLog new file mode 100644 index 0000000000000..00a4a1f102474 --- /dev/null +++ b/cpu/ChangeLog @@ -0,0 +1,173 @@ +2004-01-14 Richard Sandiford + + * frv.cpu (UNIT): Add IACC. + (iacc-multiply-r-r): Use it. + * frv.opc (fr400_unit_mapping): Add entry for IACC. + (fr500_unit_mapping, fr550_unit_mapping): Likewise. + +2004-01-06 Alexandre Oliva + + 2003-12-19 Alexandre Oliva + * frv.opc (parse_ulo16, parse_uhi16, parse_d12): Fix some + cut&paste errors in shifting/truncating numerical operands. + 2003-08-08 Alexandre Oliva + * frv.opc (parse_ulo16): Parse gotofflo and gotofffuncdesclo. + (parse_uslo16): Likewise. + (parse_uhi16): Parse gotoffhi and gotofffuncdeschi. + (parse_d12): Parse gotoff12 and gotofffuncdesc12. + (parse_s12): Likewise. + 2003-08-04 Alexandre Oliva + * frv.opc (parse_ulo16): Parse gotlo and gotfuncdesclo. + (parse_uslo16): Likewise. + (parse_uhi16): Parse gothi and gotfuncdeschi. + (parse_d12): Parse got12 and gotfuncdesc12. + (parse_s12): Likewise. + +2003-10-10 Dave Brolley + + * frv.cpu (dnpmop): New p-macro. + (GRdoublek): Use dnpmop. + (CPRdoublek, FRdoublei, FRdoublej, FRdoublek): Ditto. + (store-double-r-r): Use (.sym regtype doublek). + (r-store-double): Ditto. + (store-double-r-r-u): Ditto. + (conditional-store-double): Ditto. + (conditional-store-double-u): Ditto. + (store-double-r-simm): Ditto. + (fmovs): Assign to UNIT FMALL. + +2003-10-06 Dave Brolley + + * frv.cpu, frv.opc: Add support for fr550. + +2003-09-24 Dave Brolley + + * frv.cpu (u-commit): New modelling unit for fr500. + (mwtaccg): Use frv_ref_SI to reference ACC40Sk as an input operand. + (commit-r): Use u-commit model for fr500. + (commit): Ditto. + (conditional-float-binary-op): Take profiling data as an argument. + Update callers. + (ne-float-binary-op): Ditto. + +2003-09-19 Michael Snyder + + * frv.cpu (nldqi): Delete unimplemented instruction. + +2003-09-12 Dave Brolley + + * frv.cpu (u-clrgr, u-clrfr): New units of model fr500. + (clear-ne-flag-r): Pass insn profiling in as an argument. Call + frv_ref_SI to get input register referenced for profiling. + (clear-ne-flag-all): Pass insn profiling in as an argument. + (clrgr,clrfr,clrga,clrfa): Add profiling information. + +2003-09-11 Michael Snyder + + * frv.cpu: Typographical corrections. + +2003-09-09 Dave Brolley + + * frv.cpu (media-dual-complex): Change UNIT to FMALL. + (conditional-media-dual-complex, media-quad-complex): Likewise. + +2003-09-04 Dave Brolley + + * frv.cpu (register-transfer): Pass in all attributes in on argument. + Update all callers. + (conditional-register-transfer): Ditto. + (cache-preload): Ditto. + (floating-point-conversion): Ditto. + (floating-point-neg): Ditto. + (float-abs): Ditto. + (float-binary-op-s): Ditto. + (conditional-float-binary-op): Ditto. + (ne-float-binary-op): Ditto. + (float-dual-arith): Ditto. + (ne-float-dual-arith): Ditto. + +2003-09-03 Dave Brolley + + * frv.opc (parse_A, parse_A0, parse_A1): New parse handlers. + * frv.cpu (UNIT): Add IALL, FMALL, FMLOW, STORE, SCAN, DCPL, MDUALACC, + MCLRACC-1. + (A): Removed operand. + (A0,A1): New operands replace operand A. + (mnop): Now a real insn + (mclracc): Removed insn. + (mclracc-0, mclracc-1): New insns replace mclracc. + (all insns): Use new UNIT attributes. + +2003-08-21 Nick Clifton + + * frv.cpu (mbtoh): Replace input parameter to u-media-dual-expand + and u-media-dual-btoh with output parameter. + (cmbtoh): Add profiling hack. + +2003-08-19 Michael Snyder + + * frv.cpu: Fix typo, Frintkeven -> FRintkeven + +2003-06-10 Doug Evans + + * frv.cpu: Add IDOC attribute. + +2003-06-06 Andrew Cagney + + Contributed by Red Hat. + * iq2000.cpu: New file. Written by Ben Elliston, Jeff Johnston, + Stan Cox, and Frank Ch. Eigler. + * iq2000.opc: New file. Written by Ben Elliston, Frank + Ch. Eigler, Chris Moller, Jeff Johnston, and Stan Cox. + * iq2000m.cpu: New file. Written by Jeff Johnston. + * iq10.cpu: New file. Written by Jeff Johnston. + +2003-06-05 Nick Clifton + + * frv.cpu (FRintieven): New operand. An even-numbered only + version of the FRinti operand. + (FRintjeven): Likewise for FRintj. + (FRintkeven): Likewise for FRintk. + (mdcutssi, media-dual-word-rotate-r-r, mqsaths, + media-quad-arith-sat-semantics, media-quad-arith-sat, + conditional-media-quad-arith-sat, mdunpackh, + media-quad-multiply-semantics, media-quad-multiply, + conditional-media-quad-multiply, media-quad-complex-i, + media-quad-multiply-acc-semantics, media-quad-multiply-acc, + conditional-media-quad-multiply-acc, munpackh, + media-quad-multiply-cross-acc-semantics, mdpackh, + media-quad-multiply-cross-acc, mbtoh-semantics, + media-quad-cross-multiply-cross-acc-semantics, + media-quad-cross-multiply-cross-acc, mbtoh, mhtob-semantics, + media-quad-cross-multiply-acc-semantics, cmbtoh, + media-quad-cross-multiply-acc, media-quad-complex, mhtob, + media-expand-halfword-to-double-semantics, mexpdhd, cmexpdhd, + cmhtob): Use new operands. + * frv.opc (CGEN_VERBOSE_ASSEMBLER_ERRORS): Define. + (parse_even_register): New function. + +2003-06-03 Nick Clifton + + * frv.cpu (media-dual-word-rotate-r-r): Use a signed 6-bit + immediate value not unsigned. + +2003-06-03 Andrew Cagney + + Contributed by Red Hat. + * frv.cpu: New file. Written by Dave Brolley, Catherine Moore, + and Eric Christopher. + * frv.opc: New file. Written by Catherine Moore, and Dave + Brolley. + * simplify.inc: New file. Written by Doug Evans. + +2003-05-02 Andrew Cagney + + * New file. + + +Local Variables: +mode: change-log +left-margin: 8 +fill-column: 74 +version-control: never +End: diff --git a/cpu/frv.cpu b/cpu/frv.cpu new file mode 100644 index 0000000000000..28e783383870d --- /dev/null +++ b/cpu/frv.cpu @@ -0,0 +1,8895 @@ +; Fujitsu FRV opcode support, for GNU Binutils. -*- Scheme -*- +; +; Copyright 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +; +; Contributed by Red Hat Inc; developed under contract from Fujitsu. +; +; This file is part of the GNU Binutils. +; +; This program is free software; 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. + +(include "simplify.inc") + +; define-arch must appear first + +(define-arch + (name frv) ; name of cpu architecture + (comment "Fujitsu FRV") + (insn-lsb0? #t) + (machs frv fr550 fr500 fr400 tomcat simple) + (isas frv) +) + +(define-isa + (name frv) + (base-insn-bitsize 32) + ; Initial bitnumbers to decode insns by. + (decode-assist (24 23 22 21 20 19 18)) + (liw-insns 1) ; The frv fetches up to 1 insns at a time. + (parallel-insns 8) ; The frv executes up to 8 insns at a time. +) + +; Cpu family definitions. +; +(define-cpu + ; cpu names must be distinct from the architecture name and machine names. + ; The "b" suffix stands for "base" and is the convention. + ; The "f" suffix stands for "family" and is the convention. + (name frvbf) + (comment "Fujitsu FRV base family") + (endian big) + (word-bitsize 32) +) + +; Generic FR-V machine. Supports the entire architecture +(define-mach + (name frv) + (comment "Generic FRV cpu") + (cpu frvbf) +) +(define-model + (name frv) (comment "Generic FRV model") (attrs) + (mach frv) + + (pipeline all "" () ((fetch) (decode) (execute) (writeback))) + + ; `state' is a list of variables for recording model state + ; (state) + + (unit u-exec "Execution Unit" () + 1 1 ; issue done + () ; state + () ; inputs + () ; outputs + () ; profile action (default) + ) +) + +; FR550 machine +(define-mach + (name fr550) + (comment "FR550 cpu") + (cpu frvbf) +) +(define-model + (name fr550) (comment "FR550 model") (attrs) + (mach fr550) + + (pipeline all "" () ((fetch) (decode) (execute) (writeback))) + + ; `state' is a list of variables for recording model state + (state + ; State items + ; These are all masks with each bit representing one register. + (prev-fr-load DI) ; Previous use of FR register was target of a load + (prev-fr-complex-1 DI) ; Previous use of FR register has variable latency + (prev-fr-complex-2 DI) ; Previous use of FR register has variable latency + (prev-ccr-complex DI) ; Previous use of CCR register has variable latency + (prev-acc-mmac DI) ; Previous use of ACC register was a MMAC category + (cur-fr-load DI) ; Current use of FR register was target of a load + (cur-fr-complex-1 DI) ; Current use of FR register has variable latency + (cur-fr-complex-2 DI) ; Current use of FR register has variable latency + (cur-ccr-complex SI) ; Current use of CCR register has variable latency + (cur-acc-mmac DI) ; Current use of ACC register was a MMAC category + ) + ; Basic unit for instructions with no latency penalties + (unit u-exec "Execution Unit" () + 1 1 ; issue done + () ; state + () ; inputs + () ; outputs + () ; profile action (default) + ) + ; Basic integer insn unit + (unit u-integer "Integer Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRk INT -1) (ICCi_1 INT -1)) ; outputs + () ; profile action (default) + ) + ; Integer multiplication unit + (unit u-imul "Integer Multiplication Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRdoublek INT -1) (ICCi_1 INT -1)) ; outputs + () ; profile action (default) + ) + ; Integer division unit + (unit u-idiv "Integer Division Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRk INT -1) (ICCi_1 INT -1)) ; outputs + () ; profile action (default) + ) + ; Branch unit + (unit u-branch "Branch Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) + (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs + ((pc)) ; outputs + () ; profile action (default) + ) + ; Trap unit + (unit u-trap "Trap Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) + (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Condition code check unit + (unit u-check "Check Unit" () + 1 1 ; issue done + () ; state + ((ICCi_3 INT -1) (FCCi_3 INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Float Arithmetic unit + (unit u-float-arith "Float Arithmetic unit" () + 1 1 ; issue done + () ; state + ((FRi INT -1) (FRj INT -1) ; inputs + (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs + ((FRk INT -1) (FRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; Float Dual Arithmetic unit + (unit u-float-dual-arith "Float Arithmetic unit" () + ; This unit has a 2 cycle penalty -- see table 14-14 in the fr550 LSI + 1 3 ; issue done + () ; state + ((FRi INT -1) (FRj INT -1) ; inputs + (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs + ((FRk INT -1) (FRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; Float Div unit + (unit u-float-div "Float Div unit" () + 1 1 ; issue done + () ; state + ((FRi INT -1) (FRj INT -1)) ; inputs + ((FRk INT -1)) ; outputs + () ; profile action (default) + ) + ; Float Square Root unit + (unit u-float-sqrt "Float Square Root unit" () + 1 1 ; issue done + () ; state + ((FRj INT -1) (FRdoublej INT -1)) ; inputs + ((FRk INT -1) (FRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; Float Compare unit + (unit u-float-compare "Float Compare unit" () + 1 1 ; issue done + () ; state + ((FRi INT -1) (FRj INT -1) + (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs + ((FCCi_2 INT -1)) ; outputs + () ; profile action (default) + ) + ; Dual Float Compare unit + (unit u-float-dual-compare "Float Dual Compare unit" () + ; This unit has a 2 cycle penalty -- see table 14-14 in the fr550 LSI + 1 3 ; issue done + () ; state + ((FRi INT -1) (FRj INT -1)) ; inputs + ((FCCi_2 INT -1)) ; outputs + () ; profile action (default) + ) + ; FR Move to GR unit + (unit u-fr2gr "FR Move to GR Unit" () + 1 1 ; issue done + () ; state + ((FRintk INT -1)) ; inputs + ((GRj INT -1)) ; outputs + () ; profile action (default) + ) + ; GR Move to FR unit + (unit u-gr2fr "GR Move to FR Unit" () + 1 1 ; issue done + () ; state + ((GRj INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; SPR Move to GR unit + (unit u-spr2gr "SPR Move to GR Unit" () + 1 1 ; issue done + () ; state + ((spr INT -1)) ; inputs + ((GRj INT -1)) ; outputs + () ; profile action (default) + ) + ; GR Move to SPR unit + (unit u-gr2spr "GR Move to SPR Unit" () + 1 1 ; issue done + () ; state + ((GRj INT -1)) ; inputs + ((spr INT -1)) ; outputs + () ; profile action (default) + ) + ; GR set half unit + (unit u-set-hilo "GR Set Half" () + 1 1 ; issue done + () ; state + () ; inputs + ((GRkhi INT -1) (GRklo INT -1)) ; outputs + () ; profile action (default) + ) + ; GR load unit + (unit u-gr-load "GR Load Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRk INT -1) (GRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; GR store unit + (unit u-gr-store "GR Store Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) (GRk INT -1) (GRdoublek INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; FR load unit + (unit u-fr-load "FR Load Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((FRintk INT -1) (FRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; FR store unit + (unit u-fr-store "FR Store Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Swap unit + (unit u-swap "Swap Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRk INT -1)) ; outputs + () ; profile action (default) + ) + ; FR Move to FR unit + (unit u-fr2fr "FR Move to FR Unit" () + 1 1 ; issue done + () ; state + ((FRi INT -1)) ; inputs + ((FRk INT -1)) ; outputs + () ; profile action (default) + ) + ; Clrgr unit + (unit u-clrgr "Clrgr Unit" () + 1 1 ; issue done + () ; state + ((GRk INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Clrfr unit + (unit u-clrfr "Clrfr Unit" () + 1 1 ; issue done + () ; state + ((FRk INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Insn cache invalidate unit + (unit u-ici "Insn cache invalidate unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Data cache invalidate unit + (unit u-dci "Data cache invalidate unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Data cache flush unit + (unit u-dcf "Data cache flush unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Insn cache preload unit + (unit u-icpl "Insn cache preload unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Data cache preload unit + (unit u-dcpl "Data cache preload unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Insn cache unlock unit + (unit u-icul "Insn cache unlock unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Data cache unlock unit + (unit u-dcul "Data cache unlock unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; commit unit + (unit u-commit "Commit Unit" () + 1 1 ; issue done + () ; state + ((GRk INT -1) (FRk INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Float Conversion unit + (unit u-float-convert "Float Conversion unit" () + 1 1 ; issue done + () ; state + ((FRj INT -1) (FRintj INT -1) (FRdoublej INT -1)) ; inputs + ((FRk INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; Media units + (unit u-media "Media unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-quad "Media-quad unit" () + 1 1 ; issue done + () ; state + ((FRintieven INT -1) (FRintjeven INT -1)) ; inputs + ((FRintkeven INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-dual-expand "Media Dual Expand unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1)) ; inputs + ((FRintkeven INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-3-dual "Media-3-dual unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-3-acc "Media unit for M-3 using ACC" () + 1 1 ; issue done + () ; state + ((FRintj INT -1) (ACC40Si INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-3-acc-dual "Media-3-acc-dual unit" () + 1 1 ; issue done + () ; state + ((ACC40Si INT -1)) ; inputs + ((FRintkeven INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-3-wtacc "Media-3-wtacc unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (ACC40Sk INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + (unit u-media-3-mclracc "Media-3-mclracc unit" () + 1 1 ; issue done + () ; state + () ; inputs + () ; outputs + () ; profile action (default) + ) + (unit u-media-set "Media set" () + 1 1 ; issue done + () ; state + () ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-4 "Media-4 unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1)) ; inputs + ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-4-acc "Media-4-acc unit" () + 1 1 ; issue done + () ; state + ((ACC40Si INT -1)) ; inputs + ((ACC40Sk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-4-acc-dual "Media-4-acc-dual unit" () + 1 1 ; issue done + () ; state + ((ACC40Si INT -1)) ; inputs + ((ACC40Sk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-4-add-sub "Media-4-add-sub unit" () + 1 1 ; issue done + () ; state + ((ACC40Si INT -1)) ; inputs + ((ACC40Sk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-4-add-sub-dual "Media-4-add-sub-dual unit" () + 1 1 ; issue done + () ; state + ((ACC40Si INT -1)) ; inputs + ((ACC40Sk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-4-quad "Media-4-quad unit" () + 1 1 ; issue done + () ; state + ((FRintieven INT -1) (FRintjeven INT -1)) ; inputs + ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs + () ; profile action (default) + ) +) + +; FR500 machine. +(define-mach + (name fr500) + (comment "FR500 cpu") + (cpu frvbf) +) +(define-model + (name fr500) (comment "FR500 model") (attrs) + (mach fr500) + + (pipeline all "" () ((fetch) (decode) (execute) (writeback))) + + ; `state' is a list of variables for recording model state + (state + ; State items + ; These are all masks with each bit representing one register. + (prev-fpop DI) ; Previous use of FR register was floating point insn + (prev-media DI) ; Previous use of FR register was a media insn + (prev-cc-complex DI) ; Previous use of ICC register was not simple + (cur-fpop DI) ; Current use of FR register was floating point insn + (cur-media DI) ; Current use of FR register was a media insn + (cur-cc-complex DI) ; Current use of ICC register was not simple + ) + ; Basic unit for instructions with no latency penalties + (unit u-exec "Execution Unit" () + 1 1 ; issue done + () ; state + () ; inputs + () ; outputs + () ; profile action (default) + ) + ; Basic integer insn unit + (unit u-integer "Integer Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRk INT -1) (ICCi_1 INT -1)) ; outputs + () ; profile action (default) + ) + ; Integer multiplication unit + (unit u-imul "Integer Multiplication Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRdoublek INT -1) (ICCi_1 INT -1)) ; outputs + () ; profile action (default) + ) + ; Integer division unit + (unit u-idiv "Integer Division Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRk INT -1) (ICCi_1 INT -1)) ; outputs + () ; profile action (default) + ) + ; Branch unit + (unit u-branch "Branch Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) + (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs + ((pc)) ; outputs + () ; profile action (default) + ) + ; Trap unit + (unit u-trap "Trap Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) + (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Condition code check unit + (unit u-check "Check Unit" () + 1 1 ; issue done + () ; state + ((ICCi_3 INT -1) (FCCi_3 INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Clrgr unit + (unit u-clrgr "Clrgr Unit" () + 1 1 ; issue done + () ; state + ((GRk INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Clrfr unit + (unit u-clrfr "Clrfr Unit" () + 1 1 ; issue done + () ; state + ((FRk INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; GR set half unit + (unit u-set-hilo "GR Set Half" () + 1 1 ; issue done + () ; state + () ; inputs + ((GRkhi INT -1) (GRklo INT -1)) ; outputs + () ; profile action (default) + ) + ; GR load unit -- TODO doesn't handle quad + (unit u-gr-load "GR Load Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRk INT -1) (GRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; GR store unit -- TODO doesn't handle quad + (unit u-gr-store "GR Store Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) (GRk INT -1) (GRdoublek INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; GR recovering store unit -- TODO doesn't handle quad + (unit u-gr-r-store "GR Recovering Store Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) (GRk INT -1) (GRdoublek INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; FR load unit -- TODO doesn't handle quad + (unit u-fr-load "FR Load Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((FRintk INT -1) (FRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; FR store unit -- TODO doesn't handle quad + (unit u-fr-store "FR Store Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; FR recovering store unit -- TODO doesn't handle quad + (unit u-fr-r-store "FR Recovering Store Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Swap unit + (unit u-swap "Swap Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRk INT -1)) ; outputs + () ; profile action (default) + ) + ; FR Move to FR unit + (unit u-fr2fr "FR Move to FR Unit" () + 1 1 ; issue done + () ; state + ((FRi INT -1)) ; inputs + ((FRk INT -1)) ; outputs + () ; profile action (default) + ) + ; FR Move to GR unit + (unit u-fr2gr "FR Move to GR Unit" () + 1 1 ; issue done + () ; state + ((FRintk INT -1)) ; inputs + ((GRj INT -1)) ; outputs + () ; profile action (default) + ) + ; SPR Move to GR unit + (unit u-spr2gr "SPR Move to GR Unit" () + 1 1 ; issue done + () ; state + ((spr INT -1)) ; inputs + ((GRj INT -1)) ; outputs + () ; profile action (default) + ) + ; GR Move to FR unit + (unit u-gr2fr "GR Move to FR Unit" () + 1 1 ; issue done + () ; state + ((GRj INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; GR Move to SPR unit + (unit u-gr2spr "GR Move to SPR Unit" () + 1 1 ; issue done + () ; state + ((GRj INT -1)) ; inputs + ((spr INT -1)) ; outputs + () ; profile action (default) + ) + ; Float Arithmetic unit + (unit u-float-arith "Float Arithmetic unit" () + 1 1 ; issue done + () ; state + ((FRi INT -1) (FRj INT -1) ; inputs + (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs + ((FRk INT -1) (FRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; Float Dual Arithmetic unit + (unit u-float-dual-arith "Float Arithmetic unit" () + 1 1 ; issue done + () ; state + ((FRi INT -1) (FRj INT -1) ; inputs + (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs + ((FRk INT -1) (FRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; Float Div unit + (unit u-float-div "Float Div unit" () + 1 1 ; issue done + () ; state + ((FRi INT -1) (FRj INT -1)) ; inputs + ((FRk INT -1)) ; outputs + () ; profile action (default) + ) + ; Float Square Root unit + (unit u-float-sqrt "Float Square Root unit" () + 1 1 ; issue done + () ; state + ((FRj INT -1) (FRdoublej INT -1)) ; inputs + ((FRk INT -1) (FRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; Float Dual Square Root unit + (unit u-float-dual-sqrt "Float Dual Square Root unit" () + 1 1 ; issue done + () ; state + ((FRj INT -1)) ; inputs + ((FRk INT -1)) ; outputs + () ; profile action (default) + ) + ; Float Compare unit + (unit u-float-compare "Float Compare unit" () + 1 1 ; issue done + () ; state + ((FRi INT -1) (FRj INT -1) + (FRdoublei INT -1) (FRdoublej INT -1)) ; inputs + ((FCCi_2 INT -1)) ; outputs + () ; profile action (default) + ) + ; Dual Float Compare unit + (unit u-float-dual-compare "Float Dual Compare unit" () + 1 1 ; issue done + () ; state + ((FRi INT -1) (FRj INT -1)) ; inputs + ((FCCi_2 INT -1)) ; outputs + () ; profile action (default) + ) + ; Float Conversion unit + (unit u-float-convert "Float Conversion unit" () + 1 1 ; issue done + () ; state + ((FRj INT -1) (FRintj INT -1) (FRdoublej INT -1)) ; inputs + ((FRk INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; Dual Float Conversion unit + (unit u-float-dual-convert "Float Dual Conversion unit" () + 1 1 ; issue done + () ; state + ((FRj INT -1) (FRintj INT -1)) ; inputs + ((FRk INT -1) (FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media unit + (unit u-media "Media unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1) (ACC40Si INT -1) (ACCGi INT -1)) ; inputs + ((FRintk INT -1) (ACC40Sk INT -1) (ACC40Uk INT -1) (ACCGk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media Quad Arithmetic unit + (unit u-media-quad-arith "Media Quad Arithmetic unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media Dual Multiplication unit + (unit u-media-dual-mul "Media Dual Multiplication unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1)) ; inputs + ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media Quad Multiplication unit + (unit u-media-quad-mul "Media Quad Multiplication unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1)) ; inputs + ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media Quad Complex unit + (unit u-media-quad-complex "Media Quad Complex unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1)) ; inputs + ((ACC40Sk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media Dual Expand unit + (unit u-media-dual-expand "Media Dual Expand unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media Dual Unpack unit + (unit u-media-dual-unpack "Media Dual Unpack unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media Dual byte to half unit + (unit u-media-dual-btoh "Media Byte to byte" () + 1 1 ; issue done + () ; state + ((FRintj INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media Dual half to byte unit + (unit u-media-dual-htob "Media Half to byte" () + 1 1 ; issue done + () ; state + ((FRintj INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media Dual byte to half unit extended + (unit u-media-dual-btohe "Media Byte to byte extended" () + 1 1 ; issue done + () ; state + ((FRintj INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; Barrier unit + (unit u-barrier "Barrier unit" () + 1 1 ; issue done + () ; state + () ; inputs + () ; outputs + () ; profile action (default) + ) + ; Memory Barrier unit + (unit u-membar "Memory Barrier unit" () + 1 1 ; issue done + () ; state + () ; inputs + () ; outputs + () ; profile action (default) + ) + ; Insn cache invalidate unit + (unit u-ici "Insn cache invalidate unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Data cache invalidate unit + (unit u-dci "Data cache invalidate unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Data cache flush unit + (unit u-dcf "Data cache flush unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Insn cache preload unit + (unit u-icpl "Insn cache preload unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Data cache preload unit + (unit u-dcpl "Data cache preload unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Insn cache unlock unit + (unit u-icul "Insn cache unlock unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Data cache unlock unit + (unit u-dcul "Data cache unlock unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; commit unit + (unit u-commit "Commit Unit" () + 1 1 ; issue done + () ; state + ((GRk INT -1) (FRk INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) +) + +; Tomcat machine. Early version of fr500 machine +(define-mach + (name tomcat) + (comment "Tomcat -- early version of fr500") + (cpu frvbf) +) +(define-model + (name tomcat) (comment "Tomcat model") (attrs) + (mach tomcat) + + (pipeline all "" () ((fetch) (decode) (execute) (writeback))) + + ; `state' is a list of variables for recording model state + ; (state) + + (unit u-exec "Execution Unit" () + 1 1 ; issue done + () ; state + () ; inputs + () ; outputs + () ; profile action (default) + ) +) + +; FR400 machine +(define-mach + (name fr400) + (comment "FR400 cpu") + (cpu frvbf) +) +(define-model + (name fr400) (comment "FR400 model") (attrs) + (mach fr400) + (pipeline all "" () ((fetch) (decode) (execute) (writeback))) + ; `state' is a list of variables for recording model state + (state + ; State items + ; These are all masks with each bit representing one register. + (prev-fp-load DI) ; Previous use of FR register was floating point load + (prev-fr-p4 DI) ; Previous use of FR register was media unit 4 + (prev-fr-p6 DI) ; Previous use of FR register was media unit 6 + (prev-acc-p2 DI) ; Previous use of ACC register was media unit 2 + (prev-acc-p4 DI) ; Previous use of ACC register was media unit 4 + (cur-fp-load DI) ; Current use of FR register is floating point load + (cur-fr-p4 DI) ; Current use of FR register is media unit 4 + (cur-fr-p6 DI) ; Current use of FR register is media unit 6 + (cur-acc-p2 DI) ; Current use of ACC register is media unit 2 + (cur-acc-p4 DI) ; Current use of ACC register is media unit 4 + ) + (unit u-exec "Execution Unit" () + 1 1 ; issue done + () ; state + () ; inputs + () ; outputs + () ; profile action (default) + ) + ; Basic integer insn unit + (unit u-integer "Integer Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRk INT -1) (ICCi_1 INT -1)) ; outputs + () ; profile action (default) + ) + ; Integer multiplication unit + (unit u-imul "Integer Multiplication Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRdoublek INT -1) (ICCi_1 INT -1)) ; outputs + () ; profile action (default) + ) + ; Integer division unit + (unit u-idiv "Integer Division Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRk INT -1) (ICCi_1 INT -1)) ; outputs + () ; profile action (default) + ) + ; Branch unit + (unit u-branch "Branch Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) + (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs + ((pc)) ; outputs + () ; profile action (default) + ) + ; Trap unit + (unit u-trap "Trap Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) + (ICCi_2 INT -1) (FCCi_2 INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Condition code check unit + (unit u-check "Check Unit" () + 1 1 ; issue done + () ; state + ((ICCi_3 INT -1) (FCCi_3 INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; GR set half unit + (unit u-set-hilo "GR Set Half" () + 1 1 ; issue done + () ; state + () ; inputs + ((GRkhi INT -1) (GRklo INT -1)) ; outputs + () ; profile action (default) + ) + ; GR load unit -- TODO doesn't handle quad + (unit u-gr-load "GR Load Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRk INT -1) (GRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; GR store unit -- TODO doesn't handle quad + (unit u-gr-store "GR Store Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) (GRk INT -1) (GRdoublek INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; FR load unit -- TODO doesn't handle quad + (unit u-fr-load "FR Load Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((FRintk INT -1) (FRdoublek INT -1)) ; outputs + () ; profile action (default) + ) + ; FR store unit -- TODO doesn't handle quad + (unit u-fr-store "FR Store Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1) (FRintk INT -1) (FRdoublek INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Swap unit + (unit u-swap "Swap Unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + ((GRk INT -1)) ; outputs + () ; profile action (default) + ) + ; FR Move to GR unit + (unit u-fr2gr "FR Move to GR Unit" () + 1 1 ; issue done + () ; state + ((FRintk INT -1)) ; inputs + ((GRj INT -1)) ; outputs + () ; profile action (default) + ) + ; SPR Move to GR unit + (unit u-spr2gr "SPR Move to GR Unit" () + 1 1 ; issue done + () ; state + ((spr INT -1)) ; inputs + ((GRj INT -1)) ; outputs + () ; profile action (default) + ) + ; GR Move to FR unit + (unit u-gr2fr "GR Move to FR Unit" () + 1 1 ; issue done + () ; state + ((GRj INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; GR Move to SPR unit + (unit u-gr2spr "GR Move to SPR Unit" () + 1 1 ; issue done + () ; state + ((GRj INT -1)) ; inputs + ((spr INT -1)) ; outputs + () ; profile action (default) + ) + ; Media unit M1 -- see table 13-8 in the fr400 LSI + (unit u-media-1 "Media-1 unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-1-quad "Media-1-quad unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-hilo "Media-hilo unit -- a variation of the Media-1 unit" () + 1 1 ; issue done + () ; state + () ; inputs + ((FRkhi INT -1) (FRklo INT -1)) ; outputs + () ; profile action (default) + ) + ; Media unit M2 -- see table 13-8 in the fr400 LSI + (unit u-media-2 "Media-2 unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1)) ; inputs + ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-2-quad "Media-2-quad unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1)) ; inputs + ((ACC40Sk INT -1) (ACC40Uk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-2-acc "Media-2-acc unit" () + 1 1 ; issue done + () ; state + ((ACC40Si INT -1)) ; inputs + ((ACC40Sk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-2-acc-dual "Media-2-acc-dual unit" () + 1 1 ; issue done + () ; state + ((ACC40Si INT -1)) ; inputs + ((ACC40Sk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-2-add-sub "Media-2-add-sub unit" () + 1 1 ; issue done + () ; state + ((ACC40Si INT -1)) ; inputs + ((ACC40Sk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-2-add-sub-dual "Media-2-add-sub-dual unit" () + 1 1 ; issue done + () ; state + ((ACC40Si INT -1)) ; inputs + ((ACC40Sk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media unit M3 -- see table 13-8 in the fr400 LSI + (unit u-media-3 "Media-3 unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-3-dual "Media-3-dual unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-3-quad "Media-3-quad unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media unit M4 -- see table 13-8 in the fr400 LSI + (unit u-media-4 "Media-4 unit" () + 1 1 ; issue done + () ; state + ((ACC40Si INT -1) (FRintj INT -1)) ; inputs + ((ACC40Sk INT -1) (FRintk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-4-accg "Media-4-accg unit" () + 1 1 ; issue done + () ; state + ((ACCGi INT -1) (FRinti INT -1)) ; inputs + ((ACCGk INT -1) (FRintk INT -1)) ; outputs + () ; profile action (default) + ) + (unit u-media-4-acc-dual "Media-4-acc-dual unit" () + 1 1 ; issue done + () ; state + ((ACC40Si INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media unit M6 -- see table 13-8 in the fr400 LSI + (unit u-media-6 "Media-6 unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media unit M7 -- see table 13-8 in the fr400 LSI + (unit u-media-7 "Media-1 unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1) (FRintj INT -1)) ; inputs + ((FCCk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media Dual Expand unit + (unit u-media-dual-expand "Media Dual Expand unit" () + 1 1 ; issue done + () ; state + ((FRinti INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; Media Dual half to byte unit + (unit u-media-dual-htob "Media Half to byte" () + 1 1 ; issue done + () ; state + ((FRintj INT -1)) ; inputs + ((FRintk INT -1)) ; outputs + () ; profile action (default) + ) + ; Barrier unit + (unit u-barrier "Barrier unit" () + 1 1 ; issue done + () ; state + () ; inputs + () ; outputs + () ; profile action (default) + ) + ; Memory Barrier unit + (unit u-membar "Memory Barrier unit" () + 1 1 ; issue done + () ; state + () ; inputs + () ; outputs + () ; profile action (default) + ) + ; Insn cache invalidate unit + (unit u-ici "Insn cache invalidate unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Data cache invalidate unit + (unit u-dci "Data cache invalidate unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Data cache flush unit + (unit u-dcf "Data cache flush unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Insn cache preload unit + (unit u-icpl "Insn cache preload unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Data cache preload unit + (unit u-dcpl "Data cache preload unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Insn cache unlock unit + (unit u-icul "Insn cache unlock unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) + ; Data cache unlock unit + (unit u-dcul "Data cache unlock unit" () + 1 1 ; issue done + () ; state + ((GRi INT -1) (GRj INT -1)) ; inputs + () ; outputs + () ; profile action (default) + ) +) + +; Simple machine - single issue integer machine +(define-mach + (name simple) + (comment "Simple single issue integer cpu") + (cpu frvbf) +) +(define-model + (name simple) (comment "Simple model") (attrs) + (mach simple) + (pipeline all "" () ((fetch) (decode) (execute) (writeback))) + ; `state' is a list of variables for recording model state + (state) + (unit u-exec "Execution Unit" () + 1 1 ; issue done + () ; state + () ; inputs + () ; outputs + () ; profile action (default) + ) +) + +; The instruction fetch/execute cycle. +; +; This is how to fetch and decode an instruction. +; Leave it out for now + +; (define-extract (const SI 0)) + +; This is how to execute a decoded instruction. +; Leave it out for now + +; (define-execute (const SI 0)) + +; An attribute to describe which unit an insn runs in. +(define-attr + (for insn) + (type enum) + (name UNIT) + (comment "parallel execution pipeline selection") + ; The order of declaration is significant. + ; See the *_unit_mapping tables in frv.opc + ; Keep variations on the same unit together. + ; Keep the '01' variant immediately after the '1' variant in each unit. + ; Keep the 'ALL' variations immediately after the last numbered variant in each unit. + (values NIL + I0 I1 I01 I2 I3 IALL + FM0 FM1 FM01 FM2 FM3 FMALL FMLOW + B0 B1 B01 + C + MULT-DIV ; multiply/division slotted differently on different machines + IACC ; iacc multiply slotted differently on different machines + LOAD ; loads slotted differently on different machines + STORE ; store slotted differently on different machines + SCAN ; scan, scani slotted differently on different machines + DCPL ; dcpl slotted differently on different machines + MDUALACC ; media dual acc slotted differently on different machines + MCLRACC-1; mclracc A==1 slotted differently on different machines + NUM_UNITS + ) +) +; Attributes to describe major categories of insns +(define-attr + (for insn) + (type enum) + (name FR400-MAJOR) + (comment "fr400 major insn categories") + ; The order of declaration is significant. Keep variations on the same major + ; together. + (values NONE + I-1 I-2 I-3 I-4 I-5 + B-1 B-2 B-3 B-4 B-5 B-6 + C-1 C-2 + M-1 M-2 + ) +) +(define-attr + (for insn) + (type enum) + (name FR500-MAJOR) + (comment "fr500 major insn categories") + ; The order of declaration is significant. Keep variations on the same major + ; together. + (values NONE + I-1 I-2 I-3 I-4 I-5 I-6 + B-1 B-2 B-3 B-4 B-5 B-6 + C-1 C-2 + F-1 F-2 F-3 F-4 F-5 F-6 F-7 F-8 + M-1 M-2 M-3 M-4 M-5 M-6 M-7 M-8 + ) +) +(define-attr + (for insn) + (type enum) + (name FR550-MAJOR) + (comment "fr550 major insn categories") + ; The order of declaration is significant. Keep variations on the same major + ; together. + (values NONE + I-1 I-2 I-3 I-4 I-5 I-6 I-7 I-8 + B-1 B-2 B-3 B-4 B-5 B-6 + C-1 C-2 + F-1 F-2 F-3 F-4 + M-1 M-2 M-3 M-4 M-5 + ) +) +; Privileged insn +(define-attr + (for insn) + (type boolean) + (name PRIVILEGED) + (comment "insn only allowed in supervisor mode") +) +; Non-Excepting insn +(define-attr + (for insn) + (type boolean) + (name NON-EXCEPTING) + (comment "non-excepting insn") +) +; Conditional insn +(define-attr + (for insn) + (type boolean) + (name CONDITIONAL) + (comment "conditional insn") +) +; insn accesses FR registers +(define-attr + (for insn) + (type boolean) + (name FR-ACCESS) + (comment "insn accesses FR registers") +) +; insn preserves MSR.OVF +(define-attr + (for insn) + (type boolean) + (name PRESERVE-OVF) + (comment "Preserve value of MSR.OVF") +) +; null attribute -- used as a place holder for where an attribue is required. +(define-attr + (for insn) + (type boolean) + (name NA) + (comment "placeholder attribute") + (attrs META) ; do not define in any generated file for now +) + +; IDOC attribute for instruction documentation. + +(define-attr + (for insn) + (type enum) + (name IDOC) + (comment "insn kind for documentation") + (attrs META) + (values + (MEM - () "Memory") + (ALU - () "ALU") + (FPU - () "FPU") + (BR - () "Branch") + (PRIV - () "Priviledged") + (MISC - () "Miscellaneous") + ) +) + +; Instruction fields. +; +; Attributes: +; PCREL-ADDR: pc relative value (for reloc and disassembly purposes) +; ABS-ADDR: absolute address (for reloc and disassembly purposes?) +; RESERVED: bits are not used to decode insn, must be all 0 +(dnf f-pack "packing bit" () 31 1) +(dnf f-op "primary opcode" () 24 7) +(dnf f-ope1 "extended opcode" () 11 6) +(dnf f-ope2 "extended opcode" () 9 4) +(dnf f-ope3 "extended opcode" () 15 3) +(dnf f-ope4 "extended opcode" () 7 2) + +(dnf f-GRi "source register 1" () 17 6) +(dnf f-GRj "source register 2" () 5 6) +(dnf f-GRk "destination register" () 30 6) + +(dnf f-FRi "source register 1" () 17 6) +(dnf f-FRj "source register 2" () 5 6) +(dnf f-FRk "destination register" () 30 6) + +(dnf f-CPRi "source register 1" () 17 6) +(dnf f-CPRj "source register 2" () 5 6) +(dnf f-CPRk "destination register" () 30 6) + +(dnf f-ACCGi "source register" () 17 6) +(dnf f-ACCGk "destination register" () 30 6) + +(dnf f-ACC40Si "40 bit signed accumulator" () 17 6) +(dnf f-ACC40Ui "40 bit unsigned accumulator" () 17 6) +(dnf f-ACC40Sk "40 bit accumulator" () 30 6) +(dnf f-ACC40Uk "40 bit accumulator" () 30 6) + +(dnf f-CRi "source register" () 14 3) +(dnf f-CRj "source register" () 2 3) +(dnf f-CRk "destination register" () 27 3) +(dnf f-CCi "condition register" () 11 3) + +(df f-CRj_int "target cr for ck insns" () 26 2 UINT + ((value pc) (sub WI value 4)) + ((value pc) (add WI value 4)) +) +(dnf f-CRj_float "target cr for fck insns" () 26 2) + +(dnf f-ICCi_1 "condition register" () 11 2) +(dnf f-ICCi_2 "condition register" () 26 2) +(dnf f-ICCi_3 "condition register" () 1 2) +(dnf f-FCCi_1 "condition register" () 11 2) +(dnf f-FCCi_2 "condition register" () 26 2) +(dnf f-FCCi_3 "condition register" () 1 2) +(dnf f-FCCk "condition register" () 26 2) +(dnf f-eir "exception insn register" () 17 6) + +(df f-s10 "10 bit sign extended" () 9 10 INT #f #f) +(df f-s12 "12 bit sign extended" () 11 12 INT #f #f) +(df f-d12 "12 bit sign extended" () 11 12 INT #f #f) +(df f-u16 "16 bit unsigned" () 15 16 UINT #f #f) +(df f-s16 "16 bit sign extended" () 15 16 INT #f #f) +(df f-s6 "6 bit signed" () 5 6 INT #f #f) +(df f-s6_1 "6 bit signed" () 11 6 INT #f #f) +(df f-u6 "6 bit unsigned" () 5 6 UINT #f #f) +(df f-s5 "5 bit signed" () 4 5 INT #f #f) + +(df f-u12-h "upper 6 bits of u12" () 17 6 INT #f #f) +(df f-u12-l "lower 6 bits of u12" () 5 6 UINT #f #f) +(dnmf f-u12 "12 bit signed immediate" () INT + (f-u12-h f-u12-l) + (sequence () ; insert + (set (ifield f-u12-h) (sra SI (ifield f-u12) 6)) + (set (ifield f-u12-l) (and (ifield f-u12) #x3f)) + ) + (sequence () ; extract + (set (ifield f-u12) (or (sll (ifield f-u12-h) 6) + (ifield f-u12-l))) + ) +) + +(dnf f-int-cc "integer branch conditions" () 30 4) +(dnf f-flt-cc "floating branch conditions" () 30 4) +(df f-cond "conditional arithmetic" () 8 1 UINT #f #f) +(df f-ccond "lr branch condition" () 12 1 UINT #f #f) +(df f-hint "2 bit branch prediction hint" () 17 2 UINT #f #f) +(df f-LI "link indicator" () 25 1 UINT #f #f) +(df f-lock "cache lock indicator" () 25 1 UINT #f #f) +(df f-debug "debug mode indicator" () 25 1 UINT #f #f) +(df f-A "all accumulator bit" () 17 1 UINT #f #f) +(df f-ae "cache all entries indicator" () 25 1 UINT #f #f) + +(dnf f-spr-h "upper 6 bits of spr" () 30 6) +(dnf f-spr-l "lower 6 bits of spr" () 17 6) +(dnmf f-spr "special purpose register" () UINT + (f-spr-h f-spr-l) + (sequence () ; insert + (set (ifield f-spr-h) (srl (ifield f-spr) (const 6))) + (set (ifield f-spr-l) (and (ifield f-spr) (const #x3f))) + ) + (sequence () ; extract + (set (ifield f-spr) (or (sll (ifield f-spr-h) (const 6)) + (ifield f-spr-l))) + ) +) + +(df f-label16 "18 bit pc relative signed offset" (PCREL-ADDR) 15 16 INT + ((value pc) (sra WI (sub WI value pc) (const 2))) + ((value pc) (add WI (sll WI value (const 2)) pc)) +) + +(df f-labelH6 "upper 6 bits of label24" () 30 6 INT #f #f) +(dnf f-labelL18 "lower 18 bits of label24" () 17 18) +(dnmf f-label24 "26 bit signed offset" (PCREL-ADDR) INT + (f-labelH6 f-labelL18) + ; insert + (sequence () + (set (ifield f-labelH6) + (sra WI (sub (ifield f-label24) pc) (const 20))) + (set (ifield f-labelL18) + (and (srl (sub (ifield f-label24) pc) (const 2)) + (const #x3ffff))) + ) + ; extract + (sequence () + (set (ifield f-label24) + (add (sll (or (sll (ifield f-labelH6) (const 18)) + (ifield f-labelL18)) + (const 2)) + pc))) +) + +(dnf f-ICCi_1-null "null field" (RESERVED) 11 2) +(dnf f-ICCi_2-null "null field" (RESERVED) 26 2) +(dnf f-ICCi_3-null "null field" (RESERVED) 1 2) +(dnf f-FCCi_1-null "null field" (RESERVED) 11 2) +(dnf f-FCCi_2-null "null field" (RESERVED) 26 2) +(dnf f-FCCi_3-null "null field" (RESERVED) 1 2) +(dnf f-rs-null "null field" (RESERVED) 17 6) +(dnf f-GRi-null "null field" (RESERVED) 17 6) +(dnf f-GRj-null "null field" (RESERVED) 5 6) +(dnf f-GRk-null "null field" (RESERVED) 30 6) +(dnf f-FRi-null "null field" (RESERVED) 17 6) +(dnf f-FRj-null "null field" (RESERVED) 5 6) +(dnf f-ACCj-null "null field" (RESERVED) 5 6) +(dnf f-rd-null "null field" (RESERVED) 30 6) +(dnf f-cond-null "null field" (RESERVED) 30 4) +(dnf f-ccond-null "null field" (RESERVED) 12 1) +(dnf f-s12-null "null field" (RESERVED) 11 12) +(dnf f-label16-null "null field" (RESERVED) 15 16) +(dnf f-misc-null-1 "null field" (RESERVED) 30 5) +(dnf f-misc-null-2 "null field" (RESERVED) 11 6) +(dnf f-misc-null-3 "null field" (RESERVED) 11 4) +(dnf f-misc-null-4 "null field" (RESERVED) 17 2) +(dnf f-misc-null-5 "null field" (RESERVED) 17 16) +(dnf f-misc-null-6 "null field" (RESERVED) 30 3) +(dnf f-misc-null-7 "null field" (RESERVED) 17 3) +(dnf f-misc-null-8 "null field" (RESERVED) 5 3) +(dnf f-misc-null-9 "null field" (RESERVED) 5 4) +(dnf f-misc-null-10 "null field" (RESERVED) 16 5) +(dnf f-misc-null-11 "null field" (RESERVED) 5 1) + +(dnf f-LI-off "null field" (RESERVED) 25 1) +(dnf f-LI-on "null field" (RESERVED) 25 1) + +; Enums. + +; insn-op: +; FIXME: should use die macro or some such +(define-normal-insn-enum insn-op "insn op enums" () OP_ f-op + ( + "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" + "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" + "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F" + "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" + "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "4A" "4B" "4C" "4D" "4E" "4F" + "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "5A" "5B" "5C" "5D" "5E" "5F" + "60" "61" "62" "63" "64" "65" "66" "67" "68" "69" "6A" "6B" "6C" "6D" "6E" "6F" + "70" "71" "72" "73" "74" "75" "76" "77" "78" "79" "7A" "7B" "7C" "7D" "7E" "7F" + ) +) + +(define-normal-insn-enum insn-ope1 "insn ope enums" () OPE1_ f-ope1 + ( + "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" + "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F" + "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F" + "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F" + ) +) + +(define-normal-insn-enum insn-ope2 "insn ope enums" () OPE2_ f-ope2 + ( + "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F" + ) +) + +(define-normal-insn-enum insn-ope3 "insn ope enums" () OPE3_ f-ope3 + ( + "00" "01" "02" "03" "04" "05" "06" "07" + ) +) + +(define-normal-insn-enum insn-ope4 "insn ope enums" () OPE4_ f-ope4 + ( + "0" "1" "2" "3" + ) +) + +; int-cc: integer branch conditions +; FIXME: should use die macro or some such +(define-normal-insn-enum int-cc "integer branch cond enums" () ICC_ f-int-cc + ( + "nev" "c" "v" "lt" "eq" "ls" "n" "le" + "ra" "nc" "nv" "ge" "ne" "hi" "p" "gt" + ) +) + +; flt-cc: floating-point/media branch conditions +; FIXME: should use die macro or some such +(define-normal-insn-enum flt-cc "float branch cond enums" () FCC_ f-flt-cc + ("nev" "u" "gt" "ug" "lt" "ul" "lg" "ne" + "eq" "ue" "ge" "uge" "le" "ule" "o" "ra") +) + +; Hardware pieces. +; These entries list the elements of the raw hardware. +; They're also used to provide tables and other elements of the assembly +; language. +(dnh h-pc "program counter" (PC PROFILE) (pc) () () ()) + +; The PSR. The individual fields are referenced more than the entire +; register, so reference them directly. We can assemble the +; entire register contents when necessary. +; +(dsh h-psr_imple "PSR.IMPLE" () (register UQI)) +(dsh h-psr_ver "PSR.VER" () (register UQI)) +(dsh h-psr_ice "PSR.ICE bit" () (register BI)) +(dsh h-psr_nem "PSR.NEM bit" () (register BI)) +(dsh h-psr_cm "PSR.CM bit" () (register BI)) +(dsh h-psr_be "PSR.BE bit" () (register BI)) +(dsh h-psr_esr "PSR.ESR bit" () (register BI)) +(dsh h-psr_ef "PSR.EF bit" () (register BI)) +(dsh h-psr_em "PSR.EM bit" () (register BI)) +(dsh h-psr_pil "PSR.PIL " () (register UQI)) +(dsh h-psr_ps "PSR.PS bit" () (register BI)) +(dsh h-psr_et "PSR.ET bit" () (register BI)) + +; PSR.S requires special handling because the shadow registers (SR0-SR4) must +; be switched with GR4-GR7 when changing from user to supervisor mode or +; vice-versa. +(define-hardware + (name h-psr_s) + (comment "PSR.S bit") + (attrs) + (type register BI) + (get) + (set (newval) (c-call VOID "@cpu@_h_psr_s_set_handler" newval)) +) + +; The TBR. The individual bits are referenced more than the entire +; register, so reference them directly. We can assemble the +; entire register contents when necessary. +; +(dsh h-tbr_tba "TBR.TBA" () (register UWI)) +(dsh h-tbr_tt "TBR.TT" () (register UQI)) + +; The BPSR. The individual bits are referenced more than the entire +; register, so reference them directly. We can assemble the +; entire register contents when necessary. +; +(dsh h-bpsr_bs "PSR.S bit" () (register BI)) +(dsh h-bpsr_bet "PSR.ET bit" () (register BI)) + +; General registers +; +(define-keyword + (name gr-names) + (print-name h-gr) + (prefix "") + (values + (sp 1) (fp 2) + (gr0 0)(gr1 1)(gr2 2)(gr3 3)(gr4 4)(gr5 5)(gr6 6)(gr7 7) + (gr8 8)(gr9 9)(gr10 10)(gr11 11)(gr12 12)(gr13 13)(gr14 14)(gr15 15) + (gr16 16)(gr17 17)(gr18 18)(gr19 19)(gr20 20)(gr21 21)(gr22 22)(gr23 23) + (gr24 24)(gr25 25)(gr26 26)(gr27 27)(gr28 28)(gr29 29)(gr30 30)(gr31 31) + (gr32 32)(gr33 33)(gr34 34)(gr35 35)(gr36 36)(gr37 37)(gr38 38)(gr39 39) + (gr40 40)(gr41 41)(gr42 42)(gr43 43)(gr44 44)(gr45 45)(gr46 46)(gr47 47) + (gr48 48)(gr49 49)(gr50 50)(gr51 51)(gr52 52)(gr53 53)(gr54 54)(gr55 55) + (gr56 56)(gr57 57)(gr58 58)(gr59 59)(gr60 60)(gr61 61)(gr62 62)(gr63 63) + ) +) + +(define-hardware + (name h-gr) + (comment "general registers") + (attrs PROFILE) + (type register USI (64)) + (indices extern-keyword gr-names) + (get (index) (c-call WI "@cpu@_h_gr_get_handler" index)) + (set (index newval) (c-call VOID "@cpu@_h_gr_set_handler" index newval)) +) + +; General Registers as double words +; These registers are shadowed onto h-gr +(define-hardware + (name h-gr_double) + (comment "general registers as double words") + (attrs PROFILE VIRTUAL) + (type register DI (32)) + ; FIXME: Need constraint to prohibit odd numbers. + (indices extern-keyword gr-names) + (get (index) + (c-call DI "@cpu@_h_gr_double_get_handler" index)) + (set (index newval) + (c-call VOID "@cpu@_h_gr_double_set_handler" index newval)) +) + +; General Registers as high and low half words +; These registers are shadowed onto h-gr +(define-hardware + (name h-gr_hi) + (comment "general registers as high half word") + (attrs PROFILE VIRTUAL) + (type register UHI (64)) + (indices extern-keyword gr-names) + (get (index) (c-call UHI "@cpu@_h_gr_hi_get_handler" index)) + (set (index newval) (c-call VOID "@cpu@_h_gr_hi_set_handler" index newval)) +) +(define-hardware + (name h-gr_lo) + (comment "general registers as low half word") + (attrs PROFILE VIRTUAL) + (type register UHI (64)) + (indices extern-keyword gr-names) + (get (index) (c-call UHI "@cpu@_h_gr_lo_get_handler" index)) + (set (index newval) (c-call VOID "@cpu@_h_gr_lo_set_handler" index newval)) +) + +; Floating Point Registers +(define-keyword + (name fr-names) + (print-name h-fr) + (prefix "") + (values + (fr0 0)(fr1 1)(fr2 2)(fr3 3)(fr4 4)(fr5 5)(fr6 6)(fr7 7) + (fr8 8)(fr9 9)(fr10 10)(fr11 11)(fr12 12)(fr13 13)(fr14 14)(fr15 15) + (fr16 16)(fr17 17)(fr18 18)(fr19 19)(fr20 20)(fr21 21)(fr22 22)(fr23 23) + (fr24 24)(fr25 25)(fr26 26)(fr27 27)(fr28 28)(fr29 29)(fr30 30)(fr31 31) + (fr32 32)(fr33 33)(fr34 34)(fr35 35)(fr36 36)(fr37 37)(fr38 38)(fr39 39) + (fr40 40)(fr41 41)(fr42 42)(fr43 43)(fr44 44)(fr45 45)(fr46 46)(fr47 47) + (fr48 48)(fr49 49)(fr50 50)(fr51 51)(fr52 52)(fr53 53)(fr54 54)(fr55 55) + (fr56 56)(fr57 57)(fr58 58)(fr59 59)(fr60 60)(fr61 61)(fr62 62)(fr63 63) + ) +) + +(define-hardware + (name h-fr) + (comment "floating point registers") + (attrs PROFILE) + (type register SF (64)) + (indices extern-keyword fr-names) + (get (index) (c-call SF "@cpu@_h_fr_get_handler" index)) + (set (index newval) (c-call VOID "@cpu@_h_fr_set_handler" index newval)) +) + +; Floating Point Registers as double precision +; These registers are shadowed onto h-fr + +(define-hardware + (name h-fr_double) + (comment "floating point registers as double precision") + (attrs PROFILE VIRTUAL) + (type register DF (32)) + ; FIXME: Need constraint to prohibit odd numbers. + (indices extern-keyword fr-names) + (get (index) + (c-call DF "@cpu@_h_fr_double_get_handler" index)) + (set (index newval) + (c-call VOID "@cpu@_h_fr_double_set_handler" index newval)) +) + +; Floating Point Registers as integer words. +; These registers are shadowed onto h-fr + +(define-hardware + (name h-fr_int) + (comment "floating point registers as integers") + (attrs PROFILE VIRTUAL) + (type register USI (64)) + (indices extern-keyword fr-names) + (get (index) + (c-call USI "@cpu@_h_fr_int_get_handler" index)) + (set (index newval) + (c-call VOID "@cpu@_h_fr_int_set_handler" index newval)) +) + +; Floating Point Registers as high and low half words +; These registers are shadowed onto h-fr +(define-hardware + (name h-fr_hi) + (comment "floating point registers as unsigned high half word") + (attrs PROFILE VIRTUAL) + (type register UHI (64)) + (indices extern-keyword fr-names) + (get (regno) (srl (reg h-fr_int regno) 16)) + (set (regno newval) (set (reg h-fr_int regno) + (or (and (reg h-fr_int regno) #xffff) + (sll newval 16)))) +) +(define-hardware + (name h-fr_lo) + (comment "floating point registers as unsigned low half word") + (attrs PROFILE VIRTUAL) + (type register UHI (64)) + (indices extern-keyword fr-names) + (get (regno) (and (reg h-fr_int regno) #xffff)) + (set (regno newval) (set (reg h-fr_int regno) + (or (and (reg h-fr_int regno) #xffff0000) + (and newval #xffff)))) +) + +; Floating Point Registers as unsigned bytes +; These registers are shadowed onto h-fr +(define-hardware + (name h-fr_0) + (comment "floating point registers as unsigned byte 0") + (attrs PROFILE VIRTUAL) + (type register UHI (64)) + (indices extern-keyword fr-names) + (get (regno) (and (reg h-fr_int regno) #xff)) + (set (regno newval) + (sequence () + (if (gt USI newval #xff) + (set newval #xff)) + (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #xffffff00) + newval)))) +) +(define-hardware + (name h-fr_1) + (comment "floating point registers as unsigned byte 1") + (attrs PROFILE VIRTUAL) + (type register UHI (64)) + (indices extern-keyword fr-names) + (get (regno) (and (srl (reg h-fr_int regno) 8) #xff)) + (set (regno newval) + (sequence () + (if (gt USI newval #xff) + (set newval #xff)) + (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #xffff00ff) + (sll newval 8))))) +) +(define-hardware + (name h-fr_2) + (comment "floating point registers as unsigned byte 2") + (attrs PROFILE VIRTUAL) + (type register UHI (64)) + (indices extern-keyword fr-names) + (get (regno) (and (srl (reg h-fr_int regno) 16) #xff)) + (set (regno newval) + (sequence () + (if (gt USI newval #xff) + (set newval #xff)) + (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #xff00ffff) + (sll newval 16))))) +) +(define-hardware + (name h-fr_3) + (comment "floating point registers as unsigned byte 3") + (attrs PROFILE VIRTUAL) + (type register UHI (64)) + (indices extern-keyword fr-names) + (get (regno) (and (srl (reg h-fr_int regno) 24) #xff)) + (set (regno newval) + (sequence () + (if (gt USI newval #xff) + (set newval #xff)) + (set (reg h-fr_int regno) (or (and (reg h-fr_int regno) #x00ffffff) + (sll newval 24))))) +) +; Coprocessor Registers +; +(define-keyword + (name cpr-names) + (print-name h-cpr) + (prefix "") + (values +(cpr0 0)(cpr1 1)(cpr2 2)(cpr3 3)(cpr4 4)(cpr5 5)(cpr6 6)(cpr7 7) +(cpr8 8)(cpr9 9)(cpr10 10)(cpr11 11)(cpr12 12)(cpr13 13)(cpr14 14)(cpr15 15) +(cpr16 16)(cpr17 17)(cpr18 18)(cpr19 19)(cpr20 20)(cpr21 21)(cpr22 22)(cpr23 23) +(cpr24 24)(cpr25 25)(cpr26 26)(cpr27 27)(cpr28 28)(cpr29 29)(cpr30 30)(cpr31 31) +(cpr32 32)(cpr33 33)(cpr34 34)(cpr35 35)(cpr36 36)(cpr37 37)(cpr38 38)(cpr39 39) +(cpr40 40)(cpr41 41)(cpr42 42)(cpr43 43)(cpr44 44)(cpr45 45)(cpr46 46)(cpr47 47) +(cpr48 48)(cpr49 49)(cpr50 50)(cpr51 51)(cpr52 52)(cpr53 53)(cpr54 54)(cpr55 55) +(cpr56 56)(cpr57 57)(cpr58 58)(cpr59 59)(cpr60 60)(cpr61 61)(cpr62 62)(cpr63 63) + ) +) + +(define-hardware + (name h-cpr) + (comment "coprocessor registers") + (attrs PROFILE (MACH frv)) + (type register WI (64)) + (indices extern-keyword cpr-names) +) + +; Coprocessor Registers as double words +; These registers are shadowed onto h-cpr +(define-hardware + (name h-cpr_double) + (comment "coprocessor registers as double words") + (attrs PROFILE VIRTUAL (MACH frv)) + (type register DI (32)) + ; FIXME: Need constraint to prohibit odd numbers. + (indices extern-keyword cpr-names) + (get (index) + (c-call DI "@cpu@_h_cpr_double_get_handler" index)) + (set (index newval) + (c-call VOID "@cpu@_h_cpr_double_set_handler" index newval)) +) + +; Special Purpose Registers +; +(define-keyword + (name spr-names) + (print-name h-spr) + (prefix "") + (values + (psr 0) (pcsr 1) (bpcsr 2) (tbr 3) (bpsr 4) + + (hsr0 16) (hsr1 17) (hsr2 18) (hsr3 19) + (hsr4 20) (hsr5 21) (hsr6 22) (hsr7 23) + (hsr8 24) (hsr9 25) (hsr10 26) (hsr11 27) + (hsr12 28) (hsr13 29) (hsr14 30) (hsr15 31) + (hsr16 32) (hsr17 33) (hsr18 34) (hsr19 35) + (hsr20 36) (hsr21 37) (hsr22 38) (hsr23 39) + (hsr24 40) (hsr25 41) (hsr26 42) (hsr27 43) + (hsr28 44) (hsr29 45) (hsr30 46) (hsr31 47) + (hsr32 48) (hsr33 49) (hsr34 50) (hsr35 51) + (hsr36 52) (hsr37 53) (hsr38 54) (hsr39 55) + (hsr40 56) (hsr41 57) (hsr42 58) (hsr43 59) + (hsr44 60) (hsr45 61) (hsr46 62) (hsr47 63) + (hsr48 64) (hsr49 65) (hsr50 66) (hsr51 67) + (hsr52 68) (hsr53 69) (hsr54 70) (hsr55 71) + (hsr56 72) (hsr57 73) (hsr58 74) (hsr59 75) + (hsr60 76) (hsr61 77) (hsr62 78) (hsr63 79) + + (ccr 256) (cccr 263) (lr 272) (lcr 273) (iacc0h 280) (iacc0l 281) (isr 288) + + (neear0 352) (neear1 353) (neear2 354) (neear3 355) + (neear4 356) (neear5 357) (neear6 358) (neear7 359) + (neear8 360) (neear9 361) (neear10 362) (neear11 363) + (neear12 364) (neear13 365) (neear14 366) (neear15 367) + (neear16 368) (neear17 369) (neear18 370) (neear19 371) + (neear20 372) (neear21 373) (neear22 374) (neear23 375) + (neear24 376) (neear25 377) (neear26 378) (neear27 379) + (neear28 380) (neear29 381) (neear30 382) (neear31 383) + + (nesr0 384) (nesr1 385) (nesr2 386) (nesr3 387) + (nesr4 388) (nesr5 389) (nesr6 390) (nesr7 391) + (nesr8 392) (nesr9 393) (nesr10 394) (nesr11 395) + (nesr12 396) (nesr13 397) (nesr14 398) (nesr15 399) + (nesr16 400) (nesr17 401) (nesr18 402) (nesr19 403) + (nesr20 404) (nesr21 405) (nesr22 406) (nesr23 407) + (nesr24 408) (nesr25 409) (nesr26 410) (nesr27 411) + (nesr28 412) (nesr29 413) (nesr30 414) (nesr31 415) + + (necr 416) + + (gner0 432) (gner1 433) + + (fner0 434) (fner1 435) + + (epcr0 512) (epcr1 513) (epcr2 514) (epcr3 515) + (epcr4 516) (epcr5 517) (epcr6 518) (epcr7 519) + (epcr8 520) (epcr9 521) (epcr10 522) (epcr11 523) + (epcr12 524) (epcr13 525) (epcr14 526) (epcr15 527) + (epcr16 528) (epcr17 529) (epcr18 530) (epcr19 531) + (epcr20 532) (epcr21 533) (epcr22 534) (epcr23 535) + (epcr24 536) (epcr25 537) (epcr26 538) (epcr27 539) + (epcr28 540) (epcr29 541) (epcr30 542) (epcr31 543) + (epcr32 544) (epcr33 545) (epcr34 546) (epcr35 547) + (epcr36 548) (epcr37 549) (epcr38 550) (epcr39 551) + (epcr40 552) (epcr41 553) (epcr42 554) (epcr43 555) + (epcr44 556) (epcr45 557) (epcr46 558) (epcr47 559) + (epcr48 560) (epcr49 561) (epcr50 562) (epcr51 563) + (epcr52 564) (epcr53 565) (epcr54 566) (epcr55 567) + (epcr56 568) (epcr57 569) (epcr58 570) (epcr59 571) + (epcr60 572) (epcr61 573) (epcr62 574) (epcr63 575) + + (esr0 576) (esr1 577) (esr2 578) (esr3 579) + (esr4 580) (esr5 581) (esr6 582) (esr7 583) + (esr8 584) (esr9 585) (esr10 586) (esr11 587) + (esr12 588) (esr13 589) (esr14 590) (esr15 591) + (esr16 592) (esr17 593) (esr18 594) (esr19 595) + (esr20 596) (esr21 597) (esr22 598) (esr23 599) + (esr24 600) (esr25 601) (esr26 602) (esr27 603) + (esr28 604) (esr29 605) (esr30 606) (esr31 607) + (esr32 608) (esr33 609) (esr34 610) (esr35 611) + (esr36 612) (esr37 613) (esr38 614) (esr39 615) + (esr40 616) (esr41 617) (esr42 618) (esr43 619) + (esr44 620) (esr45 621) (esr46 622) (esr47 623) + (esr48 624) (esr49 625) (esr50 626) (esr51 627) + (esr52 628) (esr53 629) (esr54 630) (esr55 631) + (esr56 632) (esr57 633) (esr58 634) (esr59 635) + (esr60 636) (esr61 637) (esr62 638) (esr63 639) + + (eir0 640) (eir1 641) (eir2 642) (eir3 643) + (eir4 644) (eir5 645) (eir6 646) (eir7 647) + (eir8 648) (eir9 649) (eir10 650) (eir11 651) + (eir12 652) (eir13 653) (eir14 654) (eir15 655) + (eir16 656) (eir17 657) (eir18 658) (eir19 659) + (eir20 660) (eir21 661) (eir22 662) (eir23 663) + (eir24 664) (eir25 665) (eir26 666) (eir27 667) + (eir28 668) (eir29 669) (eir30 670) (eir31 671) + + (esfr0 672) (esfr1 673) + + (sr0 768) (sr1 769) (sr2 770) (sr3 771) + + (fsr0 1024) (fsr1 1025) (fsr2 1026) (fsr3 1027) + (fsr4 1028) (fsr5 1029) (fsr6 1030) (fsr7 1031) + (fsr8 1032) (fsr9 1033) (fsr10 1034) (fsr11 1035) + (fsr12 1036) (fsr13 1037) (fsr14 1038) (fsr15 1039) + (fsr16 1040) (fsr17 1041) (fsr18 1042) (fsr19 1043) + (fsr20 1044) (fsr21 1045) (fsr22 1046) (fsr23 1047) + (fsr24 1048) (fsr25 1049) (fsr26 1050) (fsr27 1051) + (fsr28 1052) (fsr29 1053) (fsr30 1054) (fsr31 1055) + (fsr32 1056) (fsr33 1057) (fsr34 1058) (fsr35 1059) + (fsr36 1060) (fsr37 1061) (fsr38 1062) (fsr39 1063) + (fsr40 1064) (fsr41 1065) (fsr42 1066) (fsr43 1067) + (fsr44 1068) (fsr45 1069) (fsr46 1070) (fsr47 1071) + (fsr48 1072) (fsr49 1073) (fsr50 1074) (fsr51 1075) + (fsr52 1076) (fsr53 1077) (fsr54 1078) (fsr55 1079) + (fsr56 1080) (fsr57 1081) (fsr58 1082) (fsr59 1083) + (fsr60 1084) (fsr61 1085) (fsr62 1086) (fsr63 1087) + + ; FQ0-FQ31 are 64 bit registers. + ; These names allow access to the upper 32 bits of the FQ registers. + (fqop0 1088) (fqop1 1090) (fqop2 1092) (fqop3 1094) + (fqop4 1096) (fqop5 1098) (fqop6 1100) (fqop7 1102) + (fqop8 1104) (fqop9 1106) (fqop10 1108) (fqop11 1110) + (fqop12 1112) (fqop13 1114) (fqop14 1116) (fqop15 1118) + (fqop16 1120) (fqop17 1122) (fqop18 1124) (fqop19 1126) + (fqop20 1128) (fqop21 1130) (fqop22 1132) (fqop23 1134) + (fqop24 1136) (fqop25 1138) (fqop26 1140) (fqop27 1142) + (fqop28 1144) (fqop29 1146) (fqop30 1148) (fqop31 1150) + ; These names allow access to the lower 32 bits of the FQ registers. + (fqst0 1089) (fqst1 1091) (fqst2 1093) (fqst3 1095) + (fqst4 1097) (fqst5 1099) (fqst6 1101) (fqst7 1103) + (fqst8 1105) (fqst9 1107) (fqst10 1109) (fqst11 1111) + (fqst12 1113) (fqst13 1115) (fqst14 1117) (fqst15 1119) + (fqst16 1121) (fqst17 1123) (fqst18 1125) (fqst19 1127) + (fqst20 1129) (fqst21 1131) (fqst22 1133) (fqst23 1135) + (fqst24 1137) (fqst25 1139) (fqst26 1141) (fqst27 1143) + (fqst28 1145) (fqst29 1147) (fqst30 1149) (fqst31 1151) + ; These also access the lower 32 bits of the FQ registers. + ; These are not accessible as spr registers (see LSI appendix - section 13.4) +; (fq0 1089) (fq1 1091) (fq2 1093) (fq3 1095) +; (fq4 1097) (fq5 1099) (fq6 1101) (fq7 1103) +; (fq8 1105) (fq9 1107) (fq10 1109) (fq11 1111) +; (fq12 1113) (fq13 1115) (fq14 1117) (fq15 1119) +; (fq16 1121) (fq17 1123) (fq18 1125) (fq19 1127) +; (fq20 1129) (fq21 1131) (fq22 1133) (fq23 1135) +; (fq24 1137) (fq25 1139) (fq26 1141) (fq27 1143) +; (fq28 1145) (fq29 1147) (fq30 1149) (fq31 1151) + + (mcilr0 1272) (mcilr1 1273) + + (msr0 1280) (msr1 1281) (msr2 1282) (msr3 1283) + (msr4 1284) (msr5 1285) (msr6 1286) (msr7 1287) + (msr8 1288) (msr9 1289) (msr10 1290) (msr11 1291) + (msr12 1292) (msr13 1293) (msr14 1294) (msr15 1295) + (msr16 1296) (msr17 1297) (msr18 1298) (msr19 1299) + (msr20 1300) (msr21 1301) (msr22 1302) (msr23 1303) + (msr24 1304) (msr25 1305) (msr26 1306) (msr27 1307) + (msr28 1308) (msr29 1309) (msr30 1310) (msr31 1311) + (msr32 1312) (msr33 1313) (msr34 1314) (msr35 1315) + (msr36 1316) (msr37 1317) (msr38 1318) (msr39 1319) + (msr40 1320) (msr41 1321) (msr42 1322) (msr43 1323) + (msr44 1324) (msr45 1325) (msr46 1326) (msr47 1327) + (msr48 1328) (msr49 1329) (msr50 1330) (msr51 1331) + (msr52 1332) (msr53 1333) (msr54 1334) (msr55 1335) + (msr56 1336) (msr57 1337) (msr58 1338) (msr59 1339) + (msr60 1340) (msr61 1341) (msr62 1342) (msr63 1343) + + ; MQ0-MQ31 are 64 bit registers. + ; These names allow access to the upper 32 bits of the MQ registers. + (mqop0 1344) (mqop1 1346) (mqop2 1348) (mqop3 1350) + (mqop4 1352) (mqop5 1354) (mqop6 1356) (mqop7 1358) + (mqop8 1360) (mqop9 1362) (mqop10 1364) (mqop11 1366) + (mqop12 1368) (mqop13 1370) (mqop14 1372) (mqop15 1374) + (mqop16 1376) (mqop17 1378) (mqop18 1380) (mqop19 1382) + (mqop20 1384) (mqop21 1386) (mqop22 1388) (mqop23 1390) + (mqop24 1392) (mqop25 1394) (mqop26 1396) (mqop27 1398) + (mqop28 1400) (mqop29 1402) (mqop30 1404) (mqop31 1406) + ; These names allow access to the lower 32 bits of the MQ registers. + (mqst0 1345) (mqst1 1347) (mqst2 1349) (mqst3 1351) + (mqst4 1353) (mqst5 1355) (mqst6 1357) (mqst7 1359) + (mqst8 1361) (mqst9 1363) (mqst10 1365) (mqst11 1367) + (mqst12 1369) (mqst13 1371) (mqst14 1373) (mqst15 1375) + (mqst16 1377) (mqst17 1379) (mqst18 1381) (mqst19 1383) + (mqst20 1385) (mqst21 1387) (mqst22 1389) (mqst23 1391) + (mqst24 1393) (mqst25 1395) (mqst26 1397) (mqst27 1399) + (mqst28 1401) (mqst29 1403) (mqst30 1405) (mqst31 1407) + ; These also access the lower 32 bits of the MQ registers. + ; These are not accessible as spr registers (see LSI appendix - section 13.4) +; (mq0 1345) (mq1 1347) (mq2 1349) (mq3 1351) +; (mq4 1353) (mq5 1355) (mq6 1357) (mq7 1359) +; (mq8 1361) (mq9 1363) (mq10 1365) (mq11 1367) +; (mq12 1369) (mq13 1371) (mq14 1373) (mq15 1375) +; (mq16 1377) (mq17 1379) (mq18 1381) (mq19 1383) +; (mq20 1385) (mq21 1387) (mq22 1389) (mq23 1391) +; (mq24 1393) (mq25 1395) (mq26 1397) (mq27 1399) +; (mq28 1401) (mq29 1403) (mq30 1405) (mq31 1407) + + ; These are not accessible as spr registers (see LSI appendix - section 13.4) +; (acc0 1408) (acc1 1409) (acc2 1410) (acc3 1411) +; (acc4 1412) (acc5 1413) (acc6 1414) (acc7 1415) +; (acc8 1416) (acc9 1417) (acc10 1418) (acc11 1419) +; (acc12 1420) (acc13 1421) (acc14 1422) (acc15 1423) +; (acc16 1424) (acc17 1425) (acc18 1426) (acc19 1427) +; (acc20 1428) (acc21 1429) (acc22 1430) (acc23 1431) +; (acc24 1432) (acc25 1433) (acc26 1434) (acc27 1435) +; (acc28 1436) (acc29 1437) (acc30 1438) (acc31 1439) +; (acc32 1440) (acc33 1441) (acc34 1442) (acc35 1443) +; (acc36 1444) (acc37 1445) (acc38 1446) (acc39 1447) +; (acc40 1448) (acc41 1449) (acc42 1450) (acc43 1451) +; (acc44 1452) (acc45 1453) (acc46 1454) (acc47 1455) +; (acc48 1456) (acc49 1457) (acc50 1458) (acc51 1459) +; (acc52 1460) (acc53 1461) (acc54 1462) (acc55 1463) +; (acc56 1464) (acc57 1465) (acc58 1466) (acc59 1467) +; (acc60 1468) (acc61 1469) (acc62 1470) (acc63 1471) + +; (accg0 1472) (accg1 1473) (accg2 1474) (accg3 1475) +; (accg4 1476) (accg5 1477) (accg6 1478) (accg7 1479) +; (accg8 1480) (accg9 1481) (accg10 1482) (accg11 1483) +; (accg12 1484) (accg13 1485) (accg14 1486) (accg15 1487) +; (accg16 1488) (accg17 1489) (accg18 1490) (accg19 1491) +; (accg20 1492) (accg21 1493) (accg22 1494) (accg23 1495) +; (accg24 1496) (accg25 1497) (accg26 1498) (accg27 1499) +; (accg28 1500) (accg29 1501) (accg30 1502) (accg31 1503) +; (accg32 1504) (accg33 1505) (accg34 1506) (accg35 1507) +; (accg36 1508) (accg37 1509) (accg38 1510) (accg39 1511) +; (accg40 1512) (accg41 1513) (accg42 1514) (accg43 1515) +; (accg44 1516) (accg45 1517) (accg46 1518) (accg47 1519) +; (accg48 1520) (accg49 1521) (accg50 1522) (accg51 1523) +; (accg52 1524) (accg53 1525) (accg54 1526) (accg55 1527) +; (accg56 1528) (accg57 1529) (accg58 1530) (accg59 1531) +; (accg60 1532) (accg61 1533) (accg62 1534) (accg63 1535) + + (ear0 1536) (ear1 1537) (ear2 1538) (ear3 1539) + (ear4 1540) (ear5 1541) (ear6 1542) (ear7 1543) + (ear8 1544) (ear9 1545) (ear10 1546) (ear11 1547) + (ear12 1548) (ear13 1549) (ear14 1550) (ear15 1551) + (ear16 1552) (ear17 1553) (ear18 1554) (ear19 1555) + (ear20 1556) (ear21 1557) (ear22 1558) (ear23 1559) + (ear24 1560) (ear25 1561) (ear26 1562) (ear27 1563) + (ear28 1564) (ear29 1565) (ear30 1566) (ear31 1567) + (ear32 1568) (ear33 1569) (ear34 1570) (ear35 1571) + (ear36 1572) (ear37 1573) (ear38 1574) (ear39 1575) + (ear40 1576) (ear41 1577) (ear42 1578) (ear43 1579) + (ear44 1580) (ear45 1581) (ear46 1582) (ear47 1583) + (ear48 1584) (ear49 1585) (ear50 1586) (ear51 1587) + (ear52 1588) (ear53 1589) (ear54 1590) (ear55 1591) + (ear56 1592) (ear57 1593) (ear58 1594) (ear59 1595) + (ear60 1596) (ear61 1597) (ear62 1598) (ear63 1599) + + (edr0 1600) (edr1 1601) (edr2 1602) (edr3 1603) + (edr4 1604) (edr5 1605) (edr6 1606) (edr7 1607) + (edr8 1608) (edr9 1609) (edr10 1610) (edr11 1611) + (edr12 1612) (edr13 1613) (edr14 1614) (edr15 1615) + (edr16 1616) (edr17 1617) (edr18 1618) (edr19 1619) + (edr20 1620) (edr21 1621) (edr22 1622) (edr23 1623) + (edr24 1624) (edr25 1625) (edr26 1626) (edr27 1627) + (edr28 1628) (edr29 1629) (edr30 1630) (edr31 1631) + (edr32 1632) (edr33 1636) (edr34 1634) (edr35 1635) + (edr36 1636) (edr37 1637) (edr38 1638) (edr39 1639) + (edr40 1640) (edr41 1641) (edr42 1642) (edr43 1643) + (edr44 1644) (edr45 1645) (edr46 1646) (edr47 1647) + (edr48 1648) (edr49 1649) (edr50 1650) (edr51 1651) + (edr52 1652) (edr53 1653) (edr54 1654) (edr55 1655) + (edr56 1656) (edr57 1657) (edr58 1658) (edr59 1659) + (edr60 1660) (edr61 1661) (edr62 1662) (edr63 1663) + + (iamlr0 1664) (iamlr1 1665) (iamlr2 1666) (iamlr3 1667) + (iamlr4 1668) (iamlr5 1669) (iamlr6 1670) (iamlr7 1671) + (iamlr8 1672) (iamlr9 1673) (iamlr10 1674) (iamlr11 1675) + (iamlr12 1676) (iamlr13 1677) (iamlr14 1678) (iamlr15 1679) + (iamlr16 1680) (iamlr17 1681) (iamlr18 1682) (iamlr19 1683) + (iamlr20 1684) (iamlr21 1685) (iamlr22 1686) (iamlr23 1687) + (iamlr24 1688) (iamlr25 1689) (iamlr26 1690) (iamlr27 1691) + (iamlr28 1692) (iamlr29 1693) (iamlr30 1694) (iamlr31 1695) + (iamlr32 1696) (iamlr33 1697) (iamlr34 1698) (iamlr35 1699) + (iamlr36 1700) (iamlr37 1701) (iamlr38 1702) (iamlr39 1703) + (iamlr40 1704) (iamlr41 1705) (iamlr42 1706) (iamlr43 1707) + (iamlr44 1708) (iamlr45 1709) (iamlr46 1710) (iamlr47 1711) + (iamlr48 1712) (iamlr49 1713) (iamlr50 1714) (iamlr51 1715) + (iamlr52 1716) (iamlr53 1717) (iamlr54 1718) (iamlr55 1719) + (iamlr56 1720) (iamlr57 1721) (iamlr58 1722) (iamlr59 1723) + (iamlr60 1724) (iamlr61 1725) (iamlr62 1726) (iamlr63 1727) + + (iampr0 1728) (iampr1 1729) (iampr2 1730) (iampr3 1731) + (iampr4 1732) (iampr5 1733) (iampr6 1734) (iampr7 1735) + (iampr8 1736) (iampr9 1737) (iampr10 1738) (iampr11 1739) + (iampr12 1740) (iampr13 1741) (iampr14 1742) (iampr15 1743) + (iampr16 1744) (iampr17 1745) (iampr18 1746) (iampr19 1747) + (iampr20 1748) (iampr21 1749) (iampr22 1750) (iampr23 1751) + (iampr24 1752) (iampr25 1753) (iampr26 1754) (iampr27 1755) + (iampr28 1756) (iampr29 1757) (iampr30 1758) (iampr31 1759) + (iampr32 1760) (iampr33 1761) (iampr34 1762) (iampr35 1763) + (iampr36 1764) (iampr37 1765) (iampr38 1766) (iampr39 1767) + (iampr40 1768) (iampr41 1769) (iampr42 1770) (iampr43 1771) + (iampr44 1772) (iampr45 1773) (iampr46 1774) (iampr47 1775) + (iampr48 1776) (iampr49 1777) (iampr50 1778) (iampr51 1779) + (iampr52 1780) (iampr53 1781) (iampr54 1782) (iampr55 1783) + (iampr56 1784) (iampr57 1785) (iampr58 1786) (iampr59 1787) + (iampr60 1788) (iampr61 1789) (iampr62 1790) (iampr63 1791) + + (damlr0 1792) (damlr1 1793) (damlr2 1794) (damlr3 1795) + (damlr4 1796) (damlr5 1797) (damlr6 1798) (damlr7 1799) + (damlr8 1800) (damlr9 1801) (damlr10 1802) (damlr11 1803) + (damlr12 1804) (damlr13 1805) (damlr14 1806) (damlr15 1807) + (damlr16 1808) (damlr17 1809) (damlr18 1810) (damlr19 1811) + (damlr20 1812) (damlr21 1813) (damlr22 1814) (damlr23 1815) + (damlr24 1816) (damlr25 1817) (damlr26 1818) (damlr27 1819) + (damlr28 1820) (damlr29 1821) (damlr30 1822) (damlr31 1823) + (damlr32 1824) (damlr33 1825) (damlr34 1826) (damlr35 1827) + (damlr36 1828) (damlr37 1829) (damlr38 1830) (damlr39 1831) + (damlr40 1832) (damlr41 1833) (damlr42 1834) (damlr43 1835) + (damlr44 1836) (damlr45 1837) (damlr46 1838) (damlr47 1839) + (damlr48 1840) (damlr49 1841) (damlr50 1842) (damlr51 1843) + (damlr52 1844) (damlr53 1845) (damlr54 1846) (damlr55 1847) + (damlr56 1848) (damlr57 1849) (damlr58 1850) (damlr59 1851) + (damlr60 1852) (damlr61 1853) (damlr62 1854) (damlr63 1855) + + (dampr0 1856) (dampr1 1857) (dampr2 1858) (dampr3 1859) + (dampr4 1860) (dampr5 1861) (dampr6 1862) (dampr7 1863) + (dampr8 1864) (dampr9 1865) (dampr10 1866) (dampr11 1867) + (dampr12 1868) (dampr13 1869) (dampr14 1870) (dampr15 1871) + (dampr16 1872) (dampr17 1873) (dampr18 1874) (dampr19 1875) + (dampr20 1876) (dampr21 1877) (dampr22 1878) (dampr23 1879) + (dampr24 1880) (dampr25 1881) (dampr26 1882) (dampr27 1883) + (dampr28 1884) (dampr29 1885) (dampr30 1886) (dampr31 1887) + (dampr32 1888) (dampr33 1889) (dampr34 1890) (dampr35 1891) + (dampr36 1892) (dampr37 1893) (dampr38 1894) (dampr39 1895) + (dampr40 1896) (dampr41 1897) (dampr42 1898) (dampr43 1899) + (dampr44 1900) (dampr45 1901) (dampr46 1902) (dampr47 1903) + (dampr48 1904) (dampr49 1905) (dampr50 1906) (dampr51 1907) + (dampr52 1908) (dampr53 1909) (dampr54 1910) (dampr55 1911) + (dampr56 1912) (dampr57 1913) (dampr58 1914) (dampr59 1915) + (dampr60 1916) (dampr61 1917) (dampr62 1918) (dampr63 1919) + + (amcr 1920) (stbar 1921) (mmcr 1922) + (dcr 2048) (brr 2049) (nmar 2050) + + (ibar0 2052) (ibar1 2053) (ibar2 2054) (ibar3 2055) + (dbar0 2056) (dbar1 2057) (dbar2 2058) (dbar3 2059) + + (dbdr00 2060) (dbdr01 2061) (dbdr02 2062) (dbdr03 2063) + (dbdr10 2064) (dbdr11 2065) (dbdr12 2066) (dbdr13 2067) + (dbdr20 2068) (dbdr21 2069) (dbdr22 2070) (dbdr23 2071) + (dbdr30 2072) (dbdr31 2073) (dbdr32 2074) (dbdr33 2075) + + (dbmr00 2076) (dbmr01 2077) (dbmr02 2078) (dbmr03 2079) + (dbmr10 2080) (dbmr11 2081) (dbmr12 2082) (dbmr13 2083) + (dbmr20 2084) (dbmr21 2085) (dbmr22 2086) (dbmr23 2087) + (dbmr30 2088) (dbmr31 2089) (dbmr32 2090) (dbmr33 2091) + + (cpcfr 2092) (cpcr 2093) (cpsr 2094) + + (cpesr0 2096) (cpesr1 2097) + (cpemr0 2098) (cpemr1 2099) + + (ihsr8 3848) + ) +) + +(define-hardware + (name h-spr) + (comment "special purpose registers") + (attrs PROFILE) + (type register UWI (4096)) + (indices extern-keyword spr-names) + (get (index) (c-call UWI "@cpu@_h_spr_get_handler" index)) + (set (index newval) (c-call VOID "@cpu@_h_spr_set_handler" index newval)) +) + +(define-pmacro (spr-pcsr) (reg h-spr 1)) +(define-pmacro (spr-bpcsr) (reg h-spr 2)) +(define-pmacro (spr-lr) (reg h-spr 272)) +(define-pmacro (spr-lcr) (reg h-spr 273)) +(define-pmacro (spr-iacc0h) (reg h-spr 280)) +(define-pmacro (spr-iacc0l) (reg h-spr 281)) +(define-pmacro (spr-sr0) (reg h-spr 768)) +(define-pmacro (spr-sr1) (reg h-spr 769)) +(define-pmacro (spr-sr2) (reg h-spr 770)) +(define-pmacro (spr-sr3) (reg h-spr 771)) + +; Accumulator guard. Actually a subset of the SPR registers, but those SPRs +; are read-only in most insns. This hardware element is used by those insns +; which have direct access (mwtaccg, mrdaccg). +(define-keyword + (name accg-names) + (print-name h-accg) + (prefix "") + (values + (accg0 0)(accg1 1)(accg2 2)(accg3 3) + (accg4 4)(accg5 5)(accg6 6)(accg7 7) + (accg8 8)(accg9 9)(accg10 10)(accg11 11) + (accg12 12)(accg13 13)(accg14 14)(accg15 15) + (accg16 16)(accg17 17)(accg18 18)(accg19 19) + (accg20 20)(accg21 21)(accg22 22)(accg23 23) + (accg24 24)(accg25 25)(accg26 26)(accg27 27) + (accg28 28)(accg29 29)(accg30 30)(accg31 31) + (accg32 32)(accg33 33)(accg34 34)(accg35 35) + (accg36 36)(accg37 37)(accg38 38)(accg39 39) + (accg40 40)(accg41 41)(accg42 42)(accg43 43) + (accg44 44)(accg45 45)(accg46 46)(accg47 47) + (accg48 48)(accg49 49)(accg50 50)(accg51 51) + (accg52 52)(accg53 53)(accg54 54)(accg55 55) + (accg56 56)(accg57 57)(accg58 58)(accg59 59) + (accg60 60)(accg61 61)(accg62 62)(accg63 63) + ) +) + +(define-hardware + (name h-accg) + (comment "accumulator guard") + (attrs PROFILE VIRTUAL) + (type register UWI (64)) + (indices extern-keyword accg-names) + (get (index) + (and (reg h-spr (add index 1472)) #xff)) + (set (index newval) + (set (raw-reg UWI h-spr (add index 1472)) (and newval #xff))) +) + +; 40 bit accumulator. Composed of ACCG and ACC registers concatenated, but +; referenced more often as the composed 40 bits. +(define-keyword + (name acc-names) + (print-name h-acc40) + (prefix "") + (values +(acc0 0)(acc1 1)(acc2 2)(acc3 3)(acc4 4)(acc5 5)(acc6 6)(acc7 7) +(acc8 8)(acc9 9)(acc10 10)(acc11 11)(acc12 12)(acc13 13)(acc14 14)(acc15 15) +(acc16 16)(acc17 17)(acc18 18)(acc19 19)(acc20 20)(acc21 21)(acc22 22)(acc23 23) +(acc24 24)(acc25 25)(acc26 26)(acc27 27)(acc28 28)(acc29 29)(acc30 30)(acc31 31) +(acc32 32)(acc33 33)(acc34 34)(acc35 35)(acc36 36)(acc37 37)(acc38 38)(acc39 39) +(acc40 40)(acc41 41)(acc42 42)(acc43 43)(acc44 44)(acc45 45)(acc46 46)(acc47 47) +(acc48 48)(acc49 49)(acc50 50)(acc51 51)(acc52 52)(acc53 53)(acc54 54)(acc55 55) +(acc56 56)(acc57 57)(acc58 58)(acc59 59)(acc60 60)(acc61 61)(acc62 62)(acc63 63) + ) +) + +(define-hardware + (name h-acc40S) + (comment "40 bit signed accumulator") + (attrs PROFILE VIRTUAL) + (type register DI (64)) + (indices extern-keyword acc-names) + ; The accumlator is made up of two 32 bit registers, accgi/acci. + ; We want to extract this as a combined 40 signed bits + (get (index) + (or DI + (sll DI (ext DI (trunc QI (reg h-spr (add index 1472)))) + 32) + (zext DI (reg h-spr (add index 1408))))) + ; Bits 40-63 are not written. raw-reg is used to bypass read-only restrictions + ; on ACC and ACCG registers + (set (index newval) + (sequence () + (c-call VOID "frv_check_spr_write_access" (add index 1408)) + (set (raw-reg UWI h-spr + (add index 1472)) (and (srl newval 32) #xff)) + (set (raw-reg UWI h-spr + (add index 1408)) (trunc USI newval)))) +) + +(define-hardware + (name h-acc40U) + (comment "40 bit unsigned accumulator") + (attrs PROFILE VIRTUAL) + (type register UDI (64)) + (indices extern-keyword acc-names) + ; The accumlator is made up of two 32 bit registers, accgi/acci. + ; We want to extract this as a combined 40 unsigned bits + (get (index) + (or DI + (sll DI (zext DI (reg h-spr (add index 1472))) 32) + (zext DI (reg h-spr (add index 1408))))) + ; Bits 40-63 are not written. raw-reg is used to bypass read-only restrictions + ; on ACC and ACCG registers + (set (index newval) + (sequence () + (c-call VOID "frv_check_spr_write_access" (add index 1408)) + (set (raw-reg UWI h-spr + (add index 1472)) (and (srl newval 32) #xff)) + (set (raw-reg UWI h-spr + (add index 1408)) (trunc USI newval)))) +) +; 64-bit signed accumulator. Composed of iacc0h and iacc0l registers +; concatenated, but referenced more often as the composed 64 bits. +(define-keyword + ; This is totally hokey -- I have to have an index! + (name iacc0-names) + (print-name h-iacc0) + (prefix "") + (values (iacc0 0)) +) + +(define-hardware + (name h-iacc0) + (comment "64 bit signed accumulator") + (attrs PROFILE VIRTUAL (MACH fr400)) + (type register DI (1)) + (indices extern-keyword iacc0-names) + ; The single 64-bit integer accumulator is made up of two 32 bit + ; registers, iacc0h and iacc0l. We want to extract this as a + ; combined 64 signed bits. + (get (idx) (or DI (sll DI (ext DI (spr-iacc0h)) 32) (zext DI (spr-iacc0l)))) + (set (idx newval) + (sequence () + (set (spr-iacc0h) (trunc SI (srl newval 32))) + (set (spr-iacc0l) (trunc SI newval)))) +) + +; Integer condition code registers (CCR) +; +; The individual sub registers bits of the CCR are referenced more often than +; the entire register so set them directly. We can assemble the +; entire register when necessary. +; +(define-keyword + (name iccr-names) + (print-name h-iccr) + (prefix "") + (values (icc0 0) (icc1 1) (icc2 2) (icc3 3)) +) + +(define-hardware + (name h-iccr) + (comment "Integer condition code registers") + (attrs PROFILE) + (type register UQI (4)) + (indices extern-keyword iccr-names) +) + +; Floating point condition code registers (CCR) +; +; The individual sub registers bits of the CCR are referenced more often than +; the entire register so set them directly. We can assemble the +; entire register when necessary. +; +(define-keyword + (name fccr-names) + (print-name h-fccr) + (prefix "") + (values (fcc0 0) (fcc1 1) (fcc2 2) (fcc3 3)) +) + +(define-hardware + (name h-fccr) + (comment "Floating point condition code registers") + (attrs PROFILE) + (type register UQI (4)) + (indices extern-keyword fccr-names) +) + +; C condition code registers (CCCR) +; +(define-keyword + (name cccr-names) + (print-name h-cccr) + (prefix "") + (values (cc0 0) (cc1 1) (cc2 2) (cc3 3) (cc4 4) (cc5 5) (cc6 6) (cc7 7)) +) + +(define-hardware + (name h-cccr) + (comment "Condition code registers") + (attrs PROFILE) + (type register UQI (8)) + (indices extern-keyword cccr-names) +) + +; Dummy hardware used to define packing bit on insns +; +(define-hardware + (name h-pack) + (comment "Packing bit dummy hardware") + (type immediate (UINT 1)) + (values keyword "" (("" 1) (".p" 0) (".P" 0))) +) +; Dummy hardware used to define hint field for branches always taken +; +(define-hardware + (name h-hint-taken) + (comment "Branch taken hint dummy hardware") + (type immediate (UINT 1)) + ; The order of these is important. We want '2' to get written by default, + ; but we also want the docoder/disassembler to allow the values '0', '1' and + ; '3'. + (values keyword "" (("" 2) ("" 0) ("" 1) ("" 3))) +) +; Dummy hardware used to define hint field for branches never taken +; +(define-hardware + (name h-hint-not-taken) + (comment "Branch not taken hint dummy hardware") + (type immediate (UINT 1)) + ; The order of these is important. We want '0' to get written by default, + ; but we also want the docoder/disassembler to allow the values '1', '2' and + ; '3'. + (values keyword "" (("" 0) ("" 1) ("" 2) ("" 3))) +) + +; Instruction Operands. +; These entries provide a layer between the assembler and the raw hardware +; description, and are used to refer to hardware elements in the semantic +; code. Usually there's a bit of over-specification, but in more complicated +; instruction sets there isn't. + +; FRV specific operand attributes: + +(define-attr + (for operand) + (type boolean) + (name HASH-PREFIX) + (comment "immediates have an optional '#' prefix") +) + +; ??? Convention says this should be o-sr, but then the insn definitions +; should refer to o-sr which is clumsy. The "o-" could be implicit, but +; then it should be implicit for all the symbols here, but then there would +; be confusion between (f-)simm8 and (h-)simm8. +; So for now the rule is exactly as it appears here. + +; dnmop: define-normal-mode-operand: temporary, pending potential removal +; of modes from h/w. +(define-pmacro (dnmop xname xcomment xattrs xtype xindex xmode) + (define-operand + (name xname) + (comment xcomment) + (.splice attrs (.unsplice xattrs)) + (type xtype) + (index xindex) + (mode xmode) + ) +) + +; dnpmop: define-normal-parsed-mode-operand: Normal mode operand with parse handler +(define-pmacro (dnpmop xname xcomment xattrs xtype xindex xmode xparse) + (define-operand + (name xname) + (comment xcomment) + (.splice attrs (.unsplice xattrs)) + (type xtype) + (index xindex) + (mode xmode) + (handlers (parse xparse)) + ) +) + +(dnop pack "packing bit" () h-pack f-pack) + +(dnmop GRi "source register 1" () h-gr f-GRi SI) +(dnmop GRj "source register 2" () h-gr f-GRj SI) +(dnmop GRk "destination register" () h-gr f-GRk SI) +(dnmop GRkhi "destination register" () h-gr_hi f-GRk UHI) +(dnmop GRklo "destination register" () h-gr_lo f-GRk UHI) +(dnpmop GRdoublek "destination register" () h-gr_double f-GRk DI "even_register") +(dnmop ACC40Si "signed accumulator" () h-acc40S f-ACC40Si DI) +(dnmop ACC40Ui "unsigned accumulator" () h-acc40U f-ACC40Ui UDI) +(dnmop ACC40Sk "target accumulator" () h-acc40S f-ACC40Sk DI) +(dnmop ACC40Uk "target accumulator" () h-acc40U f-ACC40Uk UDI) +(dnmop ACCGi "source register" () h-accg f-ACCGi UWI) +(dnmop ACCGk "target register" () h-accg f-ACCGk UWI) + +(dnmop CPRi "source register" ((MACH frv)) h-cpr f-CPRi SI) +(dnmop CPRj "source register" ((MACH frv)) h-cpr f-CPRj SI) +(dnmop CPRk "destination register" ((MACH frv)) h-cpr f-CPRk SI) +(dnpmop CPRdoublek "destination register" ((MACH frv)) h-cpr_double f-CPRk DI "even_register") + +; floating point operands +(dnmop FRinti "source register 1" () h-fr_int f-FRi SI) +(dnmop FRintj "source register 2" () h-fr_int f-FRj SI) +(dnmop FRintk "target register" () h-fr_int f-FRk SI) +(dnmop FRi "source register 1" () h-fr f-FRi SF) +(dnmop FRj "source register 2" () h-fr f-FRj SF) +(dnmop FRk "destination register" () h-fr f-FRk SF) +(dnmop FRkhi "destination register" () h-fr_hi f-FRk UHI) +(dnmop FRklo "destination register" () h-fr_lo f-FRk UHI) +(dnpmop FRdoublei "source register 1" () h-fr_double f-FRi DF "even_register") +(dnpmop FRdoublej "source register 2" () h-fr_double f-FRj DF "even_register") +(dnpmop FRdoublek "target register" () h-fr_double f-FRk DF "even_register") + +(dnop CRi "source register 1" () h-cccr f-CRi) +(dnop CRj "source register 2" () h-cccr f-CRj) +(dnop CRj_int "destination register" () h-cccr f-CRj_int) +(dnop CRj_float "destination register" () h-cccr f-CRj_float) +(dnop CRk "destination register" () h-cccr f-CRk) +(dnop CCi "condition register" () h-cccr f-CCi) + +(dnop ICCi_1 "condition register" () h-iccr f-ICCi_1) +(dnop ICCi_2 "condition register" () h-iccr f-ICCi_2) +(dnop ICCi_3 "condition register" () h-iccr f-ICCi_3) +(dnop FCCi_1 "condition register" () h-fccr f-FCCi_1) +(dnop FCCi_2 "condition register" () h-fccr f-FCCi_2) +(dnop FCCi_3 "condition register" () h-fccr f-FCCi_3) +(dnop FCCk "condition register" () h-fccr f-FCCk) + +(dnop eir "exception insn reg" () h-uint f-eir) +(dnop s10 "10 bit signed immediate" (HASH-PREFIX) h-sint f-s10) +(dnop u16 "16 bit unsigned immediate" (HASH-PREFIX) h-uint f-u16) +(dnop s16 "16 bit signed immediate" (HASH-PREFIX) h-sint f-s16) +(dnop s6 "6 bit signed immediate" (HASH-PREFIX) h-sint f-s6) +(dnop s6_1 "6 bit signed immediate" (HASH-PREFIX) h-sint f-s6_1) +(dnop u6 "6 bit unsigned immediate" (HASH-PREFIX) h-uint f-u6) +(dnop s5 "5 bit signed immediate" (HASH-PREFIX) h-sint f-s5) +(dnop cond "conditional arithmetic" (HASH-PREFIX) h-uint f-cond) +(dnop ccond "lr branch condition" (HASH-PREFIX) h-uint f-ccond) +(dnop hint "2 bit branch predictor" (HASH-PREFIX) h-uint f-hint) +(dnop hint_taken "2 bit branch predictor" () h-hint-taken f-hint) +(dnop hint_not_taken "2 bit branch predictor" () h-hint-not-taken f-hint) + +(dnop LI "link indicator" () h-uint f-LI) +(dnop lock "cache lock indicator" (HASH-PREFIX) h-uint f-lock) +(dnop debug "debug mode indicator" (HASH-PREFIX) h-uint f-debug) +(dnop ae "all entries indicator" (HASH-PREFIX) h-uint f-ae) + +(dnop label16 "18 bit pc relative address" () h-iaddr f-label16) +(dnop label24 "26 bit pc relative address" () h-iaddr f-label24) + +(define-operand + (name A0) + (comment "A==0 operand of mclracc") + (attrs) + (type h-uint) + (index f-A) + (mode USI) + (handlers (parse "A0")) +) + +(define-operand + (name A1) + (comment "A==1 operand of mclracc") + (attrs) + (type h-uint) + (index f-A) + (mode USI) + (handlers (parse "A1")) +) + +(define-operand + (name FRintieven) + (comment "(even) source register 1") + (attrs) + (type h-fr_int) + (index f-FRi) + (mode SI) + (handlers (parse "even_register")) +) + +(define-operand + (name FRintjeven) + (comment "(even) source register 2") + (attrs) + (type h-fr_int) + (index f-FRj) + (mode SI) + (handlers (parse "even_register")) +) + +(define-operand + (name FRintkeven) + (comment "(even) target register") + (attrs) + (type h-fr_int) + (index f-FRk) + (mode SI) + (handlers (parse "even_register")) +) + +(define-operand + (name d12) + (comment "12 bit signed immediate") + (attrs) + (type h-sint) + (index f-d12) + (handlers (parse "d12")) +) + +(define-operand + (name s12) + (comment "12 bit signed immediate") + (attrs HASH-PREFIX) + (type h-sint) + (index f-d12) + (handlers (parse "s12")) +) + +(define-operand + (name u12) + (comment "12 bit signed immediate") + (attrs HASH-PREFIX) + (type h-sint) + (index f-u12) + (handlers (parse "u12")) +) + +(define-operand + (name spr) + (comment "special purpose register") + (attrs) + (type h-spr) + (index f-spr) + (handlers (parse "spr") (print "spr")) +) + +(define-operand + (name ulo16) + (comment "16 bit unsigned immediate, for #lo()") + (attrs) + (type h-uint) + (index f-u16) + (handlers (parse "ulo16") (print "lo")) +) + +(define-operand + (name slo16) + (comment "16 bit unsigned immediate, for #lo()") + (attrs) + (type h-sint) + (index f-s16) + (handlers (parse "uslo16") (print "lo")) +) + +(define-operand + (name uhi16) + (comment "16 bit unsigned immediate, for #hi()") + (attrs) + (type h-uint) + (index f-u16) + (handlers (parse "uhi16") (print "hi")) +) + +; operands representing hardware +; +(dnop psr_esr "PSR.ESR bit" (SEM-ONLY) h-psr_esr f-nil) +(dnop psr_s "PSR.S bit" (SEM-ONLY) h-psr_s f-nil) +(dnop psr_ps "PSR.PS bit" (SEM-ONLY) h-psr_ps f-nil) +(dnop psr_et "PSR.ET bit" (SEM-ONLY) h-psr_et f-nil) + +(dnop bpsr_bs "BPSR.BS bit" (SEM-ONLY) h-bpsr_bs f-nil) +(dnop bpsr_bet "BPSR.BET bit" (SEM-ONLY) h-bpsr_bet f-nil) + +(dnop tbr_tba "TBR.TBA" (SEM-ONLY) h-tbr_tba f-nil) +(dnop tbr_tt "TBR.TT" (SEM-ONLY) h-tbr_tt f-nil) + +; Null operands +; +(define-pmacro (ICCi_1-null) (f-ICCi_1-null 0)) +(define-pmacro (ICCi_2-null) (f-ICCi_2-null 0)) +(define-pmacro (ICCi_3-null) (f-ICCi_3-null 0)) +(define-pmacro (FCCi_1-null) (f-FCCi_1-null 0)) +(define-pmacro (FCCi_2-null) (f-FCCi_2-null 0)) +(define-pmacro (FCCi_3-null) (f-FCCi_3-null 0)) +(define-pmacro (rs-null) (f-rs-null 0)) +(define-pmacro (GRi-null) (f-GRi-null 0)) +(define-pmacro (GRj-null) (f-GRj-null 0)) +(define-pmacro (GRk-null) (f-GRk-null 0)) +(define-pmacro (FRi-null) (f-FRi-null 0)) +(define-pmacro (FRj-null) (f-FRj-null 0)) +(define-pmacro (ACCj-null) (f-ACCj-null 0)) +(define-pmacro (rd-null) (f-rd-null 0)) +(define-pmacro (cond-null) (f-cond-null 0)) +(define-pmacro (ccond-null) (f-ccond-null 0)) +(define-pmacro (s12-null) (f-s12-null 0)) +(define-pmacro (label16-null) (f-label16-null 0)) +(define-pmacro (misc-null-1) (f-misc-null-1 0)) +(define-pmacro (misc-null-2) (f-misc-null-2 0)) +(define-pmacro (misc-null-3) (f-misc-null-3 0)) +(define-pmacro (misc-null-4) (f-misc-null-4 0)) +(define-pmacro (misc-null-5) (f-misc-null-5 0)) +(define-pmacro (misc-null-6) (f-misc-null-6 0)) +(define-pmacro (misc-null-7) (f-misc-null-7 0)) +(define-pmacro (misc-null-8) (f-misc-null-8 0)) +(define-pmacro (misc-null-9) (f-misc-null-9 0)) +(define-pmacro (misc-null-10) (f-misc-null-10 0)) +(define-pmacro (misc-null-11) (f-misc-null-11 0)) + +(define-pmacro (LI-on) (f-LI-on 1)) +(define-pmacro (LI-off) (f-LI-off 0)) + +; Instruction definitions. +; +; Notes: +; - dni is short for "define-normal-instruction" +; - Macros are used to represent each insn format. These should be used as much +; as possible unless an insn has exceptional behaviour +; + +; Commonly used Macros +; +; Specific registers +; + +; Integer condition code manipulation +; +(define-pmacro (set-z-and-n icc x) + (if (eq x 0) + (set icc (or (and icc #x7) #x4)) + (if (lt x 0) + (set icc (or (and icc #xb) #x8)) + (set icc (and icc #x3)))) +) + +(define-pmacro (set-n icc val) + (if (eq val 0) + (set icc (and icc #x7)) + (set icc (or icc #x8))) +) + +(define-pmacro (set-z icc val) + (if (eq val 0) + (set icc (and icc #xb)) + (set icc (or icc #x4))) +) + +(define-pmacro (set-v icc val) + (if (eq val 0) + (set icc (and icc #xd)) + (set icc (or icc #x2))) +) + +(define-pmacro (set-c icc val) + (if (eq val 0) + (set icc (and icc #xe)) + (set icc (or icc #x1))) +) + +(define-pmacro (nbit icc) + (trunc BI (srl (and icc #x8) 3)) +) + +(define-pmacro (zbit icc) + (trunc BI (srl (and icc #x4) 2)) +) + +(define-pmacro (vbit icc) + (trunc BI (srl (and icc #x2) 1)) +) + +(define-pmacro (cbit icc) + (trunc BI (and icc #x1)) +) + +(define-pmacro (ebit icc) + (trunc BI (srl (and icc #x8) 3)) +) + +(define-pmacro (lbit icc) + (trunc BI (srl (and icc #x4) 2)) +) + +(define-pmacro (gbit icc) + (trunc BI (srl (and icc #x2) 1)) +) + +(define-pmacro (ubit icc) + (trunc BI (and icc #x1)) +) + +; FRV insns +; +; +; Format: INT, Logic, Shift r-r +; +(define-pmacro (int-logic-r-r name operation op ope comment) + (dni name + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str name "$pack $GRi,$GRj,$GRk") + (+ pack GRk op GRi (ICCi_1-null) ope GRj) + (set GRk (operation GRi GRj)) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-logic-r-r add add OP_00 OPE2_00 "add reg/reg") +(int-logic-r-r sub sub OP_00 OPE2_04 "sub reg/reg") +(int-logic-r-r and and OP_01 OPE2_00 "and reg/reg") +(int-logic-r-r or or OP_01 OPE2_02 "or reg/reg") +(int-logic-r-r xor xor OP_01 OPE2_04 "xor reg/reg") + +(dni not + ("not") + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + ("not$pack $GRj,$GRk") + (+ pack GRk OP_01 (rs-null) (ICCi_1-null) OPE2_06 GRj) + (set GRk (inv GRj)) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) +) + +(dni sdiv + "signed division" + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1)) + "sdiv$pack $GRi,$GRj,$GRk" + (+ pack GRk OP_00 GRi (ICCi_1-null) OPE2_0E GRj) + (sequence () + (c-call VOID "@cpu@_signed_integer_divide" + GRi GRj (index-of GRk) 0) + (clobber GRk)) + ((fr400 (unit u-idiv)) + (fr500 (unit u-idiv)) (fr550 (unit u-idiv))) +) + +(dni nsdiv + "non excepting signed division" + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING + (MACH simple,tomcat,fr500,fr550,frv)) + "nsdiv$pack $GRi,$GRj,$GRk" + (+ pack GRk OP_01 GRi (ICCi_1-null) OPE2_0E GRj) + (sequence () + (c-call VOID "@cpu@_signed_integer_divide" + GRi GRj (index-of GRk) 1) + (clobber GRk)) + ((fr400 (unit u-idiv)) + (fr500 (unit u-idiv)) (fr550 (unit u-idiv))) +) + +(dni udiv + "unsigned division reg/reg" + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1)) + "udiv$pack $GRi,$GRj,$GRk" + (+ pack GRk OP_00 GRi (ICCi_1-null) OPE2_0F GRj) + (sequence () + (c-call VOID "@cpu@_unsigned_integer_divide" + GRi GRj (index-of GRk) 0) + (clobber GRk)) + ((fr400 (unit u-idiv)) + (fr500 (unit u-idiv)) (fr550 (unit u-idiv))) +) + +(dni nudiv + "non excepting unsigned division" + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING + (MACH simple,tomcat,fr500,fr550,frv)) + "nudiv$pack $GRi,$GRj,$GRk" + (+ pack GRk OP_01 GRi (ICCi_1-null) OPE2_0F GRj) + (sequence () + (c-call VOID "@cpu@_unsigned_integer_divide" + GRi GRj (index-of GRk) 1) + (clobber GRk)) + ((fr400 (unit u-idiv)) + (fr500 (unit u-idiv)) (fr550 (unit u-idiv))) +) + +; Multiplication +; +(define-pmacro (multiply-r-r name signop op ope comment) + (dni name + (comment) + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1)) + (.str name "$pack $GRi,$GRj,$GRdoublek") + (+ pack GRdoublek op GRi (ICCi_1-null) ope GRj) + (set GRdoublek (mul DI (signop DI GRi) (signop DI GRj))) + ((fr400 (unit u-imul)) + (fr500 (unit u-imul)) (fr550 (unit u-imul))) + ) +) + +(multiply-r-r smul ext OP_00 OPE2_08 "signed multiply reg/reg") +(multiply-r-r umul zext OP_00 OPE2_0A "unsigned multiply reg/reg") + +; Multiplication with integer accumulator IACC +; + +(define-pmacro (iacc-set value) + (set (reg h-iacc0 0) value)) + +(define-pmacro (iacc-add value) + (set (reg h-iacc0 0) + (cond DI + ((andif (andif (gt value 0) (gt (reg h-iacc0 0) 0)) + (lt (sub DI #x7fffffffffffffff value) (reg h-iacc0 0))) + ; Positive overflow + (const DI #x7fffffffffffffff)) + ((andif (andif (lt value 0) (lt (reg h-iacc0 0) 0)) + (gt (sub DI #x8000000000000000 value) (reg h-iacc0 0))) + ; Negative overflow + (const DI #x8000000000000000)) + (else + (add DI (reg h-iacc0 0) value)))) +) + +(define-pmacro (iacc-sub value) + (set (reg h-iacc0 0) + (cond DI + ((andif (andif (lt value 0) (gt (reg h-iacc0 0) 0)) + (lt (add DI #x7fffffffffffffff value) (reg h-iacc0 0))) + ; Positive overflow + (const DI #x7fffffffffffffff)) + ((andif (andif (gt value 0) (lt (reg h-iacc0 0) 0)) + (gt (add DI #x8000000000000000 value) (reg h-iacc0 0))) + ; Negative overflow + (const DI #x8000000000000000)) + (else + (sub DI (reg h-iacc0 0) value)))) +) + +(define-pmacro (iacc-multiply-r-r name operation op ope comment) + (dni name + (comment) + ((UNIT IACC) (FR400-MAJOR I-1) (MACH fr400)) + (.str name "$pack $GRi,$GRj") + (+ pack (rd-null) op GRi ope GRj) + ((.sym iacc- operation) (mul DI (ext DI GRi) (ext DI GRj))) + ((fr400 (unit u-integer))) + ) +) + +(iacc-multiply-r-r smu set OP_46 OPE1_05 "Signed multiply reg/reg/iacc") +(iacc-multiply-r-r smass add OP_46 OPE1_06 "Signed multiply/add reg/reg/iacc") +(iacc-multiply-r-r smsss sub OP_46 OPE1_07 "Signed multiply/sub reg/reg/iacc") + +(define-pmacro (int-shift-r-r name op ope comment) + (dni name + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str name "$pack $GRi,$GRj,$GRk") + (+ pack GRk op GRi (ICCi_1-null) ope GRj) + (set GRk (name GRi (and GRj #x1f))) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-shift-r-r sll OP_01 OPE2_08 "shift left logical reg/reg") +(int-shift-r-r srl OP_01 OPE2_0A "shift right logical reg/reg") +(int-shift-r-r sra OP_01 OPE2_0C "shift right arith reg/reg") + +(dni slass + "shift left arith reg/reg with saturation" + ((UNIT IALL) (FR400-MAJOR I-1) (MACH fr400)) + "slass$pack $GRi,$GRj,$GRk" + (+ pack GRk OP_46 GRi OPE1_02 GRj) + (set GRk (c-call SI "@cpu@_shift_left_arith_saturate" GRi GRj)) + () +) + +(dni scutss + "Integer accumulator cut with saturation" + ((UNIT IALL) (FR400-MAJOR I-1) (MACH fr400)) + "scutss$pack $GRj,$GRk" + (+ pack GRk OP_46 (rs-null) OPE1_04 GRj) + (set GRk (c-call SI "@cpu@_iacc_cut" (reg h-iacc0 0) GRj)) + () +) + +(define-pmacro (scan-semantics arg1 arg2 targ) + (sequence ((WI tmp1) (WI tmp2)) + (set tmp1 arg1) + (set tmp2 (sra arg2 1)) + (set targ (c-call WI "@cpu@_scan_result" (xor tmp1 tmp2)))) +) + +(dni scan + "scan" + ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + "scan$pack $GRi,$GRj,$GRk" + (+ pack GRk OP_0B GRi (ICCi_1-null) OPE2_00 GRj) + (scan-semantics GRi GRj GRk) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) +) + +; Format: conditional INT, Logic, Shift r-r +; +(define-pmacro (conditional-int-logic name operation op ope comment) + (dni name + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL) + (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond") + (+ pack GRk op GRi CCi cond ope GRj) + (if (eq CCi (or cond 2)) + (set GRk (operation GRi GRj))) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(conditional-int-logic cadd add OP_58 OPE4_0 "conditional add") +(conditional-int-logic csub sub OP_58 OPE4_1 "conditional sub") +(conditional-int-logic cand and OP_5A OPE4_0 "conditional and") +(conditional-int-logic cor or OP_5A OPE4_1 "conditional or") +(conditional-int-logic cxor xor OP_5A OPE4_2 "conditional xor") + +(dni cnot + "conditional not" + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL) + "cnot$pack $GRj,$GRk,$CCi,$cond" + (+ pack GRk OP_5A (rs-null) CCi cond OPE4_3 GRj) + (if (eq CCi (or cond 2)) + (set GRk (inv GRj))) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) +) + +(dni csmul + "conditional signed multiply" + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL) + "csmul$pack $GRi,$GRj,$GRdoublek,$CCi,$cond" + (+ pack GRdoublek OP_58 GRi CCi cond OPE4_2 GRj) + (if (eq CCi (or cond 2)) + (set GRdoublek (mul DI (ext DI GRi) (ext DI GRj)))) + ((fr400 (unit u-imul)) + (fr500 (unit u-imul)) (fr550 (unit u-imul))) +) + +(dni csdiv + "conditional signed division" + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL) + "csdiv$pack $GRi,$GRj,$GRk,$CCi,$cond" + (+ pack GRk OP_58 GRi CCi cond OPE4_3 GRj) + (if (eq CCi (or cond 2)) + (sequence () + (c-call VOID "@cpu@_signed_integer_divide" + GRi GRj (index-of GRk) 0) + (clobber GRk))) + ((fr400 (unit u-idiv)) + (fr500 (unit u-idiv)) (fr550 (unit u-idiv))) +) + +(dni cudiv + "conditional unsigned division" + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL) + "cudiv$pack $GRi,$GRj,$GRk,$CCi,$cond" + (+ pack GRk OP_59 GRi CCi cond OPE4_3 GRj) + (if (eq CCi (or cond 2)) + (sequence () + (c-call VOID "@cpu@_unsigned_integer_divide" + GRi GRj (index-of GRk) 0) + (clobber GRk))) + ((fr400 (unit u-idiv)) + (fr500 (unit u-idiv)) (fr550 (unit u-idiv))) +) + +(define-pmacro (conditional-shift name operation op ope comment) + (dni name + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL) + (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond") + (+ pack GRk op GRi CCi cond ope GRj) + (if (eq CCi (or cond 2)) + (set GRk (operation GRi (and GRj #x1f)))) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(conditional-shift csll sll OP_5C OPE4_0 "conditional shift left logical") +(conditional-shift csrl srl OP_5C OPE4_1 "conditional shift right logical") +(conditional-shift csra sra OP_5C OPE4_2 "conditional shift right arith") + +(dni cscan + "conditional scan" + ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL) + "cscan$pack $GRi,$GRj,$GRk,$CCi,$cond" + (+ pack GRk OP_65 GRi CCi cond OPE4_3 GRj) + (if (eq CCi (or cond 2)) + (scan-semantics GRi GRj GRk)) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) +) + +; Format: INT, Logic, Shift, cc r-r +; +(define-pmacro (int-arith-cc-semantics operation icc) + (sequence ((BI tmp) (QI cc) (SI result)) + (set cc icc) + (set tmp ((.sym operation -oflag) GRi GRj (const 0))) + (set-v cc tmp) + (set tmp ((.sym operation -cflag) GRi GRj (const 0))) + (set-c cc tmp) + (set result (operation GRi GRj)) + (set-z-and-n cc result) + (set GRk result) + (set icc cc)) +) + +(define-pmacro (int-arith-cc-r-r name operation op ope comment) + (dni name + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1") + (+ pack GRk op GRi ICCi_1 ope GRj) + (int-arith-cc-semantics operation ICCi_1) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-arith-cc-r-r addcc add OP_00 OPE2_01 "add reg/reg, set icc") +(int-arith-cc-r-r subcc sub OP_00 OPE2_05 "sub reg/reg, set icc") + +(define-pmacro (int-logic-cc-semantics op icc) + (sequence ((SI tmp)) + (set tmp (op GRi GRj)) + (set GRk tmp) + (set-z-and-n icc tmp)) +) + +(define-pmacro (int-logic-cc-r-r name op ope comment) + (dni (.sym name cc) + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str (.sym name cc) "$pack $GRi,$GRj,$GRk,$ICCi_1") + (+ pack GRk op GRi ICCi_1 ope GRj) + (int-logic-cc-semantics name ICCi_1) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-logic-cc-r-r and OP_01 OPE2_01 "and reg/reg, set icc") +(int-logic-cc-r-r or OP_01 OPE2_03 "or reg/reg, set icc") +(int-logic-cc-r-r xor OP_01 OPE2_05 "xor reg/reg, set icc") + +(define-pmacro (int-shift-cc-semantics op l-r icc) + (sequence ((WI shift) (SI tmp) (QI cc)) + (set shift (and GRj #x1f)) + (set cc (c-call QI (.str "@cpu@_set_icc_for_shift_" l-r) + GRi shift icc)) + (set tmp (op GRi shift)) + (set GRk tmp) + (set-z-and-n cc tmp) + (set icc cc)) +) + +(define-pmacro (int-shift-cc-r-r name l-r op ope comment) + (dni (.sym name cc) + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str (.sym name cc) "$pack $GRi,$GRj,$GRk,$ICCi_1") + (+ pack GRk op GRi ICCi_1 ope GRj) + (int-shift-cc-semantics name l-r ICCi_1) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-shift-cc-r-r sll left OP_01 OPE2_09 "shift left logical reg/reg,set icc") +(int-shift-cc-r-r srl right OP_01 OPE2_0B "shift right logical reg/reg,set icc") +(int-shift-cc-r-r sra right OP_01 OPE2_0D "shift right arith reg/reg,set icc") + +(define-pmacro (multiply-cc-semantics signop arg1 arg2 targ icc) + (sequence ((DI tmp) (QI cc)) + (set cc icc) + (set tmp (mul DI (signop DI arg1) (signop DI arg2))) + (set-n cc (srl DI tmp 63)) + (set-z cc (eq tmp 0)) + (set targ tmp) + (set icc cc)) +) + +(define-pmacro (multiply-cc-r-r name signop op ope comment) + (dni name + (comment) + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1)) + (.str name "$pack $GRi,$GRj,$GRdoublek,$ICCi_1") + (+ pack GRdoublek op GRi ICCi_1 ope GRj) + (multiply-cc-semantics signop GRi GRj GRdoublek ICCi_1) + ((fr400 (unit u-imul)) + (fr500 (unit u-imul)) (fr550 (unit u-imul))) + ) +) + +(multiply-cc-r-r smulcc ext OP_00 OPE2_09 "signed multiply reg/reg") +(multiply-cc-r-r umulcc zext OP_00 OPE2_0B "unsigned multiply reg/reg") + + +; Format: conditional INT, Logic, Shift, cc r-r +; +(define-pmacro (conditional-int-arith-cc name operation op ope comment) + (dni name + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL) + (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond") + (+ pack GRk op GRi CCi cond ope GRj) + (if (eq CCi (or cond 2)) + (int-arith-cc-semantics operation + (reg h-iccr (and (index-of CCi) 3)))) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(conditional-int-arith-cc caddcc add OP_59 OPE4_0 "add, set icc") +(conditional-int-arith-cc csubcc sub OP_59 OPE4_1 "sub, set icc") + +(dni csmulcc + "conditional signed multiply and set condition code" + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1) CONDITIONAL) + "csmulcc$pack $GRi,$GRj,$GRdoublek,$CCi,$cond" + (+ pack GRdoublek OP_59 GRi CCi cond OPE4_2 GRj) + (if (eq CCi (or cond 2)) + (multiply-cc-semantics ext GRi GRj GRdoublek + (reg h-iccr (and (index-of CCi) 3)))) + ((fr400 (unit u-imul)) + (fr500 (unit u-imul)) (fr550 (unit u-imul))) +) + +(define-pmacro (conditional-int-logic-cc name operation op ope comment) + (dni name + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL) + (.str name "$pack $GRi,$GRj,$GRk,$CCi,$cond") + (+ pack GRk op GRi CCi cond ope GRj) + (if (eq CCi (or cond 2)) + (int-logic-cc-semantics operation + (reg h-iccr (and (index-of CCi) 3)))) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(conditional-int-logic-cc candcc and OP_5B OPE4_0 "conditional and, set icc") +(conditional-int-logic-cc corcc or OP_5B OPE4_1 "conditional or , set icc") +(conditional-int-logic-cc cxorcc xor OP_5B OPE4_2 "conditional xor, set icc") + +(define-pmacro (conditional-int-shift-cc name l-r op ope comment) + (dni (.sym c name cc) + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL) + (.str (.sym c name cc) "$pack $GRi,$GRj,$GRk,$CCi,$cond") + (+ pack GRk op GRi CCi cond ope GRj) + (if (eq CCi (or cond 2)) + (int-shift-cc-semantics name l-r + (reg h-iccr (and (index-of CCi) 3)))) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(conditional-int-shift-cc sll left OP_5D OPE4_0 "shift left logical, set icc") +(conditional-int-shift-cc srl right OP_5D OPE4_1 "shift right logical, set icc") +(conditional-int-shift-cc sra right OP_5D OPE4_2 "shift right arith , set icc") + +; Add and subtract with carry +; +(define-pmacro (int-arith-x-r-r name operation op ope comment) + (dni name + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1") + (+ pack GRk op GRi ICCi_1 ope GRj) + (set GRk ((.sym operation c) GRi GRj (cbit ICCi_1))) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-arith-x-r-r addx add OP_00 OPE2_02 "Add reg/reg, with carry") +(int-arith-x-r-r subx sub OP_00 OPE2_06 "Sub reg/reg, with carry") + +(define-pmacro (int-arith-x-cc-r-r name operation op ope comment) + (dni name + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str name "$pack $GRi,$GRj,$GRk,$ICCi_1") + (+ pack GRk op GRi ICCi_1 ope GRj) + (sequence ((WI tmp) (QI cc)) + (set cc ICCi_1) + (set tmp ((.sym operation c) GRi GRj (cbit cc))) + (set-v cc ((.sym operation -oflag) GRi GRj (cbit cc))) + (set-c cc ((.sym operation -cflag) GRi GRj (cbit cc))) + (set-z-and-n cc tmp) + (set GRk tmp) + (set ICCi_1 cc)) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-arith-x-cc-r-r addxcc add OP_00 OPE2_03 "Add reg/reg, use/set carry") +(int-arith-x-cc-r-r subxcc sub OP_00 OPE2_07 "Sub reg/reg, use/set carry") +; Add and subtract with saturation +; +(define-pmacro (int-arith-ss-r-r name operation op ope comment) + (dni name + (comment) + ((UNIT IALL) (FR400-MAJOR I-1) (MACH fr400)) + (.str name "$pack $GRi,$GRj,$GRk") + (+ pack GRk op GRi ope GRj) + (sequence () + (set GRk (operation GRi GRj)) + (if ((.sym operation -oflag) GRi GRj (const 0)) + ; Overflow, saturate. + ; Sign of result will be + ; same as sign of first operand. + (set GRk + (cond SI + ((gt GRi 0) (const #x7fffffff)) + ((lt GRi 0) (const #x80000000)) + (else (const 0))))) + ) + ((fr400 (unit u-integer))) + ) +) + +(int-arith-ss-r-r addss add OP_46 OPE1_00 "add reg/reg, with saturation") +(int-arith-ss-r-r subss sub OP_46 OPE1_01 "sub reg/reg, with saturation") + +; Format: INT, Logic, Shift r-simm +; +(define-pmacro (int-logic-r-simm name operation op comment) + (dni name + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str name "$pack $GRi,$s12,$GRk") + (+ pack GRk op GRi s12) + (set GRk (operation GRi s12)) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-logic-r-simm addi add OP_10 "add reg/immed") +(int-logic-r-simm subi sub OP_14 "sub reg/immed") +(int-logic-r-simm andi and OP_20 "and reg/immed") +(int-logic-r-simm ori or OP_22 "or reg/immed") +(int-logic-r-simm xori xor OP_24 "xor reg/immed") + +(dni sdivi + "signed division reg/immed" + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1)) + "sdivi$pack $GRi,$s12,$GRk" + (+ pack GRk OP_1E GRi s12) + (sequence () + (c-call VOID "@cpu@_signed_integer_divide" + GRi s12 (index-of GRk) 0) + (clobber GRk)) + ((fr400 (unit u-idiv)) + (fr500 (unit u-idiv)) (fr550 (unit u-idiv))) +) + +(dni nsdivi + "non excepting signed division reg/immed" + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING + (MACH simple,tomcat,fr500,fr550,frv)) + "nsdivi$pack $GRi,$s12,$GRk" + (+ pack GRk OP_2E GRi s12) + (sequence () + (c-call VOID "@cpu@_signed_integer_divide" + GRi s12 (index-of GRk) 1) + (clobber GRk)) + ((fr400 (unit u-idiv)) + (fr500 (unit u-idiv)) (fr550 (unit u-idiv))) +) + +(dni udivi + "unsigned division reg/immed" + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1)) + "udivi$pack $GRi,$s12,$GRk" + (+ pack GRk OP_1F GRi s12) + (sequence () + (c-call VOID "@cpu@_unsigned_integer_divide" + GRi s12 (index-of GRk) 0) + (clobber GRk)) + ((fr400 (unit u-idiv)) + (fr500 (unit u-idiv)) (fr550 (unit u-idiv))) +) + +(dni nudivi + "non excepting unsigned division reg/immed" + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) NON-EXCEPTING + (MACH simple,tomcat,fr500,fr550,frv)) + "nudivi$pack $GRi,$s12,$GRk" + (+ pack GRk OP_2F GRi s12) + (sequence () + (c-call VOID "@cpu@_unsigned_integer_divide" + GRi s12 (index-of GRk) 1) + (clobber GRk)) + ((fr400 (unit u-idiv)) + (fr500 (unit u-idiv)) (fr550 (unit u-idiv))) +) + +(define-pmacro (multiply-r-simm name signop op comment) + (dni name + (comment) + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1)) + (.str name "$pack $GRi,$s12,$GRdoublek") + (+ pack GRdoublek op GRi s12) + (set GRdoublek (mul DI (signop DI GRi) (signop DI s12))) + ((fr400 (unit u-imul)) + (fr500 (unit u-imul)) (fr550 (unit u-imul))) + ) +) + +(multiply-r-simm smuli ext OP_18 "signed multiply reg/immed") +(multiply-r-simm umuli zext OP_1A "unsigned multiply reg/immed") + +(define-pmacro (int-shift-r-simm name op comment) + (dni (.sym name i) + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str (.sym name i) "$pack $GRi,$s12,$GRk") + (+ pack GRk op GRi s12) + (set GRk (name GRi (and s12 #x1f))) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-shift-r-simm sll OP_28 "shift left logical reg/immed") +(int-shift-r-simm srl OP_2A "shift right logical reg/immed") +(int-shift-r-simm sra OP_2C "shift right arith reg/immed") + +(dni scani + "scan immediate" + ((UNIT SCAN) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + "scani$pack $GRi,$s12,$GRk" + (+ pack GRk OP_47 GRi s12) + (scan-semantics GRi s12 GRk) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) +) + +; Format: INT, Logic, Shift cc r-simm +; +(define-pmacro (int-arith-cc-r-simm name operation op comment) + (dni name + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str name "$pack $GRi,$s10,$GRk,$ICCi_1") + (+ pack GRk op GRi ICCi_1 s10) + (sequence ((BI tmp) (QI cc) (SI result)) + (set cc ICCi_1) + (set tmp ((.sym operation -oflag) GRi s10 (const 0))) + (set-v cc tmp) + (set tmp ((.sym operation -cflag) GRi s10 (const 0))) + (set-c cc tmp) + (set result (operation GRi s10)) + (set-z-and-n cc result) + (set GRk result) + (set ICCi_1 cc)) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-arith-cc-r-simm addicc add OP_11 "add reg/immed, set icc") +(int-arith-cc-r-simm subicc sub OP_15 "sub reg/immed, set icc") + +(define-pmacro (int-logic-cc-r-simm name op comment) + (dni (.sym name icc) + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str (.sym name icc) "$pack $GRi,$s10,$GRk,$ICCi_1") + (+ pack GRk op GRi ICCi_1 s10) + (sequence ((SI tmp)) + (set tmp (name GRi s10)) + (set GRk tmp) + (set-z-and-n ICCi_1 tmp)) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-logic-cc-r-simm and OP_21 "and reg/immed, set icc") +(int-logic-cc-r-simm or OP_23 "or reg/immed, set icc") +(int-logic-cc-r-simm xor OP_25 "xor reg/immed, set icc") + +(define-pmacro (multiply-cc-r-simm name signop op comment) + (dni name + (comment) + ((UNIT MULT-DIV) (FR500-MAJOR I-1) (FR550-MAJOR I-2) (FR400-MAJOR I-1)) + (.str name "$pack $GRi,$s10,$GRdoublek,$ICCi_1") + (+ pack GRdoublek op GRi ICCi_1 s10) + (multiply-cc-semantics signop GRi s10 GRdoublek ICCi_1) + ((fr400 (unit u-imul)) + (fr500 (unit u-imul)) (fr550 (unit u-imul))) + ) +) + +(multiply-cc-r-simm smulicc ext OP_19 "signed multiply reg/immed") +(multiply-cc-r-simm umulicc zext OP_1B "unsigned multiply reg/immed") + +(define-pmacro (int-shift-cc-r-simm name l-r op comment) + (dni (.sym name icc) + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str (.sym name icc) "$pack $GRi,$s10,$GRk,$ICCi_1") + (+ pack GRk op GRi ICCi_1 s10) + (sequence ((WI shift) (SI tmp) (QI cc)) + (set shift (and s10 #x1f)) + (set cc (c-call QI (.str "@cpu@_set_icc_for_shift_" l-r) + GRi shift ICCi_1)) + (set tmp (name GRi shift)) + (set GRk tmp) + (set-z-and-n cc tmp) + (set ICCi_1 cc)) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-shift-cc-r-simm sll left OP_29 "shift left logical reg/immed, set icc") +(int-shift-cc-r-simm srl right OP_2B "shift right logical reg/immed, set icc") +(int-shift-cc-r-simm sra right OP_2D "shift right arith reg/immed, set icc") + +(define-pmacro (int-arith-x-r-simm name operation op comment) + (dni name + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str name "$pack $GRi,$s10,$GRk,$ICCi_1") + (+ pack GRk op GRi ICCi_1 s10) + (set GRk ((.sym operation c) GRi s10 (cbit ICCi_1))) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-arith-x-r-simm addxi add OP_12 "Add reg/immed, with carry") +(int-arith-x-r-simm subxi sub OP_16 "Sub reg/immed, with carry") + +(define-pmacro (int-arith-x-cc-r-simm name operation op comment) + (dni name + (comment) + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + (.str name "$pack $GRi,$s10,$GRk,$ICCi_1") + (+ pack GRk op GRi ICCi_1 s10) + (sequence ((WI tmp) (QI cc)) + (set cc ICCi_1) + (set tmp ((.sym operation c) GRi s10 (cbit cc))) + (set-v cc ((.sym operation -oflag) GRi s10 (cbit cc))) + (set-c cc ((.sym operation -cflag) GRi s10 (cbit cc))) + (set-z-and-n cc tmp) + (set GRk tmp) + (set ICCi_1 cc)) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) + ) +) + +(int-arith-x-cc-r-simm addxicc add OP_13 "Add reg/immed, with carry") +(int-arith-x-cc-r-simm subxicc sub OP_17 "Sub reg/immed, with carry") + +; Byte compare insns + +(dni cmpb + "Compare bytes" + ((UNIT IALL) (FR400-MAJOR I-1) (FR550-MAJOR I-1) (MACH fr400,fr550)) + "cmpb$pack $GRi,$GRj,$ICCi_1" + (+ pack (GRk-null) OP_00 GRi ICCi_1 OPE2_0C GRj) + (sequence ((QI cc)) + (set-n cc (eq (and GRi #xff000000) (and GRj #xff000000))) + (set-z cc (eq (and GRi #x00ff0000) (and GRj #x00ff0000))) + (set-v cc (eq (and GRi #x0000ff00) (and GRj #x0000ff00))) + (set-c cc (eq (and GRi #x000000ff) (and GRj #x000000ff))) + (set ICCi_1 cc)) + ((fr400 (unit u-integer)) (fr550 (unit u-integer))) +) + +(dni cmpba + "OR of Compare bytes" + ((UNIT IALL) (FR400-MAJOR I-1) (FR550-MAJOR I-1) (MACH fr400,fr550)) + "cmpba$pack $GRi,$GRj,$ICCi_1" + (+ pack (GRk-null) OP_00 GRi ICCi_1 OPE2_0D GRj) + (sequence ((QI cc)) + (set cc 0) + (set-c cc + (orif (eq (and GRi #xff000000) (and GRj #xff000000)) + (orif (eq (and GRi #x00ff0000) (and GRj #x00ff0000)) + (orif (eq (and GRi #x0000ff00) + (and GRj #x0000ff00)) + (eq (and GRi #x000000ff) + (and GRj #x000000ff)))))) + (set ICCi_1 cc)) + ((fr400 (unit u-integer)) (fr550 (unit u-integer))) +) + +; Format: Load immediate +; +(dni setlo + "set low order bits" + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + "setlo$pack $ulo16,$GRklo" + (+ pack GRk OP_3D (misc-null-4) u16) + (set GRklo u16) + ((fr400 (unit u-set-hilo)) + (fr500 (unit u-set-hilo)) (fr550 (unit u-set-hilo))) +) + +(dni sethi + "set high order bits" + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + "sethi$pack $uhi16,$GRkhi" + (+ pack GRkhi OP_3E (misc-null-4) u16) + (set GRkhi u16) + ((fr400 (unit u-set-hilo)) + (fr500 (unit u-set-hilo)) (fr550 (unit u-set-hilo))) +) + +(dni setlos + "set low order bits and extend sign" + ((UNIT IALL) (FR500-MAJOR I-1) (FR550-MAJOR I-1) (FR400-MAJOR I-1)) + "setlos$pack $slo16,$GRk" + (+ pack GRk OP_3F (misc-null-4) s16) + (set GRk s16) + ((fr400 (unit u-integer)) + (fr500 (unit u-integer)) (fr550 (unit u-integer))) +) + +(define-pmacro (load-gr-r name mode op ope comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2)) + (.str name "$pack @($GRi,$GRj),$GRk") + (+ pack GRk op GRi ope GRj) + (set GRk (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj))) + ((fr400 (unit u-gr-load)) + (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + ) +) + +(load-gr-r ldsb QI OP_02 OPE1_00 "Load signed byte") +(load-gr-r ldub UQI OP_02 OPE1_01 "Load unsigned byte") +(load-gr-r ldsh HI OP_02 OPE1_02 "Load signed half") +(load-gr-r lduh UHI OP_02 OPE1_03 "Load unsigned half") +(load-gr-r ld SI OP_02 OPE1_04 "Load word") + +(define-pmacro (load-fr-r name mode op ope comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) FR-ACCESS) + (.str name "$pack @($GRi,$GRj),$FRintk") + (+ pack FRintk op GRi ope GRj) + (set FRintk (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj))) + ((fr400 (unit u-fr-load)) + (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + ) +) + +(load-fr-r ldbf UQI OP_02 OPE1_08 "Load byte float") +(load-fr-r ldhf UHI OP_02 OPE1_09 "Load half float") +(load-fr-r ldf SI OP_02 OPE1_0A "Load word float") + +(define-pmacro (load-cpr-r name mode op ope reg attr comment) + (dni name + (comment) + ((UNIT LOAD) (FR500-MAJOR I-2) attr) + (.str name "$pack @($GRi,$GRj),$" reg "k") + (+ pack (.sym reg k) op GRi ope GRj) + (set (.sym reg k) + (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj))) + () + ) +) + +(load-cpr-r ldc SI OP_02 OPE1_0D CPR (MACH frv) "Load coprocessor word") + +; These correspond to enumerators in frv-sim.h +(define-pmacro (ne-UQI-size) 0) +(define-pmacro (ne-QI-size) 1) +(define-pmacro (ne-UHI-size) 2) +(define-pmacro (ne-HI-size) 3) +(define-pmacro (ne-SI-size) 4) +(define-pmacro (ne-DI-size) 5) +(define-pmacro (ne-XI-size) 6) + +(define-pmacro (ne-load-semantics base dispix targ idisp size is_float action) + (sequence ((BI do_op)) + (set do_op + (c-call BI "@cpu@_check_non_excepting_load" + (index-of base) dispix (index-of targ) + idisp size is_float)) + (if do_op action)) +) + +(define-pmacro (ne-load-gr-r name mode op ope size comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING + (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack @($GRi,$GRj),$GRk") + (+ pack GRk op GRi ope GRj) + (ne-load-semantics GRi (index-of GRj) GRk 0 size 0 + (set GRk + (c-call mode (.str "@cpu@_read_mem_" mode) + pc (add GRi GRj)))) + ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + ) +) + +(ne-load-gr-r nldsb QI OP_02 OPE1_20 (ne-QI-size) "Load signed byte") +(ne-load-gr-r nldub UQI OP_02 OPE1_21 (ne-UQI-size) "Load unsigned byte") +(ne-load-gr-r nldsh HI OP_02 OPE1_22 (ne-HI-size) "Load signed half") +(ne-load-gr-r nlduh UHI OP_02 OPE1_23 (ne-UHI-size) "Load unsigned half") +(ne-load-gr-r nld SI OP_02 OPE1_24 (ne-SI-size) "Load word") + +(define-pmacro (ne-load-fr-r name mode op ope size comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS + (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack @($GRi,$GRj),$FRintk") + (+ pack FRintk op GRi ope GRj) + (ne-load-semantics GRi (index-of GRj) FRintk 0 size 1 + (set FRintk + (c-call mode (.str "@cpu@_read_mem_" mode) + pc (add GRi GRj)))) + ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + ) +) + +(ne-load-fr-r nldbf UQI OP_02 OPE1_28 (ne-UQI-size) "Load byte float") +(ne-load-fr-r nldhf UHI OP_02 OPE1_29 (ne-UHI-size) "Load half float") +(ne-load-fr-r nldf SI OP_02 OPE1_2A (ne-SI-size) "Load word float") + +; Semantics for a load-double insn +; +(define-pmacro (load-double-semantics not_gr mode regtype address arg) + (if (orif not_gr (ne (index-of (.sym regtype doublek)) 0)) + (sequence () + (set address (add GRi arg)) + (set (.sym regtype doublek) + (c-call mode (.str "@cpu@_read_mem_" mode) pc address)))) +) + +(define-pmacro (load-double-r-r + name not_gr mode op ope regtype attr profile comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr) + (.str name "$pack @($GRi,$GRj),$" regtype "doublek") + (+ pack (.sym regtype doublek) op GRi ope GRj) + (sequence ((WI address)) + (load-double-semantics not_gr mode regtype address GRj)) + profile + ) +) + +(load-double-r-r ldd 0 DI OP_02 OPE1_05 GR NA + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + "Load double word") +(load-double-r-r lddf 1 DF OP_02 OPE1_0B FR FR-ACCESS + ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + "Load double float") +(load-double-r-r lddc 1 DI OP_02 OPE1_0E CPR (MACH frv) () + "Load coprocessor double") + +(define-pmacro (ne-load-double-r-r + name not_gr mode op ope regtype size is_float attr profile + comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr + (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack @($GRi,$GRj),$" regtype "doublek") + (+ pack (.sym regtype doublek) op GRi ope GRj) + (sequence ((WI address)) + (ne-load-semantics GRi (index-of GRj) (.sym regtype doublek) + 0 size is_float + (load-double-semantics not_gr mode + regtype + address GRj))) + profile + ) +) + +(ne-load-double-r-r nldd 0 DI OP_02 OPE1_25 GR (ne-DI-size) 0 NA + ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load double word") +(ne-load-double-r-r nlddf 1 DF OP_02 OPE1_2B FR (ne-DI-size) 1 FR-ACCESS + ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load double float") + +; Semantics for a load-quad insn +; +(define-pmacro (load-quad-semantics regtype address arg) + (sequence () + (set address (add GRi arg)) + (c-call VOID (.str "@cpu@_load_quad_" regtype) + pc address (index-of (.sym regtype k)))) +) + +(define-pmacro (load-quad-r-r name op ope regtype attr profile comment) + (dni name + (comment) + ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr) + (.str name "$pack @($GRi,$GRj),$" regtype "k") + (+ pack (.sym regtype k) op GRi ope GRj) + (sequence ((WI address)) + (load-quad-semantics regtype address GRj)) + ; TODO regtype-k not referenced for profiling + profile + ) +) + +(load-quad-r-r ldq OP_02 OPE1_06 GR NA ((fr500 (unit u-gr-load))) + "Load quad word") +(load-quad-r-r ldqf OP_02 OPE1_0C FRint FR-ACCESS ((fr500 (unit u-fr-load))) + "Load quad float") +(load-quad-r-r ldqc OP_02 OPE1_0F CPR NA () "Load coprocessor quad") + +(define-pmacro (ne-load-quad-r-r + name op ope regtype size is_float attr profile comment) + (dni name + (comment) + ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING attr) + (.str name "$pack @($GRi,$GRj),$" regtype "k") + (+ pack (.sym regtype k) op GRi ope GRj) + (sequence ((WI address)) + (ne-load-semantics GRi (index-of GRj) (.sym regtype k) + 0 size is_float + (load-quad-semantics regtype address GRj))) + ; TODO regtype-k not referenced for profiling + profile + ) +) + +(ne-load-quad-r-r nldq OP_02 OPE1_26 GR (ne-XI-size) 0 NA + ((fr500 (unit u-gr-load))) "Load quad word") +(ne-load-quad-r-r nldqf OP_02 OPE1_2C FRint (ne-XI-size) 1 FR-ACCESS + ((fr500 (unit u-fr-load))) "Load quad float") + +(define-pmacro (load-gr-u-semantics mode) + (sequence ((UWI address)) + (set address (add GRi GRj)) + (set GRk (c-call mode (.str "@cpu@_read_mem_" mode) pc address)) + (if (ne (index-of GRi) (index-of GRk)) + (sequence () + (set GRi address) + (c-call VOID "@cpu@_force_update")))) +) + +(define-pmacro (load-gr-u name mode op ope comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2)) + (.str name "$pack @($GRi,$GRj),$GRk") + (+ pack GRk op GRi ope GRj) + (load-gr-u-semantics mode) + ((fr400 (unit u-gr-load)) + (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + ) +) + +(load-gr-u ldsbu QI OP_02 OPE1_10 "Load signed byte, update index") +(load-gr-u ldubu UQI OP_02 OPE1_11 "Load unsigned byte, update index") +(load-gr-u ldshu HI OP_02 OPE1_12 "Load signed half, update index") +(load-gr-u lduhu UHI OP_02 OPE1_13 "Load unsigned half, update index") +(load-gr-u ldu SI OP_02 OPE1_14 "Load word, update index") + +(define-pmacro (ne-load-gr-u name mode op ope size comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING + (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack @($GRi,$GRj),$GRk") + (+ pack GRk op GRi ope GRj) + (ne-load-semantics GRi (index-of GRj) GRk 0 size 0 (load-gr-u-semantics mode)) + ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + ) +) + +(ne-load-gr-u nldsbu QI OP_02 OPE1_30 (ne-QI-size) "Load signed byte, update index") +(ne-load-gr-u nldubu UQI OP_02 OPE1_31 (ne-UQI-size) "Load unsigned byte, update index") +(ne-load-gr-u nldshu HI OP_02 OPE1_32 (ne-HI-size) "Load signed half, update index") +(ne-load-gr-u nlduhu UHI OP_02 OPE1_33 (ne-UHI-size) "Load unsigned half, update index") +(ne-load-gr-u nldu SI OP_02 OPE1_34 (ne-SI-size) "Load word, update index") + +(define-pmacro (load-non-gr-u-semantics mode regtype) + (sequence ((UWI address)) + (set address (add GRi GRj)) + (set (.sym regtype k) + (c-call mode (.str "@cpu@_read_mem_" mode) pc address)) + (set GRi address) + (c-call VOID "@cpu@_force_update")) +) + +(define-pmacro (load-fr-u name mode op ope comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) FR-ACCESS) + (.str name "$pack @($GRi,$GRj),$FRintk") + (+ pack FRintk op GRi ope GRj) + (load-non-gr-u-semantics mode FRint) + ((fr400 (unit u-fr-load)) + (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + ) +) + +(load-fr-u ldbfu UQI OP_02 OPE1_18 "Load byte float, update index") +(load-fr-u ldhfu UHI OP_02 OPE1_19 "Load half float, update index") +(load-fr-u ldfu SI OP_02 OPE1_1A "Load word float, update index") + +(define-pmacro (load-cpr-u name mode op ope comment) + (dni name + (comment) + ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv)) + (.str name "$pack @($GRi,$GRj),$CPRk") + (+ pack CPRk op GRi ope GRj) + (load-non-gr-u-semantics mode CPR) + () + ) +) + +(load-cpr-u ldcu SI OP_02 OPE1_1D "Load coprocessor word float,update index") + +(define-pmacro (ne-load-non-gr-u name mode op ope regtype size comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS + (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack @($GRi,$GRj),$" regtype "k") + (+ pack (.sym regtype k) op GRi ope GRj) + (ne-load-semantics GRi (index-of GRj) (.sym regtype k) 0 size 1 + (load-non-gr-u-semantics mode regtype)) + ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + ) +) + +(ne-load-non-gr-u nldbfu UQI OP_02 OPE1_38 FRint (ne-UQI-size) "Load byte float, update index") +(ne-load-non-gr-u nldhfu UHI OP_02 OPE1_39 FRint (ne-UHI-size) "Load half float, update index") +(ne-load-non-gr-u nldfu SI OP_02 OPE1_3A FRint (ne-SI-size) "Load word float, update index") + +(define-pmacro (load-double-gr-u-semantics) + (sequence ((WI address)) + (load-double-semantics 0 DI GR address GRj) + (if (ne (index-of GRi) (index-of GRdoublek)) + (sequence () + (set GRi address) + (c-call VOID "@cpu@_force_update")))) +) + +(define-pmacro (load-double-gr-u name op ope comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2)) + (.str name "$pack @($GRi,$GRj),$GRdoublek") + (+ pack GRdoublek op GRi ope GRj) + (load-double-gr-u-semantics) + ((fr400 (unit u-gr-load)) + (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + ) +) + +(load-double-gr-u lddu OP_02 OPE1_15 "Load double word, update index") + +(define-pmacro (ne-load-double-gr-u name op ope size comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING + (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack @($GRi,$GRj),$GRdoublek") + (+ pack GRdoublek op GRi ope GRj) + (ne-load-semantics GRi (index-of GRj) GRdoublek 0 size 0 + (load-double-gr-u-semantics)) + ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + + ) +) + +(ne-load-double-gr-u nlddu OP_02 OPE1_35 (ne-DI-size) "Load double word, update index") + +(define-pmacro (load-double-non-gr-u-semantics mode regtype) + (sequence ((WI address)) + (load-double-semantics 1 mode regtype address GRj) + (set GRi address) + (c-call VOID "@cpu@_force_update")) +) + +(define-pmacro (load-double-non-gr-u + name mode op ope regtype attr profile comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr) + (.str name "$pack @($GRi,$GRj),$" regtype "doublek") + (+ pack (.sym regtype doublek) op GRi ope GRj) + (load-double-non-gr-u-semantics mode regtype) + profile + ) +) + +(load-double-non-gr-u lddfu DF OP_02 OPE1_1B FR FR-ACCESS + ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + "Load double float, update index") +(load-double-non-gr-u lddcu DI OP_02 OPE1_1E CPR (MACH frv) + () "Load coprocessor double float, update index") + +(define-pmacro (ne-load-double-non-gr-u name mode op ope regtype size comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING FR-ACCESS + (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack @($GRi,$GRj),$" regtype "doublek") + (+ pack (.sym regtype doublek) op GRi ope GRj) + (ne-load-semantics GRi (index-of GRj) (.sym regtype doublek) 0 size 1 + (load-double-non-gr-u-semantics mode regtype)) + ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + ) +) + +(ne-load-double-non-gr-u nlddfu DF OP_02 OPE1_3B FR (ne-DI-size) "Load double float, update index") + +(define-pmacro (load-quad-gr-u-semantics) + (sequence ((WI address)) + (load-quad-semantics GR address GRj) + (if (ne (index-of GRi) (index-of GRk)) + (sequence () + (set GRi address) + (c-call VOID "@cpu@_force_update")))) +) + +(define-pmacro (load-quad-gr-u name op ope comment) + (dni name + (comment) + ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv)) + (.str name "$pack @($GRi,$GRj),$GRk") + (+ pack GRk op GRi ope GRj) + (load-quad-gr-u-semantics) + ; TODO - GRk not referenced here for profiling + ((fr500 (unit u-gr-load))) + ) +) + +(load-quad-gr-u ldqu OP_02 OPE1_16 "Load quad word, update index") + +(define-pmacro (ne-load-quad-gr-u name op ope size comment) + (dni name + (comment) + ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING) + (.str name "$pack @($GRi,$GRj),$GRk") + (+ pack GRk op GRi ope GRj) + (ne-load-semantics GRi (index-of GRj) GRk 0 size 0 + (load-quad-gr-u-semantics)) + ; TODO - GRk not referenced here for profiling + ((fr500 (unit u-gr-load))) + ) +) + +(ne-load-quad-gr-u nldqu OP_02 OPE1_36 (ne-XI-size) "Load quad word, update index") + +(define-pmacro (load-quad-non-gr-u-semantics regtype) + (sequence ((WI address)) + (load-quad-semantics regtype address GRj) + (set GRi address) + (c-call VOID "@cpu@_force_update")) +) + +(define-pmacro (load-quad-non-gr-u name op ope regtype attr profile comment) + (dni name + (comment) + ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr) + (.str name "$pack @($GRi,$GRj),$" regtype "k") + (+ pack (.sym regtype k) op GRi ope GRj) + (load-quad-non-gr-u-semantics regtype) + profile + ) +) + +(load-quad-non-gr-u ldqfu OP_02 OPE1_1C FRint FR-ACCESS + ((fr500 (unit u-fr-load))) "Load quad float, update index") +(load-quad-non-gr-u ldqcu OP_02 OPE1_1F CPR NA + () "Load coprocessor quad word, update index") + +(define-pmacro (ne-load-quad-non-gr-u name op ope regtype size comment) + (dni name + (comment) + ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING FR-ACCESS) + (.str name "$pack @($GRi,$GRj),$" regtype "k") + (+ pack (.sym regtype k) op GRi ope GRj) + (ne-load-semantics GRi (index-of GRj) (.sym regtype k) 0 size 1 + (load-quad-non-gr-u-semantics regtype)) + ((fr500 (unit u-fr-load))) + ) +) + +(ne-load-quad-non-gr-u nldqfu OP_02 OPE1_3C FRint (ne-XI-size) "Load quad float,update index") + +(define-pmacro (load-r-simm name mode op regtype attr profile comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr) + (.str name "$pack @($GRi,$d12),$" regtype "k") + (+ pack (.sym regtype k) op GRi d12) + (set (.sym regtype k) + (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi d12))) + profile + ) +) + +(load-r-simm ldsbi QI OP_30 GR NA + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + "Load signed byte") +(load-r-simm ldshi HI OP_31 GR NA + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + "Load signed half") +(load-r-simm ldi SI OP_32 GR NA + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + "Load word") +(load-r-simm ldubi UQI OP_35 GR NA + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + "Load unsigned byte") +(load-r-simm lduhi UHI OP_36 GR NA + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + "Load unsigned half") + +(load-r-simm ldbfi UQI OP_38 FRint FR-ACCESS + ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + "Load byte float") +(load-r-simm ldhfi UHI OP_39 FRint FR-ACCESS + ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + "Load half float") +(load-r-simm ldfi SI OP_3A FRint FR-ACCESS + ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + "Load word float") + +(define-pmacro (ne-load-r-simm + name mode op regtype size is_float attr profile comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr + (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack @($GRi,$d12),$" regtype "k") + (+ pack (.sym regtype k) op GRi d12) + (ne-load-semantics GRi -1 (.sym regtype k) d12 size is_float + (set (.sym regtype k) + (c-call mode (.str "@cpu@_read_mem_" mode) + pc (add GRi d12)))) + profile + ) +) + +(ne-load-r-simm nldsbi QI OP_40 GR (ne-QI-size) 0 NA + ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load signed byte") +(ne-load-r-simm nldubi UQI OP_41 GR (ne-UQI-size) 0 NA + ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load unsigned byte") +(ne-load-r-simm nldshi HI OP_42 GR (ne-HI-size) 0 NA + ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load signed half") +(ne-load-r-simm nlduhi UHI OP_43 GR (ne-UHI-size) 0 NA + ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load unsigned half") +(ne-load-r-simm nldi SI OP_44 GR (ne-SI-size) 0 NA + ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load word") + +(ne-load-r-simm nldbfi UQI OP_48 FRint (ne-UQI-size) 1 FR-ACCESS + ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load byte float") +(ne-load-r-simm nldhfi UHI OP_49 FRint (ne-UHI-size) 1 FR-ACCESS + ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load half float") +(ne-load-r-simm nldfi SI OP_4A FRint (ne-SI-size) 1 FR-ACCESS + ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load word float") + +(define-pmacro (load-double-r-simm + name not_gr mode op regtype attr profile comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) attr) + (.str name "$pack @($GRi,$d12),$" regtype "doublek") + (+ pack (.sym regtype doublek) op GRi d12) + (sequence ((WI address)) + (load-double-semantics not_gr mode regtype address d12)) + profile + ) +) + +(load-double-r-simm lddi 0 DI OP_33 GR NA + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + "Load double word") +(load-double-r-simm lddfi 1 DF OP_3B FR FR-ACCESS + ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + "Load double float") + +(define-pmacro (ne-load-double-r-simm + name not_gr mode op regtype size is_float attr profile comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) NON-EXCEPTING attr + (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack @($GRi,$d12),$" regtype "doublek") + (+ pack (.sym regtype doublek) op GRi d12) + (sequence ((WI address)) + (ne-load-semantics GRi -1 (.sym regtype doublek) + d12 size is_float + (load-double-semantics not_gr mode + regtype + address d12))) + profile + ) +) + +(ne-load-double-r-simm nlddi 0 DI OP_45 GR (ne-DI-size) 0 NA + ((fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) "Load double word") +(ne-load-double-r-simm nlddfi 1 DF OP_4B FR (ne-DI-size) 1 FR-ACCESS + ((fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) "Load double float") + +(define-pmacro (load-quad-r-simm name op regtype attr profile comment) + (dni name + (comment) + ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) attr) + (.str name "$pack @($GRi,$d12),$" regtype "k") + (+ pack (.sym regtype k) op GRi d12) + (sequence ((WI address)) + (load-quad-semantics regtype address d12)) + profile + ) +) + +(load-quad-r-simm ldqi OP_34 GR NA + ((fr500 (unit u-gr-load))) "Load quad word") +(load-quad-r-simm ldqfi OP_3C FRint FR-ACCESS + ((fr500 (unit u-fr-load))) "Load quad float") + +(define-pmacro (ne-load-quad-r-simm + name op regtype size is_float attr profile comment) + (dni name + (comment) + ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) NON-EXCEPTING attr) + (.str name "$pack @($GRi,$d12),$" regtype "k") + (+ pack (.sym regtype k) op GRi d12) + (sequence ((WI address)) + (ne-load-semantics GRi -1 (.sym regtype k) d12 size is_float + (load-quad-semantics regtype address d12))) + profile + ) +) + +(ne-load-quad-r-simm nldqfi OP_4C FRint (ne-XI-size) 1 FR-ACCESS + ((fr500 (unit u-fr-load))) "Load quad float") + +(define-pmacro (store-r-r name mode op ope reg attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr) + (.str name "$pack $" reg "k,@($GRi,$GRj)") + (+ pack (.sym reg k) op GRi ope GRj) + (c-call VOID (.str "@cpu@_write_mem_" mode) + pc (add GRi GRj) (.sym reg k)) + profile + ) +) + +(store-r-r stb QI OP_03 OPE1_00 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store unsigned byte") +(store-r-r sth HI OP_03 OPE1_01 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store unsigned half") +(store-r-r st SI OP_03 OPE1_02 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store word") + +(store-r-r stbf QI OP_03 OPE1_08 FRint FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store byte float") +(store-r-r sthf HI OP_03 OPE1_09 FRint FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store half float") +(store-r-r stf SI OP_03 OPE1_0A FRint FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store word float") + +(store-r-r stc SI OP_03 OPE1_25 CPR (MACH frv) () "Store coprocessor word") + +(define-pmacro (r-store name mode op ope reg size is_float profile comment) + (dni name + (comment) + ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv)) + (.str name "$pack $" reg "k,@($GRi,$GRj)") + (+ pack (.sym reg k) op GRi ope GRj) + (sequence ((WI address)) + (set address (add GRi GRj)) + (c-call VOID (.str "@cpu@_write_mem_" mode) + pc address (.sym reg k)) + (c-call VOID "@cpu@_check_recovering_store" + address (index-of (.sym reg k)) size is_float)) + profile + ) +) + +(r-store rstb QI OP_03 OPE1_20 GR 1 0 + ((fr500 (unit u-gr-r-store))) "Store unsigned byte") +(r-store rsth HI OP_03 OPE1_21 GR 2 0 + ((fr500 (unit u-gr-r-store))) "Store unsigned half") +(r-store rst SI OP_03 OPE1_22 GR 4 0 + ((fr500 (unit u-gr-r-store))) "Store word") + +(r-store rstbf QI OP_03 OPE1_28 FRint 1 1 + ((fr500 (unit u-fr-r-store))) "Store byte float") +(r-store rsthf HI OP_03 OPE1_29 FRint 2 1 + ((fr500 (unit u-fr-r-store))) "Store half float") +(r-store rstf SI OP_03 OPE1_2A FRint 4 1 + ((fr500 (unit u-fr-r-store))) "Store word float") + +; Semantics for a store-double insn +; +(define-pmacro (store-double-semantics mode regtype address arg) + (sequence () + (set address (add GRi arg)) + (c-call VOID (.str "@cpu@_write_mem_" mode) + pc address (.sym regtype doublek))) +) + +(define-pmacro (store-double-r-r name mode op ope regtype attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr) + (.str name "$pack $" regtype "doublek,@($GRi,$GRj)") + (+ pack (.sym regtype doublek) op GRi ope GRj) + (sequence ((WI address)) + (store-double-semantics mode regtype address GRj)) + profile + ) +) + +(store-double-r-r std DI OP_03 OPE1_03 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store double word") +(store-double-r-r stdf DF OP_03 OPE1_0B FR FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store double float") + +(store-double-r-r stdc DI OP_03 OPE1_26 CPR (MACH frv) + () "Store coprocessor double word") + +(define-pmacro (r-store-double + name mode op ope regtype is_float attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr) + (.str name "$pack $" regtype "doublek,@($GRi,$GRj)") + (+ pack (.sym regtype doublek) op GRi ope GRj) + (sequence ((WI address)) + (store-double-semantics mode regtype address GRj) + (c-call VOID "@cpu@_check_recovering_store" + address (index-of (.sym regtype doublek)) 8 is_float)) + profile + ) +) + +(r-store-double rstd DI OP_03 OPE1_23 GR 0 NA + ((fr500 (unit u-gr-r-store))) "Store double word") +(r-store-double rstdf DF OP_03 OPE1_2B FR 1 FR-ACCESS + ((fr500 (unit u-fr-r-store))) "Store double float") + +; Semantics for a store-quad insn +; +(define-pmacro (store-quad-semantics regtype address arg) + (sequence () + (set address (add GRi arg)) + (c-call VOID (.str "@cpu@_store_quad_" regtype) + pc address (index-of (.sym regtype k)))) +) + +(define-pmacro (store-quad-r-r name op ope regtype attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr) + (.str name "$pack $" regtype "k,@($GRi,$GRj)") + (+ pack (.sym regtype k) op GRi ope GRj) + (sequence ((WI address)) + (store-quad-semantics regtype address GRj)) + profile + ) +) + +(store-quad-r-r stq OP_03 OPE1_04 GR NA + ((fr500 (unit u-gr-store))) "Store quad word") +(store-quad-r-r stqf OP_03 OPE1_0C FRint FR-ACCESS + ((fr500 (unit u-fr-store))) + "Store quad float") +(store-quad-r-r stqc OP_03 OPE1_27 CPR NA + () "Store coprocessor quad word") + +(define-pmacro (r-store-quad name op ope regtype is_float attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr) + (.str name "$pack $" regtype "k,@($GRi,$GRj)") + (+ pack (.sym regtype k) op GRi ope GRj) + (sequence ((WI address)) + (store-quad-semantics regtype address GRj) + (c-call VOID "@cpu@_check_recovering_store" + address (index-of (.sym regtype k)) 16 is_float)) + profile + ) +) + +(r-store-quad rstq OP_03 OPE1_24 GR 0 NA + ((fr500 (unit u-gr-r-store))) "Store quad word") +(r-store-quad rstqf OP_03 OPE1_2C FRint 1 FR-ACCESS + ((fr500 (unit u-fr-r-store))) "Store quad float") + +(define-pmacro (store-r-r-u name mode op ope regtype attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr) + (.str name "$pack $" regtype "k,@($GRi,$GRj)") + (+ pack (.sym regtype k) op GRi ope GRj) + (sequence ((UWI address)) + (set address (add GRi GRj)) + (c-call VOID (.str "@cpu@_write_mem_" mode) + pc address (.sym regtype k)) + (set GRi address)) + profile + ) +) + +(store-r-r-u stbu QI OP_03 OPE1_10 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store unsigned byte, update index") +(store-r-r-u sthu HI OP_03 OPE1_11 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store unsigned half, update index") +(store-r-r-u stu WI OP_03 OPE1_12 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store word, update index") + +(store-r-r-u stbfu QI OP_03 OPE1_18 FRint FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store byte float, update index") +(store-r-r-u sthfu HI OP_03 OPE1_19 FRint FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store half float, update index") +(store-r-r-u stfu SI OP_03 OPE1_1A FRint FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store word float, update index") + +(store-r-r-u stcu SI OP_03 OPE1_2D CPR (MACH frv) () + "Store coprocessor word, update index") + +(define-pmacro (store-double-r-r-u + name mode op ope regtype attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr) + (.str name "$pack $" regtype "doublek,@($GRi,$GRj)") + (+ pack (.sym regtype doublek) op GRi ope GRj) + (sequence ((WI address)) + (store-double-semantics mode regtype address GRj) + (set GRi address)) + profile + ) +) + +(store-double-r-r-u stdu DI OP_03 OPE1_13 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store double word, update index") +(store-double-r-r-u stdfu DF OP_03 OPE1_1B FR FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store double float,update index") +(store-double-r-r-u stdcu DI OP_03 OPE1_2E CPR (MACH frv) () + "Store coprocessor double word, update index") + +(define-pmacro (store-quad-r-r-u name op ope regtype attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr) + (.str name "$pack $" regtype "k,@($GRi,$GRj)") + (+ pack (.sym regtype k) op GRi ope GRj) + (sequence ((WI address)) + (store-quad-semantics regtype address GRj) + (set GRi address)) + profile + ) +) + +(store-quad-r-r-u stqu OP_03 OPE1_14 GR NA + ((fr500 (unit u-gr-store))) + "Store quad word, update index") +(store-quad-r-r-u stqfu OP_03 OPE1_1C FRint FR-ACCESS + ((fr500 (unit u-fr-store))) + "Store quad float, update index") +(store-quad-r-r-u stqcu OP_03 OPE1_2F CPR NA () + "Store coprocessor quad word, update index") + +(define-pmacro (conditional-load name mode op ope regtype profile comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL) + (.str name "$pack @($GRi,$GRj),$" regtype "k,$CCi,$cond") + (+ pack (.sym regtype k) op GRi CCi cond ope GRj) + (if (eq CCi (or cond 2)) + (set (.sym regtype k) + (c-call mode (.str "@cpu@_read_mem_" mode) pc (add GRi GRj)))) + profile + ) +) + +(conditional-load cldsb QI OP_5E OPE4_0 GR + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + "Load signed byte") +(conditional-load cldub UQI OP_5E OPE4_1 GR + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + "Load unsigned byte") +(conditional-load cldsh HI OP_5E OPE4_2 GR + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + "Load signed half") +(conditional-load clduh UHI OP_5E OPE4_3 GR + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + "Load unsigned half") +(conditional-load cld SI OP_5F OPE4_0 GR + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + "Load word") + +(conditional-load cldbf UQI OP_60 OPE4_0 FRint + ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + "Load byte float") +(conditional-load cldhf UHI OP_60 OPE4_1 FRint + ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + "Load half float") +(conditional-load cldf SI OP_60 OPE4_2 FRint + ((fr400 (unit u-fr-load)) (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + "Load word float") + +(define-pmacro (conditional-load-double + name not_gr mode op ope regtype attr profile comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL attr) + (.str name "$pack @($GRi,$GRj),$" regtype "doublek,$CCi,$cond") + (+ pack (.sym regtype doublek) op GRi CCi cond ope GRj) + (if (eq CCi (or cond 2)) + (sequence ((WI address)) + (load-double-semantics not_gr mode regtype address GRj))) + profile + ) +) + +(conditional-load-double cldd 0 DI OP_5F OPE4_1 GR NA + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + "Load double word") +(conditional-load-double clddf 1 DF OP_60 OPE4_3 FR FR-ACCESS + ((fr400 (unit u-gr-load)) (fr500 (unit u-gr-load)) (fr550 (unit u-fr-load))) + "Load double float") + +(dni cldq + "conditional load quad integer" + ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) CONDITIONAL) + "cldq$pack @($GRi,$GRj),$GRk,$CCi,$cond" + (+ pack GRk OP_5F GRi CCi cond OPE4_2 GRj) + (if (eq CCi (or cond 2)) + (sequence ((WI address)) + (load-quad-semantics GR address GRj))) + ((fr500 (unit u-gr-load))) +) + +(define-pmacro (conditional-load-gr-u name mode op ope comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL) + (.str name "$pack @($GRi,$GRj),$GRk,$CCi,$cond") + (+ pack GRk op GRi CCi cond ope GRj) + (if (eq CCi (or cond 2)) + (sequence ((WI address)) + (set address (add GRi GRj)) + (set GRk + (c-call mode (.str "@cpu@_read_mem_" mode) + pc address)) + (if (ne (index-of GRi) (index-of GRk)) + (set GRi address)))) + ((fr400 (unit u-gr-load)) + (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) + ) +) + +(conditional-load-gr-u cldsbu QI OP_61 OPE4_0 "Load signed byte, update") +(conditional-load-gr-u cldubu UQI OP_61 OPE4_1 "Load unsigned byte, update") +(conditional-load-gr-u cldshu HI OP_61 OPE4_2 "Load signed half, update") +(conditional-load-gr-u clduhu UHI OP_61 OPE4_3 "Load unsigned half, update") +(conditional-load-gr-u cldu SI OP_62 OPE4_0 "Load word, update") + +(define-pmacro (conditional-load-non-gr-u name mode op ope regtype comment) + (dni name + (comment) + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL FR-ACCESS) + (.str name "$pack @($GRi,$GRj),$" regtype "k,$CCi,$cond") + (+ pack (.sym regtype k) op GRi CCi cond ope GRj) + (if (eq CCi (or cond 2)) + (sequence ((WI address)) + (set address (add GRi GRj)) + (set (.sym regtype k) + (c-call mode (.str "@cpu@_read_mem_" mode) + pc address)) + (set GRi address))) + ((fr400 (unit u-fr-load)) + (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) + ) +) + +(conditional-load-non-gr-u cldbfu UQI OP_63 OPE4_0 FRint "Load byte float, update") +(conditional-load-non-gr-u cldhfu UHI OP_63 OPE4_1 FRint "Load half float, update") +(conditional-load-non-gr-u cldfu SI OP_63 OPE4_2 FRint "Load word float, update") + + +(dni clddu + "Load double word, update" + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL) + "clddu$pack @($GRi,$GRj),$GRdoublek,$CCi,$cond" + (+ pack GRdoublek OP_62 GRi CCi cond OPE4_1 GRj) + (if (eq CCi (or cond 2)) + (sequence ((WI address)) + (load-double-semantics 0 DI GR address GRj) + (if (ne (index-of GRi) (index-of GRdoublek)) + (set GRi address)))) + ((fr400 (unit u-gr-load)) + (fr500 (unit u-gr-load)) (fr550 (unit u-gr-load))) +) + +(dni clddfu + "Load double float, update" + ((UNIT LOAD) (FR550-MAJOR I-3) (FR500-MAJOR I-2) (FR400-MAJOR I-2) CONDITIONAL FR-ACCESS) + "clddfu$pack @($GRi,$GRj),$FRdoublek,$CCi,$cond" + (+ pack FRdoublek OP_63 GRi CCi cond OPE4_3 GRj) + (if (eq CCi (or cond 2)) + (sequence ((WI address)) + (load-double-semantics 1 DF FR address GRj) + (set GRi address))) + ((fr400 (unit u-fr-load)) + (fr500 (unit u-fr-load)) (fr550 (unit u-fr-load))) +) + +(dni cldqu + "conditional load quad integer and update index" + ((UNIT LOAD) (FR500-MAJOR I-2) (MACH frv) CONDITIONAL) + "cldqu$pack @($GRi,$GRj),$GRk,$CCi,$cond" + (+ pack GRk OP_62 GRi CCi cond OPE4_2 GRj) + (if (eq CCi (or cond 2)) + (sequence ((WI address)) + (load-quad-semantics GR address GRj) + (if (ne (index-of GRi) (index-of GRk)) + (set GRi address)))) + ((fr500 (unit u-gr-load))) +) + +(define-pmacro (conditional-store name mode op ope regtype profile comment) + (dni name + (comment) + ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL) + (.str name "$pack $" regtype "k,@($GRi,$GRj),$CCi,$cond") + (+ pack (.sym regtype k) op GRi CCi cond ope GRj) + (if (eq CCi (or cond 2)) + (c-call VOID (.str "@cpu@_write_mem_" mode) + pc (add GRi GRj) (.sym regtype k))) + profile + ) +) + +(conditional-store cstb QI OP_64 OPE4_0 GR + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store unsigned byte") +(conditional-store csth HI OP_64 OPE4_1 GR + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store unsigned half") +(conditional-store cst SI OP_64 OPE4_2 GR + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store word") + +(conditional-store cstbf QI OP_66 OPE4_0 FRint + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store byte float") +(conditional-store csthf HI OP_66 OPE4_1 FRint + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store half float") +(conditional-store cstf SI OP_66 OPE4_2 FRint + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store word float") + +(define-pmacro (conditional-store-double + name mode op ope regtype attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL attr) + (.str name "$pack $" regtype "doublek,@($GRi,$GRj),$CCi,$cond") + (+ pack (.sym regtype doublek) op GRi CCi cond ope GRj) + (if (eq CCi (or cond 2)) + (sequence ((WI address)) + (store-double-semantics mode regtype address GRj))) + profile + ) +) + +(conditional-store-double cstd DI OP_64 OPE4_3 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store double word") +(conditional-store-double cstdf DF OP_66 OPE4_3 FR FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store double float") + +(dni cstq + "conditionally store quad word" + ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) CONDITIONAL) + "cstq$pack $GRk,@($GRi,$GRj),$CCi,$cond" + (+ pack GRk OP_65 GRi CCi cond OPE4_0 GRj) + (if (eq CCi (or cond 2)) + (sequence ((WI address)) + (store-quad-semantics GR address GRj))) + ((fr500 (unit u-gr-store))) +) + +(define-pmacro (conditional-store-u + name mode op ope regtype attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL attr) + (.str name "$pack $" regtype "k,@($GRi,$GRj),$CCi,$cond") + (+ pack (.sym regtype k) op GRi CCi cond ope GRj) + (if (eq CCi (or cond 2)) + (sequence ((WI address)) + (set address (add GRi GRj)) + (c-call VOID (.str "@cpu@_write_mem_" mode) + pc address (.sym regtype k)) + (set GRi address))) + profile + ) +) + +(conditional-store-u cstbu QI OP_67 OPE4_0 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store unsigned byte, update index") +(conditional-store-u csthu HI OP_67 OPE4_1 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store unsigned half, update index") +(conditional-store-u cstu SI OP_67 OPE4_2 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store word, update index") + +(conditional-store-u cstbfu QI OP_68 OPE4_0 FRint FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store byte float, update index") +(conditional-store-u csthfu HI OP_68 OPE4_1 FRint FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store half float, update index") +(conditional-store-u cstfu SI OP_68 OPE4_2 FRint FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store word float, update index") + +(define-pmacro (conditional-store-double-u + name mode op ope regtype attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) CONDITIONAL attr) + (.str name "$pack $" regtype "doublek,@($GRi,$GRj),$CCi,$cond") + (+ pack (.sym regtype doublek) op GRi CCi cond ope GRj) + (if (eq CCi (or cond 2)) + (sequence ((WI address)) + (store-double-semantics mode regtype address GRj) + (set GRi address))) + profile + ) +) + +(conditional-store-double-u cstdu DI OP_67 OPE4_3 GR NA + ((fr400 (unit u-gr-store)) + (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store double word, update index") +(conditional-store-double-u cstdfu DF OP_68 OPE4_3 FR FR-ACCESS + ((fr400 (unit u-fr-store)) + (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store double float, update index") + +(define-pmacro (store-r-simm name mode op regtype attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr) + (.str name "$pack $" regtype "k,@($GRi,$d12)") + (+ pack (.sym regtype k) op GRi d12) + (c-call VOID (.str "@cpu@_write_mem_" mode) + pc (add GRi d12) (.sym regtype k)) + profile + ) +) + +(store-r-simm stbi QI OP_50 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store unsigned byte") +(store-r-simm sthi HI OP_51 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store unsigned half") +(store-r-simm sti SI OP_52 GR NA + ((fr400 (unit u-gr-store)) (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store word") + +(store-r-simm stbfi QI OP_4E FRint FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store byte float") +(store-r-simm sthfi HI OP_4F FRint FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store half float") +(store-r-simm stfi SI OP_55 FRint FR-ACCESS + ((fr400 (unit u-fr-store)) (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store word float") + +(define-pmacro (store-double-r-simm name mode op regtype attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR550-MAJOR I-4) (FR500-MAJOR I-3) (FR400-MAJOR I-3) attr) + (.str name "$pack $" regtype "doublek,@($GRi,$d12)") + (+ pack (.sym regtype doublek) op GRi d12) + (sequence ((WI address)) + (store-double-semantics mode regtype address d12)) + profile + ) +) + +(store-double-r-simm stdi DI OP_53 GR NA + ((fr400 (unit u-gr-store)) + (fr500 (unit u-gr-store)) (fr550 (unit u-gr-store))) + "Store double word") +(store-double-r-simm stdfi DF OP_56 FR FR-ACCESS + ((fr400 (unit u-fr-store)) + (fr500 (unit u-fr-store)) (fr550 (unit u-fr-store))) + "Store double float") + +(define-pmacro (store-quad-r-simm name op regtype attr profile comment) + (dni name + (comment) + ((UNIT STORE) (FR500-MAJOR I-3) (MACH frv) attr) + (.str name "$pack $" regtype "k,@($GRi,$d12)") + (+ pack (.sym regtype k) op GRi d12) + (sequence ((WI address)) + (store-quad-semantics regtype address d12)) + profile + ) +) + +(store-quad-r-simm stqi OP_54 GR NA ((fr500 (unit u-gr-store))) + "Store quad word") +(store-quad-r-simm stqfi OP_57 FRint FR-ACCESS () + "Store quad float") + +(define-pmacro (swap-semantics base offset arg) + (sequence ((WI tmp) (WI address)) + (set tmp arg) + (set address (add base offset)) + (c-call VOID "@cpu@_check_swap_address" address) + (set arg (c-call WI "@cpu@_read_mem_WI" pc address)) + (c-call VOID "@cpu@_write_mem_WI" pc address tmp)) +) + +(dni swap + "Swap contents of memory with GR" + ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2)) + "swap$pack @($GRi,$GRj),$GRk" + (+ pack GRk OP_03 GRi OPE1_05 GRj) + (swap-semantics GRi GRj GRk) + ((fr400 (unit u-swap)) + (fr500 (unit u-swap)) (fr550 (unit u-swap))) +) + +(dni "swapi" + "Swap contents of memory with GR" + ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2)) + ("swapi$pack @($GRi,$d12),$GRk") + (+ pack GRk OP_4D GRi d12) + (swap-semantics GRi d12 GRk) + ((fr400 (unit u-swap)) + (fr500 (unit u-swap)) (fr550 (unit u-swap))) +) + +(dni cswap + "Conditionally swap contents of memory with GR" + ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2) CONDITIONAL) + "cswap$pack @($GRi,$GRj),$GRk,$CCi,$cond" + (+ pack GRk OP_65 GRi CCi cond OPE4_2 GRj) + (if (eq CCi (or cond 2)) + (swap-semantics GRi GRj GRk)) + ((fr400 (unit u-swap)) + (fr500 (unit u-swap)) (fr550 (unit u-swap))) +) + +(define-pmacro (register-transfer + name op ope reg_src reg_targ pipe attrs profile comment) + (dni name + (comment) + (.splice (UNIT pipe) (.unsplice attrs)) + (.str name "$pack $" reg_src ",$" reg_targ) + (+ pack reg_targ op (rs-null) ope reg_src) + (set reg_targ reg_src) + profile + ) +) + +(register-transfer movgf OP_03 OPE1_15 + GRj FRintk I0 + ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS) + ((fr400 (unit u-gr2fr)) (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr))) + "transfer gr to fr") +(register-transfer movfg OP_03 OPE1_0D + FRintk GRj I0 + ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS) + ((fr400 (unit u-fr2gr)) (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr))) + "transfer fr to gr") + +(define-pmacro (nextreg hw r offset) (reg hw (add (index-of r) offset))) + +(define-pmacro (register-transfer-double-from-gr-semantics cond) + (if cond + (if (eq (index-of GRj) 0) + (sequence () + (set FRintk 0) + (set (nextreg h-fr_int FRintk 1) 0)) + (sequence () + (set FRintk GRj) + (set (nextreg h-fr_int FRintk 1) (nextreg h-gr GRj 1))))) +) + +(dni movgfd + "move GR for FR double" + ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS) + "movgfd$pack $GRj,$FRintk" + (+ pack FRintk OP_03 (rs-null) OPE1_16 GRj) + (register-transfer-double-from-gr-semantics 1) + ; TODO -- doesn't handle second register in the pair + ((fr400 (unit u-gr2fr)) + (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr))) +) + +(define-pmacro (register-transfer-double-to-gr-semantics cond) + (if (andif (ne (index-of GRj) 0) cond) + (sequence () + (set GRj FRintk) + (set (nextreg h-gr GRj 1) (nextreg h-fr_int FRintk 1)))) +) + +(dni movfgd + "move FR for GR double" + ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) FR-ACCESS) + "movfgd$pack $FRintk,$GRj" + (+ pack FRintk OP_03 (rs-null) OPE1_0E GRj) + (register-transfer-double-to-gr-semantics 1) + ; TODO -- doesn't handle second register in the pair + ((fr400 (unit u-fr2gr)) + (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr))) +) + +(dni movgfq + "move GR for FR quad" + ((UNIT I0) (FR500-MAJOR I-4) (MACH frv) FR-ACCESS) + "movgfq$pack $GRj,$FRintk" + (+ pack FRintk OP_03 (rs-null) OPE1_17 GRj) + (if (eq (index-of GRj) 0) + (sequence () + (set FRintk 0) + (set (reg h-fr_int (add (index-of FRintk) 1)) 0) + (set (reg h-fr_int (add (index-of FRintk) 2)) 0) + (set (reg h-fr_int (add (index-of FRintk) 3)) 0)) + (sequence () + (set FRintk GRj) + (set (reg h-fr_int (add (index-of FRintk) 1)) + (reg h-gr (add (index-of GRj) 1))) + (set (reg h-fr_int (add (index-of FRintk) 2)) + (reg h-gr (add (index-of GRj) 2))) + (set (reg h-fr_int (add (index-of FRintk) 3)) + (reg h-gr (add (index-of GRj) 3))))) + () +) + +(dni movfgq + "move FR for GR quad" + ((UNIT I0) (FR500-MAJOR I-4) (MACH frv) FR-ACCESS) + "movfgq$pack $FRintk,$GRj" + (+ pack FRintk OP_03 (rs-null) OPE1_0F GRj) + (if (ne (index-of GRj) 0) + (sequence () + (set GRj FRintk) + (set (reg h-gr (add (index-of GRj) 1)) + (reg h-fr_int (add (index-of FRintk) 1))) + (set (reg h-gr (add (index-of GRj) 2)) + (reg h-fr_int (add (index-of FRintk) 2))) + (set (reg h-gr (add (index-of GRj) 3)) + (reg h-fr_int (add (index-of FRintk) 3))))) + () +) + +(define-pmacro (conditional-register-transfer + name op ope reg_src reg_targ pipe attrs profile comment) + (dni name + (comment) + (.splice (UNIT pipe) CONDITIONAL FR-ACCESS (.unsplice attrs)) + (.str name "$pack $" reg_src ",$" reg_targ ",$CCi,$cond") + (+ pack reg_targ op (rs-null) CCi cond ope reg_src) + (if (eq CCi (or cond 2)) + (set reg_targ reg_src)) + profile + ) +) + +(conditional-register-transfer cmovgf OP_69 OPE4_0 GRj FRintk I0 + ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4)) + ((fr400 (unit u-gr2fr)) (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr))) + "transfer gr to fr") +(conditional-register-transfer cmovfg OP_69 OPE4_2 FRintk GRj I0 + ((FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4)) + ((fr400 (unit u-fr2gr)) (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr))) + "transfer fr to gr") + + +(dni cmovgfd + "Conditional move GR to FR double" + ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) CONDITIONAL FR-ACCESS) + "cmovgfd$pack $GRj,$FRintk,$CCi,$cond" + (+ pack FRintk OP_69 (rs-null) CCi cond OPE4_1 GRj) + (register-transfer-double-from-gr-semantics (eq CCi (or cond 2))) + ; TODO -- doesn't handle extra registers in double + ((fr400 (unit u-gr2fr)) + (fr500 (unit u-gr2fr)) (fr550 (unit u-gr2fr))) +) + +(dni cmovfgd + "Conditional move FR to GR double" + ((UNIT I0) (FR500-MAJOR I-4) (FR550-MAJOR I-5) (FR400-MAJOR I-4) CONDITIONAL FR-ACCESS) + "cmovfgd$pack $FRintk,$GRj,$CCi,$cond" + (+ pack FRintk OP_69 (rs-null) CCi cond OPE4_3 GRj) + (register-transfer-double-to-gr-semantics (eq CCi (or cond 2))) + ; TODO -- doesn't handle second register in the pair + ((fr400 (unit u-fr2gr)) + (fr500 (unit u-fr2gr)) (fr550 (unit u-fr2gr))) +) + +(define-pmacro (register-transfer-spr + name op ope reg_src reg_targ unitname comment) + (dni name + (comment) + ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2)) + (.str name "$pack $" reg_src ",$" reg_targ) + (+ pack reg_targ op ope reg_src) + (set reg_targ reg_src) + ((fr400 (unit unitname)) + (fr500 (unit unitname)) (fr550 (unit unitname))) + ) +) + +(register-transfer-spr movgs OP_03 OPE1_06 GRj spr u-gr2spr "transfer gr->spr") +(register-transfer-spr movsg OP_03 OPE1_07 spr GRj u-spr2gr "transfer spr->gr") + +; Integer Branch Conditions +(define-pmacro (Inev cc) (const BI 0)) +(define-pmacro (Ira cc) (const BI 1)) +(define-pmacro (Ieq cc) ( zbit cc)) +(define-pmacro (Ine cc) (not (zbit cc))) +(define-pmacro (Ile cc) ( orif (zbit cc) (xor (nbit cc) (vbit cc)))) +(define-pmacro (Igt cc) (not (orif (zbit cc) (xor (nbit cc) (vbit cc))))) +(define-pmacro (Ilt cc) ( xor (nbit cc) (vbit cc))) +(define-pmacro (Ige cc) (not (xor (nbit cc) (vbit cc)))) +(define-pmacro (Ils cc) ( orif (cbit cc) (zbit cc))) +(define-pmacro (Ihi cc) (not (orif (cbit cc) (zbit cc)))) +(define-pmacro (Ic cc) ( cbit cc)) +(define-pmacro (Inc cc) (not (cbit cc))) +(define-pmacro (In cc) ( nbit cc)) +(define-pmacro (Ip cc) (not (nbit cc))) +(define-pmacro (Iv cc) ( vbit cc)) +(define-pmacro (Inv cc) (not (vbit cc))) + +; Float Branch Conditions +(define-pmacro (Fnev cc) (const BI 0)) +(define-pmacro (Fra cc) (const BI 1)) +(define-pmacro (Fne cc) (orif (lbit cc) (orif (gbit cc) (ubit cc)))) +(define-pmacro (Feq cc) (ebit cc)) +(define-pmacro (Flg cc) (orif (lbit cc) (gbit cc))) +(define-pmacro (Fue cc) (orif (ebit cc) (ubit cc))) +(define-pmacro (Ful cc) (orif (lbit cc) (ubit cc))) +(define-pmacro (Fge cc) (orif (ebit cc) (gbit cc))) +(define-pmacro (Flt cc) (lbit cc)) +(define-pmacro (Fuge cc) (orif (ebit cc) (orif (gbit cc) (ubit cc)))) +(define-pmacro (Fug cc) (orif (gbit cc) (ubit cc))) +(define-pmacro (Fle cc) (orif (ebit cc) (lbit cc))) +(define-pmacro (Fgt cc) (gbit cc)) +(define-pmacro (Fule cc) (orif (ebit cc) (orif (lbit cc) (ubit cc)))) +(define-pmacro (Fu cc) (ubit cc)) +(define-pmacro (Fo cc) (orif (ebit cc) (orif (lbit cc) (gbit cc)))) + +(define-pmacro (conditional-branch-i prefix cc op cond comment) + (dni (.sym prefix cc) + (comment) + ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1)) + (.str (.sym prefix cc) "$pack $ICCi_2,$hint,$label16") + (+ pack (.sym ICC_ cc) ICCi_2 op hint label16) + (sequence () + (c-call VOID "@cpu@_model_branch" label16 hint) + (if (cond ICCi_2) + (set pc label16))) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) + ) +) + +(dni bra + "integer branch equal" + ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1)) + "bra$pack $hint_taken$label16" + (+ pack ICC_ra (ICCi_2-null) OP_06 hint_taken label16) + (sequence () + (c-call VOID "@cpu@_model_branch" label16 hint_taken) + (set pc label16)) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(dni bno + "integer branch never" + ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1)) + "bno$pack$hint_not_taken" + (+ pack ICC_nev (ICCi_2-null) OP_06 hint_not_taken (label16-null)) + (c-call VOID "@cpu@_model_branch" label16 hint_not_taken) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(conditional-branch-i b eq OP_06 Ieq "integer branch equal") +(conditional-branch-i b ne OP_06 Ine "integer branch not equal") +(conditional-branch-i b le OP_06 Ile "integer branch less or equal") +(conditional-branch-i b gt OP_06 Igt "integer branch greater") +(conditional-branch-i b lt OP_06 Ilt "integer branch less") +(conditional-branch-i b ge OP_06 Ige "integer branch greater or equal") +(conditional-branch-i b ls OP_06 Ils "integer branch less or equal unsigned") +(conditional-branch-i b hi OP_06 Ihi "integer branch greater unsigned") +(conditional-branch-i b c OP_06 Ic "integer branch carry set") +(conditional-branch-i b nc OP_06 Inc "integer branch carry clear") +(conditional-branch-i b n OP_06 In "integer branch negative") +(conditional-branch-i b p OP_06 Ip "integer branch positive") +(conditional-branch-i b v OP_06 Iv "integer branch overflow set") +(conditional-branch-i b nv OP_06 Inv "integer branch overflow clear") + +(define-pmacro (conditional-branch-f prefix cc op cond comment) + (dni (.sym prefix cc) + (comment) + ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1) FR-ACCESS) + (.str (.sym prefix cc) "$pack $FCCi_2,$hint,$label16") + (+ pack (.sym FCC_ cc) FCCi_2 op hint label16) + (sequence () + (c-call VOID "@cpu@_model_branch" label16 hint) + (if (cond FCCi_2) (set pc label16))) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) + ) +) + +(dni fbra + "float branch equal" + ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1) FR-ACCESS) + "fbra$pack $hint_taken$label16" + (+ pack FCC_ra (FCCi_2-null) OP_07 hint_taken label16) + (sequence () + (c-call VOID "@cpu@_model_branch" label16 hint_taken) + (set pc label16)) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(dni fbno + "float branch never" + ((UNIT B01) (FR500-MAJOR B-1) (FR550-MAJOR B-1) (FR400-MAJOR B-1) FR-ACCESS) + "fbno$pack$hint_not_taken" + (+ pack FCC_nev (FCCi_2-null) OP_07 hint_not_taken (label16-null)) + (c-call VOID "@cpu@_model_branch" label16 hint_not_taken) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(conditional-branch-f fb ne OP_07 Fne "float branch not equal") +(conditional-branch-f fb eq OP_07 Feq "float branch equal") +(conditional-branch-f fb lg OP_07 Flg "float branch less or greater") +(conditional-branch-f fb ue OP_07 Fue "float branch unordered or equal") +(conditional-branch-f fb ul OP_07 Ful "float branch unordered or less") +(conditional-branch-f fb ge OP_07 Fge "float branch greater or equal") +(conditional-branch-f fb lt OP_07 Flt "float branch less") +(conditional-branch-f fb uge OP_07 Fuge "float branch unordered, greater,equal") +(conditional-branch-f fb ug OP_07 Fug "float branch unordered or greater") +(conditional-branch-f fb le OP_07 Fle "float branch less or equal") +(conditional-branch-f fb gt OP_07 Fgt "float branch greater") +(conditional-branch-f fb ule OP_07 Fule "float branch unordered, less or equal") +(conditional-branch-f fb u OP_07 Fu "float branch unordered") +(conditional-branch-f fb o OP_07 Fo "float branch ordered") + +(define-pmacro (ctrlr-branch-semantics cond ccond) + (sequence ((SI tmp)) + (set tmp (sub (spr-lcr) 1)) + (set (spr-lcr) tmp) + (if cond + (if (eq ccond 0) + (if (ne tmp 0) + (set pc (spr-lr))) + (if (eq tmp 0) + (set pc (spr-lr)))))) +) + +(dni bctrlr + "LCR conditional branch to lr" + ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2)) + ("bctrlr$pack $ccond,$hint") + (+ pack (cond-null) (ICCi_2-null) OP_0E hint OPE3_01 ccond (s12-null)) + (sequence () + (c-call VOID "@cpu@_model_branch" (spr-lr) hint) + (ctrlr-branch-semantics (const BI 1) ccond)) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(define-pmacro (conditional-branch-cclr prefix cc i-f op ope cond attr comment) + (dni (.sym prefix cc lr) + (comment) + ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3) attr) + (.str (.sym prefix cc lr) "$pack $" i-f "CCi_2,$hint") + (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op hint ope + (ccond-null) (s12-null)) + (sequence () + (c-call VOID "@cpu@_model_branch" (spr-lr) hint) + (if (cond (.sym i-f CCi_2)) (set pc (spr-lr)))) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) + ) +) + +(dni bralr + "integer cclr branch always" + ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3)) + "bralr$pack$hint_taken" + (+ pack ICC_ra (ICCi_2-null) OP_0E hint_taken OPE3_02 (ccond-null) (s12-null)) + (sequence () + (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken) + (set pc (spr-lr))) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(dni bnolr + "integer cclr branch never" + ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3)) + "bnolr$pack$hint_not_taken" + (+ pack ICC_nev (ICCi_2-null) OP_0E hint_not_taken OPE3_02 (ccond-null) (s12-null)) + (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(conditional-branch-cclr b eq I OP_0E OPE3_02 Ieq NA "integer cclr branch equal") +(conditional-branch-cclr b ne I OP_0E OPE3_02 Ine NA "integer cclr branch not equal") +(conditional-branch-cclr b le I OP_0E OPE3_02 Ile NA "integer cclr branch less or equal") +(conditional-branch-cclr b gt I OP_0E OPE3_02 Igt NA "integer cclr branch greater") +(conditional-branch-cclr b lt I OP_0E OPE3_02 Ilt NA "integer cclr branch less") +(conditional-branch-cclr b ge I OP_0E OPE3_02 Ige NA "integer cclr branch greater or equal") +(conditional-branch-cclr b ls I OP_0E OPE3_02 Ils NA "integer cclr branch less or equal unsigned") +(conditional-branch-cclr b hi I OP_0E OPE3_02 Ihi NA "integer cclr branch greater unsigned") +(conditional-branch-cclr b c I OP_0E OPE3_02 Ic NA "integer cclr branch carry set") +(conditional-branch-cclr b nc I OP_0E OPE3_02 Inc NA "integer cclr branch carry clear") +(conditional-branch-cclr b n I OP_0E OPE3_02 In NA "integer cclr branch negative") +(conditional-branch-cclr b p I OP_0E OPE3_02 Ip NA "integer cclr branch positive") +(conditional-branch-cclr b v I OP_0E OPE3_02 Iv NA "integer cclr branch overflow set") +(conditional-branch-cclr b nv I OP_0E OPE3_02 Inv NA "integer cclr branch overflow clear") + +(dni fbralr + "float cclr branch always" + ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3) FR-ACCESS) + "fbralr$pack$hint_taken" + (+ pack FCC_ra (FCCi_2-null) OP_0E hint_taken OPE3_06 (ccond-null) (s12-null)) + (sequence () + (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken) + (set pc (spr-lr))) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(dni fbnolr + "float cclr branch never" + ((UNIT B01) (FR500-MAJOR B-3) (FR550-MAJOR B-3) (FR400-MAJOR B-3) FR-ACCESS) + "fbnolr$pack$hint_not_taken" + (+ pack FCC_nev (FCCi_2-null) OP_0E hint_not_taken OPE3_06 (ccond-null) (s12-null)) + (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(conditional-branch-cclr fb eq F OP_0E OPE3_06 Feq FR-ACCESS "float cclr branch equal") +(conditional-branch-cclr fb ne F OP_0E OPE3_06 Fne FR-ACCESS "float cclr branch not equal") +(conditional-branch-cclr fb lg F OP_0E OPE3_06 Flg FR-ACCESS "float branch less or greater") +(conditional-branch-cclr fb ue F OP_0E OPE3_06 Fue FR-ACCESS "float branch unordered or equal") +(conditional-branch-cclr fb ul F OP_0E OPE3_06 Ful FR-ACCESS "float branch unordered or less") +(conditional-branch-cclr fb ge F OP_0E OPE3_06 Fge FR-ACCESS "float branch greater or equal") +(conditional-branch-cclr fb lt F OP_0E OPE3_06 Flt FR-ACCESS "float branch less") +(conditional-branch-cclr fb uge F OP_0E OPE3_06 Fuge FR-ACCESS "float branch unordered, greater, equal") +(conditional-branch-cclr fb ug F OP_0E OPE3_06 Fug FR-ACCESS "float branch unordered or greater") +(conditional-branch-cclr fb le F OP_0E OPE3_06 Fle FR-ACCESS "float branch less or equal") +(conditional-branch-cclr fb gt F OP_0E OPE3_06 Fgt FR-ACCESS "float branch greater") +(conditional-branch-cclr fb ule F OP_0E OPE3_06 Fule FR-ACCESS "float branch unordered, less or equal") +(conditional-branch-cclr fb u F OP_0E OPE3_06 Fu FR-ACCESS "float branch unordered") +(conditional-branch-cclr fb o F OP_0E OPE3_06 Fo FR-ACCESS "float branch ordered") + +(define-pmacro (conditional-branch-ctrlr prefix cc i-f op ope cond attr comment) + (dni (.sym prefix cc lr) + (comment) + ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2) attr) + (.str (.sym prefix cc lr) "$pack $" i-f "CCi_2,$ccond,$hint") + (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op hint ope ccond (s12-null)) + (sequence () + (c-call VOID "@cpu@_model_branch" (spr-lr) hint) + (ctrlr-branch-semantics (cond (.sym i-f CCi_2)) ccond)) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) + ) +) + +(dni bcralr + "integer ctrlr branch always" + ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2)) + "bcralr$pack $ccond$hint_taken" + (+ pack ICC_ra (ICCi_2-null) OP_0E hint_taken OPE3_03 ccond (s12-null)) + (sequence () + (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken) + (ctrlr-branch-semantics (const BI 1) ccond)) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(dni bcnolr + "integer ctrlr branch never" + ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2)) + "bcnolr$pack$hint_not_taken" + (+ pack ICC_nev (ICCi_2-null) OP_0E hint_not_taken OPE3_03 (ccond-null) (s12-null)) + (sequence () + (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken) + (ctrlr-branch-semantics (const BI 0) ccond)) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(conditional-branch-ctrlr bc eq I OP_0E OPE3_03 Ieq NA "integer ctrlr branch equal") +(conditional-branch-ctrlr bc ne I OP_0E OPE3_03 Ine NA "integer ctrlr branch not equal") +(conditional-branch-ctrlr bc le I OP_0E OPE3_03 Ile NA "integer ctrlr branch less equal") +(conditional-branch-ctrlr bc gt I OP_0E OPE3_03 Igt NA "integer ctrlr branch greater") +(conditional-branch-ctrlr bc lt I OP_0E OPE3_03 Ilt NA "integer ctrlr branch less") +(conditional-branch-ctrlr bc ge I OP_0E OPE3_03 Ige NA "integer ctrlr branch greater equal") +(conditional-branch-ctrlr bc ls I OP_0E OPE3_03 Ils NA "integer ctrlr branch less equal unsigned") +(conditional-branch-ctrlr bc hi I OP_0E OPE3_03 Ihi NA "integer ctrlr branch greater unsigned") +(conditional-branch-ctrlr bc c I OP_0E OPE3_03 Ic NA "integer ctrlr branch carry set") +(conditional-branch-ctrlr bc nc I OP_0E OPE3_03 Inc NA "integer ctrlr branch carry clear") +(conditional-branch-ctrlr bc n I OP_0E OPE3_03 In NA "integer ctrlr branch negative") +(conditional-branch-ctrlr bc p I OP_0E OPE3_03 Ip NA "integer ctrlr branch positive") +(conditional-branch-ctrlr bc v I OP_0E OPE3_03 Iv NA "integer ctrlr branch overflow set") +(conditional-branch-ctrlr bc nv I OP_0E OPE3_03 Inv NA "integer ctrlr branch overflow clear") + +(dni fcbralr + "float ctrlr branch always" + ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2) FR-ACCESS) + "fcbralr$pack $ccond$hint_taken" + (+ pack FCC_ra (FCCi_2-null) OP_0E hint_taken OPE3_07 ccond (s12-null)) + (sequence () + (c-call VOID "@cpu@_model_branch" (spr-lr) hint_taken) + (ctrlr-branch-semantics (const BI 1) ccond)) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(dni fcbnolr + "float ctrlr branch never" + ((UNIT B0) (FR500-MAJOR B-2) (FR550-MAJOR B-2) (FR400-MAJOR B-2) FR-ACCESS) + "fcbnolr$pack$hint_not_taken" + (+ pack FCC_nev (FCCi_2-null) OP_0E hint_not_taken OPE3_07 (ccond-null) (s12-null)) + (sequence () + (c-call VOID "@cpu@_model_branch" (spr-lr) hint_not_taken) + (ctrlr-branch-semantics (const BI 0) ccond)) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(conditional-branch-ctrlr fcb eq F OP_0E OPE3_07 Feq FR-ACCESS "float cclr branch equal") +(conditional-branch-ctrlr fcb ne F OP_0E OPE3_07 Fne FR-ACCESS "float cclr branch not equal") +(conditional-branch-ctrlr fcb lg F OP_0E OPE3_07 Flg FR-ACCESS "float branch less or greater") +(conditional-branch-ctrlr fcb ue F OP_0E OPE3_07 Fue FR-ACCESS "float branch unordered or equal") +(conditional-branch-ctrlr fcb ul F OP_0E OPE3_07 Ful FR-ACCESS "float branch unordered or less") +(conditional-branch-ctrlr fcb ge F OP_0E OPE3_07 Fge FR-ACCESS "float branch greater or equal") +(conditional-branch-ctrlr fcb lt F OP_0E OPE3_07 Flt FR-ACCESS "float branch less") +(conditional-branch-ctrlr fcb uge F OP_0E OPE3_07 Fuge FR-ACCESS "float branch unordered, greater, equal") +(conditional-branch-ctrlr fcb ug F OP_0E OPE3_07 Fug FR-ACCESS "float branch unordered or greater") +(conditional-branch-ctrlr fcb le F OP_0E OPE3_07 Fle FR-ACCESS "float branch less or equal") +(conditional-branch-ctrlr fcb gt F OP_0E OPE3_07 Fgt FR-ACCESS "float branch greater") +(conditional-branch-ctrlr fcb ule F OP_0E OPE3_07 Fule FR-ACCESS "float branch unordered, less or equal") +(conditional-branch-ctrlr fcb u F OP_0E OPE3_07 Fu FR-ACCESS "float branch unordered") +(conditional-branch-ctrlr fcb o F OP_0E OPE3_07 Fo FR-ACCESS "float branch ordered") + +(define-pmacro (jump-and-link-semantics base offset LI) + (sequence () + (if (eq LI 1) + (c-call VOID "@cpu@_set_write_next_vliw_addr_to_LR" 1)) + ; Target address gets aligned here + (set pc (and (add base offset) #xfffffffc)) + (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken +) + +(dni jmpl + "jump and link" + ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6) (FR400-MAJOR I-5)) + "jmpl$pack @($GRi,$GRj)" + (+ pack (misc-null-1) (LI-off) OP_0C GRi (misc-null-2) GRj) + (jump-and-link-semantics GRi GRj LI) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(dni calll + "call and link" + ((UNIT I0) (FR500-MAJOR I-5) (FR400-MAJOR I-5)) + "calll$pack @($GRi,$GRj)" + (+ pack (misc-null-1) (LI-on) OP_0C GRi (misc-null-2) GRj) + (jump-and-link-semantics GRi GRj LI) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch))) +) + +(dni jmpil + "jump immediate and link" + ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6) (FR400-MAJOR I-5)) + "jmpil$pack @($GRi,$s12)" + (+ pack (misc-null-1) (LI-off) OP_0D GRi s12) + (jump-and-link-semantics GRi s12 LI) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(dni callil + "call immediate and link" + ((UNIT I0) (FR500-MAJOR I-5) (FR400-MAJOR I-5)) + "callil$pack @($GRi,$s12)" + (+ pack (misc-null-1) (LI-on) OP_0D GRi s12) + (jump-and-link-semantics GRi s12 LI) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch))) +) + +(dni call + "call and link" + ((UNIT B0) (FR500-MAJOR B-4) (FR550-MAJOR B-4) (FR400-MAJOR B-4)) + "call$pack $label24" + (+ pack OP_0F label24) + (sequence () + (c-call VOID "@cpu@_set_write_next_vliw_addr_to_LR" 1) + (set pc label24) + (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(dni rett + "return from trap" + ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2) PRIVILEGED) + "rett$pack $debug" + (+ pack (misc-null-1) debug OP_05 (rs-null) (s12-null)) + ; frv_rett handles operating vs user mode + (sequence () + (set pc (c-call UWI "frv_rett" pc debug)) + (c-call VOID "@cpu@_model_branch" pc #x2)) ; hint branch taken + () +) + +(dni rei + "run exception instruction" + ((UNIT C) (FR500-MAJOR C-1) (MACH frv) PRIVILEGED) + "rei$pack $eir" + (+ pack (rd-null) OP_37 eir (s12-null)) + (nop) ; for now + () +) + +(define-pmacro (trap-semantics cond base offset) + (if cond + (sequence () + ; This is defered to frv_itrap because for the breakpoint + ; case we want to change as little of the machine state as + ; possible. + ; + ; PCSR=PC + ; PSR.PS=PSR.S + ; PSR.ET=0 + ; if PSR.ESR==1 + ; SR0 through SR3=GR4 through GR7 + ; TBR.TT=0x80 + ((GRi + s12) & 0x7f) + ; PC=TBR + ; We still should indicate what is modified by this insn. + (clobber (spr-pcsr)) + (clobber psr_ps) + (clobber psr_et) + (clobber tbr_tt) + (if (ne psr_esr (const 0)) + (sequence () + (clobber (spr-sr0)) + (clobber (spr-sr1)) + (clobber (spr-sr2)) + (clobber (spr-sr3)))) + ; frv_itrap handles operating vs user mode + (c-call VOID "frv_itrap" pc base offset))) +) + +(define-pmacro (trap-r prefix cc i-f op ope cond attr comment) + (dni (.sym prefix cc) + (comment) + ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) attr) + (.str (.sym prefix cc) "$pack $" i-f "CCi_2,$GRi,$GRj") + (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op GRi (misc-null-3) ope GRj) + (trap-semantics (cond (.sym i-f CCi_2)) GRi GRj) + ((fr400 (unit u-trap)) + (fr500 (unit u-trap)) (fr550 (unit u-trap))) + ) +) + +(dni tra + "integer trap always" + ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1)) + "tra$pack $GRi,$GRj" + (+ pack ICC_ra (ICCi_2-null) OP_04 GRi (misc-null-3) OPE4_0 GRj) + (trap-semantics (const BI 1) GRi GRj) + ((fr400 (unit u-trap)) + (fr500 (unit u-trap)) (fr550 (unit u-trap))) +) + +(dni tno + "integer trap never" + ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1)) + "tno$pack" + (+ pack ICC_nev (ICCi_2-null) OP_04 (GRi-null) (misc-null-3) OPE4_0 (GRj-null)) + (trap-semantics (const BI 0) GRi GRj) + ((fr400 (unit u-trap)) + (fr500 (unit u-trap)) (fr550 (unit u-trap))) +) + +(trap-r t eq I OP_04 OPE4_0 Ieq NA "integer trap equal") +(trap-r t ne I OP_04 OPE4_0 Ine NA "integer trap not equal") +(trap-r t le I OP_04 OPE4_0 Ile NA "integer trap less or equal") +(trap-r t gt I OP_04 OPE4_0 Igt NA "integer trap greater") +(trap-r t lt I OP_04 OPE4_0 Ilt NA "integer trap less") +(trap-r t ge I OP_04 OPE4_0 Ige NA "integer trap greater or equal") +(trap-r t ls I OP_04 OPE4_0 Ils NA "integer trap less or equal unsigned") +(trap-r t hi I OP_04 OPE4_0 Ihi NA "integer trap greater unsigned") +(trap-r t c I OP_04 OPE4_0 Ic NA "integer trap carry set") +(trap-r t nc I OP_04 OPE4_0 Inc NA "integer trap carry clear") +(trap-r t n I OP_04 OPE4_0 In NA "integer trap negative") +(trap-r t p I OP_04 OPE4_0 Ip NA "integer trap positive") +(trap-r t v I OP_04 OPE4_0 Iv NA "integer trap overflow set") +(trap-r t nv I OP_04 OPE4_0 Inv NA "integer trap overflow clear") + +(dni ftra + "float trap always" + ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS) + "ftra$pack $GRi,$GRj" + (+ pack FCC_ra (FCCi_2-null) OP_04 GRi (misc-null-3) OPE4_1 GRj) + (trap-semantics (const BI 1) GRi GRj) + ((fr400 (unit u-trap)) + (fr500 (unit u-trap)) (fr550 (unit u-trap))) +) + +(dni ftno + "flost trap never" + ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS) + "ftno$pack" + (+ pack FCC_nev (FCCi_2-null) OP_04 (GRi-null) (misc-null-3) OPE4_1 (GRj-null)) + (trap-semantics (const BI 0) GRi GRj) + ((fr400 (unit u-trap)) + (fr500 (unit u-trap)) (fr550 (unit u-trap))) +) + +(trap-r ft ne F OP_04 OPE4_1 Fne FR-ACCESS "float trap not equal") +(trap-r ft eq F OP_04 OPE4_1 Feq FR-ACCESS "float trap equal") +(trap-r ft lg F OP_04 OPE4_1 Flg FR-ACCESS "float trap greater or less") +(trap-r ft ue F OP_04 OPE4_1 Fue FR-ACCESS "float trap unordered or equal") +(trap-r ft ul F OP_04 OPE4_1 Ful FR-ACCESS "float trap unordered or less") +(trap-r ft ge F OP_04 OPE4_1 Fge FR-ACCESS "float trap greater or equal") +(trap-r ft lt F OP_04 OPE4_1 Flt FR-ACCESS "float trap less") +(trap-r ft uge F OP_04 OPE4_1 Fuge FR-ACCESS "float trap unordered greater or equal") +(trap-r ft ug F OP_04 OPE4_1 Fug FR-ACCESS "float trap unordered or greater") +(trap-r ft le F OP_04 OPE4_1 Fle FR-ACCESS "float trap less or equal") +(trap-r ft gt F OP_04 OPE4_1 Fgt FR-ACCESS "float trap greater") +(trap-r ft ule F OP_04 OPE4_1 Fule FR-ACCESS "float trap unordered less or equal") +(trap-r ft u F OP_04 OPE4_1 Fu FR-ACCESS "float trap unordered") +(trap-r ft o F OP_04 OPE4_1 Fo FR-ACCESS "float trap ordered") + +(define-pmacro (trap-immed prefix cc i-f op cond attr comment) + (dni (.sym prefix cc) + (comment) + ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) attr) + (.str (.sym prefix cc) "$pack $" i-f "CCi_2,$GRi,$s12") + (+ pack (.sym i-f CC_ cc) (.sym i-f CCi_2) op GRi s12) + (trap-semantics (cond (.sym i-f CCi_2)) GRi s12) + ((fr400 (unit u-trap)) + (fr500 (unit u-trap)) (fr550 (unit u-trap))) + ) +) + +(dni tira + "integer trap always" + ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1)) + "tira$pack $GRi,$s12" + (+ pack ICC_ra (ICCi_2-null) OP_1C GRi s12) + (trap-semantics (const BI 1) GRi s12) + ((fr400 (unit u-trap)) + (fr500 (unit u-trap)) (fr550 (unit u-trap))) +) + +(dni tino + "integer trap never" + ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1)) + "tino$pack" + (+ pack ICC_nev (ICCi_2-null) OP_1C (GRi-null) (s12-null)) + (trap-semantics (const BI 0) GRi s12) + ((fr400 (unit u-trap)) + (fr500 (unit u-trap)) (fr550 (unit u-trap))) +) + +(trap-immed ti eq I OP_1C Ieq NA "integer trap equal") +(trap-immed ti ne I OP_1C Ine NA "integer trap not equal") +(trap-immed ti le I OP_1C Ile NA "integer trap less or equal") +(trap-immed ti gt I OP_1C Igt NA "integer trap greater") +(trap-immed ti lt I OP_1C Ilt NA "integer trap less") +(trap-immed ti ge I OP_1C Ige NA "integer trap greater or equal") +(trap-immed ti ls I OP_1C Ils NA "integer trap less or equal unsigned") +(trap-immed ti hi I OP_1C Ihi NA "integer trap greater unsigned") +(trap-immed ti c I OP_1C Ic NA "integer trap carry set") +(trap-immed ti nc I OP_1C Inc NA "integer trap carry clear") +(trap-immed ti n I OP_1C In NA "integer trap negative") +(trap-immed ti p I OP_1C Ip NA "integer trap positive") +(trap-immed ti v I OP_1C Iv NA "integer trap overflow set") +(trap-immed ti nv I OP_1C Inv NA "integer trap overflow clear") + +(dni ftira + "float trap always" + ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS) + "ftira$pack $GRi,$s12" + (+ pack FCC_ra (ICCi_2-null) OP_1D GRi s12) + (trap-semantics (const BI 1) GRi s12) + ((fr400 (unit u-trap)) + (fr500 (unit u-trap)) (fr550 (unit u-trap))) +) + +(dni ftino + "float trap never" + ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS) + "ftino$pack" + (+ pack FCC_nev (FCCi_2-null) OP_1D (GRi-null) (s12-null)) + (trap-semantics (const BI 0) GRi s12) + ((fr400 (unit u-trap)) + (fr500 (unit u-trap)) (fr550 (unit u-trap))) +) + +(trap-immed fti ne F OP_1D Fne FR-ACCESS "float trap not equal") +(trap-immed fti eq F OP_1D Feq FR-ACCESS "float trap equal") +(trap-immed fti lg F OP_1D Flg FR-ACCESS "float trap greater or less") +(trap-immed fti ue F OP_1D Fue FR-ACCESS "float trap unordered or equal") +(trap-immed fti ul F OP_1D Ful FR-ACCESS "float trap unordered or less") +(trap-immed fti ge F OP_1D Fge FR-ACCESS "float trap greater or equal") +(trap-immed fti lt F OP_1D Flt FR-ACCESS "float trap less") +(trap-immed fti uge F OP_1D Fuge FR-ACCESS "float trap unordered greater or equal") +(trap-immed fti ug F OP_1D Fug FR-ACCESS "float trap unordered or greater") +(trap-immed fti le F OP_1D Fle FR-ACCESS "float trap less or equal") +(trap-immed fti gt F OP_1D Fgt FR-ACCESS "float trap greater") +(trap-immed fti ule F OP_1D Fule FR-ACCESS "float trap unordered less or equal") +(trap-immed fti u F OP_1D Fu FR-ACCESS "float trap unordered") +(trap-immed fti o F OP_1D Fo FR-ACCESS "float trap ordered") + +(dni break + "break trap" + ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1)) + "break$pack" + (+ pack (rd-null) OP_04 (rs-null) (misc-null-3) OPE4_3 (GRj-null)) + (sequence () + ; This is defered to frv_break because for the breakpoint + ; case we want to change as little of the machine state as + ; possible. + ; + ; BPCSR=PC + ; BPSR.BS=PSR.S + ; BPSR.BET=PSR.ET + ; PSR.S=1 + ; PSR.ET=0 + ; TBR.TT=0xff + ; PC=TBR + ; We still should indicate what is modified by this insn. + (clobber (spr-bpcsr)) + (clobber bpsr_bs) + (clobber bpsr_bet) + (clobber psr_s) + (clobber psr_et) + (clobber tbr_tt) + (c-call VOID "frv_break")) + () +) + +(dni mtrap + "media trap" + ((UNIT C) (FR500-MAJOR C-1) (FR550-MAJOR C-1) (FR400-MAJOR C-1) FR-ACCESS) + "mtrap$pack" + (+ pack (rd-null) OP_04 (rs-null) (misc-null-3) OPE4_2 (GRj-null)) + (c-call VOID "frv_mtrap") + () +) + +(define-pmacro (condition-code-logic name operation ope comment) + (dni name + (comment) + ((UNIT B01) (FR500-MAJOR B-6) (FR550-MAJOR B-6) (FR400-MAJOR B-6)) + (.str name "$pack $CRi,$CRj,$CRk") + (+ pack (misc-null-6) CRk OP_0A (misc-null-7) CRi ope (misc-null-8) CRj) + (set CRk (c-call UQI "@cpu@_cr_logic" operation CRi CRj)) + () + ) +) +(define-pmacro (op-andcr) 0) +(define-pmacro (op-orcr) 1) +(define-pmacro (op-xorcr) 2) +(define-pmacro (op-nandcr) 3) +(define-pmacro (op-norcr) 4) +(define-pmacro (op-andncr) 5) +(define-pmacro (op-orncr) 6) +(define-pmacro (op-nandncr) 7) +(define-pmacro (op-norncr) 8) + +(define-pmacro (cr-true) 3) +(define-pmacro (cr-false) 2) +(define-pmacro (cr-undefined) 0) + +(condition-code-logic andcr (op-andcr) OPE1_08 "and condition code regs") +(condition-code-logic orcr (op-orcr) OPE1_09 "or condition code regs") +(condition-code-logic xorcr (op-xorcr) OPE1_0A "xor condition code regs") +(condition-code-logic nandcr (op-nandcr) OPE1_0C "nand condition code regs") +(condition-code-logic norcr (op-norcr) OPE1_0D "nor condition code regs") +(condition-code-logic andncr (op-andncr) OPE1_10 "andn condition code regs") +(condition-code-logic orncr (op-orncr) OPE1_11 "orn condition code regs") +(condition-code-logic nandncr (op-nandncr) OPE1_14 "nandn condition code regs") +(condition-code-logic norncr (op-norncr) OPE1_15 "norn condition code regs") + +(dni notcr + ("not cccr register") + ((UNIT B01) (FR500-MAJOR B-6) (FR550-MAJOR B-6) (FR400-MAJOR B-6)) + (.str notcr "$pack $CRj,$CRk") + (+ pack (misc-null-6) CRk OP_0A (rs-null) OPE1_0B (misc-null-8) CRj) + (set CRk (xor CRj 1)) + () +) + +(define-pmacro (check-semantics cond cr) + (if cond (set cr (cr-true)) (set cr (cr-false))) +) + +(define-pmacro (check-int-condition-code prefix cc op cond comment) + (dni (.sym prefix cc) + (comment) + ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5)) + (.str (.sym prefix cc) "$pack $ICCi_3,$CRj_int") + (+ pack (.sym ICC_ cc) CRj_int op (misc-null-5) ICCi_3) + (check-semantics (cond ICCi_3) CRj_int) + ((fr400 (unit u-check)) + (fr500 (unit u-check)) (fr550 (unit u-check))) + ) +) + +(dni ckra + "check integer cc always" + ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5)) + "ckra$pack $CRj_int" + (+ pack ICC_ra CRj_int OP_08 (misc-null-5) (ICCi_3-null)) + (check-semantics (const BI 1) CRj_int) + ((fr400 (unit u-check)) + (fr500 (unit u-check)) (fr550 (unit u-check))) +) + +(dni ckno + "check integer cc never" + ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5)) + "ckno$pack $CRj_int" + (+ pack ICC_nev CRj_int OP_08 (misc-null-5) (ICCi_3-null)) + (check-semantics (const BI 0) CRj_int) + ((fr400 (unit u-check)) + (fr500 (unit u-check)) (fr550 (unit u-check))) +) + +(check-int-condition-code ck eq OP_08 Ieq "check integer cc equal") +(check-int-condition-code ck ne OP_08 Ine "check integer cc not equal") +(check-int-condition-code ck le OP_08 Ile "check integer cc less or equal") +(check-int-condition-code ck gt OP_08 Igt "check integer cc greater") +(check-int-condition-code ck lt OP_08 Ilt "check integer cc less") +(check-int-condition-code ck ge OP_08 Ige "check integer cc greater or equal") +(check-int-condition-code ck ls OP_08 Ils "check integer cc less or equal unsigned") +(check-int-condition-code ck hi OP_08 Ihi "check integer cc greater unsigned") +(check-int-condition-code ck c OP_08 Ic "check integer cc carry set") +(check-int-condition-code ck nc OP_08 Inc "check integer cc carry clear") +(check-int-condition-code ck n OP_08 In "check integer cc negative") +(check-int-condition-code ck p OP_08 Ip "check integer cc positive") +(check-int-condition-code ck v OP_08 Iv "check integer cc overflow set") +(check-int-condition-code ck nv OP_08 Inv "check integer cc overflow clear") + +(define-pmacro (check-float-condition-code prefix cc op cond comment) + (dni (.sym prefix cc) + (comment) + ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) FR-ACCESS) + (.str (.sym prefix cc) "$pack $FCCi_3,$CRj_float") + (+ pack (.sym FCC_ cc) CRj_float op (misc-null-5) FCCi_3) + (check-semantics (cond FCCi_3) CRj_float) + ((fr400 (unit u-check)) + (fr500 (unit u-check)) (fr550 (unit u-check))) + ) +) + +(dni fckra + "check float cc always" + ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) FR-ACCESS) + "fckra$pack $CRj_float" + (+ pack FCC_ra CRj_float OP_09 (misc-null-5) FCCi_3) + (check-semantics (const BI 1) CRj_float) + ((fr400 (unit u-check)) + (fr500 (unit u-check)) (fr550 (unit u-check))) +) + +(dni fckno + "check float cc never" + ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) FR-ACCESS) + "fckno$pack $CRj_float" + (+ pack FCC_nev CRj_float OP_09 (misc-null-5) FCCi_3) + (check-semantics (const BI 0) CRj_float) + ((fr400 (unit u-check)) + (fr500 (unit u-check)) (fr550 (unit u-check))) +) + +(check-float-condition-code fck ne OP_09 Fne "check float cc not equal") +(check-float-condition-code fck eq OP_09 Feq "check float cc equal") +(check-float-condition-code fck lg OP_09 Flg "check float cc greater or less") +(check-float-condition-code fck ue OP_09 Fue "check float cc unordered or equal") +(check-float-condition-code fck ul OP_09 Ful "check float cc unordered or less") +(check-float-condition-code fck ge OP_09 Fge "check float cc greater or equal") +(check-float-condition-code fck lt OP_09 Flt "check float cc less") +(check-float-condition-code fck uge OP_09 Fuge "check float cc unordered greater or equal") +(check-float-condition-code fck ug OP_09 Fug "check float cc unordered or greater") +(check-float-condition-code fck le OP_09 Fle "check float cc less or equal") +(check-float-condition-code fck gt OP_09 Fgt "check float cc greater") +(check-float-condition-code fck ule OP_09 Fule "check float cc unordered less or equal") +(check-float-condition-code fck u OP_09 Fu "check float cc unordered") +(check-float-condition-code fck o OP_09 Fo "check float cc ordered") + +(define-pmacro (conditional-check-int-condition-code prefix cc op ope test comment) + (dni (.sym prefix cc) + (comment) + ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL) + (.str (.sym prefix cc) "$pack $ICCi_3,$CRj_int,$CCi,$cond") + (+ pack (.sym ICC_ cc) CRj_int op (rs-null) CCi cond ope + (misc-null-9) ICCi_3) + (if (eq CCi (or cond 2)) + (check-semantics (test ICCi_3) CRj_int) + (set CRj_int (cr-undefined))) + ((fr400 (unit u-check)) + (fr500 (unit u-check)) (fr550 (unit u-check))) + ) +) + +(dni cckra + "conditional check integer cc always" + ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL) + "cckra$pack $CRj_int,$CCi,$cond" + (+ pack ICC_ra CRj_int OP_6A (rs-null) CCi cond OPE4_0 + (misc-null-9) (ICCi_3-null)) + (if (eq CCi (or cond 2)) + (check-semantics (const BI 1) CRj_int) + (set CRj_int (cr-undefined))) + ((fr400 (unit u-check)) + (fr500 (unit u-check)) (fr550 (unit u-check))) +) + +(dni cckno + "conditional check integer cc never" + ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL) + "cckno$pack $CRj_int,$CCi,$cond" + (+ pack ICC_nev CRj_int OP_6A (rs-null) CCi cond OPE4_0 + (misc-null-9) (ICCi_3-null)) + (if (eq CCi (or cond 2)) + (check-semantics (const BI 0) CRj_int) + (set CRj_int (cr-undefined))) + ((fr400 (unit u-check)) + (fr500 (unit u-check)) (fr550 (unit u-check))) +) + +(conditional-check-int-condition-code cck eq OP_6A OPE4_0 Ieq "check integer cc equal") +(conditional-check-int-condition-code cck ne OP_6A OPE4_0 Ine "check integer cc not equal") +(conditional-check-int-condition-code cck le OP_6A OPE4_0 Ile "check integer cc less or equal") +(conditional-check-int-condition-code cck gt OP_6A OPE4_0 Igt "check integer cc greater") +(conditional-check-int-condition-code cck lt OP_6A OPE4_0 Ilt "check integer cc less") +(conditional-check-int-condition-code cck ge OP_6A OPE4_0 Ige "check integer cc greater or equal") +(conditional-check-int-condition-code cck ls OP_6A OPE4_0 Ils "check integer cc less or equal unsigned") +(conditional-check-int-condition-code cck hi OP_6A OPE4_0 Ihi "check integer cc greater unsigned") +(conditional-check-int-condition-code cck c OP_6A OPE4_0 Ic "check integer cc carry set") +(conditional-check-int-condition-code cck nc OP_6A OPE4_0 Inc "check integer cc carry clear") +(conditional-check-int-condition-code cck n OP_6A OPE4_0 In "check integer cc negative") +(conditional-check-int-condition-code cck p OP_6A OPE4_0 Ip "check integer cc positive") +(conditional-check-int-condition-code cck v OP_6A OPE4_0 Iv "check integer cc overflow set") +(conditional-check-int-condition-code cck nv OP_6A OPE4_0 Inv "check integer cc overflow clear") + +(define-pmacro (conditional-check-float-condition-code prefix cc op ope test comment) + (dni (.sym prefix cc) + (comment) + ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL FR-ACCESS) + (.str (.sym prefix cc) "$pack $FCCi_3,$CRj_float,$CCi,$cond") + (+ pack (.sym FCC_ cc) CRj_float op (rs-null) CCi cond ope + (misc-null-9) FCCi_3) + (if (eq CCi (or cond 2)) + (check-semantics (test FCCi_3) CRj_float) + (set CRj_float (cr-undefined))) + ((fr400 (unit u-check)) + (fr500 (unit u-check)) (fr550 (unit u-check))) + ) +) + +(dni cfckra + "conditional check float cc always" + ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL FR-ACCESS) + "cfckra$pack $CRj_float,$CCi,$cond" + (+ pack FCC_ra CRj_float OP_6A (rs-null) CCi cond OPE4_1 + (misc-null-9) (FCCi_3-null)) + (if (eq CCi (or cond 2)) + (check-semantics (const BI 1) CRj_float) + (set CRj_float (cr-undefined))) + ((fr400 (unit u-check)) + (fr500 (unit u-check)) (fr550 (unit u-check))) +) + +(dni cfckno + "conditional check float cc never" + ((UNIT B01) (FR500-MAJOR B-5) (FR550-MAJOR B-5) (FR400-MAJOR B-5) CONDITIONAL FR-ACCESS) + "cfckno$pack $CRj_float,$CCi,$cond" + (+ pack FCC_nev CRj_float OP_6A (rs-null) CCi cond OPE4_1 + (misc-null-9) (FCCi_3-null)) + (if (eq CCi (or cond 2)) + (check-semantics (const BI 0) CRj_float) + (set CRj_float (cr-undefined))) + ((fr400 (unit u-check)) + (fr500 (unit u-check)) (fr550 (unit u-check))) +) + +(conditional-check-float-condition-code cfck ne OP_6A OPE4_1 Fne "check float cc not equal") +(conditional-check-float-condition-code cfck eq OP_6A OPE4_1 Feq "check float cc equal") +(conditional-check-float-condition-code cfck lg OP_6A OPE4_1 Flg "check float cc greater or less") +(conditional-check-float-condition-code cfck ue OP_6A OPE4_1 Fue "check float cc unordered or equal") +(conditional-check-float-condition-code cfck ul OP_6A OPE4_1 Ful "check float cc unordered or less") +(conditional-check-float-condition-code cfck ge OP_6A OPE4_1 Fge "check float cc greater or equal") +(conditional-check-float-condition-code cfck lt OP_6A OPE4_1 Flt "check float cc less") +(conditional-check-float-condition-code cfck uge OP_6A OPE4_1 Fuge "check float cc unordered greater or equal") +(conditional-check-float-condition-code cfck ug OP_6A OPE4_1 Fug "check float cc unordered or greater") +(conditional-check-float-condition-code cfck le OP_6A OPE4_1 Fle "check float cc less or equal") +(conditional-check-float-condition-code cfck gt OP_6A OPE4_1 Fgt "check float cc greater") +(conditional-check-float-condition-code cfck ule OP_6A OPE4_1 Fule "check float cc unordered less or equal") +(conditional-check-float-condition-code cfck u OP_6A OPE4_1 Fu "check float cc unordered") +(conditional-check-float-condition-code cfck o OP_6A OPE4_1 Fo "check float cc ordered") + +(dni cjmpl + "conditional jump and link" + ((UNIT I0) (FR500-MAJOR I-5) (FR550-MAJOR I-6) (FR400-MAJOR I-5) CONDITIONAL) + "cjmpl$pack @($GRi,$GRj),$CCi,$cond" + (+ pack (misc-null-1) (LI-off) OP_6A GRi CCi cond OPE4_2 GRj) + (if (eq CCi (or cond 2)) + (jump-and-link-semantics GRi GRj LI)) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch)) (fr550 (unit u-branch))) +) + +(dni ccalll + "conditional call and link" + ((UNIT I0) (FR500-MAJOR I-5) (FR400-MAJOR I-5) CONDITIONAL) + "ccalll$pack @($GRi,$GRj),$CCi,$cond" + (+ pack (misc-null-1) (LI-on) OP_6A GRi CCi cond OPE4_2 GRj) + (if (eq CCi (or cond 2)) + (jump-and-link-semantics GRi GRj LI)) + ((fr400 (unit u-branch)) + (fr500 (unit u-branch))) +) + +(define-pmacro (cache-invalidate name cache all op ope profile comment) + (dni name + (comment) + ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2)) + (.str name "$pack @($GRi,$GRj)") + (+ pack (rd-null) op GRi ope GRj) + (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) all) + profile + ) +) + +(cache-invalidate ici insn 0 OP_03 OPE1_38 + ((fr400 (unit u-ici)) (fr500 (unit u-ici)) (fr550 (unit u-ici))) + "invalidate insn cache") +(cache-invalidate dci data 0 OP_03 OPE1_3C + ((fr400 (unit u-dci)) (fr500 (unit u-dci)) (fr550 (unit u-dci))) + "invalidate data cache") + +(define-pmacro (cache-invalidate-entry name cache op ope profile comment) + (dni name + (comment) + ((UNIT C) (FR400-MAJOR C-2) (FR550-MAJOR C-2) (MACH fr400,fr550)) + (.str name "$pack @($GRi,$GRj),$ae") + (+ pack (misc-null-1) ae op GRi ope GRj) + (if (eq ae 0) + (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) -1) ; Invalid ae setting for this insn + (c-call VOID (.str "@cpu@_" cache "_cache_invalidate") (add GRi GRj) ae)) + profile + ) +) + +(cache-invalidate-entry icei insn OP_03 OPE1_39 + ((fr400 (unit u-ici)) (fr550 (unit u-ici))) + "invalidate insn cache entry") +(cache-invalidate-entry dcei data OP_03 OPE1_3A + ((fr400 (unit u-dci)) (fr550 (unit u-dci))) + "invalidate data cache entry") + +(dni dcf + "Data cache flush" + ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2)) + "dcf$pack @($GRi,$GRj)" + (+ pack (rd-null) OP_03 GRi OPE1_3D GRj) + (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) 0) + ((fr400 (unit u-dcf)) + (fr500 (unit u-dcf)) (fr550 (unit u-dcf))) +) + +(dni dcef + "Data cache entry flush" + ((UNIT C) (FR400-MAJOR C-2) (FR550-MAJOR C-2) (MACH fr400,fr550)) + "dcef$pack @($GRi,$GRj),$ae" + (+ pack (misc-null-1) ae OP_03 GRi OPE1_3B GRj) + (if (eq ae 0) + (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) -1) + (c-call VOID "@cpu@_data_cache_flush" (add GRi GRj) ae)) + ((fr400 (unit u-dcf)) (fr550 (unit u-dcf))) +) + +(define-pmacro (write-TLB name insn op ope comment) + (dni name + (comment) + ((UNIT C) (FR500-MAJOR C-2) (MACH frv) PRIVILEGED) + (.str insn "$pack $GRk,@($GRi,$GRj)") + (+ pack GRk op GRi ope GRj) + (nop) ; for now + () + ) +) + +(write-TLB witlb witlb OP_03 OPE1_32 "write for insn TLB") +(write-TLB wdtlb wdtlb OP_03 OPE1_36 "write for data TLB") + +(define-pmacro (invalidate-TLB name insn op ope comment) + (dni name + (comment) + ((UNIT C) (FR500-MAJOR C-2) (MACH frv) PRIVILEGED) + (.str insn "$pack @($GRi,$GRj)") + (+ pack (rd-null) op GRi ope GRj) + (nop) ; for now + () + ) +) + +(invalidate-TLB itlbi itlbi OP_03 OPE1_33 "invalidate insn TLB") +(invalidate-TLB dtlbi dtlbi OP_03 OPE1_37 "invalidate data TLB") + +(define-pmacro (cache-preload name cache pipe attrs op ope profile comment) + (dni name + (comment) + (.splice (UNIT pipe) (FR500-MAJOR C-2) (FR400-MAJOR C-2) (.unsplice attrs)) + (.str name "$pack $GRi,$GRj,$lock") + (+ pack (misc-null-1) lock op GRi ope GRj) + (c-call VOID (.str "@cpu@_" cache "_cache_preload") GRi GRj lock) + profile + ) +) + +(cache-preload icpl insn C ((FR550-MAJOR C-2)) OP_03 OPE1_30 + ((fr400 (unit u-icpl)) (fr500 (unit u-icpl)) (fr550 (unit u-icpl))) + "preload insn cache") +(cache-preload dcpl data DCPL ((FR550-MAJOR I-8)) OP_03 OPE1_34 + ((fr400 (unit u-dcpl)) (fr500 (unit u-dcpl)) (fr550 (unit u-dcpl))) + "preload data cache") + +(define-pmacro (cache-unlock name cache op ope profile comment) + (dni name + (comment) + ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2)) + (.str name "$pack $GRi") + (+ pack (rd-null) op GRi ope (GRj-null)) + (c-call VOID (.str "@cpu@_" cache "_cache_unlock") GRi) + profile + ) +) + +(cache-unlock icul insn OP_03 OPE1_31 + ((fr400 (unit u-icul)) (fr500 (unit u-icul)) (fr550 (unit u-icul))) + "unlock insn cache") +(cache-unlock dcul data OP_03 OPE1_35 + ((fr400 (unit u-dcul)) (fr500 (unit u-dcul)) (fr550 (unit u-dcul))) + "unlock data cache") + +(define-pmacro (barrier name insn op ope profile comment) + (dni name + (comment) + ((UNIT C) (FR500-MAJOR C-2) (FR550-MAJOR C-2) (FR400-MAJOR C-2)) + (.str insn "$pack") + (+ pack (rd-null) op (rs-null) ope (GRj-null)) + (nop) ; sufficient implementation + profile + ) +) + +(barrier bar bar OP_03 OPE1_3E + ((fr400 (unit u-barrier)) (fr500 (unit u-barrier))) + "barrier") +(barrier membar membar OP_03 OPE1_3F + ((fr400 (unit u-membar)) (fr500 (unit u-membar))) + "memory barrier") + +; Coprocessor operations +(define-pmacro (cop-op num op) + (dni (.sym cop num) + "Coprocessor operation" + ((UNIT C) (FR500-MAJOR C-2) (MACH frv)) + (.str "cop" num "$pack $s6_1,$CPRi,$CPRj,$CPRk") + (+ pack CPRk op CPRi s6_1 CPRj) + (nop) ; sufficient implementation + () + ) +) + +(cop-op 1 OP_7E) +(cop-op 2 OP_7F) + +(define-pmacro (clear-ne-flag-semantics target_index is_float) + (c-call VOID "@cpu@_clear_ne_flags" target_index is_float) +) + +(define-pmacro (clear-ne-flag-r name op ope reg is_float attr profile comment) + (dni name + (comment) + ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH simple,tomcat,fr500,fr550,frv) attr) + (.str name "$pack $" reg "k") + (+ pack (.sym reg k) op (rs-null) ope (GRj-null)) + (sequence () + ; hack to get this referenced for profiling + (c-raw-call VOID "frv_ref_SI" (.sym reg k)) + (clear-ne-flag-semantics (index-of (.sym reg k)) is_float)) + profile + ) +) + +(clear-ne-flag-r clrgr OP_0A OPE1_00 GR 0 NA + ((fr500 (unit u-clrgr)) (fr550 (unit u-clrgr))) + "Clear GR NE flag") +(clear-ne-flag-r clrfr OP_0A OPE1_02 FR 1 FR-ACCESS + ((fr500 (unit u-clrfr)) (fr550 (unit u-clrfr))) + "Clear FR NE flag") + +(define-pmacro (clear-ne-flag-all name op ope is_float attr profile comment) + (dni name + (comment) + ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH simple,tomcat,fr500,fr550,frv) attr) + (.str name "$pack") + (+ pack (rd-null) op (rs-null) ope (GRj-null)) + (clear-ne-flag-semantics -1 is_float) + profile + ) +) + +(clear-ne-flag-all clrga OP_0A OPE1_01 0 NA + ((fr500 (unit u-clrgr)) (fr550 (unit u-clrgr))) + "Clear GR NE flag ALL") +(clear-ne-flag-all clrfa OP_0A OPE1_03 1 FR-ACCESS + ((fr500 (unit u-clrfr)) (fr550 (unit u-clrfr))) + "Clear FR NE flag ALL") + +(define-pmacro (commit-semantics target_index is_float) + (c-call VOID "@cpu@_commit" target_index is_float) +) + +(define-pmacro (commit-r name op ope reg is_float attr comment) + (dni name + (comment) + ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH frv,fr500,fr550) attr) + (.str name "$pack $" reg "k") + (+ pack (.sym reg k) op (rs-null) ope (GRj-null)) + (commit-semantics (index-of (.sym reg k)) is_float) + ((fr500 (unit u-commit)) (fr550 (unit u-commit))) + ) +) + +(commit-r commitgr OP_0A OPE1_04 GR 0 NA "commit exceptions, specific GR") +(commit-r commitfr OP_0A OPE1_06 FR 1 FR-ACCESS "commit exceptions, specific FR") + +(define-pmacro (commit name op ope is_float attr comment) + (dni name + (comment) + ((UNIT I01) (FR500-MAJOR I-6) (FR550-MAJOR I-7) (MACH frv,fr500,fr550) attr) + (.str name "$pack") + (+ pack (rd-null) op (rs-null) ope (GRj-null)) + (commit-semantics -1 is_float) + ((fr500 (unit u-commit)) (fr550 (unit u-commit))) + ) +) + +(commit commitga OP_0A OPE1_05 0 NA "commit exceptions, any GR") +(commit commitfa OP_0A OPE1_07 1 FR-ACCESS "commit exceptions, any FR") + +(define-pmacro (floating-point-conversion + name op ope conv mode src targ attr comment) + (dni name + (comment) + (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr)) + (.str name "$pack $" src ",$" targ) + (+ pack targ op (rs-null) ope src) + (set targ (conv mode src)) + ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert))) + ) +) + +(floating-point-conversion fitos OP_79 OPE1_00 float SF FRintj FRk + ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) + "Convert Integer to Single") +(floating-point-conversion fstoi OP_79 OPE1_01 fix SI FRj FRintk + ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) + "Convert Single to Integer") +(floating-point-conversion fitod OP_7A OPE1_00 float DF FRintj FRdoublek + ((MACH frv)) + "Convert Integer to Double") +(floating-point-conversion fdtoi OP_7A OPE1_01 fix SI FRdoublej FRintk + ((MACH frv)) + "Convert Double to Integer") + +(define-pmacro (floating-point-dual-conversion + name op ope conv mode src src_hw targ targ_hw attr comment) + (dni name + (comment) + ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1) attr) + (.str name "$pack $" src ",$" targ) + (+ pack targ op (rs-null) ope src) + (sequence () + (set targ (conv mode src)) + (set (nextreg targ_hw targ 1) + (conv mode (nextreg src_hw src 1)))) + ((fr500 (unit u-float-dual-convert))) + ) +) + +(floating-point-dual-conversion fditos OP_79 OPE1_10 float SF FRintj h-fr_int FRk h-fr NA "Dual Convert Integer to Single") +(floating-point-dual-conversion fdstoi OP_79 OPE1_11 fix SI FRj h-fr FRintk h-fr_int NA "Dual Convert Single to Integer") + +(define-pmacro (ne-floating-point-dual-conversion + name op ope conv mode src src_hw targ targ_hw attr comment) + (dni name + (comment) + ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1) NON-EXCEPTING attr) + (.str name "$pack $" src ",$" targ) + (+ pack targ op (rs-null) ope src) + (sequence () + (c-call VOID "@cpu@_set_ne_index" (index-of targ)) + (set targ (conv mode src)) + (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 1)) + (set (nextreg targ_hw targ 1) + (conv mode (nextreg src_hw src 1)))) + ((fr500 (unit u-float-dual-convert))) + ) +) + +(ne-floating-point-dual-conversion nfditos OP_79 OPE1_30 float SF FRintj h-fr_int FRk h-fr NA "Non excepting dual Convert Integer to Single") +(ne-floating-point-dual-conversion nfdstoi OP_79 OPE1_31 fix SI FRj h-fr FRintk h-fr_int NA "Non excepting dual Convert Single to Integer") + +(define-pmacro (conditional-floating-point-conversion + name op ope conv mode src targ comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack $" src ",$" targ ",$CCi,$cond") + (+ pack targ op (rs-null) CCi cond ope src) + (if (eq CCi (or cond 2)) + (set targ (conv mode src))) + ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert))) + ) +) + +(conditional-floating-point-conversion cfitos OP_6B OPE4_0 float SF FRintj FRk "Conditional convert Integer to Single") +(conditional-floating-point-conversion cfstoi OP_6B OPE4_1 fix SI FRj FRintk "Conditional convert Single to Integer") + +(define-pmacro (ne-floating-point-conversion + name op ope conv mode src targ comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack $" src ",$" targ) + (+ pack targ op (rs-null) ope src) + (sequence () + (c-call VOID "@cpu@_set_ne_index" (index-of targ)) + (set targ (conv mode src))) + ((fr500 (unit u-float-convert)) (fr550 (unit u-float-convert))) + ) +) + +(ne-floating-point-conversion nfitos OP_79 OPE1_20 float SF FRintj FRk "NE convert Integer to Single") +(ne-floating-point-conversion nfstoi OP_79 OPE1_21 fix SI FRj FRintk "NE convert Single to Integer") + +(register-transfer fmovs OP_79 OPE1_02 + FRj FRk FMALL + ((FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) + ((fr500 (unit u-fr2fr))) + "Move Single Float") +(register-transfer fmovd OP_7A OPE1_02 + ; TODO -- unit doesn't handle extra register + FRdoublej FRdoublek FM01 + ((FR500-MAJOR F-1) (MACH frv)) + ((fr500 (unit u-fr2fr)) (fr550 (unit u-fr2fr))) + "Move Double Float") + +(dni fdmovs + "Dual move single float" + ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1)) + "fdmovs$pack $FRj,$FRk" + (+ pack FRk OP_79 (rs-null) OPE1_12 FRj) + (sequence () + (set FRk FRj) + (set (nextreg h-fr FRk 1) (nextreg h-fr FRj 1))) + ; TODO -- unit doesn't handle extra register + ((fr500 (unit u-fr2fr))) +) + +(conditional-register-transfer cfmovs OP_6C OPE4_0 FRj FRk FM01 + ((FR500-MAJOR F-1) (FR550-MAJOR F-2) + (MACH simple,tomcat,fr500,fr550,frv)) + ((fr500 (unit u-fr2fr)) (fr550 (unit u-fr2fr))) + "Conditional move Single Float") + +(define-pmacro (floating-point-neg name src targ op ope attr comment) + (dni name + (comment) + (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr)) + (.str name "$pack $" src ",$" targ) + (+ pack src op (rs-null) ope targ) + (set targ (neg src)) + ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith))) + ) +) + +(floating-point-neg fnegs FRj FRk OP_79 OPE1_03 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) "Floating point negate, single") +(floating-point-neg fnegd FRdoublej FRdoublek OP_7A OPE1_03 ((MACH frv)) "Floating point negate, double") + +(dni fdnegs + "Floating point dual negate, single" + ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1)) + "fdnegs$pack $FRj,$FRk" + (+ pack FRk OP_79 (rs-null) OPE1_13 FRj) + (sequence () + (set FRk (neg FRj)) + (set (nextreg h-fr FRk 1) (neg (nextreg h-fr FRj 1)))) + ((fr500 (unit u-float-dual-arith))) +) + +(dni cfnegs + "Conditional floating point negate, single" + ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) + "cfnegs$pack $FRj,$FRk,$CCi,$cond" + (+ pack FRj OP_6C (rs-null) CCi cond OPE4_1 FRk) + (if (eq CCi (or cond 2)) + (set FRk (neg FRj))) + ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith))) +) + +(define-pmacro (float-abs name src targ op ope attr comment) + (dni name + (comment) + (.splice (UNIT FMALL) (FR500-MAJOR F-1) (.unsplice attr)) + (.str name "$pack $" src ",$" targ ) + (+ pack targ op (rs-null) ope src) + (set targ (abs src)) + ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith))) + ) +) + +(float-abs fabss FRj FRk OP_79 OPE1_04 ((FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) "Float absolute value, single") +(float-abs fabsd FRdoublej FRdoublek OP_7A OPE1_04 ((MACH frv)) "Float absolute value, double") + +(dni fdabss + "Floating point dual absolute value, single" + ((MACH frv) (UNIT FMALL) (FR500-MAJOR F-1)) + "fdabss$pack $FRj,$FRk" + (+ pack FRk OP_79 (rs-null) OPE1_14 FRj) + (sequence () + (set FRk (abs FRj)) + (set (nextreg h-fr FRk 1) (abs (nextreg h-fr FRj 1)))) + ((fr500 (unit u-float-dual-arith))) +) + +(dni cfabss + "Conditional floating point absolute value, single" + ((UNIT FMALL) (FR500-MAJOR F-1) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) + "cfabss$pack $FRj,$FRk,$CCi,$cond" + (+ pack FRj OP_6C (rs-null) CCi cond OPE4_2 FRk) + (if (eq CCi (or cond 2)) + (set FRk (abs FRj))) + ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith))) +) + +(dni fsqrts + "Square root single" + ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv)) + "fsqrts$pack $FRj,$FRk" + (+ pack FRk OP_79 (rs-null) OPE1_05 FRj) + (set FRk (sqrt SF FRj)) + ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt))) +) + +(dni fdsqrts + "Dual square root single" + ((MACH frv) (UNIT FM01) (FR500-MAJOR F-4)) + "fdsqrts$pack $FRj,$FRk" + (+ pack FRk OP_79 (rs-null) OPE1_15 FRj) + (sequence () + (set FRk (sqrt SF FRj)) + (set (nextreg h-fr FRk 1) (sqrt (nextreg h-fr FRj 1)))) + ((fr500 (unit u-float-dual-sqrt))) +) + +(dni nfdsqrts + "Non excepting Dual square root single" + ((MACH frv) (UNIT FM01) (FR500-MAJOR F-4) NON-EXCEPTING) + "nfdsqrts$pack $FRj,$FRk" + (+ pack FRk OP_79 (rs-null) OPE1_35 FRj) + (sequence () + (c-call VOID "@cpu@_set_ne_index" (index-of FRk)) + (set FRk (sqrt SF FRj)) + (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1)) + (set (nextreg h-fr FRk 1) (sqrt (nextreg h-fr FRj 1)))) + ((fr500 (unit u-float-dual-sqrt))) +) + +(dni fsqrtd + "Square root double" + ((UNIT FM01) (FR500-MAJOR F-4) (MACH frv)) + "fsqrtd$pack $FRdoublej,$FRdoublek" + (+ pack FRdoublek OP_7A (rs-null) OPE1_05 FRdoublej) + (set FRdoublek (sqrt DF FRdoublej)) + ((fr500 (unit u-float-sqrt))) +) + +(dni cfsqrts + "Conditional square root single" + ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv)) + "cfsqrts$pack $FRj,$FRk,$CCi,$cond" + (+ pack FRk OP_6E (rs-null) CCi cond OPE4_2 FRj) + (if (eq CCi (or cond 2)) + (set FRk (sqrt SF FRj))) + ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt))) +) + +(dni nfsqrts + "Non exception square root, single" + ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv)) + "nfsqrts$pack $FRj,$FRk" + (+ pack FRk OP_79 (rs-null) OPE1_25 FRj) + (sequence () + (c-call VOID "@cpu@_set_ne_index" (index-of FRk)) + (set FRk (sqrt SF FRj))) + ((fr500 (unit u-float-sqrt)) (fr550 (unit u-float-sqrt))) +) + +(define-pmacro (float-binary-op-s name pipe attr operation op ope comment) + (dni name + (comment) + (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv) (.unsplice attr)) + (.str name "$pack $FRi,$FRj,$FRk") + (+ pack FRk op FRi ope FRj) + (set FRk (operation FRi FRj)) + ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith))) + ) +) + +(float-binary-op-s fadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_79 OPE1_06 "add single float") +(float-binary-op-s fsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_79 OPE1_07 "sub single float") +(float-binary-op-s fmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_79 OPE1_08 "mul single float") + +(dni fdivs + "div single float" + ((UNIT FM01) (FR500-MAJOR F-4) (FR550-MAJOR F-3) (MACH simple,tomcat,fr500,fr550,frv)) + "fdivs$pack $FRi,$FRj,$FRk" + (+ pack FRk OP_79 FRi OPE1_09 FRj) + (set FRk (div FRi FRj)) + ((fr500 (unit u-float-div)) + (fr550 (unit u-float-div))) +) + +(define-pmacro (float-binary-op-d name operation op ope major comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR major) (MACH frv)) + (.str name "$pack $FRdoublei,$FRdoublej,$FRdoublek") + (+ pack FRdoublek op FRdoublei ope FRdoublej) + (set FRdoublek (operation FRdoublei FRdoublej)) + ((fr500 (unit u-float-arith))) + ) +) + +(float-binary-op-d faddd add OP_7A OPE1_06 F-2 "add double float") +(float-binary-op-d fsubd sub OP_7A OPE1_07 F-2 "sub double float") +(float-binary-op-d fmuld mul OP_7A OPE1_08 F-3 "mul double float") +(float-binary-op-d fdivd div OP_7A OPE1_09 F-4 "div double float") + +(define-pmacro (conditional-float-binary-op name pipe attr operation op ope profile comment) + (dni name + (comment) + (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv) + (.unsplice attr)) + (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond") + (+ pack FRk op FRi CCi cond ope FRj) + (if (eq CCi (or cond 2)) + (set FRk (operation FRi FRj))) + profile + ) +) + +(conditional-float-binary-op cfadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_6D OPE4_0 + ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith))) + "cond add single") +(conditional-float-binary-op cfsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_6D OPE4_1 + ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith))) + "cond sub single") +(conditional-float-binary-op cfmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_6E OPE4_0 + ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith))) + "cond mul single") +(conditional-float-binary-op cfdivs FM01 ((FR500-MAJOR F-4) (FR550-MAJOR F-3)) div OP_6E OPE4_1 + ((fr500 (unit u-float-div)) (fr550 (unit u-float-div))) + "cond div single") + +(define-pmacro (ne-float-binary-op name pipe attr operation op ope profile comment) + (dni name + (comment) + (.splice (UNIT pipe) (MACH simple,tomcat,fr500,fr550,frv) + (.unsplice attr)) + (.str name "$pack $FRi,$FRj,$FRk") + (+ pack FRk op FRi ope FRj) + (sequence () + (c-call VOID "@cpu@_set_ne_index" (index-of FRk)) + (set FRk (operation FRi FRj))) + profile + ) +) + +(ne-float-binary-op nfadds FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) add OP_79 OPE1_26 + ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith))) + "ne add single") +(ne-float-binary-op nfsubs FMALL ((FR500-MAJOR F-2) (FR550-MAJOR F-2)) sub OP_79 OPE1_27 + ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith))) + "ne sub single") +(ne-float-binary-op nfmuls FM01 ((FR500-MAJOR F-3) (FR550-MAJOR F-3)) mul OP_79 OPE1_28 + ((fr500 (unit u-float-arith)) (fr550 (unit u-float-arith))) + "ne mul single") +(ne-float-binary-op nfdivs FM01 ((FR500-MAJOR F-4) (FR550-MAJOR F-3)) div OP_79 OPE1_29 + ((fr500 (unit u-float-div)) (fr550 (unit u-float-div))) + "ne div single") + +(define-pmacro (fcc-eq) 8) +(define-pmacro (fcc-lt) 4) +(define-pmacro (fcc-gt) 2) +(define-pmacro (fcc-uo) 1) + +(define-pmacro (compare-and-set-fcc arg1 arg2 fcc) + (if (gt arg1 arg2) + (set fcc (fcc-gt)) + (if (eq arg1 arg2) + (set fcc (fcc-eq)) + (if (lt arg1 arg2) + (set fcc (fcc-lt)) + (set fcc (fcc-uo))))) +) + +(dni fcmps + "compare single float" + ((UNIT FMALL) (FR500-MAJOR F-2) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) + "fcmps$pack $FRi,$FRj,$FCCi_2" + (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_0A FRj) + (compare-and-set-fcc FRi FRj FCCi_2) + ((fr500 (unit u-float-compare)) (fr550 (unit u-float-compare))) +) + +(dni fcmpd + "compare double float" + ((UNIT FMALL) (FR500-MAJOR F-2) (MACH frv)) + "fcmpd$pack $FRdoublei,$FRdoublej,$FCCi_2" + (+ pack (cond-null) FCCi_2 OP_7A FRdoublei OPE1_0A FRdoublej) + (compare-and-set-fcc FRdoublei FRdoublej FCCi_2) + ((fr500 (unit u-float-compare))) +) + +(dni cfcmps + "Conditional compare single, float" + ((UNIT FMALL) (FR500-MAJOR F-2) (FR550-MAJOR F-2) (MACH simple,tomcat,fr500,fr550,frv)) + "cfcmps$pack $FRi,$FRj,$FCCi_2,$CCi,$cond" + (+ pack (cond-null) FCCi_2 OP_6D FRi CCi cond OPE4_2 FRj) + (if (eq CCi (or cond 2)) + (compare-and-set-fcc FRi FRj FCCi_2)) + ((fr500 (unit u-float-compare)) (fr550 (unit u-float-compare))) +) + +(dni fdcmps + "float dual compare single" + ((UNIT FMALL) (FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) + "fdcmps$pack $FRi,$FRj,$FCCi_2" + (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_1A FRj) + (sequence () + (compare-and-set-fcc FRi FRj FCCi_2) + (compare-and-set-fcc (nextreg h-fr FRi 1) (nextreg h-fr FRj 1) + (nextreg h-fccr FCCi_2 1))) + ((fr500 (unit u-float-dual-compare)) (fr550 (unit u-float-dual-compare))) +) + +(define-pmacro (float-mul-with-add name add_sub arg1 arg2 targ op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv)) + (.str name "$pack $" arg1 ",$" arg2 ",$" targ) + (+ pack targ op arg1 ope arg2) + (set targ (add_sub (mul arg1 arg2) targ)) + ((fr500 (unit u-float-dual-arith))) + ) +) + +(float-mul-with-add fmadds add FRi FRj FRk OP_79 OPE1_0B "mul with add, single") +(float-mul-with-add fmsubs sub FRi FRj FRk OP_79 OPE1_0C "mul with sub, single") + +(float-mul-with-add fmaddd add FRdoublei FRdoublej FRdoublek OP_7A OPE1_0B "mul with add, double") +(float-mul-with-add fmsubd sub FRdoublei FRdoublej FRdoublek OP_7A OPE1_0C "mul with sub, double") + +(dni fdmadds + "Float dual multiply with add" + ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv)) + "fdmadds$pack $FRi,$FRj,$FRk" + (+ pack FRk OP_79 FRi OPE1_1B FRj) + (sequence () + (set FRk (add (mul FRi FRj) FRk)) + (set (nextreg h-fr FRk 1) + (add (mul (nextreg h-fr FRi 1) (nextreg h-fr FRj 1)) + (nextreg h-fr FRk 1)))) + ; TODO dual registers not referenced for profiling + ((fr500 (unit u-float-dual-arith))) +) + +(dni nfdmadds + "Non excepting float dual multiply with add" + ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv)) + "nfdmadds$pack $FRi,$FRj,$FRk" + (+ pack FRk OP_79 FRi OPE1_3B FRj) + (sequence () + (c-call VOID "@cpu@_set_ne_index" (index-of FRk)) + (set FRk (add (mul FRi FRj) FRk)) + (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1)) + (set (nextreg h-fr FRk 1) + (add (mul (nextreg h-fr FRi 1) (nextreg h-fr FRj 1)) + (nextreg h-fr FRk 1)))) + ; TODO dual registers not referenced for profiling + ((fr500 (unit u-float-dual-arith))) +) + +(define-pmacro (conditional-float-mul-with-add + name add_sub arg1 arg2 targ op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv) CONDITIONAL) + (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond") + (+ pack FRk op FRi CCi cond ope FRj) + (if (eq CCi (or cond 2)) + (set targ (add_sub (mul arg1 arg2) targ))) + ((fr500 (unit u-float-dual-arith))) + ) +) + +(conditional-float-mul-with-add cfmadds add FRi FRj FRk OP_6F OPE4_0 "conditional mul with add, single") +(conditional-float-mul-with-add cfmsubs sub FRi FRj FRk OP_6F OPE4_1 "conditional mul with sub, single") + +(define-pmacro (ne-float-mul-with-add name add_sub arg1 arg2 targ op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR F-5) (MACH frv) NON-EXCEPTING) + (.str name "$pack $" arg1 ",$" arg2 ",$" targ) + (+ pack targ op arg1 ope arg2) + (sequence () + (c-call VOID "@cpu@_set_ne_index" (index-of targ)) + (set targ (add_sub (mul arg1 arg2) targ))) + ((fr500 (unit u-float-dual-arith))) + ) +) + +(ne-float-mul-with-add nfmadds add FRi FRj FRk OP_79 OPE1_2B "non excepting mul with add, single") +(ne-float-mul-with-add nfmsubs sub FRi FRj FRk OP_79 OPE1_2C "non excepting mul with sub, single") + +(define-pmacro (float-parallel-mul-add-semantics cond add_sub arg1 arg2 targ) + (if cond + (sequence () + (set targ (mul arg1 arg2)) + (set (nextreg h-fr targ 1) + (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1))))) +) + +(define-pmacro (float-parallel-mul-add + name add_sub arg1 arg2 targ op ope comment) + (dni name + (comment) + ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack $" arg1 ",$" arg2 ",$" targ) + (+ pack targ op arg1 ope arg2) + (float-parallel-mul-add-semantics 1 add_sub arg1 arg2 targ) + ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith))) + ) +) + +(float-parallel-mul-add fmas add FRi FRj FRk OP_79 OPE1_0E "parallel mul/add, single") +(float-parallel-mul-add fmss sub FRi FRj FRk OP_79 OPE1_0F "parallel mul/sub, single") + +(define-pmacro (float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ) + (sequence () + (set targ (mul arg1 arg2)) + (set (nextreg h-fr targ 1) + (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1))) + (set (nextreg h-fr targ 2) + (mul (nextreg h-fr arg1 2) (nextreg h-fr arg2 2))) + (set (nextreg h-fr targ 3) + (add_sub (nextreg h-fr arg1 3) (nextreg h-fr arg2 3)))) +) + +(define-pmacro (float-dual-parallel-mul-add + name add_sub arg1 arg2 targ op ope comment) + (dni name + (comment) + ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv)) + (.str name "$pack $" arg1 ",$" arg2 ",$" targ) + (+ pack targ op arg1 ope arg2) + (float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ) + () + ) +) + +(float-dual-parallel-mul-add fdmas add FRi FRj FRk OP_79 OPE1_1C "dual parallel mul/add, single") +(float-dual-parallel-mul-add fdmss sub FRi FRj FRk OP_79 OPE1_1D "dual parallel mul/sub, single") + +(define-pmacro (ne-float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ) + (sequence () + (c-call VOID "@cpu@_set_ne_index" (index-of targ)) + (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 1)) + (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 2)) + (c-call VOID "@cpu@_set_ne_index" (add (index-of targ) 3)) + (set targ (mul arg1 arg2)) + (set (nextreg h-fr targ 1) + (add_sub (nextreg h-fr arg1 1) (nextreg h-fr arg2 1))) + (set (nextreg h-fr targ 2) + (mul (nextreg h-fr arg1 2) (nextreg h-fr arg2 2))) + (set (nextreg h-fr targ 3) + (add_sub (nextreg h-fr arg1 3) (nextreg h-fr arg2 3)))) +) + +(define-pmacro (ne-float-dual-parallel-mul-add + name add_sub arg1 arg2 targ op ope comment) + (dni name + (comment) + ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv)) + (.str name "$pack $" arg1 ",$" arg2 ",$" targ) + (+ pack targ op arg1 ope arg2) + (ne-float-dual-parallel-mul-add-semantics add_sub arg1 arg2 targ) + () + ) +) + +(ne-float-dual-parallel-mul-add nfdmas add FRi FRj FRk OP_79 OPE1_3C "non excepting dual parallel mul/add, single") +(ne-float-dual-parallel-mul-add nfdmss sub FRi FRj FRk OP_79 OPE1_3D "non excepting dual parallel mul/sub, single") + +(define-pmacro (conditional-float-parallel-mul-add name add_sub op ope comment) + (dni name + (comment) + ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) CONDITIONAL (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack $FRi,$FRj,$FRk,$CCi,$cond") + (+ pack FRk op FRi CCi cond ope FRj) + (float-parallel-mul-add-semantics (eq CCi (or cond 2)) + add_sub FRi FRj FRk) + ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith))) + ) +) + +(conditional-float-parallel-mul-add cfmas add OP_6F OPE4_2 "conditional parallel mul/add, single") +(conditional-float-parallel-mul-add cfmss sub OP_6F OPE4_3 "conditional parallel mul/sub, single") + +(define-pmacro (float-parallel-mul-add-double-semantics add_sub arg1 arg2 targ) + (sequence () + (set targ (ftrunc SF (mul DF (fext DF arg1) (fext DF arg2)))) + (set (nextreg h-fr targ 1) + (ftrunc SF (add_sub DF + (fext DF (nextreg h-fr arg1 1)) + (fext DF (nextreg h-fr arg2 1)))))) +) + +(define-pmacro (float-parallel-mul-add-double + name add_sub arg1 arg2 targ op ope comment) + (dni name + (comment) + ((UNIT FM01) (FR500-MAJOR F-5) (MACH frv)) + (.str name "$pack $" arg1 ",$" arg2 ",$" targ) + (+ pack targ op arg1 ope arg2) + (float-parallel-mul-add-double-semantics add_sub arg1 arg2 targ) + () + ) +) + +(float-parallel-mul-add-double fmad add FRi FRj FRk OP_7A OPE1_0E "parallel mul/add, double") +(float-parallel-mul-add-double fmsd sub FRi FRj FRk OP_7A OPE1_0F "parallel mul/sub, double") + +(define-pmacro (ne-float-parallel-mul-add name add_sub op ope comment) + (dni name + (comment) + ((UNIT FM01) (FR500-MAJOR F-5) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) + (.str name "$pack $FRi,$FRj,$FRk") + (+ pack FRk op FRi ope FRj) + (sequence () + (c-call VOID "@cpu@_set_ne_index" (index-of FRk)) + (set FRk (mul FRi FRj)) + (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1)) + (set (nextreg h-fr FRk 1) + (add_sub (nextreg h-fr FRi 1) (nextreg h-fr FRj 1)))) + ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith))) + ) +) + +(ne-float-parallel-mul-add nfmas add OP_79 OPE1_2E "ne parallel mul/add,single") +(ne-float-parallel-mul-add nfmss sub OP_79 OPE1_2F "ne parallel mul/sub,single") + +(define-pmacro (float-dual-arith name attr oper1 oper2 op ope comment) + (dni name + (comment) + (.splice (UNIT FM01) (.unsplice attr)) + (.str name "$pack $FRi,$FRj,$FRk") + (+ pack FRk op FRi ope FRj) + (sequence () + (set FRk (oper1 FRi FRj)) + (set (nextreg h-fr FRk 1) + (oper2 (nextreg h-fr FRi 1) (nextreg h-fr FRj 1)))) + ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith))) + ) +) + +(float-dual-arith fdadds ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) add add OP_79 OPE1_16 "dual add, single") +(float-dual-arith fdsubs ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) sub sub OP_79 OPE1_17 "dual sub, single") +(float-dual-arith fdmuls ((FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) mul mul OP_79 OPE1_18 "dual mul, single") +(float-dual-arith fddivs ((FR500-MAJOR F-7) (MACH frv)) div div OP_79 OPE1_19 "dual div,single") +(float-dual-arith fdsads ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) add sub OP_79 OPE1_1E "dual add/sub, single") + +(dni fdmulcs + "Float dual cross multiply single" + ((UNIT FM01) (FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) + "fdmulcs$pack $FRi,$FRj,$FRk" + (+ pack FRk OP_79 FRi OPE1_1F FRj) + (sequence () + (set FRk (mul FRi (nextreg h-fr FRj 1))) + (set (nextreg h-fr FRk 1) (mul (nextreg h-fr FRi 1) FRj))) + ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith))) +) + +(dni nfdmulcs + "NE float dual cross multiply single" + ((UNIT FM01) (FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) + "nfdmulcs$pack $FRi,$FRj,$FRk" + (+ pack FRk OP_79 FRi OPE1_3F FRj) + (sequence () + (c-call VOID "@cpu@_set_ne_index" (index-of FRk)) + (set FRk (mul FRi (nextreg h-fr FRj 1))) + (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1)) + (set (nextreg h-fr FRk 1) (mul (nextreg h-fr FRi 1) FRj))) + ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith))) +) + +(define-pmacro (ne-float-dual-arith name attr oper1 oper2 op ope comment) + (dni name + (comment) + (.splice (UNIT FM01) (.unsplice attr)) + (.str name "$pack $FRi,$FRj,$FRk") + (+ pack FRk op FRi ope FRj) + (sequence () + (c-call VOID "@cpu@_set_ne_index" (index-of FRk)) + (set FRk (oper1 FRi FRj)) + (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1)) + (set (nextreg h-fr FRk 1) + (oper2 (nextreg h-fr FRi 1) (nextreg h-fr FRj 1)))) + ((fr500 (unit u-float-dual-arith)) (fr550 (unit u-float-dual-arith))) + ) +) + +(ne-float-dual-arith nfdadds ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) add add OP_79 OPE1_36 "ne dual add, single") +(ne-float-dual-arith nfdsubs ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) sub sub OP_79 OPE1_37 "ne dual sub, single") +(ne-float-dual-arith nfdmuls ((FR500-MAJOR F-7) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) mul mul OP_79 OPE1_38 "ne dual mul, single") +(ne-float-dual-arith nfddivs ((FR500-MAJOR F-7) (MACH frv)) div div OP_79 OPE1_39 "ne dual div,single") +(ne-float-dual-arith nfdsads ((FR500-MAJOR F-6) (FR550-MAJOR F-4) (MACH simple,tomcat,fr500,fr550,frv)) add sub OP_79 OPE1_3E "ne dual add/sub, single") + +(dni nfdcmps + "non-excepting dual float compare" + ((UNIT FM01) (FR500-MAJOR F-6) (MACH simple,tomcat,frv)) + "nfdcmps$pack $FRi,$FRj,$FCCi_2" + (+ pack (cond-null) FCCi_2 OP_79 FRi OPE1_3A FRj) + (sequence () + (c-call VOID "@cpu@_set_ne_index" (index-of FRk)) + (compare-and-set-fcc FRi FRj FCCi_2) + (c-call VOID "@cpu@_set_ne_index" (add (index-of FRk) 1)) + (compare-and-set-fcc (nextreg h-fr FRi 1) (nextreg h-fr FRj 1) + (nextreg h-fccr FCCi_2 1))) + ((fr500 (unit u-float-dual-compare))) +) + +; Media Instructions +; +(define-pmacro (halfword hilo arg offset) + (reg (.sym h-fr_ hilo) (add (index-of arg) offset))) + +(dni mhsetlos + "Media set lower signed 12 bits" + ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1)) + "mhsetlos$pack $u12,$FRklo" + (+ pack FRklo OP_78 OPE1_20 u12) + (set FRklo u12) + ((fr400 (unit u-media-hilo)) (fr550 (unit u-media-set (out FRintk FRklo)))) +) + +(dni mhsethis + "Media set upper signed 12 bits" + ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1)) + "mhsethis$pack $u12,$FRkhi" + (+ pack FRkhi OP_78 OPE1_22 u12) + (set FRkhi u12) + ((fr400 (unit u-media-hilo)) (fr550 (unit u-media-set (out FRintk FRkhi)))) +) + +(dni mhdsets + "Media dual set halfword signed 12 bits" + ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1)) + "mhdsets$pack $u12,$FRintk" + (+ pack FRintk OP_78 OPE1_24 u12) + (sequence () + ; hack to get FRintk passed to modelling functions + (set FRintk (c-raw-call SI "frv_ref_SI" FRintk)) + (set (halfword hi FRintk 0) u12) + (set (halfword lo FRintk 0) u12)) + ((fr400 (unit u-media-1)) (fr550 (unit u-media-set))) +) + +(define-pmacro (set-5-semantics target value) + (sequence ((HI tmp)) + (set tmp target) + (set tmp (and tmp #x07ff)) + (set tmp (or tmp (sll (and s5 #x1f) 11))) + (set target tmp)) +) + +(define-pmacro (media-set-5 name hilo op ope comment) + (dni name + (comment) + ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1)) + (.str name "$pack $s5,$FRk" hilo) + (+ pack (.sym FRk hilo) op (FRi-null) ope (misc-null-11) s5) + (set-5-semantics (.sym FRk hilo) s5) + ((fr400 (unit u-media-hilo)) (fr550 (unit u-media-set (out FRintk (.sym FRk hilo))))) + ) +) + +(media-set-5 mhsetloh lo OP_78 OPE1_21 "Media set upper 5 bits lo") +(media-set-5 mhsethih hi OP_78 OPE1_23 "Media set upper 5 bits hi") + +(dni mhdseth + "Media dual set halfword upper 5 bits" + ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-5) (FR400-MAJOR M-1)) + "mhdseth$pack $s5,$FRintk" + (+ pack FRintk OP_78 (FRi-null) OPE1_25 (misc-null-11) s5) + (sequence () + ; hack to get FRintk passed to modelling functions + (set FRintk (c-raw-call SI "frv_ref_SI" FRintk)) + (set-5-semantics (halfword hi FRintk 0) s5) + (set-5-semantics (halfword lo FRintk 0) s5)) + ((fr400 (unit u-media-1)) (fr550 (unit u-media-set))) +) + +(define-pmacro (media-logic-r-r name operation op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1)) + (.str name "$pack $FRinti,$FRintj,$FRintk") + (+ pack FRintk op FRinti ope FRintj) + (set FRintk (operation FRinti FRintj)) + ((fr400 (unit u-media-1)) + (fr500 (unit u-media)) (fr550 (unit u-media))) + ) +) + +(media-logic-r-r mand and OP_7B OPE1_00 "and reg/reg") +(media-logic-r-r mor or OP_7B OPE1_01 "or reg/reg") +(media-logic-r-r mxor xor OP_7B OPE1_02 "xor reg/reg") + +(define-pmacro (conditional-media-logic name operation op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1) CONDITIONAL) + (.str name "$pack $FRinti,$FRintj,$FRintk,$CCi,$cond") + (+ pack FRintk op FRinti CCi cond ope FRintj) + (if (eq CCi (or cond 2)) + (set FRintk (operation FRinti FRintj))) + ((fr400 (unit u-media-1)) + (fr500 (unit u-media)) (fr550 (unit u-media))) + ) +) + +(conditional-media-logic cmand and OP_70 OPE4_0 "conditional and reg/reg") +(conditional-media-logic cmor or OP_70 OPE4_1 "conditional or reg/reg") +(conditional-media-logic cmxor xor OP_70 OPE4_2 "conditional xor reg/reg") + +(dni mnot + ("mnot") + ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1)) + ("mnot$pack $FRintj,$FRintk") + (+ pack FRintk OP_7B (rs-null) OPE1_03 FRintj) + (set FRintk (inv FRintj)) + ((fr400 (unit u-media-1)) + (fr500 (unit u-media)) (fr550 (unit u-media))) +) + +(dni cmnot + ("cmnot") + ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1) CONDITIONAL) + ("cmnot$pack $FRintj,$FRintk,$CCi,$cond") + (+ pack FRintk OP_70 (rs-null) CCi cond OPE4_3 FRintj) + (if (eq CCi (or cond 2)) + (set FRintk (inv FRintj))) + ((fr400 (unit u-media-1)) + (fr500 (unit u-media)) (fr550 (unit u-media))) +) + +(define-pmacro (media-rotate-r-r name operation op ope comment) + (dni name + (comment) + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1)) + (.str name "$pack $FRinti,$u6,$FRintk") + (+ pack FRintk op FRinti ope u6) + (set FRintk (operation FRinti (and u6 #x1f))) + ((fr400 (unit u-media-3)) + (fr500 (unit u-media)) (fr550 (unit u-media))) + ) +) + +(media-rotate-r-r mrotli rol OP_7B OPE1_04 "rotate left reg/reg") +(media-rotate-r-r mrotri ror OP_7B OPE1_05 "rotate right reg/reg") + +(define-pmacro (media-cut-r-r name arg op ope comment) + (dni name + (comment) + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2)) + (.str name "$pack $FRinti,$" arg ",$FRintk") + (+ pack FRintk op FRinti ope arg) + (set FRintk (c-call SI "@cpu@_cut" FRinti (nextreg h-fr_int FRinti 1) arg)) + ((fr400 (unit u-media-3)) + (fr500 (unit u-media)) (fr550 (unit u-media))) + ) +) + +(media-cut-r-r mwcut FRintj OP_7B OPE1_06 "media cut") +(media-cut-r-r mwcuti u6 OP_7B OPE1_07 "media cut") + +(define-pmacro (media-cut-acc name arg op ope comment) + (dni name + (comment) + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1)) + (.str name "$pack $ACC40Si,$" arg ",$FRintk") + (+ pack FRintk op ACC40Si ope arg) + (set FRintk (c-call SI "@cpu@_media_cut" ACC40Si arg)) + ((fr400 (unit u-media-4)) + (fr500 (unit u-media)) (fr550 (unit u-media-3-acc))) + ) +) + +(media-cut-acc mcut FRintj OP_7B OPE1_2C "media accumulator cut reg") +(media-cut-acc mcuti s6 OP_7B OPE1_2E "media accumulator cut immed") + +(define-pmacro (media-cut-acc-ss name arg op ope comment) + (dni name + (comment) + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1)) + (.str name "$pack $ACC40Si,$" arg ",$FRintk") + (+ pack FRintk op ACC40Si ope arg) + (set FRintk (c-call SI "@cpu@_media_cut_ss" ACC40Si arg)) + ((fr400 (unit u-media-4)) + (fr500 (unit u-media)) (fr550 (unit u-media-3-acc))) + ) +) + +(media-cut-acc-ss mcutss FRintj OP_7B OPE1_2D "media accumulator cut reg with saturation") +(media-cut-acc-ss mcutssi s6 OP_7B OPE1_2F "media accumulator cut immed with saturation") + +; Dual Media Instructions +; +(define-pmacro (register-unaligned register alignment) + (and (index-of register) (sub alignment 1)) +) + +(dni mdcutssi + "Media dual cut with signed saturation" + ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2)) + "mdcutssi$pack $ACC40Si,$s6,$FRintkeven" + (+ pack FRintkeven OP_78 ACC40Si OPE1_0E s6) + (if (register-unaligned ACC40Si 2) + (c-call VOID "@cpu@_media_acc_not_aligned") + (if (register-unaligned FRintkeven 2) + (c-call VOID "@cpu@_media_register_not_aligned") + (sequence () + (set FRintkeven (c-call SI "@cpu@_media_cut_ss" ACC40Si s6)) + (set (nextreg h-fr_int FRintkeven 1) + (c-call SI "@cpu@_media_cut_ss" + (nextreg h-acc40S ACC40Si 1) s6))))) + ((fr400 (unit u-media-4-acc-dual + (out FRintk FRintkeven))) (fr550 (unit u-media-3-acc-dual))) +) + +; The (add (xxxx) (mul arg 0)) is a hack to get a reference to arg generated +; so it will be passed to the unit modelers. YUCK!!!!! +(define-pmacro (extract-hilo reg1 off1 reg2 off2 arg1hi arg1lo arg2hi arg2lo) + (sequence () + (set arg1hi (add (halfword hi reg1 off1) (mul reg1 0))) + (set arg1lo (add (halfword lo reg1 off1) (mul reg1 0))) + (set arg2hi (add (halfword hi reg2 off2) (mul reg2 0))) + (set arg2lo (add (halfword lo reg2 off2) (mul reg2 0)))) +) + +(dni maveh + "Media dual average" + ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1)) + "maveh$pack $FRinti,$FRintj,$FRintk" + (+ pack FRintk OP_7B FRinti OPE1_08 FRintj) + (set FRintk (c-call SI "@cpu@_media_average" FRinti FRintj)) + ((fr400 (unit u-media-1)) + (fr500 (unit u-media)) (fr550 (unit u-media))) +) + +(define-pmacro (media-dual-shift name operation op ope profile comment) + (dni name + (comment) + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1)) + (.str name "$pack $FRinti,$u6,$FRintk") + (+ pack FRintk op FRinti ope u6) + (sequence () + ; hack to get these referenced for profiling + (set FRinti (c-raw-call SI "frv_ref_SI" FRinti)) + (set FRintk (c-raw-call SI "frv_ref_SI" FRintk)) + (set (halfword hi FRintk 0) + (operation (halfword hi FRinti 0) (and u6 #xf))) + (set (halfword lo FRintk 0) + (operation (halfword lo FRinti 0) (and u6 #xf)))) + profile + ) +) + +(media-dual-shift msllhi sll OP_7B OPE1_09 + ((fr400 (unit u-media-3)) (fr500 (unit u-media)) (fr550 (unit u-media))) + "Media dual shift left logical") +(media-dual-shift msrlhi srl OP_7B OPE1_0A + ((fr400 (unit u-media-3)) (fr500 (unit u-media)) (fr550 (unit u-media))) + "Media dual shift right logical") +(media-dual-shift msrahi sra OP_7B OPE1_0B + ((fr400 (unit u-media-6)) (fr500 (unit u-media)) (fr550 (unit u-media))) + "Media dual shift right arithmetic") + +(define-pmacro (media-dual-word-rotate-r-r name operation op ope comment) + (dni name + (comment) + ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2)) + (.str name "$pack $FRintieven,$s6,$FRintkeven") + (+ pack FRintkeven op FRintieven ope s6) + (if (orif (register-unaligned FRintieven 2) + (register-unaligned FRintkeven 2)) + (c-call VOID "@cpu@_media_register_not_aligned") + (sequence () + (set FRintkeven (operation FRintieven (and s6 #x1f))) + (set (nextreg h-fr_int FRintkeven 1) + (operation (nextreg h-fr_int FRintieven 1) + (and s6 #x1f))))) + ((fr400 (unit u-media-3-quad + (in FRinti FRintieven) + (out FRintk FRintkeven))) (fr550 (unit u-media-quad))) + ) +) + +(media-dual-word-rotate-r-r mdrotli rol OP_78 OPE1_0B "rotate left reg/reg") + +(dni mcplhi + "Media bit concatenate, halfword" + ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2)) + "mcplhi$pack $FRinti,$u6,$FRintk" + (+ pack FRintk OP_78 FRinti OPE1_0C u6) + (sequence ((HI arg1) (HI arg2) (HI shift)) + (set FRinti (c-raw-call SI "frv_ref_SI" FRinti)) + (set FRintk (c-raw-call SI "frv_ref_SI" FRintk)) + (set shift (and u6 #xf)) + (set arg1 (sll (halfword hi FRinti 0) shift)) + (if (ne shift 0) + (sequence () + (set arg2 (halfword hi FRinti 1)) + (set arg2 (srl HI (sll HI arg2 (sub 15 shift)) + (sub 15 shift))) + (set arg1 (or HI arg1 arg2)))) + (set (halfword hi FRintk 0) arg1)) + ((fr400 (unit u-media-3-dual)) (fr550 (unit u-media-3-dual))) +) + +(dni mcpli + "Media bit concatenate, word" + ((UNIT FMLOW) (MACH fr400,fr550) (FR550-MAJOR M-3) (FR400-MAJOR M-2)) + "mcpli$pack $FRinti,$u6,$FRintk" + (+ pack FRintk OP_78 FRinti OPE1_0D u6) + (sequence ((SI tmp) (SI shift)) + (set shift (and u6 #x1f)) + (set tmp (sll FRinti shift)) + (if (ne shift 0) + (sequence ((SI tmp1)) + (set tmp1 (srl (sll (nextreg h-fr_int FRinti 1) + (sub 31 shift)) + (sub 31 shift))) + (set tmp (or tmp tmp1)))) + (set FRintk tmp)) + ((fr400 (unit u-media-3-dual)) (fr550 (unit u-media-3-dual))) +) + +(define-pmacro (saturate arg max min result) + (if (gt arg max) + (set result max) + (if (lt arg min) + (set result min) + (set result arg))) +) + +(dni msaths + "Media dual saturation signed" + ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1)) + "msaths$pack $FRinti,$FRintj,$FRintk" + (+ pack FRintk OP_7B FRinti OPE1_0C FRintj) + (sequence ((HI argihi) (HI argilo) (HI argjhi) (HI argjlo)) + (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo) + (saturate argihi argjhi (inv argjhi) (halfword hi FRintk 0)) + (saturate argilo argjlo (inv argjlo) (halfword lo FRintk 0))) + ((fr400 (unit u-media-1)) + (fr500 (unit u-media)) (fr550 (unit u-media))) +) + +(dni mqsaths + "Media quad saturation signed" + ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-2) (FR400-MAJOR M-1)) + "mqsaths$pack $FRintieven,$FRintjeven,$FRintkeven" + (+ pack FRintkeven OP_78 FRintieven OPE1_0F FRintjeven) + (if (orif (register-unaligned FRintieven 2) + (orif (register-unaligned FRintjeven 2) + (register-unaligned FRintkeven 2))) + (c-call VOID "@cpu@_media_register_not_aligned") + (sequence ((HI argihi) (HI argilo) (HI argjhi) (HI argjlo)) + ; hack to get FRintkeven referenced as a target for profiling + (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven)) + (extract-hilo FRintieven 0 FRintjeven 0 argihi argilo argjhi argjlo) + (saturate argihi argjhi (inv argjhi) (halfword hi FRintkeven 0)) + (saturate argilo argjlo (inv argjlo) (halfword lo FRintkeven 0)) + (extract-hilo FRintieven 1 FRintjeven 1 argihi argilo argjhi argjlo) + (saturate argihi argjhi (inv argjhi) (halfword hi FRintkeven 1)) + (saturate argilo argjlo (inv argjlo) (halfword lo FRintkeven 1)))) + ((fr400 (unit u-media-1-quad + (in FRinti FRintieven) + (in FRintj FRintjeven) + (out FRintk FRintkeven))) (fr550 (unit u-media-quad))) +) + +(define-pmacro (saturate-unsigned arg max result) + (if (gt arg max) + (set result max) + (set result arg)) +) + +(dni msathu + "Media dual saturation unsigned" + ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1)) + "msathu$pack $FRinti,$FRintj,$FRintk" + (+ pack FRintk OP_7B FRinti OPE1_0D FRintj) + (sequence ((UHI argihi) (UHI argilo) (UHI argjhi) (UHI argjlo)) + (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo) + (saturate-unsigned argihi argjhi (halfword hi FRintk 0)) + (saturate-unsigned argilo argjlo (halfword lo FRintk 0))) + ((fr400 (unit u-media-1)) + (fr500 (unit u-media)) (fr550 (unit u-media))) +) + +(define-pmacro (media-dual-compare name mode op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1)) + (.str name "$pack $FRinti,$FRintj,$FCCk") + (+ pack (cond-null) FCCk op FRinti ope FRintj) + (if (register-unaligned FCCk 2) + (c-call VOID "@cpu@_media_cr_not_aligned") + (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo)) + (extract-hilo FRinti 0 FRintj 0 + argihi argilo argjhi argjlo) + (compare-and-set-fcc argihi argjhi FCCk) + (compare-and-set-fcc argilo argjlo (nextreg h-fccr FCCk 1)))) + ; TODO - doesn't handle second FCC + ((fr400 (unit u-media-7)) + (fr500 (unit u-media)) (fr550 (unit u-media))) + ) +) + +(media-dual-compare mcmpsh HI OP_7B OPE1_0E "Media dual compare signed") +(media-dual-compare mcmpuh UHI OP_7B OPE1_0F "Media dual compare unsigned") + +; Bits for the MSR.SIE field +(define-pmacro (msr-sie-nil) 0) +(define-pmacro (msr-sie-fri-hi) 8) +(define-pmacro (msr-sie-fri-lo) 4) +(define-pmacro (msr-sie-fri-1-hi) 2) +(define-pmacro (msr-sie-fri-1-lo) 1) +(define-pmacro (msr-sie-acci) 8) +(define-pmacro (msr-sie-acci-1) 4) +(define-pmacro (msr-sie-acci-2) 2) +(define-pmacro (msr-sie-acci-3) 1) + +(define-pmacro (saturate-v arg max min sie result) + (if (gt DI arg max) + (sequence () + (set result max) + (c-call VOID "@cpu@_media_overflow" sie)) + (if (lt DI arg min) + (sequence () + (set result min) + (c-call VOID "@cpu@_media_overflow" sie)) + (set result arg))) +) + +(dni mabshs + "Media dual absolute value, halfword" + ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-2) (FR400-MAJOR M-1)) + "mabshs$pack $FRintj,$FRintk" + (+ pack FRintk OP_78 (FRi-null) OPE1_0A FRintj) + (sequence ((HI arghi) (HI arglo)) + (set FRintj (c-raw-call SI "frv_ref_SI" FRintj)) + (set FRintk (c-raw-call SI "frv_ref_SI" FRintk)) + (set arghi (halfword hi FRintj 0)) + (set arglo (halfword lo FRintj 0)) + (saturate-v (abs arghi) 32767 -32768 (msr-sie-fri-hi) + (halfword hi FRintk 0)) + (saturate-v (abs arglo) 32767 -32768 (msr-sie-fri-lo) + (halfword lo FRintk 0))) + ((fr400 (unit u-media-1)) (fr550 (unit u-media))) +) + +(define-pmacro (media-arith-sat-semantics + operation arg1 arg2 res mode max min sie) + (sequence ((DI tmp)) + (set tmp (operation arg1 arg2)) + (saturate-v tmp max min sie res)) +) + +(define-pmacro (media-dual-arith-sat-semantics operation mode max min) + (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo)) + (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo) + (media-arith-sat-semantics operation argihi argjhi + (halfword hi FRintk 0) mode max min + (msr-sie-fri-hi)) + (media-arith-sat-semantics operation argilo argjlo + (halfword lo FRintk 0) mode max min + (msr-sie-fri-lo))) +) + +(define-pmacro (media-dual-arith-sat name operation mode max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1)) + (.str name "$pack $FRinti,$FRintj,$FRintk") + (+ pack FRintk op FRinti ope FRintj) + (media-dual-arith-sat-semantics operation mode max min) + ((fr400 (unit u-media-1)) + (fr500 (unit u-media)) (fr550 (unit u-media))) + ) +) + +(media-dual-arith-sat maddhss add HI 32767 -32768 OP_7B OPE1_10 "Media dual add signed with saturation") +(media-dual-arith-sat maddhus add UHI 65535 0 OP_7B OPE1_11 "Media dual add unsigned with saturation") + +(media-dual-arith-sat msubhss sub HI 32767 -32768 OP_7B OPE1_12 "Media dual sub signed with saturation") +(media-dual-arith-sat msubhus sub UHI 65535 0 OP_7B OPE1_13 "Media dual sub unsigned with saturation") + +(define-pmacro (conditional-media-dual-arith-sat + name operation mode max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-1) CONDITIONAL) + (.str name "$pack $FRinti,$FRintj,$FRintk,$CCi,$cond") + (+ pack FRintk op FRinti CCi cond ope FRintj) + (if (eq CCi (or cond 2)) + (media-dual-arith-sat-semantics operation mode max min)) + ((fr400 (unit u-media-1)) + (fr500 (unit u-media)) (fr550 (unit u-media))) + ) +) + +(conditional-media-dual-arith-sat cmaddhss add HI 32767 -32768 OP_71 OPE4_0 "Conditional Media dual add signed with saturation") +(conditional-media-dual-arith-sat cmaddhus add UHI 65535 0 OP_71 OPE4_1 "Conditional Media dual add unsigned with saturation") + +(conditional-media-dual-arith-sat cmsubhss sub HI 32767 -32768 OP_71 OPE4_2 "Conditional Media dual sub signed with saturation") +(conditional-media-dual-arith-sat cmsubhus sub UHI 65535 0 OP_71 OPE4_3 "Conditional Media dual sub unsigned with saturation") + +(define-pmacro (media-quad-arith-sat-semantics cond operation mode max min) + (if (orif (register-unaligned FRintieven 2) + (orif (register-unaligned FRintjeven 2) + (register-unaligned FRintkeven 2))) + (c-call VOID "@cpu@_media_register_not_aligned") + (if cond + (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo)) + ; hack to get FRintkeven referenced as a target for profiling + (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven)) + (extract-hilo FRintieven 0 FRintjeven 0 + argihi argilo argjhi argjlo) + (media-arith-sat-semantics operation argihi argjhi + (halfword hi FRintkeven 0) mode + max min (msr-sie-fri-hi)) + (media-arith-sat-semantics operation argilo argjlo + (halfword lo FRintkeven 0) mode + max min (msr-sie-fri-lo)) + (extract-hilo FRintieven 1 FRintjeven 1 + argihi argilo argjhi argjlo) + (media-arith-sat-semantics operation argihi argjhi + (halfword hi FRintkeven 1) mode + max min (msr-sie-fri-1-hi)) + (media-arith-sat-semantics operation argilo argjlo + (halfword lo FRintkeven 1) mode + max min (msr-sie-fri-1-lo))))) +) + +(define-pmacro (media-quad-arith-sat name operation mode max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-2)) + (.str name "$pack $FRintieven,$FRintjeven,$FRintkeven") + (+ pack FRintkeven op FRintieven ope FRintjeven) + (media-quad-arith-sat-semantics 1 operation mode max min) + ((fr400 (unit u-media-1-quad + (in FRinti FRintieven) + (in FRintj FRintjeven) + (out FRintk FRintkeven))) + (fr500 (unit u-media-quad-arith + (in FRinti FRintieven) + (in FRintj FRintjeven) + (out FRintk FRintkeven))) (fr550 (unit u-media-quad))) + ) +) + +(media-quad-arith-sat mqaddhss add HI 32767 -32768 OP_7B OPE1_18 "Media quad add signed with saturation") +(media-quad-arith-sat mqaddhus add UHI 65535 0 OP_7B OPE1_19 "Media quad add unsigned with saturation") + +(media-quad-arith-sat mqsubhss sub HI 32767 -32768 OP_7B OPE1_1A "Media quad sub signed with saturation") +(media-quad-arith-sat mqsubhus sub UHI 65535 0 OP_7B OPE1_1B "Media quad sub unsigned with saturation") + +(define-pmacro (conditional-media-quad-arith-sat + name operation mode max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-2) (FR400-MAJOR M-2) CONDITIONAL) + (.str name "$pack $FRintieven,$FRintjeven,$FRintkeven,$CCi,$cond") + (+ pack FRintkeven op FRintieven CCi cond ope FRintjeven) + (media-quad-arith-sat-semantics (eq CCi (or cond 2)) + operation mode max min) + ((fr400 (unit u-media-1-quad + (in FRinti FRintieven) + (in FRintj FRintjeven) + (out FRintk FRintkeven))) + (fr500 (unit u-media-quad-arith + (in FRinti FRintieven) + (in FRintj FRintjeven) + (out FRintk FRintkeven))) (fr550 (unit u-media-quad))) + ) +) + +(conditional-media-quad-arith-sat cmqaddhss add HI 32767 -32768 OP_73 OPE4_0 "Conditional Media quad add signed with saturation") +(conditional-media-quad-arith-sat cmqaddhus add UHI 65535 0 OP_73 OPE4_1 "Conditional Media quad add unsigned with saturation") + +(conditional-media-quad-arith-sat cmqsubhss sub HI 32767 -32768 OP_73 OPE4_2 "Conditional Media quad sub signed with saturation") +(conditional-media-quad-arith-sat cmqsubhus sub UHI 65535 0 OP_73 OPE4_3 "Conditional Media quad sub unsigned with saturation") + +(define-pmacro (media-acc-arith-sat name operation mode max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-1)) + (.str name "$pack $ACC40Si,$ACC40Sk") + (+ pack ACC40Sk op ACC40Si ope (ACCj-null)) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si)) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk)) + (if (register-unaligned ACC40Si 2) + (c-call VOID "@cpu@_media_acc_not_aligned") + (media-arith-sat-semantics operation ACC40Si + (nextreg h-acc40S ACC40Si 1) + ACC40Sk mode max min (msr-sie-acci))))) + ((fr400 (unit u-media-2-acc)) (fr550 (unit u-media-4-acc))) + ) +) + +(media-acc-arith-sat maddaccs add DI #x7fffffffff (inv DI #x7fffffffff) + OP_78 OPE1_04 "Media accumulator addition") +(media-acc-arith-sat msubaccs sub DI #x7fffffffff (inv DI #x7fffffffff) + OP_78 OPE1_05 "Media accumulator subtraction") + +(define-pmacro (media-dual-acc-arith-sat name operation mode max min op ope + comment) + (dni name + (comment) + ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2)) + (.str name "$pack $ACC40Si,$ACC40Sk") + (+ pack ACC40Sk op ACC40Si ope (ACCj-null)) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si)) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk)) + (if (register-unaligned ACC40Si 4) + (c-call VOID "@cpu@_media_acc_not_aligned") + (if (register-unaligned ACC40Sk 2) + (c-call VOID "@cpu@_media_acc_not_aligned") + (sequence () + (media-arith-sat-semantics operation ACC40Si + (nextreg h-acc40S ACC40Si 1) + ACC40Sk mode max min + (msr-sie-acci)) + (media-arith-sat-semantics operation + (nextreg h-acc40S ACC40Si 2) + (nextreg h-acc40S ACC40Si 3) + (nextreg h-acc40S ACC40Sk 1) + mode max min + (msr-sie-acci-1))))))) + ((fr400 (unit u-media-2-acc-dual)) (fr550 (unit u-media-4-acc-dual))) + ) +) + +(media-dual-acc-arith-sat mdaddaccs add DI #x7fffffffff (inv DI #x7fffffffff) + OP_78 OPE1_06 "Media accumulator addition") +(media-dual-acc-arith-sat mdsubaccs sub DI #x7fffffffff (inv DI #x7fffffffff) + OP_78 OPE1_07 "Media accumulator subtraction") + +(dni masaccs + "Media add and subtract signed accumulator with saturation" + ((UNIT FMALL) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-1)) + "masaccs$pack $ACC40Si,$ACC40Sk" + (+ pack ACC40Sk OP_78 ACC40Si OPE1_08 (ACCj-null)) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si)) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk)) + (if (register-unaligned ACC40Si 2) + (c-call VOID "@cpu@_media_acc_not_aligned") + (if (register-unaligned ACC40Sk 2) + (c-call VOID "@cpu@_media_acc_not_aligned") + (sequence () + (media-arith-sat-semantics add ACC40Si + (nextreg h-acc40S ACC40Si 1) + ACC40Sk DI + #x7fffffffff + (inv DI #x7fffffffff) + (msr-sie-acci)) + (media-arith-sat-semantics sub ACC40Si + (nextreg h-acc40S ACC40Si 1) + (nextreg h-acc40S ACC40Sk 1) + DI + #x7fffffffff + (inv DI #x7fffffffff) + (msr-sie-acci-1))))))) + ((fr400 (unit u-media-2-add-sub)) (fr550 (unit u-media-4-add-sub))) + ) + +(dni mdasaccs + "Media add and subtract signed accumulator with saturation" + ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2)) + "mdasaccs$pack $ACC40Si,$ACC40Sk" + (+ pack ACC40Sk OP_78 ACC40Si OPE1_09 (ACCj-null)) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Si)) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk)) + (if (register-unaligned ACC40Si 4) + (c-call VOID "@cpu@_media_acc_not_aligned") + (if (register-unaligned ACC40Sk 4) + (c-call VOID "@cpu@_media_acc_not_aligned") + (sequence () + (media-arith-sat-semantics add ACC40Si + (nextreg h-acc40S ACC40Si 1) + ACC40Sk DI + #x7fffffffff + (inv DI #x7fffffffff) + (msr-sie-acci)) + (media-arith-sat-semantics sub ACC40Si + (nextreg h-acc40S ACC40Si 1) + (nextreg h-acc40S ACC40Sk 1) + DI + #x7fffffffff + (inv DI #x7fffffffff) + (msr-sie-acci-1)) + (media-arith-sat-semantics add + (nextreg h-acc40S ACC40Si 2) + (nextreg h-acc40S ACC40Si 3) + (nextreg h-acc40S ACC40Sk 2) + DI + #x7fffffffff + (inv DI #x7fffffffff) + (msr-sie-acci-2)) + (media-arith-sat-semantics sub + (nextreg h-acc40S ACC40Si 2) + (nextreg h-acc40S ACC40Si 3) + (nextreg h-acc40S ACC40Sk 3) + DI + #x7fffffffff + (inv DI #x7fffffffff) + (msr-sie-acci-3))))))) + ((fr400 (unit u-media-2-add-sub-dual)) (fr550 (unit u-media-4-add-sub-dual))) + ) + +(define-pmacro (media-multiply-semantics conv arg1 arg2 res) + (set res (mul DI (conv DI arg1) (conv DI arg2))) +) + +(define-pmacro (media-dual-multiply-semantics cond mode conv rhs1 rhs2) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk)) + (if (register-unaligned ACC40Sk 2) + (c-call VOID "@cpu@_media_acc_not_aligned") + (if cond + (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo)) + (extract-hilo FRinti 0 FRintj 0 + argihi argilo argjhi argjlo) + (media-multiply-semantics conv argihi rhs1 ACC40Sk) + (media-multiply-semantics conv argilo rhs2 + (nextreg h-acc40S ACC40Sk 1)))))) +) + +(define-pmacro (media-dual-multiply name mode conv rhs1 rhs2 op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) PRESERVE-OVF) + (.str name "$pack $FRinti,$FRintj,$ACC40Sk") + (+ pack ACC40Sk op FRinti ope FRintj) + (media-dual-multiply-semantics 1 mode conv rhs1 rhs2) + ((fr400 (unit u-media-2)) + (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4))) + ) +) + +(media-dual-multiply mmulhs HI ext argjhi argjlo OP_7B OPE1_14 "Media dual multiply signed") +(media-dual-multiply mmulhu UHI zext argjhi argjlo OP_7B OPE1_15 "Media dual multiply unsigned") + +(media-dual-multiply mmulxhs HI ext argjlo argjhi OP_7B OPE1_28 "Media dual cross multiply signed") +(media-dual-multiply mmulxhu UHI zext argjlo argjhi OP_7B OPE1_29 "Media dual cross multiply unsigned") + +(define-pmacro (conditional-media-dual-multiply + name mode conv rhs1 rhs2 op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) + PRESERVE-OVF CONDITIONAL) + (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond") + (+ pack ACC40Sk op FRinti CCi cond ope FRintj) + (media-dual-multiply-semantics (eq CCi (or cond 2)) mode conv rhs1 rhs2) + ((fr400 (unit u-media-2)) + (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4))) + ) +) + +(conditional-media-dual-multiply cmmulhs HI ext argjhi argjlo OP_72 OPE4_0 "Conditional Media dual multiply signed") +(conditional-media-dual-multiply cmmulhu UHI zext argjhi argjlo OP_72 OPE4_1 "Conditional Media dual multiply unsigned") + +(define-pmacro (media-quad-multiply-semantics cond mode conv rhs1 rhs2) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk)) + (if (register-unaligned ACC40Sk 4) + (c-call VOID "@cpu@_media_acc_not_aligned") + (if (orif (register-unaligned FRintieven 2) + (register-unaligned FRintjeven 2)) + (c-call VOID "@cpu@_media_register_not_aligned") + (if cond + (sequence ((mode argihi) (mode argilo) + (mode argjhi) (mode argjlo)) + (extract-hilo FRintieven 0 FRintjeven 0 + argihi argilo argjhi argjlo) + (media-multiply-semantics conv argihi rhs1 ACC40Sk) + (media-multiply-semantics conv argilo rhs2 + (nextreg h-acc40S ACC40Sk 1)) + (extract-hilo FRintieven 1 FRintjeven 1 + argihi argilo argjhi argjlo) + (media-multiply-semantics conv argihi rhs1 + (nextreg h-acc40S ACC40Sk 2)) + (media-multiply-semantics conv argilo rhs2 + (nextreg h-acc40S ACC40Sk 3))))))) +) + +(define-pmacro (media-quad-multiply name mode conv rhs1 rhs2 op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2) PRESERVE-OVF) + (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk") + (+ pack ACC40Sk op FRintieven ope FRintjeven) + (media-quad-multiply-semantics 1 mode conv rhs1 rhs2) + ((fr400 (unit u-media-2-quad + (in FRinti FRintieven) + (in FRintj FRintjeven))) + (fr500 (unit u-media-quad-mul + (in FRinti FRintieven) + (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad))) + ) +) + +(media-quad-multiply mqmulhs HI ext argjhi argjlo OP_7B OPE1_1C "Media quad multiply signed") +(media-quad-multiply mqmulhu UHI zext argjhi argjlo OP_7B OPE1_1D "Media quad multiply unsigned") + +(media-quad-multiply mqmulxhs HI ext argjlo argjhi OP_7B OPE1_2A "Media quad cross multiply signed") +(media-quad-multiply mqmulxhu UHI zext argjlo argjhi OP_7B OPE1_2B "Media quad cross multiply unsigned") + +(define-pmacro (conditional-media-quad-multiply + name mode conv rhs1 rhs2 op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2) + PRESERVE-OVF CONDITIONAL) + (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk,$CCi,$cond") + (+ pack ACC40Sk op FRintieven CCi cond ope FRintjeven) + (media-quad-multiply-semantics (eq CCi (or cond 2)) mode conv rhs1 rhs2) + ((fr400 (unit u-media-2-quad + (in FRinti FRintieven) + (in FRintj FRintjeven))) + (fr500 (unit u-media-quad-mul + (in FRinti FRintieven) + (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad))) + ) +) + +(conditional-media-quad-multiply cmqmulhs HI ext argjhi argjlo OP_74 OPE4_0 "Conditional Media quad multiply signed") +(conditional-media-quad-multiply cmqmulhu UHI zext argjhi argjlo OP_74 OPE4_1 "Conditional Media quad multiply unsigned") + +(define-pmacro (media-multiply-acc-semantics + conv arg1 addop arg2 res max min sie) + (sequence ((DI tmp)) + (set tmp (addop res (mul DI (conv DI arg1) (conv DI arg2)))) + (saturate-v tmp max min sie res)) +) + +(define-pmacro (media-dual-multiply-acc-semantics + cond mode conv addop rhw res max min) + (if (c-call SI "@cpu@_check_acc_range" (index-of res)) + (if (register-unaligned res 2) + (c-call VOID "@cpu@_media_acc_not_aligned") + (if cond + (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo)) + (extract-hilo FRinti 0 FRintj 0 + argihi argilo argjhi argjlo) + (media-multiply-acc-semantics conv argihi addop argjhi + res + max min (msr-sie-acci)) + (media-multiply-acc-semantics conv argilo addop argjlo + (nextreg rhw res 1) + max min (msr-sie-acci-1)))))) +) + +(define-pmacro (media-dual-multiply-acc + name mode conv addop rhw res max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1)) + (.str name "$pack $FRinti,$FRintj,$" res) + (+ pack res op FRinti ope FRintj) + (media-dual-multiply-acc-semantics 1 mode conv addop rhw res max min) + ((fr400 (unit u-media-2)) + (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4))) + ) +) + +(media-dual-multiply-acc mmachs HI ext add h-acc40S ACC40Sk + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_7B OPE1_16 + "Media dual multiply and accumulate signed") + +(media-dual-multiply-acc mmachu UHI zext add h-acc40U ACC40Uk + (const DI #xffffffffff) (const DI 0) + OP_7B OPE1_17 + "Media dual multiply and accumulate unsigned") + +(media-dual-multiply-acc mmrdhs HI ext sub h-acc40S ACC40Sk + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_7B OPE1_30 + "Media dual multiply and reduce signed") + +(media-dual-multiply-acc mmrdhu UHI zext sub h-acc40U ACC40Uk + (const DI #xffffffffff) (const DI 0) + OP_7B OPE1_31 + "Media dual multiply and reduce unsigned") + +(define-pmacro (conditional-media-dual-multiply-acc + name mode conv addop rhw res max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) CONDITIONAL) + (.str name "$pack $FRinti,$FRintj,$" res ",$CCi,$cond") + (+ pack res op FRinti CCi cond ope FRintj) + (media-dual-multiply-acc-semantics (eq CCi (or cond 2)) + mode conv addop rhw res max min) + ((fr400 (unit u-media-2)) + (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4))) + ) +) + +(conditional-media-dual-multiply-acc cmmachs HI ext add h-acc40S ACC40Sk + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_72 OPE4_2 + "Conditional Media dual multiply and accumulate signed") + +(conditional-media-dual-multiply-acc cmmachu UHI zext add h-acc40U ACC40Uk + (const DI #xffffffffff) (const DI 0) + OP_72 OPE4_3 + "Conditional Media dual multiply and accumulate unsigned") + +(define-pmacro (media-quad-multiply-acc-semantics + cond mode conv addop rhw res max min) + (if (c-call SI "@cpu@_check_acc_range" (index-of res)) + (if (register-unaligned res 4) + (c-call VOID "@cpu@_media_acc_not_aligned") + (if (orif (register-unaligned FRintieven 2) + (register-unaligned FRintjeven 2)) + (c-call VOID "@cpu@_media_register_not_aligned") + (if cond + (sequence ((mode argihi) (mode argilo) + (mode argjhi) (mode argjlo)) + (extract-hilo FRintieven 0 FRintjeven 0 + argihi argilo argjhi argjlo) + (media-multiply-acc-semantics conv argihi addop argjhi + res + max min (msr-sie-acci)) + (media-multiply-acc-semantics conv argilo addop argjlo + (nextreg rhw res 1) + max min (msr-sie-acci-1)) + (extract-hilo FRintieven 1 FRintjeven 1 + argihi argilo argjhi argjlo) + (media-multiply-acc-semantics conv argihi addop argjhi + (nextreg rhw res 2) + max min (msr-sie-acci-2)) + (media-multiply-acc-semantics conv argilo addop argjlo + (nextreg rhw res 3) + max min + (msr-sie-acci-3))))))) +) + +(define-pmacro (media-quad-multiply-acc + name mode conv addop rhw res max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2)) + (.str name "$pack $FRintieven,$FRintjeven,$" res) + (+ pack res op FRintieven ope FRintjeven) + (media-quad-multiply-acc-semantics 1 mode conv addop rhw res max min) + ((fr400 (unit u-media-2-quad + (in FRinti FRintieven) + (in FRintj FRintjeven))) + (fr500 (unit u-media-quad-mul + (in FRinti FRintieven) + (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad))) + ) +) + +(media-quad-multiply-acc mqmachs HI ext add h-acc40S ACC40Sk + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_7B OPE1_1E + "Media quad multiply and accumulate signed") + +(media-quad-multiply-acc mqmachu UHI zext add h-acc40U ACC40Uk + (const DI #xffffffffff) (const DI 0) + OP_7B OPE1_1F + "Media quad multiply and accumulate unsigned") + +(define-pmacro (conditional-media-quad-multiply-acc + name mode conv addop rhw res max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2) CONDITIONAL) + (.str name "$pack $FRintieven,$FRintjeven,$" res ",$CCi,$cond") + (+ pack res op FRintieven CCi cond ope FRintjeven) + (media-quad-multiply-acc-semantics (eq CCi (or cond 2)) + mode conv addop rhw res max min) + ((fr400 (unit u-media-2-quad + (in FRinti FRintieven) + (in FRintj FRintjeven))) + (fr500 (unit u-media-quad-mul + (in FRinti FRintieven) + (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad))) + ) +) + +(conditional-media-quad-multiply-acc cmqmachs HI ext add h-acc40S ACC40Sk + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_74 OPE4_2 + "Conditional Media quad multiply and accumulate signed") + +(conditional-media-quad-multiply-acc cmqmachu UHI zext add h-acc40U ACC40Uk + (const DI #xffffffffff) (const DI 0) + OP_74 OPE4_3 + "Conditional media quad multiply and accumulate unsigned") + +(define-pmacro (media-quad-multiply-cross-acc-semantics + cond mode conv addop rhw res max min) + (if (c-call SI "@cpu@_check_acc_range" (index-of res)) + (if (register-unaligned res 4) + (c-call VOID "@cpu@_media_acc_not_aligned") + (if (orif (register-unaligned FRintieven 2) + (register-unaligned FRintjeven 2)) + (c-call VOID "@cpu@_media_register_not_aligned") + (if cond + (sequence ((mode argihi) (mode argilo) + (mode argjhi) (mode argjlo)) + (extract-hilo FRintieven 0 FRintjeven 0 + argihi argilo argjhi argjlo) + (media-multiply-acc-semantics conv argihi addop argjhi + (nextreg rhw res 2) + max min (msr-sie-acci-2)) + (media-multiply-acc-semantics conv argilo addop argjlo + (nextreg rhw res 3) + max min (msr-sie-acci-3)) + (extract-hilo FRintieven 1 FRintjeven 1 + argihi argilo argjhi argjlo) + (media-multiply-acc-semantics conv argihi addop argjhi + res + max min (msr-sie-acci)) + (media-multiply-acc-semantics conv argilo addop argjlo + (nextreg rhw res 1) + max min + (msr-sie-acci-1))))))) +) + +(define-pmacro (media-quad-multiply-cross-acc + name mode conv addop rhw res max min op ope comment) + (dni name + (comment) + ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2)) + (.str name "$pack $FRintieven,$FRintjeven,$" res) + (+ pack res op FRintieven ope FRintjeven) + (media-quad-multiply-cross-acc-semantics 1 mode conv addop rhw res + max min) + ((fr400 (unit u-media-2-quad + (in FRinti FRintieven) + (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad))) + ) +) + +(media-quad-multiply-cross-acc mqxmachs HI ext add h-acc40S ACC40Sk + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_78 OPE1_00 + "Media quad multiply and cross accumulate signed") + +(define-pmacro (media-quad-cross-multiply-cross-acc-semantics + cond mode conv addop rhw res max min) + (if (c-call SI "@cpu@_check_acc_range" (index-of res)) + (if (register-unaligned res 4) + (c-call VOID "@cpu@_media_acc_not_aligned") + (if (orif (register-unaligned FRintieven 2) + (register-unaligned FRintjeven 2)) + (c-call VOID "@cpu@_media_register_not_aligned") + (if cond + (sequence ((mode argihi) (mode argilo) + (mode argjhi) (mode argjlo)) + (extract-hilo FRintieven 0 FRintjeven 0 + argihi argilo argjhi argjlo) + (media-multiply-acc-semantics conv argihi addop argjlo + (nextreg rhw res 2) + max min (msr-sie-acci-2)) + (media-multiply-acc-semantics conv argilo addop argjhi + (nextreg rhw res 3) + max min (msr-sie-acci-3)) + (extract-hilo FRintieven 1 FRintjeven 1 + argihi argilo argjhi argjlo) + (media-multiply-acc-semantics conv argihi addop argjlo + res + max min (msr-sie-acci)) + (media-multiply-acc-semantics conv argilo addop argjhi + (nextreg rhw res 1) + max min + (msr-sie-acci-1))))))) +) + +(define-pmacro (media-quad-cross-multiply-cross-acc + name mode conv addop rhw res max min op ope comment) + (dni name + (comment) + ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2)) + (.str name "$pack $FRintieven,$FRintjeven,$" res) + (+ pack res op FRintieven ope FRintjeven) + (media-quad-cross-multiply-cross-acc-semantics 1 mode conv addop rhw res + max min) + ((fr400 (unit u-media-2-quad + (in FRinti FRintieven) + (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad))) + ) +) + +(media-quad-cross-multiply-cross-acc mqxmacxhs HI ext add h-acc40S ACC40Sk + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_78 OPE1_01 + "Media quad cross multiply and cross accumulate signed") + +(define-pmacro (media-quad-cross-multiply-acc-semantics + cond mode conv addop rhw res max min) + (if (c-call SI "@cpu@_check_acc_range" (index-of res)) + (if (register-unaligned res 4) + (c-call VOID "@cpu@_media_acc_not_aligned") + (if (orif (register-unaligned FRintieven 2) + (register-unaligned FRintjeven 2)) + (c-call VOID "@cpu@_media_register_not_aligned") + (if cond + (sequence ((mode argihi) (mode argilo) + (mode argjhi) (mode argjlo)) + (extract-hilo FRintieven 0 FRintjeven 0 + argihi argilo argjhi argjlo) + (media-multiply-acc-semantics conv argihi addop argjlo + res + max min (msr-sie-acci)) + (media-multiply-acc-semantics conv argilo addop argjhi + (nextreg rhw res 1) + max min (msr-sie-acci-1)) + (extract-hilo FRintieven 1 FRintjeven 1 + argihi argilo argjhi argjlo) + (media-multiply-acc-semantics conv argihi addop argjlo + (nextreg rhw res 2) + max min (msr-sie-acci-2)) + (media-multiply-acc-semantics conv argilo addop argjhi + (nextreg rhw res 3) + max min + (msr-sie-acci-3))))))) +) + +(define-pmacro (media-quad-cross-multiply-acc + name mode conv addop rhw res max min op ope comment) + (dni name + (comment) + ((UNIT MDUALACC) (MACH fr400,fr550) (FR550-MAJOR M-4) (FR400-MAJOR M-2)) + (.str name "$pack $FRintieven,$FRintjeven,$" res) + (+ pack res op FRintieven ope FRintjeven) + (media-quad-cross-multiply-acc-semantics 1 mode conv addop rhw res + max min) + ((fr400 (unit u-media-2-quad + (in FRinti FRintieven) + (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad))) + ) +) + +(media-quad-cross-multiply-acc mqmacxhs HI ext add h-acc40S ACC40Sk + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_78 OPE1_02 + "Media quad cross multiply and accumulate signed") + +(define-pmacro (media-complex-semantics + conv lhs1 rhs1 lhs2 rhs2 res max min sie) + (sequence ((DI tmp1) (DI tmp2)) + (media-multiply-semantics conv lhs1 rhs1 tmp1) + (media-multiply-semantics conv lhs2 rhs2 tmp2) + (set tmp1 (sub tmp1 tmp2)) + (saturate-v tmp1 max min sie res)) +) + +(define-pmacro (media-complex-semantics-i + conv lhs1 rhs1 lhs2 rhs2 res max min sie) + (sequence ((DI tmp1) (DI tmp2)) + (media-multiply-semantics conv lhs1 rhs1 tmp1) + (media-multiply-semantics conv lhs2 rhs2 tmp2) + (set tmp1 (add tmp1 tmp2)) + (saturate-v tmp1 max min sie res)) +) + +(define-pmacro (media-dual-complex-semantics mode conv rhs1 rhs2 max min) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk)) + (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo)) + (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo) + (media-complex-semantics conv argihi rhs1 argilo rhs2 ACC40Sk + max min (msr-sie-acci)))) +) + +(define-pmacro (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk)) + (sequence ((mode argihi) (mode argilo) (mode argjhi) (mode argjlo)) + (extract-hilo FRinti 0 FRintj 0 argihi argilo argjhi argjlo) + (media-complex-semantics-i conv argihi rhs1 argilo rhs2 ACC40Sk + max min (msr-sie-acci)))) +) + +(define-pmacro (media-dual-complex + name mode conv rhs1 rhs2 max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1)) + (.str name "$pack $FRinti,$FRintj,$ACC40Sk") + (+ pack ACC40Sk op FRinti ope FRintj) + (media-dual-complex-semantics mode conv rhs1 rhs2 max min) + ((fr400 (unit u-media-2)) + (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4))) + ) +) + +(define-pmacro (media-dual-complex-i + name mode conv rhs1 rhs2 max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1)) + (.str name "$pack $FRinti,$FRintj,$ACC40Sk") + (+ pack ACC40Sk op FRinti ope FRintj) + (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min) + ((fr400 (unit u-media-2)) + (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4))) + ) +) + +(media-dual-complex mcpxrs HI ext argjhi argjlo + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_7B OPE1_20 + "Media dual complex real signed with saturation") + +(media-dual-complex mcpxru UHI zext argjhi argjlo + (const DI #xffffffffff) (const DI 0) + OP_7B OPE1_21 + "Media dual complex real unsigned with saturation") + +(media-dual-complex-i mcpxis HI ext argjlo argjhi + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_7B OPE1_22 + "Media dual complex imaginary signed with saturation") + +(media-dual-complex-i mcpxiu UHI zext argjlo argjhi + (const DI #xffffffffff) (const DI 0) + OP_7B OPE1_23 + "Media dual complex imaginary unsigned with saturation") + +(define-pmacro (conditional-media-dual-complex + name mode conv rhs1 rhs2 max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) CONDITIONAL) + (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond") + (+ pack ACC40Sk op FRinti CCi cond ope FRintj) + (if (eq CCi (or cond 2)) + (media-dual-complex-semantics mode conv rhs1 rhs2 max min)) + ((fr400 (unit u-media-2)) + (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4))) + ) +) + +(define-pmacro (conditional-media-dual-complex-i + name mode conv rhs1 rhs2 max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-1) CONDITIONAL) + (.str name "$pack $FRinti,$FRintj,$ACC40Sk,$CCi,$cond") + (+ pack ACC40Sk op FRinti CCi cond ope FRintj) + (if (eq CCi (or cond 2)) + (media-dual-complex-semantics-i mode conv rhs1 rhs2 max min)) + ((fr400 (unit u-media-2)) + (fr500 (unit u-media-dual-mul)) (fr550 (unit u-media-4))) + ) +) + +(conditional-media-dual-complex cmcpxrs HI ext argjhi argjlo + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_75 OPE4_0 + "Conditional Media dual complex real signed with saturation") + +(conditional-media-dual-complex cmcpxru UHI zext argjhi argjlo + (const DI #xffffffffff) (const DI 0) + OP_75 OPE4_1 + "Conditional Media dual complex real unsigned with saturation") + +(conditional-media-dual-complex-i cmcpxis HI ext argjlo argjhi + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_75 OPE4_2 + "Conditional Media dual complex imaginary signed with saturation") + +(conditional-media-dual-complex-i cmcpxiu UHI zext argjlo argjhi + (const DI #xffffffffff) (const DI 0) + OP_75 OPE4_3 + "Conditional Media dual complex imaginary unsigned with saturation") + +(define-pmacro (media-quad-complex + name mode conv rhs1 rhs2 max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2)) + (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk") + (+ pack ACC40Sk op FRintieven ope FRintjeven) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk)) + (if (register-unaligned ACC40Sk 2) + (c-call VOID "@cpu@_media_acc_not_aligned") + (if (orif (register-unaligned FRintieven 2) + (register-unaligned FRintjeven 2)) + (c-call VOID "@cpu@_media_register_not_aligned") + (sequence ((mode argihi) (mode argilo) + (mode argjhi) (mode argjlo)) + (extract-hilo FRintieven 0 FRintjeven 0 + argihi argilo argjhi argjlo) + (media-complex-semantics conv argihi rhs1 argilo rhs2 + ACC40Sk + max min (msr-sie-acci)) + (extract-hilo FRintieven 1 FRintjeven 1 + argihi argilo argjhi argjlo) + (media-complex-semantics conv argihi rhs1 argilo rhs2 + (nextreg h-acc40S ACC40Sk 1) + max min (msr-sie-acci-1)))))) + ((fr400 (unit u-media-2-quad + (in FRinti FRintieven) + (in FRintj FRintjeven))) + (fr500 (unit u-media-quad-complex + (in FRinti FRintieven) + (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad))) + ) +) + +(define-pmacro (media-quad-complex-i + name mode conv rhs1 rhs2 max min op ope comment) + (dni name + (comment) + ((UNIT FMALL) (FR500-MAJOR M-4) (FR550-MAJOR M-4) (FR400-MAJOR M-2)) + (.str name "$pack $FRintieven,$FRintjeven,$ACC40Sk") + (+ pack ACC40Sk op FRintieven ope FRintjeven) + (if (c-call SI "@cpu@_check_acc_range" (index-of ACC40Sk)) + (if (register-unaligned ACC40Sk 2) + (c-call VOID "@cpu@_media_acc_not_aligned") + (if (orif (register-unaligned FRintieven 2) + (register-unaligned FRintjeven 2)) + (c-call VOID "@cpu@_media_register_not_aligned") + (sequence ((mode argihi) (mode argilo) + (mode argjhi) (mode argjlo)) + (extract-hilo FRintieven 0 FRintjeven 0 + argihi argilo argjhi argjlo) + (media-complex-semantics-i conv argihi rhs1 argilo rhs2 + ACC40Sk + max min (msr-sie-acci)) + (extract-hilo FRintieven 1 FRintjeven 1 + argihi argilo argjhi argjlo) + (media-complex-semantics-i conv argihi rhs1 argilo rhs2 + (nextreg h-acc40S ACC40Sk 1) + max min (msr-sie-acci-1)))))) + ((fr400 (unit u-media-2-quad + (in FRinti FRintieven) + (in FRintj FRintjeven))) + (fr500 (unit u-media-quad-complex + (in FRinti FRintieven) + (in FRintj FRintjeven))) (fr550 (unit u-media-4-quad))) + ) +) + +(media-quad-complex mqcpxrs HI ext argjhi argjlo + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_7B OPE1_24 + "Media quad complex real signed with saturation") + +(media-quad-complex mqcpxru UHI zext argjhi argjlo + (const DI #xffffffffff) (const DI 0) + OP_7B OPE1_25 + "Media quad complex real unsigned with saturation") + +(media-quad-complex-i mqcpxis HI ext argjlo argjhi + (const DI #x7fffffffff) (const DI #xffffff8000000000) + OP_7B OPE1_26 + "Media quad complex imaginary signed with saturation") + +(media-quad-complex-i mqcpxiu UHI zext argjlo argjhi + (const DI #xffffffffff) (const DI 0) + OP_7B OPE1_27 + "Media quad complex imaginary unsigned with saturation") + +(define-pmacro (media-pack src1 src2 targ offset) + (sequence () + (set (halfword hi targ offset) (halfword lo src1 offset)) + (set (halfword lo targ offset) (halfword lo src2 offset))) +) + +(define-pmacro (media-expand-halfword-to-word-semantics cond) + (if cond + (sequence ((UHI tmp)) + (if (and u6 1) + (set tmp (halfword lo FRinti 0)) + (set tmp (halfword hi FRinti 0))) + (set (halfword hi FRintk 0) tmp) + (set (halfword lo FRintk 0) tmp))) +) + +(dni mexpdhw + "Media expand halfword to word" + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1)) + "mexpdhw$pack $FRinti,$u6,$FRintk" + (+ pack FRintk OP_7B FRinti OPE1_32 u6) + (media-expand-halfword-to-word-semantics 1) + ((fr400 (unit u-media-3)) + (fr500 (unit u-media)) (fr550 (unit u-media))) +) + +(dni cmexpdhw + "Conditional media expand halfword to word" + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1) CONDITIONAL) + "cmexpdhw$pack $FRinti,$u6,$FRintk,$CCi,$cond" + (+ pack FRintk OP_76 FRinti CCi cond OPE4_2 u6) + (media-expand-halfword-to-word-semantics (eq CCi (or cond 2))) + ((fr400 (unit u-media-3)) + (fr500 (unit u-media)) (fr550 (unit u-media))) +) + +(define-pmacro (media-expand-halfword-to-double-semantics cond) + (if (register-unaligned FRintkeven 2) + (c-call VOID "@cpu@_media_register_not_aligned") + (if cond + (sequence ((UHI tmp)) + ; a hack to get FRintkeven referenced for profiling + (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven)) + (if (and u6 1) + (set tmp (halfword lo FRinti 0)) + (set tmp (halfword hi FRinti 0))) + (set (halfword hi FRintkeven 0) tmp) + (set (halfword lo FRintkeven 0) tmp) + (set (halfword hi FRintkeven 1) tmp) + (set (halfword lo FRintkeven 1) tmp)))) +) + +(dni mexpdhd + "Media expand halfword to double" + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2)) + "mexpdhd$pack $FRinti,$u6,$FRintkeven" + (+ pack FRintkeven OP_7B FRinti OPE1_33 u6) + (media-expand-halfword-to-double-semantics 1) + ((fr400 (unit u-media-dual-expand + (out FRintk FRintkeven))) + (fr500 (unit u-media-dual-expand + (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand))) +) + +(dni cmexpdhd + "Conditional media expand halfword to double" + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2) CONDITIONAL) + "cmexpdhd$pack $FRinti,$u6,$FRintkeven,$CCi,$cond" + (+ pack FRintkeven OP_76 FRinti CCi cond OPE4_3 u6) + (media-expand-halfword-to-double-semantics (eq CCi (or cond 2))) + ((fr400 (unit u-media-dual-expand + (out FRintk FRintkeven))) + (fr500 (unit u-media-dual-expand + (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand))) +) + +(dni mpackh + "Media halfword pack" + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1)) + "mpackh$pack $FRinti,$FRintj,$FRintk" + (+ pack FRintk OP_7B FRinti OPE1_34 FRintj) + (media-pack FRinti FRintj FRintk 0) + ((fr400 (unit u-media-3)) + (fr500 (unit u-media)) (fr550 (unit u-media))) +) + +(dni mdpackh + "Media dual pack" + ((UNIT FM01) (FR500-MAJOR M-5) (FR550-MAJOR M-3) (FR400-MAJOR M-2)) + "mdpackh$pack $FRintieven,$FRintjeven,$FRintkeven" + (+ pack FRintkeven OP_7B FRintieven OPE1_36 FRintjeven) + (if (orif (register-unaligned FRintieven 2) + (orif (register-unaligned FRintjeven 2) + (register-unaligned FRintkeven 2))) + (c-call VOID "@cpu@_media_register_not_aligned") + (sequence () + ; hack to get these referenced for profiling + (set FRintieven (c-raw-call SI "frv_ref_SI" FRintieven)) + (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven)) + (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven)) + (media-pack FRintieven FRintjeven FRintkeven 0) + (media-pack FRintieven FRintjeven FRintkeven 1))) + ((fr400 (unit u-media-3-quad + (in FRinti FRintieven) + (in FRintj FRintjeven) + (out FRintk FRintkeven))) + (fr500 (unit u-media-quad-arith + (in FRinti FRintieven) + (in FRintj FRintjeven) + (out FRintk FRintkeven))) (fr550 (unit u-media-quad))) +) + +(define-pmacro (media-unpack src soff targ toff) + (sequence () + (set (halfword hi targ toff) (halfword hi src soff)) + (set (halfword lo targ toff) (halfword hi src soff)) + (set (halfword hi targ (add toff 1)) (halfword lo src soff)) + (set (halfword lo targ (add toff 1)) (halfword lo src soff))) +) + +(dni munpackh + "Media halfword unpack" + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2)) + "munpackh$pack $FRinti,$FRintkeven" + (+ pack FRintkeven OP_7B FRinti OPE1_35 (FRj-null)) + (if (register-unaligned FRintkeven 2) + (c-call VOID "@cpu@_media_register_not_aligned") + (sequence () + ; hack to get these referenced for profiling + (set FRinti (c-raw-call SI "frv_ref_SI" FRinti)) + (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven)) + (media-unpack FRinti 0 FRintkeven 0))) + ((fr400 (unit u-media-dual-expand + (out FRintk FRintkeven))) + (fr500 (unit u-media-dual-expand + (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand))) +) + +(dni mdunpackh + "Media dual unpack" + ((UNIT FM01) (FR500-MAJOR M-7) (MACH simple,tomcat,frv)) + "mdunpackh$pack $FRintieven,$FRintk" + (+ pack FRintk OP_7B FRintieven OPE1_37 (FRj-null)) + (if (orif (register-unaligned FRintieven 2) (register-unaligned FRintk 4)) + (c-call VOID "@cpu@_media_register_not_aligned") + (sequence () + ; hack to get these referenced for profiling + (set FRintieven (c-raw-call SI "frv_ref_SI" FRintieven)) + (set FRintk (c-raw-call SI "frv_ref_SI" FRintk)) + (media-unpack FRintieven 0 FRintk 0) + (media-unpack FRintieven 1 FRintk 2))) + ((fr500 (unit u-media-dual-unpack + (in FRinti FRintieven)))) +) + +(define-pmacro (ubyte num arg offset) + (reg (.sym h-fr_ num) (add (index-of arg) offset))) + +(define-pmacro (mbtoh-semantics cond) + (if (register-unaligned FRintkeven 2) + (c-call VOID "@cpu@_media_register_not_aligned") + (if cond + (sequence () + (set (halfword hi FRintkeven 0) (ubyte 3 FRintj 0)) + (set (halfword lo FRintkeven 0) (ubyte 2 FRintj 0)) + (set (halfword hi FRintkeven 1) (ubyte 1 FRintj 0)) + (set (halfword lo FRintkeven 1) (ubyte 0 FRintj 0))))) +) + +(dni mbtoh + "Media convert byte to halfword" + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2)) + "mbtoh$pack $FRintj,$FRintkeven" + (+ pack FRintkeven OP_7B (FRi-null) OPE1_38 FRintj) + (sequence () + ; hack to get these referenced for profiling + (set FRintj (c-raw-call SI "frv_ref_SI" FRintj)) + (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven)) + (mbtoh-semantics 1)) + ((fr400 (unit u-media-dual-expand + (out FRintk FRintkeven))) + (fr500 (unit u-media-dual-btoh + (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand))) +) + +(dni cmbtoh + "Conditional media convert byte to halfword" + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2) CONDITIONAL) + "cmbtoh$pack $FRintj,$FRintkeven,$CCi,$cond" + (+ pack FRintkeven OP_77 (FRi-null) CCi cond OPE4_0 FRintj) + (sequence () + ; hack to get these referenced for profiling + (set FRintj (c-raw-call SI "frv_ref_SI" FRintj)) + (set FRintkeven (c-raw-call SI "frv_ref_SI" FRintkeven)) + (mbtoh-semantics (eq CCi (or cond 2)))) + ((fr400 (unit u-media-dual-expand + (out FRintk FRintkeven))) + (fr500 (unit u-media-dual-btoh + (out FRintk FRintkeven))) (fr550 (unit u-media-dual-expand (in FRinti FRintj)))) +) + +(define-pmacro (mhtob-semantics cond) + (if (register-unaligned FRintjeven 2) + (c-call VOID "@cpu@_media_register_not_aligned") + (if cond + (sequence () + (set (ubyte 3 FRintk 0) (halfword hi FRintjeven 0)) + (set (ubyte 2 FRintk 0) (halfword lo FRintjeven 0)) + (set (ubyte 1 FRintk 0) (halfword hi FRintjeven 1)) + (set (ubyte 0 FRintk 0) (halfword lo FRintjeven 1))))) +) + +(dni mhtob + "Media convert halfword to byte" + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2)) + "mhtob$pack $FRintjeven,$FRintk" + (+ pack FRintk OP_7B (FRi-null) OPE1_39 FRintjeven) + (sequence () + ; hack to get these referenced for profiling + (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven)) + (set FRintk (c-raw-call SI "frv_ref_SI" FRintk)) + (mhtob-semantics 1)) + ((fr400 (unit u-media-dual-htob + (in FRintj FRintjeven))) + (fr500 (unit u-media-dual-htob + (in FRintj FRintjeven))) (fr550 (unit u-media-3-dual (in FRinti FRintjeven)))) +) + +(dni cmhtob + "Conditional media convert halfword to byte" + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-2) CONDITIONAL) + "cmhtob$pack $FRintjeven,$FRintk,$CCi,$cond" + (+ pack FRintk OP_77 (FRi-null) CCi cond OPE4_1 FRintjeven) + (sequence () + ; hack to get these referenced for profiling + (set FRintjeven (c-raw-call SI "frv_ref_SI" FRintjeven)) + (set FRintk (c-raw-call SI "frv_ref_SI" FRintk)) + (mhtob-semantics (eq CCi (or cond 2)))) + ((fr400 (unit u-media-dual-htob + (in FRintj FRintjeven))) + (fr500 (unit u-media-dual-htob + (in FRintj FRintjeven))) (fr550 (unit u-media-3-dual (in FRinti FRintjeven)))) +) + +(define-pmacro (mbtohe-semantics cond) + (if (register-unaligned FRintk 4) + (c-call VOID "@cpu@_media_register_not_aligned") + (if cond + (sequence () + (set (halfword hi FRintk 0) (ubyte 3 FRintj 0)) + (set (halfword lo FRintk 0) (ubyte 3 FRintj 0)) + (set (halfword hi FRintk 1) (ubyte 2 FRintj 0)) + (set (halfword lo FRintk 1) (ubyte 2 FRintj 0)) + (set (halfword hi FRintk 2) (ubyte 1 FRintj 0)) + (set (halfword lo FRintk 2) (ubyte 1 FRintj 0)) + (set (halfword hi FRintk 3) (ubyte 0 FRintj 0)) + (set (halfword lo FRintk 3) (ubyte 0 FRintj 0))))) +) + +(dni mbtohe + "Media convert byte to halfword extended" + ((UNIT FM01) (FR500-MAJOR M-7) (MACH simple,tomcat,frv)) + "mbtohe$pack $FRintj,$FRintk" + (+ pack FRintk OP_7B (FRi-null) OPE1_3A FRintj) + (sequence () + ; hack to get these referenced for profiling + (set FRintj (c-raw-call SI "frv_ref_SI" FRintj)) + (set FRintk (c-raw-call SI "frv_ref_SI" FRintk)) + (mbtohe-semantics 1)) + ((fr500 (unit u-media-dual-btohe))) +) + +(dni cmbtohe + "Conditional media convert byte to halfword extended" + ((UNIT FM01) (FR500-MAJOR M-7) CONDITIONAL (MACH simple,tomcat,frv)) + "cmbtohe$pack $FRintj,$FRintk,$CCi,$cond" + (+ pack FRintk OP_77 (FRi-null) CCi cond OPE4_2 FRintj) + (sequence () + ; hack to get these referenced for profiling + (set FRintj (c-raw-call SI "frv_ref_SI" FRintj)) + (set FRintk (c-raw-call SI "frv_ref_SI" FRintk)) + (mbtohe-semantics (eq CCi (or cond 2)))) + ((fr500 (unit u-media-dual-btohe))) +) + +; Media NOP +; A special case of mclracc +(dni mnop "Media nop" + ((UNIT FMALL) (FR500-MAJOR M-1) (FR550-MAJOR M-1) (FR400-MAJOR M-1)) + "mnop$pack" + (+ pack (f-ACC40Sk 63) OP_7B (f-A 1) (misc-null-10) OPE1_3B (FRj-null)) + (nop) + () +) + +; mclracc with #A==0 +(dni mclracc-0 + "Media clear accumulator(s)" + ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3) (FR400-MAJOR M-1)) + "mclracc$pack $ACC40Sk,$A0" + (+ pack ACC40Sk OP_7B (f-A 0) (misc-null-10) OPE1_3B (FRj-null)) + (c-call VOID "@cpu@_clear_accumulators" (index-of ACC40Sk) 0) + ((fr400 (unit u-media-4)) + (fr500 (unit u-media)) (fr550 (unit u-media-3-mclracc))) +) + +; mclracc with #A==1 +(dni mclracc-1 + "Media clear accumulator(s)" + ((UNIT MCLRACC-1) (FR500-MAJOR M-6) (FR550-MAJOR M-3) (FR400-MAJOR M-2)) + "mclracc$pack $ACC40Sk,$A1" + (+ pack ACC40Sk OP_7B (f-A 1) (misc-null-10) OPE1_3B (FRj-null)) + (c-call VOID "@cpu@_clear_accumulators" (index-of ACC40Sk) 1) + ((fr400 (unit u-media-4)) + (fr500 (unit u-media)) (fr550 (unit u-media-3-mclracc))) +) + +(dni mrdacc + "Media read accumulator" + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1)) + "mrdacc$pack $ACC40Si,$FRintk" + (+ pack FRintk OP_7B ACC40Si OPE1_3C (FRj-null)) + (set FRintk ACC40Si) + ((fr400 (unit u-media-4)) + (fr500 (unit u-media)) (fr550 (unit u-media-3-acc))) +) + +(dni mrdaccg + "Media read accumulator guard" + ((UNIT FM01) (FR500-MAJOR M-2) (FR550-MAJOR M-3) (FR400-MAJOR M-1)) + "mrdaccg$pack $ACCGi,$FRintk" + (+ pack FRintk OP_7B ACCGi OPE1_3E (FRj-null)) + (set FRintk ACCGi) + ((fr400 (unit u-media-4-accg)) + (fr500 (unit u-media)) (fr550 (unit u-media-3-acc (in ACC40Si ACCGi)))) +) + +(dni mwtacc + "Media write accumulator" + ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3) (FR400-MAJOR M-1)) + "mwtacc$pack $FRinti,$ACC40Sk" + (+ pack ACC40Sk OP_7B FRinti OPE1_3D (FRj-null)) + (set ACC40Sk (or (and ACC40Sk (const DI #xffffffff00000000)) + FRinti)) + ((fr400 (unit u-media-4)) + (fr500 (unit u-media)) (fr550 (unit u-media-3-wtacc))) +) + +(dni mwtaccg + "Media write accumulator guard" + ((UNIT FM01) (FR500-MAJOR M-3) (FR550-MAJOR M-3) (FR400-MAJOR M-1)) + "mwtaccg$pack $FRinti,$ACCGk" + (+ pack ACCGk OP_7B FRinti OPE1_3F (FRj-null)) + (sequence () + ; hack to get these referenced for profiling + (c-raw-call VOID "frv_ref_SI" ACCGk) + (set ACCGk FRinti)) + ((fr400 (unit u-media-4-accg)) + (fr500 (unit u-media)) (fr550 (unit u-media-3-wtacc (in ACC40Sk ACCGk)))) +) + +(define-pmacro (media-cop num op) + (dni (.sym mcop num) + "Media custom instruction" + ((UNIT FM01) (FR500-MAJOR M-1) (MACH frv)) + (.str "mcop" num "$pack $FRi,$FRj,$FRk") + (+ pack FRk op FRi OPE1_00 FRj) + (c-call VOID "@cpu@_media_cop" num) + () + ) +) + +(media-cop 1 OP_7C) +(media-cop 2 OP_7D) + +; nop +; A nop is defined to be a "ori gr0,0,gr0" +; This needn't be a macro-insn, but making it one greatly simplifies decode.c +; On the other hand spending a little time in the decoder is often worth it. +; +(dnmi nop "nop" + ((UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1)) + "nop$pack" + (emit ori pack (GRi 0) (s12 0) (GRk 0)) +) + +; Floating point NOP +(dni fnop + "Floating point nop" + ((UNIT FMALL) (FR500-MAJOR F-8) (FR550-MAJOR F-1) (MACH simple,tomcat,fr500,fr550,frv)) + "fnop$pack" + (+ pack (rd-null) OP_79 (FRi-null) OPE1_0D (FRj-null)) + (nop) + () +) + +; A return instruction +(dnmi ret "return" + (NO-DIS (UNIT B01) (FR500-MAJOR B-3) (FR400-MAJOR B-3)) + "ret$pack" + (emit bralr pack (hint_taken 2)) +) + +(dnmi cmp "compare" + (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1)) + "cmp$pack $GRi,$GRj,$ICCi_1" + (emit subcc pack GRi GRj (GRk 0) ICCi_1) +) + +(dnmi cmpi "compare immediate" + (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1)) + "cmpi$pack $GRi,$s10,$ICCi_1" + (emit subicc pack GRi s10 (GRk 0) ICCi_1) +) + +(dnmi ccmp "conditional compare" + (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL) + "ccmp$pack $GRi,$GRj,$CCi,$cond" + (emit csubcc pack GRi GRj (GRk 0) CCi cond) +) + +(dnmi mov "move" + (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1)) + "mov$pack $GRi,$GRk" + (emit ori pack GRi (s12 0) GRk) +) + +(dnmi cmov "conditional move" + (NO-DIS (UNIT IALL) (FR500-MAJOR I-1) (FR400-MAJOR I-1) CONDITIONAL) + "cmov$pack $GRi,$GRk,$CCi,$cond" + (emit cor pack GRi (GRj 0) GRk CCi cond) +) diff --git a/cpu/frv.opc b/cpu/frv.opc new file mode 100644 index 0000000000000..03c0f3e1437e1 --- /dev/null +++ b/cpu/frv.opc @@ -0,0 +1,1544 @@ +/* Fujitsu FRV opcode support, for GNU Binutils. -*- C -*- + + Copyright 2000, 2001, 2003, 2004 Free Software Foundation, Inc. + + Contributed by Red Hat Inc; developed under contract from Fujitsu. + + This file is part of the GNU Binutils. + + This program is free software; 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. + +*/ + +/* This file is an addendum to frv.cpu. Heavy use of C code isn't + appropriate in .cpu files, so it resides here. This especially applies + to assembly/disassembly where parsing/printing can be quite involved. + Such things aren't really part of the specification of the cpu, per se, + so .cpu files provide the general framework and .opc files handle the + nitty-gritty details as necessary. + + Each section is delimited with start and end markers. + + -opc.h additions use: "-- opc.h" + -opc.c additions use: "-- opc.c" + -asm.c additions use: "-- asm.c" + -dis.c additions use: "-- dis.c" + -ibd.h additions use: "-- ibd.h" +*/ + +/* -- opc.h */ + +#undef CGEN_DIS_HASH_SIZE +#define CGEN_DIS_HASH_SIZE 128 +#undef CGEN_DIS_HASH +#define CGEN_DIS_HASH(buffer, value) (((value) >> 18) & 127) + +/* Allows reason codes to be output when assembler errors occur. */ +#define CGEN_VERBOSE_ASSEMBLER_ERRORS + +/* Vliw support. */ +#define FRV_VLIW_SIZE 8 /* fr550 has largest vliw size of 8. */ +#define PAD_VLIW_COMBO ,UNIT_NIL,UNIT_NIL,UNIT_NIL,UNIT_NIL +typedef CGEN_ATTR_VALUE_TYPE VLIW_COMBO[FRV_VLIW_SIZE]; + +typedef struct +{ + int next_slot; + int constraint_violation; + unsigned long mach; + unsigned long elf_flags; + CGEN_ATTR_VALUE_TYPE *unit_mapping; + VLIW_COMBO *current_vliw; + CGEN_ATTR_VALUE_TYPE major[FRV_VLIW_SIZE]; + const CGEN_INSN* insn[FRV_VLIW_SIZE]; +} FRV_VLIW; + +int frv_is_branch_major PARAMS ((CGEN_ATTR_VALUE_TYPE, unsigned long)); +int frv_is_float_major PARAMS ((CGEN_ATTR_VALUE_TYPE, unsigned long)); +int frv_is_media_major PARAMS ((CGEN_ATTR_VALUE_TYPE, unsigned long)); +int frv_is_branch_insn PARAMS ((const CGEN_INSN *)); +int frv_is_float_insn PARAMS ((const CGEN_INSN *)); +int frv_is_media_insn PARAMS ((const CGEN_INSN *)); +void frv_vliw_reset PARAMS ((FRV_VLIW *, unsigned long mach, unsigned long elf_flags)); +int frv_vliw_add_insn PARAMS ((FRV_VLIW *, const CGEN_INSN *)); +int spr_valid PARAMS ((long)); +/* -- */ + +/* -- opc.c */ +#include "elf/frv.h" +#include + +static int match_unit + PARAMS ((FRV_VLIW *, CGEN_ATTR_VALUE_TYPE, CGEN_ATTR_VALUE_TYPE)); +static int match_vliw + PARAMS ((VLIW_COMBO *, VLIW_COMBO *, int)); +static VLIW_COMBO * add_next_to_vliw + PARAMS ((FRV_VLIW *, CGEN_ATTR_VALUE_TYPE)); +static int find_major_in_vliw + PARAMS ((FRV_VLIW *, CGEN_ATTR_VALUE_TYPE)); +static int fr400_check_insn_major_constraints + PARAMS ((FRV_VLIW *, CGEN_ATTR_VALUE_TYPE)); +static int fr500_check_insn_major_constraints + PARAMS ((FRV_VLIW *, CGEN_ATTR_VALUE_TYPE)); +static int fr550_check_insn_major_constraints + PARAMS ((FRV_VLIW *, CGEN_ATTR_VALUE_TYPE, const CGEN_INSN *)); +static int check_insn_major_constraints + PARAMS ((FRV_VLIW *, CGEN_ATTR_VALUE_TYPE, const CGEN_INSN *)); + +int +frv_is_branch_major (CGEN_ATTR_VALUE_TYPE major, unsigned long mach) +{ + switch (mach) + { + case bfd_mach_fr400: + if (major >= FR400_MAJOR_B_1 && major <= FR400_MAJOR_B_6) + return 1; /* is a branch */ + break; + default: + if (major >= FR500_MAJOR_B_1 && major <= FR500_MAJOR_B_6) + return 1; /* is a branch */ + break; + } + + return 0; /* not a branch */ +} + +int +frv_is_float_major (CGEN_ATTR_VALUE_TYPE major, unsigned long mach) +{ + switch (mach) + { + case bfd_mach_fr400: + return 0; /* No float insns */ + default: + if (major >= FR500_MAJOR_F_1 && major <= FR500_MAJOR_F_8) + return 1; /* is a float insn */ + break; + } + + return 0; /* not a branch */ +} + +int +frv_is_media_major (CGEN_ATTR_VALUE_TYPE major, unsigned long mach) +{ + switch (mach) + { + case bfd_mach_fr400: + if (major >= FR400_MAJOR_M_1 && major <= FR400_MAJOR_M_2) + return 1; /* is a media insn */ + break; + default: + if (major >= FR500_MAJOR_M_1 && major <= FR500_MAJOR_M_8) + return 1; /* is a media insn */ + break; + } + + return 0; /* not a branch */ +} + +int +frv_is_branch_insn (const CGEN_INSN *insn) +{ + if (frv_is_branch_major (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_FR400_MAJOR), + bfd_mach_fr400)) + return 1; + if (frv_is_branch_major (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_FR500_MAJOR), + bfd_mach_fr500)) + return 1; + + return 0; +} + +int +frv_is_float_insn (const CGEN_INSN *insn) +{ + if (frv_is_float_major (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_FR400_MAJOR), + bfd_mach_fr400)) + return 1; + if (frv_is_float_major (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_FR500_MAJOR), + bfd_mach_fr500)) + return 1; + + return 0; +} + +int +frv_is_media_insn (const CGEN_INSN *insn) +{ + if (frv_is_media_major (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_FR400_MAJOR), + bfd_mach_fr400)) + return 1; + if (frv_is_media_major (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_FR500_MAJOR), + bfd_mach_fr500)) + return 1; + + return 0; +} + +/* This table represents the allowable packing for vliw insns for the fr400. + The fr400 has only 2 vliw slots. Represent this by not allowing any insns + in the extra slots. + Subsets of any given row are also allowed. */ +static VLIW_COMBO fr400_allowed_vliw[] = +{ + /* slot0 slot1 slot2 slot3 */ + { UNIT_I0, UNIT_I1, UNIT_NIL, UNIT_NIL PAD_VLIW_COMBO }, + { UNIT_I0, UNIT_FM0, UNIT_NIL, UNIT_NIL PAD_VLIW_COMBO }, + { UNIT_I0, UNIT_B0, UNIT_NIL, UNIT_NIL PAD_VLIW_COMBO }, + { UNIT_FM0, UNIT_FM1, UNIT_NIL, UNIT_NIL PAD_VLIW_COMBO }, + { UNIT_FM0, UNIT_B0, UNIT_NIL, UNIT_NIL PAD_VLIW_COMBO }, + { UNIT_B0, UNIT_NIL, UNIT_NIL, UNIT_NIL PAD_VLIW_COMBO }, + { UNIT_C, UNIT_NIL, UNIT_NIL, UNIT_NIL PAD_VLIW_COMBO }, + { UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL PAD_VLIW_COMBO } +}; + +/* This table represents the allowable packing for vliw insns for the fr500. + The fr500 has only 4 vliw slots. Represent this by not allowing any insns + in the extra slots. + Subsets of any given row are also allowed. */ +static VLIW_COMBO fr500_allowed_vliw[] = +{ + /* slot0 slot1 slot2 slot3 */ + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_FM1 PAD_VLIW_COMBO }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_B0 PAD_VLIW_COMBO }, + { UNIT_I0, UNIT_FM0, UNIT_FM1, UNIT_B0 PAD_VLIW_COMBO }, + { UNIT_I0, UNIT_FM0, UNIT_B0, UNIT_B1 PAD_VLIW_COMBO }, + { UNIT_I0, UNIT_I1, UNIT_B0, UNIT_B1 PAD_VLIW_COMBO }, + { UNIT_I0, UNIT_B0, UNIT_B1, UNIT_NIL PAD_VLIW_COMBO }, + { UNIT_FM0, UNIT_FM1, UNIT_B0, UNIT_B1 PAD_VLIW_COMBO }, + { UNIT_FM0, UNIT_B0, UNIT_B1, UNIT_NIL PAD_VLIW_COMBO }, + { UNIT_B0, UNIT_B1, UNIT_NIL, UNIT_NIL PAD_VLIW_COMBO }, + { UNIT_C, UNIT_NIL, UNIT_NIL, UNIT_NIL PAD_VLIW_COMBO }, + { UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL PAD_VLIW_COMBO } +}; + +/* This table represents the allowable packing for vliw insns for the fr550. + Subsets of any given row are also allowed. */ +static VLIW_COMBO fr550_allowed_vliw[] = +{ + /* slot0 slot1 slot2 slot3 slot4 slot5 slot6 slot7 */ + { UNIT_I0, UNIT_I1, UNIT_I2, UNIT_I3, UNIT_B0, UNIT_B1 , UNIT_NIL, UNIT_NIL }, + { UNIT_I0, UNIT_I1, UNIT_I2, UNIT_B0, UNIT_B1 , UNIT_NIL, UNIT_NIL, UNIT_NIL }, + { UNIT_I0, UNIT_I1, UNIT_B0, UNIT_B1 , UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL }, + { UNIT_I0, UNIT_B0, UNIT_B1 , UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_FM1, UNIT_I2, UNIT_FM2, UNIT_I3, UNIT_FM3 }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_FM1, UNIT_I2, UNIT_FM2, UNIT_I3, UNIT_B0 }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_FM1, UNIT_I2, UNIT_FM2, UNIT_FM3, UNIT_B0 }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_FM1, UNIT_I2, UNIT_FM2, UNIT_B0, UNIT_B1 }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_FM1, UNIT_I2, UNIT_I3, UNIT_B0, UNIT_B1 }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_FM1, UNIT_I2, UNIT_B0, UNIT_B1, UNIT_NIL }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_FM1, UNIT_FM2, UNIT_FM3, UNIT_B0, UNIT_B1 }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_FM1, UNIT_FM2, UNIT_FM3, UNIT_B0, UNIT_B1 }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_FM1, UNIT_FM2, UNIT_B0, UNIT_B1, UNIT_NIL }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_FM1, UNIT_B0, UNIT_B1, UNIT_NIL, UNIT_NIL }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_I2, UNIT_I3, UNIT_B0, UNIT_B1, UNIT_NIL }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_I2, UNIT_B0, UNIT_B1, UNIT_NIL, UNIT_NIL }, + { UNIT_I0, UNIT_FM0, UNIT_I1, UNIT_B0, UNIT_B1, UNIT_NIL, UNIT_NIL, UNIT_NIL }, + { UNIT_I0, UNIT_FM0, UNIT_FM1, UNIT_FM2, UNIT_FM3, UNIT_B0, UNIT_B1, UNIT_NIL }, + { UNIT_I0, UNIT_FM0, UNIT_FM1, UNIT_FM2, UNIT_B0, UNIT_B1, UNIT_NIL, UNIT_NIL }, + { UNIT_I0, UNIT_FM0, UNIT_FM1, UNIT_B0, UNIT_B1, UNIT_NIL, UNIT_NIL, UNIT_NIL }, + { UNIT_I0, UNIT_FM0, UNIT_B0, UNIT_B1, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL }, + { UNIT_B0, UNIT_B1, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL }, + { UNIT_C, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL }, + { UNIT_FM0, UNIT_FM1, UNIT_FM2, UNIT_FM3, UNIT_B0, UNIT_B1, UNIT_NIL, UNIT_NIL }, + { UNIT_FM0, UNIT_FM1, UNIT_FM2, UNIT_B0, UNIT_B1, UNIT_NIL, UNIT_NIL, UNIT_NIL }, + { UNIT_FM0, UNIT_FM1, UNIT_B0, UNIT_B1, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL }, + { UNIT_FM0, UNIT_B0, UNIT_B1, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL }, + { UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL, UNIT_NIL } +}; + +/* Some insns are assigned specialized implementation units which map to + different actual implementation units on different machines. These + tables perform that mapping. */ +static CGEN_ATTR_VALUE_TYPE fr400_unit_mapping[] = +{ +/* unit in insn actual unit */ +/* NIL */ UNIT_NIL, +/* I0 */ UNIT_I0, +/* I1 */ UNIT_I1, +/* I01 */ UNIT_I01, +/* I2 */ UNIT_NIL, /* no I2 or I3 unit */ +/* I3 */ UNIT_NIL, +/* IALL */ UNIT_I01, /* only I0 and I1 units */ +/* FM0 */ UNIT_FM0, +/* FM1 */ UNIT_FM1, +/* FM01 */ UNIT_FM01, +/* FM2 */ UNIT_NIL, /* no F2 or M2 units */ +/* FM3 */ UNIT_NIL, /* no F3 or M3 units */ +/* FMALL */ UNIT_FM01,/* Only F0,F1,M0,M1 units */ +/* FMLOW */ UNIT_FM0, /* Only F0,M0 units */ +/* B0 */ UNIT_B0, /* branches only in B0 unit. */ +/* B1 */ UNIT_B0, +/* B01 */ UNIT_B0, +/* C */ UNIT_C, +/* MULT-DIV */ UNIT_I0, /* multiply and divide only in I0 unit. */ +/* IACC */ UNIT_I01, /* iacc multiply in I0 or I1 unit. */ +/* LOAD */ UNIT_I0, /* load only in I0 unit. */ +/* STORE */ UNIT_I0, /* store only in I0 unit. */ +/* SCAN */ UNIT_I0, /* scan only in I0 unit. */ +/* DCPL */ UNIT_C, /* dcpl only in C unit. */ +/* MDUALACC */ UNIT_FM0, /* media dual acc insn only in FM0 unit. */ +/* MCLRACC-1*/ UNIT_FM0 /* mclracc,A==1 insn only in FM0 unit. */ +}; + +static CGEN_ATTR_VALUE_TYPE fr500_unit_mapping[] = +{ +/* unit in insn actual unit */ +/* NIL */ UNIT_NIL, +/* I0 */ UNIT_I0, +/* I1 */ UNIT_I1, +/* I01 */ UNIT_I01, +/* I2 */ UNIT_NIL, /* no I2 or I3 unit */ +/* I3 */ UNIT_NIL, +/* IALL */ UNIT_I01, /* only I0 and I1 units */ +/* FM0 */ UNIT_FM0, +/* FM1 */ UNIT_FM1, +/* FM01 */ UNIT_FM01, +/* FM2 */ UNIT_NIL, /* no F2 or M2 units */ +/* FM3 */ UNIT_NIL, /* no F3 or M2 units */ +/* FMALL */ UNIT_FM01,/* Only F0,F1,M0,M1 units */ +/* FMLOW */ UNIT_FM0, /* Only F0,M0 units */ +/* B0 */ UNIT_B0, +/* B1 */ UNIT_B1, +/* B01 */ UNIT_B01, +/* C */ UNIT_C, +/* MULT-DIV */ UNIT_I01, /* multiply and divide in I0 or I1 unit. */ +/* IACC */ UNIT_NIL, /* iacc multiply not implemented */ +/* LOAD */ UNIT_I01, /* load in I0 or I1 unit. */ +/* STORE */ UNIT_I0, /* store only in I0 unit. */ +/* SCAN */ UNIT_I01, /* scan in I0 or I1 unit. */ +/* DCPL */ UNIT_C, /* dcpl only in C unit. */ +/* MDUALACC */ UNIT_FM0, /* media dual acc insn only in FM0 unit. */ +/* MCLRACC-1*/ UNIT_FM01 /* mclracc,A==1 in FM0 or FM1 unit. */ +}; + +static CGEN_ATTR_VALUE_TYPE fr550_unit_mapping[] = +{ +/* unit in insn actual unit */ +/* NIL */ UNIT_NIL, +/* I0 */ UNIT_I0, +/* I1 */ UNIT_I1, +/* I01 */ UNIT_I01, +/* I2 */ UNIT_I2, +/* I3 */ UNIT_I3, +/* IALL */ UNIT_IALL, +/* FM0 */ UNIT_FM0, +/* FM1 */ UNIT_FM1, +/* FM01 */ UNIT_FM01, +/* FM2 */ UNIT_FM2, +/* FM3 */ UNIT_FM3, +/* FMALL */ UNIT_FMALL, +/* FMLOW */ UNIT_FM01, /* Only F0,F1,M0,M1 units */ +/* B0 */ UNIT_B0, +/* B1 */ UNIT_B1, +/* B01 */ UNIT_B01, +/* C */ UNIT_C, +/* MULT-DIV */ UNIT_I01, /* multiply and divide in I0 or I1 unit. */ +/* IACC */ UNIT_NIL, /* iacc multiply not implemented. */ +/* LOAD */ UNIT_I01, /* load in I0 or I1 unit. */ +/* STORE */ UNIT_I01, /* store in I0 or I1 unit. */ +/* SCAN */ UNIT_IALL, /* scan in any integer unit. */ +/* DCPL */ UNIT_I0, /* dcpl only in I0 unit. */ +/* MDUALACC */ UNIT_FMALL,/* media dual acc insn in all media units */ +/* MCLRACC-1*/ UNIT_FM01 /* mclracc,A==1 in FM0 or FM1 unit. */ +}; + +void +frv_vliw_reset (FRV_VLIW *vliw, unsigned long mach, unsigned long elf_flags) +{ + vliw->next_slot = 0; + vliw->constraint_violation = 0; + vliw->mach = mach; + vliw->elf_flags = elf_flags; + + switch (mach) + { + case bfd_mach_fr400: + vliw->current_vliw = fr400_allowed_vliw; + vliw->unit_mapping = fr400_unit_mapping; + break; + case bfd_mach_fr550: + vliw->current_vliw = fr550_allowed_vliw; + vliw->unit_mapping = fr550_unit_mapping; + break; + default: + vliw->current_vliw = fr500_allowed_vliw; + vliw->unit_mapping = fr500_unit_mapping; + break; + } +} + +/* Return 1 if unit1 is a match for unit2. + Unit1 comes from the insn's UNIT attribute. unit2 comes from one of the + *_allowed_vliw tables above. */ +static int +match_unit (FRV_VLIW *vliw, + CGEN_ATTR_VALUE_TYPE unit1, CGEN_ATTR_VALUE_TYPE unit2) +{ + /* Map any specialized implementation units to actual ones. */ + unit1 = vliw->unit_mapping[unit1]; + + if (unit1 == unit2) + return 1; + if (unit1 < unit2) + return 0; + + switch (unit1) + { + case UNIT_I01: + case UNIT_FM01: + case UNIT_B01: + /* The 01 versions of these units are within 2 enums of the 0 or 1 + versions. */ + if (unit1 - unit2 <= 2) + return 1; + break; + case UNIT_IALL: + case UNIT_FMALL: + /* The ALL versions of these units are within 5 enums of the 0, 1, 2 or 3 + versions. */ + if (unit1 - unit2 <= 5) + return 1; + break; + default: + break; + } + + return 0; +} + +/* Return 1 if the vliws match, 0 otherwise. */ + +static int +match_vliw (VLIW_COMBO *vliw1, VLIW_COMBO *vliw2, int vliw_size) +{ + int i; + + for (i = 0; i < vliw_size; ++i) + { + if ((*vliw1)[i] != (*vliw2)[i]) + return 0; + } + + return 1; +} + +/* Find the next vliw vliw in the table that can accomodate the new insn. + If one is found then return it. Otherwise return NULL. */ + +static VLIW_COMBO * +add_next_to_vliw (FRV_VLIW *vliw, CGEN_ATTR_VALUE_TYPE unit) +{ + int next = vliw->next_slot; + VLIW_COMBO *current = vliw->current_vliw; + VLIW_COMBO *potential; + + if (next <= 0) + { + fprintf (stderr, "frv-opc.c line %d: bad vliw->next_slot value.\n", + __LINE__); + abort (); /* Should never happen */ + } + + /* The table is sorted by units allowed within slots, so vliws with + identical starting sequences are together. */ + potential = current; + do + { + if (match_unit (vliw, unit, (*potential)[next])) + return potential; + ++potential; + } + while (match_vliw (potential, current, next)); + + return NULL; +} + +/* Look for the given major insn type in the given vliw. Return 1 if found, + return 0 otherwise. */ + +static int +find_major_in_vliw (FRV_VLIW *vliw, CGEN_ATTR_VALUE_TYPE major) +{ + int i; + + for (i = 0; i < vliw->next_slot; ++i) + if (vliw->major[i] == major) + return 1; + + return 0; +} + +/* Check for constraints between the insns in the vliw due to major insn + types. */ + +static int +fr400_check_insn_major_constraints ( + FRV_VLIW *vliw, CGEN_ATTR_VALUE_TYPE major +) +{ + /* In the cpu file, all media insns are represented as being allowed in + both media units. This makes it easier since this is the case for fr500. + Catch the invalid combinations here. Insns of major class FR400_MAJOR_M_2 + cannot coexist with any other media insn in a vliw. */ + switch (major) + { + case FR400_MAJOR_M_2: + return ! find_major_in_vliw (vliw, FR400_MAJOR_M_1) + && ! find_major_in_vliw (vliw, FR400_MAJOR_M_2); + default: + break; + } + return 1; +} + +static int +find_unit_in_vliw ( + FRV_VLIW *vliw, CGEN_ATTR_VALUE_TYPE unit +) +{ + int i; + for (i = 0; i < vliw->next_slot; ++i) + if (CGEN_INSN_ATTR_VALUE (vliw->insn[i], CGEN_INSN_UNIT) == unit) + return 1; + + return 0; /* not found */ +} + +static int +find_major_in_slot ( + FRV_VLIW *vliw, CGEN_ATTR_VALUE_TYPE major, CGEN_ATTR_VALUE_TYPE slot +) +{ + int i; + + for (i = 0; i < vliw->next_slot; ++i) + if (vliw->major[i] == major && (*vliw->current_vliw)[i] == slot) + return 1; + + return 0; +} + +static int +fr550_find_media_in_vliw (FRV_VLIW *vliw) +{ + int i; + + for (i = 0; i < vliw->next_slot; ++i) + { + if (vliw->major[i] < FR550_MAJOR_M_1 || vliw->major[i] > FR550_MAJOR_M_5) + continue; + + /* Found a media insn, however, MNOP and MCLRACC don't count. */ + if (CGEN_INSN_NUM (vliw->insn[i]) == FRV_INSN_MNOP + || CGEN_INSN_NUM (vliw->insn[i]) == FRV_INSN_MCLRACC_0 + || CGEN_INSN_NUM (vliw->insn[i]) == FRV_INSN_MCLRACC_1) + continue; + + return 1; /* found one */ + } + + return 0; +} + +static int +fr550_find_float_in_vliw (FRV_VLIW *vliw) +{ + int i; + + for (i = 0; i < vliw->next_slot; ++i) + { + if (vliw->major[i] < FR550_MAJOR_F_1 || vliw->major[i] > FR550_MAJOR_F_4) + continue; + + /* Found a floating point insn, however, FNOP doesn't count. */ + if (CGEN_INSN_NUM (vliw->insn[i]) == FRV_INSN_FNOP) + continue; + + return 1; /* found one */ + } + + return 0; +} + +static int +fr550_check_insn_major_constraints ( + FRV_VLIW *vliw, CGEN_ATTR_VALUE_TYPE major, const CGEN_INSN *insn +) +{ + CGEN_ATTR_VALUE_TYPE unit; + CGEN_ATTR_VALUE_TYPE slot = (*vliw->current_vliw)[vliw->next_slot]; + switch (slot) + { + case UNIT_I2: + /* If it's a store, then there must be another store in I1 */ + unit = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_UNIT); + if (unit == UNIT_STORE) + return find_unit_in_vliw (vliw, UNIT_STORE); + break; + case UNIT_FM2: + case UNIT_FM3: + /* Floating point insns other than FNOP in slot f2 or f3 cannot coexist with + media insns. */ + if (major >= FR550_MAJOR_F_1 && major <= FR550_MAJOR_F_4 + && CGEN_INSN_NUM (insn) != FRV_INSN_FNOP) + return ! fr550_find_media_in_vliw (vliw); + /* Media insns other than MNOP in slot m2 or m3 cannot coexist with + floating point insns. */ + if (major >= FR550_MAJOR_M_1 && major <= FR550_MAJOR_M_5 + && CGEN_INSN_NUM (insn) != FRV_INSN_MNOP) + return ! fr550_find_float_in_vliw (vliw); + /* F-2 in slot f2 or f3 cannot coexist with F-2 or F-4 in slot f1 or f2 + respectively. + */ + if (major == FR550_MAJOR_F_2) + return ! find_major_in_slot (vliw, FR550_MAJOR_F_2, slot - (UNIT_FM2 - UNIT_FM0)) + && ! find_major_in_slot (vliw, FR550_MAJOR_F_4, slot - (UNIT_FM2 - UNIT_FM0)); + /* M-2 or M-5 in slot m2 or m3 cannot coexist with M-2 in slot m1 or m2 + respectively. */ + if (major == FR550_MAJOR_M_2 || major == FR550_MAJOR_M_5) + return ! find_major_in_slot (vliw, FR550_MAJOR_M_2, slot - (UNIT_FM2 - UNIT_FM0)); + /* M-4 in slot m2 or m3 cannot coexist with M-4 in slot m1 or m2 + respectively. */ + if (major == FR550_MAJOR_M_4) + return ! find_major_in_slot (vliw, FR550_MAJOR_M_4, slot - (UNIT_FM2 - UNIT_FM0)); + break; + default: + break; + } + return 1; /* all ok */ +} + +static int +fr500_check_insn_major_constraints ( + FRV_VLIW *vliw, CGEN_ATTR_VALUE_TYPE major +) +{ + /* TODO: A table might be faster for some of the more complex instances + here. */ + switch (major) + { + case FR500_MAJOR_I_1: + case FR500_MAJOR_I_4: + case FR500_MAJOR_I_5: + case FR500_MAJOR_I_6: + case FR500_MAJOR_B_1: + case FR500_MAJOR_B_2: + case FR500_MAJOR_B_3: + case FR500_MAJOR_B_4: + case FR500_MAJOR_B_5: + case FR500_MAJOR_B_6: + case FR500_MAJOR_F_4: + case FR500_MAJOR_F_8: + case FR500_MAJOR_M_8: + return 1; /* OK */ + case FR500_MAJOR_I_2: + /* Cannot coexist with I-3 insn. */ + return ! find_major_in_vliw (vliw, FR500_MAJOR_I_3); + case FR500_MAJOR_I_3: + /* Cannot coexist with I-2 insn. */ + return ! find_major_in_vliw (vliw, FR500_MAJOR_I_2); + case FR500_MAJOR_F_1: + case FR500_MAJOR_F_2: + /* Cannot coexist with F-5, F-6, or M-7 insn. */ + return ! find_major_in_vliw (vliw, FR500_MAJOR_F_5) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_6) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_7); + case FR500_MAJOR_F_3: + /* Cannot coexist with F-7, or M-7 insn. */ + return ! find_major_in_vliw (vliw, FR500_MAJOR_F_7) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_7); + case FR500_MAJOR_F_5: + /* Cannot coexist with F-1, F-2, F-6, F-7, or M-7 insn. */ + return ! find_major_in_vliw (vliw, FR500_MAJOR_F_1) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_2) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_6) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_7) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_7); + case FR500_MAJOR_F_6: + /* Cannot coexist with F-1, F-2, F-5, F-6, or M-7 insn. */ + return ! find_major_in_vliw (vliw, FR500_MAJOR_F_1) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_2) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_5) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_6) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_7); + case FR500_MAJOR_F_7: + /* Cannot coexist with F-3, F-5, F-7, or M-7 insn. */ + return ! find_major_in_vliw (vliw, FR500_MAJOR_F_3) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_5) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_7) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_7); + case FR500_MAJOR_M_1: + /* Cannot coexist with M-7 insn. */ + return ! find_major_in_vliw (vliw, FR500_MAJOR_M_7); + case FR500_MAJOR_M_2: + case FR500_MAJOR_M_3: + /* Cannot coexist with M-5, M-6 or M-7 insn. */ + return ! find_major_in_vliw (vliw, FR500_MAJOR_M_5) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_6) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_7); + case FR500_MAJOR_M_4: + /* Cannot coexist with M-6 insn. */ + return ! find_major_in_vliw (vliw, FR500_MAJOR_M_6); + case FR500_MAJOR_M_5: + /* Cannot coexist with M-2, M-3, M-5, M-6 or M-7 insn. */ + return ! find_major_in_vliw (vliw, FR500_MAJOR_M_2) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_3) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_5) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_6) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_7); + case FR500_MAJOR_M_6: + /* Cannot coexist with M-2, M-3, M-4, M-5, M-6 or M-7 insn. */ + return ! find_major_in_vliw (vliw, FR500_MAJOR_M_2) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_3) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_4) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_5) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_6) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_7); + case FR500_MAJOR_M_7: + /* Cannot coexist with M-1, M-2, M-3, M-5, M-6 or M-7 insn. */ + return ! find_major_in_vliw (vliw, FR500_MAJOR_M_1) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_2) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_3) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_5) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_6) + && ! find_major_in_vliw (vliw, FR500_MAJOR_M_7) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_1) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_2) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_3) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_5) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_6) + && ! find_major_in_vliw (vliw, FR500_MAJOR_F_7); + default: + fprintf (stderr, "frv-opc.c, line %d: bad major code, aborting.\n", + __LINE__); + abort (); + break; + } + return 1; +} + +static int +check_insn_major_constraints ( + FRV_VLIW *vliw, CGEN_ATTR_VALUE_TYPE major, const CGEN_INSN *insn +) +{ + int rc; + switch (vliw->mach) + { + case bfd_mach_fr400: + rc = fr400_check_insn_major_constraints (vliw, major); + break; + case bfd_mach_fr550: + rc = fr550_check_insn_major_constraints (vliw, major, insn); + break; + default: + rc = fr500_check_insn_major_constraints (vliw, major); + break; + } + return rc; +} + +/* Add in insn to the VLIW vliw if possible. Return 0 if successful, + non-zero otherwise. */ +int +frv_vliw_add_insn (FRV_VLIW *vliw, const CGEN_INSN *insn) +{ + int index; + CGEN_ATTR_VALUE_TYPE major; + CGEN_ATTR_VALUE_TYPE unit; + VLIW_COMBO *new_vliw; + + if (vliw->constraint_violation || CGEN_INSN_INVALID_P (insn)) + return 1; + + index = vliw->next_slot; + if (index >= FRV_VLIW_SIZE) + return 1; + + unit = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_UNIT); + if (unit == UNIT_NIL) + { + fprintf (stderr, "frv-opc.c line %d: bad insn unit.\n", + __LINE__); + abort (); /* no UNIT specified for this insn in frv.cpu */ + } + + switch (vliw->mach) + { + case bfd_mach_fr400: + major = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_FR400_MAJOR); + break; + case bfd_mach_fr550: + major = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_FR550_MAJOR); + break; + default: + major = CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_FR500_MAJOR); + break; + } + + if (index <= 0) + { + /* Any insn can be added to slot 0. */ + while (! match_unit (vliw, unit, (*vliw->current_vliw)[0])) + ++vliw->current_vliw; + vliw->major[0] = major; + vliw->insn[0] = insn; + vliw->next_slot = 1; + return 0; + } + + /* If there are already insns in the vliw(s) check to see that + this one can be added. Do this by finding an allowable vliw + combination that can accept the new insn. */ + if (! (vliw->elf_flags & EF_FRV_NOPACK)) + { + new_vliw = add_next_to_vliw (vliw, unit); + if (new_vliw && check_insn_major_constraints (vliw, major, insn)) + { + vliw->current_vliw = new_vliw; + vliw->major[index] = major; + vliw->insn[index] = insn; + vliw->next_slot++; + return 0; + } + + /* The frv machine supports all packing conbinations. If we fail, + to add the insn, then it could not be handled as if it was the fr500. + Just return as if it was handled ok. */ + if (vliw->mach == bfd_mach_frv) + return 0; + } + + vliw->constraint_violation = 1; + return 1; +} + +int +spr_valid (regno) + long regno; +{ + if (regno < 0) return 0; + if (regno <= 4095) return 1; + return 0; +} +/* -- */ + +/* -- asm.c */ +static const char * parse_ulo16 + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_uslo16 + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_uhi16 + PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static long parse_register_number + PARAMS ((const char **)); +static const char * parse_spr + PARAMS ((CGEN_CPU_DESC, const char **, CGEN_KEYWORD *, long *)); +static const char * parse_d12 + PARAMS ((CGEN_CPU_DESC, const char **, int, long *)); +static const char * parse_s12 + PARAMS ((CGEN_CPU_DESC, const char **, int, long *)); +static const char * parse_u12 + PARAMS ((CGEN_CPU_DESC, const char **, int, long *)); +static const char * parse_even_register + PARAMS ((CGEN_CPU_DESC, const char **, CGEN_KEYWORD *, long *)); +static const char * parse_A0 + PARAMS ((CGEN_CPU_DESC, const char **, int, long *)); +static const char * parse_A1 + PARAMS ((CGEN_CPU_DESC, const char **, int, long *)); +static const char * parse_A + PARAMS ((CGEN_CPU_DESC, const char **, int, long *, long)); + +static const char * +parse_ulo16 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + unsigned long *valuep; +{ + const char *errmsg; + enum cgen_parse_operand_result result_type; + bfd_vma value; + + if (**strp == '#' || **strp == '%') + { + if (strncasecmp (*strp + 1, "lo(", 3) == 0) + { + *strp += 4; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_LO16, + &result_type, &value); + if (**strp != ')') + return "missing `)'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + if (strncasecmp (*strp + 1, "gprello(", 8) == 0) + { + *strp += 9; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_GPRELLO, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotlo(", 6) == 0) + { + *strp += 7; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_GOTLO, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotfuncdesclo(", 14) == 0) + { + *strp += 15; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_FUNCDESC_GOTLO, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotofflo(", 9) == 0) + { + *strp += 10; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_GOTOFFLO, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotofffuncdesclo(", 17) == 0) + { + *strp += 18; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_FUNCDESC_GOTOFFLO, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + } + return cgen_parse_signed_integer (cd, strp, opindex, valuep); +} + +static const char * +parse_uslo16 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + unsigned long *valuep; +{ + const char *errmsg; + enum cgen_parse_operand_result result_type; + bfd_vma value; + + if (**strp == '#' || **strp == '%') + { + if (strncasecmp (*strp + 1, "lo(", 3) == 0) + { + *strp += 4; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_LO16, + &result_type, &value); + if (**strp != ')') + return "missing `)'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gprello(", 8) == 0) + { + *strp += 9; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_GPRELLO, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotlo(", 6) == 0) + { + *strp += 7; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_GOTLO, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotfuncdesclo(", 14) == 0) + { + *strp += 15; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_FUNCDESC_GOTLO, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotofflo(", 9) == 0) + { + *strp += 10; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_GOTOFFLO, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotofffuncdesclo(", 17) == 0) + { + *strp += 18; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_FUNCDESC_GOTOFFLO, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + } + return cgen_parse_unsigned_integer (cd, strp, opindex, valuep); +} + +static const char * +parse_uhi16 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + unsigned long *valuep; +{ + const char *errmsg; + enum cgen_parse_operand_result result_type; + bfd_vma value; + + if (**strp == '#' || **strp == '%') + { + if (strncasecmp (*strp + 1, "hi(", 3) == 0) + { + *strp += 4; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_HI16, + &result_type, &value); + if (**strp != ')') + return "missing `)'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value >>= 16; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gprelhi(", 8) == 0) + { + *strp += 9; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_GPRELHI, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value >>= 16; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gothi(", 6) == 0) + { + *strp += 7; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_GOTHI, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value >>= 16; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotfuncdeschi(", 14) == 0) + { + *strp += 15; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_FUNCDESC_GOTHI, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value >>= 16; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotoffhi(", 9) == 0) + { + *strp += 10; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_GOTOFFHI, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value >>= 16; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotofffuncdeschi(", 17) == 0) + { + *strp += 18; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_FUNCDESC_GOTOFFHI, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value >>= 16; + *valuep = value; + return errmsg; + } + } + return cgen_parse_unsigned_integer (cd, strp, opindex, valuep); +} + +static long +parse_register_number (strp) + const char **strp; +{ + int regno; + if (**strp < '0' || **strp > '9') + return -1; /* error */ + + regno = **strp - '0'; + for (++*strp; **strp >= '0' && **strp <= '9'; ++*strp) + regno = regno * 10 + (**strp - '0'); + + return regno; +} + +static const char * +parse_spr (cd, strp, table, valuep) + CGEN_CPU_DESC cd; + const char **strp; + CGEN_KEYWORD * table; + long *valuep; +{ + const char *save_strp; + long regno; + + /* Check for spr index notation. */ + if (strncasecmp (*strp, "spr[", 4) == 0) + { + *strp += 4; + regno = parse_register_number (strp); + if (**strp != ']') + return "missing `]'"; + ++*strp; + if (! spr_valid (regno)) + return "Special purpose register number is out of range"; + *valuep = regno; + return NULL; + } + + save_strp = *strp; + regno = parse_register_number (strp); + if (regno != -1) + { + if (! spr_valid (regno)) + return "Special purpose register number is out of range"; + *valuep = regno; + return NULL; + } + + *strp = save_strp; + return cgen_parse_keyword (cd, strp, table, valuep); +} + +static const char * +parse_d12 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + long *valuep; +{ + const char *errmsg; + enum cgen_parse_operand_result result_type; + bfd_vma value; + + /* Check for small data reference. */ + if (**strp == '#' || **strp == '%') + { + if (strncasecmp (*strp + 1, "gprel12(", 8) == 0) + { + *strp += 9; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_GPREL12, + &result_type, &value); + if (**strp != ')') + return "missing `)'"; + ++*strp; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "got12(", 6) == 0) + { + *strp += 7; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_GOT12, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotfuncdesc12(", 14) == 0) + { + *strp += 15; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_FUNCDESC_GOT12, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotoff12(", 9) == 0) + { + *strp += 10; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_GOTOFF12, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + *valuep = value; + return errmsg; + } + else if (strncasecmp (*strp + 1, "gotofffuncdesc12(", 17) == 0) + { + *strp += 18; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_FUNCDESC_GOTOFF12, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + *valuep = value; + return errmsg; + } + } + return cgen_parse_signed_integer (cd, strp, opindex, valuep); +} + +static const char * +parse_s12 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + long *valuep; +{ + const char *errmsg; + enum cgen_parse_operand_result result_type; + bfd_vma value; + + /* Check for small data reference. */ + if ((**strp == '#' || **strp == '%') + && strncasecmp (*strp + 1, "gprel12(", 8) == 0) + { + *strp += 9; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_GPREL12, + &result_type, &value); + if (**strp != ')') + return "missing `)'"; + ++*strp; + *valuep = value; + return errmsg; + } + else if ((**strp == '#' || **strp == '%') + && strncasecmp (*strp + 1, "got12(", 6) == 0) + { + *strp += 7; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_GOT12, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + *valuep = value; + return errmsg; + } + else if ((**strp == '#' || **strp == '%') + && strncasecmp (*strp + 1, "gotfuncdesc12(", 14) == 0) + { + *strp += 15; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_FUNCDESC_GOT12, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + *valuep = value; + return errmsg; + } + else if ((**strp == '#' || **strp == '%') + && strncasecmp (*strp + 1, "gotoff12(", 9) == 0) + { + *strp += 10; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_GOTOFF12, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + *valuep = value; + return errmsg; + } + else if ((**strp == '#' || **strp == '%') + && strncasecmp (*strp + 1, "gotofffuncdesc12(", 17) == 0) + { + *strp += 18; + errmsg = cgen_parse_address (cd, strp, opindex, + BFD_RELOC_FRV_FUNCDESC_GOTOFF12, + &result_type, &value); + if (**strp != ')') + return "missing ')'"; + ++*strp; + *valuep = value; + return errmsg; + } + else + { + if (**strp == '#') + ++*strp; + return cgen_parse_signed_integer (cd, strp, opindex, valuep); + } +} + +static const char * +parse_u12 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + long *valuep; +{ + const char *errmsg; + enum cgen_parse_operand_result result_type; + bfd_vma value; + + /* Check for small data reference. */ + if ((**strp == '#' || **strp == '%') + && strncasecmp (*strp + 1, "gprel12(", 8) == 0) + { + *strp += 9; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_FRV_GPRELU12, + &result_type, &value); + if (**strp != ')') + return "missing `)'"; + ++*strp; + *valuep = value; + return errmsg; + } + else + { + if (**strp == '#') + ++*strp; + return cgen_parse_signed_integer (cd, strp, opindex, valuep); + } +} + +static const char * +parse_A (cd, strp, opindex, valuep, A) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + long *valuep; + long A; +{ + const char *errmsg; + + if (**strp == '#') + ++*strp; + + errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, valuep); + if (errmsg) + return errmsg; + + if (*valuep != A) + return "Value of A operand must be 0 or 1"; + + return NULL; +} + +static const char * +parse_A0 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + long *valuep; +{ + return parse_A (cd, strp, opindex, valuep, 0); +} + +static const char * +parse_A1 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + long *valuep; +{ + return parse_A (cd, strp, opindex, valuep, 1); +} + +static const char * +parse_even_register (cd, strP, tableP, valueP) + CGEN_CPU_DESC cd; + const char ** strP; + CGEN_KEYWORD * tableP; + long * valueP; +{ + const char * errmsg; + const char * saved_star_strP = * strP; + + errmsg = cgen_parse_keyword (cd, strP, tableP, valueP); + + if (errmsg == NULL && ((* valueP) & 1)) + { + errmsg = _("register number must be even"); + * strP = saved_star_strP; + } + + return errmsg; +} +/* -- */ + +/* -- dis.c */ +static void print_spr + PARAMS ((CGEN_CPU_DESC, PTR, CGEN_KEYWORD *, long, unsigned)); +static void print_hi + PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); +static void print_lo + PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned, bfd_vma, int)); + +static void +print_spr (cd, dis_info, names, regno, attrs) + CGEN_CPU_DESC cd; + PTR dis_info; + CGEN_KEYWORD *names; + long regno; + unsigned int attrs; +{ + /* Use the register index format for any unnamed registers. */ + if (cgen_keyword_lookup_value (names, regno) == NULL) + { + disassemble_info *info = (disassemble_info *) dis_info; + (*info->fprintf_func) (info->stream, "spr[%ld]", regno); + } + else + print_keyword (cd, dis_info, names, regno, attrs); +} + +static void +print_hi (cd, dis_info, value, attrs, pc, length) + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; + PTR dis_info; + long value; + unsigned int attrs ATTRIBUTE_UNUSED; + bfd_vma pc ATTRIBUTE_UNUSED; + int length ATTRIBUTE_UNUSED; +{ + disassemble_info *info = (disassemble_info *) dis_info; + if (value) + (*info->fprintf_func) (info->stream, "0x%lx", value); + else + (*info->fprintf_func) (info->stream, "hi(0x%lx)", value); +} + +static void +print_lo (cd, dis_info, value, attrs, pc, length) + CGEN_CPU_DESC cd ATTRIBUTE_UNUSED; + PTR dis_info; + long value; + unsigned int attrs ATTRIBUTE_UNUSED; + bfd_vma pc ATTRIBUTE_UNUSED; + int length ATTRIBUTE_UNUSED; +{ + disassemble_info *info = (disassemble_info *) dis_info; + if (value) + (*info->fprintf_func) (info->stream, "0x%lx", value); + else + (*info->fprintf_func) (info->stream, "lo(0x%lx)", value); +} + +/* -- */ diff --git a/cpu/iq10.cpu b/cpu/iq10.cpu new file mode 100644 index 0000000000000..322f3ccbe34bb --- /dev/null +++ b/cpu/iq10.cpu @@ -0,0 +1,1111 @@ +; IQ10-only CPU description. -*- Scheme -*- +; +; Copyright 2001, 2002 Free Software Foundation, Inc. +; +; Contributed by Red Hat Inc; developed under contract from Vitesse. +; +; This file is part of the GNU Binutils. +; +; This program is free software; 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. + + +; Instructions. + +(dni andoui-q10 "iq10 and upper ones immediate" (MACH10 USES-RS USES-RT) + "andoui $rt,$rs,$hi16" + (+ OP10_ANDOUI rs rt hi16) + (set rt (and rs (or (sll hi16 16) #xFFFF))) + ()) + +(dni andoui2-q10 "iq10 and upper ones immediate" (ALIAS NO-DIS MACH10 USES-RS USES-RT) + "andoui ${rt-rs},$hi16" + (+ OP10_ANDOUI rt-rs hi16) + (set rt-rs (and rt-rs (or (sll hi16 16) #xFFFF))) + ()) + +(dni orui-q10 "or upper immediate" (MACH10 USES-RS USES-RT) + "orui $rt,$rs,$hi16" + (+ OP10_ORUI rs rt hi16) + (set rt (or rs (sll hi16 16))) + ()) + +(dni orui2-q10 "or upper immediate" (ALIAS NO-DIS MACH10 USES-RS USES-RT) + "orui ${rt-rs},$hi16" + (+ OP10_ORUI rt-rs hi16) + (set rt-rs (or rt-rs (sll hi16 16))) + ()) + +(dni mrgbq10 "merge bytes" (MACH10 USES-RD USES-RS USES-RT) + "mrgb $rd,$rs,$rt,$maskq10" + (+ OP_SPECIAL rs rt rd maskq10 FUNC_MRGB) + (sequence ((SI temp)) + (if (bitclear? mask 0) + (set temp (and rs #xFF)) + (set temp (and rt #xFF))) + (if (bitclear? mask 1) + (set temp (or temp (and rs #xFF00))) + (set temp (or temp (and rt #xFF00)))) + (if (bitclear? mask 2) + (set temp (or temp (and rs #xFF0000))) + (set temp (or temp (and rt #xFF0000)))) + (if (bitclear? mask 3) + (set temp (or temp (and rs #xFF000000))) + (set temp (or temp (and rt #xFF000000)))) + (set rd temp)) + ()) + +(dni mrgbq102 "merge bytes" (ALIAS NO-DIS MACH10 USES-RD USES-RS USES-RT) + "mrgb ${rd-rs},$rt,$maskq10" + (+ OP_SPECIAL rt rd-rs maskq10 FUNC_MRGB) + (sequence ((SI temp)) + (if (bitclear? mask 0) + (set temp (and rd-rs #xFF)) + (set temp (and rt #xFF))) + (if (bitclear? mask 1) + (set temp (or temp (and rd-rs #xFF00))) + (set temp (or temp (and rt #xFF00)))) + (if (bitclear? mask 2) + (set temp (or temp (and rd-rs #xFF0000))) + (set temp (or temp (and rt #xFF0000)))) + (if (bitclear? mask 3) + (set temp (or temp (and rd-rs #xFF000000))) + (set temp (or temp (and rt #xFF000000)))) + (set rd-rs temp)) + ()) + +; In the future, we'll want the j & jal to use the 21 bit target, with +; the upper five bits shifted up. For now, give 'em the 16 bit target. + +(dni jq10 "jump" (MACH10) + "j $jmptarg" + (+ OP_J (f-rs 0) (f-rt 0) jmptarg) +; "j $jmptargq10" +; (+ OP_J upper-5-jmptargq10 (f-rt 0) lower-16-jmptargq10) + (delay 1 (set pc jmptarg)) + ()) + +(dni jalq10 "jump and link" (MACH10 USES-RT) + "jal $rt,$jmptarg" + (+ OP_JAL (f-rs 0) rt jmptarg) +; "jal $rt,$jmptargq10" +; (+ OP_JAL upper-5-jmptargq10 rt lower-16-jmptargq10) + (delay 1 + (sequence () + (set rt (add pc 8)) + (set pc jmptarg))) + ()) + +(dni jalq10-2 "jump and link, implied r31" (MACH10 USES-RT) + "jal $jmptarg" + (+ OP_JAL (f-rs 0) (f-rt 31) jmptarg) + (delay 1 + (sequence () + (set rt (add pc 8)) + (set pc jmptarg))) + ()) + +; Branch instructions. + +(dni bbil "branch bit immediate likely" (MACH10 USES-RS) + "bbil $rs($bitnum),$offset" + (+ OP10_BBIL rs bitnum offset) + (if (bitset? rs bitnum) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bbinl "branch bit immediate negated likely" (MACH10 USES-RS) + "bbinl $rs($bitnum),$offset" + (+ OP10_BBINL rs bitnum offset) + (if (bitclear? rs bitnum) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bbvl "branch bit variable likely" (MACH10 USES-RS USES-RT) + "bbvl $rs,$rt,$offset" + (+ OP10_BBVL rs rt offset) + (if (bitset? rs (and rt #x1F)) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bbvnl "branch bit variable negated likely" (MACH10 USES-RS USES-RT) + "bbvnl $rs,$rt,$offset" + (+ OP10_BBVNL rs rt offset) + (if (bitclear? rs (and rt #x1F)) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bgtzal "branch if greater than zero and link" (MACH10 USES-RS USES-R31) + "bgtzal $rs,$offset" + (+ OP_REGIMM rs FUNC_BGTZAL offset) + (if (gt rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset)))) + ()) + +(dni bgtzall + "branch if greater than zero and link likely" (MACH10 USES-RS USES-R31) + "bgtzall $rs,$offset" + (+ OP_REGIMM rs FUNC_BGTZALL offset) + (if (gt rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset))) + (skip 1)) + ()) + +(dni blezal "branch if less than or equal to zero and link" (MACH10 USES-RS USES-R31) + "blezal $rs,$offset" + (+ OP_REGIMM rs FUNC_BLEZAL offset) + (if (le rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset)))) + ()) + +(dni blezall + "branch if less than or equal to zero and link likely" (MACH10 USES-RS USES-R31) + "blezall $rs,$offset" + (+ OP_REGIMM rs FUNC_BLEZALL offset) + (if (le rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset))) + (skip 1)) + ()) + +(dni bgtz-q10 "branch if greater than zero" (MACH10 USES-RS) + "bgtz $rs,$offset" + (+ OP_REGIMM rs FUNC_BGTZ offset) + (if (gt rs 0) + (delay 1 (set pc offset))) + ()) + +(dni bgtzl-q10 "branch if greater than zero likely" (MACH10 USES-RS) + "bgtzl $rs,$offset" + (+ OP_REGIMM rs FUNC_BGTZL offset) + (if (gt rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + + +(dni blez-q10 "branch if less than or equal to zero" (MACH10 USES-RS) + "blez $rs,$offset" + (+ OP_REGIMM rs FUNC_BLEZ offset) + (if (le rs 0) + (delay 1 (set pc offset))) + ()) + +(dni blezl-q10 "branch if less than or equal to zero likely" (MACH10 USES-RS) + "blezl $rs,$offset" + (+ OP_REGIMM rs FUNC_BLEZL offset) + (if (le rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bmb-q10 "branch if matching byte-lane" (MACH10 USES-RS USES-RT) + "bmb $rs,$rt,$offset" + (+ OP10_BMB rs rt offset) + (sequence ((BI branch?)) + (set branch? 0) + (if (eq (and rs #xFF) (and rt #xFF)) + (set branch? 1)) + (if (eq (and rs #xFF00) (and rt #xFF00)) + (set branch? 1)) + (if (eq (and rs #xFF0000) (and rt #xFF0000)) + (set branch? 1)) + (if (eq (and rs #xFF000000) (and rt #xFF000000)) + (set branch? 1)) + (if branch? + (delay 1 (set pc offset)))) + ()) + +(dni bmbl "branch if matching byte-lane likely" (MACH10 USES-RS USES-RT) + "bmbl $rs,$rt,$offset" + (+ OP10_BMBL rs rt offset) + (sequence ((BI branch?)) + (set branch? 0) + (if (eq (and rs #xFF) (and rt #xFF)) + (set branch? 1)) + (if (eq (and rs #xFF00) (and rt #xFF00)) + (set branch? 1)) + (if (eq (and rs #xFF0000) (and rt #xFF0000)) + (set branch? 1)) + (if (eq (and rs #xFF000000) (and rt #xFF000000)) + (set branch? 1)) + (if branch? + (delay 1 (set pc offset)) + (skip 1))) + ()) + +(dni bri "branch if register invalid" (MACH10 USES-RS) + "bri $rs,$offset" + (+ OP_REGIMM rs FUNC_BRI offset) + (if (gt rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni brv "branch if register invalid" (MACH10 USES-RS) + "brv $rs,$offset" + (+ OP_REGIMM rs FUNC_BRV offset) + (if (gt rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +; debug instructions + +(dni bctx "branch if the current context == instruction[21]" (MACH10 USES-RS) + "bctx $rs,$offset" + (+ OP_REGIMM rs FUNC_BCTX offset) + (delay 1 (set pc offset)) + ()) + +(dni yield "unconditional yield to the other context" (MACH10) + "yield" + (+ OP_SPECIAL (f-rs 0) (f-rt 0) (f-rd 0) (f-shamt 0) FUNC10_YIELD) + (unimp yield) + ()) + +; Special instructions. + +(dni crc32 "CRC, 32 bit input" (MACH10 USES-RD USES-RS USES-RT) + "crc32 $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_CRC32) + (unimp crc32) + ()) + +(dni crc32b "CRC, 8 bit input" (MACH10 USES-RD USES-RS USES-RT) + "crc32b $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_CRC32B) + (unimp crc32b) + ()) + +(dni cnt1s "Count ones" (MACH10 USES-RD USES-RS) + "cnt1s $rd,$rs" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC10_CNT1S) + (unimp crcp) + ()) + + +; Special Instructions + +(dni avail "Mark Header Buffer Available" (MACH10 USES-RD) + "avail $rd" + (+ OP_COP3 (f-rs 0) (f-rt 0) rd (f-shamt 0) FUNC10_AVAIL) + (unimp avail) + ()) + +(dni free "Mark Header Buffer Free" (MACH10 USES-RS USES-RD) + "free $rd,$rs" + (+ OP_COP3 rs (f-rt 0) rd (f-shamt 0) FUNC10_FREE) + (unimp free) + ()) + +(dni tstod "Test Header Buffer Order Dependency" (MACH10 USES-RS USES-RD) + "tstod $rd,$rs" + (+ OP_COP3 rs (f-rt 0) rd (f-shamt 0) FUNC10_TSTOD) + (unimp tstod) + ()) + +(dni cmphdr "Get a Complete Header" (MACH10 USES-RD) + "cmphdr $rd" + (+ OP_COP3 (f-rs 0) (f-rt 0) rd (f-shamt 0) FUNC10_CMPHDR) + (unimp cmphdr) + ()) + +(dni mcid "Allocate a Multicast ID" (MACH10 USES-RD USES-RT) + "mcid $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_MCID) + (unimp mcid) + ()) + +(dni dba "Allocate a Data Buffer Pointer" (MACH10 USES-RD) + "dba $rd" + (+ OP_COP3 (f-rs 0) (f-rt 0) rd (f-shamt 0) FUNC10_DBA) + (unimp dba) + ()) + +(dni dbd "Deallocate a Data Buffer Pointer" (MACH10 USES-RS USES-RT USES-RD) + "dbd $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_DBD) + (unimp dbd) + ()) + +(dni dpwt "DSTN_PORT Write" (MACH10 USES-RS USES-RD) + "dpwt $rd,$rs" + (+ OP_COP3 rs (f-rt 0) rd (f-shamt 0) FUNC10_DPWT) + (unimp dpwt) + ()) + +; Architectural and coprocessor instructions. + +(dni chkhdrq10 "" (MACH10 USES-RS USES-RD) + "chkhdr $rd,$rs" + (+ OP_COP3 rs (f-rt 0) rd (f-shamt 0) FUNC10_CHKHDR) + (unimp chkhdr) + ()) + +; Coprocessor DMA Instructions (IQ10) + +(dni rba "Read Bytes Absolute" (MACH10 USES-RS USES-RT USES-RD) + "rba $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_RBA) + (unimp rba) + ()) + +(dni rbal "Read Bytes Absolute and Lock" (MACH10 USES-RS USES-RT USES-RD) + "rbal $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_RBAL) + (unimp rbal) + ()) + +(dni rbar "Read Bytes Absolute and Release" (MACH10 USES-RS USES-RT USES-RD) + "rbar $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_RBAR) + (unimp rbar) + ()) + +(dni wba "Write Bytes Absolute" (MACH10 USES-RS USES-RT USES-RD) + "wba $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_WBA) + (unimp wba) + ()) + +(dni wbau "Write Bytes Absolute and Unlock" (MACH10 USES-RS USES-RT USES-RD) + "wbau $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_WBAU) + (unimp wbau) + ()) + +(dni wbac "Write Bytes Absolute Cacheable" (MACH10 USES-RS USES-RT USES-RD) + "wbac $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_WBAC) + (unimp wbac) + ()) + +(dni rbi "Read Bytes Immediate" (MACH10 USES-RD USES-RS USES-RT) + "rbi $rd,$rs,$rt,$bytecount" + (+ OP_COP3 rs rt rd FUNC10_RBI bytecount) + (unimp rbi) + ()) + +(dni rbil "Read Bytes Immediate and Lock" (MACH10 USES-RD USES-RS USES-RT) + "rbil $rd,$rs,$rt,$bytecount" + (+ OP_COP3 rs rt rd FUNC10_RBIL bytecount) + (unimp rbil) + ()) + +(dni rbir "Read Bytes Immediate and Release" (MACH10 USES-RD USES-RS USES-RT) + "rbir $rd,$rs,$rt,$bytecount" + (+ OP_COP3 rs rt rd FUNC10_RBIR bytecount) + (unimp rbir) + ()) + +(dni wbi "Write Bytes Immediate" (MACH10 USES-RD USES-RS USES-RT) + "wbi $rd,$rs,$rt,$bytecount" + (+ OP_COP3 rs rt rd FUNC10_WBI bytecount) + (unimp wbi) + ()) + +(dni wbic "Write Bytes Immediate Cacheable" (MACH10 USES-RD USES-RS USES-RT) + "wbic $rd,$rs,$rt,$bytecount" + (+ OP_COP3 rs rt rd FUNC10_WBIC bytecount) + (unimp wbic) + ()) + +(dni wbiu "Write Bytes Immediate" (MACH10 USES-RD USES-RS USES-RT) + "wbiu $rd,$rs,$rt,$bytecount" + (+ OP_COP3 rs rt rd FUNC10_WBIU bytecount) + (unimp wbiu) + ()) + +(dni pkrli "Packet Release Immediate" (MACH10 USES-RD USES-RS USES-RT) + "pkrli $rd,$rs,$rt,$bytecount" + (+ OP_COP2 rs rt rd FUNC10_PKRLI bytecount) + (unimp pkrli) + ()) + +(dni pkrlih "Packet Release Immediate and Hold" (MACH10 USES-RD USES-RS USES-RT) + "pkrlih $rd,$rs,$rt,$bytecount" + (+ OP_COP2 rs rt rd FUNC10_PKRLIH bytecount) + (unimp pkrlih) + ()) + +(dni pkrliu "Packet Release Immediate Unconditional" (MACH10 USES-RD USES-RS USES-RT) + "pkrliu $rd,$rs,$rt,$bytecount" + (+ OP_COP2 rs rt rd FUNC10_PKRLIU bytecount) + (unimp pkrliu) + ()) + +(dni pkrlic "Packet Release Immediate Continue" (MACH10 USES-RD USES-RS USES-RT) + "pkrlic $rd,$rs,$rt,$bytecount" + (+ OP_COP2 rs rt rd FUNC10_PKRLIC bytecount) + (unimp pkrlic) + ()) + +(dni pkrla "Packet Release Absolute" (MACH10 USES-RS USES-RT USES-RD) + "pkrla $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_PKRLA) + (unimp pkrla) + ()) + +(dni pkrlau "Packet Release Absolute Unconditional" (MACH10 USES-RS USES-RT USES-RD) + "pkrlau $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_PKRLAU) + (unimp pkrlau) + ()) + +(dni pkrlah "Packet Release Absolute and Hold" (MACH10 USES-RS USES-RT USES-RD) + "pkrlah $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_PKRLAH) + (unimp pkrlah) + ()) + +(dni pkrlac "Packet Release Absolute Continue" (MACH10 USES-RS USES-RT USES-RD) + "pkrlac $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_PKRLAC) + (unimp pkrlac) + ()) + +; Main Memory Access Instructions + +(dni lock "lock memory" (MACH10 USES-RD USES-RT) + "lock $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_LOCK) + (unimp lock) + ()) + +(dni unlk "unlock memory" (MACH10 USES-RT USES-RD) + "unlk $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_UNLK) + (unimp unlk) + ()) + +(dni swrd "Single Word Read" (MACH10 USES-RT USES-RD) + "swrd $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_SWRD) + (unimp swrd) + ()) + +(dni swrdl "Single Word Read and Lock" (MACH10 USES-RT USES-RD) + "swrdl $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_SWRDL) + (unimp swrdl) + ()) + +(dni swwr "Single Word Write" (MACH10 USES-RS USES-RT USES-RD) + "swwr $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_SWWR) + (unimp swwr) + ()) + +(dni swwru "Single Word Write and Unlock" (MACH10 USES-RS USES-RT USES-RD) + "swwru $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 0) FUNC10_SWWRU) + (unimp swwru) + ()) + +(dni dwrd "Double Word Read" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "dwrd $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_DWRD) + (unimp dwrd) + ()) + +(dni dwrdl "Double Word Read and Lock" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "dwrdl $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_DWRDL) + (unimp dwrdl) + ()) + +; CAM access instructions (IQ10) + +(dni cam36 "CAM Access in 36-bit Mode" (MACH10 USES-RT USES-RD) + "cam36 $rd,$rt,${cam-z},${cam-y}" + (+ OP_COP3 (f-rs 0) rt rd FUNC10_CAM36 cam-z cam-y) + (unimp cam36) + ()) + +(dni cam72 "CAM Access in 72-bit Mode" (MACH10 USES-RT USES-RD) + "cam72 $rd,$rt,${cam-y},${cam-z}" + (+ OP_COP3 (f-rs 0) rt rd FUNC10_CAM72 cam-z cam-y) + (unimp cam72) + ()) + +(dni cam144 "CAM Access in 144-bit Mode" (MACH10 USES-RT USES-RD) + "cam144 $rd,$rt,${cam-y},${cam-z}" + (+ OP_COP3 (f-rs 0) rt rd FUNC10_CAM144 cam-z cam-y) + (unimp cam144) + ()) + +(dni cam288 "CAM Access in 288-bit Mode" (MACH10 USES-RT USES-RD) + "cam288 $rd,$rt,${cam-y},${cam-z}" + (+ OP_COP3 (f-rs 0) rt rd FUNC10_CAM288 cam-z cam-y) + (unimp cam288) + ()) + +; Counter manager instructions (IQ10) + +(dni cm32and "Counter Manager And" (MACH10 USES-RS USES-RT USES-RD) + "cm32and $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32AND) + (unimp cm32and) + ()) + +(dni cm32andn "Counter Manager And With Inverse" (MACH10 USES-RS USES-RT USES-RD) + "cm32andn $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32ANDN) + (unimp cm32andn) + ()) + +(dni cm32or "Counter Manager Or" (MACH10 USES-RS USES-RT USES-RD) + "cm32or $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32OR) + (unimp cm32or) + ()) + +(dni cm32ra "Counter Manager 32-bit Rolling Add" (MACH10 USES-RS USES-RT USES-RD) + "cm32ra $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 2) FUNC10_CM32RA) + (unimp cm32ra) + ()) + +(dni cm32rd "Counter Manager 32-bit Rolling Decrement" (MACH10 USES-RT USES-RD) + "cm32rd $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32RD) + (unimp cm32rd) + ()) + +(dni cm32ri "Counter Manager 32-bit Rolling Increment" (MACH10 USES-RT USES-RD) + "cm32ri $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32RI) + (unimp cm32ri) + ()) + +(dni cm32rs "Counter Manager 32-bit Rolling Subtract" (MACH10 USES-RS USES-RT USES-RD) + "cm32rs $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-shamt 2) FUNC10_CM32RS) + (unimp cm32rs) + ()) + +(dni cm32sa "Counter Manager 32-bit Saturating Add" (MACH10 USES-RS USES-RT USES-RD) + "cm32sa $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32SA) + (unimp cm32sa) + ()) + +(dni cm32sd "Counter Manager 32-bit Saturating Decrement" (MACH10 USES-RT USES-RD) + "cm32sd $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32SD) + (unimp cm32sd) + ()) + +(dni cm32si "Counter Manager 32-bit Saturating Increment" (MACH10 USES-RT USES-RD) + "cm32si $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32SI) + (unimp cm32si) + ()) + +(dni cm32ss "Counter Manager 32-bit Saturating Subtract" (MACH10 USES-RS USES-RT USES-RD) + "cm32ss $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32SS) + (unimp cm32ss) + ()) + +(dni cm32xor "Counter Manager Xor" (MACH10 USES-RS USES-RT USES-RD) + "cm32xor $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM32XOR) + (unimp cm32xor) + ()) + +(dni cm64clr "Counter Manager Clear" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "cm64clr $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64CLR) + (unimp cm64clr) + ()) + +(dni cm64ra "Counter Manager 64-bit Rolling Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm64ra $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64RA) + (unimp cm64ra) + ()) + +(dni cm64rd "Counter Manager 64-bit Rolling Decrement" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "cm64rd $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64RD) + (unimp cm64rd) + ()) + +(dni cm64ri "Counter Manager 32-bit Rolling Increment" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "cm64ri $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64RI) + (unimp cm64ri) + ()) + +(dni cm64ria2 "Counter Manager 32/32 Rolling Increment/Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm64ria2 $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64RIA2) + (unimp cm64ria2) + ()) + +(dni cm64rs "Counter Manager 64-bit Rolling Subtract" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm64rs $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64RS) + (unimp cm64rs) + ()) + +(dni cm64sa "Counter Manager 64-bit Saturating Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm64sa $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64SA) + (unimp cm64sa) + ()) + +(dni cm64sd "Counter Manager 64-bit Saturating Decrement" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "cm64sd $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64SD) + (unimp cm64sd) + ()) + +(dni cm64si "Counter Manager 64-bit Saturating Increment" (MACH10 EVEN-REG-NUM USES-RT USES-RD) + "cm64si $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64SI) + (unimp cm64si) + ()) + +(dni cm64sia2 "Counter Manager 32/32 Saturating Increment/Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm64sia2 $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64SIA2) + (unimp cm64sia2) + ()) + +(dni cm64ss "Counter Manager 64-bit Saturating Subtract" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm64ss $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM64SS) + (unimp cm64ss) + ()) + +(dni cm128ria2 "Counter Manager 128-bit 64/64 Rolling Increment/Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm128ria2 $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128RIA2) + (unimp cm128ria2) + ()) + +(dni cm128ria3 "Counter Manager 128-bit 32/32/64 Rolling Increment/Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm128ria3 $rd,$rs,$rt,${cm-3z}" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128RIA3 cm-3z) + (unimp cm128ria3) + ()) + +(dni cm128ria4 "Counter Manager 128-bit 32/32/32/32 Rolling Inc/Add" (MACH10 USES-RS USES-RT USES-RD) + "cm128ria4 $rd,$rs,$rt,${cm-4z}" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128RIA4 cm-4z) + (unimp cm128ria4) + ()) + +(dni cm128sia2 "Counter Manager 128-bit 64/64 Saturating Inc/Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm128sia2 $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128SIA2) + (unimp cm128sia2) + ()) + +(dni cm128sia3 "Counter Manager 128-bit 32/32/64 Saturating Inc/Add" (MACH10 EVEN-REG-NUM USES-RS USES-RT USES-RD) + "cm128sia3 $rd,$rs,$rt,${cm-3z}" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128SIA3 cm-3z) + (unimp cm128sia3) + ()) + +(dni cm128sia4 "Counter Manager 128-bit 32/32/32/32 Saturating Inc/Add" (MACH10 USES-RS USES-RT USES-RD) + "cm128sia4 $rd,$rs,$rt,${cm-4z}" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128SIA4 cm-4z) + (unimp cm128sia4) + ()) + +(dni cm128vsa "Counter Manager Continuous State Dual Leaky Token Bucket Policing" (MACH10 USES-RS USES-RT USES-RD) + "cm128vsa $rd,$rs,$rt" + (+ OP_COP3 rs rt rd (f-cp-op 0) (f-cp-grp 2) FUNC10_CM128VSA) + (unimp cm128vsa) + ()) + +; Coprocessor Data Movement Instructions + +; Note that we don't set the USES-RD or USES-RT attributes for many of the following +; instructions, as it's the COP register that's being specified. + +; ??? Is YIELD-INSN the right attribute for IQ10? The IQ2000 used the attribute to warn about +; yielding instructions in a delay slot, but that's not relevant in IQ10. What *is* relevant +; (and unique to IQ10) is instructions that yield if the destination register is accessed +; before the value is there, causing a yield. + +(dni cfc "copy from coprocessor control register" (MACH10 LOAD-DELAY USES-RD YIELD-INSN) + "cfc $rd,$rt" + (+ OP_COP3 (f-rs 0) rt rd (f-shamt 0) FUNC10_CFC) + (unimp cfc) + ()) + +(dni ctc "copy to coprocessor control register" (MACH10 USES-RS) + "ctc $rs,$rt" + (+ OP_COP3 rs rt (f-rd 0) (f-shamt 0) FUNC10_CTC) + (unimp ctc) + ()) + +; Macros + +(dnmi m-avail "Mark Header Buffer Available" (MACH10 NO-DIS) + "avail" + (emit avail (f-rd 0)) +) + +(dnmi m-cam36 "CAM Access in 36-bit Mode" (MACH10 USES-RT USES-RD NO-DIS) + "cam36 $rd,$rt,${cam-z}" + (emit cam36 rd rt cam-z (f-cam-y 0)) +) + +(dnmi m-cam72 "CAM Access in 72-bit Mode" (MACH10 USES-RT USES-RD NO-DIS) + "cam72 $rd,$rt,${cam-z}" + (emit cam72 rd rt cam-z (f-cam-y 0)) +) + +(dnmi m-cam144 "CAM Access in 144-bit Mode" (MACH10 USES-RT USES-RD NO-DIS) + "cam144 $rd,$rt,${cam-z}" + (emit cam144 rd rt cam-z (f-cam-y 0)) +) + +(dnmi m-cam288 "CAM Access in 288-bit Mode" (MACH10 USES-RT USES-RD NO-DIS) + "cam288 $rd,$rt,${cam-z}" + (emit cam288 rd rt cam-z (f-cam-y 0)) +) + +(dnmi m-cm32read "Counter Manager 32-bit Rolling Add R0" (MACH10 USES-RT USES-RD NO-DIS) + "cm32read $rd,$rt" + (emit cm32ra rd (f-rs 0) rt) +) + +(dnmi m-cm64read "Counter Manager 64-bit Rolling Add R0" (MACH10 USES-RT USES-RD NO-DIS) + "cm64read $rd,$rt" + (emit cm64ra rd (f-rs 0) rt) +) + +(dnmi m-cm32mlog "Counter Manager 32-bit or R0" (MACH10 USES-RS USES-RT NO-DIS) + "cm32mlog $rs,$rt" + (emit cm32or (f-rd 0) rs rt) +) + +(dnmi m-cm32and "Counter Manager And" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32and $rs,$rt" + (emit cm32and (f-rd 0) rs rt) +) + +(dnmi m-cm32andn "Counter Manager And With Inverse" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32andn $rs,$rt" + (emit cm32andn (f-rd 0) rs rt) +) + +(dnmi m-cm32or "Counter Manager Or" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32or $rs,$rt" + (emit cm32or (f-rd 0) rs rt) +) + +(dnmi m-cm32ra "Counter Manager 32-bit Rolling Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32ra $rs,$rt" + (emit cm32ra (f-rd 0) rs rt) +) + +(dnmi m-cm32rd "Counter Manager 32-bit Rolling Decrement" (MACH10 USES-RT USES-RD NO-DIS) + "cm32rd $rt" + (emit cm32rd (f-rd 0) rt) +) + +(dnmi m-cm32ri "Counter Manager 32-bit Rolling Increment" (MACH10 USES-RT USES-RD NO-DIS) + "cm32ri $rt" + (emit cm32ri (f-rd 0) rt) +) + +(dnmi m-cm32rs "Counter Manager 32-bit Rolling Subtract" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32rs $rs,$rt" + (emit cm32rs (f-rd 0) rs rt) +) + +(dnmi m-cm32sa "Counter Manager 32-bit Saturating Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32sa $rs,$rt" + (emit cm32sa (f-rd 0) rs rt) +) + +(dnmi m-cm32sd "Counter Manager 32-bit Saturating Decrement" (MACH10 USES-RT USES-RD NO-DIS) + "cm32sd $rt" + (emit cm32sd (f-rd 0) rt) +) + +(dnmi m-cm32si "Counter Manager 32-bit Saturating Increment" (MACH10 USES-RT USES-RD NO-DIS) + "cm32si $rt" + (emit cm32si (f-rd 0) rt) +) + +(dnmi m-cm32ss "Counter Manager 32-bit Saturating Subtract" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32ss $rs,$rt" + (emit cm32ss (f-rd 0) rs rt) +) + +(dnmi m-cm32xor "Counter Manager Xor" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm32xor $rs,$rt" + (emit cm32xor (f-rd 0) rs rt) +) + +(dnmi m-cm64clr "Counter Manager Clear" (MACH10 USES-RT USES-RD NO-DIS) + "cm64clr $rt" + (emit cm64clr (f-rd 0) rt) +) + +(dnmi m-cm64ra "Counter Manager 64-bit Rolling Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm64ra $rs,$rt" + (emit cm64ra (f-rd 0) rs rt) +) + +(dnmi m-cm64rd "Counter Manager 64-bit Rolling Decrement" (MACH10 USES-RT USES-RD NO-DIS) + "cm64rd $rt" + (emit cm64rd (f-rd 0) rt) +) + +(dnmi m-cm64ri "Counter Manager 32-bit Rolling Increment" (MACH10 USES-RT USES-RD NO-DIS) + "cm64ri $rt" + (emit cm64ri (f-rd 0) rt) +) + +(dnmi m-cm64ria2 "Counter Manager 32/32 Rolling Increment/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm64ria2 $rs,$rt" + (emit cm64ria2 (f-rd 0) rs rt) +) + +(dnmi m-cm64rs "Counter Manager 64-bit Rolling Subtract" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm64rs $rs,$rt" + (emit cm64rs (f-rd 0) rs rt) +) + +(dnmi m-cm64sa "Counter Manager 64-bit Saturating Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm64sa $rs,$rt" + (emit cm64sa (f-rd 0) rs rt) +) + +(dnmi m-cm64sd "Counter Manager 64-bit Saturating Decrement" (MACH10 USES-RT USES-RD NO-DIS) + "cm64sd $rt" + (emit cm64sd (f-rd 0) rt) +) + +(dnmi m-cm64si "Counter Manager 64-bit Saturating Increment" (MACH10 USES-RT USES-RD NO-DIS) + "cm64si $rt" + (emit cm64si (f-rd 0) rt) +) + +(dnmi m-cm64sia2 "Counter Manager 32/32 Saturating Increment/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm64sia2 $rs,$rt" + (emit cm64sia2 (f-rd 0) rs rt) +) + +(dnmi m-cm64ss "Counter Manager 64-bit Saturating Subtract" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm64ss $rs,$rt" + (emit cm64ss (f-rd 0) rs rt) +) + +(dnmi m-cm128ria2 "Counter Manager 128-bit 64/64 Rolling Increment/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm128ria2 $rs,$rt" + (emit cm128ria2 (f-rd 0) rs rt) +) + +(dnmi m-cm128ria3 "Counter Manager 128-bit 32/32/64 Rolling Increment/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm128ria3 $rs,$rt,${cm-3z}" + (emit cm128ria3 (f-rd 0) rs rt cm-3z) +) + +(dnmi m-cm128ria4 "Counter Manager 128-bit 32/32/32/32 Rolling Inc/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm128ria4 $rs,$rt,${cm-4z}" + (emit cm128ria4 (f-rd 0) rs rt cm-4z) +) + +(dnmi m-cm128sia2 "Counter Manager 128-bit 64/64 Saturating Inc/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm128sia2 $rs,$rt" + (emit cm128sia2 (f-rd 0) rs rt) +) + +(dnmi m-cm128sia3 "Counter Manager 128-bit 32/32/64 Saturating Inc/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm128sia3 $rs,$rt,${cm-3z}" + (emit cm128sia3 (f-rd 0) rs rt cm-3z) +) + +(dnmi m-cm128sia4 "Counter Manager 128-bit 32/32/32/32 Saturating Inc/Add" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "cm128sia4 $rs,$rt,${cm-4z}" + (emit cm128sia4 (f-rd 0) rs rt cm-4z) +) + +(dnmi m-cmphdr "Get a Complete Header" (MACH10 NO-DIS) + "cmphdr" + (emit cmphdr (f-rd 0)) +) + +(dnmi m-dbd "Deallocate a Data Buffer Pointer" (MACH10 USES-RD USES-RT NO-DIS) + "dbd $rd,$rt" + (emit dbd rd (f-rs 0) rt) +) + +(dnmi m2-dbd "Deallocate a Data Buffer Pointer" (MACH10 USES-RT NO-DIS) + "dbd $rt" + (emit dbd (f-rd 0) (f-rs 0) rt) +) + +(dnmi m-dpwt "DSTN_PORT Write" (MACH10 USES-RS NO-DIS) + "dpwt $rs" + (emit dpwt (f-rd 0) rs) +) + +(dnmi m-free "" (MACH10 USES-RS USES-RD NO-DIS) + "free $rs" + (emit free (f-rd 0) rs) +) + +;(dnmi m-jal "jump and link, implied r31" (MACH10 USES-RT NO-DIS) +; "jal $jmptarg" +; (emit jal (f-rt 31) jmptarg) +;) + +(dnmi m-lock "lock memory" (MACH10 USES-RT NO-DIS) + "lock $rt" + (emit lock (f-rd 0) rt) +) + +(dnmi m-pkrla "Packet Release Absolute" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "pkrla $rs,$rt" + (emit pkrla (f-rd 0) rs rt) +) + +(dnmi m-pkrlac "Packet Release Absolute Continue" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "pkrlac $rs,$rt" + (emit pkrlac (f-rd 0) rs rt) +) + +(dnmi m-pkrlah "Packet Release Absolute and Hold" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "pkrlah $rs,$rt" + (emit pkrlah (f-rd 0) rs rt) +) + +(dnmi m-pkrlau "Packet Release Absolute Unconditional" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "pkrlau $rs,$rt" + (emit pkrlau (f-rd 0) rs rt) +) + +(dnmi m-pkrli "Packet Release Immediate" (MACH10 USES-RD USES-RS USES-RT NO-DIS) + "pkrli $rs,$rt,$bytecount" + (emit pkrli (f-rd 0) rs rt bytecount) +) + +(dnmi m-pkrlic "Packet Release Immediate Continue" (MACH10 USES-RS USES-RT NO-DIS) + "pkrlic $rs,$rt,$bytecount" + (emit pkrlic (f-rd 0) rs rt bytecount) +) + +(dnmi m-pkrlih "Packet Release Immediate and Hold" (MACH10 USES-RD USES-RS USES-RT NO-DIS) + "pkrlih $rs,$rt,$bytecount" + (emit pkrlih (f-rd 0) rs rt bytecount) +) + +(dnmi m-pkrliu "Packet Release Immediate Unconditional" (MACH10 USES-RD USES-RS USES-RT NO-DIS) + "pkrliu $rs,$rt,$bytecount" + (emit pkrliu (f-rd 0) rs rt bytecount) +) + +(dnmi m-rba "Read Bytes Absolute" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "rba $rs,$rt" + (emit rba (f-rd 0) rs rt) +) + +(dnmi m-rbal "Read Bytes Absolute and Lock" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "rbal $rs,$rt" + (emit rbal (f-rd 0) rs rt) +) + +(dnmi m-rbar "Read Bytes Absolute and Release" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "rbar $rs,$rt" + (emit rbar (f-rd 0) rs rt) +) + +(dnmi m-rbi "Read Bytes Immediate" (MACH10 USES-RS USES-RT NO-DIS) + "rbi $rs,$rt,$bytecount" + (emit rbi (f-rd 0) rs rt bytecount) +) + +(dnmi m-rbil "Read Bytes Immediate and Lock" (MACH10 USES-RS USES-RT NO-DIS) + "rbil $rs,$rt,$bytecount" + (emit rbil (f-rd 0) rs rt bytecount) +) + +(dnmi m-rbir "Read Bytes Immediate and Release" (MACH10 USES-RS USES-RT NO-DIS) + "rbir $rs,$rt,$bytecount" + (emit rbir (f-rd 0) rs rt bytecount) +) + +(dnmi m-swwr "Single Word Write" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "swwr $rs,$rt" + (emit swwr (f-rd 0) rs rt) +) + +(dnmi m-swwru "Single Word Write and Unlock" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "swwru $rs,$rt" + (emit swwru (f-rd 0) rs rt) +) + +(dnmi m-tstod "Test Header Buffer Order Dependency" (MACH10 USES-RS USES-RD NO-DIS) + "tstod $rs" + (emit tstod (f-rd 0) rs) +) + +(dnmi m-unlk "" (MACH10 USES-RT USES-RD NO-DIS) + "unlk $rt" + (emit unlk (f-rd 0) rt) +) + +(dnmi m-wba "Write Bytes Absolute" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "wba $rs,$rt" + (emit wba (f-rd 0) rs rt) +) + +(dnmi m-wbac "Write Bytes Absolute Cacheable" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "wbac $rs,$rt" + (emit wbac (f-rd 0) rs rt) +) + +(dnmi m-wbau "Write Bytes Absolute and Unlock" (MACH10 USES-RS USES-RT USES-RD NO-DIS) + "wbau $rs,$rt" + (emit wbau (f-rd 0) rs rt) +) + +(dnmi m-wbi "Write Bytes Immediate" (MACH10 USES-RD USES-RS USES-RT NO-DIS) + "wbi $rs,$rt,$bytecount" + (emit wbi (f-rd 0) rs rt bytecount) +) + +(dnmi m-wbic "Write Bytes Immediate Cacheable" (MACH10 USES-RD USES-RS USES-RT NO-DIS) + "wbic $rs,$rt,$bytecount" + (emit wbic (f-rd 0) rs rt bytecount) +) + +(dnmi m-wbiu "Write Bytes Immediate" (MACH10 USES-RD USES-RS USES-RT NO-DIS) + "wbiu $rs,$rt,$bytecount" + (emit wbiu (f-rd 0) rs rt bytecount) +) + diff --git a/cpu/iq2000.cpu b/cpu/iq2000.cpu new file mode 100644 index 0000000000000..2a34859af8e42 --- /dev/null +++ b/cpu/iq2000.cpu @@ -0,0 +1,1199 @@ +; IQ2000/IQ10 Common CPU description. -*- Scheme -*- +; +; Copyright 2000, 2001, 2002 Free Software Foundation, Inc. +; +; Contributed by Red Hat Inc; developed under contract from Vitesse. +; +; This file is part of the GNU Binutils. +; +; This program is free software; 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. + +(include "simplify.inc") + +(define-arch + (name iq2000) + (comment "IQ2000 architecture") + (insn-lsb0? #t) + (machs iq2000 iq10) + (isas iq2000) +) + +(define-isa + (name iq2000) + (comment "Basic IQ2000 instruction set") + (default-insn-word-bitsize 32) + (default-insn-bitsize 32) + (base-insn-bitsize 32) + (decode-assist (31 30 29 28 27 26)) +) + +(define-cpu + (name iq2000bf) + (comment "IQ2000 family") + (endian big) + (word-bitsize 32) + (file-transform "") +) + +(define-cpu + (name iq10bf) + (comment "IQ10 coprocessor family") + (endian big) + (word-bitsize 32) + (file-transform "") + +) + +(define-mach + (name iq2000) + (comment "IQ2000 packet processing engine") + (cpu iq2000bf) + (isas iq2000) +) + +(define-mach + (name iq10) + (comment "IQ10 coprocessor") + (cpu iq10bf) + (isas iq2000) +) + +(define-model + (name iq2000) + (comment "IQ2000 microprocessor") + (mach iq2000) + (unit u-exec "Execution Unit" () + 1 1 ; issue done + () () () ()) +) + +(define-model + (name iq10) + (comment "IQ10 coprocessor") + (mach iq10) + (unit u-exec "Execution Unit" () + 1 1 ; issue done + () () () ()) +) + +; Macros to simplify MACH attribute specification. + +(define-pmacro MACH2000 (MACH iq2000)) +(define-pmacro MACH10 (MACH iq10)) + + +; Hardware elements. + +(define-hardware + (name h-pc) + (comment "program counter") + (attrs PC PROFILE (ISA iq2000)) + (type pc) + (get () (c-call USI "get_h_pc")) + (set (newval) (c-call VOID "set_h_pc" newval)) +) +; FIXME: it would be nice if the hardwired zero in R0 could be +; specified as a virtual hardware element, with one less register in +; the register file proper. + +(define-keyword + (name gr-names) + (print-name h-gr) + (values (r0 0) (%0 0) (r1 1) (%1 1) (r2 2) (%2 2) (r3 3) (%3 3) + (r4 4) (%4 4) (r5 5) (%5 5) (r6 6) (%6 6) (r7 7) (%7 7) + (r8 8) (%8 8) (r9 9) (%9 9) (r10 10) (%10 10) (r11 11) (%11 11) + (r12 12) (%12 12) (r13 13) (%13 13) (r14 14) (%14 14) (r15 15) (%15 15) + (r16 16) (%16 16) (r17 17) (%17 17) (r18 18) (%18 18) (r19 19) (%19 19) + (r20 20) (%20 20) (r21 21) (%21 21) (r22 22) (%22 22) (r23 23) (%23 23) + (r24 24) (%24 24) (r25 25) (%25 25) (r26 26) (%26 26) (r27 27) (%27 27) + (r28 28) (%28 28) (r29 29) (%29 29) (r30 30) (%30 30) (r31 31) (%31 31)) +) + +(define-hardware + (name h-gr) + (comment "General purpose registers") +; (attrs (ISA iq2000) CACHE-ADDR) + (type register SI (32)) + (indices extern-keyword gr-names) + (get (idx) + (cond SI + ((eq idx 0) (const 0)) + (else (raw-reg h-gr idx)))) + (set (idx newval) + (cond VOID + ((eq idx 0) (nop)) + (else (set (raw-reg h-gr idx) newval)))) +) + + +; Instruction fields. + +(dnf f-opcode "opcode field" () 31 6) +(dnf f-rs "register field Rs" () 25 5) +(dnf f-rt "register field Rt" () 20 5) +(dnf f-rd "register field Rd" () 15 5) +(dnf f-shamt "shift amount field" () 10 5) +(dnf f-cp-op "coprocessor op field" () 10 3) +(dnf f-cp-op-10 "coprocessor op field for CAM" () 10 5) +(dnf f-cp-grp "coprocessor group field" () 7 2) +(dnf f-func "function field" () 5 6) +(dnf f-imm "immediate field" () 15 16) + +(define-multi-ifield + (name f-rd-rs) + (comment "register Rd implied from Rs") + (attrs) + (mode UINT) + (subfields f-rd f-rs) + (insert (sequence () + (set (ifield f-rd) (ifield f-rd-rs)) + (set (ifield f-rs) (ifield f-rd-rs)) + )) + (extract (sequence () + (set (ifield f-rd-rs) (ifield f-rs)) + )) +) + +(define-multi-ifield + (name f-rd-rt) + (comment "register Rd implied from Rt") + (attrs) + (mode UINT) + (subfields f-rd f-rt) + (insert (sequence () + (set (ifield f-rd) (ifield f-rd-rt)) + (set (ifield f-rt) (ifield f-rd-rt)) + )) + (extract (sequence () + (set (ifield f-rd-rt) (ifield f-rt)) + )) +) + +(define-multi-ifield + (name f-rt-rs) + (comment "register Rt implied from Rs") + (attrs) + (mode UINT) + (subfields f-rt f-rs) + (insert (sequence () + (set (ifield f-rt) (ifield f-rt-rs)) + (set (ifield f-rs) (ifield f-rt-rs)) + )) + (extract (sequence () + (set (ifield f-rd-rs) (ifield f-rs)) + )) +) + +(df f-jtarg "jump target field" (ABS-ADDR) 15 16 UINT + ((value pc) (srl USI (and USI value #x03FFFF) 2)) + ((value pc) (or USI (and USI pc #xF0000000) (sll USI value 2)))) + +(df f-jtargq10 "iq10 jump target field" (ABS-ADDR) 20 21 UINT + ((value pc) (srl SI (and SI value #x7FFFFF) 2)) + ((value pc) (or SI (and SI pc #xF0000000) (sll SI value 2)))) + +(df f-offset "pc offset field" (PCREL-ADDR) 15 16 INT + ; Actually, this is relative to the address of the delay slot. + ((value pc) (sra SI (sub SI value pc) 2)) + ((value pc) (add SI (sll SI value 2) (add pc 4)))) + +; Instruction fields that scarcely appear in instructions. + +(dnf f-count "count field" () 15 7) +(dnf f-bytecount "byte count field" () 7 8) +(dnf f-index "index field" () 8 9) +(dnf f-mask "mask field" () 9 4) +(dnf f-maskq10 "iq10 mask field" () 10 5) +(dnf f-maskl "mask left field" () 4 5) +(dnf f-excode "execcode field" () 25 20) +(dnf f-rsrvd "reserved field" () 25 10) +(dnf f-10-11 "bits 10:0" () 10 11) +(dnf f-24-19 "bits 24:6" () 24 19) +(dnf f-5 "bit 5" () 5 1) +(dnf f-10 "bit 10" () 10 1) +(dnf f-25 "bit 25" () 25 1) +(dnf f-cam-z "cam global mask z" () 5 3) +(dnf f-cam-y "cam operation y" () 2 3) +(dnf f-cm-3func "CM 3 bit fn field" () 5 3) +(dnf f-cm-4func "CM 4 bit fn field" () 5 4) +(dnf f-cm-3z "CM 3Z field" () 1 2) +(dnf f-cm-4z "CM 4Z field" () 2 3) + + +; Enumerations. + +(define-normal-insn-enum + opcodes "primary opcodes" () OP_ f-opcode + (("SPECIAL" 0) ("REGIMM" 1) ("J" 2) ("JAL" 3) ("BEQ" 4) ("BNE" 5) ("BLEZ" 6) ("BGTZ" 7) + ("ADDI" 8) ("ADDIU" 9) ("SLTI" 10) ("SLTIU" 11) ("ANDI" 12) ("ORI" 13) ("XORI" 14) ("LUI" 15) + ("COP0" 16) ("COP1" 17) ("COP2" 18) ("COP3" 19) ("BEQL" 20) ("BNEL" 21) ("BLEZL" 22) ("BGTZL" 23) + ("BMB0" 24) ("BMB1" 25) ("BMB2" 26) ("BMB3" 27) ("BBI" 28) ("BBV" 29) ("BBIN" 30) ("BBVN" 31) + ("LB" 32) ("LH" 33) ("LW" 35) ("LBU" 36) ("LHU" 37) ("RAM" 39) + ("SB" 40) ("SH" 41) ("SW" 43) ("ANDOI" 44) ("BMB" 45) ("ORUI" 47) + ("LDW" 48) + ("SDW" 56) ("ANDOUI" 63)) +) + +(define-normal-insn-enum + q10_opcodes "iq10-only primary opcodes" () OP10_ f-opcode + (("BMB" 6) ("ORUI" 15) ("BMBL" 22) ("ANDOUI" 47) ("BBIL" 60) ("BBVL" 61) ("BBINL" 62) ("BBVNL" 63)) +) + +(define-normal-insn-enum + regimm-functions "branch sub-opcodes" () FUNC_ f-rt + (("BLTZ" 0) ("BGEZ" 1) ("BLTZL" 2) ("BGEZL" 3) ("BLEZ" 4) ("BGTZ" 5) ("BLEZL" 6) ("BGTZL" 7) + ("BRI" 8) ("BRV" 9) ("BCTX" 12) + ("BLTZAL" 16) ("BGEZAL" 17) ("BLTZALL" 18) ("BGEZALL" 19) ("BLEZAL" 20) ("BGTZAL" 21) ("BLEZALL" 22) ("BGTZALL" 23)) +) + +(define-normal-insn-enum + functions "function sub-opcodes" () FUNC_ f-func + (("SLL" 0) ("SLMV" 1) ("SRL" 2) ("SRA" 3) ("SLLV" 4) ("SRMV" 5) ("SRLV" 6) ("SRAV" 7) + ("JR" 8) ("JALR" 9) ("JCR" 10) ("SYSCALL" 12) ("BREAK" 13) ("SLEEP" 14) + ("ADD" 32) ("ADDU" 33) ("SUB" 34) ("SUBU" 35) ("AND" 36) ("OR" 37) ("XOR" 38) ("NOR" 39) + ("ADO16" 41) ("SLT" 42) ("SLTU" 43) ("MRGB" 45)) +) + +; iq10 special function sub-opcodes +(define-normal-insn-enum + q10s_functions "iq10-only special function sub-opcodes" () FUNC10_ f-func + (("YIELD" 14) ("CNT1S" 46)) +) + +; coprocessor opcodes in concert with f-cp-grp +(define-normal-insn-enum + cop_functions "iq10 function sub-opcodes" () FUNC10_ f-func + (("CFC" 0) ("LOCK" 1) ("CTC" 2) ("UNLK" 3) ("SWRD" 4) ("SWRDL" 5) ("SWWR" 6) ("SWWRU" 7) + ("RBA" 8) ("RBAL" 9) ("RBAR" 10) ("DWRD" 12) ("DWRDL" 13) + ("WBA" 16) ("WBAU" 17) ("WBAC" 18) ("CRC32" 20) ("CRC32B" 21) + ("MCID" 32) ("DBD" 33) ("DBA" 34) ("DPWT" 35) ("AVAIL" 36) ("FREE" 37) ("CHKHDR" 38) ("TSTOD" 39) + ("PKRLA" 40) ("PKRLAU" 41) ("PKRLAH" 42) ("PKRLAC" 43) ("CMPHDR" 44) + + ("CM64RS" 0) ("CM64RD" 1) ("CM64RI" 4) ("CM64CLR" 5) + ("CM64SS" 8) ("CM64SD" 9) ("CM64SI" 12) + ("CM64RA" 16) ("CM64RIA2" 20) ("CM128RIA2" 21) + ("CM64SA" 24) ("CM64SIA2" 28) ("CM128SIA2" 29) + ("CM32RS" 32) ("CM32RD" 33) ("CM32XOR" 34) ("CM32ANDN" 35) ("CM32RI" 36) ("CM128VSA" 38) + ("CM32SS" 40) ("CM32SD" 41) ("CM32OR" 42) ("CM32AND" 43) ("CM32SI" 44) + ("CM32RA" 48) + ("CM32SA" 56) ) +) + +; coprocessor opcodes in concert with f-cp-grp +(define-normal-insn-enum + cop_cm128_4functions "iq10 function sub-opcodes" () FUNC10_ f-cm-4func + (("CM128RIA3" 4) ("CM128SIA3" 6)) +) + +(define-normal-insn-enum + cop_cm128_3functions "iq10 function sub-opcodes" () FUNC10_ f-cm-3func + (("CM128RIA4" 6) ("CM128SIA4" 7)) +) + +(define-normal-insn-enum + cop2_functions "iq10 coprocessor sub-opcodes" () FUNC10_ f-cp-op + (("PKRLI" 0) ("PKRLIU" 1) ("PKRLIH" 2) ("PKRLIC" 3) ("RBIR" 1) ("RBI" 2) ("RBIL" 3) ("WBIC" 5) ("WBI" 6) ("WBIU" 7)) +) + +(define-normal-insn-enum + cop3_cam_functions "iq10 coprocessor cam sub-opcodes" () FUNC10_ f-cp-op-10 + (("CAM36" 16) ("CAM72" 17) ("CAM144" 18) ("CAM288" 19)) +) + + +; Attributes. + +(define-attr + (for insn) + (type boolean) + (name YIELD-INSN) + (comment "insn generates a context yield") +) + +(define-attr + (for insn) + (type boolean) + (name LOAD-DELAY) + (comment "insn has a load delay") +) + +(define-attr + (for insn) + (type boolean) + (name EVEN-REG-NUM) + (comment "insn requires an even numbered register in rt(2000) or rd(10)") +) + +(define-attr + (for insn) + (type boolean) + (name UNSUPPORTED) + (comment "insn is unsupported") +) + +(define-pmacro (define-reg-use-attr regfield) + (define-attr + (for insn) + (type boolean) + (name (.sym USES- (.upcase regfield))) + (comment ("insn accesses register operand " regfield)))) + +(define-reg-use-attr rd) +(define-reg-use-attr rs) +(define-reg-use-attr rt) +(define-reg-use-attr r31) + + +; Operands. + +(dnop rs "register Rs" () h-gr f-rs) +(dnop rt "register Rt" () h-gr f-rt) +(dnop rd "register Rd" () h-gr f-rd) +(dnop rd-rs "register Rd from Rs" () h-gr f-rd-rs) +(dnop rd-rt "register Rd from Rt" () h-gr f-rd-rt) +(dnop rt-rs "register Rt from Rs" () h-gr f-rt-rs) +(dnop shamt "shift amount" () h-uint f-shamt) +(define-operand (name imm) (comment "immediate") (attrs) + (type h-uint) (index f-imm) (handlers (parse "imm"))) +(dnop offset "pc-relative offset" () h-iaddr f-offset) +(dnop baseoff "base register offset" () h-iaddr f-imm) +(dnop jmptarg "jump target" () h-iaddr f-jtarg) +(dnop mask "mask" () h-uint f-mask) +(dnop maskq10 "iq10 mask" () h-uint f-maskq10) +(dnop maskl "mask left" () h-uint f-maskl) +(dnop count "count" () h-uint f-count) +(dnop index "index" () h-uint f-index) +(dnop execode "execcode" () h-uint f-excode) +(dnop bytecount "byte count" () h-uint f-bytecount) +(dnop cam-y "cam global opn y" () h-uint f-cam-y) +(dnop cam-z "cam global mask z" () h-uint f-cam-z) +(dnop cm-3func "CM 3 bit fn field" () h-uint f-cm-3func) +(dnop cm-4func "CM 4 bit fn field" () h-uint f-cm-4func) +(dnop cm-3z "CM 3 bit Z field" () h-uint f-cm-3z) +(dnop cm-4z "CM 4 bit Z field" () h-uint f-cm-4z) + +; Aliases for the rs and rt operands. This just makes the load/store +; insns easier to compare with the instruction set documentation. + +(dnop base "base register" () h-gr f-rs) +(dnop maskr "mask right" () h-uint f-rs) +(dnop bitnum "bit number" () h-uint f-rt) + +; For high(foo). +(define-operand + (name hi16) + (comment "high 16 bit immediate") + (attrs) + (type h-uint) + (index f-imm) + (handlers (parse "hi16")) +) + +; For low(foo). +(define-operand + (name lo16) + (comment "16 bit signed immediate, for low") + (attrs) + (type h-uint) + (index f-imm) + (handlers (parse "lo16")) +) + +; For negated imm. +(define-operand + (name mlo16) + (comment "negated 16 bit signed immediate") + (attrs) + (type h-uint) + (index f-imm) + (handlers (parse "mlo16")) +) + +; For iq10 jmps +; In the future, we'll want the j & jal to use the 21 bit target, with +; the upper five bits shifted up. For now, don't use this. +(define-operand + (name jmptargq10) + (comment "iq10 21-bit jump offset") + (attrs) + (type h-iaddr) + (index f-jtargq10) + (handlers (parse "jtargq10")) +) + + +; Instructions. + +; A pmacro for use in semantic bodies of unimplemented insns. +(define-pmacro (unimp mnemonic) (nop)) + +(define-pmacro (bitset? value bit-num) + (and value (sll 1 bit-num))) + +(define-pmacro (bitclear? value bit-num) + (not (bitset? value bit-num))) + +; Arithmetic/logic instructions. + +(dni add2 "add registers" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "add ${rd-rs},$rt" + (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_ADD) + (set rd-rs (add rt rd-rs)) + ()) + +(dni add "add registers" (USES-RD USES-RS USES-RT) + "add $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_ADD) + (set rd (add rs rt)) + ()) + + +(dni addi2 "add immediate" (ALIAS NO-DIS USES-RS USES-RT) + "addi ${rt-rs},$lo16" + (+ OP_ADDI rt-rs lo16) + (set rt-rs (add rt-rs (ext SI (trunc HI lo16)))) + ()) + +(dni addi "add immediate" (USES-RS USES-RT) + "addi $rt,$rs,$lo16" + (+ OP_ADDI rs rt lo16) + (set rt (add rs (ext SI (trunc HI lo16)))) + ()) + +(dni addiu2 "add immediate unsigned" (ALIAS NO-DIS USES-RS USES-RT) + "addiu ${rt-rs},$lo16" + (+ OP_ADDIU rt-rs lo16) + (set rt-rs (add rt-rs (ext SI (trunc HI lo16)))) + ()) + +(dni addiu "add immediate unsigned" (USES-RS USES-RT) + "addiu $rt,$rs,$lo16" + (+ OP_ADDIU rs rt lo16) + (set rt (add rs (ext SI (trunc HI lo16)))) + ()) + +(dni addu2 "add unsigned" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "addu ${rd-rs},$rt" + (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_ADDU) + (set rd-rs (add rd-rs rt)) + ()) + +(dni addu "add unsigned" (USES-RD USES-RS USES-RT) + "addu $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_ADDU) + (set rd (add rs rt)) + ()) + +(dni ado162 "add 16, ones complement" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "ado16 ${rd-rs},$rt" + (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_ADO16) + (sequence ((HI high) (HI low)) + (set low (add HI (and HI rd-rs #xFFFF) (and HI rt #xFFFF))) + (set high (add HI (srl rd-rs 16) (srl rt 16))) + (set rd-rs (or SI (sll SI high 16) low))) + ()) + +(dni ado16 "add 16, ones complement" (USES-RD USES-RS USES-RT) + "ado16 $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_ADO16) + (sequence ((HI high) (HI low)) + (set low (add HI (and HI rs #xFFFF) (and HI rt #xFFFF))) + (set high (add HI (srl rs 16) (srl rt 16))) + (set rd (or SI (sll SI high 16) low))) + ()) + +(dni and2 "and register" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "and ${rd-rs},$rt" + (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_AND) + (set rd-rs (and rd-rs rt)) + ()) + +(dni and "and register" (USES-RD USES-RS USES-RT) + "and $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_AND) + (set rd (and rs rt)) + ()) + +(dni andi2 "and immediate" (ALIAS NO-DIS USES-RS USES-RT) + "andi ${rt-rs},$lo16" + (+ OP_ANDI rt-rs lo16) + (set rt-rs (and rt-rs (zext SI lo16))) + ()) + +(dni andi "and immediate" (USES-RS USES-RT) + "andi $rt,$rs,$lo16" + (+ OP_ANDI rs rt lo16) + (set rt (and rs (zext SI lo16))) + ()) + +(dni andoi2 "and ones immediate" (ALIAS NO-DIS USES-RS USES-RT) + "andoi ${rt-rs},$lo16" + (+ OP_ANDOI rt-rs lo16) + (set rt-rs (and rt-rs (or #xFFFF0000 (ext SI (trunc HI lo16))))) + ()) + +(dni andoi "and ones immediate" (USES-RS USES-RT) + "andoi $rt,$rs,$lo16" + (+ OP_ANDOI rs rt lo16) + (set rt (and rs (or #xFFFF0000 (ext SI (trunc HI lo16))))) + ()) + +(dni nor2 "nor" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "nor ${rd-rs},$rt" + (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_NOR) + (set rd-rs (inv (or rd-rs rt))) + ()) + +(dni nor "nor" (USES-RD USES-RS USES-RT) + "nor $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_NOR) + (set rd (inv (or rs rt))) + ()) + +(dni or2 "or" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "or ${rd-rs},$rt" + (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_OR) + (set rd-rs (or rd-rs rt)) + ()) + +(dni or "or" (USES-RD USES-RS USES-RT) + "or $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_OR) + (set rd (or rs rt)) + ()) + +(dni ori2 "or immediate" (ALIAS NO-DIS USES-RS USES-RT) + "ori ${rt-rs},$lo16" + (+ OP_ORI rt-rs lo16) + (set rt-rs (or rt-rs (zext SI lo16))) + ()) + +(dni ori "or immediate" (USES-RS USES-RT) + "ori $rt,$rs,$lo16" + (+ OP_ORI rs rt lo16) + (set rt (or rs (zext SI lo16))) + ()) + +(dni ram "rotate and mask" (USES-RD USES-RT) + "ram $rd,$rt,$shamt,$maskl,$maskr" + (+ OP_RAM maskr rt rd shamt (f-5 0) maskl) + (sequence () + (set rd (ror rt shamt)) + (set rd (and rd (srl #xFFFFFFFF maskl))) + (set rd (and rd (sll #xFFFFFFFF maskr)))) + ()) + +(dni sll "shift left logical" (USES-RD USES-RT) + "sll $rd,$rt,$shamt" + (+ OP_SPECIAL (f-rs 0) rt rd shamt (f-func 0)) + (set rd (sll rt shamt)) + ()) + +(dni sllv2 "shift left logical variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "sllv ${rd-rt},$rs" + (+ OP_SPECIAL rs rd-rt (f-shamt 0) FUNC_SLLV) + (set rd-rt (sll rd-rt (and rs #x1F))) + ()) + +(dni sllv "shift left logical variable" (USES-RD USES-RS USES-RT) + "sllv $rd,$rt,$rs" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SLLV) + (set rd (sll rt (and rs #x1F))) + ()) + +(dni slmv2 "shift left and mask variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "slmv ${rd-rt},$rs,$shamt" + (+ OP_SPECIAL rs rd-rt shamt FUNC_SLMV) + (set rd-rt (and (sll rd-rt shamt) (srl #xFFFFFFFF rs))) + ()) + +(dni slmv "shift left and mask variable" (USES-RD USES-RS USES-RT) + "slmv $rd,$rt,$rs,$shamt" + (+ OP_SPECIAL rs rt rd shamt FUNC_SLMV) + (set rd (and (sll rt shamt) (srl #xFFFFFFFF rs))) + ()) + +(dni slt2 "set if less than" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "slt ${rd-rs},$rt" + (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_SLT) + (if (lt rd-rs rt) + (set rd-rs 1) + (set rd-rs 0)) + ()) + +(dni slt "set if less than" (USES-RD USES-RS USES-RT) + "slt $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SLT) + (if (lt rs rt) + (set rd 1) + (set rd 0)) + ()) + +(dni slti2 "set if less than immediate" (ALIAS NO-DIS USES-RS USES-RT) + "slti ${rt-rs},$imm" + (+ OP_SLTI rt-rs imm) + (if (lt rt-rs (ext SI (trunc HI imm))) + (set rt-rs 1) + (set rt-rs 0)) + ()) + +(dni slti "set if less than immediate" (USES-RS USES-RT) + "slti $rt,$rs,$imm" + (+ OP_SLTI rs rt imm) + (if (lt rs (ext SI (trunc HI imm))) + (set rt 1) + (set rt 0)) + ()) + +(dni sltiu2 "set if less than immediate unsigned" (ALIAS NO-DIS USES-RS USES-RT) + "sltiu ${rt-rs},$imm" + (+ OP_SLTIU rt-rs imm) + (if (ltu rt-rs (ext SI (trunc HI imm))) + (set rt-rs 1) + (set rt-rs 0)) + ()) + +(dni sltiu "set if less than immediate unsigned" (USES-RS USES-RT) + "sltiu $rt,$rs,$imm" + (+ OP_SLTIU rs rt imm) + (if (ltu rs (ext SI (trunc HI imm))) + (set rt 1) + (set rt 0)) + ()) + +(dni sltu2 "set if less than unsigned" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "sltu ${rd-rs},$rt" + (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_SLTU) + (if (ltu rd-rs rt) + (set rd-rs 1) + (set rd-rs 0)) + ()) + +(dni sltu "set if less than unsigned" (USES-RD USES-RS USES-RT) + "sltu $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SLTU) + (if (ltu rs rt) + (set rd 1) + (set rd 0)) + ()) + +(dni sra2 "shift right arithmetic" (ALIAS NO-DIS USES-RD USES-RT) + "sra ${rd-rt},$shamt" + (+ OP_SPECIAL (f-rs 0) rd-rt shamt FUNC_SRA) + (set rd-rt (sra rd-rt shamt)) + ()) + +(dni sra "shift right arithmetic" (USES-RD USES-RT) + "sra $rd,$rt,$shamt" + (+ OP_SPECIAL (f-rs 0) rt rd shamt FUNC_SRA) + (set rd (sra rt shamt)) + ()) + +(dni srav2 "shift right arithmetic variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "srav ${rd-rt},$rs" + (+ OP_SPECIAL rs rd-rt (f-shamt 0) FUNC_SRAV) + (set rd-rt (sra rd-rt (and rs #x1F))) + ()) + +(dni srav "shift right arithmetic variable" (USES-RD USES-RS USES-RT) + "srav $rd,$rt,$rs" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SRAV) + (set rd (sra rt (and rs #x1F))) + ()) + +(dni srl "shift right logical" (USES-RD USES-RT) + "srl $rd,$rt,$shamt" + (+ OP_SPECIAL (f-rs 0) rt rd shamt FUNC_SRL) + (set rd (srl rt shamt)) + ()) + +(dni srlv2 "shift right logical variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "srlv ${rd-rt},$rs" + (+ OP_SPECIAL rs rd-rt (f-shamt 0) FUNC_SRLV) + (set rd-rt (srl rd-rt (and rs #x1F))) + ()) + +(dni srlv "shift right logical variable" (USES-RD USES-RS USES-RT) + "srlv $rd,$rt,$rs" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SRLV) + (set rd (srl rt (and rs #x1F))) + ()) + +(dni srmv2 "shift right and mask variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "srmv ${rd-rt},$rs,$shamt" + (+ OP_SPECIAL rs rd-rt shamt FUNC_SRMV) + (set rd-rt (and (srl rd-rt shamt) (sll #xFFFFFFFF rs))) + ()) + +(dni srmv "shift right and mask variable" (USES-RD USES-RS USES-RT) + "srmv $rd,$rt,$rs,$shamt" + (+ OP_SPECIAL rs rt rd shamt FUNC_SRMV) + (set rd (and (srl rt shamt) (sll #xFFFFFFFF rs))) + ()) + +(dni sub2 "subtract" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "sub ${rd-rs},$rt" + (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_SUB) + (set rd-rs (sub rd-rs rt)) + ()) + +(dni sub "subtract" (USES-RD USES-RS USES-RT) + "sub $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SUB) + (set rd (sub rs rt)) + ()) + +(dni subu2 "subtract unsigned" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "subu ${rd-rs},$rt" + (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_SUBU) + (set rd-rs (sub rd-rs rt)) + ()) + +(dni subu "subtract unsigned" (USES-RD USES-RS USES-RT) + "subu $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SUBU) + (set rd (sub rs rt)) + ()) + +(dni xor2 "exclusive or" (ALIAS NO-DIS USES-RD USES-RS USES-RT) + "xor ${rd-rs},$rt" + (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_XOR) + (set rd-rs (xor rd-rs rt)) + ()) + +(dni xor "exclusive or" (USES-RD USES-RS USES-RT) + "xor $rd,$rs,$rt" + (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_XOR) + (set rd (xor rs rt)) + ()) + +(dni xori2 "exclusive or immediate" (ALIAS NO-DIS USES-RS USES-RT) + "xori ${rt-rs},$lo16" + (+ OP_XORI rt-rs lo16) + (set rt-rs (xor rt-rs (zext SI lo16))) + ()) + +(dni xori "exclusive or immediate" (USES-RS USES-RT) + "xori $rt,$rs,$lo16" + (+ OP_XORI rs rt lo16) + (set rt (xor rs (zext SI lo16))) + ()) + + +; Branch instructions. + +(dni bbi "branch bit immediate" (USES-RS) + "bbi $rs($bitnum),$offset" + (+ OP_BBI rs bitnum offset) + (if (bitset? rs bitnum) + (delay 1 (set pc offset))) + ()) + +(dni bbin "branch bit immediate negated" (USES-RS) + "bbin $rs($bitnum),$offset" + (+ OP_BBIN rs bitnum offset) + (if (bitclear? rs bitnum) + (delay 1 (set pc offset))) + ()) + +(dni bbv "branch bit variable" (USES-RS USES-RT) + "bbv $rs,$rt,$offset" + (+ OP_BBV rs rt offset) + (if (bitset? rs (and rt #x1F)) + (delay 1 (set pc offset))) + ()) + +(dni bbvn "branch bit variable negated" (USES-RS USES-RT) + "bbvn $rs,$rt,$offset" + (+ OP_BBVN rs rt offset) + (if (bitclear? rs (and rt #x1F)) + (delay 1 (set pc offset))) + ()) + +(dni beq "branch if equal" (USES-RS USES-RT) + "beq $rs,$rt,$offset" + (+ OP_BEQ rs rt offset) + (if (eq rs rt) + (delay 1 (set pc offset))) + ()) + +(dni beql "branch if equal likely" (USES-RS USES-RT) + "beql $rs,$rt,$offset" + (+ OP_BEQL rs rt offset) + (if (eq rs rt) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bgez "branch if greater than or equal to zero" (USES-RS) + "bgez $rs,$offset" + (+ OP_REGIMM rs FUNC_BGEZ offset) + (if (ge rs 0) + (delay 1 (set pc offset))) + ()) + +(dni bgezal "branch if greater than or equal to zero and link" (USES-RS USES-R31) + "bgezal $rs,$offset" + (+ OP_REGIMM rs FUNC_BGEZAL offset) + (if (ge rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset)))) + ()) + +(dni bgezall + "branch if greater than equal to zero and link likely" (USES-RS USES-R31) + "bgezall $rs,$offset" + (+ OP_REGIMM rs FUNC_BGEZALL offset) + (if (ge rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset))) + (skip 1)) + ()) + +(dni bgezl "branch if greater or equal to zero likely" (USES-RS) + "bgezl $rs,$offset" + (+ OP_REGIMM rs FUNC_BGEZL offset) + (if (ge rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bltz "branch if less than zero" (USES-RS) + "bltz $rs,$offset" + (+ OP_REGIMM rs FUNC_BLTZ offset) + (if (lt rs 0) + (delay 1 (set pc offset))) + ()) + +(dni bltzl "branch if less than zero likely" (USES-RS) + "bltzl $rs,$offset" + (+ OP_REGIMM rs FUNC_BLTZL offset) + (if (lt rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni bltzal "branch if less than zero and link" (USES-RS USES-R31) + "bltzal $rs,$offset" + (+ OP_REGIMM rs FUNC_BLTZAL offset) + (if (lt rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset)))) + ()) + +(dni bltzall "branch if less than zero and link likely" (USES-RS USES-R31) + "bltzall $rs,$offset" + (+ OP_REGIMM rs FUNC_BLTZALL offset) + (if (lt rs 0) + (sequence () + (set (reg h-gr 31) (add pc 8)) + (delay 1 (set pc offset))) + (skip 1)) + ()) + +(dni bmb0 "branch if matching byte-lane 0" (USES-RS USES-RT) + "bmb0 $rs,$rt,$offset" + (+ OP_BMB0 rs rt offset) + (if (eq (and rs #xFF) (and rt #xFF)) + (delay 1 (set pc offset))) + ()) + +(dni bmb1 "branch if matching byte-lane 1" (USES-RS USES-RT) + "bmb1 $rs,$rt,$offset" + (+ OP_BMB1 rs rt offset) + (if (eq (and rs #xFF00) (and rt #xFF00)) + (delay 1 (set pc offset))) + ()) + +(dni bmb2 "branch if matching byte-lane 2" (USES-RS USES-RT) + "bmb2 $rs,$rt,$offset" + (+ OP_BMB2 rs rt offset) + (if (eq (and rs #xFF0000) (and rt #xFF0000)) + (delay 1 (set pc offset))) + ()) + +(dni bmb3 "branch if matching byte-lane 3" (USES-RS USES-RT) + "bmb3 $rs,$rt,$offset" + (+ OP_BMB3 rs rt offset) + (if (eq (and rs #xFF000000) (and rt #xFF000000)) + (delay 1 (set pc offset))) + ()) + +(dni bne "branch if not equal" (USES-RS USES-RT) + "bne $rs,$rt,$offset" + (+ OP_BNE rs rt offset) + (if (ne rs rt) + (delay 1 (set pc offset))) + ()) + +(dni bnel "branch if not equal likely" (USES-RS USES-RT) + "bnel $rs,$rt,$offset" + (+ OP_BNEL rs rt offset) + (if (ne rs rt) + (delay 1 (set pc offset)) + (skip 1)) + ()) + + + + +; Jump instructions. +; Might as well jump! + +(dni jalr "jump and link register" (USES-RD USES-RS) + "jalr $rd,$rs" + (+ OP_SPECIAL rs (f-rt 0) rd (f-shamt 0) FUNC_JALR) + (delay 1 + (sequence () + (set rd (add pc 8)) + (set pc rs))) + ()) + +(dni jr "jump register" (USES-RS) + "jr $rs" + (+ OP_SPECIAL rs (f-rt 0) (f-rd 0) (f-shamt 0) FUNC_JR) + (delay 1 (set pc rs)) + ()) + + +; Load instructions. + +(dni lb "load byte" (LOAD-DELAY USES-RS USES-RT) + "lb $rt,$lo16($base)" + (+ OP_LB base rt lo16) + (set rt (ext WI (mem QI (add base (ext SI (trunc HI lo16)))))) +; (sequence ((SI addr) (SI word)) +; (set addr (add base lo16)) +; (set word (mem SI (and addr (inv 3)))) +; (set word (srl word (sll (and addr 2) 3))) +; (set rt (ext SI word))) + ()) + +(dni lbu "load byte unsigned" (LOAD-DELAY USES-RS USES-RT) + "lbu $rt,$lo16($base)" + (+ OP_LBU base rt lo16) + (set rt (zext WI (mem QI (add base (ext SI (trunc HI lo16)))))) +; (sequence ((SI addr) (SI word)) +; (set addr (add base lo16)) +; (set word (mem SI (and addr (inv 3)))) +; (set rt (srl word (sll (and addr 2) 3)))) + ()) + +(dni lh "load half word" (LOAD-DELAY USES-RS USES-RT) + "lh $rt,$lo16($base)" + (+ OP_LH base rt lo16) + (set rt (ext WI (mem HI (add base (ext SI (trunc HI lo16)))))) +; (sequence ((SI addr) (HI word)) +; (set addr (add base lo16)) +; (set word (mem SI (and addr (inv 3)))) +; (set word (srl word (sll (and addr 1) 4))) +; (set rt (ext SI word))) + ()) + +(dni lhu "load half word unsigned" (LOAD-DELAY USES-RS USES-RT) + "lhu $rt,$lo16($base)" + (+ OP_LHU base rt lo16) + (set rt (zext WI (mem HI (add base (ext SI (trunc HI lo16)))))) +; (sequence ((SI addr) (SI word)) +; (set addr (add base lo16)) +; (set word (mem SI (and addr (inv 3)))) +; (set rt (srl word (sll (and addr 1) 4)))) + ()) + +(dni lui "load upper immediate" (USES-RT) + "lui $rt,$hi16" + (+ OP_LUI (f-rs 0) rt hi16) + (set rt (sll hi16 16)) + ()) + +(dni lw "load word" (LOAD-DELAY USES-RS USES-RT) + "lw $rt,$lo16($base)" + (+ OP_LW base rt lo16) + (set rt (mem SI (add base (ext SI (trunc HI lo16))))) + ()) + + +; Store instructions. + +(dni sb "store byte" (USES-RS USES-RT) + "sb $rt,$lo16($base)" + (+ OP_SB base rt lo16) + (set (mem QI (add base (ext SI (trunc HI lo16)))) (and QI rt #xFF)) + ()) + +(dni sh "store half word" (USES-RS USES-RT) + "sh $rt,$lo16($base)" + (+ OP_SH base rt lo16) + (set (mem HI (add base (ext SI (trunc HI lo16)))) (and HI rt #xFFFF)) + ()) + +(dni sw "store word" (USES-RS USES-RT) + "sw $rt,$lo16($base)" + (+ OP_SW base rt lo16) + (set (mem SI (add base (ext SI (trunc HI lo16)))) rt) + ()) + + +; Special instructions for simulation/debugging +(dni break "breakpoint" () + "break" + (+ OP_SPECIAL (f-rs 0) (f-rt 0) (f-rd 0) (f-shamt 0) FUNC_BREAK) + (c-call VOID "do_break" pc) + ()) + +(dni syscall "system call" (YIELD-INSN) + "syscall" + (+ OP_SPECIAL execode (f-func 12)) + (c-call VOID "do_syscall") + ()) + +; Macro instructions, common to iq10 & iq2000 + +(dnmi nop "nop" () + "nop" + (emit sll (rd 0) (rt 0) (shamt 0)) +) + +(dnmi li "load immediate" (USES-RS NO-DIS) + "li $rs,$imm" + (emit ori (rt 0) rs imm) +) + +(dnmi move "move" (USES-RD USES-RT NO-DIS) + "move $rd,$rt" + (emit or rd (rs 0) rt) +) + +(dnmi lb-base-0 "load byte - implied base 0" (USES-RT NO-DIS) + "lb $rt,$lo16" + (emit lb rt lo16 (base 0)) +) + +(dnmi lbu-base-0 "load byte unsigned - implied base 0" (USES-RT NO-DIS) + "lbu $rt,$lo16" + (emit lbu rt lo16 (base 0)) +) + +(dnmi lh-base-0 "load half - implied base 0" (USES-RT NO-DIS) + "lh $rt,$lo16" + (emit lh rt lo16 (base 0)) +) + +(dnmi lw-base-0 "load word - implied base 0" (USES-RT NO-DIS) + "lw $rt,$lo16" + (emit lw rt lo16 (base 0)) +) + +(dnmi m-add "add immediate" (USES-RS USES-RT NO-DIS) + "add $rt,$rs,$lo16" + (emit addi rt rs lo16)) + +(dnmi m-addu "add immediate unsigned" (USES-RS USES-RT NO-DIS) + "addu $rt,$rs,$lo16" + (emit addiu rt rs lo16) +) + +(dnmi m-and "and immediate" (USES-RS USES-RT NO-DIS) + "and $rt,$rs,$lo16" + (emit andi rt rs lo16) +) + +(dnmi m-j "jump register" (USES-RS NO-DIS) + "j $rs" + (emit jr rs) +) + +(dnmi m-or "or immediate" (USES-RS USES-RT NO-DIS) + "or $rt,$rs,$lo16" + (emit ori rt rs lo16) +) + +(dnmi m-sll "shift left logical" (USES-RD USES-RT USES-RS NO-DIS) + "sll $rd,$rt,$rs" + (emit sllv rd rt rs) +) + +(dnmi m-slt "slt immediate" (USES-RS USES-RT NO-DIS) + "slt $rt,$rs,$imm" + (emit slti rt rs imm) +) + +(dnmi m-sltu "sltu immediate" (USES-RS USES-RT NO-DIS) + "sltu $rt,$rs,$imm" + (emit sltiu rt rs imm) +) + +(dnmi m-sra "shift right arithmetic" (USES-RD USES-RT USES-RS NO-DIS) + "sra $rd,$rt,$rs" + (emit srav rd rt rs) +) + +(dnmi m-srl "shift right logical" (USES-RD USES-RT USES-RS NO-DIS) + "srl $rd,$rt,$rs" + (emit srlv rd rt rs) +) + +(dnmi not "not" (USES-RD USES-RT NO-DIS) + "not $rd,$rt" + (emit nor rd (rs 0) rt) +) + +(dnmi subi "sub immediate" (USES-RS USES-RT NO-DIS) + "subi $rt,$rs,$mlo16" + (emit addiu rt rs mlo16) +) + +(dnmi m-sub "subtract immediate" (USES-RS USES-RT NO-DIS) + "sub $rt,$rs,$mlo16" + (emit addiu rt rs mlo16) +) + +(dnmi m-subu "subtract unsigned" (USES-RS USES-RT NO-DIS) + "subu $rt,$rs,$mlo16" + (emit addiu rt rs mlo16) +) + +(dnmi sb-base-0 "store byte - implied base 0" (USES-RT NO-DIS) + "sb $rt,$lo16" + (emit sb rt lo16 (base 0)) +) + +(dnmi sh-base-0 "store half - implied base 0" (USES-RT NO-DIS) + "sh $rt,$lo16" + (emit sh rt lo16 (base 0)) +) + +(dnmi sw-base-0 "store word - implied base 0" (USES-RT NO-DIS) + "sw $rt,$lo16" + (emit sw rt lo16 (base 0)) +) + +(dnmi m-xor "xor immediate" (USES-RS USES-RT NO-DIS) + "xor $rt,$rs,$lo16" + (emit xori rt rs lo16) +) + + +(if (keep-mach? (iq2000)) +(include "iq2000m.cpu")) + +(if (keep-mach? (iq10)) +(include "iq10.cpu")) + + + diff --git a/cpu/iq2000.opc b/cpu/iq2000.opc new file mode 100644 index 0000000000000..06600ec7938bd --- /dev/null +++ b/cpu/iq2000.opc @@ -0,0 +1,324 @@ +/* IQ2000 opcode support. -*- C -*- + + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + + Contributed by Red Hat Inc; developed under contract from Fujitsu. + + This file is part of the GNU Binutils. + + This program is free software; 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. + +*/ + +/* This file is an addendum to iq2000.cpu. Heavy use of C code isn't + appropriate in .cpu files, so it resides here. This especially applies + to assembly/disassembly where parsing/printing can be quite involved. + Such things aren't really part of the specification of the cpu, per se, + so .cpu files provide the general framework and .opc files handle the + nitty-gritty details as necessary. + + Each section is delimited with start and end markers. + + -opc.h additions use: "-- opc.h" + -opc.c additions use: "-- opc.c" + -asm.c additions use: "-- asm.c" + -dis.c additions use: "-- dis.c" + -ibd.h additions use: "-- ibd.h" +*/ + +/* -- opc.h */ + +/* Allows reason codes to be output when assembler errors occur. */ +#define CGEN_VERBOSE_ASSEMBLER_ERRORS + +/* Override disassembly hashing - there are variable bits in the top + byte of these instructions. */ +#define CGEN_DIS_HASH_SIZE 8 +#define CGEN_DIS_HASH(buf,value) (((* (unsigned char*) (buf)) >> 6) % CGEN_DIS_HASH_SIZE) + +/* following activates check beyond hashing since some iq2000 and iq10 + instructions have same mnemonics but different functionality. */ +#define CGEN_VALIDATE_INSN_SUPPORTED + +extern int iq2000_cgen_insn_supported (CGEN_CPU_DESC cd, CGEN_INSN *insn); + +/* -- asm.c */ +static const char * parse_mimm PARAMS ((CGEN_CPU_DESC, const char **, int, long *)); +static const char * parse_imm PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_hi16 PARAMS ((CGEN_CPU_DESC, const char **, int, unsigned long *)); +static const char * parse_lo16 PARAMS ((CGEN_CPU_DESC, const char **, int, long *)); + +/* Special check to ensure that instruction exists for given machine */ +int +iq2000_cgen_insn_supported (cd, insn) + CGEN_CPU_DESC cd; + CGEN_INSN *insn; +{ + int machs = cd->machs; + + return ((CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_MACH) & machs) != 0); +} + +static int iq2000_cgen_isa_register (strp) + const char **strp; +{ + int len; + int ch1, ch2; + if (**strp == 'r' || **strp == 'R') + { + len = strlen (*strp); + if (len == 2) + { + ch1 = (*strp)[1]; + if ('0' <= ch1 && ch1 <= '9') + return 1; + } + else if (len == 3) + { + ch1 = (*strp)[1]; + ch2 = (*strp)[2]; + if (('1' <= ch1 && ch1 <= '2') && ('0' <= ch2 && ch2 <= '9')) + return 1; + if ('3' == ch1 && (ch2 == '0' || ch2 == '1')) + return 1; + } + } + if (**strp == '%' && tolower((*strp)[1]) != 'l' && tolower((*strp)[1]) != 'h') + return 1; + return 0; +} + +/* Handle negated literal. */ + +static const char * +parse_mimm (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + long *valuep; +{ + const char *errmsg; + long value; + + /* Verify this isn't a register */ + if (iq2000_cgen_isa_register (strp)) + errmsg = _("immediate value cannot be register"); + else + { + long value; + + errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); + if (errmsg == NULL) + { + long x = (-value) & 0xFFFF0000; + if (x != 0 && x != 0xFFFF0000) + errmsg = _("immediate value out of range"); + else + *valuep = (-value & 0xFFFF); + } + } + return errmsg; +} + +/* Handle signed/unsigned literal. */ + +static const char * +parse_imm (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + unsigned long *valuep; +{ + const char *errmsg; + long value; + + if (iq2000_cgen_isa_register (strp)) + errmsg = _("immediate value cannot be register"); + else + { + long value; + + errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value); + if (errmsg == NULL) + { + long x = value & 0xFFFF0000; + if (x != 0 && x != 0xFFFF0000) + errmsg = _("immediate value out of range"); + else + *valuep = (value & 0xFFFF); + } + } + return errmsg; +} + +/* Handle iq10 21-bit jmp offset. */ + +static const char * +parse_jtargq10 (cd, strp, opindex, reloc, type_addr, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + int reloc; + enum cgen_parse_operand_result *type_addr; + unsigned long *valuep; +{ + const char *errmsg; + bfd_vma value; + enum cgen_parse_operand_result result_type = CGEN_PARSE_OPERAND_RESULT_NUMBER; + + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_IQ2000_OFFSET_21, + &result_type, &value); + if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + { + /* check value is within 23-bits (remembering that 2-bit shift right will occur) */ + if (value > 0x7fffff) + return _("21-bit offset out of range"); + } + *valuep = (value & 0x7FFFFF); + return errmsg; +} + +/* Handle high(). */ + +static const char * +parse_hi16 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + unsigned long *valuep; +{ + if (strncasecmp (*strp, "%hi(", 4) == 0) + { + enum cgen_parse_operand_result result_type; + bfd_vma value; + const char *errmsg; + + *strp += 4; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16, + &result_type, &value); + if (**strp != ')') + return _("missing `)'"); + + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + { + /* if value has top-bit of %lo on, then it will + sign-propagate and so we compensate by adding + 1 to the resultant %hi value */ + if (value & 0x8000) + value += 0x10000; + value >>= 16; + } + *valuep = value; + + return errmsg; + } + + /* we add %uhi in case a user just wants the high 16-bits or is using + an insn like ori for %lo which does not sign-propagate */ + if (strncasecmp (*strp, "%uhi(", 5) == 0) + { + enum cgen_parse_operand_result result_type; + bfd_vma value; + const char *errmsg; + + *strp += 5; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_IQ2000_UHI16, + &result_type, &value); + if (**strp != ')') + return _("missing `)'"); + + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + { + value >>= 16; + } + *valuep = value; + + return errmsg; + } + + return parse_imm (cd, strp, opindex, valuep); +} + +/* Handle %lo in a signed context. + The signedness of the value doesn't matter to %lo(), but this also + handles the case where %lo() isn't present. */ + +static const char * +parse_lo16 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + long *valuep; +{ + if (strncasecmp (*strp, "%lo(", 4) == 0) + { + const char *errmsg; + enum cgen_parse_operand_result result_type; + bfd_vma value; + + *strp += 4; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16, + &result_type, &value); + if (**strp != ')') + return _("missing `)'"); + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value &= 0xffff; + *valuep = value; + return errmsg; + } + + return parse_imm (cd, strp, opindex, valuep); +} + +/* Handle %lo in a negated signed context. + The signedness of the value doesn't matter to %lo(), but this also + handles the case where %lo() isn't present. */ + +static const char * +parse_mlo16 (cd, strp, opindex, valuep) + CGEN_CPU_DESC cd; + const char **strp; + int opindex; + long *valuep; +{ + if (strncasecmp (*strp, "%lo(", 4) == 0) + { + const char *errmsg; + enum cgen_parse_operand_result result_type; + bfd_vma value; + + *strp += 4; + errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_LO16, + &result_type, &value); + if (**strp != ')') + return _("missing `)'"); + ++*strp; + if (errmsg == NULL + && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) + value = (-value) & 0xffff; + *valuep = value; + return errmsg; + } + + return parse_mimm (cd, strp, opindex, valuep); +} + +/* -- */ diff --git a/cpu/iq2000m.cpu b/cpu/iq2000m.cpu new file mode 100644 index 0000000000000..a3a41d9966547 --- /dev/null +++ b/cpu/iq2000m.cpu @@ -0,0 +1,630 @@ +; IQ2000-only CPU description. -*- Scheme -*- +; +; Copyright 2000, 2001, 2002 Free Software Foundation, Inc. +; +; Contributed by Red Hat Inc; developed under contract from Vitesse. +; +; This file is part of the GNU Binutils. +; +; This program is free software; 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. + +(dni andoui "and upper ones immediate" (MACH2000 USES-RS USES-RT) + "andoui $rt,$rs,$hi16" + (+ OP_ANDOUI rs rt hi16) + (set rt (and rs (or (sll hi16 16) #xFFFF))) + ()) + +(dni andoui2 "and upper ones immediate" (ALIAS NO-DIS MACH2000 USES-RS USES-RT) + "andoui ${rt-rs},$hi16" + (+ OP_ANDOUI rt-rs hi16) + (set rt-rs (and rt-rs (or (sll hi16 16) #xFFFF))) + ()) + +(dni orui2 "or upper immediate" (ALIAS NO-DIS MACH2000 USES-RS USES-RT) + "orui ${rt-rs},$hi16" + (+ OP_ORUI rt-rs hi16) + (set rt-rs (or rt-rs (sll hi16 16))) + ()) + +(dni orui "or upper immediate" (MACH2000 USES-RS USES-RT) + "orui $rt,$rs,$hi16" + (+ OP_ORUI rs rt hi16) + (set rt (or rs (sll hi16 16))) + ()) + +(dni bgtz "branch if greater than zero" (MACH2000 USES-RS) + "bgtz $rs,$offset" + (+ OP_BGTZ rs (f-rt 0) offset) + (if (gt rs 0) + (delay 1 (set pc offset))) + ()) + + +(dni bgtzl "branch if greater than zero likely" (MACH2000 USES-RS) + "bgtzl $rs,$offset" + (+ OP_BGTZL rs (f-rt 0) offset) + (if (gt rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + +(dni blez "branch if less than or equal to zero" (MACH2000 USES-RS) + "blez $rs,$offset" + (+ OP_BLEZ rs (f-rt 0) offset) + (if (le rs 0) + (delay 1 (set pc offset))) + ()) + +(dni blezl "branch if less than or equal to zero likely" (MACH2000 USES-RS) + "blezl $rs,$offset" + (+ OP_BLEZL rs (f-rt 0) offset) + (if (le rs 0) + (delay 1 (set pc offset)) + (skip 1)) + ()) + + +(dni mrgb "merge bytes" (MACH2000 USES-RD USES-RS USES-RT) + "mrgb $rd,$rs,$rt,$mask" + (+ OP_SPECIAL rs rt rd (f-10 0) mask FUNC_MRGB) + (sequence ((SI temp)) + (if (bitclear? mask 0) + (set temp (and rs #xFF)) + (set temp (and rt #xFF))) + (if (bitclear? mask 1) + (set temp (or temp (and rs #xFF00))) + (set temp (or temp (and rt #xFF00)))) + (if (bitclear? mask 2) + (set temp (or temp (and rs #xFF0000))) + (set temp (or temp (and rt #xFF0000)))) + (if (bitclear? mask 3) + (set temp (or temp (and rs #xFF000000))) + (set temp (or temp (and rt #xFF000000)))) + (set rd temp)) + ()) + +(dni mrgb2 "merge bytes" (ALIAS NO-DIS MACH2000 USES-RD USES-RS USES-RT) + "mrgb ${rd-rs},$rt,$mask" + (+ OP_SPECIAL rt rd-rs (f-10 0) mask FUNC_MRGB) + (sequence ((SI temp)) + (if (bitclear? mask 0) + (set temp (and rd-rs #xFF)) + (set temp (and rt #xFF))) + (if (bitclear? mask 1) + (set temp (or temp (and rd-rs #xFF00))) + (set temp (or temp (and rt #xFF00)))) + (if (bitclear? mask 2) + (set temp (or temp (and rd-rs #xFF0000))) + (set temp (or temp (and rt #xFF0000)))) + (if (bitclear? mask 3) + (set temp (or temp (and rd-rs #xFF000000))) + (set temp (or temp (and rt #xFF000000)))) + (set rd-rs temp)) + ()) + +; NOTE: None of these instructions' semantics are specified, so they +; will not work in a simulator. +; +; Architectural and coprocessor instructions. +; BREAK and SYSCALL are implemented with escape hatches to the C +; code. These are used by the test suite to indicate pass/failures. + +(dni bctxt "branch and switch context" (MACH2000 DELAY-SLOT COND-CTI USES-RS) + "bctxt $rs,$offset" + (+ OP_REGIMM rs (f-rt 6) offset) + (unimp bctxt) + ()) + +(dni bc0f "branch if copro 0 condition false" (MACH2000 DELAY-SLOT COND-CTI) + "bc0f $offset" + (+ OP_COP0 (f-rs 8) (f-rt 0) offset) + (unimp bc0f) + ()) + +(dni bc0fl "branch if copro 0 condition false likely" (MACH2000 DELAY-SLOT COND-CTI SKIP-CTI) + "bc0fl $offset" + (+ OP_COP0 (f-rs 8) (f-rt 2) offset) + (unimp bc0fl) + ()) + +(dni bc3f "branch if copro 3 condition false" (MACH2000 DELAY-SLOT COND-CTI) + "bc3f $offset" + (+ OP_COP3 (f-rs 8) (f-rt 0) offset) + (unimp bc3f) + ()) + +(dni bc3fl "branch if copro 3 condition false likely" (MACH2000 DELAY-SLOT COND-CTI SKIP-CTI) + "bc3fl $offset" + (+ OP_COP3 (f-rs 8) (f-rt 2) offset) + (unimp bc3fl) + ()) + +(dni bc0t "branch if copro 0 condition true" (MACH2000 DELAY-SLOT COND-CTI) + "bc0t $offset" + (+ OP_COP0 (f-rs 8) (f-rt 1) offset) + (unimp bc0t) + ()) + +(dni bc0tl "branch if copro 0 condition true likely" (MACH2000 DELAY-SLOT COND-CTI SKIP-CTI) + "bc0tl $offset" + (+ OP_COP0 (f-rs 8) (f-rt 3) offset) + (unimp bc0tl) + ()) + +(dni bc3t "branch if copro 3 condition true" (MACH2000 DELAY-SLOT COND-CTI) + "bc3t $offset" + (+ OP_COP3 (f-rs 8) (f-rt 1) offset) + (unimp bc3t) + ()) + +(dni bc3tl "branch if copro 3 condition true likely" (MACH2000 DELAY-SLOT COND-CTI SKIP-CTI) + "bc3tl $offset" + (+ OP_COP3 (f-rs 8) (f-rt 3) offset) + (unimp bc3tl) + ()) + +; Note that we don't set the USES-RD or USES-RT attributes for many of the following +; instructions, as it's the COP register that's being specified. + +(dni cfc0 "control from coprocessor 0" (MACH2000 LOAD-DELAY USES-RT) + "cfc0 $rt,$rd" + (+ OP_COP0 (f-rs 2) rt rd (f-10-11 0)) + (unimp cfc0) + ()) + +(dni cfc1 "control from coprocessor 1" (MACH2000 LOAD-DELAY USES-RT) + "cfc1 $rt,$rd" + (+ OP_COP1 (f-rs 2) rt rd (f-10-11 0)) + (unimp cfc1) + ()) + +(dni cfc2 "control from coprocessor 2" (MACH2000 LOAD-DELAY USES-RT YIELD-INSN) + "cfc2 $rt,$rd" + (+ OP_COP2 (f-rs 2) rt rd (f-10-11 0)) + (unimp cfc2) + ()) + +(dni cfc3 "control from coprocessor 3" (MACH2000 LOAD-DELAY USES-RT YIELD-INSN) + "cfc3 $rt,$rd" + (+ OP_COP3 (f-rs 2) rt rd (f-10-11 0)) + (unimp cfc3) + ()) + +; COPz instructions are an instruction form, not real instructions +; with associated assembly mnemonics. Therefore, they are omitted +; from the ISA description. + +(dni chkhdr "check header" (MACH2000 LOAD-DELAY USES-RD YIELD-INSN) + "chkhdr $rd,$rt" + (+ OP_COP3 (f-rs 9) rt rd (f-shamt 0) (f-func 0)) + (unimp chkhdr) + ()) + +(dni ctc0 "control to coprocessor 0" (MACH2000 USES-RT) + "ctc0 $rt,$rd" + (+ OP_COP0 (f-rs 6) rt rd (f-10-11 0)) + (unimp ctc0) + ()) + +(dni ctc1 "control to coprocessor 1" (MACH2000 USES-RT) + "ctc1 $rt,$rd" + (+ OP_COP1 (f-rs 6) rt rd (f-10-11 0)) + (unimp ctc1) + ()) + +(dni ctc2 "control to coprocessor 2" (MACH2000 USES-RT) + "ctc2 $rt,$rd" + (+ OP_COP2 (f-rs 6) rt rd (f-10-11 0)) + (unimp ctc2) + ()) + +(dni ctc3 "control to coprocessor 3" (MACH2000 USES-RT) + "ctc3 $rt,$rd" + (+ OP_COP3 (f-rs 6) rt rd (f-10-11 0)) + (unimp ctc3) + ()) + +(dni jcr "jump context register" (MACH2000 DELAY-SLOT UNCOND-CTI USES-RS) + "jcr $rs" + (+ OP_SPECIAL rs (f-rt 0) (f-rd 0) (f-shamt 0) FUNC_JCR) + (unimp jcr) + ()) + +(dni luc32 "lookup chain 32 bits" (MACH2000 USES-RD USES-RT YIELD-INSN) + "luc32 $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 3)) + (unimp luc32) + ()) + +(dni luc32l "lookup chain 32 bits and lock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "luc32l $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 7)) + (unimp luc32l) + ()) + +(dni luc64 "lookup chain 64 bits" (MACH2000 USES-RD USES-RT YIELD-INSN) + "luc64 $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 11)) + (unimp luc64) + ()) + +(dni luc64l "lookup chain 64 bits and lock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "luc64l $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 15)) + (unimp luc64l) + ()) + +(dni luk "lookup key" (MACH2000 USES-RD USES-RT) + "luk $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 8)) + (unimp luk) + ()) + +(dni lulck "lookup lock" (MACH2000 USES-RT YIELD-INSN) + "lulck $rt" + (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 4)) + (unimp lulck) + ()) + +(dni lum32 "lookup match 32 bits" (MACH2000 USES-RD USES-RT YIELD-INSN) + "lum32 $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 2)) + (unimp lum32) + ()) + +(dni lum32l "lookup match 32 bits and lock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "lum32l $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 6)) + (unimp lum32l) + ()) + +(dni lum64 "lookup match 64 bits" (MACH2000 USES-RD USES-RT YIELD-INSN) + "lum64 $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 10)) + (unimp lum64) + ()) + +(dni lum64l "lookup match 64 bits and lock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "lum64l $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 14)) + (unimp lum64l) + ()) + +(dni lur "lookup read" (MACH2000 USES-RD USES-RT YIELD-INSN) + "lur $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 1)) + (unimp lur) + ()) + +(dni lurl "lookup read and lock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "lurl $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 5)) + (unimp lurl) + ()) + +(dni luulck "lookup unlock" (MACH2000 USES-RT YIELD-INSN) + "luulck $rt" + (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 0)) + (unimp luulck) + ()) + +(dni mfc0 "move from coprocessor 0" (MACH2000 LOAD-DELAY USES-RT) + "mfc0 $rt,$rd" + (+ OP_COP0 (f-rs 0) rt rd (f-10-11 0)) + (unimp mfc0) + ()) + +(dni mfc1 "move from coprocessor 1" (MACH2000 LOAD-DELAY USES-RT) + "mfc1 $rt,$rd" + (+ OP_COP1 (f-rs 0) rt rd (f-10-11 0)) + (unimp mfc1) + ()) + +(dni mfc2 "move from coprocessor 2" (MACH2000 LOAD-DELAY USES-RT YIELD-INSN) + "mfc2 $rt,$rd" + (+ OP_COP2 (f-rs 0) rt rd (f-10-11 0)) + (unimp mfc2) + ()) + +(dni mfc3 "move from coprocessor 3" (MACH2000 LOAD-DELAY USES-RT YIELD-INSN) + "mfc3 $rt,$rd" + (+ OP_COP3 (f-rs 0) rt rd (f-10-11 0)) + (unimp mfc3) + ()) + +(dni mtc0 "move to coprocessor 0" (MACH2000 USES-RT) + "mtc0 $rt,$rd" + (+ OP_COP0 (f-rs 4) rt rd (f-10-11 0)) + (unimp mtc0) + ()) + +(dni mtc1 "move to coprocessor 1" (MACH2000 USES-RT) + "mtc1 $rt,$rd" + (+ OP_COP1 (f-rs 4) rt rd (f-10-11 0)) + (unimp mtc1) + ()) + +(dni mtc2 "move to coprocessor 2" (MACH2000 USES-RT) + "mtc2 $rt,$rd" + (+ OP_COP2 (f-rs 4) rt rd (f-10-11 0)) + (unimp mtc2) + ()) + +(dni mtc3 "move to coprocessor 3" (MACH2000 USES-RT) + "mtc3 $rt,$rd" + (+ OP_COP3 (f-rs 4) rt rd (f-10-11 0)) + (unimp mtc3) + ()) + +(dni pkrl "pkrl" (MACH2000 USES-RD USES-RT YIELD-INSN) + "pkrl $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 7)) + (unimp pkrl) + ()) + +(dni pkrlr1 "pkrlr1" (MACH2000 USES-RT YIELD-INSN) + "pkrlr1 $rt,$count" + (+ OP_COP3 (f-rs 29) rt count) + (unimp pkrlr1) + ()) + +(dni pkrlr30 "pkrlr30" (MACH2000 USES-RT YIELD-INSN) + "pkrlr30 $rt,$count" + (+ OP_COP3 (f-rs 31) rt count) + (unimp pkrlr30) + ()) + +(dni rb "dma read bytes" (MACH2000 USES-RD USES-RT YIELD-INSN) + "rb $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 4)) + (unimp rb) + ()) + +(dni rbr1 "dma read bytes using r1" (MACH2000 USES-RT YIELD-INSN) + "rbr1 $rt,$count" + (+ OP_COP3 (f-rs 24) rt count) + (unimp rbr1) + ()) + +(dni rbr30 "dma read bytes using r30" (MACH2000 USES-RT YIELD-INSN) + "rbr30 $rt,$count" + (+ OP_COP3 (f-rs 26) rt count) + (unimp rbr30) + ()) + +(dni rfe "restore from exception" (MACH2000) + "rfe" + (+ OP_COP0 (f-25 1) (f-24-19 0) (f-func 16)) + (unimp rfe) + ()) + +(dni rx "dma read word64s" (MACH2000 USES-RD USES-RT YIELD-INSN) + "rx $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 6)) + (unimp rx) + ()) + +(dni rxr1 "dma read word64s using r1" (MACH2000 USES-RT YIELD-INSN) + "rxr1 $rt,$count" + (+ OP_COP3 (f-rs 28) rt count) + (unimp rxr1) + ()) + +(dni rxr30 "dma read word 64s using r30" (MACH2000 USES-RT YIELD-INSN) + "rxr30 $rt,$count" + (+ OP_COP3 (f-rs 30) rt count) + (unimp rxr30) + ()) + +(dni sleep "sleep" (MACH2000 YIELD-INSN) + "sleep" + (+ OP_SPECIAL execode FUNC_SLEEP) + (unimp sleep) + ()) + +(dni srrd "sram read" (MACH2000 USES-RT YIELD-INSN) + "srrd $rt" + (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 16)) + (unimp srrd) + ()) + +(dni srrdl "sram read and lock" (MACH2000 USES-RT YIELD-INSN) + "srrdl $rt" + (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 20)) + (unimp srrdl) + ()) + +(dni srulck "sram unlock" (MACH2000 USES-RT YIELD-INSN) + "srulck $rt" + (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 22)) + (unimp srulck) + ()) + +(dni srwr "sram write" (MACH2000 USES-RD USES-RT YIELD-INSN) + "srwr $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 17)) + (unimp srwr) + ()) + +(dni srwru "sram write and unlock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "srwru $rt,$rd" + (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 21)) + (unimp srwru) + ()) + +(dni trapqfl "yield if dma queue full" (MACH2000 YIELD-INSN) + "trapqfl" + (+ OP_COP3 (f-rs 1) (f-rt 0) (f-rd 0) (f-shamt 0) (f-func 8)) + (unimp trapqfl) + ()) + +(dni trapqne "yield if dma queue not empty" (MACH2000 YIELD-INSN) + "trapqne" + (+ OP_COP3 (f-rs 1) (f-rt 0) (f-rd 0) (f-shamt 0) (f-func 9)) + (unimp trapqne) + ()) + +(dni traprel "traprel" (MACH2000 USES-RT YIELD-INSN) + "traprel $rt" + (+ OP_COP3 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 10)) + (unimp traprel) + ()) + +(dni wb "dma write bytes" (MACH2000 USES-RD USES-RT YIELD-INSN) + "wb $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 0)) + (unimp wb) + ()) + +(dni wbu "dma write bytes and unlock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "wbu $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 1)) + (unimp wbu) + ()) + +(dni wbr1 "dma write bytes using r1" (MACH2000 USES-RT YIELD-INSN) + "wbr1 $rt,$count" + (+ OP_COP3 (f-rs 16) rt count) + (unimp wbr1) + ()) + +(dni wbr1u "dma write bytes using r1 and unlock" (MACH2000 USES-RT YIELD-INSN) + "wbr1u $rt,$count" + (+ OP_COP3 (f-rs 17) rt count) + (unimp wbr1u) + ()) + +(dni wbr30 "dma write bytes using r30" (MACH2000 USES-RT YIELD-INSN) + "wbr30 $rt,$count" + (+ OP_COP3 (f-rs 18) rt count) + (unimp wbr30) + ()) + +(dni wbr30u "dma write bytes using r30 and unlock" (MACH2000 USES-RT YIELD-INSN) + "wbr30u $rt,$count" + (+ OP_COP3 (f-rs 19) rt count) + (unimp wbr30u) + ()) + +(dni wx "dma write word64s" (MACH2000 USES-RD USES-RT YIELD-INSN) + "wx $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 2)) + (unimp wx) + ()) + +(dni wxu "dma write word64s and unlock" (MACH2000 USES-RD USES-RT YIELD-INSN) + "wxu $rd,$rt" + (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 3)) + (unimp wxu) + ()) + +(dni wxr1 "dma write word64s using r1" (MACH2000 USES-RT YIELD-INSN) + "wxr1 $rt,$count" + (+ OP_COP3 (f-rs 20) rt count) + (unimp wxr1) + ()) + +(dni wxr1u "dma write word64s using r1 and unlock" (MACH2000 USES-RT YIELD-INSN) + "wxr1u $rt,$count" + (+ OP_COP3 (f-rs 21) rt count) + (unimp wxr1u) + ()) + +(dni wxr30 "dma write word64s using r30" (MACH2000 USES-RT YIELD-INSN) + "wxr30 $rt,$count" + (+ OP_COP3 (f-rs 22) rt count) + (unimp wxr30) + ()) + +(dni wxr30u "dma write word64s using r30 and unlock" (MACH2000 USES-RT YIELD-INSN) + "wxr30u $rt,$count" + (+ OP_COP3 (f-rs 23) rt count) + (unimp wxr30u) + ()) + + +; Load/Store instructions. + +(dni ldw "load double word" (MACH2000 EVEN-REG-NUM LOAD-DELAY USES-RT) + "ldw $rt,$lo16($base)" + (+ OP_LDW base rt lo16) + (sequence ((SI addr)) + (set addr (and (add base lo16) (inv 3))) + (set (reg h-gr (add (ifield f-rt) 1)) (mem SI addr)) + (set rt (mem SI (add addr 4)))) + ()) + +(dni sdw "store double word" (MACH2000 EVEN-REG-NUM USES-RT) + "sdw $rt,$lo16($base)" + (+ OP_SDW base rt lo16) + (sequence ((SI addr)) + (set addr (and (add base lo16) (inv 3))) + (set (mem SI (add addr 4)) rt) + (set (mem SI addr) (reg h-gr (add (ifield f-rt) 1)))) + ()) + + +; Jump instructions + +(dni j "jump" (MACH2000) + "j $jmptarg" + (+ OP_J (f-rsrvd 0) jmptarg) + (delay 1 (set pc jmptarg)) + ()) + +(dni jal "jump and link" (MACH2000 USES-R31) + "jal $jmptarg" + (+ OP_JAL (f-rsrvd 0) jmptarg) + (delay 1 + (sequence () + (set (reg h-gr 31) (add pc 8)) + (set pc jmptarg))) + ()) + +(dni bmb "branch if matching byte-lane" (MACH2000 USES-RS USES-RT) + "bmb $rs,$rt,$offset" + (+ OP_BMB rs rt offset) + (sequence ((BI branch?)) + (set branch? 0) + (if (eq (and rs #xFF) (and rt #xFF)) + (set branch? 1)) + (if (eq (and rs #xFF00) (and rt #xFF00)) + (set branch? 1)) + (if (eq (and rs #xFF0000) (and rt #xFF0000)) + (set branch? 1)) + (if (eq (and rs #xFF000000) (and rt #xFF000000)) + (set branch? 1)) + (if branch? + (delay 1 (set pc offset)))) + ()) + + +; Macros + +(dnmi ldw-base-0 "load double word - implied base 0" (MACH2000 EVEN-REG-NUM LOAD-DELAY USES-RT USES-RS NO-DIS) + "ldw $rt,$lo16" + (emit ldw rt lo16 (base 0)) +) + +(dnmi sdw-base-0 "store double word - implied base 0" (MACH2000 EVEN-REG-NUM USES-RT NO-DIS) + "sdw $rt,$lo16" + (emit sdw rt lo16 (base 0)) +) + + + + + + diff --git a/cpu/simplify.inc b/cpu/simplify.inc new file mode 100644 index 0000000000000..12b05b7981f6c --- /dev/null +++ b/cpu/simplify.inc @@ -0,0 +1,215 @@ +; Collection of macros, for GNU Binutils .cpu files. -*- Scheme -*- +; +; Copyright 2000 Free Software Foundation, Inc. +; +; Contributed by Red Hat Inc. +; +; This file is part of the GNU Binutils. +; +; This program is free software; 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. + +; Enums. + +; Define a normal enum without using name/value pairs. +; This is currently the same as define-full-enum but it needn't remain +; that way (it's define-full-enum that would change). + +(define-pmacro (define-normal-enum name comment attrs prefix vals) + "\ +Define a normal enum, fixed number of arguments. +" + (define-full-enum name comment attrs prefix vals) +) + +; Define a normal insn enum. + +(define-pmacro (define-normal-insn-enum name comment attrs prefix fld vals) + "\ +Define a normal instruction opcode enum. +" + (define-full-insn-enum name comment attrs prefix fld vals) +) + +; Instruction fields. + +; Normally, fields are unsigned have no encode/decode needs. + +(define-pmacro (define-normal-ifield name comment attrs start length) + "Define a normal instruction field.\n" + (define-full-ifield name comment attrs start length UINT #f #f) +) + +; For those who don't like typing. + +(define-pmacro df + "Shorthand form of define-full-ifield.\n" + define-full-ifield +) +(define-pmacro dnf + "Shorthand form of define-normal-ifield.\n" + define-normal-ifield +) + +; Define a normal multi-ifield. +; FIXME: The define-normal version for ifields doesn't include the mode. + +(define-pmacro (define-normal-multi-ifield name comment attrs + mode subflds insert extract) + "Define a normal multi-part instruction field.\n" + (define-full-multi-ifield name comment attrs mode subflds insert extract) +) + +; For those who don't like typing. + +(define-pmacro dnmf + "Shorthand form of define-normal-multi-ifield.\n" + define-normal-multi-ifield +) + +; Simple multi-ifields: mode is UINT, default insert/extract support. + +(define-pmacro (dsmf name comment attrs subflds) + "Define a simple multi-part instruction field.\n" + (define-full-multi-ifield name comment attrs UINT subflds #f #f) +) + +; Hardware. + +; Simpler version for most hardware elements. +; Allow special assembler support specification but no semantic-name or +; get/set specs. + +(define-pmacro (define-normal-hardware name comment attrs type + indices values handlers) + "\ +Define a normal hardware element. +" + (define-full-hardware name comment attrs name type + indices values handlers () () ()) +) + +; For those who don't like typing. + +(define-pmacro dnh + "Shorthand form of define-normal-hardware.\n" + define-normal-hardware +) + +; Simpler version of dnh that leaves out the indices, values, handlers, +; get, set, and layout specs. +; This is useful for 1 bit registers. +; ??? While dsh and dnh aren't that distinguishable when perusing a .cpu file, +; they both take a fixed number of positional arguments, and dsh is a proper +; subset of dnh with all arguments in the same positions, so methinks things +; are ok. + +(define-pmacro (define-simple-hardware name comment attrs type) + "\ +Define a simple hardware element (usually a scalar register). +" + (define-full-hardware name comment attrs name type () () () () () ()) +) + +(define-pmacro dsh + "Shorthand form of define-simple-hardware.\n" + define-simple-hardware +) + +; Operands. + +(define-pmacro (define-normal-operand name comment attrs type index) + "Define a normal operand.\n" + (define-full-operand name comment attrs type DFLT index () () ()) +) + +; For those who don't like typing. +; FIXME: dno? + +(define-pmacro dnop + "Shorthand form of define-normal-operand.\n" + define-normal-operand +) + +(define-pmacro (dndo x-name x-mode x-args + x-syntax x-base-ifield x-encoding x-ifield-assertion + x-getter x-setter) + "Define a normal derived operand." + (define-derived-operand + (name x-name) + (mode x-mode) + (args x-args) + (syntax x-syntax) + (base-ifield x-base-ifield) + (encoding x-encoding) + (ifield-assertion x-ifield-assertion) + (getter x-getter) + (setter x-setter) + ) +) + +; Instructions. + +; Define an instruction object, normal version. +; At present all fields must be specified. +; Fields ifield-assertion is absent. + +(define-pmacro (define-normal-insn name comment attrs syntax fmt semantics timing) + "Define a normal instruction.\n" + (define-full-insn name comment attrs syntax fmt () semantics timing) +) + +; To reduce the amount of typing. +; Note that this is the same name as the D'ni in MYST. Oooohhhh..... +; this must be the right way to go. :-) + +(define-pmacro dni + "Shorthand form of define-normal-insn.\n" + define-normal-insn +) + +; Macro instructions. + +; Define a macro-insn object, normal version. +; This only supports expanding to one real insn. + +(define-pmacro (define-normal-macro-insn name comment attrs syntax expansion) + "Define a normal macro instruction.\n" + (define-full-minsn name comment attrs syntax expansion) +) + +; To reduce the amount of typing. + +(define-pmacro dnmi + "Shorthand form of define-normal-macro-insn.\n" + define-normal-macro-insn +) + +; Modes. +; ??? Not currently available for use. +; +; Define Normal Mode +; +;(define-pmacro (define-normal-mode name comment attrs bits bytes +; non-mode-c-type printf-type sem-mode ptr-to host?) +; "Define a normal mode.\n" +; (define-full-mode name comment attrs bits bytes +; non-mode-c-type printf-type sem-mode ptr-to host?) +;) +; +; For those who don't like typing. +;(define-pmacro dnm +; "Shorthand form of define-normal-mode.\n" +; define-normal-mode +;) diff --git a/etc/ChangeLog b/etc/ChangeLog index debe735ca99f2..6865f2df18599 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,12 @@ +2003-05-16 Kelley Cook + + * configure.texi: Use "i[3-7]86" in example. + +2003-01-02 H.J. Lu + + * Makefile.in (DESTDIR): New. + (install-info): Use it. + 2002-06-11 Nick Clifton Import the following patches from the FSF GCC sources: diff --git a/etc/Makefile.in b/etc/Makefile.in index 2bc34574540e2..63f7738c64aee 100644 --- a/etc/Makefile.in +++ b/etc/Makefile.in @@ -2,6 +2,8 @@ # Makefile.in for etc # +DESTDIR = + prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -68,17 +70,17 @@ info: done install-info: info - $(SHELL) $(srcdir)/../mkinstalldirs $(infodir) + $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(infodir) if test ! -f standards.info; then cd $(srcdir); fi; \ if test -f standards.info; then \ for i in standards.info*; do \ - $(INSTALL_DATA) $$i $(infodir)/$$i; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(infodir)/$$i; \ done; \ fi if test ! -f configure.info; then cd $(srcdir); fi; \ if test -f configure.info; then \ for i in configure.info*; do \ - $(INSTALL_DATA) $$i $(infodir)/$$i; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(infodir)/$$i; \ done; \ fi diff --git a/etc/cfg-paper.texi b/etc/cfg-paper.texi deleted file mode 100644 index bcfbb31e13f8c..0000000000000 --- a/etc/cfg-paper.texi +++ /dev/null @@ -1,717 +0,0 @@ -\input texinfo -@c %**start of header -@setfilename cfg-paper.info -@settitle On Configuring Development Tools -@c %**end of header -@setchapternewpage off - -@ifinfo -This document attempts to describe the general concepts behind -configuration of the @sc{gnu} Development Tools. -It also discusses common usage. - -Copyright (C) 1991, 1992, 1994 Cygnus Support -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by Cygnus Support. -@end ifinfo - -@titlepage -@sp 10 -@title{On Configuring Development Tools} -@author{K. Richard Pixley, @code{rich@@cygnus.com}} -@author{Cygnus Support} -@page - -@vskip 0pt plus 1filll -Copyright @copyright{} 1991, 1992, 1994 Cygnus Support - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation approved -by Cygnus Support. -@end titlepage - -@ifinfo -@format -START-INFO-DIR-ENTRY -* configuration: (cfg-paper). Some theory on configuring source. -END-INFO-DIR-ENTRY -@end format -@end ifinfo - -@node top, Some Basic Terms, (dir), (dir) - -@ifinfo -This document attempts to describe the general concepts behind -configuration of the @sc{gnu} Development Tools. -It also discusses common usage. -@end ifinfo - -@menu -* Some Basic Terms:: Some Basic Terms -* Specifics.:: Specifics -* Building Development Environments:: Building Development Environments -* A Walk Through:: A Walk Through -* Final Notes:: Final Notes -* Index:: Index - - --- The Detailed Node Listing --- - -Some Basic Terms - -* Host Environments:: Host Environments -* Configuration Time Options:: Configuration Time Options - -A Walk Through - -* Native Development Environments:: Native Development Environments -* Emulation Environments:: Emulation Environments -* Simple Cross Environments:: Simple Cross Environments -* Crossing Into Targets:: Crossing Into Targets -* Canadian Cross:: Canadian Cross - -Final Notes - -* Hacking Configurations:: Hacking Configurations -@end menu - -@node Some Basic Terms, Specifics., top, top -@chapter Some Basic Terms - -There are a lot of terms that are frequently used when discussing -development tools. Most of the common terms have been used for many -different concepts such that their meanings have become ambiguous to the -point of being confusing. Typically, we only guess at their meanings -from context and we frequently guess wrong. - -This document uses very few terms by comparison. The intent is to make -the concepts as clear as possible in order to convey the usage and -intent of these tools. - -@emph{Programs} run on @emph{machines}. Programs are very nearly always -written in @emph{source}. Programs are @emph{built} from source. -@emph{Compilation} is a process that is frequently, but not always, used -when building programs. -@cindex Programs -@cindex Machines -@cindex Source -@cindex Building -@cindex Compilation - -@menu -* Host Environments:: Host Environments -* Configuration Time Options:: Configuration Time Options -@end menu - -@node Host Environments, Configuration Time Options, Some Basic Terms, Some Basic Terms -@section Host Environments - -@cindex host -In this document, the word @emph{host} refers to the environment in -which the source in question will be compiled. @emph{host} and -@emph{host name} have nothing to do with the proper name of your host, -like @emph{ucbvax}, @emph{prep.ai.mit.edu} or @emph{att.com}. Instead -they refer to things like @emph{sun4} and @emph{dec3100}. - -Forget for a moment that this particular directory of source is the -source for a development environment. Instead, pretend that it is the -source for a simpler, more mundane, application, say, a desk calculator. - -Source that can be compiled in more than one environment, generally -needs to be set up for each environment explicitly. Here we refer to -that process as configuration. That is, we configure the source for a -host. - -For example, if we wanted to configure our mythical desk calculator to -compile on a SparcStation, we might configure for host sun4. With our -configuration system: - -@example -cd desk-calculator ; ./configure sun4 -@end example - -@noindent -does the trick. @code{configure} is a shell script that sets up Makefiles, -subdirectories, and symbolic links appropriate for compiling the source -on a sun4. - -The @emph{host} environment does not necessarily refer to the machine on -which the tools are built. It is possible to provide a sun3 development -environment on a sun4. If we wanted to use a cross compiler on the sun4 -to build a program intended to be run on a sun3, we would configure the -source for sun3. - -@example -cd desk-calculator ; ./configure sun3 -@end example - -@noindent -The fact that we are actually building the program on a sun4 makes no -difference if the sun3 cross compiler presents an environment that looks -like a sun3 from the point of view of the desk calculator source code. -Specifically, the environment is a sun3 environment if the header files, -predefined symbols, and libraries appear as they do on a sun3. - -Nor does the host environment refer to the the machine on which the -program to be built will run. It is possible to provide a sun3 -emulation environment on a sun4 such that programs built in a sun3 -development environment actually run on the sun4. This technique is -often used within individual programs to remedy deficiencies in the host -operating system. For example, some operating systems do not provide -the @code{bcopy} function and so it is emulated using the -@code{memcpy} funtion. - -Host environment simply refers to the environment in which the program -will be built from the source. - - -@node Configuration Time Options, , Host Environments, Some Basic Terms -@section Configuration Time Options - -Many programs have compile time options. That is, features of the -program that are either compiled into the program or not based on a -choice made by the person who builds the program. We refer to these as -@emph{configuration options}. For example, our desk calculator might be -capable of being compiled into a program that either uses infix notation -or postfix as a configuration option. For a sun3, to choose infix you -might use: - -@example -./configure sun3 --enable-notation=infix -@end example - -@noindent -while for a sun4 with postfix you might use: - -@example -./configure sun4 --enable-notation=postfix -@end example - -If we wanted to build both at the same time, the intermediate pieces -used in the build process must be kept separate. - -@example -mkdir ../objdir.sun4 -(cd ../objdir.sun4 ; ../configure sun4 --enable-notation=postfix --srcdir=../src) -mkdir ../objdir.sun3 -(cd ../objdir.sun3 ; ../configure sun3 --enable-notation=infix --srcdir=../src) -@end example - -@noindent -will create subdirectories for the intermediate pieces of the sun4 and -sun3 configurations. This is necessary as previous systems were only -capable of one configuration at a time. Otherwise, a second -configuration would write over the first. We've chosen to retain this -behaviour so the obj directories and the @code{--srcdir} configuration -option are necessary to get the new behaviour. The order of the -arguments doesn't matter. There should be exactly one argument without -a leading @samp{-} and that argument will be assumed to be the host -name. - -From here on the examples will assume that you want to build the tools -@emph{in place} and won't show the @code{--srcdir} option, but remember -that it is available. - -In order to actually install the program, the configuration system needs -to know where you would like the program installed. The default -location is @file{/usr/local}. We refer to this location as -@code{$(prefix)}. All user visible programs will be installed in -@file{@code{$(prefix)}/bin}. All other programs and files will be -installed in a subdirectory of @file{@code{$(prefix)}/lib}. - -You can only change @code{$(prefix)} as a configuration time -option. - -@example -./configure sun4 --enable-notation=postfix --prefix=/local -@end example - -@noindent -Will configure the source such that: - -@example -make install -@end example - -@noindent -will put its programs in @file{/local/bin} and @file{/local/lib/gcc}. -If you change @code{$(prefix)} after building the source, you will need -to: - -@example -make clean -@end example - -@noindent -before the change will be propogated properly. This is because some -tools need to know the locations of other tools. - -With these concepts in mind, we can drop the desk calculator example and -move on to the application that resides in these directories, namely, -the source to a development environment. - -@node Specifics., Building Development Environments, Some Basic Terms, top -@chapter Specifics - -The @sc{gnu} Development Tools can be built on a wide variety of hosts. So, -of course, they must be configured. Like the last example, - -@example -./configure sun4 --prefix=/local -./configure sun3 --prefix=/local -@end example - -@noindent -will configure the source to be built in subdirectories, in order to -keep the intermediate pieces separate, and to be installed in -@file{/local}. - -When built with suitable development environments, these will be native -tools. We'll explain the term @emph{native} later. - -@node Building Development Environments, A Walk Through, Specifics., top -@chapter Building Development Environments - -@cindex Target - -The @sc{gnu} development tools can not only be built in a -number of host development environments, they can also be configured to -create a number of different development environments on each of those -hosts. We refer to a specific development environment created as a -@emph{target}. That is, the word @emph{target} refers to the development -environment produced by compiling this source and installing the -resulting programs. - -For the @sc{gnu} development tools, the default target is the -same as the host. That is, the development environment produced is -intended to be compatible with the environment used to build the tools. - -In the example above, we created two configurations, one for sun4 and -one for sun3. The first configuration is expecting to be built in a -sun4 development environment, to create a sun4 development environment. -It doesn't necessarily need to be built on a sun4 if a sun4 development -environment is available elsewhere. Likewise, if the available sun4 -development environment produces executables intended for something -other than sun4, then the development environment built from this sun4 -configuration will run on something other than a sun4. From the point -of view of the configuration system and the @sc{gnu} development tools -source, this doesn't matter. What matters is that they will be built in -a sun4 environment. - -Similarly, the second configuration given above is expecting to be built -in a sun3 development environment, to create a sun3 development -environment. - -The development environment produced is a configuration time option, -just like @code{$(prefix)}. - -@example -./configure sun4 --prefix=/local --target=sun3 -./configure sun3 --prefix=/local --target=sun4 -@end example - -In this example, like before, we create two configurations. The first -is intended to be built in a sun4 environment, in subdirectories, to be -installed in @file{/local}. The second is intended to be built in a -sun3 environment, in subdirectories, to be installed in @file{/local}. - -Unlike the previous example, the first configuration will produce a sun3 -development environment, perhaps even suitable for building the second -configuration. Likewise, the second configuration will produce a sun4 -development environment, perhaps even suitable for building the first -configuration. - -The development environment used to build these configurations will -determine the machines on which the resulting development environments -can be used. - - -@node A Walk Through, Final Notes, Building Development Environments, top -@chapter A Walk Through - - -@menu -* Native Development Environments:: Native Development Environments -* Emulation Environments:: Emulation Environments -* Simple Cross Environments:: Simple Cross Environments -* Crossing Into Targets:: Crossing Into Targets -* Canadian Cross:: Canadian Cross -@end menu - -@node Native Development Environments, Emulation Environments, A Walk Through, A Walk Through -@section Native Development Environments - -Let us assume for a moment that you have a sun4 and that with your sun4 -you received a development environment. This development environment is -intended to be run on your sun4 to build programs that can be run on -your sun4. You could, for instance, run this development environment on -your sun4 to build our example desk calculator program. You could then -run the desk calculator program on your sun4. - -@cindex Native -@cindex Foreign -The resulting desk calculator program is referred to as a @emph{native} -program. The development environment itself is composed of native -programs that, when run, build other native programs. Any other program -is referred to as @emph{foreign}. Programs intended for other machines are -foreign programs. - -This type of development environment, which is by far the most common, -is refered to as @emph{native}. That is, a native development environment -runs on some machine to build programs for that same machine. The -process of using a native development environment to build native -programs is called a @emph{native} build. - -@example -./configure sun4 -@end example - -@noindent -will configure this source such that when built in a sun4 development -environment, with a development environment that builds programs -intended to be run on sun4 machines, the programs built will be native -programs and the resulting development environment will be a native -development environment. - -The development system that came with your sun4 is one such environment. -Using it to build the @sc{gnu} Development Tools is a very common activity -and the resulting development environment is quite popular. - -@example -make all -@end example - -@noindent -will build the tools as configured and will assume that you want to use -the native development environment that came with your machine. - -@cindex Bootstrapping -@cindex Stage1 -Using a development environment to build a development environment is -called @emph{bootstrapping}. The release of the @sc{gnu} -Development Tools is capable of bootstrapping itself. This is a very -powerful feature that we'll return to later. For now, let's pretend -that you used the native development environment that came with your -sun4 to bootstrap the release and let's call the new -development environment @emph{stage1}. - -Why bother? Well, most people find that the @sc{gnu} development -environment builds programs that run faster and take up less space than -the native development environments that came with their machines. Some -people didn't get development environments with their machines and some -people just like using the @sc{gnu} tools better than using other tools. - -@cindex Stage2 -While you're at it, if the @sc{gnu} tools produce better programs, maybe you -should use them to build the @sc{gnu} tools. So let's -pretend that you do. Let's call the new development environment -@emph{stage2}. - -@cindex Stage3 -So far you've built a development environment, stage1, and you've used -stage1 to build a new, faster and smaller development environment, -stage2, but you haven't run any of the programs that the @sc{gnu} tools have -built. You really don't yet know if these tools work. Do you have any -programs built with the @sc{gnu} tools? Yes, you do. stage2. What does -that program do? It builds programs. Ok, do you have any source handy -to build into a program? Yes, you do. The @sc{gnu} tools themselves. In -fact, if you use stage2 to build the @sc{gnu} tools again the resulting -programs should be identical to stage2. Let's pretend that you do and -call the new development environment @emph{stage3}. - -@cindex Three stage boot -You've just completed what's called a @emph{three stage boot}. You now have -a small, fast, somewhat tested, development environment. - -@example -make bootstrap -@end example - -@noindent -will do a three stage boot across all tools and will compare stage2 to -stage3 and complain if they are not identical. - -Once built, - -@example -make install -@end example - -@noindent -will install the development environment in the default location, or in -@code{$(prefix)} if you specified an alternate when you configured. - -@cindex Cross -Any development environment that is not a native development environment -is refered to as a @emph{cross} development environment. There are many -different types of cross development environments but most fall into one -of three basic categories. - - -@node Emulation Environments, Simple Cross Environments, Native Development Environments, A Walk Through -@section Emulation Environments - -@cindex Emulation -The first category of cross development environment is called -@emph{emulation}. There are two primary types of emulation, but both -types result in programs that run on the native host. - -@cindex Software emulation -@cindex Software emulator -The first type is @emph{software emulation}. This form of cross -development environment involves a native program that when run on the -native host, is capable of interpreting, and in most aspects running, a -program intended for some other machine. This technique is typically -used when the other machine is either too expensive, too slow, too fast, -or not available, perhaps because it hasn't yet been built. The native, -interpreting program is called a @emph{software emulator}. - -The @sc{gnu} Development Tools do not currently include any software -emulators. Some do exist and the @sc{gnu} Development Tools can be -configured to create simple cross development environments for with -these emulators. More on this later. - -The second type of emulation is when source intended for some other -development environment is built into a program intended for the native -host. The concepts of operating system universes and hosted operating -systems are two such development environments. - -@node Simple Cross Environments, Crossing Into Targets, Emulation Environments, A Walk Through -@section Simple Cross Environments - -@example -./configure sun4 --target=a29k -@end example - -@noindent -will configure the tools such that when compiled in a sun4 development -environment the resulting development environment can be used to create -programs intended for an a29k. Again, this does not necessarily mean -that the new development environment can be run on a sun4. That would -depend on the development environment used to build these tools. - -Earlier you saw how to configure the tools to build a native development -environment, that is, a development environment that runs on your sun4 -and builds programs for your sun4. Let's pretend that you use stage3 to -build this simple cross configuration and let's call the new development -environment gcc-a29k. Remember that this is a native build. Gcc-a29k -is a collection of native programs intended to run on your sun4. That's -what stage3 builds, programs for your sun4. Gcc-a29k represents an a29k -development environment that builds programs intended to run on an a29k. -But, remember, gcc-a29k runs on your sun4. Programs built with gcc-a29k -will run on your sun4 only with the help of an appropriate software -emulator. - -@cindex Simple cross -@cindex Crossing to -Building gcc-a29k is also a bootstrap but of a slightly different sort. -We call gcc-a29k a @emph{simple cross} environment and using gcc-a29k to -build a program intended for a29k is called @emph{crossing to} a29k. -Simple cross environments are the second category of cross development -environments. - - -@node Crossing Into Targets, Canadian Cross, Simple Cross Environments, A Walk Through -@section Crossing Into Targets - -@example -./configure a29k --target=a29k -@end example - -@noindent -will configure the tools such that when compiled in an a29k development -environment, the resulting development environment can be used to create -programs intended for an a29k. Again, this does not necessarily mean -that the new development environment can be run on an a29k. That would -depend on the development environment used to build these tools. - -If you've been following along this walk through, then you've already -built an a29k environment, namely gcc-a29k. Let's pretend you use -gcc-a29k to build the current configuration. - -Gcc-a29k builds programs intended for the a29k so the new development -environment will be intended for use on an a29k. That is, this new gcc -consists of programs that are foreign to your sun4. They cannot be run -on your sun4. - -@cindex Crossing into -The process of building this configuration is a another bootstrap. This -bootstrap is also a cross to a29k. Because this type of build is both a -bootstrap and a cross to a29k, it is sometimes referred to as a -@emph{cross into} a29k. This new development environment isn't really a -cross development environment at all. It is intended to run on an a29k -to produce programs for an a29k. You'll remember that this makes it, by -definition, an a29k native compiler. @emph{Crossing into} has been -introduced here not because it is a type of cross development -environment, but because it is frequently mistaken as one. The process -is @emph{a cross} but the resulting development environment is a native -development environment. - -You could not have built this configuration with stage3, because stage3 -doesn't provide an a29k environment. Instead it provides a sun4 -environment. - -If you happen to have an a29k lying around, you could now use this fresh -development environment on the a29k to three-stage these tools all over -again. This process would look just like it did when we built the -native sun4 development environment because we would be building another -native development environment, this one on a29k. - - -@node Canadian Cross, , Crossing Into Targets, A Walk Through -@section Canadian Cross - -So far you've seen that our development environment source must be -configured for a specific host and for a specific target. You've also -seen that the resulting development environment depends on the -development environment used in the build process. - -When all four match identically, that is, the configured host, the -configured target, the environment presented by the development -environment used in the build, and the machine on which the resulting -development environment is intended to run, then the new development -environment will be a native development environment. - -When all four match except the configured host, then we can assume that -the development environment used in the build is some form of library -emulation. - -When all four match except for the configured target, then the resulting -development environment will be a simple cross development environment. - -When all four match except for the host on which the development -environment used in the build runs, the build process is a @emph{cross into} -and the resulting development environment will be native to some other -machine. - -Most of the other permutations do exist in some form, but only one more -is interesting to the current discussion. - -@example -./configure a29k --target=sun3 -@end example - -@noindent -will configure the tools such that when compiled in an a29k development -environment, the resulting development environment can be used to create -programs intended for a sun3. Again, this does not necessarily mean -that the new development environment can be run on an a29k. That would -depend on the development environment used to build these tools. - -If you are still following along, then you have two a29k development -environments, the native development environment that runs on a29k, and -the simple cross that runs on your sun4. If you use the a29k native -development environment on the a29k, you will be doing the same thing we -did a while back, namely building a simple cross from a29k to sun3. -Let's pretend that instead, you use gcc-a29k, the simple cross -development environment that runs on sun4 but produces programs for -a29k. - -The resulting development environment will run on a29k because that's -what gcc-a29k builds, a29k programs. This development environment will -produce programs for a sun3 because that is how it was configured. This -means that the resulting development environment is a simple cross. - -@cindex Canadian Cross -@cindex Three party cross -There really isn't a common name for this process because very few -development environments are capable of being configured this -extensively. For the sake of discussion, let's call this process a -@emph{Canadian cross}. It's a three party cross, Canada has a three -party system, hence Canadian Cross. - -@node Final Notes, Index, A Walk Through, top -@chapter Final Notes - -By @emph{configures}, I mean that links, Makefile, .gdbinit, and -config.status are built. Configuration is always done from the source -directory. - -@table @code - -@item ./configure @var{name} -configures this directory, perhaps recursively, for a single host+target -pair where the host and target are both @var{name}. If a previous -configuration existed, it will be overwritten. - -@item ./configure @var{hostname} --target=@var{targetname} -configures this directory, perhaps recursively, for a single host+target -pair where the host is @var{hostname} and target is @var{targetname}. -If a previous configuration existed, it will be overwritten. - -@end table - -@menu -* Hacking Configurations:: Hacking Configurations -@end menu - -@node Hacking Configurations, , Final Notes, Final Notes -@section Hacking Configurations - -The configure scripts essentially do three things, create subdirectories -if appropriate, build a @file{Makefile}, and create links to files, all -based on and tailored to, a specific host+target pair. The scripts also -create a @file{.gdbinit} if appropriate but this is not tailored. - -The Makefile is created by prepending some variable definitions to a -Makefile template called @file{Makefile.in} and then inserting host and -target specific Makefile fragments. The variables are set based on the -chosen host+target pair and build style, that is, if you use -@code{--srcdir} or not. The host and target specific Makefile may or may -not exist. - -@itemize @bullet - -@item -Makefiles can be edited directly, but those changes will eventually be -lost. Changes intended to be permanent for a specific host should be -made to the host specific Makefile fragment. This should be in -@file{./config/mh-@var{host}} if it exists. Changes intended to be -permanent for a specific target should be made to the target specific -Makefile fragment. This should be in @file{./config/mt-@var{target}} if -it exists. Changes intended to be permanent for the directory should be -made in @file{Makefile.in}. To propogate changes to any of these, -either use @code{make Makefile} or @code{./config.status} or -re-configure. - -@end itemize - -@page -@node Index, , Final Notes, top -@appendix Index - -@printindex cp - -@contents -@bye - -@c Local Variables: -@c fill-column: 72 -@c End: diff --git a/etc/configure.info b/etc/configure.info new file mode 100644 index 0000000000000..1f6bfc6acb29b --- /dev/null +++ b/etc/configure.info @@ -0,0 +1,2748 @@ +This is configure.info, produced by makeinfo version 4.6 from +./configure.texi. + +INFO-DIR-SECTION GNU admin +START-INFO-DIR-ENTRY +* configure: (configure). The GNU configure and build system +END-INFO-DIR-ENTRY + + This file documents the GNU configure and build system. + + Copyright (C) 1998 Cygnus Solutions. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, provided that +the entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions, except that this permission notice may be stated in a +translation approved by the Foundation. + + +File: configure.info, Node: Top, Next: Introduction, Up: (dir) + +GNU configure and build system +****************************** + +The GNU configure and build system. + +* Menu: + +* Introduction:: Introduction. +* Getting Started:: Getting Started. +* Files:: Files. +* Configuration Names:: Configuration Names. +* Cross Compilation Tools:: Cross Compilation Tools. +* Canadian Cross:: Canadian Cross. +* Cygnus Configure:: Cygnus Configure. +* Multilibs:: Multilibs. +* FAQ:: Frequently Asked Questions. +* Index:: Index. + + +File: configure.info, Node: Introduction, Next: Getting Started, Prev: Top, Up: Top + +Introduction +************ + +This document describes the GNU configure and build systems. It +describes how autoconf, automake, libtool, and make fit together. It +also includes a discussion of the older Cygnus configure system. + + This document does not describe in detail how to use each of the +tools; see the respective manuals for that. Instead, it describes +which files the developer must write, which files are machine generated +and how they are generated, and where certain common problems should be +addressed. + + This document draws on several sources, including the autoconf +manual by David MacKenzie (*note autoconf overview: (autoconf)Top.), +the automake manual by David MacKenzie and Tom Tromey (*note automake +overview: (automake)Top.), the libtool manual by Gordon Matzigkeit +(*note libtool overview: (libtool)Top.), and the Cygnus configure +manual by K. Richard Pixley. + +* Menu: + +* Goals:: Goals. +* Tools:: The tools. +* History:: History. +* Building:: Building. + + +File: configure.info, Node: Goals, Next: Tools, Up: Introduction + +Goals +===== + +The GNU configure and build system has two main goals. + + The first is to simplify the development of portable programs. The +system permits the developer to concentrate on writing the program, +simplifying many details of portability across Unix and even Windows +systems, and permitting the developer to describe how to build the +program using simple rules rather than complex Makefiles. + + The second is to simplify the building of programs distributed as +source code. All programs are built using a simple, standardized, two +step process. The program builder need not install any special tools in +order to build the program. + + +File: configure.info, Node: Tools, Next: History, Prev: Goals, Up: Introduction + +Tools +===== + +The GNU configure and build system is comprised of several different +tools. Program developers must build and install all of these tools. + + People who just want to build programs from distributed sources +normally do not need any special tools beyond a Unix shell, a make +program, and a C compiler. + +autoconf + provides a general portability framework, based on testing the + features of the host system at build time. + +automake + a system for describing how to build a program, permitting the + developer to write a simplified `Makefile'. + +libtool + a standardized approach to building shared libraries. + +gettext + provides a framework for translation of text messages into other + languages; not really discussed in this document. + +m4 + autoconf requires the GNU version of m4; the standard Unix m4 does + not suffice. + +perl + automake requires perl. + + +File: configure.info, Node: History, Next: Building, Prev: Tools, Up: Introduction + +History +======= + +This is a very brief and probably inaccurate history. + + As the number of Unix variants increased during the 1980s, it became +harder to write programs which could run on all variants. While it was +often possible to use `#ifdef' to identify particular systems, +developers frequently did not have access to every system, and the +characteristics of some systems changed from version to version. + + By 1992, at least three different approaches had been developed: + * The Metaconfig program, by Larry Wall, Harlan Stenn, and Raphael + Manfredi. + + * The Cygnus configure script, by K. Richard Pixley, and the gcc + configure script, by Richard Stallman. These use essentially the + same approach, and the developers communicated regularly. + + * The autoconf program, by David MacKenzie. + + The Metaconfig program is still used for Perl and a few other +programs. It is part of the Dist package. I do not know if it is +being developed. + + In 1994, David MacKenzie and others modified autoconf to incorporate +all the features of Cygnus configure. Since then, there has been a +slow but steady conversion of GNU programs from Cygnus configure to +autoconf. gcc has been converted, eliminating the gcc configure script. + + GNU autoconf was regularly maintained until late 1996. As of this +writing in June, 1998, it has no public maintainer. + + Most programs are built using the make program, which requires the +developer to write Makefiles describing how to build the programs. +Since most programs are built in pretty much the same way, this led to a +lot of duplication. + + The X Window system is built using the imake tool, which uses a +database of rules to eliminate the duplication. However, building a +tool which was developed using imake requires that the builder have +imake installed, violating one of the goals of the GNU system. + + The new BSD make provides a standard library of Makefile fragments, +which permits developers to write very simple Makefiles. However, this +requires that the builder install the new BSD make program. + + In 1994, David MacKenzie wrote the first version of automake, which +permitted writing a simple build description which was converted into a +Makefile which could be used by the standard make program. In 1995, Tom +Tromey completely rewrote automake in Perl, and he continues to enhance +it. + + Various free packages built libraries, and by around 1995 several +included support to build shared libraries on various platforms. +However, there was no consistent approach. In early 1996, Gordon +Matzigkeit began working on libtool, which provided a standardized +approach to building shared libraries. This was integrated into +automake from the start. + + The development of automake and libtool was driven by the GNITS +project, a group of GNU maintainers who designed standardized tools to +help meet the GNU coding standards. + + +File: configure.info, Node: Building, Prev: History, Up: Introduction + +Building +======== + +Most readers of this document should already know how to build a tool by +running `configure' and `make'. This section may serve as a quick +introduction or reminder. + + Building a tool is normally as simple as running `configure' +followed by `make'. You should normally run `configure' from an empty +directory, using some path to refer to the `configure' script in the +source directory. The directory in which you run `configure' is called +the "object directory". + + In order to use a object directory which is different from the source +directory, you must be using the GNU version of `make', which has the +required `VPATH' support. Despite this restriction, using a different +object directory is highly recommended: + * It keeps the files generated during the build from cluttering up + your sources. + + * It permits you to remove the built files by simply removing the + entire build directory. + + * It permits you to build from the same sources with several sets of + configure options simultaneously. + + If you don't have GNU `make', you will have to run `configure' in +the source directory. All GNU packages should support this; in +particular, GNU packages should not assume the presence of GNU `make'. + + After running `configure', you can build the tools by running `make'. + + To install the tools, run `make install'. Installing the tools will +copy the programs and any required support files to the "installation +directory". The location of the installation directory is controlled +by `configure' options, as described below. + + In the Cygnus tree at present, the info files are built and +installed as a separate step. To build them, run `make info'. To +install them, run `make install-info'. + + All `configure' scripts support a wide variety of options. The most +interesting ones are `--with' and `--enable' options which are +generally specific to particular tools. You can usually use the +`--help' option to get a list of interesting options for a particular +configure script. + + The only generic options you are likely to use are the `--prefix' +and `--exec-prefix' options. These options are used to specify the +installation directory. + + The directory named by the `--prefix' option will hold machine +independent files such as info files. + + The directory named by the `--exec-prefix' option, which is normally +a subdirectory of the `--prefix' directory, will hold machine dependent +files such as executables. + + The default for `--prefix' is `/usr/local'. The default for +`--exec-prefix' is the value used for `--prefix'. + + The convention used in Cygnus releases is to use a `--prefix' option +of `/usr/cygnus/RELEASE', where RELEASE is the name of the release, and +to use a `--exec-prefix' option of `/usr/cygnus/RELEASE/H-HOST', where +HOST is the configuration name of the host system (*note Configuration +Names::). + + Do not use either the source or the object directory as the +installation directory. That will just lead to confusion. + + +File: configure.info, Node: Getting Started, Next: Files, Prev: Introduction, Up: Top + +Getting Started +*************** + +To start using the GNU configure and build system with your software +package, you must write three files, and you must run some tools to +manually generate additional files. + +* Menu: + +* Write configure.in:: Write configure.in. +* Write Makefile.am:: Write Makefile.am. +* Write acconfig.h:: Write acconfig.h. +* Generate files:: Generate files. +* Getting Started Example:: Example. + + +File: configure.info, Node: Write configure.in, Next: Write Makefile.am, Up: Getting Started + +Write configure.in +================== + +You must first write the file `configure.in'. This is an autoconf +input file, and the autoconf manual describes in detail what this file +should look like. + + You will write tests in your `configure.in' file to check for +conditions that may change from one system to another, such as the +presence of particular header files or functions. + + For example, not all systems support the `gettimeofday' function. +If you want to use the `gettimeofday' function when it is available, +and to use some other function when it is not, you would check for this +by putting `AC_CHECK_FUNCS(gettimeofday)' in `configure.in'. + + When the configure script is run at build time, this will arrange to +define the preprocessor macro `HAVE_GETTIMEOFDAY' to the value 1 if the +`gettimeofday' function is available, and to not define the macro at +all if the function is not available. Your code can then use `#ifdef' +to test whether it is safe to call `gettimeofday'. + + If you have an existing body of code, the `autoscan' program may +help identify potential portability problems, and hence configure tests +that you will want to use. *Note Invoking autoscan: (autoconf)Invoking +autoscan. + + Another handy tool for an existing body of code is `ifnames'. This +will show you all the preprocessor conditionals that the code already +uses. *Note Invoking ifnames: (autoconf)Invoking ifnames. + + Besides the portability tests which are specific to your particular +package, every `configure.in' file should contain the following macros. + +`AC_INIT' + This macro takes a single argument, which is the name of a file in + your package. For example, `AC_INIT(foo.c)'. + +`AC_PREREQ(VERSION)' + This macro is optional. It may be used to indicate the version of + `autoconf' that you are using. This will prevent users from + running an earlier version of `autoconf' and perhaps getting an + invalid `configure' script. For example, `AC_PREREQ(2.12)'. + +`AM_INIT_AUTOMAKE' + This macro takes two arguments: the name of the package, and a + version number. For example, `AM_INIT_AUTOMAKE(foo, 1.0)'. (This + macro is not needed if you are not using automake). + +`AM_CONFIG_HEADER' + This macro names the header file which will hold the preprocessor + macro definitions at run time. Normally this should be + `config.h'. Your sources would then use `#include "config.h"' to + include it. + + This macro may optionally name the input file for that header + file; by default, this is `config.h.in', but that file name works + poorly on DOS filesystems. Therefore, it is often better to name + it explicitly as `config.in'. + + This is what you should normally put in `configure.in': + AM_CONFIG_HEADER(config.h:config.in) + + (If you are not using automake, use `AC_CONFIG_HEADER' rather than + `AM_CONFIG_HEADER'). + +`AM_MAINTAINER_MODE' + This macro always appears in Cygnus configure scripts. Other + programs may or may not use it. + + If this macro is used, the `--enable-maintainer-mode' option is + required to enable automatic rebuilding of generated files used by + the configure system. This of course requires that developers be + aware of, and use, that option. + + If this macro is not used, then the generated files will always be + rebuilt automatically. This will cause problems if the wrong + versions of autoconf, automake, or others are in the builder's + `PATH'. + + (If you are not using automake, you do not need to use this macro). + +`AC_EXEEXT' + Either this macro or `AM_EXEEXT' always appears in Cygnus configure + files. Other programs may or may not use one of them. + + This macro looks for the executable suffix used on the host + system. On Unix systems, this is the empty string. On Windows + systems, this is `.exe'. This macro directs automake to use the + executable suffix as appropriate when creating programs. This + macro does not take any arguments. + + The `AC_EXEEXT' form is new, and is part of a Cygnus patch to + autoconf to support compiling with Visual C++. Older programs use + `AM_EXEEXT' instead. + + (Programs which do not use automake use neither `AC_EXEEXT' nor + `AM_EXEEXT'). + +`AC_PROG_CC' + If you are writing C code, you will normally want to use this + macro. It locates the C compiler to use. It does not take any + arguments. + + However, if this `configure.in' file is for a library which is to + be compiled by a cross compiler which may not fully work, then you + will not want to use `AC_PROG_CC'. Instead, you will want to use a + variant which does not call the macro `AC_PROG_CC_WORKS'. Examples + can be found in various `configure.in' files for libraries that are + compiled with cross compilers, such as libiberty or libgloss. + This is essentially a bug in autoconf, and there will probably be + a better workaround at some point. + +`AC_PROG_CXX' + If you are writing C++ code, you will want to use this macro. It + locates the C++ compiler to use. It does not take any arguments. + The same cross compiler comments apply as for `AC_PROG_CC'. + +`AM_PROG_LIBTOOL' + If you want to build libraries, and you want to permit them to be + shared, or you want to link against libraries which were built + using libtool, then you will need this macro. This macro is + required in order to use libtool. + + By default, this will cause all libraries to be built as shared + libraries. To prevent this-to change the default-use + `AM_DISABLE_SHARED' before `AM_PROG_LIBTOOL'. The configure + options `--enable-shared' and `--disable-shared' may be used to + override the default at build time. + +`AC_DEFINE(_GNU_SOURCE)' + GNU packages should normally include this line before any other + feature tests. This defines the macro `_GNU_SOURCE' when + compiling, which directs the libc header files to provide the + standard GNU system interfaces including all GNU extensions. If + this macro is not defined, certain GNU extensions may not be + available. + +`AC_OUTPUT' + This macro takes a list of file names which the configure process + should produce. This is normally a list of one or more `Makefile' + files in different directories. If your package lives entirely in + a single directory, you would use simply `AC_OUTPUT(Makefile)'. + If you also have, for example, a `lib' subdirectory, you would use + `AC_OUTPUT(Makefile lib/Makefile)'. + + If you want to use locally defined macros in your `configure.in' +file, then you will need to write a `acinclude.m4' file which defines +them (if not using automake, this file is called `aclocal.m4'). +Alternatively, you can put separate macros in an `m4' subdirectory, and +put `ACLOCAL_AMFLAGS = -I m4' in your `Makefile.am' file so that the +`aclocal' program will be able to find them. + + The different macro prefixes indicate which tool defines the macro. +Macros which start with `AC_' are part of autoconf. Macros which start +with `AM_' are provided by automake or libtool. + + +File: configure.info, Node: Write Makefile.am, Next: Write acconfig.h, Prev: Write configure.in, Up: Getting Started + +Write Makefile.am +================= + +You must write the file `Makefile.am'. This is an automake input file, +and the automake manual describes in detail what this file should look +like. + + The automake commands in `Makefile.am' mostly look like variable +assignments in a `Makefile'. automake recognizes special variable +names, and automatically add make rules to the output as needed. + + There will be one `Makefile.am' file for each directory in your +package. For each directory with subdirectories, the `Makefile.am' +file should contain the line + SUBDIRS = DIR DIR ... + +where each DIR is the name of a subdirectory. + + For each `Makefile.am', there should be a corresponding `Makefile' +in the `AC_OUTPUT' macro in `configure.in'. + + Every `Makefile.am' written at Cygnus should contain the line + AUTOMAKE_OPTIONS = cygnus + +This puts automake into Cygnus mode. See the automake manual for +details. + + You may to include the version number of `automake' that you are +using on the `AUTOMAKE_OPTIONS' line. For example, + AUTOMAKE_OPTIONS = cygnus 1.3 + +This will prevent users from running an earlier version of `automake' +and perhaps getting an invalid `Makefile.in'. + + If your package builds a program, then in the directory where that +program is built you will normally want a line like + bin_PROGRAMS = PROGRAM + +where PROGRAM is the name of the program. You will then want a line +like + PROGRAM_SOURCES = FILE FILE ... + +where each FILE is the name of a source file to link into the program +(e.g., `foo.c'). + + If your package builds a library, and you do not want the library to +ever be built as a shared library, then in the directory where that +library is built you will normally want a line like + lib_LIBRARIES = libNAME.a + +where `libNAME.a' is the name of the library. You will then want a +line like + libNAME_a_SOURCES = FILE FILE ... + +where each FILE is the name of a source file to add to the library. + + If your package builds a library, and you want to permit building the +library as a shared library, then in the directory where that library is +built you will normally want a line like + lib_LTLIBRARIES = libNAME.la + The use of `LTLIBRARIES', and the `.la' extension, indicate a +library to be built using libtool. As usual, you will then want a line +like + libNAME_la_SOURCES = FILE FILE ... + + The strings `bin' and `lib' that appear above in `bin_PROGRAMS' and +`lib_LIBRARIES' are not arbitrary. They refer to particular +directories, which may be set by the `--bindir' and `--libdir' options +to `configure'. If those options are not used, the default values are +based on the `--prefix' or `--exec-prefix' options to `configure'. It +is possible to use other names if the program or library should be +installed in some other directory. + + The `Makefile.am' file may also contain almost anything that may +appear in a normal `Makefile'. automake also supports many other +special variables, as well as conditionals. + + See the automake manual for more information. + + +File: configure.info, Node: Write acconfig.h, Next: Generate files, Prev: Write Makefile.am, Up: Getting Started + +Write acconfig.h +================ + +If you are generating a portability header file, (i.e., you are using +`AM_CONFIG_HEADER' in `configure.in'), then you will have to write a +`acconfig.h' file. It will have to contain the following lines. + + /* Name of package. */ + #undef PACKAGE + + /* Version of package. */ + #undef VERSION + + This requirement is really a bug in the system, and the requirement +may be eliminated at some later date. + + The `acconfig.h' file will also similar comment and `#undef' lines +for any unusual macros in the `configure.in' file, including any macro +which appears in a `AC_DEFINE' macro. + + In particular, if you are writing a GNU package and therefore include +`AC_DEFINE(_GNU_SOURCE)' in `configure.in' as suggested above, you will +need lines like this in `acconfig.h': + /* Enable GNU extensions. */ + #undef _GNU_SOURCE + + Normally the `autoheader' program will inform you of any such +requirements by printing an error message when it is run. However, if +you do anything particular odd in your `configure.in' file, you will +have to make sure that the right entries appear in `acconfig.h', since +otherwise the results of the tests may not be available in the +`config.h' file which your code will use. + + (Thee `PACKAGE' and `VERSION' lines are not required if you are not +using automake, and in that case you may not need a `acconfig.h' file +at all). + + +File: configure.info, Node: Generate files, Next: Getting Started Example, Prev: Write acconfig.h, Up: Getting Started + +Generate files +============== + +Once you have written `configure.in', `Makefile.am', `acconfig.h', and +possibly `acinclude.m4', you must use autoconf and automake programs to +produce the first versions of the generated files. This is done by +executing the following sequence of commands. + + aclocal + autoconf + autoheader + automake + + The `aclocal' and `automake' commands are part of the automake +package, and the `autoconf' and `autoheader' commands are part of the +autoconf package. + + If you are using a `m4' subdirectory for your macros, you will need +to use the `-I m4' option when you run `aclocal'. + + If you are not using the Cygnus tree, use the `-a' option when +running `automake' command in order to copy the required support files +into your source directory. + + If you are using libtool, you must build and install the libtool +package with the same `--prefix' and `--exec-prefix' options as you +used with the autoconf and automake packages. You must do this before +running any of the above commands. If you are not using the Cygnus +tree, you will need to run the `libtoolize' program to copy the libtool +support files into your directory. + + Once you have managed to run these commands without getting any +errors, you should create a new empty directory, and run the `configure' +script which will have been created by `autoconf' with the +`--enable-maintainer-mode' option. This will give you a set of +Makefiles which will include rules to automatically rebuild all the +generated files. + + After doing that, whenever you have changed some of the input files +and want to regenerated the other files, go to your object directory +and run `make'. Doing this is more reliable than trying to rebuild the +files manually, because there are complex order dependencies and it is +easy to forget something. + + +File: configure.info, Node: Getting Started Example, Prev: Generate files, Up: Getting Started + +Example +======= + +Let's consider a trivial example. + + Suppose we want to write a simple version of `touch'. Our program, +which we will call `poke', will take a single file name argument, and +use the `utime' system call to set the modification and access times of +the file to the current time. We want this program to be highly +portable. + + We'll first see what this looks like without using autoconf and +automake, and then see what it looks like with them. + +* Menu: + +* Getting Started Example 1:: First Try. +* Getting Started Example 2:: Second Try. +* Getting Started Example 3:: Third Try. +* Generate Files in Example:: Generate Files. + + +File: configure.info, Node: Getting Started Example 1, Next: Getting Started Example 2, Up: Getting Started Example + +First Try +--------- + +Here is our first try at `poke.c'. Note that we've written it without +ANSI/ISO C prototypes, since we want it to be highly portable. + + #include + #include + #include + #include + + int + main (argc, argv) + int argc; + char **argv; + { + if (argc != 2) + { + fprintf (stderr, "Usage: poke file\n"); + exit (1); + } + + if (utime (argv[1], NULL) < 0) + { + perror ("utime"); + exit (1); + } + + exit (0); + } + + We also write a simple `Makefile'. + + CC = gcc + CFLAGS = -g -O2 + + all: poke + + poke: poke.o + $(CC) -o poke $(CFLAGS) $(LDFLAGS) poke.o + + So far, so good. + + Unfortunately, there are a few problems. + + On older Unix systems derived from BSD 4.3, the `utime' system call +does not accept a second argument of `NULL'. On those systems, we need +to pass a pointer to `struct utimbuf' structure. Unfortunately, even +older systems don't define that structure; on those systems, we need to +pass an array of two `long' values. + + The header file `stdlib.h' was invented by ANSI C, and older systems +don't have a copy. We included it above to get a declaration of `exit'. + + We can find some of these portability problems by running +`autoscan', which will create a `configure.scan' file which we can use +as a prototype for our `configure.in' file. I won't show the output, +but it will notice the potential problems with `utime' and `stdlib.h'. + + In our `Makefile', we don't provide any way to install the program. +This doesn't matter much for such a simple example, but a real program +will need an `install' target. For that matter, we will also want a +`clean' target. + + +File: configure.info, Node: Getting Started Example 2, Next: Getting Started Example 3, Prev: Getting Started Example 1, Up: Getting Started Example + +Second Try +---------- + +Here is our second try at this program. + + We modify `poke.c' to use preprocessor macros to control what +features are available. (I've cheated a bit by using the same macro +names which autoconf will use). + + #include + + #ifdef STDC_HEADERS + #include + #endif + + #include + + #ifdef HAVE_UTIME_H + #include + #endif + + #ifndef HAVE_UTIME_NULL + + #include + + #ifndef HAVE_STRUCT_UTIMBUF + + struct utimbuf + { + long actime; + long modtime; + }; + + #endif + + static int + utime_now (file) + char *file; + { + struct utimbuf now; + + now.actime = now.modtime = time (NULL); + return utime (file, &now); + } + + #define utime(f, p) utime_now (f) + + #endif /* HAVE_UTIME_NULL */ + + int + main (argc, argv) + int argc; + char **argv; + { + if (argc != 2) + { + fprintf (stderr, "Usage: poke file\n"); + exit (1); + } + + if (utime (argv[1], NULL) < 0) + { + perror ("utime"); + exit (1); + } + + exit (0); + } + + Here is the associated `Makefile'. We've added support for the +preprocessor flags we use. We've also added `install' and `clean' +targets. + + # Set this to your installation directory. + bindir = /usr/local/bin + + # Uncomment this if you have the standard ANSI/ISO C header files. + # STDC_HDRS = -DSTDC_HEADERS + + # Uncomment this if you have utime.h. + # UTIME_H = -DHAVE_UTIME_H + + # Uncomment this if utime (FILE, NULL) works on your system. + # UTIME_NULL = -DHAVE_UTIME_NULL + + # Uncomment this if struct utimbuf is defined in utime.h. + # UTIMBUF = -DHAVE_STRUCT_UTIMBUF + + CC = gcc + CFLAGS = -g -O2 + + ALL_CFLAGS = $(STDC_HDRS) $(UTIME_H) $(UTIME_NULL) $(UTIMBUF) $(CFLAGS) + + all: poke + + poke: poke.o + $(CC) -o poke $(ALL_CFLAGS) $(LDFLAGS) poke.o + + .c.o: + $(CC) -c $(ALL_CFLAGS) poke.c + + install: poke + cp poke $(bindir)/poke + + clean: + rm poke poke.o + + Some problems with this approach should be clear. + + Users who want to compile poke will have to know how `utime' works +on their systems, so that they can uncomment the `Makefile' correctly. + + The installation is done using `cp', but many systems have an +`install' program which may be used, and which supports optional +features such as stripping debugging information out of the installed +binary. + + The use of `Makefile' variables like `CC', `CFLAGS' and `LDFLAGS' +follows the requirements of the GNU standards. This is convenient for +all packages, since it reduces surprises for users. However, it is +easy to get the details wrong, and wind up with a slightly nonstandard +distribution. + + +File: configure.info, Node: Getting Started Example 3, Next: Generate Files in Example, Prev: Getting Started Example 2, Up: Getting Started Example + +Third Try +--------- + +For our third try at this program, we will write a `configure.in' +script to discover the configuration features on the host system, rather +than requiring the user to edit the `Makefile'. We will also write a +`Makefile.am' rather than a `Makefile'. + + The only change to `poke.c' is to add a line at the start of the +file: + #include "config.h" + + The new `configure.in' file is as follows. + + AC_INIT(poke.c) + AM_INIT_AUTOMAKE(poke, 1.0) + AM_CONFIG_HEADER(config.h:config.in) + AC_PROG_CC + AC_HEADER_STDC + AC_CHECK_HEADERS(utime.h) + AC_EGREP_HEADER(utimbuf, utime.h, AC_DEFINE(HAVE_STRUCT_UTIMBUF)) + AC_FUNC_UTIME_NULL + AC_OUTPUT(Makefile) + + The first four macros in this file, and the last one, were described +above; see *Note Write configure.in::. If we omit these macros, then +when we run `automake' we will get a reminder that we need them. + + The other macros are standard autoconf macros. + +`AC_HEADER_STDC' + Check for standard C headers. + +`AC_CHECK_HEADERS' + Check whether a particular header file exists. + +`AC_EGREP_HEADER' + Check for a particular string in a particular header file, in this + case checking for `utimbuf' in `utime.h'. + +`AC_FUNC_UTIME_NULL' + Check whether `utime' accepts a NULL second argument to set the + file change time to the current time. + + See the autoconf manual for a more complete description. + + The new `Makefile.am' file is as follows. Note how simple this is +compared to our earlier `Makefile'. + + bin_PROGRAMS = poke + + poke_SOURCES = poke.c + + This means that we should build a single program name `poke'. It +should be installed in the binary directory, which we called `bindir' +earlier. The program `poke' is built from the source file `poke.c'. + + We must also write a `acconfig.h' file. Besides `PACKAGE' and +`VERSION', which must be mentioned for all packages which use automake, +we must include `HAVE_STRUCT_UTIMBUF', since we mentioned it in an +`AC_DEFINE'. + + /* Name of package. */ + #undef PACKAGE + + /* Version of package. */ + #undef VERSION + + /* Whether utime.h defines struct utimbuf. */ + #undef HAVE_STRUCT_UTIMBUF + + +File: configure.info, Node: Generate Files in Example, Prev: Getting Started Example 3, Up: Getting Started Example + +Generate Files +-------------- + +We must now generate the other files, using the following commands. + + aclocal + autoconf + autoheader + automake + + When we run `autoheader', it will remind us of any macros we forgot +to add to `acconfig.h'. + + When we run `automake', it will want to add some files to our +distribution. It will add them automatically if we use the +`--add-missing' option. + + By default, `automake' will run in GNU mode, which means that it +will want us to create certain additional files; as of this writing, it +will want `NEWS', `README', `AUTHORS', and `ChangeLog', all of which +are files which should appear in a standard GNU distribution. We can +either add those files, or run `automake' with the `--foreign' option. + + Running these tools will generate the following files, all of which +are described in the next chapter. + + * `aclocal.m4' + + * `configure' + + * `config.in' + + * `Makefile.in' + + * `stamp-h.in' + + +File: configure.info, Node: Files, Next: Configuration Names, Prev: Getting Started, Up: Top + +Files +***** + +As was seen in the previous chapter, the GNU configure and build system +uses a number of different files. The developer must write a few files. +The others are generated by various tools. + + The system is rather flexible, and can be used in many different +ways. In describing the files that it uses, I will describe the common +case, and mention some other cases that may arise. + +* Menu: + +* Developer Files:: Developer Files. +* Build Files:: Build Files. +* Support Files:: Support Files. + + +File: configure.info, Node: Developer Files, Next: Build Files, Up: Files + +Developer Files +=============== + +This section describes the files written or generated by the developer +of a package. + +* Menu: + +* Developer Files Picture:: Developer Files Picture. +* Written Developer Files:: Written Developer Files. +* Generated Developer Files:: Generated Developer Files. + + +File: configure.info, Node: Developer Files Picture, Next: Written Developer Files, Up: Developer Files + +Developer Files Picture +----------------------- + +Here is a picture of the files which are written by the developer, the +generated files which would be included with a complete source +distribution, and the tools which create those files. The file names +are plain text and the tool names are enclosed by `*' characters (e.g., +`autoheader' is the name of a tool, not the name of a file). + +[image text=" acconfig.h configure.in Makefile.am + | | | + | --------------+---------------------- | + | | | | | + v v | acinclude.m4 | | + *autoheader* | | v v + | | v --->*automake* + v |--->*aclocal* | | + config.in | | | v + | v | Makefile.in + | aclocal.m4--- + | | + v v + *autoconf* + | + v + configure +"] + + +File: configure.info, Node: Written Developer Files, Next: Generated Developer Files, Prev: Developer Files Picture, Up: Developer Files + +Written Developer Files +----------------------- + +The following files would be written by the developer. + +`configure.in' + This is the configuration script. This script contains + invocations of autoconf macros. It may also contain ordinary + shell script code. This file will contain feature tests for + portability issues. The last thing in the file will normally be + an `AC_OUTPUT' macro listing which files to create when the + builder runs the configure script. This file is always required + when using the GNU configure system. *Note Write configure.in::. + +`Makefile.am' + This is the automake input file. It describes how the code should + be built. It consists of definitions of automake variables. It + may also contain ordinary Makefile targets. This file is only + needed when using automake (newer tools normally use automake, but + there are still older tools which have not been converted, in + which the developer writes `Makefile.in' directly). *Note Write + Makefile.am::. + +`acconfig.h' + When the configure script creates a portability header file, by + using `AM_CONFIG_HEADER' (or, if not using automake, + `AC_CONFIG_HEADER'), this file is used to describe macros which are + not recognized by the `autoheader' command. This is normally a + fairly uninteresting file, consisting of a collection of `#undef' + lines with comments. Normally any call to `AC_DEFINE' in + `configure.in' will require a line in this file. *Note Write + acconfig.h::. + +`acinclude.m4' + This file is not always required. It defines local autoconf + macros. These macros may then be used in `configure.in'. If you + don't need any local autoconf macros, then you don't need this + file at all. In fact, in general, you never need local autoconf + macros, since you can put everything in `configure.in', but + sometimes a local macro is convenient. + + Newer tools may omit `acinclude.m4', and instead use a + subdirectory, typically named `m4', and define `ACLOCAL_AMFLAGS = + -I m4' in `Makefile.am' to force `aclocal' to look there for macro + definitions. The macro definitions are then placed in separate + files in that directory. + + The `acinclude.m4' file is only used when using automake; in older + tools, the developer writes `aclocal.m4' directly, if it is needed. + + +File: configure.info, Node: Generated Developer Files, Prev: Written Developer Files, Up: Developer Files + +Generated Developer Files +------------------------- + +The following files would be generated by the developer. + + When using automake, these files are normally not generated manually +after the first time. Instead, the generated `Makefile' contains rules +to automatically rebuild the files as required. When +`AM_MAINTAINER_MODE' is used in `configure.in' (the normal case in +Cygnus code), the automatic rebuilding rules will only be defined if +you configure using the `--enable-maintainer-mode' option. + + When using automatic rebuilding, it is important to ensure that all +the various tools have been built and installed on your `PATH'. Using +automatic rebuilding is highly recommended, so much so that I'm not +going to explain what you have to do if you don't use it. + +`configure' + This is the configure script which will be run when building the + package. This is generated by `autoconf' from `configure.in' and + `aclocal.m4'. This is a shell script. + +`Makefile.in' + This is the file which the configure script will turn into the + `Makefile' at build time. This file is generated by `automake' + from `Makefile.am'. If you aren't using automake, you must write + this file yourself. This file is pretty much a normal `Makefile', + with some configure substitutions for certain variables. + +`aclocal.m4' + This file is created by the `aclocal' program, based on the + contents of `configure.in' and `acinclude.m4' (or, as noted in the + description of `acinclude.m4' above, on the contents of an `m4' + subdirectory). This file contains definitions of autoconf macros + which `autoconf' will use when generating the file `configure'. + These autoconf macros may be defined by you in `acinclude.m4' or + they may be defined by other packages such as automake, libtool or + gettext. If you aren't using automake, you will normally write + this file yourself; in that case, if `configure.in' uses only + standard autoconf macros, this file will not be needed at all. + +`config.in' + This file is created by `autoheader' based on `acconfig.h' and + `configure.in'. At build time, the configure script will define + some of the macros in it to create `config.h', which may then be + included by your program. This permits your C code to use + preprocessor conditionals to change its behaviour based on the + characteristics of the host system. This file may also be called + `config.h.in'. + +`stamp.h-in' + This rather uninteresting file, which I omitted from the picture, + is generated by `automake'. It always contains the string + `timestamp'. It is used as a timestamp file indicating whether + `config.in' is up to date. Using a timestamp file means that + `config.in' can be marked as up to date without actually changing + its modification time. This is useful since `config.in' depends + upon `configure.in', but it is easy to change `configure.in' in a + way which does not affect `config.in'. + + +File: configure.info, Node: Build Files, Next: Support Files, Prev: Developer Files, Up: Files + +Build Files +=========== + +This section describes the files which are created at configure and +build time. These are the files which somebody who builds the package +will see. + + Of course, the developer will also build the package. The +distinction between developer files and build files is not that the +developer does not see the build files, but that somebody who only +builds the package does not have to worry about the developer files. + +* Menu: + +* Build Files Picture:: Build Files Picture. +* Build Files Description:: Build Files Description. + + +File: configure.info, Node: Build Files Picture, Next: Build Files Description, Up: Build Files + +Build Files Picture +------------------- + +Here is a picture of the files which will be created at build time. +`config.status' is both a created file and a shell script which is run +to create other files, and the picture attempts to show that. + +[image text=" config.in *configure* Makefile.in + | | | + | v | + | config.status | + | | | + *config.status*<======+==========>*config.status* + | | + v v + config.h Makefile +"] + + +File: configure.info, Node: Build Files Description, Prev: Build Files Picture, Up: Build Files + +Build Files Description +----------------------- + +This is a description of the files which are created at build time. + +`config.status' + The first step in building a package is to run the `configure' + script. The `configure' script will create the file + `config.status', which is itself a shell script. When you first + run `configure', it will automatically run `config.status'. An + `Makefile' derived from an automake generated `Makefile.in' will + contain rules to automatically run `config.status' again when + necessary to recreate certain files if their inputs change. + +`Makefile' + This is the file which make will read to build the program. The + `config.status' script will transform `Makefile.in' into + `Makefile'. + +`config.h' + This file defines C preprocessor macros which C code can use to + adjust its behaviour on different systems. The `config.status' + script will transform `config.in' into `config.h'. + +`config.cache' + This file did not fit neatly into the picture, and I omitted it. + It is used by the `configure' script to cache results between + runs. This can be an important speedup. If you modify + `configure.in' in such a way that the results of old tests should + change (perhaps you have added a new library to `LDFLAGS'), then + you will have to remove `config.cache' to force the tests to be + rerun. + + The autoconf manual explains how to set up a site specific cache + file. This can speed up running `configure' scripts on your + system. + +`stamp.h' + This file, which I omitted from the picture, is similar to + `stamp-h.in'. It is used as a timestamp file indicating whether + `config.h' is up to date. This is useful since `config.h' depends + upon `config.status', but it is easy for `config.status' to change + in a way which does not affect `config.h'. + + +File: configure.info, Node: Support Files, Prev: Build Files, Up: Files + +Support Files +============= + +The GNU configure and build system requires several support files to be +included with your distribution. You do not normally need to concern +yourself with these. If you are using the Cygnus tree, most are already +present. Otherwise, they will be installed with your source by +`automake' (with the `--add-missing' option) and `libtoolize'. + + You don't have to put the support files in the top level directory. +You can put them in a subdirectory, and use the `AC_CONFIG_AUX_DIR' +macro in `configure.in' to tell `automake' and the `configure' script +where they are. + + In this section, I describe the support files, so that you can know +what they are and why they are there. + +`ABOUT-NLS' + Added by automake if you are using gettext. This is a + documentation file about the gettext project. + +`ansi2knr.c' + Used by an automake generated `Makefile' if you put `ansi2knr' in + `AUTOMAKE_OPTIONS' in `Makefile.am'. This permits compiling ANSI + C code with a K&R C compiler. + +`ansi2knr.1' + The man page which goes with `ansi2knr.c'. + +`config.guess' + A shell script which determines the configuration name for the + system on which it is run. + +`config.sub' + A shell script which canonicalizes a configuration name entered by + a user. + +`elisp-comp' + Used to compile Emacs LISP files. + +`install-sh' + A shell script which installs a program. This is used if the + configure script can not find an install binary. + +`ltconfig' + Used by libtool. This is a shell script which configures libtool + for the particular system on which it is used. + +`ltmain.sh' + Used by libtool. This is the actual libtool script which is used, + after it is configured by `ltconfig' to build a library. + +`mdate-sh' + A shell script used by an automake generated `Makefile' to pretty + print the modification time of a file. This is used to maintain + version numbers for texinfo files. + +`missing' + A shell script used if some tool is missing entirely. This is + used by an automake generated `Makefile' to avoid certain sorts of + timestamp problems. + +`mkinstalldirs' + A shell script which creates a directory, including all parent + directories. This is used by an automake generated `Makefile' + during installation. + +`texinfo.tex' + Required if you have any texinfo files. This is used when + converting Texinfo files into DVI using `texi2dvi' and TeX. + +`ylwrap' + A shell script used by an automake generated `Makefile' to run + programs like `bison', `yacc', `flex', and `lex'. These programs + default to producing output files with a fixed name, and the + `ylwrap' script runs them in a subdirectory to avoid file name + conflicts when using a parallel make program. + + +File: configure.info, Node: Configuration Names, Next: Cross Compilation Tools, Prev: Files, Up: Top + +Configuration Names +******************* + +The GNU configure system names all systems using a "configuration +name". All such names used to be triplets (they may now contain four +parts in certain cases), and the term "configuration triplet" is still +seen. + +* Menu: + +* Configuration Name Definition:: Configuration Name Definition. +* Using Configuration Names:: Using Configuration Names. + + +File: configure.info, Node: Configuration Name Definition, Next: Using Configuration Names, Up: Configuration Names + +Configuration Name Definition +============================= + +This is a string of the form CPU-MANUFACTURER-OPERATING_SYSTEM. In +some cases, this is extended to a four part form: +CPU-MANUFACTURER-KERNEL-OPERATING_SYSTEM. + + When using a configuration name in a configure option, it is normally +not necessary to specify an entire name. In particular, the +MANUFACTURER field is often omitted, leading to strings such as +`i386-linux' or `sparc-sunos'. The shell script `config.sub' will +translate these shortened strings into the canonical form. autoconf +will arrange for `config.sub' to be run automatically when it is needed. + + The fields of a configuration name are as follows: + +CPU + The type of processor. This is typically something like `i386' or + `sparc'. More specific variants are used as well, such as + `mipsel' to indicate a little endian MIPS processor. + +MANUFACTURER + A somewhat freeform field which indicates the manufacturer of the + system. This is often simply `unknown'. Other common strings are + `pc' for an IBM PC compatible system, or the name of a workstation + vendor, such as `sun'. + +OPERATING_SYSTEM + The name of the operating system which is run on the system. This + will be something like `solaris2.5' or `irix6.3'. There is no + particular restriction on the version number, and strings like + `aix4.1.4.0' are seen. For an embedded system, which has no + operating system, this field normally indicates the type of object + file format, such as `elf' or `coff'. + +KERNEL + This is used mainly for GNU/Linux. A typical GNU/Linux + configuration name is `i586-pc-linux-gnulibc1'. In this case the + kernel, `linux', is separated from the operating system, + `gnulibc1'. + + The shell script `config.guess' will normally print the correct +configuration name for the system on which it is run. It does by +running `uname' and by examining other characteristics of the system. + + Because `config.guess' can normally determine the configuration name +for a machine, it is normally only necessary to specify a configuration +name when building a cross-compiler or when building using a +cross-compiler. + + +File: configure.info, Node: Using Configuration Names, Prev: Configuration Name Definition, Up: Configuration Names + +Using Configuration Names +========================= + +A configure script will sometimes have to make a decision based on a +configuration name. You will need to do this if you have to compile +code differently based on something which can not be tested using a +standard autoconf feature test. + + It is normally better to test for particular features, rather than to +test for a particular system. This is because as Unix evolves, +different systems copy features from one another. Even if you need to +determine whether the feature is supported based on a configuration +name, you should define a macro which describes the feature, rather than +defining a macro which describes the particular system you are on. + + Testing for a particular system is normally done using a case +statement in `configure.in'. The case statement might look something +like the following, assuming that `host' is a shell variable holding a +canonical configuration name (which will be the case if `configure.in' +uses the `AC_CANONICAL_HOST' or `AC_CANONICAL_SYSTEM' macro). + + case "${host}" in + i[3-7]86-*-linux-gnu*) do something ;; + sparc*-sun-solaris2.[56789]*) do something ;; + sparc*-sun-solaris*) do something ;; + mips*-*-elf*) do something ;; + esac + + It is particularly important to use `*' after the operating system +field, in order to match the version number which will be generated by +`config.guess'. + + In most cases you must be careful to match a range of processor +types. For most processor families, a trailing `*' suffices, as in +`mips*' above. For the i386 family, something along the lines of +`i[3-7]86' suffices at present. For the m68k family, you will need +something like `m68*'. Of course, if you do not need to match on the +processor, it is simpler to just replace the entire field by a `*', as +in `*-*-irix*'. + + +File: configure.info, Node: Cross Compilation Tools, Next: Canadian Cross, Prev: Configuration Names, Up: Top + +Cross Compilation Tools +*********************** + +The GNU configure and build system can be used to build "cross +compilation" tools. A cross compilation tool is a tool which runs on +one system and produces code which runs on another system. + +* Menu: + +* Cross Compilation Concepts:: Cross Compilation Concepts. +* Host and Target:: Host and Target. +* Using the Host Type:: Using the Host Type. +* Specifying the Target:: Specifying the Target. +* Using the Target Type:: Using the Target Type. +* Cross Tools in the Cygnus Tree:: Cross Tools in the Cygnus Tree + + +File: configure.info, Node: Cross Compilation Concepts, Next: Host and Target, Up: Cross Compilation Tools + +Cross Compilation Concepts +========================== + +A compiler which produces programs which run on a different system is a +cross compilation compiler, or simply a "cross compiler". Similarly, +we speak of cross assemblers, cross linkers, etc. + + In the normal case, a compiler produces code which runs on the same +system as the one on which the compiler runs. When it is necessary to +distinguish this case from the cross compilation case, such a compiler +is called a "native compiler". Similarly, we speak of native +assemblers, etc. + + Although the debugger is not strictly speaking a compilation tool, +it is nevertheless meaningful to speak of a cross debugger: a debugger +which is used to debug code which runs on another system. Everything +that is said below about configuring cross compilation tools applies to +the debugger as well. + + +File: configure.info, Node: Host and Target, Next: Using the Host Type, Prev: Cross Compilation Concepts, Up: Cross Compilation Tools + +Host and Target +=============== + +When building cross compilation tools, there are two different systems +involved: the system on which the tools will run, and the system for +which the tools generate code. + + The system on which the tools will run is called the "host" system. + + The system for which the tools generate code is called the "target" +system. + + For example, suppose you have a compiler which runs on a GNU/Linux +system and generates ELF programs for a MIPS embedded system. In this +case the GNU/Linux system is the host, and the MIPS ELF system is the +target. Such a compiler could be called a GNU/Linux cross MIPS ELF +compiler, or, equivalently, a `i386-linux-gnu' cross `mips-elf' +compiler. + + Naturally, most programs are not cross compilation tools. For those +programs, it does not make sense to speak of a target. It only makes +sense to speak of a target for tools like `gcc' or the `binutils' which +actually produce running code. For example, it does not make sense to +speak of the target of a tool like `bison' or `make'. + + Most cross compilation tools can also serve as native tools. For a +native compilation tool, it is still meaningful to speak of a target. +For a native tool, the target is the same as the host. For example, for +a GNU/Linux native compiler, the host is GNU/Linux, and the target is +also GNU/Linux. + + +File: configure.info, Node: Using the Host Type, Next: Specifying the Target, Prev: Host and Target, Up: Cross Compilation Tools + +Using the Host Type +=================== + +In almost all cases the host system is the system on which you run the +`configure' script, and on which you build the tools (for the case when +they differ, *note Canadian Cross::). + + If your configure script needs to know the configuration name of the +host system, and the package is not a cross compilation tool and +therefore does not have a target, put `AC_CANONICAL_HOST' in +`configure.in'. This macro will arrange to define a few shell +variables when the `configure' script is run. + +`host' + The canonical configuration name of the host. This will normally + be determined by running the `config.guess' shell script, although + the user is permitted to override this by using an explicit + `--host' option. + +`host_alias' + In the unusual case that the user used an explicit `--host' option, + this will be the argument to `--host'. In the normal case, this + will be the same as the `host' variable. + +`host_cpu' +`host_vendor' +`host_os' + The first three parts of the canonical configuration name. + + The shell variables may be used by putting shell code in +`configure.in'. For an example, see *Note Using Configuration Names::. + + +File: configure.info, Node: Specifying the Target, Next: Using the Target Type, Prev: Using the Host Type, Up: Cross Compilation Tools + +Specifying the Target +===================== + +By default, the `configure' script will assume that the target is the +same as the host. This is the more common case; for example, it leads +to a native compiler rather than a cross compiler. + + If you want to build a cross compilation tool, you must specify the +target explicitly by using the `--target' option when you run +`configure'. The argument to `--target' is the configuration name of +the system for which you wish to generate code. *Note Configuration +Names::. + + For example, to build tools which generate code for a MIPS ELF +embedded system, you would use `--target mips-elf'. + + +File: configure.info, Node: Using the Target Type, Next: Cross Tools in the Cygnus Tree, Prev: Specifying the Target, Up: Cross Compilation Tools + +Using the Target Type +===================== + +When writing `configure.in' for a cross compilation tool, you will need +to use information about the target. To do this, put +`AC_CANONICAL_SYSTEM' in `configure.in'. + + `AC_CANONICAL_SYSTEM' will look for a `--target' option and +canonicalize it using the `config.sub' shell script. It will also run +`AC_CANONICAL_HOST' (*note Using the Host Type::). + + The target type will be recorded in the following shell variables. +Note that the host versions of these variables will also be defined by +`AC_CANONICAL_HOST'. + +`target' + The canonical configuration name of the target. + +`target_alias' + The argument to the `--target' option. If the user did not specify + a `--target' option, this will be the same as `host_alias'. + +`target_cpu' +`target_vendor' +`target_os' + The first three parts of the canonical target configuration name. + + Note that if `host' and `target' are the same string, you can assume +a native configuration. If they are different, you can assume a cross +configuration. + + It is arguably possible for `host' and `target' to represent the +same system, but for the strings to not be identical. For example, if +`config.guess' returns `sparc-sun-sunos4.1.4', and somebody configures +with `--target sparc-sun-sunos4.1', then the slight differences between +the two versions of SunOS may be unimportant for your tool. However, +in the general case it can be quite difficult to determine whether the +differences between two configuration names are significant or not. +Therefore, by convention, if the user specifies a `--target' option +without specifying a `--host' option, it is assumed that the user wants +to configure a cross compilation tool. + + The variables `target' and `target_alias' should be handled +differently. + + In general, whenever the user may actually see a string, +`target_alias' should be used. This includes anything which may appear +in the file system, such as a directory name or part of a tool name. +It also includes any tool output, unless it is clearly labelled as the +canonical target configuration name. This permits the user to use the +`--target' option to specify how the tool will appear to the outside +world. + + On the other hand, when checking for characteristics of the target +system, `target' should be used. This is because a wide variety of +`--target' options may map into the same canonical configuration name. +You should not attempt to duplicate the canonicalization done by +`config.sub' in your own code. + + By convention, cross tools are installed with a prefix of the +argument used with the `--target' option, also known as `target_alias' +(*note Using the Target Type::). If the user does not use the +`--target' option, and thus is building a native tool, no prefix is +used. + + For example, if gcc is configured with `--target mips-elf', then the +installed binary will be named `mips-elf-gcc'. If gcc is configured +without a `--target' option, then the installed binary will be named +`gcc'. + + The autoconf macro `AC_ARG_PROGRAM' will handle this for you. If +you are using automake, no more need be done; the programs will +automatically be installed with the correct prefixes. Otherwise, see +the autoconf documentation for `AC_ARG_PROGRAM'. + + +File: configure.info, Node: Cross Tools in the Cygnus Tree, Prev: Using the Target Type, Up: Cross Compilation Tools + +Cross Tools in the Cygnus Tree +============================== + +The Cygnus tree is used for various packages including gdb, the GNU +binutils, and egcs. It is also, of course, used for Cygnus releases. + + In the Cygnus tree, the top level `configure' script uses the old +Cygnus configure system, not autoconf. The top level `Makefile.in' is +written to build packages based on what is in the source tree, and +supports building a large number of tools in a single +`configure'/`make' step. + + The Cygnus tree may be configured with a `--target' option. The +`--target' option applies recursively to every subdirectory, and +permits building an entire set of cross tools at once. + +* Menu: + +* Host and Target Libraries:: Host and Target Libraries. +* Target Library Configure Scripts:: Target Library Configure Scripts. +* Make Targets in Cygnus Tree:: Make Targets in Cygnus Tree. +* Target libiberty:: Target libiberty + + +File: configure.info, Node: Host and Target Libraries, Next: Target Library Configure Scripts, Up: Cross Tools in the Cygnus Tree + +Host and Target Libraries +------------------------- + +The Cygnus tree distinguishes host libraries from target libraries. + + Host libraries are built with the compiler used to build the programs +which run on the host, which is called the host compiler. This includes +libraries such as `bfd' and `tcl'. These libraries are built with the +host compiler, and are linked into programs like the binutils or gcc +which run on the host. + + Target libraries are built with the target compiler. If gcc is +present in the source tree, then the target compiler is the gcc that is +built using the host compiler. Target libraries are libraries such as +`newlib' and `libstdc++'. These libraries are not linked into the host +programs, but are instead made available for use with programs built +with the target compiler. + + For the rest of this section, assume that gcc is present in the +source tree, so that it will be used to build the target libraries. + + There is a complication here. The configure process needs to know +which compiler you are going to use to build a tool; otherwise, the +feature tests will not work correctly. The Cygnus tree handles this by +not configuring the target libraries until the target compiler is +built. In order to permit everything to build using a single +`configure'/`make', the configuration of the target libraries is +actually triggered during the make step. + + When the target libraries are configured, the `--target' option is +not used. Instead, the `--host' option is used with the argument of +the `--target' option for the overall configuration. If no `--target' +option was used for the overall configuration, the `--host' option will +be passed with the output of the `config.guess' shell script. Any +`--build' option is passed down unchanged. + + This translation of configuration options is done because since the +target libraries are compiled with the target compiler, they are being +built in order to run on the target of the overall configuration. By +the definition of host, this means that their host system is the same as +the target system of the overall configuration. + + The same process is used for both a native configuration and a cross +configuration. Even when using a native configuration, the target +libraries will be configured and built using the newly built compiler. +This is particularly important for the C++ libraries, since there is no +reason to assume that the C++ compiler used to build the host tools (if +there even is one) uses the same ABI as the g++ compiler which will be +used to build the target libraries. + + There is one difference between a native configuration and a cross +configuration. In a native configuration, the target libraries are +normally configured and built as siblings of the host tools. In a cross +configuration, the target libraries are normally built in a subdirectory +whose name is the argument to `--target'. This is mainly for +historical reasons. + + To summarize, running `configure' in the Cygnus tree configures all +the host libraries and tools, but does not configure any of the target +libraries. Running `make' then does the following steps: + + * Build the host libraries. + + * Build the host programs, including gcc. Note that we call gcc + both a host program (since it runs on the host) and a target + compiler (since it generates code for the target). + + * Using the newly built target compiler, configure the target + libraries. + + * Build the target libraries. + + The steps need not be done in precisely this order, since they are +actually controlled by `Makefile' targets. + + +File: configure.info, Node: Target Library Configure Scripts, Next: Make Targets in Cygnus Tree, Prev: Host and Target Libraries, Up: Cross Tools in the Cygnus Tree + +Target Library Configure Scripts +-------------------------------- + +There are a few things you must know in order to write a configure +script for a target library. This is just a quick sketch, and beginners +shouldn't worry if they don't follow everything here. + + The target libraries are configured and built using a newly built +target compiler. There may not be any startup files or libraries for +this target compiler. In fact, those files will probably be built as +part of some target library, which naturally means that they will not +exist when your target library is configured. + + This means that the configure script for a target library may not use +any test which requires doing a link. This unfortunately includes many +useful autoconf macros, such as `AC_CHECK_FUNCS'. autoconf macros +which do a compile but not a link, such as `AC_CHECK_HEADERS', may be +used. + + This is a severe restriction, but normally not a fatal one, as target +libraries can often assume the presence of other target libraries, and +thus know which functions will be available. + + As of this writing, the autoconf macro `AC_PROG_CC' does a link to +make sure that the compiler works. This may fail in a target library, +so target libraries must use a different set of macros to locate the +compiler. See the `configure.in' file in a directory like `libiberty' +or `libgloss' for an example. + + As noted in the previous section, target libraries are sometimes +built in directories which are siblings to the host tools, and are +sometimes built in a subdirectory. The `--with-target-subdir' configure +option will be passed when the library is configured. Its value will be +an empty string if the target library is a sibling. Its value will be +the name of the subdirectory if the target library is in a subdirectory. + + If the overall build is not a native build (i.e., the overall +configure used the `--target' option), then the library will be +configured with the `--with-cross-host' option. The value of this +option will be the host system of the overall build. Recall that the +host system of the library will be the target of the overall build. If +the overall build is a native build, the `--with-cross-host' option +will not be used. + + A library which can be built both standalone and as a target library +may want to install itself into different directories depending upon the +case. When built standalone, or when built native, the library should +be installed in `$(libdir)'. When built as a target library which is +not native, the library should be installed in `$(tooldir)/lib'. The +`--with-cross-host' option may be used to distinguish these cases. + + This same test of `--with-cross-host' may be used to see whether it +is OK to use link tests in the configure script. If the +`--with-cross-host' option is not used, then the library is being built +either standalone or native, and a link should work. + + +File: configure.info, Node: Make Targets in Cygnus Tree, Next: Target libiberty, Prev: Target Library Configure Scripts, Up: Cross Tools in the Cygnus Tree + +Make Targets in Cygnus Tree +--------------------------- + +The top level `Makefile' in the Cygnus tree defines targets for every +known subdirectory. + + For every subdirectory DIR which holds a host library or program, +the `Makefile' target `all-DIR' will build that library or program. + + There are dependencies among host tools. For example, building gcc +requires first building gas, because the gcc build process invokes the +target assembler. These dependencies are reflected in the top level +`Makefile'. + + For every subdirectory DIR which holds a target library, the +`Makefile' target `configure-target-DIR' will configure that library. +The `Makefile' target `all-target-DIR' will build that library. + + Every `configure-target-DIR' target depends upon `all-gcc', since +gcc, the target compiler, is required to configure the tool. Every +`all-target-DIR' target depends upon the corresponding +`configure-target-DIR' target. + + There are several other targets which may be of interest for each +directory: `install-DIR', `clean-DIR', and `check-DIR'. There are also +corresponding `target' versions of these for the target libraries , +such as `install-target-DIR'. + + +File: configure.info, Node: Target libiberty, Prev: Make Targets in Cygnus Tree, Up: Cross Tools in the Cygnus Tree + +Target libiberty +---------------- + +The `libiberty' subdirectory is currently a special case, in that it is +the only directory which is built both using the host compiler and +using the target compiler. + + This is because the files in `libiberty' are used when building the +host tools, and they are also incorporated into the `libstdc++' target +library as support code. + + This duality does not pose any particular difficulties. It means +that there are targets for both `all-libiberty' and +`all-target-libiberty'. + + In a native configuration, when target libraries are not built in a +subdirectory, the same objects are normally used as both the host build +and the target build. This is normally OK, since libiberty contains +only C code, and in a native configuration the results of the host +compiler and the target compiler are normally interoperable. + + Irix 6 is again an exception here, since the SGI native compiler +defaults to using the `O32' ABI, and gcc defaults to using the `N32' +ABI. On Irix 6, the target libraries are built in a subdirectory even +for a native configuration, avoiding this problem. + + There are currently no other libraries built for both the host and +the target, but there is no conceptual problem with adding more. + + +File: configure.info, Node: Canadian Cross, Next: Cygnus Configure, Prev: Cross Compilation Tools, Up: Top + +Canadian Cross +************** + +It is possible to use the GNU configure and build system to build a +program which will run on a system which is different from the system on +which the tools are built. In other words, it is possible to build +programs using a cross compiler. + + This is referred to as a "Canadian Cross". + +* Menu: + +* Canadian Cross Example:: Canadian Cross Example. +* Canadian Cross Concepts:: Canadian Cross Concepts. +* Build Cross Host Tools:: Build Cross Host Tools. +* Build and Host Options:: Build and Host Options. +* CCross not in Cygnus Tree:: Canadian Cross not in Cygnus Tree. +* CCross in Cygnus Tree:: Canadian Cross in Cygnus Tree. +* Supporting Canadian Cross:: Supporting Canadian Cross. + + +File: configure.info, Node: Canadian Cross Example, Next: Canadian Cross Concepts, Up: Canadian Cross + +Canadian Cross Example +====================== + +Here is an example of a Canadian Cross. + + While running on a GNU/Linux, you can build a program which will run +on a Solaris system. You would use a GNU/Linux cross Solaris compiler +to build the program. + + Of course, you could not run the resulting program on your GNU/Linux +system. You would have to copy it over to a Solaris system before you +would run it. + + Of course, you could also simply build the programs on the Solaris +system in the first place. However, perhaps the Solaris system is not +available for some reason; perhaps you actually don't have one, but you +want to build the tools for somebody else to use. Or perhaps your +GNU/Linux system is much faster than your Solaris system. + + A Canadian Cross build is most frequently used when building +programs to run on a non-Unix system, such as DOS or Windows. It may +be simpler to configure and build on a Unix system than to support the +configuration machinery on a non-Unix system. + + +File: configure.info, Node: Canadian Cross Concepts, Next: Build Cross Host Tools, Prev: Canadian Cross Example, Up: Canadian Cross + +Canadian Cross Concepts +======================= + +When building a Canadian Cross, there are at least two different systems +involved: the system on which the tools are being built, and the system +on which the tools will run. + + The system on which the tools are being built is called the "build" +system. + + The system on which the tools will run is called the host system. + + For example, if you are building a Solaris program on a GNU/Linux +system, as in the previous section, the build system would be GNU/Linux, +and the host system would be Solaris. + + It is, of course, possible to build a cross compiler using a Canadian +Cross (i.e., build a cross compiler using a cross compiler). In this +case, the system for which the resulting cross compiler generates code +is called the target system. (For a more complete discussion of host +and target systems, *note Host and Target::). + + An example of building a cross compiler using a Canadian Cross would +be building a Windows cross MIPS ELF compiler on a GNU/Linux system. In +this case the build system would be GNU/Linux, the host system would be +Windows, and the target system would be MIPS ELF. + + The name Canadian Cross comes from the case when the build, host, and +target systems are all different. At the time that these issues were +all being hashed out, Canada had three national political parties. + + +File: configure.info, Node: Build Cross Host Tools, Next: Build and Host Options, Prev: Canadian Cross Concepts, Up: Canadian Cross + +Build Cross Host Tools +====================== + +In order to configure a program for a Canadian Cross build, you must +first build and install the set of cross tools you will use to build the +program. + + These tools will be build cross host tools. That is, they will run +on the build system, and will produce code that runs on the host system. + + It is easy to confuse the meaning of build and host here. Always +remember that the build system is where you are doing the build, and the +host system is where the resulting program will run. Therefore, you +need a build cross host compiler. + + In general, you must have a complete cross environment in order to do +the build. This normally means a cross compiler, cross assembler, and +so forth, as well as libraries and include files for the host system. + + +File: configure.info, Node: Build and Host Options, Next: CCross not in Cygnus Tree, Prev: Build Cross Host Tools, Up: Canadian Cross + +Build and Host Options +====================== + +When you run `configure', you must use both the `--build' and `--host' +options. + + The `--build' option is used to specify the configuration name of +the build system. This can normally be the result of running the +`config.guess' shell script, and it is reasonable to use +`--build=`config.guess`'. + + The `--host' option is used to specify the configuration name of the +host system. + + As we explained earlier, `config.guess' is used to set the default +value for the `--host' option (*note Using the Host Type::). We can +now see that since `config.guess' returns the type of system on which +it is run, it really identifies the build system. Since the host +system is normally the same as the build system (i.e., people do not +normally build using a cross compiler), it is reasonable to use the +result of `config.guess' as the default for the host system when the +`--host' option is not used. + + It might seem that if the `--host' option were used without the +`--build' option that the configure script could run `config.guess' to +determine the build system, and presume a Canadian Cross if the result +of `config.guess' differed from the `--host' option. However, for +historical reasons, some configure scripts are routinely run using an +explicit `--host' option, rather than using the default from +`config.guess'. As noted earlier, it is difficult or impossible to +reliably compare configuration names (*note Using the Target Type::). +Therefore, by convention, if the `--host' option is used, but the +`--build' option is not used, then the build system defaults to the +host system. + + +File: configure.info, Node: CCross not in Cygnus Tree, Next: CCross in Cygnus Tree, Prev: Build and Host Options, Up: Canadian Cross + +Canadian Cross not in Cygnus Tree. +================================== + +If you are not using the Cygnus tree, you must explicitly specify the +cross tools which you want to use to build the program. This is done by +setting environment variables before running the `configure' script. + + You must normally set at least the environment variables `CC', `AR', +and `RANLIB' to the cross tools which you want to use to build. + + For some programs, you must set additional cross tools as well, such +as `AS', `LD', or `NM'. + + You would set these environment variables to the build cross tools +which you are going to use. + + For example, if you are building a Solaris program on a GNU/Linux +system, and your GNU/Linux cross Solaris compiler were named +`solaris-gcc', then you would set the environment variable `CC' to +`solaris-gcc'. + + +File: configure.info, Node: CCross in Cygnus Tree, Next: Supporting Canadian Cross, Prev: CCross not in Cygnus Tree, Up: Canadian Cross + +Canadian Cross in Cygnus Tree +============================= + +This section describes configuring and building a Canadian Cross when +using the Cygnus tree. + +* Menu: + +* Standard Cygnus CCross:: Building a Normal Program. +* Cross Cygnus CCross:: Building a Cross Program. + + +File: configure.info, Node: Standard Cygnus CCross, Next: Cross Cygnus CCross, Up: CCross in Cygnus Tree + +Building a Normal Program +------------------------- + +When configuring a Canadian Cross in the Cygnus tree, all the +appropriate environment variables are automatically set to `HOST-TOOL', +where HOST is the value used for the `--host' option, and TOOL is the +name of the tool (e.g., `gcc', `as', etc.). These tools must be on +your `PATH'. + + Adding a prefix of HOST will give the usual name for the build cross +host tools. To see this, consider that when these cross tools were +built, they were configured to run on the build system and to produce +code for the host system. That is, they were configured with a +`--target' option that is the same as the system which we are now +calling the host. Recall that the default name for installed cross +tools uses the target system as a prefix (*note Using the Target +Type::). Since that is the system which we are now calling the host, +HOST is the right prefix to use. + + For example, if you configure with `--build=i386-linux-gnu' and +`--host=solaris', then the Cygnus tree will automatically default to +using the compiler `solaris-gcc'. You must have previously built and +installed this compiler, probably by doing a build with no `--host' +option and with a `--target' option of `solaris'. + + +File: configure.info, Node: Cross Cygnus CCross, Prev: Standard Cygnus CCross, Up: CCross in Cygnus Tree + +Building a Cross Program +------------------------ + +There are additional considerations if you want to build a cross +compiler, rather than a native compiler, in the Cygnus tree using a +Canadian Cross. + + When you build a cross compiler using the Cygnus tree, then the +target libraries will normally be built with the newly built target +compiler (*note Host and Target Libraries::). However, this will not +work when building with a Canadian Cross. This is because the newly +built target compiler will be a program which runs on the host system, +and therefore will not be able to run on the build system. + + Therefore, when building a cross compiler with the Cygnus tree, you +must first install a set of build cross target tools. These tools will +be used when building the target libraries. + + Note that this is not a requirement of a Canadian Cross in general. +For example, it would be possible to build just the host cross target +tools on the build system, to copy the tools to the host system, and to +build the target libraries on the host system. The requirement for +build cross target tools is imposed by the Cygnus tree, which expects +to be able to build both host programs and target libraries in a single +`configure'/`make' step. Because it builds these in a single step, it +expects to be able to build the target libraries on the build system, +which means that it must use a build cross target toolchain. + + For example, suppose you want to build a Windows cross MIPS ELF +compiler on a GNU/Linux system. You must have previously installed +both a GNU/Linux cross Windows compiler and a GNU/Linux cross MIPS ELF +compiler. + + In order to build the Windows (configuration name `i386-cygwin32') +cross MIPS ELF (configure name `mips-elf') compiler, you might execute +the following commands (long command lines are broken across lines with +a trailing backslash as a continuation character). + + mkdir linux-x-cygwin32 + cd linux-x-cygwin32 + SRCDIR/configure --target i386-cygwin32 --prefix=INSTALLDIR \ + --exec-prefix=INSTALLDIR/H-i386-linux + make + make install + cd .. + mkdir linux-x-mips-elf + cd linux-x-mips-elf + SRCDIR/configure --target mips-elf --prefix=INSTALLDIR \ + --exec-prefix=INSTALLDIR/H-i386-linux + make + make install + cd .. + mkdir cygwin32-x-mips-elf + cd cygwin32-x-mips-elf + SRCDIR/configure --build=i386-linux-gnu --host=i386-cygwin32 \ + --target=mips-elf --prefix=WININSTALLDIR \ + --exec-prefix=WININSTALLDIR/H-i386-cygwin32 + make + make install + + You would then copy the contents of WININSTALLDIR over to the +Windows machine, and run the resulting programs. + + +File: configure.info, Node: Supporting Canadian Cross, Prev: CCross in Cygnus Tree, Up: Canadian Cross + +Supporting Canadian Cross +========================= + +If you want to make it possible to build a program you are developing +using a Canadian Cross, you must take some care when writing your +configure and make rules. Simple cases will normally work correctly. +However, it is not hard to write configure and make tests which will +fail in a Canadian Cross. + +* Menu: + +* CCross in Configure:: Supporting Canadian Cross in Configure Scripts. +* CCross in Make:: Supporting Canadian Cross in Makefiles. + + +File: configure.info, Node: CCross in Configure, Next: CCross in Make, Up: Supporting Canadian Cross + +Supporting Canadian Cross in Configure Scripts +---------------------------------------------- + +In a `configure.in' file, after calling `AC_PROG_CC', you can find out +whether this is a Canadian Cross configure by examining the shell +variable `cross_compiling'. In a Canadian Cross, which means that the +compiler is a cross compiler, `cross_compiling' will be `yes'. In a +normal configuration, `cross_compiling' will be `no'. + + You ordinarily do not need to know the type of the build system in a +configure script. However, if you do need that information, you can get +it by using the macro `AC_CANONICAL_SYSTEM', the same macro that is +used to determine the target system. This macro will set the variables +`build', `build_alias', `build_cpu', `build_vendor', and `build_os', +which correspond to the similar `target' and `host' variables, except +that they describe the build system. + + When writing tests in `configure.in', you must remember that you +want to test the host environment, not the build environment. + + Macros like `AC_CHECK_FUNCS' which use the compiler will test the +host environment. That is because the tests will be done by running the +compiler, which is actually a build cross host compiler. If the +compiler can find the function, that means that the function is present +in the host environment. + + Tests like `test -f /dev/ptyp0', on the other hand, will test the +build environment. Remember that the configure script is running on the +build system, not the host system. If your configure scripts examines +files, those files will be on the build system. Whatever you determine +based on those files may or may not be the case on the host system. + + Most autoconf macros will work correctly for a Canadian Cross. The +main exception is `AC_TRY_RUN'. This macro tries to compile and run a +test program. This will fail in a Canadian Cross, because the program +will be compiled for the host system, which means that it will not run +on the build system. + + The `AC_TRY_RUN' macro provides an optional argument to tell the +configure script what to do in a Canadian Cross. If that argument is +not present, you will get a warning when you run `autoconf': + warning: AC_TRY_RUN called without default to allow cross compiling + +This tells you that the resulting `configure' script will not work with +a Canadian Cross. + + In some cases while it may better to perform a test at configure +time, it is also possible to perform the test at run time. In such a +case you can use the cross compiling argument to `AC_TRY_RUN' to tell +your program that the test could not be performed at configure time. + + There are a few other autoconf macros which will not work correctly +with a Canadian Cross: a partial list is `AC_FUNC_GETPGRP', +`AC_FUNC_SETPGRP', `AC_FUNC_SETVBUF_REVERSED', and +`AC_SYS_RESTARTABLE_SYSCALLS'. The `AC_CHECK_SIZEOF' macro is +generally not very useful with a Canadian Cross; it permits an optional +argument indicating the default size, but there is no way to know what +the correct default should be. + + +File: configure.info, Node: CCross in Make, Prev: CCross in Configure, Up: Supporting Canadian Cross + +Supporting Canadian Cross in Makefiles. +--------------------------------------- + +The main Canadian Cross issue in a `Makefile' arises when you want to +use a subsidiary program to generate code or data which you will then +include in your real program. + + If you compile this subsidiary program using `$(CC)' in the usual +way, you will not be able to run it. This is because `$(CC)' will +build a program for the host system, but the program is being built on +the build system. + + You must instead use a compiler for the build system, rather than the +host system. In the Cygnus tree, this make variable `$(CC_FOR_BUILD)' +will hold a compiler for the build system. + + Note that you should not include `config.h' in a file you are +compiling with `$(CC_FOR_BUILD)'. The `configure' script will build +`config.h' with information for the host system. However, you are +compiling the file using a compiler for the build system (a native +compiler). Subsidiary programs are normally simple filters which do no +user interaction, and it is normally possible to write them in a highly +portable fashion so that the absence of `config.h' is not crucial. + + The gcc `Makefile.in' shows a complex situation in which certain +files, such as `rtl.c', must be compiled into both subsidiary programs +run on the build system and into the final program. This approach may +be of interest for advanced build system hackers. Note that the build +system compiler is rather confusingly called `HOST_CC'. + + +File: configure.info, Node: Cygnus Configure, Next: Multilibs, Prev: Canadian Cross, Up: Top + +Cygnus Configure +**************** + +The Cygnus configure script predates autoconf. All of its interesting +features have been incorporated into autoconf. No new programs should +be written to use the Cygnus configure script. + + However, the Cygnus configure script is still used in a few places: +at the top of the Cygnus tree and in a few target libraries in the +Cygnus tree. Until those uses have been replaced with autoconf, some +brief notes are appropriate here. This is not complete documentation, +but it should be possible to use this as a guide while examining the +scripts themselves. + +* Menu: + +* Cygnus Configure Basics:: Cygnus Configure Basics. +* Cygnus Configure in C++ Libraries:: Cygnus Configure in C++ Libraries. + + +File: configure.info, Node: Cygnus Configure Basics, Next: Cygnus Configure in C++ Libraries, Up: Cygnus Configure + +Cygnus Configure Basics +======================= + +Cygnus configure does not use any generated files; there is no program +corresponding to `autoconf'. Instead, there is a single shell script +named `configure' which may be found at the top of the Cygnus tree. +This shell script was written by hand; it was not generated by +autoconf, and it is incorrect, and indeed harmful, to run `autoconf' in +the top level of a Cygnus tree. + + Cygnus configure works in a particular directory by examining the +file `configure.in' in that directory. That file is broken into four +separate shell scripts. + + The first is the contents of `configure.in' up to a line that starts +with `# per-host:'. This is the common part. + + The second is the rest of `configure.in' up to a line that starts +with `# per-target:'. This is the per host part. + + The third is the rest of `configure.in' up to a line that starts +with `# post-target:'. This is the per target part. + + The fourth is the remainder of `configure.in'. This is the post +target part. + + If any of these comment lines are missing, the corresponding shell +script is empty. + + Cygnus configure will first execute the common part. This must set +the shell variable `srctrigger' to the name of a source file, to +confirm that Cygnus configure is looking at the right directory. This +may set the shell variables `package_makefile_frag' and +`package_makefile_rules_frag'. + + Cygnus configure will next set the `build' and `host' shell +variables, and execute the per host part. This may set the shell +variable `host_makefile_frag'. + + Cygnus configure will next set the `target' variable, and execute +the per target part. This may set the shell variable +`target_makefile_frag'. + + Any of these scripts may set the `subdirs' shell variable. This +variable is a list of subdirectories where a `Makefile.in' file may be +found. Cygnus configure will automatically look for a `Makefile.in' +file in the current directory. The `subdirs' shell variable is not +normally used, and I believe that the only directory which uses it at +present is `newlib'. + + For each `Makefile.in', Cygnus configure will automatically create a +`Makefile' by adding definitions for `make' variables such as `host' +and `target', and automatically editing the values of `make' variables +such as `prefix' if they are present. + + Also, if any of the `makefile_frag' shell variables are set, Cygnus +configure will interpret them as file names relative to either the +working directory or the source directory, and will read the contents of +the file into the generated `Makefile'. The file contents will be read +in after the first line in `Makefile.in' which starts with `####'. + + These `Makefile' fragments are used to customize behaviour for a +particular host or target. They serve to select particular files to +compile, and to define particular preprocessor macros by providing +values for `make' variables which are then used during compilation. +Cygnus configure, unlike autoconf, normally does not do feature tests, +and normally requires support to be added manually for each new host. + + The `Makefile' fragment support is similar to the autoconf +`AC_SUBST_FILE' macro. + + After creating each `Makefile', the post target script will be run +(i.e., it may be run several times). This script may further customize +the `Makefile'. When it is run, the shell variable `Makefile' will +hold the name of the `Makefile', including the appropriate directory +component. + + Like an autoconf generated `configure' script, Cygnus configure will +create a file named `config.status' which, when run, will automatically +recreate the configuration. The `config.status' file will simply +execute the Cygnus configure script again with the appropriate +arguments. + + Any of the parts of `configure.in' may set the shell variables +`files' and `links'. Cygnus configure will set up symlinks from the +names in `links' to the files named in `files'. This is similar to the +autoconf `AC_LINK_FILES' macro. + + Finally, any of the parts of `configure.in' may set the shell +variable `configdirs' to a set of subdirectories. If it is set, Cygnus +configure will recursively run the configure process in each +subdirectory. If the subdirectory uses Cygnus configure, it will +contain a `configure.in' file but no `configure' file, in which case +Cygnus configure will invoke itself recursively. If the subdirectory +has a `configure' file, Cygnus configure assumes that it is an autoconf +generated `configure' script, and simply invokes it directly. + + +File: configure.info, Node: Cygnus Configure in C++ Libraries, Prev: Cygnus Configure Basics, Up: Cygnus Configure + +Cygnus Configure in C++ Libraries +================================= + +The C++ library configure system, written by Per Bothner, deserves +special mention. It uses Cygnus configure, but it does feature testing +like that done by autoconf generated `configure' scripts. This +approach is used in the libraries `libio', `libstdc++', and `libg++'. + + Most of the `Makefile' information is written out by the shell +script `libio/config.shared'. Each `configure.in' file sets certain +shell variables, and then invokes `config.shared' to create two package +`Makefile' fragments. These fragments are then incorporated into the +resulting `Makefile' by the Cygnus configure script. + + The file `_G_config.h' is created in the `libio' object directory by +running the shell script `libio/gen-params'. This shell script uses +feature tests to define macros and typedefs in `_G_config.h'. + + +File: configure.info, Node: Multilibs, Next: FAQ, Prev: Cygnus Configure, Up: Top + +Multilibs +********* + +For some targets gcc may have different processor requirements depending +upon command line options. An obvious example is the `-msoft-float' +option supported on several processors. This option means that the +floating point registers are not available, which means that floating +point operations must be done by calling an emulation subroutine rather +than by using machine instructions. + + For such options, gcc is often configured to compile target libraries +twice: once with `-msoft-float' and once without. When gcc compiles +target libraries more than once, the resulting libraries are called +"multilibs". + + Multilibs are not really part of the GNU configure and build system, +but we discuss them here since they require support in the `configure' +scripts and `Makefile's used for target libraries. + +* Menu: + +* Multilibs in gcc:: Multilibs in gcc. +* Multilibs in Target Libraries:: Multilibs in Target Libraries. + + +File: configure.info, Node: Multilibs in gcc, Next: Multilibs in Target Libraries, Up: Multilibs + +Multilibs in gcc +================ + +In gcc, multilibs are defined by setting the variable +`MULTILIB_OPTIONS' in the target `Makefile' fragment. Several other +`MULTILIB' variables may also be defined there. *Note The Target +Makefile Fragment: (gcc)Target Fragment. + + If you have built gcc, you can see what multilibs it uses by running +it with the `-print-multi-lib' option. The output `.;' means that no +multilibs are used. In general, the output is a sequence of lines, one +per multilib. The first part of each line, up to the `;', is the name +of the multilib directory. The second part is a list of compiler +options separated by `@' characters. + + Multilibs are built in a tree of directories. The top of the tree, +represented by `.' in the list of multilib directories, is the default +library to use when no special compiler options are used. The +subdirectories of the tree hold versions of the library to use when +particular compiler options are used. + + +File: configure.info, Node: Multilibs in Target Libraries, Prev: Multilibs in gcc, Up: Multilibs + +Multilibs in Target Libraries +============================= + +The target libraries in the Cygnus tree are automatically built with +multilibs. That means that each library is built multiple times. + + This default is set in the top level `configure.in' file, by adding +`--enable-multilib' to the list of arguments passed to configure when +it is run for the target libraries (*note Host and Target Libraries::). + + Each target library uses the shell script `config-ml.in', written by +Doug Evans, to prepare to build target libraries. This shell script is +invoked after the `Makefile' has been created by the `configure' +script. If multilibs are not enabled, it does nothing, otherwise it +modifies the `Makefile' to support multilibs. + + The `config-ml.in' script makes one copy of the `Makefile' for each +multilib in the appropriate subdirectory. When configuring in the +source directory (which is not recommended), it will build a symlink +tree of the sources in each subdirectory. + + The `config-ml.in' script sets several variables in the various +`Makefile's. The `Makefile.in' must have definitions for these +variables already; `config-ml.in' simply changes the existing values. +The `Makefile' should use default values for these variables which will +do the right thing in the subdirectories. + +`MULTISRCTOP' + `config-ml.in' will set this to a sequence of `../' strings, where + the number of strings is the number of multilib levels in the + source tree. The default value should be the empty string. + +`MULTIBUILDTOP' + `config-ml.in' will set this to a sequence of `../' strings, where + the number of strings is number of multilib levels in the object + directory. The default value should be the empty string. This + will differ from `MULTISRCTOP' when configuring in the source tree + (which is not recommended). + +`MULTIDIRS' + In the top level `Makefile' only, `config-ml.in' will set this to + the list of multilib subdirectories. The default value should be + the empty string. + +`MULTISUBDIR' + `config-ml.in' will set this to the installed subdirectory name to + use for this subdirectory, with a leading `/'. The default value + shold be the empty string. + +`MULTIDO' +`MULTICLEAN' + In the top level `Makefile' only, `config-ml.in' will set these + variables to commands to use when doing a recursive make. These + variables should both default to the string `true', so that by + default nothing happens. + + All references to the parent of the source directory should use the +variable `MULTISRCTOP'. Instead of writing `$(srcdir)/..', you must +write `$(srcdir)/$(MULTISRCTOP)..'. + + Similarly, references to the parent of the object directory should +use the variable `MULTIBUILDTOP'. + + In the installation target, the libraries should be installed in the +subdirectory `MULTISUBDIR'. Instead of installing +`$(libdir)/libfoo.a', install `$(libdir)$(MULTISUBDIR)/libfoo.a'. + + The `config-ml.in' script also modifies the top level `Makefile' to +add `multi-do' and `multi-clean' targets which are used when building +multilibs. + + The default target of the `Makefile' should include the following +command: + @$(MULTIDO) $(FLAGS_TO_PASS) DO=all multi-do + +This assumes that `$(FLAGS_TO_PASS)' is defined as a set of variables +to pass to a recursive invocation of `make'. This will build all the +multilibs. Note that the default value of `MULTIDO' is `true', so by +default this command will do nothing. It will only do something in the +top level `Makefile' if multilibs were enabled. + + The `install' target of the `Makefile' should include the following +command: + @$(MULTIDO) $(FLAGS_TO_PASS) DO=install multi-do + + In general, any operation, other than clean, which should be +performed on all the multilibs should use a `$(MULTIDO)' line, setting +the variable `DO' to the target of each recursive call to `make'. + + The `clean' targets (`clean', `mostlyclean', etc.) should use +`$(MULTICLEAN)'. For example, the `clean' target should do this: + @$(MULTICLEAN) DO=clean multi-clean + + +File: configure.info, Node: FAQ, Next: Index, Prev: Multilibs, Up: Top + +Frequently Asked Questions +************************** + +Which do I run first, `autoconf' or `automake'? + Except when you first add autoconf or automake support to a + package, you shouldn't run either by hand. Instead, configure + with the `--enable-maintainer-mode' option, and let `make' take + care of it. + +`autoconf' says something about undefined macros. + This means that you have macros in your `configure.in' which are + not defined by `autoconf'. You may be using an old version of + `autoconf'; try building and installing a newer one. Make sure the + newly installled `autoconf' is first on your `PATH'. Also, see + the next question. + +My `configure' script has stuff like `CY_GNU_GETTEXT' in it. + This means that you have macros in your `configure.in' which should + be defined in your `aclocal.m4' file, but aren't. This usually + means that `aclocal' was not able to appropriate definitions of the + macros. Make sure that you have installed all the packages you + need. In particular, make sure that you have installed libtool + (this is where `AM_PROG_LIBTOOL' is defined) and gettext (this is + where `CY_GNU_GETTEXT' is defined, at least in the Cygnus version + of gettext). + +My `Makefile' has `@' characters in it. + This may mean that you tried to use an autoconf substitution in + your `Makefile.in' without adding the appropriate `AC_SUBST' call + to your `configure' script. Or it may just mean that you need to + rebuild `Makefile' in your build directory. To rebuild `Makefile' + from `Makefile.in', run the shell script `config.status' with no + arguments. If you need to force `configure' to run again, first + run `config.status --recheck'. These runs are normally done + automatically by `Makefile' targets, but if your `Makefile' has + gotten messed up you'll need to help them along. + +Why do I have to run both `config.status --recheck' and `config.status'? + Normally, you don't; they will be run automatically by `Makefile' + targets. If you do need to run them, use `config.status --recheck' + to run the `configure' script again with the same arguments as the + first time you ran it. Use `config.status' (with no arguments) to + regenerate all files (`Makefile', `config.h', etc.) based on the + results of the configure script. The two cases are separate + because it isn't always necessary to regenerate all the files + after running `config.status --recheck'. The `Makefile' targets + generated by automake will use the environment variables + `CONFIG_FILES' and `CONFIG_HEADERS' to only regenerate files as + they are needed. + +What is the Cygnus tree? + The Cygnus tree is used for various packages including gdb, the GNU + binutils, and egcs. It is also, of course, used for Cygnus + releases. It is the build system which was developed at Cygnus, + using the Cygnus configure script. It permits building many + different packages with a single configure and make. The + configure scripts in the tree are being converted to autoconf, but + the general build structure remains intact. + +Why do I have to keep rebuilding and reinstalling the tools? + I know, it's a pain. Unfortunately, there are bugs in the tools + themselves which need to be fixed, and each time that happens + everybody who uses the tools need to reinstall new versions of + them. I don't know if there is going to be a clever fix until the + tools stabilize. + +Why not just have a Cygnus tree `make' target to update the tools? + The tools unfortunately need to be installed before they can be + used. That means that they must be built using an appropriate + prefix, and it seems unwise to assume that every configuration + uses an appropriate prefix. It might be possible to make them + work in place, or it might be possible to install them in some + subdirectory; so far these approaches have not been implemented. + + +File: configure.info, Node: Index, Prev: FAQ, Up: Top + +Index +***** + +* Menu: + +* --build option: Build and Host Options. +* --host option: Build and Host Options. +* --target option: Specifying the Target. +* _GNU_SOURCE: Write configure.in. +* AC_CANONICAL_HOST: Using the Host Type. +* AC_CANONICAL_SYSTEM: Using the Target Type. +* AC_CONFIG_HEADER: Write configure.in. +* AC_EXEEXT: Write configure.in. +* AC_INIT: Write configure.in. +* AC_OUTPUT: Write configure.in. +* AC_PREREQ: Write configure.in. +* AC_PROG_CC: Write configure.in. +* AC_PROG_CXX: Write configure.in. +* acconfig.h: Written Developer Files. +* acconfig.h, writing: Write acconfig.h. +* acinclude.m4: Written Developer Files. +* aclocal.m4: Generated Developer Files. +* AM_CONFIG_HEADER: Write configure.in. +* AM_DISABLE_SHARED: Write configure.in. +* AM_EXEEXT: Write configure.in. +* AM_INIT_AUTOMAKE: Write configure.in. +* AM_MAINTAINER_MODE: Write configure.in. +* AM_PROG_LIBTOOL: Write configure.in. +* AM_PROG_LIBTOOL in configure: FAQ. +* build option: Build and Host Options. +* building with a cross compiler: Canadian Cross. +* canadian cross: Canadian Cross. +* canadian cross in configure: CCross in Configure. +* canadian cross in cygnus tree: CCross in Cygnus Tree. +* canadian cross in makefile: CCross in Make. +* canadian cross, configuring: Build and Host Options. +* canonical system names: Configuration Names. +* config.cache: Build Files Description. +* config.h: Build Files Description. +* config.h.in: Generated Developer Files. +* config.in: Generated Developer Files. +* config.status: Build Files Description. +* config.status --recheck: FAQ. +* configuration names: Configuration Names. +* configuration triplets: Configuration Names. +* configure: Generated Developer Files. +* configure build system: Build and Host Options. +* configure host: Build and Host Options. +* configure target: Specifying the Target. +* configure.in: Written Developer Files. +* configure.in, writing: Write configure.in. +* configuring a canadian cross: Build and Host Options. +* cross compiler: Cross Compilation Concepts. +* cross compiler, building with: Canadian Cross. +* cross tools: Cross Compilation Tools. +* CY_GNU_GETTEXT in configure: FAQ. +* cygnus configure: Cygnus Configure. +* goals: Goals. +* history: History. +* host names: Configuration Names. +* host option: Build and Host Options. +* host system: Host and Target. +* host triplets: Configuration Names. +* HOST_CC: CCross in Make. +* libg++ configure: Cygnus Configure in C++ Libraries. +* libio configure: Cygnus Configure in C++ Libraries. +* libstdc++ configure: Cygnus Configure in C++ Libraries. +* Makefile: Build Files Description. +* Makefile, garbage characters: FAQ. +* Makefile.am: Written Developer Files. +* Makefile.am, writing: Write Makefile.am. +* Makefile.in: Generated Developer Files. +* multilibs: Multilibs. +* stamp-h: Build Files Description. +* stamp-h.in: Generated Developer Files. +* system names: Configuration Names. +* system types: Configuration Names. +* target option: Specifying the Target. +* target system: Host and Target. +* triplets: Configuration Names. +* undefined macros: FAQ. + + + +Tag Table: +Node: Top971 +Node: Introduction1499 +Node: Goals2577 +Node: Tools3293 +Node: History4279 +Node: Building7269 +Node: Getting Started10356 +Node: Write configure.in10865 +Node: Write Makefile.am18108 +Node: Write acconfig.h21263 +Node: Generate files22797 +Node: Getting Started Example24755 +Node: Getting Started Example 125502 +Node: Getting Started Example 227436 +Node: Getting Started Example 330549 +Node: Generate Files in Example32916 +Node: Files33994 +Node: Developer Files34601 +Node: Developer Files Picture34973 +Node: Written Developer Files36282 +Node: Generated Developer Files38822 +Node: Build Files41954 +Node: Build Files Picture42607 +Node: Build Files Description43379 +Node: Support Files45373 +Node: Configuration Names48247 +Node: Configuration Name Definition48743 +Node: Using Configuration Names51058 +Node: Cross Compilation Tools53020 +Node: Cross Compilation Concepts53707 +Node: Host and Target54667 +Node: Using the Host Type56160 +Node: Specifying the Target57501 +Node: Using the Target Type58282 +Node: Cross Tools in the Cygnus Tree61705 +Node: Host and Target Libraries62754 +Node: Target Library Configure Scripts66491 +Node: Make Targets in Cygnus Tree69571 +Node: Target libiberty70907 +Node: Canadian Cross72282 +Node: Canadian Cross Example73119 +Node: Canadian Cross Concepts74230 +Node: Build Cross Host Tools75734 +Node: Build and Host Options76678 +Node: CCross not in Cygnus Tree78456 +Node: CCross in Cygnus Tree79426 +Node: Standard Cygnus CCross79839 +Node: Cross Cygnus CCross81191 +Node: Supporting Canadian Cross83979 +Node: CCross in Configure84586 +Node: CCross in Make87740 +Node: Cygnus Configure89331 +Node: Cygnus Configure Basics90162 +Node: Cygnus Configure in C++ Libraries94832 +Node: Multilibs95831 +Node: Multilibs in gcc96872 +Node: Multilibs in Target Libraries97942 +Node: FAQ102123 +Node: Index106219 + +End Tag Table diff --git a/etc/configure.man b/etc/configure.man deleted file mode 100644 index a7699041a7113..0000000000000 --- a/etc/configure.man +++ /dev/null @@ -1,166 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright (c) 1991, 1992, 1996 Cygnus Support -.\" written by K. Richard Pixley -.TH configure 1 "29 March 1996" "cygnus support" "Cygnus Support" -.de BP -.sp -.ti \-.2i -\(** -.. - -.SH NAME -configure \- prepare source code to be built - -.SH SYNOPSIS -configure HOST [--target=TARGET] [--srcdir=DIR] [--rm] - [--site=SITE] [--prefix=DIR] [--exec_prefix=DIR] - [--program_prefix=DIR] [--tmpdir=DIR] - [--with-PACKAGE[=YES/NO]] [--without-PACKAGE] - [--enable-FEATURE[=YES/NO]] [--disable-FEATURE] - [--norecursion] [--nfp] [-s] [-v] [-V | --version] [--help] - -.SH DESCRIPTION -.I configure -is a program used to prepare souce code to be built. It does this by -generating Makefiles and .gdbinit files, creating symlinks, recursing -in subdirectories, and some other miscellaneous file editing. - -.SH OPTIONS -.I configure -accepts the following options: - -.TP -.I \--target=TARGET -Requests that the sources be configured to target the -.I TARGET -machine. If no target is specified explicitly, the target is assumed -to be the same as the host. - -.TP -.I \--srcdir=DIR -tells configure to find the source in -.I DIR. -Object code is always built in the current directory, -.I `.'. - -.TP -.I \--rm -asks configure to remove a configuration rather than create one. - -.TP -.I \--site=SITE -asks configure to use any site-specific Makefile fragments for -.I SITE -when building Makefiles. - -.TP -.I \--prefix=DIR -sets the location in which to install files to -.I DIR. -The default is "/usr/local". - -.TP -.I \--exec_prefix=DIR -sets the root directory for host-dependent files to -.I DIR. -The default location is the value of -.I prefix. - -.TP -.I \--program_prefix=DIR -configures the source to install programs which have the same names as -common Unix programs, such as "make", in -.I DIR. -Also applies to programs which might be used for cross-compilation. - -.TP -.I \--tmpdir=DIR -sets the directory in which configure creates temporary files to -.I DIR. - -.TP -.I \--with-PACKAGE[=YES/NO] -sets a flag for the build to recognize that -.I PACKAGE -is explicitly present or not present. If -.I \=YES/NO -is nonexistent, the default is -.I YES. -.I \--without-PACKAGE -is equivalent to -.IR \--with-PACKAGE=no . - -.TP -.I \--enable-FEATURE[=YES/NO] -sets a flag for the build to recognize that -.I FEATURE -should be included or not included. If -.I \=YES/NO -is nonexistent, the default is -.I YES. -.I \--disable-FEATURE -is equivalent to -.IR --enable-FEATURE=no . - -.TP -.I \--norecursion -asks that only the current directory be configured. Normally -.I configure -recurs on subdirectories. - -.TP -.I \-nfp -Notifies -.I configure -that all of the specified hosts have -.I no floating point -units. - -.TP -.I \-s -used internally by configure to supress status messages on -subdirectory recursions. Override with -.I \-v - -.TP -.I \-v -verbose output. Asks that configure print status lines for each -directory configured. Normally, only the status lines for the current -directory are printed. - -.TP -.I \--version -.I \-V -prints -.I configure -version number. - -.TP -.I \-help -displays a brief usage summary. - - -.SH FILES -configure.in for each directory's individual needs -.br -Makefile.in Makefile template -.br -config.sub for parsing configuration names -.br -config.guess for guessing HOST when not specified -.br -config.status non-recursively rebuilds current directory - -.SH FILES -.ta \w'gmon.sum 'u -a.out the namelist and text space. -.br -gmon.out dynamic call graph and profile. -.br -gmon.sum summarized dynamic call graph and profile. - -.SH "SEE ALSO" -.RB "`\|" configure "\|'" -entry in -.B -info. diff --git a/etc/configure.texi b/etc/configure.texi index 91401671f9254..d69dc414d0f3e 100644 --- a/etc/configure.texi +++ b/etc/configure.texi @@ -1451,7 +1451,7 @@ canonical configuration name (which will be the case if @smallexample case "$@{host@}" in -i[3456]86-*-linux-gnu*) do something ;; +i[3-7]86-*-linux-gnu*) do something ;; sparc*-sun-solaris2.[56789]*) do something ;; sparc*-sun-solaris*) do something ;; mips*-*-elf*) do something ;; @@ -1465,7 +1465,7 @@ field, in order to match the version number which will be generated by In most cases you must be careful to match a range of processor types. For most processor families, a trailing @samp{*} suffices, as in @samp{mips*} above. For the i386 family, something along the lines of -@samp{i[3456]86} suffices at present. For the m68k family, you will +@samp{i[3-7]86} suffices at present. For the m68k family, you will need something like @samp{m68*}. Of course, if you do not need to match on the processor, it is simpler to just replace the entire field by a @samp{*}, as in @samp{*-*-irix*}. diff --git a/etc/fdl.texi b/etc/fdl.texi new file mode 100644 index 0000000000000..138705678816e --- /dev/null +++ b/etc/fdl.texi @@ -0,0 +1,368 @@ +@c -*-texinfo-*- +@node GNU Free Documentation License, , , Copying This Manual + +@appendix GNU Free Documentation License +@center Version 1.1, March 2000 + +@display +Copyright (C) 2000 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. +@end display +@sp 1 +@enumerate 0 +@item +PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +written document ``free'' in the sense of freedom: to assure everyone +the effective freedom to copy and redistribute it, with or without +modifying it, either commercially or noncommercially. Secondarily, +this License preserves for the author and publisher a way to get +credit for their work, while not being considered responsible for +modifications made by others. + +This License is a kind of ``copyleft'', which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + +@sp 1 +@item +APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work that contains a +notice placed by the copyright holder saying it can be distributed +under the terms of this License. The ``Document'', below, refers to any +such manual or work. Any member of the public is a licensee, and is +addressed as ``you.'' + +A ``Modified Version'' of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A ``Secondary Section'' is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall subject +(or to related matters) and contains nothing that could fall directly +within that overall subject. (For example, if the Document is in part a +textbook of mathematics, a Secondary Section may not explain any +mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The ``Invariant Sections'' are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. + +The ``Cover Texts'' are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. + +A ``Transparent'' copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, whose contents can be viewed and edited directly and +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup has been designed to thwart or discourage +subsequent modification by readers is not Transparent. A copy that is +not ``Transparent'' is called ``Opaque.'' + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML designed for human modification. Opaque formats include +PostScript, PDF, proprietary formats that can be read and edited only +by proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML produced by some word processors for output +purposes only. + +The ``Title Page'' means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, ``Title Page'' means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. +@sp 1 +@item +VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. +@sp 1 +@item +COPYING IN QUANTITY + +If you publish printed copies of the Document numbering more than 100, +and the Document's license notice requires Cover Texts, you must enclose +the copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a publicly-accessible computer-network location containing a complete +Transparent copy of the Document, free of added material, which the +general network-using public has access to download anonymously at no +charge using public-standard network protocols. If you use the latter +option, you must take reasonably prudent steps, when you begin +distribution of Opaque copies in quantity, to ensure that this +Transparent copy will remain thus accessible at the stated location +until at least one year after the last time you distribute an Opaque +copy (directly or through your agents or retailers) of that edition to +the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. +@sp 1 +@item +MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +A. Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission.@* +B. List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has less than five).@* +C. State on the Title page the name of the publisher of the + Modified Version, as the publisher.@* +D. Preserve all the copyright notices of the Document.@* +E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices.@* +F. Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below.@* +G. Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice.@* +H. Include an unaltered copy of this License.@* +I. Preserve the section entitled ``History'', and its title, and add to + it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section entitled ``History'' in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence.@* +J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the ``History'' section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission.@* +K. In any section entitled ``Acknowledgements'' or ``Dedications'', + preserve the section's title, and preserve in the section all the + substance and tone of each of the contributor acknowledgements + and/or dedications given therein.@* +L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles.@* +M. Delete any section entitled ``Endorsements.'' Such a section + may not be included in the Modified Version.@* +N. Do not retitle any existing section as ``Endorsements'' + or to conflict in title with any Invariant Section.@* +@sp 1 +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section entitled ``Endorsements'', provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. +@sp 1 +@item +COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections entitled ``History'' +in the various original documents, forming one section entitled +``History''; likewise combine any sections entitled ``Acknowledgements'', +and any sections entitled ``Dedications.'' You must delete all sections +entitled ``Endorsements.'' +@sp 1 +@item +COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. +@sp 1 +@item +AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, does not as a whole count as a Modified Version +of the Document, provided no compilation copyright is claimed for the +compilation. Such a compilation is called an ``aggregate'', and this +License does not apply to the other self-contained works thus compiled +with the Document, on account of their being thus compiled, if they +are not themselves derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one quarter +of the entire aggregate, the Document's Cover Texts may be placed on +covers that surround only the Document within the aggregate. +Otherwise they must appear on covers around the whole aggregate. +@sp 1 +@item +TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License provided that you also include the +original English version of this License. In case of a disagreement +between the translation and the original English version of this +License, the original English version will prevail. +@sp 1 +@item +TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document 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. +@sp 1 +@item +FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation 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. See +http://www.gnu.org/copyleft/. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License ``or any later version'' applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. + +@end enumerate + +@unnumberedsec ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + +@smallexample +@group +Copyright (C) @var{year} @var{your name}. +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 +or any later version published by the Free Software Foundation; +with the Invariant Sections being @var{list their titles}, with the +Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}. +A copy of the license is included in the section entitled "GNU +Free Documentation License." +@end group +@end smallexample + +If you have no Invariant Sections, write ``with no Invariant Sections'' +instead of saying which ones are invariant. If you have no +Front-Cover Texts, write ``no Front-Cover Texts'' instead of +``Front-Cover Texts being @var{list}''; likewise for Back-Cover Texts. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. diff --git a/etc/standards.info b/etc/standards.info new file mode 100644 index 0000000000000..0c5be291ace02 --- /dev/null +++ b/etc/standards.info @@ -0,0 +1,4893 @@ +This is standards.info, produced by makeinfo version 4.6 from +./standards.texi. + +START-INFO-DIR-ENTRY +* Standards: (standards). GNU coding standards. +END-INFO-DIR-ENTRY + + GNU Coding Standards Copyright (C) 1992, 1993, 1994, 1995, 1996, +1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the section entitled "GNU +Free Documentation License". + + +File: standards.info, Node: Top, Next: Preface, Prev: (dir), Up: (dir) + +Version +******* + +Last updated February 14, 2002. + +* Menu: + +* Preface:: About the GNU Coding Standards +* Legal Issues:: Keeping Free Software Free +* Design Advice:: General Program Design +* Program Behavior:: Program Behavior for All Programs +* Writing C:: Making The Best Use of C +* Documentation:: Documenting Programs +* Managing Releases:: The Release Process +* References:: References to Non-Free Software or Documentation +* Copying This Manual:: How to Make Copies of This Manual +* Index:: + + +File: standards.info, Node: Preface, Next: Legal Issues, Prev: Top, Up: Top + +About the GNU Coding Standards +****************************** + +The GNU Coding Standards were written by Richard Stallman and other GNU +Project volunteers. Their purpose is to make the GNU system clean, +consistent, and easy to install. This document can also be read as a +guide to writing portable, robust and reliable programs. It focuses on +programs written in C, but many of the rules and principles are useful +even if you write in another programming language. The rules often +state reasons for writing in a certain way. + + This release of the GNU Coding Standards was last updated February +14, 2002. + + If you did not obtain this file directly from the GNU project and +recently, please check for a newer version. You can ftp the GNU Coding +Standards from any GNU FTP host in the directory `/pub/gnu/standards/'. +The GNU Coding Standards are available there in several different +formats: `standards.text', `standards.info', and `standards.dvi', as +well as the Texinfo "source" which is divided in two files: +`standards.texi' and `make-stds.texi'. The GNU Coding Standards are +also available on the GNU World Wide Web server: +`http://www.gnu.org/prep/standards_toc.html'. + + Corrections or suggestions for this document should be sent to +. If you make a suggestion, please include a +suggested new wording for it; our time is limited. We prefer a context +diff to the `standards.texi' or `make-stds.texi' files, but if you +don't have those files, please mail your suggestion anyway. + + These standards cover the minimum of what is important when writing a +GNU package. Likely, the needs for additional standards will come up. +Sometimes, you might suggest that such standards be added to this +document. If you think your standards would be generally useful, please +do suggest them. + + You should also set standards for your package on many questions not +addressed or not firmly specified here. The most important point is to +be self-consistent--try to stick to the conventions you pick, and try +to document them as much as possible. That way, your program will be +more maintainable by others. + + +File: standards.info, Node: Legal Issues, Next: Design Advice, Prev: Preface, Up: Top + +Keeping Free Software Free +************************** + +This node discusses how you can make sure that GNU software avoids +legal difficulties, and other related issues. + +* Menu: + +* Reading Non-Free Code:: Referring to Proprietary Programs +* Contributions:: Accepting Contributions +* Trademarks:: How We Deal with Trademark Issues + + +File: standards.info, Node: Reading Non-Free Code, Next: Contributions, Up: Legal Issues + +Referring to Proprietary Programs +================================= + +Don't in any circumstances refer to Unix source code for or during your +work on GNU! (Or to any other proprietary programs.) + + If you have a vague recollection of the internals of a Unix program, +this does not absolutely mean you can't write an imitation of it, but +do try to organize the imitation internally along different lines, +because this is likely to make the details of the Unix version +irrelevant and dissimilar to your results. + + For example, Unix utilities were generally optimized to minimize +memory use; if you go for speed instead, your program will be very +different. You could keep the entire input file in core and scan it +there instead of using stdio. Use a smarter algorithm discovered more +recently than the Unix program. Eliminate use of temporary files. Do +it in one pass instead of two (we did this in the assembler). + + Or, on the contrary, emphasize simplicity instead of speed. For some +applications, the speed of today's computers makes simpler algorithms +adequate. + + Or go for generality. For example, Unix programs often have static +tables or fixed-size strings, which make for arbitrary limits; use +dynamic allocation instead. Make sure your program handles NULs and +other funny characters in the input files. Add a programming language +for extensibility and write part of the program in that language. + + Or turn some parts of the program into independently usable +libraries. Or use a simple garbage collector instead of tracking +precisely when to free memory, or use a new GNU facility such as +obstacks. + + +File: standards.info, Node: Contributions, Next: Trademarks, Prev: Reading Non-Free Code, Up: Legal Issues + +Accepting Contributions +======================= + +If the program you are working on is copyrighted by the Free Software +Foundation, then when someone else sends you a piece of code to add to +the program, we need legal papers to use it--just as we asked you to +sign papers initially. _Each_ person who makes a nontrivial +contribution to a program must sign some sort of legal papers in order +for us to have clear title to the program; the main author alone is not +enough. + + So, before adding in any contributions from other people, please tell +us, so we can arrange to get the papers. Then wait until we tell you +that we have received the signed papers, before you actually use the +contribution. + + This applies both before you release the program and afterward. If +you receive diffs to fix a bug, and they make significant changes, we +need legal papers for that change. + + This also applies to comments and documentation files. For copyright +law, comments and code are just text. Copyright applies to all kinds of +text, so we need legal papers for all kinds. + + We know it is frustrating to ask for legal papers; it's frustrating +for us as well. But if you don't wait, you are going out on a limb--for +example, what if the contributor's employer won't sign a disclaimer? +You might have to take that code out again! + + You don't need papers for changes of a few lines here or there, since +they are not significant for copyright purposes. Also, you don't need +papers if all you get from the suggestion is some ideas, not actual code +which you use. For example, if someone send you one implementation, but +you write a different implementation of the same idea, you don't need to +get papers. + + The very worst thing is if you forget to tell us about the other +contributor. We could be very embarrassed in court some day as a +result. + + We have more detailed advice for maintainers of programs; if you have +reached the stage of actually maintaining a program for GNU (whether +released or not), please ask us for a copy. + + +File: standards.info, Node: Trademarks, Prev: Contributions, Up: Legal Issues + +Trademarks +========== + +Please do not include any trademark acknowledgements in GNU software +packages or documentation. + + Trademark acknowledgements are the statements that such-and-such is a +trademark of so-and-so. The GNU Project has no objection to the basic +idea of trademarks, but these acknowledgements feel like kowtowing, so +we don't use them. There is no legal requirement for them. + + What is legally required, as regards other people's trademarks, is to +avoid using them in ways which a reader might read as naming or labeling +our own programs or activities. For example, since "Objective C" is +(or at least was) a trademark, we made sure to say that we provide a +"compiler for the Objective C language" rather than an "Objective C +compiler". The latter is meant to be short for the former, but it does +not explicitly state the relationship, so it could be misinterpreted as +using "Objective C" as a label for the compiler rather than for the +language. + + +File: standards.info, Node: Design Advice, Next: Program Behavior, Prev: Legal Issues, Up: Top + +General Program Design +********************** + +This node discusses some of the issues you should take into account +when designing your program. + +* Menu: + +* Source Language:: Which languges to use. +* Compatibility:: Compatibility with other implementations +* Using Extensions:: Using non-standard features +* Standard C:: Using Standard C features +* Conditional Compilation:: Compiling Code Only If A Conditional is True + + +File: standards.info, Node: Source Language, Next: Compatibility, Up: Design Advice + +Which Languages to Use +====================== + +When you want to use a language that gets compiled and runs at high +speed, the best language to use is C. Using another language is like +using a non-standard feature: it will cause trouble for users. Even if +GCC supports the other language, users may find it inconvenient to have +to install the compiler for that other language in order to build your +program. For example, if you write your program in C++, people will +have to install the GNU C++ compiler in order to compile your program. + + C has one other advantage over C++ and other compiled languages: more +people know C, so more people will find it easy to read and modify the +program if it is written in C. + + So in general it is much better to use C, rather than the comparable +alternatives. + + But there are two exceptions to that conclusion: + + * It is no problem to use another language to write a tool + specifically intended for use with that language. That is because + the only people who want to build the tool will be those who have + installed the other language anyway. + + * If an application is of interest only to a narrow part of the + community, then the question of which language it is written in + has less effect on other people, so you may as well please + yourself. + + Many programs are designed to be extensible: they include an +interpreter for a language that is higher level than C. Often much of +the program is written in that language, too. The Emacs editor +pioneered this technique. + + The standard extensibility interpreter for GNU software is GUILE, +which implements the language Scheme (an especially clean and simple +dialect of Lisp). `http://www.gnu.org/software/guile/'. We don't +reject programs written in other "scripting languages" such as Perl and +Python, but using GUILE is very important for the overall consistency of +the GNU system. + + +File: standards.info, Node: Compatibility, Next: Using Extensions, Prev: Source Language, Up: Design Advice + +Compatibility with Other Implementations +======================================== + +With occasional exceptions, utility programs and libraries for GNU +should be upward compatible with those in Berkeley Unix, and upward +compatible with Standard C if Standard C specifies their behavior, and +upward compatible with POSIX if POSIX specifies their behavior. + + When these standards conflict, it is useful to offer compatibility +modes for each of them. + + Standard C and POSIX prohibit many kinds of extensions. Feel free +to make the extensions anyway, and include a `--ansi', `--posix', or +`--compatible' option to turn them off. However, if the extension has +a significant chance of breaking any real programs or scripts, then it +is not really upward compatible. So you should try to redesign its +interface to make it upward compatible. + + Many GNU programs suppress extensions that conflict with POSIX if the +environment variable `POSIXLY_CORRECT' is defined (even if it is +defined with a null value). Please make your program recognize this +variable if appropriate. + + When a feature is used only by users (not by programs or command +files), and it is done poorly in Unix, feel free to replace it +completely with something totally different and better. (For example, +`vi' is replaced with Emacs.) But it is nice to offer a compatible +feature as well. (There is a free `vi' clone, so we offer it.) + + Additional useful features are welcome regardless of whether there +is any precedent for them. + + +File: standards.info, Node: Using Extensions, Next: Standard C, Prev: Compatibility, Up: Design Advice + +Using Non-standard Features +=========================== + +Many GNU facilities that already exist support a number of convenient +extensions over the comparable Unix facilities. Whether to use these +extensions in implementing your program is a difficult question. + + On the one hand, using the extensions can make a cleaner program. +On the other hand, people will not be able to build the program unless +the other GNU tools are available. This might cause the program to +work on fewer kinds of machines. + + With some extensions, it might be easy to provide both alternatives. +For example, you can define functions with a "keyword" `INLINE' and +define that as a macro to expand into either `inline' or nothing, +depending on the compiler. + + In general, perhaps it is best not to use the extensions if you can +straightforwardly do without them, but to use the extensions if they +are a big improvement. + + An exception to this rule are the large, established programs (such +as Emacs) which run on a great variety of systems. Using GNU +extensions in such programs would make many users unhappy, so we don't +do that. + + Another exception is for programs that are used as part of +compilation: anything that must be compiled with other compilers in +order to bootstrap the GNU compilation facilities. If these require +the GNU compiler, then no one can compile them without having them +installed already. That would be extremely troublesome in certain +cases. + + +File: standards.info, Node: Standard C, Next: Conditional Compilation, Prev: Using Extensions, Up: Design Advice + +Standard C and Pre-Standard C +============================= + +1989 Standard C is widespread enough now that it is ok to use its +features in new programs. There is one exception: do not ever use the +"trigraph" feature of Standard C. + + 1999 Standard C is not widespread yet, so please do not require its +features in programs. It is ok to use its features if they are present. + + However, it is easy to support pre-standard compilers in most +programs, so if you know how to do that, feel free. If a program you +are maintaining has such support, you should try to keep it working. + + To support pre-standard C, instead of writing function definitions in +standard prototype form, + + int + foo (int x, int y) + ... + +write the definition in pre-standard style like this, + + int + foo (x, y) + int x, y; + ... + +and use a separate declaration to specify the argument prototype: + + int foo (int, int); + + You need such a declaration anyway, in a header file, to get the +benefit of prototypes in all the files where the function is called. +And once you have the declaration, you normally lose nothing by writing +the function definition in the pre-standard style. + + This technique does not work for integer types narrower than `int'. +If you think of an argument as being of a type narrower than `int', +declare it as `int' instead. + + There are a few special cases where this technique is hard to use. +For example, if a function argument needs to hold the system type +`dev_t', you run into trouble, because `dev_t' is shorter than `int' on +some machines; but you cannot use `int' instead, because `dev_t' is +wider than `int' on some machines. There is no type you can safely use +on all machines in a non-standard definition. The only way to support +non-standard C and pass such an argument is to check the width of +`dev_t' using Autoconf and choose the argument type accordingly. This +may not be worth the trouble. + + In order to support pre-standard compilers that do not recognize +prototypes, you may want to use a preprocessor macro like this: + + /* Declare the prototype for a general external function. */ + #if defined (__STDC__) || defined (WINDOWSNT) + #define P_(proto) proto + #else + #define P_(proto) () + #endif + + +File: standards.info, Node: Conditional Compilation, Prev: Standard C, Up: Design Advice + +Conditional Compilation +======================= + +When supporting configuration options already known when building your +program we prefer using `if (... )' over conditional compilation, as in +the former case the compiler is able to perform more extensive checking +of all possible code paths. + + For example, please write + + if (HAS_FOO) + ... + else + ... + + instead of: + + #ifdef HAS_FOO + ... + #else + ... + #endif + + A modern compiler such as GCC will generate exactly the same code in +both cases, and we have been using similar techniques with good success +in several projects. + + While this is not a silver bullet solving all portability problems, +following this policy would have saved the GCC project alone many person +hours if not days per year. + + In the case of function-like macros like `REVERSIBLE_CC_MODE' in GCC +which cannot be simply used in `if( ...)' statements, there is an easy +workaround. Simply introduce another macro `HAS_REVERSIBLE_CC_MODE' as +in the following example: + + #ifdef REVERSIBLE_CC_MODE + #define HAS_REVERSIBLE_CC_MODE 1 + #else + #define HAS_REVERSIBLE_CC_MODE 0 + #endif + + +File: standards.info, Node: Program Behavior, Next: Writing C, Prev: Design Advice, Up: Top + +Program Behavior for All Programs +********************************* + +This node describes conventions for writing robust software. It also +describes general standards for error messages, the command line +interface, and how libraries should behave. + +* Menu: + +* Semantics:: Writing robust programs +* Libraries:: Library behavior +* Errors:: Formatting error messages +* User Interfaces:: Standards about interfaces generally +* Graphical Interfaces:: Standards for graphical interfaces +* Command-Line Interfaces:: Standards for command line interfaces +* Option Table:: Table of long options +* Memory Usage:: When and how to care about memory needs +* File Usage:: Which files to use, and where + + +File: standards.info, Node: Semantics, Next: Libraries, Up: Program Behavior + +Writing Robust Programs +======================= + +Avoid arbitrary limits on the length or number of _any_ data structure, +including file names, lines, files, and symbols, by allocating all data +structures dynamically. In most Unix utilities, "long lines are +silently truncated". This is not acceptable in a GNU utility. + + Utilities reading files should not drop NUL characters, or any other +nonprinting characters _including those with codes above 0177_. The +only sensible exceptions would be utilities specifically intended for +interface to certain types of terminals or printers that can't handle +those characters. Whenever possible, try to make programs work +properly with sequences of bytes that represent multibyte characters, +using encodings such as UTF-8 and others. + + Check every system call for an error return, unless you know you +wish to ignore errors. Include the system error text (from `perror' or +equivalent) in _every_ error message resulting from a failing system +call, as well as the name of the file if any and the name of the +utility. Just "cannot open foo.c" or "stat failed" is not sufficient. + + Check every call to `malloc' or `realloc' to see if it returned +zero. Check `realloc' even if you are making the block smaller; in a +system that rounds block sizes to a power of 2, `realloc' may get a +different block if you ask for less space. + + In Unix, `realloc' can destroy the storage block if it returns zero. +GNU `realloc' does not have this bug: if it fails, the original block +is unchanged. Feel free to assume the bug is fixed. If you wish to +run your program on Unix, and wish to avoid lossage in this case, you +can use the GNU `malloc'. + + You must expect `free' to alter the contents of the block that was +freed. Anything you want to fetch from the block, you must fetch before +calling `free'. + + If `malloc' fails in a noninteractive program, make that a fatal +error. In an interactive program (one that reads commands from the +user), it is better to abort the command and return to the command +reader loop. This allows the user to kill other processes to free up +virtual memory, and then try the command again. + + Use `getopt_long' to decode arguments, unless the argument syntax +makes this unreasonable. + + When static storage is to be written in during program execution, use +explicit C code to initialize it. Reserve C initialized declarations +for data that will not be changed. + + Try to avoid low-level interfaces to obscure Unix data structures +(such as file directories, utmp, or the layout of kernel memory), since +these are less likely to work compatibly. If you need to find all the +files in a directory, use `readdir' or some other high-level interface. +These are supported compatibly by GNU. + + The preferred signal handling facilities are the BSD variant of +`signal', and the POSIX `sigaction' function; the alternative USG +`signal' interface is an inferior design. + + Nowadays, using the POSIX signal functions may be the easiest way to +make a program portable. If you use `signal', then on GNU/Linux +systems running GNU libc version 1, you should include `bsd/signal.h' +instead of `signal.h', so as to get BSD behavior. It is up to you +whether to support systems where `signal' has only the USG behavior, or +give up on them. + + In error checks that detect "impossible" conditions, just abort. +There is usually no point in printing any message. These checks +indicate the existence of bugs. Whoever wants to fix the bugs will have +to read the source code and run a debugger. So explain the problem with +comments in the source. The relevant data will be in variables, which +are easy to examine with the debugger, so there is no point moving them +elsewhere. + + Do not use a count of errors as the exit status for a program. +_That does not work_, because exit status values are limited to 8 bits +(0 through 255). A single run of the program might have 256 errors; if +you try to return 256 as the exit status, the parent process will see 0 +as the status, and it will appear that the program succeeded. + + If you make temporary files, check the `TMPDIR' environment +variable; if that variable is defined, use the specified directory +instead of `/tmp'. + + In addition, be aware that there is a possible security problem when +creating temporary files in world-writable directories. In C, you can +avoid this problem by creating temporary files in this manner: + + fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0600); + +or by using the `mkstemps' function from libiberty. + + In bash, use `set -C' to avoid this problem. + + +File: standards.info, Node: Libraries, Next: Errors, Prev: Semantics, Up: Program Behavior + +Library Behavior +================ + +Try to make library functions reentrant. If they need to do dynamic +storage allocation, at least try to avoid any nonreentrancy aside from +that of `malloc' itself. + + Here are certain name conventions for libraries, to avoid name +conflicts. + + Choose a name prefix for the library, more than two characters long. +All external function and variable names should start with this prefix. +In addition, there should only be one of these in any given library +member. This usually means putting each one in a separate source file. + + An exception can be made when two external symbols are always used +together, so that no reasonable program could use one without the +other; then they can both go in the same file. + + External symbols that are not documented entry points for the user +should have names beginning with `_'. The `_' should be followed by +the chosen name prefix for the library, to prevent collisions with +other libraries. These can go in the same files with user entry points +if you like. + + Static functions and variables can be used as you like and need not +fit any naming convention. + + +File: standards.info, Node: Errors, Next: User Interfaces, Prev: Libraries, Up: Program Behavior + +Formatting Error Messages +========================= + +Error messages from compilers should look like this: + + SOURCE-FILE-NAME:LINENO: MESSAGE + +If you want to mention the column number, use this format: + + SOURCE-FILE-NAME:LINENO:COLUMN: MESSAGE + +Line numbers should start from 1 at the beginning of the file, and +column numbers should start from 1 at the beginning of the line. (Both +of these conventions are chosen for compatibility.) Calculate column +numbers assuming that space and all ASCII printing characters have +equal width, and assuming tab stops every 8 columns. + + Error messages from other noninteractive programs should look like +this: + + PROGRAM:SOURCE-FILE-NAME:LINENO: MESSAGE + +when there is an appropriate source file, or like this: + + PROGRAM: MESSAGE + +when there is no relevant source file. + + If you want to mention the column number, use this format: + + PROGRAM:SOURCE-FILE-NAME:LINENO:COLUMN: MESSAGE + + In an interactive program (one that is reading commands from a +terminal), it is better not to include the program name in an error +message. The place to indicate which program is running is in the +prompt or with the screen layout. (When the same program runs with +input from a source other than a terminal, it is not interactive and +would do best to print error messages using the noninteractive style.) + + The string MESSAGE should not begin with a capital letter when it +follows a program name and/or file name. Also, it should not end with +a period. + + Error messages from interactive programs, and other messages such as +usage messages, should start with a capital letter. But they should not +end with a period. + + +File: standards.info, Node: User Interfaces, Next: Graphical Interfaces, Prev: Errors, Up: Program Behavior + +Standards for Interfaces Generally +================================== + +Please don't make the behavior of a utility depend on the name used to +invoke it. It is useful sometimes to make a link to a utility with a +different name, and that should not change what it does. + + Instead, use a run time option or a compilation switch or both to +select among the alternate behaviors. + + Likewise, please don't make the behavior of the program depend on the +type of output device it is used with. Device independence is an +important principle of the system's design; do not compromise it merely +to save someone from typing an option now and then. (Variation in error +message syntax when using a terminal is ok, because that is a side issue +that people do not depend on.) + + If you think one behavior is most useful when the output is to a +terminal, and another is most useful when the output is a file or a +pipe, then it is usually best to make the default behavior the one that +is useful with output to a terminal, and have an option for the other +behavior. + + Compatibility requires certain programs to depend on the type of +output device. It would be disastrous if `ls' or `sh' did not do so in +the way all users expect. In some of these cases, we supplement the +program with a preferred alternate version that does not depend on the +output device type. For example, we provide a `dir' program much like +`ls' except that its default output format is always multi-column +format. + + +File: standards.info, Node: Graphical Interfaces, Next: Command-Line Interfaces, Prev: User Interfaces, Up: Program Behavior + +Standards for Graphical Interfaces +================================== + +When you write a program that provides a graphical user interface, +please make it work with X Windows and the GTK toolkit unless the +functionality specifically requires some alternative (for example, +"displaying jpeg images while in console mode"). + + In addition, please provide a command-line interface to control the +functionality. (In many cases, the graphical user interface can be a +separate program which invokes the command-line program.) This is so +that the same jobs can be done from scripts. + + Please also consider providing a CORBA interface (for use from +GNOME), a library interface (for use from C), and perhaps a +keyboard-driven console interface (for use by users from console mode). +Once you are doing the work to provide the functionality and the +graphical interface, these won't be much extra work. + + +File: standards.info, Node: Command-Line Interfaces, Next: Option Table, Prev: Graphical Interfaces, Up: Program Behavior + +Standards for Command Line Interfaces +===================================== + +It is a good idea to follow the POSIX guidelines for the command-line +options of a program. The easiest way to do this is to use `getopt' to +parse them. Note that the GNU version of `getopt' will normally permit +options anywhere among the arguments unless the special argument `--' +is used. This is not what POSIX specifies; it is a GNU extension. + + Please define long-named options that are equivalent to the +single-letter Unix-style options. We hope to make GNU more user +friendly this way. This is easy to do with the GNU function +`getopt_long'. + + One of the advantages of long-named options is that they can be +consistent from program to program. For example, users should be able +to expect the "verbose" option of any GNU program which has one, to be +spelled precisely `--verbose'. To achieve this uniformity, look at the +table of common long-option names when you choose the option names for +your program (*note Option Table::). + + It is usually a good idea for file names given as ordinary arguments +to be input files only; any output files would be specified using +options (preferably `-o' or `--output'). Even if you allow an output +file name as an ordinary argument for compatibility, try to provide an +option as another way to specify it. This will lead to more consistency +among GNU utilities, and fewer idiosyncracies for users to remember. + + All programs should support two standard options: `--version' and +`--help'. + +`--version' + This option should direct the program to print information about + its name, version, origin and legal status, all on standard + output, and then exit successfully. Other options and arguments + should be ignored once this is seen, and the program should not + perform its normal function. + + The first line is meant to be easy for a program to parse; the + version number proper starts after the last space. In addition, + it contains the canonical name for this program, in this format: + + GNU Emacs 19.30 + + The program's name should be a constant string; _don't_ compute it + from `argv[0]'. The idea is to state the standard or canonical + name for the program, not its file name. There are other ways to + find out the precise file name where a command is found in `PATH'. + + If the program is a subsidiary part of a larger package, mention + the package name in parentheses, like this: + + emacsserver (GNU Emacs) 19.30 + + If the package has a version number which is different from this + program's version number, you can mention the package version + number just before the close-parenthesis. + + If you *need* to mention the version numbers of libraries which + are distributed separately from the package which contains this + program, you can do so by printing an additional line of version + info for each library you want to mention. Use the same format + for these lines as for the first line. + + Please do not mention all of the libraries that the program uses + "just for completeness"--that would produce a lot of unhelpful + clutter. Please mention library version numbers only if you find + in practice that they are very important to you in debugging. + + The following line, after the version number line or lines, should + be a copyright notice. If more than one copyright notice is + called for, put each on a separate line. + + Next should follow a brief statement that the program is free + software, and that users are free to copy and change it on certain + conditions. If the program is covered by the GNU GPL, say so + here. Also mention that there is no warranty, to the extent + permitted by law. + + It is ok to finish the output with a list of the major authors of + the program, as a way of giving credit. + + Here's an example of output that follows these rules: + + GNU Emacs 19.34.5 + Copyright (C) 1996 Free Software Foundation, Inc. + GNU Emacs comes with NO WARRANTY, + to the extent permitted by law. + You may redistribute copies of GNU Emacs + under the terms of the GNU General Public License. + For more information about these matters, + see the files named COPYING. + + You should adapt this to your program, of course, filling in the + proper year, copyright holder, name of program, and the references + to distribution terms, and changing the rest of the wording as + necessary. + + This copyright notice only needs to mention the most recent year in + which changes were made--there's no need to list the years for + previous versions' changes. You don't have to mention the name of + the program in these notices, if that is inconvenient, since it + appeared in the first line. + + Translations of the above lines must preserve the validity of the + copyright notices (*note Internationalization::). If the + translation's character set supports it, the `(C)' should be + replaced with the copyright symbol, as follows: + + (the official copyright symbol, which is the letter C in a circle); + + Write the word "Copyright" exactly like that, in English. Do not + translate it into another language. International treaties + recognize the English word "Copyright"; translations into other + languages do not have legal significance. + +`--help' + This option should output brief documentation for how to invoke the + program, on standard output, then exit successfully. Other + options and arguments should be ignored once this is seen, and the + program should not perform its normal function. + + Near the end of the `--help' option's output there should be a line + that says where to mail bug reports. It should have this format: + + Report bugs to MAILING-ADDRESS. + + +File: standards.info, Node: Option Table, Next: Memory Usage, Prev: Command-Line Interfaces, Up: Program Behavior + +Table of Long Options +===================== + +Here is a table of long options used by GNU programs. It is surely +incomplete, but we aim to list all the options that a new program might +want to be compatible with. If you use names not already in the table, +please send a list of them, with their +meanings, so we can update the table. + +`after-date' + `-N' in `tar'. + +`all' + `-a' in `du', `ls', `nm', `stty', `uname', and `unexpand'. + +`all-text' + `-a' in `diff'. + +`almost-all' + `-A' in `ls'. + +`append' + `-a' in `etags', `tee', `time'; `-r' in `tar'. + +`archive' + `-a' in `cp'. + +`archive-name' + `-n' in `shar'. + +`arglength' + `-l' in `m4'. + +`ascii' + `-a' in `diff'. + +`assign' + `-v' in `gawk'. + +`assume-new' + `-W' in Make. + +`assume-old' + `-o' in Make. + +`auto-check' + `-a' in `recode'. + +`auto-pager' + `-a' in `wdiff'. + +`auto-reference' + `-A' in `ptx'. + +`avoid-wraps' + `-n' in `wdiff'. + +`background' + For server programs, run in the background. + +`backward-search' + `-B' in `ctags'. + +`basename' + `-f' in `shar'. + +`batch' + Used in GDB. + +`baud' + Used in GDB. + +`before' + `-b' in `tac'. + +`binary' + `-b' in `cpio' and `diff'. + +`bits-per-code' + `-b' in `shar'. + +`block-size' + Used in `cpio' and `tar'. + +`blocks' + `-b' in `head' and `tail'. + +`break-file' + `-b' in `ptx'. + +`brief' + Used in various programs to make output shorter. + +`bytes' + `-c' in `head', `split', and `tail'. + +`c++' + `-C' in `etags'. + +`catenate' + `-A' in `tar'. + +`cd' + Used in various programs to specify the directory to use. + +`changes' + `-c' in `chgrp' and `chown'. + +`classify' + `-F' in `ls'. + +`colons' + `-c' in `recode'. + +`command' + `-c' in `su'; `-x' in GDB. + +`compare' + `-d' in `tar'. + +`compat' + Used in `gawk'. + +`compress' + `-Z' in `tar' and `shar'. + +`concatenate' + `-A' in `tar'. + +`confirmation' + `-w' in `tar'. + +`context' + Used in `diff'. + +`copyleft' + `-W copyleft' in `gawk'. + +`copyright' + `-C' in `ptx', `recode', and `wdiff'; `-W copyright' in `gawk'. + +`core' + Used in GDB. + +`count' + `-q' in `who'. + +`count-links' + `-l' in `du'. + +`create' + Used in `tar' and `cpio'. + +`cut-mark' + `-c' in `shar'. + +`cxref' + `-x' in `ctags'. + +`date' + `-d' in `touch'. + +`debug' + `-d' in Make and `m4'; `-t' in Bison. + +`define' + `-D' in `m4'. + +`defines' + `-d' in Bison and `ctags'. + +`delete' + `-D' in `tar'. + +`dereference' + `-L' in `chgrp', `chown', `cpio', `du', `ls', and `tar'. + +`dereference-args' + `-D' in `du'. + +`device' + Specify an I/O device (special file name). + +`diacritics' + `-d' in `recode'. + +`dictionary-order' + `-d' in `look'. + +`diff' + `-d' in `tar'. + +`digits' + `-n' in `csplit'. + +`directory' + Specify the directory to use, in various programs. In `ls', it + means to show directories themselves rather than their contents. + In `rm' and `ln', it means to not treat links to directories + specially. + +`discard-all' + `-x' in `strip'. + +`discard-locals' + `-X' in `strip'. + +`dry-run' + `-n' in Make. + +`ed' + `-e' in `diff'. + +`elide-empty-files' + `-z' in `csplit'. + +`end-delete' + `-x' in `wdiff'. + +`end-insert' + `-z' in `wdiff'. + +`entire-new-file' + `-N' in `diff'. + +`environment-overrides' + `-e' in Make. + +`eof' + `-e' in `xargs'. + +`epoch' + Used in GDB. + +`error-limit' + Used in `makeinfo'. + +`error-output' + `-o' in `m4'. + +`escape' + `-b' in `ls'. + +`exclude-from' + `-X' in `tar'. + +`exec' + Used in GDB. + +`exit' + `-x' in `xargs'. + +`exit-0' + `-e' in `unshar'. + +`expand-tabs' + `-t' in `diff'. + +`expression' + `-e' in `sed'. + +`extern-only' + `-g' in `nm'. + +`extract' + `-i' in `cpio'; `-x' in `tar'. + +`faces' + `-f' in `finger'. + +`fast' + `-f' in `su'. + +`fatal-warnings' + `-E' in `m4'. + +`file' + `-f' in `info', `gawk', Make, `mt', and `tar'; `-n' in `sed'; `-r' + in `touch'. + +`field-separator' + `-F' in `gawk'. + +`file-prefix' + `-b' in Bison. + +`file-type' + `-F' in `ls'. + +`files-from' + `-T' in `tar'. + +`fill-column' + Used in `makeinfo'. + +`flag-truncation' + `-F' in `ptx'. + +`fixed-output-files' + `-y' in Bison. + +`follow' + `-f' in `tail'. + +`footnote-style' + Used in `makeinfo'. + +`force' + `-f' in `cp', `ln', `mv', and `rm'. + +`force-prefix' + `-F' in `shar'. + +`foreground' + For server programs, run in the foreground; in other words, don't + do anything special to run the server in the background. + +`format' + Used in `ls', `time', and `ptx'. + +`freeze-state' + `-F' in `m4'. + +`fullname' + Used in GDB. + +`gap-size' + `-g' in `ptx'. + +`get' + `-x' in `tar'. + +`graphic' + `-i' in `ul'. + +`graphics' + `-g' in `recode'. + +`group' + `-g' in `install'. + +`gzip' + `-z' in `tar' and `shar'. + +`hashsize' + `-H' in `m4'. + +`header' + `-h' in `objdump' and `recode' + +`heading' + `-H' in `who'. + +`help' + Used to ask for brief usage information. + +`here-delimiter' + `-d' in `shar'. + +`hide-control-chars' + `-q' in `ls'. + +`html' + In `makeinfo', output HTML. + +`idle' + `-u' in `who'. + +`ifdef' + `-D' in `diff'. + +`ignore' + `-I' in `ls'; `-x' in `recode'. + +`ignore-all-space' + `-w' in `diff'. + +`ignore-backups' + `-B' in `ls'. + +`ignore-blank-lines' + `-B' in `diff'. + +`ignore-case' + `-f' in `look' and `ptx'; `-i' in `diff' and `wdiff'. + +`ignore-errors' + `-i' in Make. + +`ignore-file' + `-i' in `ptx'. + +`ignore-indentation' + `-I' in `etags'. + +`ignore-init-file' + `-f' in Oleo. + +`ignore-interrupts' + `-i' in `tee'. + +`ignore-matching-lines' + `-I' in `diff'. + +`ignore-space-change' + `-b' in `diff'. + +`ignore-zeros' + `-i' in `tar'. + +`include' + `-i' in `etags'; `-I' in `m4'. + +`include-dir' + `-I' in Make. + +`incremental' + `-G' in `tar'. + +`info' + `-i', `-l', and `-m' in Finger. + +`init-file' + In some programs, specify the name of the file to read as the + user's init file. + +`initial' + `-i' in `expand'. + +`initial-tab' + `-T' in `diff'. + +`inode' + `-i' in `ls'. + +`interactive' + `-i' in `cp', `ln', `mv', `rm'; `-e' in `m4'; `-p' in `xargs'; + `-w' in `tar'. + +`intermix-type' + `-p' in `shar'. + +`iso-8601' + Used in `date' + +`jobs' + `-j' in Make. + +`just-print' + `-n' in Make. + +`keep-going' + `-k' in Make. + +`keep-files' + `-k' in `csplit'. + +`kilobytes' + `-k' in `du' and `ls'. + +`language' + `-l' in `etags'. + +`less-mode' + `-l' in `wdiff'. + +`level-for-gzip' + `-g' in `shar'. + +`line-bytes' + `-C' in `split'. + +`lines' + Used in `split', `head', and `tail'. + +`link' + `-l' in `cpio'. + +`lint' +`lint-old' + Used in `gawk'. + +`list' + `-t' in `cpio'; `-l' in `recode'. + +`list' + `-t' in `tar'. + +`literal' + `-N' in `ls'. + +`load-average' + `-l' in Make. + +`login' + Used in `su'. + +`machine' + No listing of which programs already use this; someone should + check to see if any actually do, and tell . + +`macro-name' + `-M' in `ptx'. + +`mail' + `-m' in `hello' and `uname'. + +`make-directories' + `-d' in `cpio'. + +`makefile' + `-f' in Make. + +`mapped' + Used in GDB. + +`max-args' + `-n' in `xargs'. + +`max-chars' + `-n' in `xargs'. + +`max-lines' + `-l' in `xargs'. + +`max-load' + `-l' in Make. + +`max-procs' + `-P' in `xargs'. + +`mesg' + `-T' in `who'. + +`message' + `-T' in `who'. + +`minimal' + `-d' in `diff'. + +`mixed-uuencode' + `-M' in `shar'. + +`mode' + `-m' in `install', `mkdir', and `mkfifo'. + +`modification-time' + `-m' in `tar'. + +`multi-volume' + `-M' in `tar'. + +`name-prefix' + `-a' in Bison. + +`nesting-limit' + `-L' in `m4'. + +`net-headers' + `-a' in `shar'. + +`new-file' + `-W' in Make. + +`no-builtin-rules' + `-r' in Make. + +`no-character-count' + `-w' in `shar'. + +`no-check-existing' + `-x' in `shar'. + +`no-common' + `-3' in `wdiff'. + +`no-create' + `-c' in `touch'. + +`no-defines' + `-D' in `etags'. + +`no-deleted' + `-1' in `wdiff'. + +`no-dereference' + `-d' in `cp'. + +`no-inserted' + `-2' in `wdiff'. + +`no-keep-going' + `-S' in Make. + +`no-lines' + `-l' in Bison. + +`no-piping' + `-P' in `shar'. + +`no-prof' + `-e' in `gprof'. + +`no-regex' + `-R' in `etags'. + +`no-sort' + `-p' in `nm'. + +`no-split' + Used in `makeinfo'. + +`no-static' + `-a' in `gprof'. + +`no-time' + `-E' in `gprof'. + +`no-timestamp' + `-m' in `shar'. + +`no-validate' + Used in `makeinfo'. + +`no-wait' + Used in `emacsclient'. + +`no-warn' + Used in various programs to inhibit warnings. + +`node' + `-n' in `info'. + +`nodename' + `-n' in `uname'. + +`nonmatching' + `-f' in `cpio'. + +`nstuff' + `-n' in `objdump'. + +`null' + `-0' in `xargs'. + +`number' + `-n' in `cat'. + +`number-nonblank' + `-b' in `cat'. + +`numeric-sort' + `-n' in `nm'. + +`numeric-uid-gid' + `-n' in `cpio' and `ls'. + +`nx' + Used in GDB. + +`old-archive' + `-o' in `tar'. + +`old-file' + `-o' in Make. + +`one-file-system' + `-l' in `tar', `cp', and `du'. + +`only-file' + `-o' in `ptx'. + +`only-prof' + `-f' in `gprof'. + +`only-time' + `-F' in `gprof'. + +`options' + `-o' in `getopt', `fdlist', `fdmount', `fdmountd', and `fdumount'. + +`output' + In various programs, specify the output file name. + +`output-prefix' + `-o' in `shar'. + +`override' + `-o' in `rm'. + +`overwrite' + `-c' in `unshar'. + +`owner' + `-o' in `install'. + +`paginate' + `-l' in `diff'. + +`paragraph-indent' + Used in `makeinfo'. + +`parents' + `-p' in `mkdir' and `rmdir'. + +`pass-all' + `-p' in `ul'. + +`pass-through' + `-p' in `cpio'. + +`port' + `-P' in `finger'. + +`portability' + `-c' in `cpio' and `tar'. + +`posix' + Used in `gawk'. + +`prefix-builtins' + `-P' in `m4'. + +`prefix' + `-f' in `csplit'. + +`preserve' + Used in `tar' and `cp'. + +`preserve-environment' + `-p' in `su'. + +`preserve-modification-time' + `-m' in `cpio'. + +`preserve-order' + `-s' in `tar'. + +`preserve-permissions' + `-p' in `tar'. + +`print' + `-l' in `diff'. + +`print-chars' + `-L' in `cmp'. + +`print-data-base' + `-p' in Make. + +`print-directory' + `-w' in Make. + +`print-file-name' + `-o' in `nm'. + +`print-symdefs' + `-s' in `nm'. + +`printer' + `-p' in `wdiff'. + +`prompt' + `-p' in `ed'. + +`proxy' + Specify an HTTP proxy. + +`query-user' + `-X' in `shar'. + +`question' + `-q' in Make. + +`quiet' + Used in many programs to inhibit the usual output. *Note:* every + program accepting `--quiet' should accept `--silent' as a synonym. + +`quiet-unshar' + `-Q' in `shar' + +`quote-name' + `-Q' in `ls'. + +`rcs' + `-n' in `diff'. + +`re-interval' + Used in `gawk'. + +`read-full-blocks' + `-B' in `tar'. + +`readnow' + Used in GDB. + +`recon' + `-n' in Make. + +`record-number' + `-R' in `tar'. + +`recursive' + Used in `chgrp', `chown', `cp', `ls', `diff', and `rm'. + +`reference-limit' + Used in `makeinfo'. + +`references' + `-r' in `ptx'. + +`regex' + `-r' in `tac' and `etags'. + +`release' + `-r' in `uname'. + +`reload-state' + `-R' in `m4'. + +`relocation' + `-r' in `objdump'. + +`rename' + `-r' in `cpio'. + +`replace' + `-i' in `xargs'. + +`report-identical-files' + `-s' in `diff'. + +`reset-access-time' + `-a' in `cpio'. + +`reverse' + `-r' in `ls' and `nm'. + +`reversed-ed' + `-f' in `diff'. + +`right-side-defs' + `-R' in `ptx'. + +`same-order' + `-s' in `tar'. + +`same-permissions' + `-p' in `tar'. + +`save' + `-g' in `stty'. + +`se' + Used in GDB. + +`sentence-regexp' + `-S' in `ptx'. + +`separate-dirs' + `-S' in `du'. + +`separator' + `-s' in `tac'. + +`sequence' + Used by `recode' to chose files or pipes for sequencing passes. + +`shell' + `-s' in `su'. + +`show-all' + `-A' in `cat'. + +`show-c-function' + `-p' in `diff'. + +`show-ends' + `-E' in `cat'. + +`show-function-line' + `-F' in `diff'. + +`show-tabs' + `-T' in `cat'. + +`silent' + Used in many programs to inhibit the usual output. *Note:* every + program accepting `--silent' should accept `--quiet' as a synonym. + +`size' + `-s' in `ls'. + +`socket' + Specify a file descriptor for a network server to use for its + socket, instead of opening and binding a new socket. This + provides a way to run, in a nonpriveledged process, a server that + normally needs a reserved port number. + +`sort' + Used in `ls'. + +`source' + `-W source' in `gawk'. + +`sparse' + `-S' in `tar'. + +`speed-large-files' + `-H' in `diff'. + +`split-at' + `-E' in `unshar'. + +`split-size-limit' + `-L' in `shar'. + +`squeeze-blank' + `-s' in `cat'. + +`start-delete' + `-w' in `wdiff'. + +`start-insert' + `-y' in `wdiff'. + +`starting-file' + Used in `tar' and `diff' to specify which file within a directory + to start processing with. + +`statistics' + `-s' in `wdiff'. + +`stdin-file-list' + `-S' in `shar'. + +`stop' + `-S' in Make. + +`strict' + `-s' in `recode'. + +`strip' + `-s' in `install'. + +`strip-all' + `-s' in `strip'. + +`strip-debug' + `-S' in `strip'. + +`submitter' + `-s' in `shar'. + +`suffix' + `-S' in `cp', `ln', `mv'. + +`suffix-format' + `-b' in `csplit'. + +`sum' + `-s' in `gprof'. + +`summarize' + `-s' in `du'. + +`symbolic' + `-s' in `ln'. + +`symbols' + Used in GDB and `objdump'. + +`synclines' + `-s' in `m4'. + +`sysname' + `-s' in `uname'. + +`tabs' + `-t' in `expand' and `unexpand'. + +`tabsize' + `-T' in `ls'. + +`terminal' + `-T' in `tput' and `ul'. `-t' in `wdiff'. + +`text' + `-a' in `diff'. + +`text-files' + `-T' in `shar'. + +`time' + Used in `ls' and `touch'. + +`timeout' + Specify how long to wait before giving up on some operation. + +`to-stdout' + `-O' in `tar'. + +`total' + `-c' in `du'. + +`touch' + `-t' in Make, `ranlib', and `recode'. + +`trace' + `-t' in `m4'. + +`traditional' + `-t' in `hello'; `-W traditional' in `gawk'; `-G' in `ed', `m4', + and `ptx'. + +`tty' + Used in GDB. + +`typedefs' + `-t' in `ctags'. + +`typedefs-and-c++' + `-T' in `ctags'. + +`typeset-mode' + `-t' in `ptx'. + +`uncompress' + `-z' in `tar'. + +`unconditional' + `-u' in `cpio'. + +`undefine' + `-U' in `m4'. + +`undefined-only' + `-u' in `nm'. + +`update' + `-u' in `cp', `ctags', `mv', `tar'. + +`usage' + Used in `gawk'; same as `--help'. + +`uuencode' + `-B' in `shar'. + +`vanilla-operation' + `-V' in `shar'. + +`verbose' + Print more information about progress. Many programs support this. + +`verify' + `-W' in `tar'. + +`version' + Print the version number. + +`version-control' + `-V' in `cp', `ln', `mv'. + +`vgrind' + `-v' in `ctags'. + +`volume' + `-V' in `tar'. + +`what-if' + `-W' in Make. + +`whole-size-limit' + `-l' in `shar'. + +`width' + `-w' in `ls' and `ptx'. + +`word-regexp' + `-W' in `ptx'. + +`writable' + `-T' in `who'. + +`zeros' + `-z' in `gprof'. + + +File: standards.info, Node: Memory Usage, Next: File Usage, Prev: Option Table, Up: Program Behavior + +Memory Usage +============ + +If a program typically uses just a few meg of memory, don't bother +making any effort to reduce memory usage. For example, if it is +impractical for other reasons to operate on files more than a few meg +long, it is reasonable to read entire input files into core to operate +on them. + + However, for programs such as `cat' or `tail', that can usefully +operate on very large files, it is important to avoid using a technique +that would artificially limit the size of files it can handle. If a +program works by lines and could be applied to arbitrary user-supplied +input files, it should keep only a line in memory, because this is not +very hard and users will want to be able to operate on input files that +are bigger than will fit in core all at once. + + If your program creates complicated data structures, just make them +in core and give a fatal error if `malloc' returns zero. + + +File: standards.info, Node: File Usage, Prev: Memory Usage, Up: Program Behavior + +File Usage +========== + +Programs should be prepared to operate when `/usr' and `/etc' are +read-only file systems. Thus, if the program manages log files, lock +files, backup files, score files, or any other files which are modified +for internal purposes, these files should not be stored in `/usr' or +`/etc'. + + There are two exceptions. `/etc' is used to store system +configuration information; it is reasonable for a program to modify +files in `/etc' when its job is to update the system configuration. +Also, if the user explicitly asks to modify one file in a directory, it +is reasonable for the program to store other files in the same +directory. + + +File: standards.info, Node: Writing C, Next: Documentation, Prev: Program Behavior, Up: Top + +Making The Best Use of C +************************ + +This node provides advice on how best to use the C language when +writing GNU software. + +* Menu: + +* Formatting:: Formatting Your Source Code +* Comments:: Commenting Your Work +* Syntactic Conventions:: Clean Use of C Constructs +* Names:: Naming Variables, Functions, and Files +* System Portability:: Portability between different operating systems +* CPU Portability:: Supporting the range of CPU types +* System Functions:: Portability and ``standard'' library functions +* Internationalization:: Techniques for internationalization +* Mmap:: How you can safely use `mmap'. + + +File: standards.info, Node: Formatting, Next: Comments, Up: Writing C + +Formatting Your Source Code +=========================== + +It is important to put the open-brace that starts the body of a C +function in column zero, and avoid putting any other open-brace or +open-parenthesis or open-bracket in column zero. Several tools look +for open-braces in column zero to find the beginnings of C functions. +These tools will not work on code not formatted that way. + + It is also important for function definitions to start the name of +the function in column zero. This helps people to search for function +definitions, and may also help certain tools recognize them. Thus, the +proper format is this: + + static char * + concat (s1, s2) /* Name starts in column zero here */ + char *s1, *s2; + { /* Open brace in column zero here */ + ... + } + +or, if you want to use Standard C syntax, format the definition like +this: + + static char * + concat (char *s1, char *s2) + { + ... + } + + In Standard C, if the arguments don't fit nicely on one line, split +it like this: + + int + lots_of_args (int an_integer, long a_long, short a_short, + double a_double, float a_float) + ... + + The rest of this section gives our recommendations for other aspects +of C formatting style, which is also the default style of the `indent' +program in version 1.2 and newer. It corresponds to the options + + -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2 + -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob + + We don't think of these recommendations as requirements, because it +causes no problems for users if two different programs have different +formatting styles. + + But whatever style you use, please use it consistently, since a +mixture of styles within one program tends to look ugly. If you are +contributing changes to an existing program, please follow the style of +that program. + + For the body of the function, our recommended style looks like this: + + if (x < foo (y, z)) + haha = bar[4] + 5; + else + { + while (z) + { + haha += foo (z, z); + z--; + } + return ++x + bar (); + } + + We find it easier to read a program when it has spaces before the +open-parentheses and after the commas. Especially after the commas. + + When you split an expression into multiple lines, split it before an +operator, not after one. Here is the right way: + + if (foo_this_is_long && bar > win (x, y, z) + && remaining_condition) + + Try to avoid having two operators of different precedence at the same +level of indentation. For example, don't write this: + + mode = (inmode[j] == VOIDmode + || GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]) + ? outmode[j] : inmode[j]); + + Instead, use extra parentheses so that the indentation shows the +nesting: + + mode = ((inmode[j] == VOIDmode + || (GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]))) + ? outmode[j] : inmode[j]); + + Insert extra parentheses so that Emacs will indent the code properly. +For example, the following indentation looks nice if you do it by hand, + + v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 + + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000; + +but Emacs would alter it. Adding a set of parentheses produces +something that looks equally nice, and which Emacs will preserve: + + v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 + + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000); + + Format do-while statements like this: + + do + { + a = foo (a); + } + while (a > 0); + + Please use formfeed characters (control-L) to divide the program into +pages at logical places (but not within a function). It does not matter +just how long the pages are, since they do not have to fit on a printed +page. The formfeeds should appear alone on lines by themselves. + + +File: standards.info, Node: Comments, Next: Syntactic Conventions, Prev: Formatting, Up: Writing C + +Commenting Your Work +==================== + +Every program should start with a comment saying briefly what it is for. +Example: `fmt - filter for simple filling of text'. + + Please write the comments in a GNU program in English, because +English is the one language that nearly all programmers in all +countries can read. If you do not write English well, please write +comments in English as well as you can, then ask other people to help +rewrite them. If you can't write comments in English, please find +someone to work with you and translate your comments into English. + + Please put a comment on each function saying what the function does, +what sorts of arguments it gets, and what the possible values of +arguments mean and are used for. It is not necessary to duplicate in +words the meaning of the C argument declarations, if a C type is being +used in its customary fashion. If there is anything nonstandard about +its use (such as an argument of type `char *' which is really the +address of the second character of a string, not the first), or any +possible values that would not work the way one would expect (such as, +that strings containing newlines are not guaranteed to work), be sure +to say so. + + Also explain the significance of the return value, if there is one. + + Please put two spaces after the end of a sentence in your comments, +so that the Emacs sentence commands will work. Also, please write +complete sentences and capitalize the first word. If a lower-case +identifier comes at the beginning of a sentence, don't capitalize it! +Changing the spelling makes it a different identifier. If you don't +like starting a sentence with a lower case letter, write the sentence +differently (e.g., "The identifier lower-case is ..."). + + The comment on a function is much clearer if you use the argument +names to speak about the argument values. The variable name itself +should be lower case, but write it in upper case when you are speaking +about the value rather than the variable itself. Thus, "the inode +number NODE_NUM" rather than "an inode". + + There is usually no purpose in restating the name of the function in +the comment before it, because the reader can see that for himself. +There might be an exception when the comment is so long that the +function itself would be off the bottom of the screen. + + There should be a comment on each static variable as well, like this: + + /* Nonzero means truncate lines in the display; + zero means continue them. */ + int truncate_lines; + + Every `#endif' should have a comment, except in the case of short +conditionals (just a few lines) that are not nested. The comment should +state the condition of the conditional that is ending, _including its +sense_. `#else' should have a comment describing the condition _and +sense_ of the code that follows. For example: + + #ifdef foo + ... + #else /* not foo */ + ... + #endif /* not foo */ + #ifdef foo + ... + #endif /* foo */ + +but, by contrast, write the comments this way for a `#ifndef': + + #ifndef foo + ... + #else /* foo */ + ... + #endif /* foo */ + #ifndef foo + ... + #endif /* not foo */ + + +File: standards.info, Node: Syntactic Conventions, Next: Names, Prev: Comments, Up: Writing C + +Clean Use of C Constructs +========================= + +Please explicitly declare the types of all objects. For example, you +should explicitly declare all arguments to functions, and you should +declare functions to return `int' rather than omitting the `int'. + + Some programmers like to use the GCC `-Wall' option, and change the +code whenever it issues a warning. If you want to do this, then do. +Other programmers prefer not to use `-Wall', because it gives warnings +for valid and legitimate code which they do not want to change. If you +want to do this, then do. The compiler should be your servant, not +your master. + + Declarations of external functions and functions to appear later in +the source file should all go in one place near the beginning of the +file (somewhere before the first function definition in the file), or +else should go in a header file. Don't put `extern' declarations inside +functions. + + It used to be common practice to use the same local variables (with +names like `tem') over and over for different values within one +function. Instead of doing this, it is better declare a separate local +variable for each distinct purpose, and give it a name which is +meaningful. This not only makes programs easier to understand, it also +facilitates optimization by good compilers. You can also move the +declaration of each local variable into the smallest scope that includes +all its uses. This makes the program even cleaner. + + Don't use local variables or parameters that shadow global +identifiers. + + Don't declare multiple variables in one declaration that spans lines. +Start a new declaration on each line, instead. For example, instead of +this: + + int foo, + bar; + +write either this: + + int foo, bar; + +or this: + + int foo; + int bar; + +(If they are global variables, each should have a comment preceding it +anyway.) + + When you have an `if'-`else' statement nested in another `if' +statement, always put braces around the `if'-`else'. Thus, never write +like this: + + if (foo) + if (bar) + win (); + else + lose (); + +always like this: + + if (foo) + { + if (bar) + win (); + else + lose (); + } + + If you have an `if' statement nested inside of an `else' statement, +either write `else if' on one line, like this, + + if (foo) + ... + else if (bar) + ... + +with its `then'-part indented like the preceding `then'-part, or write +the nested `if' within braces like this: + + if (foo) + ... + else + { + if (bar) + ... + } + + Don't declare both a structure tag and variables or typedefs in the +same declaration. Instead, declare the structure tag separately and +then use it to declare the variables or typedefs. + + Try to avoid assignments inside `if'-conditions. For example, don't +write this: + + if ((foo = (char *) malloc (sizeof *foo)) == 0) + fatal ("virtual memory exhausted"); + +instead, write this: + + foo = (char *) malloc (sizeof *foo); + if (foo == 0) + fatal ("virtual memory exhausted"); + + Don't make the program ugly to placate `lint'. Please don't insert +any casts to `void'. Zero without a cast is perfectly fine as a null +pointer constant, except when calling a varargs function. + + +File: standards.info, Node: Names, Next: System Portability, Prev: Syntactic Conventions, Up: Writing C + +Naming Variables, Functions, and Files +====================================== + +The names of global variables and functions in a program serve as +comments of a sort. So don't choose terse names--instead, look for +names that give useful information about the meaning of the variable or +function. In a GNU program, names should be English, like other +comments. + + Local variable names can be shorter, because they are used only +within one context, where (presumably) comments explain their purpose. + + Try to limit your use of abbreviations in symbol names. It is ok to +make a few abbreviations, explain what they mean, and then use them +frequently, but don't use lots of obscure abbreviations. + + Please use underscores to separate words in a name, so that the Emacs +word commands can be useful within them. Stick to lower case; reserve +upper case for macros and `enum' constants, and for name-prefixes that +follow a uniform convention. + + For example, you should use names like `ignore_space_change_flag'; +don't use names like `iCantReadThis'. + + Variables that indicate whether command-line options have been +specified should be named after the meaning of the option, not after +the option-letter. A comment should state both the exact meaning of +the option and its letter. For example, + + /* Ignore changes in horizontal whitespace (-b). */ + int ignore_space_change_flag; + + When you want to define names with constant integer values, use +`enum' rather than `#define'. GDB knows about enumeration constants. + + You might want to make sure that none of the file names would +conflict the files were loaded onto an MS-DOS file system which +shortens the names. You can use the program `doschk' to test for this. + + Some GNU programs were designed to limit themselves to file names of +14 characters or less, to avoid file name conflicts if they are read +into older System V systems. Please preserve this feature in the +existing GNU programs that have it, but there is no need to do this in +new GNU programs. `doschk' also reports file names longer than 14 +characters. + + +File: standards.info, Node: System Portability, Next: CPU Portability, Prev: Names, Up: Writing C + +Portability between System Types +================================ + +In the Unix world, "portability" refers to porting to different Unix +versions. For a GNU program, this kind of portability is desirable, but +not paramount. + + The primary purpose of GNU software is to run on top of the GNU +kernel, compiled with the GNU C compiler, on various types of CPU. So +the kinds of portability that are absolutely necessary are quite +limited. But it is important to support Linux-based GNU systems, since +they are the form of GNU that is popular. + + Beyond that, it is good to support the other free operating systems +(*BSD), and it is nice to support other Unix-like systems if you want +to. Supporting a variety of Unix-like systems is desirable, although +not paramount. It is usually not too hard, so you may as well do it. +But you don't have to consider it an obligation, if it does turn out to +be hard. + + The easiest way to achieve portability to most Unix-like systems is +to use Autoconf. It's unlikely that your program needs to know more +information about the host platform than Autoconf can provide, simply +because most of the programs that need such knowledge have already been +written. + + Avoid using the format of semi-internal data bases (e.g., +directories) when there is a higher-level alternative (`readdir'). + + As for systems that are not like Unix, such as MSDOS, Windows, the +Macintosh, VMS, and MVS, supporting them is often a lot of work. When +that is the case, it is better to spend your time adding features that +will be useful on GNU and GNU/Linux, rather than on supporting other +incompatible systems. + + It is a good idea to define the "feature test macro" `_GNU_SOURCE' +when compiling your C files. When you compile on GNU or GNU/Linux, +this will enable the declarations of GNU library extension functions, +and that will usually give you a compiler error message if you define +the same function names in some other way in your program. (You don't +have to actually _use_ these functions, if you prefer to make the +program more portable to other systems.) + + But whether or not you use these GNU extensions, you should avoid +using their names for any other meanings. Doing so would make it hard +to move your code into other GNU programs. + + +File: standards.info, Node: CPU Portability, Next: System Functions, Prev: System Portability, Up: Writing C + +Portability between CPUs +======================== + +Even GNU systems will differ because of differences among CPU +types--for example, difference in byte ordering and alignment +requirements. It is absolutely essential to handle these differences. +However, don't make any effort to cater to the possibility that an +`int' will be less than 32 bits. We don't support 16-bit machines in +GNU. + + Similarly, don't make any effort to cater to the possibility that +`long' will be smaller than predefined types like `size_t'. For +example, the following code is ok: + + printf ("size = %lu\n", (unsigned long) sizeof array); + printf ("diff = %ld\n", (long) (pointer2 - pointer1)); + + 1989 Standard C requires this to work, and we know of only one +counterexample: 64-bit programs on Microsoft Windows IA-64. We will +leave it to those who want to port GNU programs to that environment to +figure out how to do it. + + Predefined file-size types like `off_t' are an exception: they are +longer than `long' on many platforms, so code like the above won't work +with them. One way to print an `off_t' value portably is to print its +digits yourself, one by one. + + Don't assume that the address of an `int' object is also the address +of its least-significant byte. This is false on big-endian machines. +Thus, don't make the following mistake: + + int c; + ... + while ((c = getchar()) != EOF) + write(file_descriptor, &c, 1); + + When calling functions, you need not worry about the difference +between pointers of various types, or between pointers and integers. +On most machines, there's no difference anyway. As for the few +machines where there is a difference, all of them support Standard C +prototypes, so you can use prototypes (perhaps conditionalized to be +active only in Standard C) to make the code work on those systems. + + In certain cases, it is ok to pass integer and pointer arguments +indiscriminately to the same function, and use no prototype on any +system. For example, many GNU programs have error-reporting functions +that pass their arguments along to `printf' and friends: + + error (s, a1, a2, a3) + char *s; + char *a1, *a2, *a3; + { + fprintf (stderr, "error: "); + fprintf (stderr, s, a1, a2, a3); + } + +In practice, this works on all machines, since a pointer is generally +the widest possible kind of argument; it is much simpler than any +"correct" alternative. Be sure _not_ to use a prototype for such +functions. + + If you have decided to use Standard C, then you can instead define +`error' using `stdarg.h', and pass the arguments along to `vfprintf'. + + Avoid casting pointers to integers if you can. Such casts greatly +reduce portability, and in most programs they are easy to avoid. In the +cases where casting pointers to integers is essential--such as, a Lisp +interpreter which stores type information as well as an address in one +word--you'll have to make explicit provisions to handle different word +sizes. You will also need to make provision for systems in which the +normal range of addresses you can get from `malloc' starts far away +from zero. + + +File: standards.info, Node: System Functions, Next: Internationalization, Prev: CPU Portability, Up: Writing C + +Calling System Functions +======================== + +C implementations differ substantially. Standard C reduces but does +not eliminate the incompatibilities; meanwhile, many GNU packages still +support pre-standard compilers because this is not hard to do. This +chapter gives recommendations for how to use the more-or-less standard C +library functions to avoid unnecessary loss of portability. + + * Don't use the return value of `sprintf'. It returns the number of + characters written on some systems, but not on all systems. + + * Be aware that `vfprintf' is not always available. + + * `main' should be declared to return type `int'. It should + terminate either by calling `exit' or by returning the integer + status code; make sure it cannot ever return an undefined value. + + * Don't declare system functions explicitly. + + Almost any declaration for a system function is wrong on some + system. To minimize conflicts, leave it to the system header + files to declare system functions. If the headers don't declare a + function, let it remain undeclared. + + While it may seem unclean to use a function without declaring it, + in practice this works fine for most system library functions on + the systems where this really happens; thus, the disadvantage is + only theoretical. By contrast, actual declarations have + frequently caused actual conflicts. + + * If you must declare a system function, don't specify the argument + types. Use an old-style declaration, not a Standard C prototype. + The more you specify about the function, the more likely a + conflict. + + * In particular, don't unconditionally declare `malloc' or `realloc'. + + Most GNU programs use those functions just once, in functions + conventionally named `xmalloc' and `xrealloc'. These functions + call `malloc' and `realloc', respectively, and check the results. + + Because `xmalloc' and `xrealloc' are defined in your program, you + can declare them in other files without any risk of type conflict. + + On most systems, `int' is the same length as a pointer; thus, the + calls to `malloc' and `realloc' work fine. For the few + exceptional systems (mostly 64-bit machines), you can use + *conditionalized* declarations of `malloc' and `realloc'--or put + these declarations in configuration files specific to those + systems. + + * The string functions require special treatment. Some Unix systems + have a header file `string.h'; others have `strings.h'. Neither + file name is portable. There are two things you can do: use + Autoconf to figure out which file to include, or don't include + either file. + + * If you don't include either strings file, you can't get + declarations for the string functions from the header file in the + usual way. + + That causes less of a problem than you might think. The newer + standard string functions should be avoided anyway because many + systems still don't support them. The string functions you can + use are these: + + strcpy strncpy strcat strncat + strlen strcmp strncmp + strchr strrchr + + The copy and concatenate functions work fine without a declaration + as long as you don't use their values. Using their values without + a declaration fails on systems where the width of a pointer + differs from the width of `int', and perhaps in other cases. It + is trivial to avoid using their values, so do that. + + The compare functions and `strlen' work fine without a declaration + on most systems, possibly all the ones that GNU software runs on. + You may find it necessary to declare them *conditionally* on a few + systems. + + The search functions must be declared to return `char *'. Luckily, + there is no variation in the data type they return. But there is + variation in their names. Some systems give these functions the + names `index' and `rindex'; other systems use the names `strchr' + and `strrchr'. Some systems support both pairs of names, but + neither pair works on all systems. + + You should pick a single pair of names and use it throughout your + program. (Nowadays, it is better to choose `strchr' and `strrchr' + for new programs, since those are the standard names.) Declare + both of those names as functions returning `char *'. On systems + which don't support those names, define them as macros in terms of + the other pair. For example, here is what to put at the beginning + of your file (or in a header) if you want to use the names + `strchr' and `strrchr' throughout: + + #ifndef HAVE_STRCHR + #define strchr index + #endif + #ifndef HAVE_STRRCHR + #define strrchr rindex + #endif + + char *strchr (); + char *strrchr (); + + Here we assume that `HAVE_STRCHR' and `HAVE_STRRCHR' are macros +defined in systems where the corresponding functions exist. One way to +get them properly defined is to use Autoconf. + + +File: standards.info, Node: Internationalization, Next: Mmap, Prev: System Functions, Up: Writing C + +Internationalization +==================== + +GNU has a library called GNU gettext that makes it easy to translate the +messages in a program into various languages. You should use this +library in every program. Use English for the messages as they appear +in the program, and let gettext provide the way to translate them into +other languages. + + Using GNU gettext involves putting a call to the `gettext' macro +around each string that might need translation--like this: + + printf (gettext ("Processing file `%s'...")); + +This permits GNU gettext to replace the string `"Processing file +`%s'..."' with a translated version. + + Once a program uses gettext, please make a point of writing calls to +`gettext' when you add new strings that call for translation. + + Using GNU gettext in a package involves specifying a "text domain +name" for the package. The text domain name is used to separate the +translations for this package from the translations for other packages. +Normally, the text domain name should be the same as the name of the +package--for example, `fileutils' for the GNU file utilities. + + To enable gettext to work well, avoid writing code that makes +assumptions about the structure of words or sentences. When you want +the precise text of a sentence to vary depending on the data, use two or +more alternative string constants each containing a complete sentences, +rather than inserting conditionalized words or phrases into a single +sentence framework. + + Here is an example of what not to do: + + printf ("%d file%s processed", nfiles, + nfiles != 1 ? "s" : ""); + +The problem with that example is that it assumes that plurals are made +by adding `s'. If you apply gettext to the format string, like this, + + printf (gettext ("%d file%s processed"), nfiles, + nfiles != 1 ? "s" : ""); + +the message can use different words, but it will still be forced to use +`s' for the plural. Here is a better way: + + printf ((nfiles != 1 ? "%d files processed" + : "%d file processed"), + nfiles); + +This way, you can apply gettext to each of the two strings +independently: + + printf ((nfiles != 1 ? gettext ("%d files processed") + : gettext ("%d file processed")), + nfiles); + +This can be any method of forming the plural of the word for "file", and +also handles languages that require agreement in the word for +"processed". + + A similar problem appears at the level of sentence structure with +this code: + + printf ("# Implicit rule search has%s been done.\n", + f->tried_implicit ? "" : " not"); + +Adding `gettext' calls to this code cannot give correct results for all +languages, because negation in some languages requires adding words at +more than one place in the sentence. By contrast, adding `gettext' +calls does the job straightfowardly if the code starts out like this: + + printf (f->tried_implicit + ? "# Implicit rule search has been done.\n", + : "# Implicit rule search has not been done.\n"); + + +File: standards.info, Node: Mmap, Prev: Internationalization, Up: Writing C + +Mmap +==== + +Don't assume that `mmap' either works on all files or fails for all +files. It may work on some files and fail on others. + + The proper way to use `mmap' is to try it on the specific file for +which you want to use it--and if `mmap' doesn't work, fall back on +doing the job in another way using `read' and `write'. + + The reason this precaution is needed is that the GNU kernel (the +HURD) provides a user-extensible file system, in which there can be many +different kinds of "ordinary files." Many of them support `mmap', but +some do not. It is important to make programs handle all these kinds +of files. + + +File: standards.info, Node: Documentation, Next: Managing Releases, Prev: Writing C, Up: Top + +Documenting Programs +******************** + +A GNU program should ideally come with full free documentation, adequate +for both reference and tutorial purposes. If the package can be +programmed or extended, the documentation should cover programming or +extending it, as well as just using it. + +* Menu: + +* GNU Manuals:: Writing proper manuals. +* Doc Strings and Manuals:: Compiling doc strings doesn't make a manual. +* Manual Structure Details:: Specific structure conventions. +* License for Manuals:: Writing the distribution terms for a manual. +* Manual Credits:: Giving credit to documentation contributors. +* Printed Manuals:: Mentioning the printed manual. +* NEWS File:: NEWS files supplement manuals. +* Change Logs:: Recording Changes +* Man Pages:: Man pages are secondary. +* Reading other Manuals:: How far you can go in learning + from other manuals. + + +File: standards.info, Node: GNU Manuals, Next: Doc Strings and Manuals, Up: Documentation + +GNU Manuals +=========== + +The preferred document format for the GNU system is the Texinfo +formatting language. Every GNU package should (ideally) have +documentation in Texinfo both for reference and for learners. Texinfo +makes it possible to produce a good quality formatted book, using TeX, +and to generate an Info file. It is also possible to generate HTML +output from Texinfo source. See the Texinfo manual, either the +hardcopy, or the on-line version available through `info' or the Emacs +Info subsystem (`C-h i'). + + Nowadays some other formats such as Docbook and Sgmltexi can be +converted automatically into Texinfo. It is ok to produce the Texinfo +documentation by conversion this way, as long as it gives good results. + + Programmers often find it most natural to structure the documentation +following the structure of the implementation, which they know. But +this structure is not necessarily good for explaining how to use the +program; it may be irrelevant and confusing for a user. + + At every level, from the sentences in a paragraph to the grouping of +topics into separate manuals, the right way to structure documentation +is according to the concepts and questions that a user will have in mind +when reading it. Sometimes this structure of ideas matches the +structure of the implementation of the software being documented--but +often they are different. Often the most important part of learning to +write good documentation is learning to notice when you are structuring +the documentation like the implementation, and think about better +alternatives. + + For example, each program in the GNU system probably ought to be +documented in one manual; but this does not mean each program should +have its own manual. That would be following the structure of the +implementation, rather than the structure that helps the user +understand. + + Instead, each manual should cover a coherent _topic_. For example, +instead of a manual for `diff' and a manual for `diff3', we have one +manual for "comparison of files" which covers both of those programs, +as well as `cmp'. By documenting these programs together, we can make +the whole subject clearer. + + The manual which discusses a program should certainly document all of +the program's command-line options and all of its commands. It should +give examples of their use. But don't organize the manual as a list of +features. Instead, organize it logically, by subtopics. Address the +questions that a user will ask when thinking about the job that the +program does. + + In general, a GNU manual should serve both as tutorial and reference. +It should be set up for convenient access to each topic through Info, +and for reading straight through (appendixes aside). A GNU manual +should give a good introduction to a beginner reading through from the +start, and should also provide all the details that hackers want. The +Bison manual is a good example of this--please take a look at it to see +what we mean. + + That is not as hard as it first sounds. Arrange each chapter as a +logical breakdown of its topic, but order the sections, and write their +text, so that reading the chapter straight through makes sense. Do +likewise when structuring the book into chapters, and when structuring a +section into paragraphs. The watchword is, _at each point, address the +most fundamental and important issue raised by the preceding text._ + + If necessary, add extra chapters at the beginning of the manual which +are purely tutorial and cover the basics of the subject. These provide +the framework for a beginner to understand the rest of the manual. The +Bison manual provides a good example of how to do this. + + To serve as a reference, a manual should have an Index that list all +the functions, variables, options, and important concepts that are part +of the program. One combined Index should do for a short manual, but +sometimes for a complex package it is better to use multiple indices. +The Texinfo manual includes advice on preparing good index entries, see +*Note Making Index Entries: (texinfo)Index Entries, and see *Note +Defining the Entries of an Index: (texinfo)Indexing Commands. + + Don't use Unix man pages as a model for how to write GNU +documentation; most of them are terse, badly structured, and give +inadequate explanation of the underlying concepts. (There are, of +course, some exceptions.) Also, Unix man pages use a particular format +which is different from what we use in GNU manuals. + + Please include an email address in the manual for where to report +bugs _in the manual_. + + Please do not use the term "pathname" that is used in Unix +documentation; use "file name" (two words) instead. We use the term +"path" only for search paths, which are lists of directory names. + + Please do not use the term "illegal" to refer to erroneous input to a +computer program. Please use "invalid" for this, and reserve the term +"illegal" for activities punishable by law. + + +File: standards.info, Node: Doc Strings and Manuals, Next: Manual Structure Details, Prev: GNU Manuals, Up: Documentation + +Doc Strings and Manuals +======================= + +Some programming systems, such as Emacs, provide a documentation string +for each function, command or variable. You may be tempted to write a +reference manual by compiling the documentation strings and writing a +little additional text to go around them--but you must not do it. That +approach is a fundamental mistake. The text of well-written +documentation strings will be entirely wrong for a manual. + + A documentation string needs to stand alone--when it appears on the +screen, there will be no other text to introduce or explain it. +Meanwhile, it can be rather informal in style. + + The text describing a function or variable in a manual must not stand +alone; it appears in the context of a section or subsection. Other text +at the beginning of the section should explain some of the concepts, and +should often make some general points that apply to several functions or +variables. The previous descriptions of functions and variables in the +section will also have given information about the topic. A description +written to stand alone would repeat some of that information; this +redundance looks bad. Meanwhile, the informality that is acceptable in +a documentation string is totally unacceptable in a manual. + + The only good way to use documentation strings in writing a good +manual is to use them as a source of information for writing good text. + + +File: standards.info, Node: Manual Structure Details, Next: License for Manuals, Prev: Doc Strings and Manuals, Up: Documentation + +Manual Structure Details +======================== + +The title page of the manual should state the version of the programs or +packages documented in the manual. The Top node of the manual should +also contain this information. If the manual is changing more +frequently than or independent of the program, also state a version +number for the manual in both of these places. + + Each program documented in the manual should have a node named +`PROGRAM Invocation' or `Invoking PROGRAM'. This node (together with +its subnodes, if any) should describe the program's command line +arguments and how to run it (the sort of information people would look +in a man page for). Start with an `@example' containing a template for +all the options and arguments that the program uses. + + Alternatively, put a menu item in some menu whose item name fits one +of the above patterns. This identifies the node which that item points +to as the node for this purpose, regardless of the node's actual name. + + The `--usage' feature of the Info reader looks for such a node or +menu item in order to find the relevant text, so it is essential for +every Texinfo file to have one. + + If one manual describes several programs, it should have such a node +for each program described in the manual. + + +File: standards.info, Node: License for Manuals, Next: Manual Credits, Prev: Manual Structure Details, Up: Documentation + +License for Manuals +=================== + +Please use the GNU Free Documentation License for all GNU manuals that +are more than a few pages long. Likewise for a collection of short +documents--you only need one copy of the GNU FDL for the whole +collection. For a single short document, you can use a very permissive +non-copyleft license, to avoid taking up space with a long license. + + See `http://www.gnu.org/copyleft/fdl-howto.html' for more explanation +of how to employ the GFDL. + + Note that it is not obligatory to include a copy of the GNU GPL or +GNU LGPL in a manual whose license is neither the GPL nor the LGPL. It +can be a good idea to include the program's license in a large manual; +in a short manual, whose size would be increased considerably by +including the program's license, it is probably better not to include +it. + + +File: standards.info, Node: Manual Credits, Next: Printed Manuals, Prev: License for Manuals, Up: Documentation + +Manual Credits +============== + +Please credit the principal human writers of the manual as the authors, +on the title page of the manual. If a company sponsored the work, thank +the company in a suitable place in the manual, but do not cite the +company as an author. + + +File: standards.info, Node: Printed Manuals, Next: NEWS File, Prev: Manual Credits, Up: Documentation + +Printed Manuals +=============== + +The FSF publishes some GNU manuals in printed form. To encourage sales +of these manuals, the on-line versions of the manual should mention at +the very start that the printed manual is available and should point at +information for getting it--for instance, with a link to the page +. This should not be included in +the printed manual, though, because there it is redundant. + + It is also useful to explain in the on-line forms of the manual how +the user can print out the manual from the sources. + + +File: standards.info, Node: NEWS File, Next: Change Logs, Prev: Printed Manuals, Up: Documentation + +The NEWS File +============= + +In addition to its manual, the package should have a file named `NEWS' +which contains a list of user-visible changes worth mentioning. In +each new release, add items to the front of the file and identify the +version they pertain to. Don't discard old items; leave them in the +file after the newer items. This way, a user upgrading from any +previous version can see what is new. + + If the `NEWS' file gets very long, move some of the older items into +a file named `ONEWS' and put a note at the end referring the user to +that file. + + +File: standards.info, Node: Change Logs, Next: Man Pages, Prev: NEWS File, Up: Documentation + +Change Logs +=========== + +Keep a change log to describe all the changes made to program source +files. The purpose of this is so that people investigating bugs in the +future will know about the changes that might have introduced the bug. +Often a new bug can be found by looking at what was recently changed. +More importantly, change logs can help you eliminate conceptual +inconsistencies between different parts of a program, by giving you a +history of how the conflicting concepts arose and who they came from. + +* Menu: + +* Change Log Concepts:: +* Style of Change Logs:: +* Simple Changes:: +* Conditional Changes:: +* Indicating the Part Changed:: + + +File: standards.info, Node: Change Log Concepts, Next: Style of Change Logs, Up: Change Logs + +Change Log Concepts +------------------- + +You can think of the change log as a conceptual "undo list" which +explains how earlier versions were different from the current version. +People can see the current version; they don't need the change log to +tell them what is in it. What they want from a change log is a clear +explanation of how the earlier version differed. + + The change log file is normally called `ChangeLog' and covers an +entire directory. Each directory can have its own change log, or a +directory can use the change log of its parent directory-it's up to you. + + Another alternative is to record change log information with a +version control system such as RCS or CVS. This can be converted +automatically to a `ChangeLog' file using `rcs2log'; in Emacs, the +command `C-x v a' (`vc-update-change-log') does the job. + + There's no need to describe the full purpose of the changes or how +they work together. If you think that a change calls for explanation, +you're probably right. Please do explain it--but please put the +explanation in comments in the code, where people will see it whenever +they see the code. For example, "New function" is enough for the +change log when you add a function, because there should be a comment +before the function definition to explain what it does. + + However, sometimes it is useful to write one line to describe the +overall purpose of a batch of changes. + + The easiest way to add an entry to `ChangeLog' is with the Emacs +command `M-x add-change-log-entry'. An entry should have an asterisk, +the name of the changed file, and then in parentheses the name of the +changed functions, variables or whatever, followed by a colon. Then +describe the changes you made to that function or variable. + + +File: standards.info, Node: Style of Change Logs, Next: Simple Changes, Prev: Change Log Concepts, Up: Change Logs + +Style of Change Logs +-------------------- + +Here are some simple examples of change log entries, starting with the +header line that says who made the change and when, followed by +descriptions of specific changes. (These examples are drawn from Emacs +and GCC.) + + 1998-08-17 Richard Stallman + + * register.el (insert-register): Return nil. + (jump-to-register): Likewise. + + * sort.el (sort-subr): Return nil. + + * tex-mode.el (tex-bibtex-file, tex-file, tex-region): + Restart the tex shell if process is gone or stopped. + (tex-shell-running): New function. + + * expr.c (store_one_arg): Round size up for move_block_to_reg. + (expand_call): Round up when emitting USE insns. + * stmt.c (assign_parms): Round size up for move_block_from_reg. + + It's important to name the changed function or variable in full. +Don't abbreviate function or variable names, and don't combine them. +Subsequent maintainers will often search for a function name to find all +the change log entries that pertain to it; if you abbreviate the name, +they won't find it when they search. + + For example, some people are tempted to abbreviate groups of function +names by writing `* register.el ({insert,jump-to}-register)'; this is +not a good idea, since searching for `jump-to-register' or +`insert-register' would not find that entry. + + Separate unrelated change log entries with blank lines. When two +entries represent parts of the same change, so that they work together, +then don't put blank lines between them. Then you can omit the file +name and the asterisk when successive entries are in the same file. + + Break long lists of function names by closing continued lines with +`)', rather than `,', and opening the continuation with `(' as in this +example: + + * keyboard.c (menu_bar_items, tool_bar_items) + (Fexecute_extended_command): Deal with `keymap' property. + + +File: standards.info, Node: Simple Changes, Next: Conditional Changes, Prev: Style of Change Logs, Up: Change Logs + +Simple Changes +-------------- + +Certain simple kinds of changes don't need much detail in the change +log. + + When you change the calling sequence of a function in a simple +fashion, and you change all the callers of the function to use the new +calling sequence, there is no need to make individual entries for all +the callers that you changed. Just write in the entry for the function +being called, "All callers changed"--like this: + + * keyboard.c (Fcommand_execute): New arg SPECIAL. + All callers changed. + + When you change just comments or doc strings, it is enough to write +an entry for the file, without mentioning the functions. Just "Doc +fixes" is enough for the change log. + + There's no need to make change log entries for documentation files. +This is because documentation is not susceptible to bugs that are hard +to fix. Documentation does not consist of parts that must interact in a +precisely engineered fashion. To correct an error, you need not know +the history of the erroneous passage; it is enough to compare what the +documentation says with the way the program actually works. + + +File: standards.info, Node: Conditional Changes, Next: Indicating the Part Changed, Prev: Simple Changes, Up: Change Logs + +Conditional Changes +------------------- + +C programs often contain compile-time `#if' conditionals. Many changes +are conditional; sometimes you add a new definition which is entirely +contained in a conditional. It is very useful to indicate in the +change log the conditions for which the change applies. + + Our convention for indicating conditional changes is to use square +brackets around the name of the condition. + + Here is a simple example, describing a change which is conditional +but does not have a function or entity name associated with it: + + * xterm.c [SOLARIS2]: Include string.h. + + Here is an entry describing a new definition which is entirely +conditional. This new definition for the macro `FRAME_WINDOW_P' is +used only when `HAVE_X_WINDOWS' is defined: + + * frame.h [HAVE_X_WINDOWS] (FRAME_WINDOW_P): Macro defined. + + Here is an entry for a change within the function `init_display', +whose definition as a whole is unconditional, but the changes themselves +are contained in a `#ifdef HAVE_LIBNCURSES' conditional: + + * dispnew.c (init_display) [HAVE_LIBNCURSES]: If X, call tgetent. + + Here is an entry for a change that takes affect only when a certain +macro is _not_ defined: + + (gethostname) [!HAVE_SOCKETS]: Replace with winsock version. + + +File: standards.info, Node: Indicating the Part Changed, Prev: Conditional Changes, Up: Change Logs + +Indicating the Part Changed +--------------------------- + +Indicate the part of a function which changed by using angle brackets +enclosing an indication of what the changed part does. Here is an entry +for a change in the part of the function `sh-while-getopts' that deals +with `sh' commands: + + * progmodes/sh-script.el (sh-while-getopts) : Handle case that + user-specified option string is empty. + + +File: standards.info, Node: Man Pages, Next: Reading other Manuals, Prev: Change Logs, Up: Documentation + +Man Pages +========= + +In the GNU project, man pages are secondary. It is not necessary or +expected for every GNU program to have a man page, but some of them do. +It's your choice whether to include a man page in your program. + + When you make this decision, consider that supporting a man page +requires continual effort each time the program is changed. The time +you spend on the man page is time taken away from more useful work. + + For a simple program which changes little, updating the man page may +be a small job. Then there is little reason not to include a man page, +if you have one. + + For a large program that changes a great deal, updating a man page +may be a substantial burden. If a user offers to donate a man page, +you may find this gift costly to accept. It may be better to refuse +the man page unless the same person agrees to take full responsibility +for maintaining it--so that you can wash your hands of it entirely. If +this volunteer later ceases to do the job, then don't feel obliged to +pick it up yourself; it may be better to withdraw the man page from the +distribution until someone else agrees to update it. + + When a program changes only a little, you may feel that the +discrepancies are small enough that the man page remains useful without +updating. If so, put a prominent note near the beginning of the man +page explaining that you don't maintain it and that the Texinfo manual +is more authoritative. The note should say how to access the Texinfo +documentation. + + +File: standards.info, Node: Reading other Manuals, Prev: Man Pages, Up: Documentation + +Reading other Manuals +===================== + +There may be non-free books or documentation files that describe the +program you are documenting. + + It is ok to use these documents for reference, just as the author of +a new algebra textbook can read other books on algebra. A large portion +of any non-fiction book consists of facts, in this case facts about how +a certain program works, and these facts are necessarily the same for +everyone who writes about the subject. But be careful not to copy your +outline structure, wording, tables or examples from preexisting non-free +documentation. Copying from free documentation may be ok; please check +with the FSF about the individual case. + + +File: standards.info, Node: Managing Releases, Next: References, Prev: Documentation, Up: Top + +The Release Process +******************* + +Making a release is more than just bundling up your source files in a +tar file and putting it up for FTP. You should set up your software so +that it can be configured to run on a variety of systems. Your Makefile +should conform to the GNU standards described below, and your directory +layout should also conform to the standards discussed below. Doing so +makes it easy to include your package into the larger framework of all +GNU software. + +* Menu: + +* Configuration:: How Configuration Should Work +* Makefile Conventions:: Makefile Conventions +* Releases:: Making Releases + + +File: standards.info, Node: Configuration, Next: Makefile Conventions, Up: Managing Releases + +How Configuration Should Work +============================= + +Each GNU distribution should come with a shell script named +`configure'. This script is given arguments which describe the kind of +machine and system you want to compile the program for. + + The `configure' script must record the configuration options so that +they affect compilation. + + One way to do this is to make a link from a standard name such as +`config.h' to the proper configuration file for the chosen system. If +you use this technique, the distribution should _not_ contain a file +named `config.h'. This is so that people won't be able to build the +program without configuring it first. + + Another thing that `configure' can do is to edit the Makefile. If +you do this, the distribution should _not_ contain a file named +`Makefile'. Instead, it should include a file `Makefile.in' which +contains the input used for editing. Once again, this is so that people +won't be able to build the program without configuring it first. + + If `configure' does write the `Makefile', then `Makefile' should +have a target named `Makefile' which causes `configure' to be rerun, +setting up the same configuration that was set up last time. The files +that `configure' reads should be listed as dependencies of `Makefile'. + + All the files which are output from the `configure' script should +have comments at the beginning explaining that they were generated +automatically using `configure'. This is so that users won't think of +trying to edit them by hand. + + The `configure' script should write a file named `config.status' +which describes which configuration options were specified when the +program was last configured. This file should be a shell script which, +if run, will recreate the same configuration. + + The `configure' script should accept an option of the form +`--srcdir=DIRNAME' to specify the directory where sources are found (if +it is not the current directory). This makes it possible to build the +program in a separate directory, so that the actual source directory is +not modified. + + If the user does not specify `--srcdir', then `configure' should +check both `.' and `..' to see if it can find the sources. If it finds +the sources in one of these places, it should use them from there. +Otherwise, it should report that it cannot find the sources, and should +exit with nonzero status. + + Usually the easy way to support `--srcdir' is by editing a +definition of `VPATH' into the Makefile. Some rules may need to refer +explicitly to the specified source directory. To make this possible, +`configure' can add to the Makefile a variable named `srcdir' whose +value is precisely the specified directory. + + The `configure' script should also take an argument which specifies +the type of system to build the program for. This argument should look +like this: + + CPU-COMPANY-SYSTEM + + For example, a Sun 3 might be `m68k-sun-sunos4.1'. + + The `configure' script needs to be able to decode all plausible +alternatives for how to describe a machine. Thus, `sun3-sunos4.1' +would be a valid alias. For many programs, `vax-dec-ultrix' would be +an alias for `vax-dec-bsd', simply because the differences between +Ultrix and BSD are rarely noticeable, but a few programs might need to +distinguish them. + + There is a shell script called `config.sub' that you can use as a +subroutine to validate system types and canonicalize aliases. + + Other options are permitted to specify in more detail the software +or hardware present on the machine, and include or exclude optional +parts of the package: + +`--enable-FEATURE[=PARAMETER]' + Configure the package to build and install an optional user-level + facility called FEATURE. This allows users to choose which + optional features to include. Giving an optional PARAMETER of + `no' should omit FEATURE, if it is built by default. + + No `--enable' option should *ever* cause one feature to replace + another. No `--enable' option should ever substitute one useful + behavior for another useful behavior. The only proper use for + `--enable' is for questions of whether to build part of the program + or exclude it. + +`--with-PACKAGE' + The package PACKAGE will be installed, so configure this package + to work with PACKAGE. + + Possible values of PACKAGE include `gnu-as' (or `gas'), `gnu-ld', + `gnu-libc', `gdb', `x', and `x-toolkit'. + + Do not use a `--with' option to specify the file name to use to + find certain files. That is outside the scope of what `--with' + options are for. + + All `configure' scripts should accept all of these "detail" options, +whether or not they make any difference to the particular package at +hand. In particular, they should accept any option that starts with +`--with-' or `--enable-'. This is so users will be able to configure +an entire GNU source tree at once with a single set of options. + + You will note that the categories `--with-' and `--enable-' are +narrow: they *do not* provide a place for any sort of option you might +think of. That is deliberate. We want to limit the possible +configuration options in GNU software. We do not want GNU programs to +have idiosyncratic configuration options. + + Packages that perform part of the compilation process may support +cross-compilation. In such a case, the host and target machines for the +program may be different. + + The `configure' script should normally treat the specified type of +system as both the host and the target, thus producing a program which +works for the same type of machine that it runs on. + + To configure a cross-compiler, cross-assembler, or what have you, you +should specify a target different from the host, using the configure +option `--target=TARGETTYPE'. The syntax for TARGETTYPE is the same as +for the host type. So the command would look like this: + + ./configure HOSTTYPE --target=TARGETTYPE + + Programs for which cross-operation is not meaningful need not accept +the `--target' option, because configuring an entire operating system +for cross-operation is not a meaningful operation. + + Bootstrapping a cross-compiler requires compiling it on a machine +other than the host it will run on. Compilation packages accept a +configuration option `--build=BUILDTYPE' for specifying the +configuration on which you will compile them, but the configure script +should normally guess the build machine type (using `config.guess'), so +this option is probably not necessary. The host and target types +normally default from the build type, so in bootstrapping a +cross-compiler you must specify them both explicitly. + + Some programs have ways of configuring themselves automatically. If +your program is set up to do this, your `configure' script can simply +ignore most of its arguments. + + +File: standards.info, Node: Makefile Conventions, Next: Releases, Prev: Configuration, Up: Managing Releases + +Makefile Conventions +==================== + +This node describes conventions for writing the Makefiles for GNU +programs. Using Automake will help you write a Makefile that follows +these conventions. + +* Menu: + +* Makefile Basics:: General Conventions for Makefiles +* Utilities in Makefiles:: Utilities in Makefiles +* Command Variables:: Variables for Specifying Commands +* Directory Variables:: Variables for Installation Directories +* Standard Targets:: Standard Targets for Users +* Install Command Categories:: Three categories of commands in the `install' + rule: normal, pre-install and post-install. + + +File: standards.info, Node: Makefile Basics, Next: Utilities in Makefiles, Up: Makefile Conventions + +General Conventions for Makefiles +--------------------------------- + +Every Makefile should contain this line: + + SHELL = /bin/sh + +to avoid trouble on systems where the `SHELL' variable might be +inherited from the environment. (This is never a problem with GNU +`make'.) + + Different `make' programs have incompatible suffix lists and +implicit rules, and this sometimes creates confusion or misbehavior. So +it is a good idea to set the suffix list explicitly using only the +suffixes you need in the particular Makefile, like this: + + .SUFFIXES: + .SUFFIXES: .c .o + +The first line clears out the suffix list, the second introduces all +suffixes which may be subject to implicit rules in this Makefile. + + Don't assume that `.' is in the path for command execution. When +you need to run programs that are a part of your package during the +make, please make sure that it uses `./' if the program is built as +part of the make or `$(srcdir)/' if the file is an unchanging part of +the source code. Without one of these prefixes, the current search +path is used. + + The distinction between `./' (the "build directory") and +`$(srcdir)/' (the "source directory") is important because users can +build in a separate directory using the `--srcdir' option to +`configure'. A rule of the form: + + foo.1 : foo.man sedscript + sed -e sedscript foo.man > foo.1 + +will fail when the build directory is not the source directory, because +`foo.man' and `sedscript' are in the source directory. + + When using GNU `make', relying on `VPATH' to find the source file +will work in the case where there is a single dependency file, since +the `make' automatic variable `$<' will represent the source file +wherever it is. (Many versions of `make' set `$<' only in implicit +rules.) A Makefile target like + + foo.o : bar.c + $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o + +should instead be written as + + foo.o : bar.c + $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@ + +in order to allow `VPATH' to work correctly. When the target has +multiple dependencies, using an explicit `$(srcdir)' is the easiest way +to make the rule work well. For example, the target above for `foo.1' +is best written as: + + foo.1 : foo.man sedscript + sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@ + + GNU distributions usually contain some files which are not source +files--for example, Info files, and the output from Autoconf, Automake, +Bison or Flex. Since these files normally appear in the source +directory, they should always appear in the source directory, not in the +build directory. So Makefile rules to update them should put the +updated files in the source directory. + + However, if a file does not appear in the distribution, then the +Makefile should not put it in the source directory, because building a +program in ordinary circumstances should not modify the source directory +in any way. + + Try to make the build and installation targets, at least (and all +their subtargets) work correctly with a parallel `make'. + + +File: standards.info, Node: Utilities in Makefiles, Next: Command Variables, Prev: Makefile Basics, Up: Makefile Conventions + +Utilities in Makefiles +---------------------- + +Write the Makefile commands (and any shell scripts, such as +`configure') to run in `sh', not in `csh'. Don't use any special +features of `ksh' or `bash'. + + The `configure' script and the Makefile rules for building and +installation should not use any utilities directly except these: + + cat cmp cp diff echo egrep expr false grep install-info + ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch true + + The compression program `gzip' can be used in the `dist' rule. + + Stick to the generally supported options for these programs. For +example, don't use `mkdir -p', convenient as it may be, because most +systems don't support it. + + It is a good idea to avoid creating symbolic links in makefiles, +since a few systems don't support them. + + The Makefile rules for building and installation can also use +compilers and related programs, but should do so via `make' variables +so that the user can substitute alternatives. Here are some of the +programs we mean: + + ar bison cc flex install ld ldconfig lex + make makeinfo ranlib texi2dvi yacc + + Use the following `make' variables to run those programs: + + $(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX) + $(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC) + + When you use `ranlib' or `ldconfig', you should make sure nothing +bad happens if the system does not have the program in question. +Arrange to ignore an error from that command, and print a message before +the command to tell the user that failure of this command does not mean +a problem. (The Autoconf `AC_PROG_RANLIB' macro can help with this.) + + If you use symbolic links, you should implement a fallback for +systems that don't have symbolic links. + + Additional utilities that can be used via Make variables are: + + chgrp chmod chown mknod + + It is ok to use other utilities in Makefile portions (or scripts) +intended only for particular systems where you know those utilities +exist. + + +File: standards.info, Node: Command Variables, Next: Directory Variables, Prev: Utilities in Makefiles, Up: Makefile Conventions + +Variables for Specifying Commands +--------------------------------- + +Makefiles should provide variables for overriding certain commands, +options, and so on. + + In particular, you should run most utility programs via variables. +Thus, if you use Bison, have a variable named `BISON' whose default +value is set with `BISON = bison', and refer to it with `$(BISON)' +whenever you need to use Bison. + + File management utilities such as `ln', `rm', `mv', and so on, need +not be referred to through variables in this way, since users don't +need to replace them with other programs. + + Each program-name variable should come with an options variable that +is used to supply options to the program. Append `FLAGS' to the +program-name variable name to get the options variable name--for +example, `BISONFLAGS'. (The names `CFLAGS' for the C compiler, +`YFLAGS' for yacc, and `LFLAGS' for lex, are exceptions to this rule, +but we keep them because they are standard.) Use `CPPFLAGS' in any +compilation command that runs the preprocessor, and use `LDFLAGS' in +any compilation command that does linking as well as in any direct use +of `ld'. + + If there are C compiler options that _must_ be used for proper +compilation of certain files, do not include them in `CFLAGS'. Users +expect to be able to specify `CFLAGS' freely themselves. Instead, +arrange to pass the necessary options to the C compiler independently +of `CFLAGS', by writing them explicitly in the compilation commands or +by defining an implicit rule, like this: + + CFLAGS = -g + ALL_CFLAGS = -I. $(CFLAGS) + .c.o: + $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< + + Do include the `-g' option in `CFLAGS', because that is not +_required_ for proper compilation. You can consider it a default that +is only recommended. If the package is set up so that it is compiled +with GCC by default, then you might as well include `-O' in the default +value of `CFLAGS' as well. + + Put `CFLAGS' last in the compilation command, after other variables +containing compiler options, so the user can use `CFLAGS' to override +the others. + + `CFLAGS' should be used in every invocation of the C compiler, both +those which do compilation and those which do linking. + + Every Makefile should define the variable `INSTALL', which is the +basic command for installing a file into the system. + + Every Makefile should also define the variables `INSTALL_PROGRAM' +and `INSTALL_DATA'. (The default for `INSTALL_PROGRAM' should be +`$(INSTALL)'; the default for `INSTALL_DATA' should be `${INSTALL} -m +644'.) Then it should use those variables as the commands for actual +installation, for executables and nonexecutables respectively. Use +these variables as follows: + + $(INSTALL_PROGRAM) foo $(bindir)/foo + $(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a + + Optionally, you may prepend the value of `DESTDIR' to the target +filename. Doing this allows the installer to create a snapshot of the +installation to be copied onto the real target filesystem later. Do not +set the value of `DESTDIR' in your Makefile, and do not include it in +any installed files. With support for `DESTDIR', the above examples +become: + + $(INSTALL_PROGRAM) foo $(DESTDIR)$(bindir)/foo + $(INSTALL_DATA) libfoo.a $(DESTDIR)$(libdir)/libfoo.a + +Always use a file name, not a directory name, as the second argument of +the installation commands. Use a separate command for each file to be +installed. + + +File: standards.info, Node: Directory Variables, Next: Standard Targets, Prev: Command Variables, Up: Makefile Conventions + +Variables for Installation Directories +-------------------------------------- + +Installation directories should always be named by variables, so it is +easy to install in a nonstandard place. The standard names for these +variables are described below. They are based on a standard filesystem +layout; variants of it are used in SVR4, 4.4BSD, GNU/Linux, Ultrix v4, +and other modern operating systems. + + These two variables set the root for the installation. All the other +installation directories should be subdirectories of one of these two, +and nothing should be directly installed into these two directories. + +`prefix' + A prefix used in constructing the default values of the variables + listed below. The default value of `prefix' should be + `/usr/local'. When building the complete GNU system, the prefix + will be empty and `/usr' will be a symbolic link to `/'. (If you + are using Autoconf, write it as `@prefix@'.) + + Running `make install' with a different value of `prefix' from the + one used to build the program should _not_ recompile the program. + +`exec_prefix' + A prefix used in constructing the default values of some of the + variables listed below. The default value of `exec_prefix' should + be `$(prefix)'. (If you are using Autoconf, write it as + `@exec_prefix@'.) + + Generally, `$(exec_prefix)' is used for directories that contain + machine-specific files (such as executables and subroutine + libraries), while `$(prefix)' is used directly for other + directories. + + Running `make install' with a different value of `exec_prefix' + from the one used to build the program should _not_ recompile the + program. + + Executable programs are installed in one of the following +directories. + +`bindir' + The directory for installing executable programs that users can + run. This should normally be `/usr/local/bin', but write it as + `$(exec_prefix)/bin'. (If you are using Autoconf, write it as + `@bindir@'.) + +`sbindir' + The directory for installing executable programs that can be run + from the shell, but are only generally useful to system + administrators. This should normally be `/usr/local/sbin', but + write it as `$(exec_prefix)/sbin'. (If you are using Autoconf, + write it as `@sbindir@'.) + +`libexecdir' + The directory for installing executable programs to be run by other + programs rather than by users. This directory should normally be + `/usr/local/libexec', but write it as `$(exec_prefix)/libexec'. + (If you are using Autoconf, write it as `@libexecdir@'.) + + Data files used by the program during its execution are divided into +categories in two ways. + + * Some files are normally modified by programs; others are never + normally modified (though users may edit some of these). + + * Some files are architecture-independent and can be shared by all + machines at a site; some are architecture-dependent and can be + shared only by machines of the same kind and operating system; + others may never be shared between two machines. + + This makes for six different possibilities. However, we want to +discourage the use of architecture-dependent files, aside from object +files and libraries. It is much cleaner to make other data files +architecture-independent, and it is generally not hard. + + Therefore, here are the variables Makefiles should use to specify +directories: + +`datadir' + The directory for installing read-only architecture independent + data files. This should normally be `/usr/local/share', but write + it as `$(prefix)/share'. (If you are using Autoconf, write it as + `@datadir@'.) As a special exception, see `$(infodir)' and + `$(includedir)' below. + +`sysconfdir' + The directory for installing read-only data files that pertain to a + single machine-that is to say, files for configuring a host. + Mailer and network configuration files, `/etc/passwd', and so + forth belong here. All the files in this directory should be + ordinary ASCII text files. This directory should normally be + `/usr/local/etc', but write it as `$(prefix)/etc'. (If you are + using Autoconf, write it as `@sysconfdir@'.) + + Do not install executables here in this directory (they probably + belong in `$(libexecdir)' or `$(sbindir)'). Also do not install + files that are modified in the normal course of their use (programs + whose purpose is to change the configuration of the system + excluded). Those probably belong in `$(localstatedir)'. + +`sharedstatedir' + The directory for installing architecture-independent data files + which the programs modify while they run. This should normally be + `/usr/local/com', but write it as `$(prefix)/com'. (If you are + using Autoconf, write it as `@sharedstatedir@'.) + +`localstatedir' + The directory for installing data files which the programs modify + while they run, and that pertain to one specific machine. Users + should never need to modify files in this directory to configure + the package's operation; put such configuration information in + separate files that go in `$(datadir)' or `$(sysconfdir)'. + `$(localstatedir)' should normally be `/usr/local/var', but write + it as `$(prefix)/var'. (If you are using Autoconf, write it as + `@localstatedir@'.) + +`libdir' + The directory for object files and libraries of object code. Do + not install executables here, they probably ought to go in + `$(libexecdir)' instead. The value of `libdir' should normally be + `/usr/local/lib', but write it as `$(exec_prefix)/lib'. (If you + are using Autoconf, write it as `@libdir@'.) + +`infodir' + The directory for installing the Info files for this package. By + default, it should be `/usr/local/info', but it should be written + as `$(prefix)/info'. (If you are using Autoconf, write it as + `@infodir@'.) + +`lispdir' + The directory for installing any Emacs Lisp files in this package. + By default, it should be `/usr/local/share/emacs/site-lisp', but + it should be written as `$(prefix)/share/emacs/site-lisp'. + + If you are using Autoconf, write the default as `@lispdir@'. In + order to make `@lispdir@' work, you need the following lines in + your `configure.in' file: + + lispdir='${datadir}/emacs/site-lisp' + AC_SUBST(lispdir) + +`includedir' + The directory for installing header files to be included by user + programs with the C `#include' preprocessor directive. This + should normally be `/usr/local/include', but write it as + `$(prefix)/include'. (If you are using Autoconf, write it as + `@includedir@'.) + + Most compilers other than GCC do not look for header files in + directory `/usr/local/include'. So installing the header files + this way is only useful with GCC. Sometimes this is not a problem + because some libraries are only really intended to work with GCC. + But some libraries are intended to work with other compilers. + They should install their header files in two places, one + specified by `includedir' and one specified by `oldincludedir'. + +`oldincludedir' + The directory for installing `#include' header files for use with + compilers other than GCC. This should normally be `/usr/include'. + (If you are using Autoconf, you can write it as `@oldincludedir@'.) + + The Makefile commands should check whether the value of + `oldincludedir' is empty. If it is, they should not try to use + it; they should cancel the second installation of the header files. + + A package should not replace an existing header in this directory + unless the header came from the same package. Thus, if your Foo + package provides a header file `foo.h', then it should install the + header file in the `oldincludedir' directory if either (1) there + is no `foo.h' there or (2) the `foo.h' that exists came from the + Foo package. + + To tell whether `foo.h' came from the Foo package, put a magic + string in the file--part of a comment--and `grep' for that string. + + Unix-style man pages are installed in one of the following: + +`mandir' + The top-level directory for installing the man pages (if any) for + this package. It will normally be `/usr/local/man', but you should + write it as `$(prefix)/man'. (If you are using Autoconf, write it + as `@mandir@'.) + +`man1dir' + The directory for installing section 1 man pages. Write it as + `$(mandir)/man1'. + +`man2dir' + The directory for installing section 2 man pages. Write it as + `$(mandir)/man2' + +`...' + *Don't make the primary documentation for any GNU software be a + man page. Write a manual in Texinfo instead. Man pages are just + for the sake of people running GNU software on Unix, which is a + secondary application only.* + +`manext' + The file name extension for the installed man page. This should + contain a period followed by the appropriate digit; it should + normally be `.1'. + +`man1ext' + The file name extension for installed section 1 man pages. + +`man2ext' + The file name extension for installed section 2 man pages. + +`...' + Use these names instead of `manext' if the package needs to + install man pages in more than one section of the manual. + + And finally, you should set the following variable: + +`srcdir' + The directory for the sources being compiled. The value of this + variable is normally inserted by the `configure' shell script. + (If you are using Autconf, use `srcdir = @srcdir@'.) + + For example: + + # Common prefix for installation directories. + # NOTE: This directory must exist when you start the install. + prefix = /usr/local + exec_prefix = $(prefix) + # Where to put the executable for the command `gcc'. + bindir = $(exec_prefix)/bin + # Where to put the directories used by the compiler. + libexecdir = $(exec_prefix)/libexec + # Where to put the Info files. + infodir = $(prefix)/info + + If your program installs a large number of files into one of the +standard user-specified directories, it might be useful to group them +into a subdirectory particular to that program. If you do this, you +should write the `install' rule to create these subdirectories. + + Do not expect the user to include the subdirectory name in the value +of any of the variables listed above. The idea of having a uniform set +of variable names for installation directories is to enable the user to +specify the exact same values for several different GNU packages. In +order for this to be useful, all the packages must be designed so that +they will work sensibly when the user does so. + + +File: standards.info, Node: Standard Targets, Next: Install Command Categories, Prev: Directory Variables, Up: Makefile Conventions + +Standard Targets for Users +-------------------------- + +All GNU programs should have the following targets in their Makefiles: + +`all' + Compile the entire program. This should be the default target. + This target need not rebuild any documentation files; Info files + should normally be included in the distribution, and DVI files + should be made only when explicitly asked for. + + By default, the Make rules should compile and link with `-g', so + that executable programs have debugging symbols. Users who don't + mind being helpless can strip the executables later if they wish. + +`install' + Compile the program and copy the executables, libraries, and so on + to the file names where they should reside for actual use. If + there is a simple test to verify that a program is properly + installed, this target should run that test. + + Do not strip executables when installing them. Devil-may-care + users can use the `install-strip' target to do that. + + If possible, write the `install' target rule so that it does not + modify anything in the directory where the program was built, + provided `make all' has just been done. This is convenient for + building the program under one user name and installing it under + another. + + The commands should create all the directories in which files are + to be installed, if they don't already exist. This includes the + directories specified as the values of the variables `prefix' and + `exec_prefix', as well as all subdirectories that are needed. One + way to do this is by means of an `installdirs' target as described + below. + + Use `-' before any command for installing a man page, so that + `make' will ignore any errors. This is in case there are systems + that don't have the Unix man page documentation system installed. + + The way to install Info files is to copy them into `$(infodir)' + with `$(INSTALL_DATA)' (*note Command Variables::), and then run + the `install-info' program if it is present. `install-info' is a + program that edits the Info `dir' file to add or update the menu + entry for the given Info file; it is part of the Texinfo package. + Here is a sample rule to install an Info file: + + $(DESTDIR)$(infodir)/foo.info: foo.info + $(POST_INSTALL) + # There may be a newer info file in . than in srcdir. + -if test -f foo.info; then d=.; \ + else d=$(srcdir); fi; \ + $(INSTALL_DATA) $$d/foo.info $(DESTDIR)$@; \ + # Run install-info only if it exists. + # Use `if' instead of just prepending `-' to the + # line so we notice real errors from install-info. + # We use `$(SHELL) -c' because some shells do not + # fail gracefully when there is an unknown command. + if $(SHELL) -c 'install-info --version' \ + >/dev/null 2>&1; then \ + install-info --dir-file=$(DESTDIR)$(infodir)/dir \ + $(DESTDIR)$(infodir)/foo.info; \ + else true; fi + + When writing the `install' target, you must classify all the + commands into three categories: normal ones, "pre-installation" + commands and "post-installation" commands. *Note Install Command + Categories::. + +`uninstall' + Delete all the installed files--the copies that the `install' + target creates. + + This rule should not modify the directories where compilation is + done, only the directories where files are installed. + + The uninstallation commands are divided into three categories, + just like the installation commands. *Note Install Command + Categories::. + +`install-strip' + Like `install', but strip the executable files while installing + them. In simple cases, this target can use the `install' target in + a simple way: + + install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ + install + + But if the package installs scripts as well as real executables, + the `install-strip' target can't just refer to the `install' + target; it has to strip the executables but not the scripts. + + `install-strip' should not strip the executables in the build + directory which are being copied for installation. It should only + strip the copies that are installed. + + Normally we do not recommend stripping an executable unless you + are sure the program has no bugs. However, it can be reasonable + to install a stripped executable for actual execution while saving + the unstripped executable elsewhere in case there is a bug. + +`clean' + Delete all files from the current directory that are normally + created by building the program. Don't delete the files that + record the configuration. Also preserve files that could be made + by building, but normally aren't because the distribution comes + with them. + + Delete `.dvi' files here if they are not part of the distribution. + +`distclean' + Delete all files from the current directory that are created by + configuring or building the program. If you have unpacked the + source and built the program without creating any other files, + `make distclean' should leave only the files that were in the + distribution. + +`mostlyclean' + Like `clean', but may refrain from deleting a few files that people + normally don't want to recompile. For example, the `mostlyclean' + target for GCC does not delete `libgcc.a', because recompiling it + is rarely necessary and takes a lot of time. + +`maintainer-clean' + Delete almost everything from the current directory that can be + reconstructed with this Makefile. This typically includes + everything deleted by `distclean', plus more: C source files + produced by Bison, tags tables, Info files, and so on. + + The reason we say "almost everything" is that running the command + `make maintainer-clean' should not delete `configure' even if + `configure' can be remade using a rule in the Makefile. More + generally, `make maintainer-clean' should not delete anything that + needs to exist in order to run `configure' and then begin to build + the program. This is the only exception; `maintainer-clean' should + delete everything else that can be rebuilt. + + The `maintainer-clean' target is intended to be used by a + maintainer of the package, not by ordinary users. You may need + special tools to reconstruct some of the files that `make + maintainer-clean' deletes. Since these files are normally + included in the distribution, we don't take care to make them easy + to reconstruct. If you find you need to unpack the full + distribution again, don't blame us. + + To help make users aware of this, the commands for the special + `maintainer-clean' target should start with these two: + + @echo 'This command is intended for maintainers to use; it' + @echo 'deletes files that may need special tools to rebuild.' + +`TAGS' + Update a tags table for this program. + +`info' + Generate any Info files needed. The best way to write the rules + is as follows: + + info: foo.info + + foo.info: foo.texi chap1.texi chap2.texi + $(MAKEINFO) $(srcdir)/foo.texi + + You must define the variable `MAKEINFO' in the Makefile. It should + run the `makeinfo' program, which is part of the Texinfo + distribution. + + Normally a GNU distribution comes with Info files, and that means + the Info files are present in the source directory. Therefore, + the Make rule for an info file should update it in the source + directory. When users build the package, ordinarily Make will not + update the Info files because they will already be up to date. + +`dvi' + Generate DVI files for all Texinfo documentation. For example: + + dvi: foo.dvi + + foo.dvi: foo.texi chap1.texi chap2.texi + $(TEXI2DVI) $(srcdir)/foo.texi + + You must define the variable `TEXI2DVI' in the Makefile. It should + run the program `texi2dvi', which is part of the Texinfo + distribution.(1) Alternatively, write just the dependencies, and + allow GNU `make' to provide the command. + +`dist' + Create a distribution tar file for this program. The tar file + should be set up so that the file names in the tar file start with + a subdirectory name which is the name of the package it is a + distribution for. This name can include the version number. + + For example, the distribution tar file of GCC version 1.40 unpacks + into a subdirectory named `gcc-1.40'. + + The easiest way to do this is to create a subdirectory + appropriately named, use `ln' or `cp' to install the proper files + in it, and then `tar' that subdirectory. + + Compress the tar file with `gzip'. For example, the actual + distribution file for GCC version 1.40 is called `gcc-1.40.tar.gz'. + + The `dist' target should explicitly depend on all non-source files + that are in the distribution, to make sure they are up to date in + the distribution. *Note Making Releases: Releases. + +`check' + Perform self-tests (if any). The user must build the program + before running the tests, but need not install the program; you + should write the self-tests so that they work when the program is + built but not installed. + + The following targets are suggested as conventional names, for +programs in which they are useful. + +`installcheck' + Perform installation tests (if any). The user must build and + install the program before running the tests. You should not + assume that `$(bindir)' is in the search path. + +`installdirs' + It's useful to add a target named `installdirs' to create the + directories where files are installed, and their parent + directories. There is a script called `mkinstalldirs' which is + convenient for this; you can find it in the Texinfo package. You + can use a rule like this: + + # Make sure all installation directories (e.g. $(bindir)) + # actually exist by making them if necessary. + installdirs: mkinstalldirs + $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ + $(libdir) $(infodir) \ + $(mandir) + + or, if you wish to support `DESTDIR', + + # Make sure all installation directories (e.g. $(bindir)) + # actually exist by making them if necessary. + installdirs: mkinstalldirs + $(srcdir)/mkinstalldirs \ + $(DESTDIR)$(bindir) $(DESTDIR)$(datadir) \ + $(DESTDIR)$(libdir) $(DESTDIR)$(infodir) \ + $(DESTDIR)$(mandir) + + This rule should not modify the directories where compilation is + done. It should do nothing but create installation directories. + + ---------- Footnotes ---------- + + (1) `texi2dvi' uses TeX to do the real work of formatting. TeX is +not distributed with Texinfo. + + +File: standards.info, Node: Install Command Categories, Prev: Standard Targets, Up: Makefile Conventions + +Install Command Categories +-------------------------- + +When writing the `install' target, you must classify all the commands +into three categories: normal ones, "pre-installation" commands and +"post-installation" commands. + + Normal commands move files into their proper places, and set their +modes. They may not alter any files except the ones that come entirely +from the package they belong to. + + Pre-installation and post-installation commands may alter other +files; in particular, they can edit global configuration files or data +bases. + + Pre-installation commands are typically executed before the normal +commands, and post-installation commands are typically run after the +normal commands. + + The most common use for a post-installation command is to run +`install-info'. This cannot be done with a normal command, since it +alters a file (the Info directory) which does not come entirely and +solely from the package being installed. It is a post-installation +command because it needs to be done after the normal command which +installs the package's Info files. + + Most programs don't need any pre-installation commands, but we have +the feature just in case it is needed. + + To classify the commands in the `install' rule into these three +categories, insert "category lines" among them. A category line +specifies the category for the commands that follow. + + A category line consists of a tab and a reference to a special Make +variable, plus an optional comment at the end. There are three +variables you can use, one for each category; the variable name +specifies the category. Category lines are no-ops in ordinary execution +because these three Make variables are normally undefined (and you +_should not_ define them in the makefile). + + Here are the three possible category lines, each with a comment that +explains what it means: + + $(PRE_INSTALL) # Pre-install commands follow. + $(POST_INSTALL) # Post-install commands follow. + $(NORMAL_INSTALL) # Normal commands follow. + + If you don't use a category line at the beginning of the `install' +rule, all the commands are classified as normal until the first category +line. If you don't use any category lines, all the commands are +classified as normal. + + These are the category lines for `uninstall': + + $(PRE_UNINSTALL) # Pre-uninstall commands follow. + $(POST_UNINSTALL) # Post-uninstall commands follow. + $(NORMAL_UNINSTALL) # Normal commands follow. + + Typically, a pre-uninstall command would be used for deleting entries +from the Info directory. + + If the `install' or `uninstall' target has any dependencies which +act as subroutines of installation, then you should start _each_ +dependency's commands with a category line, and start the main target's +commands with a category line also. This way, you can ensure that each +command is placed in the right category regardless of which of the +dependencies actually run. + + Pre-installation and post-installation commands should not run any +programs except for these: + + [ basename bash cat chgrp chmod chown cmp cp dd diff echo + egrep expand expr false fgrep find getopt grep gunzip gzip + hostname install install-info kill ldconfig ln ls md5sum + mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee + test touch true uname xargs yes + + The reason for distinguishing the commands in this way is for the +sake of making binary packages. Typically a binary package contains +all the executables and other files that need to be installed, and has +its own method of installing them--so it does not need to run the normal +installation commands. But installing the binary package does need to +execute the pre-installation and post-installation commands. + + Programs to build binary packages work by extracting the +pre-installation and post-installation commands. Here is one way of +extracting the pre-installation commands: + + make -n install -o all \ + PRE_INSTALL=pre-install \ + POST_INSTALL=post-install \ + NORMAL_INSTALL=normal-install \ + | gawk -f pre-install.awk + +where the file `pre-install.awk' could contain this: + + $0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ {on = 0} + on {print $0} + $0 ~ /^\t[ \t]*pre_install[ \t]*$/ {on = 1} + + The resulting file of pre-installation commands is executed as a +shell script as part of installing the binary package. + + +File: standards.info, Node: Releases, Prev: Makefile Conventions, Up: Managing Releases + +Making Releases +=============== + +Package the distribution of `Foo version 69.96' up in a gzipped tar +file with the name `foo-69.96.tar.gz'. It should unpack into a +subdirectory named `foo-69.96'. + + Building and installing the program should never modify any of the +files contained in the distribution. This means that all the files +that form part of the program in any way must be classified into "source +files" and "non-source files". Source files are written by humans and +never changed automatically; non-source files are produced from source +files by programs under the control of the Makefile. + + The distribution should contain a file named `README' which gives +the name of the package, and a general description of what it does. It +is also good to explain the purpose of each of the first-level +subdirectories in the package, if there are any. The `README' file +should either state the version number of the package, or refer to where +in the package it can be found. + + The `README' file should refer to the file `INSTALL', which should +contain an explanation of the installation procedure. + + The `README' file should also refer to the file which contains the +copying conditions. The GNU GPL, if used, should be in a file called +`COPYING'. If the GNU LGPL is used, it should be in a file called +`COPYING.LIB'. + + Naturally, all the source files must be in the distribution. It is +okay to include non-source files in the distribution, provided they are +up-to-date and machine-independent, so that building the distribution +normally will never modify them. We commonly include non-source files +produced by Bison, `lex', TeX, and `makeinfo'; this helps avoid +unnecessary dependencies between our distributions, so that users can +install whichever packages they want to install. + + Non-source files that might actually be modified by building and +installing the program should *never* be included in the distribution. +So if you do distribute non-source files, always make sure they are up +to date when you make a new distribution. + + Make sure that the directory into which the distribution unpacks (as +well as any subdirectories) are all world-writable (octal mode 777). +This is so that old versions of `tar' which preserve the ownership and +permissions of the files from the tar archive will be able to extract +all the files even if the user is unprivileged. + + Make sure that all the files in the distribution are world-readable. + + Make sure that no file name in the distribution is more than 14 +characters long. Likewise, no file created by building the program +should have a name longer than 14 characters. The reason for this is +that some systems adhere to a foolish interpretation of the POSIX +standard, and refuse to open a longer name, rather than truncating as +they did in the past. + + Don't include any symbolic links in the distribution itself. If the +tar file contains symbolic links, then people cannot even unpack it on +systems that don't support symbolic links. Also, don't use multiple +names for one file in different directories, because certain file +systems cannot handle this and that prevents unpacking the distribution. + + Try to make sure that all the file names will be unique on MS-DOS. A +name on MS-DOS consists of up to 8 characters, optionally followed by a +period and up to three characters. MS-DOS will truncate extra +characters both before and after the period. Thus, `foobarhacker.c' +and `foobarhacker.o' are not ambiguous; they are truncated to +`foobarha.c' and `foobarha.o', which are distinct. + + Include in your distribution a copy of the `texinfo.tex' you used to +test print any `*.texinfo' or `*.texi' files. + + Likewise, if your program uses small GNU software packages like +regex, getopt, obstack, or termcap, include them in the distribution +file. Leaving them out would make the distribution file a little +smaller at the expense of possible inconvenience to a user who doesn't +know what other files to get. + + +File: standards.info, Node: References, Next: Copying This Manual, Prev: Managing Releases, Up: Top + +References to Non-Free Software and Documentation +************************************************* + +A GNU program should not recommend use of any non-free program. We +can't stop some people from writing proprietary programs, or stop other +people from using them, but we can and should avoid helping to +advertise them to new potential customers. Proprietary software is a +social and ethical problem, and the point of GNU is to solve that +problem. + + When a non-free program or system is well known, you can mention it +in passing--that is harmless, since users who might want to use it +probably already know about it. For instance, it is fine to explain +how to build your package on top of some non-free operating system, or +how to use it together with some widely used non-free program. + + However, you should give only the necessary information to help those +who already use the non-free program to use your program with it--don't +give, or refer to, any further information about the proprietary +program, and don't imply that the proprietary program enhances your +program, or that its existence is in any way a good thing. The goal +should be that people already using the proprietary program will get +the advice they need about how to use your free program, while people +who don't already use the proprietary program will not see anything to +lead them to take an interest in it. + + If a non-free program or system is obscure in your program's domain, +your program should not mention or support it at all, since doing so +would tend to popularize the non-free program more than it popularizes +your program. (You cannot hope to find many additional users among the +users of Foobar if the users of Foobar are few.) + + A GNU package should not refer the user to any non-free documentation +for free software. Free documentation that can be included in free +operating systems is essential for completing the GNU system, so it is +a major focus of the GNU Project; to recommend use of documentation +that we are not allowed to use in GNU would undermine the efforts to +get documentation that we can include. So GNU packages should never +recommend non-free documentation. + + +File: standards.info, Node: Copying This Manual, Next: Index, Prev: References, Up: Top + +Copying This Manual +******************* + +* Menu: + +* GNU Free Documentation License:: License for copying this manual + + +File: standards.info, Node: GNU Free Documentation License, Up: Copying This Manual + +GNU Free Documentation License +****************************** + + Version 1.1, March 2000 + Copyright (C) 2000 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. + + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or other + written document "free" in the sense of freedom: to assure everyone + the effective freedom to copy and redistribute it, with or without + modifying it, either commercially or noncommercially. Secondarily, + this License preserves for the author and publisher a way to get + credit for their work, while not being considered responsible for + modifications made by others. + + This License is a kind of "copyleft", which means that derivative + works of the document must themselves be free in the same sense. + It complements the GNU General Public License, which is a copyleft + license designed for free software. + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same freedoms + that the software does. But this License is not limited to + software manuals; it can be used for any textual work, regardless + of subject matter or whether it is published as a printed book. + We recommend this License principally for works whose purpose is + instruction or reference. + + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work that contains a + notice placed by the copyright holder saying it can be distributed + under the terms of this License. The "Document", below, refers to + any such manual or work. Any member of the public is a licensee, + and is addressed as "you." + + A "Modified Version" of the Document means any work containing the + Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. + + A "Secondary Section" is a named appendix or a front-matter + section of the Document that deals exclusively with the + relationship of the publishers or authors of the Document to the + Document's overall subject (or to related matters) and contains + nothing that could fall directly within that overall subject. + (For example, if the Document is in part a textbook of + mathematics, a Secondary Section may not explain any mathematics.) + The relationship could be a matter of historical connection with + the subject or with related matters, or of legal, commercial, + philosophical, ethical or political position regarding them. + + The "Invariant Sections" are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in + the notice that says that the Document is released under this + License. + + The "Cover Texts" are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice + that says that the Document is released under this License. + + A "Transparent" copy of the Document means a machine-readable copy, + represented in a format whose specification is available to the + general public, whose contents can be viewed and edited directly + and straightforwardly with generic text editors or (for images + composed of pixels) generic paint programs or (for drawings) some + widely available drawing editor, and that is suitable for input to + text formatters or for automatic translation to a variety of + formats suitable for input to text formatters. A copy made in an + otherwise Transparent file format whose markup has been designed + to thwart or discourage subsequent modification by readers is not + Transparent. A copy that is not "Transparent" is called "Opaque." + + Examples of suitable formats for Transparent copies include plain + ASCII without markup, Texinfo input format, LaTeX input format, + SGML or XML using a publicly available DTD, and + standard-conforming simple HTML designed for human modification. + Opaque formats include PostScript, PDF, proprietary formats that + can be read and edited only by proprietary word processors, SGML + or XML for which the DTD and/or processing tools are not generally + available, and the machine-generated HTML produced by some word + processors for output purposes only. + + The "Title Page" means, for a printed book, the title page itself, + plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For + works in formats which do not have any title page as such, "Title + Page" means the text near the most prominent appearance of the + work's title, preceding the beginning of the body of the text. + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that you + add no other conditions whatsoever to those of this License. You + may not use technical measures to obstruct or control the reading + or further copying of the copies you make or distribute. However, + you may accept compensation in exchange for copies. If you + distribute a large enough number of copies you must also follow + the conditions in section 3. + + You may also lend copies, under the same conditions stated above, + and you may publicly display copies. + + 3. COPYING IN QUANTITY + + If you publish printed copies of the Document numbering more than + 100, and the Document's license notice requires Cover Texts, you + must enclose the copies in covers that carry, clearly and legibly, + all these Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also clearly + and legibly identify you as the publisher of these copies. The + front cover must present the full title with all words of the + title equally prominent and visible. You may add other material + on the covers in addition. Copying with changes limited to the + covers, as long as they preserve the title of the Document and + satisfy these conditions, can be treated as verbatim copying in + other respects. + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + If you publish or distribute Opaque copies of the Document + numbering more than 100, you must either include a + machine-readable Transparent copy along with each Opaque copy, or + state in or with each Opaque copy a publicly-accessible + computer-network location containing a complete Transparent copy + of the Document, free of added material, which the general + network-using public has access to download anonymously at no + charge using public-standard network protocols. If you use the + latter option, you must take reasonably prudent steps, when you + begin distribution of Opaque copies in quantity, to ensure that + this Transparent copy will remain thus accessible at the stated + location until at least one year after the last time you + distribute an Opaque copy (directly or through your agents or + retailers) of that edition to the public. + + It is requested, but not required, that you contact the authors of + the Document well before redistributing any large number of + copies, to give them a chance to provide you with an updated + version of the Document. + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document + under the conditions of sections 2 and 3 above, provided that you + release the Modified Version under precisely this License, with + the Modified Version filling the role of the Document, thus + licensing distribution and modification of the Modified Version to + whoever possesses a copy of it. In addition, you must do these + things in the Modified Version: + + A. Use in the Title Page (and on the covers, if any) a title + distinct from that of the Document, and from those of previous + versions (which should, if there were any, be listed in the + History section of the Document). You may use the same title + as a previous version if the original publisher of that version + gives permission. + B. List on the Title Page, as authors, one or more persons or + entities responsible for authorship of the modifications in the + Modified Version, together with at least five of the principal + authors of the Document (all of its principal authors, if it + has less than five). + C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. + D. Preserve all the copyright notices of the Document. + E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + F. Include, immediately after the copyright notices, a license + notice giving the public permission to use the Modified Version + under the terms of this License, in the form shown in the + Addendum below. + G. Preserve in that license notice the full lists of Invariant + Sections and required Cover Texts given in the Document's + license notice. + H. Include an unaltered copy of this License. + I. Preserve the section entitled "History", and its title, and add + to it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. + If there is no section entitled "History" in the Document, + create one stating the title, year, authors, and publisher of + the Document as given on its Title Page, then add an item + describing the Modified Version as stated in the previous + sentence. + J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and + likewise the network locations given in the Document for + previous versions it was based on. These may be placed in the + "History" section. You may omit a network location for a work + that was published at least four years before the Document + itself, or if the original publisher of the version it refers + to gives permission. + K. In any section entitled "Acknowledgements" or "Dedications", + preserve the section's title, and preserve in the section all the + substance and tone of each of the contributor acknowledgements + and/or dedications given therein. + L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. + M. Delete any section entitled "Endorsements." Such a section + may not be included in the Modified Version. + N. Do not retitle any existing section as "Endorsements" or to + conflict in title with any Invariant Section. + + If the Modified Version includes new front-matter sections or + appendices that qualify as Secondary Sections and contain no + material copied from the Document, you may at your option + designate some or all of these sections as invariant. To do this, + add their titles to the list of Invariant Sections in the Modified + Version's license notice. These titles must be distinct from any + other section titles. + + You may add a section entitled "Endorsements", provided it contains + nothing but endorsements of your Modified Version by various + parties-for example, statements of peer review or that the text has + been approved by an organization as the authoritative definition + of a standard. + + You may add a passage of up to five words as a Front-Cover Text, + and a passage of up to 25 words as a Back-Cover Text, to the end + of the list of Cover Texts in the Modified Version. Only one + passage of Front-Cover Text and one of Back-Cover Text may be + added by (or through arrangements made by) any one entity. If the + Document already includes a cover text for the same cover, + previously added by you or by arrangement made by the same entity + you are acting on behalf of, you may not add another; but you may + replace the old one, on explicit permission from the previous + publisher that added the old one. + + The author(s) and publisher(s) of the Document do not by this + License give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version. + + 5. COMBINING DOCUMENTS + + You may combine the Document with other documents released under + this License, under the terms defined in section 4 above for + modified versions, provided that you include in the combination + all of the Invariant Sections of all of the original documents, + unmodified, and list them all as Invariant Sections of your + combined work in its license notice. + + The combined work need only contain one copy of this License, and + multiple identical Invariant Sections may be replaced with a single + copy. If there are multiple Invariant Sections with the same name + but different contents, make the title of each such section unique + by adding at the end of it, in parentheses, the name of the + original author or publisher of that section if known, or else a + unique number. Make the same adjustment to the section titles in + the list of Invariant Sections in the license notice of the + combined work. + + In the combination, you must combine any sections entitled + "History" in the various original documents, forming one section + entitled "History"; likewise combine any sections entitled + "Acknowledgements", and any sections entitled "Dedications." You + must delete all sections entitled "Endorsements." + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other + documents released under this License, and replace the individual + copies of this License in the various documents with a single copy + that is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the + documents in all other respects. + + You may extract a single document from such a collection, and + distribute it individually under this License, provided you insert + a copy of this License into the extracted document, and follow + this License in all other respects regarding verbatim copying of + that document. + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with other + separate and independent documents or works, in or on a volume of + a storage or distribution medium, does not as a whole count as a + Modified Version of the Document, provided no compilation + copyright is claimed for the compilation. Such a compilation is + called an "aggregate", and this License does not apply to the + other self-contained works thus compiled with the Document, on + account of their being thus compiled, if they are not themselves + derivative works of the Document. + + If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one + quarter of the entire aggregate, the Document's Cover Texts may be + placed on covers that surround only the Document within the + aggregate. Otherwise they must appear on covers around the whole + aggregate. + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section + 4. Replacing Invariant Sections with translations requires special + permission from their copyright holders, but you may include + translations of some or all Invariant Sections in addition to the + original versions of these Invariant Sections. You may include a + translation of this License provided that you also include the + original English version of this License. In case of a + disagreement between the translation and the original English + version of this License, the original English version will prevail. + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document + except as expressly provided for under this License. Any other + attempt to copy, modify, sublicense or distribute the Document 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. + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software Foundation may publish new, revised versions of + the GNU Free Documentation 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. See + http://www.gnu.org/copyleft/. + + Each version of the License is given a distinguishing version + number. If the Document specifies that a particular numbered + version of this License "or any later version" applies to it, you + have the option of following the terms and conditions either of + that specified version or of any later version that has been + published (not as a draft) by the Free Software Foundation. If + the Document does not specify a version number of this License, + you may choose any version ever published (not as a draft) by the + Free Software Foundation. + + +ADDENDUM: How to use this License for your documents +==================================================== + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and license +notices just after the title page: + + Copyright (C) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 + or any later version published by the Free Software Foundation; + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. + A copy of the license is included in the section entitled "GNU + Free Documentation License." + + If you have no Invariant Sections, write "with no Invariant Sections" +instead of saying which ones are invariant. If you have no Front-Cover +Texts, write "no Front-Cover Texts" instead of "Front-Cover Texts being +LIST"; likewise for Back-Cover Texts. + + If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, to +permit their use in free software. + + +File: standards.info, Node: Index, Prev: Copying This Manual, Up: Top + +Index +***** + +* Menu: + +* #endif, commenting: Comments. +* --help option: Command-Line Interfaces. +* --version option: Command-Line Interfaces. +* -Wall compiler option: Syntactic Conventions. +* accepting contributions: Contributions. +* address for bug reports: Command-Line Interfaces. +* ANSI C standard: Standard C. +* arbitrary limits on data: Semantics. +* autoconf: System Portability. +* avoiding proprietary code: Reading Non-Free Code. +* behavior, dependent on program's name: User Interfaces. +* binary packages: Install Command Categories. +* bindir: Directory Variables. +* braces, in C source: Formatting. +* bug reports: Command-Line Interfaces. +* canonical name of a program: Command-Line Interfaces. +* casting pointers to integers: CPU Portability. +* change logs: Change Logs. +* change logs, conditional changes: Conditional Changes. +* change logs, style: Style of Change Logs. +* command-line arguments, decoding: Semantics. +* command-line interface: Command-Line Interfaces. +* commenting: Comments. +* compatibility with C and POSIX standards: Compatibility. +* compiler warnings: Syntactic Conventions. +* conditional changes, and change logs: Conditional Changes. +* conditionals, comments for: Comments. +* configure: Configuration. +* control-L: Formatting. +* conventions for makefiles: Makefile Conventions. +* corba: Graphical Interfaces. +* credits for manuals: Manual Credits. +* data types, and portability: CPU Portability. +* declaration for system functions: System Functions. +* documentation: Documentation. +* doschk: Names. +* downloading this manual: Preface. +* error messages: Semantics. +* error messages, formatting: Errors. +* exec_prefix: Directory Variables. +* expressions, splitting: Formatting. +* file usage: File Usage. +* file-name limitations: Names. +* formatting error messages: Errors. +* formatting source code: Formatting. +* formfeed: Formatting. +* function argument, declaring: Syntactic Conventions. +* function prototypes: Standard C. +* getopt: Command-Line Interfaces. +* gettext: Internationalization. +* gnome: Graphical Interfaces. +* graphical user interface: Graphical Interfaces. +* gtk: Graphical Interfaces. +* GUILE: Source Language. +* implicit int: Syntactic Conventions. +* impossible conditions: Semantics. +* internationalization: Internationalization. +* legal aspects: Legal Issues. +* legal papers: Contributions. +* libexecdir: Directory Variables. +* libraries: Libraries. +* library functions, and portability: System Functions. +* license for manuals: License for Manuals. +* lint: Syntactic Conventions. +* long option names: Option Table. +* long-named options: Command-Line Interfaces. +* makefile, conventions for: Makefile Conventions. +* malloc return value: Semantics. +* man pages: Man Pages. +* manual structure: Manual Structure Details. +* memory allocation failure: Semantics. +* memory usage: Memory Usage. +* message text, and internationalization: Internationalization. +* mmap: Mmap. +* multiple variables in a line: Syntactic Conventions. +* names of variables, functions, and files: Names. +* NEWS file: NEWS File. +* non-POSIX systems, and portability: System Portability. +* non-standard extensions: Using Extensions. +* NUL characters: Semantics. +* open brace: Formatting. +* optional features, configure-time: Configuration. +* options for compatibility: Compatibility. +* output device and program's behavior: User Interfaces. +* packaging: Releases. +* portability, and data types: CPU Portability. +* portability, and library functions: System Functions. +* portability, between system types: System Portability. +* POSIX compatibility: Compatibility. +* POSIXLY_CORRECT, environment variable: Compatibility. +* post-installation commands: Install Command Categories. +* pre-installation commands: Install Command Categories. +* prefix: Directory Variables. +* program configuration: Configuration. +* program design: Design Advice. +* program name and its behavior: User Interfaces. +* program's canonical name: Command-Line Interfaces. +* programming languges: Source Language. +* proprietary programs: Reading Non-Free Code. +* README file: Releases. +* references to non-free material: References. +* releasing: Managing Releases. +* sbindir: Directory Variables. +* signal handling: Semantics. +* spaces before open-paren: Formatting. +* standard command-line options: Command-Line Interfaces. +* standards for makefiles: Makefile Conventions. +* string library functions: System Functions. +* syntactic conventions: Syntactic Conventions. +* table of long options: Option Table. +* temporary files: Semantics. +* temporary variables: Syntactic Conventions. +* texinfo.tex, in a distribution: Releases. +* TMPDIR environment variable: Semantics. +* trademarks: Trademarks. +* where to obtain standards.texi: Preface. + + + +Tag Table: +Node: Top689 +Node: Preface1389 +Node: Legal Issues3605 +Node: Reading Non-Free Code4065 +Node: Contributions5785 +Node: Trademarks7931 +Node: Design Advice8986 +Node: Source Language9566 +Node: Compatibility11570 +Node: Using Extensions13190 +Node: Standard C14758 +Node: Conditional Compilation17153 +Node: Program Behavior18444 +Node: Semantics19359 +Node: Libraries24044 +Node: Errors25281 +Node: User Interfaces27054 +Node: Graphical Interfaces28651 +Node: Command-Line Interfaces29678 +Node: Option Table35741 +Node: Memory Usage50742 +Node: File Usage51759 +Node: Writing C52499 +Node: Formatting53345 +Node: Comments57400 +Node: Syntactic Conventions60694 +Node: Names64098 +Node: System Portability66299 +Node: CPU Portability68676 +Node: System Functions71924 +Node: Internationalization77123 +Node: Mmap80268 +Node: Documentation80970 +Node: GNU Manuals82071 +Node: Doc Strings and Manuals87120 +Node: Manual Structure Details88665 +Node: License for Manuals90075 +Node: Manual Credits91041 +Node: Printed Manuals91426 +Node: NEWS File92104 +Node: Change Logs92774 +Node: Change Log Concepts93520 +Node: Style of Change Logs95372 +Node: Simple Changes97415 +Node: Conditional Changes98647 +Node: Indicating the Part Changed100057 +Node: Man Pages100572 +Node: Reading other Manuals102188 +Node: Managing Releases102969 +Node: Configuration103728 +Node: Makefile Conventions110625 +Node: Makefile Basics111423 +Node: Utilities in Makefiles114585 +Node: Command Variables116718 +Node: Directory Variables120283 +Node: Standard Targets131165 +Ref: Standard Targets-Footnote-1142413 +Node: Install Command Categories142513 +Node: Releases147083 +Node: References151163 +Node: Copying This Manual153444 +Node: GNU Free Documentation License153658 +Node: Index173341 + +End Tag Table diff --git a/etc/texi2pod.pl b/etc/texi2pod.pl new file mode 100644 index 0000000000000..bdc20e8118f3b --- /dev/null +++ b/etc/texi2pod.pl @@ -0,0 +1,427 @@ +#! /usr/bin/perl -w + +# Copyright (C) 1999, 2000, 2001, 200 Free Software Foundation, Inc. + +# This file is part of GNU CC. + +# GNU CC is free software; 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. + +# GNU CC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GNU CC; see the file COPYING. If not, write to +# the Free Software Foundation, 59 Temple Place - Suite 330, +# Boston MA 02111-1307, USA. + +# This does trivial (and I mean _trivial_) conversion of Texinfo +# markup to Perl POD format. It's intended to be used to extract +# something suitable for a manpage from a Texinfo document. + +$output = 0; +$skipping = 0; +%sects = (); +$section = ""; +@icstack = (); +@endwstack = (); +@skstack = (); +@instack = (); +$shift = ""; +%defs = (); +$fnno = 1; +$inf = ""; +$ibase = ""; + +while ($_ = shift) { + if (/^-D(.*)$/) { + if ($1 ne "") { + $flag = $1; + } else { + $flag = shift; + } + $value = ""; + ($flag, $value) = ($flag =~ /^([^=]+)(?:=(.+))?/); + die "no flag specified for -D\n" + unless $flag ne ""; + die "flags may only contain letters, digits, hyphens, dashes and underscores\n" + unless $flag =~ /^[a-zA-Z0-9_-]+$/; + $defs{$flag} = $value; + } elsif (/^-/) { + usage(); + } else { + $in = $_, next unless defined $in; + $out = $_, next unless defined $out; + usage(); + } +} + +if (defined $in) { + $inf = gensym(); + open($inf, "<$in") or die "opening \"$in\": $!\n"; + $ibase = $1 if $in =~ m|^(.+)/[^/]+$|; +} else { + $inf = \*STDIN; +} + +if (defined $out) { + open(STDOUT, ">$out") or die "opening \"$out\": $!\n"; +} + +while(defined $inf) { +while(<$inf>) { + # Certain commands are discarded without further processing. + /^\@(?: + [a-z]+index # @*index: useful only in complete manual + |need # @need: useful only in printed manual + |(?:end\s+)?group # @group .. @end group: ditto + |page # @page: ditto + |node # @node: useful only in .info file + |(?:end\s+)?ifnottex # @ifnottex .. @end ifnottex: use contents + )\b/x and next; + + chomp; + + # Look for filename and title markers. + /^\@setfilename\s+([^.]+)/ and $fn = $1, next; + /^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next; + + # Identify a man title but keep only the one we are interested in. + /^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do { + if (exists $defs{$1}) { + $fn = $1; + $tl = postprocess($2); + } + next; + }; + + # Look for blocks surrounded by @c man begin SECTION ... @c man end. + # This really oughta be @ifman ... @end ifman and the like, but such + # would require rev'ing all other Texinfo translators. + /^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do { + $output = 1 if exists $defs{$2}; + $sect = $1; + next; + }; + /^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next; + /^\@c\s+man\s+end/ and do { + $sects{$sect} = "" unless exists $sects{$sect}; + $sects{$sect} .= postprocess($section); + $section = ""; + $output = 0; + next; + }; + + # handle variables + /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do { + $defs{$1} = $2; + next; + }; + /^\@clear\s+([a-zA-Z0-9_-]+)/ and do { + delete $defs{$1}; + next; + }; + + next unless $output; + + # Discard comments. (Can't do it above, because then we'd never see + # @c man lines.) + /^\@c\b/ and next; + + # End-block handler goes up here because it needs to operate even + # if we are skipping. + /^\@end\s+([a-z]+)/ and do { + # Ignore @end foo, where foo is not an operation which may + # cause us to skip, if we are presently skipping. + my $ended = $1; + next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex)$/; + + die "\@end $ended without \@$ended at line $.\n" unless defined $endw; + die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw; + + $endw = pop @endwstack; + + if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) { + $skipping = pop @skstack; + next; + } elsif ($ended =~ /^(?:example|smallexample|display)$/) { + $shift = ""; + $_ = ""; # need a paragraph break + } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) { + $_ = "\n=back\n"; + $ic = pop @icstack; + } else { + die "unknown command \@end $ended at line $.\n"; + } + }; + + # We must handle commands which can cause skipping even while we + # are skipping, otherwise we will not process nested conditionals + # correctly. + /^\@ifset\s+([a-zA-Z0-9_-]+)/ and do { + push @endwstack, $endw; + push @skstack, $skipping; + $endw = "ifset"; + $skipping = 1 unless exists $defs{$1}; + next; + }; + + /^\@ifclear\s+([a-zA-Z0-9_-]+)/ and do { + push @endwstack, $endw; + push @skstack, $skipping; + $endw = "ifclear"; + $skipping = 1 if exists $defs{$1}; + next; + }; + + /^\@(ignore|menu|iftex)\b/ and do { + push @endwstack, $endw; + push @skstack, $skipping; + $endw = $1; + $skipping = 1; + next; + }; + + next if $skipping; + + # Character entities. First the ones that can be replaced by raw text + # or discarded outright: + s/\@copyright\{\}/(c)/g; + s/\@dots\{\}/.../g; + s/\@enddots\{\}/..../g; + s/\@([.!? ])/$1/g; + s/\@[:-]//g; + s/\@bullet(?:\{\})?/*/g; + s/\@TeX\{\}/TeX/g; + s/\@pounds\{\}/\#/g; + s/\@minus(?:\{\})?/-/g; + s/\\,/,/g; + + # Now the ones that have to be replaced by special escapes + # (which will be turned back into text by unmunge()) + s/&/&/g; + s/\@\{/{/g; + s/\@\}/}/g; + s/\@\@/&at;/g; + + # Inside a verbatim block, handle @var specially. + if ($shift ne "") { + s/\@var\{([^\}]*)\}/<$1>/g; + } + + # POD doesn't interpret E<> inside a verbatim block. + if ($shift eq "") { + s//>/g; + } else { + s//>/g; + } + + # Single line command handlers. + + /^\@include\s+(.+)$/ and do { + push @instack, $inf; + $inf = gensym(); + + # Try cwd and $ibase. + open($inf, "<" . $1) + or open($inf, "<" . $ibase . "/" . $1) + or die "cannot open $1 or $ibase/$1: $!\n"; + next; + }; + + /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/ + and $_ = "\n=head2 $1\n"; + /^\@subsection\s+(.+)$/ + and $_ = "\n=head3 $1\n"; + + # Block command handlers: + /^\@itemize\s+(\@[a-z]+|\*|-)/ and do { + push @endwstack, $endw; + push @icstack, $ic; + $ic = $1; + $_ = "\n=over 4\n"; + $endw = "itemize"; + }; + + /^\@enumerate(?:\s+([a-zA-Z0-9]+))?/ and do { + push @endwstack, $endw; + push @icstack, $ic; + if (defined $1) { + $ic = $1 . "."; + } else { + $ic = "1."; + } + $_ = "\n=over 4\n"; + $endw = "enumerate"; + }; + + /^\@([fv]?table)\s+(\@[a-z]+)/ and do { + push @endwstack, $endw; + push @icstack, $ic; + $endw = $1; + $ic = $2; + $ic =~ s/\@(?:samp|strong|key|gcctabopt|env)/B/; + $ic =~ s/\@(?:code|kbd)/C/; + $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; + $ic =~ s/\@(?:file)/F/; + $_ = "\n=over 4\n"; + }; + + /^\@((?:small)?example|display)/ and do { + push @endwstack, $endw; + $endw = $1; + $shift = "\t"; + $_ = ""; # need a paragraph break + }; + + /^\@itemx?\s*(.+)?$/ and do { + if (defined $1) { + # Entity escapes prevent munging by the <> processing below. + $_ = "\n=item $ic\<$1\>\n"; + } else { + $_ = "\n=item $ic\n"; + $ic =~ y/A-Ya-y/B-Zb-z/; + $ic =~ s/(\d+)/$1 + 1/eg; + } + }; + + $section .= $shift.$_."\n"; +} +# End of current file. +close($inf); +$inf = pop @instack; +} + +die "No filename or title\n" unless defined $fn && defined $tl; + +$sects{NAME} = "$fn \- $tl\n"; +$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES}; + +for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT FILES + BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) { + if(exists $sects{$sect}) { + $head = $sect; + $head =~ s/SEEALSO/SEE ALSO/; + print "=head1 $head\n\n"; + print scalar unmunge ($sects{$sect}); + print "\n"; + } +} + +sub usage +{ + die "usage: $0 [-D toggle...] [infile [outfile]]\n"; +} + +sub postprocess +{ + local $_ = $_[0]; + + # @value{foo} is replaced by whatever 'foo' is defined as. + while (m/(\@value\{([a-zA-Z0-9_-]+)\})/g) { + if (! exists $defs{$2}) { + print STDERR "Option $2 not defined\n"; + s/\Q$1\E//; + } else { + $value = $defs{$2}; + s/\Q$1\E/$value/; + } + } + + # Formatting commands. + # Temporary escape for @r. + s/\@r\{([^\}]*)\}/R<$1>/g; + s/\@(?:dfn|var|emph|cite|i)\{([^\}]*)\}/I<$1>/g; + s/\@(?:code|kbd)\{([^\}]*)\}/C<$1>/g; + s/\@(?:gccoptlist|samp|strong|key|option|env|command|b)\{([^\}]*)\}/B<$1>/g; + s/\@sc\{([^\}]*)\}/\U$1/g; + s/\@file\{([^\}]*)\}/F<$1>/g; + s/\@w\{([^\}]*)\}/S<$1>/g; + s/\@(?:dmn|math)\{([^\}]*)\}/$1/g; + + # Cross references are thrown away, as are @noindent and @refill. + # (@noindent is impossible in .pod, and @refill is unnecessary.) + # @* is also impossible in .pod; we discard it and any newline that + # follows it. Similarly, our macro @gol must be discarded. + + s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g; + s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g; + s/;\s+\@pxref\{(?:[^\}]*)\}//g; + s/\@noindent\s*//g; + s/\@refill//g; + s/\@gol//g; + s/\@\*\s*\n?//g; + + # @uref can take one, two, or three arguments, with different + # semantics each time. @url and @email are just like @uref with + # one argument, for our purposes. + s/\@(?:uref|url|email)\{([^\},]*)\}/<B<$1>>/g; + s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g; + s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g; + + # Turn B blah> into B I B to + # match Texinfo semantics of @emph inside @samp. Also handle @r + # inside bold. + s/<//g; + 1 while s/B<((?:[^<>]|I<[^<>]*>)*)R<([^>]*)>/B<$1>${2}B]*)I<([^>]+)>/B<$1>I<$2>B]*)B<([^>]+)>/I<$1>B<$2>I//g; + s/([BI])<(\s+)([^>]+)>/$2$1<$3>/g; + s/([BI])<([^>]+?)(\s+)>/$1<$2>$3/g; + + # Extract footnotes. This has to be done after all other + # processing because otherwise the regexp will choke on formatting + # inside @footnote. + while (/\@footnote/g) { + s/\@footnote\{([^\}]+)\}/[$fnno]/; + add_footnote($1, $fnno); + $fnno++; + } + + return $_; +} + +sub unmunge +{ + # Replace escaped symbols with their equivalents. + local $_ = $_[0]; + + s/</E/g; + s/>/E/g; + s/{/\{/g; + s/}/\}/g; + s/&at;/\@/g; + s/&/&/g; + return $_; +} + +sub add_footnote +{ + unless (exists $sects{FOOTNOTES}) { + $sects{FOOTNOTES} = "\n=over 4\n\n"; + } + + $sects{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++; + $sects{FOOTNOTES} .= $_[0]; + $sects{FOOTNOTES} .= "\n\n"; +} + +# stolen from Symbol.pm +{ + my $genseq = 0; + sub gensym + { + my $name = "GEN" . $genseq++; + my $ref = \*{$name}; + delete $::{$name}; + return $ref; + } +} diff --git a/gas/COPYING b/gas/COPYING new file mode 100644 index 0000000000000..c27986e64cdef --- /dev/null +++ b/gas/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright 1989, 1991, 1997 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. + + + Copyright (C) 19yy + + This program is free software; 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. + + , 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/gas/README-vms b/gas/README-vms new file mode 100644 index 0000000000000..f3ee10e5e1d23 --- /dev/null +++ b/gas/README-vms @@ -0,0 +1,248 @@ + This document explains a couple of things that are specific to VMS. +There are currently two "chapters", the first deals with cross-assembly +issues, and the second deals with the VMS debugger and GNU-CC. + + +*********************************************************************** +****************** Notes for Cross Assembly with VMS ****************** +*********************************************************************** + + If you wish to build gas on a non-VMS system to cross-assemble, +you should use: + +configure ${hosttype} -target=vms + +and then follow the usual procedure. The object files generated on +Unix will be correct from a binary point of view, but the real trick is +getting them to the VMS machine. The format of the object file is +a variable-length record, but each record contains binary data. gas +writes the records in the same format that VMS would expect, +namely a two-byte count followed by that number of bytes. + + If you try to copy the file to a VMS system using ftp, the ftp +protocol will screw up the file by looking for nulls (record terminator for +unix) and it will insert it's own record terminators at that point. This +will obviously corrupt the file. + + If you try to transfer the file with ftp in binary mode, the +file itself will not be corrupt, but VMS will think that the file contains +fixed-length records of 512 bytes. You can use the public-domain FILE +utility to change this with a command like: + +$FILE foo.o/type=variable + +If you do not have this utility available, the following program can be +used to perform this task: + + #include + + #define RME$C_SETRFM 1 + + struct FAB * fab; + + main(int argc, char * argv[]){ + int i, status; + fab = (struct FAB*) malloc(sizeof(struct FAB)); + *fab = cc$rms_fab; /* initialize FAB*/ + fab->fab$b_fac = FAB$M_PUT; + fab->fab$l_fop |= FAB$M_ESC; + fab->fab$l_ctx = RME$C_SETRFM; + fab->fab$w_ifi = 0; + for(i=1;ifab$l_fna = argv[i]; + fab->fab$b_fns = strlen(argv[i]); + status = sys$open(fab,0,0); + if((status & 7) != 1) lib$signal(status); + fab->fab$b_rfm = FAB$C_VAR; + status = sys$modify(fab,0,0); + if((status & 7) != 1) lib$signal(status); + status = sys$close(fab,0,0); + if((status & 7) != 1) lib$signal(status); + }; + } + + If you have NFS running on the VMS system, what you need to do +depends upon which NFS software you are running on the VMS system. There +are a number of different TCP/IP packages for VMS available, and only very +limited testing has been performed. In the tests that has been done so +far, the contents of the file will always be correct when transferring the +file via NFS, but the record attributes may or may not be correct. + + One proprietary TCP/IP/NFS package for VMS is known to +automatically fix the record attributes of the object file if you NFS mount +a unix disk from the VMS system, and if the file has a ".obj" extension on +the unix system. Other TCP/IP packages might do this for you as well, but +they have not been checked. + +No matter what method you use to get the file to the VMS system, it is +always a good idea to check to make sure that it is the correct type by +doing a "$dir/full" on the object file. The desired record attributes will +be "None". Undesirable record attributes will be "Stream-LF" or anything +else. + +Once you get the files on the VMS system, you can check their integrity +with the "$anal/obj" command. (Naturally at some point you should rename +the .o files to .obj). As far as the debugger is concerned, the records +will be correct, but the debugger will not be able to find the source files, +since it only has the file name, and not the full directory specification. +You must give the debugger some help by telling it which directories to +search for the individual files - once you have done this you should be +able to proceed normally. + + It is a good idea to use names for your files which will be valid +under VMS, since otherwise you will have no way of getting the debugger to +find the source file when deugging. + +The reason for this is that the object file normally contins specific +information that the debugger can use to positively identify a file, and if +you are assembling on a unix system this information simply does not exist +in a meaningful way. You must help the debugger by using the "SET FILE=" +command to tell the debugger where to look for source files. The debugger +records will be correct, except that the debugger will not be initially +able to find the source files. You can use the "SET FILE" command to tell +the debugger where to look for the source files. + +I have only tested this with a SVr4 i486 machine, and everything seems to +work OK, with the limited testing that I have done. Other machines may +or may not work. You should read the chapters on cross-compilers in the gcc +manual before fooling with this. Since gas does not need to do any floating +point arithmetic, the floating point constants that are generated here should +be correct - the only concern is with constant folding in the main compiler. +The range and precision of floats and doubles are similar on the 486 (with +a builtin 80387) and the VAX, although there is a factor of 2 to 4 +difference in the range. The double, as implemented on the 486, is quite +similar to the G_FLOAT on the VAX. + +*********************************************************************** +****************** Notes for using GNU CC with the VMS debugger******** +*********************************************************************** + + + 1) You should be aware that GNU-C, as with any other decent compiler, +will do things when optimization is turned on that you may not expect. +Sometimes intermediate results are not written to variables, if they are only +used in one place, and sometimes variables that are not used at all will not be +written to the symbol table. Also, parameters to inline functions are often +inaccessible. You can see the assembly code equivalent by using KP7 in the +debugger, and from this you can tell if in fact a variable should have the +value that you expect. You can find out if a variable lives withing a register +by doing a 'show symbol/addr'. + + 2) Overly complex data types, such as: + +int (*(*(*(*(*(* sarr6)[1])[1])[2])[3])[4])[5]; + +will not be debugged properly, since the debugging record overflows an internal +debugger buffer. gcc-as will convert these to *void as far as the debugger +symbol table is concerned, which will avoid any problems, and the assembler +will give you a message informing you that this has happened. + + 3) You must, of course, compile and link with /debug. If you link +without debug, you still get traceback table in the executable, but there is no +symbol table for variables. + + 4) Included in the patches to VMS.C are fixes to two bugs that are +unrelated to the changes that I have made. One of these made it impossible to +debug small programs sometimes, and the other caused the debugger to become +confused about which routine it was in, and give this incorrect info in +tracebacks. + + 5) If you are using the GNU-C++ compiler, you should modify the +compiler driver file GNU_CC:[000000]GCC.COM (or GXX.COM). If you have a +separate GXX.COM, then you need to change one line in GXX.COM to: +$ if f$locate("D",p2) .ne. P2_Length then Debug = " ""-G0""" + Notice zero---> ^ +If you are using a GCC.COM that does both C and C++, add the following lines to +GCC.COM: + +$! +$! Use old style debugging records for VMS +$! +$ if (Debug.nes."" ).and. Plus then Debug = " ""-G0""" + +after the variables Plus and Debug are set. The reason for this, is that C++ +compiler by default generates debugging records that are more complex, +with many new syntactical elements that allow for the new features of the +language. The -G0 switch tells the C++ compiler to use the old style debugging +records. Until the debugger understands C++ there is not any point to try and +use the expanded syntax. + + 6) When you have nested scopes, i.e.: +main(){ + int i; + {int i; + {int i; +};};} +and you say "EXAM i" the debugger needs to figure out which variable you +actually want to reference. I have arranged things to define a block to the +debugger when you use brackets to enter a new scope, so in the example above, +the variables would be described as: +TEST\main\i +TEST\main\$0\i +TEST\main\$0\$0\i +At each level, the block name is a number with a dollar sign prefix, the +numbers start with 0 and count upward. When you say EXAM i, the debugger looks +at the current PC, and decides which block it is currently in. It works from +the innermost level outward until it finds a block that has the variable "i" +defined. You can always specify the scope explicitly. + + 7) With C++, there can be a lot of inline functions, and it would be +rather restrictive to force the user to debug the program by converting all of +the inline functions to normal functions. What I have done is to essentially +"add" (with the debugger) source lines from the include files that contain the +inline functions. Thus when you step into an inline function it appears as if +you have called the function, and you can examine variables and so forth. +There are several *very* important differences, however. First of all, since +there is no function call involved, you cannot step over the inline function +call - you always step into it. Secondly, since the same source lines are used +in many locations, there is a separate copy of the source for *each* usage. +Without this, breakpoints do not work, since we must have a 1-to-1 mapping +between source lines and PC. + Since you cannot step over inline function calls, it can be a real pain +if you are not really interested in what is going on for that function call. +What I have done is to use the "-D" switch for the assembler to toggle the +following behavior. With the "-D" switch, all inline functions are included in +the object file, and you can debug everything. Without the "-D" switch +(default case with VMS implementation), inline functions are included *only* if +they did not come from system header files (i.e. from GNU_CC_INCLUDE: or +GNU_GXX_INCLUDE:). Thus, without the switch the user only debugs his/her own +inline functions, and not the system ones. (This is especially useful if you do +a lot of stream I/O in C++). This probably will not provide enough granularity +for many users, but for now this is still somewhat experimental, and I would +like to reflect upon it and get some feedback before I go any further. +Possible solutions include an interactive prompting, a logical name, or a new +command line option in gcc.c (which is then passed through somehow to the guts +of the assembler). + The inline functions from header files appear after the source code +for the source file. This has the advantage that the source file itself is +numbered with the same line numbers that you get with an editor. In addition, +the entire header file is not included, since the assembler makes a list of +the min and max source lines that are used, and only includes those lines from +the first to the last actually used. (It is easy to change it to include the +whole file). + + 8) When you are debugging C++ objects, the object "this" is refered to +as "$this". Actually, the compiler writes it as ".this", but the period is +not good for the debugger, so I have a routine to convert it to a $. (It +actually converts all periods to $, but only for variables, since this was +intended to allow us to access "this". + + 9) If you use the asm("...") keyword for global symbols, you will not +be able to see that symbol with the debugger. The reason is that there are two +records for the symbol stored in the data structures of the assembler. One +contains the info such as psect number and offset, and the other one contains +the information having to do with the data type of the variable. In order to +debug as symbol, you need to be able to coorelate these records, and the only +way to do this is by name. The record with the storage attributes will take +the name used in the asm directive, and the record that specifies the data type +has the actual variable name, and thus when you use the asm directive to change +a variable name, the symbol becomes invisible. + + 10) Older versions of the compiler ( GNU-C 1.37.92 and earlier) place +global constants in the text psect. This is unfortunate, since to the linker +this appears to be an entry point. I sent a patch to the compiler to RMS, +which will generate a .const section for these variables, and patched the +assembler to put these variables into a psect just like that for normal +variables, except that they are marked NOWRT. static constants are still +placed in the text psect, since there is no need for any external access. diff --git a/gas/acconfig.h b/gas/acconfig.h deleted file mode 100644 index c9c60025c7574..0000000000000 --- a/gas/acconfig.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Name of package. */ -#undef PACKAGE - -/* Version of package. */ -#undef VERSION - -/* Should gas use high-level BFD interfaces? */ -#undef BFD_ASSEMBLER - -/* Some assert/preprocessor combinations are incapable of handling - certain kinds of constructs in the argument of assert. For example, - quoted strings (if requoting isn't done right) or newlines. */ -#undef BROKEN_ASSERT - -/* If we aren't doing cross-assembling, some operations can be optimized, - since byte orders and value sizes don't need to be adjusted. */ -#undef CROSS_COMPILE - -/* Some gas code wants to know these parameters. */ -#undef TARGET_ALIAS -#undef TARGET_CPU -#undef TARGET_CANONICAL -#undef TARGET_OS -#undef TARGET_VENDOR - -/* Sometimes the system header files don't declare strstr. */ -#undef NEED_DECLARATION_STRSTR - -/* Sometimes the system header files don't declare malloc and realloc. */ -#undef NEED_DECLARATION_MALLOC - -/* Sometimes the system header files don't declare free. */ -#undef NEED_DECLARATION_FREE - -/* Sometimes the system header files don't declare sbrk. */ -#undef NEED_DECLARATION_SBRK - -/* Sometimes errno.h doesn't declare errno itself. */ -#undef NEED_DECLARATION_ERRNO - -#undef MANY_SEGMENTS - -/* The configure script defines this for some targets based on the - target name used. It is not always defined. */ -#undef TARGET_BYTES_BIG_ENDIAN - -/* Needed only for some configurations that can produce multiple output - formats. */ -#undef DEFAULT_EMULATION -#undef EMULATIONS -#undef USE_EMULATIONS -#undef OBJ_MAYBE_AOUT -#undef OBJ_MAYBE_BOUT -#undef OBJ_MAYBE_COFF -#undef OBJ_MAYBE_ECOFF -#undef OBJ_MAYBE_ELF -#undef OBJ_MAYBE_GENERIC -#undef OBJ_MAYBE_HP300 -#undef OBJ_MAYBE_IEEE -#undef OBJ_MAYBE_SOM -#undef OBJ_MAYBE_VMS - -/* Used for some of the COFF configurations, when the COFF code needs - to select something based on the CPU type before it knows it... */ -#undef I386COFF -#undef M68KCOFF -#undef M88KCOFF - -/* Using cgen code? */ -#undef USING_CGEN - -/* Needed only for sparc configuration. */ -#undef DEFAULT_ARCH - -/* Needed only for PowerPC Solaris. */ -#undef TARGET_SOLARIS_COMMENT - -/* Needed only for SCO 5. */ -#undef SCO_ELF diff --git a/gas/as.h b/gas/as.h index 5e30f478313e1..890ecd8f1056f 100644 --- a/gas/as.h +++ b/gas/as.h @@ -1,6 +1,6 @@ /* as.h - global header file Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005 + 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -397,22 +397,6 @@ typedef unsigned int relax_substateT; /* Enough bits for address, but still an integer type. Could be a problem, cross-assembling for 64-bit machines. */ typedef addressT relax_addressT; - -struct relax_type -{ - /* Forward reach. Signed number. > 0. */ - offsetT rlx_forward; - /* Backward reach. Signed number. < 0. */ - offsetT rlx_backward; - - /* Bytes length of this address. */ - unsigned char rlx_length; - - /* Next longer relax-state. 0 means there is no 'next' relax-state. */ - relax_substateT rlx_more; -}; - -typedef struct relax_type relax_typeS; /* main program "as.c" (command arguments etc) */ diff --git a/gas/conf.in b/gas/conf.in deleted file mode 100644 index d56807cd88d59..0000000000000 --- a/gas/conf.in +++ /dev/null @@ -1,127 +0,0 @@ -/* conf.in. Generated automatically from configure.in by autoheader. */ - -/* Define if using alloca.c. */ -#undef C_ALLOCA - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -#undef CRAY_STACKSEG_END - -/* Define if you have alloca, as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define if you have and it should be used (not on Ultrix). */ -#undef HAVE_ALLOCA_H - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#undef STACK_DIRECTION - -/* Should gas use high-level BFD interfaces? */ -#undef BFD_ASSEMBLER - -/* Some assert/preprocessor combinations are incapable of handling - certain kinds of constructs in the argument of assert. For example, - quoted strings (if requoting isn't done right) or newlines. */ -#undef BROKEN_ASSERT - -/* If we aren't doing cross-assembling, some operations can be optimized, - since byte orders and value sizes don't need to be adjusted. */ -#undef CROSS_COMPILE - -/* Some gas code wants to know these parameters. */ -#undef TARGET_ALIAS -#undef TARGET_CPU -#undef TARGET_CANONICAL -#undef TARGET_OS -#undef TARGET_VENDOR - -/* Sometimes the system header files don't declare strstr. */ -#undef NEED_DECLARATION_STRSTR - -/* Sometimes the system header files don't declare malloc and realloc. */ -#undef NEED_DECLARATION_MALLOC - -/* Sometimes the system header files don't declare free. */ -#undef NEED_DECLARATION_FREE - -/* Sometimes the system header files don't declare sbrk. */ -#undef NEED_DECLARATION_SBRK - -/* Sometimes errno.h doesn't declare errno itself. */ -#undef NEED_DECLARATION_ERRNO - -#undef MANY_SEGMENTS - -/* Needed only for sparc configuration. */ -#undef SPARC_V9 -#undef SPARC_ARCH64 - -/* Defined if using CGEN. */ -#undef USING_CGEN - -/* Needed only for some configurations that can produce multiple output - formats. */ -#undef DEFAULT_EMULATION -#undef EMULATIONS -#undef USE_EMULATIONS -#undef OBJ_MAYBE_AOUT -#undef OBJ_MAYBE_BOUT -#undef OBJ_MAYBE_COFF -#undef OBJ_MAYBE_ECOFF -#undef OBJ_MAYBE_ELF -#undef OBJ_MAYBE_GENERIC -#undef OBJ_MAYBE_HP300 -#undef OBJ_MAYBE_IEEE -#undef OBJ_MAYBE_SOM -#undef OBJ_MAYBE_VMS - -/* Used for some of the COFF configurations, when the COFF code needs - to select something based on the CPU type before it knows it... */ -#undef I386COFF -#undef M68KCOFF -#undef M88KCOFF - -/* Define if you have the remove function. */ -#undef HAVE_REMOVE - -/* Define if you have the sbrk function. */ -#undef HAVE_SBRK - -/* Define if you have the unlink function. */ -#undef HAVE_UNLINK - -/* Define if you have the header file. */ -#undef HAVE_ERRNO_H - -/* Define if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define if you have the header file. */ -#undef HAVE_STDARG_H - -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the header file. */ -#undef HAVE_VARARGS_H diff --git a/gas/config-gas.com b/gas/config-gas.com new file mode 100644 index 0000000000000..cf5248af5da95 --- /dev/null +++ b/gas/config-gas.com @@ -0,0 +1,186 @@ +$!config-gas.com +$! This file sets things up to build gas on a VMS system to generate object +$! files for a VMS system. We do not use the configure script, since we +$! do not have /bin/sh to execute it. +$! +$! +$ gas_host="vms" +$ arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2 +$ arch = f$element(arch_indx,"|","|VAX|Alpha|") +$ if arch.eqs."VAX" +$ then +$ cpu_type="vax" +$ obj_format="vms" +$ atof="vax" +$ else +$ cpu_type="alpha" +$ obj_format="evax" +$ atof="ieee" +$ endif +$ emulation="generic" +$! +$ DELETE = "delete/noConfirm" +$ ECHO = "write sys$output" +$! +$! Target specific information +$ call make "targ-cpu.h" "[.config]tc-''cpu_type'.h" +$ call make "targ-env.h" "[.config]te-''emulation'.h" +$! +$! Code to handle the object file format. +$ call make "obj-format.h" "[.config]obj-''obj_format'.h" +$! +$! (not currently used for vax or alpha) +$ call make "itbl-cpu.h" "[.config]itbl-''cpu_type'.h" +$! +$! +$! Create the file version.opt, which helps identify the executable. +$! +$if f$trnlnm("IFILE$").nes."" then close/noLog ifile$ +$search CONFIGURE.IN "AM_INIT_AUTOMAKE"/Exact/Output=config-gas-tmp.tmp +$open ifile$ config-gas-tmp.tmp +$read ifile$ line +$close ifile$ +$DELETE config-gas-tmp.tmp;* +$! Discard "AM_INIT_AUTOMAKE(gas, " and ")" parts. +$ijk=f$locate(",",line)+2 +$line=f$extract(ijk,f$length(line)-ijk,line) +$ijk=f$locate(")",line) +$line=f$extract(0,ijk,line) +$! +$ if f$search("version.opt").nes."" then DELETE version.opt;* +$copy _NL: version.opt +$open/Append ifile$ version.opt +$write ifile$ "identification="+""""+line+"""" +$close ifile$ +$! +$! Now write config.h. +$! +$ if f$search("config.h").nes."" then DELETE config.h;* +$copy _NL: config.h +$open/Append ifile$ config.h +$write ifile$ "/* config.h. Generated by config-gas.com. */ +$write ifile$ "#ifndef VERSION" +$write ifile$ "#define VERSION """,line,"""" +$write ifile$ "#endif" +$write ifile$ "/*--*/" +$if arch .eqs. "VAX" +$then +$append [.config]vms-conf.h ifile$: +$else +$ append [.config]vms-a-conf.h ifile$: +$endif +$close ifile$ +$ECHO "Created config.h." +$! +$! Check for, and possibly make, header file . +$! +$ if f$search("tmp-chk-h.*").nes."" then DELETE tmp-chk-h.*;* +$!can't use simple `#include HDR' with `gcc /Define="HDR="' +$!because the 2.6.[0-3] preprocessor handles it wrong (VMS-specific gcc bug) +$ create tmp-chk-h.c +int tmp_chk_h; /* guarantee non-empty output */ +#ifdef HAVE_STDIO_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_UNIXIO_H +#include +#endif +#ifdef HAVE_UNIXLIB_H +#include +#endif +$ on warning then continue +$ CHECK = "call tmp_chk_h" +$ CHECK "HAVE_STDIO_H" +$ if .not.$status +$ then type sys$input: + +? could not compile . + + If you're compiling with DEC C or VAX C, create config.status as an + empty file and start gnu make again. + + If you're compiling with GNU C, there is some setup problem and + gas configuration cannot proceed. + +$ DELETE tmp-chk-h.c;* +$ exit %x002C +$ endif +$! +$ CHECK "HAVE_UNISTD_H" +$ if .not.$status +$ then +$ if f$trnlnm("HFILE$").nes."" then close/noLog hfile$ +$ CHECK "HAVE_UNIXIO_H" +$ got_unixio = ($status .and. 1) +$ CHECK "HAVE_UNIXLIB_H" +$ got_unixlib = ($status .and. 1) +$ create []unistd.h !with rudimentary contents +/* substitute for building gas */ +#ifndef UNISTD_H +#define UNISTD_H + +$ open/Append hfile$ []unistd.h +$ if got_unixio +$ then write hfile$ "#include " +$ else append sys$input: hfile$: +/* some of the routines normally prototyped in */ +extern int creat(), open(), close(), read(), write(); +extern int access(), dup(), dup2(), fstat(), stat(); +extern long lseek(); +$ endif +$ write hfile$ "" +$ if got_unixlib +$ then write hfile$ "#include " +$ else append sys$input: hfile$: +/* some of the routines normally prototyped in */ +extern char *sbrk(), *getcwd(), *cuserid(); +extern int brk(), chdir(), chmod(), chown(), mkdir(); +extern unsigned getuid(), umask(); +$ endif +$ append sys$input: hfile$: + +#endif /*UNISTD_H*/ +$ close hfile$ +$ ECHO "Created ""[]unistd.h""." +$ endif !gcc '#include ' failed +$ DELETE tmp-chk-h.c;* +$ +$tmp_chk_h: subroutine +$ set noOn +$ hname = f$edit("<" + (p1 - "HAVE_" - "_H") + ".h>","LOWERCASE") +$ write sys$output "Checking for ''hname'." +$ if f$search("tmp-chk-h.obj").nes."" then DELETE tmp-chk-h.obj;* +$ define/noLog sys$error _NL: !can't use /User_Mode here due to gcc +$ define/noLog sys$output _NL: ! driver's use of multiple image activation +$ gcc /Include=([],[-.include]) /Define=("''p1'") tmp-chk-h.c +$!can't just check $status; gcc 2.6.[0-3] preprocessor doesn't set it correctly +$ ok = (($status.and.1).and.(f$search("tmp-chk-h.obj").nes."")) .or. %x10000000 +$ deassign sys$error !restore, more or less +$ deassign sys$output +$ if ok then DELETE tmp-chk-h.obj;* +$ exit ok +$ endsubroutine !tmp_chk_h +$ +$! +$! Done +$! +$ if f$search("config.status") .nes. "" then DELETE config.status;* +$ open/write cfile []config.status +$ write cfile "Links are now set up for use with a "+arch+" running VMS." +$ close cfile +$ type []config.status +$exit +$! +$! +$make: subroutine +$ if f$search(p1).nes."" then DELETE 'p1';* +$ create 'p1' +$ if f$trnlnm("IFILE$").nes."" then close/noLog ifile$ +$ open/Append ifile$ 'p1' +$ write ifile$ "#include ""''f$string(p2 - "[.config]")'""" +$ close ifile$ +$ ECHO "Created ''p1' for ''p2'." +$endsubroutine !make diff --git a/gas/config/atof-tahoe.c b/gas/config/atof-tahoe.c new file mode 100644 index 0000000000000..11bea10044199 --- /dev/null +++ b/gas/config/atof-tahoe.c @@ -0,0 +1,415 @@ +/* atof_tahoe.c - turn a string into a Tahoe floating point number + Copyright 1987, 1993, 2000 Free Software Foundation, Inc. + +/* This is really a simplified version of atof_vax.c. I glommed it wholesale + and then shaved it down. I don't even know how it works. (Don't you find + my honesty refreshing? Devon E Bowen + + I don't allow uppercase letters in the precision descriptors. + i.e. 'f' and 'd' are allowed but 'F' and 'D' aren't. */ + +#include "as.h" + +/* Precision in LittleNums. */ +#define MAX_PRECISION (4) +#define D_PRECISION (4) +#define F_PRECISION (2) + +/* Precision in chars. */ +#define D_PRECISION_CHARS (8) +#define F_PRECISION_CHARS (4) + +/* Length in LittleNums of guard bits. */ +#define GUARD (2) + +static const long int mask[] = +{ + 0x00000000, + 0x00000001, + 0x00000003, + 0x00000007, + 0x0000000f, + 0x0000001f, + 0x0000003f, + 0x0000007f, + 0x000000ff, + 0x000001ff, + 0x000003ff, + 0x000007ff, + 0x00000fff, + 0x00001fff, + 0x00003fff, + 0x00007fff, + 0x0000ffff, + 0x0001ffff, + 0x0003ffff, + 0x0007ffff, + 0x000fffff, + 0x001fffff, + 0x003fffff, + 0x007fffff, + 0x00ffffff, + 0x01ffffff, + 0x03ffffff, + 0x07ffffff, + 0x0fffffff, + 0x1fffffff, + 0x3fffffff, + 0x7fffffff, + 0xffffffff +}; + +/* Shared between flonum_gen2tahoe and next_bits. */ +static int bits_left_in_littlenum; +static LITTLENUM_TYPE *littlenum_pointer; +static LITTLENUM_TYPE *littlenum_end; + +#if __STDC__ == 1 + +int flonum_gen2tahoe (int format_letter, FLONUM_TYPE * f, + LITTLENUM_TYPE * words); + +#else /* not __STDC__ */ + +int flonum_gen2tahoe (); + +#endif /* not __STDC__ */ + +static int +next_bits (number_of_bits) + int number_of_bits; +{ + int return_value; + + if (littlenum_pointer < littlenum_end) + return 0; + if (number_of_bits >= bits_left_in_littlenum) + { + return_value = mask[bits_left_in_littlenum] & *littlenum_pointer; + number_of_bits -= bits_left_in_littlenum; + return_value <<= number_of_bits; + bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS - number_of_bits; + littlenum_pointer--; + if (littlenum_pointer >= littlenum_end) + return_value |= ((*littlenum_pointer) >> (bits_left_in_littlenum)) & + mask[number_of_bits]; + } + else + { + bits_left_in_littlenum -= number_of_bits; + return_value = mask[number_of_bits] & + ((*littlenum_pointer) >> bits_left_in_littlenum); + } + return return_value; +} + +static void +make_invalid_floating_point_number (words) + LITTLENUM_TYPE *words; +{ + /* Floating Reserved Operand Code. */ + *words = 0x8000; +} + +static int /* 0 means letter is OK. */ +what_kind_of_float (letter, precisionP, exponent_bitsP) + /* In: lowercase please. What kind of float? */ + char letter; + + /* Number of 16-bit words in the float. */ + int *precisionP; + + /* Number of exponent bits. */ + long int *exponent_bitsP; +{ + int retval; /* 0: OK. */ + + retval = 0; + switch (letter) + { + case 'f': + *precisionP = F_PRECISION; + *exponent_bitsP = 8; + break; + + case 'd': + *precisionP = D_PRECISION; + *exponent_bitsP = 8; + break; + + default: + retval = 69; + break; + } + return (retval); +} + +/* Warning: This returns 16-bit LITTLENUMs, because that is what the + VAX thinks in. It is up to the caller to figure out any alignment + problems and to conspire for the bytes/word to be emitted in the + right order. Bigendians beware! */ + +char * /* Return pointer past text consumed. */ +atof_tahoe (str, what_kind, words) + char *str; /* Text to convert to binary. */ + char what_kind; /* 'd', 'f', 'g', 'h' */ + LITTLENUM_TYPE *words; /* Build the binary here. */ +{ + FLONUM_TYPE f; + LITTLENUM_TYPE bits[MAX_PRECISION + MAX_PRECISION + GUARD]; + /* Extra bits for zeroed low-order bits. */ + /* The 1st MAX_PRECISION are zeroed, the last contain flonum bits. */ + char *return_value; + int precision; /* Number of 16-bit words in the format. */ + long int exponent_bits; + + return_value = str; + f.low = bits + MAX_PRECISION; + f.high = NULL; + f.leader = NULL; + f.exponent = NULL; + f.sign = '\0'; + + if (what_kind_of_float (what_kind, &precision, &exponent_bits)) + { + /* We lost. */ + return_value = NULL; + make_invalid_floating_point_number (words); + } + if (return_value) + { + memset (bits, '\0', sizeof (LITTLENUM_TYPE) * MAX_PRECISION); + + /* Use more LittleNums than seems necessary: + the highest flonum may have 15 leading 0 bits, so could be + useless. */ + f.high = f.low + precision - 1 + GUARD; + + if (atof_generic (&return_value, ".", "eE", &f)) + { + make_invalid_floating_point_number (words); + /* We lost. */ + return_value = NULL; + } + else + { + if (flonum_gen2tahoe (what_kind, &f, words)) + return_value = NULL; + } + } + return return_value; +} + +/* In: a flonum, a Tahoe floating point format. + Out: a Tahoe floating-point bit pattern. */ + +int /* 0: OK. */ +flonum_gen2tahoe (format_letter, f, words) + char format_letter; /* One of 'd' 'f'. */ + FLONUM_TYPE *f; + LITTLENUM_TYPE *words; /* Deliver answer here. */ +{ + LITTLENUM_TYPE *lp; + int precision; + long int exponent_bits; + int return_value; /* 0 == OK. */ + + return_value = + what_kind_of_float (format_letter, &precision, &exponent_bits); + if (return_value != 0) + { + make_invalid_floating_point_number (words); + } + else + { + if (f->low > f->leader) + { + /* 0.0e0 seen. */ + memset (words, '\0', sizeof (LITTLENUM_TYPE) * precision); + } + else + { + long int exponent_1; + long int exponent_2; + long int exponent_3; + long int exponent_4; + int exponent_skippage; + LITTLENUM_TYPE word1; + + /* JF: Deal with new Nan, +Inf and -Inf codes. */ + if (f->sign != '-' && f->sign != '+') + { + make_invalid_floating_point_number (words); + return return_value; + } + /* All tahoe floating_point formats have: + Bit 15 is sign bit. + Bits 14:n are excess-whatever exponent. + Bits n-1:0 (if any) are most significant bits of fraction. + Bits 15:0 of the next word are the next most significant bits. + And so on for each other word. + + So we need: number of bits of exponent, number of bits of + mantissa. */ + + bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS; + littlenum_pointer = f->leader; + littlenum_end = f->low; + + /* Seek (and forget) 1st significant bit. */ + for (exponent_skippage = 0; + !next_bits (1); + exponent_skippage++) + ; + + exponent_1 = f->exponent + f->leader + 1 - f->low; + + /* Radix LITTLENUM_RADIX, point just higher than f -> leader. */ + exponent_2 = exponent_1 * LITTLENUM_NUMBER_OF_BITS; + + /* Radix 2. */ + exponent_3 = exponent_2 - exponent_skippage; + + /* Forget leading zeros, forget 1st bit. */ + exponent_4 = exponent_3 + (1 << (exponent_bits - 1)); + + /* Offset exponent. */ + + if (exponent_4 & ~mask[exponent_bits]) + { + /* Exponent overflow. Lose immediately. */ + + make_invalid_floating_point_number (words); + + /* We leave return_value alone: admit we read the + number, but return a floating exception because we + can't encode the number. */ + } + else + { + lp = words; + + /* Word 1. Sign, exponent and perhaps high bits. */ + /* Assume 2's complement integers. */ + word1 = ((exponent_4 & mask[exponent_bits]) + << (15 - exponent_bits)) + | ((f->sign == '+') ? 0 : 0x8000) + | next_bits (15 - exponent_bits); + *lp++ = word1; + + /* The rest of the words are just mantissa bits. */ + for (; lp < words + precision; lp++) + *lp = next_bits (LITTLENUM_NUMBER_OF_BITS); + + if (next_bits (1)) + { + /* Since the NEXT bit is a 1, round UP the mantissa. + The cunning design of these hidden-1 floats permits + us to let the mantissa overflow into the exponent, and + it 'does the right thing'. However, we lose if the + highest-order bit of the lowest-order word flips. + Is that clear? */ + + unsigned long int carry; + + /* #if (sizeof(carry)) < ((sizeof(bits[0]) * + BITS_PER_CHAR) + 2) Please allow at least 1 more + bit in carry than is in a LITTLENUM. We need + that extra bit to hold a carry during a LITTLENUM + carry propagation. Another extra bit (kept 0) + will assure us that we don't get a sticky sign + bit after shifting right, and that permits us to + propagate the carry without any masking of bits. + #endif */ + for (carry = 1, lp--; + carry && (lp >= words); + lp--) + { + carry = *lp + carry; + *lp = carry; + carry >>= LITTLENUM_NUMBER_OF_BITS; + } + + if ((word1 ^ *words) + & (1 << (LITTLENUM_NUMBER_OF_BITS - 1))) + { + make_invalid_floating_point_number (words); + /* We leave return_value alone: admit we read + the number, but return a floating exception + because we can't encode the number. */ + } + } /* if (we needed to round up) */ + } /* if (exponent overflow) */ + } /* if (0.0e0) */ + } /* if (float_type was OK) */ + return return_value; +} + +/* In: input_line_pointer -> the 1st character of a floating-point + * number. + * 1 letter denoting the type of statement that wants a + * binary floating point number returned. + * Address of where to build floating point literal. + * Assumed to be 'big enough'. + * Address of where to return size of literal (in chars). + * + * Out: Input_line_pointer -> of next char after floating number. + * Error message, or 0. + * Floating point literal. + * Number of chars we used for the literal. */ + +char * +md_atof (what_statement_type, literalP, sizeP) + char what_statement_type; + char *literalP; + int *sizeP; +{ + LITTLENUM_TYPE words[MAX_PRECISION]; + register char kind_of_float; + register int number_of_chars; + register LITTLENUM_TYPE *littlenum_pointer; + + switch (what_statement_type) + { + case 'f': /* .ffloat */ + case 'd': /* .dfloat */ + kind_of_float = what_statement_type; + break; + + default: + kind_of_float = 0; + break; + } + + if (kind_of_float) + { + register LITTLENUM_TYPE *limit; + + input_line_pointer = atof_tahoe (input_line_pointer, + kind_of_float, + words); + /* The atof_tahoe() builds up 16-bit numbers. + Since the assembler may not be running on + a different-endian machine, be very careful about + converting words to chars. */ + number_of_chars = (kind_of_float == 'f' ? F_PRECISION_CHARS : + (kind_of_float == 'd' ? D_PRECISION_CHARS : 0)); + know (number_of_chars <= MAX_PRECISION * sizeof (LITTLENUM_TYPE)); + limit = words + (number_of_chars / sizeof (LITTLENUM_TYPE)); + for (littlenum_pointer = words; + littlenum_pointer < limit; + littlenum_pointer++) + { + md_number_to_chars (literalP, *littlenum_pointer, + sizeof (LITTLENUM_TYPE)); + literalP += sizeof (LITTLENUM_TYPE); + } + } + else + { + number_of_chars = 0; + } + + *sizeP = number_of_chars; + return kind_of_float ? 0 : _("Bad call to md_atof()"); +} diff --git a/gas/config/e-crisaout.c b/gas/config/e-crisaout.c new file mode 100644 index 0000000000000..4f2344957b775 --- /dev/null +++ b/gas/config/e-crisaout.c @@ -0,0 +1,19 @@ +#include "as.h" +#include "emul.h" + +static const char *crisaout_bfd_name PARAMS ((void)); + +static const char * +crisaout_bfd_name () +{ + abort (); + return NULL; +} + +#define emul_bfd_name crisaout_bfd_name +#define emul_format &aout_format_ops + +#define emul_name "crisaout" +#define emul_struct_name crisaout +#define emul_default_endian 0 +#include "emul-target.h" diff --git a/gas/config/e-criself.c b/gas/config/e-criself.c new file mode 100644 index 0000000000000..f0dc48e0e940d --- /dev/null +++ b/gas/config/e-criself.c @@ -0,0 +1,19 @@ +#include "as.h" +#include "emul.h" + +static const char *criself_bfd_name PARAMS ((void)); + +static const char * +criself_bfd_name () +{ + abort (); + return NULL; +} + +#define emul_bfd_name criself_bfd_name +#define emul_format &elf_format_ops + +#define emul_name "criself" +#define emul_struct_name criself +#define emul_default_endian 0 +#include "emul-target.h" diff --git a/gas/config/i386coff.mt b/gas/config/i386coff.mt deleted file mode 100644 index efda833651817..0000000000000 --- a/gas/config/i386coff.mt +++ /dev/null @@ -1 +0,0 @@ -TDEFINES=-DI386COFF diff --git a/gas/config/m68k-parse.h b/gas/config/m68k-parse.h new file mode 100644 index 0000000000000..c82e69fc65a0f --- /dev/null +++ b/gas/config/m68k-parse.h @@ -0,0 +1,334 @@ +/* m68k-parse.h -- header file for m68k assembler + Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, + 2003 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#ifndef M68K_PARSE_H +#define M68K_PARSE_H + +/* This header file defines things which are shared between the + operand parser in m68k.y and the m68k assembler proper in + tc-m68k.c. */ + +/* The various m68k registers. */ + +/* DATA and ADDR have to be contiguous, so that reg-DATA gives + 0-7==data reg, 8-15==addr reg for operands that take both types. + + We don't use forms like "ADDR0 = ADDR" here because this file is + likely to be used on an Apollo, and the broken Apollo compiler + gives an `undefined variable' error if we do that, according to + troy@cbme.unsw.edu.au. */ + +#define DATA DATA0 +#define ADDR ADDR0 +#define SP ADDR7 +#define BAD BAD0 +#define BAC BAC0 + +enum m68k_register +{ + DATA0 = 1, /* 1- 8 == data registers 0-7 */ + DATA1, + DATA2, + DATA3, + DATA4, + DATA5, + DATA6, + DATA7, + + ADDR0, + ADDR1, + ADDR2, + ADDR3, + ADDR4, + ADDR5, + ADDR6, + ADDR7, + + FP0, /* Eight FP registers */ + FP1, + FP2, + FP3, + FP4, + FP5, + FP6, + FP7, + + COP0, /* Co-processor #0-#7 */ + COP1, + COP2, + COP3, + COP4, + COP5, + COP6, + COP7, + + PC, /* Program counter */ + ZPC, /* Hack for Program space, but 0 addressing */ + SR, /* Status Reg */ + CCR, /* Condition code Reg */ + ACC, /* Accumulator Reg */ + MACSR, /* MAC Status Reg */ + MASK, /* Modulus Reg */ + + /* These have to be grouped together for the movec instruction to work. */ + USP, /* User Stack Pointer */ + ISP, /* Interrupt stack pointer */ + SFC, + DFC, + CACR, + VBR, + CAAR, + MSP, + ITT0, + ITT1, + DTT0, + DTT1, + MMUSR, + TC, + SRP, + URP, + BUSCR, /* 68060 added these. */ + PCR, + ROMBAR, /* mcf5200 added these. */ + RAMBAR0, + RAMBAR1, + MMUBAR, /* mcfv4e added these. */ + ROMBAR1, /* mcfv4e added these. */ + MPCR, EDRAMBAR, SECMBAR, /* mcfv4e added these. */ + PCR1U0, PCR1L0, PCR1U1, PCR1L1,/* mcfv4e added these. */ + PCR2U0, PCR2L0, PCR2U1, PCR2L1,/* mcfv4e added these. */ + PCR3U0, PCR3L0, PCR3U1, PCR3L1,/* mcfv4e added these. */ + MBAR0, MBAR1, /* mcfv4e added these. */ + ACR0, ACR1, ACR2, ACR3, /* mcf5200 added these. */ + FLASHBAR, RAMBAR, /* mcf528x added these. */ + MBAR, +#define last_movec_reg MBAR + /* End of movec ordering constraints. */ + + FPI, + FPS, + FPC, + + DRP, /* 68851 or 68030 MMU regs */ + CRP, + CAL, + VAL, + SCC, + AC, + BAD0, + BAD1, + BAD2, + BAD3, + BAD4, + BAD5, + BAD6, + BAD7, + BAC0, + BAC1, + BAC2, + BAC3, + BAC4, + BAC5, + BAC6, + BAC7, + PSR, /* aka MMUSR on 68030 (but not MMUSR on 68040) + and ACUSR on 68ec030 */ + PCSR, + + IC, /* instruction cache token */ + DC, /* data cache token */ + NC, /* no cache token */ + BC, /* both caches token */ + + TT0, /* 68030 access control unit regs */ + TT1, + + ZDATA0, /* suppressed data registers. */ + ZDATA1, + ZDATA2, + ZDATA3, + ZDATA4, + ZDATA5, + ZDATA6, + ZDATA7, + + ZADDR0, /* suppressed address registers. */ + ZADDR1, + ZADDR2, + ZADDR3, + ZADDR4, + ZADDR5, + ZADDR6, + ZADDR7, + + /* Upper and lower half of data and address registers. Order *must* + be DATAxL, ADDRxL, DATAxU, ADDRxU. */ + DATA0L, /* lower half of data registers */ + DATA1L, + DATA2L, + DATA3L, + DATA4L, + DATA5L, + DATA6L, + DATA7L, + + ADDR0L, /* lower half of address registers */ + ADDR1L, + ADDR2L, + ADDR3L, + ADDR4L, + ADDR5L, + ADDR6L, + ADDR7L, + + DATA0U, /* upper half of data registers */ + DATA1U, + DATA2U, + DATA3U, + DATA4U, + DATA5U, + DATA6U, + DATA7U, + + ADDR0U, /* upper half of address registers */ + ADDR1U, + ADDR2U, + ADDR3U, + ADDR4U, + ADDR5U, + ADDR6U, + ADDR7U, +}; + +/* Size information. */ + +enum m68k_size +{ + /* Unspecified. */ + SIZE_UNSPEC, + + /* Byte. */ + SIZE_BYTE, + + /* Word (2 bytes). */ + SIZE_WORD, + + /* Longword (4 bytes). */ + SIZE_LONG +}; + +/* The structure used to hold information about an index register. */ + +struct m68k_indexreg +{ + /* The index register itself. */ + enum m68k_register reg; + + /* The size to use. */ + enum m68k_size size; + + /* The value to scale by. */ + int scale; +}; + +#ifdef OBJ_ELF +/* The type of a PIC expression. */ + +enum pic_relocation +{ + pic_none, /* not pic */ + pic_plt_pcrel, /* @PLTPC */ + pic_got_pcrel, /* @GOTPC */ + pic_plt_off, /* @PLT */ + pic_got_off /* @GOT */ +}; +#endif + +/* The structure used to hold information about an expression. */ + +struct m68k_exp +{ + /* The size to use. */ + enum m68k_size size; + +#ifdef OBJ_ELF + /* The type of pic relocation if any. */ + enum pic_relocation pic_reloc; +#endif + + /* The expression itself. */ + expressionS exp; +}; + +/* The operand modes. */ + +enum m68k_operand_type +{ + IMMED = 1, + ABSL, + DREG, + AREG, + FPREG, + CONTROL, + AINDR, + AINC, + ADEC, + DISP, + BASE, + POST, + PRE, + REGLST +}; + +/* The structure used to hold a parsed operand. */ + +struct m68k_op +{ + /* The type of operand. */ + enum m68k_operand_type mode; + + /* The main register. */ + enum m68k_register reg; + + /* The register mask for mode REGLST. */ + unsigned long mask; + + /* An error message. */ + const char *error; + + /* The index register. */ + struct m68k_indexreg index; + + /* The displacement. */ + struct m68k_exp disp; + + /* The outer displacement. */ + struct m68k_exp odisp; +}; + +#endif /* ! defined (M68K_PARSE_H) */ + +/* The parsing function. */ + +extern int m68k_ip_op PARAMS ((char *, struct m68k_op *)); + +/* Whether register prefixes are optional. */ +extern int flag_reg_prefix_optional; diff --git a/gas/config/m68k-parse.y b/gas/config/m68k-parse.y new file mode 100644 index 0000000000000..813bfaad2c119 --- /dev/null +++ b/gas/config/m68k-parse.y @@ -0,0 +1,1062 @@ +/* m68k.y -- bison grammar for m68k operand parsing + Copyright 1995, 1996, 1997, 1998, 2001 Free Software Foundation, Inc. + Written by Ken Raeburn and Ian Lance Taylor, Cygnus Support + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* This file holds a bison grammar to parse m68k operands. The m68k + has a complicated operand syntax, and gas supports two main + variations of it. Using a grammar is probably overkill, but at + least it makes clear exactly what we do support. */ + +%{ + +#include "as.h" +#include "tc-m68k.h" +#include "m68k-parse.h" +#include "safe-ctype.h" + +/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, + etc), as well as gratuitously global symbol names If other parser + generators (bison, byacc, etc) produce additional global names that + conflict at link time, then those parser generators need to be + fixed instead of adding those names to this list. */ + +#define yymaxdepth m68k_maxdepth +#define yyparse m68k_parse +#define yylex m68k_lex +#define yyerror m68k_error +#define yylval m68k_lval +#define yychar m68k_char +#define yydebug m68k_debug +#define yypact m68k_pact +#define yyr1 m68k_r1 +#define yyr2 m68k_r2 +#define yydef m68k_def +#define yychk m68k_chk +#define yypgo m68k_pgo +#define yyact m68k_act +#define yyexca m68k_exca +#define yyerrflag m68k_errflag +#define yynerrs m68k_nerrs +#define yyps m68k_ps +#define yypv m68k_pv +#define yys m68k_s +#define yy_yys m68k_yys +#define yystate m68k_state +#define yytmp m68k_tmp +#define yyv m68k_v +#define yy_yyv m68k_yyv +#define yyval m68k_val +#define yylloc m68k_lloc +#define yyreds m68k_reds /* With YYDEBUG defined */ +#define yytoks m68k_toks /* With YYDEBUG defined */ +#define yylhs m68k_yylhs +#define yylen m68k_yylen +#define yydefred m68k_yydefred +#define yydgoto m68k_yydgoto +#define yysindex m68k_yysindex +#define yyrindex m68k_yyrindex +#define yygindex m68k_yygindex +#define yytable m68k_yytable +#define yycheck m68k_yycheck + +#ifndef YYDEBUG +#define YYDEBUG 1 +#endif + +/* Internal functions. */ + +static enum m68k_register m68k_reg_parse PARAMS ((char **)); +static int yylex PARAMS ((void)); +static void yyerror PARAMS ((const char *)); + +/* The parser sets fields pointed to by this global variable. */ +static struct m68k_op *op; + +%} + +%union +{ + struct m68k_indexreg indexreg; + enum m68k_register reg; + struct m68k_exp exp; + unsigned long mask; + int onereg; +} + +%token DR AR FPR FPCR LPC ZAR ZDR LZPC CREG +%token INDEXREG +%token EXPR + +%type zireg zdireg +%type zadr zdr apc zapc zpc optzapc optczapc +%type optcexpr optexprc +%type reglist ireglist reglistpair +%type reglistreg + +%% + +/* An operand. */ + +operand: + generic_operand + | motorola_operand + | mit_operand + ; + +/* A generic operand. */ + +generic_operand: + DR + { + op->mode = DREG; + op->reg = $1; + } + | AR + { + op->mode = AREG; + op->reg = $1; + } + | FPR + { + op->mode = FPREG; + op->reg = $1; + } + | FPCR + { + op->mode = CONTROL; + op->reg = $1; + } + | CREG + { + op->mode = CONTROL; + op->reg = $1; + } + | EXPR + { + op->mode = ABSL; + op->disp = $1; + } + | '#' EXPR + { + op->mode = IMMED; + op->disp = $2; + } + | '&' EXPR + { + op->mode = IMMED; + op->disp = $2; + } + | reglist + { + op->mode = REGLST; + op->mask = $1; + } + ; + +/* An operand in Motorola syntax. This includes MRI syntax as well, + which may or may not be different in that it permits commutativity + of index and base registers, and permits an offset expression to + appear inside or outside of the parentheses. */ + +motorola_operand: + '(' AR ')' + { + op->mode = AINDR; + op->reg = $2; + } + | '(' AR ')' '+' + { + op->mode = AINC; + op->reg = $2; + } + | '-' '(' AR ')' + { + op->mode = ADEC; + op->reg = $3; + } + | '(' EXPR ',' zapc ')' + { + op->reg = $4; + op->disp = $2; + if (($4 >= ZADDR0 && $4 <= ZADDR7) + || $4 == ZPC) + op->mode = BASE; + else + op->mode = DISP; + } + | '(' zapc ',' EXPR ')' + { + op->reg = $2; + op->disp = $4; + if (($2 >= ZADDR0 && $2 <= ZADDR7) + || $2 == ZPC) + op->mode = BASE; + else + op->mode = DISP; + } + | EXPR '(' zapc ')' + { + op->reg = $3; + op->disp = $1; + if (($3 >= ZADDR0 && $3 <= ZADDR7) + || $3 == ZPC) + op->mode = BASE; + else + op->mode = DISP; + } + | '(' LPC ')' + { + op->mode = DISP; + op->reg = $2; + } + | '(' ZAR ')' + { + op->mode = BASE; + op->reg = $2; + } + | '(' LZPC ')' + { + op->mode = BASE; + op->reg = $2; + } + | '(' EXPR ',' zapc ',' zireg ')' + { + op->mode = BASE; + op->reg = $4; + op->disp = $2; + op->index = $6; + } + | '(' EXPR ',' zapc ',' zpc ')' + { + if ($4 == PC || $4 == ZPC) + yyerror (_("syntax error")); + op->mode = BASE; + op->reg = $6; + op->disp = $2; + op->index.reg = $4; + op->index.size = SIZE_UNSPEC; + op->index.scale = 1; + } + | '(' EXPR ',' zdireg optczapc ')' + { + op->mode = BASE; + op->reg = $5; + op->disp = $2; + op->index = $4; + } + | '(' zdireg ',' EXPR ')' + { + op->mode = BASE; + op->disp = $4; + op->index = $2; + } + | EXPR '(' zapc ',' zireg ')' + { + op->mode = BASE; + op->reg = $3; + op->disp = $1; + op->index = $5; + } + | '(' zapc ',' zireg ')' + { + op->mode = BASE; + op->reg = $2; + op->index = $4; + } + | EXPR '(' zapc ',' zpc ')' + { + if ($3 == PC || $3 == ZPC) + yyerror (_("syntax error")); + op->mode = BASE; + op->reg = $5; + op->disp = $1; + op->index.reg = $3; + op->index.size = SIZE_UNSPEC; + op->index.scale = 1; + } + | '(' zapc ',' zpc ')' + { + if ($2 == PC || $2 == ZPC) + yyerror (_("syntax error")); + op->mode = BASE; + op->reg = $4; + op->index.reg = $2; + op->index.size = SIZE_UNSPEC; + op->index.scale = 1; + } + | EXPR '(' zdireg optczapc ')' + { + op->mode = BASE; + op->reg = $4; + op->disp = $1; + op->index = $3; + } + | '(' zdireg optczapc ')' + { + op->mode = BASE; + op->reg = $3; + op->index = $2; + } + | '(' '[' EXPR optczapc ']' ',' zireg optcexpr ')' + { + op->mode = POST; + op->reg = $4; + op->disp = $3; + op->index = $7; + op->odisp = $8; + } + | '(' '[' EXPR optczapc ']' optcexpr ')' + { + op->mode = POST; + op->reg = $4; + op->disp = $3; + op->odisp = $6; + } + | '(' '[' zapc ']' ',' zireg optcexpr ')' + { + op->mode = POST; + op->reg = $3; + op->index = $6; + op->odisp = $7; + } + | '(' '[' zapc ']' optcexpr ')' + { + op->mode = POST; + op->reg = $3; + op->odisp = $5; + } + | '(' '[' EXPR ',' zapc ',' zireg ']' optcexpr ')' + { + op->mode = PRE; + op->reg = $5; + op->disp = $3; + op->index = $7; + op->odisp = $9; + } + | '(' '[' zapc ',' zireg ']' optcexpr ')' + { + op->mode = PRE; + op->reg = $3; + op->index = $5; + op->odisp = $7; + } + | '(' '[' EXPR ',' zapc ',' zpc ']' optcexpr ')' + { + if ($5 == PC || $5 == ZPC) + yyerror (_("syntax error")); + op->mode = PRE; + op->reg = $7; + op->disp = $3; + op->index.reg = $5; + op->index.size = SIZE_UNSPEC; + op->index.scale = 1; + op->odisp = $9; + } + | '(' '[' zapc ',' zpc ']' optcexpr ')' + { + if ($3 == PC || $3 == ZPC) + yyerror (_("syntax error")); + op->mode = PRE; + op->reg = $5; + op->index.reg = $3; + op->index.size = SIZE_UNSPEC; + op->index.scale = 1; + op->odisp = $7; + } + | '(' '[' optexprc zdireg optczapc ']' optcexpr ')' + { + op->mode = PRE; + op->reg = $5; + op->disp = $3; + op->index = $4; + op->odisp = $7; + } + ; + +/* An operand in MIT syntax. */ + +mit_operand: + optzapc '@' + { + /* We use optzapc to avoid a shift/reduce conflict. */ + if ($1 < ADDR0 || $1 > ADDR7) + yyerror (_("syntax error")); + op->mode = AINDR; + op->reg = $1; + } + | optzapc '@' '+' + { + /* We use optzapc to avoid a shift/reduce conflict. */ + if ($1 < ADDR0 || $1 > ADDR7) + yyerror (_("syntax error")); + op->mode = AINC; + op->reg = $1; + } + | optzapc '@' '-' + { + /* We use optzapc to avoid a shift/reduce conflict. */ + if ($1 < ADDR0 || $1 > ADDR7) + yyerror (_("syntax error")); + op->mode = ADEC; + op->reg = $1; + } + | optzapc '@' '(' EXPR ')' + { + op->reg = $1; + op->disp = $4; + if (($1 >= ZADDR0 && $1 <= ZADDR7) + || $1 == ZPC) + op->mode = BASE; + else + op->mode = DISP; + } + | optzapc '@' '(' optexprc zireg ')' + { + op->mode = BASE; + op->reg = $1; + op->disp = $4; + op->index = $5; + } + | optzapc '@' '(' EXPR ')' '@' '(' optexprc zireg ')' + { + op->mode = POST; + op->reg = $1; + op->disp = $4; + op->index = $9; + op->odisp = $8; + } + | optzapc '@' '(' EXPR ')' '@' '(' EXPR ')' + { + op->mode = POST; + op->reg = $1; + op->disp = $4; + op->odisp = $8; + } + | optzapc '@' '(' optexprc zireg ')' '@' '(' EXPR ')' + { + op->mode = PRE; + op->reg = $1; + op->disp = $4; + op->index = $5; + op->odisp = $9; + } + ; + +/* An index register, possibly suppressed, which need not have a size + or scale. */ + +zireg: + INDEXREG + | zadr + { + $$.reg = $1; + $$.size = SIZE_UNSPEC; + $$.scale = 1; + } + ; + +/* A register which may be an index register, but which may not be an + address register. This nonterminal is used to avoid ambiguity when + trying to parse something like (0,d5,a6) as compared to (0,a6,d5). */ + +zdireg: + INDEXREG + | zdr + { + $$.reg = $1; + $$.size = SIZE_UNSPEC; + $$.scale = 1; + } + ; + +/* An address or data register, or a suppressed address or data + register. */ + +zadr: + zdr + | AR + | ZAR + ; + +/* A data register which may be suppressed. */ + +zdr: + DR + | ZDR + ; + +/* Either an address register or the PC. */ + +apc: + AR + | LPC + ; + +/* Either an address register, or the PC, or a suppressed address + register, or a suppressed PC. */ + +zapc: + apc + | LZPC + | ZAR + ; + +/* An optional zapc. */ + +optzapc: + /* empty */ + { + $$ = ZADDR0; + } + | zapc + ; + +/* The PC, optionally suppressed. */ + +zpc: + LPC + | LZPC + ; + +/* ',' zapc when it may be omitted. */ + +optczapc: + /* empty */ + { + $$ = ZADDR0; + } + | ',' zapc + { + $$ = $2; + } + ; + +/* ',' EXPR when it may be omitted. */ + +optcexpr: + /* empty */ + { + $$.exp.X_op = O_absent; + $$.size = SIZE_UNSPEC; + } + | ',' EXPR + { + $$ = $2; + } + ; + +/* EXPR ',' when it may be omitted. */ + +optexprc: + /* empty */ + { + $$.exp.X_op = O_absent; + $$.size = SIZE_UNSPEC; + } + | EXPR ',' + { + $$ = $1; + } + ; + +/* A register list for the movem instruction. */ + +reglist: + reglistpair + | reglistpair '/' ireglist + { + $$ = $1 | $3; + } + | reglistreg '/' ireglist + { + $$ = (1 << $1) | $3; + } + ; + +/* We use ireglist when we know we are looking at a reglist, and we + can safely reduce a simple register to reglistreg. If we permitted + reglist to reduce to reglistreg, it would be ambiguous whether a + plain register were a DREG/AREG/FPREG or a REGLST. */ + +ireglist: + reglistreg + { + $$ = 1 << $1; + } + | reglistpair + | reglistpair '/' ireglist + { + $$ = $1 | $3; + } + | reglistreg '/' ireglist + { + $$ = (1 << $1) | $3; + } + ; + +reglistpair: + reglistreg '-' reglistreg + { + if ($1 <= $3) + $$ = (1 << ($3 + 1)) - 1 - ((1 << $1) - 1); + else + $$ = (1 << ($1 + 1)) - 1 - ((1 << $3) - 1); + } + ; + +reglistreg: + DR + { + $$ = $1 - DATA0; + } + | AR + { + $$ = $1 - ADDR0 + 8; + } + | FPR + { + $$ = $1 - FP0 + 16; + } + | FPCR + { + if ($1 == FPI) + $$ = 24; + else if ($1 == FPS) + $$ = 25; + else + $$ = 26; + } + ; + +%% + +/* The string to parse is stored here, and modified by yylex. */ + +static char *str; + +/* The original string pointer. */ + +static char *strorig; + +/* If *CCP could be a register, return the register number and advance + *CCP. Otherwise don't change *CCP, and return 0. */ + +static enum m68k_register +m68k_reg_parse (ccp) + register char **ccp; +{ + char *start = *ccp; + char c; + char *p; + symbolS *symbolp; + + if (flag_reg_prefix_optional) + { + if (*start == REGISTER_PREFIX) + start++; + p = start; + } + else + { + if (*start != REGISTER_PREFIX) + return 0; + p = start + 1; + } + + if (! is_name_beginner (*p)) + return 0; + + p++; + while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*') + p++; + + c = *p; + *p = 0; + symbolp = symbol_find (start); + *p = c; + + if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section) + { + *ccp = p; + return S_GET_VALUE (symbolp); + } + + /* In MRI mode, something like foo.bar can be equated to a register + name. */ + while (flag_mri && c == '.') + { + ++p; + while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*') + p++; + c = *p; + *p = '\0'; + symbolp = symbol_find (start); + *p = c; + if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section) + { + *ccp = p; + return S_GET_VALUE (symbolp); + } + } + + return 0; +} + +/* The lexer. */ + +static int +yylex () +{ + enum m68k_register reg; + char *s; + int parens; + int c = 0; + int tail = 0; + char *hold; + + if (*str == ' ') + ++str; + + if (*str == '\0') + return 0; + + /* Various special characters are just returned directly. */ + switch (*str) + { + case '@': + /* In MRI mode, this can be the start of an octal number. */ + if (flag_mri) + { + if (ISDIGIT (str[1]) + || ((str[1] == '+' || str[1] == '-') + && ISDIGIT (str[2]))) + break; + } + /* Fall through. */ + case '#': + case '&': + case ',': + case ')': + case '/': + case '[': + case ']': + return *str++; + case '+': + /* It so happens that a '+' can only appear at the end of an + operand. If it appears anywhere else, it must be a unary + plus on an expression. */ + if (str[1] == '\0') + return *str++; + break; + case '-': + /* A '-' can only appear in -(ar), rn-rn, or ar@-. If it + appears anywhere else, it must be a unary minus on an + expression. */ + if (str[1] == '\0') + return *str++; + s = str + 1; + if (*s == '(') + ++s; + if (m68k_reg_parse (&s) != 0) + return *str++; + break; + case '(': + /* A '(' can only appear in `(reg)', `(expr,...', `([', `@(', or + `)('. If it appears anywhere else, it must be starting an + expression. */ + if (str[1] == '[' + || (str > strorig + && (str[-1] == '@' + || str[-1] == ')'))) + return *str++; + s = str + 1; + if (m68k_reg_parse (&s) != 0) + return *str++; + /* Check for the case of '(expr,...' by scanning ahead. If we + find a comma outside of balanced parentheses, we return '('. + If we find an unbalanced right parenthesis, then presumably + the '(' really starts an expression. */ + parens = 0; + for (s = str + 1; *s != '\0'; s++) + { + if (*s == '(') + ++parens; + else if (*s == ')') + { + if (parens == 0) + break; + --parens; + } + else if (*s == ',' && parens == 0) + { + /* A comma can not normally appear in an expression, so + this is a case of '(expr,...'. */ + return *str++; + } + } + } + + /* See if it's a register. */ + + reg = m68k_reg_parse (&str); + if (reg != 0) + { + int ret; + + yylval.reg = reg; + + if (reg >= DATA0 && reg <= DATA7) + ret = DR; + else if (reg >= ADDR0 && reg <= ADDR7) + ret = AR; + else if (reg >= FP0 && reg <= FP7) + return FPR; + else if (reg == FPI + || reg == FPS + || reg == FPC) + return FPCR; + else if (reg == PC) + return LPC; + else if (reg >= ZDATA0 && reg <= ZDATA7) + ret = ZDR; + else if (reg >= ZADDR0 && reg <= ZADDR7) + ret = ZAR; + else if (reg == ZPC) + return LZPC; + else + return CREG; + + /* If we get here, we have a data or address register. We + must check for a size or scale; if we find one, we must + return INDEXREG. */ + + s = str; + + if (*s != '.' && *s != ':' && *s != '*') + return ret; + + yylval.indexreg.reg = reg; + + if (*s != '.' && *s != ':') + yylval.indexreg.size = SIZE_UNSPEC; + else + { + ++s; + switch (*s) + { + case 'w': + case 'W': + yylval.indexreg.size = SIZE_WORD; + ++s; + break; + case 'l': + case 'L': + yylval.indexreg.size = SIZE_LONG; + ++s; + break; + default: + yyerror (_("illegal size specification")); + yylval.indexreg.size = SIZE_UNSPEC; + break; + } + } + + yylval.indexreg.scale = 1; + + if (*s == '*' || *s == ':') + { + expressionS scale; + + ++s; + + hold = input_line_pointer; + input_line_pointer = s; + expression (&scale); + s = input_line_pointer; + input_line_pointer = hold; + + if (scale.X_op != O_constant) + yyerror (_("scale specification must resolve to a number")); + else + { + switch (scale.X_add_number) + { + case 1: + case 2: + case 4: + case 8: + yylval.indexreg.scale = scale.X_add_number; + break; + default: + yyerror (_("invalid scale value")); + break; + } + } + } + + str = s; + + return INDEXREG; + } + + /* It must be an expression. Before we call expression, we need to + look ahead to see if there is a size specification. We must do + that first, because otherwise foo.l will be treated as the symbol + foo.l, rather than as the symbol foo with a long size + specification. The grammar requires that all expressions end at + the end of the operand, or with ',', '(', ']', ')'. */ + + parens = 0; + for (s = str; *s != '\0'; s++) + { + if (*s == '(') + { + if (parens == 0 + && s > str + && (s[-1] == ')' || ISALNUM (s[-1]))) + break; + ++parens; + } + else if (*s == ')') + { + if (parens == 0) + break; + --parens; + } + else if (parens == 0 + && (*s == ',' || *s == ']')) + break; + } + + yylval.exp.size = SIZE_UNSPEC; + if (s <= str + 2 + || (s[-2] != '.' && s[-2] != ':')) + tail = 0; + else + { + switch (s[-1]) + { + case 's': + case 'S': + case 'b': + case 'B': + yylval.exp.size = SIZE_BYTE; + break; + case 'w': + case 'W': + yylval.exp.size = SIZE_WORD; + break; + case 'l': + case 'L': + yylval.exp.size = SIZE_LONG; + break; + default: + break; + } + if (yylval.exp.size != SIZE_UNSPEC) + tail = 2; + } + +#ifdef OBJ_ELF + { + /* Look for @PLTPC, etc. */ + char *cp; + + yylval.exp.pic_reloc = pic_none; + cp = s - tail; + if (cp - 6 > str && cp[-6] == '@') + { + if (strncmp (cp - 6, "@PLTPC", 6) == 0) + { + yylval.exp.pic_reloc = pic_plt_pcrel; + tail += 6; + } + else if (strncmp (cp - 6, "@GOTPC", 6) == 0) + { + yylval.exp.pic_reloc = pic_got_pcrel; + tail += 6; + } + } + else if (cp - 4 > str && cp[-4] == '@') + { + if (strncmp (cp - 4, "@PLT", 4) == 0) + { + yylval.exp.pic_reloc = pic_plt_off; + tail += 4; + } + else if (strncmp (cp - 4, "@GOT", 4) == 0) + { + yylval.exp.pic_reloc = pic_got_off; + tail += 4; + } + } + } +#endif + + if (tail != 0) + { + c = s[-tail]; + s[-tail] = 0; + } + + hold = input_line_pointer; + input_line_pointer = str; + expression (&yylval.exp.exp); + str = input_line_pointer; + input_line_pointer = hold; + + if (tail != 0) + { + s[-tail] = c; + str = s; + } + + return EXPR; +} + +/* Parse an m68k operand. This is the only function which is called + from outside this file. */ + +int +m68k_ip_op (s, oparg) + char *s; + struct m68k_op *oparg; +{ + memset (oparg, 0, sizeof *oparg); + oparg->error = NULL; + oparg->index.reg = ZDATA0; + oparg->index.scale = 1; + oparg->disp.exp.X_op = O_absent; + oparg->odisp.exp.X_op = O_absent; + + str = strorig = s; + op = oparg; + + return yyparse (); +} + +/* The error handler. */ + +static void +yyerror (s) + const char *s; +{ + op->error = s; +} diff --git a/gas/config/m88k-opcode.h b/gas/config/m88k-opcode.h new file mode 100644 index 0000000000000..8055b5e430ec9 --- /dev/null +++ b/gas/config/m88k-opcode.h @@ -0,0 +1,559 @@ +/* m88k-opcode.h -- Instruction information for the Motorola 88000 + Contributed by Devon Bowen of Buffalo University + and Torbjorn Granlund of the Swedish Institute of Computer Science. + Copyright 1989, 1990, 1991, 1993, 2000 Free Software Foundation, Inc. + +This file is part of GAS, the GNU Assembler. + +GAS is free software; 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 1, or (at your option) +any later version. + +GAS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GAS; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#if !defined(__STDC__) && !defined(const) +#define const +#endif + +/* + Character codes for op_spec field below. + Reserved for self-matching: [ ] , + + d = GRF Destination register (21:5) + x = XRF register prefix. Makes next d, 1, or 2, match an extended register. + 1 = Source register 1 (16:5) + 2 = Source register 2 (0:5) + 3 = Both source registers (same value) (0:5 and 16:5) + I = IMM16 (0:16) + b = bit field spec. (0:10) + p = 16 bit pc displ. (0:16) + P = 26 bit pc displ. (0:26) + B = bb0/bb1 condition (21:5) + M = bcnd condition (21:5) + f = fcr (5:6) + c = cr (5:6) + V = VEC9 (0:9) + o = O6 field of "prot" insn (10:7) + ? = Give warning for this insn/operand combination + */ + +/* instruction descriptor structure */ + +struct m88k_opcode +{ + unsigned int opcode; + char *name; + char *op_spec; +}; + +/* and introducing... the Motorola 88100 and 88110 instruction sets... */ + +/* By default, include the 88110 instructions. */ +#define MC88110 + +#if defined (MC88110) +#define _MC88100(OPCODE,MNEM,OP_SPEC) +#define _MC88110(OPCODE,MNEM,OP_SPEC) {OPCODE,MNEM,OP_SPEC}, +#else +#define _MC88100(OPCODE,MNEM,OP_SPEC) {OPCODE,MNEM,OP_SPEC}, +#define _MC88110(OPCODE,MNEM,OP_SPEC) +#endif + +#define _MC88xxx(OPCODE,MNEM,OP_SPEC) {OPCODE,MNEM,OP_SPEC}, + +/* Equal mnemonics must be adjacent. + More specific operand specification must go before more general. + For example, "d,1,2" must go before "d,1,I" as a register for s2 + would otherwise be considered a variable name. */ + +static struct m88k_opcode m88k_opcodes[] = +{ + /* Opcode Mnemonic Opspec */ + + _MC88xxx (0xf4007000, "add", "d,1,2") + _MC88xxx (0x70000000, "add", "d,1,I") + _MC88xxx (0xf4007200, "add.ci", "d,1,2") + _MC88xxx (0xf4007300, "add.cio", "d,1,2") + _MC88xxx (0xf4007100, "add.co", "d,1,2") + _MC88xxx (0xf4006000, "addu", "d,1,2") + _MC88xxx (0x60000000, "addu", "d,1,I") + _MC88xxx (0xf4006200, "addu.ci", "d,1,2") + _MC88xxx (0xf4006300, "addu.cio", "d,1,2") + _MC88xxx (0xf4006100, "addu.co", "d,1,2") + _MC88xxx (0xf4004000, "and", "d,1,2") + _MC88xxx (0x40000000, "and", "d,1,I") + _MC88xxx (0xf4004400, "and.c", "d,1,2") + _MC88xxx (0x44000000, "and.u", "d,1,I") + _MC88xxx (0xd0000000, "bb0", "B,1,p") + _MC88xxx (0xd4000000, "bb0.n", "B,1,p") + _MC88xxx (0xd8000000, "bb1", "B,1,p") + _MC88xxx (0xdc000000, "bb1.n", "B,1,p") + _MC88xxx (0xe8000000, "bcnd", "M,1,p") + _MC88xxx (0xec000000, "bcnd.n", "M,1,p") + _MC88xxx (0xc0000000, "br", "P") + _MC88xxx (0xc4000000, "br.n", "P") + _MC88xxx (0xc8000000, "bsr", "P") + _MC88xxx (0xcc000000, "bsr.n", "P") + _MC88xxx (0xf4008000, "clr", "d,1,2") + _MC88xxx (0xf0008000, "clr", "d,1,b") + _MC88xxx (0xf4007c00, "cmp", "d,1,2") + _MC88xxx (0x7c000000, "cmp", "d,1,I") + _MC88xxx (0xf4007800, "div", "d,1,2") + _MC88xxx (0x78000000, "div", "d,1,I") + _MC88xxx (0xf4007800, "divs", "d,1,2") + _MC88xxx (0x78000000, "divs", "d,1,I") + _MC88110 (0xf4006900, "divu.d", "d,1,2") + _MC88xxx (0xf4006800, "divu", "d,1,2") + _MC88xxx (0x68000000, "divu", "d,1,I") + _MC88xxx (0xf4009000, "ext", "d,1,2") + _MC88xxx (0xf0009000, "ext", "d,1,b") + _MC88xxx (0xf4009800, "extu", "d,1,2") + _MC88xxx (0xf0009800, "extu", "d,1,b") + _MC88xxx (0x84002800, "fadd.sss", "d,1,2") + _MC88110 (0x8400a800, "fadd.sss", "xd,x1,x2") + _MC88xxx (0x84002880, "fadd.ssd", "d,1,2") + _MC88110 (0x8400a820, "fadd.ssd", "xd,x1,x2") + _MC88110 (0x8400a840, "fadd.ssx", "xd,x1,x2") + _MC88xxx (0x84002a00, "fadd.sds", "d,1,2") + _MC88110 (0x8400a880, "fadd.sds", "xd,x1,x2") + _MC88xxx (0x84002a80, "fadd.sdd", "d,1,2") + _MC88110 (0x8400a8a0, "fadd.sdd", "xd,x1,x2") + _MC88110 (0x8400a8c0, "fadd.sdx", "xd,x1,x2") + _MC88110 (0x8400a900, "fadd.sxs", "xd,x1,x2") + _MC88110 (0x8400a920, "fadd.sxd", "xd,x1,x2") + _MC88110 (0x8400a940, "fadd.sxx", "xd,x1,x2") + _MC88xxx (0x84002820, "fadd.dss", "d,1,2") + _MC88110 (0x8400aa00, "fadd.dss", "xd,x1,x2") + _MC88xxx (0x840028a0, "fadd.dsd", "d,1,2") + _MC88110 (0x8400aa20, "fadd.dsd", "xd,x1,x2") + _MC88110 (0x8400aa40, "fadd.dsx", "xd,x1,x2") + _MC88xxx (0x84002a20, "fadd.dds", "d,1,2") + _MC88110 (0x8400aa80, "fadd.dds", "xd,x1,x2") + _MC88xxx (0x84002aa0, "fadd.ddd", "d,1,2") + _MC88110 (0x8400aaa0, "fadd.ddd", "xd,x1,x2") + _MC88110 (0x8400aac0, "fadd.ddx", "xd,x1,x2") + _MC88110 (0x8400ab00, "fadd.dxs", "xd,x1,x2") + _MC88110 (0x8400ab20, "fadd.dxd", "xd,x1,x2") + _MC88110 (0x8400ab40, "fadd.dxx", "xd,x1,x2") + _MC88110 (0x8400ac00, "fadd.xss", "xd,x1,x2") + _MC88110 (0x8400ac20, "fadd.xsd", "xd,x1,x2") + _MC88110 (0x8400ac40, "fadd.xsx", "xd,x1,x2") + _MC88110 (0x8400ac80, "fadd.xds", "xd,x1,x2") + _MC88110 (0x8400aca0, "fadd.xdd", "xd,x1,x2") + _MC88110 (0x8400acc0, "fadd.xdx", "xd,x1,x2") + _MC88110 (0x8400ad00, "fadd.xxs", "xd,x1,x2") + _MC88110 (0x8400ad20, "fadd.xxd", "xd,x1,x2") + _MC88110 (0x8400ad40, "fadd.xxx", "xd,x1,x2") + _MC88xxx (0x84003a80, "fcmp.sdd", "d,1,2") + _MC88110 (0x8400ba80, "fcmp.sdd", "d,x1,x2") + _MC88xxx (0x84003a00, "fcmp.sds", "d,1,2") + _MC88110 (0x8400ba00, "fcmp.sds", "d,x1,x2") + _MC88110 (0x8400bb00, "fcmp.sdx", "d,x1,x2") + _MC88xxx (0x84003880, "fcmp.ssd", "d,1,2") + _MC88110 (0x8400b880, "fcmp.ssd", "d,x1,x2") + _MC88xxx (0x84003800, "fcmp.sss", "d,1,2") + _MC88110 (0x8400b800, "fcmp.sss", "d,x1,x2") + _MC88110 (0x8400b900, "fcmp.ssx", "d,x1,x2") + _MC88110 (0x8400bc80, "fcmp.sxd", "d,x1,x2") + _MC88110 (0x8400bc00, "fcmp.sxs", "d,x1,x2") + _MC88110 (0x8400bd00, "fcmp.sxx", "d,x1,x2") + _MC88110 (0x84003aa0, "fcmpu.sdd", "d,1,2") + _MC88110 (0x8400baa0, "fcmpu.sdd", "d,x1,x2") + _MC88110 (0x84003a20, "fcmpu.sds", "d,1,2") + _MC88110 (0x8400ba20, "fcmpu.sds", "d,x1,x2") + _MC88110 (0x8400bb20, "fcmpu.sdx", "d,x1,x2") + _MC88110 (0x840038a0, "fcmpu.ssd", "d,1,2") + _MC88110 (0x8400b8a0, "fcmpu.ssd", "d,x1,x2") + _MC88110 (0x84003820, "fcmpu.sss", "d,1,2") + _MC88110 (0x8400b820, "fcmpu.sss", "d,x1,x2") + _MC88110 (0x8400b920, "fcmpu.ssx", "d,x1,x2") + _MC88110 (0x8400bca0, "fcmpu.sxd", "d,x1,x2") + _MC88110 (0x8400bc20, "fcmpu.sxs", "d,x1,x2") + _MC88110 (0x8400bd20, "fcmpu.sxx", "d,x1,x2") + _MC88110 (0x84000880, "fcvt.ds", "d,2") + _MC88110 (0x84008880, "fcvt.ds", "xd,x2") + _MC88110 (0x840088c0, "fcvt.dx", "xd,x2") + _MC88110 (0x84000820, "fcvt.sd", "d,2") + _MC88110 (0x84008820, "fcvt.sd", "xd,x2") + _MC88110 (0x84008840, "fcvt.sx", "xd,x2") + _MC88110 (0x84008920, "fcvt.xd", "xd,x2") + _MC88110 (0x84008900, "fcvt.xs", "xd,x2") + _MC88xxx (0x84007000, "fdiv.sss", "d,1,2") + _MC88110 (0x8400f000, "fdiv.sss", "xd,x1,x2") + _MC88xxx (0x84007080, "fdiv.ssd", "d,1,2") + _MC88110 (0x8400f020, "fdiv.ssd", "xd,x1,x2") + _MC88110 (0x8400f040, "fdiv.ssx", "xd,x1,x2") + _MC88xxx (0x84007200, "fdiv.sds", "d,1,2") + _MC88110 (0x8400f080, "fdiv.sds", "xd,x1,x2") + _MC88xxx (0x84007280, "fdiv.sdd", "d,1,2") + _MC88110 (0x8400f0a0, "fdiv.sdd", "xd,x1,x2") + _MC88110 (0x8400f0c0, "fdiv.sdx", "xd,x1,x2") + _MC88110 (0x8400f100, "fdiv.sxs", "xd,x1,x2") + _MC88110 (0x8400f120, "fdiv.sxd", "xd,x1,x2") + _MC88110 (0x8400f140, "fdiv.sxx", "xd,x1,x2") + _MC88xxx (0x84007020, "fdiv.dss", "d,1,2") + _MC88110 (0x8400f200, "fdiv.dss", "xd,x1,x2") + _MC88xxx (0x840070a0, "fdiv.dsd", "d,1,2") + _MC88110 (0x8400f220, "fdiv.dsd", "xd,x1,x2") + _MC88110 (0x8400f240, "fdiv.dsx", "xd,x1,x2") + _MC88xxx (0x84007220, "fdiv.dds", "d,1,2") + _MC88110 (0x8400f280, "fdiv.dds", "xd,x1,x2") + _MC88xxx (0x840072a0, "fdiv.ddd", "d,1,2") + _MC88110 (0x8400f2a0, "fdiv.ddd", "xd,x1,x2") + _MC88110 (0x8400f2c0, "fdiv.ddx", "xd,x1,x2") + _MC88110 (0x8400f300, "fdiv.dxs", "xd,x1,x2") + _MC88110 (0x8400f320, "fdiv.dxd", "xd,x1,x2") + _MC88110 (0x8400f340, "fdiv.dxx", "xd,x1,x2") + _MC88110 (0x8400f400, "fdiv.xss", "xd,x1,x2") + _MC88110 (0x8400f420, "fdiv.xsd", "xd,x1,x2") + _MC88110 (0x8400f440, "fdiv.xsx", "xd,x1,x2") + _MC88110 (0x8400f480, "fdiv.xds", "xd,x1,x2") + _MC88110 (0x8400f4a0, "fdiv.xdd", "xd,x1,x2") + _MC88110 (0x8400f4c0, "fdiv.xdx", "xd,x1,x2") + _MC88110 (0x8400f500, "fdiv.xxs", "xd,x1,x2") + _MC88110 (0x8400f520, "fdiv.xxd", "xd,x1,x2") + _MC88110 (0x8400f540, "fdiv.xxx", "xd,x1,x2") + _MC88xxx (0xf400ec00, "ff0", "d,2") + _MC88xxx (0xf400e800, "ff1", "d,2") + _MC88xxx (0x80004800, "fldcr", "d,f") + _MC88xxx (0x84002020, "flt.ds", "d,2") + _MC88110 (0x84002220, "flt.ds", "xd,2") + _MC88xxx (0x84002000, "flt.ss", "d,2") + _MC88110 (0x84002200, "flt.ss", "xd,2") + _MC88110 (0x84002240, "flt.xs", "xd,2") + _MC88xxx (0x84000000, "fmul.sss", "d,1,2") + _MC88110 (0x84008000, "fmul.sss", "xd,x1,x2") + _MC88xxx (0x84000080, "fmul.ssd", "d,1,2") + _MC88110 (0x84008020, "fmul.ssd", "xd,x1,x2") + _MC88110 (0x84008040, "fmul.ssx", "xd,x1,x2") + _MC88xxx (0x84000200, "fmul.sds", "d,1,2") + _MC88110 (0x84008080, "fmul.sds", "xd,x1,x2") + _MC88xxx (0x84000280, "fmul.sdd", "d,1,2") + _MC88110 (0x840080a0, "fmul.sdd", "xd,x1,x2") + _MC88110 (0x840080c0, "fmul.sdx", "xd,x1,x2") + _MC88110 (0x84008100, "fmul.sxs", "xd,x1,x2") + _MC88110 (0x84008120, "fmul.sxd", "xd,x1,x2") + _MC88110 (0x84008140, "fmul.sxx", "xd,x1,x2") + _MC88xxx (0x84000020, "fmul.dss", "d,1,2") + _MC88110 (0x84008200, "fmul.dss", "xd,x1,x2") + _MC88xxx (0x840000a0, "fmul.dsd", "d,1,2") + _MC88110 (0x84008220, "fmul.dsd", "xd,x1,x2") + _MC88110 (0x84008240, "fmul.dsx", "xd,x1,x2") + _MC88xxx (0x84000220, "fmul.dds", "d,1,2") + _MC88110 (0x84008280, "fmul.dds", "xd,x1,x2") + _MC88xxx (0x840002a0, "fmul.ddd", "d,1,2") + _MC88110 (0x840082a0, "fmul.ddd", "xd,x1,x2") + _MC88110 (0x840082c0, "fmul.ddx", "xd,x1,x2") + _MC88110 (0x84008300, "fmul.dxs", "xd,x1,x2") + _MC88110 (0x84008320, "fmul.dxd", "xd,x1,x2") + _MC88110 (0x84008340, "fmul.dxx", "xd,x1,x2") + _MC88110 (0x84008400, "fmul.xss", "xd,x1,x2") + _MC88110 (0x84008420, "fmul.xsd", "xd,x1,x2") + _MC88110 (0x84008440, "fmul.xsx", "xd,x1,x2") + _MC88110 (0x84008480, "fmul.xds", "xd,x1,x2") + _MC88110 (0x840084a0, "fmul.xdd", "xd,x1,x2") + _MC88110 (0x840084c0, "fmul.xdx", "xd,x1,x2") + _MC88110 (0x84008500, "fmul.xxs", "xd,x1,x2") + _MC88110 (0x84008520, "fmul.xxd", "xd,x1,x2") + _MC88110 (0x84008540, "fmul.xxx", "xd,x1,x2") + _MC88110 (0x840078a0, "fsqrt.dd", "d,2") + _MC88110 (0x8400f8a0, "fsqrt.dd", "xd,x2") + _MC88110 (0x84007880, "fsqrt.ds", "d,2") + _MC88110 (0x8400f880, "fsqrt.ds", "xd,x2") + _MC88110 (0x8400f8c0, "fsqrt.dx", "xd,x2") + _MC88110 (0x84007820, "fsqrt.sd", "d,2") + _MC88110 (0x8400f820, "fsqrt.sd", "xd,x2") + _MC88110 (0x84007800, "fsqrt.ss", "d,2") + _MC88110 (0x8400f800, "fsqrt.ss", "xd,x2") + _MC88110 (0x8400f840, "fsqrt.sx", "xd,x2") + _MC88110 (0x8400f920, "fsqrt.xd", "xd,x2") + _MC88110 (0x8400f900, "fsqrt.xs", "xd,x2") + _MC88110 (0x8400f940, "fsqrt.xx", "xd,x2") + _MC88xxx (0x80008800, "fstcr", "3,f") + _MC88xxx (0x84003000, "fsub.sss", "d,1,2") + _MC88110 (0x8400b000, "fsub.sss", "xd,x1,x2") + _MC88xxx (0x84003080, "fsub.ssd", "d,1,2") + _MC88110 (0x8400b020, "fsub.ssd", "xd,x1,x2") + _MC88110 (0x8400b040, "fsub.ssx", "xd,x1,x2") + _MC88xxx (0x84003200, "fsub.sds", "d,1,2") + _MC88110 (0x8400b080, "fsub.sds", "xd,x1,x2") + _MC88xxx (0x84003280, "fsub.sdd", "d,1,2") + _MC88110 (0x8400b0a0, "fsub.sdd", "xd,x1,x2") + _MC88110 (0x8400b0c0, "fsub.sdx", "xd,x1,x2") + _MC88110 (0x8400b100, "fsub.sxs", "xd,x1,x2") + _MC88110 (0x8400b120, "fsub.sxd", "xd,x1,x2") + _MC88110 (0x8400b140, "fsub.sxx", "xd,x1,x2") + _MC88xxx (0x84003020, "fsub.dss", "d,1,2") + _MC88110 (0x8400b200, "fsub.dss", "xd,x1,x2") + _MC88xxx (0x840030a0, "fsub.dsd", "d,1,2") + _MC88110 (0x8400b220, "fsub.dsd", "xd,x1,x2") + _MC88110 (0x8400b240, "fsub.dsx", "xd,x1,x2") + _MC88xxx (0x84003220, "fsub.dds", "d,1,2") + _MC88110 (0x8400b280, "fsub.dds", "xd,x1,x2") + _MC88xxx (0x840032a0, "fsub.ddd", "d,1,2") + _MC88110 (0x8400b2a0, "fsub.ddd", "xd,x1,x2") + _MC88110 (0x8400b2c0, "fsub.ddx", "xd,x1,x2") + _MC88110 (0x8400b300, "fsub.dxs", "xd,x1,x2") + _MC88110 (0x8400b320, "fsub.dxd", "xd,x1,x2") + _MC88110 (0x8400b340, "fsub.dxx", "xd,x1,x2") + _MC88110 (0x8400b400, "fsub.xss", "xd,x1,x2") + _MC88110 (0x8400b420, "fsub.xsd", "xd,x1,x2") + _MC88110 (0x8400b440, "fsub.xsx", "xd,x1,x2") + _MC88110 (0x8400b480, "fsub.xds", "xd,x1,x2") + _MC88110 (0x8400b4a0, "fsub.xdd", "xd,x1,x2") + _MC88110 (0x8400b4c0, "fsub.xdx", "xd,x1,x2") + _MC88110 (0x8400b500, "fsub.xxs", "xd,x1,x2") + _MC88110 (0x8400b520, "fsub.xxd", "xd,x1,x2") + _MC88110 (0x8400b540, "fsub.xxx", "xd,x1,x2") + _MC88xxx (0x8000c800, "fxcr", "d,3,f") + _MC88xxx (0x8400fc01, "illop1", "") + _MC88xxx (0x8400fc02, "illop2", "") + _MC88xxx (0x8400fc03, "illop3", "") + _MC88xxx (0x84004880, "int.sd", "d,2") + _MC88110 (0x8400c880, "int.sd", "d,x2") + _MC88xxx (0x84004800, "int.ss", "d,2") + _MC88110 (0x8400c800, "int.ss", "d,x2") + _MC88110 (0x8400c900, "int.sx", "d,x2") + _MC88xxx (0xf400c000, "jmp", "2") + _MC88xxx (0xf400c400, "jmp.n", "2") + _MC88xxx (0xf400c800, "jsr", "2") + _MC88xxx (0xf400cc00, "jsr.n", "2") + _MC88xxx (0xf4001400, "ld", "d,1,2") + _MC88xxx (0xf4001600, "ld", "d,1[2]") + _MC88xxx (0x14000000, "ld", "d,1,I") + _MC88110 (0xf0001600, "ld", "xd,1[2]") + _MC88110 (0xf0001400, "ld", "xd,1,2") + _MC88110 (0x04000000, "ld", "xd,1,I") + _MC88xxx (0xf4001e00, "ld.b", "d,1[2]") + _MC88xxx (0xf4001c00, "ld.b", "d,1,2") + _MC88xxx (0x1c000000, "ld.b", "d,1,I") + _MC88xxx (0xf4001d00, "ld.b.usr", "d,1,2") + _MC88xxx (0xf4001f00, "ld.b.usr", "d,1[2]") + _MC88xxx (0xf4000e00, "ld.bu", "d,1[2]") + _MC88xxx (0xf4000c00, "ld.bu", "d,1,2") + _MC88xxx (0x0c000000, "ld.bu", "d,1,I") + _MC88xxx (0xf4000d00, "ld.bu.usr", "d,1,2") + _MC88xxx (0xf4000f00, "ld.bu.usr", "d,1[2]") + _MC88xxx (0xf4001200, "ld.d", "d,1[2]") + _MC88xxx (0xf4001000, "ld.d", "d,1,2") + _MC88xxx (0x10000000, "ld.d", "d,1,I") + _MC88110 (0xf0001200, "ld.d", "xd,1[2]") + _MC88110 (0xf0001000, "ld.d", "xd,1,2") + _MC88110 (0x00000000, "ld.d", "xd,1,I") + _MC88xxx (0xf4001100, "ld.d.usr", "d,1,2") + _MC88xxx (0xf4001300, "ld.d.usr", "d,1[2]") + _MC88110 (0xf0001100, "ld.d.usr", "xd,1,2") + _MC88110 (0xf0001300, "ld.d.usr", "xd,1[2]") + _MC88xxx (0xf4001a00, "ld.h", "d,1[2]") + _MC88xxx (0xf4001800, "ld.h", "d,1,2") + _MC88xxx (0x18000000, "ld.h", "d,1,I") + _MC88xxx (0xf4001900, "ld.h.usr", "d,1,2") + _MC88xxx (0xf4001b00, "ld.h.usr", "d,1[2]") + _MC88xxx (0xf4000a00, "ld.hu", "d,1[2]") + _MC88xxx (0xf4000800, "ld.hu", "d,1,2") + _MC88xxx (0x08000000, "ld.hu", "d,1,I") + _MC88xxx (0xf4000900, "ld.hu.usr", "d,1,2") + _MC88xxx (0xf4000b00, "ld.hu.usr", "d,1[2]") + _MC88xxx (0xf4001500, "ld.usr", "d,1,2") + _MC88xxx (0xf4001700, "ld.usr", "d,1[2]") + _MC88110 (0xf0001500, "ld.usr", "xd,1,2") + _MC88110 (0xf0001700, "ld.usr", "xd,1[2]") + _MC88110 (0xf0001a00, "ld.x", "xd,1[2]") + _MC88110 (0xf0001800, "ld.x", "xd,1,2") + _MC88110 (0x3c000000, "ld.x", "xd,1,I") + _MC88110 (0xf0001900, "ld.x.usr", "xd,1,2") + _MC88110 (0xf0001b00, "ld.x.usr", "xd,1[2]") + _MC88xxx (0xf4003600, "lda", "d,1[2]") + _MC88xxx (0xf4006000, "lda", "?d,1,2") /* Output addu */ + _MC88xxx (0x60000000, "lda", "?d,1,I") /* Output addu */ + _MC88xxx (0xf4006000, "lda.b", "?d,1[2]") /* Output addu */ + _MC88xxx (0xf4006000, "lda.b", "?d,1,2") /* Output addu */ + _MC88xxx (0x60000000, "lda.b", "?d,1,I") /* Output addu */ + _MC88xxx (0xf4003200, "lda.d", "d,1[2]") + _MC88xxx (0xf4006000, "lda.d", "?d,1,2") /* Output addu */ + _MC88xxx (0x60000000, "lda.d", "?d,1,I") /* Output addu */ + _MC88110 (0xf4003e00, "lda.x", "d,1[2]") + _MC88xxx (0xf4003a00, "lda.h", "d,1[2]") + _MC88xxx (0xf4006000, "lda.h", "?d,1,2") /* Output addu */ + _MC88xxx (0x60000000, "lda.h", "?d,1,I") /* Output addu */ + _MC88xxx (0x80004000, "ldcr", "d,c") + _MC88xxx (0xf400a000, "mak", "d,1,2") + _MC88xxx (0xf000a000, "mak", "d,1,b") + _MC88xxx (0x48000000, "mask", "d,1,I") + _MC88xxx (0x4c000000, "mask.u", "d,1,I") + _MC88110 (0x8400c000, "mov.s", "d,x2") + _MC88110 (0x84004200, "mov.s", "xd,2") + _MC88110 (0x8400c080, "mov.d", "d,x2") + _MC88110 (0x84004280, "mov.d", "xd,2") + _MC88110 (0x8400c300, "mov", "xd,x2") + _MC88xxx (0xf4006c00, "mul", "d,1,2") + _MC88xxx (0x6c000000, "mul", "d,1,I") + _MC88xxx (0xf4006e00, "muls", "d,1,2") + _MC88xxx (0x6c000000, "muls", "d,1,I") + _MC88xxx (0xf4006c00, "mulu", "d,1,2") /* synonym for mul */ + _MC88xxx (0x6c000000, "mulu", "d,1,I") /* synonym for mul */ + _MC88110 (0xf4006d00, "mulu.d", "d,1,2") + _MC88xxx (0x84005080, "nint.sd", "d,2") + _MC88110 (0x8400d080, "nint.sd", "d,x2") + _MC88xxx (0x84005000, "nint.ss", "d,2") + _MC88110 (0x8400d000, "nint.ss", "d,x2") + _MC88110 (0x8400d100, "nint.sx", "d,x2") + _MC88xxx (0xf4005800, "or", "d,1,2") + _MC88xxx (0x58000000, "or", "d,1,I") + _MC88xxx (0xf4005c00, "or.c", "d,1,2") + _MC88xxx (0x5c000000, "or.u", "d,1,I") + _MC88110 (0x88002020, "padd.b", "d,1,2") + _MC88110 (0x88002040, "padd.h", "d,1,2") + _MC88110 (0x88002060, "padd", "d,1,2") + _MC88110 (0x880020a0, "padds.u.b", "d,1,2") + _MC88110 (0x880020c0, "padds.u.h", "d,1,2") + _MC88110 (0x880020e0, "padds.u", "d,1,2") + _MC88110 (0x88002120, "padds.us.b", "d,1,2") + _MC88110 (0x88002140, "padds.us.h", "d,1,2") + _MC88110 (0x88002160, "padds.us", "d,1,2") + _MC88110 (0x880021a0, "padds.s.b", "d,1,2") + _MC88110 (0x880021c0, "padds.s.h", "d,1,2") + _MC88110 (0x880021e0, "padds.s", "d,1,2") + _MC88110 (0x88003860, "pcmp", "d,1,2") + _MC88110 (0x88000000, "pmul", "d,1,2") + _MC88110 (0x88006420, "ppack.32.b", "d,1,2") + _MC88110 (0x88006240, "ppack.16.h", "d,1,2") + _MC88110 (0x88006440, "ppack.32.h", "d,1,2") + _MC88110 (0x88006160, "ppack.8", "d,1,2") + _MC88110 (0x88006260, "ppack.16", "d,1,2") + _MC88110 (0x88006460, "ppack.32", "d,1,2") + _MC88110 (0x88007800, "prot", "d,1,2") + _MC88110 (0x88007000, "prot", "d,1,o") + _MC88110 (0x88003020, "psub.b", "d,1,2") + _MC88110 (0x88003040, "psub.h", "d,1,2") + _MC88110 (0x88003060, "psub", "d,1,2") + _MC88110 (0x880030a0, "psubs.u.b", "d,1,2") + _MC88110 (0x880030c0, "psubs.u.h", "d,1,2") + _MC88110 (0x880030e0, "psubs.u", "d,1,2") + _MC88110 (0x88003120, "psubs.us.b", "d,1,2") + _MC88110 (0x88003140, "psubs.us.h", "d,1,2") + _MC88110 (0x88003160, "psubs.us", "d,1,2") + _MC88110 (0x880031a0, "psubs.s.b", "d,1,2") + _MC88110 (0x880031c0, "psubs.s.h", "d,1,2") + _MC88110 (0x880031e0, "psubs.s", "d,1,2") + _MC88110 (0x88006800, "punpk.n", "d,1") + _MC88110 (0x88006820, "punpk.b", "d,1") + _MC88110 (0x88006840, "punpk.h", "d,1") + _MC88xxx (0xf400a800, "rot", "d,1,2") + _MC88xxx (0xf000a800, "rot", "d,1,b") + _MC88xxx (0xf400fc00, "rte", "") + _MC88xxx (0xf4008800, "set", "d,1,2") + _MC88xxx (0xf0008800, "set", "d,1,b") + _MC88xxx (0xf4002600, "st", "d,1[2]") + _MC88xxx (0xf4002400, "st", "d,1,2") + _MC88xxx (0x24000000, "st", "d,1,I") + _MC88110 (0xf0002600, "st", "xd,1[2]") + _MC88110 (0xf0002400, "st", "xd,1,2") + _MC88110 (0x34000000, "st", "xd,1,I") + _MC88xxx (0xf4002e00, "st.b", "d,1[2]") + _MC88xxx (0xf4002c00, "st.b", "d,1,2") + _MC88xxx (0x2c000000, "st.b", "d,1,I") + _MC88xxx (0xf4002d00, "st.b.usr", "d,1,2") + _MC88xxx (0xf4002f00, "st.b.usr", "d,1[2]") + _MC88110 (0xf4002d80, "st.b.usr.wt", "d,1,2") + _MC88110 (0xf4002f80, "st.b.usr.wt", "d,1[2]") + _MC88110 (0xf4002c80, "st.b.wt", "d,1,2") + _MC88110 (0xf4002e80, "st.b.wt", "d,1[2]") + _MC88xxx (0xf4002200, "st.d", "d,1[2]") + _MC88xxx (0xf4002000, "st.d", "d,1,2") + _MC88xxx (0x20000000, "st.d", "d,1,I") + _MC88110 (0xf0002200, "st.d", "xd,1[2]") + _MC88110 (0xf0002000, "st.d", "xd,1,2") + _MC88110 (0x30000000, "st.d", "xd,1,I") + _MC88xxx (0xf4002100, "st.d.usr", "d,1,2") + _MC88xxx (0xf4002300, "st.d.usr", "d,1[2]") + _MC88110 (0xf0002100, "st.d.usr", "xd,1,2") + _MC88110 (0xf0002300, "st.d.usr", "xd,1[2]") + _MC88110 (0xf4002180, "st.d.usr.wt", "d,1,2") + _MC88110 (0xf4002380, "st.d.usr.wt", "d,1[2]") + _MC88110 (0xf0002180, "st.d.usr.wt", "xd,1,2") + _MC88110 (0xf0002380, "st.d.usr.wt", "xd,1[2]") + _MC88110 (0xf4002080, "st.d.wt", "d,1,2") + _MC88110 (0xf4002280, "st.d.wt", "d,1[2]") + _MC88110 (0xf0002080, "st.d.wt", "xd,1,2") + _MC88110 (0xf0002280, "st.d.wt", "xd,1[2]") + _MC88xxx (0xf4002a00, "st.h", "d,1[2]") + _MC88xxx (0xf4002800, "st.h", "d,1,2") + _MC88xxx (0x28000000, "st.h", "d,1,I") + _MC88xxx (0xf4002900, "st.h.usr", "d,1,2") + _MC88xxx (0xf4002b00, "st.h.usr", "d,1[2]") + _MC88110 (0xf4002980, "st.h.usr.wt", "d,1,2") + _MC88110 (0xf4002b80, "st.h.usr.wt", "d,1[2]") + _MC88110 (0xf4002880, "st.h.wt", "d,1,2") + _MC88110 (0xf4002a80, "st.h.wt", "d,1[2]") + _MC88xxx (0xf4002500, "st.usr", "d,1,2") + _MC88xxx (0xf4002700, "st.usr", "d,1[2]") + _MC88110 (0xf0002500, "st.usr", "xd,1,2") + _MC88110 (0xf0002700, "st.usr", "xd,1[2]") + _MC88110 (0xf4002580, "st.usr.wt", "d,1,2") + _MC88110 (0xf4002780, "st.usr.wt", "d,1[2]") + _MC88110 (0xf0002580, "st.usr.wt", "xd,1,2") + _MC88110 (0xf0002780, "st.usr.wt", "xd,1[2]") + _MC88110 (0xf4002480, "st.wt", "d,1,2") + _MC88110 (0xf4002680, "st.wt", "d,1[2]") + _MC88110 (0xf0002480, "st.wt", "xd,1,2") + _MC88110 (0xf0002680, "st.wt", "xd,1[2]") + _MC88110 (0xf0002a00, "st.x", "xd,1[2]") + _MC88110 (0xf0002800, "st.x", "xd,1,2") + _MC88110 (0x38000000, "st.x", "xd,1,I") + _MC88110 (0xf0002900, "st.x.usr", "xd,1,2") + _MC88110 (0xf0002b00, "st.x.usr", "xd,1[2]") + _MC88110 (0xf0002980, "st.x.usr.wt", "xd,1,2") + _MC88110 (0xf0002b80, "st.x.usr.wt", "xd,1[2]") + _MC88110 (0xf0002880, "st.x.wt", "xd,1,2") + _MC88110 (0xf0002a80, "st.x.wt", "xd,1[2]") + _MC88xxx (0x80008000, "stcr", "3,c") + _MC88xxx (0xf4007400, "sub", "d,1,2") + _MC88xxx (0x74000000, "sub", "d,1,I") + _MC88xxx (0xf4007600, "sub.ci", "d,1,2") + _MC88xxx (0xf4007700, "sub.cio", "d,1,2") + _MC88xxx (0xf4007500, "sub.co", "d,1,2") + _MC88xxx (0xf4006400, "subu", "d,1,2") + _MC88xxx (0x64000000, "subu", "d,1,I") + _MC88xxx (0xf4006600, "subu.ci", "d,1,2") + _MC88xxx (0xf4006700, "subu.cio", "d,1,2") + _MC88xxx (0xf4006500, "subu.co", "d,1,2") + _MC88xxx (0xf000d000, "tb0", "B,1,V") + _MC88xxx (0xf000d800, "tb1", "B,1,V") + _MC88xxx (0xf400f800, "tbnd", "1,2") + _MC88xxx (0xf8000000, "tbnd", "1,I") + _MC88xxx (0xf000e800, "tcnd", "M,1,V") + _MC88xxx (0x84005880, "trnc.sd", "d,2") + _MC88110 (0x8400d880, "trnc.sd", "d,x2") + _MC88xxx (0x84005800, "trnc.ss", "d,2") + _MC88110 (0x8400d800, "trnc.ss", "d,x2") + _MC88110 (0x8400d900, "trnc.sx", "d,x2") + _MC88xxx (0x8000c000, "xcr", "d,3,c") + _MC88xxx (0xf4000600, "xmem", "d,1[2]") + _MC88xxx (0xf4000400, "xmem", "d,1,2") + _MC88100 (0x04000000, "xmem", "?d,1,I") + _MC88xxx (0xf4000200, "xmem.bu", "d,1[2]") + _MC88xxx (0xf4000000, "xmem.bu", "d,1,2") + _MC88100 (0x00000000, "xmem.bu", "?d,1,I") + _MC88xxx (0xf4000300, "xmem.bu.usr", "d,1[2]") + _MC88xxx (0xf4000100, "xmem.bu.usr", "d,1,2") + _MC88100 (0x00000100, "xmem.bu.usr", "?d,1,I") + _MC88xxx (0xf4000700, "xmem.usr", "d,1[2]") + _MC88xxx (0xf4000500, "xmem.usr", "d,1,2") + _MC88100 (0x04000100, "xmem.usr", "?d,1,I") + _MC88xxx (0xf4005000, "xor", "d,1,2") + _MC88xxx (0x50000000, "xor", "d,1,I") + _MC88xxx (0xf4005400, "xor.c", "d,1,2") + _MC88xxx (0x54000000, "xor.u", "d,1,I") + _MC88xxx (0x00000000, "", 0) +}; + +#define NUMOPCODES ((sizeof m88k_opcodes)/(sizeof m88k_opcodes[0])) diff --git a/gas/config/obj-bout.c b/gas/config/obj-bout.c new file mode 100644 index 0000000000000..88ea0f1c7c698 --- /dev/null +++ b/gas/config/obj-bout.c @@ -0,0 +1,354 @@ +/* b.out object file format + Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002 + Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#include "as.h" +#include "obstack.h" + +/* In: segT Out: N_TYPE bits */ +const short seg_N_TYPE[] = +{ + N_ABS, + N_TEXT, + N_DATA, + N_BSS, + N_UNDF, /* unknown */ + N_UNDF, /* error */ + N_UNDF, /* expression */ + N_UNDF, /* debug */ + N_UNDF, /* ntv */ + N_UNDF, /* ptv */ + N_REGISTER, /* register */ +}; + +const segT N_TYPE_seg[N_TYPE + 2] = +{ /* N_TYPE == 0x1E = 32-2 */ + SEG_UNKNOWN, /* N_UNDF == 0 */ + SEG_GOOF, + SEG_ABSOLUTE, /* N_ABS == 2 */ + SEG_GOOF, + SEG_TEXT, /* N_TEXT == 4 */ + SEG_GOOF, + SEG_DATA, /* N_DATA == 6 */ + SEG_GOOF, + SEG_BSS, /* N_BSS == 8 */ + SEG_GOOF, + SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, + SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, + SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, + SEG_REGISTER, /* dummy N_REGISTER for regs = 30 */ + SEG_GOOF, +}; + +static void obj_bout_line PARAMS ((int)); + +const pseudo_typeS obj_pseudo_table[] = +{ + {"line", obj_bout_line, 0}, /* Source code line number. */ + +/* coff debugging directives. Currently ignored silently. */ + {"def", s_ignore, 0}, + {"dim", s_ignore, 0}, + {"endef", s_ignore, 0}, + {"ln", s_ignore, 0}, + {"scl", s_ignore, 0}, + {"size", s_ignore, 0}, + {"tag", s_ignore, 0}, + {"type", s_ignore, 0}, + {"val", s_ignore, 0}, + +/* other stuff we don't handle */ + {"ABORT", s_ignore, 0}, + {"ident", s_ignore, 0}, + + {NULL, NULL, 0} /* End sentinel. */ +}; + +/* Relocation. */ + +/* Crawl along a fixS chain. Emit the segment's relocations. */ + +void +obj_emit_relocations (where, fixP, segment_address_in_file) + char **where; + fixS *fixP; /* Fixup chain for this segment. */ + relax_addressT segment_address_in_file; +{ + for (; fixP; fixP = fixP->fx_next) + { + if (fixP->fx_done == 0 + || fixP->fx_r_type != NO_RELOC) + { + symbolS *sym; + + sym = fixP->fx_addsy; + while (sym->sy_value.X_op == O_symbol + && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym))) + sym = sym->sy_value.X_add_symbol; + fixP->fx_addsy = sym; + + tc_bout_fix_to_chars (*where, fixP, segment_address_in_file); + *where += sizeof (struct relocation_info); + } /* if there's a symbol */ + } /* for each fixup */ +} + +/* Aout file generation & utilities . */ + +/* Convert a lvalue to machine dependent data. */ + +void +obj_header_append (where, headers) + char **where; + object_headers *headers; +{ + /* Always leave in host byte order. */ + + headers->header.a_talign = section_alignment[SEG_TEXT]; + + /* Force to at least 2. */ + if (headers->header.a_talign < 2) + { + headers->header.a_talign = 2; + } + + headers->header.a_dalign = section_alignment[SEG_DATA]; + headers->header.a_balign = section_alignment[SEG_BSS]; + + headers->header.a_tload = 0; + headers->header.a_dload = + md_section_align (SEG_DATA, H_GET_TEXT_SIZE (headers)); + + headers->header.a_relaxable = linkrelax; + +#ifdef CROSS_COMPILE + md_number_to_chars (*where, headers->header.a_magic, sizeof (headers->header.a_magic)); + *where += sizeof (headers->header.a_magic); + md_number_to_chars (*where, headers->header.a_text, sizeof (headers->header.a_text)); + *where += sizeof (headers->header.a_text); + md_number_to_chars (*where, headers->header.a_data, sizeof (headers->header.a_data)); + *where += sizeof (headers->header.a_data); + md_number_to_chars (*where, headers->header.a_bss, sizeof (headers->header.a_bss)); + *where += sizeof (headers->header.a_bss); + md_number_to_chars (*where, headers->header.a_syms, sizeof (headers->header.a_syms)); + *where += sizeof (headers->header.a_syms); + md_number_to_chars (*where, headers->header.a_entry, sizeof (headers->header.a_entry)); + *where += sizeof (headers->header.a_entry); + md_number_to_chars (*where, headers->header.a_trsize, sizeof (headers->header.a_trsize)); + *where += sizeof (headers->header.a_trsize); + md_number_to_chars (*where, headers->header.a_drsize, sizeof (headers->header.a_drsize)); + *where += sizeof (headers->header.a_drsize); + md_number_to_chars (*where, headers->header.a_tload, sizeof (headers->header.a_tload)); + *where += sizeof (headers->header.a_tload); + md_number_to_chars (*where, headers->header.a_dload, sizeof (headers->header.a_dload)); + *where += sizeof (headers->header.a_dload); + md_number_to_chars (*where, headers->header.a_talign, sizeof (headers->header.a_talign)); + *where += sizeof (headers->header.a_talign); + md_number_to_chars (*where, headers->header.a_dalign, sizeof (headers->header.a_dalign)); + *where += sizeof (headers->header.a_dalign); + md_number_to_chars (*where, headers->header.a_balign, sizeof (headers->header.a_balign)); + *where += sizeof (headers->header.a_balign); + md_number_to_chars (*where, headers->header.a_relaxable, sizeof (headers->header.a_relaxable)); + *where += sizeof (headers->header.a_relaxable); +#else /* ! CROSS_COMPILE */ + append (where, (char *) &headers->header, sizeof (headers->header)); +#endif /* ! CROSS_COMPILE */ +} + +void +obj_symbol_to_chars (where, symbolP) + char **where; + symbolS *symbolP; +{ + md_number_to_chars ((char *) &(S_GET_OFFSET (symbolP)), + S_GET_OFFSET (symbolP), + sizeof (S_GET_OFFSET (symbolP))); + + md_number_to_chars ((char *) &(S_GET_DESC (symbolP)), + S_GET_DESC (symbolP), + sizeof (S_GET_DESC (symbolP))); + + md_number_to_chars ((char *) &symbolP->sy_symbol.n_value, + S_GET_VALUE (symbolP), + sizeof (symbolP->sy_symbol.n_value)); + + append (where, (char *) &symbolP->sy_symbol, sizeof (obj_symbol_type)); +} + +void +obj_emit_symbols (where, symbol_rootP) + char **where; + symbolS *symbol_rootP; +{ + symbolS *symbolP; + + /* Emit all symbols left in the symbol chain. */ + for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP)) + { + /* Used to save the offset of the name. It is used to point to + the string in memory but must be a file offset. */ + char *temp; + + temp = S_GET_NAME (symbolP); + S_SET_OFFSET (symbolP, symbolP->sy_name_offset); + + /* Any symbol still undefined and is not a dbg symbol is made N_EXT. */ + if (!S_IS_DEBUG (symbolP) && !S_IS_DEFINED (symbolP)) + S_SET_EXTERNAL (symbolP); + + obj_symbol_to_chars (where, symbolP); + S_SET_NAME (symbolP, temp); + } +} + +void +obj_symbol_new_hook (symbolP) + symbolS *symbolP; +{ + S_SET_OTHER (symbolP, 0); + S_SET_DESC (symbolP, 0); +} + +static void +obj_bout_line (ignore) + int ignore ATTRIBUTE_UNUSED; +{ + /* Assume delimiter is part of expression. */ + /* BSD4.2 as fails with delightful bug, so we are not being + incompatible here. */ + new_logical_line ((char *) NULL, (int) (get_absolute_expression ())); + demand_empty_rest_of_line (); +} + +void +obj_read_begin_hook () +{ +} + +void +obj_crawl_symbol_chain (headers) + object_headers *headers; +{ + symbolS **symbolPP; + symbolS *symbolP; + int symbol_number = 0; + + tc_crawl_symbol_chain (headers); + + symbolPP = &symbol_rootP; /* -> last symbol chain link. */ + while ((symbolP = *symbolPP) != NULL) + { + if (flag_readonly_data_in_text && (S_GET_SEGMENT (symbolP) == SEG_DATA)) + { + S_SET_SEGMENT (symbolP, SEG_TEXT); + } /* if pushing data into text */ + + resolve_symbol_value (symbolP); + + /* Skip symbols which were equated to undefined or common + symbols. */ + if (symbolP->sy_value.X_op == O_symbol + && (! S_IS_DEFINED (symbolP) || S_IS_COMMON (symbolP))) + { + *symbolPP = symbol_next (symbolP); + continue; + } + + /* OK, here is how we decide which symbols go out into the + brave new symtab. Symbols that do are: + + * symbols with no name (stabd's?) + * symbols with debug info in their N_TYPE + + Symbols that don't are: + * symbols that are registers + * symbols with \1 as their 3rd character (numeric labels) + * "local labels" as defined by S_LOCAL_NAME(name) + if the -L switch was passed to gas. + + All other symbols are output. We complain if a deleted + symbol was marked external. */ + + if (1 + && !S_IS_REGISTER (symbolP) + && (!S_GET_NAME (symbolP) + || S_IS_DEBUG (symbolP) +#ifdef TC_I960 + /* FIXME-SOON this ifdef seems highly dubious to me. xoxorich. */ + || !S_IS_DEFINED (symbolP) + || S_IS_EXTERNAL (symbolP) +#endif /* TC_I960 */ + || (S_GET_NAME (symbolP)[0] != '\001' + && (flag_keep_locals || !S_LOCAL_NAME (symbolP))))) + { + symbolP->sy_number = symbol_number++; + + /* The + 1 after strlen account for the \0 at the end of + each string. */ + if (!S_IS_STABD (symbolP)) + { + /* Ordinary case. */ + symbolP->sy_name_offset = string_byte_count; + string_byte_count += strlen (S_GET_NAME (symbolP)) + 1; + } + else /* .Stabd case. */ + symbolP->sy_name_offset = 0; + symbolPP = &(symbolP->sy_next); + } + else + { + if (S_IS_EXTERNAL (symbolP) || !S_IS_DEFINED (symbolP)) + { + as_bad (_("Local symbol %s never defined"), + S_GET_NAME (symbolP)); + } /* Oops. */ + + /* Unhook it from the chain. */ + *symbolPP = symbol_next (symbolP); + } /* if this symbol should be in the output */ + } /* for each symbol */ + + H_SET_SYMBOL_TABLE_SIZE (headers, symbol_number); +} + +/* Find strings by crawling along symbol table chain. */ + +void +obj_emit_strings (where) + char **where; +{ + symbolS *symbolP; + +#ifdef CROSS_COMPILE + /* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */ + md_number_to_chars (*where, string_byte_count, sizeof (string_byte_count)); + *where += sizeof (string_byte_count); +#else /* CROSS_COMPILE */ + append (where, (char *) &string_byte_count, + (unsigned long) sizeof (string_byte_count)); +#endif /* CROSS_COMPILE */ + + for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP)) + { + if (S_GET_NAME (symbolP)) + append (where, S_GET_NAME (symbolP), + (unsigned long) (strlen (S_GET_NAME (symbolP)) + 1)); + } /* Walk symbol chain. */ +} diff --git a/gas/config/obj-bout.h b/gas/config/obj-bout.h new file mode 100644 index 0000000000000..aaa9d9beb7bc5 --- /dev/null +++ b/gas/config/obj-bout.h @@ -0,0 +1,319 @@ +/* b.out object file format + Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, + 2002, 2003 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with GAS; see the file COPYING. If not, write + to the Free Software Foundation, 59 Temple Place - Suite 330, Cambridge, MA + 02139, USA. */ + +/* + * This file is a modified version of 'a.out.h'. It is to be used in all GNU + * tools modified to support the i80960 b.out format (or tools that operate on + * object files created by such tools). + * + * All i80960 development is done in a CROSS-DEVELOPMENT environment. I.e., + * object code is generated on, and executed under the direction of a symbolic + * debugger running on, a host system. We do not want to be subject to the + * vagaries of which host it is or whether it supports COFF or a.out format, or + * anything else. We DO want to: + * + * o always generate the same format object files, regardless of host. + * + * o have an 'a.out' header that we can modify for our own purposes + * (the 80960 is typically an embedded processor and may require + * enhanced linker support that the normal a.out.h header can't + * accommodate). + * + * As for byte-ordering, the following rules apply: + * + * o Text and data that is actually downloaded to the target is always + * in i80960 (little-endian) order. + * + * o All other numbers (in the header, symbols, relocation directives) + * are in host byte-order: object files CANNOT be lifted from a + * little-end host and used on a big-endian (or vice versa) without + * modification. + * ==> THIS IS NO LONGER TRUE USING BFD. WE CAN GENERATE ANY BYTE ORDER + * FOR THE HEADER, AND READ ANY BYTE ORDER. PREFERENCE WOULD BE TO + * USE LITTLE-ENDIAN BYTE ORDER THROUGHOUT, REGARDLESS OF HOST. <== + * + * o The downloader ('comm960') takes care to generate a pseudo-header + * with correct (i80960) byte-ordering before shipping text and data + * off to the NINDY monitor in the target systems. Symbols and + * relocation info are never sent to the target. + */ + +#define OBJ_BOUT 1 + +#define OUTPUT_FLAVOR bfd_target_aout_flavour + +#include "targ-cpu.h" + +#define OBJ_DEFAULT_OUTPUT_FILE_NAME "b.out" + +extern const short seg_N_TYPE[]; +extern const segT N_TYPE_seg[]; + +#define BMAGIC 0415 +/* We don't accept the following (see N_BADMAG macro). + * They're just here so GNU code will compile. + */ +#define OMAGIC 0407 /* old impure format */ +#define NMAGIC 0410 /* read-only text */ +#define ZMAGIC 0413 /* demand load format */ + +#ifndef DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE +#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (BMAGIC) +#endif /* DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE */ + +/* FILE HEADER + * All 'lengths' are given as a number of bytes. + * All 'alignments' are for relinkable files only; an alignment of + * 'n' indicates the corresponding segment must begin at an + * address that is a multiple of (2**n). + */ +struct exec + { + /* Standard stuff */ + unsigned long a_magic; /* Identifies this as a b.out file */ + unsigned long a_text; /* Length of text */ + unsigned long a_data; /* Length of data */ + unsigned long a_bss; /* Length of runtime uninitialized data area */ + unsigned long a_syms; /* Length of symbol table */ + unsigned long a_entry; /* Runtime start address */ + unsigned long a_trsize; /* Length of text relocation info */ + unsigned long a_drsize; /* Length of data relocation info */ + + /* Added for i960 */ + unsigned long a_tload; /* Text runtime load address */ + unsigned long a_dload; /* Data runtime load address */ + unsigned char a_talign; /* Alignment of text segment */ + unsigned char a_dalign; /* Alignment of data segment */ + unsigned char a_balign; /* Alignment of bss segment */ + unsigned char a_relaxable; /* Contains enough info to relax */ + }; + +#define N_BADMAG(x) (((x).a_magic)!=BMAGIC) +#define N_TXTOFF(x) ( sizeof (struct exec) ) +#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text ) +#define N_TROFF(x) ( N_DATOFF(x) + (x).a_data ) +#define N_DROFF(x) ( N_TROFF(x) + (x).a_trsize ) +#define N_SYMOFF(x) ( N_DROFF(x) + (x).a_drsize ) +#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) + +/* A single entry in the symbol table + */ +struct nlist + { + union + { + char *n_name; + struct nlist *n_next; + long n_strx; /* Index into string table */ + } + n_un; + unsigned char n_type; /* See below */ + char n_other; /* Used in i80960 support -- see below */ + short n_desc; + unsigned long n_value; + }; + +typedef struct nlist obj_symbol_type; + +/* Legal values of n_type + */ +#define N_UNDF 0 /* Undefined symbol */ +#define N_ABS 2 /* Absolute symbol */ +#define N_TEXT 4 /* Text symbol */ +#define N_DATA 6 /* Data symbol */ +#define N_BSS 8 /* BSS symbol */ +#define N_FN 31 /* Filename symbol */ + +#define N_EXT 1 /* External symbol (OR'd in with one of above) */ +#define N_TYPE 036 /* Mask for all the type bits */ +#define N_STAB 0340 /* Mask for all bits used for SDB entries */ + +#ifndef CUSTOM_RELOC_FORMAT +struct relocation_info + { + int r_address; /* File address of item to be relocated */ + unsigned + r_index:24, /* Index of symbol on which relocation is based*/ + r_pcrel:1, /* 1 => relocate PC-relative; else absolute + * On i960, pc-relative implies 24-bit + * address, absolute implies 32-bit. + */ + r_length:2, /* Number of bytes to relocate: + * 0 => 1 byte + * 1 => 2 bytes + * 2 => 4 bytes -- only value used for i960 + */ + r_extern:1, r_bsr:1, /* Something for the GNU NS32K assembler */ + r_disp:1, /* Something for the GNU NS32K assembler */ + r_callj:1, /* 1 if relocation target is an i960 'callj' */ + nuthin:1; /* Unused */ + }; + +#endif /* CUSTOM_RELOC_FORMAT */ + +/* + * Macros to extract information from a symbol table entry. + * This syntactic indirection allows independence regarding a.out or coff. + * The argument (s) of all these macros is a pointer to a symbol table entry. + */ + +/* Predicates */ +/* True if the symbol is external */ +#define S_IS_EXTERNAL(s) ((s)->sy_symbol.n_type & N_EXT) + +/* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */ +#define S_IS_DEFINED(s) ((S_GET_TYPE(s) != N_UNDF) || (S_GET_DESC(s) != 0)) + +/* Return true for symbols that should not be reduced to section + symbols or eliminated from expressions, because they may be + overridden by the linker. */ +#define S_FORCE_RELOC(s, strict) \ + (!SEG_NORMAL (S_GET_SEGMENT (s))) + +#define S_IS_COMMON(s) \ + (S_GET_TYPE (s) == N_UNDF && S_GET_VALUE (s) != 0) + +#define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER) + +/* True if a debug special symbol entry */ +#define S_IS_DEBUG(s) ((s)->sy_symbol.n_type & N_STAB) +/* True if a symbol is local symbol name */ +#define S_IS_LOCAL(s) \ + ((S_GET_NAME (s) \ + && !S_IS_DEBUG (s) \ + && (strchr (S_GET_NAME (s), '\001') != NULL \ + || strchr (S_GET_NAME (s), '\002') != NULL \ + || (S_LOCAL_NAME(s) && !flag_keep_locals))) \ + || (flag_strip_local_absolute \ + && !S_IS_EXTERNAL(s) \ + && S_GET_SEGMENT(s) == absolute_section)) +/* True if a symbol is not defined in this file */ +#define S_IS_EXTERN(s) ((s)->sy_symbol.n_type & N_EXT) +/* True if the symbol has been generated because of a .stabd directive */ +#define S_IS_STABD(s) (S_GET_NAME(s) == NULL) + +/* Accessors */ +/* The name of the symbol */ +#define S_GET_NAME(s) ((s)->sy_symbol.n_un.n_name) +/* The pointer to the string table */ +#define S_GET_OFFSET(s) ((s)->sy_symbol.n_un.n_strx) +/* The type of the symbol */ +#define S_GET_TYPE(s) ((s)->sy_symbol.n_type & N_TYPE) +/* The numeric value of the segment */ +#define S_GET_SEGMENT(s) (N_TYPE_seg[S_GET_TYPE(s)]) +/* The n_other expression value */ +#define S_GET_OTHER(s) ((s)->sy_symbol.n_other) +/* The n_desc expression value */ +#define S_GET_DESC(s) ((s)->sy_symbol.n_desc) + +/* Modifiers */ +/* Assume that a symbol cannot be simultaneously in more than on segment */ +/* set segment */ +#define S_SET_SEGMENT(s,seg) ((s)->sy_symbol.n_type &= ~N_TYPE,(s)->sy_symbol.n_type|=SEGMENT_TO_SYMBOL_TYPE(seg)) +/* The symbol is external */ +#define S_SET_EXTERNAL(s) ((s)->sy_symbol.n_type |= N_EXT) +/* The symbol is not external */ +#define S_CLEAR_EXTERNAL(s) ((s)->sy_symbol.n_type &= ~N_EXT) +/* Set the name of the symbol */ +#define S_SET_NAME(s,v) ((s)->sy_symbol.n_un.n_name = (v)) +/* Set the offset in the string table */ +#define S_SET_OFFSET(s,v) ((s)->sy_symbol.n_un.n_strx = (v)) +/* Set the n_other expression value */ +#define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v)) +/* Set the n_desc expression value */ +#define S_SET_DESC(s,v) ((s)->sy_symbol.n_desc = (v)) +/* Set the n_type value */ +#define S_SET_TYPE(s,v) ((s)->sy_symbol.n_type = (v)) + +/* File header macro and type definition */ + +#define H_GET_FILE_SIZE(h) (sizeof (struct exec) + \ + H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \ + H_GET_SYMBOL_TABLE_SIZE(h) + \ + H_GET_TEXT_RELOCATION_SIZE(h) + \ + H_GET_DATA_RELOCATION_SIZE(h) + \ + (h)->string_table_size) + +#define H_GET_HEADER_SIZE(h) (sizeof (struct exec)) +#define H_GET_TEXT_SIZE(h) ((h)->header.a_text) +#define H_GET_DATA_SIZE(h) ((h)->header.a_data) +#define H_GET_BSS_SIZE(h) ((h)->header.a_bss) +#define H_GET_TEXT_RELOCATION_SIZE(h) ((h)->header.a_trsize) +#define H_GET_DATA_RELOCATION_SIZE(h) ((h)->header.a_drsize) +#define H_GET_SYMBOL_TABLE_SIZE(h) ((h)->header.a_syms) +#define H_GET_MAGIC_NUMBER(h) ((h)->header.a_info) +#define H_GET_ENTRY_POINT(h) ((h)->header.a_entry) +#define H_GET_STRING_SIZE(h) ((h)->string_table_size) +#define H_GET_LINENO_SIZE(h) (0) + +#ifdef EXEC_MACHINE_TYPE +#define H_GET_MACHINE_TYPE(h) ((h)->header.a_machtype) +#endif /* EXEC_MACHINE_TYPE */ +#ifdef EXEC_VERSION +#define H_GET_VERSION(h) ((h)->header.a_version) +#endif /* EXEC_VERSION */ + +#define H_SET_TEXT_SIZE(h,v) ((h)->header.a_text = (v)) +#define H_SET_DATA_SIZE(h,v) ((h)->header.a_data = (v)) +#define H_SET_BSS_SIZE(h,v) ((h)->header.a_bss = (v)) + +#define H_SET_RELOCATION_SIZE(h,t,d) (H_SET_TEXT_RELOCATION_SIZE((h),(t)),\ + H_SET_DATA_RELOCATION_SIZE((h),(d))) + +#define H_SET_TEXT_RELOCATION_SIZE(h,v) ((h)->header.a_trsize = (v)) +#define H_SET_DATA_RELOCATION_SIZE(h,v) ((h)->header.a_drsize = (v)) +#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * \ + sizeof (struct nlist)) + +#define H_SET_MAGIC_NUMBER(h,v) ((h)->header.a_magic = (v)) + +#define H_SET_ENTRY_POINT(h,v) ((h)->header.a_entry = (v)) +#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v)) +#ifdef EXEC_MACHINE_TYPE +#define H_SET_MACHINE_TYPE(h,v) ((h)->header.a_machtype = (v)) +#endif /* EXEC_MACHINE_TYPE */ +#ifdef EXEC_VERSION +#define H_SET_VERSION(h,v) ((h)->header.a_version = (v)) +#endif /* EXEC_VERSION */ + +typedef struct + { + struct exec header; /* a.out header */ + long string_table_size; /* names + '\0' + sizeof (int) */ + } + +object_headers; + +/* unused hooks. */ +#define OBJ_EMIT_LINENO(a, b, c) {;} +#define obj_pre_write_hook(a) {;} + +#if __STDC__ +struct fix; +#endif +extern void tc_aout_fix_to_chars PARAMS ((char *where, + struct fix *fixP, + relax_addressT segment_address)); +extern void tc_bout_fix_to_chars PARAMS ((char *where, + struct fix *fixP, + relax_addressT segment_address)); + +#define AOUT_STABS diff --git a/gas/config/obj-evax.c b/gas/config/obj-evax.c new file mode 100644 index 0000000000000..c2b5c873deacc --- /dev/null +++ b/gas/config/obj-evax.c @@ -0,0 +1,83 @@ +/* obj-evax.c - EVAX (openVMS/Alpha) object file format. + Copyright 1996, 1997 Free Software Foundation, Inc. + Contributed by Klaus Kämpf (kkaempf@progis.de) of + proGIS Software, Aachen, Germany. + + This file is part of GAS, the GNU Assembler + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +#define OBJ_HEADER "obj-evax.h" + +#include "as.h" + +static void s_evax_weak PARAMS ((int)); + +const pseudo_typeS obj_pseudo_table[] = +{ + { "weak", s_evax_weak, 0}, + {0, 0, 0}, +}; /* obj_pseudo_table */ + +void obj_read_begin_hook () {} + +/* Handle the weak specific pseudo-op. */ + +static void +s_evax_weak (ignore) + int ignore; +{ + char *name; + int c; + symbolS *symbolP; + char *stop = NULL; + char stopc; + + if (flag_mri) + stop = mri_comment_field (&stopc); + + do + { + name = input_line_pointer; + c = get_symbol_end (); + symbolP = symbol_find_or_make (name); + *input_line_pointer = c; + SKIP_WHITESPACE (); + S_SET_WEAK (symbolP); + if (c == ',') + { + input_line_pointer++; + SKIP_WHITESPACE (); + if (*input_line_pointer == '\n') + c = '\n'; + } + } + while (c == ','); + + if (flag_mri) + mri_comment_end (stop, stopc); + + demand_empty_rest_of_line (); +} + +/* + * Local Variables: + * comment-column: 0 + * fill-column: 131 + * End: + */ + +/* end of obj-evax.c */ diff --git a/gas/config/obj-evax.h b/gas/config/obj-evax.h new file mode 100644 index 0000000000000..98d704a186e22 --- /dev/null +++ b/gas/config/obj-evax.h @@ -0,0 +1,95 @@ +/* This file is obj-evax.h + Copyright 1996, 2000 Free Software Foundation, Inc. + Contributed by Klaus Kämpf (kkaempf@progis.de) of + proGIS Software, Aachen, Germany. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +/* + * This file is obj-evax.h and is intended to be a template for + * object format specific header files. + */ + +/* define an obj specific macro off which target cpu back ends may key. */ +#define OBJ_EVAX 1 + +/* include whatever target cpu is appropriate. */ +#include "targ-cpu.h" + +#ifdef BFD_ASSEMBLER +#define OUTPUT_FLAVOR bfd_target_evax_flavour +#endif + +/* + * SYMBOLS + */ + +/* + * If your object format needs to reorder symbols, define this. When + * defined, symbols are kept on a doubly linked list and functions are + * made available for push, insert, append, and delete. If not defined, + * symbols are kept on a singly linked list, only the append and clear + * facilities are available, and they are macros. + */ + +/* #define SYMBOLS_NEED_PACKPOINTERS */ + +/* */ +typedef struct + { + void *nothing; + } +obj_symbol_type; /* should be the format's symbol structure */ + +typedef void *object_headers; + +#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (0) /* your magic number */ + +#define OBJ_EMIT_LINENO(a,b,c) /* must be *something*. This no-op's it out. */ + +#define obj_symbol_new_hook(s) {;} + +#define S_SET_OTHER(S,V) +#define S_SET_TYPE(S,T) +#define S_SET_DESC(S,D) +#define S_GET_OTHER(S) 0 +#define S_GET_TYPE(S) 0 +#define S_GET_DESC(S) 0 + +#define PDSC_S_K_KIND_FP_STACK 9 +#define PDSC_S_K_KIND_FP_REGISTER 10 +#define PDSC_S_K_KIND_NULL 8 + +#define PDSC_S_K_MIN_STACK_SIZE 32 +#define PDSC_S_K_MIN_REGISTER_SIZE 24 +#define PDSC_S_K_NULL_SIZE 16 + +#define PDSC_S_M_BASE_REG_IS_FP 0x80 /* low byte */ +#define PDSC_S_M_NATIVE 0x10 /* high byte */ +#define PDSC_S_M_NO_JACKET 0x20 /* high byte */ + +#define LKP_S_K_SIZE 16 + +#define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) (P2VAR) = 3 + +/* + * Local Variables: + * comment-column: 0 + * fill-column: 131 + * End: + */ diff --git a/gas/config/obj-generic.c b/gas/config/obj-generic.c deleted file mode 100644 index 69fc3d1dbf963..0000000000000 --- a/gas/config/obj-generic.c +++ /dev/null @@ -1,41 +0,0 @@ -/* This file is obj-generic.c and is intended to be a template for - object format specific source files. - - Copyright (C) 1987-1992 Free Software Foundation, Inc. - - This file is part of GAS, the GNU Assembler. - - GAS is free software; 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. - - GAS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* Chars that can be used to separate mant from exp in floating point nums */ -char EXP_CHARS[] = "eE"; - -/* Chars that mean this number is a floating point constant */ -/* As in 0f12.456 */ -/* or 0d1.2345e12 */ -char FLT_CHARS[] = "rRsSfFdDxXpP"; - -/* These chars start a comment anywhere in a source file (except inside - another comment */ -const char comment_chars[] = "#"; - -/* - * Local Variables: - * comment-column: 0 - * fill-column: 131 - * End: - */ - -/* end of obj-generic.c */ diff --git a/gas/config/obj-generic.h b/gas/config/obj-generic.h deleted file mode 100644 index 8cb8020d0a42f..0000000000000 --- a/gas/config/obj-generic.h +++ /dev/null @@ -1,79 +0,0 @@ -/* This file is obj-generic.h - Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 2000 - Free Software Foundation, Inc. - - This file is part of GAS, the GNU Assembler. - - GAS is free software; 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. - - GAS is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GAS; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -/* - * This file is obj-generic.h and is intended to be a template for - * object format specific header files. - */ - -/* define an obj specific macro off which target cpu back ends may key. */ -#define OBJ_GENERIC 1 - -/* include whatever target cpu is appropriate. */ -#include "targ-cpu.h" - -/* - * SYMBOLS - */ - -/* - * If your object format needs to reorder symbols, define this. When - * defined, symbols are kept on a doubly linked list and functions are - * made available for push, insert, append, and delete. If not defined, - * symbols are kept on a singly linked list, only the append and clear - * facilities are available, and they are macros. - */ - -/* #define SYMBOLS_NEED_PACKPOINTERS */ - -/* */ -typedef struct - { - void *nothing; - } - -obj_symbol_type; /* should be the format's symbol structure */ - -typedef void *object_headers; - -/* symbols have names */ -#define S_GET_NAME(s) ("foo") /* get the name of a symbolP */ -#define S_SET_NAME(s,v) ; -/* symbols have segments */ -#define S_GET_SEGMENT(s) (SEG_UNKNOWN) -#define S_SET_SEGMENT(s,v) ; -/* symbols may be external */ -#define S_IS_EXTERNAL(s) (0) -#define S_SET_EXTERNAL(s) ; - -/* symbols may or may not be defined */ -#define S_IS_DEFINED(s) (0) - -#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (0) /* your magic number */ - -#define OBJ_EMIT_LINENO(a,b,c) /* must be *something*. This no-op's it out. */ - -/* - * Local Variables: - * comment-column: 0 - * fill-column: 131 - * End: - */ diff --git a/gas/config/obj-hp300.c b/gas/config/obj-hp300.c new file mode 100644 index 0000000000000..2fc0f25592909 --- /dev/null +++ b/gas/config/obj-hp300.c @@ -0,0 +1,53 @@ +/* This file is obj-hp300.h + Copyright 1993, 2000 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#include "config/obj-aout.c" + +/* Aout file generation & utilities */ +void +hp300_header_append (where, headers) + char **where; + object_headers *headers; +{ + tc_headers_hook (headers); + +#define DO(FIELD) \ + { \ + md_number_to_chars (*where, headers->header.FIELD, sizeof (headers->header.FIELD)); \ + *where += sizeof (headers->header.FIELD); \ + } + + DO (a_info); + DO (a_spare1); + DO (a_spare2); + DO (a_text); + DO (a_data); + DO (a_bss); + DO (a_trsize); + DO (a_drsize); + DO (a_spare3); + DO (a_spare4); + DO (a_spare5); + DO (a_entry); + DO (a_spare6); + DO (a_spare7); + DO (a_syms); + DO (a_spare8); +} diff --git a/gas/config/obj-hp300.h b/gas/config/obj-hp300.h new file mode 100644 index 0000000000000..8ff1f6778437f --- /dev/null +++ b/gas/config/obj-hp300.h @@ -0,0 +1,72 @@ +/* This file is obj-hp300.h + Copyright 1993, 2000 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#define __STRUCT_EXEC_OVERRIDE__ + +struct exec_bytes +{ + unsigned char a_info[4]; /* a_machtype/a_magic */ + unsigned char a_spare1[4]; + unsigned char a_spare2[4]; + unsigned char a_text[4]; /* length of text, in bytes */ + unsigned char a_data[4]; /* length of data, in bytes */ + unsigned char a_bss[4]; /* length of uninitialized data area for file, in bytes */ + unsigned char a_trsize[4]; /* length of relocation info for text, in bytes */ + unsigned char a_drsize[4]; /* length of relocation info for data, in bytes */ + unsigned char a_spare3[4]; /* HP = pascal interface size */ + unsigned char a_spare4[4]; /* HP = symbol table size */ + unsigned char a_spare5[4]; /* HP = debug name table size */ + unsigned char a_entry[4]; /* start address */ + unsigned char a_spare6[4]; /* HP = source line table size */ + unsigned char a_spare7[4]; /* HP = value table size */ + unsigned char a_syms[4]; /* length of symbol table data in file, in bytes */ + unsigned char a_spare8[4]; +}; + +/* How big the "struct exec" is on disk */ +#define EXEC_BYTES_SIZE (16 * 4) + +struct exec +{ + unsigned long a_info; + unsigned long a_spare1; + unsigned long a_spare2; + unsigned long a_text; + unsigned long a_data; + unsigned long a_bss; + unsigned long a_trsize; + unsigned long a_drsize; + unsigned long a_spare3; + unsigned long a_spare4; + unsigned long a_spare5; + unsigned long a_entry; + unsigned long a_spare6; + unsigned long a_spare7; + unsigned long a_syms; + unsigned long a_spare8; +}; + +#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (OMAGIC) +#define AOUT_VERSION 0x02 +#define AOUT_MACHTYPE 0x0c +#define OMAGIC 0x106 + +#define obj_header_append hp300_header_append +#include "config/obj-aout.h" diff --git a/gas/config/obj-som.c b/gas/config/obj-som.c new file mode 100644 index 0000000000000..454042a4f4199 --- /dev/null +++ b/gas/config/obj-som.c @@ -0,0 +1,347 @@ +/* SOM object file format. + Copyright 1993, 1994, 1998, 2000, 2002 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Written by the Center for Software Science at the University of Utah + and by Cygnus Support. */ + +#include "as.h" +#include "subsegs.h" +#include "aout/stab_gnu.h" +#include "obstack.h" + +static void obj_som_weak PARAMS ((int)); + +const pseudo_typeS obj_pseudo_table[] = +{ + {"weak", obj_som_weak, 0}, + {NULL, NULL, 0} +}; + +static int version_seen = 0; +static int copyright_seen = 0; +static int compiler_seen = 0; + +/* Unused by SOM. */ + +void +obj_read_begin_hook () +{ +} + +/* Handle a .compiler directive. This is intended to create the + compilation unit auxiliary header for MPE such that the linkeditor + can handle SOM extraction from archives. The format of the quoted + string is "sourcefile language version" and is delimited by blanks. */ + +void +obj_som_compiler (unused) + int unused; +{ + char *buf; + char c; + char *filename; + char *language_name; + char *p; + char *version_id; + + if (compiler_seen) + { + as_bad ("Only one .compiler pseudo-op per file!"); + ignore_rest_of_line (); + return; + } + + SKIP_WHITESPACE (); + if (*input_line_pointer == '\"') + { + buf = input_line_pointer; + ++input_line_pointer; + while (is_a_char (next_char_of_string ())) + ; + c = *input_line_pointer; + *input_line_pointer = '\000'; + } + else + { + as_bad ("Expected quoted string"); + ignore_rest_of_line (); + return; + } + + /* Parse the quoted string into its component parts. Skip the + quote. */ + filename = buf + 1; + p = filename; + while (*p != ' ' && *p != '\000') + p++; + if (*p == '\000') + { + as_bad (".compiler directive missing language and version"); + return; + } + *p = '\000'; + + language_name = ++p; + while (*p != ' ' && *p != '\000') + p++; + if (*p == '\000') + { + as_bad (".compiler directive missing version"); + return; + } + *p = '\000'; + + version_id = ++p; + while (*p != '\000') + p++; + /* Remove the trailing quote. */ + *(--p) = '\000'; + + compiler_seen = 1; + if (! bfd_som_attach_compilation_unit (stdoutput, filename, language_name, + "GNU Tools", version_id)) + { + bfd_perror (stdoutput->filename); + as_fatal ("FATAL: Attaching compiler header %s", stdoutput->filename); + } + *input_line_pointer = c; + demand_empty_rest_of_line (); +} + +/* Handle a .version directive. */ + +void +obj_som_version (unused) + int unused; +{ + char *version, c; + + if (version_seen) + { + as_bad (_("Only one .version pseudo-op per file!")); + ignore_rest_of_line (); + return; + } + + SKIP_WHITESPACE (); + if (*input_line_pointer == '\"') + { + version = input_line_pointer; + ++input_line_pointer; + while (is_a_char (next_char_of_string ())) + ; + c = *input_line_pointer; + *input_line_pointer = '\000'; + } + else + { + as_bad (_("Expected quoted string")); + ignore_rest_of_line (); + return; + } + + version_seen = 1; + if (!bfd_som_attach_aux_hdr (stdoutput, VERSION_AUX_ID, version)) + { + bfd_perror (stdoutput->filename); + as_perror (_("FATAL: Attaching version header %s"), + stdoutput->filename); + exit (EXIT_FAILURE); + } + *input_line_pointer = c; + demand_empty_rest_of_line (); +} + +/* Handle a .copyright directive. This probably isn't complete, but + it's of dubious value anyway and (IMHO) not worth the time to finish. + If you care about copyright strings that much, you fix it. */ + +void +obj_som_copyright (unused) + int unused; +{ + char *copyright, c; + + if (copyright_seen) + { + as_bad (_("Only one .copyright pseudo-op per file!")); + ignore_rest_of_line (); + return; + } + + SKIP_WHITESPACE (); + if (*input_line_pointer == '\"') + { + copyright = input_line_pointer; + ++input_line_pointer; + while (is_a_char (next_char_of_string ())) + ; + c = *input_line_pointer; + *input_line_pointer = '\000'; + } + else + { + as_bad (_("Expected quoted string")); + ignore_rest_of_line (); + return; + } + + copyright_seen = 1; + if (!bfd_som_attach_aux_hdr (stdoutput, COPYRIGHT_AUX_ID, copyright)) + { + bfd_perror (stdoutput->filename); + as_perror (_("FATAL: Attaching copyright header %s"), + stdoutput->filename); + exit (EXIT_FAILURE); + } + *input_line_pointer = c; + demand_empty_rest_of_line (); +} + +/* Perform any initialization necessary for stabs support. + + For SOM we need to create the space which will contain the + two stabs subspaces. Additionally we need to set up the + space/subspace relationships and set space/subspace attributes + which BFD does not understand. */ + +void +obj_som_init_stab_section (seg) + segT seg; +{ + segT saved_seg = now_seg; + segT space; + subsegT saved_subseg = now_subseg; + char *p, *file; + unsigned int stroff; + + /* Make the space which will contain the debug subspaces. */ + space = bfd_make_section_old_way (stdoutput, "$GDB_DEBUG$"); + + /* Set SOM specific attributes for the space. In particular we set + the space "defined", "private", "sort_key", and "spnum" values. + + Due to a bug in pxdb (called by hpux linker), the sort keys + of the various stabs spaces/subspaces need to be "small". We + reserve range 72/73 which appear to work well. */ + obj_set_section_attributes (space, 1, 1, 72, 2); + bfd_set_section_alignment (stdoutput, space, 2); + + /* Set the containing space for both stab sections to be $GDB_DEBUG$ + (just created above). Also set some attributes which BFD does + not understand. In particular, access bits, sort keys, and load + quadrant. */ + obj_set_subsection_attributes (seg, space, 0x1f, 73, 0); + bfd_set_section_alignment (stdoutput, seg, 2); + + /* Make some space for the first special stab entry and zero the memory. + It contains information about the length of this file's + stab string and the like. Using it avoids the need to + relocate the stab strings. + + The $GDB_STRINGS$ space will be created as a side effect of + the call to get_stab_string_offset. */ + p = frag_more (12); + memset (p, 0, 12); + as_where (&file, (unsigned int *) NULL); + stroff = get_stab_string_offset (file, "$GDB_STRINGS$"); + know (stroff == 1); + md_number_to_chars (p, stroff, 4); + seg_info (seg)->stabu.p = p; + + /* Set the containing space for both stab sections to be $GDB_DEBUG$ + (just created above). Also set some attributes which BFD does + not understand. In particular, access bits, sort keys, and load + quadrant. */ + seg = bfd_get_section_by_name (stdoutput, "$GDB_STRINGS$"); + obj_set_subsection_attributes (seg, space, 0x1f, 72, 0); + bfd_set_section_alignment (stdoutput, seg, 2); + + subseg_set (saved_seg, saved_subseg); +} + +/* Fill in the counts in the first entry in a .stabs section. */ + +static void +adjust_stab_sections (abfd, sec, xxx) + bfd *abfd; + asection *sec; + PTR xxx; +{ + asection *strsec; + char *p; + int strsz, nsyms; + + if (strcmp ("$GDB_SYMBOLS$", sec->name)) + return; + + strsec = bfd_get_section_by_name (abfd, "$GDB_STRINGS$"); + if (strsec) + strsz = bfd_section_size (abfd, strsec); + else + strsz = 0; + nsyms = bfd_section_size (abfd, sec) / 12 - 1; + + p = seg_info (sec)->stabu.p; + assert (p != 0); + + bfd_h_put_16 (abfd, (bfd_vma) nsyms, (bfd_byte *) p + 6); + bfd_h_put_32 (abfd, (bfd_vma) strsz, (bfd_byte *) p + 8); +} + +/* Called late in the assembly phase to adjust the special + stab entry and to set the starting address for each code subspace. */ + +void +som_frob_file () +{ + bfd_map_over_sections (stdoutput, adjust_stab_sections, (PTR) 0); +} + +static void +obj_som_weak (ignore) + int ignore ATTRIBUTE_UNUSED; +{ + char *name; + int c; + symbolS *symbolP; + + do + { + name = input_line_pointer; + c = get_symbol_end (); + symbolP = symbol_find_or_make (name); + *input_line_pointer = c; + SKIP_WHITESPACE (); + S_SET_WEAK (symbolP); +#if 0 + symbol_get_obj (symbolP)->local = 1; +#endif + if (c == ',') + { + input_line_pointer++; + SKIP_WHITESPACE (); + if (*input_line_pointer == '\n') + c = '\n'; + } + } + while (c == ','); + demand_empty_rest_of_line (); +} diff --git a/gas/config/obj-som.h b/gas/config/obj-som.h new file mode 100644 index 0000000000000..23d79eb2b118a --- /dev/null +++ b/gas/config/obj-som.h @@ -0,0 +1,73 @@ +/* SOM object file format. + Copyright 1993, 1994, 1995, 1998, 2000 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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 1, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + Written by the Center for Software Science at the University of Utah + and by Cygnus Support. */ + +#ifndef _OBJ_SOM_H +#define _OBJ_SOM_H + +#define OBJ_SOM 1 + +#include "bfd.h" +#include "bfd/som.h" +#include "targ-cpu.h" + +#ifndef FALSE +#define FALSE 0 +#define TRUE !FALSE +#endif + +/* should be conditional on address size! */ +#define som_symbol(asymbol) ((som_symbol_type *) (&(asymbol)->the_bfd)) + +extern void som_file_symbol PARAMS ((char *)); +extern void obj_som_version PARAMS ((int)); +extern void obj_som_init_stab_section PARAMS ((segT)); +extern void obj_som_copyright PARAMS ((int)); +extern void obj_som_compiler PARAMS ((int)); + +#define obj_symbol_new_hook(s) {;} + +/* SOM has several attributes for spaces/subspaces which can not + be easily expressed in BFD. We use these macros to trigger calls + into the SOM BFD backend to set these attributes. */ +#define obj_set_section_attributes bfd_som_set_section_attributes +#define obj_set_subsection_attributes bfd_som_set_subsection_attributes + +/* Likewise for symbol types. */ +#define obj_set_symbol_type bfd_som_set_symbol_type + +/* Stabs go in a separate sections. GDB expects to find them in sections + with the names $GDB_SYMBOLS$ and $GDB_STRINGS$ rather than .stab and + .stabstr. */ +#define SEPARATE_STAB_SECTIONS 1 +#define STAB_SECTION_NAME "$GDB_SYMBOLS$" +#define STAB_STRING_SECTION_NAME "$GDB_STRINGS$" + +/* We use INIT_STAB_SECTION to record the space/subspace relationships + for the various debugging sections. */ +#define INIT_STAB_SECTION(seg) obj_som_init_stab_section (seg) + +/* We'll be updating the magic 1st stab entry once the entire assembly + fail has been processed. */ +#define obj_frob_file() som_frob_file() + +#endif /* _OBJ_SOM_H */ diff --git a/gas/config/obj-vms.c b/gas/config/obj-vms.c new file mode 100644 index 0000000000000..18b4fd4096206 --- /dev/null +++ b/gas/config/obj-vms.c @@ -0,0 +1,4933 @@ +/* vms.c -- Write out a VAX/VMS object file + Copyright 1987, 1988, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001, + 2002, 2003 + Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* Written by David L. Kashtan */ +/* Modified by Eric Youngdale to write VMS debug records for program + variables */ + +/* Want all of obj-vms.h (as obj-format.h, via targ-env.h, via as.h). */ +#define WANT_VMS_OBJ_DEFS + +#include "as.h" +#include "config.h" +#include "safe-ctype.h" +#include "subsegs.h" +#include "obstack.h" +#include + +/* What we do if there is a goof. */ +#define error as_fatal + +#ifdef VMS /* These are of no use if we are cross assembling. */ +#include /* Define File Access Block. */ +#include /* Define NAM Block. */ +#include /* Define XAB - all different types. */ +extern int sys$open(), sys$close(), sys$asctim(); +#endif + +/* Version string of the compiler that produced the code we are + assembling. (And this assembler, if we do not have compiler info). */ +char *compiler_version_string; + +extern int flag_hash_long_names; /* -+ */ +extern int flag_one; /* -1; compatibility with gcc 1.x */ +extern int flag_show_after_trunc; /* -H */ +extern int flag_no_hash_mixed_case; /* -h NUM */ + +/* Flag that determines how we map names. This takes several values, and + is set with the -h switch. A value of zero implies names should be + upper case, and the presence of the -h switch inhibits the case hack. + No -h switch at all sets vms_name_mapping to 0, and allows case hacking. + A value of 2 (set with -h2) implies names should be + all lower case, with no case hack. A value of 3 (set with -h3) implies + that case should be preserved. */ + +/* If the -+ switch is given, then the hash is appended to any name that is + longer than 31 characters, regardless of the setting of the -h switch. */ + +char vms_name_mapping = 0; + +static symbolS *Entry_Point_Symbol = 0; /* Pointer to "_main" */ + +/* We augment the "gas" symbol structure with this. */ + +struct VMS_Symbol +{ + struct VMS_Symbol *Next; + symbolS *Symbol; + int Size; + int Psect_Index; + int Psect_Offset; +}; + +struct VMS_Symbol *VMS_Symbols = 0; +struct VMS_Symbol *Ctors_Symbols = 0; +struct VMS_Symbol *Dtors_Symbols = 0; + +/* We need this to keep track of the various input files, so that we can + give the debugger the correct source line. */ + +struct input_file +{ + struct input_file *next; + struct input_file *same_file_fpnt; + int file_number; + int max_line; + int min_line; + int offset; + char flag; + char *name; + symbolS *spnt; +}; + +static struct input_file *file_root = (struct input_file *) NULL; + +/* Styles of PSECTS (program sections) that we generate; just shorthand + to avoid lists of section attributes. Used by VMS_Psect_Spec(). */ +enum ps_type +{ + ps_TEXT, ps_DATA, ps_COMMON, ps_CONST, ps_CTORS, ps_DTORS +}; + +/* This enum is used to keep track of the various types of variables that + may be present. */ + +enum advanced_type +{ + BASIC, POINTER, ARRAY, ENUM, STRUCT, UNION, FUNCTION, VOID, ALIAS, UNKNOWN +}; + +/* This structure contains the information from the stabs directives, and the + information is filled in by VMS_typedef_parse. Everything that is needed + to generate the debugging record for a given symbol is present here. + This could be done more efficiently, using nested struct/unions, but for + now I am happy that it works. */ + +struct VMS_DBG_Symbol +{ + struct VMS_DBG_Symbol *next; + /* Description of what this is. */ + enum advanced_type advanced; + /* This record is for this type. */ + int dbx_type; + /* For advanced types this is the type referred to. I.e., the type + a pointer points to, or the type of object that makes up an + array. */ + int type2; + /* Use this type when generating a variable def. */ + int VMS_type; + /* Used for arrays - this will be present for all. */ + int index_min; + /* Entries, but will be meaningless for non-arrays. */ + int index_max; + /* Size in bytes of the data type. For an array, this is the size + of one element in the array. */ + int data_size; + /* Number of the structure/union/enum - used for ref. */ + int struc_numb; +}; + +#define SYMTYPLST_SIZE (1<<4) /* 16; Must be power of two. */ +#define SYMTYP_HASH(x) ((unsigned) (x) & (SYMTYPLST_SIZE - 1)) + +struct VMS_DBG_Symbol *VMS_Symbol_type_list[SYMTYPLST_SIZE]; + +/* We need this structure to keep track of forward references to + struct/union/enum that have not been defined yet. When they are + ultimately defined, then we can go back and generate the TIR + commands to make a back reference. */ + +struct forward_ref +{ + struct forward_ref *next; + int dbx_type; + int struc_numb; + char resolved; +}; + +struct forward_ref *f_ref_root = (struct forward_ref *) NULL; + +/* This routine is used to compare the names of certain types to various + fixed types that are known by the debugger. */ + +#define type_check(X) !strcmp (symbol_name, X) + +/* This variable is used to keep track of the name of the symbol we are + working on while we are parsing the stabs directives. */ + +static const char *symbol_name; + +/* We use this counter to assign numbers to all of the structures, unions + and enums that we define. When we actually declare a variable to the + debugger, we can simply do it by number, rather than describing the + whole thing each time. */ + +static int structure_count = 0; + +/* This variable is used to indicate that we are making the last attempt to + parse the stabs, and that we should define as much as we can, and ignore + the rest. */ + +static int final_pass; + +/* This variable is used to keep track of the current structure number + for a given variable. If this is < 0, that means that the structure + has not yet been defined to the debugger. This is still cool, since + the VMS object language has ways of fixing things up after the fact, + so we just make a note of this, and generate fixups at the end. */ + +static int struct_number; + +/* This is used to distinguish between D_float and G_float for telling + the debugger about doubles. gcc outputs the same .stabs regardless + of whether -mg is used to select alternate doubles. */ + +static int vax_g_doubles = 0; + +/* Local symbol references (used to handle N_ABS symbols; gcc does not + generate those, but they're possible with hand-coded assembler input) + are always made relative to some particular environment. If the current + input has any such symbols, then we expect this to get incremented + exactly once and end up having all of them be in environment #0. */ + +static int Current_Environment = -1; + +/* Every object file must specify an module name, which is also used by + traceback records. Set in Write_VMS_MHD_Records(). */ + +static char Module_Name[255+1]; + +/* Variable descriptors are used tell the debugger the data types of certain + more complicated variables (basically anything involving a structure, + union, enum, array or pointer). Some non-pointer variables of the + basic types that the debugger knows about do not require a variable + descriptor. + + Since it is impossible to have a variable descriptor longer than 128 + bytes by virtue of the way that the VMS object language is set up, + it makes not sense to make the arrays any longer than this, or worrying + about dynamic sizing of the array. + + These are the arrays and counters that we use to build a variable + descriptor. */ + +#define MAX_DEBUG_RECORD 128 +static char Local[MAX_DEBUG_RECORD]; /* Buffer for variable descriptor. */ +static char Asuffix[MAX_DEBUG_RECORD]; /* Buffer for array descriptor. */ +static int Lpnt; /* Index into Local. */ +static int Apoint; /* Index into Asuffix. */ +static char overflow; /* Flag to indicate we have written too much. */ +static int total_len; /* Used to calculate the total length of + variable descriptor plus array descriptor + - used for len byte. */ + +/* Flag if we have told user about finding global constants in the text + section. */ +static int gave_compiler_message = 0; + +/* Global data (Object records limited to 512 bytes by VAX-11 "C" runtime). */ + +static int VMS_Object_File_FD; /* File Descriptor for object file. */ +static char Object_Record_Buffer[512]; /* Buffer for object file records. */ +static size_t Object_Record_Offset; /* Offset to end of data. */ +static int Current_Object_Record_Type; /* Type of record in above. */ + +/* Macros for moving data around. Must work on big-endian systems. */ + +#ifdef VMS /* These are more efficient for VMS->VMS systems. */ +#define COPY_LONG(dest,val) ( *(long *) (dest) = (val) ) +#define COPY_SHORT(dest,val) ( *(short *) (dest) = (val) ) +#else +#define COPY_LONG(dest,val) md_number_to_chars ((dest), (val), 4) +#define COPY_SHORT(dest,val) md_number_to_chars ((dest), (val), 2) +#endif + +/* Macros for placing data into the object record buffer. */ + +#define PUT_LONG(val) \ + ( COPY_LONG (&Object_Record_Buffer[Object_Record_Offset], (val)), \ + Object_Record_Offset += 4 ) + +#define PUT_SHORT(val) \ + ( COPY_SHORT (&Object_Record_Buffer[Object_Record_Offset], (val)), \ + Object_Record_Offset += 2 ) + +#define PUT_CHAR(val) (Object_Record_Buffer[Object_Record_Offset++] = (val)) + +#define PUT_COUNTED_STRING(cp) \ + do \ + { \ + const char *p = (cp); \ + \ + PUT_CHAR ((char) strlen (p)); \ + while (*p) \ + PUT_CHAR (*p++); \ + } \ + while (0) + +/* Macro for determining if a Name has psect attributes attached + to it. */ + +#define PSECT_ATTRIBUTES_STRING "$$PsectAttributes_" +#define PSECT_ATTRIBUTES_STRING_LENGTH 18 + +#define HAS_PSECT_ATTRIBUTES(Name) \ + (strncmp ((*Name == '_' ? Name + 1 : Name), \ + PSECT_ATTRIBUTES_STRING, \ + PSECT_ATTRIBUTES_STRING_LENGTH) == 0) + + + /* in: segT out: N_TYPE bits */ +const short seg_N_TYPE[] = +{ + N_ABS, + N_TEXT, + N_DATA, + N_BSS, + N_UNDF, /* unknown */ + N_UNDF, /* error */ + N_UNDF, /* expression */ + N_UNDF, /* debug */ + N_UNDF, /* ntv */ + N_UNDF, /* ptv */ + N_REGISTER, /* register */ +}; + +const segT N_TYPE_seg[N_TYPE + 2] = +{ /* N_TYPE == 0x1E = 32-2 */ + SEG_UNKNOWN, /* N_UNDF == 0 */ + SEG_GOOF, + SEG_ABSOLUTE, /* N_ABS == 2 */ + SEG_GOOF, + SEG_TEXT, /* N_TEXT == 4 */ + SEG_GOOF, + SEG_DATA, /* N_DATA == 6 */ + SEG_GOOF, + SEG_BSS, /* N_BSS == 8 */ + SEG_GOOF, + SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, + SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, + SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, + SEG_REGISTER, /* dummy N_REGISTER for regs = 30 */ + SEG_GOOF, +}; + + +/* The following code defines the special types of pseudo-ops that we + use with VMS. */ + +unsigned char const_flag = IN_DEFAULT_SECTION; + +static void +s_const (int arg) +{ + /* Since we don't need `arg', use it as our scratch variable so that + we won't get any "not used" warnings about it. */ + arg = get_absolute_expression (); + subseg_set (SEG_DATA, (subsegT) arg); + const_flag = 1; + demand_empty_rest_of_line (); +} + +const pseudo_typeS obj_pseudo_table[] = +{ + {"const", s_const, 0}, + {0, 0, 0}, +}; /* obj_pseudo_table */ + +/* Routine to perform RESOLVE_SYMBOL_REDEFINITION(). */ + +int +vms_resolve_symbol_redef (symbolS *sym) +{ + /* If the new symbol is .comm AND it has a size of zero, + we ignore it (i.e. the old symbol overrides it). */ + if (SEGMENT_TO_SYMBOL_TYPE ((int) now_seg) == (N_UNDF | N_EXT) + && frag_now_fix () == 0) + { + as_warn (_("compiler emitted zero-size common symbol `%s' already defined"), + S_GET_NAME (sym)); + return 1; + } + /* If the old symbol is .comm and it has a size of zero, + we override it with the new symbol value. */ + if (S_IS_EXTERNAL (sym) && S_IS_DEFINED (sym) && S_GET_VALUE (sym) == 0) + { + as_warn (_("compiler redefined zero-size common symbol `%s'"), + S_GET_NAME (sym)); + sym->sy_frag = frag_now; + S_SET_OTHER (sym, const_flag); + S_SET_VALUE (sym, frag_now_fix ()); + /* Keep N_EXT bit. */ + sym->sy_symbol.n_type |= SEGMENT_TO_SYMBOL_TYPE ((int) now_seg); + return 1; + } + + return 0; +} + +/* `tc_frob_label' handler for colon(symbols.c), used to examine the + dummy label(s) gcc inserts at the beginning of each file it generates. + gcc 1.x put "gcc_compiled."; gcc 2.x (as of 2.7) puts "gcc2_compiled." + and "__gnu_language_" and possibly "__vax__doubles". */ + +void +vms_check_for_special_label (symbolS *symbolP) +{ + /* Special labels only occur prior to explicit section directives. */ + if ((const_flag & IN_DEFAULT_SECTION) != 0) + { + char *sym_name = S_GET_NAME (symbolP); + + if (*sym_name == '_') + ++sym_name; + + if (!strcmp (sym_name, "__vax_g_doubles")) + vax_g_doubles = 1; +#if 0 /* not necessary */ + else if (!strcmp (sym_name, "__vax_d_doubles")) + vax_g_doubles = 0; +#endif +#if 0 /* These are potential alternatives to tc-vax.c's md_parse_options(). */ + else if (!strcmp (sym_name, "gcc_compiled.")) + flag_one = 1; + else if (!strcmp (sym_name, "__gnu_language_cplusplus")) + flag_hash_long_names = 1; +#endif + } +} + +void +obj_read_begin_hook (void) +{ +} + +void +obj_crawl_symbol_chain (object_headers *headers) +{ + symbolS *symbolP; + symbolS **symbolPP; + int symbol_number = 0; + + symbolPP = &symbol_rootP; /* -> last symbol chain link. */ + while ((symbolP = *symbolPP) != NULL) + { + resolve_symbol_value (symbolP); + + /* OK, here is how we decide which symbols go out into the + brave new symtab. Symbols that do are: + + * symbols with no name (stabd's?) + * symbols with debug info in their N_TYPE + * symbols with \1 as their 3rd character (numeric labels) + * "local labels" needed for PIC fixups + + Symbols that don't are: + * symbols that are registers + + All other symbols are output. We complain if a deleted + symbol was marked external. */ + + if (!S_IS_REGISTER (symbolP)) + { + symbolP->sy_number = symbol_number++; + symbolP->sy_name_offset = 0; + symbolPP = &symbolP->sy_next; + } + else + { + if (S_IS_EXTERNAL (symbolP) || !S_IS_DEFINED (symbolP)) + as_bad (_("Local symbol %s never defined"), + S_GET_NAME (symbolP)); + + /* Unhook it from the chain. */ + *symbolPP = symbol_next (symbolP); + } + } + + H_SET_STRING_SIZE (headers, string_byte_count); + H_SET_SYMBOL_TABLE_SIZE (headers, symbol_number); +} + + +/* VMS OBJECT FILE HACKING ROUTINES. */ + +/* Create the VMS object file. */ + +static void +Create_VMS_Object_File (void) +{ +#ifdef eunice + VMS_Object_File_FD = creat (out_file_name, 0777, "var"); +#else +#ifndef VMS + VMS_Object_File_FD = creat (out_file_name, 0777); +#else /* VMS */ + VMS_Object_File_FD = creat (out_file_name, 0, "rfm=var", + "ctx=bin", "mbc=16", "deq=64", "fop=tef", + "shr=nil"); +#endif /* !VMS */ +#endif /* !eunice */ + /* Deal with errors. */ + if (VMS_Object_File_FD < 0) + as_fatal (_("Couldn't create VMS object file \"%s\""), out_file_name); + /* Initialize object file hacking variables. */ + Object_Record_Offset = 0; + Current_Object_Record_Type = -1; +} + +/* Flush the object record buffer to the object file. */ + +static void +Flush_VMS_Object_Record_Buffer (void) +{ + /* If the buffer is empty, there's nothing to do. */ + if (Object_Record_Offset == 0) + return; + +#ifndef VMS /* For cross-assembly purposes. */ + { + char RecLen[2]; + + /* "Variable-length record" files have a two byte length field + prepended to each record. It's normally out-of-band, and native + VMS output will insert it automatically for this type of file. + When cross-assembling, we must write it explicitly. */ + md_number_to_chars (RecLen, Object_Record_Offset, 2); + if (write (VMS_Object_File_FD, RecLen, 2) != 2) + error (_("I/O error writing VMS object file (length prefix)")); + /* We also need to force the actual record to be an even number of + bytes. For native output, that's automatic; when cross-assembling, + pad with a NUL byte if length is odd. Do so _after_ writing the + pre-padded length. Since our buffer is defined with even size, + an odd offset implies that it has some room left. */ + if ((Object_Record_Offset & 1) != 0) + Object_Record_Buffer[Object_Record_Offset++] = '\0'; + } +#endif /* not VMS */ + + /* Write the data to the file. */ + if ((size_t) write (VMS_Object_File_FD, Object_Record_Buffer, + Object_Record_Offset) != Object_Record_Offset) + error (_("I/O error writing VMS object file")); + + /* The buffer is now empty. */ + Object_Record_Offset = 0; +} + +/* Declare a particular type of object file record. */ + +static void +Set_VMS_Object_File_Record (int Type) +{ + /* If the type matches, we are done. */ + if (Type == Current_Object_Record_Type) + return; + /* Otherwise: flush the buffer. */ + Flush_VMS_Object_Record_Buffer (); + /* Remember the new type. */ + Current_Object_Record_Type = Type; +} + +/* Close the VMS Object file. */ + +static void +Close_VMS_Object_File (void) +{ + /* Flush (should never be necessary) and reset saved record-type context. */ + Set_VMS_Object_File_Record (-1); + +#ifndef VMS /* For cross-assembly purposes. */ + { + char RecLen[2]; + int minus_one = -1; + + /* Write a 2 byte record-length field of -1 into the file, which + means end-of-block when read, hence end-of-file when occurring + in the file's last block. It is only needed for variable-length + record files transferred to VMS as fixed-length record files + (typical for binary FTP; NFS shouldn't need it, but it won't hurt). */ + md_number_to_chars (RecLen, minus_one, 2); + write (VMS_Object_File_FD, RecLen, 2); + } +#else + /* When written on a VMS system, the file header (cf inode) will record + the actual end-of-file position and no inline marker is needed. */ +#endif + + close (VMS_Object_File_FD); +} + +/* Text Information and Relocation routines. */ + +/* Stack Psect base followed by signed, varying-sized offset. + Common to several object records. */ + +static void +vms_tir_stack_psect (int Psect_Index, int Offset, int Force) +{ + int psect_width, offset_width; + + psect_width = ((unsigned) Psect_Index > 255) ? 2 : 1; + offset_width = (Force || Offset > 32767 || Offset < -32768) ? 4 + : (Offset > 127 || Offset < -128) ? 2 : 1; +#define Sta_P(p,o) (((o)<<1) | ((p)-1)) + /* Byte or word psect; byte, word, or longword offset. */ + switch (Sta_P(psect_width,offset_width)) + { + case Sta_P(1,1): PUT_CHAR (TIR_S_C_STA_PB); + PUT_CHAR ((char) (unsigned char) Psect_Index); + PUT_CHAR ((char) Offset); + break; + case Sta_P(1,2): PUT_CHAR (TIR_S_C_STA_PW); + PUT_CHAR ((char) (unsigned char) Psect_Index); + PUT_SHORT (Offset); + break; + case Sta_P(1,4): PUT_CHAR (TIR_S_C_STA_PL); + PUT_CHAR ((char) (unsigned char) Psect_Index); + PUT_LONG (Offset); + break; + case Sta_P(2,1): PUT_CHAR (TIR_S_C_STA_WPB); + PUT_SHORT (Psect_Index); + PUT_CHAR ((char) Offset); + break; + case Sta_P(2,2): PUT_CHAR (TIR_S_C_STA_WPW); + PUT_SHORT (Psect_Index); + PUT_SHORT (Offset); + break; + case Sta_P(2,4): PUT_CHAR (TIR_S_C_STA_WPL); + PUT_SHORT (Psect_Index); + PUT_LONG (Offset); + break; + } +#undef Sta_P +} + +/* Store immediate data in current Psect. */ + +static void +VMS_Store_Immediate_Data (const char *Pointer, int Size, int Record_Type) +{ + int i; + + Set_VMS_Object_File_Record (Record_Type); + /* We can only store as most 128 bytes at a time due to the way that + TIR commands are encoded. */ + while (Size > 0) + { + i = (Size > 128) ? 128 : Size; + Size -= i; + /* If we cannot accommodate this record, flush the buffer. */ + if ((Object_Record_Offset + i + 1) >= sizeof Object_Record_Buffer) + Flush_VMS_Object_Record_Buffer (); + /* If the buffer is empty we must insert record type. */ + if (Object_Record_Offset == 0) + PUT_CHAR (Record_Type); + /* Store the count. The Store Immediate TIR command is implied by + a negative command byte, and the length of the immediate data + is abs(command_byte). So, we write the negated length value. */ + PUT_CHAR ((char) (-i & 0xff)); + /* Now store the data. */ + while (--i >= 0) + PUT_CHAR (*Pointer++); + } + /* Flush the buffer if it is more than 75% full. */ + if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4)) + Flush_VMS_Object_Record_Buffer (); +} + +/* Make a data reference. */ + +static void +VMS_Set_Data (int Psect_Index, int Offset, int Record_Type, int Force) +{ + Set_VMS_Object_File_Record (Record_Type); + /* If the buffer is empty we must insert the record type. */ + if (Object_Record_Offset == 0) + PUT_CHAR (Record_Type); + /* Stack the Psect base with its offset. */ + vms_tir_stack_psect (Psect_Index, Offset, Force); + /* Set relocation base. */ + PUT_CHAR (TIR_S_C_STO_PIDR); + /* Flush the buffer if it is more than 75% full. */ + if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4)) + Flush_VMS_Object_Record_Buffer (); +} + +/* Make a debugger reference to a struct, union or enum. */ + +static void +VMS_Store_Struct (int Struct_Index) +{ + /* We are writing a debug record. */ + Set_VMS_Object_File_Record (OBJ_S_C_DBG); + /* If the buffer is empty we must insert the record type. */ + if (Object_Record_Offset == 0) + PUT_CHAR (OBJ_S_C_DBG); + PUT_CHAR (TIR_S_C_STA_UW); + PUT_SHORT (Struct_Index); + PUT_CHAR (TIR_S_C_CTL_STKDL); + PUT_CHAR (TIR_S_C_STO_L); + /* Flush the buffer if it is more than 75% full. */ + if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4)) + Flush_VMS_Object_Record_Buffer (); +} + +/* Make a debugger reference to partially define a struct, union or enum. */ + +static void +VMS_Def_Struct (int Struct_Index) +{ + /* We are writing a debug record. */ + Set_VMS_Object_File_Record (OBJ_S_C_DBG); + /* If the buffer is empty we must insert the record type. */ + if (Object_Record_Offset == 0) + PUT_CHAR (OBJ_S_C_DBG); + PUT_CHAR (TIR_S_C_STA_UW); + PUT_SHORT (Struct_Index); + PUT_CHAR (TIR_S_C_CTL_DFLOC); + /* Flush the buffer if it is more than 75% full. */ + if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4)) + Flush_VMS_Object_Record_Buffer (); +} + +static void +VMS_Set_Struct (int Struct_Index) +{ + Set_VMS_Object_File_Record (OBJ_S_C_DBG); + if (Object_Record_Offset == 0) + PUT_CHAR (OBJ_S_C_DBG); + PUT_CHAR (TIR_S_C_STA_UW); + PUT_SHORT (Struct_Index); + PUT_CHAR (TIR_S_C_CTL_STLOC); + if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4)) + Flush_VMS_Object_Record_Buffer (); +} + +/* Traceback Information routines. */ + +/* Write the Traceback Module Begin record. */ + +static void +VMS_TBT_Module_Begin (void) +{ + char *cp, *cp1; + int Size; + char Local[256]; + + /* Arrange to store the data locally (leave room for size byte). */ + cp = &Local[1]; + /* Begin module. */ + *cp++ = DST_S_C_MODBEG; + *cp++ = 0; /* flags; not used */ + /* Language type == "C" + (FIXME: this should be based on the input...) */ + COPY_LONG (cp, DST_S_C_C); + cp += 4; + /* Store the module name. */ + *cp++ = (char) strlen (Module_Name); + cp1 = Module_Name; + while (*cp1) + *cp++ = *cp1++; + /* Now we can store the record size. */ + Size = (cp - Local); + Local[0] = Size - 1; + /* Put it into the object record. */ + VMS_Store_Immediate_Data (Local, Size, OBJ_S_C_TBT); +} + +/* Write the Traceback Module End record. */ + +static void +VMS_TBT_Module_End (void) +{ + char Local[2]; + + /* End module. */ + Local[0] = 1; + Local[1] = DST_S_C_MODEND; + /* Put it into the object record. */ + VMS_Store_Immediate_Data (Local, 2, OBJ_S_C_TBT); +} + +/* Write a Traceback Routine Begin record. */ + +static void +VMS_TBT_Routine_Begin (symbolS *symbolP, int Psect) +{ + char *cp, *cp1; + char *Name; + int Offset; + int Size; + char Local[512]; + + /* Strip the leading "_" from the name. */ + Name = S_GET_NAME (symbolP); + if (*Name == '_') + Name++; + /* Get the text psect offset. */ + Offset = S_GET_VALUE (symbolP); + /* Set the record size. */ + Size = 1 + 1 + 4 + 1 + strlen (Name); + Local[0] = Size; + /* DST type "routine begin". */ + Local[1] = DST_S_C_RTNBEG; + /* Uses CallS/CallG. */ + Local[2] = 0; + /* Store the data so far. */ + VMS_Store_Immediate_Data (Local, 3, OBJ_S_C_TBT); + /* Make sure we are still generating a OBJ_S_C_TBT record. */ + if (Object_Record_Offset == 0) + PUT_CHAR (OBJ_S_C_TBT); + /* Stack the address. */ + vms_tir_stack_psect (Psect, Offset, 0); + /* Store the data reference. */ + PUT_CHAR (TIR_S_C_STO_PIDR); + /* Store the counted string as data. */ + cp = Local; + cp1 = Name; + Size = strlen (cp1) + 1; + *cp++ = Size - 1; + while (*cp1) + *cp++ = *cp1++; + VMS_Store_Immediate_Data (Local, Size, OBJ_S_C_TBT); +} + +/* Write a Traceback Routine End record. + + We *must* search the symbol table to find the next routine, since the + assembler has a way of reassembling the symbol table OUT OF ORDER Thus + the next routine in the symbol list is not necessarily the next one in + memory. For debugging to work correctly we must know the size of the + routine. */ + +static void +VMS_TBT_Routine_End (int Max_Size, symbolS *sp) +{ + symbolS *symbolP; + unsigned long Size = 0x7fffffff; + char Local[16]; + valueT sym_value, sp_value = S_GET_VALUE (sp); + + for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP)) + { + if (!S_IS_DEBUG (symbolP) && S_GET_TYPE (symbolP) == N_TEXT) + { + if (*S_GET_NAME (symbolP) == 'L') + continue; + sym_value = S_GET_VALUE (symbolP); + if (sym_value > sp_value && sym_value < Size) + Size = sym_value; + + /* Dummy labels like "gcc_compiled." should no longer reach here. */ +#if 0 + else + /* Check if gcc_compiled. has size of zero. */ + if (sym_value == sp_value && + sp != symbolP && + (!strcmp (S_GET_NAME (sp), "gcc_compiled.") || + !strcmp (S_GET_NAME (sp), "gcc2_compiled."))) + Size = sym_value; +#endif + } + } + if (Size == 0x7fffffff) + Size = Max_Size; + Size -= sp_value; /* and get the size of the routine */ + /* Record Size. */ + Local[0] = 6; + /* DST type is "routine end". */ + Local[1] = DST_S_C_RTNEND; + Local[2] = 0; /* unused */ + /* Size of routine. */ + COPY_LONG (&Local[3], Size); + /* Store the record. */ + VMS_Store_Immediate_Data (Local, 7, OBJ_S_C_TBT); +} + +/* Write a Traceback Block Begin record. */ + +static void +VMS_TBT_Block_Begin (symbolS *symbolP, int Psect, char *Name) +{ + char *cp, *cp1; + int Offset; + int Size; + char Local[512]; + + /* Set the record size. */ + Size = 1 + 1 + 4 + 1 + strlen (Name); + Local[0] = Size; + /* DST type is "begin block"; we simulate with a phony routine. */ + Local[1] = DST_S_C_BLKBEG; + /* Uses CallS/CallG. */ + Local[2] = 0; + /* Store the data so far. */ + VMS_Store_Immediate_Data (Local, 3, OBJ_S_C_DBG); + /* Make sure we are still generating a debug record. */ + if (Object_Record_Offset == 0) + PUT_CHAR (OBJ_S_C_DBG); + /* Now get the symbol address. */ + PUT_CHAR (TIR_S_C_STA_WPL); + PUT_SHORT (Psect); + /* Get the text psect offset. */ + Offset = S_GET_VALUE (symbolP); + PUT_LONG (Offset); + /* Store the data reference. */ + PUT_CHAR (TIR_S_C_STO_PIDR); + /* Store the counted string as data. */ + cp = Local; + cp1 = Name; + Size = strlen (cp1) + 1; + *cp++ = Size - 1; + while (*cp1) + *cp++ = *cp1++; + VMS_Store_Immediate_Data (Local, Size, OBJ_S_C_DBG); +} + +/* Write a Traceback Block End record. */ + +static void +VMS_TBT_Block_End (valueT Size) +{ + char Local[16]; + + Local[0] = 6; /* record length */ + /* DST type is "block end"; simulate with a phony end routine. */ + Local[1] = DST_S_C_BLKEND; + Local[2] = 0; /* unused, must be zero */ + COPY_LONG (&Local[3], Size); + VMS_Store_Immediate_Data (Local, 7, OBJ_S_C_DBG); +} + + +/* Write a Line number <-> Program Counter correlation record. */ + +static void +VMS_TBT_Line_PC_Correlation (int Line_Number, int Offset, + int Psect, int Do_Delta) +{ + char *cp; + char Local[64]; + + if (Do_Delta == 0) + { + /* If not delta, set our PC/Line number correlation. */ + cp = &Local[1]; /* Put size in Local[0] later. */ + /* DST type is "Line Number/PC correlation". */ + *cp++ = DST_S_C_LINE_NUM; + /* Set Line number. */ + if (Line_Number - 1 <= 255) + { + *cp++ = DST_S_C_SET_LINUM_B; + *cp++ = (char) (Line_Number - 1); + } + else if (Line_Number - 1 <= 65535) + { + *cp++ = DST_S_C_SET_LINE_NUM; + COPY_SHORT (cp, Line_Number - 1), cp += 2; + } + else + { + *cp++ = DST_S_C_SET_LINUM_L; + COPY_LONG (cp, Line_Number - 1), cp += 4; + } + /* Set PC. */ + *cp++ = DST_S_C_SET_ABS_PC; + /* Store size now that we know it, then output the data. */ + Local[0] = cp - &Local[1]; + /* Account for the space that TIR_S_C_STO_PIDR will use for the PC. */ + Local[0] += 4; /* size includes length of another longword */ + VMS_Store_Immediate_Data (Local, cp - Local, OBJ_S_C_TBT); + /* Make sure we are still generating a OBJ_S_C_TBT record. */ + if (Object_Record_Offset == 0) + PUT_CHAR (OBJ_S_C_TBT); + vms_tir_stack_psect (Psect, Offset, 0); + PUT_CHAR (TIR_S_C_STO_PIDR); + /* Do a PC offset of 0 to register the line number. */ + Local[0] = 2; + Local[1] = DST_S_C_LINE_NUM; + Local[2] = 0; /* Increment PC by 0 and register line # */ + VMS_Store_Immediate_Data (Local, 3, OBJ_S_C_TBT); + } + else + { + if (Do_Delta < 0) + { + /* When delta is negative, terminate the line numbers. */ + Local[0] = 1 + 1 + 4; + Local[1] = DST_S_C_LINE_NUM; + Local[2] = DST_S_C_TERM_L; + COPY_LONG (&Local[3], Offset); + VMS_Store_Immediate_Data (Local, 7, OBJ_S_C_TBT); + return; + } + /* Do a PC/Line delta. */ + cp = &Local[1]; + *cp++ = DST_S_C_LINE_NUM; + if (Line_Number > 1) + { + /* We need to increment the line number. */ + if (Line_Number - 1 <= 255) + { + *cp++ = DST_S_C_INCR_LINUM; + *cp++ = Line_Number - 1; + } + else if (Line_Number - 1 <= 65535) + { + *cp++ = DST_S_C_INCR_LINUM_W; + COPY_SHORT (cp, Line_Number - 1), cp += 2; + } + else + { + *cp++ = DST_S_C_INCR_LINUM_L; + COPY_LONG (cp, Line_Number - 1), cp += 4; + } + } + /* Increment the PC. */ + if (Offset <= 128) + { + /* Small offsets are encoded as negative numbers, rather than the + usual non-negative type code followed by another data field. */ + *cp++ = (char) -Offset; + } + else if (Offset <= 65535) + { + *cp++ = DST_S_C_DELTA_PC_W; + COPY_SHORT (cp, Offset), cp += 2; + } + else + { + *cp++ = DST_S_C_DELTA_PC_L; + COPY_LONG (cp, Offset), cp += 4; + } + /* Set size now that be know it, then output the data. */ + Local[0] = cp - &Local[1]; + VMS_Store_Immediate_Data (Local, cp - Local, OBJ_S_C_TBT); + } +} + + +/* Describe a source file to the debugger. */ + +static int +VMS_TBT_Source_File (char *Filename, int ID_Number) +{ + char *cp; + int len, rfo, ffb, ebk; + char cdt[8]; + char Local[512]; +#ifdef VMS /* Used for native assembly */ + unsigned Status; + struct FAB fab; /* RMS file access block */ + struct NAM nam; /* file name information */ + struct XABDAT xabdat; /* date+time fields */ + struct XABFHC xabfhc; /* file header characteristics */ + char resultant_string_buffer[255 + 1]; + + /* Set up RMS structures: */ + /* FAB -- file access block */ + memset ((char *) &fab, 0, sizeof fab); + fab.fab$b_bid = FAB$C_BID; + fab.fab$b_bln = (unsigned char) sizeof fab; + fab.fab$l_fna = Filename; + fab.fab$b_fns = (unsigned char) strlen (Filename); + fab.fab$l_nam = (char *) &nam; + fab.fab$l_xab = (char *) &xabdat; + /* NAM -- file name block. */ + memset ((char *) &nam, 0, sizeof nam); + nam.nam$b_bid = NAM$C_BID; + nam.nam$b_bln = (unsigned char) sizeof nam; + nam.nam$l_rsa = resultant_string_buffer; + nam.nam$b_rss = (unsigned char) (sizeof resultant_string_buffer - 1); + /* XABs -- extended attributes blocks. */ + memset ((char *) &xabdat, 0, sizeof xabdat); + xabdat.xab$b_cod = XAB$C_DAT; + xabdat.xab$b_bln = (unsigned char) sizeof xabdat; + xabdat.xab$l_nxt = (char *) &xabfhc; + memset ((char *) &xabfhc, 0, sizeof xabfhc); + xabfhc.xab$b_cod = XAB$C_FHC; + xabfhc.xab$b_bln = (unsigned char) sizeof xabfhc; + xabfhc.xab$l_nxt = 0; + + /* Get the file information. */ + Status = sys$open (&fab); + if (!(Status & 1)) + { + as_tsktsk (_("Couldn't find source file \"%s\", status=%%X%x"), + Filename, Status); + return 0; + } + sys$close (&fab); + /* Now extract fields of interest. */ + memcpy (cdt, (char *) &xabdat.xab$q_cdt, 8); /* creation date */ + ebk = xabfhc.xab$l_ebk; /* end-of-file block */ + ffb = xabfhc.xab$w_ffb; /* first free byte of last block */ + rfo = xabfhc.xab$b_rfo; /* record format */ + len = nam.nam$b_rsl; /* length of Filename */ + resultant_string_buffer[len] = '\0'; + Filename = resultant_string_buffer; /* full filename */ +#else /* Cross-assembly */ + /* [Perhaps we ought to use actual values derived from stat() here?] */ + memset (cdt, 0, 8); /* null VMS quadword binary time */ + ebk = ffb = rfo = 0; + len = strlen (Filename); + if (len > 255) /* a single byte is used as count prefix */ + { + Filename += (len - 255); /* tail end is more significant */ + len = 255; + } +#endif /* VMS */ + + cp = &Local[1]; /* fill in record length later */ + *cp++ = DST_S_C_SOURCE; /* DST type is "source file" */ + *cp++ = DST_S_C_SRC_FORMFEED; /* formfeeds count as source records */ + *cp++ = DST_S_C_SRC_DECLFILE; /* declare source file */ + know (cp == &Local[4]); + *cp++ = 0; /* fill in this length below */ + *cp++ = 0; /* flags; must be zero */ + COPY_SHORT (cp, ID_Number), cp += 2; /* file ID number */ + memcpy (cp, cdt, 8), cp += 8; /* creation date+time */ + COPY_LONG (cp, ebk), cp += 4; /* end-of-file block */ + COPY_SHORT (cp, ffb), cp += 2; /* first free byte of last block */ + *cp++ = (char) rfo; /* RMS record format */ + /* Filename. */ + *cp++ = (char) len; + while (--len >= 0) + *cp++ = *Filename++; + /* Library module name (none). */ + *cp++ = 0; + /* Now that size is known, fill it in and write out the record. */ + Local[4] = cp - &Local[5]; /* source file declaration size */ + Local[0] = cp - &Local[1]; /* TBT record size */ + VMS_Store_Immediate_Data (Local, cp - Local, OBJ_S_C_TBT); + return 1; +} + +/* Traceback information is described in terms of lines from compiler + listing files, not lines from source files. We need to set up the + correlation between listing line numbers and source line numbers. + Since gcc's .stabn directives refer to the source lines, we just + need to describe a one-to-one correspondence. */ + +static void +VMS_TBT_Source_Lines (int ID_Number, int Starting_Line_Number, + int Number_Of_Lines) +{ + char *cp; + int chunk_limit; + char Local[128]; /* room enough to describe 1310700 lines... */ + + cp = &Local[1]; /* Put size in Local[0] later. */ + *cp++ = DST_S_C_SOURCE; /* DST type is "source file". */ + *cp++ = DST_S_C_SRC_SETFILE; /* Set Source File. */ + COPY_SHORT (cp, ID_Number), cp += 2; /* File ID Number. */ + /* Set record number and define lines. Since no longword form of + SRC_DEFLINES is available, we need to be able to cope with any huge + files a chunk at a time. It doesn't matter for tracebacks, since + unspecified lines are mapped one-to-one and work out right, but it + does matter within the debugger. Without this explicit mapping, + it will complain about lines not existing in the module. */ + chunk_limit = (sizeof Local - 5) / 6; + if (Number_Of_Lines > 65535 * chunk_limit) /* avoid buffer overflow */ + Number_Of_Lines = 65535 * chunk_limit; + while (Number_Of_Lines > 65535) + { + *cp++ = DST_S_C_SRC_SETREC_L; + COPY_LONG (cp, Starting_Line_Number), cp += 4; + *cp++ = DST_S_C_SRC_DEFLINES_W; + COPY_SHORT (cp, 65535), cp += 2; + Starting_Line_Number += 65535; + Number_Of_Lines -= 65535; + } + /* Set record number and define lines, normal case. */ + if (Starting_Line_Number <= 65535) + { + *cp++ = DST_S_C_SRC_SETREC_W; + COPY_SHORT (cp, Starting_Line_Number), cp += 2; + } + else + { + *cp++ = DST_S_C_SRC_SETREC_L; + COPY_LONG (cp, Starting_Line_Number), cp += 4; + } + *cp++ = DST_S_C_SRC_DEFLINES_W; + COPY_SHORT (cp, Number_Of_Lines), cp += 2; + /* Set size now that be know it, then output the data. */ + Local[0] = cp - &Local[1]; + VMS_Store_Immediate_Data (Local, cp - Local, OBJ_S_C_TBT); +} + + +/* Debugger Information support routines. */ + +/* This routine locates a file in the list of files. If an entry does + not exist, one is created. For include files, a new entry is always + created such that inline functions can be properly debugged. */ + +static struct input_file * +find_file (symbolS *sp) +{ + struct input_file *same_file = 0; + struct input_file *fpnt, *last = 0; + char *sp_name; + + for (fpnt = file_root; fpnt; fpnt = fpnt->next) + { + if (fpnt->spnt == sp) + return fpnt; + last = fpnt; + } + sp_name = S_GET_NAME (sp); + for (fpnt = file_root; fpnt; fpnt = fpnt->next) + { + if (strcmp (sp_name, fpnt->name) == 0) + { + if (fpnt->flag == 1) + return fpnt; + same_file = fpnt; + break; + } + } + fpnt = xmalloc (sizeof (struct input_file)); + if (!file_root) + file_root = fpnt; + else + last->next = fpnt; + fpnt->next = 0; + fpnt->name = sp_name; + fpnt->min_line = 0x7fffffff; + fpnt->max_line = 0; + fpnt->offset = 0; + fpnt->flag = 0; + fpnt->file_number = 0; + fpnt->spnt = sp; + fpnt->same_file_fpnt = same_file; + return fpnt; +} + +/* This routine converts a number string into an integer, and stops when + it sees an invalid character. The return value is the address of the + character just past the last character read. No error is generated. */ + +static char * +cvt_integer (char *str, int *rtn) +{ + int ival = 0, sgn = 1; + + if (*str == '-') + sgn = -1, ++str; + while (*str >= '0' && *str <= '9') + ival = 10 * ival + *str++ - '0'; + *rtn = sgn * ival; + return str; +} + + +/* The following functions and definitions are used to generate object + records that will describe program variables to the VMS debugger. + + This file contains many of the routines needed to output debugging info + into the object file that the VMS debugger needs to understand symbols. + These routines are called very late in the assembly process, and thus + we can be fairly lax about changing things, since the GSD and the TIR + sections have already been output. */ + +/* This routine fixes the names that are generated by C++, ".this" is a good + example. The period does not work for the debugger, since it looks like + the syntax for a structure element, and thus it gets mightily confused. + + We also use this to strip the PsectAttribute hack from the name before we + write a debugger record. */ + +static char * +fix_name (char *pnt) +{ + char *pnt1; + + /* Kill any leading "_". */ + if (*pnt == '_') + pnt++; + + /* Is there a Psect Attribute to skip?? */ + if (HAS_PSECT_ATTRIBUTES (pnt)) + { + /* Yes: Skip it. */ + pnt += PSECT_ATTRIBUTES_STRING_LENGTH; + while (*pnt) + { + if ((pnt[0] == '$') && (pnt[1] == '$')) + { + pnt += 2; + break; + } + pnt++; + } + } + + /* Here we fix the .this -> $this conversion. */ + for (pnt1 = pnt; *pnt1 != 0; pnt1++) + if (*pnt1 == '.') + *pnt1 = '$'; + + return pnt; +} + +/* When defining a structure, this routine is called to find the name of + the actual structure. It is assumed that str points to the equal sign + in the definition, and it moves backward until it finds the start of the + name. If it finds a 0, then it knows that this structure def is in the + outermost level, and thus symbol_name points to the symbol name. */ + +static char * +get_struct_name (char *str) +{ + char *pnt; + pnt = str; + while ((*pnt != ':') && (*pnt != '\0')) + pnt--; + if (*pnt == '\0') + return (char *) symbol_name; + *pnt-- = '\0'; + while ((*pnt != ';') && (*pnt != '=')) + pnt--; + if (*pnt == ';') + return pnt + 1; + while ((*pnt < '0') || (*pnt > '9')) + pnt++; + while ((*pnt >= '0') && (*pnt <= '9')) + pnt++; + return pnt; +} + +/* Search symbol list for type number dbx_type. + Return a pointer to struct. */ + +static struct VMS_DBG_Symbol * +find_symbol (int dbx_type) +{ + struct VMS_DBG_Symbol *spnt; + + spnt = VMS_Symbol_type_list[SYMTYP_HASH (dbx_type)]; + while (spnt) + { + if (spnt->dbx_type == dbx_type) + break; + spnt = spnt->next; + } + if (!spnt || spnt->advanced != ALIAS) + return spnt; + return find_symbol (spnt->type2); +} + +#if 0 /* obsolete */ +/* This routine puts info into either Local or Asuffix, depending on the sign + of size. The reason is that it is easier to build the variable descriptor + backwards, while the array descriptor is best built forwards. In the end + they get put together, if there is not a struct/union/enum along the way. */ + +static void +push (int value, int size1) +{ + if (size1 < 0) + { + size1 = -size1; + if (Lpnt < size1) + { + overflow = 1; + Lpnt = 1; + return; + } + Lpnt -= size1; + md_number_to_chars (&Local[Lpnt + 1], value, size1); + } + else + { + if (Apoint + size1 >= MAX_DEBUG_RECORD) + { + overflow = 1; + Apoint = MAX_DEBUG_RECORD - 1; + return; + } + md_number_to_chars (&Asuffix[Apoint], value, size1); + Apoint += size1; + } +} +#endif + +static void +fpush (int value, int size) +{ + if (Apoint + size >= MAX_DEBUG_RECORD) + { + overflow = 1; + Apoint = MAX_DEBUG_RECORD - 1; + return; + } + if (size == 1) + Asuffix[Apoint++] = (char) value; + else + { + md_number_to_chars (&Asuffix[Apoint], value, size); + Apoint += size; + } +} + +static void +rpush (int value, int size) +{ + if (Lpnt < size) + { + overflow = 1; + Lpnt = 1; + return; + } + if (size == 1) + Local[Lpnt--] = (char) value; + else + { + Lpnt -= size; + md_number_to_chars (&Local[Lpnt + 1], value, size); + } +} + +/* This routine generates the array descriptor for a given array. */ + +static void +array_suffix (struct VMS_DBG_Symbol *spnt2) +{ + struct VMS_DBG_Symbol *spnt; + struct VMS_DBG_Symbol *spnt1; + int rank; + int total_size; + + rank = 0; + spnt = spnt2; + while (spnt->advanced != ARRAY) + { + spnt = find_symbol (spnt->type2); + if (!spnt) + return; + } + spnt1 = spnt; + total_size = 1; + while (spnt1->advanced == ARRAY) + { + rank++; + total_size *= (spnt1->index_max - spnt1->index_min + 1); + spnt1 = find_symbol (spnt1->type2); + } + total_size = total_size * spnt1->data_size; + fpush (spnt1->data_size, 2); /* element size */ + if (spnt1->VMS_type == DBG_S_C_ADVANCED_TYPE) + fpush (0, 1); + else + fpush (spnt1->VMS_type, 1); /* element type */ + fpush (DSC_K_CLASS_A, 1); /* descriptor class */ + fpush (0, 4); /* base address */ + fpush (0, 1); /* scale factor -- not applicable */ + fpush (0, 1); /* digit count -- not applicable */ + fpush (0xc0, 1); /* flags: multiplier block & bounds present */ + fpush (rank, 1); /* number of dimensions */ + fpush (total_size, 4); + fpush (0, 4); /* pointer to element [0][0]...[0] */ + spnt1 = spnt; + while (spnt1->advanced == ARRAY) + { + fpush (spnt1->index_max - spnt1->index_min + 1, 4); + spnt1 = find_symbol (spnt1->type2); + } + spnt1 = spnt; + while (spnt1->advanced == ARRAY) + { + fpush (spnt1->index_min, 4); + fpush (spnt1->index_max, 4); + spnt1 = find_symbol (spnt1->type2); + } +} + +/* This routine generates the start of a variable descriptor based upon + a struct/union/enum that has yet to be defined. We define this spot as + a new location, and save four bytes for the address. When the struct is + finally defined, then we can go back and plug in the correct address. */ + +static void +new_forward_ref (int dbx_type) +{ + struct forward_ref *fpnt; + + fpnt = xmalloc (sizeof (struct forward_ref)); + fpnt->next = f_ref_root; + f_ref_root = fpnt; + fpnt->dbx_type = dbx_type; + fpnt->struc_numb = ++structure_count; + fpnt->resolved = 'N'; + rpush (DST_K_TS_IND, 1); /* indirect type specification */ + total_len = 5; + rpush (total_len, 2); + struct_number = -fpnt->struc_numb; +} + +/* This routine generates the variable descriptor used to describe non-basic + variables. It calls itself recursively until it gets to the bottom of it + all, and then builds the descriptor backwards. It is easiest to do it + this way since we must periodically write length bytes, and it is easiest + if we know the value when it is time to write it. */ + +static int +gen1 (struct VMS_DBG_Symbol *spnt, int array_suffix_len) +{ + struct VMS_DBG_Symbol *spnt1; + int i; + + switch (spnt->advanced) + { + case VOID: + rpush (DBG_S_C_VOID, 1); + total_len += 1; + rpush (total_len, 2); + return 0; + case BASIC: + case FUNCTION: + if (array_suffix_len == 0) + { + rpush (spnt->VMS_type, 1); + rpush (DBG_S_C_BASIC, 1); + total_len = 2; + rpush (total_len, 2); + return 1; + } + rpush (0, 4); + rpush (DST_K_VFLAGS_DSC, 1); + rpush (DST_K_TS_DSC, 1); /* Descriptor type specification. */ + total_len = -2; + return 1; + case STRUCT: + case UNION: + case ENUM: + struct_number = spnt->struc_numb; + if (struct_number < 0) + { + new_forward_ref (spnt->dbx_type); + return 1; + } + rpush (DBG_S_C_STRUCT, 1); + total_len = 5; + rpush (total_len, 2); + return 1; + case POINTER: + spnt1 = find_symbol (spnt->type2); + i = 1; + if (!spnt1) + new_forward_ref (spnt->type2); + else + i = gen1 (spnt1, 0); + if (i) + { + /* (*void) is a special case, do not put pointer suffix. */ + rpush (DBG_S_C_POINTER, 1); + total_len += 3; + rpush (total_len, 2); + } + return 1; + case ARRAY: + spnt1 = spnt; + while (spnt1->advanced == ARRAY) + { + spnt1 = find_symbol (spnt1->type2); + if (!spnt1) + { + as_tsktsk (_("debugger forward reference error, dbx type %d"), + spnt->type2); + return 0; + } + } + /* It is too late to generate forward references, so the user + gets a message. This should only happen on a compiler error. */ + (void) gen1 (spnt1, 1); + i = Apoint; + array_suffix (spnt); + array_suffix_len = Apoint - i; + switch (spnt1->advanced) + { + case BASIC: + case FUNCTION: + break; + default: + rpush (0, 2); + total_len += 2; + rpush (total_len, 2); + rpush (DST_K_VFLAGS_DSC, 1); + rpush (1, 1); /* Flags: element value spec included. */ + rpush (1, 1); /* One dimension. */ + rpush (DBG_S_C_COMPLEX_ARRAY, 1); + } + total_len += array_suffix_len + 8; + rpush (total_len, 2); + break; + default: + break; + } + return 0; +} + +/* This generates a suffix for a variable. If it is not a defined type yet, + then dbx_type contains the type we are expecting so we can generate a + forward reference. This calls gen1 to build most of the descriptor, and + then it puts the icing on at the end. It then dumps whatever is needed + to get a complete descriptor (i.e. struct reference, array suffix). */ + +static void +generate_suffix (struct VMS_DBG_Symbol *spnt, int dbx_type) +{ + static const char pvoid[6] = + { + 5, /* record.length == 5 */ + DST_K_TYPSPEC, /* record.type == 1 (type specification) */ + 0, /* name.length == 0, no name follows */ + 1, 0, /* type.length == 1 {2 bytes, little endian} */ + DBG_S_C_VOID /* type.type == 5 (pointer to unspecified) */ + }; + int i; + + Apoint = 0; + Lpnt = MAX_DEBUG_RECORD - 1; + total_len = 0; + struct_number = 0; + overflow = 0; + if (!spnt) + new_forward_ref (dbx_type); + else + { + if (spnt->VMS_type != DBG_S_C_ADVANCED_TYPE) + return; /* no suffix needed */ + gen1 (spnt, 0); + } + rpush (0, 1); /* no name (len==0) */ + rpush (DST_K_TYPSPEC, 1); + total_len += 4; + rpush (total_len, 1); + /* If the variable descriptor overflows the record, output a descriptor + for a pointer to void. */ + if ((total_len >= MAX_DEBUG_RECORD) || overflow) + { + as_warn (_("Variable descriptor %d too complicated. Defined as `void *'."), + spnt->dbx_type); + VMS_Store_Immediate_Data (pvoid, 6, OBJ_S_C_DBG); + return; + } + i = 0; + while (Lpnt < MAX_DEBUG_RECORD - 1) + Local[i++] = Local[++Lpnt]; + Lpnt = i; + /* We use this for reference to structure that has already been defined. */ + if (struct_number > 0) + { + VMS_Store_Immediate_Data (Local, Lpnt, OBJ_S_C_DBG); + Lpnt = 0; + VMS_Store_Struct (struct_number); + } + /* We use this for a forward reference to a structure that has yet to + be defined. We store four bytes of zero to make room for the actual + address once it is known. */ + if (struct_number < 0) + { + struct_number = -struct_number; + VMS_Store_Immediate_Data (Local, Lpnt, OBJ_S_C_DBG); + Lpnt = 0; + VMS_Def_Struct (struct_number); + COPY_LONG (&Local[Lpnt], 0L); + Lpnt += 4; + VMS_Store_Immediate_Data (Local, Lpnt, OBJ_S_C_DBG); + Lpnt = 0; + } + i = 0; + while (i < Apoint) + Local[Lpnt++] = Asuffix[i++]; + if (Lpnt != 0) + VMS_Store_Immediate_Data (Local, Lpnt, OBJ_S_C_DBG); + Lpnt = 0; +} + +/* "novel length" type doesn't work for simple atomic types. */ +#define USE_BITSTRING_DESCRIPTOR(t) ((t)->advanced == BASIC) +#undef SETUP_BASIC_TYPES + +/* This routine generates a type description for a bitfield. */ + +static void +bitfield_suffix (struct VMS_DBG_Symbol *spnt, int width) +{ + Local[Lpnt++] = 13; /* rec.len==13 */ + Local[Lpnt++] = DST_K_TYPSPEC; /* a type specification record */ + Local[Lpnt++] = 0; /* not named */ + COPY_SHORT (&Local[Lpnt], 9); /* typ.len==9 */ + Lpnt += 2; + Local[Lpnt++] = DST_K_TS_NOV_LENG; /* This type is a "novel length" + incarnation of some other type. */ + COPY_LONG (&Local[Lpnt], width); /* size in bits == novel length */ + Lpnt += 4; + VMS_Store_Immediate_Data (Local, Lpnt, OBJ_S_C_DBG); + Lpnt = 0; + /* assert( spnt->struc_numb > 0 ); */ + VMS_Store_Struct (spnt->struc_numb); /* output 4 more bytes */ +} + +/* Formally define a builtin type, so that it can serve as the target of + an indirect reference. It makes bitfield_suffix() easier by avoiding + the need to use a forward reference for the first occurrence of each + type used in a bitfield. */ + +static void +setup_basic_type (struct VMS_DBG_Symbol *spnt ATTRIBUTE_UNUSED) +{ +#ifdef SETUP_BASIC_TYPES + /* This would be very useful if "novel length" fields actually worked + with basic types like they do with enumerated types. However, + they do not, so this isn't worth doing just so that you can use + EXAMINE/TYPE=(__long_long_int) instead of EXAMINE/QUAD. */ + char *p; +#ifndef SETUP_SYNONYM_TYPES + /* This determines whether compatible things like `int' and `long int' + ought to have distinct type records rather than sharing one. */ + struct VMS_DBG_Symbol *spnt2; + + /* First check whether this type has already been seen by another name. */ + for (spnt2 = VMS_Symbol_type_list[SYMTYP_HASH (spnt->VMS_type)]; + spnt2; + spnt2 = spnt2->next) + if (spnt2 != spnt && spnt2->VMS_type == spnt->VMS_type) + { + spnt->struc_numb = spnt2->struc_numb; + return; + } +#endif + + /* `structure number' doesn't really mean `structure'; it means an index + into a linker maintained set of saved locations which can be referenced + again later. */ + spnt->struc_numb = ++structure_count; + VMS_Def_Struct (spnt->struc_numb); /* remember where this type lives */ + /* define the simple scalar type */ + Local[Lpnt++] = 6 + strlen (symbol_name) + 2; /* rec.len */ + Local[Lpnt++] = DST_K_TYPSPEC; /* rec.typ==type specification */ + Local[Lpnt++] = strlen (symbol_name) + 2; + Local[Lpnt++] = '_'; /* prefix name with "__" */ + Local[Lpnt++] = '_'; + for (p = symbol_name; *p; p++) + Local[Lpnt++] = *p == ' ' ? '_' : *p; + COPY_SHORT (&Local[Lpnt], 2); /* typ.len==2 */ + Lpnt += 2; + Local[Lpnt++] = DST_K_TS_ATOM; /* typ.kind is simple type */ + Local[Lpnt++] = spnt->VMS_type; /* typ.type */ + VMS_Store_Immediate_Data (Local, Lpnt, OBJ_S_C_DBG); + Lpnt = 0; +#endif /* SETUP_BASIC_TYPES */ +} + +/* This routine generates a symbol definition for a C symbol for the + debugger. It takes a psect and offset for global symbols; if psect < 0, + then this is a local variable and the offset is relative to FP. In this + case it can be either a variable (Offset < 0) or a parameter (Offset > 0). */ + +static void +VMS_DBG_record (struct VMS_DBG_Symbol *spnt, int Psect, + int Offset, char *Name) +{ + char *Name_pnt; + int len; + int i = 0; + + /* If there are bad characters in name, convert them. */ + Name_pnt = fix_name (Name); + + len = strlen (Name_pnt); + if (Psect < 0) + { + /* This is a local variable, referenced to SP. */ + Local[i++] = 7 + len; + Local[i++] = spnt->VMS_type; + Local[i++] = (Offset > 0) ? DBG_C_FUNCTION_PARAM : DBG_C_LOCAL_SYM; + COPY_LONG (&Local[i], Offset); + i += 4; + } + else + { + Local[i++] = 7 + len; + Local[i++] = spnt->VMS_type; + Local[i++] = DST_K_VALKIND_ADDR; + VMS_Store_Immediate_Data (Local, i, OBJ_S_C_DBG); + i = 0; + VMS_Set_Data (Psect, Offset, OBJ_S_C_DBG, 0); + } + Local[i++] = len; + while (*Name_pnt != '\0') + Local[i++] = *Name_pnt++; + VMS_Store_Immediate_Data (Local, i, OBJ_S_C_DBG); + if (spnt->VMS_type == DBG_S_C_ADVANCED_TYPE) + generate_suffix (spnt, 0); +} + +/* This routine parses the stabs entries in order to make the definition + for the debugger of local symbols and function parameters. */ + +static void +VMS_local_stab_Parse (symbolS *sp) +{ + struct VMS_DBG_Symbol *spnt; + char *pnt; + char *pnt1; + char *str; + int dbx_type; + + dbx_type = 0; + str = S_GET_NAME (sp); + pnt = (char *) strchr (str, ':'); + if (!pnt) + return; + + /* Save this for later, and skip colon. */ + pnt1 = pnt++; + + /* Ignore static constants. */ + if (*pnt == 'c') + return; + + /* There is one little catch that we must be aware of. Sometimes function + parameters are optimized into registers, and the compiler, in its + infiite wisdom outputs stabs records for *both*. In general we want to + use the register if it is present, so we must search the rest of the + symbols for this function to see if this parameter is assigned to a + register. */ + { + symbolS *sp1; + char *str1; + char *pnt2; + + if (*pnt == 'p') + { + for (sp1 = symbol_next (sp); sp1; sp1 = symbol_next (sp1)) + { + if (!S_IS_DEBUG (sp1)) + continue; + if (S_GET_RAW_TYPE (sp1) == N_FUN) + { + pnt2 = (char *) strchr (S_GET_NAME (sp1), ':') + 1; + if (*pnt2 == 'F' || *pnt2 == 'f') + break; + } + if (S_GET_RAW_TYPE (sp1) != N_RSYM) + continue; + str1 = S_GET_NAME (sp1); /* and get the name */ + pnt2 = str; + while (*pnt2 != ':') + { + if (*pnt2 != *str1) + break; + pnt2++; + str1++; + } + if (*str1 == ':' && *pnt2 == ':') + return; /* They are the same! Let's skip this one. */ + } + + /* Skip p in case no register. */ + pnt++; + } + } + + pnt = cvt_integer (pnt, &dbx_type); + + spnt = find_symbol (dbx_type); + if (!spnt) + /* Dunno what this is. */ + return; + + *pnt1 = '\0'; + VMS_DBG_record (spnt, -1, S_GET_VALUE (sp), str); + + /* ...and restore the string. */ + *pnt1 = ':'; +} + +/* This routine parses a stabs entry to find the information required + to define a variable. It is used for global and static variables. + Basically we need to know the address of the symbol. With older + versions of the compiler, const symbols are treated differently, in + that if they are global they are written into the text psect. The + global symbol entry for such a const is actually written as a program + entry point (Yuk!!), so if we cannot find a symbol in the list of + psects, we must search the entry points as well. static consts are + even harder, since they are never assigned a memory address. The + compiler passes a stab to tell us the value, but I am not sure what + to do with it. */ + +static void +VMS_stab_parse (symbolS *sp, int expected_type, + int type1, int type2, int Text_Psect) +{ + char *pnt; + char *pnt1; + char *str; + symbolS *sp1; + struct VMS_DBG_Symbol *spnt; + struct VMS_Symbol *vsp; + int dbx_type; + + dbx_type = 0; + str = S_GET_NAME (sp); + + pnt = (char *) strchr (str, ':'); + if (!pnt) + /* No colon present. */ + return; + + /* Save this for later. */ + pnt1 = pnt; + pnt++; + if (*pnt == expected_type) + { + pnt = cvt_integer (pnt + 1, &dbx_type); + spnt = find_symbol (dbx_type); + if (!spnt) + return; /*Dunno what this is*/ + /* Now we need to search the symbol table to find the psect and + offset for this variable. */ + *pnt1 = '\0'; + vsp = VMS_Symbols; + while (vsp) + { + pnt = S_GET_NAME (vsp->Symbol); + if (pnt && *pnt++ == '_' + /* make sure name is the same and symbol type matches */ + && strcmp (pnt, str) == 0 + && (S_GET_RAW_TYPE (vsp->Symbol) == type1 + || S_GET_RAW_TYPE (vsp->Symbol) == type2)) + break; + vsp = vsp->Next; + } + if (vsp) + { + VMS_DBG_record (spnt, vsp->Psect_Index, vsp->Psect_Offset, str); + *pnt1 = ':'; /* and restore the string */ + return; + } + /* The symbol was not in the symbol list, but it may be an + "entry point" if it was a constant. */ + for (sp1 = symbol_rootP; sp1; sp1 = symbol_next (sp1)) + { + /* Dispatch on STAB type. */ + if (S_IS_DEBUG (sp1) || (S_GET_TYPE (sp1) != N_TEXT)) + continue; + pnt = S_GET_NAME (sp1); + if (*pnt == '_') + pnt++; + if (strcmp (pnt, str) == 0) + { + if (!gave_compiler_message && expected_type == 'G') + { + char *long_const_msg = _("\ +***Warning - the assembly code generated by the compiler has placed \n\ + global constant(s) in the text psect. These will not be available to \n\ + other modules, since this is not the correct way to handle this. You \n\ + have two options: 1) get a patched compiler that does not put global \n\ + constants in the text psect, or 2) remove the 'const' keyword from \n\ + definitions of global variables in your source module(s). Don't say \n\ + I didn't warn you! \n"); + + as_tsktsk (long_const_msg); + gave_compiler_message = 1; + } + VMS_DBG_record (spnt, + Text_Psect, + S_GET_VALUE (sp1), + str); + *pnt1 = ':'; + /* Fool assembler to not output this as a routine in the TBT. */ + pnt1 = S_GET_NAME (sp1); + *pnt1 = 'L'; + S_SET_NAME (sp1, pnt1); + return; + } + } + } + + /* ...and restore the string. */ + *pnt1 = ':'; +} + +/* Simpler interfaces into VMS_stab_parse(). */ + +static void +VMS_GSYM_Parse (symbolS *sp, int Text_Psect) +{ /* Global variables */ + VMS_stab_parse (sp, 'G', (N_UNDF | N_EXT), (N_DATA | N_EXT), Text_Psect); +} + +static void +VMS_LCSYM_Parse (symbolS *sp, int Text_Psect) +{ + VMS_stab_parse (sp, 'S', N_BSS, -1, Text_Psect); +} + +static void +VMS_STSYM_Parse (symbolS *sp, int Text_Psect) +{ + VMS_stab_parse (sp, 'S', N_DATA, -1, Text_Psect); +} + +/* For register symbols, we must figure out what range of addresses + within the psect are valid. We will use the brackets in the stab + directives to give us guidance as to the PC range that this variable + is in scope. I am still not completely comfortable with this but + as I learn more, I seem to get a better handle on what is going on. + Caveat Emptor. */ + +static void +VMS_RSYM_Parse (symbolS *sp, symbolS *Current_Routine ATTRIBUTE_UNUSED, + int Text_Psect) +{ + symbolS *symbolP; + struct VMS_DBG_Symbol *spnt; + char *pnt; + char *pnt1; + char *str; + int dbx_type; + int len; + int i = 0; + int bcnt = 0; + int Min_Offset = -1; /* min PC of validity */ + int Max_Offset = 0; /* max PC of validity */ + + for (symbolP = sp; symbolP; symbolP = symbol_next (symbolP)) + { + /* Dispatch on STAB type. */ + switch (S_GET_RAW_TYPE (symbolP)) + { + case N_LBRAC: + if (bcnt++ == 0) + Min_Offset = S_GET_VALUE (symbolP); + break; + case N_RBRAC: + if (--bcnt == 0) + Max_Offset = S_GET_VALUE (symbolP) - 1; + break; + } + if ((Min_Offset != -1) && (bcnt == 0)) + break; + if (S_GET_RAW_TYPE (symbolP) == N_FUN) + { + pnt = (char *) strchr (S_GET_NAME (symbolP), ':') + 1; + if (*pnt == 'F' || *pnt == 'f') break; + } + } + + /* Check to see that the addresses were defined. If not, then there + were no brackets in the function, and we must try to search for + the next function. Since functions can be in any order, we should + search all of the symbol list to find the correct ending address. */ + if (Min_Offset == -1) + { + int Max_Source_Offset; + int This_Offset; + + Min_Offset = S_GET_VALUE (sp); + Max_Source_Offset = Min_Offset; /* just in case no N_SLINEs found */ + for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP)) + switch (S_GET_RAW_TYPE (symbolP)) + { + case N_TEXT | N_EXT: + This_Offset = S_GET_VALUE (symbolP); + if (This_Offset > Min_Offset && This_Offset < Max_Offset) + Max_Offset = This_Offset; + break; + case N_SLINE: + This_Offset = S_GET_VALUE (symbolP); + if (This_Offset > Max_Source_Offset) + Max_Source_Offset = This_Offset; + break; + } + /* If this is the last routine, then we use the PC of the last source + line as a marker of the max PC for which this reg is valid. */ + if (Max_Offset == 0x7fffffff) + Max_Offset = Max_Source_Offset; + } + + dbx_type = 0; + str = S_GET_NAME (sp); + if ((pnt = (char *) strchr (str, ':')) == 0) + return; /* no colon present */ + pnt1 = pnt; /* save this for later*/ + pnt++; + if (*pnt != 'r') + return; + pnt = cvt_integer (pnt + 1, &dbx_type); + spnt = find_symbol (dbx_type); + if (!spnt) + return; /*Dunno what this is yet*/ + *pnt1 = '\0'; + pnt = fix_name (S_GET_NAME (sp)); /* if there are bad characters in name, convert them */ + len = strlen (pnt); + Local[i++] = 25 + len; + Local[i++] = spnt->VMS_type; + Local[i++] = DST_K_VFLAGS_TVS; /* trailing value specified */ + COPY_LONG (&Local[i], 1 + len); /* relative offset, beyond name */ + i += 4; + Local[i++] = len; /* name length (ascic prefix) */ + while (*pnt != '\0') + Local[i++] = *pnt++; + Local[i++] = DST_K_VS_FOLLOWS; /* value specification follows */ + COPY_SHORT (&Local[i], 15); /* length of rest of record */ + i += 2; + Local[i++] = DST_K_VS_ALLOC_SPLIT; /* split lifetime */ + Local[i++] = 1; /* one binding follows */ + VMS_Store_Immediate_Data (Local, i, OBJ_S_C_DBG); + i = 0; + VMS_Set_Data (Text_Psect, Min_Offset, OBJ_S_C_DBG, 1); + VMS_Set_Data (Text_Psect, Max_Offset, OBJ_S_C_DBG, 1); + Local[i++] = DST_K_VALKIND_REG; /* nested value spec */ + COPY_LONG (&Local[i], S_GET_VALUE (sp)); + i += 4; + VMS_Store_Immediate_Data (Local, i, OBJ_S_C_DBG); + *pnt1 = ':'; + if (spnt->VMS_type == DBG_S_C_ADVANCED_TYPE) + generate_suffix (spnt, 0); +} + +/* This function examines a structure definition, checking all of the elements + to make sure that all of them are fully defined. The only thing that we + kick out are arrays of undefined structs, since we do not know how big + they are. All others we can handle with a normal forward reference. */ + +static int +forward_reference (char *pnt) +{ + struct VMS_DBG_Symbol *spnt, *spnt1; + int i; + + pnt = cvt_integer (pnt + 1, &i); + if (*pnt == ';') + return 0; /* no forward references */ + do + { + pnt = (char *) strchr (pnt, ':'); + pnt = cvt_integer (pnt + 1, &i); + spnt = find_symbol (i); + while (spnt && (spnt->advanced == POINTER || spnt->advanced == ARRAY)) + { + spnt1 = find_symbol (spnt->type2); + if (spnt->advanced == ARRAY && !spnt1) + return 1; + spnt = spnt1; + } + pnt = cvt_integer (pnt + 1, &i); + pnt = cvt_integer (pnt + 1, &i); + } while (*++pnt != ';'); + return 0; /* no forward references found */ +} + +/* Used to check a single element of a structure on the final pass. */ + +static int +final_forward_reference (struct VMS_DBG_Symbol *spnt) +{ + struct VMS_DBG_Symbol *spnt1; + + while (spnt && (spnt->advanced == POINTER || spnt->advanced == ARRAY)) + { + spnt1 = find_symbol (spnt->type2); + if (spnt->advanced == ARRAY && !spnt1) + return 1; + spnt = spnt1; + } + return 0; /* no forward references found */ +} + +/* This routine parses the stabs directives to find any definitions of dbx + type numbers. It makes a note of all of them, creating a structure + element of VMS_DBG_Symbol that describes it. This also generates the + info for the debugger that describes the struct/union/enum, so that + further references to these data types will be by number + + We have to process pointers right away, since there can be references + to them later in the same stabs directive. We cannot have forward + references to pointers, (but we can have a forward reference to a + pointer to a structure/enum/union) and this is why we process them + immediately. After we process the pointer, then we search for defs + that are nested even deeper. + + 8/15/92: We have to process arrays right away too, because there can + be multiple references to identical array types in one structure + definition, and only the first one has the definition. */ + +static int +VMS_typedef_parse (char *str) +{ + char *pnt; + char *pnt1; + const char *pnt2; + int i; + int dtype; + struct forward_ref *fpnt; + int i1, i2, i3, len; + struct VMS_DBG_Symbol *spnt; + struct VMS_DBG_Symbol *spnt1; + + /* check for any nested def's */ + pnt = (char *) strchr (str + 1, '='); + if (pnt && str[1] != '*' && (str[1] != 'a' || str[2] != 'r') + && VMS_typedef_parse (pnt) == 1) + return 1; + /* now find dbx_type of entry */ + pnt = str - 1; + if (*pnt == 'c') + { /* check for static constants */ + *str = '\0'; /* for now we ignore them */ + return 0; + } + while ((*pnt <= '9') && (*pnt >= '0')) + pnt--; + pnt++; /* and get back to the number */ + cvt_integer (pnt, &i1); + spnt = find_symbol (i1); + /* First see if this has been defined already, due to forward reference. */ + if (!spnt) + { + i2 = SYMTYP_HASH (i1); + spnt = xmalloc (sizeof (struct VMS_DBG_Symbol)); + spnt->next = VMS_Symbol_type_list[i2]; + VMS_Symbol_type_list[i2] = spnt; + spnt->dbx_type = i1; /* and save the type */ + spnt->type2 = spnt->VMS_type = spnt->data_size = 0; + spnt->index_min = spnt->index_max = spnt->struc_numb = 0; + } + + /* For structs and unions, do a partial parse, otherwise we sometimes get + circular definitions that are impossible to resolve. We read enough + info so that any reference to this type has enough info to be resolved. */ + + /* Point to character past equal sign. */ + pnt = str + 1; + + if (*pnt >= '0' && *pnt <= '9') + { + if (type_check ("void")) + { /* this is the void symbol */ + *str = '\0'; + spnt->advanced = VOID; + return 0; + } + if (type_check ("unknown type")) + { + *str = '\0'; + spnt->advanced = UNKNOWN; + return 0; + } + pnt1 = cvt_integer (pnt, &i1); + if (i1 != spnt->dbx_type) + { + spnt->advanced = ALIAS; + spnt->type2 = i1; + strcpy (str, pnt1); + return 0; + } + as_tsktsk (_("debugginer output: %d is an unknown untyped variable."), + spnt->dbx_type); + return 1; /* do not know what this is */ + } + + /* Point to character past equal sign. */ + pnt = str + 1; + + switch (*pnt) + { + case 'r': + spnt->advanced = BASIC; + if (type_check ("int")) + { + spnt->VMS_type = DBG_S_C_SLINT; + spnt->data_size = 4; + } + else if (type_check ("long int")) + { + spnt->VMS_type = DBG_S_C_SLINT; + spnt->data_size = 4; + } + else if (type_check ("unsigned int")) + { + spnt->VMS_type = DBG_S_C_ULINT; + spnt->data_size = 4; + } + else if (type_check ("long unsigned int")) + { + spnt->VMS_type = DBG_S_C_ULINT; + spnt->data_size = 4; + } + else if (type_check ("short int")) + { + spnt->VMS_type = DBG_S_C_SSINT; + spnt->data_size = 2; + } + else if (type_check ("short unsigned int")) + { + spnt->VMS_type = DBG_S_C_USINT; + spnt->data_size = 2; + } + else if (type_check ("char")) + { + spnt->VMS_type = DBG_S_C_SCHAR; + spnt->data_size = 1; + } + else if (type_check ("signed char")) + { + spnt->VMS_type = DBG_S_C_SCHAR; + spnt->data_size = 1; + } + else if (type_check ("unsigned char")) + { + spnt->VMS_type = DBG_S_C_UCHAR; + spnt->data_size = 1; + } + else if (type_check ("float")) + { + spnt->VMS_type = DBG_S_C_REAL4; + spnt->data_size = 4; + } + else if (type_check ("double")) + { + spnt->VMS_type = vax_g_doubles ? DBG_S_C_REAL8_G : DBG_S_C_REAL8; + spnt->data_size = 8; + } + else if (type_check ("long double")) + { + /* same as double, at least for now */ + spnt->VMS_type = vax_g_doubles ? DBG_S_C_REAL8_G : DBG_S_C_REAL8; + spnt->data_size = 8; + } + else if (type_check ("long long int")) + { + spnt->VMS_type = DBG_S_C_SQUAD; /* signed quadword */ + spnt->data_size = 8; + } + else if (type_check ("long long unsigned int")) + { + spnt->VMS_type = DBG_S_C_UQUAD; /* unsigned quadword */ + spnt->data_size = 8; + } + else if (type_check ("complex float")) + { + spnt->VMS_type = DBG_S_C_COMPLX4; + spnt->data_size = 2 * 4; + } + else if (type_check ("complex double")) + { + spnt->VMS_type = vax_g_doubles ? DBG_S_C_COMPLX8_G : DBG_S_C_COMPLX8; + spnt->data_size = 2 * 8; + } + else if (type_check ("complex long double")) + { + /* same as complex double, at least for now */ + spnt->VMS_type = vax_g_doubles ? DBG_S_C_COMPLX8_G : DBG_S_C_COMPLX8; + spnt->data_size = 2 * 8; + } + else + { + /* Shouldn't get here, but if we do, something + more substantial ought to be done... */ + spnt->VMS_type = 0; + spnt->data_size = 0; + } + if (spnt->VMS_type != 0) + setup_basic_type (spnt); + pnt1 = (char *) strchr (str, ';') + 1; + break; + case 's': + case 'u': + spnt->advanced = (*pnt == 's') ? STRUCT : UNION; + spnt->VMS_type = DBG_S_C_ADVANCED_TYPE; + pnt1 = cvt_integer (pnt + 1, &spnt->data_size); + if (!final_pass && forward_reference (pnt)) + { + spnt->struc_numb = -1; + return 1; + } + spnt->struc_numb = ++structure_count; + pnt1--; + pnt = get_struct_name (str); + VMS_Def_Struct (spnt->struc_numb); + i = 0; + for (fpnt = f_ref_root; fpnt; fpnt = fpnt->next) + if (fpnt->dbx_type == spnt->dbx_type) + { + fpnt->resolved = 'Y'; + VMS_Set_Struct (fpnt->struc_numb); + VMS_Store_Struct (spnt->struc_numb); + i++; + } + if (i > 0) + VMS_Set_Struct (spnt->struc_numb); + i = 0; + Local[i++] = 11 + strlen (pnt); + Local[i++] = DBG_S_C_STRUCT_START; + Local[i++] = DST_K_VFLAGS_NOVAL; /* structure definition only */ + COPY_LONG (&Local[i], 0L); /* hence value is unused */ + i += 4; + Local[i++] = strlen (pnt); + pnt2 = pnt; + while (*pnt2 != '\0') + Local[i++] = *pnt2++; + i2 = spnt->data_size * 8; /* number of bits */ + COPY_LONG (&Local[i], i2); + i += 4; + VMS_Store_Immediate_Data (Local, i, OBJ_S_C_DBG); + i = 0; + if (pnt != symbol_name) + { + pnt += strlen (pnt); + /* Replace colon for later. */ + *pnt = ':'; + } + + while (*++pnt1 != ';') + { + pnt = (char *) strchr (pnt1, ':'); + *pnt = '\0'; + pnt2 = pnt1; + pnt1 = cvt_integer (pnt + 1, &dtype); + pnt1 = cvt_integer (pnt1 + 1, &i2); + pnt1 = cvt_integer (pnt1 + 1, &i3); + spnt1 = find_symbol (dtype); + len = strlen (pnt2); + if (spnt1 && (spnt1->advanced == BASIC || spnt1->advanced == ENUM) + && ((i3 != spnt1->data_size * 8) || (i2 % 8 != 0))) + { /* bitfield */ + if (USE_BITSTRING_DESCRIPTOR (spnt1)) + { + /* This uses a type descriptor, which doesn't work if + the enclosing structure has been placed in a register. + Also, enum bitfields degenerate to simple integers. */ + int unsigned_type = (spnt1->VMS_type == DBG_S_C_ULINT + || spnt1->VMS_type == DBG_S_C_USINT + || spnt1->VMS_type == DBG_S_C_UCHAR + || spnt1->VMS_type == DBG_S_C_UQUAD + || spnt1->advanced == ENUM); + Apoint = 0; + fpush (19 + len, 1); + fpush (unsigned_type ? DBG_S_C_UBITU : DBG_S_C_SBITU, 1); + fpush (DST_K_VFLAGS_DSC, 1); /* specified by descriptor */ + fpush (1 + len, 4); /* relative offset to descriptor */ + fpush (len, 1); /* length byte (ascic prefix) */ + while (*pnt2 != '\0') /* name bytes */ + fpush (*pnt2++, 1); + fpush (i3, 2); /* dsc length == size of bitfield */ + /* dsc type == un?signed bitfield */ + fpush (unsigned_type ? DBG_S_C_UBITU : DBG_S_C_SBITU, 1); + fpush (DSC_K_CLASS_UBS, 1); /* dsc class == unaligned bitstring */ + fpush (0x00, 4); /* dsc pointer == zeroes */ + fpush (i2, 4); /* start position */ + VMS_Store_Immediate_Data (Asuffix, Apoint, OBJ_S_C_DBG); + Apoint = 0; + } + else + { + /* Use a "novel length" type specification, which works + right for register structures and for enum bitfields + but results in larger object modules. */ + Local[i++] = 7 + len; + Local[i++] = DBG_S_C_ADVANCED_TYPE; /* type spec follows */ + Local[i++] = DBG_S_C_STRUCT_ITEM; /* value is a bit offset */ + COPY_LONG (&Local[i], i2); /* bit offset */ + i += 4; + Local[i++] = strlen (pnt2); + while (*pnt2 != '\0') + Local[i++] = *pnt2++; + VMS_Store_Immediate_Data (Local, i, OBJ_S_C_DBG); + i = 0; + bitfield_suffix (spnt1, i3); + } + } + else /* Not a bitfield. */ + { + /* Check if this is a forward reference. */ + if (final_pass && final_forward_reference (spnt1)) + { + as_tsktsk (_("debugger output: structure element `%s' has undefined type"), + pnt2); + continue; + } + Local[i++] = 7 + len; + Local[i++] = spnt1 ? spnt1->VMS_type : DBG_S_C_ADVANCED_TYPE; + Local[i++] = DBG_S_C_STRUCT_ITEM; + COPY_LONG (&Local[i], i2); /* bit offset */ + i += 4; + Local[i++] = strlen (pnt2); + while (*pnt2 != '\0') + Local[i++] = *pnt2++; + VMS_Store_Immediate_Data (Local, i, OBJ_S_C_DBG); + i = 0; + if (!spnt1) + generate_suffix (spnt1, dtype); + else if (spnt1->VMS_type == DBG_S_C_ADVANCED_TYPE) + generate_suffix (spnt1, 0); + } + } + pnt1++; + Local[i++] = 0x01; /* length byte */ + Local[i++] = DBG_S_C_STRUCT_END; + VMS_Store_Immediate_Data (Local, i, OBJ_S_C_DBG); + i = 0; + break; + case 'e': + spnt->advanced = ENUM; + spnt->VMS_type = DBG_S_C_ADVANCED_TYPE; + spnt->struc_numb = ++structure_count; + spnt->data_size = 4; + VMS_Def_Struct (spnt->struc_numb); + i = 0; + for (fpnt = f_ref_root; fpnt; fpnt = fpnt->next) + if (fpnt->dbx_type == spnt->dbx_type) + { + fpnt->resolved = 'Y'; + VMS_Set_Struct (fpnt->struc_numb); + VMS_Store_Struct (spnt->struc_numb); + i++; + } + if (i > 0) + VMS_Set_Struct (spnt->struc_numb); + i = 0; + len = strlen (symbol_name); + Local[i++] = 3 + len; + Local[i++] = DBG_S_C_ENUM_START; + Local[i++] = 4 * 8; /* enum values are 32 bits */ + Local[i++] = len; + pnt2 = symbol_name; + while (*pnt2 != '\0') + Local[i++] = *pnt2++; + VMS_Store_Immediate_Data (Local, i, OBJ_S_C_DBG); + i = 0; + while (*++pnt != ';') + { + pnt1 = (char *) strchr (pnt, ':'); + *pnt1++ = '\0'; + pnt1 = cvt_integer (pnt1, &i1); + len = strlen (pnt); + Local[i++] = 7 + len; + Local[i++] = DBG_S_C_ENUM_ITEM; + Local[i++] = DST_K_VALKIND_LITERAL; + COPY_LONG (&Local[i], i1); + i += 4; + Local[i++] = len; + pnt2 = pnt; + while (*pnt != '\0') + Local[i++] = *pnt++; + VMS_Store_Immediate_Data (Local, i, OBJ_S_C_DBG); + i = 0; + pnt = pnt1; /* Skip final semicolon */ + } + Local[i++] = 0x01; /* len byte */ + Local[i++] = DBG_S_C_ENUM_END; + VMS_Store_Immediate_Data (Local, i, OBJ_S_C_DBG); + i = 0; + pnt1 = pnt + 1; + break; + case 'a': + spnt->advanced = ARRAY; + spnt->VMS_type = DBG_S_C_ADVANCED_TYPE; + pnt = (char *) strchr (pnt, ';'); + if (!pnt) + return 1; + pnt1 = cvt_integer (pnt + 1, &spnt->index_min); + pnt1 = cvt_integer (pnt1 + 1, &spnt->index_max); + pnt1 = cvt_integer (pnt1 + 1, &spnt->type2); + pnt = (char *) strchr (str + 1, '='); + if (pnt && VMS_typedef_parse (pnt) == 1) + return 1; + break; + case 'f': + spnt->advanced = FUNCTION; + spnt->VMS_type = DBG_S_C_FUNCTION_ADDR; + /* this masquerades as a basic type*/ + spnt->data_size = 4; + pnt1 = cvt_integer (pnt + 1, &spnt->type2); + break; + case '*': + spnt->advanced = POINTER; + spnt->VMS_type = DBG_S_C_ADVANCED_TYPE; + spnt->data_size = 4; + pnt1 = cvt_integer (pnt + 1, &spnt->type2); + pnt = (char *) strchr (str + 1, '='); + if (pnt && VMS_typedef_parse (pnt) == 1) + return 1; + break; + default: + spnt->advanced = UNKNOWN; + spnt->VMS_type = 0; + as_tsktsk (_("debugger output: %d is an unknown type of variable."), + spnt->dbx_type); + return 1; /* unable to decipher */ + } + /* This removes the evidence of the definition so that the outer levels + of parsing do not have to worry about it. */ + pnt = str; + while (*pnt1 != '\0') + *pnt++ = *pnt1++; + *pnt = '\0'; + return 0; +} + +/* This is the root routine that parses the stabs entries for definitions. + it calls VMS_typedef_parse, which can in turn call itself. We need to + be careful, since sometimes there are forward references to other symbol + types, and these cannot be resolved until we have completed the parse. + + Also check and see if we are using continuation stabs, if we are, then + paste together the entire contents of the stab before we pass it to + VMS_typedef_parse. */ + +static void +VMS_LSYM_Parse (void) +{ + char *pnt; + char *pnt1; + char *pnt2; + char *str; + char *parse_buffer = 0; + char fixit[10]; + int incomplete, pass, incom1; + struct forward_ref *fpnt; + symbolS *sp; + + pass = 0; + final_pass = 0; + incomplete = 0; + do + { + incom1 = incomplete; + incomplete = 0; + for (sp = symbol_rootP; sp; sp = symbol_next (sp)) + { + /* Deal with STAB symbols. */ + if (S_IS_DEBUG (sp)) + { + /* Dispatch on STAB type. */ + switch (S_GET_RAW_TYPE (sp)) + { + case N_GSYM: + case N_LCSYM: + case N_STSYM: + case N_PSYM: + case N_RSYM: + case N_LSYM: + case N_FUN: /* Sometimes these contain typedefs. */ + str = S_GET_NAME (sp); + symbol_name = str; + pnt = str + strlen (str) - 1; + if (*pnt == '?') /* Continuation stab. */ + { + symbolS *spnext; + int tlen = 0; + + spnext = sp; + do + { + tlen += strlen (str) - 1; + spnext = symbol_next (spnext); + str = S_GET_NAME (spnext); + pnt = str + strlen (str) - 1; + } + while (*pnt == '?'); + + tlen += strlen (str); + parse_buffer = xmalloc (tlen + 1); + strcpy (parse_buffer, S_GET_NAME (sp)); + pnt2 = parse_buffer + strlen (parse_buffer) - 1; + *pnt2 = '\0'; + spnext = sp; + + do + { + spnext = symbol_next (spnext); + str = S_GET_NAME (spnext); + strcat (pnt2, str); + pnt2 += strlen (str) - 1; + *str = '\0'; /* Erase this string */ + /* S_SET_NAME (spnext, str); */ + if (*pnt2 != '?') break; + *pnt2 = '\0'; + } + while (1); + + str = parse_buffer; + symbol_name = str; + } + + if ((pnt = (char *) strchr (str, ':')) != 0) + { + *pnt = '\0'; + pnt1 = pnt + 1; + if ((pnt2 = (char *) strchr (pnt1, '=')) != 0) + incomplete += VMS_typedef_parse (pnt2); + if (parse_buffer) + { + /* At this point the parse buffer should just + contain name:nn. If it does not, then we + are in real trouble. Anyway, this is always + shorter than the original line. */ + pnt2 = S_GET_NAME (sp); + strcpy (pnt2, parse_buffer); + /* S_SET_NAME (sp, pnt2); */ + free (parse_buffer), parse_buffer = 0; + } + /* Put back colon to restore dbx_type. */ + *pnt = ':'; + } + break; + } + } + } + pass++; + + /* Make one last pass, if needed, and define whatever we can + that is left. */ + if (final_pass == 0 && incomplete == incom1) + { + final_pass = 1; + incom1++; /* Force one last pass through. */ + } + } + while (incomplete != 0 && incomplete != incom1); + + if (incomplete != 0) + as_tsktsk (_("debugger output: Unable to resolve %d circular references."), + incomplete); + + fpnt = f_ref_root; + symbol_name = "\0"; + while (fpnt) + { + if (fpnt->resolved != 'Y') + { + if (find_symbol (fpnt->dbx_type)) + { + as_tsktsk (_("debugger forward reference error, dbx type %d"), + fpnt->dbx_type); + break; + } + fixit[0] = 0; + sprintf (&fixit[1], "%d=s4;", fpnt->dbx_type); + pnt2 = (char *) strchr (&fixit[1], '='); + VMS_typedef_parse (pnt2); + } + fpnt = fpnt->next; + } +} + +static void +Define_Local_Symbols (symbolS *s0P, symbolS *s2P, symbolS *Current_Routine, + int Text_Psect) +{ + symbolS *s1P; /* Each symbol from s0P .. s2P (exclusive). */ + + for (s1P = symbol_next (s0P); s1P != s2P; s1P = symbol_next (s1P)) + { + if (!s1P) + break; /* and return */ + if (S_GET_RAW_TYPE (s1P) == N_FUN) + { + char *pnt = (char *) strchr (S_GET_NAME (s1P), ':') + 1; + if (*pnt == 'F' || *pnt == 'f') break; + } + if (!S_IS_DEBUG (s1P)) + continue; + /* Dispatch on STAB type. */ + switch (S_GET_RAW_TYPE (s1P)) + { + default: + /* Not left or right brace. */ + continue; + + case N_LSYM: + case N_PSYM: + VMS_local_stab_Parse (s1P); + break; + + case N_RSYM: + VMS_RSYM_Parse (s1P, Current_Routine, Text_Psect); + break; + } + } +} + +/* This function crawls the symbol chain searching for local symbols that + need to be described to the debugger. When we enter a new scope with + a "{", it creates a new "block", which helps the debugger keep track + of which scope we are currently in. */ + +static symbolS * +Define_Routine (symbolS *s0P, int Level, symbolS *Current_Routine, + int Text_Psect) +{ + symbolS *s1P; + valueT Offset; + int rcount = 0; + + for (s1P = symbol_next (s0P); s1P != 0; s1P = symbol_next (s1P)) + { + if (S_GET_RAW_TYPE (s1P) == N_FUN) + { + char *pnt = (char *) strchr (S_GET_NAME (s1P), ':') + 1; + if (*pnt == 'F' || *pnt == 'f') break; + } + if (!S_IS_DEBUG (s1P)) + continue; + /* Dispatch on STAB type. */ + switch (S_GET_RAW_TYPE (s1P)) + { + default: + continue; + + case N_LBRAC: + if (Level != 0) + { + char str[10]; + sprintf (str, "$%d", rcount++); + VMS_TBT_Block_Begin (s1P, Text_Psect, str); + } + /* Side-effect: fully resolve symbol. */ + Offset = S_GET_VALUE (s1P); + Define_Local_Symbols (s0P, s1P, Current_Routine, Text_Psect); + s1P = Define_Routine (s1P, Level + 1, Current_Routine, Text_Psect); + if (Level != 0) + VMS_TBT_Block_End (S_GET_VALUE (s1P) - Offset); + s0P = s1P; + break; + + case N_RBRAC: + return s1P; + } + } + + /* We end up here if there were no brackets in this function. + Define everything. */ + Define_Local_Symbols (s0P, (symbolS *)0, Current_Routine, Text_Psect); + return s1P; +} + + +#ifndef VMS +#include +#include +static void get_VMS_time_on_unix (char *); + +/* Manufacture a VMS-like time string on a Unix based system. */ +static void +get_VMS_time_on_unix (char *Now) +{ + char *pnt; + time_t timeb; + + time (&timeb); + pnt = ctime (&timeb); + pnt[3] = 0; + pnt[7] = 0; + pnt[10] = 0; + pnt[16] = 0; + pnt[24] = 0; + sprintf (Now, "%2s-%3s-%s %s", pnt + 8, pnt + 4, pnt + 20, pnt + 11); +} +#endif /* not VMS */ + +/* Write the MHD (Module Header) records. */ + +static void +Write_VMS_MHD_Records (void) +{ + const char *cp; + char *cp1; + int i; +#ifdef VMS + struct { unsigned short len, mbz; char *ptr; } Descriptor; +#endif + char Now[17+1]; + + /* We are writing a module header record. */ + Set_VMS_Object_File_Record (OBJ_S_C_HDR); + /* MAIN MODULE HEADER RECORD. */ + /* Store record type and header type. */ + PUT_CHAR (OBJ_S_C_HDR); + PUT_CHAR (MHD_S_C_MHD); + /* Structure level is 0. */ + PUT_CHAR (OBJ_S_C_STRLVL); + /* Maximum record size is size of the object record buffer. */ + PUT_SHORT (sizeof (Object_Record_Buffer)); + + /* FIXME: module name and version should be user + specifiable via `.ident' and/or `#pragma ident'. */ + + /* Get module name (the FILENAME part of the object file). */ + cp = out_file_name; + cp1 = Module_Name; + while (*cp) + { + if (*cp == ']' || *cp == '>' || *cp == ':' || *cp == '/') + { + cp1 = Module_Name; + cp++; + continue; + } + *cp1++ = TOUPPER (*cp++); + } + *cp1 = '\0'; + + /* Limit it to 31 characters and store in the object record. */ + while (--cp1 >= Module_Name) + if (*cp1 == '.') + *cp1 = '\0'; + if (strlen (Module_Name) > 31) + { + if (flag_hash_long_names) + as_tsktsk (_("Module name truncated: %s\n"), Module_Name); + Module_Name[31] = '\0'; + } + PUT_COUNTED_STRING (Module_Name); + /* Module Version is "V1.0". */ + PUT_COUNTED_STRING ("V1.0"); + /* Creation time is "now" (17 chars of time string): "dd-MMM-yyyy hh:mm". */ +#ifndef VMS + get_VMS_time_on_unix (Now); +#else /* VMS */ + Descriptor.len = sizeof Now - 1; + Descriptor.mbz = 0; /* type & class unspecified */ + Descriptor.ptr = Now; + (void) sys$asctim ((unsigned short *)0, &Descriptor, (long *)0, 0); +#endif /* VMS */ + for (i = 0; i < 17; i++) + PUT_CHAR (Now[i]); + /* Patch time is "never" (17 zeros). */ + for (i = 0; i < 17; i++) + PUT_CHAR (0); + /* Force this to be a separate output record. */ + Flush_VMS_Object_Record_Buffer (); + + /* LANGUAGE PROCESSOR NAME. */ + + /* Store record type and header type. */ + PUT_CHAR (OBJ_S_C_HDR); + PUT_CHAR (MHD_S_C_LNM); + + /* Store language processor name and version (not a counted string!). + This is normally supplied by the gcc driver for the command line + which invokes gas. If absent, we fall back to gas's version. */ + + cp = compiler_version_string; + if (cp == 0) + { + cp = "GNU AS V"; + while (*cp) + PUT_CHAR (*cp++); + cp = VERSION; + } + while (*cp >= ' ') + PUT_CHAR (*cp++); + /* Force this to be a separate output record. */ + Flush_VMS_Object_Record_Buffer (); +} + +/* Write the EOM (End Of Module) record. */ + +static void +Write_VMS_EOM_Record (int Psect, valueT Offset) +{ + /* We are writing an end-of-module record + (this assumes that the entry point will always be in a psect + represented by a single byte, which is the case for code in + Text_Psect==0). */ + + Set_VMS_Object_File_Record (OBJ_S_C_EOM); + PUT_CHAR (OBJ_S_C_EOM); /* Record type. */ + PUT_CHAR (0); /* Error severity level (we ignore it). */ + /* Store the entry point, if it exists. */ + if (Psect >= 0) + { + PUT_CHAR (Psect); + PUT_LONG (Offset); + } + /* Flush the record; this will be our final output. */ + Flush_VMS_Object_Record_Buffer (); +} + + +/* This hash routine borrowed from GNU-EMACS, and strengthened slightly + ERY. */ + +static int +hash_string (const char *ptr) +{ + const unsigned char *p = (unsigned char *) ptr; + const unsigned char *end = p + strlen (ptr); + unsigned char c; + int hash = 0; + + while (p != end) + { + c = *p++; + hash = ((hash << 3) + (hash << 15) + (hash >> 28) + c); + } + return hash; +} + +/* Generate a Case-Hacked VMS symbol name (limited to 31 chars). */ + +static void +VMS_Case_Hack_Symbol (const char *In, char *Out) +{ + long int init; + long int result; + char *pnt = 0; + char *new_name; + const char *old_name; + int i; + int destructor = 0; /* Hack to allow for case sens in a destructor. */ + int truncate = 0; + int Case_Hack_Bits = 0; + int Saw_Dollar = 0; + static char Hex_Table[16] = + {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + + /* Kill any leading "_". */ + if ((In[0] == '_') && ((In[1] > '9') || (In[1] < '0'))) + In++; + + new_name = Out; /* Save this for later. */ + +#if 0 + if ((In[0] == '_') && (In[1] == '$') && (In[2] == '_')) + destructor = 1; +#endif + + /* We may need to truncate the symbol, save the hash for later. */ + result = (strlen (In) > 23) ? hash_string (In) : 0; + /* Is there a Psect Attribute to skip? */ + if (HAS_PSECT_ATTRIBUTES (In)) + { + /* Yes: Skip it. */ + In += PSECT_ATTRIBUTES_STRING_LENGTH; + while (*In) + { + if ((In[0] == '$') && (In[1] == '$')) + { + In += 2; + break; + } + In++; + } + } + + old_name = In; +#if 0 + if (strlen (In) > 31 && flag_hash_long_names) + as_tsktsk ("Symbol name truncated: %s\n", In); +#endif + /* Do the case conversion. */ + /* Maximum of 23 chars */ + i = 23; + while (*In && (--i >= 0)) + { + Case_Hack_Bits <<= 1; + if (*In == '$') + Saw_Dollar = 1; + if ((destructor == 1) && (i == 21)) + Saw_Dollar = 0; + + switch (vms_name_mapping) + { + case 0: + if (ISUPPER (*In)) + { + *Out++ = *In++; + Case_Hack_Bits |= 1; + } + else + *Out++ = TOUPPER (*In++); + break; + + case 3: + *Out++ = *In++; + break; + + case 2: + if (ISLOWER (*In)) + *Out++ = *In++; + else + *Out++ = TOLOWER (*In++); + break; + } + } + /* If we saw a dollar sign, we don't do case hacking. */ + if (flag_no_hash_mixed_case || Saw_Dollar) + Case_Hack_Bits = 0; + + /* If we have more than 23 characters and everything is lowercase + we can insert the full 31 characters. */ + if (*In) + { + /* We have more than 23 characters + If we must add the case hack, then we have truncated the str. */ + pnt = Out; + truncate = 1; + if (Case_Hack_Bits == 0) + { + /* And so far they are all lower case: + Check up to 8 more characters + and ensure that they are lowercase. */ + for (i = 0; (In[i] != 0) && (i < 8); i++) + if (ISUPPER (In[i]) && !Saw_Dollar && !flag_no_hash_mixed_case) + break; + + if (In[i] == 0) + truncate = 0; + + if ((i == 8) || (In[i] == 0)) + { + /* They are: Copy up to 31 characters + to the output string. */ + i = 8; + while ((--i >= 0) && (*In)) + switch (vms_name_mapping){ + case 0: *Out++ = TOUPPER (*In++); + break; + case 3: *Out++ = *In++; + break; + case 2: *Out++ = TOLOWER (*In++); + break; + } + } + } + } + /* If there were any uppercase characters in the name we + take on the case hacking string. */ + + /* Old behavior for regular GNU-C compiler. */ + if (!flag_hash_long_names) + truncate = 0; + if ((Case_Hack_Bits != 0) || (truncate == 1)) + { + if (truncate == 0) + { + *Out++ = '_'; + for (i = 0; i < 6; i++) + { + *Out++ = Hex_Table[Case_Hack_Bits & 0xf]; + Case_Hack_Bits >>= 4; + } + *Out++ = 'X'; + } + else + { + Out = pnt; /* Cut back to 23 characters maximum. */ + *Out++ = '_'; + for (i = 0; i < 7; i++) + { + init = result & 0x01f; + *Out++ = (init < 10) ? ('0' + init) : ('A' + init - 10); + result = result >> 5; + } + } + } + /* Done. */ + *Out = 0; + if (truncate == 1 && flag_hash_long_names && flag_show_after_trunc) + as_tsktsk (_("Symbol %s replaced by %s\n"), old_name, new_name); +} + + +/* Scan a symbol name for a psect attribute specification. */ + +#define GLOBALSYMBOL_BIT 0x10000 +#define GLOBALVALUE_BIT 0x20000 + +static void +VMS_Modify_Psect_Attributes (const char *Name, int *Attribute_Pointer) +{ + int i; + const char *cp; + int Negate; + static const struct + { + const char *Name; + int Value; + } Attributes[] = + { + {"PIC", GPS_S_M_PIC}, + {"LIB", GPS_S_M_LIB}, + {"OVR", GPS_S_M_OVR}, + {"REL", GPS_S_M_REL}, + {"GBL", GPS_S_M_GBL}, + {"SHR", GPS_S_M_SHR}, + {"EXE", GPS_S_M_EXE}, + {"RD", GPS_S_M_RD}, + {"WRT", GPS_S_M_WRT}, + {"VEC", GPS_S_M_VEC}, + {"GLOBALSYMBOL", GLOBALSYMBOL_BIT}, + {"GLOBALVALUE", GLOBALVALUE_BIT}, + {0, 0} + }; + + /* Kill leading "_". */ + if (*Name == '_') + Name++; + /* Check for a PSECT attribute list. */ + if (!HAS_PSECT_ATTRIBUTES (Name)) + return; + /* Skip the attribute list indicator. */ + Name += PSECT_ATTRIBUTES_STRING_LENGTH; + /* Process the attributes ("_" separated, "$" terminated). */ + while (*Name != '$') + { + /* Assume not negating. */ + Negate = 0; + /* Check for "NO". */ + if ((Name[0] == 'N') && (Name[1] == 'O')) + { + /* We are negating (and skip the NO). */ + Negate = 1; + Name += 2; + } + /* Find the token delimiter. */ + cp = Name; + while (*cp && (*cp != '_') && (*cp != '$')) + cp++; + /* Look for the token in the attribute list. */ + for (i = 0; Attributes[i].Name; i++) + { + /* If the strings match, set/clear the attr. */ + if (strncmp (Name, Attributes[i].Name, cp - Name) == 0) + { + /* Set or clear. */ + if (Negate) + *Attribute_Pointer &= + ~Attributes[i].Value; + else + *Attribute_Pointer |= + Attributes[i].Value; + /* Done. */ + break; + } + } + /* Now skip the attribute. */ + Name = cp; + if (*Name == '_') + Name++; + } +} + + +#define GBLSYM_REF 0 +#define GBLSYM_DEF 1 +#define GBLSYM_VAL 2 +#define GBLSYM_LCL 4 /* not GBL after all... */ +#define GBLSYM_WEAK 8 + +/* Define a global symbol (or possibly a local one). */ + +static void +VMS_Global_Symbol_Spec (const char *Name, int Psect_Number, int Psect_Offset, int Flags) +{ + char Local[32]; + + /* We are writing a GSD record. */ + Set_VMS_Object_File_Record (OBJ_S_C_GSD); + + /* If the buffer is empty we must insert the GSD record type. */ + if (Object_Record_Offset == 0) + PUT_CHAR (OBJ_S_C_GSD); + + /* We are writing a Global (or local) symbol definition subrecord. */ + PUT_CHAR ((Flags & GBLSYM_LCL) != 0 ? GSD_S_C_LSY : + ((unsigned) Psect_Number <= 255) ? GSD_S_C_SYM : GSD_S_C_SYMW); + + /* Data type is undefined. */ + PUT_CHAR (0); + + /* Switch on Definition/Reference. */ + if ((Flags & GBLSYM_DEF) == 0) + { + /* Reference. */ + PUT_SHORT (((Flags & GBLSYM_VAL) == 0) ? GSY_S_M_REL : 0); + if ((Flags & GBLSYM_LCL) != 0) /* local symbols have extra field */ + PUT_SHORT (Current_Environment); + } + else + { + int sym_flags; + + /* Definition + [ assert (LSY_S_M_DEF == GSY_S_M_DEF && LSY_S_M_REL == GSY_S_M_REL); ]. */ + sym_flags = GSY_S_M_DEF; + if (Flags & GBLSYM_WEAK) + sym_flags |= GSY_S_M_WEAK; + if ((Flags & GBLSYM_VAL) == 0) + sym_flags |= GSY_S_M_REL; + PUT_SHORT (sym_flags); + if ((Flags & GBLSYM_LCL) != 0) /* local symbols have extra field */ + PUT_SHORT (Current_Environment); + + /* Psect Number. */ + if ((Flags & GBLSYM_LCL) == 0 && (unsigned) Psect_Number <= 255) + PUT_CHAR (Psect_Number); + else + PUT_SHORT (Psect_Number); + + /* Offset. */ + PUT_LONG (Psect_Offset); + } + + /* Finally, the global symbol name. */ + VMS_Case_Hack_Symbol (Name, Local); + PUT_COUNTED_STRING (Local); + + /* Flush the buffer if it is more than 75% full. */ + if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4)) + Flush_VMS_Object_Record_Buffer (); +} + +/* Define an environment to support local symbol references. + This is just to mollify the linker; we don't actually do + anything useful with it. */ + +static void +VMS_Local_Environment_Setup (const char *Env_Name) +{ + /* We are writing a GSD record. */ + Set_VMS_Object_File_Record (OBJ_S_C_GSD); + /* If the buffer is empty we must insert the GSD record type. */ + if (Object_Record_Offset == 0) + PUT_CHAR (OBJ_S_C_GSD); + /* We are writing an ENV subrecord. */ + PUT_CHAR (GSD_S_C_ENV); + + ++Current_Environment; /* index of environment being defined */ + + /* ENV$W_FLAGS: we are defining the next environment. It's not nested. */ + PUT_SHORT (ENV_S_M_DEF); + /* ENV$W_ENVINDX: index is always 0 for non-nested definitions. */ + PUT_SHORT (0); + + /* ENV$B_NAMLNG + ENV$T_NAME: environment name in ASCIC format. */ + if (!Env_Name) Env_Name = ""; + PUT_COUNTED_STRING ((char *)Env_Name); + + /* Flush the buffer if it is more than 75% full. */ + if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4)) + Flush_VMS_Object_Record_Buffer (); +} + + +/* Define a psect. */ + +static int +VMS_Psect_Spec (const char *Name, int Size, enum ps_type Type, struct VMS_Symbol *vsp) +{ + char Local[32]; + int Psect_Attributes; + + /* Generate the appropriate PSECT flags given the PSECT type. */ + switch (Type) + { + case ps_TEXT: + /* Text psects are PIC,noOVR,REL,noGBL,SHR,EXE,RD,noWRT. */ + Psect_Attributes = (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_SHR|GPS_S_M_EXE + |GPS_S_M_RD); + break; + case ps_DATA: + /* Data psects are PIC,noOVR,REL,noGBL,noSHR,noEXE,RD,WRT. */ + Psect_Attributes = (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_RD|GPS_S_M_WRT); + break; + case ps_COMMON: + /* Common block psects are: PIC,OVR,REL,GBL,noSHR,noEXE,RD,WRT. */ + Psect_Attributes = (GPS_S_M_PIC|GPS_S_M_OVR|GPS_S_M_REL|GPS_S_M_GBL + |GPS_S_M_RD|GPS_S_M_WRT); + break; + case ps_CONST: + /* Const data psects are: PIC,OVR,REL,GBL,noSHR,noEXE,RD,noWRT. */ + Psect_Attributes = (GPS_S_M_PIC|GPS_S_M_OVR|GPS_S_M_REL|GPS_S_M_GBL + |GPS_S_M_RD); + break; + case ps_CTORS: + /* Ctor psects are PIC,noOVR,REL,GBL,noSHR,noEXE,RD,noWRT. */ + Psect_Attributes = (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_GBL|GPS_S_M_RD); + break; + case ps_DTORS: + /* Dtor psects are PIC,noOVR,REL,GBL,noSHR,noEXE,RD,noWRT. */ + Psect_Attributes = (GPS_S_M_PIC|GPS_S_M_REL|GPS_S_M_GBL|GPS_S_M_RD); + break; + default: + /* impossible */ + error (_("Unknown VMS psect type (%ld)"), (long) Type); + break; + } + /* Modify the psect attributes according to any attribute string. */ + if (vsp && S_GET_TYPE (vsp->Symbol) == N_ABS) + Psect_Attributes |= GLOBALVALUE_BIT; + else if (HAS_PSECT_ATTRIBUTES (Name)) + VMS_Modify_Psect_Attributes (Name, &Psect_Attributes); + /* Check for globalref/def/val. */ + if ((Psect_Attributes & GLOBALVALUE_BIT) != 0) + { + /* globalvalue symbols were generated before. This code + prevents unsightly psect buildup, and makes sure that + fixup references are emitted correctly. */ + vsp->Psect_Index = -1; /* to catch errors */ + S_SET_TYPE (vsp->Symbol, N_UNDF); /* make refs work */ + return 1; /* decrement psect counter */ + } + + if ((Psect_Attributes & GLOBALSYMBOL_BIT) != 0) + { + switch (S_GET_RAW_TYPE (vsp->Symbol)) + { + case N_UNDF | N_EXT: + VMS_Global_Symbol_Spec (Name, vsp->Psect_Index, + vsp->Psect_Offset, GBLSYM_REF); + vsp->Psect_Index = -1; + S_SET_TYPE (vsp->Symbol, N_UNDF); + /* Return and indicate no psect. */ + return 1; + + case N_DATA | N_EXT: + VMS_Global_Symbol_Spec (Name, vsp->Psect_Index, + vsp->Psect_Offset, GBLSYM_DEF); + /* In this case we still generate the psect. */ + break; + + default: + as_fatal (_("Globalsymbol attribute for symbol %s was unexpected."), + Name); + break; + } + } + + /* Clear out the globalref/def stuff. */ + Psect_Attributes &= 0xffff; + /* We are writing a GSD record. */ + Set_VMS_Object_File_Record (OBJ_S_C_GSD); + /* If the buffer is empty we must insert the GSD record type. */ + if (Object_Record_Offset == 0) + PUT_CHAR (OBJ_S_C_GSD); + /* We are writing a PSECT definition subrecord. */ + PUT_CHAR (GSD_S_C_PSC); + /* Psects are always LONGWORD aligned. */ + PUT_CHAR (2); + /* Specify the psect attributes. */ + PUT_SHORT (Psect_Attributes); + /* Specify the allocation. */ + PUT_LONG (Size); + /* Finally, the psect name. */ + VMS_Case_Hack_Symbol (Name, Local); + PUT_COUNTED_STRING (Local); + /* Flush the buffer if it is more than 75% full. */ + if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4)) + Flush_VMS_Object_Record_Buffer (); + return 0; +} + + +/* Given the pointer to a symbol we calculate how big the data at the + symbol is. We do this by looking for the next symbol (local or global) + which will indicate the start of another datum. */ + +static offsetT +VMS_Initialized_Data_Size (symbolS *s0P, unsigned End_Of_Data) +{ + symbolS *s1P; + valueT s0P_val = S_GET_VALUE (s0P), s1P_val, + nearest_val = (valueT) End_Of_Data; + + /* Find the nearest symbol what follows this one. */ + for (s1P = symbol_rootP; s1P; s1P = symbol_next (s1P)) + { + /* The data type must match. */ + if (S_GET_TYPE (s1P) != N_DATA) + continue; + s1P_val = S_GET_VALUE (s1P); + if (s1P_val > s0P_val && s1P_val < nearest_val) + nearest_val = s1P_val; + } + /* Calculate its size. */ + return (offsetT) (nearest_val - s0P_val); +} + +/* Check symbol names for the Psect hack with a globalvalue, and then + generate globalvalues for those that have it. */ + +static void +VMS_Emit_Globalvalues (unsigned text_siz, unsigned data_siz, + char *Data_Segment) +{ + symbolS *sp; + char *stripped_name, *Name; + int Size; + int Psect_Attributes; + int globalvalue; + int typ, abstyp; + + /* Scan the symbol table for globalvalues, and emit def/ref when + required. These will be caught again later and converted to + N_UNDF. */ + for (sp = symbol_rootP; sp; sp = sp->sy_next) + { + typ = S_GET_RAW_TYPE (sp); + abstyp = ((typ & ~N_EXT) == N_ABS); + /* See if this is something we want to look at. */ + if (!abstyp && + typ != (N_DATA | N_EXT) && + typ != (N_UNDF | N_EXT)) + continue; + /* See if this has globalvalue specification. */ + Name = S_GET_NAME (sp); + + if (abstyp) + { + stripped_name = 0; + Psect_Attributes = GLOBALVALUE_BIT; + } + else if (HAS_PSECT_ATTRIBUTES (Name)) + { + stripped_name = xmalloc (strlen (Name) + 1); + strcpy (stripped_name, Name); + Psect_Attributes = 0; + VMS_Modify_Psect_Attributes (stripped_name, &Psect_Attributes); + } + else + continue; + + if ((Psect_Attributes & GLOBALVALUE_BIT) != 0) + { + switch (typ) + { + case N_ABS: + /* Local symbol references will want + to have an environment defined. */ + if (Current_Environment < 0) + VMS_Local_Environment_Setup (".N_ABS"); + VMS_Global_Symbol_Spec (Name, 0, + S_GET_VALUE (sp), + GBLSYM_DEF|GBLSYM_VAL|GBLSYM_LCL); + break; + case N_ABS | N_EXT: + VMS_Global_Symbol_Spec (Name, 0, + S_GET_VALUE (sp), + GBLSYM_DEF|GBLSYM_VAL); + break; + case N_UNDF | N_EXT: + VMS_Global_Symbol_Spec (stripped_name, 0, 0, GBLSYM_VAL); + break; + case N_DATA | N_EXT: + Size = VMS_Initialized_Data_Size (sp, text_siz + data_siz); + if (Size > 4) + error (_("Invalid data type for globalvalue")); + globalvalue = md_chars_to_number (Data_Segment + + S_GET_VALUE (sp) - text_siz , Size); + /* Three times for good luck. The linker seems to get confused + if there are fewer than three */ + VMS_Global_Symbol_Spec (stripped_name, 0, 0, GBLSYM_VAL); + VMS_Global_Symbol_Spec (stripped_name, 0, globalvalue, + GBLSYM_DEF|GBLSYM_VAL); + VMS_Global_Symbol_Spec (stripped_name, 0, globalvalue, + GBLSYM_DEF|GBLSYM_VAL); + break; + default: + as_warn (_("Invalid globalvalue of %s"), stripped_name); + break; + } + } + + if (stripped_name) + free (stripped_name); + } + +} + + +/* Define a procedure entry pt/mask. */ + +static void +VMS_Procedure_Entry_Pt (char *Name, int Psect_Number, int Psect_Offset, + int Entry_Mask) +{ + char Local[32]; + + /* We are writing a GSD record. */ + Set_VMS_Object_File_Record (OBJ_S_C_GSD); + /* If the buffer is empty we must insert the GSD record type. */ + if (Object_Record_Offset == 0) + PUT_CHAR (OBJ_S_C_GSD); + /* We are writing a Procedure Entry Pt/Mask subrecord. */ + PUT_CHAR (((unsigned) Psect_Number <= 255) ? GSD_S_C_EPM : GSD_S_C_EPMW); + /* Data type is undefined. */ + PUT_CHAR (0); + /* Flags = "RELOCATABLE" and "DEFINED". */ + PUT_SHORT (GSY_S_M_DEF | GSY_S_M_REL); + /* Psect Number. */ + if ((unsigned) Psect_Number <= 255) + PUT_CHAR (Psect_Number); + else + PUT_SHORT (Psect_Number); + /* Offset. */ + PUT_LONG (Psect_Offset); + /* Entry mask. */ + PUT_SHORT (Entry_Mask); + /* Finally, the global symbol name. */ + VMS_Case_Hack_Symbol (Name, Local); + PUT_COUNTED_STRING (Local); + /* Flush the buffer if it is more than 75% full. */ + if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4)) + Flush_VMS_Object_Record_Buffer (); +} + + +/* Set the current location counter to a particular Psect and Offset. */ + +static void +VMS_Set_Psect (int Psect_Index, int Offset, int Record_Type) +{ + /* We are writing a "Record_Type" record. */ + Set_VMS_Object_File_Record (Record_Type); + /* If the buffer is empty we must insert the record type. */ + if (Object_Record_Offset == 0) + PUT_CHAR (Record_Type); + /* Stack the Psect base + Offset. */ + vms_tir_stack_psect (Psect_Index, Offset, 0); + /* Set relocation base. */ + PUT_CHAR (TIR_S_C_CTL_SETRB); + /* Flush the buffer if it is more than 75% full. */ + if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4)) + Flush_VMS_Object_Record_Buffer (); +} + + +/* Store repeated immediate data in current Psect. */ + +static void +VMS_Store_Repeated_Data (int Repeat_Count, char *Pointer, int Size, + int Record_Type) +{ + /* Ignore zero bytes/words/longwords. */ + switch (Size) + { + case 4: + if (Pointer[3] != 0 || Pointer[2] != 0) break; + /* else FALLTHRU */ + case 2: + if (Pointer[1] != 0) break; + /* else FALLTHRU */ + case 1: + if (Pointer[0] != 0) break; + /* zero value */ + return; + default: + break; + } + /* If the data is too big for a TIR_S_C_STO_RIVB sub-record + then we do it manually. */ + if (Size > 255) + { + while (--Repeat_Count >= 0) + VMS_Store_Immediate_Data (Pointer, Size, Record_Type); + return; + } + /* We are writing a "Record_Type" record. */ + Set_VMS_Object_File_Record (Record_Type); + /* If the buffer is empty we must insert record type. */ + if (Object_Record_Offset == 0) + PUT_CHAR (Record_Type); + /* Stack the repeat count. */ + PUT_CHAR (TIR_S_C_STA_LW); + PUT_LONG (Repeat_Count); + /* And now the command and its data. */ + PUT_CHAR (TIR_S_C_STO_RIVB); + PUT_CHAR (Size); + while (--Size >= 0) + PUT_CHAR (*Pointer++); + /* Flush the buffer if it is more than 75% full. */ + if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4)) + Flush_VMS_Object_Record_Buffer (); +} + + +/* Store a Position Independent Reference. */ + +static void +VMS_Store_PIC_Symbol_Reference (symbolS *Symbol, int Offset, int PC_Relative, + int Psect, int Psect_Offset, int Record_Type) +{ + struct VMS_Symbol *vsp = Symbol->sy_obj; + char Local[32]; + int local_sym = 0; + + /* We are writing a "Record_Type" record. */ + Set_VMS_Object_File_Record (Record_Type); + /* If the buffer is empty we must insert record type. */ + if (Object_Record_Offset == 0) + PUT_CHAR (Record_Type); + /* Set to the appropriate offset in the Psect. + For a Code reference we need to fix the operand + specifier as well, so back up 1 byte; + for a Data reference we just store HERE. */ + VMS_Set_Psect (Psect, + PC_Relative ? Psect_Offset - 1 : Psect_Offset, + Record_Type); + /* Make sure we are still generating a "Record Type" record. */ + if (Object_Record_Offset == 0) + PUT_CHAR (Record_Type); + /* Dispatch on symbol type (so we can stack its value). */ + switch (S_GET_RAW_TYPE (Symbol)) + { + /* Global symbol. */ + case N_ABS: + local_sym = 1; + /*FALLTHRU*/ + case N_ABS | N_EXT: +#ifdef NOT_VAX_11_C_COMPATIBLE + case N_UNDF | N_EXT: + case N_DATA | N_EXT: +#endif /* NOT_VAX_11_C_COMPATIBLE */ + case N_UNDF: + case N_TEXT | N_EXT: + /* Get the symbol name (case hacked). */ + VMS_Case_Hack_Symbol (S_GET_NAME (Symbol), Local); + /* Stack the global symbol value. */ + if (!local_sym) + { + PUT_CHAR (TIR_S_C_STA_GBL); + } + else + { + /* Local symbols have an extra field. */ + PUT_CHAR (TIR_S_C_STA_LSY); + PUT_SHORT (Current_Environment); + } + PUT_COUNTED_STRING (Local); + if (Offset) + { + /* Stack the longword offset. */ + PUT_CHAR (TIR_S_C_STA_LW); + PUT_LONG (Offset); + /* Add the two, leaving the result on the stack. */ + PUT_CHAR (TIR_S_C_OPR_ADD); + } + break; + /* Uninitialized local data. */ + case N_BSS: + /* Stack the Psect (+offset). */ + vms_tir_stack_psect (vsp->Psect_Index, + vsp->Psect_Offset + Offset, + 0); + break; + /* Local text. */ + case N_TEXT: + /* Stack the Psect (+offset). */ + vms_tir_stack_psect (vsp->Psect_Index, + S_GET_VALUE (Symbol) + Offset, + 0); + break; + /* Initialized local or global data. */ + case N_DATA: +#ifndef NOT_VAX_11_C_COMPATIBLE + case N_UNDF | N_EXT: + case N_DATA | N_EXT: +#endif /* NOT_VAX_11_C_COMPATIBLE */ + /* Stack the Psect (+offset). */ + vms_tir_stack_psect (vsp->Psect_Index, + vsp->Psect_Offset + Offset, + 0); + break; + } + /* Store either a code or data reference. */ + PUT_CHAR (PC_Relative ? TIR_S_C_STO_PICR : TIR_S_C_STO_PIDR); + /* Flush the buffer if it is more than 75% full. */ + if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4)) + Flush_VMS_Object_Record_Buffer (); +} + + +/* Check in the text area for an indirect pc-relative reference + and fix it up with addressing mode 0xff [PC indirect] + + THIS SHOULD BE REPLACED BY THE USE OF TIR_S_C_STO_PIRR IN THE + PIC CODE GENERATING FIXUP ROUTINE. */ + +static void +VMS_Fix_Indirect_Reference (int Text_Psect, addressT Offset, + fragS *fragP, fragS *text_frag_root) +{ + /* The addressing mode byte is 1 byte before the address. */ + Offset--; + /* Is it in THIS frag? */ + if ((Offset < fragP->fr_address) || + (Offset >= (fragP->fr_address + fragP->fr_fix))) + { + /* We need to search for the fragment containing this + Offset. */ + for (fragP = text_frag_root; fragP; fragP = fragP->fr_next) + { + if ((Offset >= fragP->fr_address) && + (Offset < (fragP->fr_address + fragP->fr_fix))) + break; + } + /* If we couldn't find the frag, things are BAD! */ + if (fragP == 0) + error (_("Couldn't find fixup fragment when checking for indirect reference")); + } + /* Check for indirect PC relative addressing mode. */ + if (fragP->fr_literal[Offset - fragP->fr_address] == (char) 0xff) + { + static char Address_Mode = (char) 0xff; + + /* Yes: Store the indirect mode back into the image + to fix up the damage done by STO_PICR. */ + VMS_Set_Psect (Text_Psect, Offset, OBJ_S_C_TIR); + VMS_Store_Immediate_Data (&Address_Mode, 1, OBJ_S_C_TIR); + } +} + + +/* If the procedure "main()" exists we have to add the instruction + "jsb c$main_args" at the beginning to be compatible with VAX-11 "C". + + FIXME: the macro name `HACK_DEC_C_STARTUP' should be renamed + to `HACK_VAXCRTL_STARTUP' because Digital's compiler + named "DEC C" uses run-time library "DECC$SHR", but this + startup code is for "VAXCRTL", the library for Digital's + older "VAX C". Also, this extra code isn't needed for + supporting gcc because it already generates the VAXCRTL + startup call when compiling main(). The reference to + `flag_hash_long_names' looks very suspicious too; + probably an old-style command line option was inadvertently + overloaded here, then blindly converted into the new one. */ +void +vms_check_for_main (void) +{ + symbolS *symbolP; +#ifdef HACK_DEC_C_STARTUP /* JF */ + struct frchain *frchainP; + fragS *fragP; + fragS **prev_fragPP; + struct fix *fixP; + fragS *New_Frag; + int i; +#endif /* HACK_DEC_C_STARTUP */ + + symbolP = (symbolS *) symbol_find ("_main"); + if (symbolP && !S_IS_DEBUG (symbolP) && + S_IS_EXTERNAL (symbolP) && (S_GET_TYPE (symbolP) == N_TEXT)) + { +#ifdef HACK_DEC_C_STARTUP + if (!flag_hash_long_names) + { +#endif + /* Remember the entry point symbol. */ + Entry_Point_Symbol = symbolP; +#ifdef HACK_DEC_C_STARTUP + } + else + { + /* Scan all the fragment chains for the one with "_main" + (Actually we know the fragment from the symbol, but we need + the previous fragment so we can change its pointer). */ + frchainP = frchain_root; + while (frchainP) + { + /* Scan all the fragments in this chain, remembering + the "previous fragment". */ + prev_fragPP = &frchainP->frch_root; + fragP = frchainP->frch_root; + while (fragP && (fragP != frchainP->frch_last)) + { + /* Is this the fragment ? */ + if (fragP == symbolP->sy_frag) + { + /* Yes: Modify the fragment by replacing + it with a new fragment. */ + New_Frag = + xmalloc (sizeof (*New_Frag) + + fragP->fr_fix + + fragP->fr_var + + 5); + /* The fragments are the same except + that the "fixed" area is larger. */ + *New_Frag = *fragP; + New_Frag->fr_fix += 6; + /* Copy the literal data opening a hole + 2 bytes after "_main" (i.e. just after + the entry mask). Into which we place + the JSB instruction. */ + New_Frag->fr_literal[0] = fragP->fr_literal[0]; + New_Frag->fr_literal[1] = fragP->fr_literal[1]; + New_Frag->fr_literal[2] = 0x16; /* Jsb */ + New_Frag->fr_literal[3] = 0xef; + New_Frag->fr_literal[4] = 0; + New_Frag->fr_literal[5] = 0; + New_Frag->fr_literal[6] = 0; + New_Frag->fr_literal[7] = 0; + for (i = 2; i < fragP->fr_fix + fragP->fr_var; i++) + New_Frag->fr_literal[i + 6] = + fragP->fr_literal[i]; + /* Now replace the old fragment with the + newly generated one. */ + *prev_fragPP = New_Frag; + /* Remember the entry point symbol. */ + Entry_Point_Symbol = symbolP; + /* Scan the text area fixup structures + as offsets in the fragment may have changed. */ + for (fixP = text_fix_root; fixP; fixP = fixP->fx_next) + { + /* Look for references to this fragment. */ + if (fixP->fx_frag == fragP) + { + /* Change the fragment pointer. */ + fixP->fx_frag = New_Frag; + /* If the offset is after the entry mask we need + to account for the JSB instruction we just + inserted. */ + if (fixP->fx_where >= 2) + fixP->fx_where += 6; + } + } + /* Scan the symbols as offsets in the + fragment may have changed. */ + for (symbolP = symbol_rootP; + symbolP; + symbolP = symbol_next (symbolP)) + { + /* Look for references to this fragment. */ + if (symbolP->sy_frag == fragP) + { + /* Change the fragment pointer. */ + symbolP->sy_frag = New_Frag; + /* If the offset is after the entry mask we need + to account for the JSB instruction we just + inserted. */ + if (S_GET_VALUE (symbolP) >= 2) + S_SET_VALUE (symbolP, + S_GET_VALUE (symbolP) + 6); + } + } + /* Make a symbol reference to "_c$main_args" so we + can get its address inserted into the JSB + instruction. */ + symbolP = xmalloc (sizeof (*symbolP)); + S_SET_NAME (symbolP, "_C$MAIN_ARGS"); + S_SET_TYPE (symbolP, N_UNDF); + S_SET_OTHER (symbolP, 0); + S_SET_DESC (symbolP, 0); + S_SET_VALUE (symbolP, 0); + symbolP->sy_name_offset = 0; + symbolP->sy_number = 0; + symbolP->sy_obj = 0; + symbolP->sy_frag = New_Frag; + symbolP->sy_resolved = 0; + symbolP->sy_resolving = 0; + /* This actually inserts at the beginning of the list. */ + symbol_append (symbol_rootP, symbolP, + &symbol_rootP, &symbol_lastP); + + symbol_rootP = symbolP; + /* Generate a text fixup structure + to get "_c$main_args" stored into the + JSB instruction. */ + fixP = xmalloc (sizeof (*fixP)); + fixP->fx_frag = New_Frag; + fixP->fx_where = 4; + fixP->fx_addsy = symbolP; + fixP->fx_subsy = 0; + fixP->fx_offset = 0; + fixP->fx_size = 4; + fixP->fx_pcrel = 1; + fixP->fx_next = text_fix_root; + text_fix_root = fixP; + /* Now make sure we exit from the loop. */ + frchainP = 0; + break; + } + /* Try the next fragment. */ + prev_fragPP = &fragP->fr_next; + fragP = fragP->fr_next; + } + /* Try the next fragment chain. */ + if (frchainP) + frchainP = frchainP->frch_next; + } + } +#endif /* HACK_DEC_C_STARTUP */ + } +} + + +/* Beginning of vms_write_object_file(). */ + +static +struct vms_obj_state +{ + /* Next program section index to use. */ + int psect_number; + + /* Psect index for code. Always ends up #0. */ + int text_psect; + + /* Psect index for initialized static variables. */ + int data_psect; + + /* Psect index for uninitialized static variables. */ + int bss_psect; + + /* Psect index for static constructors. */ + int ctors_psect; + + /* Psect index for static destructors. */ + int dtors_psect; + + /* Number of bytes used for local symbol data. */ + int local_initd_data_size; + + /* Dynamic buffer for initialized data. */ + char *data_segment; + +} vms_obj_state; + +#define Psect_Number vms_obj_state.psect_number +#define Text_Psect vms_obj_state.text_psect +#define Data_Psect vms_obj_state.data_psect +#define Bss_Psect vms_obj_state.bss_psect +#define Ctors_Psect vms_obj_state.ctors_psect +#define Dtors_Psect vms_obj_state.dtors_psect +#define Local_Initd_Data_Size vms_obj_state.local_initd_data_size +#define Data_Segment vms_obj_state.data_segment + +#define IS_GXX_VTABLE(symP) (strncmp (S_GET_NAME (symP), "__vt.", 5) == 0) +#define IS_GXX_XTOR(symP) (strncmp (S_GET_NAME (symP), "__GLOBAL_.", 10) == 0) +#define XTOR_SIZE 4 + + +/* Perform text segment fixups. */ + +static void +vms_fixup_text_section (unsigned text_siz ATTRIBUTE_UNUSED, + struct frag *text_frag_root, + struct frag *data_frag_root) +{ + fragS *fragP; + struct fix *fixP; + offsetT dif; + + /* Scan the text fragments. */ + for (fragP = text_frag_root; fragP; fragP = fragP->fr_next) + { + /* Stop if we get to the data fragments. */ + if (fragP == data_frag_root) + break; + /* Ignore fragments with no data. */ + if ((fragP->fr_fix == 0) && (fragP->fr_var == 0)) + continue; + /* Go to the appropriate offset in the Text Psect. */ + VMS_Set_Psect (Text_Psect, fragP->fr_address, OBJ_S_C_TIR); + /* Store the "fixed" part. */ + if (fragP->fr_fix) + VMS_Store_Immediate_Data (fragP->fr_literal, + fragP->fr_fix, + OBJ_S_C_TIR); + /* Store the "variable" part. */ + if (fragP->fr_var && fragP->fr_offset) + VMS_Store_Repeated_Data (fragP->fr_offset, + fragP->fr_literal + fragP->fr_fix, + fragP->fr_var, + OBJ_S_C_TIR); + } + + /* Now we go through the text segment fixups and generate + TIR records to fix up addresses within the Text Psect. */ + for (fixP = text_fix_root; fixP; fixP = fixP->fx_next) + { + /* We DO handle the case of "Symbol - Symbol" as + long as it is in the same segment. */ + if (fixP->fx_subsy && fixP->fx_addsy) + { + /* They need to be in the same segment. */ + if (S_GET_RAW_TYPE (fixP->fx_subsy) != + S_GET_RAW_TYPE (fixP->fx_addsy)) + error (_("Fixup data addsy and subsy don't have the same type")); + /* And they need to be in one that we can check the psect on. */ + if ((S_GET_TYPE (fixP->fx_addsy) != N_DATA) && + (S_GET_TYPE (fixP->fx_addsy) != N_TEXT)) + error (_("Fixup data addsy and subsy don't have an appropriate type")); + /* This had better not be PC relative! */ + if (fixP->fx_pcrel) + error (_("Fixup data is erroneously \"pcrel\"")); + /* Subtract their values to get the difference. */ + dif = S_GET_VALUE (fixP->fx_addsy) - S_GET_VALUE (fixP->fx_subsy); + md_number_to_chars (Local, (valueT)dif, fixP->fx_size); + /* Now generate the fixup object records; + set the psect and store the data. */ + VMS_Set_Psect (Text_Psect, + fixP->fx_where + fixP->fx_frag->fr_address, + OBJ_S_C_TIR); + VMS_Store_Immediate_Data (Local, + fixP->fx_size, + OBJ_S_C_TIR); + continue; + } + /* Size will HAVE to be "long". */ + if (fixP->fx_size != 4) + error (_("Fixup datum is not a longword")); + /* Symbol must be "added" (if it is ever + subtracted we can fix this assumption). */ + if (fixP->fx_addsy == 0) + error (_("Fixup datum is not \"fixP->fx_addsy\"")); + /* Store the symbol value in a PIC fashion. */ + VMS_Store_PIC_Symbol_Reference (fixP->fx_addsy, + fixP->fx_offset, + fixP->fx_pcrel, + Text_Psect, + fixP->fx_where + fixP->fx_frag->fr_address, + OBJ_S_C_TIR); + /* Check for indirect address reference, which has to be fixed up + (as the linker will screw it up with TIR_S_C_STO_PICR). */ + if (fixP->fx_pcrel) + VMS_Fix_Indirect_Reference (Text_Psect, + fixP->fx_where + fixP->fx_frag->fr_address, + fixP->fx_frag, + text_frag_root); + } +} + + +/* Create a buffer holding the data segment. */ + +static void +synthesize_data_segment (unsigned data_siz, unsigned text_siz, + struct frag *data_frag_root) +{ + fragS *fragP; + char *fill_literal; + long fill_size, count, i; + + /* Allocate the data segment. */ + Data_Segment = xmalloc (data_siz); + + /* Run through the data fragments, filling in the segment. */ + for (fragP = data_frag_root; fragP; fragP = fragP->fr_next) + { + i = fragP->fr_address - text_siz; + if (fragP->fr_fix) + memcpy (Data_Segment + i, fragP->fr_literal, fragP->fr_fix); + i += fragP->fr_fix; + + if ((fill_size = fragP->fr_var) != 0) + { + fill_literal = fragP->fr_literal + fragP->fr_fix; + for (count = fragP->fr_offset; count; count--) + { + memcpy (Data_Segment + i, fill_literal, fill_size); + i += fill_size; + } + } + } +} + +/* Perform data segment fixups. */ + +static void +vms_fixup_data_section (unsigned int data_siz ATTRIBUTE_UNUSED, + unsigned int text_siz) +{ + struct VMS_Symbol *vsp; + struct fix *fixP; + symbolS *sp; + addressT fr_address; + offsetT dif; + valueT val; + + /* Run through all the data symbols and store the data. */ + for (vsp = VMS_Symbols; vsp; vsp = vsp->Next) + { + /* Ignore anything other than data symbols. */ + if (S_GET_TYPE (vsp->Symbol) != N_DATA) + continue; + /* Set the Psect + Offset. */ + VMS_Set_Psect (vsp->Psect_Index, + vsp->Psect_Offset, + OBJ_S_C_TIR); + /* Store the data. */ + val = S_GET_VALUE (vsp->Symbol); + VMS_Store_Immediate_Data (Data_Segment + val - text_siz, + vsp->Size, + OBJ_S_C_TIR); + } /* N_DATA symbol loop */ + + /* Now we go through the data segment fixups and generate + TIR records to fix up addresses within the Data Psects. */ + for (fixP = data_fix_root; fixP; fixP = fixP->fx_next) + { + /* Find the symbol for the containing datum. */ + for (vsp = VMS_Symbols; vsp; vsp = vsp->Next) + { + /* Only bother with Data symbols. */ + sp = vsp->Symbol; + if (S_GET_TYPE (sp) != N_DATA) + continue; + /* Ignore symbol if After fixup. */ + val = S_GET_VALUE (sp); + fr_address = fixP->fx_frag->fr_address; + if (val > fixP->fx_where + fr_address) + continue; + /* See if the datum is here. */ + if (val + vsp->Size <= fixP->fx_where + fr_address) + continue; + /* We DO handle the case of "Symbol - Symbol" as + long as it is in the same segment. */ + if (fixP->fx_subsy && fixP->fx_addsy) + { + /* They need to be in the same segment. */ + if (S_GET_RAW_TYPE (fixP->fx_subsy) != + S_GET_RAW_TYPE (fixP->fx_addsy)) + error (_("Fixup data addsy and subsy don't have the same type")); + /* And they need to be in one that we can check the psect on. */ + if ((S_GET_TYPE (fixP->fx_addsy) != N_DATA) && + (S_GET_TYPE (fixP->fx_addsy) != N_TEXT)) + error (_("Fixup data addsy and subsy don't have an appropriate type")); + /* This had better not be PC relative! */ + if (fixP->fx_pcrel) + error (_("Fixup data is erroneously \"pcrel\"")); + /* Subtract their values to get the difference. */ + dif = S_GET_VALUE (fixP->fx_addsy) - S_GET_VALUE (fixP->fx_subsy); + md_number_to_chars (Local, (valueT)dif, fixP->fx_size); + /* Now generate the fixup object records; + set the psect and store the data. */ + VMS_Set_Psect (vsp->Psect_Index, + fr_address + fixP->fx_where + - val + vsp->Psect_Offset, + OBJ_S_C_TIR); + VMS_Store_Immediate_Data (Local, + fixP->fx_size, + OBJ_S_C_TIR); + break; /* done with this fixup */ + } + /* Size will HAVE to be "long". */ + if (fixP->fx_size != 4) + error (_("Fixup datum is not a longword")); + /* Symbol must be "added" (if it is ever + subtracted we can fix this assumption). */ + if (fixP->fx_addsy == 0) + error (_("Fixup datum is not \"fixP->fx_addsy\"")); + /* Store the symbol value in a PIC fashion. */ + VMS_Store_PIC_Symbol_Reference (fixP->fx_addsy, + fixP->fx_offset, + fixP->fx_pcrel, + vsp->Psect_Index, + fr_address + fixP->fx_where + - val + vsp->Psect_Offset, + OBJ_S_C_TIR); + /* Done with this fixup. */ + break; + } + } +} + +/* Perform ctors/dtors segment fixups. */ + +static void +vms_fixup_xtors_section (struct VMS_Symbol *symbols, + int sect_no ATTRIBUTE_UNUSED) +{ + struct VMS_Symbol *vsp; + + /* Run through all the symbols and store the data. */ + for (vsp = symbols; vsp; vsp = vsp->Next) + { + symbolS *sp; + + /* Set relocation base. */ + VMS_Set_Psect (vsp->Psect_Index, vsp->Psect_Offset, OBJ_S_C_TIR); + + sp = vsp->Symbol; + /* Stack the Psect base with its offset. */ + VMS_Set_Data (Text_Psect, S_GET_VALUE (sp), OBJ_S_C_TIR, 0); + } + /* Flush the buffer if it is more than 75% full. */ + if (Object_Record_Offset > (sizeof (Object_Record_Buffer) * 3 / 4)) + Flush_VMS_Object_Record_Buffer (); +} + + +/* Define symbols for the linker. */ + +static void +global_symbol_directory (unsigned text_siz, unsigned data_siz) +{ + fragS *fragP; + symbolS *sp; + struct VMS_Symbol *vsp; + int Globalref, define_as_global_symbol; + +#if 0 + /* The g++ compiler does not write out external references to + vtables correctly. Check for this and holler if we see it + happening. If that compiler bug is ever fixed we can remove + this. + + (Jun'95: gcc 2.7.0's cc1plus still exhibits this behavior.) + + This was reportedly fixed as of June 2, 1998. */ + + for (sp = symbol_rootP; sp; sp = symbol_next (sp)) + if (S_GET_RAW_TYPE (sp) == N_UNDF && IS_GXX_VTABLE (sp)) + { + S_SET_TYPE (sp, N_UNDF | N_EXT); + S_SET_OTHER (sp, 1); + as_warn (_("g++ wrote an extern reference to `%s' as a routine.\nI will fix it, but I hope that it was note really a routine."), + S_GET_NAME (sp)); + } +#endif + + /* Now scan the symbols and emit the appropriate GSD records. */ + for (sp = symbol_rootP; sp; sp = symbol_next (sp)) + { + define_as_global_symbol = 0; + vsp = 0; + /* Dispatch on symbol type. */ + switch (S_GET_RAW_TYPE (sp)) + { + + /* Global uninitialized data. */ + case N_UNDF | N_EXT: + /* Make a VMS data symbol entry. */ + vsp = xmalloc (sizeof *vsp); + vsp->Symbol = sp; + vsp->Size = S_GET_VALUE (sp); + vsp->Psect_Index = Psect_Number++; + vsp->Psect_Offset = 0; + vsp->Next = VMS_Symbols; + VMS_Symbols = vsp; + sp->sy_obj = vsp; + /* Make the psect for this data. */ + Globalref = VMS_Psect_Spec (S_GET_NAME (sp), + vsp->Size, + S_GET_OTHER (sp) ? ps_CONST : ps_COMMON, + vsp); + if (Globalref) + Psect_Number--; +#ifdef NOT_VAX_11_C_COMPATIBLE + define_as_global_symbol = 1; +#else + /* See if this is an external vtable. We want to help the + linker find these things in libraries, so we make a symbol + reference. This is not compatible with VAX-C usage for + variables, but since vtables are only used internally by + g++, we can get away with this hack. */ + define_as_global_symbol = IS_GXX_VTABLE (sp); +#endif + break; + + /* Local uninitialized data. */ + case N_BSS: + /* Make a VMS data symbol entry. */ + vsp = xmalloc (sizeof *vsp); + vsp->Symbol = sp; + vsp->Size = 0; + vsp->Psect_Index = Bss_Psect; + vsp->Psect_Offset = S_GET_VALUE (sp) - bss_address_frag.fr_address; + vsp->Next = VMS_Symbols; + VMS_Symbols = vsp; + sp->sy_obj = vsp; + break; + + /* Global initialized data. */ + case N_DATA | N_EXT: + /* Make a VMS data symbol entry. */ + vsp = xmalloc (sizeof *vsp); + vsp->Symbol = sp; + vsp->Size = VMS_Initialized_Data_Size (sp, text_siz + data_siz); + vsp->Psect_Index = Psect_Number++; + vsp->Psect_Offset = 0; + vsp->Next = VMS_Symbols; + VMS_Symbols = vsp; + sp->sy_obj = vsp; + /* Make its psect. */ + Globalref = VMS_Psect_Spec (S_GET_NAME (sp), + vsp->Size, + S_GET_OTHER (sp) ? ps_CONST : ps_COMMON, + vsp); + if (Globalref) + Psect_Number--; +#ifdef NOT_VAX_11_C_COMPATIBLE + define_as_global_symbol = 1; +#else + /* See N_UNDF|N_EXT above for explanation. */ + define_as_global_symbol = IS_GXX_VTABLE (sp); +#endif + break; + + /* Local initialized data. */ + case N_DATA: + { + char *sym_name = S_GET_NAME (sp); + + /* Always suppress local numeric labels. */ + if (sym_name && strcmp (sym_name, FAKE_LABEL_NAME) == 0) + break; + + /* Make a VMS data symbol entry. */ + vsp = xmalloc (sizeof *vsp); + vsp->Symbol = sp; + vsp->Size = VMS_Initialized_Data_Size (sp, text_siz + data_siz); + vsp->Psect_Index = Data_Psect; + vsp->Psect_Offset = Local_Initd_Data_Size; + Local_Initd_Data_Size += vsp->Size; + vsp->Next = VMS_Symbols; + VMS_Symbols = vsp; + sp->sy_obj = vsp; + } + break; + + /* Global Text definition. */ + case N_TEXT | N_EXT: + { + + if (IS_GXX_XTOR (sp)) + { + vsp = xmalloc (sizeof *vsp); + vsp->Symbol = sp; + vsp->Size = XTOR_SIZE; + sp->sy_obj = vsp; + switch ((S_GET_NAME (sp))[10]) + { + case 'I': + vsp->Psect_Index = Ctors_Psect; + vsp->Psect_Offset = (Ctors_Symbols==0)?0:(Ctors_Symbols->Psect_Offset+XTOR_SIZE); + vsp->Next = Ctors_Symbols; + Ctors_Symbols = vsp; + break; + case 'D': + vsp->Psect_Index = Dtors_Psect; + vsp->Psect_Offset = (Dtors_Symbols==0)?0:(Dtors_Symbols->Psect_Offset+XTOR_SIZE); + vsp->Next = Dtors_Symbols; + Dtors_Symbols = vsp; + break; + case 'G': + as_warn (_("Can't handle global xtors symbols yet.")); + break; + default: + as_warn (_("Unknown %s"), S_GET_NAME (sp)); + break; + } + } + else + { + unsigned short Entry_Mask; + + /* Get the entry mask. */ + fragP = sp->sy_frag; + /* First frag might be empty if we're generating listings. + So skip empty rs_fill frags. */ + while (fragP && fragP->fr_type == rs_fill && fragP->fr_fix == 0) + fragP = fragP->fr_next; + + /* If first frag doesn't contain the data, what do we do? + If it's possibly smaller than two bytes, that would + imply that the entry mask is not stored where we're + expecting it. + + If you can find a test case that triggers this, report + it (and tell me what the entry mask field ought to be), + and I'll try to fix it. KR */ + if (fragP->fr_fix < 2) + abort (); + + Entry_Mask = (fragP->fr_literal[0] & 0x00ff) | + ((fragP->fr_literal[1] & 0x00ff) << 8); + /* Define the procedure entry point. */ + VMS_Procedure_Entry_Pt (S_GET_NAME (sp), + Text_Psect, + S_GET_VALUE (sp), + Entry_Mask); + } + break; + } + + /* Local Text definition. */ + case N_TEXT: + /* Make a VMS data symbol entry. */ + if (Text_Psect != -1) + { + vsp = xmalloc (sizeof *vsp); + vsp->Symbol = sp; + vsp->Size = 0; + vsp->Psect_Index = Text_Psect; + vsp->Psect_Offset = S_GET_VALUE (sp); + vsp->Next = VMS_Symbols; + VMS_Symbols = vsp; + sp->sy_obj = vsp; + } + break; + + /* Global Reference. */ + case N_UNDF: + /* Make a GSD global symbol reference record. */ + VMS_Global_Symbol_Spec (S_GET_NAME (sp), + 0, + 0, + GBLSYM_REF); + break; + + /* Absolute symbol. */ + case N_ABS: + case N_ABS | N_EXT: + /* gcc doesn't generate these; + VMS_Emit_Globalvalue handles them though. */ + vsp = xmalloc (sizeof *vsp); + vsp->Symbol = sp; + vsp->Size = 4; /* always assume 32 bits */ + vsp->Psect_Index = 0; + vsp->Psect_Offset = S_GET_VALUE (sp); + vsp->Next = VMS_Symbols; + VMS_Symbols = vsp; + sp->sy_obj = vsp; + break; + + /* Anything else. */ + default: + /* Ignore STAB symbols, including .stabs emitted by g++. */ + if (S_IS_DEBUG (sp) || (S_GET_TYPE (sp) == 22)) + break; + /* + * Error otherwise. + */ + as_tsktsk (_("unhandled stab type %d"), S_GET_TYPE (sp)); + break; + } + + /* Global symbols have different linkage than external variables. */ + if (define_as_global_symbol) + VMS_Global_Symbol_Spec (S_GET_NAME (sp), + vsp->Psect_Index, + 0, + GBLSYM_DEF); + } +} + + +/* Output debugger symbol table information for symbols which + are local to a specific routine. */ + +static void +local_symbols_DST (symbolS *s0P, symbolS *Current_Routine) +{ + symbolS *s1P; + char *s0P_name, *pnt0, *pnt1; + + s0P_name = S_GET_NAME (s0P); + if (*s0P_name++ != '_') + return; + + for (s1P = Current_Routine; s1P; s1P = symbol_next (s1P)) + { +#if 0 /* redundant; RAW_TYPE != N_FUN suffices */ + if (!S_IS_DEBUG (s1P)) + continue; +#endif + if (S_GET_RAW_TYPE (s1P) != N_FUN) + continue; + pnt0 = s0P_name; + pnt1 = S_GET_NAME (s1P); + /* We assume the two strings are never exactly equal... */ + while (*pnt0++ == *pnt1++) + { + } + /* Found it if s0P name is exhausted and s1P name has ":F" or ":f" next. + Note: both pointers have advanced one past the non-matching char. */ + if ((*pnt1 == 'F' || *pnt1 == 'f') && *--pnt1 == ':' && *--pnt0 == '\0') + { + Define_Routine (s1P, 0, Current_Routine, Text_Psect); + return; + } + } +} + +/* Construct and output the debug symbol table. */ + +static void +vms_build_DST (unsigned text_siz) +{ + symbolS *symbolP; + symbolS *Current_Routine = 0; + struct input_file *Cur_File = 0; + offsetT Cur_Offset = -1; + int Cur_Line_Number = 0; + int File_Number = 0; + int Debugger_Offset = 0; + int file_available; + int dsc; + offsetT val; + + /* Write the Traceback Begin Module record. */ + VMS_TBT_Module_Begin (); + + /* Output debugging info for global variables and static variables + that are not specific to one routine. We also need to examine + all stabs directives, to find the definitions to all of the + advanced data types, and this is done by VMS_LSYM_Parse. This + needs to be done before any definitions are output to the object + file, since there can be forward references in the stabs + directives. When through with parsing, the text of the stabs + directive is altered, with the definitions removed, so that later + passes will see directives as they would be written if the type + were already defined. + + We also look for files and include files, and make a list of + them. We examine the source file numbers to establish the actual + lines that code was generated from, and then generate offsets. */ + VMS_LSYM_Parse (); + for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP)) + { + /* Only deal with STAB symbols here. */ + if (!S_IS_DEBUG (symbolP)) + continue; + /* Dispatch on STAB type. */ + switch (S_GET_RAW_TYPE (symbolP)) + { + case N_SLINE: + dsc = S_GET_DESC (symbolP); + if (dsc > Cur_File->max_line) + Cur_File->max_line = dsc; + if (dsc < Cur_File->min_line) + Cur_File->min_line = dsc; + break; + case N_SO: + Cur_File = find_file (symbolP); + Cur_File->flag = 1; + Cur_File->min_line = 1; + break; + case N_SOL: + Cur_File = find_file (symbolP); + break; + case N_GSYM: + VMS_GSYM_Parse (symbolP, Text_Psect); + break; + case N_LCSYM: + VMS_LCSYM_Parse (symbolP, Text_Psect); + break; + case N_FUN: /* For static constant symbols */ + case N_STSYM: + VMS_STSYM_Parse (symbolP, Text_Psect); + break; + default: + break; + } + } + + /* Now we take a quick sweep through the files and assign offsets + to each one. This will essentially be the starting line number to + the debugger for each file. Output the info for the debugger to + specify the files, and then tell it how many lines to use. */ + for (Cur_File = file_root; Cur_File; Cur_File = Cur_File->next) + { + if (Cur_File->max_line == 0) + continue; + if ((strncmp (Cur_File->name, "GNU_GXX_INCLUDE:", 16) == 0) && + !flag_debug) + continue; + if ((strncmp (Cur_File->name, "GNU_CC_INCLUDE:", 15) == 0) && + !flag_debug) + continue; + /* show a few extra lines at the start of the region selected */ + if (Cur_File->min_line > 2) + Cur_File->min_line -= 2; + Cur_File->offset = Debugger_Offset - Cur_File->min_line + 1; + Debugger_Offset += Cur_File->max_line - Cur_File->min_line + 1; + if (Cur_File->same_file_fpnt) + { + Cur_File->file_number = Cur_File->same_file_fpnt->file_number; + } + else + { + Cur_File->file_number = ++File_Number; + file_available = VMS_TBT_Source_File (Cur_File->name, + Cur_File->file_number); + if (!file_available) + { + Cur_File->file_number = 0; + File_Number--; + continue; + } + } + VMS_TBT_Source_Lines (Cur_File->file_number, + Cur_File->min_line, + Cur_File->max_line - Cur_File->min_line + 1); + } /* for */ + Cur_File = (struct input_file *) NULL; + + /* Scan the symbols and write out the routines + (this makes the assumption that symbols are in + order of ascending text segment offset). */ + for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP)) + { + /* Deal with text symbols. */ + if (!S_IS_DEBUG (symbolP) && S_GET_TYPE (symbolP) == N_TEXT) + { + /* Ignore symbols starting with "L", as they are local symbols. */ + if (*S_GET_NAME (symbolP) == 'L') + continue; + /* If there is a routine start defined, terminate it. */ + if (Current_Routine) + VMS_TBT_Routine_End (text_siz, Current_Routine); + + /* Check for & skip dummy labels like "gcc_compiled.". + * They're identified by the IN_DEFAULT_SECTION flag. */ + if ((S_GET_OTHER (symbolP) & IN_DEFAULT_SECTION) != 0 && + S_GET_VALUE (symbolP) == 0) + continue; + /* Store the routine begin traceback info. */ + VMS_TBT_Routine_Begin (symbolP, Text_Psect); + Current_Routine = symbolP; + /* Define symbols local to this routine. */ + local_symbols_DST (symbolP, Current_Routine); + /* Done. */ + continue; + + } + /* Deal with STAB symbols. */ + else if (S_IS_DEBUG (symbolP)) + { + /* Dispatch on STAB type. */ + switch (S_GET_RAW_TYPE (symbolP)) + { + /* Line number. */ + case N_SLINE: + /* Offset the line into the correct portion of the file. */ + if (Cur_File->file_number == 0) + break; + val = S_GET_VALUE (symbolP); + /* Sometimes the same offset gets several source lines + assigned to it. We should be selective about which + lines we allow, we should prefer lines that are in + the main source file when debugging inline functions. */ + if (val == Cur_Offset && Cur_File->file_number != 1) + break; + + /* Calculate actual debugger source line. */ + dsc = S_GET_DESC (symbolP) + Cur_File->offset; + S_SET_DESC (symbolP, dsc); + /* Define PC/Line correlation. */ + if (Cur_Offset == -1) + { + /* First N_SLINE; set up initial correlation. */ + VMS_TBT_Line_PC_Correlation (dsc, + val, + Text_Psect, + 0); + } + else if ((dsc - Cur_Line_Number) <= 0) + { + /* Line delta is not +ve, we need to close the line and + start a new PC/Line correlation. */ + VMS_TBT_Line_PC_Correlation (0, + val - Cur_Offset, + 0, + -1); + VMS_TBT_Line_PC_Correlation (dsc, + val, + Text_Psect, + 0); + } + else + { + /* Line delta is +ve, all is well. */ + VMS_TBT_Line_PC_Correlation (dsc - Cur_Line_Number, + val - Cur_Offset, + 0, + 1); + } + /* Update the current line/PC info. */ + Cur_Line_Number = dsc; + Cur_Offset = val; + break; + + /* Source file. */ + case N_SO: + /* Remember that we had a source file and emit + the source file debugger record. */ + Cur_File = find_file (symbolP); + break; + + case N_SOL: + /* We need to make sure that we are really in the actual + source file when we compute the maximum line number. + Otherwise the debugger gets really confused. */ + Cur_File = find_file (symbolP); + break; + + default: + break; + } + } + } + + /* If there is a routine start defined, terminate it + (and the line numbers). */ + if (Current_Routine) + { + /* Terminate the line numbers. */ + VMS_TBT_Line_PC_Correlation (0, + text_siz - S_GET_VALUE (Current_Routine), + 0, + -1); + /* Terminate the routine. */ + VMS_TBT_Routine_End (text_siz, Current_Routine); + } + + /* Write the Traceback End Module TBT record. */ + VMS_TBT_Module_End (); +} + + +/* Write a VAX/VMS object file (everything else has been done!). */ + +void +vms_write_object_file (unsigned text_siz, unsigned data_siz, unsigned bss_siz, + fragS *text_frag_root, fragS *data_frag_root) +{ + struct VMS_Symbol *vsp; + + /* Initialize program section indices; values get updated later. */ + Psect_Number = 0; /* next Psect Index to use */ + Text_Psect = -1; /* Text Psect Index */ + Data_Psect = -2; /* Data Psect Index JF: Was -1 */ + Bss_Psect = -3; /* Bss Psect Index JF: Was -1 */ + Ctors_Psect = -4; /* Ctors Psect Index */ + Dtors_Psect = -5; /* Dtors Psect Index */ + /* Initialize other state variables. */ + Data_Segment = 0; + Local_Initd_Data_Size = 0; + + /* Create the actual output file and populate it with required + "module header" information. */ + Create_VMS_Object_File (); + Write_VMS_MHD_Records (); + + /* Create the Data segment: + + Since this is REALLY hard to do any other way, + we actually manufacture the data segment and + then store the appropriate values out of it. + We need to generate this early, so that globalvalues + can be properly emitted. */ + if (data_siz > 0) + synthesize_data_segment (data_siz, text_siz, data_frag_root); + + /* Global Symbol Directory. */ + + /* Emit globalvalues now. We must do this before the text psect is + defined, or we will get linker warnings about multiply defined + symbols. All of the globalvalues "reference" psect 0, although + it really does not have anything to do with it. */ + VMS_Emit_Globalvalues (text_siz, data_siz, Data_Segment); + /* Define the Text Psect. */ + Text_Psect = Psect_Number++; + VMS_Psect_Spec ("$code", text_siz, ps_TEXT, 0); + /* Define the BSS Psect. */ + if (bss_siz > 0) + { + Bss_Psect = Psect_Number++; + VMS_Psect_Spec ("$uninitialized_data", bss_siz, ps_DATA, 0); + } + /* Define symbols to the linker. */ + global_symbol_directory (text_siz, data_siz); + /* Define the Data Psect. */ + if (data_siz > 0 && Local_Initd_Data_Size > 0) + { + Data_Psect = Psect_Number++; + VMS_Psect_Spec ("$data", Local_Initd_Data_Size, ps_DATA, 0); + /* Local initialized data (N_DATA) symbols need to be updated to the + proper value of Data_Psect now that it's actually been defined. + (A dummy value was used in global_symbol_directory() above.) */ + for (vsp = VMS_Symbols; vsp; vsp = vsp->Next) + if (vsp->Psect_Index < 0 && S_GET_RAW_TYPE (vsp->Symbol) == N_DATA) + vsp->Psect_Index = Data_Psect; + } + + if (Ctors_Symbols != 0) + { + char *ps_name = "$ctors"; + Ctors_Psect = Psect_Number++; + VMS_Psect_Spec (ps_name, Ctors_Symbols->Psect_Offset + XTOR_SIZE, + ps_CTORS, 0); + VMS_Global_Symbol_Spec (ps_name, Ctors_Psect, + 0, GBLSYM_DEF|GBLSYM_WEAK); + for (vsp = Ctors_Symbols; vsp; vsp = vsp->Next) + vsp->Psect_Index = Ctors_Psect; + } + + if (Dtors_Symbols != 0) + { + char *ps_name = "$dtors"; + Dtors_Psect = Psect_Number++; + VMS_Psect_Spec (ps_name, Dtors_Symbols->Psect_Offset + XTOR_SIZE, + ps_DTORS, 0); + VMS_Global_Symbol_Spec (ps_name, Dtors_Psect, + 0, GBLSYM_DEF|GBLSYM_WEAK); + for (vsp = Dtors_Symbols; vsp; vsp = vsp->Next) + vsp->Psect_Index = Dtors_Psect; + } + + /* Text Information and Relocation Records. */ + + /* Write the text segment data. */ + if (text_siz > 0) + vms_fixup_text_section (text_siz, text_frag_root, data_frag_root); + /* Write the data segment data, then discard it. */ + if (data_siz > 0) + { + vms_fixup_data_section (data_siz, text_siz); + free (Data_Segment), Data_Segment = 0; + } + + if (Ctors_Symbols != 0) + vms_fixup_xtors_section (Ctors_Symbols, Ctors_Psect); + + if (Dtors_Symbols != 0) + vms_fixup_xtors_section (Dtors_Symbols, Dtors_Psect); + + /* Debugger Symbol Table Records. */ + + vms_build_DST (text_siz); + + /* Wrap things up. */ + + /* Write the End Of Module record. */ + if (Entry_Point_Symbol) + Write_VMS_EOM_Record (Text_Psect, S_GET_VALUE (Entry_Point_Symbol)); + else + Write_VMS_EOM_Record (-1, (valueT) 0); + + /* All done, close the object file. */ + Close_VMS_Object_File (); +} diff --git a/gas/config/obj-vms.h b/gas/config/obj-vms.h new file mode 100644 index 0000000000000..bd75896b4e6cc --- /dev/null +++ b/gas/config/obj-vms.h @@ -0,0 +1,554 @@ +/* VMS object file format + Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000, + 2002, 2003 Free Software Foundation, Inc. + +This file is part of GAS, the GNU Assembler. + +GAS is free software; 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. + +GAS is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GAS; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ + +/* Tag to validate a.out object file format processing */ +#define OBJ_VMS 1 + +#include "targ-cpu.h" + +#define LONGWORD_ALIGNMENT 2 + +/* This macro controls subsection alignment within a section. + * + * Under VAX/VMS, the linker (and PSECT specifications) + * take care of correctly aligning the segments. + * Doing the alignment here (on initialized data) can + * mess up the calculation of global data PSECT sizes. + */ +#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) \ + (((SEG) == data_section) ? 0 : LONGWORD_ALIGNMENT) + +/* This flag is used to remember whether we are in the const or the + data section. By and large they are identical, but we set a no-write + bit for psects in the const section. */ + +extern unsigned char const_flag; + +/* This is overloaded onto const_flag, for convenience. It's used to flag + dummy labels like "gcc2_compiled." which occur before the first .text + or .data section directive. */ + +#define IN_DEFAULT_SECTION 0x80 + +/* These are defined in obj-vms.c. */ +extern const short seg_N_TYPE[]; +extern const segT N_TYPE_seg[]; + +#undef NO_RELOC +enum reloc_type + { + NO_RELOC, RELOC_32 + }; + +#define N_BADMAG(x) (0) +#define N_TXTOFF(x) ( sizeof (struct exec) ) +#define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text ) +#define N_TROFF(x) ( N_DATOFF(x) + (x).a_data ) +#define N_DROFF(x) ( N_TROFF(x) + (x).a_trsize ) +#define N_SYMOFF(x) ( N_DROFF(x) + (x).a_drsize ) +#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms ) + +/* We use this copy of the exec header for VMS. We do not actually use it, but + what we actually do is let gas fill in the relevant slots, and when we get + around to writing an obj file, we just pick out what we need. */ + +struct exec +{ + unsigned long a_text; /* length of text, in bytes */ + unsigned long a_data; /* length of data, in bytes */ + unsigned long a_bss; /* length of uninitialized data area for file, in bytes */ + unsigned long a_trsize; /* length of relocation info for text, in bytes */ + unsigned long a_drsize; /* length of relocation info for data, in bytes */ + unsigned long a_entry; /* start address */ + unsigned long a_syms; /* length of symbol table data in file, in bytes */ +}; + +typedef struct + { + struct exec header; /* a.out header */ + long string_table_size; /* names + '\0' + sizeof (int) */ + } +object_headers; + +/* A single entry in the symbol table + * (this started as a clone of bout.h's nlist, but much was unneeded). + */ +struct nlist + { + char *n_name; + unsigned char n_type; /* See below */ + unsigned char n_other; /* used for const_flag and "default section" */ + unsigned : 16; /* padding for alignment */ + int n_desc; /* source line number for N_SLINE stabs */ + }; + +/* Legal values of n_type (see aout/stab.def for the majority of the codes). + */ +#define N_UNDF 0 /* Undefined symbol */ +#define N_ABS 2 /* Absolute symbol */ +#define N_TEXT 4 /* Text symbol */ +#define N_DATA 6 /* Data symbol */ +#define N_BSS 8 /* BSS symbol */ +#define N_FN 31 /* Filename symbol */ + +#define N_EXT 1 /* External symbol (OR'd in with one of above) */ +#define N_TYPE 036 /* Mask for all the type bits */ + +#define N_STAB 0340 /* Mask for all bits used for SDB entries */ + +#include "aout/stab_gnu.h" + +/* SYMBOL TABLE */ +/* Symbol table entry data type */ + +typedef struct nlist obj_symbol_type; /* Symbol table entry */ + +/* Symbol table macros and constants */ + +#define OBJ_SYMFIELD_TYPE struct VMS_Symbol * + +/* + * Macros to extract information from a symbol table entry. + * This syntactic indirection allows independence regarding a.out or coff. + * The argument (s) of all these macros is a pointer to a symbol table entry. + */ + +/* True if the symbol is external */ +#define S_IS_EXTERNAL(s) ((s)->sy_symbol.n_type & N_EXT) + +/* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */ +#define S_IS_DEFINED(s) (S_GET_TYPE(s) != N_UNDF) + +#define S_IS_COMMON(s) (S_GET_TYPE(s) == N_UNDF && S_GET_VALUE(s) != 0) + +/* Return true for symbols that should not be reduced to section + symbols or eliminated from expressions, because they may be + overridden by the linker. */ +#define S_FORCE_RELOC(s, strict) \ + (!SEG_NORMAL (S_GET_SEGMENT (s))) + +#define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER) + +/* True if a debug special symbol entry */ +#define S_IS_DEBUG(s) ((s)->sy_symbol.n_type & N_STAB) +/* True if a symbol is local symbol name */ +/* A symbol name whose name begin with ^A is a gas internal pseudo symbol + nameless symbols come from .stab directives. */ +#define S_IS_LOCAL(s) (S_GET_NAME(s) && \ + !S_IS_DEBUG(s) && \ + (strchr(S_GET_NAME(s), '\001') != 0 || \ + strchr(S_GET_NAME(s), '\002') != 0 || \ + (S_LOCAL_NAME(s) && !flag_keep_locals))) +/* True if a symbol is not defined in this file */ +#define S_IS_EXTERN(s) ((s)->sy_symbol.n_type & N_EXT) +/* True if the symbol has been generated because of a .stabd directive */ +#define S_IS_STABD(s) (S_GET_NAME(s) == (char *)0) + +/* Accessors */ +/* The name of the symbol */ +#define S_GET_NAME(s) ((s)->sy_symbol.n_name) +/* The pointer to the string table */ +#define S_GET_OFFSET(s) ((s)->sy_name_offset) +/* The raw type of the symbol */ +#define S_GET_RAW_TYPE(s) ((s)->sy_symbol.n_type) +/* The type of the symbol */ +#define S_GET_TYPE(s) ((s)->sy_symbol.n_type & N_TYPE) +/* The numeric value of the segment */ +#define S_GET_SEGMENT(s) (N_TYPE_seg[S_GET_TYPE(s)]) +/* The n_other expression value */ +#define S_GET_OTHER(s) ((s)->sy_symbol.n_other) +/* The n_desc expression value */ +#define S_GET_DESC(s) ((s)->sy_symbol.n_desc) + +/* Modifiers */ +/* Assume that a symbol cannot be simultaneously in more than on segment */ +/* set segment */ +#define S_SET_SEGMENT(s,seg) ((s)->sy_symbol.n_type &= ~N_TYPE,(s)->sy_symbol.n_type|=SEGMENT_TO_SYMBOL_TYPE(seg)) +/* The symbol is external */ +#define S_SET_EXTERNAL(s) ((s)->sy_symbol.n_type |= N_EXT) +/* The symbol is not external */ +#define S_CLEAR_EXTERNAL(s) ((s)->sy_symbol.n_type &= ~N_EXT) +/* Set the name of the symbol */ +#define S_SET_NAME(s,v) ((s)->sy_symbol.n_name = (v)) +/* Set the offset in the string table */ +#define S_SET_OFFSET(s,v) ((s)->sy_name_offset = (v)) +/* Set the n_other expression value */ +#define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v)) +/* Set the n_desc expression value */ +#define S_SET_DESC(s,v) ((s)->sy_symbol.n_desc = (v)) +/* Set the n_type expression value */ +#define S_SET_TYPE(s,v) ((s)->sy_symbol.n_type = (v)) + +/* File header macro and type definition */ + +#define H_GET_TEXT_SIZE(h) ((h)->header.a_text) +#define H_GET_DATA_SIZE(h) ((h)->header.a_data) +#define H_GET_BSS_SIZE(h) ((h)->header.a_bss) + +#define H_SET_TEXT_SIZE(h,v) ((h)->header.a_text = md_section_align(SEG_TEXT, (v))) +#define H_SET_DATA_SIZE(h,v) ((h)->header.a_data = md_section_align(SEG_DATA, (v))) +#define H_SET_BSS_SIZE(h,v) ((h)->header.a_bss = md_section_align(SEG_BSS, (v))) + +#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v)) +#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * \ + sizeof (struct nlist)) + +/* line numbering stuff. */ +#define OBJ_EMIT_LINENO(a, b, c) {;} + +#define obj_symbol_new_hook(s) {;} + +/* Force structure tags into scope so that their use in prototypes + will never be their first occurrence. */ +struct fix; +struct frag; + +/* obj-vms routines visible to the rest of gas. */ + +extern void tc_aout_fix_to_chars PARAMS ((char *,struct fix *,relax_addressT)); + +extern int vms_resolve_symbol_redef PARAMS ((symbolS *)); +#define RESOLVE_SYMBOL_REDEFINITION(X) vms_resolve_symbol_redef(X) + +/* Compiler-generated label "__vax_g_doubles" is used to augment .stabs. */ +extern void vms_check_for_special_label PARAMS ((symbolS *)); +#define obj_frob_label(X) vms_check_for_special_label(X) + +extern void vms_check_for_main PARAMS ((void)); + +extern void vms_write_object_file PARAMS ((unsigned,unsigned,unsigned, + struct frag *,struct frag *)); + +/* VMS executables are nothing like a.out, but the VMS port of gcc uses + a.out format stabs which obj-vms.c then translates. */ + +#define AOUT_STABS + + +#ifdef WANT_VMS_OBJ_DEFS + +/* The rest of this file contains definitions for constants used within + the actual VMS object file. We do not use a $ in the symbols (as per + usual VMS convention) since System V gags on it. */ + +#define OBJ_S_C_HDR 0 +#define OBJ_S_C_HDR_MHD 0 +#define OBJ_S_C_HDR_LNM 1 +#define OBJ_S_C_HDR_SRC 2 +#define OBJ_S_C_HDR_TTL 3 +#define OBJ_S_C_HDR_CPR 4 +#define OBJ_S_C_HDR_MTC 5 +#define OBJ_S_C_HDR_GTX 6 +#define OBJ_S_C_GSD 1 +#define OBJ_S_C_GSD_PSC 0 +#define OBJ_S_C_GSD_SYM 1 +#define OBJ_S_C_GSD_EPM 2 +#define OBJ_S_C_GSD_PRO 3 +#define OBJ_S_C_GSD_SYMW 4 +#define OBJ_S_C_GSD_EPMW 5 +#define OBJ_S_C_GSD_PROW 6 +#define OBJ_S_C_GSD_IDC 7 +#define OBJ_S_C_GSD_ENV 8 +#define OBJ_S_C_GSD_LSY 9 +#define OBJ_S_C_GSD_LEPM 10 +#define OBJ_S_C_GSD_LPRO 11 +#define OBJ_S_C_GSD_SPSC 12 +#define OBJ_S_C_TIR 2 +#define OBJ_S_C_EOM 3 +#define OBJ_S_C_DBG 4 +#define OBJ_S_C_TBT 5 +#define OBJ_S_C_LNK 6 +#define OBJ_S_C_EOMW 7 +#define OBJ_S_C_MAXRECTYP 7 +#define OBJ_S_K_SUBTYP 1 +#define OBJ_S_C_SUBTYP 1 +#define OBJ_S_C_MAXRECSIZ 2048 +#define OBJ_S_C_STRLVL 0 +#define OBJ_S_C_SYMSIZ 31 +#define OBJ_S_C_STOREPLIM -1 +#define OBJ_S_C_PSCALILIM 9 + +#define MHD_S_C_MHD 0 +#define MHD_S_C_LNM 1 +#define MHD_S_C_SRC 2 +#define MHD_S_C_TTL 3 +#define MHD_S_C_CPR 4 +#define MHD_S_C_MTC 5 +#define MHD_S_C_GTX 6 +#define MHD_S_C_MAXHDRTYP 6 + +#define GSD_S_K_ENTRIES 1 +#define GSD_S_C_ENTRIES 1 +#define GSD_S_C_PSC 0 +#define GSD_S_C_SYM 1 +#define GSD_S_C_EPM 2 +#define GSD_S_C_PRO 3 +#define GSD_S_C_SYMW 4 +#define GSD_S_C_EPMW 5 +#define GSD_S_C_PROW 6 +#define GSD_S_C_IDC 7 +#define GSD_S_C_ENV 8 +#define GSD_S_C_LSY 9 +#define GSD_S_C_LEPM 10 +#define GSD_S_C_LPRO 11 +#define GSD_S_C_SPSC 12 +#define GSD_S_C_SYMV 13 +#define GSD_S_C_EPMV 14 +#define GSD_S_C_PROV 15 +#define GSD_S_C_MAXRECTYP 15 + +#define GSY_S_M_WEAK 1 +#define GSY_S_M_DEF 2 +#define GSY_S_M_UNI 4 +#define GSY_S_M_REL 8 + +#define LSY_S_M_DEF 2 +#define LSY_S_M_REL 8 + +#define ENV_S_M_DEF 1 +#define ENV_S_M_NESTED 2 + +#define GPS_S_M_PIC 1 +#define GPS_S_M_LIB 2 +#define GPS_S_M_OVR 4 +#define GPS_S_M_REL 8 +#define GPS_S_M_GBL 16 +#define GPS_S_M_SHR 32 +#define GPS_S_M_EXE 64 +#define GPS_S_M_RD 128 +#define GPS_S_M_WRT 256 +#define GPS_S_M_VEC 512 +#define GPS_S_K_NAME 9 +#define GPS_S_C_NAME 9 + +#define TIR_S_C_STA_GBL 0 +#define TIR_S_C_STA_SB 1 +#define TIR_S_C_STA_SW 2 +#define TIR_S_C_STA_LW 3 +#define TIR_S_C_STA_PB 4 +#define TIR_S_C_STA_PW 5 +#define TIR_S_C_STA_PL 6 +#define TIR_S_C_STA_UB 7 +#define TIR_S_C_STA_UW 8 +#define TIR_S_C_STA_BFI 9 +#define TIR_S_C_STA_WFI 10 +#define TIR_S_C_STA_LFI 11 +#define TIR_S_C_STA_EPM 12 +#define TIR_S_C_STA_CKARG 13 +#define TIR_S_C_STA_WPB 14 +#define TIR_S_C_STA_WPW 15 +#define TIR_S_C_STA_WPL 16 +#define TIR_S_C_STA_LSY 17 +#define TIR_S_C_STA_LIT 18 +#define TIR_S_C_STA_LEPM 19 +#define TIR_S_C_MAXSTACOD 19 +#define TIR_S_C_MINSTOCOD 20 +#define TIR_S_C_STO_SB 20 +#define TIR_S_C_STO_SW 21 +#define TIR_S_C_STO_L 22 +#define TIR_S_C_STO_BD 23 +#define TIR_S_C_STO_WD 24 +#define TIR_S_C_STO_LD 25 +#define TIR_S_C_STO_LI 26 +#define TIR_S_C_STO_PIDR 27 +#define TIR_S_C_STO_PICR 28 +#define TIR_S_C_STO_RSB 29 +#define TIR_S_C_STO_RSW 30 +#define TIR_S_C_STO_RL 31 +#define TIR_S_C_STO_VPS 32 +#define TIR_S_C_STO_USB 33 +#define TIR_S_C_STO_USW 34 +#define TIR_S_C_STO_RUB 35 +#define TIR_S_C_STO_RUW 36 +#define TIR_S_C_STO_B 37 +#define TIR_S_C_STO_W 38 +#define TIR_S_C_STO_RB 39 +#define TIR_S_C_STO_RW 40 +#define TIR_S_C_STO_RIVB 41 +#define TIR_S_C_STO_PIRR 42 +#define TIR_S_C_MAXSTOCOD 42 +#define TIR_S_C_MINOPRCOD 50 +#define TIR_S_C_OPR_NOP 50 +#define TIR_S_C_OPR_ADD 51 +#define TIR_S_C_OPR_SUB 52 +#define TIR_S_C_OPR_MUL 53 +#define TIR_S_C_OPR_DIV 54 +#define TIR_S_C_OPR_AND 55 +#define TIR_S_C_OPR_IOR 56 +#define TIR_S_C_OPR_EOR 57 +#define TIR_S_C_OPR_NEG 58 +#define TIR_S_C_OPR_COM 59 +#define TIR_S_C_OPR_INSV 60 +#define TIR_S_C_OPR_ASH 61 +#define TIR_S_C_OPR_USH 62 +#define TIR_S_C_OPR_ROT 63 +#define TIR_S_C_OPR_SEL 64 +#define TIR_S_C_OPR_REDEF 65 +#define TIR_S_C_OPR_DFLIT 66 +#define TIR_S_C_MAXOPRCOD 66 +#define TIR_S_C_MINCTLCOD 80 +#define TIR_S_C_CTL_SETRB 80 +#define TIR_S_C_CTL_AUGRB 81 +#define TIR_S_C_CTL_DFLOC 82 +#define TIR_S_C_CTL_STLOC 83 +#define TIR_S_C_CTL_STKDL 84 +#define TIR_S_C_MAXCTLCOD 84 + +/* + * Debugger symbol definitions: These are done by hand, as no + * machine-readable version seems + * to be available. + */ +#define DST_S_C_C 7 /* Language == "C" */ +#define DST_S_C_CXX 15 /* Language == "C++" */ +#define DST_S_C_VERSION 153 +#define DST_S_C_SOURCE 155 /* Source file */ +#define DST_S_C_PROLOG 162 +#define DST_S_C_BLKBEG 176 /* Beginning of block */ +#define DST_S_C_BLKEND 177 /* End of block */ +#define DST_S_C_ENTRY 181 +#define DST_S_C_PSECT 184 +#define DST_S_C_LINE_NUM 185 /* Line Number */ +#define DST_S_C_LBLORLIT 186 +#define DST_S_C_LABEL 187 +#define DST_S_C_MODBEG 188 /* Beginning of module */ +#define DST_S_C_MODEND 189 /* End of module */ +#define DST_S_C_RTNBEG 190 /* Beginning of routine */ +#define DST_S_C_RTNEND 191 /* End of routine */ +#define DST_S_C_DELTA_PC_W 1 /* Incr PC */ +#define DST_S_C_INCR_LINUM 2 /* Incr Line # */ +#define DST_S_C_INCR_LINUM_W 3 /* Incr Line # */ +#define DST_S_C_SET_LINUM_INCR 4 +#define DST_S_C_SET_LINUM_INCR_W 5 +#define DST_S_C_RESET_LINUM_INCR 6 +#define DST_S_C_BEG_STMT_MODE 7 +#define DST_S_C_END_STMT_MODE 8 +#define DST_S_C_SET_LINE_NUM 9 /* Set Line # */ +#define DST_S_C_SET_PC 10 +#define DST_S_C_SET_PC_W 11 +#define DST_S_C_SET_PC_L 12 +#define DST_S_C_SET_STMTNUM 13 +#define DST_S_C_TERM 14 /* End of lines */ +#define DST_S_C_TERM_W 15 /* End of lines */ +#define DST_S_C_SET_ABS_PC 16 /* Set PC */ +#define DST_S_C_DELTA_PC_L 17 /* Incr PC */ +#define DST_S_C_INCR_LINUM_L 18 /* Incr Line # */ +#define DST_S_C_SET_LINUM_B 19 /* Set Line # */ +#define DST_S_C_SET_LINUM_L 20 /* Set Line # */ +#define DST_S_C_TERM_L 21 /* End of lines */ +/* these are used with DST_S_C_SOURCE */ +#define DST_S_C_SRC_DECLFILE 1 /* Declare source file */ +#define DST_S_C_SRC_SETFILE 2 /* Set source file */ +#define DST_S_C_SRC_SETREC_L 3 /* Set record, longword value */ +#define DST_S_C_SRC_SETREC_W 4 /* Set record, word value */ +#define DST_S_C_SRC_DEFLINES_W 10 /* # of line, word counter */ +#define DST_S_C_SRC_DEFLINES_B 11 /* # of line, byte counter */ +#define DST_S_C_SRC_FORMFEED 16 /* ^L counts as a record */ +/* the following are the codes for the various data types. Anything not on + * the list is included under 'advanced_type' + */ +#define DBG_S_C_UCHAR 0x02 +#define DBG_S_C_USINT 0x03 +#define DBG_S_C_ULINT 0x04 +#define DBG_S_C_UQUAD 0x05 +#define DBG_S_C_SCHAR 0x06 +#define DBG_S_C_SSINT 0x07 +#define DBG_S_C_SLINT 0x08 +#define DBG_S_C_SQUAD 0x09 +#define DBG_S_C_REAL4 0x0a +#define DBG_S_C_REAL8 0x0b /* D_float double */ +#define DBG_S_C_COMPLX4 0x0c /* 2xF_float complex float */ +#define DBG_S_C_COMPLX8 0x0d /* 2xD_float complex double */ +#define DBG_S_C_REAL8_G 0x1b /* G_float double */ +#define DBG_S_C_COMPLX8_G 0x1d /* 2xG_float complex double */ +#define DBG_S_C_FUNCTION_ADDR 0x17 +#define DBG_S_C_ADVANCED_TYPE 0xa3 +/* Some of these are just for future reference. [pr] + */ +#define DBG_S_C_UBITA 0x01 /* unsigned, aligned bit field */ +#define DBG_S_C_UBITU 0x22 /* unsigned, unaligned bit field */ +#define DBG_S_C_SBITA 0x29 /* signed, aligned bit field */ +#define DBG_S_C_SBITU 0x2a /* signed, unaligned bit field */ +#define DBG_S_C_CSTRING 0x2e /* asciz ('\0' terminated) string */ +#define DBG_S_C_WCHAR 0x38 /* wchar_t */ +/* These are descriptor class codes. + */ +#define DSC_K_CLASS_S 0x01 /* static (fixed length) */ +#define DSC_K_CLASS_D 0x02 /* dynamic string (not via malloc!) */ +#define DSC_K_CLASS_A 0x04 /* array */ +#define DSC_K_CLASS_UBS 0x0d /* unaligned bit string */ +/* These are the codes that are used to generate the definitions of struct + * union and enum records + */ +#define DBG_S_C_ENUM_ITEM 0xa4 +#define DBG_S_C_ENUM_START 0xa5 +#define DBG_S_C_ENUM_END 0xa6 +#define DBG_S_C_STRUCT_ITEM DST_K_VFLAGS_BITOFFS /* 0xff */ +#define DBG_S_C_STRUCT_START 0xab +#define DBG_S_C_STRUCT_END 0xac +#define DST_K_TYPSPEC 0xaf /* type specification */ +/* These codes are used in the generation of the symbol definition records + */ +#define DST_K_VFLAGS_NOVAL 0x80 /* struct definition only */ +#define DST_K_VFLAGS_DSC 0xfa /* descriptor used */ +#define DST_K_VFLAGS_TVS 0xfb /* trailing value specified */ +#define DST_K_VS_FOLLOWS 0xfd /* value spec follows */ +#define DST_K_VFLAGS_BITOFFS 0xff /* value contains bit offset */ +#define DST_K_VALKIND_LITERAL 0 +#define DST_K_VALKIND_ADDR 1 +#define DST_K_VALKIND_DESC 2 +#define DST_K_VALKIND_REG 3 +#define DST_K_REG_VAX_AP 0x0c /* R12 */ +#define DST_K_REG_VAX_FP 0x0d /* R13 */ +#define DST_K_REG_VAX_SP 0x0e /* R14 */ +#define DST_V_VALKIND 0 /* offset of valkind field */ +#define DST_V_INDIRECT 2 /* offset to indirect bit */ +#define DST_V_DISP 3 /* offset to displacement bit */ +#define DST_V_REGNUM 4 /* offset to register number */ +#define DST_M_INDIRECT (1<fr_literal + the_insn.reloc_offset), + 4, /* size */ + &the_insn.exp, + the_insn.pcrel, + the_insn.reloc); + } +} + +static char * +parse_operand (s, operandp, opt) + char *s; + expressionS *operandp; + int opt; +{ + char *save = input_line_pointer; + char *new; + + input_line_pointer = s; + expression (operandp); + if (operandp->X_op == O_absent && ! opt) + as_bad (_("missing operand")); + new = input_line_pointer; + input_line_pointer = save; + return new; +} + +/* Instruction parsing. Takes a string containing the opcode. + Operands are at input_line_pointer. Output is in the_insn. + Warnings or errors are generated. */ + +static void +machine_ip (str) + char *str; +{ + char *s; + const char *args; + struct machine_opcode *insn; + char *argsStart; + unsigned long opcode; + expressionS the_operand; + expressionS *operand = &the_operand; + unsigned int reg; + + /* Must handle `div0' opcode. */ + s = str; + if (ISALPHA (*s)) + for (; ISALNUM (*s); ++s) + *s = TOLOWER (*s); + + switch (*s) + { + case '\0': + break; + + case ' ': /* FIXME-SOMEDAY more whitespace */ + *s++ = '\0'; + break; + + default: + as_bad (_("Unknown opcode: `%s'"), str); + return; + } + if ((insn = (struct machine_opcode *) hash_find (op_hash, str)) == NULL) + { + as_bad (_("Unknown opcode `%s'."), str); + return; + } + argsStart = s; + opcode = insn->opcode; + memset (&the_insn, '\0', sizeof (the_insn)); + the_insn.reloc = NO_RELOC; + + /* Build the opcode, checking as we go to make sure that the + operands match. + + If an operand matches, we modify the_insn or opcode appropriately, + and do a "continue". If an operand fails to match, we "break". */ + + if (insn->args[0] != '\0') + { + /* Prime the pump. */ + s = parse_operand (s, operand, insn->args[0] == 'I'); + } + + for (args = insn->args;; ++args) + { + switch (*args) + { + + case '\0': /* end of args */ + if (*s == '\0') + { + /* We are truly done. */ + the_insn.opcode = opcode; + return; + } + as_bad (_("Too many operands: %s"), s); + break; + + case ',': /* Must match a comma */ + if (*s++ == ',') + { + /* Parse next operand. */ + s = parse_operand (s, operand, args[1] == 'I'); + continue; + } + break; + + case 'v': /* Trap numbers (immediate field) */ + if (operand->X_op == O_constant) + { + if (operand->X_add_number < 256) + { + opcode |= (operand->X_add_number << 16); + continue; + } + else + { + as_bad (_("Immediate value of %ld is too large"), + (long) operand->X_add_number); + continue; + } + } + the_insn.reloc = RELOC_8; + the_insn.reloc_offset = 1; /* BIG-ENDIAN Byte 1 of insn */ + the_insn.exp = *operand; + continue; + + case 'b': /* A general register or 8-bit immediate */ + case 'i': + /* We treat the two cases identically since we mashed + them together in the opcode table. */ + if (operand->X_op == O_register) + goto general_reg; + + /* Make sure the 'i' case really exists. */ + if ((insn->opcode | IMMEDIATE_BIT) != (insn + 1)->opcode) + break; + + opcode |= IMMEDIATE_BIT; + if (operand->X_op == O_constant) + { + if (operand->X_add_number < 256) + { + opcode |= operand->X_add_number; + continue; + } + else + { + as_bad (_("Immediate value of %ld is too large"), + (long) operand->X_add_number); + continue; + } + } + the_insn.reloc = RELOC_8; + the_insn.reloc_offset = 3; /* BIG-ENDIAN Byte 3 of insn */ + the_insn.exp = *operand; + continue; + + case 'a': /* next operand must be a register */ + case 'c': + general_reg: + /* lrNNN or grNNN or %%expr or a user-def register name */ + if (operand->X_op != O_register) + break; /* Only registers */ + know (operand->X_add_symbol == 0); + know (operand->X_op_symbol == 0); + reg = operand->X_add_number; + if (reg >= SREG) + break; /* No special registers */ + + /* Got the register, now figure out where it goes in the + opcode. */ + switch (*args) + { + case 'a': + opcode |= reg << 8; + continue; + + case 'b': + case 'i': + opcode |= reg; + continue; + + case 'c': + opcode |= reg << 16; + continue; + } + as_fatal (_("failed sanity check.")); + break; + + case 'x': /* 16 bit constant, zero-extended */ + case 'X': /* 16 bit constant, one-extended */ + if (operand->X_op == O_constant) + { + opcode |= (operand->X_add_number & 0xFF) << 0 | + ((operand->X_add_number & 0xFF00) << 8); + continue; + } + the_insn.reloc = RELOC_CONST; + the_insn.exp = *operand; + continue; + + case 'h': + if (operand->X_op == O_constant) + { + opcode |= (operand->X_add_number & 0x00FF0000) >> 16 | + (((unsigned long) operand->X_add_number + /* avoid sign ext */ & 0xFF000000) >> 8); + continue; + } + the_insn.reloc = RELOC_CONSTH; + the_insn.exp = *operand; + continue; + + case 'P': /* PC-relative jump address */ + case 'A': /* Absolute jump address */ + /* These two are treated together since we folded the + opcode table entries together. */ + if (operand->X_op == O_constant) + { + /* Make sure the 'A' case really exists. */ + if ((insn->opcode | ABSOLUTE_BIT) != (insn + 1)->opcode) + break; + { + bfd_vma v, mask; + mask = 0x1ffff; + v = operand->X_add_number & ~ mask; + if (v) + as_bad ("call/jmp target out of range"); + } + opcode |= ABSOLUTE_BIT | + (operand->X_add_number & 0x0003FC00) << 6 | + ((operand->X_add_number & 0x000003FC) >> 2); + continue; + } + the_insn.reloc = RELOC_JUMPTARG; + the_insn.exp = *operand; + the_insn.pcrel = 1; /* Assume PC-relative jump */ + /* FIXME-SOON, Do we figure out whether abs later, after + know sym val? */ + continue; + + case 'e': /* Coprocessor enable bit for LOAD/STORE insn */ + if (operand->X_op == O_constant) + { + if (operand->X_add_number == 0) + continue; + if (operand->X_add_number == 1) + { + opcode |= CE_BIT; + continue; + } + } + break; + + case 'n': /* Control bits for LOAD/STORE instructions */ + if (operand->X_op == O_constant && + operand->X_add_number < 128) + { + opcode |= (operand->X_add_number << 16); + continue; + } + break; + + case 's': /* Special register number */ + if (operand->X_op != O_register) + break; /* Only registers */ + if (operand->X_add_number < SREG) + break; /* Not a special register */ + opcode |= (operand->X_add_number & 0xFF) << 8; + continue; + + case 'u': /* UI bit of CONVERT */ + if (operand->X_op == O_constant) + { + if (operand->X_add_number == 0) + continue; + if (operand->X_add_number == 1) + { + opcode |= UI_BIT; + continue; + } + } + break; + + case 'r': /* RND bits of CONVERT */ + if (operand->X_op == O_constant && + operand->X_add_number < 8) + { + opcode |= operand->X_add_number << 4; + continue; + } + break; + + case 'I': /* ID bits of INV and IRETINV. */ + /* This operand is optional. */ + if (operand->X_op == O_absent) + continue; + else if (operand->X_op == O_constant + && operand->X_add_number < 4) + { + opcode |= operand->X_add_number << 16; + continue; + } + break; + + case 'd': /* FD bits of CONVERT */ + if (operand->X_op == O_constant && + operand->X_add_number < 4) + { + opcode |= operand->X_add_number << 2; + continue; + } + break; + + case 'f': /* FS bits of CONVERT */ + if (operand->X_op == O_constant && + operand->X_add_number < 4) + { + opcode |= operand->X_add_number << 0; + continue; + } + break; + + case 'C': + if (operand->X_op == O_constant && + operand->X_add_number < 4) + { + opcode |= operand->X_add_number << 16; + continue; + } + break; + + case 'F': + if (operand->X_op == O_constant && + operand->X_add_number < 16) + { + opcode |= operand->X_add_number << 18; + continue; + } + break; + + default: + BAD_CASE (*args); + } + /* Types or values of args don't match. */ + as_bad ("Invalid operands"); + return; + } +} + +/* This is identical to the md_atof in m68k.c. I think this is right, + but I'm not sure. + + Turn a string in input_line_pointer into a floating point constant + of type TYPE, and store the appropriate bytes in *LITP. The number + of LITTLENUMS emitted is stored in *SIZEP. An error message is + returned, or NULL on OK. */ + +/* Equal to MAX_PRECISION in atof-ieee.c */ +#define MAX_LITTLENUMS 6 + +char * +md_atof (type, litP, sizeP) + char type; + char *litP; + int *sizeP; +{ + int prec; + LITTLENUM_TYPE words[MAX_LITTLENUMS]; + LITTLENUM_TYPE *wordP; + char *t; + + switch (type) + { + + case 'f': + case 'F': + case 's': + case 'S': + prec = 2; + break; + + case 'd': + case 'D': + case 'r': + case 'R': + prec = 4; + break; + + case 'x': + case 'X': + prec = 6; + break; + + case 'p': + case 'P': + prec = 6; + break; + + default: + *sizeP = 0; + return "Bad call to MD_ATOF()"; + } + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + *sizeP = prec * sizeof (LITTLENUM_TYPE); + for (wordP = words; prec--;) + { + md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } + return 0; +} + +/* + * Write out big-endian. + */ +void +md_number_to_chars (buf, val, n) + char *buf; + valueT val; + int n; +{ + number_to_chars_bigendian (buf, val, n); +} + +void +md_apply_fix3 (fixP, valP, seg) + fixS *fixP; + valueT * valP; + segT seg ATTRIBUTE_UNUSED; +{ + long val = *valP; + char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; + + fixP->fx_addnumber = val; /* Remember value for emit_reloc. */ + + know (fixP->fx_size == 4); + know (fixP->fx_r_type < NO_RELOC); + + /* This is a hack. There should be a better way to handle this. */ + if (fixP->fx_r_type == RELOC_WDISP30 && fixP->fx_addsy) + val += fixP->fx_where + fixP->fx_frag->fr_address; + + switch (fixP->fx_r_type) + { + case RELOC_32: + buf[0] = val >> 24; + buf[1] = val >> 16; + buf[2] = val >> 8; + buf[3] = val; + break; + + case RELOC_8: + buf[0] = val; + break; + + case RELOC_WDISP30: + val = (val >> 2) + 1; + buf[0] |= (val >> 24) & 0x3f; + buf[1] = (val >> 16); + buf[2] = val >> 8; + buf[3] = val; + break; + + case RELOC_HI22: + buf[1] |= (val >> 26) & 0x3f; + buf[2] = val >> 18; + buf[3] = val >> 10; + break; + + case RELOC_LO10: + buf[2] |= (val >> 8) & 0x03; + buf[3] = val; + break; + + case RELOC_BASE13: + buf[2] |= (val >> 8) & 0x1f; + buf[3] = val; + break; + + case RELOC_WDISP22: + val = (val >> 2) + 1; + /* FALLTHROUGH */ + case RELOC_BASE22: + buf[1] |= (val >> 16) & 0x3f; + buf[2] = val >> 8; + buf[3] = val; + break; + + case RELOC_JUMPTARG: /* 00XX00XX pattern in a word */ + if (!fixP->fx_done) + { + /* The linker tries to support both AMD and old GNU style + R_IREL relocs. That means that if the addend is exactly + the negative of the address within the section, the + linker will not handle it correctly. */ + if (fixP->fx_pcrel + && val != 0 + && val == - (fixP->fx_frag->fr_address + fixP->fx_where)) + as_bad_where + (fixP->fx_file, fixP->fx_line, + "the linker will not handle this relocation correctly"); + } + else if (fixP->fx_pcrel) + { + long v = val >> 17; + + if (v != 0 && v != -1) + as_bad_where (fixP->fx_file, fixP->fx_line, + "call/jmp target out of range"); + } + else + /* This case was supposed to be handled in machine_ip. */ + abort (); + buf[1] = val >> 10; /* Holds bits 0003FFFC of address */ + buf[3] = val >> 2; + break; + + case RELOC_CONST: /* 00XX00XX pattern in a word */ + buf[1] = val >> 8; /* Holds bits 0000XXXX */ + buf[3] = val; + break; + + case RELOC_CONSTH: /* 00XX00XX pattern in a word */ + buf[1] = val >> 24; /* Holds bits XXXX0000 */ + buf[3] = val >> 16; + break; + + case NO_RELOC: + default: + as_bad (_("bad relocation type: 0x%02x"), fixP->fx_r_type); + break; + } + + if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0) + fixP->fx_done = 1; +} + +#ifdef OBJ_COFF +short +tc_coff_fix2rtype (fixP) + fixS *fixP; +{ + + switch (fixP->fx_r_type) + { + case RELOC_32: + return (R_WORD); + case RELOC_8: + return (R_BYTE); + case RELOC_CONST: + return (R_ILOHALF); + case RELOC_CONSTH: + return (R_IHIHALF); + case RELOC_JUMPTARG: + return (R_IREL); + default: + printf (_("need %o3\n"), fixP->fx_r_type); + abort (); + } /* switch on type */ + + return (0); +} + +#endif /* OBJ_COFF */ + +/* should never be called for 29k */ +void +md_convert_frag (headers, seg, fragP) + object_headers *headers ATTRIBUTE_UNUSED; + segT seg ATTRIBUTE_UNUSED; + register fragS *fragP ATTRIBUTE_UNUSED; +{ + as_fatal (_("a29k_convert_frag\n")); +} + +/* should never be called for a29k */ +int +md_estimate_size_before_relax (fragP, segtype) + register fragS *fragP ATTRIBUTE_UNUSED; + segT segtype ATTRIBUTE_UNUSED; +{ + as_fatal (_("a29k_estimate_size_before_relax\n")); + return 0; +} + +#if 0 +/* for debugging only */ +static void +print_insn (insn) + struct machine_it *insn; +{ + char *Reloc[] = + { + "RELOC_8", + "RELOC_16", + "RELOC_32", + "RELOC_DISP8", + "RELOC_DISP16", + "RELOC_DISP32", + "RELOC_WDISP30", + "RELOC_WDISP22", + "RELOC_HI22", + "RELOC_22", + "RELOC_13", + "RELOC_LO10", + "RELOC_SFA_BASE", + "RELOC_SFA_OFF13", + "RELOC_BASE10", + "RELOC_BASE13", + "RELOC_BASE22", + "RELOC_PC10", + "RELOC_PC22", + "RELOC_JMP_TBL", + "RELOC_SEGOFF16", + "RELOC_GLOB_DAT", + "RELOC_JMP_SLOT", + "RELOC_RELATIVE", + "NO_RELOC" + }; + + if (insn->error) + { + fprintf (stderr, "ERROR: %s\n"); + } + fprintf (stderr, "opcode=0x%08x\n", insn->opcode); + fprintf (stderr, "reloc = %s\n", Reloc[insn->reloc]); + fprintf (stderr, "exp = {\n"); + fprintf (stderr, "\t\tX_add_symbol = %s\n", + insn->exp.X_add_symbol ? + (S_GET_NAME (insn->exp.X_add_symbol) ? + S_GET_NAME (insn->exp.X_add_symbol) : "???") : "0"); + fprintf (stderr, "\t\tX_op_symbol = %s\n", + insn->exp.X_op_symbol ? + (S_GET_NAME (insn->exp.X_op_symbol) ? + S_GET_NAME (insn->exp.X_op_symbol) : "???") : "0"); + fprintf (stderr, "\t\tX_add_number = %d\n", + insn->exp.X_add_number); + fprintf (stderr, "}\n"); +} + +#endif + +/* Translate internal representation of relocation info to target format. + + On sparc/29k: first 4 bytes are normal unsigned long address, next three + bytes are index, most sig. byte first. Byte 7 is broken up with + bit 7 as external, bits 6 & 5 unused, and the lower + five bits as relocation type. Next 4 bytes are long addend. */ +/* Thanx and a tip of the hat to Michael Bloom, mb@ttidca.tti.com */ + +#ifdef OBJ_AOUT + +void +tc_aout_fix_to_chars (where, fixP, segment_address_in_file) + char *where; + fixS *fixP; + relax_addressT segment_address_in_file; +{ + long r_symbolnum; + + know (fixP->fx_r_type < NO_RELOC); + know (fixP->fx_addsy != NULL); + + md_number_to_chars (where, + fixP->fx_frag->fr_address + fixP->fx_where - segment_address_in_file, + 4); + + r_symbolnum = (S_IS_DEFINED (fixP->fx_addsy) + ? S_GET_TYPE (fixP->fx_addsy) + : fixP->fx_addsy->sy_number); + + where[4] = (r_symbolnum >> 16) & 0x0ff; + where[5] = (r_symbolnum >> 8) & 0x0ff; + where[6] = r_symbolnum & 0x0ff; + where[7] = (((!S_IS_DEFINED (fixP->fx_addsy)) << 7) & 0x80) | (0 & 0x60) | (fixP->fx_r_type & 0x1F); + /* Also easy */ + md_number_to_chars (&where[8], fixP->fx_addnumber, 4); +} + +#endif /* OBJ_AOUT */ + +const char *md_shortopts = ""; +struct option md_longopts[] = { + {NULL, no_argument, NULL, 0} +}; +size_t md_longopts_size = sizeof (md_longopts); + +int +md_parse_option (c, arg) + int c ATTRIBUTE_UNUSED; + char *arg ATTRIBUTE_UNUSED; +{ + return 0; +} + +void +md_show_usage (stream) + FILE *stream ATTRIBUTE_UNUSED; +{ +} + +/* This is called when a line is unrecognized. This is used to handle + definitions of a29k style local labels. */ + +int +a29k_unrecognized_line (c) + int c; +{ + int lab; + char *s; + + if (c != '$' + || ! ISDIGIT (input_line_pointer[0])) + return 0; + + s = input_line_pointer; + + lab = 0; + while (ISDIGIT (*s)) + { + lab = lab * 10 + *s - '0'; + ++s; + } + + if (*s != ':') + { + /* Not a label definition. */ + return 0; + } + + if (dollar_label_defined (lab)) + { + as_bad (_("label \"$%d\" redefined"), lab); + return 0; + } + + define_dollar_label (lab); + colon (dollar_label_name (lab, 0)); + input_line_pointer = s + 1; + + return 1; +} + +/* Default the values of symbols known that should be "predefined". We + don't bother to predefine them unless you actually use one, since there + are a lot of them. */ + +symbolS * +md_undefined_symbol (name) + char *name; +{ + long regnum; + char testbuf[5 + /*SLOP*/ 5]; + + if (name[0] == 'g' || name[0] == 'G' + || name[0] == 'l' || name[0] == 'L' + || name[0] == 's' || name[0] == 'S') + { + /* Perhaps a global or local register name */ + if (name[1] == 'r' || name[1] == 'R') + { + long maxreg; + + /* Parse the number, make sure it has no extra zeroes or + trailing chars. */ + regnum = atol (&name[2]); + + if (name[0] == 's' || name[0] == 'S') + maxreg = 255; + else + maxreg = 127; + if (regnum > maxreg) + return NULL; + + sprintf (testbuf, "%ld", regnum); + if (strcmp (testbuf, &name[2]) != 0) + return NULL; /* gr007 or lr7foo or whatever */ + + /* We have a wiener! Define and return a new symbol for it. */ + if (name[0] == 'l' || name[0] == 'L') + regnum += 128; + else if (name[0] == 's' || name[0] == 'S') + regnum += SREG; + return (symbol_new (name, SEG_REGISTER, (valueT) regnum, + &zero_address_frag)); + } + } + + return NULL; +} + +/* Parse an operand that is machine-specific. */ + +void +md_operand (expressionP) + expressionS *expressionP; +{ + + if (input_line_pointer[0] == '%' && input_line_pointer[1] == '%') + { + /* We have a numeric register expression. No biggy. */ + input_line_pointer += 2; /* Skip %% */ + (void) expression (expressionP); + if (expressionP->X_op != O_constant + || expressionP->X_add_number > 255) + as_bad (_("Invalid expression after %%%%\n")); + expressionP->X_op = O_register; + } + else if (input_line_pointer[0] == '&') + { + /* We are taking the 'address' of a register...this one is not + in the manual, but it *is* in traps/fpsymbol.h! What they + seem to want is the register number, as an absolute number. */ + input_line_pointer++; /* Skip & */ + (void) expression (expressionP); + if (expressionP->X_op != O_register) + as_bad (_("Invalid register in & expression")); + else + expressionP->X_op = O_constant; + } + else if (input_line_pointer[0] == '$' + && ISDIGIT (input_line_pointer[1])) + { + long lab; + char *name; + symbolS *sym; + + /* This is a local label. */ + ++input_line_pointer; + lab = (long) get_absolute_expression (); + if (dollar_label_defined (lab)) + { + name = dollar_label_name (lab, 0); + sym = symbol_find (name); + } + else + { + name = dollar_label_name (lab, 1); + sym = symbol_find_or_make (name); + } + + expressionP->X_op = O_symbol; + expressionP->X_add_symbol = sym; + expressionP->X_add_number = 0; + } + else if (input_line_pointer[0] == '$') + { + char *s; + char type; + int fieldnum, fieldlimit; + LITTLENUM_TYPE floatbuf[8]; + + /* $float(), $doubleN(), or $extendN() convert floating values + to integers. */ + + s = input_line_pointer; + + ++s; + + fieldnum = 0; + if (strncmp (s, "double", sizeof "double" - 1) == 0) + { + s += sizeof "double" - 1; + type = 'd'; + fieldlimit = 2; + } + else if (strncmp (s, "float", sizeof "float" - 1) == 0) + { + s += sizeof "float" - 1; + type = 'f'; + fieldlimit = 1; + } + else if (strncmp (s, "extend", sizeof "extend" - 1) == 0) + { + s += sizeof "extend" - 1; + type = 'x'; + fieldlimit = 4; + } + else + { + return; + } + + if (ISDIGIT (*s)) + { + fieldnum = *s - '0'; + ++s; + } + if (fieldnum >= fieldlimit) + return; + + SKIP_WHITESPACE (); + if (*s != '(') + return; + ++s; + SKIP_WHITESPACE (); + + s = atof_ieee (s, type, floatbuf); + if (s == NULL) + return; + s = s; + + SKIP_WHITESPACE (); + if (*s != ')') + return; + ++s; + SKIP_WHITESPACE (); + + input_line_pointer = s; + expressionP->X_op = O_constant; + expressionP->X_unsigned = 1; + expressionP->X_add_number = ((floatbuf[fieldnum * 2] + << LITTLENUM_NUMBER_OF_BITS) + + floatbuf[fieldnum * 2 + 1]); + } +} + +/* Round up a section size to the appropriate boundary. */ +valueT +md_section_align (segment, size) + segT segment ATTRIBUTE_UNUSED; + valueT size; +{ + return size; /* Byte alignment is fine */ +} + +/* Exactly what point is a PC-relative offset relative TO? + On the 29000, they're relative to the address of the instruction, + which we have set up as the address of the fixup too. */ +long +md_pcrel_from (fixP) + fixS *fixP; +{ + return fixP->fx_where + fixP->fx_frag->fr_address; +} diff --git a/gas/config/tc-a29k.h b/gas/config/tc-a29k.h new file mode 100644 index 0000000000000..7f3f1b2425f63 --- /dev/null +++ b/gas/config/tc-a29k.h @@ -0,0 +1,55 @@ +/* tc-a29k.h -- Assemble for the AMD 29000. + Copyright 1989, 1990, 1991, 1992, 1993, 1995, 1998 + Free Software Foundation, Inc. + +This file is part of GAS, the GNU Assembler. + +GAS is free software; 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. + +GAS is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GAS; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ + +#define TC_A29K + +#define TARGET_BYTES_BIG_ENDIAN 1 + +#define WORKING_DOT_WORD + +#define LEX_DOLLAR 1 + +#define tc_unrecognized_line(c) a29k_unrecognized_line (c) +extern int a29k_unrecognized_line PARAMS ((int)); + +#define tc_headers_hook(a) ; /* not used */ +#define tc_headers_hook(a) ; /* not used */ +#define tc_crawl_symbol_chain(a) ; /* not used */ +#define tc_coff_symbol_emit_hook(a) ; /* not used */ + +#define AOUT_MACHTYPE 101 +#define TC_COFF_FIX2RTYPE(fix_ptr) tc_coff_fix2rtype(fix_ptr) +#define BFD_ARCH bfd_arch_a29k +#define COFF_MAGIC SIPFBOMAGIC +/* Should the reloc be output ? + on the 29k, this is true only if there is a symbol attached. + on the h8, this is always true, since no fixup is done +*/ +#define TC_COUNT_RELOC(x) (x->fx_addsy) +#define TC_CONS_RELOC RELOC_32 + +#define COFF_FLAGS F_AR32W +#define reloc_type int +#define NEED_FX_R_TYPE + +#define ZERO_BASED_SEGMENTS + +/* end of tc-a29k.h */ diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c new file mode 100644 index 0000000000000..43b4b7167a7c8 --- /dev/null +++ b/gas/config/tc-avr.c @@ -0,0 +1,1300 @@ +/* tc-avr.c -- Assembler code for the ATMEL AVR + + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Contributed by Denis Chertykov + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include "as.h" +#include "safe-ctype.h" +#include "subsegs.h" + +struct avr_opcodes_s +{ + char *name; + char *constraints; + int insn_size; /* In words. */ + int isa; + unsigned int bin_opcode; +}; + +#define AVR_INSN(NAME, CONSTR, OPCODE, SIZE, ISA, BIN) \ +{#NAME, CONSTR, SIZE, ISA, BIN}, + +struct avr_opcodes_s avr_opcodes[] = +{ + #include "opcode/avr.h" + {NULL, NULL, 0, 0, 0} +}; + +const char comment_chars[] = ";"; +const char line_comment_chars[] = "#"; +const char line_separator_chars[] = "$"; + +const char *md_shortopts = "m:"; +struct mcu_type_s +{ + char *name; + int isa; + int mach; +}; + +/* XXX - devices that don't seem to exist (renamed, replaced with larger + ones, or planned but never produced), left here for compatibility. + TODO: hide them in show_mcu_list output? */ + +static struct mcu_type_s mcu_types[] = +{ + {"avr1", AVR_ISA_TINY1, bfd_mach_avr1}, + {"avr2", AVR_ISA_2xxx, bfd_mach_avr2}, + {"avr3", AVR_ISA_M103, bfd_mach_avr3}, + {"avr4", AVR_ISA_M8, bfd_mach_avr4}, + {"avr5", AVR_ISA_ALL, bfd_mach_avr5}, + {"at90s1200", AVR_ISA_1200, bfd_mach_avr1}, + {"attiny10", AVR_ISA_TINY1, bfd_mach_avr1}, /* XXX -> tn11 */ + {"attiny11", AVR_ISA_TINY1, bfd_mach_avr1}, + {"attiny12", AVR_ISA_TINY1, bfd_mach_avr1}, + {"attiny15", AVR_ISA_TINY1, bfd_mach_avr1}, + {"attiny28", AVR_ISA_TINY1, bfd_mach_avr1}, + {"at90s2313", AVR_ISA_2xxx, bfd_mach_avr2}, + {"at90s2323", AVR_ISA_2xxx, bfd_mach_avr2}, + {"at90s2333", AVR_ISA_2xxx, bfd_mach_avr2}, /* XXX -> 4433 */ + {"at90s2343", AVR_ISA_2xxx, bfd_mach_avr2}, + {"attiny22", AVR_ISA_2xxx, bfd_mach_avr2}, /* XXX -> 2343 */ + {"attiny26", AVR_ISA_2xxx, bfd_mach_avr2}, + {"at90s4433", AVR_ISA_2xxx, bfd_mach_avr2}, + {"at90s4414", AVR_ISA_2xxx, bfd_mach_avr2}, /* XXX -> 8515 */ + {"at90s4434", AVR_ISA_2xxx, bfd_mach_avr2}, /* XXX -> 8535 */ + {"at90s8515", AVR_ISA_2xxx, bfd_mach_avr2}, + {"at90s8535", AVR_ISA_2xxx, bfd_mach_avr2}, + {"at90c8534", AVR_ISA_2xxx, bfd_mach_avr2}, + {"at86rf401", AVR_ISA_2xxx, bfd_mach_avr2}, + {"atmega603", AVR_ISA_M603, bfd_mach_avr3}, /* XXX -> m103 */ + {"atmega103", AVR_ISA_M103, bfd_mach_avr3}, + {"at43usb320",AVR_ISA_M103, bfd_mach_avr3}, + {"at43usb355",AVR_ISA_M603, bfd_mach_avr3}, + {"at76c711", AVR_ISA_M603, bfd_mach_avr3}, + {"atmega8", AVR_ISA_M8, bfd_mach_avr4}, + {"atmega83", AVR_ISA_M8, bfd_mach_avr4}, /* XXX -> m8535 */ + {"atmega85", AVR_ISA_M8, bfd_mach_avr4}, /* XXX -> m8 */ + {"atmega8515",AVR_ISA_M8, bfd_mach_avr4}, + {"atmega8535",AVR_ISA_M8, bfd_mach_avr4}, + {"atmega16", AVR_ISA_M323, bfd_mach_avr5}, + {"atmega161", AVR_ISA_M161, bfd_mach_avr5}, + {"atmega162", AVR_ISA_M323, bfd_mach_avr5}, + {"atmega163", AVR_ISA_M161, bfd_mach_avr5}, + {"atmega169", AVR_ISA_M323, bfd_mach_avr5}, + {"atmega32", AVR_ISA_M323, bfd_mach_avr5}, + {"atmega323", AVR_ISA_M323, bfd_mach_avr5}, + {"atmega64", AVR_ISA_M323, bfd_mach_avr5}, + {"atmega128", AVR_ISA_M128, bfd_mach_avr5}, + {"at94k", AVR_ISA_94K, bfd_mach_avr5}, + {NULL, 0, 0} +}; + +/* Current MCU type. */ +static struct mcu_type_s default_mcu = {"avr2", AVR_ISA_2xxx,bfd_mach_avr2}; +static struct mcu_type_s *avr_mcu = &default_mcu; + +/* AVR target-specific switches. */ +struct avr_opt_s +{ + int all_opcodes; /* -mall-opcodes: accept all known AVR opcodes */ + int no_skip_bug; /* -mno-skip-bug: no warnings for skipping 2-word insns */ + int no_wrap; /* -mno-wrap: reject rjmp/rcall with 8K wrap-around */ +}; + +static struct avr_opt_s avr_opt = { 0, 0, 0 }; + +const char EXP_CHARS[] = "eE"; +const char FLT_CHARS[] = "dD"; +static void avr_set_arch (int dummy); + +/* The target specific pseudo-ops which we support. */ +const pseudo_typeS md_pseudo_table[] = +{ + {"arch", avr_set_arch, 0}, + { NULL, NULL, 0} +}; + +#define LDI_IMMEDIATE(x) (((x) & 0xf) | (((x) << 4) & 0xf00)) + +static void show_mcu_list PARAMS ((FILE *)); +static char *skip_space PARAMS ((char *)); +static char *extract_word PARAMS ((char *, char *, int)); +static unsigned int avr_operand PARAMS ((struct avr_opcodes_s *, + int, char *, char **)); +static unsigned int avr_operands PARAMS ((struct avr_opcodes_s *, char **)); +static unsigned int avr_get_constant PARAMS ((char *, int)); +static char *parse_exp PARAMS ((char *, expressionS *)); +static bfd_reloc_code_real_type avr_ldi_expression PARAMS ((expressionS *)); + +#define EXP_MOD_NAME(i) exp_mod[i].name +#define EXP_MOD_RELOC(i) exp_mod[i].reloc +#define EXP_MOD_NEG_RELOC(i) exp_mod[i].neg_reloc +#define HAVE_PM_P(i) exp_mod[i].have_pm + +struct exp_mod_s +{ + char *name; + bfd_reloc_code_real_type reloc; + bfd_reloc_code_real_type neg_reloc; + int have_pm; +}; + +static struct exp_mod_s exp_mod[] = +{ + {"hh8", BFD_RELOC_AVR_HH8_LDI, BFD_RELOC_AVR_HH8_LDI_NEG, 1}, + {"pm_hh8", BFD_RELOC_AVR_HH8_LDI_PM, BFD_RELOC_AVR_HH8_LDI_PM_NEG, 0}, + {"hi8", BFD_RELOC_AVR_HI8_LDI, BFD_RELOC_AVR_HI8_LDI_NEG, 1}, + {"pm_hi8", BFD_RELOC_AVR_HI8_LDI_PM, BFD_RELOC_AVR_HI8_LDI_PM_NEG, 0}, + {"lo8", BFD_RELOC_AVR_LO8_LDI, BFD_RELOC_AVR_LO8_LDI_NEG, 1}, + {"pm_lo8", BFD_RELOC_AVR_LO8_LDI_PM, BFD_RELOC_AVR_LO8_LDI_PM_NEG, 0}, + {"hlo8", -BFD_RELOC_AVR_LO8_LDI, -BFD_RELOC_AVR_LO8_LDI_NEG, 0}, + {"hhi8", -BFD_RELOC_AVR_HI8_LDI, -BFD_RELOC_AVR_HI8_LDI_NEG, 0}, +}; + +/* Opcode hash table. */ +static struct hash_control *avr_hash; + +/* Reloc modifiers hash control (hh8,hi8,lo8,pm_xx). */ +static struct hash_control *avr_mod_hash; + +#define OPTION_MMCU 'm' +#define OPTION_ALL_OPCODES (OPTION_MD_BASE + 1) +#define OPTION_NO_SKIP_BUG (OPTION_MD_BASE + 2) +#define OPTION_NO_WRAP (OPTION_MD_BASE + 3) + +struct option md_longopts[] = +{ + { "mmcu", required_argument, NULL, OPTION_MMCU }, + { "mall-opcodes", no_argument, NULL, OPTION_ALL_OPCODES }, + { "mno-skip-bug", no_argument, NULL, OPTION_NO_SKIP_BUG }, + { "mno-wrap", no_argument, NULL, OPTION_NO_WRAP }, + { NULL, no_argument, NULL, 0 } +}; + +size_t md_longopts_size = sizeof (md_longopts); + +/* Display nicely formatted list of known MCU names. */ + +static void +show_mcu_list (stream) + FILE *stream; +{ + int i, x; + + fprintf (stream, _("Known MCU names:")); + x = 1000; + + for (i = 0; mcu_types[i].name; i++) + { + int len = strlen (mcu_types[i].name); + + x += len + 1; + + if (x < 75) + fprintf (stream, " %s", mcu_types[i].name); + else + { + fprintf (stream, "\n %s", mcu_types[i].name); + x = len + 2; + } + } + + fprintf (stream, "\n"); +} + +static inline char * +skip_space (s) + char *s; +{ + while (*s == ' ' || *s == '\t') + ++s; + return s; +} + +/* Extract one word from FROM and copy it to TO. */ + +static char * +extract_word (char *from, char *to, int limit) +{ + char *op_start; + char *op_end; + int size = 0; + + /* Drop leading whitespace. */ + from = skip_space (from); + *to = 0; + + /* Find the op code end. */ + for (op_start = op_end = from; *op_end != 0 && is_part_of_name (*op_end);) + { + to[size++] = *op_end++; + if (size + 1 >= limit) + break; + } + + to[size] = 0; + return op_end; +} + +int +md_estimate_size_before_relax (fragp, seg) + fragS *fragp ATTRIBUTE_UNUSED; + asection *seg ATTRIBUTE_UNUSED; +{ + abort (); + return 0; +} + +void +md_show_usage (stream) + FILE *stream; +{ + fprintf (stream, + _("AVR options:\n" + " -mmcu=[avr-name] select microcontroller variant\n" + " [avr-name] can be:\n" + " avr1 - AT90S1200, ATtiny1x, ATtiny28\n" + " avr2 - AT90S2xxx, AT90S4xxx, AT90S8xxx, ATtiny22\n" + " avr3 - ATmega103, ATmega603\n" + " avr4 - ATmega83, ATmega85\n" + " avr5 - ATmega161, ATmega163, ATmega32, AT94K\n" + " or immediate microcontroller name.\n")); + fprintf (stream, + _(" -mall-opcodes accept all AVR opcodes, even if not supported by MCU\n" + " -mno-skip-bug disable warnings for skipping two-word instructions\n" + " (default for avr4, avr5)\n" + " -mno-wrap reject rjmp/rcall instructions with 8K wrap-around\n" + " (default for avr3, avr5)\n")); + show_mcu_list (stream); +} + +static void +avr_set_arch (dummy) + int dummy ATTRIBUTE_UNUSED; +{ + char *str; + + str = (char *) alloca (20); + input_line_pointer = extract_word (input_line_pointer, str, 20); + md_parse_option (OPTION_MMCU, str); + bfd_set_arch_mach (stdoutput, TARGET_ARCH, avr_mcu->mach); +} + +int +md_parse_option (c, arg) + int c; + char *arg; +{ + switch (c) + { + case OPTION_MMCU: + { + int i; + char *s = alloca (strlen (arg) + 1); + + { + char *t = s; + char *arg1 = arg; + + do + *t = TOLOWER (*arg1++); + while (*t++); + } + + for (i = 0; mcu_types[i].name; ++i) + if (strcmp (mcu_types[i].name, s) == 0) + break; + + if (!mcu_types[i].name) + { + show_mcu_list (stderr); + as_fatal (_("unknown MCU: %s\n"), arg); + } + + /* It is OK to redefine mcu type within the same avr[1-5] bfd machine + type - this for allows passing -mmcu=... via gcc ASM_SPEC as well + as .arch ... in the asm output at the same time. */ + if (avr_mcu == &default_mcu || avr_mcu->mach == mcu_types[i].mach) + avr_mcu = &mcu_types[i]; + else + as_fatal (_("redefinition of mcu type `%s' to `%s'"), + avr_mcu->name, mcu_types[i].name); + return 1; + } + case OPTION_ALL_OPCODES: + avr_opt.all_opcodes = 1; + return 1; + case OPTION_NO_SKIP_BUG: + avr_opt.no_skip_bug = 1; + return 1; + case OPTION_NO_WRAP: + avr_opt.no_wrap = 1; + return 1; + } + + return 0; +} + +symbolS * +md_undefined_symbol (name) + char *name ATTRIBUTE_UNUSED; +{ + return 0; +} + +/* Turn a string in input_line_pointer into a floating point constant + of type TYPE, and store the appropriate bytes in *LITP. The number + of LITTLENUMS emitted is stored in *SIZEP. An error message is + returned, or NULL on OK. */ + +char * +md_atof (type, litP, sizeP) + int type; + char *litP; + int *sizeP; +{ + int prec; + LITTLENUM_TYPE words[4]; + LITTLENUM_TYPE *wordP; + char *t; + + switch (type) + { + case 'f': + prec = 2; + break; + case 'd': + prec = 4; + break; + default: + *sizeP = 0; + return _("bad call to md_atof"); + } + + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + + *sizeP = prec * sizeof (LITTLENUM_TYPE); + + /* This loop outputs the LITTLENUMs in REVERSE order. */ + for (wordP = words + prec - 1; prec--;) + { + md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } + + return NULL; +} + +void +md_convert_frag (abfd, sec, fragP) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + fragS *fragP ATTRIBUTE_UNUSED; +{ + abort (); +} + +void +md_begin () +{ + unsigned int i; + struct avr_opcodes_s *opcode; + avr_hash = hash_new (); + + /* Insert unique names into hash table. This hash table then provides a + quick index to the first opcode with a particular name in the opcode + table. */ + for (opcode = avr_opcodes; opcode->name; opcode++) + hash_insert (avr_hash, opcode->name, (char *) opcode); + + avr_mod_hash = hash_new (); + + for (i = 0; i < sizeof (exp_mod) / sizeof (exp_mod[0]); ++i) + hash_insert (avr_mod_hash, EXP_MOD_NAME (i), (void *) (i + 10)); + + bfd_set_arch_mach (stdoutput, TARGET_ARCH, avr_mcu->mach); +} + +/* Resolve STR as a constant expression and return the result. + If result greater than MAX then error. */ + +static unsigned int +avr_get_constant (str, max) + char *str; + int max; +{ + expressionS ex; + str = skip_space (str); + input_line_pointer = str; + expression (&ex); + + if (ex.X_op != O_constant) + as_bad (_("constant value required")); + + if (ex.X_add_number > max || ex.X_add_number < 0) + as_bad (_("number must be less than %d"), max + 1); + + return ex.X_add_number; +} + +/* Parse instruction operands. + Return binary opcode. */ + +static unsigned int +avr_operands (opcode, line) + struct avr_opcodes_s *opcode; + char **line; +{ + char *op = opcode->constraints; + unsigned int bin = opcode->bin_opcode; + char *frag = frag_more (opcode->insn_size * 2); + char *str = *line; + int where = frag - frag_now->fr_literal; + static unsigned int prev = 0; /* Previous opcode. */ + + /* Opcode have operands. */ + if (*op) + { + unsigned int reg1 = 0; + unsigned int reg2 = 0; + int reg1_present = 0; + int reg2_present = 0; + + /* Parse first operand. */ + if (REGISTER_P (*op)) + reg1_present = 1; + reg1 = avr_operand (opcode, where, op, &str); + ++op; + + /* Parse second operand. */ + if (*op) + { + if (*op == ',') + ++op; + + if (*op == '=') + { + reg2 = reg1; + reg2_present = 1; + } + else + { + if (REGISTER_P (*op)) + reg2_present = 1; + + str = skip_space (str); + if (*str++ != ',') + as_bad (_("`,' required")); + str = skip_space (str); + + reg2 = avr_operand (opcode, where, op, &str); + + } + + if (reg1_present && reg2_present) + reg2 = (reg2 & 0xf) | ((reg2 << 5) & 0x200); + else if (reg2_present) + reg2 <<= 4; + } + if (reg1_present) + reg1 <<= 4; + bin |= reg1 | reg2; + } + + /* Detect undefined combinations (like ld r31,Z+). */ + if (!avr_opt.all_opcodes && AVR_UNDEF_P (bin)) + as_warn (_("undefined combination of operands")); + + if (opcode->insn_size == 2) + { + /* Warn if the previous opcode was cpse/sbic/sbis/sbrc/sbrs + (AVR core bug, fixed in the newer devices). */ + + if (!(avr_opt.no_skip_bug || (avr_mcu->isa & AVR_ISA_MUL)) + && AVR_SKIP_P (prev)) + as_warn (_("skipping two-word instruction")); + + bfd_putl32 ((bfd_vma) bin, frag); + } + else + bfd_putl16 ((bfd_vma) bin, frag); + + prev = bin; + *line = str; + return bin; +} + +/* Parse one instruction operand. + Return operand bitmask. Also fixups can be generated. */ + +static unsigned int +avr_operand (opcode, where, op, line) + struct avr_opcodes_s *opcode; + int where; + char *op; + char **line; +{ + expressionS op_expr; + unsigned int op_mask = 0; + char *str = skip_space (*line); + + switch (*op) + { + /* Any register operand. */ + case 'w': + case 'd': + case 'r': + case 'a': + case 'v': + if (*str == 'r' || *str == 'R') + { + char r_name[20]; + + str = extract_word (str, r_name, sizeof (r_name)); + op_mask = 0xff; + if (ISDIGIT (r_name[1])) + { + if (r_name[2] == '\0') + op_mask = r_name[1] - '0'; + else if (r_name[1] != '0' + && ISDIGIT (r_name[2]) + && r_name[3] == '\0') + op_mask = (r_name[1] - '0') * 10 + r_name[2] - '0'; + } + } + else + { + op_mask = avr_get_constant (str, 31); + str = input_line_pointer; + } + + if (op_mask <= 31) + { + switch (*op) + { + case 'a': + if (op_mask < 16 || op_mask > 23) + as_bad (_("register r16-r23 required")); + op_mask -= 16; + break; + + case 'd': + if (op_mask < 16) + as_bad (_("register number above 15 required")); + op_mask -= 16; + break; + + case 'v': + if (op_mask & 1) + as_bad (_("even register number required")); + op_mask >>= 1; + break; + + case 'w': + if ((op_mask & 1) || op_mask < 24) + as_bad (_("register r24, r26, r28 or r30 required")); + op_mask = (op_mask - 24) >> 1; + break; + } + break; + } + as_bad (_("register name or number from 0 to 31 required")); + break; + + case 'e': + { + char c; + + if (*str == '-') + { + str = skip_space (str + 1); + op_mask = 0x1002; + } + c = TOLOWER (*str); + if (c == 'x') + op_mask |= 0x100c; + else if (c == 'y') + op_mask |= 0x8; + else if (c != 'z') + as_bad (_("pointer register (X, Y or Z) required")); + + str = skip_space (str + 1); + if (*str == '+') + { + ++str; + if (op_mask & 2) + as_bad (_("cannot both predecrement and postincrement")); + op_mask |= 0x1001; + } + + /* avr1 can do "ld r,Z" and "st Z,r" but no other pointer + registers, no predecrement, no postincrement. */ + if (!avr_opt.all_opcodes && (op_mask & 0x100F) + && !(avr_mcu->isa & AVR_ISA_SRAM)) + as_bad (_("addressing mode not supported")); + } + break; + + case 'z': + if (*str == '-') + as_bad (_("can't predecrement")); + + if (! (*str == 'z' || *str == 'Z')) + as_bad (_("pointer register Z required")); + + str = skip_space (str + 1); + + if (*str == '+') + { + ++str; + op_mask |= 1; + } + break; + + case 'b': + { + char c = TOLOWER (*str++); + + if (c == 'y') + op_mask |= 0x8; + else if (c != 'z') + as_bad (_("pointer register (Y or Z) required")); + str = skip_space (str); + if (*str++ == '+') + { + unsigned int x; + x = avr_get_constant (str, 63); + str = input_line_pointer; + op_mask |= (x & 7) | ((x & (3 << 3)) << 7) | ((x & (1 << 5)) << 8); + } + } + break; + + case 'h': + str = parse_exp (str, &op_expr); + fix_new_exp (frag_now, where, opcode->insn_size * 2, + &op_expr, FALSE, BFD_RELOC_AVR_CALL); + break; + + case 'L': + str = parse_exp (str, &op_expr); + fix_new_exp (frag_now, where, opcode->insn_size * 2, + &op_expr, TRUE, BFD_RELOC_AVR_13_PCREL); + break; + + case 'l': + str = parse_exp (str, &op_expr); + fix_new_exp (frag_now, where, opcode->insn_size * 2, + &op_expr, TRUE, BFD_RELOC_AVR_7_PCREL); + break; + + case 'i': + str = parse_exp (str, &op_expr); + fix_new_exp (frag_now, where + 2, opcode->insn_size * 2, + &op_expr, FALSE, BFD_RELOC_16); + break; + + case 'M': + { + bfd_reloc_code_real_type r_type; + + input_line_pointer = str; + r_type = avr_ldi_expression (&op_expr); + str = input_line_pointer; + fix_new_exp (frag_now, where, 3, + &op_expr, FALSE, r_type); + } + break; + + case 'n': + { + unsigned int x; + + x = ~avr_get_constant (str, 255); + str = input_line_pointer; + op_mask |= (x & 0xf) | ((x << 4) & 0xf00); + } + break; + + case 'K': + { + unsigned int x; + + x = avr_get_constant (str, 63); + str = input_line_pointer; + op_mask |= (x & 0xf) | ((x & 0x30) << 2); + } + break; + + case 'S': + case 's': + { + unsigned int x; + + x = avr_get_constant (str, 7); + str = input_line_pointer; + if (*op == 'S') + x <<= 4; + op_mask |= x; + } + break; + + case 'P': + { + unsigned int x; + + x = avr_get_constant (str, 63); + str = input_line_pointer; + op_mask |= (x & 0xf) | ((x & 0x30) << 5); + } + break; + + case 'p': + { + unsigned int x; + + x = avr_get_constant (str, 31); + str = input_line_pointer; + op_mask |= x << 3; + } + break; + + case '?': + break; + + default: + as_bad (_("unknown constraint `%c'"), *op); + } + + *line = str; + return op_mask; +} + +/* GAS will call this function for each section at the end of the assembly, + to permit the CPU backend to adjust the alignment of a section. */ + +valueT +md_section_align (seg, addr) + asection *seg; + valueT addr; +{ + int align = bfd_get_section_alignment (stdoutput, seg); + return ((addr + (1 << align) - 1) & (-1 << align)); +} + +/* If you define this macro, it should return the offset between the + address of a PC relative fixup and the position from which the PC + relative adjustment should be made. On many processors, the base + of a PC relative instruction is the next instruction, so this + macro would return the length of an instruction. */ + +long +md_pcrel_from_section (fixp, sec) + fixS *fixp; + segT sec; +{ + if (fixp->fx_addsy != (symbolS *) NULL + && (!S_IS_DEFINED (fixp->fx_addsy) + || (S_GET_SEGMENT (fixp->fx_addsy) != sec))) + return 0; + + return fixp->fx_frag->fr_address + fixp->fx_where; +} + +/* GAS will call this for each fixup. It should store the correct + value in the object file. */ + +void +md_apply_fix3 (fixP, valP, seg) + fixS *fixP; + valueT * valP; + segT seg; +{ + unsigned char *where; + unsigned long insn; + long value = *valP; + + if (fixP->fx_addsy == (symbolS *) NULL) + fixP->fx_done = 1; + + else if (fixP->fx_pcrel) + { + segT s = S_GET_SEGMENT (fixP->fx_addsy); + + if (s == seg || s == absolute_section) + { + value += S_GET_VALUE (fixP->fx_addsy); + fixP->fx_done = 1; + } + } + + /* We don't actually support subtracting a symbol. */ + if (fixP->fx_subsy != (symbolS *) NULL) + as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex")); + + switch (fixP->fx_r_type) + { + default: + fixP->fx_no_overflow = 1; + break; + case BFD_RELOC_AVR_7_PCREL: + case BFD_RELOC_AVR_13_PCREL: + case BFD_RELOC_32: + case BFD_RELOC_16: + case BFD_RELOC_AVR_CALL: + break; + } + + if (fixP->fx_done) + { + /* Fetch the instruction, insert the fully resolved operand + value, and stuff the instruction back again. */ + where = fixP->fx_frag->fr_literal + fixP->fx_where; + insn = bfd_getl16 (where); + + switch (fixP->fx_r_type) + { + case BFD_RELOC_AVR_7_PCREL: + if (value & 1) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("odd address operand: %ld"), value); + + /* Instruction addresses are always right-shifted by 1. */ + value >>= 1; + --value; /* Correct PC. */ + + if (value < -64 || value > 63) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("operand out of range: %ld"), value); + value = (value << 3) & 0x3f8; + bfd_putl16 ((bfd_vma) (value | insn), where); + break; + + case BFD_RELOC_AVR_13_PCREL: + if (value & 1) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("odd address operand: %ld"), value); + + /* Instruction addresses are always right-shifted by 1. */ + value >>= 1; + --value; /* Correct PC. */ + + if (value < -2048 || value > 2047) + { + /* No wrap for devices with >8K of program memory. */ + if ((avr_mcu->isa & AVR_ISA_MEGA) || avr_opt.no_wrap) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("operand out of range: %ld"), value); + } + + value &= 0xfff; + bfd_putl16 ((bfd_vma) (value | insn), where); + break; + + case BFD_RELOC_32: + bfd_putl16 ((bfd_vma) value, where); + break; + + case BFD_RELOC_16: + bfd_putl16 ((bfd_vma) value, where); + break; + + case BFD_RELOC_AVR_16_PM: + bfd_putl16 ((bfd_vma) (value >> 1), where); + break; + + case BFD_RELOC_AVR_LO8_LDI: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value), where); + break; + + case -BFD_RELOC_AVR_LO8_LDI: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 16), where); + break; + + case BFD_RELOC_AVR_HI8_LDI: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 8), where); + break; + + case -BFD_RELOC_AVR_HI8_LDI: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 24), where); + break; + + case BFD_RELOC_AVR_HH8_LDI: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 16), where); + break; + + case BFD_RELOC_AVR_LO8_LDI_NEG: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value), where); + break; + + case -BFD_RELOC_AVR_LO8_LDI_NEG: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 16), where); + break; + + case BFD_RELOC_AVR_HI8_LDI_NEG: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 8), where); + break; + + case -BFD_RELOC_AVR_HI8_LDI_NEG: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 24), where); + break; + + case BFD_RELOC_AVR_HH8_LDI_NEG: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 16), where); + break; + + case BFD_RELOC_AVR_LO8_LDI_PM: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 1), where); + break; + + case BFD_RELOC_AVR_HI8_LDI_PM: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 9), where); + break; + + case BFD_RELOC_AVR_HH8_LDI_PM: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (value >> 17), where); + break; + + case BFD_RELOC_AVR_LO8_LDI_PM_NEG: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 1), where); + break; + + case BFD_RELOC_AVR_HI8_LDI_PM_NEG: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 9), where); + break; + + case BFD_RELOC_AVR_HH8_LDI_PM_NEG: + bfd_putl16 ((bfd_vma) insn | LDI_IMMEDIATE (-value >> 17), where); + break; + + case BFD_RELOC_AVR_CALL: + { + unsigned long x; + + x = bfd_getl16 (where); + if (value & 1) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("odd address operand: %ld"), value); + value >>= 1; + x |= ((value & 0x10000) | ((value << 3) & 0x1f00000)) >> 16; + bfd_putl16 ((bfd_vma) x, where); + bfd_putl16 ((bfd_vma) (value & 0xffff), where + 2); + } + break; + + default: + as_fatal (_("line %d: unknown relocation type: 0x%x"), + fixP->fx_line, fixP->fx_r_type); + break; + } + } + else + { + switch (fixP->fx_r_type) + { + case -BFD_RELOC_AVR_HI8_LDI_NEG: + case -BFD_RELOC_AVR_HI8_LDI: + case -BFD_RELOC_AVR_LO8_LDI_NEG: + case -BFD_RELOC_AVR_LO8_LDI: + as_bad_where (fixP->fx_file, fixP->fx_line, + _("only constant expression allowed")); + fixP->fx_done = 1; + break; + default: + break; + } + } +} + +/* A `BFD_ASSEMBLER' GAS will call this to generate a reloc. GAS + will pass the resulting reloc to `bfd_install_relocation'. This + currently works poorly, as `bfd_install_relocation' often does the + wrong thing, and instances of `tc_gen_reloc' have been written to + work around the problems, which in turns makes it difficult to fix + `bfd_install_relocation'. */ + +/* If while processing a fixup, a reloc really needs to be created + then it is done here. */ + +arelent * +tc_gen_reloc (seg, fixp) + asection *seg ATTRIBUTE_UNUSED; + fixS *fixp; +{ + arelent *reloc; + + reloc = (arelent *) xmalloc (sizeof (arelent)); + + reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); + *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); + + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); + if (reloc->howto == (reloc_howto_type *) NULL) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + _("reloc %d not supported by object file format"), + (int) fixp->fx_r_type); + return NULL; + } + + if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT + || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY) + reloc->address = fixp->fx_offset; + + reloc->addend = fixp->fx_offset; + + return reloc; +} + +void +md_assemble (str) + char *str; +{ + struct avr_opcodes_s *opcode; + char op[11]; + + str = skip_space (extract_word (str, op, sizeof (op))); + + if (!op[0]) + as_bad (_("can't find opcode ")); + + opcode = (struct avr_opcodes_s *) hash_find (avr_hash, op); + + if (opcode == NULL) + { + as_bad (_("unknown opcode `%s'"), op); + return; + } + + /* Special case for opcodes with optional operands (lpm, elpm) - + version with operands exists in avr_opcodes[] in the next entry. */ + + if (*str && *opcode->constraints == '?') + ++opcode; + + if (!avr_opt.all_opcodes && (opcode->isa & avr_mcu->isa) != opcode->isa) + as_bad (_("illegal opcode %s for mcu %s"), opcode->name, avr_mcu->name); + + /* We used to set input_line_pointer to the result of get_operands, + but that is wrong. Our caller assumes we don't change it. */ + { + char *t = input_line_pointer; + avr_operands (opcode, &str); + if (*skip_space (str)) + as_bad (_("garbage at end of line")); + input_line_pointer = t; + } +} + +/* Parse ordinary expression. */ + +static char * +parse_exp (s, op) + char *s; + expressionS *op; +{ + input_line_pointer = s; + expression (op); + if (op->X_op == O_absent) + as_bad (_("missing operand")); + return input_line_pointer; +} + +/* Parse special expressions (needed for LDI command): + xx8 (address) + xx8 (-address) + pm_xx8 (address) + pm_xx8 (-address) + where xx is: hh, hi, lo. */ + +static bfd_reloc_code_real_type +avr_ldi_expression (exp) + expressionS *exp; +{ + char *str = input_line_pointer; + char *tmp; + char op[8]; + int mod; + tmp = str; + + str = extract_word (str, op, sizeof (op)); + + if (op[0]) + { + mod = (int) hash_find (avr_mod_hash, op); + + if (mod) + { + int closes = 0; + + mod -= 10; + str = skip_space (str); + + if (*str == '(') + { + int neg_p = 0; + + ++str; + + if (strncmp ("pm(", str, 3) == 0 + || strncmp ("-(pm(", str, 5) == 0) + { + if (HAVE_PM_P (mod)) + { + ++mod; + ++closes; + } + else + as_bad (_("illegal expression")); + + if (*str == '-') + { + neg_p = 1; + ++closes; + str += 5; + } + else + str += 3; + } + + if (*str == '-' && *(str + 1) == '(') + { + neg_p ^= 1; + ++closes; + str += 2; + } + + input_line_pointer = str; + expression (exp); + + do + { + if (*input_line_pointer != ')') + { + as_bad (_("`)' required")); + break; + } + input_line_pointer++; + } + while (closes--); + + return neg_p ? EXP_MOD_NEG_RELOC (mod) : EXP_MOD_RELOC (mod); + } + } + } + + input_line_pointer = tmp; + expression (exp); + + /* Warn about expressions that fail to use lo8 (). */ + if (exp->X_op == O_constant) + { + int x = exp->X_add_number; + if (x < -255 || x > 255) + as_warn (_("constant out of 8-bit range: %d"), x); + } + else + as_warn (_("expression possibly out of 8-bit range")); + + return BFD_RELOC_AVR_LO8_LDI; +} + +/* Flag to pass `pm' mode between `avr_parse_cons_expression' and + `avr_cons_fix_new'. */ +static int exp_mod_pm = 0; + +/* Parse special CONS expression: pm (expression) + which is used for addressing to a program memory. + Relocation: BFD_RELOC_AVR_16_PM. */ + +void +avr_parse_cons_expression (exp, nbytes) + expressionS *exp; + int nbytes; +{ + char *tmp; + + exp_mod_pm = 0; + + tmp = input_line_pointer = skip_space (input_line_pointer); + + if (nbytes == 2) + { + char *pm_name = "pm"; + int len = strlen (pm_name); + + if (strncasecmp (input_line_pointer, pm_name, len) == 0) + { + input_line_pointer = skip_space (input_line_pointer + len); + + if (*input_line_pointer == '(') + { + input_line_pointer = skip_space (input_line_pointer + 1); + exp_mod_pm = 1; + expression (exp); + + if (*input_line_pointer == ')') + ++input_line_pointer; + else + { + as_bad (_("`)' required")); + exp_mod_pm = 0; + } + + return; + } + + input_line_pointer = tmp; + } + } + + expression (exp); +} + +void +avr_cons_fix_new (frag, where, nbytes, exp) + fragS *frag; + int where; + int nbytes; + expressionS *exp; +{ + if (exp_mod_pm == 0) + { + if (nbytes == 2) + fix_new_exp (frag, where, nbytes, exp, FALSE, BFD_RELOC_16); + else if (nbytes == 4) + fix_new_exp (frag, where, nbytes, exp, FALSE, BFD_RELOC_32); + else + as_bad (_("illegal %srelocation size: %d"), "", nbytes); + } + else + { + if (nbytes == 2) + fix_new_exp (frag, where, nbytes, exp, FALSE, BFD_RELOC_AVR_16_PM); + else + as_bad (_("illegal %srelocation size: %d"), "`pm' ", nbytes); + exp_mod_pm = 0; + } +} diff --git a/gas/config/tc-avr.h b/gas/config/tc-avr.h new file mode 100644 index 0000000000000..8a1a4eb9e3086 --- /dev/null +++ b/gas/config/tc-avr.h @@ -0,0 +1,126 @@ +/* This file is tc-avr.h + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + + Contributed by Denis Chertykov + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#ifndef BFD_ASSEMBLER + #error AVR support requires BFD_ASSEMBLER +#endif + +/* By convention, you should define this macro in the `.h' file. For + example, `tc-m68k.h' defines `TC_M68K'. You might have to use this + if it is necessary to add CPU specific code to the object format + file. */ +#define TC_AVR + +/* This macro is the BFD target name to use when creating the output + file. This will normally depend upon the `OBJ_FMT' macro. */ +#define TARGET_FORMAT "elf32-avr" + +/* This macro is the BFD architecture to pass to `bfd_set_arch_mach'. */ +#define TARGET_ARCH bfd_arch_avr + +/* This macro is the BFD machine number to pass to + `bfd_set_arch_mach'. If it is not defined, GAS will use 0. */ +#define TARGET_MACH 0 + +/* You should define this macro to be non-zero if the target is big + endian, and zero if the target is little endian. */ +#define TARGET_BYTES_BIG_ENDIAN 0 + +/* If you define this macro, GAS will warn about the use of + nonstandard escape sequences in a string. */ +#define ONLY_STANDARD_ESCAPES + +/* GAS will call this function for any expression that can not be + recognized. When the function is called, `input_line_pointer' + will point to the start of the expression. */ +#define md_operand(x) + +/* You may define this macro to parse an expression used in a data + allocation pseudo-op such as `.word'. You can use this to + recognize relocation directives that may appear in such directives. */ +#define TC_PARSE_CONS_EXPRESSION(EXPR,N) avr_parse_cons_expression (EXPR,N) +void avr_parse_cons_expression (expressionS *exp, int nbytes); + +/* You may define this macro to generate a fixup for a data + allocation pseudo-op. */ +#define TC_CONS_FIX_NEW(FRAG,WHERE,N,EXP) avr_cons_fix_new(FRAG,WHERE,N,EXP) +void avr_cons_fix_new(fragS *frag,int where, int nbytes, expressionS *exp); + +/* This should just call either `number_to_chars_bigendian' or + `number_to_chars_littleendian', whichever is appropriate. On + targets like the MIPS which support options to change the + endianness, which function to call is a runtime decision. On + other targets, `md_number_to_chars' can be a simple macro. */ +#define md_number_to_chars number_to_chars_littleendian + +/* `md_short_jump_size' + `md_long_jump_size' + `md_create_short_jump' + `md_create_long_jump' + If `WORKING_DOT_WORD' is defined, GAS will not do broken word + processing (*note Broken words::.). Otherwise, you should set + `md_short_jump_size' to the size of a short jump (a jump that is + just long enough to jump around a long jmp) and + `md_long_jump_size' to the size of a long jump (a jump that can go + anywhere in the function), You should define + `md_create_short_jump' to create a short jump around a long jump, + and define `md_create_long_jump' to create a long jump. */ +#define WORKING_DOT_WORD + +/* If you define this macro, it means that `tc_gen_reloc' may return + multiple relocation entries for a single fixup. In this case, the + return value of `tc_gen_reloc' is a pointer to a null terminated + array. */ +#undef RELOC_EXPANSION_POSSIBLE + +/* No shared lib support, so we don't need to ensure externally + visible symbols can be overridden. */ +#define EXTERN_FORCE_RELOC 0 + +/* Values passed to md_apply_fix3 don't include the symbol value. */ +#define MD_APPLY_SYM_VALUE(FIX) 0 + +/* If you define this macro, it should return the offset between the + address of a PC relative fixup and the position from which the PC + relative adjustment should be made. On many processors, the base + of a PC relative instruction is the next instruction, so this + macro would return the length of an instruction. */ +#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC) +extern long md_pcrel_from_section PARAMS ((struct fix *, segT)); + +/* The number of bytes to put into a word in a listing. This affects + the way the bytes are clumped together in the listing. For + example, a value of 2 might print `1234 5678' where a value of 1 + would print `12 34 56 78'. The default value is 4. */ +#define LISTING_WORD_SIZE 2 + +/* AVR port uses `$' as a logical line separator */ +#define LEX_DOLLAR 0 + +/* An `.lcomm' directive with no explicit alignment parameter will + use this macro to set P2VAR to the alignment that a request for + SIZE bytes will have. The alignment is expressed as a power of + two. If no alignment should take place, the macro definition + should do nothing. Some targets define a `.bss' directive that is + also affected by this macro. The default definition will set + P2VAR to the truncated power of two of sizes up to eight bytes. */ +#define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) (P2VAR) = 0 diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c new file mode 100644 index 0000000000000..e725b8847b862 --- /dev/null +++ b/gas/config/tc-cris.c @@ -0,0 +1,3370 @@ +/* tc-cris.c -- Assembler code for the CRIS CPU core. + Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + + Contributed by Axis Communications AB, Lund, Sweden. + Originally written for GAS 1.38.1 by Mikael Asker. + Updates, BFDizing, GNUifying and ELF support by Hans-Peter Nilsson. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +#include +#include "as.h" +#include "safe-ctype.h" +#include "subsegs.h" +#include "opcode/cris.h" +#include "dwarf2dbg.h" + +/* Conventions used here: + Generally speaking, pointers to binutils types such as "fragS" and + "expressionS" get parameter and variable names ending in "P", such as + "fragP", to harmonize with the rest of the binutils code. Other + pointers get a "p" suffix, such as "bufp". Any function or type-name + that could clash with a current or future binutils or GAS function get + a "cris_" prefix. */ + +#define SYNTAX_RELAX_REG_PREFIX "no_register_prefix" +#define SYNTAX_ENFORCE_REG_PREFIX "register_prefix" +#define SYNTAX_USER_SYM_LEADING_UNDERSCORE "leading_underscore" +#define SYNTAX_USER_SYM_NO_LEADING_UNDERSCORE "no_leading_underscore" +#define REGISTER_PREFIX_CHAR '$' + +/* True for expressions where getting X_add_symbol and X_add_number is + enough to get the "base" and "offset"; no need to make_expr_symbol. + It's not enough to check if X_op_symbol is NULL; that misses unary + operations like O_uminus. */ +#define SIMPLE_EXPR(EXP) \ + ((EXP)->X_op == O_constant || (EXP)->X_op == O_symbol) + +/* Like in ":GOT", ":GOTOFF" etc. Other ports use '@', but that's in + line_separator_chars for CRIS, so we avoid it. */ +#define PIC_SUFFIX_CHAR ':' + +/* This might be CRIS_INSN_NONE if we're assembling a prefix-insn only. + Note that some prefix-insns might be assembled as CRIS_INSN_NORMAL. */ +enum cris_insn_kind +{ + CRIS_INSN_NORMAL, CRIS_INSN_NONE, CRIS_INSN_BRANCH, CRIS_INSN_MUL +}; + +/* An instruction will have one of these prefixes. + Although the same bit-pattern, we handle BDAP with an immediate + expression (eventually quick or [pc+]) different from when we only have + register expressions. */ +enum prefix_kind +{ + PREFIX_NONE, PREFIX_BDAP_IMM, PREFIX_BDAP, PREFIX_BIAP, PREFIX_DIP, + PREFIX_PUSH +}; + +/* The prefix for an instruction. */ +struct cris_prefix +{ + enum prefix_kind kind; + int base_reg_number; + unsigned int opcode; + + /* There might be an expression to be evaluated, like I in [rN+I]. */ + expressionS expr; + + /* If there's an expression, we might need a relocation. Here's the + type of what relocation to start relaxaton with. + The relocation is assumed to start immediately after the prefix insn, + so we don't provide an offset. */ + enum bfd_reloc_code_real reloc; +}; + +/* The description of the instruction being assembled. */ +struct cris_instruction +{ + /* If CRIS_INSN_NONE, then this insn is of zero length. */ + enum cris_insn_kind insn_type; + + /* If a special register was mentioned, this is its description, else + it is NULL. */ + const struct cris_spec_reg *spec_reg; + + unsigned int opcode; + + /* An insn may have at most one expression; theoretically there could be + another in its prefix (but I don't see how that could happen). */ + expressionS expr; + + /* The expression might need a relocation. Here's one to start + relaxation with. */ + enum bfd_reloc_code_real reloc; + + /* The size in bytes of an immediate expression, or zero if + nonapplicable. */ + int imm_oprnd_size; +}; + +static void cris_process_instruction PARAMS ((char *, + struct cris_instruction *, + struct cris_prefix *)); +static int get_bwd_size_modifier PARAMS ((char **, int *)); +static int get_bw_size_modifier PARAMS ((char **, int *)); +static int get_gen_reg PARAMS ((char **, int *)); +static int get_spec_reg PARAMS ((char **, + const struct cris_spec_reg **)); +static int get_autoinc_prefix_or_indir_op PARAMS ((char **, + struct cris_prefix *, + int *, int *, int *, + expressionS *)); +static int get_3op_or_dip_prefix_op PARAMS ((char **, + struct cris_prefix *)); +static int cris_get_expression PARAMS ((char **, expressionS *)); +static int get_flags PARAMS ((char **, int *)); +static void gen_bdap PARAMS ((int, expressionS *)); +static int branch_disp PARAMS ((int)); +static void gen_cond_branch_32 PARAMS ((char *, char *, fragS *, + symbolS *, symbolS *, long int)); +static void cris_number_to_imm PARAMS ((char *, long, int, fixS *, segT)); +static void cris_create_short_jump PARAMS ((char *, addressT, addressT, + fragS *, symbolS *)); +static void s_syntax PARAMS ((int)); +static void s_cris_file PARAMS ((int)); +static void s_cris_loc PARAMS ((int)); + +/* Get ":GOT", ":GOTOFF", ":PLT" etc. suffixes. */ +static void cris_get_pic_suffix PARAMS ((char **, + bfd_reloc_code_real_type *, + expressionS *)); +static unsigned int cris_get_pic_reloc_size + PARAMS ((bfd_reloc_code_real_type)); + +/* All the .syntax functions. */ +static void cris_force_reg_prefix PARAMS ((void)); +static void cris_relax_reg_prefix PARAMS ((void)); +static void cris_sym_leading_underscore PARAMS ((void)); +static void cris_sym_no_leading_underscore PARAMS ((void)); +static char *cris_insn_first_word_frag PARAMS ((void)); + +/* Handle to the opcode hash table. */ +static struct hash_control *op_hash = NULL; + +/* If we target cris-axis-linux-gnu (as opposed to generic cris-axis-elf), + we default to no underscore and required register-prefixes. The + difference is in the default values. */ +#ifdef TE_LINUX +#define DEFAULT_CRIS_AXIS_LINUX_GNU TRUE +#else +#define DEFAULT_CRIS_AXIS_LINUX_GNU FALSE +#endif + +/* Whether we demand that registers have a `$' prefix. Default here. */ +static bfd_boolean demand_register_prefix = DEFAULT_CRIS_AXIS_LINUX_GNU; + +/* Whether global user symbols have a leading underscore. Default here. */ +static bfd_boolean symbols_have_leading_underscore + = !DEFAULT_CRIS_AXIS_LINUX_GNU; + +/* Whether or not we allow PIC, and expand to PIC-friendly constructs. */ +static bfd_boolean pic = FALSE; + +const pseudo_typeS md_pseudo_table[] = +{ + {"dword", cons, 4}, + {"syntax", s_syntax, 0}, + {"file", s_cris_file, 0}, + {"loc", s_cris_loc, 0}, + {NULL, 0, 0} +}; + +static int warn_for_branch_expansion = 0; + +/* Whether to emit error when a MULS/MULU could be located last on a + cache-line. */ +static int err_for_dangerous_mul_placement = 1; + +const char cris_comment_chars[] = ";"; + +/* This array holds the chars that only start a comment at the beginning of + a line. If the line seems to have the form '# 123 filename' + .line and .file directives will appear in the pre-processed output. */ +/* Note that input_file.c hand-checks for '#' at the beginning of the + first line of the input file. This is because the compiler outputs + #NO_APP at the beginning of its output. */ +/* Also note that slash-star will always start a comment. */ +const char line_comment_chars[] = "#"; +const char line_separator_chars[] = "@"; + +/* Now all floating point support is shut off. See md_atof. */ +const char EXP_CHARS[] = ""; +const char FLT_CHARS[] = ""; + +/* For CRIS, we encode the relax_substateTs (in e.g. fr_substate) as: + 2 1 0 + ---/ /--+-----------------+-----------------+-----------------+ + | what state ? | how long ? | + ---/ /--+-----------------+-----------------+-----------------+ + + The "how long" bits are 00 = byte, 01 = word, 10 = dword (long). + This is a Un*x convention. + Not all lengths are legit for a given value of (what state). + + Groups for CRIS address relaxing: + + 1. Bcc + length: byte, word, 10-byte expansion + + 2. BDAP + length: byte, word, dword + + 3. MULS/MULU + Not really a relaxation (no infrastructure to get delay-slots + right), just an alignment and placement checker for the v10 + multiply/cache-bug. */ + +#define STATE_CONDITIONAL_BRANCH (1) +#define STATE_BASE_PLUS_DISP_PREFIX (2) +#define STATE_MUL (3) + +#define STATE_LENGTH_MASK (3) +#define STATE_BYTE (0) +#define STATE_WORD (1) +#define STATE_DWORD (2) +/* Symbol undefined. */ +#define STATE_UNDF (3) +#define STATE_MAX_LENGTH (3) + +/* These displacements are relative to the address following the opcode + word of the instruction. The first letter is Byte, Word. The 2nd + letter is Forward, Backward. */ + +#define BRANCH_BF ( 254) +#define BRANCH_BB (-256) +#define BRANCH_WF (2 + 32767) +#define BRANCH_WB (2 + -32768) + +#define BDAP_BF ( 127) +#define BDAP_BB (-128) +#define BDAP_WF ( 32767) +#define BDAP_WB (-32768) + +#define ENCODE_RELAX(what, length) (((what) << 2) + (length)) + +const relax_typeS md_cris_relax_table[] = +{ + /* Error sentinel (0, 0). */ + {1, 1, 0, 0}, + + /* Unused (0, 1). */ + {1, 1, 0, 0}, + + /* Unused (0, 2). */ + {1, 1, 0, 0}, + + /* Unused (0, 3). */ + {1, 1, 0, 0}, + + /* Bcc o (1, 0). */ + {BRANCH_BF, BRANCH_BB, 0, ENCODE_RELAX (1, 1)}, + + /* Bcc [PC+] (1, 1). */ + {BRANCH_WF, BRANCH_WB, 2, ENCODE_RELAX (1, 2)}, + + /* BEXT/BWF, BA, JUMP (external), JUMP (always), Bnot_cc, JUMP (default) + (1, 2). */ + {0, 0, 10, 0}, + + /* Unused (1, 3). */ + {1, 1, 0, 0}, + + /* BDAP o (2, 0). */ + {BDAP_BF, BDAP_BB, 0, ENCODE_RELAX (2, 1)}, + + /* BDAP.[bw] [PC+] (2, 1). */ + {BDAP_WF, BDAP_WB, 2, ENCODE_RELAX (2, 2)}, + + /* BDAP.d [PC+] (2, 2). */ + {0, 0, 4, 0}, + + /* Unused (2, 3). */ + {0, 0, 0, 0}, + + /* MULS/MULU (3, 0). Positions (3, 1..3) are unused. */ + {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} +}; + +#undef BRANCH_BF +#undef BRANCH_BB +#undef BRANCH_WF +#undef BRANCH_WB +#undef BDAP_BF +#undef BDAP_BB +#undef BDAP_WF +#undef BDAP_WB + +/* Target-specific multicharacter options, not const-declared at usage + in 2.9.1 and CVS of 2000-02-16. */ +struct option md_longopts[] = +{ +#define OPTION_NO_US (OPTION_MD_BASE + 0) + {"no-underscore", no_argument, NULL, OPTION_NO_US}, +#define OPTION_US (OPTION_MD_BASE + 1) + {"underscore", no_argument, NULL, OPTION_US}, +#define OPTION_PIC (OPTION_MD_BASE + 2) + {"pic", no_argument, NULL, OPTION_PIC}, +#define OPTION_MULBUG_ABORT_ON (OPTION_MD_BASE + 3) + {"mul-bug-abort", no_argument, NULL, OPTION_MULBUG_ABORT_ON}, +#define OPTION_MULBUG_ABORT_OFF (OPTION_MD_BASE + 4) + {"no-mul-bug-abort", no_argument, NULL, OPTION_MULBUG_ABORT_OFF}, + {NULL, no_argument, NULL, 0} +}; + +/* Not const-declared at usage in 2.9.1. */ +size_t md_longopts_size = sizeof (md_longopts); +const char *md_shortopts = "hHN"; + +/* At first glance, this may seems wrong and should be 4 (ba + nop); but + since a short_jump must skip a *number* of long jumps, it must also be + a long jump. Here, we hope to make it a "ba [16bit_offs]" and a "nop" + for the delay slot and hope that the jump table at most needs + 32767/4=8191 long-jumps. A branch is better than a jump, since it is + relative; we will not have a reloc to fix up somewhere. + + Note that we can't add relocs, because relaxation uses these fixed + numbers, and md_create_short_jump is called after relaxation. */ + +const int md_short_jump_size = 6; +const int md_long_jump_size = 6; + +/* Report output format. Small changes in output format (like elf + variants below) can happen until all options are parsed, but after + that, the output format must remain fixed. */ + +const char * +cris_target_format () +{ + switch (OUTPUT_FLAVOR) + { + case bfd_target_aout_flavour: + return "a.out-cris"; + + case bfd_target_elf_flavour: + if (symbols_have_leading_underscore) + return "elf32-us-cris"; + return "elf32-cris"; + + default: + abort (); + return NULL; + } +} + +/* We need a port-specific relaxation function to cope with sym2 - sym1 + relative expressions with both symbols in the same segment (but not + necessarily in the same frag as this insn), for example: + move.d [pc+sym2-(sym1-2)],r10 + sym1: + The offset can be 8, 16 or 32 bits long. */ + +long +cris_relax_frag (seg, fragP, stretch) + segT seg ATTRIBUTE_UNUSED; + fragS *fragP; + long stretch ATTRIBUTE_UNUSED; +{ + long growth; + offsetT aim = 0; + symbolS *symbolP; + const relax_typeS *this_type; + const relax_typeS *start_type; + relax_substateT next_state; + relax_substateT this_state; + const relax_typeS *table = TC_GENERIC_RELAX_TABLE; + + /* We only have to cope with frags as prepared by + md_estimate_size_before_relax. The dword cases may get here + because of the different reasons that they aren't relaxable. */ + switch (fragP->fr_subtype) + { + case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_DWORD): + case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_DWORD): + /* When we get to these states, the frag won't grow any more. */ + return 0; + + case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_WORD): + case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_BYTE): + if (fragP->fr_symbol == NULL + || S_GET_SEGMENT (fragP->fr_symbol) != absolute_section) + as_fatal (_("internal inconsistency problem in %s: fr_symbol %lx"), + __FUNCTION__, (long) fragP->fr_symbol); + symbolP = fragP->fr_symbol; + if (symbol_resolved_p (symbolP)) + as_fatal (_("internal inconsistency problem in %s: resolved symbol"), + __FUNCTION__); + aim = S_GET_VALUE (symbolP); + break; + + case ENCODE_RELAX (STATE_MUL, STATE_BYTE): + /* Nothing to do here. */ + return 0; + + default: + as_fatal (_("internal inconsistency problem in %s: fr_subtype %d"), + __FUNCTION__, fragP->fr_subtype); + } + + /* The rest is stolen from relax_frag. There's no obvious way to + share the code, but fortunately no requirement to keep in sync as + long as fragP->fr_symbol does not have its segment changed. */ + + this_state = fragP->fr_subtype; + start_type = this_type = table + this_state; + + if (aim < 0) + { + /* Look backwards. */ + for (next_state = this_type->rlx_more; next_state;) + if (aim >= this_type->rlx_backward) + next_state = 0; + else + { + /* Grow to next state. */ + this_state = next_state; + this_type = table + this_state; + next_state = this_type->rlx_more; + } + } + else + { + /* Look forwards. */ + for (next_state = this_type->rlx_more; next_state;) + if (aim <= this_type->rlx_forward) + next_state = 0; + else + { + /* Grow to next state. */ + this_state = next_state; + this_type = table + this_state; + next_state = this_type->rlx_more; + } + } + + growth = this_type->rlx_length - start_type->rlx_length; + if (growth != 0) + fragP->fr_subtype = this_state; + return growth; +} + +/* Prepare machine-dependent frags for relaxation. + + Called just before relaxation starts. Any symbol that is now undefined + will not become defined. + + Return the correct fr_subtype in the frag. + + Return the initial "guess for fr_var" to caller. The guess for fr_var + is *actually* the growth beyond fr_fix. Whatever we do to grow fr_fix + or fr_var contributes to our returned value. + + Although it may not be explicit in the frag, pretend + fr_var starts with a value. */ + +int +md_estimate_size_before_relax (fragP, segment_type) + fragS *fragP; + /* The segment is either N_DATA or N_TEXT. */ + segT segment_type; +{ + int old_fr_fix; + + old_fr_fix = fragP->fr_fix; + + switch (fragP->fr_subtype) + { + case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_UNDF): + if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type) + /* The symbol lies in the same segment - a relaxable case. */ + fragP->fr_subtype + = ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_BYTE); + else + /* Unknown or not the same segment, so not relaxable. */ + fragP->fr_subtype + = ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_DWORD); + fragP->fr_var = md_cris_relax_table[fragP->fr_subtype].rlx_length; + break; + + case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_UNDF): + /* Note that we can not do anything sane with relaxing + [rX + a_known_symbol_in_text], it will have to be a 32-bit + value. + + We could play tricks with managing a constant pool and make + a_known_symbol_in_text a "bdap [pc + offset]" pointing there + (like the GOT for ELF shared libraries), but that's no use, it + would in general be no shorter or faster code, only more + complicated. */ + + if (S_GET_SEGMENT (fragP->fr_symbol) != absolute_section) + { + /* Go for dword if not absolute or same segment. */ + fragP->fr_subtype + = ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_DWORD); + fragP->fr_var = md_cris_relax_table[fragP->fr_subtype].rlx_length; + } + else if (!symbol_resolved_p (fragP->fr_symbol)) + { + /* The symbol will eventually be completely resolved as an + absolute expression, but right now it depends on the result + of relaxation and we don't know anything else about the + value. We start relaxation with the assumption that it'll + fit in a byte. */ + fragP->fr_subtype + = ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_BYTE); + fragP->fr_var = md_cris_relax_table[fragP->fr_subtype].rlx_length; + } + else + { + /* Absolute expression. */ + long int value; + value = S_GET_VALUE (fragP->fr_symbol) + fragP->fr_offset; + + if (value >= -128 && value <= 127) + { + /* Byte displacement. */ + (fragP->fr_opcode)[0] = value; + } + else + { + /* Word or dword displacement. */ + int pow2_of_size = 1; + char *writep; + + if (value < -32768 || value > 32767) + { + /* Outside word range, make it a dword. */ + pow2_of_size = 2; + } + + /* Modify the byte-offset BDAP into a word or dword offset + BDAP. Or really, a BDAP rX,8bit into a + BDAP.[wd] rX,[PC+] followed by a word or dword. */ + (fragP->fr_opcode)[0] = BDAP_PC_LOW + pow2_of_size * 16; + + /* Keep the register number in the highest four bits. */ + (fragP->fr_opcode)[1] &= 0xF0; + (fragP->fr_opcode)[1] |= BDAP_INCR_HIGH; + + /* It grew by two or four bytes. */ + fragP->fr_fix += 1 << pow2_of_size; + writep = fragP->fr_literal + old_fr_fix; + md_number_to_chars (writep, value, 1 << pow2_of_size); + } + frag_wane (fragP); + } + break; + + case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_BYTE): + case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_WORD): + case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_DWORD): + case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_BYTE): + case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_WORD): + case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_DWORD): + /* When relaxing a section for the second time, we don't need to + do anything except making sure that fr_var is set right. */ + fragP->fr_var = md_cris_relax_table[fragP->fr_subtype].rlx_length; + break; + + case ENCODE_RELAX (STATE_MUL, STATE_BYTE): + /* Nothing to do here. */ + break; + + default: + BAD_CASE (fragP->fr_subtype); + } + + return fragP->fr_var + (fragP->fr_fix - old_fr_fix); +} + +/* Perform post-processing of machine-dependent frags after relaxation. + Called after relaxation is finished. + In: Address of frag. + fr_type == rs_machine_dependent. + fr_subtype is what the address relaxed to. + + Out: Any fixS:s and constants are set up. + + The caller will turn the frag into a ".space 0". */ + +void +md_convert_frag (abfd, sec, fragP) + bfd *abfd ATTRIBUTE_UNUSED; + segT sec ATTRIBUTE_UNUSED; + fragS *fragP; +{ + /* Pointer to first byte in variable-sized part of the frag. */ + char *var_partp; + + /* Pointer to first opcode byte in frag. */ + char *opcodep; + + /* Used to check integrity of the relaxation. + One of 2 = long, 1 = word, or 0 = byte. */ + int length_code; + + /* Size in bytes of variable-sized part of frag. */ + int var_part_size = 0; + + /* This is part of *fragP. It contains all information about addresses + and offsets to varying parts. */ + symbolS *symbolP; + unsigned long var_part_offset; + + /* Where, in file space, is _var of *fragP? */ + unsigned long address_of_var_part = 0; + + /* Where, in file space, does addr point? */ + unsigned long target_address; + + know (fragP->fr_type == rs_machine_dependent); + + length_code = fragP->fr_subtype & STATE_LENGTH_MASK; + know (length_code >= 0 && length_code < STATE_MAX_LENGTH); + + var_part_offset = fragP->fr_fix; + var_partp = fragP->fr_literal + var_part_offset; + opcodep = fragP->fr_opcode; + + symbolP = fragP->fr_symbol; + target_address = (symbolP ? S_GET_VALUE (symbolP) : 0) + fragP->fr_offset; + address_of_var_part = fragP->fr_address + var_part_offset; + + switch (fragP->fr_subtype) + { + case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_BYTE): + opcodep[0] = branch_disp ((target_address - address_of_var_part)); + var_part_size = 0; + break; + + case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_WORD): + /* We had a quick immediate branch, now turn it into a word one i.e. a + PC autoincrement. */ + opcodep[0] = BRANCH_PC_LOW; + opcodep[1] &= 0xF0; + opcodep[1] |= BRANCH_INCR_HIGH; + md_number_to_chars (var_partp, + (long) (target_address - (address_of_var_part + 2)), + 2); + var_part_size = 2; + break; + + case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_DWORD): + gen_cond_branch_32 (fragP->fr_opcode, var_partp, fragP, + fragP->fr_symbol, (symbolS *) NULL, + fragP->fr_offset); + /* Ten bytes added: a branch, nop and a jump. */ + var_part_size = 2 + 2 + 4 + 2; + break; + + case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_BYTE): + if (symbolP == NULL) + as_fatal (_("internal inconsistency in %s: bdapq no symbol"), + __FUNCTION__); + opcodep[0] = S_GET_VALUE (symbolP); + var_part_size = 0; + break; + + case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_WORD): + /* We had a BDAP 8-bit "quick immediate", now turn it into a 16-bit + one that uses PC autoincrement. */ + opcodep[0] = BDAP_PC_LOW + (1 << 4); + opcodep[1] &= 0xF0; + opcodep[1] |= BDAP_INCR_HIGH; + if (symbolP == NULL) + as_fatal (_("internal inconsistency in %s: bdap.w with no symbol"), + __FUNCTION__); + md_number_to_chars (var_partp, S_GET_VALUE (symbolP), 2); + var_part_size = 2; + break; + + case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_DWORD): + /* We had a BDAP 16-bit "word", change the offset to a dword. */ + opcodep[0] = BDAP_PC_LOW + (2 << 4); + opcodep[1] &= 0xF0; + opcodep[1] |= BDAP_INCR_HIGH; + if (fragP->fr_symbol == NULL) + md_number_to_chars (var_partp, fragP->fr_offset, 4); + else + fix_new (fragP, var_partp - fragP->fr_literal, 4, fragP->fr_symbol, + fragP->fr_offset, 0, BFD_RELOC_32); + var_part_size = 4; + break; + + case ENCODE_RELAX (STATE_MUL, STATE_BYTE): + /* This is the only time we check position and aligmnent of the + placement-tracking frag. */ + if (sec->alignment_power < 2) + as_bad_where (fragP->fr_file, fragP->fr_line, + _("section alignment must be >= 4 bytes to check MULS/MULU safeness")); + else + { + /* If the address after the MULS/MULU has alignment which is + that of the section and may be that of a cache-size of the + buggy versions, then the MULS/MULU can be placed badly. */ + if ((address_of_var_part + & ((1 << sec->alignment_power) - 1) & 31) == 0) + as_bad_where (fragP->fr_file, fragP->fr_line, + _("dangerous MULS/MULU location; give it higher alignment")); + } + break; + + default: + BAD_CASE (fragP->fr_subtype); + break; + } + + fragP->fr_fix += var_part_size; +} + +/* Generate a short jump around a secondary jump table. + Used by md_create_long_jump. + + This used to be md_create_short_jump, but is now called from + md_create_long_jump instead, when sufficient. + since the sizes of the jumps are the same. It used to be brittle, + making possibilities for creating bad code. */ + +static void +cris_create_short_jump (storep, from_addr, to_addr, fragP, to_symbol) + char *storep; + addressT from_addr; + addressT to_addr; + fragS *fragP ATTRIBUTE_UNUSED; + symbolS *to_symbol ATTRIBUTE_UNUSED; +{ + long int distance; + + distance = to_addr - from_addr; + + if (-254 <= distance && distance <= 256) + { + /* Create a "short" short jump: "BA distance - 2". */ + storep[0] = branch_disp (distance - 2); + storep[1] = BA_QUICK_HIGH; + + /* A nop for the delay slot. */ + md_number_to_chars (storep + 2, NOP_OPCODE, 2); + + /* The extra word should be filled with something sane too. Make it + a nop to keep disassembly sane. */ + md_number_to_chars (storep + 4, NOP_OPCODE, 2); + } + else + { + /* Make it a "long" short jump: "BA (PC+)". */ + md_number_to_chars (storep, BA_PC_INCR_OPCODE, 2); + + /* ".WORD distance - 4". */ + md_number_to_chars (storep + 2, (long) (distance - 4), 2); + + /* A nop for the delay slot. */ + md_number_to_chars (storep + 4, NOP_OPCODE, 2); + } +} + +/* Generate a long jump in a secondary jump table. + + storep Where to store the jump instruction. + from_addr Address of the jump instruction. + to_addr Destination address of the jump. + fragP Which frag the destination address operand + lies in. + to_symbol Destination symbol. */ + +void +md_create_long_jump (storep, from_addr, to_addr, fragP, to_symbol) + char *storep; + addressT from_addr; + addressT to_addr; + fragS *fragP; + symbolS *to_symbol; +{ + long int distance; + + distance = to_addr - from_addr; + + if (-32763 <= distance && distance <= 32772) + { + /* Then make it a "short" long jump. */ + cris_create_short_jump (storep, from_addr, to_addr, fragP, + to_symbol); + } + else + { + /* We have a "long" long jump: "JUMP [PC+]". + Make it an "ADD [PC+],PC" if we're supposed to emit PIC code. */ + md_number_to_chars (storep, + pic ? ADD_PC_INCR_OPCODE : JUMP_PC_INCR_OPCODE, 2); + + /* Follow with a ".DWORD to_addr", PC-relative for PIC. */ + fix_new (fragP, storep + 2 - fragP->fr_literal, 4, to_symbol, + 0, pic ? 1 : 0, pic ? BFD_RELOC_32_PCREL : BFD_RELOC_32); + } +} + +/* Allocate space for the first piece of an insn, and mark it as the + start of the insn for debug-format use. */ + +static char * +cris_insn_first_word_frag () +{ + char *insnp = frag_more (2); + + /* We need to mark the start of the insn by passing dwarf2_emit_insn + the offset from the current fragment position. This must be done + after the first fragment is created but before any other fragments + (fixed or varying) are created. Note that the offset only + corresponds to the "size" of the insn for a fixed-size, + non-expanded insn. */ + if (OUTPUT_FLAVOR == bfd_target_elf_flavour) + dwarf2_emit_insn (2); + + return insnp; +} + +/* Port-specific assembler initialization. */ + +void +md_begin () +{ + const char *hashret = NULL; + int i = 0; + + /* Set up a hash table for the instructions. */ + op_hash = hash_new (); + if (op_hash == NULL) + as_fatal (_("Virtual memory exhausted")); + + while (cris_opcodes[i].name != NULL) + { + const char *name = cris_opcodes[i].name; + hashret = hash_insert (op_hash, name, (PTR) &cris_opcodes[i]); + + if (hashret != NULL && *hashret != '\0') + as_fatal (_("Can't hash `%s': %s\n"), cris_opcodes[i].name, + *hashret == 0 ? _("(unknown reason)") : hashret); + do + { + if (cris_opcodes[i].match & cris_opcodes[i].lose) + as_fatal (_("Buggy opcode: `%s' \"%s\"\n"), cris_opcodes[i].name, + cris_opcodes[i].args); + + ++i; + } + while (cris_opcodes[i].name != NULL + && strcmp (cris_opcodes[i].name, name) == 0); + } +} + +/* Assemble a source line. */ + +void +md_assemble (str) + char *str; +{ + struct cris_instruction output_instruction; + struct cris_prefix prefix; + char *opcodep; + char *p; + + know (str); + + /* Do the low-level grunt - assemble to bits and split up into a prefix + and ordinary insn. */ + cris_process_instruction (str, &output_instruction, &prefix); + + /* Handle any prefixes to the instruction. */ + switch (prefix.kind) + { + case PREFIX_NONE: + break; + + /* When the expression is unknown for a BDAP, it can need 0, 2 or 4 + extra bytes, so we handle it separately. */ + case PREFIX_BDAP_IMM: + /* We only do it if the relocation is unspecified, i.e. not a PIC + relocation. */ + if (prefix.reloc == BFD_RELOC_NONE) + { + gen_bdap (prefix.base_reg_number, &prefix.expr); + break; + } + /* Fall through. */ + case PREFIX_BDAP: + case PREFIX_BIAP: + case PREFIX_DIP: + opcodep = cris_insn_first_word_frag (); + + /* Output the prefix opcode. */ + md_number_to_chars (opcodep, (long) prefix.opcode, 2); + + /* Having a specified reloc only happens for DIP and for BDAP with + PIC operands, but it is ok to drop through here for the other + prefixes as they can have no relocs specified. */ + if (prefix.reloc != BFD_RELOC_NONE) + { + unsigned int relocsize + = (prefix.kind == PREFIX_DIP + ? 4 : cris_get_pic_reloc_size (prefix.reloc)); + + p = frag_more (relocsize); + fix_new_exp (frag_now, (p - frag_now->fr_literal), relocsize, + &prefix.expr, 0, prefix.reloc); + } + break; + + case PREFIX_PUSH: + opcodep = cris_insn_first_word_frag (); + + /* Output the prefix opcode. Being a "push", we add the negative + size of the register to "sp". */ + if (output_instruction.spec_reg != NULL) + { + /* Special register. */ + opcodep[0] = -output_instruction.spec_reg->reg_size; + } + else + { + /* General register. */ + opcodep[0] = -4; + } + opcodep[1] = (REG_SP << 4) + (BDAP_QUICK_OPCODE >> 8); + break; + + default: + BAD_CASE (prefix.kind); + } + + /* If we only had a prefix insn, we're done. */ + if (output_instruction.insn_type == CRIS_INSN_NONE) + return; + + /* Done with the prefix. Continue with the main instruction. */ + if (prefix.kind == PREFIX_NONE) + opcodep = cris_insn_first_word_frag (); + else + opcodep = frag_more (2); + + /* Output the instruction opcode. */ + md_number_to_chars (opcodep, (long) (output_instruction.opcode), 2); + + /* Output the symbol-dependent instruction stuff. */ + if (output_instruction.insn_type == CRIS_INSN_BRANCH) + { + segT to_seg = absolute_section; + int is_undefined = 0; + int length_code; + + if (output_instruction.expr.X_op != O_constant) + { + to_seg = S_GET_SEGMENT (output_instruction.expr.X_add_symbol); + + if (to_seg == undefined_section) + is_undefined = 1; + } + + if (to_seg == now_seg || is_undefined) + { + /* Handle complex expressions. */ + valueT addvalue + = (SIMPLE_EXPR (&output_instruction.expr) + ? output_instruction.expr.X_add_number + : 0); + symbolS *sym + = (SIMPLE_EXPR (&output_instruction.expr) + ? output_instruction.expr.X_add_symbol + : make_expr_symbol (&output_instruction.expr)); + + /* If is_undefined, then the expression may BECOME now_seg. */ + length_code = is_undefined ? STATE_UNDF : STATE_BYTE; + + /* Make room for max ten bytes of variable length. */ + frag_var (rs_machine_dependent, 10, 0, + ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, length_code), + sym, addvalue, opcodep); + } + else + { + /* We have: to_seg != now_seg && to_seg != undefined_section. + This means it is a branch to a known symbol in another + section, perhaps an absolute address. Emit a 32-bit branch. */ + char *cond_jump = frag_more (10); + + gen_cond_branch_32 (opcodep, cond_jump, frag_now, + output_instruction.expr.X_add_symbol, + (symbolS *) NULL, + output_instruction.expr.X_add_number); + } + } + else if (output_instruction.insn_type == CRIS_INSN_MUL + && err_for_dangerous_mul_placement) + /* Create a frag which which we track the location of the mul insn + (in the last two bytes before the mul-frag). */ + frag_variant (rs_machine_dependent, 0, 0, + ENCODE_RELAX (STATE_MUL, STATE_BYTE), + NULL, 0, opcodep); + else + { + if (output_instruction.imm_oprnd_size > 0) + { + /* The instruction has an immediate operand. */ + enum bfd_reloc_code_real reloc = BFD_RELOC_NONE; + + switch (output_instruction.imm_oprnd_size) + { + /* Any byte-size immediate constants are treated as + word-size. FIXME: Thus overflow check does not work + correctly. */ + + case 2: + /* Note that size-check for the explicit reloc has already + been done when we get here. */ + if (output_instruction.reloc != BFD_RELOC_NONE) + reloc = output_instruction.reloc; + else + reloc = BFD_RELOC_16; + break; + + case 4: + /* Allow a relocation specified in the operand. */ + if (output_instruction.reloc != BFD_RELOC_NONE) + reloc = output_instruction.reloc; + else + reloc = BFD_RELOC_32; + break; + + default: + BAD_CASE (output_instruction.imm_oprnd_size); + } + + p = frag_more (output_instruction.imm_oprnd_size); + fix_new_exp (frag_now, (p - frag_now->fr_literal), + output_instruction.imm_oprnd_size, + &output_instruction.expr, 0, reloc); + } + else if (output_instruction.reloc != BFD_RELOC_NONE) + { + /* An immediate operand that has a relocation and needs to be + processed further. */ + + /* It is important to use fix_new_exp here and everywhere else + (and not fix_new), as fix_new_exp can handle "difference + expressions" - where the expression contains a difference of + two symbols in the same segment. */ + fix_new_exp (frag_now, (opcodep - frag_now->fr_literal), 2, + &output_instruction.expr, 0, + output_instruction.reloc); + } + } +} + +/* Low level text-to-bits assembly. */ + +static void +cris_process_instruction (insn_text, out_insnp, prefixp) + char *insn_text; + struct cris_instruction *out_insnp; + struct cris_prefix *prefixp; +{ + char *s; + char modified_char = 0; + const char *args; + struct cris_opcode *instruction; + char *operands; + int match = 0; + int mode; + int regno; + int size_bits; + + /* Reset these fields to a harmless state in case we need to return in + error. */ + prefixp->kind = PREFIX_NONE; + prefixp->reloc = BFD_RELOC_NONE; + out_insnp->insn_type = CRIS_INSN_NORMAL; + out_insnp->imm_oprnd_size = 0; + + /* Find the end of the opcode mnemonic. We assume (true in 2.9.1) + that the caller has translated the opcode to lower-case, up to the + first non-letter. */ + for (operands = insn_text; ISLOWER (*operands); ++operands) + ; + + /* Terminate the opcode after letters, but save the character there if + it was of significance. */ + switch (*operands) + { + case '\0': + break; + + case '.': + /* Put back the modified character later. */ + modified_char = *operands; + /* Fall through. */ + + case ' ': + /* Consume the character after the mnemonic + and replace it with '\0'. */ + *operands++ = '\0'; + break; + + default: + as_bad (_("Unknown opcode: `%s'"), insn_text); + return; + } + + /* Find the instruction. */ + instruction = (struct cris_opcode *) hash_find (op_hash, insn_text); + if (instruction == NULL) + { + as_bad (_("Unknown opcode: `%s'"), insn_text); + return; + } + + /* Put back the modified character. */ + switch (modified_char) + { + case 0: + break; + + default: + *--operands = modified_char; + } + + /* Try to match an opcode table slot. */ + for (s = operands;;) + { + int imm_expr_found; + + /* Initialize *prefixp, perhaps after being modified for a + "near match". */ + prefixp->kind = PREFIX_NONE; + prefixp->reloc = BFD_RELOC_NONE; + + /* Initialize *out_insnp. */ + memset (out_insnp, 0, sizeof (*out_insnp)); + out_insnp->opcode = instruction->match; + out_insnp->reloc = BFD_RELOC_NONE; + out_insnp->insn_type = CRIS_INSN_NORMAL; + out_insnp->imm_oprnd_size = 0; + + imm_expr_found = 0; + + /* Build the opcode, checking as we go to make sure that the + operands match. */ + for (args = instruction->args;; ++args) + { + switch (*args) + { + case '\0': + /* If we've come to the end of arguments, we're done. */ + if (*s == '\0') + match = 1; + break; + + case '!': + /* Non-matcher character for disassembly. + Ignore it here. */ + continue; + + case ',': + case ' ': + /* These must match exactly. */ + if (*s++ == *args) + continue; + break; + + case 'B': + /* This is not really an operand, but causes a "BDAP + -size,SP" prefix to be output, for PUSH instructions. */ + prefixp->kind = PREFIX_PUSH; + continue; + + case 'b': + /* This letter marks an operand that should not be matched + in the assembler. It is a branch with 16-bit + displacement. The assembler will create them from the + 8-bit flavor when necessary. The assembler does not + support the [rN+] operand, as the [r15+] that is + generated for 16-bit displacements. */ + break; + + case 'c': + /* A 5-bit unsigned immediate in bits <4:0>. */ + if (! cris_get_expression (&s, &out_insnp->expr)) + break; + else + { + if (out_insnp->expr.X_op == O_constant + && (out_insnp->expr.X_add_number < 0 + || out_insnp->expr.X_add_number > 31)) + as_bad (_("Immediate value not in 5 bit unsigned range: %ld"), + out_insnp->expr.X_add_number); + + out_insnp->reloc = BFD_RELOC_CRIS_UNSIGNED_5; + continue; + } + + case 'C': + /* A 4-bit unsigned immediate in bits <3:0>. */ + if (! cris_get_expression (&s, &out_insnp->expr)) + break; + else + { + if (out_insnp->expr.X_op == O_constant + && (out_insnp->expr.X_add_number < 0 + || out_insnp->expr.X_add_number > 15)) + as_bad (_("Immediate value not in 4 bit unsigned range: %ld"), + out_insnp->expr.X_add_number); + + out_insnp->reloc = BFD_RELOC_CRIS_UNSIGNED_4; + continue; + } + + case 'D': + /* General register in bits <15:12> and <3:0>. */ + if (! get_gen_reg (&s, ®no)) + break; + else + { + out_insnp->opcode |= regno /* << 0 */; + out_insnp->opcode |= regno << 12; + continue; + } + + case 'f': + /* Flags from the condition code register. */ + { + int flags = 0; + + if (! get_flags (&s, &flags)) + break; + + out_insnp->opcode |= ((flags & 0xf0) << 8) | (flags & 0xf); + continue; + } + + case 'i': + /* A 6-bit signed immediate in bits <5:0>. */ + if (! cris_get_expression (&s, &out_insnp->expr)) + break; + else + { + if (out_insnp->expr.X_op == O_constant + && (out_insnp->expr.X_add_number < -32 + || out_insnp->expr.X_add_number > 31)) + as_bad (_("Immediate value not in 6 bit range: %ld"), + out_insnp->expr.X_add_number); + out_insnp->reloc = BFD_RELOC_CRIS_SIGNED_6; + continue; + } + + case 'I': + /* A 6-bit unsigned immediate in bits <5:0>. */ + if (! cris_get_expression (&s, &out_insnp->expr)) + break; + else + { + if (out_insnp->expr.X_op == O_constant + && (out_insnp->expr.X_add_number < 0 + || out_insnp->expr.X_add_number > 63)) + as_bad (_("Immediate value not in 6 bit unsigned range: %ld"), + out_insnp->expr.X_add_number); + out_insnp->reloc = BFD_RELOC_CRIS_UNSIGNED_6; + continue; + } + + case 'M': + /* A size modifier, B, W or D, to be put in a bit position + suitable for CLEAR instructions (i.e. reflecting a zero + register). */ + if (! get_bwd_size_modifier (&s, &size_bits)) + break; + else + { + switch (size_bits) + { + case 0: + out_insnp->opcode |= 0 << 12; + break; + + case 1: + out_insnp->opcode |= 4 << 12; + break; + + case 2: + out_insnp->opcode |= 8 << 12; + break; + } + continue; + } + + case 'm': + /* A size modifier, B, W or D, to be put in bits <5:4>. */ + if (! get_bwd_size_modifier (&s, &size_bits)) + break; + else + { + out_insnp->opcode |= size_bits << 4; + continue; + } + + case 'o': + /* A branch expression. */ + if (! cris_get_expression (&s, &out_insnp->expr)) + break; + else + { + out_insnp->insn_type = CRIS_INSN_BRANCH; + continue; + } + + case 'O': + /* A BDAP expression for any size, "expr,r". */ + if (! cris_get_expression (&s, &prefixp->expr)) + break; + else + { + if (*s != ',') + break; + + s++; + + if (!get_gen_reg (&s, &prefixp->base_reg_number)) + break; + + /* Since 'O' is used with an explicit bdap, we have no + "real" instruction. */ + prefixp->kind = PREFIX_BDAP_IMM; + prefixp->opcode + = BDAP_QUICK_OPCODE | (prefixp->base_reg_number << 12); + + out_insnp->insn_type = CRIS_INSN_NONE; + continue; + } + + case 'P': + /* Special register in bits <15:12>. */ + if (! get_spec_reg (&s, &out_insnp->spec_reg)) + break; + else + { + /* Use of some special register names come with a + specific warning. Note that we have no ".cpu type" + pseudo yet, so some of this is just unused + framework. */ + if (out_insnp->spec_reg->warning) + as_warn (out_insnp->spec_reg->warning); + else if (out_insnp->spec_reg->applicable_version + == cris_ver_warning) + /* Others have a generic warning. */ + as_warn (_("Unimplemented register `%s' specified"), + out_insnp->spec_reg->name); + + out_insnp->opcode + |= out_insnp->spec_reg->number << 12; + continue; + } + + case 'p': + /* This character is used in the disassembler to + recognize a prefix instruction to fold into the + addressing mode for the next instruction. It is + ignored here. */ + continue; + + case 'R': + /* General register in bits <15:12>. */ + if (! get_gen_reg (&s, ®no)) + break; + else + { + out_insnp->opcode |= regno << 12; + continue; + } + + case 'r': + /* General register in bits <3:0>. */ + if (! get_gen_reg (&s, ®no)) + break; + else + { + out_insnp->opcode |= regno /* << 0 */; + continue; + } + + case 'S': + /* Source operand in bit <10> and a prefix; a 3-operand + prefix. */ + if (! get_3op_or_dip_prefix_op (&s, prefixp)) + break; + else + continue; + + case 's': + /* Source operand in bits <10>, <3:0> and optionally a + prefix; i.e. an indirect operand or an side-effect + prefix. */ + if (! get_autoinc_prefix_or_indir_op (&s, prefixp, &mode, + ®no, + &imm_expr_found, + &out_insnp->expr)) + break; + else + { + if (prefixp->kind != PREFIX_NONE) + { + /* A prefix, so it has the autoincrement bit + set. */ + out_insnp->opcode |= (AUTOINCR_BIT << 8); + } + else + { + /* No prefix. The "mode" variable contains bits like + whether or not this is autoincrement mode. */ + out_insnp->opcode |= (mode << 10); + + /* If there was a PIC reloc specifier, then it was + attached to the prefix. Note that we can't check + that the reloc size matches, since we don't have + all the operands yet in all cases. */ + if (prefixp->reloc != BFD_RELOC_NONE) + out_insnp->reloc = prefixp->reloc; + } + + out_insnp->opcode |= regno /* << 0 */ ; + continue; + } + + case 'x': + /* Rs.m in bits <15:12> and <5:4>. */ + if (! get_gen_reg (&s, ®no) + || ! get_bwd_size_modifier (&s, &size_bits)) + break; + else + { + out_insnp->opcode |= (regno << 12) | (size_bits << 4); + continue; + } + + case 'y': + /* Source operand in bits <10>, <3:0> and optionally a + prefix; i.e. an indirect operand or an side-effect + prefix. + + The difference to 's' is that this does not allow an + "immediate" expression. */ + if (! get_autoinc_prefix_or_indir_op (&s, prefixp, + &mode, ®no, + &imm_expr_found, + &out_insnp->expr) + || imm_expr_found) + break; + else + { + if (prefixp->kind != PREFIX_NONE) + { + /* A prefix, and those matched here always have + side-effects (see 's' case). */ + out_insnp->opcode |= (AUTOINCR_BIT << 8); + } + else + { + /* No prefix. The "mode" variable contains bits + like whether or not this is autoincrement + mode. */ + out_insnp->opcode |= (mode << 10); + } + + out_insnp->opcode |= regno /* << 0 */; + continue; + } + + case 'z': + /* Size modifier (B or W) in bit <4>. */ + if (! get_bw_size_modifier (&s, &size_bits)) + break; + else + { + out_insnp->opcode |= size_bits << 4; + continue; + } + + default: + BAD_CASE (*args); + } + + /* We get here when we fail a match above or we found a + complete match. Break out of this loop. */ + break; + } + + /* Was it a match or a miss? */ + if (match == 0) + { + /* If it's just that the args don't match, maybe the next + item in the table is the same opcode but with + matching operands. */ + if (instruction[1].name != NULL + && ! strcmp (instruction->name, instruction[1].name)) + { + /* Yep. Restart and try that one instead. */ + ++instruction; + s = operands; + continue; + } + else + { + /* We've come to the end of instructions with this + opcode, so it must be an error. */ + as_bad (_("Illegal operands")); + return; + } + } + else + { + /* We have a match. Check if there's anything more to do. */ + if (imm_expr_found) + { + /* There was an immediate mode operand, so we must check + that it has an appropriate size. */ + switch (instruction->imm_oprnd_size) + { + default: + case SIZE_NONE: + /* Shouldn't happen; this one does not have immediate + operands with different sizes. */ + BAD_CASE (instruction->imm_oprnd_size); + break; + + case SIZE_FIX_32: + out_insnp->imm_oprnd_size = 4; + break; + + case SIZE_SPEC_REG: + switch (out_insnp->spec_reg->reg_size) + { + case 1: + if (out_insnp->expr.X_op == O_constant + && (out_insnp->expr.X_add_number < -128 + || out_insnp->expr.X_add_number > 255)) + as_bad (_("Immediate value not in 8 bit range: %ld"), + out_insnp->expr.X_add_number); + /* Fall through. */ + case 2: + /* FIXME: We need an indicator in the instruction + table to pass on, to indicate if we need to check + overflow for a signed or unsigned number. */ + if (out_insnp->expr.X_op == O_constant + && (out_insnp->expr.X_add_number < -32768 + || out_insnp->expr.X_add_number > 65535)) + as_bad (_("Immediate value not in 16 bit range: %ld"), + out_insnp->expr.X_add_number); + out_insnp->imm_oprnd_size = 2; + break; + + case 4: + out_insnp->imm_oprnd_size = 4; + break; + + default: + BAD_CASE (out_insnp->spec_reg->reg_size); + } + break; + + case SIZE_FIELD: + switch (size_bits) + { + case 0: + if (out_insnp->expr.X_op == O_constant + && (out_insnp->expr.X_add_number < -128 + || out_insnp->expr.X_add_number > 255)) + as_bad (_("Immediate value not in 8 bit range: %ld"), + out_insnp->expr.X_add_number); + /* Fall through. */ + case 1: + if (out_insnp->expr.X_op == O_constant + && (out_insnp->expr.X_add_number < -32768 + || out_insnp->expr.X_add_number > 65535)) + as_bad (_("Immediate value not in 16 bit range: %ld"), + out_insnp->expr.X_add_number); + out_insnp->imm_oprnd_size = 2; + break; + + case 2: + out_insnp->imm_oprnd_size = 4; + break; + + default: + BAD_CASE (out_insnp->spec_reg->reg_size); + } + } + + /* If there was a relocation specified for the immediate + expression (i.e. it had a PIC modifier) check that the + size of the PIC relocation matches the size specified by + the opcode. */ + if (out_insnp->reloc != BFD_RELOC_NONE + && (cris_get_pic_reloc_size (out_insnp->reloc) + != (unsigned int) out_insnp->imm_oprnd_size)) + as_bad (_("PIC relocation size does not match operand size")); + } + else if (instruction->op == cris_muls_op + || instruction->op == cris_mulu_op) + out_insnp->insn_type = CRIS_INSN_MUL; + } + break; + } +} + +/* Get a B, W, or D size modifier from the string pointed out by *cPP, + which must point to a '.' in front of the modifier. On successful + return, *cPP is advanced to the character following the size + modifier, and is undefined otherwise. + + cPP Pointer to pointer to string starting + with the size modifier. + + size_bitsp Pointer to variable to contain the size bits on + successful return. + + Return 1 iff a correct size modifier is found, else 0. */ + +static int +get_bwd_size_modifier (cPP, size_bitsp) + char **cPP; + int *size_bitsp; +{ + if (**cPP != '.') + return 0; + else + { + /* Consume the '.'. */ + (*cPP)++; + + switch (**cPP) + { + case 'B': + case 'b': + *size_bitsp = 0; + break; + + case 'W': + case 'w': + *size_bitsp = 1; + break; + + case 'D': + case 'd': + *size_bitsp = 2; + break; + + default: + return 0; + } + + /* Consume the size letter. */ + (*cPP)++; + return 1; + } +} + +/* Get a B or W size modifier from the string pointed out by *cPP, + which must point to a '.' in front of the modifier. On successful + return, *cPP is advanced to the character following the size + modifier, and is undefined otherwise. + + cPP Pointer to pointer to string starting + with the size modifier. + + size_bitsp Pointer to variable to contain the size bits on + successful return. + + Return 1 iff a correct size modifier is found, else 0. */ + +static int +get_bw_size_modifier (cPP, size_bitsp) + char **cPP; + int *size_bitsp; +{ + if (**cPP != '.') + return 0; + else + { + /* Consume the '.'. */ + (*cPP)++; + + switch (**cPP) + { + case 'B': + case 'b': + *size_bitsp = 0; + break; + + case 'W': + case 'w': + *size_bitsp = 1; + break; + + default: + return 0; + } + + /* Consume the size letter. */ + (*cPP)++; + return 1; + } +} + +/* Get a general register from the string pointed out by *cPP. The + variable *cPP is advanced to the character following the general + register name on a successful return, and has its initial position + otherwise. + + cPP Pointer to pointer to string, beginning with a general + register name. + + regnop Pointer to int containing the register number. + + Return 1 iff a correct general register designator is found, + else 0. */ + +static int +get_gen_reg (cPP, regnop) + char **cPP; + int *regnop; +{ + char *oldp; + oldp = *cPP; + + /* Handle a sometimes-mandatory dollar sign as register prefix. */ + if (**cPP == REGISTER_PREFIX_CHAR) + (*cPP)++; + else if (demand_register_prefix) + return 0; + + switch (**cPP) + { + case 'P': + case 'p': + /* "P" as in "PC"? Consume the "P". */ + (*cPP)++; + + if ((**cPP == 'C' || **cPP == 'c') + && ! ISALNUM ((*cPP)[1])) + { + /* It's "PC": consume the "c" and we're done. */ + (*cPP)++; + *regnop = REG_PC; + return 1; + } + break; + + case 'R': + case 'r': + /* Hopefully r[0-9] or r1[0-5]. Consume 'R' or 'r'. */ + (*cPP)++; + + if (ISDIGIT (**cPP)) + { + /* It's r[0-9]. Consume and check the next digit. */ + *regnop = **cPP - '0'; + (*cPP)++; + + if (! ISALNUM (**cPP)) + { + /* No more digits, we're done. */ + return 1; + } + else + { + /* One more digit. Consume and add. */ + *regnop = *regnop * 10 + (**cPP - '0'); + + /* We need to check for a valid register number; Rn, + 0 <= n <= MAX_REG. */ + if (*regnop <= MAX_REG) + { + /* Consume second digit. */ + (*cPP)++; + return 1; + } + } + } + break; + + case 'S': + case 's': + /* "S" as in "SP"? Consume the "S". */ + (*cPP)++; + if (**cPP == 'P' || **cPP == 'p') + { + /* It's "SP": consume the "p" and we're done. */ + (*cPP)++; + *regnop = REG_SP; + return 1; + } + break; + + default: + /* Just here to silence compilation warnings. */ + ; + } + + /* We get here if we fail. Restore the pointer. */ + *cPP = oldp; + return 0; +} + +/* Get a special register from the string pointed out by *cPP. The + variable *cPP is advanced to the character following the special + register name if one is found, and retains its original position + otherwise. + + cPP Pointer to pointer to string starting with a special register + name. + + sregpp Pointer to Pointer to struct spec_reg, where a pointer to the + register description will be stored. + + Return 1 iff a correct special register name is found. */ + +static int +get_spec_reg (cPP, sregpp) + char **cPP; + const struct cris_spec_reg **sregpp; +{ + char *s1; + const char *s2; + char *name_begin = *cPP; + + const struct cris_spec_reg *sregp; + + /* Handle a sometimes-mandatory dollar sign as register prefix. */ + if (*name_begin == REGISTER_PREFIX_CHAR) + name_begin++; + else if (demand_register_prefix) + return 0; + + /* Loop over all special registers. */ + for (sregp = cris_spec_regs; sregp->name != NULL; sregp++) + { + /* Start over from beginning of the supposed name. */ + s1 = name_begin; + s2 = sregp->name; + + while (*s2 != '\0' && TOLOWER (*s1) == *s2) + { + s1++; + s2++; + } + + /* For a match, we must have consumed the name in the table, and we + must be outside what could be part of a name. Assume here that a + test for alphanumerics is sufficient for a name test. */ + if (*s2 == 0 && ! ISALNUM (*s1)) + { + /* We have a match. Update the pointer and be done. */ + *cPP = s1; + *sregpp = sregp; + return 1; + } + } + + /* If we got here, we did not find any name. */ + return 0; +} + +/* Get an unprefixed or side-effect-prefix operand from the string pointed + out by *cPP. The pointer *cPP is advanced to the character following + the indirect operand if we have success, else it contains an undefined + value. + + cPP Pointer to pointer to string beginning with the first + character of the supposed operand. + + prefixp Pointer to structure containing an optional instruction + prefix. + + is_autoincp Pointer to int indicating the indirect or autoincrement + bits. + + src_regnop Pointer to int containing the source register number in + the instruction. + + imm_foundp Pointer to an int indicating if an immediate expression + is found. + + imm_exprP Pointer to a structure containing an immediate + expression, if success and if *imm_foundp is nonzero. + + Return 1 iff a correct indirect operand is found. */ + +static int +get_autoinc_prefix_or_indir_op (cPP, prefixp, is_autoincp, src_regnop, + imm_foundp, imm_exprP) + char **cPP; + struct cris_prefix *prefixp; + int *is_autoincp; + int *src_regnop; + int *imm_foundp; + expressionS *imm_exprP; +{ + /* Assume there was no immediate mode expression. */ + *imm_foundp = 0; + + if (**cPP == '[') + { + /* So this operand is one of: + Indirect: [rN] + Autoincrement: [rN+] + Indexed with assign: [rN=rM+rO.S] + Offset with assign: [rN=rM+I], [rN=rM+[rO].s], [rN=rM+[rO+].s] + + Either way, consume the '['. */ + (*cPP)++; + + /* Get the rN register. */ + if (! get_gen_reg (cPP, src_regnop)) + /* If there was no register, then this cannot match. */ + return 0; + else + { + /* We got the register, now check the next character. */ + switch (**cPP) + { + case ']': + /* Indirect mode. We're done here. */ + prefixp->kind = PREFIX_NONE; + *is_autoincp = 0; + break; + + case '+': + /* This must be an auto-increment mode, if there's a + match. */ + prefixp->kind = PREFIX_NONE; + *is_autoincp = 1; + + /* We consume this character and break out to check the + closing ']'. */ + (*cPP)++; + break; + + case '=': + /* This must be indexed with assign, or offset with assign + to match. */ + (*cPP)++; + + /* Either way, the next thing must be a register. */ + if (! get_gen_reg (cPP, &prefixp->base_reg_number)) + /* No register, no match. */ + return 0; + else + { + /* We've consumed "[rN=rM", so we must be looking at + "+rO.s]" or "+I]", or "-I]", or "+[rO].s]" or + "+[rO+].s]". */ + if (**cPP == '+') + { + int index_reg_number; + (*cPP)++; + + if (**cPP == '[') + { + int size_bits; + /* This must be [rx=ry+[rz].s] or + [rx=ry+[rz+].s] or no match. We must be + looking at rz after consuming the '['. */ + (*cPP)++; + + if (!get_gen_reg (cPP, &index_reg_number)) + return 0; + + prefixp->kind = PREFIX_BDAP; + prefixp->opcode + = (BDAP_INDIR_OPCODE + + (prefixp->base_reg_number << 12) + + index_reg_number); + + if (**cPP == '+') + { + /* We've seen "[rx=ry+[rz+" here, so now we + know that there must be "].s]" left to + check. */ + (*cPP)++; + prefixp->opcode |= AUTOINCR_BIT << 8; + } + + /* If it wasn't autoincrement, we don't need to + add anything. */ + + /* Check the next-to-last ']'. */ + if (**cPP != ']') + return 0; + + (*cPP)++; + + /* Check the ".s" modifier. */ + if (! get_bwd_size_modifier (cPP, &size_bits)) + return 0; + + prefixp->opcode |= size_bits << 4; + + /* Now we got [rx=ry+[rz+].s or [rx=ry+[rz].s. + We break out to check the final ']'. */ + break; + } + /* It wasn't an indirection. Check if it's a + register. */ + else if (get_gen_reg (cPP, &index_reg_number)) + { + int size_bits; + + /* Indexed with assign mode: "[rN+rM.S]". */ + prefixp->kind = PREFIX_BIAP; + prefixp->opcode + = (BIAP_OPCODE + (index_reg_number << 12) + + prefixp->base_reg_number /* << 0 */); + + if (! get_bwd_size_modifier (cPP, &size_bits)) + /* Size missing, this isn't a match. */ + return 0; + else + { + /* Size found, break out to check the + final ']'. */ + prefixp->opcode |= size_bits << 4; + break; + } + } + /* Not a register. Then this must be "[rN+I]". */ + else if (cris_get_expression (cPP, &prefixp->expr)) + { + /* We've got offset with assign mode. Fill + in the blanks and break out to match the + final ']'. */ + prefixp->kind = PREFIX_BDAP_IMM; + + /* We tentatively put an opcode corresponding to + a 32-bit operand here, although it may be + relaxed when there's no PIC specifier for the + operand. */ + prefixp->opcode + = (BDAP_INDIR_OPCODE + | (prefixp->base_reg_number << 12) + | (AUTOINCR_BIT << 8) + | (2 << 4) + | REG_PC /* << 0 */); + + /* This can have a PIC suffix, specifying reloc + type to use. */ + if (pic && **cPP == PIC_SUFFIX_CHAR) + { + unsigned int relocsize; + + cris_get_pic_suffix (cPP, &prefixp->reloc, + &prefixp->expr); + + /* Tweak the size of the immediate operand + in the prefix opcode if it isn't what we + set. */ + relocsize + = cris_get_pic_reloc_size (prefixp->reloc); + if (relocsize != 4) + prefixp->opcode + = ((prefixp->opcode & ~(3 << 4)) + | ((relocsize >> 1) << 4)); + } + break; + } + else + /* Neither register nor expression found, so + this can't be a match. */ + return 0; + } + /* Not "[rN+" but perhaps "[rN-"? */ + else if (**cPP == '-') + { + /* We must have an offset with assign mode. */ + if (! cris_get_expression (cPP, &prefixp->expr)) + /* No expression, no match. */ + return 0; + else + { + /* We've got offset with assign mode. Fill + in the blanks and break out to match the + final ']'. + + Note that we don't allow a PIC suffix for an + operand with a minus sign. */ + prefixp->kind = PREFIX_BDAP_IMM; + break; + } + } + else + /* Neither '+' nor '-' after "[rN=rM". Lose. */ + return 0; + } + default: + /* Neither ']' nor '+' nor '=' after "[rN". Lose. */ + return 0; + } + } + + /* When we get here, we have a match and will just check the closing + ']'. We can still fail though. */ + if (**cPP != ']') + return 0; + else + { + /* Don't forget to consume the final ']'. + Then return in glory. */ + (*cPP)++; + return 1; + } + } + /* No indirection. Perhaps a constant? */ + else if (cris_get_expression (cPP, imm_exprP)) + { + /* Expression found, this is immediate mode. */ + prefixp->kind = PREFIX_NONE; + *is_autoincp = 1; + *src_regnop = REG_PC; + *imm_foundp = 1; + + /* This can have a PIC suffix, specifying reloc type to use. The + caller must check that the reloc size matches the operand size. */ + if (pic && **cPP == PIC_SUFFIX_CHAR) + cris_get_pic_suffix (cPP, &prefixp->reloc, imm_exprP); + + return 1; + } + + /* No luck today. */ + return 0; +} + +/* This function gets an indirect operand in a three-address operand + combination from the string pointed out by *cPP. The pointer *cPP is + advanced to the character following the indirect operand on success, or + has an unspecified value on failure. + + cPP Pointer to pointer to string beginning + with the operand + + prefixp Pointer to structure containing an + instruction prefix + + Returns 1 iff a correct indirect operand is found. */ + +static int +get_3op_or_dip_prefix_op (cPP, prefixp) + char **cPP; + struct cris_prefix *prefixp; +{ + int reg_number; + + if (**cPP != '[') + /* We must have a '[' or it's a clean failure. */ + return 0; + + /* Eat the first '['. */ + (*cPP)++; + + if (**cPP == '[') + { + /* A second '[', so this must be double-indirect mode. */ + (*cPP)++; + prefixp->kind = PREFIX_DIP; + prefixp->opcode = DIP_OPCODE; + + /* Get the register or fail entirely. */ + if (! get_gen_reg (cPP, ®_number)) + return 0; + else + { + prefixp->opcode |= reg_number /* << 0 */ ; + if (**cPP == '+') + { + /* Since we found a '+', this must be double-indirect + autoincrement mode. */ + (*cPP)++; + prefixp->opcode |= AUTOINCR_BIT << 8; + } + + /* There's nothing particular to do, if this was a + double-indirect *without* autoincrement. */ + } + + /* Check the first ']'. The second one is checked at the end. */ + if (**cPP != ']') + return 0; + + /* Eat the first ']', so we'll be looking at a second ']'. */ + (*cPP)++; + } + /* No second '['. Then we should have a register here, making + it "[rN". */ + else if (get_gen_reg (cPP, &prefixp->base_reg_number)) + { + /* This must be indexed or offset mode: "[rN+I]" or + "[rN+rM.S]" or "[rN+[rM].S]" or "[rN+[rM+].S]". */ + if (**cPP == '+') + { + int index_reg_number; + + (*cPP)++; + + if (**cPP == '[') + { + /* This is "[rx+["... Expect a register next. */ + int size_bits; + (*cPP)++; + + if (!get_gen_reg (cPP, &index_reg_number)) + return 0; + + prefixp->kind = PREFIX_BDAP; + prefixp->opcode + = (BDAP_INDIR_OPCODE + + (prefixp->base_reg_number << 12) + + index_reg_number); + + /* We've seen "[rx+[ry", so check if this is + autoincrement. */ + if (**cPP == '+') + { + /* Yep, now at "[rx+[ry+". */ + (*cPP)++; + prefixp->opcode |= AUTOINCR_BIT << 8; + } + /* If it wasn't autoincrement, we don't need to + add anything. */ + + /* Check a first closing ']': "[rx+[ry]" or + "[rx+[ry+]". */ + if (**cPP != ']') + return 0; + (*cPP)++; + + /* Now expect a size modifier ".S". */ + if (! get_bwd_size_modifier (cPP, &size_bits)) + return 0; + + prefixp->opcode |= size_bits << 4; + + /* Ok, all interesting stuff has been seen: + "[rx+[ry+].S" or "[rx+[ry].S". We only need to + expect a final ']', which we'll do in a common + closing session. */ + } + /* Seen "[rN+", but not a '[', so check if we have a + register. */ + else if (get_gen_reg (cPP, &index_reg_number)) + { + /* This is indexed mode: "[rN+rM.S]" or + "[rN+rM.S+]". */ + int size_bits; + prefixp->kind = PREFIX_BIAP; + prefixp->opcode + = (BIAP_OPCODE + | prefixp->base_reg_number /* << 0 */ + | (index_reg_number << 12)); + + /* Consume the ".S". */ + if (! get_bwd_size_modifier (cPP, &size_bits)) + /* Missing size, so fail. */ + return 0; + else + /* Size found. Add that piece and drop down to + the common checking of the closing ']'. */ + prefixp->opcode |= size_bits << 4; + } + /* Seen "[rN+", but not a '[' or a register, so then + it must be a constant "I". */ + else if (cris_get_expression (cPP, &prefixp->expr)) + { + /* Expression found, so fill in the bits of offset + mode and drop down to check the closing ']'. */ + prefixp->kind = PREFIX_BDAP_IMM; + + /* We tentatively put an opcode corresponding to a 32-bit + operand here, although it may be relaxed when there's no + PIC specifier for the operand. */ + prefixp->opcode + = (BDAP_INDIR_OPCODE + | (prefixp->base_reg_number << 12) + | (AUTOINCR_BIT << 8) + | (2 << 4) + | REG_PC /* << 0 */); + + /* This can have a PIC suffix, specifying reloc type to use. */ + if (pic && **cPP == PIC_SUFFIX_CHAR) + { + unsigned int relocsize; + + cris_get_pic_suffix (cPP, &prefixp->reloc, &prefixp->expr); + + /* Tweak the size of the immediate operand in the prefix + opcode if it isn't what we set. */ + relocsize = cris_get_pic_reloc_size (prefixp->reloc); + if (relocsize != 4) + prefixp->opcode + = ((prefixp->opcode & ~(3 << 4)) + | ((relocsize >> 1) << 4)); + } + } + else + /* Nothing valid here: lose. */ + return 0; + } + /* Seen "[rN" but no '+', so check if it's a '-'. */ + else if (**cPP == '-') + { + /* Yep, we must have offset mode. */ + if (! cris_get_expression (cPP, &prefixp->expr)) + /* No expression, so we lose. */ + return 0; + else + { + /* Expression found to make this offset mode, so + fill those bits and drop down to check the + closing ']'. + + Note that we don't allow a PIC suffix for + an operand with a minus sign like this. */ + prefixp->kind = PREFIX_BDAP_IMM; + } + } + else + { + /* We've seen "[rN", but not '+' or '-'; rather a ']'. + Hmm. Normally this is a simple indirect mode that we + shouldn't match, but if we expect ']', then we have a + zero offset, so it can be a three-address-operand, + like "[rN],rO,rP", thus offset mode. + + Don't eat the ']', that will be done in the closing + ceremony. */ + prefixp->expr.X_op = O_constant; + prefixp->expr.X_add_number = 0; + prefixp->expr.X_add_symbol = NULL; + prefixp->expr.X_op_symbol = NULL; + prefixp->kind = PREFIX_BDAP_IMM; + } + } + /* A '[', but no second '[', and no register. Check if we + have an expression, making this "[I]" for a double-indirect + prefix. */ + else if (cris_get_expression (cPP, &prefixp->expr)) + { + /* Expression found, the so called absolute mode for a + double-indirect prefix on PC. */ + prefixp->kind = PREFIX_DIP; + prefixp->opcode = DIP_OPCODE | (AUTOINCR_BIT << 8) | REG_PC; + prefixp->reloc = BFD_RELOC_32; + } + else + /* Neither '[' nor register nor expression. We lose. */ + return 0; + + /* We get here as a closing ceremony to a successful match. We just + need to check the closing ']'. */ + if (**cPP != ']') + /* Oops. Close but no air-polluter. */ + return 0; + + /* Don't forget to consume that ']', before returning in glory. */ + (*cPP)++; + return 1; +} + +/* Get an expression from the string pointed out by *cPP. + The pointer *cPP is advanced to the character following the expression + on a success, or retains its original value otherwise. + + cPP Pointer to pointer to string beginning with the expression. + + exprP Pointer to structure containing the expression. + + Return 1 iff a correct expression is found. */ + +static int +cris_get_expression (cPP, exprP) + char **cPP; + expressionS *exprP; +{ + char *saved_input_line_pointer; + segT exp; + + /* The "expression" function expects to find an expression at the + global variable input_line_pointer, so we have to save it to give + the impression that we don't fiddle with global variables. */ + saved_input_line_pointer = input_line_pointer; + input_line_pointer = *cPP; + + exp = expression (exprP); + if (exprP->X_op == O_illegal || exprP->X_op == O_absent) + { + input_line_pointer = saved_input_line_pointer; + return 0; + } + + /* Everything seems to be fine, just restore the global + input_line_pointer and say we're successful. */ + *cPP = input_line_pointer; + input_line_pointer = saved_input_line_pointer; + return 1; +} + +/* Get a sequence of flag characters from *spp. The pointer *cPP is + advanced to the character following the expression. The flag + characters are consecutive, no commas or spaces. + + cPP Pointer to pointer to string beginning with the expression. + + flagp Pointer to int to return the flags expression. + + Return 1 iff a correct flags expression is found. */ + +static int +get_flags (cPP, flagsp) + char **cPP; + int *flagsp; +{ + for (;;) + { + switch (**cPP) + { + case 'd': + case 'D': + case 'm': + case 'M': + *flagsp |= 0x80; + break; + + case 'e': + case 'E': + case 'b': + case 'B': + *flagsp |= 0x40; + break; + + case 'i': + case 'I': + *flagsp |= 0x20; + break; + + case 'x': + case 'X': + *flagsp |= 0x10; + break; + + case 'n': + case 'N': + *flagsp |= 0x8; + break; + + case 'z': + case 'Z': + *flagsp |= 0x4; + break; + + case 'v': + case 'V': + *flagsp |= 0x2; + break; + + case 'c': + case 'C': + *flagsp |= 1; + break; + + default: + /* We consider this successful if we stop at a comma or + whitespace. Anything else, and we consider it a failure. */ + if (**cPP != ',' + && **cPP != 0 + && ! ISSPACE (**cPP)) + return 0; + else + return 1; + } + + /* Don't forget to consume each flag character. */ + (*cPP)++; + } +} + +/* Generate code and fixes for a BDAP prefix. + + base_regno Int containing the base register number. + + exprP Pointer to structure containing the offset expression. */ + +static void +gen_bdap (base_regno, exprP) + int base_regno; + expressionS *exprP; +{ + unsigned int opcode; + char *opcodep; + + /* Put out the prefix opcode; assume quick immediate mode at first. */ + opcode = BDAP_QUICK_OPCODE | (base_regno << 12); + opcodep = cris_insn_first_word_frag (); + md_number_to_chars (opcodep, opcode, 2); + + if (exprP->X_op == O_constant) + { + /* We have an absolute expression that we know the size of right + now. */ + long int value; + int size; + + value = exprP->X_add_number; + if (value < -32768 || value > 32767) + /* Outside range for a "word", make it a dword. */ + size = 2; + else + /* Assume "word" size. */ + size = 1; + + /* If this is a signed-byte value, we can fit it into the prefix + insn itself. */ + if (value >= -128 && value <= 127) + opcodep[0] = value; + else + { + /* This is a word or dword displacement, which will be put in a + word or dword after the prefix. */ + char *p; + + opcodep[0] = BDAP_PC_LOW + (size << 4); + opcodep[1] &= 0xF0; + opcodep[1] |= BDAP_INCR_HIGH; + p = frag_more (1 << size); + md_number_to_chars (p, value, 1 << size); + } + } + else + { + /* Handle complex expressions. */ + valueT addvalue + = SIMPLE_EXPR (exprP) ? exprP->X_add_number : 0; + symbolS *sym + = (SIMPLE_EXPR (exprP) + ? exprP->X_add_symbol : make_expr_symbol (exprP)); + + /* The expression is not defined yet but may become absolute. We + make it a relocation to be relaxed. */ + frag_var (rs_machine_dependent, 4, 0, + ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_UNDF), + sym, addvalue, opcodep); + } +} + +/* Encode a branch displacement in the range -256..254 into the form used + by CRIS conditional branch instructions. + + offset The displacement value in bytes. */ + +static int +branch_disp (offset) + int offset; +{ + int disp; + + disp = offset & 0xFE; + + if (offset < 0) + disp |= 1; + + return disp; +} + +/* Generate code and fixes for a 32-bit conditional branch instruction + created by "extending" an existing 8-bit branch instruction. + + opcodep Pointer to the word containing the original 8-bit branch + instruction. + + writep Pointer to "extension area" following the first instruction + word. + + fragP Pointer to the frag containing the instruction. + + add_symP, Parts of the destination address expression. + sub_symP, + add_num. */ + +static void +gen_cond_branch_32 (opcodep, writep, fragP, add_symP, sub_symP, add_num) + char *opcodep; + char *writep; + fragS *fragP; + symbolS *add_symP; + symbolS *sub_symP; + long int add_num; +{ + if (warn_for_branch_expansion) + as_warn_where (fragP->fr_file, fragP->fr_line, + _("32-bit conditional branch generated")); + + /* Here, writep points to what will be opcodep + 2. First, we change + the actual branch in opcodep[0] and opcodep[1], so that in the + final insn, it will look like: + opcodep+10: Bcc .-6 + + This means we don't have to worry about changing the opcode or + messing with the delay-slot instruction. So, we move it to last in + the "extended" branch, and just change the displacement. Admittedly, + it's not the optimal extended construct, but we should get this + rarely enough that it shouldn't matter. */ + + writep[8] = branch_disp (-2 - 6); + writep[9] = opcodep[1]; + + /* Then, we change the branch to an unconditional branch over the + extended part, to the new location of the Bcc: + opcodep: BA .+10 + opcodep+2: NOP + + Note that these two writes are to currently different locations, + merged later. */ + + md_number_to_chars (opcodep, BA_QUICK_OPCODE + 8, 2); + md_number_to_chars (writep, NOP_OPCODE, 2); + + /* Then the extended thing, the 32-bit jump insn. + opcodep+4: JUMP [PC+] + or, in the PIC case, + opcodep+4: ADD [PC+],PC. */ + + md_number_to_chars (writep + 2, + pic ? ADD_PC_INCR_OPCODE : JUMP_PC_INCR_OPCODE, 2); + + /* We have to fill in the actual value too. + opcodep+6: .DWORD + This is most probably an expression, but we can cope with an absolute + value too. FIXME: Testcase needed with and without pic. */ + + if (add_symP == NULL && sub_symP == NULL) + { + /* An absolute address. */ + if (pic) + fix_new (fragP, writep + 4 - fragP->fr_literal, 4, + section_symbol (absolute_section), + add_num, 1, BFD_RELOC_32_PCREL); + else + md_number_to_chars (writep + 4, add_num, 4); + } + else + { + if (sub_symP != NULL) + as_bad_where (fragP->fr_file, fragP->fr_line, + _("Complex expression not supported")); + + /* Not absolute, we have to make it a frag for later evaluation. */ + fix_new (fragP, writep + 4 - fragP->fr_literal, 4, add_symP, + add_num, pic ? 1 : 0, pic ? BFD_RELOC_32_PCREL : BFD_RELOC_32); + } +} + +/* Get the size of an immediate-reloc in bytes. Only valid for PIC + relocs. */ + +static unsigned int +cris_get_pic_reloc_size (reloc) + bfd_reloc_code_real_type reloc; +{ + return reloc == BFD_RELOC_CRIS_16_GOTPLT || reloc == BFD_RELOC_CRIS_16_GOT + ? 2 : 4; +} + +/* Store a reloc type at *RELOCP corresponding to the PIC suffix at *CPP. + Adjust *EXPRP with any addend found after the PIC suffix. */ + +static void +cris_get_pic_suffix (cPP, relocp, exprP) + char **cPP; + bfd_reloc_code_real_type *relocp; + expressionS *exprP; +{ + char *s = *cPP; + unsigned int i; + expressionS const_expr; + + const struct pic_suffixes_struct + { + const char *const suffix; + unsigned int len; + bfd_reloc_code_real_type reloc; + } pic_suffixes[] = + { +#undef PICMAP +#define PICMAP(s, r) {s, sizeof (s) - 1, r} + /* Keep this in order with longest unambiguous prefix first. */ + PICMAP ("GOTPLT16", BFD_RELOC_CRIS_16_GOTPLT), + PICMAP ("GOTPLT", BFD_RELOC_CRIS_32_GOTPLT), + PICMAP ("PLTG", BFD_RELOC_CRIS_32_PLT_GOTREL), + PICMAP ("PLT", BFD_RELOC_CRIS_32_PLT_PCREL), + PICMAP ("GOTOFF", BFD_RELOC_CRIS_32_GOTREL), + PICMAP ("GOT16", BFD_RELOC_CRIS_16_GOT), + PICMAP ("GOT", BFD_RELOC_CRIS_32_GOT) + }; + + /* We've already seen the ':', so consume it. */ + s++; + + for (i = 0; i < sizeof (pic_suffixes)/sizeof (pic_suffixes[0]); i++) + { + if (strncmp (s, pic_suffixes[i].suffix, pic_suffixes[i].len) == 0 + && ! is_part_of_name (s[pic_suffixes[i].len])) + { + /* We have a match. Consume the suffix and set the relocation + type. */ + s += pic_suffixes[i].len; + + /* There can be a constant term appended. If so, we will add it + to *EXPRP. */ + if (*s == '+' || *s == '-') + { + if (! cris_get_expression (&s, &const_expr)) + /* There was some kind of syntax error. Bail out. */ + break; + + /* Allow complex expressions as the constant part. It still + has to be an assembly-time constant or there will be an + error emitting the reloc. This makes the PIC qualifiers + idempotent; foo:GOTOFF+32 == foo+32:GOTOFF. The former we + recognize here; the latter is parsed in the incoming + expression. */ + exprP->X_add_symbol = make_expr_symbol (exprP); + exprP->X_op = O_add; + exprP->X_add_number = 0; + exprP->X_op_symbol = make_expr_symbol (&const_expr); + } + + *relocp = pic_suffixes[i].reloc; + *cPP = s; + return; + } + } + + /* No match. Don't consume anything; fall back and there will be a + syntax error. */ +} + +/* This *could* be: + + Turn a string in input_line_pointer into a floating point constant + of type TYPE, and store the appropriate bytes in *LITP. The number + of LITTLENUMS emitted is stored in *SIZEP. + + type A character from FLTCHARS that describes what kind of + floating-point number is wanted. + + litp A pointer to an array that the result should be stored in. + + sizep A pointer to an integer where the size of the result is stored. + + But we don't support floating point constants in assembly code *at all*, + since it's suboptimal and just opens up bug opportunities. GCC emits + the bit patterns as hex. All we could do here is to emit what GCC + would have done in the first place. *Nobody* writes floating-point + code as assembly code, but if they do, they should be able enough to + find out the correct bit patterns and use them. */ + +char * +md_atof (type, litp, sizep) + char type ATTRIBUTE_UNUSED; + char *litp ATTRIBUTE_UNUSED; + int *sizep ATTRIBUTE_UNUSED; +{ + /* FIXME: Is this function mentioned in the internals.texi manual? If + not, add it. */ + return _("Bad call to md_atof () - floating point formats are not supported"); +} + +/* Turn a number as a fixS * into a series of bytes that represents the + number on the target machine. The purpose of this procedure is the + same as that of md_number_to_chars but this procedure is supposed to + handle general bit field fixes and machine-dependent fixups. + + bufp Pointer to an array where the result should be stored. + + val The value to store. + + n The number of bytes in "val" that should be stored. + + fixP The fix to be applied to the bit field starting at bufp. + + seg The segment containing this number. */ + +static void +cris_number_to_imm (bufp, val, n, fixP, seg) + char *bufp; + long val; + int n; + fixS *fixP; + segT seg; +{ + segT sym_seg; + + know (n <= 4); + know (fixP); + + /* We put the relative "vma" for the other segment for inter-segment + relocations in the object data to stay binary "compatible" (with an + uninteresting old version) for the relocation. + Maybe delete some day. */ + if (fixP->fx_addsy + && (sym_seg = S_GET_SEGMENT (fixP->fx_addsy)) != seg) + val += sym_seg->vma; + + if (fixP->fx_addsy != NULL || fixP->fx_pcrel) + switch (fixP->fx_r_type) + { + /* These must be fully resolved when getting here. */ + case BFD_RELOC_32_PCREL: + case BFD_RELOC_16_PCREL: + case BFD_RELOC_8_PCREL: + as_bad_where (fixP->fx_frag->fr_file, fixP->fx_frag->fr_line, + _("PC-relative relocation must be trivially resolved")); + default: + ; + } + + switch (fixP->fx_r_type) + { + /* Ditto here, we put the addend into the object code as + well as the reloc addend. Keep it that way for now, to simplify + regression tests on the object file contents. FIXME: Seems + uninteresting now that we have a test suite. */ + + case BFD_RELOC_CRIS_16_GOT: + case BFD_RELOC_CRIS_32_GOT: + case BFD_RELOC_CRIS_32_GOTREL: + case BFD_RELOC_CRIS_16_GOTPLT: + case BFD_RELOC_CRIS_32_GOTPLT: + case BFD_RELOC_CRIS_32_PLT_GOTREL: + case BFD_RELOC_CRIS_32_PLT_PCREL: + /* We don't want to put in any kind of non-zero bits in the data + being relocated for these. */ + break; + + case BFD_RELOC_32: + case BFD_RELOC_32_PCREL: + /* No use having warnings here, since most hosts have a 32-bit type + for "long" (which will probably change soon, now that I wrote + this). */ + bufp[3] = (val >> 24) & 0xFF; + bufp[2] = (val >> 16) & 0xFF; + bufp[1] = (val >> 8) & 0xFF; + bufp[0] = val & 0xFF; + break; + + /* FIXME: The 16 and 8-bit cases should have a way to check + whether a signed or unsigned (or any signedness) number is + accepted. + FIXME: Does the as_bad calls find the line number by themselves, + or should we change them into as_bad_where? */ + + case BFD_RELOC_16: + case BFD_RELOC_16_PCREL: + if (val > 0xffff || val < -32768) + as_bad (_("Value not in 16 bit range: %ld"), val); + if (! fixP->fx_addsy) + { + bufp[1] = (val >> 8) & 0xFF; + bufp[0] = val & 0xFF; + } + break; + + case BFD_RELOC_8: + case BFD_RELOC_8_PCREL: + if (val > 255 || val < -128) + as_bad (_("Value not in 8 bit range: %ld"), val); + if (! fixP->fx_addsy) + bufp[0] = val & 0xFF; + break; + + case BFD_RELOC_CRIS_UNSIGNED_4: + if (val > 15 || val < 0) + as_bad (_("Value not in 4 bit unsigned range: %ld"), val); + if (! fixP->fx_addsy) + bufp[0] |= val & 0x0F; + break; + + case BFD_RELOC_CRIS_UNSIGNED_5: + if (val > 31 || val < 0) + as_bad (_("Value not in 5 bit unsigned range: %ld"), val); + if (! fixP->fx_addsy) + bufp[0] |= val & 0x1F; + break; + + case BFD_RELOC_CRIS_SIGNED_6: + if (val > 31 || val < -32) + as_bad (_("Value not in 6 bit range: %ld"), val); + if (! fixP->fx_addsy) + bufp[0] |= val & 0x3F; + break; + + case BFD_RELOC_CRIS_UNSIGNED_6: + if (val > 63 || val < 0) + as_bad (_("Value not in 6 bit unsigned range: %ld"), val); + if (! fixP->fx_addsy) + bufp[0] |= val & 0x3F; + break; + + case BFD_RELOC_CRIS_BDISP8: + if (! fixP->fx_addsy) + bufp[0] = branch_disp (val); + break; + + case BFD_RELOC_NONE: + /* May actually happen automatically. For example at broken + words, if the word turns out not to be broken. + FIXME: When? Which testcase? */ + if (! fixP->fx_addsy) + md_number_to_chars (bufp, val, n); + break; + + case BFD_RELOC_VTABLE_INHERIT: + /* This borrowed from tc-ppc.c on a whim. */ + if (fixP->fx_addsy + && !S_IS_DEFINED (fixP->fx_addsy) + && !S_IS_WEAK (fixP->fx_addsy)) + S_SET_WEAK (fixP->fx_addsy); + /* Fall through. */ + + case BFD_RELOC_VTABLE_ENTRY: + fixP->fx_done = 0; + break; + + default: + BAD_CASE (fixP->fx_r_type); + } +} + +/* Processes machine-dependent command line options. Called once for + each option on the command line that the machine-independent part of + GAS does not understand. */ + +int +md_parse_option (arg, argp) + int arg; + char *argp ATTRIBUTE_UNUSED; +{ + switch (arg) + { + case 'H': + case 'h': + printf (_("Please use --help to see usage and options for this assembler.\n")); + md_show_usage (stdout); + exit (EXIT_SUCCESS); + + case 'N': + warn_for_branch_expansion = 1; + return 1; + + case OPTION_NO_US: + demand_register_prefix = TRUE; + + if (OUTPUT_FLAVOR == bfd_target_aout_flavour) + as_bad (_("--no-underscore is invalid with a.out format")); + else + symbols_have_leading_underscore = FALSE; + return 1; + + case OPTION_US: + demand_register_prefix = FALSE; + symbols_have_leading_underscore = TRUE; + return 1; + + case OPTION_PIC: + pic = TRUE; + return 1; + + case OPTION_MULBUG_ABORT_OFF: + err_for_dangerous_mul_placement = 0; + return 1; + + case OPTION_MULBUG_ABORT_ON: + err_for_dangerous_mul_placement = 1; + return 1; + + default: + return 0; + } +} + +/* Round up a section size to the appropriate boundary. */ +valueT +md_section_align (segment, size) + segT segment; + valueT size; +{ + /* Round all sects to multiple of 4, except the bss section, which + we'll round to word-size. + + FIXME: Check if this really matters. All sections should be + rounded up, and all sections should (optionally) be assumed to be + dword-aligned, it's just that there is actual usage of linking to a + multiple of two. */ + if (OUTPUT_FLAVOR == bfd_target_aout_flavour) + { + if (segment == bss_section) + return (size + 1) & ~1; + return (size + 3) & ~3; + } + else + { + /* FIXME: Is this wanted? It matches the testsuite, but that's not + really a valid reason. */ + if (segment == text_section) + return (size + 3) & ~3; + } + + return size; +} + +/* Generate a machine-dependent relocation. */ +arelent * +tc_gen_reloc (section, fixP) + asection *section ATTRIBUTE_UNUSED; + fixS *fixP; +{ + arelent *relP; + bfd_reloc_code_real_type code; + + switch (fixP->fx_r_type) + { + case BFD_RELOC_CRIS_16_GOT: + case BFD_RELOC_CRIS_32_GOT: + case BFD_RELOC_CRIS_16_GOTPLT: + case BFD_RELOC_CRIS_32_GOTPLT: + case BFD_RELOC_CRIS_32_GOTREL: + case BFD_RELOC_CRIS_32_PLT_GOTREL: + case BFD_RELOC_CRIS_32_PLT_PCREL: + case BFD_RELOC_32: + case BFD_RELOC_16: + case BFD_RELOC_8: + case BFD_RELOC_VTABLE_INHERIT: + case BFD_RELOC_VTABLE_ENTRY: + code = fixP->fx_r_type; + break; + default: + as_bad_where (fixP->fx_file, fixP->fx_line, + _("Semantics error. This type of operand can not be relocated, it must be an assembly-time constant")); + return 0; + } + + relP = (arelent *) xmalloc (sizeof (arelent)); + assert (relP != 0); + relP->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); + *relP->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy); + relP->address = fixP->fx_frag->fr_address + fixP->fx_where; + + if (fixP->fx_pcrel) + relP->addend = 0; + else + relP->addend = fixP->fx_offset; + + /* This is the standard place for KLUDGEs to work around bugs in + bfd_install_relocation (first such note in the documentation + appears with binutils-2.8). + + That function bfd_install_relocation does the wrong thing with + putting stuff into the addend of a reloc (it should stay out) for a + weak symbol. The really bad thing is that it adds the + "segment-relative offset" of the symbol into the reloc. In this + case, the reloc should instead be relative to the symbol with no + other offset than the assembly code shows; and since the symbol is + weak, any local definition should be ignored until link time (or + thereafter). + To wit: weaksym+42 should be weaksym+42 in the reloc, + not weaksym+(offset_from_segment_of_local_weaksym_definition) + + To "work around" this, we subtract the segment-relative offset of + "known" weak symbols. This evens out the extra offset. + + That happens for a.out but not for ELF, since for ELF, + bfd_install_relocation uses the "special function" field of the + howto, and does not execute the code that needs to be undone. */ + + if (OUTPUT_FLAVOR == bfd_target_aout_flavour + && fixP->fx_addsy && S_IS_WEAK (fixP->fx_addsy) + && ! bfd_is_und_section (S_GET_SEGMENT (fixP->fx_addsy))) + { + relP->addend -= S_GET_VALUE (fixP->fx_addsy); + } + + relP->howto = bfd_reloc_type_lookup (stdoutput, code); + if (! relP->howto) + { + const char *name; + + name = S_GET_NAME (fixP->fx_addsy); + if (name == NULL) + name = _(""); + as_fatal (_("Cannot generate relocation type for symbol %s, code %s"), + name, bfd_get_reloc_code_name (code)); + } + + return relP; +} + +/* Machine-dependent usage-output. */ + +void +md_show_usage (stream) + FILE *stream; +{ + /* The messages are formatted to line up with the generic options. */ + fprintf (stream, _("CRIS-specific options:\n")); + fprintf (stream, "%s", + _(" -h, -H Don't execute, print this help text. Deprecated.\n")); + fprintf (stream, "%s", + _(" -N Warn when branches are expanded to jumps.\n")); + fprintf (stream, "%s", + _(" --underscore User symbols are normally prepended with underscore.\n")); + fprintf (stream, "%s", + _(" Registers will not need any prefix.\n")); + fprintf (stream, "%s", + _(" --no-underscore User symbols do not have any prefix.\n")); + fprintf (stream, "%s", + _(" Registers will require a `$'-prefix.\n")); + fprintf (stream, "%s", + _(" --pic Enable generation of position-independent code.\n")); +} + +/* Apply a fixS (fixup of an instruction or data that we didn't have + enough info to complete immediately) to the data in a frag. */ + +void +md_apply_fix3 (fixP, valP, seg) + fixS *fixP; + valueT *valP; + segT seg; +{ + /* This assignment truncates upper bits if valueT is 64 bits (as with + --enable-64-bit-bfd), which is fine here, though we cast to avoid + any compiler warnings. */ + long val = (long) *valP; + char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; + + if (fixP->fx_addsy == 0 && !fixP->fx_pcrel) + fixP->fx_done = 1; + + if (fixP->fx_bit_fixP || fixP->fx_im_disp != 0) + { + as_bad_where (fixP->fx_file, fixP->fx_line, _("Invalid relocation")); + fixP->fx_done = 1; + } + else + { + /* We can't actually support subtracting a symbol. */ + if (fixP->fx_subsy != (symbolS *) NULL) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("expression too complex")); + + cris_number_to_imm (buf, val, fixP->fx_size, fixP, seg); + } +} + +/* All relocations are relative to the location just after the fixup; + the address of the fixup plus its size. */ + +long +md_pcrel_from (fixP) + fixS *fixP; +{ + valueT addr = fixP->fx_where + fixP->fx_frag->fr_address; + + /* FIXME: We get here only at the end of assembly, when X in ".-X" is + still unknown. Since we don't have pc-relative relocations in a.out, + this is invalid. What to do if anything for a.out, is to add + pc-relative relocations everywhere including the elinux program + loader. For ELF, allow straight-forward PC-relative relocations, + which are always relative to the location after the relocation. */ + if (OUTPUT_FLAVOR != bfd_target_elf_flavour + || (fixP->fx_r_type != BFD_RELOC_8_PCREL + && fixP->fx_r_type != BFD_RELOC_16_PCREL + && fixP->fx_r_type != BFD_RELOC_32_PCREL)) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("Invalid pc-relative relocation")); + return fixP->fx_size + addr; +} + +/* We have no need to give defaults for symbol-values. */ +symbolS * +md_undefined_symbol (name) + char *name ATTRIBUTE_UNUSED; +{ + return 0; +} + +/* If this function returns non-zero, it prevents the relocation + against symbol(s) in the FIXP from being replaced with relocations + against section symbols, and guarantees that a relocation will be + emitted even when the value can be resolved locally. */ +int +md_cris_force_relocation (fixp) + struct fix *fixp; +{ + switch (fixp->fx_r_type) + { + case BFD_RELOC_CRIS_16_GOT: + case BFD_RELOC_CRIS_32_GOT: + case BFD_RELOC_CRIS_16_GOTPLT: + case BFD_RELOC_CRIS_32_GOTPLT: + case BFD_RELOC_CRIS_32_GOTREL: + case BFD_RELOC_CRIS_32_PLT_GOTREL: + case BFD_RELOC_CRIS_32_PLT_PCREL: + return 1; + default: + ; + } + + return generic_force_reloc (fixp); +} + +/* Check and emit error if broken-word handling has failed to fix up a + case-table. This is called from write.c, after doing everything it + knows about how to handle broken words. */ + +void +tc_cris_check_adjusted_broken_word (new_offset, brokwP) + offsetT new_offset; + struct broken_word *brokwP; +{ + if (new_offset > 32767 || new_offset < -32768) + /* We really want a genuine error, not a warning, so make it one. */ + as_bad_where (brokwP->frag->fr_file, brokwP->frag->fr_line, + _("Adjusted signed .word (%ld) overflows: `switch'-statement too large."), + (long) new_offset); +} + +/* Make a leading REGISTER_PREFIX_CHAR mandatory for all registers. */ + +static void cris_force_reg_prefix () +{ + demand_register_prefix = TRUE; +} + +/* Do not demand a leading REGISTER_PREFIX_CHAR for all registers. */ + +static void cris_relax_reg_prefix () +{ + demand_register_prefix = FALSE; +} + +/* Adjust for having a leading '_' on all user symbols. */ + +static void cris_sym_leading_underscore () +{ + /* We can't really do anything more than assert that what the program + thinks symbol starts with agrees with the command-line options, since + the bfd is already created. */ + + if (!symbols_have_leading_underscore) + as_bad (_(".syntax %s requires command-line option `--underscore'"), + SYNTAX_USER_SYM_LEADING_UNDERSCORE); +} + +/* Adjust for not having any particular prefix on user symbols. */ + +static void cris_sym_no_leading_underscore () +{ + if (symbols_have_leading_underscore) + as_bad (_(".syntax %s requires command-line option `--no-underscore'"), + SYNTAX_USER_SYM_NO_LEADING_UNDERSCORE); +} + +/* Handle the .syntax pseudo, which takes an argument that decides what + syntax the assembly code has. */ + +static void +s_syntax (ignore) + int ignore ATTRIBUTE_UNUSED; +{ + static const struct syntaxes + { + const char *operand; + void (*fn) PARAMS ((void)); + } syntax_table[] = + {{SYNTAX_ENFORCE_REG_PREFIX, cris_force_reg_prefix}, + {SYNTAX_RELAX_REG_PREFIX, cris_relax_reg_prefix}, + {SYNTAX_USER_SYM_LEADING_UNDERSCORE, cris_sym_leading_underscore}, + {SYNTAX_USER_SYM_NO_LEADING_UNDERSCORE, cris_sym_no_leading_underscore}}; + + const struct syntaxes *sp; + + for (sp = syntax_table; + sp < syntax_table + sizeof (syntax_table) / sizeof (syntax_table[0]); + sp++) + { + if (strncmp (input_line_pointer, sp->operand, + strlen (sp->operand)) == 0) + { + (sp->fn) (); + + input_line_pointer += strlen (sp->operand); + demand_empty_rest_of_line (); + return; + } + } + + as_bad (_("Unknown .syntax operand")); +} + +/* Wrapper for dwarf2_directive_file to emit error if this is seen when + not emitting ELF. */ + +static void +s_cris_file (dummy) + int dummy; +{ + if (OUTPUT_FLAVOR != bfd_target_elf_flavour) + as_bad (_("Pseudodirective .file is only valid when generating ELF")); + else + dwarf2_directive_file (dummy); +} + +/* Wrapper for dwarf2_directive_loc to emit error if this is seen when not + emitting ELF. */ + +static void +s_cris_loc (dummy) + int dummy; +{ + if (OUTPUT_FLAVOR != bfd_target_elf_flavour) + as_bad (_("Pseudodirective .loc is only valid when generating ELF")); + else + dwarf2_directive_loc (dummy); +} + +/* + * Local variables: + * eval: (c-set-style "gnu") + * indent-tabs-mode: t + * End: + */ diff --git a/gas/config/tc-cris.h b/gas/config/tc-cris.h new file mode 100644 index 0000000000000..9082a62627615 --- /dev/null +++ b/gas/config/tc-cris.h @@ -0,0 +1,170 @@ +/* tc-cris.h -- Header file for tc-cris.c, the CRIS GAS port. + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + + Contributed by Axis Communications AB, Lund, Sweden. + Originally written for GAS 1.38.1 by Mikael Asker. + Updates, BFDizing, GNUifying and ELF by Hans-Peter Nilsson. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +/* See the GAS "internal" document for general documentation on this. + It is called internals.texi (internals.info when makeinfo:d), but is + not installed or makeinfo:d by "make info". */ + +/* Functions and variables that aren't declared in tc.h are declared here, + with the type/prototype that is used in the local extern-declaration of + their usage. */ + +#ifndef TC_CRIS +#define TC_CRIS + +/* Multi-target support is always on. */ +extern const char *cris_target_format PARAMS ((void)); +#define TARGET_FORMAT cris_target_format () + +#define TARGET_ARCH bfd_arch_cris + +#define TARGET_BYTES_BIG_ENDIAN 0 + +extern const char *md_shortopts; +extern struct option md_longopts[]; +extern size_t md_longopts_size; + +extern const pseudo_typeS md_pseudo_table[]; + +#define tc_comment_chars cris_comment_chars +extern const char cris_comment_chars[]; +extern const char line_comment_chars[]; +extern const char line_separator_chars[]; +extern const char EXP_CHARS[]; +extern const char FLT_CHARS[]; + +/* This should be optional, since it is ignored as an escape (assumed to + be itself) if it is not recognized. */ +#define ONLY_STANDARD_ESCAPES + +/* Note that we do not define TC_EQUAL_IN_INSN, since its current use is + in the instruction rather than the operand, and thus does not come to + use for side-effect assignments such as "and.d [r0 = r1 + 42], r3". */ +#define md_operand(x) + +#define md_number_to_chars number_to_chars_littleendian + +extern const int md_short_jump_size; +extern const int md_long_jump_size; + +/* There's no use having different functions for this; the sizes are the + same. Note that we can't #define md_short_jump_size here. */ +#define md_create_short_jump md_create_long_jump + +extern const struct relax_type md_cris_relax_table[]; +#define TC_GENERIC_RELAX_TABLE md_cris_relax_table + +long cris_relax_frag PARAMS ((segT, fragS *, long)); + +/* GAS only handles relaxations for pc-relative data targeting addresses + in the same segment, so we have to handle the rest on our own. */ +#define md_relax_frag(SEG, FRAGP, STRETCH) \ + ((FRAGP)->fr_symbol != NULL \ + && S_GET_SEGMENT ((FRAGP)->fr_symbol) == (SEG) \ + ? relax_frag (SEG, FRAGP, STRETCH) \ + : cris_relax_frag (SEG, FRAGP, STRETCH)) + +#define TC_FORCE_RELOCATION(FIX) md_cris_force_relocation (FIX) +extern int md_cris_force_relocation PARAMS ((struct fix *)); + +#define IS_CRIS_PIC_RELOC(RTYPE) \ + ((RTYPE) == BFD_RELOC_CRIS_16_GOT \ + || (RTYPE) == BFD_RELOC_CRIS_32_GOT \ + || (RTYPE) == BFD_RELOC_CRIS_16_GOTPLT \ + || (RTYPE) == BFD_RELOC_CRIS_32_GOTPLT \ + || (RTYPE) == BFD_RELOC_CRIS_32_GOTREL \ + || (RTYPE) == BFD_RELOC_CRIS_32_PLT_GOTREL \ + || (RTYPE) == BFD_RELOC_CRIS_32_PLT_PCREL) + +/* Make sure we don't resolve fixups for which we want to emit dynamic + relocations. FIXME: Set fx_plt instead of using IS_CRIS_PIC_RELOC. */ +#define TC_FORCE_RELOCATION_LOCAL(FIX) \ + (!(FIX)->fx_pcrel \ + || (FIX)->fx_plt \ + || IS_CRIS_PIC_RELOC ((FIX)->fx_r_type) \ + || TC_FORCE_RELOCATION (FIX)) + +/* For some reloc types, don't adjust fixups by reducing to a section + symbol. */ +#define tc_fix_adjustable(FIX) \ + ((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \ + && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \ + && (! IS_CRIS_PIC_RELOC ((FIX)->fx_r_type) \ + || (FIX)->fx_r_type == BFD_RELOC_CRIS_32_GOTREL)) + +/* When we have fixups against constant expressions, we get a GAS-specific + section symbol at no extra charge for obscure reasons in + adjust_reloc_syms. Since ELF outputs section symbols, it gladly + outputs this "*ABS*" symbol in every object. Avoid that. + Also, don't emit undefined symbols (that aren't used in relocations). + They pop up when tentatively parsing register names as symbols. */ +#define tc_frob_symbol(symp, punt) \ + do { \ + if ((OUTPUT_FLAVOR == bfd_target_elf_flavour \ + && (symp) == section_symbol (absolute_section)) \ + || ! S_IS_DEFINED (symp)) \ + (punt) = 1; \ + } while (0) + +#define LISTING_HEADER "GAS for CRIS" + +#if 0 +/* The testsuite does not let me define these, although they IMHO should + be preferred over the default. */ +#define LISTING_WORD_SIZE 2 +#define LISTING_LHS_WIDTH 4 +#define LISTING_LHS_WIDTH_SECOND 4 +#endif + +/* END of declaration and definitions described in the "internals" + document. */ + +/* Do this, or we will never know what hit us when the + broken-word-fixes break. Do _not_ use WARN_SIGNED_OVERFLOW_WORD, + it is only for use with WORKING_DOT_WORD and warns about most stuff. + (still in 2.9.1). */ +struct broken_word; +extern void tc_cris_check_adjusted_broken_word PARAMS ((offsetT, + struct + broken_word *)); +#define TC_CHECK_ADJUSTED_BROKEN_DOT_WORD(new_offset, brokw) \ + tc_cris_check_adjusted_broken_word ((offsetT) (new_offset), brokw) + +/* We don't want any implicit alignment, so we do nothing. */ +#define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) + +/* CRIS instructions, with operands and prefixes included, are a multiple + of two bytes long. */ +#define DWARF2_LINE_MIN_INSN_LENGTH 2 + +/* Make port immune to unwanted difference in te-generic.h vs. te-linux.h. */ +#define LOCAL_LABELS_DOLLAR 1 + +#endif /* TC_CRIS */ +/* + * Local variables: + * eval: (c-set-style "gnu") + * indent-tabs-mode: t + * End: + */ diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c new file mode 100644 index 0000000000000..639fdc0c9446e --- /dev/null +++ b/gas/config/tc-d10v.c @@ -0,0 +1,1905 @@ +/* tc-d10v.c -- Assembler code for the Mitsubishi D10V + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include "as.h" +#include "safe-ctype.h" +#include "subsegs.h" +#include "opcode/d10v.h" +#include "elf/ppc.h" + +const char comment_chars[] = ";"; +const char line_comment_chars[] = "#"; +const char line_separator_chars[] = ""; +const char *md_shortopts = "O"; +const char EXP_CHARS[] = "eE"; +const char FLT_CHARS[] = "dD"; + +int Optimizing = 0; + +#define AT_WORD_P(X) ((X)->X_op == O_right_shift \ + && (X)->X_op_symbol != NULL \ + && symbol_constant_p ((X)->X_op_symbol) \ + && S_GET_VALUE ((X)->X_op_symbol) == AT_WORD_RIGHT_SHIFT) +#define AT_WORD_RIGHT_SHIFT 2 + +/* Fixups. */ +#define MAX_INSN_FIXUPS (5) +struct d10v_fixup +{ + expressionS exp; + int operand; + int pcrel; + int size; + bfd_reloc_code_real_type reloc; +}; + +typedef struct _fixups +{ + int fc; + struct d10v_fixup fix[MAX_INSN_FIXUPS]; + struct _fixups *next; +} Fixups; + +static Fixups FixUps[2]; +static Fixups *fixups; + +static int do_not_ignore_hash = 0; + +typedef int packing_type; +#define PACK_UNSPEC (0) /* Packing order not specified. */ +#define PACK_PARALLEL (1) /* "||" */ +#define PACK_LEFT_RIGHT (2) /* "->" */ +#define PACK_RIGHT_LEFT (3) /* "<-" */ +static packing_type etype = PACK_UNSPEC; /* Used by d10v_cleanup. */ + +/* TRUE if instruction swapping warnings should be inhibited. + --nowarnswap. */ +static bfd_boolean flag_warn_suppress_instructionswap; + +/* TRUE if instruction packing should be performed when --gstabs is specified. + --gstabs-packing, --no-gstabs-packing. */ +static bfd_boolean flag_allow_gstabs_packing = 1; + +/* Local functions. */ +static int reg_name_search PARAMS ((char *name)); +static int register_name PARAMS ((expressionS *expressionP)); +static int check_range PARAMS ((unsigned long num, int bits, int flags)); +static int postfix PARAMS ((char *p)); +static bfd_reloc_code_real_type get_reloc PARAMS ((struct d10v_operand *op)); +static int get_operands PARAMS ((expressionS exp[])); +static struct d10v_opcode *find_opcode PARAMS ((struct d10v_opcode *opcode, expressionS ops[])); +static unsigned long build_insn PARAMS ((struct d10v_opcode *opcode, expressionS *opers, unsigned long insn)); +static void write_long PARAMS ((unsigned long insn, Fixups *fx)); +static void write_1_short PARAMS ((struct d10v_opcode *opcode, unsigned long insn, Fixups *fx)); +static int write_2_short PARAMS ((struct d10v_opcode *opcode1, unsigned long insn1, + struct d10v_opcode *opcode2, unsigned long insn2, packing_type exec_type, Fixups *fx)); +static unsigned long do_assemble PARAMS ((char *str, struct d10v_opcode **opcode)); +static unsigned long d10v_insert_operand PARAMS (( unsigned long insn, int op_type, + offsetT value, int left, fixS *fix)); +static int parallel_ok PARAMS ((struct d10v_opcode *opcode1, unsigned long insn1, + struct d10v_opcode *opcode2, unsigned long insn2, + packing_type exec_type)); + +static void check_resource_conflict PARAMS ((struct d10v_opcode *opcode1, + unsigned long insn1, + struct d10v_opcode *opcode2, + unsigned long insn2)); + +static symbolS * find_symbol_matching_register PARAMS ((expressionS *)); + +struct option md_longopts[] = +{ +#define OPTION_NOWARNSWAP (OPTION_MD_BASE) + {"nowarnswap", no_argument, NULL, OPTION_NOWARNSWAP}, +#define OPTION_GSTABSPACKING (OPTION_MD_BASE + 1) + {"gstabspacking", no_argument, NULL, OPTION_GSTABSPACKING}, + {"gstabs-packing", no_argument, NULL, OPTION_GSTABSPACKING}, +#define OPTION_NOGSTABSPACKING (OPTION_MD_BASE + 2) + {"nogstabspacking", no_argument, NULL, OPTION_NOGSTABSPACKING}, + {"no-gstabs-packing", no_argument, NULL, OPTION_NOGSTABSPACKING}, + {NULL, no_argument, NULL, 0} +}; + +size_t md_longopts_size = sizeof (md_longopts); + +static void d10v_dot_word PARAMS ((int)); + +/* The target specific pseudo-ops which we support. */ +const pseudo_typeS md_pseudo_table[] = +{ + { "word", d10v_dot_word, 2 }, + { NULL, NULL, 0 } +}; + +/* Opcode hash table. */ +static struct hash_control *d10v_hash; + +/* Do a binary search of the d10v_predefined_registers array to see if + NAME is a valid regiter name. Return the register number from the + array on success, or -1 on failure. */ + +static int +reg_name_search (name) + char *name; +{ + int middle, low, high; + int cmp; + + low = 0; + high = d10v_reg_name_cnt () - 1; + + do + { + middle = (low + high) / 2; + cmp = strcasecmp (name, d10v_predefined_registers[middle].name); + if (cmp < 0) + high = middle - 1; + else if (cmp > 0) + low = middle + 1; + else + return d10v_predefined_registers[middle].value; + } + while (low <= high); + return -1; +} + +/* Check the string at input_line_pointer + to see if it is a valid register name. */ + +static int +register_name (expressionP) + expressionS *expressionP; +{ + int reg_number; + char c, *p = input_line_pointer; + + while (*p + && *p != '\n' && *p != '\r' && *p != ',' && *p != ' ' && *p != ')') + p++; + + c = *p; + if (c) + *p++ = 0; + + /* Look to see if it's in the register table. */ + reg_number = reg_name_search (input_line_pointer); + if (reg_number >= 0) + { + expressionP->X_op = O_register; + /* Temporarily store a pointer to the string here. */ + expressionP->X_op_symbol = (symbolS *) input_line_pointer; + expressionP->X_add_number = reg_number; + input_line_pointer = p; + return 1; + } + if (c) + *(p - 1) = c; + return 0; +} + +static int +check_range (num, bits, flags) + unsigned long num; + int bits; + int flags; +{ + long min, max; + int retval = 0; + + /* Don't bother checking 16-bit values. */ + if (bits == 16) + return 0; + + if (flags & OPERAND_SHIFT) + { + /* All special shift operands are unsigned and <= 16. + We allow 0 for now. */ + if (num > 16) + return 1; + else + return 0; + } + + if (flags & OPERAND_SIGNED) + { + /* Signed 3-bit integers are restricted to the (-2, 3) range. */ + if (flags & RESTRICTED_NUM3) + { + if ((long) num < -2 || (long) num > 3) + retval = 1; + } + else + { + max = (1 << (bits - 1)) - 1; + min = - (1 << (bits - 1)); + if (((long) num > max) || ((long) num < min)) + retval = 1; + } + } + else + { + max = (1 << bits) - 1; + min = 0; + if (((long) num > max) || ((long) num < min)) + retval = 1; + } + return retval; +} + +void +md_show_usage (stream) + FILE *stream; +{ + fprintf (stream, _("D10V options:\n\ +-O Optimize. Will do some operations in parallel.\n\ +--gstabs-packing Pack adjacent short instructions together even\n\ + when --gstabs is specified. On by default.\n\ +--no-gstabs-packing If --gstabs is specified, do not pack adjacent\n\ + instructions together.\n")); +} + +int +md_parse_option (c, arg) + int c; + char *arg ATTRIBUTE_UNUSED; +{ + switch (c) + { + case 'O': + /* Optimize. Will attempt to parallelize operations. */ + Optimizing = 1; + break; + case OPTION_NOWARNSWAP: + flag_warn_suppress_instructionswap = 1; + break; + case OPTION_GSTABSPACKING: + flag_allow_gstabs_packing = 1; + break; + case OPTION_NOGSTABSPACKING: + flag_allow_gstabs_packing = 0; + break; + default: + return 0; + } + return 1; +} + +symbolS * +md_undefined_symbol (name) + char *name ATTRIBUTE_UNUSED; +{ + return 0; +} + +/* Turn a string in input_line_pointer into a floating point constant + of type TYPE, and store the appropriate bytes in *LITP. The number + of LITTLENUMS emitted is stored in *SIZEP. An error message is + returned, or NULL on OK. */ + +char * +md_atof (type, litP, sizeP) + int type; + char *litP; + int *sizeP; +{ + int prec; + LITTLENUM_TYPE words[4]; + char *t; + int i; + + switch (type) + { + case 'f': + prec = 2; + break; + case 'd': + prec = 4; + break; + default: + *sizeP = 0; + return _("bad call to md_atof"); + } + + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + + *sizeP = prec * 2; + + for (i = 0; i < prec; i++) + { + md_number_to_chars (litP, (valueT) words[i], 2); + litP += 2; + } + return NULL; +} + +void +md_convert_frag (abfd, sec, fragP) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + fragS *fragP ATTRIBUTE_UNUSED; +{ + abort (); +} + +valueT +md_section_align (seg, addr) + asection *seg; + valueT addr; +{ + int align = bfd_get_section_alignment (stdoutput, seg); + return ((addr + (1 << align) - 1) & (-1 << align)); +} + +void +md_begin () +{ + char *prev_name = ""; + struct d10v_opcode *opcode; + d10v_hash = hash_new (); + + /* Insert unique names into hash table. The D10v instruction set + has many identical opcode names that have different opcodes based + on the operands. This hash table then provides a quick index to + the first opcode with a particular name in the opcode table. */ + + for (opcode = (struct d10v_opcode *) d10v_opcodes; opcode->name; opcode++) + { + if (strcmp (prev_name, opcode->name)) + { + prev_name = (char *) opcode->name; + hash_insert (d10v_hash, opcode->name, (char *) opcode); + } + } + + fixups = &FixUps[0]; + FixUps[0].next = &FixUps[1]; + FixUps[1].next = &FixUps[0]; +} + +/* Remove the postincrement or postdecrement operator ( '+' or '-' ) + from an expression. */ + +static int +postfix (p) + char *p; +{ + while (*p != '-' && *p != '+') + { + if (*p == 0 || *p == '\n' || *p == '\r') + break; + p++; + } + + if (*p == '-') + { + *p = ' '; + return (-1); + } + if (*p == '+') + { + *p = ' '; + return (1); + } + + return (0); +} + +static bfd_reloc_code_real_type +get_reloc (op) + struct d10v_operand *op; +{ + int bits = op->bits; + + if (bits <= 4) + return (0); + + if (op->flags & OPERAND_ADDR) + { + if (bits == 8) + return (BFD_RELOC_D10V_10_PCREL_R); + else + return (BFD_RELOC_D10V_18_PCREL); + } + + return (BFD_RELOC_16); +} + +/* Parse a string of operands. Return an array of expressions. */ + +static int +get_operands (exp) + expressionS exp[]; +{ + char *p = input_line_pointer; + int numops = 0; + int post = 0; + int uses_at = 0; + + while (*p) + { + while (*p == ' ' || *p == '\t' || *p == ',') + p++; + if (*p == 0 || *p == '\n' || *p == '\r') + break; + + if (*p == '@') + { + uses_at = 1; + + p++; + exp[numops].X_op = O_absent; + if (*p == '(') + { + p++; + exp[numops].X_add_number = OPERAND_ATPAR; + } + else if (*p == '-') + { + p++; + exp[numops].X_add_number = OPERAND_ATMINUS; + } + else + { + exp[numops].X_add_number = OPERAND_ATSIGN; + if (*p == '+') + { + numops++; + exp[numops].X_op = O_absent; + exp[numops].X_add_number = OPERAND_PLUS; + p++; + } + post = postfix (p); + } + numops++; + continue; + } + + if (*p == ')') + { + /* Just skip the trailing paren. */ + p++; + continue; + } + + input_line_pointer = p; + + /* Check to see if it might be a register name. */ + if (!register_name (&exp[numops])) + { + /* Parse as an expression. */ + if (uses_at) + { + /* Any expression that involves the indirect addressing + cannot also involve immediate addressing. Therefore + the use of the hash character is illegal. */ + int save = do_not_ignore_hash; + do_not_ignore_hash = 1; + + expression (&exp[numops]); + + do_not_ignore_hash = save; + } + else + expression (&exp[numops]); + } + + if (strncasecmp (input_line_pointer, "@word", 5) == 0) + { + input_line_pointer += 5; + if (exp[numops].X_op == O_register) + { + /* If it looked like a register name but was followed by + "@word" then it was really a symbol, so change it to + one. */ + exp[numops].X_op = O_symbol; + exp[numops].X_add_symbol = + symbol_find_or_make ((char *) exp[numops].X_op_symbol); + } + + /* Check for identifier@word+constant. */ + if (*input_line_pointer == '-' || *input_line_pointer == '+') + { + expressionS new_exp; + expression (&new_exp); + exp[numops].X_add_number = new_exp.X_add_number; + } + + /* Convert expr into a right shift by AT_WORD_RIGHT_SHIFT. */ + { + expressionS new_exp; + memset (&new_exp, 0, sizeof new_exp); + new_exp.X_add_number = AT_WORD_RIGHT_SHIFT; + new_exp.X_op = O_constant; + new_exp.X_unsigned = 1; + exp[numops].X_op_symbol = make_expr_symbol (&new_exp); + exp[numops].X_op = O_right_shift; + } + + know (AT_WORD_P (&exp[numops])); + } + + if (exp[numops].X_op == O_illegal) + as_bad (_("illegal operand")); + else if (exp[numops].X_op == O_absent) + as_bad (_("missing operand")); + + numops++; + p = input_line_pointer; + } + + switch (post) + { + case -1: /* Postdecrement mode. */ + exp[numops].X_op = O_absent; + exp[numops++].X_add_number = OPERAND_MINUS; + break; + case 1: /* Postincrement mode. */ + exp[numops].X_op = O_absent; + exp[numops++].X_add_number = OPERAND_PLUS; + break; + } + + exp[numops].X_op = 0; + return (numops); +} + +static unsigned long +d10v_insert_operand (insn, op_type, value, left, fix) + unsigned long insn; + int op_type; + offsetT value; + int left; + fixS *fix; +{ + int shift, bits; + + shift = d10v_operands[op_type].shift; + if (left) + shift += 15; + + bits = d10v_operands[op_type].bits; + + /* Truncate to the proper number of bits. */ + if (check_range (value, bits, d10v_operands[op_type].flags)) + as_bad_where (fix->fx_file, fix->fx_line, + _("operand out of range: %ld"), (long) value); + + value &= 0x7FFFFFFF >> (31 - bits); + insn |= (value << shift); + + return insn; +} + +/* Take a pointer to the opcode entry in the opcode table and the + array of operand expressions. Return the instruction. */ + +static unsigned long +build_insn (opcode, opers, insn) + struct d10v_opcode *opcode; + expressionS *opers; + unsigned long insn; +{ + int i, bits, shift, flags, format; + unsigned long number; + + /* The insn argument is only used for the DIVS kludge. */ + if (insn) + format = LONG_R; + else + { + insn = opcode->opcode; + format = opcode->format; + } + + for (i = 0; opcode->operands[i]; i++) + { + flags = d10v_operands[opcode->operands[i]].flags; + bits = d10v_operands[opcode->operands[i]].bits; + shift = d10v_operands[opcode->operands[i]].shift; + number = opers[i].X_add_number; + + if (flags & OPERAND_REG) + { + number &= REGISTER_MASK; + if (format == LONG_L) + shift += 15; + } + + if (opers[i].X_op != O_register && opers[i].X_op != O_constant) + { + /* Now create a fixup. */ + + if (fixups->fc >= MAX_INSN_FIXUPS) + as_fatal (_("too many fixups")); + + if (AT_WORD_P (&opers[i])) + { + /* Recognize XXX>>1+N aka XXX@word+N as special (AT_WORD). */ + fixups->fix[fixups->fc].reloc = BFD_RELOC_D10V_18; + opers[i].X_op = O_symbol; + opers[i].X_op_symbol = NULL; /* Should free it. */ + /* number is left shifted by AT_WORD_RIGHT_SHIFT so + that, it is aligned with the symbol's value. Later, + BFD_RELOC_D10V_18 will right shift (symbol_value + + X_add_number). */ + number <<= AT_WORD_RIGHT_SHIFT; + opers[i].X_add_number = number; + } + else + { + fixups->fix[fixups->fc].reloc = + get_reloc ((struct d10v_operand *) &d10v_operands[opcode->operands[i]]); + + /* Check that an immediate was passed to ops that expect one. */ + if ((flags & OPERAND_NUM) + && (fixups->fix[fixups->fc].reloc == 0)) + as_bad (_("operand is not an immediate")); + } + + if (fixups->fix[fixups->fc].reloc == BFD_RELOC_16 || + fixups->fix[fixups->fc].reloc == BFD_RELOC_D10V_18) + fixups->fix[fixups->fc].size = 2; + else + fixups->fix[fixups->fc].size = 4; + + fixups->fix[fixups->fc].exp = opers[i]; + fixups->fix[fixups->fc].operand = opcode->operands[i]; + fixups->fix[fixups->fc].pcrel = + (flags & OPERAND_ADDR) ? TRUE : FALSE; + (fixups->fc)++; + } + + /* Truncate to the proper number of bits. */ + if ((opers[i].X_op == O_constant) && check_range (number, bits, flags)) + as_bad (_("operand out of range: %lu"), number); + number &= 0x7FFFFFFF >> (31 - bits); + insn = insn | (number << shift); + } + + /* kludge: for DIVS, we need to put the operands in twice on the second + pass, format is changed to LONG_R to force the second set of operands + to not be shifted over 15. */ + if ((opcode->opcode == OPCODE_DIVS) && (format == LONG_L)) + insn = build_insn (opcode, opers, insn); + + return insn; +} + +/* Write out a long form instruction. */ + +static void +write_long (insn, fx) + unsigned long insn; + Fixups *fx; +{ + int i, where; + char *f = frag_more (4); + + insn |= FM11; + number_to_chars_bigendian (f, insn, 4); + + for (i = 0; i < fx->fc; i++) + { + if (fx->fix[i].reloc) + { + where = f - frag_now->fr_literal; + if (fx->fix[i].size == 2) + where += 2; + + if (fx->fix[i].reloc == BFD_RELOC_D10V_18) + fx->fix[i].operand |= 4096; + + fix_new_exp (frag_now, + where, + fx->fix[i].size, + &(fx->fix[i].exp), + fx->fix[i].pcrel, + fx->fix[i].operand|2048); + } + } + fx->fc = 0; +} + +/* Write out a short form instruction by itself. */ + +static void +write_1_short (opcode, insn, fx) + struct d10v_opcode *opcode; + unsigned long insn; + Fixups *fx; +{ + char *f = frag_more (4); + int i, where; + + if (opcode->exec_type & PARONLY) + as_fatal (_("Instruction must be executed in parallel with another instruction.")); + + /* The other container needs to be NOP. + According to 4.3.1: for FM=00, sub-instructions performed only by IU + cannot be encoded in L-container. */ + if (opcode->unit == IU) + insn |= FM00 | (NOP << 15); /* Right container. */ + else + insn = FM00 | (insn << 15) | NOP; /* Left container. */ + + number_to_chars_bigendian (f, insn, 4); + for (i = 0; i < fx->fc; i++) + { + if (fx->fix[i].reloc) + { + where = f - frag_now->fr_literal; + if (fx->fix[i].size == 2) + where += 2; + + if (fx->fix[i].reloc == BFD_RELOC_D10V_18) + fx->fix[i].operand |= 4096; + + /* If it's an R reloc, we may have to switch it to L. */ + if ((fx->fix[i].reloc == BFD_RELOC_D10V_10_PCREL_R) + && (opcode->unit != IU)) + fx->fix[i].operand |= 1024; + + fix_new_exp (frag_now, + where, + fx->fix[i].size, + &(fx->fix[i].exp), + fx->fix[i].pcrel, + fx->fix[i].operand|2048); + } + } + fx->fc = 0; +} + +/* Expects two short instructions. + If possible, writes out both as a single packed instruction. + Otherwise, writes out the first one, packed with a NOP. + Returns number of instructions not written out. */ + +static int +write_2_short (opcode1, insn1, opcode2, insn2, exec_type, fx) + struct d10v_opcode *opcode1, *opcode2; + unsigned long insn1, insn2; + packing_type exec_type; + Fixups *fx; +{ + unsigned long insn; + char *f; + int i, j, where; + + if ((exec_type != PACK_PARALLEL) + && ((opcode1->exec_type & PARONLY) || (opcode2->exec_type & PARONLY))) + as_fatal (_("Instruction must be executed in parallel")); + + if ((opcode1->format & LONG_OPCODE) || (opcode2->format & LONG_OPCODE)) + as_fatal (_("Long instructions may not be combined.")); + + switch (exec_type) + { + case PACK_UNSPEC: /* Order not specified. */ + if (opcode1->exec_type & ALONE) + { + /* Case of a short branch on a separate GAS line. Pack with NOP. */ + write_1_short (opcode1, insn1, fx->next); + return 1; + } + if (Optimizing + && parallel_ok (opcode1, insn1, opcode2, insn2, exec_type)) + { + /* Parallel. */ + if (opcode1->unit == IU) + insn = FM00 | (insn2 << 15) | insn1; + else if (opcode2->unit == MU) + insn = FM00 | (insn2 << 15) | insn1; + else + insn = FM00 | (insn1 << 15) | insn2; + } + else if (opcode1->unit == IU) + /* Reverse sequential with IU opcode1 on right and done first. */ + insn = FM10 | (insn2 << 15) | insn1; + else + /* Sequential with non-IU opcode1 on left and done first. */ + insn = FM01 | (insn1 << 15) | insn2; + break; + + case PACK_PARALLEL: + if (opcode1->exec_type & SEQ || opcode2->exec_type & SEQ) + as_fatal + (_("One of these instructions may not be executed in parallel.")); + if (opcode1->unit == IU) + { + if (opcode2->unit == IU) + as_fatal (_("Two IU instructions may not be executed in parallel")); + if (!flag_warn_suppress_instructionswap) + as_warn (_("Swapping instruction order")); + insn = FM00 | (insn2 << 15) | insn1; + } + else if (opcode2->unit == MU) + { + if (opcode1->unit == MU) + as_fatal (_("Two MU instructions may not be executed in parallel")); + if (!flag_warn_suppress_instructionswap) + as_warn (_("Swapping instruction order")); + insn = FM00 | (insn2 << 15) | insn1; + } + else + insn = FM00 | (insn1 << 15) | insn2; + check_resource_conflict (opcode1, insn1, opcode2, insn2); + break; + + case PACK_LEFT_RIGHT: + if (opcode1->unit != IU) + insn = FM01 | (insn1 << 15) | insn2; + else if (opcode2->unit == MU || opcode2->unit == EITHER) + { + if (!flag_warn_suppress_instructionswap) + as_warn (_("Swapping instruction order")); + insn = FM10 | (insn2 << 15) | insn1; + } + else + as_fatal (_("IU instruction may not be in the left container")); + if (opcode1->exec_type & ALONE) + as_warn (_("Instruction in R container is squashed by flow control instruction in L container.")); + break; + + case PACK_RIGHT_LEFT: + if (opcode2->unit != MU) + insn = FM10 | (insn1 << 15) | insn2; + else if (opcode1->unit == IU || opcode1->unit == EITHER) + { + if (!flag_warn_suppress_instructionswap) + as_warn (_("Swapping instruction order")); + insn = FM01 | (insn2 << 15) | insn1; + } + else + as_fatal (_("MU instruction may not be in the right container")); + if (opcode2->exec_type & ALONE) + as_warn (_("Instruction in R container is squashed by flow control instruction in L container.")); + break; + + default: + as_fatal (_("unknown execution type passed to write_2_short()")); + } + + f = frag_more (4); + number_to_chars_bigendian (f, insn, 4); + + /* Process fixup chains. fx refers to insn2 when j == 0, and to + insn1 when j == 1. Yes, it's reversed. */ + + for (j = 0; j < 2; j++) + { + for (i = 0; i < fx->fc; i++) + { + if (fx->fix[i].reloc) + { + where = f - frag_now->fr_literal; + if (fx->fix[i].size == 2) + where += 2; + + if (fx->fix[i].reloc == BFD_RELOC_D10V_10_PCREL_R + /* A BFD_RELOC_D10V_10_PCREL_R relocation applied to + the instruction in the L container has to be + adjusted to BDF_RELOC_D10V_10_PCREL_L. When + j==0, we're processing insn2's operands, so we + want to mark the operand if insn2 is *not* in the + R container. When j==1, we're processing insn1's + operands, so we want to mark the operand if insn2 + *is* in the R container. Note that, if two + instructions are identical, we're never going to + swap them, so the test is safe. */ + && j == ((insn & 0x7fff) == insn2)) + fx->fix[i].operand |= 1024; + + if (fx->fix[i].reloc == BFD_RELOC_D10V_18) + fx->fix[i].operand |= 4096; + + fix_new_exp (frag_now, + where, + fx->fix[i].size, + &(fx->fix[i].exp), + fx->fix[i].pcrel, + fx->fix[i].operand|2048); + } + } + fx->fc = 0; + fx = fx->next; + } + return (0); +} + +/* Check 2 instructions and determine if they can be safely + executed in parallel. Return 1 if they can be. */ + +static int +parallel_ok (op1, insn1, op2, insn2, exec_type) + struct d10v_opcode *op1, *op2; + unsigned long insn1, insn2; + packing_type exec_type; +{ + int i, j, flags, mask, shift, regno; + unsigned long ins, mod[2], used[2]; + struct d10v_opcode *op; + + if ((op1->exec_type & SEQ) != 0 || (op2->exec_type & SEQ) != 0 + || (op1->exec_type & PAR) == 0 || (op2->exec_type & PAR) == 0 + || (op1->unit == BOTH) || (op2->unit == BOTH) + || (op1->unit == IU && op2->unit == IU) + || (op1->unit == MU && op2->unit == MU)) + return 0; + + /* If this is auto parallelization, and the first instruction is a + branch or should not be packed, then don't parallelize. */ + if (exec_type == PACK_UNSPEC + && (op1->exec_type & (ALONE | BRANCH))) + return 0; + + /* The idea here is to create two sets of bitmasks (mod and used) + which indicate which registers are modified or used by each + instruction. The operation can only be done in parallel if + instruction 1 and instruction 2 modify different registers, and + the first instruction does not modify registers that the second + is using (The second instruction can modify registers that the + first is using as they are only written back after the first + instruction has completed). Accesses to control registers, PSW, + and memory are treated as accesses to a single register. So if + both instructions write memory or if the first instruction writes + memory and the second reads, then they cannot be done in + parallel. Likewise, if the first instruction mucks with the psw + and the second reads the PSW (which includes C, F0, and F1), then + they cannot operate safely in parallel. */ + + /* The bitmasks (mod and used) look like this (bit 31 = MSB). + r0-r15 0-15 + a0-a1 16-17 + cr (not psw) 18 + psw 19 + mem 20 */ + + for (j = 0; j < 2; j++) + { + if (j == 0) + { + op = op1; + ins = insn1; + } + else + { + op = op2; + ins = insn2; + } + mod[j] = used[j] = 0; + if (op->exec_type & BRANCH_LINK) + mod[j] |= 1 << 13; + + for (i = 0; op->operands[i]; i++) + { + flags = d10v_operands[op->operands[i]].flags; + shift = d10v_operands[op->operands[i]].shift; + mask = 0x7FFFFFFF >> (31 - d10v_operands[op->operands[i]].bits); + if (flags & OPERAND_REG) + { + regno = (ins >> shift) & mask; + if (flags & (OPERAND_ACC0 | OPERAND_ACC1)) + regno += 16; + else if (flags & OPERAND_CONTROL) /* mvtc or mvfc. */ + { + if (regno == 0) + regno = 19; + else + regno = 18; + } + else if (flags & (OPERAND_FFLAG | OPERAND_CFLAG)) + regno = 19; + + if (flags & OPERAND_DEST) + { + mod[j] |= 1 << regno; + if (flags & OPERAND_EVEN) + mod[j] |= 1 << (regno + 1); + } + else + { + used[j] |= 1 << regno; + if (flags & OPERAND_EVEN) + used[j] |= 1 << (regno + 1); + + /* Auto inc/dec also modifies the register. */ + if (op->operands[i + 1] != 0 + && (d10v_operands[op->operands[i + 1]].flags + & (OPERAND_PLUS | OPERAND_MINUS)) != 0) + mod[j] |= 1 << regno; + } + } + else if (flags & OPERAND_ATMINUS) + { + /* SP implicitly used/modified. */ + mod[j] |= 1 << 15; + used[j] |= 1 << 15; + } + } + if (op->exec_type & RMEM) + used[j] |= 1 << 20; + else if (op->exec_type & WMEM) + mod[j] |= 1 << 20; + else if (op->exec_type & RF0) + used[j] |= 1 << 19; + else if (op->exec_type & WF0) + mod[j] |= 1 << 19; + else if (op->exec_type & WCAR) + mod[j] |= 1 << 19; + } + if ((mod[0] & mod[1]) == 0 && (mod[0] & used[1]) == 0) + return 1; + return 0; +} + +/* Determine if there are any resource conflicts among two manually + parallelized instructions. Some of this was lifted from parallel_ok. */ + +static void +check_resource_conflict (op1, insn1, op2, insn2) + struct d10v_opcode *op1, *op2; + unsigned long insn1, insn2; +{ + int i, j, flags, mask, shift, regno; + unsigned long ins, mod[2]; + struct d10v_opcode *op; + + if ((op1->exec_type & SEQ) + || ! ((op1->exec_type & PAR) || (op1->exec_type & PARONLY))) + { + as_warn (_("packing conflict: %s must dispatch sequentially"), + op1->name); + return; + } + + if ((op2->exec_type & SEQ) + || ! ((op2->exec_type & PAR) || (op2->exec_type & PARONLY))) + { + as_warn (_("packing conflict: %s must dispatch sequentially"), + op2->name); + return; + } + + /* See if both instructions write to the same resource. + + The idea here is to create two sets of bitmasks (mod and used) which + indicate which registers are modified or used by each instruction. + The operation can only be done in parallel if neither instruction + modifies the same register. Accesses to control registers and memory + are treated as accesses to a single register. So if both instructions + write memory or if the first instruction writes memory and the second + reads, then they cannot be done in parallel. We treat reads to the PSW + (which includes C, F0, and F1) in isolation. So simultaneously writing + C and F0 in two different sub-instructions is permitted. */ + + /* The bitmasks (mod and used) look like this (bit 31 = MSB). + r0-r15 0-15 + a0-a1 16-17 + cr (not psw) 18 + psw(other) 19 + mem 20 + psw(C flag) 21 + psw(F0 flag) 22 */ + + for (j = 0; j < 2; j++) + { + if (j == 0) + { + op = op1; + ins = insn1; + } + else + { + op = op2; + ins = insn2; + } + mod[j] = 0; + if (op->exec_type & BRANCH_LINK) + mod[j] |= 1 << 13; + + for (i = 0; op->operands[i]; i++) + { + flags = d10v_operands[op->operands[i]].flags; + shift = d10v_operands[op->operands[i]].shift; + mask = 0x7FFFFFFF >> (31 - d10v_operands[op->operands[i]].bits); + if (flags & OPERAND_REG) + { + regno = (ins >> shift) & mask; + if (flags & (OPERAND_ACC0 | OPERAND_ACC1)) + regno += 16; + else if (flags & OPERAND_CONTROL) /* mvtc or mvfc */ + { + if (regno == 0) + regno = 19; + else + regno = 18; + } + else if (flags & OPERAND_FFLAG) + regno = 22; + else if (flags & OPERAND_CFLAG) + regno = 21; + + if (flags & OPERAND_DEST + /* Auto inc/dec also modifies the register. */ + || (op->operands[i + 1] != 0 + && (d10v_operands[op->operands[i + 1]].flags + & (OPERAND_PLUS | OPERAND_MINUS)) != 0)) + { + mod[j] |= 1 << regno; + if (flags & OPERAND_EVEN) + mod[j] |= 1 << (regno + 1); + } + } + else if (flags & OPERAND_ATMINUS) + { + /* SP implicitly used/modified. */ + mod[j] |= 1 << 15; + } + } + + if (op->exec_type & WMEM) + mod[j] |= 1 << 20; + else if (op->exec_type & WF0) + mod[j] |= 1 << 22; + else if (op->exec_type & WCAR) + mod[j] |= 1 << 21; + } + + if ((mod[0] & mod[1]) == 0) + return; + else + { + unsigned long x; + x = mod[0] & mod[1]; + + for (j = 0; j <= 15; j++) + if (x & (1 << j)) + as_warn (_("resource conflict (R%d)"), j); + for (j = 16; j <= 17; j++) + if (x & (1 << j)) + as_warn (_("resource conflict (A%d)"), j - 16); + if (x & (1 << 19)) + as_warn (_("resource conflict (PSW)")); + if (x & (1 << 21)) + as_warn (_("resource conflict (C flag)")); + if (x & (1 << 22)) + as_warn (_("resource conflict (F flag)")); + } +} + +/* This is the main entry point for the machine-dependent assembler. + str points to a machine-dependent instruction. This function is + supposed to emit the frags/bytes it assembles to. For the D10V, it + mostly handles the special VLIW parsing and packing and leaves the + difficult stuff to do_assemble(). */ + +static unsigned long prev_insn; +static struct d10v_opcode *prev_opcode = 0; +static subsegT prev_subseg; +static segT prev_seg = 0;; + +void +md_assemble (str) + char *str; +{ + /* etype is saved extype. For multi-line instructions. */ + + packing_type extype = PACK_UNSPEC; /* Parallel, etc. */ + + struct d10v_opcode *opcode; + unsigned long insn; + char *str2; + + if (etype == PACK_UNSPEC) + { + /* Look for the special multiple instruction separators. */ + str2 = strstr (str, "||"); + if (str2) + extype = PACK_PARALLEL; + else + { + str2 = strstr (str, "->"); + if (str2) + extype = PACK_LEFT_RIGHT; + else + { + str2 = strstr (str, "<-"); + if (str2) + extype = PACK_RIGHT_LEFT; + } + } + + /* str2 points to the separator, if there is one. */ + if (str2) + { + *str2 = 0; + + /* If two instructions are present and we already have one saved, + then first write out the saved one. */ + d10v_cleanup (); + + /* Assemble first instruction and save it. */ + prev_insn = do_assemble (str, &prev_opcode); + prev_seg = now_seg; + prev_subseg = now_subseg; + if (prev_insn == (unsigned long) -1) + as_fatal (_("can't find opcode ")); + fixups = fixups->next; + str = str2 + 2; + } + } + + insn = do_assemble (str, &opcode); + if (insn == (unsigned long) -1) + { + if (extype != PACK_UNSPEC) + { + etype = extype; + return; + } + as_fatal (_("can't find opcode ")); + } + + if (etype != PACK_UNSPEC) + { + extype = etype; + etype = PACK_UNSPEC; + } + + /* If this is a long instruction, write it and any previous short + instruction. */ + if (opcode->format & LONG_OPCODE) + { + if (extype != PACK_UNSPEC) + as_fatal (_("Unable to mix instructions as specified")); + d10v_cleanup (); + write_long (insn, fixups); + prev_opcode = NULL; + return; + } + + if (prev_opcode + && prev_seg + && ((prev_seg != now_seg) || (prev_subseg != now_subseg))) + d10v_cleanup (); + + if (prev_opcode + && (0 == write_2_short (prev_opcode, prev_insn, opcode, insn, extype, + fixups))) + { + /* No instructions saved. */ + prev_opcode = NULL; + } + else + { + if (extype != PACK_UNSPEC) + as_fatal (_("Unable to mix instructions as specified")); + /* Save last instruction so it may be packed on next pass. */ + prev_opcode = opcode; + prev_insn = insn; + prev_seg = now_seg; + prev_subseg = now_subseg; + fixups = fixups->next; + } +} + +/* Assemble a single instruction. + Return an opcode, or -1 (an invalid opcode) on error. */ + +static unsigned long +do_assemble (str, opcode) + char *str; + struct d10v_opcode **opcode; +{ + unsigned char *op_start, *save; + unsigned char *op_end; + char name[20]; + int nlen = 0; + expressionS myops[6]; + unsigned long insn; + + /* Drop leading whitespace. */ + while (*str == ' ') + str++; + + /* Find the opcode end. */ + for (op_start = op_end = (unsigned char *) (str); + *op_end + && nlen < 20 + && !is_end_of_line[*op_end] && *op_end != ' '; + op_end++) + { + name[nlen] = TOLOWER (op_start[nlen]); + nlen++; + } + name[nlen] = 0; + + if (nlen == 0) + return -1; + + /* Find the first opcode with the proper name. */ + *opcode = (struct d10v_opcode *) hash_find (d10v_hash, name); + if (*opcode == NULL) + as_fatal (_("unknown opcode: %s"), name); + + save = input_line_pointer; + input_line_pointer = op_end; + *opcode = find_opcode (*opcode, myops); + if (*opcode == 0) + return -1; + input_line_pointer = save; + + insn = build_insn ((*opcode), myops, 0); + return (insn); +} + +/* Find the symbol which has the same name as the register in exp. */ + +static symbolS * +find_symbol_matching_register (exp) + expressionS *exp; +{ + int i; + + if (exp->X_op != O_register) + return NULL; + + /* Find the name of the register. */ + for (i = d10v_reg_name_cnt (); i--;) + if (d10v_predefined_registers[i].value == exp->X_add_number) + break; + + if (i < 0) + abort (); + + /* Now see if a symbol has been defined with the same name. */ + return symbol_find (d10v_predefined_registers[i].name); +} + +/* Get a pointer to an entry in the opcode table. + The function must look at all opcodes with the same name and use + the operands to choose the correct opcode. */ + +static struct d10v_opcode * +find_opcode (opcode, myops) + struct d10v_opcode *opcode; + expressionS myops[]; +{ + int i, match; + struct d10v_opcode *next_opcode; + + /* Get all the operands and save them as expressions. */ + get_operands (myops); + + /* Now see if the operand is a fake. If so, find the correct size + instruction, if possible. */ + if (opcode->format == OPCODE_FAKE) + { + int opnum = opcode->operands[0]; + int flags; + + if (myops[opnum].X_op == O_register) + { + myops[opnum].X_op = O_symbol; + myops[opnum].X_add_symbol = + symbol_find_or_make ((char *) myops[opnum].X_op_symbol); + myops[opnum].X_add_number = 0; + myops[opnum].X_op_symbol = NULL; + } + + next_opcode = opcode + 1; + + /* If the first operand is supposed to be a register, make sure + we got a valid one. */ + flags = d10v_operands[next_opcode->operands[0]].flags; + if (flags & OPERAND_REG) + { + int X_op = myops[0].X_op; + int num = myops[0].X_add_number; + + if (X_op != O_register + || (num & ~flags + & (OPERAND_GPR | OPERAND_ACC0 | OPERAND_ACC1 + | OPERAND_FFLAG | OPERAND_CFLAG | OPERAND_CONTROL)) + || ((flags & OPERAND_SP) && ! (num & OPERAND_SP))) + { + as_bad (_("bad opcode or operands")); + return 0; + } + } + + if (myops[opnum].X_op == O_constant + || (myops[opnum].X_op == O_symbol + && S_IS_DEFINED (myops[opnum].X_add_symbol) + && (S_GET_SEGMENT (myops[opnum].X_add_symbol) == now_seg))) + { + for (i = 0; opcode->operands[i + 1]; i++) + { + int bits = d10v_operands[next_opcode->operands[opnum]].bits; + int flags = d10v_operands[next_opcode->operands[opnum]].flags; + if (flags & OPERAND_ADDR) + bits += 2; + + if (myops[opnum].X_op == O_constant) + { + if (!check_range (myops[opnum].X_add_number, bits, flags)) + break; + } + else + { + fragS *sym_frag; + fragS *f; + unsigned long current_position; + unsigned long symbol_position; + unsigned long value; + bfd_boolean found_symbol; + + /* Calculate the address of the current instruction + and the address of the symbol. Do this by summing + the offsets of previous frags until we reach the + frag containing the symbol, and the current frag. */ + sym_frag = symbol_get_frag (myops[opnum].X_add_symbol); + found_symbol = FALSE; + + current_position = + obstack_next_free (&frchain_now->frch_obstack) + - frag_now->fr_literal; + symbol_position = S_GET_VALUE (myops[opnum].X_add_symbol); + + for (f = frchain_now->frch_root; f; f = f->fr_next) + { + current_position += f->fr_fix + f->fr_offset; + + if (f == sym_frag) + found_symbol = TRUE; + + if (! found_symbol) + symbol_position += f->fr_fix + f->fr_offset; + } + + value = symbol_position; + + if (flags & OPERAND_ADDR) + value -= current_position; + + if (AT_WORD_P (&myops[opnum])) + { + if (bits > 4) + { + bits += 2; + if (!check_range (value, bits, flags)) + break; + } + } + else if (!check_range (value, bits, flags)) + break; + } + next_opcode++; + } + + if (opcode->operands [i + 1] == 0) + as_fatal (_("value out of range")); + else + opcode = next_opcode; + } + else + { + /* Not a constant, so use a long instruction. */ + opcode += 2; + } + } + + match = 0; + + /* Now search the opcode table table for one with operands + that matches what we've got. */ + while (!match) + { + match = 1; + for (i = 0; opcode->operands[i]; i++) + { + int flags = d10v_operands[opcode->operands[i]].flags; + int X_op = myops[i].X_op; + int num = myops[i].X_add_number; + + if (X_op == 0) + { + match = 0; + break; + } + + if (flags & OPERAND_REG) + { + if ((X_op != O_register) + || (num & ~flags + & (OPERAND_GPR | OPERAND_ACC0 | OPERAND_ACC1 + | OPERAND_FFLAG | OPERAND_CFLAG + | OPERAND_CONTROL)) + || ((flags & OPERAND_SP) && ! (num & OPERAND_SP))) + { + match = 0; + break; + } + } + + if (((flags & OPERAND_MINUS) && ((X_op != O_absent) || (num != OPERAND_MINUS))) || + ((flags & OPERAND_PLUS) && ((X_op != O_absent) || (num != OPERAND_PLUS))) || + ((flags & OPERAND_ATMINUS) && ((X_op != O_absent) || (num != OPERAND_ATMINUS))) || + ((flags & OPERAND_ATPAR) && ((X_op != O_absent) || (num != OPERAND_ATPAR))) || + ((flags & OPERAND_ATSIGN) && ((X_op != O_absent) || ((num != OPERAND_ATSIGN) && (num != OPERAND_ATPAR))))) + { + match = 0; + break; + } + + /* Unfortunately, for the indirect operand in instructions such + as ``ldb r1, @(c,r14)'' this function can be passed + X_op == O_register (because 'c' is a valid register name). + However we cannot just ignore the case when X_op == O_register + but flags & OPERAND_REG is null, so we check to see if a symbol + of the same name as the register exists. If the symbol does + exist, then the parser was unable to distinguish the two cases + and we fix things here. (Ref: PR14826) */ + + if (!(flags & OPERAND_REG) && (X_op == O_register)) + { + symbolS * sym; + + sym = find_symbol_matching_register (& myops[i]); + + if (sym != NULL) + { + myops[i].X_op = X_op = O_symbol; + myops[i].X_add_symbol = sym; + } + else + as_bad + (_("illegal operand - register name found where none expected")); + } + } + + /* We're only done if the operands matched so far AND there + are no more to check. */ + if (match && myops[i].X_op == 0) + break; + else + match = 0; + + next_opcode = opcode + 1; + + if (next_opcode->opcode == 0) + break; + + if (strcmp (next_opcode->name, opcode->name)) + break; + + opcode = next_opcode; + } + + if (!match) + { + as_bad (_("bad opcode or operands")); + return (0); + } + + /* Check that all registers that are required to be even are. + Also, if any operands were marked as registers, but were really symbols, + fix that here. */ + for (i = 0; opcode->operands[i]; i++) + { + if ((d10v_operands[opcode->operands[i]].flags & OPERAND_EVEN) && + (myops[i].X_add_number & 1)) + as_fatal (_("Register number must be EVEN")); + if ((d10v_operands[opcode->operands[i]].flags & OPERAND_NOSP) + && (myops[i].X_add_number & OPERAND_SP)) + as_bad (_("Unsupported use of sp")); + if (myops[i].X_op == O_register) + { + if (!(d10v_operands[opcode->operands[i]].flags & OPERAND_REG)) + { + myops[i].X_op = O_symbol; + myops[i].X_add_symbol = + symbol_find_or_make ((char *) myops[i].X_op_symbol); + myops[i].X_add_number = 0; + myops[i].X_op_symbol = NULL; + } + } + if ((d10v_operands[opcode->operands[i]].flags & OPERAND_CONTROL) + && (myops[i].X_add_number == OPERAND_CONTROL + 4 + || myops[i].X_add_number == OPERAND_CONTROL + 5 + || myops[i].X_add_number == OPERAND_CONTROL + 6 + || myops[i].X_add_number == OPERAND_CONTROL + 12 + || myops[i].X_add_number == OPERAND_CONTROL + 13 + || myops[i].X_add_number == OPERAND_CONTROL + 15)) + as_warn (_("cr%ld is a reserved control register"), + myops[i].X_add_number - OPERAND_CONTROL); + } + return opcode; +} + +/* If while processing a fixup, a reloc really needs to be created. + Then it is done here. */ + +arelent * +tc_gen_reloc (seg, fixp) + asection *seg ATTRIBUTE_UNUSED; + fixS *fixp; +{ + arelent *reloc; + reloc = (arelent *) xmalloc (sizeof (arelent)); + reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); + *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); + if (reloc->howto == (reloc_howto_type *) NULL) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + _("reloc %d not supported by object file format"), + (int) fixp->fx_r_type); + return NULL; + } + + if (fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY) + reloc->address = fixp->fx_offset; + + reloc->addend = 0; + + return reloc; +} + +int +md_estimate_size_before_relax (fragp, seg) + fragS *fragp ATTRIBUTE_UNUSED; + asection *seg ATTRIBUTE_UNUSED; +{ + abort (); + return 0; +} + +long +md_pcrel_from_section (fixp, sec) + fixS *fixp; + segT sec; +{ + if (fixp->fx_addsy != (symbolS *) NULL + && (!S_IS_DEFINED (fixp->fx_addsy) + || (S_GET_SEGMENT (fixp->fx_addsy) != sec))) + return 0; + return fixp->fx_frag->fr_address + fixp->fx_where; +} + +void +md_apply_fix3 (fixP, valP, seg) + fixS *fixP; + valueT *valP; + segT seg ATTRIBUTE_UNUSED; +{ + char *where; + unsigned long insn; + long value = *valP; + int op_type; + int left = 0; + + if (fixP->fx_addsy == (symbolS *) NULL) + fixP->fx_done = 1; + + /* We don't actually support subtracting a symbol. */ + if (fixP->fx_subsy != (symbolS *) NULL) + as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex")); + + op_type = fixP->fx_r_type; + if (op_type & 2048) + { + op_type -= 2048; + if (op_type & 1024) + { + op_type -= 1024; + fixP->fx_r_type = BFD_RELOC_D10V_10_PCREL_L; + left = 1; + } + else if (op_type & 4096) + { + op_type -= 4096; + fixP->fx_r_type = BFD_RELOC_D10V_18; + } + else + fixP->fx_r_type = + get_reloc ((struct d10v_operand *) &d10v_operands[op_type]); + } + + /* Fetch the instruction, insert the fully resolved operand + value, and stuff the instruction back again. */ + where = fixP->fx_frag->fr_literal + fixP->fx_where; + insn = bfd_getb32 ((unsigned char *) where); + + switch (fixP->fx_r_type) + { + case BFD_RELOC_D10V_10_PCREL_L: + case BFD_RELOC_D10V_10_PCREL_R: + case BFD_RELOC_D10V_18_PCREL: + /* If the fix is relative to a global symbol, not a section + symbol, then ignore the offset. + XXX - Do we have to worry about branches to a symbol + offset ? */ + if (fixP->fx_addsy != NULL + && S_IS_EXTERN (fixP->fx_addsy) ) + { + segT fseg = S_GET_SEGMENT (fixP->fx_addsy); + segment_info_type *segf = seg_info(fseg); + + if ( segf && segf->sym != fixP->fx_addsy) + value = 0; + } + /* Drop through. */ + case BFD_RELOC_D10V_18: + /* Instruction addresses are always right-shifted by 2. */ + value >>= AT_WORD_RIGHT_SHIFT; + if (fixP->fx_size == 2) + bfd_putb16 ((bfd_vma) value, (unsigned char *) where); + else + { + struct d10v_opcode *rep, *repi; + + rep = (struct d10v_opcode *) hash_find (d10v_hash, "rep"); + repi = (struct d10v_opcode *) hash_find (d10v_hash, "repi"); + if ((insn & FM11) == FM11 + && ((repi != NULL + && (insn & repi->mask) == (unsigned) repi->opcode) + || (rep != NULL + && (insn & rep->mask) == (unsigned) rep->opcode)) + && value < 4) + as_fatal + (_("line %d: rep or repi must include at least 4 instructions"), + fixP->fx_line); + insn = + d10v_insert_operand (insn, op_type, (offsetT) value, left, fixP); + bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + } + break; + case BFD_RELOC_32: + bfd_putb32 ((bfd_vma) value, (unsigned char *) where); + break; + case BFD_RELOC_16: + bfd_putb16 ((bfd_vma) value, (unsigned char *) where); + break; + + case BFD_RELOC_VTABLE_INHERIT: + case BFD_RELOC_VTABLE_ENTRY: + fixP->fx_done = 0; + return; + + default: + as_fatal (_("line %d: unknown relocation type: 0x%x"), + fixP->fx_line, fixP->fx_r_type); + } +} + +/* d10v_cleanup() is called after the assembler has finished parsing + the input file, when a label is read from the input file, or when a + stab directive is output. Because the D10V assembler sometimes + saves short instructions to see if it can package them with the + next instruction, there may be a short instruction that still needs + to be written. + + NOTE: accesses a global, etype. + NOTE: invoked by various macros such as md_cleanup: see. */ + +int +d10v_cleanup () +{ + segT seg; + subsegT subseg; + + /* If cleanup was invoked because the assembler encountered, e.g., a + user label, we write out the pending instruction, if any. If it + was invoked because the assembler is outputting a piece of line + debugging information, though, we write out the pending + instruction only if the --no-gstabs-packing command line switch + has been specified. */ + if (prev_opcode + && etype == PACK_UNSPEC + && (! outputting_stabs_line_debug || ! flag_allow_gstabs_packing)) + { + seg = now_seg; + subseg = now_subseg; + + if (prev_seg) + subseg_set (prev_seg, prev_subseg); + + write_1_short (prev_opcode, prev_insn, fixups->next); + subseg_set (seg, subseg); + prev_opcode = NULL; + } + return 1; +} + +/* Like normal .word, except support @word. + Clobbers input_line_pointer, checks end-of-line. */ + +static void +d10v_dot_word (dummy) + int dummy ATTRIBUTE_UNUSED; +{ + expressionS exp; + char *p; + + if (is_it_end_of_statement ()) + { + demand_empty_rest_of_line (); + return; + } + + do + { + expression (&exp); + if (!strncasecmp (input_line_pointer, "@word", 5)) + { + exp.X_add_number = 0; + input_line_pointer += 5; + + p = frag_more (2); + fix_new_exp (frag_now, p - frag_now->fr_literal, 2, + &exp, 0, BFD_RELOC_D10V_18); + } + else + emit_expr (&exp, 2); + } + while (*input_line_pointer++ == ','); + + input_line_pointer--; /* Put terminator back into stream. */ + demand_empty_rest_of_line (); +} + +/* Mitsubishi asked that we support some old syntax that apparently + had immediate operands starting with '#'. This is in some of their + sample code but is not documented (although it appears in some + examples in their assembler manual). For now, we'll solve this + compatibility problem by simply ignoring any '#' at the beginning + of an operand. */ + +/* Operands that begin with '#' should fall through to here. + From expr.c. */ + +void +md_operand (expressionP) + expressionS *expressionP; +{ + if (*input_line_pointer == '#' && ! do_not_ignore_hash) + { + input_line_pointer++; + expression (expressionP); + } +} + +bfd_boolean +d10v_fix_adjustable (fixP) + fixS *fixP; +{ + /* We need the symbol name for the VTABLE entries. */ + if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT + || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) + return 0; + + return 1; +} diff --git a/gas/config/tc-d10v.h b/gas/config/tc-d10v.h new file mode 100644 index 0000000000000..debb799b95cfd --- /dev/null +++ b/gas/config/tc-d10v.h @@ -0,0 +1,71 @@ +/* tc-d10v.h -- Header file for tc-d10v.c. + Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + Written by Martin Hunt, Cygnus Support. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#define TC_D10V + +#define TARGET_BYTES_BIG_ENDIAN 0 + +#ifndef BFD_ASSEMBLER + #error D10V support requires BFD_ASSEMBLER +#endif + +/* The target BFD architecture. */ +#define TARGET_ARCH bfd_arch_d10v + +#define TARGET_FORMAT "elf32-d10v" + +/* Call md_pcrel_from_section, not md_pcrel_from. */ +#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC) +struct fix; +long md_pcrel_from_section PARAMS ((struct fix *, segT)); + +/* Permit temporary numeric labels. */ +#define LOCAL_LABELS_FB 1 + +#define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */ + +/* We don't need to handle .word strangely. */ +#define WORKING_DOT_WORD + +#define md_number_to_chars number_to_chars_bigendian + +int d10v_cleanup PARAMS ((void)); +#define md_after_pass_hook() d10v_cleanup () +#define md_cleanup() d10v_cleanup () +#define md_do_align(a,b,c,d,e) d10v_cleanup () +#define tc_frob_label(sym) do {\ + d10v_cleanup (); \ + symbol_set_frag (sym, frag_now); \ + S_SET_VALUE (sym, (valueT) frag_now_fix ()); \ +} while (0) + +#define tc_fix_adjustable(FIX) d10v_fix_adjustable(FIX) +bfd_boolean d10v_fix_adjustable PARAMS ((struct fix *)); + +/* Values passed to md_apply_fix3 don't include the symbol value. */ +#define MD_APPLY_SYM_VALUE(FIX) 0 + +/* No shared lib support, so we don't need to ensure externally + visible symbols can be overridden. */ +#define EXTERN_FORCE_RELOC 0 + +#define md_flush_pending_output d10v_cleanup diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c new file mode 100644 index 0000000000000..7507c46cf3ede --- /dev/null +++ b/gas/config/tc-d30v.c @@ -0,0 +1,2253 @@ +/* tc-d30v.c -- Assembler code for the Mitsubishi D30V + Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include "as.h" +#include "safe-ctype.h" +#include "subsegs.h" +#include "opcode/d30v.h" + +const char comment_chars[] = ";"; +const char line_comment_chars[] = "#"; +const char line_separator_chars[] = ""; +const char *md_shortopts = "OnNcC"; +const char EXP_CHARS[] = "eE"; +const char FLT_CHARS[] = "dD"; + +#if HAVE_LIMITS_H +#include +#endif + +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif + +#define NOP_MULTIPLY 1 +#define NOP_ALL 2 +static int warn_nops = 0; +static int Optimizing = 0; +static int warn_register_name_conflicts = 1; + +#define FORCE_SHORT 1 +#define FORCE_LONG 2 + +/* EXEC types. */ +typedef enum _exec_type +{ + EXEC_UNKNOWN, /* no order specified */ + EXEC_PARALLEL, /* done in parallel (FM=00) */ + EXEC_SEQ, /* sequential (FM=01) */ + EXEC_REVSEQ /* reverse sequential (FM=10) */ +} exec_type_enum; + +/* Fixups. */ +#define MAX_INSN_FIXUPS (5) +struct d30v_fixup +{ + expressionS exp; + int operand; + int pcrel; + int size; + bfd_reloc_code_real_type reloc; +}; + +typedef struct _fixups +{ + int fc; + struct d30v_fixup fix[MAX_INSN_FIXUPS]; + struct _fixups *next; +} Fixups; + +static Fixups FixUps[2]; +static Fixups *fixups; + +/* Whether current and previous instruction are word multiply insns. */ +static int cur_mul32_p = 0; +static int prev_mul32_p = 0; + +/* The flag_explicitly_parallel is true iff the instruction being assembled + has been explicitly written as a parallel short-instruction pair by the + human programmer. It is used in parallel_ok () to distinguish between + those dangerous parallelizations attempted by the human, which are to be + allowed, and those attempted by the assembler, which are not. It is set + from md_assemble (). */ +static int flag_explicitly_parallel = 0; +static int flag_xp_state = 0; + +/* Whether current and previous left sub-instruction disables + execution of right sub-instruction. */ +static int cur_left_kills_right_p = 0; +static int prev_left_kills_right_p = 0; + +/* The known current alignment of the current section. */ +static int d30v_current_align; +static segT d30v_current_align_seg; + +/* The last seen label in the current section. This is used to auto-align + labels preceding instructions. */ +static symbolS *d30v_last_label; + +/* Two nops. */ +#define NOP_LEFT ((long long) NOP << 32) +#define NOP_RIGHT ((long long) NOP) +#define NOP2 (FM00 | NOP_LEFT | NOP_RIGHT) + +/* Local functions. */ +static int reg_name_search PARAMS ((char *name)); +static int register_name PARAMS ((expressionS *expressionP)); +static int check_range PARAMS ((unsigned long num, int bits, int flags)); +static int postfix PARAMS ((char *p)); +static bfd_reloc_code_real_type get_reloc PARAMS ((struct d30v_operand *op, int rel_flag)); +static int get_operands PARAMS ((expressionS exp[], int cmp_hack)); +static struct d30v_format *find_format PARAMS ((struct d30v_opcode *opcode, + expressionS ops[],int fsize, int cmp_hack)); +static long long build_insn PARAMS ((struct d30v_insn *opcode, expressionS *opers)); +static void write_long PARAMS ((struct d30v_insn *opcode, long long insn, Fixups *fx)); +static void write_1_short PARAMS ((struct d30v_insn *opcode, long long insn, + Fixups *fx, int use_sequential)); +static int write_2_short PARAMS ((struct d30v_insn *opcode1, long long insn1, + struct d30v_insn *opcode2, long long insn2, exec_type_enum exec_type, Fixups *fx)); +static long long do_assemble PARAMS ((char *str, struct d30v_insn *opcode, + int shortp, int is_parallel)); +static int parallel_ok PARAMS ((struct d30v_insn *opcode1, unsigned long insn1, + struct d30v_insn *opcode2, unsigned long insn2, + exec_type_enum exec_type)); +static void d30v_number_to_chars PARAMS ((char *buf, long long value, int nbytes)); +static void check_size PARAMS ((long value, int bits, char *file, int line)); +static void d30v_align PARAMS ((int, char *, symbolS *)); +static void s_d30v_align PARAMS ((int)); +static void s_d30v_text PARAMS ((int)); +static void s_d30v_data PARAMS ((int)); +static void s_d30v_section PARAMS ((int)); + +struct option md_longopts[] = +{ + {NULL, no_argument, NULL, 0} +}; + +size_t md_longopts_size = sizeof (md_longopts); + +/* The target specific pseudo-ops which we support. */ +const pseudo_typeS md_pseudo_table[] = +{ + { "word", cons, 4 }, + { "hword", cons, 2 }, + { "align", s_d30v_align, 0 }, + { "text", s_d30v_text, 0 }, + { "data", s_d30v_data, 0 }, + { "section", s_d30v_section, 0 }, + { "section.s", s_d30v_section, 0 }, + { "sect", s_d30v_section, 0 }, + { "sect.s", s_d30v_section, 0 }, + { NULL, NULL, 0 } +}; + +/* Opcode hash table. */ +static struct hash_control *d30v_hash; + +/* Do a binary search of the pre_defined_registers array to see if + NAME is a valid regiter name. Return the register number from the + array on success, or -1 on failure. */ + +static int +reg_name_search (name) + char *name; +{ + int middle, low, high; + int cmp; + + low = 0; + high = reg_name_cnt () - 1; + + do + { + middle = (low + high) / 2; + cmp = strcasecmp (name, pre_defined_registers[middle].name); + if (cmp < 0) + high = middle - 1; + else if (cmp > 0) + low = middle + 1; + else + { + if (symbol_find (name) != NULL) + { + if (warn_register_name_conflicts) + as_warn (_("Register name %s conflicts with symbol of the same name"), + name); + } + + return pre_defined_registers[middle].value; + } + } + while (low <= high); + + return -1; +} + +/* Check the string at input_line_pointer to see if it is a valid + register name. */ + +static int +register_name (expressionP) + expressionS *expressionP; +{ + int reg_number; + char c, *p = input_line_pointer; + + while (*p && *p != '\n' && *p != '\r' && *p != ',' && *p != ' ' && *p != ')') + p++; + + c = *p; + if (c) + *p++ = 0; + + /* Look to see if it's in the register table. */ + reg_number = reg_name_search (input_line_pointer); + if (reg_number >= 0) + { + expressionP->X_op = O_register; + /* Temporarily store a pointer to the string here. */ + expressionP->X_op_symbol = (symbolS *) input_line_pointer; + expressionP->X_add_number = reg_number; + input_line_pointer = p; + return 1; + } + if (c) + *(p - 1) = c; + return 0; +} + +static int +check_range (num, bits, flags) + unsigned long num; + int bits; + int flags; +{ + long min, max; + + /* Don't bother checking 32-bit values. */ + if (bits == 32) + { + if (sizeof (unsigned long) * CHAR_BIT == 32) + return 0; + + /* We don't record signed or unsigned for 32-bit quantities. + Allow either. */ + min = -((unsigned long) 1 << (bits - 1)); + max = ((unsigned long) 1 << bits) - 1; + return (long) num < min || (long) num > max; + } + + if (flags & OPERAND_SHIFT) + { + /* We know that all shifts are right by three bits. */ + num >>= 3; + + if (flags & OPERAND_SIGNED) + { + unsigned long sign_bit = ((unsigned long) -1L >> 4) + 1; + num = (num ^ sign_bit) - sign_bit; + } + } + + if (flags & OPERAND_SIGNED) + { + max = ((unsigned long) 1 << (bits - 1)) - 1; + min = - ((unsigned long) 1 << (bits - 1)); + return (long) num > max || (long) num < min; + } + else + { + max = ((unsigned long) 1 << bits) - 1; + return num > (unsigned long) max; + } +} + +void +md_show_usage (stream) + FILE *stream; +{ + fprintf (stream, _("\nD30V options:\n\ +-O Make adjacent short instructions parallel if possible.\n\ +-n Warn about all NOPs inserted by the assembler.\n\ +-N Warn about NOPs inserted after word multiplies.\n\ +-c Warn about symbols whoes names match register names.\n\ +-C Opposite of -C. -c is the default.\n")); +} + +int +md_parse_option (c, arg) + int c; + char *arg ATTRIBUTE_UNUSED; +{ + switch (c) + { + /* Optimize. Will attempt to parallelize operations. */ + case 'O': + Optimizing = 1; + break; + + /* Warn about all NOPS that the assembler inserts. */ + case 'n': + warn_nops = NOP_ALL; + break; + + /* Warn about the NOPS that the assembler inserts because of the + multiply hazard. */ + case 'N': + warn_nops = NOP_MULTIPLY; + break; + + case 'c': + warn_register_name_conflicts = 1; + break; + + case 'C': + warn_register_name_conflicts = 0; + break; + + default: + return 0; + } + return 1; +} + +symbolS * +md_undefined_symbol (name) + char *name ATTRIBUTE_UNUSED; +{ + return 0; +} + +/* Turn a string in input_line_pointer into a floating point constant + of type TYPE, and store the appropriate bytes in *LITP. The number + of LITTLENUMS emitted is stored in *SIZEP. An error message is + returned, or NULL on OK. */ + +char * +md_atof (type, litP, sizeP) + int type; + char *litP; + int *sizeP; +{ + int prec; + LITTLENUM_TYPE words[4]; + char *t; + int i; + + switch (type) + { + case 'f': + prec = 2; + break; + case 'd': + prec = 4; + break; + default: + *sizeP = 0; + return _("bad call to md_atof"); + } + + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + + *sizeP = prec * 2; + + for (i = 0; i < prec; i++) + { + md_number_to_chars (litP, (valueT) words[i], 2); + litP += 2; + } + return NULL; +} + +void +md_convert_frag (abfd, sec, fragP) + bfd *abfd ATTRIBUTE_UNUSED; + asection *sec ATTRIBUTE_UNUSED; + fragS *fragP ATTRIBUTE_UNUSED; +{ + abort (); +} + +valueT +md_section_align (seg, addr) + asection *seg; + valueT addr; +{ + int align = bfd_get_section_alignment (stdoutput, seg); + return ((addr + (1 << align) - 1) & (-1 << align)); +} + +void +md_begin () +{ + struct d30v_opcode *opcode; + d30v_hash = hash_new (); + + /* Insert opcode names into a hash table. */ + for (opcode = (struct d30v_opcode *) d30v_opcode_table; opcode->name; opcode++) + hash_insert (d30v_hash, opcode->name, (char *) opcode); + + fixups = &FixUps[0]; + FixUps[0].next = &FixUps[1]; + FixUps[1].next = &FixUps[0]; + + d30v_current_align_seg = now_seg; +} + +/* Remove the postincrement or postdecrement operator ( '+' or '-' ) + from an expression. */ + +static int +postfix (p) + char *p; +{ + while (*p != '-' && *p != '+') + { + if (*p == 0 || *p == '\n' || *p == '\r' || *p == ' ' || *p == ',') + break; + p++; + } + + if (*p == '-') + { + *p = ' '; + return -1; + } + + if (*p == '+') + { + *p = ' '; + return 1; + } + + return 0; +} + +static bfd_reloc_code_real_type +get_reloc (op, rel_flag) + struct d30v_operand *op; + int rel_flag; +{ + switch (op->bits) + { + case 6: + if (op->flags & OPERAND_SHIFT) + return BFD_RELOC_D30V_9_PCREL; + else + return BFD_RELOC_D30V_6; + break; + case 12: + if (!(op->flags & OPERAND_SHIFT)) + as_warn (_("unexpected 12-bit reloc type")); + if (rel_flag == RELOC_PCREL) + return BFD_RELOC_D30V_15_PCREL; + else + return BFD_RELOC_D30V_15; + case 18: + if (!(op->flags & OPERAND_SHIFT)) + as_warn (_("unexpected 18-bit reloc type")); + if (rel_flag == RELOC_PCREL) + return BFD_RELOC_D30V_21_PCREL; + else + return BFD_RELOC_D30V_21; + case 32: + if (rel_flag == RELOC_PCREL) + return BFD_RELOC_D30V_32_PCREL; + else + return BFD_RELOC_D30V_32; + default: + return 0; + } +} + +/* Parse a string of operands and return an array of expressions. */ + +static int +get_operands (exp, cmp_hack) + expressionS exp[]; + int cmp_hack; +{ + char *p = input_line_pointer; + int numops = 0; + int post = 0; + + if (cmp_hack) + { + exp[numops].X_op = O_absent; + exp[numops++].X_add_number = cmp_hack - 1; + } + + while (*p) + { + while (*p == ' ' || *p == '\t' || *p == ',') + p++; + + if (*p == 0 || *p == '\n' || *p == '\r') + break; + + if (*p == '@') + { + p++; + exp[numops].X_op = O_absent; + if (*p == '(') + { + p++; + exp[numops].X_add_number = OPERAND_ATPAR; + post = postfix (p); + } + else if (*p == '-') + { + p++; + exp[numops].X_add_number = OPERAND_ATMINUS; + } + else + { + exp[numops].X_add_number = OPERAND_ATSIGN; + post = postfix (p); + } + numops++; + continue; + } + + if (*p == ')') + { + /* Just skip the trailing paren. */ + p++; + continue; + } + + input_line_pointer = p; + + /* Check to see if it might be a register name. */ + if (!register_name (&exp[numops])) + { + /* Parse as an expression. */ + expression (&exp[numops]); + } + + if (exp[numops].X_op == O_illegal) + as_bad (_("illegal operand")); + else if (exp[numops].X_op == O_absent) + as_bad (_("missing operand")); + + numops++; + p = input_line_pointer; + + switch (post) + { + case -1: + /* Postdecrement mode. */ + exp[numops].X_op = O_absent; + exp[numops++].X_add_number = OPERAND_MINUS; + break; + case 1: + /* Postincrement mode. */ + exp[numops].X_op = O_absent; + exp[numops++].X_add_number = OPERAND_PLUS; + break; + } + post = 0; + } + + exp[numops].X_op = 0; + + return numops; +} + +/* Generate the instruction. + It does everything but write the FM bits. */ + +static long long +build_insn (opcode, opers) + struct d30v_insn *opcode; + expressionS *opers; +{ + int i, length, bits, shift, flags; + unsigned long number, id = 0; + long long insn; + struct d30v_opcode *op = opcode->op; + struct d30v_format *form = opcode->form; + + insn = + opcode->ecc << 28 | op->op1 << 25 | op->op2 << 20 | form->modifier << 18; + + for (i = 0; form->operands[i]; i++) + { + flags = d30v_operand_table[form->operands[i]].flags; + + /* Must be a register or number. */ + if (!(flags & OPERAND_REG) && !(flags & OPERAND_NUM) + && !(flags & OPERAND_NAME) && !(flags & OPERAND_SPECIAL)) + continue; + + bits = d30v_operand_table[form->operands[i]].bits; + if (flags & OPERAND_SHIFT) + bits += 3; + + length = d30v_operand_table[form->operands[i]].length; + shift = 12 - d30v_operand_table[form->operands[i]].position; + if (opers[i].X_op != O_symbol) + number = opers[i].X_add_number; + else + number = 0; + if (flags & OPERAND_REG) + { + /* Check for mvfsys or mvtsys control registers. */ + if (flags & OPERAND_CONTROL && (number & 0x7f) > MAX_CONTROL_REG) + { + /* PSWL or PSWH. */ + id = (number & 0x7f) - MAX_CONTROL_REG; + number = 0; + } + else if (number & OPERAND_FLAG) + { + /* NUMBER is a flag register. */ + id = 3; + } + number &= 0x7F; + } + else if (flags & OPERAND_SPECIAL) + { + number = id; + } + + if (opers[i].X_op != O_register && opers[i].X_op != O_constant + && !(flags & OPERAND_NAME)) + { + /* Now create a fixup. */ + if (fixups->fc >= MAX_INSN_FIXUPS) + as_fatal (_("too many fixups")); + + fixups->fix[fixups->fc].reloc = + get_reloc ((struct d30v_operand *) &d30v_operand_table[form->operands[i]], op->reloc_flag); + fixups->fix[fixups->fc].size = 4; + fixups->fix[fixups->fc].exp = opers[i]; + fixups->fix[fixups->fc].operand = form->operands[i]; + if (fixups->fix[fixups->fc].reloc == BFD_RELOC_D30V_9_PCREL) + fixups->fix[fixups->fc].pcrel = RELOC_PCREL; + else + fixups->fix[fixups->fc].pcrel = op->reloc_flag; + (fixups->fc)++; + } + + /* Truncate to the proper number of bits. */ + if ((opers[i].X_op == O_constant) && check_range (number, bits, flags)) + as_bad (_("operand out of range: %ld"), number); + if (bits < 31) + number &= 0x7FFFFFFF >> (31 - bits); + if (flags & OPERAND_SHIFT) + number >>= 3; + if (bits == 32) + { + /* It's a LONG instruction. */ + insn |= ((number & 0xffffffff) >> 26); /* top 6 bits */ + insn <<= 32; /* shift the first word over */ + insn |= ((number & 0x03FC0000) << 2); /* next 8 bits */ + insn |= number & 0x0003FFFF; /* bottom 18 bits */ + } + else + insn |= number << shift; + } + + return insn; +} + +/* Write out a long form instruction. */ + +static void +write_long (opcode, insn, fx) + struct d30v_insn *opcode ATTRIBUTE_UNUSED; + long long insn; + Fixups *fx; +{ + int i, where; + char *f = frag_more (8); + + insn |= FM11; + d30v_number_to_chars (f, insn, 8); + + for (i = 0; i < fx->fc; i++) + { + if (fx->fix[i].reloc) + { + where = f - frag_now->fr_literal; + fix_new_exp (frag_now, + where, + fx->fix[i].size, + &(fx->fix[i].exp), + fx->fix[i].pcrel, + fx->fix[i].reloc); + } + } + + fx->fc = 0; +} + +/* Write out a short form instruction by itself. */ + +static void +write_1_short (opcode, insn, fx, use_sequential) + struct d30v_insn *opcode; + long long insn; + Fixups *fx; + int use_sequential; +{ + char *f = frag_more (8); + int i, where; + + if (warn_nops == NOP_ALL) + as_warn (_("%s NOP inserted"), use_sequential ? + _("sequential") : _("parallel")); + + /* The other container needs to be NOP. */ + if (use_sequential) + { + /* Use a sequential NOP rather than a parallel one, + as the current instruction is a FLAG_MUL32 type one + and the next instruction is a load. */ + + /* According to 4.3.1: for FM=01, sub-instructions performed + only by IU cannot be encoded in L-container. */ + + if (opcode->op->unit == IU) + /* Right then left. */ + insn |= FM10 | NOP_LEFT; + else + /* Left then right. */ + insn = FM01 | (insn << 32) | NOP_RIGHT; + } + else + { + /* According to 4.3.1: for FM=00, sub-instructions performed + only by IU cannot be encoded in L-container. */ + + if (opcode->op->unit == IU) + /* Right container. */ + insn |= FM00 | NOP_LEFT; + else + /* Left container. */ + insn = FM00 | (insn << 32) | NOP_RIGHT; + } + + d30v_number_to_chars (f, insn, 8); + + for (i = 0; i < fx->fc; i++) + { + if (fx->fix[i].reloc) + { + where = f - frag_now->fr_literal; + fix_new_exp (frag_now, + where, + fx->fix[i].size, + &(fx->fix[i].exp), + fx->fix[i].pcrel, + fx->fix[i].reloc); + } + } + + fx->fc = 0; +} + +/* Write out a short form instruction if possible. + Return number of instructions not written out. */ + +static int +write_2_short (opcode1, insn1, opcode2, insn2, exec_type, fx) + struct d30v_insn *opcode1, *opcode2; + long long insn1, insn2; + exec_type_enum exec_type; + Fixups *fx; +{ + long long insn = NOP2; + char *f; + int i, j, where; + + if (exec_type == EXEC_SEQ + && (opcode1->op->flags_used & (FLAG_JMP | FLAG_JSR)) + && ((opcode1->op->flags_used & FLAG_DELAY) == 0) + && ((opcode1->ecc == ECC_AL) || ! Optimizing)) + { + /* Unconditional, non-delayed branches kill instructions in + the right bin. Conditional branches don't always but if + we are not optimizing, then we have been asked to produce + an error about such constructs. For the purposes of this + test, subroutine calls are considered to be branches. */ + write_1_short (opcode1, insn1, fx->next, FALSE); + return 1; + } + + /* Note: we do not have to worry about subroutine calls occurring + in the right hand container. The return address is always + aligned to the next 64 bit boundary, be that 64 or 32 bit away. */ + switch (exec_type) + { + case EXEC_UNKNOWN: /* Order not specified. */ + if (Optimizing + && parallel_ok (opcode1, insn1, opcode2, insn2, exec_type) + && ! ( (opcode1->op->unit == EITHER_BUT_PREFER_MU + || opcode1->op->unit == MU) + && + ( opcode2->op->unit == EITHER_BUT_PREFER_MU + || opcode2->op->unit == MU))) + { + /* Parallel. */ + exec_type = EXEC_PARALLEL; + + if (opcode1->op->unit == IU + || opcode2->op->unit == MU + || opcode2->op->unit == EITHER_BUT_PREFER_MU) + insn = FM00 | (insn2 << 32) | insn1; + else + { + insn = FM00 | (insn1 << 32) | insn2; + fx = fx->next; + } + } + else if ((opcode1->op->flags_used & (FLAG_JMP | FLAG_JSR) + && ((opcode1->op->flags_used & FLAG_DELAY) == 0)) + || opcode1->op->flags_used & FLAG_RP) + { + /* We must emit (non-delayed) branch type instructions + on their own with nothing in the right container. */ + /* We must treat repeat instructions likewise, since the + following instruction has to be separate from the repeat + in order to be repeated. */ + write_1_short (opcode1, insn1, fx->next, FALSE); + return 1; + } + else if (prev_left_kills_right_p) + { + /* The left instruction kils the right slot, so we + must leave it empty. */ + write_1_short (opcode1, insn1, fx->next, FALSE); + return 1; + } + else if (opcode1->op->unit == IU) + { + if (opcode2->op->unit == EITHER_BUT_PREFER_MU) + { + /* Case 103810 is a request from Mitsubishi that opcodes + with EITHER_BUT_PREFER_MU should not be executed in + reverse sequential order. */ + write_1_short (opcode1, insn1, fx->next, FALSE); + return 1; + } + + /* Reverse sequential. */ + insn = FM10 | (insn2 << 32) | insn1; + exec_type = EXEC_REVSEQ; + } + else + { + /* Sequential. */ + insn = FM01 | (insn1 << 32) | insn2; + fx = fx->next; + exec_type = EXEC_SEQ; + } + break; + + case EXEC_PARALLEL: /* Parallel. */ + flag_explicitly_parallel = flag_xp_state; + if (! parallel_ok (opcode1, insn1, opcode2, insn2, exec_type)) + as_bad (_("Instructions may not be executed in parallel")); + else if (opcode1->op->unit == IU) + { + if (opcode2->op->unit == IU) + as_bad (_("Two IU instructions may not be executed in parallel")); + as_warn (_("Swapping instruction order")); + insn = FM00 | (insn2 << 32) | insn1; + } + else if (opcode2->op->unit == MU) + { + if (opcode1->op->unit == MU) + as_bad (_("Two MU instructions may not be executed in parallel")); + else if (opcode1->op->unit == EITHER_BUT_PREFER_MU) + as_warn (_("Executing %s in IU may not work"), opcode1->op->name); + as_warn (_("Swapping instruction order")); + insn = FM00 | (insn2 << 32) | insn1; + } + else + { + if (opcode2->op->unit == EITHER_BUT_PREFER_MU) + as_warn (_("Executing %s in IU may not work in parallel execution"), + opcode2->op->name); + + insn = FM00 | (insn1 << 32) | insn2; + fx = fx->next; + } + flag_explicitly_parallel = 0; + break; + + case EXEC_SEQ: /* Sequential. */ + if (opcode1->op->unit == IU) + as_bad (_("IU instruction may not be in the left container")); + if (prev_left_kills_right_p) + as_bad (_("special left instruction `%s' kills instruction " + "`%s' in right container"), + opcode1->op->name, opcode2->op->name); + insn = FM01 | (insn1 << 32) | insn2; + fx = fx->next; + break; + + case EXEC_REVSEQ: /* Reverse sequential. */ + if (opcode2->op->unit == MU) + as_bad (_("MU instruction may not be in the right container")); + if (opcode1->op->unit == EITHER_BUT_PREFER_MU) + as_warn (_("Executing %s in reverse serial with %s may not work"), + opcode1->op->name, opcode2->op->name); + else if (opcode2->op->unit == EITHER_BUT_PREFER_MU) + as_warn (_("Executing %s in IU in reverse serial may not work"), + opcode2->op->name); + insn = FM10 | (insn1 << 32) | insn2; + fx = fx->next; + break; + + default: + as_fatal (_("unknown execution type passed to write_2_short()")); + } + +#if 0 + printf ("writing out %llx\n", insn); +#endif + f = frag_more (8); + d30v_number_to_chars (f, insn, 8); + + /* If the previous instruction was a 32-bit multiply but it is put into a + parallel container, mark the current instruction as being a 32-bit + multiply. */ + if (prev_mul32_p && exec_type == EXEC_PARALLEL) + cur_mul32_p = 1; + + for (j = 0; j < 2; j++) + { + for (i = 0; i < fx->fc; i++) + { + if (fx->fix[i].reloc) + { + where = (f - frag_now->fr_literal) + 4 * j; + + fix_new_exp (frag_now, + where, + fx->fix[i].size, + &(fx->fix[i].exp), + fx->fix[i].pcrel, + fx->fix[i].reloc); + } + } + + fx->fc = 0; + fx = fx->next; + } + + return 0; +} + +/* Check 2 instructions and determine if they can be safely + executed in parallel. Return 1 if they can be. */ + +static int +parallel_ok (op1, insn1, op2, insn2, exec_type) + struct d30v_insn *op1, *op2; + unsigned long insn1, insn2; + exec_type_enum exec_type; +{ + int i, j, shift, regno, bits, ecc; + unsigned long flags, mask, flags_set1, flags_set2, flags_used1, flags_used2; + unsigned long ins, mod_reg[2][3], used_reg[2][3], flag_reg[2]; + struct d30v_format *f; + struct d30v_opcode *op; + + /* Section 4.3: Both instructions must not be IU or MU only. */ + if ((op1->op->unit == IU && op2->op->unit == IU) + || (op1->op->unit == MU && op2->op->unit == MU)) + return 0; + + /* First instruction must not be a jump to safely optimize, unless this + is an explicit parallel operation. */ + if (exec_type != EXEC_PARALLEL + && (op1->op->flags_used & (FLAG_JMP | FLAG_JSR))) + return 0; + + /* If one instruction is /TX or /XT and the other is /FX or /XF respectively, + then it is safe to allow the two to be done as parallel ops, since only + one will ever be executed at a time. */ + if ((op1->ecc == ECC_TX && op2->ecc == ECC_FX) + || (op1->ecc == ECC_FX && op2->ecc == ECC_TX) + || (op1->ecc == ECC_XT && op2->ecc == ECC_XF) + || (op1->ecc == ECC_XF && op2->ecc == ECC_XT)) + return 1; + + /* [0] r0-r31 + [1] r32-r63 + [2] a0, a1, flag registers. */ + for (j = 0; j < 2; j++) + { + if (j == 0) + { + f = op1->form; + op = op1->op; + ecc = op1->ecc; + ins = insn1; + } + else + { + f = op2->form; + op = op2->op; + ecc = op2->ecc; + ins = insn2; + } + + flag_reg[j] = 0; + mod_reg[j][0] = mod_reg[j][1] = 0; + used_reg[j][0] = used_reg[j][1] = 0; + + if (flag_explicitly_parallel) + { + /* For human specified parallel instructions we have been asked + to ignore the possibility that both instructions could modify + bits in the PSW, so we initialise the mod & used arrays to 0. + We have been asked, however, to refuse to allow parallel + instructions which explicitly set the same flag register, + eg "cmpne f0,r1,0x10 || cmpeq f0, r5, 0x2", so further on we test + for the use of a flag register and set a bit in the mod or used + array appropriately. */ + mod_reg[j][2] = 0; + used_reg[j][2] = 0; + } + else + { + mod_reg[j][2] = (op->flags_set & FLAG_ALL); + used_reg[j][2] = (op->flags_used & FLAG_ALL); + } + + /* BSR/JSR always sets R62. */ + if (op->flags_used & FLAG_JSR) + mod_reg[j][1] = (1L << (62 - 32)); + + /* Conditional execution affects the flags_used. */ + switch (ecc) + { + case ECC_TX: + case ECC_FX: + used_reg[j][2] |= flag_reg[j] = FLAG_0; + break; + + case ECC_XT: + case ECC_XF: + used_reg[j][2] |= flag_reg[j] = FLAG_1; + break; + + case ECC_TT: + case ECC_TF: + used_reg[j][2] |= flag_reg[j] = (FLAG_0 | FLAG_1); + break; + } + + for (i = 0; f->operands[i]; i++) + { + flags = d30v_operand_table[f->operands[i]].flags; + shift = 12 - d30v_operand_table[f->operands[i]].position; + bits = d30v_operand_table[f->operands[i]].bits; + if (bits == 32) + mask = 0xffffffff; + else + mask = 0x7FFFFFFF >> (31 - bits); + + if ((flags & OPERAND_PLUS) || (flags & OPERAND_MINUS)) + { + /* This is a post-increment or post-decrement. + The previous register needs to be marked as modified. */ + shift = 12 - d30v_operand_table[f->operands[i - 1]].position; + regno = (ins >> shift) & 0x3f; + if (regno >= 32) + mod_reg[j][1] |= 1L << (regno - 32); + else + mod_reg[j][0] |= 1L << regno; + } + else if (flags & OPERAND_REG) + { + regno = (ins >> shift) & mask; + /* The memory write functions don't have a destination + register. */ + if ((flags & OPERAND_DEST) && !(op->flags_set & FLAG_MEM)) + { + /* MODIFIED registers and flags. */ + if (flags & OPERAND_ACC) + { + if (regno == 0) + mod_reg[j][2] |= FLAG_A0; + else if (regno == 1) + mod_reg[j][2] |= FLAG_A1; + else + abort (); + } + else if (flags & OPERAND_FLAG) + mod_reg[j][2] |= 1L << regno; + else if (!(flags & OPERAND_CONTROL)) + { + int r, z; + + /* Need to check if there are two destination + registers, for example ld2w. */ + if (flags & OPERAND_2REG) + z = 1; + else + z = 0; + + for (r = regno; r <= regno + z; r++) + { + if (r >= 32) + mod_reg[j][1] |= 1L << (r - 32); + else + mod_reg[j][0] |= 1L << r; + } + } + } + else + { + /* USED, but not modified registers and flags. */ + if (flags & OPERAND_ACC) + { + if (regno == 0) + used_reg[j][2] |= FLAG_A0; + else if (regno == 1) + used_reg[j][2] |= FLAG_A1; + else + abort (); + } + else if (flags & OPERAND_FLAG) + used_reg[j][2] |= 1L << regno; + else if (!(flags & OPERAND_CONTROL)) + { + int r, z; + + /* Need to check if there are two source + registers, for example st2w. */ + if (flags & OPERAND_2REG) + z = 1; + else + z = 0; + + for (r = regno; r <= regno + z; r++) + { + if (r >= 32) + used_reg[j][1] |= 1L << (r - 32); + else + used_reg[j][0] |= 1L << r; + } + } + } + } + } + } + + flags_set1 = op1->op->flags_set; + flags_set2 = op2->op->flags_set; + flags_used1 = op1->op->flags_used; + flags_used2 = op2->op->flags_used; + + /* Check for illegal combinations with ADDppp/SUBppp. */ + if (((flags_set1 & FLAG_NOT_WITH_ADDSUBppp) != 0 + && (flags_used2 & FLAG_ADDSUBppp) != 0) + || ((flags_set2 & FLAG_NOT_WITH_ADDSUBppp) != 0 + && (flags_used1 & FLAG_ADDSUBppp) != 0)) + return 0; + + /* Load instruction combined with half-word multiply is illegal. */ + if (((flags_used1 & FLAG_MEM) != 0 && (flags_used2 & FLAG_MUL16)) + || ((flags_used2 & FLAG_MEM) != 0 && (flags_used1 & FLAG_MUL16))) + return 0; + + /* Specifically allow add || add by removing carry, overflow bits dependency. + This is safe, even if an addc follows since the IU takes the argument in + the right container, and it writes its results last. + However, don't paralellize add followed by addc or sub followed by + subb. */ + if (mod_reg[0][2] == FLAG_CVVA && mod_reg[1][2] == FLAG_CVVA + && (used_reg[0][2] & ~flag_reg[0]) == 0 + && (used_reg[1][2] & ~flag_reg[1]) == 0 + && op1->op->unit == EITHER && op2->op->unit == EITHER) + { + mod_reg[0][2] = mod_reg[1][2] = 0; + } + + for (j = 0; j < 3; j++) + { + /* If the second instruction depends on the first, we obviously + cannot parallelize. Note, the mod flag implies use, so + check that as well. */ + /* If flag_explicitly_parallel is set, then the case of the + second instruction using a register the first instruction + modifies is assumed to be okay; we trust the human. We + don't trust the human if both instructions modify the same + register but we do trust the human if they modify the same + flags. */ + /* We have now been requested not to trust the human if the + instructions modify the same flag registers either. */ + if (flag_explicitly_parallel) + { + if ((mod_reg[0][j] & mod_reg[1][j]) != 0) + return 0; + } + else + if ((mod_reg[0][j] & (mod_reg[1][j] | used_reg[1][j])) != 0) + return 0; + } + + return 1; +} + +/* This is the main entry point for the machine-dependent assembler. + STR points to a machine-dependent instruction. This function is + supposed to emit the frags/bytes it assembles to. For the D30V, it + mostly handles the special VLIW parsing and packing and leaves the + difficult stuff to do_assemble (). */ + +static long long prev_insn = -1; +static struct d30v_insn prev_opcode; +static subsegT prev_subseg; +static segT prev_seg = 0; + +void +md_assemble (str) + char *str; +{ + struct d30v_insn opcode; + long long insn; + /* Execution type; parallel, etc. */ + exec_type_enum extype = EXEC_UNKNOWN; + /* Saved extype. Used for multiline instructions. */ + static exec_type_enum etype = EXEC_UNKNOWN; + char *str2; + + if ((prev_insn != -1) && prev_seg + && ((prev_seg != now_seg) || (prev_subseg != now_subseg))) + d30v_cleanup (FALSE); + + if (d30v_current_align < 3) + d30v_align (3, NULL, d30v_last_label); + else if (d30v_current_align > 3) + d30v_current_align = 3; + d30v_last_label = NULL; + + flag_explicitly_parallel = 0; + flag_xp_state = 0; + if (etype == EXEC_UNKNOWN) + { + /* Look for the special multiple instruction separators. */ + str2 = strstr (str, "||"); + if (str2) + { + extype = EXEC_PARALLEL; + flag_xp_state = 1; + } + else + { + str2 = strstr (str, "->"); + if (str2) + extype = EXEC_SEQ; + else + { + str2 = strstr (str, "<-"); + if (str2) + extype = EXEC_REVSEQ; + } + } + + /* STR2 points to the separator, if one. */ + if (str2) + { + *str2 = 0; + + /* If two instructions are present and we already have one saved, + then first write it out. */ + d30v_cleanup (FALSE); + + /* Assemble first instruction and save it. */ + prev_insn = do_assemble (str, &prev_opcode, 1, 0); + if (prev_insn == -1) + as_bad (_("Cannot assemble instruction")); + if (prev_opcode.form != NULL && prev_opcode.form->form >= LONG) + as_bad (_("First opcode is long. Unable to mix instructions as specified.")); + fixups = fixups->next; + str = str2 + 2; + prev_seg = now_seg; + prev_subseg = now_subseg; + } + } + + insn = do_assemble (str, &opcode, + (extype != EXEC_UNKNOWN || etype != EXEC_UNKNOWN), + extype == EXEC_PARALLEL); + if (insn == -1) + { + if (extype != EXEC_UNKNOWN) + etype = extype; + as_bad (_("Cannot assemble instruction")); + return; + } + + if (etype != EXEC_UNKNOWN) + { + extype = etype; + etype = EXEC_UNKNOWN; + } + + /* Word multiply instructions must not be followed by either a load or a + 16-bit multiply instruction in the next cycle. */ + if ( (extype != EXEC_REVSEQ) + && prev_mul32_p + && (opcode.op->flags_used & (FLAG_MEM | FLAG_MUL16))) + { + /* However, load and multiply should able to be combined in a parallel + operation, so check for that first. */ + if (prev_insn != -1 + && (opcode.op->flags_used & FLAG_MEM) + && opcode.form->form < LONG + && (extype == EXEC_PARALLEL || (Optimizing && extype == EXEC_UNKNOWN)) + && parallel_ok (&prev_opcode, (long) prev_insn, + &opcode, (long) insn, extype) + && write_2_short (&prev_opcode, (long) prev_insn, + &opcode, (long) insn, extype, fixups) == 0) + { + /* No instructions saved. */ + prev_insn = -1; + return; + } + else + { + /* Can't parallelize, flush previous instruction and emit a + word of NOPS, unless the previous instruction is a NOP, + in which case just flush it, as this will generate a word + of NOPs for us. */ + + if (prev_insn != -1 && (strcmp (prev_opcode.op->name, "nop") == 0)) + d30v_cleanup (FALSE); + else + { + char *f; + + if (prev_insn != -1) + d30v_cleanup (TRUE); + else + { + f = frag_more (8); + d30v_number_to_chars (f, NOP2, 8); + + if (warn_nops == NOP_ALL || warn_nops == NOP_MULTIPLY) + { + if (opcode.op->flags_used & FLAG_MEM) + as_warn (_("word of NOPs added between word multiply and load")); + else + as_warn (_("word of NOPs added between word multiply and 16-bit multiply")); + } + } + } + + extype = EXEC_UNKNOWN; + } + } + else if ( (extype == EXEC_REVSEQ) + && cur_mul32_p + && (prev_opcode.op->flags_used & (FLAG_MEM | FLAG_MUL16))) + { + /* Can't parallelize, flush current instruction and add a + sequential NOP. */ + write_1_short (&opcode, (long) insn, fixups->next->next, TRUE); + + /* Make the previous instruction the current one. */ + extype = EXEC_UNKNOWN; + insn = prev_insn; + now_seg = prev_seg; + now_subseg = prev_subseg; + prev_insn = -1; + cur_mul32_p = prev_mul32_p; + prev_mul32_p = 0; + memcpy (&opcode, &prev_opcode, sizeof (prev_opcode)); + } + + /* If this is a long instruction, write it and any previous short + instruction. */ + if (opcode.form->form >= LONG) + { + if (extype != EXEC_UNKNOWN) + as_bad (_("Instruction uses long version, so it cannot be mixed as specified")); + d30v_cleanup (FALSE); + write_long (&opcode, insn, fixups); + prev_insn = -1; + } + else if ((prev_insn != -1) + && (write_2_short + (&prev_opcode, (long) prev_insn, &opcode, + (long) insn, extype, fixups) == 0)) + { + /* No instructions saved. */ + prev_insn = -1; + } + else + { + if (extype != EXEC_UNKNOWN) + as_bad (_("Unable to mix instructions as specified")); + + /* Save off last instruction so it may be packed on next pass. */ + memcpy (&prev_opcode, &opcode, sizeof (prev_opcode)); + prev_insn = insn; + prev_seg = now_seg; + prev_subseg = now_subseg; + fixups = fixups->next; + prev_mul32_p = cur_mul32_p; + } +} + +/* Assemble a single instruction and return an opcode. + Return -1 (an invalid opcode) on error. */ + +#define NAME_BUF_LEN 20 + +static long long +do_assemble (str, opcode, shortp, is_parallel) + char *str; + struct d30v_insn *opcode; + int shortp; + int is_parallel; +{ + unsigned char *op_start; + unsigned char *save; + unsigned char *op_end; + char name[NAME_BUF_LEN]; + int cmp_hack; + int nlen = 0; + int fsize = (shortp ? FORCE_SHORT : 0); + expressionS myops[6]; + long long insn; + + /* Drop leading whitespace. */ + while (*str == ' ') + str++; + + /* Find the opcode end. */ + for (op_start = op_end = (unsigned char *) (str); + *op_end + && nlen < (NAME_BUF_LEN - 1) + && *op_end != '/' + && !is_end_of_line[*op_end] && *op_end != ' '; + op_end++) + { + name[nlen] = TOLOWER (op_start[nlen]); + nlen++; + } + + if (nlen == 0) + return -1; + + name[nlen] = 0; + + /* If there is an execution condition code, handle it. */ + if (*op_end == '/') + { + int i = 0; + while ((i < ECC_MAX) && strncasecmp (d30v_ecc_names[i], op_end + 1, 2)) + i++; + + if (i == ECC_MAX) + { + char tmp[4]; + strncpy (tmp, op_end + 1, 2); + tmp[2] = 0; + as_bad (_("unknown condition code: %s"), tmp); + return -1; + } +#if 0 + printf ("condition code=%d\n", i); +#endif + opcode->ecc = i; + op_end += 3; + } + else + opcode->ecc = ECC_AL; + + /* CMP and CMPU change their name based on condition codes. */ + if (!strncmp (name, "cmp", 3)) + { + int p, i; + char **str = (char **) d30v_cc_names; + if (name[3] == 'u') + p = 4; + else + p = 3; + + for (i = 1; *str && strncmp (*str, &name[p], 2); i++, str++) + ; + + /* cmpu only supports some condition codes. */ + if (p == 4) + { + if (i < 3 || i > 6) + { + name[p + 2] = 0; + as_bad (_("cmpu doesn't support condition code %s"), &name[p]); + } + } + + if (!*str) + { + name[p + 2] = 0; + as_bad (_("unknown condition code: %s"), &name[p]); + } + + cmp_hack = i; + name[p] = 0; + } + else + cmp_hack = 0; + +#if 0 + printf ("cmp_hack=%d\n", cmp_hack); +#endif + + /* Need to look for .s or .l. */ + if (name[nlen - 2] == '.') + { + switch (name[nlen - 1]) + { + case 's': + fsize = FORCE_SHORT; + break; + case 'l': + fsize = FORCE_LONG; + break; + } + name[nlen - 2] = 0; + } + + /* Find the first opcode with the proper name. */ + opcode->op = (struct d30v_opcode *) hash_find (d30v_hash, name); + if (opcode->op == NULL) + { + as_bad (_("unknown opcode: %s"), name); + return -1; + } + + save = input_line_pointer; + input_line_pointer = op_end; + while (!(opcode->form = find_format (opcode->op, myops, fsize, cmp_hack))) + { + opcode->op++; + if (opcode->op->name == NULL || strcmp (opcode->op->name, name)) + { + as_bad (_("operands for opcode `%s' do not match any valid format"), + name); + return -1; + } + } + input_line_pointer = save; + + insn = build_insn (opcode, myops); + + /* Propagate multiply status. */ + if (insn != -1) + { + if (is_parallel && prev_mul32_p) + cur_mul32_p = 1; + else + { + prev_mul32_p = cur_mul32_p; + cur_mul32_p = (opcode->op->flags_used & FLAG_MUL32) != 0; + } + } + + /* Propagate left_kills_right status. */ + if (insn != -1) + { + prev_left_kills_right_p = cur_left_kills_right_p; + + if (opcode->op->flags_set & FLAG_LKR) + { + cur_left_kills_right_p = 1; + + if (strcmp (opcode->op->name, "mvtsys") == 0) + { + /* Left kills right for only mvtsys only for + PSW/PSWH/PSWL/flags target. */ + if ((myops[0].X_op == O_register) && + ((myops[0].X_add_number == OPERAND_CONTROL) || /* psw */ + (myops[0].X_add_number == OPERAND_CONTROL+MAX_CONTROL_REG+2) || /* pswh */ + (myops[0].X_add_number == OPERAND_CONTROL+MAX_CONTROL_REG+1) || /* pswl */ + (myops[0].X_add_number == OPERAND_FLAG+0) || /* f0 */ + (myops[0].X_add_number == OPERAND_FLAG+1) || /* f1 */ + (myops[0].X_add_number == OPERAND_FLAG+2) || /* f2 */ + (myops[0].X_add_number == OPERAND_FLAG+3) || /* f3 */ + (myops[0].X_add_number == OPERAND_FLAG+4) || /* f4 */ + (myops[0].X_add_number == OPERAND_FLAG+5) || /* f5 */ + (myops[0].X_add_number == OPERAND_FLAG+6) || /* f6 */ + (myops[0].X_add_number == OPERAND_FLAG+7))) /* f7 */ + { + cur_left_kills_right_p = 1; + } + else + { + /* Other mvtsys target registers don't kill right + instruction. */ + cur_left_kills_right_p = 0; + } + } /* mvtsys */ + } + else + cur_left_kills_right_p = 0; + } + + return insn; +} + +/* Get a pointer to an entry in the format table. + It must look at all formats for an opcode and use the operands + to choose the correct one. Return NULL on error. */ + +static struct d30v_format * +find_format (opcode, myops, fsize, cmp_hack) + struct d30v_opcode *opcode; + expressionS myops[]; + int fsize; + int cmp_hack; +{ + int numops, match, index, i = 0, j, k; + struct d30v_format *fm; + + if (opcode == NULL) + return NULL; + + /* Get all the operands and save them as expressions. */ + numops = get_operands (myops, cmp_hack); + + while ((index = opcode->format[i++]) != 0) + { + if (fsize == FORCE_SHORT && index >= LONG) + continue; + + if (fsize == FORCE_LONG && index < LONG) + continue; + + fm = (struct d30v_format *) &d30v_format_table[index]; + k = index; + while (fm->form == index) + { + match = 1; + /* Now check the operands for compatibility. */ + for (j = 0; match && fm->operands[j]; j++) + { + int flags = d30v_operand_table[fm->operands[j]].flags; + int bits = d30v_operand_table[fm->operands[j]].bits; + int X_op = myops[j].X_op; + int num = myops[j].X_add_number; + + if (flags & OPERAND_SPECIAL) + break; + else if (X_op == O_illegal) + match = 0; + else if (flags & OPERAND_REG) + { + if (X_op != O_register + || ((flags & OPERAND_ACC) && !(num & OPERAND_ACC)) + || (!(flags & OPERAND_ACC) && (num & OPERAND_ACC)) + || ((flags & OPERAND_FLAG) && !(num & OPERAND_FLAG)) + || (!(flags & (OPERAND_FLAG | OPERAND_CONTROL)) && (num & OPERAND_FLAG)) + || ((flags & OPERAND_CONTROL) + && !(num & (OPERAND_CONTROL | OPERAND_FLAG)))) + { + match = 0; + } + } + else if (((flags & OPERAND_MINUS) + && (X_op != O_absent || num != OPERAND_MINUS)) + || ((flags & OPERAND_PLUS) + && (X_op != O_absent || num != OPERAND_PLUS)) + || ((flags & OPERAND_ATMINUS) + && (X_op != O_absent || num != OPERAND_ATMINUS)) + || ((flags & OPERAND_ATPAR) + && (X_op != O_absent || num != OPERAND_ATPAR)) + || ((flags & OPERAND_ATSIGN) + && (X_op != O_absent || num != OPERAND_ATSIGN))) + { + match = 0; + } + else if (flags & OPERAND_NUM) + { + /* A number can be a constant or symbol expression. */ + + /* If we have found a register name, but that name + also matches a symbol, then re-parse the name as + an expression. */ + if (X_op == O_register + && symbol_find ((char *) myops[j].X_op_symbol)) + { + input_line_pointer = (char *) myops[j].X_op_symbol; + expression (&myops[j]); + } + + /* Turn an expression into a symbol for later resolution. */ + if (X_op != O_absent && X_op != O_constant + && X_op != O_symbol && X_op != O_register + && X_op != O_big) + { + symbolS *sym = make_expr_symbol (&myops[j]); + myops[j].X_op = X_op = O_symbol; + myops[j].X_add_symbol = sym; + myops[j].X_add_number = num = 0; + } + + if (fm->form >= LONG) + { + /* If we're testing for a LONG format, either fits. */ + if (X_op != O_constant && X_op != O_symbol) + match = 0; + } + else if (fm->form < LONG + && ((fsize == FORCE_SHORT && X_op == O_symbol) + || (fm->form == SHORT_D2 && j == 0))) + match = 1; + + /* This is the tricky part. Will the constant or symbol + fit into the space in the current format? */ + else if (X_op == O_constant) + { + if (check_range (num, bits, flags)) + match = 0; + } + else if (X_op == O_symbol + && S_IS_DEFINED (myops[j].X_add_symbol) + && S_GET_SEGMENT (myops[j].X_add_symbol) == now_seg + && opcode->reloc_flag == RELOC_PCREL) + { + /* If the symbol is defined, see if the value will fit + into the form we're considering. */ + fragS *f; + long value; + + /* Calculate the current address by running through the + previous frags and adding our current offset. */ + value = 0; + for (f = frchain_now->frch_root; f; f = f->fr_next) + value += f->fr_fix + f->fr_offset; + value = (S_GET_VALUE (myops[j].X_add_symbol) - value + - (obstack_next_free (&frchain_now->frch_obstack) + - frag_now->fr_literal)); + if (check_range (value, bits, flags)) + match = 0; + } + else + match = 0; + } + } +#if 0 + printf ("through the loop: match=%d\n", match); +#endif + /* We're only done if the operands matched so far AND there + are no more to check. */ + if (match && myops[j].X_op == 0) + { + /* Final check - issue a warning if an odd numbered register + is used as the first register in an instruction that reads + or writes 2 registers. */ + + for (j = 0; fm->operands[j]; j++) + if (myops[j].X_op == O_register + && (myops[j].X_add_number & 1) + && (d30v_operand_table[fm->operands[j]].flags & OPERAND_2REG)) + as_warn (_("Odd numbered register used as target of multi-register instruction")); + + return fm; + } + fm = (struct d30v_format *) &d30v_format_table[++k]; + } +#if 0 + printf ("trying another format: i=%d\n", i); +#endif + } + return NULL; +} + +/* If while processing a fixup, a reloc really needs to be created, + then it is done here. */ + +arelent * +tc_gen_reloc (seg, fixp) + asection *seg ATTRIBUTE_UNUSED; + fixS *fixp; +{ + arelent *reloc; + reloc = (arelent *) xmalloc (sizeof (arelent)); + reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); + *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); + if (reloc->howto == (reloc_howto_type *) NULL) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + _("reloc %d not supported by object file format"), + (int) fixp->fx_r_type); + return NULL; + } + + reloc->addend = 0; + return reloc; +} + +int +md_estimate_size_before_relax (fragp, seg) + fragS *fragp ATTRIBUTE_UNUSED; + asection *seg ATTRIBUTE_UNUSED; +{ + abort (); + return 0; +} + +long +md_pcrel_from_section (fixp, sec) + fixS *fixp; + segT sec; +{ + if (fixp->fx_addsy != (symbolS *) NULL + && (!S_IS_DEFINED (fixp->fx_addsy) + || (S_GET_SEGMENT (fixp->fx_addsy) != sec))) + return 0; + return fixp->fx_frag->fr_address + fixp->fx_where; +} + +void +md_apply_fix3 (fixP, valP, seg) + fixS *fixP; + valueT *valP; + segT seg ATTRIBUTE_UNUSED; +{ + char *where; + unsigned long insn, insn2; + long value = *valP; + + if (fixP->fx_addsy == (symbolS *) NULL) + fixP->fx_done = 1; + + /* We don't support subtracting a symbol. */ + if (fixP->fx_subsy != (symbolS *) NULL) + as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex")); + + /* Fetch the instruction, insert the fully resolved operand + value, and stuff the instruction back again. */ + where = fixP->fx_frag->fr_literal + fixP->fx_where; + insn = bfd_getb32 ((unsigned char *) where); + + switch (fixP->fx_r_type) + { + case BFD_RELOC_8: /* Check for a bad .byte directive. */ + if (fixP->fx_addsy != NULL) + as_bad (_("line %d: unable to place address of symbol '%s' into a byte"), + fixP->fx_line, S_GET_NAME (fixP->fx_addsy)); + else if (((unsigned)value) > 0xff) + as_bad (_("line %d: unable to place value %lx into a byte"), + fixP->fx_line, value); + else + *(unsigned char *) where = value; + break; + + case BFD_RELOC_16: /* Check for a bad .short directive. */ + if (fixP->fx_addsy != NULL) + as_bad (_("line %d: unable to place address of symbol '%s' into a short"), + fixP->fx_line, S_GET_NAME (fixP->fx_addsy)); + else if (((unsigned)value) > 0xffff) + as_bad (_("line %d: unable to place value %lx into a short"), + fixP->fx_line, value); + else + bfd_putb16 ((bfd_vma) value, (unsigned char *) where); + break; + + case BFD_RELOC_64: /* Check for a bad .quad directive. */ + if (fixP->fx_addsy != NULL) + as_bad (_("line %d: unable to place address of symbol '%s' into a quad"), + fixP->fx_line, S_GET_NAME (fixP->fx_addsy)); + else + { + bfd_putb32 ((bfd_vma) value, (unsigned char *) where); + bfd_putb32 (0, ((unsigned char *) where) + 4); + } + break; + + case BFD_RELOC_D30V_6: + check_size (value, 6, fixP->fx_file, fixP->fx_line); + insn |= value & 0x3F; + bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + break; + + case BFD_RELOC_D30V_9_PCREL: + if (fixP->fx_where & 0x7) + { + if (fixP->fx_done) + value += 4; + else + fixP->fx_r_type = BFD_RELOC_D30V_9_PCREL_R; + } + check_size (value, 9, fixP->fx_file, fixP->fx_line); + insn |= ((value >> 3) & 0x3F) << 12; + bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + break; + + case BFD_RELOC_D30V_15: + check_size (value, 15, fixP->fx_file, fixP->fx_line); + insn |= (value >> 3) & 0xFFF; + bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + break; + + case BFD_RELOC_D30V_15_PCREL: + if (fixP->fx_where & 0x7) + { + if (fixP->fx_done) + value += 4; + else + fixP->fx_r_type = BFD_RELOC_D30V_15_PCREL_R; + } + check_size (value, 15, fixP->fx_file, fixP->fx_line); + insn |= (value >> 3) & 0xFFF; + bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + break; + + case BFD_RELOC_D30V_21: + check_size (value, 21, fixP->fx_file, fixP->fx_line); + insn |= (value >> 3) & 0x3FFFF; + bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + break; + + case BFD_RELOC_D30V_21_PCREL: + if (fixP->fx_where & 0x7) + { + if (fixP->fx_done) + value += 4; + else + fixP->fx_r_type = BFD_RELOC_D30V_21_PCREL_R; + } + check_size (value, 21, fixP->fx_file, fixP->fx_line); + insn |= (value >> 3) & 0x3FFFF; + bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + break; + + case BFD_RELOC_D30V_32: + insn2 = bfd_getb32 ((unsigned char *) where + 4); + insn |= (value >> 26) & 0x3F; /* Top 6 bits. */ + insn2 |= ((value & 0x03FC0000) << 2); /* Next 8 bits. */ + insn2 |= value & 0x0003FFFF; /* Bottom 18 bits. */ + bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + bfd_putb32 ((bfd_vma) insn2, (unsigned char *) where + 4); + break; + + case BFD_RELOC_D30V_32_PCREL: + insn2 = bfd_getb32 ((unsigned char *) where + 4); + insn |= (value >> 26) & 0x3F; /* Top 6 bits. */ + insn2 |= ((value & 0x03FC0000) << 2); /* Next 8 bits. */ + insn2 |= value & 0x0003FFFF; /* Bottom 18 bits. */ + bfd_putb32 ((bfd_vma) insn, (unsigned char *) where); + bfd_putb32 ((bfd_vma) insn2, (unsigned char *) where + 4); + break; + + case BFD_RELOC_32: + bfd_putb32 ((bfd_vma) value, (unsigned char *) where); + break; + + default: + as_bad (_("line %d: unknown relocation type: 0x%x"), + fixP->fx_line, fixP->fx_r_type); + } +} + +/* Called after the assembler has finished parsing the input file or + after a label is defined. Because the D30V assembler sometimes + saves short instructions to see if it can package them with the + next instruction, there may be a short instruction that still needs + written. */ + +int +d30v_cleanup (use_sequential) + int use_sequential; +{ + segT seg; + subsegT subseg; + + if (prev_insn != -1) + { + seg = now_seg; + subseg = now_subseg; + subseg_set (prev_seg, prev_subseg); + write_1_short (&prev_opcode, (long) prev_insn, fixups->next, + use_sequential); + subseg_set (seg, subseg); + prev_insn = -1; + if (use_sequential) + prev_mul32_p = FALSE; + } + + return 1; +} + +static void +d30v_number_to_chars (buf, value, n) + char *buf; /* Return 'nbytes' of chars here. */ + long long value; /* The value of the bits. */ + int n; /* Number of bytes in the output. */ +{ + while (n--) + { + buf[n] = value & 0xff; + value >>= 8; + } +} + +/* This function is called at the start of every line. It checks to + see if the first character is a '.', which indicates the start of a + pseudo-op. If it is, then write out any unwritten instructions. */ + +void +d30v_start_line () +{ + char *c = input_line_pointer; + + while (ISSPACE (*c)) + c++; + + if (*c == '.') + d30v_cleanup (FALSE); +} + +static void +check_size (value, bits, file, line) + long value; + int bits; + char *file; + int line; +{ + int tmp, max; + + if (value < 0) + tmp = ~value; + else + tmp = value; + + max = (1 << (bits - 1)) - 1; + + if (tmp > max) + as_bad_where (file, line, _("value too large to fit in %d bits"), bits); +} + +/* d30v_frob_label() is called when after a label is recognized. */ + +void +d30v_frob_label (lab) + symbolS *lab; +{ + /* Emit any pending instructions. */ + d30v_cleanup (FALSE); + + /* Update the label's address with the current output pointer. */ + symbol_set_frag (lab, frag_now); + S_SET_VALUE (lab, (valueT) frag_now_fix ()); + + /* Record this label for future adjustment after we find out what + kind of data it references, and the required alignment therewith. */ + d30v_last_label = lab; +} + +/* Hook into cons for capturing alignment changes. */ + +void +d30v_cons_align (size) + int size; +{ + int log_size; + + log_size = 0; + while ((size >>= 1) != 0) + ++log_size; + + if (d30v_current_align < log_size) + d30v_align (log_size, (char *) NULL, NULL); + else if (d30v_current_align > log_size) + d30v_current_align = log_size; + d30v_last_label = NULL; +} + +/* Called internally to handle all alignment needs. This takes care + of eliding calls to frag_align if'n the cached current alignment + says we've already got it, as well as taking care of the auto-aligning + labels wrt code. */ + +static void +d30v_align (n, pfill, label) + int n; + char *pfill; + symbolS *label; +{ + /* The front end is prone to changing segments out from under us + temporarily when -g is in effect. */ + int switched_seg_p = (d30v_current_align_seg != now_seg); + + /* Do not assume that if 'd30v_current_align >= n' and + '! switched_seg_p' that it is safe to avoid performing + this alignment request. The alignment of the current frag + can be changed under our feet, for example by a .ascii + directive in the source code. cf testsuite/gas/d30v/reloc.s */ + d30v_cleanup (FALSE); + + if (pfill == NULL) + { + if (n > 2 + && (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + { + static char const nop[4] = { 0x00, 0xf0, 0x00, 0x00 }; + + /* First, make sure we're on a four-byte boundary, in case + someone has been putting .byte values the text section. */ + if (d30v_current_align < 2 || switched_seg_p) + frag_align (2, 0, 0); + frag_align_pattern (n, nop, sizeof nop, 0); + } + else + frag_align (n, 0, 0); + } + else + frag_align (n, *pfill, 0); + + if (!switched_seg_p) + d30v_current_align = n; + + if (label != NULL) + { + symbolS *sym; + int label_seen = FALSE; + struct frag *old_frag; + valueT old_value; + valueT new_value; + + assert (S_GET_SEGMENT (label) == now_seg); + + old_frag = symbol_get_frag (label); + old_value = S_GET_VALUE (label); + new_value = (valueT) frag_now_fix (); + + /* It is possible to have more than one label at a particular + address, especially if debugging is enabled, so we must + take care to adjust all the labels at this address in this + fragment. To save time we search from the end of the symbol + list, backwards, since the symbols we are interested in are + almost certainly the ones that were most recently added. + Also to save time we stop searching once we have seen at least + one matching label, and we encounter a label that is no longer + in the target fragment. Note, this search is guaranteed to + find at least one match when sym == label, so no special case + code is necessary. */ + for (sym = symbol_lastP; sym != NULL; sym = symbol_previous (sym)) + { + if (symbol_get_frag (sym) == old_frag + && S_GET_VALUE (sym) == old_value) + { + label_seen = TRUE; + symbol_set_frag (sym, frag_now); + S_SET_VALUE (sym, new_value); + } + else if (label_seen && symbol_get_frag (sym) != old_frag) + break; + } + } + + record_alignment (now_seg, n); +} + +/* Handle the .align pseudo-op. This aligns to a power of two. We + hook here to latch the current alignment. */ + +static void +s_d30v_align (ignore) + int ignore ATTRIBUTE_UNUSED; +{ + int align; + char fill, *pfill = NULL; + long max_alignment = 15; + + align = get_absolute_expression (); + if (align > max_alignment) + { + align = max_alignment; + as_warn (_("Alignment too large: %d assumed"), align); + } + else if (align < 0) + { + as_warn (_("Alignment negative: 0 assumed")); + align = 0; + } + + if (*input_line_pointer == ',') + { + input_line_pointer++; + fill = get_absolute_expression (); + pfill = &fill; + } + + d30v_last_label = NULL; + d30v_align (align, pfill, NULL); + + demand_empty_rest_of_line (); +} + +/* Handle the .text pseudo-op. This is like the usual one, but it + clears the saved last label and resets known alignment. */ + +static void +s_d30v_text (i) + int i; + +{ + s_text (i); + d30v_last_label = NULL; + d30v_current_align = 0; + d30v_current_align_seg = now_seg; +} + +/* Handle the .data pseudo-op. This is like the usual one, but it + clears the saved last label and resets known alignment. */ + +static void +s_d30v_data (i) + int i; +{ + s_data (i); + d30v_last_label = NULL; + d30v_current_align = 0; + d30v_current_align_seg = now_seg; +} + +/* Handle the .section pseudo-op. This is like the usual one, but it + clears the saved last label and resets known alignment. */ + +static void +s_d30v_section (ignore) + int ignore; +{ + obj_elf_section (ignore); + d30v_last_label = NULL; + d30v_current_align = 0; + d30v_current_align_seg = now_seg; +} diff --git a/gas/config/tc-d30v.h b/gas/config/tc-d30v.h new file mode 100644 index 0000000000000..7306817c10ae2 --- /dev/null +++ b/gas/config/tc-d30v.h @@ -0,0 +1,68 @@ +/* tc-310v.h -- Header file for tc-d30v.c. + Copyright 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. + Written by Martin Hunt, Cygnus Support. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#define TC_D30V + +#ifndef BFD_ASSEMBLER + #error D30V support requires BFD_ASSEMBLER +#endif + +/* The target BFD architecture. */ +#define TARGET_ARCH bfd_arch_d30v +#define TARGET_FORMAT "elf32-d30v" +#define TARGET_BYTES_BIG_ENDIAN 1 + +#define md_operand(x) + +/* Call md_pcrel_from_section, not md_pcrel_from. */ +struct fix; +extern long md_pcrel_from_section PARAMS ((struct fix *, segT)); +#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC) + +/* Permit temporary numeric labels. */ +#define LOCAL_LABELS_FB 1 + +#define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */ + +/* We don't need to handle .word strangely. */ +#define WORKING_DOT_WORD + +#define md_number_to_chars number_to_chars_bigendian + +int d30v_cleanup PARAMS ((int)); +#define md_after_pass_hook() d30v_cleanup (FALSE) +#define md_cleanup() d30v_cleanup (FALSE) +#define TC_START_LABEL(ch, ptr) (ch == ':' && d30v_cleanup (FALSE)) +void d30v_start_line PARAMS ((void)); +#define md_start_line_hook() d30v_start_line () + +void d30v_frob_label PARAMS ((symbolS *)); +#define tc_frob_label(sym) d30v_frob_label(sym) + +void d30v_cons_align PARAMS ((int)); +#define md_cons_align(nbytes) d30v_cons_align(nbytes) + +/* Values passed to md_apply_fix3 don't include the symbol value. */ +#define MD_APPLY_SYM_VALUE(FIX) 0 + +/* No shared lib support, so we don't need to ensure externally + visible symbols can be overridden. */ +#define EXTERN_FORCE_RELOC 0 diff --git a/gas/config/tc-dlx.c b/gas/config/tc-dlx.c new file mode 100644 index 0000000000000..82b4aa249b08c --- /dev/null +++ b/gas/config/tc-dlx.c @@ -0,0 +1,1459 @@ +/* tc-ldx.c -- Assemble for the DLX + Copyright 2002, 2003, 2004 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* Initially created by Kuang Hwa Lin, 3/20/2002. */ + +#include "safe-ctype.h" +#include "as.h" +#include "tc-dlx.h" +#include "opcode/dlx.h" +#if 0 +#include "elf/dlx.h" +#endif + +/* Make it easier to clone this machine desc into another one. */ +#define machine_opcode dlx_opcode +#define machine_opcodes dlx_opcodes +#define machine_ip dlx_ip +#define machine_it dlx_it + +#define NO_RELOC BFD_RELOC_NONE +#define RELOC_DLX_REL26 BFD_RELOC_DLX_JMP26 +#define RELOC_DLX_16 BFD_RELOC_16 +#define RELOC_DLX_REL16 BFD_RELOC_16_PCREL_S2 +#define RELOC_DLX_HI16 BFD_RELOC_HI16_S +#define RELOC_DLX_LO16 BFD_RELOC_LO16 +#define RELOC_DLX_VTINHERIT BFD_RELOC_VTABLE_INHERIT +#define RELOC_DLX_VTENTRY BFD_RELOC_VTABLE_ENTRY + +/* handle of the OPCODE hash table */ +static struct hash_control *op_hash = NULL; + +struct machine_it +{ + char *error; + unsigned long opcode; + struct nlist *nlistp; + expressionS exp; + int pcrel; + int size; + int reloc_offset; /* Offset of reloc within insn. */ + int reloc; + int HI; + int LO; +} +the_insn; + +/* static void print_insn PARAMS ((struct machine_it *)); */ +char * parse_operand PARAMS ((char *, expressionS *)); +int md_chars_to_number PARAMS ((unsigned char *, int)); + +static void machine_ip PARAMS ((char *)); +static void s_proc PARAMS ((int)); +static void insert_sreg PARAMS ((char *, int)); +static int hilo_modifier_ok PARAMS ((char *)); +static int is_ldst_registers PARAMS ((char *)); +static int match_sft_register PARAMS ((char *)); +static void define_some_regs PARAMS ((void)); +static char * dlx_parse_loadop PARAMS ((char *)); +static char * dlx_parse_storeop PARAMS ((char *)); +static char * fix_ld_st_operand PARAMS ((unsigned long, char *)); + +const pseudo_typeS + +dlx_pseudo_table[] = + { + /* Some additional ops that are used by gcc-dlx. */ + {"asciiz", stringer, 1}, + {"half", cons, 2}, + {"dword", cons, 8}, + {"word", cons, 4}, + {"proc", s_proc, 0}, + {"endproc", s_proc, 1}, + {NULL, 0, 0}, + }; + +/* This array holds the chars that always start a comment. If the + pre-processor is disabled, these aren't very useful. */ +const char comment_chars[] = ";"; + +/* This array holds the chars that only start a comment at the beginning of + a line. If the line seems to have the form '# 123 filename' + .line and .file directives will appear in the pre-processed output. */ +/* Note that input_file.c hand checks for '#' at the beginning of the + first line of the input file. This is because the compiler outputs + #NO_APP at the beginning of its output. */ +/* Also note that comments like this one will always work. */ +const char line_comment_chars[] = "#"; + +/* We needed an unused char for line separation to work around the + lack of macros, using sed and such. */ +const char line_separator_chars[] = "@"; + +/* Chars that can be used to separate mant from exp in floating point nums. */ +const char EXP_CHARS[] = "eE"; + +/* Chars that mean this number is a floating point constant. + As in 0f12.456 + or 0d1.2345e12. */ +const char FLT_CHARS[] = "rRsSfFdDxXpP"; + +static void +insert_sreg (regname, regnum) + char *regname; + int regnum; +{ + /* Must be large enough to hold the names of the special registers. */ + char buf[80]; + int i; + + symbol_table_insert (symbol_new (regname, reg_section, (valueT) regnum, + &zero_address_frag)); + for (i = 0; regname[i]; i++) + buf[i] = ISLOWER (regname[i]) ? TOUPPER (regname[i]) : regname[i]; + buf[i] = '\0'; + + symbol_table_insert (symbol_new (buf, reg_section, (valueT) regnum, + &zero_address_frag)); +} + +/* Install symbol definitions for assorted special registers. + See MIPS Assembly Language Programmer's Guide page 1-4 */ + +static void +define_some_regs () +{ +#if 0 + /* Hardware representation. */ + insert_sreg ("r0", 0); + insert_sreg ("r1", 1); + insert_sreg ("r2", 2); + insert_sreg ("r3", 3); + insert_sreg ("r4", 4); + insert_sreg ("r5", 5); + insert_sreg ("r6", 6); + insert_sreg ("r7", 7); + insert_sreg ("r8", 8); + insert_sreg ("r9", 9); + insert_sreg ("r10", 10); + insert_sreg ("r11", 11); + insert_sreg ("r12", 12); + insert_sreg ("r13", 13); + insert_sreg ("r14", 14); + insert_sreg ("r15", 15); + insert_sreg ("r16", 16); + insert_sreg ("r17", 17); + insert_sreg ("r18", 18); + insert_sreg ("r19", 19); + insert_sreg ("r20", 20); + insert_sreg ("r21", 21); + insert_sreg ("r22", 22); + insert_sreg ("r23", 23); + insert_sreg ("r24", 24); + insert_sreg ("r25", 25); + insert_sreg ("r26", 26); + insert_sreg ("r27", 27); + insert_sreg ("r28", 28); + insert_sreg ("r29", 29); + insert_sreg ("r30", 30); + insert_sreg ("r31", 31); +#endif + /* Software representation. */ + insert_sreg ("zero", 0); + insert_sreg ("at", 1); + insert_sreg ("v0", 2); + insert_sreg ("v1", 3); + insert_sreg ("a0", 4); + insert_sreg ("a1", 5); + insert_sreg ("a2", 6); + insert_sreg ("a3", 7); + insert_sreg ("t0", 8); + insert_sreg ("t1", 9); + insert_sreg ("t2", 10); + insert_sreg ("t3", 11); + insert_sreg ("t4", 12); + insert_sreg ("t5", 13); + insert_sreg ("t6", 14); + insert_sreg ("t7", 15); + insert_sreg ("s0", 16); + insert_sreg ("s1", 17); + insert_sreg ("s2", 18); + insert_sreg ("s3", 19); + insert_sreg ("s4", 20); + insert_sreg ("s5", 21); + insert_sreg ("s6", 22); + insert_sreg ("s7", 23); + insert_sreg ("t8", 24); + insert_sreg ("t9", 25); + insert_sreg ("k0", 26); + insert_sreg ("k1", 27); + insert_sreg ("gp", 28); + insert_sreg ("sp", 29); + insert_sreg ("fp", 30); + insert_sreg ("ra", 31); + /* Special registers. */ + insert_sreg ("pc", 0); + insert_sreg ("npc", 1); + insert_sreg ("iad", 2); +} + +/* Subroutine check the string to match an register, */ + +static int +match_sft_register (name) + char *name; +{ +#define MAX_REG_NO 35 +/* Currently we have 35 software registers defined - + we borrowed from MIPS. */ + static char *soft_reg[] = + { + "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", + "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", + "s0", "s1", "s2", "s3", "s4", "s5", "s7", "k0", "k1", + "gp", "sp", "fp", "ra", "pc", "npc", "iad", + "EndofTab" /* End of the Table indicator */ + }; + char low_name[21], *ptr; + int idx; + + for (ptr = name,idx = 0; *ptr != '\0'; ptr++) + low_name[idx++] = TOLOWER (*ptr); + + low_name[idx] = '\0'; + idx = 0; + + while (idx < MAX_REG_NO && strcmp (soft_reg[idx], & low_name [0])) + idx += 1; + + return idx < MAX_REG_NO; +} + +/* Subroutine check the string to match an register. */ + +static int +is_ldst_registers (name) + char *name; +{ + char *ptr = name; + + /* The first character of the register name got to be either %, $, r of R. */ + if ((ptr[0] == '%' || ptr[0] == '$' || ptr[0] == 'r' || ptr[0] == 'R') + && ISDIGIT ((unsigned char) ptr[1])) + return 1; + + /* Now check the software register representation. */ + return match_sft_register (ptr); +} + +/* Subroutine of s_proc so targets can choose a different default prefix. + If DEFAULT_PREFIX is NULL, use the target's "leading char". */ + +static void +s_proc (end_p) + int end_p; +{ + /* Record the current function so that we can issue an error message for + misplaced .func,.endfunc, and also so that .endfunc needs no + arguments. */ + static char *current_name; + static char *current_label; + + if (end_p) + { + if (current_name == NULL) + { + as_bad (_("missing .proc")); + ignore_rest_of_line (); + return; + } + + current_name = current_label = NULL; + SKIP_WHITESPACE (); + while (!is_end_of_line[(unsigned char) *input_line_pointer]) + input_line_pointer++; + } + else + { + char *name, *label; + char delim1, delim2; + + if (current_name != NULL) + { + as_bad (_(".endfunc missing for previous .proc")); + ignore_rest_of_line (); + return; + } + + name = input_line_pointer; + delim1 = get_symbol_end (); + name = xstrdup (name); + *input_line_pointer = delim1; + SKIP_WHITESPACE (); + + if (*input_line_pointer != ',') + { + char leading_char = 0; + + leading_char = bfd_get_symbol_leading_char (stdoutput); + /* Missing entry point, use function's name with the leading + char prepended. */ + if (leading_char) + asprintf (&label, "%c%s", leading_char, name); + else + label = name; + } + else + { + ++input_line_pointer; + SKIP_WHITESPACE (); + label = input_line_pointer; + delim2 = get_symbol_end (); + label = xstrdup (label); + *input_line_pointer = delim2; + } + + current_name = name; + current_label = label; + } + demand_empty_rest_of_line (); +} + +/* This function is called once, at assembler startup time. It should + set up all the tables, etc., that the MD part of the assembler will + need. */ + +void +md_begin () +{ + const char *retval = NULL; + int lose = 0; + unsigned int i; + + /* Create a new hash table. */ + op_hash = hash_new (); + + /* Hash up all the opcodes for fast use later. */ + for (i = 0; i < num_dlx_opcodes; i++) + { + const char *name = machine_opcodes[i].name; + + retval = hash_insert (op_hash, name, (PTR) &machine_opcodes[i]); + + if (retval != NULL) + { + fprintf (stderr, "internal error: can't hash `%s': %s\n", + machine_opcodes[i].name, retval); + lose = 1; + } + } + + if (lose) + as_fatal (_("Broken assembler. No assembly attempted.")); + + define_some_regs (); +} + +/* Assemble a single instruction. Its label has already been handled + by the generic front end. We just parse opcode and operands, and + produce the bytes of data and relocation. */ + +void +md_assemble (str) + char *str; +{ + char *toP; + fixS *fixP; + bit_fixS *bitP; + + know (str); + machine_ip (str); + toP = frag_more (4); + /* Put out the opcode. */ + md_number_to_chars (toP, the_insn.opcode, 4); + + /* Put out the symbol-dependent stuff. */ + if (the_insn.reloc != NO_RELOC) + { + fixP = fix_new_exp (frag_now, + (toP - frag_now->fr_literal + the_insn.reloc_offset), + the_insn.size, & the_insn.exp, the_insn.pcrel, + the_insn.reloc); + + /* Turn off complaints that the addend is + too large for things like foo+100000@ha. */ + switch (the_insn.reloc) + { + case RELOC_DLX_HI16: + case RELOC_DLX_LO16: + fixP->fx_no_overflow = 1; + break; + default: + break; + } + + switch (fixP->fx_r_type) + { + case RELOC_DLX_REL26: + bitP = malloc (sizeof (bit_fixS)); + bitP->fx_bit_size = 26; + bitP->fx_bit_offset = 25; + bitP->fx_bit_base = the_insn.opcode & 0xFC000000; + bitP->fx_bit_base_adj = 0; + bitP->fx_bit_max = 0; + bitP->fx_bit_min = 0; + bitP->fx_bit_add = 0x03FFFFFF; + fixP->fx_bit_fixP = bitP; + break; + case RELOC_DLX_LO16: + case RELOC_DLX_REL16: + bitP = malloc (sizeof (bit_fixS)); + bitP->fx_bit_size = 16; + bitP->fx_bit_offset = 15; + bitP->fx_bit_base = the_insn.opcode & 0xFFFF0000; + bitP->fx_bit_base_adj = 0; + bitP->fx_bit_max = 0; + bitP->fx_bit_min = 0; + bitP->fx_bit_add = 0x0000FFFF; + fixP->fx_bit_fixP = bitP; + break; + case RELOC_DLX_HI16: + bitP = malloc (sizeof (bit_fixS)); + bitP->fx_bit_size = 16; + bitP->fx_bit_offset = 15; + bitP->fx_bit_base = the_insn.opcode & 0xFFFF0000; + bitP->fx_bit_base_adj = 0; + bitP->fx_bit_max = 0; + bitP->fx_bit_min = 0; + bitP->fx_bit_add = 0x0000FFFF; + fixP->fx_bit_fixP = bitP; + break; + default: + fixP->fx_bit_fixP = (bit_fixS *)NULL; + break; + } + } +} + +static int +hilo_modifier_ok (s) + char *s; +{ + char *ptr = s; + int idx, count = 1; + + if (*ptr != '(') + return 1; + + for (idx = 1; ptr[idx] != '\0' && ptr[idx] != '[' && idx < 73; idx += 1) + { + if (count == 0) + return count; + + if (ptr[idx] == '(') + count += 1; + + if (ptr[idx] == ')') + count -= 1; + } + + return (count == 0) ? 1:0; +} + +char * +parse_operand (s, operandp) + char *s; + expressionS *operandp; +{ + char *save = input_line_pointer; + char *new; + + the_insn.HI = the_insn.LO = 0; + + /* Search for %hi and %lo, make a mark and skip it. */ + if (strncmp (s, "%hi", 3) == 0) + { + s += 3; + the_insn.HI = 1; + } + else + { + if (strncmp (s, "%lo", 3) == 0) + { + s += 3; + the_insn.LO = 1; + } + else + the_insn.LO = 0; + } + + if (the_insn.HI || the_insn.LO) + { + if (!hilo_modifier_ok (s)) + as_bad (_("Expression Error for operand modifier %%hi/%%lo\n")); + } + + /* Check for the % and $ register representation */ + if ((s[0] == '%' || s[0] == '$' || s[0] == 'r' || s[0] == 'R') + && ISDIGIT ((unsigned char) s[1])) + { + /* We have a numeric register expression. No biggy. */ + s += 1; + input_line_pointer = s; + (void) expression (operandp); + if (operandp->X_op != O_constant + || operandp->X_add_number > 31) + as_bad (_("Invalid expression after %%%%\n")); + operandp->X_op = O_register; + } + else + { + /* Normal operand parsing. */ + input_line_pointer = s; + (void) expression (operandp); + } + + new = input_line_pointer; + input_line_pointer = save; + return new; +} + +/* This function will check the opcode and return 1 if the opcode is one + of the load/store instruction, and it will fix the operand string to + the standard form so we can use the standard parse_operand routine. */ + +#define READ_OP 0x100 +#define WRITE_OP 0x200 +static char iBuf[81]; + +static char * +dlx_parse_loadop (str) + char * str; +{ + char *ptr = str; + int idx = 0; + + /* The last pair of ()/[] is the register, all other are the + reloc displacement, and if there is a register then it ought + to have a pair of ()/[] + This is not necessarily true, what if the load instruction come + without the register and with %hi/%lo modifier? */ + for (idx = 0; idx < 72 && ptr[idx] != '\0'; idx++) + ; + + if (idx == 72) + { + badoperand_load: + as_bad (_("Bad operand for a load instruction: <%s>"), str); + return NULL; + } + else + { + int i, pb = 0; + int m2 = 0; + char rs1[7], rd[7], endm, match = '0'; + char imm[72]; + + idx -= 1; + switch (str[idx]) + { + case ')': + match = '('; + endm = ')'; + break; + case ']': + match = '['; + endm = ']'; + break; + default: + /* No register indicated, fill in zero. */ + rs1[0] = 'r'; + rs1[1] = '0'; + rs1[2] = '\0'; + match = 0; + endm = 0; + m2 = 1; + } + + if (!m2) + { + /* Searching for (/[ which will match the ]/). */ + for (pb = idx - 1; str[pb] != match; pb -= 1) + /* Match can only be either '[' or '(', if it is + '(' then this can be a normal expression, we'll treat + it as an operand. */ + if (str[pb] == endm || pb < (idx - 5)) + goto load_no_rs1; + pb += 1; + + for (i = 0; (pb + i) < idx; i++) + rs1[i] = str[pb+i]; + + rs1[i] = '\0'; + + if (is_ldst_registers (& rs1[0])) + /* Point to the last character of the imm. */ + pb -= 1; + else + { + load_no_rs1: + if (match == '[') + goto badoperand_load; + /* No register indicated, fill in zero and restore the imm. */ + rs1[0] = 'r'; + rs1[1] = '0'; + rs1[2] = '\0'; + m2 = 1; + } + } + + /* Duplicate the first register. */ + for (i = 0; i < 7 && str[i] != ','; i++) + rd[i] = ptr[i]; + + if (str[i] != ',') + goto badoperand_load; + else + rd[i] = '\0'; + + /* Copy the immd. */ + if (m2) + /* Put the '\0' back in. */ + pb = idx + 1; + + for (i++, m2 = 0; i < pb; m2++,i++) + imm[m2] = ptr[i]; + + imm[m2] = '\0'; + + /* Assemble the instruction to gas internal format. */ + for (i = 0; rd[i] != '\0'; i++) + iBuf[i] = rd[i]; + + iBuf[i++] = ','; + + for (pb = 0 ; rs1[pb] != '\0'; i++, pb++) + iBuf[i] = rs1[pb]; + + iBuf[i++] = ','; + + for (pb = 0; imm[pb] != '\0'; i++, pb++) + iBuf[i] = imm[pb]; + + iBuf[i] = '\0'; + return iBuf; + } +} + +static char * +dlx_parse_storeop (str) + char * str; +{ + char *ptr = str; + int idx = 0; + + /* Search for the ','. */ + for (idx = 0; idx < 72 && ptr[idx] != ','; idx++) + ; + + if (idx == 72) + { + badoperand_store: + as_bad (_("Bad operand for a store instruction: <%s>"), str); + return NULL; + } + else + { + /* idx now points to the ','. */ + int i, pb = 0; + int comma = idx; + int m2 = 0; + char rs1[7], rd[7], endm, match = '0'; + char imm[72]; + + /* Now parse the '(' and ')', and make idx point to ')'. */ + idx -= 1; + switch (str[idx]) + { + case ')': + match = '('; + endm = ')'; + break; + case ']': + match = '['; + endm = ']'; + break; + default: + /* No register indicated, fill in zero. */ + rs1[0] = 'r'; + rs1[1] = '0'; + rs1[2] = '\0'; + match = 0; + endm = 0; + m2 = 1; + } + + if (!m2) + { + /* Searching for (/[ which will match the ]/). */ + for (pb = idx - 1; str[pb] != match; pb -= 1) + if (pb < (idx - 5) || str[pb] == endm) + goto store_no_rs1; + pb += 1; + + for (i = 0; (pb + i) < idx; i++) + rs1[i] = str[pb + i]; + + rs1[i] = '\0'; + + if (is_ldst_registers (& rs1[0])) + /* Point to the last character of the imm. */ + pb -= 1; + else + { + store_no_rs1: + if (match == '[') + goto badoperand_store; + + /* No register indicated, fill in zero and restore the imm. */ + rs1[0] = 'r'; + rs1[1] = '0'; + rs1[2] = '\0'; + pb = comma; + } + } + else + /* No register was specified. */ + pb = comma; + + /* Duplicate the first register. */ + for (i = comma + 1; (str[i] == ' ' || str[i] == '\t'); i++) + ; + + for (m2 = 0; (m2 < 7 && str[i] != '\0'); i++, m2++) + { + if (str[i] != ' ' && str[i] != '\t') + rd[m2] = str[i]; + else + goto badoperand_store; + } + + if (str[i] != '\0') + goto badoperand_store; + else + rd[m2] = '\0'; + + /* Copy the immd. */ + for (i = 0; i < pb; i++) + imm[i] = ptr[i]; + + imm[i] = '\0'; + + /* Assemble the instruction to gas internal format. */ + for (i = 0; rd[i] != '\0'; i++) + iBuf[i] = rd[i]; + iBuf[i++] = ','; + for (pb = 0 ; rs1[pb] != '\0'; i++, pb++) + iBuf[i] = rs1[pb]; + iBuf[i++] = ','; + for (pb = 0; imm[pb] != '\0'; i++, pb++) + iBuf[i] = imm[pb]; + iBuf[i] = '\0'; + return iBuf; + } +} + +static char * +fix_ld_st_operand (opcode, str) + unsigned long opcode; + char* str; +{ + /* Check the opcode. */ + switch ((int) opcode) + { + case LBOP: + case LBUOP: + case LSBUOP: + case LHOP: + case LHUOP: + case LSHUOP: + case LWOP: + case LSWOP: + return dlx_parse_loadop (str); + case SBOP: + case SHOP: + case SWOP: + return dlx_parse_storeop (str); + default: + return str; + } +} + +/* Instruction parsing. Takes a string containing the opcode. + Operands are at input_line_pointer. Output is in the_insn. + Warnings or errors are generated. */ + +static void +machine_ip (str) + char *str; +{ + char *s; + const char *args; + struct machine_opcode *insn; + char *argsStart; + unsigned long opcode; + expressionS the_operand; + expressionS *operand = &the_operand; + unsigned int reg, reg_shift = 0; + + /* Fixup the opcode string to all lower cases, and also + allow numerical digits. */ + s = str; + + if (ISALPHA (*s)) + for (; ISALNUM (*s); ++s) + if (ISUPPER (*s)) + *s = TOLOWER (*s); + + switch (*s) + { + case '\0': + break; + + /* FIXME-SOMEDAY more whitespace. */ + case ' ': + *s++ = '\0'; + break; + + default: + as_bad (_("Unknown opcode: `%s'"), str); + return; + } + + /* Hash the opcode, insn will have the string from opcode table. + also initialized the_insn struct. */ + if ((insn = (struct machine_opcode *) hash_find (op_hash, str)) == NULL) + { + /* Handle the ret and return macro here. */ + if ((strcmp (str, "ret") == 0) || (strcmp (str, "return") == 0)) + { + memset (&the_insn, '\0', sizeof (the_insn)); + the_insn.reloc = NO_RELOC; + the_insn.pcrel = 0; + the_insn.opcode = + (unsigned long)(JROP | 0x03e00000); /* 0x03e00000 = r31 << 21 */ + } + else + as_bad (_("Unknown opcode `%s'."), str); + + return; + } + + argsStart = s; + opcode = insn->opcode; + memset (&the_insn, '\0', sizeof (the_insn)); + the_insn.reloc = NO_RELOC; + the_insn.pcrel = 0; + + /* Set the sip reloc HI16 flag. */ + if (!set_dlx_skip_hi16_flag (1)) + as_bad (_("Can not set dlx_skip_hi16_flag")); + + /* Fix the operand string if it is one of load store instructions. */ + s = fix_ld_st_operand (opcode, s); + + /* Build the opcode, checking as we go to make sure that the + operands match. + If an operand matches, we modify the_insn or opcode appropriately, + and do a "continue". If an operand fails to match, we "break". */ + if (insn->args[0] != '\0' && insn->args[0] != 'N') + { + /* Prime the pump. */ + if (*s == '\0') + { + as_bad (_("Missing arguments for opcode <%s>."), str); + return; + } + else + s = parse_operand (s, operand); + } + else if (insn->args[0] == 'N') + { + /* Clean up the insn and done! */ + the_insn.opcode = opcode; + return; + } + + /* Parse through the args (this is from opcode table), *s point to + the current character of the instruction stream. */ + for (args = insn->args;; ++args) + { + switch (*args) + { + /* End of Line. */ + case '\0': + /* End of args. */ + if (*s == '\0') + { + /* We are truly done. */ + the_insn.opcode = opcode; + /* Clean up the HI and LO mark. */ + the_insn.HI = 0; + the_insn.LO = 0; + return; + } + + the_insn.HI = 0; + the_insn.LO = 0; + as_bad (_("Too many operands: %s"), s); + break; + + /* ',' Args separator */ + case ',': + /* Must match a comma. */ + if (*s++ == ',') + { + /* Parse next operand. */ + s = parse_operand (s, operand); + continue; + } + break; + + /* It can be a 'a' register or 'i' operand. */ + case 'P': + /* Macro move operand/reg. */ + if (operand->X_op == O_register) + { + /* Its a register. */ + reg_shift = 21; + goto general_reg; + } + + /* The immediate 16 bits literal, bit 0-15. */ + case 'i': + /* offset, unsigned. */ + case 'I': + /* offset, signed. */ + if (operand->X_op == O_constant) + { + if (the_insn.HI) + operand->X_add_number >>= 16; + + opcode |= operand->X_add_number & 0xFFFF; + + if (the_insn.HI && the_insn.LO) + as_bad (_("Both the_insn.HI and the_insn.LO are set : %s"), s); + else + { + the_insn.HI = 0; + the_insn.LO = 0; + } + continue; + } + + the_insn.reloc = (the_insn.HI) ? RELOC_DLX_HI16 + : (the_insn.LO ? RELOC_DLX_LO16 : RELOC_DLX_16); + the_insn.reloc_offset = 2; + the_insn.size = 2; + the_insn.pcrel = 0; + the_insn.exp = * operand; + the_insn.HI = 0; + the_insn.LO = 0; + continue; + + case 'd': + /* offset, signed. */ + if (operand->X_op == O_constant) + { + opcode |= operand->X_add_number & 0xFFFF; + continue; + } + the_insn.reloc = RELOC_DLX_REL16; + the_insn.reloc_offset = 0; /* BIG-ENDIAN Byte 3 of insn. */ + the_insn.size = 4; + the_insn.pcrel = 1; + the_insn.exp = *operand; + continue; + + /* The immediate 26 bits literal, bit 0-25. */ + case 'D': + /* offset, signed. */ + if (operand->X_op == O_constant) + { + opcode |= operand->X_add_number & 0x3FFFFFF; + continue; + } + the_insn.reloc = RELOC_DLX_REL26; + the_insn.reloc_offset = 0; /* BIG-ENDIAN Byte 3 of insn. */ + the_insn.size = 4; + the_insn.pcrel = 1; + the_insn.exp = *operand; + continue; + + /* Type 'a' Register. */ + case 'a': + /* A general register at bits 21-25, rs1. */ + know (operand->X_op != O_register); + reg_shift = 21; + goto general_reg; + + /* Type 'b' Register. */ + case 'b': + /* A general register at bits 16-20, rs2/rd. */ + know (operand->X_op != O_register); + reg_shift = 16; + goto general_reg; + + /* Type 'c' Register. */ + case 'c': + /* A general register at bits 11-15, rd. */ + know (operand->X_op != O_register); + reg_shift = 11; + + general_reg: + know (operand->X_add_symbol == 0); + know (operand->X_op_symbol == 0); + reg = operand->X_add_number; + if (reg & 0xffffffe0) + as_fatal (_("failed regnum sanity check.")); + else + /* Got the register, now figure out where it goes in the opcode. */ + opcode |= reg << reg_shift; + + switch (*args) + { + case 'a': + case 'b': + case 'c': + case 'P': + continue; + } + as_fatal (_("failed general register sanity check.")); + break; + + default: + BAD_CASE (*args); + } + + /* Types or values of args don't match. */ + as_bad ("Invalid operands"); + return; + } +} + +/* This is identical to the md_atof in m68k.c. I think this is right, + but I'm not sure. + + Turn a string in input_line_pointer into a floating point constant + of type TYPE, and store the appropriate bytes in *LITP. The number + of LITTLENUMS emitted is stored in *SIZEP. An error message is + returned, or NULL on OK. */ +/* Dlx will not use it anyway, so I just leave it here for now. */ + +/* Equal to MAX_PRECISION in atof-ieee.c. */ +#define MAX_LITTLENUMS 6 + +char * +md_atof (type, litP, sizeP) + char type; + char *litP; + int *sizeP; +{ + int prec; + LITTLENUM_TYPE words[MAX_LITTLENUMS]; + LITTLENUM_TYPE *wordP; + char *t; + + switch (type) + { + case 'f': + case 'F': + case 's': + case 'S': + prec = 2; + break; + + case 'd': + case 'D': + case 'r': + case 'R': + prec = 4; + break; + + case 'x': + case 'X': + prec = 6; + break; + + case 'p': + case 'P': + prec = 6; + break; + + default: + *sizeP = 0; + return "Bad call to MD_ATOF()"; + } + + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + + *sizeP = prec * sizeof (LITTLENUM_TYPE); + + for (wordP = words; prec--;) + { + md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } + + return 0; +} + +/* Write out big-endian. */ +void +md_number_to_chars (buf, val, n) + char *buf; + valueT val; + int n; +{ + number_to_chars_bigendian (buf, val, n); +} + +/* md_chars_to_number: convert from target byte order to host byte order. */ + +int +md_chars_to_number (val, n) + unsigned char *val; /* Value in target byte order. */ + int n; /* Number of bytes in the input. */ +{ + int retval; + + for (retval = 0; n--;) + { + retval <<= 8; + retval |= val[n]; + } + + return retval; +} + +bfd_boolean +md_dlx_fix_adjustable (fixP) + fixS *fixP; +{ + /* We need the symbol name for the VTABLE entries. */ + return (fixP->fx_r_type != BFD_RELOC_VTABLE_INHERIT + && fixP->fx_r_type != BFD_RELOC_VTABLE_ENTRY); +} + +void +md_apply_fix3 (fixP, valP, seg) + fixS *fixP; + valueT *valP; + segT seg ATTRIBUTE_UNUSED; +{ + long val = *valP; + char *place = fixP->fx_where + fixP->fx_frag->fr_literal; + + know (fixP->fx_size == 4); + know (fixP->fx_r_type < NO_RELOC); + + switch (fixP->fx_r_type) + { + case RELOC_DLX_LO16: + case RELOC_DLX_REL16: + if (fixP->fx_bit_fixP != (bit_fixS *) NULL) + { + val = (val & 0x0000FFFF) | fixP->fx_bit_fixP->fx_bit_base; + free (fixP->fx_bit_fixP); + fixP->fx_bit_fixP = (bit_fixS *) NULL; + } +#ifdef DEBUG + else + know ((fixP->fx_bit_fixP != (bit_fixS *) NULL)); +#endif + break; + + case RELOC_DLX_HI16: + if (fixP->fx_bit_fixP != (bit_fixS *) NULL) + { + val = (val >> 16) | fixP->fx_bit_fixP->fx_bit_base; + free (fixP->fx_bit_fixP); + fixP->fx_bit_fixP = (bit_fixS *)NULL; + } +#ifdef DEBUG + else + know ((fixP->fx_bit_fixP != (bit_fixS *) NULL)); +#endif + break; + + case RELOC_DLX_REL26: + if (fixP->fx_bit_fixP != (bit_fixS *) NULL) + { + val = (val & 0x03FFFFFF) | fixP->fx_bit_fixP->fx_bit_base; + free (fixP->fx_bit_fixP); + fixP->fx_bit_fixP = (bit_fixS *) NULL; + } +#ifdef DEBUG + else + know ((fixP->fx_bit_fixP != (bit_fixS *) NULL)); +#endif + break; + + case BFD_RELOC_VTABLE_INHERIT: + /* This borrowed from tc-ppc.c on a whim. */ + fixP->fx_done = 0; + if (fixP->fx_addsy + && !S_IS_DEFINED (fixP->fx_addsy) + && !S_IS_WEAK (fixP->fx_addsy)) + S_SET_WEAK (fixP->fx_addsy); + return; + + case BFD_RELOC_VTABLE_ENTRY: + fixP->fx_done = 0; + return; + + default: + break; + } + + number_to_chars_bigendian (place, val, fixP->fx_size); + if (fixP->fx_addsy == NULL) + fixP->fx_done = 1; +} + +const char *md_shortopts = ""; + +struct option md_longopts[] = + { + {NULL, no_argument, NULL, 0} + }; + +size_t md_longopts_size = sizeof (md_longopts); + +int +md_parse_option (c, arg) + int c ATTRIBUTE_UNUSED; + char *arg ATTRIBUTE_UNUSED; +{ + return 0; +} + +void +md_show_usage (stream) + FILE *stream ATTRIBUTE_UNUSED; +{ +} + +/* This is called when a line is unrecognized. */ + +int +dlx_unrecognized_line (c) + int c; +{ + int lab; + char *s; + + if (c != '$' || ! ISDIGIT ((unsigned char) input_line_pointer[0])) + return 0; + + s = input_line_pointer; + + lab = 0; + while (ISDIGIT ((unsigned char) *s)) + { + lab = lab * 10 + *s - '0'; + ++s; + } + + if (*s != ':') + { + /* Not a label definition. */ + return 0; + } + + if (dollar_label_defined (lab)) + { + as_bad (_("label \"$%d\" redefined"), lab); + return 0; + } + + define_dollar_label (lab); + colon (dollar_label_name (lab, 0)); + input_line_pointer = s + 1; + + return 1; +} + +/* Default the values of symbols known that should be "predefined". We + don't bother to predefine them unless you actually use one, since there + are a lot of them. */ + +symbolS * +md_undefined_symbol (name) + char *name ATTRIBUTE_UNUSED; +{ + return NULL; +} + + +/* Parse an operand that is machine-specific, the function was called + in expr.c by operand() function, when everything failed before it + call a quit. */ + +void +md_operand (expressionP) + expressionS* expressionP; +{ + /* Check for the #number representation */ + if (input_line_pointer[0] == '#' && + ISDIGIT ((unsigned char) input_line_pointer[1])) + { + /* We have a numeric number expression. No biggy. */ + input_line_pointer += 1; /* Skip # */ + + (void) expression (expressionP); + + if (expressionP->X_op != O_constant) + as_bad (_("Invalid expression after # number\n")); + } + + return; +#if 0 + else if (input_line_pointer[0] == '$' + && ISDIGIT ((unsigned char) input_line_pointer[1])) + { + long lab; + char *name; + symbolS *sym; + + /* This is a local label. */ + ++input_line_pointer; + lab = (long) get_absolute_expression (); + if (dollar_label_defined (lab)) + { + name = dollar_label_name (lab, 0); + sym = symbol_find (name); + } + else + { + name = dollar_label_name (lab, 1); + sym = symbol_find_or_make (name); + } + + expressionP->X_op = O_symbol; + expressionP->X_add_symbol = sym; + expressionP->X_add_number = 0; + } +#endif +} + +/* Round up a section size to the appropriate boundary. */ + +valueT +md_section_align (segment, size) + segT segment ATTRIBUTE_UNUSED; + valueT size; +{ + /* Byte alignment is fine. */ + return size; +} + +/* Exactly what point is a PC-relative offset relative TO? + On the 29000, they're relative to the address of the instruction, + which we have set up as the address of the fixup too. */ + +long +md_pcrel_from (fixP) + fixS* fixP; +{ + return 4 + fixP->fx_where + fixP->fx_frag->fr_address; +} + +/* From cgen.c: */ + +#if 0 +static short +tc_bfd_fix2rtype (fixP) + fixS* fixP; +{ +#if 0 + if (fixP->fx_bsr) + abort (); +#endif + + if (fixP->fx_pcrel == 0 && fixP->fx_size == 4) + return BFD_RELOC_32; + + if (fixP->fx_pcrel != 0 && fixP->fx_size == 4) + return BFD_RELOC_26_PCREL; + + abort (); + + return 0; +} +#endif + +/* Translate internal representation of relocation info to BFD target + format. + FIXME: To what extent can we get all relevant targets to use this? + The above FIXME is from a29k, but I think it is also needed here. */ + +arelent * +tc_gen_reloc (section, fixP) + asection *section ATTRIBUTE_UNUSED; + fixS *fixP; +{ + arelent * reloc; + + reloc = (arelent *) xmalloc (sizeof (arelent)); + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type); + + if (reloc->howto == (reloc_howto_type *) NULL) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + "internal error: can't export reloc type %d (`%s')", + fixP->fx_r_type, + bfd_get_reloc_code_name (fixP->fx_r_type)); + return NULL; + } + + assert (!fixP->fx_pcrel == !reloc->howto->pc_relative); + + reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); + *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy); + reloc->address = fixP->fx_frag->fr_address + fixP->fx_where; + + if (fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) + reloc->address = fixP->fx_offset; + reloc->addend = 0; + + return reloc; +} + +extern void pop_insert PARAMS ((const pseudo_typeS *)); + +void +dlx_pop_insert () +{ + pop_insert (dlx_pseudo_table); + return ; +} diff --git a/gas/config/tc-dlx.h b/gas/config/tc-dlx.h new file mode 100644 index 0000000000000..9aab0d2d4f105 --- /dev/null +++ b/gas/config/tc-dlx.h @@ -0,0 +1,94 @@ +/* tc-dlx.h -- Assemble for the DLX + Copyright 2002, 2003 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* Initially created by Kuang Hwa Lin, 3/20/2002. */ + +#define TC_DLX + +#ifndef BFD_ASSEMBLER + #error DLX support requires BFD_ASSEMBLER +#endif + +#ifndef __BFD_H_SEEN__ +#include "bfd.h" +#endif + +/* The target BFD architecture. */ +#define TARGET_ARCH bfd_arch_dlx +#define TARGET_FORMAT "elf32-dlx" +#define TARGET_BYTES_BIG_ENDIAN 1 + +#define WORKING_DOT_WORD + +#define LEX_DOLLAR 1 + +/* #define md_operand(x) */ +extern void dlx_pop_insert PARAMS ((void)); +extern int set_dlx_skip_hi16_flag PARAMS ((int)); + +#define md_pop_insert() dlx_pop_insert () + +#define md_convert_frag(b,s,f) as_fatal ("convert_frag called\n") +#define md_estimate_size_before_relax(f,s) \ + (as_fatal ("estimate_size_before_relax called"),1) + +#define tc_unrecognized_line(c) dlx_unrecognized_line (c) + +extern int dlx_unrecognized_line PARAMS ((int)); + +#define tc_headers_hook(a) ; /* not used */ +#define tc_headers_hook(a) ; /* not used */ +#define tc_crawl_symbol_chain(a) ; /* not used */ +#define tc_coff_symbol_emit_hook(a) ; /* not used */ + +#define AOUT_MACHTYPE 101 +#define TC_COFF_FIX2RTYPE(fix_ptr) tc_coff_fix2rtype (fix_ptr) +#define BFD_ARCH bfd_arch_dlx +#define COFF_MAGIC DLXMAGIC +/* Should the reloc be output ? + on the 29k, this is true only if there is a symbol attached. + on the h8, this is always true, since no fixup is done + on dlx, I have no idea!! but lets keep it here just for fun. +*/ +#define TC_COUNT_RELOC(x) (x->fx_addsy) +#define TC_CONS_RELOC BFD_RELOC_32_PCREL + +/* No shared lib support, so we don't need to ensure externally + visible symbols can be overridden. */ +#define EXTERN_FORCE_RELOC 0 + +#define tc_fix_adjustable(FIX) md_dlx_fix_adjustable (FIX) +extern bfd_boolean md_dlx_fix_adjustable PARAMS ((struct fix *)); + +/* Values passed to md_apply_fix3 don't include the symbol value. */ +#define MD_APPLY_SYM_VALUE(FIX) 0 + +#define NEED_FX_R_TYPE + +/* Zero Based Segment?? sound very dangerous to me! */ +#define ZERO_BASED_SEGMENTS + +/* Permit temporary numeric labels. */ +#define LOCAL_LABELS_FB 1 + +#undef LOCAL_LABELS_DOLLAR +#define LOCAL_LABELS_DOLLAR 0 + +#define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */ diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c new file mode 100644 index 0000000000000..b47903e4486a1 --- /dev/null +++ b/gas/config/tc-fr30.c @@ -0,0 +1,640 @@ +/* tc-fr30.c -- Assembler for the Fujitsu FR30. + Copyright 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include "as.h" +#include "safe-ctype.h" +#include "subsegs.h" +#include "symcat.h" +#include "opcodes/fr30-desc.h" +#include "opcodes/fr30-opc.h" +#include "cgen.h" + +/* Structure to hold all of the different components describing + an individual instruction. */ +typedef struct +{ + const CGEN_INSN * insn; + const CGEN_INSN * orig_insn; + CGEN_FIELDS fields; +#if CGEN_INT_INSN_P + CGEN_INSN_INT buffer [1]; +#define INSN_VALUE(buf) (*(buf)) +#else + unsigned char buffer [CGEN_MAX_INSN_SIZE]; +#define INSN_VALUE(buf) (buf) +#endif + char * addr; + fragS * frag; + int num_fixups; + fixS * fixups [GAS_CGEN_MAX_FIXUPS]; + int indices [MAX_OPERAND_INSTANCES]; +} +fr30_insn; + +const char comment_chars[] = ";"; +const char line_comment_chars[] = "#"; +const char line_separator_chars[] = "|"; +const char EXP_CHARS[] = "eE"; +const char FLT_CHARS[] = "dD"; + +#define FR30_SHORTOPTS "" +const char * md_shortopts = FR30_SHORTOPTS; + +struct option md_longopts[] = +{ + {NULL, no_argument, NULL, 0} +}; +size_t md_longopts_size = sizeof (md_longopts); + +int +md_parse_option (c, arg) + int c ATTRIBUTE_UNUSED; + char *arg ATTRIBUTE_UNUSED; +{ + switch (c) + { + default: + return 0; + } + return 1; +} + +void +md_show_usage (stream) + FILE * stream; +{ + fprintf (stream, _(" FR30 specific command line options:\n")); +} + +/* The target specific pseudo-ops which we support. */ +const pseudo_typeS md_pseudo_table[] = +{ + { "word", cons, 4 }, + { NULL, NULL, 0 } +}; + + +void +md_begin () +{ + /* Initialize the `cgen' interface. */ + + /* Set the machine number and endian. */ + gas_cgen_cpu_desc = fr30_cgen_cpu_open (CGEN_CPU_OPEN_MACHS, 0, + CGEN_CPU_OPEN_ENDIAN, + CGEN_ENDIAN_BIG, + CGEN_CPU_OPEN_END); + fr30_cgen_init_asm (gas_cgen_cpu_desc); + + /* This is a callback from cgen to gas to parse operands. */ + cgen_set_parse_operand_fn (gas_cgen_cpu_desc, gas_cgen_parse_operand); +} + +void +md_assemble (str) + char *str; +{ + static int last_insn_had_delay_slot = 0; + fr30_insn insn; + char *errmsg; + + /* Initialize GAS's cgen interface for a new instruction. */ + gas_cgen_init_parse (); + + insn.insn = fr30_cgen_assemble_insn + (gas_cgen_cpu_desc, str, & insn.fields, insn.buffer, & errmsg); + + if (!insn.insn) + { + as_bad (errmsg); + return; + } + + /* Doesn't really matter what we pass for RELAX_P here. */ + gas_cgen_finish_insn (insn.insn, insn.buffer, + CGEN_FIELDS_BITSIZE (& insn.fields), 1, NULL); + + /* Warn about invalid insns in delay slots. */ + if (last_insn_had_delay_slot + && CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_NOT_IN_DELAY_SLOT)) + as_warn (_("Instruction %s not allowed in a delay slot."), + CGEN_INSN_NAME (insn.insn)); + + last_insn_had_delay_slot + = CGEN_INSN_ATTR_VALUE (insn.insn, CGEN_INSN_DELAY_SLOT); +} + +/* The syntax in the manual says constants begin with '#'. + We just ignore it. */ + +void +md_operand (expressionP) + expressionS * expressionP; +{ + if (* input_line_pointer == '#') + { + input_line_pointer ++; + expression (expressionP); + } +} + +valueT +md_section_align (segment, size) + segT segment; + valueT size; +{ + int align = bfd_get_section_alignment (stdoutput, segment); + return ((size + (1 << align) - 1) & (-1 << align)); +} + +symbolS * +md_undefined_symbol (name) + char *name ATTRIBUTE_UNUSED; +{ + return 0; +} + +/* Interface to relax_segment. */ + +/* FIXME: Build table by hand, get it working, then machine generate. */ + +const relax_typeS md_relax_table[] = +{ +/* The fields are: + 1) most positive reach of this state, + 2) most negative reach of this state, + 3) how many bytes this mode will add to the size of the current frag + 4) which index into the table to try if we can't fit into this one. */ + + /* The first entry must be unused because an `rlx_more' value of zero ends + each list. */ + {1, 1, 0, 0}, + + /* The displacement used by GAS is from the end of the 2 byte insn, + so we subtract 2 from the following. */ + /* 16 bit insn, 8 bit disp -> 10 bit range. + This doesn't handle a branch in the right slot at the border: + the "& -4" isn't taken into account. It's not important enough to + complicate things over it, so we subtract an extra 2 (or + 2 in -ve + case). */ + {511 - 2 - 2, -512 - 2 + 2, 0, 2 }, + /* 32 bit insn, 24 bit disp -> 26 bit range. */ + {0x2000000 - 1 - 2, -0x2000000 - 2, 2, 0 }, + /* Same thing, but with leading nop for alignment. */ + {0x2000000 - 1 - 2, -0x2000000 - 2, 4, 0 } +}; + +#if 0 +long +fr30_relax_frag (segment, fragP, stretch) + segT segment; + fragS * fragP; + long stretch; +{ + /* Address of branch insn. */ + long address = fragP->fr_address + fragP->fr_fix - 2; + long growth = 0; + + /* Keep 32 bit insns aligned on 32 bit boundaries. */ + if (fragP->fr_subtype == 2) + { + if ((address & 3) != 0) + { + fragP->fr_subtype = 3; + growth = 2; + } + } + else if (fragP->fr_subtype == 3) + { + if ((address & 3) == 0) + { + fragP->fr_subtype = 2; + growth = -2; + } + } + else + { + growth = relax_frag (segment, fragP, stretch); + + /* Long jump on odd halfword boundary? */ + if (fragP->fr_subtype == 2 && (address & 3) != 0) + { + fragP->fr_subtype = 3; + growth += 2; + } + } + + return growth; +} +#endif + +/* Return an initial guess of the length by which a fragment must grow to + hold a branch to reach its destination. + Also updates fr_type/fr_subtype as necessary. + + Called just before doing relaxation. + Any symbol that is now undefined will not become defined. + The guess for fr_var is ACTUALLY the growth beyond fr_fix. + Whatever we do to grow fr_fix or fr_var contributes to our returned value. + Although it may not be explicit in the frag, pretend fr_var starts with a + 0 value. */ + +int +md_estimate_size_before_relax (fragP, segment) + fragS * fragP; + segT segment; +{ + /* The only thing we have to handle here are symbols outside of the + current segment. They may be undefined or in a different segment in + which case linker scripts may place them anywhere. + However, we can't finish the fragment here and emit the reloc as insn + alignment requirements may move the insn about. */ + + if (S_GET_SEGMENT (fragP->fr_symbol) != segment) + { +#if 0 + int old_fr_fix = fragP->fr_fix; +#endif + + /* The symbol is undefined in this segment. + Change the relaxation subtype to the max allowable and leave + all further handling to md_convert_frag. */ + fragP->fr_subtype = 2; + +#if 0 /* Can't use this, but leave in for illustration. */ + /* Change 16 bit insn to 32 bit insn. */ + fragP->fr_opcode[0] |= 0x80; + + /* Increase known (fixed) size of fragment. */ + fragP->fr_fix += 2; + + /* Create a relocation for it. */ + fix_new (fragP, old_fr_fix, 4, + fragP->fr_symbol, + fragP->fr_offset, 1 /* pcrel */, + /* FIXME: Can't use a real BFD reloc here. + gas_cgen_md_apply_fix3 can't handle it. */ + BFD_RELOC_FR30_26_PCREL); + + /* Mark this fragment as finished. */ + frag_wane (fragP); + return fragP->fr_fix - old_fr_fix; +#else + { + const CGEN_INSN * insn; + int i; + + /* Update the recorded insn. + Fortunately we don't have to look very far. + FIXME: Change this to record in the instruction the next higher + relaxable insn to use. */ + for (i = 0, insn = fragP->fr_cgen.insn; i < 4; i++, insn++) + { + if ((strcmp (CGEN_INSN_MNEMONIC (insn), + CGEN_INSN_MNEMONIC (fragP->fr_cgen.insn)) + == 0) + && CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED)) + break; + } + if (i == 4) + abort (); + + fragP->fr_cgen.insn = insn; + return 2; + } +#endif + } + + /* Return the size of the variable part of the frag. */ + return md_relax_table[fragP->fr_subtype].rlx_length; +} + +/* *fragP has been relaxed to its final size, and now needs to have + the bytes inside it modified to conform to the new size. + + Called after relaxation is finished. + fragP->fr_type == rs_machine_dependent. + fragP->fr_subtype is the subtype of what the address relaxed to. */ + +void +md_convert_frag (abfd, sec, fragP) + bfd *abfd ATTRIBUTE_UNUSED; + segT sec ATTRIBUTE_UNUSED; + fragS *fragP ATTRIBUTE_UNUSED; +{ +#if 0 + char * opcode; + char * displacement; + int target_address; + int opcode_address; + int extension; + int addend; + + opcode = fragP->fr_opcode; + + /* Address opcode resides at in file space. */ + opcode_address = fragP->fr_address + fragP->fr_fix - 2; + + switch (fragP->fr_subtype) + { + case 1 : + extension = 0; + displacement = & opcode[1]; + break; + case 2 : + opcode[0] |= 0x80; + extension = 2; + displacement = & opcode[1]; + break; + case 3 : + opcode[2] = opcode[0] | 0x80; + md_number_to_chars (opcode, PAR_NOP_INSN, 2); + opcode_address += 2; + extension = 4; + displacement = & opcode[3]; + break; + default : + abort (); + } + + if (S_GET_SEGMENT (fragP->fr_symbol) != sec) + { + /* symbol must be resolved by linker */ + if (fragP->fr_offset & 3) + as_warn (_("Addend to unresolved symbol not on word boundary.")); + addend = fragP->fr_offset >> 2; + } + else + { + /* Address we want to reach in file space. */ + target_address = S_GET_VALUE (fragP->fr_symbol) + fragP->fr_offset; + addend = (target_address - (opcode_address & -4)) >> 2; + } + + /* Create a relocation for symbols that must be resolved by the linker. + Otherwise output the completed insn. */ + + if (S_GET_SEGMENT (fragP->fr_symbol) != sec) + { + assert (fragP->fr_subtype != 1); + assert (fragP->fr_cgen.insn != 0); + gas_cgen_record_fixup (fragP, + /* Offset of branch insn in frag. */ + fragP->fr_fix + extension - 4, + fragP->fr_cgen.insn, + 4 /*length*/, + /* FIXME: quick hack */ +#if 0 + CGEN_OPERAND_ENTRY (fragP->fr_cgen.opindex), +#else + CGEN_OPERAND_ENTRY (FR30_OPERAND_DISP24), +#endif + fragP->fr_cgen.opinfo, + fragP->fr_symbol, fragP->fr_offset); + } + +#define SIZE_FROM_RELAX_STATE(n) ((n) == 1 ? 1 : 3) + + md_number_to_chars (displacement, (valueT) addend, + SIZE_FROM_RELAX_STATE (fragP->fr_subtype)); + + fragP->fr_fix += extension; +#endif +} + +/* Functions concerning relocs. */ + +/* The location from which a PC relative jump should be calculated, + given a PC relative reloc. */ + +long +md_pcrel_from_section (fixP, sec) + fixS * fixP; + segT sec; +{ + if (fixP->fx_addsy != (symbolS *) NULL + && (! S_IS_DEFINED (fixP->fx_addsy) + || S_GET_SEGMENT (fixP->fx_addsy) != sec)) + { + /* The symbol is undefined (or is defined but not in this section). + Let the linker figure it out. */ + return 0; + } + + return (fixP->fx_frag->fr_address + fixP->fx_where) & ~1; +} + +/* Return the bfd reloc type for OPERAND of INSN at fixup FIXP. + Returns BFD_RELOC_NONE if no reloc type can be found. + *FIXP may be modified if desired. */ + +bfd_reloc_code_real_type +md_cgen_lookup_reloc (insn, operand, fixP) + const CGEN_INSN *insn ATTRIBUTE_UNUSED; + const CGEN_OPERAND *operand; + fixS *fixP; +{ + switch (operand->type) + { + case FR30_OPERAND_LABEL9: fixP->fx_pcrel = 1; return BFD_RELOC_FR30_9_PCREL; + case FR30_OPERAND_LABEL12: fixP->fx_pcrel = 1; return BFD_RELOC_FR30_12_PCREL; + case FR30_OPERAND_DISP10: return BFD_RELOC_FR30_10_IN_8; + case FR30_OPERAND_DISP9: return BFD_RELOC_FR30_9_IN_8; + case FR30_OPERAND_DISP8: return BFD_RELOC_FR30_8_IN_8; + case FR30_OPERAND_UDISP6: return BFD_RELOC_FR30_6_IN_4; + case FR30_OPERAND_I8: return BFD_RELOC_8; + case FR30_OPERAND_I32: return BFD_RELOC_FR30_48; + case FR30_OPERAND_I20: return BFD_RELOC_FR30_20; + default : /* avoid -Wall warning */ + break; + } + + return BFD_RELOC_NONE; +} + +/* Write a value out to the object file, using the appropriate endianness. */ + +void +md_number_to_chars (buf, val, n) + char * buf; + valueT val; + int n; +{ + number_to_chars_bigendian (buf, val, n); +} + +/* Turn a string in input_line_pointer into a floating point constant of type + type, and store the appropriate bytes in *litP. The number of LITTLENUMS + emitted is stored in *sizeP . An error message is returned, or NULL on OK. +*/ + +/* Equal to MAX_PRECISION in atof-ieee.c */ +#define MAX_LITTLENUMS 6 + +char * +md_atof (type, litP, sizeP) + char type; + char * litP; + int * sizeP; +{ + int i; + int prec; + LITTLENUM_TYPE words [MAX_LITTLENUMS]; + char * t; + + switch (type) + { + case 'f': + case 'F': + case 's': + case 'S': + prec = 2; + break; + + case 'd': + case 'D': + case 'r': + case 'R': + prec = 4; + break; + + /* FIXME: Some targets allow other format chars for bigger sizes here. */ + + default: + * sizeP = 0; + return _("Bad call to md_atof()"); + } + + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + * sizeP = prec * sizeof (LITTLENUM_TYPE); + + for (i = 0; i < prec; i++) + { + md_number_to_chars (litP, (valueT) words[i], + sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } + + return 0; +} + +/* Worker function for fr30_is_colon_insn(). */ +static char restore_colon PARAMS ((int)); + +static char +restore_colon (advance_i_l_p_by) + int advance_i_l_p_by; +{ + char c; + + /* Restore the colon, and advance input_line_pointer to + the end of the new symbol. */ + * input_line_pointer = ':'; + input_line_pointer += advance_i_l_p_by; + c = * input_line_pointer; + * input_line_pointer = 0; + + return c; +} + +/* Determines if the symbol starting at START and ending in + a colon that was at the location pointed to by INPUT_LINE_POINTER + (but which has now been replaced bu a NUL) is in fact an + LDI:8, LDI:20, LDI:32, CALL:D. JMP:D, RET:D or Bcc:D instruction. + If it is, then it restores the colon, advances INPUT_LINE_POINTER + to the real end of the instruction/symbol, and returns the character + that really terminated the symbol. Otherwise it returns 0. */ +char +fr30_is_colon_insn (start) + char * start; +{ + char * i_l_p = input_line_pointer; + + /* Check to see if the symbol parsed so far is 'ldi' */ + if ( (start[0] != 'l' && start[0] != 'L') + || (start[1] != 'd' && start[1] != 'D') + || (start[2] != 'i' && start[2] != 'I') + || start[3] != 0) + { + /* Nope - check to see a 'd' follows the colon. */ + if ( (i_l_p[1] == 'd' || i_l_p[1] == 'D') + && (i_l_p[2] == ' ' || i_l_p[2] == '\t' || i_l_p[2] == '\n')) + { + /* Yup - it might be delay slot instruction. */ + int i; + static char * delay_insns [] = + { + "call", "jmp", "ret", "bra", "bno", + "beq", "bne", "bc", "bnc", "bn", + "bp", "bv", "bnv", "blt", "bge", + "ble", "bgt", "bls", "bhi" + }; + + for (i = sizeof (delay_insns) / sizeof (delay_insns[0]); i--;) + { + char * insn = delay_insns[i]; + int len = strlen (insn); + + if (start [len] != 0) + continue; + + while (len --) + if (TOLOWER (start [len]) != insn [len]) + break; + + if (len == -1) + return restore_colon (1); + } + } + + /* Nope - it is a normal label. */ + return 0; + } + + /* Check to see if the text following the colon is '8' */ + if (i_l_p[1] == '8' && (i_l_p[2] == ' ' || i_l_p[2] == '\t')) + return restore_colon (2); + + /* Check to see if the text following the colon is '20' */ + else if (i_l_p[1] == '2' && i_l_p[2] =='0' && (i_l_p[3] == ' ' || i_l_p[3] == '\t')) + return restore_colon (3); + + /* Check to see if the text following the colon is '32' */ + else if (i_l_p[1] == '3' && i_l_p[2] =='2' && (i_l_p[3] == ' ' || i_l_p[3] == '\t')) + return restore_colon (3); + + return 0; +} + +bfd_boolean +fr30_fix_adjustable (fixP) + fixS * fixP; +{ + /* We need the symbol name for the VTABLE entries */ + if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT + || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) + return 0; + + return 1; +} diff --git a/gas/config/tc-fr30.h b/gas/config/tc-fr30.h new file mode 100644 index 0000000000000..8c1166b9051bb --- /dev/null +++ b/gas/config/tc-fr30.h @@ -0,0 +1,75 @@ +/* tc-fr30.h -- Header file for tc-fr30.c. + Copyright 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define TC_FR30 + +#ifndef BFD_ASSEMBLER +/* leading space so will compile with cc */ + #error FR30 support requires BFD_ASSEMBLER +#endif + +#define LISTING_HEADER "FR30 GAS " + +/* The target BFD architecture. */ +#define TARGET_ARCH bfd_arch_fr30 + +#define TARGET_FORMAT "elf32-fr30" + +#define TARGET_BYTES_BIG_ENDIAN 1 + +/* Permit temporary numeric labels. */ +#define LOCAL_LABELS_FB 1 + +#define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */ + +/* We don't need to handle .word strangely. */ +#define WORKING_DOT_WORD + +/* Values passed to md_apply_fix3 don't include the symbol value. */ +#define MD_APPLY_SYM_VALUE(FIX) 0 + +#define md_apply_fix3 gas_cgen_md_apply_fix3 + +#define tc_fix_adjustable(FIX) fr30_fix_adjustable (FIX) +struct fix; +extern bfd_boolean fr30_fix_adjustable PARAMS ((struct fix *)); + +#define tc_gen_reloc gas_cgen_tc_gen_reloc + +/* Call md_pcrel_from_section(), not md_pcrel_from(). */ +#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC) +extern long md_pcrel_from_section PARAMS ((struct fix *, segT)); + +/* For 8 vs 16 vs 32 bit branch selection. */ +#define TC_GENERIC_RELAX_TABLE md_relax_table +extern const struct relax_type md_relax_table[]; + +/* We need a special version of the TC_START_LABEL macro so that we + allow the LDI:8, LDI:20, LDI:32 and delay slot instructions to be + parsed as such. Note - in a HORRIBLE HACK, we make use of the + knowledge that this marco is only ever evaluated in one place + (read_a_source_file in read.c) where we can access the local + variable 's' - the start of the symbol that was terminated by + 'character'. Also we need to be able to change the contents of + the local variable 'c' which is passed to this macro as 'character'. */ +#define TC_START_LABEL(character, i_l_p) \ + ((character) != ':' ? 0 : (character = fr30_is_colon_insn (s)) ? 0 : ((character = ':'), 1)) +extern char fr30_is_colon_insn PARAMS ((char *)); diff --git a/gas/config/tc-frv.c b/gas/config/tc-frv.c new file mode 100644 index 0000000000000..7c802b9fe3a13 --- /dev/null +++ b/gas/config/tc-frv.c @@ -0,0 +1,1776 @@ +/* tc-frv.c -- Assembler for the Fujitsu FRV. + Copyright 2002, 2003 Free Software Foundation. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include "as.h" +#include "subsegs.h" +#include "symcat.h" +#include "opcodes/frv-desc.h" +#include "opcodes/frv-opc.h" +#include "cgen.h" +#include "libbfd.h" +#include "elf/common.h" +#include "elf/frv.h" + +/* Structure to hold all of the different components describing + an individual instruction. */ +typedef struct +{ + const CGEN_INSN * insn; + const CGEN_INSN * orig_insn; + CGEN_FIELDS fields; +#if CGEN_INT_INSN_P + CGEN_INSN_INT buffer [1]; +#define INSN_VALUE(buf) (*(buf)) +#else + unsigned char buffer [CGEN_MAX_INSN_SIZE]; +#define INSN_VALUE(buf) (buf) +#endif + char * addr; + fragS * frag; + int num_fixups; + fixS * fixups [GAS_CGEN_MAX_FIXUPS]; + int indices [MAX_OPERAND_INSTANCES]; +} +frv_insn; + +enum vliw_insn_type +{ + VLIW_GENERIC_TYPE, /* Don't care about this insn. */ + VLIW_BRANCH_TYPE, /* A Branch. */ + VLIW_LABEL_TYPE, /* A Label. */ + VLIW_NOP_TYPE, /* A NOP. */ + VLIW_BRANCH_HAS_NOPS /* A Branch that requires NOPS. */ +}; + +/* We're going to use these in the fr_subtype field to mark + whether to keep inserted nops. */ + +#define NOP_KEEP 1 /* Keep these NOPS. */ +#define NOP_DELETE 2 /* Delete these NOPS. */ + +#define DO_COUNT TRUE +#define DONT_COUNT FALSE + +/* A list of insns within a VLIW insn. */ +struct vliw_insn_list +{ + /* The type of this insn. */ + enum vliw_insn_type type; + + /* The corresponding gas insn information. */ + const CGEN_INSN *insn; + + /* For branches and labels, the symbol that is referenced. */ + symbolS *sym; + + /* For branches, the frag containing the single nop that was generated. */ + fragS *snop_frag; + + /* For branches, the frag containing the double nop that was generated. */ + fragS *dnop_frag; + + /* Pointer to raw data for this insn. */ + char *address; + + /* Next insn in list. */ + struct vliw_insn_list *next; +}; + +static struct vliw_insn_list single_nop_insn = { + VLIW_NOP_TYPE, NULL, NULL, NULL, NULL, NULL, NULL }; + +static struct vliw_insn_list double_nop_insn = { + VLIW_NOP_TYPE, NULL, NULL, NULL, NULL, NULL, NULL }; + +struct vliw_chain +{ + int num; + int insn_count; + struct vliw_insn_list *insn_list; + struct vliw_chain *next; +}; + +static struct vliw_chain *vliw_chain_top; +static struct vliw_chain *current_vliw_chain; +static struct vliw_chain *previous_vliw_chain; +static struct vliw_insn_list *current_vliw_insn; + +const char comment_chars[] = ";"; +const char line_comment_chars[] = "#"; +const char line_separator_chars[] = "!"; +const char EXP_CHARS[] = "eE"; +const char FLT_CHARS[] = "dD"; + +static FRV_VLIW vliw; + +/* Default machine */ + +#ifdef DEFAULT_CPU_FRV +#define DEFAULT_MACHINE bfd_mach_frv +#define DEFAULT_FLAGS EF_FRV_CPU_GENERIC + +#else +#ifdef DEFAULT_CPU_FR300 +#define DEFAULT_MACHINE bfd_mach_fr300 +#define DEFAULT_FLAGS EF_FRV_CPU_FR300 + +#else +#ifdef DEFAULT_CPU_SIMPLE +#define DEFAULT_MACHINE bfd_mach_frvsimple +#define DEFAULT_FLAGS EF_FRV_CPU_SIMPLE + +#else +#ifdef DEFAULT_CPU_TOMCAT +#define DEFAULT_MACHINE bfd_mach_frvtomcat +#define DEFAULT_FLAGS EF_FRV_CPU_TOMCAT + +#else +#ifdef DEFAULT_CPU_FR400 +#define DEFAULT_MACHINE bfd_mach_fr400 +#define DEFAULT_FLAGS EF_FRV_CPU_FR400 + +#else +#ifdef DEFAULT_CPU_FR550 +#define DEFAULT_MACHINE bfd_mach_fr550 +#define DEFAULT_FLAGS EF_FRV_CPU_FR550 + +#else +#define DEFAULT_MACHINE bfd_mach_fr500 +#define DEFAULT_FLAGS EF_FRV_CPU_FR500 +#endif +#endif +#endif +#endif +#endif +#endif + +#ifdef TE_LINUX +# define DEFAULT_FDPIC EF_FRV_FDPIC +#else +# define DEFAULT_FDPIC 0 +#endif + +static unsigned long frv_mach = bfd_mach_frv; + +/* Flags to set in the elf header */ +static flagword frv_flags = DEFAULT_FLAGS | DEFAULT_FDPIC; + +static int frv_user_set_flags_p = 0; +static int frv_pic_p = 0; +static const char *frv_pic_flag = DEFAULT_FDPIC ? "-mfdpic" : (const char *)0; + +/* Print tomcat-specific debugging info. */ +static int tomcat_debug = 0; + +/* Tomcat-specific NOP statistics. */ +static int tomcat_stats = 0; +static int tomcat_doubles = 0; +static int tomcat_singles = 0; + +/* Forward reference to static functions */ +static void frv_set_flags PARAMS ((int)); +static void frv_pic_ptr PARAMS ((int)); +static void frv_frob_file_section PARAMS ((bfd *, asection *, PTR)); + +/* The target specific pseudo-ops which we support. */ +const pseudo_typeS md_pseudo_table[] = +{ + { "eflags", frv_set_flags, 0 }, + { "word", cons, 4 }, + { "picptr", frv_pic_ptr, 4 }, + { NULL, NULL, 0 } +}; + + +#define FRV_SHORTOPTS "G:" +const char * md_shortopts = FRV_SHORTOPTS; + +#define OPTION_GPR_32 (OPTION_MD_BASE) +#define OPTION_GPR_64 (OPTION_MD_BASE + 1) +#define OPTION_FPR_32 (OPTION_MD_BASE + 2) +#define OPTION_FPR_64 (OPTION_MD_BASE + 3) +#define OPTION_SOFT_FLOAT (OPTION_MD_BASE + 4) +#define OPTION_DWORD_YES (OPTION_MD_BASE + 5) +#define OPTION_DWORD_NO (OPTION_MD_BASE + 6) +#define OPTION_DOUBLE (OPTION_MD_BASE + 7) +#define OPTION_NO_DOUBLE (OPTION_MD_BASE + 8) +#define OPTION_MEDIA (OPTION_MD_BASE + 9) +#define OPTION_NO_MEDIA (OPTION_MD_BASE + 10) +#define OPTION_CPU (OPTION_MD_BASE + 11) +#define OPTION_PIC (OPTION_MD_BASE + 12) +#define OPTION_BIGPIC (OPTION_MD_BASE + 13) +#define OPTION_LIBPIC (OPTION_MD_BASE + 14) +#define OPTION_MULADD (OPTION_MD_BASE + 15) +#define OPTION_NO_MULADD (OPTION_MD_BASE + 16) +#define OPTION_TOMCAT_DEBUG (OPTION_MD_BASE + 17) +#define OPTION_TOMCAT_STATS (OPTION_MD_BASE + 18) +#define OPTION_PACK (OPTION_MD_BASE + 19) +#define OPTION_NO_PACK (OPTION_MD_BASE + 20) +#define OPTION_FDPIC (OPTION_MD_BASE + 21) +#define OPTION_NOPIC (OPTION_MD_BASE + 22) + +struct option md_longopts[] = +{ + { "mgpr-32", no_argument, NULL, OPTION_GPR_32 }, + { "mgpr-64", no_argument, NULL, OPTION_GPR_64 }, + { "mfpr-32", no_argument, NULL, OPTION_FPR_32 }, + { "mfpr-64", no_argument, NULL, OPTION_FPR_64 }, + { "mhard-float", no_argument, NULL, OPTION_FPR_64 }, + { "msoft-float", no_argument, NULL, OPTION_SOFT_FLOAT }, + { "mdword", no_argument, NULL, OPTION_DWORD_YES }, + { "mno-dword", no_argument, NULL, OPTION_DWORD_NO }, + { "mdouble", no_argument, NULL, OPTION_DOUBLE }, + { "mno-double", no_argument, NULL, OPTION_NO_DOUBLE }, + { "mmedia", no_argument, NULL, OPTION_MEDIA }, + { "mno-media", no_argument, NULL, OPTION_NO_MEDIA }, + { "mcpu", required_argument, NULL, OPTION_CPU }, + { "mpic", no_argument, NULL, OPTION_PIC }, + { "mPIC", no_argument, NULL, OPTION_BIGPIC }, + { "mlibrary-pic", no_argument, NULL, OPTION_LIBPIC }, + { "mmuladd", no_argument, NULL, OPTION_MULADD }, + { "mno-muladd", no_argument, NULL, OPTION_NO_MULADD }, + { "mtomcat-debug", no_argument, NULL, OPTION_TOMCAT_DEBUG }, + { "mtomcat-stats", no_argument, NULL, OPTION_TOMCAT_STATS }, + { "mpack", no_argument, NULL, OPTION_PACK }, + { "mno-pack", no_argument, NULL, OPTION_NO_PACK }, + { "mfdpic", no_argument, NULL, OPTION_FDPIC }, + { "mnopic", no_argument, NULL, OPTION_NOPIC }, + { NULL, no_argument, NULL, 0 }, +}; + +size_t md_longopts_size = sizeof (md_longopts); + +/* What value to give to bfd_set_gp_size. */ +static int g_switch_value = 8; + +int +md_parse_option (c, arg) + int c; + char * arg; +{ + switch (c) + { + default: + return 0; + + case 'G': + g_switch_value = atoi (arg); + if (! g_switch_value) + frv_flags |= EF_FRV_G0; + break; + + case OPTION_GPR_32: + frv_flags = (frv_flags & ~EF_FRV_GPR_MASK) | EF_FRV_GPR_32; + break; + + case OPTION_GPR_64: + frv_flags = (frv_flags & ~EF_FRV_GPR_MASK) | EF_FRV_GPR_64; + break; + + case OPTION_FPR_32: + frv_flags = (frv_flags & ~EF_FRV_FPR_MASK) | EF_FRV_FPR_32; + break; + + case OPTION_FPR_64: + frv_flags = (frv_flags & ~EF_FRV_FPR_MASK) | EF_FRV_FPR_64; + break; + + case OPTION_SOFT_FLOAT: + frv_flags = (frv_flags & ~EF_FRV_FPR_MASK) | EF_FRV_FPR_NONE; + break; + + case OPTION_DWORD_YES: + frv_flags = (frv_flags & ~EF_FRV_DWORD_MASK) | EF_FRV_DWORD_YES; + break; + + case OPTION_DWORD_NO: + frv_flags = (frv_flags & ~EF_FRV_DWORD_MASK) | EF_FRV_DWORD_NO; + break; + + case OPTION_DOUBLE: + frv_flags |= EF_FRV_DOUBLE; + break; + + case OPTION_NO_DOUBLE: + frv_flags &= ~EF_FRV_DOUBLE; + break; + + case OPTION_MEDIA: + frv_flags |= EF_FRV_MEDIA; + break; + + case OPTION_NO_MEDIA: + frv_flags &= ~EF_FRV_MEDIA; + break; + + case OPTION_MULADD: + frv_flags |= EF_FRV_MULADD; + break; + + case OPTION_NO_MULADD: + frv_flags &= ~EF_FRV_MULADD; + break; + + case OPTION_PACK: + frv_flags &= ~EF_FRV_NOPACK; + break; + + case OPTION_NO_PACK: + frv_flags |= EF_FRV_NOPACK; + break; + + case OPTION_CPU: + { + char *p; + int cpu_flags = EF_FRV_CPU_GENERIC; + + /* Identify the processor type */ + p = arg; + if (strcmp (p, "frv") == 0) + { + cpu_flags = EF_FRV_CPU_GENERIC; + frv_mach = bfd_mach_frv; + } + + else if (strcmp (p, "fr500") == 0) + { + cpu_flags = EF_FRV_CPU_FR500; + frv_mach = bfd_mach_fr500; + } + + else if (strcmp (p, "fr550") == 0) + { + cpu_flags = EF_FRV_CPU_FR550; + frv_mach = bfd_mach_fr550; + } + + else if (strcmp (p, "fr400") == 0) + { + cpu_flags = EF_FRV_CPU_FR400; + frv_mach = bfd_mach_fr400; + } + + else if (strcmp (p, "fr300") == 0) + { + cpu_flags = EF_FRV_CPU_FR300; + frv_mach = bfd_mach_fr300; + } + + else if (strcmp (p, "simple") == 0) + { + cpu_flags = EF_FRV_CPU_SIMPLE; + frv_mach = bfd_mach_frvsimple; + frv_flags |= EF_FRV_NOPACK; + } + + else if (strcmp (p, "tomcat") == 0) + { + cpu_flags = EF_FRV_CPU_TOMCAT; + frv_mach = bfd_mach_frvtomcat; + } + + else + { + as_fatal ("Unknown cpu -mcpu=%s", arg); + return 0; + } + + frv_flags = (frv_flags & ~EF_FRV_CPU_MASK) | cpu_flags; + } + break; + + case OPTION_PIC: + frv_flags |= EF_FRV_PIC; + frv_pic_p = 1; + frv_pic_flag = "-fpic"; + break; + + case OPTION_BIGPIC: + frv_flags |= EF_FRV_BIGPIC; + frv_pic_p = 1; + frv_pic_flag = "-fPIC"; + break; + + case OPTION_LIBPIC: + frv_flags |= (EF_FRV_LIBPIC | EF_FRV_G0); + frv_pic_p = 1; + frv_pic_flag = "-mlibrary-pic"; + g_switch_value = 0; + break; + + case OPTION_FDPIC: + frv_flags |= EF_FRV_FDPIC; + frv_pic_flag = "-mfdpic"; + break; + + case OPTION_NOPIC: + frv_flags &= ~(EF_FRV_FDPIC | EF_FRV_PIC + | EF_FRV_BIGPIC | EF_FRV_LIBPIC); + frv_pic_flag = 0; + break; + + case OPTION_TOMCAT_DEBUG: + tomcat_debug = 1; + break; + + case OPTION_TOMCAT_STATS: + tomcat_stats = 1; + break; + } + + return 1; +} + +void +md_show_usage (stream) + FILE * stream; +{ + fprintf (stream, _("FRV specific command line options:\n")); + fprintf (stream, _("-G n Data >= n bytes is in small data area\n")); + fprintf (stream, _("-mgpr-32 Note 32 gprs are used\n")); + fprintf (stream, _("-mgpr-64 Note 64 gprs are used\n")); + fprintf (stream, _("-mfpr-32 Note 32 fprs are used\n")); + fprintf (stream, _("-mfpr-64 Note 64 fprs are used\n")); + fprintf (stream, _("-msoft-float Note software fp is used\n")); + fprintf (stream, _("-mdword Note stack is aligned to a 8 byte boundary\n")); + fprintf (stream, _("-mno-dword Note stack is aligned to a 4 byte boundary\n")); + fprintf (stream, _("-mdouble Note fp double insns are used\n")); + fprintf (stream, _("-mmedia Note media insns are used\n")); + fprintf (stream, _("-mmuladd Note multiply add/subtract insns are used\n")); + fprintf (stream, _("-mpack Note instructions are packed\n")); + fprintf (stream, _("-mno-pack Do not allow instructions to be packed\n")); + fprintf (stream, _("-mpic Note small position independent code\n")); + fprintf (stream, _("-mPIC Note large position independent code\n")); + fprintf (stream, _("-mlibrary-pic Compile library for large position indepedent code\n")); + fprintf (stream, _("-mfdpic Assemble for the FDPIC ABI\n")); + fprintf (stream, _("-mnopic Disable -mpic, -mPIC, -mlibrary-pic and -mfdpic\n")); + fprintf (stream, _("-mcpu={fr500|fr550|fr400|fr300|frv|simple|tomcat}\n")); + fprintf (stream, _(" Record the cpu type\n")); + fprintf (stream, _("-mtomcat-stats Print out stats for tomcat workarounds\n")); + fprintf (stream, _("-mtomcat-debug Debug tomcat workarounds\n")); +} + + +void +md_begin () +{ + /* Initialize the `cgen' interface. */ + + /* Set the machine number and endian. */ + gas_cgen_cpu_desc = frv_cgen_cpu_open (CGEN_CPU_OPEN_MACHS, 0, + CGEN_CPU_OPEN_ENDIAN, + CGEN_ENDIAN_BIG, + CGEN_CPU_OPEN_END); + frv_cgen_init_asm (gas_cgen_cpu_desc); + + /* This is a callback from cgen to gas to parse operands. */ + cgen_set_parse_operand_fn (gas_cgen_cpu_desc, gas_cgen_parse_operand); + + /* Set the ELF flags if desired. */ + if (frv_flags) + bfd_set_private_flags (stdoutput, frv_flags); + + /* Set the machine type */ + bfd_default_set_arch_mach (stdoutput, bfd_arch_frv, frv_mach); + + /* Set up gp size so we can put local common items in .sbss */ + bfd_set_gp_size (stdoutput, g_switch_value); + + frv_vliw_reset (& vliw, frv_mach, frv_flags); +} + +bfd_boolean +frv_md_fdpic_enabled (void) +{ + return (frv_flags & EF_FRV_FDPIC) != 0; +} + +int chain_num = 0; + +struct vliw_insn_list *frv_insert_vliw_insn PARAMS ((bfd_boolean)); + +struct vliw_insn_list * +frv_insert_vliw_insn (count) + bfd_boolean count; +{ + struct vliw_insn_list *vliw_insn_list_entry; + struct vliw_chain *vliw_chain_entry; + + if (current_vliw_chain == NULL) + { + vliw_chain_entry = (struct vliw_chain *) xmalloc (sizeof (struct vliw_chain)); + vliw_chain_entry->insn_count = 0; + vliw_chain_entry->insn_list = NULL; + vliw_chain_entry->next = NULL; + vliw_chain_entry->num = chain_num++; + + if (!vliw_chain_top) + vliw_chain_top = vliw_chain_entry; + current_vliw_chain = vliw_chain_entry; + if (previous_vliw_chain) + previous_vliw_chain->next = vliw_chain_entry; + } + + vliw_insn_list_entry = (struct vliw_insn_list *) xmalloc (sizeof (struct vliw_insn_list)); + vliw_insn_list_entry->type = VLIW_GENERIC_TYPE; + vliw_insn_list_entry->insn = NULL; + vliw_insn_list_entry->sym = NULL; + vliw_insn_list_entry->snop_frag = NULL; + vliw_insn_list_entry->dnop_frag = NULL; + vliw_insn_list_entry->next = NULL; + + if (count) + current_vliw_chain->insn_count++; + + if (current_vliw_insn) + current_vliw_insn->next = vliw_insn_list_entry; + current_vliw_insn = vliw_insn_list_entry; + + if (!current_vliw_chain->insn_list) + current_vliw_chain->insn_list = current_vliw_insn; + + return vliw_insn_list_entry; +} + + /* Identify the following cases: + + 1) A VLIW insn that contains both a branch and the branch destination. + This requires the insertion of two vliw instructions before the + branch. The first consists of two nops. The second consists of + a single nop. + + 2) A single instruction VLIW insn which is the destination of a branch + that is in the next VLIW insn. This requires the insertion of a vliw + insn containing two nops before the branch. + + 3) A double instruction VLIW insn which contains the destination of a + branch that is in the next VLIW insn. This requires the insertion of + a VLIW insn containing a single nop before the branch. + + 4) A single instruction VLIW insn which contains branch destination (x), + followed by a single instruction VLIW insn which does not contain + the branch to (x), followed by a VLIW insn which does contain the branch + to (x). This requires the insertion of a VLIW insn containing a single + nop before the VLIW instruction containing the branch. + + */ +#define FRV_IS_NOP(insn) (insn.buffer[0] == FRV_NOP_PACK || insn.buffer[0] == FRV_NOP_NOPACK) +#define FRV_NOP_PACK 0x00880000 /* ori.p gr0,0,gr0 */ +#define FRV_NOP_NOPACK 0x80880000 /* ori gr0,0,gr0 */ + +/* Check a vliw insn for an insn of type containing the sym passed in label_sym. */ + +static struct vliw_insn_list *frv_find_in_vliw + PARAMS ((enum vliw_insn_type, struct vliw_chain *, symbolS *)); + +static struct vliw_insn_list * +frv_find_in_vliw (vliw_insn_type, this_chain, label_sym) + enum vliw_insn_type vliw_insn_type; + struct vliw_chain *this_chain; + symbolS *label_sym; +{ + + struct vliw_insn_list *the_insn; + + if (!this_chain) + return NULL; + + for (the_insn = this_chain->insn_list; the_insn; the_insn = the_insn->next) + { + if (the_insn->type == vliw_insn_type + && the_insn->sym == label_sym) + return the_insn; + } + + return NULL; +} + +enum vliw_nop_type +{ + /* A Vliw insn containing a single nop insn. */ + VLIW_SINGLE_NOP, + + /* A Vliw insn containing two nop insns. */ + VLIW_DOUBLE_NOP, + + /* Two vliw insns. The first containing two nop insns. + The second contain a single nop insn. */ + VLIW_DOUBLE_THEN_SINGLE_NOP +}; + +static void frv_debug_tomcat PARAMS ((struct vliw_chain *)); + +static void +frv_debug_tomcat (start_chain) + struct vliw_chain *start_chain; +{ + struct vliw_chain *this_chain; + struct vliw_insn_list *this_insn; + int i = 1; + + for (this_chain = start_chain; this_chain; this_chain = this_chain->next, i++) + { + fprintf (stderr, "\nVliw Insn #%d, #insns: %d\n", i, this_chain->insn_count); + + for (this_insn = this_chain->insn_list; this_insn; this_insn = this_insn->next) + { + if (this_insn->type == VLIW_LABEL_TYPE) + fprintf (stderr, "Label Value: %d\n", (int) this_insn->sym); + else if (this_insn->type == VLIW_BRANCH_TYPE) + fprintf (stderr, "%s to %d\n", this_insn->insn->base->name, (int) this_insn->sym); + else if (this_insn->type == VLIW_BRANCH_HAS_NOPS) + fprintf (stderr, "nop'd %s to %d\n", this_insn->insn->base->name, (int) this_insn->sym); + else if (this_insn->type == VLIW_NOP_TYPE) + fprintf (stderr, "Nop\n"); + else + fprintf (stderr, " %s\n", this_insn->insn->base->name); + } + } +} + +static void frv_adjust_vliw_count PARAMS ((struct vliw_chain *)); + +static void +frv_adjust_vliw_count (this_chain) + struct vliw_chain *this_chain; +{ + struct vliw_insn_list *this_insn; + + this_chain->insn_count = 0; + + for (this_insn = this_chain->insn_list; + this_insn; + this_insn = this_insn->next) + { + if (this_insn->type != VLIW_LABEL_TYPE) + this_chain->insn_count++; + } + +} + +/* Insert the desired nop combination in the vliw chain before insert_before_insn. + Rechain the vliw insn. */ + +static struct vliw_chain *frv_tomcat_shuffle + PARAMS ((enum vliw_nop_type, struct vliw_chain *, struct vliw_insn_list *)); + +static struct vliw_chain * +frv_tomcat_shuffle (this_nop_type, vliw_to_split, insert_before_insn) + enum vliw_nop_type this_nop_type; + struct vliw_chain *vliw_to_split; + struct vliw_insn_list *insert_before_insn; +{ + + bfd_boolean pack_prev = FALSE; + struct vliw_chain *return_me = NULL; + struct vliw_insn_list *prev_insn = NULL; + struct vliw_insn_list *curr_insn = vliw_to_split->insn_list; + + struct vliw_chain *double_nop = (struct vliw_chain *) xmalloc (sizeof (struct vliw_chain)); + struct vliw_chain *single_nop = (struct vliw_chain *) xmalloc (sizeof (struct vliw_chain)); + struct vliw_chain *second_part = (struct vliw_chain *) xmalloc (sizeof (struct vliw_chain)); + struct vliw_chain *curr_vliw = vliw_chain_top; + struct vliw_chain *prev_vliw = NULL; + + while (curr_insn && curr_insn != insert_before_insn) + { + /* We can't set the packing bit on a label. If we have the case + label 1: + label 2: + label 3: + branch that needs nops + Then don't set pack bit later. */ + + if (curr_insn->type != VLIW_LABEL_TYPE) + pack_prev = TRUE; + prev_insn = curr_insn; + curr_insn = curr_insn->next; + } + + while (curr_vliw && curr_vliw != vliw_to_split) + { + prev_vliw = curr_vliw; + curr_vliw = curr_vliw->next; + } + + switch (this_nop_type) + { + case VLIW_SINGLE_NOP: + if (!prev_insn) + { + /* Branch is first, Insert the NOP prior to this vliw insn. */ + if (prev_vliw) + prev_vliw->next = single_nop; + else + vliw_chain_top = single_nop; + single_nop->next = vliw_to_split; + vliw_to_split->insn_list->type = VLIW_BRANCH_HAS_NOPS; + return_me = vliw_to_split; + } + else + { + /* Set the packing bit on the previous insn. */ + if (pack_prev) + { + unsigned char *buffer = prev_insn->address; + buffer[0] |= 0x80; + } + /* The branch is in the middle. Split this vliw insn into first + and second parts. Insert the NOP inbetween. */ + + second_part->insn_list = insert_before_insn; + second_part->insn_list->type = VLIW_BRANCH_HAS_NOPS; + second_part->next = vliw_to_split->next; + frv_adjust_vliw_count (second_part); + + single_nop->next = second_part; + + vliw_to_split->next = single_nop; + prev_insn->next = NULL; + + return_me = second_part; + frv_adjust_vliw_count (vliw_to_split); + } + break; + + case VLIW_DOUBLE_NOP: + if (!prev_insn) + { + /* Branch is first, Insert the NOP prior to this vliw insn. */ + if (prev_vliw) + prev_vliw->next = double_nop; + else + vliw_chain_top = double_nop; + + double_nop->next = vliw_to_split; + return_me = vliw_to_split; + vliw_to_split->insn_list->type = VLIW_BRANCH_HAS_NOPS; + } + else + { + /* Set the packing bit on the previous insn. */ + if (pack_prev) + { + unsigned char *buffer = prev_insn->address; + buffer[0] |= 0x80; + } + + /* The branch is in the middle. Split this vliw insn into first + and second parts. Insert the NOP inbetween. */ + second_part->insn_list = insert_before_insn; + second_part->insn_list->type = VLIW_BRANCH_HAS_NOPS; + second_part->next = vliw_to_split->next; + frv_adjust_vliw_count (second_part); + + double_nop->next = second_part; + + vliw_to_split->next = single_nop; + prev_insn->next = NULL; + frv_adjust_vliw_count (vliw_to_split); + + return_me = second_part; + } + break; + + case VLIW_DOUBLE_THEN_SINGLE_NOP: + double_nop->next = single_nop; + double_nop->insn_count = 2; + double_nop->insn_list = &double_nop_insn; + single_nop->insn_count = 1; + single_nop->insn_list = &single_nop_insn; + + if (!prev_insn) + { + /* The branch is the first insn in this vliw. Don't split the vliw. Insert + the nops prior to this vliw. */ + if (prev_vliw) + prev_vliw->next = double_nop; + else + vliw_chain_top = double_nop; + + single_nop->next = vliw_to_split; + return_me = vliw_to_split; + vliw_to_split->insn_list->type = VLIW_BRANCH_HAS_NOPS; + } + else + { + /* Set the packing bit on the previous insn. */ + if (pack_prev) + { + unsigned char *buffer = prev_insn->address; + buffer[0] |= 0x80; + } + + /* The branch is in the middle of this vliw insn. Split into first and + second parts. Insert the nop vliws in between. */ + second_part->insn_list = insert_before_insn; + second_part->insn_list->type = VLIW_BRANCH_HAS_NOPS; + second_part->next = vliw_to_split->next; + frv_adjust_vliw_count (second_part); + + single_nop->next = second_part; + + vliw_to_split->next = double_nop; + prev_insn->next = NULL; + frv_adjust_vliw_count (vliw_to_split); + + return_me = second_part; + } + break; + } + + return return_me; +} + +static void frv_tomcat_analyze_vliw_chains PARAMS ((void)); + +static void +frv_tomcat_analyze_vliw_chains () +{ + struct vliw_chain *vliw1 = NULL; + struct vliw_chain *vliw2 = NULL; + struct vliw_chain *vliw3 = NULL; + + struct vliw_insn_list *this_insn = NULL; + struct vliw_insn_list *temp_insn = NULL; + + /* We potentially need to look at three VLIW insns to determine if the + workaround is required. Set them up. Ignore existing nops during analysis. */ + +#define FRV_SET_VLIW_WINDOW(VLIW1, VLIW2, VLIW3) \ + if (VLIW1 && VLIW1->next) \ + VLIW2 = VLIW1->next; \ + else \ + VLIW2 = NULL; \ + if (VLIW2 && VLIW2->next) \ + VLIW3 = VLIW2->next; \ + else \ + VLIW3 = NULL + + vliw1 = vliw_chain_top; + +workaround_top: + + FRV_SET_VLIW_WINDOW (vliw1, vliw2, vliw3); + + if (!vliw1) + return; + + if (vliw1->insn_count == 1) + { + /* check vliw1 for a label. */ + if (vliw1->insn_list->type == VLIW_LABEL_TYPE) + { + temp_insn = frv_find_in_vliw (VLIW_BRANCH_TYPE, vliw2, vliw1->insn_list->sym); + if (temp_insn) + { + vliw1 = frv_tomcat_shuffle (VLIW_DOUBLE_NOP, vliw2, vliw1->insn_list); + temp_insn->dnop_frag->fr_subtype = NOP_KEEP; + vliw1 = vliw1->next; + if (tomcat_stats) + tomcat_doubles++; + goto workaround_top; + } + else if (vliw2 + && vliw2->insn_count == 1 + && (temp_insn = frv_find_in_vliw (VLIW_BRANCH_TYPE, vliw3, vliw1->insn_list->sym)) != NULL) + { + temp_insn->snop_frag->fr_subtype = NOP_KEEP; + vliw1 = frv_tomcat_shuffle (VLIW_SINGLE_NOP, vliw3, vliw3->insn_list); + if (tomcat_stats) + tomcat_singles++; + goto workaround_top; + } + } + } + + if (vliw1->insn_count == 2) + { + struct vliw_insn_list *this_insn; + + /* check vliw1 for a label. */ + for (this_insn = vliw1->insn_list; this_insn; this_insn = this_insn->next) + { + if (this_insn->type == VLIW_LABEL_TYPE) + { + if ((temp_insn = frv_find_in_vliw (VLIW_BRANCH_TYPE, vliw2, this_insn->sym)) != NULL) + { + temp_insn->snop_frag->fr_subtype = NOP_KEEP; + vliw1 = frv_tomcat_shuffle (VLIW_SINGLE_NOP, vliw2, this_insn); + if (tomcat_stats) + tomcat_singles++; + } + else + vliw1 = vliw1->next; + goto workaround_top; + } + } + } + /* Examine each insn in this VLIW. Look for the workaround criteria. */ + for (this_insn = vliw1->insn_list; this_insn; this_insn = this_insn->next) + { + /* Don't look at labels or nops. */ + while (this_insn + && (this_insn->type == VLIW_LABEL_TYPE + || this_insn->type == VLIW_NOP_TYPE + || this_insn->type == VLIW_BRANCH_HAS_NOPS)) + this_insn = this_insn->next; + + if (!this_insn) + { + vliw1 = vliw2; + goto workaround_top; + } + + if (frv_is_branch_insn (this_insn->insn)) + { + if ((temp_insn = frv_find_in_vliw (VLIW_LABEL_TYPE, vliw1, this_insn->sym)) != NULL) + { + /* Insert [nop/nop] [nop] before branch. */ + this_insn->snop_frag->fr_subtype = NOP_KEEP; + this_insn->dnop_frag->fr_subtype = NOP_KEEP; + vliw1 = frv_tomcat_shuffle (VLIW_DOUBLE_THEN_SINGLE_NOP, vliw1, this_insn); + goto workaround_top; + } + } + + + } + /* This vliw insn checks out okay. Take a look at the next one. */ + vliw1 = vliw1->next; + goto workaround_top; +} + +void +frv_tomcat_workaround () +{ + if (frv_mach != bfd_mach_frvtomcat) + return; + + if (tomcat_debug) + frv_debug_tomcat (vliw_chain_top); + + frv_tomcat_analyze_vliw_chains (); + + if (tomcat_stats) + { + fprintf (stderr, "Inserted %d Single Nops\n", tomcat_singles); + fprintf (stderr, "Inserted %d Double Nops\n", tomcat_doubles); + } +} + +static int +fr550_check_insn_acc_range (frv_insn *insn, int low, int hi) +{ + int acc; + switch (CGEN_INSN_NUM (insn->insn)) + { + case FRV_INSN_MADDACCS: + case FRV_INSN_MSUBACCS: + case FRV_INSN_MDADDACCS: + case FRV_INSN_MDSUBACCS: + case FRV_INSN_MASACCS: + case FRV_INSN_MDASACCS: + acc = insn->fields.f_ACC40Si; + if (acc < low || acc > hi) + return 1; /* out of range */ + acc = insn->fields.f_ACC40Sk; + if (acc < low || acc > hi) + return 1; /* out of range */ + break; + case FRV_INSN_MMULHS: + case FRV_INSN_MMULHU: + case FRV_INSN_MMULXHS: + case FRV_INSN_MMULXHU: + case FRV_INSN_CMMULHS: + case FRV_INSN_CMMULHU: + case FRV_INSN_MQMULHS: + case FRV_INSN_MQMULHU: + case FRV_INSN_MQMULXHS: + case FRV_INSN_MQMULXHU: + case FRV_INSN_CMQMULHS: + case FRV_INSN_CMQMULHU: + case FRV_INSN_MMACHS: + case FRV_INSN_MMRDHS: + case FRV_INSN_CMMACHS: + case FRV_INSN_MQMACHS: + case FRV_INSN_CMQMACHS: + case FRV_INSN_MQXMACHS: + case FRV_INSN_MQXMACXHS: + case FRV_INSN_MQMACXHS: + case FRV_INSN_MCPXRS: + case FRV_INSN_MCPXIS: + case FRV_INSN_CMCPXRS: + case FRV_INSN_CMCPXIS: + case FRV_INSN_MQCPXRS: + case FRV_INSN_MQCPXIS: + acc = insn->fields.f_ACC40Sk; + if (acc < low || acc > hi) + return 1; /* out of range */ + break; + case FRV_INSN_MMACHU: + case FRV_INSN_MMRDHU: + case FRV_INSN_CMMACHU: + case FRV_INSN_MQMACHU: + case FRV_INSN_CMQMACHU: + case FRV_INSN_MCPXRU: + case FRV_INSN_MCPXIU: + case FRV_INSN_CMCPXRU: + case FRV_INSN_CMCPXIU: + case FRV_INSN_MQCPXRU: + case FRV_INSN_MQCPXIU: + acc = insn->fields.f_ACC40Uk; + if (acc < low || acc > hi) + return 1; /* out of range */ + break; + default: + break; + } + return 0; /* all is ok */ +} + +static int +fr550_check_acc_range (FRV_VLIW *vliw, frv_insn *insn) +{ + switch ((*vliw->current_vliw)[vliw->next_slot - 1]) + { + case UNIT_FM0: + case UNIT_FM2: + return fr550_check_insn_acc_range (insn, 0, 3); + case UNIT_FM1: + case UNIT_FM3: + return fr550_check_insn_acc_range (insn, 4, 7); + default: + break; + } + return 0; /* all is ok */ +} + +void +md_assemble (str) + char * str; +{ + frv_insn insn; + char *errmsg; + int packing_constraint; + finished_insnS finished_insn; + fragS *double_nop_frag = NULL; + fragS *single_nop_frag = NULL; + struct vliw_insn_list *vliw_insn_list_entry = NULL; + + /* Initialize GAS's cgen interface for a new instruction. */ + gas_cgen_init_parse (); + + memset (&insn, 0, sizeof (insn)); + + insn.insn = frv_cgen_assemble_insn + (gas_cgen_cpu_desc, str, & insn.fields, insn.buffer, &errmsg); + + if (!insn.insn) + { + as_bad (errmsg); + return; + } + + /* If the cpu is tomcat, then we need to insert nops to workaround + hardware limitations. We need to keep track of each vliw unit + and examine the length of the unit and the individual insns + within the unit to determine the number and location of the + required nops. */ + if (frv_mach == bfd_mach_frvtomcat) + { + /* If we've just finished a VLIW insn OR this is a branch, + then start up a new frag. Fill it with nops. We will get rid + of those that are not required after we've seen all of the + instructions but before we start resolving fixups. */ + if ( !FRV_IS_NOP (insn) + && (frv_is_branch_insn (insn.insn) || insn.fields.f_pack)) + { + char *buffer; + + frag_wane (frag_now); + frag_new (0); + double_nop_frag = frag_now; + buffer = frag_var (rs_machine_dependent, 8, 8, NOP_DELETE, NULL, 0, 0); + md_number_to_chars (buffer, FRV_NOP_PACK, 4); + md_number_to_chars (buffer+4, FRV_NOP_NOPACK, 4); + + frag_wane (frag_now); + frag_new (0); + single_nop_frag = frag_now; + buffer = frag_var (rs_machine_dependent, 4, 4, NOP_DELETE, NULL, 0, 0); + md_number_to_chars (buffer, FRV_NOP_NOPACK, 4); + } + + vliw_insn_list_entry = frv_insert_vliw_insn (DO_COUNT); + vliw_insn_list_entry->insn = insn.insn; + if (frv_is_branch_insn (insn.insn)) + vliw_insn_list_entry->type = VLIW_BRANCH_TYPE; + + if ( !FRV_IS_NOP (insn) + && (frv_is_branch_insn (insn.insn) || insn.fields.f_pack)) + { + vliw_insn_list_entry->snop_frag = single_nop_frag; + vliw_insn_list_entry->dnop_frag = double_nop_frag; + } + } + + /* Make sure that this insn does not violate the VLIW packing constraints. */ + /* -mno-pack disallows any packing whatsoever. */ + if (frv_flags & EF_FRV_NOPACK) + { + if (! insn.fields.f_pack) + { + as_bad (_("VLIW packing used for -mno-pack")); + return; + } + } + /* -mcpu=FRV is an idealized FR-V implementation that supports all of the + instructions, don't do vliw checking. */ + else if (frv_mach != bfd_mach_frv) + { + packing_constraint = frv_vliw_add_insn (& vliw, insn.insn); + if (frv_mach == bfd_mach_fr550 && ! packing_constraint) + packing_constraint = fr550_check_acc_range (& vliw, & insn); + if (insn.fields.f_pack) + frv_vliw_reset (& vliw, frv_mach, frv_flags); + if (packing_constraint) + { + as_bad (_("VLIW packing constraint violation")); + return; + } + } + + /* Doesn't really matter what we pass for RELAX_P here. */ + gas_cgen_finish_insn (insn.insn, insn.buffer, + CGEN_FIELDS_BITSIZE (& insn.fields), 1, &finished_insn); + + + /* If the cpu is tomcat, then we need to insert nops to workaround + hardware limitations. We need to keep track of each vliw unit + and examine the length of the unit and the individual insns + within the unit to determine the number and location of the + required nops. */ + if (frv_mach == bfd_mach_frvtomcat) + { + if (vliw_insn_list_entry) + vliw_insn_list_entry->address = finished_insn.addr; + else + abort(); + + if (insn.fields.f_pack) + { + /* We've completed a VLIW insn. */ + previous_vliw_chain = current_vliw_chain; + current_vliw_chain = NULL; + current_vliw_insn = NULL; + } + } +} + +/* The syntax in the manual says constants begin with '#'. + We just ignore it. */ + +void +md_operand (expressionP) + expressionS * expressionP; +{ + if (* input_line_pointer == '#') + { + input_line_pointer ++; + expression (expressionP); + } +} + +valueT +md_section_align (segment, size) + segT segment; + valueT size; +{ + int align = bfd_get_section_alignment (stdoutput, segment); + return ((size + (1 << align) - 1) & (-1 << align)); +} + +symbolS * +md_undefined_symbol (name) + char * name ATTRIBUTE_UNUSED; +{ + return 0; +} + +/* Interface to relax_segment. */ + +/* FIXME: Build table by hand, get it working, then machine generate. */ +const relax_typeS md_relax_table[] = +{ + {1, 1, 0, 0}, + {511 - 2 - 2, -512 - 2 + 2, 0, 2 }, + {0x2000000 - 1 - 2, -0x2000000 - 2, 2, 0 }, + {0x2000000 - 1 - 2, -0x2000000 - 2, 4, 0 } +}; + +long +frv_relax_frag (fragP, stretch) + fragS *fragP ATTRIBUTE_UNUSED; + long stretch ATTRIBUTE_UNUSED; +{ + return 0; +} + +/* Return an initial guess of the length by which a fragment must grow to + hold a branch to reach its destination. + Also updates fr_type/fr_subtype as necessary. + + Called just before doing relaxation. + Any symbol that is now undefined will not become defined. + The guess for fr_var is ACTUALLY the growth beyond fr_fix. + Whatever we do to grow fr_fix or fr_var contributes to our returned value. + Although it may not be explicit in the frag, pretend fr_var starts with a + 0 value. */ + +int +md_estimate_size_before_relax (fragP, segment) + fragS * fragP; + segT segment ATTRIBUTE_UNUSED; +{ + switch (fragP->fr_subtype) + { + case NOP_KEEP: + return fragP->fr_var; + + default: + case NOP_DELETE: + return 0; + } +} + +/* *fragP has been relaxed to its final size, and now needs to have + the bytes inside it modified to conform to the new size. + + Called after relaxation is finished. + fragP->fr_type == rs_machine_dependent. + fragP->fr_subtype is the subtype of what the address relaxed to. */ + +void +md_convert_frag (abfd, sec, fragP) + bfd * abfd ATTRIBUTE_UNUSED; + segT sec ATTRIBUTE_UNUSED; + fragS * fragP; +{ + switch (fragP->fr_subtype) + { + default: + case NOP_DELETE: + return; + + case NOP_KEEP: + fragP->fr_fix = fragP->fr_var; + fragP->fr_var = 0; + return; + } +} + +/* Functions concerning relocs. */ + +/* The location from which a PC relative jump should be calculated, + given a PC relative reloc. */ + +long +md_pcrel_from_section (fixP, sec) + fixS * fixP; + segT sec; +{ + if (TC_FORCE_RELOCATION (fixP) + || (fixP->fx_addsy != (symbolS *) NULL + && S_GET_SEGMENT (fixP->fx_addsy) != sec)) + { + /* If we can't adjust this relocation, or if it references a + local symbol in a different section (which + TC_FORCE_RELOCATION can't check), let the linker figure it + out. */ + return 0; + } + + return (fixP->fx_frag->fr_address + fixP->fx_where) & ~1; +} + +/* Return the bfd reloc type for OPERAND of INSN at fixup FIXP. + Returns BFD_RELOC_NONE if no reloc type can be found. + *FIXP may be modified if desired. */ + +bfd_reloc_code_real_type +md_cgen_lookup_reloc (insn, operand, fixP) + const CGEN_INSN * insn ATTRIBUTE_UNUSED; + const CGEN_OPERAND * operand; + fixS * fixP; +{ + switch (operand->type) + { + case FRV_OPERAND_LABEL16: + fixP->fx_pcrel = TRUE; + return BFD_RELOC_FRV_LABEL16; + + case FRV_OPERAND_LABEL24: + fixP->fx_pcrel = TRUE; + return BFD_RELOC_FRV_LABEL24; + + case FRV_OPERAND_UHI16: + case FRV_OPERAND_ULO16: + case FRV_OPERAND_SLO16: + + /* The relocation type should be recorded in opinfo */ + if (fixP->fx_cgen.opinfo != 0) + return fixP->fx_cgen.opinfo; + break; + + case FRV_OPERAND_D12: + case FRV_OPERAND_S12: + if (fixP->fx_cgen.opinfo != 0) + return fixP->fx_cgen.opinfo; + + return BFD_RELOC_FRV_GPREL12; + + case FRV_OPERAND_U12: + return BFD_RELOC_FRV_GPRELU12; + + default: + break; + } + return BFD_RELOC_NONE; +} + + +/* See whether we need to force a relocation into the output file. + This is used to force out switch and PC relative relocations when + relaxing. */ + +int +frv_force_relocation (fix) + fixS * fix; +{ + if (fix->fx_r_type == BFD_RELOC_FRV_GPREL12 + || fix->fx_r_type == BFD_RELOC_FRV_GPRELU12) + return 1; + + return generic_force_reloc (fix); +} + +/* Apply a fixup that could be resolved within the assembler. */ + +void +md_apply_fix3 (fixP, valP, seg) + fixS * fixP; + valueT * valP; + segT seg; +{ + if (fixP->fx_addsy == 0) + switch (fixP->fx_cgen.opinfo) + { + case BFD_RELOC_FRV_HI16: + *valP >>= 16; + /* Fall through. */ + case BFD_RELOC_FRV_LO16: + *valP &= 0xffff; + break; + } + + gas_cgen_md_apply_fix3 (fixP, valP, seg); + return; +} + + +/* Write a value out to the object file, using the appropriate endianness. */ + +void +frv_md_number_to_chars (buf, val, n) + char * buf; + valueT val; + int n; +{ + number_to_chars_bigendian (buf, val, n); +} + +/* Turn a string in input_line_pointer into a floating point constant of type + type, and store the appropriate bytes in *litP. The number of LITTLENUMS + emitted is stored in *sizeP . An error message is returned, or NULL on OK. +*/ + +/* Equal to MAX_PRECISION in atof-ieee.c */ +#define MAX_LITTLENUMS 6 + +char * +md_atof (type, litP, sizeP) + char type; + char * litP; + int * sizeP; +{ + int i; + int prec; + LITTLENUM_TYPE words [MAX_LITTLENUMS]; + char * t; + + switch (type) + { + case 'f': + case 'F': + case 's': + case 'S': + prec = 2; + break; + + case 'd': + case 'D': + case 'r': + case 'R': + prec = 4; + break; + + /* FIXME: Some targets allow other format chars for bigger sizes here. */ + + default: + * sizeP = 0; + return _("Bad call to md_atof()"); + } + + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + * sizeP = prec * sizeof (LITTLENUM_TYPE); + + for (i = 0; i < prec; i++) + { + md_number_to_chars (litP, (valueT) words[i], + sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } + + return 0; +} + +bfd_boolean +frv_fix_adjustable (fixP) + fixS * fixP; +{ + bfd_reloc_code_real_type reloc_type; + + if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED) + { + const CGEN_INSN *insn = NULL; + int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED; + const CGEN_OPERAND *operand = cgen_operand_lookup_by_num(gas_cgen_cpu_desc, opindex); + reloc_type = md_cgen_lookup_reloc (insn, operand, fixP); + } + else + reloc_type = fixP->fx_r_type; + + /* We need the symbol name for the VTABLE entries */ + if ( reloc_type == BFD_RELOC_VTABLE_INHERIT + || reloc_type == BFD_RELOC_VTABLE_ENTRY + || reloc_type == BFD_RELOC_FRV_GPREL12 + || reloc_type == BFD_RELOC_FRV_GPRELU12) + return 0; + + return 1; +} + +/* Allow user to set flags bits. */ +void +frv_set_flags (arg) + int arg ATTRIBUTE_UNUSED; +{ + flagword new_flags = get_absolute_expression (); + flagword new_mask = ~ (flagword)0; + + frv_user_set_flags_p = 1; + if (*input_line_pointer == ',') + { + ++input_line_pointer; + new_mask = get_absolute_expression (); + } + + frv_flags = (frv_flags & ~new_mask) | (new_flags & new_mask); + bfd_set_private_flags (stdoutput, frv_flags); +} + +/* Frv specific function to handle 4 byte initializations for pointers that are + considered 'safe' for use with pic support. Until frv_frob_file{,_section} + is run, we encode it a BFD_RELOC_CTOR, and it is turned back into a normal + BFD_RELOC_32 at that time. */ + +void +frv_pic_ptr (nbytes) + int nbytes; +{ + expressionS exp; + char *p; + + if (nbytes != 4) + abort (); + +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + + if (is_it_end_of_statement ()) + { + demand_empty_rest_of_line (); + return; + } + +#ifdef md_cons_align + md_cons_align (nbytes); +#endif + + do + { + bfd_reloc_code_real_type reloc_type = BFD_RELOC_CTOR; + + if (strncasecmp (input_line_pointer, "funcdesc(", 9) == 0) + { + input_line_pointer += 9; + expression (&exp); + if (*input_line_pointer == ')') + input_line_pointer++; + else + as_bad ("missing ')'"); + reloc_type = BFD_RELOC_FRV_FUNCDESC; + } + else + expression (&exp); + + p = frag_more (4); + memset (p, 0, 4); + fix_new_exp (frag_now, p - frag_now->fr_literal, 4, &exp, 0, + reloc_type); + } + while (*input_line_pointer++ == ','); + + input_line_pointer--; /* Put terminator back into stream. */ + demand_empty_rest_of_line (); +} + + + +#ifdef DEBUG +#define DPRINTF1(A) fprintf (stderr, A) +#define DPRINTF2(A,B) fprintf (stderr, A, B) +#define DPRINTF3(A,B,C) fprintf (stderr, A, B, C) + +#else +#define DPRINTF1(A) +#define DPRINTF2(A,B) +#define DPRINTF3(A,B,C) +#endif + +/* Go through a the sections looking for relocations that are problematical for + pic. If not pic, just note that this object can't be linked with pic. If + it is pic, see if it needs to be marked so that it will be fixed up, or if + not possible, issue an error. */ + +static void +frv_frob_file_section (abfd, sec, ptr) + bfd *abfd; + asection *sec; + PTR ptr ATTRIBUTE_UNUSED; +{ + segment_info_type *seginfo = seg_info (sec); + fixS *fixp; + CGEN_CPU_DESC cd = gas_cgen_cpu_desc; + flagword flags = bfd_get_section_flags (abfd, sec); + + /* Skip relocations in known sections (.ctors, .dtors, and .gcc_except_table) + since we can fix those up by hand. */ + int known_section_p = (sec->name + && sec->name[0] == '.' + && ((sec->name[1] == 'c' + && strcmp (sec->name, ".ctor") == 0) + || (sec->name[1] == 'd' + && strcmp (sec->name, ".dtor") == 0) + || (sec->name[1] == 'g' + && strcmp (sec->name, ".gcc_except_table") == 0))); + + DPRINTF3 ("\nFrv section %s%s\n", sec->name, (known_section_p) ? ", known section" : ""); + if ((flags & SEC_ALLOC) == 0) + { + DPRINTF1 ("\tSkipping non-loaded section\n"); + return; + } + + for (fixp = seginfo->fix_root; fixp; fixp = fixp->fx_next) + { + symbolS *s = fixp->fx_addsy; + bfd_reloc_code_real_type reloc; + int non_pic_p; + int opindex; + const CGEN_OPERAND *operand; + const CGEN_INSN *insn = fixp->fx_cgen.insn; + + if (fixp->fx_done) + { + DPRINTF1 ("\tSkipping reloc that has already been done\n"); + continue; + } + + if (fixp->fx_pcrel) + { + DPRINTF1 ("\tSkipping reloc that is PC relative\n"); + continue; + } + + if (! s) + { + DPRINTF1 ("\tSkipping reloc without symbol\n"); + continue; + } + + if (fixp->fx_r_type < BFD_RELOC_UNUSED) + { + opindex = -1; + reloc = fixp->fx_r_type; + } + else + { + opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED; + operand = cgen_operand_lookup_by_num (cd, opindex); + reloc = md_cgen_lookup_reloc (insn, operand, fixp); + } + + DPRINTF3 ("\treloc %s\t%s", bfd_get_reloc_code_name (reloc), S_GET_NAME (s)); + + non_pic_p = 0; + switch (reloc) + { + default: + break; + + case BFD_RELOC_32: + /* Skip relocations in known sections (.ctors, .dtors, and + .gcc_except_table) since we can fix those up by hand. Also + skip forward references to constants. Also skip a difference + of two symbols, which still uses the BFD_RELOC_32 at this + point. */ + if (! known_section_p + && S_GET_SEGMENT (s) != absolute_section + && !fixp->fx_subsy + && (flags & (SEC_READONLY | SEC_CODE)) == 0) + { + non_pic_p = 1; + } + break; + + /* FIXME -- should determine if any of the GP relocation really uses + gr16 (which is not pic safe) or not. Right now, assume if we + aren't being compiled with -mpic, the usage is non pic safe, but + is safe with -mpic. */ + case BFD_RELOC_FRV_GPREL12: + case BFD_RELOC_FRV_GPRELU12: + case BFD_RELOC_FRV_GPREL32: + case BFD_RELOC_FRV_GPRELHI: + case BFD_RELOC_FRV_GPRELLO: + non_pic_p = ! frv_pic_p; + break; + + case BFD_RELOC_FRV_LO16: + case BFD_RELOC_FRV_HI16: + if (S_GET_SEGMENT (s) != absolute_section) + non_pic_p = 1; + break; + + case BFD_RELOC_VTABLE_INHERIT: + case BFD_RELOC_VTABLE_ENTRY: + non_pic_p = 1; + break; + + /* If this is a blessed BFD_RELOC_32, convert it back to the normal + relocation. */ + case BFD_RELOC_CTOR: + fixp->fx_r_type = BFD_RELOC_32; + break; + } + + if (non_pic_p) + { + DPRINTF1 (" (Non-pic relocation)\n"); + if (frv_pic_p) + as_warn_where (fixp->fx_file, fixp->fx_line, + _("Relocation %s is not safe for %s"), + bfd_get_reloc_code_name (reloc), frv_pic_flag); + + else if ((frv_flags & EF_FRV_NON_PIC_RELOCS) == 0) + { + frv_flags |= EF_FRV_NON_PIC_RELOCS; + bfd_set_private_flags (abfd, frv_flags); + } + } +#ifdef DEBUG + else + DPRINTF1 ("\n"); +#endif + } +} + +/* After all of the symbols have been adjusted, go over the file looking + for any relocations that pic won't support. */ + +void +frv_frob_file () +{ + bfd_map_over_sections (stdoutput, frv_frob_file_section, (PTR)0); +} + +void +frv_frob_label (this_label) + symbolS *this_label; +{ + struct vliw_insn_list *vliw_insn_list_entry; + + if (frv_mach != bfd_mach_frvtomcat) + return; + + if (now_seg != text_section) + return; + + vliw_insn_list_entry = frv_insert_vliw_insn(DONT_COUNT); + vliw_insn_list_entry->type = VLIW_LABEL_TYPE; + vliw_insn_list_entry->sym = this_label; +} + +fixS * +frv_cgen_record_fixup_exp (frag, where, insn, length, operand, opinfo, exp) + fragS * frag; + int where; + const CGEN_INSN * insn; + int length; + const CGEN_OPERAND * operand; + int opinfo; + expressionS * exp; +{ + fixS * fixP = gas_cgen_record_fixup_exp (frag, where, insn, length, + operand, opinfo, exp); + + if (frv_mach == bfd_mach_frvtomcat + && current_vliw_insn + && current_vliw_insn->type == VLIW_BRANCH_TYPE + && exp != NULL) + current_vliw_insn->sym = exp->X_add_symbol; + + return fixP; +} diff --git a/gas/config/tc-frv.h b/gas/config/tc-frv.h new file mode 100644 index 0000000000000..fb887a0d35332 --- /dev/null +++ b/gas/config/tc-frv.h @@ -0,0 +1,129 @@ +/* tc-frv.h -- Header file for tc-frv.c. + Copyright 2002 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#define TC_FRV + +#ifndef BFD_ASSEMBLER +/* leading space so will compile with cc */ + #error FRV support requires BFD_ASSEMBLER +#endif + +#define LISTING_HEADER "FRV GAS " + +/* The target BFD architecture. */ +#define TARGET_ARCH bfd_arch_frv + +#define TARGET_FORMAT (frv_md_fdpic_enabled () \ + ? "elf32-frvfdpic" : "elf32-frv") +extern bfd_boolean frv_md_fdpic_enabled (void); + +#define TARGET_BYTES_BIG_ENDIAN 1 + +/* Permit temporary numeric labels. */ +#define LOCAL_LABELS_FB 1 + +#define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */ + +/* We don't need to handle .word strangely. */ +#define WORKING_DOT_WORD + +/* Values passed to md_apply_fix3 don't include the symbol value. */ +#define MD_APPLY_SYM_VALUE(FIX) 0 + +extern void frv_tomcat_workaround PARAMS ((void)); +#define md_cleanup frv_tomcat_workaround + +#define md_number_to_chars frv_md_number_to_chars + +extern long frv_relax_frag PARAMS ((fragS *, long)); +#define md_relax_frag(segment, fragP, stretch) frv_relax_frag(fragP, stretch) + +#define tc_fix_adjustable(FIX) frv_fix_adjustable (FIX) +struct fix; +extern bfd_boolean frv_fix_adjustable PARAMS ((struct fix *)); + +/* When relaxing, we need to emit various relocs we otherwise wouldn't. */ +#define TC_FORCE_RELOCATION(fix) frv_force_relocation (fix) +extern int frv_force_relocation PARAMS ((struct fix *)); + +/* If we simplify subtractions that aren't SUB_SAME or SUB_ABS, we end + up with PCrel fixups, but since we don't have any PCrel relocs, we + crash. Preventing simplification gets us a good, early error. */ +#define TC_FORCE_RELOCATION_SUB_LOCAL(fixP) 1 + +#undef GAS_CGEN_MAX_FIXUPS +#define GAS_CGEN_MAX_FIXUPS 1 + +void frv_frob_label PARAMS ((symbolS *)); +#define tc_frob_label(sym) frv_frob_label(sym) + +#define tc_gen_reloc gas_cgen_tc_gen_reloc + +#define md_cgen_record_fixup_exp frv_cgen_record_fixup_exp + +/* Call md_pcrel_from_section(), not md_pcrel_from(). */ +#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC) +extern long md_pcrel_from_section PARAMS ((struct fix *, segT)); + +/* After all of the symbols have been adjusted, go over the file looking + for any relocations that pic won't support. */ +#define tc_frob_file() frv_frob_file () +extern void frv_frob_file PARAMS ((void)); + +/* We don't want 0x00 for code alignment because this generates `add.p + gr0, gr0, gr0' patterns. Although it's fine as a nop instruction, + it has the VLIW packing bit set, which means if you have a bunch of + them in a row and attempt to execute them, you'll exceed the VLIW + capacity and fail. This also gets GDB confused sometimes, because + it won't set breakpoints in instructions other than the first of a + VLIW pack, so you used to be unable to set a breakpoint in the + initial instruction of a function that followed such + alignment-introduced instructions. + + We could have arranged to emit `nop' instructions (0x80880000), + maybe even VLIW-pack sequences of nop instructions as much as + possible for the selected machine type, just in case the alignment + code actually happens to run, but this is probably too much effort + for little gain. This code is not meant to be run anyway, so just + emit nops. */ +#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4) +#define HANDLE_ALIGN(FRAGP) do \ + if ((FRAGP)->fr_type == rs_align_code) \ + { \ + valueT count = ((FRAGP)->fr_next->fr_address \ + - ((FRAGP)->fr_address + (FRAGP)->fr_fix)); \ + unsigned char *dest = (FRAGP)->fr_literal + (FRAGP)->fr_fix; \ + if ((count & 3) != 0) \ + { \ + memset (dest, 0, (count & 3)); \ + (FRAGP)->fr_fix += (count & 3); \ + dest += (count & 3); \ + count -= (count & 3); \ + } \ + if (count) \ + { \ + (FRAGP)->fr_var = 4; \ + *dest++ = 0x80; \ + *dest++ = 0x88; \ + *dest++ = 0x00; \ + *dest++ = 0x00; \ + } \ + } \ + while (0) diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c new file mode 100644 index 0000000000000..467d9bcdb26cf --- /dev/null +++ b/gas/config/tc-h8300.c @@ -0,0 +1,2324 @@ +/* tc-h8300.c -- Assemble code for the Renesas H8/300 + Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, + 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* Written By Steve Chamberlain . */ + +#include +#include "as.h" +#include "subsegs.h" +#include "bfd.h" + +#ifdef BFD_ASSEMBLER +#include "dwarf2dbg.h" +#endif + +#define DEFINE_TABLE +#define h8_opcodes ops +#include "opcode/h8300.h" +#include "safe-ctype.h" + +#ifdef OBJ_ELF +#include "elf/h8.h" +#endif + +const char comment_chars[] = ";"; +const char line_comment_chars[] = "#"; +const char line_separator_chars[] = ""; + +static void sbranch (int); +static void h8300hmode (int); +static void h8300smode (int); +static void h8300hnmode (int); +static void h8300snmode (int); +static void h8300sxmode (int); +static void h8300sxnmode (int); +static void pint (int); + +int Hmode; +int Smode; +int Nmode; +int SXmode; + +#define PSIZE (Hmode && !Nmode ? L_32 : L_16) + +static int bsize = L_8; /* Default branch displacement. */ + +struct h8_instruction +{ + int length; + int noperands; + int idx; + int size; + const struct h8_opcode *opcode; +}; + +static struct h8_instruction *h8_instructions; + +static void +h8300hmode (int arg ATTRIBUTE_UNUSED) +{ + Hmode = 1; + Smode = 0; +#ifdef BFD_ASSEMBLER + if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300h)) + as_warn (_("could not set architecture and machine")); +#endif +} + +static void +h8300smode (int arg ATTRIBUTE_UNUSED) +{ + Smode = 1; + Hmode = 1; +#ifdef BFD_ASSEMBLER + if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300s)) + as_warn (_("could not set architecture and machine")); +#endif +} + +static void +h8300hnmode (int arg ATTRIBUTE_UNUSED) +{ + Hmode = 1; + Smode = 0; + Nmode = 1; +#ifdef BFD_ASSEMBLER + if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300hn)) + as_warn (_("could not set architecture and machine")); +#endif +} + +static void +h8300snmode (int arg ATTRIBUTE_UNUSED) +{ + Smode = 1; + Hmode = 1; + Nmode = 1; +#ifdef BFD_ASSEMBLER + if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300sn)) + as_warn (_("could not set architecture and machine")); +#endif +} + +static void +h8300sxmode (int arg ATTRIBUTE_UNUSED) +{ + Smode = 1; + Hmode = 1; + SXmode = 1; +#ifdef BFD_ASSEMBLER + if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300sx)) + as_warn (_("could not set architecture and machine")); +#endif +} + +static void +h8300sxnmode (int arg ATTRIBUTE_UNUSED) +{ + Smode = 1; + Hmode = 1; + SXmode = 1; + Nmode = 1; +#ifdef BFD_ASSEMBLER + if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300sxn)) + as_warn (_("could not set architecture and machine")); +#endif +} + +static void +sbranch (int size) +{ + bsize = size; +} + +static void +pint (int arg ATTRIBUTE_UNUSED) +{ + cons (Hmode ? 4 : 2); +} + +/* This table describes all the machine specific pseudo-ops the assembler + has to support. The fields are: + pseudo-op name without dot + function to call to execute this pseudo-op + Integer arg to pass to the function. */ + +const pseudo_typeS md_pseudo_table[] = +{ + {"h8300h", h8300hmode, 0}, + {"h8300hn", h8300hnmode, 0}, + {"h8300s", h8300smode, 0}, + {"h8300sn", h8300snmode, 0}, + {"h8300sx", h8300sxmode, 0}, + {"h8300sxn", h8300sxnmode, 0}, + {"sbranch", sbranch, L_8}, + {"lbranch", sbranch, L_16}, + + {"int", pint, 0}, + {"data.b", cons, 1}, + {"data.w", cons, 2}, + {"data.l", cons, 4}, + {"form", listing_psize, 0}, + {"heading", listing_title, 0}, + {"import", s_ignore, 0}, + {"page", listing_eject, 0}, + {"program", s_ignore, 0}, + {0, 0, 0} +}; + +const int md_reloc_size; + +const char EXP_CHARS[] = "eE"; + +/* Chars that mean this number is a floating point constant + As in 0f12.456 + or 0d1.2345e12. */ +const char FLT_CHARS[] = "rRsSfFdDxXpP"; + +static struct hash_control *opcode_hash_control; /* Opcode mnemonics. */ + +/* This function is called once, at assembler startup time. This + should set up all the tables, etc. that the MD part of the assembler + needs. */ + +void +md_begin (void) +{ + unsigned int nopcodes; + struct h8_opcode *p, *p1; + struct h8_instruction *pi; + char prev_buffer[100]; + int idx = 0; + +#ifdef BFD_ASSEMBLER + if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300)) + as_warn (_("could not set architecture and machine")); +#endif + + opcode_hash_control = hash_new (); + prev_buffer[0] = 0; + + nopcodes = sizeof (h8_opcodes) / sizeof (struct h8_opcode); + + h8_instructions = (struct h8_instruction *) + xmalloc (nopcodes * sizeof (struct h8_instruction)); + + pi = h8_instructions; + p1 = h8_opcodes; + /* We do a minimum amount of sorting on the opcode table; this is to + make it easy to describe the mova instructions without unnecessary + code duplication. + Sorting only takes place inside blocks of instructions of the form + X/Y, so for example mova/b, mova/w and mova/l can be intermixed. */ + while (p1) + { + struct h8_opcode *first_skipped = 0; + int len, cmplen = 0; + char *src = p1->name; + char *dst, *buffer; + + if (p1->name == 0) + break; + /* Strip off any . part when inserting the opcode and only enter + unique codes into the hash table. */ + dst = buffer = malloc (strlen (src) + 1); + while (*src) + { + if (*src == '.') + { + src++; + break; + } + if (*src == '/') + cmplen = src - p1->name + 1; + *dst++ = *src++; + } + *dst = 0; + len = dst - buffer; + if (cmplen == 0) + cmplen = len; + hash_insert (opcode_hash_control, buffer, (char *) pi); + strcpy (prev_buffer, buffer); + idx++; + + for (p = p1; p->name; p++) + { + /* A negative TIME is used to indicate that we've added this opcode + already. */ + if (p->time == -1) + continue; + if (strncmp (p->name, buffer, cmplen) != 0 + || (p->name[cmplen] != '\0' && p->name[cmplen] != '.' + && p->name[cmplen - 1] != '/')) + { + if (first_skipped == 0) + first_skipped = p; + break; + } + if (strncmp (p->name, buffer, len) != 0) + { + if (first_skipped == 0) + first_skipped = p; + continue; + } + + p->time = -1; + pi->size = p->name[len] == '.' ? p->name[len + 1] : 0; + pi->idx = idx; + + /* Find the number of operands. */ + pi->noperands = 0; + while (pi->noperands < 3 && p->args.nib[pi->noperands] != (op_type) E) + pi->noperands++; + + /* Find the length of the opcode in bytes. */ + pi->length = 0; + while (p->data.nib[pi->length * 2] != (op_type) E) + pi->length++; + + pi->opcode = p; + pi++; + } + p1 = first_skipped; + } + + /* Add entry for the NULL vector terminator. */ + pi->length = 0; + pi->noperands = 0; + pi->idx = 0; + pi->size = 0; + pi->opcode = 0; + + linkrelax = 1; +} + +struct h8_op +{ + op_type mode; + unsigned reg; + expressionS exp; +}; + +static void clever_message (const struct h8_instruction *, struct h8_op *); +static void fix_operand_size (struct h8_op *, int); +static void build_bytes (const struct h8_instruction *, struct h8_op *); +static void do_a_fix_imm (int, int, struct h8_op *, int); +static void check_operand (struct h8_op *, unsigned int, char *); +static const struct h8_instruction * get_specific (const struct h8_instruction *, struct h8_op *, int) ; +static char *get_operands (unsigned, char *, struct h8_op *); +static void get_operand (char **, struct h8_op *, int); +static int parse_reg (char *, op_type *, unsigned *, int); +static char *skip_colonthing (char *, int *); +static char *parse_exp (char *, struct h8_op *); + +static int constant_fits_width_p (struct h8_op *, unsigned int); +static int constant_fits_size_p (struct h8_op *, int, int); + +/* + parse operands + WREG r0,r1,r2,r3,r4,r5,r6,r7,fp,sp + r0l,r0h,..r7l,r7h + @WREG + @WREG+ + @-WREG + #const + ccr +*/ + +/* Try to parse a reg name. Return the number of chars consumed. */ + +static int +parse_reg (char *src, op_type *mode, unsigned int *reg, int direction) +{ + char *end; + int len; + + /* Cribbed from get_symbol_end. */ + if (!is_name_beginner (*src) || *src == '\001') + return 0; + end = src + 1; + while ((is_part_of_name (*end) && *end != '.') || *end == '\001') + end++; + len = end - src; + + if (len == 2 && TOLOWER (src[0]) == 's' && TOLOWER (src[1]) == 'p') + { + *mode = PSIZE | REG | direction; + *reg = 7; + return len; + } + if (len == 3 && + TOLOWER (src[0]) == 'c' && + TOLOWER (src[1]) == 'c' && + TOLOWER (src[2]) == 'r') + { + *mode = CCR; + *reg = 0; + return len; + } + if (len == 3 && + TOLOWER (src[0]) == 'e' && + TOLOWER (src[1]) == 'x' && + TOLOWER (src[2]) == 'r') + { + *mode = EXR; + *reg = 1; + return len; + } + if (len == 3 && + TOLOWER (src[0]) == 'v' && + TOLOWER (src[1]) == 'b' && + TOLOWER (src[2]) == 'r') + { + *mode = VBR; + *reg = 6; + return len; + } + if (len == 3 && + TOLOWER (src[0]) == 's' && + TOLOWER (src[1]) == 'b' && + TOLOWER (src[2]) == 'r') + { + *mode = SBR; + *reg = 7; + return len; + } + if (len == 2 && TOLOWER (src[0]) == 'f' && TOLOWER (src[1]) == 'p') + { + *mode = PSIZE | REG | direction; + *reg = 6; + return len; + } + if (len == 3 && TOLOWER (src[0]) == 'e' && TOLOWER (src[1]) == 'r' && + src[2] >= '0' && src[2] <= '7') + { + *mode = L_32 | REG | direction; + *reg = src[2] - '0'; + if (!Hmode) + as_warn (_("Reg not valid for H8/300")); + return len; + } + if (len == 2 && TOLOWER (src[0]) == 'e' && src[1] >= '0' && src[1] <= '7') + { + *mode = L_16 | REG | direction; + *reg = src[1] - '0' + 8; + if (!Hmode) + as_warn (_("Reg not valid for H8/300")); + return len; + } + + if (TOLOWER (src[0]) == 'r') + { + if (src[1] >= '0' && src[1] <= '7') + { + if (len == 3 && TOLOWER (src[2]) == 'l') + { + *mode = L_8 | REG | direction; + *reg = (src[1] - '0') + 8; + return len; + } + if (len == 3 && TOLOWER (src[2]) == 'h') + { + *mode = L_8 | REG | direction; + *reg = (src[1] - '0'); + return len; + } + if (len == 2) + { + *mode = L_16 | REG | direction; + *reg = (src[1] - '0'); + return len; + } + } + } + + return 0; +} + + +/* Parse an immediate or address-related constant and store it in OP. + If the user also specifies the operand's size, store that size + in OP->MODE, otherwise leave it for later code to decide. */ + +static char * +parse_exp (char *src, struct h8_op *op) +{ + char *save; + + save = input_line_pointer; + input_line_pointer = src; + expression (&op->exp); + if (op->exp.X_op == O_absent) + as_bad (_("missing operand")); + src = input_line_pointer; + input_line_pointer = save; + + return skip_colonthing (src, &op->mode); +} + + +/* If SRC starts with an explicit operand size, skip it and store the size + in *MODE. Leave *MODE unchanged otherwise. */ + +static char * +skip_colonthing (char *src, int *mode) +{ + if (*src == ':') + { + src++; + *mode &= ~SIZE; + if (src[0] == '8' && !ISDIGIT (src[1])) + *mode |= L_8; + else if (src[0] == '2' && !ISDIGIT (src[1])) + *mode |= L_2; + else if (src[0] == '3' && !ISDIGIT (src[1])) + *mode |= L_3; + else if (src[0] == '4' && !ISDIGIT (src[1])) + *mode |= L_4; + else if (src[0] == '5' && !ISDIGIT (src[1])) + *mode |= L_5; + else if (src[0] == '2' && src[1] == '4' && !ISDIGIT (src[2])) + *mode |= L_24; + else if (src[0] == '3' && src[1] == '2' && !ISDIGIT (src[2])) + *mode |= L_32; + else if (src[0] == '1' && src[1] == '6' && !ISDIGIT (src[2])) + *mode |= L_16; + else + as_bad (_("invalid operand size requested")); + + while (ISDIGIT (*src)) + src++; + } + return src; +} + +/* The many forms of operand: + + Rn Register direct + @Rn Register indirect + @(exp[:16], Rn) Register indirect with displacement + @Rn+ + @-Rn + @aa:8 absolute 8 bit + @aa:16 absolute 16 bit + @aa absolute 16 bit + + #xx[:size] immediate data + @(exp:[8], pc) pc rel + @@aa[:8] memory indirect. */ + +static int +constant_fits_width_p (struct h8_op *operand, unsigned int width) +{ + return ((operand->exp.X_add_number & ~width) == 0 + || (operand->exp.X_add_number | width) == (unsigned)(~0)); +} + +static int +constant_fits_size_p (struct h8_op *operand, int size, int no_symbols) +{ + offsetT num = operand->exp.X_add_number; + if (no_symbols + && (operand->exp.X_add_symbol != 0 || operand->exp.X_op_symbol != 0)) + return 0; + switch (size) + { + case L_2: + return (num & ~3) == 0; + case L_3: + return (num & ~7) == 0; + case L_3NZ: + return num >= 1 && num < 8; + case L_4: + return (num & ~15) == 0; + case L_5: + return num >= 1 && num < 32; + case L_8: + return (num & ~0xFF) == 0 || ((unsigned)num | 0x7F) == ~0u; + case L_8U: + return (num & ~0xFF) == 0; + case L_16: + return (num & ~0xFFFF) == 0 || ((unsigned)num | 0x7FFF) == ~0u; + case L_16U: + return (num & ~0xFFFF) == 0; + case L_32: + return 1; + default: + abort (); + } +} + +static void +get_operand (char **ptr, struct h8_op *op, int direction) +{ + char *src = *ptr; + op_type mode; + unsigned int num; + unsigned int len; + + op->mode = 0; + + /* Check for '(' and ')' for instructions ldm and stm. */ + if (src[0] == '(' && src[8] == ')') + ++ src; + + /* Gross. Gross. ldm and stm have a format not easily handled + by get_operand. We deal with it explicitly here. */ + if (TOLOWER (src[0]) == 'e' && TOLOWER (src[1]) == 'r' && + ISDIGIT (src[2]) && src[3] == '-' && + TOLOWER (src[4]) == 'e' && TOLOWER (src[5]) == 'r' && ISDIGIT (src[6])) + { + int low, high; + + low = src[2] - '0'; + high = src[6] - '0'; + + /* Check register pair's validity as per tech note TN-H8*-193A/E + from Renesas for H8S and H8SX hardware manual. */ + if ( !(low == 0 && (high == 1 || high == 2 || high == 3)) + && !(low == 1 && (high == 2 || high == 3 || high == 4) && SXmode) + && !(low == 2 && (high == 3 || ((high == 4 || high == 5) && SXmode))) + && !(low == 3 && (high == 4 || high == 5 || high == 6) && SXmode) + && !(low == 4 && (high == 5 || high == 6)) + && !(low == 4 && high == 7 && SXmode) + && !(low == 5 && (high == 6 || high == 7) && SXmode) + && !(low == 6 && high == 7 && SXmode)) + as_bad (_("Invalid register list for ldm/stm\n")); + + /* Even sicker. We encode two registers into op->reg. One + for the low register to save, the other for the high + register to save; we also set the high bit in op->reg + so we know this is "very special". */ + op->reg = 0x80000000 | (high << 8) | low; + op->mode = REG; + if (src[7] == ')') + *ptr = src + 8; + else + *ptr = src + 7; + return; + } + + len = parse_reg (src, &op->mode, &op->reg, direction); + if (len) + { + src += len; + if (*src == '.') + { + int size = op->mode & SIZE; + switch (src[1]) + { + case 'l': case 'L': + if (size != L_32) + as_warn (_("mismatch between register and suffix")); + op->mode = (op->mode & ~MODE) | LOWREG; + break; + case 'w': case 'W': + if (size != L_32 && size != L_16) + as_warn (_("mismatch between register and suffix")); + op->mode = (op->mode & ~MODE) | LOWREG; + op->mode = (op->mode & ~SIZE) | L_16; + break; + case 'b': case 'B': + op->mode = (op->mode & ~MODE) | LOWREG; + if (size != L_32 && size != L_8) + as_warn (_("mismatch between register and suffix")); + op->mode = (op->mode & ~MODE) | LOWREG; + op->mode = (op->mode & ~SIZE) | L_8; + break; + default: + as_warn ("invalid suffix after register."); + break; + } + src += 2; + } + *ptr = src; + return; + } + + if (*src == '@') + { + src++; + if (*src == '@') + { + *ptr = parse_exp (src + 1, op); + if (op->exp.X_add_number >= 0x100) + { + int divisor = 1; + + op->mode = VECIND; + /* FIXME : 2? or 4? */ + if (op->exp.X_add_number >= 0x400) + as_bad (_("address too high for vector table jmp/jsr")); + else if (op->exp.X_add_number >= 0x200) + divisor = 4; + else + divisor = 2; + + op->exp.X_add_number = op->exp.X_add_number / divisor - 0x80; + } + else + op->mode = MEMIND; + return; + } + + if (*src == '-' || *src == '+') + { + len = parse_reg (src + 1, &mode, &num, direction); + if (len == 0) + { + /* Oops, not a reg after all, must be ordinary exp. */ + op->mode = ABS | direction; + *ptr = parse_exp (src, op); + return; + } + + if (((mode & SIZE) != PSIZE) + /* For Normal mode accept 16 bit and 32 bit pointer registers. */ + && (!Nmode || ((mode & SIZE) != L_32))) + as_bad (_("Wrong size pointer register for architecture.")); + + op->mode = src[0] == '-' ? RDPREDEC : RDPREINC; + op->reg = num; + *ptr = src + 1 + len; + return; + } + if (*src == '(') + { + src++; + + /* See if this is @(ERn.x, PC). */ + len = parse_reg (src, &mode, &op->reg, direction); + if (len != 0 && (mode & MODE) == REG && src[len] == '.') + { + switch (TOLOWER (src[len + 1])) + { + case 'b': + mode = PCIDXB | direction; + break; + case 'w': + mode = PCIDXW | direction; + break; + case 'l': + mode = PCIDXL | direction; + break; + default: + mode = 0; + break; + } + if (mode + && src[len + 2] == ',' + && TOLOWER (src[len + 3]) != 'p' + && TOLOWER (src[len + 4]) != 'c' + && src[len + 5] != ')') + { + *ptr = src + len + 6; + op->mode |= mode; + return; + } + /* Fall through into disp case - the grammar is somewhat + ambiguous, so we should try whether it's a DISP operand + after all ("ER3.L" might be a poorly named label...). */ + } + + /* Disp. */ + + /* Start off assuming a 16 bit offset. */ + + src = parse_exp (src, op); + if (*src == ')') + { + op->mode |= ABS | direction; + *ptr = src + 1; + return; + } + + if (*src != ',') + { + as_bad (_("expected @(exp, reg16)")); + return; + } + src++; + + len = parse_reg (src, &mode, &op->reg, direction); + if (len == 0 || (mode & MODE) != REG) + { + as_bad (_("expected @(exp, reg16)")); + return; + } + src += len; + if (src[0] == '.') + { + switch (TOLOWER (src[1])) + { + case 'b': + op->mode |= INDEXB | direction; + break; + case 'w': + op->mode |= INDEXW | direction; + break; + case 'l': + op->mode |= INDEXL | direction; + break; + default: + as_bad (_("expected .L, .W or .B for register in indexed addressing mode")); + } + src += 2; + op->reg &= 7; + } + else + op->mode |= DISP | direction; + src = skip_colonthing (src, &op->mode); + + if (*src != ')' && '(') + { + as_bad (_("expected @(exp, reg16)")); + return; + } + *ptr = src + 1; + return; + } + len = parse_reg (src, &mode, &num, direction); + + if (len) + { + src += len; + if (*src == '+' || *src == '-') + { + if (((mode & SIZE) != PSIZE) + /* For Normal mode accept 16 bit and 32 bit pointer registers. */ + && (!Nmode || ((mode & SIZE) != L_32))) + as_bad (_("Wrong size pointer register for architecture.")); + op->mode = *src == '+' ? RSPOSTINC : RSPOSTDEC; + op->reg = num; + src++; + *ptr = src; + return; + } + if (((mode & SIZE) != PSIZE) + /* For Normal mode accept 16 bit and 32 bit pointer registers. */ + && (!Nmode || ((mode & SIZE) != L_32))) + as_bad (_("Wrong size pointer register for architecture.")); + + op->mode = direction | IND | PSIZE; + op->reg = num; + *ptr = src; + + return; + } + else + { + /* must be a symbol */ + + op->mode = ABS | direction; + *ptr = parse_exp (src, op); + return; + } + } + + if (*src == '#') + { + op->mode = IMM; + *ptr = parse_exp (src + 1, op); + return; + } + else if (strncmp (src, "mach", 4) == 0 || + strncmp (src, "macl", 4) == 0 || + strncmp (src, "MACH", 4) == 0 || + strncmp (src, "MACL", 4) == 0) + { + op->reg = TOLOWER (src[3]) == 'l'; + op->mode = MACREG; + *ptr = src + 4; + return; + } + else + { + op->mode = PCREL; + *ptr = parse_exp (src, op); + } +} + +static char * +get_operands (unsigned int noperands, char *op_end, struct h8_op *operand) +{ + char *ptr = op_end; + + switch (noperands) + { + case 0: + break; + + case 1: + ptr++; + get_operand (&ptr, operand + 0, SRC); + if (*ptr == ',') + { + ptr++; + get_operand (&ptr, operand + 1, DST); + } + break; + + case 2: + ptr++; + get_operand (&ptr, operand + 0, SRC); + if (*ptr == ',') + ptr++; + get_operand (&ptr, operand + 1, DST); + break; + + case 3: + ptr++; + get_operand (&ptr, operand + 0, SRC); + if (*ptr == ',') + ptr++; + get_operand (&ptr, operand + 1, DST); + if (*ptr == ',') + ptr++; + get_operand (&ptr, operand + 2, OP3); + break; + + default: + abort (); + } + + return ptr; +} + +/* MOVA has special requirements. Rather than adding twice the amount of + addressing modes, we simply special case it a bit. */ +static void +get_mova_operands (char *op_end, struct h8_op *operand) +{ + char *ptr = op_end; + + if (ptr[1] != '@' || ptr[2] != '(') + goto error; + ptr += 3; + operand[0].mode = 0; + ptr = parse_exp (ptr, &operand[0]); + + if (*ptr !=',') + goto error; + ptr++; + get_operand (&ptr, operand + 1, DST); + + if (*ptr =='.') + { + ptr++; + switch (*ptr++) + { + case 'b': case 'B': + operand[0].mode = (operand[0].mode & ~MODE) | INDEXB; + break; + case 'w': case 'W': + operand[0].mode = (operand[0].mode & ~MODE) | INDEXW; + break; + case 'l': case 'L': + operand[0].mode = (operand[0].mode & ~MODE) | INDEXL; + break; + default: + goto error; + } + } + else if ((operand[1].mode & MODE) == LOWREG) + { + switch (operand[1].mode & SIZE) + { + case L_8: + operand[0].mode = (operand[0].mode & ~MODE) | INDEXB; + break; + case L_16: + operand[0].mode = (operand[0].mode & ~MODE) | INDEXW; + break; + case L_32: + operand[0].mode = (operand[0].mode & ~MODE) | INDEXL; + break; + default: + goto error; + } + } + else + goto error; + + if (*ptr++ != ')' || *ptr++ != ',') + goto error; + get_operand (&ptr, operand + 2, OP3); + /* See if we can use the short form of MOVA. */ + if (((operand[1].mode & MODE) == REG || (operand[1].mode & MODE) == LOWREG) + && (operand[2].mode & MODE) == REG + && (operand[1].reg & 7) == (operand[2].reg & 7)) + { + operand[1].mode = operand[2].mode = 0; + operand[0].reg = operand[2].reg & 7; + } + return; + + error: + as_bad (_("expected valid addressing mode for mova: \"@(disp, ea.sz),ERn\"")); +} + +static void +get_rtsl_operands (char *ptr, struct h8_op *operand) +{ + int mode, num, num2, len, type = 0; + + ptr++; + if (*ptr == '(') + { + ptr++; + type = 1; + } + len = parse_reg (ptr, &mode, &num, SRC); + if (len == 0 || (mode & MODE) != REG) + { + as_bad (_("expected register")); + return; + } + ptr += len; + if (*ptr == '-') + { + len = parse_reg (++ptr, &mode, &num2, SRC); + if (len == 0 || (mode & MODE) != REG) + { + as_bad (_("expected register")); + return; + } + ptr += len; + /* CONST_xxx are used as placeholders in the opcode table. */ + num = num2 - num; + if (num < 0 || num > 3) + { + as_bad (_("invalid register list")); + return; + } + } + else + num2 = num, num = 0; + if (type == 1 && *ptr++ != ')') + { + as_bad (_("expected closing paren")); + return; + } + operand[0].mode = RS32; + operand[1].mode = RD32; + operand[0].reg = num; + operand[1].reg = num2; +} + +/* Passed a pointer to a list of opcodes which use different + addressing modes, return the opcode which matches the opcodes + provided. */ + +static const struct h8_instruction * +get_specific (const struct h8_instruction *instruction, + struct h8_op *operands, int size) +{ + const struct h8_instruction *this_try = instruction; + const struct h8_instruction *found_other = 0, *found_mismatched = 0; + int found = 0; + int this_index = instruction->idx; + int noperands = 0; + + /* There's only one ldm/stm and it's easier to just + get out quick for them. */ + if (OP_KIND (instruction->opcode->how) == O_LDM + || OP_KIND (instruction->opcode->how) == O_STM) + return this_try; + + while (noperands < 3 && operands[noperands].mode != 0) + noperands++; + + while (this_index == instruction->idx && !found) + { + int this_size; + + found = 1; + this_try = instruction++; + this_size = this_try->opcode->how & SN; + + if (this_try->noperands != noperands) + found = 0; + else if (this_try->noperands > 0) + { + int i; + + for (i = 0; i < this_try->noperands && found; i++) + { + op_type op = this_try->opcode->args.nib[i]; + int op_mode = op & MODE; + int op_size = op & SIZE; + int x = operands[i].mode; + int x_mode = x & MODE; + int x_size = x & SIZE; + + if (op_mode == LOWREG && (x_mode == REG || x_mode == LOWREG)) + { + if ((x_size == L_8 && (operands[i].reg & 8) == 0) + || (x_size == L_16 && (operands[i].reg & 8) == 8)) + as_warn (_("can't use high part of register in operand %d"), i); + + if (x_size != op_size) + found = 0; + } + else if (op_mode == REG) + { + if (x_mode == LOWREG) + x_mode = REG; + if (x_mode != REG) + found = 0; + + if (x_size == L_P) + x_size = (Hmode ? L_32 : L_16); + if (op_size == L_P) + op_size = (Hmode ? L_32 : L_16); + + /* The size of the reg is v important. */ + if (op_size != x_size) + found = 0; + } + else if (op_mode & CTRL) /* control register */ + { + if (!(x_mode & CTRL)) + found = 0; + + switch (x_mode) + { + case CCR: + if (op_mode != CCR && + op_mode != CCR_EXR && + op_mode != CC_EX_VB_SB) + found = 0; + break; + case EXR: + if (op_mode != EXR && + op_mode != CCR_EXR && + op_mode != CC_EX_VB_SB) + found = 0; + break; + case MACH: + if (op_mode != MACH && + op_mode != MACREG) + found = 0; + break; + case MACL: + if (op_mode != MACL && + op_mode != MACREG) + found = 0; + break; + case VBR: + if (op_mode != VBR && + op_mode != VBR_SBR && + op_mode != CC_EX_VB_SB) + found = 0; + break; + case SBR: + if (op_mode != SBR && + op_mode != VBR_SBR && + op_mode != CC_EX_VB_SB) + found = 0; + break; + } + } + else if ((op & ABSJMP) && (x_mode == ABS || x_mode == PCREL)) + { + operands[i].mode &= ~MODE; + operands[i].mode |= ABSJMP; + /* But it may not be 24 bits long. */ + if (x_mode == ABS && !Hmode) + { + operands[i].mode &= ~SIZE; + operands[i].mode |= L_16; + } + if ((operands[i].mode & SIZE) == L_32 + && (op_mode & SIZE) != L_32) + found = 0; + } + else if (x_mode == IMM && op_mode != IMM) + { + offsetT num = operands[i].exp.X_add_number; + if (op_mode == KBIT || op_mode == DBIT) + /* This is ok if the immediate value is sensible. */; + else if (op_mode == CONST_2) + found = num == 2; + else if (op_mode == CONST_4) + found = num == 4; + else if (op_mode == CONST_8) + found = num == 8; + else if (op_mode == CONST_16) + found = num == 16; + else + found = 0; + } + else if (op_mode == PCREL && op_mode == x_mode) + { + /* movsd, bsr/bc and bsr/bs only come in PCREL16 flavour: + If x_size is L_8, promote it. */ + if (OP_KIND (this_try->opcode->how) == O_MOVSD + || OP_KIND (this_try->opcode->how) == O_BSRBC + || OP_KIND (this_try->opcode->how) == O_BSRBS) + if (x_size == L_8) + x_size = L_16; + + /* The size of the displacement is important. */ + if (op_size != x_size) + found = 0; + } + else if ((op_mode == DISP || op_mode == IMM || op_mode == ABS + || op_mode == INDEXB || op_mode == INDEXW + || op_mode == INDEXL) + && op_mode == x_mode) + { + /* Promote a L_24 to L_32 if it makes us match. */ + if (x_size == L_24 && op_size == L_32) + { + x &= ~SIZE; + x |= x_size = L_32; + } + +#if 0 /* ??? */ + /* Promote an L8 to L_16 if it makes us match. */ + if ((op_mode == ABS || op_mode == DISP) && x_size == L_8) + { + if (op_size == L_16) + x_size = L_16; + } +#endif + + if (((x_size == L_16 && op_size == L_16U) + || (x_size == L_8 && op_size == L_8U) + || (x_size == L_3 && op_size == L_3NZ)) + /* We're deliberately more permissive for ABS modes. */ + && (op_mode == ABS + || constant_fits_size_p (operands + i, op_size, + op & NO_SYMBOLS))) + x_size = op_size; + + if (x_size != 0 && op_size != x_size) + found = 0; + else if (x_size == 0 + && ! constant_fits_size_p (operands + i, op_size, + op & NO_SYMBOLS)) + found = 0; + } + else if (op_mode != x_mode) + { + found = 0; + } + } + } + if (found) + { + if ((this_try->opcode->available == AV_H8SX && ! SXmode) + || (this_try->opcode->available == AV_H8S && ! Smode) + || (this_try->opcode->available == AV_H8H && ! Hmode)) + found = 0, found_other = this_try; + else if (this_size != size && (this_size != SN && size != SN)) + found_mismatched = this_try, found = 0; + + } + } + if (found) + return this_try; + if (found_other) + { + as_warn (_("Opcode `%s' with these operand types not available in %s mode"), + found_other->opcode->name, + (! Hmode && ! Smode ? "H8/300" + : SXmode ? "H8sx" + : Smode ? "H8/300S" + : "H8/300H")); + } + else if (found_mismatched) + { + as_warn (_("mismatch between opcode size and operand size")); + return found_mismatched; + } + return 0; +} + +static void +check_operand (struct h8_op *operand, unsigned int width, char *string) +{ + if (operand->exp.X_add_symbol == 0 + && operand->exp.X_op_symbol == 0) + { + /* No symbol involved, let's look at offset, it's dangerous if + any of the high bits are not 0 or ff's, find out by oring or + anding with the width and seeing if the answer is 0 or all + fs. */ + + if (! constant_fits_width_p (operand, width)) + { + if (width == 255 + && (operand->exp.X_add_number & 0xff00) == 0xff00) + { + /* Just ignore this one - which happens when trying to + fit a 16 bit address truncated into an 8 bit address + of something like bset. */ + } + else if (strcmp (string, "@") == 0 + && width == 0xffff + && (operand->exp.X_add_number & 0xff8000) == 0xff8000) + { + /* Just ignore this one - which happens when trying to + fit a 24 bit address truncated into a 16 bit address + of something like mov.w. */ + } + else + { + as_warn (_("operand %s0x%lx out of range."), string, + (unsigned long) operand->exp.X_add_number); + } + } + } +} + +/* RELAXMODE has one of 3 values: + + 0 Output a "normal" reloc, no relaxing possible for this insn/reloc + + 1 Output a relaxable 24bit absolute mov.w address relocation + (may relax into a 16bit absolute address). + + 2 Output a relaxable 16/24 absolute mov.b address relocation + (may relax into an 8bit absolute address). */ + +static void +do_a_fix_imm (int offset, int nibble, struct h8_op *operand, int relaxmode) +{ + int idx; + int size; + int where; + char *bytes = frag_now->fr_literal + offset; + + char *t = ((operand->mode & MODE) == IMM) ? "#" : "@"; + + if (operand->exp.X_add_symbol == 0) + { + switch (operand->mode & SIZE) + { + case L_2: + check_operand (operand, 0x3, t); + bytes[0] |= (operand->exp.X_add_number & 3) << (nibble ? 0 : 4); + break; + case L_3: + case L_3NZ: + check_operand (operand, 0x7, t); + bytes[0] |= (operand->exp.X_add_number & 7) << (nibble ? 0 : 4); + break; + case L_4: + check_operand (operand, 0xF, t); + bytes[0] |= (operand->exp.X_add_number & 15) << (nibble ? 0 : 4); + break; + case L_5: + check_operand (operand, 0x1F, t); + bytes[0] |= operand->exp.X_add_number & 31; + break; + case L_8: + case L_8U: + check_operand (operand, 0xff, t); + bytes[0] |= operand->exp.X_add_number; + break; + case L_16: + case L_16U: + check_operand (operand, 0xffff, t); + bytes[0] |= operand->exp.X_add_number >> 8; + bytes[1] |= operand->exp.X_add_number >> 0; + break; + case L_24: + check_operand (operand, 0xffffff, t); + bytes[0] |= operand->exp.X_add_number >> 16; + bytes[1] |= operand->exp.X_add_number >> 8; + bytes[2] |= operand->exp.X_add_number >> 0; + break; + + case L_32: + /* This should be done with bfd. */ + bytes[0] |= operand->exp.X_add_number >> 24; + bytes[1] |= operand->exp.X_add_number >> 16; + bytes[2] |= operand->exp.X_add_number >> 8; + bytes[3] |= operand->exp.X_add_number >> 0; + if (relaxmode != 0) + { + idx = (relaxmode == 2) ? R_MOV24B1 : R_MOVL1; + fix_new_exp (frag_now, offset, 4, &operand->exp, 0, idx); + } + break; + } + } + else + { + switch (operand->mode & SIZE) + { + case L_24: + case L_32: + size = 4; + where = (operand->mode & SIZE) == L_24 ? -1 : 0; + if (relaxmode == 2) + idx = R_MOV24B1; + else if (relaxmode == 1) + idx = R_MOVL1; + else + idx = R_RELLONG; + break; + default: + as_bad (_("Can't work out size of operand.\n")); + case L_16: + case L_16U: + size = 2; + where = 0; + if (relaxmode == 2) + idx = R_MOV16B1; + else + idx = R_RELWORD; + operand->exp.X_add_number = + ((operand->exp.X_add_number & 0xffff) ^ 0x8000) - 0x8000; + operand->exp.X_add_number |= (bytes[0] << 8) | bytes[1]; + break; + case L_8: + size = 1; + where = 0; + idx = R_RELBYTE; + operand->exp.X_add_number = + ((operand->exp.X_add_number & 0xff) ^ 0x80) - 0x80; + operand->exp.X_add_number |= bytes[0]; + } + + fix_new_exp (frag_now, + offset + where, + size, + &operand->exp, + 0, + idx); + } +} + +/* Now we know what sort of opcodes it is, let's build the bytes. */ + +static void +build_bytes (const struct h8_instruction *this_try, struct h8_op *operand) +{ + int i; + char *output = frag_more (this_try->length); + op_type *nibble_ptr = this_try->opcode->data.nib; + op_type c; + unsigned int nibble_count = 0; + int op_at[3]; + int nib = 0; + int movb = 0; + char asnibbles[100]; + char *p = asnibbles; + int high, low; + + if (!Hmode && this_try->opcode->available != AV_H8) + as_warn (_("Opcode `%s' with these operand types not available in H8/300 mode"), + this_try->opcode->name); + else if (!Smode + && this_try->opcode->available != AV_H8 + && this_try->opcode->available != AV_H8H) + as_warn (_("Opcode `%s' with these operand types not available in H8/300H mode"), + this_try->opcode->name); + else if (!SXmode + && this_try->opcode->available != AV_H8 + && this_try->opcode->available != AV_H8H + && this_try->opcode->available != AV_H8S) + as_warn (_("Opcode `%s' with these operand types not available in H8/300S mode"), + this_try->opcode->name); + + while (*nibble_ptr != (op_type) E) + { + int d; + + nib = 0; + c = *nibble_ptr++; + + d = (c & OP3) == OP3 ? 2 : (c & DST) == DST ? 1 : 0; + + if (c < 16) + nib = c; + else + { + int c2 = c & MODE; + + if (c2 == REG || c2 == LOWREG + || c2 == IND || c2 == PREINC || c2 == PREDEC + || c2 == POSTINC || c2 == POSTDEC) + { + nib = operand[d].reg; + if (c2 == LOWREG) + nib &= 7; + } + + else if (c & CTRL) /* Control reg operand. */ + nib = operand[d].reg; + + else if ((c & DISPREG) == (DISPREG)) + { + nib = operand[d].reg; + } + else if (c2 == ABS) + { + operand[d].mode = c; + op_at[d] = nibble_count; + nib = 0; + } + else if (c2 == IMM || c2 == PCREL || c2 == ABS + || (c & ABSJMP) || c2 == DISP) + { + operand[d].mode = c; + op_at[d] = nibble_count; + nib = 0; + } + else if ((c & IGNORE) || (c & DATA)) + nib = 0; + + else if (c2 == DBIT) + { + switch (operand[0].exp.X_add_number) + { + case 1: + nib = c; + break; + case 2: + nib = 0x8 | c; + break; + default: + as_bad (_("Need #1 or #2 here")); + } + } + else if (c2 == KBIT) + { + switch (operand[0].exp.X_add_number) + { + case 1: + nib = 0; + break; + case 2: + nib = 8; + break; + case 4: + if (!Hmode) + as_warn (_("#4 not valid on H8/300.")); + nib = 9; + break; + + default: + as_bad (_("Need #1 or #2 here")); + break; + } + /* Stop it making a fix. */ + operand[0].mode = 0; + } + + if (c & MEMRELAX) + operand[d].mode |= MEMRELAX; + + if (c & B31) + nib |= 0x8; + + if (c & B21) + nib |= 0x4; + + if (c & B11) + nib |= 0x2; + + if (c & B01) + nib |= 0x1; + + if (c2 == MACREG) + { + if (operand[0].mode == MACREG) + /* stmac has mac[hl] as the first operand. */ + nib = 2 + operand[0].reg; + else + /* ldmac has mac[hl] as the second operand. */ + nib = 2 + operand[1].reg; + } + } + nibble_count++; + + *p++ = nib; + } + + /* Disgusting. Why, oh why didn't someone ask us for advice + on the assembler format. */ + if (OP_KIND (this_try->opcode->how) == O_LDM) + { + high = (operand[1].reg >> 8) & 0xf; + low = (operand[1].reg) & 0xf; + asnibbles[2] = high - low; + asnibbles[7] = high; + } + else if (OP_KIND (this_try->opcode->how) == O_STM) + { + high = (operand[0].reg >> 8) & 0xf; + low = (operand[0].reg) & 0xf; + asnibbles[2] = high - low; + asnibbles[7] = low; + } + + for (i = 0; i < this_try->length; i++) + output[i] = (asnibbles[i * 2] << 4) | asnibbles[i * 2 + 1]; + + /* Note if this is a movb or a bit manipulation instruction + there is a special relaxation which only applies. */ + if ( this_try->opcode->how == O (O_MOV, SB) + || this_try->opcode->how == O (O_BCLR, SB) + || this_try->opcode->how == O (O_BAND, SB) + || this_try->opcode->how == O (O_BIAND, SB) + || this_try->opcode->how == O (O_BILD, SB) + || this_try->opcode->how == O (O_BIOR, SB) + || this_try->opcode->how == O (O_BIST, SB) + || this_try->opcode->how == O (O_BIXOR, SB) + || this_try->opcode->how == O (O_BLD, SB) + || this_try->opcode->how == O (O_BNOT, SB) + || this_try->opcode->how == O (O_BOR, SB) + || this_try->opcode->how == O (O_BSET, SB) + || this_try->opcode->how == O (O_BST, SB) + || this_try->opcode->how == O (O_BTST, SB) + || this_try->opcode->how == O (O_BXOR, SB)) + movb = 1; + + /* Output any fixes. */ + for (i = 0; i < this_try->noperands; i++) + { + int x = operand[i].mode; + int x_mode = x & MODE; + + if (x_mode == IMM || x_mode == DISP) + do_a_fix_imm (output - frag_now->fr_literal + op_at[i] / 2, + op_at[i] & 1, operand + i, (x & MEMRELAX) != 0); + + else if (x_mode == ABS) + do_a_fix_imm (output - frag_now->fr_literal + op_at[i] / 2, + op_at[i] & 1, operand + i, + (x & MEMRELAX) ? movb + 1 : 0); + + else if (x_mode == PCREL) + { + int size16 = (x & SIZE) == L_16; + int size = size16 ? 2 : 1; + int type = size16 ? R_PCRWORD : R_PCRBYTE; + fixS *fixP; + + check_operand (operand + i, size16 ? 0x7fff : 0x7f, "@"); + + if (operand[i].exp.X_add_number & 1) + as_warn (_("branch operand has odd offset (%lx)\n"), + (unsigned long) operand->exp.X_add_number); +#ifndef OBJ_ELF + /* The COFF port has always been off by one, changing it + now would be an incompatible change, so we leave it as-is. + + We don't want to do this for ELF as we want to be + compatible with the proposed ELF format from Hitachi. */ + operand[i].exp.X_add_number -= 1; +#endif + if (size16) + { + operand[i].exp.X_add_number = + ((operand[i].exp.X_add_number & 0xffff) ^ 0x8000) - 0x8000; + } + else + { + operand[i].exp.X_add_number = + ((operand[i].exp.X_add_number & 0xff) ^ 0x80) - 0x80; + } + + /* For BRA/S. */ + if (! size16) + operand[i].exp.X_add_number |= output[op_at[i] / 2]; + + fixP = fix_new_exp (frag_now, + output - frag_now->fr_literal + op_at[i] / 2, + size, + &operand[i].exp, + 1, + type); + fixP->fx_signed = 1; + } + else if (x_mode == MEMIND) + { + check_operand (operand + i, 0xff, "@@"); + fix_new_exp (frag_now, + output - frag_now->fr_literal + 1, + 1, + &operand[i].exp, + 0, + R_MEM_INDIRECT); + } + else if (x_mode == VECIND) + { + check_operand (operand + i, 0x7f, "@@"); + /* FIXME: approximating the effect of "B31" here... + This is very hackish, and ought to be done a better way. */ + operand[i].exp.X_add_number |= 0x80; + fix_new_exp (frag_now, + output - frag_now->fr_literal + 1, + 1, + &operand[i].exp, + 0, + R_MEM_INDIRECT); + } + else if (x & ABSJMP) + { + int where = 0; + bfd_reloc_code_real_type reloc_type = R_JMPL1; + +#ifdef OBJ_ELF + /* To be compatible with the proposed H8 ELF format, we + want the relocation's offset to point to the first byte + that will be modified, not to the start of the instruction. */ + + if ((operand->mode & SIZE) == L_32) + { + where = 2; + reloc_type = R_RELLONG; + } + else + where = 1; +#endif + + /* This jmp may be a jump or a branch. */ + + check_operand (operand + i, + SXmode ? 0xffffffff : Hmode ? 0xffffff : 0xffff, + "@"); + + if (operand[i].exp.X_add_number & 1) + as_warn (_("branch operand has odd offset (%lx)\n"), + (unsigned long) operand->exp.X_add_number); + + if (!Hmode) + operand[i].exp.X_add_number = + ((operand[i].exp.X_add_number & 0xffff) ^ 0x8000) - 0x8000; + fix_new_exp (frag_now, + output - frag_now->fr_literal + where, + 4, + &operand[i].exp, + 0, + reloc_type); + } + } +} + +/* Try to give an intelligent error message for common and simple to + detect errors. */ + +static void +clever_message (const struct h8_instruction *instruction, + struct h8_op *operand) +{ + /* Find out if there was more than one possible opcode. */ + + if ((instruction + 1)->idx != instruction->idx) + { + int argn; + + /* Only one opcode of this flavour, try to guess which operand + didn't match. */ + for (argn = 0; argn < instruction->noperands; argn++) + { + switch (instruction->opcode->args.nib[argn]) + { + case RD16: + if (operand[argn].mode != RD16) + { + as_bad (_("destination operand must be 16 bit register")); + return; + + } + break; + + case RS8: + if (operand[argn].mode != RS8) + { + as_bad (_("source operand must be 8 bit register")); + return; + } + break; + + case ABS16DST: + if (operand[argn].mode != ABS16DST) + { + as_bad (_("destination operand must be 16bit absolute address")); + return; + } + break; + case RD8: + if (operand[argn].mode != RD8) + { + as_bad (_("destination operand must be 8 bit register")); + return; + } + break; + + case ABS16SRC: + if (operand[argn].mode != ABS16SRC) + { + as_bad (_("source operand must be 16bit absolute address")); + return; + } + break; + + } + } + } + as_bad (_("invalid operands")); +} + + +/* If OPERAND is part of an address, adjust its size and value given + that it addresses SIZE bytes. + + This function decides how big non-immediate constants are when no + size was explicitly given. It also scales down the assembly-level + displacement in an @(d:2,ERn) operand. */ + +static void +fix_operand_size (struct h8_op *operand, int size) +{ + if (SXmode && (operand->mode & MODE) == DISP) + { + /* If the user didn't specify an operand width, see if we + can use @(d:2,ERn). */ + if ((operand->mode & SIZE) == 0 + && operand->exp.X_add_symbol == 0 + && operand->exp.X_op_symbol == 0 + && (operand->exp.X_add_number == size + || operand->exp.X_add_number == size * 2 + || operand->exp.X_add_number == size * 3)) + operand->mode |= L_2; + + /* Scale down the displacement in an @(d:2,ERn) operand. + X_add_number then contains the desired field value. */ + if ((operand->mode & SIZE) == L_2) + { + if (operand->exp.X_add_number % size != 0) + as_warn (_("operand/size mis-match")); + operand->exp.X_add_number /= size; + } + } + + if ((operand->mode & SIZE) == 0) + switch (operand->mode & MODE) + { + case DISP: + case INDEXB: + case INDEXW: + case INDEXL: + case ABS: + /* Pick a 24-bit address unless we know that a 16-bit address + is safe. get_specific() will relax L_24 into L_32 where + necessary. */ + if (Hmode + && !Nmode + && (operand->exp.X_add_number < -32768 + || operand->exp.X_add_number > 32767 + || operand->exp.X_add_symbol != 0 + || operand->exp.X_op_symbol != 0)) + operand->mode |= L_24; + else + operand->mode |= L_16; + break; + + case PCREL: + /* This condition is long standing, though somewhat suspect. */ + if (operand->exp.X_add_number > -128 + && operand->exp.X_add_number < 127) + operand->mode |= L_8; + else + operand->mode |= L_16; + break; + } +} + + +/* This is the guts of the machine-dependent assembler. STR points to + a machine dependent instruction. This function is supposed to emit + the frags/bytes it assembles. */ + +void +md_assemble (char *str) +{ + char *op_start; + char *op_end; + struct h8_op operand[3]; + const struct h8_instruction *instruction; + const struct h8_instruction *prev_instruction; + + char *dot = 0; + char *slash = 0; + char c; + int size, i; + + /* Drop leading whitespace. */ + while (*str == ' ') + str++; + + /* Find the op code end. */ + for (op_start = op_end = str; + *op_end != 0 && *op_end != ' '; + op_end++) + { + if (*op_end == '.') + { + dot = op_end + 1; + *op_end = 0; + op_end += 2; + break; + } + else if (*op_end == '/' && ! slash) + slash = op_end; + } + + if (op_end == op_start) + { + as_bad (_("can't find opcode ")); + } + c = *op_end; + + *op_end = 0; + + /* The assembler stops scanning the opcode at slashes, so it fails + to make characters following them lower case. Fix them. */ + if (slash) + while (*++slash) + *slash = TOLOWER (*slash); + + instruction = (const struct h8_instruction *) + hash_find (opcode_hash_control, op_start); + + if (instruction == NULL) + { + as_bad (_("unknown opcode")); + return; + } + + /* We used to set input_line_pointer to the result of get_operands, + but that is wrong. Our caller assumes we don't change it. */ + + operand[0].mode = 0; + operand[1].mode = 0; + operand[2].mode = 0; + + if (OP_KIND (instruction->opcode->how) == O_MOVAB + || OP_KIND (instruction->opcode->how) == O_MOVAW + || OP_KIND (instruction->opcode->how) == O_MOVAL) + get_mova_operands (op_end, operand); + else if (OP_KIND (instruction->opcode->how) == O_RTEL + || OP_KIND (instruction->opcode->how) == O_RTSL) + get_rtsl_operands (op_end, operand); + else + get_operands (instruction->noperands, op_end, operand); + + *op_end = c; + prev_instruction = instruction; + + /* Now we have operands from instruction. + Let's check them out for ldm and stm. */ + if (OP_KIND (instruction->opcode->how) == O_LDM) + { + /* The first operand must be @er7+, and the + second operand must be a register pair. */ + if ((operand[0].mode != RSINC) + || (operand[0].reg != 7) + || ((operand[1].reg & 0x80000000) == 0)) + as_bad (_("invalid operand in ldm")); + } + else if (OP_KIND (instruction->opcode->how) == O_STM) + { + /* The first operand must be a register pair, + and the second operand must be @-er7. */ + if (((operand[0].reg & 0x80000000) == 0) + || (operand[1].mode != RDDEC) + || (operand[1].reg != 7)) + as_bad (_("invalid operand in stm")); + } + + size = SN; + if (dot) + { + switch (TOLOWER (*dot)) + { + case 'b': + size = SB; + break; + + case 'w': + size = SW; + break; + + case 'l': + size = SL; + break; + } + } + if (OP_KIND (instruction->opcode->how) == O_MOVAB || + OP_KIND (instruction->opcode->how) == O_MOVAW || + OP_KIND (instruction->opcode->how) == O_MOVAL) + { + switch (operand[0].mode & MODE) + { + case INDEXB: + default: + fix_operand_size (&operand[1], 1); + break; + case INDEXW: + fix_operand_size (&operand[1], 2); + break; + case INDEXL: + fix_operand_size (&operand[1], 4); + break; + } + } + else + { + for (i = 0; i < 3 && operand[i].mode != 0; i++) + switch (size) + { + case SN: + case SB: + default: + fix_operand_size (&operand[i], 1); + break; + case SW: + fix_operand_size (&operand[i], 2); + break; + case SL: + fix_operand_size (&operand[i], 4); + break; + } + } + + instruction = get_specific (instruction, operand, size); + + if (instruction == 0) + { + /* Couldn't find an opcode which matched the operands. */ + char *where = frag_more (2); + + where[0] = 0x0; + where[1] = 0x0; + clever_message (prev_instruction, operand); + + return; + } + + build_bytes (instruction, operand); + +#ifdef BFD_ASSEMBLER + dwarf2_emit_insn (instruction->length); +#endif +} + +#ifndef BFD_ASSEMBLER +void +tc_crawl_symbol_chain (object_headers *headers ATTRIBUTE_UNUSED) +{ + printf (_("call to tc_crawl_symbol_chain \n")); +} +#endif + +symbolS * +md_undefined_symbol (char *name ATTRIBUTE_UNUSED) +{ + return 0; +} + +#ifndef BFD_ASSEMBLER +void +tc_headers_hook (object_headers *headers ATTRIBUTE_UNUSED) +{ + printf (_("call to tc_headers_hook \n")); +} +#endif + +/* Various routines to kill one day */ +/* Equal to MAX_PRECISION in atof-ieee.c */ +#define MAX_LITTLENUMS 6 + +/* Turn a string in input_line_pointer into a floating point constant + of type TYPE, and store the appropriate bytes in *LITP. The number + of LITTLENUMS emitted is stored in *SIZEP. An error message is + returned, or NULL on OK. */ + +char * +md_atof (int type, char *litP, int *sizeP) +{ + int prec; + LITTLENUM_TYPE words[MAX_LITTLENUMS]; + LITTLENUM_TYPE *wordP; + char *t; + + switch (type) + { + case 'f': + case 'F': + case 's': + case 'S': + prec = 2; + break; + + case 'd': + case 'D': + case 'r': + case 'R': + prec = 4; + break; + + case 'x': + case 'X': + prec = 6; + break; + + case 'p': + case 'P': + prec = 6; + break; + + default: + *sizeP = 0; + return _("Bad call to MD_ATOF()"); + } + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + + *sizeP = prec * sizeof (LITTLENUM_TYPE); + for (wordP = words; prec--;) + { + md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } + return 0; +} + +const char *md_shortopts = ""; +struct option md_longopts[] = { + {NULL, no_argument, NULL, 0} +}; + +size_t md_longopts_size = sizeof (md_longopts); + +int +md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED) +{ + return 0; +} + +void +md_show_usage (FILE *stream ATTRIBUTE_UNUSED) +{ +} + +void tc_aout_fix_to_chars (void); + +void +tc_aout_fix_to_chars (void) +{ + printf (_("call to tc_aout_fix_to_chars \n")); + abort (); +} + +void +md_convert_frag ( +#ifdef BFD_ASSEMBLER + bfd *headers ATTRIBUTE_UNUSED, +#else + object_headers *headers ATTRIBUTE_UNUSED, +#endif + segT seg ATTRIBUTE_UNUSED, + fragS *fragP ATTRIBUTE_UNUSED) +{ + printf (_("call to md_convert_frag \n")); + abort (); +} + +#ifdef BFD_ASSEMBLER +valueT +md_section_align (segT segment, valueT size) +{ + int align = bfd_get_section_alignment (stdoutput, segment); + return ((size + (1 << align) - 1) & (-1 << align)); +} +#else +valueT +md_section_align (segT seg, valueT size) +{ + return ((size + (1 << section_alignment[(int) seg]) - 1) + & (-1 << section_alignment[(int) seg])); +} +#endif + + +void +md_apply_fix3 (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) +{ + char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; + long val = *valP; + + switch (fixP->fx_size) + { + case 1: + *buf++ = val; + break; + case 2: + *buf++ = (val >> 8); + *buf++ = val; + break; + case 4: + *buf++ = (val >> 24); + *buf++ = (val >> 16); + *buf++ = (val >> 8); + *buf++ = val; + break; + default: + abort (); + } + + if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0) + fixP->fx_done = 1; +} + +int +md_estimate_size_before_relax (register fragS *fragP ATTRIBUTE_UNUSED, + register segT segment_type ATTRIBUTE_UNUSED) +{ + printf (_("call tomd_estimate_size_before_relax \n")); + abort (); +} + +/* Put number into target byte order. */ +void +md_number_to_chars (char *ptr, valueT use, int nbytes) +{ + number_to_chars_bigendian (ptr, use, nbytes); +} + +long +md_pcrel_from (fixS *fixP ATTRIBUTE_UNUSED) +{ + abort (); +} + +#ifndef BFD_ASSEMBLER +void +tc_reloc_mangle (fixS *fix_ptr, struct internal_reloc *intr, bfd_vma base) +{ + symbolS *symbol_ptr; + + symbol_ptr = fix_ptr->fx_addsy; + + /* If this relocation is attached to a symbol then it's ok + to output it. */ + if (fix_ptr->fx_r_type == TC_CONS_RELOC) + { + /* cons likes to create reloc32's whatever the size of the reloc.. + */ + switch (fix_ptr->fx_size) + { + case 4: + intr->r_type = R_RELLONG; + break; + case 2: + intr->r_type = R_RELWORD; + break; + case 1: + intr->r_type = R_RELBYTE; + break; + default: + abort (); + } + } + else + { + intr->r_type = fix_ptr->fx_r_type; + } + + intr->r_vaddr = fix_ptr->fx_frag->fr_address + fix_ptr->fx_where + base; + intr->r_offset = fix_ptr->fx_offset; + + if (symbol_ptr) + { + if (symbol_ptr->sy_number != -1) + intr->r_symndx = symbol_ptr->sy_number; + else + { + symbolS *segsym; + + /* This case arises when a reference is made to `.'. */ + segsym = seg_info (S_GET_SEGMENT (symbol_ptr))->dot; + if (segsym == NULL) + intr->r_symndx = -1; + else + { + intr->r_symndx = segsym->sy_number; + intr->r_offset += S_GET_VALUE (symbol_ptr); + } + } + } + else + intr->r_symndx = -1; +} +#else /* BFD_ASSEMBLER */ +arelent * +tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp) +{ + arelent *rel; + bfd_reloc_code_real_type r_type; + + if (fixp->fx_addsy && fixp->fx_subsy) + { + if ((S_GET_SEGMENT (fixp->fx_addsy) != S_GET_SEGMENT (fixp->fx_subsy)) + || S_GET_SEGMENT (fixp->fx_addsy) == undefined_section) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + "Difference of symbols in different sections is not supported"); + return NULL; + } + } + + rel = (arelent *) xmalloc (sizeof (arelent)); + rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); + *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); + rel->address = fixp->fx_frag->fr_address + fixp->fx_where; + rel->addend = fixp->fx_offset; + + r_type = fixp->fx_r_type; + +#define DEBUG 0 +#if DEBUG + fprintf (stderr, "%s\n", bfd_get_reloc_code_name (r_type)); + fflush(stderr); +#endif + rel->howto = bfd_reloc_type_lookup (stdoutput, r_type); + if (rel->howto == NULL) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + _("Cannot represent relocation type %s"), + bfd_get_reloc_code_name (r_type)); + return NULL; + } + + return rel; +} +#endif diff --git a/gas/config/tc-h8300.h b/gas/config/tc-h8300.h new file mode 100644 index 0000000000000..89351cbe93298 --- /dev/null +++ b/gas/config/tc-h8300.h @@ -0,0 +1,103 @@ +/* This file is tc-h8300.h + Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, + 1997, 1998, 2000, 2002, 2003 + Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#define TC_H8300 + +#define TARGET_BYTES_BIG_ENDIAN 1 + +#define TARGET_ARCH bfd_arch_h8300 + +#ifdef BFD_ASSEMBLER +/* Fixup debug sections since we will never relax them. */ +#define TC_LINKRELAX_FIXUP(seg) (seg->flags & SEC_ALLOC) +#endif +#ifdef OBJ_ELF +#define TARGET_FORMAT "elf32-h8300" +#define LOCAL_LABEL_PREFIX '.' +#define LOCAL_LABEL(NAME) (NAME[0] == '.' && NAME[1] == 'L') +#define FAKE_LABEL_NAME ".L0\001" +#endif + +#if ANSI_PROTOTYPES +struct fix; +struct internal_reloc; +#endif + +#define WORKING_DOT_WORD + +/* This macro translates between an internal fix and a coff reloc type. */ +#define TC_COFF_FIX2RTYPE(fixP) abort (); + +#define BFD_ARCH bfd_arch_h8300 +#define COFF_MAGIC ( Smode && Nmode ? 0x8304 : Hmode && Nmode ? 0x8303 : Smode ? 0x8302 : Hmode ? 0x8301 : 0x8300) +#define TC_COUNT_RELOC(x) (1) +#define IGNORE_NONSTANDARD_ESCAPES + +#define tc_coff_symbol_emit_hook(a) ; /* not used */ +#define TC_RELOC_MANGLE(s,a,b,c) tc_reloc_mangle(a,b,c) +extern void tc_reloc_mangle (struct fix *, struct internal_reloc *, bfd_vma); + +/* No shared lib support, so we don't need to ensure externally + visible symbols can be overridden. */ +#define EXTERN_FORCE_RELOC 0 + +/* Minimum instruction is of 16 bits. */ +#define DWARF2_LINE_MIN_INSN_LENGTH 2 + +#ifdef OBJ_ELF +/* Provide mappings from the original H8 COFF relocation names to + their corresponding BFD relocation names. This allows us to use + most of tc-h8300.c without modifications for both ELF and COFF + ports. */ +#define R_MOV24B1 BFD_RELOC_H8_DIR24A8 +#define R_MOVL1 BFD_RELOC_H8_DIR32A16 +#define R_MOV24B1 BFD_RELOC_H8_DIR24A8 +#define R_MOVL1 BFD_RELOC_H8_DIR32A16 +#define R_RELLONG BFD_RELOC_32 +#define R_MOV16B1 BFD_RELOC_H8_DIR16A8 +#define R_RELWORD BFD_RELOC_16 +#define R_RELBYTE BFD_RELOC_8 +#define R_PCRWORD BFD_RELOC_16_PCREL +#define R_PCRBYTE BFD_RELOC_8_PCREL +#define R_JMPL1 BFD_RELOC_H8_DIR24R8 +#define R_MEM_INDIRECT BFD_RELOC_8 + +/* We do not want to adjust any relocations to make implementation of + linker relaxations easier. */ +#define tc_fix_adjustable(FIX) 0 +#endif + +#define TC_CONS_RELOC (Hmode ? R_RELLONG: R_RELWORD) + +#define DO_NOT_STRIP 0 +#define LISTING_HEADER "Renesas H8/300 GAS " +#define NEED_FX_R_TYPE 1 +#ifndef OBJ_ELF +#define RELOC_32 1234 +#endif + +extern int Hmode; +extern int Smode; +extern int Nmode; +extern int SXmode; + +#define md_operand(x) diff --git a/gas/config/tc-h8500.c b/gas/config/tc-h8500.c new file mode 100644 index 0000000000000..cd4d76f8831cf --- /dev/null +++ b/gas/config/tc-h8500.c @@ -0,0 +1,1617 @@ +/* tc-h8500.c -- Assemble code for the Renesas H8/500 + Copyright 1993, 1994, 1995, 1998, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* Written By Steve Chamberlain . */ + +#include +#include "as.h" +#include "bfd.h" +#include "subsegs.h" +#define DEFINE_TABLE +#define ASSEMBLER_TABLE +#include "opcodes/h8500-opc.h" +#include "safe-ctype.h" + +const char comment_chars[] = "!"; +const char line_separator_chars[] = ";"; +const char line_comment_chars[] = "!#"; + +/* This table describes all the machine specific pseudo-ops the assembler + has to support. The fields are: + pseudo-op name without dot + function to call to execute this pseudo-op + Integer arg to pass to the function + */ + +const pseudo_typeS md_pseudo_table[] = +{ + {"int", cons, 2}, + {"data.b", cons, 1}, + {"data.w", cons, 2}, + {"data.l", cons, 4}, + {"form", listing_psize, 0}, + {"heading", listing_title, 0}, + {"import", s_ignore, 0}, + {"page", listing_eject, 0}, + {"program", s_ignore, 0}, + {0, 0, 0} +}; + +const int md_reloc_size; + +const char EXP_CHARS[] = "eE"; + +/* Chars that mean this number is a floating point constant */ +/* As in 0f12.456 */ +/* or 0d1.2345e12 */ +const char FLT_CHARS[] = "rRsSfFdDxXpP"; + +#define C(a,b) ENCODE_RELAX(a,b) +#define ENCODE_RELAX(what,length) (((what) << 2) + (length)) + +#define GET_WHAT(x) ((x>>2)) + +#define BYTE_DISP 1 +#define WORD_DISP 2 +#define UNDEF_BYTE_DISP 0 +#define UNDEF_WORD_DISP 3 + +#define BRANCH 1 +#define SCB_F 2 +#define SCB_TST 3 +#define END 4 + +#define BYTE_F 127 +#define BYTE_B -126 +#define WORD_F 32767 +#define WORD_B 32768 + +relax_typeS md_relax_table[C (END, 0)] = { + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + { 0, 0, 0, 0 }, + + /* BRANCH */ + { 0, 0, 0, 0 }, + { BYTE_F, BYTE_B, 2, C (BRANCH, WORD_DISP) }, + { WORD_F, WORD_B, 3, 0 }, + { 0, 0, 3, 0 }, + + /* SCB_F */ + { 0, 0, 0, 0 }, + { BYTE_F, BYTE_B, 3, C (SCB_F, WORD_DISP) }, + { WORD_F, WORD_B, 8, 0 }, + { 0, 0, 8, 0 }, + + /* SCB_TST */ + { 0, 0, 0, 0 }, + { BYTE_F, BYTE_B, 3, C (SCB_TST, WORD_DISP) }, + { WORD_F, WORD_B, 10, 0 }, + { 0, 0, 10, 0 } + +}; + +static struct hash_control *opcode_hash_control; /* Opcode mnemonics */ + +/* + This function is called once, at assembler startup time. This should + set up all the tables, etc. that the MD part of the assembler needs + */ + +void +md_begin () +{ + const h8500_opcode_info *opcode; + char prev_buffer[100]; + int idx = 0; + + opcode_hash_control = hash_new (); + prev_buffer[0] = 0; + + /* Insert unique names into hash table */ + for (opcode = h8500_table; opcode->name; opcode++) + { + if (idx != opcode->idx) + { + hash_insert (opcode_hash_control, opcode->name, (char *) opcode); + idx++; + } + } +} + +static int rn; /* register number used by RN */ +static int rs; /* register number used by RS */ +static int rd; /* register number used by RD */ +static int crb; /* byte size cr */ +static int crw; /* word sized cr */ +static int cr; /* unknown size cr */ + +static expressionS displacement;/* displacement expression */ + +static int immediate_inpage; +static expressionS immediate; /* immediate expression */ + +static expressionS absolute; /* absolute expression */ + +typedef struct +{ + int type; + int reg; + expressionS exp; + int page; +} + +h8500_operand_info; + +/* Try to parse a reg name. Return the number of chars consumed. */ + +static int parse_reg PARAMS ((char *, int *, int *)); + +static int +parse_reg (src, mode, reg) + char *src; + int *mode; + int *reg; +{ + char *end; + int len; + + /* Cribbed from get_symbol_end(). */ + if (!is_name_beginner (*src) || *src == '\001') + return 0; + end = src + 1; + while (is_part_of_name (*end) || *end == '\001') + end++; + len = end - src; + + if (len == 2 && src[0] == 'r') + { + if (src[1] >= '0' && src[1] <= '7') + { + *mode = RN; + *reg = (src[1] - '0'); + return len; + } + } + if (len == 2 && src[0] == 's' && src[1] == 'p') + { + *mode = RN; + *reg = 7; + return len; + } + if (len == 3 && src[0] == 'c' && src[1] == 'c' && src[2] == 'r') + { + *mode = CRB; + *reg = 1; + return len; + } + if (len == 2 && src[0] == 's' && src[1] == 'r') + { + *mode = CRW; + *reg = 0; + return len; + } + if (len == 2 && src[0] == 'b' && src[1] == 'r') + { + *mode = CRB; + *reg = 3; + return len; + } + if (len == 2 && src[0] == 'e' && src[1] == 'p') + { + *mode = CRB; + *reg = 4; + return len; + } + if (len == 2 && src[0] == 'd' && src[1] == 'p') + { + *mode = CRB; + *reg = 5; + return len; + } + if (len == 2 && src[0] == 't' && src[1] == 'p') + { + *mode = CRB; + *reg = 7; + return len; + } + if (len == 2 && src[0] == 'f' && src[1] == 'p') + { + *mode = RN; + *reg = 6; + return len; + } + return 0; +} + +static char *parse_exp PARAMS ((char *, expressionS *, int *)); + +static char * +parse_exp (s, op, page) + char *s; + expressionS *op; + int *page; +{ + char *save; + char *new; + + save = input_line_pointer; + + *page = 0; + if (s[0] == '%') + { + if (s[1] == 'p' && s[2] == 'a' && s[3] == 'g' && s[4] == 'e') + { + s += 5; + *page = 'p'; + } + if (s[1] == 'h' && s[2] == 'i' && s[3] == '1' && s[4] == '6') + { + s += 5; + *page = 'h'; + } + else if (s[1] == 'o' && s[2] == 'f' && s[3] == 'f') + { + s += 4; + *page = 'o'; + } + } + + input_line_pointer = s; + + expression (op); + if (op->X_op == O_absent) + as_bad (_("missing operand")); + new = input_line_pointer; + input_line_pointer = save; + return new; +} + +typedef enum + { + exp_signed, exp_unsigned, exp_sandu + } sign_type; + +static char *skip_colonthing + PARAMS ((sign_type, char *, h8500_operand_info *, int, int, int, int)); + +static char * +skip_colonthing (sign, ptr, exp, def, size8, size16, size24) + sign_type sign; + char *ptr; + h8500_operand_info *exp; + int def; + int size8; + int size16; + int size24; +{ + ptr = parse_exp (ptr, &exp->exp, &exp->page); + if (*ptr == ':') + { + ptr++; + if (*ptr == '8') + { + ptr++; + exp->type = size8; + } + else if (ptr[0] == '1' && ptr[1] == '6') + { + ptr += 2; + exp->type = size16; + } + else if (ptr[0] == '2' && ptr[1] == '4') + { + if (!size24) + { + as_bad (_(":24 not valid for this opcode")); + } + ptr += 2; + exp->type = size24; + } + else + { + as_bad (_("expect :8,:16 or :24")); + exp->type = size16; + } + } + else + { + if (exp->page == 'p') + { + exp->type = IMM8; + } + else if (exp->page == 'h') + { + exp->type = IMM16; + } + else + { + /* Let's work out the size from the context */ + int n = exp->exp.X_add_number; + if (size8 + && exp->exp.X_op == O_constant + && ((sign == exp_signed && (n >= -128 && n <= 127)) + || (sign == exp_unsigned && (n >= 0 && (n <= 255))) + || (sign == exp_sandu && (n >= -128 && (n <= 255))))) + { + exp->type = size8; + } + else + { + exp->type = def; + } + } + } + return ptr; +} + +static int parse_reglist PARAMS ((char *, h8500_operand_info *)); + +static int +parse_reglist (src, op) + char *src; + h8500_operand_info *op; +{ + int mode; + int rn; + int mask = 0; + int rm; + int idx = 1; /* skip ( */ + + while (src[idx] && src[idx] != ')') + { + int done = parse_reg (src + idx, &mode, &rn); + + if (done) + { + idx += done; + mask |= 1 << rn; + } + else + { + as_bad (_("syntax error in reg list")); + return 0; + } + if (src[idx] == '-') + { + idx++; + done = parse_reg (src + idx, &mode, &rm); + if (done) + { + idx += done; + while (rn <= rm) + { + mask |= 1 << rn; + rn++; + } + } + else + { + as_bad (_("missing final register in range")); + } + } + if (src[idx] == ',') + idx++; + } + idx++; + op->exp.X_add_symbol = 0; + op->exp.X_op_symbol = 0; + op->exp.X_add_number = mask; + op->exp.X_op = O_constant; + op->exp.X_unsigned = 1; + op->type = IMM8; + return idx; + +} + +/* The many forms of operand: + + Rn Register direct + @Rn Register indirect + @(disp[:size], Rn) Register indirect with displacement + @Rn+ + @-Rn + @aa[:size] absolute + #xx[:size] immediate data + + */ + +static void get_operand PARAMS ((char **, h8500_operand_info *, char)); + +static void +get_operand (ptr, op, ispage) + char **ptr; + h8500_operand_info *op; + char ispage; +{ + char *src = *ptr; + int mode; + unsigned int num; + unsigned int len; + op->page = 0; + if (src[0] == '(' && src[1] == 'r') + { + /* This is a register list */ + *ptr = src + parse_reglist (src, op); + return; + } + + len = parse_reg (src, &op->type, &op->reg); + + if (len) + { + *ptr = src + len; + return; + } + + if (*src == '@') + { + src++; + if (*src == '-') + { + src++; + len = parse_reg (src, &mode, &num); + if (len == 0) + { + /* Oops, not a reg after all, must be ordinary exp */ + src--; + /* must be a symbol */ + *ptr = skip_colonthing (exp_unsigned, src, + op, ABS16, ABS8, ABS16, ABS24); + return; + } + + op->type = RNDEC; + op->reg = num; + *ptr = src + len; + return; + } + if (*src == '(') + { + /* Disp */ + src++; + + src = skip_colonthing (exp_signed, src, + op, RNIND_D16, RNIND_D8, RNIND_D16, 0); + + if (*src != ',') + { + as_bad (_("expected @(exp, Rn)")); + return; + } + src++; + len = parse_reg (src, &mode, &op->reg); + if (len == 0 || mode != RN) + { + as_bad (_("expected @(exp, Rn)")); + return; + } + src += len; + if (*src != ')') + { + as_bad (_("expected @(exp, Rn)")); + return; + } + *ptr = src + 1; + return; + } + len = parse_reg (src, &mode, &num); + + if (len) + { + src += len; + if (*src == '+') + { + src++; + if (mode != RN) + { + as_bad (_("@Rn+ needs word register")); + return; + } + op->type = RNINC; + op->reg = num; + *ptr = src; + return; + } + if (mode != RN) + { + as_bad (_("@Rn needs word register")); + return; + } + op->type = RNIND; + op->reg = num; + *ptr = src; + return; + } + else + { + /* must be a symbol */ + *ptr = + skip_colonthing (exp_unsigned, src, op, + ispage ? ABS24 : ABS16, ABS8, ABS16, ABS24); + return; + } + } + + if (*src == '#') + { + src++; + *ptr = skip_colonthing (exp_sandu, src, op, IMM16, IMM8, IMM16, ABS24); + return; + } + else + { + *ptr = skip_colonthing (exp_signed, src, op, + ispage ? ABS24 : PCREL8, PCREL8, PCREL16, ABS24); + } +} + +static char *get_operands + PARAMS ((h8500_opcode_info *, char *, h8500_operand_info *)); + +static char * +get_operands (info, args, operand) + h8500_opcode_info *info; + char *args; + h8500_operand_info *operand; +{ + char *ptr = args; + + switch (info->nargs) + { + case 0: + operand[0].type = 0; + operand[1].type = 0; + break; + + case 1: + ptr++; + get_operand (&ptr, operand + 0, info->name[0] == 'p'); + operand[1].type = 0; + break; + + case 2: + ptr++; + get_operand (&ptr, operand + 0, 0); + if (*ptr == ',') + ptr++; + get_operand (&ptr, operand + 1, 0); + break; + + default: + abort (); + } + + return ptr; +} + +/* Passed a pointer to a list of opcodes which use different + addressing modes, return the opcode which matches the opcodes + provided. */ + +int pcrel8; /* Set when we've seen a pcrel operand */ + +static h8500_opcode_info *get_specific + PARAMS ((h8500_opcode_info *, h8500_operand_info *)); + +static h8500_opcode_info * +get_specific (opcode, operands) + h8500_opcode_info *opcode; + h8500_operand_info *operands; +{ + h8500_opcode_info *this_try = opcode; + int found = 0; + unsigned int noperands = opcode->nargs; + int this_index = opcode->idx; + + while (this_index == opcode->idx && !found) + { + unsigned int i; + + this_try = opcode++; + + /* look at both operands needed by the opcodes and provided by + the user*/ + for (i = 0; i < noperands; i++) + { + h8500_operand_info *user = operands + i; + + switch (this_try->arg_type[i]) + { + case FPIND_D8: + /* Opcode needs (disp:8,fp) */ + if (user->type == RNIND_D8 && user->reg == 6) + { + displacement = user->exp; + continue; + } + break; + case RDIND_D16: + if (user->type == RNIND_D16) + { + displacement = user->exp; + rd = user->reg; + continue; + } + break; + case RDIND_D8: + if (user->type == RNIND_D8) + { + displacement = user->exp; + rd = user->reg; + continue; + } + break; + case RNIND_D16: + case RNIND_D8: + if (user->type == this_try->arg_type[i]) + { + displacement = user->exp; + rn = user->reg; + continue; + } + break; + + case SPDEC: + if (user->type == RNDEC && user->reg == 7) + { + continue; + } + break; + case SPINC: + if (user->type == RNINC && user->reg == 7) + { + continue; + } + break; + case ABS16: + if (user->type == ABS16) + { + absolute = user->exp; + continue; + } + break; + case ABS8: + if (user->type == ABS8) + { + absolute = user->exp; + continue; + } + break; + case ABS24: + if (user->type == ABS24) + { + absolute = user->exp; + continue; + } + break; + + case CRB: + if ((user->type == CRB || user->type == CR) && user->reg != 0) + { + crb = user->reg; + continue; + } + break; + case CRW: + if ((user->type == CRW || user->type == CR) && user->reg == 0) + { + crw = user->reg; + continue; + } + break; + case DISP16: + if (user->type == DISP16) + { + displacement = user->exp; + continue; + } + break; + case DISP8: + if (user->type == DISP8) + { + displacement = user->exp; + continue; + } + break; + case FP: + if (user->type == RN && user->reg == 6) + { + continue; + } + break; + case PCREL16: + if (user->type == PCREL16) + { + displacement = user->exp; + continue; + } + break; + case PCREL8: + if (user->type == PCREL8) + { + displacement = user->exp; + pcrel8 = 1; + continue; + } + break; + + case IMM16: + if (user->type == IMM16 + || user->type == IMM8) + { + immediate_inpage = user->page; + immediate = user->exp; + continue; + } + break; + case RLIST: + case IMM8: + if (user->type == IMM8) + { + immediate_inpage = user->page; + immediate = user->exp; + continue; + } + break; + case IMM4: + if (user->type == IMM8) + { + immediate_inpage = user->page; + immediate = user->exp; + continue; + } + break; + case QIM: + if (user->type == IMM8 + && user->exp.X_op == O_constant + && + (user->exp.X_add_number == -2 + || user->exp.X_add_number == -1 + || user->exp.X_add_number == 1 + || user->exp.X_add_number == 2)) + { + immediate_inpage = user->page; + immediate = user->exp; + continue; + } + break; + case RD: + if (user->type == RN) + { + rd = user->reg; + continue; + } + break; + case RS: + if (user->type == RN) + { + rs = user->reg; + continue; + } + break; + case RDIND: + if (user->type == RNIND) + { + rd = user->reg; + continue; + + } + break; + case RNINC: + case RNIND: + case RNDEC: + case RN: + + if (user->type == this_try->arg_type[i]) + { + rn = user->reg; + continue; + } + break; + case SP: + if (user->type == RN && user->reg == 7) + { + continue; + } + break; + default: + printf (_("unhandled %d\n"), this_try->arg_type[i]); + break; + } + + /* If we get here this didn't work out */ + goto fail; + } + found = 1; + fail:; + + } + + if (found) + return this_try; + else + return 0; +} + +static int check PARAMS ((expressionS *, int, int)); + +static int +check (operand, low, high) + expressionS *operand; + int low; + int high; +{ + if (operand->X_op != O_constant + || operand->X_add_number < low + || operand->X_add_number > high) + { + as_bad (_("operand must be absolute in range %d..%d"), low, high); + } + return operand->X_add_number; +} + +static void insert PARAMS ((char *, int, expressionS *, int, int)); + +static void +insert (output, index, exp, reloc, pcrel) + char *output; + int index; + expressionS *exp; + int reloc; + int pcrel; +{ + fix_new_exp (frag_now, + output - frag_now->fr_literal + index, + 4, /* always say size is 4, but we know better */ + exp, + pcrel, + reloc); +} + +static void build_relaxable_instruction + PARAMS ((h8500_opcode_info *, h8500_operand_info *)); + +static void +build_relaxable_instruction (opcode, operand) + h8500_opcode_info *opcode; + h8500_operand_info *operand ATTRIBUTE_UNUSED; +{ + /* All relaxable instructions start life as two bytes but can become + three bytes long if a lonely branch and up to 9 bytes if long + scb. */ + char *p; + int len; + int type; + + if (opcode->bytes[0].contents == 0x01) + { + type = SCB_F; + } + else if (opcode->bytes[0].contents == 0x06 + || opcode->bytes[0].contents == 0x07) + { + type = SCB_TST; + } + else + { + type = BRANCH; + } + + p = frag_var (rs_machine_dependent, + md_relax_table[C (type, WORD_DISP)].rlx_length, + len = md_relax_table[C (type, BYTE_DISP)].rlx_length, + C (type, UNDEF_BYTE_DISP), + displacement.X_add_symbol, + displacement.X_add_number, + 0); + + p[0] = opcode->bytes[0].contents; + if (type != BRANCH) + { + p[1] = opcode->bytes[1].contents | rs; + } +} + +/* Now we know what sort of opcodes it is, let's build the bytes. */ + +static void build_bytes PARAMS ((h8500_opcode_info *, h8500_operand_info *)); + +static void +build_bytes (opcode, operand) + h8500_opcode_info *opcode; + h8500_operand_info *operand; +{ + int index; + + if (pcrel8) + { + pcrel8 = 0; + build_relaxable_instruction (opcode, operand); + } + else + { + char *output = frag_more (opcode->length); + + memset (output, 0, opcode->length); + for (index = 0; index < opcode->length; index++) + { + output[index] = opcode->bytes[index].contents; + + switch (opcode->bytes[index].insert) + { + default: + printf (_("failed for %d\n"), opcode->bytes[index].insert); + break; + case 0: + break; + case RN: + output[index] |= rn; + break; + case RD: + case RDIND: + output[index] |= rd; + break; + case RS: + output[index] |= rs; + break; + case DISP16: + insert (output, index, &displacement, R_H8500_IMM16, 0); + index++; + break; + case DISP8: + case FPIND_D8: + insert (output, index, &displacement, R_H8500_IMM8, 0); + break; + case IMM16: + { + int p; + + switch (immediate_inpage) + { + case 'p': + p = R_H8500_HIGH16; + break; + case 'h': + p = R_H8500_HIGH16; + break; + default: + p = R_H8500_IMM16; + break; + } + insert (output, index, &immediate, p, 0); + } + index++; + break; + case RLIST: + case IMM8: + if (immediate_inpage) + insert (output, index, &immediate, R_H8500_HIGH8, 0); + else + insert (output, index, &immediate, R_H8500_IMM8, 0); + break; + case PCREL16: + insert (output, index, &displacement, R_H8500_PCREL16, 1); + index++; + break; + case PCREL8: + insert (output, index, &displacement, R_H8500_PCREL8, 1); + break; + case IMM4: + output[index] |= check (&immediate, 0, 15); + break; + case CR: + output[index] |= cr; + if (cr == 0) + output[0] |= 0x8; + else + output[0] &= ~0x8; + break; + case CRB: + output[index] |= crb; + output[0] &= ~0x8; + break; + case CRW: + output[index] |= crw; + output[0] |= 0x8; + break; + case ABS24: + insert (output, index, &absolute, R_H8500_IMM24, 0); + index += 2; + break; + case ABS16: + insert (output, index, &absolute, R_H8500_IMM16, 0); + index++; + break; + case ABS8: + insert (output, index, &absolute, R_H8500_IMM8, 0); + break; + case QIM: + switch (immediate.X_add_number) + { + case -2: + output[index] |= 0x5; + break; + case -1: + output[index] |= 0x4; + break; + case 1: + output[index] |= 0; + break; + case 2: + output[index] |= 1; + break; + } + break; + } + } + } +} + +/* This is the guts of the machine-dependent assembler. STR points to + a machine dependent instruction. This function is supposed to emit + the frags/bytes it assembles to. */ + +void +md_assemble (str) + char *str; +{ + char *op_start; + char *op_end; + h8500_operand_info operand[2]; + h8500_opcode_info *opcode; + h8500_opcode_info *prev_opcode; + char name[11]; + + int nlen = 0; + + /* Drop leading whitespace. */ + while (*str == ' ') + str++; + + /* Find the op code end. */ + for (op_start = op_end = str; + !is_end_of_line[(unsigned char) *op_end] && *op_end != ' '; + op_end++) + { + if ( /**op_end != '.' + && *op_end != ':' + && */ nlen < 10) + { + name[nlen++] = *op_end; + } + } + name[nlen] = 0; + + if (op_end == op_start) + as_bad (_("can't find opcode ")); + + opcode = (h8500_opcode_info *) hash_find (opcode_hash_control, name); + + if (opcode == NULL) + { + as_bad (_("unknown opcode")); + return; + } + + get_operands (opcode, op_end, operand); + prev_opcode = opcode; + + opcode = get_specific (opcode, operand); + + if (opcode == 0) + { + /* Couldn't find an opcode which matched the operands */ + char *where = frag_more (2); + + where[0] = 0x0; + where[1] = 0x0; + as_bad (_("invalid operands for opcode")); + return; + } + + build_bytes (opcode, operand); +} + +void +tc_crawl_symbol_chain (headers) + object_headers *headers ATTRIBUTE_UNUSED; +{ + printf (_("call to tc_crawl_symbol_chain \n")); +} + +symbolS * +md_undefined_symbol (name) + char *name ATTRIBUTE_UNUSED; +{ + return 0; +} + +void +tc_headers_hook (headers) + object_headers *headers ATTRIBUTE_UNUSED; +{ + printf (_("call to tc_headers_hook \n")); +} + +/* Various routines to kill one day. */ +/* Equal to MAX_PRECISION in atof-ieee.c. */ +#define MAX_LITTLENUMS 6 + +/* Turn a string in input_line_pointer into a floating point constant + of type type, and store the appropriate bytes in *LITP. The number + of LITTLENUMS emitted is stored in *SIZEP. An error message is + returned, or NULL on OK. */ + +char * +md_atof (type, litP, sizeP) + char type; + char *litP; + int *sizeP; +{ + int prec; + LITTLENUM_TYPE words[MAX_LITTLENUMS]; + LITTLENUM_TYPE *wordP; + char *t; + + switch (type) + { + case 'f': + case 'F': + case 's': + case 'S': + prec = 2; + break; + + case 'd': + case 'D': + case 'r': + case 'R': + prec = 4; + break; + + case 'x': + case 'X': + prec = 6; + break; + + case 'p': + case 'P': + prec = 6; + break; + + default: + *sizeP = 0; + return _("Bad call to MD_ATOF()"); + } + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + + *sizeP = prec * sizeof (LITTLENUM_TYPE); + for (wordP = words; prec--;) + { + md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } + return 0; +} + +const char *md_shortopts = ""; +struct option md_longopts[] = { + {NULL, no_argument, NULL, 0} +}; +size_t md_longopts_size = sizeof (md_longopts); + +int +md_parse_option (c, arg) + int c ATTRIBUTE_UNUSED; + char *arg ATTRIBUTE_UNUSED; +{ + return 0; +} + +void +md_show_usage (stream) + FILE *stream ATTRIBUTE_UNUSED; +{ +} + +static void wordify_scb PARAMS ((char *, int *, int *)); + +static void +wordify_scb (buffer, disp_size, inst_size) + char *buffer; + int *disp_size; + int *inst_size; +{ + int rn = buffer[1] & 0x7; + + switch (buffer[0]) + { + case 0x0e: /* BSR */ + case 0x20: + case 0x21: + case 0x22: + case 0x23: + case 0x24: + case 0x25: + case 0x26: + case 0x27: + case 0x28: + case 0x29: + case 0x2a: + case 0x2b: + case 0x2c: + case 0x2d: + case 0x2e: + case 0x2f: + buffer[0] |= 0x10; + buffer[1] = 0; + buffer[2] = 0; + *disp_size = 2; + *inst_size = 1; + return; + default: + abort (); + + case 0x01: + *inst_size = 6; + *disp_size = 2; + break; + case 0x06: + *inst_size = 8; + *disp_size = 2; + + *buffer++ = 0x26; /* bne + 8 */ + *buffer++ = 0x08; + break; + case 0x07: + *inst_size = 8; + *disp_size = 2; + *buffer++ = 0x27; /* bne + 8 */ + *buffer++ = 0x08; + break; + + } + *buffer++ = 0xa8 | rn; /* addq -1,rn */ + *buffer++ = 0x0c; + *buffer++ = 0x04; /* cmp #0xff:8, rn */ + *buffer++ = 0xff; + *buffer++ = 0x70 | rn; + *buffer++ = 0x36; /* bne ... */ + *buffer++ = 0; + *buffer++ = 0; +} + +/* Called after relaxing, change the frags so they know how big they + are. */ + +void +md_convert_frag (headers, seg, fragP) + object_headers *headers ATTRIBUTE_UNUSED; + segT seg ATTRIBUTE_UNUSED; + fragS *fragP; +{ + int disp_size = 0; + int inst_size = 0; + char *buffer = fragP->fr_fix + fragP->fr_literal; + + switch (fragP->fr_subtype) + { + case C (BRANCH, BYTE_DISP): + disp_size = 1; + inst_size = 1; + break; + + case C (SCB_F, BYTE_DISP): + case C (SCB_TST, BYTE_DISP): + disp_size = 1; + inst_size = 2; + break; + + /* Branches to a known 16 bit displacement. */ + + /* Turn on the 16bit bit. */ + case C (BRANCH, WORD_DISP): + case C (SCB_F, WORD_DISP): + case C (SCB_TST, WORD_DISP): + wordify_scb (buffer, &disp_size, &inst_size); + break; + + case C (BRANCH, UNDEF_WORD_DISP): + case C (SCB_F, UNDEF_WORD_DISP): + case C (SCB_TST, UNDEF_WORD_DISP): + /* This tried to be relaxed, but didn't manage it, it now needs + a fix. */ + wordify_scb (buffer, &disp_size, &inst_size); + + /* Make a reloc */ + fix_new (fragP, + fragP->fr_fix + inst_size, + 4, + fragP->fr_symbol, + fragP->fr_offset, + 0, + R_H8500_PCREL16); + + fragP->fr_fix += disp_size + inst_size; + return; + break; + default: + abort (); + } + if (inst_size) + { + /* Get the address of the end of the instruction */ + int next_inst = fragP->fr_fix + fragP->fr_address + disp_size + inst_size; + int targ_addr = (S_GET_VALUE (fragP->fr_symbol) + + fragP->fr_offset); + int disp = targ_addr - next_inst; + + md_number_to_chars (buffer + inst_size, disp, disp_size); + fragP->fr_fix += disp_size + inst_size; + } +} + +valueT +md_section_align (seg, size) + segT seg ; + valueT size; +{ + return ((size + (1 << section_alignment[(int) seg]) - 1) + & (-1 << section_alignment[(int) seg])); + +} + +void +md_apply_fix3 (fixP, valP, seg) + fixS *fixP; + valueT * valP; + segT seg ATTRIBUTE_UNUSED; +{ + long val = * (long *) valP; + char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; + + if (fixP->fx_r_type == 0) + fixP->fx_r_type = fixP->fx_size == 4 ? R_H8500_IMM32 : R_H8500_IMM16; + + switch (fixP->fx_r_type) + { + case R_H8500_IMM8: + case R_H8500_PCREL8: + *buf++ = val; + break; + case R_H8500_IMM16: + case R_H8500_LOW16: + case R_H8500_PCREL16: + *buf++ = (val >> 8); + *buf++ = val; + break; + case R_H8500_HIGH8: + *buf++ = val >> 16; + break; + case R_H8500_HIGH16: + *buf++ = val >> 24; + *buf++ = val >> 16; + break; + case R_H8500_IMM24: + *buf++ = (val >> 16); + *buf++ = (val >> 8); + *buf++ = val; + break; + case R_H8500_IMM32: + *buf++ = (val >> 24); + *buf++ = (val >> 16); + *buf++ = (val >> 8); + *buf++ = val; + break; + default: + abort (); + } + + if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0) + fixP->fx_done = 1; +} + +/* Called just before address relaxation, return the length + by which a fragment must grow to reach it's destination. */ + +int +md_estimate_size_before_relax (fragP, segment_type) + register fragS *fragP; + register segT segment_type; +{ + int what; + + switch (fragP->fr_subtype) + { + default: + abort (); + + case C (BRANCH, UNDEF_BYTE_DISP): + case C (SCB_F, UNDEF_BYTE_DISP): + case C (SCB_TST, UNDEF_BYTE_DISP): + what = GET_WHAT (fragP->fr_subtype); + /* used to be a branch to somewhere which was unknown */ + if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type) + { + /* Got a symbol and it's defined in this segment, become byte + sized - maybe it will fix up. */ + fragP->fr_subtype = C (what, BYTE_DISP); + } + else + { + /* Its got a segment, but its not ours, so it will always be + long. */ + fragP->fr_subtype = C (what, UNDEF_WORD_DISP); + } + break; + + case C (BRANCH, BYTE_DISP): + case C (BRANCH, WORD_DISP): + case C (BRANCH, UNDEF_WORD_DISP): + case C (SCB_F, BYTE_DISP): + case C (SCB_F, WORD_DISP): + case C (SCB_F, UNDEF_WORD_DISP): + case C (SCB_TST, BYTE_DISP): + case C (SCB_TST, WORD_DISP): + case C (SCB_TST, UNDEF_WORD_DISP): + /* When relaxing a section for the second time, we don't need to + do anything besides return the current size. */ + break; + } + + return md_relax_table[fragP->fr_subtype].rlx_length; +} + +/* Put number into target byte order. */ + +void +md_number_to_chars (ptr, use, nbytes) + char *ptr; + valueT use; + int nbytes; +{ + number_to_chars_bigendian (ptr, use, nbytes); +} + +long +md_pcrel_from (fixP) + fixS *fixP; +{ + return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address; +} + +void +tc_coff_symbol_emit_hook (ignore) + symbolS *ignore ATTRIBUTE_UNUSED; +{ +} + +short +tc_coff_fix2rtype (fix_ptr) + fixS *fix_ptr; +{ + if (fix_ptr->fx_r_type == RELOC_32) + { + /* cons likes to create reloc32's whatever the size of the reloc.. + */ + switch (fix_ptr->fx_size) + { + case 2: + return R_H8500_IMM16; + break; + case 1: + return R_H8500_IMM8; + break; + default: + abort (); + } + } + return fix_ptr->fx_r_type; +} + +void +tc_reloc_mangle (fix_ptr, intr, base) + fixS *fix_ptr; + struct internal_reloc *intr; + bfd_vma base; + +{ + symbolS *symbol_ptr; + + symbol_ptr = fix_ptr->fx_addsy; + + /* If this relocation is attached to a symbol then it's ok + to output it */ + if (fix_ptr->fx_r_type == RELOC_32) + { + /* cons likes to create reloc32's whatever the size of the reloc.. + */ + switch (fix_ptr->fx_size) + { + case 2: + intr->r_type = R_IMM16; + break; + case 1: + intr->r_type = R_IMM8; + break; + default: + abort (); + } + } + else + { + intr->r_type = fix_ptr->fx_r_type; + } + + intr->r_vaddr = fix_ptr->fx_frag->fr_address + fix_ptr->fx_where + base; + intr->r_offset = fix_ptr->fx_offset; + + /* Turn the segment of the symbol into an offset. */ + if (symbol_ptr) + { + symbolS *dot; + + dot = segment_info[S_GET_SEGMENT (symbol_ptr)].dot; + if (dot) + { +#if 0 + intr->r_offset -= + segment_info[S_GET_SEGMENT (symbol_ptr)].scnhdr.s_paddr; +#endif + intr->r_offset += S_GET_VALUE (symbol_ptr); + intr->r_symndx = dot->sy_number; + } + else + { + intr->r_symndx = symbol_ptr->sy_number; + } + + } + else + { + intr->r_symndx = -1; + } + +} + +int +start_label (ptr) + char *ptr; +{ + /* Check for :s.w */ + if (ISALPHA (ptr[1]) && ptr[2] == '.') + return 0; + /* Check for :s */ + if (ISALPHA (ptr[1]) && !ISALPHA (ptr[2])) + return 0; + return 1; +} + +int +tc_coff_sizemachdep (frag) + fragS *frag; +{ + return md_relax_table[frag->fr_subtype].rlx_length; +} diff --git a/gas/config/tc-h8500.h b/gas/config/tc-h8500.h new file mode 100644 index 0000000000000..5902524d4f172 --- /dev/null +++ b/gas/config/tc-h8500.h @@ -0,0 +1,57 @@ +/* This file is tc-h8500.h + Copyright 1993, 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#define TC_H8500 + +#define TARGET_BYTES_BIG_ENDIAN 1 + +#if ANSI_PROTOTYPES +struct internal_reloc; +#endif + +#define WORKING_DOT_WORD + +/* This macro translates between an internal fix and a coff reloc type. */ +#define TC_COFF_FIX2RTYPE(fixP) tc_coff_fix2rtype(fixP) + +#define BFD_ARCH bfd_arch_h8500 +#define COFF_MAGIC 0x8500 +#define TC_COUNT_RELOC(x) ((x)->fx_addsy||(x)->fx_subsy) +#define IGNORE_NONSTANDARD_ESCAPES + +#define TC_RELOC_MANGLE(s,a,b,c) tc_reloc_mangle(a,b,c) +extern void tc_reloc_mangle + PARAMS ((struct fix *, struct internal_reloc *, bfd_vma)); + +#define DO_NOT_STRIP 0 +#define LISTING_HEADER "Renesas H8/500 GAS " +#define NEED_FX_R_TYPE 1 +#define RELOC_32 1234 + +#define TC_START_LABEL(ch, ptr) (ch == ':' && start_label(ptr)) +int start_label PARAMS ((char *)); + +#define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag) +int tc_coff_sizemachdep PARAMS ((struct frag *)); + +#define md_operand(x) + +extern struct relax_type md_relax_table[]; +#define TC_GENERIC_RELAX_TABLE md_relax_table diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c new file mode 100644 index 0000000000000..77563a99bee5e --- /dev/null +++ b/gas/config/tc-hppa.c @@ -0,0 +1,8710 @@ +/* tc-hppa.c -- Assemble for the PA + Copyright 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, + 2002, 2003 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; 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. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* HP PA-RISC support was contributed by the Center for Software Science + at the University of Utah. */ + +#include + +#include "as.h" +#include "safe-ctype.h" +#include "subsegs.h" + +#include "bfd/libhppa.h" + +/* Be careful, this file includes data *declarations*. */ +#include "opcode/hppa.h" + +#if defined (OBJ_ELF) && defined (OBJ_SOM) +error only one of OBJ_ELF and OBJ_SOM can be defined +#endif + +/* If we are using ELF, then we probably can support dwarf2 debug + records. Furthermore, if we are supporting dwarf2 debug records, + then we want to use the assembler support for compact line numbers. */ +#ifdef OBJ_ELF +#include "dwarf2dbg.h" + +/* A "convenient" place to put object file dependencies which do + not need to be seen outside of tc-hppa.c. */ + +/* Object file formats specify relocation types. */ +typedef enum elf_hppa_reloc_type reloc_type; + +/* Object file formats specify BFD symbol types. */ +typedef elf_symbol_type obj_symbol_type; +#define symbol_arg_reloc_info(sym)\ + (((obj_symbol_type *) symbol_get_bfdsym (sym))->tc_data.hppa_arg_reloc) + +#if TARGET_ARCH_SIZE == 64 +/* How to generate a relocation. */ +#define hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type +#define elf_hppa_reloc_final_type elf64_hppa_reloc_final_type +#else +#define hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type +#define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type +#endif + +/* ELF objects can have versions, but apparently do not have anywhere + to store a copyright string. */ +#define obj_version obj_elf_version +#define obj_copyright obj_elf_version + +#define UNWIND_SECTION_NAME ".PARISC.unwind" +#endif /* OBJ_ELF */ + +#ifdef OBJ_SOM +/* Names of various debugging spaces/subspaces. */ +#define GDB_DEBUG_SPACE_NAME "$GDB_DEBUG$" +#define GDB_STRINGS_SUBSPACE_NAME "$GDB_STRINGS$" +#define GDB_SYMBOLS_SUBSPACE_NAME "$GDB_SYMBOLS$" +#define UNWIND_SECTION_NAME "$UNWIND$" + +/* Object file formats specify relocation types. */ +typedef int reloc_type; + +/* SOM objects can have both a version string and a copyright string. */ +#define obj_version obj_som_version +#define obj_copyright obj_som_copyright + +/* How to generate a relocation. */ +#define hppa_gen_reloc_type hppa_som_gen_reloc_type + +/* Object file formats specify BFD symbol types. */ +typedef som_symbol_type obj_symbol_type; +#define symbol_arg_reloc_info(sym)\ + (((obj_symbol_type *) symbol_get_bfdsym (sym))->tc_data.ap.hppa_arg_reloc) + +/* This apparently isn't in older versions of hpux reloc.h. */ +#ifndef R_DLT_REL +#define R_DLT_REL 0x78 +#endif + +#ifndef R_N0SEL +#define R_N0SEL 0xd8 +#endif + +#ifndef R_N1SEL +#define R_N1SEL 0xd9 +#endif +#endif /* OBJ_SOM */ + +#if TARGET_ARCH_SIZE == 64 +#define DEFAULT_LEVEL 25 +#else +#define DEFAULT_LEVEL 10 +#endif + +/* Various structures and types used internally in tc-hppa.c. */ + +/* Unwind table and descriptor. FIXME: Sync this with GDB version. */ + +struct unwind_desc + { + unsigned int cannot_unwind:1; + unsigned int millicode:1; + unsigned int millicode_save_rest:1; + unsigned int region_desc:2; + unsigned int save_sr:2; + unsigned int entry_fr:4; + unsigned int entry_gr:5; + unsigned int args_stored:1; + unsigned int call_fr:5; + unsigned int call_gr:5; + unsigned int save_sp:1; + unsigned int save_rp:1; + unsigned int save_rp_in_frame:1; + unsigned int extn_ptr_defined:1; + unsigned int cleanup_defined:1; + + unsigned int hpe_interrupt_marker:1; + unsigned int hpux_interrupt_marker:1; + unsigned int reserved:3; + unsigned int frame_size:27; + }; + +/* We can't rely on compilers placing bitfields in any particular + place, so use these macros when dumping unwind descriptors to + object files. */ +#define UNWIND_LOW32(U) \ + (((U)->cannot_unwind << 31) \ + | ((U)->millicode << 30) \ + | ((U)->millicode_save_rest << 29) \ + | ((U)->region_desc << 27) \ + | ((U)->save_sr << 25) \ + | ((U)->entry_fr << 21) \ + | ((U)->entry_gr << 16) \ + | ((U)->args_stored << 15) \ + | ((U)->call_fr << 10) \ + | ((U)->call_gr << 5) \ + | ((U)->save_sp << 4) \ + | ((U)->save_rp << 3) \ + | ((U)->save_rp_in_frame << 2) \ + | ((U)->extn_ptr_defined << 1) \ + | ((U)->cleanup_defined << 0)) + +#define UNWIND_HIGH32(U) \ + (((U)->hpe_interrupt_marker << 31) \ + | ((U)->hpux_interrupt_marker << 30) \ + | ((U)->frame_size << 0)) + +struct unwind_table + { + /* Starting and ending offsets of the region described by + descriptor. */ + unsigned int start_offset; + unsigned int end_offset; + struct unwind_desc descriptor; + }; + +/* This structure is used by the .callinfo, .enter, .leave pseudo-ops to + control the entry and exit code they generate. It is also used in + creation of the correct stack unwind descriptors. + + NOTE: GAS does not support .enter and .leave for the generation of + prologues and epilogues. FIXME. + + The fields in structure roughly correspond to the arguments available on the + .callinfo pseudo-op. */ + +struct call_info + { + /* The unwind descriptor being built. */ + struct unwind_table ci_unwind; + + /* Name of this function. */ + symbolS *start_symbol; + + /* (temporary) symbol used to mark the end of this function. */ + symbolS *end_symbol; + + /* Next entry in the chain. */ + struct call_info *ci_next; + }; + +/* Operand formats for FP instructions. Note not all FP instructions + allow all four formats to be used (for example fmpysub only allows + SGL and DBL). */ +typedef enum + { + SGL, DBL, ILLEGAL_FMT, QUAD, W, UW, DW, UDW, QW, UQW + } +fp_operand_format; + +/* This fully describes the symbol types which may be attached to + an EXPORT or IMPORT directive. Only SOM uses this formation + (ELF has no need for it). */ +typedef enum + { + SYMBOL_TYPE_UNKNOWN, + SYMBOL_TYPE_ABSOLUTE, + SYMBOL_TYPE_CODE, + SYMBOL_TYPE_DATA, + SYMBOL_TYPE_ENTRY, + SYMBOL_TYPE_MILLICODE, + SYMBOL_TYPE_PLABEL, + SYMBOL_TYPE_PRI_PROG, + SYMBOL_TYPE_SEC_PROG, + } +pa_symbol_type; + +/* This structure contains information needed to assemble + individual instructions. */ +struct pa_it + { + /* Holds the opcode after parsing by pa_ip. */ + unsigned long opcode; + + /* Holds an expression associated with the current instruction. */ + expressionS exp; + + /* Does this instruction use PC-relative addressing. */ + int pcrel; + + /* Floating point formats for operand1 and operand2. */ + fp_operand_format fpof1; + fp_operand_format fpof2; + + /* Whether or not we saw a truncation request on an fcnv insn. */ + int trunc; + + /* Holds the field selector for this instruction + (for example L%, LR%, etc). */ + long field_selector; + + /* Holds any argument relocation bits associated with this + instruction. (instruction should be some sort of call). */ + unsigned int arg_reloc; + + /* The format specification for this instruction. */ + int format; + + /* The relocation (if any) associated with this instruction. */ + reloc_type reloc; + }; + +/* PA-89 floating point registers are arranged like this: + + +--------------+--------------+ + | 0 or 16L | 16 or 16R | + +--------------+--------------+ + | 1 or 17L | 17 or 17R | + +--------------+--------------+ + | | | + + . . . + . . . + . . . + + | | | + +--------------+--------------+ + | 14 or 30L | 30 or 30R | + +--------------+--------------+ + | 15 or 31L | 31 or 31R | + +--------------+--------------+ */ + +/* Additional information needed to build argument relocation stubs. */ +struct call_desc + { + /* The argument relocation specification. */ + unsigned int arg_reloc; + + /* Number of arguments. */ + unsigned int arg_count; + }; + +#ifdef OBJ_SOM +/* This structure defines an entry in the subspace dictionary + chain. */ + +struct subspace_dictionary_chain + { + /* Nonzero if this space has been defined by the user code. */ + unsigned int ssd_defined; + + /* Name of this subspace. */ + char *ssd_name; + + /* GAS segment and subsegment associated with this subspace. */ + asection *ssd_seg; + int ssd_subseg; + + /* Next space in the subspace dictionary chain. */ + struct subspace_dictionary_chain *ssd_next; + }; + +typedef struct subspace_dictionary_chain ssd_chain_struct; + +/* This structure defines an entry in the subspace dictionary + chain. */ + +struct space_dictionary_chain + { + /* Nonzero if this space has been defined by the user code or + as a default space. */ + unsigned int sd_defined; + + /* Nonzero if this spaces has been defined by the user code. */ + unsigned int sd_user_defined; + + /* The space number (or index). */ + unsigned int sd_spnum; + + /* The name of this subspace. */ + char *sd_name; + + /* GAS segment to which this subspace corresponds. */ + asection *sd_seg; + + /* Current subsegment number being used. */ + int sd_last_subseg; + + /* The chain of subspaces contained within this space. */ + ssd_chain_struct *sd_subspaces; + + /* The next entry in the space dictionary chain. */ + struct space_dictionary_chain *sd_next; + }; + +typedef struct space_dictionary_chain sd_chain_struct; + +/* This structure defines attributes of the default subspace + dictionary entries. */ + +struct default_subspace_dict + { + /* Name of the subspace. */ + char *name; + + /* FIXME. Is this still needed? */ + char defined; + + /* Nonzero if this subspace is loadable. */ + char loadable; + + /* Nonzero if this subspace contains only code. */ + char code_only; + + /* Nonzero if this is a common subspace. */ + char common; + + /* Nonzero if this is a common subspace which allows symbols + to be multiply defined. */ + char dup_common; + + /* Nonzero if this subspace should be zero filled. */ + char zero; + + /* Sort key for this subspace. */ + unsigned char sort; + + /* Access control bits for this subspace. Can represent RWX access + as well as privilege level changes for gateways. */ + int access; + + /* Index of containing space. */ + int space_index; + + /* Alignment (in bytes) of this subspace. */ + int alignment; + + /* Quadrant within space where this subspace should be loaded. */ + int quadrant; + + /* An index into the default spaces array. */ + int def_space_index; + + /* Subsegment associated with this subspace. */ + subsegT subsegment; + }; + +/* This structure defines attributes of the default space + dictionary entries. */ + +struct default_space_dict + { + /* Name of the space. */ + char *name; + + /* Space number. It is possible to identify spaces within + assembly code numerically! */ + int spnum; + + /* Nonzero if this space is loadable. */ + char loadable; + + /* Nonzero if this space is "defined". FIXME is still needed */ + char defined; + + /* Nonzero if this space can not be shared. */ + char private; + + /* Sort key for this space. */ + unsigned char sort; + + /* Segment associated with this space. */ + asection *segment; + }; +#endif + +/* Structure for previous label tracking. Needed so that alignments, + callinfo declarations, etc can be easily attached to a particular + label. */ +typedef struct label_symbol_struct + { + struct symbol *lss_label; +#ifdef OBJ_SOM + sd_chain_struct *lss_space; +#endif +#ifdef OBJ_ELF + segT lss_segment; +#endif + struct label_symbol_struct *lss_next; + } +label_symbol_struct; + +/* Extra information needed to perform fixups (relocations) on the PA. */ +struct hppa_fix_struct + { + /* The field selector. */ + enum hppa_reloc_field_selector_type_alt fx_r_field; + + /* Type of fixup. */ + int fx_r_type; + + /* Format of fixup. */ + int fx_r_format; + + /* Argument relocation bits. */ + unsigned int fx_arg_reloc; + + /* The segment this fixup appears in. */ + segT segment; + }; + +/* Structure to hold information about predefined registers. */ + +struct pd_reg + { + char *name; + int value; + }; + +/* This structure defines the mapping from a FP condition string + to a condition number which can be recorded in an instruction. */ +struct fp_cond_map + { + char *string; + int cond; + }; + +/* This structure defines a mapping from a field selector + string to a field selector type. */ +struct selector_entry + { + char *prefix; + int field_selector; + }; + +/* Prototypes for functions local to tc-hppa.c. */ + +#ifdef OBJ_SOM +static void pa_check_current_space_and_subspace PARAMS ((void)); +#endif + +#if !(defined (OBJ_ELF) && (defined (TE_LINUX) || defined (TE_NetBSD))) +static void pa_text PARAMS ((int)); +static void pa_data PARAMS ((int)); +static void pa_comm PARAMS ((int)); +#endif +static fp_operand_format pa_parse_fp_format PARAMS ((char **s)); +static void pa_cons PARAMS ((int)); +static void pa_float_cons PARAMS ((int)); +static void pa_fill PARAMS ((int)); +static void pa_lcomm PARAMS ((int)); +static void pa_lsym PARAMS ((int)); +static void pa_stringer PARAMS ((int)); +static void pa_version PARAMS ((int)); +static int pa_parse_fp_cmp_cond PARAMS ((char **)); +static int get_expression PARAMS ((char *)); +static int pa_get_absolute_expression PARAMS ((struct pa_it *, char **)); +static int evaluate_absolute PARAMS ((struct pa_it *)); +static unsigned int pa_build_arg_reloc PARAMS ((char *)); +static unsigned int pa_align_arg_reloc PARAMS ((unsigned int, unsigned int)); +static int pa_parse_nullif PARAMS ((char **)); +static int pa_parse_nonneg_cmpsub_cmpltr PARAMS ((char **)); +static int pa_parse_neg_cmpsub_cmpltr PARAMS ((char **)); +static int pa_parse_neg_add_cmpltr PARAMS ((char **)); +static int pa_parse_nonneg_add_cmpltr PARAMS ((char **)); +static int pa_parse_cmpb_64_cmpltr PARAMS ((char **)); +static int pa_parse_cmpib_64_cmpltr PARAMS ((char **)); +static int pa_parse_addb_64_cmpltr PARAMS ((char **)); +static void pa_block PARAMS ((int)); +static void pa_brtab PARAMS ((int)); +static void pa_try PARAMS ((int)); +static void pa_call PARAMS ((int)); +static void pa_call_args PARAMS ((struct call_desc *)); +static void pa_callinfo PARAMS ((int)); +static void pa_copyright PARAMS ((int)); +static void pa_end PARAMS ((int)); +static void pa_enter PARAMS ((int)); +static void pa_entry PARAMS ((int)); +static void pa_equ PARAMS ((int)); +static void pa_exit PARAMS ((int)); +static void pa_export PARAMS ((int)); +static void pa_type_args PARAMS ((symbolS *, int)); +static void pa_import PARAMS ((int)); +static void pa_label PARAMS ((int)); +static void pa_leave PARAMS ((int)); +static void pa_level PARAMS ((int)); +static void pa_origin PARAMS ((int)); +static void pa_proc PARAMS ((int)); +static void pa_procend PARAMS ((int)); +static void pa_param PARAMS ((int)); +static void pa_undefine_label PARAMS ((void)); +static int need_pa11_opcode PARAMS ((void)); +static int pa_parse_number PARAMS ((char **, int)); +static label_symbol_struct *pa_get_label PARAMS ((void)); +#ifdef OBJ_SOM +static int log2 PARAMS ((int)); +static void pa_compiler PARAMS ((int)); +static void pa_align PARAMS ((int)); +static void pa_space PARAMS ((int)); +static void pa_spnum PARAMS ((int)); +static void pa_subspace PARAMS ((int)); +static sd_chain_struct *create_new_space PARAMS ((char *, int, int, + int, int, int, + asection *, int)); +static ssd_chain_struct *create_new_subspace PARAMS ((sd_chain_struct *, + char *, int, int, + int, int, int, + int, int, int, int, + int, asection *)); +static ssd_chain_struct *update_subspace PARAMS ((sd_chain_struct *, + char *, int, int, int, + int, int, int, int, + int, int, int, + asection *)); +static sd_chain_struct *is_defined_space PARAMS ((char *)); +static ssd_chain_struct *is_defined_subspace PARAMS ((char *)); +static sd_chain_struct *pa_segment_to_space PARAMS ((asection *)); +static ssd_chain_struct *pa_subsegment_to_subspace PARAMS ((asection *, + subsegT)); +static sd_chain_struct *pa_find_space_by_number PARAMS ((int)); +static unsigned int pa_subspace_start PARAMS ((sd_chain_struct *, int)); +static sd_chain_struct *pa_parse_space_stmt PARAMS ((char *, int)); +static int pa_next_subseg PARAMS ((sd_chain_struct *)); +static void pa_spaces_begin PARAMS ((void)); +#endif +static void pa_ip PARAMS ((char *)); +static void fix_new_hppa PARAMS ((fragS *, int, int, symbolS *, + offsetT, expressionS *, int, + bfd_reloc_code_real_type, + enum hppa_reloc_field_selector_type_alt, + int, unsigned int, int)); +static int is_end_of_statement PARAMS ((void)); +static int reg_name_search PARAMS ((char *)); +static int pa_chk_field_selector PARAMS ((char **)); +static int is_same_frag PARAMS ((fragS *, fragS *)); +static void process_exit PARAMS ((void)); +static unsigned int pa_stringer_aux PARAMS ((char *)); +static fp_operand_format pa_parse_fp_cnv_format PARAMS ((char **s)); +static int pa_parse_ftest_gfx_completer PARAMS ((char **)); + +#ifdef OBJ_ELF +static void hppa_elf_mark_end_of_function PARAMS ((void)); +static void pa_build_unwind_subspace PARAMS ((struct call_info *)); +static void pa_vtable_entry PARAMS ((int)); +static void pa_vtable_inherit PARAMS ((int)); +#endif + +/* File and globally scoped variable declarations. */ + +#ifdef OBJ_SOM +/* Root and final entry in the space chain. */ +static sd_chain_struct *space_dict_root; +static sd_chain_struct *space_dict_last; + +/* The current space and subspace. */ +static sd_chain_struct *current_space; +static ssd_chain_struct *current_subspace; +#endif + +/* Root of the call_info chain. */ +static struct call_info *call_info_root; + +/* The last call_info (for functions) structure + seen so it can be associated with fixups and + function labels. */ +static struct call_info *last_call_info; + +/* The last call description (for actual calls). */ +static struct call_desc last_call_desc; + +/* handle of the OPCODE hash table */ +static struct hash_control *op_hash = NULL; + +/* These characters can be suffixes of opcode names and they may be + followed by meaningful whitespace. We don't include `,' and `!' + as they never appear followed by meaningful whitespace. */ +const char hppa_symbol_chars[] = "*?=<>"; + +/* Table of pseudo ops for the PA. FIXME -- how many of these + are now redundant with the overall GAS and the object file + dependent tables? */ +const pseudo_typeS md_pseudo_table[] = +{ + /* align pseudo-ops on the PA specify the actual alignment requested, + not the log2 of the requested alignment. */ +#ifdef OBJ_SOM + {"align", pa_align, 8}, +#endif +#ifdef OBJ_ELF + {"align", s_align_bytes, 8}, +#endif + {"begin_brtab", pa_brtab, 1}, + {"begin_try", pa_try, 1}, + {"block", pa_block, 1}, + {"blockz", pa_block, 0}, + {"byte", pa_cons, 1}, + {"call", pa_call, 0}, + {"callinfo", pa_callinfo, 0}, +#if defined (OBJ_ELF) && (defined (TE_LINUX) || defined (TE_NetBSD)) + {"code", obj_elf_text, 0}, +#else + {"code", pa_text, 0}, + {"comm", pa_comm, 0}, +#endif +#ifdef OBJ_SOM + {"compiler", pa_compiler, 0}, +#endif + {"copyright", pa_copyright, 0}, +#if !(defined (OBJ_ELF) && (defined (TE_LINUX) || defined (TE_NetBSD))) + {"data", pa_data, 0}, +#endif + {"double", pa_float_cons, 'd'}, + {"dword", pa_cons, 8}, + {"end", pa_end, 0}, + {"end_brtab", pa_brtab, 0}, +#if !(defined (OBJ_ELF) && (defined (TE_LINUX) || defined (TE_NetBSD))) + {"end_try", pa_try, 0}, +#endif + {"enter", pa_enter, 0}, + {"entry", pa_entry, 0}, + {"equ", pa_equ, 0}, + {"exit", pa_exit, 0}, + {"export", pa_export, 0}, + {"fill", pa_fill, 0}, + {"float", pa_float_cons, 'f'}, + {"half", pa_cons, 2}, + {"import", pa_import, 0}, + {"int", pa_cons, 4}, + {"label", pa_label, 0}, + {"lcomm", pa_lcomm, 0}, + {"leave", pa_leave, 0}, + {"level", pa_level, 0}, + {"long", pa_cons, 4}, + {"lsym", pa_lsym, 0}, +#ifdef OBJ_SOM + {"nsubspa", pa_subspace, 1}, +#endif + {"octa", pa_cons, 16}, + {"org", pa_origin, 0}, + {"origin", pa_origin, 0}, + {"param", pa_param, 0}, + {"proc", pa_proc, 0}, + {"procend", pa_procend, 0}, + {"quad", pa_cons, 8}, + {"reg", pa_equ, 1}, + {"short", pa_cons, 2}, + {"single", pa_float_cons, 'f'}, +#ifdef OBJ_SOM + {"space", pa_space, 0}, + {"spnum", pa_spnum, 0}, +#endif + {"string", pa_stringer, 0}, + {"stringz", pa_stringer, 1}, +#ifdef OBJ_SOM + {"subspa", pa_subspace, 0}, +#endif +#if !(defined (OBJ_ELF) && (defined (TE_LINUX) || defined (TE_NetBSD))) + {"text", pa_text, 0}, +#endif + {"version", pa_version, 0}, +#ifdef OBJ_ELF + {"vtable_entry", pa_vtable_entry, 0}, + {"vtable_inherit", pa_vtable_inherit, 0}, +#endif + {"word", pa_cons, 4}, + {NULL, 0, 0} +}; + +/* This array holds the chars that only start a comment at the beginning of + a line. If the line seems to have the form '# 123 filename' + .line and .file directives will appear in the pre-processed output. + + Note that input_file.c hand checks for '#' at the beginning of the + first line of the input file. This is because the compiler outputs + #NO_APP at the beginning of its output. + + Also note that C style comments will always work. */ +const char line_comment_chars[] = "#"; + +/* This array holds the chars that always start a comment. If the + pre-processor is disabled, these aren't very useful. */ +const char comment_chars[] = ";"; + +/* This array holds the characters which act as line separators. */ +const char line_separator_chars[] = "!"; + +/* Chars that can be used to separate mant from exp in floating point nums. */ +const char EXP_CHARS[] = "eE"; + +/* Chars that mean this number is a floating point constant. + As in 0f12.456 or 0d1.2345e12. + + Be aware that MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT may have to be + changed in read.c. Ideally it shouldn't hae to know abou it at + all, but nothing is ideal around here. */ +const char FLT_CHARS[] = "rRsSfFdDxXpP"; + +static struct pa_it the_insn; + +/* Points to the end of an expression just parsed by get_expression + and friends. FIXME. This shouldn't be handled with a file-global + variable. */ +static char *expr_end; + +/* Nonzero if a .callinfo appeared within the current procedure. */ +static int callinfo_found; + +/* Nonzero if the assembler is currently within a .entry/.exit pair. */ +static int within_entry_exit; + +/* Nonzero if the assembler is currently within a procedure definition. */ +static int within_procedure; + +/* Handle on structure which keep track of the last symbol + seen in each subspace. */ +static label_symbol_struct *label_symbols_rootp = NULL; + +/* Holds the last field selector. */ +static int hppa_field_selector; + +/* Nonzero when strict syntax checking is enabled. Zero otherwise. + + Each opcode in the table has a flag which indicates whether or not + strict syntax checking should be enabled for that instruction. */ +static int strict = 0; + +/* pa_parse_number returns values in `pa_number'. Mostly + pa_parse_number is used to return a register number, with floating + point registers being numbered from FP_REG_BASE upwards. + The bit specified with FP_REG_RSEL is set if the floating point + register has a `r' suffix. */ +#define FP_REG_BASE 64 +#define FP_REG_RSEL 128 +static int pa_number; + +#ifdef OBJ_SOM +/* A dummy bfd symbol so that all relocations have symbols of some kind. */ +static symbolS *dummy_symbol; +#endif + +/* Nonzero if errors are to be printed. */ +static int print_errors = 1; + +/* List of registers that are pre-defined: + + Each general register has one predefined name of the form + %r which has the value . + + Space and control registers are handled in a similar manner, + but use %sr and %cr as their predefined names. + + Likewise for the floating point registers, but of the form + %fr. Floating point registers have additional predefined + names with 'L' and 'R' suffixes (e.g. %fr19L, %fr19R) which + again have the value . + + Many registers also have synonyms: + + %r26 - %r23 have %arg0 - %arg3 as synonyms + %r28 - %r29 have %ret0 - %ret1 as synonyms + %r30 has %sp as a synonym + %r27 has %dp as a synonym + %r2 has %rp as a synonym + + Almost every control register has a synonym; they are not listed + here for brevity. + + The table is sorted. Suitable for searching by a binary search. */ + +static const struct pd_reg pre_defined_registers[] = +{ + {"%arg0", 26}, + {"%arg1", 25}, + {"%arg2", 24}, + {"%arg3", 23}, + {"%cr0", 0}, + {"%cr10", 10}, + {"%cr11", 11}, + {"%cr12", 12}, + {"%cr13", 13}, + {"%cr14", 14}, + {"%cr15", 15}, + {"%cr16", 16}, + {"%cr17", 17}, + {"%cr18", 18}, + {"%cr19", 19}, + {"%cr20", 20}, + {"%cr21", 21}, + {"%cr22", 22}, + {"%cr23", 23}, + {"%cr24", 24}, + {"%cr25", 25}, + {"%cr26", 26}, + {"%cr27", 27}, + {"%cr28", 28}, + {"%cr29", 29}, + {"%cr30", 30}, + {"%cr31", 31}, + {"%cr8", 8}, + {"%cr9", 9}, + {"%dp", 27}, + {"%eiem", 15}, + {"%eirr", 23}, + {"%farg0", 5}, + {"%farg1", 6}, + {"%farg2", 7}, + {"%farg3", 8}, + {"%fr0", 0 + FP_REG_BASE}, + {"%fr0l", 0 + FP_REG_BASE}, + {"%fr0r", 0 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr1", 1 + FP_REG_BASE}, + {"%fr10", 10 + FP_REG_BASE}, + {"%fr10l", 10 + FP_REG_BASE}, + {"%fr10r", 10 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr11", 11 + FP_REG_BASE}, + {"%fr11l", 11 + FP_REG_BASE}, + {"%fr11r", 11 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr12", 12 + FP_REG_BASE}, + {"%fr12l", 12 + FP_REG_BASE}, + {"%fr12r", 12 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr13", 13 + FP_REG_BASE}, + {"%fr13l", 13 + FP_REG_BASE}, + {"%fr13r", 13 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr14", 14 + FP_REG_BASE}, + {"%fr14l", 14 + FP_REG_BASE}, + {"%fr14r", 14 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr15", 15 + FP_REG_BASE}, + {"%fr15l", 15 + FP_REG_BASE}, + {"%fr15r", 15 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr16", 16 + FP_REG_BASE}, + {"%fr16l", 16 + FP_REG_BASE}, + {"%fr16r", 16 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr17", 17 + FP_REG_BASE}, + {"%fr17l", 17 + FP_REG_BASE}, + {"%fr17r", 17 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr18", 18 + FP_REG_BASE}, + {"%fr18l", 18 + FP_REG_BASE}, + {"%fr18r", 18 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr19", 19 + FP_REG_BASE}, + {"%fr19l", 19 + FP_REG_BASE}, + {"%fr19r", 19 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr1l", 1 + FP_REG_BASE}, + {"%fr1r", 1 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr2", 2 + FP_REG_BASE}, + {"%fr20", 20 + FP_REG_BASE}, + {"%fr20l", 20 + FP_REG_BASE}, + {"%fr20r", 20 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr21", 21 + FP_REG_BASE}, + {"%fr21l", 21 + FP_REG_BASE}, + {"%fr21r", 21 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr22", 22 + FP_REG_BASE}, + {"%fr22l", 22 + FP_REG_BASE}, + {"%fr22r", 22 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr23", 23 + FP_REG_BASE}, + {"%fr23l", 23 + FP_REG_BASE}, + {"%fr23r", 23 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr24", 24 + FP_REG_BASE}, + {"%fr24l", 24 + FP_REG_BASE}, + {"%fr24r", 24 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr25", 25 + FP_REG_BASE}, + {"%fr25l", 25 + FP_REG_BASE}, + {"%fr25r", 25 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr26", 26 + FP_REG_BASE}, + {"%fr26l", 26 + FP_REG_BASE}, + {"%fr26r", 26 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr27", 27 + FP_REG_BASE}, + {"%fr27l", 27 + FP_REG_BASE}, + {"%fr27r", 27 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr28", 28 + FP_REG_BASE}, + {"%fr28l", 28 + FP_REG_BASE}, + {"%fr28r", 28 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr29", 29 + FP_REG_BASE}, + {"%fr29l", 29 + FP_REG_BASE}, + {"%fr29r", 29 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr2l", 2 + FP_REG_BASE}, + {"%fr2r", 2 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr3", 3 + FP_REG_BASE}, + {"%fr30", 30 + FP_REG_BASE}, + {"%fr30l", 30 + FP_REG_BASE}, + {"%fr30r", 30 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr31", 31 + FP_REG_BASE}, + {"%fr31l", 31 + FP_REG_BASE}, + {"%fr31r", 31 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr3l", 3 + FP_REG_BASE}, + {"%fr3r", 3 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr4", 4 + FP_REG_BASE}, + {"%fr4l", 4 + FP_REG_BASE}, + {"%fr4r", 4 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr5", 5 + FP_REG_BASE}, + {"%fr5l", 5 + FP_REG_BASE}, + {"%fr5r", 5 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr6", 6 + FP_REG_BASE}, + {"%fr6l", 6 + FP_REG_BASE}, + {"%fr6r", 6 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr7", 7 + FP_REG_BASE}, + {"%fr7l", 7 + FP_REG_BASE}, + {"%fr7r", 7 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr8", 8 + FP_REG_BASE}, + {"%fr8l", 8 + FP_REG_BASE}, + {"%fr8r", 8 + FP_REG_BASE + FP_REG_RSEL}, + {"%fr9", 9 + FP_REG_BASE}, + {"%fr9l", 9 + FP_REG_BASE}, + {"%fr9r", 9 + FP_REG_BASE + FP_REG_RSEL}, + {"%fret", 4}, + {"%hta", 25}, + {"%iir", 19}, + {"%ior", 21}, + {"%ipsw", 22}, + {"%isr", 20}, + {"%itmr", 16}, + {"%iva", 14}, +#if TARGET_ARCH_SIZE == 64 + {"%mrp", 2}, +#else + {"%mrp", 31}, +#endif + {"%pcoq", 18}, + {"%pcsq", 17}, + {"%pidr1", 8}, + {"%pidr2", 9}, + {"%pidr3", 12}, + {"%pidr4", 13}, + {"%ppda", 24}, + {"%r0", 0}, + {"%r1", 1}, + {"%r10", 10}, + {"%r11", 11}, + {"%r12", 12}, + {"%r13", 13}, + {"%r14", 14}, + {"%r15", 15}, + {"%r16", 16}, + {"%r17", 17}, + {"%r18", 18}, + {"%r19", 19}, + {"%r2", 2}, + {"%r20", 20}, + {"%r21", 21}, + {"%r22", 22}, + {"%r23", 23}, + {"%r24", 24}, + {"%r25", 25}, + {"%r26", 26}, + {"%r27", 27}, + {"%r28", 28}, + {"%r29", 29}, + {"%r3", 3}, + {"%r30", 30}, + {"%r31", 31}, + {"%r4", 4}, + {"%r5", 5}, + {"%r6", 6}, + {"%r7", 7}, + {"%r8", 8}, + {"%r9", 9}, + {"%rctr", 0}, + {"%ret0", 28}, + {"%ret1", 29}, + {"%rp", 2}, + {"%sar", 11}, + {"%sp", 30}, + {"%sr0", 0}, + {"%sr1", 1}, + {"%sr2", 2}, + {"%sr3", 3}, + {"%sr4", 4}, + {"%sr5", 5}, + {"%sr6", 6}, + {"%sr7", 7}, + {"%t1", 22}, + {"%t2", 21}, + {"%t3", 20}, + {"%t4", 19}, + {"%tf1", 11}, + {"%tf2", 10}, + {"%tf3", 9}, + {"%tf4", 8}, + {"%tr0", 24}, + {"%tr1", 25}, + {"%tr2", 26}, + {"%tr3", 27}, + {"%tr4", 28}, + {"%tr5", 29}, + {"%tr6", 30}, + {"%tr7", 31} +}; + +/* This table is sorted by order of the length of the string. This is + so we check for <> before we check for <. If we had a <> and checked + for < first, we would get a false match. */ +static const struct fp_cond_map fp_cond_map[] = +{ + {"false?", 0}, + {"false", 1}, + {"true?", 30}, + {"true", 31}, + {"!<=>", 3}, + {"!?>=", 8}, + {"!?<=", 16}, + {"!<>", 7}, + {"!>=", 11}, + {"!?>", 12}, + {"?<=", 14}, + {"!<=", 19}, + {"!?<", 20}, + {"?>=", 22}, + {"!?=", 24}, + {"!=t", 27}, + {"<=>", 29}, + {"=t", 5}, + {"?=", 6}, + {"?<", 10}, + {"<=", 13}, + {"!>", 15}, + {"?>", 18}, + {">=", 21}, + {"!<", 23}, + {"<>", 25}, + {"!=", 26}, + {"!?", 28}, + {"?", 2}, + {"=", 4}, + {"<", 9}, + {">", 17} +}; + +static const struct selector_entry selector_table[] = +{ + {"f", e_fsel}, + {"l", e_lsel}, + {"ld", e_ldsel}, + {"lp", e_lpsel}, + {"lr", e_lrsel}, + {"ls", e_lssel}, + {"lt", e_ltsel}, + {"ltp", e_ltpsel}, + {"n", e_nsel}, + {"nl", e_nlsel}, + {"nlr", e_nlrsel}, + {"p", e_psel}, + {"r", e_rsel}, + {"rd", e_rdsel}, + {"rp", e_rpsel}, + {"rr", e_rrsel}, + {"rs", e_rssel}, + {"rt", e_rtsel}, + {"rtp", e_rtpsel}, + {"t", e_tsel}, +}; + +#ifdef OBJ_SOM +/* default space and subspace dictionaries */ + +#define GDB_SYMBOLS GDB_SYMBOLS_SUBSPACE_NAME +#define GDB_STRINGS GDB_STRINGS_SUBSPACE_NAME + +/* pre-defined subsegments (subspaces) for the HPPA. */ +#define SUBSEG_CODE 0 +#define SUBSEG_LIT 1 +#define SUBSEG_MILLI 2 +#define SUBSEG_DATA 0 +#define SUBSEG_BSS 2 +#define SUBSEG_UNWIND 3 +#define SUBSEG_GDB_STRINGS 0 +#define SUBSEG_GDB_SYMBOLS 1 + +static struct default_subspace_dict pa_def_subspaces[] = +{ + {"$CODE$", 1, 1, 1, 0, 0, 0, 24, 0x2c, 0, 8, 0, 0, SUBSEG_CODE}, + {"$DATA$", 1, 1, 0, 0, 0, 0, 24, 0x1f, 1, 8, 1, 1, SUBSEG_DATA}, + {"$LIT$", 1, 1, 0, 0, 0, 0, 16, 0x2c, 0, 8, 0, 0, SUBSEG_LIT}, + {"$MILLICODE$", 1, 1, 0, 0, 0, 0, 8, 0x2c, 0, 8, 0, 0, SUBSEG_MILLI}, + {"$BSS$", 1, 1, 0, 0, 0, 1, 80, 0x1f, 1, 8, 1, 1, SUBSEG_BSS}, + {NULL, 0, 1, 0, 0, 0, 0, 255, 0x1f, 0, 4, 0, 0, 0} +}; + +static struct default_space_dict pa_def_spaces[] = +{ + {"$TEXT$", 0, 1, 1, 0, 8, ASEC_NULL}, + {"$PRIVATE$", 1, 1, 1, 1, 16, ASEC_NULL}, + {NULL, 0, 0, 0, 0, 0, ASEC_NULL} +}; + +/* Misc local definitions used by the assembler. */ + +/* These macros are used to maintain spaces/subspaces. */ +#define SPACE_DEFINED(space_chain) (space_chain)->sd_defined +#define SPACE_USER_DEFINED(space_chain) (space_chain)->sd_user_defined +#define SPACE_SPNUM(space_chain) (space_chain)->sd_spnum +#define SPACE_NAME(space_chain) (space_chain)->sd_name + +#define SUBSPACE_DEFINED(ss_chain) (ss_chain)->ssd_defined +#define SUBSPACE_NAME(ss_chain) (ss_chain)->ssd_name +#endif + +/* Return nonzero if the string pointed to by S potentially represents + a right or left half of a FP register */ +#define IS_R_SELECT(S) (*(S) == 'R' || *(S) == 'r') +#define IS_L_SELECT(S) (*(S) == 'L' || *(S) == 'l') + +/* Insert FIELD into OPCODE starting at bit START. Continue pa_ip + main loop after insertion. */ + +#define INSERT_FIELD_AND_CONTINUE(OPCODE, FIELD, START) \ + { \ + ((OPCODE) |= (FIELD) << (START)); \ + continue; \ + } + +/* Simple range checking for FIELD against HIGH and LOW bounds. + IGNORE is used to suppress the error message. */ + +#define CHECK_FIELD(FIELD, HIGH, LOW, IGNORE) \ + { \ + if ((FIELD) > (HIGH) || (FIELD) < (LOW)) \ + { \ + if (! IGNORE) \ + as_bad (_("Field out of range [%d..%d] (%d)."), (LOW), (HIGH), \ + (int) (FIELD));\ + break; \ + } \ + } + +/* Variant of CHECK_FIELD for use in md_apply_fix3 and other places where + the current file and line number are not valid. */ + +#define CHECK_FIELD_WHERE(FIELD, HIGH, LOW, FILENAME, LINE) \ + { \ + if ((FIELD) > (HIGH) || (FIELD) < (LOW)) \ + { \ + as_bad_where ((FILENAME), (LINE), \ + _("Field out of range [%d..%d] (%d)."), (LOW), (HIGH), \ + (int) (FIELD));\ + break; \ + } \ + } + +/* Simple alignment checking for FIELD against ALIGN (a power of two). + IGNORE is used to suppress the error message. */ + +#define CHECK_ALIGN(FIELD, ALIGN, IGNORE) \ + { \ + if ((FIELD) & ((ALIGN) - 1)) \ + { \ + if (! IGNORE) \ + as_bad (_("Field not properly aligned [%d] (%d)."), (ALIGN), \ + (int) (FIELD));\ + break; \ + } \ + } + +#define is_DP_relative(exp) \ + ((exp).X_op == O_subtract \ + && strcmp (S_GET_NAME ((exp).X_op_symbol), "$global$") == 0) + +#define is_PC_relative(exp) \ + ((exp).X_op == O_subtract \ + && strcmp (S_GET_NAME ((exp).X_op_symbol), "$PIC_pcrel$0") == 0) + +/* We need some complex handling for stabs (sym1 - sym2). Luckily, we'll + always be able to reduce the expression to a constant, so we don't + need real complex handling yet. */ +#define is_complex(exp) \ + ((exp).X_op != O_constant && (exp).X_op != O_symbol) + +/* Actual functions to implement the PA specific code for the assembler. */ + +/* Called before writing the object file. Make sure entry/exit and + proc/procend pairs match. */ + +void +pa_check_eof () +{ + if (within_entry_exit) + as_fatal (_("Missing .exit\n")); + + if (within_procedure) + as_fatal (_("Missing .procend\n")); +} + +/* Returns a pointer to the label_symbol_struct for the current space. + or NULL if no label_symbol_struct exists for the current space. */ + +static label_symbol_struct * +pa_get_label () +{ + label_symbol_struct *label_chain; + + for (label_chain = label_symbols_rootp; + label_chain; + label_chain = label_chain->lss_next) + { +#ifdef OBJ_SOM + if (current_space == label_chain->lss_space && label_chain->lss_label) + return label_chain; +#endif +#ifdef OBJ_ELF + if (now_seg == label_chain->lss_segment && label_chain->lss_label) + return label_chain; +#endif + } + + return NULL; +} + +/* Defines a label for the current space. If one is already defined, + this function will replace it with the new label. */ + +void +pa_define_label (symbol) + symbolS *symbol; +{ + label_symbol_struct *label_chain = pa_get_label (); + + if (label_chain) + label_chain->lss_label = symbol; + else + { + /* Create a new label entry and add it to the head of the chain. */ + label_chain + = (label_symbol_struct *) xmalloc (sizeof (label_symbol_struct)); + label_chain->lss_label = symbol; +#ifdef OBJ_SOM + label_chain->lss_space = current_space; +#endif +#ifdef OBJ_ELF + label_chain->lss_segment = now_seg; +#endif + label_chain->lss_next = NULL; + + if (label_symbols_rootp) + label_chain->lss_next = label_symbols_rootp; + + label_symbols_rootp = label_chain; + } +} + +/* Removes a label definition for the current space. + If there is no label_symbol_struct entry, then no action is taken. */ + +static void +pa_undefine_label () +{ + label_symbol_struct *label_chain; + label_symbol_struct *prev_label_chain = NULL; + + for (label_chain = label_symbols_rootp; + label_chain; + label_chain = label_chain->lss_next) + { + if (1 +#ifdef OBJ_SOM + && current_space == label_chain->lss_space && label_chain->lss_label +#endif +#ifdef OBJ_ELF + && now_seg == label_chain->lss_segment && label_chain->lss_label +#endif + ) + { + /* Remove the label from the chain and free its memory. */ + if (prev_label_chain) + prev_label_chain->lss_next = label_chain->lss_next; + else + label_symbols_rootp = label_chain->lss_next; + + free (label_chain); + break; + } + prev_label_chain = label_chain; + } +} + +/* An HPPA-specific version of fix_new. This is required because the HPPA + code needs to keep track of some extra stuff. Each call to fix_new_hppa + results in the creation of an instance of an hppa_fix_struct. An + hppa_fix_struct stores the extra information along with a pointer to the + original fixS. This is attached to the original fixup via the + tc_fix_data field. */ + +static void +fix_new_hppa (frag, where, size, add_symbol, offset, exp, pcrel, + r_type, r_field, r_format, arg_reloc, unwind_bits) + fragS *frag; + int where; + int size; + symbolS *add_symbol; + offsetT offset; + expressionS *exp; + int pcrel; + bfd_reloc_code_real_type r_type; + enum hppa_reloc_field_selector_type_alt r_field; + int r_format; + unsigned int arg_reloc; + int unwind_bits ATTRIBUTE_UNUSED; +{ + fixS *new_fix; + + struct hppa_fix_struct *hppa_fix = (struct hppa_fix_struct *) + obstack_alloc (¬es, sizeof (struct hppa_fix_struct)); + + if (exp != NULL) + new_fix = fix_new_exp (frag, where, size, exp, pcrel, r_type); + else + new_fix = fix_new (frag, where, size, add_symbol, offset, pcrel, r_type); + new_fix->tc_fix_data = (void *) hppa_fix; + hppa_fix->fx_r_type = r_type; + hppa_fix->fx_r_field = r_field; + hppa_fix->fx_r_format = r_format; + hppa_fix->fx_arg_reloc = arg_reloc; + hppa_fix->segment = now_seg; +#ifdef OBJ_SOM + if (r_type == R_ENTRY || r_type == R_EXIT) + new_fix->fx_offset = unwind_bits; +#endif + + /* foo-$global$ is used to access non-automatic storage. $global$ + is really just a marker and has served its purpose, so eliminate + it now so as not to confuse write.c. Ditto for $PIC_pcrel$0. */ + if (new_fix->fx_subsy + && (strcmp (S_GET_NAME (new_fix->fx_subsy), "$global$") == 0 + || strcmp (S_GET_NAME (new_fix->fx_subsy), "$PIC_pcrel$0") == 0)) + new_fix->fx_subsy = NULL; +} + +/* Parse a .byte, .word, .long expression for the HPPA. Called by + cons via the TC_PARSE_CONS_EXPRESSION macro. */ + +void +parse_cons_expression_hppa (exp) + expressionS *exp; +{ + hppa_field_selector = pa_chk_field_selector (&input_line_pointer); + expression (exp); +} + +/* This fix_new is called by cons via TC_CONS_FIX_NEW. + hppa_field_selector is set by the parse_cons_expression_hppa. */ + +void +cons_fix_new_hppa (frag, where, size, exp) + fragS *frag; + int where; + int size; + expressionS *exp; +{ + unsigned int rel_type; + + /* Get a base relocation type. */ + if (is_DP_relative (*exp)) + rel_type = R_HPPA_GOTOFF; + else if (is_PC_relative (*exp)) + rel_type = R_HPPA_PCREL_CALL; + else if (is_complex (*exp)) + rel_type = R_HPPA_COMPLEX; + else + rel_type = R_HPPA; + + if (hppa_field_selector != e_psel && hppa_field_selector != e_fsel) + { + as_warn (_("Invalid field selector. Assuming F%%.")); + hppa_field_selector = e_fsel; + } + + fix_new_hppa (frag, where, size, + (symbolS *) NULL, (offsetT) 0, exp, 0, rel_type, + hppa_field_selector, size * 8, 0, 0); + + /* Reset field selector to its default state. */ + hppa_field_selector = 0; +} + +/* This function is called once, at assembler startup time. It should + set up all the tables, etc. that the MD part of the assembler will need. */ + +void +md_begin () +{ + const char *retval = NULL; + int lose = 0; + unsigned int i = 0; + + last_call_info = NULL; + call_info_root = NULL; + + /* Set the default machine type. */ + if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, DEFAULT_LEVEL)) + as_warn (_("could not set architecture and machine")); + + /* Folding of text and data segments fails miserably on the PA. + Warn user and disable "-R" option. */ + if (flag_readonly_data_in_text) + { + as_warn (_("-R option not supported on this target.")); + flag_readonly_data_in_text = 0; + } + +#ifdef OBJ_SOM + pa_spaces_begin (); +#endif + + op_hash = hash_new (); + + while (i < NUMOPCODES) + { + const char *name = pa_opcodes[i].name; + retval = hash_insert (op_hash, name, (struct pa_opcode *) &pa_opcodes[i]); + if (retval != NULL && *retval != '\0') + { + as_fatal (_("Internal error: can't hash `%s': %s\n"), name, retval); + lose = 1; + } + do + { + if ((pa_opcodes[i].match & pa_opcodes[i].mask) + != pa_opcodes[i].match) + { + fprintf (stderr, _("internal error: losing opcode: `%s' \"%s\"\n"), + pa_opcodes[i].name, pa_opcodes[i].args); + lose = 1; + } + ++i; + } + while (i < NUMOPCODES && !strcmp (pa_opcodes[i].name, name)); + } + + if (lose) + as_fatal (_("Broken assembler. No assembly attempted.")); + +#ifdef OBJ_SOM + /* SOM will change text_section. To make sure we never put + anything into the old one switch to the new one now. */ + subseg_set (text_section, 0); +#endif + +#ifdef OBJ_SOM + dummy_symbol = symbol_find_or_make ("L$dummy"); + S_SET_SEGMENT (dummy_symbol, text_section); + /* Force the symbol to be converted to a real symbol. */ + (void) symbol_get_bfdsym (dummy_symbol); +#endif +} + +/* Assemble a single instruction storing it into a frag. */ +void +md_assemble (str) + char *str; +{ + char *to; + + /* The had better be something to assemble. */ + assert (str); + + /* If we are within a procedure definition, make sure we've + defined a label for the procedure; handle case where the + label was defined after the .PROC directive. + + Note there's not need to diddle with the segment or fragment + for the label symbol in this case. We have already switched + into the new $CODE$ subspace at this point. */ + if (within_procedure && last_call_info->start_symbol == NULL) + { + label_symbol_struct *label_symbol = pa_get_label (); + + if (label_symbol) + { + if (label_symbol->lss_label) + { + last_call_info->start_symbol = label_symbol->lss_label; + symbol_get_bfdsym (label_symbol->lss_label)->flags + |= BSF_FUNCTION; +#ifdef OBJ_SOM + /* Also handle allocation of a fixup to hold the unwind + information when the label appears after the proc/procend. */ + if (within_entry_exit) + { + char *where; + unsigned int u; + + where = frag_more (0); + u = UNWIND_LOW32 (&last_call_info->ci_unwind.descriptor); + fix_new_hppa (frag_now, where - frag_now->fr_literal, 0, + NULL, (offsetT) 0, NULL, + 0, R_HPPA_ENTRY, e_fsel, 0, 0, u); + } +#endif + } + else + as_bad (_("Missing function name for .PROC (corrupted label chain)")); + } + else + as_bad (_("Missing function name for .PROC")); + } + + /* Assemble the instruction. Results are saved into "the_insn". */ + pa_ip (str); + + /* Get somewhere to put the assembled instruction. */ + to = frag_more (4); + + /* Output the opcode. */ + md_number_to_chars (to, the_insn.opcode, 4); + + /* If necessary output more stuff. */ + if (the_insn.reloc != R_HPPA_NONE) + fix_new_hppa (frag_now, (to - frag_now->fr_literal), 4, NULL, + (offsetT) 0, &the_insn.exp, the_insn.pcrel, + the_insn.reloc, the_insn.field_selector, + the_insn.format, the_insn.arg_reloc, 0); + +#ifdef OBJ_ELF + dwarf2_emit_insn (4); +#endif +} + +/* Do the real work for assembling a single instruction. Store results + into the global "the_insn" variable. */ + +static void +pa_ip (str) + char *str; +{ + char *error_message = ""; + char *s, c, *argstart, *name, *save_s; + const char *args; + int match = FALSE; + int comma = 0; + int cmpltr, nullif, flag, cond, num; + unsigned long opcode; + struct pa_opcode *insn; + +#ifdef OBJ_SOM + /* We must have a valid space and subspace. */ + pa_check_current_space_and_subspace (); +#endif + + /* Convert everything up to the first whitespace character into lower + case. */ + for (s = str; *s != ' ' && *s != '\t' && *s != '\n' && *s != '\0'; s++) + *s = TOLOWER (*s); + + /* Skip to something interesting. */ + for (s = str; + ISUPPER (*s) || ISLOWER (*s) || (*s >= '0' && *s <= '3'); + ++s) + ; + + switch (*s) + { + + case '\0': + break; + + case ',': + comma = 1; + + /*FALLTHROUGH */ + + case ' ': + *s++ = '\0'; + break; + + default: + as_fatal (_("Unknown opcode: `%s'"), str); + } + + /* Look up the opcode in the has table. */ + if ((insn = (struct pa_opcode *) hash_find (op_hash, str)) == NULL) + { + as_bad ("Unknown opcode: `%s'", str); + return; + } + + if (comma) + { + *--s = ','; + } + + /* Mark the location where arguments for the instruction start, then + start processing them. */ + argstart = s; + for (;;) + { + /* Do some initialization. */ + opcode = insn->match; + strict = (insn->flags & FLAG_STRICT); + memset (&the_insn, 0, sizeof (the_insn)); + + the_insn.reloc = R_HPPA_NONE; + + /* If this instruction is specific to a particular architecture, + then set a new architecture. */ + /* But do not automatically promote to pa2.0. The automatic promotion + crud is for compatibility with HP's old assemblers only. */ + if (insn->arch < 20 + && bfd_get_mach (stdoutput) < insn->arch) + { + if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, insn->arch)) + as_warn (_("could not update architecture and machine")); + } + else if (bfd_get_mach (stdoutput) < insn->arch) + { + match = FALSE; + goto failed; + } + + /* Build the opcode, checking as we go to make + sure that the operands match. */ + for (args = insn->args;; ++args) + { + /* Absorb white space in instruction. */ + while (*s == ' ' || *s == '\t') + s++; + + switch (*args) + { + + /* End of arguments. */ + case '\0': + if (*s == '\0') + match = TRUE; + break; + + case '+': + if (*s == '+') + { + ++s; + continue; + } + if (*s == '-') + continue; + break; + + /* These must match exactly. */ + case '(': + case ')': + case ',': + case ' ': + if (*s++ == *args) + continue; + break; + + /* Handle a 5 bit register or control register field at 10. */ + case 'b': + case '^': + if (!pa_parse_number (&s, 0)) + break; + num = pa_number; + CHECK_FIELD (num, 31, 0, 0); + INSERT_FIELD_AND_CONTINUE (opcode, num, 21); + + /* Handle %sar or %cr11. No bits get set, we just verify that it + is there. */ + case '!': + /* Skip whitespace before register. */ + while (*s == ' ' || *s == '\t') + s = s + 1; + + if (!strncasecmp (s, "%sar", 4)) + { + s += 4; + continue; + } + else if (!strncasecmp (s, "%cr11", 5)) + { + s += 5; + continue; + } + break; + + /* Handle a 5 bit register field at 15. */ + case 'x': + if (!pa_parse_number (&s, 0)) + break; + num = pa_number; + CHECK_FIELD (num, 31, 0, 0); + INSERT_FIELD_AND_CONTINUE (opcode, num, 16); + + /* Handle a 5 bit register field at 31. */ + case 't': + if (!pa_parse_number (&s, 0)) + break; + num = pa_number; + CHECK_FIELD (num, 31, 0, 0); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + + /* Handle a 5 bit register field at 10 and 15. */ + case 'a': + if (!pa_parse_number (&s, 0)) + break; + num = pa_number; + CHECK_FIELD (num, 31, 0, 0); + opcode |= num << 16; + INSERT_FIELD_AND_CONTINUE (opcode, num, 21); + + /* Handle a 5 bit field length at 31. */ + case 'T': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 32, 1, 0); + INSERT_FIELD_AND_CONTINUE (opcode, 32 - num, 0); + + /* Handle a 5 bit immediate at 15. */ + case '5': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + /* When in strict mode, we want to just reject this + match instead of giving an out of range error. */ + CHECK_FIELD (num, 15, -16, strict); + num = low_sign_unext (num, 5); + INSERT_FIELD_AND_CONTINUE (opcode, num, 16); + + /* Handle a 5 bit immediate at 31. */ + case 'V': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + /* When in strict mode, we want to just reject this + match instead of giving an out of range error. */ + CHECK_FIELD (num, 15, -16, strict); + num = low_sign_unext (num, 5); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + + /* Handle an unsigned 5 bit immediate at 31. */ + case 'r': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 31, 0, strict); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + + /* Handle an unsigned 5 bit immediate at 15. */ + case 'R': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 31, 0, strict); + INSERT_FIELD_AND_CONTINUE (opcode, num, 16); + + /* Handle an unsigned 10 bit immediate at 15. */ + case 'U': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 1023, 0, strict); + INSERT_FIELD_AND_CONTINUE (opcode, num, 16); + + /* Handle a 2 bit space identifier at 17. */ + case 's': + if (!pa_parse_number (&s, 0)) + break; + num = pa_number; + CHECK_FIELD (num, 3, 0, 1); + INSERT_FIELD_AND_CONTINUE (opcode, num, 14); + + /* Handle a 3 bit space identifier at 18. */ + case 'S': + if (!pa_parse_number (&s, 0)) + break; + num = pa_number; + CHECK_FIELD (num, 7, 0, 1); + opcode |= re_assemble_3 (num); + continue; + + /* Handle all completers. */ + case 'c': + switch (*++args) + { + + /* Handle a completer for an indexing load or store. */ + case 'X': + case 'x': + { + int uu = 0; + int m = 0; + int i = 0; + while (*s == ',' && i < 2) + { + s++; + if (strncasecmp (s, "sm", 2) == 0) + { + uu = 1; + m = 1; + s++; + i++; + } + else if (strncasecmp (s, "m", 1) == 0) + m = 1; + else if ((strncasecmp (s, "s ", 2) == 0) + || (strncasecmp (s, "s,", 2) == 0)) + uu = 1; + /* When in strict mode this is a match failure. */ + else if (strict) + { + s--; + break; + } + else + as_bad (_("Invalid Indexed Load Completer.")); + s++; + i++; + } + if (i > 2) + as_bad (_("Invalid Indexed Load Completer Syntax.")); + opcode |= m << 5; + INSERT_FIELD_AND_CONTINUE (opcode, uu, 13); + } + + /* Handle a short load/store completer. */ + case 'M': + case 'm': + case 'q': + case 'J': + case 'e': + { + int a = 0; + int m = 0; + if (*s == ',') + { + int found = 0; + s++; + if (strncasecmp (s, "ma", 2) == 0) + { + a = 0; + m = 1; + found = 1; + } + else if (strncasecmp (s, "mb", 2) == 0) + { + a = 1; + m = 1; + found = 1; + } + + /* When in strict mode, pass through for cache op. */ + if (!found && strict) + s--; + else + { + if (!found) + as_bad (_("Invalid Short Load/Store Completer.")); + s += 2; + } + } + /* If we did not get a ma/mb completer, then we do not + consider this a positive match for 'ce'. */ + else if (*args == 'e') + break; + + /* 'J', 'm', 'M' and 'q' are the same, except for where they + encode the before/after field. */ + if (*args == 'm' || *args == 'M') + { + opcode |= m << 5; + INSERT_FIELD_AND_CONTINUE (opcode, a, 13); + } + else if (*args == 'q') + { + opcode |= m << 3; + INSERT_FIELD_AND_CONTINUE (opcode, a, 2); + } + else if (*args == 'J') + { + /* M bit is explicit in the major opcode. */ + INSERT_FIELD_AND_CONTINUE (opcode, a, 2); + } + else if (*args == 'e') + { + /* Stash the ma/mb flag temporarily in the + instruction. We will use (and remove it) + later when handling 'J', 'K', '<' & '>'. */ + opcode |= a; + continue; + } + } + + /* Handle a stbys completer. */ + case 'A': + case 's': + { + int a = 0; + int m = 0; + int i = 0; + while (*s == ',' && i < 2) + { + s++; + if (strncasecmp (s, "m", 1) == 0) + m = 1; + else if ((strncasecmp (s, "b ", 2) == 0) + || (strncasecmp (s, "b,", 2) == 0)) + a = 0; + else if (strncasecmp (s, "e", 1) == 0) + a = 1; + /* When in strict mode this is a match failure. */ + else if (strict) + { + s--; + break; + } + else + as_bad (_("Invalid Store Bytes Short Completer")); + s++; + i++; + } + if (i > 2) + as_bad (_("Invalid Store Bytes Short Completer")); + opcode |= m << 5; + INSERT_FIELD_AND_CONTINUE (opcode, a, 13); + } + + /* Handle load cache hint completer. */ + case 'c': + cmpltr = 0; + if (!strncmp (s, ",sl", 3)) + { + s += 3; + cmpltr = 2; + } + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 10); + + /* Handle store cache hint completer. */ + case 'C': + cmpltr = 0; + if (!strncmp (s, ",sl", 3)) + { + s += 3; + cmpltr = 2; + } + else if (!strncmp (s, ",bc", 3)) + { + s += 3; + cmpltr = 1; + } + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 10); + + /* Handle load and clear cache hint completer. */ + case 'd': + cmpltr = 0; + if (!strncmp (s, ",co", 3)) + { + s += 3; + cmpltr = 1; + } + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 10); + + /* Handle load ordering completer. */ + case 'o': + if (strncmp (s, ",o", 2) != 0) + break; + s += 2; + continue; + + /* Handle a branch gate completer. */ + case 'g': + if (strncasecmp (s, ",gate", 5) != 0) + break; + s += 5; + continue; + + /* Handle a branch link and push completer. */ + case 'p': + if (strncasecmp (s, ",l,push", 7) != 0) + break; + s += 7; + continue; + + /* Handle a branch link completer. */ + case 'l': + if (strncasecmp (s, ",l", 2) != 0) + break; + s += 2; + continue; + + /* Handle a branch pop completer. */ + case 'P': + if (strncasecmp (s, ",pop", 4) != 0) + break; + s += 4; + continue; + + /* Handle a local processor completer. */ + case 'L': + if (strncasecmp (s, ",l", 2) != 0) + break; + s += 2; + continue; + + /* Handle a PROBE read/write completer. */ + case 'w': + flag = 0; + if (!strncasecmp (s, ",w", 2)) + { + flag = 1; + s += 2; + } + else if (!strncasecmp (s, ",r", 2)) + { + flag = 0; + s += 2; + } + + INSERT_FIELD_AND_CONTINUE (opcode, flag, 6); + + /* Handle MFCTL wide completer. */ + case 'W': + if (strncasecmp (s, ",w", 2) != 0) + break; + s += 2; + continue; + + /* Handle an RFI restore completer. */ + case 'r': + flag = 0; + if (!strncasecmp (s, ",r", 2)) + { + flag = 5; + s += 2; + } + + INSERT_FIELD_AND_CONTINUE (opcode, flag, 5); + + /* Handle a system control completer. */ + case 'Z': + if (*s == ',' && (*(s + 1) == 'm' || *(s + 1) == 'M')) + { + flag = 1; + s += 2; + } + else + flag = 0; + + INSERT_FIELD_AND_CONTINUE (opcode, flag, 5); + + /* Handle intermediate/final completer for DCOR. */ + case 'i': + flag = 0; + if (!strncasecmp (s, ",i", 2)) + { + flag = 1; + s += 2; + } + + INSERT_FIELD_AND_CONTINUE (opcode, flag, 6); + + /* Handle zero/sign extension completer. */ + case 'z': + flag = 1; + if (!strncasecmp (s, ",z", 2)) + { + flag = 0; + s += 2; + } + + INSERT_FIELD_AND_CONTINUE (opcode, flag, 10); + + /* Handle add completer. */ + case 'a': + flag = 1; + if (!strncasecmp (s, ",l", 2)) + { + flag = 2; + s += 2; + } + else if (!strncasecmp (s, ",tsv", 4)) + { + flag = 3; + s += 4; + } + + INSERT_FIELD_AND_CONTINUE (opcode, flag, 10); + + /* Handle 64 bit carry for ADD. */ + case 'Y': + flag = 0; + if (!strncasecmp (s, ",dc,tsv", 7) || + !strncasecmp (s, ",tsv,dc", 7)) + { + flag = 1; + s += 7; + } + else if (!strncasecmp (s, ",dc", 3)) + { + flag = 0; + s += 3; + } + else + break; + + INSERT_FIELD_AND_CONTINUE (opcode, flag, 11); + + /* Handle 32 bit carry for ADD. */ + case 'y': + flag = 0; + if (!strncasecmp (s, ",c,tsv", 6) || + !strncasecmp (s, ",tsv,c", 6)) + { + flag = 1; + s += 6; + } + else if (!strncasecmp (s, ",c", 2)) + { + flag = 0; + s += 2; + } + else + break; + + INSERT_FIELD_AND_CONTINUE (opcode, flag, 11); + + /* Handle trap on signed overflow. */ + case 'v': + flag = 0; + if (!strncasecmp (s, ",tsv", 4)) + { + flag = 1; + s += 4; + } + + INSERT_FIELD_AND_CONTINUE (opcode, flag, 11); + + /* Handle trap on condition and overflow. */ + case 't': + flag = 0; + if (!strncasecmp (s, ",tc,tsv", 7) || + !strncasecmp (s, ",tsv,tc", 7)) + { + flag = 1; + s += 7; + } + else if (!strncasecmp (s, ",tc", 3)) + { + flag = 0; + s += 3; + } + else + break; + + INSERT_FIELD_AND_CONTINUE (opcode, flag, 11); + + /* Handle 64 bit borrow for SUB. */ + case 'B': + flag = 0; + if (!strncasecmp (s, ",db,tsv", 7) || + !strncasecmp (s, ",tsv,db", 7)) + { + flag = 1; + s += 7; + } + else if (!strncasecmp (s, ",db", 3)) + { + flag = 0; + s += 3; + } + else + break; + + INSERT_FIELD_AND_CONTINUE (opcode, flag, 11); + + /* Handle 32 bit borrow for SUB. */ + case 'b': + flag = 0; + if (!strncasecmp (s, ",b,tsv", 6) || + !strncasecmp (s, ",tsv,b", 6)) + { + flag = 1; + s += 6; + } + else if (!strncasecmp (s, ",b", 2)) + { + flag = 0; + s += 2; + } + else + break; + + INSERT_FIELD_AND_CONTINUE (opcode, flag, 11); + + /* Handle trap condition completer for UADDCM. */ + case 'T': + flag = 0; + if (!strncasecmp (s, ",tc", 3)) + { + flag = 1; + s += 3; + } + + INSERT_FIELD_AND_CONTINUE (opcode, flag, 6); + + /* Handle signed/unsigned at 21. */ + case 'S': + { + int sign = 1; + if (strncasecmp (s, ",s", 2) == 0) + { + sign = 1; + s += 2; + } + else if (strncasecmp (s, ",u", 2) == 0) + { + sign = 0; + s += 2; + } + + INSERT_FIELD_AND_CONTINUE (opcode, sign, 10); + } + + /* Handle left/right combination at 17:18. */ + case 'h': + if (*s++ == ',') + { + int lr = 0; + if (*s == 'r') + lr = 2; + else if (*s == 'l') + lr = 0; + else + as_bad (_("Invalid left/right combination completer")); + + s++; + INSERT_FIELD_AND_CONTINUE (opcode, lr, 13); + } + else + as_bad (_("Invalid left/right combination completer")); + break; + + /* Handle saturation at 24:25. */ + case 'H': + { + int sat = 3; + if (strncasecmp (s, ",ss", 3) == 0) + { + sat = 1; + s += 3; + } + else if (strncasecmp (s, ",us", 3) == 0) + { + sat = 0; + s += 3; + } + + INSERT_FIELD_AND_CONTINUE (opcode, sat, 6); + } + + /* Handle permutation completer. */ + case '*': + if (*s++ == ',') + { + int permloc[4]; + int perm = 0; + int i = 0; + permloc[0] = 13; + permloc[1] = 10; + permloc[2] = 8; + permloc[3] = 6; + for (; i < 4; i++) + { + switch (*s++) + { + case '0': + perm = 0; + break; + case '1': + perm = 1; + break; + case '2': + perm = 2; + break; + case '3': + perm = 3; + break; + default: + as_bad (_("Invalid permutation completer")); + } + opcode |= perm << permloc[i]; + } + continue; + } + else + as_bad (_("Invalid permutation completer")); + break; + + default: + abort (); + } + break; + + /* Handle all conditions. */ + case '?': + { + args++; + switch (*args) + { + /* Handle FP compare conditions. */ + case 'f': + cond = pa_parse_fp_cmp_cond (&s); + INSERT_FIELD_AND_CONTINUE (opcode, cond, 0); + + /* Handle an add condition. */ + case 'A': + case 'a': + cmpltr = 0; + flag = 0; + if (*s == ',') + { + s++; + + /* 64 bit conditions. */ + if (*args == 'A') + { + if (*s == '*') + s++; + else + break; + } + else if (*s == '*') + break; + + name = s; + while (*s != ',' && *s != ' ' && *s != '\t') + s += 1; + c = *s; + *s = 0x00; + if (strcmp (name, "=") == 0) + cmpltr = 1; + else if (strcmp (name, "<") == 0) + cmpltr = 2; + else if (strcmp (name, "<=") == 0) + cmpltr = 3; + else if (strcasecmp (name, "nuv") == 0) + cmpltr = 4; + else if (strcasecmp (name, "znv") == 0) + cmpltr = 5; + else if (strcasecmp (name, "sv") == 0) + cmpltr = 6; + else if (strcasecmp (name, "od") == 0) + cmpltr = 7; + else if (strcasecmp (name, "tr") == 0) + { + cmpltr = 0; + flag = 1; + } + else if (strcmp (name, "<>") == 0) + { + cmpltr = 1; + flag = 1; + } + else if (strcmp (name, ">=") == 0) + { + cmpltr = 2; + flag = 1; + } + else if (strcmp (name, ">") == 0) + { + cmpltr = 3; + flag = 1; + } + else if (strcasecmp (name, "uv") == 0) + { + cmpltr = 4; + flag = 1; + } + else if (strcasecmp (name, "vnz") == 0) + { + cmpltr = 5; + flag = 1; + } + else if (strcasecmp (name, "nsv") == 0) + { + cmpltr = 6; + flag = 1; + } + else if (strcasecmp (name, "ev") == 0) + { + cmpltr = 7; + flag = 1; + } + /* ",*" is a valid condition. */ + else if (*args == 'a' || *name) + as_bad (_("Invalid Add Condition: %s"), name); + *s = c; + } + opcode |= cmpltr << 13; + INSERT_FIELD_AND_CONTINUE (opcode, flag, 12); + + /* Handle non-negated add and branch condition. */ + case 'd': + cmpltr = pa_parse_nonneg_add_cmpltr (&s); + if (cmpltr < 0) + { + as_bad (_("Invalid Add and Branch Condition")); + cmpltr = 0; + } + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13); + + /* Handle 64 bit wide-mode add and branch condition. */ + case 'W': + cmpltr = pa_parse_addb_64_cmpltr (&s); + if (cmpltr < 0) + { + as_bad (_("Invalid Add and Branch Condition")); + cmpltr = 0; + } + else + { + /* Negated condition requires an opcode change. */ + opcode |= (cmpltr & 8) << 24; + } + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr & 7, 13); + + /* Handle a negated or non-negated add and branch + condition. */ + case '@': + save_s = s; + cmpltr = pa_parse_nonneg_add_cmpltr (&s); + if (cmpltr < 0) + { + s = save_s; + cmpltr = pa_parse_neg_add_cmpltr (&s); + if (cmpltr < 0) + { + as_bad (_("Invalid Compare/Subtract Condition")); + cmpltr = 0; + } + else + { + /* Negated condition requires an opcode change. */ + opcode |= 1 << 27; + } + } + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13); + + /* Handle branch on bit conditions. */ + case 'B': + case 'b': + cmpltr = 0; + if (*s == ',') + { + s++; + + if (*args == 'B') + { + if (*s == '*') + s++; + else + break; + } + else if (*s == '*') + break; + + if (strncmp (s, "<", 1) == 0) + { + cmpltr = 0; + s++; + } + else if (strncmp (s, ">=", 2) == 0) + { + cmpltr = 1; + s += 2; + } + else + as_bad (_("Invalid Bit Branch Condition: %c"), *s); + } + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 15); + + /* Handle a compare/subtract condition. */ + case 'S': + case 's': + cmpltr = 0; + flag = 0; + if (*s == ',') + { + s++; + + /* 64 bit conditions. */ + if (*args == 'S') + { + if (*s == '*') + s++; + else + break; + } + else if (*s == '*') + break; + + name = s; + while (*s != ',' && *s != ' ' && *s != '\t') + s += 1; + c = *s; + *s = 0x00; + if (strcmp (name, "=") == 0) + cmpltr = 1; + else if (strcmp (name, "<") == 0) + cmpltr = 2; + else if (strcmp (name, "<=") == 0) + cmpltr = 3; + else if (strcasecmp (name, "<<") == 0) + cmpltr = 4; + else if (strcasecmp (name, "<<=") == 0) + cmpltr = 5; + else if (strcasecmp (name, "sv") == 0) + cmpltr = 6; + else if (strcasecmp (name, "od") == 0) + cmpltr = 7; + else if (strcasecmp (name, "tr") == 0) + { + cmpltr = 0; + flag = 1; + } + else if (strcmp (name, "<>") == 0) + { + cmpltr = 1; + flag = 1; + } + else if (strcmp (name, ">=") == 0) + { + cmpltr = 2; + flag = 1; + } + else if (strcmp (name, ">") == 0) + { + cmpltr = 3; + flag = 1; + } + else if (strcasecmp (name, ">>=") == 0) + { + cmpltr = 4; + flag = 1; + } + else if (strcasecmp (name, ">>") == 0) + { + cmpltr = 5; + flag = 1; + } + else if (strcasecmp (name, "nsv") == 0) + { + cmpltr = 6; + flag = 1; + } + else if (strcasecmp (name, "ev") == 0) + { + cmpltr = 7; + flag = 1; + } + /* ",*" is a valid condition. */ + else if (*args != 'S' || *name) + as_bad (_("Invalid Compare/Subtract Condition: %s"), + name); + *s = c; + } + opcode |= cmpltr << 13; + INSERT_FIELD_AND_CONTINUE (opcode, flag, 12); + + /* Handle a non-negated compare condition. */ + case 't': + cmpltr = pa_parse_nonneg_cmpsub_cmpltr (&s); + if (cmpltr < 0) + { + as_bad (_("Invalid Compare/Subtract Condition")); + cmpltr = 0; + } + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13); + + /* Handle a 32 bit compare and branch condition. */ + case 'n': + save_s = s; + cmpltr = pa_parse_nonneg_cmpsub_cmpltr (&s); + if (cmpltr < 0) + { + s = save_s; + cmpltr = pa_parse_neg_cmpsub_cmpltr (&s); + if (cmpltr < 0) + { + as_bad (_("Invalid Compare and Branch Condition")); + cmpltr = 0; + } + else + { + /* Negated condition requires an opcode change. */ + opcode |= 1 << 27; + } + } + + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13); + + /* Handle a 64 bit compare and branch condition. */ + case 'N': + cmpltr = pa_parse_cmpb_64_cmpltr (&s); + if (cmpltr >= 0) + { + /* Negated condition requires an opcode change. */ + opcode |= (cmpltr & 8) << 26; + } + else + /* Not a 64 bit cond. Give 32 bit a chance. */ + break; + + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr & 7, 13); + + /* Handle a 64 bit cmpib condition. */ + case 'Q': + cmpltr = pa_parse_cmpib_64_cmpltr (&s); + if (cmpltr < 0) + /* Not a 64 bit cond. Give 32 bit a chance. */ + break; + + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13); + + /* Handle a logical instruction condition. */ + case 'L': + case 'l': + cmpltr = 0; + flag = 0; + if (*s == ',') + { + s++; + + /* 64 bit conditions. */ + if (*args == 'L') + { + if (*s == '*') + s++; + else + break; + } + else if (*s == '*') + break; + + name = s; + while (*s != ',' && *s != ' ' && *s != '\t') + s += 1; + c = *s; + *s = 0x00; + + if (strcmp (name, "=") == 0) + cmpltr = 1; + else if (strcmp (name, "<") == 0) + cmpltr = 2; + else if (strcmp (name, "<=") == 0) + cmpltr = 3; + else if (strcasecmp (name, "od") == 0) + cmpltr = 7; + else if (strcasecmp (name, "tr") == 0) + { + cmpltr = 0; + flag = 1; + } + else if (strcmp (name, "<>") == 0) + { + cmpltr = 1; + flag = 1; + } + else if (strcmp (name, ">=") == 0) + { + cmpltr = 2; + flag = 1; + } + else if (strcmp (name, ">") == 0) + { + cmpltr = 3; + flag = 1; + } + else if (strcasecmp (name, "ev") == 0) + { + cmpltr = 7; + flag = 1; + } + /* ",*" is a valid condition. */ + else if (*args != 'L' || *name) + as_bad (_("Invalid Logical Instruction Condition.")); + *s = c; + } + opcode |= cmpltr << 13; + INSERT_FIELD_AND_CONTINUE (opcode, flag, 12); + + /* Handle a shift/extract/deposit condition. */ + case 'X': + case 'x': + case 'y': + cmpltr = 0; + if (*s == ',') + { + save_s = s++; + + /* 64 bit conditions. */ + if (*args == 'X') + { + if (*s == '*') + s++; + else + break; + } + else if (*s == '*') + break; + + name = s; + while (*s != ',' && *s != ' ' && *s != '\t') + s += 1; + c = *s; + *s = 0x00; + if (strcmp (name, "=") == 0) + cmpltr = 1; + else if (strcmp (name, "<") == 0) + cmpltr = 2; + else if (strcasecmp (name, "od") == 0) + cmpltr = 3; + else if (strcasecmp (name, "tr") == 0) + cmpltr = 4; + else if (strcmp (name, "<>") == 0) + cmpltr = 5; + else if (strcmp (name, ">=") == 0) + cmpltr = 6; + else if (strcasecmp (name, "ev") == 0) + cmpltr = 7; + /* Handle movb,n. Put things back the way they were. + This includes moving s back to where it started. */ + else if (strcasecmp (name, "n") == 0 && *args == 'y') + { + *s = c; + s = save_s; + continue; + } + /* ",*" is a valid condition. */ + else if (*args != 'X' || *name) + as_bad (_("Invalid Shift/Extract/Deposit Condition.")); + *s = c; + } + INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13); + + /* Handle a unit instruction condition. */ + case 'U': + case 'u': + cmpltr = 0; + flag = 0; + if (*s == ',') + { + s++; + + /* 64 bit conditions. */ + if (*args == 'U') + { + if (*s == '*') + s++; + else + break; + } + else if (*s == '*') + break; + + if (strncasecmp (s, "sbz", 3) == 0) + { + cmpltr = 2; + s += 3; + } + else if (strncasecmp (s, "shz", 3) == 0) + { + cmpltr = 3; + s += 3; + } + else if (strncasecmp (s, "sdc", 3) == 0) + { + cmpltr = 4; + s += 3; + } + else if (strncasecmp (s, "sbc", 3) == 0) + { + cmpltr = 6; + s += 3; + } + else if (strncasecmp (s, "shc", 3) == 0) + { + cmpltr = 7; + s += 3; + } + else if (strncasecmp (s, "tr", 2) == 0) + { + cmpltr = 0; + flag = 1; + s += 2; + } + else if (strncasecmp (s, "nbz", 3) == 0) + { + cmpltr = 2; + flag = 1; + s += 3; + } + else if (strncasecmp (s, "nhz", 3) == 0) + { + cmpltr = 3; + flag = 1; + s += 3; + } + else if (strncasecmp (s, "ndc", 3) == 0) + { + cmpltr = 4; + flag = 1; + s += 3; + } + else if (strncasecmp (s, "nbc", 3) == 0) + { + cmpltr = 6; + flag = 1; + s += 3; + } + else if (strncasecmp (s, "nhc", 3) == 0) + { + cmpltr = 7; + flag = 1; + s += 3; + } + else if (strncasecmp (s, "swz", 3) == 0) + { + cmpltr = 1; + flag = 0; + s += 3; + } + else if (strncasecmp (s, "swc", 3) == 0) + { + cmpltr = 5; + flag = 0; + s += 3; + } + else if (strncasecmp (s, "nwz", 3) == 0) + { + cmpltr = 1; + flag = 1; + s += 3; + } + else if (strncasecmp (s, "nwc", 3) == 0) + { + cmpltr = 5; + flag = 1; + s += 3; + } + /* ",*" is a valid condition. */ + else if (*args != 'U' || (*s != ' ' && *s != '\t')) + as_bad (_("Invalid Unit Instruction Condition.")); + } + opcode |= cmpltr << 13; + INSERT_FIELD_AND_CONTINUE (opcode, flag, 12); + + default: + abort (); + } + break; + } + + /* Handle a nullification completer for branch instructions. */ + case 'n': + nullif = pa_parse_nullif (&s); + INSERT_FIELD_AND_CONTINUE (opcode, nullif, 1); + + /* Handle a nullification completer for copr and spop insns. */ + case 'N': + nullif = pa_parse_nullif (&s); + INSERT_FIELD_AND_CONTINUE (opcode, nullif, 5); + + /* Handle ,%r2 completer for new syntax branches. */ + case 'L': + if (*s == ',' && strncasecmp (s + 1, "%r2", 3) == 0) + s += 4; + else if (*s == ',' && strncasecmp (s + 1, "%rp", 3) == 0) + s += 4; + else + break; + continue; + + /* Handle 3 bit entry into the fp compare array. Valid values + are 0..6 inclusive. */ + case 'h': + get_expression (s); + s = expr_end; + if (the_insn.exp.X_op == O_constant) + { + num = evaluate_absolute (&the_insn); + CHECK_FIELD (num, 6, 0, 0); + num++; + INSERT_FIELD_AND_CONTINUE (opcode, num, 13); + } + else + break; + + /* Handle 3 bit entry into the fp compare array. Valid values + are 0..6 inclusive. */ + case 'm': + get_expression (s); + if (the_insn.exp.X_op == O_constant) + { + s = expr_end; + num = evaluate_absolute (&the_insn); + CHECK_FIELD (num, 6, 0, 0); + num = (num + 1) ^ 1; + INSERT_FIELD_AND_CONTINUE (opcode, num, 13); + } + else + break; + + /* Handle graphics test completers for ftest */ + case '=': + { + num = pa_parse_ftest_gfx_completer (&s); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + } + + /* Handle a 11 bit immediate at 31. */ + case 'i': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + if (the_insn.exp.X_op == O_constant) + { + num = evaluate_absolute (&the_insn); + CHECK_FIELD (num, 1023, -1024, 0); + num = low_sign_unext (num, 11); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + } + else + { + if (is_DP_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_GOTOFF; + else if (is_PC_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_PCREL_CALL; + else + the_insn.reloc = R_HPPA; + the_insn.format = 11; + continue; + } + + /* Handle a 14 bit immediate at 31. */ + case 'J': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + if (the_insn.exp.X_op == O_constant) + { + int mb; + + /* XXX the completer stored away tidbits of information + for us to extract. We need a cleaner way to do this. + Now that we have lots of letters again, it would be + good to rethink this. */ + mb = opcode & 1; + opcode -= mb; + num = evaluate_absolute (&the_insn); + if (mb != (num < 0)) + break; + CHECK_FIELD (num, 8191, -8192, 0); + num = low_sign_unext (num, 14); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + } + break; + + /* Handle a 14 bit immediate at 31. */ + case 'K': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + if (the_insn.exp.X_op == O_constant) + { + int mb; + + mb = opcode & 1; + opcode -= mb; + num = evaluate_absolute (&the_insn); + if (mb == (num < 0)) + break; + if (num % 4) + break; + CHECK_FIELD (num, 8191, -8192, 0); + num = low_sign_unext (num, 14); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + } + break; + + /* Handle a 16 bit immediate at 31. */ + case '<': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + if (the_insn.exp.X_op == O_constant) + { + int mb; + + mb = opcode & 1; + opcode -= mb; + num = evaluate_absolute (&the_insn); + if (mb != (num < 0)) + break; + CHECK_FIELD (num, 32767, -32768, 0); + num = re_assemble_16 (num); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + } + break; + + /* Handle a 16 bit immediate at 31. */ + case '>': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + if (the_insn.exp.X_op == O_constant) + { + int mb; + + mb = opcode & 1; + opcode -= mb; + num = evaluate_absolute (&the_insn); + if (mb == (num < 0)) + break; + if (num % 4) + break; + CHECK_FIELD (num, 32767, -32768, 0); + num = re_assemble_16 (num); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + } + break; + + /* Handle 14 bit immediate, shifted left three times. */ + case '#': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + if (the_insn.exp.X_op == O_constant) + { + num = evaluate_absolute (&the_insn); + if (num & 0x7) + break; + CHECK_FIELD (num, 8191, -8192, 0); + if (num < 0) + opcode |= 1; + num &= 0x1fff; + num >>= 3; + INSERT_FIELD_AND_CONTINUE (opcode, num, 4); + } + else + { + if (is_DP_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_GOTOFF; + else if (is_PC_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_PCREL_CALL; + else + the_insn.reloc = R_HPPA; + the_insn.format = 14; + continue; + } + break; + + /* Handle 14 bit immediate, shifted left twice. */ + case 'd': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + if (the_insn.exp.X_op == O_constant) + { + num = evaluate_absolute (&the_insn); + if (num & 0x3) + break; + CHECK_FIELD (num, 8191, -8192, 0); + if (num < 0) + opcode |= 1; + num &= 0x1fff; + num >>= 2; + INSERT_FIELD_AND_CONTINUE (opcode, num, 3); + } + else + { + if (is_DP_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_GOTOFF; + else if (is_PC_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_PCREL_CALL; + else + the_insn.reloc = R_HPPA; + the_insn.format = 14; + continue; + } + + /* Handle a 14 bit immediate at 31. */ + case 'j': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + if (the_insn.exp.X_op == O_constant) + { + num = evaluate_absolute (&the_insn); + CHECK_FIELD (num, 8191, -8192, 0); + num = low_sign_unext (num, 14); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + } + else + { + if (is_DP_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_GOTOFF; + else if (is_PC_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_PCREL_CALL; + else + the_insn.reloc = R_HPPA; + the_insn.format = 14; + continue; + } + + /* Handle a 21 bit immediate at 31. */ + case 'k': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + if (the_insn.exp.X_op == O_constant) + { + num = evaluate_absolute (&the_insn); + CHECK_FIELD (num >> 11, 1048575, -1048576, 0); + opcode |= re_assemble_21 (num); + continue; + } + else + { + if (is_DP_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_GOTOFF; + else if (is_PC_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_PCREL_CALL; + else + the_insn.reloc = R_HPPA; + the_insn.format = 21; + continue; + } + + /* Handle a 16 bit immediate at 31 (PA 2.0 wide mode only). */ + case 'l': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + if (the_insn.exp.X_op == O_constant) + { + num = evaluate_absolute (&the_insn); + CHECK_FIELD (num, 32767, -32768, 0); + opcode |= re_assemble_16 (num); + continue; + } + else + { + /* ??? Is this valid for wide mode? */ + if (is_DP_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_GOTOFF; + else if (is_PC_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_PCREL_CALL; + else + the_insn.reloc = R_HPPA; + the_insn.format = 14; + continue; + } + + /* Handle a word-aligned 16-bit imm. at 31 (PA2.0 wide). */ + case 'y': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + if (the_insn.exp.X_op == O_constant) + { + num = evaluate_absolute (&the_insn); + CHECK_FIELD (num, 32767, -32768, 0); + CHECK_ALIGN (num, 4, 0); + opcode |= re_assemble_16 (num); + continue; + } + else + { + /* ??? Is this valid for wide mode? */ + if (is_DP_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_GOTOFF; + else if (is_PC_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_PCREL_CALL; + else + the_insn.reloc = R_HPPA; + the_insn.format = 14; + continue; + } + + /* Handle a dword-aligned 16-bit imm. at 31 (PA2.0 wide). */ + case '&': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + if (the_insn.exp.X_op == O_constant) + { + num = evaluate_absolute (&the_insn); + CHECK_FIELD (num, 32767, -32768, 0); + CHECK_ALIGN (num, 8, 0); + opcode |= re_assemble_16 (num); + continue; + } + else + { + /* ??? Is this valid for wide mode? */ + if (is_DP_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_GOTOFF; + else if (is_PC_relative (the_insn.exp)) + the_insn.reloc = R_HPPA_PCREL_CALL; + else + the_insn.reloc = R_HPPA; + the_insn.format = 14; + continue; + } + + /* Handle a 12 bit branch displacement. */ + case 'w': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + the_insn.pcrel = 1; + if (!the_insn.exp.X_add_symbol + || !strcmp (S_GET_NAME (the_insn.exp.X_add_symbol), + FAKE_LABEL_NAME)) + { + num = evaluate_absolute (&the_insn); + if (num % 4) + { + as_bad (_("Branch to unaligned address")); + break; + } + if (the_insn.exp.X_add_symbol) + num -= 8; + CHECK_FIELD (num, 8191, -8192, 0); + opcode |= re_assemble_12 (num >> 2); + continue; + } + else + { + the_insn.reloc = R_HPPA_PCREL_CALL; + the_insn.format = 12; + the_insn.arg_reloc = last_call_desc.arg_reloc; + memset (&last_call_desc, 0, sizeof (struct call_desc)); + s = expr_end; + continue; + } + + /* Handle a 17 bit branch displacement. */ + case 'W': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + the_insn.pcrel = 1; + if (!the_insn.exp.X_add_symbol + || !strcmp (S_GET_NAME (the_insn.exp.X_add_symbol), + FAKE_LABEL_NAME)) + { + num = evaluate_absolute (&the_insn); + if (num % 4) + { + as_bad (_("Branch to unaligned address")); + break; + } + if (the_insn.exp.X_add_symbol) + num -= 8; + CHECK_FIELD (num, 262143, -262144, 0); + opcode |= re_assemble_17 (num >> 2); + continue; + } + else + { + the_insn.reloc = R_HPPA_PCREL_CALL; + the_insn.format = 17; + the_insn.arg_reloc = last_call_desc.arg_reloc; + memset (&last_call_desc, 0, sizeof (struct call_desc)); + continue; + } + + /* Handle a 22 bit branch displacement. */ + case 'X': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + the_insn.pcrel = 1; + if (!the_insn.exp.X_add_symbol + || !strcmp (S_GET_NAME (the_insn.exp.X_add_symbol), + FAKE_LABEL_NAME)) + { + num = evaluate_absolute (&the_insn); + if (num % 4) + { + as_bad (_("Branch to unaligned address")); + break; + } + if (the_insn.exp.X_add_symbol) + num -= 8; + CHECK_FIELD (num, 8388607, -8388608, 0); + opcode |= re_assemble_22 (num >> 2); + } + else + { + the_insn.reloc = R_HPPA_PCREL_CALL; + the_insn.format = 22; + the_insn.arg_reloc = last_call_desc.arg_reloc; + memset (&last_call_desc, 0, sizeof (struct call_desc)); + continue; + } + + /* Handle an absolute 17 bit branch target. */ + case 'z': + the_insn.field_selector = pa_chk_field_selector (&s); + get_expression (s); + s = expr_end; + the_insn.pcrel = 0; + if (!the_insn.exp.X_add_symbol + || !strcmp (S_GET_NAME (the_insn.exp.X_add_symbol), + FAKE_LABEL_NAME)) + { + num = evaluate_absolute (&the_insn); + if (num % 4) + { + as_bad (_("Branch to unaligned address")); + break; + } + if (the_insn.exp.X_add_symbol) + num -= 8; + CHECK_FIELD (num, 262143, -262144, 0); + opcode |= re_assemble_17 (num >> 2); + continue; + } + else + { + the_insn.reloc = R_HPPA_ABS_CALL; + the_insn.format = 17; + the_insn.arg_reloc = last_call_desc.arg_reloc; + memset (&last_call_desc, 0, sizeof (struct call_desc)); + continue; + } + + /* Handle '%r1' implicit operand of addil instruction. */ + case 'Z': + if (*s == ',' && *(s + 1) == '%' && *(s + 3) == '1' + && (*(s + 2) == 'r' || *(s + 2) == 'R')) + { + s += 4; + continue; + } + else + break; + + /* Handle '%sr0,%r31' implicit operand of be,l instruction. */ + case 'Y': + if (strncasecmp (s, "%sr0,%r31", 9) != 0) + break; + s += 9; + continue; + + /* Handle immediate value of 0 for ordered load/store instructions. */ + case '@': + if (*s != '0') + break; + s++; + continue; + + /* Handle a 2 bit shift count at 25. */ + case '.': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 3, 1, strict); + INSERT_FIELD_AND_CONTINUE (opcode, num, 6); + + /* Handle a 4 bit shift count at 25. */ + case '*': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 15, 0, strict); + INSERT_FIELD_AND_CONTINUE (opcode, num, 6); + + /* Handle a 5 bit shift count at 26. */ + case 'p': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 31, 0, strict); + INSERT_FIELD_AND_CONTINUE (opcode, 31 - num, 5); + + /* Handle a 6 bit shift count at 20,22:26. */ + case '~': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 63, 0, strict); + num = 63 - num; + opcode |= (num & 0x20) << 6; + INSERT_FIELD_AND_CONTINUE (opcode, num & 0x1f, 5); + + /* Handle a 6 bit field length at 23,27:31. */ + case '%': + flag = 0; + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 64, 1, strict); + num--; + opcode |= (num & 0x20) << 3; + num = 31 - (num & 0x1f); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + + /* Handle a 6 bit field length at 19,27:31. */ + case '|': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 64, 1, strict); + num--; + opcode |= (num & 0x20) << 7; + num = 31 - (num & 0x1f); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + + /* Handle a 5 bit bit position at 26. */ + case 'P': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 31, 0, strict); + INSERT_FIELD_AND_CONTINUE (opcode, num, 5); + + /* Handle a 6 bit bit position at 20,22:26. */ + case 'q': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 63, 0, strict); + opcode |= (num & 0x20) << 6; + INSERT_FIELD_AND_CONTINUE (opcode, num & 0x1f, 5); + + /* Handle a 5 bit immediate at 10 with 'd' as the complement + of the high bit of the immediate. */ + case 'B': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 63, 0, strict); + if (num & 0x20) + ; + else + opcode |= (1 << 13); + INSERT_FIELD_AND_CONTINUE (opcode, num & 0x1f, 21); + + /* Handle a 5 bit immediate at 10. */ + case 'Q': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 31, 0, strict); + INSERT_FIELD_AND_CONTINUE (opcode, num, 21); + + /* Handle a 9 bit immediate at 28. */ + case '$': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 511, 1, strict); + INSERT_FIELD_AND_CONTINUE (opcode, num, 3); + + /* Handle a 13 bit immediate at 18. */ + case 'A': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 8191, 0, strict); + INSERT_FIELD_AND_CONTINUE (opcode, num, 13); + + /* Handle a 26 bit immediate at 31. */ + case 'D': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 67108863, 0, strict); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + + /* Handle a 3 bit SFU identifier at 25. */ + case 'v': + if (*s++ != ',') + as_bad (_("Invalid SFU identifier")); + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 7, 0, strict); + INSERT_FIELD_AND_CONTINUE (opcode, num, 6); + + /* Handle a 20 bit SOP field for spop0. */ + case 'O': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 1048575, 0, strict); + num = (num & 0x1f) | ((num & 0x000fffe0) << 6); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + + /* Handle a 15bit SOP field for spop1. */ + case 'o': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 32767, 0, strict); + INSERT_FIELD_AND_CONTINUE (opcode, num, 11); + + /* Handle a 10bit SOP field for spop3. */ + case '0': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 1023, 0, strict); + num = (num & 0x1f) | ((num & 0x000003e0) << 6); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + + /* Handle a 15 bit SOP field for spop2. */ + case '1': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 32767, 0, strict); + num = (num & 0x1f) | ((num & 0x00007fe0) << 6); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + + /* Handle a 3-bit co-processor ID field. */ + case 'u': + if (*s++ != ',') + as_bad (_("Invalid COPR identifier")); + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 7, 0, strict); + INSERT_FIELD_AND_CONTINUE (opcode, num, 6); + + /* Handle a 22bit SOP field for copr. */ + case '2': + num = pa_get_absolute_expression (&the_insn, &s); + if (strict && the_insn.exp.X_op != O_constant) + break; + s = expr_end; + CHECK_FIELD (num, 4194303, 0, strict); + num = (num & 0x1f) | ((num & 0x003fffe0) << 4); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + + /* Handle a source FP operand format completer. */ + case '{': + if (*s == ',' && *(s+1) == 't') + { + the_insn.trunc = 1; + s += 2; + } + else + the_insn.trunc = 0; + flag = pa_parse_fp_cnv_format (&s); + the_insn.fpof1 = flag; + if (flag == W || flag == UW) + flag = SGL; + if (flag == DW || flag == UDW) + flag = DBL; + if (flag == QW || flag == UQW) + flag = QUAD; + INSERT_FIELD_AND_CONTINUE (opcode, flag, 11); + + /* Handle a destination FP operand format completer. */ + case '_': + /* pa_parse_format needs the ',' prefix. */ + s--; + flag = pa_parse_fp_cnv_format (&s); + the_insn.fpof2 = flag; + if (flag == W || flag == UW) + flag = SGL; + if (flag == DW || flag == UDW) + flag = DBL; + if (flag == QW || flag == UQW) + flag = QUAD; + opcode |= flag << 13; + if (the_insn.fpof1 == SGL + || the_insn.fpof1 == DBL + || the_insn.fpof1 == QUAD) + { + if (the_insn.fpof2 == SGL + || the_insn.fpof2 == DBL + || the_insn.fpof2 == QUAD) + flag = 0; + else if (the_insn.fpof2 == W + || the_insn.fpof2 == DW + || the_insn.fpof2 == QW) + flag = 2; + else if (the_insn.fpof2 == UW + || the_insn.fpof2 == UDW + || the_insn.fpof2 == UQW) + flag = 6; + else + abort (); + } + else if (the_insn.fpof1 == W + || the_insn.fpof1 == DW + || the_insn.fpof1 == QW) + { + if (the_insn.fpof2 == SGL + || the_insn.fpof2 == DBL + || the_insn.fpof2 == QUAD) + flag = 1; + else + abort (); + } + else if (the_insn.fpof1 == UW + || the_insn.fpof1 == UDW + || the_insn.fpof1 == UQW) + { + if (the_insn.fpof2 == SGL + || the_insn.fpof2 == DBL + || the_insn.fpof2 == QUAD) + flag = 5; + else + abort (); + } + flag |= the_insn.trunc; + INSERT_FIELD_AND_CONTINUE (opcode, flag, 15); + + /* Handle a source FP operand format completer. */ + case 'F': + flag = pa_parse_fp_format (&s); + the_insn.fpof1 = flag; + INSERT_FIELD_AND_CONTINUE (opcode, flag, 11); + + /* Handle a destination FP operand format completer. */ + case 'G': + /* pa_parse_format needs the ',' prefix. */ + s--; + flag = pa_parse_fp_format (&s); + the_insn.fpof2 = flag; + INSERT_FIELD_AND_CONTINUE (opcode, flag, 13); + + /* Handle a source FP operand format completer at 20. */ + case 'I': + flag = pa_parse_fp_format (&s); + the_insn.fpof1 = flag; + INSERT_FIELD_AND_CONTINUE (opcode, flag, 11); + + /* Handle a floating point operand format at 26. + Only allows single and double precision. */ + case 'H': + flag = pa_parse_fp_format (&s); + switch (flag) + { + case SGL: + opcode |= 0x20; + case DBL: + the_insn.fpof1 = flag; + continue; + + case QUAD: + case ILLEGAL_FMT: + default: + as_bad (_("Invalid Floating Point Operand Format.")); + } + break; + + /* Handle all floating point registers. */ + case 'f': + switch (*++args) + { + /* Float target register. */ + case 't': + if (!pa_parse_number (&s, 3)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + + /* Float target register with L/R selection. */ + case 'T': + { + if (!pa_parse_number (&s, 1)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + opcode |= num; + + /* 0x30 opcodes are FP arithmetic operation opcodes + and need to be turned into 0x38 opcodes. This + is not necessary for loads/stores. */ + if (need_pa11_opcode () + && ((opcode & 0xfc000000) == 0x30000000)) + opcode |= 1 << 27; + + opcode |= (pa_number & FP_REG_RSEL ? 1 << 6 : 0); + continue; + } + + /* Float operand 1. */ + case 'a': + { + if (!pa_parse_number (&s, 1)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + opcode |= num << 21; + if (need_pa11_opcode ()) + { + opcode |= (pa_number & FP_REG_RSEL ? 1 << 7 : 0); + opcode |= 1 << 27; + } + continue; + } + + /* Float operand 1 with L/R selection. */ + case 'X': + case 'A': + { + if (!pa_parse_number (&s, 1)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + opcode |= num << 21; + opcode |= (pa_number & FP_REG_RSEL ? 1 << 7 : 0); + continue; + } + + /* Float operand 2. */ + case 'b': + { + if (!pa_parse_number (&s, 1)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + opcode |= num << 16; + if (need_pa11_opcode ()) + { + opcode |= (pa_number & FP_REG_RSEL ? 1 << 12 : 0); + opcode |= 1 << 27; + } + continue; + } + + /* Float operand 2 with L/R selection. */ + case 'B': + { + if (!pa_parse_number (&s, 1)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + opcode |= num << 16; + opcode |= (pa_number & FP_REG_RSEL ? 1 << 12 : 0); + continue; + } + + /* Float operand 3 for fmpyfadd, fmpynfadd. */ + case 'C': + { + if (!pa_parse_number (&s, 1)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + opcode |= (num & 0x1c) << 11; + opcode |= (num & 0x03) << 9; + opcode |= (pa_number & FP_REG_RSEL ? 1 << 8 : 0); + continue; + } + + /* Float mult operand 1 for fmpyadd, fmpysub */ + case 'i': + { + if (!pa_parse_number (&s, 1)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + if (the_insn.fpof1 == SGL) + { + if (num < 16) + { + as_bad (_("Invalid register for single precision fmpyadd or fmpysub")); + break; + } + num &= 0xF; + num |= (pa_number & FP_REG_RSEL ? 1 << 4 : 0); + } + INSERT_FIELD_AND_CONTINUE (opcode, num, 21); + } + + /* Float mult operand 2 for fmpyadd, fmpysub */ + case 'j': + { + if (!pa_parse_number (&s, 1)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + if (the_insn.fpof1 == SGL) + { + if (num < 16) + { + as_bad (_("Invalid register for single precision fmpyadd or fmpysub")); + break; + } + num &= 0xF; + num |= (pa_number & FP_REG_RSEL ? 1 << 4 : 0); + } + INSERT_FIELD_AND_CONTINUE (opcode, num, 16); + } + + /* Float mult target for fmpyadd, fmpysub */ + case 'k': + { + if (!pa_parse_number (&s, 1)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + if (the_insn.fpof1 == SGL) + { + if (num < 16) + { + as_bad (_("Invalid register for single precision fmpyadd or fmpysub")); + break; + } + num &= 0xF; + num |= (pa_number & FP_REG_RSEL ? 1 << 4 : 0); + } + INSERT_FIELD_AND_CONTINUE (opcode, num, 0); + } + + /* Float add operand 1 for fmpyadd, fmpysub */ + case 'l': + { + if (!pa_parse_number (&s, 1)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + if (the_insn.fpof1 == SGL) + { + if (num < 16) + { + as_bad (_("Invalid register for single precision fmpyadd or fmpysub")); + break; + } + num &= 0xF; + num |= (pa_number & FP_REG_RSEL ? 1 << 4 : 0); + } + INSERT_FIELD_AND_CONTINUE (opcode, num, 6); + } + + /* Float add target for fmpyadd, fmpysub */ + case 'm': + { + if (!pa_parse_number (&s, 1)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + if (the_insn.fpof1 == SGL) + { + if (num < 16) + { + as_bad (_("Invalid register for single precision fmpyadd or fmpysub")); + break; + } + num &= 0xF; + num |= (pa_number & FP_REG_RSEL ? 1 << 4 : 0); + } + INSERT_FIELD_AND_CONTINUE (opcode, num, 11); + } + + /* Handle L/R register halves like 'x'. */ + case 'E': + case 'e': + { + if (!pa_parse_number (&s, 1)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + opcode |= num << 16; + if (need_pa11_opcode ()) + { + opcode |= (pa_number & FP_REG_RSEL ? 1 << 1 : 0); + } + continue; + } + + /* Float target register (PA 2.0 wide). */ + case 'x': + if (!pa_parse_number (&s, 3)) + break; + num = (pa_number & ~FP_REG_RSEL) - FP_REG_BASE; + CHECK_FIELD (num, 31, 0, 0); + INSERT_FIELD_AND_CONTINUE (opcode, num, 16); + + default: + abort (); + } + break; + + default: + abort (); + } + break; + } + + failed: + /* Check if the args matched. */ + if (!match) + { + if (&insn[1] - pa_opcodes < (int) NUMOPCODES + && !strcmp (insn->name, insn[1].name)) + { + ++insn; + s = argstart; + continue; + } + else + { + as_bad (_("Invalid operands %s"), error_message); + return; + } + } + break; + } + + the_insn.opcode = opcode; +} + +/* Turn a string in input_line_pointer into a floating point constant of type + type, and store the appropriate bytes in *litP. The number of LITTLENUMS + emitted is stored in *sizeP . An error message or NULL is returned. */ + +#define MAX_LITTLENUMS 6 + +char * +md_atof (type, litP, sizeP) + char type; + char *litP; + int *sizeP; +{ + int prec; + LITTLENUM_TYPE words[MAX_LITTLENUMS]; + LITTLENUM_TYPE *wordP; + char *t; + + switch (type) + { + + case 'f': + case 'F': + case 's': + case 'S': + prec = 2; + break; + + case 'd': + case 'D': + case 'r': + case 'R': + prec = 4; + break; + + case 'x': + case 'X': + prec = 6; + break; + + case 'p': + case 'P': + prec = 6; + break; + + default: + *sizeP = 0; + return _("Bad call to MD_ATOF()"); + } + t = atof_ieee (input_line_pointer, type, words); + if (t) + input_line_pointer = t; + *sizeP = prec * sizeof (LITTLENUM_TYPE); + for (wordP = words; prec--;) + { + md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } + return NULL; +} + +/* Write out big-endian. */ + +void +md_number_to_chars (buf, val, n) + char *buf; + valueT val; + int n; +{ + number_to_chars_bigendian (buf, val, n); +} + +/* Translate internal representation of relocation info to BFD target + format. */ + +arelent ** +tc_gen_reloc (section, fixp) + asection *section; + fixS *fixp; +{ + arelent *reloc; + struct hppa_fix_struct *hppa_fixp; + static arelent *no_relocs = NULL; + arelent **relocs; + reloc_type **codes; + reloc_type code; + int n_relocs; + int i; + + hppa_fixp = (struct hppa_fix_struct *) fixp->tc_fix_data; + if (fixp->fx_addsy == 0) + return &no_relocs; + + assert (hppa_fixp != 0); + assert (section != 0); + + reloc = (arelent *) xmalloc (sizeof (arelent)); + + reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); + *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); + codes = hppa_gen_reloc_type (stdoutput, + fixp->fx_r_type, + hppa_fixp->fx_r_format, + hppa_fixp->fx_r_field, + fixp->fx_subsy != NULL, + symbol_get_bfdsym (fixp->fx_addsy)); + + if (codes == NULL) + { + as_bad_where (fixp->fx_file, fixp->fx_line, _("Cannot handle fixup")); + abort (); + } + + for (n_relocs = 0; codes[n_relocs]; n_relocs++) + ; + + relocs = (arelent **) xmalloc (sizeof (arelent *) * n_relocs + 1); + reloc = (arelent *) xmalloc (sizeof (arelent) * n_relocs); + for (i = 0; i < n_relocs; i++) + relocs[i] = &reloc[i]; + + relocs[n_relocs] = NULL; + +#ifdef OBJ_ELF + switch (fixp->fx_r_type) + { + default: + assert (n_relocs == 1); + + code = *codes[0]; + + /* Now, do any processing that is dependent on the relocation type. */ + switch (code) + { + case R_PARISC_DLTREL21L: + case R_PARISC_DLTREL14R: + case R_PARISC_DLTREL14F: + case R_PARISC_PLABEL32: + case R_PARISC_PLABEL21L: + case R_PARISC_PLABEL14R: + /* For plabel relocations, the addend of the + relocation should be either 0 (no static link) or 2 + (static link required). This adjustment is done in + bfd/elf32-hppa.c:elf32_hppa_relocate_section. + + We also slam a zero addend into the DLT relative relocs; + it doesn't make a lot of sense to use any addend since + it gets you a different (eg unknown) DLT entry. */ + reloc->addend = 0; + break; + +#ifdef ELF_ARG_RELOC + case R_PARISC_PCREL17R: + case R_PARISC_PCREL17F: + case R_PARISC_PCREL17C: + case R_PARISC_DIR17R: + case R_PARISC_DIR17F: + case R_PARISC_PCREL21L: + case R_PARISC_DIR21L: + reloc->addend = HPPA_R_ADDEND (hppa_fixp->fx_arg_reloc, + fixp->fx_offset); + break; +#endif + + case R_PARISC_DIR32: + /* Facilitate hand-crafted unwind info. */ + if (strcmp (section->name, UNWIND_SECTION_NAME) == 0) + code = R_PARISC_SEGREL32; + /* Fall thru */ + + default: + reloc->addend = fixp->fx_offset; + break; + } + + reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); + *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); + reloc->howto = bfd_reloc_type_lookup (stdoutput, + (bfd_reloc_code_real_type) code); + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; + + assert (reloc->howto && (unsigned int) code == reloc->howto->type); + break; + } +#else /* OBJ_SOM */ + + /* Walk over reach relocation returned by the BFD backend. */ + for (i = 0; i < n_relocs; i++) + { + code = *codes[i]; + + relocs[i]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); + *relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); + relocs[i]->howto = + bfd_reloc_type_lookup (stdoutput, + (bfd_reloc_code_real_type) code); + relocs[i]->address = fixp->fx_frag->fr_address + fixp->fx_where; + + switch (code) + { + case R_COMP2: + /* The only time we ever use a R_COMP2 fixup is for the difference + of two symbols. With that in mind we fill in all four + relocs now and break out of the loop. */ + assert (i == 1); + relocs[0]->sym_ptr_ptr = (asymbol **) &(bfd_abs_symbol); + relocs[0]->howto = + bfd_reloc_type_lookup (stdoutput, + (bfd_reloc_code_real_type) *codes[0]); + relocs[0]->address = fixp->fx_frag->fr_address + fixp->fx_where; + relocs[0]->addend = 0; + relocs[1]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); + *relocs[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); + relocs[1]->howto = + bfd_reloc_type_lookup (stdoutput, + (bfd_reloc_code_real_type) *codes[1]); + relocs[1]->address = fixp->fx_frag->fr_address + fixp->fx_where; + relocs[1]->addend = 0; + relocs[2]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); + *relocs[2]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy); + relocs[2]->howto = + bfd_reloc_type_lookup (stdoutput, + (bfd_reloc_code_real_type) *codes[2]); + relocs[2]->address = fixp->fx_frag->fr_address + fixp->fx_where; + relocs[2]->addend = 0; + relocs[3]->sym_ptr_ptr = (asymbol **) &(bfd_abs_symbol); + relocs[3]->howto = + bfd_reloc_type_lookup (stdoutput, + (bfd_reloc_code_real_type) *codes[3]); + relocs[3]->address = fixp->fx_frag->fr_address + fixp->fx_where; + relocs[3]->addend = 0; + relocs[4]->sym_ptr_ptr = (asymbol **) &(bfd_abs_symbol); + relocs[4]->howto = + bfd_reloc_type_lookup (stdoutput, + (bfd_reloc_code_real_type) *codes[4]); + relocs[4]->address = fixp->fx_frag->fr_address + fixp->fx_where; + relocs[4]->addend = 0; + goto done; + case R_PCREL_CALL: + case R_ABS_CALL: + relocs[i]->addend = HPPA_R_ADDEND (hppa_fixp->fx_arg_reloc, 0); + break; + + case R_DLT_REL: + case R_DATA_PLABEL: + case R_CODE_PLABEL: + /* For plabel relocations, the addend of the + relocation should be either 0 (no static link) or 2 + (static link required). + + FIXME: We always assume no static link! + + We also slam a zero addend into the DLT relative relocs; + it doesn't make a lot of sense to use any addend since + it gets you a different (eg unknown) DLT entry. */ + relocs[i]->addend = 0; + break; + + case R_N_MODE: + case R_S_MODE: + case R_D_MODE: + case R_R_MODE: + case R_FSEL: + case R_LSEL: + case R_RSEL: + case R_BEGIN_BRTAB: + case R_END_BRTAB: + case R_BEGIN_TRY: + case R_N0SEL: + case R_N1SEL: + /* There is no symbol or addend associated with these fixups. */ + relocs[i]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); + *relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (dummy_symbol); + relocs[i]->addend = 0; + break; + + case R_END_TRY: + case R_ENTRY: + case R_EXIT: + /* There is no symbol associated with these fixups. */ + relocs[i]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *)); + *relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (dummy_symbol); + relocs[i]->addend = fixp->fx_offset; + break; + + default: + relocs[i]->addend = fixp->fx_offset; + } + } + + done: +#endif + + return relocs; +} + +/* Process any machine dependent frag types. */ + +void +md_convert_frag (abfd, sec, fragP) + register bfd *abfd ATTRIBUTE_UNUSED; + register asection *sec ATTRIBUTE_UNUSED; + register fragS *fragP; +{ + unsigned int address; + + if (fragP->fr_type == rs_machine_dependent) + { + switch ((int) fragP->fr_subtype) + { + case 0: + fragP->fr_type = rs_fill; + know (fragP->fr_var == 1); + know (fragP->fr_next); + address = fragP->fr_address + fragP->fr_fix; + if (address % fragP->fr_offset) + { + fragP->fr_offset = + fragP->fr_next->fr_address + - fragP->fr_address + - fragP->fr_fix; + } + else + fragP->fr_offset = 0; + break; + } + } +} + +/* Round up a section size to the appropriate boundary. */ + +valueT +md_section_align (segment, size) + asection *segment; + valueT size; +{ + int align = bfd_get_section_alignment (stdoutput, segment); + int align2 = (1 << align) - 1; + + return (size + align2) & ~align2; +} + +/* Return the approximate size of a frag before relaxation has occurred. */ +int +md_estimate_size_before_relax (fragP, segment) + register fragS *fragP; + asection *segment ATTRIBUTE_UNUSED; +{ + int size; + + size = 0; + + while ((fragP->fr_fix + size) % fragP->fr_offset) + size++; + + return size; +} + +#ifdef OBJ_ELF +# ifdef WARN_COMMENTS +const char *md_shortopts = "Vc"; +# else +const char *md_shortopts = "V"; +# endif +#else +# ifdef WARN_COMMENTS +const char *md_shortopts = "c"; +# else +const char *md_shortopts = ""; +# endif +#endif + +struct option md_longopts[] = { +#ifdef WARN_COMMENTS + {"warn-comment", no_argument, NULL, 'c'}, +#endif + {NULL, no_argument, NULL, 0} +}; +size_t md_longopts_size = sizeof (md_longopts); + +int +md_parse_option (c, arg) + int c ATTRIBUTE_UNUSED; + char *arg ATTRIBUTE_UNUSED; +{ + switch (c) + { + default: + return 0; + +#ifdef OBJ_ELF + case 'V': + print_version_id (); + break; +#endif +#ifdef WARN_COMMENTS + case 'c': + warn_comment = 1; + break; +#endif + } + + return 1; +} + +void +md_show_usage (stream) + FILE *stream ATTRIBUTE_UNUSED; +{ +#ifdef OBJ_ELF + fprintf (stream, _("\ + -Q ignored\n")); +#endif +#ifdef WARN_COMMENTS + fprintf (stream, _("\ + -c print a warning if a comment is found\n")); +#endif +} + +/* We have no need to default values of symbols. */ + +symbolS * +md_undefined_symbol (name) + char *name ATTRIBUTE_UNUSED; +{ + return 0; +} + +#if defined (OBJ_SOM) || defined (ELF_ARG_RELOC) +#define nonzero_dibits(x) \ + ((x) | (((x) & 0x55555555) << 1) | (((x) & 0xAAAAAAAA) >> 1)) +#define arg_reloc_stub_needed(CALLER, CALLEE) \ + (((CALLER) ^ (CALLEE)) & nonzero_dibits (CALLER) & nonzero_dibits (CALLEE)) +#else +#define arg_reloc_stub_needed(CALLER, CALLEE) 0 +#endif + +/* Apply a fixup to an instruction. */ + +void +md_apply_fix3 (fixP, valP, seg) + fixS *fixP; + valueT *valP; + segT seg ATTRIBUTE_UNUSED; +{ + unsigned char *buf; + struct hppa_fix_struct *hppa_fixP; + offsetT new_val; + int insn, val, fmt; + + /* SOM uses R_HPPA_ENTRY and R_HPPA_EXIT relocations which can + never be "applied" (they are just markers). Likewise for + R_HPPA_BEGIN_BRTAB and R_HPPA_END_BRTAB. */ +#ifdef OBJ_SOM + if (fixP->fx_r_type == R_HPPA_ENTRY + || fixP->fx_r_type == R_HPPA_EXIT + || fixP->fx_r_type == R_HPPA_BEGIN_BRTAB + || fixP->fx_r_type == R_HPPA_END_BRTAB + || fixP->fx_r_type == R_HPPA_BEGIN_TRY) + return; + + /* Disgusting. We must set fx_offset ourselves -- R_HPPA_END_TRY + fixups are considered not adjustable, which in turn causes + adjust_reloc_syms to not set fx_offset. Ugh. */ + if (fixP->fx_r_type == R_HPPA_END_TRY) + { + fixP->fx_offset = * valP; + return; + } +#endif +#ifdef OBJ_ELF + if (fixP->fx_r_type == (int) R_PARISC_GNU_VTENTRY + || fixP->fx_r_type == (int) R_PARISC_GNU_VTINHERIT) + return; +#endif + + if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0) + fixP->fx_done = 1; + + /* There should have been an HPPA specific fixup associated + with the GAS fixup. */ + hppa_fixP = (struct hppa_fix_struct *) fixP->tc_fix_data; + if (hppa_fixP == NULL) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("no hppa_fixup entry for fixup type 0x%x"), + fixP->fx_r_type); + return; + } + + buf = (unsigned char *) (fixP->fx_frag->fr_literal + fixP->fx_where); + insn = bfd_get_32 (stdoutput, buf); + fmt = bfd_hppa_insn2fmt (stdoutput, insn); + + /* If there is a symbol associated with this fixup, then it's something + which will need a SOM relocation (except for some PC-relative relocs). + In such cases we should treat the "val" or "addend" as zero since it + will be added in as needed from fx_offset in tc_gen_reloc. */ + if ((fixP->fx_addsy != NULL + || fixP->fx_r_type == (int) R_HPPA_NONE) +#ifdef OBJ_SOM + && fmt != 32 +#endif + ) + new_val = ((fmt == 12 || fmt == 17 || fmt == 22) ? 8 : 0); +#ifdef OBJ_SOM + /* These field selectors imply that we do not want an addend. */ + else if (hppa_fixP->fx_r_field == e_psel + || hppa_fixP->fx_r_field == e_rpsel + || hppa_fixP->fx_r_field == e_lpsel + || hppa_fixP->fx_r_field == e_tsel + || hppa_fixP->fx_r_field == e_rtsel + || hppa_fixP->fx_r_field == e_ltsel) + new_val = ((fmt == 12 || fmt == 17 || fmt == 22) ? 8 : 0); +#endif + else + new_val = hppa_field_adjust (* valP, 0, hppa_fixP->fx_r_field); + + /* Handle pc-relative exceptions from above. */ + if ((fmt == 12 || fmt == 17 || fmt == 22) + && fixP->fx_addsy + && fixP->fx_pcrel + && !arg_reloc_stub_needed (symbol_arg_reloc_info (fixP->fx_addsy), + hppa_fixP->fx_arg_reloc) +#ifdef OBJ_ELF + && (* valP - 8 + 8192 < 16384 + || (fmt == 17 && * valP - 8 + 262144 < 524288) + || (fmt == 22 && * valP - 8 + 8388608 < 16777216)) +#endif +#ifdef OBJ_SOM + && (* valP - 8 + 262144 < 524288 + || (fmt == 22 && * valP - 8 + 8388608 < 16777216)) +#endif + && !S_IS_EXTERNAL (fixP->fx_addsy) + && !S_IS_WEAK (fixP->fx_addsy) + && S_GET_SEGMENT (fixP->fx_addsy) == hppa_fixP->segment + && !(fixP->fx_subsy + && S_GET_SEGMENT (fixP->fx_subsy) != hppa_fixP->segment)) + { + new_val = hppa_field_adjust (* valP, 0, hppa_fixP->fx_r_field); + } + + switch (fmt) + { + case 10: + CHECK_FIELD_WHERE (new_val, 8191, -8192, + fixP->fx_file, fixP->fx_line); + val = new_val; + + insn = (insn & ~ 0x3ff1) | (((val & 0x1ff8) << 1) + | ((val & 0x2000) >> 13)); + break; + case -11: + CHECK_FIELD_WHERE (new_val, 8191, -8192, + fixP->fx_file, fixP->fx_line); + val = new_val; + + insn = (insn & ~ 0x3ff9) | (((val & 0x1ffc) << 1) + | ((val & 0x2000) >> 13)); + break; + /* Handle all opcodes with the 'j' operand type. */ + case 14: + CHECK_FIELD_WHERE (new_val, 8191, -8192, + fixP->fx_file, fixP->fx_line); + val = new_val; + + insn = ((insn & ~ 0x3fff) | low_sign_unext (val, 14)); + break; + + /* Handle all opcodes with the 'k' operand type. */ + case 21: + CHECK_FIELD_WHERE (new_val, 1048575, -1048576, + fixP->fx_file, fixP->fx_line); + val = new_val; + + insn = (insn & ~ 0x1fffff) | re_assemble_21 (val); + break; + + /* Handle all the opcodes with the 'i' operand type. */ + case 11: + CHECK_FIELD_WHERE (new_val, 1023, -1024, + fixP->fx_file, fixP->fx_line); + val = new_val; + + insn = (insn & ~ 0x7ff) | low_sign_unext (val, 11); + break; + + /* Handle all the opcodes with the 'w' operand type. */ + case 12: + CHECK_FIELD_WHERE (new_val - 8, 8191, -8192, + fixP->fx_file, fixP->fx_line); + val = new_val - 8; + + insn = (insn & ~ 0x1ffd) | re_assemble_12 (val >> 2); + break; + + /* Handle some of the opcodes with the 'W' operand type. */ + case 17: + { + offsetT distance = * valP; + + /* If this is an absolute branch (ie no link) with an out of + range target, then we want to complain. */ + if (fixP->fx_r_type == (int) R_HPPA_PCREL_CALL + && (insn & 0xffe00000) == 0xe8000000) + CHECK_FIELD_WHERE (distance - 8, 262143, -262144, + fixP->fx_file, fixP->fx_line); + + CHECK_FIELD_WHERE (new_val - 8, 262143, -262144, + fixP->fx_file, fixP->fx_line); + val = new_val - 8; + + insn = (insn & ~ 0x1f1ffd) | re_assemble_17 (val >> 2); + break; + } + + case 22: + { + offsetT distance = * valP; + + /* If this is an absolute branch (ie no link) with an out of + range target, then we want to complain. */ + if (fixP->fx_r_type == (int) R_HPPA_PCREL_CALL + && (insn & 0xffe00000) == 0xe8000000) + CHECK_FIELD_WHERE (distance - 8, 8388607, -8388608, + fixP->fx_file, fixP->fx_line); + + CHECK_FIELD_WHERE (new_val - 8, 8388607, -8388608, + fixP->fx_file, fixP->fx_line); + val = new_val - 8; + + insn = (insn & ~ 0x3ff1ffd) | re_assemble_22 (val >> 2); + break; + } + + case -10: + val = new_val; + insn = (insn & ~ 0xfff1) | re_assemble_16 (val & -8); + break; + + case -16: + val = new_val; + insn = (insn & ~ 0xfff9) | re_assemble_16 (val & -4); + break; + + case 16: + val = new_val; + insn = (insn & ~ 0xffff) | re_assemble_16 (val); + break; + + case 32: + insn = new_val; + break; + + default: + as_bad_where (fixP->fx_file, fixP->fx_line, + _("Unknown relocation encountered in md_apply_fix.")); + return; + } + + /* Insert the relocation. */ + bfd_put_32 (stdoutput, insn, buf); +} + +/* Exactly what point is a PC-relative offset relative TO? + On the PA, they're relative to the address of the offset. */ + +long +md_pcrel_from (fixP) + fixS *fixP; +{ + return fixP->fx_where + fixP->fx_frag->fr_address; +} + +/* Return nonzero if the input line pointer is at the end of + a statement. */ + +static int +is_end_of_statement () +{ + return ((*input_line_pointer == '\n') + || (*input_line_pointer == ';') + || (*input_line_pointer == '!')); +} + +/* Read a number from S. The number might come in one of many forms, + the most common will be a hex or decimal constant, but it could be + a pre-defined register (Yuk!), or an absolute symbol. + + Return 1 on success or 0 on failure. If STRICT, then a missing + register prefix will cause a failure. The number itself is + returned in `pa_number'. + + IS_FLOAT indicates that a PA-89 FP register number should be + parsed; A `l' or `r' suffix is checked for if but 2 of IS_FLOAT is + not set. + + pa_parse_number can not handle negative constants and will fail + horribly if it is passed such a constant. */ + +static int +pa_parse_number (s, is_float) + char **s; + int is_float; +{ + int num; + char *name; + char c; + symbolS *sym; + int status; + char *p = *s; + bfd_boolean have_prefix; + + /* Skip whitespace before the number. */ + while (*p == ' ' || *p == '\t') + p = p + 1; + + pa_number = -1; + have_prefix = 0; + num = 0; + if (!strict && ISDIGIT (*p)) + { + /* Looks like a number. */ + + if (*p == '0' && (*(p + 1) == 'x' || *(p + 1) == 'X')) + { + /* The number is specified in hex. */ + p += 2; + while (ISDIGIT (*p) || ((*p >= 'a') && (*p <= 'f')) + || ((*p >= 'A') && (*p <= 'F'))) + { + if (ISDIGIT (*p)) + num = num * 16 + *p - '0'; + else if (*p >= 'a' && *p <= 'f') + num = num * 16 + *p - 'a' + 10; + else + num = num * 16 + *p - 'A' + 10; + ++p; + } + } + else + { + /* The number is specified in decimal. */ + while (ISDIGIT (*p)) + { + num = num * 10 + *p - '0'; + ++p; + } + } + + pa_number = num; + + /* Check for a `l' or `r' suffix. */ + if (is_float) + { + pa_number += FP_REG_BASE; + if (! (is_float & 2)) + { + if (IS_R_SELECT (p)) + { + pa_number += FP_REG_RSEL; + ++p; + } + else if (IS_L_SELECT (p)) + { + ++p; + } + } + } + } + else if (*p == '%') + { + /* The number might be a predefined register. */ + have_prefix = 1; + name = p; + p++; + c = *p; + /* Tege hack: Special case for general registers as the general + code makes a binary search with case translation, and is VERY + slow. */ + if (c == 'r') + { + p++; + if (*p == 'e' && *(p + 1) == 't' + && (*(p + 2) == '0' || *(p + 2) == '1')) + { + p += 2; + num = *p - '0' + 28; + p++; + } + else if (*p == 'p') + { + num = 2; + p++; + } + else if (!ISDIGIT (*p)) + { + if (print_errors) + as_bad (_("Undefined register: '%s'."), name); + num = -1; + } + else + { + do + num = num * 10 + *p++ - '0'; + while (ISDIGIT (*p)); + } + } + else + { + /* Do a normal register search. */ + while (is_part_of_name (c)) + { + p = p + 1; + c = *p; + } + *p = 0; + status = reg_name_search (name); + if (status >= 0) + num = status; + else + { + if (print_errors) + as_bad (_("Undefined register: '%s'."), name); + num = -1; + } + *p = c; + } + + pa_number = num; + } + else + { + /* And finally, it could be a symbol in the absolute section which + is effectively a constant, or a register alias symbol. */ + name = p; + c = *p; + while (is_part_of_name (c)) + { + p = p + 1; + c = *p; + } + *p = 0; + if ((sym = symbol_find (name)) != NULL) + { + if (S_GET_SEGMENT (sym) == reg_section) + { + num = S_GET_VALUE (sym); + /* Well, we don't really have one, but we do have a + register, so... */ + have_prefix = TRUE; + } + else if (S_GET_SEGMENT (sym) == &bfd_abs_section) + num = S_GET_VALUE (sym); + else if (!strict) + { + if (print_errors) + as_bad (_("Non-absolute symbol: '%s'."), name); + num = -1; + } + } + else if (!strict) + { + /* There is where we'd come for an undefined symbol + or for an empty string. For an empty string we + will return zero. That's a concession made for + compatibility with the braindamaged HP assemblers. */ + if (*name == 0) + num = 0; + else + { + if (print_errors) + as_bad (_("Undefined absolute constant: '%s'."), name); + num = -1; + } + } + *p = c; + + pa_number = num; + } + + if (!strict || have_prefix) + { + *s = p; + return 1; + } + return 0; +} + +#define REG_NAME_CNT (sizeof (pre_defined_registers) / sizeof (struct pd_reg)) + +/* Given NAME, find the register number associated with that name, return + the integer value associated with the given name or -1 on failure. */ + +static int +reg_name_search (name) + char *name; +{ + int middle, low, high; + int cmp; + + low = 0; + high = REG_NAME_CNT - 1; + + do + { + middle = (low + high) / 2; + cmp = strcasecmp (name, pre_defined_registers[middle].name); + if (cmp < 0) + high = middle - 1; + else if (cmp > 0) + low = middle + 1; + else + return pre_defined_registers[middle].value; + } + while (low <= high); + + return -1; +} + +/* Return nonzero if the given INSN and L/R information will require + a new PA-1.1 opcode. */ + +static int +need_pa11_opcode () +{ + if ((pa_number & FP_REG_RSEL) != 0 + && !(the_insn.fpof1 == DBL && the_insn.fpof2 == DBL)) + { + /* If this instruction is specific to a particular architecture, + then set a new architecture. */ + if (bfd_get_mach (stdoutput) < pa11) + { + if (!bfd_set_arch_mach (stdoutput, bfd_arch_hppa, pa11)) + as_warn (_("could not update architecture and machine")); + } + return TRUE; + } + else + return FALSE; +} + +/* Parse a condition for a fcmp instruction. Return the numerical + code associated with the condition. */ + +static int +pa_parse_fp_cmp_cond (s) + char **s; +{ + int cond, i; + + cond = 0; + + for (i = 0; i < 32; i++) + { + if (strncasecmp (*s, fp_cond_map[i].string, + strlen (fp_cond_map[i].string)) == 0) + { + cond = fp_cond_map[i].cond; + *s += strlen (fp_cond_map[i].string); + /* If not a complete match, back up the input string and + report an error. */ + if (**s != ' ' && **s != '\t') + { + *s -= strlen (fp_cond_map[i].string); + break; + } + while (**s == ' ' || **s == '\t') + *s = *s + 1; + return cond; + } + } + + as_bad (_("Invalid FP Compare Condition: %s"), *s); + + /* Advance over the bogus completer. */ + while (**s != ',' && **s != ' ' && **s != '\t') + *s += 1; + + return 0; +} + +/* Parse a graphics test complete for ftest. */ + +static int +pa_parse_ftest_gfx_completer (s) + char **s; +{ + int value; + + value = 0; + if (strncasecmp (*s, "acc8", 4) == 0) + { + value = 5; + *s += 4; + } + else if (strncasecmp (*s, "acc6", 4) == 0) + { + value = 9; + *s += 4; + } + else if (strncasecmp (*s, "acc4", 4) == 0) + { + value = 13; + *s += 4; + } + else if (strncasecmp (*s, "acc2", 4) == 0) + { + value = 17; + *s += 4; + } + else if (strncasecmp (*s, "acc", 3) == 0) + { + value = 1; + *s += 3; + } + else if (strncasecmp (*s, "rej8", 4) == 0) + { + value = 6; + *s += 4; + } + else if (strncasecmp (*s, "rej", 3) == 0) + { + value = 2; + *s += 3; + } + else + { + value = 0; + as_bad (_("Invalid FTEST completer: %s"), *s); + } + + return value; +} + +/* Parse an FP operand format completer returning the completer + type. */ + +static fp_operand_format +pa_parse_fp_cnv_format (s) + char **s; +{ + int format; + + format = SGL; + if (**s == ',') + { + *s += 1; + if (strncasecmp (*s, "sgl", 3) == 0) + { + format = SGL; + *s += 4; + } + else if (strncasecmp (*s, "dbl", 3) == 0) + { + format = DBL; + *s += 4; + } + else if (strncasecmp (*s, "quad", 4) == 0) + { + format = QUAD; + *s += 5; + } + else if (strncasecmp (*s, "w", 1) == 0) + { + format = W; + *s += 2; + } + else if (strncasecmp (*s, "uw", 2) == 0) + { + format = UW; + *s += 3; + } + else if (strncasecmp (*s, "dw", 2) == 0) + { + format = DW; + *s += 3; + } + else if (strncasecmp (*s, "udw", 3) == 0) + { + format = UDW; + *s += 4; + } + else if (strncasecmp (*s, "qw", 2) == 0) + { + format = QW; + *s += 3; + } + else if (strncasecmp (*s, "uqw", 3) == 0) + { + format = UQW; + *s += 4; + } + else + { + format = ILLEGAL_FMT; + as_bad (_("Invalid FP Operand Format: %3s"), *s); + } + } + + return format; +} + +/* Parse an FP operand format completer returning the completer + type. */ + +static fp_operand_format +pa_parse_fp_format (s) + char **s; +{ + int format; + + format = SGL; + if (**s == ',') + { + *s += 1; + if (strncasecmp (*s, "sgl", 3) == 0) + { + format = SGL; + *s += 4; + } + else if (strncasecmp (*s, "dbl", 3) == 0) + { + format = DBL; + *s += 4; + } + else if (strncasecmp (*s, "quad", 4) == 0) + { + format = QUAD; + *s += 5; + } + else + { + format = ILLEGAL_FMT; + as_bad (_("Invalid FP Operand Format: %3s"), *s); + } + } + + return format; +} + +/* Convert from a selector string into a selector type. */ + +static int +pa_chk_field_selector (str) + char **str; +{ + int middle, low, high; + int cmp; + char name[4]; + + /* Read past any whitespace. */ + /* FIXME: should we read past newlines and formfeeds??? */ + while (**str == ' ' || **str == '\t' || **str == '\n' || **str == '\f') + *str = *str + 1; + + if ((*str)[1] == '\'' || (*str)[1] == '%') + name[0] = TOLOWER ((*str)[0]), + name[1] = 0; + else if ((*str)[2] == '\'' || (*str)[2] == '%') + name[0] = TOLOWER ((*str)[0]), + name[1] = TOLOWER ((*str)[1]), + name[2] = 0; + else if ((*str)[3] == '\'' || (*str)[3] == '%') + name[0] = TOLOWER ((*str)[0]), + name[1] = TOLOWER ((*str)[1]), + name[2] = TOLOWER ((*str)[2]), + name[3] = 0; + else + return e_fsel; + + low = 0; + high = sizeof (selector_table) / sizeof (struct selector_entry) - 1; + + do + { + middle = (low + high) / 2; + cmp = strcmp (name, selector_table[middle].prefix); + if (cmp < 0) + high = middle - 1; + else if (cmp > 0) + low = middle + 1; + else + { + *str += strlen (name) + 1; +#ifndef OBJ_SOM + if (selector_table[middle].field_selector == e_nsel) + return e_fsel; +#endif + return selector_table[middle].field_selector; + } + } + while (low <= high); + + return e_fsel; +} + +/* Mark (via expr_end) the end of an expression (I think). FIXME. */ + +static int +get_expression (str) + char *str; +{ + char *save_in; + asection *seg; + + save_in = input_line_pointer; + input_line_pointer = str; + seg = expression (&the_insn.exp); + if (!(seg == absolute_section + || seg == undefined_section + || SEG_NORMAL (seg))) + { + as_warn (_("Bad segment in expression.")); + expr_end = input_line_pointer; + input_line_pointer = save_in; + return 1; + } + expr_end = input_line_pointer; + input_line_pointer = save_in; + return 0; +} + +/* Mark (via expr_end) the end of an absolute expression. FIXME. */ +static int +pa_get_absolute_expression (insn, strp) + struct pa_it *insn; + char **strp; +{ + char *save_in; + + insn->field_selector = pa_chk_field_selector (strp); + save_in = input_line_pointer; + input_line_pointer = *strp; + expression (&insn->exp); + /* This is not perfect, but is a huge improvement over doing nothing. + + The PA assembly syntax is ambiguous in a variety of ways. Consider + this string "4 %r5" Is that the number 4 followed by the register + r5, or is that 4 MOD r5? + + If we get a modulo expression when looking for an absolute, we try + again cutting off the input string at the first whitespace character. */ + if (insn->exp.X_op == O_modulus) + { + char *s, c; + int retval; + + input_line_pointer = *strp; + s = *strp; + while (*s != ',' && *s != ' ' && *s != '\t') + s++; + + c = *s; + *s = 0; + + retval = pa_get_absolute_expression (insn, strp); + + input_line_pointer = save_in; + *s = c; + return evaluate_absolute (insn); + } + /* When in strict mode we have a non-match, fix up the pointers + and return to our caller. */ + if (insn->exp.X_op != O_constant && strict) + { + expr_end = input_line_pointer; + input_line_pointer = save_in; + return 0; + } + if (insn->exp.X_op != O_constant) + { + as_bad (_("Bad segment (should be absolute).")); + expr_end = input_line_pointer; + input_line_pointer = save_in; + return 0; + } + expr_end = input_line_pointer; + input_line_pointer = save_in; + return evaluate_absolute (insn); +} + +/* Evaluate an absolute expression EXP which may be modified by + the selector FIELD_SELECTOR. Return the value of the expression. */ +static int +evaluate_absolute (insn) + struct pa_it *insn; +{ + offsetT value; + expressionS exp; + int field_selector = insn->field_selector; + + exp = insn->exp; + value = exp.X_add_number; + + return hppa_field_adjust (0, value, field_selector); +} + +/* Given an argument location specification return the associated + argument location number. */ + +static unsigned int +pa_build_arg_reloc (type_name) + char *type_name; +{ + + if (strncasecmp (type_name, "no", 2) == 0) + return 0; + if (strncasecmp (type_name, "gr", 2) == 0) + return 1; + else if (strncasecmp (type_name, "fr", 2) == 0) + return 2; + else if (strncasecmp (type_name, "fu", 2) == 0) + return 3; + else + as_bad (_("Invalid argument location: %s\n"), type_name); + + return 0; +} + +/* Encode and return an argument relocation specification for + the given register in the location specified by arg_reloc. */ + +static unsigned int +pa_align_arg_reloc (reg, arg_reloc) + unsigned int reg; + unsigned int arg_reloc; +{ + unsigned int new_reloc; + + new_reloc = arg_reloc; + switch (reg) + { + case 0: + new_reloc <<= 8; + break; + case 1: + new_reloc <<= 6; + break; + case 2: + new_reloc <<= 4; + break; + case 3: + new_reloc <<= 2; + break; + default: + as_bad (_("Invalid argument description: %d"), reg); + } + + return new_reloc; +} + +/* Parse a PA nullification completer (,n). Return nonzero if the + completer was found; return zero if no completer was found. */ + +static int +pa_parse_nullif (s) + char **s; +{ + int nullif; + + nullif = 0; + if (**s == ',') + { + *s = *s + 1; + if (strncasecmp (*s, "n", 1) == 0) + nullif = 1; + else + { + as_bad (_("Invalid Nullification: (%c)"), **s); + nullif = 0; + } + *s = *s + 1; + } + + return nullif; +} + +/* Parse a non-negated compare/subtract completer returning the + number (for encoding in instructions) of the given completer. */ + +static int +pa_parse_nonneg_cmpsub_cmpltr (s) + char **s; +{ + int cmpltr; + char *name = *s + 1; + char c; + char *save_s = *s; + int nullify = 0; + + cmpltr = 0; + if (**s == ',') + { + *s += 1; + while (**s != ',' && **s != ' ' && **s != '\t') + *s += 1; + c = **s; + **s = 0x00; + + if (strcmp (name, "=") == 0) + { + cmpltr = 1; + } + else if (strcmp (name, "<") == 0) + { + cmpltr = 2; + } + else if (strcmp (name, "<=") == 0) + { + cmpltr = 3; + } + else if (strcmp (name, "<<") == 0) + { + cmpltr = 4; + } + else if (strcmp (name, "<<=") == 0) + { + cmpltr = 5; + } + else if (strcasecmp (name, "sv") == 0) + { + cmpltr = 6; + } + else if (strcasecmp (name, "od") == 0) + { + cmpltr = 7; + } + /* If we have something like addb,n then there is no condition + completer. */ + else if (strcasecmp (name, "n") == 0) + { + cmpltr = 0; + nullify = 1; + } + else + { + cmpltr = -1; + } + **s = c; + } + + /* Reset pointers if this was really a ,n for a branch instruction. */ + if (nullify) + *s = save_s; + + return cmpltr; +} + +/* Parse a negated compare/subtract completer returning the + number (for encoding in instructions) of the given completer. */ + +static int +pa_parse_neg_cmpsub_cmpltr (s) + char **s; +{ + int cmpltr; + char *name = *s + 1; + char c; + char *save_s = *s; + int nullify = 0; + + cmpltr = 0; + if (**s == ',') + { + *s += 1; + while (**s != ',' && **s != ' ' && **s != '\t') + *s += 1; + c = **s; + **s = 0x00; + + if (strcasecmp (name, "tr") == 0) + { + cmpltr = 0; + } + else if (strcmp (name, "<>") == 0) + { + cmpltr = 1; + } + else if (strcmp (name, ">=") == 0) + { + cmpltr = 2; + } + else if (strcmp (name, ">") == 0) + { + cmpltr = 3; + } + else if (strcmp (name, ">>=") == 0) + { + cmpltr = 4; + } + else if (strcmp (name, ">>") == 0) + { + cmpltr = 5; + } + else if (strcasecmp (name, "nsv") == 0) + { + cmpltr = 6; + } + else if (strcasecmp (name, "ev") == 0) + { + cmpltr = 7; + } + /* If we have something like addb,n then there is no condition + completer. */ + else if (strcasecmp (name, "n") == 0) + { + cmpltr = 0; + nullify = 1; + } + else + { + cmpltr = -1; + } + **s = c; + } + + /* Reset pointers if this was really a ,n for a branch instruction. */ + if (nullify) + *s = save_s; + + return cmpltr; +} + +/* Parse a 64 bit compare and branch completer returning the number (for + encoding in instructions) of the given completer. + + Nonnegated comparisons are returned as 0-7, negated comparisons are + returned as 8-15. */ + +static int +pa_parse_cmpb_64_cmpltr (s) + char **s; +{ + int cmpltr; + char *name = *s + 1; + char c; + + cmpltr = -1; + if (**s == ',') + { + *s += 1; + while (**s != ',' && **s != ' ' && **s != '\t') + *s += 1; + c = **s; + **s = 0x00; + + if (strcmp (name, "*") == 0) + { + cmpltr = 0; + } + else if (strcmp (name, "*=") == 0) + { + cmpltr = 1; + } + else if (strcmp (name, "*<") == 0) + { + cmpltr = 2; + } + else if (strcmp (name, "*<=") == 0) + { + cmpltr = 3; + } + else if (strcmp (name, "*<<") == 0) + { + cmpltr = 4; + } + else if (strcmp (name, "*<<=") == 0) + { + cmpltr = 5; + } + else if (strcasecmp (name, "*sv") == 0) + { + cmpltr = 6; + } + else if (strcasecmp (name, "*od") == 0) + { + cmpltr = 7; + } + else if (strcasecmp (name, "*tr") == 0) + { + cmpltr = 8; + } + else if (strcmp (name, "*<>") == 0) + { + cmpltr = 9; + } + else if (strcmp (name, "*>=") == 0) + { + cmpltr = 10; + } + else if (strcmp (name, "*>") == 0) + { + cmpltr = 11; + } + else if (strcmp (name, "*>>=") == 0) + { + cmpltr = 12; + } + else if (strcmp (name, "*>>") == 0) + { + cmpltr = 13; + } + else if (strcasecmp (name, "*nsv") == 0) + { + cmpltr = 14; + } + else if (strcasecmp (name, "*ev") == 0) + { + cmpltr = 15; + } + else + { + cmpltr = -1; + } + **s = c; + } + + return cmpltr; +} + +/* Parse a 64 bit compare immediate and branch completer returning the number + (for encoding in instructions) of the given completer. */ + +static int +pa_parse_cmpib_64_cmpltr (s) + char **s; +{ + int cmpltr; + char *name = *s + 1; + char c; + + cmpltr = -1; + if (**s == ',') + { + *s += 1; + while (**s != ',' && **s != ' ' && **s != '\t') + *s += 1; + c = **s; + **s = 0x00; + + if (strcmp (name, "*<<") == 0) + { + cmpltr = 0; + } + else if (strcmp (name, "*=") == 0) + { + cmpltr = 1; + } + else if (strcmp (name, "*<") == 0) + { + cmpltr = 2; + } + else if (strcmp (name, "*<=") == 0) + { + cmpltr = 3; + } + else if (strcmp (name, "*>>=") == 0) + { + cmpltr = 4; + } + else if (strcmp (name, "*<>") == 0) + { + cmpltr = 5; + } + else if (strcasecmp (name, "*>=") == 0) + { + cmpltr = 6; + } + else if (strcasecmp (name, "*>") == 0) + { + cmpltr = 7; + } + else + { + cmpltr = -1; + } + **s = c; + } + + return cmpltr; +} + +/* Parse a non-negated addition completer returning the number + (for encoding in instructions) of the given completer. */ + +static int +pa_parse_nonneg_add_cmpltr (s) + char **s; +{ + int cmpltr; + char *name = *s + 1; + char c; + char *save_s = *s; + int nullify = 0; + + cmpltr = 0; + if (**s == ',') + { + *s += 1; + while (**s != ',' && **s != ' ' && **s != '\t') + *s += 1; + c = **s; + **s = 0x00; + if (strcmp (name, "=") == 0) + { + cmpltr = 1; + } + else if (strcmp (name, "<") == 0) + { + cmpltr = 2; + } + else if (strcmp (name, "<=") == 0) + { + cmpltr = 3; + } + else if (strcasecmp (name, "nuv") == 0) + { + cmpltr = 4; + } + else if (strcasecmp (name, "znv") == 0) + { + cmpltr = 5; + } + else if (strcasecmp (name, "sv") == 0) + { + cmpltr = 6; + } + else if (strcasecmp (name, "od") == 0) + { + cmpltr = 7; + } + /* If we have something like addb,n then there is no condition + completer. */ + else if (strcasecmp (name, "n") == 0) + { + cmpltr = 0; + nullify = 1; + } + else + { + cmpltr = -1; + } + **s = c; + } + + /* Reset pointers if this was really a ,n for a branch instruction. */ + if (nullify) + *s = save_s; + + return cmpltr; +} + +/* Parse a negated addition completer returning the number + (for encoding in instructions) of the given completer. */ + +static int +pa_parse_neg_add_cmpltr (s) + char **s; +{ + int cmpltr; + char *name = *s + 1; + char c; + char *save_s = *s; + int nullify = 0; + + cmpltr = 0; + if (**s == ',') + { + *s += 1; + while (**s != ',' && **s != ' ' && **s != '\t') + *s += 1; + c = **s; + **s = 0x00; + if (strcasecmp (name, "tr") == 0) + { + cmpltr = 0; + } + else if (strcmp (name, "<>") == 0) + { + cmpltr = 1; + } + else if (strcmp (name, ">=") == 0) + { + cmpltr = 2; + } + else if (strcmp (name, ">") == 0) + { + cmpltr = 3; + } + else if (strcasecmp (name, "uv") == 0) + { + cmpltr = 4; + } + else if (strcasecmp (name, "vnz") == 0) + { + cmpltr = 5; + } + else if (strcasecmp (name, "nsv") == 0) + { + cmpltr = 6; + } + else if (strcasecmp (name, "ev") == 0) + { + cmpltr = 7; + } + /* If we have something like addb,n then there is no condition + completer. */ + else if (strcasecmp (name, "n") == 0) + { + cmpltr = 0; + nullify = 1; + } + else + { + cmpltr = -1; + } + **s = c; + } + + /* Reset pointers if this was really a ,n for a branch instruction. */ + if (nullify) + *s = save_s; + + return cmpltr; +} + +/* Parse a 64 bit wide mode add and branch completer returning the number (for + encoding in instructions) of the given completer. */ + +static int +pa_parse_addb_64_cmpltr (s) + char **s; +{ + int cmpltr; + char *name = *s + 1; + char c; + char *save_s = *s; + int nullify = 0; + + cmpltr = 0; + if (**s == ',') + { + *s += 1; + while (**s != ',' && **s != ' ' && **s != '\t') + *s += 1; + c = **s; + **s = 0x00; + if (strcmp (name, "=") == 0) + { + cmpltr = 1; + } + else if (strcmp (name, "<") == 0) + { + cmpltr = 2; + } + else if (strcmp (name, "<=") == 0) + { + cmpltr = 3; + } + else if (strcasecmp (name, "nuv") == 0) + { + cmpltr = 4; + } + else if (strcasecmp (name, "*=") == 0) + { + cmpltr = 5; + } + else if (strcasecmp (name, "*<") == 0) + { + cmpltr = 6; + } + else if (strcasecmp (name, "*<=") == 0) + { + cmpltr = 7; + } + else if (strcmp (name, "tr") == 0) + { + cmpltr = 8; + } + else if (strcmp (name, "<>") == 0) + { + cmpltr = 9; + } + else if (strcmp (name, ">=") == 0) + { + cmpltr = 10; + } + else if (strcmp (name, ">") == 0) + { + cmpltr = 11; + } + else if (strcasecmp (name, "uv") == 0) + { + cmpltr = 12; + } + else if (strcasecmp (name, "*<>") == 0) + { + cmpltr = 13; + } + else if (strcasecmp (name, "*>=") == 0) + { + cmpltr = 14; + } + else if (strcasecmp (name, "*>") == 0) + { + cmpltr = 15; + } + /* If we have something like addb,n then there is no condition + completer. */ + else if (strcasecmp (name, "n") == 0) + { + cmpltr = 0; + nullify = 1; + } + else + { + cmpltr = -1; + } + **s = c; + } + + /* Reset pointers if this was really a ,n for a branch instruction. */ + if (nullify) + *s = save_s; + + return cmpltr; +} + +#ifdef OBJ_SOM +/* Handle an alignment directive. Special so that we can update the + alignment of the subspace if necessary. */ +static void +pa_align (bytes) + int bytes; +{ + /* We must have a valid space and subspace. */ + pa_check_current_space_and_subspace (); + + /* Let the generic gas code do most of the work. */ + s_align_bytes (bytes); + + /* If bytes is a power of 2, then update the current subspace's + alignment if necessary. */ + if (log2 (bytes) != -1) + record_alignment (current_subspace->ssd_seg, log2 (bytes)); +} +#endif + +/* Handle a .BLOCK type pseudo-op. */ + +static void +pa_block (z) + int z ATTRIBUTE_UNUSED; +{ + char *p; + long int temp_fill; + unsigned int temp_size; + unsigned int i; + +#ifdef OBJ_SOM + /* We must have a valid space and subspace. */ + pa_check_current_space_and_subspace (); +#endif + + temp_size = get_absolute_expression (); + + /* Always fill with zeros, that's what the HP assembler does. */ + temp_fill = 0; + + p = frag_var (rs_fill, (int) temp_size, (int) temp_size, + (relax_substateT) 0, (symbolS *) 0, (offsetT) 1, NULL); + memset (p, 0, temp_size); + + /* Convert 2 bytes at a time. */ + + for (i = 0; i < temp_size; i += 2) + { + md_number_to_chars (p + i, + (valueT) temp_fill, + (int) ((temp_size - i) > 2 ? 2 : (temp_size - i))); + } + + pa_undefine_label (); + demand_empty_rest_of_line (); +} + +/* Handle a .begin_brtab and .end_brtab pseudo-op. */ + +static void +pa_brtab (begin) + int begin ATTRIBUTE_UNUSED; +{ + +#ifdef OBJ_SOM + /* The BRTAB relocations are only available in SOM (to denote + the beginning and end of branch tables). */ + char *where = frag_more (0); + + fix_new_hppa (frag_now, where - frag_now->fr_literal, 0, + NULL, (offsetT) 0, NULL, + 0, begin ? R_HPPA_BEGIN_BRTAB : R_HPPA_END_BRTAB, + e_fsel, 0, 0, 0); +#endif + + demand_empty_rest_of_line (); +} + +/* Handle a .begin_try and .end_try pseudo-op. */ + +static void +pa_try (begin) + int begin ATTRIBUTE_UNUSED; +{ +#ifdef OBJ_SOM + expressionS exp; + char *where = frag_more (0); + + if (! begin) + expression (&exp); + + /* The TRY relocations are only available in SOM (to denote + the beginning and end of exception handling regions). */ + + fix_new_hppa (frag_now, where - frag_now->fr_literal, 0, + NULL, (offsetT) 0, begin ? NULL : &exp, + 0, begin ? R_HPPA_BEGIN_TRY : R_HPPA_END_TRY, + e_fsel, 0, 0, 0); +#endif + + demand_empty_rest_of_line (); +} + +/* Handle a .CALL pseudo-op. This involves storing away information + about where arguments are to be found so the linker can detect + (and correct) argument location mismatches between caller and callee. */ + +static void +pa_call (unused) + int unused ATTRIBUTE_UNUSED; +{ +#ifdef OBJ_SOM + /* We must have a valid space and subspace. */ + pa_check_current_space_and_subspace (); +#endif + + pa_call_args (&last_call_desc); + demand_empty_rest_of_line (); +} + +/* Do the dirty work of building a call descriptor which describes + where the caller placed arguments to a function call. */ + +static void +pa_call_args (call_desc) + struct call_desc *call_desc; +{ + char *name, c, *p; + unsigned int temp, arg_reloc; + + while (!is_end_of_statement ()) + { + name = input_line_pointer; + c = get_symbol_end (); + /* Process a source argument. */ + if ((strncasecmp (name, "argw", 4) == 0)) + { + temp = atoi (name + 4); + p = input_line_pointer; + *p = c; + input_line_pointer++; + name = input_line_pointer; + c = get_symbol_end (); + arg_reloc = pa_build_arg_reloc (name); + call_desc->arg_reloc |= pa_align_arg_reloc (temp, arg_reloc); + } + /* Process a return value. */ + else if ((strncasecmp (name, "rtnval", 6) == 0)) + { + p = input_line_pointer; + *p = c; + input_line_pointer++; + name = input_line_pointer; + c = get_symbol_end (); + arg_reloc = pa_build_arg_reloc (name); + call_desc->arg_reloc |= (arg_reloc & 0x3); + } + else + { + as_bad (_("Invalid .CALL argument: %s"), name); + } + p = input_line_pointer; + *p = c; + if (!is_end_of_statement ()) + input_line_pointer++; + } +} + +/* Return TRUE if FRAG1 and FRAG2 are the same. */ + +static int +is_same_frag (frag1, frag2) + fragS *frag1; + fragS *frag2; +{ + + if (frag1 == NULL) + return (FALSE); + else if (frag2 == NULL) + return (FALSE); + else if (frag1 == frag2) + return (TRUE); + else if (frag2->fr_type == rs_fill && frag2->fr_fix == 0) + return (is_same_frag (frag1, frag2->fr_next)); + else + return (FALSE); +} + +#ifdef OBJ_ELF +/* Build an entry in the UNWIND subspace from the given function + attributes in CALL_INFO. This is not needed for SOM as using + R_ENTRY and R_EXIT relocations allow the linker to handle building + of the unwind spaces. */ + +static void +pa_build_unwind_subspace (call_info) + struct call_info *call_info; +{ + asection *seg, *save_seg; + subsegT save_subseg; + unsigned int unwind; + int reloc; + char *p; + + if ((bfd_get_section_flags (stdoutput, now_seg) + & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) + != (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) + return; + + reloc = R_PARISC_SEGREL32; + save_seg = now_seg; + save_subseg = now_subseg; + /* Get into the right seg/subseg. This may involve creating + the seg the first time through. Make sure to have the + old seg/subseg so that we can reset things when we are done. */ + seg = bfd_get_section_by_name (stdoutput, UNWIND_SECTION_NAME); + if (seg == ASEC_NULL) + { + seg = subseg_new (UNWIND_SECTION_NAME, 0); + bfd_set_section_flags (stdoutput, seg, + SEC_READONLY | SEC_HAS_CONTENTS + | SEC_LOAD | SEC_RELOC | SEC_ALLOC | SEC_DATA); + bfd_set_section_alignment (stdoutput, seg, 2); + } + + subseg_set (seg, 0); + + /* Get some space to hold relocation information for the unwind + descriptor. */ + p = frag_more (16); + + /* Relocation info. for start offset of the function. */ + md_number_to_chars (p, 0, 4); + fix_new_hppa (frag_now, p - frag_now->fr_literal, 4, + call_info->start_symbol, (offsetT) 0, + (expressionS *) NULL, 0, reloc, + e_fsel, 32, 0, 0); + + /* Relocation info. for end offset of the function. + + Because we allow reductions of 32bit relocations for ELF, this will be + reduced to section_sym + offset which avoids putting the temporary + symbol into the symbol table. It (should) end up giving the same + value as call_info->start_symbol + function size once the linker is + finished with its work. */ + md_number_to_chars (p + 4, 0, 4); + fix_new_hppa (frag_now, p + 4 - frag_now->fr_literal, 4, + call_info->end_symbol, (offsetT) 0, + (expressionS *) NULL, 0, reloc, + e_fsel, 32, 0, 0); + + /* Dump the descriptor. */ + unwind = UNWIND_LOW32 (&call_info->ci_unwind.descriptor); + md_number_to_chars (p + 8, unwind, 4); + + unwind = UNWIND_HIGH32 (&call_info->ci_unwind.descriptor); + md_number_to_chars (p + 12, unwind, 4); + + /* Return back to the original segment/subsegment. */ + subseg_set (save_seg, save_subseg); +} +#endif + +/* Process a .CALLINFO pseudo-op. This information is used later + to build unwind descriptors and maybe one day to support + .ENTER and .LEAVE. */ + +static void +pa_callinfo (unused) + int unused ATTRIBUTE_UNUSED; +{ + char *name, c, *p; + int temp; + +#ifdef OBJ_SOM + /* We must have a valid space and subspace. */ + pa_check_current_space_and_subspace (); +#endif + + /* .CALLINFO must appear within a procedure definition. */ + if (!within_procedure) + as_bad (_(".callinfo is not within a procedure definition")); + + /* Mark the fact that we found the .CALLINFO for the + current procedure. */ + callinfo_found = TRUE; + + /* Iterate over the .CALLINFO arguments. */ + while (!is_end_of_statement ()) + { + name = input_line_pointer; + c = get_symbol_end (); + /* Frame size specification. */ + if ((strncasecmp (name, "frame", 5) == 0)) + { + p = input_line_pointer; + *p = c; + input_line_pointer++; + temp = get_absolute_expression (); + if ((temp & 0x3) != 0) + { + as_bad (_("FRAME parameter must be a multiple of 8: %d\n"), temp); + temp = 0; + } + + /* callinfo is in bytes and unwind_desc is in 8 byte units. */ + last_call_info->ci_unwind.descriptor.frame_size = temp / 8; + + } + /* Entry register (GR, GR and SR) specifications. */ + else if ((strncasecmp (name, "entry_gr", 8) == 0)) + { + p = input_line_pointer; + *p = c; + input_line_pointer++; + temp = get_absolute_expression (); + /* The HP assembler accepts 19 as the high bound for ENTRY_GR + even though %r19 is caller saved. I think this is a bug in + the HP assembler, and we are not going to emulate it. */ + if (temp < 3 || temp > 18) + as_bad (_("Value for ENTRY_GR must be in the range 3..18\n")); + last_call_info->ci_unwind.descriptor.entry_gr = temp - 2; + } + else if ((strncasecmp (name, "entry_fr", 8) == 0)) + { + p = input_line_pointer; + *p = c; + input_line_pointer++; + temp = get_absolute_expression (); + /* Similarly the HP assembler takes 31 as the high bound even + though %fr21 is the last callee saved floating point register. */ + if (temp < 12 || temp > 21) + as_bad (_("Value for ENTRY_FR must be in the range 12..21\n")); + last_call_info->ci_unwind.descriptor.entry_fr = temp - 11; + } + else if ((strncasecmp (name, "entry_sr", 8) == 0)) + { + p = input_line_pointer; + *p = c; + input_line_pointer++; + temp = get_absolute_expression (); + if (temp != 3) + as_bad (_("Value for ENTRY_SR must be 3\n")); + } + /* Note whether or not this function performs any calls. */ + else if ((strncasecmp (name, "calls", 5) == 0) || + (strncasecmp (name, "caller", 6) == 0)) + { + p = input_line_pointer; + *p = c; + } + else if ((strncasecmp (name, "no_calls", 8) == 0)) + { + p = input_line_pointer; + *p = c; + } + /* Should RP be saved into the stack. */ + else if ((strncasecmp (name, "save_rp", 7) == 0)) + { + p = input_line_pointer; + *p = c; + last_call_info->ci_unwind.descriptor.save_rp = 1; + } + /* Likewise for SP. */ + else if ((strncasecmp (name, "save_sp", 7) == 0)) + { + p = input_line_pointer; + *p = c; + last_call_info->ci_unwind.descriptor.save_sp = 1; + } + /* Is this an unwindable procedure. If so mark it so + in the unwind descriptor. */ + else if ((strncasecmp (name, "no_unwind", 9) == 0)) + { + p = input_line_pointer; + *p = c; + last_call_info->ci_unwind.descriptor.cannot_unwind = 1; + } + /* Is this an interrupt routine. If so mark it in the + unwind descriptor. */ + else if ((strncasecmp (name, "hpux_int", 7) == 0)) + { + p = input_line_pointer; + *p = c; + last_call_info->ci_unwind.descriptor.hpux_interrupt_marker = 1; + } + /* Is this a millicode routine. "millicode" isn't in my + assembler manual, but my copy is old. The HP assembler + accepts it, and there's a place in the unwind descriptor + to drop the information, so we'll accept it too. */ + else if ((strncasecmp (name, "millicode", 9) == 0)) + { + p = input_line_pointer; + *p = c; + last_call_info->ci_unwind.descriptor.millicode = 1; + } + else + { + as_bad (_("Invalid .CALLINFO argument: %s"), name); + *input_line_pointer = c; + } + if (!is_end_of_statement ()) + input_line_pointer++; + } + + demand_empty_rest_of_line (); +} + +#if !(defined (OBJ_ELF) && (defined (TE_LINUX) || defined (TE_NetBSD))) +/* Switch to the text space. Like s_text, but delete our + label when finished. */ +static void +pa_text (unused) + int unused ATTRIBUTE_UNUSED; +{ +#ifdef OBJ_SOM + current_space = is_defined_space ("$TEXT$"); + current_subspace + = pa_subsegment_to_subspace (current_space->sd_seg, 0); +#endif + + s_text (0); + pa_undefine_label (); +} + +/* Switch to the data space. As usual delete our label. */ +static void +pa_data (unused) + int unused ATTRIBUTE_UNUSED; +{ +#ifdef OBJ_SOM + current_space = is_defined_space ("$PRIVATE$"); + current_subspace + = pa_subsegment_to_subspace (current_space->sd_seg, 0); +#endif + s_data (0); + pa_undefine_label (); +} + +/* This is different than the standard GAS s_comm(). On HP9000/800 machines, + the .comm pseudo-op has the following symtax: + +